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.
- package/dist/libraries/backend/chunk-45WVZY23.mjs +41 -0
- package/dist/libraries/backend/{chunk-FRL4IWBU.mjs → chunk-46YP3QFO.mjs} +5 -5
- package/dist/libraries/backend/{chunk-C2YFOJYP.mjs → chunk-6N4RVNZ5.mjs} +13 -8
- package/dist/libraries/backend/{chunk-NDN25XDG.mjs → chunk-6OVW4YXK.mjs} +1 -1
- package/dist/libraries/backend/{chunk-NDS3EHT3.mjs → chunk-AEEYR55J.mjs} +1 -1
- package/dist/libraries/backend/{chunk-W63TY2DI.mjs → chunk-BYAXY6C4.mjs} +69 -58
- package/dist/libraries/backend/{chunk-QXJ7YDTB.mjs → chunk-IZAQ6MUN.mjs} +1 -1
- package/dist/libraries/backend/express.d.mts +2 -2
- package/dist/libraries/backend/express.d.ts +2 -2
- package/dist/libraries/backend/express.js +123 -71
- package/dist/libraries/backend/express.mjs +7 -6
- package/dist/libraries/backend/fastify.js +123 -71
- package/dist/libraries/backend/fastify.mjs +7 -6
- package/dist/libraries/backend/hono.js +123 -71
- package/dist/libraries/backend/hono.mjs +7 -6
- package/dist/libraries/backend/next.js +207 -165
- package/dist/libraries/backend/next.mjs +101 -100
- package/dist/libraries/backend/react-router.js +123 -71
- package/dist/libraries/backend/react-router.mjs +7 -6
- package/dist/libraries/backend/{referralTypes-p6A_PZbz.d.ts → referralTypes-7NmhI47Z.d.mts} +7 -7
- package/dist/libraries/backend/{referralTypes-BdY-EkkQ.d.mts → referralTypes-CURy8Tnw.d.ts} +7 -7
- package/dist/libraries/backend/remix_dep.js +123 -71
- package/dist/libraries/backend/remix_dep.mjs +7 -6
- package/dist/libraries/backend/{response-ByHPEnHs.d.mts → response-CV6KGWH5.d.mts} +1 -0
- package/dist/libraries/backend/{response-ByHPEnHs.d.ts → response-CV6KGWH5.d.ts} +1 -0
- package/dist/libraries/backend/routes/backendRouter.js +123 -70
- package/dist/libraries/backend/routes/backendRouter.mjs +7 -6
- package/dist/libraries/backend/routes/entityRoutes.js +122 -65
- package/dist/libraries/backend/routes/entityRoutes.mjs +5 -3
- package/dist/libraries/backend/routes/genRoutes.js +123 -70
- package/dist/libraries/backend/routes/genRoutes.mjs +4 -3
- package/dist/libraries/backend/routes/referralRoutes.js +123 -68
- package/dist/libraries/backend/routes/referralRoutes.mjs +4 -3
- package/dist/libraries/backend/supabase.js +123 -71
- package/dist/libraries/backend/supabase.mjs +7 -6
- package/dist/libraries/backend/tanstack.js +126 -72
- package/dist/libraries/backend/tanstack.mjs +10 -9
- package/dist/libraries/backend/utils/backendRes.d.mts +1 -1
- package/dist/libraries/backend/utils/backendRes.d.ts +1 -1
- package/dist/libraries/backend/utils/backendRes.js +113 -58
- package/dist/libraries/backend/utils/backendRes.mjs +3 -1
- package/dist/libraries/backend/utils/logBackendErrors.d.mts +5 -0
- package/dist/libraries/backend/utils/logBackendErrors.d.ts +5 -0
- package/dist/libraries/backend/utils/logBackendErrors.js +84 -0
- package/dist/libraries/backend/utils/logBackendErrors.mjs +14 -0
- package/dist/libraries/backend/utils/withAuth.d.mts +2 -2
- package/dist/libraries/backend/utils/withAuth.d.ts +2 -2
- package/dist/libraries/backend/utils/withAuth.js +122 -65
- package/dist/libraries/backend/utils/withAuth.mjs +4 -2
- package/dist/libraries/react/AutumnContext.d.mts +11 -15
- package/dist/libraries/react/AutumnContext.d.ts +11 -15
- package/dist/libraries/react/AutumnContext.js +177 -97
- package/dist/libraries/react/AutumnContext.mjs +4 -3
- package/dist/libraries/react/BaseAutumnProvider.d.mts +8 -5
- package/dist/libraries/react/BaseAutumnProvider.d.ts +8 -5
- package/dist/libraries/react/BaseAutumnProvider.js +241 -274
- package/dist/libraries/react/BaseAutumnProvider.mjs +7 -7
- package/dist/libraries/react/{ReactAutumnClient-DNcV0gAT.d.ts → ReactAutumnClient-BM8hrCEC.d.ts} +20 -28
- package/dist/libraries/react/{ReactAutumnClient-BQtmw21U.d.mts → ReactAutumnClient-EjsfCAgE.d.mts} +20 -28
- package/dist/libraries/react/ReactAutumnProvider.d.mts +1 -1
- package/dist/libraries/react/ReactAutumnProvider.d.ts +1 -1
- package/dist/libraries/react/ReactAutumnProvider.js +247 -276
- package/dist/libraries/react/ReactAutumnProvider.mjs +7 -8
- package/dist/libraries/react/{chunk-KHU4NOQJ.mjs → chunk-2MVQH6J5.mjs} +10 -4
- package/dist/libraries/react/chunk-57I3B4BV.mjs +20 -0
- package/dist/libraries/react/chunk-5S5BL6HV.mjs +17 -0
- package/dist/libraries/react/chunk-A6J237PD.mjs +57 -0
- package/dist/{next/client/hooks/useEntityProvider.js → libraries/react/chunk-BGEO5REY.mjs} +12 -10
- package/dist/libraries/react/chunk-CIBQ4BJU.mjs +19 -0
- package/dist/libraries/react/{chunk-O4SNGQNB.mjs → chunk-CQ27LXPH.mjs} +35 -36
- package/dist/libraries/react/chunk-DMU3G7UZ.mjs +17 -0
- package/dist/libraries/react/{chunk-ILWLFCTA.mjs → chunk-EOSHPHLH.mjs} +10 -22
- package/dist/libraries/react/chunk-IXVPNA4H.mjs +20 -0
- package/dist/libraries/react/{chunk-OCZFV7OX.mjs → chunk-JNJ53ZW6.mjs} +103 -55
- package/dist/libraries/react/{chunk-PW6WFMLB.mjs → chunk-NJFRQ6T4.mjs} +7 -36
- package/dist/libraries/react/chunk-PSE3LKMR.mjs +64 -0
- package/dist/libraries/react/{chunk-STABYMUY.mjs → chunk-XDAZD5HF.mjs} +48 -23
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +4 -3
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +4 -3
- package/dist/libraries/react/client/ReactAutumnClient.js +167 -75
- package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -2
- package/dist/libraries/react/client/clientCompMethods.d.mts +4 -3
- package/dist/libraries/react/client/clientCompMethods.d.ts +4 -3
- package/dist/libraries/react/client/clientCusMethods.d.mts +4 -3
- package/dist/libraries/react/client/clientCusMethods.d.ts +4 -3
- package/dist/libraries/react/client/clientEntityMethods.d.mts +4 -3
- package/dist/libraries/react/client/clientEntityMethods.d.ts +4 -3
- package/dist/libraries/react/client/clientGenMethods.d.mts +4 -3
- package/dist/libraries/react/client/clientGenMethods.d.ts +4 -3
- package/dist/libraries/react/client/clientReferralMethods.d.mts +4 -3
- package/dist/libraries/react/client/clientReferralMethods.d.ts +4 -3
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +2 -2
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +2 -2
- package/dist/libraries/react/componentTypes-HF9MRJPX.d.mts +15 -0
- package/dist/libraries/react/componentTypes-HF9MRJPX.d.ts +15 -0
- package/dist/libraries/react/{error-CG2LXoa7.d.ts → error-DHbclCVh.d.mts} +1 -0
- package/dist/libraries/react/{error-CG2LXoa7.d.mts → error-DHbclCVh.d.ts} +1 -0
- package/dist/libraries/react/errorUtils/logAuthError.d.mts +8 -0
- package/dist/libraries/react/errorUtils/logAuthError.d.ts +8 -0
- package/dist/libraries/react/{hooks/usePricingTableProvider.js → errorUtils/logAuthError.js} +128 -96
- package/dist/libraries/react/errorUtils/logAuthError.mjs +21 -0
- package/dist/libraries/react/errorUtils/logFetchError.d.mts +8 -0
- package/dist/libraries/react/errorUtils/logFetchError.d.ts +8 -0
- package/dist/libraries/react/errorUtils/logFetchError.js +42 -0
- package/dist/libraries/react/errorUtils/logFetchError.mjs +8 -0
- package/dist/libraries/react/hooks/useAutumn.d.mts +2 -2
- package/dist/libraries/react/hooks/useAutumn.d.ts +2 -2
- package/dist/libraries/react/hooks/useAutumn.js +264 -133
- package/dist/libraries/react/hooks/useAutumn.mjs +7 -4
- package/dist/libraries/react/hooks/useAutumnBase.d.mts +55 -0
- package/dist/libraries/react/hooks/useAutumnBase.d.ts +55 -0
- package/dist/libraries/react/hooks/useAutumnBase.js +944 -0
- package/dist/libraries/react/hooks/useAutumnBase.mjs +19 -0
- package/dist/libraries/react/hooks/useCustomer.d.mts +10 -17
- package/dist/libraries/react/hooks/useCustomer.d.ts +10 -17
- package/dist/libraries/react/hooks/useCustomer.js +224 -114
- package/dist/libraries/react/hooks/useCustomer.mjs +6 -4
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +31 -0
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +31 -0
- package/dist/libraries/react/hooks/{useEntityProvider.js → useCustomerBase.js} +419 -93
- package/dist/libraries/react/hooks/useCustomerBase.mjs +18 -0
- package/dist/libraries/react/hooks/useEntity.d.mts +4 -4
- package/dist/libraries/react/hooks/useEntity.d.ts +4 -4
- package/dist/libraries/react/hooks/useEntity.js +215 -140
- package/dist/libraries/react/hooks/useEntity.mjs +6 -5
- package/dist/libraries/react/hooks/useEntityBase.d.mts +25 -0
- package/dist/libraries/react/hooks/useEntityBase.d.ts +25 -0
- package/dist/libraries/react/hooks/useEntityBase.js +87 -0
- package/dist/libraries/react/hooks/useEntityBase.mjs +8 -0
- package/dist/libraries/react/hooks/usePricingTable.d.mts +8 -12
- package/dist/libraries/react/hooks/usePricingTable.d.ts +8 -12
- package/dist/libraries/react/hooks/usePricingTable.js +211 -113
- package/dist/libraries/react/hooks/usePricingTable.mjs +6 -4
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +27 -0
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +27 -0
- package/dist/libraries/react/hooks/usePricingTableBase.js +810 -0
- package/dist/libraries/react/hooks/usePricingTableBase.mjs +18 -0
- package/dist/libraries/react/index.d.mts +8 -5
- package/dist/libraries/react/index.d.ts +8 -5
- package/dist/libraries/react/index.js +380 -408
- package/dist/libraries/react/index.mjs +14 -13
- package/dist/libraries/react/{response-B1KyqUB9.d.ts → response-B2MqTR7X.d.ts} +4 -4
- package/dist/libraries/react/{response-B5dHU3I9.d.mts → response-By38xiUq.d.mts} +4 -4
- package/dist/libraries/react/utils/compareParams.mjs +18 -3
- package/dist/next/AutumnProvider.js +2 -2
- package/dist/next/AutumnProvider.mjs +2 -2
- package/dist/next/client/AutumnClientProvider.d.mts +2 -0
- package/dist/next/client/AutumnClientProvider.d.ts +2 -0
- package/dist/next/client/NextAutumnClient.d.mts +81 -0
- package/dist/next/client/NextAutumnClient.d.ts +81 -0
- package/dist/next/client/NextAutumnClient.js +95 -0
- package/dist/next/client/NextAutumnClient.mjs +95 -0
- package/dist/next/client/NextAutumnProvider.d.mts +10 -0
- package/dist/next/client/NextAutumnProvider.d.ts +10 -0
- package/dist/next/client/NextAutumnProvider.js +21 -0
- package/dist/next/client/NextAutumnProvider.mjs +21 -0
- package/dist/next/client/clientEntTypes-ClSxkMvK.d.mts +29 -0
- package/dist/next/client/clientEntTypes-DuYXyCN4.d.ts +29 -0
- package/dist/next/client/clientGenTypes-BvnGc6fc.d.mts +156 -0
- package/dist/next/client/clientGenTypes-F8OKtPMU.d.ts +156 -0
- package/dist/next/client/clientReferralTypes-C9JiOk2s.d.mts +20 -0
- package/dist/next/client/clientReferralTypes-C9JiOk2s.d.ts +20 -0
- package/dist/next/client/clientUtils.d.mts +2 -2
- package/dist/next/client/clientUtils.d.ts +2 -2
- package/dist/next/client/componentTypes-HF9MRJPX.d.mts +15 -0
- package/dist/next/client/componentTypes-HF9MRJPX.d.ts +15 -0
- package/dist/next/client/{cusTypes-sh5_cN7N.d.ts → cusTypes-D9vXDh6B.d.mts} +23 -1
- package/dist/next/client/{cusTypes-sh5_cN7N.d.mts → cusTypes-D9vXDh6B.d.ts} +23 -1
- package/dist/next/client/{entTypes-C9TNWMk6.d.mts → entTypes-C2xwPhrH.d.mts} +5 -2
- package/dist/next/client/{entTypes-BDqnMLZ4.d.ts → entTypes-D5Bk72AS.d.ts} +5 -2
- package/dist/next/client/error-DHbclCVh.d.mts +17 -0
- package/dist/next/client/error-DHbclCVh.d.ts +17 -0
- package/dist/next/client/hooks/useAutumn.d.mts +41 -33
- package/dist/next/client/hooks/useAutumn.d.ts +41 -33
- package/dist/next/client/hooks/useAutumn.js +3 -236
- package/dist/next/client/hooks/useAutumn.mjs +3 -236
- package/dist/next/client/hooks/useCustomer.d.mts +19 -20
- package/dist/next/client/hooks/useCustomer.d.ts +19 -20
- package/dist/next/client/hooks/useCustomer.js +6 -120
- package/dist/next/client/hooks/useCustomer.mjs +6 -120
- package/dist/next/client/hooks/useEntity.d.mts +5 -5
- package/dist/next/client/hooks/useEntity.d.ts +5 -5
- package/dist/next/client/hooks/useEntity.js +3 -2
- package/dist/next/client/hooks/useEntity.mjs +3 -2
- package/dist/next/client/hooks/usePricingTable.d.mts +16 -14
- package/dist/next/client/hooks/usePricingTable.d.ts +16 -14
- package/dist/next/client/hooks/usePricingTable.js +4 -50
- package/dist/next/client/hooks/usePricingTable.mjs +4 -50
- package/dist/next/client/types.d.mts +2 -2
- package/dist/next/client/types.d.ts +2 -2
- package/dist/next/index.d.mts +363 -132
- package/dist/next/index.d.ts +363 -132
- package/dist/next/index.js +13 -8
- package/dist/next/index.mjs +6 -4
- package/dist/next/server/auth/handleAuthProvider.d.mts +2 -2
- package/dist/next/server/auth/handleAuthProvider.d.ts +2 -2
- package/dist/next/server/auth/supabase-wrapper.d.mts +1 -3
- package/dist/next/server/auth/supabase-wrapper.d.ts +1 -3
- package/dist/next/server/auth/{withAuth.d.mts → withNextAuth.d.mts} +1 -1
- package/dist/next/server/auth/{withAuth.d.ts → withNextAuth.d.ts} +1 -1
- package/dist/next/server/clientEntTypes-CWr4xXQ1.d.mts +14 -0
- package/dist/next/server/clientEntTypes-CWr4xXQ1.d.ts +14 -0
- package/dist/next/server/componentActions.d.mts +1 -1
- package/dist/next/server/componentActions.d.ts +1 -1
- package/dist/next/server/componentActions.js +1 -1
- package/dist/next/server/componentActions.mjs +1 -1
- package/dist/next/server/cusActions.d.mts +213 -14
- package/dist/next/server/cusActions.d.ts +213 -14
- package/dist/next/server/cusActions.js +12 -22
- package/dist/next/server/cusActions.mjs +12 -22
- package/dist/next/server/{cusTypes-BD42O-7Z.d.mts → cusTypes-DYgbKGrd.d.mts} +1 -1
- package/dist/next/server/{cusTypes-BD42O-7Z.d.ts → cusTypes-DYgbKGrd.d.ts} +1 -1
- package/dist/next/server/genActions.d.mts +41 -26
- package/dist/next/server/genActions.d.ts +41 -26
- package/dist/next/server/genActions.js +14 -62
- package/dist/next/server/genActions.mjs +14 -62
- package/dist/next/server/{response-BCg7kiiN.d.mts → response-eH4S4sg0.d.mts} +1 -0
- package/dist/next/server/{response-BCg7kiiN.d.ts → response-eH4S4sg0.d.ts} +1 -0
- package/dist/next/server/utils.d.mts +1 -1
- package/dist/next/server/utils.d.ts +1 -1
- package/dist/sdk/check.d.mts +3 -3
- package/dist/sdk/check.d.ts +3 -3
- package/dist/sdk/general.d.mts +3 -3
- package/dist/sdk/general.d.ts +3 -3
- package/dist/sdk/index.d.mts +9 -4
- package/dist/sdk/index.d.ts +9 -4
- package/dist/sdk/index.js +106 -71
- package/dist/sdk/index.mjs +102 -71
- package/dist/utils/chunk-V7R5DCYR.mjs +41 -0
- package/dist/utils/encryptUtils.js +103 -55
- package/dist/utils/encryptUtils.mjs +69 -55
- package/dist/utils/logger.d.mts +45 -0
- package/dist/utils/logger.d.ts +45 -0
- package/dist/utils/logger.js +75 -0
- package/dist/utils/logger.mjs +6 -0
- package/dist/utils/toSnakeCase.d.mts +3 -0
- package/dist/utils/toSnakeCase.d.ts +3 -0
- package/dist/utils/toSnakeCase.js +45 -0
- package/dist/utils/toSnakeCase.mjs +20 -0
- package/package.json +4 -5
- package/tsup.config.ts +1 -6
- package/dist/libraries/react/chunk-5LNSASJV.mjs +0 -33
- package/dist/libraries/react/chunk-CZA5WF64.mjs +0 -51
- package/dist/libraries/react/chunk-PIIGEXKQ.mjs +0 -77
- package/dist/libraries/react/chunk-PYM4YPRD.mjs +0 -38
- package/dist/libraries/react/chunk-Q5SSQSDP.mjs +0 -48
- package/dist/libraries/react/chunk-URAFNMTH.mjs +0 -48
- package/dist/libraries/react/chunk-VN4AVW2V.mjs +0 -24
- package/dist/libraries/react/hooks/useCustomerProvider.d.mts +0 -28
- package/dist/libraries/react/hooks/useCustomerProvider.d.ts +0 -28
- package/dist/libraries/react/hooks/useCustomerProvider.js +0 -100
- package/dist/libraries/react/hooks/useCustomerProvider.mjs +0 -8
- package/dist/libraries/react/hooks/useEntityProvider.d.mts +0 -33
- package/dist/libraries/react/hooks/useEntityProvider.d.ts +0 -33
- package/dist/libraries/react/hooks/useEntityProvider.mjs +0 -9
- package/dist/libraries/react/hooks/usePricingTableProvider.d.mts +0 -19
- package/dist/libraries/react/hooks/usePricingTableProvider.d.ts +0 -19
- package/dist/libraries/react/hooks/usePricingTableProvider.mjs +0 -9
- package/dist/next/client/AutumnContext.d.mts +0 -9
- package/dist/next/client/AutumnContext.d.ts +0 -9
- package/dist/next/client/AutumnContext.js +0 -47
- package/dist/next/client/AutumnContext.mjs +0 -47
- package/dist/next/client/AutumnProvider.d.mts +0 -11
- package/dist/next/client/AutumnProvider.d.ts +0 -11
- package/dist/next/client/AutumnProvider.js +0 -117
- package/dist/next/client/AutumnProvider.mjs +0 -117
- package/dist/next/client/clientEntTypes-pqnB95m3.d.mts +0 -9
- package/dist/next/client/clientEntTypes-pqnB95m3.d.ts +0 -9
- package/dist/next/client/hooks/types.d.mts +0 -27
- package/dist/next/client/hooks/types.d.ts +0 -27
- package/dist/next/client/hooks/useEntityProvider.d.mts +0 -11
- package/dist/next/client/hooks/useEntityProvider.d.ts +0 -11
- package/dist/next/client/hooks/useEntityProvider.mjs +0 -52
- package/dist/next/server/clientEntTypes-B3DRcw3U.d.mts +0 -216
- package/dist/next/server/clientEntTypes-BRUTcNUD.d.ts +0 -216
- /package/dist/next/client/{hooks/types.js → AutumnClientProvider.js} +0 -0
- /package/dist/next/client/{hooks/types.mjs → AutumnClientProvider.mjs} +0 -0
- /package/dist/next/server/auth/{withAuth.js → withNextAuth.js} +0 -0
- /package/dist/next/server/auth/{withAuth.mjs → withNextAuth.mjs} +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use server";
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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 {
|
|
2
|
-
import {
|
|
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 {
|
|
2
|
-
import {
|
|
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/
|
|
3
|
+
import { withAuth } from "./auth/withNextAuth";
|
|
4
4
|
import { toServerResponse } from "./utils";
|
|
5
|
-
import { toSnakeCase } from "../../
|
|
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
|
-
|
|
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
|
-
|
|
59
|
-
|
|
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
|
-
|
|
86
|
-
|
|
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/
|
|
3
|
+
import { withAuth } from "./auth/withNextAuth";
|
|
4
4
|
import { toServerResponse } from "./utils";
|
|
5
|
-
import { toSnakeCase } from "../../
|
|
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
|
-
|
|
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
|
-
|
|
59
|
-
|
|
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
|
-
|
|
86
|
-
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { R as Result, A as AutumnError, E as ErrorResponse } from './response-
|
|
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-
|
|
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
|
|
package/dist/sdk/check.d.mts
CHANGED
|
@@ -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
|
|
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
|
|
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 {
|
|
47
|
+
export type { CheckFeaturePreview, CheckFeatureScenario, CheckProductPreview, CheckProductScenario };
|
package/dist/sdk/check.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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 {
|
|
47
|
+
export type { CheckFeaturePreview, CheckFeatureScenario, CheckProductPreview, CheckProductScenario };
|
package/dist/sdk/general.d.mts
CHANGED
|
@@ -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 {
|
|
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?:
|
|
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?:
|
|
83
|
+
preview?: CheckProductPreview | CheckFeaturePreview;
|
|
84
84
|
}
|
|
85
85
|
interface EntitledBalance {
|
|
86
86
|
feature_id: string;
|
package/dist/sdk/general.d.ts
CHANGED
|
@@ -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 {
|
|
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?:
|
|
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?:
|
|
83
|
+
preview?: CheckProductPreview | CheckFeaturePreview;
|
|
84
84
|
}
|
|
85
85
|
interface EntitledBalance {
|
|
86
86
|
feature_id: string;
|
package/dist/sdk/index.d.mts
CHANGED
|
@@ -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 {
|
|
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
|
|
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>>;
|