autumn-js 1.2.3 → 1.2.4

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 (152) hide show
  1. package/dist/backend/adapters/express.d.mts +1 -1
  2. package/dist/backend/adapters/express.d.ts +1 -1
  3. package/dist/backend/adapters/express.js +30 -16
  4. package/dist/backend/adapters/express.mjs +9 -9
  5. package/dist/backend/adapters/fetch.d.mts +1 -1
  6. package/dist/backend/adapters/fetch.d.ts +1 -1
  7. package/dist/backend/adapters/fetch.js +30 -16
  8. package/dist/backend/adapters/fetch.mjs +9 -9
  9. package/dist/backend/adapters/hono.d.mts +1 -1
  10. package/dist/backend/adapters/hono.d.ts +1 -1
  11. package/dist/backend/adapters/hono.js +30 -16
  12. package/dist/backend/adapters/hono.mjs +9 -9
  13. package/dist/backend/adapters/index.d.mts +1 -1
  14. package/dist/backend/adapters/index.d.ts +1 -1
  15. package/dist/backend/adapters/index.js +30 -16
  16. package/dist/backend/adapters/index.mjs +12 -12
  17. package/dist/backend/adapters/next.d.mts +1 -1
  18. package/dist/backend/adapters/next.d.ts +1 -1
  19. package/dist/backend/adapters/next.js +30 -16
  20. package/dist/backend/adapters/next.mjs +9 -9
  21. package/dist/backend/{authTypes-B5VxPaMo.d.mts → authTypes-Bdpu8A6G.d.mts} +4 -0
  22. package/dist/backend/{authTypes-B5VxPaMo.d.ts → authTypes-Bdpu8A6G.d.ts} +4 -0
  23. package/dist/backend/{chunk-N62MDT7U.mjs → chunk-3RN6TO3T.mjs} +4 -2
  24. package/dist/backend/{chunk-OLHAIHAX.mjs → chunk-AA2HLIP7.mjs} +5 -5
  25. package/dist/backend/{chunk-IUFWKMTJ.mjs → chunk-AIKOHUUL.mjs} +1 -1
  26. package/dist/backend/{chunk-CCEZMERA.mjs → chunk-BGGTI77T.mjs} +26 -14
  27. package/dist/backend/{chunk-FRKRWJ5S.mjs → chunk-MHFVVQCC.mjs} +1 -1
  28. package/dist/backend/{chunk-ETHQSA52.mjs → chunk-OZRCCZTP.mjs} +7 -7
  29. package/dist/backend/{chunk-IFFSWLXT.mjs → chunk-SCDE7Y52.mjs} +1 -1
  30. package/dist/backend/{chunk-2YEMC57K.mjs → chunk-UUMOHEAD.mjs} +1 -1
  31. package/dist/backend/core/handlers/coreHandler.d.mts +2 -2
  32. package/dist/backend/core/handlers/coreHandler.d.ts +2 -2
  33. package/dist/backend/core/handlers/coreHandler.js +30 -16
  34. package/dist/backend/core/handlers/coreHandler.mjs +7 -7
  35. package/dist/backend/core/handlers/executeRoute.d.mts +2 -2
  36. package/dist/backend/core/handlers/executeRoute.d.ts +2 -2
  37. package/dist/backend/core/handlers/executeRoute.mjs +4 -4
  38. package/dist/backend/core/handlers/handleRouteByName.d.mts +1 -1
  39. package/dist/backend/core/handlers/handleRouteByName.d.ts +1 -1
  40. package/dist/backend/core/handlers/handleRouteByName.js +30 -16
  41. package/dist/backend/core/handlers/handleRouteByName.mjs +7 -7
  42. package/dist/backend/core/handlers/index.d.mts +2 -2
  43. package/dist/backend/core/handlers/index.d.ts +2 -2
  44. package/dist/backend/core/handlers/index.js +30 -16
  45. package/dist/backend/core/handlers/index.mjs +10 -10
  46. package/dist/backend/core/handlers/resolveIdentity.d.mts +1 -1
  47. package/dist/backend/core/handlers/resolveIdentity.d.ts +1 -1
  48. package/dist/backend/core/index.d.mts +2 -2
  49. package/dist/backend/core/index.d.ts +2 -2
  50. package/dist/backend/core/index.js +30 -16
  51. package/dist/backend/core/index.mjs +10 -10
  52. package/dist/backend/core/routes/index.d.mts +2 -2
  53. package/dist/backend/core/routes/index.d.ts +2 -2
  54. package/dist/backend/core/routes/index.js +4 -2
  55. package/dist/backend/core/routes/index.mjs +2 -2
  56. package/dist/backend/core/routes/routeBuilder.d.mts +2 -2
  57. package/dist/backend/core/routes/routeBuilder.d.ts +2 -2
  58. package/dist/backend/core/routes/routeConfigs.d.mts +2 -2
  59. package/dist/backend/core/routes/routeConfigs.d.ts +2 -2
  60. package/dist/backend/core/routes/routeConfigs.js +4 -2
  61. package/dist/backend/core/routes/routeConfigs.mjs +2 -2
  62. package/dist/backend/core/types/authTypes.d.mts +1 -1
  63. package/dist/backend/core/types/authTypes.d.ts +1 -1
  64. package/dist/backend/core/types/handlerTypes.d.mts +2 -2
  65. package/dist/backend/core/types/handlerTypes.d.ts +2 -2
  66. package/dist/backend/core/types/index.d.mts +2 -2
  67. package/dist/backend/core/types/index.d.ts +2 -2
  68. package/dist/backend/core/types/routeTypes.d.mts +2 -2
  69. package/dist/backend/core/types/routeTypes.d.ts +2 -2
  70. package/dist/backend/core/utils/index.mjs +3 -3
  71. package/dist/backend/index.d.mts +4 -4
  72. package/dist/backend/index.d.ts +4 -4
  73. package/dist/backend/index.js +30 -16
  74. package/dist/backend/index.mjs +10 -10
  75. package/dist/backend/{routeTypes-BkSHRiCI.d.ts → routeTypes-DpH9YHyt.d.ts} +21 -1
  76. package/dist/backend/{routeTypes-C1hUtfD8.d.mts → routeTypes-mIP4rSxp.d.mts} +21 -1
  77. package/dist/better-auth/{chunk-6J74ZVNY.mjs → chunk-3C2VGNW3.mjs} +27 -15
  78. package/dist/better-auth/{chunk-2PRVJULJ.mjs → chunk-CG3LL2TQ.mjs} +4 -2
  79. package/dist/better-auth/{chunk-IY7FPOWF.mjs → chunk-UCMJFTKD.mjs} +1 -1
  80. package/dist/better-auth/index.js +30 -16
  81. package/dist/better-auth/index.mjs +3 -3
  82. package/dist/better-auth/types.d.mts +4 -0
  83. package/dist/better-auth/types.d.ts +4 -0
  84. package/dist/better-auth/utils/createAutumnEndpoint.js +4 -2
  85. package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
  86. package/dist/better-auth/utils/handleBetterAuthRoute.js +30 -16
  87. package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
  88. package/dist/better-auth/utils/index.js +30 -16
  89. package/dist/better-auth/utils/index.mjs +3 -3
  90. package/dist/react/AutumnContext.d.mts +2 -2
  91. package/dist/react/AutumnContext.d.ts +2 -2
  92. package/dist/react/AutumnProvider.d.mts +2 -1
  93. package/dist/react/AutumnProvider.d.ts +2 -1
  94. package/dist/react/AutumnProvider.js +18 -8
  95. package/dist/react/AutumnProvider.mjs +3 -3
  96. package/dist/react/{chunk-R7I3UPL4.mjs → chunk-26CKSAPZ.mjs} +6 -4
  97. package/dist/react/{chunk-QEJLIFBC.mjs → chunk-QOFGTXEX.mjs} +3 -2
  98. package/dist/react/{chunk-M34U5F2H.mjs → chunk-SCDO26YC.mjs} +11 -4
  99. package/dist/react/client/AutumnClient.d.mts +3 -2
  100. package/dist/react/client/AutumnClient.d.ts +3 -2
  101. package/dist/react/client/AutumnClient.js +13 -5
  102. package/dist/react/client/AutumnClient.mjs +2 -2
  103. package/dist/react/client/IAutumnClient.d.mts +2 -2
  104. package/dist/react/client/IAutumnClient.d.ts +2 -2
  105. package/dist/react/client/index.d.mts +2 -2
  106. package/dist/react/client/index.d.ts +2 -2
  107. package/dist/react/client/index.js +13 -5
  108. package/dist/react/client/index.mjs +2 -2
  109. package/dist/react/client/internal/httpClient.d.mts +1 -0
  110. package/dist/react/client/internal/httpClient.d.ts +1 -0
  111. package/dist/react/client/internal/httpClient.js +11 -4
  112. package/dist/react/client/internal/httpClient.mjs +1 -1
  113. package/dist/react/{customer-CJSDgQMF.d.ts → customer-BPHnUS4N.d.ts} +4 -0
  114. package/dist/react/{customer-Bb7J-_p_.d.mts → customer-DDRi84Zq.d.mts} +4 -0
  115. package/dist/react/hooks/index.d.mts +2 -2
  116. package/dist/react/hooks/index.d.ts +2 -2
  117. package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +1 -1
  118. package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +1 -1
  119. package/dist/react/hooks/internal/check/customerToFeatures.d.mts +1 -1
  120. package/dist/react/hooks/internal/check/customerToFeatures.d.ts +1 -1
  121. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +1 -1
  122. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +1 -1
  123. package/dist/react/hooks/internal/check/getCreditCost.d.mts +1 -1
  124. package/dist/react/hooks/internal/check/getCreditCost.d.ts +1 -1
  125. package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +2 -2
  126. package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +2 -2
  127. package/dist/react/hooks/internal/useCustomerActions.d.mts +2 -2
  128. package/dist/react/hooks/internal/useCustomerActions.d.ts +2 -2
  129. package/dist/react/hooks/useAggregateEvents.d.mts +1 -1
  130. package/dist/react/hooks/useAggregateEvents.d.ts +1 -1
  131. package/dist/react/hooks/useCustomer.d.mts +2 -2
  132. package/dist/react/hooks/useCustomer.d.ts +2 -2
  133. package/dist/react/hooks/useEntity.d.mts +1 -1
  134. package/dist/react/hooks/useEntity.d.ts +1 -1
  135. package/dist/react/hooks/useListEvents.d.mts +1 -1
  136. package/dist/react/hooks/useListEvents.d.ts +1 -1
  137. package/dist/react/hooks/useListPlans.d.mts +1 -1
  138. package/dist/react/hooks/useListPlans.d.ts +1 -1
  139. package/dist/react/hooks/useReferrals.d.mts +1 -1
  140. package/dist/react/hooks/useReferrals.d.ts +1 -1
  141. package/dist/react/index.d.mts +2 -2
  142. package/dist/react/index.d.ts +2 -2
  143. package/dist/react/index.js +18 -8
  144. package/dist/react/index.mjs +3 -3
  145. package/dist/react/{params-CheyAQ0-.d.mts → params-Bj6uyOX1.d.mts} +4 -0
  146. package/dist/react/{params-yCtJ7lOA.d.ts → params-DAVIR4YX.d.ts} +4 -0
  147. package/dist/sdk/index.d.mts +29 -2
  148. package/dist/sdk/index.d.ts +29 -2
  149. package/dist/sdk/index.js +26 -14
  150. package/dist/sdk/index.mjs +26 -14
  151. package/package.json +1 -1
  152. package/dist/backend/{chunk-S5HPMJ4U.mjs → chunk-55C2WWXQ.mjs} +3 -3
