@polar-sh/sdk 0.36.1 → 0.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -19
- package/bin/mcp-server.js +224 -66
- package/bin/mcp-server.js.map +8 -8
- package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
- package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
- package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js +110 -0
- package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/commonjs/models/components/checkout.d.ts +5 -0
- package/dist/commonjs/models/components/checkout.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkout.js +4 -0
- package/dist/commonjs/models/components/checkout.js.map +1 -1
- package/dist/commonjs/models/components/checkoutcreate.d.ts +5 -0
- package/dist/commonjs/models/components/checkoutcreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkoutcreate.js +4 -0
- package/dist/commonjs/models/components/checkoutcreate.js.map +1 -1
- package/dist/commonjs/models/components/checkoutpublic.d.ts +5 -0
- package/dist/commonjs/models/components/checkoutpublic.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkoutpublic.js +4 -0
- package/dist/commonjs/models/components/checkoutpublic.js.map +1 -1
- package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts +5 -0
- package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkoutpublicconfirmed.js +4 -0
- package/dist/commonjs/models/components/checkoutpublicconfirmed.js.map +1 -1
- package/dist/commonjs/models/components/checkoutupdate.d.ts +5 -0
- package/dist/commonjs/models/components/checkoutupdate.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkoutupdate.js +4 -0
- package/dist/commonjs/models/components/checkoutupdate.js.map +1 -1
- package/dist/commonjs/models/components/customercustomersession.d.ts +31 -0
- package/dist/commonjs/models/components/customercustomersession.d.ts.map +1 -0
- package/dist/commonjs/models/components/customercustomersession.js +82 -0
- package/dist/commonjs/models/components/customercustomersession.js.map +1 -0
- package/dist/commonjs/models/components/customersession.d.ts +2 -0
- package/dist/commonjs/models/components/customersession.d.ts.map +1 -1
- package/dist/commonjs/models/components/customersession.js +4 -0
- package/dist/commonjs/models/components/customersession.js.map +1 -1
- package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
- package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js +4 -0
- package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
- package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts +5 -0
- package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/customersessioncustomeridcreate.js +4 -0
- package/dist/commonjs/models/components/customersessioncustomeridcreate.js.map +1 -1
- package/dist/commonjs/models/components/productcreateonetime.d.ts +44 -4
- package/dist/commonjs/models/components/productcreateonetime.d.ts.map +1 -1
- package/dist/commonjs/models/components/productcreateonetime.js +60 -20
- package/dist/commonjs/models/components/productcreateonetime.js.map +1 -1
- package/dist/commonjs/models/components/productcreaterecurring.d.ts +44 -4
- package/dist/commonjs/models/components/productcreaterecurring.d.ts.map +1 -1
- package/dist/commonjs/models/components/productcreaterecurring.js +60 -20
- package/dist/commonjs/models/components/productcreaterecurring.js.map +1 -1
- package/dist/commonjs/models/components/productupdate.d.ts +85 -4
- package/dist/commonjs/models/components/productupdate.d.ts.map +1 -1
- package/dist/commonjs/models/components/productupdate.js +117 -21
- package/dist/commonjs/models/components/productupdate.js.map +1 -1
- package/dist/commonjs/models/components/webtokenrequest.d.ts +67 -0
- package/dist/commonjs/models/components/webtokenrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/webtokenrequest.js +117 -0
- package/dist/commonjs/models/components/webtokenrequest.js.map +1 -0
- package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
- package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
- package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js +78 -0
- package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
- package/dist/commonjs/models/operations/oauth2requesttoken.d.ts +3 -2
- package/dist/commonjs/models/operations/oauth2requesttoken.d.ts.map +1 -1
- package/dist/commonjs/models/operations/oauth2requesttoken.js +3 -0
- package/dist/commonjs/models/operations/oauth2requesttoken.js.map +1 -1
- package/dist/commonjs/sdk/customerportal.d.ts +3 -0
- package/dist/commonjs/sdk/customerportal.d.ts.map +1 -1
- package/dist/commonjs/sdk/customerportal.js +4 -0
- package/dist/commonjs/sdk/customerportal.js.map +1 -1
- package/dist/commonjs/sdk/customersession.d.ts +15 -0
- package/dist/commonjs/sdk/customersession.d.ts.map +1 -0
- package/dist/commonjs/sdk/customersession.js +24 -0
- package/dist/commonjs/sdk/customersession.js.map +1 -0
- package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
- package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
- package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js +74 -0
- package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/dist/esm/models/components/checkout.d.ts +5 -0
- package/dist/esm/models/components/checkout.d.ts.map +1 -1
- package/dist/esm/models/components/checkout.js +4 -0
- package/dist/esm/models/components/checkout.js.map +1 -1
- package/dist/esm/models/components/checkoutcreate.d.ts +5 -0
- package/dist/esm/models/components/checkoutcreate.d.ts.map +1 -1
- package/dist/esm/models/components/checkoutcreate.js +4 -0
- package/dist/esm/models/components/checkoutcreate.js.map +1 -1
- package/dist/esm/models/components/checkoutpublic.d.ts +5 -0
- package/dist/esm/models/components/checkoutpublic.d.ts.map +1 -1
- package/dist/esm/models/components/checkoutpublic.js +4 -0
- package/dist/esm/models/components/checkoutpublic.js.map +1 -1
- package/dist/esm/models/components/checkoutpublicconfirmed.d.ts +5 -0
- package/dist/esm/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
- package/dist/esm/models/components/checkoutpublicconfirmed.js +4 -0
- package/dist/esm/models/components/checkoutpublicconfirmed.js.map +1 -1
- package/dist/esm/models/components/checkoutupdate.d.ts +5 -0
- package/dist/esm/models/components/checkoutupdate.d.ts.map +1 -1
- package/dist/esm/models/components/checkoutupdate.js +4 -0
- package/dist/esm/models/components/checkoutupdate.js.map +1 -1
- package/dist/esm/models/components/customercustomersession.d.ts +31 -0
- package/dist/esm/models/components/customercustomersession.d.ts.map +1 -0
- package/dist/esm/models/components/customercustomersession.js +44 -0
- package/dist/esm/models/components/customercustomersession.js.map +1 -0
- package/dist/esm/models/components/customersession.d.ts +2 -0
- package/dist/esm/models/components/customersession.d.ts.map +1 -1
- package/dist/esm/models/components/customersession.js +4 -0
- package/dist/esm/models/components/customersession.js.map +1 -1
- package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
- package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
- package/dist/esm/models/components/customersessioncustomerexternalidcreate.js +4 -0
- package/dist/esm/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
- package/dist/esm/models/components/customersessioncustomeridcreate.d.ts +5 -0
- package/dist/esm/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
- package/dist/esm/models/components/customersessioncustomeridcreate.js +4 -0
- package/dist/esm/models/components/customersessioncustomeridcreate.js.map +1 -1
- package/dist/esm/models/components/productcreateonetime.d.ts +44 -4
- package/dist/esm/models/components/productcreateonetime.d.ts.map +1 -1
- package/dist/esm/models/components/productcreateonetime.js +60 -20
- package/dist/esm/models/components/productcreateonetime.js.map +1 -1
- package/dist/esm/models/components/productcreaterecurring.d.ts +44 -4
- package/dist/esm/models/components/productcreaterecurring.d.ts.map +1 -1
- package/dist/esm/models/components/productcreaterecurring.js +60 -20
- package/dist/esm/models/components/productcreaterecurring.js.map +1 -1
- package/dist/esm/models/components/productupdate.d.ts +85 -4
- package/dist/esm/models/components/productupdate.d.ts.map +1 -1
- package/dist/esm/models/components/productupdate.js +114 -20
- package/dist/esm/models/components/productupdate.js.map +1 -1
- package/dist/esm/models/components/webtokenrequest.d.ts +67 -0
- package/dist/esm/models/components/webtokenrequest.d.ts.map +1 -0
- package/dist/esm/models/components/webtokenrequest.js +79 -0
- package/dist/esm/models/components/webtokenrequest.js.map +1 -0
- package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
- package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
- package/dist/esm/models/operations/customerportalcustomersessionintrospect.js +40 -0
- package/dist/esm/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
- package/dist/esm/models/operations/oauth2requesttoken.d.ts +3 -2
- package/dist/esm/models/operations/oauth2requesttoken.d.ts.map +1 -1
- package/dist/esm/models/operations/oauth2requesttoken.js +3 -0
- package/dist/esm/models/operations/oauth2requesttoken.js.map +1 -1
- package/dist/esm/sdk/customerportal.d.ts +3 -0
- package/dist/esm/sdk/customerportal.d.ts.map +1 -1
- package/dist/esm/sdk/customerportal.js +4 -0
- package/dist/esm/sdk/customerportal.js.map +1 -1
- package/dist/esm/sdk/customersession.d.ts +15 -0
- package/dist/esm/sdk/customersession.d.ts.map +1 -0
- package/dist/esm/sdk/customersession.js +20 -0
- package/dist/esm/sdk/customersession.js.map +1 -0
- package/docs/sdks/customersession/README.md +79 -0
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/customerPortalCustomerSessionIntrospect.ts +157 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/components/checkout.ts +9 -0
- package/src/models/components/checkoutcreate.ts +9 -0
- package/src/models/components/checkoutpublic.ts +9 -0
- package/src/models/components/checkoutpublicconfirmed.ts +9 -0
- package/src/models/components/checkoutupdate.ts +9 -0
- package/src/models/components/customercustomersession.ts +81 -0
- package/src/models/components/customersession.ts +6 -0
- package/src/models/components/customersessioncustomerexternalidcreate.ts +9 -0
- package/src/models/components/customersessioncustomeridcreate.ts +9 -0
- package/src/models/components/productcreateonetime.ts +120 -40
- package/src/models/components/productcreaterecurring.ts +120 -40
- package/src/models/components/productupdate.ts +233 -40
- package/src/models/components/webtokenrequest.ts +133 -0
- package/src/models/operations/customerportalcustomersessionintrospect.ts +89 -0
- package/src/models/operations/oauth2requesttoken.ts +12 -2
- package/src/sdk/customerportal.ts +6 -0
- package/src/sdk/customersession.ts +30 -0
|
@@ -140,6 +140,10 @@ export type Checkout = {
|
|
|
140
140
|
* URL where the customer will be redirected after a successful payment.
|
|
141
141
|
*/
|
|
142
142
|
successUrl: string;
|
|
143
|
+
/**
|
|
144
|
+
* When set, a back button will be shown in the checkout to return to this URL.
|
|
145
|
+
*/
|
|
146
|
+
returnUrl: string | null;
|
|
143
147
|
/**
|
|
144
148
|
* When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.
|
|
145
149
|
*/
|
|
@@ -590,6 +594,7 @@ export const Checkout$inboundSchema: z.ZodType<
|
|
|
590
594
|
url: z.string(),
|
|
591
595
|
expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
592
596
|
success_url: z.string(),
|
|
597
|
+
return_url: z.nullable(z.string()),
|
|
593
598
|
embed_origin: z.nullable(z.string()),
|
|
594
599
|
amount: z.number().int(),
|
|
595
600
|
seats: z.nullable(z.number().int()).optional(),
|
|
@@ -659,6 +664,7 @@ export const Checkout$inboundSchema: z.ZodType<
|
|
|
659
664
|
"client_secret": "clientSecret",
|
|
660
665
|
"expires_at": "expiresAt",
|
|
661
666
|
"success_url": "successUrl",
|
|
667
|
+
"return_url": "returnUrl",
|
|
662
668
|
"embed_origin": "embedOrigin",
|
|
663
669
|
"price_per_seat": "pricePerSeat",
|
|
664
670
|
"discount_amount": "discountAmount",
|
|
@@ -713,6 +719,7 @@ export type Checkout$Outbound = {
|
|
|
713
719
|
url: string;
|
|
714
720
|
expires_at: string;
|
|
715
721
|
success_url: string;
|
|
722
|
+
return_url: string | null;
|
|
716
723
|
embed_origin: string | null;
|
|
717
724
|
amount: number;
|
|
718
725
|
seats?: number | null | undefined;
|
|
@@ -789,6 +796,7 @@ export const Checkout$outboundSchema: z.ZodType<
|
|
|
789
796
|
url: z.string(),
|
|
790
797
|
expiresAt: z.date().transform(v => v.toISOString()),
|
|
791
798
|
successUrl: z.string(),
|
|
799
|
+
returnUrl: z.nullable(z.string()),
|
|
792
800
|
embedOrigin: z.nullable(z.string()),
|
|
793
801
|
amount: z.number().int(),
|
|
794
802
|
seats: z.nullable(z.number().int()).optional(),
|
|
@@ -856,6 +864,7 @@ export const Checkout$outboundSchema: z.ZodType<
|
|
|
856
864
|
clientSecret: "client_secret",
|
|
857
865
|
expiresAt: "expires_at",
|
|
858
866
|
successUrl: "success_url",
|
|
867
|
+
returnUrl: "return_url",
|
|
859
868
|
embedOrigin: "embed_origin",
|
|
860
869
|
pricePerSeat: "price_per_seat",
|
|
861
870
|
discountAmount: "discount_amount",
|
|
@@ -126,6 +126,10 @@ export type CheckoutCreate = {
|
|
|
126
126
|
* URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id.
|
|
127
127
|
*/
|
|
128
128
|
successUrl?: string | null | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* When set, a back button will be shown in the checkout to return to this URL.
|
|
131
|
+
*/
|
|
132
|
+
returnUrl?: string | null | undefined;
|
|
129
133
|
/**
|
|
130
134
|
* If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page.
|
|
131
135
|
*/
|
|
@@ -346,6 +350,7 @@ export const CheckoutCreate$inboundSchema: z.ZodType<
|
|
|
346
350
|
).optional(),
|
|
347
351
|
subscription_id: z.nullable(z.string()).optional(),
|
|
348
352
|
success_url: z.nullable(z.string()).optional(),
|
|
353
|
+
return_url: z.nullable(z.string()).optional(),
|
|
349
354
|
embed_origin: z.nullable(z.string()).optional(),
|
|
350
355
|
products: z.array(z.string()),
|
|
351
356
|
}).transform((v) => {
|
|
@@ -368,6 +373,7 @@ export const CheckoutCreate$inboundSchema: z.ZodType<
|
|
|
368
373
|
"customer_metadata": "customerMetadata",
|
|
369
374
|
"subscription_id": "subscriptionId",
|
|
370
375
|
"success_url": "successUrl",
|
|
376
|
+
"return_url": "returnUrl",
|
|
371
377
|
"embed_origin": "embedOrigin",
|
|
372
378
|
});
|
|
373
379
|
});
|
|
@@ -399,6 +405,7 @@ export type CheckoutCreate$Outbound = {
|
|
|
399
405
|
| undefined;
|
|
400
406
|
subscription_id?: string | null | undefined;
|
|
401
407
|
success_url?: string | null | undefined;
|
|
408
|
+
return_url?: string | null | undefined;
|
|
402
409
|
embed_origin?: string | null | undefined;
|
|
403
410
|
products: Array<string>;
|
|
404
411
|
};
|
|
@@ -443,6 +450,7 @@ export const CheckoutCreate$outboundSchema: z.ZodType<
|
|
|
443
450
|
).optional(),
|
|
444
451
|
subscriptionId: z.nullable(z.string()).optional(),
|
|
445
452
|
successUrl: z.nullable(z.string()).optional(),
|
|
453
|
+
returnUrl: z.nullable(z.string()).optional(),
|
|
446
454
|
embedOrigin: z.nullable(z.string()).optional(),
|
|
447
455
|
products: z.array(z.string()),
|
|
448
456
|
}).transform((v) => {
|
|
@@ -465,6 +473,7 @@ export const CheckoutCreate$outboundSchema: z.ZodType<
|
|
|
465
473
|
customerMetadata: "customer_metadata",
|
|
466
474
|
subscriptionId: "subscription_id",
|
|
467
475
|
successUrl: "success_url",
|
|
476
|
+
returnUrl: "return_url",
|
|
468
477
|
embedOrigin: "embed_origin",
|
|
469
478
|
});
|
|
470
479
|
});
|
|
@@ -144,6 +144,10 @@ export type CheckoutPublic = {
|
|
|
144
144
|
* URL where the customer will be redirected after a successful payment.
|
|
145
145
|
*/
|
|
146
146
|
successUrl: string;
|
|
147
|
+
/**
|
|
148
|
+
* When set, a back button will be shown in the checkout to return to this URL.
|
|
149
|
+
*/
|
|
150
|
+
returnUrl: string | null;
|
|
147
151
|
/**
|
|
148
152
|
* When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.
|
|
149
153
|
*/
|
|
@@ -482,6 +486,7 @@ export const CheckoutPublic$inboundSchema: z.ZodType<
|
|
|
482
486
|
url: z.string(),
|
|
483
487
|
expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
484
488
|
success_url: z.string(),
|
|
489
|
+
return_url: z.nullable(z.string()),
|
|
485
490
|
embed_origin: z.nullable(z.string()),
|
|
486
491
|
amount: z.number().int(),
|
|
487
492
|
seats: z.nullable(z.number().int()).optional(),
|
|
@@ -541,6 +546,7 @@ export const CheckoutPublic$inboundSchema: z.ZodType<
|
|
|
541
546
|
"client_secret": "clientSecret",
|
|
542
547
|
"expires_at": "expiresAt",
|
|
543
548
|
"success_url": "successUrl",
|
|
549
|
+
"return_url": "returnUrl",
|
|
544
550
|
"embed_origin": "embedOrigin",
|
|
545
551
|
"price_per_seat": "pricePerSeat",
|
|
546
552
|
"discount_amount": "discountAmount",
|
|
@@ -589,6 +595,7 @@ export type CheckoutPublic$Outbound = {
|
|
|
589
595
|
url: string;
|
|
590
596
|
expires_at: string;
|
|
591
597
|
success_url: string;
|
|
598
|
+
return_url: string | null;
|
|
592
599
|
embed_origin: string | null;
|
|
593
600
|
amount: number;
|
|
594
601
|
seats?: number | null | undefined;
|
|
@@ -659,6 +666,7 @@ export const CheckoutPublic$outboundSchema: z.ZodType<
|
|
|
659
666
|
url: z.string(),
|
|
660
667
|
expiresAt: z.date().transform(v => v.toISOString()),
|
|
661
668
|
successUrl: z.string(),
|
|
669
|
+
returnUrl: z.nullable(z.string()),
|
|
662
670
|
embedOrigin: z.nullable(z.string()),
|
|
663
671
|
amount: z.number().int(),
|
|
664
672
|
seats: z.nullable(z.number().int()).optional(),
|
|
@@ -716,6 +724,7 @@ export const CheckoutPublic$outboundSchema: z.ZodType<
|
|
|
716
724
|
clientSecret: "client_secret",
|
|
717
725
|
expiresAt: "expires_at",
|
|
718
726
|
successUrl: "success_url",
|
|
727
|
+
returnUrl: "return_url",
|
|
719
728
|
embedOrigin: "embed_origin",
|
|
720
729
|
pricePerSeat: "price_per_seat",
|
|
721
730
|
discountAmount: "discount_amount",
|
|
@@ -148,6 +148,10 @@ export type CheckoutPublicConfirmed = {
|
|
|
148
148
|
* URL where the customer will be redirected after a successful payment.
|
|
149
149
|
*/
|
|
150
150
|
successUrl: string;
|
|
151
|
+
/**
|
|
152
|
+
* When set, a back button will be shown in the checkout to return to this URL.
|
|
153
|
+
*/
|
|
154
|
+
returnUrl: string | null;
|
|
151
155
|
/**
|
|
152
156
|
* When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.
|
|
153
157
|
*/
|
|
@@ -498,6 +502,7 @@ export const CheckoutPublicConfirmed$inboundSchema: z.ZodType<
|
|
|
498
502
|
url: z.string(),
|
|
499
503
|
expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
500
504
|
success_url: z.string(),
|
|
505
|
+
return_url: z.nullable(z.string()),
|
|
501
506
|
embed_origin: z.nullable(z.string()),
|
|
502
507
|
amount: z.number().int(),
|
|
503
508
|
seats: z.nullable(z.number().int()).optional(),
|
|
@@ -558,6 +563,7 @@ export const CheckoutPublicConfirmed$inboundSchema: z.ZodType<
|
|
|
558
563
|
"client_secret": "clientSecret",
|
|
559
564
|
"expires_at": "expiresAt",
|
|
560
565
|
"success_url": "successUrl",
|
|
566
|
+
"return_url": "returnUrl",
|
|
561
567
|
"embed_origin": "embedOrigin",
|
|
562
568
|
"price_per_seat": "pricePerSeat",
|
|
563
569
|
"discount_amount": "discountAmount",
|
|
@@ -607,6 +613,7 @@ export type CheckoutPublicConfirmed$Outbound = {
|
|
|
607
613
|
url: string;
|
|
608
614
|
expires_at: string;
|
|
609
615
|
success_url: string;
|
|
616
|
+
return_url: string | null;
|
|
610
617
|
embed_origin: string | null;
|
|
611
618
|
amount: number;
|
|
612
619
|
seats?: number | null | undefined;
|
|
@@ -678,6 +685,7 @@ export const CheckoutPublicConfirmed$outboundSchema: z.ZodType<
|
|
|
678
685
|
url: z.string(),
|
|
679
686
|
expiresAt: z.date().transform(v => v.toISOString()),
|
|
680
687
|
successUrl: z.string(),
|
|
688
|
+
returnUrl: z.nullable(z.string()),
|
|
681
689
|
embedOrigin: z.nullable(z.string()),
|
|
682
690
|
amount: z.number().int(),
|
|
683
691
|
seats: z.nullable(z.number().int()).optional(),
|
|
@@ -736,6 +744,7 @@ export const CheckoutPublicConfirmed$outboundSchema: z.ZodType<
|
|
|
736
744
|
clientSecret: "client_secret",
|
|
737
745
|
expiresAt: "expires_at",
|
|
738
746
|
successUrl: "success_url",
|
|
747
|
+
returnUrl: "return_url",
|
|
739
748
|
embedOrigin: "embed_origin",
|
|
740
749
|
pricePerSeat: "price_per_seat",
|
|
741
750
|
discountAmount: "discount_amount",
|
|
@@ -116,6 +116,10 @@ export type CheckoutUpdate = {
|
|
|
116
116
|
* URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id.
|
|
117
117
|
*/
|
|
118
118
|
successUrl?: string | null | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* When set, a back button will be shown in the checkout to return to this URL.
|
|
121
|
+
*/
|
|
122
|
+
returnUrl?: string | null | undefined;
|
|
119
123
|
/**
|
|
120
124
|
* If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page.
|
|
121
125
|
*/
|
|
@@ -331,6 +335,7 @@ export const CheckoutUpdate$inboundSchema: z.ZodType<
|
|
|
331
335
|
z.record(z.union([z.string(), z.number().int(), z.number(), z.boolean()])),
|
|
332
336
|
).optional(),
|
|
333
337
|
success_url: z.nullable(z.string()).optional(),
|
|
338
|
+
return_url: z.nullable(z.string()).optional(),
|
|
334
339
|
embed_origin: z.nullable(z.string()).optional(),
|
|
335
340
|
}).transform((v) => {
|
|
336
341
|
return remap$(v, {
|
|
@@ -351,6 +356,7 @@ export const CheckoutUpdate$inboundSchema: z.ZodType<
|
|
|
351
356
|
"customer_ip_address": "customerIpAddress",
|
|
352
357
|
"customer_metadata": "customerMetadata",
|
|
353
358
|
"success_url": "successUrl",
|
|
359
|
+
"return_url": "returnUrl",
|
|
354
360
|
"embed_origin": "embedOrigin",
|
|
355
361
|
});
|
|
356
362
|
});
|
|
@@ -382,6 +388,7 @@ export type CheckoutUpdate$Outbound = {
|
|
|
382
388
|
| null
|
|
383
389
|
| undefined;
|
|
384
390
|
success_url?: string | null | undefined;
|
|
391
|
+
return_url?: string | null | undefined;
|
|
385
392
|
embed_origin?: string | null | undefined;
|
|
386
393
|
};
|
|
387
394
|
|
|
@@ -424,6 +431,7 @@ export const CheckoutUpdate$outboundSchema: z.ZodType<
|
|
|
424
431
|
z.record(z.union([z.string(), z.number().int(), z.number(), z.boolean()])),
|
|
425
432
|
).optional(),
|
|
426
433
|
successUrl: z.nullable(z.string()).optional(),
|
|
434
|
+
returnUrl: z.nullable(z.string()).optional(),
|
|
427
435
|
embedOrigin: z.nullable(z.string()).optional(),
|
|
428
436
|
}).transform((v) => {
|
|
429
437
|
return remap$(v, {
|
|
@@ -444,6 +452,7 @@ export const CheckoutUpdate$outboundSchema: z.ZodType<
|
|
|
444
452
|
customerIpAddress: "customer_ip_address",
|
|
445
453
|
customerMetadata: "customer_metadata",
|
|
446
454
|
successUrl: "success_url",
|
|
455
|
+
returnUrl: "return_url",
|
|
447
456
|
embedOrigin: "embed_origin",
|
|
448
457
|
});
|
|
449
458
|
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type CustomerCustomerSession = {
|
|
12
|
+
expiresAt: Date;
|
|
13
|
+
returnUrl: string | null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const CustomerCustomerSession$inboundSchema: z.ZodType<
|
|
18
|
+
CustomerCustomerSession,
|
|
19
|
+
z.ZodTypeDef,
|
|
20
|
+
unknown
|
|
21
|
+
> = z.object({
|
|
22
|
+
expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
23
|
+
return_url: z.nullable(z.string()),
|
|
24
|
+
}).transform((v) => {
|
|
25
|
+
return remap$(v, {
|
|
26
|
+
"expires_at": "expiresAt",
|
|
27
|
+
"return_url": "returnUrl",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export type CustomerCustomerSession$Outbound = {
|
|
33
|
+
expires_at: string;
|
|
34
|
+
return_url: string | null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export const CustomerCustomerSession$outboundSchema: z.ZodType<
|
|
39
|
+
CustomerCustomerSession$Outbound,
|
|
40
|
+
z.ZodTypeDef,
|
|
41
|
+
CustomerCustomerSession
|
|
42
|
+
> = z.object({
|
|
43
|
+
expiresAt: z.date().transform(v => v.toISOString()),
|
|
44
|
+
returnUrl: z.nullable(z.string()),
|
|
45
|
+
}).transform((v) => {
|
|
46
|
+
return remap$(v, {
|
|
47
|
+
expiresAt: "expires_at",
|
|
48
|
+
returnUrl: "return_url",
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
55
|
+
*/
|
|
56
|
+
export namespace CustomerCustomerSession$ {
|
|
57
|
+
/** @deprecated use `CustomerCustomerSession$inboundSchema` instead. */
|
|
58
|
+
export const inboundSchema = CustomerCustomerSession$inboundSchema;
|
|
59
|
+
/** @deprecated use `CustomerCustomerSession$outboundSchema` instead. */
|
|
60
|
+
export const outboundSchema = CustomerCustomerSession$outboundSchema;
|
|
61
|
+
/** @deprecated use `CustomerCustomerSession$Outbound` instead. */
|
|
62
|
+
export type Outbound = CustomerCustomerSession$Outbound;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function customerCustomerSessionToJSON(
|
|
66
|
+
customerCustomerSession: CustomerCustomerSession,
|
|
67
|
+
): string {
|
|
68
|
+
return JSON.stringify(
|
|
69
|
+
CustomerCustomerSession$outboundSchema.parse(customerCustomerSession),
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function customerCustomerSessionFromJSON(
|
|
74
|
+
jsonString: string,
|
|
75
|
+
): SafeParseResult<CustomerCustomerSession, SDKValidationError> {
|
|
76
|
+
return safeParse(
|
|
77
|
+
jsonString,
|
|
78
|
+
(x) => CustomerCustomerSession$inboundSchema.parse(JSON.parse(x)),
|
|
79
|
+
`Failed to parse 'CustomerCustomerSession' from JSON`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
@@ -32,6 +32,7 @@ export type CustomerSession = {
|
|
|
32
32
|
id: string;
|
|
33
33
|
token: string;
|
|
34
34
|
expiresAt: Date;
|
|
35
|
+
returnUrl: string | null;
|
|
35
36
|
customerPortalUrl: string;
|
|
36
37
|
customerId: string;
|
|
37
38
|
/**
|
|
@@ -53,6 +54,7 @@ export const CustomerSession$inboundSchema: z.ZodType<
|
|
|
53
54
|
id: z.string(),
|
|
54
55
|
token: z.string(),
|
|
55
56
|
expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
57
|
+
return_url: z.nullable(z.string()),
|
|
56
58
|
customer_portal_url: z.string(),
|
|
57
59
|
customer_id: z.string(),
|
|
58
60
|
customer: Customer$inboundSchema,
|
|
@@ -61,6 +63,7 @@ export const CustomerSession$inboundSchema: z.ZodType<
|
|
|
61
63
|
"created_at": "createdAt",
|
|
62
64
|
"modified_at": "modifiedAt",
|
|
63
65
|
"expires_at": "expiresAt",
|
|
66
|
+
"return_url": "returnUrl",
|
|
64
67
|
"customer_portal_url": "customerPortalUrl",
|
|
65
68
|
"customer_id": "customerId",
|
|
66
69
|
});
|
|
@@ -73,6 +76,7 @@ export type CustomerSession$Outbound = {
|
|
|
73
76
|
id: string;
|
|
74
77
|
token: string;
|
|
75
78
|
expires_at: string;
|
|
79
|
+
return_url: string | null;
|
|
76
80
|
customer_portal_url: string;
|
|
77
81
|
customer_id: string;
|
|
78
82
|
customer: Customer$Outbound;
|
|
@@ -89,6 +93,7 @@ export const CustomerSession$outboundSchema: z.ZodType<
|
|
|
89
93
|
id: z.string(),
|
|
90
94
|
token: z.string(),
|
|
91
95
|
expiresAt: z.date().transform(v => v.toISOString()),
|
|
96
|
+
returnUrl: z.nullable(z.string()),
|
|
92
97
|
customerPortalUrl: z.string(),
|
|
93
98
|
customerId: z.string(),
|
|
94
99
|
customer: Customer$outboundSchema,
|
|
@@ -97,6 +102,7 @@ export const CustomerSession$outboundSchema: z.ZodType<
|
|
|
97
102
|
createdAt: "created_at",
|
|
98
103
|
modifiedAt: "modified_at",
|
|
99
104
|
expiresAt: "expires_at",
|
|
105
|
+
returnUrl: "return_url",
|
|
100
106
|
customerPortalUrl: "customer_portal_url",
|
|
101
107
|
customerId: "customer_id",
|
|
102
108
|
});
|
|
@@ -12,6 +12,10 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
12
12
|
* Schema for creating a customer session using an external customer ID.
|
|
13
13
|
*/
|
|
14
14
|
export type CustomerSessionCustomerExternalIDCreate = {
|
|
15
|
+
/**
|
|
16
|
+
* When set, a back button will be shown in the customer portal to return to this URL.
|
|
17
|
+
*/
|
|
18
|
+
returnUrl?: string | null | undefined;
|
|
15
19
|
/**
|
|
16
20
|
* External ID of the customer to create a session for.
|
|
17
21
|
*/
|
|
@@ -24,15 +28,18 @@ export const CustomerSessionCustomerExternalIDCreate$inboundSchema: z.ZodType<
|
|
|
24
28
|
z.ZodTypeDef,
|
|
25
29
|
unknown
|
|
26
30
|
> = z.object({
|
|
31
|
+
return_url: z.nullable(z.string()).optional(),
|
|
27
32
|
external_customer_id: z.string(),
|
|
28
33
|
}).transform((v) => {
|
|
29
34
|
return remap$(v, {
|
|
35
|
+
"return_url": "returnUrl",
|
|
30
36
|
"external_customer_id": "externalCustomerId",
|
|
31
37
|
});
|
|
32
38
|
});
|
|
33
39
|
|
|
34
40
|
/** @internal */
|
|
35
41
|
export type CustomerSessionCustomerExternalIDCreate$Outbound = {
|
|
42
|
+
return_url?: string | null | undefined;
|
|
36
43
|
external_customer_id: string;
|
|
37
44
|
};
|
|
38
45
|
|
|
@@ -42,9 +49,11 @@ export const CustomerSessionCustomerExternalIDCreate$outboundSchema: z.ZodType<
|
|
|
42
49
|
z.ZodTypeDef,
|
|
43
50
|
CustomerSessionCustomerExternalIDCreate
|
|
44
51
|
> = z.object({
|
|
52
|
+
returnUrl: z.nullable(z.string()).optional(),
|
|
45
53
|
externalCustomerId: z.string(),
|
|
46
54
|
}).transform((v) => {
|
|
47
55
|
return remap$(v, {
|
|
56
|
+
returnUrl: "return_url",
|
|
48
57
|
externalCustomerId: "external_customer_id",
|
|
49
58
|
});
|
|
50
59
|
});
|
|
@@ -12,6 +12,10 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
12
12
|
* Schema for creating a customer session using a customer ID.
|
|
13
13
|
*/
|
|
14
14
|
export type CustomerSessionCustomerIDCreate = {
|
|
15
|
+
/**
|
|
16
|
+
* When set, a back button will be shown in the customer portal to return to this URL.
|
|
17
|
+
*/
|
|
18
|
+
returnUrl?: string | null | undefined;
|
|
15
19
|
/**
|
|
16
20
|
* ID of the customer to create a session for.
|
|
17
21
|
*/
|
|
@@ -24,15 +28,18 @@ export const CustomerSessionCustomerIDCreate$inboundSchema: z.ZodType<
|
|
|
24
28
|
z.ZodTypeDef,
|
|
25
29
|
unknown
|
|
26
30
|
> = z.object({
|
|
31
|
+
return_url: z.nullable(z.string()).optional(),
|
|
27
32
|
customer_id: z.string(),
|
|
28
33
|
}).transform((v) => {
|
|
29
34
|
return remap$(v, {
|
|
35
|
+
"return_url": "returnUrl",
|
|
30
36
|
"customer_id": "customerId",
|
|
31
37
|
});
|
|
32
38
|
});
|
|
33
39
|
|
|
34
40
|
/** @internal */
|
|
35
41
|
export type CustomerSessionCustomerIDCreate$Outbound = {
|
|
42
|
+
return_url?: string | null | undefined;
|
|
36
43
|
customer_id: string;
|
|
37
44
|
};
|
|
38
45
|
|
|
@@ -42,9 +49,11 @@ export const CustomerSessionCustomerIDCreate$outboundSchema: z.ZodType<
|
|
|
42
49
|
z.ZodTypeDef,
|
|
43
50
|
CustomerSessionCustomerIDCreate
|
|
44
51
|
> = z.object({
|
|
52
|
+
returnUrl: z.nullable(z.string()).optional(),
|
|
45
53
|
customerId: z.string(),
|
|
46
54
|
}).transform((v) => {
|
|
47
55
|
return remap$(v, {
|
|
56
|
+
returnUrl: "return_url",
|
|
48
57
|
customerId: "customer_id",
|
|
49
58
|
});
|
|
50
59
|
});
|
|
@@ -47,11 +47,11 @@ import {
|
|
|
47
47
|
export type ProductCreateOneTimeMetadata = string | number | number | boolean;
|
|
48
48
|
|
|
49
49
|
export type ProductCreateOneTimePrices =
|
|
50
|
-
| ProductPriceMeteredUnitCreate
|
|
51
|
-
| ProductPriceFixedCreate
|
|
52
|
-
| ProductPriceSeatBasedCreate
|
|
53
|
-
| ProductPriceCustomCreate
|
|
54
|
-
| ProductPriceFreeCreate;
|
|
50
|
+
| (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
|
|
51
|
+
| (ProductPriceFixedCreate & { amountType: "fixed" })
|
|
52
|
+
| (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
|
|
53
|
+
| (ProductPriceCustomCreate & { amountType: "custom" })
|
|
54
|
+
| (ProductPriceFreeCreate & { amountType: "free" });
|
|
55
55
|
|
|
56
56
|
export type ProductCreateOneTime = {
|
|
57
57
|
/**
|
|
@@ -82,11 +82,11 @@ export type ProductCreateOneTime = {
|
|
|
82
82
|
* List of available prices for this product. It should contain at most one static price (fixed, custom or free), and any number of metered prices. Metered prices are not supported on one-time purchase products.
|
|
83
83
|
*/
|
|
84
84
|
prices: Array<
|
|
85
|
-
| ProductPriceMeteredUnitCreate
|
|
86
|
-
| ProductPriceFixedCreate
|
|
87
|
-
| ProductPriceSeatBasedCreate
|
|
88
|
-
| ProductPriceCustomCreate
|
|
89
|
-
| ProductPriceFreeCreate
|
|
85
|
+
| (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
|
|
86
|
+
| (ProductPriceFixedCreate & { amountType: "fixed" })
|
|
87
|
+
| (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
|
|
88
|
+
| (ProductPriceCustomCreate & { amountType: "custom" })
|
|
89
|
+
| (ProductPriceFreeCreate & { amountType: "free" })
|
|
90
90
|
>;
|
|
91
91
|
/**
|
|
92
92
|
* List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded.
|
|
@@ -166,20 +166,40 @@ export const ProductCreateOneTimePrices$inboundSchema: z.ZodType<
|
|
|
166
166
|
z.ZodTypeDef,
|
|
167
167
|
unknown
|
|
168
168
|
> = z.union([
|
|
169
|
-
ProductPriceMeteredUnitCreate$inboundSchema
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
ProductPriceMeteredUnitCreate$inboundSchema.and(
|
|
170
|
+
z.object({ amount_type: z.literal("metered_unit") }).transform((v) => ({
|
|
171
|
+
amountType: v.amount_type,
|
|
172
|
+
})),
|
|
173
|
+
),
|
|
174
|
+
ProductPriceFixedCreate$inboundSchema.and(
|
|
175
|
+
z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
|
|
176
|
+
amountType: v.amount_type,
|
|
177
|
+
})),
|
|
178
|
+
),
|
|
179
|
+
ProductPriceSeatBasedCreate$inboundSchema.and(
|
|
180
|
+
z.object({ amount_type: z.literal("seat_based") }).transform((v) => ({
|
|
181
|
+
amountType: v.amount_type,
|
|
182
|
+
})),
|
|
183
|
+
),
|
|
184
|
+
ProductPriceCustomCreate$inboundSchema.and(
|
|
185
|
+
z.object({ amount_type: z.literal("custom") }).transform((v) => ({
|
|
186
|
+
amountType: v.amount_type,
|
|
187
|
+
})),
|
|
188
|
+
),
|
|
189
|
+
ProductPriceFreeCreate$inboundSchema.and(
|
|
190
|
+
z.object({ amount_type: z.literal("free") }).transform((v) => ({
|
|
191
|
+
amountType: v.amount_type,
|
|
192
|
+
})),
|
|
193
|
+
),
|
|
174
194
|
]);
|
|
175
195
|
|
|
176
196
|
/** @internal */
|
|
177
197
|
export type ProductCreateOneTimePrices$Outbound =
|
|
178
|
-
| ProductPriceMeteredUnitCreate$Outbound
|
|
179
|
-
| ProductPriceFixedCreate$Outbound
|
|
180
|
-
| ProductPriceSeatBasedCreate$Outbound
|
|
181
|
-
| ProductPriceCustomCreate$Outbound
|
|
182
|
-
| ProductPriceFreeCreate$Outbound;
|
|
198
|
+
| (ProductPriceMeteredUnitCreate$Outbound & { amount_type: "metered_unit" })
|
|
199
|
+
| (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
|
|
200
|
+
| (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
|
|
201
|
+
| (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
|
|
202
|
+
| (ProductPriceFreeCreate$Outbound & { amount_type: "free" });
|
|
183
203
|
|
|
184
204
|
/** @internal */
|
|
185
205
|
export const ProductCreateOneTimePrices$outboundSchema: z.ZodType<
|
|
@@ -187,11 +207,31 @@ export const ProductCreateOneTimePrices$outboundSchema: z.ZodType<
|
|
|
187
207
|
z.ZodTypeDef,
|
|
188
208
|
ProductCreateOneTimePrices
|
|
189
209
|
> = z.union([
|
|
190
|
-
ProductPriceMeteredUnitCreate$outboundSchema
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
210
|
+
ProductPriceMeteredUnitCreate$outboundSchema.and(
|
|
211
|
+
z.object({ amountType: z.literal("metered_unit") }).transform((v) => ({
|
|
212
|
+
amount_type: v.amountType,
|
|
213
|
+
})),
|
|
214
|
+
),
|
|
215
|
+
ProductPriceFixedCreate$outboundSchema.and(
|
|
216
|
+
z.object({ amountType: z.literal("fixed") }).transform((v) => ({
|
|
217
|
+
amount_type: v.amountType,
|
|
218
|
+
})),
|
|
219
|
+
),
|
|
220
|
+
ProductPriceSeatBasedCreate$outboundSchema.and(
|
|
221
|
+
z.object({ amountType: z.literal("seat_based") }).transform((v) => ({
|
|
222
|
+
amount_type: v.amountType,
|
|
223
|
+
})),
|
|
224
|
+
),
|
|
225
|
+
ProductPriceCustomCreate$outboundSchema.and(
|
|
226
|
+
z.object({ amountType: z.literal("custom") }).transform((v) => ({
|
|
227
|
+
amount_type: v.amountType,
|
|
228
|
+
})),
|
|
229
|
+
),
|
|
230
|
+
ProductPriceFreeCreate$outboundSchema.and(
|
|
231
|
+
z.object({ amountType: z.literal("free") }).transform((v) => ({
|
|
232
|
+
amount_type: v.amountType,
|
|
233
|
+
})),
|
|
234
|
+
),
|
|
195
235
|
]);
|
|
196
236
|
|
|
197
237
|
/**
|
|
@@ -238,11 +278,31 @@ export const ProductCreateOneTime$inboundSchema: z.ZodType<
|
|
|
238
278
|
description: z.nullable(z.string()).optional(),
|
|
239
279
|
prices: z.array(
|
|
240
280
|
z.union([
|
|
241
|
-
ProductPriceMeteredUnitCreate$inboundSchema
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
281
|
+
ProductPriceMeteredUnitCreate$inboundSchema.and(
|
|
282
|
+
z.object({ amount_type: z.literal("metered_unit") }).transform((v) => ({
|
|
283
|
+
amountType: v.amount_type,
|
|
284
|
+
})),
|
|
285
|
+
),
|
|
286
|
+
ProductPriceFixedCreate$inboundSchema.and(
|
|
287
|
+
z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
|
|
288
|
+
amountType: v.amount_type,
|
|
289
|
+
})),
|
|
290
|
+
),
|
|
291
|
+
ProductPriceSeatBasedCreate$inboundSchema.and(
|
|
292
|
+
z.object({ amount_type: z.literal("seat_based") }).transform((v) => ({
|
|
293
|
+
amountType: v.amount_type,
|
|
294
|
+
})),
|
|
295
|
+
),
|
|
296
|
+
ProductPriceCustomCreate$inboundSchema.and(
|
|
297
|
+
z.object({ amount_type: z.literal("custom") }).transform((v) => ({
|
|
298
|
+
amountType: v.amount_type,
|
|
299
|
+
})),
|
|
300
|
+
),
|
|
301
|
+
ProductPriceFreeCreate$inboundSchema.and(
|
|
302
|
+
z.object({ amount_type: z.literal("free") }).transform((v) => ({
|
|
303
|
+
amountType: v.amount_type,
|
|
304
|
+
})),
|
|
305
|
+
),
|
|
246
306
|
]),
|
|
247
307
|
),
|
|
248
308
|
medias: z.nullable(z.array(z.string())).optional(),
|
|
@@ -264,11 +324,11 @@ export type ProductCreateOneTime$Outbound = {
|
|
|
264
324
|
name: string;
|
|
265
325
|
description?: string | null | undefined;
|
|
266
326
|
prices: Array<
|
|
267
|
-
| ProductPriceMeteredUnitCreate$Outbound
|
|
268
|
-
| ProductPriceFixedCreate$Outbound
|
|
269
|
-
| ProductPriceSeatBasedCreate$Outbound
|
|
270
|
-
| ProductPriceCustomCreate$Outbound
|
|
271
|
-
| ProductPriceFreeCreate$Outbound
|
|
327
|
+
| (ProductPriceMeteredUnitCreate$Outbound & { amount_type: "metered_unit" })
|
|
328
|
+
| (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
|
|
329
|
+
| (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
|
|
330
|
+
| (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
|
|
331
|
+
| (ProductPriceFreeCreate$Outbound & { amount_type: "free" })
|
|
272
332
|
>;
|
|
273
333
|
medias?: Array<string> | null | undefined;
|
|
274
334
|
attached_custom_fields?:
|
|
@@ -291,11 +351,31 @@ export const ProductCreateOneTime$outboundSchema: z.ZodType<
|
|
|
291
351
|
description: z.nullable(z.string()).optional(),
|
|
292
352
|
prices: z.array(
|
|
293
353
|
z.union([
|
|
294
|
-
ProductPriceMeteredUnitCreate$outboundSchema
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
354
|
+
ProductPriceMeteredUnitCreate$outboundSchema.and(
|
|
355
|
+
z.object({ amountType: z.literal("metered_unit") }).transform((v) => ({
|
|
356
|
+
amount_type: v.amountType,
|
|
357
|
+
})),
|
|
358
|
+
),
|
|
359
|
+
ProductPriceFixedCreate$outboundSchema.and(
|
|
360
|
+
z.object({ amountType: z.literal("fixed") }).transform((v) => ({
|
|
361
|
+
amount_type: v.amountType,
|
|
362
|
+
})),
|
|
363
|
+
),
|
|
364
|
+
ProductPriceSeatBasedCreate$outboundSchema.and(
|
|
365
|
+
z.object({ amountType: z.literal("seat_based") }).transform((v) => ({
|
|
366
|
+
amount_type: v.amountType,
|
|
367
|
+
})),
|
|
368
|
+
),
|
|
369
|
+
ProductPriceCustomCreate$outboundSchema.and(
|
|
370
|
+
z.object({ amountType: z.literal("custom") }).transform((v) => ({
|
|
371
|
+
amount_type: v.amountType,
|
|
372
|
+
})),
|
|
373
|
+
),
|
|
374
|
+
ProductPriceFreeCreate$outboundSchema.and(
|
|
375
|
+
z.object({ amountType: z.literal("free") }).transform((v) => ({
|
|
376
|
+
amount_type: v.amountType,
|
|
377
|
+
})),
|
|
378
|
+
),
|
|
299
379
|
]),
|
|
300
380
|
),
|
|
301
381
|
medias: z.nullable(z.array(z.string())).optional(),
|