autumn-js 0.0.116 → 0.1.0

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 (119) hide show
  1. package/dist/libraries/backend/better-auth.d.mts +18 -18
  2. package/dist/libraries/backend/better-auth.d.ts +18 -18
  3. package/dist/libraries/backend/convex.d.mts +1 -0
  4. package/dist/libraries/backend/convex.d.ts +1 -0
  5. package/dist/libraries/backend/convex.js +7 -5
  6. package/dist/libraries/backend/convex.mjs +7 -5
  7. package/dist/libraries/backend/elysia.d.mts +3 -3
  8. package/dist/libraries/backend/elysia.d.ts +3 -3
  9. package/dist/libraries/backend/elysia.js +50 -9
  10. package/dist/libraries/backend/elysia.mjs +51 -8
  11. package/dist/libraries/backend/express.d.mts +1 -1
  12. package/dist/libraries/backend/express.d.ts +1 -1
  13. package/dist/libraries/backend/index.d.mts +1 -1
  14. package/dist/libraries/backend/index.d.ts +1 -1
  15. package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
  16. package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
  17. package/dist/libraries/react/AutumnContext.d.mts +6 -6
  18. package/dist/libraries/react/AutumnContext.d.ts +6 -6
  19. package/dist/libraries/react/BaseAutumnProvider.d.mts +6 -6
  20. package/dist/libraries/react/BaseAutumnProvider.d.ts +6 -6
  21. package/dist/libraries/react/BaseAutumnProvider.js +2 -1
  22. package/dist/libraries/react/BaseAutumnProvider.mjs +2 -2
  23. package/dist/libraries/react/{ReactAutumnClient-DooIpMm0.d.mts → ReactAutumnClient-BK3wjb-u.d.mts} +18 -18
  24. package/dist/libraries/react/{ReactAutumnClient-5mFEwitR.d.ts → ReactAutumnClient-Bh0Sgw6f.d.ts} +18 -18
  25. package/dist/libraries/react/ReactAutumnProvider.d.mts +2 -2
  26. package/dist/libraries/react/ReactAutumnProvider.d.ts +2 -2
  27. package/dist/libraries/react/ReactAutumnProvider.js +2 -1
  28. package/dist/libraries/react/ReactAutumnProvider.mjs +3 -3
  29. package/dist/libraries/react/{attachTypes-CSutLgVn.d.ts → attachTypes-Cy6WgUas.d.ts} +7 -7
  30. package/dist/libraries/react/{attachTypes-By0coJIV.d.mts → attachTypes-DKmoXHQO.d.mts} +7 -7
  31. package/dist/libraries/react/{chunk-AXHU3KAH.mjs → chunk-4NCB2TMQ.mjs} +1 -1
  32. package/dist/libraries/react/{chunk-EXUNRZTP.mjs → chunk-53HYUF2F.mjs} +2 -1
  33. package/dist/libraries/react/{chunk-77DMPCGK.mjs → chunk-BGLWB5O2.mjs} +4 -4
  34. package/dist/libraries/react/{chunk-QJJC6MB3.mjs → chunk-JLJPPCQJ.mjs} +1 -1
  35. package/dist/libraries/react/{chunk-MPA65MFU.mjs → chunk-TM3NBNVM.mjs} +1 -1
  36. package/dist/libraries/react/client/ReactAutumnClient.d.mts +6 -6
  37. package/dist/libraries/react/client/ReactAutumnClient.d.ts +6 -6
  38. package/dist/libraries/react/client/clientCompMethods.d.mts +6 -6
  39. package/dist/libraries/react/client/clientCompMethods.d.ts +6 -6
  40. package/dist/libraries/react/client/clientCusMethods.d.mts +6 -6
  41. package/dist/libraries/react/client/clientCusMethods.d.ts +6 -6
  42. package/dist/libraries/react/client/clientEntityMethods.d.mts +6 -6
  43. package/dist/libraries/react/client/clientEntityMethods.d.ts +6 -6
  44. package/dist/libraries/react/client/clientGenMethods.d.mts +6 -6
  45. package/dist/libraries/react/client/clientGenMethods.d.ts +6 -6
  46. package/dist/libraries/react/client/clientProdMethods.d.mts +6 -6
  47. package/dist/libraries/react/client/clientProdMethods.d.ts +6 -6
  48. package/dist/libraries/react/client/clientReferralMethods.d.mts +6 -6
  49. package/dist/libraries/react/client/clientReferralMethods.d.ts +6 -6
  50. package/dist/libraries/react/client/types/clientAttachTypes.d.mts +20 -20
  51. package/dist/libraries/react/client/types/clientAttachTypes.d.ts +20 -20
  52. package/dist/libraries/react/client/types/clientGenTypes.d.mts +4 -4
  53. package/dist/libraries/react/client/types/clientGenTypes.d.ts +4 -4
  54. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.mts +2 -2
  55. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.ts +2 -2
  56. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +2 -1
  57. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +6 -6
  58. package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.mts +2 -2
  59. package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.ts +2 -2
  60. package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.mts +1 -1
  61. package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.ts +1 -1
  62. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +6 -6
  63. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +1 -1
  64. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +1 -1
  65. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
  66. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
  67. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +2 -1
  68. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +6 -6
  69. package/dist/libraries/react/components/ui/button.d.mts +1 -1
  70. package/dist/libraries/react/components/ui/button.d.ts +1 -1
  71. package/dist/libraries/react/{cusTypes-Bbmd8V3j.d.mts → cusTypes-Dlt0fQmq.d.mts} +7 -7
  72. package/dist/libraries/react/{cusTypes-d_DR9uFs.d.ts → cusTypes-eNmWJ2rC.d.ts} +7 -7
  73. package/dist/libraries/react/{entTypes-B2DgO6PV.d.mts → entTypes-BDZUfZE_.d.mts} +1 -1
  74. package/dist/libraries/react/{entTypes-D6eoGCKH.d.ts → entTypes-B_DvaeRL.d.ts} +1 -1
  75. package/dist/libraries/react/{genTypes-C2VFQqmX.d.mts → genTypes-BIPS92_Q.d.mts} +5 -5
  76. package/dist/libraries/react/{genTypes-BNXXZTFn.d.ts → genTypes-Rn-oq2sc.d.ts} +5 -5
  77. package/dist/libraries/react/hooks/helpers/handleCheck.d.mts +6 -6
  78. package/dist/libraries/react/hooks/helpers/handleCheck.d.ts +6 -6
  79. package/dist/libraries/react/hooks/helpers/useAutumnBase.d.mts +7 -7
  80. package/dist/libraries/react/hooks/helpers/useAutumnBase.d.ts +7 -7
  81. package/dist/libraries/react/hooks/useAnalytics.d.mts +2 -2
  82. package/dist/libraries/react/hooks/useAnalytics.d.ts +2 -2
  83. package/dist/libraries/react/hooks/useCustomer.d.mts +6 -6
  84. package/dist/libraries/react/hooks/useCustomer.d.ts +6 -6
  85. package/dist/libraries/react/hooks/useCustomer.js +2 -1
  86. package/dist/libraries/react/hooks/useCustomer.mjs +2 -2
  87. package/dist/libraries/react/hooks/useCustomerBase.d.mts +6 -6
  88. package/dist/libraries/react/hooks/useCustomerBase.d.ts +6 -6
  89. package/dist/libraries/react/hooks/useCustomerBase.js +2 -1
  90. package/dist/libraries/react/hooks/useCustomerBase.mjs +1 -1
  91. package/dist/libraries/react/hooks/useEntity.d.mts +6 -6
  92. package/dist/libraries/react/hooks/useEntity.d.ts +6 -6
  93. package/dist/libraries/react/hooks/useEntityBase.d.mts +8 -8
  94. package/dist/libraries/react/hooks/useEntityBase.d.ts +8 -8
  95. package/dist/libraries/react/hooks/usePaywall.d.mts +1 -1
  96. package/dist/libraries/react/hooks/usePaywall.d.ts +1 -1
  97. package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
  98. package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
  99. package/dist/libraries/react/hooks/usePricingTableBase.d.mts +6 -6
  100. package/dist/libraries/react/hooks/usePricingTableBase.d.ts +6 -6
  101. package/dist/libraries/react/hooks/useProductsBase.d.mts +6 -6
  102. package/dist/libraries/react/hooks/useProductsBase.d.ts +6 -6
  103. package/dist/libraries/react/index.js +2 -1
  104. package/dist/libraries/react/index.mjs +2 -1
  105. package/dist/next/server/auth/withNextAuth.d.mts +1 -1
  106. package/dist/next/server/auth/withNextAuth.d.ts +1 -1
  107. package/dist/next/server/componentActions.d.mts +1 -1
  108. package/dist/next/server/componentActions.d.ts +1 -1
  109. package/dist/next/server/cusActions.d.mts +15 -15
  110. package/dist/next/server/cusActions.d.ts +15 -15
  111. package/dist/next/server/genActions.d.mts +1 -1
  112. package/dist/next/server/genActions.d.ts +1 -1
  113. package/package.json +7 -4
  114. package/dist/libraries/backend/{referralTypes-DXhjwazw.d.ts → referralTypes-DHs1hY4_.d.ts} +35 -35
  115. package/dist/libraries/backend/{referralTypes-Dxn4bOpT.d.mts → referralTypes-DRsv8not.d.mts} +35 -35
  116. package/dist/libraries/react/{prodTypes-B3iWy6kz.d.mts → prodTypes-DuLXGCiA.d.mts} +2 -2
  117. package/dist/libraries/react/{prodTypes-B3iWy6kz.d.ts → prodTypes-DuLXGCiA.d.ts} +2 -2
  118. package/dist/next/server/{cusTypes-MnneoF1F.d.ts → cusTypes-B0zde-Pl.d.mts} +4 -4
  119. package/dist/next/server/{cusTypes-MnneoF1F.d.mts → cusTypes-B0zde-Pl.d.ts} +4 -4
