autumn-js 0.0.66 → 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-p6A_PZbz.d.ts → referralTypes-7NmhI47Z.d.mts} +7 -7
  21. package/dist/libraries/backend/{referralTypes-BdY-EkkQ.d.mts → referralTypes-CURy8Tnw.d.ts} +7 -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-KHU4NOQJ.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.js → libraries/react/chunk-BGEO5REY.mjs} +12 -10
  69. package/dist/libraries/react/chunk-CIBQ4BJU.mjs +19 -0
  70. package/dist/libraries/react/{chunk-O4SNGQNB.mjs → chunk-CQ27LXPH.mjs} +35 -36
  71. package/dist/libraries/react/chunk-DMU3G7UZ.mjs +17 -0
  72. package/dist/libraries/react/{chunk-ILWLFCTA.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-PW6WFMLB.mjs → chunk-NJFRQ6T4.mjs} +7 -36
  76. package/dist/libraries/react/chunk-PSE3LKMR.mjs +64 -0
  77. package/dist/libraries/react/{chunk-STABYMUY.mjs → chunk-XDAZD5HF.mjs} +48 -23
  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 +2 -2
  93. package/dist/libraries/react/client/types/clientGenTypes.d.ts +2 -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 +14 -13
  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 -132
  192. package/dist/next/index.d.ts +363 -132
  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 -26
  214. package/dist/next/server/genActions.d.ts +41 -26
  215. package/dist/next/server/genActions.js +14 -62
  216. package/dist/next/server/genActions.mjs +14 -62
  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 +3 -3
  224. package/dist/sdk/general.d.ts +3 -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-5LNSASJV.mjs +0 -33
  243. package/dist/libraries/react/chunk-CZA5WF64.mjs +0 -51
  244. package/dist/libraries/react/chunk-PIIGEXKQ.mjs +0 -77
  245. package/dist/libraries/react/chunk-PYM4YPRD.mjs +0 -38
  246. package/dist/libraries/react/chunk-Q5SSQSDP.mjs +0 -48
  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 -27
  270. package/dist/next/client/hooks/types.d.ts +0 -27
  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.mjs +0 -52
  274. package/dist/next/server/clientEntTypes-B3DRcw3U.d.mts +0 -216
  275. package/dist/next/server/clientEntTypes-BRUTcNUD.d.ts +0 -216
  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,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
  };
@@ -117,4 +117,4 @@ interface CustomerInvoice {
117
117
  created_at: number;
118
118
  }
119
119
 
120
- export { AppEnv as A, type BillingPortalParams as B, type CustomerData as C, FreeTrialDuration as F, type GetCustomerParams as G, Infinite as I, type ProductItemIntervalType as P, type UpdateCustomerParams as U, type Customer as a, type CreateCustomerParams as b, type BillingPortalResponse as c, type CustomerProduct as d, type CustomerFeature as e, type CustomerInvoice as f, UsageModel as g, type UsageModelType as h };
120
+ export { AppEnv as A, type BillingPortalParams as B, type CustomerData as C, FreeTrialDuration as F, type GetCustomerParams as G, Infinite as I, type ProductItemIntervalType as P, UsageModel as U, type CustomerProduct as a, type CustomerFeature as b, type CustomerInvoice as c, type UsageModelType as d, type Customer as e, type CreateCustomerParams as f, type UpdateCustomerParams as g, type BillingPortalResponse as h };
@@ -117,4 +117,4 @@ interface CustomerInvoice {
117
117
  created_at: number;
118
118
  }
119
119
 
