autumn-js 0.0.33 → 0.0.34
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/next/client/AutumnContext.d.mts +1 -2
- package/dist/next/client/AutumnContext.d.ts +1 -2
- package/dist/next/client/AutumnProvider.js +6 -0
- package/dist/next/client/AutumnProvider.mjs +6 -0
- package/dist/next/client/clientUtils.d.mts +3 -3
- package/dist/next/client/clientUtils.d.ts +3 -3
- package/dist/next/client/clientUtils.js +13 -0
- package/dist/next/client/clientUtils.mjs +13 -0
- package/dist/next/client/hooks/useCustomer.d.mts +6 -3
- package/dist/next/client/hooks/useCustomer.d.ts +6 -3
- package/dist/next/client/hooks/useCustomer.js +19 -7
- package/dist/next/client/hooks/useCustomer.mjs +19 -7
- package/dist/next/client/hooks/useEntity.d.mts +2 -3
- package/dist/next/client/hooks/useEntity.d.ts +2 -3
- package/dist/next/client/hooks/useEntity.js +3 -4
- package/dist/next/client/hooks/useEntity.mjs +3 -4
- package/dist/next/client/hooks/usePricingTable.d.mts +1 -2
- package/dist/next/client/hooks/usePricingTable.d.ts +1 -2
- package/dist/next/client/types-B4Y4mIQa.d.mts +79 -0
- package/dist/next/client/types-D3Exrq7u.d.ts +79 -0
- package/dist/next/client/types.d.mts +2 -64
- package/dist/next/client/types.d.ts +2 -64
- package/dist/next/index.d.mts +30 -30
- package/dist/next/index.d.ts +30 -30
- package/dist/next/server/auth/clerk-wrapper.js +3 -3
- package/dist/next/server/auth/clerk-wrapper.mjs +3 -3
- package/dist/next/server/auth/handleAuthProvider.js +21 -10
- package/dist/next/server/auth/handleAuthProvider.mjs +21 -10
- package/dist/next/server/auth/withAuth.d.mts +1 -1
- package/dist/next/server/auth/withAuth.d.ts +1 -1
- package/dist/next/server/auth/withAuth.js +1 -1
- package/dist/next/server/auth/withAuth.mjs +1 -1
- package/dist/next/server/componentActions.d.mts +1 -1
- package/dist/next/server/componentActions.d.ts +1 -1
- package/dist/next/server/cusActions.d.mts +5 -5
- package/dist/next/server/cusActions.d.ts +5 -5
- package/dist/next/server/genActions.d.mts +5 -5
- package/dist/next/server/genActions.d.ts +5 -5
- package/package.json +1 -5
- package/tsup.config.ts +1 -1
- package/dist/next/client/entTypes-BY0W7TQY.d.ts +0 -19
- package/dist/next/client/entTypes-C8YyvH78.d.mts +0 -19
- package/dist/next/client/error-CG2LXoa7.d.mts +0 -16
- package/dist/next/client/error-CG2LXoa7.d.ts +0 -16
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { AutumnContextParams } from './types.mjs';
|
|
2
|
+
import { A as AutumnContextParams } from './types-B4Y4mIQa.mjs';
|
|
3
3
|
import './cusTypes-Cb2VYILZ.mjs';
|
|
4
|
-
import './entTypes-C8YyvH78.mjs';
|
|
5
4
|
|
|
6
5
|
declare const AutumnContext: react.Context<AutumnContextParams>;
|
|
7
6
|
declare const useAutumnContext: () => AutumnContextParams;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { AutumnContextParams } from './types.js';
|
|
2
|
+
import { A as AutumnContextParams } from './types-D3Exrq7u.js';
|
|
3
3
|
import './cusTypes-Cb2VYILZ.js';
|
|
4
|
-
import './entTypes-BY0W7TQY.js';
|
|
5
4
|
|
|
6
5
|
declare const AutumnContext: react.Context<AutumnContextParams>;
|
|
7
6
|
declare const useAutumnContext: () => AutumnContextParams;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { AutumnContext } from "./AutumnContext";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
|
+
import { useCustomer } from "./hooks/useCustomer";
|
|
6
7
|
const useDialog = (component) => {
|
|
7
8
|
const [dialogFound, setDialogFound] = useState(false);
|
|
8
9
|
const [dialogProps, setDialogProps] = useState(null);
|
|
@@ -32,6 +33,11 @@ const AutumnClientProvider = ({
|
|
|
32
33
|
customerData
|
|
33
34
|
}) => {
|
|
34
35
|
let [customer, setCustomer] = useState(null);
|
|
36
|
+
useCustomer({
|
|
37
|
+
encryptedCustomerId,
|
|
38
|
+
customerData,
|
|
39
|
+
errorOnNotFound: false
|
|
40
|
+
});
|
|
35
41
|
let [pricingTableProducts, setPricingTableProducts] = useState(null);
|
|
36
42
|
const [components, setComponents] = useState({});
|
|
37
43
|
const [entity, setEntity] = useState(null);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { AutumnContext } from "./AutumnContext";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
|
+
import { useCustomer } from "./hooks/useCustomer";
|
|
6
7
|
const useDialog = (component) => {
|
|
7
8
|
const [dialogFound, setDialogFound] = useState(false);
|
|
8
9
|
const [dialogProps, setDialogProps] = useState(null);
|
|
@@ -32,6 +33,11 @@ const AutumnClientProvider = ({
|
|
|
32
33
|
customerData
|
|
33
34
|
}) => {
|
|
34
35
|
let [customer, setCustomer] = useState(null);
|
|
36
|
+
useCustomer({
|
|
37
|
+
encryptedCustomerId,
|
|
38
|
+
customerData,
|
|
39
|
+
errorOnNotFound: false
|
|
40
|
+
});
|
|
35
41
|
let [pricingTableProducts, setPricingTableProducts] = useState(null);
|
|
36
42
|
const [components, setComponents] = useState({});
|
|
37
43
|
const [entity, setEntity] = useState(null);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AutumnClientError, PricingTableProduct } from './types.mjs';
|
|
1
|
+
import { a as AutumnClientError, P as PricingTableProduct } from './types-B4Y4mIQa.mjs';
|
|
2
2
|
import './cusTypes-Cb2VYILZ.mjs';
|
|
3
|
-
import './entTypes-C8YyvH78.mjs';
|
|
4
3
|
|
|
5
4
|
declare const toClientErrorResponse: (error: any) => {
|
|
6
5
|
data: null;
|
|
7
6
|
error: AutumnClientError;
|
|
8
7
|
};
|
|
8
|
+
declare const toClientError: (error: any) => AutumnClientError;
|
|
9
9
|
declare const fetchPricingTableData: ({ setIsLoading, setError, setProducts, encryptedCustomerId, }: {
|
|
10
10
|
setIsLoading?: (isLoading: boolean) => void;
|
|
11
11
|
setError?: (error: any) => void;
|
|
@@ -13,4 +13,4 @@ declare const fetchPricingTableData: ({ setIsLoading, setError, setProducts, enc
|
|
|
13
13
|
encryptedCustomerId?: string;
|
|
14
14
|
}) => Promise<any>;
|
|
15
15
|
|
|
16
|
-
export { fetchPricingTableData, toClientErrorResponse };
|
|
16
|
+
export { fetchPricingTableData, toClientError, toClientErrorResponse };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AutumnClientError, PricingTableProduct } from './types.js';
|
|
1
|
+
import { a as AutumnClientError, P as PricingTableProduct } from './types-D3Exrq7u.js';
|
|
2
2
|
import './cusTypes-Cb2VYILZ.js';
|
|
3
|
-
import './entTypes-BY0W7TQY.js';
|
|
4
3
|
|
|
5
4
|
declare const toClientErrorResponse: (error: any) => {
|
|
6
5
|
data: null;
|
|
7
6
|
error: AutumnClientError;
|
|
8
7
|
};
|
|
8
|
+
declare const toClientError: (error: any) => AutumnClientError;
|
|
9
9
|
declare const fetchPricingTableData: ({ setIsLoading, setError, setProducts, encryptedCustomerId, }: {
|
|
10
10
|
setIsLoading?: (isLoading: boolean) => void;
|
|
11
11
|
setError?: (error: any) => void;
|
|
@@ -13,4 +13,4 @@ declare const fetchPricingTableData: ({ setIsLoading, setError, setProducts, enc
|
|
|
13
13
|
encryptedCustomerId?: string;
|
|
14
14
|
}) => Promise<any>;
|
|
15
15
|
|
|
16
|
-
export { fetchPricingTableData, toClientErrorResponse };
|
|
16
|
+
export { fetchPricingTableData, toClientError, toClientErrorResponse };
|
|
@@ -17,6 +17,18 @@ const toClientErrorResponse = (error) => {
|
|
|
17
17
|
error: new AutumnClientError({ message: msg, code })
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
+
const toClientError = (error) => {
|
|
21
|
+
let msg = "Unknown error";
|
|
22
|
+
let code = "unknown";
|
|
23
|
+
if (error?.message) {
|
|
24
|
+
msg = error.message;
|
|
25
|
+
}
|
|
26
|
+
if (error?.code) {
|
|
27
|
+
code = error.code;
|
|
28
|
+
}
|
|
29
|
+
console.error("Autumn Error: ", msg);
|
|
30
|
+
return new AutumnClientError({ message: msg, code });
|
|
31
|
+
};
|
|
20
32
|
const fetchPricingTableData = async ({
|
|
21
33
|
setIsLoading,
|
|
22
34
|
setError,
|
|
@@ -53,5 +65,6 @@ const fetchPricingTableData = async ({
|
|
|
53
65
|
};
|
|
54
66
|
export {
|
|
55
67
|
fetchPricingTableData,
|
|
68
|
+
toClientError,
|
|
56
69
|
toClientErrorResponse
|
|
57
70
|
};
|
|
@@ -17,6 +17,18 @@ const toClientErrorResponse = (error) => {
|
|
|
17
17
|
error: new AutumnClientError({ message: msg, code })
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
+
const toClientError = (error) => {
|
|
21
|
+
let msg = "Unknown error";
|
|
22
|
+
let code = "unknown";
|
|
23
|
+
if (error?.message) {
|
|
24
|
+
msg = error.message;
|
|
25
|
+
}
|
|
26
|
+
if (error?.code) {
|
|
27
|
+
code = error.code;
|
|
28
|
+
}
|
|
29
|
+
console.error("Autumn Error: ", msg);
|
|
30
|
+
return new AutumnClientError({ message: msg, code });
|
|
31
|
+
};
|
|
20
32
|
const fetchPricingTableData = async ({
|
|
21
33
|
setIsLoading,
|
|
22
34
|
setError,
|
|
@@ -53,5 +65,6 @@ const fetchPricingTableData = async ({
|
|
|
53
65
|
};
|
|
54
66
|
export {
|
|
55
67
|
fetchPricingTableData,
|
|
68
|
+
toClientError,
|
|
56
69
|
toClientErrorResponse
|
|
57
70
|
};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as CustomerExpandOption, b as Customer } from '../cusTypes-Cb2VYILZ.mjs';
|
|
1
|
+
import { a as CustomerExpandOption, C as CustomerData, b as Customer } from '../cusTypes-Cb2VYILZ.mjs';
|
|
3
2
|
import { CreateEntityParams } from './types.mjs';
|
|
3
|
+
import { a as AutumnClientError } from '../types-B4Y4mIQa.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
interface UseCustomerProps {
|
|
7
7
|
expand?: CustomerExpandOption[];
|
|
8
8
|
autoCreate?: boolean;
|
|
9
|
+
encryptedCustomerId?: string;
|
|
10
|
+
customerData?: CustomerData;
|
|
11
|
+
errorOnNotFound?: boolean;
|
|
9
12
|
}
|
|
10
13
|
declare const useCustomer: (options?: UseCustomerProps) => {
|
|
11
14
|
customer: Customer | null;
|
|
12
15
|
isLoading: boolean;
|
|
13
|
-
error:
|
|
16
|
+
error: AutumnClientError | null;
|
|
14
17
|
refetch: () => Promise<void>;
|
|
15
18
|
createEntity: (params: CreateEntityParams | CreateEntityParams[]) => Promise<any>;
|
|
16
19
|
deleteEntity: (entityId: string) => Promise<any>;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as CustomerExpandOption, b as Customer } from '../cusTypes-Cb2VYILZ.js';
|
|
1
|
+
import { a as CustomerExpandOption, C as CustomerData, b as Customer } from '../cusTypes-Cb2VYILZ.js';
|
|
3
2
|
import { CreateEntityParams } from './types.js';
|
|
3
|
+
import { a as AutumnClientError } from '../types-D3Exrq7u.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
interface UseCustomerProps {
|
|
7
7
|
expand?: CustomerExpandOption[];
|
|
8
8
|
autoCreate?: boolean;
|
|
9
|
+
encryptedCustomerId?: string;
|
|
10
|
+
customerData?: CustomerData;
|
|
11
|
+
errorOnNotFound?: boolean;
|
|
9
12
|
}
|
|
10
13
|
declare const useCustomer: (options?: UseCustomerProps) => {
|
|
11
14
|
customer: Customer | null;
|
|
12
15
|
isLoading: boolean;
|
|
13
|
-
error:
|
|
16
|
+
error: AutumnClientError | null;
|
|
14
17
|
refetch: () => Promise<void>;
|
|
15
18
|
createEntity: (params: CreateEntityParams | CreateEntityParams[]) => Promise<any>;
|
|
16
19
|
deleteEntity: (entityId: string) => Promise<any>;
|
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
createEntityAction,
|
|
9
9
|
deleteEntityAction
|
|
10
10
|
} from "../../server/cusActions";
|
|
11
|
-
import { toClientErrorResponse } from "../clientUtils";
|
|
11
|
+
import { toClientError, toClientErrorResponse } from "../clientUtils";
|
|
12
12
|
const defaultOptions = {
|
|
13
13
|
expand: void 0,
|
|
14
|
-
autoCreate: true
|
|
14
|
+
autoCreate: true,
|
|
15
|
+
encryptedCustomerId: void 0,
|
|
16
|
+
customerData: void 0,
|
|
17
|
+
errorOnNotFound: true
|
|
15
18
|
};
|
|
16
19
|
const deleteEntity = async ({
|
|
17
20
|
encryptedCustomerId,
|
|
@@ -32,7 +35,15 @@ const useCustomer = (options) => {
|
|
|
32
35
|
finalOptions = { ...defaultOptions, ...options };
|
|
33
36
|
}
|
|
34
37
|
const { autoCreate } = finalOptions;
|
|
35
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
encryptedCustomerId: contextEncryptedCustomerId,
|
|
40
|
+
customerData: contextCustomerData,
|
|
41
|
+
customer,
|
|
42
|
+
setCustomer
|
|
43
|
+
} = useAutumnContext();
|
|
44
|
+
const encryptedCustomerId = finalOptions.encryptedCustomerId || contextEncryptedCustomerId;
|
|
45
|
+
const customerData = finalOptions.customerData || contextCustomerData;
|
|
46
|
+
const errorOnNotFound = finalOptions.errorOnNotFound;
|
|
36
47
|
const [error, setError] = useState(null);
|
|
37
48
|
const [isLoading, setIsLoading] = useState(true);
|
|
38
49
|
const fetchCustomer = async () => {
|
|
@@ -62,16 +73,17 @@ const useCustomer = (options) => {
|
|
|
62
73
|
error2 = result.error;
|
|
63
74
|
}
|
|
64
75
|
if (error2) {
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
if (error2 && error2?.code == "no_customer_id" && !errorOnNotFound) {
|
|
77
|
+
} else {
|
|
78
|
+
setError(toClientError(error2));
|
|
79
|
+
}
|
|
67
80
|
} else {
|
|
68
81
|
setCustomer(data);
|
|
69
82
|
setError(null);
|
|
70
83
|
}
|
|
71
84
|
returnData = data;
|
|
72
85
|
} catch (error2) {
|
|
73
|
-
|
|
74
|
-
setError(error2);
|
|
86
|
+
setError(toClientError(error2));
|
|
75
87
|
}
|
|
76
88
|
setIsLoading(false);
|
|
77
89
|
return returnData;
|
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
createEntityAction,
|
|
9
9
|
deleteEntityAction
|
|
10
10
|
} from "../../server/cusActions";
|
|
11
|
-
import { toClientErrorResponse } from "../clientUtils";
|
|
11
|
+
import { toClientError, toClientErrorResponse } from "../clientUtils";
|
|
12
12
|
const defaultOptions = {
|
|
13
13
|
expand: void 0,
|
|
14
|
-
autoCreate: true
|
|
14
|
+
autoCreate: true,
|
|
15
|
+
encryptedCustomerId: void 0,
|
|
16
|
+
customerData: void 0,
|
|
17
|
+
errorOnNotFound: true
|
|
15
18
|
};
|
|
16
19
|
const deleteEntity = async ({
|
|
17
20
|
encryptedCustomerId,
|
|
@@ -32,7 +35,15 @@ const useCustomer = (options) => {
|
|
|
32
35
|
finalOptions = { ...defaultOptions, ...options };
|
|
33
36
|
}
|
|
34
37
|
const { autoCreate } = finalOptions;
|
|
35
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
encryptedCustomerId: contextEncryptedCustomerId,
|
|
40
|
+
customerData: contextCustomerData,
|
|
41
|
+
customer,
|
|
42
|
+
setCustomer
|
|
43
|
+
} = useAutumnContext();
|
|
44
|
+
const encryptedCustomerId = finalOptions.encryptedCustomerId || contextEncryptedCustomerId;
|
|
45
|
+
const customerData = finalOptions.customerData || contextCustomerData;
|
|
46
|
+
const errorOnNotFound = finalOptions.errorOnNotFound;
|
|
36
47
|
const [error, setError] = useState(null);
|
|
37
48
|
const [isLoading, setIsLoading] = useState(true);
|
|
38
49
|
const fetchCustomer = async () => {
|
|
@@ -62,16 +73,17 @@ const useCustomer = (options) => {
|
|
|
62
73
|
error2 = result.error;
|
|
63
74
|
}
|
|
64
75
|
if (error2) {
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
if (error2 && error2?.code == "no_customer_id" && !errorOnNotFound) {
|
|
77
|
+
} else {
|
|
78
|
+
setError(toClientError(error2));
|
|
79
|
+
}
|
|
67
80
|
} else {
|
|
68
81
|
setCustomer(data);
|
|
69
82
|
setError(null);
|
|
70
83
|
}
|
|
71
84
|
returnData = data;
|
|
72
85
|
} catch (error2) {
|
|
73
|
-
|
|
74
|
-
setError(error2);
|
|
86
|
+
setError(toClientError(error2));
|
|
75
87
|
}
|
|
76
88
|
setIsLoading(false);
|
|
77
89
|
return returnData;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { G as GetEntityParams, E as Entity } from '../entTypes-C8YyvH78.mjs';
|
|
1
|
+
import { G as GetEntityParams, E as Entity, a as AutumnClientError } from '../types-B4Y4mIQa.mjs';
|
|
3
2
|
import '../cusTypes-Cb2VYILZ.mjs';
|
|
4
3
|
|
|
5
4
|
declare const useEntity: (entityId?: string, params?: GetEntityParams) => {
|
|
6
5
|
entity: Entity | null;
|
|
7
6
|
isLoading: boolean;
|
|
8
|
-
error:
|
|
7
|
+
error: AutumnClientError | null;
|
|
9
8
|
refetch: () => Promise<void>;
|
|
10
9
|
};
|
|
11
10
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { G as GetEntityParams, E as Entity } from '../entTypes-BY0W7TQY.js';
|
|
1
|
+
import { G as GetEntityParams, E as Entity, a as AutumnClientError } from '../types-D3Exrq7u.js';
|
|
3
2
|
import '../cusTypes-Cb2VYILZ.js';
|
|
4
3
|
|
|
5
4
|
declare const useEntity: (entityId?: string, params?: GetEntityParams) => {
|
|
6
5
|
entity: Entity | null;
|
|
7
6
|
isLoading: boolean;
|
|
8
|
-
error:
|
|
7
|
+
error: AutumnClientError | null;
|
|
9
8
|
refetch: () => Promise<void>;
|
|
10
9
|
};
|
|
11
10
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { useAutumnContext } from "../AutumnContext";
|
|
5
5
|
import { getEntityAction } from "../../server/cusActions";
|
|
6
|
+
import { toClientError } from "../clientUtils";
|
|
6
7
|
const useEntity = (entityId, params) => {
|
|
7
8
|
const {
|
|
8
9
|
encryptedCustomerId,
|
|
@@ -31,16 +32,14 @@ const useEntity = (entityId, params) => {
|
|
|
31
32
|
data = result.data;
|
|
32
33
|
error2 = result.error;
|
|
33
34
|
if (error2) {
|
|
34
|
-
|
|
35
|
-
setError(error2);
|
|
35
|
+
setError(toClientError(error2));
|
|
36
36
|
} else {
|
|
37
37
|
setEntity(data);
|
|
38
38
|
setError(null);
|
|
39
39
|
}
|
|
40
40
|
returnData = data;
|
|
41
41
|
} catch (error2) {
|
|
42
|
-
|
|
43
|
-
setError(error2);
|
|
42
|
+
setError(toClientError(error2));
|
|
44
43
|
}
|
|
45
44
|
setIsLoading(false);
|
|
46
45
|
return returnData;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { useAutumnContext } from "../AutumnContext";
|
|
5
5
|
import { getEntityAction } from "../../server/cusActions";
|
|
6
|
+
import { toClientError } from "../clientUtils";
|
|
6
7
|
const useEntity = (entityId, params) => {
|
|
7
8
|
const {
|
|
8
9
|
encryptedCustomerId,
|
|
@@ -31,16 +32,14 @@ const useEntity = (entityId, params) => {
|
|
|
31
32
|
data = result.data;
|
|
32
33
|
error2 = result.error;
|
|
33
34
|
if (error2) {
|
|
34
|
-
|
|
35
|
-
setError(error2);
|
|
35
|
+
setError(toClientError(error2));
|
|
36
36
|
} else {
|
|
37
37
|
setEntity(data);
|
|
38
38
|
setError(null);
|
|
39
39
|
}
|
|
40
40
|
returnData = data;
|
|
41
41
|
} catch (error2) {
|
|
42
|
-
|
|
43
|
-
setError(error2);
|
|
42
|
+
setError(toClientError(error2));
|
|
44
43
|
}
|
|
45
44
|
setIsLoading(false);
|
|
46
45
|
return returnData;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice, C as CustomerData, b as Customer } from './cusTypes-Cb2VYILZ.mjs';
|
|
2
|
+
|
|
3
|
+
type EntityExpandOption = "invoices";
|
|
4
|
+
|
|
5
|
+
interface GetEntityParams {
|
|
6
|
+
expand?: EntityExpandOption[];
|
|
7
|
+
}
|
|
8
|
+
interface Entity {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
customer_id: string;
|
|
12
|
+
created_at: number;
|
|
13
|
+
env: string;
|
|
14
|
+
products: CustomerProduct[];
|
|
15
|
+
features: Record<string, CustomerFeature>;
|
|
16
|
+
invoices?: CustomerInvoice[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ProductDetails {
|
|
20
|
+
id: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
buttonText?: string;
|
|
23
|
+
buttonUrl?: string;
|
|
24
|
+
recommendText?: string;
|
|
25
|
+
}
|
|
26
|
+
interface PricingTableProduct {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
buttonText: string;
|
|
30
|
+
price: {
|
|
31
|
+
primaryText: string;
|
|
32
|
+
secondaryText?: string;
|
|
33
|
+
};
|
|
34
|
+
items: {
|
|
35
|
+
primaryText: string;
|
|
36
|
+
secondaryText?: string;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
declare class AutumnClientError extends Error {
|
|
40
|
+
code: string;
|
|
41
|
+
constructor({ message, code }: {
|
|
42
|
+
message: string;
|
|
43
|
+
code: string;
|
|
44
|
+
});
|
|
45
|
+
toString(): string;
|
|
46
|
+
toJSON(): {
|
|
47
|
+
message: string;
|
|
48
|
+
code: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface AutumnContextParams {
|
|
52
|
+
encryptedCustomerId?: string;
|
|
53
|
+
customerData?: CustomerData;
|
|
54
|
+
authProvider?: "clerk" | "better-auth";
|
|
55
|
+
customer: Customer | null;
|
|
56
|
+
setCustomer: (customer: Customer | null) => void;
|
|
57
|
+
entity: Entity | null;
|
|
58
|
+
setEntity: (entity: Entity | null) => void;
|
|
59
|
+
entityId?: string;
|
|
60
|
+
prodChangeDialog: {
|
|
61
|
+
found: boolean;
|
|
62
|
+
setProps: (props: any) => void;
|
|
63
|
+
setOpen: (open: boolean) => void;
|
|
64
|
+
setComponent: (component: any) => void;
|
|
65
|
+
};
|
|
66
|
+
paywallDialog: {
|
|
67
|
+
found: boolean;
|
|
68
|
+
setProps: (props: any) => void;
|
|
69
|
+
setOpen: (open: boolean) => void;
|
|
70
|
+
setComponent: (component: any) => void;
|
|
71
|
+
};
|
|
72
|
+
pricingTableProducts: PricingTableProduct[] | null;
|
|
73
|
+
setPricingTableProducts: (products: PricingTableProduct[]) => void;
|
|
74
|
+
}
|
|
75
|
+
interface AutumnProviderProps extends AutumnContextParams {
|
|
76
|
+
children?: React.ReactNode;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { type AutumnContextParams as A, type Entity as E, type GetEntityParams as G, type PricingTableProduct as P, AutumnClientError as a, type ProductDetails as b, type AutumnProviderProps as c };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice, C as CustomerData, b as Customer } from './cusTypes-Cb2VYILZ.js';
|
|
2
|
+
|
|
3
|
+
type EntityExpandOption = "invoices";
|
|
4
|
+
|
|
5
|
+
interface GetEntityParams {
|
|
6
|
+
expand?: EntityExpandOption[];
|
|
7
|
+
}
|
|
8
|
+
interface Entity {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
customer_id: string;
|
|
12
|
+
created_at: number;
|
|
13
|
+
env: string;
|
|
14
|
+
products: CustomerProduct[];
|
|
15
|
+
features: Record<string, CustomerFeature>;
|
|
16
|
+
invoices?: CustomerInvoice[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ProductDetails {
|
|
20
|
+
id: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
buttonText?: string;
|
|
23
|
+
buttonUrl?: string;
|
|
24
|
+
recommendText?: string;
|
|
25
|
+
}
|
|
26
|
+
interface PricingTableProduct {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
buttonText: string;
|
|
30
|
+
price: {
|
|
31
|
+
primaryText: string;
|
|
32
|
+
secondaryText?: string;
|
|
33
|
+
};
|
|
34
|
+
items: {
|
|
35
|
+
primaryText: string;
|
|
36
|
+
secondaryText?: string;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
declare class AutumnClientError extends Error {
|
|
40
|
+
code: string;
|
|
41
|
+
constructor({ message, code }: {
|
|
42
|
+
message: string;
|
|
43
|
+
code: string;
|
|
44
|
+
});
|
|
45
|
+
toString(): string;
|
|
46
|
+
toJSON(): {
|
|
47
|
+
message: string;
|
|
48
|
+
code: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface AutumnContextParams {
|
|
52
|
+
encryptedCustomerId?: string;
|
|
53
|
+
customerData?: CustomerData;
|
|
54
|
+
authProvider?: "clerk" | "better-auth";
|
|
55
|
+
customer: Customer | null;
|
|
56
|
+
setCustomer: (customer: Customer | null) => void;
|
|
57
|
+
entity: Entity | null;
|
|
58
|
+
setEntity: (entity: Entity | null) => void;
|
|
59
|
+
entityId?: string;
|
|
60
|
+
prodChangeDialog: {
|
|
61
|
+
found: boolean;
|
|
62
|
+
setProps: (props: any) => void;
|
|
63
|
+
setOpen: (open: boolean) => void;
|
|
64
|
+
setComponent: (component: any) => void;
|
|
65
|
+
};
|
|
66
|
+
paywallDialog: {
|
|
67
|
+
found: boolean;
|
|
68
|
+
setProps: (props: any) => void;
|
|
69
|
+
setOpen: (open: boolean) => void;
|
|
70
|
+
setComponent: (component: any) => void;
|
|
71
|
+
};
|
|
72
|
+
pricingTableProducts: PricingTableProduct[] | null;
|
|
73
|
+
setPricingTableProducts: (products: PricingTableProduct[]) => void;
|
|
74
|
+
}
|
|
75
|
+
interface AutumnProviderProps extends AutumnContextParams {
|
|
76
|
+
children?: React.ReactNode;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { type AutumnContextParams as A, type Entity as E, type GetEntityParams as G, type PricingTableProduct as P, AutumnClientError as a, type ProductDetails as b, type AutumnProviderProps as c };
|
|
@@ -1,64 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface ProductDetails {
|
|
5
|
-
id: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
buttonText?: string;
|
|
8
|
-
buttonUrl?: string;
|
|
9
|
-
recommendText?: string;
|
|
10
|
-
}
|
|
11
|
-
interface PricingTableProduct {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
buttonText: string;
|
|
15
|
-
price: {
|
|
16
|
-
primaryText: string;
|
|
17
|
-
secondaryText?: string;
|
|
18
|
-
};
|
|
19
|
-
items: {
|
|
20
|
-
primaryText: string;
|
|
21
|
-
secondaryText?: string;
|
|
22
|
-
}[];
|
|
23
|
-
}
|
|
24
|
-
declare class AutumnClientError extends Error {
|
|
25
|
-
code: string;
|
|
26
|
-
constructor({ message, code }: {
|
|
27
|
-
message: string;
|
|
28
|
-
code: string;
|
|
29
|
-
});
|
|
30
|
-
toString(): string;
|
|
31
|
-
toJSON(): {
|
|
32
|
-
message: string;
|
|
33
|
-
code: string;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
interface AutumnContextParams {
|
|
37
|
-
encryptedCustomerId?: string;
|
|
38
|
-
customerData?: CustomerData;
|
|
39
|
-
authProvider?: "clerk" | "better-auth";
|
|
40
|
-
customer: Customer | null;
|
|
41
|
-
setCustomer: (customer: Customer | null) => void;
|
|
42
|
-
entity: Entity | null;
|
|
43
|
-
setEntity: (entity: Entity | null) => void;
|
|
44
|
-
entityId?: string;
|
|
45
|
-
prodChangeDialog: {
|
|
46
|
-
found: boolean;
|
|
47
|
-
setProps: (props: any) => void;
|
|
48
|
-
setOpen: (open: boolean) => void;
|
|
49
|
-
setComponent: (component: any) => void;
|
|
50
|
-
};
|
|
51
|
-
paywallDialog: {
|
|
52
|
-
found: boolean;
|
|
53
|
-
setProps: (props: any) => void;
|
|
54
|
-
setOpen: (open: boolean) => void;
|
|
55
|
-
setComponent: (component: any) => void;
|
|
56
|
-
};
|
|
57
|
-
pricingTableProducts: PricingTableProduct[] | null;
|
|
58
|
-
setPricingTableProducts: (products: PricingTableProduct[]) => void;
|
|
59
|
-
}
|
|
60
|
-
interface AutumnProviderProps extends AutumnContextParams {
|
|
61
|
-
children?: React.ReactNode;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { AutumnClientError, type AutumnContextParams, type AutumnProviderProps, type PricingTableProduct, type ProductDetails };
|
|
1
|
+
import './cusTypes-Cb2VYILZ.mjs';
|
|
2
|
+
export { a as AutumnClientError, A as AutumnContextParams, c as AutumnProviderProps, P as PricingTableProduct, b as ProductDetails } from './types-B4Y4mIQa.mjs';
|