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
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-RFSQBGLO.mjs";
6
6
  import {
7
7
  useCustomerBase
8
- } from "./chunk-XK3AXQED.mjs";
8
+ } from "./chunk-BT5OY2CA.mjs";
9
9
 
10
10
  // src/libraries/react/BaseAutumnProvider.tsx
11
11
  import { useRef } from "react";
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  handleCheck,
5
5
  openDialog
6
- } from "./chunk-KMYL54B4.mjs";
6
+ } from "./chunk-DKOF357C.mjs";
7
7
  import {
8
8
  useAutumnBase
9
- } from "./chunk-6D6TYTTO.mjs";
9
+ } from "./chunk-P6CAHZVT.mjs";
10
10
  import {
11
11
  useAutumnContext
12
- } from "./chunk-FDNQ6GRK.mjs";
12
+ } from "./chunk-SWVRRNIW.mjs";
13
13
 
14
14
  // src/libraries/react/hooks/useCustomerBase.tsx
15
15
  import useSWR from "swr";
@@ -88,16 +88,6 @@ var useCustomerBase = ({
88
88
  context
89
89
  });
90
90
  return res;
91
- },
92
- /** @deprecated Use check() instead */
93
- allowed: (params2) => {
94
- const result = handleCheck({
95
- customer,
96
- params: params2,
97
- isEntity: false,
98
- context
99
- });
100
- return result.data.allowed;
101
91
  }
102
92
  };
103
93
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  CheckFeatureResultSchema
5
- } from "./chunk-WYQMHQUE.mjs";
5
+ } from "./chunk-5O3IHYFF.mjs";
6
6
 
7
7
  // src/libraries/react/hooks/helpers/handleCheck.ts
8
8
  var getCusFeature = ({
@@ -2,10 +2,10 @@
2
2
 
3
3
  import {
4
4
  useCustomerBase
5
- } from "./chunk-XK3AXQED.mjs";
5
+ } from "./chunk-BT5OY2CA.mjs";
6
6
  import {
7
7
  AutumnContext
8
- } from "./chunk-FDNQ6GRK.mjs";
8
+ } from "./chunk-SWVRRNIW.mjs";
9
9
 
10
10
  // src/libraries/react/hooks/useCustomer.tsx
11
11
  var useCustomer = (params) => {
@@ -2,11 +2,11 @@
2
2
 
3
3
  import {
4
4
  usePricingTableBase
5
- } from "./chunk-YHT2JUXO.mjs";
5
+ } from "./chunk-7HRCOEUW.mjs";
6
6
  import {
7
7
  AutumnContext,
8
8
  useAutumnContext
9
- } from "./chunk-FDNQ6GRK.mjs";
9
+ } from "./chunk-SWVRRNIW.mjs";
10
10
 
11
11
  // src/libraries/react/hooks/usePricingTable.tsx
12
12
  var usePricingTable = (params) => {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  usePricingTableBase
5
- } from "./chunk-YHT2JUXO.mjs";
5
+ } from "./chunk-7HRCOEUW.mjs";
6
6
 
7
7
  // src/libraries/react/hooks/helpers/useAutumnBase.tsx
8
8
  var useAutumnBase = ({
@@ -147,7 +147,6 @@ var useAutumnBase = ({
147
147
  };
148
148
  return {
149
149
  attach,
150
- // check,
151
150
  track,
152
151
  cancel,
153
152
  openBillingPortal,
@@ -3,10 +3,10 @@
3
3
  import {
4
4
  AutumnContext,
5
5
  useAutumnContext
6
- } from "./chunk-FDNQ6GRK.mjs";
6
+ } from "./chunk-SWVRRNIW.mjs";
7
7
  import {
8
8
  AutumnError
9
- } from "./chunk-WYQMHQUE.mjs";
9
+ } from "./chunk-5O3IHYFF.mjs";
10
10
 
11
11
  // src/libraries/react/hooks/useAnalytics.tsx
12
12
  import useSWR from "swr";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  AutumnClient
5
- } from "./chunk-U3OQJXCW.mjs";
5
+ } from "./chunk-TOAZUTY6.mjs";
6
6
 
7
7
  // src/libraries/react/AutumnContext.tsx
8
8
  import { createContext, useContext } from "react";
