diff --git a/dashboard/src/main/home/project-settings/BillingPage.tsx b/dashboard/src/main/home/project-settings/BillingPage.tsx index 4095904a5b..a02763f6cc 100644 --- a/dashboard/src/main/home/project-settings/BillingPage.tsx +++ b/dashboard/src/main/home/project-settings/BillingPage.tsx @@ -57,19 +57,6 @@ function BillingPage(): JSX.Element { const { usage } = useCustomerUsage("day", true); - const trialEnding = (starting_on: string, ending_before: string): string => { - if (ending_before === undefined) { - return ""; - } - - const diff = dayjs(ending_before).diff(dayjs()); - if (diff <= 0) { - return `Started on ${readableDate(starting_on)}`; - } - - return `Free trial ends ${dayjs().to(dayjs(ending_before))}`; - }; - const processedData = useMemo(() => { const before = usage; const resultMap = new Map(); @@ -270,8 +257,8 @@ function BillingPage(): JSX.Element { {usage?.length && - usage.length > 0 && - usage[0].usage_metrics.length > 0 ? ( + usage.length > 0 && + usage[0].usage_metrics.length > 0 ? ( You have referred{" "} - {referralDetails ? referralDetails.referral_count : "?"}/10 users. + {referralDetails ? referralDetails.referral_count : "?"}/{referralDetails?.max_allowed_referrals} users. )} diff --git a/dashboard/src/shared/types.tsx b/dashboard/src/shared/types.tsx index 30a80a2ade..f623a998a0 100644 --- a/dashboard/src/shared/types.tsx +++ b/dashboard/src/shared/types.tsx @@ -289,15 +289,15 @@ export type FormElement = { export type RepoType = { FullName: string; } & ( - | { + | { Kind: "github"; GHRepoID: number; } - | { + | { Kind: "gitlab"; GitIntegrationId: number; } -); + ); export type FileType = { path: string; @@ -344,6 +344,7 @@ export type ProjectType = { user_id: number; project_id: number; }>; + referral_code: string; }; export type ChoiceType = { @@ -379,15 +380,15 @@ export type ActionConfigType = { image_repo_uri: string; dockerfile_path?: string; } & ( - | { + | { kind: "gitlab"; gitlab_integration_id: number; } - | { + | { kind: "github"; git_repo_id: number; } -); + ); export type GithubActionConfigType = ActionConfigType & { kind: "github"; diff --git a/internal/billing/metronome.go b/internal/billing/metronome.go index fa9f5bc3b4..7b2356c92e 100644 --- a/internal/billing/metronome.go +++ b/internal/billing/metronome.go @@ -272,12 +272,9 @@ func (m MetronomeClient) CreateCreditsGrant(ctx context.Context, customerID uuid return telemetry.Error(ctx, span, err, "failed to get credit type id") } - // Uniqueness key is used to prevent duplicate grants - uniquenessKey := fmt.Sprintf("%s-referral-reward", customerID) - req := types.CreateCreditsGrantRequest{ CustomerID: customerID, - UniquenessKey: uniquenessKey, + UniquenessKey: uuid.NewString(), GrantAmount: types.GrantAmountID{ Amount: grantAmount, CreditTypeID: creditTypeID,