autumn-js 0.0.103 → 0.0.105

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 (259) hide show
  1. package/dist/libraries/backend/better-auth.d.mts +46 -22
  2. package/dist/libraries/backend/better-auth.d.ts +46 -22
  3. package/dist/libraries/backend/better-auth.js +76 -83
  4. package/dist/libraries/backend/better-auth.mjs +7 -7
  5. package/dist/libraries/backend/{chunk-33NT3WE5.mjs → chunk-3OLXYDCU.mjs} +1 -1
  6. package/dist/libraries/backend/{chunk-AKV5N4WO.mjs → chunk-5EKNB4IJ.mjs} +1 -1
  7. package/dist/libraries/backend/{chunk-CEZHD5H6.mjs → chunk-5H6HVCOP.mjs} +1 -1
  8. package/dist/libraries/backend/{chunk-J3L3OBSS.mjs → chunk-HHMIVOXX.mjs} +18 -1
  9. package/dist/libraries/backend/{chunk-YFWJ6E4U.mjs → chunk-ICPSX5WQ.mjs} +8 -8
  10. package/dist/libraries/backend/{chunk-6VS7TU7O.mjs → chunk-IOSEAUDJ.mjs} +57 -81
  11. package/dist/libraries/backend/{chunk-RA4AC56B.mjs → chunk-K7JGEYUX.mjs} +1 -1
  12. package/dist/libraries/backend/convex.js +73 -80
  13. package/dist/libraries/backend/convex.mjs +7 -7
  14. package/dist/libraries/backend/elysia.js +73 -80
  15. package/dist/libraries/backend/elysia.mjs +7 -7
  16. package/dist/libraries/backend/express.d.mts +1 -1
  17. package/dist/libraries/backend/express.d.ts +1 -1
  18. package/dist/libraries/backend/express.js +73 -80
  19. package/dist/libraries/backend/express.mjs +7 -7
  20. package/dist/libraries/backend/fastify.js +73 -80
  21. package/dist/libraries/backend/fastify.mjs +7 -7
  22. package/dist/libraries/backend/hono.js +73 -80
  23. package/dist/libraries/backend/hono.mjs +7 -7
  24. package/dist/libraries/backend/next.js +169 -176
  25. package/dist/libraries/backend/next.mjs +101 -101
  26. package/dist/libraries/backend/react-router.js +73 -80
  27. package/dist/libraries/backend/react-router.mjs +7 -7
  28. package/dist/libraries/backend/{referralTypes-DcDxMGTp.d.mts → referralTypes-CILDqqIc.d.mts} +220 -123
  29. package/dist/libraries/backend/{referralTypes-DV8s1h8w.d.ts → referralTypes-DKd7XOdW.d.ts} +220 -123
  30. package/dist/libraries/backend/remix_dep.js +73 -80
  31. package/dist/libraries/backend/remix_dep.mjs +7 -7
  32. package/dist/libraries/backend/routes/backendRouter.js +73 -80
  33. package/dist/libraries/backend/routes/backendRouter.mjs +7 -7
  34. package/dist/libraries/backend/routes/entityRoutes.js +56 -80
  35. package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
  36. package/dist/libraries/backend/routes/genRoutes.js +73 -80
  37. package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
  38. package/dist/libraries/backend/routes/productRoutes.js +56 -80
  39. package/dist/libraries/backend/routes/productRoutes.mjs +3 -3
  40. package/dist/libraries/backend/routes/referralRoutes.js +56 -80
  41. package/dist/libraries/backend/routes/referralRoutes.mjs +3 -3
  42. package/dist/libraries/backend/supabase.js +73 -80
  43. package/dist/libraries/backend/supabase.mjs +7 -7
  44. package/dist/libraries/backend/tanstack.js +73 -80
  45. package/dist/libraries/backend/tanstack.mjs +7 -7
  46. package/dist/libraries/backend/utils/backendRes.js +56 -80
  47. package/dist/libraries/backend/utils/backendRes.mjs +1 -1
  48. package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
  49. package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
  50. package/dist/libraries/backend/utils/withAuth.js +56 -80
  51. package/dist/libraries/backend/utils/withAuth.mjs +2 -2
  52. package/dist/libraries/react/AutumnContext.d.mts +5 -4
  53. package/dist/libraries/react/AutumnContext.d.ts +5 -4
  54. package/dist/libraries/react/AutumnContext.js +63 -82
  55. package/dist/libraries/react/AutumnContext.mjs +6 -6
  56. package/dist/libraries/react/BaseAutumnProvider.d.mts +5 -4
  57. package/dist/libraries/react/BaseAutumnProvider.d.ts +5 -4
  58. package/dist/libraries/react/BaseAutumnProvider.js +96 -111
  59. package/dist/libraries/react/BaseAutumnProvider.mjs +10 -10
  60. package/dist/libraries/react/{ReactAutumnClient-BlxQQOXE.d.ts → ReactAutumnClient-BICsMJ-m.d.ts} +21 -10
  61. package/dist/libraries/react/{ReactAutumnClient-C8Nt-pqu.d.mts → ReactAutumnClient-BuQHr-be.d.mts} +21 -10
  62. package/dist/libraries/react/ReactAutumnProvider.d.mts +1 -1
  63. package/dist/libraries/react/ReactAutumnProvider.d.ts +1 -1
  64. package/dist/libraries/react/ReactAutumnProvider.js +96 -111
  65. package/dist/libraries/react/ReactAutumnProvider.mjs +11 -11
  66. package/dist/libraries/react/attachTypes-Cb7EQun_.d.ts +58 -0
  67. package/dist/libraries/react/attachTypes-CsFmlhk3.d.mts +58 -0
  68. package/dist/libraries/react/{chunk-VUBJ6JM3.mjs → chunk-253MTZP3.mjs} +7 -2
  69. package/dist/libraries/react/{chunk-CYW4LNFZ.mjs → chunk-2PVRCDDK.mjs} +68 -90
  70. package/dist/libraries/react/{chunk-LXSKONN2.mjs → chunk-4A53GN44.mjs} +5 -5
  71. package/dist/libraries/react/{chunk-X4R3V6O6.mjs → chunk-4CHWEUKX.mjs} +2 -2
  72. package/dist/libraries/react/{chunk-OAWFFAKA.mjs → chunk-6EZVNJHQ.mjs} +6 -6
  73. package/dist/libraries/react/{chunk-PZJQBCVG.mjs → chunk-6RNG47NV.mjs} +1 -1
  74. package/dist/libraries/react/{chunk-3SGSKYJ7.mjs → chunk-7DINVACK.mjs} +2 -2
  75. package/dist/libraries/react/{chunk-QBBE72EF.mjs → chunk-CBPZVSMZ.mjs} +12 -7
  76. package/dist/libraries/react/chunk-CUWUAQML.mjs +179 -0
  77. package/dist/libraries/react/chunk-DJIRJJNG.mjs +34 -0
  78. package/dist/libraries/react/{chunk-GQIE3MFB.mjs → chunk-DRAIZ3UZ.mjs} +3 -3
  79. package/dist/libraries/react/{chunk-AL3VJLFU.mjs → chunk-EV5RNY5U.mjs} +1 -1
  80. package/dist/libraries/react/{chunk-S6JUZ43Q.mjs → chunk-KDD5RMQ3.mjs} +2 -2
  81. package/dist/libraries/react/{chunk-KYSWTOMQ.mjs → chunk-KJLHVBV4.mjs} +30 -24
  82. package/dist/libraries/react/{chunk-OAPUYXBO.mjs → chunk-KWNH6C27.mjs} +6 -6
  83. package/dist/libraries/react/{chunk-CGWNDUYV.mjs → chunk-LXD6AEZW.mjs} +1 -1
  84. package/dist/libraries/react/chunk-N7LPH3DU.mjs +695 -0
  85. package/dist/libraries/react/{chunk-DBGTWERW.mjs → chunk-OEIUKLFH.mjs} +4 -3
  86. package/dist/libraries/react/{chunk-EHOBTSZ7.mjs → chunk-OM3ROIZO.mjs} +5 -8
  87. package/dist/libraries/react/{chunk-DHJ36QEV.mjs → chunk-OTYSAMRH.mjs} +2 -2
  88. package/dist/libraries/react/chunk-QUO2CYKM.mjs +30 -0
  89. package/dist/libraries/react/{chunk-BCMBFJ7E.mjs → chunk-RCTILKK3.mjs} +70 -37
  90. package/dist/libraries/react/{chunk-ZVQKDPUP.mjs → chunk-RPEGNKJH.mjs} +3 -3
  91. package/dist/libraries/react/{chunk-SDMBKRAI.mjs → chunk-WAFSQH6N.mjs} +37 -37
  92. package/dist/libraries/react/{chunk-RQN4VDAE.mjs → chunk-XXGKLOAK.mjs} +3 -3
  93. package/dist/libraries/react/client/ReactAutumnClient.d.mts +5 -5
  94. package/dist/libraries/react/client/ReactAutumnClient.d.ts +5 -5
  95. package/dist/libraries/react/client/ReactAutumnClient.js +63 -82
  96. package/dist/libraries/react/client/ReactAutumnClient.mjs +5 -5
  97. package/dist/libraries/react/client/clientCompMethods.d.mts +5 -5
  98. package/dist/libraries/react/client/clientCompMethods.d.ts +5 -5
  99. package/dist/libraries/react/client/clientCusMethods.d.mts +5 -5
  100. package/dist/libraries/react/client/clientCusMethods.d.ts +5 -5
  101. package/dist/libraries/react/client/clientEntityMethods.d.mts +5 -5
  102. package/dist/libraries/react/client/clientEntityMethods.d.ts +5 -5
  103. package/dist/libraries/react/client/clientGenMethods.d.mts +9 -7
  104. package/dist/libraries/react/client/clientGenMethods.d.ts +9 -7
  105. package/dist/libraries/react/client/clientGenMethods.js +8 -2
  106. package/dist/libraries/react/client/clientGenMethods.mjs +3 -1
  107. package/dist/libraries/react/client/clientProdMethods.d.mts +5 -5
  108. package/dist/libraries/react/client/clientProdMethods.d.ts +5 -5
  109. package/dist/libraries/react/client/clientReferralMethods.d.mts +5 -5
  110. package/dist/libraries/react/client/clientReferralMethods.d.ts +5 -5
  111. package/dist/libraries/react/client/types/clientAttachTypes.d.mts +115 -0
  112. package/dist/libraries/react/client/types/clientAttachTypes.d.ts +115 -0
  113. package/dist/libraries/react/client/types/clientAttachTypes.js +68 -0
  114. package/dist/libraries/react/client/types/clientAttachTypes.mjs +42 -0
  115. package/dist/libraries/react/client/types/clientGenTypes.d.mts +10 -81
  116. package/dist/libraries/react/client/types/clientGenTypes.d.ts +10 -81
  117. package/dist/libraries/react/client/types/clientGenTypes.js +1 -24
  118. package/dist/libraries/react/client/types/clientGenTypes.mjs +1 -22
  119. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.css +213 -4
  120. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.mts +5 -32
  121. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.ts +5 -32
  122. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.js +720 -371
  123. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.mjs +30 -33
  124. package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.mts +3 -2
  125. package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.ts +3 -2
  126. package/dist/libraries/react/components/attach-dialog/lib/attach-content.js +70 -37
  127. package/dist/libraries/react/components/attach-dialog/lib/attach-content.mjs +1 -1
  128. package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.mts +1 -1
  129. package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.ts +1 -1
  130. package/dist/libraries/react/components/check-dialog/check-dialog-synced.js +43 -43
  131. package/dist/libraries/react/components/check-dialog/check-dialog-synced.mjs +5 -5
  132. package/dist/libraries/react/components/check-dialog/lib/check-content.d.mts +1 -1
  133. package/dist/libraries/react/components/check-dialog/lib/check-content.d.ts +1 -1
  134. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +3 -1
  135. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +3 -1
  136. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.js +12 -7
  137. package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.mjs +1 -1
  138. package/dist/libraries/react/components/pricing-table/pricing-table-synced.css +213 -4
  139. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
  140. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
  141. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +795 -457
  142. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +29 -26
  143. package/dist/libraries/react/components/ui/accordion.d.mts +9 -0
  144. package/dist/libraries/react/components/ui/accordion.d.ts +9 -0
  145. package/dist/libraries/react/components/ui/accordion.js +2721 -0
  146. package/dist/libraries/react/components/ui/accordion.mjs +15 -0
  147. package/dist/libraries/react/components/ui/button.d.mts +1 -1
  148. package/dist/libraries/react/components/ui/button.d.ts +1 -1
  149. package/dist/libraries/react/components/ui/button.js +3 -3
  150. package/dist/libraries/react/components/ui/button.mjs +2 -2
  151. package/dist/libraries/react/components/ui/dialog.js +43 -43
  152. package/dist/libraries/react/components/ui/dialog.mjs +3 -3
  153. package/dist/libraries/react/components/ui/input.d.mts +5 -0
  154. package/dist/libraries/react/components/ui/input.d.ts +5 -0
  155. package/dist/libraries/react/components/ui/input.js +2587 -0
  156. package/dist/libraries/react/components/ui/input.mjs +9 -0
  157. package/dist/libraries/react/components/ui/popover.d.mts +9 -0
  158. package/dist/libraries/react/components/ui/popover.d.ts +9 -0
  159. package/dist/libraries/react/components/ui/popover.js +2594 -0
  160. package/dist/libraries/react/components/ui/popover.mjs +15 -0
  161. package/dist/libraries/react/components/ui/switch.js +12 -12
  162. package/dist/libraries/react/components/ui/switch.mjs +3 -3
  163. package/dist/libraries/react/{cusTypes-CHcG59KG.d.mts → cusTypes-l9ZWuqVq.d.mts} +30 -12
  164. package/dist/libraries/react/{cusTypes-CHcG59KG.d.ts → cusTypes-l9ZWuqVq.d.ts} +30 -12
  165. package/dist/libraries/react/{entTypes-8-4TWxee.d.ts → entTypes-CFDcayTF.d.ts} +1 -1
  166. package/dist/libraries/react/{entTypes-3t7AbNhm.d.mts → entTypes-Diy1Q4vW.d.mts} +1 -1
  167. package/dist/libraries/react/hooks/handleAllowed.d.mts +2 -2
  168. package/dist/libraries/react/hooks/handleAllowed.d.ts +2 -2
  169. package/dist/libraries/react/hooks/useAutumn.d.mts +21 -6
  170. package/dist/libraries/react/hooks/useAutumn.d.ts +21 -6
  171. package/dist/libraries/react/hooks/useAutumn.js +94 -110
  172. package/dist/libraries/react/hooks/useAutumn.mjs +9 -9
  173. package/dist/libraries/react/hooks/useAutumnBase.d.mts +24 -9
  174. package/dist/libraries/react/hooks/useAutumnBase.d.ts +24 -9
  175. package/dist/libraries/react/hooks/useAutumnBase.js +94 -110
  176. package/dist/libraries/react/hooks/useAutumnBase.mjs +8 -8
  177. package/dist/libraries/react/hooks/useCustomer.d.mts +7 -5
  178. package/dist/libraries/react/hooks/useCustomer.d.ts +7 -5
  179. package/dist/libraries/react/hooks/useCustomer.js +96 -111
  180. package/dist/libraries/react/hooks/useCustomer.mjs +10 -10
  181. package/dist/libraries/react/hooks/useCustomerBase.d.mts +8 -5
  182. package/dist/libraries/react/hooks/useCustomerBase.d.ts +8 -5
  183. package/dist/libraries/react/hooks/useCustomerBase.js +96 -111
  184. package/dist/libraries/react/hooks/useCustomerBase.mjs +9 -9
  185. package/dist/libraries/react/hooks/useEntity.d.mts +16 -9
  186. package/dist/libraries/react/hooks/useEntity.d.ts +16 -9
  187. package/dist/libraries/react/hooks/useEntity.js +94 -110
  188. package/dist/libraries/react/hooks/useEntity.mjs +10 -10
  189. package/dist/libraries/react/hooks/useEntityBase.d.mts +18 -9
  190. package/dist/libraries/react/hooks/useEntityBase.d.ts +18 -9
  191. package/dist/libraries/react/hooks/useEntityBase.js +94 -110
  192. package/dist/libraries/react/hooks/useEntityBase.mjs +9 -9
  193. package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
  194. package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
  195. package/dist/libraries/react/hooks/usePricingTable.js +66 -88
  196. package/dist/libraries/react/hooks/usePricingTable.mjs +8 -8
  197. package/dist/libraries/react/hooks/usePricingTableBase.d.mts +6 -6
  198. package/dist/libraries/react/hooks/usePricingTableBase.d.ts +6 -6
  199. package/dist/libraries/react/hooks/usePricingTableBase.js +66 -88
  200. package/dist/libraries/react/hooks/usePricingTableBase.mjs +7 -7
  201. package/dist/libraries/react/hooks/useProductsBase.js +63 -82
  202. package/dist/libraries/react/hooks/useProductsBase.mjs +6 -6
  203. package/dist/libraries/react/index.d.mts +217 -106
  204. package/dist/libraries/react/index.d.ts +217 -106
  205. package/dist/libraries/react/index.js +802 -464
  206. package/dist/libraries/react/index.mjs +793 -455
  207. package/dist/libraries/react/{response-DnJCkvfc.d.ts → response-BFBmXYPK.d.ts} +2 -25
  208. package/dist/libraries/react/{response-B8MYd86O.d.mts → response-D3QhcRLa.d.mts} +2 -25
  209. package/dist/next/{AutumnProvider-Xl1mqxls.d.mts → AutumnProvider-CHFySjFm.d.mts} +30 -12
  210. package/dist/next/{AutumnProvider-Xl1mqxls.d.ts → AutumnProvider-CHFySjFm.d.ts} +30 -12
  211. package/dist/next/AutumnProvider.d.mts +1 -1
  212. package/dist/next/AutumnProvider.d.ts +1 -1
  213. package/dist/next/client/NextAutumnClient.d.mts +19 -8
  214. package/dist/next/client/NextAutumnClient.d.ts +19 -8
  215. package/dist/next/client/NextAutumnClient.js +13 -2
  216. package/dist/next/client/NextAutumnClient.mjs +13 -2
  217. package/dist/next/client/NextAutumnProvider.d.mts +1 -1
  218. package/dist/next/client/NextAutumnProvider.d.ts +1 -1
  219. package/dist/next/client/attachTypes-BbjEGh-Q.d.mts +58 -0
  220. package/dist/next/client/attachTypes-BmvzLAdZ.d.ts +58 -0
  221. package/dist/next/client/{clientGenTypes-Dx1TULjb.d.ts → clientAttachTypes-DWV50ToQ.d.ts} +108 -90
  222. package/dist/next/client/{clientGenTypes-tE8HbEdV.d.mts → clientAttachTypes-xaEzXIt3.d.mts} +108 -90
  223. package/dist/next/client/clientUtils.d.mts +2 -2
  224. package/dist/next/client/clientUtils.d.ts +2 -2
  225. package/dist/next/client/{cusTypes-nWQygxXu.d.mts → cusTypes-mflRCYE_.d.mts} +30 -12
  226. package/dist/next/client/{cusTypes-nWQygxXu.d.ts → cusTypes-mflRCYE_.d.ts} +30 -12
  227. package/dist/next/client/{entTypes-DusU3WqD.d.mts → entTypes-BRNi52gE.d.mts} +1 -1
  228. package/dist/next/client/{entTypes-DDZyYuom.d.ts → entTypes-DtUiQ3Ms.d.ts} +1 -1
  229. package/dist/next/client/hooks/useAutumn.d.mts +19 -5
  230. package/dist/next/client/hooks/useAutumn.d.ts +19 -5
  231. package/dist/next/client/hooks/useCustomer.d.mts +5 -4
  232. package/dist/next/client/hooks/useCustomer.d.ts +5 -4
  233. package/dist/next/client/hooks/useEntity.d.mts +14 -8
  234. package/dist/next/client/hooks/useEntity.d.ts +14 -8
  235. package/dist/next/client/hooks/usePricingTable.d.mts +1 -1
  236. package/dist/next/client/hooks/usePricingTable.d.ts +1 -1
  237. package/dist/next/client/types.d.mts +2 -2
  238. package/dist/next/client/types.d.ts +2 -2
  239. package/dist/next/index.d.mts +213 -107
  240. package/dist/next/index.d.ts +213 -107
  241. package/dist/next/server/auth/withNextAuth.d.mts +1 -1
  242. package/dist/next/server/auth/withNextAuth.d.ts +1 -1
  243. package/dist/next/server/componentActions.d.mts +1 -1
  244. package/dist/next/server/componentActions.d.ts +1 -1
  245. package/dist/next/server/cusActions.d.mts +177 -98
  246. package/dist/next/server/cusActions.d.ts +177 -98
  247. package/dist/next/server/{cusTypes-Tc189V9T.d.mts → cusTypes-Bh_pVAJp.d.mts} +32 -14
  248. package/dist/next/server/{cusTypes-Tc189V9T.d.ts → cusTypes-Bh_pVAJp.d.ts} +32 -14
  249. package/dist/next/server/genActions.d.mts +3 -4
  250. package/dist/next/server/genActions.d.ts +3 -4
  251. package/dist/sdk/index.d.mts +221 -135
  252. package/dist/sdk/index.d.ts +221 -135
  253. package/dist/sdk/index.js +55 -80
  254. package/dist/sdk/index.mjs +54 -81
  255. package/dist/styles/global.css +213 -4
  256. package/dist/utils/encryptUtils.js +56 -80
  257. package/dist/utils/encryptUtils.mjs +56 -80
  258. package/package.json +7 -4
  259. package/dist/libraries/react/chunk-ZEVKOP7Z.mjs +0 -548
