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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { C as CustomerData, a as CheckFeatureResult, b as CheckProductResult, P as ProductItem, c as Product, G as GetCustomerParams, d as Customer, e as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, f as BillingPortalResult, g as UpdateBalancesParams, h as UpdateBalancesResult, i as CreateProductParams, L as ListProductsParams, j as CustomerProduct, k as CustomerFeature, l as CustomerInvoice } from './cusTypes-
|
|
2
|
-
import { z } from 'zod';
|
|
1
|
+
import { C as CustomerData, a as CheckFeatureResult, b as CheckProductResult, P as ProductItem, c as Product, G as GetCustomerParams, d as Customer, e as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, f as BillingPortalResult, g as UpdateBalancesParams, h as UpdateBalancesResult, i as CreateProductParams, L as ListProductsParams, j as CustomerProduct, k as CustomerFeature, l as CustomerInvoice } from './cusTypes-CTuY9T7g.mjs';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
import { z as z$1 } from 'zod';
|
|
3
4
|
import { R as Result, A as AutumnError } from './response-eH4S4sg0.mjs';
|
|
4
5
|
|
|
5
6
|
declare const CancelParamsSchema: z.ZodObject<{
|
|
@@ -7,17 +8,7 @@ declare const CancelParamsSchema: z.ZodObject<{
|
|
|
7
8
|
product_id: z.ZodString;
|
|
8
9
|
entity_id: z.ZodOptional<z.ZodString>;
|
|
9
10
|
cancel_immediately: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
-
},
|
|
11
|
-
product_id: string;
|
|
12
|
-
customer_id: string;
|
|
13
|
-
entity_id?: string | undefined;
|
|
14
|
-
cancel_immediately?: boolean | undefined;
|
|
15
|
-
}, {
|
|
16
|
-
product_id: string;
|
|
17
|
-
customer_id: string;
|
|
18
|
-
entity_id?: string | undefined;
|
|
19
|
-
cancel_immediately?: boolean | undefined;
|
|
20
|
-
}>;
|
|
11
|
+
}, z.core.$strip>;
|
|
21
12
|
type CancelParams = z.infer<typeof CancelParamsSchema>;
|
|
22
13
|
declare const TrackParamsSchema: z.ZodObject<{
|
|
23
14
|
customer_id: z.ZodString;
|
|
@@ -28,25 +19,7 @@ declare const TrackParamsSchema: z.ZodObject<{
|
|
|
28
19
|
customer_data: z.ZodOptional<z.ZodAny>;
|
|
29
20
|
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
30
21
|
entity_data: z.ZodOptional<z.ZodAny>;
|
|
31
|
-
},
|
|
32
|
-
customer_id: string;
|
|
33
|
-
value?: number | undefined;
|
|
34
|
-
feature_id?: string | undefined;
|
|
35
|
-
entity_id?: string | undefined;
|
|
36
|
-
customer_data?: any;
|
|
37
|
-
entity_data?: any;
|
|
38
|
-
event_name?: string | undefined;
|
|
39
|
-
idempotency_key?: string | undefined;
|
|
40
|
-
}, {
|
|
41
|
-
customer_id: string;
|
|
42
|
-
value?: number | undefined;
|
|
43
|
-
feature_id?: string | undefined;
|
|
44
|
-
entity_id?: string | undefined;
|
|
45
|
-
customer_data?: any;
|
|
46
|
-
entity_data?: any;
|
|
47
|
-
event_name?: string | undefined;
|
|
48
|
-
idempotency_key?: string | undefined;
|
|
49
|
-
}>;
|
|
22
|
+
}, z.core.$strip>;
|
|
50
23
|
type TrackParams = z.infer<typeof TrackParamsSchema>;
|
|
51
24
|
declare const CheckParamsSchema: z.ZodObject<{
|
|
52
25
|
customer_id: z.ZodString;
|
|
@@ -60,40 +33,8 @@ declare const CheckParamsSchema: z.ZodObject<{
|
|
|
60
33
|
entity_data: z.ZodOptional<z.ZodObject<{
|
|
61
34
|
name: z.ZodOptional<z.ZodString>;
|
|
62
35
|
feature_id: z.ZodString;
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
name?: string | undefined;
|
|
66
|
-
}, {
|
|
67
|
-
feature_id: string;
|
|
68
|
-
name?: string | undefined;
|
|
69
|
-
}>>;
|
|
70
|
-
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
customer_id: string;
|
|
72
|
-
feature_id?: string | undefined;
|
|
73
|
-
product_id?: string | undefined;
|
|
74
|
-
entity_id?: string | undefined;
|
|
75
|
-
required_balance?: number | undefined;
|
|
76
|
-
customer_data?: any;
|
|
77
|
-
entity_data?: {
|
|
78
|
-
feature_id: string;
|
|
79
|
-
name?: string | undefined;
|
|
80
|
-
} | undefined;
|
|
81
|
-
send_event?: boolean | undefined;
|
|
82
|
-
with_preview?: boolean | undefined;
|
|
83
|
-
}, {
|
|
84
|
-
customer_id: string;
|
|
85
|
-
feature_id?: string | undefined;
|
|
86
|
-
product_id?: string | undefined;
|
|
87
|
-
entity_id?: string | undefined;
|
|
88
|
-
required_balance?: number | undefined;
|
|
89
|
-
customer_data?: any;
|
|
90
|
-
entity_data?: {
|
|
91
|
-
feature_id: string;
|
|
92
|
-
name?: string | undefined;
|
|
93
|
-
} | undefined;
|
|
94
|
-
send_event?: boolean | undefined;
|
|
95
|
-
with_preview?: boolean | undefined;
|
|
96
|
-
}>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
97
38
|
type CheckParams = z.infer<typeof CheckParamsSchema>;
|
|
98
39
|
type CheckResult = CheckFeatureResult & CheckProductResult;
|
|
99
40
|
interface UsageParams {
|
|
@@ -118,17 +59,15 @@ interface SetupPaymentResult {
|
|
|
118
59
|
}
|
|
119
60
|
declare const QueryParamsSchema: z.ZodObject<{
|
|
120
61
|
customer_id: z.ZodString;
|
|
121
|
-
feature_id: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString
|
|
122
|
-
range: z.ZodOptional<z.ZodEnum<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
range?: "24h" | "7d" | "30d" | "90d" | "last_cycle" | undefined;
|
|
131
|
-
}>;
|
|
62
|
+
feature_id: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
63
|
+
range: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
"24h": "24h";
|
|
65
|
+
"7d": "7d";
|
|
66
|
+
"30d": "30d";
|
|
67
|
+
"90d": "90d";
|
|
68
|
+
last_cycle: "last_cycle";
|
|
69
|
+
}>>;
|
|
70
|
+
}, z.core.$strip>;
|
|
132
71
|
type QueryParams = z.infer<typeof QueryParamsSchema>;
|
|
133
72
|
type QueryResult = {
|
|
134
73
|
list: Array<{
|
|
@@ -141,13 +80,7 @@ type QueryResult = {
|
|
|
141
80
|
declare const AttachFeatureOptionsSchema: z.ZodObject<{
|
|
142
81
|
feature_id: z.ZodString;
|
|
143
82
|
quantity: z.ZodNumber;
|
|
144
|
-
},
|
|
145
|
-
feature_id: string;
|
|
146
|
-
quantity: number;
|
|
147
|
-
}, {
|
|
148
|
-
feature_id: string;
|
|
149
|
-
quantity: number;
|
|
150
|
-
}>;
|
|
83
|
+
}, z.core.$strip>;
|
|
151
84
|
type AttachFeatureOptions = z.infer<typeof AttachFeatureOptionsSchema>;
|
|
152
85
|
declare const AttachParamsSchema: z.ZodObject<{
|
|
153
86
|
customer_id: z.ZodString;
|
|
@@ -156,14 +89,8 @@ declare const AttachParamsSchema: z.ZodObject<{
|
|
|
156
89
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
157
90
|
feature_id: z.ZodString;
|
|
158
91
|
quantity: z.ZodNumber;
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
quantity: number;
|
|
162
|
-
}, {
|
|
163
|
-
feature_id: string;
|
|
164
|
-
quantity: number;
|
|
165
|
-
}>, "many">>;
|
|
166
|
-
product_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
92
|
+
}, z.core.$strip>>>;
|
|
93
|
+
product_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
167
94
|
free_trial: z.ZodOptional<z.ZodBoolean>;
|
|
168
95
|
success_url: z.ZodOptional<z.ZodString>;
|
|
169
96
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -172,64 +99,12 @@ declare const AttachParamsSchema: z.ZodObject<{
|
|
|
172
99
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
173
100
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
174
101
|
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
175
|
-
},
|
|
176
|
-
name?: string | null | undefined;
|
|
177
|
-
email?: string | null | undefined;
|
|
178
|
-
fingerprint?: string | null | undefined;
|
|
179
|
-
}, {
|
|
180
|
-
name?: string | null | undefined;
|
|
181
|
-
email?: string | null | undefined;
|
|
182
|
-
fingerprint?: string | null | undefined;
|
|
183
|
-
}>>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
184
103
|
entity_data: z.ZodOptional<z.ZodAny>;
|
|
185
104
|
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
186
105
|
reward: z.ZodOptional<z.ZodString>;
|
|
187
106
|
invoice: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
-
},
|
|
189
|
-
customer_id: string;
|
|
190
|
-
options?: {
|
|
191
|
-
feature_id: string;
|
|
192
|
-
quantity: number;
|
|
193
|
-
}[] | undefined;
|
|
194
|
-
metadata?: Record<string, string> | undefined;
|
|
195
|
-
product_id?: string | undefined;
|
|
196
|
-
entity_id?: string | undefined;
|
|
197
|
-
product_ids?: string[] | undefined;
|
|
198
|
-
free_trial?: boolean | undefined;
|
|
199
|
-
success_url?: string | undefined;
|
|
200
|
-
force_checkout?: boolean | undefined;
|
|
201
|
-
customer_data?: {
|
|
202
|
-
name?: string | null | undefined;
|
|
203
|
-
email?: string | null | undefined;
|
|
204
|
-
fingerprint?: string | null | undefined;
|
|
205
|
-
} | undefined;
|
|
206
|
-
entity_data?: any;
|
|
207
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
208
|
-
reward?: string | undefined;
|
|
209
|
-
invoice?: boolean | undefined;
|
|
210
|
-
}, {
|
|
211
|
-
customer_id: string;
|
|
212
|
-
options?: {
|
|
213
|
-
feature_id: string;
|
|
214
|
-
quantity: number;
|
|
215
|
-
}[] | undefined;
|
|
216
|
-
metadata?: Record<string, string> | undefined;
|
|
217
|
-
product_id?: string | undefined;
|
|
218
|
-
entity_id?: string | undefined;
|
|
219
|
-
product_ids?: string[] | undefined;
|
|
220
|
-
free_trial?: boolean | undefined;
|
|
221
|
-
success_url?: string | undefined;
|
|
222
|
-
force_checkout?: boolean | undefined;
|
|
223
|
-
customer_data?: {
|
|
224
|
-
name?: string | null | undefined;
|
|
225
|
-
email?: string | null | undefined;
|
|
226
|
-
fingerprint?: string | null | undefined;
|
|
227
|
-
} | undefined;
|
|
228
|
-
entity_data?: any;
|
|
229
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
230
|
-
reward?: string | undefined;
|
|
231
|
-
invoice?: boolean | undefined;
|
|
232
|
-
}>;
|
|
107
|
+
}, z.core.$strip>;
|
|
233
108
|
type AttachParams = z.infer<typeof AttachParamsSchema>;
|
|
234
109
|
declare const CheckoutParamsSchema: z.ZodObject<{
|
|
235
110
|
customer_id: z.ZodString;
|
|
@@ -238,65 +113,19 @@ declare const CheckoutParamsSchema: z.ZodObject<{
|
|
|
238
113
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
239
114
|
feature_id: z.ZodString;
|
|
240
115
|
quantity: z.ZodNumber;
|
|
241
|
-
},
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}, {
|
|
245
|
-
feature_id: string;
|
|
246
|
-
quantity: number;
|
|
247
|
-
}>, "many">>;
|
|
116
|
+
}, z.core.$strip>>>;
|
|
117
|
+
force_checkout: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
+
invoice: z.ZodOptional<z.ZodBoolean>;
|
|
248
119
|
success_url: z.ZodOptional<z.ZodString>;
|
|
249
120
|
customer_data: z.ZodOptional<z.ZodObject<{
|
|
250
121
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
251
122
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
123
|
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
-
},
|
|
254
|
-
name?: string | null | undefined;
|
|
255
|
-
email?: string | null | undefined;
|
|
256
|
-
fingerprint?: string | null | undefined;
|
|
257
|
-
}, {
|
|
258
|
-
name?: string | null | undefined;
|
|
259
|
-
email?: string | null | undefined;
|
|
260
|
-
fingerprint?: string | null | undefined;
|
|
261
|
-
}>>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
262
125
|
entity_data: z.ZodOptional<z.ZodAny>;
|
|
263
126
|
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
264
127
|
reward: z.ZodOptional<z.ZodString>;
|
|
265
|
-
},
|
|
266
|
-
product_id: string;
|
|
267
|
-
customer_id: string;
|
|
268
|
-
options?: {
|
|
269
|
-
feature_id: string;
|
|
270
|
-
quantity: number;
|
|
271
|
-
}[] | undefined;
|
|
272
|
-
entity_id?: string | undefined;
|
|
273
|
-
success_url?: string | undefined;
|
|
274
|
-
customer_data?: {
|
|
275
|
-
name?: string | null | undefined;
|
|
276
|
-
email?: string | null | undefined;
|
|
277
|
-
fingerprint?: string | null | undefined;
|
|
278
|
-
} | undefined;
|
|
279
|
-
entity_data?: any;
|
|
280
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
281
|
-
reward?: string | undefined;
|
|
282
|
-
}, {
|
|
283
|
-
product_id: string;
|
|
284
|
-
customer_id: string;
|
|
285
|
-
options?: {
|
|
286
|
-
feature_id: string;
|
|
287
|
-
quantity: number;
|
|
288
|
-
}[] | undefined;
|
|
289
|
-
entity_id?: string | undefined;
|
|
290
|
-
success_url?: string | undefined;
|
|
291
|
-
customer_data?: {
|
|
292
|
-
name?: string | null | undefined;
|
|
293
|
-
email?: string | null | undefined;
|
|
294
|
-
fingerprint?: string | null | undefined;
|
|
295
|
-
} | undefined;
|
|
296
|
-
entity_data?: any;
|
|
297
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
298
|
-
reward?: string | undefined;
|
|
299
|
-
}>;
|
|
128
|
+
}, z.core.$strip>;
|
|
300
129
|
type CheckoutParams = z.infer<typeof CheckoutParamsSchema>;
|
|
301
130
|
type CheckoutResult = {
|
|
302
131
|
url?: string;
|
|
@@ -324,33 +153,33 @@ declare enum FeatureType {
|
|
|
324
153
|
ContinuousUse = "continuous_use",
|
|
325
154
|
CreditSystem = "credit_system"
|
|
326
155
|
}
|
|
327
|
-
declare const FeatureSchema: z.ZodObject<{
|
|
328
|
-
id: z.ZodString;
|
|
329
|
-
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
330
|
-
type: z.ZodNativeEnum<typeof FeatureType>;
|
|
331
|
-
display: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
332
|
-
singular: z.ZodString;
|
|
333
|
-
plural: z.ZodString;
|
|
334
|
-
}, "strip", z.ZodTypeAny, {
|
|
156
|
+
declare const FeatureSchema: z$1.ZodObject<{
|
|
157
|
+
id: z$1.ZodString;
|
|
158
|
+
name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
159
|
+
type: z$1.ZodNativeEnum<typeof FeatureType>;
|
|
160
|
+
display: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
161
|
+
singular: z$1.ZodString;
|
|
162
|
+
plural: z$1.ZodString;
|
|
163
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
335
164
|
singular: string;
|
|
336
165
|
plural: string;
|
|
337
166
|
}, {
|
|
338
167
|
singular: string;
|
|
339
168
|
plural: string;
|
|
340
169
|
}>>>;
|
|
341
|
-
credit_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
342
|
-
metered_feature_id: z.ZodString;
|
|
343
|
-
credit_cost: z.ZodNumber;
|
|
344
|
-
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
credit_schema: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodArray<z$1.ZodObject<{
|
|
171
|
+
metered_feature_id: z$1.ZodString;
|
|
172
|
+
credit_cost: z$1.ZodNumber;
|
|
173
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
345
174
|
metered_feature_id: string;
|
|
346
175
|
credit_cost: number;
|
|
347
176
|
}, {
|
|
348
177
|
metered_feature_id: string;
|
|
349
178
|
credit_cost: number;
|
|
350
179
|
}>, "many">>>;
|
|
351
|
-
}, "strip", z.ZodTypeAny, {
|
|
352
|
-
type: FeatureType;
|
|
180
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
353
181
|
id: string;
|
|
182
|
+
type: FeatureType;
|
|
354
183
|
name?: string | null | undefined;
|
|
355
184
|
credit_schema?: {
|
|
356
185
|
metered_feature_id: string;
|
|
@@ -361,8 +190,8 @@ declare const FeatureSchema: z.ZodObject<{
|
|
|
361
190
|
plural: string;
|
|
362
191
|
} | null | undefined;
|
|
363
192
|
}, {
|
|
364
|
-
type: FeatureType;
|
|
365
193
|
id: string;
|
|
194
|
+
type: FeatureType;
|
|
366
195
|
name?: string | null | undefined;
|
|
367
196
|
credit_schema?: {
|
|
368
197
|
metered_feature_id: string;
|
|
@@ -373,7 +202,7 @@ declare const FeatureSchema: z.ZodObject<{
|
|
|
373
202
|
plural: string;
|
|
374
203
|
} | null | undefined;
|
|
375
204
|
}>;
|
|
376
|
-
type Feature = z.infer<typeof FeatureSchema>;
|
|
205
|
+
type Feature = z$1.infer<typeof FeatureSchema>;
|
|
377
206
|
|
|
378
207
|
declare class Autumn {
|
|
379
208
|
private readonly secretKey;
|
|
@@ -452,13 +281,68 @@ declare class Autumn {
|
|
|
452
281
|
list: Feature[];
|
|
453
282
|
}, AutumnError>>;
|
|
454
283
|
};
|
|
455
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Initiates a checkout flow for a product purchase.
|
|
286
|
+
*
|
|
287
|
+
* The checkout function handles the purchase process for products with pricing.
|
|
288
|
+
* It determines whether to show a dialog for user input or redirect directly
|
|
289
|
+
* to Stripe based on the customer's state and product requirements.
|
|
290
|
+
*
|
|
291
|
+
* @param params - Checkout parameters including product ID, customer data, and options
|
|
292
|
+
* @returns Promise resolving to checkout details including pricing, prorations, and URLs
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* const result = await autumn.checkout({
|
|
297
|
+
* customer_id: "user_123",
|
|
298
|
+
* product_id: "pro",
|
|
299
|
+
* success_url: "https://myapp.com/success"
|
|
300
|
+
* });
|
|
301
|
+
*
|
|
302
|
+
* if (result.url) {
|
|
303
|
+
* // Redirect to Stripe checkout
|
|
304
|
+
* window.location.href = result.url;
|
|
305
|
+
* }
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
456
308
|
checkout(params: CheckoutParams): Promise<Result<CheckoutResult, AutumnError>>;
|
|
457
|
-
static
|
|
458
|
-
|
|
459
|
-
|
|
309
|
+
static checkout: (params: CheckoutParams) => Promise<Result<CheckoutResult, AutumnError>>;
|
|
310
|
+
static usage: (params: UsageParams) => Promise<Result<UsageResult, AutumnError>>;
|
|
311
|
+
/**
|
|
312
|
+
* Attaches a product to a customer, enabling access and handling billing.
|
|
313
|
+
*
|
|
314
|
+
* The attach function activates a product for a customer and applies all product items.
|
|
315
|
+
* When you attach a product:
|
|
316
|
+
* - The customer gains access to all features in the product
|
|
317
|
+
* - If the product has prices, the customer will be billed accordingly
|
|
318
|
+
* - If there's no existing payment method, a checkout URL will be generated
|
|
319
|
+
*
|
|
320
|
+
* @param params - Attach parameters including customer ID, product ID, and options
|
|
321
|
+
* @returns Promise resolving to attachment result with checkout URL if needed
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* const result = await autumn.attach({
|
|
326
|
+
* customer_id: "user_123",
|
|
327
|
+
* product_id: "pro",
|
|
328
|
+
* success_url: "https://myapp.com/success"
|
|
329
|
+
* });
|
|
330
|
+
*
|
|
331
|
+
* if (result.checkout_url) {
|
|
332
|
+
* // Payment required - redirect to checkout
|
|
333
|
+
* window.location.href = result.checkout_url;
|
|
334
|
+
* } else {
|
|
335
|
+
* // Product successfully attached
|
|
336
|
+
* console.log("Access granted:", result.message);
|
|
337
|
+
* }
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
attach(params: AttachParams): Promise<Result<{
|
|
460
341
|
customer_id: string;
|
|
461
342
|
product_ids: string[];
|
|
343
|
+
code: string;
|
|
344
|
+
message: string;
|
|
345
|
+
checkout_url?: string | undefined;
|
|
462
346
|
customer_data?: any;
|
|
463
347
|
invoice?: {
|
|
464
348
|
status: string;
|
|
@@ -467,14 +351,13 @@ declare class Autumn {
|
|
|
467
351
|
total: number;
|
|
468
352
|
currency: string;
|
|
469
353
|
} | undefined;
|
|
470
|
-
checkout_url?: string | undefined;
|
|
471
354
|
}, AutumnError>>;
|
|
472
|
-
static
|
|
473
|
-
attach(params: AttachParams): Promise<Result<{
|
|
474
|
-
code: string;
|
|
475
|
-
message: string;
|
|
355
|
+
static attach: (params: AttachParams) => Promise<Result<{
|
|
476
356
|
customer_id: string;
|
|
477
357
|
product_ids: string[];
|
|
358
|
+
code: string;
|
|
359
|
+
message: string;
|
|
360
|
+
checkout_url?: string | undefined;
|
|
478
361
|
customer_data?: any;
|
|
479
362
|
invoice?: {
|
|
480
363
|
status: string;
|
|
@@ -483,38 +366,152 @@ declare class Autumn {
|
|
|
483
366
|
total: number;
|
|
484
367
|
currency: string;
|
|
485
368
|
} | undefined;
|
|
486
|
-
checkout_url?: string | undefined;
|
|
487
369
|
}, AutumnError>>;
|
|
488
370
|
static setupPayment: (params: SetupPaymentParams) => Promise<Result<SetupPaymentResult, AutumnError>>;
|
|
371
|
+
/**
|
|
372
|
+
* Sets up a payment method for a customer.
|
|
373
|
+
*
|
|
374
|
+
* This method allows you to set up payment methods for customers without
|
|
375
|
+
* immediately charging them. Useful for collecting payment information
|
|
376
|
+
* before product attachment or for updating existing payment methods.
|
|
377
|
+
*
|
|
378
|
+
* @param params - Setup payment parameters including customer information
|
|
379
|
+
* @returns Promise resolving to setup payment result
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```typescript
|
|
383
|
+
* const result = await autumn.setupPayment({
|
|
384
|
+
* customer_id: "user_123"
|
|
385
|
+
* });
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
489
388
|
setupPayment(params: SetupPaymentParams): Promise<Result<SetupPaymentResult, AutumnError>>;
|
|
490
389
|
static cancel: (params: CancelParams) => Promise<Result<{
|
|
491
|
-
product_id: string;
|
|
492
|
-
customer_id: string;
|
|
493
390
|
success: boolean;
|
|
391
|
+
customer_id: string;
|
|
392
|
+
product_id: string;
|
|
494
393
|
}, AutumnError>>;
|
|
394
|
+
/**
|
|
395
|
+
* Cancels a customer's subscription or product attachment.
|
|
396
|
+
*
|
|
397
|
+
* This method allows you to cancel a customer's subscription to a specific product.
|
|
398
|
+
* You can choose to cancel immediately or at the end of the billing cycle.
|
|
399
|
+
*
|
|
400
|
+
* @param params - Cancel parameters including customer ID and product ID
|
|
401
|
+
* @returns Promise resolving to cancellation result
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```typescript
|
|
405
|
+
* const result = await autumn.cancel({
|
|
406
|
+
* customer_id: "user_123",
|
|
407
|
+
* product_id: "pro",
|
|
408
|
+
* cancel_immediately: false // Cancel at end of billing cycle
|
|
409
|
+
* });
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
495
412
|
cancel(params: CancelParams): Promise<Result<{
|
|
496
|
-
product_id: string;
|
|
497
|
-
customer_id: string;
|
|
498
413
|
success: boolean;
|
|
414
|
+
customer_id: string;
|
|
415
|
+
product_id: string;
|
|
499
416
|
}, AutumnError>>;
|
|
500
417
|
static check: (params: CheckParams) => Promise<Result<CheckResult, AutumnError>>;
|
|
418
|
+
/**
|
|
419
|
+
* Checks if a customer has access to a specific feature.
|
|
420
|
+
*
|
|
421
|
+
* This method verifies whether a customer has permission to use a feature
|
|
422
|
+
* and checks their remaining balance/usage limits. It can be used to gate
|
|
423
|
+
* features and determine when to show upgrade prompts.
|
|
424
|
+
*
|
|
425
|
+
* @param params - Check parameters including customer ID and feature ID
|
|
426
|
+
* @returns Promise resolving to access check result with allowed status and balance info
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* const result = await autumn.check({
|
|
431
|
+
* customer_id: "user_123",
|
|
432
|
+
* feature_id: "messages",
|
|
433
|
+
* required_balance: 1
|
|
434
|
+
* });
|
|
435
|
+
*
|
|
436
|
+
* if (!result.allowed) {
|
|
437
|
+
* console.log("Feature access denied - upgrade required");
|
|
438
|
+
* }
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
501
441
|
check(params: CheckParams): Promise<Result<CheckResult, AutumnError>>;
|
|
502
442
|
static track: (params: TrackParams) => Promise<Result<{
|
|
503
|
-
code: string;
|
|
504
443
|
id: string;
|
|
444
|
+
code: string;
|
|
505
445
|
customer_id: string;
|
|
506
446
|
feature_id?: string | undefined;
|
|
507
447
|
event_name?: string | undefined;
|
|
508
448
|
}, AutumnError>>;
|
|
449
|
+
/**
|
|
450
|
+
* Tracks usage events for features or analytics.
|
|
451
|
+
*
|
|
452
|
+
* This method records usage events for metered features, updating the customer's
|
|
453
|
+
* balance and usage statistics. It's typically used server-side to ensure
|
|
454
|
+
* accurate tracking that cannot be manipulated by users.
|
|
455
|
+
*
|
|
456
|
+
* @param params - Track parameters including customer ID, feature ID, and usage value
|
|
457
|
+
* @returns Promise resolving to tracking result
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```typescript
|
|
461
|
+
* const result = await autumn.track({
|
|
462
|
+
* customer_id: "user_123",
|
|
463
|
+
* feature_id: "messages",
|
|
464
|
+
* value: 1 // Track 1 message sent
|
|
465
|
+
* });
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
509
468
|
track(params: TrackParams): Promise<Result<{
|
|
510
|
-
code: string;
|
|
511
469
|
id: string;
|
|
470
|
+
code: string;
|
|
512
471
|
customer_id: string;
|
|
513
472
|
feature_id?: string | undefined;
|
|
514
473
|
event_name?: string | undefined;
|
|
515
474
|
}, AutumnError>>;
|
|
475
|
+
/**
|
|
476
|
+
* Retrieves usage statistics and analytics for a customer.
|
|
477
|
+
*
|
|
478
|
+
* This method fetches detailed usage information for a customer's features,
|
|
479
|
+
* including current balances, usage history, and analytics data. Useful
|
|
480
|
+
* for displaying usage dashboards or generating reports.
|
|
481
|
+
*
|
|
482
|
+
* @param params - Usage parameters including customer ID and optional filters
|
|
483
|
+
* @returns Promise resolving to usage statistics and analytics data
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```typescript
|
|
487
|
+
* const result = await autumn.usage({
|
|
488
|
+
* customer_id: "user_123",
|
|
489
|
+
* feature_id: "messages"
|
|
490
|
+
* value: 20 // Usage value
|
|
491
|
+
* });
|
|
492
|
+
* ```
|
|
493
|
+
*/
|
|
516
494
|
usage(params: UsageParams): Promise<Result<UsageResult, AutumnError>>;
|
|
517
495
|
static query: (params: QueryParams) => Promise<Result<QueryResult, AutumnError>>;
|
|
496
|
+
/**
|
|
497
|
+
* Performs advanced queries on customer data and analytics.
|
|
498
|
+
*
|
|
499
|
+
* This method allows you to run complex queries against customer data,
|
|
500
|
+
* usage patterns, and billing information. Useful for generating reports,
|
|
501
|
+
* analytics, and custom data insights.
|
|
502
|
+
*
|
|
503
|
+
* @param params - Query parameters including customer ID and query specifications
|
|
504
|
+
* @returns Promise resolving to query results with requested data
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```typescript
|
|
508
|
+
* const result = await autumn.query({
|
|
509
|
+
* customer_id: "user_123",
|
|
510
|
+
* feature_id: "messages" // feature id to fetch for query, can also be an array
|
|
511
|
+
* });
|
|
512
|
+
*
|
|
513
|
+
* ```
|
|
514
|
+
*/
|
|
518
515
|
query(params: QueryParams): Promise<Result<QueryResult, AutumnError>>;
|
|
519
516
|
}
|
|
520
517
|
|
|
@@ -549,15 +546,7 @@ declare const TransferProductParamsSchema: z.ZodObject<{
|
|
|
549
546
|
from_entity_id: z.ZodString;
|
|
550
547
|
to_entity_id: z.ZodString;
|
|
551
548
|
product_id: z.ZodString;
|
|
552
|
-
},
|
|
553
|
-
from_entity_id: string;
|
|
554
|
-
to_entity_id: string;
|
|
555
|
-
product_id: string;
|
|
556
|
-
}, {
|
|
557
|
-
from_entity_id: string;
|
|
558
|
-
to_entity_id: string;
|
|
559
|
-
product_id: string;
|
|
560
|
-
}>;
|
|
549
|
+
}, z.core.$strip>;
|
|
561
550
|
type TransferProductParams = z.infer<typeof TransferProductParamsSchema>;
|
|
562
551
|
type TransferProductResult = {
|
|
563
552
|
success: boolean;
|
|
@@ -566,24 +555,12 @@ type TransferProductResult = {
|
|
|
566
555
|
declare const CreateReferralCodeParamsSchema: z.ZodObject<{
|
|
567
556
|
customer_id: z.ZodString;
|
|
568
557
|
program_id: z.ZodString;
|
|
569
|
-
},
|
|
570
|
-
customer_id: string;
|
|
571
|
-
program_id: string;
|
|
572
|
-
}, {
|
|
573
|
-
customer_id: string;
|
|
574
|
-
program_id: string;
|
|
575
|
-
}>;
|
|
558
|
+
}, z.core.$strip>;
|
|
576
559
|
type CreateReferralCodeParams = z.infer<typeof CreateReferralCodeParamsSchema>;
|
|
577
560
|
declare const RedeemReferralCodeParamsSchema: z.ZodObject<{
|
|
578
561
|
code: z.ZodString;
|
|
579
562
|
customer_id: z.ZodString;
|
|
580
|
-
},
|
|
581
|
-
code: string;
|
|
582
|
-
customer_id: string;
|
|
583
|
-
}, {
|
|
584
|
-
code: string;
|
|
585
|
-
customer_id: string;
|
|
586
|
-
}>;
|
|
563
|
+
}, z.core.$strip>;
|
|
587
564
|
type RedeemReferralCodeParams = z.infer<typeof RedeemReferralCodeParamsSchema>;
|
|
588
565
|
|
|
589
566
|
interface CreateEntityParams {
|