autumn-js 0.1.11 → 0.1.13

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 (136) hide show
  1. package/dist/libraries/backend/better-auth.d.mts +4 -0
  2. package/dist/libraries/backend/better-auth.d.ts +4 -0
  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-DSv2hpmP.d.mts} +178 -44
  33. package/dist/libraries/backend/{referralTypes-FlI0fYwz.d.ts → referralTypes-DdKvvqSK.d.ts} +178 -44
  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.js +176 -4
  57. package/dist/libraries/react/AutumnContext.mjs +4 -4
  58. package/dist/libraries/react/BaseAutumnProvider.js +176 -15
  59. package/dist/libraries/react/BaseAutumnProvider.mjs +9 -9
  60. package/dist/libraries/react/ReactAutumnProvider.js +176 -15
  61. package/dist/libraries/react/ReactAutumnProvider.mjs +10 -10
  62. package/dist/libraries/react/{chunk-2ENHPIYQ.mjs → chunk-52HVA7E4.mjs} +3 -3
  63. package/dist/libraries/react/{chunk-WYQMHQUE.mjs → chunk-5O3IHYFF.mjs} +172 -2
  64. package/dist/libraries/react/{chunk-JHFJKAXG.mjs → chunk-5YM6QT7V.mjs} +33 -33
  65. package/dist/libraries/react/{chunk-KP2Q65Y3.mjs → chunk-643J45JV.mjs} +2 -2
  66. package/dist/libraries/react/{chunk-YHT2JUXO.mjs → chunk-7HRCOEUW.mjs} +1 -1
  67. package/dist/libraries/react/{chunk-OMJJLT2Q.mjs → chunk-7JU3XHKL.mjs} +1 -1
  68. package/dist/libraries/react/{chunk-XK3AXQED.mjs → chunk-BT5OY2CA.mjs} +3 -13
  69. package/dist/libraries/react/{chunk-KMYL54B4.mjs → chunk-DKOF357C.mjs} +1 -1
  70. package/dist/libraries/react/{chunk-4NZ7ML7V.mjs → chunk-M3SON3SH.mjs} +2 -2
  71. package/dist/libraries/react/{chunk-67RWFVWN.mjs → chunk-OSYZMMQC.mjs} +2 -2
  72. package/dist/libraries/react/{chunk-6D6TYTTO.mjs → chunk-P6CAHZVT.mjs} +1 -2
  73. package/dist/libraries/react/{chunk-VZY225C6.mjs → chunk-RP56DI4O.mjs} +2 -2
  74. package/dist/libraries/react/{chunk-FDNQ6GRK.mjs → chunk-SWVRRNIW.mjs} +1 -1
  75. package/dist/libraries/react/{chunk-U3OQJXCW.mjs → chunk-TOAZUTY6.mjs} +8 -6
  76. package/dist/libraries/react/{chunk-3MF54MDU.mjs → chunk-WBBWID5F.mjs} +1 -1
  77. package/dist/libraries/react/{chunk-TTLL63A4.mjs → chunk-Z7REFVM4.mjs} +3 -3
  78. package/dist/libraries/react/client/ReactAutumnClient.js +176 -4
  79. package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -3
  80. package/dist/libraries/react/client/types/clientGenTypes.js +172 -2
  81. package/dist/libraries/react/client/types/clientGenTypes.mjs +1 -1
  82. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.css +3 -0
  83. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +181 -20
  84. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +26 -26
  85. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.css +3 -0
  86. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.js +176 -4
  87. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +26 -26
  88. package/dist/libraries/react/components/pricing-table/pricing-table-synced.css +3 -0
  89. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +181 -20
  90. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +26 -26
  91. package/dist/libraries/react/components/ui/button.d.mts +2 -2
  92. package/dist/libraries/react/components/ui/button.d.ts +2 -2
  93. package/dist/libraries/react/components/ui/dialog.mjs +2 -2
  94. package/dist/libraries/react/components/ui/popover.mjs +2 -2
  95. package/dist/libraries/react/hooks/helpers/handleCheck.js +172 -2
  96. package/dist/libraries/react/hooks/helpers/handleCheck.mjs +2 -2
  97. package/dist/libraries/react/hooks/helpers/useAutumnBase.js +172 -3
  98. package/dist/libraries/react/hooks/helpers/useAutumnBase.mjs +3 -3
  99. package/dist/libraries/react/hooks/useAnalytics.js +176 -4
  100. package/dist/libraries/react/hooks/useAnalytics.mjs +5 -5
  101. package/dist/libraries/react/hooks/useCustomer.d.mts +60 -2
  102. package/dist/libraries/react/hooks/useCustomer.d.ts +60 -2
  103. package/dist/libraries/react/hooks/useCustomer.js +176 -15
  104. package/dist/libraries/react/hooks/useCustomer.mjs +9 -9
  105. package/dist/libraries/react/hooks/useCustomerBase.d.mts +44 -3
  106. package/dist/libraries/react/hooks/useCustomerBase.d.ts +44 -3
  107. package/dist/libraries/react/hooks/useCustomerBase.js +176 -15
  108. package/dist/libraries/react/hooks/useCustomerBase.mjs +8 -8
  109. package/dist/libraries/react/hooks/useEntity.js +176 -5
  110. package/dist/libraries/react/hooks/useEntity.mjs +9 -9
  111. package/dist/libraries/react/hooks/useEntityBase.js +176 -5
  112. package/dist/libraries/react/hooks/useEntityBase.mjs +8 -8
  113. package/dist/libraries/react/hooks/usePaywall.js +176 -4
  114. package/dist/libraries/react/hooks/usePaywall.mjs +5 -5
  115. package/dist/libraries/react/hooks/usePricingTable.js +176 -4
  116. package/dist/libraries/react/hooks/usePricingTable.mjs +6 -6
  117. package/dist/libraries/react/hooks/usePricingTableBase.js +172 -2
  118. package/dist/libraries/react/hooks/usePricingTableBase.mjs +2 -2
  119. package/dist/libraries/react/index.d.mts +104 -7
  120. package/dist/libraries/react/index.d.ts +104 -7
  121. package/dist/libraries/react/index.js +182 -21
  122. package/dist/libraries/react/index.mjs +182 -21
  123. package/dist/next/client/hooks/useCustomer.d.mts +44 -7
  124. package/dist/next/client/hooks/useCustomer.d.ts +44 -7
  125. package/dist/next/server/cusActions.d.mts +178 -44
  126. package/dist/next/server/cusActions.d.ts +178 -44
  127. package/dist/sdk/index.d.mts +178 -44
  128. package/dist/sdk/index.d.ts +178 -44
  129. package/dist/sdk/index.js +171 -1
  130. package/dist/sdk/index.mjs +171 -1
  131. package/dist/styles/global.css +3 -0
  132. package/dist/utils/encryptUtils.js +172 -2
  133. package/dist/utils/encryptUtils.mjs +172 -2
  134. package/package.json +1 -1
  135. package/dist/libraries/react/{chunk-7JNU5ABT.mjs → chunk-FJWZPMWU.mjs} +3 -3
  136. package/dist/libraries/react/{chunk-LCWL3TIT.mjs → chunk-OTZ65PCT.mjs} +3 -3