@@ -130,13 +130,13 @@ declare const autumn: (options?: {
130
130
  attach: {
131
131
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
132
132
  body: {
133
+ entity_id?: string | undefined;
133
134
  options?: {
134
135
  feature_id: string;
135
136
  quantity: number;
136
137
  }[] | undefined;
137
138
  metadata?: Record<string, string> | undefined;
138
139
  product_id?: string | undefined;
139
- entity_id?: string | undefined;
140
140
  product_ids?: string[] | undefined;
141
141
  free_trial?: boolean | undefined;
142
142
  success_url?: string | undefined;
@@ -210,13 +210,13 @@ declare const autumn: (options?: {
210
210
  checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
211
211
  reward: z.ZodOptional<z.ZodString>;
212
212
  }, "customer_id">, "strip", z.ZodTypeAny, {
213
+ entity_id?: string | undefined;
213
214
  options?: {
214
215
  feature_id: string;
215
216
  quantity: number;
216
217
  }[] | undefined;
217
218
  metadata?: Record<string, string> | undefined;
218
219
  product_id?: string | undefined;
219
- entity_id?: string | undefined;
220
220
  product_ids?: string[] | undefined;
221
221
  free_trial?: boolean | undefined;
222
222
  success_url?: string | undefined;
@@ -230,13 +230,13 @@ declare const autumn: (options?: {
230
230
  checkout_session_params?: Record<string, any> | undefined;
231
231
  reward?: string | undefined;
232
232
  }, {
233
+ entity_id?: string | undefined;
233
234
  options?: {
234
235
  feature_id: string;
235
236
  quantity: number;
236
237
  }[] | undefined;
237
238
  metadata?: Record<string, string> | undefined;
238
239
  product_id?: string | undefined;
239
- entity_id?: string | undefined;
240
240
  product_ids?: string[] | undefined;
241
241
  free_trial?: boolean | undefined;
242
242
  success_url?: string | undefined;
@@ -281,15 +281,15 @@ declare const autumn: (options?: {
281
281
  check: {
282
282
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
283
283
  body: {
284
- product_id?: string | undefined;
285
- entity_id?: string | undefined;
286
284
  feature_id?: string | undefined;
285
+ entity_id?: string | undefined;
286
+ required_balance?: number | undefined;
287
+ product_id?: string | undefined;
287
288
  customer_data?: any;
288
289
  entity_data?: {
289
290
  feature_id: string;
290
291
  name?: string | undefined;
291
292
  } | undefined;
292
- required_balance?: number | undefined;
293
293
  send_event?: boolean | undefined;
294
294
  with_preview?: boolean | undefined;
295
295
  };
@@ -337,27 +337,27 @@ declare const autumn: (options?: {
337
337
  name?: string | undefined;
338
338
  }>>;
339
339
  }, "customer_id">, "strip", z.ZodTypeAny, {
340
- product_id?: string | undefined;
341
- entity_id?: string | undefined;
342
340
  feature_id?: string | undefined;
341
+ entity_id?: string | undefined;
342
+ required_balance?: number | undefined;
343
+ product_id?: string | undefined;
343
344
  customer_data?: any;
344
345
  entity_data?: {
345
346
  feature_id: string;
346
347
  name?: string | undefined;
347
348
  } | undefined;
348
- required_balance?: number | undefined;
349
349
  send_event?: boolean | undefined;
350
350
  with_preview?: boolean | undefined;
351
351
  }, {
352
- product_id?: string | undefined;
353
- entity_id?: string | undefined;
354
352
  feature_id?: string | undefined;
353
+ entity_id?: string | undefined;
354
+ required_balance?: number | undefined;
355
+ product_id?: string | undefined;
355
356
  customer_data?: any;
356
357
  entity_data?: {
357
358
  feature_id: string;
358
359
  name?: string | undefined;
359
360
  } | undefined;
360
- required_balance?: number | undefined;
361
361
  send_event?: boolean | undefined;
362
362
  with_preview?: boolean | undefined;
363
363
  }>;
@@ -392,9 +392,9 @@ declare const autumn: (options?: {
392
392
  track: {
393
393
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
394
394
  body: {
395
- value?: number | undefined;
396
- entity_id?: string | undefined;
397
395
  feature_id?: string | undefined;
396
+ entity_id?: string | undefined;
397
+ value?: number | undefined;
398
398
  customer_data?: any;
399
399
  entity_data?: any;
400
400
  event_name?: string | undefined;
@@ -434,17 +434,17 @@ declare const autumn: (options?: {
434
434
  idempotency_key: z.ZodOptional<z.ZodString>;
435
435
  entity_data: z.ZodOptional<z.ZodAny>;
436
436
  }, "customer_id">, "strip", z.ZodTypeAny, {
437
- value?: number | undefined;
438
- entity_id?: string | undefined;
439
437
  feature_id?: string | undefined;
438
+ entity_id?: string | undefined;
439
+ value?: number | undefined;
440
440
  customer_data?: any;
441
441
  entity_data?: any;
442
442
  event_name?: string | undefined;
443
443
  idempotency_key?: string | undefined;
444
444
  }, {
445
- value?: number | undefined;
446
- entity_id?: string | undefined;
447
445
  feature_id?: string | undefined;
446
+ entity_id?: string | undefined;
447
+ value?: number | undefined;
448
448
  customer_data?: any;
449
449
  entity_data?: any;
450
450
  event_name?: string | undefined;
@@ -130,13 +130,13 @@ declare const autumn: (options?: {
130
130
  attach: {
131
131
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
132
132
  body: {
133
+ entity_id?: string | undefined;
133
134
  options?: {
134
135
  feature_id: string;
135
136
  quantity: number;
136
137
  }[] | undefined;
137
138
  metadata?: Record<string, string> | undefined;
138
139
  product_id?: string | undefined;
139
- entity_id?: string | undefined;
140
140
  product_ids?: string[] | undefined;
141
141
  free_trial?: boolean | undefined;
142
142
  success_url?: string | undefined;
@@ -210,13 +210,13 @@ declare const autumn: (options?: {
210
210
  checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
211
211
  reward: z.ZodOptional<z.ZodString>;
212
212
  }, "customer_id">, "strip", z.ZodTypeAny, {
213
+ entity_id?: string | undefined;
213
214
  options?: {
214
215
  feature_id: string;
215
216
  quantity: number;
216
217
  }[] | undefined;
217
218
  metadata?: Record<string, string> | undefined;
218
219
  product_id?: string | undefined;
219
- entity_id?: string | undefined;
220
220
  product_ids?: string[] | undefined;
221
221
  free_trial?: boolean | undefined;
222
222
  success_url?: string | undefined;
@@ -230,13 +230,13 @@ declare const autumn: (options?: {
230
230
  checkout_session_params?: Record<string, any> | undefined;
231
231
  reward?: string | undefined;
232
232
  }, {
233
+ entity_id?: string | undefined;
233
234
  options?: {
234
235
  feature_id: string;
235
236
  quantity: number;
236
237
  }[] | undefined;
237
238
  metadata?: Record<string, string> | undefined;
238
239
  product_id?: string | undefined;
239
- entity_id?: string | undefined;
240
240
  product_ids?: string[] | undefined;
241
241
  free_trial?: boolean | undefined;
242
242
  success_url?: string | undefined;
@@ -281,15 +281,15 @@ declare const autumn: (options?: {
281
281
  check: {
282
282
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
283
283
  body: {
284
- product_id?: string | undefined;
285
- entity_id?: string | undefined;
286
284
  feature_id?: string | undefined;
285
+ entity_id?: string | undefined;
286
+ required_balance?: number | undefined;
287
+ product_id?: string | undefined;
287
288
  customer_data?: any;
288
289
  entity_data?: {
289
290
  feature_id: string;
290
291
  name?: string | undefined;
291
292
  } | undefined;
292
- required_balance?: number | undefined;
293
293
  send_event?: boolean | undefined;
294
294
  with_preview?: boolean | undefined;
295
295
  };
@@ -337,27 +337,27 @@ declare const autumn: (options?: {
337
337
  name?: string | undefined;
338
338
  }>>;
339
339
  }, "customer_id">, "strip", z.ZodTypeAny, {
340
- product_id?: string | undefined;
341
- entity_id?: string | undefined;
342
340
  feature_id?: string | undefined;
341
+ entity_id?: string | undefined;
342
+ required_balance?: number | undefined;
343
+ product_id?: string | undefined;
343
344
  customer_data?: any;
344
345
  entity_data?: {
345
346
  feature_id: string;
346
347
  name?: string | undefined;
347
348
  } | undefined;
348
- required_balance?: number | undefined;
349
349
  send_event?: boolean | undefined;
350
350
  with_preview?: boolean | undefined;
351
351
  }, {
352
- product_id?: string | undefined;
353
- entity_id?: string | undefined;
354
352
  feature_id?: string | undefined;
353
+ entity_id?: string | undefined;
354
+ required_balance?: number | undefined;
355
+ product_id?: string | undefined;
355
356
  customer_data?: any;
356
357
  entity_data?: {
357
358
  feature_id: string;
358
359
  name?: string | undefined;
359
360
  } | undefined;
360
- required_balance?: number | undefined;
361
361
  send_event?: boolean | undefined;
362
362
  with_preview?: boolean | undefined;
363
363
  }>;
@@ -392,9 +392,9 @@ declare const autumn: (options?: {
392
392
  track: {
393
393
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
394
394
  body: {
395
- value?: number | undefined;
396
- entity_id?: string | undefined;
397
395
  feature_id?: string | undefined;
396
+ entity_id?: string | undefined;
397
+ value?: number | undefined;
398
398
  customer_data?: any;
399
399
  entity_data?: any;
400
400
  event_name?: string | undefined;
@@ -434,17 +434,17 @@ declare const autumn: (options?: {
434
434
  idempotency_key: z.ZodOptional<z.ZodString>;
435
435
  entity_data: z.ZodOptional<z.ZodAny>;
436
436
  }, "customer_id">, "strip", z.ZodTypeAny, {
437
- value?: number | undefined;
438
- entity_id?: string | undefined;
439
437
  feature_id?: string | undefined;
438
+ entity_id?: string | undefined;
439
+ value?: number | undefined;
440
440
  customer_data?: any;
441
441
  entity_data?: any;
442
442
  event_name?: string | undefined;
443
443
  idempotency_key?: string | undefined;
444
444
  }, {
445
- value?: number | undefined;
446
- entity_id?: string | undefined;
447
445
  feature_id?: string | undefined;
446
+ entity_id?: string | undefined;
447
+ value?: number | undefined;
448
448
  customer_data?: any;
449
449
  entity_data?: any;
450
450
  event_name?: string | undefined;
@@ -5,6 +5,7 @@ declare function autumnHandler(options: {
5
5
  identify: (ctx: any, request: any) => AuthResult;
6
6
  url?: string;
7
7
  secretKey?: string;
8
+ clientOrigin?: string;
8
9
  }): any;
9
10
 
10
11
  export { autumnHandler };
@@ -5,6 +5,7 @@ declare function autumnHandler(options: {
5
5
  identify: (ctx: any, request: any) => AuthResult;
6
6
  url?: string;
7
7
  secretKey?: string;
8
+ clientOrigin?: string;
8
9
  }): any;
9
10
 
10
11
  export { autumnHandler };
@@ -1160,10 +1160,11 @@ function autumnHandler(options) {
1160
1160
  if (headers.get("Origin") !== null && headers.get("Access-Control-Request-Method") !== null && headers.get("Access-Control-Request-Headers") !== null) {
1161
1161
  return new Response(null, {
1162
1162
  headers: new Headers({
1163
- // e.g. https://mywebsite.com, configured on your Convex dashboard
1164
- "Access-Control-Allow-Origin": process.env.CLIENT_ORIGIN,
1165
- "Access-Control-Allow-Methods": "POST",
1166
- "Access-Control-Allow-Headers": "Content-Type, Digest",
1163
+ // e.g. https://mywebsite.com, configured on your Convex dashboard, or passed in as an option
1164
+ "Access-Control-Allow-Origin": options.clientOrigin ?? process.env.CLIENT_ORIGIN ?? "http://localhost:3000",
1165
+ "Access-Control-Allow-Methods": "POST, GET, PATCH, DELETE, OPTIONS",
1166
+ "Access-Control-Allow-Headers": "Content-Type, Digest, Authorization, Cookie",
1167
+ "Access-Control-Allow-Credentials": "true",
1167
1168
  "Access-Control-Max-Age": "86400"
1168
1169
  })
1169
1170
  });
@@ -1204,7 +1205,8 @@ function autumnHandler(options) {
1204
1205
  return Response.json(result.body, {
1205
1206
  status: result.statusCode,
1206
1207
  headers: new Headers({
1207
- "Access-Control-Allow-Origin": process.env.CLIENT_ORIGIN,
1208
+ "Access-Control-Allow-Origin": options.clientOrigin ?? process.env.CLIENT_ORIGIN ?? "http://localhost:3000",
1209
+ "Access-Control-Allow-Credentials": "true",
1208
1210
  Vary: "origin"
1209
1211
  })
1210
1212
  });
@@ -24,10 +24,11 @@ function autumnHandler(options) {
24
24
  if (headers.get("Origin") !== null && headers.get("Access-Control-Request-Method") !== null && headers.get("Access-Control-Request-Headers") !== null) {
25
25
  return new Response(null, {
26
26
  headers: new Headers({
27
- // e.g. https://mywebsite.com, configured on your Convex dashboard
28
- "Access-Control-Allow-Origin": process.env.CLIENT_ORIGIN,
29
- "Access-Control-Allow-Methods": "POST",
30
- "Access-Control-Allow-Headers": "Content-Type, Digest",
27
+ // e.g. https://mywebsite.com, configured on your Convex dashboard, or passed in as an option
28
+ "Access-Control-Allow-Origin": options.clientOrigin ?? process.env.CLIENT_ORIGIN ?? "http://localhost:3000",
29
+ "Access-Control-Allow-Methods": "POST, GET, PATCH, DELETE, OPTIONS",
30
+ "Access-Control-Allow-Headers": "Content-Type, Digest, Authorization, Cookie",
31
+ "Access-Control-Allow-Credentials": "true",
31
32
  "Access-Control-Max-Age": "86400"
32
33
  })
33
34
  });
@@ -68,7 +69,8 @@ function autumnHandler(options) {
68
69
  return Response.json(result.body, {
69
70
  status: result.statusCode,
70
71
  headers: new Headers({
71
- "Access-Control-Allow-Origin": process.env.CLIENT_ORIGIN,
72
+ "Access-Control-Allow-Origin": options.clientOrigin ?? process.env.CLIENT_ORIGIN ?? "http://localhost:3000",
73
+ "Access-Control-Allow-Credentials": "true",
72
74
  Vary: "origin"
73
75
  })
74
76
  });
@@ -1,8 +1,8 @@
1
1
  import { AuthResult } from './utils/AuthFunction.mjs';
2
- import { Context, Elysia } from 'elysia';
2
+ import { Elysia } from 'elysia';
3
3
 
4
- declare function autumnHandler<ContextType extends Context = Context>(options: {
5
- identify: (context: ContextType) => AuthResult | Promise<AuthResult>;
4
+ declare function autumnHandler(options: {
5
+ identify: (context: any) => AuthResult | Promise<AuthResult>;
6
6
  version?: string;
7
7
  secretKey?: string;
8
8
  url?: string;
@@ -1,8 +1,8 @@
1
1
  import { AuthResult } from './utils/AuthFunction.js';
2
- import { Context, Elysia } from 'elysia';
2
+ import { Elysia } from 'elysia';
3
3
 
4
- declare function autumnHandler<ContextType extends Context = Context>(options: {
5
- identify: (context: ContextType) => AuthResult | Promise<AuthResult>;
4
+ declare function autumnHandler(options: {
5
+ identify: (context: any) => AuthResult | Promise<AuthResult>;
6
6
  version?: string;
7
7
  secretKey?: string;
8
8
  url?: string;
@@ -1152,8 +1152,25 @@ var secretKeyCheck = (secretKey) => {
1152
1152
  return { found: true, error: null };
1153
1153
  };
1154
1154
 
1155
+ // src/utils/toSnakeCase.ts
1156
+ function stringToSnakeCase2(str) {
1157
+ return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
1158
+ }
1159
+ var toSnakeCase2 = (obj) => {
1160
+ if (Array.isArray(obj)) {
1161
+ return obj.map(toSnakeCase2);
1162
+ } else if (obj !== null && typeof obj === "object") {
1163
+ return Object.fromEntries(
1164
+ Object.entries(obj).map(([key, value]) => [
1165
+ stringToSnakeCase2(key),
1166
+ toSnakeCase2(value)
1167
+ ])
1168
+ );
1169
+ }
1170
+ return obj;
1171
+ };
1172
+
1155
1173
  // src/libraries/backend/elysia.ts
1156
- var import_toSnakeCase2 = require("src/utils/toSnakeCase");
1157
1174
  function autumnHandler(options) {
1158
1175
  const { found, error: resError } = secretKeyCheck(options.secretKey);
1159
1176
  if (!found && !options.secretKey) {
@@ -1161,12 +1178,32 @@ function autumnHandler(options) {
1161
1178
  }
1162
1179
  const router = createRouterWithOptions();
1163
1180
  return function plugin(app) {
1164
- const autumn = new Autumn({
1165
- url: options.url || autumnApiUrl,
1166
- version: options.version,
1167
- secretKey: options.secretKey
1181
+ app.get("/api/autumn/*", async (context) => {
1182
+ return handleRequest(context);
1168
1183
  });
1169
- app.all("/api/autumn/*", async (context) => {
1184
+ app.delete("/api/autumn/*", async (context) => {
1185
+ return handleRequest(context);
1186
+ });
1187
+ app.post("/api/autumn/*", async (context) => {
1188
+ return handleRequest(context);
1189
+ });
1190
+ app.put("/api/autumn/*", async (context) => {
1191
+ return handleRequest(context);
1192
+ });
1193
+ app.patch("/api/autumn/*", async (context) => {
1194
+ return handleRequest(context);
1195
+ });
1196
+ async function handleRequest(context) {
1197
+ let { found: found2, error: resError2 } = secretKeyCheck(options.secretKey);
1198
+ if (!found2) {
1199
+ context.set.status = resError2.statusCode;
1200
+ return resError2;
1201
+ }
1202
+ const autumn = new Autumn({
1203
+ url: options.url || autumnApiUrl,
1204
+ version: options.version,
1205
+ secretKey: options.secretKey
1206
+ });
1170
1207
  const request = context.request;
1171
1208
  const url = new URL(request.url);
1172
1209
  const path = url.pathname;
@@ -1181,12 +1218,16 @@ function autumnHandler(options) {
1181
1218
  const { handler } = data;
1182
1219
  let body = null;
1183
1220
  if (["POST", "PUT", "PATCH"].includes(method)) {
1184
- body = context.body;
1221
+ try {
1222
+ body = context.body;
1223
+ } catch (error) {
1224
+ body = null;
1225
+ }
1185
1226
  }
1186
1227
  try {
1187
1228
  const result = await handler({
1188
1229
  autumn,
1189
- body: (0, import_toSnakeCase2.toSnakeCase)(body),
1230
+ body: toSnakeCase2(body),
1190
1231
  path,
1191
1232
  getCustomer: async () => await options.identify(context),
1192
1233
  pathParams,
@@ -1201,7 +1242,7 @@ function autumnHandler(options) {
1201
1242
  message: error?.message || "Unknown error"
1202
1243
  };
1203
1244
  }
1204
- });
1245
+ }
1205
1246
  return app;
1206
1247
  };
1207
1248
  }
@@ -19,7 +19,26 @@ import {
19
19
 
20
20
  // src/libraries/backend/elysia.ts
21
21
  import { findRoute } from "rou3";
22
- import { toSnakeCase } from "src/utils/toSnakeCase";
22
+
23
+ // src/utils/toSnakeCase.ts
24
+ function stringToSnakeCase(str) {
25
+ return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
26
+ }
27
+ var toSnakeCase = (obj) => {
28
+ if (Array.isArray(obj)) {
29
+ return obj.map(toSnakeCase);
30
+ } else if (obj !== null && typeof obj === "object") {
31
+ return Object.fromEntries(
32
+ Object.entries(obj).map(([key, value]) => [
33
+ stringToSnakeCase(key),
34
+ toSnakeCase(value)
35
+ ])
36
+ );
37
+ }
38
+ return obj;
39
+ };
40
+
41
+ // src/libraries/backend/elysia.ts
23
42
  function autumnHandler(options) {
24
43
  const { found, error: resError } = secretKeyCheck(options.secretKey);
25
44
  if (!found && !options.secretKey) {
@@ -27,12 +46,32 @@ function autumnHandler(options) {
27
46
  }
28
47
  const router = createRouterWithOptions();
29
48
  return function plugin(app) {
30
- const autumn = new Autumn({
31
- url: options.url || autumnApiUrl,
32
- version: options.version,
33
- secretKey: options.secretKey
49
+ app.get("/api/autumn/*", async (context) => {
50
+ return handleRequest(context);
34
51
  });
35
- app.all("/api/autumn/*", async (context) => {
52
+ app.delete("/api/autumn/*", async (context) => {
53
+ return handleRequest(context);
54
+ });
55
+ app.post("/api/autumn/*", async (context) => {
56
+ return handleRequest(context);
57
+ });
58
+ app.put("/api/autumn/*", async (context) => {
59
+ return handleRequest(context);
60
+ });
61
+ app.patch("/api/autumn/*", async (context) => {
62
+ return handleRequest(context);
63
+ });
64
+ async function handleRequest(context) {
65
+ let { found: found2, error: resError2 } = secretKeyCheck(options.secretKey);
66
+ if (!found2) {
67
+ context.set.status = resError2.statusCode;
68
+ return resError2;
69
+ }
70
+ const autumn = new Autumn({
71
+ url: options.url || autumnApiUrl,
72
+ version: options.version,
73
+ secretKey: options.secretKey
74
+ });
36
75
  const request = context.request;
37
76
  const url = new URL(request.url);
38
77
  const path = url.pathname;
@@ -47,7 +86,11 @@ function autumnHandler(options) {
47
86
  const { handler } = data;
48
87
  let body = null;
49
88
  if (["POST", "PUT", "PATCH"].includes(method)) {
50
- body = context.body;
89
+ try {
90
+ body = context.body;
91
+ } catch (error) {
92
+ body = null;
93
+ }
51
94
  }
52
95
  try {
53
96
  const result = await handler({
@@ -67,7 +110,7 @@ function autumnHandler(options) {
67
110
  message: error?.message || "Unknown error"
68
111
  };
69
112
  }
70
- });
113
+ }
71
114
  return app;
72
115
  };
73
116
  }
@@ -1,4 +1,4 @@
1
- import { A as Autumn } from './referralTypes-Dxn4bOpT.mjs';
1
+ import { A as Autumn } from './referralTypes-DRsv8not.mjs';
2
2
  import { AuthResult } from './utils/AuthFunction.mjs';
3
3
  import 'zod';
4
4
  import './response-CV6KGWH5.mjs';
@@ -1,4 +1,4 @@
1
- import { A as Autumn } from './referralTypes-DXhjwazw.js';
1
+ import { A as Autumn } from './referralTypes-DHs1hY4_.js';
2
2
  import { AuthResult } from './utils/AuthFunction.js';
3
3
  import 'zod';
4
4
  import './response-CV6KGWH5.js';
@@ -1,4 +1,4 @@
1
- export { A as Autumn } from './referralTypes-Dxn4bOpT.mjs';
1
+ export { A as Autumn } from './referralTypes-DRsv8not.mjs';
2
2
  import 'zod';
3
3
  import './response-CV6KGWH5.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- export { A as Autumn } from './referralTypes-DXhjwazw.js';
1
+ export { A as Autumn } from './referralTypes-DHs1hY4_.js';
2
2
  import 'zod';
3
3
  import './response-CV6KGWH5.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { A as Autumn, C as CustomerData } from '../referralTypes-Dxn4bOpT.mjs';
1
+ import { A as Autumn, C as CustomerData } from '../referralTypes-DRsv8not.mjs';
2
2
  import { AuthResult } from './AuthFunction.mjs';
3
3
  import 'zod';
4
4
  import '../response-CV6KGWH5.mjs';
@@ -1,4 +1,4 @@
1
- import { A as Autumn, C as CustomerData } from '../referralTypes-DXhjwazw.js';
1
+ import { A as Autumn, C as CustomerData } from '../referralTypes-DHs1hY4_.js';
2
2
  import { AuthResult } from './AuthFunction.js';
3
3
  import 'zod';
4
4
  import '../response-CV6KGWH5.js';
@@ -1,14 +1,14 @@
1
1
  import * as React$1 from 'react';
2
- import { A as AutumnClient } from './ReactAutumnClient-DooIpMm0.mjs';
2
+ import { A as AutumnClient } from './ReactAutumnClient-BK3wjb-u.mjs';
3
3
  import './client/types/clientEntTypes.mjs';
4
4
  import './client/types/clientGenTypes.mjs';
5
5
  import 'zod';
6
6
  import './error-DHbclCVh.mjs';
7
- import './genTypes-C2VFQqmX.mjs';
8
- import './prodTypes-B3iWy6kz.mjs';
9
- import './attachTypes-By0coJIV.mjs';
10
- import './entTypes-B2DgO6PV.mjs';
11
- import './cusTypes-Bbmd8V3j.mjs';
7
+ import './genTypes-BIPS92_Q.mjs';
8
+ import './prodTypes-DuLXGCiA.mjs';
9
+ import './attachTypes-DKmoXHQO.mjs';
10
+ import './entTypes-BDZUfZE_.mjs';
11
+ import './cusTypes-Dlt0fQmq.mjs';
12
12
 
13
13
  interface AutumnDialogContext {
14
14
  props: any;
@@ -1,14 +1,14 @@
1
1
  import * as React$1 from 'react';
2
- import { A as AutumnClient } from './ReactAutumnClient-5mFEwitR.js';
2
+ import { A as AutumnClient } from './ReactAutumnClient-Bh0Sgw6f.js';
3
3
  import './client/types/clientEntTypes.js';
4
4
  import './client/types/clientGenTypes.js';
5
5
  import 'zod';
6
6
  import './error-DHbclCVh.js';
7
- import './genTypes-BNXXZTFn.js';
8
- import './prodTypes-B3iWy6kz.js';
9
- import './attachTypes-CSutLgVn.js';
10
- import './entTypes-D6eoGCKH.js';
11
- import './cusTypes-d_DR9uFs.js';
7
+ import './genTypes-Rn-oq2sc.js';
8
+ import './prodTypes-DuLXGCiA.js';
9
+ import './attachTypes-Cy6WgUas.js';
10
+ import './entTypes-B_DvaeRL.js';
11
+ import './cusTypes-eNmWJ2rC.js';
12
12
 
13
13
  interface AutumnDialogContext {
14
14
  props: any;
@@ -1,15 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React__default from 'react';
3
- import { A as AutumnClient } from './ReactAutumnClient-DooIpMm0.mjs';
3
+ import { A as AutumnClient } from './ReactAutumnClient-BK3wjb-u.mjs';
4
4
  import './client/types/clientEntTypes.mjs';
5
5
  import './client/types/clientGenTypes.mjs';
6
6
  import 'zod';
7
7
  import './error-DHbclCVh.mjs';
8
- import './genTypes-C2VFQqmX.mjs';
9
- import './prodTypes-B3iWy6kz.mjs';
10
- import './attachTypes-By0coJIV.mjs';
11
- import './entTypes-B2DgO6PV.mjs';
12
- import './cusTypes-Bbmd8V3j.mjs';
8
+ import './genTypes-BIPS92_Q.mjs';
9
+ import './prodTypes-DuLXGCiA.mjs';
10
+ import './attachTypes-DKmoXHQO.mjs';
11
+ import './entTypes-BDZUfZE_.mjs';
12
+ import './cusTypes-Dlt0fQmq.mjs';
13
13
 
14
14
  declare function BaseAutumnProvider({ client, children, AutumnContext, }: {
15
15
  client: AutumnClient;