File tree Expand file tree Collapse file tree 4 files changed +32
-0
lines changed
clerk-js/src/core/resources Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @clerk/clerk-js ' : minor
3
+ ' @clerk/types ' : minor
4
+ ---
5
+
6
+ Update billing resources with trial properties.
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export class CommerceSubscription extends BaseResource implements CommerceSubscr
27
27
date : Date ;
28
28
} | null = null ;
29
29
subscriptionItems ! : CommerceSubscriptionItemResource [ ] ;
30
+ eligibleForFreeTrial ?: boolean ;
30
31
31
32
constructor ( data : CommerceSubscriptionJSON ) {
32
33
super ( ) ;
@@ -51,6 +52,7 @@ export class CommerceSubscription extends BaseResource implements CommerceSubscr
51
52
}
52
53
: null ;
53
54
this . subscriptionItems = ( data . subscription_items || [ ] ) . map ( item => new CommerceSubscriptionItem ( item ) ) ;
55
+ this . eligibleForFreeTrial = data . eligible_for_free_trial ;
54
56
return this ;
55
57
}
56
58
}
@@ -71,6 +73,7 @@ export class CommerceSubscriptionItem extends BaseResource implements CommerceSu
71
73
credit ?: {
72
74
amount : CommerceMoney ;
73
75
} ;
76
+ isFreeTrial = false ;
74
77
75
78
constructor ( data : CommerceSubscriptionItemJSON ) {
76
79
super ( ) ;
@@ -97,6 +100,8 @@ export class CommerceSubscriptionItem extends BaseResource implements CommerceSu
97
100
98
101
this . amount = data . amount ? commerceMoneyFromJSON ( data . amount ) : undefined ;
99
102
this . credit = data . credit && data . credit . amount ? { amount : commerceMoneyFromJSON ( data . credit . amount ) } : undefined ;
103
+
104
+ this . isFreeTrial = this . withDefault ( data . is_free_trial , false ) ;
100
105
return this ;
101
106
}
102
107
Original file line number Diff line number Diff line change @@ -1094,6 +1094,15 @@ export interface CommerceSubscriptionItemResource extends ClerkResource {
1094
1094
* ```
1095
1095
*/
1096
1096
cancel : ( params : CancelSubscriptionParams ) => Promise < DeletedObjectResource > ;
1097
+ /**
1098
+ * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change.
1099
+ * It is advised to pin the SDK version and the clerk-js version to a specific version to avoid breaking changes.
1100
+ * @example
1101
+ * ```tsx
1102
+ * <ClerkProvider clerkJsVersion="x.x.x" />
1103
+ * ```
1104
+ */
1105
+ isFreeTrial : boolean ;
1097
1106
}
1098
1107
1099
1108
/**
@@ -1203,6 +1212,16 @@ export interface CommerceSubscriptionResource extends ClerkResource {
1203
1212
* ```
1204
1213
*/
1205
1214
updatedAt : Date | null ;
1215
+
1216
+ /**
1217
+ * @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change.
1218
+ * It is advised to pin the SDK version and the clerk-js version to a specific version to avoid breaking changes.
1219
+ * @example
1220
+ * ```tsx
1221
+ * <ClerkProvider clerkJsVersion="x.x.x" />
1222
+ * ```
1223
+ */
1224
+ eligibleForFreeTrial ?: boolean ;
1206
1225
}
1207
1226
1208
1227
/**
Original file line number Diff line number Diff line change @@ -783,6 +783,7 @@ export interface CommerceSubscriptionItemJSON extends ClerkResourceJSON {
783
783
period_end : number | null ;
784
784
canceled_at : number | null ;
785
785
past_due_at : number | null ;
786
+ is_free_trial : boolean ;
786
787
}
787
788
788
789
/**
@@ -812,6 +813,7 @@ export interface CommerceSubscriptionJSON extends ClerkResourceJSON {
812
813
updated_at : number | null ;
813
814
past_due_at : number | null ;
814
815
subscription_items : CommerceSubscriptionItemJSON [ ] | null ;
816
+ eligible_for_free_trial ?: boolean ;
815
817
}
816
818
817
819
/**
You can’t perform that action at this time.
0 commit comments