Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/violet-games-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': patch
---

Add missing fields to CommercePlan type.
16 changes: 16 additions & 0 deletions packages/backend/src/api/resources/CommercePlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ export class BillingPlan {
* The features the Plan offers.
*/
readonly features: Feature[],
/**
* The URL of the Plan's avatar image.
*/
readonly avatarUrl: string | null,
/**
* Number of free trial days for this plan.
*/
readonly freeTrialDays: number | null,
/**
* Whether free trial is enabled for this plan.
*/
readonly freeTrialEnabled: boolean,
) {}

static fromJSON(data: BillingPlanJSON): BillingPlan {
Expand All @@ -79,6 +91,7 @@ export class BillingPlan {
: null
) as T extends null ? null : BillingMoneyAmount;
};

return new BillingPlan(
data.id,
data.name,
Expand All @@ -93,6 +106,9 @@ export class BillingPlan {
formatAmountJSON(data.annual_monthly_fee),
data.for_payer_type,
(data.features ?? []).map(feature => Feature.fromJSON(feature)),
data.avatar_url,
data.free_trial_days,
data.free_trial_enabled,
);
}
}
3 changes: 3 additions & 0 deletions packages/backend/src/api/resources/JSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,9 @@ export interface BillingPlanJSON extends ClerkResourceJSON {
annual_monthly_fee: BillingMoneyAmountJSON | null;
for_payer_type: 'org' | 'user';
features?: FeatureJSON[];
free_trial_days: number | null;
free_trial_enabled: boolean;
avatar_url: string | null;
}

type BillingSubscriptionItemStatus =
Expand Down
Loading