File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
clerk-js/src/core/modules/commerce Expand file tree Collapse file tree 3 files changed +16
-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
+ Add ` getPlan ` by id to the billing namespace.
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import type {
4
4
CommerceCheckoutJSON ,
5
5
CommercePaymentJSON ,
6
6
CommercePaymentResource ,
7
+ CommercePlanJSON ,
7
8
CommercePlanResource ,
8
9
CommerceProductJSON ,
9
10
CommerceStatementJSON ,
@@ -39,6 +40,14 @@ export class CommerceBilling implements CommerceBillingNamespace {
39
40
return defaultProduct ?. plans . map ( plan => new CommercePlan ( plan ) ) || [ ] ;
40
41
} ;
41
42
43
+ getPlan = async ( params : { id : string } ) : Promise < CommercePlanResource > => {
44
+ const plan = ( await BaseResource . _fetch ( {
45
+ path : `/commerce/plans/${ params . id } ` ,
46
+ method : 'GET' ,
47
+ } ) ) as unknown as CommercePlanJSON ;
48
+ return new CommercePlan ( plan ) ;
49
+ } ;
50
+
42
51
getSubscriptions = async (
43
52
params : GetSubscriptionsParams ,
44
53
) : Promise < ClerkPaginatedResponse < CommerceSubscriptionResource > > => {
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ type WithOptionalOrgType<T> = T & {
10
10
export interface CommerceBillingNamespace {
11
11
getPaymentAttempts : ( params : GetPaymentAttemptsParams ) => Promise < ClerkPaginatedResponse < CommercePaymentResource > > ;
12
12
getPlans : ( params ?: GetPlansParams ) => Promise < CommercePlanResource [ ] > ;
13
+ getPlan : ( params : { id : string } ) => Promise < CommercePlanResource > ;
13
14
getSubscriptions : ( params : GetSubscriptionsParams ) => Promise < ClerkPaginatedResponse < CommerceSubscriptionResource > > ;
14
15
getStatements : ( params : GetStatementsParams ) => Promise < ClerkPaginatedResponse < CommerceStatementResource > > ;
15
16
startCheckout : ( params : CreateCheckoutParams ) => Promise < CommerceCheckoutResource > ;
You can’t perform that action at this time.
0 commit comments