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.
Files changed (95) hide show
  1. package/README.md +1 -2
  2. package/dist/next/AutumnProvider.js +3 -1
  3. package/dist/next/AutumnProvider.mjs +3 -1
  4. package/dist/next/client/AutumnContext.d.mts +2 -4
  5. package/dist/next/client/AutumnContext.d.ts +2 -4
  6. package/dist/next/client/AutumnContext.js +3 -0
  7. package/dist/next/client/AutumnContext.mjs +3 -0
  8. package/dist/next/client/AutumnProvider.d.mts +5 -1
  9. package/dist/next/client/AutumnProvider.d.ts +5 -1
  10. package/dist/next/client/AutumnProvider.js +77 -6
  11. package/dist/next/client/AutumnProvider.mjs +77 -6
  12. package/dist/next/client/{error-BUtm1Pks.d.mts → error-CG2LXoa7.d.mts} +1 -1
  13. package/dist/next/client/{error-BUtm1Pks.d.ts → error-CG2LXoa7.d.ts} +1 -1
  14. package/dist/next/client/hooks/types.d.mts +14 -0
  15. package/dist/next/client/hooks/types.d.ts +14 -0
  16. package/dist/next/client/hooks/types.js +2 -0
  17. package/dist/next/client/hooks/types.mjs +2 -0
  18. package/dist/next/client/hooks/useAutumn.d.mts +38 -33
  19. package/dist/next/client/hooks/useAutumn.d.ts +38 -33
  20. package/dist/next/client/hooks/useAutumn.js +162 -41
  21. package/dist/next/client/hooks/useAutumn.mjs +162 -41
  22. package/dist/next/client/hooks/useCustomer.d.mts +4 -6
  23. package/dist/next/client/hooks/useCustomer.d.ts +4 -6
  24. package/dist/next/client/hooks/useCustomer.js +15 -4
  25. package/dist/next/client/hooks/useCustomer.mjs +15 -4
  26. package/dist/next/client/hooks/usePricingTable.d.mts +36 -0
  27. package/dist/next/client/hooks/usePricingTable.d.ts +36 -0
  28. package/dist/next/client/hooks/usePricingTable.js +65 -0
  29. package/dist/next/client/hooks/usePricingTable.mjs +65 -0
  30. package/dist/next/client/types.d.mts +12 -1
  31. package/dist/next/client/types.d.ts +12 -1
  32. package/dist/next/client/types.js +20 -0
  33. package/dist/next/client/types.mjs +20 -0
  34. package/dist/next/index.d.mts +102 -102
  35. package/dist/next/index.d.ts +102 -102
  36. package/dist/next/index.js +2 -0
  37. package/dist/next/index.mjs +1 -0
  38. package/dist/next/server/auth/clerk-wrapper.d.mts +3 -0
  39. package/dist/next/server/auth/clerk-wrapper.d.ts +3 -0
  40. package/dist/next/server/auth/clerk-wrapper.js +21 -0
  41. package/dist/next/server/auth/clerk-wrapper.mjs +21 -0
  42. package/dist/next/server/auth/handleAuthProvider.d.mts +5 -23
  43. package/dist/next/server/auth/handleAuthProvider.d.ts +5 -23
  44. package/dist/next/server/auth/handleAuthProvider.js +4 -10
  45. package/dist/next/server/auth/handleAuthProvider.mjs +4 -10
  46. package/dist/next/server/auth/supabase-wrapper.js +44 -0
  47. package/dist/next/server/auth/supabase-wrapper.mjs +44 -0
  48. package/dist/next/server/auth/withAuth.d.mts +6 -2
  49. package/dist/next/server/auth/withAuth.d.ts +6 -2
  50. package/dist/next/server/auth/withAuth.js +5 -1
  51. package/dist/next/server/auth/withAuth.mjs +5 -1
  52. package/dist/next/server/componentActions.d.mts +11 -0
  53. package/dist/next/server/componentActions.d.ts +11 -0
  54. package/dist/next/server/componentActions.js +21 -0
  55. package/dist/next/server/componentActions.mjs +21 -0
  56. package/dist/next/server/cusActions.d.mts +7 -27
  57. package/dist/next/server/cusActions.d.ts +7 -27
  58. package/dist/next/server/cusActions.js +13 -10
  59. package/dist/next/server/cusActions.mjs +13 -10
  60. package/dist/next/server/{cusTypes-G4c15fDy.d.mts → cusTypes-B9N9G7Vr.d.mts} +1 -1
  61. package/dist/next/server/{cusTypes-G4c15fDy.d.ts → cusTypes-B9N9G7Vr.d.ts} +1 -1
  62. package/dist/next/server/genActions.d.mts +3 -2
  63. package/dist/next/server/genActions.d.ts +3 -2
  64. package/dist/next/server/genActions.js +37 -26
  65. package/dist/next/server/genActions.mjs +37 -26
  66. package/dist/next/server/{genTypes-B-HSg3vG.d.mts → genTypes-BDibiu0E.d.ts} +2 -1
  67. package/dist/next/server/{genTypes-OgZRrjL_.d.ts → genTypes-DDkwFU_V.d.mts} +2 -1
  68. package/dist/next/server/response-CmSY57k6.d.mts +26 -0
  69. package/dist/next/server/response-CmSY57k6.d.ts +26 -0
  70. package/dist/next/server/utils.d.mts +5 -0
  71. package/dist/next/server/utils.d.ts +5 -0
  72. package/dist/next/server/utils.js +16 -0
  73. package/dist/next/server/utils.mjs +16 -0
  74. package/dist/next/{AutumnServer.js → webpack-ignore.js} +13 -16
  75. package/dist/next/webpack-ignore.mjs +13 -0
  76. package/dist/sdk/general.d.mts +1 -0
  77. package/dist/sdk/general.d.ts +1 -0
  78. package/dist/sdk/index.d.mts +29 -3
  79. package/dist/sdk/index.d.ts +29 -3
  80. package/dist/sdk/index.js +48 -2
  81. package/dist/sdk/index.mjs +48 -3
  82. package/dist/sdk/products.d.mts +3 -1
  83. package/dist/sdk/products.d.ts +3 -1
  84. package/dist/utils/encryptUtils.js +330 -3
  85. package/dist/utils/encryptUtils.mjs +330 -3
  86. package/package.json +10 -3
  87. package/tsup.config.ts +8 -0
  88. package/dist/next/AutumnServer.mjs +0 -12
  89. package/dist/next/server/auth/utils.js +0 -25
  90. package/dist/next/server/auth/utils.mjs +0 -25
  91. package/dist/sdk/cusTypes-BxbYGvfU.d.mts +0 -68
  92. package/dist/sdk/cusTypes-CcZ5ZhSo.d.ts +0 -68
  93. package/tsconfig.json +0 -25
  94. /package/dist/next/server/auth/{utils.d.mts → supabase-wrapper.d.mts} +0 -0
  95. /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 { customer, attach, openBillingPortal } = useAutumn()
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<AutumnContextParams>;
6
- declare const useAutumnContext: () => AutumnContextParams;
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<AutumnContextParams>;
6
- declare const useAutumnContext: () => AutumnContextParams;
3
+ declare const AutumnContext: react.Context<any>;
4
+ declare const useAutumnContext: () => any;
7
5
 
