@stardeckai/autumn-js 0.1.85
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/LICENSE.md +7 -0
- package/README.md +12 -0
- package/dist/libraries/backend/balancesTypes-BrQjQCw3.d.ts +1822 -0
- package/dist/libraries/backend/balancesTypes-Dk9mLKO8.d.mts +1822 -0
- package/dist/libraries/backend/better-auth.d.mts +772 -0
- package/dist/libraries/backend/better-auth.d.ts +772 -0
- package/dist/libraries/backend/better-auth.js +2872 -0
- package/dist/libraries/backend/better-auth.mjs +482 -0
- package/dist/libraries/backend/chunk-4LJK3VUJ.mjs +48 -0
- package/dist/libraries/backend/chunk-7AOVJSWM.mjs +158 -0
- package/dist/libraries/backend/chunk-ENC3BP6R.mjs +53 -0
- package/dist/libraries/backend/chunk-IZDJ3I6T.mjs +1749 -0
- package/dist/libraries/backend/chunk-KSG3E4Q2.mjs +8 -0
- package/dist/libraries/backend/chunk-LM7CBUUT.mjs +95 -0
- package/dist/libraries/backend/chunk-NRKSUO62.mjs +115 -0
- package/dist/libraries/backend/chunk-SGEUXFOF.mjs +40 -0
- package/dist/libraries/backend/chunk-SRJD6EXQ.mjs +104 -0
- package/dist/libraries/backend/chunk-UNZHJTEY.mjs +18 -0
- package/dist/libraries/backend/chunk-ZGBFNNRL.mjs +78 -0
- package/dist/libraries/backend/chunk-ZW3KBZDU.mjs +30 -0
- package/dist/libraries/backend/constants.d.mts +4 -0
- package/dist/libraries/backend/constants.d.ts +4 -0
- package/dist/libraries/backend/constants.js +33 -0
- package/dist/libraries/backend/constants.mjs +8 -0
- package/dist/libraries/backend/convex.d.mts +16 -0
- package/dist/libraries/backend/convex.d.ts +16 -0
- package/dist/libraries/backend/convex.js +2468 -0
- package/dist/libraries/backend/convex.mjs +164 -0
- package/dist/libraries/backend/elysia.d.mts +35 -0
- package/dist/libraries/backend/elysia.d.ts +35 -0
- package/dist/libraries/backend/elysia.js +2399 -0
- package/dist/libraries/backend/elysia.mjs +102 -0
- package/dist/libraries/backend/express.d.mts +16 -0
- package/dist/libraries/backend/express.d.ts +16 -0
- package/dist/libraries/backend/express.js +2371 -0
- package/dist/libraries/backend/express.mjs +72 -0
- package/dist/libraries/backend/fastify.d.mts +9 -0
- package/dist/libraries/backend/fastify.d.ts +9 -0
- package/dist/libraries/backend/fastify.js +2368 -0
- package/dist/libraries/backend/fastify.mjs +69 -0
- package/dist/libraries/backend/hono.d.mts +12 -0
- package/dist/libraries/backend/hono.d.ts +12 -0
- package/dist/libraries/backend/hono.js +2365 -0
- package/dist/libraries/backend/hono.mjs +66 -0
- package/dist/libraries/backend/index.d.mts +25 -0
- package/dist/libraries/backend/index.d.ts +25 -0
- package/dist/libraries/backend/index.js +2376 -0
- package/dist/libraries/backend/index.mjs +74 -0
- package/dist/libraries/backend/next.d.mts +13 -0
- package/dist/libraries/backend/next.d.ts +13 -0
- package/dist/libraries/backend/next.js +2395 -0
- package/dist/libraries/backend/next.mjs +94 -0
- package/dist/libraries/backend/react-router.d.mts +12 -0
- package/dist/libraries/backend/react-router.d.ts +12 -0
- package/dist/libraries/backend/react-router.js +2396 -0
- package/dist/libraries/backend/react-router.mjs +97 -0
- package/dist/libraries/backend/remix_dep.d.mts +15 -0
- package/dist/libraries/backend/remix_dep.d.ts +15 -0
- package/dist/libraries/backend/remix_dep.js +2360 -0
- package/dist/libraries/backend/remix_dep.mjs +73 -0
- package/dist/libraries/backend/response-BBvvMvoC.d.mts +30 -0
- package/dist/libraries/backend/response-BBvvMvoC.d.ts +30 -0
- package/dist/libraries/backend/routes/analyticsRoutes.d.mts +6 -0
- package/dist/libraries/backend/routes/analyticsRoutes.d.ts +6 -0
- package/dist/libraries/backend/routes/analyticsRoutes.js +1936 -0
- package/dist/libraries/backend/routes/analyticsRoutes.mjs +10 -0
- package/dist/libraries/backend/routes/backendRouter.d.mts +12 -0
- package/dist/libraries/backend/routes/backendRouter.d.ts +12 -0
- package/dist/libraries/backend/routes/backendRouter.js +2304 -0
- package/dist/libraries/backend/routes/backendRouter.mjs +15 -0
- package/dist/libraries/backend/routes/basePath.d.mts +2 -0
- package/dist/libraries/backend/routes/basePath.d.ts +2 -0
- package/dist/libraries/backend/routes/basePath.js +1 -0
- package/dist/libraries/backend/routes/basePath.mjs +0 -0
- package/dist/libraries/backend/routes/entityRoutes.d.mts +6 -0
- package/dist/libraries/backend/routes/entityRoutes.d.ts +6 -0
- package/dist/libraries/backend/routes/entityRoutes.js +1963 -0
- package/dist/libraries/backend/routes/entityRoutes.mjs +10 -0
- package/dist/libraries/backend/routes/genRoutes.d.mts +6 -0
- package/dist/libraries/backend/routes/genRoutes.d.ts +6 -0
- package/dist/libraries/backend/routes/genRoutes.js +2041 -0
- package/dist/libraries/backend/routes/genRoutes.mjs +10 -0
- package/dist/libraries/backend/routes/productRoutes.d.mts +6 -0
- package/dist/libraries/backend/routes/productRoutes.d.ts +6 -0
- package/dist/libraries/backend/routes/productRoutes.js +1913 -0
- package/dist/libraries/backend/routes/productRoutes.mjs +10 -0
- package/dist/libraries/backend/routes/referralRoutes.d.mts +6 -0
- package/dist/libraries/backend/routes/referralRoutes.d.ts +6 -0
- package/dist/libraries/backend/routes/referralRoutes.js +1931 -0
- package/dist/libraries/backend/routes/referralRoutes.mjs +10 -0
- package/dist/libraries/backend/schemas/zod.d.mts +71 -0
- package/dist/libraries/backend/schemas/zod.d.ts +71 -0
- package/dist/libraries/backend/schemas/zod.js +101 -0
- package/dist/libraries/backend/schemas/zod.mjs +68 -0
- package/dist/libraries/backend/supabase.d.mts +9 -0
- package/dist/libraries/backend/supabase.d.ts +9 -0
- package/dist/libraries/backend/supabase.js +2394 -0
- package/dist/libraries/backend/supabase.mjs +95 -0
- package/dist/libraries/backend/tanstack.d.mts +32 -0
- package/dist/libraries/backend/tanstack.d.ts +32 -0
- package/dist/libraries/backend/tanstack.js +2384 -0
- package/dist/libraries/backend/tanstack.mjs +83 -0
- package/dist/libraries/backend/utils/AuthFunction.d.mts +9 -0
- package/dist/libraries/backend/utils/AuthFunction.d.ts +9 -0
- package/dist/libraries/backend/utils/AuthFunction.js +18 -0
- package/dist/libraries/backend/utils/AuthFunction.mjs +0 -0
- package/dist/libraries/backend/utils/backendRes.d.mts +19 -0
- package/dist/libraries/backend/utils/backendRes.d.ts +19 -0
- package/dist/libraries/backend/utils/backendRes.js +1791 -0
- package/dist/libraries/backend/utils/backendRes.mjs +10 -0
- package/dist/libraries/backend/utils/betterAuth/middlewares.d.mts +26 -0
- package/dist/libraries/backend/utils/betterAuth/middlewares.d.ts +26 -0
- package/dist/libraries/backend/utils/betterAuth/middlewares.js +130 -0
- package/dist/libraries/backend/utils/betterAuth/middlewares.mjs +10 -0
- package/dist/libraries/backend/utils/betterAuth/types.d.mts +19 -0
- package/dist/libraries/backend/utils/betterAuth/types.d.ts +19 -0
- package/dist/libraries/backend/utils/betterAuth/types.js +18 -0
- package/dist/libraries/backend/utils/betterAuth/types.mjs +0 -0
- package/dist/libraries/backend/utils/logBackendErrors.d.mts +5 -0
- package/dist/libraries/backend/utils/logBackendErrors.d.ts +5 -0
- package/dist/libraries/backend/utils/logBackendErrors.js +73 -0
- package/dist/libraries/backend/utils/logBackendErrors.mjs +13 -0
- package/dist/libraries/backend/utils/secretKeyCheck.d.mts +13 -0
- package/dist/libraries/backend/utils/secretKeyCheck.d.ts +13 -0
- package/dist/libraries/backend/utils/secretKeyCheck.js +42 -0
- package/dist/libraries/backend/utils/secretKeyCheck.mjs +6 -0
- package/dist/libraries/backend/utils/withAuth.d.mts +29 -0
- package/dist/libraries/backend/utils/withAuth.d.ts +29 -0
- package/dist/libraries/backend/utils/withAuth.js +1892 -0
- package/dist/libraries/backend/utils/withAuth.mjs +9 -0
- package/dist/libraries/react/AutumnContext.d.mts +34 -0
- package/dist/libraries/react/AutumnContext.d.ts +34 -0
- package/dist/libraries/react/AutumnContext.js +2162 -0
- package/dist/libraries/react/AutumnContext.mjs +20 -0
- package/dist/libraries/react/BaseAutumnProvider.d.mts +18 -0
- package/dist/libraries/react/BaseAutumnProvider.d.ts +18 -0
- package/dist/libraries/react/BaseAutumnProvider.js +2833 -0
- package/dist/libraries/react/BaseAutumnProvider.mjs +25 -0
- package/dist/libraries/react/ReactAutumnClient-BJzchCM3.d.ts +304 -0
- package/dist/libraries/react/ReactAutumnClient-Cc2rjUsz.d.mts +304 -0
- package/dist/libraries/react/ReactAutumnProvider.d.mts +20 -0
- package/dist/libraries/react/ReactAutumnProvider.d.ts +20 -0
- package/dist/libraries/react/ReactAutumnProvider.js +3229 -0
- package/dist/libraries/react/ReactAutumnProvider.mjs +26 -0
- package/dist/libraries/react/attachTypes-BNlJ6XXa.d.mts +69 -0
- package/dist/libraries/react/attachTypes-eg914-6v.d.ts +69 -0
- package/dist/libraries/react/chunk-2ZZJUGBO.mjs +138 -0
- package/dist/libraries/react/chunk-4J2T27L6.mjs +99 -0
- package/dist/libraries/react/chunk-4J6OC4ZQ.mjs +2532 -0
- package/dist/libraries/react/chunk-6EXNYWJX.mjs +67 -0
- package/dist/libraries/react/chunk-736TFHSL.mjs +18 -0
- package/dist/libraries/react/chunk-ACRIHVEO.mjs +134 -0
- package/dist/libraries/react/chunk-ACSLCOHZ.mjs +198 -0
- package/dist/libraries/react/chunk-BGOD72CO.mjs +20 -0
- package/dist/libraries/react/chunk-BLM4DAAR.mjs +158 -0
- package/dist/libraries/react/chunk-BVK3DYFG.mjs +157 -0
- package/dist/libraries/react/chunk-CIBQ4BJU.mjs +19 -0
- package/dist/libraries/react/chunk-CSHDMTUY.mjs +52 -0
- package/dist/libraries/react/chunk-D2TXVOAD.mjs +50 -0
- package/dist/libraries/react/chunk-EAZME3W6.mjs +89 -0
- package/dist/libraries/react/chunk-FDURBIAI.mjs +2520 -0
- package/dist/libraries/react/chunk-FK5QRKSW.mjs +747 -0
- package/dist/libraries/react/chunk-GUM4HIGI.mjs +30 -0
- package/dist/libraries/react/chunk-I5ZGIAIX.mjs +57 -0
- package/dist/libraries/react/chunk-IKJYNTI5.mjs +1335 -0
- package/dist/libraries/react/chunk-J24P6YUI.mjs +25 -0
- package/dist/libraries/react/chunk-JNGOZQHP.mjs +62 -0
- package/dist/libraries/react/chunk-JVCOY7ZL.mjs +22 -0
- package/dist/libraries/react/chunk-KEGHYZMH.mjs +584 -0
- package/dist/libraries/react/chunk-LDGZ322L.mjs +92 -0
- package/dist/libraries/react/chunk-MPAPGILW.mjs +360 -0
- package/dist/libraries/react/chunk-NBCD7YQN.mjs +151 -0
- package/dist/libraries/react/chunk-OO5IBU2P.mjs +67 -0
- package/dist/libraries/react/chunk-OYBOLAL5.mjs +31 -0
- package/dist/libraries/react/chunk-Q24L3UDQ.mjs +206 -0
- package/dist/libraries/react/chunk-R4I7MVEX.mjs +46 -0
- package/dist/libraries/react/chunk-RFSQBGLO.mjs +21 -0
- package/dist/libraries/react/chunk-SGEO7BFC.mjs +44 -0
- package/dist/libraries/react/chunk-SUENW2KS.mjs +17 -0
- package/dist/libraries/react/chunk-TI73WOTR.mjs +256 -0
- package/dist/libraries/react/chunk-URQMBRFZ.mjs +62 -0
- package/dist/libraries/react/chunk-V575SGOW.mjs +12 -0
- package/dist/libraries/react/chunk-VPW2CMGB.mjs +165 -0
- package/dist/libraries/react/chunk-WA7QZHL5.mjs +101 -0
- package/dist/libraries/react/chunk-WFFVOEUG.mjs +15 -0
- package/dist/libraries/react/chunk-WVKYZYFT.mjs +37 -0
- package/dist/libraries/react/chunk-XDQLJ7QR.mjs +17 -0
- package/dist/libraries/react/chunk-XGG7IZUQ.mjs +218 -0
- package/dist/libraries/react/chunk-ZBHCIMJH.mjs +448 -0
- package/dist/libraries/react/chunk-ZJPIZX24.mjs +1736 -0
- package/dist/libraries/react/chunk-ZPW4DL3O.mjs +96 -0
- package/dist/libraries/react/client/ConvexAutumnClient.d.mts +77 -0
- package/dist/libraries/react/client/ConvexAutumnClient.d.ts +77 -0
- package/dist/libraries/react/client/ConvexAutumnClient.js +2119 -0
- package/dist/libraries/react/client/ConvexAutumnClient.mjs +9 -0
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +9 -0
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +9 -0
- package/dist/libraries/react/client/ReactAutumnClient.js +2120 -0
- package/dist/libraries/react/client/ReactAutumnClient.mjs +17 -0
- package/dist/libraries/react/client/clientAnalyticsMethods.d.mts +14 -0
- package/dist/libraries/react/client/clientAnalyticsMethods.d.ts +14 -0
- package/dist/libraries/react/client/clientAnalyticsMethods.js +41 -0
- package/dist/libraries/react/client/clientAnalyticsMethods.mjs +10 -0
- package/dist/libraries/react/client/clientCompMethods.d.mts +33 -0
- package/dist/libraries/react/client/clientCompMethods.d.ts +33 -0
- package/dist/libraries/react/client/clientCompMethods.js +35 -0
- package/dist/libraries/react/client/clientCompMethods.mjs +11 -0
- package/dist/libraries/react/client/clientCusMethods.d.mts +16 -0
- package/dist/libraries/react/client/clientCusMethods.d.ts +16 -0
- package/dist/libraries/react/client/clientCusMethods.js +38 -0
- package/dist/libraries/react/client/clientCusMethods.mjs +8 -0
- package/dist/libraries/react/client/clientEntityMethods.d.mts +16 -0
- package/dist/libraries/react/client/clientEntityMethods.d.ts +16 -0
- package/dist/libraries/react/client/clientEntityMethods.js +58 -0
- package/dist/libraries/react/client/clientEntityMethods.mjs +12 -0
- package/dist/libraries/react/client/clientGenMethods.d.mts +22 -0
- package/dist/libraries/react/client/clientGenMethods.d.ts +22 -0
- package/dist/libraries/react/client/clientGenMethods.js +97 -0
- package/dist/libraries/react/client/clientGenMethods.mjs +22 -0
- package/dist/libraries/react/client/clientProdMethods.d.mts +15 -0
- package/dist/libraries/react/client/clientProdMethods.d.ts +15 -0
- package/dist/libraries/react/client/clientProdMethods.js +35 -0
- package/dist/libraries/react/client/clientProdMethods.mjs +8 -0
- package/dist/libraries/react/client/clientReferralMethods.d.mts +15 -0
- package/dist/libraries/react/client/clientReferralMethods.d.ts +15 -0
- package/dist/libraries/react/client/clientReferralMethods.js +41 -0
- package/dist/libraries/react/client/clientReferralMethods.mjs +10 -0
- package/dist/libraries/react/client/types/clientAnalyticsTypes.d.mts +78 -0
- package/dist/libraries/react/client/types/clientAnalyticsTypes.d.ts +78 -0
- package/dist/libraries/react/client/types/clientAnalyticsTypes.js +92 -0
- package/dist/libraries/react/client/types/clientAnalyticsTypes.mjs +62 -0
- package/dist/libraries/react/client/types/clientAttachTypes.d.mts +48 -0
- package/dist/libraries/react/client/types/clientAttachTypes.d.ts +48 -0
- package/dist/libraries/react/client/types/clientAttachTypes.js +76 -0
- package/dist/libraries/react/client/types/clientAttachTypes.mjs +50 -0
- package/dist/libraries/react/client/types/clientCusTypes.d.mts +5 -0
- package/dist/libraries/react/client/types/clientCusTypes.d.ts +5 -0
- package/dist/libraries/react/client/types/clientCusTypes.js +20 -0
- package/dist/libraries/react/client/types/clientCusTypes.mjs +2 -0
- package/dist/libraries/react/client/types/clientEntTypes.d.mts +19 -0
- package/dist/libraries/react/client/types/clientEntTypes.d.ts +19 -0
- package/dist/libraries/react/client/types/clientEntTypes.js +48 -0
- package/dist/libraries/react/client/types/clientEntTypes.mjs +22 -0
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +56 -0
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +56 -0
- package/dist/libraries/react/client/types/clientGenTypes.js +1819 -0
- package/dist/libraries/react/client/types/clientGenTypes.mjs +54 -0
- package/dist/libraries/react/client/types/clientPricingTableTypes.d.mts +20 -0
- package/dist/libraries/react/client/types/clientPricingTableTypes.d.ts +20 -0
- package/dist/libraries/react/client/types/clientPricingTableTypes.js +20 -0
- package/dist/libraries/react/client/types/clientPricingTableTypes.mjs +2 -0
- package/dist/libraries/react/client/types/clientProdTypes.d.mts +5 -0
- package/dist/libraries/react/client/types/clientProdTypes.d.ts +5 -0
- package/dist/libraries/react/client/types/clientProdTypes.js +20 -0
- package/dist/libraries/react/client/types/clientProdTypes.mjs +2 -0
- package/dist/libraries/react/client/types/clientReferralTypes.d.mts +12 -0
- package/dist/libraries/react/client/types/clientReferralTypes.d.ts +12 -0
- package/dist/libraries/react/client/types/clientReferralTypes.js +40 -0
- package/dist/libraries/react/client/types/clientReferralTypes.mjs +15 -0
- package/dist/libraries/react/client/types/responseTypes.d.mts +2 -0
- package/dist/libraries/react/client/types/responseTypes.d.ts +2 -0
- package/dist/libraries/react/client/types/responseTypes.js +3 -0
- package/dist/libraries/react/client/types/responseTypes.mjs +2 -0
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.css +1460 -0
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.mts +25 -0
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.ts +25 -0
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +11543 -0
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +57 -0
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.mts +11 -0
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.ts +11 -0
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.js +181 -0
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.mjs +8 -0
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.mts +9 -0
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.ts +9 -0
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.js +80 -0
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.mjs +8 -0
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.css +1460 -0
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.d.mts +11 -0
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.d.ts +11 -0
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.js +10566 -0
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +53 -0
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +9 -0
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +9 -0
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.js +85 -0
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.mjs +8 -0
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.css +1460 -0
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +52 -0
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +52 -0
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +11834 -0
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +66 -0
- package/dist/libraries/react/components/ui/accordion.d.mts +15 -0
- package/dist/libraries/react/components/ui/accordion.d.ts +15 -0
- package/dist/libraries/react/components/ui/accordion.js +3679 -0
- package/dist/libraries/react/components/ui/accordion.mjs +19 -0
- package/dist/libraries/react/components/ui/button.d.mts +11 -0
- package/dist/libraries/react/components/ui/button.d.ts +11 -0
- package/dist/libraries/react/components/ui/button.js +2776 -0
- package/dist/libraries/react/components/ui/button.mjs +12 -0
- package/dist/libraries/react/components/ui/dialog.d.mts +29 -0
- package/dist/libraries/react/components/ui/dialog.d.ts +29 -0
- package/dist/libraries/react/components/ui/dialog.js +4880 -0
- package/dist/libraries/react/components/ui/dialog.mjs +33 -0
- 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 +11 -0
- package/dist/libraries/react/components/ui/popover.d.ts +11 -0
- package/dist/libraries/react/components/ui/popover.js +6852 -0
- package/dist/libraries/react/components/ui/popover.mjs +20 -0
- package/dist/libraries/react/components/ui/switch.d.mts +8 -0
- package/dist/libraries/react/components/ui/switch.d.ts +8 -0
- package/dist/libraries/react/components/ui/switch.js +3096 -0
- package/dist/libraries/react/components/ui/switch.mjs +13 -0
- package/dist/libraries/react/cusTypes-CfdKzRo3.d.mts +210 -0
- package/dist/libraries/react/cusTypes-CmjJWspY.d.ts +210 -0
- package/dist/libraries/react/error-DHbclCVh.d.mts +17 -0
- package/dist/libraries/react/error-DHbclCVh.d.ts +17 -0
- package/dist/libraries/react/errorUtils/logAuthError.d.mts +3 -0
- package/dist/libraries/react/errorUtils/logAuthError.d.ts +3 -0
- package/dist/libraries/react/errorUtils/logAuthError.js +45 -0
- package/dist/libraries/react/errorUtils/logAuthError.mjs +8 -0
- package/dist/libraries/react/errorUtils/logFetchError.d.mts +8 -0
- package/dist/libraries/react/errorUtils/logFetchError.d.ts +8 -0
- package/dist/libraries/react/errorUtils/logFetchError.js +42 -0
- package/dist/libraries/react/errorUtils/logFetchError.mjs +8 -0
- package/dist/libraries/react/eventTypes-5iJYcv30.d.mts +26 -0
- package/dist/libraries/react/eventTypes-5iJYcv30.d.ts +26 -0
- package/dist/libraries/react/genTypes-BouhbtKm.d.ts +24 -0
- package/dist/libraries/react/genTypes-DT5O0rCP.d.mts +24 -0
- package/dist/libraries/react/hooks/helpers/handleCheck.d.mts +34 -0
- package/dist/libraries/react/hooks/helpers/handleCheck.d.ts +34 -0
- package/dist/libraries/react/hooks/helpers/handleCheck.js +1917 -0
- package/dist/libraries/react/hooks/helpers/handleCheck.mjs +11 -0
- package/dist/libraries/react/hooks/helpers/useAutumnBase.d.mts +32 -0
- package/dist/libraries/react/hooks/helpers/useAutumnBase.d.ts +32 -0
- package/dist/libraries/react/hooks/helpers/useAutumnBase.js +2115 -0
- package/dist/libraries/react/hooks/helpers/useAutumnBase.mjs +10 -0
- package/dist/libraries/react/hooks/helpers/useDialog.d.mts +3 -0
- package/dist/libraries/react/hooks/helpers/useDialog.d.ts +3 -0
- package/dist/libraries/react/hooks/helpers/useDialog.js +44 -0
- package/dist/libraries/react/hooks/helpers/useDialog.mjs +8 -0
- package/dist/libraries/react/hooks/useAggregateEvents.d.mts +20 -0
- package/dist/libraries/react/hooks/useAggregateEvents.d.ts +20 -0
- package/dist/libraries/react/hooks/useAggregateEvents.js +2216 -0
- package/dist/libraries/react/hooks/useAggregateEvents.mjs +19 -0
- package/dist/libraries/react/hooks/useAnalytics.d.mts +21 -0
- package/dist/libraries/react/hooks/useAnalytics.d.ts +21 -0
- package/dist/libraries/react/hooks/useAnalytics.js +2201 -0
- package/dist/libraries/react/hooks/useAnalytics.mjs +19 -0
- package/dist/libraries/react/hooks/useCustomer.d.mts +89 -0
- package/dist/libraries/react/hooks/useCustomer.d.ts +89 -0
- package/dist/libraries/react/hooks/useCustomer.js +2738 -0
- package/dist/libraries/react/hooks/useCustomer.mjs +23 -0
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +91 -0
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +91 -0
- package/dist/libraries/react/hooks/useCustomerBase.js +2728 -0
- package/dist/libraries/react/hooks/useCustomerBase.mjs +22 -0
- package/dist/libraries/react/hooks/useEntity.d.mts +30 -0
- package/dist/libraries/react/hooks/useEntity.d.ts +30 -0
- package/dist/libraries/react/hooks/useEntity.js +2740 -0
- package/dist/libraries/react/hooks/useEntity.mjs +23 -0
- package/dist/libraries/react/hooks/useEntityBase.d.mts +39 -0
- package/dist/libraries/react/hooks/useEntityBase.d.ts +39 -0
- package/dist/libraries/react/hooks/useEntityBase.js +2732 -0
- package/dist/libraries/react/hooks/useEntityBase.mjs +22 -0
- package/dist/libraries/react/hooks/useListEvents.d.mts +43 -0
- package/dist/libraries/react/hooks/useListEvents.d.ts +43 -0
- package/dist/libraries/react/hooks/useListEvents.js +2238 -0
- package/dist/libraries/react/hooks/useListEvents.mjs +19 -0
- package/dist/libraries/react/hooks/usePaywall.d.mts +13 -0
- package/dist/libraries/react/hooks/usePaywall.d.ts +13 -0
- package/dist/libraries/react/hooks/usePaywall.js +2194 -0
- package/dist/libraries/react/hooks/usePaywall.mjs +19 -0
- package/dist/libraries/react/hooks/usePricingTable.d.mts +15 -0
- package/dist/libraries/react/hooks/usePricingTable.d.ts +15 -0
- package/dist/libraries/react/hooks/usePricingTable.js +2363 -0
- package/dist/libraries/react/hooks/usePricingTable.mjs +20 -0
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +25 -0
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +25 -0
- package/dist/libraries/react/hooks/usePricingTableBase.js +1957 -0
- package/dist/libraries/react/hooks/usePricingTableBase.mjs +9 -0
- package/dist/libraries/react/hooks/useProductsBase.d.mts +19 -0
- package/dist/libraries/react/hooks/useProductsBase.d.ts +19 -0
- package/dist/libraries/react/hooks/useProductsBase.js +55 -0
- package/dist/libraries/react/hooks/useProductsBase.mjs +21 -0
- package/dist/libraries/react/index.d.mts +951 -0
- package/dist/libraries/react/index.d.ts +951 -0
- package/dist/libraries/react/index.js +12709 -0
- package/dist/libraries/react/index.mjs +12662 -0
- package/dist/libraries/react/lib/utils.d.mts +5 -0
- package/dist/libraries/react/lib/utils.d.ts +5 -0
- package/dist/libraries/react/lib/utils.js +2556 -0
- package/dist/libraries/react/lib/utils.mjs +8 -0
- package/dist/libraries/react/prodTypes-C4aZSZfO.d.mts +171 -0
- package/dist/libraries/react/prodTypes-C4aZSZfO.d.ts +171 -0
- package/dist/libraries/react/utils/compareParams.d.mts +3 -0
- package/dist/libraries/react/utils/compareParams.d.ts +3 -0
- package/dist/libraries/react/utils/compareParams.js +47 -0
- package/dist/libraries/react/utils/compareParams.mjs +23 -0
- package/dist/libraries/react/utils/errorUtils.d.mts +20 -0
- package/dist/libraries/react/utils/errorUtils.d.ts +20 -0
- package/dist/libraries/react/utils/errorUtils.js +61 -0
- package/dist/libraries/react/utils/errorUtils.mjs +36 -0
- package/dist/libraries/react/utils/inject-styles.d.mts +4 -0
- package/dist/libraries/react/utils/inject-styles.d.ts +4 -0
- package/dist/libraries/react/utils/inject-styles.js +61 -0
- package/dist/libraries/react/utils/inject-styles.mjs +10 -0
- package/dist/next/AutumnProvider.d.mts +30 -0
- package/dist/next/AutumnProvider.d.ts +30 -0
- package/dist/next/AutumnProvider.js +68 -0
- package/dist/next/AutumnProvider.mjs +44 -0
- package/dist/next/client/AutumnClientProvider.d.mts +2 -0
- package/dist/next/client/AutumnClientProvider.d.ts +2 -0
- package/dist/next/client/AutumnClientProvider.js +2 -0
- package/dist/next/client/AutumnClientProvider.mjs +2 -0
- package/dist/next/client/NextAutumnClient.d.mts +375 -0
- package/dist/next/client/NextAutumnClient.d.ts +375 -0
- package/dist/next/client/NextAutumnClient.js +107 -0
- package/dist/next/client/NextAutumnClient.mjs +107 -0
- package/dist/next/client/NextAutumnProvider.d.mts +13 -0
- package/dist/next/client/NextAutumnProvider.d.ts +13 -0
- package/dist/next/client/NextAutumnProvider.js +23 -0
- package/dist/next/client/NextAutumnProvider.mjs +23 -0
- package/dist/next/client/clientAttachTypes-CZ0FmsbF.d.mts +104 -0
- package/dist/next/client/clientAttachTypes-Dczm087t.d.ts +104 -0
- package/dist/next/client/clientEntTypes-CeaZbrIq.d.ts +73 -0
- package/dist/next/client/clientEntTypes-jltPLNQ5.d.mts +73 -0
- package/dist/next/client/clientUtils.d.mts +18 -0
- package/dist/next/client/clientUtils.d.ts +18 -0
- package/dist/next/client/clientUtils.js +72 -0
- package/dist/next/client/clientUtils.mjs +72 -0
- package/dist/next/client/cusTypes-BgJmgZt6.d.ts +215 -0
- package/dist/next/client/cusTypes-BngiltFz.d.mts +215 -0
- package/dist/next/client/error-DHbclCVh.d.mts +17 -0
- package/dist/next/client/error-DHbclCVh.d.ts +17 -0
- package/dist/next/client/hooks/useAutumn.d.mts +20 -0
- package/dist/next/client/hooks/useAutumn.d.ts +20 -0
- package/dist/next/client/hooks/useAutumn.js +17 -0
- package/dist/next/client/hooks/useAutumn.mjs +17 -0
- package/dist/next/client/hooks/useCustomer.d.mts +89 -0
- package/dist/next/client/hooks/useCustomer.d.ts +89 -0
- package/dist/next/client/hooks/useCustomer.js +15 -0
- package/dist/next/client/hooks/useCustomer.mjs +15 -0
- package/dist/next/client/hooks/useEntity.d.mts +27 -0
- package/dist/next/client/hooks/useEntity.d.ts +27 -0
- package/dist/next/client/hooks/useEntity.js +11 -0
- package/dist/next/client/hooks/useEntity.mjs +11 -0
- package/dist/next/client/hooks/usePricingTable.d.mts +33 -0
- package/dist/next/client/hooks/usePricingTable.d.ts +33 -0
- package/dist/next/client/hooks/usePricingTable.js +14 -0
- package/dist/next/client/hooks/usePricingTable.mjs +14 -0
- package/dist/next/client/prodTypes-G6W3NUPg.d.mts +162 -0
- package/dist/next/client/prodTypes-G6W3NUPg.d.ts +162 -0
- package/dist/next/client/response-CLgEplsF.d.ts +16 -0
- package/dist/next/client/response-DKQ_cb7U.d.mts +16 -0
- package/dist/next/client/types.d.mts +74 -0
- package/dist/next/client/types.d.ts +74 -0
- package/dist/next/client/types.js +21 -0
- package/dist/next/client/types.mjs +21 -0
- package/dist/next/enums.d.mts +5 -0
- package/dist/next/enums.d.ts +5 -0
- package/dist/next/enums.js +31 -0
- package/dist/next/enums.mjs +7 -0
- package/dist/next/index.d.mts +19 -0
- package/dist/next/index.d.ts +19 -0
- package/dist/next/index.js +22 -0
- package/dist/next/index.mjs +1 -0
- package/dist/next/server/auth/authPlugin.d.mts +13 -0
- package/dist/next/server/auth/authPlugin.d.ts +13 -0
- package/dist/next/server/auth/authPlugin.js +11 -0
- package/dist/next/server/auth/authPlugin.mjs +11 -0
- package/dist/next/server/auth/clerk-wrapper.d.mts +3 -0
- package/dist/next/server/auth/clerk-wrapper.d.ts +3 -0
- package/dist/next/server/auth/clerk-wrapper.js +22 -0
- package/dist/next/server/auth/clerk-wrapper.mjs +22 -0
- package/dist/next/server/auth/get-next-headers.d.mts +6 -0
- package/dist/next/server/auth/get-next-headers.d.ts +6 -0
- package/dist/next/server/auth/get-next-headers.js +18 -0
- package/dist/next/server/auth/get-next-headers.mjs +18 -0
- package/dist/next/server/auth/handleAuthProvider.d.mts +44 -0
- package/dist/next/server/auth/handleAuthProvider.d.ts +44 -0
- package/dist/next/server/auth/handleAuthProvider.js +179 -0
- package/dist/next/server/auth/handleAuthProvider.mjs +179 -0
- package/dist/next/server/auth/supabase-wrapper.d.mts +3 -0
- package/dist/next/server/auth/supabase-wrapper.d.ts +3 -0
- package/dist/next/server/auth/supabase-wrapper.js +45 -0
- package/dist/next/server/auth/supabase-wrapper.mjs +45 -0
- package/dist/next/server/auth/withNextAuth.d.mts +16 -0
- package/dist/next/server/auth/withNextAuth.d.ts +16 -0
- package/dist/next/server/auth/withNextAuth.js +42 -0
- package/dist/next/server/auth/withNextAuth.mjs +42 -0
- package/dist/next/server/componentActions.d.mts +12 -0
- package/dist/next/server/componentActions.d.ts +12 -0
- package/dist/next/server/componentActions.js +21 -0
- package/dist/next/server/componentActions.mjs +21 -0
- package/dist/next/server/cusActions.d.mts +1421 -0
- package/dist/next/server/cusActions.d.ts +1421 -0
- package/dist/next/server/cusActions.js +70 -0
- package/dist/next/server/cusActions.mjs +70 -0
- package/dist/next/server/cusTypes-C7g7DT5P.d.mts +444 -0
- package/dist/next/server/cusTypes-C7g7DT5P.d.ts +444 -0
- package/dist/next/server/genActions.d.mts +86 -0
- package/dist/next/server/genActions.d.ts +86 -0
- package/dist/next/server/genActions.js +90 -0
- package/dist/next/server/genActions.mjs +90 -0
- package/dist/next/server/response-Bal_cFRb.d.mts +30 -0
- package/dist/next/server/response-Bal_cFRb.d.ts +30 -0
- package/dist/next/server/utils.d.mts +5 -0
- package/dist/next/server/utils.d.ts +5 -0
- package/dist/next/server/utils.js +16 -0
- package/dist/next/server/utils.mjs +16 -0
- package/dist/sdk/index.d.mts +2859 -0
- package/dist/sdk/index.d.ts +2859 -0
- package/dist/sdk/index.js +1832 -0
- package/dist/sdk/index.mjs +1742 -0
- package/dist/styles/global.css +1498 -0
- package/dist/utils/chunk-EG37DNU2.mjs +40 -0
- package/dist/utils/encryptUtils.d.mts +4 -0
- package/dist/utils/encryptUtils.d.ts +4 -0
- package/dist/utils/encryptUtils.js +1811 -0
- package/dist/utils/encryptUtils.mjs +1742 -0
- package/dist/utils/entityUtils.d.mts +3 -0
- package/dist/utils/entityUtils.d.ts +3 -0
- package/dist/utils/entityUtils.js +35 -0
- package/dist/utils/entityUtils.mjs +10 -0
- package/dist/utils/logger.d.mts +45 -0
- package/dist/utils/logger.d.ts +45 -0
- package/dist/utils/logger.js +64 -0
- package/dist/utils/logger.mjs +6 -0
- package/dist/utils/toSnakeCase.d.mts +7 -0
- package/dist/utils/toSnakeCase.d.ts +7 -0
- package/dist/utils/toSnakeCase.js +64 -0
- package/dist/utils/toSnakeCase.mjs +39 -0
- package/package.json +201 -0
- package/tsup.config.ts +213 -0
|
@@ -0,0 +1,2859 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
|
|
3
|
+
declare const Infinite = "inf";
|
|
4
|
+
declare enum FreeTrialDuration {
|
|
5
|
+
Day = "day"
|
|
6
|
+
}
|
|
7
|
+
declare enum UsageModel {
|
|
8
|
+
Prepaid = "prepaid",
|
|
9
|
+
PayPerUse = "pay_per_use"
|
|
10
|
+
}
|
|
11
|
+
type UsageModelType = "prepaid" | "pay_per_use";
|
|
12
|
+
declare enum ProductItemInterval {
|
|
13
|
+
Minute = "minute",
|
|
14
|
+
Hour = "hour",
|
|
15
|
+
Day = "day",
|
|
16
|
+
Week = "week",
|
|
17
|
+
Month = "month",
|
|
18
|
+
Quarter = "quarter",
|
|
19
|
+
SemiAnnual = "semi_annual",
|
|
20
|
+
Year = "year",
|
|
21
|
+
Multiple = "multiple"
|
|
22
|
+
}
|
|
23
|
+
type ProductItemIntervalType = "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | "multiple";
|
|
24
|
+
|
|
25
|
+
type CheckFeatureScenario = "usage_limit" | "feature_flag";
|
|
26
|
+
declare const CheckFeatureResultSchema: z.ZodObject<{
|
|
27
|
+
allowed: z.ZodBoolean;
|
|
28
|
+
feature_id: z.ZodString;
|
|
29
|
+
customer_id: z.ZodString;
|
|
30
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
31
|
+
required_balance: z.ZodNumber;
|
|
32
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
interval: z.ZodOptional<z.ZodEnum<typeof ProductItemInterval>>;
|
|
34
|
+
balance: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
35
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
next_reset_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
38
|
+
overage_allowed: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
usage_limit: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
rollovers: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
balance: z.ZodNumber;
|
|
42
|
+
expires_at: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
breakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
45
|
+
interval: z.ZodEnum<typeof ProductItemInterval>;
|
|
46
|
+
balance: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
next_reset_at: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
}, z.core.$strip>>>;
|
|
51
|
+
credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
52
|
+
feature_id: z.ZodString;
|
|
53
|
+
credit_amount: z.ZodNumber;
|
|
54
|
+
}, z.core.$strip>>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
type CheckFeatureResult = z.infer<typeof CheckFeatureResultSchema>;
|
|
57
|
+
interface CheckFeaturePreview {
|
|
58
|
+
scenario: CheckFeatureScenario;
|
|
59
|
+
title: string;
|
|
60
|
+
message: string;
|
|
61
|
+
feature_id: string;
|
|
62
|
+
feature_name: string;
|
|
63
|
+
products: Product[];
|
|
64
|
+
}
|
|
65
|
+
type ProductScenario = "scheduled" | "active" | "new" | "renew" | "upgrade" | "downgrade" | "cancel";
|
|
66
|
+
interface CheckProductResult {
|
|
67
|
+
allowed: boolean;
|
|
68
|
+
customer_id: string;
|
|
69
|
+
product_id: string;
|
|
70
|
+
entity_id?: string;
|
|
71
|
+
status?: string;
|
|
72
|
+
preview?: CheckProductPreview;
|
|
73
|
+
}
|
|
74
|
+
interface CheckProductPreview {
|
|
75
|
+
scenario: ProductScenario;
|
|
76
|
+
product_id: string;
|
|
77
|
+
product_name: string;
|
|
78
|
+
recurring: boolean;
|
|
79
|
+
error_on_attach?: boolean;
|
|
80
|
+
next_cycle_at?: number;
|
|
81
|
+
current_product_name?: string;
|
|
82
|
+
items?: {
|
|
83
|
+
price: string;
|
|
84
|
+
description: string;
|
|
85
|
+
usage_model?: UsageModelType;
|
|
86
|
+
}[];
|
|
87
|
+
options?: {
|
|
88
|
+
feature_id: string;
|
|
89
|
+
feature_name: string;
|
|
90
|
+
billing_units: number;
|
|
91
|
+
price?: number;
|
|
92
|
+
tiers?: {
|
|
93
|
+
to: number | string;
|
|
94
|
+
amount: number;
|
|
95
|
+
}[];
|
|
96
|
+
}[];
|
|
97
|
+
due_today?: {
|
|
98
|
+
price: number;
|
|
99
|
+
currency: string;
|
|
100
|
+
};
|
|
101
|
+
due_next_cycle?: {
|
|
102
|
+
price: number;
|
|
103
|
+
currency: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare enum AppEnv {
|
|
108
|
+
Sandbox = "sandbox",
|
|
109
|
+
Live = "live"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface PriceTier {
|
|
113
|
+
to: number;
|
|
114
|
+
amount: number | "inf";
|
|
115
|
+
}
|
|
116
|
+
interface Feature$1 {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
type: "boolean" | "continuous_use" | "single_use" | "credit_system";
|
|
120
|
+
}
|
|
121
|
+
interface ProductItem {
|
|
122
|
+
type?: "feature" | "priced_feature" | "price";
|
|
123
|
+
feature_id?: string;
|
|
124
|
+
included_usage?: number | typeof Infinite;
|
|
125
|
+
interval?: ProductItemIntervalType;
|
|
126
|
+
feature?: Feature$1;
|
|
127
|
+
usage_model?: UsageModel;
|
|
128
|
+
price?: number;
|
|
129
|
+
billing_units?: number;
|
|
130
|
+
entity_feature_id?: string;
|
|
131
|
+
reset_usage_when_enabled?: boolean;
|
|
132
|
+
quantity?: number;
|
|
133
|
+
next_cycle_quantity?: number;
|
|
134
|
+
display?: {
|
|
135
|
+
primary_text?: string;
|
|
136
|
+
secondary_text?: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
interface FreeTrial {
|
|
140
|
+
duration: FreeTrialDuration;
|
|
141
|
+
length: number;
|
|
142
|
+
unique_fingerprint: boolean;
|
|
143
|
+
trial_available?: boolean;
|
|
144
|
+
}
|
|
145
|
+
interface Product {
|
|
146
|
+
id: string;
|
|
147
|
+
created_at: number;
|
|
148
|
+
name: string;
|
|
149
|
+
env: AppEnv;
|
|
150
|
+
is_add_on: boolean;
|
|
151
|
+
is_default: boolean;
|
|
152
|
+
group: string;
|
|
153
|
+
version: number;
|
|
154
|
+
items: ProductItem[];
|
|
155
|
+
free_trial: FreeTrial | null;
|
|
156
|
+
scenario?: ProductScenario;
|
|
157
|
+
base_variant_id: string | null;
|
|
158
|
+
properties: {
|
|
159
|
+
is_free: boolean;
|
|
160
|
+
is_one_off: boolean;
|
|
161
|
+
interval_group: string;
|
|
162
|
+
has_trial: boolean;
|
|
163
|
+
updateable: boolean;
|
|
164
|
+
};
|
|
165
|
+
display?: {
|
|
166
|
+
name?: string;
|
|
167
|
+
description?: string;
|
|
168
|
+
button_text?: string;
|
|
169
|
+
recommend_text?: string;
|
|
170
|
+
everything_from?: string;
|
|
171
|
+
button_url?: string;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
interface CreateProductParams {
|
|
175
|
+
id: string;
|
|
176
|
+
name?: string;
|
|
177
|
+
is_add_on?: boolean;
|
|
178
|
+
is_default?: boolean;
|
|
179
|
+
items?: ProductItem[];
|
|
180
|
+
free_trial?: FreeTrial;
|
|
181
|
+
}
|
|
182
|
+
interface ListProductsParams {
|
|
183
|
+
customer_id?: string;
|
|
184
|
+
}
|
|
185
|
+
interface DeleteProductParams {
|
|
186
|
+
all_versions?: boolean;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
declare enum ProductStatus {
|
|
190
|
+
Active = "active",
|
|
191
|
+
Expired = "expired",
|
|
192
|
+
Trialing = "trialing",
|
|
193
|
+
Scheduled = "scheduled",
|
|
194
|
+
PastDue = "past_due"
|
|
195
|
+
}
|
|
196
|
+
declare const CustomerExpandEnum: z.ZodEnum<{
|
|
197
|
+
invoices: "invoices";
|
|
198
|
+
rewards: "rewards";
|
|
199
|
+
trials_used: "trials_used";
|
|
200
|
+
entities: "entities";
|
|
201
|
+
referrals: "referrals";
|
|
202
|
+
payment_method: "payment_method";
|
|
203
|
+
}>;
|
|
204
|
+
type CustomerExpandOption = "invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method";
|
|
205
|
+
|
|
206
|
+
type EntityExpandOption = "invoices";
|
|
207
|
+
|
|
208
|
+
interface CreateEntityParams {
|
|
209
|
+
id: string;
|
|
210
|
+
name: string;
|
|
211
|
+
feature_id: string;
|
|
212
|
+
customer_data?: CustomerData;
|
|
213
|
+
}
|
|
214
|
+
interface CreateEntityResult {
|
|
215
|
+
success: boolean;
|
|
216
|
+
}
|
|
217
|
+
interface DeleteEntityResult {
|
|
218
|
+
success: boolean;
|
|
219
|
+
}
|
|
220
|
+
interface GetEntityParams {
|
|
221
|
+
expand?: EntityExpandOption[];
|
|
222
|
+
}
|
|
223
|
+
interface Entity {
|
|
224
|
+
id: string;
|
|
225
|
+
name: string;
|
|
226
|
+
customer_id: string;
|
|
227
|
+
created_at: number;
|
|
228
|
+
env: string;
|
|
229
|
+
products: CustomerProduct[];
|
|
230
|
+
features: Record<string, CustomerFeature>;
|
|
231
|
+
invoices?: CustomerInvoice[];
|
|
232
|
+
}
|
|
233
|
+
declare const EntityDataSchema: z.ZodObject<{
|
|
234
|
+
name: z.ZodOptional<z.ZodString>;
|
|
235
|
+
feature_id: z.ZodString;
|
|
236
|
+
}, z.core.$strip>;
|
|
237
|
+
type EntityData = z.infer<typeof EntityDataSchema>;
|
|
238
|
+
declare const TransferProductParamsSchema: z.ZodObject<{
|
|
239
|
+
from_entity_id: z.ZodString;
|
|
240
|
+
to_entity_id: z.ZodString;
|
|
241
|
+
product_id: z.ZodString;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
type TransferProductParams = z.infer<typeof TransferProductParamsSchema>;
|
|
244
|
+
type TransferProductResult = {
|
|
245
|
+
success: boolean;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
declare const PurchaseLimitIntervalEnum: z.ZodEnum<{
|
|
249
|
+
hour: "hour";
|
|
250
|
+
day: "day";
|
|
251
|
+
week: "week";
|
|
252
|
+
month: "month";
|
|
253
|
+
}>;
|
|
254
|
+
declare const PurchaseLimitInterval: readonly ["hour", "day", "week", "month"];
|
|
255
|
+
type PurchaseLimitInterval = (typeof PurchaseLimitInterval)[number];
|
|
256
|
+
declare const AutoTopupPurchaseLimitSchema: z.ZodObject<{
|
|
257
|
+
interval: z.ZodEnum<{
|
|
258
|
+
hour: "hour";
|
|
259
|
+
day: "day";
|
|
260
|
+
week: "week";
|
|
261
|
+
month: "month";
|
|
262
|
+
}>;
|
|
263
|
+
interval_count: z.ZodDefault<z.ZodNumber>;
|
|
264
|
+
limit: z.ZodNumber;
|
|
265
|
+
}, z.core.$strip>;
|
|
266
|
+
declare const AutoTopupSchema: z.ZodObject<{
|
|
267
|
+
feature_id: z.ZodString;
|
|
268
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
269
|
+
threshold: z.ZodNumber;
|
|
270
|
+
quantity: z.ZodNumber;
|
|
271
|
+
purchase_limit: z.ZodOptional<z.ZodObject<{
|
|
272
|
+
interval: z.ZodEnum<{
|
|
273
|
+
hour: "hour";
|
|
274
|
+
day: "day";
|
|
275
|
+
week: "week";
|
|
276
|
+
month: "month";
|
|
277
|
+
}>;
|
|
278
|
+
interval_count: z.ZodDefault<z.ZodNumber>;
|
|
279
|
+
limit: z.ZodNumber;
|
|
280
|
+
}, z.core.$strip>>;
|
|
281
|
+
}, z.core.$strip>;
|
|
282
|
+
declare const CustomerBillingControlsSchema: z.ZodObject<{
|
|
283
|
+
auto_topups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
284
|
+
feature_id: z.ZodString;
|
|
285
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
286
|
+
threshold: z.ZodNumber;
|
|
287
|
+
quantity: z.ZodNumber;
|
|
288
|
+
purchase_limit: z.ZodOptional<z.ZodObject<{
|
|
289
|
+
interval: z.ZodEnum<{
|
|
290
|
+
hour: "hour";
|
|
291
|
+
day: "day";
|
|
292
|
+
week: "week";
|
|
293
|
+
month: "month";
|
|
294
|
+
}>;
|
|
295
|
+
interval_count: z.ZodDefault<z.ZodNumber>;
|
|
296
|
+
limit: z.ZodNumber;
|
|
297
|
+
}, z.core.$strip>>;
|
|
298
|
+
}, z.core.$strip>>>;
|
|
299
|
+
}, z.core.$strip>;
|
|
300
|
+
type AutoTopupPurchaseLimit = z.infer<typeof AutoTopupPurchaseLimitSchema>;
|
|
301
|
+
type AutoTopup = z.infer<typeof AutoTopupSchema>;
|
|
302
|
+
type CustomerBillingControls = z.infer<typeof CustomerBillingControlsSchema>;
|
|
303
|
+
declare const CoreCusFeatureSchema: z.ZodObject<{
|
|
304
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
305
|
+
interval: z.ZodOptional<z.ZodEnum<typeof ProductItemInterval>>;
|
|
306
|
+
balance: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
307
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
308
|
+
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
309
|
+
next_reset_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
310
|
+
overage_allowed: z.ZodOptional<z.ZodBoolean>;
|
|
311
|
+
usage_limit: z.ZodOptional<z.ZodNumber>;
|
|
312
|
+
rollovers: z.ZodOptional<z.ZodObject<{
|
|
313
|
+
balance: z.ZodNumber;
|
|
314
|
+
expires_at: z.ZodNumber;
|
|
315
|
+
}, z.core.$strip>>;
|
|
316
|
+
breakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
317
|
+
interval: z.ZodEnum<typeof ProductItemInterval>;
|
|
318
|
+
balance: z.ZodOptional<z.ZodNumber>;
|
|
319
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
320
|
+
included_usage: z.ZodOptional<z.ZodNumber>;
|
|
321
|
+
next_reset_at: z.ZodOptional<z.ZodNumber>;
|
|
322
|
+
}, z.core.$strip>>>;
|
|
323
|
+
credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
324
|
+
feature_id: z.ZodString;
|
|
325
|
+
credit_amount: z.ZodNumber;
|
|
326
|
+
}, z.core.$strip>>>;
|
|
327
|
+
}, z.core.$strip>;
|
|
328
|
+
type CoreCustomerFeature = z.infer<typeof CoreCusFeatureSchema>;
|
|
329
|
+
interface CustomerFeature extends CoreCustomerFeature {
|
|
330
|
+
id: string;
|
|
331
|
+
name: string;
|
|
332
|
+
type: "static" | "single_use" | "continuous_use";
|
|
333
|
+
}
|
|
334
|
+
interface CustomerReferral {
|
|
335
|
+
program_id: string;
|
|
336
|
+
customer: {
|
|
337
|
+
id: string;
|
|
338
|
+
name: string | null;
|
|
339
|
+
email: string | null;
|
|
340
|
+
};
|
|
341
|
+
reward_applied: boolean;
|
|
342
|
+
created_at: number;
|
|
343
|
+
}
|
|
344
|
+
interface CustomerProduct {
|
|
345
|
+
id: string;
|
|
346
|
+
name: string | null;
|
|
347
|
+
group: string | null;
|
|
348
|
+
status: ProductStatus;
|
|
349
|
+
started_at: number;
|
|
350
|
+
canceled_at: number | null;
|
|
351
|
+
version: number;
|
|
352
|
+
subscription_ids?: string[] | null;
|
|
353
|
+
current_period_start?: number | null;
|
|
354
|
+
current_period_end?: number | null;
|
|
355
|
+
trial_ends_at?: number;
|
|
356
|
+
entity_id?: string;
|
|
357
|
+
is_add_on: boolean;
|
|
358
|
+
is_default: boolean;
|
|
359
|
+
items: ProductItem[];
|
|
360
|
+
}
|
|
361
|
+
interface Customer {
|
|
362
|
+
id: string | null;
|
|
363
|
+
created_at: number;
|
|
364
|
+
name: string | null;
|
|
365
|
+
email: string | null;
|
|
366
|
+
fingerprint: string | null;
|
|
367
|
+
stripe_id: string | null;
|
|
368
|
+
env: AppEnv;
|
|
369
|
+
metadata: Record<string, any>;
|
|
370
|
+
send_email_receipts: boolean;
|
|
371
|
+
billing_controls: CustomerBillingControls;
|
|
372
|
+
products: CustomerProduct[];
|
|
373
|
+
features: Record<string, CustomerFeature>;
|
|
374
|
+
payment_method?: any;
|
|
375
|
+
referrals?: CustomerReferral[];
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Maps expand option strings to their corresponding types.
|
|
379
|
+
* Used for conditional type expansion based on the expand parameter.
|
|
380
|
+
*/
|
|
381
|
+
interface CustomerExpandedFields {
|
|
382
|
+
invoices: CustomerInvoice[];
|
|
383
|
+
entities: Entity[];
|
|
384
|
+
referrals: CustomerReferral[];
|
|
385
|
+
rewards: unknown;
|
|
386
|
+
trials_used: unknown;
|
|
387
|
+
payment_method: unknown;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Utility type that creates a Customer with additional expanded fields
|
|
391
|
+
* based on the expand array passed to the API.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* // Base customer without expanded fields
|
|
395
|
+
* type Base = ExpandedCustomer<[]>;
|
|
396
|
+
*
|
|
397
|
+
* // Customer with invoices and entities expanded
|
|
398
|
+
* type WithExpansion = ExpandedCustomer<['invoices', 'entities']>;
|
|
399
|
+
* // Result: Customer & { invoices: CustomerInvoice[]; entities: Entity[] }
|
|
400
|
+
*/
|
|
401
|
+
type ExpandedCustomer<T extends readonly CustomerExpandOption[] = readonly []> = Customer & {
|
|
402
|
+
[K in T[number]]: CustomerExpandedFields[K];
|
|
403
|
+
};
|
|
404
|
+
declare const CustomerDataSchema: z.ZodObject<{
|
|
405
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
406
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
407
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
408
|
+
}, z.core.$strip>;
|
|
409
|
+
type CustomerData = z.infer<typeof CustomerDataSchema>;
|
|
410
|
+
interface GetCustomerParams<T extends readonly CustomerExpandOption[] = readonly []> {
|
|
411
|
+
expand?: T;
|
|
412
|
+
}
|
|
413
|
+
declare const CreateCustomerParamsSchema: z.ZodObject<{
|
|
414
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
415
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
416
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
417
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
418
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
419
|
+
expand: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
420
|
+
invoices: "invoices";
|
|
421
|
+
rewards: "rewards";
|
|
422
|
+
trials_used: "trials_used";
|
|
423
|
+
entities: "entities";
|
|
424
|
+
referrals: "referrals";
|
|
425
|
+
payment_method: "payment_method";
|
|
426
|
+
}>>>;
|
|
427
|
+
stripe_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
428
|
+
auto_enable_plan_id: z.ZodOptional<z.ZodString>;
|
|
429
|
+
billing_controls: z.ZodOptional<z.ZodObject<{
|
|
430
|
+
auto_topups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
431
|
+
feature_id: z.ZodString;
|
|
432
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
433
|
+
threshold: z.ZodNumber;
|
|
434
|
+
quantity: z.ZodNumber;
|
|
435
|
+
purchase_limit: z.ZodOptional<z.ZodObject<{
|
|
436
|
+
interval: z.ZodEnum<{
|
|
437
|
+
hour: "hour";
|
|
438
|
+
day: "day";
|
|
439
|
+
week: "week";
|
|
440
|
+
month: "month";
|
|
441
|
+
}>;
|
|
442
|
+
interval_count: z.ZodDefault<z.ZodNumber>;
|
|
443
|
+
limit: z.ZodNumber;
|
|
444
|
+
}, z.core.$strip>>;
|
|
445
|
+
}, z.core.$strip>>>;
|
|
446
|
+
}, z.core.$strip>>;
|
|
447
|
+
}, z.core.$strip>;
|
|
448
|
+
type CreateCustomerParamsBase = z.infer<typeof CreateCustomerParamsSchema>;
|
|
449
|
+
/**
|
|
450
|
+
* Generic version of CreateCustomerParams that preserves the expand array type
|
|
451
|
+
* for proper ExpandedCustomer inference.
|
|
452
|
+
*/
|
|
453
|
+
interface CreateCustomerParams<T extends readonly CustomerExpandOption[] = readonly []> extends Omit<CreateCustomerParamsBase, "expand"> {
|
|
454
|
+
expand?: T;
|
|
455
|
+
}
|
|
456
|
+
interface UpdateCustomerParams {
|
|
457
|
+
id?: string | null;
|
|
458
|
+
name?: string | null;
|
|
459
|
+
email?: string | null;
|
|
460
|
+
fingerprint?: string | null;
|
|
461
|
+
metadata?: Record<string, any>;
|
|
462
|
+
stripe_id?: string;
|
|
463
|
+
billing_controls?: CustomerBillingControls;
|
|
464
|
+
}
|
|
465
|
+
declare const BillingPortalParamsSchema: z.ZodObject<{
|
|
466
|
+
return_url: z.ZodOptional<z.ZodString>;
|
|
467
|
+
}, z.core.$strip>;
|
|
468
|
+
type BillingPortalParams = z.infer<typeof BillingPortalParamsSchema>;
|
|
469
|
+
interface BillingPortalResult {
|
|
470
|
+
customer_id: string;
|
|
471
|
+
url: string;
|
|
472
|
+
}
|
|
473
|
+
interface CustomerInvoice {
|
|
474
|
+
product_ids: string[];
|
|
475
|
+
stripe_id: string;
|
|
476
|
+
status: string;
|
|
477
|
+
total: number;
|
|
478
|
+
currency: string;
|
|
479
|
+
created_at: number;
|
|
480
|
+
hosted_invoice_url: string;
|
|
481
|
+
}
|
|
482
|
+
declare const UpdateBalancesParamsSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
483
|
+
feature_id: z.ZodString;
|
|
484
|
+
balance: z.ZodNumber;
|
|
485
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
486
|
+
feature_id: z.ZodString;
|
|
487
|
+
balance: z.ZodNumber;
|
|
488
|
+
}, z.core.$strip>>]>, z.ZodObject<{
|
|
489
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
490
|
+
balances: z.ZodArray<z.ZodObject<{
|
|
491
|
+
feature_id: z.ZodString;
|
|
492
|
+
balance: z.ZodNumber;
|
|
493
|
+
}, z.core.$strip>>;
|
|
494
|
+
}, z.core.$strip>]>;
|
|
495
|
+
declare const DeleteCustomerParamsSchema: z.ZodObject<{
|
|
496
|
+
delete_in_stripe: z.ZodOptional<z.ZodBoolean>;
|
|
497
|
+
}, z.core.$strip>;
|
|
498
|
+
declare const ListCustomersParamsSchema: z.ZodObject<{
|
|
499
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
500
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
501
|
+
}, z.core.$strip>;
|
|
502
|
+
type ListCustomersParams = z.infer<typeof ListCustomersParamsSchema>;
|
|
503
|
+
type DeleteCustomerParams = z.infer<typeof DeleteCustomerParamsSchema>;
|
|
504
|
+
type UpdateBalancesParams = z.infer<typeof UpdateBalancesParamsSchema>;
|
|
505
|
+
type UpdateBalancesResult = {
|
|
506
|
+
success: boolean;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
declare const LockParamsSchema: z.ZodObject<{
|
|
510
|
+
lock_id: z.ZodString;
|
|
511
|
+
enabled: z.ZodLiteral<true>;
|
|
512
|
+
expires_at: z.ZodOptional<z.ZodNumber>;
|
|
513
|
+
}, z.core.$strip>;
|
|
514
|
+
type LockParams = z.infer<typeof LockParamsSchema>;
|
|
515
|
+
declare const CancelParamsSchema: z.ZodObject<{
|
|
516
|
+
customer_id: z.ZodString;
|
|
517
|
+
product_id: z.ZodString;
|
|
518
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
519
|
+
cancel_immediately: z.ZodOptional<z.ZodBoolean>;
|
|
520
|
+
prorate: z.ZodOptional<z.ZodBoolean>;
|
|
521
|
+
}, z.core.$strip>;
|
|
522
|
+
type CancelParams = z.infer<typeof CancelParamsSchema>;
|
|
523
|
+
declare const CancelResultSchema: z.ZodObject<{
|
|
524
|
+
success: z.ZodBoolean;
|
|
525
|
+
customer_id: z.ZodString;
|
|
526
|
+
product_id: z.ZodString;
|
|
527
|
+
}, z.core.$strip>;
|
|
528
|
+
type CancelResult = z.infer<typeof CancelResultSchema>;
|
|
529
|
+
declare const TrackParamsSchema: z.ZodObject<{
|
|
530
|
+
customer_id: z.ZodString;
|
|
531
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
532
|
+
feature_id: z.ZodOptional<z.ZodString>;
|
|
533
|
+
event_name: z.ZodOptional<z.ZodString>;
|
|
534
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
535
|
+
customer_data: z.ZodOptional<z.ZodAny>;
|
|
536
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
537
|
+
entity_data: z.ZodOptional<z.ZodAny>;
|
|
538
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
539
|
+
lock: z.ZodOptional<z.ZodObject<{
|
|
540
|
+
lock_id: z.ZodString;
|
|
541
|
+
enabled: z.ZodLiteral<true>;
|
|
542
|
+
expires_at: z.ZodOptional<z.ZodNumber>;
|
|
543
|
+
}, z.core.$strip>>;
|
|
544
|
+
}, z.core.$strip>;
|
|
545
|
+
type TrackParams = z.infer<typeof TrackParamsSchema>;
|
|
546
|
+
declare const TrackResultSchema: z.ZodObject<{
|
|
547
|
+
id: z.ZodString;
|
|
548
|
+
code: z.ZodString;
|
|
549
|
+
customer_id: z.ZodString;
|
|
550
|
+
feature_id: z.ZodOptional<z.ZodString>;
|
|
551
|
+
event_name: z.ZodOptional<z.ZodString>;
|
|
552
|
+
}, z.core.$strip>;
|
|
553
|
+
type TrackResult = z.infer<typeof TrackResultSchema>;
|
|
554
|
+
declare const CheckParamsSchema: z.ZodObject<{
|
|
555
|
+
customer_id: z.ZodString;
|
|
556
|
+
feature_id: z.ZodOptional<z.ZodString>;
|
|
557
|
+
product_id: z.ZodOptional<z.ZodString>;
|
|
558
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
559
|
+
customer_data: z.ZodOptional<z.ZodAny>;
|
|
560
|
+
required_balance: z.ZodOptional<z.ZodNumber>;
|
|
561
|
+
send_event: z.ZodOptional<z.ZodBoolean>;
|
|
562
|
+
with_preview: z.ZodOptional<z.ZodBoolean>;
|
|
563
|
+
entity_data: z.ZodOptional<z.ZodObject<{
|
|
564
|
+
name: z.ZodOptional<z.ZodString>;
|
|
565
|
+
feature_id: z.ZodString;
|
|
566
|
+
}, z.core.$strip>>;
|
|
567
|
+
lock: z.ZodOptional<z.ZodObject<{
|
|
568
|
+
lock_id: z.ZodString;
|
|
569
|
+
enabled: z.ZodLiteral<true>;
|
|
570
|
+
expires_at: z.ZodOptional<z.ZodNumber>;
|
|
571
|
+
}, z.core.$strip>>;
|
|
572
|
+
}, z.core.$strip>;
|
|
573
|
+
type CheckParams = z.infer<typeof CheckParamsSchema>;
|
|
574
|
+
type CheckResult = CheckFeatureResult & CheckProductResult;
|
|
575
|
+
interface UsageParams {
|
|
576
|
+
customer_id: string;
|
|
577
|
+
feature_id: string;
|
|
578
|
+
value: number;
|
|
579
|
+
customer_data?: CustomerData;
|
|
580
|
+
}
|
|
581
|
+
interface UsageResult {
|
|
582
|
+
code: string;
|
|
583
|
+
customer_id: string;
|
|
584
|
+
feature_id: string;
|
|
585
|
+
}
|
|
586
|
+
interface SetupPaymentParams$1 {
|
|
587
|
+
customer_id: string;
|
|
588
|
+
success_url?: string;
|
|
589
|
+
checkout_session_params?: Record<string, any>;
|
|
590
|
+
}
|
|
591
|
+
interface SetupPaymentResult {
|
|
592
|
+
customer_id: string;
|
|
593
|
+
url: string;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
declare const AttachFeatureOptionsSchema: z.ZodObject<{
|
|
597
|
+
feature_id: z.ZodString;
|
|
598
|
+
quantity: z.ZodNumber;
|
|
599
|
+
}, z.core.$strip>;
|
|
600
|
+
type AttachFeatureOptions = z.infer<typeof AttachFeatureOptionsSchema>;
|
|
601
|
+
declare const AttachParamsSchema: z.ZodObject<{
|
|
602
|
+
customer_id: z.ZodString;
|
|
603
|
+
product_id: z.ZodOptional<z.ZodString>;
|
|
604
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
605
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
606
|
+
feature_id: z.ZodString;
|
|
607
|
+
quantity: z.ZodNumber;
|
|
608
|
+
}, z.core.$strip>>>;
|
|
609
|
+
product_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
610
|
+
free_trial: z.ZodOptional<z.ZodBoolean>;
|
|
611
|
+
success_url: z.ZodOptional<z.ZodString>;
|
|
612
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
613
|
+
force_checkout: z.ZodOptional<z.ZodBoolean>;
|
|
614
|
+
customer_data: z.ZodOptional<z.ZodObject<{
|
|
615
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
616
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
617
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
618
|
+
}, z.core.$strip>>;
|
|
619
|
+
entity_data: z.ZodOptional<z.ZodAny>;
|
|
620
|
+
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
621
|
+
reward: z.ZodOptional<z.ZodString>;
|
|
622
|
+
invoice: z.ZodOptional<z.ZodBoolean>;
|
|
623
|
+
new_billing_subscription: z.ZodOptional<z.ZodBoolean>;
|
|
624
|
+
}, z.core.$strip>;
|
|
625
|
+
type AttachParams = z.infer<typeof AttachParamsSchema>;
|
|
626
|
+
declare const AttachResultSchema: z.ZodObject<{
|
|
627
|
+
checkout_url: z.ZodOptional<z.ZodString>;
|
|
628
|
+
customer_id: z.ZodString;
|
|
629
|
+
product_ids: z.ZodArray<z.ZodString>;
|
|
630
|
+
code: z.ZodString;
|
|
631
|
+
message: z.ZodString;
|
|
632
|
+
customer_data: z.ZodOptional<z.ZodAny>;
|
|
633
|
+
invoice: z.ZodOptional<z.ZodObject<{
|
|
634
|
+
status: z.ZodString;
|
|
635
|
+
stripe_id: z.ZodString;
|
|
636
|
+
hosted_invoice_url: z.ZodNullable<z.ZodString>;
|
|
637
|
+
total: z.ZodNumber;
|
|
638
|
+
currency: z.ZodString;
|
|
639
|
+
}, z.core.$strip>>;
|
|
640
|
+
}, z.core.$strip>;
|
|
641
|
+
type AttachResult = z.infer<typeof AttachResultSchema>;
|
|
642
|
+
declare const CheckoutParamsSchema: z.ZodObject<{
|
|
643
|
+
customer_id: z.ZodString;
|
|
644
|
+
product_id: z.ZodString;
|
|
645
|
+
product_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
646
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
647
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
648
|
+
feature_id: z.ZodString;
|
|
649
|
+
quantity: z.ZodNumber;
|
|
650
|
+
}, z.core.$strip>>>;
|
|
651
|
+
force_checkout: z.ZodOptional<z.ZodBoolean>;
|
|
652
|
+
invoice: z.ZodOptional<z.ZodBoolean>;
|
|
653
|
+
success_url: z.ZodOptional<z.ZodString>;
|
|
654
|
+
customer_data: z.ZodOptional<z.ZodObject<{
|
|
655
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
656
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
657
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
658
|
+
}, z.core.$strip>>;
|
|
659
|
+
entity_data: z.ZodOptional<z.ZodAny>;
|
|
660
|
+
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
661
|
+
reward: z.ZodOptional<z.ZodString>;
|
|
662
|
+
new_billing_subscription: z.ZodOptional<z.ZodBoolean>;
|
|
663
|
+
}, z.core.$strip>;
|
|
664
|
+
type CheckoutParams = z.infer<typeof CheckoutParamsSchema>;
|
|
665
|
+
type CheckoutResult = {
|
|
666
|
+
url?: string;
|
|
667
|
+
customer_id: string;
|
|
668
|
+
has_prorations: boolean;
|
|
669
|
+
lines: {
|
|
670
|
+
description: string;
|
|
671
|
+
amount: number;
|
|
672
|
+
item: ProductItem;
|
|
673
|
+
}[];
|
|
674
|
+
total: number;
|
|
675
|
+
currency: string;
|
|
676
|
+
options: AttachFeatureOptions[];
|
|
677
|
+
product: Product;
|
|
678
|
+
current_product: Product;
|
|
679
|
+
free_trial?: boolean;
|
|
680
|
+
next_cycle?: {
|
|
681
|
+
starts_at: number;
|
|
682
|
+
total: number;
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
declare const QueryRangeEnum: z.ZodEnum<{
|
|
687
|
+
"24h": "24h";
|
|
688
|
+
"7d": "7d";
|
|
689
|
+
"30d": "30d";
|
|
690
|
+
"90d": "90d";
|
|
691
|
+
last_cycle: "last_cycle";
|
|
692
|
+
"1bc": "1bc";
|
|
693
|
+
"3bc": "3bc";
|
|
694
|
+
}>;
|
|
695
|
+
declare const BinSizeEnum: z.ZodEnum<{
|
|
696
|
+
hour: "hour";
|
|
697
|
+
day: "day";
|
|
698
|
+
}>;
|
|
699
|
+
declare const QueryParamsSchema: z.ZodObject<{
|
|
700
|
+
customer_id: z.ZodString;
|
|
701
|
+
feature_id: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
702
|
+
range: z.ZodOptional<z.ZodEnum<{
|
|
703
|
+
"24h": "24h";
|
|
704
|
+
"7d": "7d";
|
|
705
|
+
"30d": "30d";
|
|
706
|
+
"90d": "90d";
|
|
707
|
+
last_cycle: "last_cycle";
|
|
708
|
+
"1bc": "1bc";
|
|
709
|
+
"3bc": "3bc";
|
|
710
|
+
}>>;
|
|
711
|
+
group_by: z.ZodOptional<z.ZodString>;
|
|
712
|
+
bin_size: z.ZodOptional<z.ZodEnum<{
|
|
713
|
+
hour: "hour";
|
|
714
|
+
day: "day";
|
|
715
|
+
}>>;
|
|
716
|
+
custom_range: z.ZodOptional<z.ZodObject<{
|
|
717
|
+
start: z.ZodNumber;
|
|
718
|
+
end: z.ZodNumber;
|
|
719
|
+
}, z.core.$strip>>;
|
|
720
|
+
}, z.core.$strip>;
|
|
721
|
+
type QueryParams = z.infer<typeof QueryParamsSchema>;
|
|
722
|
+
type QueryResult = {
|
|
723
|
+
list: Array<{
|
|
724
|
+
period: number;
|
|
725
|
+
} & {
|
|
726
|
+
[key: string]: number | Record<string, number>;
|
|
727
|
+
}>;
|
|
728
|
+
};
|
|
729
|
+
declare const EventsListParamsSchema: z.ZodObject<{
|
|
730
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
731
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
732
|
+
customer_id: z.ZodString;
|
|
733
|
+
feature_id: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
734
|
+
custom_range: z.ZodOptional<z.ZodObject<{
|
|
735
|
+
start: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
736
|
+
end: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
737
|
+
}, z.core.$strip>>;
|
|
738
|
+
}, z.core.$strip>;
|
|
739
|
+
type EventsListParams = z.infer<typeof EventsListParamsSchema>;
|
|
740
|
+
declare const EventsListItemSchema: z.ZodObject<{
|
|
741
|
+
id: z.ZodString;
|
|
742
|
+
timestamp: z.ZodNumber;
|
|
743
|
+
feature_id: z.ZodString;
|
|
744
|
+
customer_id: z.ZodString;
|
|
745
|
+
value: z.ZodNumber;
|
|
746
|
+
properties: z.ZodObject<{}, z.core.$strip>;
|
|
747
|
+
}, z.core.$strip>;
|
|
748
|
+
type EventsListItem = z.infer<typeof EventsListItemSchema>;
|
|
749
|
+
declare const EventsListResponseSchema: z.ZodObject<{
|
|
750
|
+
list: z.ZodArray<z.ZodObject<{
|
|
751
|
+
id: z.ZodString;
|
|
752
|
+
timestamp: z.ZodNumber;
|
|
753
|
+
feature_id: z.ZodString;
|
|
754
|
+
customer_id: z.ZodString;
|
|
755
|
+
value: z.ZodNumber;
|
|
756
|
+
properties: z.ZodObject<{}, z.core.$strip>;
|
|
757
|
+
}, z.core.$strip>>;
|
|
758
|
+
has_more: z.ZodBoolean;
|
|
759
|
+
offset: z.ZodNumber;
|
|
760
|
+
limit: z.ZodNumber;
|
|
761
|
+
total: z.ZodNumber;
|
|
762
|
+
}, z.core.$strip>;
|
|
763
|
+
type EventsListResponse = z.infer<typeof EventsListResponseSchema>;
|
|
764
|
+
|
|
765
|
+
declare enum FeatureType {
|
|
766
|
+
Boolean = "boolean",
|
|
767
|
+
SingleUse = "single_use",
|
|
768
|
+
ContinuousUse = "continuous_use",
|
|
769
|
+
CreditSystem = "credit_system"
|
|
770
|
+
}
|
|
771
|
+
declare const FeatureSchema: z.ZodObject<{
|
|
772
|
+
id: z.ZodString;
|
|
773
|
+
name: z.ZodString;
|
|
774
|
+
type: z.ZodEnum<typeof FeatureType>;
|
|
775
|
+
display: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
776
|
+
singular: z.ZodString;
|
|
777
|
+
plural: z.ZodString;
|
|
778
|
+
}, z.core.$strip>>>;
|
|
779
|
+
credit_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
780
|
+
metered_feature_id: z.ZodString;
|
|
781
|
+
credit_cost: z.ZodNumber;
|
|
782
|
+
}, z.core.$strip>>>>;
|
|
783
|
+
archived: z.ZodBoolean;
|
|
784
|
+
}, z.core.$strip>;
|
|
785
|
+
type Feature = z.infer<typeof FeatureSchema>;
|
|
786
|
+
|
|
787
|
+
interface ErrorResponse {
|
|
788
|
+
message: string;
|
|
789
|
+
code: string;
|
|
790
|
+
}
|
|
791
|
+
declare class AutumnError extends Error {
|
|
792
|
+
readonly message: string;
|
|
793
|
+
readonly code: string;
|
|
794
|
+
constructor(response: ErrorResponse);
|
|
795
|
+
static fromError(error: any): AutumnError;
|
|
796
|
+
toString(): string;
|
|
797
|
+
toJSON(): {
|
|
798
|
+
message: string;
|
|
799
|
+
code: string;
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
type AutumnErrorWithStatus = AutumnError & {
|
|
803
|
+
statusCode?: number;
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
type Success<T> = {
|
|
807
|
+
data: T;
|
|
808
|
+
error: null;
|
|
809
|
+
statusCode?: number;
|
|
810
|
+
};
|
|
811
|
+
type Failure<E> = {
|
|
812
|
+
data: null;
|
|
813
|
+
error: E;
|
|
814
|
+
statusCode?: number;
|
|
815
|
+
};
|
|
816
|
+
declare const toContainerResult: ({ response, logger, logError, }: {
|
|
817
|
+
response: Response;
|
|
818
|
+
logger: Console;
|
|
819
|
+
logError?: boolean;
|
|
820
|
+
}) => Promise<Result<any, AutumnError>>;
|
|
821
|
+
type Result<T, E> = Success<T> | Failure<E>;
|
|
822
|
+
type AutumnPromise<T> = Promise<Result<T, AutumnError>>;
|
|
823
|
+
|
|
824
|
+
declare class Autumn {
|
|
825
|
+
private readonly secretKey;
|
|
826
|
+
private readonly publishableKey;
|
|
827
|
+
private headers;
|
|
828
|
+
private url;
|
|
829
|
+
private logger;
|
|
830
|
+
readonly defaultReturnUrl?: string;
|
|
831
|
+
constructor(options?: {
|
|
832
|
+
secretKey?: string;
|
|
833
|
+
publishableKey?: string;
|
|
834
|
+
url?: string;
|
|
835
|
+
version?: string;
|
|
836
|
+
headers?: Record<string, string>;
|
|
837
|
+
logLevel?: string;
|
|
838
|
+
defaultReturnUrl?: string;
|
|
839
|
+
});
|
|
840
|
+
get(path: string): Promise<Result<any, AutumnError>>;
|
|
841
|
+
post(path: string, body: unknown): Promise<Result<any, AutumnError>>;
|
|
842
|
+
postWithVersion(path: string, body: unknown, version: string): Promise<Result<any, AutumnError>>;
|
|
843
|
+
delete(path: string): Promise<Result<any, AutumnError>>;
|
|
844
|
+
static customers: {
|
|
845
|
+
list: (params?: ListCustomersParams) => Promise<Result<{
|
|
846
|
+
list: Customer[];
|
|
847
|
+
total: number;
|
|
848
|
+
limit: number;
|
|
849
|
+
offset: number;
|
|
850
|
+
}, AutumnError>>;
|
|
851
|
+
get: <const T extends readonly CustomerExpandOption[] = readonly []>(id: string, params?: GetCustomerParams<T>) => AutumnPromise<ExpandedCustomer<T>>;
|
|
852
|
+
create: <const T extends readonly CustomerExpandOption[] = readonly []>(params?: CreateCustomerParams<T>) => AutumnPromise<ExpandedCustomer<T>>;
|
|
853
|
+
update: (id: string, params: UpdateCustomerParams) => Promise<Result<Customer, AutumnError>>;
|
|
854
|
+
delete: (id: string, params?: DeleteCustomerParams) => Promise<Result<Customer, AutumnError>>;
|
|
855
|
+
billingPortal: (id: string, params?: BillingPortalParams) => Promise<Result<BillingPortalResult, AutumnError>>;
|
|
856
|
+
updateBalances: (id: string, params: UpdateBalancesParams) => Promise<Result<UpdateBalancesResult, AutumnError>>;
|
|
857
|
+
};
|
|
858
|
+
static products: {
|
|
859
|
+
get: (id: string) => Promise<Result<Product, AutumnError>>;
|
|
860
|
+
create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
|
|
861
|
+
list: (params?: ListProductsParams) => Promise<Result<{
|
|
862
|
+
list: Product[];
|
|
863
|
+
}, AutumnError>>;
|
|
864
|
+
delete: (id: string) => Promise<Result<{
|
|
865
|
+
success: boolean;
|
|
866
|
+
}, AutumnError>>;
|
|
867
|
+
};
|
|
868
|
+
static entities: {
|
|
869
|
+
get: (customer_id: string, entity_id: string, params?: GetEntityParams) => Promise<Result<Entity, AutumnError>>;
|
|
870
|
+
create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
|
|
871
|
+
transfer: (customer_id: string, params: TransferProductParams) => Promise<Result<TransferProductResult, AutumnError>>;
|
|
872
|
+
delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
|
|
873
|
+
};
|
|
874
|
+
static referrals: {
|
|
875
|
+
createCode: (params: CreateReferralCodeParams) => Promise<Result<CreateReferralCodeResult, AutumnError>>;
|
|
876
|
+
redeemCode: (params: RedeemReferralCodeParams) => Promise<Result<RedeemReferralCodeResult, AutumnError>>;
|
|
877
|
+
};
|
|
878
|
+
static features: {
|
|
879
|
+
list: () => Promise<Result<{
|
|
880
|
+
list: Feature[];
|
|
881
|
+
}, AutumnError>>;
|
|
882
|
+
get: (id: string) => Promise<Result<{
|
|
883
|
+
id: string;
|
|
884
|
+
name: string;
|
|
885
|
+
type: FeatureType;
|
|
886
|
+
archived: boolean;
|
|
887
|
+
display?: {
|
|
888
|
+
singular: string;
|
|
889
|
+
plural: string;
|
|
890
|
+
} | null | undefined;
|
|
891
|
+
credit_schema?: {
|
|
892
|
+
metered_feature_id: string;
|
|
893
|
+
credit_cost: number;
|
|
894
|
+
}[] | null | undefined;
|
|
895
|
+
}, AutumnError>>;
|
|
896
|
+
};
|
|
897
|
+
static events: {
|
|
898
|
+
list: (params: EventsListParams) => Promise<Result<{
|
|
899
|
+
list: {
|
|
900
|
+
id: string;
|
|
901
|
+
timestamp: number;
|
|
902
|
+
feature_id: string;
|
|
903
|
+
customer_id: string;
|
|
904
|
+
value: number;
|
|
905
|
+
properties: Record<string, never>;
|
|
906
|
+
}[];
|
|
907
|
+
has_more: boolean;
|
|
908
|
+
offset: number;
|
|
909
|
+
limit: number;
|
|
910
|
+
total: number;
|
|
911
|
+
}, AutumnError>>;
|
|
912
|
+
aggregate: (params: QueryParams) => Promise<Result<QueryResult, AutumnError>>;
|
|
913
|
+
};
|
|
914
|
+
static balances: {
|
|
915
|
+
create: (params: CreateBalanceParams) => Promise<Result<CreateBalanceResponse, AutumnError>>;
|
|
916
|
+
};
|
|
917
|
+
static v2: {
|
|
918
|
+
billing: {
|
|
919
|
+
attach: (params: BillingAttachParams) => Promise<Result<{
|
|
920
|
+
customer_id: string;
|
|
921
|
+
payment_url: string | null;
|
|
922
|
+
entity_id?: string | undefined;
|
|
923
|
+
invoice?: {
|
|
924
|
+
status: string | null;
|
|
925
|
+
stripe_id: string;
|
|
926
|
+
total: number;
|
|
927
|
+
currency: string;
|
|
928
|
+
hosted_invoice_url: string | null;
|
|
929
|
+
} | undefined;
|
|
930
|
+
required_action?: {
|
|
931
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
932
|
+
reason: string;
|
|
933
|
+
} | undefined;
|
|
934
|
+
}, AutumnError>>;
|
|
935
|
+
update: (params: BillingUpdateParams) => Promise<Result<{
|
|
936
|
+
customer_id: string;
|
|
937
|
+
payment_url: string | null;
|
|
938
|
+
entity_id?: string | undefined;
|
|
939
|
+
invoice?: {
|
|
940
|
+
status: string | null;
|
|
941
|
+
stripe_id: string;
|
|
942
|
+
total: number;
|
|
943
|
+
currency: string;
|
|
944
|
+
hosted_invoice_url: string | null;
|
|
945
|
+
} | undefined;
|
|
946
|
+
required_action?: {
|
|
947
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
948
|
+
reason: string;
|
|
949
|
+
} | undefined;
|
|
950
|
+
}, AutumnError>>;
|
|
951
|
+
previewAttach: (params: BillingAttachParams) => Promise<Result<{
|
|
952
|
+
customer_id: string;
|
|
953
|
+
line_items: {
|
|
954
|
+
title: string;
|
|
955
|
+
description: string;
|
|
956
|
+
amount: number;
|
|
957
|
+
}[];
|
|
958
|
+
total: number;
|
|
959
|
+
currency: string;
|
|
960
|
+
next_cycle?: {
|
|
961
|
+
starts_at: number;
|
|
962
|
+
total: number;
|
|
963
|
+
} | undefined;
|
|
964
|
+
}, AutumnError>>;
|
|
965
|
+
previewUpdate: (params: BillingUpdateParams) => Promise<Result<{
|
|
966
|
+
customer_id: string;
|
|
967
|
+
line_items: {
|
|
968
|
+
title: string;
|
|
969
|
+
description: string;
|
|
970
|
+
amount: number;
|
|
971
|
+
}[];
|
|
972
|
+
total: number;
|
|
973
|
+
currency: string;
|
|
974
|
+
next_cycle?: {
|
|
975
|
+
starts_at: number;
|
|
976
|
+
total: number;
|
|
977
|
+
} | undefined;
|
|
978
|
+
}, AutumnError>>;
|
|
979
|
+
multiAttach: (params: MultiAttachParams) => Promise<Result<{
|
|
980
|
+
customer_id: string;
|
|
981
|
+
payment_url: string | null;
|
|
982
|
+
entity_id?: string | undefined;
|
|
983
|
+
invoice?: {
|
|
984
|
+
status: string | null;
|
|
985
|
+
stripe_id: string;
|
|
986
|
+
total: number;
|
|
987
|
+
currency: string;
|
|
988
|
+
hosted_invoice_url: string | null;
|
|
989
|
+
} | undefined;
|
|
990
|
+
required_action?: {
|
|
991
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
992
|
+
reason: string;
|
|
993
|
+
} | undefined;
|
|
994
|
+
}, AutumnError>>;
|
|
995
|
+
previewMultiAttach: (params: MultiAttachParams) => Promise<Result<{
|
|
996
|
+
customer_id: string;
|
|
997
|
+
line_items: {
|
|
998
|
+
title: string;
|
|
999
|
+
description: string;
|
|
1000
|
+
amount: number;
|
|
1001
|
+
}[];
|
|
1002
|
+
total: number;
|
|
1003
|
+
currency: string;
|
|
1004
|
+
next_cycle?: {
|
|
1005
|
+
starts_at: number;
|
|
1006
|
+
total: number;
|
|
1007
|
+
} | undefined;
|
|
1008
|
+
}, AutumnError>>;
|
|
1009
|
+
setupPayment: (params: SetupPaymentParams) => Promise<Result<{
|
|
1010
|
+
customer_id: string;
|
|
1011
|
+
url: string;
|
|
1012
|
+
entity_id?: string | undefined;
|
|
1013
|
+
}, AutumnError>>;
|
|
1014
|
+
};
|
|
1015
|
+
balances: {
|
|
1016
|
+
update: (params: V2UpdateBalanceParams) => Promise<Result<{
|
|
1017
|
+
message: string;
|
|
1018
|
+
}, AutumnError>>;
|
|
1019
|
+
finalize: (params: V2FinalizeLockParams) => Promise<Result<{
|
|
1020
|
+
success: true;
|
|
1021
|
+
}, AutumnError>>;
|
|
1022
|
+
};
|
|
1023
|
+
};
|
|
1024
|
+
customers: {
|
|
1025
|
+
list: (params?: ListCustomersParams) => Promise<Result<{
|
|
1026
|
+
list: Customer[];
|
|
1027
|
+
total: number;
|
|
1028
|
+
limit: number;
|
|
1029
|
+
offset: number;
|
|
1030
|
+
}, AutumnError>>;
|
|
1031
|
+
get: <const T extends readonly CustomerExpandOption[] = readonly []>(id: string, params?: GetCustomerParams<T>) => AutumnPromise<ExpandedCustomer<T>>;
|
|
1032
|
+
create: <const T extends readonly CustomerExpandOption[] = readonly []>(params?: CreateCustomerParams<T>) => AutumnPromise<ExpandedCustomer<T>>;
|
|
1033
|
+
update: (id: string, params: UpdateCustomerParams) => Promise<Result<Customer, AutumnError>>;
|
|
1034
|
+
delete: (id: string, params?: DeleteCustomerParams) => Promise<Result<Customer, AutumnError>>;
|
|
1035
|
+
billingPortal: (id: string, params?: BillingPortalParams) => Promise<Result<BillingPortalResult, AutumnError>>;
|
|
1036
|
+
updateBalances: (id: string, params: UpdateBalancesParams) => Promise<Result<UpdateBalancesResult, AutumnError>>;
|
|
1037
|
+
};
|
|
1038
|
+
products: {
|
|
1039
|
+
get: (id: string) => Promise<Result<Product, AutumnError>>;
|
|
1040
|
+
create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
|
|
1041
|
+
list: (params?: ListProductsParams) => Promise<Result<{
|
|
1042
|
+
list: Product[];
|
|
1043
|
+
}, AutumnError>>;
|
|
1044
|
+
delete: (id: string) => Promise<Result<{
|
|
1045
|
+
success: boolean;
|
|
1046
|
+
}, AutumnError>>;
|
|
1047
|
+
};
|
|
1048
|
+
entities: {
|
|
1049
|
+
get: (customer_id: string, entity_id: string, params?: GetEntityParams) => Promise<Result<Entity, AutumnError>>;
|
|
1050
|
+
create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
|
|
1051
|
+
transfer: (customer_id: string, params: TransferProductParams) => Promise<Result<TransferProductResult, AutumnError>>;
|
|
1052
|
+
delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
|
|
1053
|
+
};
|
|
1054
|
+
referrals: {
|
|
1055
|
+
createCode: (params: CreateReferralCodeParams) => Promise<Result<CreateReferralCodeResult, AutumnError>>;
|
|
1056
|
+
redeemCode: (params: RedeemReferralCodeParams) => Promise<Result<RedeemReferralCodeResult, AutumnError>>;
|
|
1057
|
+
};
|
|
1058
|
+
features: {
|
|
1059
|
+
list: () => Promise<Result<{
|
|
1060
|
+
list: Feature[];
|
|
1061
|
+
}, AutumnError>>;
|
|
1062
|
+
get: (id: string) => Promise<Result<{
|
|
1063
|
+
id: string;
|
|
1064
|
+
name: string;
|
|
1065
|
+
type: FeatureType;
|
|
1066
|
+
archived: boolean;
|
|
1067
|
+
display?: {
|
|
1068
|
+
singular: string;
|
|
1069
|
+
plural: string;
|
|
1070
|
+
} | null | undefined;
|
|
1071
|
+
credit_schema?: {
|
|
1072
|
+
metered_feature_id: string;
|
|
1073
|
+
credit_cost: number;
|
|
1074
|
+
}[] | null | undefined;
|
|
1075
|
+
}, AutumnError>>;
|
|
1076
|
+
};
|
|
1077
|
+
events: {
|
|
1078
|
+
list: (params: EventsListParams) => Promise<Result<{
|
|
1079
|
+
list: {
|
|
1080
|
+
id: string;
|
|
1081
|
+
timestamp: number;
|
|
1082
|
+
feature_id: string;
|
|
1083
|
+
customer_id: string;
|
|
1084
|
+
value: number;
|
|
1085
|
+
properties: Record<string, never>;
|
|
1086
|
+
}[];
|
|
1087
|
+
has_more: boolean;
|
|
1088
|
+
offset: number;
|
|
1089
|
+
limit: number;
|
|
1090
|
+
total: number;
|
|
1091
|
+
}, AutumnError>>;
|
|
1092
|
+
aggregate: (params: QueryParams) => Promise<Result<QueryResult, AutumnError>>;
|
|
1093
|
+
};
|
|
1094
|
+
balances: {
|
|
1095
|
+
create: (params: CreateBalanceParams) => Promise<Result<CreateBalanceResponse, AutumnError>>;
|
|
1096
|
+
};
|
|
1097
|
+
v2: {
|
|
1098
|
+
billing: {
|
|
1099
|
+
attach: (params: BillingAttachParams) => Promise<Result<{
|
|
1100
|
+
customer_id: string;
|
|
1101
|
+
payment_url: string | null;
|
|
1102
|
+
entity_id?: string | undefined;
|
|
1103
|
+
invoice?: {
|
|
1104
|
+
status: string | null;
|
|
1105
|
+
stripe_id: string;
|
|
1106
|
+
total: number;
|
|
1107
|
+
currency: string;
|
|
1108
|
+
hosted_invoice_url: string | null;
|
|
1109
|
+
} | undefined;
|
|
1110
|
+
required_action?: {
|
|
1111
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
1112
|
+
reason: string;
|
|
1113
|
+
} | undefined;
|
|
1114
|
+
}, AutumnError>>;
|
|
1115
|
+
update: (params: BillingUpdateParams) => Promise<Result<{
|
|
1116
|
+
customer_id: string;
|
|
1117
|
+
payment_url: string | null;
|
|
1118
|
+
entity_id?: string | undefined;
|
|
1119
|
+
invoice?: {
|
|
1120
|
+
status: string | null;
|
|
1121
|
+
stripe_id: string;
|
|
1122
|
+
total: number;
|
|
1123
|
+
currency: string;
|
|
1124
|
+
hosted_invoice_url: string | null;
|
|
1125
|
+
} | undefined;
|
|
1126
|
+
required_action?: {
|
|
1127
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
1128
|
+
reason: string;
|
|
1129
|
+
} | undefined;
|
|
1130
|
+
}, AutumnError>>;
|
|
1131
|
+
previewAttach: (params: BillingAttachParams) => Promise<Result<{
|
|
1132
|
+
customer_id: string;
|
|
1133
|
+
line_items: {
|
|
1134
|
+
title: string;
|
|
1135
|
+
description: string;
|
|
1136
|
+
amount: number;
|
|
1137
|
+
}[];
|
|
1138
|
+
total: number;
|
|
1139
|
+
currency: string;
|
|
1140
|
+
next_cycle?: {
|
|
1141
|
+
starts_at: number;
|
|
1142
|
+
total: number;
|
|
1143
|
+
} | undefined;
|
|
1144
|
+
}, AutumnError>>;
|
|
1145
|
+
previewUpdate: (params: BillingUpdateParams) => Promise<Result<{
|
|
1146
|
+
customer_id: string;
|
|
1147
|
+
line_items: {
|
|
1148
|
+
title: string;
|
|
1149
|
+
description: string;
|
|
1150
|
+
amount: number;
|
|
1151
|
+
}[];
|
|
1152
|
+
total: number;
|
|
1153
|
+
currency: string;
|
|
1154
|
+
next_cycle?: {
|
|
1155
|
+
starts_at: number;
|
|
1156
|
+
total: number;
|
|
1157
|
+
} | undefined;
|
|
1158
|
+
}, AutumnError>>;
|
|
1159
|
+
multiAttach: (params: MultiAttachParams) => Promise<Result<{
|
|
1160
|
+
customer_id: string;
|
|
1161
|
+
payment_url: string | null;
|
|
1162
|
+
entity_id?: string | undefined;
|
|
1163
|
+
invoice?: {
|
|
1164
|
+
status: string | null;
|
|
1165
|
+
stripe_id: string;
|
|
1166
|
+
total: number;
|
|
1167
|
+
currency: string;
|
|
1168
|
+
hosted_invoice_url: string | null;
|
|
1169
|
+
} | undefined;
|
|
1170
|
+
required_action?: {
|
|
1171
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
1172
|
+
reason: string;
|
|
1173
|
+
} | undefined;
|
|
1174
|
+
}, AutumnError>>;
|
|
1175
|
+
previewMultiAttach: (params: MultiAttachParams) => Promise<Result<{
|
|
1176
|
+
customer_id: string;
|
|
1177
|
+
line_items: {
|
|
1178
|
+
title: string;
|
|
1179
|
+
description: string;
|
|
1180
|
+
amount: number;
|
|
1181
|
+
}[];
|
|
1182
|
+
total: number;
|
|
1183
|
+
currency: string;
|
|
1184
|
+
next_cycle?: {
|
|
1185
|
+
starts_at: number;
|
|
1186
|
+
total: number;
|
|
1187
|
+
} | undefined;
|
|
1188
|
+
}, AutumnError>>;
|
|
1189
|
+
setupPayment: (params: SetupPaymentParams) => Promise<Result<{
|
|
1190
|
+
customer_id: string;
|
|
1191
|
+
url: string;
|
|
1192
|
+
entity_id?: string | undefined;
|
|
1193
|
+
}, AutumnError>>;
|
|
1194
|
+
};
|
|
1195
|
+
balances: {
|
|
1196
|
+
update: (params: V2UpdateBalanceParams) => Promise<Result<{
|
|
1197
|
+
message: string;
|
|
1198
|
+
}, AutumnError>>;
|
|
1199
|
+
finalize: (params: V2FinalizeLockParams) => Promise<Result<{
|
|
1200
|
+
success: true;
|
|
1201
|
+
}, AutumnError>>;
|
|
1202
|
+
};
|
|
1203
|
+
};
|
|
1204
|
+
/**
|
|
1205
|
+
* Initiates a checkout flow for a product purchase.
|
|
1206
|
+
*
|
|
1207
|
+
* The checkout function handles the purchase process for products with pricing.
|
|
1208
|
+
* It determines whether to show a dialog for user input or redirect directly
|
|
1209
|
+
* to Stripe based on the customer's state and product requirements.
|
|
1210
|
+
*
|
|
1211
|
+
* @param params - Checkout parameters including product ID, customer data, and options
|
|
1212
|
+
* @returns Promise resolving to checkout details including pricing, prorations, and URLs
|
|
1213
|
+
*
|
|
1214
|
+
* @example
|
|
1215
|
+
* ```typescript
|
|
1216
|
+
* const result = await autumn.checkout({
|
|
1217
|
+
* customer_id: "user_123",
|
|
1218
|
+
* product_id: "pro",
|
|
1219
|
+
* success_url: "https://myapp.com/success"
|
|
1220
|
+
* });
|
|
1221
|
+
*
|
|
1222
|
+
* if (result.url) {
|
|
1223
|
+
* // Redirect to Stripe checkout
|
|
1224
|
+
* window.location.href = result.url;
|
|
1225
|
+
* }
|
|
1226
|
+
* ```
|
|
1227
|
+
*/
|
|
1228
|
+
checkout(params: CheckoutParams): Promise<Result<CheckoutResult, AutumnError>>;
|
|
1229
|
+
static checkout: (params: CheckoutParams) => Promise<Result<CheckoutResult, AutumnError>>;
|
|
1230
|
+
static usage: (params: UsageParams) => Promise<Result<UsageResult, AutumnError>>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Attaches a product to a customer, enabling access and handling billing.
|
|
1233
|
+
*
|
|
1234
|
+
* The attach function activates a product for a customer and applies all product items.
|
|
1235
|
+
* When you attach a product:
|
|
1236
|
+
* - The customer gains access to all features in the product
|
|
1237
|
+
* - If the product has prices, the customer will be billed accordingly
|
|
1238
|
+
* - If there's no existing payment method, a checkout URL will be generated
|
|
1239
|
+
*
|
|
1240
|
+
* @param params - Attach parameters including customer ID, product ID, and options
|
|
1241
|
+
* @returns Promise resolving to attachment result with checkout URL if needed
|
|
1242
|
+
*
|
|
1243
|
+
* @example
|
|
1244
|
+
* ```typescript
|
|
1245
|
+
* const result = await autumn.attach({
|
|
1246
|
+
* customer_id: "user_123",
|
|
1247
|
+
* product_id: "pro",
|
|
1248
|
+
* success_url: "https://myapp.com/success"
|
|
1249
|
+
* });
|
|
1250
|
+
*
|
|
1251
|
+
* if (result.checkout_url) {
|
|
1252
|
+
* // Payment required - redirect to checkout
|
|
1253
|
+
* window.location.href = result.checkout_url;
|
|
1254
|
+
* } else {
|
|
1255
|
+
* // Product successfully attached
|
|
1256
|
+
* console.log("Access granted:", result.message);
|
|
1257
|
+
* }
|
|
1258
|
+
* ```
|
|
1259
|
+
*/
|
|
1260
|
+
attach(params: AttachParams): Promise<Result<{
|
|
1261
|
+
customer_id: string;
|
|
1262
|
+
product_ids: string[];
|
|
1263
|
+
code: string;
|
|
1264
|
+
message: string;
|
|
1265
|
+
checkout_url?: string | undefined;
|
|
1266
|
+
customer_data?: any;
|
|
1267
|
+
invoice?: {
|
|
1268
|
+
status: string;
|
|
1269
|
+
stripe_id: string;
|
|
1270
|
+
hosted_invoice_url: string | null;
|
|
1271
|
+
total: number;
|
|
1272
|
+
currency: string;
|
|
1273
|
+
} | undefined;
|
|
1274
|
+
}, AutumnError>>;
|
|
1275
|
+
static attach: (params: AttachParams) => Promise<Result<{
|
|
1276
|
+
customer_id: string;
|
|
1277
|
+
product_ids: string[];
|
|
1278
|
+
code: string;
|
|
1279
|
+
message: string;
|
|
1280
|
+
checkout_url?: string | undefined;
|
|
1281
|
+
customer_data?: any;
|
|
1282
|
+
invoice?: {
|
|
1283
|
+
status: string;
|
|
1284
|
+
stripe_id: string;
|
|
1285
|
+
hosted_invoice_url: string | null;
|
|
1286
|
+
total: number;
|
|
1287
|
+
currency: string;
|
|
1288
|
+
} | undefined;
|
|
1289
|
+
}, AutumnError>>;
|
|
1290
|
+
static setupPayment: (params: SetupPaymentParams$1) => Promise<Result<SetupPaymentResult, AutumnError>>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Sets up a payment method for a customer.
|
|
1293
|
+
*
|
|
1294
|
+
* This method allows you to set up payment methods for customers without
|
|
1295
|
+
* immediately charging them. Useful for collecting payment information
|
|
1296
|
+
* before product attachment or for updating existing payment methods.
|
|
1297
|
+
*
|
|
1298
|
+
* @param params - Setup payment parameters including customer information
|
|
1299
|
+
* @returns Promise resolving to setup payment result
|
|
1300
|
+
*
|
|
1301
|
+
* @example
|
|
1302
|
+
* ```typescript
|
|
1303
|
+
* const result = await autumn.setupPayment({
|
|
1304
|
+
* customer_id: "user_123"
|
|
1305
|
+
* });
|
|
1306
|
+
* ```
|
|
1307
|
+
*/
|
|
1308
|
+
setupPayment(params: SetupPaymentParams$1): Promise<Result<SetupPaymentResult, AutumnError>>;
|
|
1309
|
+
static cancel: (params: CancelParams) => Promise<Result<{
|
|
1310
|
+
success: boolean;
|
|
1311
|
+
customer_id: string;
|
|
1312
|
+
product_id: string;
|
|
1313
|
+
}, AutumnError>>;
|
|
1314
|
+
/**
|
|
1315
|
+
* Cancels a customer's subscription or product attachment.
|
|
1316
|
+
*
|
|
1317
|
+
* This method allows you to cancel a customer's subscription to a specific product.
|
|
1318
|
+
* You can choose to cancel immediately or at the end of the billing cycle.
|
|
1319
|
+
*
|
|
1320
|
+
* @param params - Cancel parameters including customer ID and product ID
|
|
1321
|
+
* @returns Promise resolving to cancellation result
|
|
1322
|
+
*
|
|
1323
|
+
* @example
|
|
1324
|
+
* ```typescript
|
|
1325
|
+
* const result = await autumn.cancel({
|
|
1326
|
+
* customer_id: "user_123",
|
|
1327
|
+
* product_id: "pro",
|
|
1328
|
+
* cancel_immediately: false // Cancel at end of billing cycle
|
|
1329
|
+
* });
|
|
1330
|
+
* ```
|
|
1331
|
+
*/
|
|
1332
|
+
cancel(params: CancelParams): Promise<Result<{
|
|
1333
|
+
success: boolean;
|
|
1334
|
+
customer_id: string;
|
|
1335
|
+
product_id: string;
|
|
1336
|
+
}, AutumnError>>;
|
|
1337
|
+
static check: (params: CheckParams) => Promise<Result<CheckResult, AutumnError>>;
|
|
1338
|
+
/**
|
|
1339
|
+
* Checks if a customer has access to a specific feature.
|
|
1340
|
+
*
|
|
1341
|
+
* This method verifies whether a customer has permission to use a feature
|
|
1342
|
+
* and checks their remaining balance/usage limits. It can be used to gate
|
|
1343
|
+
* features and determine when to show upgrade prompts.
|
|
1344
|
+
*
|
|
1345
|
+
* @param params - Check parameters including customer ID and feature ID
|
|
1346
|
+
* @returns Promise resolving to access check result with allowed status and balance info
|
|
1347
|
+
*
|
|
1348
|
+
* @example
|
|
1349
|
+
* ```typescript
|
|
1350
|
+
* const result = await autumn.check({
|
|
1351
|
+
* customer_id: "user_123",
|
|
1352
|
+
* feature_id: "messages",
|
|
1353
|
+
* required_balance: 1
|
|
1354
|
+
* });
|
|
1355
|
+
*
|
|
1356
|
+
* if (!result.allowed) {
|
|
1357
|
+
* console.log("Feature access denied - upgrade required");
|
|
1358
|
+
* }
|
|
1359
|
+
* ```
|
|
1360
|
+
*/
|
|
1361
|
+
check(params: CheckParams): Promise<Result<CheckResult, AutumnError>>;
|
|
1362
|
+
static track: (params: TrackParams) => Promise<Result<{
|
|
1363
|
+
id: string;
|
|
1364
|
+
code: string;
|
|
1365
|
+
customer_id: string;
|
|
1366
|
+
feature_id?: string | undefined;
|
|
1367
|
+
event_name?: string | undefined;
|
|
1368
|
+
}, AutumnError>>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Tracks usage events for features or analytics.
|
|
1371
|
+
*
|
|
1372
|
+
* This method records usage events for metered features, updating the customer's
|
|
1373
|
+
* balance and usage statistics. It's typically used server-side to ensure
|
|
1374
|
+
* accurate tracking that cannot be manipulated by users.
|
|
1375
|
+
*
|
|
1376
|
+
* @param params - Track parameters including customer ID, feature ID, and usage value
|
|
1377
|
+
* @returns Promise resolving to tracking result
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* ```typescript
|
|
1381
|
+
* const result = await autumn.track({
|
|
1382
|
+
* customer_id: "user_123",
|
|
1383
|
+
* feature_id: "messages",
|
|
1384
|
+
* value: 1 // Track 1 message sent
|
|
1385
|
+
* });
|
|
1386
|
+
* ```
|
|
1387
|
+
*/
|
|
1388
|
+
track(params: TrackParams): Promise<Result<{
|
|
1389
|
+
id: string;
|
|
1390
|
+
code: string;
|
|
1391
|
+
customer_id: string;
|
|
1392
|
+
feature_id?: string | undefined;
|
|
1393
|
+
event_name?: string | undefined;
|
|
1394
|
+
}, AutumnError>>;
|
|
1395
|
+
/**
|
|
1396
|
+
* Retrieves usage statistics and analytics for a customer.
|
|
1397
|
+
*
|
|
1398
|
+
* This method fetches detailed usage information for a customer's features,
|
|
1399
|
+
* including current balances, usage history, and analytics data. Useful
|
|
1400
|
+
* for displaying usage dashboards or generating reports.
|
|
1401
|
+
*
|
|
1402
|
+
* @param params - Usage parameters including customer ID and optional filters
|
|
1403
|
+
* @returns Promise resolving to usage statistics and analytics data
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* ```typescript
|
|
1407
|
+
* const result = await autumn.usage({
|
|
1408
|
+
* customer_id: "user_123",
|
|
1409
|
+
* feature_id: "messages"
|
|
1410
|
+
* value: 20 // Usage value
|
|
1411
|
+
* });
|
|
1412
|
+
* ```
|
|
1413
|
+
*/
|
|
1414
|
+
usage(params: UsageParams): Promise<Result<UsageResult, AutumnError>>;
|
|
1415
|
+
static query: (params: QueryParams) => Promise<Result<QueryResult, AutumnError>>;
|
|
1416
|
+
/**
|
|
1417
|
+
* Performs advanced queries on customer data and analytics.
|
|
1418
|
+
*
|
|
1419
|
+
* This method allows you to run complex queries against customer data,
|
|
1420
|
+
* usage patterns, and billing information. Useful for generating reports,
|
|
1421
|
+
* analytics, and custom data insights.
|
|
1422
|
+
*
|
|
1423
|
+
* @param params - Query parameters including customer ID and query specifications
|
|
1424
|
+
* @returns Promise resolving to query results with requested data
|
|
1425
|
+
*
|
|
1426
|
+
* @example
|
|
1427
|
+
* ```typescript
|
|
1428
|
+
* const result = await autumn.query({
|
|
1429
|
+
* customer_id: "user_123",
|
|
1430
|
+
* feature_id: "messages" // feature id to fetch for query, can also be an array
|
|
1431
|
+
* });
|
|
1432
|
+
*
|
|
1433
|
+
* ```
|
|
1434
|
+
*/
|
|
1435
|
+
query(params: QueryParams): Promise<Result<QueryResult, AutumnError>>;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
interface GetPricingTableParams {
|
|
1439
|
+
customer_id?: string;
|
|
1440
|
+
}
|
|
1441
|
+
interface PricingTableProduct {
|
|
1442
|
+
id: string;
|
|
1443
|
+
name: string;
|
|
1444
|
+
description?: string;
|
|
1445
|
+
button_text?: string;
|
|
1446
|
+
recommend_text?: string;
|
|
1447
|
+
everything_from?: string;
|
|
1448
|
+
price: {
|
|
1449
|
+
primary_text: string;
|
|
1450
|
+
secondary_text?: string;
|
|
1451
|
+
} & ProductItem;
|
|
1452
|
+
items: ({
|
|
1453
|
+
primary_text: string;
|
|
1454
|
+
secondary_text?: string;
|
|
1455
|
+
} & ProductItem)[];
|
|
1456
|
+
scenario: ProductScenario;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
declare const fetchPricingTable: ({ instance, params, }: {
|
|
1460
|
+
instance: Autumn;
|
|
1461
|
+
params?: GetPricingTableParams;
|
|
1462
|
+
}) => AutumnPromise<PricingTableProduct[]>;
|
|
1463
|
+
|
|
1464
|
+
declare const CreateReferralCodeParamsSchema: z.ZodObject<{
|
|
1465
|
+
customer_id: z.ZodString;
|
|
1466
|
+
program_id: z.ZodString;
|
|
1467
|
+
}, z.core.$strip>;
|
|
1468
|
+
type CreateReferralCodeParams = z.infer<typeof CreateReferralCodeParamsSchema>;
|
|
1469
|
+
interface CreateReferralCodeResult {
|
|
1470
|
+
code: string;
|
|
1471
|
+
customer_id: string;
|
|
1472
|
+
created_at: number;
|
|
1473
|
+
}
|
|
1474
|
+
declare const RedeemReferralCodeParamsSchema: z.ZodObject<{
|
|
1475
|
+
code: z.ZodString;
|
|
1476
|
+
customer_id: z.ZodString;
|
|
1477
|
+
}, z.core.$strip>;
|
|
1478
|
+
type RedeemReferralCodeParams = z.infer<typeof RedeemReferralCodeParamsSchema>;
|
|
1479
|
+
interface RedeemReferralCodeResult {
|
|
1480
|
+
id: string;
|
|
1481
|
+
customer_id: string;
|
|
1482
|
+
reward_id: string;
|
|
1483
|
+
referrer: {
|
|
1484
|
+
id: string;
|
|
1485
|
+
name: string | null;
|
|
1486
|
+
email: string | null;
|
|
1487
|
+
};
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
declare const ResetInterval: readonly ["one_off", "minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"];
|
|
1491
|
+
declare const CreateBalanceParamsSchema: z.ZodObject<{
|
|
1492
|
+
feature_id: z.ZodString;
|
|
1493
|
+
customer_id: z.ZodString;
|
|
1494
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
1495
|
+
granted_balance: z.ZodOptional<z.ZodNumber>;
|
|
1496
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
1497
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
1498
|
+
interval: z.ZodEnum<{
|
|
1499
|
+
one_off: "one_off";
|
|
1500
|
+
minute: "minute";
|
|
1501
|
+
hour: "hour";
|
|
1502
|
+
day: "day";
|
|
1503
|
+
week: "week";
|
|
1504
|
+
month: "month";
|
|
1505
|
+
quarter: "quarter";
|
|
1506
|
+
semi_annual: "semi_annual";
|
|
1507
|
+
year: "year";
|
|
1508
|
+
}>;
|
|
1509
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1510
|
+
}, z.core.$strip>>;
|
|
1511
|
+
expires_at: z.ZodOptional<z.ZodNumber>;
|
|
1512
|
+
}, z.core.$strip>;
|
|
1513
|
+
type CreateBalanceParams = z.infer<typeof CreateBalanceParamsSchema>;
|
|
1514
|
+
type CreateBalanceResponse = {
|
|
1515
|
+
message: string;
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
declare const BillingIntervalSchema: z.ZodEnum<{
|
|
1519
|
+
one_off: "one_off";
|
|
1520
|
+
week: "week";
|
|
1521
|
+
month: "month";
|
|
1522
|
+
quarter: "quarter";
|
|
1523
|
+
semi_annual: "semi_annual";
|
|
1524
|
+
year: "year";
|
|
1525
|
+
}>;
|
|
1526
|
+
type BillingInterval = z.infer<typeof BillingIntervalSchema>;
|
|
1527
|
+
declare const BillingMethodSchema: z.ZodEnum<{
|
|
1528
|
+
prepaid: "prepaid";
|
|
1529
|
+
usage_based: "usage_based";
|
|
1530
|
+
}>;
|
|
1531
|
+
type BillingMethod = z.infer<typeof BillingMethodSchema>;
|
|
1532
|
+
declare const OnIncreaseSchema: z.ZodEnum<{
|
|
1533
|
+
bill_immediately: "bill_immediately";
|
|
1534
|
+
prorate_immediately: "prorate_immediately";
|
|
1535
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1536
|
+
bill_next_cycle: "bill_next_cycle";
|
|
1537
|
+
}>;
|
|
1538
|
+
type OnIncrease = z.infer<typeof OnIncreaseSchema>;
|
|
1539
|
+
declare const OnDecreaseSchema: z.ZodEnum<{
|
|
1540
|
+
prorate: "prorate";
|
|
1541
|
+
prorate_immediately: "prorate_immediately";
|
|
1542
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1543
|
+
none: "none";
|
|
1544
|
+
no_prorations: "no_prorations";
|
|
1545
|
+
}>;
|
|
1546
|
+
type OnDecrease = z.infer<typeof OnDecreaseSchema>;
|
|
1547
|
+
declare const RolloverExpiryDurationTypeSchema: z.ZodEnum<{
|
|
1548
|
+
month: "month";
|
|
1549
|
+
forever: "forever";
|
|
1550
|
+
}>;
|
|
1551
|
+
type RolloverExpiryDurationType = z.infer<typeof RolloverExpiryDurationTypeSchema>;
|
|
1552
|
+
declare const FeatureQuantityParamsSchema: z.ZodObject<{
|
|
1553
|
+
feature_id: z.ZodString;
|
|
1554
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
1555
|
+
adjustable: z.ZodOptional<z.ZodBoolean>;
|
|
1556
|
+
}, z.core.$strip>;
|
|
1557
|
+
type FeatureQuantityParams = z.infer<typeof FeatureQuantityParamsSchema>;
|
|
1558
|
+
declare const FreeTrialParamsSchema: z.ZodObject<{
|
|
1559
|
+
duration_length: z.ZodNumber;
|
|
1560
|
+
duration_type: z.ZodDefault<z.ZodEnum<{
|
|
1561
|
+
day: "day";
|
|
1562
|
+
month: "month";
|
|
1563
|
+
year: "year";
|
|
1564
|
+
}>>;
|
|
1565
|
+
card_required: z.ZodDefault<z.ZodBoolean>;
|
|
1566
|
+
}, z.core.$strip>;
|
|
1567
|
+
type FreeTrialParams = z.infer<typeof FreeTrialParamsSchema>;
|
|
1568
|
+
declare const AttachDiscountSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
1569
|
+
reward_id: z.ZodString;
|
|
1570
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1571
|
+
promotion_code: z.ZodString;
|
|
1572
|
+
}, z.core.$strip>]>;
|
|
1573
|
+
type AttachDiscount = z.infer<typeof AttachDiscountSchema>;
|
|
1574
|
+
declare const InvoiceModeParamsSchema: z.ZodObject<{
|
|
1575
|
+
enabled: z.ZodBoolean;
|
|
1576
|
+
enable_plan_immediately: z.ZodDefault<z.ZodBoolean>;
|
|
1577
|
+
finalize: z.ZodDefault<z.ZodBoolean>;
|
|
1578
|
+
}, z.core.$strip>;
|
|
1579
|
+
type InvoiceModeParams = z.infer<typeof InvoiceModeParamsSchema>;
|
|
1580
|
+
declare const ProrationBehaviorSchema: z.ZodEnum<{
|
|
1581
|
+
prorate_immediately: "prorate_immediately";
|
|
1582
|
+
none: "none";
|
|
1583
|
+
}>;
|
|
1584
|
+
type ProrationBehavior = z.infer<typeof ProrationBehaviorSchema>;
|
|
1585
|
+
declare const RedirectModeSchema: z.ZodEnum<{
|
|
1586
|
+
never: "never";
|
|
1587
|
+
always: "always";
|
|
1588
|
+
if_required: "if_required";
|
|
1589
|
+
}>;
|
|
1590
|
+
type RedirectMode = z.infer<typeof RedirectModeSchema>;
|
|
1591
|
+
declare const PlanScheduleSchema: z.ZodEnum<{
|
|
1592
|
+
immediate: "immediate";
|
|
1593
|
+
end_of_cycle: "end_of_cycle";
|
|
1594
|
+
}>;
|
|
1595
|
+
type PlanSchedule = z.infer<typeof PlanScheduleSchema>;
|
|
1596
|
+
declare const CancelActionSchema: z.ZodEnum<{
|
|
1597
|
+
cancel_immediately: "cancel_immediately";
|
|
1598
|
+
cancel_end_of_cycle: "cancel_end_of_cycle";
|
|
1599
|
+
uncancel: "uncancel";
|
|
1600
|
+
}>;
|
|
1601
|
+
type CancelAction = z.infer<typeof CancelActionSchema>;
|
|
1602
|
+
declare const UsageTierSchema: z.ZodObject<{
|
|
1603
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
1604
|
+
amount: z.ZodNumber;
|
|
1605
|
+
}, z.core.$strip>;
|
|
1606
|
+
type UsageTier = z.infer<typeof UsageTierSchema>;
|
|
1607
|
+
declare const BasePriceParamsSchema: z.ZodObject<{
|
|
1608
|
+
amount: z.ZodNumber;
|
|
1609
|
+
interval: z.ZodEnum<{
|
|
1610
|
+
one_off: "one_off";
|
|
1611
|
+
week: "week";
|
|
1612
|
+
month: "month";
|
|
1613
|
+
quarter: "quarter";
|
|
1614
|
+
semi_annual: "semi_annual";
|
|
1615
|
+
year: "year";
|
|
1616
|
+
}>;
|
|
1617
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1618
|
+
}, z.core.$strip>;
|
|
1619
|
+
type BasePriceParams = z.infer<typeof BasePriceParamsSchema>;
|
|
1620
|
+
declare const CreatePlanItemParamsSchema: z.ZodObject<{
|
|
1621
|
+
feature_id: z.ZodString;
|
|
1622
|
+
included: z.ZodOptional<z.ZodNumber>;
|
|
1623
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
1624
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
1625
|
+
interval: z.ZodEnum<{
|
|
1626
|
+
one_off: "one_off";
|
|
1627
|
+
minute: "minute";
|
|
1628
|
+
hour: "hour";
|
|
1629
|
+
day: "day";
|
|
1630
|
+
week: "week";
|
|
1631
|
+
month: "month";
|
|
1632
|
+
quarter: "quarter";
|
|
1633
|
+
semi_annual: "semi_annual";
|
|
1634
|
+
year: "year";
|
|
1635
|
+
}>;
|
|
1636
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1637
|
+
}, z.core.$strip>>;
|
|
1638
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
1639
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
1640
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1641
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
1642
|
+
amount: z.ZodNumber;
|
|
1643
|
+
}, z.core.$strip>>>;
|
|
1644
|
+
interval: z.ZodEnum<{
|
|
1645
|
+
one_off: "one_off";
|
|
1646
|
+
week: "week";
|
|
1647
|
+
month: "month";
|
|
1648
|
+
quarter: "quarter";
|
|
1649
|
+
semi_annual: "semi_annual";
|
|
1650
|
+
year: "year";
|
|
1651
|
+
}>;
|
|
1652
|
+
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1653
|
+
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1654
|
+
billing_method: z.ZodEnum<{
|
|
1655
|
+
prepaid: "prepaid";
|
|
1656
|
+
usage_based: "usage_based";
|
|
1657
|
+
}>;
|
|
1658
|
+
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
1659
|
+
}, z.core.$strip>>;
|
|
1660
|
+
proration: z.ZodOptional<z.ZodObject<{
|
|
1661
|
+
on_increase: z.ZodEnum<{
|
|
1662
|
+
bill_immediately: "bill_immediately";
|
|
1663
|
+
prorate_immediately: "prorate_immediately";
|
|
1664
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1665
|
+
bill_next_cycle: "bill_next_cycle";
|
|
1666
|
+
}>;
|
|
1667
|
+
on_decrease: z.ZodEnum<{
|
|
1668
|
+
prorate: "prorate";
|
|
1669
|
+
prorate_immediately: "prorate_immediately";
|
|
1670
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1671
|
+
none: "none";
|
|
1672
|
+
no_prorations: "no_prorations";
|
|
1673
|
+
}>;
|
|
1674
|
+
}, z.core.$strip>>;
|
|
1675
|
+
rollover: z.ZodOptional<z.ZodObject<{
|
|
1676
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
1677
|
+
expiry_duration_type: z.ZodEnum<{
|
|
1678
|
+
month: "month";
|
|
1679
|
+
forever: "forever";
|
|
1680
|
+
}>;
|
|
1681
|
+
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
1682
|
+
}, z.core.$strip>>;
|
|
1683
|
+
}, z.core.$strip>;
|
|
1684
|
+
type CreatePlanItemParams = z.infer<typeof CreatePlanItemParamsSchema>;
|
|
1685
|
+
declare const CustomizePlanSchema: z.ZodObject<{
|
|
1686
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1687
|
+
amount: z.ZodNumber;
|
|
1688
|
+
interval: z.ZodEnum<{
|
|
1689
|
+
one_off: "one_off";
|
|
1690
|
+
week: "week";
|
|
1691
|
+
month: "month";
|
|
1692
|
+
quarter: "quarter";
|
|
1693
|
+
semi_annual: "semi_annual";
|
|
1694
|
+
year: "year";
|
|
1695
|
+
}>;
|
|
1696
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1697
|
+
}, z.core.$strip>>>;
|
|
1698
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1699
|
+
feature_id: z.ZodString;
|
|
1700
|
+
included: z.ZodOptional<z.ZodNumber>;
|
|
1701
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
1702
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
1703
|
+
interval: z.ZodEnum<{
|
|
1704
|
+
one_off: "one_off";
|
|
1705
|
+
minute: "minute";
|
|
1706
|
+
hour: "hour";
|
|
1707
|
+
day: "day";
|
|
1708
|
+
week: "week";
|
|
1709
|
+
month: "month";
|
|
1710
|
+
quarter: "quarter";
|
|
1711
|
+
semi_annual: "semi_annual";
|
|
1712
|
+
year: "year";
|
|
1713
|
+
}>;
|
|
1714
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1715
|
+
}, z.core.$strip>>;
|
|
1716
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
1717
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
1718
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1719
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
1720
|
+
amount: z.ZodNumber;
|
|
1721
|
+
}, z.core.$strip>>>;
|
|
1722
|
+
interval: z.ZodEnum<{
|
|
1723
|
+
one_off: "one_off";
|
|
1724
|
+
week: "week";
|
|
1725
|
+
month: "month";
|
|
1726
|
+
quarter: "quarter";
|
|
1727
|
+
semi_annual: "semi_annual";
|
|
1728
|
+
year: "year";
|
|
1729
|
+
}>;
|
|
1730
|
+
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1731
|
+
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1732
|
+
billing_method: z.ZodEnum<{
|
|
1733
|
+
prepaid: "prepaid";
|
|
1734
|
+
usage_based: "usage_based";
|
|
1735
|
+
}>;
|
|
1736
|
+
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
1737
|
+
}, z.core.$strip>>;
|
|
1738
|
+
proration: z.ZodOptional<z.ZodObject<{
|
|
1739
|
+
on_increase: z.ZodEnum<{
|
|
1740
|
+
bill_immediately: "bill_immediately";
|
|
1741
|
+
prorate_immediately: "prorate_immediately";
|
|
1742
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1743
|
+
bill_next_cycle: "bill_next_cycle";
|
|
1744
|
+
}>;
|
|
1745
|
+
on_decrease: z.ZodEnum<{
|
|
1746
|
+
prorate: "prorate";
|
|
1747
|
+
prorate_immediately: "prorate_immediately";
|
|
1748
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1749
|
+
none: "none";
|
|
1750
|
+
no_prorations: "no_prorations";
|
|
1751
|
+
}>;
|
|
1752
|
+
}, z.core.$strip>>;
|
|
1753
|
+
rollover: z.ZodOptional<z.ZodObject<{
|
|
1754
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
1755
|
+
expiry_duration_type: z.ZodEnum<{
|
|
1756
|
+
month: "month";
|
|
1757
|
+
forever: "forever";
|
|
1758
|
+
}>;
|
|
1759
|
+
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
1760
|
+
}, z.core.$strip>>;
|
|
1761
|
+
}, z.core.$strip>>>;
|
|
1762
|
+
free_trial: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1763
|
+
duration_length: z.ZodNumber;
|
|
1764
|
+
duration_type: z.ZodDefault<z.ZodEnum<{
|
|
1765
|
+
day: "day";
|
|
1766
|
+
month: "month";
|
|
1767
|
+
year: "year";
|
|
1768
|
+
}>>;
|
|
1769
|
+
card_required: z.ZodDefault<z.ZodBoolean>;
|
|
1770
|
+
}, z.core.$strip>>>;
|
|
1771
|
+
}, z.core.$strip>;
|
|
1772
|
+
type CustomizePlan = z.infer<typeof CustomizePlanSchema>;
|
|
1773
|
+
declare const CustomLineItemSchema: z.ZodObject<{
|
|
1774
|
+
amount: z.ZodNumber;
|
|
1775
|
+
description: z.ZodString;
|
|
1776
|
+
}, z.core.$strip>;
|
|
1777
|
+
type CustomLineItem = z.infer<typeof CustomLineItemSchema>;
|
|
1778
|
+
declare const BillingAttachParamsSchema: z.ZodObject<{
|
|
1779
|
+
customer_id: z.ZodString;
|
|
1780
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
1781
|
+
feature_quantities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1782
|
+
feature_id: z.ZodString;
|
|
1783
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
1784
|
+
adjustable: z.ZodOptional<z.ZodBoolean>;
|
|
1785
|
+
}, z.core.$strip>>>;
|
|
1786
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
1787
|
+
customize: z.ZodOptional<z.ZodObject<{
|
|
1788
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1789
|
+
amount: z.ZodNumber;
|
|
1790
|
+
interval: z.ZodEnum<{
|
|
1791
|
+
one_off: "one_off";
|
|
1792
|
+
week: "week";
|
|
1793
|
+
month: "month";
|
|
1794
|
+
quarter: "quarter";
|
|
1795
|
+
semi_annual: "semi_annual";
|
|
1796
|
+
year: "year";
|
|
1797
|
+
}>;
|
|
1798
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1799
|
+
}, z.core.$strip>>>;
|
|
1800
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1801
|
+
feature_id: z.ZodString;
|
|
1802
|
+
included: z.ZodOptional<z.ZodNumber>;
|
|
1803
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
1804
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
1805
|
+
interval: z.ZodEnum<{
|
|
1806
|
+
one_off: "one_off";
|
|
1807
|
+
minute: "minute";
|
|
1808
|
+
hour: "hour";
|
|
1809
|
+
day: "day";
|
|
1810
|
+
week: "week";
|
|
1811
|
+
month: "month";
|
|
1812
|
+
quarter: "quarter";
|
|
1813
|
+
semi_annual: "semi_annual";
|
|
1814
|
+
year: "year";
|
|
1815
|
+
}>;
|
|
1816
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1817
|
+
}, z.core.$strip>>;
|
|
1818
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
1819
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
1820
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1821
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
1822
|
+
amount: z.ZodNumber;
|
|
1823
|
+
}, z.core.$strip>>>;
|
|
1824
|
+
interval: z.ZodEnum<{
|
|
1825
|
+
one_off: "one_off";
|
|
1826
|
+
week: "week";
|
|
1827
|
+
month: "month";
|
|
1828
|
+
quarter: "quarter";
|
|
1829
|
+
semi_annual: "semi_annual";
|
|
1830
|
+
year: "year";
|
|
1831
|
+
}>;
|
|
1832
|
+
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1833
|
+
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1834
|
+
billing_method: z.ZodEnum<{
|
|
1835
|
+
prepaid: "prepaid";
|
|
1836
|
+
usage_based: "usage_based";
|
|
1837
|
+
}>;
|
|
1838
|
+
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
1839
|
+
}, z.core.$strip>>;
|
|
1840
|
+
proration: z.ZodOptional<z.ZodObject<{
|
|
1841
|
+
on_increase: z.ZodEnum<{
|
|
1842
|
+
bill_immediately: "bill_immediately";
|
|
1843
|
+
prorate_immediately: "prorate_immediately";
|
|
1844
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1845
|
+
bill_next_cycle: "bill_next_cycle";
|
|
1846
|
+
}>;
|
|
1847
|
+
on_decrease: z.ZodEnum<{
|
|
1848
|
+
prorate: "prorate";
|
|
1849
|
+
prorate_immediately: "prorate_immediately";
|
|
1850
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1851
|
+
none: "none";
|
|
1852
|
+
no_prorations: "no_prorations";
|
|
1853
|
+
}>;
|
|
1854
|
+
}, z.core.$strip>>;
|
|
1855
|
+
rollover: z.ZodOptional<z.ZodObject<{
|
|
1856
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
1857
|
+
expiry_duration_type: z.ZodEnum<{
|
|
1858
|
+
month: "month";
|
|
1859
|
+
forever: "forever";
|
|
1860
|
+
}>;
|
|
1861
|
+
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
1862
|
+
}, z.core.$strip>>;
|
|
1863
|
+
}, z.core.$strip>>>;
|
|
1864
|
+
free_trial: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1865
|
+
duration_length: z.ZodNumber;
|
|
1866
|
+
duration_type: z.ZodDefault<z.ZodEnum<{
|
|
1867
|
+
day: "day";
|
|
1868
|
+
month: "month";
|
|
1869
|
+
year: "year";
|
|
1870
|
+
}>>;
|
|
1871
|
+
card_required: z.ZodDefault<z.ZodBoolean>;
|
|
1872
|
+
}, z.core.$strip>>>;
|
|
1873
|
+
}, z.core.$strip>>;
|
|
1874
|
+
invoice_mode: z.ZodOptional<z.ZodObject<{
|
|
1875
|
+
enabled: z.ZodBoolean;
|
|
1876
|
+
enable_plan_immediately: z.ZodDefault<z.ZodBoolean>;
|
|
1877
|
+
finalize: z.ZodDefault<z.ZodBoolean>;
|
|
1878
|
+
}, z.core.$strip>>;
|
|
1879
|
+
proration_behavior: z.ZodOptional<z.ZodEnum<{
|
|
1880
|
+
prorate_immediately: "prorate_immediately";
|
|
1881
|
+
none: "none";
|
|
1882
|
+
}>>;
|
|
1883
|
+
subscription_id: z.ZodOptional<z.ZodString>;
|
|
1884
|
+
plan_id: z.ZodString;
|
|
1885
|
+
discounts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1886
|
+
reward_id: z.ZodString;
|
|
1887
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1888
|
+
promotion_code: z.ZodString;
|
|
1889
|
+
}, z.core.$strip>]>>>;
|
|
1890
|
+
success_url: z.ZodOptional<z.ZodString>;
|
|
1891
|
+
redirect_mode: z.ZodOptional<z.ZodEnum<{
|
|
1892
|
+
never: "never";
|
|
1893
|
+
always: "always";
|
|
1894
|
+
if_required: "if_required";
|
|
1895
|
+
}>>;
|
|
1896
|
+
new_billing_subscription: z.ZodOptional<z.ZodBoolean>;
|
|
1897
|
+
plan_schedule: z.ZodOptional<z.ZodEnum<{
|
|
1898
|
+
immediate: "immediate";
|
|
1899
|
+
end_of_cycle: "end_of_cycle";
|
|
1900
|
+
}>>;
|
|
1901
|
+
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1902
|
+
custom_line_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1903
|
+
amount: z.ZodNumber;
|
|
1904
|
+
description: z.ZodString;
|
|
1905
|
+
}, z.core.$strip>>>;
|
|
1906
|
+
}, z.core.$strip>;
|
|
1907
|
+
type BillingAttachParams = z.infer<typeof BillingAttachParamsSchema>;
|
|
1908
|
+
declare const BillingUpdateParamsSchema: z.ZodObject<{
|
|
1909
|
+
customer_id: z.ZodString;
|
|
1910
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
1911
|
+
feature_quantities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1912
|
+
feature_id: z.ZodString;
|
|
1913
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
1914
|
+
adjustable: z.ZodOptional<z.ZodBoolean>;
|
|
1915
|
+
}, z.core.$strip>>>;
|
|
1916
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
1917
|
+
customize: z.ZodOptional<z.ZodObject<{
|
|
1918
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1919
|
+
amount: z.ZodNumber;
|
|
1920
|
+
interval: z.ZodEnum<{
|
|
1921
|
+
one_off: "one_off";
|
|
1922
|
+
week: "week";
|
|
1923
|
+
month: "month";
|
|
1924
|
+
quarter: "quarter";
|
|
1925
|
+
semi_annual: "semi_annual";
|
|
1926
|
+
year: "year";
|
|
1927
|
+
}>;
|
|
1928
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1929
|
+
}, z.core.$strip>>>;
|
|
1930
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1931
|
+
feature_id: z.ZodString;
|
|
1932
|
+
included: z.ZodOptional<z.ZodNumber>;
|
|
1933
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
1934
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
1935
|
+
interval: z.ZodEnum<{
|
|
1936
|
+
one_off: "one_off";
|
|
1937
|
+
minute: "minute";
|
|
1938
|
+
hour: "hour";
|
|
1939
|
+
day: "day";
|
|
1940
|
+
week: "week";
|
|
1941
|
+
month: "month";
|
|
1942
|
+
quarter: "quarter";
|
|
1943
|
+
semi_annual: "semi_annual";
|
|
1944
|
+
year: "year";
|
|
1945
|
+
}>;
|
|
1946
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
1947
|
+
}, z.core.$strip>>;
|
|
1948
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
1949
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
1950
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1951
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
1952
|
+
amount: z.ZodNumber;
|
|
1953
|
+
}, z.core.$strip>>>;
|
|
1954
|
+
interval: z.ZodEnum<{
|
|
1955
|
+
one_off: "one_off";
|
|
1956
|
+
week: "week";
|
|
1957
|
+
month: "month";
|
|
1958
|
+
quarter: "quarter";
|
|
1959
|
+
semi_annual: "semi_annual";
|
|
1960
|
+
year: "year";
|
|
1961
|
+
}>;
|
|
1962
|
+
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1963
|
+
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1964
|
+
billing_method: z.ZodEnum<{
|
|
1965
|
+
prepaid: "prepaid";
|
|
1966
|
+
usage_based: "usage_based";
|
|
1967
|
+
}>;
|
|
1968
|
+
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
1969
|
+
}, z.core.$strip>>;
|
|
1970
|
+
proration: z.ZodOptional<z.ZodObject<{
|
|
1971
|
+
on_increase: z.ZodEnum<{
|
|
1972
|
+
bill_immediately: "bill_immediately";
|
|
1973
|
+
prorate_immediately: "prorate_immediately";
|
|
1974
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1975
|
+
bill_next_cycle: "bill_next_cycle";
|
|
1976
|
+
}>;
|
|
1977
|
+
on_decrease: z.ZodEnum<{
|
|
1978
|
+
prorate: "prorate";
|
|
1979
|
+
prorate_immediately: "prorate_immediately";
|
|
1980
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
1981
|
+
none: "none";
|
|
1982
|
+
no_prorations: "no_prorations";
|
|
1983
|
+
}>;
|
|
1984
|
+
}, z.core.$strip>>;
|
|
1985
|
+
rollover: z.ZodOptional<z.ZodObject<{
|
|
1986
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
1987
|
+
expiry_duration_type: z.ZodEnum<{
|
|
1988
|
+
month: "month";
|
|
1989
|
+
forever: "forever";
|
|
1990
|
+
}>;
|
|
1991
|
+
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
1992
|
+
}, z.core.$strip>>;
|
|
1993
|
+
}, z.core.$strip>>>;
|
|
1994
|
+
free_trial: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1995
|
+
duration_length: z.ZodNumber;
|
|
1996
|
+
duration_type: z.ZodDefault<z.ZodEnum<{
|
|
1997
|
+
day: "day";
|
|
1998
|
+
month: "month";
|
|
1999
|
+
year: "year";
|
|
2000
|
+
}>>;
|
|
2001
|
+
card_required: z.ZodDefault<z.ZodBoolean>;
|
|
2002
|
+
}, z.core.$strip>>>;
|
|
2003
|
+
}, z.core.$strip>>;
|
|
2004
|
+
invoice_mode: z.ZodOptional<z.ZodObject<{
|
|
2005
|
+
enabled: z.ZodBoolean;
|
|
2006
|
+
enable_plan_immediately: z.ZodDefault<z.ZodBoolean>;
|
|
2007
|
+
finalize: z.ZodDefault<z.ZodBoolean>;
|
|
2008
|
+
}, z.core.$strip>>;
|
|
2009
|
+
proration_behavior: z.ZodOptional<z.ZodEnum<{
|
|
2010
|
+
prorate_immediately: "prorate_immediately";
|
|
2011
|
+
none: "none";
|
|
2012
|
+
}>>;
|
|
2013
|
+
subscription_id: z.ZodOptional<z.ZodString>;
|
|
2014
|
+
plan_id: z.ZodOptional<z.ZodString>;
|
|
2015
|
+
cancel_action: z.ZodOptional<z.ZodEnum<{
|
|
2016
|
+
cancel_immediately: "cancel_immediately";
|
|
2017
|
+
cancel_end_of_cycle: "cancel_end_of_cycle";
|
|
2018
|
+
uncancel: "uncancel";
|
|
2019
|
+
}>>;
|
|
2020
|
+
}, z.core.$strip>;
|
|
2021
|
+
type BillingUpdateParams = z.infer<typeof BillingUpdateParamsSchema>;
|
|
2022
|
+
declare const PaymentFailureCodeSchema: z.ZodEnum<{
|
|
2023
|
+
"3ds_required": "3ds_required";
|
|
2024
|
+
payment_method_required: "payment_method_required";
|
|
2025
|
+
payment_failed: "payment_failed";
|
|
2026
|
+
}>;
|
|
2027
|
+
type PaymentFailureCode = z.infer<typeof PaymentFailureCodeSchema>;
|
|
2028
|
+
declare const BillingRequiredActionSchema: z.ZodObject<{
|
|
2029
|
+
code: z.ZodEnum<{
|
|
2030
|
+
"3ds_required": "3ds_required";
|
|
2031
|
+
payment_method_required: "payment_method_required";
|
|
2032
|
+
payment_failed: "payment_failed";
|
|
2033
|
+
}>;
|
|
2034
|
+
reason: z.ZodString;
|
|
2035
|
+
}, z.core.$strip>;
|
|
2036
|
+
type BillingRequiredAction = z.infer<typeof BillingRequiredActionSchema>;
|
|
2037
|
+
declare const BillingResponseSchema: z.ZodObject<{
|
|
2038
|
+
customer_id: z.ZodString;
|
|
2039
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
2040
|
+
invoice: z.ZodOptional<z.ZodObject<{
|
|
2041
|
+
status: z.ZodNullable<z.ZodString>;
|
|
2042
|
+
stripe_id: z.ZodString;
|
|
2043
|
+
total: z.ZodNumber;
|
|
2044
|
+
currency: z.ZodString;
|
|
2045
|
+
hosted_invoice_url: z.ZodNullable<z.ZodString>;
|
|
2046
|
+
}, z.core.$strip>>;
|
|
2047
|
+
payment_url: z.ZodNullable<z.ZodString>;
|
|
2048
|
+
required_action: z.ZodOptional<z.ZodObject<{
|
|
2049
|
+
code: z.ZodEnum<{
|
|
2050
|
+
"3ds_required": "3ds_required";
|
|
2051
|
+
payment_method_required: "payment_method_required";
|
|
2052
|
+
payment_failed: "payment_failed";
|
|
2053
|
+
}>;
|
|
2054
|
+
reason: z.ZodString;
|
|
2055
|
+
}, z.core.$strip>>;
|
|
2056
|
+
}, z.core.$strip>;
|
|
2057
|
+
type BillingResponse = z.infer<typeof BillingResponseSchema>;
|
|
2058
|
+
declare const MultiAttachCustomizePlanSchema: z.ZodObject<{
|
|
2059
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2060
|
+
amount: z.ZodNumber;
|
|
2061
|
+
interval: z.ZodEnum<{
|
|
2062
|
+
one_off: "one_off";
|
|
2063
|
+
week: "week";
|
|
2064
|
+
month: "month";
|
|
2065
|
+
quarter: "quarter";
|
|
2066
|
+
semi_annual: "semi_annual";
|
|
2067
|
+
year: "year";
|
|
2068
|
+
}>;
|
|
2069
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
2070
|
+
}, z.core.$strip>>>;
|
|
2071
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2072
|
+
feature_id: z.ZodString;
|
|
2073
|
+
included: z.ZodOptional<z.ZodNumber>;
|
|
2074
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
2075
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
2076
|
+
interval: z.ZodEnum<{
|
|
2077
|
+
one_off: "one_off";
|
|
2078
|
+
minute: "minute";
|
|
2079
|
+
hour: "hour";
|
|
2080
|
+
day: "day";
|
|
2081
|
+
week: "week";
|
|
2082
|
+
month: "month";
|
|
2083
|
+
quarter: "quarter";
|
|
2084
|
+
semi_annual: "semi_annual";
|
|
2085
|
+
year: "year";
|
|
2086
|
+
}>;
|
|
2087
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
2088
|
+
}, z.core.$strip>>;
|
|
2089
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
2090
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
2091
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2092
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
2093
|
+
amount: z.ZodNumber;
|
|
2094
|
+
}, z.core.$strip>>>;
|
|
2095
|
+
interval: z.ZodEnum<{
|
|
2096
|
+
one_off: "one_off";
|
|
2097
|
+
week: "week";
|
|
2098
|
+
month: "month";
|
|
2099
|
+
quarter: "quarter";
|
|
2100
|
+
semi_annual: "semi_annual";
|
|
2101
|
+
year: "year";
|
|
2102
|
+
}>;
|
|
2103
|
+
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2104
|
+
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2105
|
+
billing_method: z.ZodEnum<{
|
|
2106
|
+
prepaid: "prepaid";
|
|
2107
|
+
usage_based: "usage_based";
|
|
2108
|
+
}>;
|
|
2109
|
+
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
2110
|
+
}, z.core.$strip>>;
|
|
2111
|
+
proration: z.ZodOptional<z.ZodObject<{
|
|
2112
|
+
on_increase: z.ZodEnum<{
|
|
2113
|
+
bill_immediately: "bill_immediately";
|
|
2114
|
+
prorate_immediately: "prorate_immediately";
|
|
2115
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
2116
|
+
bill_next_cycle: "bill_next_cycle";
|
|
2117
|
+
}>;
|
|
2118
|
+
on_decrease: z.ZodEnum<{
|
|
2119
|
+
prorate: "prorate";
|
|
2120
|
+
prorate_immediately: "prorate_immediately";
|
|
2121
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
2122
|
+
none: "none";
|
|
2123
|
+
no_prorations: "no_prorations";
|
|
2124
|
+
}>;
|
|
2125
|
+
}, z.core.$strip>>;
|
|
2126
|
+
rollover: z.ZodOptional<z.ZodObject<{
|
|
2127
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
2128
|
+
expiry_duration_type: z.ZodEnum<{
|
|
2129
|
+
month: "month";
|
|
2130
|
+
forever: "forever";
|
|
2131
|
+
}>;
|
|
2132
|
+
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
2133
|
+
}, z.core.$strip>>;
|
|
2134
|
+
}, z.core.$strip>>>;
|
|
2135
|
+
}, z.core.$strip>;
|
|
2136
|
+
type MultiAttachCustomizePlan = z.infer<typeof MultiAttachCustomizePlanSchema>;
|
|
2137
|
+
declare const MultiAttachPlanSchema: z.ZodObject<{
|
|
2138
|
+
plan_id: z.ZodString;
|
|
2139
|
+
customize: z.ZodOptional<z.ZodObject<{
|
|
2140
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2141
|
+
amount: z.ZodNumber;
|
|
2142
|
+
interval: z.ZodEnum<{
|
|
2143
|
+
one_off: "one_off";
|
|
2144
|
+
week: "week";
|
|
2145
|
+
month: "month";
|
|
2146
|
+
quarter: "quarter";
|
|
2147
|
+
semi_annual: "semi_annual";
|
|
2148
|
+
year: "year";
|
|
2149
|
+
}>;
|
|
2150
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
2151
|
+
}, z.core.$strip>>>;
|
|
2152
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2153
|
+
feature_id: z.ZodString;
|
|
2154
|
+
included: z.ZodOptional<z.ZodNumber>;
|
|
2155
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
2156
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
2157
|
+
interval: z.ZodEnum<{
|
|
2158
|
+
one_off: "one_off";
|
|
2159
|
+
minute: "minute";
|
|
2160
|
+
hour: "hour";
|
|
2161
|
+
day: "day";
|
|
2162
|
+
week: "week";
|
|
2163
|
+
month: "month";
|
|
2164
|
+
quarter: "quarter";
|
|
2165
|
+
semi_annual: "semi_annual";
|
|
2166
|
+
year: "year";
|
|
2167
|
+
}>;
|
|
2168
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
2169
|
+
}, z.core.$strip>>;
|
|
2170
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
2171
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
2172
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2173
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
2174
|
+
amount: z.ZodNumber;
|
|
2175
|
+
}, z.core.$strip>>>;
|
|
2176
|
+
interval: z.ZodEnum<{
|
|
2177
|
+
one_off: "one_off";
|
|
2178
|
+
week: "week";
|
|
2179
|
+
month: "month";
|
|
2180
|
+
quarter: "quarter";
|
|
2181
|
+
semi_annual: "semi_annual";
|
|
2182
|
+
year: "year";
|
|
2183
|
+
}>;
|
|
2184
|
+
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2185
|
+
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2186
|
+
billing_method: z.ZodEnum<{
|
|
2187
|
+
prepaid: "prepaid";
|
|
2188
|
+
usage_based: "usage_based";
|
|
2189
|
+
}>;
|
|
2190
|
+
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
2191
|
+
}, z.core.$strip>>;
|
|
2192
|
+
proration: z.ZodOptional<z.ZodObject<{
|
|
2193
|
+
on_increase: z.ZodEnum<{
|
|
2194
|
+
bill_immediately: "bill_immediately";
|
|
2195
|
+
prorate_immediately: "prorate_immediately";
|
|
2196
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
2197
|
+
bill_next_cycle: "bill_next_cycle";
|
|
2198
|
+
}>;
|
|
2199
|
+
on_decrease: z.ZodEnum<{
|
|
2200
|
+
prorate: "prorate";
|
|
2201
|
+
prorate_immediately: "prorate_immediately";
|
|
2202
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
2203
|
+
none: "none";
|
|
2204
|
+
no_prorations: "no_prorations";
|
|
2205
|
+
}>;
|
|
2206
|
+
}, z.core.$strip>>;
|
|
2207
|
+
rollover: z.ZodOptional<z.ZodObject<{
|
|
2208
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
2209
|
+
expiry_duration_type: z.ZodEnum<{
|
|
2210
|
+
month: "month";
|
|
2211
|
+
forever: "forever";
|
|
2212
|
+
}>;
|
|
2213
|
+
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
2214
|
+
}, z.core.$strip>>;
|
|
2215
|
+
}, z.core.$strip>>>;
|
|
2216
|
+
}, z.core.$strip>>;
|
|
2217
|
+
feature_quantities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2218
|
+
feature_id: z.ZodString;
|
|
2219
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
2220
|
+
adjustable: z.ZodOptional<z.ZodBoolean>;
|
|
2221
|
+
}, z.core.$strip>>>;
|
|
2222
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
2223
|
+
subscription_id: z.ZodOptional<z.ZodString>;
|
|
2224
|
+
}, z.core.$strip>;
|
|
2225
|
+
type MultiAttachPlan = z.infer<typeof MultiAttachPlanSchema>;
|
|
2226
|
+
declare const MultiAttachParamsSchema: z.ZodObject<{
|
|
2227
|
+
customer_id: z.ZodString;
|
|
2228
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
2229
|
+
plans: z.ZodArray<z.ZodObject<{
|
|
2230
|
+
plan_id: z.ZodString;
|
|
2231
|
+
customize: z.ZodOptional<z.ZodObject<{
|
|
2232
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2233
|
+
amount: z.ZodNumber;
|
|
2234
|
+
interval: z.ZodEnum<{
|
|
2235
|
+
one_off: "one_off";
|
|
2236
|
+
week: "week";
|
|
2237
|
+
month: "month";
|
|
2238
|
+
quarter: "quarter";
|
|
2239
|
+
semi_annual: "semi_annual";
|
|
2240
|
+
year: "year";
|
|
2241
|
+
}>;
|
|
2242
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
2243
|
+
}, z.core.$strip>>>;
|
|
2244
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2245
|
+
feature_id: z.ZodString;
|
|
2246
|
+
included: z.ZodOptional<z.ZodNumber>;
|
|
2247
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
2248
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
2249
|
+
interval: z.ZodEnum<{
|
|
2250
|
+
one_off: "one_off";
|
|
2251
|
+
minute: "minute";
|
|
2252
|
+
hour: "hour";
|
|
2253
|
+
day: "day";
|
|
2254
|
+
week: "week";
|
|
2255
|
+
month: "month";
|
|
2256
|
+
quarter: "quarter";
|
|
2257
|
+
semi_annual: "semi_annual";
|
|
2258
|
+
year: "year";
|
|
2259
|
+
}>;
|
|
2260
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
2261
|
+
}, z.core.$strip>>;
|
|
2262
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
2263
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
2264
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2265
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
2266
|
+
amount: z.ZodNumber;
|
|
2267
|
+
}, z.core.$strip>>>;
|
|
2268
|
+
interval: z.ZodEnum<{
|
|
2269
|
+
one_off: "one_off";
|
|
2270
|
+
week: "week";
|
|
2271
|
+
month: "month";
|
|
2272
|
+
quarter: "quarter";
|
|
2273
|
+
semi_annual: "semi_annual";
|
|
2274
|
+
year: "year";
|
|
2275
|
+
}>;
|
|
2276
|
+
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2277
|
+
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2278
|
+
billing_method: z.ZodEnum<{
|
|
2279
|
+
prepaid: "prepaid";
|
|
2280
|
+
usage_based: "usage_based";
|
|
2281
|
+
}>;
|
|
2282
|
+
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
2283
|
+
}, z.core.$strip>>;
|
|
2284
|
+
proration: z.ZodOptional<z.ZodObject<{
|
|
2285
|
+
on_increase: z.ZodEnum<{
|
|
2286
|
+
bill_immediately: "bill_immediately";
|
|
2287
|
+
prorate_immediately: "prorate_immediately";
|
|
2288
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
2289
|
+
bill_next_cycle: "bill_next_cycle";
|
|
2290
|
+
}>;
|
|
2291
|
+
on_decrease: z.ZodEnum<{
|
|
2292
|
+
prorate: "prorate";
|
|
2293
|
+
prorate_immediately: "prorate_immediately";
|
|
2294
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
2295
|
+
none: "none";
|
|
2296
|
+
no_prorations: "no_prorations";
|
|
2297
|
+
}>;
|
|
2298
|
+
}, z.core.$strip>>;
|
|
2299
|
+
rollover: z.ZodOptional<z.ZodObject<{
|
|
2300
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
2301
|
+
expiry_duration_type: z.ZodEnum<{
|
|
2302
|
+
month: "month";
|
|
2303
|
+
forever: "forever";
|
|
2304
|
+
}>;
|
|
2305
|
+
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
2306
|
+
}, z.core.$strip>>;
|
|
2307
|
+
}, z.core.$strip>>>;
|
|
2308
|
+
}, z.core.$strip>>;
|
|
2309
|
+
feature_quantities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2310
|
+
feature_id: z.ZodString;
|
|
2311
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
2312
|
+
adjustable: z.ZodOptional<z.ZodBoolean>;
|
|
2313
|
+
}, z.core.$strip>>>;
|
|
2314
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
2315
|
+
subscription_id: z.ZodOptional<z.ZodString>;
|
|
2316
|
+
}, z.core.$strip>>;
|
|
2317
|
+
free_trial: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2318
|
+
duration_length: z.ZodNumber;
|
|
2319
|
+
duration_type: z.ZodDefault<z.ZodEnum<{
|
|
2320
|
+
day: "day";
|
|
2321
|
+
month: "month";
|
|
2322
|
+
year: "year";
|
|
2323
|
+
}>>;
|
|
2324
|
+
card_required: z.ZodDefault<z.ZodBoolean>;
|
|
2325
|
+
}, z.core.$strip>>>;
|
|
2326
|
+
invoice_mode: z.ZodOptional<z.ZodObject<{
|
|
2327
|
+
enabled: z.ZodBoolean;
|
|
2328
|
+
enable_plan_immediately: z.ZodDefault<z.ZodBoolean>;
|
|
2329
|
+
finalize: z.ZodDefault<z.ZodBoolean>;
|
|
2330
|
+
}, z.core.$strip>>;
|
|
2331
|
+
discounts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2332
|
+
reward_id: z.ZodString;
|
|
2333
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2334
|
+
promotion_code: z.ZodString;
|
|
2335
|
+
}, z.core.$strip>]>>>;
|
|
2336
|
+
success_url: z.ZodOptional<z.ZodString>;
|
|
2337
|
+
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2338
|
+
redirect_mode: z.ZodOptional<z.ZodEnum<{
|
|
2339
|
+
never: "never";
|
|
2340
|
+
always: "always";
|
|
2341
|
+
if_required: "if_required";
|
|
2342
|
+
}>>;
|
|
2343
|
+
new_billing_subscription: z.ZodOptional<z.ZodBoolean>;
|
|
2344
|
+
}, z.core.$strip>;
|
|
2345
|
+
type MultiAttachParams = z.infer<typeof MultiAttachParamsSchema>;
|
|
2346
|
+
declare const SetupPaymentParamsSchema: z.ZodObject<{
|
|
2347
|
+
customer_id: z.ZodString;
|
|
2348
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
2349
|
+
plan_id: z.ZodOptional<z.ZodString>;
|
|
2350
|
+
feature_quantities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2351
|
+
feature_id: z.ZodString;
|
|
2352
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
2353
|
+
adjustable: z.ZodOptional<z.ZodBoolean>;
|
|
2354
|
+
}, z.core.$strip>>>;
|
|
2355
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
2356
|
+
customize: z.ZodOptional<z.ZodObject<{
|
|
2357
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2358
|
+
amount: z.ZodNumber;
|
|
2359
|
+
interval: z.ZodEnum<{
|
|
2360
|
+
one_off: "one_off";
|
|
2361
|
+
week: "week";
|
|
2362
|
+
month: "month";
|
|
2363
|
+
quarter: "quarter";
|
|
2364
|
+
semi_annual: "semi_annual";
|
|
2365
|
+
year: "year";
|
|
2366
|
+
}>;
|
|
2367
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
2368
|
+
}, z.core.$strip>>>;
|
|
2369
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2370
|
+
feature_id: z.ZodString;
|
|
2371
|
+
included: z.ZodOptional<z.ZodNumber>;
|
|
2372
|
+
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
2373
|
+
reset: z.ZodOptional<z.ZodObject<{
|
|
2374
|
+
interval: z.ZodEnum<{
|
|
2375
|
+
one_off: "one_off";
|
|
2376
|
+
minute: "minute";
|
|
2377
|
+
hour: "hour";
|
|
2378
|
+
day: "day";
|
|
2379
|
+
week: "week";
|
|
2380
|
+
month: "month";
|
|
2381
|
+
quarter: "quarter";
|
|
2382
|
+
semi_annual: "semi_annual";
|
|
2383
|
+
year: "year";
|
|
2384
|
+
}>;
|
|
2385
|
+
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
2386
|
+
}, z.core.$strip>>;
|
|
2387
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
2388
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
2389
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2390
|
+
to: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
2391
|
+
amount: z.ZodNumber;
|
|
2392
|
+
}, z.core.$strip>>>;
|
|
2393
|
+
interval: z.ZodEnum<{
|
|
2394
|
+
one_off: "one_off";
|
|
2395
|
+
week: "week";
|
|
2396
|
+
month: "month";
|
|
2397
|
+
quarter: "quarter";
|
|
2398
|
+
semi_annual: "semi_annual";
|
|
2399
|
+
year: "year";
|
|
2400
|
+
}>;
|
|
2401
|
+
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2402
|
+
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2403
|
+
billing_method: z.ZodEnum<{
|
|
2404
|
+
prepaid: "prepaid";
|
|
2405
|
+
usage_based: "usage_based";
|
|
2406
|
+
}>;
|
|
2407
|
+
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
2408
|
+
}, z.core.$strip>>;
|
|
2409
|
+
proration: z.ZodOptional<z.ZodObject<{
|
|
2410
|
+
on_increase: z.ZodEnum<{
|
|
2411
|
+
bill_immediately: "bill_immediately";
|
|
2412
|
+
prorate_immediately: "prorate_immediately";
|
|
2413
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
2414
|
+
bill_next_cycle: "bill_next_cycle";
|
|
2415
|
+
}>;
|
|
2416
|
+
on_decrease: z.ZodEnum<{
|
|
2417
|
+
prorate: "prorate";
|
|
2418
|
+
prorate_immediately: "prorate_immediately";
|
|
2419
|
+
prorate_next_cycle: "prorate_next_cycle";
|
|
2420
|
+
none: "none";
|
|
2421
|
+
no_prorations: "no_prorations";
|
|
2422
|
+
}>;
|
|
2423
|
+
}, z.core.$strip>>;
|
|
2424
|
+
rollover: z.ZodOptional<z.ZodObject<{
|
|
2425
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
2426
|
+
expiry_duration_type: z.ZodEnum<{
|
|
2427
|
+
month: "month";
|
|
2428
|
+
forever: "forever";
|
|
2429
|
+
}>;
|
|
2430
|
+
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
2431
|
+
}, z.core.$strip>>;
|
|
2432
|
+
}, z.core.$strip>>>;
|
|
2433
|
+
free_trial: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2434
|
+
duration_length: z.ZodNumber;
|
|
2435
|
+
duration_type: z.ZodDefault<z.ZodEnum<{
|
|
2436
|
+
day: "day";
|
|
2437
|
+
month: "month";
|
|
2438
|
+
year: "year";
|
|
2439
|
+
}>>;
|
|
2440
|
+
card_required: z.ZodDefault<z.ZodBoolean>;
|
|
2441
|
+
}, z.core.$strip>>>;
|
|
2442
|
+
}, z.core.$strip>>;
|
|
2443
|
+
discounts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2444
|
+
reward_id: z.ZodString;
|
|
2445
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2446
|
+
promotion_code: z.ZodString;
|
|
2447
|
+
}, z.core.$strip>]>>>;
|
|
2448
|
+
success_url: z.ZodOptional<z.ZodString>;
|
|
2449
|
+
checkout_session_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2450
|
+
}, z.core.$strip>;
|
|
2451
|
+
type SetupPaymentParams = z.infer<typeof SetupPaymentParamsSchema>;
|
|
2452
|
+
declare const SetupPaymentResponseSchema: z.ZodObject<{
|
|
2453
|
+
customer_id: z.ZodString;
|
|
2454
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
2455
|
+
url: z.ZodString;
|
|
2456
|
+
}, z.core.$strip>;
|
|
2457
|
+
type SetupPaymentResponse = z.infer<typeof SetupPaymentResponseSchema>;
|
|
2458
|
+
declare const PreviewLineItemSchema: z.ZodObject<{
|
|
2459
|
+
title: z.ZodString;
|
|
2460
|
+
description: z.ZodString;
|
|
2461
|
+
amount: z.ZodNumber;
|
|
2462
|
+
}, z.core.$strip>;
|
|
2463
|
+
type PreviewLineItem = z.infer<typeof PreviewLineItemSchema>;
|
|
2464
|
+
declare const BillingPreviewResponseSchema: z.ZodObject<{
|
|
2465
|
+
customer_id: z.ZodString;
|
|
2466
|
+
line_items: z.ZodArray<z.ZodObject<{
|
|
2467
|
+
title: z.ZodString;
|
|
2468
|
+
description: z.ZodString;
|
|
2469
|
+
amount: z.ZodNumber;
|
|
2470
|
+
}, z.core.$strip>>;
|
|
2471
|
+
total: z.ZodNumber;
|
|
2472
|
+
currency: z.ZodString;
|
|
2473
|
+
next_cycle: z.ZodOptional<z.ZodObject<{
|
|
2474
|
+
starts_at: z.ZodNumber;
|
|
2475
|
+
total: z.ZodNumber;
|
|
2476
|
+
}, z.core.$strip>>;
|
|
2477
|
+
}, z.core.$strip>;
|
|
2478
|
+
type BillingPreviewResponse = z.infer<typeof BillingPreviewResponseSchema>;
|
|
2479
|
+
|
|
2480
|
+
/**
|
|
2481
|
+
* Creates the v2 billing methods object
|
|
2482
|
+
*/
|
|
2483
|
+
declare const v2BillingMethods: (instance?: Autumn) => {
|
|
2484
|
+
/**
|
|
2485
|
+
* Attaches a plan to a customer, enabling access and handling billing.
|
|
2486
|
+
*
|
|
2487
|
+
* @param params - Attach parameters including customer ID, plan ID, and options
|
|
2488
|
+
* @returns Promise resolving to billing response with checkout URL if needed
|
|
2489
|
+
*
|
|
2490
|
+
* @example
|
|
2491
|
+
* ```typescript
|
|
2492
|
+
* const result = await autumn.v2.billing.attach({
|
|
2493
|
+
* customer_id: "cus_123",
|
|
2494
|
+
* plan_id: "pro_plan",
|
|
2495
|
+
* success_url: "https://myapp.com/success"
|
|
2496
|
+
* });
|
|
2497
|
+
*
|
|
2498
|
+
* if (result.payment_url) {
|
|
2499
|
+
* // Payment required - redirect to checkout
|
|
2500
|
+
* window.location.href = result.payment_url;
|
|
2501
|
+
* }
|
|
2502
|
+
* ```
|
|
2503
|
+
*/
|
|
2504
|
+
attach: (params: BillingAttachParams) => Promise<Result<{
|
|
2505
|
+
customer_id: string;
|
|
2506
|
+
payment_url: string | null;
|
|
2507
|
+
entity_id?: string | undefined;
|
|
2508
|
+
invoice?: {
|
|
2509
|
+
status: string | null;
|
|
2510
|
+
stripe_id: string;
|
|
2511
|
+
total: number;
|
|
2512
|
+
currency: string;
|
|
2513
|
+
hosted_invoice_url: string | null;
|
|
2514
|
+
} | undefined;
|
|
2515
|
+
required_action?: {
|
|
2516
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
2517
|
+
reason: string;
|
|
2518
|
+
} | undefined;
|
|
2519
|
+
}, AutumnError>>;
|
|
2520
|
+
/**
|
|
2521
|
+
* Updates a customer's subscription, handling plan changes and cancellations.
|
|
2522
|
+
*
|
|
2523
|
+
* @param params - Update parameters including customer ID, plan ID, and cancel action
|
|
2524
|
+
* @returns Promise resolving to billing response with invoice details
|
|
2525
|
+
*
|
|
2526
|
+
* @example
|
|
2527
|
+
* ```typescript
|
|
2528
|
+
* // Update to a new plan
|
|
2529
|
+
* const result = await autumn.v2.billing.update({
|
|
2530
|
+
* customer_id: "cus_123",
|
|
2531
|
+
* plan_id: "enterprise_plan",
|
|
2532
|
+
* feature_quantities: [{ feature_id: "seats", quantity: 10 }]
|
|
2533
|
+
* });
|
|
2534
|
+
*
|
|
2535
|
+
* // Cancel at end of billing cycle
|
|
2536
|
+
* const cancelResult = await autumn.v2.billing.update({
|
|
2537
|
+
* customer_id: "cus_123",
|
|
2538
|
+
* plan_id: "pro_plan",
|
|
2539
|
+
* cancel_action: "cancel_end_of_cycle"
|
|
2540
|
+
* });
|
|
2541
|
+
* ```
|
|
2542
|
+
*/
|
|
2543
|
+
update: (params: BillingUpdateParams) => Promise<Result<{
|
|
2544
|
+
customer_id: string;
|
|
2545
|
+
payment_url: string | null;
|
|
2546
|
+
entity_id?: string | undefined;
|
|
2547
|
+
invoice?: {
|
|
2548
|
+
status: string | null;
|
|
2549
|
+
stripe_id: string;
|
|
2550
|
+
total: number;
|
|
2551
|
+
currency: string;
|
|
2552
|
+
hosted_invoice_url: string | null;
|
|
2553
|
+
} | undefined;
|
|
2554
|
+
required_action?: {
|
|
2555
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
2556
|
+
reason: string;
|
|
2557
|
+
} | undefined;
|
|
2558
|
+
}, AutumnError>>;
|
|
2559
|
+
/**
|
|
2560
|
+
* Preview what attaching a plan would cost without actually attaching it.
|
|
2561
|
+
*
|
|
2562
|
+
* @param params - Same parameters as attach
|
|
2563
|
+
* @returns Promise resolving to preview response with line items and totals
|
|
2564
|
+
*
|
|
2565
|
+
* @example
|
|
2566
|
+
* ```typescript
|
|
2567
|
+
* const preview = await autumn.v2.billing.previewAttach({
|
|
2568
|
+
* customer_id: "cus_123",
|
|
2569
|
+
* plan_id: "pro_plan"
|
|
2570
|
+
* });
|
|
2571
|
+
*
|
|
2572
|
+
* console.log(`Total: $${preview.total / 100}`);
|
|
2573
|
+
* preview.line_items.forEach(item => {
|
|
2574
|
+
* console.log(`${item.title}: $${item.amount / 100}`);
|
|
2575
|
+
* });
|
|
2576
|
+
* ```
|
|
2577
|
+
*/
|
|
2578
|
+
previewAttach: (params: BillingAttachParams) => Promise<Result<{
|
|
2579
|
+
customer_id: string;
|
|
2580
|
+
line_items: {
|
|
2581
|
+
title: string;
|
|
2582
|
+
description: string;
|
|
2583
|
+
amount: number;
|
|
2584
|
+
}[];
|
|
2585
|
+
total: number;
|
|
2586
|
+
currency: string;
|
|
2587
|
+
next_cycle?: {
|
|
2588
|
+
starts_at: number;
|
|
2589
|
+
total: number;
|
|
2590
|
+
} | undefined;
|
|
2591
|
+
}, AutumnError>>;
|
|
2592
|
+
/**
|
|
2593
|
+
* Preview what updating a subscription would cost without actually updating it.
|
|
2594
|
+
*
|
|
2595
|
+
* @param params - Same parameters as update
|
|
2596
|
+
* @returns Promise resolving to preview response with line items and totals
|
|
2597
|
+
*
|
|
2598
|
+
* @example
|
|
2599
|
+
* ```typescript
|
|
2600
|
+
* const preview = await autumn.v2.billing.previewUpdate({
|
|
2601
|
+
* customer_id: "cus_123",
|
|
2602
|
+
* plan_id: "enterprise_plan",
|
|
2603
|
+
* feature_quantities: [{ feature_id: "seats", quantity: 20 }]
|
|
2604
|
+
* });
|
|
2605
|
+
*
|
|
2606
|
+
* console.log(`Prorated charge: $${preview.total / 100}`);
|
|
2607
|
+
* ```
|
|
2608
|
+
*/
|
|
2609
|
+
previewUpdate: (params: BillingUpdateParams) => Promise<Result<{
|
|
2610
|
+
customer_id: string;
|
|
2611
|
+
line_items: {
|
|
2612
|
+
title: string;
|
|
2613
|
+
description: string;
|
|
2614
|
+
amount: number;
|
|
2615
|
+
}[];
|
|
2616
|
+
total: number;
|
|
2617
|
+
currency: string;
|
|
2618
|
+
next_cycle?: {
|
|
2619
|
+
starts_at: number;
|
|
2620
|
+
total: number;
|
|
2621
|
+
} | undefined;
|
|
2622
|
+
}, AutumnError>>;
|
|
2623
|
+
/**
|
|
2624
|
+
* Attaches multiple plans to a customer in a single request.
|
|
2625
|
+
*
|
|
2626
|
+
* @param params - Multi-attach parameters including customer ID and array of plans
|
|
2627
|
+
* @returns Promise resolving to billing response with checkout URL if needed
|
|
2628
|
+
*
|
|
2629
|
+
* @example
|
|
2630
|
+
* ```typescript
|
|
2631
|
+
* const result = await autumn.v2.billing.multiAttach({
|
|
2632
|
+
* customer_id: "cus_123",
|
|
2633
|
+
* plans: [
|
|
2634
|
+
* { plan_id: "base_plan" },
|
|
2635
|
+
* { plan_id: "addon_plan", feature_quantities: [{ feature_id: "seats", quantity: 5 }] }
|
|
2636
|
+
* ],
|
|
2637
|
+
* success_url: "https://myapp.com/success"
|
|
2638
|
+
* });
|
|
2639
|
+
* ```
|
|
2640
|
+
*/
|
|
2641
|
+
multiAttach: (params: MultiAttachParams) => Promise<Result<{
|
|
2642
|
+
customer_id: string;
|
|
2643
|
+
payment_url: string | null;
|
|
2644
|
+
entity_id?: string | undefined;
|
|
2645
|
+
invoice?: {
|
|
2646
|
+
status: string | null;
|
|
2647
|
+
stripe_id: string;
|
|
2648
|
+
total: number;
|
|
2649
|
+
currency: string;
|
|
2650
|
+
hosted_invoice_url: string | null;
|
|
2651
|
+
} | undefined;
|
|
2652
|
+
required_action?: {
|
|
2653
|
+
code: "3ds_required" | "payment_method_required" | "payment_failed";
|
|
2654
|
+
reason: string;
|
|
2655
|
+
} | undefined;
|
|
2656
|
+
}, AutumnError>>;
|
|
2657
|
+
/**
|
|
2658
|
+
* Preview what attaching multiple plans would cost without actually attaching them.
|
|
2659
|
+
*
|
|
2660
|
+
* @param params - Same parameters as multiAttach
|
|
2661
|
+
* @returns Promise resolving to preview response with line items and totals
|
|
2662
|
+
*
|
|
2663
|
+
* @example
|
|
2664
|
+
* ```typescript
|
|
2665
|
+
* const preview = await autumn.v2.billing.previewMultiAttach({
|
|
2666
|
+
* customer_id: "cus_123",
|
|
2667
|
+
* plans: [
|
|
2668
|
+
* { plan_id: "base_plan" },
|
|
2669
|
+
* { plan_id: "addon_plan" }
|
|
2670
|
+
* ]
|
|
2671
|
+
* });
|
|
2672
|
+
*
|
|
2673
|
+
* console.log(`Total: $${preview.total / 100}`);
|
|
2674
|
+
* ```
|
|
2675
|
+
*/
|
|
2676
|
+
previewMultiAttach: (params: MultiAttachParams) => Promise<Result<{
|
|
2677
|
+
customer_id: string;
|
|
2678
|
+
line_items: {
|
|
2679
|
+
title: string;
|
|
2680
|
+
description: string;
|
|
2681
|
+
amount: number;
|
|
2682
|
+
}[];
|
|
2683
|
+
total: number;
|
|
2684
|
+
currency: string;
|
|
2685
|
+
next_cycle?: {
|
|
2686
|
+
starts_at: number;
|
|
2687
|
+
total: number;
|
|
2688
|
+
} | undefined;
|
|
2689
|
+
}, AutumnError>>;
|
|
2690
|
+
/**
|
|
2691
|
+
* Sets up a payment method for a customer. Optionally attach a plan after setup.
|
|
2692
|
+
*
|
|
2693
|
+
* @param params - Setup payment parameters including customer ID and optional plan
|
|
2694
|
+
* @returns Promise resolving to setup payment response with redirect URL
|
|
2695
|
+
*
|
|
2696
|
+
* @example
|
|
2697
|
+
* ```typescript
|
|
2698
|
+
* // Just setup payment method
|
|
2699
|
+
* const result = await autumn.v2.billing.setupPayment({
|
|
2700
|
+
* customer_id: "cus_123",
|
|
2701
|
+
* success_url: "https://myapp.com/account"
|
|
2702
|
+
* });
|
|
2703
|
+
*
|
|
2704
|
+
* // Setup payment and attach a plan after
|
|
2705
|
+
* const result = await autumn.v2.billing.setupPayment({
|
|
2706
|
+
* customer_id: "cus_123",
|
|
2707
|
+
* plan_id: "pro_plan",
|
|
2708
|
+
* success_url: "https://myapp.com/success"
|
|
2709
|
+
* });
|
|
2710
|
+
*
|
|
2711
|
+
* // Redirect to Stripe
|
|
2712
|
+
* window.location.href = result.url;
|
|
2713
|
+
* ```
|
|
2714
|
+
*/
|
|
2715
|
+
setupPayment: (params: SetupPaymentParams) => Promise<Result<{
|
|
2716
|
+
customer_id: string;
|
|
2717
|
+
url: string;
|
|
2718
|
+
entity_id?: string | undefined;
|
|
2719
|
+
}, AutumnError>>;
|
|
2720
|
+
};
|
|
2721
|
+
|
|
2722
|
+
declare const V2ResetIntervalSchema: z.ZodEnum<{
|
|
2723
|
+
one_off: "one_off";
|
|
2724
|
+
minute: "minute";
|
|
2725
|
+
hour: "hour";
|
|
2726
|
+
day: "day";
|
|
2727
|
+
week: "week";
|
|
2728
|
+
month: "month";
|
|
2729
|
+
quarter: "quarter";
|
|
2730
|
+
semi_annual: "semi_annual";
|
|
2731
|
+
year: "year";
|
|
2732
|
+
}>;
|
|
2733
|
+
type V2ResetInterval = z.infer<typeof V2ResetIntervalSchema>;
|
|
2734
|
+
declare const V2UpdateBalanceParamsSchema: z.ZodObject<{
|
|
2735
|
+
customer_id: z.ZodString;
|
|
2736
|
+
feature_id: z.ZodString;
|
|
2737
|
+
entity_id: z.ZodOptional<z.ZodString>;
|
|
2738
|
+
remaining: z.ZodOptional<z.ZodNumber>;
|
|
2739
|
+
add_to_balance: z.ZodOptional<z.ZodNumber>;
|
|
2740
|
+
usage: z.ZodOptional<z.ZodNumber>;
|
|
2741
|
+
interval: z.ZodOptional<z.ZodEnum<{
|
|
2742
|
+
one_off: "one_off";
|
|
2743
|
+
minute: "minute";
|
|
2744
|
+
hour: "hour";
|
|
2745
|
+
day: "day";
|
|
2746
|
+
week: "week";
|
|
2747
|
+
month: "month";
|
|
2748
|
+
quarter: "quarter";
|
|
2749
|
+
semi_annual: "semi_annual";
|
|
2750
|
+
year: "year";
|
|
2751
|
+
}>>;
|
|
2752
|
+
included_grant: z.ZodOptional<z.ZodNumber>;
|
|
2753
|
+
balance_id: z.ZodOptional<z.ZodString>;
|
|
2754
|
+
next_reset_at: z.ZodOptional<z.ZodNumber>;
|
|
2755
|
+
}, z.core.$strip>;
|
|
2756
|
+
type V2UpdateBalanceParams = z.infer<typeof V2UpdateBalanceParamsSchema>;
|
|
2757
|
+
declare const V2UpdateBalanceResponseSchema: z.ZodObject<{
|
|
2758
|
+
message: z.ZodString;
|
|
2759
|
+
}, z.core.$strip>;
|
|
2760
|
+
type V2UpdateBalanceResponse = z.infer<typeof V2UpdateBalanceResponseSchema>;
|
|
2761
|
+
declare const V2FinalizeLockActionSchema: z.ZodEnum<{
|
|
2762
|
+
confirm: "confirm";
|
|
2763
|
+
release: "release";
|
|
2764
|
+
}>;
|
|
2765
|
+
type V2FinalizeLockAction = z.infer<typeof V2FinalizeLockActionSchema>;
|
|
2766
|
+
declare const V2FinalizeLockParamsSchema: z.ZodObject<{
|
|
2767
|
+
lock_id: z.ZodString;
|
|
2768
|
+
action: z.ZodEnum<{
|
|
2769
|
+
confirm: "confirm";
|
|
2770
|
+
release: "release";
|
|
2771
|
+
}>;
|
|
2772
|
+
override_value: z.ZodOptional<z.ZodNumber>;
|
|
2773
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2774
|
+
}, z.core.$strip>;
|
|
2775
|
+
type V2FinalizeLockParams = z.infer<typeof V2FinalizeLockParamsSchema>;
|
|
2776
|
+
declare const V2FinalizeLockResponseSchema: z.ZodObject<{
|
|
2777
|
+
success: z.ZodLiteral<true>;
|
|
2778
|
+
}, z.core.$strip>;
|
|
2779
|
+
type V2FinalizeLockResponse = z.infer<typeof V2FinalizeLockResponseSchema>;
|
|
2780
|
+
|
|
2781
|
+
/**
|
|
2782
|
+
* Creates the v2 balances methods object
|
|
2783
|
+
*/
|
|
2784
|
+
declare const v2BalancesMethods: (instance?: Autumn) => {
|
|
2785
|
+
/**
|
|
2786
|
+
* Updates a customer's balance for a specific feature.
|
|
2787
|
+
*
|
|
2788
|
+
* @param params - Update balance parameters
|
|
2789
|
+
* @returns Promise resolving to update balance response
|
|
2790
|
+
*
|
|
2791
|
+
* @example
|
|
2792
|
+
* ```typescript
|
|
2793
|
+
* // Set remaining balance to exact value
|
|
2794
|
+
* await autumn.v2.balances.update({
|
|
2795
|
+
* customer_id: "cus_123",
|
|
2796
|
+
* feature_id: "api_calls",
|
|
2797
|
+
* remaining: 1000,
|
|
2798
|
+
* });
|
|
2799
|
+
*
|
|
2800
|
+
* // Add to existing balance
|
|
2801
|
+
* await autumn.v2.balances.update({
|
|
2802
|
+
* customer_id: "cus_123",
|
|
2803
|
+
* feature_id: "credits",
|
|
2804
|
+
* add_to_balance: 500,
|
|
2805
|
+
* });
|
|
2806
|
+
*
|
|
2807
|
+
* // Update usage
|
|
2808
|
+
* await autumn.v2.balances.update({
|
|
2809
|
+
* customer_id: "cus_123",
|
|
2810
|
+
* feature_id: "api_calls",
|
|
2811
|
+
* usage: 100,
|
|
2812
|
+
* });
|
|
2813
|
+
*
|
|
2814
|
+
* // Target specific balance by interval or balance_id
|
|
2815
|
+
* await autumn.v2.balances.update({
|
|
2816
|
+
* customer_id: "cus_123",
|
|
2817
|
+
* feature_id: "api_calls",
|
|
2818
|
+
* balance_id: "bal_xyz",
|
|
2819
|
+
* remaining: 500,
|
|
2820
|
+
* });
|
|
2821
|
+
* ```
|
|
2822
|
+
*/
|
|
2823
|
+
update: (params: V2UpdateBalanceParams) => Promise<Result<{
|
|
2824
|
+
message: string;
|
|
2825
|
+
}, AutumnError>>;
|
|
2826
|
+
/**
|
|
2827
|
+
* Finalizes a balance lock by confirming or releasing it.
|
|
2828
|
+
*
|
|
2829
|
+
* @param params - Finalize lock parameters
|
|
2830
|
+
* @returns Promise resolving to finalize lock response
|
|
2831
|
+
*
|
|
2832
|
+
* @example
|
|
2833
|
+
* ```typescript
|
|
2834
|
+
* // Confirm a lock (deduct the reserved balance)
|
|
2835
|
+
* await autumn.v2.balances.finalize({
|
|
2836
|
+
* lock_id: "lock_abc123",
|
|
2837
|
+
* action: "confirm",
|
|
2838
|
+
* });
|
|
2839
|
+
*
|
|
2840
|
+
* // Release a lock (return the reserved balance)
|
|
2841
|
+
* await autumn.v2.balances.finalize({
|
|
2842
|
+
* lock_id: "lock_abc123",
|
|
2843
|
+
* action: "release",
|
|
2844
|
+
* });
|
|
2845
|
+
*
|
|
2846
|
+
* // Confirm with a different value than originally reserved
|
|
2847
|
+
* await autumn.v2.balances.finalize({
|
|
2848
|
+
* lock_id: "lock_abc123",
|
|
2849
|
+
* action: "confirm",
|
|
2850
|
+
* override_value: 5,
|
|
2851
|
+
* });
|
|
2852
|
+
* ```
|
|
2853
|
+
*/
|
|
2854
|
+
finalize: (params: V2FinalizeLockParams) => Promise<Result<{
|
|
2855
|
+
success: true;
|
|
2856
|
+
}, AutumnError>>;
|
|
2857
|
+
};
|
|
2858
|
+
|
|
2859
|
+
export { AppEnv, type AttachDiscount, AttachDiscountSchema, type AttachFeatureOptions, AttachFeatureOptionsSchema, type AttachParams, AttachParamsSchema, type AttachResult, AttachResultSchema, type AutoTopup, type AutoTopupPurchaseLimit, AutoTopupPurchaseLimitSchema, AutoTopupSchema, Autumn, AutumnError, type AutumnErrorWithStatus, type AutumnPromise, type BasePriceParams, BasePriceParamsSchema, type BillingAttachParams, BillingAttachParamsSchema, type BillingInterval, BillingIntervalSchema, type BillingMethod, BillingMethodSchema, type BillingPortalParams, BillingPortalParamsSchema, type BillingPortalResult, type BillingPreviewResponse, BillingPreviewResponseSchema, type BillingRequiredAction, BillingRequiredActionSchema, type BillingResponse, BillingResponseSchema, type BillingUpdateParams, BillingUpdateParamsSchema, BinSizeEnum, type CancelAction, CancelActionSchema, type CancelParams, CancelParamsSchema, type CancelResult, CancelResultSchema, type CheckFeaturePreview, type CheckFeatureResult, CheckFeatureResultSchema, type CheckFeatureScenario, type CheckParams, CheckParamsSchema, type CheckProductPreview, type CheckProductResult, type CheckResult, type CheckoutParams, CheckoutParamsSchema, type CheckoutResult, CoreCusFeatureSchema, type CoreCustomerFeature, type CreateBalanceParams, CreateBalanceParamsSchema, type CreateBalanceResponse, type CreateCustomerParams, type CreateCustomerParamsBase, CreateCustomerParamsSchema, type CreateEntityParams, type CreateEntityResult, type CreatePlanItemParams, CreatePlanItemParamsSchema, type CreateProductParams, type CreateReferralCodeParams, CreateReferralCodeParamsSchema, type CreateReferralCodeResult, type CustomLineItem, CustomLineItemSchema, type Customer, type CustomerBillingControls, CustomerBillingControlsSchema, type CustomerData, CustomerDataSchema, CustomerExpandEnum, type CustomerExpandOption, type CustomerExpandedFields, type CustomerFeature, type CustomerInvoice, type CustomerProduct, type CustomerReferral, type CustomizePlan, CustomizePlanSchema, type DeleteCustomerParams, DeleteCustomerParamsSchema, type DeleteEntityResult, type DeleteProductParams, type Entity, type EntityData, EntityDataSchema, type EntityExpandOption, type ErrorResponse, type EventsListItem, EventsListItemSchema, type EventsListParams, EventsListParamsSchema, type EventsListResponse, EventsListResponseSchema, type ExpandedCustomer, type Feature$1 as Feature, type FeatureQuantityParams, FeatureQuantityParamsSchema, FeatureSchema, type FreeTrial, FreeTrialDuration, type FreeTrialParams, FreeTrialParamsSchema, type GetCustomerParams, type GetEntityParams, type GetPricingTableParams, Infinite, type InvoiceModeParams, InvoiceModeParamsSchema, type ListCustomersParams, ListCustomersParamsSchema, type ListProductsParams, type LockParams, LockParamsSchema, type MultiAttachCustomizePlan, MultiAttachCustomizePlanSchema, type MultiAttachParams, MultiAttachParamsSchema, type MultiAttachPlan, MultiAttachPlanSchema, type OnDecrease, OnDecreaseSchema, type OnIncrease, OnIncreaseSchema, type PaymentFailureCode, PaymentFailureCodeSchema, type PlanSchedule, PlanScheduleSchema, type PreviewLineItem, PreviewLineItemSchema, type PriceTier, type PricingTableProduct, type Product, type ProductItem, ProductItemInterval, type ProductItemIntervalType, type ProductScenario, ProductStatus, type ProrationBehavior, ProrationBehaviorSchema, PurchaseLimitInterval, PurchaseLimitIntervalEnum, type QueryParams, QueryParamsSchema, QueryRangeEnum, type QueryResult, type RedeemReferralCodeParams, RedeemReferralCodeParamsSchema, type RedeemReferralCodeResult, type RedirectMode, RedirectModeSchema, ResetInterval, type RolloverExpiryDurationType, RolloverExpiryDurationTypeSchema, type SetupPaymentParams$1 as SetupPaymentParams, type SetupPaymentResponse, SetupPaymentResponseSchema, type SetupPaymentResult, type TrackParams, TrackParamsSchema, type TrackResult, TrackResultSchema, type TransferProductParams, TransferProductParamsSchema, type TransferProductResult, type UpdateBalancesParams, UpdateBalancesParamsSchema, type UpdateBalancesResult, type UpdateCustomerParams, UsageModel, type UsageModelType, type UsageParams, type UsageResult, type UsageTier, UsageTierSchema, type V2FinalizeLockAction, V2FinalizeLockActionSchema, type V2FinalizeLockParams, V2FinalizeLockParamsSchema, type V2FinalizeLockResponse, V2FinalizeLockResponseSchema, type V2ResetInterval, V2ResetIntervalSchema, type SetupPaymentParams as V2SetupPaymentParams, SetupPaymentParamsSchema as V2SetupPaymentParamsSchema, type V2UpdateBalanceParams, V2UpdateBalanceParamsSchema, type V2UpdateBalanceResponse, V2UpdateBalanceResponseSchema, fetchPricingTable, toContainerResult, v2BalancesMethods, v2BillingMethods };
|