autumn-js 0.1.11 → 0.1.12

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.
Files changed (192) hide show
  1. package/dist/libraries/backend/better-auth.d.mts +30 -26
  2. package/dist/libraries/backend/better-auth.d.ts +30 -26
  3. package/dist/libraries/backend/better-auth.js +172 -2
  4. package/dist/libraries/backend/better-auth.mjs +7 -7
  5. package/dist/libraries/backend/{chunk-EW2R7722.mjs → chunk-2DWGCQCF.mjs} +1 -1
  6. package/dist/libraries/backend/{chunk-VNJ3MFJE.mjs → chunk-56RGUNOT.mjs} +1 -1
  7. package/dist/libraries/backend/{chunk-P3ARLB2M.mjs → chunk-6JI6MF4S.mjs} +1 -1
  8. package/dist/libraries/backend/{chunk-5DDCZMDB.mjs → chunk-FA5Z2MOT.mjs} +1 -1
  9. package/dist/libraries/backend/{chunk-RAHKKJED.mjs → chunk-NWPFUFXX.mjs} +6 -6
  10. package/dist/libraries/backend/{chunk-NAP2URIW.mjs → chunk-Q7SD535L.mjs} +172 -2
  11. package/dist/libraries/backend/{chunk-7K3RATTK.mjs → chunk-SDL7BFTH.mjs} +1 -1
  12. package/dist/libraries/backend/convex.js +172 -2
  13. package/dist/libraries/backend/convex.mjs +7 -7
  14. package/dist/libraries/backend/elysia.js +172 -2
  15. package/dist/libraries/backend/elysia.mjs +7 -7
  16. package/dist/libraries/backend/express.d.mts +1 -1
  17. package/dist/libraries/backend/express.d.ts +1 -1
  18. package/dist/libraries/backend/express.js +172 -2
  19. package/dist/libraries/backend/express.mjs +7 -7
  20. package/dist/libraries/backend/fastify.js +172 -2
  21. package/dist/libraries/backend/fastify.mjs +7 -7
  22. package/dist/libraries/backend/hono.js +172 -2
  23. package/dist/libraries/backend/hono.mjs +7 -7
  24. package/dist/libraries/backend/index.d.mts +1 -1
  25. package/dist/libraries/backend/index.d.ts +1 -1
  26. package/dist/libraries/backend/index.js +172 -2
  27. package/dist/libraries/backend/index.mjs +7 -7
  28. package/dist/libraries/backend/next.js +172 -2
  29. package/dist/libraries/backend/next.mjs +7 -7
  30. package/dist/libraries/backend/react-router.js +172 -2
  31. package/dist/libraries/backend/react-router.mjs +7 -7
  32. package/dist/libraries/backend/{referralTypes-C1eZ8cjO.d.mts → referralTypes-BOsjdpOb.d.mts} +176 -6
  33. package/dist/libraries/backend/{referralTypes-FlI0fYwz.d.ts → referralTypes-DcfU8B6R.d.ts} +176 -6
  34. package/dist/libraries/backend/remix_dep.js +172 -2
  35. package/dist/libraries/backend/remix_dep.mjs +7 -7
  36. package/dist/libraries/backend/routes/backendRouter.js +172 -2
  37. package/dist/libraries/backend/routes/backendRouter.mjs +7 -7
  38. package/dist/libraries/backend/routes/entityRoutes.js +172 -2
  39. package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
  40. package/dist/libraries/backend/routes/genRoutes.js +172 -2
  41. package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
  42. package/dist/libraries/backend/routes/productRoutes.js +172 -2
  43. package/dist/libraries/backend/routes/productRoutes.mjs +3 -3
  44. package/dist/libraries/backend/routes/referralRoutes.js +172 -2
  45. package/dist/libraries/backend/routes/referralRoutes.mjs +3 -3
  46. package/dist/libraries/backend/supabase.js +172 -2
  47. package/dist/libraries/backend/supabase.mjs +7 -7
  48. package/dist/libraries/backend/tanstack.js +172 -2
  49. package/dist/libraries/backend/tanstack.mjs +7 -7
  50. package/dist/libraries/backend/utils/backendRes.js +172 -2
  51. package/dist/libraries/backend/utils/backendRes.mjs +1 -1
  52. package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
  53. package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
  54. package/dist/libraries/backend/utils/withAuth.js +172 -2
  55. package/dist/libraries/backend/utils/withAuth.mjs +2 -2
  56. package/dist/libraries/react/AutumnContext.d.mts +6 -6
  57. package/dist/libraries/react/AutumnContext.d.ts +6 -6
  58. package/dist/libraries/react/AutumnContext.js +172 -2
  59. package/dist/libraries/react/AutumnContext.mjs +4 -4
  60. package/dist/libraries/react/BaseAutumnProvider.d.mts +6 -6
  61. package/dist/libraries/react/BaseAutumnProvider.d.ts +6 -6
  62. package/dist/libraries/react/BaseAutumnProvider.js +172 -13
  63. package/dist/libraries/react/BaseAutumnProvider.mjs +9 -9
  64. package/dist/libraries/react/{ReactAutumnClient-CfDtucnL.d.ts → ReactAutumnClient-CIAkiqwV.d.ts} +5 -5
  65. package/dist/libraries/react/{ReactAutumnClient-IFdMWiu5.d.mts → ReactAutumnClient-zBxnpPLM.d.mts} +5 -5
  66. package/dist/libraries/react/ReactAutumnProvider.d.mts +2 -2
  67. package/dist/libraries/react/ReactAutumnProvider.d.ts +2 -2
  68. package/dist/libraries/react/ReactAutumnProvider.js +172 -13
  69. package/dist/libraries/react/ReactAutumnProvider.mjs +10 -10
  70. package/dist/libraries/react/{attachTypes-CLK4jfuj.d.ts → attachTypes-BQaZHr5e.d.ts} +1 -1
  71. package/dist/libraries/react/{attachTypes-C5gcbNrS.d.mts → attachTypes-Cuxn1ThG.d.mts} +1 -1
  72. package/dist/libraries/react/{chunk-4NZ7ML7V.mjs → chunk-26K62U62.mjs} +2 -2
  73. package/dist/libraries/react/{chunk-WYQMHQUE.mjs → chunk-5O3IHYFF.mjs} +172 -2
  74. package/dist/libraries/react/{chunk-3MF54MDU.mjs → chunk-5RTUQSYZ.mjs} +1 -1
  75. package/dist/libraries/react/{chunk-XK3AXQED.mjs → chunk-6X76WFOV.mjs} +3 -13
  76. package/dist/libraries/react/{chunk-JHFJKAXG.mjs → chunk-7A2PZDUO.mjs} +25 -25
  77. package/dist/libraries/react/{chunk-YHT2JUXO.mjs → chunk-7HRCOEUW.mjs} +1 -1
  78. package/dist/libraries/react/{chunk-KP2Q65Y3.mjs → chunk-CMUWZZWV.mjs} +2 -2
  79. package/dist/libraries/react/{chunk-KMYL54B4.mjs → chunk-DKOF357C.mjs} +1 -1
  80. package/dist/libraries/react/{chunk-67RWFVWN.mjs → chunk-HNIU2WNT.mjs} +2 -2
  81. package/dist/libraries/react/{chunk-U3OQJXCW.mjs → chunk-JTYEHM27.mjs} +4 -4
  82. package/dist/libraries/react/{chunk-6D6TYTTO.mjs → chunk-P6CAHZVT.mjs} +1 -2
  83. package/dist/libraries/react/{chunk-TTLL63A4.mjs → chunk-QNMB7QR6.mjs} +3 -3
  84. package/dist/libraries/react/{chunk-2ENHPIYQ.mjs → chunk-RK4NRHHQ.mjs} +3 -3
  85. package/dist/libraries/react/{chunk-VZY225C6.mjs → chunk-ROKCGZ77.mjs} +2 -2
  86. package/dist/libraries/react/{chunk-FDNQ6GRK.mjs → chunk-TE2MOBO7.mjs} +1 -1
  87. package/dist/libraries/react/{chunk-OMJJLT2Q.mjs → chunk-VGNA76RG.mjs} +1 -1
  88. package/dist/libraries/react/client/ReactAutumnClient.d.mts +6 -6
  89. package/dist/libraries/react/client/ReactAutumnClient.d.ts +6 -6
  90. package/dist/libraries/react/client/ReactAutumnClient.js +172 -2
  91. package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -3
  92. package/dist/libraries/react/client/clientCompMethods.d.mts +6 -6
  93. package/dist/libraries/react/client/clientCompMethods.d.ts +6 -6
  94. package/dist/libraries/react/client/clientCusMethods.d.mts +6 -6
  95. package/dist/libraries/react/client/clientCusMethods.d.ts +6 -6
  96. package/dist/libraries/react/client/clientEntityMethods.d.mts +6 -6
  97. package/dist/libraries/react/client/clientEntityMethods.d.ts +6 -6
  98. package/dist/libraries/react/client/clientGenMethods.d.mts +6 -6
  99. package/dist/libraries/react/client/clientGenMethods.d.ts +6 -6
  100. package/dist/libraries/react/client/clientProdMethods.d.mts +6 -6
  101. package/dist/libraries/react/client/clientProdMethods.d.ts +6 -6
  102. package/dist/libraries/react/client/clientReferralMethods.d.mts +6 -6
  103. package/dist/libraries/react/client/clientReferralMethods.d.ts +6 -6
  104. package/dist/libraries/react/client/types/clientGenTypes.js +172 -2
  105. package/dist/libraries/react/client/types/clientGenTypes.mjs +1 -1
  106. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.mts +2 -2
  107. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.ts +2 -2
  108. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +172 -13
  109. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +26 -26
  110. package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.mts +2 -2
  111. package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.ts +2 -2
  112. package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.mts +1 -1
  113. package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.ts +1 -1
  114. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.js +172 -2
  115. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +26 -26
  116. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +1 -1
  117. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +1 -1
  118. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
  119. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
  120. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +172 -13
  121. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +26 -26
  122. package/dist/libraries/react/components/ui/button.d.mts +2 -2
  123. package/dist/libraries/react/components/ui/button.d.ts +2 -2
  124. package/dist/libraries/react/components/ui/dialog.mjs +2 -2
  125. package/dist/libraries/react/components/ui/popover.mjs +2 -2
  126. package/dist/libraries/react/{cusTypes-CBapqjzm.d.mts → cusTypes-B2m4-oz4.d.mts} +1 -1
  127. package/dist/libraries/react/{cusTypes-D13MXEN7.d.ts → cusTypes-lMnznWYJ.d.ts} +1 -1
  128. package/dist/libraries/react/{entTypes-C1bM1Zpv.d.mts → entTypes-D-gn1jj2.d.mts} +1 -1
  129. package/dist/libraries/react/{entTypes-DbIrfEpl.d.ts → entTypes-WMQRyYAv.d.ts} +1 -1
  130. package/dist/libraries/react/{genTypes-C_ilxndU.d.mts → genTypes-DdYlVEah.d.mts} +1 -1
  131. package/dist/libraries/react/{genTypes-DjcQWIOM.d.ts → genTypes-aPPwPimh.d.ts} +1 -1
  132. package/dist/libraries/react/hooks/helpers/handleCheck.d.mts +6 -6
  133. package/dist/libraries/react/hooks/helpers/handleCheck.d.ts +6 -6
  134. package/dist/libraries/react/hooks/helpers/handleCheck.js +172 -2
  135. package/dist/libraries/react/hooks/helpers/handleCheck.mjs +2 -2
  136. package/dist/libraries/react/hooks/helpers/useAutumnBase.d.mts +6 -6
  137. package/dist/libraries/react/hooks/helpers/useAutumnBase.d.ts +6 -6
  138. package/dist/libraries/react/hooks/helpers/useAutumnBase.js +172 -3
  139. package/dist/libraries/react/hooks/helpers/useAutumnBase.mjs +3 -3
  140. package/dist/libraries/react/hooks/useAnalytics.d.mts +2 -2
  141. package/dist/libraries/react/hooks/useAnalytics.d.ts +2 -2
  142. package/dist/libraries/react/hooks/useAnalytics.js +172 -2
  143. package/dist/libraries/react/hooks/useAnalytics.mjs +5 -5
  144. package/dist/libraries/react/hooks/useCustomer.d.mts +66 -8
  145. package/dist/libraries/react/hooks/useCustomer.d.ts +66 -8
  146. package/dist/libraries/react/hooks/useCustomer.js +172 -13
  147. package/dist/libraries/react/hooks/useCustomer.mjs +9 -9
  148. package/dist/libraries/react/hooks/useCustomerBase.d.mts +50 -9
  149. package/dist/libraries/react/hooks/useCustomerBase.d.ts +50 -9
  150. package/dist/libraries/react/hooks/useCustomerBase.js +172 -13
  151. package/dist/libraries/react/hooks/useCustomerBase.mjs +8 -8
  152. package/dist/libraries/react/hooks/useEntity.d.mts +4 -4
  153. package/dist/libraries/react/hooks/useEntity.d.ts +4 -4
  154. package/dist/libraries/react/hooks/useEntity.js +172 -3
  155. package/dist/libraries/react/hooks/useEntity.mjs +9 -9
  156. package/dist/libraries/react/hooks/useEntityBase.d.mts +6 -6
  157. package/dist/libraries/react/hooks/useEntityBase.d.ts +6 -6
  158. package/dist/libraries/react/hooks/useEntityBase.js +172 -3
  159. package/dist/libraries/react/hooks/useEntityBase.mjs +8 -8
  160. package/dist/libraries/react/hooks/usePaywall.d.mts +1 -1
  161. package/dist/libraries/react/hooks/usePaywall.d.ts +1 -1
  162. package/dist/libraries/react/hooks/usePaywall.js +172 -2
  163. package/dist/libraries/react/hooks/usePaywall.mjs +5 -5
  164. package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
  165. package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
  166. package/dist/libraries/react/hooks/usePricingTable.js +172 -2
  167. package/dist/libraries/react/hooks/usePricingTable.mjs +6 -6
  168. package/dist/libraries/react/hooks/usePricingTableBase.d.mts +6 -6
  169. package/dist/libraries/react/hooks/usePricingTableBase.d.ts +6 -6
  170. package/dist/libraries/react/hooks/usePricingTableBase.js +172 -2
  171. package/dist/libraries/react/hooks/usePricingTableBase.mjs +2 -2
  172. package/dist/libraries/react/hooks/useProductsBase.d.mts +6 -6
  173. package/dist/libraries/react/hooks/useProductsBase.d.ts +6 -6
  174. package/dist/libraries/react/index.d.mts +104 -7
  175. package/dist/libraries/react/index.d.ts +104 -7
  176. package/dist/libraries/react/index.js +172 -13
  177. package/dist/libraries/react/index.mjs +172 -13
  178. package/dist/libraries/react/{prodTypes-B8NdKyKo.d.ts → prodTypes-C8xRoBP7.d.mts} +1 -1
  179. package/dist/libraries/react/{prodTypes-B8NdKyKo.d.mts → prodTypes-C8xRoBP7.d.ts} +1 -1
  180. package/dist/next/client/hooks/useCustomer.d.mts +44 -7
  181. package/dist/next/client/hooks/useCustomer.d.ts +44 -7
  182. package/dist/next/server/cusActions.d.mts +176 -6
  183. package/dist/next/server/cusActions.d.ts +176 -6
  184. package/dist/sdk/index.d.mts +174 -4
  185. package/dist/sdk/index.d.ts +174 -4
  186. package/dist/sdk/index.js +171 -1
  187. package/dist/sdk/index.mjs +171 -1
  188. package/dist/utils/encryptUtils.js +172 -2
  189. package/dist/utils/encryptUtils.mjs +172 -2
  190. package/package.json +1 -1
  191. package/dist/libraries/react/{chunk-7JNU5ABT.mjs → chunk-FJWZPMWU.mjs} +3 -3
  192. package/dist/libraries/react/{chunk-LCWL3TIT.mjs → chunk-OTZ65PCT.mjs} +3 -3
