@schematichq/schematic-components 2.32.0 → 2.34.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 +2490 -409
- package/dist/schematic-components-elements.d.ts +605 -11
- package/dist/schematic-components-elements.esm.js +2466 -370
- package/dist/schematic-components.browser.cjs.js +859 -215
- package/dist/schematic-components.browser.esm.js +859 -215
- package/dist/schematic-components.cjs.js +859 -215
- package/dist/schematic-components.d.ts +127 -0
- package/dist/schematic-components.esm.js +859 -215
- package/package.json +10 -10
|
@@ -4,6 +4,16 @@ import { BillingDataProvider } from '@schematichq/schematic-react';
|
|
|
4
4
|
import { BillingDataProviderProps } from '@schematichq/schematic-react';
|
|
5
5
|
import { BillingDataStatus } from '@schematichq/schematic-react';
|
|
6
6
|
import { BillingResourceName } from '@schematichq/schematic-react';
|
|
7
|
+
import { Company } from '@schematichq/schematic-react';
|
|
8
|
+
import { CompanyPlan } from '@schematichq/schematic-react';
|
|
9
|
+
import { CompanySubscription } from '@schematichq/schematic-react';
|
|
10
|
+
import { CreditAutoTopup } from '@schematichq/schematic-react';
|
|
11
|
+
import { CreditBalanceEntry } from '@schematichq/schematic-react';
|
|
12
|
+
import { CreditComposition } from '@schematichq/schematic-react';
|
|
13
|
+
import { CreditGrant } from '@schematichq/schematic-react';
|
|
14
|
+
import { CreditUserUsage } from '@schematichq/schematic-react';
|
|
15
|
+
import { CreditUserUsageRow } from '@schematichq/schematic-react';
|
|
16
|
+
import { CustomPlanBilling } from '@schematichq/schematic-react';
|
|
7
17
|
import { Discount } from '@schematichq/schematic-react';
|
|
8
18
|
import { FEATURE_USER_USAGE_LIMIT } from '@schematichq/schematic-react';
|
|
9
19
|
import { FeatureUsage } from '@schematichq/schematic-react';
|
|
@@ -20,13 +30,18 @@ import { PerLicenseCreditGrant } from '@schematichq/schematic-react';
|
|
|
20
30
|
import { default as React_2 } from 'react';
|
|
21
31
|
import { ResourceHandle } from '@schematichq/schematic-react';
|
|
22
32
|
import { ResourceState } from '@schematichq/schematic-react';
|
|
33
|
+
import { ScheduledDowngrade } from '@schematichq/schematic-react';
|
|
23
34
|
import { SchematicI18nConfig } from '@schematichq/schematic-react';
|
|
24
35
|
import { SchematicI18nProvider } from '@schematichq/schematic-react';
|
|
25
36
|
import { SchematicI18nProviderProps } from '@schematichq/schematic-react';
|
|
26
37
|
import { SetupIntent } from '@schematichq/schematic-react';
|
|
27
38
|
import { SetupIntentHandle } from '@schematichq/schematic-react';
|
|
28
39
|
import type { Translate } from '@schematichq/schematic-react';
|
|
40
|
+
import { UnsubscribeHandle } from '@schematichq/schematic-react';
|
|
29
41
|
import { UpcomingInvoice } from '@schematichq/schematic-react';
|
|
42
|
+
import { useCompany } from '@schematichq/schematic-react';
|
|
43
|
+
import { useCreditBalances } from '@schematichq/schematic-react';
|
|
44
|
+
import { useCreditUserUsage } from '@schematichq/schematic-react';
|
|
30
45
|
import { useFeatureUsage } from '@schematichq/schematic-react';
|
|
31
46
|
import { useFeatureUserUsage } from '@schematichq/schematic-react';
|
|
32
47
|
import { useInvalidateBillingData } from '@schematichq/schematic-react';
|
|
@@ -38,8 +53,21 @@ import { useSchematicLocale } from '@schematichq/schematic-react';
|
|
|
38
53
|
import { useSchematicStrings } from '@schematichq/schematic-react';
|
|
39
54
|
import { useSchematicTranslate } from '@schematichq/schematic-react';
|
|
40
55
|
import { useSetupIntent } from '@schematichq/schematic-react';
|
|
56
|
+
import { useUnsubscribe } from '@schematichq/schematic-react';
|
|
41
57
|
import { useUpcomingInvoice } from '@schematichq/schematic-react';
|
|
42
58
|
|
|
59
|
+
export declare type AutoTopupLine = {
|
|
60
|
+
kind: "disabled";
|
|
61
|
+
creditId: string;
|
|
62
|
+
unit: string;
|
|
63
|
+
} | {
|
|
64
|
+
kind: "adds";
|
|
65
|
+
creditId: string;
|
|
66
|
+
amount: string;
|
|
67
|
+
unit: string;
|
|
68
|
+
threshold: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
43
71
|
export { BillingActions }
|
|
44
72
|
|
|
45
73
|
export { BillingData }
|
|
@@ -66,6 +94,150 @@ export declare interface BillLine {
|
|
|
66
94
|
amountText: string;
|
|
67
95
|
}
|
|
68
96
|
|
|
97
|
+
export { Company }
|
|
98
|
+
|
|
99
|
+
export { CompanyPlan }
|
|
100
|
+
|
|
101
|
+
export { CompanySubscription }
|
|
102
|
+
|
|
103
|
+
export { CreditAutoTopup }
|
|
104
|
+
|
|
105
|
+
export { CreditBalanceEntry }
|
|
106
|
+
|
|
107
|
+
export { CreditComposition }
|
|
108
|
+
|
|
109
|
+
export declare interface CreditCompositionLine {
|
|
110
|
+
/** Credits per period in all. */
|
|
111
|
+
total: string;
|
|
112
|
+
creditName: string;
|
|
113
|
+
/** A period key: "day", "week", "month" or "year". */
|
|
114
|
+
period: string;
|
|
115
|
+
/** "12 Seats × 10". */
|
|
116
|
+
perLicense: {
|
|
117
|
+
quantity: string;
|
|
118
|
+
licenseName: string;
|
|
119
|
+
perUnit: string;
|
|
120
|
+
};
|
|
121
|
+
/** The flat company grant on top; `null` when there is none. */
|
|
122
|
+
companyGrant: string | null;
|
|
123
|
+
/** "1st", "22nd": the day of the month the next bill is due. */
|
|
124
|
+
renewsOn: string | null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { CreditGrant }
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* `deriveCreditUsage`: the company's credit balances as the cards show them,
|
|
131
|
+
* with numbers, names and dates formatted here. The wording is the
|
|
132
|
+
* element's, keyed by `kind`.
|
|
133
|
+
*/
|
|
134
|
+
/** Why credits were granted, as the ledger words it. */
|
|
135
|
+
export declare type CreditGrantKind = "plan" | "bundle" | "autoTopup" | "promotional";
|
|
136
|
+
|
|
137
|
+
/** Grants of one credit from one bundle, or one grant outside a bundle. */
|
|
138
|
+
export declare interface CreditGroupRow {
|
|
139
|
+
key: string;
|
|
140
|
+
/** Live grants in the group. */
|
|
141
|
+
count: number;
|
|
142
|
+
bundleName: string | null;
|
|
143
|
+
/** The newest grant's quantity. */
|
|
144
|
+
quantity: string;
|
|
145
|
+
creditName: string;
|
|
146
|
+
/** Credits spent; `null` at 0, which shows nothing. */
|
|
147
|
+
used: string | null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export declare interface CreditLedgerRow {
|
|
151
|
+
id: string;
|
|
152
|
+
kind: CreditGrantKind;
|
|
153
|
+
/** Credits granted. */
|
|
154
|
+
amount: string;
|
|
155
|
+
/** The credit's name for `amount`; a bundle is named in the singular. */
|
|
156
|
+
item: string;
|
|
157
|
+
/** "Sep 1, 2026". */
|
|
158
|
+
createdAt: string;
|
|
159
|
+
/** When the grant refreshes, or when it runs out; `null` for neither. */
|
|
160
|
+
date: {
|
|
161
|
+
kind: "resets" | "expires";
|
|
162
|
+
text: string;
|
|
163
|
+
} | null;
|
|
164
|
+
source: CreditGrant;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The company's credit balances, a card each: what is left, the grants
|
|
169
|
+
* behind it, how the plan's grants add up, and who on the team spent it.
|
|
170
|
+
*
|
|
171
|
+
* A company with no credits, and a plan that draws on none, renders
|
|
172
|
+
* nothing. A 404 means the account is not enabled for company reads, and
|
|
173
|
+
* the element says so.
|
|
174
|
+
*/
|
|
175
|
+
export declare function CreditUsage({ buyMoreTarget, buyMoreUrl, className, headingLevel, locale: localeProp, onBuyMore, showDescription, showExpiration, showHeader, showIcon, showUsage, showUsageByUser, strings, visibleCredits, }: CreditUsageProps): JSX.Element | null;
|
|
176
|
+
|
|
177
|
+
export declare namespace CreditUsage {
|
|
178
|
+
var resources: readonly ["creditBalances"];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export declare interface CreditUsageProps extends ElementProps {
|
|
182
|
+
/** The "Credits" heading above the cards. Default false, as in the embed. */
|
|
183
|
+
showHeader?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Heading level; each credit's name sits one below while the heading
|
|
186
|
+
* shows, and takes it when the heading is hidden. Names stay h6 under an
|
|
187
|
+
* h6 heading, as HTML has no h7. Default 2.
|
|
188
|
+
*/
|
|
189
|
+
headingLevel?: HeadingLevel;
|
|
190
|
+
/** Each credit's icon; the circle is held even without one. Default true. */
|
|
191
|
+
showIcon?: boolean;
|
|
192
|
+
/** Each credit's description. Default true. */
|
|
193
|
+
showDescription?: boolean;
|
|
194
|
+
/** When each grant expires or resets, in its balance details. Default true. */
|
|
195
|
+
showExpiration?: boolean;
|
|
196
|
+
/** What is left of each credit. Default true. */
|
|
197
|
+
showUsage?: boolean;
|
|
198
|
+
/** The breakdown of consumption by user. Default true. */
|
|
199
|
+
showUsageByUser?: boolean;
|
|
200
|
+
/** Credit ids to show, in this order; every credit when absent. */
|
|
201
|
+
visibleCredits?: string[];
|
|
202
|
+
/**
|
|
203
|
+
* "Buy More" on a credit a bundle sells calls this. Without it or
|
|
204
|
+
* `buyMoreUrl` there is no button.
|
|
205
|
+
*/
|
|
206
|
+
onBuyMore?: (credit: CreditBalanceEntry) => void;
|
|
207
|
+
/** "Buy More" links here when there is no `onBuyMore`. */
|
|
208
|
+
buyMoreUrl?: string;
|
|
209
|
+
/** `target` for `buyMoreUrl`. */
|
|
210
|
+
buyMoreTarget?: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export declare interface CreditUsageRow {
|
|
214
|
+
creditId: string;
|
|
215
|
+
name: string;
|
|
216
|
+
description: string | null;
|
|
217
|
+
/** A schematic-icons glyph name; `null` when the credit has none. */
|
|
218
|
+
icon: string | null;
|
|
219
|
+
/** What is left, to ten fraction digits, and the credit's name for it. */
|
|
220
|
+
remaining: {
|
|
221
|
+
amount: string;
|
|
222
|
+
units: string;
|
|
223
|
+
};
|
|
224
|
+
purchasable: boolean;
|
|
225
|
+
/** Newest first. Empty for a plan credit the company holds none of. */
|
|
226
|
+
ledger: CreditLedgerRow[];
|
|
227
|
+
composition: CreditCompositionLine | null;
|
|
228
|
+
/** The credit's names, for a host labelling amounts itself. */
|
|
229
|
+
unit: {
|
|
230
|
+
name: string;
|
|
231
|
+
singularName?: string;
|
|
232
|
+
pluralName?: string;
|
|
233
|
+
};
|
|
234
|
+
source: CreditBalanceEntry;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export { CreditUserUsage }
|
|
238
|
+
|
|
239
|
+
export { CreditUserUsageRow }
|
|
240
|
+
|
|
69
241
|
/**
|
|
70
242
|
* The tier a row's usage sits in. For overage, the tier past the soft limit
|
|
71
243
|
* of a two-tier price, which is how an overage price is built; for tiered
|
|
@@ -73,6 +245,8 @@ export declare interface BillLine {
|
|
|
73
245
|
*/
|
|
74
246
|
export declare function currentTier(row: FeatureUsage): TierRange | null;
|
|
75
247
|
|
|
248
|
+
export { CustomPlanBilling }
|
|
249
|
+
|
|
76
250
|
/**
|
|
77
251
|
* The English copy, and the fallback for anything a host does not answer.
|
|
78
252
|
* It is a plain resource bundle, so it can be registered as one:
|
|
@@ -89,6 +263,14 @@ export declare function currentTier(row: FeatureUsage): TierRange | null;
|
|
|
89
263
|
*/
|
|
90
264
|
export declare const DEFAULT_STRINGS: ElementStrings & StringCatalog;
|
|
91
265
|
|
|
266
|
+
export declare function deriveCreditUsage(balances: CreditBalanceEntry[], options: DeriveCreditUsageOptions): CreditUsageRow[];
|
|
267
|
+
|
|
268
|
+
export declare interface DeriveCreditUsageOptions {
|
|
269
|
+
locale: string;
|
|
270
|
+
/** Credit ids to show, in this order; every credit when absent. */
|
|
271
|
+
visibleCredits?: string[];
|
|
272
|
+
}
|
|
273
|
+
|
|
92
274
|
export declare interface DerivedPaymentMethods {
|
|
93
275
|
/** Every method, in the order the server gave. */
|
|
94
276
|
rows: PaymentMethodRow[];
|
|
@@ -142,6 +324,34 @@ export declare interface DerivePaymentMethodsOptions {
|
|
|
142
324
|
now?: Date;
|
|
143
325
|
}
|
|
144
326
|
|
|
327
|
+
export declare function derivePlanManager(data: {
|
|
328
|
+
company: Company;
|
|
329
|
+
creditBalances: CreditBalanceEntry[];
|
|
330
|
+
featureUsage: FeatureUsage[];
|
|
331
|
+
}, options: DerivePlanManagerOptions): PlanManagerView;
|
|
332
|
+
|
|
333
|
+
export declare interface DerivePlanManagerOptions extends UsageLimitOptions {
|
|
334
|
+
locale: string;
|
|
335
|
+
/** What "Trial ends in" counts down from. Default now. */
|
|
336
|
+
now?: Date;
|
|
337
|
+
/** Credit-burning features' "credits per use". Default true. */
|
|
338
|
+
showCredits?: boolean;
|
|
339
|
+
/** A plan priced at zero reads "Free". Default false. */
|
|
340
|
+
showZeroPriceAsFree?: boolean;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Whether there is a subscription to cancel, when access ends, and what
|
|
345
|
+
* cancelling stops charging for.
|
|
346
|
+
*/
|
|
347
|
+
export declare function deriveUnsubscribe(company: Company, featureUsage: FeatureUsage[], options: DeriveUnsubscribeOptions): UnsubscribeView;
|
|
348
|
+
|
|
349
|
+
export declare interface DeriveUnsubscribeOptions {
|
|
350
|
+
locale: string;
|
|
351
|
+
/** Used when the next bill date is unknown. Defaults to now. */
|
|
352
|
+
now?: Date;
|
|
353
|
+
}
|
|
354
|
+
|
|
145
355
|
export declare function deriveUpcomingInvoice(invoice: UpcomingInvoice, options: DeriveUpcomingInvoiceOptions): UpcomingBillSummary;
|
|
146
356
|
|
|
147
357
|
export declare interface DeriveUpcomingInvoiceOptions {
|
|
@@ -279,6 +489,87 @@ export declare type ElementStrings = {
|
|
|
279
489
|
meteredFeaturesAddMore: string;
|
|
280
490
|
meteredFeaturesAdditional: string;
|
|
281
491
|
meteredFeaturesTier: string;
|
|
492
|
+
creditUsageLoading: string;
|
|
493
|
+
creditUsageHeader: string;
|
|
494
|
+
creditUsageError: string;
|
|
495
|
+
creditUsageUnavailable: string;
|
|
496
|
+
creditUsageRemaining: string;
|
|
497
|
+
creditUsageBuyMore: string;
|
|
498
|
+
creditUsageSeeDetails: string;
|
|
499
|
+
creditUsageHideDetails: string;
|
|
500
|
+
creditUsageSeeAll: string;
|
|
501
|
+
creditUsageHideAll: string;
|
|
502
|
+
creditUsageGrantPlan: string;
|
|
503
|
+
creditUsageGrantBundle: string;
|
|
504
|
+
creditUsageGrantAutoTopup: string;
|
|
505
|
+
creditUsageGrantPromotional: string;
|
|
506
|
+
creditUsageResets: string;
|
|
507
|
+
creditUsageExpires: string;
|
|
508
|
+
creditUsageComposition: string;
|
|
509
|
+
creditUsageCompositionWithGrant: string;
|
|
510
|
+
creditUsagePerLicense: string;
|
|
511
|
+
creditUsageCompanyGrant: string;
|
|
512
|
+
creditUsageRenewsOn: string;
|
|
513
|
+
planManagerLoading: string;
|
|
514
|
+
planManagerError: string;
|
|
515
|
+
planManagerUnavailable: string;
|
|
516
|
+
planManagerTrialEndsIn: string;
|
|
517
|
+
planManagerTrialEndsSoon: string;
|
|
518
|
+
planManagerTrialEnded: string;
|
|
519
|
+
planManagerDays: string;
|
|
520
|
+
planManagerHours: string;
|
|
521
|
+
planManagerMinutes: string;
|
|
522
|
+
planManagerCanceled: string;
|
|
523
|
+
planManagerAccessEnds: string;
|
|
524
|
+
planManagerPlanFallback: string;
|
|
525
|
+
planManagerCustomAwaiting: string;
|
|
526
|
+
planManagerCustomAwaitingDescription: string;
|
|
527
|
+
planManagerCustomDue: string;
|
|
528
|
+
planManagerCustomDueDescription: string;
|
|
529
|
+
planManagerYourPlan: string;
|
|
530
|
+
planManagerPayNow: string;
|
|
531
|
+
planManagerDowngradeScheduled: string;
|
|
532
|
+
planManagerUsageBased: string;
|
|
533
|
+
planManagerFree: string;
|
|
534
|
+
planManagerAddOns: string;
|
|
535
|
+
planManagerAdditional: string;
|
|
536
|
+
planManagerTierBased: string;
|
|
537
|
+
planManagerCreditsInPlan: string;
|
|
538
|
+
planManagerCreditsError: string;
|
|
539
|
+
planManagerCreditsLoading: string;
|
|
540
|
+
planManagerTopUps: string;
|
|
541
|
+
planManagerCreditBundles: string;
|
|
542
|
+
planManagerPromotionalCredits: string;
|
|
543
|
+
planManagerChangePlan: string;
|
|
544
|
+
planManagerCredits: string;
|
|
545
|
+
planManagerCreditsPerPeriod: string;
|
|
546
|
+
planManagerCreditsPerLicense: string;
|
|
547
|
+
planManagerCreditsPlusPerPeriod: string;
|
|
548
|
+
planManagerLicensesTimesCredits: string;
|
|
549
|
+
planManagerLicensesTimesCreditsPlusCompany: string;
|
|
550
|
+
planManagerUsed: string;
|
|
551
|
+
planManagerAutoTopup: string;
|
|
552
|
+
planManagerAutoTopupDisabled: string;
|
|
553
|
+
planManagerAutoTopupAdds: string;
|
|
554
|
+
planManagerAutoTopupTip: string;
|
|
555
|
+
planManagerEdit: string;
|
|
556
|
+
planManagerSeeAll: string;
|
|
557
|
+
planManagerHideAll: string;
|
|
558
|
+
unsubscribeButton: string;
|
|
559
|
+
unsubscribeTitle: string;
|
|
560
|
+
unsubscribeAccessUntil: string;
|
|
561
|
+
unsubscribeNotReady: string;
|
|
562
|
+
unsubscribeManagePlan: string;
|
|
563
|
+
unsubscribePlan: string;
|
|
564
|
+
unsubscribeAddOns: string;
|
|
565
|
+
unsubscribeMonthlyTotal: string;
|
|
566
|
+
unsubscribeQuarterlyTotal: string;
|
|
567
|
+
unsubscribeYearlyTotal: string;
|
|
568
|
+
unsubscribeConfirm: string;
|
|
569
|
+
unsubscribeFailed: string;
|
|
570
|
+
unsubscribeClose: string;
|
|
571
|
+
unsubscribeError: string;
|
|
572
|
+
unsubscribeUnavailable: string;
|
|
282
573
|
usageByUserHeader: string;
|
|
283
574
|
usageByUserTotal: string;
|
|
284
575
|
usageByUserError: string;
|
|
@@ -309,6 +600,11 @@ export declare type ElementStrings = {
|
|
|
309
600
|
periodMonthShort: string;
|
|
310
601
|
periodQuarterShort: string;
|
|
311
602
|
periodYearShort: string;
|
|
603
|
+
periodDay: string;
|
|
604
|
+
periodWeek: string;
|
|
605
|
+
periodMonth: string;
|
|
606
|
+
periodQuarter: string;
|
|
607
|
+
periodYear: string;
|
|
312
608
|
};
|
|
313
609
|
|
|
314
610
|
/**
|
|
@@ -333,7 +629,7 @@ export declare type EntitlementText =
|
|
|
333
629
|
| {
|
|
334
630
|
kind: "perPackage";
|
|
335
631
|
cost: string;
|
|
336
|
-
size:
|
|
632
|
+
size: string;
|
|
337
633
|
units: string;
|
|
338
634
|
}
|
|
339
635
|
/** "Up to 1,000 API calls in this tier". */
|
|
@@ -426,7 +722,7 @@ export declare function formatPercent(fraction: number, locale: string): string;
|
|
|
426
722
|
export declare function formatShortDate(date: Date, locale: string): string;
|
|
427
723
|
|
|
428
724
|
/** Heading level an element's own heading renders at. Default 2. */
|
|
429
|
-
export declare type HeadingLevel = 2 | 3 | 4 | 5 | 6;
|
|
725
|
+
export declare type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
430
726
|
|
|
431
727
|
/**
|
|
432
728
|
* The HTTP status behind a failed billing read, or `undefined` for anything
|
|
@@ -470,7 +766,7 @@ export declare interface IncludedFeatureRow {
|
|
|
470
766
|
* the element shows it only when the host asks.
|
|
471
767
|
*/
|
|
472
768
|
hardLimit: {
|
|
473
|
-
amount:
|
|
769
|
+
amount: string;
|
|
474
770
|
units: string;
|
|
475
771
|
} | null;
|
|
476
772
|
/** The price's tiers, for a tier-priced row or tiered pay-in-advance. */
|
|
@@ -625,7 +921,7 @@ export declare interface MeteredFeatureRow {
|
|
|
625
921
|
/** "Resets Oct 1". */
|
|
626
922
|
resetsAt: string | null;
|
|
627
923
|
hardLimit: {
|
|
628
|
-
amount:
|
|
924
|
+
amount: string;
|
|
629
925
|
units: string;
|
|
630
926
|
} | null;
|
|
631
927
|
meter: MeteredMeter | null;
|
|
@@ -769,7 +1065,8 @@ export declare type MeteredPriceDetails = {
|
|
|
769
1065
|
kind: "overage";
|
|
770
1066
|
/** The per-unit price past the soft limit. */
|
|
771
1067
|
unitPrice: string;
|
|
772
|
-
|
|
1068
|
+
/** "100" for a package price; `null` for a price per unit. */
|
|
1069
|
+
packageSize: string | null;
|
|
773
1070
|
units: string;
|
|
774
1071
|
/** A period key, for a trait billed per period. */
|
|
775
1072
|
period: string | null;
|
|
@@ -781,9 +1078,9 @@ export declare type MeteredPriceDetails = {
|
|
|
781
1078
|
};
|
|
782
1079
|
} | {
|
|
783
1080
|
kind: "tier";
|
|
784
|
-
from:
|
|
1081
|
+
from: string;
|
|
785
1082
|
/** `null` for the last, unbounded tier. */
|
|
786
|
-
to:
|
|
1083
|
+
to: string | null;
|
|
787
1084
|
/** What the usage costs across the tiers; `null` when nothing does. */
|
|
788
1085
|
cost: string | null;
|
|
789
1086
|
period: string | null;
|
|
@@ -933,12 +1230,204 @@ export declare interface PaymentMethodsProps extends ElementProps {
|
|
|
933
1230
|
export { PerLicenseCreditGrant }
|
|
934
1231
|
|
|
935
1232
|
export declare interface PerLicenseCredits {
|
|
936
|
-
|
|
937
|
-
amount: number;
|
|
1233
|
+
amount: string;
|
|
938
1234
|
creditName: string;
|
|
939
1235
|
licenseName: string;
|
|
940
1236
|
}
|
|
941
1237
|
|
|
1238
|
+
export declare interface PlanAddOnRow {
|
|
1239
|
+
id: string;
|
|
1240
|
+
name: string;
|
|
1241
|
+
/** `null` when the add-on is not billed. */
|
|
1242
|
+
price: {
|
|
1243
|
+
amount: string;
|
|
1244
|
+
/** A period key, or "one-time". */
|
|
1245
|
+
period: string;
|
|
1246
|
+
} | null;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
export declare interface PlanCreditRow {
|
|
1250
|
+
creditId: string;
|
|
1251
|
+
text: {
|
|
1252
|
+
kind: "perLicense";
|
|
1253
|
+
amount: string;
|
|
1254
|
+
creditName: string;
|
|
1255
|
+
licenseName: string;
|
|
1256
|
+
/** The flat company grant on top, per period; `null` without one. */
|
|
1257
|
+
plus: {
|
|
1258
|
+
amount: string;
|
|
1259
|
+
creditName: string;
|
|
1260
|
+
period: string;
|
|
1261
|
+
} | null;
|
|
1262
|
+
} | {
|
|
1263
|
+
kind: "total";
|
|
1264
|
+
amount: string;
|
|
1265
|
+
creditName: string;
|
|
1266
|
+
/** A period key; `null` without a subscription. */
|
|
1267
|
+
period: string | null;
|
|
1268
|
+
};
|
|
1269
|
+
/** Credits spent; `null` at 0, which shows nothing. */
|
|
1270
|
+
used: string | null;
|
|
1271
|
+
/** The tip on the used count when the credit tops itself up. */
|
|
1272
|
+
autoTopup: {
|
|
1273
|
+
amount: string;
|
|
1274
|
+
threshold: string;
|
|
1275
|
+
} | null;
|
|
1276
|
+
/** "12 Seats × 10 = 120 credits/mo". */
|
|
1277
|
+
composition: {
|
|
1278
|
+
quantity: string;
|
|
1279
|
+
licenseName: string;
|
|
1280
|
+
perUnit: string;
|
|
1281
|
+
/** The flat company grant; `null` without one. */
|
|
1282
|
+
fixed: string | null;
|
|
1283
|
+
total: string;
|
|
1284
|
+
creditName: string;
|
|
1285
|
+
/** A period key: "day", "week", "month" or "year". */
|
|
1286
|
+
period: string;
|
|
1287
|
+
} | null;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* The company's plan: a notice about where its subscription is headed, the
|
|
1292
|
+
* plan and its price, its add-ons, its usage-based features, and the
|
|
1293
|
+
* credits the plan and the company's purchases bring.
|
|
1294
|
+
*
|
|
1295
|
+
* It reads the company, its usage and its credits. It waits for the company
|
|
1296
|
+
* and its usage, and for its credits unless `showCredits` is off. A 404
|
|
1297
|
+
* means the account is not enabled for company reads, and the card says so.
|
|
1298
|
+
* Credits that fail to load cost only the credit sections, which show the
|
|
1299
|
+
* error in their place.
|
|
1300
|
+
*/
|
|
1301
|
+
export declare function PlanManager({ changePlanTarget, changePlanUrl, className, editAutoTopupTarget, editAutoTopupUrl, headingLevel, locale: localeProp, onChangePlan, onEditAutoTopup, showAddOns, showCredits, showDescription, showHardLimit, showHeader, showLabels, showNotice, showPrice, showUsageBased, showWarningThresholdAsLimit, showZeroPriceAsFree, strings, }: PlanManagerProps): JSX.Element;
|
|
1302
|
+
|
|
1303
|
+
export declare namespace PlanManager {
|
|
1304
|
+
var resources: readonly ["company", "featureUsage", "creditBalances"];
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
export declare interface PlanManagerProps extends ElementProps {
|
|
1308
|
+
/** Heading level of the plan's name. Default 2. */
|
|
1309
|
+
headingLevel?: HeadingLevel;
|
|
1310
|
+
/**
|
|
1311
|
+
* The notice above the plan: a trial, a cancellation, a custom plan's
|
|
1312
|
+
* invoice or a scheduled downgrade. Default true.
|
|
1313
|
+
*/
|
|
1314
|
+
showNotice?: boolean;
|
|
1315
|
+
/** The plan's name, description and price. Default true. */
|
|
1316
|
+
showHeader?: boolean;
|
|
1317
|
+
/** The plan's description. Default true. */
|
|
1318
|
+
showDescription?: boolean;
|
|
1319
|
+
/** The plan's price. Default true. */
|
|
1320
|
+
showPrice?: boolean;
|
|
1321
|
+
/** The add-ons the company holds. Default true. */
|
|
1322
|
+
showAddOns?: boolean;
|
|
1323
|
+
/** The usage-based features and their prices. Default true. */
|
|
1324
|
+
showUsageBased?: boolean;
|
|
1325
|
+
/**
|
|
1326
|
+
* Every credit section — the plan's credits, top-ups, bundles and
|
|
1327
|
+
* promotional credits — and the "credits per use" on credit-burning
|
|
1328
|
+
* features. Default true.
|
|
1329
|
+
*/
|
|
1330
|
+
showCredits?: boolean;
|
|
1331
|
+
/** Each section's label. Default true. */
|
|
1332
|
+
showLabels?: boolean;
|
|
1333
|
+
/** A plan priced at zero reads "Free". Default false. */
|
|
1334
|
+
showZeroPriceAsFree?: boolean;
|
|
1335
|
+
/** An info tip with the hard limit on features billed past it. Default false. */
|
|
1336
|
+
showHardLimit?: boolean;
|
|
1337
|
+
/**
|
|
1338
|
+
* Show an entitlement's warning threshold in place of its limit, where one
|
|
1339
|
+
* is configured. Default false.
|
|
1340
|
+
*/
|
|
1341
|
+
showWarningThresholdAsLimit?: boolean;
|
|
1342
|
+
/** "Change plan" calls this. Without it or `changePlanUrl` there is no button. */
|
|
1343
|
+
onChangePlan?: () => void;
|
|
1344
|
+
/** "Change plan" links here when there is no `onChangePlan`. */
|
|
1345
|
+
changePlanUrl?: string;
|
|
1346
|
+
/** `target` for `changePlanUrl`. */
|
|
1347
|
+
changePlanTarget?: string;
|
|
1348
|
+
/**
|
|
1349
|
+
* "Edit" on the auto top-up settings calls this. Without it or
|
|
1350
|
+
* `editAutoTopupUrl` there is no button.
|
|
1351
|
+
*/
|
|
1352
|
+
onEditAutoTopup?: () => void;
|
|
1353
|
+
/** "Edit" links here when there is no `onEditAutoTopup`. */
|
|
1354
|
+
editAutoTopupUrl?: string;
|
|
1355
|
+
/** `target` for `editAutoTopupUrl`. */
|
|
1356
|
+
editAutoTopupTarget?: string;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
export declare interface PlanManagerView {
|
|
1360
|
+
notice: PlanNotice | null;
|
|
1361
|
+
/** `null` when the company has no plan. */
|
|
1362
|
+
plan: {
|
|
1363
|
+
name: string;
|
|
1364
|
+
description: string | null;
|
|
1365
|
+
/** `null` when the plan is not billed. */
|
|
1366
|
+
price: PlanPrice | null;
|
|
1367
|
+
} | null;
|
|
1368
|
+
addOns: PlanAddOnRow[];
|
|
1369
|
+
usageBased: UsageBasedRow[];
|
|
1370
|
+
planCredits: PlanCreditRow[];
|
|
1371
|
+
/** The self-service auto top-up box; `null` when no plan credit offers it. */
|
|
1372
|
+
autoTopup: {
|
|
1373
|
+
lines: AutoTopupLine[];
|
|
1374
|
+
} | null;
|
|
1375
|
+
topUps: CreditGroupRow[];
|
|
1376
|
+
bundles: CreditGroupRow[];
|
|
1377
|
+
promotional: CreditGroupRow[];
|
|
1378
|
+
/** A custom plan awaiting payment to activate has no plan to change yet. */
|
|
1379
|
+
canChangePlan: boolean;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* `derivePlanManager`: the company, its usage and its credits as the plan
|
|
1384
|
+
* manager shows them. The wording is the element's, keyed by `kind`;
|
|
1385
|
+
* numbers, names and dates are formatted here.
|
|
1386
|
+
*/
|
|
1387
|
+
export declare type PlanNotice = {
|
|
1388
|
+
kind: "trial";
|
|
1389
|
+
/**
|
|
1390
|
+
* Whole days, else hours or minutes; `"soon"` inside the last minute,
|
|
1391
|
+
* which a rendered page would not count down; `"ended"` once the end
|
|
1392
|
+
* has passed but the subscription still reads as trialing (a late
|
|
1393
|
+
* webhook, stale data, a page left open); `null` without an end.
|
|
1394
|
+
*/
|
|
1395
|
+
endsIn: {
|
|
1396
|
+
amount: number;
|
|
1397
|
+
unit: TrialUnit;
|
|
1398
|
+
} | "soon" | "ended" | null;
|
|
1399
|
+
} | {
|
|
1400
|
+
kind: "canceled";
|
|
1401
|
+
/** The plan's name; `null` when the company has none. */
|
|
1402
|
+
planName: string | null;
|
|
1403
|
+
/** "October 1, 2026"; `null` without a cancellation date. */
|
|
1404
|
+
date: string | null;
|
|
1405
|
+
} | {
|
|
1406
|
+
kind: "customPlanBilling";
|
|
1407
|
+
/** The plan activates on payment, rather than ending without it. */
|
|
1408
|
+
awaitingActivation: boolean;
|
|
1409
|
+
planName: string | null;
|
|
1410
|
+
date: string;
|
|
1411
|
+
invoiceUrl: string | null;
|
|
1412
|
+
} | {
|
|
1413
|
+
kind: "scheduledDowngrade";
|
|
1414
|
+
fromPlanName: string;
|
|
1415
|
+
toPlanName: string;
|
|
1416
|
+
/** When the current period ends; `null` when it is not known. */
|
|
1417
|
+
date: string | null;
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1420
|
+
export declare type PlanPrice = {
|
|
1421
|
+
kind: "usageBased";
|
|
1422
|
+
} | {
|
|
1423
|
+
kind: "free";
|
|
1424
|
+
} | {
|
|
1425
|
+
kind: "amount";
|
|
1426
|
+
amount: string;
|
|
1427
|
+
/** A period key: "month", "quarter", "year"; `null` when free or unknown. */
|
|
1428
|
+
period: string | null;
|
|
1429
|
+
};
|
|
1430
|
+
|
|
942
1431
|
/**
|
|
943
1432
|
* `other` is required because every language has it. Supply whichever other
|
|
944
1433
|
* categories the language uses: Polish needs `one`, `few`, and `many`;
|
|
@@ -985,6 +1474,8 @@ export { ResourceHandle }
|
|
|
985
1474
|
|
|
986
1475
|
export { ResourceState }
|
|
987
1476
|
|
|
1477
|
+
export { ScheduledDowngrade }
|
|
1478
|
+
|
|
988
1479
|
/**
|
|
989
1480
|
* Every token the stylesheet can reference, with the value used when the
|
|
990
1481
|
* host sets none. Adding a token here is what makes it usable in the CSS;
|
|
@@ -1067,9 +1558,59 @@ export { Translate }
|
|
|
1067
1558
|
|
|
1068
1559
|
export declare type Translator = (key: StringKey, vars?: StringVars) => string;
|
|
1069
1560
|
|
|
1561
|
+
export declare type TrialUnit = "day" | "hour" | "minute";
|
|
1562
|
+
|
|
1070
1563
|
/** A unit's price in minor units, the provider's decimal where it has one. */
|
|
1071
1564
|
export declare function unitPrice(price: MeteredPrice): number;
|
|
1072
1565
|
|
|
1566
|
+
/**
|
|
1567
|
+
* Cancels the subscription at period end after a confirmation dialog.
|
|
1568
|
+
*
|
|
1569
|
+
* Renders nothing until the company and its usage load, or once there is no
|
|
1570
|
+
* subscription left to cancel.
|
|
1571
|
+
*/
|
|
1572
|
+
export declare function UnsubscribeButton({ className, locale: localeProp, managePlanTarget, managePlanUrl, onManagePlan, onUnsubscribed, strings, }: UnsubscribeButtonProps): JSX.Element | null;
|
|
1573
|
+
|
|
1574
|
+
export declare namespace UnsubscribeButton {
|
|
1575
|
+
var resources: readonly ["company", "featureUsage"];
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
export declare interface UnsubscribeButtonProps extends ElementProps {
|
|
1579
|
+
/**
|
|
1580
|
+
* Handles "Manage plan" in the dialog. Without this or `managePlanUrl`,
|
|
1581
|
+
* the dialog hides "Manage plan".
|
|
1582
|
+
*/
|
|
1583
|
+
onManagePlan?: () => void;
|
|
1584
|
+
/** "Manage plan" links here when there is no `onManagePlan`. */
|
|
1585
|
+
managePlanUrl?: string;
|
|
1586
|
+
/** `target` for the `managePlanUrl` link. */
|
|
1587
|
+
managePlanTarget?: string;
|
|
1588
|
+
/** Called once the subscription is set to cancel. */
|
|
1589
|
+
onUnsubscribed?: () => void;
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
export { UnsubscribeHandle }
|
|
1593
|
+
|
|
1594
|
+
export declare interface UnsubscribeView {
|
|
1595
|
+
/** A subscription exists and is not already set to end. */
|
|
1596
|
+
canUnsubscribe: boolean;
|
|
1597
|
+
accessEndsOn: string;
|
|
1598
|
+
period: string;
|
|
1599
|
+
plan: {
|
|
1600
|
+
name: string;
|
|
1601
|
+
price: string | null;
|
|
1602
|
+
} | null;
|
|
1603
|
+
addOns: {
|
|
1604
|
+
id: string;
|
|
1605
|
+
name: string;
|
|
1606
|
+
price: string;
|
|
1607
|
+
/** Left out of the recurring total. */
|
|
1608
|
+
oneTime: boolean;
|
|
1609
|
+
}[];
|
|
1610
|
+
/** Recurring cost per `period`: the plan, recurring add-ons, and pay-in-advance usage. */
|
|
1611
|
+
total: string;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1073
1614
|
/**
|
|
1074
1615
|
* The company's next bill: what it will be charged and when, and the
|
|
1075
1616
|
* account balance and discounts that shaped the figure.
|
|
@@ -1142,6 +1683,50 @@ export declare interface UpcomingInvoiceFormatters {
|
|
|
1142
1683
|
amount?: (amountMinor: number, currency: string, locale: string) => string;
|
|
1143
1684
|
}
|
|
1144
1685
|
|
|
1686
|
+
export declare interface UsageBasedRow {
|
|
1687
|
+
featureId: string;
|
|
1688
|
+
name: string;
|
|
1689
|
+
/** The limit the feature is shown against; `null` shows the name alone. */
|
|
1690
|
+
quantity: {
|
|
1691
|
+
amount: string;
|
|
1692
|
+
units: string;
|
|
1693
|
+
} | null;
|
|
1694
|
+
/** Overage: the price is for usage past the limit. */
|
|
1695
|
+
additional: boolean;
|
|
1696
|
+
tierBased: boolean;
|
|
1697
|
+
/** Pay-as-you-go and overage: the price of a unit, or of a package. */
|
|
1698
|
+
unitPrice: {
|
|
1699
|
+
cost: string;
|
|
1700
|
+
/** More than one unit to a package; `null` for a single unit. */
|
|
1701
|
+
packageSize: string | null;
|
|
1702
|
+
units: string;
|
|
1703
|
+
/** A period key for a trait-based feature; `null` otherwise. */
|
|
1704
|
+
period: string | null;
|
|
1705
|
+
} | null;
|
|
1706
|
+
/** Credit burndown: credits consumed per use. */
|
|
1707
|
+
perUse: {
|
|
1708
|
+
amount: string;
|
|
1709
|
+
units: string;
|
|
1710
|
+
} | null;
|
|
1711
|
+
/** Paid in advance: what the allocation costs per period. */
|
|
1712
|
+
cost: {
|
|
1713
|
+
amount: string;
|
|
1714
|
+
period: string | null;
|
|
1715
|
+
} | null;
|
|
1716
|
+
tiers: {
|
|
1717
|
+
currency: string;
|
|
1718
|
+
mode: "graduated" | "volume" | null;
|
|
1719
|
+
period: string | null;
|
|
1720
|
+
ranges: TierRange[];
|
|
1721
|
+
unit: string;
|
|
1722
|
+
} | null;
|
|
1723
|
+
hardLimit: {
|
|
1724
|
+
amount: string;
|
|
1725
|
+
units: string;
|
|
1726
|
+
} | null;
|
|
1727
|
+
source: FeatureUsage;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1145
1730
|
/**
|
|
1146
1731
|
* The number a row's usage is shown against: the allocation for a row with
|
|
1147
1732
|
* no price behavior or one paid in advance, the soft limit for overage, or
|
|
@@ -1165,12 +1750,13 @@ export declare type UsageSegment =
|
|
|
1165
1750
|
{
|
|
1166
1751
|
kind: "unitPricePerPeriod";
|
|
1167
1752
|
cost: string;
|
|
1168
|
-
|
|
1753
|
+
/** "100" for a package price; `null` for a price per unit. */
|
|
1754
|
+
size: string | null;
|
|
1169
1755
|
units: string;
|
|
1170
1756
|
/** A period key: "month", "quarter" or "year". */
|
|
1171
1757
|
period: string;
|
|
1172
1758
|
}
|
|
1173
|
-
/** "
|
|
1759
|
+
/** "1,300 API calls used". */
|
|
1174
1760
|
| {
|
|
1175
1761
|
kind: "used";
|
|
1176
1762
|
amount: string;
|
|
@@ -1198,6 +1784,12 @@ export declare type UsageSummary = {
|
|
|
1198
1784
|
amount: string;
|
|
1199
1785
|
};
|
|
1200
1786
|
|
|
1787
|
+
export { useCompany }
|
|
1788
|
+
|
|
1789
|
+
export { useCreditBalances }
|
|
1790
|
+
|
|
1791
|
+
export { useCreditUserUsage }
|
|
1792
|
+
|
|
1201
1793
|
export { useFeatureUsage }
|
|
1202
1794
|
|
|
1203
1795
|
export { useFeatureUserUsage }
|
|
@@ -1241,6 +1833,8 @@ export { useSetupIntent }
|
|
|
1241
1833
|
*/
|
|
1242
1834
|
export declare function useTranslator(overrides?: StringOverrides, locale?: string): Translator;
|
|
1243
1835
|
|
|
1836
|
+
export { useUnsubscribe }
|
|
1837
|
+
|
|
1244
1838
|
export { useUpcomingInvoice }
|
|
1245
1839
|
|
|
1246
1840
|
/** Not for a server render or its hydration; `useResolvedLocale` reads it
|