@dloizides/auth-web 1.12.1 → 1.13.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 +431 -386
- package/dist/index.d.mts +81 -9
- package/dist/index.d.ts +81 -9
- package/dist/index.js +137 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +137 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -412,6 +412,17 @@ interface DemoCredentialsHintLabels {
|
|
|
412
412
|
useCredentials: string;
|
|
413
413
|
/** Accessibility hint for that button. */
|
|
414
414
|
useCredentialsHint: string;
|
|
415
|
+
/**
|
|
416
|
+
* The collapsed disclosure trigger (e.g. "Try the demo").
|
|
417
|
+
*
|
|
418
|
+
* Keep the word "demo" in it. This one line is the ONLY thing an evaluator
|
|
419
|
+
* scanning the page has to find, so it must be searchable by the word they
|
|
420
|
+
* are looking for — a coy label like "Just looking?" is discreet at the cost
|
|
421
|
+
* of being undiscoverable, which defeats the point of shipping a demo.
|
|
422
|
+
*/
|
|
423
|
+
toggle: string;
|
|
424
|
+
/** Accessibility hint for the disclosure trigger. */
|
|
425
|
+
toggleHint: string;
|
|
415
426
|
}
|
|
416
427
|
declare const DEFAULT_DEMO_CREDENTIALS_HINT_LABELS: DemoCredentialsHintLabels;
|
|
417
428
|
|
|
@@ -1286,7 +1297,35 @@ interface PreferredMethodHintProps {
|
|
|
1286
1297
|
declare function PreferredMethodHint({ method, theme: themeProp, labels: labelsProp, testIdPrefix, }: Readonly<PreferredMethodHintProps>): ReactElement | null;
|
|
1287
1298
|
|
|
1288
1299
|
/**
|
|
1289
|
-
* `<DemoCredentialsHint>`
|
|
1300
|
+
* How `<DemoCredentialsHint>` presents itself on the login surface.
|
|
1301
|
+
*
|
|
1302
|
+
* The two variants answer opposite questions, and the choice is a product
|
|
1303
|
+
* decision rather than a styling one:
|
|
1304
|
+
*
|
|
1305
|
+
* - `Panel` assumes the page exists FOR the demo — a sales/marketing console
|
|
1306
|
+
* where every visitor is an evaluator. It advertises loudly.
|
|
1307
|
+
* - `Disclosure` assumes the page is a real customer's front door that ALSO
|
|
1308
|
+
* happens to offer a demo. Real account holders outnumber evaluators, so the
|
|
1309
|
+
* demo collapses behind one quiet line of text and costs them nothing.
|
|
1310
|
+
*
|
|
1311
|
+
* `Disclosure` is the default because the second case is the common one across
|
|
1312
|
+
* the estate: every product login screen is a page paying customers use daily.
|
|
1313
|
+
*
|
|
1314
|
+
* ⚠️ "Discreet" is achieved with SIZE, WEIGHT and POSITION — never by lowering
|
|
1315
|
+
* contrast. Both variants draw their text from `colors.textSecondary`, a token
|
|
1316
|
+
* every app already holds to the WCAG AA 4.5:1 floor. Dimming this further with
|
|
1317
|
+
* opacity would trade an accessibility guarantee for a visual preference; if a
|
|
1318
|
+
* consuming app's `textSecondary` fails AA, that is the app's token to fix.
|
|
1319
|
+
*/
|
|
1320
|
+
declare const enum DemoCredentialsHintVariant {
|
|
1321
|
+
/** Always-open inset panel with a brand rail. The original presentation. */
|
|
1322
|
+
Panel = "panel",
|
|
1323
|
+
/** One quiet "try the demo" line that expands the credentials on tap. */
|
|
1324
|
+
Disclosure = "disclosure"
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* `<DemoCredentialsHint>` — the public-demo credentials surface.
|
|
1290
1329
|
*
|
|
1291
1330
|
* Mount on the login surface of a product with an OPEN demo account whose
|
|
1292
1331
|
* credentials are already published (typically on the marketing site). It shows
|
|
@@ -1302,9 +1341,36 @@ declare function PreferredMethodHint({ method, theme: themeProp, labels: labelsP
|
|
|
1302
1341
|
* Fails closed: no credentials (or a half-configured pair) renders `null` — zero
|
|
1303
1342
|
* DOM — so a misconfigured env var can never publish an empty demo panel.
|
|
1304
1343
|
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1344
|
+
* ## Two variants, and why the default changed in 1.13.0
|
|
1345
|
+
*
|
|
1346
|
+
* Originally this only rendered an always-open panel above the form. That is
|
|
1347
|
+
* right for a page whose whole purpose IS the demo, and wrong for the far more
|
|
1348
|
+
* common case: a login screen paying customers use every day, where an
|
|
1349
|
+
* unmissable "here are some credentials" block is noise at best and a trust
|
|
1350
|
+
* problem at worst.
|
|
1351
|
+
*
|
|
1352
|
+
* `DemoCredentialsHintVariant.Disclosure` — now the default — collapses the
|
|
1353
|
+
* whole thing to one quiet line ("Try the demo") that expands on tap. Pass
|
|
1354
|
+
* `variant={DemoCredentialsHintVariant.Panel}` to keep the original block.
|
|
1355
|
+
*
|
|
1356
|
+
* ⚠️ Two things this deliberately does NOT do to achieve discretion:
|
|
1357
|
+
*
|
|
1358
|
+
* - **It does not lower contrast.** The trigger uses `colors.textSecondary`,
|
|
1359
|
+
* the same AA-held token as every other piece of helper copy. Discretion is
|
|
1360
|
+
* carried by size, placement and the absence of chrome.
|
|
1361
|
+
* - **It does not hide from assistive tech.** The trigger is a real focusable
|
|
1362
|
+
* button carrying `accessibilityState.expanded`, so a screen reader
|
|
1363
|
+
* announces both that it exists and whether it is open. Visually quiet must
|
|
1364
|
+
* not mean absent — a demo nobody can find is a demo nobody uses.
|
|
1365
|
+
*
|
|
1366
|
+
* ## Layout stability
|
|
1367
|
+
*
|
|
1368
|
+
* The expanded body renders BELOW the trigger, and the component is designed to
|
|
1369
|
+
* sit BELOW `<LoginForm>` (see the zygos login route). Expanding therefore grows
|
|
1370
|
+
* the card downward and never displaces the username or password inputs the
|
|
1371
|
+
* visitor may already be interacting with. Mounting it ABOVE the form would make
|
|
1372
|
+
* every expansion shove the fields down the page — precisely the jarring
|
|
1373
|
+
* behaviour a disclosure exists to avoid.
|
|
1308
1374
|
*/
|
|
1309
1375
|
|
|
1310
1376
|
interface DemoCredentialsHintProps {
|
|
@@ -1313,6 +1379,11 @@ interface DemoCredentialsHintProps {
|
|
|
1313
1379
|
* username or password — renders nothing at all.
|
|
1314
1380
|
*/
|
|
1315
1381
|
credentials?: DemoCredentials;
|
|
1382
|
+
/**
|
|
1383
|
+
* Presentation. Defaults to `Disclosure` (one quiet expandable line); pass
|
|
1384
|
+
* `Panel` for the original always-open block.
|
|
1385
|
+
*/
|
|
1386
|
+
variant?: DemoCredentialsHintVariant;
|
|
1316
1387
|
/** Explicit theme; overrides any `<AuthThemeProvider>`. */
|
|
1317
1388
|
theme?: AuthTheme;
|
|
1318
1389
|
/** Localised copy. Partial — unspecified keys fall back to English defaults. */
|
|
@@ -1321,13 +1392,13 @@ interface DemoCredentialsHintProps {
|
|
|
1321
1392
|
testIdPrefix?: string;
|
|
1322
1393
|
/**
|
|
1323
1394
|
* Called with the resolved credentials when the user taps "use these
|
|
1324
|
-
* credentials". Omit to render
|
|
1325
|
-
*
|
|
1395
|
+
* credentials". Omit to render read-only (no button) — the values are still
|
|
1396
|
+
* selectable, so a visitor can copy them by hand.
|
|
1326
1397
|
*/
|
|
1327
1398
|
onUse?: (credentials: DemoCredentials) => void;
|
|
1328
1399
|
}
|
|
1329
|
-
/** Themeable public-demo credentials
|
|
1330
|
-
declare function DemoCredentialsHint({ credentials, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1400
|
+
/** Themeable public-demo credentials surface. Renders `null` when there is no demo. */
|
|
1401
|
+
declare function DemoCredentialsHint({ credentials, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1331
1402
|
|
|
1332
1403
|
/**
|
|
1333
1404
|
* React context for the `AuthTheme`.
|
|
@@ -1438,6 +1509,7 @@ declare const AuthTestIds: {
|
|
|
1438
1509
|
readonly demoCredentialsUsername: "auth-demo-credentials-username";
|
|
1439
1510
|
readonly demoCredentialsPassword: "auth-demo-credentials-password";
|
|
1440
1511
|
readonly demoCredentialsUseButton: "auth-demo-credentials-use";
|
|
1512
|
+
readonly demoCredentialsToggle: "auth-demo-credentials-toggle";
|
|
1441
1513
|
};
|
|
1442
1514
|
/** Apply an optional prefix to a base test ID. */
|
|
1443
1515
|
declare function withTestIdPrefix(baseId: string, prefix?: string): string;
|
|
@@ -2255,4 +2327,4 @@ declare function validatePasswordPolicy(password: string): PasswordPolicyError[]
|
|
|
2255
2327
|
/** `true` when the password satisfies every policy rule. */
|
|
2256
2328
|
declare function isPasswordValid(password: string): boolean;
|
|
2257
2329
|
|
|
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 };
|
|
2330
|
+
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
|
@@ -412,6 +412,17 @@ interface DemoCredentialsHintLabels {
|
|
|
412
412
|
useCredentials: string;
|
|
413
413
|
/** Accessibility hint for that button. */
|
|
414
414
|
useCredentialsHint: string;
|
|
415
|
+
/**
|
|
416
|
+
* The collapsed disclosure trigger (e.g. "Try the demo").
|
|
417
|
+
*
|
|
418
|
+
* Keep the word "demo" in it. This one line is the ONLY thing an evaluator
|
|
419
|
+
* scanning the page has to find, so it must be searchable by the word they
|
|
420
|
+
* are looking for — a coy label like "Just looking?" is discreet at the cost
|
|
421
|
+
* of being undiscoverable, which defeats the point of shipping a demo.
|
|
422
|
+
*/
|
|
423
|
+
toggle: string;
|
|
424
|
+
/** Accessibility hint for the disclosure trigger. */
|
|
425
|
+
toggleHint: string;
|
|
415
426
|
}
|
|
416
427
|
declare const DEFAULT_DEMO_CREDENTIALS_HINT_LABELS: DemoCredentialsHintLabels;
|
|
417
428
|
|
|
@@ -1286,7 +1297,35 @@ interface PreferredMethodHintProps {
|
|
|
1286
1297
|
declare function PreferredMethodHint({ method, theme: themeProp, labels: labelsProp, testIdPrefix, }: Readonly<PreferredMethodHintProps>): ReactElement | null;
|
|
1287
1298
|
|
|
1288
1299
|
/**
|
|
1289
|
-
* `<DemoCredentialsHint>`
|
|
1300
|
+
* How `<DemoCredentialsHint>` presents itself on the login surface.
|
|
1301
|
+
*
|
|
1302
|
+
* The two variants answer opposite questions, and the choice is a product
|
|
1303
|
+
* decision rather than a styling one:
|
|
1304
|
+
*
|
|
1305
|
+
* - `Panel` assumes the page exists FOR the demo — a sales/marketing console
|
|
1306
|
+
* where every visitor is an evaluator. It advertises loudly.
|
|
1307
|
+
* - `Disclosure` assumes the page is a real customer's front door that ALSO
|
|
1308
|
+
* happens to offer a demo. Real account holders outnumber evaluators, so the
|
|
1309
|
+
* demo collapses behind one quiet line of text and costs them nothing.
|
|
1310
|
+
*
|
|
1311
|
+
* `Disclosure` is the default because the second case is the common one across
|
|
1312
|
+
* the estate: every product login screen is a page paying customers use daily.
|
|
1313
|
+
*
|
|
1314
|
+
* ⚠️ "Discreet" is achieved with SIZE, WEIGHT and POSITION — never by lowering
|
|
1315
|
+
* contrast. Both variants draw their text from `colors.textSecondary`, a token
|
|
1316
|
+
* every app already holds to the WCAG AA 4.5:1 floor. Dimming this further with
|
|
1317
|
+
* opacity would trade an accessibility guarantee for a visual preference; if a
|
|
1318
|
+
* consuming app's `textSecondary` fails AA, that is the app's token to fix.
|
|
1319
|
+
*/
|
|
1320
|
+
declare const enum DemoCredentialsHintVariant {
|
|
1321
|
+
/** Always-open inset panel with a brand rail. The original presentation. */
|
|
1322
|
+
Panel = "panel",
|
|
1323
|
+
/** One quiet "try the demo" line that expands the credentials on tap. */
|
|
1324
|
+
Disclosure = "disclosure"
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* `<DemoCredentialsHint>` — the public-demo credentials surface.
|
|
1290
1329
|
*
|
|
1291
1330
|
* Mount on the login surface of a product with an OPEN demo account whose
|
|
1292
1331
|
* credentials are already published (typically on the marketing site). It shows
|
|
@@ -1302,9 +1341,36 @@ declare function PreferredMethodHint({ method, theme: themeProp, labels: labelsP
|
|
|
1302
1341
|
* Fails closed: no credentials (or a half-configured pair) renders `null` — zero
|
|
1303
1342
|
* DOM — so a misconfigured env var can never publish an empty demo panel.
|
|
1304
1343
|
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1344
|
+
* ## Two variants, and why the default changed in 1.13.0
|
|
1345
|
+
*
|
|
1346
|
+
* Originally this only rendered an always-open panel above the form. That is
|
|
1347
|
+
* right for a page whose whole purpose IS the demo, and wrong for the far more
|
|
1348
|
+
* common case: a login screen paying customers use every day, where an
|
|
1349
|
+
* unmissable "here are some credentials" block is noise at best and a trust
|
|
1350
|
+
* problem at worst.
|
|
1351
|
+
*
|
|
1352
|
+
* `DemoCredentialsHintVariant.Disclosure` — now the default — collapses the
|
|
1353
|
+
* whole thing to one quiet line ("Try the demo") that expands on tap. Pass
|
|
1354
|
+
* `variant={DemoCredentialsHintVariant.Panel}` to keep the original block.
|
|
1355
|
+
*
|
|
1356
|
+
* ⚠️ Two things this deliberately does NOT do to achieve discretion:
|
|
1357
|
+
*
|
|
1358
|
+
* - **It does not lower contrast.** The trigger uses `colors.textSecondary`,
|
|
1359
|
+
* the same AA-held token as every other piece of helper copy. Discretion is
|
|
1360
|
+
* carried by size, placement and the absence of chrome.
|
|
1361
|
+
* - **It does not hide from assistive tech.** The trigger is a real focusable
|
|
1362
|
+
* button carrying `accessibilityState.expanded`, so a screen reader
|
|
1363
|
+
* announces both that it exists and whether it is open. Visually quiet must
|
|
1364
|
+
* not mean absent — a demo nobody can find is a demo nobody uses.
|
|
1365
|
+
*
|
|
1366
|
+
* ## Layout stability
|
|
1367
|
+
*
|
|
1368
|
+
* The expanded body renders BELOW the trigger, and the component is designed to
|
|
1369
|
+
* sit BELOW `<LoginForm>` (see the zygos login route). Expanding therefore grows
|
|
1370
|
+
* the card downward and never displaces the username or password inputs the
|
|
1371
|
+
* visitor may already be interacting with. Mounting it ABOVE the form would make
|
|
1372
|
+
* every expansion shove the fields down the page — precisely the jarring
|
|
1373
|
+
* behaviour a disclosure exists to avoid.
|
|
1308
1374
|
*/
|
|
1309
1375
|
|
|
1310
1376
|
interface DemoCredentialsHintProps {
|
|
@@ -1313,6 +1379,11 @@ interface DemoCredentialsHintProps {
|
|
|
1313
1379
|
* username or password — renders nothing at all.
|
|
1314
1380
|
*/
|
|
1315
1381
|
credentials?: DemoCredentials;
|
|
1382
|
+
/**
|
|
1383
|
+
* Presentation. Defaults to `Disclosure` (one quiet expandable line); pass
|
|
1384
|
+
* `Panel` for the original always-open block.
|
|
1385
|
+
*/
|
|
1386
|
+
variant?: DemoCredentialsHintVariant;
|
|
1316
1387
|
/** Explicit theme; overrides any `<AuthThemeProvider>`. */
|
|
1317
1388
|
theme?: AuthTheme;
|
|
1318
1389
|
/** Localised copy. Partial — unspecified keys fall back to English defaults. */
|
|
@@ -1321,13 +1392,13 @@ interface DemoCredentialsHintProps {
|
|
|
1321
1392
|
testIdPrefix?: string;
|
|
1322
1393
|
/**
|
|
1323
1394
|
* Called with the resolved credentials when the user taps "use these
|
|
1324
|
-
* credentials". Omit to render
|
|
1325
|
-
*
|
|
1395
|
+
* credentials". Omit to render read-only (no button) — the values are still
|
|
1396
|
+
* selectable, so a visitor can copy them by hand.
|
|
1326
1397
|
*/
|
|
1327
1398
|
onUse?: (credentials: DemoCredentials) => void;
|
|
1328
1399
|
}
|
|
1329
|
-
/** Themeable public-demo credentials
|
|
1330
|
-
declare function DemoCredentialsHint({ credentials, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1400
|
+
/** Themeable public-demo credentials surface. Renders `null` when there is no demo. */
|
|
1401
|
+
declare function DemoCredentialsHint({ credentials, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1331
1402
|
|
|
1332
1403
|
/**
|
|
1333
1404
|
* React context for the `AuthTheme`.
|
|
@@ -1438,6 +1509,7 @@ declare const AuthTestIds: {
|
|
|
1438
1509
|
readonly demoCredentialsUsername: "auth-demo-credentials-username";
|
|
1439
1510
|
readonly demoCredentialsPassword: "auth-demo-credentials-password";
|
|
1440
1511
|
readonly demoCredentialsUseButton: "auth-demo-credentials-use";
|
|
1512
|
+
readonly demoCredentialsToggle: "auth-demo-credentials-toggle";
|
|
1441
1513
|
};
|
|
1442
1514
|
/** Apply an optional prefix to a base test ID. */
|
|
1443
1515
|
declare function withTestIdPrefix(baseId: string, prefix?: string): string;
|
|
@@ -2255,4 +2327,4 @@ declare function validatePasswordPolicy(password: string): PasswordPolicyError[]
|
|
|
2255
2327
|
/** `true` when the password satisfies every policy rule. */
|
|
2256
2328
|
declare function isPasswordValid(password: string): boolean;
|
|
2257
2329
|
|
|
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 };
|
|
2330
|
+
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.js
CHANGED
|
@@ -282,7 +282,9 @@ var DEFAULT_DEMO_CREDENTIALS_HINT_LABELS = {
|
|
|
282
282
|
usernameLabel: "Username",
|
|
283
283
|
passwordLabel: "Password",
|
|
284
284
|
useCredentials: "Use these credentials",
|
|
285
|
-
useCredentialsHint: "Fill the sign-in form with the demo username and password"
|
|
285
|
+
useCredentialsHint: "Fill the sign-in form with the demo username and password",
|
|
286
|
+
toggle: "Try the demo",
|
|
287
|
+
toggleHint: "Show the demo account username and password"
|
|
286
288
|
};
|
|
287
289
|
|
|
288
290
|
// src/components/labels/resetPasswordLabels.ts
|
|
@@ -379,7 +381,9 @@ var AuthTestIds = {
|
|
|
379
381
|
demoCredentialsHint: "auth-demo-credentials-hint",
|
|
380
382
|
demoCredentialsUsername: "auth-demo-credentials-username",
|
|
381
383
|
demoCredentialsPassword: "auth-demo-credentials-password",
|
|
382
|
-
demoCredentialsUseButton: "auth-demo-credentials-use"
|
|
384
|
+
demoCredentialsUseButton: "auth-demo-credentials-use",
|
|
385
|
+
// The collapsed disclosure trigger (`disclosure` variant only).
|
|
386
|
+
demoCredentialsToggle: "auth-demo-credentials-toggle"
|
|
383
387
|
};
|
|
384
388
|
function withTestIdPrefix(baseId, prefix) {
|
|
385
389
|
return prefix === void 0 || prefix === "" ? baseId : `${prefix}-${baseId}`;
|
|
@@ -3216,7 +3220,62 @@ function PreferredMethodHint({
|
|
|
3216
3220
|
}
|
|
3217
3221
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: withTestIdPrefix(AuthTestIds.preferredMethodHint, testIdPrefix), children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.helperText, children: text }) });
|
|
3218
3222
|
}
|
|
3223
|
+
function DemoCredentialsBody({
|
|
3224
|
+
credentials,
|
|
3225
|
+
labels,
|
|
3226
|
+
styles: styles3,
|
|
3227
|
+
authStyles,
|
|
3228
|
+
testIdPrefix,
|
|
3229
|
+
onUse
|
|
3230
|
+
}) {
|
|
3231
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
|
|
3232
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.row, children: [
|
|
3233
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.rowLabel, children: labels.usernameLabel }),
|
|
3234
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3235
|
+
reactNative.Text,
|
|
3236
|
+
{
|
|
3237
|
+
selectable: true,
|
|
3238
|
+
style: styles3.rowValue,
|
|
3239
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsUsername, testIdPrefix),
|
|
3240
|
+
children: credentials.username
|
|
3241
|
+
}
|
|
3242
|
+
)
|
|
3243
|
+
] }),
|
|
3244
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.row, children: [
|
|
3245
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.rowLabel, children: labels.passwordLabel }),
|
|
3246
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3247
|
+
reactNative.Text,
|
|
3248
|
+
{
|
|
3249
|
+
selectable: true,
|
|
3250
|
+
style: styles3.rowValue,
|
|
3251
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsPassword, testIdPrefix),
|
|
3252
|
+
children: credentials.password
|
|
3253
|
+
}
|
|
3254
|
+
)
|
|
3255
|
+
] }),
|
|
3256
|
+
onUse !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3257
|
+
reactNative.TouchableOpacity,
|
|
3258
|
+
{
|
|
3259
|
+
accessibilityHint: labels.useCredentialsHint,
|
|
3260
|
+
accessibilityLabel: labels.useCredentials,
|
|
3261
|
+
accessibilityRole: "button",
|
|
3262
|
+
style: [authStyles.secondaryButton, styles3.useButton],
|
|
3263
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsUseButton, testIdPrefix),
|
|
3264
|
+
onPress: onUse,
|
|
3265
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: authStyles.secondaryButtonText, children: labels.useCredentials })
|
|
3266
|
+
}
|
|
3267
|
+
) : null
|
|
3268
|
+
] });
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
// src/components/DemoCredentialsHintVariant.ts
|
|
3272
|
+
var DemoCredentialsHintVariant = /* @__PURE__ */ ((DemoCredentialsHintVariant2) => {
|
|
3273
|
+
DemoCredentialsHintVariant2["Panel"] = "panel";
|
|
3274
|
+
DemoCredentialsHintVariant2["Disclosure"] = "disclosure";
|
|
3275
|
+
return DemoCredentialsHintVariant2;
|
|
3276
|
+
})(DemoCredentialsHintVariant || {});
|
|
3219
3277
|
var PANEL_BORDER_WIDTH = 1;
|
|
3278
|
+
var TRIGGER_MIN_HEIGHT = 32;
|
|
3220
3279
|
var ACCENT_RAIL_WIDTH = 3;
|
|
3221
3280
|
var TITLE_LETTER_SPACING = 0.8;
|
|
3222
3281
|
var DESCRIPTION_LINE_HEIGHT_RATIO = 1.45;
|
|
@@ -3277,6 +3336,40 @@ function useDemoCredentialsStyles(theme) {
|
|
|
3277
3336
|
flexShrink: 1,
|
|
3278
3337
|
backgroundColor: colors.surface,
|
|
3279
3338
|
color: colors.text
|
|
3339
|
+
},
|
|
3340
|
+
// ── Disclosure variant ──────────────────────────────────────────────
|
|
3341
|
+
// No panel fill, no border, no brand rail: the collapsed state is one
|
|
3342
|
+
// line of text and nothing else, so on a page a real customer uses it
|
|
3343
|
+
// reads as a footnote rather than as a second call to action.
|
|
3344
|
+
disclosure: {
|
|
3345
|
+
marginTop: spacing.md,
|
|
3346
|
+
alignSelf: "stretch"
|
|
3347
|
+
},
|
|
3348
|
+
disclosureTrigger: {
|
|
3349
|
+
alignSelf: "center",
|
|
3350
|
+
justifyContent: "center",
|
|
3351
|
+
minHeight: TRIGGER_MIN_HEIGHT,
|
|
3352
|
+
paddingHorizontal: spacing.xs
|
|
3353
|
+
},
|
|
3354
|
+
disclosureTriggerText: {
|
|
3355
|
+
fontSize: typography.caption,
|
|
3356
|
+
textDecorationLine: "underline",
|
|
3357
|
+
// `textSecondary`, NOT a dimmed `text`. This is the same token the rest
|
|
3358
|
+
// of the helper copy uses, so it inherits whatever AA contrast the
|
|
3359
|
+
// consuming app already guarantees. Discretion here is carried by the
|
|
3360
|
+
// caption size, the centred placement below the form, and the absence
|
|
3361
|
+
// of any fill or border — never by fading the text toward the
|
|
3362
|
+
// background, which is how "discreet" quietly becomes a contrast bug.
|
|
3363
|
+
color: colors.textSecondary
|
|
3364
|
+
},
|
|
3365
|
+
disclosureBody: {
|
|
3366
|
+
marginTop: spacing.sm,
|
|
3367
|
+
paddingTop: spacing.sm,
|
|
3368
|
+
borderTopWidth: PANEL_BORDER_WIDTH,
|
|
3369
|
+
borderTopColor: colors.border
|
|
3370
|
+
},
|
|
3371
|
+
useButton: {
|
|
3372
|
+
alignSelf: "stretch"
|
|
3280
3373
|
}
|
|
3281
3374
|
});
|
|
3282
3375
|
}, [theme]);
|
|
@@ -3297,6 +3390,7 @@ function resolveDemoCredentials(credentials) {
|
|
|
3297
3390
|
}
|
|
3298
3391
|
function DemoCredentialsHint({
|
|
3299
3392
|
credentials,
|
|
3393
|
+
variant = "disclosure" /* Disclosure */,
|
|
3300
3394
|
theme: themeProp,
|
|
3301
3395
|
labels: labelsProp,
|
|
3302
3396
|
testIdPrefix,
|
|
@@ -3305,6 +3399,7 @@ function DemoCredentialsHint({
|
|
|
3305
3399
|
const theme = useAuthTheme(themeProp);
|
|
3306
3400
|
const authStyles = useAuthStyles(theme);
|
|
3307
3401
|
const styles3 = useDemoCredentialsStyles(theme);
|
|
3402
|
+
const [expanded, setExpanded] = react.useState(false);
|
|
3308
3403
|
const labels = react.useMemo(
|
|
3309
3404
|
() => ({ ...DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, ...labelsProp }),
|
|
3310
3405
|
[labelsProp]
|
|
@@ -3315,53 +3410,57 @@ function DemoCredentialsHint({
|
|
|
3315
3410
|
onUse(resolved);
|
|
3316
3411
|
}
|
|
3317
3412
|
}, [resolved, onUse]);
|
|
3413
|
+
const handleToggle = react.useCallback(() => {
|
|
3414
|
+
setExpanded((current) => !current);
|
|
3415
|
+
}, []);
|
|
3318
3416
|
if (resolved === null) {
|
|
3319
3417
|
return null;
|
|
3320
3418
|
}
|
|
3419
|
+
const body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3420
|
+
DemoCredentialsBody,
|
|
3421
|
+
{
|
|
3422
|
+
authStyles,
|
|
3423
|
+
credentials: resolved,
|
|
3424
|
+
labels,
|
|
3425
|
+
styles: styles3,
|
|
3426
|
+
testIdPrefix,
|
|
3427
|
+
onUse: onUse === void 0 ? void 0 : handleUse
|
|
3428
|
+
}
|
|
3429
|
+
);
|
|
3430
|
+
if (variant === "panel" /* Panel */) {
|
|
3431
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3432
|
+
reactNative.View,
|
|
3433
|
+
{
|
|
3434
|
+
style: styles3.panel,
|
|
3435
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsHint, testIdPrefix),
|
|
3436
|
+
children: [
|
|
3437
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.title, children: labels.title }),
|
|
3438
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.description, children: labels.description }),
|
|
3439
|
+
body
|
|
3440
|
+
]
|
|
3441
|
+
}
|
|
3442
|
+
);
|
|
3443
|
+
}
|
|
3321
3444
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3322
3445
|
reactNative.View,
|
|
3323
3446
|
{
|
|
3324
|
-
style: styles3.
|
|
3447
|
+
style: styles3.disclosure,
|
|
3325
3448
|
testID: withTestIdPrefix(AuthTestIds.demoCredentialsHint, testIdPrefix),
|
|
3326
3449
|
children: [
|
|
3327
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3328
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.description, children: labels.description }),
|
|
3329
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.row, children: [
|
|
3330
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.rowLabel, children: labels.usernameLabel }),
|
|
3331
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3332
|
-
reactNative.Text,
|
|
3333
|
-
{
|
|
3334
|
-
selectable: true,
|
|
3335
|
-
style: styles3.rowValue,
|
|
3336
|
-
testID: withTestIdPrefix(AuthTestIds.demoCredentialsUsername, testIdPrefix),
|
|
3337
|
-
children: resolved.username
|
|
3338
|
-
}
|
|
3339
|
-
)
|
|
3340
|
-
] }),
|
|
3341
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.row, children: [
|
|
3342
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.rowLabel, children: labels.passwordLabel }),
|
|
3343
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3344
|
-
reactNative.Text,
|
|
3345
|
-
{
|
|
3346
|
-
selectable: true,
|
|
3347
|
-
style: styles3.rowValue,
|
|
3348
|
-
testID: withTestIdPrefix(AuthTestIds.demoCredentialsPassword, testIdPrefix),
|
|
3349
|
-
children: resolved.password
|
|
3350
|
-
}
|
|
3351
|
-
)
|
|
3352
|
-
] }),
|
|
3353
|
-
onUse !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3450
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3354
3451
|
reactNative.TouchableOpacity,
|
|
3355
3452
|
{
|
|
3356
|
-
accessibilityHint: labels.
|
|
3357
|
-
accessibilityLabel: labels.
|
|
3453
|
+
accessibilityHint: labels.toggleHint,
|
|
3454
|
+
accessibilityLabel: labels.toggle,
|
|
3358
3455
|
accessibilityRole: "button",
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3456
|
+
accessibilityState: { expanded },
|
|
3457
|
+
style: styles3.disclosureTrigger,
|
|
3458
|
+
testID: withTestIdPrefix(AuthTestIds.demoCredentialsToggle, testIdPrefix),
|
|
3459
|
+
onPress: handleToggle,
|
|
3460
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.disclosureTriggerText, children: labels.toggle })
|
|
3363
3461
|
}
|
|
3364
|
-
)
|
|
3462
|
+
),
|
|
3463
|
+
expanded ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.disclosureBody, children: body }) : null
|
|
3365
3464
|
]
|
|
3366
3465
|
}
|
|
3367
3466
|
);
|
|
@@ -3637,6 +3736,7 @@ exports.DEFAULT_RESET_PASSWORD_LABELS = DEFAULT_RESET_PASSWORD_LABELS;
|
|
|
3637
3736
|
exports.DEVICE_PIN_ALLOWED_DIGITS = DEVICE_PIN_ALLOWED_DIGITS;
|
|
3638
3737
|
exports.DEVICE_PIN_DEFAULT_DIGITS = DEVICE_PIN_DEFAULT_DIGITS;
|
|
3639
3738
|
exports.DemoCredentialsHint = DemoCredentialsHint;
|
|
3739
|
+
exports.DemoCredentialsHintVariant = DemoCredentialsHintVariant;
|
|
3640
3740
|
exports.DevicePinEnrollErrorKey = DevicePinEnrollErrorKey;
|
|
3641
3741
|
exports.DevicePinEnrollForm = DevicePinEnrollForm;
|
|
3642
3742
|
exports.DevicePinErrorKey = DevicePinErrorKey;
|