@schematichq/schematic-components 2.34.1 → 2.36.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.
@@ -4,6 +4,22 @@ 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 { Catalog } from '@schematichq/schematic-react';
8
+ import { CatalogAutoTopup } from '@schematichq/schematic-react';
9
+ import { CatalogCheckoutField } from '@schematichq/schematic-react';
10
+ import { CatalogCreditBundle } from '@schematichq/schematic-react';
11
+ import { CatalogEntitlement } from '@schematichq/schematic-react';
12
+ import { CatalogPlan } from '@schematichq/schematic-react';
13
+ import { CatalogQuery } from '@schematichq/schematic-react';
14
+ import { CatalogView } from '@schematichq/schematic-react';
15
+ import type { Checkout as Checkout_2 } from '@schematichq/schematic-react';
16
+ import { CheckoutHandle } from '@schematichq/schematic-react';
17
+ import { CheckoutPriceSnapshot } from '@schematichq/schematic-react';
18
+ import { CheckoutProblem } from '@schematichq/schematic-react';
19
+ import { CheckoutProblemCode } from '@schematichq/schematic-react';
20
+ import { checkoutProblemsOf } from '@schematichq/schematic-react';
21
+ import { CheckoutResult } from '@schematichq/schematic-react';
22
+ import { CheckoutSelections } from '@schematichq/schematic-react';
7
23
  import { Company } from '@schematichq/schematic-react';
8
24
  import { CompanyPlan } from '@schematichq/schematic-react';
9
25
  import { CompanySubscription } from '@schematichq/schematic-react';
@@ -27,6 +43,8 @@ import { MeteredPrice } from '@schematichq/schematic-react';
27
43
  import { PaymentMethod } from '@schematichq/schematic-react';
28
44
  import { PaymentMethodsHandle } from '@schematichq/schematic-react';
29
45
  import { PerLicenseCreditGrant } from '@schematichq/schematic-react';
46
+ import { PublicCatalog } from '@schematichq/schematic-react';
47
+ import { PublicCatalogPlan } from '@schematichq/schematic-react';
30
48
  import { default as React_2 } from 'react';
31
49
  import { ResourceHandle } from '@schematichq/schematic-react';
32
50
  import { ResourceState } from '@schematichq/schematic-react';
@@ -36,9 +54,15 @@ import { SchematicI18nProvider } from '@schematichq/schematic-react';
36
54
  import { SchematicI18nProviderProps } from '@schematichq/schematic-react';
37
55
  import { SetupIntent } from '@schematichq/schematic-react';
38
56
  import { SetupIntentHandle } from '@schematichq/schematic-react';
57
+ import { TaxId } from '@schematichq/schematic-react';
58
+ import { TaxIdInput } from '@schematichq/schematic-react';
59
+ import { TaxIdsHandle } from '@schematichq/schematic-react';
39
60
  import type { Translate } from '@schematichq/schematic-react';
40
61
  import { UnsubscribeHandle } from '@schematichq/schematic-react';
41
62
  import { UpcomingInvoice } from '@schematichq/schematic-react';
63
+ import { useCatalog } from '@schematichq/schematic-react';
64
+ import { useCheckout } from '@schematichq/schematic-react';
65
+ import { UseCheckoutOptions } from '@schematichq/schematic-react';
42
66
  import { useCompany } from '@schematichq/schematic-react';
43
67
  import { useCreditBalances } from '@schematichq/schematic-react';
44
68
  import { useCreditUserUsage } from '@schematichq/schematic-react';
@@ -53,9 +77,19 @@ import { useSchematicLocale } from '@schematichq/schematic-react';
53
77
  import { useSchematicStrings } from '@schematichq/schematic-react';
54
78
  import { useSchematicTranslate } from '@schematichq/schematic-react';
55
79
  import { useSetupIntent } from '@schematichq/schematic-react';
80
+ import { useTaxIds } from '@schematichq/schematic-react';
56
81
  import { useUnsubscribe } from '@schematichq/schematic-react';
57
82
  import { useUpcomingInvoice } from '@schematichq/schematic-react';
58
83
 