@@ -393,7 +393,8 @@ var getOrCreateCustomerAutoTopupOutboundSchema = import_v44.z.object({
393
393
  enabled: import_v44.z.boolean(),
394
394
  threshold: import_v44.z.number(),
395
395
  quantity: import_v44.z.number(),
396
- purchase_limit: import_v44.z.union([getOrCreateCustomerPurchaseLimitOutboundSchema, import_v44.z.undefined()]).optional()
396
+ purchase_limit: import_v44.z.union([getOrCreateCustomerPurchaseLimitOutboundSchema, import_v44.z.undefined()]).optional(),
397
+ invoice_mode: import_v44.z.union([import_v44.z.boolean(), import_v44.z.undefined()]).optional()
397
398
  });
398
399
  var getOrCreateCustomerSpendLimitOutboundSchema = import_v44.z.object({
399
400
  feature_id: import_v44.z.union([import_v44.z.string(), import_v44.z.undefined()]).optional(),
@@ -451,7 +452,8 @@ var getOrCreateCustomerAutoTopupSchema = import_v44.z.object({
451
452
  enabled: import_v44.z.union([import_v44.z.boolean(), import_v44.z.undefined()]).optional(),
452
453
  threshold: import_v44.z.number(),
453
454
  quantity: import_v44.z.number(),
454
- purchaseLimit: import_v44.z.union([getOrCreateCustomerPurchaseLimitSchema, import_v44.z.undefined()]).optional()
455
+ purchaseLimit: import_v44.z.union([getOrCreateCustomerPurchaseLimitSchema, import_v44.z.undefined()]).optional(),
456
+ invoiceMode: import_v44.z.union([import_v44.z.boolean(), import_v44.z.undefined()]).optional()
455
457
  });
456
458
  var getOrCreateCustomerThresholdTypeSchema = closedEnumSchema3;
457
459
  var getOrCreateCustomerUsageAlertSchema = import_v44.z.object({
@@ -2629,8 +2631,8 @@ var SDK_METADATA = {
2629
2631
  language: "typescript",
2630
2632
  openapiDocVersion: "2.2.0",
2631
2633
  sdkVersion: "0.10.17",
2632
- genVersion: "2.879.1",
2633
- userAgent: "speakeasy-sdk/typescript 0.10.17 2.879.1 2.2.0 @useautumn/sdk"
2634
+ genVersion: "2.879.6",
2635
+ userAgent: "speakeasy-sdk/typescript 0.10.17 2.879.6 2.2.0 @useautumn/sdk"
2634
2636
  };
2635
2637
 
2636
2638
  // ../sdk/src/lib/http.ts
@@ -5247,12 +5249,14 @@ var CustomerDataAutoTopup$outboundSchema = z31.pipe(
5247
5249
  quantity: z31.number(),
5248
5250
  purchaseLimit: z31.optional(
5249
5251
  z31.lazy(() => CustomerDataPurchaseLimit$outboundSchema)
5250
- )
5252
+ ),
5253
+ invoiceMode: z31.optional(z31.boolean())
5251
5254
  }),
5252
5255
  z31.transform((v) => {
5253
5256
  return remap(v, {
5254
5257
  featureId: "feature_id",
5255
- purchaseLimit: "purchase_limit"
5258
+ purchaseLimit: "purchase_limit",
5259
+ invoiceMode: "invoice_mode"
5256
5260
  });
5257
5261
  })
5258
5262
  );
@@ -6606,12 +6610,14 @@ var CustomerAutoTopup$inboundSchema = z37.pipe(
6606
6610
  quantity: number2(),
6607
6611
  purchase_limit: optional2(
6608
6612
  z37.lazy(() => CustomerPurchaseLimit$inboundSchema)
6609
- )
6613
+ ),
6614
+ invoice_mode: optional2(boolean2())
6610
6615
  }),
