autumn-js 0.1.10 → 0.1.12
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/better-auth.d.mts +53 -223
- package/dist/libraries/backend/better-auth.d.ts +53 -223
- package/dist/libraries/backend/better-auth.js +322 -152
- package/dist/libraries/backend/better-auth.mjs +8 -8
- package/dist/libraries/backend/{chunk-I43OU64D.mjs → chunk-2DWGCQCF.mjs} +1 -1
- package/dist/libraries/backend/{chunk-JN4ULI5R.mjs → chunk-56RGUNOT.mjs} +1 -1
- package/dist/libraries/backend/{chunk-YN334O74.mjs → chunk-6JI6MF4S.mjs} +1 -1
- package/dist/libraries/backend/{chunk-274BIVOC.mjs → chunk-FA5Z2MOT.mjs} +1 -1
- package/dist/libraries/backend/{chunk-7WWKVE4J.mjs → chunk-NWPFUFXX.mjs} +6 -6
- package/dist/libraries/backend/{chunk-KY3RLTE7.mjs → chunk-Q7SD535L.mjs} +185 -15
- package/dist/libraries/backend/{chunk-EJBD5GH7.mjs → chunk-SDL7BFTH.mjs} +1 -1
- package/dist/libraries/backend/convex.js +318 -148
- package/dist/libraries/backend/convex.mjs +7 -7
- package/dist/libraries/backend/elysia.js +318 -148
- package/dist/libraries/backend/elysia.mjs +7 -7
- package/dist/libraries/backend/express.d.mts +2 -1
- package/dist/libraries/backend/express.d.ts +2 -1
- package/dist/libraries/backend/express.js +318 -148
- package/dist/libraries/backend/express.mjs +7 -7
- package/dist/libraries/backend/fastify.js +318 -148
- package/dist/libraries/backend/fastify.mjs +7 -7
- package/dist/libraries/backend/hono.js +318 -148
- package/dist/libraries/backend/hono.mjs +7 -7
- package/dist/libraries/backend/index.d.mts +2 -1
- package/dist/libraries/backend/index.d.ts +2 -1
- package/dist/libraries/backend/index.js +318 -148
- package/dist/libraries/backend/index.mjs +7 -7
- package/dist/libraries/backend/next.js +318 -148
- package/dist/libraries/backend/next.mjs +7 -7
- package/dist/libraries/backend/react-router.js +318 -148
- package/dist/libraries/backend/react-router.mjs +7 -7
- package/dist/libraries/backend/{referralTypes-DpLmOy8-.d.mts → referralTypes-BOsjdpOb.d.mts} +251 -460
- package/dist/libraries/backend/{referralTypes-nXl36Opw.d.ts → referralTypes-DcfU8B6R.d.ts} +251 -460
- package/dist/libraries/backend/remix_dep.js +318 -148
- package/dist/libraries/backend/remix_dep.mjs +7 -7
- package/dist/libraries/backend/routes/backendRouter.js +318 -148
- package/dist/libraries/backend/routes/backendRouter.mjs +7 -7
- package/dist/libraries/backend/routes/entityRoutes.js +318 -148
- package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/genRoutes.js +318 -148
- package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/productRoutes.js +318 -148
- package/dist/libraries/backend/routes/productRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/referralRoutes.js +318 -148
- package/dist/libraries/backend/routes/referralRoutes.mjs +3 -3
- package/dist/libraries/backend/schemas/zod.d.mts +15 -153
- package/dist/libraries/backend/schemas/zod.d.ts +15 -153
- package/dist/libraries/backend/schemas/zod.js +43 -43
- package/dist/libraries/backend/schemas/zod.mjs +3 -3
- package/dist/libraries/backend/supabase.js +318 -148
- package/dist/libraries/backend/supabase.mjs +7 -7
- package/dist/libraries/backend/tanstack.js +318 -148
- package/dist/libraries/backend/tanstack.mjs +7 -7
- package/dist/libraries/backend/utils/backendRes.js +318 -148
- package/dist/libraries/backend/utils/backendRes.mjs +1 -1
- package/dist/libraries/backend/utils/withAuth.d.mts +2 -1
- package/dist/libraries/backend/utils/withAuth.d.ts +2 -1
- package/dist/libraries/backend/utils/withAuth.js +318 -148
- package/dist/libraries/backend/utils/withAuth.mjs +2 -2
- package/dist/libraries/react/AutumnContext.d.mts +7 -7
- package/dist/libraries/react/AutumnContext.d.ts +7 -7
- package/dist/libraries/react/AutumnContext.js +318 -148
- package/dist/libraries/react/AutumnContext.mjs +3 -3
- package/dist/libraries/react/BaseAutumnProvider.d.mts +7 -7
- package/dist/libraries/react/BaseAutumnProvider.d.ts +7 -7
- package/dist/libraries/react/BaseAutumnProvider.js +318 -159
- package/dist/libraries/react/BaseAutumnProvider.mjs +8 -8
- package/dist/libraries/react/{ReactAutumnClient-BozBPLWS.d.ts → ReactAutumnClient-CIAkiqwV.d.ts} +21 -21
- package/dist/libraries/react/{ReactAutumnClient-CDp4DLo0.d.mts → ReactAutumnClient-zBxnpPLM.d.mts} +21 -21
- package/dist/libraries/react/ReactAutumnProvider.d.mts +3 -3
- package/dist/libraries/react/ReactAutumnProvider.d.ts +3 -3
- package/dist/libraries/react/ReactAutumnProvider.js +318 -159
- package/dist/libraries/react/ReactAutumnProvider.mjs +9 -9
- package/dist/libraries/react/attachTypes-BQaZHr5e.d.ts +45 -0
- package/dist/libraries/react/attachTypes-Cuxn1ThG.d.mts +45 -0
- package/dist/libraries/react/{chunk-CPN2LD2I.mjs → chunk-26K62U62.mjs} +2 -2
- package/dist/libraries/react/{chunk-JIWMNR2E.mjs → chunk-5O3IHYFF.mjs} +185 -15
- package/dist/libraries/react/{chunk-JJVQIA5V.mjs → chunk-5RTUQSYZ.mjs} +1 -1
- package/dist/libraries/react/{chunk-TBRYCVBL.mjs → chunk-6X76WFOV.mjs} +3 -13
- package/dist/libraries/react/{chunk-4EPRIJNB.mjs → chunk-7A2PZDUO.mjs} +448 -450
- package/dist/libraries/react/{chunk-MKP43WD6.mjs → chunk-7HRCOEUW.mjs} +1 -1
- package/dist/libraries/react/{chunk-IRTAGYDD.mjs → chunk-CMUWZZWV.mjs} +2 -2
- package/dist/libraries/react/{chunk-XTONWQ65.mjs → chunk-DKOF357C.mjs} +1 -1
- package/dist/libraries/react/{chunk-QZPMYB2V.mjs → chunk-HNIU2WNT.mjs} +2 -2
- package/dist/libraries/react/{chunk-KG2NPWAE.mjs → chunk-JTYEHM27.mjs} +1 -1
- package/dist/libraries/react/{chunk-URFTKUL2.mjs → chunk-P6CAHZVT.mjs} +1 -2
- package/dist/libraries/react/{chunk-DRUVAAUW.mjs → chunk-QNMB7QR6.mjs} +3 -3
- package/dist/libraries/react/{chunk-UQ5HI732.mjs → chunk-RK4NRHHQ.mjs} +3 -3
- package/dist/libraries/react/{chunk-7LOW3KZ3.mjs → chunk-ROKCGZ77.mjs} +2 -2
- package/dist/libraries/react/{chunk-E2BEY4ZP.mjs → chunk-TE2MOBO7.mjs} +1 -1
- package/dist/libraries/react/{chunk-3YIV3N5Y.mjs → chunk-VGNA76RG.mjs} +1 -1
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +7 -7
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +7 -7
- package/dist/libraries/react/client/ReactAutumnClient.js +318 -148
- package/dist/libraries/react/client/ReactAutumnClient.mjs +2 -2
- package/dist/libraries/react/client/clientCompMethods.d.mts +7 -7
- package/dist/libraries/react/client/clientCompMethods.d.ts +7 -7
- package/dist/libraries/react/client/clientCusMethods.d.mts +7 -7
- package/dist/libraries/react/client/clientCusMethods.d.ts +7 -7
- package/dist/libraries/react/client/clientEntityMethods.d.mts +7 -7
- package/dist/libraries/react/client/clientEntityMethods.d.ts +7 -7
- package/dist/libraries/react/client/clientGenMethods.d.mts +7 -7
- package/dist/libraries/react/client/clientGenMethods.d.ts +7 -7
- package/dist/libraries/react/client/clientProdMethods.d.mts +7 -7
- package/dist/libraries/react/client/clientProdMethods.d.ts +7 -7
- package/dist/libraries/react/client/clientReferralMethods.d.mts +7 -7
- package/dist/libraries/react/client/clientReferralMethods.d.ts +7 -7
- package/dist/libraries/react/client/types/clientAttachTypes.d.mts +7 -88
- package/dist/libraries/react/client/types/clientAttachTypes.d.ts +7 -88
- package/dist/libraries/react/client/types/clientAttachTypes.js +28 -28
- package/dist/libraries/react/client/types/clientAttachTypes.mjs +4 -4
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +13 -53
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +13 -53
- package/dist/libraries/react/client/types/clientGenTypes.js +341 -171
- package/dist/libraries/react/client/types/clientGenTypes.mjs +2 -2
- package/dist/libraries/react/client/types/clientReferralTypes.d.mts +3 -11
- package/dist/libraries/react/client/types/clientReferralTypes.d.ts +3 -11
- package/dist/libraries/react/client/types/clientReferralTypes.js +5 -5
- package/dist/libraries/react/client/types/clientReferralTypes.mjs +1 -1
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.mts +3 -3
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.ts +3 -3
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +318 -159
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +24 -24
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.mts +3 -3
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.ts +3 -3
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.mts +2 -2
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.ts +2 -2
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.js +318 -148
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +24 -24
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +2 -2
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +2 -2
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +2 -2
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +2 -2
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +318 -159
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +24 -24
- package/dist/libraries/react/components/ui/button.d.mts +1 -1
- package/dist/libraries/react/components/ui/button.d.ts +1 -1
- package/dist/libraries/react/components/ui/dialog.mjs +2 -2
- package/dist/libraries/react/components/ui/popover.mjs +2 -2
- package/dist/libraries/react/cusTypes-B2m4-oz4.d.mts +111 -0
- package/dist/libraries/react/cusTypes-lMnznWYJ.d.ts +111 -0
- package/dist/libraries/react/{entTypes-ItJ8BoHV.d.mts → entTypes-D-gn1jj2.d.mts} +1 -1
- package/dist/libraries/react/{entTypes-Byz3wYbQ.d.ts → entTypes-WMQRyYAv.d.ts} +1 -1
- package/dist/libraries/react/{genTypes-EyxQImzh.d.ts → genTypes-DdYlVEah.d.mts} +4 -24
- package/dist/libraries/react/{genTypes-DSvR32on.d.mts → genTypes-aPPwPimh.d.ts} +4 -24
- package/dist/libraries/react/hooks/helpers/handleCheck.d.mts +7 -7
- package/dist/libraries/react/hooks/helpers/handleCheck.d.ts +7 -7
- package/dist/libraries/react/hooks/helpers/handleCheck.js +318 -148
- package/dist/libraries/react/hooks/helpers/handleCheck.mjs +2 -2
- package/dist/libraries/react/hooks/helpers/useAutumnBase.d.mts +9 -9
- package/dist/libraries/react/hooks/helpers/useAutumnBase.d.ts +9 -9
- package/dist/libraries/react/hooks/helpers/useAutumnBase.js +318 -149
- package/dist/libraries/react/hooks/helpers/useAutumnBase.mjs +3 -3
- package/dist/libraries/react/hooks/useAnalytics.d.mts +3 -3
- package/dist/libraries/react/hooks/useAnalytics.d.ts +3 -3
- package/dist/libraries/react/hooks/useAnalytics.js +318 -148
- package/dist/libraries/react/hooks/useAnalytics.mjs +4 -4
- package/dist/libraries/react/hooks/useCustomer.d.mts +67 -9
- package/dist/libraries/react/hooks/useCustomer.d.ts +67 -9
- package/dist/libraries/react/hooks/useCustomer.js +318 -159
- package/dist/libraries/react/hooks/useCustomer.mjs +8 -8
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +51 -10
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +51 -10
- package/dist/libraries/react/hooks/useCustomerBase.js +318 -159
- package/dist/libraries/react/hooks/useCustomerBase.mjs +7 -7
- package/dist/libraries/react/hooks/useEntity.d.mts +10 -10
- package/dist/libraries/react/hooks/useEntity.d.ts +10 -10
- package/dist/libraries/react/hooks/useEntity.js +318 -149
- package/dist/libraries/react/hooks/useEntity.mjs +8 -8
- package/dist/libraries/react/hooks/useEntityBase.d.mts +12 -12
- package/dist/libraries/react/hooks/useEntityBase.d.ts +12 -12
- package/dist/libraries/react/hooks/useEntityBase.js +318 -149
- package/dist/libraries/react/hooks/useEntityBase.mjs +7 -7
- package/dist/libraries/react/hooks/usePaywall.d.mts +2 -2
- package/dist/libraries/react/hooks/usePaywall.d.ts +2 -2
- package/dist/libraries/react/hooks/usePaywall.js +318 -148
- package/dist/libraries/react/hooks/usePaywall.mjs +4 -4
- package/dist/libraries/react/hooks/usePricingTable.d.mts +2 -2
- package/dist/libraries/react/hooks/usePricingTable.d.ts +2 -2
- package/dist/libraries/react/hooks/usePricingTable.js +318 -148
- package/dist/libraries/react/hooks/usePricingTable.mjs +5 -5
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +7 -7
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +7 -7
- package/dist/libraries/react/hooks/usePricingTableBase.js +318 -148
- package/dist/libraries/react/hooks/usePricingTableBase.mjs +2 -2
- package/dist/libraries/react/hooks/useProductsBase.d.mts +7 -7
- package/dist/libraries/react/hooks/useProductsBase.d.ts +7 -7
- package/dist/libraries/react/index.d.mts +148 -403
- package/dist/libraries/react/index.d.ts +148 -403
- package/dist/libraries/react/index.js +318 -159
- package/dist/libraries/react/index.mjs +185 -26
- package/dist/libraries/react/{prodTypes-Bmoibf-M.d.ts → prodTypes-C8xRoBP7.d.mts} +7 -90
- package/dist/libraries/react/{prodTypes-Bmoibf-M.d.mts → prodTypes-C8xRoBP7.d.ts} +7 -90
- package/dist/next/AutumnProvider.d.mts +2 -10
- package/dist/next/AutumnProvider.d.ts +2 -10
- package/dist/next/client/NextAutumnClient.d.mts +22 -22
- package/dist/next/client/NextAutumnClient.d.ts +22 -22
- package/dist/next/client/NextAutumnProvider.d.mts +3 -3
- package/dist/next/client/NextAutumnProvider.d.ts +3 -3
- package/dist/next/client/attachTypes-DRO-C_G5.d.mts +45 -0
- package/dist/next/client/attachTypes-gOerywTE.d.ts +45 -0
- package/dist/next/client/clientAttachTypes-DWFk8mOR.d.ts +116 -0
- package/dist/next/client/clientAttachTypes-traKz9UZ.d.mts +116 -0
- package/dist/next/client/clientUtils.d.mts +4 -4
- package/dist/next/client/clientUtils.d.ts +4 -4
- package/dist/next/client/cusTypes-CNOLnLMs.d.ts +111 -0
- package/dist/next/client/cusTypes-dkOgZJbj.d.mts +111 -0
- package/dist/next/client/{entTypes-Bf0302Om.d.mts → entTypes-CXZqtZX3.d.mts} +1 -1
- package/dist/next/client/{entTypes-KSBxuyW-.d.ts → entTypes-D0T20Mxt.d.ts} +1 -1
- package/dist/next/client/hooks/useAutumn.d.mts +8 -8
- package/dist/next/client/hooks/useAutumn.d.ts +8 -8
- package/dist/next/client/hooks/useCustomer.d.mts +52 -23
- package/dist/next/client/hooks/useCustomer.d.ts +52 -23
- package/dist/next/client/hooks/useEntity.d.mts +10 -10
- package/dist/next/client/hooks/useEntity.d.ts +10 -10
- package/dist/next/client/hooks/usePricingTable.d.mts +2 -2
- package/dist/next/client/hooks/usePricingTable.d.ts +2 -2
- package/dist/next/client/{prodTypes-CxvB1YY3.d.mts → prodTypes-DwM7QuGf.d.mts} +7 -90
- package/dist/next/client/{prodTypes-CxvB1YY3.d.ts → prodTypes-DwM7QuGf.d.ts} +7 -90
- package/dist/next/client/types.d.mts +4 -4
- package/dist/next/client/types.d.ts +4 -4
- package/dist/next/server/auth/withNextAuth.d.mts +2 -2
- package/dist/next/server/auth/withNextAuth.d.ts +2 -2
- package/dist/next/server/componentActions.d.mts +2 -2
- package/dist/next/server/componentActions.d.ts +2 -2
- package/dist/next/server/cusActions.d.mts +229 -252
- package/dist/next/server/cusActions.d.ts +229 -252
- package/dist/next/server/{cusTypes-Cu6SOTmn.d.mts → cusTypes-CTuY9T7g.d.mts} +26 -212
- package/dist/next/server/{cusTypes-Cu6SOTmn.d.ts → cusTypes-CTuY9T7g.d.ts} +26 -212
- package/dist/next/server/genActions.d.mts +13 -13
- package/dist/next/server/genActions.d.ts +13 -13
- package/dist/sdk/index.d.mts +272 -534
- package/dist/sdk/index.d.ts +272 -534
- package/dist/sdk/index.js +318 -148
- package/dist/sdk/index.mjs +185 -15
- package/dist/utils/encryptUtils.js +318 -148
- package/dist/utils/encryptUtils.mjs +185 -15
- package/package.json +2 -2
- package/dist/libraries/react/attachTypes-BqXH38Ft.d.mts +0 -91
- package/dist/libraries/react/attachTypes-DxfaWOQB.d.ts +0 -91
- package/dist/libraries/react/cusTypes-B2w8Kg9H.d.mts +0 -198
- package/dist/libraries/react/cusTypes-C8UH2xVw.d.ts +0 -198
- package/dist/next/client/attachTypes--97TsCMB.d.mts +0 -91
- package/dist/next/client/attachTypes-B1sM-0vf.d.ts +0 -91
- package/dist/next/client/clientAttachTypes-BXtfXB4v.d.ts +0 -251
- package/dist/next/client/clientAttachTypes-qsdoMt_B.d.mts +0 -251
- package/dist/next/client/cusTypes-DRJ574aU.d.ts +0 -198
- package/dist/next/client/cusTypes-c6-g1-Yy.d.mts +0 -198
- package/dist/libraries/react/{chunk-7JNU5ABT.mjs → chunk-FJWZPMWU.mjs} +3 -3
- package/dist/libraries/react/{chunk-LCWL3TIT.mjs → chunk-OTZ65PCT.mjs} +3 -3
package/dist/sdk/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { z as z$1 } from 'zod';
|
|
2
3
|
|
|
3
4
|
interface ErrorResponse {
|
|
4
5
|
message: string;
|
|
@@ -45,9 +46,8 @@ declare const CheckFeatureResultSchema: z.ZodObject<{
|
|
|
45
46
|
customer_id: z.ZodString;
|
|
46
47
|
entity_id: z.ZodOptional<z.ZodString>;
|
|
47
48
|
required_balance: z.ZodNumber;
|
|
48
|
-
} & {
|
|
49
49
|
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
-
interval: z.ZodOptional<z.
|
|
50
|
+
interval: z.ZodOptional<z.ZodEnum<typeof ProductItemInterval>>;
|
|
51
51
|
balance: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
52
52
|
usage: z.ZodOptional<z.ZodNumber>;
|
|
53
53
|
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
@@ -57,101 +57,19 @@ declare const CheckFeatureResultSchema: z.ZodObject<{
|
|
|
57
57
|
rollovers: z.ZodOptional<z.ZodObject<{
|
|
58
58
|
balance: z.ZodNumber;
|
|
59
59
|
expires_at: z.ZodNumber;
|
|
60
|
-
},
|
|
61
|
-
balance: number;
|
|
62
|
-
expires_at: number;
|
|
63
|
-
}, {
|
|
64
|
-
balance: number;
|
|
65
|
-
expires_at: number;
|
|
66
|
-
}>>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
67
61
|
breakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
68
|
-
interval: z.
|
|
62
|
+
interval: z.ZodEnum<typeof ProductItemInterval>;
|
|
69
63
|
balance: z.ZodOptional<z.ZodNumber>;
|
|
70
64
|
usage: z.ZodOptional<z.ZodNumber>;
|
|
71
65
|
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
72
66
|
next_reset_at: z.ZodOptional<z.ZodNumber>;
|
|
73
|
-
},
|
|
74
|
-
interval: ProductItemInterval;
|
|
75
|
-
balance?: number | undefined;
|
|
76
|
-
usage?: number | undefined;
|
|
77
|
-
included_usage?: number | undefined;
|
|
78
|
-
next_reset_at?: number | undefined;
|
|
79
|
-
}, {
|
|
80
|
-
interval: ProductItemInterval;
|
|
81
|
-
balance?: number | undefined;
|
|
82
|
-
usage?: number | undefined;
|
|
83
|
-
included_usage?: number | undefined;
|
|
84
|
-
next_reset_at?: number | undefined;
|
|
85
|
-
}>, "many">>;
|
|
67
|
+
}, z.core.$strip>>>;
|
|
86
68
|
credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
69
|
feature_id: z.ZodString;
|
|
88
70
|
credit_amount: z.ZodNumber;
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
credit_amount: number;
|
|
92
|
-
}, {
|
|
93
|
-
feature_id: string;
|
|
94
|
-
credit_amount: number;
|
|
95
|
-
}>, "many">>;
|
|
96
|
-
}, "strip", z.ZodTypeAny, {
|
|
97
|
-
allowed: boolean;
|
|
98
|
-
feature_id: string;
|
|
99
|
-
customer_id: string;
|
|
100
|
-
required_balance: number;
|
|
101
|
-
usage_limit?: number | undefined;
|
|
102
|
-
entity_id?: string | undefined;
|
|
103
|
-
unlimited?: boolean | undefined;
|
|
104
|
-
interval?: ProductItemInterval | undefined;
|
|
105
|
-
balance?: number | null | undefined;
|
|
106
|
-
usage?: number | undefined;
|
|
107
|
-
included_usage?: number | undefined;
|
|
108
|
-
next_reset_at?: number | null | undefined;
|
|
109
|
-
overage_allowed?: boolean | undefined;
|
|
110
|
-
rollovers?: {
|
|
111
|
-
balance: number;
|
|
112
|
-
expires_at: number;
|
|
113
|
-
} | undefined;
|
|
114
|
-
breakdown?: {
|
|
115
|
-
interval: ProductItemInterval;
|
|
116
|
-
balance?: number | undefined;
|
|
117
|
-
usage?: number | undefined;
|
|
118
|
-
included_usage?: number | undefined;
|
|
119
|
-
next_reset_at?: number | undefined;
|
|
120
|
-
}[] | undefined;
|
|
121
|
-
credit_schema?: {
|
|
122
|
-
feature_id: string;
|
|
123
|
-
credit_amount: number;
|
|
124
|
-
}[] | undefined;
|
|
125
|
-
}, {
|
|
126
|
-
allowed: boolean;
|
|
127
|
-
feature_id: string;
|
|
128
|
-
customer_id: string;
|
|
129
|
-
required_balance: number;
|
|
130
|
-
usage_limit?: number | undefined;
|
|
131
|
-
entity_id?: string | undefined;
|
|
132
|
-
unlimited?: boolean | undefined;
|
|
133
|
-
interval?: ProductItemInterval | undefined;
|
|
134
|
-
balance?: number | null | undefined;
|
|
135
|
-
usage?: number | undefined;
|
|
136
|
-
included_usage?: number | undefined;
|
|
137
|
-
next_reset_at?: number | null | undefined;
|
|
138
|
-
overage_allowed?: boolean | undefined;
|
|
139
|
-
rollovers?: {
|
|
140
|
-
balance: number;
|
|
141
|
-
expires_at: number;
|
|
142
|
-
} | undefined;
|
|
143
|
-
breakdown?: {
|
|
144
|
-
interval: ProductItemInterval;
|
|
145
|
-
balance?: number | undefined;
|
|
146
|
-
usage?: number | undefined;
|
|
147
|
-
included_usage?: number | undefined;
|
|
148
|
-
next_reset_at?: number | undefined;
|
|
149
|
-
}[] | undefined;
|
|
150
|
-
credit_schema?: {
|
|
151
|
-
feature_id: string;
|
|
152
|
-
credit_amount: number;
|
|
153
|
-
}[] | undefined;
|
|
154
|
-
}>;
|
|
71
|
+
}, z.core.$strip>>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
155
73
|
type CheckFeatureResult = z.infer<typeof CheckFeatureResultSchema>;
|
|
156
74
|
interface CheckFeaturePreview {
|
|
157
75
|
scenario: CheckFeatureScenario;
|
|
@@ -289,12 +207,19 @@ declare enum ProductStatus {
|
|
|
289
207
|
Scheduled = "scheduled",
|
|
290
208
|
PastDue = "past_due"
|
|
291
209
|
}
|
|
292
|
-
declare const CustomerExpandEnum: z.ZodEnum<
|
|
210
|
+
declare const CustomerExpandEnum: z.ZodEnum<{
|
|
211
|
+
invoices: "invoices";
|
|
212
|
+
rewards: "rewards";
|
|
213
|
+
trials_used: "trials_used";
|
|
214
|
+
entities: "entities";
|
|
215
|
+
referrals: "referrals";
|
|
216
|
+
payment_method: "payment_method";
|
|
217
|
+
}>;
|
|
293
218
|
type CustomerExpandOption = "invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method";
|
|
294
219
|
|
|
295
220
|
declare const CoreCusFeatureSchema: z.ZodObject<{
|
|
296
221
|
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
297
|
-
interval: z.ZodOptional<z.
|
|
222
|
+
interval: z.ZodOptional<z.ZodEnum<typeof ProductItemInterval>>;
|
|
298
223
|
balance: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
299
224
|
usage: z.ZodOptional<z.ZodNumber>;
|
|
300
225
|
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
@@ -304,91 +229,19 @@ declare const CoreCusFeatureSchema: z.ZodObject<{
|
|
|
304
229
|
rollovers: z.ZodOptional<z.ZodObject<{
|
|
305
230
|
balance: z.ZodNumber;
|
|
306
231
|
expires_at: z.ZodNumber;
|
|
307
|
-
},
|
|
308
|
-
balance: number;
|
|
309
|
-
expires_at: number;
|
|
310
|
-
}, {
|
|
311
|
-
balance: number;
|
|
312
|
-
expires_at: number;
|
|
313
|
-
}>>;
|
|
232
|
+
}, z.core.$strip>>;
|
|
314
233
|
breakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
315
|
-
interval: z.
|
|
234
|
+
interval: z.ZodEnum<typeof ProductItemInterval>;
|
|
316
235
|
balance: z.ZodOptional<z.ZodNumber>;
|
|
317
236
|
usage: z.ZodOptional<z.ZodNumber>;
|
|
318
237
|
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
319
238
|
next_reset_at: z.ZodOptional<z.ZodNumber>;
|
|
320
|
-
},
|
|
321
|
-
interval: ProductItemInterval;
|
|
322
|
-
balance?: number | undefined;
|
|
323
|
-
usage?: number | undefined;
|
|
324
|
-
included_usage?: number | undefined;
|
|
325
|
-
next_reset_at?: number | undefined;
|
|
326
|
-
}, {
|
|
327
|
-
interval: ProductItemInterval;
|
|
328
|
-
balance?: number | undefined;
|
|
329
|
-
usage?: number | undefined;
|
|
330
|
-
included_usage?: number | undefined;
|
|
331
|
-
next_reset_at?: number | undefined;
|
|
332
|
-
}>, "many">>;
|
|
239
|
+
}, z.core.$strip>>>;
|
|
333
240
|
credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
334
241
|
feature_id: z.ZodString;
|
|
335
242
|
credit_amount: z.ZodNumber;
|
|
336
|
-
},
|
|
337
|
-
|
|
338
|
-
credit_amount: number;
|
|
339
|
-
}, {
|
|
340
|
-
feature_id: string;
|
|
341
|
-
credit_amount: number;
|
|
342
|
-
}>, "many">>;
|
|
343
|
-
}, "strip", z.ZodTypeAny, {
|
|
344
|
-
usage_limit?: number | undefined;
|
|
345
|
-
unlimited?: boolean | undefined;
|
|
346
|
-
interval?: ProductItemInterval | undefined;
|
|
347
|
-
balance?: number | null | undefined;
|
|
348
|
-
usage?: number | undefined;
|
|
349
|
-
included_usage?: number | undefined;
|
|
350
|
-
next_reset_at?: number | null | undefined;
|
|
351
|
-
overage_allowed?: boolean | undefined;
|
|
352
|
-
rollovers?: {
|
|
353
|
-
balance: number;
|
|
354
|
-
expires_at: number;
|
|
355
|
-
} | undefined;
|
|
356
|
-
breakdown?: {
|
|
357
|
-
interval: ProductItemInterval;
|
|
358
|
-
balance?: number | undefined;
|
|
359
|
-
usage?: number | undefined;
|
|
360
|
-
included_usage?: number | undefined;
|
|
361
|
-
next_reset_at?: number | undefined;
|
|
362
|
-
}[] | undefined;
|
|
363
|
-
credit_schema?: {
|
|
364
|
-
feature_id: string;
|
|
365
|
-
credit_amount: number;
|
|
366
|
-
}[] | undefined;
|
|
367
|
-
}, {
|
|
368
|
-
usage_limit?: number | undefined;
|
|
369
|
-
unlimited?: boolean | undefined;
|
|
370
|
-
interval?: ProductItemInterval | undefined;
|
|
371
|
-
balance?: number | null | undefined;
|
|
372
|
-
usage?: number | undefined;
|
|
373
|
-
included_usage?: number | undefined;
|
|
374
|
-
next_reset_at?: number | null | undefined;
|
|
375
|
-
overage_allowed?: boolean | undefined;
|
|
376
|
-
rollovers?: {
|
|
377
|
-
balance: number;
|
|
378
|
-
expires_at: number;
|
|
379
|
-
} | undefined;
|
|
380
|
-
breakdown?: {
|
|
381
|
-
interval: ProductItemInterval;
|
|
382
|
-
balance?: number | undefined;
|
|
383
|
-
usage?: number | undefined;
|
|
384
|
-
included_usage?: number | undefined;
|
|
385
|
-
next_reset_at?: number | undefined;
|
|
386
|
-
}[] | undefined;
|
|
387
|
-
credit_schema?: {
|
|
388
|
-
feature_id: string;
|
|
389
|
-
credit_amount: number;
|
|
390
|
-
}[] | undefined;
|
|
391
|
-
}>;
|
|
243
|
+
}, z.core.$strip>>>;
|
|
244
|
+
}, z.core.$strip>;
|
|
392
245
|
type CoreCustomerFeature = z.infer<typeof CoreCusFeatureSchema>;
|
|
393
246
|
interface CustomerFeature extends CoreCustomerFeature {
|
|
394
247
|
id: string;
|
|
@@ -430,15 +283,7 @@ declare const CustomerDataSchema: z.ZodObject<{
|
|
|
430
283
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
431
284
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
432
285
|
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
433
|
-
},
|
|
434
|
-
name?: string | null | undefined;
|
|
435
|
-
email?: string | null | undefined;
|
|
436
|
-
fingerprint?: string | null | undefined;
|
|
437
|
-
}, {
|
|
438
|
-
name?: string | null | undefined;
|
|
439
|
-
email?: string | null | undefined;
|
|
440
|
-
fingerprint?: string | null | undefined;
|
|
441
|
-
}>;
|
|
286
|
+
}, z.core.$strip>;
|
|
442
287
|
type CustomerData = z.infer<typeof CustomerDataSchema>;
|
|
443
288
|
interface GetCustomerParams {
|
|
444
289
|
expand?: CustomerExpandOption[];
|
|
@@ -449,22 +294,15 @@ declare const CreateCustomerParamsSchema: z.ZodObject<{
|
|
|
449
294
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
450
295
|
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
451
296
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
452
|
-
expand: z.ZodOptional<z.ZodArray<z.ZodEnum<
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
},
|
|
461
|
-
id?: string | null | undefined;
|
|
462
|
-
name?: string | null | undefined;
|
|
463
|
-
email?: string | null | undefined;
|
|
464
|
-
fingerprint?: string | null | undefined;
|
|
465
|
-
metadata?: Record<string, any> | undefined;
|
|
466
|
-
expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
|
|
467
|
-
}>;
|
|
297
|
+
expand: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
298
|
+
invoices: "invoices";
|
|
299
|
+
rewards: "rewards";
|
|
300
|
+
trials_used: "trials_used";
|
|
301
|
+
entities: "entities";
|
|
302
|
+
referrals: "referrals";
|
|
303
|
+
payment_method: "payment_method";
|
|
304
|
+
}>>>;
|
|
305
|
+
}, z.core.$strip>;
|
|
468
306
|
type CreateCustomerParams = z.infer<typeof CreateCustomerParamsSchema>;
|
|
469
307
|
interface UpdateCustomerParams {
|
|
470
308
|
id?: string | null;
|
|
@@ -474,11 +312,7 @@ interface UpdateCustomerParams {
|
|
|
474
312
|
}
|
|
475
313
|
declare const BillingPortalParamsSchema: z.ZodObject<{
|
|
476
314
|
return_url: z.ZodOptional<z.ZodString>;
|
|
477
|
-
},
|
|
478
|
-
return_url?: string | undefined;
|
|
479
|
-
}, {
|
|
480
|
-
return_url?: string | undefined;
|
|
481
|
-
}>;
|
|
315
|
+
}, z.core.$strip>;
|
|
482
316
|
type BillingPortalParams = z.infer<typeof BillingPortalParamsSchema>;
|
|
483
317
|
interface BillingPortalResult {
|
|
484
318
|
customer_id: string;
|
|
@@ -496,22 +330,10 @@ interface CustomerInvoice {
|
|
|
496
330
|
declare const UpdateBalancesParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
497
331
|
feature_id: z.ZodString;
|
|
498
332
|
balance: z.ZodNumber;
|
|
499
|
-
},
|
|
500
|
-
feature_id: string;
|
|
501
|
-
balance: number;
|
|
502
|
-
}, {
|
|
503
|
-
feature_id: string;
|
|
504
|
-
balance: number;
|
|
505
|
-
}>, z.ZodArray<z.ZodObject<{
|
|
333
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
506
334
|
feature_id: z.ZodString;
|
|
507
335
|
balance: z.ZodNumber;
|
|
508
|
-
},
|
|
509
|
-
feature_id: string;
|
|
510
|
-
balance: number;
|
|
511
|
-
}, {
|
|
512
|
-
feature_id: string;
|
|
513
|
-
balance: number;
|
|
514
|
-
}>, "many">]>;
|
|
336
|
+
}, z.core.$strip>>]>;
|
|
515
337
|
type UpdateBalancesParams = z.infer<typeof UpdateBalancesParamsSchema>;
|
|
516
338
|
type UpdateBalancesResult = {
|
|
517
339
|
success: boolean;
|
|
@@ -522,31 +344,13 @@ declare const CancelParamsSchema: z.ZodObject<{
|
|
|
522
344
|
product_id: z.ZodString;
|
|
523
345
|
entity_id: z.ZodOptional<z.ZodString>;
|
|
524
346
|
cancel_immediately: z.ZodOptional<z.ZodBoolean>;
|
|
525
|
-
},
|
|
526
|
-
customer_id: string;
|
|
527
|
-
product_id: string;
|
|
528
|
-
entity_id?: string | undefined;
|
|
529
|
-
cancel_immediately?: boolean | undefined;
|
|
530
|
-
}, {
|
|
531
|
-
customer_id: string;
|
|
532
|
-
product_id: string;
|
|
533
|
-
entity_id?: string | undefined;
|
|
534
|
-
cancel_immediately?: boolean | undefined;
|
|
535
|
-
}>;
|
|
347
|
+
}, z.core.$strip>;
|
|
536
348
|
type CancelParams = z.infer<typeof CancelParamsSchema>;
|
|
537
349
|
declare const CancelResultSchema: z.ZodObject<{
|
|
538
350
|
success: z.ZodBoolean;
|
|
539
351
|
customer_id: z.ZodString;
|
|
540
352
|
product_id: z.ZodString;
|
|
541
|
-
},
|
|
542
|
-
customer_id: string;
|
|
543
|
-
product_id: string;
|
|
544
|
-
success: boolean;
|
|
545
|
-
}, {
|
|
546
|
-
customer_id: string;
|
|
547
|
-
product_id: string;
|
|
548
|
-
success: boolean;
|
|
549
|
-
}>;
|
|
353
|
+
}, z.core.$strip>;
|
|
550
354
|
type CancelResult = z.infer<typeof CancelResultSchema>;
|
|
551
355
|
declare const TrackParamsSchema: z.ZodObject<{
|
|
552
356
|
customer_id: z.ZodString;
|
|
@@ -557,25 +361,7 @@ declare const TrackParamsSchema: z.ZodObject<{
|
|
|
557
361
|
customer_data: z.ZodOptional<z.ZodAny>;
|
|
558
362
|
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
559
363
|
entity_data: z.ZodOptional<z.ZodAny>;
|
|
560
|
-
},
|
|
561
|
-
customer_id: string;
|
|
562
|
-
feature_id?: string | undefined;
|
|
563
|
-
entity_id?: string | undefined;
|
|
564
|
-
value?: number | undefined;
|
|
565
|
-
customer_data?: any;
|
|
566
|
-
entity_data?: any;
|
|
567
|
-
event_name?: string | undefined;
|
|
568
|
-
idempotency_key?: string | undefined;
|
|
569
|
-
}, {
|
|
570
|
-
customer_id: string;
|
|
571
|
-
feature_id?: string | undefined;
|
|
572
|
-
entity_id?: string | undefined;
|
|
573
|
-
value?: number | undefined;
|
|
574
|
-
customer_data?: any;
|
|
575
|
-
entity_data?: any;
|
|
576
|
-
event_name?: string | undefined;
|
|
577
|
-
idempotency_key?: string | undefined;
|
|
578
|
-
}>;
|
|
364
|
+
}, z.core.$strip>;
|
|
579
365
|
type TrackParams = z.infer<typeof TrackParamsSchema>;
|
|
580
366
|
declare const TrackResultSchema: z.ZodObject<{
|
|
581
367
|
id: z.ZodString;
|
|
@@ -583,19 +369,7 @@ declare const TrackResultSchema: z.ZodObject<{
|
|
|
583
369
|
customer_id: z.ZodString;
|
|
584
370
|
feature_id: z.ZodOptional<z.ZodString>;
|
|
585
371
|
event_name: z.ZodOptional<z.ZodString>;
|
|
586
|
-
},
|
|
587
|
-
customer_id: string;
|
|
588
|
-
code: string;
|
|
589
|
-
id: string;
|
|
590
|
-
feature_id?: string | undefined;
|
|
591
|
-
event_name?: string | undefined;
|
|
592
|
-
}, {
|
|
593
|
-
customer_id: string;
|
|
594
|
-
code: string;
|
|
595
|
-
id: string;
|
|
596
|
-
feature_id?: string | undefined;
|
|
597
|
-
event_name?: string | undefined;
|
|
598
|
-
}>;
|
|
372
|
+
}, z.core.$strip>;
|
|
599
373
|
type TrackResult = z.infer<typeof TrackResultSchema>;
|
|
600
374
|
declare const CheckParamsSchema: z.ZodObject<{
|
|
601
375
|
customer_id: z.ZodString;
|
|
@@ -609,40 +383,8 @@ declare const CheckParamsSchema: z.ZodObject<{
|
|
|
609
383
|
entity_data: z.ZodOptional<z.ZodObject<{
|
|
610
384
|
name: z.ZodOptional<z.ZodString>;
|
|
611
385
|
feature_id: z.ZodString;
|
|
612
|
-
},
|
|
613
|
-
|
|
614
|
-
name?: string | undefined;
|
|
615
|
-
}, {
|
|
616
|
-
feature_id: string;
|
|
617
|
-
name?: string | undefined;
|
|
618
|
-
}>>;
|
|
619
|
-
}, "strip", z.ZodTypeAny, {
|
|
620
|
-
customer_id: string;
|
|
621
|
-
feature_id?: string | undefined;
|
|
622
|
-
entity_id?: string | undefined;
|
|
623
|
-
required_balance?: number | undefined;
|
|
624
|
-
product_id?: string | undefined;
|
|
625
|
-
customer_data?: any;
|
|
626
|
-
entity_data?: {
|
|
627
|
-
feature_id: string;
|
|
628
|
-
name?: string | undefined;
|
|
629
|
-
} | undefined;
|
|
630
|
-
send_event?: boolean | undefined;
|
|
631
|
-
with_preview?: boolean | undefined;
|
|
632
|
-
}, {
|
|
633
|
-
customer_id: string;
|
|
634
|
-
feature_id?: string | undefined;
|
|
635
|
-
entity_id?: string | undefined;
|
|
636
|
-
required_balance?: number | undefined;
|
|
637
|
-
product_id?: string | undefined;
|
|
638
|
-
customer_data?: any;
|
|
639
|
-
entity_data?: {
|
|
640
|
-
feature_id: string;
|
|
641
|
-
name?: string | undefined;
|
|
642
|
-
} | undefined;
|
|
643
|
-
send_event?: boolean | undefined;
|
|
644
|
-
with_preview?: boolean | undefined;
|
|
645
|
-
}>;
|
|
386
|
+
}, z.core.$strip>>;
|
|
387
|
+
}, z.core.$strip>;
|
|
646
388
|
type CheckParams = z.infer<typeof CheckParamsSchema>;
|
|
647
389
|
type CheckResult = CheckFeatureResult & CheckProductResult;
|
|
648
390
|
interface UsageParams {
|
|
@@ -665,20 +407,24 @@ interface SetupPaymentResult {
|
|
|
665
407
|
customer_id: string;
|
|
666
408
|
url: string;
|
|
667
409
|
}
|
|
668
|
-
declare const QueryRangeEnum: z.ZodEnum<
|
|
410
|
+
declare const QueryRangeEnum: z.ZodEnum<{
|
|
411
|
+
"24h": "24h";
|
|
412
|
+
"7d": "7d";
|
|
413
|
+
"30d": "30d";
|
|
414
|
+
"90d": "90d";
|
|
415
|
+
last_cycle: "last_cycle";
|
|
416
|
+
}>;
|
|
669
417
|
declare const QueryParamsSchema: z.ZodObject<{
|
|
670
418
|
customer_id: z.ZodString;
|
|
671
|
-
feature_id: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString
|
|
672
|
-
range: z.ZodOptional<z.ZodEnum<
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
range?: "24h" | "7d" | "30d" | "90d" | "last_cycle" | undefined;
|
|
681
|
-
}>;
|
|
419
|
+
feature_id: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
420
|
+
range: z.ZodOptional<z.ZodEnum<{
|
|
421
|
+
"24h": "24h";
|
|
422
|
+
"7d": "7d";
|
|
423
|
+
"30d": "30d";
|
|
424
|
+
"90d": "90d";
|
|
425
|
+
last_cycle: "last_cycle";
|
|
426
|
+
}>>;
|
|
427
|
+
}, z.core.$strip>;
|
|
682
428
|
type QueryParams = z.infer<typeof QueryParamsSchema>;
|
|
683
429
|
type QueryResult = {
|
|
684
430
|
list: Array<{
|
|
@@ -691,13 +437,7 @@ type QueryResult = {
|
|
|
691
437
|
declare const AttachFeatureOptionsSchema: z.ZodObject<{
|
|
692
438
|
feature_id: z.ZodString;
|
|
693
439
|
quantity: z.ZodNumber;
|
|
694
|
-
},
|
|
695
|
-
feature_id: string;
|
|
696
|
-
quantity: number;
|
|
697
|
-
}, {
|
|
698
|
-
feature_id: string;
|
|
699
|
-
quantity: number;
|
|
700
|
-
}>;
|
|
440
|
+
}, z.core.$strip>;
|
|
701
441
|
type AttachFeatureOptions = z.infer<typeof AttachFeatureOptionsSchema>;
|
|
702
442
|
declare const AttachParamsSchema: z.ZodObject<{
|
|
703
443
|
customer_id: z.ZodString;
|
|
@@ -706,14 +446,8 @@ declare const AttachParamsSchema: z.ZodObject<{
|
|
|
706
446
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
707
447
|
feature_id: z.ZodString;
|
|
708
448
|
quantity: z.ZodNumber;
|
|
709
|
-
},
|
|
710
|
-
|
|
711
|
-
quantity: number;
|
|
712
|
-
}, {
|
|
713
|
-
feature_id: string;
|
|
714
|
-
quantity: number;
|
|
715
|
-
}>, "many">>;
|
|
716
|
-
product_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
449
|
+
}, z.core.$strip>>>;
|
|
450
|
+
product_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
717
451
|
free_trial: z.ZodOptional<z.ZodBoolean>;
|
|
718
452
|
success_url: z.ZodOptional<z.ZodString>;
|
|
719
453
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -722,69 +456,17 @@ declare const AttachParamsSchema: z.ZodObject<{
|
|
|
722
456
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
723
457
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
724
458
|
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
725
|
-
},
|
|
726
|
-
name?: string | null | undefined;
|
|
727
|
-
email?: string | null | undefined;
|
|
728
|
-
fingerprint?: string | null | undefined;
|
|
729
|
-
}, {
|
|
730
|
-
name?: string | null | undefined;
|
|
731
|
-
email?: string | null | undefined;
|
|
732
|
-
fingerprint?: string | null | undefined;
|
|
733
|
-
}>>;
|
|
459
|
+
}, z.core.$strip>>;
|
|
734
460
|
entity_data: z.ZodOptional<z.ZodAny>;
|
|
735
461
|
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
736
462
|
reward: z.ZodOptional<z.ZodString>;
|
|
737
463
|
invoice: z.ZodOptional<z.ZodBoolean>;
|
|
738
|
-
},
|
|
739
|
-
customer_id: string;
|
|
740
|
-
entity_id?: string | undefined;
|
|
741
|
-
options?: {
|
|
742
|
-
feature_id: string;
|
|
743
|
-
quantity: number;
|
|
744
|
-
}[] | undefined;
|
|
745
|
-
metadata?: Record<string, string> | undefined;
|
|
746
|
-
product_id?: string | undefined;
|
|
747
|
-
product_ids?: string[] | undefined;
|
|
748
|
-
free_trial?: boolean | undefined;
|
|
749
|
-
success_url?: string | undefined;
|
|
750
|
-
force_checkout?: boolean | undefined;
|
|
751
|
-
customer_data?: {
|
|
752
|
-
name?: string | null | undefined;
|
|
753
|
-
email?: string | null | undefined;
|
|
754
|
-
fingerprint?: string | null | undefined;
|
|
755
|
-
} | undefined;
|
|
756
|
-
entity_data?: any;
|
|
757
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
758
|
-
reward?: string | undefined;
|
|
759
|
-
invoice?: boolean | undefined;
|
|
760
|
-
}, {
|
|
761
|
-
customer_id: string;
|
|
762
|
-
entity_id?: string | undefined;
|
|
763
|
-
options?: {
|
|
764
|
-
feature_id: string;
|
|
765
|
-
quantity: number;
|
|
766
|
-
}[] | undefined;
|
|
767
|
-
metadata?: Record<string, string> | undefined;
|
|
768
|
-
product_id?: string | undefined;
|
|
769
|
-
product_ids?: string[] | undefined;
|
|
770
|
-
free_trial?: boolean | undefined;
|
|
771
|
-
success_url?: string | undefined;
|
|
772
|
-
force_checkout?: boolean | undefined;
|
|
773
|
-
customer_data?: {
|
|
774
|
-
name?: string | null | undefined;
|
|
775
|
-
email?: string | null | undefined;
|
|
776
|
-
fingerprint?: string | null | undefined;
|
|
777
|
-
} | undefined;
|
|
778
|
-
entity_data?: any;
|
|
779
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
780
|
-
reward?: string | undefined;
|
|
781
|
-
invoice?: boolean | undefined;
|
|
782
|
-
}>;
|
|
464
|
+
}, z.core.$strip>;
|
|
783
465
|
type AttachParams = z.infer<typeof AttachParamsSchema>;
|
|
784
466
|
declare const AttachResultSchema: z.ZodObject<{
|
|
785
467
|
checkout_url: z.ZodOptional<z.ZodString>;
|
|
786
468
|
customer_id: z.ZodString;
|
|
787
|
-
product_ids: z.ZodArray<z.ZodString
|
|
469
|
+
product_ids: z.ZodArray<z.ZodString>;
|
|
788
470
|
code: z.ZodString;
|
|
789
471
|
message: z.ZodString;
|
|
790
472
|
customer_data: z.ZodOptional<z.ZodAny>;
|
|
@@ -794,48 +476,8 @@ declare const AttachResultSchema: z.ZodObject<{
|
|
|
794
476
|
hosted_invoice_url: z.ZodNullable<z.ZodString>;
|
|
795
477
|
total: z.ZodNumber;
|
|
796
478
|
currency: z.ZodString;
|
|
797
|
-
},
|
|
798
|
-
|
|
799
|
-
stripe_id: string;
|
|
800
|
-
hosted_invoice_url: string | null;
|
|
801
|
-
total: number;
|
|
802
|
-
currency: string;
|
|
803
|
-
}, {
|
|
804
|
-
status: string;
|
|
805
|
-
stripe_id: string;
|
|
806
|
-
hosted_invoice_url: string | null;
|
|
807
|
-
total: number;
|
|
808
|
-
currency: string;
|
|
809
|
-
}>>;
|
|
810
|
-
}, "strip", z.ZodTypeAny, {
|
|
811
|
-
customer_id: string;
|
|
812
|
-
code: string;
|
|
813
|
-
message: string;
|
|
814
|
-
product_ids: string[];
|
|
815
|
-
customer_data?: any;
|
|
816
|
-
invoice?: {
|
|
817
|
-
status: string;
|
|
818
|
-
stripe_id: string;
|
|
819
|
-
hosted_invoice_url: string | null;
|
|
820
|
-
total: number;
|
|
821
|
-
currency: string;
|
|
822
|
-
} | undefined;
|
|
823
|
-
checkout_url?: string | undefined;
|
|
824
|
-
}, {
|
|
825
|
-
customer_id: string;
|
|
826
|
-
code: string;
|
|
827
|
-
message: string;
|
|
828
|
-
product_ids: string[];
|
|
829
|
-
customer_data?: any;
|
|
830
|
-
invoice?: {
|
|
831
|
-
status: string;
|
|
832
|
-
stripe_id: string;
|
|
833
|
-
hosted_invoice_url: string | null;
|
|
834
|
-
total: number;
|
|
835
|
-
currency: string;
|
|
836
|
-
} | undefined;
|
|
837
|
-
checkout_url?: string | undefined;
|
|
838
|
-
}>;
|
|
479
|
+
}, z.core.$strip>>;
|
|
480
|
+
}, z.core.$strip>;
|
|
839
481
|
type AttachResult = z.infer<typeof AttachResultSchema>;
|
|
840
482
|
declare const CheckoutParamsSchema: z.ZodObject<{
|
|
841
483
|
customer_id: z.ZodString;
|
|
@@ -844,65 +486,19 @@ declare const CheckoutParamsSchema: z.ZodObject<{
|
|
|
844
486
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
845
487
|
feature_id: z.ZodString;
|
|
846
488
|
quantity: z.ZodNumber;
|
|
847
|
-
},
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}, {
|
|
851
|
-
feature_id: string;
|
|
852
|
-
quantity: number;
|
|
853
|
-
}>, "many">>;
|
|
489
|
+
}, z.core.$strip>>>;
|
|
490
|
+
force_checkout: z.ZodOptional<z.ZodBoolean>;
|
|
491
|
+
invoice: z.ZodOptional<z.ZodBoolean>;
|
|
854
492
|
success_url: z.ZodOptional<z.ZodString>;
|
|
855
493
|
customer_data: z.ZodOptional<z.ZodObject<{
|
|
856
494
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
857
495
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
858
496
|
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
859
|
-
},
|
|
860
|
-
name?: string | null | undefined;
|
|
861
|
-
email?: string | null | undefined;
|
|
862
|
-
fingerprint?: string | null | undefined;
|
|
863
|
-
}, {
|
|
864
|
-
name?: string | null | undefined;
|
|
865
|
-
email?: string | null | undefined;
|
|
866
|
-
fingerprint?: string | null | undefined;
|
|
867
|
-
}>>;
|
|
497
|
+
}, z.core.$strip>>;
|
|
868
498
|
entity_data: z.ZodOptional<z.ZodAny>;
|
|
869
499
|
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
870
500
|
reward: z.ZodOptional<z.ZodString>;
|
|
871
|
-
},
|
|
872
|
-
customer_id: string;
|
|
873
|
-
product_id: string;
|
|
874
|
-
entity_id?: string | undefined;
|
|
875
|
-
options?: {
|
|
876
|
-
feature_id: string;
|
|
877
|
-
quantity: number;
|
|
878
|
-
}[] | undefined;
|
|
879
|
-
success_url?: string | undefined;
|
|
880
|
-
customer_data?: {
|
|
881
|
-
name?: string | null | undefined;
|
|
882
|
-
email?: string | null | undefined;
|
|
883
|
-
fingerprint?: string | null | undefined;
|
|
884
|
-
} | undefined;
|
|
885
|
-
entity_data?: any;
|
|
886
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
887
|
-
reward?: string | undefined;
|
|
888
|
-
}, {
|
|
889
|
-
customer_id: string;
|
|
890
|
-
product_id: string;
|
|
891
|
-
entity_id?: string | undefined;
|
|
892
|
-
options?: {
|
|
893
|
-
feature_id: string;
|
|
894
|
-
quantity: number;
|
|
895
|
-
}[] | undefined;
|
|
896
|
-
success_url?: string | undefined;
|
|
897
|
-
customer_data?: {
|
|
898
|
-
name?: string | null | undefined;
|
|
899
|
-
email?: string | null | undefined;
|
|
900
|
-
fingerprint?: string | null | undefined;
|
|
901
|
-
} | undefined;
|
|
902
|
-
entity_data?: any;
|
|
903
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
904
|
-
reward?: string | undefined;
|
|
905
|
-
}>;
|
|
501
|
+
}, z.core.$strip>;
|
|
906
502
|
type CheckoutParams = z.infer<typeof CheckoutParamsSchema>;
|
|
907
503
|
type CheckoutResult = {
|
|
908
504
|
url?: string;
|
|
@@ -930,33 +526,33 @@ declare enum FeatureType {
|
|
|
930
526
|
ContinuousUse = "continuous_use",
|
|
931
527
|
CreditSystem = "credit_system"
|
|
932
528
|
}
|
|
933
|
-
declare const FeatureSchema: z.ZodObject<{
|
|
934
|
-
id: z.ZodString;
|
|
935
|
-
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
936
|
-
type: z.ZodNativeEnum<typeof FeatureType>;
|
|
937
|
-
display: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
938
|
-
singular: z.ZodString;
|
|
939
|
-
plural: z.ZodString;
|
|
940
|
-
}, "strip", z.ZodTypeAny, {
|
|
529
|
+
declare const FeatureSchema: z$1.ZodObject<{
|
|
530
|
+
id: z$1.ZodString;
|
|
531
|
+
name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
532
|
+
type: z$1.ZodNativeEnum<typeof FeatureType>;
|
|
533
|
+
display: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
534
|
+
singular: z$1.ZodString;
|
|
535
|
+
plural: z$1.ZodString;
|
|
536
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
941
537
|
singular: string;
|
|
942
538
|
plural: string;
|
|
943
539
|
}, {
|
|
944
540
|
singular: string;
|
|
945
541
|
plural: string;
|
|
946
542
|
}>>>;
|
|
947
|
-
credit_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
948
|
-
metered_feature_id: z.ZodString;
|
|
949
|
-
credit_cost: z.ZodNumber;
|
|
950
|
-
}, "strip", z.ZodTypeAny, {
|
|
543
|
+
credit_schema: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodArray<z$1.ZodObject<{
|
|
544
|
+
metered_feature_id: z$1.ZodString;
|
|
545
|
+
credit_cost: z$1.ZodNumber;
|
|
546
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
951
547
|
metered_feature_id: string;
|
|
952
548
|
credit_cost: number;
|
|
953
549
|
}, {
|
|
954
550
|
metered_feature_id: string;
|
|
955
551
|
credit_cost: number;
|
|
956
552
|
}>, "many">>>;
|
|
957
|
-
}, "strip", z.ZodTypeAny, {
|
|
958
|
-
type: FeatureType;
|
|
553
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
959
554
|
id: string;
|
|
555
|
+
type: FeatureType;
|
|
960
556
|
credit_schema?: {
|
|
961
557
|
metered_feature_id: string;
|
|
962
558
|
credit_cost: number;
|
|
@@ -967,8 +563,8 @@ declare const FeatureSchema: z.ZodObject<{
|
|
|
967
563
|
plural: string;
|
|
968
564
|
} | null | undefined;
|
|
969
565
|
}, {
|
|
970
|
-
type: FeatureType;
|
|
971
566
|
id: string;
|
|
567
|
+
type: FeatureType;
|
|
972
568
|
credit_schema?: {
|
|
973
569
|
metered_feature_id: string;
|
|
974
570
|
credit_cost: number;
|
|
@@ -979,7 +575,7 @@ declare const FeatureSchema: z.ZodObject<{
|
|
|
979
575
|
plural: string;
|
|
980
576
|
} | null | undefined;
|
|
981
577
|
}>;
|
|
982
|
-
type Feature = z.infer<typeof FeatureSchema>;
|
|
578
|
+
type Feature = z$1.infer<typeof FeatureSchema>;
|
|
983
579
|
|
|
984
580
|
type Success<T> = {
|
|
985
581
|
data: T;
|
|
@@ -1076,13 +672,68 @@ declare class Autumn {
|
|
|
1076
672
|
list: Feature[];
|
|
1077
673
|
}, AutumnError>>;
|
|
1078
674
|
};
|
|
1079
|
-
|
|
675
|
+
/**
|
|
676
|
+
* Initiates a checkout flow for a product purchase.
|
|
677
|
+
*
|
|
678
|
+
* The checkout function handles the purchase process for products with pricing.
|
|
679
|
+
* It determines whether to show a dialog for user input or redirect directly
|
|
680
|
+
* to Stripe based on the customer's state and product requirements.
|
|
681
|
+
*
|
|
682
|
+
* @param params - Checkout parameters including product ID, customer data, and options
|
|
683
|
+
* @returns Promise resolving to checkout details including pricing, prorations, and URLs
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* ```typescript
|
|
687
|
+
* const result = await autumn.checkout({
|
|
688
|
+
* customer_id: "user_123",
|
|
689
|
+
* product_id: "pro",
|
|
690
|
+
* success_url: "https://myapp.com/success"
|
|
691
|
+
* });
|
|
692
|
+
*
|
|
693
|
+
* if (result.url) {
|
|
694
|
+
* // Redirect to Stripe checkout
|
|
695
|
+
* window.location.href = result.url;
|
|
696
|
+
* }
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
1080
699
|
checkout(params: CheckoutParams): Promise<Result<CheckoutResult, AutumnError>>;
|
|
1081
|
-
static
|
|
700
|
+
static checkout: (params: CheckoutParams) => Promise<Result<CheckoutResult, AutumnError>>;
|
|
701
|
+
static usage: (params: UsageParams) => Promise<Result<UsageResult, AutumnError>>;
|
|
702
|
+
/**
|
|
703
|
+
* Attaches a product to a customer, enabling access and handling billing.
|
|
704
|
+
*
|
|
705
|
+
* The attach function activates a product for a customer and applies all product items.
|
|
706
|
+
* When you attach a product:
|
|
707
|
+
* - The customer gains access to all features in the product
|
|
708
|
+
* - If the product has prices, the customer will be billed accordingly
|
|
709
|
+
* - If there's no existing payment method, a checkout URL will be generated
|
|
710
|
+
*
|
|
711
|
+
* @param params - Attach parameters including customer ID, product ID, and options
|
|
712
|
+
* @returns Promise resolving to attachment result with checkout URL if needed
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* ```typescript
|
|
716
|
+
* const result = await autumn.attach({
|
|
717
|
+
* customer_id: "user_123",
|
|
718
|
+
* product_id: "pro",
|
|
719
|
+
* success_url: "https://myapp.com/success"
|
|
720
|
+
* });
|
|
721
|
+
*
|
|
722
|
+
* if (result.checkout_url) {
|
|
723
|
+
* // Payment required - redirect to checkout
|
|
724
|
+
* window.location.href = result.checkout_url;
|
|
725
|
+
* } else {
|
|
726
|
+
* // Product successfully attached
|
|
727
|
+
* console.log("Access granted:", result.message);
|
|
728
|
+
* }
|
|
729
|
+
* ```
|
|
730
|
+
*/
|
|
731
|
+
attach(params: AttachParams): Promise<Result<{
|
|
1082
732
|
customer_id: string;
|
|
733
|
+
product_ids: string[];
|
|
1083
734
|
code: string;
|
|
1084
735
|
message: string;
|
|
1085
|
-
|
|
736
|
+
checkout_url?: string | undefined;
|
|
1086
737
|
customer_data?: any;
|
|
1087
738
|
invoice?: {
|
|
1088
739
|
status: string;
|
|
@@ -1091,14 +742,13 @@ declare class Autumn {
|
|
|
1091
742
|
total: number;
|
|
1092
743
|
currency: string;
|
|
1093
744
|
} | undefined;
|
|
1094
|
-
checkout_url?: string | undefined;
|
|
1095
745
|
}, AutumnError>>;
|
|
1096
|
-
static
|
|
1097
|
-
attach(params: AttachParams): Promise<Result<{
|
|
746
|
+
static attach: (params: AttachParams) => Promise<Result<{
|
|
1098
747
|
customer_id: string;
|
|
748
|
+
product_ids: string[];
|
|
1099
749
|
code: string;
|
|
1100
750
|
message: string;
|
|
1101
|
-
|
|
751
|
+
checkout_url?: string | undefined;
|
|
1102
752
|
customer_data?: any;
|
|
1103
753
|
invoice?: {
|
|
1104
754
|
status: string;
|
|
@@ -1107,38 +757,152 @@ declare class Autumn {
|
|
|
1107
757
|
total: number;
|
|
1108
758
|
currency: string;
|
|
1109
759
|
} | undefined;
|
|
1110
|
-
checkout_url?: string | undefined;
|
|
1111
760
|
}, AutumnError>>;
|
|
1112
761
|
static setupPayment: (params: SetupPaymentParams) => Promise<Result<SetupPaymentResult, AutumnError>>;
|
|
762
|
+
/**
|
|
763
|
+
* Sets up a payment method for a customer.
|
|
764
|
+
*
|
|
765
|
+
* This method allows you to set up payment methods for customers without
|
|
766
|
+
* immediately charging them. Useful for collecting payment information
|
|
767
|
+
* before product attachment or for updating existing payment methods.
|
|
768
|
+
*
|
|
769
|
+
* @param params - Setup payment parameters including customer information
|
|
770
|
+
* @returns Promise resolving to setup payment result
|
|
771
|
+
*
|
|
772
|
+
* @example
|
|
773
|
+
* ```typescript
|
|
774
|
+
* const result = await autumn.setupPayment({
|
|
775
|
+
* customer_id: "user_123"
|
|
776
|
+
* });
|
|
777
|
+
* ```
|
|
778
|
+
*/
|
|
1113
779
|
setupPayment(params: SetupPaymentParams): Promise<Result<SetupPaymentResult, AutumnError>>;
|
|
1114
780
|
static cancel: (params: CancelParams) => Promise<Result<{
|
|
781
|
+
success: boolean;
|
|
1115
782
|
customer_id: string;
|
|
1116
783
|
product_id: string;
|
|
1117
|
-
success: boolean;
|
|
1118
784
|
}, AutumnError>>;
|
|
785
|
+
/**
|
|
786
|
+
* Cancels a customer's subscription or product attachment.
|
|
787
|
+
*
|
|
788
|
+
* This method allows you to cancel a customer's subscription to a specific product.
|
|
789
|
+
* You can choose to cancel immediately or at the end of the billing cycle.
|
|
790
|
+
*
|
|
791
|
+
* @param params - Cancel parameters including customer ID and product ID
|
|
792
|
+
* @returns Promise resolving to cancellation result
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```typescript
|
|
796
|
+
* const result = await autumn.cancel({
|
|
797
|
+
* customer_id: "user_123",
|
|
798
|
+
* product_id: "pro",
|
|
799
|
+
* cancel_immediately: false // Cancel at end of billing cycle
|
|
800
|
+
* });
|
|
801
|
+
* ```
|
|
802
|
+
*/
|
|
1119
803
|
cancel(params: CancelParams): Promise<Result<{
|
|
804
|
+
success: boolean;
|
|
1120
805
|
customer_id: string;
|
|
1121
806
|
product_id: string;
|
|
1122
|
-
success: boolean;
|
|
1123
807
|
}, AutumnError>>;
|
|
1124
808
|
static check: (params: CheckParams) => Promise<Result<CheckResult, AutumnError>>;
|
|
809
|
+
/**
|
|
810
|
+
* Checks if a customer has access to a specific feature.
|
|
811
|
+
*
|
|
812
|
+
* This method verifies whether a customer has permission to use a feature
|
|
813
|
+
* and checks their remaining balance/usage limits. It can be used to gate
|
|
814
|
+
* features and determine when to show upgrade prompts.
|
|
815
|
+
*
|
|
816
|
+
* @param params - Check parameters including customer ID and feature ID
|
|
817
|
+
* @returns Promise resolving to access check result with allowed status and balance info
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```typescript
|
|
821
|
+
* const result = await autumn.check({
|
|
822
|
+
* customer_id: "user_123",
|
|
823
|
+
* feature_id: "messages",
|
|
824
|
+
* required_balance: 1
|
|
825
|
+
* });
|
|
826
|
+
*
|
|
827
|
+
* if (!result.allowed) {
|
|
828
|
+
* console.log("Feature access denied - upgrade required");
|
|
829
|
+
* }
|
|
830
|
+
* ```
|
|
831
|
+
*/
|
|
1125
832
|
check(params: CheckParams): Promise<Result<CheckResult, AutumnError>>;
|
|
1126
833
|
static track: (params: TrackParams) => Promise<Result<{
|
|
1127
|
-
customer_id: string;
|
|
1128
|
-
code: string;
|
|
1129
834
|
id: string;
|
|
835
|
+
code: string;
|
|
836
|
+
customer_id: string;
|
|
1130
837
|
feature_id?: string | undefined;
|
|
1131
838
|
event_name?: string | undefined;
|
|
1132
839
|
}, AutumnError>>;
|
|
840
|
+
/**
|
|
841
|
+
* Tracks usage events for features or analytics.
|
|
842
|
+
*
|
|
843
|
+
* This method records usage events for metered features, updating the customer's
|
|
844
|
+
* balance and usage statistics. It's typically used server-side to ensure
|
|
845
|
+
* accurate tracking that cannot be manipulated by users.
|
|
846
|
+
*
|
|
847
|
+
* @param params - Track parameters including customer ID, feature ID, and usage value
|
|
848
|
+
* @returns Promise resolving to tracking result
|
|
849
|
+
*
|
|
850
|
+
* @example
|
|
851
|
+
* ```typescript
|
|
852
|
+
* const result = await autumn.track({
|
|
853
|
+
* customer_id: "user_123",
|
|
854
|
+
* feature_id: "messages",
|
|
855
|
+
* value: 1 // Track 1 message sent
|
|
856
|
+
* });
|
|
857
|
+
* ```
|
|
858
|
+
*/
|
|
1133
859
|
track(params: TrackParams): Promise<Result<{
|
|
1134
|
-
customer_id: string;
|
|
1135
|
-
code: string;
|
|
1136
860
|
id: string;
|
|
861
|
+
code: string;
|
|
862
|
+
customer_id: string;
|
|
1137
863
|
feature_id?: string | undefined;
|
|
1138
864
|
event_name?: string | undefined;
|
|
1139
865
|
}, AutumnError>>;
|
|
866
|
+
/**
|
|
867
|
+
* Retrieves usage statistics and analytics for a customer.
|
|
868
|
+
*
|
|
869
|
+
* This method fetches detailed usage information for a customer's features,
|
|
870
|
+
* including current balances, usage history, and analytics data. Useful
|
|
871
|
+
* for displaying usage dashboards or generating reports.
|
|
872
|
+
*
|
|
873
|
+
* @param params - Usage parameters including customer ID and optional filters
|
|
874
|
+
* @returns Promise resolving to usage statistics and analytics data
|
|
875
|
+
*
|
|
876
|
+
* @example
|
|
877
|
+
* ```typescript
|
|
878
|
+
* const result = await autumn.usage({
|
|
879
|
+
* customer_id: "user_123",
|
|
880
|
+
* feature_id: "messages"
|
|
881
|
+
* value: 20 // Usage value
|
|
882
|
+
* });
|
|
883
|
+
* ```
|
|
884
|
+
*/
|
|
1140
885
|
usage(params: UsageParams): Promise<Result<UsageResult, AutumnError>>;
|
|
1141
886
|
static query: (params: QueryParams) => Promise<Result<QueryResult, AutumnError>>;
|
|
887
|
+
/**
|
|
888
|
+
* Performs advanced queries on customer data and analytics.
|
|
889
|
+
*
|
|
890
|
+
* This method allows you to run complex queries against customer data,
|
|
891
|
+
* usage patterns, and billing information. Useful for generating reports,
|
|
892
|
+
* analytics, and custom data insights.
|
|
893
|
+
*
|
|
894
|
+
* @param params - Query parameters including customer ID and query specifications
|
|
895
|
+
* @returns Promise resolving to query results with requested data
|
|
896
|
+
*
|
|
897
|
+
* @example
|
|
898
|
+
* ```typescript
|
|
899
|
+
* const result = await autumn.query({
|
|
900
|
+
* customer_id: "user_123",
|
|
901
|
+
* feature_id: "messages" // feature id to fetch for query, can also be an array
|
|
902
|
+
* });
|
|
903
|
+
*
|
|
904
|
+
* ```
|
|
905
|
+
*/
|
|
1142
906
|
query(params: QueryParams): Promise<Result<QueryResult, AutumnError>>;
|
|
1143
907
|
}
|
|
1144
908
|
|
|
@@ -1198,27 +962,13 @@ interface Entity {
|
|
|
1198
962
|
declare const EntityDataSchema: z.ZodObject<{
|
|
1199
963
|
name: z.ZodOptional<z.ZodString>;
|
|
1200
964
|
feature_id: z.ZodString;
|
|
1201
|
-
},
|
|
1202
|
-
feature_id: string;
|
|
1203
|
-
name?: string | undefined;
|
|
1204
|
-
}, {
|
|
1205
|
-
feature_id: string;
|
|
1206
|
-
name?: string | undefined;
|
|
1207
|
-
}>;
|
|
965
|
+
}, z.core.$strip>;
|
|
1208
966
|
type EntityData = z.infer<typeof EntityDataSchema>;
|
|
1209
967
|
declare const TransferProductParamsSchema: z.ZodObject<{
|
|
1210
968
|
from_entity_id: z.ZodString;
|
|
1211
969
|
to_entity_id: z.ZodString;
|
|
1212
970
|
product_id: z.ZodString;
|
|
1213
|
-
},
|
|
1214
|
-
product_id: string;
|
|
1215
|
-
from_entity_id: string;
|
|
1216
|
-
to_entity_id: string;
|
|
1217
|
-
}, {
|
|
1218
|
-
product_id: string;
|
|
1219
|
-
from_entity_id: string;
|
|
1220
|
-
to_entity_id: string;
|
|
1221
|
-
}>;
|
|
971
|
+
}, z.core.$strip>;
|
|
1222
972
|
type TransferProductParams = z.infer<typeof TransferProductParamsSchema>;
|
|
1223
973
|
type TransferProductResult = {
|
|
1224
974
|
success: boolean;
|
|
@@ -1227,13 +977,7 @@ type TransferProductResult = {
|
|
|
1227
977
|
declare const CreateReferralCodeParamsSchema: z.ZodObject<{
|
|
1228
978
|
customer_id: z.ZodString;
|
|
1229
979
|
program_id: z.ZodString;
|
|
1230
|
-
},
|
|
1231
|
-
customer_id: string;
|
|
1232
|
-
program_id: string;
|
|
1233
|
-
}, {
|
|
1234
|
-
customer_id: string;
|
|
1235
|
-
program_id: string;
|
|
1236
|
-
}>;
|
|
980
|
+
}, z.core.$strip>;
|
|
1237
981
|
type CreateReferralCodeParams = z.infer<typeof CreateReferralCodeParamsSchema>;
|
|
1238
982
|
interface CreateReferralCodeResult {
|
|
1239
983
|
code: string;
|
|
@@ -1243,13 +987,7 @@ interface CreateReferralCodeResult {
|
|
|
1243
987
|
declare const RedeemReferralCodeParamsSchema: z.ZodObject<{
|
|
1244
988
|
code: z.ZodString;
|
|
1245
989
|
customer_id: z.ZodString;
|
|
1246
|
-
},
|
|
1247
|
-
customer_id: string;
|
|
1248
|
-
code: string;
|
|
1249
|
-
}, {
|
|
1250
|
-
customer_id: string;
|
|
1251
|
-
code: string;
|
|
1252
|
-
}>;
|
|
990
|
+
}, z.core.$strip>;
|
|
1253
991
|
type RedeemReferralCodeParams = z.infer<typeof RedeemReferralCodeParamsSchema>;
|
|
1254
992
|
interface RedeemReferralCodeResult {
|
|
1255
993
|
id: string;
|