120
- export { AppEnv as A, type BillingPortalParams as B, type CustomerData as C, FreeTrialDuration as F, type GetCustomerParams as G, Infinite as I, type ProductItemIntervalType as P, type UpdateCustomerParams as U, type Customer as a, type CreateCustomerParams as b, type BillingPortalResponse as c, type CustomerProduct as d, type CustomerFeature as e, type CustomerInvoice as f, UsageModel as g, type UsageModelType as h };
120
+ export { AppEnv as A, type BillingPortalParams as B, type CustomerData as C, FreeTrialDuration as F, type GetCustomerParams as G, Infinite as I, type ProductItemIntervalType as P, UsageModel as U, type CustomerProduct as a, type CustomerFeature as b, type CustomerInvoice as c, type UsageModelType as d, type Customer as e, type CreateCustomerParams as f, type UpdateCustomerParams as g, type BillingPortalResponse as h };
@@ -1,23 +1,51 @@
1
- import { k as AttachFeatureOptions, l as EntityDataParams } from './clientEntTypes-B3DRcw3U.mjs';
2
- import { C as CustomerData, B as BillingPortalParams } from './cusTypes-BD42O-7Z.mjs';
1
+ import { C as CustomerData, B as BillingPortalParams } from './cusTypes-DYgbKGrd.mjs';
2
+ import { E as EntityDataParams } from './clientEntTypes-CWr4xXQ1.mjs';
3
3
 
4
+ interface AttachFeatureOptions {
5
+ featureId: string;
6
+ quantity: number;
7
+ }
8
+ interface AttachParams {
9
+ productId?: string;
10
+ entityId?: string;
11
+ options?: AttachFeatureOptions[];
12
+ productIds?: string[];
13
+ freeTrial?: boolean;
14
+ successUrl?: string;
15
+ metadata?: Record<string, string>;
16
+ forceCheckout?: boolean;
17
+ dialog?: (data: any) => JSX.Element | React.ReactNode;
18
+ entityData?: EntityDataParams;
19
+ openInNewTab?: boolean;
20
+ reward?: string;
21
+ }
4
22
  interface CancelParams {
5
23
  productId: string;
6
24
  entityId?: string;
7
25
  cancelImmediately?: boolean;
8
26
  }
27
+ interface CheckParams {
28
+ featureId?: string;
29
+ productId?: string;
30
+ entityId?: string;
31
+ requiredBalance?: number;
32
+ sendEvent?: boolean;
33
+ withPreview?: boolean;
34
+ dialog?: (data: any) => JSX.Element | React.ReactNode;
35
+ entityData?: EntityDataParams;
36
+ }
37
+ interface TrackParams {
38
+ featureId?: string;
39
+ eventName?: string;
40
+ entityId?: string;
41
+ value?: number;
42
+ idempotencyKey?: string;
43
+ entityData?: EntityDataParams;
44
+ }
9
45
 