84
+ declare type AnyPlan = CatalogPlan | PublicCatalogPlan;
85
+
86
+ /** A company's own automatic top-up for one of the plan's credits. */
87
+ export declare interface AutoTopupChoice {
88
+ enabled?: boolean;
89
+ thresholdCredits?: number;
90
+ amount?: number;
91
+ }
92
+
59
93
  export declare type AutoTopupLine = {
60
94
  kind: "disabled";
61
95
  creditId: string;
@@ -68,6 +102,16 @@ export declare type AutoTopupLine = {
68
102
  threshold: string;
69
103
  };
70
104
 
105
+ export declare interface AutoTopupRow {
106
+ grantId: string;
107
+ creditName: string;
108
+ enabled: boolean;
109
+ thresholdCredits: number | null;
110
+ amount: number | null;
111
+ /** What one top-up costs at the credit's price; `null` when it is unpriced. */
112
+ costText: string | null;
113
+ }
114
+
71
115
  export { BillingActions }
72
116
 
73
117
  export { BillingData }
@@ -94,6 +138,437 @@ export declare interface BillLine {
94
138
  amountText: string;
95
139
  }
96
140
 
141
+ export declare interface BundleRow {
142
+ id: string;
143
+ name: string;
144
+ /** Credits one purchase grants; `null` for a bundle bought by the credit. */
145
+ credits: number | null;
146
+ creditName: string;
147
+ priceText: string | null;
148
+ quantity: number;
149
+ }
150
+
151
+ export declare type CartAction = {
152
+ type: "plan";
153
+ planId: string | undefined;
154
+ } | {
155
+ type: "period";
156
+ period: CheckoutPeriod;
157
+ } | {
158
+ type: "currency";
159
+ currency: string;
160
+ } | {
161
+ type: "addOn";
162
+ addOnId: string;
163
+ selected: boolean;
164
+ } | {
165
+ type: "quantity";
166
+ featureId: string;
167
+ quantity: number;
168
+ } | {
169
+ type: "bundle";
170
+ bundleId: string;
171
+ quantity: number;
172
+ } | {
173
+ type: "autoTopup";
174
+ grantId: string;
175
+ choice: AutoTopupChoice;
176
+ } | {
177
+ type: "promoCode";
178
+ promoCode: string | undefined;
179
+ } | {
180
+ type: "trial";
181
+ trial: boolean;
182
+ } | {
183
+ type: "customField";
184
+ fieldId: string;
185
+ value: string;
186
+ } | {
187
+ type: "paymentMethod";
188
+ paymentMethodId: string | undefined;
189
+ } | {
190
+ type: "optIn";
191
+ accepted: boolean;
192
+ };
193
+
194
+ export declare function cartReducer(cart: CheckoutCart, action: CartAction): CheckoutCart;
195
+
196
+ export { Catalog }
197
+
198
+ export { CatalogAutoTopup }
199
+
200
+ export { CatalogCheckoutField }
201
+
202
+ export { CatalogCreditBundle }
203
+
204
+ export { CatalogEntitlement }
205
+
206
+ /** The name the catalog gives a plan or add-on; `undefined` for one it does not sell. */
207
+ export declare function catalogName(catalog: Catalog, planId: string | null | undefined): string | undefined;
208
+
209
+ export { CatalogPlan }
210
+
211
+ /**
212
+ * What the catalog sells at a price: the plan or add-on whose own price it
213
+ * is, or the feature a pay-in-advance entitlement prices, in the plural;
214
+ * `undefined` for a price the catalog does not carry.
215
+ */
216
+ export declare function catalogPriceName(catalog: Catalog, priceId: string | null | undefined): string | undefined;
217
+
218
+ export { CatalogQuery }
219
+
220
+ export { CatalogView }
221
+
222
+ /**
223
+ * A purchase in a dialog: the plan and its period, add-ons, pay-in-advance
224
+ * quantities, credit bundles and automatic top-ups, then payment. Each change
225
+ * is priced on the server, which decides what it costs and what is wrong with
226
+ * it; the dialog decides only the order the choices are asked in.
227
+ *
228
+ * Nothing loads while it is closed, and every opening starts a new cart from
229
+ * `selection` and what the company has now.
230
+ */
231
+ export declare function Checkout({ className, display, locale: localeProp, onOpenChange, open, strings, ...rest }: CheckoutProps): React_2.JSX.Element;
232
+
233
+ export declare namespace Checkout {
234
+ var resources: readonly ["catalog", "company", "paymentMethods", "featureUsage"];
235
+ }
236
+
237
+ /**
238
+ * What the customer has chosen, before the server prices it. The server
239
+ * never sees this shape: `checkoutSelections` turns it into the cart the API
240
+ * reads, and the server's answer is the only source of prices and problems.
241
+ */
242
+ export declare interface CheckoutCart {
243
+ /** `undefined` is no plan: none chosen yet, or a purchase of bundles alone. */
244
+ planId: string | undefined;
245
+ period: CheckoutPeriod;
246
+ /** Lowercase ISO 4217. */
247
+ currency: string;
248
+ addOnIds: string[];
249
+ /** Pay-in-advance quantities by feature id. */
250
+ quantities: Record<string, number>;
251
+ /** Credit bundle counts by bundle id; zero is not bought. */
252
+ bundles: Record<string, number>;
253
+ /** The company's own top-ups, by plan credit grant id. */
254
+ autoTopup: Record<string, AutoTopupChoice>;
255
+ promoCode: string | undefined;
256
+ /** Start a trial when the plan offers one. */
257
+ trial: boolean;
258
+ /** Custom checkout field values by field id. */
259
+ customFields: Record<string, string>;
260
+ /** The provider's id of the method to pay with. */
261
+ paymentMethodId: string | undefined;
262
+ optInAccepted: boolean;
263
+ }
264
+
265
+ /** Shared by `<Checkout />` and `useCheckoutLauncher().open(config)`. */
266
+ export declare interface CheckoutConfig {
267
+ selection?: CheckoutSelection;
268
+ steps?: CheckoutSteps;
269
+ display?: CheckoutDisplay;
270
+ /** Read `GET /catalogs/{catalog_id}/view` rather than the environment's catalog. */
271
+ catalogId?: string;
272
+ }
273
+
274
+ export declare interface CheckoutDisplay {
275
+ /** Month, quarter and year choices on the plan step. Default true. */
276
+ showPeriodToggle?: boolean;
277
+ /** A currency choice when the catalog sells in more than one. Default true. */
278
+ showCurrencySelector?: boolean;
279
+ /** The line under the total about how the charge renews. Default true. */
280
+ showBillingDisclaimer?: boolean;
281
+ /** The currencies to offer, in order; the first is the default. */
282
+ currencies?: readonly string[];
283
+ /**
284
+ * How the steps and the summary sit. `"auto"` (default): the summary
285
+ * beside the steps from 768px up, under them below. `"stacked"`: under
286
+ * them at every width, and the whole dialog scrolls. The root carries
287
+ * `schematic-checkout--stacked` for a sheet of your own.
288
+ */
289
+ layout?: "auto" | "stacked";
290
+ /**
291
+ * When the summary is shown. `"always"` (default), or `"payment"`: on the
292
+ * payment step alone; the steps before it carry their Next action in
293
+ * `.schematic-checkout__nav`, and the layout carries `data-summary`.
294
+ */
295
+ summary?: "always" | "payment";
296
+ /**
297
+ * Where the checkout renders. `"dialog"` (default): a modal over the page.
298
+ * `"inline"`: in the page, where the host puts it, with no backdrop and no
299
+ * close control; the root carries `schematic-checkout--inline`. `open`
300
+ * still says whether it renders at all.
301
+ */
302
+ container?: "dialog" | "inline";
303
+ }
304
+
305
+ export { CheckoutHandle }
306
+
307
+ /** Opens the one `<Checkout />` a `CheckoutLauncherProvider` renders. */
308
+ export declare interface CheckoutLauncher {
309
+ /** Opens a new checkout on `config` over the provider's `defaults`. */
310
+ open: (config?: CheckoutConfig) => void;
311
+ close: () => void;
312
+ isOpen: boolean;
313
+ }
314
+
315
+ /**
316
+ * Renders one `<Checkout />` and hands `useCheckoutLauncher` below it the way
317
+ * to open it, so a plan card, an upgrade prompt or a "buy more" link can start
318
+ * a purchase without holding the dialog's state. Every open starts a new cart.
319
+ */
320
+ export declare function CheckoutLauncherProvider({ children, defaults, onOpenChange, ...props }: CheckoutLauncherProviderProps): React_2.JSX.Element;
321
+
322
+ export declare interface CheckoutLauncherProviderProps extends Omit<CheckoutProps, "open" | "onOpenChange" | keyof CheckoutConfig> {
323
+ /** Under every `open(config)`, section by section. */
324
+ defaults?: CheckoutConfig;
325
+ onOpenChange?: (open: boolean) => void;
326
+ children?: React_2.ReactNode;
327
+ }
328
+
329
+ export declare interface CheckoutModel {
330
+ currency: {
331
+ value: string;
332
+ options: string[];
333
+ /** Fixed by the subscription. */
334
+ locked: boolean;
335
+ /** More than one on offer, and the host shows the choice. */
336
+ selectable: boolean;
337
+ };
338
+ period: {
339
+ value: CheckoutPeriod;
340
+ /** The periods the chosen plan, else any plan, is sold on. */
341
+ options: CheckoutPeriod[];
342
+ selectable: boolean;
343
+ /**
344
+ * The longer period the chosen plan costs less on than monthly, and by
345
+ * what share, while it is not the one chosen; `null` when there is none.
346
+ */
347
+ savings: {
348
+ period: "quarter" | "year";
349
+ percentText: string;
350
+ } | null;
351
+ };
352
+ plans: PlanRow[];
353
+ /**
354
+ * The catalog's custom plan, offered as a link to ask rather than a
355
+ * choice; `null` when it offers none.
356
+ */
357
+ customPlan: {
358
+ ctaText: string | null;
359
+ ctaUrl: string | null;
360
+ priceText: string | null;
361
+ } | null;
362
+ /** Where a company a downgrade rule stops goes to ask; `null` when the catalog names nowhere. */
363
+ downgradeContact: {
364
+ url: string;
365
+ text: string | null;
366
+ } | null;
367
+ addOns: PlanRow[];
368
+ usage: QuantityRow[];
369
+ addOnUsage: QuantityRow[];
370
+ bundles: BundleRow[];
371
+ /** One bundle at a time, or a count of each. */
372
+ bundleMode: "individual" | "quantity";
373
+ autoTopups: AutoTopupRow[];
374
+ /** What the cart holds, at catalog prices. */
375
+ lines: SummaryLine[];
376
+ /** The server's totals; `null` until the cart has been priced. */
377
+ totals: CheckoutTotals | null;
378
+ /** A trial starts with this purchase. */
379
+ trial: boolean;
380
+ /** There is something to price. */
381
+ priceable: boolean;
382
+ problems: CheckoutProblems;
383
+ /** What the card form collects beside the card. */
384
+ collect: {
385
+ address: boolean;
386
+ email: boolean;
387
+ phone: boolean;
388
+ };
389
+ /** What the payment step collects. */
390
+ requirements: {
391
+ collectTaxId: boolean;
392
+ customFields: {
393
+ id: string;
394
+ name: string;
395
+ helperText: string | null;
396
+ required: boolean;
397
+ value: string;
398
+ }[];
399
+ optIn: {
400
+ required: boolean;
401
+ title: string | null;
402
+ text: string | null;
403
+ };
404
+ paymentMethodRequired: boolean;
405
+ };
406
+ /** Whether the checkout may be finalized as it stands. */
407
+ canFinalize: boolean;
408
+ }
409
+
410
+ /**
411
+ * Which price in a catalog a cart means. The catalog prices a plan once per
412
+ * billing period and currency, a pay-in-advance entitlement the same way, and
413
+ * a credit bundle once per currency; these find the one a cart selects, and
414
+ * never substitute another period's or another currency's.
415
+ */
416
+ /** A billing period a subscription renews on. */
417
+ export declare type CheckoutPeriod = "month" | "quarter" | "year";
418
+
419
+ export { CheckoutPriceSnapshot }
420
+
421
+ export { CheckoutProblem }
422
+
423
+ export { CheckoutProblemCode }
424
+
425
+ declare interface CheckoutProblems {
426
+ /** Problems about one step, keyed by it. */
427
+ byStep: Partial<Record<CheckoutStep, CheckoutProblem[]>>;
428
+ /** Problems about the checkout as a whole. */
429
+ global: CheckoutProblem[];
430
+ /** Any problem that stops a finalize. */
431
+ blocking: boolean;
432
+ }
433
+
434
+ export { checkoutProblemsOf }
435
+
436
+ export declare interface CheckoutProps extends ElementProps, CheckoutConfig {
437
+ open: boolean;
438
+ /** Called with `false` when the customer closes the dialog or the purchase completes. */
439
+ onOpenChange: (open: boolean) => void;
440
+ /**
441
+ * After the purchase is charged, and confirmed with the customer where the
442
+ * payment needed it. The billing data it changed is already reloading.
443
+ */
444
+ onComplete?: (result: CheckoutResult) => void;
445
+ /** Each time the server's list of what is wrong with the cart changes. */
446
+ onProblems?: (problems: readonly CheckoutProblem[]) => void;
447
+ onStepChange?: (step: CheckoutStep) => void;
448
+ /**
449
+ * The words a problem is shown in; `undefined` shows the server's message.
450
+ * `problem.code` says which problem it is.
451
+ */
452
+ formatProblem?: ProblemFormatter;
453
+ /** Values the card form starts with. */
454
+ checkoutPrefill?: PaymentMethodsCheckoutPrefill;
455
+ }
456
+
457
+ /**
458
+ * The proration itemized, as the server breaks it down: what is given back,
459
+ * what is owed, and when the net is charged.
460
+ */
461
+ export declare interface CheckoutProration {
462
+ lines: ProrationLine[];
463
+ /** The credit lines' sum; `null` when nothing is given back. */
464
+ creditText: string | null;
465
+ /** The charge lines' sum; `null` when nothing is owed. */
466
+ chargeText: string | null;
467
+ totalText: string;
468
+ /** Charged now, on the next invoice, or not at all. */
469
+ timing: "now" | "at_renewal" | "none";
470
+ /** The next invoice's day, for a proration charged at the renewal. */
471
+ billedAtText: string | null;
472
+ }
473
+
474
+ export { CheckoutResult }
475
+
476
+ /** What the cart starts with. Read when the checkout opens; the customer edits from there. */
477
+ export declare interface CheckoutSelection {
478
+ /**
479
+ * The plan to start on. Left out, the company's current plan — unless it
480
+ * could start a trial on it, when it chooses. `null` is no plan: a
481
+ * purchase of credit bundles alone.
482
+ */
483
+ planId?: string | null;
484
+ /** The billing period. Left out, the subscription's, else monthly. */
485
+ period?: CheckoutPeriod;
486
+ /**
487
+ * ISO 4217, any case. Ignored when the subscription's currency fixes it or
488
+ * the catalog does not sell in it.
489
+ */
490
+ currency?: string;
491
+ /** The add-ons to start with. Left out, the ones the company holds. */
492
+ addOnIds?: string[];
493
+ /**
494
+ * Pay-in-advance quantities, by feature id, for the plan and add-ons alike.
495
+ * Left out, what the company has now; clamped to whole numbers from zero.
496
+ */
497
+ quantities?: Record<string, number>;
498
+ /** Credit bundles by bundle id; a bundle bought one at a time takes any count above zero as one. */
499
+ creditBundles?: Record<string, number>;
500
+ /** Automatic top-ups the company chooses, by plan credit grant id. */
501
+ autoTopup?: Record<string, AutoTopupChoice>;
502
+ promoCode?: string;
503
+ /** Start a trial when the plan offers one and the company can take it. Default true. */
504
+ trial?: boolean;
505
+ /** Custom checkout field values by field id; win over the company's saved ones. */
506
+ customFields?: Record<string, string>;
507
+ }
508
+
509
+ /**
510
+ * The cart a card's action opens a checkout on. A checkout starts from the
511
+ * add-ons it is given, so every add-on action restates the whole list. An
512
+ * add-on chosen or changed takes the card's period, which the checkout
513
+ * applies to the whole subscription. The public catalog holds nothing, so
514
+ * its carts are only good before sign-in.
515
+ */
516
+ export declare function checkoutSelectionFor(view: PricingTableView, card: PricingCard, kind: "plan" | "addOn"): CheckoutSelection;
517
+
518
+ export { CheckoutSelections }
519
+
520
+ /**
521
+ * The cart as the API reads it, or `undefined` when there is nothing to
522
+ * price: no plan priced in the cart's period and currency, and no bundles
523
+ * to buy on their own.
524
+ */
525
+ export declare function checkoutSelections(cart: CheckoutCart, catalog: Catalog, company?: Company): CheckoutSelections | undefined;
526
+
527
+ /**
528
+ * What `<Checkout />` opens with and how it walks, as plain data: the props
529
+ * the element takes, and what `useCheckoutLauncher().open(config)` hands it.
530
+ */
531
+ /** A step of the checkout, in the order they can appear. */
532
+ export declare type CheckoutStep = "plan" | "autoTopup" | "usage" | "addOns" | "addOnUsage" | "credits" | "payment";
533
+
534
+ export declare interface CheckoutSteps {
535
+ /**
536
+ * Steps passed over when their requirement is already met. A step whose
537
+ * requirement is not met — no plan resolves, or a blocking problem points
538
+ * at it — is shown anyway.
539
+ */
540
+ skip?: readonly SkippableStep[];
541
+ /**
542
+ * Leave skipped steps out of the step list. Default false: they stay
543
+ * listed, and choosing one returns to it.
544
+ */
545
+ hideSkipped?: boolean;
546
+ /** Open here, before skipping. A step the checkout does not have falls back to the first. */
547
+ initial?: CheckoutStep;
548
+ }
549
+
550
+ export declare interface CheckoutTotals {
551
+ dueNowText: string;
552
+ /** What renews each period; `null` for a purchase that does not renew. */
553
+ totalPerPeriodText: string | null;
554
+ /** The credit or charge for the time left on the current subscription. */
555
+ prorationText: string | null;
556
+ /** The same, itemized, when the server breaks it down; `null` otherwise. */
557
+ proration: CheckoutProration | null;
558
+ /** What discounts took off, as a deduction. */
559
+ discountText: string | null;
560
+ taxText: string | null;
561
+ /** What the company's stored credit covers of what is due, as a deduction. */
562
+ creditAppliedText: string | null;
563
+ /** The credit left for later invoices once this one lands. */
564
+ creditRemainingText: string | null;
565
+ promoCodeApplied: boolean;
566
+ /** The day a trial ends and the first charge lands. */
567
+ trialEndText: string | null;
568
+ /** The change waits for the period to end rather than landing now. */
569
+ scheduledChangeText: string | null;
570
+ }
571
+
97
572
  export { Company }
98
573
 
99
574
  export { CompanyPlan }
@@ -263,6 +738,21 @@ export { CustomPlanBilling }
263
738
  */
264
739
  export declare const DEFAULT_STRINGS: ElementStrings & StringCatalog;
265
740
 
741
+ export declare function deriveCheckout(input: DeriveCheckoutInput): CheckoutModel;
742
+
743
+ export declare interface DeriveCheckoutInput {
744
+ catalog: Catalog;
745
+ company?: Company;
746
+ featureUsage?: FeatureUsage[];
747
+ cart: CheckoutCart;
748
+ /** The checkout as the server last priced it. */
749
+ checkout?: Checkout_2;
750
+ /** A write is in flight or waiting. */
751
+ isPricing?: boolean;
752
+ display?: CheckoutDisplay;
753
+ locale: string;
754
+ }
755
+
266
756
  export declare function deriveCreditUsage(balances: CreditBalanceEntry[], options: DeriveCreditUsageOptions): CreditUsageRow[];
267
757
 
268
758
  export declare interface DeriveCreditUsageOptions {
@@ -340,6 +830,32 @@ export declare interface DerivePlanManagerOptions extends UsageLimitOptions {
340
830
  showZeroPriceAsFree?: boolean;
341
831
  }
342
832
 
833
+ export declare function derivePricingTable(view: CatalogView, options: DerivePricingTableOptions): PricingTableView;
834
+
835
+ export declare interface DerivePricingTableOptions {
836
+ locale: string;
837
+ /** The period asked for; one the catalog does not offer falls back. */
838
+ period?: PricingPeriod;
839
+ /** The currency asked for; one the catalog does not offer falls back. */
840
+ currency?: string;
841
+ /**
842
+ * The company, for the period its subscription bills in: the current
843
+ * plan is current only in that period, and it is the default one.
844
+ */
845
+ company?: Company;
846
+ /** Included credits on each card. Default true. */
847
+ showCredits?: boolean;
848
+ /** A plan priced at zero reads "Free". Default false. */
849
+ showZeroPriceAsFree?: boolean;
850
+ /**
851
+ * Show an entitlement's warning threshold in place of its limit, where one
852
+ * is configured. Default false.
853
+ */
854
+ showWarningThresholdAsLimit?: boolean;
855
+ /** For the trial countdown; the clock otherwise. */
856
+ now?: Date;
857
+ }
858
+
343
859
  /**
344
860
  * Whether there is a subscription to cancel, when access ends, and what
345
861
  * cancelling stops charging for.
@@ -555,6 +1071,51 @@ export declare type ElementStrings = {
555
1071
  planManagerEdit: string;
556
1072
  planManagerSeeAll: string;
557
1073
  planManagerHideAll: string;
1074
+ pricingTableLoading: string;
1075
+ pricingTableError: string;
1076
+ pricingTableUnavailable: string;
1077
+ pricingTablePlans: string;
1078
+ pricingTableAddOns: string;
1079
+ pricingTableCurrency: string;
1080
+ pricingTablePeriod: string;
1081
+ pricingTableBilledMonthly: string;
1082
+ pricingTableBilledQuarterly: string;
1083
+ pricingTableBilledYearly: string;
1084
+ pricingTableFree: string;
1085
+ pricingTableUsageBased: string;
1086
+ pricingTableCustomPlan: string;
1087
+ pricingTableCustomPrice: string;
1088
+ pricingTableTalkToSupport: string;
1089
+ pricingTableActive: string;
1090
+ pricingTableTrialLeft: string;
1091
+ pricingTableCurrentPlan: string;
1092
+ pricingTableChoosePlan: string;
1093
+ pricingTableOverLimit: string;
1094
+ pricingTableOverLimitDetail: string;
1095
+ pricingTableChooseAddOn: string;
1096
+ pricingTableChangeAddOn: string;
1097
+ pricingTableRemoveAddOn: string;
1098
+ pricingTableEverythingIn: string;
1099
+ pricingTableSeeAll: string;
1100
+ pricingTableHideAll: string;
1101
+ pricingTableTierBased: string;
1102
+ pricingTableThen: string;
1103
+ pricingTableCredits: string;
1104
+ pricingTableCreditsPerPeriod: string;
1105
+ pricingTableCreditsPerLicense: string;
1106
+ pricingTableCreditsPerLicensePerPeriod: string;
1107
+ pricingTableCreditsPlus: string;
1108
+ pricingTableCreditsPlusPerPeriod: string;
1109
+ pricingTableSaveYearly: string;
1110
+ pricingTableSaveQuarterly: string;
1111
+ pricingTableSavingYearly: string;
1112
+ pricingTableSavingQuarterly: string;
1113
+ pricingTableUnitsPerPeriod: string;
1114
+ pricingTablePerUnitPerPeriod: string;
1115
+ pricingTablePerPackagePerPeriod: string;
1116
+ pricingTablePerUse: string;
1117
+ pricingTableUpTo: string;
1118
+ pricingTableUpToPerPeriod: string;
558
1119
  unsubscribeButton: string;
559
1120
  unsubscribeTitle: string;
560
1121
  unsubscribeAccessUntil: string;
@@ -605,6 +1166,107 @@ export declare type ElementStrings = {
605
1166
  periodMonth: string;
606
1167
  periodQuarter: string;
607
1168
  periodYear: string;
1169
+ checkoutTitle: string;
1170
+ checkoutClose: string;
1171
+ checkoutLoading: string;
1172
+ checkoutError: string;
1173
+ checkoutUnavailable: string;
1174
+ checkoutStepsLabel: string;
1175
+ checkoutStepPlan: string;
1176
+ checkoutStepAutoTopup: string;
1177
+ checkoutStepUsage: string;
1178
+ checkoutStepAddOns: string;
1179
+ checkoutStepAddOnUsage: string;
1180
+ checkoutStepCredits: string;
1181
+ checkoutStepPayment: string;
1182
+ checkoutNext: string;
1183
+ checkoutBack: string;
1184
+ checkoutPeriodMonth: string;
1185
+ checkoutPeriodQuarter: string;
1186
+ checkoutPeriodYear: string;
1187
+ checkoutPerMonth: string;
1188
+ checkoutPerQuarter: string;
1189
+ checkoutPerYear: string;
1190
+ checkoutPeriodLabel: string;
1191
+ checkoutSavingsQuarter: string;
1192
+ checkoutSavingsYear: string;
1193
+ checkoutCurrencyLabel: string;
1194
+ checkoutFree: string;
1195
+ checkoutCurrentPlan: string;
1196
+ checkoutSelect: string;
1197
+ checkoutSelected: string;
1198
+ checkoutTrialDays: string;
1199
+ checkoutTrialToggle: string;
1200
+ checkoutPlanOverLimit: string;
1201
+ checkoutPlanOverLimitFeatures: string;
1202
+ checkoutPlanDowngradeBlocked: string;
1203
+ checkoutTalkToSupport: string;
1204
+ checkoutCustomPlan: string;
1205
+ checkoutCustomPlanPrice: string;
1206
+ checkoutPlanNotPriced: string;
1207
+ checkoutAddOnsEmpty: string;
1208
+ checkoutAdd: string;
1209
+ checkoutRemove: string;
1210
+ checkoutOneTime: string;
1211
+ checkoutOneTimePrice: string;
1212
+ checkoutQuantityLabel: string;
1213
+ checkoutCurrentQuantity: string;
1214
+ checkoutPerUnit: string;
1215
+ checkoutCreditsCount: string;
1216
+ checkoutAutoTopupEnable: string;
1217
+ checkoutAutoTopupThreshold: string;
1218
+ checkoutAutoTopupAmount: string;
1219
+ checkoutAutoTopupCost: string;
1220
+ checkoutPaymentMethod: string;
1221
+ checkoutUseDifferentMethod: string;
1222
+ checkoutSavedMethods: string;
1223
+ checkoutUseMethod: string;
1224
+ checkoutPaymentNotRequired: string;
1225
+ checkoutPromoCode: string;
1226
+ checkoutPromoApply: string;
1227
+ checkoutPromoRemove: string;
1228
+ checkoutPromoApplied: string;
1229
+ checkoutTaxId: string;
1230
+ checkoutTaxIdCountry: string;
1231
+ checkoutTaxIdType: string;
1232
+ checkoutTaxIdValue: string;
1233
+ checkoutTaxIdSaved: string;
1234
+ checkoutTaxIdError: string;
1235
+ checkoutTaxIdFormat: string;
1236
+ checkoutCustomFields: string;
1237
+ checkoutRequired: string;
1238
+ checkoutOptInAccept: string;
1239
+ checkoutSummary: string;
1240
+ checkoutDueToday: string;
1241
+ checkoutTotalPerMonth: string;
1242
+ checkoutTotalPerQuarter: string;
1243
+ checkoutTotalPerYear: string;
1244
+ checkoutProration: string;
1245
+ checkoutProrationBilledAtRenewal: string;
1246
+ checkoutProrationCharge: string;
1247
+ checkoutProrationChargeUnnamed: string;
1248
+ checkoutProrationCredit: string;
1249
+ checkoutProrationCreditUnnamed: string;
1250
+ checkoutProrationHideDetails: string;
1251
+ checkoutProrationShowDetails: string;
1252
+ checkoutDiscount: string;
1253
+ checkoutTax: string;
1254
+ checkoutCreditApplied: string;
1255
+ checkoutCreditRemaining: string;
1256
+ checkoutTrialEnds: string;
1257
+ checkoutScheduledChange: string;
1258
+ checkoutDisclaimerMonth: string;
1259
+ checkoutDisclaimerQuarter: string;
1260
+ checkoutDisclaimerYear: string;
1261
+ checkoutPricing: string;
1262
+ checkoutPricingError: string;
1263
+ checkoutPay: string;
1264
+ checkoutStartTrial: string;
1265
+ checkoutConfirm: string;
1266
+ checkoutConfirmPayment: string;
1267
+ checkoutFinalizing: string;
1268
+ checkoutFinalizeError: string;
1269
+ checkoutPaymentFailed: string;
608
1270
  };
609
1271
 
610
1272
  /**
@@ -721,6 +1383,13 @@ export declare function formatPercent(fraction: number, locale: string): string;
721
1383
  /** "8/21". Empty for an Invalid Date. */
722
1384
  export declare function formatShortDate(date: Date, locale: string): string;
723
1385
 
1386
+ /**
1387
+ * "8/21 – 9/20", as the locale writes a range. Empty for an Invalid Date at
1388
+ * either end. `formatRange` is newer than the lib this package compiles
1389
+ * against, so it is reached through a cast and stood in for where absent.
1390
+ */
1391
+ export declare function formatShortDateRange(start: Date, end: Date, locale: string): string;
1392
+
724
1393
  /** Heading level an element's own heading renders at. Default 2. */
725
1394
  export declare type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
726
1395
 
@@ -735,13 +1404,14 @@ export declare type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
735
1404
  export declare function httpStatus(error: Error | undefined): number | undefined;
736
1405
 
737
1406
  /**
738
- * GENERATED by scripts/inline-icons.mjs from @schematichq/schematic-icons@0.8.0.
739
- * Do not edit; run `pnpm run icons` after bumping the package.
740
- *
741
- * The icon font and its glyph rules, appended to the elements stylesheet by
742
- * `<SchematicStyles />`. Glyphs render on `.schematic-icon
743
- * .schematic-icon--<name>`.
1407
+ * A feature's or credit's icon as the dashboard sets it: a schematic-icons
1408
+ * glyph by name, or anything else, an emoji, drawn as the text it is.
744
1409
  */
1410
+ export declare const Icon: React_2.FC<{
1411
+ className?: string;
1412
+ name: string;
1413
+ }>;
1414
+
745
1415
  export declare const iconsCss: string;
746
1416
 
747
1417
  export declare interface IncludedFeatureRow {
@@ -822,6 +1492,20 @@ export declare interface IncludedFeaturesProps extends ElementProps {
822
1492
  showWarningThresholdAsLimit?: boolean;
823
1493
  }
824
1494
 
1495
+ /**
1496
+ * The cart a checkout opens on: the host's selection over what the company
1497
+ * has now.
1498
+ */
1499
+ export declare function initialCart({ catalog, company, config, featureUsage, paymentMethods, }: InitialCartInput): CheckoutCart;
1500
+
1501
+ declare interface InitialCartInput {
1502
+ catalog: Catalog;
1503
+ company?: Company;
1504
+ featureUsage?: FeatureUsage[];
1505
+ paymentMethods?: PaymentMethod[];
1506
+ config?: CheckoutConfig;
1507
+ }
1508
+
825
1509
  /**
826
1510
  * Fills `{{name}}` placeholders, i18next style. A placeholder with no value
827
1511
  * is left as written so the omission is visible.
@@ -1428,6 +2112,39 @@ export declare type PlanPrice = {
1428
2112
  period: string | null;
1429
2113
  };
1430
2114
 
2115
+ /**
2116
+ * `deriveCheckout`: the checkout as display parts. Line items are the
2117
+ * catalog's prices times the cart's quantities, which is what the customer is
2118
+ * choosing between; the totals are the server's, from the checkout's last
2119
+ * price, and nothing here adds them up.
2120
+ */
2121
+ export declare interface PlanRow {
2122
+ id: string;
2123
+ name: string;
2124
+ description: string;
2125
+ /** The price for the cart's period in its currency; `null` when the plan is not priced there. */
2126
+ priceText: string | null;
2127
+ /** Whether the price renews each period rather than once. */
2128
+ recurring: boolean;
2129
+ free: boolean;
2130
+ current: boolean;
2131
+ selected: boolean;
2132
+ /** The company may move to it; `false` comes with `invalidReason`. */
2133
+ valid: boolean;
2134
+ invalidReason: CatalogPlan["invalidReason"] | null;
2135
+ /** The features the company uses more of than the plan allows, by name. */
2136
+ violations: string[];
2137
+ /** Days of trial the company would get; `null` when there is none for it. */
2138
+ trialDays: number | null;
2139
+ }
2140
+
2141
+ /**
2142
+ * The steps, and which of them are passed over: the host's skips, except a
2143
+ * step whose requirement is not met, one a blocking problem points at, and
2144
+ * one the customer went back to (`revisited`).
2145
+ */
2146
+ export declare function planSteps(ctx: StepContext, revisited?: ReadonlySet<CheckoutStep>): StepPlan;
2147
+
1431
2148
  /**
1432
2149
  * `other` is required because every language has it. Supply whichever other
1433
2150
  * categories the language uses: Polish needs `one`, `few`, and `many`;
@@ -1454,6 +2171,363 @@ export declare function pricePeriod(price: MeteredPrice | undefined): string | n
1454
2171
  */
1455
2172
  export declare type PriceTier = MeteredPrice["priceTiers"][number];
1456
2173
 
2174
+ /** What a card's call to action does, decided by the server's standing. */
2175
+ export declare type PricingAction =
2176
+ /** The company's plan in this period: no action, "Current plan". */
2177
+ {
2178
+ kind: "current";
2179
+ }
2180
+ /** "Choose plan"; `upgrade` sits above the current plan. */
2181
+ | {
2182
+ kind: "choose";
2183
+ upgrade: boolean;
2184
+ }
2185
+ /** An add-on the company holds: "Remove add-on". */
2186
+ | {
2187
+ kind: "remove";
2188
+ }
2189
+ /** An add-on the company holds in another period: "Change add-on". */
2190
+ | {
2191
+ kind: "change";
2192
+ }
2193
+ /** Over a limit the plan would set: disabled, with the violations. */
2194
+ | {
2195
+ kind: "overLimit";
2196
+ violations: PricingViolation[];
2197
+ }
2198
+ /** A downgrade the account does not allow in self-service. */
2199
+ | {
2200
+ kind: "downgradeBlocked";
2201
+ text: string | null;
2202
+ url: string | null;
2203
+ }
2204
+ /** The company cannot check out at all: a disabled "Choose plan". */
2205
+ | {
2206
+ kind: "unavailable";
2207
+ };
2208
+
2209
+ export declare interface PricingCard {
2210
+ id: string;
2211
+ name: string;
2212
+ description: string | null;
2213
+ price: PricingPrice;
2214
+ /** The price the card's period and currency picked, for a checkout. */
2215
+ priceId: string | null;
2216
+ /** The card's period: the chosen one, or `null` for one-time. */
2217
+ period: PricingPeriod | null;
2218
+ credits: PricingCreditLine[];
2219
+ entitlements: PricingEntitlementRow[];
2220
+ /** `null` in the public catalog, where there is no company. */
2221
+ action: PricingAction | null;
2222
+ /** The company's plan in the chosen period, for the card's outline. */
2223
+ active: boolean;
2224
+ trialDays: number | null;
2225
+ source: AnyPlan;
2226
+ }
2227
+
2228
+ /** "100 AI credits per month", one per credit the plan grants and shows. */
2229
+ export declare interface PricingCreditLine {
2230
+ creditId: string;
2231
+ icon: string | null;
2232
+ amount: string;
2233
+ creditName: string;
2234
+ /** "month", "year", …; `null` for a grant that does not renew. */
2235
+ period: string | null;
2236
+ /** "seat", for a grant per license. */
2237
+ perLicense: string | null;
2238
+ /**
2239
+ * What the plan grants the company outright beside a grant per license,
2240
+ * worded under it: "Plus 100 AI credits per month for your company".
2241
+ */
2242
+ plus: {
2243
+ amount: string;
2244
+ creditName: string;
2245
+ period: string | null;
2246
+ } | null;
2247
+ }
2248
+
2249
+ export declare interface PricingCustomPlan {
2250
+ priceText: string | null;
2251
+ ctaText: string | null;
2252
+ ctaUrl: string | null;
2253
+ }
2254
+
2255
+ /** The line beneath an entitlement's text. */
2256
+ export declare type PricingEntitlementDetail =
2257
+ /** "then $0.50/API call", "/mo" for a trait feature. */
2258
+ {
2259
+ kind: "overage";
2260
+ cost: string;
2261
+ size: string | null;
2262
+ units: string;
2263
+ period: PricingPeriod | null;
2264
+ }
2265
+ /** "Tier-based", with the tiers in a tip. */
2266
+ | {
2267
+ kind: "tiered";
2268
+ };
2269
+
2270
+ export declare interface PricingEntitlementRow {
2271
+ featureId: string;
2272
+ /** A schematic-icons glyph name; `null` when the feature has none. */
2273
+ icon: string | null;
2274
+ description: string | null;
2275
+ text: PricingEntitlementText;
2276
+ detail: PricingEntitlementDetail | null;
2277
+ tiers: {
2278
+ ranges: TierRange[];
2279
+ currency: string;
2280
+ mode: "graduated" | "volume" | null;
2281
+ period: PricingPeriod | null;
2282
+ unit: string;
2283
+ } | null;
2284
+ /** The limit a priced numeric entitlement is billed up to. */
2285
+ hardLimit: {
2286
+ amount: string;
2287
+ units: string;
2288
+ } | null;
2289
+ source: CatalogEntitlement;
2290
+ }
2291
+
2292
+ /** What an entitlement grants, worded by the element. */
2293
+ export declare type PricingEntitlementText =
2294
+ /** "API calls": a boolean feature, or a tiered one. */
2295
+ {
2296
+ kind: "name";
2297
+ name: string;
2298
+ }
2299
+ /** "Unlimited API calls". */
2300
+ | {
2301
+ kind: "unlimited";
2302
+ item: string;
2303
+ }
2304
+ /** "1,000 API calls", with "per month" for a metric period. */
2305
+ | {
2306
+ kind: "units";
2307
+ amount: string;
2308
+ units: string;
2309
+ period: string | null;
2310
+ }
2311
+ /** "$0.01 per API call", with "per month" for one paid in advance. */
2312
+ | {
2313
+ kind: "perUnit";
2314
+ cost: string;
2315
+ size: string | null;
2316
+ units: string;
2317
+ period: PricingPeriod | null;
2318
+ }
2319
+ /** "4 credits per API call". */
2320
+ | {
2321
+ kind: "perUse";
2322
+ amount: string;
2323
+ credits: string;
2324
+ unit: string;
2325
+ }
2326
+ /** "Up to 25 API calls", per period when the credit renews. */
2327
+ | {
2328
+ kind: "upTo";
2329
+ amount: string;
2330
+ units: string;
2331
+ period: string | null;
2332
+ };
2333
+
2334
+ /**
2335
+ * Display parts for a pricing table: the periods and currencies on offer,
2336
+ * and a card per plan and add-on priced in the ones chosen. Numbers, names
2337
+ * and prices arrive formatted; the element owns the wording, keyed by
2338
+ * `kind`. Which plan is current, valid or trialable is the server's to say,
2339
+ * and the public catalog says none of it.
2340
+ */
2341
+ export declare type PricingPeriod = "month" | "quarter" | "year";
2342
+
2343
+ /** What a card costs in the chosen period and currency. */
2344
+ export declare type PricingPrice =
2345
+ /** "$25.00", per `period`; `null` for a one-time add-on. */
2346
+ {
2347
+ kind: "amount";
2348
+ amount: string;
2349
+ period: PricingPeriod | null;
2350
+ }
2351
+ /** Priced at zero, with `showZeroPriceAsFree`. */
2352
+ | {
2353
+ kind: "free";
2354
+ }
2355
+ /** Priced at zero, and billed by what it is used. */
2356
+ | {
2357
+ kind: "usageBased";
2358
+ };
2359
+
2360
+ /** What a card's action does: `remove` and `change` are for a held add-on. */
2361
+ export declare type PricingSelectionAction = "choose" | "remove" | "change";
2362
+
2363
+ /**
2364
+ * The catalog's plans and add-ons, priced in the period and currency the
2365
+ * reader picks.
2366
+ *
2367
+ * It reads the catalog through `useCatalog`: the public catalog until
2368
+ * someone signs in, then the company's view, which adds the current plan,
2369
+ * the plans the company cannot move to and why, and whether it can check
2370
+ * out. With a session it also waits for the company, for the period its
2371
+ * subscription bills in; a company that fails to load costs only that
2372
+ * period.
2373
+ * The table opens nothing itself: each card's action calls `onSelectPlan`.
2374
+ */
2375
+ export declare function PricingTable({ callToActionTarget, callToActionUrl, catalogId, className, currency: currencyProp, defaultCurrency, defaultPeriod, headingLevel, locale: localeProp, onCurrencyChange, onPeriodChange, onSelectPlan, period: periodProp, showAddOns, showCredits, showCurrencySelector, showDescription, showEntitlements, showFeatureDescriptions, showFeatureIcons, showHardLimit, showHeader, showInclusionText, showPeriodToggle, showPlans, showWarningThresholdAsLimit, showZeroPriceAsFree, strings, }: PricingTableProps): JSX.Element;
2376
+
2377
+ export declare namespace PricingTable {
2378
+ var resources: readonly ["catalog", "publicCatalog", "company"];
2379
+ }
2380
+
2381
+ export declare interface PricingTableProps extends ElementProps {
2382
+ /** The catalog to show; the environment's when absent. */
2383
+ catalogId?: string;
2384
+ /** Heading level of "Plans" and "Add-ons"; the cards sit one below. Default 2. */
2385
+ headingLevel?: HeadingLevel;
2386
+ /** "Plans" and "Add-ons" above their cards. Default true. */
2387
+ showHeader?: boolean;
2388
+ /** The plans, and the custom plan where the catalog offers one. Default true. */
2389
+ showPlans?: boolean;
2390
+ /** The add-ons. Default true. */
2391
+ showAddOns?: boolean;
2392
+ /** The monthly / yearly toggle, when the catalog prices in more than one. Default true. */
2393
+ showPeriodToggle?: boolean;
2394
+ /** The currency picker, when the catalog prices in more than one. Default true. */
2395
+ showCurrencySelector?: boolean;
2396
+ /** Each card's description. Default true. */
2397
+ showDescription?: boolean;
2398
+ /** Each card's features. Default true. */
2399
+ showEntitlements?: boolean;
2400
+ /** Each feature's icon. Default true. */
2401
+ showFeatureIcons?: boolean;
2402
+ /** Each feature's description. Default false. */
2403
+ showFeatureDescriptions?: boolean;
2404
+ /** "Everything in {plan}, plus" above each plan's features but the first. Default true. */
2405
+ showInclusionText?: boolean;
2406
+ /** Each plan's included credits, and "credits per use" on its features. Default true. */
2407
+ showCredits?: boolean;
2408
+ /** A plan priced at zero reads "Free". Default false. */
2409
+ showZeroPriceAsFree?: boolean;
2410
+ /** An info tip with the hard limit on features billed past it. Default false. */
2411
+ showHardLimit?: boolean;
2412
+ /**
2413
+ * Show an entitlement's warning threshold in place of its limit, where one
2414
+ * is configured. Default false.
2415
+ */
2416
+ showWarningThresholdAsLimit?: boolean;
2417
+ /** The period shown. Set it to control the toggle; leave it to let the table. */
2418
+ period?: PricingPeriod;
2419
+ /** The period first shown when `period` is not set. */
2420
+ defaultPeriod?: PricingPeriod;
2421
+ onPeriodChange?: (period: PricingPeriod) => void;
2422
+ /** The currency shown, lowercase. Set it to control the picker. */
2423
+ currency?: string;
2424
+ /** The currency first shown when `currency` is not set. */
2425
+ defaultCurrency?: string;
2426
+ onCurrencyChange?: (currency: string) => void;
2427
+ /**
2428
+ * A card's action calls this: open a checkout with the selection, or send
2429
+ * a visitor nobody has signed in as to sign up. Without it or
2430
+ * `callToActionUrl`, cards have no action.
2431
+ */
2432
+ onSelectPlan?: (selection: PricingTableSelection) => void;
2433
+ /**
2434
+ * A card's action links here when there is no `onSelectPlan`, and a
2435
+ * blocked downgrade does when the account has no link of its own.
2436
+ */
2437
+ callToActionUrl?: string;
2438
+ /** `target` for `callToActionUrl`. */
2439
+ callToActionTarget?: string;
2440
+ }
2441
+
2442
+ /** What a card's action hands the host, to open a checkout or a sign-up. */
2443
+ export declare interface PricingTableSelection {
2444
+ kind: "plan" | "addOn";
2445
+ /** `remove` and `change` are for an add-on the company holds. */
2446
+ action: PricingSelectionAction;
2447
+ /** The plan's or add-on's id. */
2448
+ id: string;
2449
+ /** The price the card shows, for a checkout's selections. */
2450
+ priceId: string | null;
2451
+ /** `null` for a one-time add-on. */
2452
+ period: PricingPeriod | null;
2453
+ currency: string;
2454
+ /** A trial the plan offers, in days. */
2455
+ trialDays: number | null;
2456
+ /**
2457
+ * The cart to open `<Checkout selection={...} />` on for this action, from
2458
+ * the catalog the table read: build it again after sign-in, since the
2459
+ * public catalog knows no add-ons the company holds.
2460
+ */
2461
+ checkout: CheckoutSelection;
2462
+ }
2463
+
2464
+ export declare interface PricingTableView {
2465
+ source: CatalogView["source"];
2466
+ /** In month, quarter, year order; empty when nothing recurs. */
2467
+ periods: PricingPeriod[];
2468
+ /** One of `periods`, or `null` when there are none. */
2469
+ period: PricingPeriod | null;
2470
+ currencies: string[];
2471
+ currency: string;
2472
+ plans: PricingCard[];
2473
+ addOns: PricingCard[];
2474
+ /** The catalog's custom-plan call to action, when it offers one. */
2475
+ customPlan: PricingCustomPlan | null;
2476
+ /**
2477
+ * What the company's plan saves over paying monthly, by period, as a
2478
+ * percentage: "16.67%". Empty in the public catalog, and without a
2479
+ * current plan priced monthly.
2480
+ */
2481
+ savings: Partial<Record<PricingPeriod, string>>;
2482
+ /** The company's trial, for the current card's badge. */
2483
+ trialDaysLeft: {
2484
+ count: number;
2485
+ days: string;
2486
+ } | null;
2487
+ /** The add-ons the company holds, shown or not; empty in the public catalog. */
2488
+ heldAddOnIds: string[];
2489
+ }
2490
+
2491
+ export declare interface PricingViolation {
2492
+ featureName: string;
2493
+ usage: string;
2494
+ limit: string | null;
2495
+ }
2496
+
2497
+ /** The words a problem is shown in: the host's, else the server's. */
2498
+ declare type ProblemFormatter = (problem: CheckoutProblem) => string | undefined;
2499
+
2500
+ /**
2501
+ * One half of a mid-period change: the unused time given back on a price the
2502
+ * cart leaves, or the time owed on one it takes.
2503
+ */
2504
+ export declare interface ProrationLine {
2505
+ key: string;
2506
+ kind: "credit" | "charge";
2507
+ /** The plan or add-on's name; `null` when nothing names it. */
2508
+ name: string | null;
2509
+ /** "8/21 – 9/20"; `null` when the server gave no period. */
2510
+ periodText: string | null;
2511
+ amountText: string;
2512
+ }
2513
+
2514
+ export { PublicCatalog }
2515
+
2516
+ export { PublicCatalogPlan }
2517
+
2518
+ export declare interface QuantityRow {
2519
+ featureId: string;
2520
+ /** The feature's name for the quantity chosen. */
2521
+ name: string;
2522
+ /** Per unit, for the period. */
2523
+ unitPriceText: string | null;
2524
+ quantity: number;
2525
+ /** What the company has now; `null` when it has none. */
2526
+ currentQuantity: number | null;
2527
+ /** The quantity times the unit price. */
2528
+ totalText: string | null;
2529
+ }
2530
+
1457
2531
  /**
1458
2532
  * What an element reads from the billing store, declared on the element so
1459
2533
  * a page can prefetch exactly that. `fetchBillingData` has no default set:
@@ -1514,6 +2588,40 @@ export { SetupIntent }
1514
2588
 
1515
2589
  export { SetupIntentHandle }
1516
2590
 
2591
+ /** Every step but payment can be skipped. */
2592
+ export declare type SkippableStep = Exclude<CheckoutStep, "payment">;
2593
+
2594
+ /**
2595
+ * Which steps a checkout has, and where the customer is among them. The API
2596
+ * has no notion of steps: they are this element's way of walking a cart, and
2597
+ * each is derived from the catalog and the cart as they stand. Payment is
2598
+ * always last, since it is where the cart is paid for; every other step
2599
+ * appears only when there is something to choose in it.
2600
+ */
2601
+ declare interface StepContext {
2602
+ catalog: Catalog;
2603
+ company?: Company;
2604
+ cart: CheckoutCart;
2605
+ /** The checkout as the server last priced it. */
2606
+ checkout?: Checkout_2;
2607
+ config?: CheckoutSteps;
2608
+ }
2609
+
2610
+ /**
2611
+ * The step a problem is about, so a skipped step with a blocking problem is
2612
+ * shown again; `undefined` for one about the checkout as a whole.
2613
+ */
2614
+ export declare function stepOfProblem(problem: CheckoutProblem, { cart, catalog }: Pick<StepContext, "cart" | "catalog">): CheckoutStep | undefined;
2615
+
2616
+ export declare interface StepPlan {
2617
+ /** The steps this checkout has, in order. */
2618
+ available: CheckoutStep[];
2619
+ /** The steps listed for the customer: all of them, or the unskipped ones. */
2620
+ visible: CheckoutStep[];
2621
+ /** Available steps the walk passes over. */
2622
+ skipped: Set<CheckoutStep>;
2623
+ }
2624
+
1517
2625
  /** A flat catalogue, the shape of both a host's `strings` and the defaults. */
1518
2626
  export declare type StringCatalog = Record<string, string | undefined>;
1519
2627
 
@@ -1529,6 +2637,22 @@ export declare type StringOverrides = Partial<ElementStrings> & Partial<Record<`
1529
2637
  /** Interpolation values, and `count` for the plural form. */
1530
2638
  export declare type StringVars = Record<string, unknown>;
1531
2639
 
2640
+ export declare interface SummaryLine {
2641
+ key: string;
2642
+ label: string;
2643
+ /** How many, for a line bought in a quantity. */
2644
+ quantity: number | null;
2645
+ amountText: string;
2646
+ /** Charged once rather than each period: a one-time plan or add-on, a bundle. */
2647
+ oneTime: boolean;
2648
+ }
2649
+
2650
+ export { TaxId }
2651
+
2652
+ export { TaxIdInput }
2653
+
2654
+ export { TaxIdsHandle }
2655
+
1532
2656
  /** A tier as a range of units, with the price for a unit or the flat fee. */
1533
2657
  export declare interface TierRange {
1534
2658
  from: number;
@@ -1784,6 +2908,18 @@ export declare type UsageSummary = {
1784
2908
  amount: string;
1785
2909
  };
1786
2910
 
2911
+ export { useCatalog }
2912
+
2913
+ export { useCheckout }
2914
+
2915
+ /**
2916
+ * The way to open the checkout the nearest `CheckoutLauncherProvider`
2917
+ * renders. Outside one, `open` does nothing and says so in development.
2918
+ */
2919
+ export declare function useCheckoutLauncher(): CheckoutLauncher;
2920
+
2921
+ export { UseCheckoutOptions }
2922
+
1787
2923
  export { useCompany }
1788
2924
 
1789
2925
  export { useCreditBalances }
@@ -1821,6 +2957,8 @@ export { useSchematicTranslate }
1821
2957
 
1822
2958
  export { useSetupIntent }
1823
2959
 
2960
+ export { useTaxIds }
2961
+
1824
2962
  /**
1825
2963
  * Resolves copy in order: the element's `strings`, the provider's `strings`,
1826
2964
  * the provider's `translate`, then the English default.