autumn-js 0.1.20 → 0.1.22

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 (42) hide show
  1. package/dist/libraries/backend/better-auth.d.mts +28 -28
  2. package/dist/libraries/backend/better-auth.d.ts +28 -28
  3. package/dist/libraries/react/AutumnContext.mjs +4 -4
  4. package/dist/libraries/react/BaseAutumnProvider.js +11 -3
  5. package/dist/libraries/react/BaseAutumnProvider.mjs +7 -7
  6. package/dist/libraries/react/ReactAutumnProvider.js +11 -3
  7. package/dist/libraries/react/ReactAutumnProvider.mjs +8 -8
  8. package/dist/libraries/react/{chunk-AKE6UAQS.mjs → chunk-4CO2JIMK.mjs} +1 -1
  9. package/dist/libraries/react/{chunk-FD42XGXU.mjs → chunk-7PEELII6.mjs} +1 -1
  10. package/dist/libraries/react/{chunk-RJSVDPCH.mjs → chunk-BD4NZOEZ.mjs} +1 -1
  11. package/dist/libraries/react/{chunk-4IVY6AXO.mjs → chunk-DKJJ2DGE.mjs} +1 -1
  12. package/dist/libraries/react/{chunk-WFMJOMJP.mjs → chunk-E6XSQQPF.mjs} +3 -3
  13. package/dist/libraries/react/{chunk-XT6MF3ZV.mjs → chunk-JFRVJJIG.mjs} +2 -2
  14. package/dist/libraries/react/{chunk-TMTGUQGT.mjs → chunk-L6LHSFXS.mjs} +2 -2
  15. package/dist/libraries/react/{chunk-5NRXGCQW.mjs → chunk-LJNV3I7J.mjs} +2 -2
  16. package/dist/libraries/react/{chunk-64M53BCF.mjs → chunk-OLXLPM4L.mjs} +2 -2
  17. package/dist/libraries/react/{chunk-LNAQMT6O.mjs → chunk-S5XNNFQO.mjs} +14 -14
  18. package/dist/libraries/react/{chunk-BM36COXS.mjs → chunk-SEFSA357.mjs} +11 -3
  19. package/dist/libraries/react/{chunk-L4FS7ENO.mjs → chunk-T6D3GYIH.mjs} +1 -1
  20. package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -3
  21. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +11 -3
  22. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +18 -18
  23. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +18 -18
  24. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +11 -3
  25. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +18 -18
  26. package/dist/libraries/react/hooks/helpers/handleCheck.js +11 -3
  27. package/dist/libraries/react/hooks/helpers/handleCheck.mjs +1 -1
  28. package/dist/libraries/react/hooks/useAnalytics.mjs +5 -5
  29. package/dist/libraries/react/hooks/useCustomer.js +11 -3
  30. package/dist/libraries/react/hooks/useCustomer.mjs +7 -7
  31. package/dist/libraries/react/hooks/useCustomerBase.js +11 -3
  32. package/dist/libraries/react/hooks/useCustomerBase.mjs +6 -6
  33. package/dist/libraries/react/hooks/useEntity.js +11 -3
  34. package/dist/libraries/react/hooks/useEntity.mjs +7 -7
  35. package/dist/libraries/react/hooks/useEntityBase.js +11 -3
  36. package/dist/libraries/react/hooks/useEntityBase.mjs +6 -6
  37. package/dist/libraries/react/hooks/usePaywall.mjs +5 -5
  38. package/dist/libraries/react/hooks/usePricingTable.mjs +5 -5
  39. package/dist/libraries/react/index.js +11 -3
  40. package/dist/libraries/react/index.mjs +11 -3
  41. package/package.json +1 -1
  42. package/dist/libraries/react/{chunk-2OPGTDRC.mjs → chunk-6VDZ3JMC.mjs} +6 -6
