autumn-js 1.2.32 → 1.2.34
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.
- package/dist/backend/adapters/express.d.mts +1 -1
- package/dist/backend/adapters/express.d.ts +1 -1
- package/dist/backend/adapters/express.js +13482 -7722
- package/dist/backend/adapters/express.mjs +5 -5
- package/dist/backend/adapters/fetch.d.mts +1 -1
- package/dist/backend/adapters/fetch.d.ts +1 -1
- package/dist/backend/adapters/fetch.js +13482 -7722
- package/dist/backend/adapters/fetch.mjs +5 -5
- package/dist/backend/adapters/hono.d.mts +1 -1
- package/dist/backend/adapters/hono.d.ts +1 -1
- package/dist/backend/adapters/hono.js +13482 -7722
- package/dist/backend/adapters/hono.mjs +5 -5
- package/dist/backend/adapters/index.d.mts +1 -1
- package/dist/backend/adapters/index.d.ts +1 -1
- package/dist/backend/adapters/index.js +13482 -7722
- package/dist/backend/adapters/index.mjs +8 -8
- package/dist/backend/adapters/next.d.mts +1 -1
- package/dist/backend/adapters/next.d.ts +1 -1
- package/dist/backend/adapters/next.js +13482 -7722
- package/dist/backend/adapters/next.mjs +5 -5
- package/dist/backend/{authTypes-Bx2brfr_.d.mts → authTypes-DEBvnrRj.d.mts} +20 -1
- package/dist/backend/{authTypes-Bx2brfr_.d.ts → authTypes-DEBvnrRj.d.ts} +20 -1
- package/dist/backend/{chunk-UYURZ75E.mjs → chunk-4LKEHLXR.mjs} +704 -41
- package/dist/backend/{chunk-W7MG3LB3.mjs → chunk-7MRAUIPE.mjs} +1 -1
- package/dist/backend/{chunk-7MPQ5TCH.mjs → chunk-DDRD5BKK.mjs} +2 -2
- package/dist/backend/{chunk-Z7WSDAEZ.mjs → chunk-EQJ5B7OA.mjs} +13165 -8068
- package/dist/backend/{chunk-AYS6GLVO.mjs → chunk-HMGGMVFC.mjs} +1 -1
- package/dist/backend/{chunk-5QIIBIZY.mjs → chunk-KXRDZE5L.mjs} +2 -2
- package/dist/backend/{chunk-MXD3NPQK.mjs → chunk-SA6MCT5X.mjs} +1 -1
- package/dist/backend/{chunk-NSAJNDTG.mjs → chunk-WCZLA72P.mjs} +1 -1
- package/dist/backend/core/handlers/coreHandler.d.mts +2 -2
- package/dist/backend/core/handlers/coreHandler.d.ts +2 -2
- package/dist/backend/core/handlers/coreHandler.js +13482 -7722
- package/dist/backend/core/handlers/coreHandler.mjs +3 -3
- package/dist/backend/core/handlers/executeRoute.d.mts +2 -2
- package/dist/backend/core/handlers/executeRoute.d.ts +2 -2
- package/dist/backend/core/handlers/handleRouteByName.d.mts +1 -1
- package/dist/backend/core/handlers/handleRouteByName.d.ts +1 -1
- package/dist/backend/core/handlers/handleRouteByName.js +13482 -7722
- package/dist/backend/core/handlers/handleRouteByName.mjs +3 -3
- package/dist/backend/core/handlers/index.d.mts +2 -2
- package/dist/backend/core/handlers/index.d.ts +2 -2
- package/dist/backend/core/handlers/index.js +13482 -7722
- package/dist/backend/core/handlers/index.mjs +4 -4
- package/dist/backend/core/handlers/resolveIdentity.d.mts +1 -1
- package/dist/backend/core/handlers/resolveIdentity.d.ts +1 -1
- package/dist/backend/core/index.d.mts +2 -2
- package/dist/backend/core/index.d.ts +2 -2
- package/dist/backend/core/index.js +13482 -7722
- package/dist/backend/core/index.mjs +4 -4
- package/dist/backend/core/routes/index.d.mts +2 -2
- package/dist/backend/core/routes/index.d.ts +2 -2
- package/dist/backend/core/routes/index.js +704 -41
- package/dist/backend/core/routes/index.mjs +1 -1
- package/dist/backend/core/routes/routeBuilder.d.mts +2 -2
- package/dist/backend/core/routes/routeBuilder.d.ts +2 -2
- package/dist/backend/core/routes/routeConfigs.d.mts +2 -2
- package/dist/backend/core/routes/routeConfigs.d.ts +2 -2
- package/dist/backend/core/routes/routeConfigs.js +704 -41
- package/dist/backend/core/routes/routeConfigs.mjs +1 -1
- package/dist/backend/core/types/authTypes.d.mts +1 -1
- package/dist/backend/core/types/authTypes.d.ts +1 -1
- package/dist/backend/core/types/handlerTypes.d.mts +2 -2
- package/dist/backend/core/types/handlerTypes.d.ts +2 -2
- package/dist/backend/core/types/index.d.mts +2 -2
- package/dist/backend/core/types/index.d.ts +2 -2
- package/dist/backend/core/types/routeTypes.d.mts +2 -2
- package/dist/backend/core/types/routeTypes.d.ts +2 -2
- package/dist/backend/index.d.mts +4 -4
- package/dist/backend/index.d.ts +4 -4
- package/dist/backend/index.js +13482 -7722
- package/dist/backend/index.mjs +4 -4
- package/dist/backend/{routeTypes-DmFnGvb2.d.mts → routeTypes-Bb3L3YJy.d.mts} +14646 -7926
- package/dist/backend/{routeTypes-ChCnBnee.d.ts → routeTypes-BhZ9UovL.d.ts} +14646 -7926
- package/dist/better-auth/{chunk-JBU3OM2O.mjs → chunk-4VW7A2HS.mjs} +13166 -8069
- package/dist/better-auth/{chunk-ZQA6B5RX.mjs → chunk-B2PHHBLY.mjs} +704 -41
- package/dist/better-auth/{chunk-56VTK4JS.mjs → chunk-D3DYQ36C.mjs} +1 -1
- package/dist/better-auth/index.js +13888 -8128
- package/dist/better-auth/index.mjs +3 -3
- package/dist/better-auth/types.d.mts +20 -1
- package/dist/better-auth/types.d.ts +20 -1
- package/dist/better-auth/utils/createAutumnEndpoint.js +704 -41
- package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
- package/dist/better-auth/utils/handleBetterAuthRoute.js +13482 -7722
- package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
- package/dist/better-auth/utils/index.js +13888 -8128
- package/dist/better-auth/utils/index.mjs +3 -3
- package/dist/react/AutumnContext.d.mts +4 -3
- package/dist/react/AutumnContext.d.ts +4 -3
- package/dist/react/AutumnProvider.js +678 -497
- package/dist/react/AutumnProvider.mjs +2 -2
- package/dist/react/{chunk-3CXPC6AS.mjs → chunk-6KIRT7EK.mjs} +1 -1
- package/dist/react/{chunk-PVCGOFQF.mjs → chunk-AAPQJY55.mjs} +1 -1
- package/dist/react/{chunk-N2L457YE.mjs → chunk-DDMHYLY3.mjs} +1 -1
- package/dist/react/{chunk-X7BHGQHX.mjs → chunk-ERN74FDW.mjs} +1 -1
- package/dist/react/{chunk-P23GII4V.mjs → chunk-FU6VEECB.mjs} +428 -235
- package/dist/react/{chunk-C4DMB2FQ.mjs → chunk-JH5BXBEU.mjs} +1 -1
- package/dist/react/{chunk-4TB3RHNC.mjs → chunk-M3L6EE7I.mjs} +1 -1
- package/dist/react/{chunk-Q3SFYOOM.mjs → chunk-VJDFB54U.mjs} +2 -2
- package/dist/react/{chunk-ZLGDHFMS.mjs → chunk-YZ23DM7M.mjs} +1 -1
- package/dist/react/client/AutumnClient.d.mts +4 -3
- package/dist/react/client/AutumnClient.d.ts +4 -3
- package/dist/react/client/IAutumnClient.d.mts +4 -471
- package/dist/react/client/IAutumnClient.d.ts +4 -471
- package/dist/react/client/index.d.mts +4 -3
- package/dist/react/client/index.d.ts +4 -3
- package/dist/react/{customer-B9DcViyn.d.mts → customer-Djhe48ql.d.ts} +24 -5
- package/dist/react/{customer-DbS31iZc.d.ts → customer-IVcJjz9u.d.mts} +24 -5
- package/dist/react/hooks/index.d.mts +4 -3
- package/dist/react/hooks/index.d.ts +4 -3
- package/dist/react/hooks/index.js +292 -193
- package/dist/react/hooks/index.mjs +8 -8
- package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +2 -2
- package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +2 -2
- package/dist/react/hooks/internal/check/customerToFeatures.d.mts +2 -2
- package/dist/react/hooks/internal/check/customerToFeatures.d.ts +2 -2
- package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +2 -2
- package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +2 -2
- package/dist/react/hooks/internal/check/getCreditCost.d.mts +2 -2
- package/dist/react/hooks/internal/check/getCreditCost.d.ts +2 -2
- package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +3 -3
- package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +3 -3
- package/dist/react/hooks/internal/useCustomerActions.d.mts +4 -3
- package/dist/react/hooks/internal/useCustomerActions.d.ts +4 -3
- package/dist/react/hooks/internal/useCustomerActions.js +1 -1
- package/dist/react/hooks/internal/useCustomerActions.mjs +2 -2
- package/dist/react/hooks/useAggregateEvents.d.mts +17 -17
- package/dist/react/hooks/useAggregateEvents.d.ts +17 -17
- package/dist/react/hooks/useAggregateEvents.js +292 -193
- package/dist/react/hooks/useAggregateEvents.mjs +2 -2
- package/dist/react/hooks/useCustomer.d.mts +3 -3
- package/dist/react/hooks/useCustomer.d.ts +3 -3
- package/dist/react/hooks/useCustomer.js +292 -193
- package/dist/react/hooks/useCustomer.mjs +3 -3
- package/dist/react/hooks/useEntity.d.mts +2 -2
- package/dist/react/hooks/useEntity.d.ts +2 -2
- package/dist/react/hooks/useEntity.js +292 -193
- package/dist/react/hooks/useEntity.mjs +2 -2
- package/dist/react/hooks/useListEvents.d.mts +17 -17
- package/dist/react/hooks/useListEvents.d.ts +17 -17
- package/dist/react/hooks/useListEvents.js +292 -193
- package/dist/react/hooks/useListEvents.mjs +2 -2
- package/dist/react/hooks/useListPlans.d.mts +5 -4
- package/dist/react/hooks/useListPlans.d.ts +5 -4
- package/dist/react/hooks/useListPlans.js +292 -193
- package/dist/react/hooks/useListPlans.mjs +2 -2
- package/dist/react/hooks/useReferrals.d.mts +2 -2
- package/dist/react/hooks/useReferrals.d.ts +2 -2
- package/dist/react/hooks/useReferrals.js +292 -193
- package/dist/react/hooks/useReferrals.mjs +2 -2
- package/dist/react/index.d.mts +4 -3
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +1586 -1393
- package/dist/react/index.mjs +9 -9
- package/dist/react/list-plans-op-ByqRxdNR.d.mts +1224 -0
- package/dist/react/list-plans-op-D-K2LRZV.d.ts +1224 -0
- package/dist/react/{params-B8-s4Q1n.d.ts → params-CFhvUVCf.d.ts} +1605 -199
- package/dist/react/{params-BquS51Ut.d.mts → params-D3ra6In7.d.mts} +1605 -199
- package/dist/react/plan-DOxbvjQY.d.mts +1496 -0
- package/dist/react/plan-DOxbvjQY.d.ts +1496 -0
- package/dist/sdk/index.d.mts +19588 -11175
- package/dist/sdk/index.d.ts +19588 -11175
- package/dist/sdk/index.js +19103 -11652
- package/dist/sdk/index.mjs +18149 -11528
- package/package.json +1 -1
- package/dist/react/plan-BKltGb1S.d.mts +0 -743
- package/dist/react/plan-BKltGb1S.d.ts +0 -743
|
@@ -0,0 +1,1496 @@
|
|
|
1
|
+
declare const __brand: unique symbol;
|
|
2
|
+
type Unrecognized<T> = T & {
|
|
3
|
+
[__brand]: "unrecognized";
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type ClosedEnum<T extends Readonly<Record<string, string | number>>> = T[keyof T];
|
|
7
|
+
type OpenEnum<T extends Readonly<Record<string, string | number>>> = T[keyof T] | Unrecognized<T[keyof T] extends number ? number : string>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools, 'ai_credit_system' for model-based token pricing.
|
|
11
|
+
*/
|
|
12
|
+
declare const BalanceType: {
|
|
13
|
+
readonly Boolean: "boolean";
|
|
14
|
+
readonly Metered: "metered";
|
|
15
|
+
readonly CreditSystem: "credit_system";
|
|
16
|
+
readonly AiCreditSystem: "ai_credit_system";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools, 'ai_credit_system' for model-based token pricing.
|
|
20
|
+
*/
|
|
21
|
+
type BalanceType = OpenEnum<typeof BalanceType>;
|
|
22
|
+
type BalanceCreditSchema = {
|
|
23
|
+
/**
|
|
24
|
+
* ID of the metered feature that draws from this credit system.
|
|
25
|
+
*/
|
|
26
|
+
meteredFeatureId: string;
|
|
27
|
+
/**
|
|
28
|
+
* Credits consumed per unit of the metered feature.
|
|
29
|
+
*/
|
|
30
|
+
creditCost: number;
|
|
31
|
+
};
|
|
32
|
+
type BalanceModelMarkups = {
|
|
33
|
+
markup?: number | undefined;
|
|
34
|
+
inputCost?: number | undefined;
|
|
35
|
+
outputCost?: number | undefined;
|
|
36
|
+
};
|
|
37
|
+
type BalanceProviderMarkups = {
|
|
38
|
+
markup: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Display names for the feature in billing UI and customer-facing components.
|
|
42
|
+
*/
|
|
43
|
+
type BalanceDisplay = {
|
|
44
|
+
/**
|
|
45
|
+
* Singular form for UI display (e.g., 'API call', 'seat').
|
|
46
|
+
*/
|
|
47
|
+
singular?: string | null | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Plural form for UI display (e.g., 'API calls', 'seats').
|
|
50
|
+
*/
|
|
51
|
+
plural?: string | null | undefined;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The full feature object if expanded.
|
|
55
|
+
*/
|
|
56
|
+
type BalanceFeature = {
|
|
57
|
+
/**
|
|
58
|
+
* The unique identifier for this feature, used in /check and /track calls.
|
|
59
|
+
*/
|
|
60
|
+
id: string;
|
|
61
|
+
/**
|
|
62
|
+
* Human-readable name displayed in the dashboard and billing UI.
|
|
63
|
+
*/
|
|
64
|
+
name: string;
|
|
65
|
+
/**
|
|
66
|
+
* Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools, 'ai_credit_system' for model-based token pricing.
|
|
67
|
+
*/
|
|
68
|
+
type: BalanceType;
|
|
69
|
+
/**
|
|
70
|
+
* For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
|
71
|
+
*/
|
|
72
|
+
consumable: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
|
75
|
+
*/
|
|
76
|
+
eventNames?: Array<string> | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* For credit_system features: maps metered features to their credit costs.
|
|
79
|
+
*/
|
|
80
|
+
creditSchema?: Array<BalanceCreditSchema> | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Per-model markup overrides for AI credit systems.
|
|
83
|
+
*/
|
|
84
|
+
modelMarkups?: {
|
|
85
|
+
[k: string]: BalanceModelMarkups;
|
|
86
|
+
} | null | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Default percentage markup for AI credit systems. Use -100 to make usage free.
|
|
89
|
+
*/
|
|
90
|
+
defaultMarkup?: number | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Per-provider default markup percentages for AI credit systems.
|
|
93
|
+
*/
|
|
94
|
+
providerMarkups?: {
|
|
95
|
+
[k: string]: BalanceProviderMarkups;
|
|
96
|
+
} | null | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Display names for the feature in billing UI and customer-facing components.
|
|
99
|
+
*/
|
|
100
|
+
display?: BalanceDisplay | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the feature is archived and hidden from the dashboard.
|
|
103
|
+
*/
|
|
104
|
+
archived: boolean;
|
|
105
|
+
};
|
|
106
|
+
declare const BalanceIntervalEnum: {
|
|
107
|
+
readonly OneOff: "one_off";
|
|
108
|
+
readonly Minute: "minute";
|
|
109
|
+
readonly Hour: "hour";
|
|
110
|
+
readonly Day: "day";
|
|
111
|
+
readonly Week: "week";
|
|
112
|
+
readonly Month: "month";
|
|
113
|
+
readonly Quarter: "quarter";
|
|
114
|
+
readonly SemiAnnual: "semi_annual";
|
|
115
|
+
readonly Year: "year";
|
|
116
|
+
};
|
|
117
|
+
type BalanceIntervalEnum = OpenEnum<typeof BalanceIntervalEnum>;
|
|
118
|
+
type BalanceReset = {
|
|
119
|
+
/**
|
|
120
|
+
* The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.
|
|
121
|
+
*/
|
|
122
|
+
interval: BalanceIntervalEnum | string;
|
|
123
|
+
/**
|
|
124
|
+
* Number of intervals between resets (eg. 2 for bi-monthly).
|
|
125
|
+
*/
|
|
126
|
+
intervalCount?: number | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Timestamp when the balance will next reset.
|
|
129
|
+
*/
|
|
130
|
+
resetsAt: number | null;
|
|
131
|
+
};
|
|
132
|
+
type BalanceTier = {
|
|
133
|
+
to: number | string;
|
|
134
|
+
amount: number;
|
|
135
|
+
flatAmount?: number | undefined;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier).
|
|
139
|
+
*/
|
|
140
|
+
declare const BalanceTierBehavior: {
|
|
141
|
+
readonly Graduated: "graduated";
|
|
142
|
+
readonly Volume: "volume";
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier).
|
|
146
|
+
*/
|
|
147
|
+
type BalanceTierBehavior = OpenEnum<typeof BalanceTierBehavior>;
|
|
148
|
+
/**
|
|
149
|
+
* Whether usage is prepaid or billed pay-per-use.
|
|
150
|
+
*/
|
|
151
|
+
declare const BalanceBillingMethod: {
|
|
152
|
+
readonly Prepaid: "prepaid";
|
|
153
|
+
readonly UsageBased: "usage_based";
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Whether usage is prepaid or billed pay-per-use.
|
|
157
|
+
*/
|
|
158
|
+
type BalanceBillingMethod = OpenEnum<typeof BalanceBillingMethod>;
|
|
159
|
+
type BalancePrice = {
|
|
160
|
+
/**
|
|
161
|
+
* The per-unit price amount.
|
|
162
|
+
*/
|
|
163
|
+
amount?: number | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Tiered pricing configuration if applicable.
|
|
166
|
+
*/
|
|
167
|
+
tiers?: Array<BalanceTier> | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier).
|
|
170
|
+
*/
|
|
171
|
+
tierBehavior?: BalanceTierBehavior | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* The number of units per billing increment (eg. $9 / 250 units).
|
|
174
|
+
*/
|
|
175
|
+
billingUnits: number;
|
|
176
|
+
/**
|
|
177
|
+
* Whether usage is prepaid or billed pay-per-use.
|
|
178
|
+
*/
|
|
179
|
+
billingMethod: BalanceBillingMethod;
|
|
180
|
+
/**
|
|
181
|
+
* Maximum quantity that can be purchased, or null for unlimited.
|
|
182
|
+
*/
|
|
183
|
+
maxPurchase: number | null;
|
|
184
|
+
};
|
|
185
|
+
type Breakdown = {
|
|
186
|
+
/**
|
|
187
|
+
* The unique identifier for this balance breakdown.
|
|
188
|
+
*/
|
|
189
|
+
id: string;
|
|
190
|
+
/**
|
|
191
|
+
* The plan ID this balance originates from, or null for standalone balances.
|
|
192
|
+
*/
|
|
193
|
+
planId: string | null;
|
|
194
|
+
/**
|
|
195
|
+
* Amount granted from the plan's included usage.
|
|
196
|
+
*/
|
|
197
|
+
includedGrant: number;
|
|
198
|
+
/**
|
|
199
|
+
* Amount granted from prepaid purchases or top-ups.
|
|
200
|
+
*/
|
|
201
|
+
prepaidGrant: number;
|
|
202
|
+
/**
|
|
203
|
+
* Remaining balance available for use.
|
|
204
|
+
*/
|
|
205
|
+
remaining: number;
|
|
206
|
+
/**
|
|
207
|
+
* Amount consumed in the current period.
|
|
208
|
+
*/
|
|
209
|
+
usage: number;
|
|
210
|
+
/**
|
|
211
|
+
* Whether this balance has unlimited usage.
|
|
212
|
+
*/
|
|
213
|
+
unlimited: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Reset configuration for this balance, or null if no reset.
|
|
216
|
+
*/
|
|
217
|
+
reset: BalanceReset | null;
|
|
218
|
+
/**
|
|
219
|
+
* Pricing configuration if this balance has usage-based pricing.
|
|
220
|
+
*/
|
|
221
|
+
price: BalancePrice | null;
|
|
222
|
+
/**
|
|
223
|
+
* Timestamp when this balance expires, or null for no expiration.
|
|
224
|
+
*/
|
|
225
|
+
expiresAt: number | null;
|
|
226
|
+
};
|
|
227
|
+
type BalanceRollover = {
|
|
228
|
+
/**
|
|
229
|
+
* Amount of balance rolled over from a previous period.
|
|
230
|
+
*/
|
|
231
|
+
balance: number;
|
|
232
|
+
/**
|
|
233
|
+
* Timestamp when the rollover balance expires.
|
|
234
|
+
*/
|
|
235
|
+
expiresAt: number;
|
|
236
|
+
};
|
|
237
|
+
type Balance = {
|
|
238
|
+
/**
|
|
239
|
+
* The feature ID this balance is for.
|
|
240
|
+
*/
|
|
241
|
+
featureId: string;
|
|
242
|
+
/**
|
|
243
|
+
* The full feature object if expanded.
|
|
244
|
+
*/
|
|
245
|
+
feature?: BalanceFeature | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* Total balance granted (included + prepaid).
|
|
248
|
+
*/
|
|
249
|
+
granted: number;
|
|
250
|
+
/**
|
|
251
|
+
* Remaining balance available for use.
|
|
252
|
+
*/
|
|
253
|
+
remaining: number;
|
|
254
|
+
/**
|
|
255
|
+
* Total usage consumed in the current period.
|
|
256
|
+
*/
|
|
257
|
+
usage: number;
|
|
258
|
+
/**
|
|
259
|
+
* Whether this feature has unlimited usage.
|
|
260
|
+
*/
|
|
261
|
+
unlimited: boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Whether usage beyond the granted balance is allowed (with overage charges).
|
|
264
|
+
*/
|
|
265
|
+
overageAllowed: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Maximum quantity that can be purchased as a top-up, or null for unlimited.
|
|
268
|
+
*/
|
|
269
|
+
maxPurchase: number | null;
|
|
270
|
+
/**
|
|
271
|
+
* Timestamp when the balance will reset, or null for no reset.
|
|
272
|
+
*/
|
|
273
|
+
nextResetAt: number | null;
|
|
274
|
+
/**
|
|
275
|
+
* Detailed breakdown of balance sources when stacking multiple plans or grants.
|
|
276
|
+
*/
|
|
277
|
+
breakdown?: Array<Breakdown> | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* Rollover balances carried over from previous periods.
|
|
280
|
+
*/
|
|
281
|
+
rollovers?: Array<BalanceRollover> | undefined;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Billing interval (e.g. 'month', 'year').
|
|
286
|
+
*/
|
|
287
|
+
declare const PlanPriceInterval: {
|
|
288
|
+
readonly OneOff: "one_off";
|
|
289
|
+
readonly Week: "week";
|
|
290
|
+
readonly Month: "month";
|
|
291
|
+
readonly Quarter: "quarter";
|
|
292
|
+
readonly SemiAnnual: "semi_annual";
|
|
293
|
+
readonly Year: "year";
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Billing interval (e.g. 'month', 'year').
|
|
297
|
+
*/
|
|
298
|
+
type PlanPriceInterval = OpenEnum<typeof PlanPriceInterval>;
|
|
299
|
+
/**
|
|
300
|
+
* Display text for showing this price in pricing pages.
|
|
301
|
+
*/
|
|
302
|
+
type PlanPriceDisplay = {
|
|
303
|
+
/**
|
|
304
|
+
* Main display text (e.g. '$10' or '100 messages').
|
|
305
|
+
*/
|
|
306
|
+
primaryText: string;
|
|
307
|
+
/**
|
|
308
|
+
* Secondary display text (e.g. 'per month' or 'then $0.5 per 100').
|
|
309
|
+
*/
|
|
310
|
+
secondaryText?: string | undefined;
|
|
311
|
+
};
|
|
312
|
+
type PlanPrice = {
|
|
313
|
+
/**
|
|
314
|
+
* Base price amount for the plan.
|
|
315
|
+
*/
|
|
316
|
+
amount: number;
|
|
317
|
+
/**
|
|
318
|
+
* Billing interval (e.g. 'month', 'year').
|
|
319
|
+
*/
|
|
320
|
+
interval: PlanPriceInterval;
|
|
321
|
+
/**
|
|
322
|
+
* Number of intervals per billing cycle. Defaults to 1.
|
|
323
|
+
*/
|
|
324
|
+
intervalCount?: number | undefined;
|
|
325
|
+
/**
|
|
326
|
+
* Display text for showing this price in pricing pages.
|
|
327
|
+
*/
|
|
328
|
+
display?: PlanPriceDisplay | undefined;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* The type of the feature
|
|
332
|
+
*/
|
|
333
|
+
declare const PlanType: {
|
|
334
|
+
readonly Static: "static";
|
|
335
|
+
readonly Boolean: "boolean";
|
|
336
|
+
readonly SingleUse: "single_use";
|
|
337
|
+
readonly ContinuousUse: "continuous_use";
|
|
338
|
+
readonly CreditSystem: "credit_system";
|
|
339
|
+
readonly AiCreditSystem: "ai_credit_system";
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* The type of the feature
|
|
343
|
+
*/
|
|
344
|
+
type PlanType = OpenEnum<typeof PlanType>;
|
|
345
|
+
type PlanFeatureDisplay = {
|
|
346
|
+
/**
|
|
347
|
+
* The singular display name for the feature.
|
|
348
|
+
*/
|
|
349
|
+
singular: string;
|
|
350
|
+
/**
|
|
351
|
+
* The plural display name for the feature.
|
|
352
|
+
*/
|
|
353
|
+
plural: string;
|
|
354
|
+
};
|
|
355
|
+
type PlanCreditSchema = {
|
|
356
|
+
/**
|
|
357
|
+
* The ID of the metered feature (should be a single_use feature).
|
|
358
|
+
*/
|
|
359
|
+
meteredFeatureId: string;
|
|
360
|
+
/**
|
|
361
|
+
* The credit cost of the metered feature.
|
|
362
|
+
*/
|
|
363
|
+
creditCost: number;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* The full feature object if expanded.
|
|
367
|
+
*/
|
|
368
|
+
type PlanFeature = {
|
|
369
|
+
/**
|
|
370
|
+
* The ID of the feature, used to refer to it in other API calls like /track or /check.
|
|
371
|
+
*/
|
|
372
|
+
id: string;
|
|
373
|
+
/**
|
|
374
|
+
* The name of the feature.
|
|
375
|
+
*/
|
|
376
|
+
name?: string | null | undefined;
|
|
377
|
+
/**
|
|
378
|
+
* The type of the feature
|
|
379
|
+
*/
|
|
380
|
+
type: PlanType;
|
|
381
|
+
/**
|
|
382
|
+
* Singular and plural display names for the feature.
|
|
383
|
+
*/
|
|
384
|
+
display?: PlanFeatureDisplay | null | undefined;
|
|
385
|
+
/**
|
|
386
|
+
* Credit cost schema for credit system features.
|
|
387
|
+
*/
|
|
388
|
+
creditSchema?: Array<PlanCreditSchema> | null | undefined;
|
|
389
|
+
/**
|
|
390
|
+
* Whether or not the feature is archived.
|
|
391
|
+
*/
|
|
392
|
+
archived?: boolean | null | undefined;
|
|
393
|
+
};
|
|
394
|
+
/**
|
|
395
|
+
* The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.
|
|
396
|
+
*/
|
|
397
|
+
declare const PlanResetItemInterval: {
|
|
398
|
+
readonly OneOff: "one_off";
|
|
399
|
+
readonly Minute: "minute";
|
|
400
|
+
readonly Hour: "hour";
|
|
401
|
+
readonly Day: "day";
|
|
402
|
+
readonly Week: "week";
|
|
403
|
+
readonly Month: "month";
|
|
404
|
+
readonly Quarter: "quarter";
|
|
405
|
+
readonly SemiAnnual: "semi_annual";
|
|
406
|
+
readonly Year: "year";
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.
|
|
410
|
+
*/
|
|
411
|
+
type PlanResetItemInterval = OpenEnum<typeof PlanResetItemInterval>;
|
|
412
|
+
type PlanItemReset = {
|
|
413
|
+
/**
|
|
414
|
+
* The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.
|
|
415
|
+
*/
|
|
416
|
+
interval: PlanResetItemInterval;
|
|
417
|
+
/**
|
|
418
|
+
* Number of intervals between resets. Defaults to 1.
|
|
419
|
+
*/
|
|
420
|
+
intervalCount?: number | undefined;
|
|
421
|
+
};
|
|
422
|
+
type PlanItemTier = {
|
|
423
|
+
to: number | string;
|
|
424
|
+
amount: number;
|
|
425
|
+
flatAmount?: number | undefined;
|
|
426
|
+
};
|
|
427
|
+
declare const PlanItemTierBehavior: {
|
|
428
|
+
readonly Graduated: "graduated";
|
|
429
|
+
readonly Volume: "volume";
|
|
430
|
+
};
|
|
431
|
+
type PlanItemTierBehavior = OpenEnum<typeof PlanItemTierBehavior>;
|
|
432
|
+
/**
|
|
433
|
+
* Billing interval for this price. For consumable features, should match reset.interval.
|
|
434
|
+
*/
|
|
435
|
+
declare const PlanPriceItemInterval: {
|
|
436
|
+
readonly OneOff: "one_off";
|
|
437
|
+
readonly Week: "week";
|
|
438
|
+
readonly Month: "month";
|
|
439
|
+
readonly Quarter: "quarter";
|
|
440
|
+
readonly SemiAnnual: "semi_annual";
|
|
441
|
+
readonly Year: "year";
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* Billing interval for this price. For consumable features, should match reset.interval.
|
|
445
|
+
*/
|
|
446
|
+
type PlanPriceItemInterval = OpenEnum<typeof PlanPriceItemInterval>;
|
|
447
|
+
/**
|
|
448
|
+
* 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.
|
|
449
|
+
*/
|
|
450
|
+
declare const PlanItemBillingMethod: {
|
|
451
|
+
readonly Prepaid: "prepaid";
|
|
452
|
+
readonly UsageBased: "usage_based";
|
|
453
|
+
};
|
|
454
|
+
/**
|
|
455
|
+
* 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.
|
|
456
|
+
*/
|
|
457
|
+
type PlanItemBillingMethod = OpenEnum<typeof PlanItemBillingMethod>;
|
|
458
|
+
type PlanItemPrice = {
|
|
459
|
+
/**
|
|
460
|
+
* Price per billing_units after included usage is consumed. Mutually exclusive with tiers.
|
|
461
|
+
*/
|
|
462
|
+
amount?: number | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.
|
|
465
|
+
*/
|
|
466
|
+
tiers?: Array<PlanItemTier> | undefined;
|
|
467
|
+
tierBehavior?: PlanItemTierBehavior | undefined;
|
|
468
|
+
/**
|
|
469
|
+
* Billing interval for this price. For consumable features, should match reset.interval.
|
|
470
|
+
*/
|
|
471
|
+
interval: PlanPriceItemInterval;
|
|
472
|
+
/**
|
|
473
|
+
* Number of intervals per billing cycle. Defaults to 1.
|
|
474
|
+
*/
|
|
475
|
+
intervalCount?: number | undefined;
|
|
476
|
+
/**
|
|
477
|
+
* Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).
|
|
478
|
+
*/
|
|
479
|
+
billingUnits: number;
|
|
480
|
+
/**
|
|
481
|
+
* 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.
|
|
482
|
+
*/
|
|
483
|
+
billingMethod: PlanItemBillingMethod;
|
|
484
|
+
/**
|
|
485
|
+
* Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.
|
|
486
|
+
*/
|
|
487
|
+
maxPurchase: number | null;
|
|
488
|
+
};
|
|
489
|
+
/**
|
|
490
|
+
* Display text for showing this item in pricing pages.
|
|
491
|
+
*/
|
|
492
|
+
type PlanItemDisplay = {
|
|
493
|
+
/**
|
|
494
|
+
* Main display text (e.g. '$10' or '100 messages').
|
|
495
|
+
*/
|
|
496
|
+
primaryText: string;
|
|
497
|
+
/**
|
|
498
|
+
* Secondary display text (e.g. 'per month' or 'then $0.5 per 100').
|
|
499
|
+
*/
|
|
500
|
+
secondaryText?: string | undefined;
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* When rolled over units expire.
|
|
504
|
+
*/
|
|
505
|
+
declare const ItemExpiryDurationType: {
|
|
506
|
+
readonly Month: "month";
|
|
507
|
+
readonly Forever: "forever";
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* When rolled over units expire.
|
|
511
|
+
*/
|
|
512
|
+
type ItemExpiryDurationType = OpenEnum<typeof ItemExpiryDurationType>;
|
|
513
|
+
/**
|
|
514
|
+
* Rollover configuration for unused units. If set, unused included units roll over to the next period.
|
|
515
|
+
*/
|
|
516
|
+
type PlanItemRollover = {
|
|
517
|
+
/**
|
|
518
|
+
* Maximum rollover units. Null for unlimited rollover.
|
|
519
|
+
*/
|
|
520
|
+
max: number | null;
|
|
521
|
+
/**
|
|
522
|
+
* Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
|
|
523
|
+
*/
|
|
524
|
+
maxPercentage?: number | null | undefined;
|
|
525
|
+
/**
|
|
526
|
+
* When rolled over units expire.
|
|
527
|
+
*/
|
|
528
|
+
expiryDurationType: ItemExpiryDurationType;
|
|
529
|
+
/**
|
|
530
|
+
* Number of periods before expiry.
|
|
531
|
+
*/
|
|
532
|
+
expiryDurationLength?: number | undefined;
|
|
533
|
+
};
|
|
534
|
+
type Item = {
|
|
535
|
+
/**
|
|
536
|
+
* The ID of the feature this item configures.
|
|
537
|
+
*/
|
|
538
|
+
featureId: string;
|
|
539
|
+
/**
|
|
540
|
+
* The full feature object if expanded.
|
|
541
|
+
*/
|
|
542
|
+
feature?: PlanFeature | undefined;
|
|
543
|
+
/**
|
|
544
|
+
* Number of free units included. For consumable features, balance resets to this number each interval.
|
|
545
|
+
*/
|
|
546
|
+
included: number;
|
|
547
|
+
/**
|
|
548
|
+
* Whether the customer has unlimited access to this feature.
|
|
549
|
+
*/
|
|
550
|
+
unlimited: boolean;
|
|
551
|
+
/**
|
|
552
|
+
* Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.
|
|
553
|
+
*/
|
|
554
|
+
reset: PlanItemReset | null;
|
|
555
|
+
/**
|
|
556
|
+
* Pricing configuration for usage beyond included units. Null if feature is entirely free.
|
|
557
|
+
*/
|
|
558
|
+
price: PlanItemPrice | null;
|
|
559
|
+
/**
|
|
560
|
+
* Display text for showing this item in pricing pages.
|
|
561
|
+
*/
|
|
562
|
+
display?: PlanItemDisplay | undefined;
|
|
563
|
+
/**
|
|
564
|
+
* Rollover configuration for unused units. If set, unused included units roll over to the next period.
|
|
565
|
+
*/
|
|
566
|
+
rollover?: PlanItemRollover | undefined;
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
569
|
+
* Unit of time for the trial duration ('day', 'month', 'year').
|
|
570
|
+
*/
|
|
571
|
+
declare const PlanDurationType: {
|
|
572
|
+
readonly Day: "day";
|
|
573
|
+
readonly Month: "month";
|
|
574
|
+
readonly Year: "year";
|
|
575
|
+
};
|
|
576
|
+
/**
|
|
577
|
+
* Unit of time for the trial duration ('day', 'month', 'year').
|
|
578
|
+
*/
|
|
579
|
+
type PlanDurationType = OpenEnum<typeof PlanDurationType>;
|
|
580
|
+
declare const OnEnd: {
|
|
581
|
+
readonly Bill: "bill";
|
|
582
|
+
readonly Revert: "revert";
|
|
583
|
+
};
|
|
584
|
+
type OnEnd = OpenEnum<typeof OnEnd>;
|
|
585
|
+
/**
|
|
586
|
+
* Free trial configuration. If set, new customers can try this plan before being charged.
|
|
587
|
+
*/
|
|
588
|
+
type FreeTrial = {
|
|
589
|
+
/**
|
|
590
|
+
* Number of duration_type periods the trial lasts.
|
|
591
|
+
*/
|
|
592
|
+
durationLength: number;
|
|
593
|
+
/**
|
|
594
|
+
* Unit of time for the trial duration ('day', 'month', 'year').
|
|
595
|
+
*/
|
|
596
|
+
durationType: PlanDurationType;
|
|
597
|
+
/**
|
|
598
|
+
* Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
|
|
599
|
+
*/
|
|
600
|
+
cardRequired: boolean;
|
|
601
|
+
/**
|
|
602
|
+
* Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
|
|
603
|
+
*/
|
|
604
|
+
onEnd?: OnEnd | null | undefined;
|
|
605
|
+
};
|
|
606
|
+
/**
|
|
607
|
+
* Environment this plan belongs to ('sandbox' or 'live').
|
|
608
|
+
*/
|
|
609
|
+
declare const PlanEnv: {
|
|
610
|
+
readonly Sandbox: "sandbox";
|
|
611
|
+
readonly Live: "live";
|
|
612
|
+
};
|
|
613
|
+
/**
|
|
614
|
+
* Environment this plan belongs to ('sandbox' or 'live').
|
|
615
|
+
*/
|
|
616
|
+
type PlanEnv = OpenEnum<typeof PlanEnv>;
|
|
617
|
+
/**
|
|
618
|
+
* Billing interval (e.g. 'month', 'year').
|
|
619
|
+
*/
|
|
620
|
+
declare const PlanPriceVariantDetailsInterval: {
|
|
621
|
+
readonly OneOff: "one_off";
|
|
622
|
+
readonly Week: "week";
|
|
623
|
+
readonly Month: "month";
|
|
624
|
+
readonly Quarter: "quarter";
|
|
625
|
+
readonly SemiAnnual: "semi_annual";
|
|
626
|
+
readonly Year: "year";
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* Billing interval (e.g. 'month', 'year').
|
|
630
|
+
*/
|
|
631
|
+
type PlanPriceVariantDetailsInterval = OpenEnum<typeof PlanPriceVariantDetailsInterval>;
|
|
632
|
+
/**
|
|
633
|
+
* Base price configuration for a plan.
|
|
634
|
+
*/
|
|
635
|
+
type BasePrice = {
|
|
636
|
+
/**
|
|
637
|
+
* Base price amount for the plan.
|
|
638
|
+
*/
|
|
639
|
+
amount: number;
|
|
640
|
+
/**
|
|
641
|
+
* Billing interval (e.g. 'month', 'year').
|
|
642
|
+
*/
|
|
643
|
+
interval: PlanPriceVariantDetailsInterval;
|
|
644
|
+
/**
|
|
645
|
+
* Number of intervals per billing cycle. Defaults to 1.
|
|
646
|
+
*/
|
|
647
|
+
intervalCount?: number | undefined;
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.
|
|
651
|
+
*/
|
|
652
|
+
declare const PlanAddItemResetInterval: {
|
|
653
|
+
readonly OneOff: "one_off";
|
|
654
|
+
readonly Minute: "minute";
|
|
655
|
+
readonly Hour: "hour";
|
|
656
|
+
readonly Day: "day";
|
|
657
|
+
readonly Week: "week";
|
|
658
|
+
readonly Month: "month";
|
|
659
|
+
readonly Quarter: "quarter";
|
|
660
|
+
readonly SemiAnnual: "semi_annual";
|
|
661
|
+
readonly Year: "year";
|
|
662
|
+
};
|
|
663
|
+
/**
|
|
664
|
+
* Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.
|
|
665
|
+
*/
|
|
666
|
+
type PlanAddItemResetInterval = OpenEnum<typeof PlanAddItemResetInterval>;
|
|
667
|
+
/**
|
|
668
|
+
* Reset configuration for consumable features. Omit for non-consumable features like seats.
|
|
669
|
+
*/
|
|
670
|
+
type PlanVariantDetailsReset = {
|
|
671
|
+
/**
|
|
672
|
+
* Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.
|
|
673
|
+
*/
|
|
674
|
+
interval: PlanAddItemResetInterval;
|
|
675
|
+
/**
|
|
676
|
+
* Number of intervals between resets. Defaults to 1.
|
|
677
|
+
*/
|
|
678
|
+
intervalCount?: number | undefined;
|
|
679
|
+
};
|
|
680
|
+
type PlanVariantDetailsTier = {
|
|
681
|
+
to: number | string;
|
|
682
|
+
amount: number;
|
|
683
|
+
flatAmount?: number | undefined;
|
|
684
|
+
};
|
|
685
|
+
declare const PlanVariantDetailsTierBehavior: {
|
|
686
|
+
readonly Graduated: "graduated";
|
|
687
|
+
readonly Volume: "volume";
|
|
688
|
+
};
|
|
689
|
+
type PlanVariantDetailsTierBehavior = OpenEnum<typeof PlanVariantDetailsTierBehavior>;
|
|
690
|
+
/**
|
|
691
|
+
* Billing interval. For consumable features, should match reset.interval.
|
|
692
|
+
*/
|
|
693
|
+
declare const PlanAddItemPriceInterval: {
|
|
694
|
+
readonly OneOff: "one_off";
|
|
695
|
+
readonly Week: "week";
|
|
696
|
+
readonly Month: "month";
|
|
697
|
+
readonly Quarter: "quarter";
|
|
698
|
+
readonly SemiAnnual: "semi_annual";
|
|
699
|
+
readonly Year: "year";
|
|
700
|
+
};
|
|
701
|
+
/**
|
|
702
|
+
* Billing interval. For consumable features, should match reset.interval.
|
|
703
|
+
*/
|
|
704
|
+
type PlanAddItemPriceInterval = OpenEnum<typeof PlanAddItemPriceInterval>;
|
|
705
|
+
/**
|
|
706
|
+
* 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.
|
|
707
|
+
*/
|
|
708
|
+
declare const PlanAddItemBillingMethod: {
|
|
709
|
+
readonly Prepaid: "prepaid";
|
|
710
|
+
readonly UsageBased: "usage_based";
|
|
711
|
+
};
|
|
712
|
+
/**
|
|
713
|
+
* 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.
|
|
714
|
+
*/
|
|
715
|
+
type PlanAddItemBillingMethod = OpenEnum<typeof PlanAddItemBillingMethod>;
|
|
716
|
+
/**
|
|
717
|
+
* Pricing for usage beyond included units. Omit for free features.
|
|
718
|
+
*/
|
|
719
|
+
type PlanVariantDetailsPrice = {
|
|
720
|
+
/**
|
|
721
|
+
* Price per billing_units after included usage. Either 'amount' or 'tiers' is required.
|
|
722
|
+
*/
|
|
723
|
+
amount?: number | undefined;
|
|
724
|
+
/**
|
|
725
|
+
* Tiered pricing. Either 'amount' or 'tiers' is required.
|
|
726
|
+
*/
|
|
727
|
+
tiers?: Array<PlanVariantDetailsTier> | undefined;
|
|
728
|
+
tierBehavior?: PlanVariantDetailsTierBehavior | undefined;
|
|
729
|
+
/**
|
|
730
|
+
* Billing interval. For consumable features, should match reset.interval.
|
|
731
|
+
*/
|
|
732
|
+
interval: PlanAddItemPriceInterval;
|
|
733
|
+
/**
|
|
734
|
+
* Number of intervals per billing cycle. Defaults to 1.
|
|
735
|
+
*/
|
|
736
|
+
intervalCount: number;
|
|
737
|
+
/**
|
|
738
|
+
* Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).
|
|
739
|
+
*/
|
|
740
|
+
billingUnits: number;
|
|
741
|
+
/**
|
|
742
|
+
* 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.
|
|
743
|
+
*/
|
|
744
|
+
billingMethod: PlanAddItemBillingMethod;
|
|
745
|
+
/**
|
|
746
|
+
* Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. Null for no limit.
|
|
747
|
+
*/
|
|
748
|
+
maxPurchase?: number | null | undefined;
|
|
749
|
+
};
|
|
750
|
+
/**
|
|
751
|
+
* Billing behavior when quantity increases mid-cycle.
|
|
752
|
+
*/
|
|
753
|
+
declare const OnIncrease: {
|
|
754
|
+
readonly BillImmediately: "bill_immediately";
|
|
755
|
+
readonly ProrateImmediately: "prorate_immediately";
|
|
756
|
+
readonly ProrateNextCycle: "prorate_next_cycle";
|
|
757
|
+
readonly BillNextCycle: "bill_next_cycle";
|
|
758
|
+
};
|
|
759
|
+
/**
|
|
760
|
+
* Billing behavior when quantity increases mid-cycle.
|
|
761
|
+
*/
|
|
762
|
+
type OnIncrease = OpenEnum<typeof OnIncrease>;
|
|
763
|
+
/**
|
|
764
|
+
* Credit behavior when quantity decreases mid-cycle.
|
|
765
|
+
*/
|
|
766
|
+
declare const OnDecrease: {
|
|
767
|
+
readonly Prorate: "prorate";
|
|
768
|
+
readonly ProrateImmediately: "prorate_immediately";
|
|
769
|
+
readonly ProrateNextCycle: "prorate_next_cycle";
|
|
770
|
+
readonly None: "none";
|
|
771
|
+
readonly NoProrations: "no_prorations";
|
|
772
|
+
};
|
|
773
|
+
/**
|
|
774
|
+
* Credit behavior when quantity decreases mid-cycle.
|
|
775
|
+
*/
|
|
776
|
+
type OnDecrease = OpenEnum<typeof OnDecrease>;
|
|
777
|
+
/**
|
|
778
|
+
* Proration settings for prepaid features. Controls mid-cycle quantity change billing.
|
|
779
|
+
*/
|
|
780
|
+
type Proration = {
|
|
781
|
+
/**
|
|
782
|
+
* Billing behavior when quantity increases mid-cycle.
|
|
783
|
+
*/
|
|
784
|
+
onIncrease: OnIncrease;
|
|
785
|
+
/**
|
|
786
|
+
* Credit behavior when quantity decreases mid-cycle.
|
|
787
|
+
*/
|
|
788
|
+
onDecrease: OnDecrease;
|
|
789
|
+
};
|
|
790
|
+
/**
|
|
791
|
+
* When rolled over units expire.
|
|
792
|
+
*/
|
|
793
|
+
declare const VariantDetailsExpiryDurationType: {
|
|
794
|
+
readonly Month: "month";
|
|
795
|
+
readonly Forever: "forever";
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* When rolled over units expire.
|
|
799
|
+
*/
|
|
800
|
+
type VariantDetailsExpiryDurationType = OpenEnum<typeof VariantDetailsExpiryDurationType>;
|
|
801
|
+
/**
|
|
802
|
+
* Rollover config for unused units. If set, unused included units carry over.
|
|
803
|
+
*/
|
|
804
|
+
type PlanVariantDetailsRollover = {
|
|
805
|
+
/**
|
|
806
|
+
* Max rollover units. Omit for unlimited rollover.
|
|
807
|
+
*/
|
|
808
|
+
max?: number | undefined;
|
|
809
|
+
/**
|
|
810
|
+
* Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
|
|
811
|
+
*/
|
|
812
|
+
maxPercentage?: number | undefined;
|
|
813
|
+
/**
|
|
814
|
+
* When rolled over units expire.
|
|
815
|
+
*/
|
|
816
|
+
expiryDurationType: VariantDetailsExpiryDurationType;
|
|
817
|
+
/**
|
|
818
|
+
* Number of periods before expiry.
|
|
819
|
+
*/
|
|
820
|
+
expiryDurationLength?: number | undefined;
|
|
821
|
+
};
|
|
822
|
+
/**
|
|
823
|
+
* Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.
|
|
824
|
+
*/
|
|
825
|
+
type PlanItem = {
|
|
826
|
+
/**
|
|
827
|
+
* The ID of the feature to configure.
|
|
828
|
+
*/
|
|
829
|
+
featureId: string;
|
|
830
|
+
/**
|
|
831
|
+
* Number of free units included. Balance resets to this each interval for consumable features.
|
|
832
|
+
*/
|
|
833
|
+
included?: number | undefined;
|
|
834
|
+
/**
|
|
835
|
+
* If true, customer has unlimited access to this feature.
|
|
836
|
+
*/
|
|
837
|
+
unlimited?: boolean | undefined;
|
|
838
|
+
/**
|
|
839
|
+
* Reset configuration for consumable features. Omit for non-consumable features like seats.
|
|
840
|
+
*/
|
|
841
|
+
reset?: PlanVariantDetailsReset | undefined;
|
|
842
|
+
/**
|
|
843
|
+
* Pricing for usage beyond included units. Omit for free features.
|
|
844
|
+
*/
|
|
845
|
+
price?: PlanVariantDetailsPrice | undefined;
|
|
846
|
+
/**
|
|
847
|
+
* Proration settings for prepaid features. Controls mid-cycle quantity change billing.
|
|
848
|
+
*/
|
|
849
|
+
proration?: Proration | undefined;
|
|
850
|
+
/**
|
|
851
|
+
* Rollover config for unused units. If set, unused included units carry over.
|
|
852
|
+
*/
|
|
853
|
+
rollover?: PlanVariantDetailsRollover | undefined;
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* Match items with this billing method (prepaid or usage_based).
|
|
857
|
+
*/
|
|
858
|
+
declare const PlanRemoveItemBillingMethod: {
|
|
859
|
+
readonly Prepaid: "prepaid";
|
|
860
|
+
readonly UsageBased: "usage_based";
|
|
861
|
+
};
|
|
862
|
+
/**
|
|
863
|
+
* Match items with this billing method (prepaid or usage_based).
|
|
864
|
+
*/
|
|
865
|
+
type PlanRemoveItemBillingMethod = OpenEnum<typeof PlanRemoveItemBillingMethod>;
|
|
866
|
+
declare const PlanIntervalRemoveItemEnum2: {
|
|
867
|
+
readonly OneOff: "one_off";
|
|
868
|
+
readonly Minute: "minute";
|
|
869
|
+
readonly Hour: "hour";
|
|
870
|
+
readonly Day: "day";
|
|
871
|
+
readonly Week: "week";
|
|
872
|
+
readonly Month: "month";
|
|
873
|
+
readonly Quarter: "quarter";
|
|
874
|
+
readonly SemiAnnual: "semi_annual";
|
|
875
|
+
readonly Year: "year";
|
|
876
|
+
};
|
|
877
|
+
type PlanIntervalRemoveItemEnum2 = OpenEnum<typeof PlanIntervalRemoveItemEnum2>;
|
|
878
|
+
declare const PlanIntervalRemoveItemEnum1: {
|
|
879
|
+
readonly OneOff: "one_off";
|
|
880
|
+
readonly Week: "week";
|
|
881
|
+
readonly Month: "month";
|
|
882
|
+
readonly Quarter: "quarter";
|
|
883
|
+
readonly SemiAnnual: "semi_annual";
|
|
884
|
+
readonly Year: "year";
|
|
885
|
+
};
|
|
886
|
+
type PlanIntervalRemoveItemEnum1 = OpenEnum<typeof PlanIntervalRemoveItemEnum1>;
|
|
887
|
+
/**
|
|
888
|
+
* Filter for matching plan items. All provided fields must match (AND).
|
|
889
|
+
*/
|
|
890
|
+
type PlanItemFilter = {
|
|
891
|
+
/**
|
|
892
|
+
* Match items linked to this feature.
|
|
893
|
+
*/
|
|
894
|
+
featureId?: string | undefined;
|
|
895
|
+
/**
|
|
896
|
+
* Match items with this billing method (prepaid or usage_based).
|
|
897
|
+
*/
|
|
898
|
+
billingMethod?: PlanRemoveItemBillingMethod | undefined;
|
|
899
|
+
/**
|
|
900
|
+
* Match items with this interval. Accepts either a BillingInterval (price-side) or a ResetInterval (reset-side, includes day/hour/minute) so price-less items keyed by reset.interval can be disambiguated.
|
|
901
|
+
*/
|
|
902
|
+
interval?: PlanIntervalRemoveItemEnum1 | PlanIntervalRemoveItemEnum2 | undefined;
|
|
903
|
+
/**
|
|
904
|
+
* Match items with this interval_count. Disambiguates between items that share an interval but differ in count.
|
|
905
|
+
*/
|
|
906
|
+
intervalCount?: number | undefined;
|
|
907
|
+
};
|
|
908
|
+
/**
|
|
909
|
+
* Unit of time for the trial ('day', 'month', 'year').
|
|
910
|
+
*/
|
|
911
|
+
declare const PlanVariantDetailsDurationType: {
|
|
912
|
+
readonly Day: "day";
|
|
913
|
+
readonly Month: "month";
|
|
914
|
+
readonly Year: "year";
|
|
915
|
+
};
|
|
916
|
+
/**
|
|
917
|
+
* Unit of time for the trial ('day', 'month', 'year').
|
|
918
|
+
*/
|
|
919
|
+
type PlanVariantDetailsDurationType = OpenEnum<typeof PlanVariantDetailsDurationType>;
|
|
920
|
+
/**
|
|
921
|
+
* Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
|
|
922
|
+
*/
|
|
923
|
+
declare const VariantDetailsOnEnd: {
|
|
924
|
+
readonly Bill: "bill";
|
|
925
|
+
readonly Revert: "revert";
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
|
|
929
|
+
*/
|
|
930
|
+
type VariantDetailsOnEnd = OpenEnum<typeof VariantDetailsOnEnd>;
|
|
931
|
+
/**
|
|
932
|
+
* Free trial configuration for a plan.
|
|
933
|
+
*/
|
|
934
|
+
type FreeTrialParams = {
|
|
935
|
+
/**
|
|
936
|
+
* Number of duration_type periods the trial lasts.
|
|
937
|
+
*/
|
|
938
|
+
durationLength: number;
|
|
939
|
+
/**
|
|
940
|
+
* Unit of time for the trial ('day', 'month', 'year').
|
|
941
|
+
*/
|
|
942
|
+
durationType: PlanVariantDetailsDurationType;
|
|
943
|
+
/**
|
|
944
|
+
* If true, payment method required to start trial. Customer is charged after trial ends.
|
|
945
|
+
*/
|
|
946
|
+
cardRequired: boolean;
|
|
947
|
+
/**
|
|
948
|
+
* Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
|
|
949
|
+
*/
|
|
950
|
+
onEnd?: VariantDetailsOnEnd | undefined;
|
|
951
|
+
};
|
|
952
|
+
/**
|
|
953
|
+
* The time interval for the purchase limit window.
|
|
954
|
+
*/
|
|
955
|
+
declare const PlanVariantDetailsPurchaseLimitInterval: {
|
|
956
|
+
readonly Hour: "hour";
|
|
957
|
+
readonly Day: "day";
|
|
958
|
+
readonly Week: "week";
|
|
959
|
+
readonly Month: "month";
|
|
960
|
+
};
|
|
961
|
+
/**
|
|
962
|
+
* The time interval for the purchase limit window.
|
|
963
|
+
*/
|
|
964
|
+
type PlanVariantDetailsPurchaseLimitInterval = OpenEnum<typeof PlanVariantDetailsPurchaseLimitInterval>;
|
|
965
|
+
/**
|
|
966
|
+
* Optional rate limit to cap how often auto top-ups occur.
|
|
967
|
+
*/
|
|
968
|
+
type PlanVariantDetailsPurchaseLimit = {
|
|
969
|
+
/**
|
|
970
|
+
* The time interval for the purchase limit window.
|
|
971
|
+
*/
|
|
972
|
+
interval: PlanVariantDetailsPurchaseLimitInterval;
|
|
973
|
+
/**
|
|
974
|
+
* Number of intervals in the purchase limit window.
|
|
975
|
+
*/
|
|
976
|
+
intervalCount: number;
|
|
977
|
+
/**
|
|
978
|
+
* Maximum number of auto top-ups allowed within the interval.
|
|
979
|
+
*/
|
|
980
|
+
limit: number;
|
|
981
|
+
};
|
|
982
|
+
type PlanVariantDetailsAutoTopup = {
|
|
983
|
+
/**
|
|
984
|
+
* The ID of the feature (credit balance) to auto top-up.
|
|
985
|
+
*/
|
|
986
|
+
featureId: string;
|
|
987
|
+
/**
|
|
988
|
+
* Whether auto top-up is enabled.
|
|
989
|
+
*/
|
|
990
|
+
enabled: boolean;
|
|
991
|
+
/**
|
|
992
|
+
* When the balance drops below this threshold, an auto top-up will be purchased.
|
|
993
|
+
*/
|
|
994
|
+
threshold: number;
|
|
995
|
+
/**
|
|
996
|
+
* Amount of credits to add per auto top-up.
|
|
997
|
+
*/
|
|
998
|
+
quantity: number;
|
|
999
|
+
/**
|
|
1000
|
+
* Optional rate limit to cap how often auto top-ups occur.
|
|
1001
|
+
*/
|
|
1002
|
+
purchaseLimit?: PlanVariantDetailsPurchaseLimit | undefined;
|
|
1003
|
+
/**
|
|
1004
|
+
* When true, auto top-up creates a send_invoice invoice instead of auto-charging.
|
|
1005
|
+
*/
|
|
1006
|
+
invoiceMode?: boolean | undefined;
|
|
1007
|
+
};
|
|
1008
|
+
/**
|
|
1009
|
+
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
|
|
1010
|
+
*/
|
|
1011
|
+
declare const PlanVariantDetailsLimitType: {
|
|
1012
|
+
readonly Absolute: "absolute";
|
|
1013
|
+
readonly UsagePercentage: "usage_percentage";
|
|
1014
|
+
};
|
|
1015
|
+
/**
|
|
1016
|
+
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
|
|
1017
|
+
*/
|
|
1018
|
+
type PlanVariantDetailsLimitType = OpenEnum<typeof PlanVariantDetailsLimitType>;
|
|
1019
|
+
type PlanVariantDetailsSpendLimit = {
|
|
1020
|
+
/**
|
|
1021
|
+
* Optional feature ID this spend limit applies to.
|
|
1022
|
+
*/
|
|
1023
|
+
featureId?: string | undefined;
|
|
1024
|
+
/**
|
|
1025
|
+
* Whether the overage spend limit is enabled.
|
|
1026
|
+
*/
|
|
1027
|
+
enabled: boolean;
|
|
1028
|
+
/**
|
|
1029
|
+
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
|
|
1030
|
+
*/
|
|
1031
|
+
limitType?: PlanVariantDetailsLimitType | undefined;
|
|
1032
|
+
/**
|
|
1033
|
+
* Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
|
|
1034
|
+
*/
|
|
1035
|
+
overageLimit?: number | undefined;
|
|
1036
|
+
};
|
|
1037
|
+
/**
|
|
1038
|
+
* Interval for the cap, aligned to the customer's billing cycle.
|
|
1039
|
+
*/
|
|
1040
|
+
declare const PlanVariantDetailsUsageLimitInterval: {
|
|
1041
|
+
readonly Day: "day";
|
|
1042
|
+
readonly Week: "week";
|
|
1043
|
+
readonly Month: "month";
|
|
1044
|
+
readonly Year: "year";
|
|
1045
|
+
};
|
|
1046
|
+
/**
|
|
1047
|
+
* Interval for the cap, aligned to the customer's billing cycle.
|
|
1048
|
+
*/
|
|
1049
|
+
type PlanVariantDetailsUsageLimitInterval = OpenEnum<typeof PlanVariantDetailsUsageLimitInterval>;
|
|
1050
|
+
type PlanVariantDetailsUsageLimit = {
|
|
1051
|
+
/**
|
|
1052
|
+
* The feature this usage limit applies to.
|
|
1053
|
+
*/
|
|
1054
|
+
featureId: string;
|
|
1055
|
+
/**
|
|
1056
|
+
* Whether this usage limit is enabled.
|
|
1057
|
+
*/
|
|
1058
|
+
enabled: boolean;
|
|
1059
|
+
/**
|
|
1060
|
+
* Maximum units allowed per interval.
|
|
1061
|
+
*/
|
|
1062
|
+
limit: number;
|
|
1063
|
+
/**
|
|
1064
|
+
* Interval for the cap, aligned to the customer's billing cycle.
|
|
1065
|
+
*/
|
|
1066
|
+
interval: PlanVariantDetailsUsageLimitInterval;
|
|
1067
|
+
};
|
|
1068
|
+
/**
|
|
1069
|
+
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
|
|
1070
|
+
*/
|
|
1071
|
+
declare const PlanVariantDetailsThresholdType: {
|
|
1072
|
+
readonly Usage: "usage";
|
|
1073
|
+
readonly UsagePercentage: "usage_percentage";
|
|
1074
|
+
readonly Remaining: "remaining";
|
|
1075
|
+
readonly RemainingPercentage: "remaining_percentage";
|
|
1076
|
+
};
|
|
1077
|
+
/**
|
|
1078
|
+
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
|
|
1079
|
+
*/
|
|
1080
|
+
type PlanVariantDetailsThresholdType = OpenEnum<typeof PlanVariantDetailsThresholdType>;
|
|
1081
|
+
type PlanVariantDetailsUsageAlert = {
|
|
1082
|
+
/**
|
|
1083
|
+
* The feature ID this alert applies to.
|
|
1084
|
+
*/
|
|
1085
|
+
featureId?: string | undefined;
|
|
1086
|
+
/**
|
|
1087
|
+
* Whether this usage alert is enabled.
|
|
1088
|
+
*/
|
|
1089
|
+
enabled: boolean;
|
|
1090
|
+
/**
|
|
1091
|
+
* The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
|
|
1092
|
+
*/
|
|
1093
|
+
threshold: number;
|
|
1094
|
+
/**
|
|
1095
|
+
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
|
|
1096
|
+
*/
|
|
1097
|
+
thresholdType: PlanVariantDetailsThresholdType;
|
|
1098
|
+
/**
|
|
1099
|
+
* Optional user-defined label to distinguish multiple alerts on the same feature.
|
|
1100
|
+
*/
|
|
1101
|
+
name?: string | undefined;
|
|
1102
|
+
};
|
|
1103
|
+
type PlanVariantDetailsOverageAllowed = {
|
|
1104
|
+
/**
|
|
1105
|
+
* The feature ID this overage allowed control applies to.
|
|
1106
|
+
*/
|
|
1107
|
+
featureId: string;
|
|
1108
|
+
/**
|
|
1109
|
+
* Whether overage is allowed for this feature.
|
|
1110
|
+
*/
|
|
1111
|
+
enabled: boolean;
|
|
1112
|
+
};
|
|
1113
|
+
/**
|
|
1114
|
+
* Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
|
|
1115
|
+
*/
|
|
1116
|
+
type PlanVariantDetailsBillingControls = {
|
|
1117
|
+
/**
|
|
1118
|
+
* List of auto top-up configurations per feature.
|
|
1119
|
+
*/
|
|
1120
|
+
autoTopups?: Array<PlanVariantDetailsAutoTopup> | undefined;
|
|
1121
|
+
/**
|
|
1122
|
+
* List of overage spend limits per feature (caps overage spend).
|
|
1123
|
+
*/
|
|
1124
|
+
spendLimits?: Array<PlanVariantDetailsSpendLimit> | undefined;
|
|
1125
|
+
/**
|
|
1126
|
+
* List of hard usage caps per feature (max units per interval).
|
|
1127
|
+
*/
|
|
1128
|
+
usageLimits?: Array<PlanVariantDetailsUsageLimit> | undefined;
|
|
1129
|
+
/**
|
|
1130
|
+
* List of usage alert configurations per feature.
|
|
1131
|
+
*/
|
|
1132
|
+
usageAlerts?: Array<PlanVariantDetailsUsageAlert> | undefined;
|
|
1133
|
+
/**
|
|
1134
|
+
* List of overage allowed controls per feature. When enabled, usage can exceed balance.
|
|
1135
|
+
*/
|
|
1136
|
+
overageAllowed?: Array<PlanVariantDetailsOverageAllowed> | undefined;
|
|
1137
|
+
};
|
|
1138
|
+
/**
|
|
1139
|
+
* The customization that transforms the base plan into this variant.
|
|
1140
|
+
*/
|
|
1141
|
+
type Customize = {
|
|
1142
|
+
/**
|
|
1143
|
+
* Override the base price of the plan. Pass null to remove the base price.
|
|
1144
|
+
*/
|
|
1145
|
+
price?: BasePrice | null | undefined;
|
|
1146
|
+
/**
|
|
1147
|
+
* Items to add to the plan.
|
|
1148
|
+
*/
|
|
1149
|
+
addItems?: Array<PlanItem> | undefined;
|
|
1150
|
+
/**
|
|
1151
|
+
* Filters selecting items to remove from the plan.
|
|
1152
|
+
*/
|
|
1153
|
+
removeItems?: Array<PlanItemFilter> | undefined;
|
|
1154
|
+
/**
|
|
1155
|
+
* Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.
|
|
1156
|
+
*/
|
|
1157
|
+
freeTrial?: FreeTrialParams | null | undefined;
|
|
1158
|
+
/**
|
|
1159
|
+
* Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
|
|
1160
|
+
*/
|
|
1161
|
+
billingControls?: PlanVariantDetailsBillingControls | undefined;
|
|
1162
|
+
};
|
|
1163
|
+
/**
|
|
1164
|
+
* Details about how this variant relates to its latest base plan.
|
|
1165
|
+
*/
|
|
1166
|
+
type VariantDetails = {
|
|
1167
|
+
/**
|
|
1168
|
+
* The ID of the base plan this variant was derived from.
|
|
1169
|
+
*/
|
|
1170
|
+
basePlanId: string;
|
|
1171
|
+
/**
|
|
1172
|
+
* The customization that transforms the base plan into this variant.
|
|
1173
|
+
*/
|
|
1174
|
+
customize?: Customize | undefined;
|
|
1175
|
+
};
|
|
1176
|
+
/**
|
|
1177
|
+
* Miscellaneous plan-level configuration flags.
|
|
1178
|
+
*/
|
|
1179
|
+
type PlanConfig = {
|
|
1180
|
+
/**
|
|
1181
|
+
* If true, entitlements attached to this plan will still reset on schedule even when the customer's product is in a past_due state.
|
|
1182
|
+
*/
|
|
1183
|
+
ignorePastDue: boolean;
|
|
1184
|
+
};
|
|
1185
|
+
/**
|
|
1186
|
+
* The time interval for the purchase limit window.
|
|
1187
|
+
*/
|
|
1188
|
+
declare const PlanPurchaseLimitInterval: {
|
|
1189
|
+
readonly Hour: "hour";
|
|
1190
|
+
readonly Day: "day";
|
|
1191
|
+
readonly Week: "week";
|
|
1192
|
+
readonly Month: "month";
|
|
1193
|
+
};
|
|
1194
|
+
/**
|
|
1195
|
+
* The time interval for the purchase limit window.
|
|
1196
|
+
*/
|
|
1197
|
+
type PlanPurchaseLimitInterval = OpenEnum<typeof PlanPurchaseLimitInterval>;
|
|
1198
|
+
/**
|
|
1199
|
+
* Optional rate limit to cap how often auto top-ups occur.
|
|
1200
|
+
*/
|
|
1201
|
+
type PlanPurchaseLimit = {
|
|
1202
|
+
/**
|
|
1203
|
+
* The time interval for the purchase limit window.
|
|
1204
|
+
*/
|
|
1205
|
+
interval: PlanPurchaseLimitInterval;
|
|
1206
|
+
/**
|
|
1207
|
+
* Number of intervals in the purchase limit window.
|
|
1208
|
+
*/
|
|
1209
|
+
intervalCount: number;
|
|
1210
|
+
/**
|
|
1211
|
+
* Maximum number of auto top-ups allowed within the interval.
|
|
1212
|
+
*/
|
|
1213
|
+
limit: number;
|
|
1214
|
+
};
|
|
1215
|
+
type PlanAutoTopup = {
|
|
1216
|
+
/**
|
|
1217
|
+
* The ID of the feature (credit balance) to auto top-up.
|
|
1218
|
+
*/
|
|
1219
|
+
featureId: string;
|
|
1220
|
+
/**
|
|
1221
|
+
* Whether auto top-up is enabled.
|
|
1222
|
+
*/
|
|
1223
|
+
enabled: boolean;
|
|
1224
|
+
/**
|
|
1225
|
+
* When the balance drops below this threshold, an auto top-up will be purchased.
|
|
1226
|
+
*/
|
|
1227
|
+
threshold: number;
|
|
1228
|
+
/**
|
|
1229
|
+
* Amount of credits to add per auto top-up.
|
|
1230
|
+
*/
|
|
1231
|
+
quantity: number;
|
|
1232
|
+
/**
|
|
1233
|
+
* Optional rate limit to cap how often auto top-ups occur.
|
|
1234
|
+
*/
|
|
1235
|
+
purchaseLimit?: PlanPurchaseLimit | undefined;
|
|
1236
|
+
/**
|
|
1237
|
+
* When true, auto top-up creates a send_invoice invoice instead of auto-charging.
|
|
1238
|
+
*/
|
|
1239
|
+
invoiceMode?: boolean | undefined;
|
|
1240
|
+
};
|
|
1241
|
+
/**
|
|
1242
|
+
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
|
|
1243
|
+
*/
|
|
1244
|
+
declare const PlanLimitType: {
|
|
1245
|
+
readonly Absolute: "absolute";
|
|
1246
|
+
readonly UsagePercentage: "usage_percentage";
|
|
1247
|
+
};
|
|
1248
|
+
/**
|
|
1249
|
+
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
|
|
1250
|
+
*/
|
|
1251
|
+
type PlanLimitType = OpenEnum<typeof PlanLimitType>;
|
|
1252
|
+
type PlanSpendLimit = {
|
|
1253
|
+
/**
|
|
1254
|
+
* Optional feature ID this spend limit applies to.
|
|
1255
|
+
*/
|
|
1256
|
+
featureId?: string | undefined;
|
|
1257
|
+
/**
|
|
1258
|
+
* Whether the overage spend limit is enabled.
|
|
1259
|
+
*/
|
|
1260
|
+
enabled: boolean;
|
|
1261
|
+
/**
|
|
1262
|
+
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
|
|
1263
|
+
*/
|
|
1264
|
+
limitType?: PlanLimitType | undefined;
|
|
1265
|
+
/**
|
|
1266
|
+
* Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
|
|
1267
|
+
*/
|
|
1268
|
+
overageLimit?: number | undefined;
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* Interval for the cap, aligned to the customer's billing cycle.
|
|
1272
|
+
*/
|
|
1273
|
+
declare const PlanUsageLimitInterval: {
|
|
1274
|
+
readonly Day: "day";
|
|
1275
|
+
readonly Week: "week";
|
|
1276
|
+
readonly Month: "month";
|
|
1277
|
+
readonly Year: "year";
|
|
1278
|
+
};
|
|
1279
|
+
/**
|
|
1280
|
+
* Interval for the cap, aligned to the customer's billing cycle.
|
|
1281
|
+
*/
|
|
1282
|
+
type PlanUsageLimitInterval = OpenEnum<typeof PlanUsageLimitInterval>;
|
|
1283
|
+
type PlanUsageLimit = {
|
|
1284
|
+
/**
|
|
1285
|
+
* The feature this usage limit applies to.
|
|
1286
|
+
*/
|
|
1287
|
+
featureId: string;
|
|
1288
|
+
/**
|
|
1289
|
+
* Whether this usage limit is enabled.
|
|
1290
|
+
*/
|
|
1291
|
+
enabled: boolean;
|
|
1292
|
+
/**
|
|
1293
|
+
* Maximum units allowed per interval.
|
|
1294
|
+
*/
|
|
1295
|
+
limit: number;
|
|
1296
|
+
/**
|
|
1297
|
+
* Interval for the cap, aligned to the customer's billing cycle.
|
|
1298
|
+
*/
|
|
1299
|
+
interval: PlanUsageLimitInterval;
|
|
1300
|
+
};
|
|
1301
|
+
/**
|
|
1302
|
+
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
|
|
1303
|
+
*/
|
|
1304
|
+
declare const PlanThresholdType: {
|
|
1305
|
+
readonly Usage: "usage";
|
|
1306
|
+
readonly UsagePercentage: "usage_percentage";
|
|
1307
|
+
readonly Remaining: "remaining";
|
|
1308
|
+
readonly RemainingPercentage: "remaining_percentage";
|
|
1309
|
+
};
|
|
1310
|
+
/**
|
|
1311
|
+
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
|
|
1312
|
+
*/
|
|
1313
|
+
type PlanThresholdType = OpenEnum<typeof PlanThresholdType>;
|
|
1314
|
+
type PlanUsageAlert = {
|
|
1315
|
+
/**
|
|
1316
|
+
* The feature ID this alert applies to.
|
|
1317
|
+
*/
|
|
1318
|
+
featureId?: string | undefined;
|
|
1319
|
+
/**
|
|
1320
|
+
* Whether this usage alert is enabled.
|
|
1321
|
+
*/
|
|
1322
|
+
enabled: boolean;
|
|
1323
|
+
/**
|
|
1324
|
+
* The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
|
|
1325
|
+
*/
|
|
1326
|
+
threshold: number;
|
|
1327
|
+
/**
|
|
1328
|
+
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
|
|
1329
|
+
*/
|
|
1330
|
+
thresholdType: PlanThresholdType;
|
|
1331
|
+
/**
|
|
1332
|
+
* Optional user-defined label to distinguish multiple alerts on the same feature.
|
|
1333
|
+
*/
|
|
1334
|
+
name?: string | undefined;
|
|
1335
|
+
};
|
|
1336
|
+
type PlanOverageAllowed = {
|
|
1337
|
+
/**
|
|
1338
|
+
* The feature ID this overage allowed control applies to.
|
|
1339
|
+
*/
|
|
1340
|
+
featureId: string;
|
|
1341
|
+
/**
|
|
1342
|
+
* Whether overage is allowed for this feature.
|
|
1343
|
+
*/
|
|
1344
|
+
enabled: boolean;
|
|
1345
|
+
};
|
|
1346
|
+
/**
|
|
1347
|
+
* Plan-level billing controls used as customer defaults.
|
|
1348
|
+
*/
|
|
1349
|
+
type PlanBillingControls = {
|
|
1350
|
+
/**
|
|
1351
|
+
* List of auto top-up configurations per feature.
|
|
1352
|
+
*/
|
|
1353
|
+
autoTopups?: Array<PlanAutoTopup> | undefined;
|
|
1354
|
+
/**
|
|
1355
|
+
* List of overage spend limits per feature (caps overage spend).
|
|
1356
|
+
*/
|
|
1357
|
+
spendLimits?: Array<PlanSpendLimit> | undefined;
|
|
1358
|
+
/**
|
|
1359
|
+
* List of hard usage caps per feature (max units per interval).
|
|
1360
|
+
*/
|
|
1361
|
+
usageLimits?: Array<PlanUsageLimit> | undefined;
|
|
1362
|
+
/**
|
|
1363
|
+
* List of usage alert configurations per feature.
|
|
1364
|
+
*/
|
|
1365
|
+
usageAlerts?: Array<PlanUsageAlert> | undefined;
|
|
1366
|
+
/**
|
|
1367
|
+
* List of overage allowed controls per feature. When enabled, usage can exceed balance.
|
|
1368
|
+
*/
|
|
1369
|
+
overageAllowed?: Array<PlanOverageAllowed> | undefined;
|
|
1370
|
+
};
|
|
1371
|
+
/**
|
|
1372
|
+
* The customer's current status with this plan. 'active' if attached, 'scheduled' if pending activation.
|
|
1373
|
+
*/
|
|
1374
|
+
declare const PlanStatus: {
|
|
1375
|
+
readonly Active: "active";
|
|
1376
|
+
readonly Scheduled: "scheduled";
|
|
1377
|
+
};
|
|
1378
|
+
/**
|
|
1379
|
+
* The customer's current status with this plan. 'active' if attached, 'scheduled' if pending activation.
|
|
1380
|
+
*/
|
|
1381
|
+
type PlanStatus = OpenEnum<typeof PlanStatus>;
|
|
1382
|
+
/**
|
|
1383
|
+
* The action that would occur if this plan were attached to the customer.
|
|
1384
|
+
*/
|
|
1385
|
+
declare const AttachAction: {
|
|
1386
|
+
readonly Activate: "activate";
|
|
1387
|
+
readonly Upgrade: "upgrade";
|
|
1388
|
+
readonly Downgrade: "downgrade";
|
|
1389
|
+
readonly None: "none";
|
|
1390
|
+
readonly Purchase: "purchase";
|
|
1391
|
+
};
|
|
1392
|
+
/**
|
|
1393
|
+
* The action that would occur if this plan were attached to the customer.
|
|
1394
|
+
*/
|
|
1395
|
+
type AttachAction = OpenEnum<typeof AttachAction>;
|
|
1396
|
+
type CustomerEligibility = {
|
|
1397
|
+
/**
|
|
1398
|
+
* Whether the trial on this plan is available to this customer. For example, if the customer used the trial in the past, this will be false.
|
|
1399
|
+
*/
|
|
1400
|
+
trialAvailable?: boolean | undefined;
|
|
1401
|
+
/**
|
|
1402
|
+
* The customer's current status with this plan. 'active' if attached, 'scheduled' if pending activation.
|
|
1403
|
+
*/
|
|
1404
|
+
status?: PlanStatus | undefined;
|
|
1405
|
+
/**
|
|
1406
|
+
* Whether the customer's active instance of this plan is set to cancel.
|
|
1407
|
+
*/
|
|
1408
|
+
canceling?: boolean | undefined;
|
|
1409
|
+
/**
|
|
1410
|
+
* Whether the customer is currently on a free trial of this plan.
|
|
1411
|
+
*/
|
|
1412
|
+
trialing?: boolean | undefined;
|
|
1413
|
+
/**
|
|
1414
|
+
* The action that would occur if this plan were attached to the customer.
|
|
1415
|
+
*/
|
|
1416
|
+
attachAction: AttachAction;
|
|
1417
|
+
};
|
|
1418
|
+
type Plan = {
|
|
1419
|
+
/**
|
|
1420
|
+
* Unique identifier for the plan.
|
|
1421
|
+
*/
|
|
1422
|
+
id: string;
|
|
1423
|
+
/**
|
|
1424
|
+
* Display name of the plan.
|
|
1425
|
+
*/
|
|
1426
|
+
name: string;
|
|
1427
|
+
/**
|
|
1428
|
+
* Optional description of the plan.
|
|
1429
|
+
*/
|
|
1430
|
+
description: string | null;
|
|
1431
|
+
/**
|
|
1432
|
+
* Group identifier for organizing related plans. Plans in the same group are mutually exclusive.
|
|
1433
|
+
*/
|
|
1434
|
+
group: string | null;
|
|
1435
|
+
/**
|
|
1436
|
+
* Version number of the plan. Incremented when plan configuration changes.
|
|
1437
|
+
*/
|
|
1438
|
+
version: number;
|
|
1439
|
+
/**
|
|
1440
|
+
* Whether this is an add-on plan that can be attached alongside a main plan.
|
|
1441
|
+
*/
|
|
1442
|
+
addOn: boolean;
|
|
1443
|
+
/**
|
|
1444
|
+
* If true, this plan is automatically attached when a customer is created. Used for free plans.
|
|
1445
|
+
*/
|
|
1446
|
+
autoEnable: boolean;
|
|
1447
|
+
/**
|
|
1448
|
+
* Base recurring price for the plan. Null for free plans or usage-only plans.
|
|
1449
|
+
*/
|
|
1450
|
+
price: PlanPrice | null;
|
|
1451
|
+
/**
|
|
1452
|
+
* Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.
|
|
1453
|
+
*/
|
|
1454
|
+
items: Array<Item>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Free trial configuration. If set, new customers can try this plan before being charged.
|
|
1457
|
+
*/
|
|
1458
|
+
freeTrial?: FreeTrial | undefined;
|
|
1459
|
+
/**
|
|
1460
|
+
* Unix timestamp (ms) when the plan was created.
|
|
1461
|
+
*/
|
|
1462
|
+
createdAt: number;
|
|
1463
|
+
/**
|
|
1464
|
+
* Environment this plan belongs to ('sandbox' or 'live').
|
|
1465
|
+
*/
|
|
1466
|
+
env: PlanEnv;
|
|
1467
|
+
/**
|
|
1468
|
+
* Whether the plan is archived. Archived plans cannot be attached to new customers.
|
|
1469
|
+
*/
|
|
1470
|
+
archived: boolean;
|
|
1471
|
+
/**
|
|
1472
|
+
* Deprecated. Use variant_details.base_plan_id instead. If this is a variant, the ID of the base plan it was created from.
|
|
1473
|
+
*/
|
|
1474
|
+
baseVariantId: string | null;
|
|
1475
|
+
/**
|
|
1476
|
+
* Details about how this variant relates to its latest base plan.
|
|
1477
|
+
*/
|
|
1478
|
+
variantDetails?: VariantDetails | undefined;
|
|
1479
|
+
/**
|
|
1480
|
+
* Miscellaneous plan-level configuration flags.
|
|
1481
|
+
*/
|
|
1482
|
+
config: PlanConfig;
|
|
1483
|
+
/**
|
|
1484
|
+
* Plan-level billing controls used as customer defaults.
|
|
1485
|
+
*/
|
|
1486
|
+
billingControls?: PlanBillingControls | undefined;
|
|
1487
|
+
/**
|
|
1488
|
+
* Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
|
|
1489
|
+
*/
|
|
1490
|
+
metadata: {
|
|
1491
|
+
[k: string]: any;
|
|
1492
|
+
};
|
|
1493
|
+
customerEligibility?: CustomerEligibility | undefined;
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
export type { BalanceFeature as B, ClosedEnum as C, OpenEnum as O, Plan as P, Balance as a };
|