10
- declare const attachAction: (args: Omit<{
46
+ declare const attachAction: (args: Omit<AttachParams & {
11
47
  customerId: string;
12
48
  customerData?: CustomerData;
13
- productId: string;
14
- entityId?: string;
15
- successUrl?: string;
16
- options?: AttachFeatureOptions[];
17
- forceCheckout?: boolean;
18
- metadata?: Record<string, string>;
19
- entityData?: EntityDataParams;
20
- reward?: string;
21
49
  }, "customerId"> & {
22
50
  encryptedCustomerId?: string;
23
51
  }, request?: Request) => Promise<any>;
@@ -26,28 +54,15 @@ declare const cancelAction: (args: Omit<CancelParams & {
26
54
  }, "customerId"> & {
27
55
  encryptedCustomerId?: string;
28
56
  }, request?: Request) => Promise<any>;
29
- declare const checkAction: (args: Omit<{
57
+ declare const checkAction: (args: Omit<CheckParams & {
30
58
  customerId: string;
31
59
  customerData?: CustomerData;
32
- featureId?: string;
33
- productId?: string;
34
- entityId?: string;
35
- requiredBalance?: number;
36
- sendEvent?: boolean;
37
- withPreview?: "raw" | "formatted";
38
- entityData?: EntityDataParams;
39
60
  }, "customerId"> & {
40
61
  encryptedCustomerId?: string;
41
62
  }, request?: Request) => Promise<any>;
42
- declare const trackAction: (args: Omit<{
63
+ declare const trackAction: (args: Omit<TrackParams & {
43
64
  customerId: string;
44
65
  customerData?: CustomerData;
45
- featureId?: string;
46
- entityId?: string;
47
- value?: number;
48
- eventName?: string;
49
- idempotencyKey?: string;
50
- entityData?: EntityDataParams;
51
66
  }, "customerId"> & {
52
67
  encryptedCustomerId?: string;
53
68
  }, request?: Request) => Promise<any>;
@@ -1,23 +1,51 @@
1
- import { k as AttachFeatureOptions, l as EntityDataParams } from './clientEntTypes-BRUTcNUD.js';
2
- import { C as CustomerData, B as BillingPortalParams } from './cusTypes-BD42O-7Z.js';
1
+ import { C as CustomerData, B as BillingPortalParams } from './cusTypes-DYgbKGrd.js';
2
+ import { E as EntityDataParams } from './clientEntTypes-CWr4xXQ1.js';
3
3
 
4
+ interface AttachFeatureOptions {
5
+ featureId: string;
6
+ quantity: number;
7
+ }
8
+ interface AttachParams {
9
+ productId?: string;
10
+ entityId?: string;
11
+ options?: AttachFeatureOptions[];
12
+ productIds?: string[];
13
+ freeTrial?: boolean;
14
+ successUrl?: string;
15
+ metadata?: Record<string, string>;
16
+ forceCheckout?: boolean;
17
+ dialog?: (data: any) => JSX.Element | React.ReactNode;
18
+ entityData?: EntityDataParams;
19
+ openInNewTab?: boolean;
20
+ reward?: string;
21
+ }
4
22
  interface CancelParams {
5
23
  productId: string;
6
24
  entityId?: string;
7
25
  cancelImmediately?: boolean;
8
26
  }
27
+ interface CheckParams {
28
+ featureId?: string;
29
+ productId?: string;
30
+ entityId?: string;
31
+ requiredBalance?: number;
32
+ sendEvent?: boolean;
33
+ withPreview?: boolean;
34
+ dialog?: (data: any) => JSX.Element | React.ReactNode;
35
+ entityData?: EntityDataParams;
36
+ }
37
+ interface TrackParams {
38
+ featureId?: string;
39
+ eventName?: string;
40
+ entityId?: string;
41
+ value?: number;
42
+ idempotencyKey?: string;
43
+ entityData?: EntityDataParams;
44
+ }
9
45
 
10
- declare const attachAction: (args: Omit<{
46
+ declare const attachAction: (args: Omit<AttachParams & {
11
47
  customerId: string;
12
48
  customerData?: CustomerData;
13
- productId: string;
14
- entityId?: string;
15
- successUrl?: string;
16
- options?: AttachFeatureOptions[];
17
- forceCheckout?: boolean;
18
- metadata?: Record<string, string>;
19
- entityData?: EntityDataParams;
20
- reward?: string;
21
49
  }, "customerId"> & {
22
50
  encryptedCustomerId?: string;
23
51
  }, request?: Request) => Promise<any>;
@@ -26,28 +54,15 @@ declare const cancelAction: (args: Omit<CancelParams & {
26
54
  }, "customerId"> & {
27
55
  encryptedCustomerId?: string;
28
56
  }, request?: Request) => Promise<any>;
29
- declare const checkAction: (args: Omit<{
57
+ declare const checkAction: (args: Omit<CheckParams & {
30
58
  customerId: string;
31
59
  customerData?: CustomerData;
32
- featureId?: string;
33
- productId?: string;
34
- entityId?: string;
35
- requiredBalance?: number;
36
- sendEvent?: boolean;
37
- withPreview?: "raw" | "formatted";
38
- entityData?: EntityDataParams;
39
60
  }, "customerId"> & {
40
61
  encryptedCustomerId?: string;
41
62
  }, request?: Request) => Promise<any>;
42
- declare const trackAction: (args: Omit<{
63
+ declare const trackAction: (args: Omit<TrackParams & {
43
64
  customerId: string;
44
65
  customerData?: CustomerData;
45
- featureId?: string;
46
- entityId?: string;
47
- value?: number;
48
- eventName?: string;
49
- idempotencyKey?: string;
50
- entityData?: EntityDataParams;
51
66
  }, "customerId"> & {
52
67
  encryptedCustomerId?: string;
53
68
  }, request?: Request) => Promise<any>;
@@ -1,33 +1,15 @@
1
1
  "use server";
2
2
  import { createAutumnClient } from "../server/cusActions";
3
- import { withAuth } from "./auth/withAuth";
3
+ import { withAuth } from "./auth/withNextAuth";
4
4
  import { toServerResponse } from "./utils";
5
- import { toSnakeCase } from "../../libraries/react/utils/toSnakeCase";
5
+ import { toSnakeCase } from "../../utils/toSnakeCase";
6
6
  const attachAction = withAuth({
7
- fn: async ({
8
- customerId,
9
- customerData,
10
- productId,
11
- entityId,
12
- options,
13
- successUrl,
14
- forceCheckout,
15
- metadata,
16
- entityData,
17
- reward
18
- }) => {
7
+ fn: async (params) => {
19
8
  const autumn = createAutumnClient();
20
9
  let res = await autumn.attach({
21
- customer_id: customerId,
22
- customer_data: customerData,
23
- product_id: productId,
24
- success_url: successUrl,
25
- options,
26
- force_checkout: forceCheckout,
27
- metadata,
28
- entity_id: entityId,
29
- entity_data: entityData ? { ...entityData, feature_id: entityData.featureId } : void 0,
30
- reward
10
+ customer_id: params.customerId,
11
+ customer_data: params.customerData,
12
+ ...toSnakeCase(params)
31
13
  });
32
14
  return toServerResponse(res);
33
15
  },
@@ -41,54 +23,24 @@ const cancelAction = withAuth({
41
23
  }
42
24
  });
43
25
  const checkAction = withAuth({
44
- fn: async ({
45
- customerId,
46
- customerData,
47
- featureId,
48
- productId,
49
- entityId,
50
- requiredBalance,
51
- sendEvent,
52
- withPreview,
53
- entityData
54
- }) => {
26
+ fn: async (params) => {
55
27
  const autumn = createAutumnClient();
56
28
  let res = await autumn.check({
57
- customer_id: customerId,
58
- feature_id: featureId,
59
- product_id: productId,
60
- entity_id: entityId,
61
- required_balance: requiredBalance,
62
- send_event: sendEvent,
63
- with_preview: withPreview,
64
- customer_data: customerData,
65
- entity_data: entityData ? { ...entityData, feature_id: entityData.featureId } : void 0
29
+ customer_id: params.customerId,
30
+ customer_data: params.customerData,
31
+ ...toSnakeCase(params)
66
32
  });
67
33
  return toServerResponse(res);
68
34
  },
69
35
  withCustomerData: true
70
36
  });
71
37
  const trackAction = withAuth({
72
- fn: async ({
73
- customerId,
74
- featureId,
75
- entityId,
76
- value,
77
- eventName,
78
- idempotencyKey,
79
- customerData,
80
- entityData
81
- }) => {
38
+ fn: async (params) => {
82
39
  const autumn = createAutumnClient();
83
40
  let res = await autumn.track({
84
- customer_id: customerId,
85
- feature_id: featureId,
86
- entity_id: entityId,
87
- value,
88
- event_name: eventName,
89
- idempotency_key: idempotencyKey,
90
- customer_data: customerData,
91
- entity_data: entityData ? { ...entityData, feature_id: entityData.featureId } : void 0
41
+ customer_id: params.customerId,
42
+ customer_data: params.customerData,
43
+ ...toSnakeCase(params)
92
44
  });
93
45
  return toServerResponse(res);
94
46
  },
@@ -1,33 +1,15 @@
1
1
  "use server";
2
2
  import { createAutumnClient } from "../server/cusActions";
3
- import { withAuth } from "./auth/withAuth";
3
+ import { withAuth } from "./auth/withNextAuth";
4
4
  import { toServerResponse } from "./utils";
5
- import { toSnakeCase } from "../../libraries/react/utils/toSnakeCase";
5
+ import { toSnakeCase } from "../../utils/toSnakeCase";
6
6
  const attachAction = withAuth({
7
- fn: async ({
8
- customerId,
9
- customerData,
10
- productId,
11
- entityId,
12
- options,
13
- successUrl,
14
- forceCheckout,
15
- metadata,
16
- entityData,
17
- reward
18
- }) => {
7
+ fn: async (params) => {
19
8
  const autumn = createAutumnClient();
20
9
  let res = await autumn.attach({
21
- customer_id: customerId,
22
- customer_data: customerData,
23
- product_id: productId,
24
- success_url: successUrl,
25
- options,
26
- force_checkout: forceCheckout,
27
- metadata,
28
- entity_id: entityId,
29
- entity_data: entityData ? { ...entityData, feature_id: entityData.featureId } : void 0,
30
- reward
10
+ customer_id: params.customerId,
11
+ customer_data: params.customerData,
12
+ ...toSnakeCase(params)
31
13
  });
32
14
  return toServerResponse(res);
33
15
  },
@@ -41,54 +23,24 @@ const cancelAction = withAuth({
41
23
  }
42
24
  });
43
25
  const checkAction = withAuth({
44
- fn: async ({
45
- customerId,
46
- customerData,
47
- featureId,
48
- productId,
49
- entityId,
50
- requiredBalance,
51
- sendEvent,
52
- withPreview,
53
- entityData
54
- }) => {
26
+ fn: async (params) => {
55
27
  const autumn = createAutumnClient();
56
28
  let res = await autumn.check({
57
- customer_id: customerId,
58
- feature_id: featureId,
59
- product_id: productId,
60
- entity_id: entityId,
61
- required_balance: requiredBalance,
62
- send_event: sendEvent,
63
- with_preview: withPreview,
64
- customer_data: customerData,
65
- entity_data: entityData ? { ...entityData, feature_id: entityData.featureId } : void 0
29
+ customer_id: params.customerId,
30
+ customer_data: params.customerData,
31
+ ...toSnakeCase(params)
66
32
  });
67
33
  return toServerResponse(res);
68
34
  },
69
35
  withCustomerData: true
70
36
  });
71
37
  const trackAction = withAuth({
72
- fn: async ({
73
- customerId,
74
- featureId,
75
- entityId,
76
- value,
77
- eventName,
78
- idempotencyKey,
79
- customerData,
80
- entityData
81
- }) => {
38
+ fn: async (params) => {
82
39
  const autumn = createAutumnClient();
83
40
  let res = await autumn.track({
84
- customer_id: customerId,
85
- feature_id: featureId,
86
- entity_id: entityId,
87
- value,
88
- event_name: eventName,
89
- idempotency_key: idempotencyKey,
90
- customer_data: customerData,
91
- entity_data: entityData ? { ...entityData, feature_id: entityData.featureId } : void 0
41
+ customer_id: params.customerId,
42
+ customer_data: params.customerData,
43
+ ...toSnakeCase(params)
92
44
  });
93
45
  return toServerResponse(res);
94
46
  },
@@ -6,6 +6,7 @@ declare class AutumnError extends Error {
6
6
  readonly message: string;
7
7
  readonly code: string;
8
8
  constructor(response: ErrorResponse);
9
+ static fromError(error: any): AutumnError;
9
10
  toString(): string;
10
11
  toJSON(): {
11
12
  message: string;
@@ -6,6 +6,7 @@ declare class AutumnError extends Error {
6
6
  readonly message: string;
7
7
  readonly code: string;
8
8
  constructor(response: ErrorResponse);
9
+ static fromError(error: any): AutumnError;
9
10
  toString(): string;
10
11
  toJSON(): {
11
12
  message: string;
@@ -1,4 +1,4 @@
1
- import { R as Result, A as AutumnError, E as ErrorResponse } from './response-BCg7kiiN.mjs';
1
+ import { R as Result, A as AutumnError, E as ErrorResponse } from './response-eH4S4sg0.mjs';
2
2
 
3
3
  declare const toServerResponse: <T>(result: Result<T, AutumnError>) => Result<T, ErrorResponse>;
4
4
 
@@ -1,4 +1,4 @@
1
- import { R as Result, A as AutumnError, E as ErrorResponse } from './response-BCg7kiiN.js';
1
+ import { R as Result, A as AutumnError, E as ErrorResponse } from './response-eH4S4sg0.js';
2
2
 
3
3
  declare const toServerResponse: <T>(result: Result<T, AutumnError>) => Result<T, ErrorResponse>;
4
4
 
@@ -2,7 +2,7 @@ import { a as UsageModelType } from './prodEnums-C1lccCWI.mjs';
2
2
  import { Product } from './products.mjs';
3
3
 
4
4
  type CheckFeatureScenario = "usage_limit" | "feature_flag";
5
- interface CheckFeatureFormattedPreview {
5
+ interface CheckFeaturePreview {
6
6
  scenario: CheckFeatureScenario;
7
7
  title: string;
8
8
  message: string;
@@ -11,7 +11,7 @@ interface CheckFeatureFormattedPreview {
11
11
  products: Product[];
12
12
  }
13
13
  type CheckProductScenario = "scheduled" | "active" | "new" | "renew" | "upgrade" | "downgrade" | "cancel";
14
- interface CheckProductFormattedPreview {
14
+ interface CheckProductPreview {
15
15
  scenario: CheckProductScenario;
16
16
  product_id: string;
17
17
  product_name: string;
@@ -44,4 +44,4 @@ interface CheckProductFormattedPreview {
44
44
  };
45
45
  }
46
46
 
47
- export type { CheckFeatureFormattedPreview, CheckFeatureScenario, CheckProductFormattedPreview, CheckProductScenario };
47
+ export type { CheckFeaturePreview, CheckFeatureScenario, CheckProductPreview, CheckProductScenario };
@@ -2,7 +2,7 @@ import { a as UsageModelType } from './prodEnums-C1lccCWI.js';
2
2
  import { Product } from './products.js';
3
3
 
4
4
  type CheckFeatureScenario = "usage_limit" | "feature_flag";
5
- interface CheckFeatureFormattedPreview {
5
+ interface CheckFeaturePreview {
6
6
  scenario: CheckFeatureScenario;
7
7
  title: string;
8
8
  message: string;
@@ -11,7 +11,7 @@ interface CheckFeatureFormattedPreview {
11
11
  products: Product[];
12
12
  }
13
13
  type CheckProductScenario = "scheduled" | "active" | "new" | "renew" | "upgrade" | "downgrade" | "cancel";
14
- interface CheckProductFormattedPreview {
14
+ interface CheckProductPreview {
15
15
  scenario: CheckProductScenario;
16
16
  product_id: string;
17
17
  product_name: string;
@@ -44,4 +44,4 @@ interface CheckProductFormattedPreview {
44
44
  };
45
45
  }
46
46
 
47
- export type { CheckFeatureFormattedPreview, CheckFeatureScenario, CheckProductFormattedPreview, CheckProductScenario };
47
+ export type { CheckFeaturePreview, CheckFeatureScenario, CheckProductPreview, CheckProductScenario };
@@ -1,6 +1,6 @@
1
1
  import { e as CustomerData } from './cusTypes-wBxbodEe.mjs';
2
2
  import { b as EntityData } from './entTypes-CJjjWn54.mjs';
3
- import { CheckProductFormattedPreview, CheckFeatureFormattedPreview } from './check.mjs';
3
+ import { CheckProductPreview, CheckFeaturePreview } from './check.mjs';
4
4
  import './prodEnums-C1lccCWI.mjs';
5
5
  import './products.mjs';
6
6
 
@@ -67,7 +67,7 @@ interface CheckParams {
67
67
  customer_data?: CustomerData;
68
68
  required_balance?: number;
69
69
  send_event?: boolean;
70
- with_preview?: "raw" | "formatted";
70
+ with_preview?: boolean;
71
71
  entity_data?: EntityData;
72
72
  }
73
73
  interface CheckResult {
@@ -80,7 +80,7 @@ interface CheckResult {
80
80
  balance?: number | null;
81
81
  product_id?: string;
82
82
  status?: string;
83
- preview?: CheckProductFormattedPreview | CheckFeatureFormattedPreview;
83
+ preview?: CheckProductPreview | CheckFeaturePreview;
84
84
  }
85
85
  interface EntitledBalance {
86
86
  feature_id: string;
@@ -1,6 +1,6 @@
1
1
  import { e as CustomerData } from './cusTypes-BTV6ui4e.js';
2
2
  import { b as EntityData } from './entTypes-BwLV9Jn4.js';
3
- import { CheckProductFormattedPreview, CheckFeatureFormattedPreview } from './check.js';
3
+ import { CheckProductPreview, CheckFeaturePreview } from './check.js';
4
4
  import './prodEnums-C1lccCWI.js';
5
5
  import './products.js';
6
6
 
@@ -67,7 +67,7 @@ interface CheckParams {
67
67
  customer_data?: CustomerData;
68
68
  required_balance?: number;
69
69
  send_event?: boolean;
70
- with_preview?: "raw" | "formatted";
70
+ with_preview?: boolean;
71
71
  entity_data?: EntityData;
72
72
  }
73
73
  interface CheckResult {
@@ -80,7 +80,7 @@ interface CheckResult {
80
80
  balance?: number | null;
81
81
  product_id?: string;
82
82
  status?: string;
83
- preview?: CheckProductFormattedPreview | CheckFeatureFormattedPreview;
83
+ preview?: CheckProductPreview | CheckFeaturePreview;
84
84
  }
85
85
  interface EntitledBalance {
86
86
  feature_id: string;
@@ -1,5 +1,6 @@
1
1
  import { AttachParams, AttachResult, UsageParams, UsageResult, CancelParams, CancelResult, CheckParams, CheckResult, TrackParams, TrackResult } from './general.mjs';
2
2
  export { AttachFeatureOptions, EntitledBalance } from './general.mjs';
3
+ import { Logger } from 'pino';
3
4
  import { Product, CreateProductParams, ListProductsParams } from './products.mjs';
4
5
  export { FreeTrial, PriceTier, ProductItem } from './products.mjs';
5
6
  import { G as GetCustomerParams, C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-wBxbodEe.mjs';
@@ -8,7 +9,7 @@ import { G as GetEntityParams, E as Entity, C as CreateEntityParams, a as Create
8
9
  export { b as EntityData, c as EntityExpandOption } from './entTypes-CJjjWn54.mjs';
9
10
  import { CreateReferralCodeParams, RedeemReferralCodeParams } from './referrals.mjs';
10
11
  export { CreateReferralCodeResult, RedeemReferralCodeResult } from './referrals.mjs';
11
- export { CheckFeatureFormattedPreview, CheckFeatureScenario, CheckProductFormattedPreview, CheckProductScenario } from './check.mjs';
12
+ export { CheckFeaturePreview, CheckFeatureScenario, CheckProductPreview, CheckProductScenario } from './check.mjs';
12
13
  export { A as AppEnv, F as FreeTrialDuration, I as Infinite, P as ProductItemInterval, b as ProductItemIntervalType, U as UsageModel, a as UsageModelType } from './prodEnums-C1lccCWI.mjs';
13
14
 
14
15
  interface ErrorResponse {
@@ -19,6 +20,7 @@ declare class AutumnError extends Error {
19
20
  readonly message: string;
20
21
  readonly code: string;
21
22
  constructor(response: ErrorResponse);
23
+ static fromError(error: any): AutumnError;
22
24
  toString(): string;
23
25
  toJSON(): {
24
26
  message: string;
@@ -36,24 +38,27 @@ type Failure<E> = {
36
38
  error: E;
37
39
  statusCode?: number;
38
40
  };
39
- declare const toContainerResult: (response: Response) => Promise<Result<any, AutumnError>>;
41
+ declare const toContainerResult: ({ response, logger }: {
42
+ response: Response;
43
+ logger: Logger | Console;
44
+ }) => Promise<Result<any, AutumnError>>;
40
45
  type Result<T, E> = Success<T> | Failure<E>;
41
46
  type AutumnPromise<T> = Promise<Result<T, AutumnError>>;
42
47
 
43
48
  declare class Autumn {
44
49
  private readonly secretKey;
45
50
  private readonly publishableKey;
46
- private level;
47
51
  private headers;
48
52
  private url;
53
+ private logger;
49
54
  constructor(options?: {
50
55
  secretKey?: string;
51
56
  publishableKey?: string;
52
57
  url?: string;
53
58
  version?: string;
54
59
  headers?: Record<string, string>;
60
+ logLevel?: string;
55
61
  });
56
- getLevel(): "secret" | "publishable";
57
62
  get(path: string): Promise<Result<any, AutumnError>>;
58
63
  post(path: string, body: any): Promise<Result<any, AutumnError>>;
59
64
  delete(path: string): Promise<Result<any, AutumnError>>;