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
@@ -473,22 +473,92 @@ var Autumn = class {
473
473
  entities = entityMethods(this);
474
474
  referrals = referralMethods(this);
475
475
  features = featureMethods(this);
476
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
476
+ /**
477
+ * Initiates a checkout flow for a product purchase.
478
+ *
479
+ * The checkout function handles the purchase process for products with pricing.
480
+ * It determines whether to show a dialog for user input or redirect directly
481
+ * to Stripe based on the customer's state and product requirements.
482
+ *
483
+ * @param params - Checkout parameters including product ID, customer data, and options
484
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * const result = await autumn.checkout({
489
+ * customer_id: "user_123",
490
+ * product_id: "pro",
491
+ * success_url: "https://myapp.com/success"
492
+ * });
493
+ *
494
+ * if (result.url) {
495
+ * // Redirect to Stripe checkout
496
+ * window.location.href = result.url;
497
+ * }
498
+ * ```
499
+ */
477
500
  async checkout(params) {
478
501
  return handleCheckout({
479
502
  instance: this,
480
503
  params
481
504
  });
482
505
  }
483
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
506
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
484
507
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
508
+ /**
509
+ * Attaches a product to a customer, enabling access and handling billing.
510
+ *
511
+ * The attach function activates a product for a customer and applies all product items.
512
+ * When you attach a product:
513
+ * - The customer gains access to all features in the product
514
+ * - If the product has prices, the customer will be billed accordingly
515
+ * - If there's no existing payment method, a checkout URL will be generated
516
+ *
517
+ * @param params - Attach parameters including customer ID, product ID, and options
518
+ * @returns Promise resolving to attachment result with checkout URL if needed
519
+ *
520
+ * @example
521
+ * ```typescript
522
+ * const result = await autumn.attach({
523
+ * customer_id: "user_123",
524
+ * product_id: "pro",
525
+ * success_url: "https://myapp.com/success"
526
+ * });
527
+ *
528
+ * if (result.checkout_url) {
529
+ * // Payment required - redirect to checkout
530
+ * window.location.href = result.checkout_url;
531
+ * } else {
532
+ * // Product successfully attached
533
+ * console.log("Access granted:", result.message);
534
+ * }
535
+ * ```
536
+ */
485
537
  async attach(params) {
486
538
  return handleAttach({
487
539
  instance: this,
488
540
  params
489
541
  });
490
542
  }
543
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
491
544
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
545
+ /**
546
+ * Sets up a payment method for a customer.
547
+ *
548
+ * This method allows you to set up payment methods for customers without
549
+ * immediately charging them. Useful for collecting payment information
550
+ * before product attachment or for updating existing payment methods.
551
+ *
552
+ * @param params - Setup payment parameters including customer information
553
+ * @returns Promise resolving to setup payment result
554
+ *
555
+ * @example
556
+ * ```typescript
557
+ * const result = await autumn.setupPayment({
558
+ * customer_id: "user_123"
559
+ * });
560
+ * ```
561
+ */
492
562
  async setupPayment(params) {
493
563
  return handleSetupPayment({
494
564
  instance: this,
@@ -496,6 +566,24 @@ var Autumn = class {
496
566
  });
497
567
  }
498
568
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
569
+ /**
570
+ * Cancels a customer's subscription or product attachment.
571
+ *
572
+ * This method allows you to cancel a customer's subscription to a specific product.
573
+ * You can choose to cancel immediately or at the end of the billing cycle.
574
+ *
575
+ * @param params - Cancel parameters including customer ID and product ID
576
+ * @returns Promise resolving to cancellation result
577
+ *
578
+ * @example
579
+ * ```typescript
580
+ * const result = await autumn.cancel({
581
+ * customer_id: "user_123",
582
+ * product_id: "pro",
583
+ * cancel_immediately: false // Cancel at end of billing cycle
584
+ * });
585
+ * ```
586
+ */
499
587
  async cancel(params) {
500
588
  return handleCancel({
501
589
  instance: this,
@@ -503,6 +591,29 @@ var Autumn = class {
503
591
  });
504
592
  }
505
593
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
594
+ /**
595
+ * Checks if a customer has access to a specific feature.
596
+ *
597
+ * This method verifies whether a customer has permission to use a feature
598
+ * and checks their remaining balance/usage limits. It can be used to gate
599
+ * features and determine when to show upgrade prompts.
600
+ *
601
+ * @param params - Check parameters including customer ID and feature ID
602
+ * @returns Promise resolving to access check result with allowed status and balance info
603
+ *
604
+ * @example
605
+ * ```typescript
606
+ * const result = await autumn.check({
607
+ * customer_id: "user_123",
608
+ * feature_id: "messages",
609
+ * required_balance: 1
610
+ * });
611
+ *
612
+ * if (!result.allowed) {
613
+ * console.log("Feature access denied - upgrade required");
614
+ * }
615
+ * ```
616
+ */
506
617
  async check(params) {
507
618
  return handleCheck({
508
619
  instance: this,
@@ -510,12 +621,50 @@ var Autumn = class {
510
621
  });
511
622
  }
512
623
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
624
+ /**
625
+ * Tracks usage events for features or analytics.
626
+ *
627
+ * This method records usage events for metered features, updating the customer's
628
+ * balance and usage statistics. It's typically used server-side to ensure
629
+ * accurate tracking that cannot be manipulated by users.
630
+ *
631
+ * @param params - Track parameters including customer ID, feature ID, and usage value
632
+ * @returns Promise resolving to tracking result
633
+ *
634
+ * @example
635
+ * ```typescript
636
+ * const result = await autumn.track({
637
+ * customer_id: "user_123",
638
+ * feature_id: "messages",
639
+ * value: 1 // Track 1 message sent
640
+ * });
641
+ * ```
642
+ */
513
643
  async track(params) {
514
644
  return handleTrack({
515
645
  instance: this,
516
646
  params
517
647
  });
518
648
  }
649
+ /**
650
+ * Retrieves usage statistics and analytics for a customer.
651
+ *
652
+ * This method fetches detailed usage information for a customer's features,
653
+ * including current balances, usage history, and analytics data. Useful
654
+ * for displaying usage dashboards or generating reports.
655
+ *
656
+ * @param params - Usage parameters including customer ID and optional filters
657
+ * @returns Promise resolving to usage statistics and analytics data
658
+ *
659
+ * @example
660
+ * ```typescript
661
+ * const result = await autumn.usage({
662
+ * customer_id: "user_123",
663
+ * feature_id: "messages"
664
+ * value: 20 // Usage value
665
+ * });
666
+ * ```
667
+ */
519
668
  async usage(params) {
520
669
  return handleUsage({
521
670
  instance: this,
@@ -523,6 +672,25 @@ var Autumn = class {
523
672
  });
524
673
  }
525
674
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
675
+ /**
676
+ * Performs advanced queries on customer data and analytics.
677
+ *
678
+ * This method allows you to run complex queries against customer data,
679
+ * usage patterns, and billing information. Useful for generating reports,
680
+ * analytics, and custom data insights.
681
+ *
682
+ * @param params - Query parameters including customer ID and query specifications
683
+ * @returns Promise resolving to query results with requested data
684
+ *
685
+ * @example
686
+ * ```typescript
687
+ * const result = await autumn.query({
688
+ * customer_id: "user_123",
689
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
690
+ * });
691
+ *
692
+ * ```
693
+ */
526
694
  async query(params) {
527
695
  return handleQuery({
528
696
  instance: this,
@@ -738,6 +906,8 @@ var CheckoutParamsSchema = import_v47.z.object({
738
906
  product_id: import_v47.z.string(),
739
907
  entity_id: import_v47.z.string().optional(),
740
908
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
909
+ force_checkout: import_v47.z.boolean().optional(),
910
+ invoice: import_v47.z.boolean().optional(),
741
911
  success_url: import_v47.z.string().optional(),
742
912
  customer_data: CustomerDataSchema.optional(),
743
913
  entity_data: import_v47.z.any().optional(),
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  toBackendError,
3
3
  toBackendRes
4
- } from "../chunk-NAP2URIW.mjs";
4
+ } from "../chunk-Q7SD535L.mjs";
5
5
  import "../chunk-2TEL6LR5.mjs";
6
6
  import "../chunk-KSG3E4Q2.mjs";
7
7
  export {
@@ -1,4 +1,4 @@
1
- import { A as Autumn, C as CustomerData } from '../referralTypes-C1eZ8cjO.mjs';
1
+ import { A as Autumn, C as CustomerData } from '../referralTypes-DSv2hpmP.mjs';
2
2
  import { AuthResult } from './AuthFunction.mjs';
3
3
  import 'zod/v4';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- import { A as Autumn, C as CustomerData } from '../referralTypes-FlI0fYwz.js';
1
+ import { A as Autumn, C as CustomerData } from '../referralTypes-DdKvvqSK.js';
2
2
  import { AuthResult } from './AuthFunction.js';
3
3
  import 'zod/v4';
4
4
  import 'zod';
@@ -472,22 +472,92 @@ var Autumn = class {
472
472
  entities = entityMethods(this);
473
473
  referrals = referralMethods(this);
474
474
  features = featureMethods(this);
475
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
475
+ /**
476
+ * Initiates a checkout flow for a product purchase.
477
+ *
478
+ * The checkout function handles the purchase process for products with pricing.
479
+ * It determines whether to show a dialog for user input or redirect directly
480
+ * to Stripe based on the customer's state and product requirements.
481
+ *
482
+ * @param params - Checkout parameters including product ID, customer data, and options
483
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
484
+ *
485
+ * @example
486
+ * ```typescript
487
+ * const result = await autumn.checkout({
488
+ * customer_id: "user_123",
489
+ * product_id: "pro",
490
+ * success_url: "https://myapp.com/success"
491
+ * });
492
+ *
493
+ * if (result.url) {
494
+ * // Redirect to Stripe checkout
495
+ * window.location.href = result.url;
496
+ * }
497
+ * ```
498
+ */
476
499
  async checkout(params) {
477
500
  return handleCheckout({
478
501
  instance: this,
479
502
  params
480
503
  });
481
504
  }
482
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
505
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
483
506
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
507
+ /**
508
+ * Attaches a product to a customer, enabling access and handling billing.
509
+ *
510
+ * The attach function activates a product for a customer and applies all product items.
511
+ * When you attach a product:
512
+ * - The customer gains access to all features in the product
513
+ * - If the product has prices, the customer will be billed accordingly
514
+ * - If there's no existing payment method, a checkout URL will be generated
515
+ *
516
+ * @param params - Attach parameters including customer ID, product ID, and options
517
+ * @returns Promise resolving to attachment result with checkout URL if needed
518
+ *
519
+ * @example
520
+ * ```typescript
521
+ * const result = await autumn.attach({
522
+ * customer_id: "user_123",
523
+ * product_id: "pro",
524
+ * success_url: "https://myapp.com/success"
525
+ * });
526
+ *
527
+ * if (result.checkout_url) {
528
+ * // Payment required - redirect to checkout
529
+ * window.location.href = result.checkout_url;
530
+ * } else {
531
+ * // Product successfully attached
532
+ * console.log("Access granted:", result.message);
533
+ * }
534
+ * ```
535
+ */
484
536
  async attach(params) {
485
537
  return handleAttach({
486
538
  instance: this,
487
539
  params
488
540
  });
489
541
  }
542
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
490
543
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
544
+ /**
545
+ * Sets up a payment method for a customer.
546
+ *
547
+ * This method allows you to set up payment methods for customers without
548
+ * immediately charging them. Useful for collecting payment information
549
+ * before product attachment or for updating existing payment methods.
550
+ *
551
+ * @param params - Setup payment parameters including customer information
552
+ * @returns Promise resolving to setup payment result
553
+ *
554
+ * @example
555
+ * ```typescript
556
+ * const result = await autumn.setupPayment({
557
+ * customer_id: "user_123"
558
+ * });
559
+ * ```
560
+ */
491
561
  async setupPayment(params) {
492
562
  return handleSetupPayment({
493
563
  instance: this,
@@ -495,6 +565,24 @@ var Autumn = class {
495
565
  });
496
566
  }
497
567
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
568
+ /**
569
+ * Cancels a customer's subscription or product attachment.
570
+ *
571
+ * This method allows you to cancel a customer's subscription to a specific product.
572
+ * You can choose to cancel immediately or at the end of the billing cycle.
573
+ *
574
+ * @param params - Cancel parameters including customer ID and product ID
575
+ * @returns Promise resolving to cancellation result
576
+ *
577
+ * @example
578
+ * ```typescript
579
+ * const result = await autumn.cancel({
580
+ * customer_id: "user_123",
581
+ * product_id: "pro",
582
+ * cancel_immediately: false // Cancel at end of billing cycle
583
+ * });
584
+ * ```
585
+ */
498
586
  async cancel(params) {
499
587
  return handleCancel({
500
588
  instance: this,
@@ -502,6 +590,29 @@ var Autumn = class {
502
590
  });
503
591
  }
504
592
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
593
+ /**
594
+ * Checks if a customer has access to a specific feature.
595
+ *
596
+ * This method verifies whether a customer has permission to use a feature
597
+ * and checks their remaining balance/usage limits. It can be used to gate
598
+ * features and determine when to show upgrade prompts.
599
+ *
600
+ * @param params - Check parameters including customer ID and feature ID
601
+ * @returns Promise resolving to access check result with allowed status and balance info
602
+ *
603
+ * @example
604
+ * ```typescript
605
+ * const result = await autumn.check({
606
+ * customer_id: "user_123",
607
+ * feature_id: "messages",
608
+ * required_balance: 1
609
+ * });
610
+ *
611
+ * if (!result.allowed) {
612
+ * console.log("Feature access denied - upgrade required");
613
+ * }
614
+ * ```
615
+ */
505
616
  async check(params) {
506
617
  return handleCheck({
507
618
  instance: this,
@@ -509,12 +620,50 @@ var Autumn = class {
509
620
  });
510
621
  }
511
622
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
623
+ /**
624
+ * Tracks usage events for features or analytics.
625
+ *
626
+ * This method records usage events for metered features, updating the customer's
627
+ * balance and usage statistics. It's typically used server-side to ensure
628
+ * accurate tracking that cannot be manipulated by users.
629
+ *
630
+ * @param params - Track parameters including customer ID, feature ID, and usage value
631
+ * @returns Promise resolving to tracking result
632
+ *
633
+ * @example
634
+ * ```typescript
635
+ * const result = await autumn.track({
636
+ * customer_id: "user_123",
637
+ * feature_id: "messages",
638
+ * value: 1 // Track 1 message sent
639
+ * });
640
+ * ```
641
+ */
512
642
  async track(params) {
513
643
  return handleTrack({
514
644
  instance: this,
515
645
  params
516
646
  });
517
647
  }
648
+ /**
649
+ * Retrieves usage statistics and analytics for a customer.
650
+ *
651
+ * This method fetches detailed usage information for a customer's features,
652
+ * including current balances, usage history, and analytics data. Useful
653
+ * for displaying usage dashboards or generating reports.
654
+ *
655
+ * @param params - Usage parameters including customer ID and optional filters
656
+ * @returns Promise resolving to usage statistics and analytics data
657
+ *
658
+ * @example
659
+ * ```typescript
660
+ * const result = await autumn.usage({
661
+ * customer_id: "user_123",
662
+ * feature_id: "messages"
663
+ * value: 20 // Usage value
664
+ * });
665
+ * ```
666
+ */
518
667
  async usage(params) {
519
668
  return handleUsage({
520
669
  instance: this,
@@ -522,6 +671,25 @@ var Autumn = class {
522
671
  });
523
672
  }
524
673
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
674
+ /**
675
+ * Performs advanced queries on customer data and analytics.
676
+ *
677
+ * This method allows you to run complex queries against customer data,
678
+ * usage patterns, and billing information. Useful for generating reports,
679
+ * analytics, and custom data insights.
680
+ *
681
+ * @param params - Query parameters including customer ID and query specifications
682
+ * @returns Promise resolving to query results with requested data
683
+ *
684
+ * @example
685
+ * ```typescript
686
+ * const result = await autumn.query({
687
+ * customer_id: "user_123",
688
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
689
+ * });
690
+ *
691
+ * ```
692
+ */
525
693
  async query(params) {
526
694
  return handleQuery({
527
695
  instance: this,
@@ -737,6 +905,8 @@ var CheckoutParamsSchema = import_v47.z.object({
737
905
  product_id: import_v47.z.string(),
738
906
  entity_id: import_v47.z.string().optional(),
739
907
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
908
+ force_checkout: import_v47.z.boolean().optional(),
909
+ invoice: import_v47.z.boolean().optional(),
740
910
  success_url: import_v47.z.string().optional(),
741
911
  customer_data: CustomerDataSchema.optional(),
742
912
  entity_data: import_v47.z.any().optional(),
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  withAuth
3
- } from "../chunk-5DDCZMDB.mjs";
4
- import "../chunk-NAP2URIW.mjs";
3
+ } from "../chunk-FA5Z2MOT.mjs";
4
+ import "../chunk-Q7SD535L.mjs";
5
5
  import "../chunk-2TEL6LR5.mjs";
6
6
  import "../chunk-KSG3E4Q2.mjs";
7
7
  export {