autumn-js 0.0.1

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 (52) hide show
  1. package/README.md +0 -0
  2. package/dist/react/client/AutumnContext.d.mts +9 -0
  3. package/dist/react/client/AutumnContext.d.ts +9 -0
  4. package/dist/react/client/AutumnContext.js +18 -0
  5. package/dist/react/client/AutumnContext.mjs +18 -0
  6. package/dist/react/client/AutumnProvider.d.mts +12 -0
  7. package/dist/react/client/AutumnProvider.d.ts +12 -0
  8. package/dist/react/client/AutumnProvider.js +22 -0
  9. package/dist/react/client/AutumnProvider.mjs +22 -0
  10. package/dist/react/client/cusTypes-BT7wlTNj.d.mts +67 -0
  11. package/dist/react/client/cusTypes-BT7wlTNj.d.ts +67 -0
  12. package/dist/react/client/error-TNbN4XE4.d.mts +6 -0
  13. package/dist/react/client/error-TNbN4XE4.d.ts +6 -0
  14. package/dist/react/client/hooks/useAutumn.d.mts +65 -0
  15. package/dist/react/client/hooks/useAutumn.d.ts +65 -0
  16. package/dist/react/client/hooks/useAutumn.js +74 -0
  17. package/dist/react/client/hooks/useAutumn.mjs +74 -0
  18. package/dist/react/client/hooks/useCustomer.d.mts +14 -0
  19. package/dist/react/client/hooks/useCustomer.d.ts +14 -0
  20. package/dist/react/client/hooks/useCustomer.js +44 -0
  21. package/dist/react/client/hooks/useCustomer.mjs +44 -0
  22. package/dist/react/index.d.mts +157 -0
  23. package/dist/react/index.d.ts +157 -0
  24. package/dist/react/index.js +28 -0
  25. package/dist/react/index.mjs +4 -0
  26. package/dist/react/server/cusActions.d.mts +140 -0
  27. package/dist/react/server/cusActions.d.ts +140 -0
  28. package/dist/react/server/cusActions.js +26 -0
  29. package/dist/react/server/cusActions.mjs +26 -0
  30. package/dist/react/server/genActions.d.mts +42 -0
  31. package/dist/react/server/genActions.d.ts +42 -0
  32. package/dist/react/server/genActions.js +41 -0
  33. package/dist/react/server/genActions.mjs +41 -0
  34. package/dist/react/server/genTypes-RkqyS6Mn.d.mts +152 -0
  35. package/dist/react/server/genTypes-RkqyS6Mn.d.ts +152 -0
  36. package/dist/sdk/cusTypes-B9fUPd5R.d.ts +68 -0
  37. package/dist/sdk/cusTypes-DEdFHlrl.d.mts +68 -0
  38. package/dist/sdk/customers.d.mts +2 -0
  39. package/dist/sdk/customers.d.ts +2 -0
  40. package/dist/sdk/general.d.mts +60 -0
  41. package/dist/sdk/general.d.ts +60 -0
  42. package/dist/sdk/index.d.mts +97 -0
  43. package/dist/sdk/index.d.ts +97 -0
  44. package/dist/sdk/index.js +245 -0
  45. package/dist/sdk/index.mjs +237 -0
  46. package/dist/sdk/prodEnums-BnhKkH4e.d.mts +26 -0
  47. package/dist/sdk/prodEnums-BnhKkH4e.d.ts +26 -0
  48. package/dist/sdk/products.d.mts +45 -0
  49. package/dist/sdk/products.d.ts +45 -0
  50. package/package.json +46 -0
  51. package/tsconfig.json +25 -0
  52. package/tsup.config.ts +78 -0
