@waffo/pancake-ts 0.2.2 → 0.3.0

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/dist/index.d.cts CHANGED
@@ -187,14 +187,6 @@ declare enum MediaType {
187
187
  Image = "image",
188
188
  Video = "video"
189
189
  }
190
- /**
191
- * Checkout session product type.
192
- * @see waffo-pancake-order-service/app/lib/types.ts
193
- */
194
- declare enum CheckoutSessionProductType {
195
- Onetime = "onetime",
196
- Subscription = "subscription"
197
- }
198
190
  /** Error layer identifier in the call stack. */
199
191
  declare enum ErrorLayer {
200
192
  Gateway = "gateway",
@@ -212,13 +204,19 @@ declare enum ErrorLayer {
212
204
  }
213
205
  /**
214
206
  * Parameters for issuing a buyer session token.
207
+ *
208
+ * Provide either `storeId` or `productId` (at least one required).
209
+ * When `productId` is given without `storeId`, the server derives the store from the product.
210
+ *
215
211
  * @see waffo-pancake-user-service/app/lib/utils/jwt.ts IssueSessionTokenRequest
216
212
  */
217
213
  interface IssueSessionTokenParams {
218
214
  /** Buyer identity (email or any merchant-provided identifier string) */
219
215
  buyerIdentity: string;
220
- /** Store ID */
221
- storeId: string;
216
+ /** Store ID (optional when `productId` is provided) */
217
+ storeId?: string;
218
+ /** Product ID — used to derive the store when `storeId` is omitted */
219
+ productId?: string;
222
220
  }
223
221
  /**
224
222
  * Issued session token response.
@@ -625,12 +623,8 @@ interface BillingDetail {
625
623
  * @see waffo-pancake-order-service/app/lib/types.ts CreateCheckoutSessionRequest
626
624
  */
627
625
  interface CreateCheckoutSessionParams {
628
- /** Store ID */
629
- storeId: string;
630
626
  /** Product ID */
631
627
  productId: string;
632
- /** Product type */
633
- productType: `${CheckoutSessionProductType}`;
634
628
  /** Currency code (ISO 4217) */
635
629
  currency: string;
636
630
  /** Optional price snapshot override (reads from DB if omitted) */
@@ -757,20 +751,14 @@ interface RefundTicket {
757
751
  *
758
752
  * @example
759
753
  * const result = await client.checkout.anonymous.create({
760
- * storeId: "STO_xxx",
761
754
  * productId: "PROD_xxx",
762
- * productType: "onetime",
763
755
  * currency: "USD",
764
756
  * });
765
757
  * // Redirect to result.checkoutUrl
766
758
  */
767
759
  interface AnonymousCheckoutParams {
768
- /** Store ID */
769
- storeId: string;
770
760
  /** Product ID */
771
761
  productId: string;
772
- /** Product type */
773
- productType: `${CheckoutSessionProductType}`;
774
762
  /** Currency code (ISO 4217) */
775
763
  currency: string;
776
764
  /** Optional price snapshot override (reads from DB if omitted) */
@@ -794,21 +782,15 @@ interface AnonymousCheckoutParams {
794
782
  *
795
783
  * @example
796
784
  * const result = await client.checkout.authenticated.create({
797
- * storeId: "STO_xxx",
798
785
  * productId: "PROD_xxx",
799
- * productType: "onetime",
800
786
  * currency: "USD",
801
787
  * buyerIdentity: "customer@example.com",
802
788
  * });
803
789
  * // Redirect to result.checkoutUrl (includes #token=...)
804
790
  */
805
791
  interface AuthenticatedCheckoutParams {
806
- /** Store ID */
807
- storeId: string;
808
792
  /** Product ID */
809
793
  productId: string;
810
- /** Product type */
811
- productType: `${CheckoutSessionProductType}`;
812
794
  /** Currency code (ISO 4217) */
813
795
  currency: string;
814
796
  /** Buyer identity (email or merchant-provided identifier) */
@@ -1027,10 +1009,18 @@ declare class AuthResource {
1027
1009
  * @returns Issued session token with expiration
1028
1010
  *
1029
1011
  * @example
1012
+ * // By store ID
1030
1013
  * const { token, expiresAt } = await client.auth.issueSessionToken({
1031
1014
  * storeId: "STO_xxx",
1032
1015
  * buyerIdentity: "customer@example.com",
1033
1016
  * });
1017
+ *
1018
+ * @example
1019
+ * // By product ID (store derived automatically)
1020
+ * const { token, expiresAt } = await client.auth.issueSessionToken({
1021
+ * productId: "PROD_xxx",
1022
+ * buyerIdentity: "customer@example.com",
1023
+ * });
1034
1024
  */
1035
1025
  issueSessionToken(params: IssueSessionTokenParams): Promise<SessionToken>;
1036
1026
  }
@@ -1181,9 +1171,7 @@ declare class CheckoutAnonymousResource {
1181
1171
  *
1182
1172
  * @example
1183
1173
  * const result = await client.checkout.anonymous.create({
1184
- * storeId: "STO_xxx",
1185
1174
  * productId: "PROD_xxx",
1186
- * productType: "onetime",
1187
1175
  * currency: "USD",
1188
1176
  * });
1189
1177
  * // Redirect to result.checkoutUrl
@@ -1215,9 +1203,7 @@ declare class CheckoutAuthenticatedResource {
1215
1203
  *
1216
1204
  * @example
1217
1205
  * const result = await client.checkout.authenticated.create({
1218
- * storeId: "STO_xxx",
1219
1206
  * productId: "PROD_xxx",
1220
- * productType: "onetime",
1221
1207
  * currency: "USD",
1222
1208
  * buyerIdentity: "customer@example.com",
1223
1209
  * });
@@ -1238,18 +1224,14 @@ declare class CheckoutAuthenticatedResource {
1238
1224
  * @example
1239
1225
  * // Anonymous checkout (no identity)
1240
1226
  * const result = await client.checkout.anonymous.create({
1241
- * storeId: "STO_xxx",
1242
1227
  * productId: "PROD_xxx",
1243
- * productType: "onetime",
1244
1228
  * currency: "USD",
1245
1229
  * });
1246
1230
  *
1247
1231
  * @example
1248
1232
  * // Authenticated checkout (with buyer identity)
1249
1233
  * const result = await client.checkout.authenticated.create({
1250
- * storeId: "STO_xxx",
1251
1234
  * productId: "PROD_xxx",
1252
- * productType: "onetime",
1253
1235
  * currency: "USD",
1254
1236
  * buyerIdentity: "customer@example.com",
1255
1237
  * });
@@ -1273,9 +1255,7 @@ declare class CheckoutResource {
1273
1255
  *
1274
1256
  * @example
1275
1257
  * const session = await client.checkout.createSession({
1276
- * storeId: "STO_xxx",
1277
1258
  * productId: "PROD_xxx",
1278
- * productType: "onetime",
1279
1259
  * currency: "USD",
1280
1260
  * buyerEmail: "customer@example.com",
1281
1261
  * });
@@ -1685,9 +1665,7 @@ declare class WebhooksResource {
1685
1665
  *
1686
1666
  * // Create a checkout session
1687
1667
  * const session = await client.checkout.createSession({
1688
- * storeId: store.id,
1689
1668
  * productId: product.id,
1690
- * productType: "onetime",
1691
1669
  * currency: "USD",
1692
1670
  * });
1693
1671
  * // => redirect customer to session.checkoutUrl
@@ -1820,4 +1798,4 @@ declare class WaffoPancakeError extends Error {
1820
1798
  */
1821
1799
  declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
1822
1800
 
1823
- export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, CheckoutSessionProductType, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, type WebhookSettings, verifyWebhook };
1801
+ export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, type WebhookSettings, verifyWebhook };
package/dist/index.d.ts CHANGED
@@ -187,14 +187,6 @@ declare enum MediaType {
187
187
  Image = "image",
188
188
  Video = "video"
189
189
  }
190
- /**
191
- * Checkout session product type.
192
- * @see waffo-pancake-order-service/app/lib/types.ts
193
- */
194
- declare enum CheckoutSessionProductType {
195
- Onetime = "onetime",
196
- Subscription = "subscription"
197
- }
198
190
  /** Error layer identifier in the call stack. */
199
191
  declare enum ErrorLayer {
200
192
  Gateway = "gateway",
@@ -212,13 +204,19 @@ declare enum ErrorLayer {
212
204
  }
213
205
  /**
214
206
  * Parameters for issuing a buyer session token.
207
+ *
208
+ * Provide either `storeId` or `productId` (at least one required).
209
+ * When `productId` is given without `storeId`, the server derives the store from the product.
210
+ *
215
211
  * @see waffo-pancake-user-service/app/lib/utils/jwt.ts IssueSessionTokenRequest
216
212
  */
217
213
  interface IssueSessionTokenParams {
218
214
  /** Buyer identity (email or any merchant-provided identifier string) */
219
215
  buyerIdentity: string;
220
- /** Store ID */
221
- storeId: string;
216
+ /** Store ID (optional when `productId` is provided) */
217
+ storeId?: string;
218
+ /** Product ID — used to derive the store when `storeId` is omitted */
219
+ productId?: string;
222
220
  }
223
221
  /**
224
222
  * Issued session token response.
@@ -625,12 +623,8 @@ interface BillingDetail {
625
623
  * @see waffo-pancake-order-service/app/lib/types.ts CreateCheckoutSessionRequest
626
624
  */
627
625
  interface CreateCheckoutSessionParams {
628
- /** Store ID */
629
- storeId: string;
630
626
  /** Product ID */
631
627
  productId: string;
632
- /** Product type */
633
- productType: `${CheckoutSessionProductType}`;
634
628
  /** Currency code (ISO 4217) */
635
629
  currency: string;
636
630
  /** Optional price snapshot override (reads from DB if omitted) */
@@ -757,20 +751,14 @@ interface RefundTicket {
757
751
  *
758
752
  * @example
759
753
  * const result = await client.checkout.anonymous.create({
760
- * storeId: "STO_xxx",
761
754
  * productId: "PROD_xxx",
762
- * productType: "onetime",
763
755
  * currency: "USD",
764
756
  * });
765
757
  * // Redirect to result.checkoutUrl
766
758
  */
767
759
  interface AnonymousCheckoutParams {
768
- /** Store ID */
769
- storeId: string;
770
760
  /** Product ID */
771
761
  productId: string;
772
- /** Product type */
773
- productType: `${CheckoutSessionProductType}`;
774
762
  /** Currency code (ISO 4217) */
775
763
  currency: string;
776
764
  /** Optional price snapshot override (reads from DB if omitted) */
@@ -794,21 +782,15 @@ interface AnonymousCheckoutParams {
794
782
  *
795
783
  * @example
796
784
  * const result = await client.checkout.authenticated.create({
797
- * storeId: "STO_xxx",
798
785
  * productId: "PROD_xxx",
799
- * productType: "onetime",
800
786
  * currency: "USD",
801
787
  * buyerIdentity: "customer@example.com",
802
788
  * });
803
789
  * // Redirect to result.checkoutUrl (includes #token=...)
804
790
  */
805
791
  interface AuthenticatedCheckoutParams {
806
- /** Store ID */
807
- storeId: string;
808
792
  /** Product ID */
809
793
  productId: string;
810
- /** Product type */
811
- productType: `${CheckoutSessionProductType}`;
812
794
  /** Currency code (ISO 4217) */
813
795
  currency: string;
814
796
  /** Buyer identity (email or merchant-provided identifier) */
@@ -1027,10 +1009,18 @@ declare class AuthResource {
1027
1009
  * @returns Issued session token with expiration
1028
1010
  *
1029
1011
  * @example
1012
+ * // By store ID
1030
1013
  * const { token, expiresAt } = await client.auth.issueSessionToken({
1031
1014
  * storeId: "STO_xxx",
1032
1015
  * buyerIdentity: "customer@example.com",
1033
1016
  * });
1017
+ *
1018
+ * @example
1019
+ * // By product ID (store derived automatically)
1020
+ * const { token, expiresAt } = await client.auth.issueSessionToken({
1021
+ * productId: "PROD_xxx",
1022
+ * buyerIdentity: "customer@example.com",
1023
+ * });
1034
1024
  */
1035
1025
  issueSessionToken(params: IssueSessionTokenParams): Promise<SessionToken>;
1036
1026
  }
@@ -1181,9 +1171,7 @@ declare class CheckoutAnonymousResource {
1181
1171
  *
1182
1172
  * @example
1183
1173
  * const result = await client.checkout.anonymous.create({
1184
- * storeId: "STO_xxx",
1185
1174
  * productId: "PROD_xxx",
1186
- * productType: "onetime",
1187
1175
  * currency: "USD",
1188
1176
  * });
1189
1177
  * // Redirect to result.checkoutUrl
@@ -1215,9 +1203,7 @@ declare class CheckoutAuthenticatedResource {
1215
1203
  *
1216
1204
  * @example
1217
1205
  * const result = await client.checkout.authenticated.create({
1218
- * storeId: "STO_xxx",
1219
1206
  * productId: "PROD_xxx",
1220
- * productType: "onetime",
1221
1207
  * currency: "USD",
1222
1208
  * buyerIdentity: "customer@example.com",
1223
1209
  * });
@@ -1238,18 +1224,14 @@ declare class CheckoutAuthenticatedResource {
1238
1224
  * @example
1239
1225
  * // Anonymous checkout (no identity)
1240
1226
  * const result = await client.checkout.anonymous.create({
1241
- * storeId: "STO_xxx",
1242
1227
  * productId: "PROD_xxx",
1243
- * productType: "onetime",
1244
1228
  * currency: "USD",
1245
1229
  * });
1246
1230
  *
1247
1231
  * @example
1248
1232
  * // Authenticated checkout (with buyer identity)
1249
1233
  * const result = await client.checkout.authenticated.create({
1250
- * storeId: "STO_xxx",
1251
1234
  * productId: "PROD_xxx",
1252
- * productType: "onetime",
1253
1235
  * currency: "USD",
1254
1236
  * buyerIdentity: "customer@example.com",
1255
1237
  * });
@@ -1273,9 +1255,7 @@ declare class CheckoutResource {
1273
1255
  *
1274
1256
  * @example
1275
1257
  * const session = await client.checkout.createSession({
1276
- * storeId: "STO_xxx",
1277
1258
  * productId: "PROD_xxx",
1278
- * productType: "onetime",
1279
1259
  * currency: "USD",
1280
1260
  * buyerEmail: "customer@example.com",
1281
1261
  * });
@@ -1685,9 +1665,7 @@ declare class WebhooksResource {
1685
1665
  *
1686
1666
  * // Create a checkout session
1687
1667
  * const session = await client.checkout.createSession({
1688
- * storeId: store.id,
1689
1668
  * productId: product.id,
1690
- * productType: "onetime",
1691
1669
  * currency: "USD",
1692
1670
  * });
1693
1671
  * // => redirect customer to session.checkoutUrl
@@ -1820,4 +1798,4 @@ declare class WaffoPancakeError extends Error {
1820
1798
  */
1821
1799
  declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
1822
1800
 
1823
- export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, CheckoutSessionProductType, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, type WebhookSettings, verifyWebhook };
1801
+ export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, type WebhookSettings, verifyWebhook };
package/dist/index.js CHANGED
@@ -301,9 +301,7 @@ function validateBillingDetail(detail) {
301
301
  }
302
302
  }
303
303
  function validateCheckoutCommon(params) {
304
- validateShortId("storeId", params.storeId, "STO");
305
304
  validateShortId("productId", params.productId, "PROD");
306
- validateEnum("productType", params.productType, ["onetime", "subscription"]);
307
305
  validateCurrencyCode("currency", params.currency);
308
306
  if (params.priceSnapshot) {
309
307
  validateAmountString("priceSnapshot.amount", params.priceSnapshot.amount);
@@ -329,13 +327,31 @@ var AuthResource = class {
329
327
  * @returns Issued session token with expiration
330
328
  *
331
329
  * @example
330
+ * // By store ID
332
331
  * const { token, expiresAt } = await client.auth.issueSessionToken({
333
332
  * storeId: "STO_xxx",
334
333
  * buyerIdentity: "customer@example.com",
335
334
  * });
335
+ *
336
+ * @example
337
+ * // By product ID (store derived automatically)
338
+ * const { token, expiresAt } = await client.auth.issueSessionToken({
339
+ * productId: "PROD_xxx",
340
+ * buyerIdentity: "customer@example.com",
341
+ * });
336
342
  */
337
343
  async issueSessionToken(params) {
338
- validateShortId("storeId", params.storeId, "STO");
344
+ if (!params.storeId && !params.productId) {
345
+ throw new WaffoPancakeError(400, [
346
+ { message: "Missing required field: provide storeId or productId", layer: "sdk" }
347
+ ]);
348
+ }
349
+ if (params.storeId) {
350
+ validateShortId("storeId", params.storeId, "STO");
351
+ }
352
+ if (params.productId) {
353
+ validateShortId("productId", params.productId, "PROD");
354
+ }
339
355
  validateRequired("buyerIdentity", params.buyerIdentity);
340
356
  return this.http.post("/v1/actions/auth/issue-session-token", params);
341
357
  }
@@ -482,9 +498,7 @@ var CheckoutAnonymousResource = class {
482
498
  *
483
499
  * @example
484
500
  * const result = await client.checkout.anonymous.create({
485
- * storeId: "STO_xxx",
486
501
  * productId: "PROD_xxx",
487
- * productType: "onetime",
488
502
  * currency: "USD",
489
503
  * });
490
504
  * // Redirect to result.checkoutUrl
@@ -518,9 +532,7 @@ var CheckoutAuthenticatedResource = class {
518
532
  *
519
533
  * @example
520
534
  * const result = await client.checkout.authenticated.create({
521
- * storeId: "STO_xxx",
522
535
  * productId: "PROD_xxx",
523
- * productType: "onetime",
524
536
  * currency: "USD",
525
537
  * buyerIdentity: "customer@example.com",
526
538
  * });
@@ -532,7 +544,7 @@ var CheckoutAuthenticatedResource = class {
532
544
  const { buyerIdentity, buyerEmail, ...sessionFields } = params;
533
545
  const [tokenResult, sessionResult] = await Promise.all([
534
546
  this.http.post("/v1/actions/auth/issue-session-token", {
535
- storeId: params.storeId,
547
+ productId: params.productId,
536
548
  buyerIdentity
537
549
  }, { idempotencyWindow: 60 }),
538
550
  this.http.post("/v1/actions/checkout/create-session", {
@@ -572,9 +584,7 @@ var CheckoutResource = class {
572
584
  *
573
585
  * @example
574
586
  * const session = await client.checkout.createSession({
575
- * storeId: "STO_xxx",
576
587
  * productId: "PROD_xxx",
577
- * productType: "onetime",
578
588
  * currency: "USD",
579
589
  * buyerEmail: "customer@example.com",
580
590
  * });
@@ -1257,11 +1267,6 @@ var MediaType = /* @__PURE__ */ ((MediaType2) => {
1257
1267
  MediaType2["Video"] = "video";
1258
1268
  return MediaType2;
1259
1269
  })(MediaType || {});
1260
- var CheckoutSessionProductType = /* @__PURE__ */ ((CheckoutSessionProductType2) => {
1261
- CheckoutSessionProductType2["Onetime"] = "onetime";
1262
- CheckoutSessionProductType2["Subscription"] = "subscription";
1263
- return CheckoutSessionProductType2;
1264
- })(CheckoutSessionProductType || {});
1265
1270
  var ErrorLayer = /* @__PURE__ */ ((ErrorLayer2) => {
1266
1271
  ErrorLayer2["Gateway"] = "gateway";
1267
1272
  ErrorLayer2["User"] = "user";
@@ -1290,7 +1295,6 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
1290
1295
  })(WebhookEventType || {});
1291
1296
  export {
1292
1297
  BillingPeriod,
1293
- CheckoutSessionProductType,
1294
1298
  EntityStatus,
1295
1299
  Environment,
1296
1300
  ErrorLayer,