@metrifox/react-sdk 0.0.5 → 0.0.7
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/index.cjs +17 -17
- package/dist/index.d.ts +220 -16
- package/dist/index.js +17 -17
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,28 @@ interface MetrifoxInitConfig {
|
|
|
7
7
|
}
|
|
8
8
|
declare const metrifoxInit: (config: MetrifoxInitConfig) => void;
|
|
9
9
|
|
|
10
|
+
declare enum ResetIntervals {
|
|
11
|
+
NONE = "none",
|
|
12
|
+
DAILY = "daily",
|
|
13
|
+
WEEKLY = "weekly",
|
|
14
|
+
MONTHLY = "monthly",
|
|
15
|
+
QUARTERLY = "quarterly",
|
|
16
|
+
YEARLY = "yearly",
|
|
17
|
+
BI_ANNUALLY = "biannually"
|
|
18
|
+
}
|
|
10
19
|
declare enum FeatureType {
|
|
11
20
|
BOOLEAN = "boolean",
|
|
12
21
|
METERED = "metered"
|
|
13
22
|
}
|
|
23
|
+
declare enum FeatureStatus {
|
|
24
|
+
ARCHIVED = "archived",
|
|
25
|
+
ACTIVE = "active",
|
|
26
|
+
ALL = "all"
|
|
27
|
+
}
|
|
28
|
+
declare enum EnforcementType {
|
|
29
|
+
SOFT = "soft",
|
|
30
|
+
HARD = "hard"
|
|
31
|
+
}
|
|
14
32
|
declare enum SubscriptionStatus {
|
|
15
33
|
ACTIVE = "active",
|
|
16
34
|
IN_TRIAL = "in_trial",
|
|
@@ -19,6 +37,17 @@ declare enum SubscriptionStatus {
|
|
|
19
37
|
DEACTIVATED = "deactivated",
|
|
20
38
|
PAUSED = "paused"
|
|
21
39
|
}
|
|
40
|
+
declare enum PriceTypes {
|
|
41
|
+
ONE_OFF = "OneOff",
|
|
42
|
+
FIXED_RECURRING = "RecurringFixed",
|
|
43
|
+
USAGE_BASED = "UsageBased"
|
|
44
|
+
}
|
|
45
|
+
declare enum OneOffType {
|
|
46
|
+
PER_UNIT = "per_unit",
|
|
47
|
+
PER_PACKAGE = "per_package",
|
|
48
|
+
FLAT = "flat",
|
|
49
|
+
PERCENTAGE = "percentage"
|
|
50
|
+
}
|
|
22
51
|
|
|
23
52
|
type SectionKey = "upcomingInvoice" | "subscription" | "creditBalance" | "entitlementUsage" | "paymentOverview" | "billingHistory" | "plan";
|
|
24
53
|
interface CustomerPortalProps {
|
|
@@ -36,20 +65,6 @@ interface SectionConfig {
|
|
|
36
65
|
}>;
|
|
37
66
|
props?: Record<string, unknown>;
|
|
38
67
|
}
|
|
39
|
-
interface IWallet {
|
|
40
|
-
id: string;
|
|
41
|
-
balance: number;
|
|
42
|
-
name: string;
|
|
43
|
-
allocations: {
|
|
44
|
-
amount: number;
|
|
45
|
-
consumed: number;
|
|
46
|
-
balance_remaining: number;
|
|
47
|
-
source: string;
|
|
48
|
-
credited_date: string;
|
|
49
|
-
valid_until: string | null;
|
|
50
|
-
}[];
|
|
51
|
-
credit_key: string;
|
|
52
|
-
}
|
|
53
68
|
interface IEntitlements {
|
|
54
69
|
id: string;
|
|
55
70
|
carryover_quantity: number;
|
|
@@ -74,7 +89,6 @@ interface ISubscriptions {
|
|
|
74
89
|
product_name: string;
|
|
75
90
|
entitlements: IEntitlements[];
|
|
76
91
|
subscription: SubscriptionProps;
|
|
77
|
-
wallets: IWallet[];
|
|
78
92
|
payment_method: IPaymentMethod | null;
|
|
79
93
|
}
|
|
80
94
|
interface SubscriptionProps {
|
|
@@ -147,7 +161,197 @@ interface ICustomerDetails {
|
|
|
147
161
|
tenant_checkout_username: string;
|
|
148
162
|
}
|
|
149
163
|
type InvoiceStatus = "draft" | "pending" | "open" | "voided" | "paid" | "written_off" | "refunded" | "overdue" | "due";
|
|
164
|
+
interface Offering {
|
|
165
|
+
created_at: string;
|
|
166
|
+
description: string;
|
|
167
|
+
display_text: string;
|
|
168
|
+
id: string;
|
|
169
|
+
metadata: null;
|
|
170
|
+
name: string;
|
|
171
|
+
offering_id: string;
|
|
172
|
+
offering_type: string;
|
|
173
|
+
offering_key: string;
|
|
174
|
+
status: string;
|
|
175
|
+
updated_at: string;
|
|
176
|
+
version_number: number;
|
|
177
|
+
checkout_url: string | null;
|
|
178
|
+
is_visible: boolean;
|
|
179
|
+
is_free: boolean;
|
|
180
|
+
is_custom: boolean;
|
|
181
|
+
is_current_plan: boolean;
|
|
182
|
+
custom_cta_text: string | null;
|
|
183
|
+
custom_cta_url: string | null;
|
|
184
|
+
base_entitlement_plan_name: string | null;
|
|
185
|
+
trial_duration_unit: string | null;
|
|
186
|
+
trial_duration_value: number | null;
|
|
187
|
+
price_options: PriceOption[];
|
|
188
|
+
entitlements: Entitlement[];
|
|
189
|
+
base_entitlements: Entitlement[];
|
|
190
|
+
entitlement_price_options: PriceOption[];
|
|
191
|
+
credit_attachment_price_options: PriceOption[];
|
|
192
|
+
credit_attachments: CreditSystemProps[];
|
|
193
|
+
base_entitlements_plan_name: string;
|
|
194
|
+
version_id: string;
|
|
195
|
+
is_invoiceable: boolean;
|
|
196
|
+
}
|
|
197
|
+
interface PriceOption {
|
|
198
|
+
metadata: Record<string, string>;
|
|
199
|
+
id: string;
|
|
200
|
+
owner_type: "OfferingVersion" | string;
|
|
201
|
+
price_type: PriceTypes;
|
|
202
|
+
price_owner: PriceOwner;
|
|
203
|
+
price: Price;
|
|
204
|
+
created_at: string;
|
|
205
|
+
updated_at: string;
|
|
206
|
+
}
|
|
207
|
+
interface PriceOwner {
|
|
208
|
+
id: string;
|
|
209
|
+
name: string;
|
|
210
|
+
offering_id: string;
|
|
211
|
+
display_text: string;
|
|
212
|
+
description: string;
|
|
213
|
+
charge_key: string;
|
|
214
|
+
charge_model: string;
|
|
215
|
+
metadata: Record<string, string> | null;
|
|
216
|
+
created_by: string;
|
|
217
|
+
updated_by: string | null;
|
|
218
|
+
deleted_by: string | null;
|
|
219
|
+
created_at: string;
|
|
220
|
+
updated_at: string;
|
|
221
|
+
deleted_at: string | null;
|
|
222
|
+
tenant_id: string;
|
|
223
|
+
price_option_id: string;
|
|
224
|
+
}
|
|
225
|
+
interface CreditOwner {
|
|
226
|
+
id: string;
|
|
227
|
+
name: string;
|
|
228
|
+
key: string;
|
|
229
|
+
description: string;
|
|
230
|
+
status: string;
|
|
231
|
+
credit_system_id: string;
|
|
232
|
+
credit_unit_singular: string;
|
|
233
|
+
credit_unit_plural: string;
|
|
234
|
+
unit_singular: string;
|
|
235
|
+
unit_plural: string;
|
|
236
|
+
price_options: PriceOption[];
|
|
237
|
+
}
|
|
238
|
+
interface CreditSystemProps {
|
|
239
|
+
status: FeatureStatus;
|
|
240
|
+
id: string;
|
|
241
|
+
name?: string;
|
|
242
|
+
credit_name: string;
|
|
243
|
+
credit_key: string;
|
|
244
|
+
credit_system_id: string;
|
|
245
|
+
credit_unit_singular: string;
|
|
246
|
+
credit_unit_plural: string;
|
|
247
|
+
source_type: string;
|
|
248
|
+
source_id: string;
|
|
249
|
+
use_default_price: boolean;
|
|
250
|
+
topup_enabled: boolean;
|
|
251
|
+
reset_interval: string;
|
|
252
|
+
included_usage: number;
|
|
253
|
+
carryover_enabled: boolean;
|
|
254
|
+
carryover_action: string;
|
|
255
|
+
expiry_value: number | null;
|
|
256
|
+
expiry_interval: number | null;
|
|
257
|
+
can_expire: boolean;
|
|
258
|
+
is_mandatory: boolean;
|
|
259
|
+
low_balance_threshold: number | null;
|
|
260
|
+
display_text: string | null;
|
|
261
|
+
included_usage_text: string;
|
|
262
|
+
price_options: PriceOption[];
|
|
263
|
+
tiers: Tier[];
|
|
264
|
+
}
|
|
265
|
+
interface Price {
|
|
266
|
+
id: string;
|
|
267
|
+
name: string;
|
|
268
|
+
currency: string;
|
|
269
|
+
price: number;
|
|
270
|
+
price_type: string;
|
|
271
|
+
tax_inclusion: "inclusive" | "exclusive" | string;
|
|
272
|
+
tax_type: string | null;
|
|
273
|
+
tax_rate: number | null;
|
|
274
|
+
billing_interval: "monthly" | "yearly" | string;
|
|
275
|
+
billing_interval_value: number;
|
|
276
|
+
trial_period: string | null;
|
|
277
|
+
trial_period_value: number;
|
|
278
|
+
invoice_timing: "in_advance" | "in_arrears" | string;
|
|
279
|
+
unit_label: string;
|
|
280
|
+
unit_per_package: number;
|
|
281
|
+
created_at: string;
|
|
282
|
+
type: PriceTypes;
|
|
283
|
+
updated_at: string;
|
|
284
|
+
package_name: string;
|
|
285
|
+
is_custom: boolean;
|
|
286
|
+
entitlement: Entitlement;
|
|
287
|
+
tiers?: Tier[];
|
|
288
|
+
tier_type: string;
|
|
289
|
+
owner: Entitlement | CreditOwner;
|
|
290
|
+
}
|
|
291
|
+
interface Tier {
|
|
292
|
+
pricing_model: OneOffType;
|
|
293
|
+
first_unit: number;
|
|
294
|
+
last_unit: number;
|
|
295
|
+
unit_price: number;
|
|
296
|
+
package_price: number;
|
|
297
|
+
package_size: number | null;
|
|
298
|
+
percentage: number;
|
|
299
|
+
min_price: number | null;
|
|
300
|
+
max_price: number | null;
|
|
301
|
+
flat_fee: number | null;
|
|
302
|
+
}
|
|
303
|
+
interface Entitlement {
|
|
304
|
+
carryover_enabled: boolean;
|
|
305
|
+
id: string;
|
|
306
|
+
name?: string;
|
|
307
|
+
enforcement_type: EnforcementType;
|
|
308
|
+
reset_interval: ResetIntervals;
|
|
309
|
+
reset_anchor: string;
|
|
310
|
+
display_text: string;
|
|
311
|
+
price_display_text: string;
|
|
312
|
+
quota: number;
|
|
313
|
+
included_usage: number;
|
|
314
|
+
carryover_action: string;
|
|
315
|
+
override_quota: number | null;
|
|
316
|
+
feature: Feature;
|
|
317
|
+
is_visible: boolean;
|
|
318
|
+
offering_version_id: string;
|
|
319
|
+
credit_key?: string;
|
|
320
|
+
credit_cost?: number | null;
|
|
321
|
+
pre_paid_credit_system_id?: string;
|
|
322
|
+
min_purchase_quantity?: number;
|
|
323
|
+
}
|
|
324
|
+
interface Feature {
|
|
325
|
+
id: string;
|
|
326
|
+
key: string;
|
|
327
|
+
name: string;
|
|
328
|
+
description: string;
|
|
329
|
+
feature_type: FeatureType;
|
|
330
|
+
usage_model: string;
|
|
331
|
+
event_names: string;
|
|
332
|
+
aggregation_method: string;
|
|
333
|
+
unit_singular: string;
|
|
334
|
+
unit_plural: string;
|
|
335
|
+
status: FeatureStatus;
|
|
336
|
+
created_at: string;
|
|
337
|
+
}
|
|
150
338
|
|
|
151
339
|
declare const CustomerPortal: ({ customerKey, sectionsConfig }: CustomerPortalProps) => react_jsx_runtime.JSX.Element;
|
|
152
340
|
|
|
153
|
-
|
|
341
|
+
declare const PriceCard: ({ plan, interval, featureOrderMap, isPricePage, isCustomerPortal, statusTag, addPriceButton, buttonText, isCurrentPlan, planActions, cardAction, buttonAction, }: {
|
|
342
|
+
plan: Offering;
|
|
343
|
+
interval: string;
|
|
344
|
+
featureOrderMap: Map<string, number>;
|
|
345
|
+
isPricePage?: boolean;
|
|
346
|
+
isCustomerPortal?: boolean;
|
|
347
|
+
statusTag?: React.ReactNode;
|
|
348
|
+
addPriceButton?: React.ReactNode;
|
|
349
|
+
buttonText?: string;
|
|
350
|
+
isCurrentPlan?: boolean;
|
|
351
|
+
planActions?: React.ReactNode;
|
|
352
|
+
cardAction?: () => void;
|
|
353
|
+
buttonAction?: () => void;
|
|
354
|
+
}) => react_jsx_runtime.JSX.Element | null;
|
|
355
|
+
|
|
356
|
+
export { CustomerPortal, PriceCard, metrifoxInit };
|
|
357
|
+
export type { Offering as ProductOffering };
|