@dloizides/auth-web 1.12.1 → 1.14.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/CHANGELOG.md +501 -386
- package/dist/index.d.mts +102 -10
- package/dist/index.d.ts +102 -10
- package/dist/index.js +155 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -62,7 +62,21 @@ interface AuthThemeTypography {
|
|
|
62
62
|
title: number;
|
|
63
63
|
/** Form subtitle. */
|
|
64
64
|
subtitle: number;
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Field labels.
|
|
67
|
+
*
|
|
68
|
+
* The shared forms contract ("The TWO legitimate label voices", mirrored in
|
|
69
|
+
* `@dloizides/ui-forms`' `labelVariants.ts`) defines exactly two: `field` —
|
|
70
|
+
* 13 / 600 / sentence case, a label that is READ — and `control` — 11 / 700 /
|
|
71
|
+
* uppercase, a label that is SCANNED. Auth field labels are prose addressed to
|
|
72
|
+
* the person signing in, so they are the `field` voice: **13**.
|
|
73
|
+
*
|
|
74
|
+
* Through 1.13.0 this default was 14, which is neither voice — drift. Every
|
|
75
|
+
* portal that renders `<LoginForm>` inherits this token (all of them reuse
|
|
76
|
+
* `defaultAuthTheme.typography` verbatim), so the drift was uniform across
|
|
77
|
+
* zygos, agora, erevna, katalogos and ichnos, and it read against the 13px
|
|
78
|
+
* `Field` labels those same apps use on every non-auth form.
|
|
79
|
+
*/
|
|
66
80
|
label: number;
|
|
67
81
|
/** Input text and button text. */
|
|
68
82
|
body: number;
|
|
@@ -412,6 +426,17 @@ interface DemoCredentialsHintLabels {
|
|
|
412
426
|
useCredentials: string;
|
|
413
427
|
/** Accessibility hint for that button. */
|
|
414
428
|
useCredentialsHint: string;
|
|
429
|
+
/**
|
|
430
|
+
* The collapsed disclosure trigger (e.g. "Try the demo").
|
|
431
|
+
*
|
|
432
|
+
* Keep the word "demo" in it. This one line is the ONLY thing an evaluator
|
|
433
|
+
* scanning the page has to find, so it must be searchable by the word they
|
|
434
|
+
* are looking for — a coy label like "Just looking?" is discreet at the cost
|
|
435
|
+
* of being undiscoverable, which defeats the point of shipping a demo.
|
|
436
|
+
*/
|
|
437
|
+
toggle: string;
|
|
438
|
+
/** Accessibility hint for the disclosure trigger. */
|
|
439
|
+
toggleHint: string;
|
|
415
440
|
}
|
|
416
441
|
declare const DEFAULT_DEMO_CREDENTIALS_HINT_LABELS: DemoCredentialsHintLabels;
|
|
417
442
|
|
|
@@ -1286,7 +1311,35 @@ interface PreferredMethodHintProps {
|
|
|
1286
1311
|
declare function PreferredMethodHint({ method, theme: themeProp, labels: labelsProp, testIdPrefix, }: Readonly<PreferredMethodHintProps>): ReactElement | null;
|
|
1287
1312
|
|
|
1288
1313
|
/**
|
|
1289
|
-
* `<DemoCredentialsHint>`
|
|
1314
|
+
* How `<DemoCredentialsHint>` presents itself on the login surface.
|
|
1315
|
+
*
|
|
1316
|
+
* The two variants answer opposite questions, and the choice is a product
|
|
1317
|
+
* decision rather than a styling one:
|
|
1318
|
+
*
|
|
1319
|
+
* - `Panel` assumes the page exists FOR the demo — a sales/marketing console
|
|
1320
|
+
* where every visitor is an evaluator. It advertises loudly.
|
|
1321
|
+
* - `Disclosure` assumes the page is a real customer's front door that ALSO
|
|
1322
|
+
* happens to offer a demo. Real account holders outnumber evaluators, so the
|
|
1323
|
+
* demo collapses behind one quiet line of text and costs them nothing.
|
|
1324
|
+
*
|
|
1325
|
+
* `Disclosure` is the default because the second case is the common one across
|
|
1326
|
+
* the estate: every product login screen is a page paying customers use daily.
|
|
1327
|
+
*
|
|
1328
|
+
* ⚠️ "Discreet" is achieved with SIZE, WEIGHT and POSITION — never by lowering
|
|
1329
|
+
* contrast. Both variants draw their text from `colors.textSecondary`, a token
|
|
1330
|
+
* every app already holds to the WCAG AA 4.5:1 floor. Dimming this further with
|
|
1331
|
+
* opacity would trade an accessibility guarantee for a visual preference; if a
|
|
1332
|
+
* consuming app's `textSecondary` fails AA, that is the app's token to fix.
|
|
1333
|
+
*/
|
|
1334
|
+
declare const enum DemoCredentialsHintVariant {
|
|
1335
|
+
/** Always-open inset panel with a brand rail. The original presentation. */
|
|
1336
|
+
Panel = "panel",
|
|
1337
|
+
/** One quiet "try the demo" line that expands the credentials on tap. */
|
|
1338
|
+
Disclosure = "disclosure"
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* `<DemoCredentialsHint>` — the public-demo credentials surface.
|
|
1290
1343
|
*
|
|
1291
1344
|
* Mount on the login surface of a product with an OPEN demo account whose
|
|
1292
1345
|
* credentials are already published (typically on the marketing site). It shows
|
|
@@ -1302,9 +1355,42 @@ declare function PreferredMethodHint({ method, theme: themeProp, labels: labelsP
|
|
|
1302
1355
|
* Fails closed: no credentials (or a half-configured pair) renders `null` — zero
|
|
1303
1356
|
* DOM — so a misconfigured env var can never publish an empty demo panel.
|
|
1304
1357
|
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1358
|
+
* ## Two variants, and why the default changed in 1.13.0
|
|
1359
|
+
*
|
|
1360
|
+
* Originally this only rendered an always-open panel above the form. That is
|
|
1361
|
+
* right for a page whose whole purpose IS the demo, and wrong for the far more
|
|
1362
|
+
* common case: a login screen paying customers use every day, where an
|
|
1363
|
+
* unmissable "here are some credentials" block is noise at best and a trust
|
|
1364
|
+
* problem at worst.
|
|
1365
|
+
*
|
|
1366
|
+
* `DemoCredentialsHintVariant.Disclosure` — now the default — collapses the
|
|
1367
|
+
* whole thing to one quiet line ("Try the demo") that expands on tap. Pass
|
|
1368
|
+
* `variant={DemoCredentialsHintVariant.Panel}` to keep the original block.
|
|
1369
|
+
*
|
|
1370
|
+
* ⚠️ Two things this deliberately does NOT do to achieve discretion:
|
|
1371
|
+
*
|
|
1372
|
+
* - **It does not lower contrast.** The trigger uses `colors.textSecondary`,
|
|
1373
|
+
* the same AA-held token as every other piece of helper copy. Discretion is
|
|
1374
|
+
* carried by size, placement and the absence of chrome.
|
|
1375
|
+
* - **It does not hide from assistive tech.** The trigger is a real focusable
|
|
1376
|
+
* button carrying an explicit `aria-expanded` (plus `accessibilityState` for
|
|
1377
|
+
* native), so a screen reader announces both that it exists and whether it is
|
|
1378
|
+
* open. Visually quiet must not mean absent — a demo nobody can find is a demo
|
|
1379
|
+
* nobody uses.
|
|
1380
|
+
*
|
|
1381
|
+
* ⚠️ Through 1.13.0 this carried ONLY `accessibilityState={{ expanded }}` and
|
|
1382
|
+
* therefore announced nothing on web: react-native-web 0.21.2 does not read
|
|
1383
|
+
* `accessibilityState`, so the rendered button had no `aria-expanded` at all.
|
|
1384
|
+
* The old unit test asserted the React *prop*, so it passed against the bug.
|
|
1385
|
+
*
|
|
1386
|
+
* ## Layout stability
|
|
1387
|
+
*
|
|
1388
|
+
* The expanded body renders BELOW the trigger, and the component is designed to
|
|
1389
|
+
* sit BELOW `<LoginForm>` (see the zygos login route). Expanding therefore grows
|
|
1390
|
+
* the card downward and never displaces the username or password inputs the
|
|
1391
|
+
* visitor may already be interacting with. Mounting it ABOVE the form would make
|
|
1392
|
+
* every expansion shove the fields down the page — precisely the jarring
|
|
1393
|
+
* behaviour a disclosure exists to avoid.
|
|
1308
1394
|
*/
|
|
1309
1395
|
|
|
1310
1396
|
interface DemoCredentialsHintProps {
|
|
@@ -1313,6 +1399,11 @@ interface DemoCredentialsHintProps {
|
|
|
1313
1399
|
* username or password — renders nothing at all.
|
|
1314
1400
|
*/
|
|
1315
1401
|
credentials?: DemoCredentials;
|
|
1402
|
+
/**
|
|
1403
|
+
* Presentation. Defaults to `Disclosure` (one quiet expandable line); pass
|
|
1404
|
+
* `Panel` for the original always-open block.
|
|
1405
|
+
*/
|
|
1406
|
+
variant?: DemoCredentialsHintVariant;
|
|
1316
1407
|
/** Explicit theme; overrides any `<AuthThemeProvider>`. */
|
|
1317
1408
|
theme?: AuthTheme;
|
|
1318
1409
|
/** Localised copy. Partial — unspecified keys fall back to English defaults. */
|
|
@@ -1321,13 +1412,13 @@ interface DemoCredentialsHintProps {
|
|
|
1321
1412
|
testIdPrefix?: string;
|
|
1322
1413
|
/**
|
|
1323
1414
|
* Called with the resolved credentials when the user taps "use these
|
|
1324
|
-
* credentials". Omit to render
|
|
1325
|
-
*
|
|
1415
|
+
* credentials". Omit to render read-only (no button) — the values are still
|
|
1416
|
+
* selectable, so a visitor can copy them by hand.
|
|
1326
1417
|
*/
|
|
1327
1418
|
onUse?: (credentials: DemoCredentials) => void;
|
|
1328
1419
|
}
|
|
1329
|
-
/** Themeable public-demo credentials
|
|
1330
|
-
declare function DemoCredentialsHint({ credentials, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1420
|
+
/** Themeable public-demo credentials surface. Renders `null` when there is no demo. */
|
|
1421
|
+
declare function DemoCredentialsHint({ credentials, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1331
1422
|
|
|
1332
1423
|
/**
|
|
1333
1424
|
* React context for the `AuthTheme`.
|
|
@@ -1438,6 +1529,7 @@ declare const AuthTestIds: {
|
|
|
1438
1529
|
readonly demoCredentialsUsername: "auth-demo-credentials-username";
|
|
1439
1530
|
readonly demoCredentialsPassword: "auth-demo-credentials-password";
|
|
1440
1531
|
readonly demoCredentialsUseButton: "auth-demo-credentials-use";
|
|
1532
|
+
readonly demoCredentialsToggle: "auth-demo-credentials-toggle";
|
|
1441
1533
|
};
|
|
1442
1534
|
/** Apply an optional prefix to a base test ID. */
|
|
1443
1535
|
declare function withTestIdPrefix(baseId: string, prefix?: string): string;
|
|
@@ -2255,4 +2347,4 @@ declare function validatePasswordPolicy(password: string): PasswordPolicyError[]
|
|
|
2255
2347
|
/** `true` when the password satisfies every policy rule. */
|
|
2256
2348
|
declare function isPasswordValid(password: string): boolean;
|
|
2257
2349
|
|
|
2258
|
-
export { AuthScreen, type AuthScreenProps, AuthTestIds, type AuthTheme, type AuthThemeColors, AuthThemeProvider, type AuthThemeProviderProps, type AuthThemeRadii, type AuthThemeSpacing, type AuthThemeTypography, BffAuthStatus, type BffDeviceState, type BffLoginConfig, type BffLogoutClient, type CreateBffAuthClientOptions, DEFAULT_AUTH_CARD_MAX_WIDTH, DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, DEFAULT_DEVICE_PIN_ENROLL_LABELS, DEFAULT_DEVICE_PIN_SETTINGS_LABELS, DEFAULT_DEVICE_PIN_UNLOCK_LABELS, DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS, DEFAULT_FORGOT_PASSWORD_LABELS, DEFAULT_LOGIN_LABELS, DEFAULT_OTP_LABELS, DEFAULT_PASSKEY_LOGIN_LABELS, DEFAULT_PASSKEY_SETTINGS_LABELS, DEFAULT_PIN_LABELS, DEFAULT_PREFERRED_METHOD_HINT_LABELS, DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEVICE_PIN_ALLOWED_DIGITS, DEVICE_PIN_DEFAULT_DIGITS, DemoCredentialsHint, type DemoCredentialsHintLabels, type DemoCredentialsHintProps, type DemoCredentialsHintWiring, type DemoCredentialsLoginFormProps, type DevicePinCapableClient, type DevicePinDisableCapableClient, type DevicePinEnrollCapableClient, DevicePinEnrollErrorKey, DevicePinEnrollForm, type DevicePinEnrollFormProps, type DevicePinEnrollLabels, type DevicePinEnrollResult, DevicePinErrorKey, DevicePinInput, type DevicePinInputProps, DevicePinLengthPicker, type DevicePinLengthPickerProps, DevicePinOffer, type DevicePinOfferProps, DevicePinSettingsCard, type DevicePinSettingsCardProps, type DevicePinSettingsLabels, type DevicePinUnlockCapableClient, type DevicePinUnlockLabels, type DevicePinUnlockResult, DevicePinUnlockScreen, type DevicePinUnlockScreenProps, type DevicePinUnlockedUser, ForgotPasswordFields, type ForgotPasswordFieldsLabels, type ForgotPasswordFieldsProps, ForgotPasswordForm, type ForgotPasswordFormLabels, type ForgotPasswordFormProps, type LoginConfigCapableClient, LoginForm, type LoginFormLabels, type LoginFormProps, OtpForm, type OtpFormLabels, type OtpFormProps, OtpLoginStep, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasskeyCeremonyMode, PasskeyCeremonyStatus, type PasskeyErrorCode, PasskeyLoginButton, type PasskeyLoginButtonProps, type PasskeyLoginLabels, PasskeySettingsCard, type PasskeySettingsCardProps, type PasskeySettingsLabels, PasswordPolicyError, type PerformBffLogoutOptions, PinForm, type PinFormLabels, type PinFormProps, type PreferencesClientOptions, type PreferredMethodClient, PreferredMethodHint, type PreferredMethodHintLabels, type PreferredMethodHintProps, PreferredMethodSettingsCard, type PreferredMethodSettingsCardProps, type PreferredMethodSettingsLabels, PrefillIntent, ResetPasswordError, ResetPasswordForm, type ResetPasswordFormLabels, type ResetPasswordFormProps, type RoleRoute, type RoleRouteTable, type UseBffAuthOptions, type UseBffAuthResult, type UseBffForgotPasswordOptions, type UseBffLoginConfigResult, type UseBffResetPasswordOptions, type UseDemoCredentialsOptions, type UseDemoCredentialsResult, type UseDevicePinDisableArgs, type UseDevicePinDisableResult, type UseDevicePinEnrollArgs, type UseDevicePinEnrollResult, type UseDevicePinUnlockArgs, type UseDevicePinUnlockResult, type UseForgotPasswordSubmitArgs, type UseForgotPasswordSubmitResult, type UseOtpLoginOptions, type UseOtpLoginResult, type UsePasskeyCeremonyOptions, type UsePasskeyCeremonyResult, type UsePinLoginOptions, type UsePinLoginResult, type UsePreferredMethodSettingArgs, type UsePreferredMethodSettingResult, type UseResetPasswordFormArgs, type UseResetPasswordFormResult, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
|
2350
|
+
export { AuthScreen, type AuthScreenProps, AuthTestIds, type AuthTheme, type AuthThemeColors, AuthThemeProvider, type AuthThemeProviderProps, type AuthThemeRadii, type AuthThemeSpacing, type AuthThemeTypography, BffAuthStatus, type BffDeviceState, type BffLoginConfig, type BffLogoutClient, type CreateBffAuthClientOptions, DEFAULT_AUTH_CARD_MAX_WIDTH, DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, DEFAULT_DEVICE_PIN_ENROLL_LABELS, DEFAULT_DEVICE_PIN_SETTINGS_LABELS, DEFAULT_DEVICE_PIN_UNLOCK_LABELS, DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS, DEFAULT_FORGOT_PASSWORD_LABELS, DEFAULT_LOGIN_LABELS, DEFAULT_OTP_LABELS, DEFAULT_PASSKEY_LOGIN_LABELS, DEFAULT_PASSKEY_SETTINGS_LABELS, DEFAULT_PIN_LABELS, DEFAULT_PREFERRED_METHOD_HINT_LABELS, DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEVICE_PIN_ALLOWED_DIGITS, DEVICE_PIN_DEFAULT_DIGITS, DemoCredentialsHint, type DemoCredentialsHintLabels, type DemoCredentialsHintProps, DemoCredentialsHintVariant, type DemoCredentialsHintWiring, type DemoCredentialsLoginFormProps, type DevicePinCapableClient, type DevicePinDisableCapableClient, type DevicePinEnrollCapableClient, DevicePinEnrollErrorKey, DevicePinEnrollForm, type DevicePinEnrollFormProps, type DevicePinEnrollLabels, type DevicePinEnrollResult, DevicePinErrorKey, DevicePinInput, type DevicePinInputProps, DevicePinLengthPicker, type DevicePinLengthPickerProps, DevicePinOffer, type DevicePinOfferProps, DevicePinSettingsCard, type DevicePinSettingsCardProps, type DevicePinSettingsLabels, type DevicePinUnlockCapableClient, type DevicePinUnlockLabels, type DevicePinUnlockResult, DevicePinUnlockScreen, type DevicePinUnlockScreenProps, type DevicePinUnlockedUser, ForgotPasswordFields, type ForgotPasswordFieldsLabels, type ForgotPasswordFieldsProps, ForgotPasswordForm, type ForgotPasswordFormLabels, type ForgotPasswordFormProps, type LoginConfigCapableClient, LoginForm, type LoginFormLabels, type LoginFormProps, OtpForm, type OtpFormLabels, type OtpFormProps, OtpLoginStep, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasskeyCeremonyMode, PasskeyCeremonyStatus, type PasskeyErrorCode, PasskeyLoginButton, type PasskeyLoginButtonProps, type PasskeyLoginLabels, PasskeySettingsCard, type PasskeySettingsCardProps, type PasskeySettingsLabels, PasswordPolicyError, type PerformBffLogoutOptions, PinForm, type PinFormLabels, type PinFormProps, type PreferencesClientOptions, type PreferredMethodClient, PreferredMethodHint, type PreferredMethodHintLabels, type PreferredMethodHintProps, PreferredMethodSettingsCard, type PreferredMethodSettingsCardProps, type PreferredMethodSettingsLabels, PrefillIntent, ResetPasswordError, ResetPasswordForm, type ResetPasswordFormLabels, type ResetPasswordFormProps, type RoleRoute, type RoleRouteTable, type UseBffAuthOptions, type UseBffAuthResult, type UseBffForgotPasswordOptions, type UseBffLoginConfigResult, type UseBffResetPasswordOptions, type UseDemoCredentialsOptions, type UseDemoCredentialsResult, type UseDevicePinDisableArgs, type UseDevicePinDisableResult, type UseDevicePinEnrollArgs, type UseDevicePinEnrollResult, type UseDevicePinUnlockArgs, type UseDevicePinUnlockResult, type UseForgotPasswordSubmitArgs, type UseForgotPasswordSubmitResult, type UseOtpLoginOptions, type UseOtpLoginResult, type UsePasskeyCeremonyOptions, type UsePasskeyCeremonyResult, type UsePinLoginOptions, type UsePinLoginResult, type UsePreferredMethodSettingArgs, type UsePreferredMethodSettingResult, type UseResetPasswordFormArgs, type UseResetPasswordFormResult, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
package/dist/index.d.ts
CHANGED
|
@@ -62,7 +62,21 @@ interface AuthThemeTypography {
|
|
|
62
62
|
title: number;
|
|
63
63
|
/** Form subtitle. */
|
|
64
64
|
subtitle: number;
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Field labels.
|
|
67
|
+
*
|
|
68
|
+
* The shared forms contract ("The TWO legitimate label voices", mirrored in
|
|
69
|
+
* `@dloizides/ui-forms`' `labelVariants.ts`) defines exactly two: `field` —
|
|
70
|
+
* 13 / 600 / sentence case, a label that is READ — and `control` — 11 / 700 /
|
|
71
|
+
* uppercase, a label that is SCANNED. Auth field labels are prose addressed to
|
|
72
|
+
* the person signing in, so they are the `field` voice: **13**.
|
|
73
|
+
*
|
|
74
|
+
* Through 1.13.0 this default was 14, which is neither voice — drift. Every
|
|
75
|
+
* portal that renders `<LoginForm>` inherits this token (all of them reuse
|
|
76
|
+
* `defaultAuthTheme.typography` verbatim), so the drift was uniform across
|
|
77
|
+
* zygos, agora, erevna, katalogos and ichnos, and it read against the 13px
|
|
78
|
+
* `Field` labels those same apps use on every non-auth form.
|
|
79
|
+
*/
|
|
66
80
|
label: number;
|
|
67
81
|
/** Input text and button text. */
|
|
68
82
|
body: number;
|
|
@@ -412,6 +426,17 @@ interface DemoCredentialsHintLabels {
|
|
|
412
426
|
useCredentials: string;
|
|
413
427
|
/** Accessibility hint for that button. */
|
|
414
428
|
useCredentialsHint: string;
|
|
429
|
+
/**
|
|
430
|
+
* The collapsed disclosure trigger (e.g. "Try the demo").
|
|
431
|
+
*
|
|
432
|
+
* Keep the word "demo" in it. This one line is the ONLY thing an evaluator
|
|
433
|
+
* scanning the page has to find, so it must be searchable by the word they
|
|
434
|
+
* are looking for — a coy label like "Just looking?" is discreet at the cost
|
|
435
|
+
* of being undiscoverable, which defeats the point of shipping a demo.
|
|
436
|
+
*/
|
|
437
|
+
toggle: string;
|
|
438
|
+
/** Accessibility hint for the disclosure trigger. */
|
|
439
|
+
toggleHint: string;
|
|
415
440
|
}
|
|
416
441
|
declare const DEFAULT_DEMO_CREDENTIALS_HINT_LABELS: DemoCredentialsHintLabels;
|
|
417
442
|
|
|
@@ -1286,7 +1311,35 @@ interface PreferredMethodHintProps {
|
|
|
1286
1311
|
declare function PreferredMethodHint({ method, theme: themeProp, labels: labelsProp, testIdPrefix, }: Readonly<PreferredMethodHintProps>): ReactElement | null;
|
|
1287
1312
|
|
|
1288
1313
|
/**
|
|
1289
|
-
* `<DemoCredentialsHint>`
|
|
1314
|
+
* How `<DemoCredentialsHint>` presents itself on the login surface.
|
|
1315
|
+
*
|
|
1316
|
+
* The two variants answer opposite questions, and the choice is a product
|
|
1317
|
+
* decision rather than a styling one:
|
|
1318
|
+
*
|
|
1319
|
+
* - `Panel` assumes the page exists FOR the demo — a sales/marketing console
|
|
1320
|
+
* where every visitor is an evaluator. It advertises loudly.
|
|
1321
|
+
* - `Disclosure` assumes the page is a real customer's front door that ALSO
|
|
1322
|
+
* happens to offer a demo. Real account holders outnumber evaluators, so the
|
|
1323
|
+
* demo collapses behind one quiet line of text and costs them nothing.
|
|
1324
|
+
*
|
|
1325
|
+
* `Disclosure` is the default because the second case is the common one across
|
|
1326
|
+
* the estate: every product login screen is a page paying customers use daily.
|
|
1327
|
+
*
|
|
1328
|
+
* ⚠️ "Discreet" is achieved with SIZE, WEIGHT and POSITION — never by lowering
|
|
1329
|
+
* contrast. Both variants draw their text from `colors.textSecondary`, a token
|
|
1330
|
+
* every app already holds to the WCAG AA 4.5:1 floor. Dimming this further with
|
|
1331
|
+
* opacity would trade an accessibility guarantee for a visual preference; if a
|
|
1332
|
+
* consuming app's `textSecondary` fails AA, that is the app's token to fix.
|
|
1333
|
+
*/
|
|
1334
|
+
declare const enum DemoCredentialsHintVariant {
|
|
1335
|
+
/** Always-open inset panel with a brand rail. The original presentation. */
|
|
1336
|
+
Panel = "panel",
|
|
1337
|
+
/** One quiet "try the demo" line that expands the credentials on tap. */
|
|
1338
|
+
Disclosure = "disclosure"
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* `<DemoCredentialsHint>` — the public-demo credentials surface.
|
|
1290
1343
|
*
|
|
1291
1344
|
* Mount on the login surface of a product with an OPEN demo account whose
|
|
1292
1345
|
* credentials are already published (typically on the marketing site). It shows
|
|
@@ -1302,9 +1355,42 @@ declare function PreferredMethodHint({ method, theme: themeProp, labels: labelsP
|
|
|
1302
1355
|
* Fails closed: no credentials (or a half-configured pair) renders `null` — zero
|
|
1303
1356
|
* DOM — so a misconfigured env var can never publish an empty demo panel.
|
|
1304
1357
|
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1358
|
+
* ## Two variants, and why the default changed in 1.13.0
|
|
1359
|
+
*
|
|
1360
|
+
* Originally this only rendered an always-open panel above the form. That is
|
|
1361
|
+
* right for a page whose whole purpose IS the demo, and wrong for the far more
|
|
1362
|
+
* common case: a login screen paying customers use every day, where an
|
|
1363
|
+
* unmissable "here are some credentials" block is noise at best and a trust
|
|
1364
|
+
* problem at worst.
|
|
1365
|
+
*
|
|
1366
|
+
* `DemoCredentialsHintVariant.Disclosure` — now the default — collapses the
|
|
1367
|
+
* whole thing to one quiet line ("Try the demo") that expands on tap. Pass
|
|
1368
|
+
* `variant={DemoCredentialsHintVariant.Panel}` to keep the original block.
|
|
1369
|
+
*
|
|
1370
|
+
* ⚠️ Two things this deliberately does NOT do to achieve discretion:
|
|
1371
|
+
*
|
|
1372
|
+
* - **It does not lower contrast.** The trigger uses `colors.textSecondary`,
|
|
1373
|
+
* the same AA-held token as every other piece of helper copy. Discretion is
|
|
1374
|
+
* carried by size, placement and the absence of chrome.
|
|
1375
|
+
* - **It does not hide from assistive tech.** The trigger is a real focusable
|
|
1376
|
+
* button carrying an explicit `aria-expanded` (plus `accessibilityState` for
|
|
1377
|
+
* native), so a screen reader announces both that it exists and whether it is
|
|
1378
|
+
* open. Visually quiet must not mean absent — a demo nobody can find is a demo
|
|
1379
|
+
* nobody uses.
|
|
1380
|
+
*
|
|
1381
|
+
* ⚠️ Through 1.13.0 this carried ONLY `accessibilityState={{ expanded }}` and
|
|
1382
|
+
* therefore announced nothing on web: react-native-web 0.21.2 does not read
|
|
1383
|
+
* `accessibilityState`, so the rendered button had no `aria-expanded` at all.
|
|
1384
|
+
* The old unit test asserted the React *prop*, so it passed against the bug.
|
|
1385
|
+
*
|
|
1386
|
+
* ## Layout stability
|
|
1387
|
+
*
|
|
1388
|
+
* The expanded body renders BELOW the trigger, and the component is designed to
|
|
1389
|
+
* sit BELOW `<LoginForm>` (see the zygos login route). Expanding therefore grows
|
|
1390
|
+
* the card downward and never displaces the username or password inputs the
|
|
1391
|
+
* visitor may already be interacting with. Mounting it ABOVE the form would make
|
|
1392
|
+
* every expansion shove the fields down the page — precisely the jarring
|
|
1393
|
+
* behaviour a disclosure exists to avoid.
|
|
1308
1394
|
*/
|
|
1309
1395
|
|
|
1310
1396
|
interface DemoCredentialsHintProps {
|
|
@@ -1313,6 +1399,11 @@ interface DemoCredentialsHintProps {
|
|
|
1313
1399
|
* username or password — renders nothing at all.
|
|
1314
1400
|
*/
|
|
1315
1401
|
credentials?: DemoCredentials;
|
|
1402
|
+
/**
|
|
1403
|
+
* Presentation. Defaults to `Disclosure` (one quiet expandable line); pass
|
|
1404
|
+
* `Panel` for the original always-open block.
|
|
1405
|
+
*/
|
|
1406
|
+
variant?: DemoCredentialsHintVariant;
|
|
1316
1407
|
/** Explicit theme; overrides any `<AuthThemeProvider>`. */
|
|
1317
1408
|
theme?: AuthTheme;
|
|
1318
1409
|
/** Localised copy. Partial — unspecified keys fall back to English defaults. */
|
|
@@ -1321,13 +1412,13 @@ interface DemoCredentialsHintProps {
|
|
|
1321
1412
|
testIdPrefix?: string;
|
|
1322
1413
|
/**
|
|
1323
1414
|
* Called with the resolved credentials when the user taps "use these
|
|
1324
|
-
* credentials". Omit to render
|
|
1325
|
-
*
|
|
1415
|
+
* credentials". Omit to render read-only (no button) — the values are still
|
|
1416
|
+
* selectable, so a visitor can copy them by hand.
|
|
1326
1417
|
*/
|
|
1327
1418
|
onUse?: (credentials: DemoCredentials) => void;
|
|
1328
1419
|
}
|
|
1329
|
-
/** Themeable public-demo credentials
|
|
1330
|
-
declare function DemoCredentialsHint({ credentials, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1420
|
+
/** Themeable public-demo credentials surface. Renders `null` when there is no demo. */
|
|
1421
|
+
declare function DemoCredentialsHint({ credentials, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1331
1422
|
|
|
1332
1423
|
/**
|
|
1333
1424
|
* React context for the `AuthTheme`.
|
|
@@ -1438,6 +1529,7 @@ declare const AuthTestIds: {
|
|
|
1438
1529
|
readonly demoCredentialsUsername: "auth-demo-credentials-username";
|
|
1439
1530
|
readonly demoCredentialsPassword: "auth-demo-credentials-password";
|
|
1440
1531
|
readonly demoCredentialsUseButton: "auth-demo-credentials-use";
|
|
1532
|
+
readonly demoCredentialsToggle: "auth-demo-credentials-toggle";
|
|
1441
1533
|
};
|
|
1442
1534
|
/** Apply an optional prefix to a base test ID. */
|
|
1443
1535
|
declare function withTestIdPrefix(baseId: string, prefix?: string): string;
|
|
@@ -2255,4 +2347,4 @@ declare function validatePasswordPolicy(password: string): PasswordPolicyError[]
|
|
|
2255
2347
|
/** `true` when the password satisfies every policy rule. */
|
|
2256
2348
|
declare function isPasswordValid(password: string): boolean;
|
|
2257
2349
|
|
|
2258
|
-
export { AuthScreen, type AuthScreenProps, AuthTestIds, type AuthTheme, type AuthThemeColors, AuthThemeProvider, type AuthThemeProviderProps, type AuthThemeRadii, type AuthThemeSpacing, type AuthThemeTypography, BffAuthStatus, type BffDeviceState, type BffLoginConfig, type BffLogoutClient, type CreateBffAuthClientOptions, DEFAULT_AUTH_CARD_MAX_WIDTH, DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, DEFAULT_DEVICE_PIN_ENROLL_LABELS, DEFAULT_DEVICE_PIN_SETTINGS_LABELS, DEFAULT_DEVICE_PIN_UNLOCK_LABELS, DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS, DEFAULT_FORGOT_PASSWORD_LABELS, DEFAULT_LOGIN_LABELS, DEFAULT_OTP_LABELS, DEFAULT_PASSKEY_LOGIN_LABELS, DEFAULT_PASSKEY_SETTINGS_LABELS, DEFAULT_PIN_LABELS, DEFAULT_PREFERRED_METHOD_HINT_LABELS, DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEVICE_PIN_ALLOWED_DIGITS, DEVICE_PIN_DEFAULT_DIGITS, DemoCredentialsHint, type DemoCredentialsHintLabels, type DemoCredentialsHintProps, type DemoCredentialsHintWiring, type DemoCredentialsLoginFormProps, type DevicePinCapableClient, type DevicePinDisableCapableClient, type DevicePinEnrollCapableClient, DevicePinEnrollErrorKey, DevicePinEnrollForm, type DevicePinEnrollFormProps, type DevicePinEnrollLabels, type DevicePinEnrollResult, DevicePinErrorKey, DevicePinInput, type DevicePinInputProps, DevicePinLengthPicker, type DevicePinLengthPickerProps, DevicePinOffer, type DevicePinOfferProps, DevicePinSettingsCard, type DevicePinSettingsCardProps, type DevicePinSettingsLabels, type DevicePinUnlockCapableClient, type DevicePinUnlockLabels, type DevicePinUnlockResult, DevicePinUnlockScreen, type DevicePinUnlockScreenProps, type DevicePinUnlockedUser, ForgotPasswordFields, type ForgotPasswordFieldsLabels, type ForgotPasswordFieldsProps, ForgotPasswordForm, type ForgotPasswordFormLabels, type ForgotPasswordFormProps, type LoginConfigCapableClient, LoginForm, type LoginFormLabels, type LoginFormProps, OtpForm, type OtpFormLabels, type OtpFormProps, OtpLoginStep, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasskeyCeremonyMode, PasskeyCeremonyStatus, type PasskeyErrorCode, PasskeyLoginButton, type PasskeyLoginButtonProps, type PasskeyLoginLabels, PasskeySettingsCard, type PasskeySettingsCardProps, type PasskeySettingsLabels, PasswordPolicyError, type PerformBffLogoutOptions, PinForm, type PinFormLabels, type PinFormProps, type PreferencesClientOptions, type PreferredMethodClient, PreferredMethodHint, type PreferredMethodHintLabels, type PreferredMethodHintProps, PreferredMethodSettingsCard, type PreferredMethodSettingsCardProps, type PreferredMethodSettingsLabels, PrefillIntent, ResetPasswordError, ResetPasswordForm, type ResetPasswordFormLabels, type ResetPasswordFormProps, type RoleRoute, type RoleRouteTable, type UseBffAuthOptions, type UseBffAuthResult, type UseBffForgotPasswordOptions, type UseBffLoginConfigResult, type UseBffResetPasswordOptions, type UseDemoCredentialsOptions, type UseDemoCredentialsResult, type UseDevicePinDisableArgs, type UseDevicePinDisableResult, type UseDevicePinEnrollArgs, type UseDevicePinEnrollResult, type UseDevicePinUnlockArgs, type UseDevicePinUnlockResult, type UseForgotPasswordSubmitArgs, type UseForgotPasswordSubmitResult, type UseOtpLoginOptions, type UseOtpLoginResult, type UsePasskeyCeremonyOptions, type UsePasskeyCeremonyResult, type UsePinLoginOptions, type UsePinLoginResult, type UsePreferredMethodSettingArgs, type UsePreferredMethodSettingResult, type UseResetPasswordFormArgs, type UseResetPasswordFormResult, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
|
2350
|
+
export { AuthScreen, type AuthScreenProps, AuthTestIds, type AuthTheme, type AuthThemeColors, AuthThemeProvider, type AuthThemeProviderProps, type AuthThemeRadii, type AuthThemeSpacing, type AuthThemeTypography, BffAuthStatus, type BffDeviceState, type BffLoginConfig, type BffLogoutClient, type CreateBffAuthClientOptions, DEFAULT_AUTH_CARD_MAX_WIDTH, DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, DEFAULT_DEVICE_PIN_ENROLL_LABELS, DEFAULT_DEVICE_PIN_SETTINGS_LABELS, DEFAULT_DEVICE_PIN_UNLOCK_LABELS, DEFAULT_FORGOT_PASSWORD_FIELDS_LABELS, DEFAULT_FORGOT_PASSWORD_LABELS, DEFAULT_LOGIN_LABELS, DEFAULT_OTP_LABELS, DEFAULT_PASSKEY_LOGIN_LABELS, DEFAULT_PASSKEY_SETTINGS_LABELS, DEFAULT_PIN_LABELS, DEFAULT_PREFERRED_METHOD_HINT_LABELS, DEFAULT_PREFERRED_METHOD_SETTINGS_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEVICE_PIN_ALLOWED_DIGITS, DEVICE_PIN_DEFAULT_DIGITS, DemoCredentialsHint, type DemoCredentialsHintLabels, type DemoCredentialsHintProps, DemoCredentialsHintVariant, type DemoCredentialsHintWiring, type DemoCredentialsLoginFormProps, type DevicePinCapableClient, type DevicePinDisableCapableClient, type DevicePinEnrollCapableClient, DevicePinEnrollErrorKey, DevicePinEnrollForm, type DevicePinEnrollFormProps, type DevicePinEnrollLabels, type DevicePinEnrollResult, DevicePinErrorKey, DevicePinInput, type DevicePinInputProps, DevicePinLengthPicker, type DevicePinLengthPickerProps, DevicePinOffer, type DevicePinOfferProps, DevicePinSettingsCard, type DevicePinSettingsCardProps, type DevicePinSettingsLabels, type DevicePinUnlockCapableClient, type DevicePinUnlockLabels, type DevicePinUnlockResult, DevicePinUnlockScreen, type DevicePinUnlockScreenProps, type DevicePinUnlockedUser, ForgotPasswordFields, type ForgotPasswordFieldsLabels, type ForgotPasswordFieldsProps, ForgotPasswordForm, type ForgotPasswordFormLabels, type ForgotPasswordFormProps, type LoginConfigCapableClient, LoginForm, type LoginFormLabels, type LoginFormProps, OtpForm, type OtpFormLabels, type OtpFormProps, OtpLoginStep, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasskeyCeremonyMode, PasskeyCeremonyStatus, type PasskeyErrorCode, PasskeyLoginButton, type PasskeyLoginButtonProps, type PasskeyLoginLabels, PasskeySettingsCard, type PasskeySettingsCardProps, type PasskeySettingsLabels, PasswordPolicyError, type PerformBffLogoutOptions, PinForm, type PinFormLabels, type PinFormProps, type PreferencesClientOptions, type PreferredMethodClient, PreferredMethodHint, type PreferredMethodHintLabels, type PreferredMethodHintProps, PreferredMethodSettingsCard, type PreferredMethodSettingsCardProps, type PreferredMethodSettingsLabels, PrefillIntent, ResetPasswordError, ResetPasswordForm, type ResetPasswordFormLabels, type ResetPasswordFormProps, type RoleRoute, type RoleRouteTable, type UseBffAuthOptions, type UseBffAuthResult, type UseBffForgotPasswordOptions, type UseBffLoginConfigResult, type UseBffResetPasswordOptions, type UseDemoCredentialsOptions, type UseDemoCredentialsResult, type UseDevicePinDisableArgs, type UseDevicePinDisableResult, type UseDevicePinEnrollArgs, type UseDevicePinEnrollResult, type UseDevicePinUnlockArgs, type UseDevicePinUnlockResult, type UseForgotPasswordSubmitArgs, type UseForgotPasswordSubmitResult, type UseOtpLoginOptions, type UseOtpLoginResult, type UsePasskeyCeremonyOptions, type UsePasskeyCeremonyResult, type UsePinLoginOptions, type UsePinLoginResult, type UsePreferredMethodSettingArgs, type UsePreferredMethodSettingResult, type UseResetPasswordFormArgs, type UseResetPasswordFormResult, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|