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
@@ -487,22 +487,92 @@ var Autumn = class {
487
487
  entities = entityMethods(this);
488
488
  referrals = referralMethods(this);
489
489
  features = featureMethods(this);
490
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
490
+ /**
491
+ * Initiates a checkout flow for a product purchase.
492
+ *
493
+ * The checkout function handles the purchase process for products with pricing.
494
+ * It determines whether to show a dialog for user input or redirect directly
495
+ * to Stripe based on the customer's state and product requirements.
496
+ *
497
+ * @param params - Checkout parameters including product ID, customer data, and options
498
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
499
+ *
500
+ * @example
501
+ * ```typescript
502
+ * const result = await autumn.checkout({
503
+ * customer_id: "user_123",
504
+ * product_id: "pro",
505
+ * success_url: "https://myapp.com/success"
506
+ * });
507
+ *
508
+ * if (result.url) {
509
+ * // Redirect to Stripe checkout
510
+ * window.location.href = result.url;
511
+ * }
512
+ * ```
513
+ */
491
514
  async checkout(params) {
492
515
  return handleCheckout({
493
516
  instance: this,
494
517
  params
495
518
  });
496
519
  }
497
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
520
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
498
521
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
522
+ /**
523
+ * Attaches a product to a customer, enabling access and handling billing.
524
+ *
525
+ * The attach function activates a product for a customer and applies all product items.
526
+ * When you attach a product:
527
+ * - The customer gains access to all features in the product
528
+ * - If the product has prices, the customer will be billed accordingly
529
+ * - If there's no existing payment method, a checkout URL will be generated
530
+ *
531
+ * @param params - Attach parameters including customer ID, product ID, and options
532
+ * @returns Promise resolving to attachment result with checkout URL if needed
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * const result = await autumn.attach({
537
+ * customer_id: "user_123",
538
+ * product_id: "pro",
539
+ * success_url: "https://myapp.com/success"
540
+ * });
541
+ *
542
+ * if (result.checkout_url) {
543
+ * // Payment required - redirect to checkout
544
+ * window.location.href = result.checkout_url;
545
+ * } else {
546
+ * // Product successfully attached
547
+ * console.log("Access granted:", result.message);
548
+ * }
549
+ * ```
550
+ */
499
551
  async attach(params) {
500
552
  return handleAttach({
501
553
  instance: this,
502
554
  params
503
555
  });
504
556
  }
557
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
505
558
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
559
+ /**
560
+ * Sets up a payment method for a customer.
561
+ *
562
+ * This method allows you to set up payment methods for customers without
563
+ * immediately charging them. Useful for collecting payment information
564
+ * before product attachment or for updating existing payment methods.
565
+ *
566
+ * @param params - Setup payment parameters including customer information
567
+ * @returns Promise resolving to setup payment result
568
+ *
569
+ * @example
570
+ * ```typescript
571
+ * const result = await autumn.setupPayment({
572
+ * customer_id: "user_123"
573
+ * });
574
+ * ```
575
+ */
506
576
  async setupPayment(params) {
507
577
  return handleSetupPayment({
508
578
  instance: this,
@@ -510,6 +580,24 @@ var Autumn = class {
510
580
  });
511
581
  }
512
582
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
583
+ /**
584
+ * Cancels a customer's subscription or product attachment.
585
+ *
586
+ * This method allows you to cancel a customer's subscription to a specific product.
587
+ * You can choose to cancel immediately or at the end of the billing cycle.
588
+ *
589
+ * @param params - Cancel parameters including customer ID and product ID
590
+ * @returns Promise resolving to cancellation result
591
+ *
592
+ * @example
593
+ * ```typescript
594
+ * const result = await autumn.cancel({
595
+ * customer_id: "user_123",
596
+ * product_id: "pro",
597
+ * cancel_immediately: false // Cancel at end of billing cycle
598
+ * });
599
+ * ```
600
+ */
513
601
  async cancel(params) {
514
602
  return handleCancel({
515
603
  instance: this,
@@ -517,6 +605,29 @@ var Autumn = class {
517
605
  });
518
606
  }
519
607
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
608
+ /**
609
+ * Checks if a customer has access to a specific feature.
610
+ *
611
+ * This method verifies whether a customer has permission to use a feature
612
+ * and checks their remaining balance/usage limits. It can be used to gate
613
+ * features and determine when to show upgrade prompts.
614
+ *
615
+ * @param params - Check parameters including customer ID and feature ID
616
+ * @returns Promise resolving to access check result with allowed status and balance info
617
+ *
618
+ * @example
619
+ * ```typescript
620
+ * const result = await autumn.check({
621
+ * customer_id: "user_123",
622
+ * feature_id: "messages",
623
+ * required_balance: 1
624
+ * });
625
+ *
626
+ * if (!result.allowed) {
627
+ * console.log("Feature access denied - upgrade required");
628
+ * }
629
+ * ```
630
+ */
520
631
  async check(params) {
521
632
  return handleCheck({
522
633
  instance: this,
@@ -524,12 +635,50 @@ var Autumn = class {
524
635
  });
525
636
  }
526
637
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
638
+ /**
639
+ * Tracks usage events for features or analytics.
640
+ *
641
+ * This method records usage events for metered features, updating the customer's
642
+ * balance and usage statistics. It's typically used server-side to ensure
643
+ * accurate tracking that cannot be manipulated by users.
644
+ *
645
+ * @param params - Track parameters including customer ID, feature ID, and usage value
646
+ * @returns Promise resolving to tracking result
647
+ *
648
+ * @example
649
+ * ```typescript
650
+ * const result = await autumn.track({
651
+ * customer_id: "user_123",
652
+ * feature_id: "messages",
653
+ * value: 1 // Track 1 message sent
654
+ * });
655
+ * ```
656
+ */
527
657
  async track(params) {
528
658
  return handleTrack({
529
659
  instance: this,
530
660
  params
531
661
  });
532
662
  }
663
+ /**
664
+ * Retrieves usage statistics and analytics for a customer.
665
+ *
666
+ * This method fetches detailed usage information for a customer's features,
667
+ * including current balances, usage history, and analytics data. Useful
668
+ * for displaying usage dashboards or generating reports.
669
+ *
670
+ * @param params - Usage parameters including customer ID and optional filters
671
+ * @returns Promise resolving to usage statistics and analytics data
672
+ *
673
+ * @example
674
+ * ```typescript
675
+ * const result = await autumn.usage({
676
+ * customer_id: "user_123",
677
+ * feature_id: "messages"
678
+ * value: 20 // Usage value
679
+ * });
680
+ * ```
681
+ */
533
682
  async usage(params) {
534
683
  return handleUsage({
535
684
  instance: this,
@@ -537,6 +686,25 @@ var Autumn = class {
537
686
  });
538
687
  }
539
688
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
689
+ /**
690
+ * Performs advanced queries on customer data and analytics.
691
+ *
692
+ * This method allows you to run complex queries against customer data,
693
+ * usage patterns, and billing information. Useful for generating reports,
694
+ * analytics, and custom data insights.
695
+ *
696
+ * @param params - Query parameters including customer ID and query specifications
697
+ * @returns Promise resolving to query results with requested data
698
+ *
699
+ * @example
700
+ * ```typescript
701
+ * const result = await autumn.query({
702
+ * customer_id: "user_123",
703
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
704
+ * });
705
+ *
706
+ * ```
707
+ */
540
708
  async query(params) {
541
709
  return handleQuery({
542
710
  instance: this,
@@ -752,6 +920,8 @@ var CheckoutParamsSchema = import_v47.z.object({
752
920
  product_id: import_v47.z.string(),
753
921
  entity_id: import_v47.z.string().optional(),
754
922
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
923
+ force_checkout: import_v47.z.boolean().optional(),
924
+ invoice: import_v47.z.boolean().optional(),
755
925
  success_url: import_v47.z.string().optional(),
756
926
  customer_data: CustomerDataSchema.optional(),
757
927
  entity_data: import_v47.z.any().optional(),
@@ -2,15 +2,15 @@
2
2
 
3
3
  import {
4
4
  usePricingTable
5
- } from "../chunk-67RWFVWN.mjs";
6
- import "../chunk-YHT2JUXO.mjs";
7
- import "../chunk-FDNQ6GRK.mjs";
8
- import "../chunk-U3OQJXCW.mjs";
9
- import "../chunk-WYQMHQUE.mjs";
10
- import "../chunk-CIBQ4BJU.mjs";
5
+ } from "../chunk-HNIU2WNT.mjs";
6
+ import "../chunk-7HRCOEUW.mjs";
7
+ import "../chunk-TE2MOBO7.mjs";
8
+ import "../chunk-JTYEHM27.mjs";
9
+ import "../chunk-5O3IHYFF.mjs";
11
10
  import "../chunk-V575SGOW.mjs";
12
11
  import "../chunk-ZV4RPZTM.mjs";
13
12
  import "../chunk-JVCOY7ZL.mjs";
13
+ import "../chunk-CIBQ4BJU.mjs";
14
14
  import "../chunk-VTGR7VVK.mjs";
15
15
  import "../chunk-WFFVOEUG.mjs";
16
16
  import "../chunk-ZF2HUCN6.mjs";
@@ -1,15 +1,15 @@
1
1
  import * as swr from 'swr';
2
2
  import { A as AutumnError } from '../error-DHbclCVh.mjs';
3
- import { P as Product } from '../prodTypes-B8NdKyKo.mjs';
3
+ import { P as Product } from '../prodTypes-C8xRoBP7.mjs';
4
4
  import { ProductDetails } from '../client/types/clientPricingTableTypes.mjs';
5
- import { A as AutumnClient } from '../ReactAutumnClient-IFdMWiu5.mjs';
5
+ import { A as AutumnClient } from '../ReactAutumnClient-zBxnpPLM.mjs';
6
6
  import 'zod/v4';
7
7
  import '../client/types/clientEntTypes.mjs';
8
8
  import '../client/types/clientGenTypes.mjs';
9
- import '../genTypes-C_ilxndU.mjs';
10
- import '../attachTypes-C5gcbNrS.mjs';
11
- import '../entTypes-C1bM1Zpv.mjs';
12
- import '../cusTypes-CBapqjzm.mjs';
9
+ import '../genTypes-DdYlVEah.mjs';
10
+ import '../attachTypes-Cuxn1ThG.mjs';
11
+ import '../entTypes-D-gn1jj2.mjs';
12
+ import '../cusTypes-B2m4-oz4.mjs';
13
13
 
14
14
  declare const usePricingTableBase: ({ client, params, }: {
15
15
  client: AutumnClient;
@@ -1,15 +1,15 @@
1
1
  import * as swr from 'swr';
2
2
  import { A as AutumnError } from '../error-DHbclCVh.js';
3
- import { P as Product } from '../prodTypes-B8NdKyKo.js';
3
+ import { P as Product } from '../prodTypes-C8xRoBP7.js';
4
4
  import { ProductDetails } from '../client/types/clientPricingTableTypes.js';
5
- import { A as AutumnClient } from '../ReactAutumnClient-CfDtucnL.js';
5
+ import { A as AutumnClient } from '../ReactAutumnClient-CIAkiqwV.js';
6
6
  import 'zod/v4';
7
7
  import '../client/types/clientEntTypes.js';
8
8
  import '../client/types/clientGenTypes.js';
9
- import '../genTypes-DjcQWIOM.js';
10
- import '../attachTypes-CLK4jfuj.js';
11
- import '../entTypes-DbIrfEpl.js';
12
- import '../cusTypes-D13MXEN7.js';
9
+ import '../genTypes-aPPwPimh.js';
10
+ import '../attachTypes-BQaZHr5e.js';
11
+ import '../entTypes-WMQRyYAv.js';
12
+ import '../cusTypes-lMnznWYJ.js';
13
13
 
14
14
  declare const usePricingTableBase: ({ client, params, }: {
15
15
  client: AutumnClient;
@@ -485,22 +485,92 @@ var Autumn = class {
485
485
  entities = entityMethods(this);
486
486
  referrals = referralMethods(this);
487
487
  features = featureMethods(this);
488
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
488
+ /**
489
+ * Initiates a checkout flow for a product purchase.
490
+ *
491
+ * The checkout function handles the purchase process for products with pricing.
492
+ * It determines whether to show a dialog for user input or redirect directly
493
+ * to Stripe based on the customer's state and product requirements.
494
+ *
495
+ * @param params - Checkout parameters including product ID, customer data, and options
496
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
497
+ *
498
+ * @example
499
+ * ```typescript
500
+ * const result = await autumn.checkout({
501
+ * customer_id: "user_123",
502
+ * product_id: "pro",
503
+ * success_url: "https://myapp.com/success"
504
+ * });
505
+ *
506
+ * if (result.url) {
507
+ * // Redirect to Stripe checkout
508
+ * window.location.href = result.url;
509
+ * }
510
+ * ```
511
+ */
489
512
  async checkout(params) {
490
513
  return handleCheckout({
491
514
  instance: this,
492
515
  params
493
516
  });
494
517
  }
495
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
518
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
496
519
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
520
+ /**
521
+ * Attaches a product to a customer, enabling access and handling billing.
522
+ *
523
+ * The attach function activates a product for a customer and applies all product items.
524
+ * When you attach a product:
525
+ * - The customer gains access to all features in the product
526
+ * - If the product has prices, the customer will be billed accordingly
527
+ * - If there's no existing payment method, a checkout URL will be generated
528
+ *
529
+ * @param params - Attach parameters including customer ID, product ID, and options
530
+ * @returns Promise resolving to attachment result with checkout URL if needed
531
+ *
532
+ * @example
533
+ * ```typescript
534
+ * const result = await autumn.attach({
535
+ * customer_id: "user_123",
536
+ * product_id: "pro",
537
+ * success_url: "https://myapp.com/success"
538
+ * });
539
+ *
540
+ * if (result.checkout_url) {
541
+ * // Payment required - redirect to checkout
542
+ * window.location.href = result.checkout_url;
543
+ * } else {
544
+ * // Product successfully attached
545
+ * console.log("Access granted:", result.message);
546
+ * }
547
+ * ```
548
+ */
497
549
  async attach(params) {
498
550
  return handleAttach({
499
551
  instance: this,
500
552
  params
501
553
  });
502
554
  }
555
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
503
556
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
557
+ /**
558
+ * Sets up a payment method for a customer.
559
+ *
560
+ * This method allows you to set up payment methods for customers without
561
+ * immediately charging them. Useful for collecting payment information
562
+ * before product attachment or for updating existing payment methods.
563
+ *
564
+ * @param params - Setup payment parameters including customer information
565
+ * @returns Promise resolving to setup payment result
566
+ *
567
+ * @example
568
+ * ```typescript
569
+ * const result = await autumn.setupPayment({
570
+ * customer_id: "user_123"
571
+ * });
572
+ * ```
573
+ */
504
574
  async setupPayment(params) {
505
575
  return handleSetupPayment({
506
576
  instance: this,
@@ -508,6 +578,24 @@ var Autumn = class {
508
578
  });
509
579
  }
510
580
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
581
+ /**
582
+ * Cancels a customer's subscription or product attachment.
583
+ *
584
+ * This method allows you to cancel a customer's subscription to a specific product.
585
+ * You can choose to cancel immediately or at the end of the billing cycle.
586
+ *
587
+ * @param params - Cancel parameters including customer ID and product ID
588
+ * @returns Promise resolving to cancellation result
589
+ *
590
+ * @example
591
+ * ```typescript
592
+ * const result = await autumn.cancel({
593
+ * customer_id: "user_123",
594
+ * product_id: "pro",
595
+ * cancel_immediately: false // Cancel at end of billing cycle
596
+ * });
597
+ * ```
598
+ */
511
599
  async cancel(params) {
512
600
  return handleCancel({
513
601
  instance: this,
@@ -515,6 +603,29 @@ var Autumn = class {
515
603
  });
516
604
  }
517
605
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
606
+ /**
607
+ * Checks if a customer has access to a specific feature.
608
+ *
609
+ * This method verifies whether a customer has permission to use a feature
610
+ * and checks their remaining balance/usage limits. It can be used to gate
611
+ * features and determine when to show upgrade prompts.
612
+ *
613
+ * @param params - Check parameters including customer ID and feature ID
614
+ * @returns Promise resolving to access check result with allowed status and balance info
615
+ *
616
+ * @example
617
+ * ```typescript
618
+ * const result = await autumn.check({
619
+ * customer_id: "user_123",
620
+ * feature_id: "messages",
621
+ * required_balance: 1
622
+ * });
623
+ *
624
+ * if (!result.allowed) {
625
+ * console.log("Feature access denied - upgrade required");
626
+ * }
627
+ * ```
628
+ */
518
629
  async check(params) {
519
630
  return handleCheck({
520
631
  instance: this,
@@ -522,12 +633,50 @@ var Autumn = class {
522
633
  });
523
634
  }
524
635
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
636
+ /**
637
+ * Tracks usage events for features or analytics.
638
+ *
639
+ * This method records usage events for metered features, updating the customer's
640
+ * balance and usage statistics. It's typically used server-side to ensure
641
+ * accurate tracking that cannot be manipulated by users.
642
+ *
643
+ * @param params - Track parameters including customer ID, feature ID, and usage value
644
+ * @returns Promise resolving to tracking result
645
+ *
646
+ * @example
647
+ * ```typescript
648
+ * const result = await autumn.track({
649
+ * customer_id: "user_123",
650
+ * feature_id: "messages",
651
+ * value: 1 // Track 1 message sent
652
+ * });
653
+ * ```
654
+ */
525
655
  async track(params) {
526
656
  return handleTrack({
527
657
  instance: this,
528
658
  params
529
659
  });
530
660
  }
661
+ /**
662
+ * Retrieves usage statistics and analytics for a customer.
663
+ *
664
+ * This method fetches detailed usage information for a customer's features,
665
+ * including current balances, usage history, and analytics data. Useful
666
+ * for displaying usage dashboards or generating reports.
667
+ *
668
+ * @param params - Usage parameters including customer ID and optional filters
669
+ * @returns Promise resolving to usage statistics and analytics data
670
+ *
671
+ * @example
672
+ * ```typescript
673
+ * const result = await autumn.usage({
674
+ * customer_id: "user_123",
675
+ * feature_id: "messages"
676
+ * value: 20 // Usage value
677
+ * });
678
+ * ```
679
+ */
531
680
  async usage(params) {
532
681
  return handleUsage({
533
682
  instance: this,
@@ -535,6 +684,25 @@ var Autumn = class {
535
684
  });
536
685
  }
537
686
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
687
+ /**
688
+ * Performs advanced queries on customer data and analytics.
689
+ *
690
+ * This method allows you to run complex queries against customer data,
691
+ * usage patterns, and billing information. Useful for generating reports,
692
+ * analytics, and custom data insights.
693
+ *
694
+ * @param params - Query parameters including customer ID and query specifications
695
+ * @returns Promise resolving to query results with requested data
696
+ *
697
+ * @example
698
+ * ```typescript
699
+ * const result = await autumn.query({
700
+ * customer_id: "user_123",
701
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
702
+ * });
703
+ *
704
+ * ```
705
+ */
538
706
  async query(params) {
539
707
  return handleQuery({
540
708
  instance: this,
@@ -750,6 +918,8 @@ var CheckoutParamsSchema = import_v47.z.object({
750
918
  product_id: import_v47.z.string(),
751
919
  entity_id: import_v47.z.string().optional(),
752
920
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
921
+ force_checkout: import_v47.z.boolean().optional(),
922
+ invoice: import_v47.z.boolean().optional(),
753
923
  success_url: import_v47.z.string().optional(),
754
924
  customer_data: CustomerDataSchema.optional(),
755
925
  entity_data: import_v47.z.any().optional(),
@@ -2,8 +2,8 @@
2
2
 
3
3
  import {
4
4
  usePricingTableBase
5
- } from "../chunk-YHT2JUXO.mjs";
6
- import "../chunk-WYQMHQUE.mjs";
5
+ } from "../chunk-7HRCOEUW.mjs";
6
+ import "../chunk-5O3IHYFF.mjs";
7
7
  export {
8
8
  usePricingTableBase
9
9
  };
@@ -1,13 +1,13 @@
1
- import { P as Product } from '../prodTypes-B8NdKyKo.mjs';
2
- import { A as AutumnClient } from '../ReactAutumnClient-IFdMWiu5.mjs';
1
+ import { P as Product } from '../prodTypes-C8xRoBP7.mjs';
2
+ import { A as AutumnClient } from '../ReactAutumnClient-zBxnpPLM.mjs';
3
3
  import 'zod/v4';
4
4
  import '../client/types/clientEntTypes.mjs';
5
5
  import '../client/types/clientGenTypes.mjs';
6
6
  import '../error-DHbclCVh.mjs';
7
- import '../genTypes-C_ilxndU.mjs';
8
- import '../attachTypes-C5gcbNrS.mjs';
9
- import '../entTypes-C1bM1Zpv.mjs';
10
- import '../cusTypes-CBapqjzm.mjs';
7
+ import '../genTypes-DdYlVEah.mjs';
8
+ import '../attachTypes-Cuxn1ThG.mjs';
9
+ import '../entTypes-D-gn1jj2.mjs';
10
+ import '../cusTypes-B2m4-oz4.mjs';
11
11
 
12
12
  declare const useProductsBase: ({ client }: {
13
13
  client: AutumnClient;
@@ -1,13 +1,13 @@
1
- import { P as Product } from '../prodTypes-B8NdKyKo.js';
2
- import { A as AutumnClient } from '../ReactAutumnClient-CfDtucnL.js';
1
+ import { P as Product } from '../prodTypes-C8xRoBP7.js';
2
+ import { A as AutumnClient } from '../ReactAutumnClient-CIAkiqwV.js';
3
3
  import 'zod/v4';
4
4
  import '../client/types/clientEntTypes.js';
5
5
  import '../client/types/clientGenTypes.js';
6
6
  import '../error-DHbclCVh.js';
7
- import '../genTypes-DjcQWIOM.js';
8
- import '../attachTypes-CLK4jfuj.js';
9
- import '../entTypes-DbIrfEpl.js';
10
- import '../cusTypes-D13MXEN7.js';
7
+ import '../genTypes-aPPwPimh.js';
8
+ import '../attachTypes-BQaZHr5e.js';
9
+ import '../entTypes-WMQRyYAv.js';
10
+ import '../cusTypes-lMnznWYJ.js';
11
11
 
12
12
  declare const useProductsBase: ({ client }: {
13
13
  client: AutumnClient;