autumn-js 0.0.41 → 0.0.44

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 (143) hide show
  1. package/dist/libraries/backend/{chunk-UD4U5ECV.mjs → chunk-BQYMRMGB.mjs} +1 -1
  2. package/dist/libraries/backend/{chunk-7SOQYC4B.mjs → chunk-DXILLNEF.mjs} +1 -2
  3. package/dist/libraries/backend/{chunk-XPNATE4H.mjs → chunk-LRE7V775.mjs} +1 -1
  4. package/dist/libraries/backend/{chunk-V7VIK7Q2.mjs → chunk-OMSV2SEC.mjs} +4 -3
  5. package/dist/libraries/backend/{chunk-GA6SKSWH.mjs → chunk-U357CO3L.mjs} +4 -4
  6. package/dist/libraries/backend/{entTypes-BHLroNdS.d.mts → client-C4aZxBxK.d.mts} +34 -28
  7. package/dist/libraries/backend/{entTypes-BJGM9Knl.d.ts → client-DJJAbrX7.d.ts} +34 -28
  8. package/dist/libraries/backend/express.js +4 -4
  9. package/dist/libraries/backend/express.mjs +5 -5
  10. package/dist/libraries/backend/fastify.js +4 -4
  11. package/dist/libraries/backend/fastify.mjs +5 -5
  12. package/dist/libraries/backend/hono.js +4 -4
  13. package/dist/libraries/backend/hono.mjs +5 -5
  14. package/dist/libraries/backend/next.js +4 -4
  15. package/dist/libraries/backend/next.mjs +5 -5
  16. package/dist/libraries/backend/remix.js +4 -4
  17. package/dist/libraries/backend/remix.mjs +5 -5
  18. package/dist/libraries/backend/routes/backendRouter.d.mts +1 -1
  19. package/dist/libraries/backend/routes/backendRouter.d.ts +1 -1
  20. package/dist/libraries/backend/routes/backendRouter.js +4 -4
  21. package/dist/libraries/backend/routes/backendRouter.mjs +5 -5
  22. package/dist/libraries/backend/routes/entityRoutes.js +4 -4
  23. package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
  24. package/dist/libraries/backend/routes/genRoutes.js +4 -4
  25. package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
  26. package/dist/libraries/backend/tanstack.js +4 -4
  27. package/dist/libraries/backend/tanstack.mjs +5 -5
  28. package/dist/libraries/backend/utils/AuthFunction.d.mts +1 -1
  29. package/dist/libraries/backend/utils/AuthFunction.d.ts +1 -1
  30. package/dist/libraries/backend/utils/backendRes.js +1 -2
  31. package/dist/libraries/backend/utils/backendRes.mjs +1 -1
  32. package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
  33. package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
  34. package/dist/libraries/backend/utils/withAuth.js +4 -4
  35. package/dist/libraries/backend/utils/withAuth.mjs +2 -2
  36. package/dist/libraries/react/AutumnContext.d.mts +2 -2
  37. package/dist/libraries/react/AutumnContext.d.ts +2 -2
  38. package/dist/libraries/react/AutumnContext.js +1 -2
  39. package/dist/libraries/react/AutumnContext.mjs +3 -3
  40. package/dist/libraries/react/BaseAutumnProvider.d.mts +2 -2
  41. package/dist/libraries/react/BaseAutumnProvider.d.ts +2 -2
  42. package/dist/libraries/react/BaseAutumnProvider.js +1 -2
  43. package/dist/libraries/react/BaseAutumnProvider.mjs +6 -6
  44. package/dist/libraries/react/{ReactAutumnClient-C5hkD9_F.d.ts → ReactAutumnClient-CXWgmZSf.d.ts} +1 -1
  45. package/dist/libraries/react/{ReactAutumnClient-Cs1RcVVR.d.mts → ReactAutumnClient-b8N5xZyk.d.mts} +1 -1
  46. package/dist/libraries/react/ReactAutumnProvider.js +1 -2
  47. package/dist/libraries/react/ReactAutumnProvider.mjs +7 -7
  48. package/dist/libraries/react/{chunk-K474E7RH.mjs → chunk-2Z7EC4JM.mjs} +1 -1
  49. package/dist/libraries/react/{chunk-GPMSGEWX.mjs → chunk-3PQR35T5.mjs} +1 -2
  50. package/dist/libraries/react/{chunk-ZQ2RGBVJ.mjs → chunk-4G7CGF2R.mjs} +1 -1
  51. package/dist/libraries/react/{chunk-XM7R467K.mjs → chunk-D2YRPPOL.mjs} +2 -2
  52. package/dist/libraries/react/{chunk-ARMMM4EO.mjs → chunk-ELS2JOCO.mjs} +3 -3
  53. package/dist/libraries/react/{chunk-ZOWIALGE.mjs → chunk-NHKT224P.mjs} +1 -1
  54. package/dist/libraries/react/{chunk-2BGH4NXG.mjs → chunk-R3TB4JFJ.mjs} +1 -1
  55. package/dist/libraries/react/{chunk-K6GCHMT7.mjs → chunk-RLTE5H53.mjs} +8 -12
  56. package/dist/libraries/react/{chunk-4WRDLT7W.mjs → chunk-VXGVATJ5.mjs} +1 -1
  57. package/dist/libraries/react/{chunk-PQ443EFR.mjs → chunk-VY7I5OWG.mjs} +1 -1
  58. package/dist/libraries/react/{chunk-QFMVIMZ4.mjs → chunk-YF5TB4XK.mjs} +1 -1
  59. package/dist/libraries/react/client/ReactAutumnClient.d.mts +2 -2
  60. package/dist/libraries/react/client/ReactAutumnClient.d.ts +2 -2
  61. package/dist/libraries/react/client/ReactAutumnClient.js +1 -2
  62. package/dist/libraries/react/client/ReactAutumnClient.mjs +2 -2
  63. package/dist/libraries/react/client/clientCompMethods.d.mts +2 -2
  64. package/dist/libraries/react/client/clientCompMethods.d.ts +2 -2
  65. package/dist/libraries/react/client/clientCusMethods.d.mts +2 -2
  66. package/dist/libraries/react/client/clientCusMethods.d.ts +2 -2
  67. package/dist/libraries/react/client/clientEntityMethods.d.mts +2 -2
  68. package/dist/libraries/react/client/clientEntityMethods.d.ts +2 -2
  69. package/dist/libraries/react/client/clientGenMethods.d.mts +2 -2
  70. package/dist/libraries/react/client/clientGenMethods.d.ts +2 -2
  71. package/dist/libraries/react/client/types/clientEntTypes.d.mts +5 -1
  72. package/dist/libraries/react/client/types/clientEntTypes.d.ts +5 -1
  73. package/dist/libraries/react/client/types/clientGenTypes.d.mts +5 -0
  74. package/dist/libraries/react/client/types/clientGenTypes.d.ts +5 -0
  75. package/dist/libraries/react/hooks/useAutumn.d.mts +2 -1
  76. package/dist/libraries/react/hooks/useAutumn.d.ts +2 -1
  77. package/dist/libraries/react/hooks/useAutumn.js +8 -13
  78. package/dist/libraries/react/hooks/useAutumn.mjs +4 -4
  79. package/dist/libraries/react/hooks/useCustomer.d.mts +12 -12
  80. package/dist/libraries/react/hooks/useCustomer.d.ts +12 -12
  81. package/dist/libraries/react/hooks/useCustomer.js +1 -2
  82. package/dist/libraries/react/hooks/useCustomer.mjs +4 -4
  83. package/dist/libraries/react/hooks/useCustomerProvider.d.mts +2 -2
  84. package/dist/libraries/react/hooks/useCustomerProvider.d.ts +2 -2
  85. package/dist/libraries/react/hooks/useEntity.js +1 -2
  86. package/dist/libraries/react/hooks/useEntity.mjs +4 -4
  87. package/dist/libraries/react/hooks/useEntityProvider.d.mts +2 -2
  88. package/dist/libraries/react/hooks/useEntityProvider.d.ts +2 -2
  89. package/dist/libraries/react/hooks/useEntityProvider.js +1 -2
  90. package/dist/libraries/react/hooks/useEntityProvider.mjs +2 -2
  91. package/dist/libraries/react/hooks/usePricingTable.js +1 -2
  92. package/dist/libraries/react/hooks/usePricingTable.mjs +4 -4
  93. package/dist/libraries/react/hooks/usePricingTableProvider.d.mts +2 -2
  94. package/dist/libraries/react/hooks/usePricingTableProvider.d.ts +2 -2
  95. package/dist/libraries/react/hooks/usePricingTableProvider.js +1 -2
  96. package/dist/libraries/react/hooks/usePricingTableProvider.mjs +2 -2
  97. package/dist/libraries/react/index.d.mts +5 -5
  98. package/dist/libraries/react/index.d.ts +5 -5
  99. package/dist/libraries/react/index.js +8 -13
  100. package/dist/libraries/react/index.mjs +11 -11
  101. package/dist/libraries/react/{response-DSY82HjT.d.mts → response-T-FFa-qt.d.mts} +0 -1
  102. package/dist/libraries/react/{response-DGkb5pA9.d.ts → response-muDt0SJZ.d.ts} +0 -1
  103. package/dist/next/client/clientUtils.d.mts +1 -1
  104. package/dist/next/client/clientUtils.d.ts +1 -1
  105. package/dist/next/client/clientUtils.js +4 -2
  106. package/dist/next/client/clientUtils.mjs +4 -2
  107. package/dist/next/client/hooks/types.d.mts +2 -23
  108. package/dist/next/client/hooks/types.d.ts +2 -23
  109. package/dist/next/client/hooks/useAutumn.d.mts +5 -3
  110. package/dist/next/client/hooks/useAutumn.d.ts +5 -3
  111. package/dist/next/client/hooks/useAutumn.js +24 -9
  112. package/dist/next/client/hooks/useAutumn.mjs +24 -9
  113. package/dist/next/client/hooks/useCustomer.d.mts +1 -1
  114. package/dist/next/client/hooks/useCustomer.d.ts +1 -1
  115. package/dist/next/client/hooks/useCustomer.js +1 -1
  116. package/dist/next/client/hooks/useCustomer.mjs +1 -1
  117. package/dist/next/client/hooks/useEntity.js +1 -1
  118. package/dist/next/client/hooks/useEntity.mjs +1 -1
  119. package/dist/next/client/types-B7efCges.d.mts +29 -0
  120. package/dist/next/client/types-B7efCges.d.ts +29 -0
  121. package/dist/next/index.d.mts +11 -3
  122. package/dist/next/index.d.ts +11 -3
  123. package/dist/next/server/cusActions.d.mts +2 -29
  124. package/dist/next/server/cusActions.d.ts +2 -29
  125. package/dist/next/server/genActions.d.mts +13 -2
  126. package/dist/next/server/genActions.d.ts +13 -2
  127. package/dist/next/server/genActions.js +25 -10
  128. package/dist/next/server/genActions.mjs +25 -10
  129. package/dist/next/server/{genTypes-faVFtUHP.d.ts → genTypes-DNndDcib.d.mts} +36 -3
  130. package/dist/next/server/{genTypes-C1alamyV.d.mts → genTypes-DaYkl9Ex.d.ts} +36 -3
  131. package/dist/sdk/{entTypes-B07YrTT7.d.mts → entTypes-DAoQnp8D.d.mts} +5 -1
  132. package/dist/sdk/{entTypes-DS32o2jz.d.ts → entTypes-oQpX0x_Y.d.ts} +5 -1
  133. package/dist/sdk/entities.d.mts +1 -1
  134. package/dist/sdk/entities.d.ts +1 -1
  135. package/dist/sdk/general.d.mts +11 -8
  136. package/dist/sdk/general.d.ts +11 -8
  137. package/dist/sdk/index.d.mts +2 -2
  138. package/dist/sdk/index.d.ts +2 -2
  139. package/dist/sdk/index.js +1 -2
  140. package/dist/sdk/index.mjs +1 -2
  141. package/dist/utils/encryptUtils.js +1 -2
  142. package/dist/utils/encryptUtils.mjs +1 -2
  143. package/package.json +1 -1
