autumn-js 0.0.30 → 0.0.33

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.
Files changed (76) hide show
  1. package/dist/next/AutumnProvider.js +1 -3
  2. package/dist/next/AutumnProvider.mjs +1 -3
  3. package/dist/next/client/AutumnContext.d.mts +2 -2
  4. package/dist/next/client/AutumnContext.d.ts +2 -2
  5. package/dist/next/client/AutumnContext.js +4 -0
  6. package/dist/next/client/AutumnContext.mjs +4 -0
  7. package/dist/next/client/AutumnProvider.d.mts +2 -6
  8. package/dist/next/client/AutumnProvider.d.ts +2 -6
  9. package/dist/next/client/AutumnProvider.js +16 -9
  10. package/dist/next/client/AutumnProvider.mjs +16 -9
  11. package/dist/next/client/clientUtils.d.mts +2 -2
  12. package/dist/next/client/clientUtils.d.ts +2 -2
  13. package/dist/next/client/{cusTypes-CBQqMlZy.d.mts → cusTypes-Cb2VYILZ.d.mts} +1 -1
  14. package/dist/next/client/{cusTypes-CBQqMlZy.d.ts → cusTypes-Cb2VYILZ.d.ts} +1 -1
  15. package/dist/next/client/{entTypes-X4EHXDE5.d.ts → entTypes-BY0W7TQY.d.ts} +1 -1
  16. package/dist/next/client/{entTypes-DHSCGE1o.d.mts → entTypes-C8YyvH78.d.mts} +1 -1
  17. package/dist/next/client/hooks/types.d.mts +3 -1
  18. package/dist/next/client/hooks/types.d.ts +3 -1
  19. package/dist/next/client/hooks/useAutumn.d.mts +4 -40
  20. package/dist/next/client/hooks/useAutumn.d.ts +4 -40
  21. package/dist/next/client/hooks/useAutumn.js +25 -114
  22. package/dist/next/client/hooks/useAutumn.mjs +25 -114
  23. package/dist/next/client/hooks/useCustomer.d.mts +2 -1
  24. package/dist/next/client/hooks/useCustomer.d.ts +2 -1
  25. package/dist/next/client/hooks/useCustomer.js +1 -0
  26. package/dist/next/client/hooks/useCustomer.mjs +1 -0
  27. package/dist/next/client/hooks/useEntity.d.mts +2 -2
  28. package/dist/next/client/hooks/useEntity.d.ts +2 -2
  29. package/dist/next/client/hooks/useEntity.js +5 -7
  30. package/dist/next/client/hooks/useEntity.mjs +5 -7
  31. package/dist/next/client/hooks/usePricingTable.d.mts +2 -2
  32. package/dist/next/client/hooks/usePricingTable.d.ts +2 -2
  33. package/dist/next/client/types.d.mts +4 -2
  34. package/dist/next/client/types.d.ts +4 -2
  35. package/dist/next/index.d.mts +53 -100
  36. package/dist/next/index.d.ts +53 -100
  37. package/dist/next/index.js +0 -2
  38. package/dist/next/index.mjs +0 -1
  39. package/dist/next/server/genActions.d.mts +1 -14
  40. package/dist/next/server/genActions.d.ts +1 -14
  41. package/dist/next/server/genActions.js +0 -30
  42. package/dist/next/server/genActions.mjs +0 -30
  43. package/dist/sdk/check.d.mts +47 -0
  44. package/dist/sdk/check.d.ts +47 -0
  45. package/dist/sdk/{cusTypes-BkqhmnvO.d.mts → cusTypes-1gVjxtAM.d.mts} +1 -1
  46. package/dist/sdk/{cusTypes-Xg665KFq.d.ts → cusTypes-2Z7Pse3i.d.mts} +3 -1
  47. package/dist/sdk/{cusTypes-CjqnH7C3.d.ts → cusTypes-B7CQWtcF.d.ts} +1 -1
  48. package/dist/sdk/{cusTypes-BPazw8Ki.d.mts → cusTypes-C-0PPSaY.d.ts} +3 -1
  49. package/dist/sdk/customers.d.mts +2 -2
  50. package/dist/sdk/customers.d.ts +2 -2
  51. package/dist/sdk/entities.d.mts +2 -2
  52. package/dist/sdk/entities.d.ts +2 -2
  53. package/dist/sdk/genEnums-DeFd80Sr.d.mts +6 -0
  54. package/dist/sdk/genEnums-DeFd80Sr.d.ts +6 -0
  55. package/dist/sdk/general.d.mts +2 -2
  56. package/dist/sdk/general.d.ts +2 -2
  57. package/dist/sdk/index.d.mts +6 -4
  58. package/dist/sdk/index.d.ts +6 -4
  59. package/dist/sdk/{prodEnums-CuZfnjiK.d.mts → prodEnums-C1lccCWI.d.mts} +2 -1
  60. package/dist/sdk/{prodEnums-CuZfnjiK.d.ts → prodEnums-C1lccCWI.d.ts} +2 -1
  61. package/dist/sdk/{prodEnums-BnhKkH4e.d.mts → prodEnums-DHDDT-uF.d.mts} +5 -8
  62. package/dist/sdk/{prodEnums-BnhKkH4e.d.ts → prodEnums-DHDDT-uF.d.ts} +5 -8
  63. package/dist/sdk/products.d.mts +1 -1
  64. package/dist/sdk/products.d.ts +1 -1
  65. package/package.json +1 -1
  66. package/tsup.config.ts +2 -0
  67. package/dist/next/webpack-ignore.js +0 -33
  68. package/dist/next/webpack-ignore.mjs +0 -13
  69. package/dist/sdk/cusTypes-B6L_-8Kz.d.mts +0 -79
  70. package/dist/sdk/cusTypes-B9fUPd5R.d.ts +0 -68
  71. package/dist/sdk/cusTypes-BIzuiqvx.d.mts +0 -74
  72. package/dist/sdk/cusTypes-BxDQNrCc.d.ts +0 -79
  73. package/dist/sdk/cusTypes-DEdFHlrl.d.mts +0 -68
  74. package/dist/sdk/cusTypes-DOUPrslI.d.ts +0 -79
  75. package/dist/sdk/cusTypes-Dqi6Qcj0.d.mts +0 -79
  76. package/dist/sdk/cusTypes-HqJzG9Vv.d.ts +0 -74
