@waffo/pancake-ts 0.2.2 → 0.3.1

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.
@@ -454,8 +452,8 @@ interface CreateOnetimeProductParams {
454
452
  */
455
453
  interface UpdateOnetimeProductParams {
456
454
  id: string;
457
- name: string;
458
- prices: Prices;
455
+ name?: string;
456
+ prices?: Prices;
459
457
  description?: string;
460
458
  media?: MediaItem[];
461
459
  successUrl?: string;
@@ -512,9 +510,9 @@ interface CreateSubscriptionProductParams {
512
510
  */
513
511
  interface UpdateSubscriptionProductParams {
514
512
  id: string;
515
- name: string;
516
- billingPeriod: BillingPeriod;
517
- prices: Prices;
513
+ name?: string;
514
+ billingPeriod?: BillingPeriod;
515
+ prices?: Prices;
518
516
  description?: string;
519
517
  media?: MediaItem[];
520
518
  successUrl?: string;
@@ -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
  * });
@@ -1332,13 +1312,20 @@ declare class OnetimeProductsResource {
1332
1312
  /**
1333
1313
  * Update a one-time product. Creates a new version; skips if unchanged.
1334
1314
  *
1335
- * @param params - Product update parameters (all content fields required)
1315
+ * @param params - Product update parameters (only `id` is required)
1336
1316
  * @returns Updated product detail
1337
1317
  *
1338
1318
  * @example
1319
+ * // Update only the name
1339
1320
  * const { product } = await client.onetimeProducts.update({
1340
1321
  * id: "PROD_xxx",
1341
1322
  * name: "E-Book v2",
1323
+ * });
1324
+ *
1325
+ * @example
1326
+ * // Update prices while preserving other fields
1327
+ * const { product } = await client.onetimeProducts.update({
1328
+ * id: "PROD_xxx",
1342
1329
  * prices: { USD: { amount: "39.00", taxCategory: "digital_goods" } },
1343
1330
  * });
1344
1331
  */
@@ -1574,15 +1561,22 @@ declare class SubscriptionProductsResource {
1574
1561
  /**
1575
1562
  * Update a subscription product. Creates a new version; skips if unchanged.
1576
1563
  *
1577
- * @param params - Product update parameters (all content fields required)
1564
+ * @param params - Product update parameters (only `id` is required)
1578
1565
  * @returns Updated product detail
1579
1566
  *
1580
1567
  * @example
1568
+ * // Update only the name
1581
1569
  * const { product } = await client.subscriptionProducts.update({
1582
1570
  * id: "PROD_xxx",
1583
1571
  * name: "Pro Plan v2",
1584
- * billingPeriod: "monthly",
1585
- * prices: { USD: { amount: "14.99", taxCategory: "saas" } },
1572
+ * });
1573
+ *
1574
+ * @example
1575
+ * // Update prices and billing period
1576
+ * const { product } = await client.subscriptionProducts.update({
1577
+ * id: "PROD_xxx",
1578
+ * billingPeriod: "yearly",
1579
+ * prices: { USD: { amount: "99.00", taxCategory: "saas" } },
1586
1580
  * });
1587
1581
  */
1588
1582
  update(params: UpdateSubscriptionProductParams): Promise<{
@@ -1685,9 +1679,7 @@ declare class WebhooksResource {
1685
1679
  *
1686
1680
  * // Create a checkout session
1687
1681
  * const session = await client.checkout.createSession({
1688
- * storeId: store.id,
1689
1682
  * productId: product.id,
1690
- * productType: "onetime",
1691
1683
  * currency: "USD",
1692
1684
  * });
1693
1685
  * // => redirect customer to session.checkoutUrl
@@ -1820,4 +1812,4 @@ declare class WaffoPancakeError extends Error {
1820
1812
  */
1821
1813
  declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
1822
1814
 
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 };
1815
+ 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.
@@ -454,8 +452,8 @@ interface CreateOnetimeProductParams {
454
452
  */
455
453
  interface UpdateOnetimeProductParams {
456
454
  id: string;
457
- name: string;
458
- prices: Prices;
455
+ name?: string;
456
+ prices?: Prices;
459
457
  description?: string;
460
458
  media?: MediaItem[];
461
459
  successUrl?: string;
@@ -512,9 +510,9 @@ interface CreateSubscriptionProductParams {
512
510
  */
513
511
  interface UpdateSubscriptionProductParams {
514
512
  id: string;
515
- name: string;
516
- billingPeriod: BillingPeriod;
517
- prices: Prices;
513
+ name?: string;
514
+ billingPeriod?: BillingPeriod;
515
+ prices?: Prices;
518
516
  description?: string;
519
517
  media?: MediaItem[];
520
518
  successUrl?: string;
@@ -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
  * });
@@ -1332,13 +1312,20 @@ declare class OnetimeProductsResource {
1332
1312
  /**
1333
1313
  * Update a one-time product. Creates a new version; skips if unchanged.
1334
1314
  *
1335
- * @param params - Product update parameters (all content fields required)
1315
+ * @param params - Product update parameters (only `id` is required)
1336
1316
  * @returns Updated product detail
1337
1317
  *
1338
1318
  * @example
1319
+ * // Update only the name
1339
1320
  * const { product } = await client.onetimeProducts.update({
1340
1321
  * id: "PROD_xxx",
1341
1322
  * name: "E-Book v2",
1323
+ * });
1324
+ *
1325
+ * @example
1326
+ * // Update prices while preserving other fields
1327
+ * const { product } = await client.onetimeProducts.update({
1328
+ * id: "PROD_xxx",
1342
1329
  * prices: { USD: { amount: "39.00", taxCategory: "digital_goods" } },
1343
1330
  * });
1344
1331
  */
@@ -1574,15 +1561,22 @@ declare class SubscriptionProductsResource {
1574
1561
  /**
1575
1562
  * Update a subscription product. Creates a new version; skips if unchanged.
1576
1563
  *
1577
- * @param params - Product update parameters (all content fields required)
1564
+ * @param params - Product update parameters (only `id` is required)
1578
1565
  * @returns Updated product detail
1579
1566
  *
1580
1567
  * @example
1568
+ * // Update only the name
1581
1569
  * const { product } = await client.subscriptionProducts.update({
1582
1570
  * id: "PROD_xxx",
1583
1571
  * name: "Pro Plan v2",
1584
- * billingPeriod: "monthly",
1585
- * prices: { USD: { amount: "14.99", taxCategory: "saas" } },
1572
+ * });
1573
+ *
1574
+ * @example
1575
+ * // Update prices and billing period
1576
+ * const { product } = await client.subscriptionProducts.update({
1577
+ * id: "PROD_xxx",
1578
+ * billingPeriod: "yearly",
1579
+ * prices: { USD: { amount: "99.00", taxCategory: "saas" } },
1586
1580
  * });
1587
1581
  */
1588
1582
  update(params: UpdateSubscriptionProductParams): Promise<{
@@ -1685,9 +1679,7 @@ declare class WebhooksResource {
1685
1679
  *
1686
1680
  * // Create a checkout session
1687
1681
  * const session = await client.checkout.createSession({
1688
- * storeId: store.id,
1689
1682
  * productId: product.id,
1690
- * productType: "onetime",
1691
1683
  * currency: "USD",
1692
1684
  * });
1693
1685
  * // => redirect customer to session.checkoutUrl
@@ -1820,4 +1812,4 @@ declare class WaffoPancakeError extends Error {
1820
1812
  */
1821
1813
  declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
1822
1814
 
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 };
1815
+ 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
  * });
@@ -641,20 +651,27 @@ var OnetimeProductsResource = class {
641
651
  /**
642
652
  * Update a one-time product. Creates a new version; skips if unchanged.
643
653
  *
644
- * @param params - Product update parameters (all content fields required)
654
+ * @param params - Product update parameters (only `id` is required)
645
655
  * @returns Updated product detail
646
656
  *
647
657
  * @example
658
+ * // Update only the name
648
659
  * const { product } = await client.onetimeProducts.update({
649
660
  * id: "PROD_xxx",
650
661
  * name: "E-Book v2",
662
+ * });
663
+ *
664
+ * @example
665
+ * // Update prices while preserving other fields
666
+ * const { product } = await client.onetimeProducts.update({
667
+ * id: "PROD_xxx",
651
668
  * prices: { USD: { amount: "39.00", taxCategory: "digital_goods" } },
652
669
  * });
653
670
  */
654
671
  async update(params) {
655
672
  validateShortId("id", params.id, "PROD");
656
- validateRequired("name", params.name);
657
- validatePrices("prices", params.prices);
673
+ if (params.name !== void 0) validateRequired("name", params.name);
674
+ if (params.prices) validatePrices("prices", params.prices);
658
675
  return this.http.post("/v1/actions/onetime-product/update-product", params);
659
676
  }
660
677
  /**
@@ -923,22 +940,29 @@ var SubscriptionProductsResource = class {
923
940
  /**
924
941
  * Update a subscription product. Creates a new version; skips if unchanged.
925
942
  *
926
- * @param params - Product update parameters (all content fields required)
943
+ * @param params - Product update parameters (only `id` is required)
927
944
  * @returns Updated product detail
928
945
  *
929
946
  * @example
947
+ * // Update only the name
930
948
  * const { product } = await client.subscriptionProducts.update({
931
949
  * id: "PROD_xxx",
932
950
  * name: "Pro Plan v2",
933
- * billingPeriod: "monthly",
934
- * prices: { USD: { amount: "14.99", taxCategory: "saas" } },
951
+ * });
952
+ *
953
+ * @example
954
+ * // Update prices and billing period
955
+ * const { product } = await client.subscriptionProducts.update({
956
+ * id: "PROD_xxx",
957
+ * billingPeriod: "yearly",
958
+ * prices: { USD: { amount: "99.00", taxCategory: "saas" } },
935
959
  * });
936
960
  */
937
961
  async update(params) {
938
962
  validateShortId("id", params.id, "PROD");
939
- validateRequired("name", params.name);
940
- validateEnum("billingPeriod", params.billingPeriod, ["weekly", "monthly", "quarterly", "yearly"]);
941
- validatePrices("prices", params.prices);
963
+ if (params.name !== void 0) validateRequired("name", params.name);
964
+ if (params.billingPeriod !== void 0) validateEnum("billingPeriod", params.billingPeriod, ["weekly", "monthly", "quarterly", "yearly"]);
965
+ if (params.prices) validatePrices("prices", params.prices);
942
966
  return this.http.post("/v1/actions/subscription-product/update-product", params);
943
967
  }
944
968
  /**
@@ -1257,11 +1281,6 @@ var MediaType = /* @__PURE__ */ ((MediaType2) => {
1257
1281
  MediaType2["Video"] = "video";
1258
1282
  return MediaType2;
1259
1283
  })(MediaType || {});
1260
- var CheckoutSessionProductType = /* @__PURE__ */ ((CheckoutSessionProductType2) => {
1261
- CheckoutSessionProductType2["Onetime"] = "onetime";
1262
- CheckoutSessionProductType2["Subscription"] = "subscription";
1263
- return CheckoutSessionProductType2;
1264
- })(CheckoutSessionProductType || {});
1265
1284
  var ErrorLayer = /* @__PURE__ */ ((ErrorLayer2) => {
1266
1285
  ErrorLayer2["Gateway"] = "gateway";
1267
1286
  ErrorLayer2["User"] = "user";
@@ -1290,7 +1309,6 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
1290
1309
  })(WebhookEventType || {});
1291
1310
  export {
1292
1311
  BillingPeriod,
1293
- CheckoutSessionProductType,
1294
1312
  EntityStatus,
1295
1313
  Environment,
1296
1314
  ErrorLayer,