@@ -1,21 +1,21 @@
1
- import {
2
- addEntityRoutes
3
- } from "./chunk-RA4AC56B.mjs";
4
1
  import {
5
2
  addGenRoutes
6
- } from "./chunk-J3L3OBSS.mjs";
3
+ } from "./chunk-HHMIVOXX.mjs";
7
4
  import {
8
5
  addProductRoutes
9
- } from "./chunk-AKV5N4WO.mjs";
6
+ } from "./chunk-5EKNB4IJ.mjs";
10
7
  import {
11
8
  addReferralRoutes
12
- } from "./chunk-33NT3WE5.mjs";
9
+ } from "./chunk-3OLXYDCU.mjs";
10
+ import {
11
+ addEntityRoutes
12
+ } from "./chunk-K7JGEYUX.mjs";
13
13
  import {
14
14
  withAuth
15
- } from "./chunk-CEZHD5H6.mjs";
15
+ } from "./chunk-5H6HVCOP.mjs";
16
16
  import {
17
17
  fetchPricingTable
18
- } from "./chunk-6VS7TU7O.mjs";
18
+ } from "./chunk-IOSEAUDJ.mjs";
19
19
  import {
20
20
  BASE_PATH
21
21
  } from "./chunk-KSG3E4Q2.mjs";
