autumn-js 0.0.102 → 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-NW6B7QXB.mjs → chunk-2RZ2FZX2.mjs} +6 -6
- 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 +284 -268
- package/dist/libraries/backend/next.mjs +216 -193
- package/dist/libraries/backend/react-router.js +73 -80
- package/dist/libraries/backend/react-router.mjs +7 -7
- package/dist/libraries/backend/{referralTypes-D1Q2i3mG.d.ts → referralTypes-CnYanpMd.d.ts} +205 -104
- package/dist/libraries/backend/{referralTypes-Dfg6if8j.d.mts → referralTypes-jA7MQ1y5.d.mts} +205 -104
- 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 +5 -5
- 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 +9 -9
- package/dist/libraries/react/{ReactAutumnClient-YzfxjqPK.d.mts → ReactAutumnClient-BGI56QI_.d.mts} +21 -10
- package/dist/libraries/react/{ReactAutumnClient-DBbq29Nn.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 +10 -10
- 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-5NDO7C7R.mjs → chunk-3N6WLQH3.mjs} +1 -1
- package/dist/libraries/react/{chunk-H2NGSCWI.mjs → chunk-473LVTGN.mjs} +2 -2
- package/dist/libraries/react/{chunk-LXSKONN2.mjs → chunk-4A53GN44.mjs} +5 -5
- package/dist/libraries/react/{chunk-TPKQIL3N.mjs → chunk-4BQDSIWM.mjs} +5 -8
- package/dist/libraries/react/{chunk-X6RY6VG5.mjs → chunk-4VXBAIPC.mjs} +2 -2
- package/dist/libraries/react/{chunk-OAWFFAKA.mjs → chunk-6EZVNJHQ.mjs} +6 -6
- package/dist/libraries/react/{chunk-3VHO7VUQ.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-ALIGIMSK.mjs → chunk-E5EYSQYJ.mjs} +65 -87
- package/dist/libraries/react/{chunk-5URK7LI3.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-JI7WQ6AC.mjs → chunk-MNOH7Q3B.mjs} +2 -2
- package/dist/libraries/react/{chunk-SY5GNYZ7.mjs → chunk-P5MIFIIO.mjs} +2 -2
- package/dist/libraries/react/{chunk-T73WQC2X.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-GQ3TAHSV.mjs → chunk-ZFIJI37N.mjs} +1 -1
- package/dist/libraries/react/{chunk-CE33P32V.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 +4 -4
- 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 +28 -31
- 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 +27 -24
- 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-CFofdxsA.d.ts → cusTypes-DCeNEQLu.d.mts} +30 -12
- package/dist/libraries/react/{cusTypes-CFofdxsA.d.mts → cusTypes-DCeNEQLu.d.ts} +30 -12
- package/dist/libraries/react/{entTypes-BhUZh8uE.d.ts → entTypes-BJD_Hxbp.d.ts} +1 -1
- package/dist/libraries/react/{entTypes-BeWtfIqo.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 +8 -8
- 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 +7 -7
- 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 +9 -9
- 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 +8 -8
- 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 +9 -9
- 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 +8 -8
- 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 +7 -7
- 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 +6 -6
- package/dist/libraries/react/hooks/useProductsBase.js +63 -82
- package/dist/libraries/react/hooks/useProductsBase.mjs +5 -5
- 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-CxMWdpyl.d.ts → response-Dek2TEnE.d.ts} +2 -25
- package/dist/libraries/react/{response-AGK9KlYm.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 +25 -14
- package/dist/next/client/NextAutumnClient.d.ts +25 -14
- 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-D8f8BwMo.d.ts → clientAttachTypes-Dj6U8D7o.d.ts} +114 -96
- package/dist/next/client/{clientGenTypes-BcRfHmUS.d.mts → clientAttachTypes-fN66J754.d.mts} +114 -96
- package/dist/next/client/clientUtils.d.mts +2 -2
- package/dist/next/client/clientUtils.d.ts +2 -2
- package/dist/next/client/{cusTypes-Gh2wfcmj.d.mts → cusTypes-BoVZ2omf.d.mts} +30 -12
- package/dist/next/client/{cusTypes-Gh2wfcmj.d.ts → cusTypes-BoVZ2omf.d.ts} +30 -12
- package/dist/next/client/{entTypes-B_w6I3y-.d.ts → entTypes-BrHkjvC9.d.ts} +1 -1
- package/dist/next/client/{entTypes-C_xS1VPE.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 +12 -6
- package/dist/next/client/hooks/useEntity.d.ts +12 -6
- 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 +185 -106
- package/dist/next/server/cusActions.d.ts +185 -106
- package/dist/next/server/{cusTypes-DVA6iu7V.d.mts → cusTypes-Bh_pVAJp.d.mts} +34 -12
- package/dist/next/server/{cusTypes-DVA6iu7V.d.ts → cusTypes-Bh_pVAJp.d.ts} +34 -12
- package/dist/next/server/genActions.d.mts +3 -4
- package/dist/next/server/genActions.d.ts +3 -4
- package/dist/sdk/index.d.mts +223 -137
- package/dist/sdk/index.d.ts +223 -137
- 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 +10 -15
- package/dist/libraries/react/chunk-LKV32IPT.mjs +0 -548
|
@@ -62,6 +62,12 @@ var AutumnError = class _AutumnError extends Error {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
// src/sdk/general/genMethods.ts
|
|
65
|
+
var handleCheckout = async ({
|
|
66
|
+
instance,
|
|
67
|
+
params
|
|
68
|
+
}) => {
|
|
69
|
+
return instance.post("/checkout", params);
|
|
70
|
+
};
|
|
65
71
|
var handleAttach = async ({
|
|
66
72
|
instance,
|
|
67
73
|
params
|
|
@@ -80,18 +86,6 @@ var handleCancel = async ({
|
|
|
80
86
|
}) => {
|
|
81
87
|
return instance.post("/cancel", params);
|
|
82
88
|
};
|
|
83
|
-
var handleEntitled = async ({
|
|
84
|
-
instance,
|
|
85
|
-
params
|
|
86
|
-
}) => {
|
|
87
|
-
return instance.post("/entitled", params);
|
|
88
|
-
};
|
|
89
|
-
var handleEvent = async ({
|
|
90
|
-
instance,
|
|
91
|
-
params
|
|
92
|
-
}) => {
|
|
93
|
-
return instance.post("/events", params);
|
|
94
|
-
};
|
|
95
89
|
var handleTrack = async ({
|
|
96
90
|
instance,
|
|
97
91
|
params
|
|
@@ -439,6 +433,13 @@ var Autumn = class {
|
|
|
439
433
|
products = productMethods(this);
|
|
440
434
|
entities = entityMethods(this);
|
|
441
435
|
referrals = referralMethods(this);
|
|
436
|
+
static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
|
|
437
|
+
async checkout(params) {
|
|
438
|
+
return handleCheckout({
|
|
439
|
+
instance: this,
|
|
440
|
+
params
|
|
441
|
+
});
|
|
442
|
+
}
|
|
442
443
|
static attach = (params) => staticWrapper(handleAttach, void 0, { params });
|
|
443
444
|
static usage = (params) => staticWrapper(handleUsage, void 0, { params });
|
|
444
445
|
async attach(params) {
|
|
@@ -461,21 +462,6 @@ var Autumn = class {
|
|
|
461
462
|
params
|
|
462
463
|
});
|
|
463
464
|
}
|
|
464
|
-
/**
|
|
465
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
466
|
-
* Please use the new check() method instead.
|
|
467
|
-
*/
|
|
468
|
-
static entitled = (params) => staticWrapper(handleEntitled, void 0, { params });
|
|
469
|
-
/**
|
|
470
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
471
|
-
* Please use the new check() method instead.
|
|
472
|
-
*/
|
|
473
|
-
async entitled(params) {
|
|
474
|
-
return handleEntitled({
|
|
475
|
-
instance: this,
|
|
476
|
-
params
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
465
|
static check = (params) => staticWrapper(handleCheck, void 0, { params });
|
|
480
466
|
async check(params) {
|
|
481
467
|
return handleCheck({
|
|
@@ -483,21 +469,6 @@ var Autumn = class {
|
|
|
483
469
|
params
|
|
484
470
|
});
|
|
485
471
|
}
|
|
486
|
-
/**
|
|
487
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
488
|
-
* Please use the new track() method instead.
|
|
489
|
-
*/
|
|
490
|
-
static event = (params) => staticWrapper(handleEvent, void 0, { params });
|
|
491
|
-
/**
|
|
492
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
493
|
-
* Please use the new track() method instead.
|
|
494
|
-
*/
|
|
495
|
-
async event(params) {
|
|
496
|
-
return handleEvent({
|
|
497
|
-
instance: this,
|
|
498
|
-
params
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
472
|
static track = (params) => staticWrapper(handleTrack, void 0, { params });
|
|
502
473
|
async track(params) {
|
|
503
474
|
return handleTrack({
|
|
@@ -522,44 +493,6 @@ var EntityDataSchema = import_zod.z.object({
|
|
|
522
493
|
|
|
523
494
|
// src/sdk/general/genTypes.ts
|
|
524
495
|
var import_zod2 = require("zod");
|
|
525
|
-
var AttachFeatureOptionsSchema = import_zod2.z.object({
|
|
526
|
-
feature_id: import_zod2.z.string(),
|
|
527
|
-
quantity: import_zod2.z.number()
|
|
528
|
-
});
|
|
529
|
-
var AttachParamsSchema = import_zod2.z.object({
|
|
530
|
-
customer_id: import_zod2.z.string(),
|
|
531
|
-
product_id: import_zod2.z.string().optional(),
|
|
532
|
-
entity_id: import_zod2.z.string().optional(),
|
|
533
|
-
options: import_zod2.z.array(
|
|
534
|
-
import_zod2.z.object({
|
|
535
|
-
feature_id: import_zod2.z.string(),
|
|
536
|
-
quantity: import_zod2.z.number()
|
|
537
|
-
})
|
|
538
|
-
).optional(),
|
|
539
|
-
product_ids: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
540
|
-
// If set, will attach multiple products to the customer (cannot be used with product_id)
|
|
541
|
-
free_trial: import_zod2.z.boolean().optional(),
|
|
542
|
-
// Default is true -- if set to false, will bypass product free trial
|
|
543
|
-
success_url: import_zod2.z.string().optional(),
|
|
544
|
-
// Passed to Stripe
|
|
545
|
-
metadata: import_zod2.z.record(import_zod2.z.string()).optional(),
|
|
546
|
-
// Passed to Stripe
|
|
547
|
-
force_checkout: import_zod2.z.boolean().optional(),
|
|
548
|
-
// Default is false -- if set to true, will force the customer to checkout (not allowed for upgrades / downgrades)
|
|
549
|
-
customer_data: import_zod2.z.any().optional(),
|
|
550
|
-
entity_data: import_zod2.z.any().optional(),
|
|
551
|
-
checkout_session_params: import_zod2.z.record(import_zod2.z.any()).optional(),
|
|
552
|
-
// Passed to Stripe
|
|
553
|
-
reward: import_zod2.z.string().optional()
|
|
554
|
-
});
|
|
555
|
-
var AttachResultSchema = import_zod2.z.object({
|
|
556
|
-
checkout_url: import_zod2.z.string().optional(),
|
|
557
|
-
customer_id: import_zod2.z.string(),
|
|
558
|
-
product_ids: import_zod2.z.array(import_zod2.z.string()),
|
|
559
|
-
code: import_zod2.z.string(),
|
|
560
|
-
message: import_zod2.z.string(),
|
|
561
|
-
customer_data: import_zod2.z.any().optional()
|
|
562
|
-
});
|
|
563
496
|
var CancelParamsSchema = import_zod2.z.object({
|
|
564
497
|
customer_id: import_zod2.z.string(),
|
|
565
498
|
product_id: import_zod2.z.string(),
|
|
@@ -613,6 +546,11 @@ var CustomerExpandEnum = import_zod3.z.enum([
|
|
|
613
546
|
|
|
614
547
|
// src/sdk/customers/cusTypes.ts
|
|
615
548
|
var import_zod4 = require("zod");
|
|
549
|
+
var CustomerDataSchema = import_zod4.z.object({
|
|
550
|
+
name: import_zod4.z.string().nullish(),
|
|
551
|
+
email: import_zod4.z.string().nullish(),
|
|
552
|
+
fingerprint: import_zod4.z.string().nullish()
|
|
553
|
+
});
|
|
616
554
|
var CreateCustomerParamsSchema = import_zod4.z.object({
|
|
617
555
|
id: import_zod4.z.string().nullish(),
|
|
618
556
|
email: import_zod4.z.string().nullish(),
|
|
@@ -660,6 +598,44 @@ var RedeemReferralCodeParamsSchema = import_zod5.z.object({
|
|
|
660
598
|
customer_id: import_zod5.z.string()
|
|
661
599
|
});
|
|
662
600
|
|
|
601
|
+
// src/sdk/general/attachTypes.ts
|
|
602
|
+
var import_zod6 = require("zod");
|
|
603
|
+
var AttachFeatureOptionsSchema = import_zod6.z.object({
|
|
604
|
+
feature_id: import_zod6.z.string(),
|
|
605
|
+
quantity: import_zod6.z.number()
|
|
606
|
+
});
|
|
607
|
+
var AttachParamsSchema = import_zod6.z.object({
|
|
608
|
+
customer_id: import_zod6.z.string(),
|
|
609
|
+
product_id: import_zod6.z.string().optional(),
|
|
610
|
+
entity_id: import_zod6.z.string().optional(),
|
|
611
|
+
options: import_zod6.z.array(AttachFeatureOptionsSchema).optional(),
|
|
612
|
+
product_ids: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
613
|
+
free_trial: import_zod6.z.boolean().optional(),
|
|
614
|
+
success_url: import_zod6.z.string().optional(),
|
|
615
|
+
metadata: import_zod6.z.record(import_zod6.z.string()).optional(),
|
|
616
|
+
force_checkout: import_zod6.z.boolean().optional(),
|
|
617
|
+
customer_data: CustomerDataSchema.optional(),
|
|
618
|
+
entity_data: import_zod6.z.any().optional(),
|
|
619
|
+
checkout_session_params: import_zod6.z.record(import_zod6.z.any()).optional(),
|
|
620
|
+
reward: import_zod6.z.string().optional()
|
|
621
|
+
});
|
|
622
|
+
var AttachResultSchema = import_zod6.z.object({
|
|
623
|
+
checkout_url: import_zod6.z.string().optional(),
|
|
624
|
+
customer_id: import_zod6.z.string(),
|
|
625
|
+
product_ids: import_zod6.z.array(import_zod6.z.string()),
|
|
626
|
+
code: import_zod6.z.string(),
|
|
627
|
+
message: import_zod6.z.string(),
|
|
628
|
+
customer_data: import_zod6.z.any().optional()
|
|
629
|
+
});
|
|
630
|
+
var CheckoutParamsSchema = import_zod6.z.object({
|
|
631
|
+
customer_id: import_zod6.z.string(),
|
|
632
|
+
product_id: import_zod6.z.string(),
|
|
633
|
+
entity_id: import_zod6.z.string().optional(),
|
|
634
|
+
success_url: import_zod6.z.string().optional(),
|
|
635
|
+
customer_data: CustomerDataSchema.optional(),
|
|
636
|
+
options: import_zod6.z.array(AttachFeatureOptionsSchema).optional()
|
|
637
|
+
});
|
|
638
|
+
|
|
663
639
|
// src/libraries/backend/utils/backendRes.ts
|
|
664
640
|
var toBackendRes = ({ res }) => {
|
|
665
641
|
let statusCode = res.statusCode ? res.statusCode : res.error ? 500 : 200;
|
|
@@ -746,6 +722,20 @@ var sanitizeBody = (body) => {
|
|
|
746
722
|
delete bodyCopy.customer_data;
|
|
747
723
|
return bodyCopy;
|
|
748
724
|
};
|
|
725
|
+
var checkoutHandler = withAuth({
|
|
726
|
+
fn: async ({
|
|
727
|
+
autumn,
|
|
728
|
+
customer_id,
|
|
729
|
+
customer_data,
|
|
730
|
+
body
|
|
731
|
+
}) => {
|
|
732
|
+
return await autumn.checkout({
|
|
733
|
+
...sanitizeBody(body),
|
|
734
|
+
customer_id,
|
|
735
|
+
customer_data
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
});
|
|
749
739
|
var attachHandler = withAuth({
|
|
750
740
|
fn: async ({
|
|
751
741
|
autumn,
|
|
@@ -825,6 +815,9 @@ var openBillingPortalHandler = withAuth({
|
|
|
825
815
|
}
|
|
826
816
|
});
|
|
827
817
|
var addGenRoutes = (router) => {
|
|
818
|
+
(0, import_rou3.addRoute)(router, "POST", `${BASE_PATH}/checkout`, {
|
|
819
|
+
handler: checkoutHandler
|
|
820
|
+
});
|
|
828
821
|
(0, import_rou3.addRoute)(router, "POST", `${BASE_PATH}/attach`, {
|
|
829
822
|
handler: attachHandler
|
|
830
823
|
});
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
} from "./chunk-UNZHJTEY.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createRouterWithOptions
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-2RZ2FZX2.mjs";
|
|
7
|
+
import "./chunk-5EKNB4IJ.mjs";
|
|
8
|
+
import "./chunk-3OLXYDCU.mjs";
|
|
9
|
+
import "./chunk-K7JGEYUX.mjs";
|
|
10
|
+
import "./chunk-HHMIVOXX.mjs";
|
|
11
|
+
import "./chunk-5H6HVCOP.mjs";
|
|
12
12
|
import {
|
|
13
13
|
Autumn
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IOSEAUDJ.mjs";
|
|
15
15
|
import "./chunk-45WVZY23.mjs";
|
|
16
16
|
import {
|
|
17
17
|
autumnApiUrl
|
|
@@ -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 {
|
|
@@ -260,6 +278,10 @@ declare const BillingPortalParamsSchema: z.ZodObject<{
|
|
|
260
278
|
return_url?: string | undefined;
|
|
261
279
|
}>;
|
|
262
280
|
type BillingPortalParams = z.infer<typeof BillingPortalParamsSchema>;
|
|
281
|
+
interface BillingPortalResult {
|
|
282
|
+
customer_id: string;
|
|
283
|
+
url: string;
|
|
284
|
+
}
|
|
263
285
|
interface CustomerInvoice {
|
|
264
286
|
product_ids: string[];
|
|
265
287
|
stripe_id: string;
|
|
@@ -270,65 +292,6 @@ interface CustomerInvoice {
|
|
|
270
292
|
hosted_invoice_url: string;
|
|
271
293
|
}
|
|
272
294
|
|
|
273
|
-
declare const AttachParamsSchema: z.ZodObject<{
|
|
274
|
-
customer_id: z.ZodString;
|
|
275
|
-
product_id: z.ZodOptional<z.ZodString>;
|
|
276
|
-
entity_id: z.ZodOptional<z.ZodString>;
|
|
277
|
-
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
278
|
-
feature_id: z.ZodString;
|
|
279
|
-
quantity: z.ZodNumber;
|
|
280
|
-
}, "strip", z.ZodTypeAny, {
|
|
281
|
-
feature_id: string;
|
|
282
|
-
quantity: number;
|
|
283
|
-
}, {
|
|
284
|
-
feature_id: string;
|
|
285
|
-
quantity: number;
|
|
286
|
-
}>, "many">>;
|
|
287
|
-
product_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
288
|
-
free_trial: z.ZodOptional<z.ZodBoolean>;
|
|
289
|
-
success_url: z.ZodOptional<z.ZodString>;
|
|
290
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
291
|
-
force_checkout: z.ZodOptional<z.ZodBoolean>;
|
|
292
|
-
customer_data: z.ZodOptional<z.ZodAny>;
|
|
293
|
-
entity_data: z.ZodOptional<z.ZodAny>;
|
|
294
|
-
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
295
|
-
reward: z.ZodOptional<z.ZodString>;
|
|
296
|
-
}, "strip", z.ZodTypeAny, {
|
|
297
|
-
customer_id: string;
|
|
298
|
-
options?: {
|
|
299
|
-
feature_id: string;
|
|
300
|
-
quantity: number;
|
|
301
|
-
}[] | undefined;
|
|
302
|
-
metadata?: Record<string, string> | undefined;
|
|
303
|
-
product_id?: string | undefined;
|
|
304
|
-
entity_id?: string | undefined;
|
|
305
|
-
product_ids?: string[] | undefined;
|
|
306
|
-
free_trial?: boolean | undefined;
|
|
307
|
-
success_url?: string | undefined;
|
|
308
|
-
force_checkout?: boolean | undefined;
|
|
309
|
-
customer_data?: any;
|
|
310
|
-
entity_data?: any;
|
|
311
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
312
|
-
reward?: string | undefined;
|
|
313
|
-
}, {
|
|
314
|
-
customer_id: string;
|
|
315
|
-
options?: {
|
|
316
|
-
feature_id: string;
|
|
317
|
-
quantity: number;
|
|
318
|
-
}[] | undefined;
|
|
319
|
-
metadata?: Record<string, string> | undefined;
|
|
320
|
-
product_id?: string | undefined;
|
|
321
|
-
entity_id?: string | undefined;
|
|
322
|
-
product_ids?: string[] | undefined;
|
|
323
|
-
free_trial?: boolean | undefined;
|
|
324
|
-
success_url?: string | undefined;
|
|
325
|
-
force_checkout?: boolean | undefined;
|
|
326
|
-
customer_data?: any;
|
|
327
|
-
entity_data?: any;
|
|
328
|
-
checkout_session_params?: Record<string, any> | undefined;
|
|
329
|
-
reward?: string | undefined;
|
|
330
|
-
}>;
|
|
331
|
-
type AttachParams = z.infer<typeof AttachParamsSchema>;
|
|
332
295
|
declare const CancelParamsSchema: z.ZodObject<{
|
|
333
296
|
customer_id: z.ZodString;
|
|
334
297
|
product_id: z.ZodString;
|
|
@@ -444,6 +407,174 @@ interface SetupPaymentResult {
|
|
|
444
407
|
url: string;
|
|
445
408
|
}
|
|
446
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
|
+
|
|
447
578
|
declare class Autumn {
|
|
448
579
|
private readonly secretKey;
|
|
449
580
|
private readonly publishableKey;
|
|
@@ -466,7 +597,7 @@ declare class Autumn {
|
|
|
466
597
|
create: (params?: CreateCustomerParams) => Promise<Result<Customer, AutumnError>>;
|
|
467
598
|
update: (id: string, params: UpdateCustomerParams) => Promise<Result<Customer, AutumnError>>;
|
|
468
599
|
delete: (id: string) => Promise<Result<Customer, AutumnError>>;
|
|
469
|
-
billingPortal: (id: string, params?: BillingPortalParams) => Promise<Result<
|
|
600
|
+
billingPortal: (id: string, params?: BillingPortalParams) => Promise<Result<BillingPortalResult, AutumnError>>;
|
|
470
601
|
};
|
|
471
602
|
static products: {
|
|
472
603
|
get: (id: string) => Promise<Result<Product, AutumnError>>;
|
|
@@ -489,7 +620,7 @@ declare class Autumn {
|
|
|
489
620
|
create: (params?: CreateCustomerParams) => Promise<Result<Customer, AutumnError>>;
|
|
490
621
|
update: (id: string, params: UpdateCustomerParams) => Promise<Result<Customer, AutumnError>>;
|
|
491
622
|
delete: (id: string) => Promise<Result<Customer, AutumnError>>;
|
|
492
|
-
billingPortal: (id: string, params?: BillingPortalParams) => Promise<Result<
|
|
623
|
+
billingPortal: (id: string, params?: BillingPortalParams) => Promise<Result<BillingPortalResult, AutumnError>>;
|
|
493
624
|
};
|
|
494
625
|
products: {
|
|
495
626
|
get: (id: string) => Promise<Result<Product, AutumnError>>;
|
|
@@ -507,6 +638,8 @@ declare class Autumn {
|
|
|
507
638
|
createCode: (params: CreateReferralCodeParams) => Promise<Result<any, AutumnError>>;
|
|
508
639
|
redeemCode: (params: RedeemReferralCodeParams) => Promise<Result<any, AutumnError>>;
|
|
509
640
|
};
|
|
641
|
+
static checkout: (params: CheckoutParams) => Promise<Result<CheckoutResult, AutumnError>>;
|
|
642
|
+
checkout(params: CheckoutParams): Promise<Result<CheckoutResult, AutumnError>>;
|
|
510
643
|
static attach: (params: AttachParams) => Promise<Result<{
|
|
511
644
|
message: string;
|
|
512
645
|
code: string;
|
|
@@ -536,40 +669,8 @@ declare class Autumn {
|
|
|
536
669
|
product_id: string;
|
|
537
670
|
success: boolean;
|
|
538
671
|
}, AutumnError>>;
|
|
539
|
-
/**
|
|
540
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
541
|
-
* Please use the new check() method instead.
|
|
542
|
-
*/
|
|
543
|
-
static entitled: (params: CheckParams) => Promise<Result<CheckResult, AutumnError>>;
|
|
544
|
-
/**
|
|
545
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
546
|
-
* Please use the new check() method instead.
|
|
547
|
-
*/
|
|
548
|
-
entitled(params: CheckParams): Promise<Result<CheckResult, AutumnError>>;
|
|
549
672
|
static check: (params: CheckParams) => Promise<Result<CheckResult, AutumnError>>;
|
|
550
673
|
check(params: CheckParams): Promise<Result<CheckResult, AutumnError>>;
|
|
551
|
-
/**
|
|
552
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
553
|
-
* Please use the new track() method instead.
|
|
554
|
-
*/
|
|
555
|
-
static event: (params: TrackParams) => Promise<Result<{
|
|
556
|
-
code: string;
|
|
557
|
-
customer_id: string;
|
|
558
|
-
id: string;
|
|
559
|
-
feature_id?: string | undefined;
|
|
560
|
-
event_name?: string | undefined;
|
|
561
|
-
}, AutumnError>>;
|
|
562
|
-
/**
|
|
563
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
564
|
-
* Please use the new track() method instead.
|
|
565
|
-
*/
|
|
566
|
-
event(params: TrackParams): Promise<Result<{
|
|
567
|
-
code: string;
|
|
568
|
-
customer_id: string;
|
|
569
|
-
id: string;
|
|
570
|
-
feature_id?: string | undefined;
|
|
571
|
-
event_name?: string | undefined;
|
|
572
|
-
}, AutumnError>>;
|
|
573
674
|
static track: (params: TrackParams) => Promise<Result<{
|
|
574
675
|
code: string;
|
|
575
676
|
customer_id: string;
|