autumn-js 0.1.34 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libraries/backend/better-auth.d.mts +221 -310
- package/dist/libraries/backend/better-auth.d.ts +221 -310
- package/dist/libraries/backend/better-auth.js +389 -133
- package/dist/libraries/backend/better-auth.mjs +250 -100
- package/dist/libraries/backend/{chunk-F3S66STP.mjs → chunk-35N7BIAE.mjs} +45 -1
- package/dist/libraries/backend/{chunk-WBHGLFLE.mjs → chunk-4MEEJLXG.mjs} +6 -6
- package/dist/libraries/backend/{chunk-SVTPC45F.mjs → chunk-LOSIWWM2.mjs} +1 -1
- package/dist/libraries/backend/{chunk-7OEFNFGZ.mjs → chunk-MHIUO3ST.mjs} +1 -1
- package/dist/libraries/backend/{chunk-SRHT6RDB.mjs → chunk-PO4EL4BW.mjs} +9 -27
- package/dist/libraries/backend/{chunk-ENRZQDOT.mjs → chunk-QOJMX7ML.mjs} +2 -25
- package/dist/libraries/backend/chunk-SRJD6EXQ.mjs +104 -0
- package/dist/libraries/backend/{chunk-D5C5Q5FZ.mjs → chunk-USQ76FYI.mjs} +1 -1
- package/dist/libraries/backend/convex.js +52 -43
- package/dist/libraries/backend/convex.mjs +7 -7
- package/dist/libraries/backend/elysia.js +53 -62
- package/dist/libraries/backend/elysia.mjs +10 -28
- package/dist/libraries/backend/express.js +52 -43
- package/dist/libraries/backend/express.mjs +7 -7
- package/dist/libraries/backend/fastify.js +52 -43
- package/dist/libraries/backend/fastify.mjs +7 -7
- package/dist/libraries/backend/hono.js +52 -43
- package/dist/libraries/backend/hono.mjs +7 -7
- package/dist/libraries/backend/index.js +52 -43
- package/dist/libraries/backend/index.mjs +7 -7
- package/dist/libraries/backend/next.js +52 -43
- package/dist/libraries/backend/next.mjs +7 -7
- package/dist/libraries/backend/react-router.js +52 -43
- package/dist/libraries/backend/react-router.mjs +7 -7
- package/dist/libraries/backend/remix_dep.js +52 -43
- package/dist/libraries/backend/remix_dep.mjs +7 -7
- package/dist/libraries/backend/routes/backendRouter.js +52 -43
- package/dist/libraries/backend/routes/backendRouter.mjs +7 -7
- package/dist/libraries/backend/routes/entityRoutes.js +44 -17
- package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/genRoutes.js +57 -48
- package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/productRoutes.js +44 -17
- package/dist/libraries/backend/routes/productRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/referralRoutes.js +44 -17
- package/dist/libraries/backend/routes/referralRoutes.mjs +3 -3
- package/dist/libraries/backend/supabase.js +52 -43
- package/dist/libraries/backend/supabase.mjs +7 -7
- package/dist/libraries/backend/tanstack.js +52 -43
- package/dist/libraries/backend/tanstack.mjs +7 -7
- package/dist/libraries/backend/utils/backendRes.js +1 -17
- package/dist/libraries/backend/utils/backendRes.mjs +1 -1
- 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 +18 -0
- package/dist/libraries/backend/utils/betterAuth/types.d.ts +18 -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/withAuth.js +44 -17
- package/dist/libraries/backend/utils/withAuth.mjs +2 -2
- package/dist/libraries/react/AutumnContext.d.mts +7 -9
- package/dist/libraries/react/AutumnContext.d.ts +7 -9
- package/dist/libraries/react/AutumnContext.js +32 -81
- package/dist/libraries/react/AutumnContext.mjs +7 -9
- package/dist/libraries/react/BaseAutumnProvider.d.mts +7 -9
- package/dist/libraries/react/BaseAutumnProvider.d.ts +7 -9
- package/dist/libraries/react/BaseAutumnProvider.js +201 -254
- package/dist/libraries/react/BaseAutumnProvider.mjs +12 -14
- package/dist/libraries/react/{ReactAutumnClient-DEHKGBDi.d.ts → ReactAutumnClient-DkAcY1X2.d.ts} +32 -37
- package/dist/libraries/react/{ReactAutumnClient-Zj0UGjxH.d.mts → ReactAutumnClient-DuYr1i4C.d.mts} +32 -37
- package/dist/libraries/react/ReactAutumnProvider.d.mts +2 -2
- package/dist/libraries/react/ReactAutumnProvider.d.ts +2 -2
- package/dist/libraries/react/ReactAutumnProvider.js +201 -263
- package/dist/libraries/react/ReactAutumnProvider.mjs +14 -16
- package/dist/libraries/react/{attachTypes-DVF4f7Hw.d.ts → attachTypes-CKp1KMwX.d.ts} +1 -1
- package/dist/libraries/react/{attachTypes-DJIr5ldB.d.mts → attachTypes-DbuZWzAP.d.mts} +1 -1
- package/dist/libraries/react/{chunk-SIYKVK6T.mjs → chunk-5BTQDWG6.mjs} +1 -1
- package/dist/libraries/react/{chunk-IMAERZCR.mjs → chunk-5LRBYZUD.mjs} +1 -1
- package/dist/libraries/react/{chunk-RMTUAI3D.mjs → chunk-6PLIVXZY.mjs} +4 -3
- package/dist/libraries/react/{chunk-C4Z4C6RL.mjs → chunk-6U2XJZGO.mjs} +2 -2
- package/dist/libraries/react/{chunk-QUXQNE4G.mjs → chunk-7YNNQGHZ.mjs} +1 -1
- package/dist/libraries/react/{chunk-QTDNLHRG.mjs → chunk-AUZMXLNB.mjs} +1 -1
- package/dist/libraries/react/{chunk-R6KU3V35.mjs → chunk-BR56DHZ2.mjs} +2 -2
- package/dist/libraries/react/{chunk-YLBFGNCO.mjs → chunk-DJXOY3UC.mjs} +2 -2
- package/dist/libraries/react/{chunk-L2DI44KG.mjs → chunk-FSJNDXTY.mjs} +11 -11
- package/dist/libraries/react/chunk-LS2RW6JG.mjs +51 -0
- package/dist/libraries/react/{chunk-SJKUKNBU.mjs → chunk-NJRJLNGW.mjs} +1 -1
- package/dist/libraries/react/{chunk-ZF2HUCN6.mjs → chunk-OYBOLAL5.mjs} +2 -7
- package/dist/libraries/react/{chunk-RQFIIPL2.mjs → chunk-P4BHBYHL.mjs} +1 -1
- package/dist/libraries/react/{chunk-5LYLN4C2.mjs → chunk-SFOIZTAS.mjs} +1 -17
- package/dist/libraries/react/{chunk-ZV4RPZTM.mjs → chunk-SUENW2KS.mjs} +2 -7
- package/dist/libraries/react/{chunk-MJGGWQ7J.mjs → chunk-W3YUWXSL.mjs} +2 -2
- package/dist/libraries/react/{chunk-CM5UZD2G.mjs → chunk-WJZUVBCL.mjs} +4 -4
- package/dist/libraries/react/{chunk-GM7LHHFX.mjs → chunk-WRYAEUUV.mjs} +5 -9
- package/dist/libraries/react/{chunk-OLMAXT44.mjs → chunk-XGIQOMYH.mjs} +25 -25
- package/dist/libraries/react/{chunk-P4QKFNVY.mjs → chunk-ZVGPT54A.mjs} +1 -10
- package/dist/libraries/react/client/ConvexAutumnClient.d.mts +7 -13
- package/dist/libraries/react/client/ConvexAutumnClient.d.ts +7 -13
- package/dist/libraries/react/client/ConvexAutumnClient.js +1 -26
- package/dist/libraries/react/client/ConvexAutumnClient.mjs +2 -2
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +6 -8
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +6 -8
- package/dist/libraries/react/client/ReactAutumnClient.js +32 -81
- package/dist/libraries/react/client/ReactAutumnClient.mjs +6 -8
- package/dist/libraries/react/client/clientCompMethods.d.mts +25 -9
- package/dist/libraries/react/client/clientCompMethods.d.ts +25 -9
- package/dist/libraries/react/client/clientCompMethods.mjs +6 -3
- package/dist/libraries/react/client/clientCusMethods.d.mts +7 -9
- package/dist/libraries/react/client/clientCusMethods.d.ts +7 -9
- package/dist/libraries/react/client/clientEntityMethods.d.mts +6 -7
- package/dist/libraries/react/client/clientEntityMethods.d.ts +6 -7
- package/dist/libraries/react/client/clientEntityMethods.js +2 -25
- package/dist/libraries/react/client/clientEntityMethods.mjs +1 -2
- package/dist/libraries/react/client/clientGenMethods.d.mts +8 -9
- package/dist/libraries/react/client/clientGenMethods.d.ts +8 -9
- package/dist/libraries/react/client/clientGenMethods.js +12 -40
- package/dist/libraries/react/client/clientGenMethods.mjs +1 -2
- package/dist/libraries/react/client/clientProdMethods.d.mts +7 -9
- package/dist/libraries/react/client/clientProdMethods.d.ts +7 -9
- package/dist/libraries/react/client/clientReferralMethods.d.mts +6 -8
- package/dist/libraries/react/client/clientReferralMethods.d.ts +6 -8
- package/dist/libraries/react/client/clientReferralMethods.js +2 -27
- package/dist/libraries/react/client/clientReferralMethods.mjs +1 -2
- package/dist/libraries/react/client/types/clientEntTypes.d.mts +18 -13
- package/dist/libraries/react/client/types/clientEntTypes.d.ts +18 -13
- package/dist/libraries/react/client/types/clientEntTypes.js +28 -0
- package/dist/libraries/react/client/types/clientEntTypes.mjs +20 -0
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +12 -10
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +12 -10
- package/dist/libraries/react/client/types/clientGenTypes.js +14 -17
- package/dist/libraries/react/client/types/clientGenTypes.mjs +12 -1
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.mts +2 -2
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.ts +2 -2
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +285 -338
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +23 -25
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.mts +2 -2
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.ts +2 -2
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.mts +1 -1
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.ts +1 -1
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.js +81 -131
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +23 -25
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +1 -1
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +484 -537
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +23 -25
- package/dist/libraries/react/components/ui/accordion.d.mts +10 -4
- package/dist/libraries/react/components/ui/accordion.d.ts +10 -4
- package/dist/libraries/react/components/ui/button.d.mts +1 -1
- package/dist/libraries/react/components/ui/button.d.ts +1 -1
- package/dist/libraries/react/components/ui/dialog.d.mts +15 -7
- package/dist/libraries/react/components/ui/dialog.d.ts +15 -7
- package/dist/libraries/react/components/ui/popover.d.mts +6 -4
- package/dist/libraries/react/components/ui/popover.d.ts +6 -4
- package/dist/libraries/react/components/ui/switch.d.mts +3 -1
- package/dist/libraries/react/components/ui/switch.d.ts +3 -1
- package/dist/libraries/react/{cusTypes-CEb_KwPo.d.ts → cusTypes-D3QQXjif.d.ts} +1 -1
- package/dist/libraries/react/{cusTypes-DynqPCZH.d.mts → cusTypes-RU0fmR-t.d.mts} +1 -1
- package/dist/libraries/react/{entTypes-DjasDDYh.d.mts → entTypes-35x0LnYH.d.mts} +1 -1
- package/dist/libraries/react/{entTypes--Y-4T20Y.d.ts → entTypes-n2T2wpRx.d.ts} +1 -1
- package/dist/libraries/react/{genTypes-VKn7hoqQ.d.mts → genTypes-B5_6Pu_4.d.mts} +1 -1
- package/dist/libraries/react/{genTypes-BjHbcZ7E.d.ts → genTypes-CY6GNiAn.d.ts} +1 -1
- package/dist/libraries/react/hooks/helpers/handleCheck.d.mts +6 -7
- package/dist/libraries/react/hooks/helpers/handleCheck.d.ts +6 -7
- package/dist/libraries/react/hooks/helpers/handleCheck.js +1 -17
- package/dist/libraries/react/hooks/helpers/handleCheck.mjs +2 -2
- package/dist/libraries/react/hooks/helpers/useAutumnBase.d.mts +6 -7
- package/dist/libraries/react/hooks/helpers/useAutumnBase.d.ts +6 -7
- package/dist/libraries/react/hooks/helpers/useAutumnBase.js +1 -17
- package/dist/libraries/react/hooks/helpers/useAutumnBase.mjs +3 -3
- package/dist/libraries/react/hooks/useAnalytics.d.mts +2 -2
- package/dist/libraries/react/hooks/useAnalytics.d.ts +2 -2
- package/dist/libraries/react/hooks/useAnalytics.js +32 -81
- package/dist/libraries/react/hooks/useAnalytics.mjs +8 -10
- package/dist/libraries/react/hooks/useCustomer.d.mts +10 -10
- package/dist/libraries/react/hooks/useCustomer.d.ts +10 -10
- package/dist/libraries/react/hooks/useCustomer.js +181 -234
- package/dist/libraries/react/hooks/useCustomer.mjs +12 -14
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +10 -10
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +10 -10
- package/dist/libraries/react/hooks/useCustomerBase.js +197 -250
- package/dist/libraries/react/hooks/useCustomerBase.mjs +11 -13
- package/dist/libraries/react/hooks/useEntity.d.mts +4 -4
- package/dist/libraries/react/hooks/useEntity.d.ts +4 -4
- package/dist/libraries/react/hooks/useEntity.js +33 -81
- package/dist/libraries/react/hooks/useEntity.mjs +12 -14
- package/dist/libraries/react/hooks/useEntityBase.d.mts +6 -6
- package/dist/libraries/react/hooks/useEntityBase.d.ts +6 -6
- package/dist/libraries/react/hooks/useEntityBase.js +33 -81
- package/dist/libraries/react/hooks/useEntityBase.mjs +11 -13
- package/dist/libraries/react/hooks/usePaywall.d.mts +1 -1
- package/dist/libraries/react/hooks/usePaywall.d.ts +1 -1
- package/dist/libraries/react/hooks/usePaywall.js +32 -81
- package/dist/libraries/react/hooks/usePaywall.mjs +8 -10
- package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.js +32 -81
- package/dist/libraries/react/hooks/usePricingTable.mjs +9 -11
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +6 -8
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +6 -8
- package/dist/libraries/react/hooks/usePricingTableBase.js +1 -17
- package/dist/libraries/react/hooks/usePricingTableBase.mjs +2 -2
- package/dist/libraries/react/hooks/useProductsBase.d.mts +6 -8
- package/dist/libraries/react/hooks/useProductsBase.d.ts +6 -8
- package/dist/libraries/react/hooks/useProductsBase.js +2 -1
- package/dist/libraries/react/hooks/useProductsBase.mjs +2 -1
- package/dist/libraries/react/index.d.mts +62 -58
- package/dist/libraries/react/index.d.ts +62 -58
- package/dist/libraries/react/index.js +489 -550
- package/dist/libraries/react/index.mjs +461 -522
- package/dist/libraries/react/{prodTypes-C8xRoBP7.d.ts → prodTypes-C4aZSZfO.d.mts} +1 -1
- package/dist/libraries/react/{prodTypes-C8xRoBP7.d.mts → prodTypes-C4aZSZfO.d.ts} +1 -1
- package/dist/next/client/NextAutumnClient.d.mts +31 -34
- package/dist/next/client/NextAutumnClient.d.ts +31 -34
- package/dist/next/client/NextAutumnProvider.d.mts +2 -2
- package/dist/next/client/NextAutumnProvider.d.ts +2 -2
- package/dist/next/client/{clientAttachTypes-BqwjCML1.d.ts → clientAttachTypes-BtZh00uu.d.ts} +12 -10
- package/dist/next/client/{clientAttachTypes-9AXt1E5H.d.mts → clientAttachTypes-yOuJqDWt.d.mts} +12 -10
- package/dist/next/client/{clientEntTypes-CnQkrPEG.d.mts → clientEntTypes-Bsi7ciUF.d.ts} +12 -10
- package/dist/next/client/{clientEntTypes-BhQWlwSW.d.ts → clientEntTypes-aLfa3lyP.d.mts} +12 -10
- package/dist/next/client/clientUtils.d.mts +3 -3
- package/dist/next/client/clientUtils.d.ts +3 -3
- package/dist/next/client/{cusTypes-5W4JVk2C.d.ts → cusTypes-B-rJwpui.d.ts} +2 -2
- package/dist/next/client/{cusTypes-Cb9Peq72.d.mts → cusTypes-CXjHwB-c.d.mts} +2 -2
- package/dist/next/client/{entTypes-R0fGEyG8.d.mts → entTypes-BkN-Puru.d.mts} +1 -1
- package/dist/next/client/{entTypes-B2gnYOgY.d.ts → entTypes-DjKFS-Zk.d.ts} +1 -1
- package/dist/next/client/hooks/useAutumn.d.mts +3 -3
- package/dist/next/client/hooks/useAutumn.d.ts +3 -3
- package/dist/next/client/hooks/useCustomer.d.mts +6 -6
- package/dist/next/client/hooks/useCustomer.d.ts +6 -6
- package/dist/next/client/hooks/useEntity.d.mts +4 -4
- package/dist/next/client/hooks/useEntity.d.ts +4 -4
- package/dist/next/client/hooks/usePricingTable.d.mts +1 -1
- package/dist/next/client/hooks/usePricingTable.d.ts +1 -1
- package/dist/next/client/{prodTypes-BC--Np0p.d.mts → prodTypes-B_VMILpU.d.mts} +1 -1
- package/dist/next/client/{prodTypes-BC--Np0p.d.ts → prodTypes-B_VMILpU.d.ts} +1 -1
- package/dist/next/client/types.d.mts +3 -3
- package/dist/next/client/types.d.ts +3 -3
- package/dist/next/server/cusActions.d.mts +10 -8
- package/dist/next/server/cusActions.d.ts +10 -8
- package/dist/next/server/cusActions.js +3 -3
- package/dist/next/server/cusActions.mjs +3 -3
- package/dist/next/server/genActions.js +5 -5
- package/dist/next/server/genActions.mjs +5 -5
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.mjs +1 -1
- package/dist/utils/encryptUtils.js +1 -17
- package/dist/utils/encryptUtils.mjs +1 -17
- package/dist/utils/toSnakeCase.d.mts +5 -1
- package/dist/utils/toSnakeCase.d.ts +5 -1
- package/dist/utils/toSnakeCase.js +25 -6
- package/dist/utils/toSnakeCase.mjs +25 -6
- package/package.json +1 -1
- package/dist/libraries/react/chunk-KQT5G3HT.mjs +0 -27
- package/dist/libraries/react/chunk-VTGR7VVK.mjs +0 -12
- package/dist/libraries/react/chunk-YQHZT73Z.mjs +0 -59
- package/dist/libraries/react/utils/toSnakeCase.d.mts +0 -3
- package/dist/libraries/react/utils/toSnakeCase.d.ts +0 -3
- package/dist/libraries/react/utils/toSnakeCase.js +0 -50
- package/dist/libraries/react/utils/toSnakeCase.mjs +0 -8
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AttachParams } from '../client/types/clientAttachTypes.js';
|
|
2
2
|
import { CheckParams, CancelParams, TrackParams } from '../client/types/clientGenTypes.js';
|
|
3
3
|
import * as swr from 'swr';
|
|
4
|
-
import { a as CheckResult } from '../genTypes-
|
|
5
|
-
import { E as Entity, A as AutumnPromise } from '../entTypes
|
|
4
|
+
import { a as CheckResult } from '../genTypes-CY6GNiAn.js';
|
|
5
|
+
import { E as Entity, A as AutumnPromise } from '../entTypes-n2T2wpRx.js';
|
|
6
6
|
import { GetEntityParams } from '../client/types/clientEntTypes.js';
|
|
7
7
|
import 'zod/v4';
|
|
8
|
-
import '../prodTypes-
|
|
8
|
+
import '../prodTypes-C4aZSZfO.js';
|
|
9
9
|
import '../error-DHbclCVh.js';
|
|
10
|
-
import '../cusTypes-
|
|
10
|
+
import '../cusTypes-D3QQXjif.js';
|
|
11
11
|
|
|
12
12
|
declare const useEntity: (entityId: string | null, params?: GetEntityParams) => {
|
|
13
13
|
entity: Entity | null;
|
|
@@ -366,14 +366,6 @@ var toContainerResult = async ({
|
|
|
366
366
|
}
|
|
367
367
|
} catch (error2) {
|
|
368
368
|
throw error2;
|
|
369
|
-
return {
|
|
370
|
-
data: null,
|
|
371
|
-
error: new AutumnError({
|
|
372
|
-
message: "Failed to parse JSON response from Autumn",
|
|
373
|
-
code: "internal_error"
|
|
374
|
-
}),
|
|
375
|
-
statusCode: response.status
|
|
376
|
-
};
|
|
377
369
|
}
|
|
378
370
|
return {
|
|
379
371
|
data: null,
|
|
@@ -385,7 +377,7 @@ var toContainerResult = async ({
|
|
|
385
377
|
};
|
|
386
378
|
}
|
|
387
379
|
try {
|
|
388
|
-
|
|
380
|
+
const data = await response.json();
|
|
389
381
|
return {
|
|
390
382
|
data,
|
|
391
383
|
error: null,
|
|
@@ -393,14 +385,6 @@ var toContainerResult = async ({
|
|
|
393
385
|
};
|
|
394
386
|
} catch (error) {
|
|
395
387
|
throw error;
|
|
396
|
-
return {
|
|
397
|
-
data: null,
|
|
398
|
-
error: new AutumnError({
|
|
399
|
-
message: "Failed to parse Autumn API response",
|
|
400
|
-
code: "internal_error"
|
|
401
|
-
}),
|
|
402
|
-
statusCode: response?.status
|
|
403
|
-
};
|
|
404
388
|
}
|
|
405
389
|
};
|
|
406
390
|
|
|
@@ -1028,12 +1012,6 @@ var logFetchError = ({
|
|
|
1028
1012
|
2. Check that autumnHandler is correctly registered on your backend.`);
|
|
1029
1013
|
};
|
|
1030
1014
|
|
|
1031
|
-
// src/libraries/react/client/clientCompMethods.ts
|
|
1032
|
-
async function getPricingTableMethod() {
|
|
1033
|
-
const res = await this.get(`${this.prefix}/components/pricing_table`);
|
|
1034
|
-
return res;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
1015
|
// src/libraries/react/client/clientCusMethods.ts
|
|
1038
1016
|
var createCustomerMethod = async ({
|
|
1039
1017
|
client,
|
|
@@ -1043,27 +1021,6 @@ var createCustomerMethod = async ({
|
|
|
1043
1021
|
return result;
|
|
1044
1022
|
};
|
|
1045
1023
|
|
|
1046
|
-
// src/libraries/react/utils/toSnakeCase.ts
|
|
1047
|
-
function stringToSnakeCase(str) {
|
|
1048
|
-
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
|
|
1049
|
-
}
|
|
1050
|
-
var toSnakeCase = (obj, excludeKeys) => {
|
|
1051
|
-
if (Array.isArray(obj)) {
|
|
1052
|
-
return obj.map((item) => toSnakeCase(item, excludeKeys));
|
|
1053
|
-
} else if (obj !== null && typeof obj === "object") {
|
|
1054
|
-
return Object.fromEntries(
|
|
1055
|
-
Object.entries(obj).map(([key, value]) => {
|
|
1056
|
-
const snakeKey = stringToSnakeCase(key);
|
|
1057
|
-
if (excludeKeys && excludeKeys.includes(key)) {
|
|
1058
|
-
return [snakeKey, value];
|
|
1059
|
-
}
|
|
1060
|
-
return [snakeKey, toSnakeCase(value, excludeKeys)];
|
|
1061
|
-
})
|
|
1062
|
-
);
|
|
1063
|
-
}
|
|
1064
|
-
return obj;
|
|
1065
|
-
};
|
|
1066
|
-
|
|
1067
1024
|
// src/utils/entityUtils.tsx
|
|
1068
1025
|
var getEntityExpandStr = (expand) => {
|
|
1069
1026
|
if (!expand) {
|
|
@@ -1074,13 +1031,11 @@ var getEntityExpandStr = (expand) => {
|
|
|
1074
1031
|
|
|
1075
1032
|
// src/libraries/react/client/clientEntityMethods.ts
|
|
1076
1033
|
async function createEntityMethod(params) {
|
|
1077
|
-
|
|
1078
|
-
const res = await this.post(`${this.prefix}/entities`, snakeParams);
|
|
1034
|
+
const res = await this.post(`${this.prefix}/entities`, params);
|
|
1079
1035
|
return res;
|
|
1080
1036
|
}
|
|
1081
1037
|
async function getEntityMethod(entityId, params) {
|
|
1082
|
-
|
|
1083
|
-
let expand = getEntityExpandStr(params?.expand);
|
|
1038
|
+
const expand = getEntityExpandStr(params?.expand);
|
|
1084
1039
|
const res = await this.get(`${this.prefix}/entities/${entityId}?${expand}`);
|
|
1085
1040
|
return res;
|
|
1086
1041
|
}
|
|
@@ -1091,44 +1046,39 @@ async function deleteEntityMethod(entityId) {
|
|
|
1091
1046
|
|
|
1092
1047
|
// src/libraries/react/client/clientGenMethods.ts
|
|
1093
1048
|
async function checkoutMethod(params) {
|
|
1094
|
-
|
|
1095
|
-
const res = await this.post(`${this.prefix}/checkout`, snakeParams);
|
|
1049
|
+
const res = await this.post(`${this.prefix}/checkout`, params);
|
|
1096
1050
|
return res;
|
|
1097
1051
|
}
|
|
1098
1052
|
async function attachMethod(params) {
|
|
1099
|
-
|
|
1100
|
-
const res = await this.post(`${this.prefix}/attach`, snakeParams);
|
|
1053
|
+
const res = await this.post(`${this.prefix}/attach`, params);
|
|
1101
1054
|
return res;
|
|
1102
1055
|
}
|
|
1103
1056
|
async function setupPaymentMethod(params) {
|
|
1104
|
-
|
|
1105
|
-
const res = await this.post(`${this.prefix}/setup_payment`, snakeParams);
|
|
1057
|
+
const res = await this.post(`${this.prefix}/setup_payment`, params);
|
|
1106
1058
|
return res;
|
|
1107
1059
|
}
|
|
1108
1060
|
async function cancelMethod(params) {
|
|
1109
|
-
|
|
1110
|
-
const res = await this.post(`${this.prefix}/cancel`, snakeParams);
|
|
1061
|
+
const res = await this.post(`${this.prefix}/cancel`, params);
|
|
1111
1062
|
return res;
|
|
1112
1063
|
}
|
|
1113
1064
|
async function checkMethod(params) {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1065
|
+
const noDialogParams = {
|
|
1066
|
+
...params,
|
|
1067
|
+
dialog: void 0
|
|
1068
|
+
};
|
|
1069
|
+
const res = await this.post(`${this.prefix}/check`, noDialogParams);
|
|
1117
1070
|
return res;
|
|
1118
1071
|
}
|
|
1119
1072
|
async function trackMethod(params) {
|
|
1120
|
-
|
|
1121
|
-
const res = await this.post(`${this.prefix}/track`, snakeParams);
|
|
1073
|
+
const res = await this.post(`${this.prefix}/track`, params);
|
|
1122
1074
|
return res;
|
|
1123
1075
|
}
|
|
1124
1076
|
async function openBillingPortalMethod(params) {
|
|
1125
|
-
|
|
1126
|
-
const res = await this.post(`${this.prefix}/billing_portal`, snakeParams);
|
|
1077
|
+
const res = await this.post(`${this.prefix}/billing_portal`, params || {});
|
|
1127
1078
|
return res;
|
|
1128
1079
|
}
|
|
1129
1080
|
async function queryMethod(params) {
|
|
1130
|
-
|
|
1131
|
-
const res = await this.post(`${this.prefix}/query`, snakeParams);
|
|
1081
|
+
const res = await this.post(`${this.prefix}/query`, params);
|
|
1132
1082
|
return res;
|
|
1133
1083
|
}
|
|
1134
1084
|
|
|
@@ -1140,13 +1090,11 @@ async function listProductsMethod() {
|
|
|
1140
1090
|
|
|
1141
1091
|
// src/libraries/react/client/clientReferralMethods.ts
|
|
1142
1092
|
async function createCode(params) {
|
|
1143
|
-
|
|
1144
|
-
const res = await this.post(`${this.prefix}/referrals/code`, snakeParams);
|
|
1093
|
+
const res = await this.post(`${this.prefix}/referrals/code`, params);
|
|
1145
1094
|
return res;
|
|
1146
1095
|
}
|
|
1147
1096
|
async function redeemCode(params) {
|
|
1148
|
-
|
|
1149
|
-
const res = await this.post(`${this.prefix}/referrals/redeem`, snakeParams);
|
|
1097
|
+
const res = await this.post(`${this.prefix}/referrals/redeem`, params);
|
|
1150
1098
|
return res;
|
|
1151
1099
|
}
|
|
1152
1100
|
|
|
@@ -1157,7 +1105,9 @@ var AutumnClient = class {
|
|
|
1157
1105
|
customerData;
|
|
1158
1106
|
includeCredentials;
|
|
1159
1107
|
prefix;
|
|
1108
|
+
camelCase;
|
|
1160
1109
|
headers;
|
|
1110
|
+
framework;
|
|
1161
1111
|
constructor({
|
|
1162
1112
|
backendUrl,
|
|
1163
1113
|
getBearerToken,
|
|
@@ -1171,11 +1121,15 @@ var AutumnClient = class {
|
|
|
1171
1121
|
this.customerData = customerData;
|
|
1172
1122
|
this.includeCredentials = includeCredentials;
|
|
1173
1123
|
this.prefix = "/api/autumn";
|
|
1124
|
+
let camelCase = false;
|
|
1174
1125
|
if (betterAuthUrl) {
|
|
1175
1126
|
this.prefix = "/api/auth/autumn";
|
|
1176
1127
|
this.backendUrl = betterAuthUrl;
|
|
1128
|
+
camelCase = true;
|
|
1177
1129
|
}
|
|
1178
1130
|
this.headers = headers;
|
|
1131
|
+
if (betterAuthUrl) camelCase = true;
|
|
1132
|
+
this.camelCase = camelCase;
|
|
1179
1133
|
}
|
|
1180
1134
|
/**
|
|
1181
1135
|
* Detects if the backend supports CORS credentials by making an OPTIONS request
|
|
@@ -1193,7 +1147,7 @@ var AutumnClient = class {
|
|
|
1193
1147
|
body: JSON.stringify({})
|
|
1194
1148
|
});
|
|
1195
1149
|
return { valid: true, includeCredentials: true };
|
|
1196
|
-
} catch (
|
|
1150
|
+
} catch (_) {
|
|
1197
1151
|
try {
|
|
1198
1152
|
await fetch(testEndpoint, {
|
|
1199
1153
|
method: "POST",
|
|
@@ -1202,7 +1156,7 @@ var AutumnClient = class {
|
|
|
1202
1156
|
body: JSON.stringify({})
|
|
1203
1157
|
});
|
|
1204
1158
|
return { valid: true, includeCredentials: false };
|
|
1205
|
-
} catch (
|
|
1159
|
+
} catch (_2) {
|
|
1206
1160
|
return { valid: false, includeCredentials: void 0 };
|
|
1207
1161
|
}
|
|
1208
1162
|
}
|
|
@@ -1239,9 +1193,9 @@ var AutumnClient = class {
|
|
|
1239
1193
|
};
|
|
1240
1194
|
if (this.getBearerToken) {
|
|
1241
1195
|
try {
|
|
1242
|
-
|
|
1196
|
+
const token = await this.getBearerToken();
|
|
1243
1197
|
headers.Authorization = `Bearer ${token}`;
|
|
1244
|
-
} catch (
|
|
1198
|
+
} catch (_) {
|
|
1245
1199
|
console.error(`Failed to call getToken() in AutumnProvider`);
|
|
1246
1200
|
}
|
|
1247
1201
|
}
|
|
@@ -1255,15 +1209,15 @@ var AutumnClient = class {
|
|
|
1255
1209
|
method,
|
|
1256
1210
|
body
|
|
1257
1211
|
}) {
|
|
1258
|
-
body = method === "POST" ?
|
|
1212
|
+
body = method === "POST" ? {
|
|
1259
1213
|
...body,
|
|
1260
|
-
customer_data: this.customerData || void 0
|
|
1261
|
-
}
|
|
1214
|
+
[this.camelCase ? "customerData" : "customer_data"]: this.customerData || void 0
|
|
1215
|
+
} : void 0;
|
|
1262
1216
|
const includeCredentials = await this.shouldIncludeCredentials();
|
|
1263
1217
|
try {
|
|
1264
1218
|
const response = await fetch(`${this.backendUrl}${path}`, {
|
|
1265
1219
|
method,
|
|
1266
|
-
body,
|
|
1220
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
1267
1221
|
headers: await this.getHeaders(),
|
|
1268
1222
|
credentials: includeCredentials ? "include" : "omit"
|
|
1269
1223
|
});
|
|
@@ -1283,7 +1237,7 @@ var AutumnClient = class {
|
|
|
1283
1237
|
return {
|
|
1284
1238
|
data: null,
|
|
1285
1239
|
error: new AutumnError({
|
|
1286
|
-
message: error.message,
|
|
1240
|
+
message: error instanceof Error ? error.message : JSON.stringify(error),
|
|
1287
1241
|
code: "fetch_failed"
|
|
1288
1242
|
})
|
|
1289
1243
|
};
|
|
@@ -1314,9 +1268,6 @@ var AutumnClient = class {
|
|
|
1314
1268
|
params
|
|
1315
1269
|
});
|
|
1316
1270
|
}
|
|
1317
|
-
async getPricingTable() {
|
|
1318
|
-
return await getPricingTableMethod.bind(this)();
|
|
1319
|
-
}
|
|
1320
1271
|
attach = attachMethod.bind(this);
|
|
1321
1272
|
checkout = checkoutMethod.bind(this);
|
|
1322
1273
|
cancel = cancelMethod.bind(this);
|
|
@@ -1902,6 +1853,7 @@ var useEntityBase = ({
|
|
|
1902
1853
|
};
|
|
1903
1854
|
const { data, error, isLoading, mutate } = (0, import_swr2.default)(queryKey, fetchEntity, {
|
|
1904
1855
|
fallbackData: null,
|
|
1856
|
+
shouldRetryOnError: false,
|
|
1905
1857
|
onErrorRetry: (error2, key, config) => {
|
|
1906
1858
|
if (error2.code == "entity_not_found") {
|
|
1907
1859
|
return false;
|
|
@@ -2,23 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
useEntity
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-W3YUWXSL.mjs";
|
|
6
|
+
import "../chunk-6PLIVXZY.mjs";
|
|
7
|
+
import "../chunk-7YNNQGHZ.mjs";
|
|
8
|
+
import "../chunk-AUZMXLNB.mjs";
|
|
9
|
+
import "../chunk-5LRBYZUD.mjs";
|
|
10
|
+
import "../chunk-NJRJLNGW.mjs";
|
|
11
|
+
import "../chunk-XGIQOMYH.mjs";
|
|
12
|
+
import "../chunk-LS2RW6JG.mjs";
|
|
13
|
+
import "../chunk-V575SGOW.mjs";
|
|
14
|
+
import "../chunk-SUENW2KS.mjs";
|
|
12
15
|
import "../chunk-JVCOY7ZL.mjs";
|
|
13
16
|
import "../chunk-CIBQ4BJU.mjs";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-V575SGOW.mjs";
|
|
16
|
-
import "../chunk-ZV4RPZTM.mjs";
|
|
17
|
-
import "../chunk-5LYLN4C2.mjs";
|
|
18
|
-
import "../chunk-VTGR7VVK.mjs";
|
|
17
|
+
import "../chunk-SFOIZTAS.mjs";
|
|
19
18
|
import "../chunk-WFFVOEUG.mjs";
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-KQT5G3HT.mjs";
|
|
19
|
+
import "../chunk-OYBOLAL5.mjs";
|
|
22
20
|
export {
|
|
23
21
|
useEntity
|
|
24
22
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
|
-
import { a as CheckResult } from '../genTypes-
|
|
3
|
-
import { E as Entity, A as AutumnPromise } from '../entTypes-
|
|
2
|
+
import { a as CheckResult } from '../genTypes-B5_6Pu_4.mjs';
|
|
3
|
+
import { E as Entity, A as AutumnPromise } from '../entTypes-35x0LnYH.mjs';
|
|
4
4
|
import { GetEntityParams } from '../client/types/clientEntTypes.mjs';
|
|
5
5
|
import { AutumnContextParams } from '../AutumnContext.mjs';
|
|
6
6
|
import { CheckParams, CancelParams, TrackParams } from '../client/types/clientGenTypes.mjs';
|
|
7
7
|
import { AttachParams } from '../client/types/clientAttachTypes.mjs';
|
|
8
|
-
import '../prodTypes-
|
|
8
|
+
import '../prodTypes-C4aZSZfO.mjs';
|
|
9
9
|
import 'zod/v4';
|
|
10
10
|
import '../error-DHbclCVh.mjs';
|
|
11
|
-
import '../cusTypes-
|
|
11
|
+
import '../cusTypes-RU0fmR-t.mjs';
|
|
12
12
|
import 'react';
|
|
13
|
-
import '../ReactAutumnClient-
|
|
14
|
-
import '../attachTypes-
|
|
13
|
+
import '../ReactAutumnClient-DuYr1i4C.mjs';
|
|
14
|
+
import '../attachTypes-DbuZWzAP.mjs';
|
|
15
15
|
|
|
16
16
|
declare const useEntityBase: ({ entityId, params, AutumnContext, }: {
|
|
17
17
|
entityId: string | null;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
|
-
import { a as CheckResult } from '../genTypes-
|
|
3
|
-
import { E as Entity, A as AutumnPromise } from '../entTypes
|
|
2
|
+
import { a as CheckResult } from '../genTypes-CY6GNiAn.js';
|
|
3
|
+
import { E as Entity, A as AutumnPromise } from '../entTypes-n2T2wpRx.js';
|
|
4
4
|
import { GetEntityParams } from '../client/types/clientEntTypes.js';
|
|
5
5
|
import { AutumnContextParams } from '../AutumnContext.js';
|
|
6
6
|
import { CheckParams, CancelParams, TrackParams } from '../client/types/clientGenTypes.js';
|
|
7
7
|
import { AttachParams } from '../client/types/clientAttachTypes.js';
|
|
8
|
-
import '../prodTypes-
|
|
8
|
+
import '../prodTypes-C4aZSZfO.js';
|
|
9
9
|
import 'zod/v4';
|
|
10
10
|
import '../error-DHbclCVh.js';
|
|
11
|
-
import '../cusTypes-
|
|
11
|
+
import '../cusTypes-D3QQXjif.js';
|
|
12
12
|
import 'react';
|
|
13
|
-
import '../ReactAutumnClient-
|
|
14
|
-
import '../attachTypes-
|
|
13
|
+
import '../ReactAutumnClient-DkAcY1X2.js';
|
|
14
|
+
import '../attachTypes-CKp1KMwX.js';
|
|
15
15
|
|
|
16
16
|
declare const useEntityBase: ({ entityId, params, AutumnContext, }: {
|
|
17
17
|
entityId: string | null;
|
|
@@ -368,14 +368,6 @@ var toContainerResult = async ({
|
|
|
368
368
|
}
|
|
369
369
|
} catch (error2) {
|
|
370
370
|
throw error2;
|
|
371
|
-
return {
|
|
372
|
-
data: null,
|
|
373
|
-
error: new AutumnError({
|
|
374
|
-
message: "Failed to parse JSON response from Autumn",
|
|
375
|
-
code: "internal_error"
|
|
376
|
-
}),
|
|
377
|
-
statusCode: response.status
|
|
378
|
-
};
|
|
379
371
|
}
|
|
380
372
|
return {
|
|
381
373
|
data: null,
|
|
@@ -387,7 +379,7 @@ var toContainerResult = async ({
|
|
|
387
379
|
};
|
|
388
380
|
}
|
|
389
381
|
try {
|
|
390
|
-
|
|
382
|
+
const data = await response.json();
|
|
391
383
|
return {
|
|
392
384
|
data,
|
|
393
385
|
error: null,
|
|
@@ -395,14 +387,6 @@ var toContainerResult = async ({
|
|
|
395
387
|
};
|
|
396
388
|
} catch (error) {
|
|
397
389
|
throw error;
|
|
398
|
-
return {
|
|
399
|
-
data: null,
|
|
400
|
-
error: new AutumnError({
|
|
401
|
-
message: "Failed to parse Autumn API response",
|
|
402
|
-
code: "internal_error"
|
|
403
|
-
}),
|
|
404
|
-
statusCode: response?.status
|
|
405
|
-
};
|
|
406
390
|
}
|
|
407
391
|
};
|
|
408
392
|
|
|
@@ -1030,12 +1014,6 @@ var logFetchError = ({
|
|
|
1030
1014
|
2. Check that autumnHandler is correctly registered on your backend.`);
|
|
1031
1015
|
};
|
|
1032
1016
|
|
|
1033
|
-
// src/libraries/react/client/clientCompMethods.ts
|
|
1034
|
-
async function getPricingTableMethod() {
|
|
1035
|
-
const res = await this.get(`${this.prefix}/components/pricing_table`);
|
|
1036
|
-
return res;
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
1017
|
// src/libraries/react/client/clientCusMethods.ts
|
|
1040
1018
|
var createCustomerMethod = async ({
|
|
1041
1019
|
client,
|
|
@@ -1045,27 +1023,6 @@ var createCustomerMethod = async ({
|
|
|
1045
1023
|
return result;
|
|
1046
1024
|
};
|
|
1047
1025
|
|
|
1048
|
-
// src/libraries/react/utils/toSnakeCase.ts
|
|
1049
|
-
function stringToSnakeCase(str) {
|
|
1050
|
-
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
|
|
1051
|
-
}
|
|
1052
|
-
var toSnakeCase = (obj, excludeKeys) => {
|
|
1053
|
-
if (Array.isArray(obj)) {
|
|
1054
|
-
return obj.map((item) => toSnakeCase(item, excludeKeys));
|
|
1055
|
-
} else if (obj !== null && typeof obj === "object") {
|
|
1056
|
-
return Object.fromEntries(
|
|
1057
|
-
Object.entries(obj).map(([key, value]) => {
|
|
1058
|
-
const snakeKey = stringToSnakeCase(key);
|
|
1059
|
-
if (excludeKeys && excludeKeys.includes(key)) {
|
|
1060
|
-
return [snakeKey, value];
|
|
1061
|
-
}
|
|
1062
|
-
return [snakeKey, toSnakeCase(value, excludeKeys)];
|
|
1063
|
-
})
|
|
1064
|
-
);
|
|
1065
|
-
}
|
|
1066
|
-
return obj;
|
|
1067
|
-
};
|
|
1068
|
-
|
|
1069
1026
|
// src/utils/entityUtils.tsx
|
|
1070
1027
|
var getEntityExpandStr = (expand) => {
|
|
1071
1028
|
if (!expand) {
|
|
@@ -1076,13 +1033,11 @@ var getEntityExpandStr = (expand) => {
|
|
|
1076
1033
|
|
|
1077
1034
|
// src/libraries/react/client/clientEntityMethods.ts
|
|
1078
1035
|
async function createEntityMethod(params) {
|
|
1079
|
-
|
|
1080
|
-
const res = await this.post(`${this.prefix}/entities`, snakeParams);
|
|
1036
|
+
const res = await this.post(`${this.prefix}/entities`, params);
|
|
1081
1037
|
return res;
|
|
1082
1038
|
}
|
|
1083
1039
|
async function getEntityMethod(entityId, params) {
|
|
1084
|
-
|
|
1085
|
-
let expand = getEntityExpandStr(params?.expand);
|
|
1040
|
+
const expand = getEntityExpandStr(params?.expand);
|
|
1086
1041
|
const res = await this.get(`${this.prefix}/entities/${entityId}?${expand}`);
|
|
1087
1042
|
return res;
|
|
1088
1043
|
}
|
|
@@ -1093,44 +1048,39 @@ async function deleteEntityMethod(entityId) {
|
|
|
1093
1048
|
|
|
1094
1049
|
// src/libraries/react/client/clientGenMethods.ts
|
|
1095
1050
|
async function checkoutMethod(params) {
|
|
1096
|
-
|
|
1097
|
-
const res = await this.post(`${this.prefix}/checkout`, snakeParams);
|
|
1051
|
+
const res = await this.post(`${this.prefix}/checkout`, params);
|
|
1098
1052
|
return res;
|
|
1099
1053
|
}
|
|
1100
1054
|
async function attachMethod(params) {
|
|
1101
|
-
|
|
1102
|
-
const res = await this.post(`${this.prefix}/attach`, snakeParams);
|
|
1055
|
+
const res = await this.post(`${this.prefix}/attach`, params);
|
|
1103
1056
|
return res;
|
|
1104
1057
|
}
|
|
1105
1058
|
async function setupPaymentMethod(params) {
|
|
1106
|
-
|
|
1107
|
-
const res = await this.post(`${this.prefix}/setup_payment`, snakeParams);
|
|
1059
|
+
const res = await this.post(`${this.prefix}/setup_payment`, params);
|
|
1108
1060
|
return res;
|
|
1109
1061
|
}
|
|
1110
1062
|
async function cancelMethod(params) {
|
|
1111
|
-
|
|
1112
|
-
const res = await this.post(`${this.prefix}/cancel`, snakeParams);
|
|
1063
|
+
const res = await this.post(`${this.prefix}/cancel`, params);
|
|
1113
1064
|
return res;
|
|
1114
1065
|
}
|
|
1115
1066
|
async function checkMethod(params) {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1067
|
+
const noDialogParams = {
|
|
1068
|
+
...params,
|
|
1069
|
+
dialog: void 0
|
|
1070
|
+
};
|
|
1071
|
+
const res = await this.post(`${this.prefix}/check`, noDialogParams);
|
|
1119
1072
|
return res;
|
|
1120
1073
|
}
|
|
1121
1074
|
async function trackMethod(params) {
|
|
1122
|
-
|
|
1123
|
-
const res = await this.post(`${this.prefix}/track`, snakeParams);
|
|
1075
|
+
const res = await this.post(`${this.prefix}/track`, params);
|
|
1124
1076
|
return res;
|
|
1125
1077
|
}
|
|
1126
1078
|
async function openBillingPortalMethod(params) {
|
|
1127
|
-
|
|
1128
|
-
const res = await this.post(`${this.prefix}/billing_portal`, snakeParams);
|
|
1079
|
+
const res = await this.post(`${this.prefix}/billing_portal`, params || {});
|
|
1129
1080
|
return res;
|
|
1130
1081
|
}
|
|
1131
1082
|
async function queryMethod(params) {
|
|
1132
|
-
|
|
1133
|
-
const res = await this.post(`${this.prefix}/query`, snakeParams);
|
|
1083
|
+
const res = await this.post(`${this.prefix}/query`, params);
|
|
1134
1084
|
return res;
|
|
1135
1085
|
}
|
|
1136
1086
|
|
|
@@ -1142,13 +1092,11 @@ async function listProductsMethod() {
|
|
|
1142
1092
|
|
|
1143
1093
|
// src/libraries/react/client/clientReferralMethods.ts
|
|
1144
1094
|
async function createCode(params) {
|
|
1145
|
-
|
|
1146
|
-
const res = await this.post(`${this.prefix}/referrals/code`, snakeParams);
|
|
1095
|
+
const res = await this.post(`${this.prefix}/referrals/code`, params);
|
|
1147
1096
|
return res;
|
|
1148
1097
|
}
|
|
1149
1098
|
async function redeemCode(params) {
|
|
1150
|
-
|
|
1151
|
-
const res = await this.post(`${this.prefix}/referrals/redeem`, snakeParams);
|
|
1099
|
+
const res = await this.post(`${this.prefix}/referrals/redeem`, params);
|
|
1152
1100
|
return res;
|
|
1153
1101
|
}
|
|
1154
1102
|
|
|
@@ -1159,7 +1107,9 @@ var AutumnClient = class {
|
|
|
1159
1107
|
customerData;
|
|
1160
1108
|
includeCredentials;
|
|
1161
1109
|
prefix;
|
|
1110
|
+
camelCase;
|
|
1162
1111
|
headers;
|
|
1112
|
+
framework;
|
|
1163
1113
|
constructor({
|
|
1164
1114
|
backendUrl,
|
|
1165
1115
|
getBearerToken,
|
|
@@ -1173,11 +1123,15 @@ var AutumnClient = class {
|
|
|
1173
1123
|
this.customerData = customerData;
|
|
1174
1124
|
this.includeCredentials = includeCredentials;
|
|
1175
1125
|
this.prefix = "/api/autumn";
|
|
1126
|
+
let camelCase = false;
|
|
1176
1127
|
if (betterAuthUrl) {
|
|
1177
1128
|
this.prefix = "/api/auth/autumn";
|
|
1178
1129
|
this.backendUrl = betterAuthUrl;
|
|
1130
|
+
camelCase = true;
|
|
1179
1131
|
}
|
|
1180
1132
|
this.headers = headers;
|
|
1133
|
+
if (betterAuthUrl) camelCase = true;
|
|
1134
|
+
this.camelCase = camelCase;
|
|
1181
1135
|
}
|
|
1182
1136
|
/**
|
|
1183
1137
|
* Detects if the backend supports CORS credentials by making an OPTIONS request
|
|
@@ -1195,7 +1149,7 @@ var AutumnClient = class {
|
|
|
1195
1149
|
body: JSON.stringify({})
|
|
1196
1150
|
});
|
|
1197
1151
|
return { valid: true, includeCredentials: true };
|
|
1198
|
-
} catch (
|
|
1152
|
+
} catch (_) {
|
|
1199
1153
|
try {
|
|
1200
1154
|
await fetch(testEndpoint, {
|
|
1201
1155
|
method: "POST",
|
|
@@ -1204,7 +1158,7 @@ var AutumnClient = class {
|
|
|
1204
1158
|
body: JSON.stringify({})
|
|
1205
1159
|
});
|
|
1206
1160
|
return { valid: true, includeCredentials: false };
|
|
1207
|
-
} catch (
|
|
1161
|
+
} catch (_2) {
|
|
1208
1162
|
return { valid: false, includeCredentials: void 0 };
|
|
1209
1163
|
}
|
|
1210
1164
|
}
|
|
@@ -1241,9 +1195,9 @@ var AutumnClient = class {
|
|
|
1241
1195
|
};
|
|
1242
1196
|
if (this.getBearerToken) {
|
|
1243
1197
|
try {
|
|
1244
|
-
|
|
1198
|
+
const token = await this.getBearerToken();
|
|
1245
1199
|
headers.Authorization = `Bearer ${token}`;
|
|
1246
|
-
} catch (
|
|
1200
|
+
} catch (_) {
|
|
1247
1201
|
console.error(`Failed to call getToken() in AutumnProvider`);
|
|
1248
1202
|
}
|
|
1249
1203
|
}
|
|
@@ -1257,15 +1211,15 @@ var AutumnClient = class {
|
|
|
1257
1211
|
method,
|
|
1258
1212
|
body
|
|
1259
1213
|
}) {
|
|
1260
|
-
body = method === "POST" ?
|
|
1214
|
+
body = method === "POST" ? {
|
|
1261
1215
|
...body,
|
|
1262
|
-
customer_data: this.customerData || void 0
|
|
1263
|
-
}
|
|
1216
|
+
[this.camelCase ? "customerData" : "customer_data"]: this.customerData || void 0
|
|
1217
|
+
} : void 0;
|
|
1264
1218
|
const includeCredentials = await this.shouldIncludeCredentials();
|
|
1265
1219
|
try {
|
|
1266
1220
|
const response = await fetch(`${this.backendUrl}${path}`, {
|
|
1267
1221
|
method,
|
|
1268
|
-
body,
|
|
1222
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
1269
1223
|
headers: await this.getHeaders(),
|
|
1270
1224
|
credentials: includeCredentials ? "include" : "omit"
|
|
1271
1225
|
});
|
|
@@ -1285,7 +1239,7 @@ var AutumnClient = class {
|
|
|
1285
1239
|
return {
|
|
1286
1240
|
data: null,
|
|
1287
1241
|
error: new AutumnError({
|
|
1288
|
-
message: error.message,
|
|
1242
|
+
message: error instanceof Error ? error.message : JSON.stringify(error),
|
|
1289
1243
|
code: "fetch_failed"
|
|
1290
1244
|
})
|
|
1291
1245
|
};
|
|
@@ -1316,9 +1270,6 @@ var AutumnClient = class {
|
|
|
1316
1270
|
params
|
|
1317
1271
|
});
|
|
1318
1272
|
}
|
|
1319
|
-
async getPricingTable() {
|
|
1320
|
-
return await getPricingTableMethod.bind(this)();
|
|
1321
|
-
}
|
|
1322
1273
|
attach = attachMethod.bind(this);
|
|
1323
1274
|
checkout = checkoutMethod.bind(this);
|
|
1324
1275
|
cancel = cancelMethod.bind(this);
|
|
@@ -1900,6 +1851,7 @@ var useEntityBase = ({
|
|
|
1900
1851
|
};
|
|
1901
1852
|
const { data, error, isLoading, mutate } = (0, import_swr2.default)(queryKey, fetchEntity, {
|
|
1902
1853
|
fallbackData: null,
|
|
1854
|
+
shouldRetryOnError: false,
|
|
1903
1855
|
onErrorRetry: (error2, key, config) => {
|
|
1904
1856
|
if (error2.code == "entity_not_found") {
|
|
1905
1857
|
return false;
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
useEntityBase
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-6PLIVXZY.mjs";
|
|
6
|
+
import "../chunk-7YNNQGHZ.mjs";
|
|
7
|
+
import "../chunk-AUZMXLNB.mjs";
|
|
8
|
+
import "../chunk-5LRBYZUD.mjs";
|
|
9
|
+
import "../chunk-NJRJLNGW.mjs";
|
|
10
|
+
import "../chunk-XGIQOMYH.mjs";
|
|
11
|
+
import "../chunk-LS2RW6JG.mjs";
|
|
12
|
+
import "../chunk-V575SGOW.mjs";
|
|
13
|
+
import "../chunk-SUENW2KS.mjs";
|
|
11
14
|
import "../chunk-JVCOY7ZL.mjs";
|
|
12
15
|
import "../chunk-CIBQ4BJU.mjs";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-V575SGOW.mjs";
|
|
15
|
-
import "../chunk-ZV4RPZTM.mjs";
|
|
16
|
-
import "../chunk-5LYLN4C2.mjs";
|
|
17
|
-
import "../chunk-VTGR7VVK.mjs";
|
|
16
|
+
import "../chunk-SFOIZTAS.mjs";
|
|
18
17
|
import "../chunk-WFFVOEUG.mjs";
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-KQT5G3HT.mjs";
|
|
18
|
+
import "../chunk-OYBOLAL5.mjs";
|
|
21
19
|
export {
|
|
22
20
|
useEntityBase
|
|
23
21
|
};
|