@@ -0,0 +1,42 @@
1
+ import { A as AutumnError, e as EntitledResult, g as EventResult, d as AttachResult, b as BillingPortalResponse } from './genTypes-RkqyS6Mn.mjs';
2
+
3
+ declare const entitledAction: ({ customerId, featureId, }: {
4
+ customerId: string;
5
+ featureId: string;
6
+ }) => Promise<{
7
+ data: null;
8
+ error: AutumnError;
9
+ } | {
10
+ data: EntitledResult;
11
+ error: null;
12
+ }>;
13
+ declare const sendEventAction: ({ customerId, featureId, value, }: {
14
+ customerId: string;
15
+ featureId: string;
16
+ value: number;
17
+ }) => Promise<{
18
+ data: null;
19
+ error: AutumnError;
20
+ } | {
21
+ data: EventResult;
22
+ error: null;
23
+ }>;
24
+ declare const attachAction: ({ customerId, productId, }: {
25
+ customerId: string;
26
+ productId: string;
27
+ }) => Promise<{
28
+ data: null;
29
+ error: AutumnError;
30
+ } | {
31
+ data: AttachResult;
32
+ error: null;
33
+ }>;
34
+ declare const getBillingPortalAction: ({ customerId, params, }: {
35
+ customerId: string;
36
+ params?: any;
37
+ }) => Promise<{
38
+ data: BillingPortalResponse | null;
39
+ error: AutumnError | null;
40
+ }>;
41
+
42
+ export { attachAction, entitledAction, getBillingPortalAction, sendEventAction };
@@ -0,0 +1,42 @@
1
+ import { A as AutumnError, e as EntitledResult, g as EventResult, d as AttachResult, b as BillingPortalResponse } from './genTypes-RkqyS6Mn.js';
2
+
3
+ declare const entitledAction: ({ customerId, featureId, }: {
4
+ customerId: string;
5
+ featureId: string;
6
+ }) => Promise<{
7
+ data: null;
8
+ error: AutumnError;
9
+ } | {
10
+ data: EntitledResult;
11
+ error: null;
12
+ }>;
13
+ declare const sendEventAction: ({ customerId, featureId, value, }: {
14
+ customerId: string;
15
+ featureId: string;
16
+ value: number;
17
+ }) => Promise<{
18
+ data: null;
19
+ error: AutumnError;
20
+ } | {
21
+ data: EventResult;
22
+ error: null;
23
+ }>;
24
+ declare const attachAction: ({ customerId, productId, }: {
25
+ customerId: string;
26
+ productId: string;
27
+ }) => Promise<{
28
+ data: null;
29
+ error: AutumnError;
30
+ } | {
31
+ data: AttachResult;
32
+ error: null;
33
+ }>;
34
+ declare const getBillingPortalAction: ({ customerId, params, }: {
35
+ customerId: string;
36
+ params?: any;
37
+ }) => Promise<{
38
+ data: BillingPortalResponse | null;
39
+ error: AutumnError | null;
40
+ }>;
41
+
42
+ export { attachAction, entitledAction, getBillingPortalAction, sendEventAction };
@@ -0,0 +1,41 @@
1
+ "use server";
2
+ import { createAutumnClient } from "../server/cusActions";
3
+ const entitledAction = async ({
4
+ customerId,
5
+ featureId
6
+ }) => {
7
+ const autumn = createAutumnClient();
8
+ return autumn.entitled({ customer_id: customerId, feature_id: featureId });
9
+ };
10
+ const sendEventAction = async ({
11
+ customerId,
12
+ featureId,
13
+ value
14
+ }) => {
15
+ const autumn = createAutumnClient();
16
+ return autumn.event({
17
+ customer_id: customerId,
18
+ feature_id: featureId,
19
+ value
20
+ });
21
+ };
22
+ const attachAction = async ({
23
+ customerId,
24
+ productId
25
+ }) => {
26
+ const autumn = createAutumnClient();
27
+ return autumn.attach({ customer_id: customerId, product_id: productId });
28
+ };
29
+ const getBillingPortalAction = async ({
30
+ customerId,
31
+ params
32
+ }) => {
33
+ const autumn = createAutumnClient();
34
+ return await autumn.customers.billingPortal(customerId, params);
35
+ };
36
+ export {
37
+ attachAction,
38
+ entitledAction,
39
+ getBillingPortalAction,
40
+ sendEventAction
41
+ };
@@ -0,0 +1,41 @@
1
+ "use server";
2
+ import { createAutumnClient } from "../server/cusActions";
3
+ const entitledAction = async ({
4
+ customerId,
5
+ featureId
6
+ }) => {
7
+ const autumn = createAutumnClient();
8
+ return autumn.entitled({ customer_id: customerId, feature_id: featureId });
9
+ };
10
+ const sendEventAction = async ({
11
+ customerId,
12
+ featureId,
13
+ value
14
+ }) => {
15
+ const autumn = createAutumnClient();
16
+ return autumn.event({
17
+ customer_id: customerId,
18
+ feature_id: featureId,
19
+ value
20
+ });
21
+ };
22
+ const attachAction = async ({
23
+ customerId,
24
+ productId
25
+ }) => {
26
+ const autumn = createAutumnClient();
27
+ return autumn.attach({ customer_id: customerId, product_id: productId });
28
+ };
29
+ const getBillingPortalAction = async ({
30
+ customerId,
31
+ params
32
+ }) => {
33
+ const autumn = createAutumnClient();
34
+ return await autumn.customers.billingPortal(customerId, params);
35
+ };
36
+ export {
37
+ attachAction,
38
+ entitledAction,
39
+ getBillingPortalAction,
40
+ sendEventAction
41
+ };
@@ -0,0 +1,152 @@
1
+ interface AutumnError {
2
+ message: string;
3
+ code: string;
4
+ }
5
+
6
+ declare enum AppEnv {
7
+ Sandbox = "sandbox",
8
+ Live = "live"
9
+ }
10
+
11
+ declare const Infinite = "inf";
12
+ declare enum FreeTrialDuration {
13
+ Day = "day"
14
+ }
15
+ declare enum UsageModel {
16
+ Prepaid = "prepaid",
17
+ PayPerUse = "pay_per_use"
18
+ }
19
+ declare enum ProductItemInterval {
20
+ Minute = "minute",
21
+ Hour = "hour",
22
+ Day = "day",
23
+ Week = "week",
24
+ Month = "month",
25
+ Quarter = "quarter",
26
+ SemiAnnual = "semi_annual",
27
+ Year = "year"
28
+ }
29
+ type ProductItemIntervalType = "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year";
30
+
31
+ declare enum ProductStatus {
32
+ Active = "active",
33
+ Expired = "expired",
34
+ Trialing = "trialing",
35
+ Scheduled = "scheduled"
36
+ }
37
+
38
+ interface CustomerFeature {
39
+ feature_id: string;
40
+ unlimited?: boolean;
41
+ interval?: ProductItemInterval | null;
42
+ balance?: number;
43
+ usage?: number;
44
+ included_usage?: number;
45
+ next_reset_at?: number;
46
+ }
47
+ interface CustomerProduct {
48
+ id: string;
49
+ name: string | null;
50
+ group: string | null;
51
+ status: ProductStatus;
52
+ started_at: number;
53
+ canceled_at: number | null;
54
+ subscription_ids?: string[] | null;
55
+ current_period_start?: number | null;
56
+ current_period_end?: number | null;
57
+ }
58
+ interface Customer {
59
+ autumn_id: string;
60
+ created_at: number;
61
+ env: AppEnv;
62
+ id: string | null;
63
+ name: string | null;
64
+ email: string | null;
65
+ fingerprint: string | null;
66
+ stripe_id: string | null;
67
+ products: CustomerProduct[];
68
+ add_ons: CustomerProduct[];
69
+ features: CustomerFeature[];
70
+ }
71
+ interface CustomerData {
72
+ name?: string;
73
+ email?: string;
74
+ fingerprint?: string;
75
+ }
76
+ interface CreateCustomerParams {
77
+ id?: string | null;
78
+ email?: string | null;
79
+ name?: string | null;
80
+ fingerprint?: string | null;
81
+ }
82
+ interface UpdateCustomerParams {
83
+ id?: string | null;
84
+ name?: string | null;
85
+ email?: string | null;
86
+ fingerprint?: string | null;
87
+ }
88
+ interface BillingPortalParams {
89
+ return_url?: string;
90
+ }
91
+ interface BillingPortalResponse {
92
+ customer_id: string;
93
+ url: string;
94
+ }
95
+
96
+ interface AttachFeatureOptions {
97
+ feature_id: string;
98
+ quantity: number;
99
+ }
100
+ interface AttachParams {
101
+ customer_id: string;
102
+ product_id: string;
103
+ options?: AttachFeatureOptions[];
104
+ product_ids?: string[];
105
+ free_trial?: boolean;
106
+ success_url?: string;
107
+ metadata?: Record<string, string>;
108
+ force_checkout?: boolean;
109
+ }
110
+ interface AttachResult {
111
+ checkout_url?: string;
112
+ customer_id: string;
113
+ product_ids: string[];
114
+ code: string;
115
+ message: string;
116
+ }
117
+ interface EventParams {
118
+ customer_id: string;
119
+ customer_data?: CustomerData;
120
+ value?: number;
121
+ feature_id?: string;
122
+ event_name?: string;
123
+ }
124
+ interface EventResult {
125
+ id: string;
126
+ code: string;
127
+ customer_id: string;
128
+ feature_id?: string;
129
+ event_name?: string;
130
+ }
131
+ interface EntitledParams {
132
+ customer_id: string;
133
+ feature_id: string;
134
+ required_quantity?: number;
135
+ customer_data?: CustomerData;
136
+ }
137
+ interface EntitledBalance {
138
+ feature_id: string;
139
+ unlimited: boolean;
140
+ usage_allowed: boolean;
141
+ required_quantity: number | null;
142
+ balance: number | null;
143
+ }
144
+ interface EntitledResult {
145
+ customer_id: string;
146
+ feature_id: string;
147
+ code: string;
148
+ allowed: boolean;
149
+ balances: EntitledBalance[];
150
+ }
151
+
152
+ export { type AutumnError as A, type BillingPortalParams as B, type Customer as C, type EntitledParams as E, FreeTrialDuration as F, Infinite as I, type ProductItemIntervalType as P, type UpdateCustomerParams as U, type CreateCustomerParams as a, type BillingPortalResponse as b, type AttachParams as c, type AttachResult as d, type EntitledResult as e, type EventParams as f, type EventResult as g, AppEnv as h, UsageModel as i, type CustomerData as j };
@@ -0,0 +1,152 @@
1
+ interface AutumnError {
2
+ message: string;
3
+ code: string;
4
+ }
5
+
6
+ declare enum AppEnv {
7
+ Sandbox = "sandbox",
8
+ Live = "live"
9
+ }
10
+
11
+ declare const Infinite = "inf";
12
+ declare enum FreeTrialDuration {
13
+ Day = "day"
14
+ }
15
+ declare enum UsageModel {
16
+ Prepaid = "prepaid",
17
+ PayPerUse = "pay_per_use"
18
+ }
19
+ declare enum ProductItemInterval {
20
+ Minute = "minute",
21
+ Hour = "hour",
22
+ Day = "day",
23
+ Week = "week",
24
+ Month = "month",
25
+ Quarter = "quarter",
26
+ SemiAnnual = "semi_annual",
27
+ Year = "year"
28
+ }
29
+ type ProductItemIntervalType = "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year";
30
+
31
+ declare enum ProductStatus {
32
+ Active = "active",
33
+ Expired = "expired",
34
+ Trialing = "trialing",
35
+ Scheduled = "scheduled"
36
+ }
37
+
38
+ interface CustomerFeature {
39
+ feature_id: string;
40
+ unlimited?: boolean;
41
+ interval?: ProductItemInterval | null;
42
+ balance?: number;
43
+ usage?: number;
44
+ included_usage?: number;
45
+ next_reset_at?: number;
46
+ }
47
+ interface CustomerProduct {
48
+ id: string;
49
+ name: string | null;
50
+ group: string | null;
51
+ status: ProductStatus;
52
+ started_at: number;
53
+ canceled_at: number | null;
54
+ subscription_ids?: string[] | null;
55
+ current_period_start?: number | null;
56
+ current_period_end?: number | null;
57
+ }
58
+ interface Customer {
59
+ autumn_id: string;
60
+ created_at: number;
61
+ env: AppEnv;
62
+ id: string | null;
63
+ name: string | null;
64
+ email: string | null;
65
+ fingerprint: string | null;
66
+ stripe_id: string | null;
67
+ products: CustomerProduct[];
68
+ add_ons: CustomerProduct[];
69
+ features: CustomerFeature[];
70
+ }
71
+ interface CustomerData {
72
+ name?: string;
73
+ email?: string;
74
+ fingerprint?: string;
75
+ }
76
+ interface CreateCustomerParams {
77
+ id?: string | null;
78
+ email?: string | null;
79
+ name?: string | null;
80
+ fingerprint?: string | null;
81
+ }
82
+ interface UpdateCustomerParams {
83
+ id?: string | null;
84
+ name?: string | null;
85
+ email?: string | null;
86
+ fingerprint?: string | null;
87
+ }
88
+ interface BillingPortalParams {
89
+ return_url?: string;
90
+ }
91
+ interface BillingPortalResponse {
92
+ customer_id: string;
93
+ url: string;
94
+ }
95
+
96
+ interface AttachFeatureOptions {
97
+ feature_id: string;
98
+ quantity: number;
99
+ }
100
+ interface AttachParams {
101
+ customer_id: string;
102
+ product_id: string;
103
+ options?: AttachFeatureOptions[];
104
+ product_ids?: string[];
105
+ free_trial?: boolean;
106
+ success_url?: string;
107
+ metadata?: Record<string, string>;
108
+ force_checkout?: boolean;
109
+ }
110
+ interface AttachResult {
111
+ checkout_url?: string;
112
+ customer_id: string;
113
+ product_ids: string[];
114
+ code: string;
115
+ message: string;
116
+ }
117
+ interface EventParams {
118
+ customer_id: string;
119
+ customer_data?: CustomerData;
120
+ value?: number;
121
+ feature_id?: string;
122
+ event_name?: string;
123
+ }
124
+ interface EventResult {
125
+ id: string;
126
+ code: string;
127
+ customer_id: string;
128
+ feature_id?: string;
129
+ event_name?: string;
130
+ }
131
+ interface EntitledParams {
132
+ customer_id: string;
133
+ feature_id: string;
134
+ required_quantity?: number;
135
+ customer_data?: CustomerData;
136
+ }
137
+ interface EntitledBalance {
138
+ feature_id: string;
139
+ unlimited: boolean;
140
+ usage_allowed: boolean;
141
+ required_quantity: number | null;
142
+ balance: number | null;
143
+ }
144
+ interface EntitledResult {
145
+ customer_id: string;
146
+ feature_id: string;
147
+ code: string;
148
+ allowed: boolean;
149
+ balances: EntitledBalance[];
150
+ }
151
+
152
+ export { type AutumnError as A, type BillingPortalParams as B, type Customer as C, type EntitledParams as E, FreeTrialDuration as F, Infinite as I, type ProductItemIntervalType as P, type UpdateCustomerParams as U, type CreateCustomerParams as a, type BillingPortalResponse as b, type AttachParams as c, type AttachResult as d, type EntitledResult as e, type EventParams as f, type EventResult as g, AppEnv as h, UsageModel as i, type CustomerData as j };
@@ -0,0 +1,68 @@
1
+ import { P as ProductItemInterval, A as AppEnv } from './prodEnums-BnhKkH4e.js';
2
+
3
+ declare enum ProductStatus {
4
+ Active = "active",
5
+ Expired = "expired",
6
+ Trialing = "trialing",
7
+ Scheduled = "scheduled"
8
+ }
9
+
10
+ interface CustomerFeature {
11
+ feature_id: string;
12
+ unlimited?: boolean;
13
+ interval?: ProductItemInterval | null;
14
+ balance?: number;
15
+ usage?: number;
16
+ included_usage?: number;
17
+ next_reset_at?: number;
18
+ }
19
+ interface CustomerProduct {
20
+ id: string;
21
+ name: string | null;
22
+ group: string | null;
23
+ status: ProductStatus;
24
+ started_at: number;
25
+ canceled_at: number | null;
26
+ subscription_ids?: string[] | null;
27
+ current_period_start?: number | null;
28
+ current_period_end?: number | null;
29
+ }
30
+ interface Customer {
31
+ autumn_id: string;
32
+ created_at: number;
33
+ env: AppEnv;
34
+ id: string | null;
35
+ name: string | null;
36
+ email: string | null;
37
+ fingerprint: string | null;
38
+ stripe_id: string | null;
39
+ products: CustomerProduct[];
40
+ add_ons: CustomerProduct[];
41
+ features: CustomerFeature[];
42
+ }
43
+ interface CustomerData {
44
+ name?: string;
45
+ email?: string;
46
+ fingerprint?: string;
47
+ }
48
+ interface CreateCustomerParams {
49
+ id?: string | null;
50
+ email?: string | null;
51
+ name?: string | null;
52
+ fingerprint?: string | null;
53
+ }
54
+ interface UpdateCustomerParams {
55
+ id?: string | null;
56
+ name?: string | null;
57
+ email?: string | null;
58
+ fingerprint?: string | null;
59
+ }
60
+ interface BillingPortalParams {
61
+ return_url?: string;
62
+ }
63
+ interface BillingPortalResponse {
64
+ customer_id: string;
65
+ url: string;
66
+ }
67
+
68
+ export { type BillingPortalParams as B, type Customer as C, ProductStatus as P, type UpdateCustomerParams as U, type CreateCustomerParams as a, type BillingPortalResponse as b, type CustomerFeature as c, type CustomerProduct as d, type CustomerData as e };
@@ -0,0 +1,68 @@
1
+ import { P as ProductItemInterval, A as AppEnv } from './prodEnums-BnhKkH4e.mjs';
2
+
3
+ declare enum ProductStatus {
4
+ Active = "active",
5
+ Expired = "expired",
6
+ Trialing = "trialing",
7
+ Scheduled = "scheduled"
8
+ }
9
+
10
+ interface CustomerFeature {
11
+ feature_id: string;
12
+ unlimited?: boolean;
13
+ interval?: ProductItemInterval | null;
14
+ balance?: number;
15
+ usage?: number;
16
+ included_usage?: number;
17
+ next_reset_at?: number;
18
+ }
19
+ interface CustomerProduct {
20
+ id: string;
21
+ name: string | null;
22
+ group: string | null;
23
+ status: ProductStatus;
24
+ started_at: number;
25
+ canceled_at: number | null;
26
+ subscription_ids?: string[] | null;
27
+ current_period_start?: number | null;
28
+ current_period_end?: number | null;
29
+ }
30
+ interface Customer {
31
+ autumn_id: string;
32
+ created_at: number;
33
+ env: AppEnv;
34
+ id: string | null;
35
+ name: string | null;
36
+ email: string | null;
37
+ fingerprint: string | null;
38
+ stripe_id: string | null;
39
+ products: CustomerProduct[];
40
+ add_ons: CustomerProduct[];
41
+ features: CustomerFeature[];
42
+ }
43
+ interface CustomerData {
44
+ name?: string;
45
+ email?: string;
46
+ fingerprint?: string;
47
+ }
48
+ interface CreateCustomerParams {
49
+ id?: string | null;
50
+ email?: string | null;
51
+ name?: string | null;
52
+ fingerprint?: string | null;
53
+ }
54
+ interface UpdateCustomerParams {
55
+ id?: string | null;
56
+ name?: string | null;
57
+ email?: string | null;
58
+ fingerprint?: string | null;
59
+ }
60
+ interface BillingPortalParams {
61
+ return_url?: string;
62
+ }
63
+ interface BillingPortalResponse {
64
+ customer_id: string;
65
+ url: string;
66
+ }
67
+
68
+ export { type BillingPortalParams as B, type Customer as C, ProductStatus as P, type UpdateCustomerParams as U, type CreateCustomerParams as a, type BillingPortalResponse as b, type CustomerFeature as c, type CustomerProduct as d, type CustomerData as e };
@@ -0,0 +1,2 @@
1
+ import './prodEnums-BnhKkH4e.mjs';
2
+ export { B as BillingPortalParams, b as BillingPortalResponse, a as CreateCustomerParams, C as Customer, e as CustomerData, c as CustomerFeature, d as CustomerProduct, U as UpdateCustomerParams } from './cusTypes-DEdFHlrl.mjs';
@@ -0,0 +1,2 @@
1
+ import './prodEnums-BnhKkH4e.js';
2
+ export { B as BillingPortalParams, b as BillingPortalResponse, a as CreateCustomerParams, C as Customer, e as CustomerData, c as CustomerFeature, d as CustomerProduct, U as UpdateCustomerParams } from './cusTypes-B9fUPd5R.js';
@@ -0,0 +1,60 @@
1
+ import { e as CustomerData } from './cusTypes-DEdFHlrl.mjs';
2
+ import './prodEnums-BnhKkH4e.mjs';
3
+
4
+ interface AttachFeatureOptions {
5
+ feature_id: string;
6
+ quantity: number;
7
+ }
8
+ interface AttachParams {
9
+ customer_id: string;
10
+ product_id: string;
11
+ options?: AttachFeatureOptions[];
12
+ product_ids?: string[];
13
+ free_trial?: boolean;
14
+ success_url?: string;
15
+ metadata?: Record<string, string>;
16
+ force_checkout?: boolean;
17
+ }
18
+ interface AttachResult {
19
+ checkout_url?: string;
20
+ customer_id: string;
21
+ product_ids: string[];
22
+ code: string;
23
+ message: string;
24
+ }
25
+ interface EventParams {
26
+ customer_id: string;
27
+ customer_data?: CustomerData;
28
+ value?: number;
29
+ feature_id?: string;
30
+ event_name?: string;
31
+ }
32
+ interface EventResult {
33
+ id: string;
34
+ code: string;
35
+ customer_id: string;
36
+ feature_id?: string;
37
+ event_name?: string;
38
+ }
39
+ interface EntitledParams {
40
+ customer_id: string;
41
+ feature_id: string;
42
+ required_quantity?: number;
43
+ customer_data?: CustomerData;
44
+ }
45
+ interface EntitledBalance {
46
+ feature_id: string;
47
+ unlimited: boolean;
48
+ usage_allowed: boolean;
49
+ required_quantity: number | null;
50
+ balance: number | null;
51
+ }
52
+ interface EntitledResult {
53
+ customer_id: string;
54
+ feature_id: string;
55
+ code: string;
56
+ allowed: boolean;
57
+ balances: EntitledBalance[];
58
+ }
59
+
60
+ export type { AttachFeatureOptions, AttachParams, AttachResult, EntitledBalance, EntitledParams, EntitledResult, EventParams, EventResult };