@@ -3,7 +3,10 @@
3
3
  import {
4
4
  AutumnError,
5
5
  toContainerResult
6
- } from "./chunk-WYQMHQUE.mjs";
6
+ } from "./chunk-5O3IHYFF.mjs";
7
+ import {
8
+ logAuthError
9
+ } from "./chunk-JVCOY7ZL.mjs";
7
10
  import {
8
11
  logFetchError
9
12
  } from "./chunk-CIBQ4BJU.mjs";
@@ -14,9 +17,6 @@ import {
14
17
  createCode,
15
18
  redeemCode
16
19
  } from "./chunk-ZV4RPZTM.mjs";
17
- import {
18
- logAuthError
19
- } from "./chunk-JVCOY7ZL.mjs";
20
20
  import {
21
21
  getPricingTableMethod
22
22
  } from "./chunk-VTGR7VVK.mjs";
@@ -78,7 +78,8 @@ var AutumnClient = class {
78
78
  await fetch(testEndpoint, {
79
79
  method: "POST",
80
80
  credentials: "include",
81
- headers: { "Content-Type": "application/json" }
81
+ headers: { "Content-Type": "application/json" },
82
+ body: JSON.stringify({})
82
83
  });
83
84
  return { valid: true, includeCredentials: true };
84
85
  } catch (error) {
@@ -86,7 +87,8 @@ var AutumnClient = class {
86
87
  await fetch(testEndpoint, {
87
88
  method: "POST",
88
89
  credentials: "omit",
89
- headers: { "Content-Type": "application/json" }
90
+ headers: { "Content-Type": "application/json" },
91
+ body: JSON.stringify({})
90
92
  });
91
93
  return { valid: true, includeCredentials: false };
92
94
  } catch (error2) {
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  AutumnContext,
5
5
  useAutumnContext
6
- } from "./chunk-FDNQ6GRK.mjs";
6
+ } from "./chunk-SWVRRNIW.mjs";
7
7
 
8
8
  // src/libraries/react/hooks/usePaywall.tsx
9
9
  import useSWR from "swr";
@@ -2,13 +2,13 @@
2
2
 
3
3
  import {
4
4
  BaseAutumnProvider
5
- } from "./chunk-OMJJLT2Q.mjs";
5
+ } from "./chunk-7JU3XHKL.mjs";
6
6
  import {
7
7
  AutumnContext
8
- } from "./chunk-FDNQ6GRK.mjs";
8
+ } from "./chunk-SWVRRNIW.mjs";
9
9
  import {
10
10
  AutumnClient
11
- } from "./chunk-U3OQJXCW.mjs";
11
+ } from "./chunk-TOAZUTY6.mjs";
12
12
 
13
13
  // src/libraries/react/ReactAutumnProvider.tsx
14
14
  import { jsx } from "react/jsx-runtime";
