@schematichq/schematic-components 2.31.0 → 2.32.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/dist/schematic-components-elements.cjs.js +2070 -278
- package/dist/schematic-components-elements.d.ts +516 -0
- package/dist/schematic-components-elements.esm.js +2046 -248
- package/dist/schematic-components.browser.cjs.js +735 -105
- package/dist/schematic-components.browser.esm.js +735 -105
- package/dist/schematic-components.cjs.js +735 -105
- package/dist/schematic-components.d.ts +547 -101
- package/dist/schematic-components.esm.js +735 -105
- package/package.json +10 -10
|
@@ -5,13 +5,18 @@ import { BillingDataProviderProps } from '@schematichq/schematic-react';
|
|
|
5
5
|
import { BillingDataStatus } from '@schematichq/schematic-react';
|
|
6
6
|
import { BillingResourceName } from '@schematichq/schematic-react';
|
|
7
7
|
import { Discount } from '@schematichq/schematic-react';
|
|
8
|
+
import { FEATURE_USER_USAGE_LIMIT } from '@schematichq/schematic-react';
|
|
9
|
+
import { FeatureUsage } from '@schematichq/schematic-react';
|
|
10
|
+
import { FeatureUserUsage } from '@schematichq/schematic-react';
|
|
8
11
|
import { Invoice } from '@schematichq/schematic-react';
|
|
9
12
|
import { InvoicePage } from '@schematichq/schematic-react';
|
|
10
13
|
import { InvoiceQuery } from '@schematichq/schematic-react';
|
|
11
14
|
import type { InvoiceStatus } from '@schematichq/schematic-react';
|
|
12
15
|
import { JSX } from 'react';
|
|
16
|
+
import { MeteredPrice } from '@schematichq/schematic-react';
|
|
13
17
|
import { PaymentMethod } from '@schematichq/schematic-react';
|
|
14
18
|
import { PaymentMethodsHandle } from '@schematichq/schematic-react';
|
|
19
|
+
import { PerLicenseCreditGrant } from '@schematichq/schematic-react';
|
|
15
20
|
import { default as React_2 } from 'react';
|
|
16
21
|
import { ResourceHandle } from '@schematichq/schematic-react';
|
|
17
22
|
import { ResourceState } from '@schematichq/schematic-react';
|
|
@@ -22,9 +27,12 @@ import { SetupIntent } from '@schematichq/schematic-react';
|
|
|
22
27
|
import { SetupIntentHandle } from '@schematichq/schematic-react';
|
|
23
28
|
import type { Translate } from '@schematichq/schematic-react';
|
|
24
29
|
import { UpcomingInvoice } from '@schematichq/schematic-react';
|
|
30
|
+
import { useFeatureUsage } from '@schematichq/schematic-react';
|
|
31
|
+
import { useFeatureUserUsage } from '@schematichq/schematic-react';
|
|
25
32
|
import { useInvalidateBillingData } from '@schematichq/schematic-react';
|
|
26
33
|
import { useInvoices } from '@schematichq/schematic-react';
|
|
27
34
|
import { usePaymentMethods } from '@schematichq/schematic-react';
|
|
35
|
+
import { UserUsage } from '@schematichq/schematic-react';
|
|
28
36
|
import { useSchematicI18n } from '@schematichq/schematic-react';
|
|
29
37
|
import { useSchematicLocale } from '@schematichq/schematic-react';
|
|
30
38
|
import { useSchematicStrings } from '@schematichq/schematic-react';
|
|
@@ -58,6 +66,13 @@ export declare interface BillLine {
|
|
|
58
66
|
amountText: string;
|
|
59
67
|
}
|
|
60
68
|
|
|
69
|
+
/**
|
|
70
|
+
* The tier a row's usage sits in. For overage, the tier past the soft limit
|
|
71
|
+
* of a two-tier price, which is how an overage price is built; for tiered
|
|
72
|
+
* pricing, the tier holding the usage. `null` otherwise.
|
|
73
|
+
*/
|
|
74
|
+
export declare function currentTier(row: FeatureUsage): TierRange | null;
|
|
75
|
+
|
|
61
76
|
/**
|
|
62
77
|
* The English copy, and the fallback for anything a host does not answer.
|
|
63
78
|
* It is a plain resource bundle, so it can be registered as one:
|
|
@@ -86,6 +101,16 @@ export declare interface DerivedPaymentMethods {
|
|
|
86
101
|
expiryWarning: PaymentMethodExpiryWarning;
|
|
87
102
|
}
|
|
88
103
|
|
|
104
|
+
export declare function deriveIncludedFeatures(features: FeatureUsage[], options: DeriveIncludedFeaturesOptions): IncludedFeatureRow[];
|
|
105
|
+
|
|
106
|
+
export declare interface DeriveIncludedFeaturesOptions extends UsageLimitOptions {
|
|
107
|
+
locale: string;
|
|
108
|
+
/** Feature ids to show, in this order; every feature when absent. */
|
|
109
|
+
visibleFeatures?: string[];
|
|
110
|
+
/** The "credits per use" line on credit-burning features. Default true. */
|
|
111
|
+
showCredits?: boolean;
|
|
112
|
+
}
|
|
113
|
+
|
|
89
114
|
export declare function deriveInvoiceList(page: InvoicePage, options: DeriveInvoiceListOptions): InvoiceList;
|
|
90
115
|
|
|
91
116
|
export declare interface DeriveInvoiceListOptions {
|
|
@@ -93,6 +118,16 @@ export declare interface DeriveInvoiceListOptions {
|
|
|
93
118
|
format?: InvoiceFormatters;
|
|
94
119
|
}
|
|
95
120
|
|
|
121
|
+
export declare function deriveMeteredFeatures(features: FeatureUsage[], options: DeriveMeteredFeaturesOptions): MeteredFeatureRow[];
|
|
122
|
+
|
|
123
|
+
export declare interface DeriveMeteredFeaturesOptions extends UsageLimitOptions {
|
|
124
|
+
locale: string;
|
|
125
|
+
/** Feature ids to show, in this order; every metered feature when absent. */
|
|
126
|
+
visibleFeatures?: string[];
|
|
127
|
+
/** The "credits per use" line on credit-burning features. Default true. */
|
|
128
|
+
showCredits?: boolean;
|
|
129
|
+
}
|
|
130
|
+
|
|
96
131
|
/**
|
|
97
132
|
* The default is whichever row the server marked, which already prefers the
|
|
98
133
|
* subscription's method over the customer's. Nothing is promoted: a list
|
|
@@ -224,8 +259,108 @@ export declare type ElementStrings = {
|
|
|
224
259
|
paymentMethodsSaveError: string;
|
|
225
260
|
paymentMethodsSetDefaultError: string;
|
|
226
261
|
paymentMethodsRemoveError: string;
|
|
262
|
+
includedFeaturesLoading: string;
|
|
263
|
+
includedFeaturesHeader: string;
|
|
264
|
+
includedFeaturesError: string;
|
|
265
|
+
includedFeaturesUnavailable: string;
|
|
266
|
+
includedFeaturesSeeAll: string;
|
|
267
|
+
includedFeaturesHideAll: string;
|
|
268
|
+
includedFeaturesExpires: string;
|
|
269
|
+
includedFeaturesPerLicense: string;
|
|
270
|
+
meteredFeaturesLoading: string;
|
|
271
|
+
meteredFeaturesHeader: string;
|
|
272
|
+
meteredFeaturesError: string;
|
|
273
|
+
meteredFeaturesUnavailable: string;
|
|
274
|
+
meteredFeaturesUsed: string;
|
|
275
|
+
meteredFeaturesIncluded: string;
|
|
276
|
+
meteredFeaturesInUse: string;
|
|
277
|
+
meteredFeaturesLimitOf: string;
|
|
278
|
+
meteredFeaturesNoLimit: string;
|
|
279
|
+
meteredFeaturesAddMore: string;
|
|
280
|
+
meteredFeaturesAdditional: string;
|
|
281
|
+
meteredFeaturesTier: string;
|
|
282
|
+
usageByUserHeader: string;
|
|
283
|
+
usageByUserTotal: string;
|
|
284
|
+
usageByUserError: string;
|
|
285
|
+
usageByUserUnattributed: string;
|
|
286
|
+
usageByUserMore: string;
|
|
287
|
+
usageByUserShowTop: string;
|
|
288
|
+
usageByUserShowAllCount: string;
|
|
289
|
+
usageByUserShowAll: string;
|
|
290
|
+
usageByUserShowFewer: string;
|
|
291
|
+
usageUnits: string;
|
|
292
|
+
usagePerUnit: string;
|
|
293
|
+
usagePerPackage: string;
|
|
294
|
+
usageTierUpTo: string;
|
|
295
|
+
usageTierUnlimited: string;
|
|
296
|
+
usagePerUse: string;
|
|
297
|
+
usageUnlimited: string;
|
|
298
|
+
usageUnitPricePerPeriod: string;
|
|
299
|
+
usagePackagePricePerPeriod: string;
|
|
300
|
+
usageUsed: string;
|
|
301
|
+
usageResets: string;
|
|
302
|
+
usageLimited: string;
|
|
303
|
+
usageUnlimitedUsed: string;
|
|
304
|
+
usageHardLimitLabel: string;
|
|
305
|
+
usageHardLimit: string;
|
|
306
|
+
usageTieredPricingLabel: string;
|
|
307
|
+
usageTiersVolume: string;
|
|
308
|
+
usageTiersGraduated: string;
|
|
309
|
+
periodMonthShort: string;
|
|
310
|
+
periodQuarterShort: string;
|
|
311
|
+
periodYearShort: string;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Display parts for each feature the company is entitled to. Numbers, names
|
|
316
|
+
* and dates arrive formatted; the element owns the wording, keyed by `kind`.
|
|
317
|
+
*/
|
|
318
|
+
/** What the company gets: an allocation, a price, or a tier. */
|
|
319
|
+
export declare type EntitlementText =
|
|
320
|
+
/** "1,000 API calls" — an allocation, a soft limit, or a paid quantity. */
|
|
321
|
+
{
|
|
322
|
+
kind: "units";
|
|
323
|
+
amount: string;
|
|
324
|
+
units: string;
|
|
325
|
+
}
|
|
326
|
+
/** "$0.01 per API call". */
|
|
327
|
+
| {
|
|
328
|
+
kind: "perUnit";
|
|
329
|
+
cost: string;
|
|
330
|
+
unit: string;
|
|
331
|
+
}
|
|
332
|
+
/** "$1.00 per 100 API calls". */
|
|
333
|
+
| {
|
|
334
|
+
kind: "perPackage";
|
|
335
|
+
cost: string;
|
|
336
|
+
size: number;
|
|
337
|
+
units: string;
|
|
338
|
+
}
|
|
339
|
+
/** "Up to 1,000 API calls in this tier". */
|
|
340
|
+
| {
|
|
341
|
+
kind: "tierUpTo";
|
|
342
|
+
amount: string;
|
|
343
|
+
feature: string;
|
|
344
|
+
}
|
|
345
|
+
/** "Unlimited API calls in this tier". */
|
|
346
|
+
| {
|
|
347
|
+
kind: "tierUnlimited";
|
|
348
|
+
feature: string;
|
|
349
|
+
}
|
|
350
|
+
/** "2 credits per use". */
|
|
351
|
+
| {
|
|
352
|
+
kind: "perUse";
|
|
353
|
+
amount: string;
|
|
354
|
+
units: string;
|
|
355
|
+
}
|
|
356
|
+
/** "Unlimited API calls". */
|
|
357
|
+
| {
|
|
358
|
+
kind: "unlimited";
|
|
359
|
+
item: string;
|
|
227
360
|
};
|
|
228
361
|
|
|
362
|
+
export { FEATURE_USER_USAGE_LIMIT }
|
|
363
|
+
|
|
229
364
|
/**
|
|
230
365
|
* The singular or plural name of a feature or credit for a count.
|
|
231
366
|
*
|
|
@@ -240,6 +375,10 @@ export declare function featureName(named: {
|
|
|
240
375
|
pluralName?: string | null;
|
|
241
376
|
}, count?: number, locale?: string): string;
|
|
242
377
|
|
|
378
|
+
export { FeatureUsage }
|
|
379
|
+
|
|
380
|
+
export { FeatureUserUsage }
|
|
381
|
+
|
|
243
382
|
/** Credits per use, readable down to 1e-10 rather than "0" or "1e-10". */
|
|
244
383
|
export declare function formatConsumptionRate(rate: number, locale: string): string;
|
|
245
384
|
|
|
@@ -309,6 +448,84 @@ export declare function httpStatus(error: Error | undefined): number | undefined
|
|
|
309
448
|
*/
|
|
310
449
|
export declare const iconsCss: string;
|
|
311
450
|
|
|
451
|
+
export declare interface IncludedFeatureRow {
|
|
452
|
+
featureId: string;
|
|
453
|
+
name: string;
|
|
454
|
+
description: string | null;
|
|
455
|
+
/** A schematic-icons glyph name; `null` when the feature has none. */
|
|
456
|
+
icon: string | null;
|
|
457
|
+
/** "Includes 10 credits per seat", one per per-license plan grant. */
|
|
458
|
+
perLicenseCredits: PerLicenseCredits[];
|
|
459
|
+
/** When a company override ends; `null` for a plan entitlement. */
|
|
460
|
+
expiresAt: {
|
|
461
|
+
date: Date;
|
|
462
|
+
text: string;
|
|
463
|
+
} | null;
|
|
464
|
+
entitlement: EntitlementText | null;
|
|
465
|
+
usage: UsageSegment[];
|
|
466
|
+
/** Shown when `usage` is empty. */
|
|
467
|
+
usageSummary: UsageSummary | null;
|
|
468
|
+
/**
|
|
469
|
+
* The hard limit, for a numeric entitlement a price behavior bills past;
|
|
470
|
+
* the element shows it only when the host asks.
|
|
471
|
+
*/
|
|
472
|
+
hardLimit: {
|
|
473
|
+
amount: number;
|
|
474
|
+
units: string;
|
|
475
|
+
} | null;
|
|
476
|
+
/** The price's tiers, for a tier-priced row or tiered pay-in-advance. */
|
|
477
|
+
tiers: {
|
|
478
|
+
ranges: TierRange[];
|
|
479
|
+
currency: string;
|
|
480
|
+
mode: "graduated" | "volume" | null;
|
|
481
|
+
/** A period key, for flat tier fees billed per period. */
|
|
482
|
+
period: string | null;
|
|
483
|
+
} | null;
|
|
484
|
+
/** The row as the API sent it, for a host that wants more. */
|
|
485
|
+
source: FeatureUsage;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Every feature the company is entitled to: what it gets, what it has used,
|
|
490
|
+
* and, for a priced feature, what that costs.
|
|
491
|
+
*
|
|
492
|
+
* A company entitled to nothing gets the heading over an empty list. A 404
|
|
493
|
+
* means the account is not enabled for company reads, and the card says so.
|
|
494
|
+
*/
|
|
495
|
+
export declare function IncludedFeatures({ className, headingLevel, locale: localeProp, showCredits, showDescription, showEntitlement, showExpiration, showHardLimit, showHeader, showIcon, showUsage, showWarningThresholdAsLimit, strings, visibleFeatures, }: IncludedFeaturesProps): JSX.Element;
|
|
496
|
+
|
|
497
|
+
export declare namespace IncludedFeatures {
|
|
498
|
+
var resources: readonly ["featureUsage"];
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export declare interface IncludedFeaturesProps extends ElementProps {
|
|
502
|
+
/** The "Included features" heading. Default true. */
|
|
503
|
+
showHeader?: boolean;
|
|
504
|
+
/** Heading level, so the card fits the host's outline. Default 2. */
|
|
505
|
+
headingLevel?: HeadingLevel;
|
|
506
|
+
/** Each feature's icon, where it has one. Default true. */
|
|
507
|
+
showIcon?: boolean;
|
|
508
|
+
/** Each feature's description. Default true. */
|
|
509
|
+
showDescription?: boolean;
|
|
510
|
+
/** When a company override ends. Default true. */
|
|
511
|
+
showExpiration?: boolean;
|
|
512
|
+
/** What the company gets: its allocation, price, or tier. Default true. */
|
|
513
|
+
showEntitlement?: boolean;
|
|
514
|
+
/** What the company has used, its cost, and when it resets. Default true. */
|
|
515
|
+
showUsage?: boolean;
|
|
516
|
+
/** Feature ids to show, in this order; every feature when absent. */
|
|
517
|
+
visibleFeatures?: string[];
|
|
518
|
+
/** The "credits per use" line on credit-burning features. Default true. */
|
|
519
|
+
showCredits?: boolean;
|
|
520
|
+
/** An info tip with the hard limit on features billed past it. Default false. */
|
|
521
|
+
showHardLimit?: boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Show an entitlement's warning threshold in place of its limit, where one
|
|
524
|
+
* is configured. Default false.
|
|
525
|
+
*/
|
|
526
|
+
showWarningThresholdAsLimit?: boolean;
|
|
527
|
+
}
|
|
528
|
+
|
|
312
529
|
/**
|
|
313
530
|
* Fills `{{name}}` placeholders, i18next style. A placeholder with no value
|
|
314
531
|
* is left as written so the omission is visible.
|
|
@@ -386,6 +603,9 @@ export declare interface InvoicesProps extends ElementProps {
|
|
|
386
603
|
query?: InvoiceQuery;
|
|
387
604
|
}
|
|
388
605
|
|
|
606
|
+
/** Tiered when it has more than one tier, or a tiers mode says so. */
|
|
607
|
+
export declare function isTieredPrice(price: MeteredPrice | undefined): boolean;
|
|
608
|
+
|
|
389
609
|
/**
|
|
390
610
|
* `locale` is the language the catalogue is written in, since that decides
|
|
391
611
|
* its plural forms: English for the defaults, the resolved locale for a
|
|
@@ -394,6 +614,189 @@ export declare interface InvoicesProps extends ElementProps {
|
|
|
394
614
|
*/
|
|
395
615
|
export declare function lookup(catalog: StringCatalog | undefined, key: string, vars?: StringVars, locale?: string): string | undefined;
|
|
396
616
|
|
|
617
|
+
export declare interface MeteredFeatureRow {
|
|
618
|
+
featureId: string;
|
|
619
|
+
name: string;
|
|
620
|
+
description: string | null;
|
|
621
|
+
/** A schematic-icons glyph name; `null` when the feature has none. */
|
|
622
|
+
icon: string | null;
|
|
623
|
+
headline: MeteredHeadline | null;
|
|
624
|
+
limit: MeteredLimit | null;
|
|
625
|
+
/** "Resets Oct 1". */
|
|
626
|
+
resetsAt: string | null;
|
|
627
|
+
hardLimit: {
|
|
628
|
+
amount: number;
|
|
629
|
+
units: string;
|
|
630
|
+
} | null;
|
|
631
|
+
meter: MeteredMeter | null;
|
|
632
|
+
priceDetails: MeteredPriceDetails | null;
|
|
633
|
+
/** Paid in advance, so more can be bought. */
|
|
634
|
+
canAddMore: boolean;
|
|
635
|
+
/** Event-based, so its usage breaks down by user. */
|
|
636
|
+
hasUsageByUser: boolean;
|
|
637
|
+
/** The feature's names, for a host labelling amounts itself. */
|
|
638
|
+
unit: {
|
|
639
|
+
name: string;
|
|
640
|
+
singularName?: string;
|
|
641
|
+
pluralName?: string;
|
|
642
|
+
};
|
|
643
|
+
source: FeatureUsage;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* A card per event- or trait-based feature: usage against its limit, what it
|
|
648
|
+
* costs, and who on the team used it.
|
|
649
|
+
*
|
|
650
|
+
* A company with no metered features renders nothing. A 404 means the
|
|
651
|
+
* account is not enabled for company reads, and the element says so.
|
|
652
|
+
*/
|
|
653
|
+
export declare function MeteredFeatures({ addMoreTarget, addMoreUrl, className, headingLevel, locale: localeProp, onAddMore, showAllocation, showCredits, showDescription, showHardLimit, showHeader, showIcon, showMeter, showUsage, showUsageByUser, showWarningThresholdAsLimit, strings, visibleFeatures, }: MeteredFeaturesProps): JSX.Element | null;
|
|
654
|
+
|
|
655
|
+
export declare namespace MeteredFeatures {
|
|
656
|
+
var resources: readonly ["featureUsage"];
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export declare interface MeteredFeaturesProps extends ElementProps {
|
|
660
|
+
/** The "Usage" heading above the cards. Default false, as in the embed. */
|
|
661
|
+
showHeader?: boolean;
|
|
662
|
+
/**
|
|
663
|
+
* Heading level. Feature names sit one level below it, or take it when the
|
|
664
|
+
* heading is hidden. Default 2.
|
|
665
|
+
*/
|
|
666
|
+
headingLevel?: HeadingLevel;
|
|
667
|
+
/** Each feature's icon. Default true. */
|
|
668
|
+
showIcon?: boolean;
|
|
669
|
+
/** Each feature's description. Default true. */
|
|
670
|
+
showDescription?: boolean;
|
|
671
|
+
/** The headline: what is used, or the quantity paid for. Default true. */
|
|
672
|
+
showUsage?: boolean;
|
|
673
|
+
/** The limit line beneath it, and when usage resets. Default true. */
|
|
674
|
+
showAllocation?: boolean;
|
|
675
|
+
/** The usage meter. Default true. */
|
|
676
|
+
showMeter?: boolean;
|
|
677
|
+
/** The breakdown of usage by user, for event-based features. Default true. */
|
|
678
|
+
showUsageByUser?: boolean;
|
|
679
|
+
/** Feature ids to show, in this order; every metered feature when absent. */
|
|
680
|
+
visibleFeatures?: string[];
|
|
681
|
+
/** The "credits per use" line on credit-burning features. Default true. */
|
|
682
|
+
showCredits?: boolean;
|
|
683
|
+
/** An info tip with the hard limit on features billed past it. Default false. */
|
|
684
|
+
showHardLimit?: boolean;
|
|
685
|
+
/**
|
|
686
|
+
* Show an entitlement's warning threshold in place of its limit, where one
|
|
687
|
+
* is configured. Default false.
|
|
688
|
+
*/
|
|
689
|
+
showWarningThresholdAsLimit?: boolean;
|
|
690
|
+
/**
|
|
691
|
+
* Called by "Add More" on a feature paid for in advance. With neither this
|
|
692
|
+
* nor `addMoreUrl`, there is no button.
|
|
693
|
+
*/
|
|
694
|
+
onAddMore?: (feature: FeatureUsage) => void;
|
|
695
|
+
/** "Add More" links here when there is no `onAddMore`. */
|
|
696
|
+
addMoreUrl?: string;
|
|
697
|
+
/** `target` for `addMoreUrl`. */
|
|
698
|
+
addMoreTarget?: string;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* `deriveMeteredFeatures`: each event- or trait-based feature as its card
|
|
703
|
+
* shows it. The wording is the element's, keyed by `kind`; numbers, names and
|
|
704
|
+
* dates are formatted here.
|
|
705
|
+
*/
|
|
706
|
+
/** What is used, or, for a feature paid in advance, what was bought. */
|
|
707
|
+
export declare type MeteredHeadline =
|
|
708
|
+
/** "12 Seats" — a quantity paid for in advance. */
|
|
709
|
+
{
|
|
710
|
+
kind: "quantity";
|
|
711
|
+
amount: string | null;
|
|
712
|
+
units: string;
|
|
713
|
+
}
|
|
714
|
+
/** "1,300 API calls" + "used". */
|
|
715
|
+
| {
|
|
716
|
+
kind: "used";
|
|
717
|
+
amount: string;
|
|
718
|
+
units: string;
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
/** The line under the headline, before "Resets …". */
|
|
722
|
+
export declare type MeteredLimit = {
|
|
723
|
+
kind: "tierUpTo";
|
|
724
|
+
amount: string;
|
|
725
|
+
feature: string;
|
|
726
|
+
} | {
|
|
727
|
+
kind: "tierUnlimited";
|
|
728
|
+
feature: string;
|
|
729
|
+
}
|
|
730
|
+
/** "1,000 included" — an overage's soft limit. */
|
|
731
|
+
| {
|
|
732
|
+
kind: "included";
|
|
733
|
+
amount: string;
|
|
734
|
+
}
|
|
735
|
+
/** "9 used" — how much of a quantity paid for in advance is in use. */
|
|
736
|
+
| {
|
|
737
|
+
kind: "used";
|
|
738
|
+
amount: string;
|
|
739
|
+
}
|
|
740
|
+
/** What pay-as-you-go usage has cost. */
|
|
741
|
+
| {
|
|
742
|
+
kind: "cost";
|
|
743
|
+
cost: string;
|
|
744
|
+
} | {
|
|
745
|
+
kind: "perUse";
|
|
746
|
+
amount: string;
|
|
747
|
+
units: string;
|
|
748
|
+
} | {
|
|
749
|
+
kind: "limitOf";
|
|
750
|
+
amount: string;
|
|
751
|
+
} | {
|
|
752
|
+
kind: "noLimit";
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
export declare interface MeteredMeter {
|
|
756
|
+
value: number;
|
|
757
|
+
total: number;
|
|
758
|
+
/** 0–100. Past an overage's soft limit, the included share of all usage. */
|
|
759
|
+
percent: number;
|
|
760
|
+
tone: MeterTone;
|
|
761
|
+
/** Up to ten fraction digits, as is `totalText`. */
|
|
762
|
+
valueText: string;
|
|
763
|
+
totalText: string;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
export { MeteredPrice }
|
|
767
|
+
|
|
768
|
+
export declare type MeteredPriceDetails = {
|
|
769
|
+
kind: "overage";
|
|
770
|
+
/** The per-unit price past the soft limit. */
|
|
771
|
+
unitPrice: string;
|
|
772
|
+
packageSize: number;
|
|
773
|
+
units: string;
|
|
774
|
+
/** A period key, for a trait billed per period. */
|
|
775
|
+
period: string | null;
|
|
776
|
+
/** Usage past the soft limit, and what it costs. */
|
|
777
|
+
overage: {
|
|
778
|
+
amount: string;
|
|
779
|
+
units: string;
|
|
780
|
+
cost: string;
|
|
781
|
+
};
|
|
782
|
+
} | {
|
|
783
|
+
kind: "tier";
|
|
784
|
+
from: number;
|
|
785
|
+
/** `null` for the last, unbounded tier. */
|
|
786
|
+
to: number | null;
|
|
787
|
+
/** What the usage costs across the tiers; `null` when nothing does. */
|
|
788
|
+
cost: string | null;
|
|
789
|
+
period: string | null;
|
|
790
|
+
tiers: {
|
|
791
|
+
ranges: TierRange[];
|
|
792
|
+
currency: string;
|
|
793
|
+
mode: "graduated" | "volume" | null;
|
|
794
|
+
};
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
/** The fill's colour: by price for tiers and overages, else by share used. */
|
|
798
|
+
export declare type MeterTone = "tier" | "overage" | "ok" | "warning" | "critical";
|
|
799
|
+
|
|
397
800
|
export { PaymentMethod }
|
|
398
801
|
|
|
399
802
|
/**
|
|
@@ -527,6 +930,15 @@ export declare interface PaymentMethodsProps extends ElementProps {
|
|
|
527
930
|
checkoutPrefill?: PaymentMethodsCheckoutPrefill;
|
|
528
931
|
}
|
|
529
932
|
|
|
933
|
+
export { PerLicenseCreditGrant }
|
|
934
|
+
|
|
935
|
+
export declare interface PerLicenseCredits {
|
|
936
|
+
/** Credits per license unit, as the API sends it. */
|
|
937
|
+
amount: number;
|
|
938
|
+
creditName: string;
|
|
939
|
+
licenseName: string;
|
|
940
|
+
}
|
|
941
|
+
|
|
530
942
|
/**
|
|
531
943
|
* `other` is required because every language has it. Supply whichever other
|
|
532
944
|
* categories the language uses: Polish needs `one`, `few`, and `many`;
|
|
@@ -539,6 +951,20 @@ export declare function plural(locale: string, count: number, forms: Partial<Rec
|
|
|
539
951
|
/** The i18next plural suffixes a key can carry. */
|
|
540
952
|
declare type PluralSuffix = "zero" | "one" | "two" | "few" | "many" | "other";
|
|
541
953
|
|
|
954
|
+
/**
|
|
955
|
+
* "month", "quarter" or "year": the period a price is billed per, from its
|
|
956
|
+
* interval and interval count (a quarter is three months). `null` without a
|
|
957
|
+
* price.
|
|
958
|
+
*/
|
|
959
|
+
export declare function pricePeriod(price: MeteredPrice | undefined): string | null;
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* What IncludedFeatures and MeteredFeatures both read off a usage row: its
|
|
963
|
+
* limit, its current price tier, and its billing period. The server has
|
|
964
|
+
* already picked the price and its cost; this only reads them.
|
|
965
|
+
*/
|
|
966
|
+
export declare type PriceTier = MeteredPrice["priceTiers"][number];
|
|
967
|
+
|
|
542
968
|
/**
|
|
543
969
|
* What an element reads from the billing store, declared on the element so
|
|
544
970
|
* a page can prefetch exactly that. `fetchBillingData` has no default set:
|
|
@@ -612,10 +1038,38 @@ export declare type StringOverrides = Partial<ElementStrings> & Partial<Record<`
|
|
|
612
1038
|
/** Interpolation values, and `count` for the plural form. */
|
|
613
1039
|
export declare type StringVars = Record<string, unknown>;
|
|
614
1040
|
|
|
1041
|
+
/** A tier as a range of units, with the price for a unit or the flat fee. */
|
|
1042
|
+
export declare interface TierRange {
|
|
1043
|
+
from: number;
|
|
1044
|
+
/** `null` for the last tier, which has no upper bound. */
|
|
1045
|
+
to: number | null;
|
|
1046
|
+
flatPrice: number | null;
|
|
1047
|
+
/** Minor units, fractional where the provider prices below a cent. */
|
|
1048
|
+
perUnitPrice: number | null;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/** Every tier of the price, the first starting at one unit. */
|
|
1052
|
+
export declare function tierRanges(price: MeteredPrice | undefined): TierRange[];
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* An info glyph that shows `children` while hovered or focused. The trigger
|
|
1056
|
+
* is a button so a keyboard reaches it, and the content describes it so a
|
|
1057
|
+
* screen reader reads it on focus.
|
|
1058
|
+
*/
|
|
1059
|
+
export declare const Tooltip: React_2.FC<{
|
|
1060
|
+
children: React_2.ReactNode;
|
|
1061
|
+
className?: string;
|
|
1062
|
+
/** The trigger's accessible name. */
|
|
1063
|
+
label: string;
|
|
1064
|
+
}>;
|
|
1065
|
+
|
|
615
1066
|
export { Translate }
|
|
616
1067
|
|
|
617
1068
|
export declare type Translator = (key: StringKey, vars?: StringVars) => string;
|
|
618
1069
|
|
|
1070
|
+
/** A unit's price in minor units, the provider's decimal where it has one. */
|
|
1071
|
+
export declare function unitPrice(price: MeteredPrice): number;
|
|
1072
|
+
|
|
619
1073
|
/**
|
|
620
1074
|
* The company's next bill: what it will be charged and when, and the
|
|
621
1075
|
* account balance and discounts that shaped the figure.
|
|
@@ -688,6 +1142,66 @@ export declare interface UpcomingInvoiceFormatters {
|
|
|
688
1142
|
amount?: (amountMinor: number, currency: string, locale: string) => string;
|
|
689
1143
|
}
|
|
690
1144
|
|
|
1145
|
+
/**
|
|
1146
|
+
* The number a row's usage is shown against: the allocation for a row with
|
|
1147
|
+
* no price behavior or one paid in advance, the soft limit for overage, or
|
|
1148
|
+
* the warning threshold when asked for and configured. `null` when none
|
|
1149
|
+
* applies.
|
|
1150
|
+
*/
|
|
1151
|
+
export declare function usageLimit(row: FeatureUsage, options?: UsageLimitOptions): number | null;
|
|
1152
|
+
|
|
1153
|
+
export declare interface UsageLimitOptions {
|
|
1154
|
+
/**
|
|
1155
|
+
* Show the entitlement's warning threshold in place of its limit where one
|
|
1156
|
+
* is configured. In a fair-use setup the limit is the ceiling and the
|
|
1157
|
+
* threshold is the advertised number. Default false.
|
|
1158
|
+
*/
|
|
1159
|
+
showWarningThresholdAsLimit?: boolean;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/** One piece of the usage line; the element joins them with " • ". */
|
|
1163
|
+
export declare type UsageSegment =
|
|
1164
|
+
/** "$0.01/API call/mo" — pay in advance, untiered. */
|
|
1165
|
+
{
|
|
1166
|
+
kind: "unitPricePerPeriod";
|
|
1167
|
+
cost: string;
|
|
1168
|
+
size: number;
|
|
1169
|
+
units: string;
|
|
1170
|
+
/** A period key: "month", "quarter" or "year". */
|
|
1171
|
+
period: string;
|
|
1172
|
+
}
|
|
1173
|
+
/** "1300 API calls used"; the amount is left as the API sends it. */
|
|
1174
|
+
| {
|
|
1175
|
+
kind: "used";
|
|
1176
|
+
amount: string;
|
|
1177
|
+
units: string;
|
|
1178
|
+
}
|
|
1179
|
+
/** "$15.00", with "/mo" for a trait feature billed per period. */
|
|
1180
|
+
| {
|
|
1181
|
+
kind: "cost";
|
|
1182
|
+
cost: string;
|
|
1183
|
+
period: string | null;
|
|
1184
|
+
}
|
|
1185
|
+
/** "Resets Oct 1". */
|
|
1186
|
+
| {
|
|
1187
|
+
kind: "resets";
|
|
1188
|
+
date: string;
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
/** When the usage line has no segments: "1,300 of 5,000 used", or "1,300 used". */
|
|
1192
|
+
export declare type UsageSummary = {
|
|
1193
|
+
kind: "limited";
|
|
1194
|
+
amount: string;
|
|
1195
|
+
allocation: string;
|
|
1196
|
+
} | {
|
|
1197
|
+
kind: "unlimited";
|
|
1198
|
+
amount: string;
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
export { useFeatureUsage }
|
|
1202
|
+
|
|
1203
|
+
export { useFeatureUserUsage }
|
|
1204
|
+
|
|
691
1205
|
export { useInvalidateBillingData }
|
|
692
1206
|
|
|
693
1207
|
export { useInvoices }
|
|
@@ -703,6 +1217,8 @@ export { usePaymentMethods }
|
|
|
703
1217
|
*/
|
|
704
1218
|
export declare function useResolvedLocale(locale?: string): string;
|
|
705
1219
|
|
|
1220
|
+
export { UserUsage }
|
|
1221
|
+
|
|
706
1222
|
export { useSchematicI18n }
|
|
707
1223
|
|
|
708
1224
|
export { useSchematicLocale }
|