@@ -92,14 +92,15 @@ declare const autumn: (options?: {
92
92
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
93
93
  body: {
94
94
  product_id: string;
95
- entity_id?: string | undefined;
96
95
  options?: {
97
96
  feature_id: string;
98
97
  quantity: number;
99
98
  }[] | undefined;
100
99
  product_ids?: string[] | undefined;
101
- success_url?: string | undefined;
100
+ entity_id?: string | undefined;
102
101
  force_checkout?: boolean | undefined;
102
+ invoice?: boolean | undefined;
103
+ success_url?: string | undefined;
103
104
  customer_data?: {
104
105
  name?: string | null | undefined;
105
106
  email?: string | null | undefined;
@@ -108,7 +109,6 @@ declare const autumn: (options?: {
108
109
  entity_data?: any;
109
110
  checkout_session_params?: Record<string, any> | undefined;
110
111
  reward?: string | undefined;
111
- invoice?: boolean | undefined;
112
112
  };
113
113
  } & {
114
114
  method?: "POST" | undefined;
@@ -135,15 +135,16 @@ declare const autumn: (options?: {
135
135
  options: {
136
136
  method: "POST";
137
137
  body: z.ZodObject<{
138
- entity_id: z.ZodOptional<z.ZodString>;
139
- product_id: z.ZodString;
140
138
  options: z.ZodOptional<z.ZodArray<z.ZodObject<{
141
139
  feature_id: z.ZodString;
142
140
  quantity: z.ZodNumber;
143
141
  }, z.core.$strip>>>;
142
+ product_id: z.ZodString;
144
143
  product_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
145
- success_url: z.ZodOptional<z.ZodString>;
144
+ entity_id: z.ZodOptional<z.ZodString>;
146
145
  force_checkout: z.ZodOptional<z.ZodBoolean>;
146
+ invoice: z.ZodOptional<z.ZodBoolean>;
147
+ success_url: z.ZodOptional<z.ZodString>;
147
148
  customer_data: z.ZodOptional<z.ZodObject<{
148
149
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
150
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -152,7 +153,6 @@ declare const autumn: (options?: {
152
153
  entity_data: z.ZodOptional<z.ZodAny>;
153
154
  checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
154
155
  reward: z.ZodOptional<z.ZodString>;
155
- invoice: z.ZodOptional<z.ZodBoolean>;
156
156
  }, z.core.$strip>;
157
157
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
158
158
  session: {
@@ -185,17 +185,17 @@ declare const autumn: (options?: {
185
185
  attach: {
186
186
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
187
187
  body: {
188
- entity_id?: string | undefined;
189
- metadata?: Record<string, string> | undefined;
190
- product_id?: string | undefined;
191
188
  options?: {
192
189
  feature_id: string;
193
190
  quantity: number;
194
191
  }[] | undefined;
192
+ metadata?: Record<string, string> | undefined;
193
+ product_id?: string | undefined;
195
194
  product_ids?: string[] | undefined;
196
- free_trial?: boolean | undefined;
197
- success_url?: string | undefined;
195
+ entity_id?: string | undefined;
198
196
  force_checkout?: boolean | undefined;
197
+ invoice?: boolean | undefined;
198
+ success_url?: string | undefined;
199
199
  customer_data?: {
200
200
  name?: string | null | undefined;
201
201
  email?: string | null | undefined;
@@ -204,7 +204,7 @@ declare const autumn: (options?: {
204
204
  entity_data?: any;
205
205
  checkout_session_params?: Record<string, any> | undefined;
206
206
  reward?: string | undefined;
207
- invoice?: boolean | undefined;
207
+ free_trial?: boolean | undefined;
208
208
  };
209
209
  } & {
210
210
  method?: "POST" | undefined;
@@ -231,17 +231,17 @@ declare const autumn: (options?: {
231
231
  options: {
232
232
  method: "POST";
233
233
  body: z.ZodObject<{
234
- entity_id: z.ZodOptional<z.ZodString>;
235
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
236
- product_id: z.ZodOptional<z.ZodString>;
237
234
  options: z.ZodOptional<z.ZodArray<z.ZodObject<{
238
235
  feature_id: z.ZodString;
239
236
  quantity: z.ZodNumber;
240
237
  }, z.core.$strip>>>;
238
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
239
+ product_id: z.ZodOptional<z.ZodString>;
241
240
  product_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
242
- free_trial: z.ZodOptional<z.ZodBoolean>;
243
- success_url: z.ZodOptional<z.ZodString>;
241
+ entity_id: z.ZodOptional<z.ZodString>;
244
242
  force_checkout: z.ZodOptional<z.ZodBoolean>;
243
+ invoice: z.ZodOptional<z.ZodBoolean>;
244
+ success_url: z.ZodOptional<z.ZodString>;
245
245
  customer_data: z.ZodOptional<z.ZodObject<{
246
246
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
247
247
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -250,7 +250,7 @@ declare const autumn: (options?: {
250
250
  entity_data: z.ZodOptional<z.ZodAny>;
251
251
  checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
252
252
  reward: z.ZodOptional<z.ZodString>;
253
- invoice: z.ZodOptional<z.ZodBoolean>;
253
+ free_trial: z.ZodOptional<z.ZodBoolean>;
254
254
  }, z.core.$strip>;
255
255
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
256
256
  session: {
@@ -283,15 +283,15 @@ declare const autumn: (options?: {
283
283
  check: {
284
284
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
285
285
  body: {
286
- feature_id?: string | undefined;
287
- entity_id?: string | undefined;
288
- required_balance?: number | undefined;
289
286
  product_id?: string | undefined;
287
+ entity_id?: string | undefined;
288
+ feature_id?: string | undefined;
290
289
  customer_data?: any;
291
290
  entity_data?: {
292
291
  feature_id: string;
293
292
  name?: string | undefined;
294
293
  } | undefined;
294
+ required_balance?: number | undefined;
295
295
  send_event?: boolean | undefined;
296
296
  with_preview?: boolean | undefined;
297
297
  };
@@ -320,15 +320,15 @@ declare const autumn: (options?: {
320
320
  options: {
321
321
  method: "POST";
322
322
  body: z.ZodObject<{
323
- feature_id: z.ZodOptional<z.ZodString>;
324
- entity_id: z.ZodOptional<z.ZodString>;
325
- required_balance: z.ZodOptional<z.ZodNumber>;
326
323
  product_id: z.ZodOptional<z.ZodString>;
324
+ entity_id: z.ZodOptional<z.ZodString>;
325
+ feature_id: z.ZodOptional<z.ZodString>;
327
326
  customer_data: z.ZodOptional<z.ZodAny>;
328
327
  entity_data: z.ZodOptional<z.ZodObject<{
329
328
  name: z.ZodOptional<z.ZodString>;
330
329
  feature_id: z.ZodString;
331
330
  }, z.core.$strip>>;
331
+ required_balance: z.ZodOptional<z.ZodNumber>;
332
332
  send_event: z.ZodOptional<z.ZodBoolean>;
333
333
  with_preview: z.ZodOptional<z.ZodBoolean>;
334
334
  }, z.core.$strip>;
@@ -363,8 +363,8 @@ declare const autumn: (options?: {
363
363
  track: {
364
364
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
365
365
  body: {
366
- feature_id?: string | undefined;
367
366
  entity_id?: string | undefined;
367
+ feature_id?: string | undefined;
368
368
  customer_data?: any;
369
369
  entity_data?: any;
370
370
  value?: number | undefined;
@@ -396,8 +396,8 @@ declare const autumn: (options?: {
396
396
  options: {
397
397
  method: "POST";
398
398
  body: z.ZodObject<{
399
- feature_id: z.ZodOptional<z.ZodString>;
400
399
  entity_id: z.ZodOptional<z.ZodString>;
400
+ feature_id: z.ZodOptional<z.ZodString>;
401
401
  customer_data: z.ZodOptional<z.ZodAny>;
402
402
  entity_data: z.ZodOptional<z.ZodAny>;
403
403
  value: z.ZodOptional<z.ZodNumber>;
@@ -464,8 +464,8 @@ declare const autumn: (options?: {
464
464
  options: {
465
465
  method: "POST";
466
466
  body: z.ZodObject<{
467
- entity_id: z.ZodOptional<z.ZodString>;
468
467
  product_id: z.ZodString;
468
+ entity_id: z.ZodOptional<z.ZodString>;
469
469
  cancel_immediately: z.ZodOptional<z.ZodBoolean>;
470
470
  }, z.core.$strip>;
471
471
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
@@ -92,14 +92,15 @@ declare const autumn: (options?: {
92
92
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
93
93
  body: {
94
94
  product_id: string;
95
- entity_id?: string | undefined;
96
95
  options?: {
97
96
  feature_id: string;
98
97
  quantity: number;
99
98
  }[] | undefined;
100
99
  product_ids?: string[] | undefined;
101
- success_url?: string | undefined;
100
+ entity_id?: string | undefined;
102
101
  force_checkout?: boolean | undefined;
102
+ invoice?: boolean | undefined;
103
+ success_url?: string | undefined;
103
104
  customer_data?: {
104
105
  name?: string | null | undefined;
105
106
  email?: string | null | undefined;
@@ -108,7 +109,6 @@ declare const autumn: (options?: {
108
109
  entity_data?: any;
109
110
  checkout_session_params?: Record<string, any> | undefined;
110
111
  reward?: string | undefined;
111
- invoice?: boolean | undefined;
112
112
  };
113
113
  } & {
114
114
  method?: "POST" | undefined;
@@ -135,15 +135,16 @@ declare const autumn: (options?: {
135
135
  options: {
136
136
  method: "POST";
137
137
  body: z.ZodObject<{
138
- entity_id: z.ZodOptional<z.ZodString>;
139
- product_id: z.ZodString;
140
138
  options: z.ZodOptional<z.ZodArray<z.ZodObject<{
141
139
  feature_id: z.ZodString;
142
140
  quantity: z.ZodNumber;
143
141
  }, z.core.$strip>>>;
142
+ product_id: z.ZodString;
144
143
  product_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
145
- success_url: z.ZodOptional<z.ZodString>;
144
+ entity_id: z.ZodOptional<z.ZodString>;
146
145
  force_checkout: z.ZodOptional<z.ZodBoolean>;
146
+ invoice: z.ZodOptional<z.ZodBoolean>;
147
+ success_url: z.ZodOptional<z.ZodString>;
147
148
  customer_data: z.ZodOptional<z.ZodObject<{
148
149
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
150
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -152,7 +153,6 @@ declare const autumn: (options?: {
152
153
  entity_data: z.ZodOptional<z.ZodAny>;
153
154
  checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
154
155
  reward: z.ZodOptional<z.ZodString>;
155
- invoice: z.ZodOptional<z.ZodBoolean>;
156
156
  }, z.core.$strip>;
157
157
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
158
158
  session: {
@@ -185,17 +185,17 @@ declare const autumn: (options?: {
185
185
  attach: {
186
186
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
187
187
  body: {
188
- entity_id?: string | undefined;
189
- metadata?: Record<string, string> | undefined;
190
- product_id?: string | undefined;
191
188
  options?: {
192
189
  feature_id: string;
193
190
  quantity: number;
194
191
  }[] | undefined;
192
+ metadata?: Record<string, string> | undefined;
193
+ product_id?: string | undefined;
195
194
  product_ids?: string[] | undefined;
196
- free_trial?: boolean | undefined;
197
- success_url?: string | undefined;
195
+ entity_id?: string | undefined;
198
196
  force_checkout?: boolean | undefined;
197
+ invoice?: boolean | undefined;
198
+ success_url?: string | undefined;
199
199
  customer_data?: {
200
200
  name?: string | null | undefined;
201
201
  email?: string | null | undefined;
@@ -204,7 +204,7 @@ declare const autumn: (options?: {
204
204
  entity_data?: any;
205
205
  checkout_session_params?: Record<string, any> | undefined;
206
206
  reward?: string | undefined;
207
- invoice?: boolean | undefined;
207
+ free_trial?: boolean | undefined;
208
208
  };
209
209
  } & {
210
210
  method?: "POST" | undefined;
@@ -231,17 +231,17 @@ declare const autumn: (options?: {
231
231
  options: {
232
232
  method: "POST";
233
233
  body: z.ZodObject<{
234
- entity_id: z.ZodOptional<z.ZodString>;
235
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
236
- product_id: z.ZodOptional<z.ZodString>;
237
234
  options: z.ZodOptional<z.ZodArray<z.ZodObject<{
238
235
  feature_id: z.ZodString;
239
236
  quantity: z.ZodNumber;
240
237
  }, z.core.$strip>>>;
238
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
239
+ product_id: z.ZodOptional<z.ZodString>;
241
240
  product_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
242
- free_trial: z.ZodOptional<z.ZodBoolean>;
243
- success_url: z.ZodOptional<z.ZodString>;
241
+ entity_id: z.ZodOptional<z.ZodString>;
244
242
  force_checkout: z.ZodOptional<z.ZodBoolean>;
243
+ invoice: z.ZodOptional<z.ZodBoolean>;
244
+ success_url: z.ZodOptional<z.ZodString>;
245
245
  customer_data: z.ZodOptional<z.ZodObject<{
246
246
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
247
247
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -250,7 +250,7 @@ declare const autumn: (options?: {
250
250
  entity_data: z.ZodOptional<z.ZodAny>;
251
251
  checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
252
252
  reward: z.ZodOptional<z.ZodString>;
253
- invoice: z.ZodOptional<z.ZodBoolean>;
253
+ free_trial: z.ZodOptional<z.ZodBoolean>;
254
254
  }, z.core.$strip>;
255
255
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
256
256
  session: {
@@ -283,15 +283,15 @@ declare const autumn: (options?: {
283
283
  check: {
284
284
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
285
285
  body: {
286
- feature_id?: string | undefined;
287
- entity_id?: string | undefined;
288
- required_balance?: number | undefined;
289
286
  product_id?: string | undefined;
287
+ entity_id?: string | undefined;
288
+ feature_id?: string | undefined;
290
289
  customer_data?: any;
291
290
  entity_data?: {
292
291
  feature_id: string;
293
292
  name?: string | undefined;
294
293
  } | undefined;
294
+ required_balance?: number | undefined;
295
295
  send_event?: boolean | undefined;
296
296
  with_preview?: boolean | undefined;
297
297
  };
@@ -320,15 +320,15 @@ declare const autumn: (options?: {
320
320
  options: {
321
321
  method: "POST";
322
322
  body: z.ZodObject<{
323
- feature_id: z.ZodOptional<z.ZodString>;
324
- entity_id: z.ZodOptional<z.ZodString>;
325
- required_balance: z.ZodOptional<z.ZodNumber>;
326
323
  product_id: z.ZodOptional<z.ZodString>;
324
+ entity_id: z.ZodOptional<z.ZodString>;
325
+ feature_id: z.ZodOptional<z.ZodString>;
327
326
  customer_data: z.ZodOptional<z.ZodAny>;
328
327
  entity_data: z.ZodOptional<z.ZodObject<{
329
328
  name: z.ZodOptional<z.ZodString>;
330
329
  feature_id: z.ZodString;
331
330
  }, z.core.$strip>>;
331
+ required_balance: z.ZodOptional<z.ZodNumber>;
332
332
  send_event: z.ZodOptional<z.ZodBoolean>;
333
333
  with_preview: z.ZodOptional<z.ZodBoolean>;
334
334
  }, z.core.$strip>;
@@ -363,8 +363,8 @@ declare const autumn: (options?: {
363
363
  track: {
364
364
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
365
365
  body: {
366
- feature_id?: string | undefined;
367
366
  entity_id?: string | undefined;
367
+ feature_id?: string | undefined;
368
368
  customer_data?: any;
369
369
  entity_data?: any;
370
370
  value?: number | undefined;
@@ -396,8 +396,8 @@ declare const autumn: (options?: {
396
396
  options: {
397
397
  method: "POST";
398
398
  body: z.ZodObject<{
399
- feature_id: z.ZodOptional<z.ZodString>;
400
399
  entity_id: z.ZodOptional<z.ZodString>;
400
+ feature_id: z.ZodOptional<z.ZodString>;
401
401
  customer_data: z.ZodOptional<z.ZodAny>;
402
402
  entity_data: z.ZodOptional<z.ZodAny>;
403
403
  value: z.ZodOptional<z.ZodNumber>;
@@ -464,8 +464,8 @@ declare const autumn: (options?: {
464
464
  options: {
465
465
  method: "POST";
466
466
  body: z.ZodObject<{
467
- entity_id: z.ZodOptional<z.ZodString>;
468
467
  product_id: z.ZodString;
468
+ entity_id: z.ZodOptional<z.ZodString>;
469
469
  cancel_immediately: z.ZodOptional<z.ZodBoolean>;
470
470
  }, z.core.$strip>;
471
471
  use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  AutumnContext,
5
5
  useAutumnContext
6
- } from "./chunk-RJSVDPCH.mjs";
7
- import "./chunk-2OPGTDRC.mjs";
6
+ } from "./chunk-BD4NZOEZ.mjs";
7
+ import "./chunk-6VDZ3JMC.mjs";
8
+ import "./chunk-JVCOY7ZL.mjs";
9
+ import "./chunk-CIBQ4BJU.mjs";
8
10
  import "./chunk-ABJEE3UK.mjs";
9
11
  import "./chunk-V575SGOW.mjs";
10
12
  import "./chunk-ZV4RPZTM.mjs";
11
- import "./chunk-JVCOY7ZL.mjs";
12
- import "./chunk-CIBQ4BJU.mjs";
13
13
  import "./chunk-VTGR7VVK.mjs";
14
14
  import "./chunk-WFFVOEUG.mjs";
15
15
  import "./chunk-ZF2HUCN6.mjs";
@@ -1679,6 +1679,13 @@ var getCusFeature = ({
1679
1679
  featureId,
1680
1680
  requiredBalance = 1
1681
1681
  }) => {
1682
+ let cusFeature = customer.features[featureId];
1683
+ if (cusFeature && typeof cusFeature.balance === "number" && cusFeature.balance >= (requiredBalance ?? 1)) {
1684
+ return {
1685
+ cusFeature,
1686
+ requiredBalance
1687
+ };
1688
+ }
1682
1689
  let creditSchema = Object.values(customer.features).find(
1683
1690
  (f) => f.credit_schema && f.credit_schema.some((c) => c.feature_id === featureId)
1684
1691
  );
@@ -1687,7 +1694,7 @@ var getCusFeature = ({
1687
1694
  (c) => c.feature_id === featureId
1688
1695
  );
1689
1696
  return {
1690
- feature: creditSchema,
1697
+ cusFeature: creditSchema,
1691
1698
  requiredBalance: schemaItem.credit_amount * requiredBalance
1692
1699
  };
1693
1700
  }
@@ -1716,12 +1723,13 @@ var handleFeatureCheck = ({
1716
1723
  }) => {
1717
1724
  let { cusFeature, requiredBalance } = getCusFeature({
1718
1725
  customer,
1719
- featureId: params.featureId
1726
+ featureId: params.featureId,
1727
+ ...params.requiredBalance ? { requiredBalance: params.requiredBalance } : {}
1720
1728
  });
1721
1729
  let allowed = getFeatureAllowed({ cusFeature, requiredBalance });
1722
1730
  let result = {
1723
1731
  allowed,
1724
- feature_id: params.featureId,
1732
+ feature_id: cusFeature?.id ?? params.featureId,
1725
1733
  customer_id: isEntity ? customer.customer_id : customer.id,
1726
1734
  required_balance: requiredBalance,
1727
1735
  ...cusFeature
@@ -3,19 +3,19 @@
3
3
  "use client";
4
4
  import {
5
5
  BaseAutumnProvider
6
- } from "./chunk-4IVY6AXO.mjs";
6
+ } from "./chunk-DKJJ2DGE.mjs";
7
7
  import "./chunk-RFSQBGLO.mjs";
8
- import "./chunk-64M53BCF.mjs";
9
- import "./chunk-BM36COXS.mjs";
8
+ import "./chunk-OLXLPM4L.mjs";
9
+ import "./chunk-SEFSA357.mjs";
10
10
  import "./chunk-NFVAFRF6.mjs";
11
11
  import "./chunk-HBJDIEEJ.mjs";
12
- import "./chunk-RJSVDPCH.mjs";
13
- import "./chunk-2OPGTDRC.mjs";
12
+ import "./chunk-BD4NZOEZ.mjs";
13
+ import "./chunk-6VDZ3JMC.mjs";
14
+ import "./chunk-JVCOY7ZL.mjs";
15
+ import "./chunk-CIBQ4BJU.mjs";
14
16
  import "./chunk-ABJEE3UK.mjs";
15
17
  import "./chunk-V575SGOW.mjs";
16
18
  import "./chunk-ZV4RPZTM.mjs";
17
- import "./chunk-JVCOY7ZL.mjs";
18
- import "./chunk-CIBQ4BJU.mjs";
19
19
  import "./chunk-VTGR7VVK.mjs";
20
20
  import "./chunk-WFFVOEUG.mjs";
21
21
  import "./chunk-ZF2HUCN6.mjs";
@@ -1680,6 +1680,13 @@ var getCusFeature = ({
1680
1680
  featureId,
1681
1681
  requiredBalance = 1
1682
1682
  }) => {
1683
+ let cusFeature = customer.features[featureId];
1684
+ if (cusFeature && typeof cusFeature.balance === "number" && cusFeature.balance >= (requiredBalance ?? 1)) {
1685
+ return {
1686
+ cusFeature,
1687
+ requiredBalance
1688
+ };
1689
+ }
1683
1690
  let creditSchema = Object.values(customer.features).find(
1684
1691
  (f) => f.credit_schema && f.credit_schema.some((c) => c.feature_id === featureId)
1685
1692
  );
@@ -1688,7 +1695,7 @@ var getCusFeature = ({
1688
1695
  (c) => c.feature_id === featureId
1689
1696
  );
1690
1697
  return {
1691
- feature: creditSchema,
1698
+ cusFeature: creditSchema,
1692
1699
  requiredBalance: schemaItem.credit_amount * requiredBalance
1693
1700
  };
1694
1701
  }
@@ -1717,12 +1724,13 @@ var handleFeatureCheck = ({
1717
1724
  }) => {
1718
1725
  let { cusFeature, requiredBalance } = getCusFeature({
1719
1726
  customer,
1720
- featureId: params.featureId
1727
+ featureId: params.featureId,
1728
+ ...params.requiredBalance ? { requiredBalance: params.requiredBalance } : {}
1721
1729
  });
1722
1730
  let allowed = getFeatureAllowed({ cusFeature, requiredBalance });
1723
1731
  let result = {
1724
1732
  allowed,
1725
- feature_id: params.featureId,
1733
+ feature_id: cusFeature?.id ?? params.featureId,
1726
1734
  customer_id: isEntity ? customer.customer_id : customer.id,
1727
1735
  required_balance: requiredBalance,
1728
1736
  ...cusFeature
@@ -2,20 +2,20 @@
2
2
 
3
3
  import {
4
4
  ReactAutumnProvider
5
- } from "./chunk-WFMJOMJP.mjs";
6
- import "./chunk-4IVY6AXO.mjs";
5
+ } from "./chunk-E6XSQQPF.mjs";
6
+ import "./chunk-DKJJ2DGE.mjs";
7
7
  import "./chunk-RFSQBGLO.mjs";
8
- import "./chunk-64M53BCF.mjs";
9
- import "./chunk-BM36COXS.mjs";
8
+ import "./chunk-OLXLPM4L.mjs";
9
+ import "./chunk-SEFSA357.mjs";
10
10
  import "./chunk-NFVAFRF6.mjs";
11
11
  import "./chunk-HBJDIEEJ.mjs";
12
- import "./chunk-RJSVDPCH.mjs";
13
- import "./chunk-2OPGTDRC.mjs";
12
+ import "./chunk-BD4NZOEZ.mjs";
13
+ import "./chunk-6VDZ3JMC.mjs";
14
+ import "./chunk-JVCOY7ZL.mjs";
15
+ import "./chunk-CIBQ4BJU.mjs";
14
16
  import "./chunk-ABJEE3UK.mjs";
15
17
  import "./chunk-V575SGOW.mjs";
16
18
  import "./chunk-ZV4RPZTM.mjs";
17
- import "./chunk-JVCOY7ZL.mjs";
18
- import "./chunk-CIBQ4BJU.mjs";
19
19
  import "./chunk-VTGR7VVK.mjs";
20
20
  import "./chunk-WFFVOEUG.mjs";
21
21
  import "./chunk-ZF2HUCN6.mjs";
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  AutumnContext,
5
5
  useAutumnContext
6
- } from "./chunk-RJSVDPCH.mjs";
6
+ } from "./chunk-BD4NZOEZ.mjs";
7
7
  import {
8
8
  AutumnError
9
9
  } from "./chunk-ABJEE3UK.mjs";
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  AutumnContext,
8
8
  useAutumnContext
9
- } from "./chunk-RJSVDPCH.mjs";
9
+ } from "./chunk-BD4NZOEZ.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
  AutumnClient
5
- } from "./chunk-2OPGTDRC.mjs";
5
+ } from "./chunk-6VDZ3JMC.mjs";
6
6
 
7
7
  // src/libraries/react/AutumnContext.tsx
8
8
  import { createContext, useContext } from "react";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-RFSQBGLO.mjs";
6
6
  import {
7
7
  useCustomerBase
8
- } from "./chunk-64M53BCF.mjs";
8
+ } from "./chunk-OLXLPM4L.mjs";
9
9
 
10
10
  // src/libraries/react/BaseAutumnProvider.tsx
11
11
  import { useRef } from "react";
@@ -2,13 +2,13 @@
2
2
 
3
3
  import {
4
4
  BaseAutumnProvider
5
- } from "./chunk-4IVY6AXO.mjs";
5
+ } from "./chunk-DKJJ2DGE.mjs";
6
6
  import {
7
7
  AutumnContext
8
- } from "./chunk-RJSVDPCH.mjs";
8
+ } from "./chunk-BD4NZOEZ.mjs";
9
9
  import {
10
10
  AutumnClient
11
- } from "./chunk-2OPGTDRC.mjs";
11
+ } from "./chunk-6VDZ3JMC.mjs";
12
12
 
13
13
  // src/libraries/react/ReactAutumnProvider.tsx
14
14
  import { jsx } from "react/jsx-runtime";
@@ -2,10 +2,10 @@
2
2
 
3
3
  import {
4
4
  useEntityBase
5
- } from "./chunk-TMTGUQGT.mjs";
5
+ } from "./chunk-L6LHSFXS.mjs";
6
6
  import {
7
7
  AutumnContext
8
- } from "./chunk-RJSVDPCH.mjs";
8
+ } from "./chunk-BD4NZOEZ.mjs";
9
9
 
10
10
  // src/libraries/react/hooks/useEntity.tsx
11
11
  var useEntity = (entityId, params) => {
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  handleCheck,
5
5
  openDialog
6
- } from "./chunk-BM36COXS.mjs";
6
+ } from "./chunk-SEFSA357.mjs";
7
7
  import {
8
8
  useAutumnBase
9
9
  } from "./chunk-NFVAFRF6.mjs";
10
10
  import {
11
11
  useAutumnContext
12
- } from "./chunk-RJSVDPCH.mjs";
12
+ } from "./chunk-BD4NZOEZ.mjs";
13
13
 
14
14
  // src/libraries/react/hooks/useEntityBase.tsx
15
15
  import useSWR from "swr";
@@ -2,10 +2,10 @@
2
2
 
3
3
  import {
4
4
  useCustomerBase
5
- } from "./chunk-64M53BCF.mjs";
5
+ } from "./chunk-OLXLPM4L.mjs";
6
6
  import {
7
7
  AutumnContext
8
- } from "./chunk-RJSVDPCH.mjs";
8
+ } from "./chunk-BD4NZOEZ.mjs";
9
9
 
10
10
  // src/libraries/react/hooks/useCustomer.tsx
11
11
  var useCustomer = (params) => {
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  handleCheck,
5
5
  openDialog
6
- } from "./chunk-BM36COXS.mjs";
6
+ } from "./chunk-SEFSA357.mjs";
7
7
  import {
8
8
  useAutumnBase
9
9
  } from "./chunk-NFVAFRF6.mjs";
10
10
  import {
11
11
  useAutumnContext
12
- } from "./chunk-RJSVDPCH.mjs";
12
+ } from "./chunk-BD4NZOEZ.mjs";
13
13
 
14
14
  // src/libraries/react/hooks/useCustomerBase.tsx
15
15
  import useSWR from "swr";