@@ -490,22 +490,92 @@ var Autumn = class {
490
490
  entities = entityMethods(this);
491
491
  referrals = referralMethods(this);
492
492
  features = featureMethods(this);
493
- static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
493
+ /**
494
+ * Initiates a checkout flow for a product purchase.
495
+ *
496
+ * The checkout function handles the purchase process for products with pricing.
497
+ * It determines whether to show a dialog for user input or redirect directly
498
+ * to Stripe based on the customer's state and product requirements.
499
+ *
500
+ * @param params - Checkout parameters including product ID, customer data, and options
501
+ * @returns Promise resolving to checkout details including pricing, prorations, and URLs
502
+ *
503
+ * @example
504
+ * ```typescript
505
+ * const result = await autumn.checkout({
506
+ * customer_id: "user_123",
507
+ * product_id: "pro",
508
+ * success_url: "https://myapp.com/success"
509
+ * });
510
+ *
511
+ * if (result.url) {
512
+ * // Redirect to Stripe checkout
513
+ * window.location.href = result.url;
514
+ * }
515
+ * ```
516
+ */
494
517
  async checkout(params) {
495
518
  return handleCheckout({
496
519
  instance: this,
497
520
  params
498
521
  });
499
522
  }
500
- static attach = (params) => staticWrapper(handleAttach, void 0, { params });
523
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
501
524
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
525
+ /**
526
+ * Attaches a product to a customer, enabling access and handling billing.
527
+ *
528
+ * The attach function activates a product for a customer and applies all product items.
529
+ * When you attach a product:
530
+ * - The customer gains access to all features in the product
531
+ * - If the product has prices, the customer will be billed accordingly
532
+ * - If there's no existing payment method, a checkout URL will be generated
533
+ *
534
+ * @param params - Attach parameters including customer ID, product ID, and options
535
+ * @returns Promise resolving to attachment result with checkout URL if needed
536
+ *
537
+ * @example
538
+ * ```typescript
539
+ * const result = await autumn.attach({
540
+ * customer_id: "user_123",
541
+ * product_id: "pro",
542
+ * success_url: "https://myapp.com/success"
543
+ * });
544
+ *
545
+ * if (result.checkout_url) {
546
+ * // Payment required - redirect to checkout
547
+ * window.location.href = result.checkout_url;
548
+ * } else {
549
+ * // Product successfully attached
550
+ * console.log("Access granted:", result.message);
551
+ * }
552
+ * ```
553
+ */
502
554
  async attach(params) {
503
555
  return handleAttach({
504
556
  instance: this,
505
557
  params
506
558
  });
507
559
  }
560
+ static attach = (params) => staticWrapper(handleAttach, void 0, { params });
508
561
  static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
562
+ /**
563
+ * Sets up a payment method for a customer.
564
+ *
565
+ * This method allows you to set up payment methods for customers without
566
+ * immediately charging them. Useful for collecting payment information
567
+ * before product attachment or for updating existing payment methods.
568
+ *
569
+ * @param params - Setup payment parameters including customer information
570
+ * @returns Promise resolving to setup payment result
571
+ *
572
+ * @example
573
+ * ```typescript
574
+ * const result = await autumn.setupPayment({
575
+ * customer_id: "user_123"
576
+ * });
577
+ * ```
578
+ */
509
579
  async setupPayment(params) {
510
580
  return handleSetupPayment({
511
581
  instance: this,
@@ -513,6 +583,24 @@ var Autumn = class {
513
583
  });
514
584
  }
515
585
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
586
+ /**
587
+ * Cancels a customer's subscription or product attachment.
588
+ *
589
+ * This method allows you to cancel a customer's subscription to a specific product.
590
+ * You can choose to cancel immediately or at the end of the billing cycle.
591
+ *
592
+ * @param params - Cancel parameters including customer ID and product ID
593
+ * @returns Promise resolving to cancellation result
594
+ *
595
+ * @example
596
+ * ```typescript
597
+ * const result = await autumn.cancel({
598
+ * customer_id: "user_123",
599
+ * product_id: "pro",
600
+ * cancel_immediately: false // Cancel at end of billing cycle
601
+ * });
602
+ * ```
603
+ */
516
604
  async cancel(params) {
517
605
  return handleCancel({
518
606
  instance: this,
@@ -520,6 +608,29 @@ var Autumn = class {
520
608
  });
521
609
  }
522
610
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
611
+ /**
612
+ * Checks if a customer has access to a specific feature.
613
+ *
614
+ * This method verifies whether a customer has permission to use a feature
615
+ * and checks their remaining balance/usage limits. It can be used to gate
616
+ * features and determine when to show upgrade prompts.
617
+ *
618
+ * @param params - Check parameters including customer ID and feature ID
619
+ * @returns Promise resolving to access check result with allowed status and balance info
620
+ *
621
+ * @example
622
+ * ```typescript
623
+ * const result = await autumn.check({
624
+ * customer_id: "user_123",
625
+ * feature_id: "messages",
626
+ * required_balance: 1
627
+ * });
628
+ *
629
+ * if (!result.allowed) {
630
+ * console.log("Feature access denied - upgrade required");
631
+ * }
632
+ * ```
633
+ */
523
634
  async check(params) {
524
635
  return handleCheck({
525
636
  instance: this,
@@ -527,12 +638,50 @@ var Autumn = class {
527
638
  });
528
639
  }
529
640
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
641
+ /**
642
+ * Tracks usage events for features or analytics.
643
+ *
644
+ * This method records usage events for metered features, updating the customer's
645
+ * balance and usage statistics. It's typically used server-side to ensure
646
+ * accurate tracking that cannot be manipulated by users.
647
+ *
648
+ * @param params - Track parameters including customer ID, feature ID, and usage value
649
+ * @returns Promise resolving to tracking result
650
+ *
651
+ * @example
652
+ * ```typescript
653
+ * const result = await autumn.track({
654
+ * customer_id: "user_123",
655
+ * feature_id: "messages",
656
+ * value: 1 // Track 1 message sent
657
+ * });
658
+ * ```
659
+ */
530
660
  async track(params) {
531
661
  return handleTrack({
532
662
  instance: this,
533
663
  params
534
664
  });
535
665
  }
666
+ /**
667
+ * Retrieves usage statistics and analytics for a customer.
668
+ *
669
+ * This method fetches detailed usage information for a customer's features,
670
+ * including current balances, usage history, and analytics data. Useful
671
+ * for displaying usage dashboards or generating reports.
672
+ *
673
+ * @param params - Usage parameters including customer ID and optional filters
674
+ * @returns Promise resolving to usage statistics and analytics data
675
+ *
676
+ * @example
677
+ * ```typescript
678
+ * const result = await autumn.usage({
679
+ * customer_id: "user_123",
680
+ * feature_id: "messages"
681
+ * value: 20 // Usage value
682
+ * });
683
+ * ```
684
+ */
536
685
  async usage(params) {
537
686
  return handleUsage({
538
687
  instance: this,
@@ -540,6 +689,25 @@ var Autumn = class {
540
689
  });
541
690
  }
542
691
  static query = (params) => staticWrapper(handleQuery, void 0, { params });
692
+ /**
693
+ * Performs advanced queries on customer data and analytics.
694
+ *
695
+ * This method allows you to run complex queries against customer data,
696
+ * usage patterns, and billing information. Useful for generating reports,
697
+ * analytics, and custom data insights.
698
+ *
699
+ * @param params - Query parameters including customer ID and query specifications
700
+ * @returns Promise resolving to query results with requested data
701
+ *
702
+ * @example
703
+ * ```typescript
704
+ * const result = await autumn.query({
705
+ * customer_id: "user_123",
706
+ * feature_id: "messages" // feature id to fetch for query, can also be an array
707
+ * });
708
+ *
709
+ * ```
710
+ */
543
711
  async query(params) {
544
712
  return handleQuery({
545
713
  instance: this,
@@ -755,6 +923,8 @@ var CheckoutParamsSchema = import_v47.z.object({
755
923
  product_id: import_v47.z.string(),
756
924
  entity_id: import_v47.z.string().optional(),
757
925
  options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
926
+ force_checkout: import_v47.z.boolean().optional(),
927
+ invoice: import_v47.z.boolean().optional(),
758
928
  success_url: import_v47.z.string().optional(),
759
929
  customer_data: CustomerDataSchema.optional(),
760
930
  entity_data: import_v47.z.any().optional(),
@@ -936,7 +1106,8 @@ var AutumnClient = class {
936
1106
  await fetch(testEndpoint, {
937
1107
  method: "POST",
938
1108
  credentials: "include",
939
- headers: { "Content-Type": "application/json" }
1109
+ headers: { "Content-Type": "application/json" },
1110
+ body: JSON.stringify({})
940
1111
  });
941
1112
  return { valid: true, includeCredentials: true };
942
1113
  } catch (error) {
@@ -944,7 +1115,8 @@ var AutumnClient = class {
944
1115
  await fetch(testEndpoint, {
945
1116
  method: "POST",
946
1117
  credentials: "omit",
947
- headers: { "Content-Type": "application/json" }
1118
+ headers: { "Content-Type": "application/json" },
1119
+ body: JSON.stringify({})
948
1120
  });
949
1121
  return { valid: true, includeCredentials: false };
950
1122
  } catch (error2) {
@@ -2,12 +2,12 @@
2
2
 
3
3
  import {
4
4
  AutumnClient
5
- } from "../chunk-U3OQJXCW.mjs";
6
- import "../chunk-WYQMHQUE.mjs";
5
+ } from "../chunk-TOAZUTY6.mjs";
6
+ import "../chunk-5O3IHYFF.mjs";
7
+ import "../chunk-JVCOY7ZL.mjs";
7
8
  import "../chunk-CIBQ4BJU.mjs";
8
9
  import "../chunk-V575SGOW.mjs";
9
10
  import "../chunk-ZV4RPZTM.mjs";
10
- import "../chunk-JVCOY7ZL.mjs";
11
11
  import "../chunk-VTGR7VVK.mjs";
12
12
  import "../chunk-WFFVOEUG.mjs";
13
13
  import "../chunk-ZF2HUCN6.mjs";