autumn-js 0.0.65 → 0.0.67

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 (279) hide show
  1. package/dist/libraries/backend/chunk-45WVZY23.mjs +41 -0
  2. package/dist/libraries/backend/{chunk-FRL4IWBU.mjs → chunk-46YP3QFO.mjs} +5 -5
  3. package/dist/libraries/backend/{chunk-C2YFOJYP.mjs → chunk-6N4RVNZ5.mjs} +13 -8
  4. package/dist/libraries/backend/{chunk-NDN25XDG.mjs → chunk-6OVW4YXK.mjs} +1 -1
  5. package/dist/libraries/backend/{chunk-NDS3EHT3.mjs → chunk-AEEYR55J.mjs} +1 -1
  6. package/dist/libraries/backend/{chunk-W63TY2DI.mjs → chunk-BYAXY6C4.mjs} +69 -58
  7. package/dist/libraries/backend/{chunk-QXJ7YDTB.mjs → chunk-IZAQ6MUN.mjs} +1 -1
  8. package/dist/libraries/backend/express.d.mts +2 -2
  9. package/dist/libraries/backend/express.d.ts +2 -2
  10. package/dist/libraries/backend/express.js +123 -71
  11. package/dist/libraries/backend/express.mjs +7 -6
  12. package/dist/libraries/backend/fastify.js +123 -71
  13. package/dist/libraries/backend/fastify.mjs +7 -6
  14. package/dist/libraries/backend/hono.js +123 -71
  15. package/dist/libraries/backend/hono.mjs +7 -6
  16. package/dist/libraries/backend/next.js +207 -165
  17. package/dist/libraries/backend/next.mjs +101 -100
  18. package/dist/libraries/backend/react-router.js +123 -71
  19. package/dist/libraries/backend/react-router.mjs +7 -6
  20. package/dist/libraries/backend/{referralTypes-CJPslVLJ.d.ts → referralTypes-7NmhI47Z.d.mts} +8 -7
  21. package/dist/libraries/backend/{referralTypes-DmqKXhXe.d.mts → referralTypes-CURy8Tnw.d.ts} +8 -7
  22. package/dist/libraries/backend/remix_dep.js +123 -71
  23. package/dist/libraries/backend/remix_dep.mjs +7 -6
  24. package/dist/libraries/backend/{response-ByHPEnHs.d.mts → response-CV6KGWH5.d.mts} +1 -0
  25. package/dist/libraries/backend/{response-ByHPEnHs.d.ts → response-CV6KGWH5.d.ts} +1 -0
  26. package/dist/libraries/backend/routes/backendRouter.js +123 -70
  27. package/dist/libraries/backend/routes/backendRouter.mjs +7 -6
  28. package/dist/libraries/backend/routes/entityRoutes.js +122 -65
  29. package/dist/libraries/backend/routes/entityRoutes.mjs +5 -3
  30. package/dist/libraries/backend/routes/genRoutes.js +123 -70
  31. package/dist/libraries/backend/routes/genRoutes.mjs +4 -3
  32. package/dist/libraries/backend/routes/referralRoutes.js +123 -68
  33. package/dist/libraries/backend/routes/referralRoutes.mjs +4 -3
  34. package/dist/libraries/backend/supabase.js +123 -71
  35. package/dist/libraries/backend/supabase.mjs +7 -6
  36. package/dist/libraries/backend/tanstack.js +126 -72
  37. package/dist/libraries/backend/tanstack.mjs +10 -9
  38. package/dist/libraries/backend/utils/backendRes.d.mts +1 -1
  39. package/dist/libraries/backend/utils/backendRes.d.ts +1 -1
  40. package/dist/libraries/backend/utils/backendRes.js +113 -58
  41. package/dist/libraries/backend/utils/backendRes.mjs +3 -1
  42. package/dist/libraries/backend/utils/logBackendErrors.d.mts +5 -0
  43. package/dist/libraries/backend/utils/logBackendErrors.d.ts +5 -0
  44. package/dist/libraries/backend/utils/logBackendErrors.js +84 -0
  45. package/dist/libraries/backend/utils/logBackendErrors.mjs +14 -0
  46. package/dist/libraries/backend/utils/withAuth.d.mts +2 -2
  47. package/dist/libraries/backend/utils/withAuth.d.ts +2 -2
  48. package/dist/libraries/backend/utils/withAuth.js +122 -65
  49. package/dist/libraries/backend/utils/withAuth.mjs +4 -2
  50. package/dist/libraries/react/AutumnContext.d.mts +11 -15
  51. package/dist/libraries/react/AutumnContext.d.ts +11 -15
  52. package/dist/libraries/react/AutumnContext.js +177 -97
  53. package/dist/libraries/react/AutumnContext.mjs +4 -3
  54. package/dist/libraries/react/BaseAutumnProvider.d.mts +8 -5
  55. package/dist/libraries/react/BaseAutumnProvider.d.ts +8 -5
  56. package/dist/libraries/react/BaseAutumnProvider.js +241 -274
  57. package/dist/libraries/react/BaseAutumnProvider.mjs +7 -7
  58. package/dist/libraries/react/{ReactAutumnClient-DNcV0gAT.d.ts → ReactAutumnClient-BM8hrCEC.d.ts} +20 -28
  59. package/dist/libraries/react/{ReactAutumnClient-BQtmw21U.d.mts → ReactAutumnClient-EjsfCAgE.d.mts} +20 -28
  60. package/dist/libraries/react/ReactAutumnProvider.d.mts +1 -1
  61. package/dist/libraries/react/ReactAutumnProvider.d.ts +1 -1
  62. package/dist/libraries/react/ReactAutumnProvider.js +247 -276
  63. package/dist/libraries/react/ReactAutumnProvider.mjs +7 -8
  64. package/dist/libraries/react/{chunk-CZAUMPWK.mjs → chunk-2MVQH6J5.mjs} +10 -4
  65. package/dist/libraries/react/chunk-57I3B4BV.mjs +20 -0
  66. package/dist/libraries/react/chunk-5S5BL6HV.mjs +17 -0
  67. package/dist/libraries/react/chunk-A6J237PD.mjs +57 -0
  68. package/dist/{next/client/hooks/useEntityProvider.mjs → libraries/react/chunk-BGEO5REY.mjs} +12 -10
  69. package/dist/libraries/react/chunk-CIBQ4BJU.mjs +19 -0
  70. package/dist/libraries/react/{chunk-WPXLFYWT.mjs → chunk-CQ27LXPH.mjs} +35 -36
  71. package/dist/libraries/react/chunk-DMU3G7UZ.mjs +17 -0
  72. package/dist/libraries/react/{chunk-XTEUMENO.mjs → chunk-EOSHPHLH.mjs} +10 -22
  73. package/dist/libraries/react/chunk-IXVPNA4H.mjs +20 -0
  74. package/dist/libraries/react/{chunk-OCZFV7OX.mjs → chunk-JNJ53ZW6.mjs} +103 -55
  75. package/dist/libraries/react/{chunk-4TTWSWW7.mjs → chunk-NJFRQ6T4.mjs} +8 -37
  76. package/dist/libraries/react/chunk-PSE3LKMR.mjs +64 -0
  77. package/dist/libraries/react/{chunk-XXOQMNM6.mjs → chunk-XDAZD5HF.mjs} +46 -21
  78. package/dist/libraries/react/client/ReactAutumnClient.d.mts +4 -3
  79. package/dist/libraries/react/client/ReactAutumnClient.d.ts +4 -3
  80. package/dist/libraries/react/client/ReactAutumnClient.js +167 -75
  81. package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -2
  82. package/dist/libraries/react/client/clientCompMethods.d.mts +4 -3
  83. package/dist/libraries/react/client/clientCompMethods.d.ts +4 -3
  84. package/dist/libraries/react/client/clientCusMethods.d.mts +4 -3
  85. package/dist/libraries/react/client/clientCusMethods.d.ts +4 -3
  86. package/dist/libraries/react/client/clientEntityMethods.d.mts +4 -3
  87. package/dist/libraries/react/client/clientEntityMethods.d.ts +4 -3
  88. package/dist/libraries/react/client/clientGenMethods.d.mts +4 -3
  89. package/dist/libraries/react/client/clientGenMethods.d.ts +4 -3
  90. package/dist/libraries/react/client/clientReferralMethods.d.mts +4 -3
  91. package/dist/libraries/react/client/clientReferralMethods.d.ts +4 -3
  92. package/dist/libraries/react/client/types/clientGenTypes.d.mts +3 -2
  93. package/dist/libraries/react/client/types/clientGenTypes.d.ts +3 -2
  94. package/dist/libraries/react/componentTypes-HF9MRJPX.d.mts +15 -0
  95. package/dist/libraries/react/componentTypes-HF9MRJPX.d.ts +15 -0
  96. package/dist/libraries/react/{error-CG2LXoa7.d.ts → error-DHbclCVh.d.mts} +1 -0
  97. package/dist/libraries/react/{error-CG2LXoa7.d.mts → error-DHbclCVh.d.ts} +1 -0
  98. package/dist/libraries/react/errorUtils/logAuthError.d.mts +8 -0
  99. package/dist/libraries/react/errorUtils/logAuthError.d.ts +8 -0
  100. package/dist/libraries/react/{hooks/usePricingTableProvider.js → errorUtils/logAuthError.js} +128 -96
  101. package/dist/libraries/react/errorUtils/logAuthError.mjs +21 -0
  102. package/dist/libraries/react/errorUtils/logFetchError.d.mts +8 -0
  103. package/dist/libraries/react/errorUtils/logFetchError.d.ts +8 -0
  104. package/dist/libraries/react/errorUtils/logFetchError.js +42 -0
  105. package/dist/libraries/react/errorUtils/logFetchError.mjs +8 -0
  106. package/dist/libraries/react/hooks/useAutumn.d.mts +2 -2
  107. package/dist/libraries/react/hooks/useAutumn.d.ts +2 -2
  108. package/dist/libraries/react/hooks/useAutumn.js +264 -133
  109. package/dist/libraries/react/hooks/useAutumn.mjs +7 -4
  110. package/dist/libraries/react/hooks/useAutumnBase.d.mts +55 -0
  111. package/dist/libraries/react/hooks/useAutumnBase.d.ts +55 -0
  112. package/dist/libraries/react/hooks/useAutumnBase.js +944 -0
  113. package/dist/libraries/react/hooks/useAutumnBase.mjs +19 -0
  114. package/dist/libraries/react/hooks/useCustomer.d.mts +10 -17
  115. package/dist/libraries/react/hooks/useCustomer.d.ts +10 -17
  116. package/dist/libraries/react/hooks/useCustomer.js +224 -114
  117. package/dist/libraries/react/hooks/useCustomer.mjs +6 -4
  118. package/dist/libraries/react/hooks/useCustomerBase.d.mts +31 -0
  119. package/dist/libraries/react/hooks/useCustomerBase.d.ts +31 -0
  120. package/dist/libraries/react/hooks/{useEntityProvider.js → useCustomerBase.js} +419 -93
  121. package/dist/libraries/react/hooks/useCustomerBase.mjs +18 -0
  122. package/dist/libraries/react/hooks/useEntity.d.mts +4 -4
  123. package/dist/libraries/react/hooks/useEntity.d.ts +4 -4
  124. package/dist/libraries/react/hooks/useEntity.js +215 -140
  125. package/dist/libraries/react/hooks/useEntity.mjs +6 -5
  126. package/dist/libraries/react/hooks/useEntityBase.d.mts +25 -0
  127. package/dist/libraries/react/hooks/useEntityBase.d.ts +25 -0
  128. package/dist/libraries/react/hooks/useEntityBase.js +87 -0
  129. package/dist/libraries/react/hooks/useEntityBase.mjs +8 -0
  130. package/dist/libraries/react/hooks/usePricingTable.d.mts +8 -12
  131. package/dist/libraries/react/hooks/usePricingTable.d.ts +8 -12
  132. package/dist/libraries/react/hooks/usePricingTable.js +211 -113
  133. package/dist/libraries/react/hooks/usePricingTable.mjs +6 -4
  134. package/dist/libraries/react/hooks/usePricingTableBase.d.mts +27 -0
  135. package/dist/libraries/react/hooks/usePricingTableBase.d.ts +27 -0
  136. package/dist/libraries/react/hooks/usePricingTableBase.js +810 -0
  137. package/dist/libraries/react/hooks/usePricingTableBase.mjs +18 -0
  138. package/dist/libraries/react/index.d.mts +8 -5
  139. package/dist/libraries/react/index.d.ts +8 -5
  140. package/dist/libraries/react/index.js +380 -408
  141. package/dist/libraries/react/index.mjs +16 -15
  142. package/dist/libraries/react/{response-B1KyqUB9.d.ts → response-B2MqTR7X.d.ts} +4 -4
  143. package/dist/libraries/react/{response-B5dHU3I9.d.mts → response-By38xiUq.d.mts} +4 -4
  144. package/dist/libraries/react/utils/compareParams.mjs +18 -3
  145. package/dist/next/AutumnProvider.js +2 -2
  146. package/dist/next/AutumnProvider.mjs +2 -2
  147. package/dist/next/client/AutumnClientProvider.d.mts +2 -0
  148. package/dist/next/client/AutumnClientProvider.d.ts +2 -0
  149. package/dist/next/client/NextAutumnClient.d.mts +81 -0
  150. package/dist/next/client/NextAutumnClient.d.ts +81 -0
  151. package/dist/next/client/NextAutumnClient.js +95 -0
  152. package/dist/next/client/NextAutumnClient.mjs +95 -0
  153. package/dist/next/client/NextAutumnProvider.d.mts +10 -0
  154. package/dist/next/client/NextAutumnProvider.d.ts +10 -0
  155. package/dist/next/client/NextAutumnProvider.js +21 -0
  156. package/dist/next/client/NextAutumnProvider.mjs +21 -0
  157. package/dist/next/client/clientEntTypes-ClSxkMvK.d.mts +29 -0
  158. package/dist/next/client/clientEntTypes-DuYXyCN4.d.ts +29 -0
  159. package/dist/next/client/clientGenTypes-BvnGc6fc.d.mts +156 -0
  160. package/dist/next/client/clientGenTypes-F8OKtPMU.d.ts +156 -0
  161. package/dist/next/client/clientReferralTypes-C9JiOk2s.d.mts +20 -0
  162. package/dist/next/client/clientReferralTypes-C9JiOk2s.d.ts +20 -0
  163. package/dist/next/client/clientUtils.d.mts +2 -2
  164. package/dist/next/client/clientUtils.d.ts +2 -2
  165. package/dist/next/client/componentTypes-HF9MRJPX.d.mts +15 -0
  166. package/dist/next/client/componentTypes-HF9MRJPX.d.ts +15 -0
  167. package/dist/next/client/{cusTypes-sh5_cN7N.d.ts → cusTypes-D9vXDh6B.d.mts} +23 -1
  168. package/dist/next/client/{cusTypes-sh5_cN7N.d.mts → cusTypes-D9vXDh6B.d.ts} +23 -1
  169. package/dist/next/client/{entTypes-C9TNWMk6.d.mts → entTypes-C2xwPhrH.d.mts} +5 -2
  170. package/dist/next/client/{entTypes-BDqnMLZ4.d.ts → entTypes-D5Bk72AS.d.ts} +5 -2
  171. package/dist/next/client/error-DHbclCVh.d.mts +17 -0
  172. package/dist/next/client/error-DHbclCVh.d.ts +17 -0
  173. package/dist/next/client/hooks/useAutumn.d.mts +41 -33
  174. package/dist/next/client/hooks/useAutumn.d.ts +41 -33
  175. package/dist/next/client/hooks/useAutumn.js +3 -236
  176. package/dist/next/client/hooks/useAutumn.mjs +3 -236
  177. package/dist/next/client/hooks/useCustomer.d.mts +19 -20
  178. package/dist/next/client/hooks/useCustomer.d.ts +19 -20
  179. package/dist/next/client/hooks/useCustomer.js +6 -120
  180. package/dist/next/client/hooks/useCustomer.mjs +6 -120
  181. package/dist/next/client/hooks/useEntity.d.mts +5 -5
  182. package/dist/next/client/hooks/useEntity.d.ts +5 -5
  183. package/dist/next/client/hooks/useEntity.js +3 -2
  184. package/dist/next/client/hooks/useEntity.mjs +3 -2
  185. package/dist/next/client/hooks/usePricingTable.d.mts +16 -14
  186. package/dist/next/client/hooks/usePricingTable.d.ts +16 -14
  187. package/dist/next/client/hooks/usePricingTable.js +4 -50
  188. package/dist/next/client/hooks/usePricingTable.mjs +4 -50
  189. package/dist/next/client/types.d.mts +2 -2
  190. package/dist/next/client/types.d.ts +2 -2
  191. package/dist/next/index.d.mts +363 -131
  192. package/dist/next/index.d.ts +363 -131
  193. package/dist/next/index.js +13 -8
  194. package/dist/next/index.mjs +6 -4
  195. package/dist/next/server/auth/handleAuthProvider.d.mts +2 -2
  196. package/dist/next/server/auth/handleAuthProvider.d.ts +2 -2
  197. package/dist/next/server/auth/supabase-wrapper.d.mts +1 -3
  198. package/dist/next/server/auth/supabase-wrapper.d.ts +1 -3
  199. package/dist/next/server/auth/{withAuth.d.mts → withNextAuth.d.mts} +1 -1
  200. package/dist/next/server/auth/{withAuth.d.ts → withNextAuth.d.ts} +1 -1
  201. package/dist/next/server/clientEntTypes-CWr4xXQ1.d.mts +14 -0
  202. package/dist/next/server/clientEntTypes-CWr4xXQ1.d.ts +14 -0
  203. package/dist/next/server/componentActions.d.mts +1 -1
  204. package/dist/next/server/componentActions.d.ts +1 -1
  205. package/dist/next/server/componentActions.js +1 -1
  206. package/dist/next/server/componentActions.mjs +1 -1
  207. package/dist/next/server/cusActions.d.mts +213 -14
  208. package/dist/next/server/cusActions.d.ts +213 -14
  209. package/dist/next/server/cusActions.js +12 -22
  210. package/dist/next/server/cusActions.mjs +12 -22
  211. package/dist/next/server/{cusTypes-BD42O-7Z.d.mts → cusTypes-DYgbKGrd.d.mts} +1 -1
  212. package/dist/next/server/{cusTypes-BD42O-7Z.d.ts → cusTypes-DYgbKGrd.d.ts} +1 -1
  213. package/dist/next/server/genActions.d.mts +41 -25
  214. package/dist/next/server/genActions.d.ts +41 -25
  215. package/dist/next/server/genActions.js +14 -60
  216. package/dist/next/server/genActions.mjs +14 -60
  217. package/dist/next/server/{response-BCg7kiiN.d.mts → response-eH4S4sg0.d.mts} +1 -0
  218. package/dist/next/server/{response-BCg7kiiN.d.ts → response-eH4S4sg0.d.ts} +1 -0
  219. package/dist/next/server/utils.d.mts +1 -1
  220. package/dist/next/server/utils.d.ts +1 -1
  221. package/dist/sdk/check.d.mts +3 -3
  222. package/dist/sdk/check.d.ts +3 -3
  223. package/dist/sdk/general.d.mts +4 -3
  224. package/dist/sdk/general.d.ts +4 -3
  225. package/dist/sdk/index.d.mts +9 -4
  226. package/dist/sdk/index.d.ts +9 -4
  227. package/dist/sdk/index.js +106 -71
  228. package/dist/sdk/index.mjs +102 -71
  229. package/dist/utils/chunk-V7R5DCYR.mjs +41 -0
  230. package/dist/utils/encryptUtils.js +103 -55
  231. package/dist/utils/encryptUtils.mjs +69 -55
  232. package/dist/utils/logger.d.mts +45 -0
  233. package/dist/utils/logger.d.ts +45 -0
  234. package/dist/utils/logger.js +75 -0
  235. package/dist/utils/logger.mjs +6 -0
  236. package/dist/utils/toSnakeCase.d.mts +3 -0
  237. package/dist/utils/toSnakeCase.d.ts +3 -0
  238. package/dist/utils/toSnakeCase.js +45 -0
  239. package/dist/utils/toSnakeCase.mjs +20 -0
  240. package/package.json +4 -5
  241. package/tsup.config.ts +1 -6
  242. package/dist/libraries/react/chunk-5CBWPVSP.mjs +0 -51
  243. package/dist/libraries/react/chunk-DFXUEQ6D.mjs +0 -33
  244. package/dist/libraries/react/chunk-PIIGEXKQ.mjs +0 -77
  245. package/dist/libraries/react/chunk-Q5SSQSDP.mjs +0 -48
  246. package/dist/libraries/react/chunk-RIXRUJDK.mjs +0 -38
  247. package/dist/libraries/react/chunk-URAFNMTH.mjs +0 -48
  248. package/dist/libraries/react/chunk-VN4AVW2V.mjs +0 -24
  249. package/dist/libraries/react/hooks/useCustomerProvider.d.mts +0 -28
  250. package/dist/libraries/react/hooks/useCustomerProvider.d.ts +0 -28
  251. package/dist/libraries/react/hooks/useCustomerProvider.js +0 -100
  252. package/dist/libraries/react/hooks/useCustomerProvider.mjs +0 -8
  253. package/dist/libraries/react/hooks/useEntityProvider.d.mts +0 -33
  254. package/dist/libraries/react/hooks/useEntityProvider.d.ts +0 -33
  255. package/dist/libraries/react/hooks/useEntityProvider.mjs +0 -9
  256. package/dist/libraries/react/hooks/usePricingTableProvider.d.mts +0 -19
  257. package/dist/libraries/react/hooks/usePricingTableProvider.d.ts +0 -19
  258. package/dist/libraries/react/hooks/usePricingTableProvider.mjs +0 -9
  259. package/dist/next/client/AutumnContext.d.mts +0 -9
  260. package/dist/next/client/AutumnContext.d.ts +0 -9
  261. package/dist/next/client/AutumnContext.js +0 -47
  262. package/dist/next/client/AutumnContext.mjs +0 -47
  263. package/dist/next/client/AutumnProvider.d.mts +0 -11
  264. package/dist/next/client/AutumnProvider.d.ts +0 -11
  265. package/dist/next/client/AutumnProvider.js +0 -117
  266. package/dist/next/client/AutumnProvider.mjs +0 -117
  267. package/dist/next/client/clientEntTypes-pqnB95m3.d.mts +0 -9
  268. package/dist/next/client/clientEntTypes-pqnB95m3.d.ts +0 -9
  269. package/dist/next/client/hooks/types.d.mts +0 -26
  270. package/dist/next/client/hooks/types.d.ts +0 -26
  271. package/dist/next/client/hooks/useEntityProvider.d.mts +0 -11
  272. package/dist/next/client/hooks/useEntityProvider.d.ts +0 -11
  273. package/dist/next/client/hooks/useEntityProvider.js +0 -52
  274. package/dist/next/server/clientEntTypes-CPVfO1bd.d.mts +0 -215
  275. package/dist/next/server/clientEntTypes-JLwH7X3l.d.ts +0 -215
  276. /package/dist/next/client/{hooks/types.js → AutumnClientProvider.js} +0 -0
  277. /package/dist/next/client/{hooks/types.mjs → AutumnClientProvider.mjs} +0 -0
  278. /package/dist/next/server/auth/{withAuth.js → withNextAuth.js} +0 -0
  279. /package/dist/next/server/auth/{withAuth.mjs → withNextAuth.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { C as CustomerData } from '../cusTypes-BD42O-7Z.js';
1
+ import { C as CustomerData } from '../cusTypes-DYgbKGrd.js';
2
2
 
3
3
  declare const withAuth: <T extends {
4
4
  customerId?: string;
@@ -0,0 +1,14 @@
1
+ interface CreateEntityParams {
2
+ id: string;
3
+ name: string;
4
+ featureId: string;
5
+ }
6
+ interface GetEntityParams {
7
+ expand?: string[];
8
+ }
9
+ interface EntityDataParams {
10
+ name?: string;
11
+ featureId: string;
12
+ }
13
+
14
+ export type { CreateEntityParams as C, EntityDataParams as E, GetEntityParams as G };
@@ -0,0 +1,14 @@
1
+ interface CreateEntityParams {
2
+ id: string;
3
+ name: string;
4
+ featureId: string;
5
+ }
6
+ interface GetEntityParams {
7
+ expand?: string[];
8
+ }
9
+ interface EntityDataParams {
10
+ name?: string;
11
+ featureId: string;
12
+ }
13
+
14
+ export type { CreateEntityParams as C, EntityDataParams as E, GetEntityParams as G };
@@ -1,4 +1,4 @@
1
- import { C as CustomerData } from './cusTypes-BD42O-7Z.mjs';
1
+ import { C as CustomerData } from './cusTypes-DYgbKGrd.mjs';
2
2
 
3
3
  declare const getPricingTableAction: (args: Omit<{
4
4
  customerId?: string;
@@ -1,4 +1,4 @@
1
- import { C as CustomerData } from './cusTypes-BD42O-7Z.js';
1
+ import { C as CustomerData } from './cusTypes-DYgbKGrd.js';
2
2
 
3
3
  declare const getPricingTableAction: (args: Omit<{
4
4
  customerId?: string;
@@ -1,5 +1,5 @@
1
1
  "use server";
2
- import { withAuth } from "./auth/withAuth";
2
+ import { withAuth } from "./auth/withNextAuth";
3
3
  import { createAutumnClient } from "./cusActions";
4
4
  import { fetchPricingTable } from "../../sdk";
5
5
  import { toServerResponse } from "./utils";
@@ -1,5 +1,5 @@
1
1
  "use server";
2
- import { withAuth } from "./auth/withAuth";
2
+ import { withAuth } from "./auth/withNextAuth";
3
3
  import { createAutumnClient } from "./cusActions";
4
4
  import { fetchPricingTable } from "../../sdk";
5
5
  import { toServerResponse } from "./utils";
@@ -1,21 +1,226 @@
1
- import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult, j as GetEntityParams$1 } from './clientEntTypes-CPVfO1bd.mjs';
2
- import { R as Result, A as AutumnError } from './response-BCg7kiiN.mjs';
3
- import { G as GetCustomerParams, a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, C as CustomerData } from './cusTypes-BD42O-7Z.mjs';
1
+ import { a as CustomerProduct, b as CustomerFeature, c as CustomerInvoice, C as CustomerData, A as AppEnv, I as Infinite, P as ProductItemIntervalType, U as UsageModel, F as FreeTrialDuration, d as UsageModelType, G as GetCustomerParams, e as Customer, f as CreateCustomerParams, g as UpdateCustomerParams, B as BillingPortalParams, h as BillingPortalResponse } from './cusTypes-DYgbKGrd.mjs';
2
+ import { R as Result, A as AutumnError } from './response-eH4S4sg0.mjs';
3
+ import { G as GetEntityParams$1, C as CreateEntityParams$1 } from './clientEntTypes-CWr4xXQ1.mjs';
4
+
5
+ type EntityExpandOption = "invoices";
6
+
7
+ interface CreateEntityParams {
8
+ id: string;
9
+ name: string;
10
+ feature_id: string;
11
+ customer_data?: CustomerData;
12
+ }
13
+ interface CreateEntityResult {
14
+ success: boolean;
15
+ }
16
+ interface DeleteEntityResult {
17
+ success: boolean;
18
+ }
19
+ interface GetEntityParams {
20
+ expand?: EntityExpandOption[];
21
+ }
22
+ interface Entity {
23
+ id: string;
24
+ name: string;
25
+ customer_id: string;
26
+ created_at: number;
27
+ env: string;
28
+ products: CustomerProduct[];
29
+ features: Record<string, CustomerFeature>;
30
+ invoices?: CustomerInvoice[];
31
+ }
32
+ interface EntityData {
33
+ name?: string;
34
+ feature_id: string;
35
+ }
36
+
37
+ interface ProductItem {
38
+ feature_id?: string;
39
+ included_usage?: number | typeof Infinite;
40
+ interval?: ProductItemIntervalType;
41
+ usage_model?: UsageModel;
42
+ price?: number;
43
+ billing_units?: number;
44
+ entity_feature_id?: string;
45
+ reset_usage_on_billing?: boolean;
46
+ reset_usage_when_enabled?: boolean;
47
+ }
48
+ interface FreeTrial {
49
+ duration: FreeTrialDuration;
50
+ length: number;
51
+ unique_fingerprint: boolean;
52
+ }
53
+ interface Product {
54
+ autumn_id: string;
55
+ created_at: number;
56
+ id: string;
57
+ name: string;
58
+ env: AppEnv;
59
+ is_add_on: boolean;
60
+ is_default: boolean;
61
+ group: string;
62
+ version: number;
63
+ items: ProductItem[];
64
+ free_trial: FreeTrial | null;
65
+ }
66
+ interface CreateProductParams {
67
+ id: string;
68
+ name?: string;
69
+ is_add_on?: boolean;
70
+ is_default?: boolean;
71
+ items?: ProductItem[];
72
+ free_trial?: FreeTrial;
73
+ }
74
+ interface ListProductsParams {
75
+ }
76
+
77
+ type CheckFeatureScenario = "usage_limit" | "feature_flag";
78
+ interface CheckFeaturePreview {
79
+ scenario: CheckFeatureScenario;
80
+ title: string;
81
+ message: string;
82
+ feature_id: string;
83
+ feature_name: string;
84
+ products: Product[];
85
+ }
86
+ type CheckProductScenario = "scheduled" | "active" | "new" | "renew" | "upgrade" | "downgrade" | "cancel";
87
+ interface CheckProductPreview {
88
+ scenario: CheckProductScenario;
89
+ product_id: string;
90
+ product_name: string;
91
+ recurring: boolean;
92
+ error_on_attach?: boolean;
93
+ next_cycle_at?: number;
94
+ current_product_name?: string;
95
+ items?: {
96
+ price: string;
97
+ description: string;
98
+ usage_model?: UsageModelType;
99
+ }[];
100
+ options?: {
101
+ feature_id: string;
102
+ feature_name: string;
103
+ billing_units: number;
104
+ price?: number;
105
+ tiers?: {
106
+ to: number | string;
107
+ amount: number;
108
+ }[];
109
+ }[];
110
+ due_today?: {
111
+ price: number;
112
+ currency: string;
113
+ };
114
+ due_next_cycle?: {
115
+ price: number;
116
+ currency: string;
117
+ };
118
+ }
119
+
120
+ interface AttachFeatureOptions {
121
+ feature_id: string;
122
+ quantity: number;
123
+ }
124
+ interface AttachParams {
125
+ customer_id: string;
126
+ product_id?: string;
127
+ entity_id?: string;
128
+ options?: AttachFeatureOptions[];
129
+ product_ids?: string[];
130
+ free_trial?: boolean;
131
+ success_url?: string;
132
+ metadata?: Record<string, string>;
133
+ force_checkout?: boolean;
134
+ customer_data?: CustomerData;
135
+ entity_data?: EntityData;
136
+ checkout_session_params?: Record<string, any>;
137
+ reward?: string;
138
+ }
139
+ interface CancelParams {
140
+ customer_id: string;
141
+ product_id: string;
142
+ entity_id?: string;
143
+ cancel_immediately?: boolean;
144
+ }
145
+ interface CancelResult {
146
+ success: boolean;
147
+ customer_id: string;
148
+ product_id: string;
149
+ }
150
+ interface AttachResult {
151
+ checkout_url?: string;
152
+ customer_id: string;
153
+ product_ids: string[];
154
+ code: string;
155
+ message: string;
156
+ customer_data?: CustomerData;
157
+ }
158
+ interface TrackParams {
159
+ customer_id: string;
160
+ value?: number;
161
+ feature_id?: string;
162
+ event_name?: string;
163
+ entity_id?: string;
164
+ customer_data?: CustomerData;
165
+ idempotency_key?: string;
166
+ entity_data?: EntityData;
167
+ }
168
+ interface TrackResult {
169
+ id: string;
170
+ code: string;
171
+ customer_id: string;
172
+ feature_id?: string;
173
+ event_name?: string;
174
+ }
175
+ interface CheckParams {
176
+ customer_id: string;
177
+ feature_id?: string;
178
+ product_id?: string;
179
+ entity_id?: string;
180
+ customer_data?: CustomerData;
181
+ required_balance?: number;
182
+ send_event?: boolean;
183
+ with_preview?: boolean;
184
+ entity_data?: EntityData;
185
+ }
186
+ interface CheckResult {
187
+ customer_id: string;
188
+ allowed: boolean;
189
+ code: string;
190
+ feature_id?: string;
191
+ required_balance?: number;
192
+ unlimited?: boolean;
193
+ balance?: number | null;
194
+ product_id?: string;
195
+ status?: string;
196
+ preview?: CheckProductPreview | CheckFeaturePreview;
197
+ }
198
+ interface UsageParams {
199
+ customer_id: string;
200
+ feature_id: string;
201
+ value: number;
202
+ customer_data?: CustomerData;
203
+ }
204
+ interface UsageResult {
205
+ code: string;
206
+ customer_id: string;
207
+ feature_id: string;
208
+ }
4
209
 
5
210
  declare class Autumn {
6
211
  private readonly secretKey;
7
212
  private readonly publishableKey;
8
- private level;
9
213
  private headers;
10
214
  private url;
215
+ private logger;
11
216
  constructor(options?: {
12
217
  secretKey?: string;
13
218
  publishableKey?: string;
14
219
  url?: string;
15
220
  version?: string;
16
221
  headers?: Record<string, string>;
222
+ logLevel?: string;
17
223
  });
18
- getLevel(): "secret" | "publishable";
19
224
  get(path: string): Promise<Result<any, AutumnError>>;
20
225
  post(path: string, body: any): Promise<Result<any, AutumnError>>;
21
226
  delete(path: string): Promise<Result<any, AutumnError>>;
@@ -103,19 +308,13 @@ interface RedeemReferralCodeParams {
103
308
  }
104
309
 
105
310
  declare const createAutumnClient: (publishableKey?: string) => Autumn;
106
- declare const getOrCreateCustomer: (args: Omit<{
311
+ declare const createCusAction: (args: Omit<{
107
312
  customerId: string;
108
313
  customerData?: CustomerData;
109
314
  params?: CreateCustomerParams;
110
315
  }, "customerId"> & {
111
316
  encryptedCustomerId?: string;
112
317
  }, request?: Request) => Promise<any>;
113
- declare const getCustomer: (args: Omit<{
114
- customerId: string;
115
- params?: GetCustomerParams;
116
- }, "customerId"> & {
117
- encryptedCustomerId?: string;
118
- }, request?: Request) => Promise<any>;
119
318
  declare const getEntityAction: (args: Omit<{
120
319
  customerId: string;
121
320
  entityId: string;
@@ -125,7 +324,7 @@ declare const getEntityAction: (args: Omit<{
125
324
  }, request?: Request) => Promise<any>;
126
325
  declare const createEntityAction: (args: Omit<{
127
326
  customerId: string;
128
- entity: CreateEntityParams | CreateEntityParams[];
327
+ entity: CreateEntityParams$1 | CreateEntityParams$1[];
129
328
  }, "customerId"> & {
130
329
  encryptedCustomerId?: string;
131
330
  }, request?: Request) => Promise<any>;
@@ -136,4 +335,4 @@ declare const deleteEntityAction: (args: Omit<{
136
335
  encryptedCustomerId?: string;
137
336
  }, request?: Request) => Promise<any>;
138
337
 
139
- export { createAutumnClient, createEntityAction, deleteEntityAction, getCustomer, getEntityAction, getOrCreateCustomer };
338
+ export { createAutumnClient, createCusAction, createEntityAction, deleteEntityAction, getEntityAction };
@@ -1,21 +1,226 @@
1
- import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult, j as GetEntityParams$1 } from './clientEntTypes-JLwH7X3l.js';
2
- import { R as Result, A as AutumnError } from './response-BCg7kiiN.js';
3
- import { G as GetCustomerParams, a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, C as CustomerData } from './cusTypes-BD42O-7Z.js';
1
+ import { a as CustomerProduct, b as CustomerFeature, c as CustomerInvoice, C as CustomerData, A as AppEnv, I as Infinite, P as ProductItemIntervalType, U as UsageModel, F as FreeTrialDuration, d as UsageModelType, G as GetCustomerParams, e as Customer, f as CreateCustomerParams, g as UpdateCustomerParams, B as BillingPortalParams, h as BillingPortalResponse } from './cusTypes-DYgbKGrd.js';
2
+ import { R as Result, A as AutumnError } from './response-eH4S4sg0.js';
3
+ import { G as GetEntityParams$1, C as CreateEntityParams$1 } from './clientEntTypes-CWr4xXQ1.js';
4
+
5
+ type EntityExpandOption = "invoices";
6
+
7
+ interface CreateEntityParams {
8
+ id: string;
9
+ name: string;
10
+ feature_id: string;
11
+ customer_data?: CustomerData;
12
+ }
13
+ interface CreateEntityResult {
14
+ success: boolean;
15
+ }
16
+ interface DeleteEntityResult {
17
+ success: boolean;
18
+ }
19
+ interface GetEntityParams {
20
+ expand?: EntityExpandOption[];
21
+ }
22
+ interface Entity {
23
+ id: string;
24
+ name: string;
25
+ customer_id: string;
26
+ created_at: number;
27
+ env: string;
28
+ products: CustomerProduct[];
29
+ features: Record<string, CustomerFeature>;
30
+ invoices?: CustomerInvoice[];
31
+ }
32
+ interface EntityData {
33
+ name?: string;
34
+ feature_id: string;
35
+ }
36
+
37
+ interface ProductItem {
38
+ feature_id?: string;
39
+ included_usage?: number | typeof Infinite;
40
+ interval?: ProductItemIntervalType;
41
+ usage_model?: UsageModel;
42
+ price?: number;
43
+ billing_units?: number;
44
+ entity_feature_id?: string;
45
+ reset_usage_on_billing?: boolean;
46
+ reset_usage_when_enabled?: boolean;
47
+ }
48
+ interface FreeTrial {
49
+ duration: FreeTrialDuration;
50
+ length: number;
51
+ unique_fingerprint: boolean;
52
+ }
53
+ interface Product {
54
+ autumn_id: string;
55
+ created_at: number;
56
+ id: string;
57
+ name: string;
58
+ env: AppEnv;
59
+ is_add_on: boolean;
60
+ is_default: boolean;
61
+ group: string;
62
+ version: number;
63
+ items: ProductItem[];
64
+ free_trial: FreeTrial | null;
65
+ }
66
+ interface CreateProductParams {
67
+ id: string;
68
+ name?: string;
69
+ is_add_on?: boolean;
70
+ is_default?: boolean;
71
+ items?: ProductItem[];
72
+ free_trial?: FreeTrial;
73
+ }
74
+ interface ListProductsParams {
75
+ }
76
+
77
+ type CheckFeatureScenario = "usage_limit" | "feature_flag";
78
+ interface CheckFeaturePreview {
79
+ scenario: CheckFeatureScenario;
80
+ title: string;
81
+ message: string;
82
+ feature_id: string;
83
+ feature_name: string;
84
+ products: Product[];
85
+ }
86
+ type CheckProductScenario = "scheduled" | "active" | "new" | "renew" | "upgrade" | "downgrade" | "cancel";
87
+ interface CheckProductPreview {
88
+ scenario: CheckProductScenario;
89
+ product_id: string;
90
+ product_name: string;
91
+ recurring: boolean;
92
+ error_on_attach?: boolean;
93
+ next_cycle_at?: number;
94
+ current_product_name?: string;
95
+ items?: {
96
+ price: string;
97
+ description: string;
98
+ usage_model?: UsageModelType;
99
+ }[];
100
+ options?: {
101
+ feature_id: string;
102
+ feature_name: string;
103
+ billing_units: number;
104
+ price?: number;
105
+ tiers?: {
106
+ to: number | string;
107
+ amount: number;
108
+ }[];
109
+ }[];
110
+ due_today?: {
111
+ price: number;
112
+ currency: string;
113
+ };
114
+ due_next_cycle?: {
115
+ price: number;
116
+ currency: string;
117
+ };
118
+ }
119
+
120
+ interface AttachFeatureOptions {
121
+ feature_id: string;
122
+ quantity: number;
123
+ }
124
+ interface AttachParams {
125
+ customer_id: string;
126
+ product_id?: string;
127
+ entity_id?: string;
128
+ options?: AttachFeatureOptions[];
129
+ product_ids?: string[];
130
+ free_trial?: boolean;
131
+ success_url?: string;
132
+ metadata?: Record<string, string>;
133
+ force_checkout?: boolean;
134
+ customer_data?: CustomerData;
135
+ entity_data?: EntityData;
136
+ checkout_session_params?: Record<string, any>;
137
+ reward?: string;
138
+ }
139
+ interface CancelParams {
140
+ customer_id: string;
141
+ product_id: string;
142
+ entity_id?: string;
143
+ cancel_immediately?: boolean;
144
+ }
145
+ interface CancelResult {
146
+ success: boolean;
147
+ customer_id: string;
148
+ product_id: string;
149
+ }
150
+ interface AttachResult {
151
+ checkout_url?: string;
152
+ customer_id: string;
153
+ product_ids: string[];
154
+ code: string;
155
+ message: string;
156
+ customer_data?: CustomerData;
157
+ }
158
+ interface TrackParams {
159
+ customer_id: string;
160
+ value?: number;
161
+ feature_id?: string;
162
+ event_name?: string;
163
+ entity_id?: string;
164
+ customer_data?: CustomerData;
165
+ idempotency_key?: string;
166
+ entity_data?: EntityData;
167
+ }
168
+ interface TrackResult {
169
+ id: string;
170
+ code: string;
171
+ customer_id: string;
172
+ feature_id?: string;
173
+ event_name?: string;
174
+ }
175
+ interface CheckParams {
176
+ customer_id: string;
177
+ feature_id?: string;
178
+ product_id?: string;
179
+ entity_id?: string;
180
+ customer_data?: CustomerData;
181
+ required_balance?: number;
182
+ send_event?: boolean;
183
+ with_preview?: boolean;
184
+ entity_data?: EntityData;
185
+ }
186
+ interface CheckResult {
187
+ customer_id: string;
188
+ allowed: boolean;
189
+ code: string;
190
+ feature_id?: string;
191
+ required_balance?: number;
192
+ unlimited?: boolean;
193
+ balance?: number | null;
194
+ product_id?: string;
195
+ status?: string;
196
+ preview?: CheckProductPreview | CheckFeaturePreview;
197
+ }
198
+ interface UsageParams {
199
+ customer_id: string;
200
+ feature_id: string;
201
+ value: number;
202
+ customer_data?: CustomerData;
203
+ }
204
+ interface UsageResult {
205
+ code: string;
206
+ customer_id: string;
207
+ feature_id: string;
208
+ }
4
209
 
5
210
  declare class Autumn {
6
211
  private readonly secretKey;
7
212
  private readonly publishableKey;
8
- private level;
9
213
  private headers;
10
214
  private url;
215
+ private logger;
11
216
  constructor(options?: {
12
217
  secretKey?: string;
13
218
  publishableKey?: string;
14
219
  url?: string;
15
220
  version?: string;
16
221
  headers?: Record<string, string>;
222
+ logLevel?: string;
17
223
  });
18
- getLevel(): "secret" | "publishable";
19
224
  get(path: string): Promise<Result<any, AutumnError>>;
20
225
  post(path: string, body: any): Promise<Result<any, AutumnError>>;
21
226
  delete(path: string): Promise<Result<any, AutumnError>>;
@@ -103,19 +308,13 @@ interface RedeemReferralCodeParams {
103
308
  }
104
309
 
105
310
  declare const createAutumnClient: (publishableKey?: string) => Autumn;
106
- declare const getOrCreateCustomer: (args: Omit<{
311
+ declare const createCusAction: (args: Omit<{
107
312
  customerId: string;
108
313
  customerData?: CustomerData;
109
314
  params?: CreateCustomerParams;
110
315
  }, "customerId"> & {
111
316
  encryptedCustomerId?: string;
112
317
  }, request?: Request) => Promise<any>;
113
- declare const getCustomer: (args: Omit<{
114
- customerId: string;
115
- params?: GetCustomerParams;
116
- }, "customerId"> & {
117
- encryptedCustomerId?: string;
118
- }, request?: Request) => Promise<any>;
119
318
  declare const getEntityAction: (args: Omit<{
120
319
  customerId: string;
121
320
  entityId: string;
@@ -125,7 +324,7 @@ declare const getEntityAction: (args: Omit<{
125
324
  }, request?: Request) => Promise<any>;
126
325
  declare const createEntityAction: (args: Omit<{
127
326
  customerId: string;
128
- entity: CreateEntityParams | CreateEntityParams[];
327
+ entity: CreateEntityParams$1 | CreateEntityParams$1[];
129
328
  }, "customerId"> & {
130
329
  encryptedCustomerId?: string;
131
330
  }, request?: Request) => Promise<any>;
@@ -136,4 +335,4 @@ declare const deleteEntityAction: (args: Omit<{
136
335
  encryptedCustomerId?: string;
137
336
  }, request?: Request) => Promise<any>;
138
337
 
139
- export { createAutumnClient, createEntityAction, deleteEntityAction, getCustomer, getEntityAction, getOrCreateCustomer };
338
+ export { createAutumnClient, createCusAction, createEntityAction, deleteEntityAction, getEntityAction };
@@ -1,19 +1,18 @@
1
1
  "use server";
2
- import {
3
- Autumn
4
- } from "../../sdk";
5
- import { withAuth } from "./auth/withAuth";
2
+ import { Autumn } from "../../sdk";
3
+ import { withAuth } from "./auth/withNextAuth";
6
4
  import { toServerResponse } from "./utils";
5
+ import { toSnakeCase } from "../../utils/toSnakeCase";
7
6
  const createAutumnClient = (publishableKey) => {
8
7
  return new Autumn({
9
8
  publishableKey
10
9
  });
11
10
  };
12
- const getOrCreateCustomer = withAuth({
11
+ const createCusAction = withAuth({
13
12
  fn: async ({
14
13
  customerId,
15
14
  customerData,
16
- params
15
+ ...params
17
16
  }) => {
18
17
  const autumn = createAutumnClient();
19
18
  const result = await autumn.customers.create({
@@ -25,27 +24,18 @@ const getOrCreateCustomer = withAuth({
25
24
  },
26
25
  withCustomerData: true
27
26
  });
28
- const getCustomer = withAuth({
29
- fn: async ({
30
- customerId,
31
- params
32
- }) => {
33
- const autumn = createAutumnClient();
34
- const result = await autumn.customers.get(customerId, params);
35
- return toServerResponse(result);
36
- }
37
- });
38
27
  const getEntityAction = withAuth({
39
28
  fn: async ({
40
29
  customerId,
41
30
  entityId,
42
- params
31
+ ...params
43
32
  }) => {
44
33
  const autumn = createAutumnClient();
34
+ let snakeParams = toSnakeCase(params);
45
35
  const result = await autumn.entities.get(
46
36
  customerId,
47
37
  entityId,
48
- params
38
+ snakeParams
49
39
  );
50
40
  return toServerResponse(result);
51
41
  }
@@ -56,7 +46,8 @@ const createEntityAction = withAuth({
56
46
  entity
57
47
  }) => {
58
48
  const autumn = createAutumnClient();
59
- const result = await autumn.entities.create(customerId, entity);
49
+ let snakeEntity = toSnakeCase(entity);
50
+ const result = await autumn.entities.create(customerId, snakeEntity);
60
51
  return toServerResponse(result);
61
52
  }
62
53
  });
@@ -72,9 +63,8 @@ const deleteEntityAction = withAuth({
72
63
  });
73
64
  export {
74
65
  createAutumnClient,
66
+ createCusAction,
75
67
  createEntityAction,
76
68
  deleteEntityAction,
77
- getCustomer,
78
- getEntityAction,
79
- getOrCreateCustomer
69
+ getEntityAction
80
70
  };