@@ -29,8 +29,7 @@ const AutumnProvider = ({
29
29
  customerId,
30
30
  customerData,
31
31
  authPlugin,
32
- children,
33
- components
32
+ children
34
33
  }) => {
35
34
  if (typeof window !== "undefined") {
36
35
  throw new Error(
@@ -49,7 +48,6 @@ const AutumnProvider = ({
49
48
  {
50
49
  encryptedCustomerId,
51
50
  customerData,
52
- components,
53
51
  children
54
52
  }
55
53
  );
@@ -6,8 +6,7 @@ const AutumnProvider = ({
6
6
  customerId,
7
7
  customerData,
8
8
  authPlugin,
9
- children,
10
- components
9
+ children
11
10
  }) => {
12
11
  if (typeof window !== "undefined") {
13
12
  throw new Error(
@@ -26,7 +25,6 @@ const AutumnProvider = ({
26
25
  {
27
26
  encryptedCustomerId,
28
27
  customerData,
29
- components,
30
28
  children
31
29
  }
32
30
  );
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { AutumnContextParams } from './types.mjs';
3
- import './cusTypes-CBQqMlZy.mjs';
4
- import './entTypes-DHSCGE1o.mjs';
3
+ import './cusTypes-Cb2VYILZ.mjs';
4
+ import './entTypes-C8YyvH78.mjs';
5
5
 
6
6
  declare const AutumnContext: react.Context<AutumnContextParams>;
7
7
  declare const useAutumnContext: () => AutumnContextParams;
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { AutumnContextParams } from './types.js';
3
- import './cusTypes-CBQqMlZy.js';
4
- import './entTypes-X4EHXDE5.js';
3
+ import './cusTypes-Cb2VYILZ.js';
4
+ import './entTypes-BY0W7TQY.js';
5
5
 
6
6
  declare const AutumnContext: react.Context<AutumnContextParams>;
7
7
  declare const useAutumnContext: () => AutumnContextParams;
@@ -15,6 +15,8 @@ const AutumnContext = createContext({
15
15
  setProps: () => {
16
16
  },
17
17
  setOpen: () => {
18
+ },
19
+ setComponent: () => {
18
20
  }
19
21
  },
20
22
  paywallDialog: {
@@ -22,6 +24,8 @@ const AutumnContext = createContext({
22
24
  setProps: () => {
23
25
  },
24
26
  setOpen: () => {
27
+ },
28
+ setComponent: () => {
25
29
  }
26
30
  },
27
31
  pricingTableProducts: null,
@@ -15,6 +15,8 @@ const AutumnContext = createContext({
15
15
  setProps: () => {
16
16
  },
17
17
  setOpen: () => {
18
+ },
19
+ setComponent: () => {
18
20
  }
19
21
  },
20
22
  paywallDialog: {
@@ -22,6 +24,8 @@ const AutumnContext = createContext({
22
24
  setProps: () => {
23
25
  },
24
26
  setOpen: () => {
27
+ },
28
+ setComponent: () => {
25
29
  }
26
30
  },
27
31
  pricingTableProducts: null,
@@ -1,15 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as CustomerData } from './cusTypes-CBQqMlZy.mjs';
2
+ import { C as CustomerData } from './cusTypes-Cb2VYILZ.mjs';
3
3
 
4
4
  interface AutumnProviderProps {
5
5
  children?: React.ReactNode;
6
6
  encryptedCustomerId?: string;
7
7
  customerData?: CustomerData;
8
- components?: {
9
- paywallDialog?: any;
10
- productChangeDialog?: any;
11
- };
12
8
  }
13
- declare const AutumnClientProvider: ({ children, encryptedCustomerId, customerData, components, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
9
+ declare const AutumnClientProvider: ({ children, encryptedCustomerId, customerData, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
14
10
 
15
11
  export { AutumnClientProvider, type AutumnProviderProps };
@@ -1,15 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as CustomerData } from './cusTypes-CBQqMlZy.js';
2
+ import { C as CustomerData } from './cusTypes-Cb2VYILZ.js';
3
3
 
4
4
  interface AutumnProviderProps {
5
5
  children?: React.ReactNode;
6
6
  encryptedCustomerId?: string;
7
7
  customerData?: CustomerData;
8
- components?: {
9
- paywallDialog?: any;
10
- productChangeDialog?: any;
11
- };
12
8
  }
13
- declare const AutumnClientProvider: ({ children, encryptedCustomerId, customerData, components, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
9
+ declare const AutumnClientProvider: ({ children, encryptedCustomerId, customerData, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
14
10
 
15
11
  export { AutumnClientProvider, type AutumnProviderProps };
@@ -7,11 +7,6 @@ const useDialog = (component) => {
7
7
  const [dialogFound, setDialogFound] = useState(false);
8
8
  const [dialogProps, setDialogProps] = useState(null);
9
9
  const [dialogOpen, setDialogOpen] = useState(false);
10
- useEffect(() => {
11
- if (dialogProps) {
12
- setDialogOpen(true);
13
- }
14
- }, [dialogProps]);
15
10
  useEffect(() => {
16
11
  if (!dialogOpen) {
17
12
  setTimeout(() => {
@@ -34,11 +29,11 @@ const useDialog = (component) => {
34
29
  const AutumnClientProvider = ({
35
30
  children,
36
31
  encryptedCustomerId,
37
- customerData,
38
- components
32
+ customerData
39
33
  }) => {
40
34
  let [customer, setCustomer] = useState(null);
41
35
  let [pricingTableProducts, setPricingTableProducts] = useState(null);
36
+ const [components, setComponents] = useState({});
42
37
  const [entity, setEntity] = useState(null);
43
38
  const [
44
39
  prodChangeDialogFound,
@@ -65,12 +60,24 @@ const AutumnClientProvider = ({
65
60
  prodChangeDialog: {
66
61
  found: prodChangeDialogFound,
67
62
  setProps: setProdChangeDialogProps,
68
- setOpen: setProdChangeDialogOpen
63
+ setOpen: setProdChangeDialogOpen,
64
+ setComponent: (component) => {
65
+ setComponents({
66
+ ...components,
67
+ productChangeDialog: component
68
+ });
69
+ }
69
70
  },
70
71
  paywallDialog: {
71
72
  found: paywallFound,
72
73
  setProps: setPaywallProps,
73
- setOpen: setPaywallOpen
74
+ setOpen: setPaywallOpen,
75
+ setComponent: (component) => {
76
+ setComponents({
77
+ ...components,
78
+ paywallDialog: component
79
+ });
80
+ }
74
81
  },
75
82
  pricingTableProducts,
76
83
  setPricingTableProducts,
@@ -7,11 +7,6 @@ const useDialog = (component) => {
7
7
  const [dialogFound, setDialogFound] = useState(false);
8
8
  const [dialogProps, setDialogProps] = useState(null);
9
9
  const [dialogOpen, setDialogOpen] = useState(false);
10
- useEffect(() => {
11
- if (dialogProps) {
12
- setDialogOpen(true);
13
- }
14
- }, [dialogProps]);
15
10
  useEffect(() => {
16
11
  if (!dialogOpen) {
17
12
  setTimeout(() => {
@@ -34,11 +29,11 @@ const useDialog = (component) => {
34
29
  const AutumnClientProvider = ({
35
30
  children,
36
31
  encryptedCustomerId,
37
- customerData,
38
- components
32
+ customerData
39
33
  }) => {
40
34
  let [customer, setCustomer] = useState(null);
41
35
  let [pricingTableProducts, setPricingTableProducts] = useState(null);
36
+ const [components, setComponents] = useState({});
42
37
  const [entity, setEntity] = useState(null);
43
38
  const [
44
39
  prodChangeDialogFound,
@@ -65,12 +60,24 @@ const AutumnClientProvider = ({
65
60
  prodChangeDialog: {
66
61
  found: prodChangeDialogFound,
67
62
  setProps: setProdChangeDialogProps,
68
- setOpen: setProdChangeDialogOpen
63
+ setOpen: setProdChangeDialogOpen,
64
+ setComponent: (component) => {
65
+ setComponents({
66
+ ...components,
67
+ productChangeDialog: component
68
+ });
69
+ }
69
70
  },
70
71
  paywallDialog: {
71
72
  found: paywallFound,
72
73
  setProps: setPaywallProps,
73
- setOpen: setPaywallOpen
74
+ setOpen: setPaywallOpen,
75
+ setComponent: (component) => {
76
+ setComponents({
77
+ ...components,
78
+ paywallDialog: component
79
+ });
80
+ }
74
81
  },
75
82
  pricingTableProducts,
76
83
  setPricingTableProducts,
@@ -1,6 +1,6 @@
1
1
  import { AutumnClientError, PricingTableProduct } from './types.mjs';
2
- import './cusTypes-CBQqMlZy.mjs';
3
- import './entTypes-DHSCGE1o.mjs';
2
+ import './cusTypes-Cb2VYILZ.mjs';
3
+ import './entTypes-C8YyvH78.mjs';
4
4
 
5
5
  declare const toClientErrorResponse: (error: any) => {
6
6
  data: null;
@@ -1,6 +1,6 @@
1
1
  import { AutumnClientError, PricingTableProduct } from './types.js';
2
- import './cusTypes-CBQqMlZy.js';
3
- import './entTypes-X4EHXDE5.js';
2
+ import './cusTypes-Cb2VYILZ.js';
3
+ import './entTypes-BY0W7TQY.js';
4
4
 
5
5
  declare const toClientErrorResponse: (error: any) => {
6
6
  data: null;
@@ -77,4 +77,4 @@ interface CustomerInvoice {
77
77
  created_at: number;
78
78
  }
79
79
 
80
- export type { CustomerData as C, Customer as a, CustomerExpandOption as b, CustomerProduct as c, CustomerFeature as d, CustomerInvoice as e };
80
+ export type { CustomerData as C, CustomerExpandOption as a, Customer as b, CustomerProduct as c, CustomerFeature as d, CustomerInvoice as e };
@@ -77,4 +77,4 @@ interface CustomerInvoice {
77
77
  created_at: number;
78
78
  }
79
79
 
80
- export type { CustomerData as C, Customer as a, CustomerExpandOption as b, CustomerProduct as c, CustomerFeature as d, CustomerInvoice as e };
80
+ export type { CustomerData as C, CustomerExpandOption as a, Customer as b, CustomerProduct as c, CustomerFeature as d, CustomerInvoice as e };
@@ -1,4 +1,4 @@
1
- import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice } from './cusTypes-CBQqMlZy.js';
1
+ import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice } from './cusTypes-Cb2VYILZ.js';
2
2
 
3
3
  type EntityExpandOption = "invoices";
4
4
 
@@ -1,4 +1,4 @@
1
- import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice } from './cusTypes-CBQqMlZy.mjs';
1
+ import { c as CustomerProduct, d as CustomerFeature, e as CustomerInvoice } from './cusTypes-Cb2VYILZ.mjs';
2
2
 
3
3
  type EntityExpandOption = "invoices";
4
4
 
@@ -1,5 +1,6 @@
1
+ import react__default from 'react';
2
+
1
3
  interface AttachParams {
2
- dialog?: boolean;
3
4
  productId: string;
4
5
  entityId?: string;
5
6
  options?: {
@@ -9,6 +10,7 @@ interface AttachParams {
9
10
  successUrl?: string;
10
11
  forceCheckout?: boolean;
11
12
  metadata?: Record<string, string>;
13
+ dialog?: () => JSX.Element | react__default.ReactNode;
12
14
  callback?: () => Promise<void>;
13
15
  withPreview?: "formatted" | "raw";
14
16
  }
@@ -1,5 +1,6 @@
1
+ import react__default from 'react';
2
+
1
3
  interface AttachParams {
2
- dialog?: boolean;
3
4
  productId: string;
4
5
  entityId?: string;
5
6
  options?: {
@@ -9,6 +10,7 @@ interface AttachParams {
9
10
  successUrl?: string;
10
11
  forceCheckout?: boolean;
11
12
  metadata?: Record<string, string>;
13
+ dialog?: () => JSX.Element | react__default.ReactNode;
12
14
  callback?: () => Promise<void>;
13
15
  withPreview?: "formatted" | "raw";
14
16
  }
@@ -1,17 +1,16 @@
1
- import { A as AutumnError } from '../error-CG2LXoa7.mjs';
2
- import { a as Customer } from '../cusTypes-CBQqMlZy.mjs';
3
1
  import { AttachParams } from './types.mjs';
2
+ import 'react';
4
3
 
5
4
  declare const useAutumn: () => {
6
- attach: ({ dialog, productId, entityId, options, successUrl, forceCheckout, metadata, callback, }: AttachParams) => Promise<any>;
7
- check: ({ dialog, featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, }: {
8
- dialog?: boolean;
5
+ attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
6
+ check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
9
7
  featureId?: string;
10
8
  productId?: string;
11
9
  entityId?: string;
12
10
  requiredQuantity?: number;
13
11
  sendEvent?: boolean;
14
12
  withPreview?: "formatted" | "raw";
13
+ dialog?: (data: any) => JSX.Element | React.ReactNode;
15
14
  }) => Promise<any>;
16
15
  track: ({ featureId, entityId, value, }: {
17
16
  featureId: string;
@@ -25,41 +24,6 @@ declare const useAutumn: () => {
25
24
  openBillingPortal: (options?: {
26
25
  returnUrl?: string;
27
26
  }) => Promise<any>;
28
- /**
29
- * @deprecated Use track({featureId, value}) instead.
30
- * This method is deprecated and will be removed in a future version.
31
- */
32
- event: ({ featureId, value, }: {
33
- featureId: string;
34
- value?: number;
35
- }) => Promise<any>;
36
- /**
37
- * @deprecated Use check({featureId}) instead.
38
- * This method is deprecated and will be removed in a future version.
39
- */
40
- entitled: ({ featureId }: {
41
- featureId: string;
42
- }) => Promise<any>;
43
- /**
44
- * @deprecated Use the useCustomer() hook instead.
45
- * This property is deprecated and will be removed in a future version.
46
- */
47
- customer: Customer | null;
48
- /**
49
- * @deprecated Use the useCustomer() hook instead.
50
- * This property is deprecated and will be removed in a future version.
51
- */
52
- loading: boolean;
53
- /**
54
- * @deprecated Use the useCustomer() hook instead.
55
- * This property is deprecated and will be removed in a future version.
56
- */
57
- error: AutumnError | null;
58
- /**
59
- * @deprecated Use the useCustomer() hook instead.
60
- * This property is deprecated and will be removed in a future version.
61
- */
62
- refetch: () => Promise<void>;
63
27
  };
64
28
 
65
29
  export { useAutumn };
@@ -1,17 +1,16 @@
1
- import { A as AutumnError } from '../error-CG2LXoa7.js';
2
- import { a as Customer } from '../cusTypes-CBQqMlZy.js';
3
1
  import { AttachParams } from './types.js';
2
+ import 'react';
4
3
 
5
4
  declare const useAutumn: () => {
6
- attach: ({ dialog, productId, entityId, options, successUrl, forceCheckout, metadata, callback, }: AttachParams) => Promise<any>;
7
- check: ({ dialog, featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, }: {
8
- dialog?: boolean;
5
+ attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
6
+ check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
9
7
  featureId?: string;
10
8
  productId?: string;
11
9
  entityId?: string;
12
10
  requiredQuantity?: number;
13
11
  sendEvent?: boolean;
14
12
  withPreview?: "formatted" | "raw";
13
+ dialog?: (data: any) => JSX.Element | React.ReactNode;
15
14
  }) => Promise<any>;
16
15
  track: ({ featureId, entityId, value, }: {
17
16
  featureId: string;
@@ -25,41 +24,6 @@ declare const useAutumn: () => {
25
24
  openBillingPortal: (options?: {
26
25
  returnUrl?: string;
27
26
  }) => Promise<any>;
28
- /**
29
- * @deprecated Use track({featureId, value}) instead.
30
- * This method is deprecated and will be removed in a future version.
31
- */
32
- event: ({ featureId, value, }: {
33
- featureId: string;
34
- value?: number;
35
- }) => Promise<any>;
36
- /**
37
- * @deprecated Use check({featureId}) instead.
38
- * This method is deprecated and will be removed in a future version.
39
- */
40
- entitled: ({ featureId }: {
41
- featureId: string;
42
- }) => Promise<any>;
43
- /**
44
- * @deprecated Use the useCustomer() hook instead.
45
- * This property is deprecated and will be removed in a future version.
46
- */
47
- customer: Customer | null;
48
- /**
49
- * @deprecated Use the useCustomer() hook instead.
50
- * This property is deprecated and will be removed in a future version.
51
- */
52
- loading: boolean;
53
- /**
54
- * @deprecated Use the useCustomer() hook instead.
55
- * This property is deprecated and will be removed in a future version.
56
- */
57
- error: AutumnError | null;
58
- /**
59
- * @deprecated Use the useCustomer() hook instead.
60
- * This property is deprecated and will be removed in a future version.
61
- */
62
- refetch: () => Promise<void>;
63
27
  };
64
28
 
65
29
  export { useAutumn };