@@ -477,22 +477,92 @@ var Autumn = class {
477
477
  entities = entityMethods(this);
478
478
  referrals = referralMethods(this);
479
479
  features = featureMethods(this);
480
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
480
+ /**
481
+ * Initiates a checkout flow for a product purchase.
482
+ *
483
+ * The checkout function handles the purchase process for products with pricing.
484
+ * It determines whether to show a dialog for user input or redirect directly
485
+ * to Stripe based on the customer's state and product requirements.
486
+ *
487
+ * @param params - Checkout parameters including product ID, customer data, and options
488
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
489
+ *
490
+ * @example
491
+ * ```typescript
492
+ * const result = await autumn.checkout({
493
+ * customer_id: "user_123",
494
+ * product_id: "pro",
495
+ * success_url: "https://myapp.com/success"
496
+ * });
497
+ *
498
+ * if (result.url) {
499
+ * // Redirect to Stripe checkout
500
+ * window.location.href = result.url;
501
+ * }
502
+ * ```
503
+ */
481
504
  async checkout(params) {
482
505
  return handleCheckout({
483
506
  instance: this,
484
507
  params
485
508
  });
486
509
  }
487
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
510
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
488
511
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
512
+ /**
513
+ * Attaches a product to a customer, enabling access and handling billing.
514
+ *
515
+ * The attach function activates a product for a customer and applies all product items.
516
+ * When you attach a product:
517
+ * - The customer gains access to all features in the product
518
+ * - If the product has prices, the customer will be billed accordingly
519
+ * - If there's no existing payment method, a checkout URL will be generated
520
+ *
521
+ * @param params - Attach parameters including customer ID, product ID, and options
522
+ * @returns Promise resolving to attachment result with checkout URL if needed
523
+ *
524
+ * @example
525
+ * ```typescript
526
+ * const result = await autumn.attach({
527
+ * customer_id: "user_123",
528
+ * product_id: "pro",
529
+ * success_url: "https://myapp.com/success"
530
+ * });
531
+ *
532
+ * if (result.checkout_url) {
533
+ * // Payment required - redirect to checkout
534
+ * window.location.href = result.checkout_url;
535
+ * } else {
536
+ * // Product successfully attached
537
+ * console.log("Access granted:", result.message);
538
+ * }
539
+ * ```
540
+ */
489
541
  async attach(params) {
490
542
  return handleAttach({
491
543
  instance: this,
492
544
  params
493
545
  });
494
546
  }
547
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
495
548
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
549
+ /**
550
+ * Sets up a payment method for a customer.
551
+ *
552
+ * This method allows you to set up payment methods for customers without
553
+ * immediately charging them. Useful for collecting payment information
554
+ * before product attachment or for updating existing payment methods.
555
+ *
556
+ * @param params - Setup payment parameters including customer information
557
+ * @returns Promise resolving to setup payment result
558
+ *
559
+ * @example
560
+ * ```typescript
561
+ * const result = await autumn.setupPayment({
562
+ * customer_id: "user_123"
563
+ * });
564
+ * ```
565
+ */
496
566
  async setupPayment(params) {
497
567
  return handleSetupPayment({
498
568
  instance: this,
@@ -500,6 +570,24 @@ var Autumn = class {
500
570
  });
501
571
  }
502
572
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
573
+ /**
574
+ * Cancels a customer's subscription or product attachment.
575
+ *
576
+ * This method allows you to cancel a customer's subscription to a specific product.
577
+ * You can choose to cancel immediately or at the end of the billing cycle.
578
+ *
579
+ * @param params - Cancel parameters including customer ID and product ID
580
+ * @returns Promise resolving to cancellation result
581
+ *
582
+ * @example
583
+ * ```typescript
584
+ * const result = await autumn.cancel({
585
+ * customer_id: "user_123",
586
+ * product_id: "pro",
587
+ * cancel_immediately: false // Cancel at end of billing cycle
588
+ * });
589
+ * ```
590
+ */
503
591
  async cancel(params) {
504
592
  return handleCancel({
505
593
  instance: this,
@@ -507,6 +595,29 @@ var Autumn = class {
507
595
  });
508
596
  }
509
597
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
598
+ /**
599
+ * Checks if a customer has access to a specific feature.
600
+ *
601
+ * This method verifies whether a customer has permission to use a feature
602
+ * and checks their remaining balance/usage limits. It can be used to gate
603
+ * features and determine when to show upgrade prompts.
604
+ *
605
+ * @param params - Check parameters including customer ID and feature ID
606
+ * @returns Promise resolving to access check result with allowed status and balance info
607
+ *
608
+ * @example
609
+ * ```typescript
610
+ * const result = await autumn.check({
611
+ * customer_id: "user_123",
612
+ * feature_id: "messages",
613
+ * required_balance: 1
614
+ * });
615
+ *
616
+ * if (!result.allowed) {
617
+ * console.log("Feature access denied - upgrade required");
618
+ * }
619
+ * ```
620
+ */
510
621
  async check(params) {
511
622
  return handleCheck({
512
623
  instance: this,
@@ -514,12 +625,50 @@ var Autumn = class {
514
625
  });
515
626
  }
516
627
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
628
+ /**
629
+ * Tracks usage events for features or analytics.
630
+ *
631
+ * This method records usage events for metered features, updating the customer's
632
+ * balance and usage statistics. It's typically used server-side to ensure
633
+ * accurate tracking that cannot be manipulated by users.
634
+ *
635
+ * @param params - Track parameters including customer ID, feature ID, and usage value
636
+ * @returns Promise resolving to tracking result
637
+ *
638
+ * @example
639
+ * ```typescript
640
+ * const result = await autumn.track({
641
+ * customer_id: "user_123",
642
+ * feature_id: "messages",
643
+ * value: 1 // Track 1 message sent
644
+ * });
645
+ * ```
646
+ */
517
647
  async track(params) {
518
648
  return handleTrack({
519
649
  instance: this,
520
650
  params
521
651
  });
522
652
  }
653
+ /**
654
+ * Retrieves usage statistics and analytics for a customer.
655
+ *
656
+ * This method fetches detailed usage information for a customer's features,
657
+ * including current balances, usage history, and analytics data. Useful
658
+ * for displaying usage dashboards or generating reports.
659
+ *
660
+ * @param params - Usage parameters including customer ID and optional filters
661
+ * @returns Promise resolving to usage statistics and analytics data
662
+ *
663
+ * @example
664
+ * ```typescript
665
+ * const result = await autumn.usage({
666
+ * customer_id: "user_123",
667
+ * feature_id: "messages"
668
+ * value: 20 // Usage value
669
+ * });
670
+ * ```
671
+ */
523
672
  async usage(params) {
524
673
  return handleUsage({
525
674
  instance: this,
@@ -527,6 +676,25 @@ var Autumn = class {
527
676
  });
528
677
  }
529
678
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
679
+ /**
680
+ * Performs advanced queries on customer data and analytics.
681
+ *
682
+ * This method allows you to run complex queries against customer data,
683
+ * usage patterns, and billing information. Useful for generating reports,
684
+ * analytics, and custom data insights.
685
+ *
686
+ * @param params - Query parameters including customer ID and query specifications
687
+ * @returns Promise resolving to query results with requested data
688
+ *
689
+ * @example
690
+ * ```typescript
691
+ * const result = await autumn.query({
692
+ * customer_id: "user_123",
693
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
694
+ * });
695
+ *
696
+ * ```
697
+ */
530
698
  async query(params) {
531
699
  return handleQuery({
532
700
  instance: this,
@@ -742,6 +910,8 @@ var CheckoutParamsSchema = import_v47.z.object({
742
910
  product_id: import_v47.z.string(),
743
911
  entity_id: import_v47.z.string().optional(),
744
912
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
913
+ force_checkout: import_v47.z.boolean().optional(),
914
+ invoice: import_v47.z.boolean().optional(),
745
915
  success_url: import_v47.z.string().optional(),
746
916
  customer_data: CustomerDataSchema.optional(),
747
917
  entity_data: import_v47.z.any().optional(),
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  QueryRangeEnum
5
- } from "../../chunk-WYQMHQUE.mjs";
5
+ } from "../../chunk-5O3IHYFF.mjs";
6
6
 
7
7
  // src/libraries/react/client/types/clientGenTypes.ts
8
8
  import { z } from "zod/v4";
@@ -837,6 +837,9 @@ body {
837
837
  .au-text-center {
838
838
  text-align: center;
839
839
  }
840
+ .au-text-end {
841
+ text-align: end;
842
+ }
840
843
  .au-text-2xl {
841
844
  font-size: 1.5rem;
842
845
  line-height: 2rem;
@@ -6088,22 +6088,92 @@ var Autumn = class {
6088
6088
  entities = entityMethods(this);
6089
6089
  referrals = referralMethods(this);
6090
6090
  features = featureMethods(this);
6091
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
6091
+ /**
6092
+ * Initiates a checkout flow for a product purchase.
6093
+ *
6094
+ * The checkout function handles the purchase process for products with pricing.
6095
+ * It determines whether to show a dialog for user input or redirect directly
6096
+ * to Stripe based on the customer's state and product requirements.
6097
+ *
6098
+ * @param params - Checkout parameters including product ID, customer data, and options
6099
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
6100
+ *
6101
+ * @example
6102
+ * ```typescript
6103
+ * const result = await autumn.checkout({
6104
+ * customer_id: "user_123",
6105
+ * product_id: "pro",
6106
+ * success_url: "https://myapp.com/success"
6107
+ * });
6108
+ *
6109
+ * if (result.url) {
6110
+ * // Redirect to Stripe checkout
6111
+ * window.location.href = result.url;
6112
+ * }
6113
+ * ```
6114
+ */
6092
6115
  async checkout(params) {
6093
6116
  return handleCheckout({
6094
6117
  instance: this,
6095
6118
  params
6096
6119
  });
6097
6120
  }
6098
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
6121
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
6099
6122
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
6123
+ /**
6124
+ * Attaches a product to a customer, enabling access and handling billing.
6125
+ *
6126
+ * The attach function activates a product for a customer and applies all product items.
6127
+ * When you attach a product:
6128
+ * - The customer gains access to all features in the product
6129
+ * - If the product has prices, the customer will be billed accordingly
6130
+ * - If there's no existing payment method, a checkout URL will be generated
6131
+ *
6132
+ * @param params - Attach parameters including customer ID, product ID, and options
6133
+ * @returns Promise resolving to attachment result with checkout URL if needed
6134
+ *
6135
+ * @example
6136
+ * ```typescript
6137
+ * const result = await autumn.attach({
6138
+ * customer_id: "user_123",
6139
+ * product_id: "pro",
6140
+ * success_url: "https://myapp.com/success"
6141
+ * });
6142
+ *
6143
+ * if (result.checkout_url) {
6144
+ * // Payment required - redirect to checkout
6145
+ * window.location.href = result.checkout_url;
6146
+ * } else {
6147
+ * // Product successfully attached
6148
+ * console.log("Access granted:", result.message);
6149
+ * }
6150
+ * ```
6151
+ */
6100
6152
  async attach(params) {
6101
6153
  return handleAttach({
6102
6154
  instance: this,
6103
6155
  params
6104
6156
  });
6105
6157
  }
6158
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
6106
6159
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
6160
+ /**
6161
+ * Sets up a payment method for a customer.
6162
+ *
6163
+ * This method allows you to set up payment methods for customers without
6164
+ * immediately charging them. Useful for collecting payment information
6165
+ * before product attachment or for updating existing payment methods.
6166
+ *
6167
+ * @param params - Setup payment parameters including customer information
6168
+ * @returns Promise resolving to setup payment result
6169
+ *
6170
+ * @example
6171
+ * ```typescript
6172
+ * const result = await autumn.setupPayment({
6173
+ * customer_id: "user_123"
6174
+ * });
6175
+ * ```
6176
+ */
6107
6177
  async setupPayment(params) {
6108
6178
  return handleSetupPayment({
6109
6179
  instance: this,
@@ -6111,6 +6181,24 @@ var Autumn = class {
6111
6181
  });
6112
6182
  }
6113
6183
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
6184
+ /**
6185
+ * Cancels a customer's subscription or product attachment.
6186
+ *
6187
+ * This method allows you to cancel a customer's subscription to a specific product.
6188
+ * You can choose to cancel immediately or at the end of the billing cycle.
6189
+ *
6190
+ * @param params - Cancel parameters including customer ID and product ID
6191
+ * @returns Promise resolving to cancellation result
6192
+ *
6193
+ * @example
6194
+ * ```typescript
6195
+ * const result = await autumn.cancel({
6196
+ * customer_id: "user_123",
6197
+ * product_id: "pro",
6198
+ * cancel_immediately: false // Cancel at end of billing cycle
6199
+ * });
6200
+ * ```
6201
+ */
6114
6202
  async cancel(params) {
6115
6203
  return handleCancel({
6116
6204
  instance: this,
@@ -6118,6 +6206,29 @@ var Autumn = class {
6118
6206
  });
6119
6207
  }
6120
6208
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
6209
+ /**
6210
+ * Checks if a customer has access to a specific feature.
6211
+ *
6212
+ * This method verifies whether a customer has permission to use a feature
6213
+ * and checks their remaining balance/usage limits. It can be used to gate
6214
+ * features and determine when to show upgrade prompts.
6215
+ *
6216
+ * @param params - Check parameters including customer ID and feature ID
6217
+ * @returns Promise resolving to access check result with allowed status and balance info
6218
+ *
6219
+ * @example
6220
+ * ```typescript
6221
+ * const result = await autumn.check({
6222
+ * customer_id: "user_123",
6223
+ * feature_id: "messages",
6224
+ * required_balance: 1
6225
+ * });
6226
+ *
6227
+ * if (!result.allowed) {
6228
+ * console.log("Feature access denied - upgrade required");
6229
+ * }
6230
+ * ```
6231
+ */
6121
6232
  async check(params) {
6122
6233
  return handleCheck({
6123
6234
  instance: this,
@@ -6125,12 +6236,50 @@ var Autumn = class {
6125
6236
  });
6126
6237
  }
6127
6238
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
6239
+ /**
6240
+ * Tracks usage events for features or analytics.
6241
+ *
6242
+ * This method records usage events for metered features, updating the customer's
6243
+ * balance and usage statistics. It's typically used server-side to ensure
6244
+ * accurate tracking that cannot be manipulated by users.
6245
+ *
6246
+ * @param params - Track parameters including customer ID, feature ID, and usage value
6247
+ * @returns Promise resolving to tracking result
6248
+ *
6249
+ * @example
6250
+ * ```typescript
6251
+ * const result = await autumn.track({
6252
+ * customer_id: "user_123",
6253
+ * feature_id: "messages",
6254
+ * value: 1 // Track 1 message sent
6255
+ * });
6256
+ * ```
6257
+ */
6128
6258
  async track(params) {
6129
6259
  return handleTrack({
6130
6260
  instance: this,
6131
6261
  params
6132
6262
  });
6133
6263
  }
6264
+ /**
6265
+ * Retrieves usage statistics and analytics for a customer.
6266
+ *
6267
+ * This method fetches detailed usage information for a customer's features,
6268
+ * including current balances, usage history, and analytics data. Useful
6269
+ * for displaying usage dashboards or generating reports.
6270
+ *
6271
+ * @param params - Usage parameters including customer ID and optional filters
6272
+ * @returns Promise resolving to usage statistics and analytics data
6273
+ *
6274
+ * @example
6275
+ * ```typescript
6276
+ * const result = await autumn.usage({
6277
+ * customer_id: "user_123",
6278
+ * feature_id: "messages"
6279
+ * value: 20 // Usage value
6280
+ * });
6281
+ * ```
6282
+ */
6134
6283
  async usage(params) {
6135
6284
  return handleUsage({
6136
6285
  instance: this,
@@ -6138,6 +6287,25 @@ var Autumn = class {
6138
6287
  });
6139
6288
  }
6140
6289
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
6290
+ /**
6291
+ * Performs advanced queries on customer data and analytics.
6292
+ *
6293
+ * This method allows you to run complex queries against customer data,
6294
+ * usage patterns, and billing information. Useful for generating reports,
6295
+ * analytics, and custom data insights.
6296
+ *
6297
+ * @param params - Query parameters including customer ID and query specifications
6298
+ * @returns Promise resolving to query results with requested data
6299
+ *
6300
+ * @example
6301
+ * ```typescript
6302
+ * const result = await autumn.query({
6303
+ * customer_id: "user_123",
6304
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
6305
+ * });
6306
+ *
6307
+ * ```
6308
+ */
6141
6309
  async query(params) {
6142
6310
  return handleQuery({
6143
6311
  instance: this,
@@ -6353,6 +6521,8 @@ var CheckoutParamsSchema = import_v47.z.object({
6353
6521
  product_id: import_v47.z.string(),
6354
6522
  entity_id: import_v47.z.string().optional(),
6355
6523
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
6524
+ force_checkout: import_v47.z.boolean().optional(),
6525
+ invoice: import_v47.z.boolean().optional(),
6356
6526
  success_url: import_v47.z.string().optional(),
6357
6527
  customer_data: CustomerDataSchema.optional(),
6358
6528
  entity_data: import_v47.z.any().optional(),
@@ -6534,7 +6704,8 @@ var AutumnClient = class {
6534
6704
  await fetch(testEndpoint, {
6535
6705
  method: "POST",
6536
6706
  credentials: "include",
6537
- headers: { "Content-Type": "application/json" }
6707
+ headers: { "Content-Type": "application/json" },
6708
+ body: JSON.stringify({})
6538
6709
  });
6539
6710
  return { valid: true, includeCredentials: true };
6540
6711
  } catch (error) {
@@ -6542,7 +6713,8 @@ var AutumnClient = class {
6542
6713
  await fetch(testEndpoint, {
6543
6714
  method: "POST",
6544
6715
  credentials: "omit",
6545
- headers: { "Content-Type": "application/json" }
6716
+ headers: { "Content-Type": "application/json" },
6717
+ body: JSON.stringify({})
6546
6718
  });
6547
6719
  return { valid: true, includeCredentials: false };
6548
6720
  } catch (error2) {
@@ -7052,7 +7224,6 @@ var useAutumnBase = ({
7052
7224
  };
7053
7225
  return {
7054
7226
  attach,
7055
- // check,
7056
7227
  track,
7057
7228
  cancel,
7058
7229
  openBillingPortal,
@@ -7272,16 +7443,6 @@ var useCustomerBase = ({
7272
7443
  context
7273
7444
  });
7274
7445
  return res;
7275
- },
7276
- /** @deprecated Use check() instead */
7277
- allowed: (params2) => {
7278
- const result = handleCheck2({
7279
- customer,
7280
- params: params2,
7281
- isEntity: false,
7282
- context
7283
- });
7284
- return result.data.allowed;
7285
7446
  }
7286
7447
  };
7287
7448
  };
@@ -10377,15 +10538,15 @@ var PrepaidItem = ({
10377
10538
  }
10378
10539
  };
10379
10540
  const disableSelection = scenario === "renew";
10380
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "au-flex au-justify-between", children: [
10381
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "au-flex au-gap-2", children: [
10541
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "au-flex au-justify-between au-gap-2", children: [
10542
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "au-flex au-gap-2 au-items-start", children: [
10382
10543
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "au-text-muted-foreground", children: item.feature?.name }),
10383
10544
  /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Popover2, { open, onOpenChange: setOpen, children: [
10384
10545
  /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
10385
10546
  PopoverTrigger2,
10386
10547
  {
10387
10548
  className: cn(
10388
- "au-text-muted-foreground au-text-xs au-px-1 au-py-0.5 au-rounded-md au-flex au-items-center au-gap-1 au-bg-accent/80",
10549
+ "au-text-muted-foreground au-text-xs au-px-1 au-py-0.5 au-rounded-md au-flex au-items-center au-gap-1 au-bg-accent/80 au-shrink-0",
10389
10550
  disableSelection !== true && "hover:au-bg-accent hover:au-text-foreground"
10390
10551
  ),
10391
10552
  disabled: disableSelection,
@@ -10429,7 +10590,7 @@ var PrepaidItem = ({
10429
10590
  Button,
10430
10591
  {
10431
10592
  onClick: handleSave,
10432
- className: "au-w-14 !au-h-7 au-text-sm au-items-center au-bg-white au-text-foreground au-shadow-sm au-border au-border-zinc-200 hover:au-bg-zinc-100",
10593
+ className: "au-w-14 !au-h-7",
10433
10594
  disabled: loading,
10434
10595
  children: loading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LoaderCircle, { className: "au-text-muted-foreground au-animate-spin !au-w-4 !au-h-4" }) : "Save"
10435
10596
  }
@@ -10440,7 +10601,7 @@ var PrepaidItem = ({
10440
10601
  )
10441
10602
  ] })
10442
10603
  ] }),
10443
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { children: [
10604
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { className: "au-text-end", children: [
10444
10605
  item.display?.primary_text,
10445
10606
  " ",
10446
10607
  item.display?.secondary_text
@@ -5,44 +5,44 @@ import {
5
5
  CheckoutDialog,
6
6
  PriceItem,
7
7
  PricingDialogButton
8
- } from "../../chunk-JHFJKAXG.mjs";
8
+ } from "../../chunk-5YM6QT7V.mjs";
9
9
  import "../../chunk-URQMBRFZ.mjs";
10
+ import "../../chunk-BLM4DAAR.mjs";
11
+ import "../../chunk-I5ZGIAIX.mjs";
12
+ import "../../chunk-GUM4HIGI.mjs";
13
+ import "../../chunk-OTZ65PCT.mjs";
14
+ import "../../chunk-YWQTQ72B.mjs";
15
+ import "../../chunk-KUS3X33V.mjs";
16
+ import "../../chunk-WVKYZYFT.mjs";
10
17
  import "../../chunk-JGDTNJTR.mjs";
11
18
  import "../../chunk-EV5RNY5U.mjs";
12
- import "../../chunk-7JNU5ABT.mjs";
13
- import "../../chunk-QJPZFEVW.mjs";
14
- import "../../chunk-GUM4HIGI.mjs";
15
- import "../../chunk-LCWL3TIT.mjs";
19
+ import "../../chunk-FJWZPMWU.mjs";
16
20
  import "../../chunk-FEISQQNM.mjs";
21
+ import "../../chunk-QJPZFEVW.mjs";
17
22
  import "../../chunk-I2A7PK2L.mjs";
18
- import "../../chunk-YWQTQ72B.mjs";
19
- import "../../chunk-KUS3X33V.mjs";
20
23
  import "../../chunk-7TYAAD2T.mjs";
21
24
  import "../../chunk-RPEGNKJH.mjs";
22
- import "../../chunk-BLM4DAAR.mjs";
23
- import "../../chunk-I5ZGIAIX.mjs";
24
- import "../../chunk-VZY225C6.mjs";
25
- import "../../chunk-4NZ7ML7V.mjs";
26
- import "../../chunk-KP2Q65Y3.mjs";
27
- import "../../chunk-2ENHPIYQ.mjs";
28
- import "../../chunk-3MF54MDU.mjs";
29
- import "../../chunk-67RWFVWN.mjs";
25
+ import "../../chunk-OSYZMMQC.mjs";
30
26
  import "../../chunk-4J6OC4ZQ.mjs";
31
- import "../../chunk-WVKYZYFT.mjs";
32
- import "../../chunk-TTLL63A4.mjs";
33
- import "../../chunk-OMJJLT2Q.mjs";
27
+ import "../../chunk-RP56DI4O.mjs";
28
+ import "../../chunk-M3SON3SH.mjs";
29
+ import "../../chunk-643J45JV.mjs";
30
+ import "../../chunk-52HVA7E4.mjs";
31
+ import "../../chunk-WBBWID5F.mjs";
32
+ import "../../chunk-Z7REFVM4.mjs";
33
+ import "../../chunk-7JU3XHKL.mjs";
34
34
  import "../../chunk-RFSQBGLO.mjs";
35
- import "../../chunk-XK3AXQED.mjs";
36
- import "../../chunk-KMYL54B4.mjs";
37
- import "../../chunk-6D6TYTTO.mjs";
38
- import "../../chunk-YHT2JUXO.mjs";
39
- import "../../chunk-FDNQ6GRK.mjs";
40
- import "../../chunk-U3OQJXCW.mjs";
41
- import "../../chunk-WYQMHQUE.mjs";
35
+ import "../../chunk-BT5OY2CA.mjs";
36
+ import "../../chunk-DKOF357C.mjs";
37
+ import "../../chunk-P6CAHZVT.mjs";
38
+ import "../../chunk-7HRCOEUW.mjs";
39
+ import "../../chunk-SWVRRNIW.mjs";
40
+ import "../../chunk-TOAZUTY6.mjs";
41
+ import "../../chunk-5O3IHYFF.mjs";
42
+ import "../../chunk-JVCOY7ZL.mjs";
42
43
  import "../../chunk-CIBQ4BJU.mjs";
43
44
  import "../../chunk-V575SGOW.mjs";
44
45
  import "../../chunk-ZV4RPZTM.mjs";
45
- import "../../chunk-JVCOY7ZL.mjs";
46
46
  import "../../chunk-VTGR7VVK.mjs";
47
47
  import "../../chunk-WFFVOEUG.mjs";
48
48
  import "../../chunk-ZF2HUCN6.mjs";
@@ -837,6 +837,9 @@ body {
837
837
  .au-text-center {
838
838
  text-align: center;
839
839
  }
840
+ .au-text-end {
841
+ text-align: end;
842
+ }
840
843
  .au-text-2xl {
841
844
  font-size: 1.5rem;
842
845
  line-height: 2rem;