6611
6616
  z37.transform((v) => {
6612
6617
  return remap(v, {
6613
6618
  "feature_id": "featureId",
6614
- "purchase_limit": "purchaseLimit"
6619
+ "purchase_limit": "purchaseLimit",
6620
+ "invoice_mode": "invoiceMode"
6615
6621
  });
6616
6622
  })
6617
6623
  );
@@ -7381,12 +7387,14 @@ var GetOrCreateCustomerAutoTopup$outboundSchema = z46.pipe(
7381
7387
  quantity: z46.number(),
7382
7388
  purchaseLimit: z46.optional(
7383
7389
  z46.lazy(() => GetOrCreateCustomerPurchaseLimit$outboundSchema)
7384
- )
7390
+ ),
7391
+ invoiceMode: z46.optional(z46.boolean())
7385
7392
  }),
7386
7393
  z46.transform((v) => {
7387
7394
  return remap(v, {
7388
7395
  featureId: "feature_id",
7389
- purchaseLimit: "purchase_limit"
7396
+ purchaseLimit: "purchase_limit",
7397
+ invoiceMode: "invoice_mode"
7390
7398
  });
7391
7399
  })
7392
7400
  );
@@ -7871,12 +7879,14 @@ var ListCustomersAutoTopup$inboundSchema = z48.pipe(
7871
7879
  quantity: number2(),
7872
7880
  purchase_limit: optional2(
7873
7881
  z48.lazy(() => ListCustomersPurchaseLimit$inboundSchema)
7874
- )
7882
+ ),
7883
+ invoice_mode: optional2(boolean2())
7875
7884
  }),
