autumn-js 0.0.24 → 0.0.27

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.
@@ -9,6 +9,7 @@ interface AttachParams {
9
9
  forceCheckout?: boolean;
10
10
  metadata?: Record<string, string>;
11
11
  callback?: () => Promise<void>;
12
+ withPreview?: "formatted" | "raw";
12
13
  }
13
14
 
14
15
  export type { AttachParams };
@@ -9,6 +9,7 @@ interface AttachParams {
9
9
  forceCheckout?: boolean;
10
10
  metadata?: Record<string, string>;
11
11
  callback?: () => Promise<void>;
12
+ withPreview?: "formatted" | "raw";
12
13
  }
13
14
 
14
15
  export type { AttachParams };
@@ -4,15 +4,18 @@ import { AttachParams } from './types.mjs';
4
4
 
5
5
  declare const useAutumn: () => {
6
6
  attach: ({ dialog, productId, options, successUrl, forceCheckout, metadata, callback, }: AttachParams) => Promise<any>;
7
- check: ({ dialog, featureId, productId, requiredQuantity, sendEvent, }: {
7
+ check: ({ dialog, featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, }: {
8
8
  dialog?: boolean;
9
9
  featureId?: string;
10
10
  productId?: string;
11
+ entityId?: string;
11
12
  requiredQuantity?: number;
12
13
  sendEvent?: boolean;
14
+ withPreview?: "formatted" | "raw";
13
15
  }) => Promise<any>;
14
- track: ({ featureId, value, }: {
16
+ track: ({ featureId, entityId, value, }: {
15
17
  featureId: string;
18
+ entityId?: string;
16
19
  value?: number;
17
20
  }) => Promise<any>;
18
21
  openBillingPortal: (options?: {
@@ -4,15 +4,18 @@ import { AttachParams } from './types.js';
4
4
 
5
5
  declare const useAutumn: () => {
6
6
  attach: ({ dialog, productId, options, successUrl, forceCheckout, metadata, callback, }: AttachParams) => Promise<any>;
7
- check: ({ dialog, featureId, productId, requiredQuantity, sendEvent, }: {
7
+ check: ({ dialog, featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, }: {
8
8
  dialog?: boolean;
9
9
  featureId?: string;
10
10
  productId?: string;
11
+ entityId?: string;
11
12
  requiredQuantity?: number;
12
13
  sendEvent?: boolean;
14
+ withPreview?: "formatted" | "raw";
13
15
  }) => Promise<any>;
14
- track: ({ featureId, value, }: {
16
+ track: ({ featureId, entityId, value, }: {
15
17
  featureId: string;
18
+ entityId?: string;
16
19
  value?: number;
17
20
  }) => Promise<any>;
18
21
  openBillingPortal: (options?: {
@@ -148,22 +148,25 @@ const useAutumn = () => {
148
148
  dialog = paywallFound || false,
149
149
  featureId,
150
150
  productId,
151
+ entityId,
151
152
  requiredQuantity,
152
- sendEvent
153
+ sendEvent,
154
+ withPreview
153
155
  }) => {
154
156
  const res = await checkAction({
155
157
  encryptedCustomerId,
156
158
  featureId,
157
159
  productId,
160
+ entityId,
158
161
  requiredQuantity,
159
162
  sendEvent,
160
- withPreview: dialog ? "formatted" : void 0
163
+ withPreview: dialog ? "formatted" : withPreview
161
164
  });
162
165
  if (res.error) {
163
166
  return toClientErrorResponse(res.error);
164
167
  }
165
168
  let data = res.data;
166
- if (data && data.preview) {
169
+ if (data && data.preview && dialog) {
167
170
  let nextActionData = {};
168
171
  let preview = data.preview;
169
172
  if (preview.upgrade_product_id) {
@@ -200,11 +203,13 @@ const useAutumn = () => {
200
203
  };
201
204
  const track = async ({
202
205
  featureId,
206
+ entityId,
203
207
  value
204
208
  }) => {
205
209
  const res = await trackAction({
206
210
  encryptedCustomerId,
207
211
  featureId,
212
+ entityId,
208
213
  value
209
214
  });
210
215
  if (res.error) {
@@ -148,22 +148,25 @@ const useAutumn = () => {
148
148
  dialog = paywallFound || false,
149
149
  featureId,
150
150
  productId,
151
+ entityId,
151
152
  requiredQuantity,
152
- sendEvent
153
+ sendEvent,
154
+ withPreview
153
155
  }) => {
154
156
  const res = await checkAction({
155
157
  encryptedCustomerId,
156
158
  featureId,
157
159
  productId,
160
+ entityId,
158
161
  requiredQuantity,
159
162
  sendEvent,
160
- withPreview: dialog ? "formatted" : void 0
163
+ withPreview: dialog ? "formatted" : withPreview
161
164
  });
162
165
  if (res.error) {
163
166
  return toClientErrorResponse(res.error);
164
167
  }
165
168
  let data = res.data;
166
- if (data && data.preview) {
169
+ if (data && data.preview && dialog) {
167
170
  let nextActionData = {};
168
171
  let preview = data.preview;
169
172
  if (preview.upgrade_product_id) {
@@ -200,11 +203,13 @@ const useAutumn = () => {
200
203
  };
201
204
  const track = async ({
202
205
  featureId,
206
+ entityId,
203
207
  value
204
208
  }) => {
205
209
  const res = await trackAction({
206
210
  encryptedCustomerId,
207
211
  featureId,
212
+ entityId,
208
213
  value
209
214
  });
210
215
  if (res.error) {
@@ -96,19 +96,23 @@ interface AttachParams {
96
96
  forceCheckout?: boolean;
97
97
  metadata?: Record<string, string>;
98
98
  callback?: () => Promise<void>;
99
+ withPreview?: "formatted" | "raw";
99
100
  }
100
101
 
101
102
  declare const useAutumn: () => {
102
103
  attach: ({ dialog, productId, options, successUrl, forceCheckout, metadata, callback, }: AttachParams) => Promise<any>;
103
- check: ({ dialog, featureId, productId, requiredQuantity, sendEvent, }: {
104
+ check: ({ dialog, featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, }: {
104
105
  dialog?: boolean;
105
106
  featureId?: string;
106
107
  productId?: string;
108
+ entityId?: string;
107
109
  requiredQuantity?: number;
108
110
  sendEvent?: boolean;
111
+ withPreview?: "formatted" | "raw";
109
112
  }) => Promise<any>;
110
- track: ({ featureId, value, }: {
113
+ track: ({ featureId, entityId, value, }: {
111
114
  featureId: string;
115
+ entityId?: string;
112
116
  value?: number;
113
117
  }) => Promise<any>;
114
118
  openBillingPortal: (options?: {
@@ -96,19 +96,23 @@ interface AttachParams {
96
96
  forceCheckout?: boolean;
97
97
  metadata?: Record<string, string>;
98
98
  callback?: () => Promise<void>;
99
+ withPreview?: "formatted" | "raw";
99
100
  }
100
101
 
101
102
  declare const useAutumn: () => {
102
103
  attach: ({ dialog, productId, options, successUrl, forceCheckout, metadata, callback, }: AttachParams) => Promise<any>;
103
- check: ({ dialog, featureId, productId, requiredQuantity, sendEvent, }: {
104
+ check: ({ dialog, featureId, productId, entityId, requiredQuantity, sendEvent, withPreview, }: {
104
105
  dialog?: boolean;
105
106
  featureId?: string;
106
107
  productId?: string;
108
+ entityId?: string;
107
109
  requiredQuantity?: number;
108
110
  sendEvent?: boolean;
111
+ withPreview?: "formatted" | "raw";
109
112
  }) => Promise<any>;
110
- track: ({ featureId, value, }: {
113
+ track: ({ featureId, entityId, value, }: {
111
114
  featureId: string;
115
+ entityId?: string;
112
116
  value?: number;
113
117
  }) => Promise<any>;
114
118
  openBillingPortal: (options?: {
@@ -1,7 +1,19 @@
1
- import { A as AttachParams, a as AttachResult, U as UsageParams, b as UsageResult, C as CheckParams, c as CheckResult, T as TrackParams, d as TrackResult } from './genTypes-CmWo5C2C.mjs';
1
+ import { A as AttachParams, a as AttachResult, U as UsageParams, b as UsageResult, C as CheckParams, c as CheckResult, T as TrackParams, d as TrackResult } from './genTypes-B2H19mD-.mjs';
2
2
  import { A as AutumnError, R as Result } from './response-CmSY57k6.mjs';
3
3
  import { a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, A as AppEnv, I as Infinite, P as ProductItemIntervalType, d as UsageModel, F as FreeTrialDuration, C as CustomerData } from './cusTypes-DtlCmw72.mjs';
4
4
 
5
+ interface CreateEntityParams {
6
+ id: string;
7
+ name: string;
8
+ feature_id: string;
9
+ }
10
+ interface CreateEntityResult {
11
+ success: boolean;
12
+ }
13
+ interface DeleteEntityResult {
14
+ success: boolean;
15
+ }
16
+
5
17
  declare class Autumn {
6
18
  private readonly secretKey;
7
19
  private readonly publishableKey;
@@ -48,6 +60,10 @@ declare class Autumn {
48
60
  create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
49
61
  list: (params?: ListProductsParams) => Promise<Result<Product[], AutumnError>>;
50
62
  };
63
+ static entities: {
64
+ create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
65
+ delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
66
+ };
51
67
  customers: {
52
68
  get: (id: string) => Promise<Result<Customer, AutumnError>>;
53
69
  create: (params?: CreateCustomerParams) => Promise<Result<Customer, AutumnError>>;
@@ -60,6 +76,10 @@ declare class Autumn {
60
76
  create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
61
77
  list: (params?: ListProductsParams) => Promise<Result<Product[], AutumnError>>;
62
78
  };
79
+ entities: {
80
+ create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
81
+ delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
82
+ };
63
83
  static attach: (params: AttachParams) => Promise<Result<AttachResult, AutumnError>>;
64
84
  static usage: (params: UsageParams) => Promise<Result<UsageResult, AutumnError>>;
65
85
  attach(params: AttachParams): Promise<Result<AttachResult, AutumnError>>;
@@ -1,7 +1,19 @@
1
- import { A as AttachParams, a as AttachResult, U as UsageParams, b as UsageResult, C as CheckParams, c as CheckResult, T as TrackParams, d as TrackResult } from './genTypes-B8lkg6J-.js';
1
+ import { A as AttachParams, a as AttachResult, U as UsageParams, b as UsageResult, C as CheckParams, c as CheckResult, T as TrackParams, d as TrackResult } from './genTypes-CKd6Oq3O.js';
2
2
  import { A as AutumnError, R as Result } from './response-CmSY57k6.js';
3
3
  import { a as Customer, b as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, c as BillingPortalResponse, A as AppEnv, I as Infinite, P as ProductItemIntervalType, d as UsageModel, F as FreeTrialDuration, C as CustomerData } from './cusTypes-DtlCmw72.js';
4
4
 
5
+ interface CreateEntityParams {
6
+ id: string;
7
+ name: string;
8
+ feature_id: string;
9
+ }
10
+ interface CreateEntityResult {
11
+ success: boolean;
12
+ }
13
+ interface DeleteEntityResult {
14
+ success: boolean;
15
+ }
16
+
5
17
  declare class Autumn {
6
18
  private readonly secretKey;
7
19
  private readonly publishableKey;
@@ -48,6 +60,10 @@ declare class Autumn {
48
60
  create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
49
61
  list: (params?: ListProductsParams) => Promise<Result<Product[], AutumnError>>;
50
62
  };
63
+ static entities: {
64
+ create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
65
+ delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
66
+ };
51
67
  customers: {
52
68
  get: (id: string) => Promise<Result<Customer, AutumnError>>;
53
69
  create: (params?: CreateCustomerParams) => Promise<Result<Customer, AutumnError>>;
@@ -60,6 +76,10 @@ declare class Autumn {
60
76
  create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
61
77
  list: (params?: ListProductsParams) => Promise<Result<Product[], AutumnError>>;
62
78
  };
79
+ entities: {
80
+ create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
81
+ delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
82
+ };
63
83
  static attach: (params: AttachParams) => Promise<Result<AttachResult, AutumnError>>;
64
84
  static usage: (params: UsageParams) => Promise<Result<UsageResult, AutumnError>>;
65
85
  attach(params: AttachParams): Promise<Result<AttachResult, AutumnError>>;
@@ -1,4 +1,4 @@
1
- import { e as AttachFeatureOptions } from './genTypes-CmWo5C2C.mjs';
1
+ import { e as AttachFeatureOptions } from './genTypes-B2H19mD-.mjs';
2
2
  import { B as BillingPortalParams } from './cusTypes-DtlCmw72.mjs';
3
3
 
4
4
  declare const attachAction: (args: Omit<{
@@ -21,6 +21,7 @@ declare const checkAction: (args: Omit<{
21
21
  customerId: string;
22
22
  featureId?: string;
23
23
  productId?: string;
24
+ entityId?: string;
24
25
  requiredQuantity?: number;
25
26
  sendEvent?: boolean;
26
27
  withPreview?: "raw" | "formatted";
@@ -37,6 +38,7 @@ declare const sendEventAction: (args: Omit<{
37
38
  declare const trackAction: (args: Omit<{
38
39
  customerId: string;
39
40
  featureId: string;
41
+ entityId?: string;
40
42
  value?: number;
41
43
  }, "customerId"> & {
42
44
  encryptedCustomerId?: string;
@@ -1,4 +1,4 @@
1
- import { e as AttachFeatureOptions } from './genTypes-B8lkg6J-.js';
1
+ import { e as AttachFeatureOptions } from './genTypes-CKd6Oq3O.js';
2
2
  import { B as BillingPortalParams } from './cusTypes-DtlCmw72.js';
3
3
 
4
4
  declare const attachAction: (args: Omit<{
@@ -21,6 +21,7 @@ declare const checkAction: (args: Omit<{
21
21
  customerId: string;
22
22
  featureId?: string;
23
23
  productId?: string;
24
+ entityId?: string;
24
25
  requiredQuantity?: number;
25
26
  sendEvent?: boolean;
26
27
  withPreview?: "raw" | "formatted";
@@ -37,6 +38,7 @@ declare const sendEventAction: (args: Omit<{
37
38
  declare const trackAction: (args: Omit<{
38
39
  customerId: string;
39
40
  featureId: string;
41
+ entityId?: string;
40
42
  value?: number;
41
43
  }, "customerId"> & {
42
44
  encryptedCustomerId?: string;
@@ -41,6 +41,7 @@ const checkAction = withAuth({
41
41
  customerId,
42
42
  featureId,
43
43
  productId,
44
+ entityId,
44
45
  requiredQuantity,
45
46
  sendEvent,
46
47
  withPreview
@@ -50,6 +51,7 @@ const checkAction = withAuth({
50
51
  customer_id: customerId,
51
52
  feature_id: featureId,
52
53
  product_id: productId,
54
+ entity_id: entityId,
53
55
  required_quantity: requiredQuantity,
54
56
  send_event: sendEvent,
55
57
  with_preview: withPreview
@@ -76,12 +78,14 @@ const trackAction = withAuth({
76
78
  fn: async ({
77
79
  customerId,
78
80
  featureId,
81
+ entityId,
79
82
  value
80
83
  }) => {
81
84
  const autumn = createAutumnClient();
82
85
  let res = await autumn.track({
83
86
  customer_id: customerId,
84
87
  feature_id: featureId,
88
+ entity_id: entityId,
85
89
  value
86
90
  });
87
91
  return toServerResponse(res);
@@ -41,6 +41,7 @@ const checkAction = withAuth({
41
41
  customerId,
42
42
  featureId,
43
43
  productId,
44
+ entityId,
44
45
  requiredQuantity,
45
46
  sendEvent,
46
47
  withPreview
@@ -50,6 +51,7 @@ const checkAction = withAuth({
50
51
  customer_id: customerId,
51
52
  feature_id: featureId,
52
53
  product_id: productId,
54
+ entity_id: entityId,
53
55
  required_quantity: requiredQuantity,
54
56
  send_event: sendEvent,
55
57
  with_preview: withPreview
@@ -76,12 +78,14 @@ const trackAction = withAuth({
76
78
  fn: async ({
77
79
  customerId,
78
80
  featureId,
81
+ entityId,
79
82
  value
80
83
  }) => {
81
84
  const autumn = createAutumnClient();
82
85
  let res = await autumn.track({
83
86
  customer_id: customerId,
84
87
  feature_id: featureId,
88
+ entity_id: entityId,
85
89
  value
86
90
  });
87
91
  return toServerResponse(res);
@@ -27,6 +27,7 @@ interface TrackParams {
27
27
  value?: number;
28
28
  feature_id?: string;
29
29
  event_name?: string;
30
+ entity_id?: string;
30
31
  }
31
32
  interface TrackResult {
32
33
  id: string;
@@ -39,6 +40,7 @@ interface CheckParams {
39
40
  customer_id: string;
40
41
  feature_id?: string;
41
42
  product_id?: string;
43
+ entity_id?: string;
42
44
  customer_data?: CustomerData;
43
45
  required_quantity?: number;
44
46
  send_event?: boolean;
@@ -27,6 +27,7 @@ interface TrackParams {
27
27
  value?: number;
28
28
  feature_id?: string;
29
29
  event_name?: string;
30
+ entity_id?: string;
30
31
  }
31
32
  interface TrackResult {
32
33
  id: string;
@@ -39,6 +40,7 @@ interface CheckParams {
39
40
  customer_id: string;
40
41
  feature_id?: string;
41
42
  product_id?: string;
43
+ entity_id?: string;
42
44
  customer_data?: CustomerData;
43
45
  required_quantity?: number;
44
46
  send_event?: boolean;
@@ -0,0 +1,13 @@
1
+ interface CreateEntityParams {
2
+ id: string;
3
+ name: string;
4
+ feature_id: string;
5
+ }
6
+ interface CreateEntityResult {
7
+ success: boolean;
8
+ }
9
+ interface DeleteEntityResult {
10
+ success: boolean;
11
+ }
12
+
13
+ export type { CreateEntityParams, CreateEntityResult, DeleteEntityResult };
@@ -0,0 +1,13 @@
1
+ interface CreateEntityParams {
2
+ id: string;
3
+ name: string;
4
+ feature_id: string;
5
+ }
6
+ interface CreateEntityResult {
7
+ success: boolean;
8
+ }
9
+ interface DeleteEntityResult {
10
+ success: boolean;
11
+ }
12
+
13
+ export type { CreateEntityParams, CreateEntityResult, DeleteEntityResult };
@@ -28,6 +28,7 @@ interface TrackParams {
28
28
  value?: number;
29
29
  feature_id?: string;
30
30
  event_name?: string;
31
+ entity_id?: string;
31
32
  }
32
33
  interface TrackResult {
33
34
  id: string;
@@ -40,6 +41,7 @@ interface CheckParams {
40
41
  customer_id: string;
41
42
  feature_id?: string;
42
43
  product_id?: string;
44
+ entity_id?: string;
43
45
  customer_data?: CustomerData;
44
46
  required_quantity?: number;
45
47
  send_event?: boolean;
@@ -28,6 +28,7 @@ interface TrackParams {
28
28
  value?: number;
29
29
  feature_id?: string;
30
30
  event_name?: string;
31
+ entity_id?: string;
31
32
  }
32
33
  interface TrackResult {
33
34
  id: string;
@@ -40,6 +41,7 @@ interface CheckParams {
40
41
  customer_id: string;
41
42
  feature_id?: string;
42
43
  product_id?: string;
44
+ entity_id?: string;
43
45
  customer_data?: CustomerData;
44
46
  required_quantity?: number;
45
47
  send_event?: boolean;
@@ -1,4 +1,5 @@
1
1
  import { AttachParams, AttachResult, UsageParams, UsageResult, CheckParams, CheckResult, TrackParams, TrackResult } from './general.mjs';
2
+ import { CreateEntityParams, CreateEntityResult, DeleteEntityResult } from './entities.mjs';
2
3
  import { C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-BIzuiqvx.mjs';
3
4
  export { e as CustomerData, c as CustomerFeature, d as CustomerProduct, P as ProductStatus } from './cusTypes-BIzuiqvx.mjs';
4
5
  import { Product, CreateProductParams, ListProductsParams } from './products.mjs';
@@ -77,6 +78,10 @@ declare class Autumn {
77
78
  create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
78
79
  list: (params?: ListProductsParams) => Promise<Result<Product[], AutumnError>>;
79
80
  };
81
+ static entities: {
82
+ create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
83
+ delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
84
+ };
80
85
  customers: {
81
86
  get: (id: string) => Promise<Result<Customer, AutumnError>>;
82
87
  create: (params?: CreateCustomerParams) => Promise<Result<Customer, AutumnError>>;
@@ -89,6 +94,10 @@ declare class Autumn {
89
94
  create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
90
95
  list: (params?: ListProductsParams) => Promise<Result<Product[], AutumnError>>;
91
96
  };
97
+ entities: {
98
+ create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
99
+ delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
100
+ };
92
101
  static attach: (params: AttachParams) => Promise<Result<AttachResult, AutumnError>>;
93
102
  static usage: (params: UsageParams) => Promise<Result<UsageResult, AutumnError>>;
94
103
  attach(params: AttachParams): Promise<Result<AttachResult, AutumnError>>;
@@ -1,4 +1,5 @@
1
1
  import { AttachParams, AttachResult, UsageParams, UsageResult, CheckParams, CheckResult, TrackParams, TrackResult } from './general.js';
2
+ import { CreateEntityParams, CreateEntityResult, DeleteEntityResult } from './entities.js';
2
3
  import { C as Customer, a as CreateCustomerParams, U as UpdateCustomerParams, B as BillingPortalParams, b as BillingPortalResponse } from './cusTypes-HqJzG9Vv.js';
3
4
  export { e as CustomerData, c as CustomerFeature, d as CustomerProduct, P as ProductStatus } from './cusTypes-HqJzG9Vv.js';
4
5
  import { Product, CreateProductParams, ListProductsParams } from './products.js';
@@ -77,6 +78,10 @@ declare class Autumn {
77
78
  create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
78
79
  list: (params?: ListProductsParams) => Promise<Result<Product[], AutumnError>>;
79
80
  };
81
+ static entities: {
82
+ create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
83
+ delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
84
+ };
80
85
  customers: {
81
86
  get: (id: string) => Promise<Result<Customer, AutumnError>>;
82
87
  create: (params?: CreateCustomerParams) => Promise<Result<Customer, AutumnError>>;
@@ -89,6 +94,10 @@ declare class Autumn {
89
94
  create: (params?: CreateProductParams) => Promise<Result<Product, AutumnError>>;
90
95
  list: (params?: ListProductsParams) => Promise<Result<Product[], AutumnError>>;
91
96
  };
97
+ entities: {
98
+ create: (customer_id: string, params?: CreateEntityParams | CreateEntityParams[]) => Promise<Result<CreateEntityResult, AutumnError>>;
99
+ delete: (customer_id: string, entity_id: string) => Promise<Result<DeleteEntityResult, AutumnError>>;
100
+ };
92
101
  static attach: (params: AttachParams) => Promise<Result<AttachResult, AutumnError>>;
93
102
  static usage: (params: UsageParams) => Promise<Result<UsageResult, AutumnError>>;
94
103
  attach(params: AttachParams): Promise<Result<AttachResult, AutumnError>>;
package/dist/sdk/index.js CHANGED
@@ -95,6 +95,28 @@ var billingPortal = async ({
95
95
  return instance.post(`/customers/${id}/billing_portal`, params);
96
96
  };
97
97
 
98
+ // src/sdk/customers/entities/entMethods.ts
99
+ var entityMethods = (instance) => {
100
+ return {
101
+ create: (customer_id, params) => staticWrapper(createEntity, instance, { customer_id, params }),
102
+ delete: (customer_id, entity_id) => staticWrapper(deleteEntity, instance, { customer_id, entity_id })
103
+ };
104
+ };
105
+ var createEntity = async ({
106
+ instance,
107
+ customer_id,
108
+ params
109
+ }) => {
110
+ return instance.post(`/customers/${customer_id}/entities`, params);
111
+ };
112
+ var deleteEntity = async ({
113
+ instance,
114
+ customer_id,
115
+ entity_id
116
+ }) => {
117
+ return instance.delete(`/customers/${customer_id}/entities/${entity_id}`);
118
+ };
119
+
98
120
  // src/sdk/general/genMethods.ts
99
121
  var handleAttach = async ({
100
122
  instance,
@@ -183,6 +205,7 @@ var Autumn = class {
183
205
  __publicField(this, "url");
184
206
  __publicField(this, "customers", customerMethods(this));
185
207
  __publicField(this, "products", productMethods(this));
208
+ __publicField(this, "entities", entityMethods(this));
186
209
  try {
187
210
  this.secretKey = options.secretKey || process.env.AUTUMN_SECRET_KEY;
188
211
  this.publishableKey = options.publishableKey || process.env.AUTUMN_PUBLISHABLE_KEY;
@@ -306,6 +329,7 @@ var Autumn = class {
306
329
  };
307
330
  __publicField(Autumn, "customers", customerMethods());
308
331
  __publicField(Autumn, "products", productMethods());
332
+ __publicField(Autumn, "entities", entityMethods());
309
333
  __publicField(Autumn, "attach", (params) => staticWrapper(handleAttach, void 0, { params }));
310
334
  __publicField(Autumn, "usage", (params) => staticWrapper(handleUsage, void 0, { params }));
311
335
  /**
@@ -93,6 +93,28 @@ var billingPortal = async ({
93
93
  return instance.post(`/customers/${id}/billing_portal`, params);
94
94
  };
95
95
 
96
+ // src/sdk/customers/entities/entMethods.ts
97
+ var entityMethods = (instance) => {
98
+ return {
99
+ create: (customer_id, params) => staticWrapper(createEntity, instance, { customer_id, params }),
100
+ delete: (customer_id, entity_id) => staticWrapper(deleteEntity, instance, { customer_id, entity_id })
101
+ };
102
+ };
103
+ var createEntity = async ({
104
+ instance,
105
+ customer_id,
106
+ params
107
+ }) => {
108
+ return instance.post(`/customers/${customer_id}/entities`, params);
109
+ };
110
+ var deleteEntity = async ({
111
+ instance,
112
+ customer_id,
113
+ entity_id
114
+ }) => {
115
+ return instance.delete(`/customers/${customer_id}/entities/${entity_id}`);
116
+ };
117
+
96
118
  // src/sdk/general/genMethods.ts
97
119
  var handleAttach = async ({
98
120
  instance,
@@ -181,6 +203,7 @@ var Autumn = class {
181
203
  __publicField(this, "url");
182
204
  __publicField(this, "customers", customerMethods(this));
183
205
  __publicField(this, "products", productMethods(this));
206
+ __publicField(this, "entities", entityMethods(this));
184
207
  try {
185
208
  this.secretKey = options.secretKey || process.env.AUTUMN_SECRET_KEY;
186
209
  this.publishableKey = options.publishableKey || process.env.AUTUMN_PUBLISHABLE_KEY;
@@ -304,6 +327,7 @@ var Autumn = class {
304
327
  };
305
328
  __publicField(Autumn, "customers", customerMethods());
306
329
  __publicField(Autumn, "products", productMethods());
330
+ __publicField(Autumn, "entities", entityMethods());
307
331
  __publicField(Autumn, "attach", (params) => staticWrapper(handleAttach, void 0, { params }));
308
332
  __publicField(Autumn, "usage", (params) => staticWrapper(handleUsage, void 0, { params }));
309
333
  /**
@@ -127,6 +127,28 @@ var billingPortal = async ({
127
127
  return instance.post(`/customers/${id}/billing_portal`, params);
128
128
  };
129
129
 
130
+ // src/sdk/customers/entities/entMethods.ts
131
+ var entityMethods = (instance) => {
132
+ return {
133
+ create: (customer_id, params) => staticWrapper(createEntity, instance, { customer_id, params }),
134
+ delete: (customer_id, entity_id) => staticWrapper(deleteEntity, instance, { customer_id, entity_id })
135
+ };
136
+ };
137
+ var createEntity = async ({
138
+ instance,
139
+ customer_id,
140
+ params
141
+ }) => {
142
+ return instance.post(`/customers/${customer_id}/entities`, params);
143
+ };
144
+ var deleteEntity = async ({
145
+ instance,
146
+ customer_id,
147
+ entity_id
148
+ }) => {
149
+ return instance.delete(`/customers/${customer_id}/entities/${entity_id}`);
150
+ };
151
+
130
152
  // src/sdk/general/genMethods.ts
131
153
  var handleAttach = async ({
132
154
  instance,
@@ -291,8 +313,10 @@ var Autumn = class {
291
313
  }
292
314
  static customers = customerMethods();
293
315
  static products = productMethods();
316
+ static entities = entityMethods();
294
317
  customers = customerMethods(this);
295
318
  products = productMethods(this);
319
+ entities = entityMethods(this);
296
320
  static attach = (params) => staticWrapper(handleAttach, void 0, { params });
297
321
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
298
322
  async attach(params) {
@@ -92,6 +92,28 @@ var billingPortal = async ({
92
92
  return instance.post(`/customers/${id}/billing_portal`, params);
93
93
  };
94
94
 
95
+ // src/sdk/customers/entities/entMethods.ts
96
+ var entityMethods = (instance) => {
97
+ return {
98
+ create: (customer_id, params) => staticWrapper(createEntity, instance, { customer_id, params }),
99
+ delete: (customer_id, entity_id) => staticWrapper(deleteEntity, instance, { customer_id, entity_id })
100
+ };
101
+ };
102
+ var createEntity = async ({
103
+ instance,
104
+ customer_id,
105
+ params
106
+ }) => {
107
+ return instance.post(`/customers/${customer_id}/entities`, params);
108
+ };
109
+ var deleteEntity = async ({
110
+ instance,
111
+ customer_id,
112
+ entity_id
113
+ }) => {
114
+ return instance.delete(`/customers/${customer_id}/entities/${entity_id}`);
115
+ };
116
+
95
117
  // src/sdk/general/genMethods.ts
96
118
  var handleAttach = async ({
97
119
  instance,
@@ -256,8 +278,10 @@ var Autumn = class {
256
278
  }
257
279
  static customers = customerMethods();
258
280
  static products = productMethods();
281
+ static entities = entityMethods();
259
282
  customers = customerMethods(this);
260
283
  products = productMethods(this);
284
+ entities = entityMethods(this);
261
285
  static attach = (params) => staticWrapper(handleAttach, void 0, { params });
262
286
  static usage = (params) => staticWrapper(handleUsage, void 0, { params });
263
287
  async attach(params) {
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.24",
4
+ "version": "0.0.27",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
package/tsup.config.ts CHANGED
@@ -17,6 +17,7 @@ export default defineConfig([
17
17
  entry: {
18
18
  general: "src/sdk/general/genTypes.ts",
19
19
  customers: "src/sdk/customers/cusTypes.ts",
20
+ entities: "src/sdk/customers/entities/entTypes.ts",
20
21
  products: "src/sdk/products/prodTypes.ts",
21
22
  index: "src/sdk/index.ts", // Main types will go to index.d.ts
22
23
  },
@@ -1,2 +0,0 @@
1
-
2
- export { }
@@ -1,2 +0,0 @@
1
-
2
- export { }
@@ -1,2 +0,0 @@
1
- "use client";
2
-
@@ -1,2 +0,0 @@
1
- "use client";
2
-