8
6
  export { AutumnContext, useAutumnContext };
@@ -7,6 +7,9 @@ const AutumnContext = createContext({
7
7
  authProvider: "better-auth",
8
8
  customer: null,
9
9
  setCustomer: () => {
10
+ },
11
+ paywallOpen: false,
12
+ setPaywallOpen: () => {
10
13
  }
11
14
  });
12
15
  const useAutumnContext = () => {
@@ -7,6 +7,9 @@ const AutumnContext = createContext({
7
7
  authProvider: "better-auth",
8
8
  customer: null,
9
9
  setCustomer: () => {
10
+ },
11
+ paywallOpen: false,
12
+ setPaywallOpen: () => {
10
13
  }
11
14
  });
12
15
  const 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
- return /* @__PURE__ */ jsx(
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
- return /* @__PURE__ */ jsx(
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
  };
@@ -2,7 +2,7 @@ interface ErrorResponse {
2
2
  message: string;
3
3
  code: string;
4
4
  }
5
- declare class AutumnError {
5
+ declare class AutumnError extends Error {
6
6
  readonly message: string;
7
7
  readonly code: string;
8
8
  constructor(response: ErrorResponse);
@@ -2,7 +2,7 @@ interface ErrorResponse {
2
2
  message: string;
3
3
  code: string;
4
4
  }
5
- declare class AutumnError {
5
+ declare class AutumnError extends Error {
6
6
  readonly message: string;
7
7
  readonly code: string;
8
8
  constructor(response: ErrorResponse);
@@ -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 };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+
@@ -0,0 +1,2 @@
1
+ "use client";
2
+
@@ -1,23 +1,21 @@
1
- import { A as AutumnError } from '../error-BUtm1Pks.mjs';
2
- import { a as Customer } from '../cusTypes-BUiIMwvu.mjs';
1
+ import { A as AutumnError } from '../error-CG2LXoa7.mjs';
2
+ import { AttachParams } from './types.mjs';
3
3
 
4
- interface UseAutumnOptions {
5
- autoCreate?: boolean;
6
- }
7
- declare const useAutumn: (options?: UseAutumnOptions) => {
8
- customer: Customer | null;
9
- loading: boolean;
10
- error: AutumnError | null;
11
- refetch: () => Promise<void>;
12
- attach: ({ productId, options, successUrl, forceCheckout, metadata, }: {
13
- productId: string;
14
- options?: {
15
- featureId: string;
16
- quantity: number;
17
- }[];
18
- successUrl?: string;
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
- check: ({ featureId, productId, requiredQuantity, sendEvent, }: {
38
- featureId?: string;
39
- productId?: string;
40
- requiredQuantity?: number;
41
- sendEvent?: boolean;
42
- }) => Promise<any>;
43
- track: ({ featureId, value, }: {
44
- featureId: string;
45
- value?: number;
46
- }) => Promise<any>;
47
- openBillingPortal: (options?: {
48
- returnUrl?: string;
49
- }) => Promise<any>;
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 { type UseAutumnOptions, useAutumn };
57
+ export { useAutumn };
@@ -1,23 +1,21 @@
1
- import { A as AutumnError } from '../error-BUtm1Pks.js';
2
- import { a as Customer } from '../cusTypes-BUiIMwvu.js';
1
+ import { A as AutumnError } from '../error-CG2LXoa7.js';
2
+ import { AttachParams } from './types.js';
3
3
 
4
- interface UseAutumnOptions {
5
- autoCreate?: boolean;
6
- }
7
- declare const useAutumn: (options?: UseAutumnOptions) => {
8
- customer: Customer | null;
9
- loading: boolean;
10
- error: AutumnError | null;
11
- refetch: () => Promise<void>;
12
- attach: ({ productId, options, successUrl, forceCheckout, metadata, }: {
13
- productId: string;
14
- options?: {
15
- featureId: string;
16
- quantity: number;
17
- }[];
18
- successUrl?: string;
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
- check: ({ featureId, productId, requiredQuantity, sendEvent, }: {
38
- featureId?: string;
39
- productId?: string;
40
- requiredQuantity?: number;
41
- sendEvent?: boolean;
42
- }) => Promise<any>;
43
- track: ({ featureId, value, }: {
44
- featureId: string;
45
- value?: number;
46
- }) => Promise<any>;
47
- openBillingPortal: (options?: {
48
- returnUrl?: string;
49
- }) => Promise<any>;
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 { type UseAutumnOptions, useAutumn };
57
+ export { useAutumn };