7876
7885
  z48.transform((v) => {
7877
7886
  return remap(v, {
7878
7887
  "feature_id": "featureId",
7879
- "purchase_limit": "purchaseLimit"
7888
+ "purchase_limit": "purchaseLimit",
7889
+ "invoice_mode": "invoiceMode"
7880
7890
  });
7881
7891
  })
7882
7892
  );
@@ -11111,12 +11121,14 @@ var UpdateCustomerAutoTopupRequest$outboundSchema = z61.pipe(
11111
11121
  quantity: z61.number(),
11112
11122
  purchaseLimit: z61.optional(
11113
11123
  z61.lazy(() => UpdateCustomerPurchaseLimitRequest$outboundSchema)
11114
- )
11124
+ ),
11125
+ invoiceMode: z61.optional(z61.boolean())
11115
11126
  }),
11116
11127
  z61.transform((v) => {
11117
11128
  return remap(v, {
11118
11129
  featureId: "feature_id",
11119
- purchaseLimit: "purchase_limit"
11130
+ purchaseLimit: "purchase_limit",
11131
+ invoiceMode: "invoice_mode"
11120
11132
  });
11121
11133
  })
11122
11134
  );
@@ -11232,12 +11244,14 @@ var UpdateCustomerAutoTopupResponse$inboundSchema = z61.pipe(
11232
11244
  quantity: number2(),
11233
11245
  purchase_limit: optional2(
11234
11246
  z61.lazy(() => UpdateCustomerPurchaseLimitResponse$inboundSchema)
11235
- )
11247
+ ),
11248
+ invoice_mode: optional2(boolean2())
11236
11249
  }),
11237
11250
  z61.transform((v) => {
11238
11251
  return remap(v, {
11239
11252
  "feature_id": "featureId",
11240
- "purchase_limit": "purchaseLimit"
11253
+ "purchase_limit": "purchaseLimit",
11254
+ "invoice_mode": "invoiceMode"
11241
11255
  });
11242
11256
  })
11243
11257
  );
@@ -1,14 +1,14 @@
1
1
  import "../chunk-HIWOK3G6.mjs";
2
2
  import {
3
3
  createAutumnEndpoint
4
- } from "../chunk-IY7FPOWF.mjs";
4
+ } from "../chunk-UCMJFTKD.mjs";
5
5
  import {
6
6
  createHandleBetterAuthRoute
7
- } from "../chunk-6J74ZVNY.mjs";
7
+ } from "../chunk-3C2VGNW3.mjs";
8
8
  import {
9
9
  resolveIdentityFromScope
10
10
  } from "../chunk-J2WYVGHS.mjs";
11
- import "../chunk-2PRVJULJ.mjs";
11
+ import "../chunk-CG3LL2TQ.mjs";
12
12
  import {
13
13
  getActiveOrganization
14
14
  } from "../chunk-BT3EAYVW.mjs";
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { IAutumnClient } from './client/IAutumnClient.mjs';
3
- import './params-CheyAQ0-.mjs';
3
+ import './params-Bj6uyOX1.mjs';
4
4
  import './plan-CqxFGNk2.mjs';
5
- import './customer-Bb7J-_p_.mjs';
5
+ import './customer-DDRi84Zq.mjs';
6
6
 
