Skip to content

Commit 7b6dcee

Browse files
authored
chore(clerk-js,types): Strict type for CommerceCheckout.status (#6474)
1 parent ef87617 commit 7b6dcee

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.changeset/nasty-shirts-behave.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': minor
3+
'@clerk/types': minor
4+
---
5+
6+
[Billing Beta] Update checkout.status type to be `'needs_confirmation' | 'completed'` instead of `string`.

packages/clerk-js/src/core/resources/CommerceCheckout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class CommerceCheckout extends BaseResource implements CommerceCheckoutRe
1818
plan!: CommercePlan;
1919
planPeriod!: CommerceSubscriptionPlanPeriod;
2020
planPeriodStart!: number | undefined;
21-
status!: string;
21+
status!: 'needs_confirmation' | 'completed';
2222
totals!: CommerceCheckoutTotals;
2323
isImmediatePlanChange!: boolean;
2424

packages/types/src/commerce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ export interface CommerceCheckoutResource extends ClerkResource {
15031503
* <ClerkProvider clerkJsVersion="x.x.x" />
15041504
* ```
15051505
*/
1506-
status: string;
1506+
status: 'needs_confirmation' | 'completed';
15071507
/**
15081508
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change.
15091509
* It is advised to pin the SDK version and the clerk-js version to a specific version to avoid breaking changes.

packages/types/src/json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ export interface CommerceCheckoutJSON extends ClerkResourceJSON {
870870
plan: CommercePlanJSON;
871871
plan_period: CommerceSubscriptionPlanPeriod;
872872
plan_period_start?: number;
873-
status: string;
873+
status: 'needs_confirmation' | 'completed';
874874
totals: CommerceCheckoutTotalsJSON;
875875
is_immediate_plan_change: boolean;
876876
}

0 commit comments

Comments
 (0)