@@ -5412,22 +5412,92 @@ var Autumn = class {
5412
5412
  entities = entityMethods(this);
5413
5413
  referrals = referralMethods(this);
5414
5414
  features = featureMethods(this);
5415
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
5415
+ /**
5416
+ * Initiates a checkout flow for a product purchase.
5417
+ *
5418
+ * The checkout function handles the purchase process for products with pricing.
5419
+ * It determines whether to show a dialog for user input or redirect directly
5420
+ * to Stripe based on the customer's state and product requirements.
5421
+ *
5422
+ * @param params - Checkout parameters including product ID, customer data, and options
5423
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
5424
+ *
5425
+ * @example
5426
+ * ```typescript
5427
+ * const result = await autumn.checkout({
5428
+ * customer_id: "user_123",
5429
+ * product_id: "pro",
5430
+ * success_url: "https://myapp.com/success"
5431
+ * });
5432
+ *
5433
+ * if (result.url) {
5434
+ * // Redirect to Stripe checkout
5435
+ * window.location.href = result.url;
5436
+ * }
5437
+ * ```
5438
+ */
5416
5439
  async checkout(params) {
5417
5440
  return handleCheckout({
5418
5441
  instance: this,
5419
5442
  params
5420
5443
  });
5421
5444
  }
5422
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
5445
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
5423
5446
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
5447
+ /**
5448
+ * Attaches a product to a customer, enabling access and handling billing.
5449
+ *
5450
+ * The attach function activates a product for a customer and applies all product items.
5451
+ * When you attach a product:
5452
+ * - The customer gains access to all features in the product
5453
+ * - If the product has prices, the customer will be billed accordingly
5454
+ * - If there's no existing payment method, a checkout URL will be generated
5455
+ *
5456
+ * @param params - Attach parameters including customer ID, product ID, and options
5457
+ * @returns Promise resolving to attachment result with checkout URL if needed
5458
+ *
5459
+ * @example
5460
+ * ```typescript
5461
+ * const result = await autumn.attach({
5462
+ * customer_id: "user_123",
5463
+ * product_id: "pro",
5464
+ * success_url: "https://myapp.com/success"
5465
+ * });
5466
+ *
5467
+ * if (result.checkout_url) {
5468
+ * // Payment required - redirect to checkout
5469
+ * window.location.href = result.checkout_url;
5470
+ * } else {
5471
+ * // Product successfully attached
5472
+ * console.log("Access granted:", result.message);
5473
+ * }
5474
+ * ```
5475
+ */
5424
5476
  async attach(params) {
5425
5477
  return handleAttach({
5426
5478
  instance: this,
5427
5479
  params
5428
5480
  });
5429
5481
  }
5482
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
5430
5483
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
5484
+ /**
5485
+ * Sets up a payment method for a customer.
5486
+ *
5487
+ * This method allows you to set up payment methods for customers without
5488
+ * immediately charging them. Useful for collecting payment information
5489
+ * before product attachment or for updating existing payment methods.
5490
+ *
5491
+ * @param params - Setup payment parameters including customer information
5492
+ * @returns Promise resolving to setup payment result
5493
+ *
5494
+ * @example
5495
+ * ```typescript
5496
+ * const result = await autumn.setupPayment({
5497
+ * customer_id: "user_123"
5498
+ * });
5499
+ * ```
5500
+ */
5431
5501
  async setupPayment(params) {
5432
5502
  return handleSetupPayment({
5433
5503
  instance: this,
@@ -5435,6 +5505,24 @@ var Autumn = class {
5435
5505
  });
5436
5506
  }
5437
5507
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
5508
+ /**
5509
+ * Cancels a customer's subscription or product attachment.
5510
+ *
5511
+ * This method allows you to cancel a customer's subscription to a specific product.
5512
+ * You can choose to cancel immediately or at the end of the billing cycle.
5513
+ *
5514
+ * @param params - Cancel parameters including customer ID and product ID
5515
+ * @returns Promise resolving to cancellation result
5516
+ *
5517
+ * @example
5518
+ * ```typescript
5519
+ * const result = await autumn.cancel({
5520
+ * customer_id: "user_123",
5521
+ * product_id: "pro",
5522
+ * cancel_immediately: false // Cancel at end of billing cycle
5523
+ * });
5524
+ * ```
5525
+ */
5438
5526
  async cancel(params) {
5439
5527
  return handleCancel({
5440
5528
  instance: this,
@@ -5442,6 +5530,29 @@ var Autumn = class {
5442
5530
  });
5443
5531
  }
5444
5532
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
5533
+ /**
5534
+ * Checks if a customer has access to a specific feature.
5535
+ *
5536
+ * This method verifies whether a customer has permission to use a feature
5537
+ * and checks their remaining balance/usage limits. It can be used to gate
5538
+ * features and determine when to show upgrade prompts.
5539
+ *
5540
+ * @param params - Check parameters including customer ID and feature ID
5541
+ * @returns Promise resolving to access check result with allowed status and balance info
5542
+ *
5543
+ * @example
5544
+ * ```typescript
5545
+ * const result = await autumn.check({
5546
+ * customer_id: "user_123",
5547
+ * feature_id: "messages",
5548
+ * required_balance: 1
5549
+ * });
5550
+ *
5551
+ * if (!result.allowed) {
5552
+ * console.log("Feature access denied - upgrade required");
5553
+ * }
5554
+ * ```
5555
+ */
5445
5556
  async check(params) {
5446
5557
  return handleCheck({
5447
5558
  instance: this,
@@ -5449,12 +5560,50 @@ var Autumn = class {
5449
5560
  });
5450
5561
  }
5451
5562
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
5563
+ /**
5564
+ * Tracks usage events for features or analytics.
5565
+ *
5566
+ * This method records usage events for metered features, updating the customer's
5567
+ * balance and usage statistics. It's typically used server-side to ensure
5568
+ * accurate tracking that cannot be manipulated by users.
5569
+ *
5570
+ * @param params - Track parameters including customer ID, feature ID, and usage value
5571
+ * @returns Promise resolving to tracking result
5572
+ *
5573
+ * @example
5574
+ * ```typescript
5575
+ * const result = await autumn.track({
5576
+ * customer_id: "user_123",
5577
+ * feature_id: "messages",
5578
+ * value: 1 // Track 1 message sent
5579
+ * });
5580
+ * ```
5581
+ */
5452
5582
  async track(params) {
5453
5583
  return handleTrack({
5454
5584
  instance: this,
5455
5585
  params
5456
5586
  });
5457
5587
  }
5588
+ /**
5589
+ * Retrieves usage statistics and analytics for a customer.
5590
+ *
5591
+ * This method fetches detailed usage information for a customer's features,
5592
+ * including current balances, usage history, and analytics data. Useful
5593
+ * for displaying usage dashboards or generating reports.
5594
+ *
5595
+ * @param params - Usage parameters including customer ID and optional filters
5596
+ * @returns Promise resolving to usage statistics and analytics data
5597
+ *
5598
+ * @example
5599
+ * ```typescript
5600
+ * const result = await autumn.usage({
5601
+ * customer_id: "user_123",
5602
+ * feature_id: "messages"
5603
+ * value: 20 // Usage value
5604
+ * });
5605
+ * ```
5606
+ */
5458
5607
  async usage(params) {
5459
5608
  return handleUsage({
5460
5609
  instance: this,
@@ -5462,6 +5611,25 @@ var Autumn = class {
5462
5611
  });
5463
5612
  }
5464
5613
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
5614
+ /**
5615
+ * Performs advanced queries on customer data and analytics.
5616
+ *
5617
+ * This method allows you to run complex queries against customer data,
5618
+ * usage patterns, and billing information. Useful for generating reports,
5619
+ * analytics, and custom data insights.
5620
+ *
5621
+ * @param params - Query parameters including customer ID and query specifications
5622
+ * @returns Promise resolving to query results with requested data
5623
+ *
5624
+ * @example
5625
+ * ```typescript
5626
+ * const result = await autumn.query({
5627
+ * customer_id: "user_123",
5628
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
5629
+ * });
5630
+ *
5631
+ * ```
5632
+ */
5465
5633
  async query(params) {
5466
5634
  return handleQuery({
5467
5635
  instance: this,
@@ -5677,6 +5845,8 @@ var CheckoutParamsSchema = import_v47.z.object({
5677
5845
  product_id: import_v47.z.string(),
5678
5846
  entity_id: import_v47.z.string().optional(),
5679
5847
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
5848
+ force_checkout: import_v47.z.boolean().optional(),
5849
+ invoice: import_v47.z.boolean().optional(),
5680
5850
  success_url: import_v47.z.string().optional(),
5681
5851
  customer_data: CustomerDataSchema.optional(),
5682
5852
  entity_data: import_v47.z.any().optional(),
@@ -3,44 +3,44 @@
3
3
  "use client";
4
4
  import {
5
5
  PaywallDialog
6
- } from "../../chunk-JHFJKAXG.mjs";
6
+ } from "../../chunk-7A2PZDUO.mjs";
7
7
  import "../../chunk-URQMBRFZ.mjs";
8
+ import "../../chunk-GUM4HIGI.mjs";
9
+ import "../../chunk-OTZ65PCT.mjs";
10
+ import "../../chunk-YWQTQ72B.mjs";
11
+ import "../../chunk-KUS3X33V.mjs";
12
+ import "../../chunk-BLM4DAAR.mjs";
13
+ import "../../chunk-I5ZGIAIX.mjs";
8
14
  import "../../chunk-JGDTNJTR.mjs";
9
15
  import "../../chunk-EV5RNY5U.mjs";
10
- import "../../chunk-7JNU5ABT.mjs";
11
- import "../../chunk-QJPZFEVW.mjs";
12
- import "../../chunk-GUM4HIGI.mjs";
13
- import "../../chunk-LCWL3TIT.mjs";
16
+ import "../../chunk-FJWZPMWU.mjs";
14
17
  import "../../chunk-FEISQQNM.mjs";
18
+ import "../../chunk-QJPZFEVW.mjs";
15
19
  import "../../chunk-I2A7PK2L.mjs";
16
- import "../../chunk-YWQTQ72B.mjs";
17
- import "../../chunk-KUS3X33V.mjs";
18
20
  import "../../chunk-7TYAAD2T.mjs";
19
21
  import "../../chunk-RPEGNKJH.mjs";
20
- import "../../chunk-BLM4DAAR.mjs";
21
- import "../../chunk-I5ZGIAIX.mjs";
22
- import "../../chunk-VZY225C6.mjs";
23
- import "../../chunk-4NZ7ML7V.mjs";
24
- import "../../chunk-KP2Q65Y3.mjs";
25
- import "../../chunk-2ENHPIYQ.mjs";
26
- import "../../chunk-3MF54MDU.mjs";
27
- import "../../chunk-67RWFVWN.mjs";
28
- import "../../chunk-4J6OC4ZQ.mjs";
29
22
  import "../../chunk-WVKYZYFT.mjs";
30
- import "../../chunk-TTLL63A4.mjs";
31
- import "../../chunk-OMJJLT2Q.mjs";
23
+ import "../../chunk-CMUWZZWV.mjs";
24
+ import "../../chunk-RK4NRHHQ.mjs";
25
+ import "../../chunk-5RTUQSYZ.mjs";
26
+ import "../../chunk-HNIU2WNT.mjs";
27
+ import "../../chunk-4J6OC4ZQ.mjs";
28
+ import "../../chunk-ROKCGZ77.mjs";
29
+ import "../../chunk-26K62U62.mjs";
30
+ import "../../chunk-QNMB7QR6.mjs";
31
+ import "../../chunk-VGNA76RG.mjs";
32
32
  import "../../chunk-RFSQBGLO.mjs";
33
- import "../../chunk-XK3AXQED.mjs";
34
- import "../../chunk-KMYL54B4.mjs";
35
- import "../../chunk-6D6TYTTO.mjs";
36
- import "../../chunk-YHT2JUXO.mjs";
37
- import "../../chunk-FDNQ6GRK.mjs";
38
- import "../../chunk-U3OQJXCW.mjs";
39
- import "../../chunk-WYQMHQUE.mjs";
40
- import "../../chunk-CIBQ4BJU.mjs";
33
+ import "../../chunk-6X76WFOV.mjs";
34
+ import "../../chunk-DKOF357C.mjs";
35
+ import "../../chunk-P6CAHZVT.mjs";
36
+ import "../../chunk-7HRCOEUW.mjs";
37
+ import "../../chunk-TE2MOBO7.mjs";
38
+ import "../../chunk-JTYEHM27.mjs";
39
+ import "../../chunk-5O3IHYFF.mjs";
41
40
  import "../../chunk-V575SGOW.mjs";
42
41
  import "../../chunk-ZV4RPZTM.mjs";
43
42
  import "../../chunk-JVCOY7ZL.mjs";
43
+ import "../../chunk-CIBQ4BJU.mjs";
44
44
  import "../../chunk-VTGR7VVK.mjs";
45
45
  import "../../chunk-WFFVOEUG.mjs";
46
46
  import "../../chunk-ZF2HUCN6.mjs";
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as Product } from '../../../prodTypes-B8NdKyKo.mjs';
2
+ import { P as Product } from '../../../prodTypes-C8xRoBP7.mjs';
3
3
  import 'zod/v4';
4
4
 
5
5
  declare const getPricingTableContent: (product: Product) => {
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as Product } from '../../../prodTypes-B8NdKyKo.js';
2
+ import { P as Product } from '../../../prodTypes-C8xRoBP7.js';
3
3
  import 'zod/v4';
4
4
 
5
5
  declare const getPricingTableContent: (product: Product) => {
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React__default from 'react';
3
- import { P as Product, a as ProductItem } from '../../prodTypes-B8NdKyKo.mjs';
3
+ import { P as Product, c as ProductItem } from '../../prodTypes-C8xRoBP7.mjs';
4
4
  import { ProductDetails } from '../../client/types/clientPricingTableTypes.mjs';
5
5
  import 'zod/v4';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React__default from 'react';
3
- import { P as Product, a as ProductItem } from '../../prodTypes-B8NdKyKo.js';
3
+ import { P as Product, c as ProductItem } from '../../prodTypes-C8xRoBP7.js';
4
4
  import { ProductDetails } from '../../client/types/clientPricingTableTypes.js';
5
5
  import 'zod/v4';
6
6
 
@@ -519,22 +519,92 @@ var Autumn = class {
519
519
  entities = entityMethods(this);
520
520
  referrals = referralMethods(this);
521
521
  features = featureMethods(this);
522
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
522
+ /**
523
+ * Initiates a checkout flow for a product purchase.
524
+ *
525
+ * The checkout function handles the purchase process for products with pricing.
526
+ * It determines whether to show a dialog for user input or redirect directly
527
+ * to Stripe based on the customer's state and product requirements.
528
+ *
529
+ * @param params - Checkout parameters including product ID, customer data, and options
530
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
531
+ *
532
+ * @example
533
+ * ```typescript
534
+ * const result = await autumn.checkout({
535
+ * customer_id: "user_123",
536
+ * product_id: "pro",
537
+ * success_url: "https://myapp.com/success"
538
+ * });
539
+ *
540
+ * if (result.url) {
541
+ * // Redirect to Stripe checkout
542
+ * window.location.href = result.url;
543
+ * }
544
+ * ```
545
+ */
523
546
  async checkout(params) {
524
547
  return handleCheckout({
525
548
  instance: this,
526
549
  params
527
550
  });
528
551
  }
529
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
552
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
530
553
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
554
+ /**
555
+ * Attaches a product to a customer, enabling access and handling billing.
556
+ *
557
+ * The attach function activates a product for a customer and applies all product items.
558
+ * When you attach a product:
559
+ * - The customer gains access to all features in the product
560
+ * - If the product has prices, the customer will be billed accordingly
561
+ * - If there's no existing payment method, a checkout URL will be generated
562
+ *
563
+ * @param params - Attach parameters including customer ID, product ID, and options
564
+ * @returns Promise resolving to attachment result with checkout URL if needed
565
+ *
566
+ * @example
567
+ * ```typescript
568
+ * const result = await autumn.attach({
569
+ * customer_id: "user_123",
570
+ * product_id: "pro",
571
+ * success_url: "https://myapp.com/success"
572
+ * });
573
+ *
574
+ * if (result.checkout_url) {
575
+ * // Payment required - redirect to checkout
576
+ * window.location.href = result.checkout_url;
577
+ * } else {
578
+ * // Product successfully attached
579
+ * console.log("Access granted:", result.message);
580
+ * }
581
+ * ```
582
+ */
531
583
  async attach(params) {
532
584
  return handleAttach({
533
585
  instance: this,
534
586
  params
535
587
  });
536
588
  }
589
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
537
590
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
591
+ /**
592
+ * Sets up a payment method for a customer.
593
+ *
594
+ * This method allows you to set up payment methods for customers without
595
+ * immediately charging them. Useful for collecting payment information
596
+ * before product attachment or for updating existing payment methods.
597
+ *
598
+ * @param params - Setup payment parameters including customer information
599
+ * @returns Promise resolving to setup payment result
600
+ *
601
+ * @example
602
+ * ```typescript
603
+ * const result = await autumn.setupPayment({
604
+ * customer_id: "user_123"
605
+ * });
606
+ * ```
607
+ */
538
608
  async setupPayment(params) {
539
609
  return handleSetupPayment({
540
610
  instance: this,
@@ -542,6 +612,24 @@ var Autumn = class {
542
612
  });
543
613
  }
544
614
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
615
+ /**
616
+ * Cancels a customer's subscription or product attachment.
617
+ *
618
+ * This method allows you to cancel a customer's subscription to a specific product.
619
+ * You can choose to cancel immediately or at the end of the billing cycle.
620
+ *
621
+ * @param params - Cancel parameters including customer ID and product ID
622
+ * @returns Promise resolving to cancellation result
623
+ *
624
+ * @example
625
+ * ```typescript
626
+ * const result = await autumn.cancel({
627
+ * customer_id: "user_123",
628
+ * product_id: "pro",
629
+ * cancel_immediately: false // Cancel at end of billing cycle
630
+ * });
631
+ * ```
632
+ */
545
633
  async cancel(params) {
546
634
  return handleCancel({
547
635
  instance: this,
@@ -549,6 +637,29 @@ var Autumn = class {
549
637
  });
550
638
  }
551
639
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
640
+ /**
641
+ * Checks if a customer has access to a specific feature.
642
+ *
643
+ * This method verifies whether a customer has permission to use a feature
644
+ * and checks their remaining balance/usage limits. It can be used to gate
645
+ * features and determine when to show upgrade prompts.
646
+ *
647
+ * @param params - Check parameters including customer ID and feature ID
648
+ * @returns Promise resolving to access check result with allowed status and balance info
649
+ *
650
+ * @example
651
+ * ```typescript
652
+ * const result = await autumn.check({
653
+ * customer_id: "user_123",
654
+ * feature_id: "messages",
655
+ * required_balance: 1
656
+ * });
657
+ *
658
+ * if (!result.allowed) {
659
+ * console.log("Feature access denied - upgrade required");
660
+ * }
661
+ * ```
662
+ */
552
663
  async check(params) {
553
664
  return handleCheck({
554
665
  instance: this,
@@ -556,12 +667,50 @@ var Autumn = class {
556
667
  });
557
668
  }
558
669
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
670
+ /**
671
+ * Tracks usage events for features or analytics.
672
+ *
673
+ * This method records usage events for metered features, updating the customer's
674
+ * balance and usage statistics. It's typically used server-side to ensure
675
+ * accurate tracking that cannot be manipulated by users.
676
+ *
677
+ * @param params - Track parameters including customer ID, feature ID, and usage value
678
+ * @returns Promise resolving to tracking result
679
+ *
680
+ * @example
681
+ * ```typescript
682
+ * const result = await autumn.track({
683
+ * customer_id: "user_123",
684
+ * feature_id: "messages",
685
+ * value: 1 // Track 1 message sent
686
+ * });
687
+ * ```
688
+ */
559
689
  async track(params) {
560
690
  return handleTrack({
561
691
  instance: this,
562
692
  params
563
693
  });
564
694
  }
695
+ /**
696
+ * Retrieves usage statistics and analytics for a customer.
697
+ *
698
+ * This method fetches detailed usage information for a customer's features,
699
+ * including current balances, usage history, and analytics data. Useful
700
+ * for displaying usage dashboards or generating reports.
701
+ *
702
+ * @param params - Usage parameters including customer ID and optional filters
703
+ * @returns Promise resolving to usage statistics and analytics data
704
+ *
705
+ * @example
706
+ * ```typescript
707
+ * const result = await autumn.usage({
708
+ * customer_id: "user_123",
709
+ * feature_id: "messages"
710
+ * value: 20 // Usage value
711
+ * });
712
+ * ```
713
+ */
565
714
  async usage(params) {
566
715
  return handleUsage({
567
716
  instance: this,
@@ -569,6 +718,25 @@ var Autumn = class {
569
718
  });
570
719
  }
571
720
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
721
+ /**
722
+ * Performs advanced queries on customer data and analytics.
723
+ *
724
+ * This method allows you to run complex queries against customer data,
725
+ * usage patterns, and billing information. Useful for generating reports,
726
+ * analytics, and custom data insights.
727
+ *
728
+ * @param params - Query parameters including customer ID and query specifications
729
+ * @returns Promise resolving to query results with requested data
730
+ *
731
+ * @example
732
+ * ```typescript
733
+ * const result = await autumn.query({
734
+ * customer_id: "user_123",
735
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
736
+ * });
737
+ *
738
+ * ```
739
+ */
572
740
  async query(params) {
573
741
  return handleQuery({
574
742
  instance: this,
@@ -784,6 +952,8 @@ var CheckoutParamsSchema = import_v47.z.object({
784
952
  product_id: import_v47.z.string(),
785
953
  entity_id: import_v47.z.string().optional(),
786
954
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
955
+ force_checkout: import_v47.z.boolean().optional(),
956
+ invoice: import_v47.z.boolean().optional(),
787
957
  success_url: import_v47.z.string().optional(),
788
958
  customer_data: CustomerDataSchema.optional(),
789
959
  entity_data: import_v47.z.any().optional(),
@@ -1483,7 +1653,6 @@ var useAutumnBase = ({
1483
1653
  };
1484
1654
  return {
1485
1655
  attach,
1486
- // check,
1487
1656
  track,
1488
1657
  cancel,
1489
1658
  openBillingPortal,
@@ -1703,16 +1872,6 @@ var useCustomerBase = ({
1703
1872
  context
1704
1873
  });
1705
1874
  return res;
1706
- },
1707
- /** @deprecated Use check() instead */
1708
- allowed: (params2) => {
1709
- const result = handleCheck2({
1710
- customer,
1711
- params: params2,
1712
- isEntity: false,
1713
- context
1714
- });
1715
- return result.data.allowed;
1716
1875
  }
1717
1876
  };
1718
1877
  };
@@ -9,44 +9,44 @@ import {
9
9
  PricingTableContainer,
10
10
  RecommendedBadge,
11
11
  usePricingTableContext
12
- } from "../../chunk-JHFJKAXG.mjs";
12
+ } from "../../chunk-7A2PZDUO.mjs";
13
13
  import "../../chunk-URQMBRFZ.mjs";
14
+ import "../../chunk-GUM4HIGI.mjs";
15
+ import "../../chunk-OTZ65PCT.mjs";
16
+ import "../../chunk-YWQTQ72B.mjs";
17
+ import "../../chunk-KUS3X33V.mjs";
18
+ import "../../chunk-BLM4DAAR.mjs";
19
+ import "../../chunk-I5ZGIAIX.mjs";
14
20
  import "../../chunk-JGDTNJTR.mjs";
15
21
  import "../../chunk-EV5RNY5U.mjs";
16
- import "../../chunk-7JNU5ABT.mjs";
17
- import "../../chunk-QJPZFEVW.mjs";
18
- import "../../chunk-GUM4HIGI.mjs";
19
- import "../../chunk-LCWL3TIT.mjs";
22
+ import "../../chunk-FJWZPMWU.mjs";
20
23
  import "../../chunk-FEISQQNM.mjs";
24
+ import "../../chunk-QJPZFEVW.mjs";
21
25
  import "../../chunk-I2A7PK2L.mjs";
22
- import "../../chunk-YWQTQ72B.mjs";
23
- import "../../chunk-KUS3X33V.mjs";
24
26
  import "../../chunk-7TYAAD2T.mjs";
25
27
  import "../../chunk-RPEGNKJH.mjs";
26
- import "../../chunk-BLM4DAAR.mjs";
27
- import "../../chunk-I5ZGIAIX.mjs";
28
- import "../../chunk-VZY225C6.mjs";
29
- import "../../chunk-4NZ7ML7V.mjs";
30
- import "../../chunk-KP2Q65Y3.mjs";
31
- import "../../chunk-2ENHPIYQ.mjs";
32
- import "../../chunk-3MF54MDU.mjs";
33
- import "../../chunk-67RWFVWN.mjs";
34
- import "../../chunk-4J6OC4ZQ.mjs";
35
28
  import "../../chunk-WVKYZYFT.mjs";
36
- import "../../chunk-TTLL63A4.mjs";
37
- import "../../chunk-OMJJLT2Q.mjs";
29
+ import "../../chunk-CMUWZZWV.mjs";
30
+ import "../../chunk-RK4NRHHQ.mjs";
31
+ import "../../chunk-5RTUQSYZ.mjs";
32
+ import "../../chunk-HNIU2WNT.mjs";
33
+ import "../../chunk-4J6OC4ZQ.mjs";
34
+ import "../../chunk-ROKCGZ77.mjs";
35
+ import "../../chunk-26K62U62.mjs";
36
+ import "../../chunk-QNMB7QR6.mjs";
37
+ import "../../chunk-VGNA76RG.mjs";
38
38
  import "../../chunk-RFSQBGLO.mjs";
39
- import "../../chunk-XK3AXQED.mjs";
40
- import "../../chunk-KMYL54B4.mjs";
41
- import "../../chunk-6D6TYTTO.mjs";
42
- import "../../chunk-YHT2JUXO.mjs";
43
- import "../../chunk-FDNQ6GRK.mjs";
44
- import "../../chunk-U3OQJXCW.mjs";
45
- import "../../chunk-WYQMHQUE.mjs";
46
- import "../../chunk-CIBQ4BJU.mjs";
39
+ import "../../chunk-6X76WFOV.mjs";
40
+ import "../../chunk-DKOF357C.mjs";
41
+ import "../../chunk-P6CAHZVT.mjs";
42
+ import "../../chunk-7HRCOEUW.mjs";
43
+ import "../../chunk-TE2MOBO7.mjs";
44
+ import "../../chunk-JTYEHM27.mjs";
45
+ import "../../chunk-5O3IHYFF.mjs";
47
46
  import "../../chunk-V575SGOW.mjs";
48
47
  import "../../chunk-ZV4RPZTM.mjs";
49
48
  import "../../chunk-JVCOY7ZL.mjs";
49
+ import "../../chunk-CIBQ4BJU.mjs";
50
50
  import "../../chunk-VTGR7VVK.mjs";
51
51
  import "../../chunk-WFFVOEUG.mjs";
52
52
  import "../../chunk-ZF2HUCN6.mjs";
@@ -3,8 +3,8 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
- variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
7
- size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
7
+ size?: "sm" | "lg" | "default" | "icon" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
10
  asChild?: boolean;