7
7
  type AutumnContextValue = {
8
8
  client: IAutumnClient;
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { IAutumnClient } from './client/IAutumnClient.js';
3
- import './params-yCtJ7lOA.js';
3
+ import './params-DAVIR4YX.js';
4
4
  import './plan-CqxFGNk2.js';
5
- import './customer-CJSDgQMF.js';
5
+ import './customer-BPHnUS4N.js';
6
6
 
7
7
  type AutumnContextValue = {
8
8
  client: IAutumnClient;
@@ -7,6 +7,7 @@ type AutumnProviderProps = {
7
7
  pathPrefix?: string;
8
8
  useBetterAuth?: boolean;
9
9
  includeCredentials?: boolean;
10
+ headers?: Record<string, string>;
10
11
  };
11
12
  /**
12
13
  * Provider component for Autumn billing SDK.
@@ -16,6 +17,6 @@ type AutumnProviderProps = {
16
17
  * @param useBetterAuth - Use better-auth integration. Sets pathPrefix to "/api/auth/autumn" and includeCredentials to true by default.
17
18
  * @param includeCredentials - Include credentials (cookies) in cross-origin requests. Defaults to true if useBetterAuth is true.
18
19
  */
19
- declare const AutumnProvider: ({ children, backendUrl, pathPrefix, useBetterAuth, includeCredentials, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
20
+ declare const AutumnProvider: ({ children, backendUrl, pathPrefix, useBetterAuth, includeCredentials, headers, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
20
21
 
21
22
  export { AutumnProvider, type AutumnProviderProps };
@@ -7,6 +7,7 @@ type AutumnProviderProps = {
7
7
  pathPrefix?: string;
8
8
  useBetterAuth?: boolean;
9
9
  includeCredentials?: boolean;
10
+ headers?: Record<string, string>;
10
11
  };
11
12
  /**
12
13
  * Provider component for Autumn billing SDK.
@@ -16,6 +17,6 @@ type AutumnProviderProps = {
16
17
  * @param useBetterAuth - Use better-auth integration. Sets pathPrefix to "/api/auth/autumn" and includeCredentials to true by default.
17
18
  * @param includeCredentials - Include credentials (cookies) in cross-origin requests. Defaults to true if useBetterAuth is true.
18
19
  */
19
- declare const AutumnProvider: ({ children, backendUrl, pathPrefix, useBetterAuth, includeCredentials, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
20
+ declare const AutumnProvider: ({ children, backendUrl, pathPrefix, useBetterAuth, includeCredentials, headers, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
20
21
 
21
22
  export { AutumnProvider, type AutumnProviderProps };
@@ -1926,7 +1926,12 @@ var isErrorBody = (body) => {
1926
1926
  return !!body && typeof body === "object" && "message" in body && "code" in body && "statusCode" in body;
1927
1927
  };
1928
1928
  var createHttpClient = (config) => {
1929
- const { backendUrl, pathPrefix, includeCredentials } = config;
1929
+ const {
1930
+ backendUrl,
1931
+ pathPrefix,
1932
+ includeCredentials,
1933
+ headers: customHeaders
1934
+ } = config;
1930
1935
  const baseUrl = backendUrl ? `${backendUrl}${pathPrefix}` : pathPrefix;
1931
1936
  const request = async ({
1932
1937
  route,
@@ -1934,12 +1939,14 @@ var createHttpClient = (config) => {
1934
1939
  method = "POST"
1935
1940
  }) => {
1936
1941
  const url = `${baseUrl}/${route}`;
1942
+ const headers = {
1943
+ "Content-Type": "application/json",
1944
+ ...customHeaders
1945
+ };
1937
1946
  try {
1938
1947
  const response = await fetch(url, {
1939
1948
  method,
1940
- headers: {
1941
- "Content-Type": "application/json"
1942
- },
1949
+ headers,
1943
1950
  ...includeCredentials && { credentials: "include" },
1944
1951
  ...body !== void 0 && { body: JSON.stringify(body) }
1945
1952
  });
@@ -1980,7 +1987,8 @@ var createAutumnClient = (config) => {
1980
1987
  const http = createHttpClient({
1981
1988
  backendUrl: config.backendUrl,
1982
1989
  pathPrefix: config.pathPrefix,
1983
- includeCredentials: config.includeCredentials
1990
+ includeCredentials: config.includeCredentials,
1991
+ headers: config.headers
1984
1992
  });
1985
1993
  return {
1986
1994
  getOrCreateCustomer: (params) => http.request({
@@ -2055,7 +2063,8 @@ var AutumnProvider = ({
2055
2063
  backendUrl,
2056
2064
  pathPrefix,
2057
2065
  useBetterAuth,
2058
- includeCredentials
2066
+ includeCredentials,
2067
+ headers
2059
2068
  }) => {
2060
2069
  const queryClientRef = (0, import_react2.useRef)(null);
2061
2070
  if (!queryClientRef.current) {
@@ -2076,10 +2085,11 @@ var AutumnProvider = ({
2076
2085
  const client = createAutumnClient({
2077
2086
  backendUrl,
2078
2087
  pathPrefix: resolvedPathPrefix,
2079
- includeCredentials: resolvedIncludeCredentials
2088
+ includeCredentials: resolvedIncludeCredentials,
2089
+ headers
2080
2090
  });
2081
2091
  return { client };
2082
- }, [backendUrl, pathPrefix, useBetterAuth, includeCredentials]);
2092
+ }, [backendUrl, pathPrefix, useBetterAuth, includeCredentials, JSON.stringify(headers)]);
2083
2093
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(QueryClientProvider, { client: queryClientRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AutumnContext.Provider, { value: contextValue, children }) });
2084
2094
  };
2085
2095
  // Annotate the CommonJS export names for ESM import in node:
@@ -2,9 +2,9 @@
2
2
  "use client";
3
3
  import {
4
4
  AutumnProvider
5
- } from "./chunk-R7I3UPL4.mjs";
6
- import "./chunk-QEJLIFBC.mjs";
7
- import "./chunk-M34U5F2H.mjs";
5
+ } from "./chunk-26CKSAPZ.mjs";
6
+ import "./chunk-QOFGTXEX.mjs";
7
+ import "./chunk-SCDO26YC.mjs";
8
8
  import "./chunk-IC3QHWR6.mjs";
9
9
  import "./chunk-XJZH5NMZ.mjs";
10
10
  import "./chunk-SOA7GEAN.mjs";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createAutumnClient
4
- } from "./chunk-QEJLIFBC.mjs";
4
+ } from "./chunk-QOFGTXEX.mjs";
5
5
  import {
6
6
  QueryClient,
7
7
  QueryClientProvider
@@ -20,7 +20,8 @@ var AutumnProvider = ({
20
20
  backendUrl,
21
21
  pathPrefix,
22
22
  useBetterAuth,
23
- includeCredentials
23
+ includeCredentials,
24
+ headers
24
25
  }) => {
25
26
  const queryClientRef = useRef(null);
26
27
  if (!queryClientRef.current) {
@@ -41,10 +42,11 @@ var AutumnProvider = ({
41
42
  const client = createAutumnClient({
42
43
  backendUrl,
43
44
  pathPrefix: resolvedPathPrefix,
44
- includeCredentials: resolvedIncludeCredentials
45
+ includeCredentials: resolvedIncludeCredentials,
46
+ headers
45
47
  });
46
48
  return { client };
47
- }, [backendUrl, pathPrefix, useBetterAuth, includeCredentials]);
49
+ }, [backendUrl, pathPrefix, useBetterAuth, includeCredentials, JSON.stringify(headers)]);
48
50
  return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClientRef.current, children: /* @__PURE__ */ jsx(AutumnContext.Provider, { value: contextValue, children }) });
49
51
  };
50
52
 
@@ -1,14 +1,15 @@
1
1
  "use client";
2
2
  import {
3
3
  createHttpClient
4
- } from "./chunk-M34U5F2H.mjs";
4
+ } from "./chunk-SCDO26YC.mjs";
5
5
 
6
6
  // src/react/client/AutumnClient.ts
7
7
  var createAutumnClient = (config) => {
8
8
  const http = createHttpClient({
9
9
  backendUrl: config.backendUrl,
10
10
  pathPrefix: config.pathPrefix,
11
- includeCredentials: config.includeCredentials
11
+ includeCredentials: config.includeCredentials,
12
+ headers: config.headers
12
13
  });
13
14
  return {
14
15
  getOrCreateCustomer: (params) => http.request({
@@ -8,7 +8,12 @@ var isErrorBody = (body) => {
8
8
  return !!body && typeof body === "object" && "message" in body && "code" in body && "statusCode" in body;
9
9
  };
10
10
  var createHttpClient = (config) => {
11
- const { backendUrl, pathPrefix, includeCredentials } = config;
11
+ const {
12
+ backendUrl,
13
+ pathPrefix,
14
+ includeCredentials,
15
+ headers: customHeaders
16
+ } = config;
12
17
  const baseUrl = backendUrl ? `${backendUrl}${pathPrefix}` : pathPrefix;
13
18
  const request = async ({
14
19
  route,
@@ -16,12 +21,14 @@ var createHttpClient = (config) => {
16
21
  method = "POST"
17
22
  }) => {
18
23
  const url = `${baseUrl}/${route}`;
24
+ const headers = {
25
+ "Content-Type": "application/json",
26
+ ...customHeaders
27
+ };
19
28
  try {
20
29
  const response = await fetch(url, {
21
30
  method,
22
- headers: {
23
- "Content-Type": "application/json"
24
- },
31
+ headers,
25
32
  ...includeCredentials && { credentials: "include" },
26
33
  ...body !== void 0 && { body: JSON.stringify(body) }
27
34
  });
@@ -1,13 +1,14 @@
1
1
  import { IAutumnClient } from './IAutumnClient.mjs';
2
- import '../params-CheyAQ0-.mjs';
2
+ import '../params-Bj6uyOX1.mjs';
3
3
  import '../plan-CqxFGNk2.mjs';
4
- import '../customer-Bb7J-_p_.mjs';
4
+ import '../customer-DDRi84Zq.mjs';
5
5
 
6
6
  /** Configuration for Autumn client */
7
7
  type AutumnClientConfig = {
8
8
  backendUrl?: string;
9
9
  pathPrefix: string;
10
10
  includeCredentials?: boolean;
11
+ headers?: Record<string, string>;
11
12
  };
12
13
  declare const createAutumnClient: (config: AutumnClientConfig) => IAutumnClient;
13
14
 
@@ -1,13 +1,14 @@
1
1
  import { IAutumnClient } from './IAutumnClient.js';
2
- import '../params-yCtJ7lOA.js';
2
+ import '../params-DAVIR4YX.js';
3
3
  import '../plan-CqxFGNk2.js';
4
- import '../customer-CJSDgQMF.js';
4
+ import '../customer-BPHnUS4N.js';
5
5
 
6
6
  /** Configuration for Autumn client */
7
7
  type AutumnClientConfig = {
8
8
  backendUrl?: string;
9
9
  pathPrefix: string;
10
10
  includeCredentials?: boolean;
11
+ headers?: Record<string, string>;
11
12
  };
12
13
  declare const createAutumnClient: (config: AutumnClientConfig) => IAutumnClient;
13
14
 
@@ -49,7 +49,12 @@ var isErrorBody = (body) => {
49
49
  return !!body && typeof body === "object" && "message" in body && "code" in body && "statusCode" in body;
50
50
  };
51
51
  var createHttpClient = (config) => {
52
- const { backendUrl, pathPrefix, includeCredentials } = config;
52
+ const {
53
+ backendUrl,
54
+ pathPrefix,
55
+ includeCredentials,
56
+ headers: customHeaders
57
+ } = config;
53
58
  const baseUrl = backendUrl ? `${backendUrl}${pathPrefix}` : pathPrefix;
54
59
  const request = async ({
55
60
  route,
@@ -57,12 +62,14 @@ var createHttpClient = (config) => {
57
62
  method = "POST"
58
63
  }) => {
59
64
  const url = `${baseUrl}/${route}`;
65
+ const headers = {
66
+ "Content-Type": "application/json",
67
+ ...customHeaders
68
+ };
60
69
  try {
61
70
  const response = await fetch(url, {
62
71
  method,
63
- headers: {
64
- "Content-Type": "application/json"
65
- },
72
+ headers,
66
73
  ...includeCredentials && { credentials: "include" },
67
74
  ...body !== void 0 && { body: JSON.stringify(body) }
68
75
  });
@@ -103,7 +110,8 @@ var createAutumnClient = (config) => {
103
110
  const http = createHttpClient({
104
111
  backendUrl: config.backendUrl,
105
112
  pathPrefix: config.pathPrefix,
106
- includeCredentials: config.includeCredentials
113
+ includeCredentials: config.includeCredentials,
114
+ headers: config.headers
107
115
  });
108
116
  return {
109
117
  getOrCreateCustomer: (params) => http.request({
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createAutumnClient
4
- } from "../chunk-QEJLIFBC.mjs";
5
- import "../chunk-M34U5F2H.mjs";
4
+ } from "../chunk-QOFGTXEX.mjs";
5
+ import "../chunk-SCDO26YC.mjs";
6
6
  import "../chunk-IC3QHWR6.mjs";
7
7
  export {
8
8
  createAutumnClient
@@ -1,5 +1,5 @@
1
- import { d as ClientGetOrCreateCustomerParams, a as ClientAttachParams, p as AttachResponse, h as ClientPreviewAttachParams, q as PreviewAttachResponse, m as ClientUpdateSubscriptionParams, B as BillingUpdateResponse, j as ClientPreviewUpdateSubscriptionParams, r as PreviewUpdateResponse, f as ClientMultiAttachParams, M as MultiAttachResponse, i as ClientPreviewMultiAttachParams, t as PreviewMultiAttachResponse, l as ClientSetupPaymentParams, S as SetupPaymentResponse, g as ClientOpenCustomerPortalParams, O as OpenCustomerPortalResponse, b as ClientCreateReferralCodeParams, w as CreateReferralCodeResponse, k as ClientRedeemReferralCodeParams, R as RedeemReferralCodeResponse, v as ClientListPlansParams, e as ClientListEventsParams, L as ListEventsResponse, C as ClientAggregateEventsParams, A as AggregateEventsResponse, c as ClientGetEntityParams, G as GetEntityResponse } from '../params-CheyAQ0-.mjs';
2
- import { C as Customer } from '../customer-Bb7J-_p_.mjs';
1
+ import { d as ClientGetOrCreateCustomerParams, a as ClientAttachParams, p as AttachResponse, h as ClientPreviewAttachParams, q as PreviewAttachResponse, m as ClientUpdateSubscriptionParams, B as BillingUpdateResponse, j as ClientPreviewUpdateSubscriptionParams, r as PreviewUpdateResponse, f as ClientMultiAttachParams, M as MultiAttachResponse, i as ClientPreviewMultiAttachParams, t as PreviewMultiAttachResponse, l as ClientSetupPaymentParams, S as SetupPaymentResponse, g as ClientOpenCustomerPortalParams, O as OpenCustomerPortalResponse, b as ClientCreateReferralCodeParams, w as CreateReferralCodeResponse, k as ClientRedeemReferralCodeParams, R as RedeemReferralCodeResponse, v as ClientListPlansParams, e as ClientListEventsParams, L as ListEventsResponse, C as ClientAggregateEventsParams, A as AggregateEventsResponse, c as ClientGetEntityParams, G as GetEntityResponse } from '../params-Bj6uyOX1.mjs';
2
+ import { C as Customer } from '../customer-DDRi84Zq.mjs';
3
3
  import { O as OpenEnum } from '../plan-CqxFGNk2.mjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { d as ClientGetOrCreateCustomerParams, a as ClientAttachParams, p as AttachResponse, h as ClientPreviewAttachParams, q as PreviewAttachResponse, m as ClientUpdateSubscriptionParams, B as BillingUpdateResponse, j as ClientPreviewUpdateSubscriptionParams, r as PreviewUpdateResponse, f as ClientMultiAttachParams, M as MultiAttachResponse, i as ClientPreviewMultiAttachParams, t as PreviewMultiAttachResponse, l as ClientSetupPaymentParams, S as SetupPaymentResponse, g as ClientOpenCustomerPortalParams, O as OpenCustomerPortalResponse, b as ClientCreateReferralCodeParams, w as CreateReferralCodeResponse, k as ClientRedeemReferralCodeParams, R as RedeemReferralCodeResponse, v as ClientListPlansParams, e as ClientListEventsParams, L as ListEventsResponse, C as ClientAggregateEventsParams, A as AggregateEventsResponse, c as ClientGetEntityParams, G as GetEntityResponse } from '../params-yCtJ7lOA.js';
2
- import { C as Customer } from '../customer-CJSDgQMF.js';
1
+ import { d as ClientGetOrCreateCustomerParams, a as ClientAttachParams, p as AttachResponse, h as ClientPreviewAttachParams, q as PreviewAttachResponse, m as ClientUpdateSubscriptionParams, B as BillingUpdateResponse, j as ClientPreviewUpdateSubscriptionParams, r as PreviewUpdateResponse, f as ClientMultiAttachParams, M as MultiAttachResponse, i as ClientPreviewMultiAttachParams, t as PreviewMultiAttachResponse, l as ClientSetupPaymentParams, S as SetupPaymentResponse, g as ClientOpenCustomerPortalParams, O as OpenCustomerPortalResponse, b as ClientCreateReferralCodeParams, w as CreateReferralCodeResponse, k as ClientRedeemReferralCodeParams, R as RedeemReferralCodeResponse, v as ClientListPlansParams, e as ClientListEventsParams, L as ListEventsResponse, C as ClientAggregateEventsParams, A as AggregateEventsResponse, c as ClientGetEntityParams, G as GetEntityResponse } from '../params-DAVIR4YX.js';
2
+ import { C as Customer } from '../customer-BPHnUS4N.js';
3
3
  import { O as OpenEnum } from '../plan-CqxFGNk2.js';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  export { AutumnClientConfig, createAutumnClient } from './AutumnClient.mjs';
2
2
  export { AutumnClientError } from './AutumnClientError.mjs';
3
3
  export { IAutumnClient } from './IAutumnClient.mjs';
4
- import '../params-CheyAQ0-.mjs';
4
+ import '../params-Bj6uyOX1.mjs';
5
5
  import '../plan-CqxFGNk2.mjs';
6
- import '../customer-Bb7J-_p_.mjs';
6
+ import '../customer-DDRi84Zq.mjs';
@@ -1,6 +1,6 @@
1
1
  export { AutumnClientConfig, createAutumnClient } from './AutumnClient.js';
2
2
  export { AutumnClientError } from './AutumnClientError.js';
3
3
  export { IAutumnClient } from './IAutumnClient.js';
4
- import '../params-yCtJ7lOA.js';
4
+ import '../params-DAVIR4YX.js';
5
5
  import '../plan-CqxFGNk2.js';
6
- import '../customer-CJSDgQMF.js';
6
+ import '../customer-BPHnUS4N.js';
@@ -50,7 +50,12 @@ var isErrorBody = (body) => {
50
50
  return !!body && typeof body === "object" && "message" in body && "code" in body && "statusCode" in body;
51
51
  };
52
52
  var createHttpClient = (config) => {
53
- const { backendUrl, pathPrefix, includeCredentials } = config;
53
+ const {
54
+ backendUrl,
55
+ pathPrefix,
56
+ includeCredentials,
57
+ headers: customHeaders
58
+ } = config;
54
59
  const baseUrl = backendUrl ? `${backendUrl}${pathPrefix}` : pathPrefix;
55
60
  const request = async ({
56
61
  route,
@@ -58,12 +63,14 @@ var createHttpClient = (config) => {
58
63
  method = "POST"
59
64
  }) => {
60
65
  const url = `${baseUrl}/${route}`;
66
+ const headers = {
67
+ "Content-Type": "application/json",
68
+ ...customHeaders
69
+ };
61
70
  try {
62
71
  const response = await fetch(url, {
63
72
  method,
64
- headers: {
65
- "Content-Type": "application/json"
66
- },
73
+ headers,
67
74
  ...includeCredentials && { credentials: "include" },
68
75
  ...body !== void 0 && { body: JSON.stringify(body) }
69
76
  });
@@ -104,7 +111,8 @@ var createAutumnClient = (config) => {
104
111
  const http = createHttpClient({
105
112
  backendUrl: config.backendUrl,
106
113
  pathPrefix: config.pathPrefix,
107
- includeCredentials: config.includeCredentials
114
+ includeCredentials: config.includeCredentials,
115
+ headers: config.headers
108
116
  });
109
117
  return {
110
118
  getOrCreateCustomer: (params) => http.request({
@@ -2,8 +2,8 @@
2
2
  import "../chunk-7KBQVCNO.mjs";
3
3
  import {
4
4
  createAutumnClient
5
- } from "../chunk-QEJLIFBC.mjs";
6
- import "../chunk-M34U5F2H.mjs";
5
+ } from "../chunk-QOFGTXEX.mjs";
6
+ import "../chunk-SCDO26YC.mjs";
7
7
  import {
8
8
  AutumnClientError
9
9
  } from "../chunk-IC3QHWR6.mjs";
@@ -2,6 +2,7 @@ type HttpClientConfig = {
2
2
  backendUrl?: string;
3
3
  pathPrefix: string;
4
4
  includeCredentials?: boolean;
5
+ headers?: Record<string, string>;
5
6
  };
6
7
  declare const createHttpClient: (config: HttpClientConfig) => {
7
8
  request: <T>({ route, body, method, }: {
@@ -2,6 +2,7 @@ type HttpClientConfig = {
2
2
  backendUrl?: string;
3
3
  pathPrefix: string;
4
4
  includeCredentials?: boolean;
5
+ headers?: Record<string, string>;
5
6
  };
6
7
  declare const createHttpClient: (config: HttpClientConfig) => {
7
8
  request: <T>({ route, body, method, }: {
@@ -49,7 +49,12 @@ var isErrorBody = (body) => {
49
49
  return !!body && typeof body === "object" && "message" in body && "code" in body && "statusCode" in body;
50
50
  };
51
51
  var createHttpClient = (config) => {
52
- const { backendUrl, pathPrefix, includeCredentials } = config;
52
+ const {
53
+ backendUrl,
54
+ pathPrefix,
55
+ includeCredentials,
56
+ headers: customHeaders
57
+ } = config;
53
58
  const baseUrl = backendUrl ? `${backendUrl}${pathPrefix}` : pathPrefix;
54
59
  const request = async ({
55
60
  route,
@@ -57,12 +62,14 @@ var createHttpClient = (config) => {
57
62
  method = "POST"
58
63
  }) => {
59
64
  const url = `${baseUrl}/${route}`;
65
+ const headers = {
66
+ "Content-Type": "application/json",
67
+ ...customHeaders
68
+ };
60
69
  try {
61
70
  const response = await fetch(url, {
62
71
  method,
63
- headers: {
64
- "Content-Type": "application/json"
65
- },
72
+ headers,
66
73
  ...includeCredentials && { credentials: "include" },
67
74
  ...body !== void 0 && { body: JSON.stringify(body) }
68
75
  });
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createHttpClient
4
- } from "../../chunk-M34U5F2H.mjs";
4
+ } from "../../chunk-SCDO26YC.mjs";
5
5
  import "../../chunk-IC3QHWR6.mjs";
6
6
  export {
7
7
  createHttpClient
@@ -62,6 +62,10 @@ type CustomerAutoTopup = {
62
62
  * Optional rate limit to cap how often auto top-ups occur.
63
63
  */
64
64
  purchaseLimit?: CustomerPurchaseLimit | undefined;
65
+ /**
66
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
67
+ */
68
+ invoiceMode?: boolean | undefined;
65
69
  };
66
70
  type CustomerSpendLimit = {
67
71
  /**
@@ -62,6 +62,10 @@ type CustomerAutoTopup = {
62
62
  * Optional rate limit to cap how often auto top-ups occur.
63
63
  */
64
64
  purchaseLimit?: CustomerPurchaseLimit | undefined;
65
+ /**
66
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
67
+ */
68
+ invoiceMode?: boolean | undefined;
65
69
  };
66
70
  type CustomerSpendLimit = {
67
71
  /**
@@ -7,6 +7,6 @@ export { UseListPlansParams, useListPlans } from './useListPlans.mjs';
7
7
  export { UseReferralsParams, UseReferralsResult, useReferrals } from './useReferrals.mjs';
8
8
  import '@tanstack/react-query';
9
9
  import '../client/AutumnClientError.mjs';
10
- import '../params-CheyAQ0-.mjs';
10
+ import '../params-Bj6uyOX1.mjs';
11
11
  import '../plan-CqxFGNk2.mjs';
12
- import '../customer-Bb7J-_p_.mjs';
12
+ import '../customer-DDRi84Zq.mjs';