autumn-js 0.0.48 → 0.0.49
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 +2 -1
- package/dist/next/client/AutumnContext.d.ts +2 -1
- package/dist/next/client/clientEntTypes-pqnB95m3.d.mts +9 -0
- package/dist/next/client/clientEntTypes-pqnB95m3.d.ts +9 -0
- package/dist/next/client/clientUtils.d.mts +2 -1
- package/dist/next/client/clientUtils.d.ts +2 -1
- package/dist/next/client/entTypes-B1SnNOgv.d.ts +19 -0
- package/dist/next/client/entTypes-DMAhz9Dg.d.mts +19 -0
- package/dist/next/client/hooks/types.d.mts +25 -2
- package/dist/next/client/hooks/types.d.ts +25 -2
- package/dist/next/client/hooks/useAutumn.d.mts +2 -1
- package/dist/next/client/hooks/useAutumn.d.ts +2 -1
- package/dist/next/client/hooks/useCustomer.d.mts +4 -2
- package/dist/next/client/hooks/useCustomer.d.ts +4 -2
- package/dist/next/client/hooks/useEntity.d.mts +5 -4
- package/dist/next/client/hooks/useEntity.d.ts +5 -4
- package/dist/next/client/hooks/useEntity.js +2 -50
- package/dist/next/client/hooks/useEntity.mjs +2 -50
- package/dist/next/client/hooks/useEntityProvider.d.mts +11 -0
- package/dist/next/client/hooks/useEntityProvider.d.ts +11 -0
- package/dist/next/client/hooks/useEntityProvider.js +33 -0
- package/dist/next/client/hooks/useEntityProvider.mjs +33 -0
- package/dist/next/client/hooks/usePricingTable.d.mts +2 -1
- package/dist/next/client/hooks/usePricingTable.d.ts +2 -1
- package/dist/next/client/types.d.mts +64 -2
- package/dist/next/client/types.d.ts +64 -2
- package/dist/next/index.d.mts +4 -3
- package/dist/next/index.d.ts +4 -3
- package/dist/next/server/{genTypes-D0BvK77f.d.mts → clientEntTypes-CvbBjPmI.d.mts} +10 -2
- package/dist/next/server/{genTypes-8tvMa4lq.d.ts → clientEntTypes-aaR6GtOf.d.ts} +10 -2
- package/dist/next/server/cusActions.d.mts +2 -2
- package/dist/next/server/cusActions.d.ts +2 -2
- package/dist/next/server/cusActions.js +5 -1
- package/dist/next/server/cusActions.mjs +5 -1
- package/dist/next/server/genActions.d.mts +1 -6
- package/dist/next/server/genActions.d.ts +1 -6
- package/package.json +3 -2
- package/dist/next/client/types-B0ocZ_8d.d.ts +0 -79
- package/dist/next/client/types-B7efCges.d.mts +0 -29
- package/dist/next/client/types-B7efCges.d.ts +0 -29
- package/dist/next/client/types-Cx_JFSer.d.mts +0 -79
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AutumnContextParams } from './types.mjs';
|
|
3
3
|
import './cusTypes-DsDs_Qyb.mjs';
|
|
4
|
+
import './entTypes-DMAhz9Dg.mjs';
|
|
4
5
|
|
|
5
6
|
declare const AutumnContext: react.Context<AutumnContextParams>;
|
|
6
7
|
declare const useAutumnContext: () => AutumnContextParams;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AutumnContextParams } from './types.js';
|
|
3
3
|
import './cusTypes-DsDs_Qyb.js';
|
|
4
|
+
import './entTypes-B1SnNOgv.js';
|
|
4
5
|
|
|
5
6
|
declare const AutumnContext: react.Context<AutumnContextParams>;
|
|
6
7
|
declare const useAutumnContext: () => AutumnContextParams;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AutumnClientError, PricingTableProduct } from './types.mjs';
|
|
2
2
|
import './cusTypes-DsDs_Qyb.mjs';
|
|
3
|
+
import './entTypes-DMAhz9Dg.mjs';
|
|
3
4
|
|
|
4
5
|
declare const toClientErrorResponse: (error: any) => {
|
|
5
6
|
data: null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AutumnClientError, PricingTableProduct } from './types.js';
|
|
2
2
|
import './cusTypes-DsDs_Qyb.js';
|
|
3
|
+
import './entTypes-B1SnNOgv.js';
|
|
3
4
|
|
|
4
5
|
declare const toClientErrorResponse: (error: any) => {
|
|
5
6
|
data: null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice } from './cusTypes-DsDs_Qyb.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
|
+
export type { Entity as E, GetEntityParams as G };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice } from './cusTypes-DsDs_Qyb.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
|
+
export type { Entity as E, GetEntityParams as G };
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
import { E as EntityDataParams } from '../clientEntTypes-pqnB95m3.mjs';
|
|
3
|
+
|
|
4
|
+
interface AttachParams {
|
|
5
|
+
productId: string;
|
|
6
|
+
entityId?: string;
|
|
7
|
+
options?: {
|
|
8
|
+
featureId: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
}[];
|
|
11
|
+
successUrl?: string;
|
|
12
|
+
forceCheckout?: boolean;
|
|
13
|
+
metadata?: Record<string, string>;
|
|
14
|
+
dialog?: () => JSX.Element | react__default.ReactNode;
|
|
15
|
+
callback?: () => Promise<void>;
|
|
16
|
+
withPreview?: "formatted" | "raw";
|
|
17
|
+
entityData?: EntityDataParams;
|
|
18
|
+
}
|
|
19
|
+
interface CreateEntityParams {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
featureId: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type { AttachParams, CreateEntityParams };
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
import { E as EntityDataParams } from '../clientEntTypes-pqnB95m3.js';
|
|
3
|
+
|
|
4
|
+
interface AttachParams {
|
|
5
|
+
productId: string;
|
|
6
|
+
entityId?: string;
|
|
7
|
+
options?: {
|
|
8
|
+
featureId: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
}[];
|
|
11
|
+
successUrl?: string;
|
|
12
|
+
forceCheckout?: boolean;
|
|
13
|
+
metadata?: Record<string, string>;
|
|
14
|
+
dialog?: () => JSX.Element | react__default.ReactNode;
|
|
15
|
+
callback?: () => Promise<void>;
|
|
16
|
+
withPreview?: "formatted" | "raw";
|
|
17
|
+
entityData?: EntityDataParams;
|
|
18
|
+
}
|
|
19
|
+
interface CreateEntityParams {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
featureId: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type { AttachParams, CreateEntityParams };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { a as CustomerExpandOption, C as CustomerData, b as Customer } from '../cusTypes-DsDs_Qyb.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CreateEntityParams } from './types.mjs';
|
|
3
|
+
import { AutumnClientError } from '../types.mjs';
|
|
4
4
|
import 'react';
|
|
5
|
+
import '../clientEntTypes-pqnB95m3.mjs';
|
|
6
|
+
import '../entTypes-DMAhz9Dg.mjs';
|
|
5
7
|
|
|
6
8
|
interface UseCustomerProps {
|
|
7
9
|
expand?: CustomerExpandOption[];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { a as CustomerExpandOption, C as CustomerData, b as Customer } from '../cusTypes-DsDs_Qyb.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CreateEntityParams } from './types.js';
|
|
3
|
+
import { AutumnClientError } from '../types.js';
|
|
4
4
|
import 'react';
|
|
5
|
+
import '../clientEntTypes-pqnB95m3.js';
|
|
6
|
+
import '../entTypes-B1SnNOgv.js';
|
|
5
7
|
|
|
6
8
|
interface UseCustomerProps {
|
|
7
9
|
expand?: CustomerExpandOption[];
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import { G as GetEntityParams } from '../entTypes-DMAhz9Dg.mjs';
|
|
2
3
|
import '../cusTypes-DsDs_Qyb.mjs';
|
|
3
4
|
|
|
4
5
|
declare const useEntity: (entityId?: string, params?: GetEntityParams) => {
|
|
5
|
-
entity:
|
|
6
|
+
entity: any;
|
|
6
7
|
isLoading: boolean;
|
|
7
|
-
error:
|
|
8
|
-
refetch:
|
|
8
|
+
error: any;
|
|
9
|
+
refetch: swr.KeyedMutator<any>;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export { useEntity };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import { G as GetEntityParams } from '../entTypes-B1SnNOgv.js';
|
|
2
3
|
import '../cusTypes-DsDs_Qyb.js';
|
|
3
4
|
|
|
4
5
|
declare const useEntity: (entityId?: string, params?: GetEntityParams) => {
|
|
5
|
-
entity:
|
|
6
|
+
entity: any;
|
|
6
7
|
isLoading: boolean;
|
|
7
|
-
error:
|
|
8
|
-
refetch:
|
|
8
|
+
error: any;
|
|
9
|
+
refetch: swr.KeyedMutator<any>;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export { useEntity };
|
|
@@ -1,56 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { useAutumnContext } from "../AutumnContext";
|
|
5
|
-
import { getEntityAction } from "../../server/cusActions";
|
|
6
|
-
import { toClientError } from "../clientUtils";
|
|
3
|
+
import { useEntityProvider } from "./useEntityProvider";
|
|
7
4
|
const useEntity = (entityId, params) => {
|
|
8
|
-
|
|
9
|
-
encryptedCustomerId,
|
|
10
|
-
entityId: contextEntityId,
|
|
11
|
-
entity,
|
|
12
|
-
setEntity
|
|
13
|
-
} = useAutumnContext();
|
|
14
|
-
const finalEntityId = entityId || contextEntityId;
|
|
15
|
-
const [error, setError] = useState(null);
|
|
16
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
17
|
-
const fetchEntity = async () => {
|
|
18
|
-
if (!finalEntityId) {
|
|
19
|
-
console.warn("(Autumn) No entity ID provided in useEntity hook");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
setIsLoading(true);
|
|
23
|
-
let returnData = null;
|
|
24
|
-
try {
|
|
25
|
-
let data = null;
|
|
26
|
-
let error2 = null;
|
|
27
|
-
const result = await getEntityAction({
|
|
28
|
-
encryptedCustomerId,
|
|
29
|
-
entityId: finalEntityId,
|
|
30
|
-
params
|
|
31
|
-
});
|
|
32
|
-
data = result.data;
|
|
33
|
-
error2 = result.error;
|
|
34
|
-
if (error2) {
|
|
35
|
-
setError(toClientError(error2, false));
|
|
36
|
-
} else {
|
|
37
|
-
setEntity(data);
|
|
38
|
-
setError(null);
|
|
39
|
-
}
|
|
40
|
-
returnData = data;
|
|
41
|
-
} catch (error2) {
|
|
42
|
-
setError(toClientError(error2));
|
|
43
|
-
}
|
|
44
|
-
setIsLoading(false);
|
|
45
|
-
return returnData;
|
|
46
|
-
};
|
|
47
|
-
const refetch = async () => {
|
|
48
|
-
await fetchEntity();
|
|
49
|
-
};
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
fetchEntity();
|
|
52
|
-
}, [encryptedCustomerId, finalEntityId]);
|
|
53
|
-
return { entity, isLoading, error, refetch };
|
|
5
|
+
return useEntityProvider(entityId, params);
|
|
54
6
|
};
|
|
55
7
|
export {
|
|
56
8
|
useEntity
|
|
@@ -1,56 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { useAutumnContext } from "../AutumnContext";
|
|
5
|
-
import { getEntityAction } from "../../server/cusActions";
|
|
6
|
-
import { toClientError } from "../clientUtils";
|
|
3
|
+
import { useEntityProvider } from "./useEntityProvider";
|
|
7
4
|
const useEntity = (entityId, params) => {
|
|
8
|
-
|
|
9
|
-
encryptedCustomerId,
|
|
10
|
-
entityId: contextEntityId,
|
|
11
|
-
entity,
|
|
12
|
-
setEntity
|
|
13
|
-
} = useAutumnContext();
|
|
14
|
-
const finalEntityId = entityId || contextEntityId;
|
|
15
|
-
const [error, setError] = useState(null);
|
|
16
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
17
|
-
const fetchEntity = async () => {
|
|
18
|
-
if (!finalEntityId) {
|
|
19
|
-
console.warn("(Autumn) No entity ID provided in useEntity hook");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
setIsLoading(true);
|
|
23
|
-
let returnData = null;
|
|
24
|
-
try {
|
|
25
|
-
let data = null;
|
|
26
|
-
let error2 = null;
|
|
27
|
-
const result = await getEntityAction({
|
|
28
|
-
encryptedCustomerId,
|
|
29
|
-
entityId: finalEntityId,
|
|
30
|
-
params
|
|
31
|
-
});
|
|
32
|
-
data = result.data;
|
|
33
|
-
error2 = result.error;
|
|
34
|
-
if (error2) {
|
|
35
|
-
setError(toClientError(error2, false));
|
|
36
|
-
} else {
|
|
37
|
-
setEntity(data);
|
|
38
|
-
setError(null);
|
|
39
|
-
}
|
|
40
|
-
returnData = data;
|
|
41
|
-
} catch (error2) {
|
|
42
|
-
setError(toClientError(error2));
|
|
43
|
-
}
|
|
44
|
-
setIsLoading(false);
|
|
45
|
-
return returnData;
|
|
46
|
-
};
|
|
47
|
-
const refetch = async () => {
|
|
48
|
-
await fetchEntity();
|
|
49
|
-
};
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
fetchEntity();
|
|
52
|
-
}, [encryptedCustomerId, finalEntityId]);
|
|
53
|
-
return { entity, isLoading, error, refetch };
|
|
5
|
+
return useEntityProvider(entityId, params);
|
|
54
6
|
};
|
|
55
7
|
export {
|
|
56
8
|
useEntity
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import { G as GetEntityParams } from '../clientEntTypes-pqnB95m3.mjs';
|
|
3
|
+
|
|
4
|
+
declare const useEntityProvider: (entityId?: string, params?: GetEntityParams) => {
|
|
5
|
+
entity: any;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: any;
|
|
8
|
+
refetch: swr.KeyedMutator<any>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { useEntityProvider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import { G as GetEntityParams } from '../clientEntTypes-pqnB95m3.js';
|
|
3
|
+
|
|
4
|
+
declare const useEntityProvider: (entityId?: string, params?: GetEntityParams) => {
|
|
5
|
+
entity: any;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: any;
|
|
8
|
+
refetch: swr.KeyedMutator<any>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { useEntityProvider };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import useSWR from "swr";
|
|
4
|
+
import { getEntityAction } from "../../../next/server/cusActions";
|
|
5
|
+
import { useAutumnContext } from "../AutumnContext";
|
|
6
|
+
const useEntityProvider = (entityId, params) => {
|
|
7
|
+
const { encryptedCustomerId } = useAutumnContext();
|
|
8
|
+
const queryKey = ["entity", entityId, params?.expand];
|
|
9
|
+
const fetchEntity = async () => {
|
|
10
|
+
if (!entityId) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const { data: data2, error: error2 } = await getEntityAction({
|
|
14
|
+
encryptedCustomerId,
|
|
15
|
+
entityId,
|
|
16
|
+
params
|
|
17
|
+
});
|
|
18
|
+
if (error2) {
|
|
19
|
+
throw error2;
|
|
20
|
+
}
|
|
21
|
+
return data2;
|
|
22
|
+
};
|
|
23
|
+
const { data, error, isLoading, mutate } = useSWR(queryKey, fetchEntity);
|
|
24
|
+
return {
|
|
25
|
+
entity: data,
|
|
26
|
+
isLoading,
|
|
27
|
+
error,
|
|
28
|
+
refetch: mutate
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
useEntityProvider
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import useSWR from "swr";
|
|
4
|
+
import { getEntityAction } from "../../../next/server/cusActions";
|
|
5
|
+
import { useAutumnContext } from "../AutumnContext";
|
|
6
|
+
const useEntityProvider = (entityId, params) => {
|
|
7
|
+
const { encryptedCustomerId } = useAutumnContext();
|
|
8
|
+
const queryKey = ["entity", entityId, params?.expand];
|
|
9
|
+
const fetchEntity = async () => {
|
|
10
|
+
if (!entityId) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const { data: data2, error: error2 } = await getEntityAction({
|
|
14
|
+
encryptedCustomerId,
|
|
15
|
+
entityId,
|
|
16
|
+
params
|
|
17
|
+
});
|
|
18
|
+
if (error2) {
|
|
19
|
+
throw error2;
|
|
20
|
+
}
|
|
21
|
+
return data2;
|
|
22
|
+
};
|
|
23
|
+
const { data, error, isLoading, mutate } = useSWR(queryKey, fetchEntity);
|
|
24
|
+
return {
|
|
25
|
+
entity: data,
|
|
26
|
+
isLoading,
|
|
27
|
+
error,
|
|
28
|
+
refetch: mutate
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
useEntityProvider
|
|
33
|
+
};
|
|
@@ -1,2 +1,64 @@
|
|
|
1
|
-
import './cusTypes-DsDs_Qyb.mjs';
|
|
2
|
-
|
|
1
|
+
import { C as CustomerData, b as Customer } from './cusTypes-DsDs_Qyb.mjs';
|
|
2
|
+
import { E as Entity } from './entTypes-DMAhz9Dg.mjs';
|
|
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,2 +1,64 @@
|
|
|
1
|
-
import './cusTypes-DsDs_Qyb.js';
|
|
2
|
-
|
|
1
|
+
import { C as CustomerData, b as Customer } from './cusTypes-DsDs_Qyb.js';
|
|
2
|
+
import { E as Entity } from './entTypes-B1SnNOgv.js';
|
|
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 };
|
package/dist/next/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
+
import * as swr from 'swr';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
import { NextRequest, NextResponse } from 'next/server';
|
|
5
6
|
|
|
@@ -238,10 +239,10 @@ declare const usePricingTable: (options?: {
|
|
|
238
239
|
};
|
|
239
240
|
|
|
240
241
|
declare const useEntity: (entityId?: string, params?: GetEntityParams) => {
|
|
241
|
-
entity:
|
|
242
|
+
entity: any;
|
|
242
243
|
isLoading: boolean;
|
|
243
|
-
error:
|
|
244
|
-
refetch:
|
|
244
|
+
error: any;
|
|
245
|
+
refetch: swr.KeyedMutator<any>;
|
|
245
246
|
};
|
|
246
247
|
|
|
247
248
|
declare const AutumnContext: React$1.Context<AutumnContextParams>;
|
package/dist/next/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
+
import * as swr from 'swr';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
import { NextRequest, NextResponse } from 'next/server';
|
|
5
6
|
|
|
@@ -238,10 +239,10 @@ declare const usePricingTable: (options?: {
|
|
|
238
239
|
};
|
|
239
240
|
|
|
240
241
|
declare const useEntity: (entityId?: string, params?: GetEntityParams) => {
|
|
241
|
-
entity:
|
|
242
|
+
entity: any;
|
|
242
243
|
isLoading: boolean;
|
|
243
|
-
error:
|
|
244
|
-
refetch:
|
|
244
|
+
error: any;
|
|
245
|
+
refetch: swr.KeyedMutator<any>;
|
|
245
246
|
};
|
|
246
247
|
|
|
247
248
|
declare const AutumnContext: React$1.Context<AutumnContextParams>;
|
|
@@ -14,7 +14,7 @@ interface CreateEntityResult {
|
|
|
14
14
|
interface DeleteEntityResult {
|
|
15
15
|
success: boolean;
|
|
16
16
|
}
|
|
17
|
-
interface GetEntityParams {
|
|
17
|
+
interface GetEntityParams$1 {
|
|
18
18
|
expand?: EntityExpandOption[];
|
|
19
19
|
}
|
|
20
20
|
interface Entity {
|
|
@@ -202,4 +202,12 @@ interface UsageResult {
|
|
|
202
202
|
feature_id: string;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
interface GetEntityParams {
|
|
206
|
+
expand?: string[];
|
|
207
|
+
}
|
|
208
|
+
interface EntityDataParams {
|
|
209
|
+
name?: string;
|
|
210
|
+
featureId: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export type { AttachParams as A, CreateProductParams as C, DeleteEntityResult as D, Entity as E, GetEntityParams$1 as G, ListProductsParams as L, Product as P, TrackParams as T, UsageParams as U, CreateEntityParams as a, CreateEntityResult as b, AttachResult as c, UsageResult as d, CancelParams as e, CancelResult as f, CheckParams as g, CheckResult as h, TrackResult as i, GetEntityParams as j, AttachFeatureOptions as k, EntityDataParams as l };
|
|
@@ -14,7 +14,7 @@ interface CreateEntityResult {
|
|
|
14
14
|
interface DeleteEntityResult {
|
|
15
15
|
success: boolean;
|
|
16
16
|
}
|
|
17
|
-
interface GetEntityParams {
|
|
17
|
+
interface GetEntityParams$1 {
|
|
18
18
|
expand?: EntityExpandOption[];
|
|
19
19
|
}
|
|
20
20
|
interface Entity {
|
|
@@ -202,4 +202,12 @@ interface UsageResult {
|
|
|
202
202
|
feature_id: string;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
interface GetEntityParams {
|
|
206
|
+
expand?: string[];
|
|
207
|
+
}
|
|
208
|
+
interface EntityDataParams {
|
|
209
|
+
name?: string;
|
|
210
|
+
featureId: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export type { AttachParams as A, CreateProductParams as C, DeleteEntityResult as D, Entity as E, GetEntityParams$1 as G, ListProductsParams as L, Product as P, TrackParams as T, UsageParams as U, CreateEntityParams as a, CreateEntityResult as b, AttachResult as c, UsageResult as d, CancelParams as e, CancelResult as f, CheckParams as g, CheckResult as h, TrackResult as i, GetEntityParams as j, AttachFeatureOptions as k, EntityDataParams as l };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult } from './
|
|
1
|
+
import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult, j as GetEntityParams$1 } from './clientEntTypes-CvbBjPmI.mjs';
|
|
2
2
|
import { R as Result, A as AutumnError } from './response-BCg7kiiN.mjs';
|
|
3
3
|
import { G as GetCustomerParams, a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, C as CustomerData } from './cusTypes-BY1nr3mk.mjs';
|
|
4
4
|
|
|
@@ -118,7 +118,7 @@ declare const getCustomer: (args: Omit<{
|
|
|
118
118
|
declare const getEntityAction: (args: Omit<{
|
|
119
119
|
customerId: string;
|
|
120
120
|
entityId: string;
|
|
121
|
-
params?: GetEntityParams;
|
|
121
|
+
params?: GetEntityParams$1;
|
|
122
122
|
}, "customerId"> & {
|
|
123
123
|
encryptedCustomerId?: string;
|
|
124
124
|
}, request?: Request) => Promise<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult } from './
|
|
1
|
+
import { P as Product, C as CreateProductParams, L as ListProductsParams, G as GetEntityParams, E as Entity, a as CreateEntityParams, b as CreateEntityResult, D as DeleteEntityResult, A as AttachParams, c as AttachResult, U as UsageParams, d as UsageResult, e as CancelParams, f as CancelResult, g as CheckParams, h as CheckResult, T as TrackParams, i as TrackResult, j as GetEntityParams$1 } from './clientEntTypes-aaR6GtOf.js';
|
|
2
2
|
import { R as Result, A as AutumnError } from './response-BCg7kiiN.js';
|
|
3
3
|
import { G as GetCustomerParams, a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, C as CustomerData } from './cusTypes-BY1nr3mk.js';
|
|
4
4
|
|
|
@@ -118,7 +118,7 @@ declare const getCustomer: (args: Omit<{
|
|
|
118
118
|
declare const getEntityAction: (args: Omit<{
|
|
119
119
|
customerId: string;
|
|
120
120
|
entityId: string;
|
|
121
|
-
params?: GetEntityParams;
|
|
121
|
+
params?: GetEntityParams$1;
|
|
122
122
|
}, "customerId"> & {
|
|
123
123
|
encryptedCustomerId?: string;
|
|
124
124
|
}, request?: Request) => Promise<any>;
|
|
@@ -42,7 +42,11 @@ const getEntityAction = withAuth({
|
|
|
42
42
|
params
|
|
43
43
|
}) => {
|
|
44
44
|
const autumn = createAutumnClient();
|
|
45
|
-
const result = await autumn.entities.get(
|
|
45
|
+
const result = await autumn.entities.get(
|
|
46
|
+
customerId,
|
|
47
|
+
entityId,
|
|
48
|
+
params
|
|
49
|
+
);
|
|
46
50
|
return toServerResponse(result);
|
|
47
51
|
}
|
|
48
52
|
});
|
|
@@ -42,7 +42,11 @@ const getEntityAction = withAuth({
|
|
|
42
42
|
params
|
|
43
43
|
}) => {
|
|
44
44
|
const autumn = createAutumnClient();
|
|
45
|
-
const result = await autumn.entities.get(
|
|
45
|
+
const result = await autumn.entities.get(
|
|
46
|
+
customerId,
|
|
47
|
+
entityId,
|
|
48
|
+
params
|
|
49
|
+
);
|
|
46
50
|
return toServerResponse(result);
|
|
47
51
|
}
|
|
48
52
|
});
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as AttachFeatureOptions, l as EntityDataParams } from './clientEntTypes-CvbBjPmI.mjs';
|
|
2
2
|
import { C as CustomerData, B as BillingPortalParams } from './cusTypes-BY1nr3mk.mjs';
|
|
3
3
|
|
|
4
|
-
interface EntityDataParams {
|
|
5
|
-
name?: string;
|
|
6
|
-
featureId: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
4
|
declare const attachAction: (args: Omit<{
|
|
10
5
|
customerId: string;
|
|
11
6
|
customerData?: CustomerData;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as AttachFeatureOptions, l as EntityDataParams } from './clientEntTypes-aaR6GtOf.js';
|
|
2
2
|
import { C as CustomerData, B as BillingPortalParams } from './cusTypes-BY1nr3mk.js';
|
|
3
3
|
|
|
4
|
-
interface EntityDataParams {
|
|
5
|
-
name?: string;
|
|
6
|
-
featureId: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
4
|
declare const attachAction: (args: Omit<{
|
|
10
5
|
customerId: string;
|
|
11
6
|
customerData?: CustomerData;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autumn-js",
|
|
3
3
|
"description": "Autumn JS Library",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.49",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"cli": "tsx src/cli/index.ts",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"rou3": "^0.6.1"
|
|
91
|
+
"rou3": "^0.6.1",
|
|
92
|
+
"swr": "^2.3.3"
|
|
92
93
|
},
|
|
93
94
|
"typesVersions": {
|
|
94
95
|
"*": {
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice, C as CustomerData, b as Customer } from './cusTypes-DsDs_Qyb.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,29 +0,0 @@
|
|
|
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 };
|
|
@@ -1,29 +0,0 @@
|
|
|
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 };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice, C as CustomerData, b as Customer } from './cusTypes-DsDs_Qyb.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 };
|