autumn-js 0.0.41 → 0.0.44
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/{chunk-UD4U5ECV.mjs → chunk-BQYMRMGB.mjs} +1 -1
- package/dist/libraries/backend/{chunk-7SOQYC4B.mjs → chunk-DXILLNEF.mjs} +1 -2
- package/dist/libraries/backend/{chunk-XPNATE4H.mjs → chunk-LRE7V775.mjs} +1 -1
- package/dist/libraries/backend/{chunk-V7VIK7Q2.mjs → chunk-OMSV2SEC.mjs} +4 -3
- package/dist/libraries/backend/{chunk-GA6SKSWH.mjs → chunk-U357CO3L.mjs} +4 -4
- package/dist/libraries/backend/{entTypes-BHLroNdS.d.mts → client-C4aZxBxK.d.mts} +34 -28
- package/dist/libraries/backend/{entTypes-BJGM9Knl.d.ts → client-DJJAbrX7.d.ts} +34 -28
- package/dist/libraries/backend/express.js +4 -4
- package/dist/libraries/backend/express.mjs +5 -5
- package/dist/libraries/backend/fastify.js +4 -4
- package/dist/libraries/backend/fastify.mjs +5 -5
- package/dist/libraries/backend/hono.js +4 -4
- package/dist/libraries/backend/hono.mjs +5 -5
- package/dist/libraries/backend/next.js +4 -4
- package/dist/libraries/backend/next.mjs +5 -5
- package/dist/libraries/backend/remix.js +4 -4
- package/dist/libraries/backend/remix.mjs +5 -5
- package/dist/libraries/backend/routes/backendRouter.d.mts +1 -1
- package/dist/libraries/backend/routes/backendRouter.d.ts +1 -1
- package/dist/libraries/backend/routes/backendRouter.js +4 -4
- package/dist/libraries/backend/routes/backendRouter.mjs +5 -5
- package/dist/libraries/backend/routes/entityRoutes.js +4 -4
- package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/genRoutes.js +4 -4
- package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
- package/dist/libraries/backend/tanstack.js +4 -4
- package/dist/libraries/backend/tanstack.mjs +5 -5
- package/dist/libraries/backend/utils/AuthFunction.d.mts +1 -1
- package/dist/libraries/backend/utils/AuthFunction.d.ts +1 -1
- package/dist/libraries/backend/utils/backendRes.js +1 -2
- package/dist/libraries/backend/utils/backendRes.mjs +1 -1
- package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
- package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
- package/dist/libraries/backend/utils/withAuth.js +4 -4
- package/dist/libraries/backend/utils/withAuth.mjs +2 -2
- package/dist/libraries/react/AutumnContext.d.mts +2 -2
- package/dist/libraries/react/AutumnContext.d.ts +2 -2
- package/dist/libraries/react/AutumnContext.js +1 -2
- package/dist/libraries/react/AutumnContext.mjs +3 -3
- package/dist/libraries/react/BaseAutumnProvider.d.mts +2 -2
- package/dist/libraries/react/BaseAutumnProvider.d.ts +2 -2
- package/dist/libraries/react/BaseAutumnProvider.js +1 -2
- package/dist/libraries/react/BaseAutumnProvider.mjs +6 -6
- package/dist/libraries/react/{ReactAutumnClient-C5hkD9_F.d.ts → ReactAutumnClient-CXWgmZSf.d.ts} +1 -1
- package/dist/libraries/react/{ReactAutumnClient-Cs1RcVVR.d.mts → ReactAutumnClient-b8N5xZyk.d.mts} +1 -1
- package/dist/libraries/react/ReactAutumnProvider.js +1 -2
- package/dist/libraries/react/ReactAutumnProvider.mjs +7 -7
- package/dist/libraries/react/{chunk-K474E7RH.mjs → chunk-2Z7EC4JM.mjs} +1 -1
- package/dist/libraries/react/{chunk-GPMSGEWX.mjs → chunk-3PQR35T5.mjs} +1 -2
- package/dist/libraries/react/{chunk-ZQ2RGBVJ.mjs → chunk-4G7CGF2R.mjs} +1 -1
- package/dist/libraries/react/{chunk-XM7R467K.mjs → chunk-D2YRPPOL.mjs} +2 -2
- package/dist/libraries/react/{chunk-ARMMM4EO.mjs → chunk-ELS2JOCO.mjs} +3 -3
- package/dist/libraries/react/{chunk-ZOWIALGE.mjs → chunk-NHKT224P.mjs} +1 -1
- package/dist/libraries/react/{chunk-2BGH4NXG.mjs → chunk-R3TB4JFJ.mjs} +1 -1
- package/dist/libraries/react/{chunk-K6GCHMT7.mjs → chunk-RLTE5H53.mjs} +8 -12
- package/dist/libraries/react/{chunk-4WRDLT7W.mjs → chunk-VXGVATJ5.mjs} +1 -1
- package/dist/libraries/react/{chunk-PQ443EFR.mjs → chunk-VY7I5OWG.mjs} +1 -1
- package/dist/libraries/react/{chunk-QFMVIMZ4.mjs → chunk-YF5TB4XK.mjs} +1 -1
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +2 -2
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +2 -2
- package/dist/libraries/react/client/ReactAutumnClient.js +1 -2
- package/dist/libraries/react/client/ReactAutumnClient.mjs +2 -2
- package/dist/libraries/react/client/clientCompMethods.d.mts +2 -2
- package/dist/libraries/react/client/clientCompMethods.d.ts +2 -2
- package/dist/libraries/react/client/clientCusMethods.d.mts +2 -2
- package/dist/libraries/react/client/clientCusMethods.d.ts +2 -2
- package/dist/libraries/react/client/clientEntityMethods.d.mts +2 -2
- package/dist/libraries/react/client/clientEntityMethods.d.ts +2 -2
- package/dist/libraries/react/client/clientGenMethods.d.mts +2 -2
- package/dist/libraries/react/client/clientGenMethods.d.ts +2 -2
- package/dist/libraries/react/client/types/clientEntTypes.d.mts +5 -1
- package/dist/libraries/react/client/types/clientEntTypes.d.ts +5 -1
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +5 -0
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +5 -0
- package/dist/libraries/react/hooks/useAutumn.d.mts +2 -1
- package/dist/libraries/react/hooks/useAutumn.d.ts +2 -1
- package/dist/libraries/react/hooks/useAutumn.js +8 -13
- package/dist/libraries/react/hooks/useAutumn.mjs +4 -4
- package/dist/libraries/react/hooks/useCustomer.d.mts +12 -12
- package/dist/libraries/react/hooks/useCustomer.d.ts +12 -12
- package/dist/libraries/react/hooks/useCustomer.js +1 -2
- package/dist/libraries/react/hooks/useCustomer.mjs +4 -4
- package/dist/libraries/react/hooks/useCustomerProvider.d.mts +2 -2
- package/dist/libraries/react/hooks/useCustomerProvider.d.ts +2 -2
- package/dist/libraries/react/hooks/useEntity.js +1 -2
- package/dist/libraries/react/hooks/useEntity.mjs +4 -4
- package/dist/libraries/react/hooks/useEntityProvider.d.mts +2 -2
- package/dist/libraries/react/hooks/useEntityProvider.d.ts +2 -2
- package/dist/libraries/react/hooks/useEntityProvider.js +1 -2
- package/dist/libraries/react/hooks/useEntityProvider.mjs +2 -2
- package/dist/libraries/react/hooks/usePricingTable.js +1 -2
- package/dist/libraries/react/hooks/usePricingTable.mjs +4 -4
- package/dist/libraries/react/hooks/usePricingTableProvider.d.mts +2 -2
- package/dist/libraries/react/hooks/usePricingTableProvider.d.ts +2 -2
- package/dist/libraries/react/hooks/usePricingTableProvider.js +1 -2
- package/dist/libraries/react/hooks/usePricingTableProvider.mjs +2 -2
- package/dist/libraries/react/index.d.mts +5 -5
- package/dist/libraries/react/index.d.ts +5 -5
- package/dist/libraries/react/index.js +8 -13
- package/dist/libraries/react/index.mjs +11 -11
- package/dist/libraries/react/{response-DSY82HjT.d.mts → response-T-FFa-qt.d.mts} +0 -1
- package/dist/libraries/react/{response-DGkb5pA9.d.ts → response-muDt0SJZ.d.ts} +0 -1
- package/dist/next/client/clientUtils.d.mts +1 -1
- package/dist/next/client/clientUtils.d.ts +1 -1
- package/dist/next/client/clientUtils.js +4 -2
- package/dist/next/client/clientUtils.mjs +4 -2
- package/dist/next/client/hooks/types.d.mts +2 -23
- package/dist/next/client/hooks/types.d.ts +2 -23
- package/dist/next/client/hooks/useAutumn.d.mts +5 -3
- package/dist/next/client/hooks/useAutumn.d.ts +5 -3
- package/dist/next/client/hooks/useAutumn.js +24 -9
- package/dist/next/client/hooks/useAutumn.mjs +24 -9
- package/dist/next/client/hooks/useCustomer.d.mts +1 -1
- package/dist/next/client/hooks/useCustomer.d.ts +1 -1
- package/dist/next/client/hooks/useCustomer.js +1 -1
- package/dist/next/client/hooks/useCustomer.mjs +1 -1
- package/dist/next/client/hooks/useEntity.js +1 -1
- package/dist/next/client/hooks/useEntity.mjs +1 -1
- package/dist/next/client/types-B7efCges.d.mts +29 -0
- package/dist/next/client/types-B7efCges.d.ts +29 -0
- package/dist/next/index.d.mts +11 -3
- package/dist/next/index.d.ts +11 -3
- package/dist/next/server/cusActions.d.mts +2 -29
- package/dist/next/server/cusActions.d.ts +2 -29
- package/dist/next/server/genActions.d.mts +13 -2
- package/dist/next/server/genActions.d.ts +13 -2
- package/dist/next/server/genActions.js +25 -10
- package/dist/next/server/genActions.mjs +25 -10
- package/dist/next/server/{genTypes-faVFtUHP.d.ts → genTypes-DNndDcib.d.mts} +36 -3
- package/dist/next/server/{genTypes-C1alamyV.d.mts → genTypes-DaYkl9Ex.d.ts} +36 -3
- package/dist/sdk/{entTypes-B07YrTT7.d.mts → entTypes-DAoQnp8D.d.mts} +5 -1
- package/dist/sdk/{entTypes-DS32o2jz.d.ts → entTypes-oQpX0x_Y.d.ts} +5 -1
- package/dist/sdk/entities.d.mts +1 -1
- package/dist/sdk/entities.d.ts +1 -1
- package/dist/sdk/general.d.mts +11 -8
- package/dist/sdk/general.d.ts +11 -8
- package/dist/sdk/index.d.mts +2 -2
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.js +1 -2
- package/dist/sdk/index.mjs +1 -2
- package/dist/utils/encryptUtils.js +1 -2
- package/dist/utils/encryptUtils.mjs +1 -2
- package/package.json +1 -1
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
useAutumn
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RLTE5H53.mjs";
|
|
6
6
|
import {
|
|
7
7
|
useCustomer
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VXGVATJ5.mjs";
|
|
9
9
|
import {
|
|
10
10
|
useEntity
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YF5TB4XK.mjs";
|
|
12
12
|
import "./chunk-VN4AVW2V.mjs";
|
|
13
13
|
import {
|
|
14
14
|
usePricingTable
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4G7CGF2R.mjs";
|
|
16
16
|
import {
|
|
17
17
|
ReactAutumnProvider
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-D2YRPPOL.mjs";
|
|
19
|
+
import "./chunk-ELS2JOCO.mjs";
|
|
20
|
+
import "./chunk-NHKT224P.mjs";
|
|
21
21
|
import "./chunk-PIIGEXKQ.mjs";
|
|
22
22
|
import "./chunk-4QPHNIQ7.mjs";
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-R3TB4JFJ.mjs";
|
|
24
|
+
import "./chunk-2Z7EC4JM.mjs";
|
|
25
|
+
import "./chunk-VY7I5OWG.mjs";
|
|
26
26
|
import "./chunk-LS3NB4DU.mjs";
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-3PQR35T5.mjs";
|
|
28
28
|
import "./chunk-NZ5PEXT2.mjs";
|
|
29
29
|
import "./chunk-TGX6UKKS.mjs";
|
|
30
30
|
import "./chunk-4KKWHG2V.mjs";
|
|
@@ -5,7 +5,7 @@ declare const toClientErrorResponse: (error: any) => {
|
|
|
5
5
|
data: null;
|
|
6
6
|
error: AutumnClientError;
|
|
7
7
|
};
|
|
8
|
-
declare const toClientError: (error: any) => AutumnClientError;
|
|
8
|
+
declare const toClientError: (error: any, log?: boolean) => AutumnClientError;
|
|
9
9
|
declare const fetchPricingTableData: ({ setIsLoading, setError, setProducts, encryptedCustomerId, }: {
|
|
10
10
|
setIsLoading?: (isLoading: boolean) => void;
|
|
11
11
|
setError?: (error: any) => void;
|
|
@@ -5,7 +5,7 @@ declare const toClientErrorResponse: (error: any) => {
|
|
|
5
5
|
data: null;
|
|
6
6
|
error: AutumnClientError;
|
|
7
7
|
};
|
|
8
|
-
declare const toClientError: (error: any) => AutumnClientError;
|
|
8
|
+
declare const toClientError: (error: any, log?: boolean) => AutumnClientError;
|
|
9
9
|
declare const fetchPricingTableData: ({ setIsLoading, setError, setProducts, encryptedCustomerId, }: {
|
|
10
10
|
setIsLoading?: (isLoading: boolean) => void;
|
|
11
11
|
setError?: (error: any) => void;
|
|
@@ -17,7 +17,7 @@ const toClientErrorResponse = (error) => {
|
|
|
17
17
|
error: new AutumnClientError({ message: msg, code })
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
const toClientError = (error) => {
|
|
20
|
+
const toClientError = (error, log = true) => {
|
|
21
21
|
let msg = "Unknown error";
|
|
22
22
|
let code = "unknown";
|
|
23
23
|
if (error?.message) {
|
|
@@ -26,7 +26,9 @@ const toClientError = (error) => {
|
|
|
26
26
|
if (error?.code) {
|
|
27
27
|
code = error.code;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
if (log) {
|
|
30
|
+
console.error("Autumn Error: ", msg);
|
|
31
|
+
}
|
|
30
32
|
return new AutumnClientError({ message: msg, code });
|
|
31
33
|
};
|
|
32
34
|
const fetchPricingTableData = async ({
|
|
@@ -17,7 +17,7 @@ const toClientErrorResponse = (error) => {
|
|
|
17
17
|
error: new AutumnClientError({ message: msg, code })
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
const toClientError = (error) => {
|
|
20
|
+
const toClientError = (error, log = true) => {
|
|
21
21
|
let msg = "Unknown error";
|
|
22
22
|
let code = "unknown";
|
|
23
23
|
if (error?.message) {
|
|
@@ -26,7 +26,9 @@ const toClientError = (error) => {
|
|
|
26
26
|
if (error?.code) {
|
|
27
27
|
code = error.code;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
if (log) {
|
|
30
|
+
console.error("Autumn Error: ", msg);
|
|
31
|
+
}
|
|
30
32
|
return new AutumnClientError({ message: msg, code });
|
|
31
33
|
};
|
|
32
34
|
const fetchPricingTableData = async ({
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
interface AttachParams {
|
|
4
|
-
productId: string;
|
|
5
|
-
entityId?: string;
|
|
6
|
-
options?: {
|
|
7
|
-
featureId: string;
|
|
8
|
-
quantity: number;
|
|
9
|
-
}[];
|
|
10
|
-
successUrl?: string;
|
|
11
|
-
forceCheckout?: boolean;
|
|
12
|
-
metadata?: Record<string, string>;
|
|
13
|
-
dialog?: () => JSX.Element | react__default.ReactNode;
|
|
14
|
-
callback?: () => Promise<void>;
|
|
15
|
-
withPreview?: "formatted" | "raw";
|
|
16
|
-
}
|
|
17
|
-
interface CreateEntityParams {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
featureId: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type { AttachParams, CreateEntityParams };
|
|
1
|
+
import 'react';
|
|
2
|
+
export { A as AttachParams, C as CreateEntityParams } from '../types-B7efCges.mjs';
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
interface AttachParams {
|
|
4
|
-
productId: string;
|
|
5
|
-
entityId?: string;
|
|
6
|
-
options?: {
|
|
7
|
-
featureId: string;
|
|
8
|
-
quantity: number;
|
|
9
|
-
}[];
|
|
10
|
-
successUrl?: string;
|
|
11
|
-
forceCheckout?: boolean;
|
|
12
|
-
metadata?: Record<string, string>;
|
|
13
|
-
dialog?: () => JSX.Element | react__default.ReactNode;
|
|
14
|
-
callback?: () => Promise<void>;
|
|
15
|
-
withPreview?: "formatted" | "raw";
|
|
16
|
-
}
|
|
17
|
-
interface CreateEntityParams {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
featureId: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type { AttachParams, CreateEntityParams };
|
|
1
|
+
import 'react';
|
|
2
|
+
export { A as AttachParams, C as CreateEntityParams } from '../types-B7efCges.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AttachParams } from '
|
|
1
|
+
import { E as EntityDataParams, A as AttachParams } from '../types-B7efCges.mjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
|
|
4
4
|
interface TrackParams {
|
|
@@ -7,11 +7,12 @@ interface TrackParams {
|
|
|
7
7
|
entityId?: string;
|
|
8
8
|
value?: number;
|
|
9
9
|
idempotencyKey?: string;
|
|
10
|
+
entityData?: EntityDataParams;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
declare const useAutumn: () => {
|
|
13
|
-
attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
|
|
14
|
-
check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
|
|
14
|
+
attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, entityData, }: AttachParams) => Promise<any>;
|
|
15
|
+
check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, entityData, }: {
|
|
15
16
|
featureId?: string;
|
|
16
17
|
productId?: string;
|
|
17
18
|
entityId?: string;
|
|
@@ -19,6 +20,7 @@ declare const useAutumn: () => {
|
|
|
19
20
|
sendEvent?: boolean;
|
|
20
21
|
withPreview?: "formatted" | "raw";
|
|
21
22
|
dialog?: (data: any) => JSX.Element | React.ReactNode;
|
|
23
|
+
entityData?: EntityDataParams;
|
|
22
24
|
}) => Promise<any>;
|
|
23
25
|
track: (params: TrackParams) => Promise<any>;
|
|
24
26
|
cancel: ({ productId, entityId, }: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AttachParams } from '
|
|
1
|
+
import { E as EntityDataParams, A as AttachParams } from '../types-B7efCges.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
|
|
4
4
|
interface TrackParams {
|
|
@@ -7,11 +7,12 @@ interface TrackParams {
|
|
|
7
7
|
entityId?: string;
|
|
8
8
|
value?: number;
|
|
9
9
|
idempotencyKey?: string;
|
|
10
|
+
entityData?: EntityDataParams;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
declare const useAutumn: () => {
|
|
13
|
-
attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
|
|
14
|
-
check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
|
|
14
|
+
attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, entityData, }: AttachParams) => Promise<any>;
|
|
15
|
+
check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, entityData, }: {
|
|
15
16
|
featureId?: string;
|
|
16
17
|
productId?: string;
|
|
17
18
|
entityId?: string;
|
|
@@ -19,6 +20,7 @@ declare const useAutumn: () => {
|
|
|
19
20
|
sendEvent?: boolean;
|
|
20
21
|
withPreview?: "formatted" | "raw";
|
|
21
22
|
dialog?: (data: any) => JSX.Element | React.ReactNode;
|
|
23
|
+
entityData?: EntityDataParams;
|
|
22
24
|
}) => Promise<any>;
|
|
23
25
|
track: (params: TrackParams) => Promise<any>;
|
|
24
26
|
cancel: ({ productId, entityId, }: {
|
|
@@ -33,7 +33,8 @@ const useAutumn = () => {
|
|
|
33
33
|
successUrl,
|
|
34
34
|
forceCheckout,
|
|
35
35
|
metadata,
|
|
36
|
-
callback
|
|
36
|
+
callback,
|
|
37
|
+
entityData
|
|
37
38
|
}) => {
|
|
38
39
|
const attachWithoutDialog = async (options) => {
|
|
39
40
|
try {
|
|
@@ -43,7 +44,8 @@ const useAutumn = () => {
|
|
|
43
44
|
options,
|
|
44
45
|
successUrl,
|
|
45
46
|
forceCheckout,
|
|
46
|
-
metadata
|
|
47
|
+
metadata,
|
|
48
|
+
entityData
|
|
47
49
|
});
|
|
48
50
|
} catch (error2) {
|
|
49
51
|
return toClientErrorResponse(error2);
|
|
@@ -79,7 +81,8 @@ const useAutumn = () => {
|
|
|
79
81
|
forceCheckout,
|
|
80
82
|
metadata,
|
|
81
83
|
dialog,
|
|
82
|
-
callback
|
|
84
|
+
callback,
|
|
85
|
+
entityData
|
|
83
86
|
}) => {
|
|
84
87
|
if (dialog) {
|
|
85
88
|
setProdChangeComponent(dialog);
|
|
@@ -89,7 +92,8 @@ const useAutumn = () => {
|
|
|
89
92
|
successUrl,
|
|
90
93
|
forceCheckout,
|
|
91
94
|
metadata,
|
|
92
|
-
callback
|
|
95
|
+
callback,
|
|
96
|
+
entityData
|
|
93
97
|
});
|
|
94
98
|
}
|
|
95
99
|
let snakeOptions = options?.map((option) => ({
|
|
@@ -103,7 +107,8 @@ const useAutumn = () => {
|
|
|
103
107
|
options: snakeOptions,
|
|
104
108
|
successUrl,
|
|
105
109
|
forceCheckout,
|
|
106
|
-
metadata
|
|
110
|
+
metadata,
|
|
111
|
+
entityData
|
|
107
112
|
});
|
|
108
113
|
if (result.error) {
|
|
109
114
|
return toClientErrorResponse(result.error);
|
|
@@ -151,7 +156,8 @@ const useAutumn = () => {
|
|
|
151
156
|
requiredQuantity,
|
|
152
157
|
sendEvent,
|
|
153
158
|
withPreview,
|
|
154
|
-
dialog
|
|
159
|
+
dialog,
|
|
160
|
+
entityData
|
|
155
161
|
}) => {
|
|
156
162
|
if (dialog) {
|
|
157
163
|
setPaywallComponent(dialog);
|
|
@@ -163,7 +169,8 @@ const useAutumn = () => {
|
|
|
163
169
|
entityId,
|
|
164
170
|
requiredQuantity,
|
|
165
171
|
sendEvent,
|
|
166
|
-
withPreview: dialog ? "formatted" : withPreview
|
|
172
|
+
withPreview: dialog ? "formatted" : withPreview,
|
|
173
|
+
entityData
|
|
167
174
|
});
|
|
168
175
|
if (res.error) {
|
|
169
176
|
return toClientErrorResponse(res.error);
|
|
@@ -179,14 +186,22 @@ const useAutumn = () => {
|
|
|
179
186
|
return res;
|
|
180
187
|
};
|
|
181
188
|
const track = async (params) => {
|
|
182
|
-
const {
|
|
189
|
+
const {
|
|
190
|
+
featureId,
|
|
191
|
+
entityId,
|
|
192
|
+
value,
|
|
193
|
+
eventName,
|
|
194
|
+
idempotencyKey,
|
|
195
|
+
entityData
|
|
196
|
+
} = params;
|
|
183
197
|
const res = await trackAction({
|
|
184
198
|
encryptedCustomerId,
|
|
185
199
|
featureId,
|
|
186
200
|
entityId,
|
|
187
201
|
value,
|
|
188
202
|
eventName,
|
|
189
|
-
idempotencyKey
|
|
203
|
+
idempotencyKey,
|
|
204
|
+
entityData
|
|
190
205
|
});
|
|
191
206
|
if (res.error) {
|
|
192
207
|
return toClientErrorResponse(res.error);
|
|
@@ -33,7 +33,8 @@ const useAutumn = () => {
|
|
|
33
33
|
successUrl,
|
|
34
34
|
forceCheckout,
|
|
35
35
|
metadata,
|
|
36
|
-
callback
|
|
36
|
+
callback,
|
|
37
|
+
entityData
|
|
37
38
|
}) => {
|
|
38
39
|
const attachWithoutDialog = async (options) => {
|
|
39
40
|
try {
|
|
@@ -43,7 +44,8 @@ const useAutumn = () => {
|
|
|
43
44
|
options,
|
|
44
45
|
successUrl,
|
|
45
46
|
forceCheckout,
|
|
46
|
-
metadata
|
|
47
|
+
metadata,
|
|
48
|
+
entityData
|
|
47
49
|
});
|
|
48
50
|
} catch (error2) {
|
|
49
51
|
return toClientErrorResponse(error2);
|
|
@@ -79,7 +81,8 @@ const useAutumn = () => {
|
|
|
79
81
|
forceCheckout,
|
|
80
82
|
metadata,
|
|
81
83
|
dialog,
|
|
82
|
-
callback
|
|
84
|
+
callback,
|
|
85
|
+
entityData
|
|
83
86
|
}) => {
|
|
84
87
|
if (dialog) {
|
|
85
88
|
setProdChangeComponent(dialog);
|
|
@@ -89,7 +92,8 @@ const useAutumn = () => {
|
|
|
89
92
|
successUrl,
|
|
90
93
|
forceCheckout,
|
|
91
94
|
metadata,
|
|
92
|
-
callback
|
|
95
|
+
callback,
|
|
96
|
+
entityData
|
|
93
97
|
});
|
|
94
98
|
}
|
|
95
99
|
let snakeOptions = options?.map((option) => ({
|
|
@@ -103,7 +107,8 @@ const useAutumn = () => {
|
|
|
103
107
|
options: snakeOptions,
|
|
104
108
|
successUrl,
|
|
105
109
|
forceCheckout,
|
|
106
|
-
metadata
|
|
110
|
+
metadata,
|
|
111
|
+
entityData
|
|
107
112
|
});
|
|
108
113
|
if (result.error) {
|
|
109
114
|
return toClientErrorResponse(result.error);
|
|
@@ -151,7 +156,8 @@ const useAutumn = () => {
|
|
|
151
156
|
requiredQuantity,
|
|
152
157
|
sendEvent,
|
|
153
158
|
withPreview,
|
|
154
|
-
dialog
|
|
159
|
+
dialog,
|
|
160
|
+
entityData
|
|
155
161
|
}) => {
|
|
156
162
|
if (dialog) {
|
|
157
163
|
setPaywallComponent(dialog);
|
|
@@ -163,7 +169,8 @@ const useAutumn = () => {
|
|
|
163
169
|
entityId,
|
|
164
170
|
requiredQuantity,
|
|
165
171
|
sendEvent,
|
|
166
|
-
withPreview: dialog ? "formatted" : withPreview
|
|
172
|
+
withPreview: dialog ? "formatted" : withPreview,
|
|
173
|
+
entityData
|
|
167
174
|
});
|
|
168
175
|
if (res.error) {
|
|
169
176
|
return toClientErrorResponse(res.error);
|
|
@@ -179,14 +186,22 @@ const useAutumn = () => {
|
|
|
179
186
|
return res;
|
|
180
187
|
};
|
|
181
188
|
const track = async (params) => {
|
|
182
|
-
const {
|
|
189
|
+
const {
|
|
190
|
+
featureId,
|
|
191
|
+
entityId,
|
|
192
|
+
value,
|
|
193
|
+
eventName,
|
|
194
|
+
idempotencyKey,
|
|
195
|
+
entityData
|
|
196
|
+
} = params;
|
|
183
197
|
const res = await trackAction({
|
|
184
198
|
encryptedCustomerId,
|
|
185
199
|
featureId,
|
|
186
200
|
entityId,
|
|
187
201
|
value,
|
|
188
202
|
eventName,
|
|
189
|
-
idempotencyKey
|
|
203
|
+
idempotencyKey,
|
|
204
|
+
entityData
|
|
190
205
|
});
|
|
191
206
|
if (res.error) {
|
|
192
207
|
return toClientErrorResponse(res.error);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as CustomerExpandOption, C as CustomerData, b as Customer } from '../cusTypes-DsDs_Qyb.mjs';
|
|
2
|
-
import { CreateEntityParams } from '
|
|
2
|
+
import { C as CreateEntityParams } from '../types-B7efCges.mjs';
|
|
3
3
|
import { a as AutumnClientError } from '../types-Cx_JFSer.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as CustomerExpandOption, C as CustomerData, b as Customer } from '../cusTypes-DsDs_Qyb.js';
|
|
2
|
-
import { CreateEntityParams } from '
|
|
2
|
+
import { C as CreateEntityParams } from '../types-B7efCges.js';
|
|
3
3
|
import { a as AutumnClientError } from '../types-B0ocZ_8d.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface EntityDataParams {
|
|
4
|
+
name?: string;
|
|
5
|
+
featureId: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface AttachParams {
|
|
9
|
+
productId: string;
|
|
10
|
+
entityId?: string;
|
|
11
|
+
options?: {
|
|
12
|
+
featureId: string;
|
|
13
|
+
quantity: number;
|
|
14
|
+
}[];
|
|
15
|
+
successUrl?: string;
|
|
16
|
+
forceCheckout?: boolean;
|
|
17
|
+
metadata?: Record<string, string>;
|
|
18
|
+
dialog?: () => JSX.Element | react__default.ReactNode;
|
|
19
|
+
callback?: () => Promise<void>;
|
|
20
|
+
withPreview?: "formatted" | "raw";
|
|
21
|
+
entityData?: EntityDataParams;
|
|
22
|
+
}
|
|
23
|
+
interface CreateEntityParams {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
featureId: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { AttachParams as A, CreateEntityParams as C, EntityDataParams as E };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface EntityDataParams {
|
|
4
|
+
name?: string;
|
|
5
|
+
featureId: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface AttachParams {
|
|
9
|
+
productId: string;
|
|
10
|
+
entityId?: string;
|
|
11
|
+
options?: {
|
|
12
|
+
featureId: string;
|
|
13
|
+
quantity: number;
|
|
14
|
+
}[];
|
|
15
|
+
successUrl?: string;
|
|
16
|
+
forceCheckout?: boolean;
|
|
17
|
+
metadata?: Record<string, string>;
|
|
18
|
+
dialog?: () => JSX.Element | react__default.ReactNode;
|
|
19
|
+
callback?: () => Promise<void>;
|
|
20
|
+
withPreview?: "formatted" | "raw";
|
|
21
|
+
entityData?: EntityDataParams;
|
|
22
|
+
}
|
|
23
|
+
interface CreateEntityParams {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
featureId: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { AttachParams as A, CreateEntityParams as C, EntityDataParams as E };
|
package/dist/next/index.d.mts
CHANGED
|
@@ -3,6 +3,11 @@ import React__default from 'react';
|
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { NextRequest, NextResponse } from 'next/server';
|
|
5
5
|
|
|
6
|
+
interface EntityDataParams {
|
|
7
|
+
name?: string;
|
|
8
|
+
featureId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
interface AttachParams {
|
|
7
12
|
productId: string;
|
|
8
13
|
entityId?: string;
|
|
@@ -16,6 +21,7 @@ interface AttachParams {
|
|
|
16
21
|
dialog?: () => JSX.Element | React__default.ReactNode;
|
|
17
22
|
callback?: () => Promise<void>;
|
|
18
23
|
withPreview?: "formatted" | "raw";
|
|
24
|
+
entityData?: EntityDataParams;
|
|
19
25
|
}
|
|
20
26
|
interface CreateEntityParams {
|
|
21
27
|
id: string;
|
|
@@ -29,11 +35,12 @@ interface TrackParams {
|
|
|
29
35
|
entityId?: string;
|
|
30
36
|
value?: number;
|
|
31
37
|
idempotencyKey?: string;
|
|
38
|
+
entityData?: EntityDataParams;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
declare const useAutumn: () => {
|
|
35
|
-
attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
|
|
36
|
-
check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
|
|
42
|
+
attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, entityData, }: AttachParams) => Promise<any>;
|
|
43
|
+
check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, entityData, }: {
|
|
37
44
|
featureId?: string;
|
|
38
45
|
productId?: string;
|
|
39
46
|
entityId?: string;
|
|
@@ -41,6 +48,7 @@ declare const useAutumn: () => {
|
|
|
41
48
|
sendEvent?: boolean;
|
|
42
49
|
withPreview?: "formatted" | "raw";
|
|
43
50
|
dialog?: (data: any) => JSX.Element | React.ReactNode;
|
|
51
|
+
entityData?: EntityDataParams;
|
|
44
52
|
}) => Promise<any>;
|
|
45
53
|
track: (params: TrackParams) => Promise<any>;
|
|
46
54
|
cancel: ({ productId, entityId, }: {
|
|
@@ -270,7 +278,7 @@ interface AutumnProviderProps {
|
|
|
270
278
|
declare const AutumnProvider: ({ customerId, customerData, authPlugin, children, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
|
|
271
279
|
|
|
272
280
|
type AuthResult = Promise<{
|
|
273
|
-
customerId
|
|
281
|
+
customerId?: string;
|
|
274
282
|
customerData?: {
|
|
275
283
|
name?: string;
|
|
276
284
|
email?: string;
|
package/dist/next/index.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import React__default from 'react';
|
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { NextRequest, NextResponse } from 'next/server';
|
|
5
5
|
|
|
6
|
+
interface EntityDataParams {
|
|
7
|
+
name?: string;
|
|
8
|
+
featureId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
interface AttachParams {
|
|
7
12
|
productId: string;
|
|
8
13
|
entityId?: string;
|
|
@@ -16,6 +21,7 @@ interface AttachParams {
|
|
|
16
21
|
dialog?: () => JSX.Element | React__default.ReactNode;
|
|
17
22
|
callback?: () => Promise<void>;
|
|
18
23
|
withPreview?: "formatted" | "raw";
|
|
24
|
+
entityData?: EntityDataParams;
|
|
19
25
|
}
|
|
20
26
|
interface CreateEntityParams {
|
|
21
27
|
id: string;
|
|
@@ -29,11 +35,12 @@ interface TrackParams {
|
|
|
29
35
|
entityId?: string;
|
|
30
36
|
value?: number;
|
|
31
37
|
idempotencyKey?: string;
|
|
38
|
+
entityData?: EntityDataParams;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
declare const useAutumn: () => {
|
|
35
|
-
attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
|
|
36
|
-
check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
|
|
42
|
+
attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, entityData, }: AttachParams) => Promise<any>;
|
|
43
|
+
check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, entityData, }: {
|
|
37
44
|
featureId?: string;
|
|
38
45
|
productId?: string;
|
|
39
46
|
entityId?: string;
|
|
@@ -41,6 +48,7 @@ declare const useAutumn: () => {
|
|
|
41
48
|
sendEvent?: boolean;
|
|
42
49
|
withPreview?: "formatted" | "raw";
|
|
43
50
|
dialog?: (data: any) => JSX.Element | React.ReactNode;
|
|
51
|
+
entityData?: EntityDataParams;
|
|
44
52
|
}) => Promise<any>;
|
|
45
53
|
track: (params: TrackParams) => Promise<any>;
|
|
46
54
|
cancel: ({ productId, entityId, }: {
|
|
@@ -270,7 +278,7 @@ interface AutumnProviderProps {
|
|
|
270
278
|
declare const AutumnProvider: ({ customerId, customerData, authPlugin, children, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
|
|
271
279
|
|
|
272
280
|
type AuthResult = Promise<{
|
|
273
|
-
customerId
|
|
281
|
+
customerId?: string;
|
|
274
282
|
customerData?: {
|
|
275
283
|
name?: string;
|
|
276
284
|
email?: string;
|