autumn-js 0.0.13 → 0.0.22
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/README.md +1 -2
- package/dist/next/AutumnProvider.js +3 -1
- package/dist/next/AutumnProvider.mjs +3 -1
- package/dist/next/client/AutumnContext.d.mts +2 -4
- package/dist/next/client/AutumnContext.d.ts +2 -4
- package/dist/next/client/AutumnContext.js +3 -0
- package/dist/next/client/AutumnContext.mjs +3 -0
- package/dist/next/client/AutumnProvider.d.mts +5 -1
- package/dist/next/client/AutumnProvider.d.ts +5 -1
- package/dist/next/client/AutumnProvider.js +77 -6
- package/dist/next/client/AutumnProvider.mjs +77 -6
- package/dist/next/client/{error-BUtm1Pks.d.mts → error-CG2LXoa7.d.mts} +1 -1
- package/dist/next/client/{error-BUtm1Pks.d.ts → error-CG2LXoa7.d.ts} +1 -1
- package/dist/next/client/hooks/types.d.mts +14 -0
- package/dist/next/client/hooks/types.d.ts +14 -0
- package/dist/next/client/hooks/types.js +2 -0
- package/dist/next/client/hooks/types.mjs +2 -0
- package/dist/next/client/hooks/useAutumn.d.mts +38 -33
- package/dist/next/client/hooks/useAutumn.d.ts +38 -33
- package/dist/next/client/hooks/useAutumn.js +162 -41
- package/dist/next/client/hooks/useAutumn.mjs +162 -41
- package/dist/next/client/hooks/useCustomer.d.mts +4 -6
- package/dist/next/client/hooks/useCustomer.d.ts +4 -6
- package/dist/next/client/hooks/useCustomer.js +15 -4
- package/dist/next/client/hooks/useCustomer.mjs +15 -4
- package/dist/next/client/hooks/usePricingTable.d.mts +36 -0
- package/dist/next/client/hooks/usePricingTable.d.ts +36 -0
- package/dist/next/client/hooks/usePricingTable.js +65 -0
- package/dist/next/client/hooks/usePricingTable.mjs +65 -0
- package/dist/next/client/types.d.mts +12 -1
- package/dist/next/client/types.d.ts +12 -1
- package/dist/next/client/types.js +20 -0
- package/dist/next/client/types.mjs +20 -0
- package/dist/next/index.d.mts +102 -102
- package/dist/next/index.d.ts +102 -102
- package/dist/next/index.js +2 -0
- package/dist/next/index.mjs +1 -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 +21 -0
- package/dist/next/server/auth/clerk-wrapper.mjs +21 -0
- package/dist/next/server/auth/handleAuthProvider.d.mts +5 -23
- package/dist/next/server/auth/handleAuthProvider.d.ts +5 -23
- package/dist/next/server/auth/handleAuthProvider.js +4 -10
- package/dist/next/server/auth/handleAuthProvider.mjs +4 -10
- package/dist/next/server/auth/supabase-wrapper.js +44 -0
- package/dist/next/server/auth/supabase-wrapper.mjs +44 -0
- package/dist/next/server/auth/withAuth.d.mts +6 -2
- package/dist/next/server/auth/withAuth.d.ts +6 -2
- package/dist/next/server/auth/withAuth.js +5 -1
- package/dist/next/server/auth/withAuth.mjs +5 -1
- package/dist/next/server/componentActions.d.mts +11 -0
- package/dist/next/server/componentActions.d.ts +11 -0
- package/dist/next/server/componentActions.js +21 -0
- package/dist/next/server/componentActions.mjs +21 -0
- package/dist/next/server/cusActions.d.mts +7 -27
- package/dist/next/server/cusActions.d.ts +7 -27
- package/dist/next/server/cusActions.js +13 -10
- package/dist/next/server/cusActions.mjs +13 -10
- package/dist/next/server/{cusTypes-G4c15fDy.d.mts → cusTypes-B9N9G7Vr.d.mts} +1 -1
- package/dist/next/server/{cusTypes-G4c15fDy.d.ts → cusTypes-B9N9G7Vr.d.ts} +1 -1
- package/dist/next/server/genActions.d.mts +3 -2
- package/dist/next/server/genActions.d.ts +3 -2
- package/dist/next/server/genActions.js +37 -26
- package/dist/next/server/genActions.mjs +37 -26
- package/dist/next/server/{genTypes-B-HSg3vG.d.mts → genTypes-BDibiu0E.d.ts} +2 -1
- package/dist/next/server/{genTypes-OgZRrjL_.d.ts → genTypes-DDkwFU_V.d.mts} +2 -1
- package/dist/next/server/response-CmSY57k6.d.mts +26 -0
- package/dist/next/server/response-CmSY57k6.d.ts +26 -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/next/{AutumnServer.js → webpack-ignore.js} +13 -16
- package/dist/next/webpack-ignore.mjs +13 -0
- package/dist/sdk/general.d.mts +1 -0
- package/dist/sdk/general.d.ts +1 -0
- package/dist/sdk/index.d.mts +29 -3
- package/dist/sdk/index.d.ts +29 -3
- package/dist/sdk/index.js +48 -2
- package/dist/sdk/index.mjs +48 -3
- package/dist/sdk/products.d.mts +3 -1
- package/dist/sdk/products.d.ts +3 -1
- package/dist/utils/encryptUtils.js +330 -3
- package/dist/utils/encryptUtils.mjs +330 -3
- package/package.json +10 -3
- package/tsup.config.ts +8 -0
- package/dist/next/AutumnServer.mjs +0 -12
- package/dist/next/server/auth/utils.js +0 -25
- package/dist/next/server/auth/utils.mjs +0 -25
- package/dist/sdk/cusTypes-BxbYGvfU.d.mts +0 -68
- package/dist/sdk/cusTypes-CcZ5ZhSo.d.ts +0 -68
- package/tsconfig.json +0 -25
- /package/dist/next/server/auth/{utils.d.mts → supabase-wrapper.d.mts} +0 -0
- /package/dist/next/server/auth/{utils.d.ts → supabase-wrapper.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -76,11 +76,10 @@ export default function RootLayout({
|
|
|
76
76
|
import { useAutumn } from 'autumn-js/next'
|
|
77
77
|
|
|
78
78
|
export default function BillingPage() {
|
|
79
|
-
const {
|
|
79
|
+
const { attach, openBillingPortal } = useAutumn()
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
82
|
<div>
|
|
83
|
-
<h1>Welcome {customer?.name}</h1>
|
|
84
83
|
<button onClick={() => openBillingPortal()}>
|
|
85
84
|
Manage Billing
|
|
86
85
|
</button>
|
|
@@ -29,7 +29,8 @@ const AutumnProvider = ({
|
|
|
29
29
|
customerId,
|
|
30
30
|
customerData,
|
|
31
31
|
authPlugin,
|
|
32
|
-
children
|
|
32
|
+
children,
|
|
33
|
+
components
|
|
33
34
|
}) => {
|
|
34
35
|
if (typeof window !== "undefined") {
|
|
35
36
|
throw new Error(
|
|
@@ -48,6 +49,7 @@ const AutumnProvider = ({
|
|
|
48
49
|
{
|
|
49
50
|
encryptedCustomerId,
|
|
50
51
|
customerData,
|
|
52
|
+
components,
|
|
51
53
|
children
|
|
52
54
|
}
|
|
53
55
|
);
|
|
@@ -6,7 +6,8 @@ const AutumnProvider = ({
|
|
|
6
6
|
customerId,
|
|
7
7
|
customerData,
|
|
8
8
|
authPlugin,
|
|
9
|
-
children
|
|
9
|
+
children,
|
|
10
|
+
components
|
|
10
11
|
}) => {
|
|
11
12
|
if (typeof window !== "undefined") {
|
|
12
13
|
throw new Error(
|
|
@@ -25,6 +26,7 @@ const AutumnProvider = ({
|
|
|
25
26
|
{
|
|
26
27
|
encryptedCustomerId,
|
|
27
28
|
customerData,
|
|
29
|
+
components,
|
|
28
30
|
children
|
|
29
31
|
}
|
|
30
32
|
);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { AutumnContextParams } from './types.mjs';
|
|
3
|
-
import './cusTypes-BUiIMwvu.mjs';
|
|
4
2
|
|
|
5
|
-
declare const AutumnContext: react.Context<
|
|
6
|
-
declare const useAutumnContext: () =>
|
|
3
|
+
declare const AutumnContext: react.Context<any>;
|
|
4
|
+
declare const useAutumnContext: () => any;
|
|
7
5
|
|
|
8
6
|
export { AutumnContext, useAutumnContext };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { AutumnContextParams } from './types.js';
|
|
3
|
-
import './cusTypes-BUiIMwvu.js';
|
|
4
2
|
|
|
5
|
-
declare const AutumnContext: react.Context<
|
|
6
|
-
declare const useAutumnContext: () =>
|
|
3
|
+
declare const AutumnContext: react.Context<any>;
|
|
4
|
+
declare const useAutumnContext: () => any;
|
|
7
5
|
|
|
8
6
|
export { AutumnContext, useAutumnContext };
|
|
@@ -5,7 +5,11 @@ interface AutumnProviderProps {
|
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
encryptedCustomerId?: string;
|
|
7
7
|
customerData?: CustomerData;
|
|
8
|
+
components?: {
|
|
9
|
+
paywallDialog?: any;
|
|
10
|
+
productChangeDialog?: any;
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
|
-
declare const AutumnClientProvider: ({ children, encryptedCustomerId, customerData, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
|
|
13
|
+
declare const AutumnClientProvider: ({ children, encryptedCustomerId, customerData, components, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
|
|
10
14
|
|
|
11
15
|
export { AutumnClientProvider, type AutumnProviderProps };
|
|
@@ -5,7 +5,11 @@ interface AutumnProviderProps {
|
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
encryptedCustomerId?: string;
|
|
7
7
|
customerData?: CustomerData;
|
|
8
|
+
components?: {
|
|
9
|
+
paywallDialog?: any;
|
|
10
|
+
productChangeDialog?: any;
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
|
-
declare const AutumnClientProvider: ({ children, encryptedCustomerId, customerData, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
|
|
13
|
+
declare const AutumnClientProvider: ({ children, encryptedCustomerId, customerData, components, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
|
|
10
14
|
|
|
11
15
|
export { AutumnClientProvider, type AutumnProviderProps };
|
|
@@ -1,24 +1,95 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { AutumnContext } from "./AutumnContext";
|
|
5
|
-
import { useState } from "react";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
const useDialog = (component) => {
|
|
7
|
+
const [dialogFound, setDialogFound] = useState(false);
|
|
8
|
+
const [dialogProps, setDialogProps] = useState(null);
|
|
9
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (dialogProps) {
|
|
12
|
+
setDialogOpen(true);
|
|
13
|
+
}
|
|
14
|
+
}, [dialogProps]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!dialogOpen) {
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
setDialogProps(null);
|
|
19
|
+
}, 200);
|
|
20
|
+
}
|
|
21
|
+
}, [dialogOpen]);
|
|
22
|
+
const loadDialog = async () => {
|
|
23
|
+
if (component) {
|
|
24
|
+
setDialogFound(true);
|
|
25
|
+
} else {
|
|
26
|
+
setDialogFound(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
loadDialog();
|
|
31
|
+
}, []);
|
|
32
|
+
return [dialogFound, dialogProps, setDialogProps, dialogOpen, setDialogOpen];
|
|
33
|
+
};
|
|
6
34
|
const AutumnClientProvider = ({
|
|
7
35
|
children,
|
|
8
36
|
encryptedCustomerId,
|
|
9
|
-
customerData
|
|
37
|
+
customerData,
|
|
38
|
+
components
|
|
10
39
|
}) => {
|
|
11
40
|
let [customer, setCustomer] = useState(null);
|
|
12
|
-
|
|
41
|
+
const [
|
|
42
|
+
prodChangeDialogFound,
|
|
43
|
+
prodChangeDialogProps,
|
|
44
|
+
setProdChangeDialogProps,
|
|
45
|
+
prodChangeDialogOpen,
|
|
46
|
+
setProdChangeDialogOpen
|
|
47
|
+
] = useDialog(components?.productChangeDialog);
|
|
48
|
+
const [
|
|
49
|
+
paywallFound,
|
|
50
|
+
paywallProps,
|
|
51
|
+
setPaywallProps,
|
|
52
|
+
paywallOpen,
|
|
53
|
+
setPaywallOpen
|
|
54
|
+
] = useDialog(components?.paywallDialog);
|
|
55
|
+
return /* @__PURE__ */ jsxs(
|
|
13
56
|
AutumnContext.Provider,
|
|
14
57
|
{
|
|
15
58
|
value: {
|
|
16
59
|
encryptedCustomerId,
|
|
17
60
|
customerData,
|
|
18
61
|
customer,
|
|
19
|
-
setCustomer
|
|
62
|
+
setCustomer,
|
|
63
|
+
prodChangeDialog: {
|
|
64
|
+
found: prodChangeDialogFound,
|
|
65
|
+
setProps: setProdChangeDialogProps,
|
|
66
|
+
setOpen: setProdChangeDialogOpen
|
|
67
|
+
},
|
|
68
|
+
paywallDialog: {
|
|
69
|
+
found: paywallFound,
|
|
70
|
+
setProps: setPaywallProps,
|
|
71
|
+
setOpen: setPaywallOpen
|
|
72
|
+
}
|
|
20
73
|
},
|
|
21
|
-
children
|
|
74
|
+
children: [
|
|
75
|
+
components?.productChangeDialog && /* @__PURE__ */ jsx(
|
|
76
|
+
components.productChangeDialog,
|
|
77
|
+
{
|
|
78
|
+
open: prodChangeDialogOpen,
|
|
79
|
+
setOpen: setProdChangeDialogOpen,
|
|
80
|
+
...prodChangeDialogProps
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
components?.paywallDialog && /* @__PURE__ */ jsx(
|
|
84
|
+
components.paywallDialog,
|
|
85
|
+
{
|
|
86
|
+
open: paywallOpen,
|
|
87
|
+
setOpen: setPaywallOpen,
|
|
88
|
+
...paywallProps
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
children
|
|
92
|
+
]
|
|
22
93
|
}
|
|
23
94
|
);
|
|
24
95
|
};
|
|
@@ -1,24 +1,95 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { AutumnContext } from "./AutumnContext";
|
|
5
|
-
import { useState } from "react";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
const useDialog = (component) => {
|
|
7
|
+
const [dialogFound, setDialogFound] = useState(false);
|
|
8
|
+
const [dialogProps, setDialogProps] = useState(null);
|
|
9
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (dialogProps) {
|
|
12
|
+
setDialogOpen(true);
|
|
13
|
+
}
|
|
14
|
+
}, [dialogProps]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!dialogOpen) {
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
setDialogProps(null);
|
|
19
|
+
}, 200);
|
|
20
|
+
}
|
|
21
|
+
}, [dialogOpen]);
|
|
22
|
+
const loadDialog = async () => {
|
|
23
|
+
if (component) {
|
|
24
|
+
setDialogFound(true);
|
|
25
|
+
} else {
|
|
26
|
+
setDialogFound(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
loadDialog();
|
|
31
|
+
}, []);
|
|
32
|
+
return [dialogFound, dialogProps, setDialogProps, dialogOpen, setDialogOpen];
|
|
33
|
+
};
|
|
6
34
|
const AutumnClientProvider = ({
|
|
7
35
|
children,
|
|
8
36
|
encryptedCustomerId,
|
|
9
|
-
customerData
|
|
37
|
+
customerData,
|
|
38
|
+
components
|
|
10
39
|
}) => {
|
|
11
40
|
let [customer, setCustomer] = useState(null);
|
|
12
|
-
|
|
41
|
+
const [
|
|
42
|
+
prodChangeDialogFound,
|
|
43
|
+
prodChangeDialogProps,
|
|
44
|
+
setProdChangeDialogProps,
|
|
45
|
+
prodChangeDialogOpen,
|
|
46
|
+
setProdChangeDialogOpen
|
|
47
|
+
] = useDialog(components?.productChangeDialog);
|
|
48
|
+
const [
|
|
49
|
+
paywallFound,
|
|
50
|
+
paywallProps,
|
|
51
|
+
setPaywallProps,
|
|
52
|
+
paywallOpen,
|
|
53
|
+
setPaywallOpen
|
|
54
|
+
] = useDialog(components?.paywallDialog);
|
|
55
|
+
return /* @__PURE__ */ jsxs(
|
|
13
56
|
AutumnContext.Provider,
|
|
14
57
|
{
|
|
15
58
|
value: {
|
|
16
59
|
encryptedCustomerId,
|
|
17
60
|
customerData,
|
|
18
61
|
customer,
|
|
19
|
-
setCustomer
|
|
62
|
+
setCustomer,
|
|
63
|
+
prodChangeDialog: {
|
|
64
|
+
found: prodChangeDialogFound,
|
|
65
|
+
setProps: setProdChangeDialogProps,
|
|
66
|
+
setOpen: setProdChangeDialogOpen
|
|
67
|
+
},
|
|
68
|
+
paywallDialog: {
|
|
69
|
+
found: paywallFound,
|
|
70
|
+
setProps: setPaywallProps,
|
|
71
|
+
setOpen: setPaywallOpen
|
|
72
|
+
}
|
|
20
73
|
},
|
|
21
|
-
children
|
|
74
|
+
children: [
|
|
75
|
+
components?.productChangeDialog && /* @__PURE__ */ jsx(
|
|
76
|
+
components.productChangeDialog,
|
|
77
|
+
{
|
|
78
|
+
open: prodChangeDialogOpen,
|
|
79
|
+
setOpen: setProdChangeDialogOpen,
|
|
80
|
+
...prodChangeDialogProps
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
components?.paywallDialog && /* @__PURE__ */ jsx(
|
|
84
|
+
components.paywallDialog,
|
|
85
|
+
{
|
|
86
|
+
open: paywallOpen,
|
|
87
|
+
setOpen: setPaywallOpen,
|
|
88
|
+
...paywallProps
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
children
|
|
92
|
+
]
|
|
22
93
|
}
|
|
23
94
|
);
|
|
24
95
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface AttachParams {
|
|
2
|
+
dialog?: boolean;
|
|
3
|
+
productId: string;
|
|
4
|
+
options?: {
|
|
5
|
+
featureId: string;
|
|
6
|
+
quantity: number;
|
|
7
|
+
}[];
|
|
8
|
+
successUrl?: string;
|
|
9
|
+
forceCheckout?: boolean;
|
|
10
|
+
metadata?: Record<string, string>;
|
|
11
|
+
callback?: () => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type { AttachParams };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface AttachParams {
|
|
2
|
+
dialog?: boolean;
|
|
3
|
+
productId: string;
|
|
4
|
+
options?: {
|
|
5
|
+
featureId: string;
|
|
6
|
+
quantity: number;
|
|
7
|
+
}[];
|
|
8
|
+
successUrl?: string;
|
|
9
|
+
forceCheckout?: boolean;
|
|
10
|
+
metadata?: Record<string, string>;
|
|
11
|
+
callback?: () => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type { AttachParams };
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import { A as AutumnError } from '../error-
|
|
2
|
-
import {
|
|
1
|
+
import { A as AutumnError } from '../error-CG2LXoa7.mjs';
|
|
2
|
+
import { AttachParams } from './types.mjs';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
forceCheckout?: boolean;
|
|
20
|
-
metadata?: Record<string, string>;
|
|
4
|
+
declare const useAutumn: () => {
|
|
5
|
+
attach: ({ dialog, productId, options, successUrl, forceCheckout, metadata, callback, }: AttachParams) => Promise<any>;
|
|
6
|
+
check: ({ dialog, featureId, productId, requiredQuantity, sendEvent, }: {
|
|
7
|
+
dialog?: boolean;
|
|
8
|
+
featureId?: string;
|
|
9
|
+
productId?: string;
|
|
10
|
+
requiredQuantity?: number;
|
|
11
|
+
sendEvent?: boolean;
|
|
12
|
+
}) => Promise<any>;
|
|
13
|
+
track: ({ featureId, value, }: {
|
|
14
|
+
featureId: string;
|
|
15
|
+
value?: number;
|
|
16
|
+
}) => Promise<any>;
|
|
17
|
+
openBillingPortal: (options?: {
|
|
18
|
+
returnUrl?: string;
|
|
21
19
|
}) => Promise<any>;
|
|
22
20
|
/**
|
|
23
21
|
* @deprecated Use track({featureId, value}) instead.
|
|
@@ -34,19 +32,26 @@ declare const useAutumn: (options?: UseAutumnOptions) => {
|
|
|
34
32
|
entitled: ({ featureId }: {
|
|
35
33
|
featureId: string;
|
|
36
34
|
}) => Promise<any>;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use the useCustomer() hook instead.
|
|
37
|
+
* This property is deprecated and will be removed in a future version.
|
|
38
|
+
*/
|
|
39
|
+
customer: any;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use the useCustomer() hook instead.
|
|
42
|
+
* This property is deprecated and will be removed in a future version.
|
|
43
|
+
*/
|
|
44
|
+
loading: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use the useCustomer() hook instead.
|
|
47
|
+
* This property is deprecated and will be removed in a future version.
|
|
48
|
+
*/
|
|
49
|
+
error: AutumnError | null;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Use the useCustomer() hook instead.
|
|
52
|
+
* This property is deprecated and will be removed in a future version.
|
|
53
|
+
*/
|
|
54
|
+
refetch: () => Promise<void>;
|
|
50
55
|
};
|
|
51
56
|
|
|
52
|
-
export {
|
|
57
|
+
export { useAutumn };
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import { A as AutumnError } from '../error-
|
|
2
|
-
import {
|
|
1
|
+
import { A as AutumnError } from '../error-CG2LXoa7.js';
|
|
2
|
+
import { AttachParams } from './types.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
forceCheckout?: boolean;
|
|
20
|
-
metadata?: Record<string, string>;
|
|
4
|
+
declare const useAutumn: () => {
|
|
5
|
+
attach: ({ dialog, productId, options, successUrl, forceCheckout, metadata, callback, }: AttachParams) => Promise<any>;
|
|
6
|
+
check: ({ dialog, featureId, productId, requiredQuantity, sendEvent, }: {
|
|
7
|
+
dialog?: boolean;
|
|
8
|
+
featureId?: string;
|
|
9
|
+
productId?: string;
|
|
10
|
+
requiredQuantity?: number;
|
|
11
|
+
sendEvent?: boolean;
|
|
12
|
+
}) => Promise<any>;
|
|
13
|
+
track: ({ featureId, value, }: {
|
|
14
|
+
featureId: string;
|
|
15
|
+
value?: number;
|
|
16
|
+
}) => Promise<any>;
|
|
17
|
+
openBillingPortal: (options?: {
|
|
18
|
+
returnUrl?: string;
|
|
21
19
|
}) => Promise<any>;
|
|
22
20
|
/**
|
|
23
21
|
* @deprecated Use track({featureId, value}) instead.
|
|
@@ -34,19 +32,26 @@ declare const useAutumn: (options?: UseAutumnOptions) => {
|
|
|
34
32
|
entitled: ({ featureId }: {
|
|
35
33
|
featureId: string;
|
|
36
34
|
}) => Promise<any>;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use the useCustomer() hook instead.
|
|
37
|
+
* This property is deprecated and will be removed in a future version.
|
|
38
|
+
*/
|
|
39
|
+
customer: any;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use the useCustomer() hook instead.
|
|
42
|
+
* This property is deprecated and will be removed in a future version.
|
|
43
|
+
*/
|
|
44
|
+
loading: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use the useCustomer() hook instead.
|
|
47
|
+
* This property is deprecated and will be removed in a future version.
|
|
48
|
+
*/
|
|
49
|
+
error: AutumnError | null;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Use the useCustomer() hook instead.
|
|
52
|
+
* This property is deprecated and will be removed in a future version.
|
|
53
|
+
*/
|
|
54
|
+
refetch: () => Promise<void>;
|
|
50
55
|
};
|
|
51
56
|
|
|
52
|
-
export {
|
|
57
|
+
export { useAutumn };
|