@kerne/react 1.2.0 → 1.3.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/README.md +62 -0
- package/dist/chunk-3R66S7BY.cjs +3312 -0
- package/dist/chunk-ZVL47U4B.js +3312 -0
- package/dist/{i18n-CXEhPK58.d.cts → fr-E5mmylSH.d.cts} +134 -2
- package/dist/{i18n-CXEhPK58.d.ts → fr-E5mmylSH.d.ts} +134 -2
- package/dist/index.cjs +49 -27
- package/dist/index.d.cts +33 -38
- package/dist/index.d.ts +33 -38
- package/dist/index.js +42 -20
- package/dist/ui/index.cjs +984 -1906
- package/dist/ui/index.d.cts +41 -95
- package/dist/ui/index.d.ts +41 -95
- package/dist/ui/index.js +1091 -2013
- package/package.json +3 -3
- package/dist/chunk-IHNWY4ML.js +0 -1327
- package/dist/chunk-N6VPGJ36.cjs +0 -1327
package/dist/ui/index.d.cts
CHANGED
|
@@ -1,50 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Per-instance overrides of the same custom properties the stylesheet reads,
|
|
9
|
-
* applied as inline style so they win over the class defaults without
|
|
10
|
-
* specificity tricks.
|
|
11
|
-
*/
|
|
12
|
-
interface KerneAppearance {
|
|
13
|
-
/**
|
|
14
|
-
* `light` (default), `dark`, or `system` to follow the visitor's OS. Not
|
|
15
|
-
* defaulted to `system`: a light-only host would silently render a dark form
|
|
16
|
-
* for half its users.
|
|
17
|
-
*/
|
|
18
|
-
theme?: 'light' | 'dark' | 'system';
|
|
19
|
-
/**
|
|
20
|
-
* The brand colour. Drives the primary button, and - unless overridden below -
|
|
21
|
-
* its label, its hover, and the accent used for focus rings and links.
|
|
22
|
-
*/
|
|
23
|
-
primaryColor?: string;
|
|
24
|
-
/** Label on the primary button. Derived from `primaryColor` when omitted. */
|
|
25
|
-
primaryTextColor?: string;
|
|
26
|
-
/** Focus rings and links. Falls back to `primaryColor`. */
|
|
27
|
-
accentColor?: string;
|
|
28
|
-
textColor?: string;
|
|
29
|
-
borderColor?: string;
|
|
30
|
-
/** Background of error/info panels. */
|
|
31
|
-
panelColor?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The ground the component sits on. Leave unset when embedding (the host's
|
|
34
|
-
* page shows through); set it when the component owns the viewport, so its
|
|
35
|
-
* text can never resolve against a background it doesn't know about.
|
|
36
|
-
*/
|
|
37
|
-
background?: string;
|
|
38
|
-
/** Opaque ground for the card variant, the account dropdown, a pressed segment. */
|
|
39
|
-
surfaceColor?: string;
|
|
40
|
-
/** `card` wraps the screen in a bordered, raised container. Defaults to `none`. */
|
|
41
|
-
surface?: 'none' | 'card';
|
|
42
|
-
fontFamily?: string;
|
|
43
|
-
/** Corner radius on inputs and buttons, e.g. `"0px"` for square. */
|
|
44
|
-
radius?: string;
|
|
45
|
-
/** Height of inputs and buttons. Defaults to `"44px"`. */
|
|
46
|
-
controlHeight?: string;
|
|
47
|
-
}
|
|
3
|
+
import { a as KerneAppearance, K as KerneLocalization } from '../fr-E5mmylSH.cjs';
|
|
4
|
+
export { d as defaultLocalization, b as defaultTokens, f as fr, m as mergeLocalization, u as useLocalization } from '../fr-E5mmylSH.cjs';
|
|
5
|
+
import { PublicPlan, PublicPriceLabel, PublicPlanPrice, DriverSelection, SubscriptionWithPlan } from '@kerne/types';
|
|
48
6
|
|
|
49
7
|
interface KerneUIProps {
|
|
50
8
|
appearance?: KerneAppearance;
|
|
@@ -64,15 +22,11 @@ interface AuthFlowProps extends KerneUIProps {
|
|
|
64
22
|
onSuccess?: () => void;
|
|
65
23
|
/** Hand the session to another origin (the hosted portal's job). */
|
|
66
24
|
redirectUrl?: string;
|
|
67
|
-
/** Where emailed links should land. Defaults to the tenant's configured callbacks. */
|
|
68
|
-
magicLinkCallbackUrl?: string;
|
|
69
|
-
resetPasswordCallbackUrl?: string;
|
|
70
|
-
verificationCallbackUrl?: string;
|
|
71
25
|
/** Skip sign-up entirely, even on an OPEN tenant (e.g. an internal tool). */
|
|
72
26
|
allowSignUp?: boolean;
|
|
73
27
|
legal?: React.ReactNode;
|
|
74
28
|
}
|
|
75
|
-
declare function AuthFlow({ initialStep, step: controlledStep, onStepChange, onSuccess, redirectUrl,
|
|
29
|
+
declare function AuthFlow({ initialStep, step: controlledStep, onStepChange, onSuccess, redirectUrl, allowSignUp, legal, appearance, logo, className, }: AuthFlowProps): react_jsx_runtime.JSX.Element;
|
|
76
30
|
|
|
77
31
|
interface LoginFormProps extends KerneUIProps {
|
|
78
32
|
/** Called after a successful password sign-in. */
|
|
@@ -82,8 +36,6 @@ interface LoginFormProps extends KerneUIProps {
|
|
|
82
36
|
* job - see `redirectWithSession`). Takes precedence over `onSuccess`.
|
|
83
37
|
*/
|
|
84
38
|
redirectUrl?: string;
|
|
85
|
-
/** Where the emailed sign-in link should land. Defaults to the tenant's configured callback. */
|
|
86
|
-
magicLinkCallbackUrl?: string;
|
|
87
39
|
signUpUrl?: string;
|
|
88
40
|
onSignUpClick?: () => void;
|
|
89
41
|
forgotPasswordUrl?: string;
|
|
@@ -95,14 +47,12 @@ interface LoginFormProps extends KerneUIProps {
|
|
|
95
47
|
/** Small print under the form, e.g. terms and privacy links. */
|
|
96
48
|
legal?: React.ReactNode;
|
|
97
49
|
}
|
|
98
|
-
declare function LoginForm({ onSuccess, redirectUrl,
|
|
50
|
+
declare function LoginForm({ onSuccess, redirectUrl, signUpUrl, onSignUpClick, forgotPasswordUrl, onForgotPasswordClick, onOAuthSelect, title, subtitle, legal, appearance, logo, className, }: LoginFormProps): react_jsx_runtime.JSX.Element;
|
|
99
51
|
|
|
100
52
|
interface RegisterFormProps extends KerneUIProps {
|
|
101
53
|
onSuccess?: () => void;
|
|
102
54
|
/** Hand the session to another origin after sign-up (hosted portal). */
|
|
103
55
|
redirectUrl?: string;
|
|
104
|
-
/** Where the emailed sign-up link should land. Defaults to the tenant's configured callback. */
|
|
105
|
-
magicLinkCallbackUrl?: string;
|
|
106
56
|
/**
|
|
107
57
|
* Invitation token. Read from `?token=` in the URL when omitted, so an
|
|
108
58
|
* emailed invitation link works with no wiring on the host's side.
|
|
@@ -117,7 +67,7 @@ interface RegisterFormProps extends KerneUIProps {
|
|
|
117
67
|
/** Collect a display name alongside the credentials. */
|
|
118
68
|
collectName?: boolean;
|
|
119
69
|
}
|
|
120
|
-
declare function RegisterForm({ onSuccess, redirectUrl,
|
|
70
|
+
declare function RegisterForm({ onSuccess, redirectUrl, invitationToken: invitationTokenProp, signInUrl, onSignInClick, onOAuthSelect, title, subtitle, legal, collectName, appearance, logo, className, }: RegisterFormProps): react_jsx_runtime.JSX.Element;
|
|
121
71
|
|
|
122
72
|
interface MagicLinkCallbackProps extends KerneUIProps {
|
|
123
73
|
/** Overrides the `?token=` query param - for hosts that parse routes themselves. */
|
|
@@ -131,15 +81,13 @@ interface MagicLinkCallbackProps extends KerneUIProps {
|
|
|
131
81
|
declare function MagicLinkCallback({ token: tokenProp, onSuccess, redirectUrl, signInUrl, onSignInClick, appearance, logo, className, }: MagicLinkCallbackProps): react_jsx_runtime.JSX.Element;
|
|
132
82
|
|
|
133
83
|
interface ForgotPasswordFormProps extends KerneUIProps {
|
|
134
|
-
/** Where the emailed reset link should land. Defaults to the tenant's configured callback. */
|
|
135
|
-
callbackUrl?: string;
|
|
136
84
|
signInUrl?: string;
|
|
137
85
|
onSignInClick?: () => void;
|
|
138
86
|
onSent?: (email: string) => void;
|
|
139
87
|
title?: string;
|
|
140
88
|
subtitle?: React.ReactNode;
|
|
141
89
|
}
|
|
142
|
-
declare function ForgotPasswordForm({
|
|
90
|
+
declare function ForgotPasswordForm({ signInUrl, onSignInClick, onSent, title, subtitle, appearance, logo, className, }: ForgotPasswordFormProps): react_jsx_runtime.JSX.Element;
|
|
143
91
|
|
|
144
92
|
interface ResetPasswordFormProps extends KerneUIProps {
|
|
145
93
|
/** Overrides the `?token=` query param. */
|
|
@@ -155,13 +103,11 @@ declare function ResetPasswordForm({ token: tokenProp, signInUrl, onSignInClick,
|
|
|
155
103
|
interface VerifyEmailFormProps extends KerneUIProps {
|
|
156
104
|
/** Overrides the `?token=` query param. */
|
|
157
105
|
token?: string;
|
|
158
|
-
/** Where a resent verification link should land. */
|
|
159
|
-
callbackUrl?: string;
|
|
160
106
|
onVerified?: () => void;
|
|
161
107
|
title?: string;
|
|
162
108
|
subtitle?: React.ReactNode;
|
|
163
109
|
}
|
|
164
|
-
declare function VerifyEmailForm({ token: tokenProp,
|
|
110
|
+
declare function VerifyEmailForm({ token: tokenProp, onVerified, title, subtitle, appearance, logo, className, }: VerifyEmailFormProps): react_jsx_runtime.JSX.Element;
|
|
165
111
|
|
|
166
112
|
interface ActivateAccountFormProps extends KerneUIProps {
|
|
167
113
|
/** Overrides the `?token=` query param. */
|
|
@@ -248,16 +194,12 @@ interface UserProfileProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
248
194
|
onDeleted?: () => void;
|
|
249
195
|
productSlug?: string;
|
|
250
196
|
pricingProductIdOrSlug?: string;
|
|
251
|
-
portalReturnUrl?: string;
|
|
252
|
-
checkoutSuccessUrl?: string;
|
|
253
|
-
checkoutCancelUrl?: string;
|
|
254
197
|
showPlanSwitcher?: boolean;
|
|
255
198
|
showUsage?: boolean;
|
|
256
199
|
usageFeatureKeys?: string[];
|
|
257
200
|
usageLabels?: Record<string, string>;
|
|
258
|
-
verificationCallbackUrl?: string;
|
|
259
201
|
}
|
|
260
|
-
declare function UserProfile({ tabs, extraTabs, defaultTab, activeTab: controlledTab, onTabChange, showDeleteAccount, onSaved, onDeleted, productSlug, pricingProductIdOrSlug,
|
|
202
|
+
declare function UserProfile({ tabs, extraTabs, defaultTab, activeTab: controlledTab, onTabChange, showDeleteAccount, onSaved, onDeleted, productSlug, pricingProductIdOrSlug, showPlanSwitcher, showUsage, usageFeatureKeys, usageLabels, appearance, className, }: UserProfileProps): react_jsx_runtime.JSX.Element;
|
|
261
203
|
|
|
262
204
|
/**
|
|
263
205
|
* "Profile" pane: who the user is, and the address they sign in with.
|
|
@@ -268,11 +210,9 @@ declare function UserProfile({ tabs, extraTabs, defaultTab, activeTab: controlle
|
|
|
268
210
|
* fails on save.
|
|
269
211
|
*/
|
|
270
212
|
interface ProfileSectionProps {
|
|
271
|
-
/** Where a resent verification link should land. */
|
|
272
|
-
verificationCallbackUrl?: string;
|
|
273
213
|
onSaved?: () => void;
|
|
274
214
|
}
|
|
275
|
-
declare function ProfileSection({
|
|
215
|
+
declare function ProfileSection({ onSaved }: ProfileSectionProps): react_jsx_runtime.JSX.Element;
|
|
276
216
|
|
|
277
217
|
/**
|
|
278
218
|
* "Security" pane: password, and leaving.
|
|
@@ -296,38 +236,33 @@ declare function SecuritySection({ showDeleteAccount, onDeleted }: SecuritySecti
|
|
|
296
236
|
* "Billing" pane: the active plan, what it has been used for, and how to move
|
|
297
237
|
* to another one.
|
|
298
238
|
*
|
|
299
|
-
* The plan switcher
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
239
|
+
* The plan switcher used to be a bespoke, minimal list - deliberately not
|
|
240
|
+
* `<PricingTable>`, on the theory that a settings control shouldn't "sell" to
|
|
241
|
+
* someone who is already a customer. In practice that meant two independent
|
|
242
|
+
* implementations of "list plans, handle the switch" drifting apart (this one
|
|
243
|
+
* grouped prices by raw `interval` and had no path to a plan carrying a third
|
|
244
|
+
* price - early-bird, non-profit - where `<PricingTable>` already understood
|
|
245
|
+
* `PriceLabel`), and every fix to one never reached the other. This pane now
|
|
246
|
+
* composes the same `<PricingTable>` the marketing pricing page uses: one
|
|
247
|
+
* surface to keep polished instead of two to keep in sync.
|
|
308
248
|
*/
|
|
309
249
|
interface BillingSectionProps {
|
|
310
250
|
productSlug?: string;
|
|
311
251
|
/** Product the plan list is read from. Defaults to the tenant's default product. */
|
|
312
252
|
pricingProductIdOrSlug?: string;
|
|
313
|
-
portalReturnUrl?: string;
|
|
314
|
-
checkoutSuccessUrl?: string;
|
|
315
|
-
checkoutCancelUrl?: string;
|
|
316
253
|
/** Hide the plan switcher, e.g. when plan changes go through sales. */
|
|
317
254
|
showPlanSwitcher?: boolean;
|
|
318
255
|
showUsage?: boolean;
|
|
319
256
|
usageFeatureKeys?: string[];
|
|
320
257
|
usageLabels?: Record<string, string>;
|
|
321
258
|
}
|
|
322
|
-
declare function BillingSection({ productSlug, pricingProductIdOrSlug,
|
|
259
|
+
declare function BillingSection({ productSlug, pricingProductIdOrSlug, showPlanSwitcher, showUsage, usageFeatureKeys, usageLabels, }: BillingSectionProps): react_jsx_runtime.JSX.Element;
|
|
323
260
|
|
|
324
261
|
interface SubscriptionCardProps extends Omit<KerneUIProps, 'logo'> {
|
|
325
262
|
/** Restrict to one product, when the tenant sells several. */
|
|
326
263
|
productSlug?: string;
|
|
327
264
|
/** Heading above the details. Omit for the localized default, `null` for none. */
|
|
328
265
|
title?: string | null;
|
|
329
|
-
/** Where the provider portal should return to. */
|
|
330
|
-
portalReturnUrl?: string;
|
|
331
266
|
/** Shown when there is no active subscription - your pricing page. */
|
|
332
267
|
upgradeUrl?: string;
|
|
333
268
|
onUpgradeClick?: () => void;
|
|
@@ -336,7 +271,7 @@ interface SubscriptionCardProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
336
271
|
/** Hide the "Cancel subscription" button, e.g. when cancellation goes through sales/support. */
|
|
337
272
|
hideCancelButton?: boolean;
|
|
338
273
|
}
|
|
339
|
-
declare function SubscriptionCard({ productSlug, title,
|
|
274
|
+
declare function SubscriptionCard({ productSlug, title, upgradeUrl, onUpgradeClick, hidePortalButton, hideCancelButton, appearance, className, }: SubscriptionCardProps): react_jsx_runtime.JSX.Element;
|
|
340
275
|
|
|
341
276
|
interface UsageMetersProps extends Omit<KerneUIProps, 'logo'> {
|
|
342
277
|
/** Heading above the meters. Omit for the localized default, `null` for none. */
|
|
@@ -365,7 +300,7 @@ declare function UsageMeters({ title, featureKeys, showUnlimited, limit: maxRows
|
|
|
365
300
|
* (see EntitlementSummary), while the subscription payload does carry names -
|
|
366
301
|
* so components cross-reference the subscription first and only fall back
|
|
367
302
|
* here for a scope on a default pack, which has no subscription to read names
|
|
368
|
-
* from. Turning `api_calls` into "
|
|
303
|
+
* from. Turning `api_calls` into "API calls" is not as good as the real name;
|
|
369
304
|
* it is only better than showing a raw key to an end user.
|
|
370
305
|
*/
|
|
371
306
|
declare function humanizeFeatureKey(key: string): string;
|
|
@@ -435,8 +370,10 @@ interface PricingTableContextValue {
|
|
|
435
370
|
setSelectedLabelSlug: (slug: string) => void;
|
|
436
371
|
savings: LabelSavings | null;
|
|
437
372
|
currentPlanId: string | null;
|
|
373
|
+
/** The currency the subject is already billed in, or null with no subscription - see `Plan`'s currency-mismatch guard. */
|
|
374
|
+
currentPriceCurrency: string | null;
|
|
438
375
|
busyPriceId: string | null;
|
|
439
|
-
onSelectPlan: (plan: PublicPlan) => void;
|
|
376
|
+
onSelectPlan: (plan: PublicPlan, drivers?: DriverSelection[]) => void;
|
|
440
377
|
}
|
|
441
378
|
/**
|
|
442
379
|
* Headless access to the same state `<PricingTable.LabelSwitch>`/`<PricingTable.Plan>`
|
|
@@ -449,11 +386,12 @@ interface PricingTableProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
449
386
|
product?: string;
|
|
450
387
|
/** Label slug selected on first render. Defaults to the first label by PriceLabel.sort_order once the catalog loads. */
|
|
451
388
|
defaultLabel?: string;
|
|
452
|
-
/**
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Overrides the built-in checkout - e.g. a marketing site that wants its own confirmation step
|
|
391
|
+
* first. `drivers` carries what the buyer sized on the prepaid rails, and must be forwarded to
|
|
392
|
+
* `checkout()` or the sizing is lost.
|
|
393
|
+
*/
|
|
394
|
+
onSelectPlan?: (plan: PublicPlan, price: PublicPlanPrice, drivers?: DriverSelection[]) => void;
|
|
457
395
|
children: React.ReactNode;
|
|
458
396
|
}
|
|
459
397
|
/**
|
|
@@ -462,8 +400,9 @@ interface PricingTableProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
462
400
|
* once real data exists - they never have to handle a "plan not loaded yet"
|
|
463
401
|
* state of their own.
|
|
464
402
|
*/
|
|
465
|
-
declare function PricingTable({ product, defaultLabel,
|
|
403
|
+
declare function PricingTable({ product, defaultLabel, onSelectPlan, appearance, className, children, }: PricingTableProps): react_jsx_runtime.JSX.Element;
|
|
466
404
|
declare namespace PricingTable {
|
|
405
|
+
var Header: ({ eyebrow, headline, lede }: PricingTableHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
467
406
|
var LabelSwitch: () => react_jsx_runtime.JSX.Element | null;
|
|
468
407
|
var Plan: ({ slug, featured, badge, maxFeatures }: PricingTablePlanProps) => react_jsx_runtime.JSX.Element | null;
|
|
469
408
|
var Plans: ({ featuredSlug, featuredBadge, maxFeatures }: PricingTablePlansProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -485,6 +424,13 @@ interface PricingTablePlansProps {
|
|
|
485
424
|
featuredBadge?: string;
|
|
486
425
|
maxFeatures?: number;
|
|
487
426
|
}
|
|
427
|
+
interface PricingTableHeaderProps {
|
|
428
|
+
/** Small tracked line above the headline - a product name, a version, a category. */
|
|
429
|
+
eyebrow?: string;
|
|
430
|
+
headline: string;
|
|
431
|
+
/** One sentence under it. Say how billing works, not how great the product is. */
|
|
432
|
+
lede?: string;
|
|
433
|
+
}
|
|
488
434
|
|
|
489
435
|
interface CheckoutResultProps extends KerneUIProps {
|
|
490
436
|
/** `cancel` renders the abandoned-checkout copy and skips polling entirely. */
|
|
@@ -523,4 +469,4 @@ interface UpgradePromptProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
523
469
|
}
|
|
524
470
|
declare function UpgradePrompt({ featureKey, requested, featureName, children, upgradeUrl, onUpgradeClick, upgradeLabel, title, description, hideWhileLoading, appearance, className, }: UpgradePromptProps): react_jsx_runtime.JSX.Element | null;
|
|
525
471
|
|
|
526
|
-
export { ActivateAccountForm, type ActivateAccountFormProps, AuthFlow, type AuthFlowProps, type AuthFlowStep, BillingSection, type BillingSectionProps, ChangePasswordForm, type ChangePasswordFormProps, CheckoutResult, type CheckoutResultProps, ForgotPasswordForm, type ForgotPasswordFormProps,
|
|
472
|
+
export { ActivateAccountForm, type ActivateAccountFormProps, AuthFlow, type AuthFlowProps, type AuthFlowStep, BillingSection, type BillingSectionProps, ChangePasswordForm, type ChangePasswordFormProps, CheckoutResult, type CheckoutResultProps, ForgotPasswordForm, type ForgotPasswordFormProps, KerneAppearance, KerneLocalization, type LabelSavings, LoginForm, type LoginFormProps, MagicLinkCallback, type MagicLinkCallbackProps, type PriceDisplay, PricingTable, type PricingTableHeaderProps, type PricingTablePlanProps, type PricingTablePlansProps, type PricingTableProps, ProfileSection, type ProfileSectionProps, RegisterForm, type RegisterFormProps, ResetPasswordForm, type ResetPasswordFormProps, SecuritySection, type SecuritySectionProps, SignOutButton, type SignOutButtonProps, SubscriptionCard, type SubscriptionCardProps, UpgradePrompt, type UpgradePromptProps, UsageMeters, type UsageMetersProps, UserButton, type UserButtonMenuItem, type UserButtonProps, UserProfile, type UserProfileExtraTab, type UserProfileProps, type UserProfileTab, VerifyEmailForm, type VerifyEmailFormProps, WaitlistForm, type WaitlistFormProps, collectPriceLabels, formatDate, formatInterval, formatMoney, formatNumber, humanizeFeatureKey, resolveLabelSavings, resolvePriceDisplay, usePricingTable };
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,50 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Per-instance overrides of the same custom properties the stylesheet reads,
|
|
9
|
-
* applied as inline style so they win over the class defaults without
|
|
10
|
-
* specificity tricks.
|
|
11
|
-
*/
|
|
12
|
-
interface KerneAppearance {
|
|
13
|
-
/**
|
|
14
|
-
* `light` (default), `dark`, or `system` to follow the visitor's OS. Not
|
|
15
|
-
* defaulted to `system`: a light-only host would silently render a dark form
|
|
16
|
-
* for half its users.
|
|
17
|
-
*/
|
|
18
|
-
theme?: 'light' | 'dark' | 'system';
|
|
19
|
-
/**
|
|
20
|
-
* The brand colour. Drives the primary button, and - unless overridden below -
|
|
21
|
-
* its label, its hover, and the accent used for focus rings and links.
|
|
22
|
-
*/
|
|
23
|
-
primaryColor?: string;
|
|
24
|
-
/** Label on the primary button. Derived from `primaryColor` when omitted. */
|
|
25
|
-
primaryTextColor?: string;
|
|
26
|
-
/** Focus rings and links. Falls back to `primaryColor`. */
|
|
27
|
-
accentColor?: string;
|
|
28
|
-
textColor?: string;
|
|
29
|
-
borderColor?: string;
|
|
30
|
-
/** Background of error/info panels. */
|
|
31
|
-
panelColor?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The ground the component sits on. Leave unset when embedding (the host's
|
|
34
|
-
* page shows through); set it when the component owns the viewport, so its
|
|
35
|
-
* text can never resolve against a background it doesn't know about.
|
|
36
|
-
*/
|
|
37
|
-
background?: string;
|
|
38
|
-
/** Opaque ground for the card variant, the account dropdown, a pressed segment. */
|
|
39
|
-
surfaceColor?: string;
|
|
40
|
-
/** `card` wraps the screen in a bordered, raised container. Defaults to `none`. */
|
|
41
|
-
surface?: 'none' | 'card';
|
|
42
|
-
fontFamily?: string;
|
|
43
|
-
/** Corner radius on inputs and buttons, e.g. `"0px"` for square. */
|
|
44
|
-
radius?: string;
|
|
45
|
-
/** Height of inputs and buttons. Defaults to `"44px"`. */
|
|
46
|
-
controlHeight?: string;
|
|
47
|
-
}
|
|
3
|
+
import { a as KerneAppearance, K as KerneLocalization } from '../fr-E5mmylSH.js';
|
|
4
|
+
export { d as defaultLocalization, b as defaultTokens, f as fr, m as mergeLocalization, u as useLocalization } from '../fr-E5mmylSH.js';
|
|
5
|
+
import { PublicPlan, PublicPriceLabel, PublicPlanPrice, DriverSelection, SubscriptionWithPlan } from '@kerne/types';
|
|
48
6
|
|
|
49
7
|
interface KerneUIProps {
|
|
50
8
|
appearance?: KerneAppearance;
|
|
@@ -64,15 +22,11 @@ interface AuthFlowProps extends KerneUIProps {
|
|
|
64
22
|
onSuccess?: () => void;
|
|
65
23
|
/** Hand the session to another origin (the hosted portal's job). */
|
|
66
24
|
redirectUrl?: string;
|
|
67
|
-
/** Where emailed links should land. Defaults to the tenant's configured callbacks. */
|
|
68
|
-
magicLinkCallbackUrl?: string;
|
|
69
|
-
resetPasswordCallbackUrl?: string;
|
|
70
|
-
verificationCallbackUrl?: string;
|
|
71
25
|
/** Skip sign-up entirely, even on an OPEN tenant (e.g. an internal tool). */
|
|
72
26
|
allowSignUp?: boolean;
|
|
73
27
|
legal?: React.ReactNode;
|
|
74
28
|
}
|
|
75
|
-
declare function AuthFlow({ initialStep, step: controlledStep, onStepChange, onSuccess, redirectUrl,
|
|
29
|
+
declare function AuthFlow({ initialStep, step: controlledStep, onStepChange, onSuccess, redirectUrl, allowSignUp, legal, appearance, logo, className, }: AuthFlowProps): react_jsx_runtime.JSX.Element;
|
|
76
30
|
|
|
77
31
|
interface LoginFormProps extends KerneUIProps {
|
|
78
32
|
/** Called after a successful password sign-in. */
|
|
@@ -82,8 +36,6 @@ interface LoginFormProps extends KerneUIProps {
|
|
|
82
36
|
* job - see `redirectWithSession`). Takes precedence over `onSuccess`.
|
|
83
37
|
*/
|
|
84
38
|
redirectUrl?: string;
|
|
85
|
-
/** Where the emailed sign-in link should land. Defaults to the tenant's configured callback. */
|
|
86
|
-
magicLinkCallbackUrl?: string;
|
|
87
39
|
signUpUrl?: string;
|
|
88
40
|
onSignUpClick?: () => void;
|
|
89
41
|
forgotPasswordUrl?: string;
|
|
@@ -95,14 +47,12 @@ interface LoginFormProps extends KerneUIProps {
|
|
|
95
47
|
/** Small print under the form, e.g. terms and privacy links. */
|
|
96
48
|
legal?: React.ReactNode;
|
|
97
49
|
}
|
|
98
|
-
declare function LoginForm({ onSuccess, redirectUrl,
|
|
50
|
+
declare function LoginForm({ onSuccess, redirectUrl, signUpUrl, onSignUpClick, forgotPasswordUrl, onForgotPasswordClick, onOAuthSelect, title, subtitle, legal, appearance, logo, className, }: LoginFormProps): react_jsx_runtime.JSX.Element;
|
|
99
51
|
|
|
100
52
|
interface RegisterFormProps extends KerneUIProps {
|
|
101
53
|
onSuccess?: () => void;
|
|
102
54
|
/** Hand the session to another origin after sign-up (hosted portal). */
|
|
103
55
|
redirectUrl?: string;
|
|
104
|
-
/** Where the emailed sign-up link should land. Defaults to the tenant's configured callback. */
|
|
105
|
-
magicLinkCallbackUrl?: string;
|
|
106
56
|
/**
|
|
107
57
|
* Invitation token. Read from `?token=` in the URL when omitted, so an
|
|
108
58
|
* emailed invitation link works with no wiring on the host's side.
|
|
@@ -117,7 +67,7 @@ interface RegisterFormProps extends KerneUIProps {
|
|
|
117
67
|
/** Collect a display name alongside the credentials. */
|
|
118
68
|
collectName?: boolean;
|
|
119
69
|
}
|
|
120
|
-
declare function RegisterForm({ onSuccess, redirectUrl,
|
|
70
|
+
declare function RegisterForm({ onSuccess, redirectUrl, invitationToken: invitationTokenProp, signInUrl, onSignInClick, onOAuthSelect, title, subtitle, legal, collectName, appearance, logo, className, }: RegisterFormProps): react_jsx_runtime.JSX.Element;
|
|
121
71
|
|
|
122
72
|
interface MagicLinkCallbackProps extends KerneUIProps {
|
|
123
73
|
/** Overrides the `?token=` query param - for hosts that parse routes themselves. */
|
|
@@ -131,15 +81,13 @@ interface MagicLinkCallbackProps extends KerneUIProps {
|
|
|
131
81
|
declare function MagicLinkCallback({ token: tokenProp, onSuccess, redirectUrl, signInUrl, onSignInClick, appearance, logo, className, }: MagicLinkCallbackProps): react_jsx_runtime.JSX.Element;
|
|
132
82
|
|
|
133
83
|
interface ForgotPasswordFormProps extends KerneUIProps {
|
|
134
|
-
/** Where the emailed reset link should land. Defaults to the tenant's configured callback. */
|
|
135
|
-
callbackUrl?: string;
|
|
136
84
|
signInUrl?: string;
|
|
137
85
|
onSignInClick?: () => void;
|
|
138
86
|
onSent?: (email: string) => void;
|
|
139
87
|
title?: string;
|
|
140
88
|
subtitle?: React.ReactNode;
|
|
141
89
|
}
|
|
142
|
-
declare function ForgotPasswordForm({
|
|
90
|
+
declare function ForgotPasswordForm({ signInUrl, onSignInClick, onSent, title, subtitle, appearance, logo, className, }: ForgotPasswordFormProps): react_jsx_runtime.JSX.Element;
|
|
143
91
|
|
|
144
92
|
interface ResetPasswordFormProps extends KerneUIProps {
|
|
145
93
|
/** Overrides the `?token=` query param. */
|
|
@@ -155,13 +103,11 @@ declare function ResetPasswordForm({ token: tokenProp, signInUrl, onSignInClick,
|
|
|
155
103
|
interface VerifyEmailFormProps extends KerneUIProps {
|
|
156
104
|
/** Overrides the `?token=` query param. */
|
|
157
105
|
token?: string;
|
|
158
|
-
/** Where a resent verification link should land. */
|
|
159
|
-
callbackUrl?: string;
|
|
160
106
|
onVerified?: () => void;
|
|
161
107
|
title?: string;
|
|
162
108
|
subtitle?: React.ReactNode;
|
|
163
109
|
}
|
|
164
|
-
declare function VerifyEmailForm({ token: tokenProp,
|
|
110
|
+
declare function VerifyEmailForm({ token: tokenProp, onVerified, title, subtitle, appearance, logo, className, }: VerifyEmailFormProps): react_jsx_runtime.JSX.Element;
|
|
165
111
|
|
|
166
112
|
interface ActivateAccountFormProps extends KerneUIProps {
|
|
167
113
|
/** Overrides the `?token=` query param. */
|
|
@@ -248,16 +194,12 @@ interface UserProfileProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
248
194
|
onDeleted?: () => void;
|
|
249
195
|
productSlug?: string;
|
|
250
196
|
pricingProductIdOrSlug?: string;
|
|
251
|
-
portalReturnUrl?: string;
|
|
252
|
-
checkoutSuccessUrl?: string;
|
|
253
|
-
checkoutCancelUrl?: string;
|
|
254
197
|
showPlanSwitcher?: boolean;
|
|
255
198
|
showUsage?: boolean;
|
|
256
199
|
usageFeatureKeys?: string[];
|
|
257
200
|
usageLabels?: Record<string, string>;
|
|
258
|
-
verificationCallbackUrl?: string;
|
|
259
201
|
}
|
|
260
|
-
declare function UserProfile({ tabs, extraTabs, defaultTab, activeTab: controlledTab, onTabChange, showDeleteAccount, onSaved, onDeleted, productSlug, pricingProductIdOrSlug,
|
|
202
|
+
declare function UserProfile({ tabs, extraTabs, defaultTab, activeTab: controlledTab, onTabChange, showDeleteAccount, onSaved, onDeleted, productSlug, pricingProductIdOrSlug, showPlanSwitcher, showUsage, usageFeatureKeys, usageLabels, appearance, className, }: UserProfileProps): react_jsx_runtime.JSX.Element;
|
|
261
203
|
|
|
262
204
|
/**
|
|
263
205
|
* "Profile" pane: who the user is, and the address they sign in with.
|
|
@@ -268,11 +210,9 @@ declare function UserProfile({ tabs, extraTabs, defaultTab, activeTab: controlle
|
|
|
268
210
|
* fails on save.
|
|
269
211
|
*/
|
|
270
212
|
interface ProfileSectionProps {
|
|
271
|
-
/** Where a resent verification link should land. */
|
|
272
|
-
verificationCallbackUrl?: string;
|
|
273
213
|
onSaved?: () => void;
|
|
274
214
|
}
|
|
275
|
-
declare function ProfileSection({
|
|
215
|
+
declare function ProfileSection({ onSaved }: ProfileSectionProps): react_jsx_runtime.JSX.Element;
|
|
276
216
|
|
|
277
217
|
/**
|
|
278
218
|
* "Security" pane: password, and leaving.
|
|
@@ -296,38 +236,33 @@ declare function SecuritySection({ showDeleteAccount, onDeleted }: SecuritySecti
|
|
|
296
236
|
* "Billing" pane: the active plan, what it has been used for, and how to move
|
|
297
237
|
* to another one.
|
|
298
238
|
*
|
|
299
|
-
* The plan switcher
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
239
|
+
* The plan switcher used to be a bespoke, minimal list - deliberately not
|
|
240
|
+
* `<PricingTable>`, on the theory that a settings control shouldn't "sell" to
|
|
241
|
+
* someone who is already a customer. In practice that meant two independent
|
|
242
|
+
* implementations of "list plans, handle the switch" drifting apart (this one
|
|
243
|
+
* grouped prices by raw `interval` and had no path to a plan carrying a third
|
|
244
|
+
* price - early-bird, non-profit - where `<PricingTable>` already understood
|
|
245
|
+
* `PriceLabel`), and every fix to one never reached the other. This pane now
|
|
246
|
+
* composes the same `<PricingTable>` the marketing pricing page uses: one
|
|
247
|
+
* surface to keep polished instead of two to keep in sync.
|
|
308
248
|
*/
|
|
309
249
|
interface BillingSectionProps {
|
|
310
250
|
productSlug?: string;
|
|
311
251
|
/** Product the plan list is read from. Defaults to the tenant's default product. */
|
|
312
252
|
pricingProductIdOrSlug?: string;
|
|
313
|
-
portalReturnUrl?: string;
|
|
314
|
-
checkoutSuccessUrl?: string;
|
|
315
|
-
checkoutCancelUrl?: string;
|
|
316
253
|
/** Hide the plan switcher, e.g. when plan changes go through sales. */
|
|
317
254
|
showPlanSwitcher?: boolean;
|
|
318
255
|
showUsage?: boolean;
|
|
319
256
|
usageFeatureKeys?: string[];
|
|
320
257
|
usageLabels?: Record<string, string>;
|
|
321
258
|
}
|
|
322
|
-
declare function BillingSection({ productSlug, pricingProductIdOrSlug,
|
|
259
|
+
declare function BillingSection({ productSlug, pricingProductIdOrSlug, showPlanSwitcher, showUsage, usageFeatureKeys, usageLabels, }: BillingSectionProps): react_jsx_runtime.JSX.Element;
|
|
323
260
|
|
|
324
261
|
interface SubscriptionCardProps extends Omit<KerneUIProps, 'logo'> {
|
|
325
262
|
/** Restrict to one product, when the tenant sells several. */
|
|
326
263
|
productSlug?: string;
|
|
327
264
|
/** Heading above the details. Omit for the localized default, `null` for none. */
|
|
328
265
|
title?: string | null;
|
|
329
|
-
/** Where the provider portal should return to. */
|
|
330
|
-
portalReturnUrl?: string;
|
|
331
266
|
/** Shown when there is no active subscription - your pricing page. */
|
|
332
267
|
upgradeUrl?: string;
|
|
333
268
|
onUpgradeClick?: () => void;
|
|
@@ -336,7 +271,7 @@ interface SubscriptionCardProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
336
271
|
/** Hide the "Cancel subscription" button, e.g. when cancellation goes through sales/support. */
|
|
337
272
|
hideCancelButton?: boolean;
|
|
338
273
|
}
|
|
339
|
-
declare function SubscriptionCard({ productSlug, title,
|
|
274
|
+
declare function SubscriptionCard({ productSlug, title, upgradeUrl, onUpgradeClick, hidePortalButton, hideCancelButton, appearance, className, }: SubscriptionCardProps): react_jsx_runtime.JSX.Element;
|
|
340
275
|
|
|
341
276
|
interface UsageMetersProps extends Omit<KerneUIProps, 'logo'> {
|
|
342
277
|
/** Heading above the meters. Omit for the localized default, `null` for none. */
|
|
@@ -365,7 +300,7 @@ declare function UsageMeters({ title, featureKeys, showUnlimited, limit: maxRows
|
|
|
365
300
|
* (see EntitlementSummary), while the subscription payload does carry names -
|
|
366
301
|
* so components cross-reference the subscription first and only fall back
|
|
367
302
|
* here for a scope on a default pack, which has no subscription to read names
|
|
368
|
-
* from. Turning `api_calls` into "
|
|
303
|
+
* from. Turning `api_calls` into "API calls" is not as good as the real name;
|
|
369
304
|
* it is only better than showing a raw key to an end user.
|
|
370
305
|
*/
|
|
371
306
|
declare function humanizeFeatureKey(key: string): string;
|
|
@@ -435,8 +370,10 @@ interface PricingTableContextValue {
|
|
|
435
370
|
setSelectedLabelSlug: (slug: string) => void;
|
|
436
371
|
savings: LabelSavings | null;
|
|
437
372
|
currentPlanId: string | null;
|
|
373
|
+
/** The currency the subject is already billed in, or null with no subscription - see `Plan`'s currency-mismatch guard. */
|
|
374
|
+
currentPriceCurrency: string | null;
|
|
438
375
|
busyPriceId: string | null;
|
|
439
|
-
onSelectPlan: (plan: PublicPlan) => void;
|
|
376
|
+
onSelectPlan: (plan: PublicPlan, drivers?: DriverSelection[]) => void;
|
|
440
377
|
}
|
|
441
378
|
/**
|
|
442
379
|
* Headless access to the same state `<PricingTable.LabelSwitch>`/`<PricingTable.Plan>`
|
|
@@ -449,11 +386,12 @@ interface PricingTableProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
449
386
|
product?: string;
|
|
450
387
|
/** Label slug selected on first render. Defaults to the first label by PriceLabel.sort_order once the catalog loads. */
|
|
451
388
|
defaultLabel?: string;
|
|
452
|
-
/**
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Overrides the built-in checkout - e.g. a marketing site that wants its own confirmation step
|
|
391
|
+
* first. `drivers` carries what the buyer sized on the prepaid rails, and must be forwarded to
|
|
392
|
+
* `checkout()` or the sizing is lost.
|
|
393
|
+
*/
|
|
394
|
+
onSelectPlan?: (plan: PublicPlan, price: PublicPlanPrice, drivers?: DriverSelection[]) => void;
|
|
457
395
|
children: React.ReactNode;
|
|
458
396
|
}
|
|
459
397
|
/**
|
|
@@ -462,8 +400,9 @@ interface PricingTableProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
462
400
|
* once real data exists - they never have to handle a "plan not loaded yet"
|
|
463
401
|
* state of their own.
|
|
464
402
|
*/
|
|
465
|
-
declare function PricingTable({ product, defaultLabel,
|
|
403
|
+
declare function PricingTable({ product, defaultLabel, onSelectPlan, appearance, className, children, }: PricingTableProps): react_jsx_runtime.JSX.Element;
|
|
466
404
|
declare namespace PricingTable {
|
|
405
|
+
var Header: ({ eyebrow, headline, lede }: PricingTableHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
467
406
|
var LabelSwitch: () => react_jsx_runtime.JSX.Element | null;
|
|
468
407
|
var Plan: ({ slug, featured, badge, maxFeatures }: PricingTablePlanProps) => react_jsx_runtime.JSX.Element | null;
|
|
469
408
|
var Plans: ({ featuredSlug, featuredBadge, maxFeatures }: PricingTablePlansProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -485,6 +424,13 @@ interface PricingTablePlansProps {
|
|
|
485
424
|
featuredBadge?: string;
|
|
486
425
|
maxFeatures?: number;
|
|
487
426
|
}
|
|
427
|
+
interface PricingTableHeaderProps {
|
|
428
|
+
/** Small tracked line above the headline - a product name, a version, a category. */
|
|
429
|
+
eyebrow?: string;
|
|
430
|
+
headline: string;
|
|
431
|
+
/** One sentence under it. Say how billing works, not how great the product is. */
|
|
432
|
+
lede?: string;
|
|
433
|
+
}
|
|
488
434
|
|
|
489
435
|
interface CheckoutResultProps extends KerneUIProps {
|
|
490
436
|
/** `cancel` renders the abandoned-checkout copy and skips polling entirely. */
|
|
@@ -523,4 +469,4 @@ interface UpgradePromptProps extends Omit<KerneUIProps, 'logo'> {
|
|
|
523
469
|
}
|
|
524
470
|
declare function UpgradePrompt({ featureKey, requested, featureName, children, upgradeUrl, onUpgradeClick, upgradeLabel, title, description, hideWhileLoading, appearance, className, }: UpgradePromptProps): react_jsx_runtime.JSX.Element | null;
|
|
525
471
|
|
|
526
|
-
export { ActivateAccountForm, type ActivateAccountFormProps, AuthFlow, type AuthFlowProps, type AuthFlowStep, BillingSection, type BillingSectionProps, ChangePasswordForm, type ChangePasswordFormProps, CheckoutResult, type CheckoutResultProps, ForgotPasswordForm, type ForgotPasswordFormProps,
|
|
472
|
+
export { ActivateAccountForm, type ActivateAccountFormProps, AuthFlow, type AuthFlowProps, type AuthFlowStep, BillingSection, type BillingSectionProps, ChangePasswordForm, type ChangePasswordFormProps, CheckoutResult, type CheckoutResultProps, ForgotPasswordForm, type ForgotPasswordFormProps, KerneAppearance, KerneLocalization, type LabelSavings, LoginForm, type LoginFormProps, MagicLinkCallback, type MagicLinkCallbackProps, type PriceDisplay, PricingTable, type PricingTableHeaderProps, type PricingTablePlanProps, type PricingTablePlansProps, type PricingTableProps, ProfileSection, type ProfileSectionProps, RegisterForm, type RegisterFormProps, ResetPasswordForm, type ResetPasswordFormProps, SecuritySection, type SecuritySectionProps, SignOutButton, type SignOutButtonProps, SubscriptionCard, type SubscriptionCardProps, UpgradePrompt, type UpgradePromptProps, UsageMeters, type UsageMetersProps, UserButton, type UserButtonMenuItem, type UserButtonProps, UserProfile, type UserProfileExtraTab, type UserProfileProps, type UserProfileTab, VerifyEmailForm, type VerifyEmailFormProps, WaitlistForm, type WaitlistFormProps, collectPriceLabels, formatDate, formatInterval, formatMoney, formatNumber, humanizeFeatureKey, resolveLabelSavings, resolvePriceDisplay, usePricingTable };
|