@metrifox/angular-sdk 1.0.0
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/LICENSE +21 -0
- package/README.md +487 -0
- package/fesm2022/index.mjs +5898 -0
- package/index.d.ts +5 -0
- package/lib/components/customer-portal/customer-portal.component.d.ts +193 -0
- package/lib/components/pricing-table/pricing-table.component.d.ts +157 -0
- package/lib/metrifox.module.d.ts +52 -0
- package/lib/metrifox.service.d.ts +190 -0
- package/lib/types/enum.d.ts +156 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/interface.d.ts +739 -0
- package/package.json +51 -0
- package/public-api.d.ts +20 -0
- package/styles.css +3 -0
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
import { Type } from '@angular/core';
|
|
2
|
+
import { FeatureType, FeatureStatus, SubscriptionStatus, InvoiceStatusType, PriceTypes, ResetIntervals, EnforcementType, AggregationMethods, BillingTimingTypes, FeatureModel, OneOffType, PoolType } from './enum';
|
|
3
|
+
/**
|
|
4
|
+
* Main theme configuration
|
|
5
|
+
*/
|
|
6
|
+
export interface Theme {
|
|
7
|
+
pricingTable?: PricingTableTheme;
|
|
8
|
+
customerPortal?: CustomerPortalTheme;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Customer Portal theme configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface CustomerPortalTheme {
|
|
14
|
+
tabs?: {
|
|
15
|
+
background?: string;
|
|
16
|
+
borderColor?: string;
|
|
17
|
+
activeBackground?: string;
|
|
18
|
+
activeTextColor?: string;
|
|
19
|
+
inactiveTextColor?: string;
|
|
20
|
+
};
|
|
21
|
+
section?: {
|
|
22
|
+
background?: string;
|
|
23
|
+
titleTextColor?: string;
|
|
24
|
+
contentBackground?: string;
|
|
25
|
+
iconBackground?: string;
|
|
26
|
+
iconColor?: string;
|
|
27
|
+
emptyTextColor?: string;
|
|
28
|
+
};
|
|
29
|
+
card?: {
|
|
30
|
+
titleBackground?: string;
|
|
31
|
+
contentBackground?: string;
|
|
32
|
+
titleColor?: string;
|
|
33
|
+
details?: {
|
|
34
|
+
labelColor?: string;
|
|
35
|
+
valueColor?: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
subscription?: {
|
|
39
|
+
items?: {
|
|
40
|
+
background?: string;
|
|
41
|
+
borderColor?: string;
|
|
42
|
+
textColor?: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
table?: {
|
|
46
|
+
headerTextColor?: string;
|
|
47
|
+
textColor?: string;
|
|
48
|
+
};
|
|
49
|
+
button?: {
|
|
50
|
+
background?: string;
|
|
51
|
+
textColor?: string;
|
|
52
|
+
};
|
|
53
|
+
filter?: {
|
|
54
|
+
border?: string;
|
|
55
|
+
activeBackground?: string;
|
|
56
|
+
inactiveBackground?: string;
|
|
57
|
+
activeTextColor?: string;
|
|
58
|
+
inactiveTextColor?: string;
|
|
59
|
+
countBackground?: string;
|
|
60
|
+
countTextColor?: string;
|
|
61
|
+
};
|
|
62
|
+
linkColor?: string;
|
|
63
|
+
plan?: PricingTableTheme;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Pricing Table theme configuration
|
|
67
|
+
*/
|
|
68
|
+
export interface PricingTableTheme {
|
|
69
|
+
card?: CardTheme;
|
|
70
|
+
button?: ButtonTheme;
|
|
71
|
+
featureList?: FeatureListTheme;
|
|
72
|
+
tabs?: TabsTheme;
|
|
73
|
+
intervalToggle?: IntervalToggleTheme;
|
|
74
|
+
currentSubscriptionCard?: CurrentSubscriptionCardTheme;
|
|
75
|
+
freeTrialTag?: FreeTrialTheme;
|
|
76
|
+
checkoutBar?: CheckoutBarTheme;
|
|
77
|
+
}
|
|
78
|
+
export interface CardTheme {
|
|
79
|
+
background?: string;
|
|
80
|
+
borderColor?: string;
|
|
81
|
+
descriptionColor?: string;
|
|
82
|
+
header?: CardHeaderTheme;
|
|
83
|
+
description?: CardDescriptionTheme;
|
|
84
|
+
price?: CardPriceTheme;
|
|
85
|
+
}
|
|
86
|
+
export interface CardHeaderTheme {
|
|
87
|
+
background?: string;
|
|
88
|
+
textColor?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface CardDescriptionTheme {
|
|
91
|
+
textColor?: string;
|
|
92
|
+
textButtonColor?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface CardPriceTheme {
|
|
95
|
+
amountColor?: string;
|
|
96
|
+
primaryTextColor?: string;
|
|
97
|
+
secondaryTextColor?: string;
|
|
98
|
+
textButtonColor?: string;
|
|
99
|
+
background?: string;
|
|
100
|
+
borderColor?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface ButtonTheme {
|
|
103
|
+
background?: string;
|
|
104
|
+
textColor?: string;
|
|
105
|
+
secondaryBackground?: string;
|
|
106
|
+
secondaryTextColor?: string;
|
|
107
|
+
textButtonColor?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface FeatureListTheme {
|
|
110
|
+
textColor?: string;
|
|
111
|
+
iconColor?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface TabsTheme {
|
|
114
|
+
inactiveText?: string;
|
|
115
|
+
activeText?: string;
|
|
116
|
+
indicator?: string;
|
|
117
|
+
borderColor?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface IntervalToggleTheme {
|
|
120
|
+
background?: string;
|
|
121
|
+
activeBackground?: string;
|
|
122
|
+
activeText?: string;
|
|
123
|
+
inactiveText?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface CurrentSubscriptionCardTheme {
|
|
126
|
+
header?: CardHeaderTheme;
|
|
127
|
+
gradientColor?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface FreeTrialTheme {
|
|
130
|
+
background?: string;
|
|
131
|
+
textColor?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface CheckoutBarTheme {
|
|
134
|
+
background?: string;
|
|
135
|
+
borderColor?: string;
|
|
136
|
+
textColor?: string;
|
|
137
|
+
buttonBackground?: string;
|
|
138
|
+
buttonTextColor?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Metrifox SDK initialization configuration
|
|
142
|
+
*/
|
|
143
|
+
export interface MetrifoxConfig {
|
|
144
|
+
/** Client API key */
|
|
145
|
+
clientKey: string;
|
|
146
|
+
/** Optional base URL for API calls */
|
|
147
|
+
baseUrl?: string;
|
|
148
|
+
/** Optional web app URL for checkout redirects */
|
|
149
|
+
webAppUrl?: string;
|
|
150
|
+
/** Theme configuration */
|
|
151
|
+
theme?: Theme;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Section key types for Customer Portal
|
|
155
|
+
*/
|
|
156
|
+
export type SectionKey = 'upcomingInvoice' | 'subscription' | 'creditBalance' | 'entitlementUsage' | 'paymentOverview' | 'billingHistory' | 'plan';
|
|
157
|
+
/**
|
|
158
|
+
* Customer Portal component props
|
|
159
|
+
*/
|
|
160
|
+
export interface CustomerPortalProps {
|
|
161
|
+
customerKey: string;
|
|
162
|
+
sectionsConfig?: SectionConfig[];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Section configuration for Customer Portal
|
|
166
|
+
*/
|
|
167
|
+
export interface SectionConfig {
|
|
168
|
+
key: SectionKey;
|
|
169
|
+
label?: string;
|
|
170
|
+
hidden?: boolean;
|
|
171
|
+
component?: Type<unknown>;
|
|
172
|
+
props?: Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Customer details response
|
|
176
|
+
*/
|
|
177
|
+
export interface CustomerDetails {
|
|
178
|
+
customer_key: string;
|
|
179
|
+
metrifox_id: string;
|
|
180
|
+
billing_address: BillingAddress | null;
|
|
181
|
+
billing_email: string;
|
|
182
|
+
currency: string;
|
|
183
|
+
customer_type: string;
|
|
184
|
+
display_name: string;
|
|
185
|
+
full_name: string;
|
|
186
|
+
language: string;
|
|
187
|
+
primary_email: string;
|
|
188
|
+
primary_phone?: string;
|
|
189
|
+
phone_numbers?: {
|
|
190
|
+
phone_number: string;
|
|
191
|
+
}[];
|
|
192
|
+
timezone: string;
|
|
193
|
+
subscriptions: Subscription[];
|
|
194
|
+
tenant_checkout_username: string;
|
|
195
|
+
}
|
|
196
|
+
export interface BillingAddress {
|
|
197
|
+
address_line_one?: string;
|
|
198
|
+
address_line_two?: string;
|
|
199
|
+
city?: string;
|
|
200
|
+
state?: string;
|
|
201
|
+
country?: string;
|
|
202
|
+
zip_code?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Subscription data
|
|
206
|
+
*/
|
|
207
|
+
export interface Subscription {
|
|
208
|
+
product_key: string;
|
|
209
|
+
product_name: string;
|
|
210
|
+
entitlements: Entitlement[];
|
|
211
|
+
subscription: SubscriptionDetails;
|
|
212
|
+
payment_method: PaymentMethod | null;
|
|
213
|
+
}
|
|
214
|
+
export interface SubscriptionDetails {
|
|
215
|
+
id: string;
|
|
216
|
+
created_at: string;
|
|
217
|
+
currency_code: string;
|
|
218
|
+
current_billing_period_start: string | null;
|
|
219
|
+
current_billing_period_end: string | null;
|
|
220
|
+
ends_at: string | null;
|
|
221
|
+
starts_at: string | null;
|
|
222
|
+
trial_end_date: string | null;
|
|
223
|
+
next_billing_amount: number;
|
|
224
|
+
next_billing_date: string;
|
|
225
|
+
plan_name: string;
|
|
226
|
+
offering_key: string;
|
|
227
|
+
plan_version: number;
|
|
228
|
+
product_name: string;
|
|
229
|
+
status: SubscriptionStatus;
|
|
230
|
+
renews_at: string;
|
|
231
|
+
subscription_items: SubscriptionItem[];
|
|
232
|
+
upcoming_invoice: UpcomingInvoice | null;
|
|
233
|
+
can_update_quantities: boolean;
|
|
234
|
+
}
|
|
235
|
+
export interface SubscriptionItem {
|
|
236
|
+
price_option_id: string;
|
|
237
|
+
name: string;
|
|
238
|
+
currency_code: string;
|
|
239
|
+
quantity: number;
|
|
240
|
+
unit_price: number;
|
|
241
|
+
total_amount: number;
|
|
242
|
+
billing_period_start: string | null;
|
|
243
|
+
billing_period_end: string | null;
|
|
244
|
+
line_source_type: string;
|
|
245
|
+
is_addon?: boolean;
|
|
246
|
+
}
|
|
247
|
+
export interface UpcomingInvoice {
|
|
248
|
+
invoice_id: string;
|
|
249
|
+
invoice_number: string;
|
|
250
|
+
amount: string;
|
|
251
|
+
currency: Currency;
|
|
252
|
+
due_date: string;
|
|
253
|
+
status: InvoiceStatus;
|
|
254
|
+
}
|
|
255
|
+
export type InvoiceStatus = 'draft' | 'pending' | 'open' | 'voided' | 'paid' | 'written_off' | 'refunded' | 'overdue' | 'due';
|
|
256
|
+
export interface Currency {
|
|
257
|
+
id: string;
|
|
258
|
+
code: string;
|
|
259
|
+
name: string;
|
|
260
|
+
country: string;
|
|
261
|
+
decimal_places: number;
|
|
262
|
+
symbol: string;
|
|
263
|
+
is_active: boolean;
|
|
264
|
+
base_unit_name: string;
|
|
265
|
+
base_unit_per_standard: number;
|
|
266
|
+
created_at: string;
|
|
267
|
+
updated_at: string;
|
|
268
|
+
country_code: string;
|
|
269
|
+
}
|
|
270
|
+
export interface PaymentMethod {
|
|
271
|
+
type: string;
|
|
272
|
+
brand: string;
|
|
273
|
+
last4: number;
|
|
274
|
+
exp_month: number;
|
|
275
|
+
exp_year: number;
|
|
276
|
+
display_name: string;
|
|
277
|
+
}
|
|
278
|
+
export interface Entitlement {
|
|
279
|
+
id: string;
|
|
280
|
+
carryover_quantity?: number;
|
|
281
|
+
included_usage: number;
|
|
282
|
+
name?: string;
|
|
283
|
+
next_reset_at?: string;
|
|
284
|
+
quota: string | number;
|
|
285
|
+
reset_interval: ResetIntervals | null;
|
|
286
|
+
used_quantity?: number;
|
|
287
|
+
feature_type: FeatureType;
|
|
288
|
+
enforcement_type?: EnforcementType;
|
|
289
|
+
reset_anchor?: string;
|
|
290
|
+
display_text?: string;
|
|
291
|
+
price_display_text?: string;
|
|
292
|
+
carryover_action?: string;
|
|
293
|
+
override_quota?: number | null;
|
|
294
|
+
feature?: Feature;
|
|
295
|
+
is_visible?: boolean;
|
|
296
|
+
offering_version_id?: string;
|
|
297
|
+
credit_key?: string;
|
|
298
|
+
credit_cost?: number | null;
|
|
299
|
+
pre_paid_credit_system_id?: string;
|
|
300
|
+
min_purchase_quantity?: number;
|
|
301
|
+
carryover_enabled?: boolean;
|
|
302
|
+
}
|
|
303
|
+
export interface Feature {
|
|
304
|
+
id: string;
|
|
305
|
+
key: string;
|
|
306
|
+
name: string;
|
|
307
|
+
description: string;
|
|
308
|
+
feature_type: FeatureType;
|
|
309
|
+
usage_model: string;
|
|
310
|
+
event_names: string;
|
|
311
|
+
aggregation_method: string;
|
|
312
|
+
unit_singular: string;
|
|
313
|
+
unit_plural: string;
|
|
314
|
+
status: FeatureStatus;
|
|
315
|
+
created_at: string;
|
|
316
|
+
}
|
|
317
|
+
export interface EntitlementUsage {
|
|
318
|
+
id: string;
|
|
319
|
+
feature_name: string;
|
|
320
|
+
feature_key: string;
|
|
321
|
+
type: string;
|
|
322
|
+
included_pool: Pool | null;
|
|
323
|
+
purchased_pool: Pool | null;
|
|
324
|
+
pay_as_you_go_pool: Pool | null;
|
|
325
|
+
rollover_quantity_pool: Pool | null;
|
|
326
|
+
}
|
|
327
|
+
export interface Pool {
|
|
328
|
+
balance: string;
|
|
329
|
+
used: string;
|
|
330
|
+
amount: string | null;
|
|
331
|
+
next_reset_at?: string;
|
|
332
|
+
}
|
|
333
|
+
export interface ProcessedPool {
|
|
334
|
+
pool: PoolType;
|
|
335
|
+
balance: number;
|
|
336
|
+
used: number;
|
|
337
|
+
amount: number;
|
|
338
|
+
color: string;
|
|
339
|
+
percent: number;
|
|
340
|
+
isUnlimited: boolean;
|
|
341
|
+
order: number;
|
|
342
|
+
nextResetAt?: string;
|
|
343
|
+
}
|
|
344
|
+
export interface EntitlementSummary {
|
|
345
|
+
id: string;
|
|
346
|
+
subscription_id: string;
|
|
347
|
+
customer_id: string;
|
|
348
|
+
tenant_id: string;
|
|
349
|
+
customer_key: string;
|
|
350
|
+
active: boolean;
|
|
351
|
+
subscription_item_id: string | null;
|
|
352
|
+
purchased_qty: number | null;
|
|
353
|
+
billing_interval: ResetIntervals | null;
|
|
354
|
+
feature_name: string;
|
|
355
|
+
feature_key: string;
|
|
356
|
+
soft_limit_enabled: boolean;
|
|
357
|
+
included_allowance: number | null;
|
|
358
|
+
included_allowance_reset_interval: ResetIntervals;
|
|
359
|
+
included_allowance_reset_anchor: string;
|
|
360
|
+
usage_limit: string | number | null;
|
|
361
|
+
usage_limit_reset_interval: ResetIntervals;
|
|
362
|
+
usage_limit_reset_anchor: string;
|
|
363
|
+
max_carryover_amount: string | number | null;
|
|
364
|
+
carryover_action: string;
|
|
365
|
+
carryover_enabled: boolean;
|
|
366
|
+
event_names: string[];
|
|
367
|
+
aggregation_method: AggregationMethods;
|
|
368
|
+
feature_type: FeatureType;
|
|
369
|
+
price_type: BillingTimingTypes;
|
|
370
|
+
entitlement_id: string;
|
|
371
|
+
prepaid: boolean;
|
|
372
|
+
prepaid_credit_system_id: string;
|
|
373
|
+
usage_model: FeatureModel;
|
|
374
|
+
credit_cost: number | null;
|
|
375
|
+
created_at: string;
|
|
376
|
+
updated_at: string;
|
|
377
|
+
billing_interval_value: number | null;
|
|
378
|
+
}
|
|
379
|
+
export interface Wallet {
|
|
380
|
+
id: string;
|
|
381
|
+
balance: number;
|
|
382
|
+
name: string;
|
|
383
|
+
allocations: WalletAllocation[];
|
|
384
|
+
credit_key: string;
|
|
385
|
+
credit_system_id: string;
|
|
386
|
+
credit_unit_plural: string;
|
|
387
|
+
credit_unit_singular: string;
|
|
388
|
+
}
|
|
389
|
+
export interface WalletAllocation {
|
|
390
|
+
amount: number;
|
|
391
|
+
consumed: number;
|
|
392
|
+
balance_remaining: number;
|
|
393
|
+
source: string;
|
|
394
|
+
credited_date: string;
|
|
395
|
+
valid_until: string | null;
|
|
396
|
+
}
|
|
397
|
+
export interface CreditAllocation {
|
|
398
|
+
allocation_type: string;
|
|
399
|
+
amount: number;
|
|
400
|
+
consumed: number;
|
|
401
|
+
created_at: string;
|
|
402
|
+
id: string;
|
|
403
|
+
invoice_id: string;
|
|
404
|
+
order_id: string | null;
|
|
405
|
+
order_number: string | null;
|
|
406
|
+
transactions: CreditTransaction[];
|
|
407
|
+
valid_until: string | null;
|
|
408
|
+
}
|
|
409
|
+
export interface CreditTransaction {
|
|
410
|
+
id: string;
|
|
411
|
+
amount: number;
|
|
412
|
+
type: string;
|
|
413
|
+
created_at: string;
|
|
414
|
+
description?: string;
|
|
415
|
+
}
|
|
416
|
+
export interface WalletSetting {
|
|
417
|
+
id: string;
|
|
418
|
+
auto_top_up_enabled: boolean;
|
|
419
|
+
notification_enabled: boolean;
|
|
420
|
+
threshold_amount: number;
|
|
421
|
+
target_balance: number;
|
|
422
|
+
monthly_top_up_count_limit: number;
|
|
423
|
+
monthly_top_up_count: number;
|
|
424
|
+
last_top_up_at: string | null;
|
|
425
|
+
credit_system_id: string;
|
|
426
|
+
credit_system_name: string;
|
|
427
|
+
credit_system_key: string;
|
|
428
|
+
wallet_id: string;
|
|
429
|
+
monthly_top_up_count_reset_at: string;
|
|
430
|
+
}
|
|
431
|
+
export interface CreateWalletSettings {
|
|
432
|
+
customer_key: string;
|
|
433
|
+
auto_top_up_enabled: boolean;
|
|
434
|
+
notification_enabled: boolean;
|
|
435
|
+
threshold_amount: number;
|
|
436
|
+
credit_system_id: string;
|
|
437
|
+
wallet_id: string;
|
|
438
|
+
target_balance?: number;
|
|
439
|
+
monthly_top_up_count_limit?: number;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Pricing Table component props
|
|
443
|
+
*/
|
|
444
|
+
export interface PricingTableProps {
|
|
445
|
+
checkoutUsername: string;
|
|
446
|
+
productKey: string;
|
|
447
|
+
plansOnly?: boolean;
|
|
448
|
+
singlePurchasesOnly?: boolean;
|
|
449
|
+
showTabHeader?: boolean;
|
|
450
|
+
}
|
|
451
|
+
export interface Offering {
|
|
452
|
+
created_at: string;
|
|
453
|
+
description: string;
|
|
454
|
+
display_text: string;
|
|
455
|
+
id: string;
|
|
456
|
+
metadata: Record<string, string> | null;
|
|
457
|
+
name: string;
|
|
458
|
+
offering_id: string;
|
|
459
|
+
offering_type: string;
|
|
460
|
+
offering_key: string;
|
|
461
|
+
status: string;
|
|
462
|
+
updated_at: string;
|
|
463
|
+
version_number: number;
|
|
464
|
+
checkout_url: string | null;
|
|
465
|
+
is_visible: boolean;
|
|
466
|
+
is_free: boolean;
|
|
467
|
+
is_custom: boolean;
|
|
468
|
+
is_current_plan: boolean;
|
|
469
|
+
custom_cta_text: string | null;
|
|
470
|
+
custom_cta_url: string | null;
|
|
471
|
+
base_entitlement_plan_name: string | null;
|
|
472
|
+
trial_duration_unit: string | null;
|
|
473
|
+
trial_duration_value: number | null;
|
|
474
|
+
price_options: PriceOption[];
|
|
475
|
+
entitlements: Entitlement[];
|
|
476
|
+
base_entitlements: Entitlement[];
|
|
477
|
+
entitlement_price_options: PriceOption[];
|
|
478
|
+
credit_attachment_price_options: PriceOption[];
|
|
479
|
+
credit_attachments: CreditSystem[];
|
|
480
|
+
base_entitlements_plan_name: string;
|
|
481
|
+
version_id: string;
|
|
482
|
+
is_invoiceable: boolean;
|
|
483
|
+
}
|
|
484
|
+
export interface ParentOffering {
|
|
485
|
+
archived_versions: Offering[];
|
|
486
|
+
draft_version: Offering;
|
|
487
|
+
id: string;
|
|
488
|
+
is_visible: boolean;
|
|
489
|
+
offering_key: string;
|
|
490
|
+
published_version: Offering;
|
|
491
|
+
}
|
|
492
|
+
export interface PriceOption {
|
|
493
|
+
metadata: Record<string, string>;
|
|
494
|
+
id: string;
|
|
495
|
+
owner_type: 'OfferingVersion' | string;
|
|
496
|
+
price_type: PriceTypes;
|
|
497
|
+
price_owner: PriceOwner;
|
|
498
|
+
price: Price;
|
|
499
|
+
created_at: string;
|
|
500
|
+
updated_at: string;
|
|
501
|
+
}
|
|
502
|
+
export interface PriceOwner {
|
|
503
|
+
id: string;
|
|
504
|
+
name: string;
|
|
505
|
+
offering_id: string;
|
|
506
|
+
display_text: string;
|
|
507
|
+
description: string;
|
|
508
|
+
charge_key: string;
|
|
509
|
+
charge_model: string;
|
|
510
|
+
metadata: Record<string, string> | null;
|
|
511
|
+
created_by: string;
|
|
512
|
+
updated_by: string | null;
|
|
513
|
+
deleted_by: string | null;
|
|
514
|
+
created_at: string;
|
|
515
|
+
updated_at: string;
|
|
516
|
+
deleted_at: string | null;
|
|
517
|
+
tenant_id: string;
|
|
518
|
+
price_option_id: string;
|
|
519
|
+
}
|
|
520
|
+
export interface Price {
|
|
521
|
+
id: string;
|
|
522
|
+
name: string;
|
|
523
|
+
currency: string;
|
|
524
|
+
price: number;
|
|
525
|
+
price_type: string;
|
|
526
|
+
tax_inclusion: 'inclusive' | 'exclusive' | string;
|
|
527
|
+
tax_type: string | null;
|
|
528
|
+
tax_rate: number | null;
|
|
529
|
+
billing_interval: 'monthly' | 'yearly' | string;
|
|
530
|
+
billing_interval_value: number;
|
|
531
|
+
trial_period: string | null;
|
|
532
|
+
trial_period_value: number;
|
|
533
|
+
invoice_timing: 'in_advance' | 'in_arrears' | string;
|
|
534
|
+
unit_label: string;
|
|
535
|
+
unit_per_package: number;
|
|
536
|
+
created_at: string;
|
|
537
|
+
type: PriceTypes;
|
|
538
|
+
updated_at: string;
|
|
539
|
+
package_name: string;
|
|
540
|
+
is_custom: boolean;
|
|
541
|
+
entitlement?: Entitlement;
|
|
542
|
+
tiers?: Tier[];
|
|
543
|
+
tier_type: string;
|
|
544
|
+
owner?: Entitlement | CreditOwner;
|
|
545
|
+
}
|
|
546
|
+
export interface Tier {
|
|
547
|
+
pricing_model: OneOffType;
|
|
548
|
+
first_unit: number;
|
|
549
|
+
last_unit: number;
|
|
550
|
+
unit_price: number;
|
|
551
|
+
package_price: number;
|
|
552
|
+
package_size: number | null;
|
|
553
|
+
percentage: number;
|
|
554
|
+
min_price: number | null;
|
|
555
|
+
max_price: number | null;
|
|
556
|
+
flat_fee: number | null;
|
|
557
|
+
total_unit_quantity: number | null;
|
|
558
|
+
}
|
|
559
|
+
export interface CreditOwner {
|
|
560
|
+
id: string;
|
|
561
|
+
name: string;
|
|
562
|
+
key: string;
|
|
563
|
+
description: string;
|
|
564
|
+
status: string;
|
|
565
|
+
credit_system_id: string;
|
|
566
|
+
credit_unit_singular: string;
|
|
567
|
+
credit_unit_plural: string;
|
|
568
|
+
unit_singular: string;
|
|
569
|
+
unit_plural: string;
|
|
570
|
+
price_options: PriceOption[];
|
|
571
|
+
}
|
|
572
|
+
export interface CreditSystem {
|
|
573
|
+
status: FeatureStatus;
|
|
574
|
+
id: string;
|
|
575
|
+
name?: string;
|
|
576
|
+
credit_name: string;
|
|
577
|
+
credit_key: string;
|
|
578
|
+
credit_system_id: string;
|
|
579
|
+
credit_unit_singular: string;
|
|
580
|
+
credit_unit_plural: string;
|
|
581
|
+
source_type: string;
|
|
582
|
+
source_id: string;
|
|
583
|
+
use_default_price: boolean;
|
|
584
|
+
topup_enabled: boolean;
|
|
585
|
+
reset_interval: string;
|
|
586
|
+
included_usage: number;
|
|
587
|
+
carryover_enabled: boolean;
|
|
588
|
+
carryover_action: string;
|
|
589
|
+
expiry_value: number | null;
|
|
590
|
+
expiry_interval: number | null;
|
|
591
|
+
can_expire: boolean;
|
|
592
|
+
is_mandatory: boolean;
|
|
593
|
+
low_balance_threshold: number | null;
|
|
594
|
+
display_text: string | null;
|
|
595
|
+
included_usage_text: string;
|
|
596
|
+
price_options: PriceOption[];
|
|
597
|
+
tiers: Tier[];
|
|
598
|
+
}
|
|
599
|
+
export interface Product {
|
|
600
|
+
plans: ParentOffering[];
|
|
601
|
+
single_purchases: ParentOffering[];
|
|
602
|
+
currency_code: string;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Response from /sdk/product_catalogues/products/published-plans endpoint
|
|
606
|
+
* Note: This returns Offering[] directly, not ParentOffering[]
|
|
607
|
+
*/
|
|
608
|
+
export interface ProductPlans {
|
|
609
|
+
plans: Offering[];
|
|
610
|
+
}
|
|
611
|
+
export interface SinglePurchase {
|
|
612
|
+
id: string;
|
|
613
|
+
name: string;
|
|
614
|
+
description: string;
|
|
615
|
+
price: number;
|
|
616
|
+
currency_code: string;
|
|
617
|
+
offering_key: string;
|
|
618
|
+
}
|
|
619
|
+
export interface Invoice {
|
|
620
|
+
id: string;
|
|
621
|
+
invoice_number: string;
|
|
622
|
+
title: string;
|
|
623
|
+
currency_code?: string;
|
|
624
|
+
customer: CustomerDetails;
|
|
625
|
+
tenant?: Tenant;
|
|
626
|
+
due_at: string;
|
|
627
|
+
issued_at: string | null;
|
|
628
|
+
status?: InvoiceStatusType;
|
|
629
|
+
comment: string;
|
|
630
|
+
is_partially_paid?: boolean;
|
|
631
|
+
is_overdue?: boolean;
|
|
632
|
+
overdue_by?: number | null;
|
|
633
|
+
line_items: InvoiceLineItem[];
|
|
634
|
+
charge_items: InvoiceLineItem[];
|
|
635
|
+
usage_items: InvoiceLineItem[];
|
|
636
|
+
credit_items: InvoiceLineItem[];
|
|
637
|
+
summary: Partial<InvoiceSummary>;
|
|
638
|
+
currency: Partial<Currency>;
|
|
639
|
+
payment_intent?: unknown | null;
|
|
640
|
+
created_at?: string;
|
|
641
|
+
updated_at?: string;
|
|
642
|
+
}
|
|
643
|
+
export interface InvoiceLineItem {
|
|
644
|
+
id: string;
|
|
645
|
+
price_option_id: string | null;
|
|
646
|
+
tax_id: string | null;
|
|
647
|
+
name: string;
|
|
648
|
+
description: string;
|
|
649
|
+
quantity: number;
|
|
650
|
+
unit_price: string;
|
|
651
|
+
tax_rate: string;
|
|
652
|
+
discount_amount: string;
|
|
653
|
+
amount: string;
|
|
654
|
+
total_amount: string;
|
|
655
|
+
created_at: string;
|
|
656
|
+
updated_at: string;
|
|
657
|
+
}
|
|
658
|
+
export interface InvoiceSummary {
|
|
659
|
+
id: string;
|
|
660
|
+
items_subtotal: string;
|
|
661
|
+
total_discounts: string;
|
|
662
|
+
total_extra_fees: string;
|
|
663
|
+
total_before_tax: string;
|
|
664
|
+
total_amount: string;
|
|
665
|
+
total_tax_amount: string;
|
|
666
|
+
total_after_tax: string;
|
|
667
|
+
total_amount_paid: string;
|
|
668
|
+
total_adjustment_amount: string;
|
|
669
|
+
total_outstanding_amount: string;
|
|
670
|
+
created_at: string;
|
|
671
|
+
updated_at: string;
|
|
672
|
+
}
|
|
673
|
+
export interface Tenant {
|
|
674
|
+
business_name: string;
|
|
675
|
+
default_address: TenantAddress;
|
|
676
|
+
logo_url: string | null;
|
|
677
|
+
}
|
|
678
|
+
export interface TenantAddress {
|
|
679
|
+
id: string;
|
|
680
|
+
tenant_id: string;
|
|
681
|
+
line_1: string;
|
|
682
|
+
line_2: string;
|
|
683
|
+
city: string;
|
|
684
|
+
state: string;
|
|
685
|
+
postal_code: string;
|
|
686
|
+
country: string;
|
|
687
|
+
is_default: boolean;
|
|
688
|
+
created_at: string;
|
|
689
|
+
updated_at: string;
|
|
690
|
+
}
|
|
691
|
+
export interface BillingHistory {
|
|
692
|
+
invoice_id: string;
|
|
693
|
+
invoice_number: string;
|
|
694
|
+
issued_date: string;
|
|
695
|
+
due_date: string;
|
|
696
|
+
currency: string;
|
|
697
|
+
total_amount: number;
|
|
698
|
+
amount_paid: number;
|
|
699
|
+
balance_due: number;
|
|
700
|
+
status: string;
|
|
701
|
+
payment_method: PaymentMethod | null;
|
|
702
|
+
source_type: string;
|
|
703
|
+
created_at: string;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Events emitted by SDK components
|
|
707
|
+
*/
|
|
708
|
+
export interface CustomerDataLoadedEvent {
|
|
709
|
+
customerDetails: CustomerDetails;
|
|
710
|
+
}
|
|
711
|
+
export interface PlanSelectedEvent {
|
|
712
|
+
plan: Offering;
|
|
713
|
+
interval: string;
|
|
714
|
+
checkoutUrl: string;
|
|
715
|
+
}
|
|
716
|
+
export interface PurchaseSelectedEvent {
|
|
717
|
+
purchase: Offering;
|
|
718
|
+
checkoutUrl: string;
|
|
719
|
+
}
|
|
720
|
+
export interface ErrorEvent {
|
|
721
|
+
message: string;
|
|
722
|
+
code?: string;
|
|
723
|
+
details?: unknown;
|
|
724
|
+
}
|
|
725
|
+
export type CssVarMap = Record<string, string>;
|
|
726
|
+
import { LocalizationSelection } from './enum';
|
|
727
|
+
/**
|
|
728
|
+
* Localization data for a country/currency
|
|
729
|
+
*/
|
|
730
|
+
export interface Localization {
|
|
731
|
+
country_code: string;
|
|
732
|
+
currency_code: string;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Localization settings for pricing table
|
|
736
|
+
*/
|
|
737
|
+
export interface LocalizationSettings {
|
|
738
|
+
selection: LocalizationSelection;
|
|
739
|
+
}
|