@@ -2,29 +2,29 @@
2
2
 
3
3
  import {
4
4
  useAutumn
5
- } from "./chunk-K6GCHMT7.mjs";
5
+ } from "./chunk-RLTE5H53.mjs";
6
6
  import {
7
7
  useCustomer
8
- } from "./chunk-4WRDLT7W.mjs";
8
+ } from "./chunk-VXGVATJ5.mjs";
9
9
  import {
10
10
  useEntity
11
- } from "./chunk-QFMVIMZ4.mjs";
11
+ } from "./chunk-YF5TB4XK.mjs";
12
12
  import "./chunk-VN4AVW2V.mjs";
13
13
  import {
14
14
  usePricingTable
15
- } from "./chunk-ZQ2RGBVJ.mjs";
15
+ } from "./chunk-4G7CGF2R.mjs";
16
16
  import {
17
17
  ReactAutumnProvider
18
- } from "./chunk-XM7R467K.mjs";
19
- import "./chunk-ARMMM4EO.mjs";
20
- import "./chunk-ZOWIALGE.mjs";
18
+ } from "./chunk-D2YRPPOL.mjs";
19
+ import "./chunk-ELS2JOCO.mjs";
20
+ import "./chunk-NHKT224P.mjs";
21
21
  import "./chunk-PIIGEXKQ.mjs";
