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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { A as AppEnv, P as ProductItem, b as ProductItemInterval } from './prodTypes-DwM7QuGf.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
|
|
4
|
+
declare enum ProductStatus {
|
|
5
|
+
Active = "active",
|
|
6
|
+
Expired = "expired",
|
|
7
|
+
Trialing = "trialing",
|
|
8
|
+
Scheduled = "scheduled",
|
|
9
|
+
PastDue = "past_due"
|
|
10
|
+
}
|
|
11
|
+
type CustomerExpandOption = "invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method";
|
|
12
|
+
|
|
13
|
+
declare const CoreCusFeatureSchema: z.ZodObject<{
|
|
14
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
interval: z.ZodOptional<z.ZodEnum<typeof ProductItemInterval>>;
|
|
16
|
+
balance: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
17
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
next_reset_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
20
|
+
overage_allowed: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
usage_limit: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
rollovers: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
balance: z.ZodNumber;
|
|
24
|
+
expires_at: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
breakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
27
|
+
interval: z.ZodEnum<typeof ProductItemInterval>;
|
|
28
|
+
balance: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
next_reset_at: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, z.core.$strip>>>;
|
|
33
|
+
credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
|
+
feature_id: z.ZodString;
|
|
35
|
+
credit_amount: z.ZodNumber;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
type CoreCustomerFeature = z.infer<typeof CoreCusFeatureSchema>;
|
|
39
|
+
interface CustomerFeature extends CoreCustomerFeature {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
type: "static" | "single_use" | "continuous_use";
|
|
43
|
+
}
|
|
44
|
+
interface CustomerProduct {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string | null;
|
|
47
|
+
group: string | null;
|
|
48
|
+
status: ProductStatus;
|
|
49
|
+
started_at: number;
|
|
50
|
+
canceled_at: number | null;
|
|
51
|
+
version: number;
|
|
52
|
+
subscription_ids?: string[] | null;
|
|
53
|
+
current_period_start?: number | null;
|
|
54
|
+
current_period_end?: number | null;
|
|
55
|
+
trial_ends_at?: number;
|
|
56
|
+
entity_id?: string;
|
|
57
|
+
is_add_on: boolean;
|
|
58
|
+
is_default: boolean;
|
|
59
|
+
items: ProductItem[];
|
|
60
|
+
}
|
|
61
|
+
interface Customer {
|
|
62
|
+
id: string | null;
|
|
63
|
+
created_at: number;
|
|
64
|
+
name: string | null;
|
|
65
|
+
email: string | null;
|
|
66
|
+
fingerprint: string | null;
|
|
67
|
+
stripe_id: string | null;
|
|
68
|
+
env: AppEnv;
|
|
69
|
+
metadata: Record<string, any>;
|
|
70
|
+
products: CustomerProduct[];
|
|
71
|
+
features: Record<string, CustomerFeature>;
|
|
72
|
+
invoices?: CustomerInvoice[];
|
|
73
|
+
payment_method?: any;
|
|
74
|
+
}
|
|
75
|
+
declare const CustomerDataSchema: z.ZodObject<{
|
|
76
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
type CustomerData = z.infer<typeof CustomerDataSchema>;
|
|
81
|
+
declare const CreateCustomerParamsSchema: z.ZodObject<{
|
|
82
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
85
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
87
|
+
expand: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
88
|
+
invoices: "invoices";
|
|
89
|
+
rewards: "rewards";
|
|
90
|
+
trials_used: "trials_used";
|
|
91
|
+
entities: "entities";
|
|
92
|
+
referrals: "referrals";
|
|
93
|
+
payment_method: "payment_method";
|
|
94
|
+
}>>>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
type CreateCustomerParams = z.infer<typeof CreateCustomerParamsSchema>;
|
|
97
|
+
interface BillingPortalResult {
|
|
98
|
+
customer_id: string;
|
|
99
|
+
url: string;
|
|
100
|
+
}
|
|
101
|
+
interface CustomerInvoice {
|
|
102
|
+
product_ids: string[];
|
|
103
|
+
stripe_id: string;
|
|
104
|
+
status: string;
|
|
105
|
+
total: number;
|
|
106
|
+
currency: string;
|
|
107
|
+
created_at: number;
|
|
108
|
+
hosted_invoice_url: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type { BillingPortalResult as B, CustomerData as C, Customer as a, CustomerProduct as b, CustomerFeature as c, CustomerInvoice as d, CreateCustomerParams as e, CustomerExpandOption as f };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { A as AppEnv, P as ProductItem, b as ProductItemInterval } from './prodTypes-DwM7QuGf.mjs';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
|
|
4
|
+
declare enum ProductStatus {
|
|
5
|
+
Active = "active",
|
|
6
|
+
Expired = "expired",
|
|
7
|
+
Trialing = "trialing",
|
|
8
|
+
Scheduled = "scheduled",
|
|
9
|
+
PastDue = "past_due"
|
|
10
|
+
}
|
|
11
|
+
type CustomerExpandOption = "invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method";
|
|
12
|
+
|
|
13
|
+
declare const CoreCusFeatureSchema: z.ZodObject<{
|
|
14
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
interval: z.ZodOptional<z.ZodEnum<typeof ProductItemInterval>>;
|
|
16
|
+
balance: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
17
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
next_reset_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
20
|
+
overage_allowed: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
usage_limit: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
rollovers: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
balance: z.ZodNumber;
|
|
24
|
+
expires_at: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
breakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
27
|
+
interval: z.ZodEnum<typeof ProductItemInterval>;
|
|
28
|
+
balance: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
next_reset_at: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, z.core.$strip>>>;
|
|
33
|
+
credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
|
+
feature_id: z.ZodString;
|
|
35
|
+
credit_amount: z.ZodNumber;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
type CoreCustomerFeature = z.infer<typeof CoreCusFeatureSchema>;
|
|
39
|
+
interface CustomerFeature extends CoreCustomerFeature {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
type: "static" | "single_use" | "continuous_use";
|
|
43
|
+
}
|
|
44
|
+
interface CustomerProduct {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string | null;
|
|
47
|
+
group: string | null;
|
|
48
|
+
status: ProductStatus;
|
|
49
|
+
started_at: number;
|
|
50
|
+
canceled_at: number | null;
|
|
51
|
+
version: number;
|
|
52
|
+
subscription_ids?: string[] | null;
|
|
53
|
+
current_period_start?: number | null;
|
|
54
|
+
current_period_end?: number | null;
|
|
55
|
+
trial_ends_at?: number;
|
|
56
|
+
entity_id?: string;
|
|
57
|
+
is_add_on: boolean;
|
|
58
|
+
is_default: boolean;
|
|
59
|
+
items: ProductItem[];
|
|
60
|
+
}
|
|
61
|
+
interface Customer {
|
|
62
|
+
id: string | null;
|
|
63
|
+
created_at: number;
|
|
64
|
+
name: string | null;
|
|
65
|
+
email: string | null;
|
|
66
|
+
fingerprint: string | null;
|
|
67
|
+
stripe_id: string | null;
|
|
68
|
+
env: AppEnv;
|
|
69
|
+
metadata: Record<string, any>;
|
|
70
|
+
products: CustomerProduct[];
|
|
71
|
+
features: Record<string, CustomerFeature>;
|
|
72
|
+
invoices?: CustomerInvoice[];
|
|
73
|
+
payment_method?: any;
|
|
74
|
+
}
|
|
75
|
+
declare const CustomerDataSchema: z.ZodObject<{
|
|
76
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
type CustomerData = z.infer<typeof CustomerDataSchema>;
|
|
81
|
+
declare const CreateCustomerParamsSchema: z.ZodObject<{
|
|
82
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
85
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
87
|
+
expand: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
88
|
+
invoices: "invoices";
|
|
89
|
+
rewards: "rewards";
|
|
90
|
+
trials_used: "trials_used";
|
|
91
|
+
entities: "entities";
|
|
92
|
+
referrals: "referrals";
|
|
93
|
+
payment_method: "payment_method";
|
|
94
|
+
}>>>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
type CreateCustomerParams = z.infer<typeof CreateCustomerParamsSchema>;
|
|
97
|
+
interface BillingPortalResult {
|
|
98
|
+
customer_id: string;
|
|
99
|
+
url: string;
|
|
100
|
+
}
|
|
101
|
+
interface CustomerInvoice {
|
|
102
|
+
product_ids: string[];
|
|
103
|
+
stripe_id: string;
|
|
104
|
+
status: string;
|
|
105
|
+
total: number;
|
|
106
|
+
currency: string;
|
|
107
|
+
created_at: number;
|
|
108
|
+
hosted_invoice_url: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type { BillingPortalResult as B, CustomerData as C, Customer as a, CustomerProduct as b, CustomerFeature as c, CustomerInvoice as d, CreateCustomerParams as e, CustomerExpandOption as f };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { A as AttachParams, R as Result, C as CheckResult, T as TrackParams, a as AutumnPromise, b as TrackResult, c as CancelParams, d as CancelResult, O as OpenBillingPortalParams, S as SetupPaymentParams, e as SetupPaymentResult, f as CheckoutParams } from '../clientAttachTypes-
|
|
1
|
+
import { A as AttachParams, R as Result, C as CheckResult, T as TrackParams, a as AutumnPromise, b as TrackResult, c as CancelParams, d as CancelResult, O as OpenBillingPortalParams, S as SetupPaymentParams, e as SetupPaymentResult, f as CheckoutParams } from '../clientAttachTypes-traKz9UZ.mjs';
|
|
2
2
|
import { A as AutumnError } from '../error-DHbclCVh.mjs';
|
|
3
|
-
import { C as CheckoutResult } from '../attachTypes
|
|
4
|
-
import { B as BillingPortalResult } from '../cusTypes-
|
|
5
|
-
import '../prodTypes-
|
|
6
|
-
import 'zod';
|
|
3
|
+
import { C as CheckoutResult } from '../attachTypes-DRO-C_G5.mjs';
|
|
4
|
+
import { B as BillingPortalResult } from '../cusTypes-dkOgZJbj.mjs';
|
|
5
|
+
import '../prodTypes-DwM7QuGf.mjs';
|
|
6
|
+
import 'zod/v4';
|
|
7
7
|
|
|
8
8
|
declare const useAutumn: () => {
|
|
9
9
|
attach: (params: AttachParams) => Promise<Result<{
|
|
10
|
-
code: string;
|
|
11
|
-
message: string;
|
|
12
10
|
customer_id: string;
|
|
13
11
|
product_ids: string[];
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
checkout_url?: string | undefined;
|
|
14
15
|
customer_data?: any;
|
|
15
16
|
invoice?: {
|
|
16
17
|
status: string;
|
|
@@ -19,7 +20,6 @@ declare const useAutumn: () => {
|
|
|
19
20
|
total: number;
|
|
20
21
|
currency: string;
|
|
21
22
|
} | undefined;
|
|
22
|
-
checkout_url?: string | undefined;
|
|
23
23
|
} | CheckResult, AutumnError>>;
|
|
24
24
|
track: (params: TrackParams) => AutumnPromise<TrackResult>;
|
|
25
25
|
cancel: (params: CancelParams) => AutumnPromise<CancelResult>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { A as AttachParams, R as Result, C as CheckResult, T as TrackParams, a as AutumnPromise, b as TrackResult, c as CancelParams, d as CancelResult, O as OpenBillingPortalParams, S as SetupPaymentParams, e as SetupPaymentResult, f as CheckoutParams } from '../clientAttachTypes-
|
|
1
|
+
import { A as AttachParams, R as Result, C as CheckResult, T as TrackParams, a as AutumnPromise, b as TrackResult, c as CancelParams, d as CancelResult, O as OpenBillingPortalParams, S as SetupPaymentParams, e as SetupPaymentResult, f as CheckoutParams } from '../clientAttachTypes-DWFk8mOR.js';
|
|
2
2
|
import { A as AutumnError } from '../error-DHbclCVh.js';
|
|
3
|
-
import { C as CheckoutResult } from '../attachTypes-
|
|
4
|
-
import { B as BillingPortalResult } from '../cusTypes-
|
|
5
|
-
import '../prodTypes-
|
|
6
|
-
import 'zod';
|
|
3
|
+
import { C as CheckoutResult } from '../attachTypes-gOerywTE.js';
|
|
4
|
+
import { B as BillingPortalResult } from '../cusTypes-CNOLnLMs.js';
|
|
5
|
+
import '../prodTypes-DwM7QuGf.js';
|
|
6
|
+
import 'zod/v4';
|
|
7
7
|
|
|
8
8
|
declare const useAutumn: () => {
|
|
9
9
|
attach: (params: AttachParams) => Promise<Result<{
|
|
10
|
-
code: string;
|
|
11
|
-
message: string;
|
|
12
10
|
customer_id: string;
|
|
13
11
|
product_ids: string[];
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
checkout_url?: string | undefined;
|
|
14
15
|
customer_data?: any;
|
|
15
16
|
invoice?: {
|
|
16
17
|
status: string;
|
|
@@ -19,7 +20,6 @@ declare const useAutumn: () => {
|
|
|
19
20
|
total: number;
|
|
20
21
|
currency: string;
|
|
21
22
|
} | undefined;
|
|
22
|
-
checkout_url?: string | undefined;
|
|
23
23
|
} | CheckResult, AutumnError>>;
|
|
24
24
|
track: (params: TrackParams) => AutumnPromise<TrackResult>;
|
|
25
25
|
cancel: (params: CancelParams) => AutumnPromise<CancelResult>;
|
|
@@ -1,52 +1,81 @@
|
|
|
1
1
|
import { A as AutumnError } from '../error-DHbclCVh.mjs';
|
|
2
|
-
import { A as AttachParams, a as AutumnPromise, C as CheckResult, T as TrackParams, b as TrackResult, c as CancelParams, d as CancelResult, S as SetupPaymentParams, e as SetupPaymentResult, O as OpenBillingPortalParams, f as CheckoutParams, g as CheckParams, h as Success } from '../clientAttachTypes-
|
|
3
|
-
import { A as AttachResult, C as CheckoutResult } from '../attachTypes
|
|
4
|
-
import { f as CustomerExpandOption, a as Customer, B as BillingPortalResult } from '../cusTypes-
|
|
5
|
-
import { E as Entity } from '../entTypes-
|
|
2
|
+
import { A as AttachParams, a as AutumnPromise, C as CheckResult, T as TrackParams, b as TrackResult, c as CancelParams, d as CancelResult, S as SetupPaymentParams, e as SetupPaymentResult, O as OpenBillingPortalParams, f as CheckoutParams, g as CheckParams, h as Success } from '../clientAttachTypes-traKz9UZ.mjs';
|
|
3
|
+
import { A as AttachResult, C as CheckoutResult } from '../attachTypes-DRO-C_G5.mjs';
|
|
4
|
+
import { f as CustomerExpandOption, a as Customer, B as BillingPortalResult } from '../cusTypes-dkOgZJbj.mjs';
|
|
5
|
+
import { E as Entity } from '../entTypes-CXZqtZX3.mjs';
|
|
6
6
|
import { C as CreateEntityParams, a as CreateReferralCodeResult, R as RedeemReferralCodeResult } from '../clientEntTypes-BFkleT6a.mjs';
|
|
7
|
-
import { z } from 'zod';
|
|
7
|
+
import { z } from 'zod/v4';
|
|
8
8
|
import { SWRConfiguration } from 'swr';
|
|
9
|
-
import '../prodTypes-
|
|
9
|
+
import '../prodTypes-DwM7QuGf.mjs';
|
|
10
10
|
|
|
11
11
|
declare const CreateReferralCodeParamsSchema: z.ZodObject<{
|
|
12
12
|
programId: z.ZodString;
|
|
13
|
-
},
|
|
14
|
-
programId: string;
|
|
15
|
-
}, {
|
|
16
|
-
programId: string;
|
|
17
|
-
}>;
|
|
13
|
+
}, z.core.$strip>;
|
|
18
14
|
type CreateReferralCodeParams = z.infer<typeof CreateReferralCodeParamsSchema>;
|
|
19
15
|
declare const RedeemReferralCodeParamsSchema: z.ZodObject<{
|
|
20
16
|
code: z.ZodString;
|
|
21
|
-
},
|
|
22
|
-
code: string;
|
|
23
|
-
}, {
|
|
24
|
-
code: string;
|
|
25
|
-
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
26
18
|
type RedeemReferralCodeParams = z.infer<typeof RedeemReferralCodeParamsSchema>;
|
|
27
19
|
|
|
28
|
-
interface AllowedParams {
|
|
29
|
-
featureId?: string;
|
|
30
|
-
productId?: string;
|
|
31
|
-
requiredBalance?: number;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
20
|
interface UseCustomerResult {
|
|
21
|
+
/** The current customer data including subscription and feature information */
|
|
35
22
|
customer: Customer | null;
|
|
23
|
+
/** Whether customer data is currently being loaded */
|
|
36
24
|
isLoading: boolean;
|
|
25
|
+
/** Any error that occurred while fetching customer data */
|
|
37
26
|
error: AutumnError | null;
|
|
27
|
+
/**
|
|
28
|
+
* Attaches a product to the current customer, enabling access and handling billing.
|
|
29
|
+
* Activates a product and applies all product items with automatic payment handling.
|
|
30
|
+
*/
|
|
38
31
|
attach: (params: AttachParams) => AutumnPromise<AttachResult | CheckResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Tracks usage events for metered features.
|
|
34
|
+
* Records feature usage and updates customer balances server-side.
|
|
35
|
+
*/
|
|
39
36
|
track: (params: TrackParams) => AutumnPromise<TrackResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Cancels a customer's subscription or product attachment.
|
|
39
|
+
* Can cancel immediately or at the end of the billing cycle.
|
|
40
|
+
*/
|
|
40
41
|
cancel: (params: CancelParams) => AutumnPromise<CancelResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Sets up a payment method for the customer.
|
|
44
|
+
* Collects payment information without immediately charging.
|
|
45
|
+
*/
|
|
41
46
|
setupPayment: (params: SetupPaymentParams) => AutumnPromise<SetupPaymentResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Opens the Stripe billing portal for the customer.
|
|
49
|
+
* Allows customers to manage their subscription and payment methods.
|
|
50
|
+
*/
|
|
42
51
|
openBillingPortal: (params?: OpenBillingPortalParams) => AutumnPromise<BillingPortalResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Initiates a checkout flow for product purchase.
|
|
54
|
+
* Handles payment collection and redirects to Stripe checkout when needed.
|
|
55
|
+
*/
|
|
43
56
|
checkout: (params: CheckoutParams) => AutumnPromise<CheckoutResult>;
|
|
57
|
+
/** Refetches the customer data from the server */
|
|
44
58
|
refetch: () => Promise<Customer | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Creates new entities for granular feature tracking.
|
|
61
|
+
* Entities allow per-user or per-workspace feature limits.
|
|
62
|
+
*/
|
|
45
63
|
createEntity: (params: CreateEntityParams | CreateEntityParams[]) => AutumnPromise<Entity | Entity[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a referral code for the customer.
|
|
66
|
+
* Generates codes that can be shared for referral programs.
|
|
67
|
+
*/
|
|
46
68
|
createReferralCode: (params: CreateReferralCodeParams) => AutumnPromise<CreateReferralCodeResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Redeems a referral code for the customer.
|
|
71
|
+
* Applies referral benefits when a valid code is provided.
|
|
72
|
+
*/
|
|
47
73
|
redeemReferralCode: (params: RedeemReferralCodeParams) => AutumnPromise<RedeemReferralCodeResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Checks if a customer has access to a feature and shows paywalls if needed.
|
|
76
|
+
* Client-side feature gating with optional dialog display for upgrades.
|
|
77
|
+
*/
|
|
48
78
|
check: (params: CheckParams) => Success<CheckResult>;
|
|
49
|
-
allowed: (params: AllowedParams) => boolean;
|
|
50
79
|
}
|
|
51
80
|
interface UseCustomerParams {
|
|
52
81
|
errorOnNotFound?: boolean;
|
|
@@ -1,52 +1,81 @@
|
|
|
1
1
|
import { A as AutumnError } from '../error-DHbclCVh.js';
|
|
2
|
-
import { A as AttachParams, a as AutumnPromise, C as CheckResult, T as TrackParams, b as TrackResult, c as CancelParams, d as CancelResult, S as SetupPaymentParams, e as SetupPaymentResult, O as OpenBillingPortalParams, f as CheckoutParams, g as CheckParams, h as Success } from '../clientAttachTypes-
|
|
3
|
-
import { A as AttachResult, C as CheckoutResult } from '../attachTypes-
|
|
4
|
-
import { f as CustomerExpandOption, a as Customer, B as BillingPortalResult } from '../cusTypes-
|
|
5
|
-
import { E as Entity } from '../entTypes-
|
|
2
|
+
import { A as AttachParams, a as AutumnPromise, C as CheckResult, T as TrackParams, b as TrackResult, c as CancelParams, d as CancelResult, S as SetupPaymentParams, e as SetupPaymentResult, O as OpenBillingPortalParams, f as CheckoutParams, g as CheckParams, h as Success } from '../clientAttachTypes-DWFk8mOR.js';
|
|
3
|
+
import { A as AttachResult, C as CheckoutResult } from '../attachTypes-gOerywTE.js';
|
|
4
|
+
import { f as CustomerExpandOption, a as Customer, B as BillingPortalResult } from '../cusTypes-CNOLnLMs.js';
|
|
5
|
+
import { E as Entity } from '../entTypes-D0T20Mxt.js';
|
|
6
6
|
import { C as CreateEntityParams, a as CreateReferralCodeResult, R as RedeemReferralCodeResult } from '../clientEntTypes-BFkleT6a.js';
|
|
7
|
-
import { z } from 'zod';
|
|
7
|
+
import { z } from 'zod/v4';
|
|
8
8
|
import { SWRConfiguration } from 'swr';
|
|
9
|
-
import '../prodTypes-
|
|
9
|
+
import '../prodTypes-DwM7QuGf.js';
|
|
10
10
|
|
|
11
11
|
declare const CreateReferralCodeParamsSchema: z.ZodObject<{
|
|
12
12
|
programId: z.ZodString;
|
|
13
|
-
},
|
|
14
|
-
programId: string;
|
|
15
|
-
}, {
|
|
16
|
-
programId: string;
|
|
17
|
-
}>;
|
|
13
|
+
}, z.core.$strip>;
|
|
18
14
|
type CreateReferralCodeParams = z.infer<typeof CreateReferralCodeParamsSchema>;
|
|
19
15
|
declare const RedeemReferralCodeParamsSchema: z.ZodObject<{
|
|
20
16
|
code: z.ZodString;
|
|
21
|
-
},
|
|
22
|
-
code: string;
|
|
23
|
-
}, {
|
|
24
|
-
code: string;
|
|
25
|
-
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
26
18
|
type RedeemReferralCodeParams = z.infer<typeof RedeemReferralCodeParamsSchema>;
|
|
27
19
|
|
|
28
|
-
interface AllowedParams {
|
|
29
|
-
featureId?: string;
|
|
30
|
-
productId?: string;
|
|
31
|
-
requiredBalance?: number;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
20
|
interface UseCustomerResult {
|
|
21
|
+
/** The current customer data including subscription and feature information */
|
|
35
22
|
customer: Customer | null;
|
|
23
|
+
/** Whether customer data is currently being loaded */
|
|
36
24
|
isLoading: boolean;
|
|
25
|
+
/** Any error that occurred while fetching customer data */
|
|
37
26
|
error: AutumnError | null;
|
|
27
|
+
/**
|
|
28
|
+
* Attaches a product to the current customer, enabling access and handling billing.
|
|
29
|
+
* Activates a product and applies all product items with automatic payment handling.
|
|
30
|
+
*/
|
|
38
31
|
attach: (params: AttachParams) => AutumnPromise<AttachResult | CheckResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Tracks usage events for metered features.
|
|
34
|
+
* Records feature usage and updates customer balances server-side.
|
|
35
|
+
*/
|
|
39
36
|
track: (params: TrackParams) => AutumnPromise<TrackResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Cancels a customer's subscription or product attachment.
|
|
39
|
+
* Can cancel immediately or at the end of the billing cycle.
|
|
40
|
+
*/
|
|
40
41
|
cancel: (params: CancelParams) => AutumnPromise<CancelResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Sets up a payment method for the customer.
|
|
44
|
+
* Collects payment information without immediately charging.
|
|
45
|
+
*/
|
|
41
46
|
setupPayment: (params: SetupPaymentParams) => AutumnPromise<SetupPaymentResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Opens the Stripe billing portal for the customer.
|
|
49
|
+
* Allows customers to manage their subscription and payment methods.
|
|
50
|
+
*/
|
|
42
51
|
openBillingPortal: (params?: OpenBillingPortalParams) => AutumnPromise<BillingPortalResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Initiates a checkout flow for product purchase.
|
|
54
|
+
* Handles payment collection and redirects to Stripe checkout when needed.
|
|
55
|
+
*/
|
|
43
56
|
checkout: (params: CheckoutParams) => AutumnPromise<CheckoutResult>;
|
|
57
|
+
/** Refetches the customer data from the server */
|
|
44
58
|
refetch: () => Promise<Customer | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Creates new entities for granular feature tracking.
|
|
61
|
+
* Entities allow per-user or per-workspace feature limits.
|
|
62
|
+
*/
|
|
45
63
|
createEntity: (params: CreateEntityParams | CreateEntityParams[]) => AutumnPromise<Entity | Entity[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a referral code for the customer.
|
|
66
|
+
* Generates codes that can be shared for referral programs.
|
|
67
|
+
*/
|
|
46
68
|
createReferralCode: (params: CreateReferralCodeParams) => AutumnPromise<CreateReferralCodeResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Redeems a referral code for the customer.
|
|
71
|
+
* Applies referral benefits when a valid code is provided.
|
|
72
|
+
*/
|
|
47
73
|
redeemReferralCode: (params: RedeemReferralCodeParams) => AutumnPromise<RedeemReferralCodeResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Checks if a customer has access to a feature and shows paywalls if needed.
|
|
76
|
+
* Client-side feature gating with optional dialog display for upgrades.
|
|
77
|
+
*/
|
|
48
78
|
check: (params: CheckParams) => Success<CheckResult>;
|
|
49
|
-
allowed: (params: AllowedParams) => boolean;
|
|
50
79
|
}
|
|
51
80
|
interface UseCustomerParams {
|
|
52
81
|
errorOnNotFound?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as CheckParams, C as CheckResult, A as AttachParams, R as Result, c as CancelParams, a as AutumnPromise, T as TrackParams } from '../clientAttachTypes-
|
|
1
|
+
import { g as CheckParams, C as CheckResult, A as AttachParams, R as Result, c as CancelParams, a as AutumnPromise, T as TrackParams } from '../clientAttachTypes-traKz9UZ.mjs';
|
|
2
2
|
import { A as AutumnError } from '../error-DHbclCVh.mjs';
|
|
3
|
-
import { G as GetEntityParams, E as Entity } from '../entTypes-
|
|
3
|
+
import { G as GetEntityParams, E as Entity } from '../entTypes-CXZqtZX3.mjs';
|
|
4
4
|
import * as swr from 'swr';
|
|
5
|
-
import '../prodTypes-
|
|
6
|
-
import 'zod';
|
|
7
|
-
import '../cusTypes-
|
|
5
|
+
import '../prodTypes-DwM7QuGf.mjs';
|
|
6
|
+
import 'zod/v4';
|
|
7
|
+
import '../cusTypes-dkOgZJbj.mjs';
|
|
8
8
|
|
|
9
9
|
declare const useEntity: (entityId: string | null, params?: GetEntityParams) => {
|
|
10
10
|
entity: Entity | null;
|
|
@@ -16,10 +16,11 @@ declare const useEntity: (entityId: string | null, params?: GetEntityParams) =>
|
|
|
16
16
|
error: null;
|
|
17
17
|
};
|
|
18
18
|
attach: (params: AttachParams) => Promise<Result<{
|
|
19
|
-
code: string;
|
|
20
|
-
message: string;
|
|
21
19
|
customer_id: string;
|
|
22
20
|
product_ids: string[];
|
|
21
|
+
code: string;
|
|
22
|
+
message: string;
|
|
23
|
+
checkout_url?: string | undefined;
|
|
23
24
|
customer_data?: any;
|
|
24
25
|
invoice?: {
|
|
25
26
|
status: string;
|
|
@@ -28,16 +29,15 @@ declare const useEntity: (entityId: string | null, params?: GetEntityParams) =>
|
|
|
28
29
|
total: number;
|
|
29
30
|
currency: string;
|
|
30
31
|
} | undefined;
|
|
31
|
-
checkout_url?: string | undefined;
|
|
32
32
|
} | CheckResult, AutumnError>>;
|
|
33
33
|
cancel: (params: CancelParams) => AutumnPromise<{
|
|
34
|
-
customer_id: string;
|
|
35
34
|
success: boolean;
|
|
35
|
+
customer_id: string;
|
|
36
36
|
product_id: string;
|
|
37
37
|
}>;
|
|
38
38
|
track: (params: TrackParams) => AutumnPromise<{
|
|
39
|
-
code: string;
|
|
40
39
|
id: string;
|
|
40
|
+
code: string;
|
|
41
41
|
customer_id: string;
|
|
42
42
|
feature_id?: string | undefined;
|
|
43
43
|
event_name?: string | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as CheckParams, C as CheckResult, A as AttachParams, R as Result, c as CancelParams, a as AutumnPromise, T as TrackParams } from '../clientAttachTypes-
|
|
1
|
+
import { g as CheckParams, C as CheckResult, A as AttachParams, R as Result, c as CancelParams, a as AutumnPromise, T as TrackParams } from '../clientAttachTypes-DWFk8mOR.js';
|
|
2
2
|
import { A as AutumnError } from '../error-DHbclCVh.js';
|
|
3
|
-
import { G as GetEntityParams, E as Entity } from '../entTypes-
|
|
3
|
+
import { G as GetEntityParams, E as Entity } from '../entTypes-D0T20Mxt.js';
|
|
4
4
|
import * as swr from 'swr';
|
|
5
|
-
import '../prodTypes-
|
|
6
|
-
import 'zod';
|
|
7
|
-
import '../cusTypes-
|
|
5
|
+
import '../prodTypes-DwM7QuGf.js';
|
|
6
|
+
import 'zod/v4';
|
|
7
|
+
import '../cusTypes-CNOLnLMs.js';
|
|
8
8
|
|
|
9
9
|
declare const useEntity: (entityId: string | null, params?: GetEntityParams) => {
|
|
10
10
|
entity: Entity | null;
|
|
@@ -16,10 +16,11 @@ declare const useEntity: (entityId: string | null, params?: GetEntityParams) =>
|
|
|
16
16
|
error: null;
|
|
17
17
|
};
|
|
18
18
|
attach: (params: AttachParams) => Promise<Result<{
|
|
19
|
-
code: string;
|
|
20
|
-
message: string;
|
|
21
19
|
customer_id: string;
|
|
22
20
|
product_ids: string[];
|
|
21
|
+
code: string;
|
|
22
|
+
message: string;
|
|
23
|
+
checkout_url?: string | undefined;
|
|
23
24
|
customer_data?: any;
|
|
24
25
|
invoice?: {
|
|
25
26
|
status: string;
|
|
@@ -28,16 +29,15 @@ declare const useEntity: (entityId: string | null, params?: GetEntityParams) =>
|
|
|
28
29
|
total: number;
|
|
29
30
|
currency: string;
|
|
30
31
|
} | undefined;
|
|
31
|
-
checkout_url?: string | undefined;
|
|
32
32
|
} | CheckResult, AutumnError>>;
|
|
33
33
|
cancel: (params: CancelParams) => AutumnPromise<{
|
|
34
|
-
customer_id: string;
|
|
35
34
|
success: boolean;
|
|
35
|
+
customer_id: string;
|
|
36
36
|
product_id: string;
|
|
37
37
|
}>;
|
|
38
38
|
track: (params: TrackParams) => AutumnPromise<{
|
|
39
|
-
code: string;
|
|
40
39
|
id: string;
|
|
40
|
+
code: string;
|
|
41
41
|
customer_id: string;
|
|
42
42
|
feature_id?: string | undefined;
|
|
43
43
|
event_name?: string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
2
|
import { A as AutumnError } from '../error-DHbclCVh.mjs';
|
|
3
|
-
import { a as Product } from '../prodTypes-
|
|
4
|
-
import 'zod';
|
|
3
|
+
import { a as Product } from '../prodTypes-DwM7QuGf.mjs';
|
|
4
|
+
import 'zod/v4';
|
|
5
5
|
|
|
6
6
|
interface ProductDetails {
|
|
7
7
|
id?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
2
|
import { A as AutumnError } from '../error-DHbclCVh.js';
|
|
3
|
-
import { a as Product } from '../prodTypes-
|
|
4
|
-
import 'zod';
|
|
3
|
+
import { a as Product } from '../prodTypes-DwM7QuGf.js';
|
|
4
|
+
import 'zod/v4';
|
|
5
5
|
|
|
6
6
|
interface ProductDetails {
|
|
7
7
|
id?: string;
|