@@ -32,6 +32,12 @@ var AutumnError = class _AutumnError extends Error {
32
32
  };
33
33
 
34
34
  // src/sdk/general/genMethods.ts
35
+ var handleCheckout = async ({
36
+ instance,
37
+ params
38
+ }) => {
39
+ return instance.post("/checkout", params);
40
+ };
35
41
  var handleAttach = async ({
36
42
  instance,
37
43
  params
@@ -50,18 +56,6 @@ var handleCancel = async ({
50
56
  }) => {
51
57
  return instance.post("/cancel", params);
52
58
  };
53
- var handleEntitled = async ({
54
- instance,
55
- params
56
- }) => {
57
- return instance.post("/entitled", params);
58
- };
59
- var handleEvent = async ({
60
- instance,
61
- params
62
- }) => {
63
- return instance.post("/events", params);
64
- };
65
59
  var handleTrack = async ({
66
60
  instance,
67
61
  params
@@ -367,6 +361,13 @@ var Autumn = class {
367
361
  products = productMethods(this);
368
362
  entities = entityMethods(this);
369
363
  referrals = referralMethods(this);
364
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
365
+ async checkout(params) {
366
+ return handleCheckout({
367
+ instance: this,
368
+ params
369
+ });
370
+ }
370
371
  static attach = (params) => staticWrapper(handleAttach, void 0, { params });
371
372
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
372
373
  async attach(params) {
@@ -389,21 +390,6 @@ var Autumn = class {
389
390
  params
390
391
  });
391
392
  }
392
- /**
393
- * @deprecated This method is deprecated and will be removed in a future version.
394
- * Please use the new check() method instead.
395
- */
396
- static entitled = (params) => staticWrapper(handleEntitled, void 0, { params });
397
- /**
398
- * @deprecated This method is deprecated and will be removed in a future version.
399
- * Please use the new check() method instead.
400
- */
401
- async entitled(params) {
402
- return handleEntitled({
403
- instance: this,
404
- params
405
- });
406
- }
407
393
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
408
394
  async check(params) {
409
395
  return handleCheck({
@@ -411,21 +397,6 @@ var Autumn = class {
411
397
  params
412
398
  });
413
399
  }
414
- /**
415
- * @deprecated This method is deprecated and will be removed in a future version.
416
- * Please use the new track() method instead.
417
- */
418
- static event = (params) => staticWrapper(handleEvent, void 0, { params });
419
- /**
420
- * @deprecated This method is deprecated and will be removed in a future version.
421
- * Please use the new track() method instead.
422
- */
423
- async event(params) {
424
- return handleEvent({
425
- instance: this,
426
- params
427
- });
428
- }
429
400
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
430
401
  async track(params) {
431
402
  return handleTrack({
@@ -450,44 +421,6 @@ var EntityDataSchema = z.object({
450
421
 
451
422
  // src/sdk/general/genTypes.ts
452
423
  import { z as z2 } from "zod";
453
- var AttachFeatureOptionsSchema = z2.object({
454
- feature_id: z2.string(),
455
- quantity: z2.number()
456
- });
457
- var AttachParamsSchema = z2.object({
458
- customer_id: z2.string(),
459
- product_id: z2.string().optional(),
460
- entity_id: z2.string().optional(),
461
- options: z2.array(
462
- z2.object({
463
- feature_id: z2.string(),
464
- quantity: z2.number()
465
- })
466
- ).optional(),
467
- product_ids: z2.array(z2.string()).optional(),
468
- // If set, will attach multiple products to the customer (cannot be used with product_id)
469
- free_trial: z2.boolean().optional(),
470
- // Default is true -- if set to false, will bypass product free trial
471
- success_url: z2.string().optional(),
472
- // Passed to Stripe
473
- metadata: z2.record(z2.string()).optional(),
474
- // Passed to Stripe
475
- force_checkout: z2.boolean().optional(),
476
- // Default is false -- if set to true, will force the customer to checkout (not allowed for upgrades / downgrades)
477
- customer_data: z2.any().optional(),
478
- entity_data: z2.any().optional(),
479
- checkout_session_params: z2.record(z2.any()).optional(),
480
- // Passed to Stripe
481
- reward: z2.string().optional()
482
- });
483
- var AttachResultSchema = z2.object({
484
- checkout_url: z2.string().optional(),
485
- customer_id: z2.string(),
486
- product_ids: z2.array(z2.string()),
487
- code: z2.string(),
488
- message: z2.string(),
489
- customer_data: z2.any().optional()
490
- });
491
424
  var CancelParamsSchema = z2.object({
492
425
  customer_id: z2.string(),
493
426
  product_id: z2.string(),
@@ -541,6 +474,11 @@ var CustomerExpandEnum = z3.enum([
541
474
 
542
475
  // src/sdk/customers/cusTypes.ts
543
476
  import { z as z4 } from "zod";
477
+ var CustomerDataSchema = z4.object({
478
+ name: z4.string().nullish(),
479
+ email: z4.string().nullish(),
480
+ fingerprint: z4.string().nullish()
481
+ });
544
482
  var CreateCustomerParamsSchema = z4.object({
545
483
  id: z4.string().nullish(),
546
484
  email: z4.string().nullish(),
@@ -588,6 +526,44 @@ var RedeemReferralCodeParamsSchema = z5.object({
588
526
  customer_id: z5.string()
589
527
  });
590
528
 
529
+ // src/sdk/general/attachTypes.ts
530
+ import { z as z6 } from "zod";
531
+ var AttachFeatureOptionsSchema = z6.object({
532
+ feature_id: z6.string(),
533
+ quantity: z6.number()
534
+ });
535
+ var AttachParamsSchema = z6.object({
536
+ customer_id: z6.string(),
537
+ product_id: z6.string().optional(),
538
+ entity_id: z6.string().optional(),
539
+ options: z6.array(AttachFeatureOptionsSchema).optional(),
540
+ product_ids: z6.array(z6.string()).optional(),
541
+ free_trial: z6.boolean().optional(),
542
+ success_url: z6.string().optional(),
543
+ metadata: z6.record(z6.string()).optional(),
544
+ force_checkout: z6.boolean().optional(),
545
+ customer_data: CustomerDataSchema.optional(),
546
+ entity_data: z6.any().optional(),
547
+ checkout_session_params: z6.record(z6.any()).optional(),
548
+ reward: z6.string().optional()
549
+ });
550
+ var AttachResultSchema = z6.object({
551
+ checkout_url: z6.string().optional(),
552
+ customer_id: z6.string(),
553
+ product_ids: z6.array(z6.string()),
554
+ code: z6.string(),
555
+ message: z6.string(),
556
+ customer_data: z6.any().optional()
557
+ });
558
+ var CheckoutParamsSchema = z6.object({
559
+ customer_id: z6.string(),
560
+ product_id: z6.string(),
561
+ entity_id: z6.string().optional(),
562
+ success_url: z6.string().optional(),
563
+ customer_data: CustomerDataSchema.optional(),
564
+ options: z6.array(AttachFeatureOptionsSchema).optional()
565
+ });
566
+
591
567
  // src/libraries/backend/utils/backendRes.ts
592
568
  var toBackendRes = ({ res }) => {
593
569
  let statusCode = res.statusCode ? res.statusCode : res.error ? 500 : 200;
@@ -613,7 +589,6 @@ var toBackendError = ({
613
589
 
614
590
  export {
615
591
  Autumn,
616
- AttachParamsSchema,
617
592
  CancelParamsSchema,
618
593
  TrackParamsSchema,
619
594
  CheckParamsSchema,
@@ -622,6 +597,7 @@ export {
622
597
  fetchPricingTable,
623
598
  CreateReferralCodeParamsSchema,
624
599
  RedeemReferralCodeParamsSchema,
600
+ AttachParamsSchema,
625
601
  toBackendRes,
626
602
  toBackendError
627
603
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withAuth
3
- } from "./chunk-CEZHD5H6.mjs";
3
+ } from "./chunk-5H6HVCOP.mjs";
4
4
 
5
5
  // src/libraries/backend/routes/entityRoutes.ts
6
6
  import { addRoute } from "rou3";
@@ -61,6 +61,12 @@ var AutumnError = class _AutumnError extends Error {
61
61
  };
62
62
 
63
63
  // src/sdk/general/genMethods.ts
64
+ var handleCheckout = async ({
65
+ instance,
66
+ params
67
+ }) => {
68
+ return instance.post("/checkout", params);
69
+ };
64
70
  var handleAttach = async ({
65
71
  instance,
66
72
  params
@@ -79,18 +85,6 @@ var handleCancel = async ({
79
85
  }) => {
80
86
  return instance.post("/cancel", params);
81
87
  };
82
- var handleEntitled = async ({
83
- instance,
84
- params
85
- }) => {
86
- return instance.post("/entitled", params);
87
- };
88
- var handleEvent = async ({
89
- instance,
90
- params
91
- }) => {
92
- return instance.post("/events", params);
93
- };
94
88
  var handleTrack = async ({
95
89
  instance,
96
90
  params
@@ -438,6 +432,13 @@ var Autumn = class {
438
432
  products = productMethods(this);
439
433
  entities = entityMethods(this);
440
434
  referrals = referralMethods(this);
435
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
436
+ async checkout(params) {
437
+ return handleCheckout({
438
+ instance: this,
439
+ params
440
+ });
441
+ }
441
442
  static attach = (params) => staticWrapper(handleAttach, void 0, { params });
442
443
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
443
444
  async attach(params) {
@@ -460,21 +461,6 @@ var Autumn = class {
460
461
  params
461
462
  });
462
463
  }
463
- /**
464
- * @deprecated This method is deprecated and will be removed in a future version.
465
- * Please use the new check() method instead.
466
- */
467
- static entitled = (params) => staticWrapper(handleEntitled, void 0, { params });
468
- /**
469
- * @deprecated This method is deprecated and will be removed in a future version.
470
- * Please use the new check() method instead.
471
- */
472
- async entitled(params) {
473
- return handleEntitled({
474
- instance: this,
475
- params
476
- });
477
- }
478
464
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
479
465
  async check(params) {
480
466
  return handleCheck({
@@ -482,21 +468,6 @@ var Autumn = class {
482
468
  params
483
469
  });
484
470
  }
485
- /**
486
- * @deprecated This method is deprecated and will be removed in a future version.
487
- * Please use the new track() method instead.
488
- */
489
- static event = (params) => staticWrapper(handleEvent, void 0, { params });
490
- /**
491
- * @deprecated This method is deprecated and will be removed in a future version.
492
- * Please use the new track() method instead.
493
- */
494
- async event(params) {
495
- return handleEvent({
496
- instance: this,
497
- params
498
- });
499
- }
500
471
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
501
472
  async track(params) {
502
473
  return handleTrack({
@@ -521,44 +492,6 @@ var EntityDataSchema = import_zod.z.object({
521
492
 
522
493
  // src/sdk/general/genTypes.ts
523
494
  var import_zod2 = require("zod");
524
- var AttachFeatureOptionsSchema = import_zod2.z.object({
525
- feature_id: import_zod2.z.string(),
526
- quantity: import_zod2.z.number()
527
- });
528
- var AttachParamsSchema = import_zod2.z.object({
529
- customer_id: import_zod2.z.string(),
530
- product_id: import_zod2.z.string().optional(),
531
- entity_id: import_zod2.z.string().optional(),
532
- options: import_zod2.z.array(
533
- import_zod2.z.object({
534
- feature_id: import_zod2.z.string(),
535
- quantity: import_zod2.z.number()
536
- })
537
- ).optional(),
538
- product_ids: import_zod2.z.array(import_zod2.z.string()).optional(),
539
- // If set, will attach multiple products to the customer (cannot be used with product_id)
540
- free_trial: import_zod2.z.boolean().optional(),
541
- // Default is true -- if set to false, will bypass product free trial
542
- success_url: import_zod2.z.string().optional(),
543
- // Passed to Stripe
544
- metadata: import_zod2.z.record(import_zod2.z.string()).optional(),
545
- // Passed to Stripe
546
- force_checkout: import_zod2.z.boolean().optional(),
547
- // Default is false -- if set to true, will force the customer to checkout (not allowed for upgrades / downgrades)
548
- customer_data: import_zod2.z.any().optional(),
549
- entity_data: import_zod2.z.any().optional(),
550
- checkout_session_params: import_zod2.z.record(import_zod2.z.any()).optional(),
551
- // Passed to Stripe
552
- reward: import_zod2.z.string().optional()
553
- });
554
- var AttachResultSchema = import_zod2.z.object({
555
- checkout_url: import_zod2.z.string().optional(),
556
- customer_id: import_zod2.z.string(),
557
- product_ids: import_zod2.z.array(import_zod2.z.string()),
558
- code: import_zod2.z.string(),
559
- message: import_zod2.z.string(),
560
- customer_data: import_zod2.z.any().optional()
561
- });
562
495
  var CancelParamsSchema = import_zod2.z.object({
563
496
  customer_id: import_zod2.z.string(),
564
497
  product_id: import_zod2.z.string(),
@@ -612,6 +545,11 @@ var CustomerExpandEnum = import_zod3.z.enum([
612
545
 
613
546
  // src/sdk/customers/cusTypes.ts
614
547
  var import_zod4 = require("zod");
548
+ var CustomerDataSchema = import_zod4.z.object({
549
+ name: import_zod4.z.string().nullish(),
550
+ email: import_zod4.z.string().nullish(),
551
+ fingerprint: import_zod4.z.string().nullish()
552
+ });
615
553
  var CreateCustomerParamsSchema = import_zod4.z.object({
616
554
  id: import_zod4.z.string().nullish(),
617
555
  email: import_zod4.z.string().nullish(),
@@ -659,6 +597,44 @@ var RedeemReferralCodeParamsSchema = import_zod5.z.object({
659
597
  customer_id: import_zod5.z.string()
660
598
  });
661
599
 
600
+ // src/sdk/general/attachTypes.ts
601
+ var import_zod6 = require("zod");
602
+ var AttachFeatureOptionsSchema = import_zod6.z.object({
603
+ feature_id: import_zod6.z.string(),
604
+ quantity: import_zod6.z.number()
605
+ });
606
+ var AttachParamsSchema = import_zod6.z.object({
607
+ customer_id: import_zod6.z.string(),
608
+ product_id: import_zod6.z.string().optional(),
609
+ entity_id: import_zod6.z.string().optional(),
610
+ options: import_zod6.z.array(AttachFeatureOptionsSchema).optional(),
611
+ product_ids: import_zod6.z.array(import_zod6.z.string()).optional(),
612
+ free_trial: import_zod6.z.boolean().optional(),
613
+ success_url: import_zod6.z.string().optional(),
614
+ metadata: import_zod6.z.record(import_zod6.z.string()).optional(),
615
+ force_checkout: import_zod6.z.boolean().optional(),
616
+ customer_data: CustomerDataSchema.optional(),
617
+ entity_data: import_zod6.z.any().optional(),
618
+ checkout_session_params: import_zod6.z.record(import_zod6.z.any()).optional(),
619
+ reward: import_zod6.z.string().optional()
620
+ });
621
+ var AttachResultSchema = import_zod6.z.object({
622
+ checkout_url: import_zod6.z.string().optional(),
623
+ customer_id: import_zod6.z.string(),
624
+ product_ids: import_zod6.z.array(import_zod6.z.string()),
625
+ code: import_zod6.z.string(),
626
+ message: import_zod6.z.string(),
627
+ customer_data: import_zod6.z.any().optional()
628
+ });
629
+ var CheckoutParamsSchema = import_zod6.z.object({
630
+ customer_id: import_zod6.z.string(),
631
+ product_id: import_zod6.z.string(),
632
+ entity_id: import_zod6.z.string().optional(),
633
+ success_url: import_zod6.z.string().optional(),
634
+ customer_data: CustomerDataSchema.optional(),
635
+ options: import_zod6.z.array(AttachFeatureOptionsSchema).optional()
636
+ });
637
+
662
638
  // src/libraries/backend/utils/backendRes.ts
663
639
  var toBackendRes = ({ res }) => {
664
640
  let statusCode = res.statusCode ? res.statusCode : res.error ? 500 : 200;
@@ -745,6 +721,20 @@ var sanitizeBody = (body) => {
745
721
  delete bodyCopy.customer_data;
746
722
  return bodyCopy;
747
723
  };
724
+ var checkoutHandler = withAuth({
725
+ fn: async ({
726
+ autumn,
727
+ customer_id,
728
+ customer_data,
729
+ body
730
+ }) => {
731
+ return await autumn.checkout({
732
+ ...sanitizeBody(body),
733
+ customer_id,
734
+ customer_data
735
+ });
736
+ }
737
+ });
748
738
  var attachHandler = withAuth({
749
739
  fn: async ({
750
740
  autumn,
@@ -824,6 +814,9 @@ var openBillingPortalHandler = withAuth({
824
814
  }
825
815
  });
826
816
  var addGenRoutes = (router) => {
817
+ (0, import_rou3.addRoute)(router, "POST", `${BASE_PATH}/checkout`, {
818
+ handler: checkoutHandler
819
+ });
827
820
  (0, import_rou3.addRoute)(router, "POST", `${BASE_PATH}/attach`, {
828
821
  handler: attachHandler
829
822
  });
@@ -3,15 +3,15 @@ import {
3
3
  } from "./chunk-UNZHJTEY.mjs";
4
4
  import {
5
5
  createRouterWithOptions
6
- } from "./chunk-YFWJ6E4U.mjs";
7
- import "./chunk-RA4AC56B.mjs";
8
- import "./chunk-J3L3OBSS.mjs";
9
- import "./chunk-AKV5N4WO.mjs";
10
- import "./chunk-33NT3WE5.mjs";
11
- import "./chunk-CEZHD5H6.mjs";
6
+ } from "./chunk-ICPSX5WQ.mjs";
7
+ import "./chunk-HHMIVOXX.mjs";
8
+ import "./chunk-5EKNB4IJ.mjs";
9
+ import "./chunk-3OLXYDCU.mjs";
10
+ import "./chunk-K7JGEYUX.mjs";
11
+ import "./chunk-5H6HVCOP.mjs";
12
12
  import {
13
13
  Autumn
14
- } from "./chunk-6VS7TU7O.mjs";
14
+ } from "./chunk-IOSEAUDJ.mjs";
15
15
  import "./chunk-45WVZY23.mjs";
16
16
  import "./chunk-KSG3E4Q2.mjs";
17
17
  import "./chunk-6DZX6EAA.mjs";
@@ -62,6 +62,12 @@ var AutumnError = class _AutumnError extends Error {
62
62
  };
63
63
 
64
64
  // src/sdk/general/genMethods.ts
65
+ var handleCheckout = async ({
66
+ instance,
67
+ params
68
+ }) => {
69
+ return instance.post("/checkout", params);
70
+ };
65
71
  var handleAttach = async ({
66
72
  instance,
67
73
  params
@@ -80,18 +86,6 @@ var handleCancel = async ({
80
86
  }) => {
81
87
  return instance.post("/cancel", params);
82
88
  };
83
- var handleEntitled = async ({
84
- instance,
85
- params
86
- }) => {
87
- return instance.post("/entitled", params);
88
- };
89
- var handleEvent = async ({
90
- instance,
91
- params
92
- }) => {
93
- return instance.post("/events", params);
94
- };
95
89
  var handleTrack = async ({
96
90
  instance,
97
91
  params
@@ -439,6 +433,13 @@ var Autumn = class {
439
433
  products = productMethods(this);
440
434
  entities = entityMethods(this);
441
435
  referrals = referralMethods(this);
436
+ static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
437
+ async checkout(params) {
438
+ return handleCheckout({
439
+ instance: this,
440
+ params
441
+ });
442
+ }
442
443
  static attach = (params) => staticWrapper(handleAttach, void 0, { params });
443
444
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
444
445
  async attach(params) {
@@ -461,21 +462,6 @@ var Autumn = class {
461
462
  params
462
463
  });
463
464
  }
464
- /**
465
- * @deprecated This method is deprecated and will be removed in a future version.
466
- * Please use the new check() method instead.
467
- */
468
- static entitled = (params) => staticWrapper(handleEntitled, void 0, { params });
469
- /**
470
- * @deprecated This method is deprecated and will be removed in a future version.
471
- * Please use the new check() method instead.
472
- */
473
- async entitled(params) {
474
- return handleEntitled({
475
- instance: this,
476
- params
477
- });
478
- }
479
465
  static check = (params) => staticWrapper(handleCheck, void 0, { params });
480
466
  async check(params) {
481
467
  return handleCheck({
@@ -483,21 +469,6 @@ var Autumn = class {
483
469
  params
484
470
  });
485
471
  }
486
- /**
487
- * @deprecated This method is deprecated and will be removed in a future version.
488
- * Please use the new track() method instead.
489
- */
490
- static event = (params) => staticWrapper(handleEvent, void 0, { params });
491
- /**
492
- * @deprecated This method is deprecated and will be removed in a future version.
493
- * Please use the new track() method instead.
494
- */
495
- async event(params) {
496
- return handleEvent({
497
- instance: this,
498
- params
499
- });
500
- }
501
472
  static track = (params) => staticWrapper(handleTrack, void 0, { params });
502
473
  async track(params) {
503
474
  return handleTrack({
@@ -522,44 +493,6 @@ var EntityDataSchema = import_zod.z.object({
522
493
 
523
494
  // src/sdk/general/genTypes.ts
524
495
  var import_zod2 = require("zod");
525
- var AttachFeatureOptionsSchema = import_zod2.z.object({
526
- feature_id: import_zod2.z.string(),
527
- quantity: import_zod2.z.number()
528
- });
529
- var AttachParamsSchema = import_zod2.z.object({
530
- customer_id: import_zod2.z.string(),
531
- product_id: import_zod2.z.string().optional(),
532
- entity_id: import_zod2.z.string().optional(),
533
- options: import_zod2.z.array(
534
- import_zod2.z.object({
535
- feature_id: import_zod2.z.string(),
536
- quantity: import_zod2.z.number()
537
- })
538
- ).optional(),
539
- product_ids: import_zod2.z.array(import_zod2.z.string()).optional(),
540
- // If set, will attach multiple products to the customer (cannot be used with product_id)
541
- free_trial: import_zod2.z.boolean().optional(),
542
- // Default is true -- if set to false, will bypass product free trial
543
- success_url: import_zod2.z.string().optional(),
544
- // Passed to Stripe
545
- metadata: import_zod2.z.record(import_zod2.z.string()).optional(),
546
- // Passed to Stripe
547
- force_checkout: import_zod2.z.boolean().optional(),
548
- // Default is false -- if set to true, will force the customer to checkout (not allowed for upgrades / downgrades)
549
- customer_data: import_zod2.z.any().optional(),
550
- entity_data: import_zod2.z.any().optional(),
551
- checkout_session_params: import_zod2.z.record(import_zod2.z.any()).optional(),
552
- // Passed to Stripe
553
- reward: import_zod2.z.string().optional()
554
- });
555
- var AttachResultSchema = import_zod2.z.object({
556
- checkout_url: import_zod2.z.string().optional(),
557
- customer_id: import_zod2.z.string(),
558
- product_ids: import_zod2.z.array(import_zod2.z.string()),
559
- code: import_zod2.z.string(),
560
- message: import_zod2.z.string(),
561
- customer_data: import_zod2.z.any().optional()
562
- });
563
496
  var CancelParamsSchema = import_zod2.z.object({
564
497
  customer_id: import_zod2.z.string(),
565
498
  product_id: import_zod2.z.string(),
@@ -613,6 +546,11 @@ var CustomerExpandEnum = import_zod3.z.enum([
613
546
 
614
547
  // src/sdk/customers/cusTypes.ts
615
548
  var import_zod4 = require("zod");
549
+ var CustomerDataSchema = import_zod4.z.object({
550
+ name: import_zod4.z.string().nullish(),
551
+ email: import_zod4.z.string().nullish(),
552
+ fingerprint: import_zod4.z.string().nullish()
553
+ });
616
554
  var CreateCustomerParamsSchema = import_zod4.z.object({
617
555
  id: import_zod4.z.string().nullish(),
618
556
  email: import_zod4.z.string().nullish(),
@@ -660,6 +598,44 @@ var RedeemReferralCodeParamsSchema = import_zod5.z.object({
660
598
  customer_id: import_zod5.z.string()
661
599
  });
662
600
 
601
+ // src/sdk/general/attachTypes.ts
602
+ var import_zod6 = require("zod");
603
+ var AttachFeatureOptionsSchema = import_zod6.z.object({
604
+ feature_id: import_zod6.z.string(),
605
+ quantity: import_zod6.z.number()
606
+ });
607
+ var AttachParamsSchema = import_zod6.z.object({
608
+ customer_id: import_zod6.z.string(),
609
+ product_id: import_zod6.z.string().optional(),
610
+ entity_id: import_zod6.z.string().optional(),
611
+ options: import_zod6.z.array(AttachFeatureOptionsSchema).optional(),
612
+ product_ids: import_zod6.z.array(import_zod6.z.string()).optional(),
613
+ free_trial: import_zod6.z.boolean().optional(),
614
+ success_url: import_zod6.z.string().optional(),
615
+ metadata: import_zod6.z.record(import_zod6.z.string()).optional(),
616
+ force_checkout: import_zod6.z.boolean().optional(),
617
+ customer_data: CustomerDataSchema.optional(),
618
+ entity_data: import_zod6.z.any().optional(),
619
+ checkout_session_params: import_zod6.z.record(import_zod6.z.any()).optional(),
620
+ reward: import_zod6.z.string().optional()
621
+ });
622
+ var AttachResultSchema = import_zod6.z.object({
623
+ checkout_url: import_zod6.z.string().optional(),
624
+ customer_id: import_zod6.z.string(),
625
+ product_ids: import_zod6.z.array(import_zod6.z.string()),
626
+ code: import_zod6.z.string(),
627
+ message: import_zod6.z.string(),
628
+ customer_data: import_zod6.z.any().optional()
629
+ });
630
+ var CheckoutParamsSchema = import_zod6.z.object({
631
+ customer_id: import_zod6.z.string(),
632
+ product_id: import_zod6.z.string(),
633
+ entity_id: import_zod6.z.string().optional(),
634
+ success_url: import_zod6.z.string().optional(),
635
+ customer_data: CustomerDataSchema.optional(),
636
+ options: import_zod6.z.array(AttachFeatureOptionsSchema).optional()
637
+ });
638
+
663
639
  // src/libraries/backend/utils/backendRes.ts
664
640
  var toBackendRes = ({ res }) => {
665
641
  let statusCode = res.statusCode ? res.statusCode : res.error ? 500 : 200;
@@ -746,6 +722,20 @@ var sanitizeBody = (body) => {
746
722
  delete bodyCopy.customer_data;
747
723
  return bodyCopy;
748
724
  };
725
+ var checkoutHandler = withAuth({
726
+ fn: async ({
727
+ autumn,
728
+ customer_id,
729
+ customer_data,
730
+ body
731
+ }) => {
732
+ return await autumn.checkout({
733
+ ...sanitizeBody(body),
734
+ customer_id,
735
+ customer_data
736
+ });
737
+ }
738
+ });
749
739
  var attachHandler = withAuth({
750
740
  fn: async ({
751
741
  autumn,
@@ -825,6 +815,9 @@ var openBillingPortalHandler = withAuth({
825
815
  }
826
816
  });
827
817
  var addGenRoutes = (router) => {
818
+ (0, import_rou3.addRoute)(router, "POST", `${BASE_PATH}/checkout`, {
819
+ handler: checkoutHandler
820
+ });
828
821
  (0, import_rou3.addRoute)(router, "POST", `${BASE_PATH}/attach`, {
829
822
  handler: attachHandler
830
823
  });