autumn-js 0.0.103 → 0.0.104
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 +28 -4
- package/dist/libraries/backend/better-auth.d.ts +28 -4
- package/dist/libraries/backend/better-auth.js +76 -83
- package/dist/libraries/backend/better-auth.mjs +7 -7
- package/dist/libraries/backend/{chunk-YFWJ6E4U.mjs → chunk-2RZ2FZX2.mjs} +10 -10
- package/dist/libraries/backend/{chunk-33NT3WE5.mjs → chunk-3OLXYDCU.mjs} +1 -1
- package/dist/libraries/backend/{chunk-AKV5N4WO.mjs → chunk-5EKNB4IJ.mjs} +1 -1
- package/dist/libraries/backend/{chunk-CEZHD5H6.mjs → chunk-5H6HVCOP.mjs} +1 -1
- package/dist/libraries/backend/{chunk-J3L3OBSS.mjs → chunk-HHMIVOXX.mjs} +18 -1
- package/dist/libraries/backend/{chunk-6VS7TU7O.mjs → chunk-IOSEAUDJ.mjs} +57 -81
- package/dist/libraries/backend/{chunk-RA4AC56B.mjs → chunk-K7JGEYUX.mjs} +1 -1
- package/dist/libraries/backend/convex.js +73 -80
- package/dist/libraries/backend/convex.mjs +7 -7
- package/dist/libraries/backend/elysia.js +73 -80
- package/dist/libraries/backend/elysia.mjs +7 -7
- package/dist/libraries/backend/express.d.mts +1 -1
- package/dist/libraries/backend/express.d.ts +1 -1
- package/dist/libraries/backend/express.js +73 -80
- package/dist/libraries/backend/express.mjs +7 -7
- package/dist/libraries/backend/fastify.js +73 -80
- package/dist/libraries/backend/fastify.mjs +7 -7
- package/dist/libraries/backend/hono.js +73 -80
- package/dist/libraries/backend/hono.mjs +7 -7
- package/dist/libraries/backend/next.js +169 -176
- package/dist/libraries/backend/next.mjs +101 -101
- package/dist/libraries/backend/react-router.js +73 -80
- package/dist/libraries/backend/react-router.mjs +7 -7
- package/dist/libraries/backend/{referralTypes-DV8s1h8w.d.ts → referralTypes-CnYanpMd.d.ts} +199 -102
- package/dist/libraries/backend/{referralTypes-DcDxMGTp.d.mts → referralTypes-jA7MQ1y5.d.mts} +199 -102
- package/dist/libraries/backend/remix_dep.js +73 -80
- package/dist/libraries/backend/remix_dep.mjs +7 -7
- package/dist/libraries/backend/routes/backendRouter.js +73 -80
- package/dist/libraries/backend/routes/backendRouter.mjs +7 -7
- package/dist/libraries/backend/routes/entityRoutes.js +56 -80
- package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/genRoutes.js +73 -80
- package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/productRoutes.js +56 -80
- package/dist/libraries/backend/routes/productRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/referralRoutes.js +56 -80
- package/dist/libraries/backend/routes/referralRoutes.mjs +3 -3
- package/dist/libraries/backend/supabase.js +73 -80
- package/dist/libraries/backend/supabase.mjs +7 -7
- package/dist/libraries/backend/tanstack.js +73 -80
- package/dist/libraries/backend/tanstack.mjs +7 -7
- package/dist/libraries/backend/utils/backendRes.js +56 -80
- package/dist/libraries/backend/utils/backendRes.mjs +1 -1
- package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
- package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
- package/dist/libraries/backend/utils/withAuth.js +56 -80
- package/dist/libraries/backend/utils/withAuth.mjs +2 -2
- package/dist/libraries/react/AutumnContext.d.mts +5 -4
- package/dist/libraries/react/AutumnContext.d.ts +5 -4
- package/dist/libraries/react/AutumnContext.js +63 -82
- package/dist/libraries/react/AutumnContext.mjs +6 -6
- package/dist/libraries/react/BaseAutumnProvider.d.mts +5 -4
- package/dist/libraries/react/BaseAutumnProvider.d.ts +5 -4
- package/dist/libraries/react/BaseAutumnProvider.js +96 -111
- package/dist/libraries/react/BaseAutumnProvider.mjs +10 -10
- package/dist/libraries/react/{ReactAutumnClient-C8Nt-pqu.d.mts → ReactAutumnClient-BGI56QI_.d.mts} +21 -10
- package/dist/libraries/react/{ReactAutumnClient-BlxQQOXE.d.ts → ReactAutumnClient-CEv9YGLM.d.ts} +21 -10
- package/dist/libraries/react/ReactAutumnProvider.d.mts +1 -1
- package/dist/libraries/react/ReactAutumnProvider.d.ts +1 -1
- package/dist/libraries/react/ReactAutumnProvider.js +96 -111
- package/dist/libraries/react/ReactAutumnProvider.mjs +11 -11
- package/dist/libraries/react/attachTypes-Cexub7bN.d.ts +58 -0
- package/dist/libraries/react/attachTypes-DqI7qtXD.d.mts +58 -0
- package/dist/libraries/react/{chunk-VUBJ6JM3.mjs → chunk-253MTZP3.mjs} +7 -2
- package/dist/libraries/react/{chunk-RQN4VDAE.mjs → chunk-3N6WLQH3.mjs} +3 -3
- package/dist/libraries/react/{chunk-DHJ36QEV.mjs → chunk-473LVTGN.mjs} +2 -2
- package/dist/libraries/react/{chunk-LXSKONN2.mjs → chunk-4A53GN44.mjs} +5 -5
- package/dist/libraries/react/{chunk-EHOBTSZ7.mjs → chunk-4BQDSIWM.mjs} +5 -8
- package/dist/libraries/react/{chunk-S6JUZ43Q.mjs → chunk-4VXBAIPC.mjs} +2 -2
- package/dist/libraries/react/{chunk-OAWFFAKA.mjs → chunk-6EZVNJHQ.mjs} +6 -6
- package/dist/libraries/react/{chunk-DBGTWERW.mjs → chunk-ASL5VH2W.mjs} +4 -3
- package/dist/libraries/react/{chunk-QBBE72EF.mjs → chunk-CBPZVSMZ.mjs} +12 -7
- package/dist/libraries/react/chunk-CUWUAQML.mjs +179 -0
- package/dist/libraries/react/chunk-DJIRJJNG.mjs +34 -0
- package/dist/libraries/react/{chunk-CYW4LNFZ.mjs → chunk-E5EYSQYJ.mjs} +68 -90
- package/dist/libraries/react/{chunk-GQIE3MFB.mjs → chunk-EBQBPZCM.mjs} +3 -3
- package/dist/libraries/react/{chunk-AL3VJLFU.mjs → chunk-EV5RNY5U.mjs} +1 -1
- package/dist/libraries/react/chunk-G6NOGGDA.mjs +695 -0
- package/dist/libraries/react/{chunk-OAPUYXBO.mjs → chunk-KWNH6C27.mjs} +6 -6
- package/dist/libraries/react/{chunk-X4R3V6O6.mjs → chunk-MNOH7Q3B.mjs} +2 -2
- package/dist/libraries/react/{chunk-3SGSKYJ7.mjs → chunk-P5MIFIIO.mjs} +2 -2
- package/dist/libraries/react/{chunk-PZJQBCVG.mjs → chunk-PIENO233.mjs} +1 -1
- package/dist/libraries/react/chunk-QUO2CYKM.mjs +30 -0
- package/dist/libraries/react/{chunk-BCMBFJ7E.mjs → chunk-RCTILKK3.mjs} +70 -37
- package/dist/libraries/react/{chunk-ZVQKDPUP.mjs → chunk-RPEGNKJH.mjs} +3 -3
- package/dist/libraries/react/{chunk-SDMBKRAI.mjs → chunk-WAFSQH6N.mjs} +37 -37
- package/dist/libraries/react/{chunk-CGWNDUYV.mjs → chunk-ZFIJI37N.mjs} +1 -1
- package/dist/libraries/react/{chunk-KYSWTOMQ.mjs → chunk-ZITEHPEQ.mjs} +30 -24
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +5 -5
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +5 -5
- package/dist/libraries/react/client/ReactAutumnClient.js +63 -82
- package/dist/libraries/react/client/ReactAutumnClient.mjs +5 -5
- package/dist/libraries/react/client/clientCompMethods.d.mts +5 -5
- package/dist/libraries/react/client/clientCompMethods.d.ts +5 -5
- package/dist/libraries/react/client/clientCusMethods.d.mts +5 -5
- package/dist/libraries/react/client/clientCusMethods.d.ts +5 -5
- package/dist/libraries/react/client/clientEntityMethods.d.mts +5 -5
- package/dist/libraries/react/client/clientEntityMethods.d.ts +5 -5
- package/dist/libraries/react/client/clientGenMethods.d.mts +9 -7
- package/dist/libraries/react/client/clientGenMethods.d.ts +9 -7
- package/dist/libraries/react/client/clientGenMethods.js +8 -2
- package/dist/libraries/react/client/clientGenMethods.mjs +3 -1
- package/dist/libraries/react/client/clientProdMethods.d.mts +5 -5
- package/dist/libraries/react/client/clientProdMethods.d.ts +5 -5
- package/dist/libraries/react/client/clientReferralMethods.d.mts +5 -5
- package/dist/libraries/react/client/clientReferralMethods.d.ts +5 -5
- package/dist/libraries/react/client/types/clientAttachTypes.d.mts +115 -0
- package/dist/libraries/react/client/types/clientAttachTypes.d.ts +115 -0
- package/dist/libraries/react/client/types/clientAttachTypes.js +68 -0
- package/dist/libraries/react/client/types/clientAttachTypes.mjs +42 -0
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +10 -81
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +10 -81
- package/dist/libraries/react/client/types/clientGenTypes.js +1 -24
- package/dist/libraries/react/client/types/clientGenTypes.mjs +1 -22
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.css +213 -4
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.mts +5 -32
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.ts +5 -32
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.js +720 -371
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.mjs +30 -33
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.mts +3 -2
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.ts +3 -2
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.js +70 -37
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.mjs +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.mts +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.ts +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.js +43 -43
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.mjs +5 -5
- package/dist/libraries/react/components/check-dialog/lib/check-content.d.mts +1 -1
- package/dist/libraries/react/components/check-dialog/lib/check-content.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +3 -1
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +3 -1
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.js +12 -7
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.mjs +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.css +213 -4
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +794 -456
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +29 -26
- package/dist/libraries/react/components/ui/accordion.d.mts +9 -0
- package/dist/libraries/react/components/ui/accordion.d.ts +9 -0
- package/dist/libraries/react/components/ui/accordion.js +2721 -0
- package/dist/libraries/react/components/ui/accordion.mjs +15 -0
- 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/button.js +3 -3
- package/dist/libraries/react/components/ui/button.mjs +2 -2
- package/dist/libraries/react/components/ui/dialog.js +43 -43
- package/dist/libraries/react/components/ui/dialog.mjs +3 -3
- package/dist/libraries/react/components/ui/input.d.mts +5 -0
- package/dist/libraries/react/components/ui/input.d.ts +5 -0
- package/dist/libraries/react/components/ui/input.js +2587 -0
- package/dist/libraries/react/components/ui/input.mjs +9 -0
- package/dist/libraries/react/components/ui/popover.d.mts +9 -0
- package/dist/libraries/react/components/ui/popover.d.ts +9 -0
- package/dist/libraries/react/components/ui/popover.js +2594 -0
- package/dist/libraries/react/components/ui/popover.mjs +15 -0
- package/dist/libraries/react/components/ui/switch.js +12 -12
- package/dist/libraries/react/components/ui/switch.mjs +3 -3
- package/dist/libraries/react/{cusTypes-CHcG59KG.d.mts → cusTypes-DCeNEQLu.d.mts} +28 -10
- package/dist/libraries/react/{cusTypes-CHcG59KG.d.ts → cusTypes-DCeNEQLu.d.ts} +28 -10
- package/dist/libraries/react/{entTypes-8-4TWxee.d.ts → entTypes-BJD_Hxbp.d.ts} +1 -1
- package/dist/libraries/react/{entTypes-3t7AbNhm.d.mts → entTypes-CJhJFCKD.d.mts} +1 -1
- package/dist/libraries/react/hooks/handleAllowed.d.mts +2 -2
- package/dist/libraries/react/hooks/handleAllowed.d.ts +2 -2
- package/dist/libraries/react/hooks/useAutumn.d.mts +21 -6
- package/dist/libraries/react/hooks/useAutumn.d.ts +21 -6
- package/dist/libraries/react/hooks/useAutumn.js +94 -110
- package/dist/libraries/react/hooks/useAutumn.mjs +9 -9
- package/dist/libraries/react/hooks/useAutumnBase.d.mts +24 -9
- package/dist/libraries/react/hooks/useAutumnBase.d.ts +24 -9
- package/dist/libraries/react/hooks/useAutumnBase.js +94 -110
- package/dist/libraries/react/hooks/useAutumnBase.mjs +8 -8
- package/dist/libraries/react/hooks/useCustomer.d.mts +7 -5
- package/dist/libraries/react/hooks/useCustomer.d.ts +7 -5
- package/dist/libraries/react/hooks/useCustomer.js +96 -111
- package/dist/libraries/react/hooks/useCustomer.mjs +10 -10
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +8 -5
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +8 -5
- package/dist/libraries/react/hooks/useCustomerBase.js +96 -111
- package/dist/libraries/react/hooks/useCustomerBase.mjs +9 -9
- package/dist/libraries/react/hooks/useEntity.d.mts +14 -7
- package/dist/libraries/react/hooks/useEntity.d.ts +14 -7
- package/dist/libraries/react/hooks/useEntity.js +94 -110
- package/dist/libraries/react/hooks/useEntity.mjs +10 -10
- package/dist/libraries/react/hooks/useEntityBase.d.mts +16 -7
- package/dist/libraries/react/hooks/useEntityBase.d.ts +16 -7
- package/dist/libraries/react/hooks/useEntityBase.js +94 -110
- package/dist/libraries/react/hooks/useEntityBase.mjs +9 -9
- package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.js +66 -88
- package/dist/libraries/react/hooks/usePricingTable.mjs +8 -8
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +6 -6
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +6 -6
- package/dist/libraries/react/hooks/usePricingTableBase.js +66 -88
- package/dist/libraries/react/hooks/usePricingTableBase.mjs +7 -7
- package/dist/libraries/react/hooks/useProductsBase.js +63 -82
- package/dist/libraries/react/hooks/useProductsBase.mjs +6 -6
- package/dist/libraries/react/index.d.mts +217 -106
- package/dist/libraries/react/index.d.ts +217 -106
- package/dist/libraries/react/index.js +801 -463
- package/dist/libraries/react/index.mjs +792 -454
- package/dist/libraries/react/{response-DnJCkvfc.d.ts → response-Dek2TEnE.d.ts} +2 -25
- package/dist/libraries/react/{response-B8MYd86O.d.mts → response-HZAWTgGp.d.mts} +2 -25
- package/dist/next/{AutumnProvider-Xl1mqxls.d.mts → AutumnProvider-CHFySjFm.d.mts} +30 -12
- package/dist/next/{AutumnProvider-Xl1mqxls.d.ts → AutumnProvider-CHFySjFm.d.ts} +30 -12
- package/dist/next/AutumnProvider.d.mts +1 -1
- package/dist/next/AutumnProvider.d.ts +1 -1
- package/dist/next/client/NextAutumnClient.d.mts +18 -7
- package/dist/next/client/NextAutumnClient.d.ts +18 -7
- package/dist/next/client/NextAutumnClient.js +13 -2
- package/dist/next/client/NextAutumnClient.mjs +13 -2
- package/dist/next/client/NextAutumnProvider.d.mts +1 -1
- package/dist/next/client/NextAutumnProvider.d.ts +1 -1
- package/dist/next/client/attachTypes-BL6x9Zbx.d.ts +58 -0
- package/dist/next/client/attachTypes-BPYeJ6E4.d.mts +58 -0
- package/dist/next/client/{clientGenTypes-Dx1TULjb.d.ts → clientAttachTypes-Dj6U8D7o.d.ts} +108 -90
- package/dist/next/client/{clientGenTypes-tE8HbEdV.d.mts → clientAttachTypes-fN66J754.d.mts} +108 -90
- package/dist/next/client/clientUtils.d.mts +2 -2
- package/dist/next/client/clientUtils.d.ts +2 -2
- package/dist/next/client/{cusTypes-nWQygxXu.d.mts → cusTypes-BoVZ2omf.d.mts} +32 -14
- package/dist/next/client/{cusTypes-nWQygxXu.d.ts → cusTypes-BoVZ2omf.d.ts} +32 -14
- package/dist/next/client/{entTypes-DDZyYuom.d.ts → entTypes-BrHkjvC9.d.ts} +1 -1
- package/dist/next/client/{entTypes-DusU3WqD.d.mts → entTypes-Li6ZrG0C.d.mts} +1 -1
- package/dist/next/client/hooks/useAutumn.d.mts +19 -5
- package/dist/next/client/hooks/useAutumn.d.ts +19 -5
- package/dist/next/client/hooks/useCustomer.d.mts +5 -4
- package/dist/next/client/hooks/useCustomer.d.ts +5 -4
- package/dist/next/client/hooks/useEntity.d.mts +14 -8
- package/dist/next/client/hooks/useEntity.d.ts +14 -8
- package/dist/next/client/hooks/usePricingTable.d.mts +1 -1
- package/dist/next/client/hooks/usePricingTable.d.ts +1 -1
- package/dist/next/client/types.d.mts +2 -2
- package/dist/next/client/types.d.ts +2 -2
- package/dist/next/index.d.mts +213 -107
- package/dist/next/index.d.ts +213 -107
- package/dist/next/server/auth/withNextAuth.d.mts +1 -1
- package/dist/next/server/auth/withNextAuth.d.ts +1 -1
- package/dist/next/server/componentActions.d.mts +1 -1
- package/dist/next/server/componentActions.d.ts +1 -1
- package/dist/next/server/cusActions.d.mts +173 -94
- package/dist/next/server/cusActions.d.ts +173 -94
- package/dist/next/server/{cusTypes-Tc189V9T.d.mts → cusTypes-Bh_pVAJp.d.mts} +32 -14
- package/dist/next/server/{cusTypes-Tc189V9T.d.ts → cusTypes-Bh_pVAJp.d.ts} +32 -14
- package/dist/next/server/genActions.d.mts +3 -4
- package/dist/next/server/genActions.d.ts +3 -4
- package/dist/sdk/index.d.mts +221 -135
- package/dist/sdk/index.d.ts +221 -135
- package/dist/sdk/index.js +55 -80
- package/dist/sdk/index.mjs +54 -81
- package/dist/styles/global.css +213 -4
- package/dist/utils/encryptUtils.js +56 -80
- package/dist/utils/encryptUtils.mjs +56 -80
- package/package.json +7 -4
- package/dist/libraries/react/chunk-ZEVKOP7Z.mjs +0 -548
package/dist/libraries/backend/{referralTypes-DcDxMGTp.d.mts → referralTypes-jA7MQ1y5.d.mts}
RENAMED
|
@@ -89,10 +89,17 @@ declare enum AppEnv {
|
|
|
89
89
|
Live = "live"
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
interface Feature {
|
|
93
|
+
id: string;
|
|
94
|
+
name: string;
|
|
95
|
+
type: "boolean" | "continuous_use" | "single_use" | "credit_system";
|
|
96
|
+
}
|
|
92
97
|
interface ProductItem {
|
|
98
|
+
type?: "feature" | "priced_feature" | "price";
|
|
93
99
|
feature_id?: string;
|
|
94
100
|
included_usage?: number | typeof Infinite;
|
|
95
101
|
interval?: ProductItemIntervalType;
|
|
102
|
+
feature?: Feature;
|
|
96
103
|
usage_model?: UsageModel;
|
|
97
104
|
price?: number;
|
|
98
105
|
billing_units?: number;
|
|
@@ -124,10 +131,12 @@ interface Product {
|
|
|
124
131
|
free_trial: FreeTrial | null;
|
|
125
132
|
scenario?: ProductScenario;
|
|
126
133
|
base_variant_id: string | null;
|
|
127
|
-
properties
|
|
128
|
-
is_free
|
|
129
|
-
is_one_off
|
|
130
|
-
interval_group
|
|
134
|
+
properties: {
|
|
135
|
+
is_free: boolean;
|
|
136
|
+
is_one_off: boolean;
|
|
137
|
+
interval_group: string;
|
|
138
|
+
has_trial: boolean;
|
|
139
|
+
has_prepaid: boolean;
|
|
131
140
|
};
|
|
132
141
|
display?: {
|
|
133
142
|
name?: string;
|
|
@@ -215,11 +224,20 @@ interface Customer {
|
|
|
215
224
|
features: Record<string, CustomerFeature>;
|
|
216
225
|
invoices?: CustomerInvoice[];
|
|
217
226
|
}
|
|
218
|
-
|
|
219
|
-
name
|
|
220
|
-
email
|
|
221
|
-
fingerprint
|
|
222
|
-
}
|
|
227
|
+
declare const CustomerDataSchema: z.ZodObject<{
|
|
228
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
229
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
230
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
231
|
+
}, "strip", z.ZodTypeAny, {
|
|
232
|
+
name?: string | null | undefined;
|
|
233
|
+
email?: string | null | undefined;
|
|
234
|
+
fingerprint?: string | null | undefined;
|
|
235
|
+
}, {
|
|
236
|
+
name?: string | null | undefined;
|
|
237
|
+
email?: string | null | undefined;
|
|
238
|
+
fingerprint?: string | null | undefined;
|
|
239
|
+
}>;
|
|
240
|
+
type CustomerData = z.infer<typeof CustomerDataSchema>;
|
|
223
241
|
interface GetCustomerParams {
|
|
224
242
|
expand?: CustomerExpandOption[];
|
|
225
243
|
}
|
|
@@ -234,16 +252,16 @@ declare const CreateCustomerParamsSchema: z.ZodObject<{
|
|
|
234
252
|
metadata?: Record<string, any> | undefined;
|
|
235
253
|
expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
|
|
236
254
|
name?: string | null | undefined;
|
|
237
|
-
id?: string | null | undefined;
|
|
238
255
|
email?: string | null | undefined;
|
|
239
256
|
fingerprint?: string | null | undefined;
|
|
257
|
+
id?: string | null | undefined;
|
|
240
258
|
}, {
|
|
241
259
|
metadata?: Record<string, any> | undefined;
|
|
242
260
|
expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
|
|
243
261
|
name?: string | null | undefined;
|
|
244
|
-
id?: string | null | undefined;
|
|
245
262
|
email?: string | null | undefined;
|
|
246
263
|
fingerprint?: string | null | undefined;
|
|
264
|
+
id?: string | null | undefined;
|
|
247
265
|
}>;
|
|
248
266
|
type CreateCustomerParams = z.infer<typeof CreateCustomerParamsSchema>;
|
|
249
267
|
interface UpdateCustomerParams {
|
|
@@ -274,65 +292,6 @@ interface CustomerInvoice {
|
|
|
274
292
|
hosted_invoice_url: string;
|
|
275
293
|
}
|
|
276
294
|
|
|
277
|
-
declare const AttachParamsSchema: z.ZodObject<{
|
|
278
|
-
customer_id: z.ZodString;
|
|
279
|
-
product_id: z.ZodOptional<z.ZodString>;
|
|
280
|
-
entity_id: z.ZodOptional<z.ZodString>;
|
|
281
|
-
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
282
|
-
feature_id: z.ZodString;
|
|
283
|
-
quantity: z.ZodNumber;
|
|
284
|
-
}, "strip", z.ZodTypeAny, {
|
|
285
|
-
feature_id: string;
|
|
286
|
-
quantity: number;
|
|
287
|
-
}, {
|
|
288
|
-
feature_id: string;
|
|
289
|
-
quantity: number;
|
|
290
|
-
}>, "many">>;
|
|
291
|
-
product_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
292
|
-
free_trial: z.ZodOptional<z.ZodBoolean>;
|
|
293
|
-
success_url: z.ZodOptional<z.ZodString>;
|
|
294
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
295
|
-
force_checkout: z.ZodOptional<z.ZodBoolean>;
|
|
296
|
-
customer_data: z.ZodOptional<z.ZodAny>;
|
|
297
|
-
entity_data: z.ZodOptional<z.ZodAny>;
|
|
298
|
-
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
299
|
-
reward: z.ZodOptional<z.ZodString>;
|
|
300
|
-
}, "strip", z.ZodTypeAny, {
|
|
301
|
-
customer_id: string;
|
|
302
|
-
options?: {
|
|
303
|
-
feature_id: string;
|
|
304
|
-
quantity: number;
|
|
305
|
-
}[] | undefined;
|
|
306
|
-
metadata?: Record<string, string> | undefined;
|
|
307
|
-
product_id?: string | undefined;
|
|
308
|
-
entity_id?: string | undefined;
|
|
309
|
-
product_ids?: string[] | undefined;
|
|
310
|
-
free_trial?: boolean | undefined;
|
|
311
|
-
success_url?: string | undefined;
|
|
312
|
-
force_checkout?: boolean | undefined;
|
|
313
|
-
customer_data?: any;
|
|
314
|
-
entity_data?: any;
|
|
315
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
316
|
-
reward?: string | undefined;
|
|
317
|
-
}, {
|
|
318
|
-
customer_id: string;
|
|
319
|
-
options?: {
|
|
320
|
-
feature_id: string;
|
|
321
|
-
quantity: number;
|
|
322
|
-
}[] | undefined;
|
|
323
|
-
metadata?: Record<string, string> | undefined;
|
|
324
|
-
product_id?: string | undefined;
|
|
325
|
-
entity_id?: string | undefined;
|
|
326
|
-
product_ids?: string[] | undefined;
|
|
327
|
-
free_trial?: boolean | undefined;
|
|
328
|
-
success_url?: string | undefined;
|
|
329
|
-
force_checkout?: boolean | undefined;
|
|
330
|
-
customer_data?: any;
|
|
331
|
-
entity_data?: any;
|
|
332
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
333
|
-
reward?: string | undefined;
|
|
334
|
-
}>;
|
|
335
|
-
type AttachParams = z.infer<typeof AttachParamsSchema>;
|
|
336
295
|
declare const CancelParamsSchema: z.ZodObject<{
|
|
337
296
|
customer_id: z.ZodString;
|
|
338
297
|
product_id: z.ZodString;
|
|
@@ -448,6 +407,174 @@ interface SetupPaymentResult {
|
|
|
448
407
|
url: string;
|
|
449
408
|
}
|
|
450
409
|
|
|
410
|
+
declare const AttachFeatureOptionsSchema: z.ZodObject<{
|
|
411
|
+
feature_id: z.ZodString;
|
|
412
|
+
quantity: z.ZodNumber;
|
|
413
|
+
}, "strip", z.ZodTypeAny, {
|
|
414
|
+
feature_id: string;
|
|
415
|
+
quantity: number;
|
|
416
|
+
}, {
|
|
417
|
+
feature_id: string;
|
|
418
|
+
quantity: number;
|
|
419
|
+
}>;
|
|
420
|
+
type AttachFeatureOptions = z.infer<typeof AttachFeatureOptionsSchema>;
|
|
421
|
+
declare const AttachParamsSchema: z.ZodObject<{
|
|
422
|
+
customer_id: z.ZodString;
|
|
423
|
+
product_id: z.ZodOptional<z.ZodString>;
|
|
424
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
425
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
426
|
+
feature_id: z.ZodString;
|
|
427
|
+
quantity: z.ZodNumber;
|
|
428
|
+
}, "strip", z.ZodTypeAny, {
|
|
429
|
+
feature_id: string;
|
|
430
|
+
quantity: number;
|
|
431
|
+
}, {
|
|
432
|
+
feature_id: string;
|
|
433
|
+
quantity: number;
|
|
434
|
+
}>, "many">>;
|
|
435
|
+
product_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
436
|
+
free_trial: z.ZodOptional<z.ZodBoolean>;
|
|
437
|
+
success_url: z.ZodOptional<z.ZodString>;
|
|
438
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
439
|
+
force_checkout: z.ZodOptional<z.ZodBoolean>;
|
|
440
|
+
customer_data: z.ZodOptional<z.ZodObject<{
|
|
441
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
442
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
443
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
444
|
+
}, "strip", z.ZodTypeAny, {
|
|
445
|
+
name?: string | null | undefined;
|
|
446
|
+
email?: string | null | undefined;
|
|
447
|
+
fingerprint?: string | null | undefined;
|
|
448
|
+
}, {
|
|
449
|
+
name?: string | null | undefined;
|
|
450
|
+
email?: string | null | undefined;
|
|
451
|
+
fingerprint?: string | null | undefined;
|
|
452
|
+
}>>;
|
|
453
|
+
entity_data: z.ZodOptional<z.ZodAny>;
|
|
454
|
+
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
455
|
+
reward: z.ZodOptional<z.ZodString>;
|
|
456
|
+
}, "strip", z.ZodTypeAny, {
|
|
457
|
+
customer_id: string;
|
|
458
|
+
options?: {
|
|
459
|
+
feature_id: string;
|
|
460
|
+
quantity: number;
|
|
461
|
+
}[] | undefined;
|
|
462
|
+
metadata?: Record<string, string> | undefined;
|
|
463
|
+
product_id?: string | undefined;
|
|
464
|
+
entity_id?: string | undefined;
|
|
465
|
+
product_ids?: string[] | undefined;
|
|
466
|
+
free_trial?: boolean | undefined;
|
|
467
|
+
success_url?: string | undefined;
|
|
468
|
+
force_checkout?: boolean | undefined;
|
|
469
|
+
customer_data?: {
|
|
470
|
+
name?: string | null | undefined;
|
|
471
|
+
email?: string | null | undefined;
|
|
472
|
+
fingerprint?: string | null | undefined;
|
|
473
|
+
} | undefined;
|
|
474
|
+
entity_data?: any;
|
|
475
|
+
checkout_session_params?: Record<string, any> | undefined;
|
|
476
|
+
reward?: string | undefined;
|
|
477
|
+
}, {
|
|
478
|
+
customer_id: string;
|
|
479
|
+
options?: {
|
|
480
|
+
feature_id: string;
|
|
481
|
+
quantity: number;
|
|
482
|
+
}[] | undefined;
|
|
483
|
+
metadata?: Record<string, string> | undefined;
|
|
484
|
+
product_id?: string | undefined;
|
|
485
|
+
entity_id?: string | undefined;
|
|
486
|
+
product_ids?: string[] | undefined;
|
|
487
|
+
free_trial?: boolean | undefined;
|
|
488
|
+
success_url?: string | undefined;
|
|
489
|
+
force_checkout?: boolean | undefined;
|
|
490
|
+
customer_data?: {
|
|
491
|
+
name?: string | null | undefined;
|
|
492
|
+
email?: string | null | undefined;
|
|
493
|
+
fingerprint?: string | null | undefined;
|
|
494
|
+
} | undefined;
|
|
495
|
+
entity_data?: any;
|
|
496
|
+
checkout_session_params?: Record<string, any> | undefined;
|
|
497
|
+
reward?: string | undefined;
|
|
498
|
+
}>;
|
|
499
|
+
type AttachParams = z.infer<typeof AttachParamsSchema>;
|
|
500
|
+
declare const CheckoutParamsSchema: z.ZodObject<{
|
|
501
|
+
customer_id: z.ZodString;
|
|
502
|
+
product_id: z.ZodString;
|
|
503
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
504
|
+
success_url: z.ZodOptional<z.ZodString>;
|
|
505
|
+
customer_data: z.ZodOptional<z.ZodObject<{
|
|
506
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
507
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
508
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
509
|
+
}, "strip", z.ZodTypeAny, {
|
|
510
|
+
name?: string | null | undefined;
|
|
511
|
+
email?: string | null | undefined;
|
|
512
|
+
fingerprint?: string | null | undefined;
|
|
513
|
+
}, {
|
|
514
|
+
name?: string | null | undefined;
|
|
515
|
+
email?: string | null | undefined;
|
|
516
|
+
fingerprint?: string | null | undefined;
|
|
517
|
+
}>>;
|
|
518
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
519
|
+
feature_id: z.ZodString;
|
|
520
|
+
quantity: z.ZodNumber;
|
|
521
|
+
}, "strip", z.ZodTypeAny, {
|
|
522
|
+
feature_id: string;
|
|
523
|
+
quantity: number;
|
|
524
|
+
}, {
|
|
525
|
+
feature_id: string;
|
|
526
|
+
quantity: number;
|
|
527
|
+
}>, "many">>;
|
|
528
|
+
}, "strip", z.ZodTypeAny, {
|
|
529
|
+
customer_id: string;
|
|
530
|
+
product_id: string;
|
|
531
|
+
options?: {
|
|
532
|
+
feature_id: string;
|
|
533
|
+
quantity: number;
|
|
534
|
+
}[] | undefined;
|
|
535
|
+
entity_id?: string | undefined;
|
|
536
|
+
success_url?: string | undefined;
|
|
537
|
+
customer_data?: {
|
|
538
|
+
name?: string | null | undefined;
|
|
539
|
+
email?: string | null | undefined;
|
|
540
|
+
fingerprint?: string | null | undefined;
|
|
541
|
+
} | undefined;
|
|
542
|
+
}, {
|
|
543
|
+
customer_id: string;
|
|
544
|
+
product_id: string;
|
|
545
|
+
options?: {
|
|
546
|
+
feature_id: string;
|
|
547
|
+
quantity: number;
|
|
548
|
+
}[] | undefined;
|
|
549
|
+
entity_id?: string | undefined;
|
|
550
|
+
success_url?: string | undefined;
|
|
551
|
+
customer_data?: {
|
|
552
|
+
name?: string | null | undefined;
|
|
553
|
+
email?: string | null | undefined;
|
|
554
|
+
fingerprint?: string | null | undefined;
|
|
555
|
+
} | undefined;
|
|
556
|
+
}>;
|
|
557
|
+
type CheckoutParams = z.infer<typeof CheckoutParamsSchema>;
|
|
558
|
+
type CheckoutResult = {
|
|
559
|
+
url?: string;
|
|
560
|
+
customer_id: string;
|
|
561
|
+
has_prorations: boolean;
|
|
562
|
+
lines: {
|
|
563
|
+
description: string;
|
|
564
|
+
amount: number;
|
|
565
|
+
item: ProductItem;
|
|
566
|
+
}[];
|
|
567
|
+
total: number;
|
|
568
|
+
currency: string;
|
|
569
|
+
options: AttachFeatureOptions[];
|
|
570
|
+
product: Product;
|
|
571
|
+
current_product: Product;
|
|
572
|
+
next_cycle?: {
|
|
573
|
+
starts_at: number;
|
|
574
|
+
total: number;
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
|
|
451
578
|
declare class Autumn {
|
|
452
579
|
private readonly secretKey;
|
|
453
580
|
private readonly publishableKey;
|
|
@@ -511,6 +638,8 @@ declare class Autumn {
|
|
|
511
638
|
createCode: (params: CreateReferralCodeParams) => Promise<Result<any, AutumnError>>;
|
|
512
639
|
redeemCode: (params: RedeemReferralCodeParams) => Promise<Result<any, AutumnError>>;
|
|
513
640
|
};
|
|
641
|
+
static checkout: (params: CheckoutParams) => Promise<Result<CheckoutResult, AutumnError>>;
|
|
642
|
+
checkout(params: CheckoutParams): Promise<Result<CheckoutResult, AutumnError>>;
|
|
514
643
|
static attach: (params: AttachParams) => Promise<Result<{
|
|
515
644
|
message: string;
|
|
516
645
|
code: string;
|
|
@@ -540,40 +669,8 @@ declare class Autumn {
|
|
|
540
669
|
product_id: string;
|
|
541
670
|
success: boolean;
|
|
542
671
|
}, AutumnError>>;
|
|
543
|
-
/**
|
|
544
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
545
|
-
* Please use the new check() method instead.
|
|
546
|
-
*/
|
|
547
|
-
static entitled: (params: CheckParams) => Promise<Result<CheckResult, AutumnError>>;
|
|
548
|
-
/**
|
|
549
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
550
|
-
* Please use the new check() method instead.
|
|
551
|
-
*/
|
|
552
|
-
entitled(params: CheckParams): Promise<Result<CheckResult, AutumnError>>;
|
|
553
672
|
static check: (params: CheckParams) => Promise<Result<CheckResult, AutumnError>>;
|
|
554
673
|
check(params: CheckParams): Promise<Result<CheckResult, AutumnError>>;
|
|
555
|
-
/**
|
|
556
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
557
|
-
* Please use the new track() method instead.
|
|
558
|
-
*/
|
|
559
|
-
static event: (params: TrackParams) => Promise<Result<{
|
|
560
|
-
code: string;
|
|
561
|
-
customer_id: string;
|
|
562
|
-
id: string;
|
|
563
|
-
feature_id?: string | undefined;
|
|
564
|
-
event_name?: string | undefined;
|
|
565
|
-
}, AutumnError>>;
|
|
566
|
-
/**
|
|
567
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
568
|
-
* Please use the new track() method instead.
|
|
569
|
-
*/
|
|
570
|
-
event(params: TrackParams): Promise<Result<{
|
|
571
|
-
code: string;
|
|
572
|
-
customer_id: string;
|
|
573
|
-
id: string;
|
|
574
|
-
feature_id?: string | undefined;
|
|
575
|
-
event_name?: string | undefined;
|
|
576
|
-
}, AutumnError>>;
|
|
577
674
|
static track: (params: TrackParams) => Promise<Result<{
|
|
578
675
|
code: string;
|
|
579
676
|
customer_id: string;
|
|
@@ -61,6 +61,12 @@ var AutumnError = class _AutumnError extends Error {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
// src/sdk/general/genMethods.ts
|
|
64
|
+
var handleCheckout = async ({
|
|
65
|
+
instance,
|
|
66
|
+
params
|
|
67
|
+
}) => {
|
|
68
|
+
return instance.post("/checkout", params);
|
|
69
|
+
};
|
|
64
70
|
var handleAttach = async ({
|
|
65
71
|
instance,
|
|
66
72
|
params
|
|
@@ -79,18 +85,6 @@ var handleCancel = async ({
|
|
|
79
85
|
}) => {
|
|
80
86
|
return instance.post("/cancel", params);
|
|
81
87
|
};
|
|
82
|
-
var handleEntitled = async ({
|
|
83
|
-
instance,
|
|
84
|
-
params
|
|
85
|
-
}) => {
|
|
86
|
-
return instance.post("/entitled", params);
|
|
87
|
-
};
|
|
88
|
-
var handleEvent = async ({
|
|
89
|
-
instance,
|
|
90
|
-
params
|
|
91
|
-
}) => {
|
|
92
|
-
return instance.post("/events", params);
|
|
93
|
-
};
|
|
94
88
|
var handleTrack = async ({
|
|
95
89
|
instance,
|
|
96
90
|
params
|
|
@@ -438,6 +432,13 @@ var Autumn = class {
|
|
|
438
432
|
products = productMethods(this);
|
|
439
433
|
entities = entityMethods(this);
|
|
440
434
|
referrals = referralMethods(this);
|
|
435
|
+
static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
|
|
436
|
+
async checkout(params) {
|
|
437
|
+
return handleCheckout({
|
|
438
|
+
instance: this,
|
|
439
|
+
params
|
|
440
|
+
});
|
|
441
|
+
}
|
|
441
442
|
static attach = (params) => staticWrapper(handleAttach, void 0, { params });
|
|
442
443
|
static usage = (params) => staticWrapper(handleUsage, void 0, { params });
|
|
443
444
|
async attach(params) {
|
|
@@ -460,21 +461,6 @@ var Autumn = class {
|
|
|
460
461
|
params
|
|
461
462
|
});
|
|
462
463
|
}
|
|
463
|
-
/**
|
|
464
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
465
|
-
* Please use the new check() method instead.
|
|
466
|
-
*/
|
|
467
|
-
static entitled = (params) => staticWrapper(handleEntitled, void 0, { params });
|
|
468
|
-
/**
|
|
469
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
470
|
-
* Please use the new check() method instead.
|
|
471
|
-
*/
|
|
472
|
-
async entitled(params) {
|
|
473
|
-
return handleEntitled({
|
|
474
|
-
instance: this,
|
|
475
|
-
params
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
464
|
static check = (params) => staticWrapper(handleCheck, void 0, { params });
|
|
479
465
|
async check(params) {
|
|
480
466
|
return handleCheck({
|
|
@@ -482,21 +468,6 @@ var Autumn = class {
|
|
|
482
468
|
params
|
|
483
469
|
});
|
|
484
470
|
}
|
|
485
|
-
/**
|
|
486
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
487
|
-
* Please use the new track() method instead.
|
|
488
|
-
*/
|
|
489
|
-
static event = (params) => staticWrapper(handleEvent, void 0, { params });
|
|
490
|
-
/**
|
|
491
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
492
|
-
* Please use the new track() method instead.
|
|
493
|
-
*/
|
|
494
|
-
async event(params) {
|
|
495
|
-
return handleEvent({
|
|
496
|
-
instance: this,
|
|
497
|
-
params
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
471
|
static track = (params) => staticWrapper(handleTrack, void 0, { params });
|
|
501
472
|
async track(params) {
|
|
502
473
|
return handleTrack({
|
|
@@ -521,44 +492,6 @@ var EntityDataSchema = import_zod.z.object({
|
|
|
521
492
|
|
|
522
493
|
// src/sdk/general/genTypes.ts
|
|
523
494
|
var import_zod2 = require("zod");
|
|
524
|
-
var AttachFeatureOptionsSchema = import_zod2.z.object({
|
|
525
|
-
feature_id: import_zod2.z.string(),
|
|
526
|
-
quantity: import_zod2.z.number()
|
|
527
|
-
});
|
|
528
|
-
var AttachParamsSchema = import_zod2.z.object({
|
|
529
|
-
customer_id: import_zod2.z.string(),
|
|
530
|
-
product_id: import_zod2.z.string().optional(),
|
|
531
|
-
entity_id: import_zod2.z.string().optional(),
|
|
532
|
-
options: import_zod2.z.array(
|
|
533
|
-
import_zod2.z.object({
|
|
534
|
-
feature_id: import_zod2.z.string(),
|
|
535
|
-
quantity: import_zod2.z.number()
|
|
536
|
-
})
|
|
537
|
-
).optional(),
|
|
538
|
-
product_ids: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
539
|
-
// If set, will attach multiple products to the customer (cannot be used with product_id)
|
|
540
|
-
free_trial: import_zod2.z.boolean().optional(),
|
|
541
|
-
// Default is true -- if set to false, will bypass product free trial
|
|
542
|
-
success_url: import_zod2.z.string().optional(),
|
|
543
|
-
// Passed to Stripe
|
|
544
|
-
metadata: import_zod2.z.record(import_zod2.z.string()).optional(),
|
|
545
|
-
// Passed to Stripe
|
|
546
|
-
force_checkout: import_zod2.z.boolean().optional(),
|
|
547
|
-
// Default is false -- if set to true, will force the customer to checkout (not allowed for upgrades / downgrades)
|
|
548
|
-
customer_data: import_zod2.z.any().optional(),
|
|
549
|
-
entity_data: import_zod2.z.any().optional(),
|
|
550
|
-
checkout_session_params: import_zod2.z.record(import_zod2.z.any()).optional(),
|
|
551
|
-
// Passed to Stripe
|
|
552
|
-
reward: import_zod2.z.string().optional()
|
|
553
|
-
});
|
|
554
|
-
var AttachResultSchema = import_zod2.z.object({
|
|
555
|
-
checkout_url: import_zod2.z.string().optional(),
|
|
556
|
-
customer_id: import_zod2.z.string(),
|
|
557
|
-
product_ids: import_zod2.z.array(import_zod2.z.string()),
|
|
558
|
-
code: import_zod2.z.string(),
|
|
559
|
-
message: import_zod2.z.string(),
|
|
560
|
-
customer_data: import_zod2.z.any().optional()
|
|
561
|
-
});
|
|
562
495
|
var CancelParamsSchema = import_zod2.z.object({
|
|
563
496
|
customer_id: import_zod2.z.string(),
|
|
564
497
|
product_id: import_zod2.z.string(),
|
|
@@ -612,6 +545,11 @@ var CustomerExpandEnum = import_zod3.z.enum([
|
|
|
612
545
|
|
|
613
546
|
// src/sdk/customers/cusTypes.ts
|
|
614
547
|
var import_zod4 = require("zod");
|
|
548
|
+
var CustomerDataSchema = import_zod4.z.object({
|
|
549
|
+
name: import_zod4.z.string().nullish(),
|
|
550
|
+
email: import_zod4.z.string().nullish(),
|
|
551
|
+
fingerprint: import_zod4.z.string().nullish()
|
|
552
|
+
});
|
|
615
553
|
var CreateCustomerParamsSchema = import_zod4.z.object({
|
|
616
554
|
id: import_zod4.z.string().nullish(),
|
|
617
555
|
email: import_zod4.z.string().nullish(),
|
|
@@ -659,6 +597,44 @@ var RedeemReferralCodeParamsSchema = import_zod5.z.object({
|
|
|
659
597
|
customer_id: import_zod5.z.string()
|
|
660
598
|
});
|
|
661
599
|
|
|
600
|
+
// src/sdk/general/attachTypes.ts
|
|
601
|
+
var import_zod6 = require("zod");
|
|
602
|
+
var AttachFeatureOptionsSchema = import_zod6.z.object({
|
|
603
|
+
feature_id: import_zod6.z.string(),
|
|
604
|
+
quantity: import_zod6.z.number()
|
|
605
|
+
});
|
|
606
|
+
var AttachParamsSchema = import_zod6.z.object({
|
|
607
|
+
customer_id: import_zod6.z.string(),
|
|
608
|
+
product_id: import_zod6.z.string().optional(),
|
|
609
|
+
entity_id: import_zod6.z.string().optional(),
|
|
610
|
+
options: import_zod6.z.array(AttachFeatureOptionsSchema).optional(),
|
|
611
|
+
product_ids: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
612
|
+
free_trial: import_zod6.z.boolean().optional(),
|
|
613
|
+
success_url: import_zod6.z.string().optional(),
|
|
614
|
+
metadata: import_zod6.z.record(import_zod6.z.string()).optional(),
|
|
615
|
+
force_checkout: import_zod6.z.boolean().optional(),
|
|
616
|
+
customer_data: CustomerDataSchema.optional(),
|
|
617
|
+
entity_data: import_zod6.z.any().optional(),
|
|
618
|
+
checkout_session_params: import_zod6.z.record(import_zod6.z.any()).optional(),
|
|
619
|
+
reward: import_zod6.z.string().optional()
|
|
620
|
+
});
|
|
621
|
+
var AttachResultSchema = import_zod6.z.object({
|
|
622
|
+
checkout_url: import_zod6.z.string().optional(),
|
|
623
|
+
customer_id: import_zod6.z.string(),
|
|
624
|
+
product_ids: import_zod6.z.array(import_zod6.z.string()),
|
|
625
|
+
code: import_zod6.z.string(),
|
|
626
|
+
message: import_zod6.z.string(),
|
|
627
|
+
customer_data: import_zod6.z.any().optional()
|
|
628
|
+
});
|
|
629
|
+
var CheckoutParamsSchema = import_zod6.z.object({
|
|
630
|
+
customer_id: import_zod6.z.string(),
|
|
631
|
+
product_id: import_zod6.z.string(),
|
|
632
|
+
entity_id: import_zod6.z.string().optional(),
|
|
633
|
+
success_url: import_zod6.z.string().optional(),
|
|
634
|
+
customer_data: CustomerDataSchema.optional(),
|
|
635
|
+
options: import_zod6.z.array(AttachFeatureOptionsSchema).optional()
|
|
636
|
+
});
|
|
637
|
+
|
|
662
638
|
// src/libraries/backend/utils/backendRes.ts
|
|
663
639
|
var toBackendRes = ({ res }) => {
|
|
664
640
|
let statusCode = res.statusCode ? res.statusCode : res.error ? 500 : 200;
|
|
@@ -745,6 +721,20 @@ var sanitizeBody = (body) => {
|
|
|
745
721
|
delete bodyCopy.customer_data;
|
|
746
722
|
return bodyCopy;
|
|
747
723
|
};
|
|
724
|
+
var checkoutHandler = withAuth({
|
|
725
|
+
fn: async ({
|
|
726
|
+
autumn,
|
|
727
|
+
customer_id,
|
|
728
|
+
customer_data,
|
|
729
|
+
body
|
|
730
|
+
}) => {
|
|
731
|
+
return await autumn.checkout({
|
|
732
|
+
...sanitizeBody(body),
|
|
733
|
+
customer_id,
|
|
734
|
+
customer_data
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
});
|
|
748
738
|
var attachHandler = withAuth({
|
|
749
739
|
fn: async ({
|
|
750
740
|
autumn,
|
|
@@ -824,6 +814,9 @@ var openBillingPortalHandler = withAuth({
|
|
|
824
814
|
}
|
|
825
815
|
});
|
|
826
816
|
var addGenRoutes = (router) => {
|
|
817
|
+
(0, import_rou3.addRoute)(router, "POST", `${BASE_PATH}/checkout`, {
|
|
818
|
+
handler: checkoutHandler
|
|
819
|
+
});
|
|
827
820
|
(0, import_rou3.addRoute)(router, "POST", `${BASE_PATH}/attach`, {
|
|
828
821
|
handler: attachHandler
|
|
829
822
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRouterWithOptions
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-2RZ2FZX2.mjs";
|
|
4
|
+
import "./chunk-5EKNB4IJ.mjs";
|
|
5
|
+
import "./chunk-3OLXYDCU.mjs";
|
|
6
|
+
import "./chunk-K7JGEYUX.mjs";
|
|
7
|
+
import "./chunk-HHMIVOXX.mjs";
|
|
8
|
+
import "./chunk-5H6HVCOP.mjs";
|
|
9
9
|
import {
|
|
10
10
|
Autumn
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IOSEAUDJ.mjs";
|
|
12
12
|
import "./chunk-45WVZY23.mjs";
|
|
13
13
|
import {
|
|
14
14
|
autumnApiUrl
|