22
22
  import "./chunk-4QPHNIQ7.mjs";
23
- import "./chunk-2BGH4NXG.mjs";
24
- import "./chunk-K474E7RH.mjs";
25
- import "./chunk-PQ443EFR.mjs";
23
+ import "./chunk-R3TB4JFJ.mjs";
24
+ import "./chunk-2Z7EC4JM.mjs";
25
+ import "./chunk-VY7I5OWG.mjs";
26
26
  import "./chunk-LS3NB4DU.mjs";
27
- import "./chunk-GPMSGEWX.mjs";
27
+ import "./chunk-3PQR35T5.mjs";
28
28
  import "./chunk-NZ5PEXT2.mjs";
29
29
  import "./chunk-TGX6UKKS.mjs";
30
30
  import "./chunk-4KKWHG2V.mjs";
@@ -93,7 +93,6 @@ interface TrackResult {
93
93
  customer_id: string;
94
94
  feature_id?: string;
95
95
  event_name?: string;
96
- idempotency_key?: string;
97
96
  }
98
97
  interface CheckResult {
99
98
  customer_id: string;
@@ -93,7 +93,6 @@ interface TrackResult {
93
93
  customer_id: string;
94
94
  feature_id?: string;
95
95
  event_name?: string;
96
- idempotency_key?: string;
97
96
  }
98
97
  interface CheckResult {
99
98
  customer_id: string;
@@ -5,7 +5,7 @@ declare const toClientErrorResponse: (error: any) => {
5
5
  data: null;
6
6
  error: AutumnClientError;
7
7
  };
8
- declare const toClientError: (error: any) => AutumnClientError;
8
+ declare const toClientError: (error: any, log?: boolean) => AutumnClientError;
9
9
  declare const fetchPricingTableData: ({ setIsLoading, setError, setProducts, encryptedCustomerId, }: {
10
10
  setIsLoading?: (isLoading: boolean) => void;
11
11
  setError?: (error: any) => void;
@@ -5,7 +5,7 @@ declare const toClientErrorResponse: (error: any) => {
5
5
  data: null;
6
6
  error: AutumnClientError;
7
7
  };
8
- declare const toClientError: (error: any) => AutumnClientError;
8
+ declare const toClientError: (error: any, log?: boolean) => AutumnClientError;
9
9
  declare const fetchPricingTableData: ({ setIsLoading, setError, setProducts, encryptedCustomerId, }: {
10
10
  setIsLoading?: (isLoading: boolean) => void;
11
11
  setError?: (error: any) => void;
@@ -17,7 +17,7 @@ const toClientErrorResponse = (error) => {
17
17
  error: new AutumnClientError({ message: msg, code })
18
18
  };
19
19
  };
20
- const toClientError = (error) => {
20
+ const toClientError = (error, log = true) => {
21
21
  let msg = "Unknown error";
22
22
  let code = "unknown";
23
23
  if (error?.message) {
@@ -26,7 +26,9 @@ const toClientError = (error) => {
26
26
  if (error?.code) {
27
27
  code = error.code;
28
28
  }
29
- console.error("Autumn Error: ", msg);
29
+ if (log) {
30
+ console.error("Autumn Error: ", msg);
31
+ }
30
32
  return new AutumnClientError({ message: msg, code });
31
33
  };
32
34
  const fetchPricingTableData = async ({
@@ -17,7 +17,7 @@ const toClientErrorResponse = (error) => {
17
17
  error: new AutumnClientError({ message: msg, code })
18
18
  };
19
19
  };
20
- const toClientError = (error) => {
20
+ const toClientError = (error, log = true) => {
21
21
  let msg = "Unknown error";
22
22
  let code = "unknown";
23
23
  if (error?.message) {
@@ -26,7 +26,9 @@ const toClientError = (error) => {
26
26
  if (error?.code) {
27
27
  code = error.code;
28
28
  }
29
- console.error("Autumn Error: ", msg);
29
+ if (log) {
30
+ console.error("Autumn Error: ", msg);
31
+ }
30
32
  return new AutumnClientError({ message: msg, code });
31
33
  };
32
34
  const fetchPricingTableData = async ({
@@ -1,23 +1,2 @@
1
- import react__default from 'react';
2
-
3
- interface AttachParams {
4
- productId: string;
5
- entityId?: string;
6
- options?: {
7
- featureId: string;
8
- quantity: number;
9
- }[];
10
- successUrl?: string;
11
- forceCheckout?: boolean;
12
- metadata?: Record<string, string>;
13
- dialog?: () => JSX.Element | react__default.ReactNode;
14
- callback?: () => Promise<void>;
15
- withPreview?: "formatted" | "raw";
16
- }
17
- interface CreateEntityParams {
18
- id: string;
19
- name: string;
20
- featureId: string;
21
- }
22
-
23
- export type { AttachParams, CreateEntityParams };
1
+ import 'react';
2
+ export { A as AttachParams, C as CreateEntityParams } from '../types-B7efCges.mjs';
@@ -1,23 +1,2 @@
1
- import react__default from 'react';
2
-
3
- interface AttachParams {
4
- productId: string;
5
- entityId?: string;
6
- options?: {
7
- featureId: string;
8
- quantity: number;
9
- }[];
10
- successUrl?: string;
11
- forceCheckout?: boolean;
12
- metadata?: Record<string, string>;
13
- dialog?: () => JSX.Element | react__default.ReactNode;
14
- callback?: () => Promise<void>;
15
- withPreview?: "formatted" | "raw";
16
- }
17
- interface CreateEntityParams {
18
- id: string;
19
- name: string;
20
- featureId: string;
21
- }
22
-
23
- export type { AttachParams, CreateEntityParams };
1
+ import 'react';
2
+ export { A as AttachParams, C as CreateEntityParams } from '../types-B7efCges.js';
@@ -1,4 +1,4 @@
1
- import { AttachParams } from './types.mjs';
1
+ import { E as EntityDataParams, A as AttachParams } from '../types-B7efCges.mjs';
2
2
  import 'react';
3
3
 
4
4
  interface TrackParams {
@@ -7,11 +7,12 @@ interface TrackParams {
7
7
  entityId?: string;
8
8
  value?: number;
9
9
  idempotencyKey?: string;
10
+ entityData?: EntityDataParams;
10
11
  }
11
12
 
12
13
  declare const useAutumn: () => {
13
- attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
14
- check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
14
+ attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, entityData, }: AttachParams) => Promise<any>;
15
+ check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, entityData, }: {
15
16
  featureId?: string;
16
17
  productId?: string;
17
18
  entityId?: string;
@@ -19,6 +20,7 @@ declare const useAutumn: () => {
19
20
  sendEvent?: boolean;
20
21
  withPreview?: "formatted" | "raw";
21
22
  dialog?: (data: any) => JSX.Element | React.ReactNode;
23
+ entityData?: EntityDataParams;
22
24
  }) => Promise<any>;
23
25
  track: (params: TrackParams) => Promise<any>;
24
26
  cancel: ({ productId, entityId, }: {
@@ -1,4 +1,4 @@
1
- import { AttachParams } from './types.js';
1
+ import { E as EntityDataParams, A as AttachParams } from '../types-B7efCges.js';
2
2
  import 'react';
3
3
 
4
4
  interface TrackParams {
@@ -7,11 +7,12 @@ interface TrackParams {
7
7
  entityId?: string;
8
8
  value?: number;
9
9
  idempotencyKey?: string;
10
+ entityData?: EntityDataParams;
10
11
  }
11
12
 
12
13
  declare const useAutumn: () => {
13
- attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
14
- check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
14
+ attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, entityData, }: AttachParams) => Promise<any>;
15
+ check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, entityData, }: {
15
16
  featureId?: string;
16
17
  productId?: string;
17
18
  entityId?: string;
@@ -19,6 +20,7 @@ declare const useAutumn: () => {
19
20
  sendEvent?: boolean;
20
21
  withPreview?: "formatted" | "raw";
21
22
  dialog?: (data: any) => JSX.Element | React.ReactNode;
23
+ entityData?: EntityDataParams;
22
24
  }) => Promise<any>;
23
25
  track: (params: TrackParams) => Promise<any>;
24
26
  cancel: ({ productId, entityId, }: {
@@ -33,7 +33,8 @@ const useAutumn = () => {
33
33
  successUrl,
34
34
  forceCheckout,
35
35
  metadata,
36
- callback
36
+ callback,
37
+ entityData
37
38
  }) => {
38
39
  const attachWithoutDialog = async (options) => {
39
40
  try {
@@ -43,7 +44,8 @@ const useAutumn = () => {
43
44
  options,
44
45
  successUrl,
45
46
  forceCheckout,
46
- metadata
47
+ metadata,
48
+ entityData
47
49
  });
48
50
  } catch (error2) {
49
51
  return toClientErrorResponse(error2);
@@ -79,7 +81,8 @@ const useAutumn = () => {
79
81
  forceCheckout,
80
82
  metadata,
81
83
  dialog,
82
- callback
84
+ callback,
85
+ entityData
83
86
  }) => {
84
87
  if (dialog) {
85
88
  setProdChangeComponent(dialog);
@@ -89,7 +92,8 @@ const useAutumn = () => {
89
92
  successUrl,
90
93
  forceCheckout,
91
94
  metadata,
92
- callback
95
+ callback,
96
+ entityData
93
97
  });
94
98
  }
95
99
  let snakeOptions = options?.map((option) => ({
@@ -103,7 +107,8 @@ const useAutumn = () => {
103
107
  options: snakeOptions,
104
108
  successUrl,
105
109
  forceCheckout,
106
- metadata
110
+ metadata,
111
+ entityData
107
112
  });
108
113
  if (result.error) {
109
114
  return toClientErrorResponse(result.error);
@@ -151,7 +156,8 @@ const useAutumn = () => {
151
156
  requiredQuantity,
152
157
  sendEvent,
153
158
  withPreview,
154
- dialog
159
+ dialog,
160
+ entityData
155
161
  }) => {
156
162
  if (dialog) {
157
163
  setPaywallComponent(dialog);
@@ -163,7 +169,8 @@ const useAutumn = () => {
163
169
  entityId,
164
170
  requiredQuantity,
165
171
  sendEvent,
166
- withPreview: dialog ? "formatted" : withPreview
172
+ withPreview: dialog ? "formatted" : withPreview,
173
+ entityData
167
174
  });
168
175
  if (res.error) {
169
176
  return toClientErrorResponse(res.error);
@@ -179,14 +186,22 @@ const useAutumn = () => {
179
186
  return res;
180
187
  };
181
188
  const track = async (params) => {
182
- const { featureId, entityId, value, eventName, idempotencyKey } = params;
189
+ const {
190
+ featureId,
191
+ entityId,
192
+ value,
193
+ eventName,
194
+ idempotencyKey,
195
+ entityData
196
+ } = params;
183
197
  const res = await trackAction({
184
198
  encryptedCustomerId,
185
199
  featureId,
186
200
  entityId,
187
201
  value,
188
202
  eventName,
189
- idempotencyKey
203
+ idempotencyKey,
204
+ entityData
190
205
  });
191
206
  if (res.error) {
192
207
  return toClientErrorResponse(res.error);
@@ -33,7 +33,8 @@ const useAutumn = () => {
33
33
  successUrl,
34
34
  forceCheckout,
35
35
  metadata,
36
- callback
36
+ callback,
37
+ entityData
37
38
  }) => {
38
39
  const attachWithoutDialog = async (options) => {
39
40
  try {
@@ -43,7 +44,8 @@ const useAutumn = () => {
43
44
  options,
44
45
  successUrl,
45
46
  forceCheckout,
46
- metadata
47
+ metadata,
48
+ entityData
47
49
  });
48
50
  } catch (error2) {
49
51
  return toClientErrorResponse(error2);
@@ -79,7 +81,8 @@ const useAutumn = () => {
79
81
  forceCheckout,
80
82
  metadata,
81
83
  dialog,
82
- callback
84
+ callback,
85
+ entityData
83
86
  }) => {
84
87
  if (dialog) {
85
88
  setProdChangeComponent(dialog);
@@ -89,7 +92,8 @@ const useAutumn = () => {
89
92
  successUrl,
90
93
  forceCheckout,
91
94
  metadata,
92
- callback
95
+ callback,
96
+ entityData
93
97
  });
94
98
  }
95
99
  let snakeOptions = options?.map((option) => ({
@@ -103,7 +107,8 @@ const useAutumn = () => {
103
107
  options: snakeOptions,
104
108
  successUrl,
105
109
  forceCheckout,
106
- metadata
110
+ metadata,
111
+ entityData
107
112
  });
108
113
  if (result.error) {
109
114
  return toClientErrorResponse(result.error);
@@ -151,7 +156,8 @@ const useAutumn = () => {
151
156
  requiredQuantity,
152
157
  sendEvent,
153
158
  withPreview,
154
- dialog
159
+ dialog,
160
+ entityData
155
161
  }) => {
156
162
  if (dialog) {
157
163
  setPaywallComponent(dialog);
@@ -163,7 +169,8 @@ const useAutumn = () => {
163
169
  entityId,
164
170
  requiredQuantity,
165
171
  sendEvent,
166
- withPreview: dialog ? "formatted" : withPreview
172
+ withPreview: dialog ? "formatted" : withPreview,
173
+ entityData
167
174
  });
168
175
  if (res.error) {
169
176
  return toClientErrorResponse(res.error);
@@ -179,14 +186,22 @@ const useAutumn = () => {
179
186
  return res;
180
187
  };
181
188
  const track = async (params) => {
182
- const { featureId, entityId, value, eventName, idempotencyKey } = params;
189
+ const {
190
+ featureId,
191
+ entityId,
192
+ value,
193
+ eventName,
194
+ idempotencyKey,
195
+ entityData
196
+ } = params;
183
197
  const res = await trackAction({
184
198
  encryptedCustomerId,
185
199
  featureId,
186
200
  entityId,
187
201
  value,
188
202
  eventName,
189
- idempotencyKey
203
+ idempotencyKey,
204
+ entityData
190
205
  });
191
206
  if (res.error) {
192
207
  return toClientErrorResponse(res.error);
@@ -1,5 +1,5 @@
1
1
  import { a as CustomerExpandOption, C as CustomerData, b as Customer } from '../cusTypes-DsDs_Qyb.mjs';
2
- import { CreateEntityParams } from './types.mjs';
2
+ import { C as CreateEntityParams } from '../types-B7efCges.mjs';
3
3
  import { a as AutumnClientError } from '../types-Cx_JFSer.mjs';
4
4
  import 'react';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { a as CustomerExpandOption, C as CustomerData, b as Customer } from '../cusTypes-DsDs_Qyb.js';
2
- import { CreateEntityParams } from './types.js';
2
+ import { C as CreateEntityParams } from '../types-B7efCges.js';
3
3
  import { a as AutumnClientError } from '../types-B0ocZ_8d.js';
4
4
  import 'react';
5
5
 
@@ -75,7 +75,7 @@ const useCustomer = (options) => {
75
75
  if (error2) {
76
76
  if (error2 && error2?.code == "no_customer_id" && !errorOnNotFound) {
77
77
  } else {
78
- setError(toClientError(error2));
78
+ setError(toClientError(error2, false));
79
79
  }
80
80
  } else {
81
81
  setCustomer(data);
@@ -75,7 +75,7 @@ const useCustomer = (options) => {
75
75
  if (error2) {
76
76
  if (error2 && error2?.code == "no_customer_id" && !errorOnNotFound) {
77
77
  } else {
78
- setError(toClientError(error2));
78
+ setError(toClientError(error2, false));
79
79
  }
80
80
  } else {
81
81
  setCustomer(data);
@@ -32,7 +32,7 @@ const useEntity = (entityId, params) => {
32
32
  data = result.data;
33
33
  error2 = result.error;
34
34
  if (error2) {
35
- setError(toClientError(error2));
35
+ setError(toClientError(error2, false));
36
36
  } else {
37
37
  setEntity(data);
38
38
  setError(null);
@@ -32,7 +32,7 @@ const useEntity = (entityId, params) => {
32
32
  data = result.data;
33
33
  error2 = result.error;
34
34
  if (error2) {
35
- setError(toClientError(error2));
35
+ setError(toClientError(error2, false));
36
36
  } else {
37
37
  setEntity(data);
38
38
  setError(null);
@@ -0,0 +1,29 @@
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 };
@@ -0,0 +1,29 @@
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 };
@@ -3,6 +3,11 @@ import React__default from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { NextRequest, NextResponse } from 'next/server';
5
5
 
6
+ interface EntityDataParams {
7
+ name?: string;
8
+ featureId: string;
9
+ }
10
+
6
11
  interface AttachParams {
7
12
  productId: string;
8
13
  entityId?: string;
@@ -16,6 +21,7 @@ interface AttachParams {
16
21
  dialog?: () => JSX.Element | React__default.ReactNode;
17
22
  callback?: () => Promise<void>;
18
23
  withPreview?: "formatted" | "raw";
24
+ entityData?: EntityDataParams;
19
25
  }
20
26
  interface CreateEntityParams {
21
27
  id: string;
@@ -29,11 +35,12 @@ interface TrackParams {
29
35
  entityId?: string;
30
36
  value?: number;
31
37
  idempotencyKey?: string;
38
+ entityData?: EntityDataParams;
32
39
  }
33
40
 
34
41
  declare const useAutumn: () => {
35
- attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
36
- check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
42
+ attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, entityData, }: AttachParams) => Promise<any>;
43
+ check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, entityData, }: {
37
44
  featureId?: string;
38
45
  productId?: string;
39
46
  entityId?: string;
@@ -41,6 +48,7 @@ declare const useAutumn: () => {
41
48
  sendEvent?: boolean;
42
49
  withPreview?: "formatted" | "raw";
43
50
  dialog?: (data: any) => JSX.Element | React.ReactNode;
51
+ entityData?: EntityDataParams;
44
52
  }) => Promise<any>;
45
53
  track: (params: TrackParams) => Promise<any>;
46
54
  cancel: ({ productId, entityId, }: {
@@ -270,7 +278,7 @@ interface AutumnProviderProps {
270
278
  declare const AutumnProvider: ({ customerId, customerData, authPlugin, children, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
271
279
 
272
280
  type AuthResult = Promise<{
273
- customerId: string;
281
+ customerId?: string;
274
282
  customerData?: {
275
283
  name?: string;
276
284
  email?: string;
@@ -3,6 +3,11 @@ import React__default from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { NextRequest, NextResponse } from 'next/server';
5
5
 
6
+ interface EntityDataParams {
7
+ name?: string;
8
+ featureId: string;
9
+ }
10
+
6
11
  interface AttachParams {
7
12
  productId: string;
8
13
  entityId?: string;
@@ -16,6 +21,7 @@ interface AttachParams {
16
21
  dialog?: () => JSX.Element | React__default.ReactNode;
17
22
  callback?: () => Promise<void>;
18
23
  withPreview?: "formatted" | "raw";
24
+ entityData?: EntityDataParams;
19
25
  }
20
26
  interface CreateEntityParams {
21
27
  id: string;
@@ -29,11 +35,12 @@ interface TrackParams {
29
35
  entityId?: string;
30
36
  value?: number;
31
37
  idempotencyKey?: string;
38
+ entityData?: EntityDataParams;
32
39
  }
33
40
 
34
41
  declare const useAutumn: () => {
35
- attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, }: AttachParams) => Promise<any>;
36
- check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, }: {
42
+ attach: ({ productId, entityId, options, successUrl, forceCheckout, metadata, dialog, callback, entityData, }: AttachParams) => Promise<any>;
43
+ check: ({ featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, dialog, entityData, }: {
37
44
  featureId?: string;
38
45
  productId?: string;
39
46
  entityId?: string;
@@ -41,6 +48,7 @@ declare const useAutumn: () => {
41
48
  sendEvent?: boolean;
42
49
  withPreview?: "formatted" | "raw";
43
50
  dialog?: (data: any) => JSX.Element | React.ReactNode;
51
+ entityData?: EntityDataParams;
44
52
  }) => Promise<any>;
45
53
  track: (params: TrackParams) => Promise<any>;
46
54
  cancel: ({ productId, entityId, }: {
@@ -270,7 +278,7 @@ interface AutumnProviderProps {
270
278
  declare const AutumnProvider: ({ customerId, customerData, authPlugin, children, }: AutumnProviderProps) => react_jsx_runtime.JSX.Element;
271
279
 
272
280
  type AuthResult = Promise<{
273
- customerId: string;
281
+ customerId?: string;
274
282
  customerData?: {
275
283
  name?: string;
276
284
  email?: string;