@dloizides/auth-web 1.16.0 → 1.17.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 +20 -0
- package/dist/index.d.mts +35 -5
- package/dist/index.d.ts +35 -5
- package/dist/index.js +87 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.17.0
|
|
4
|
+
|
|
5
|
+
**Multi-account demo login — the `<DemoCredentialsHint>` now renders one labelled,
|
|
6
|
+
one-tap-fillable row per published demo account.** Additive and
|
|
7
|
+
backward-compatible: a single account renders byte-for-byte as before.
|
|
8
|
+
|
|
9
|
+
- **`resolveDemoAccounts` / `resolveAccountList`** (new exports) — resolve either
|
|
10
|
+
the `publishedAccounts` list (from `@dloizides/auth-client` 4.4.0 / a BFF on
|
|
11
|
+
Bff.AspNetCore 1.17.0+) or a legacy single pair into an ordered, validated
|
|
12
|
+
`DemoAccount[]`. `resolveDemoCredentials` is unchanged and still exported.
|
|
13
|
+
- **`useDemoCredentials().hintProps`** gains `accounts: DemoAccount[]` (the
|
|
14
|
+
resolved list). `credentials` is still passed through unchanged, so the field
|
|
15
|
+
is purely additive; `onUse` fills whichever account the hint reports.
|
|
16
|
+
- **`<DemoCredentialsHint>`** gains an `accounts?` prop (preferred over
|
|
17
|
+
`credentials` when present). One account → no per-account heading, unsuffixed
|
|
18
|
+
testIDs (unchanged). Multiple accounts → each gets its label heading and
|
|
19
|
+
index-suffixed testIDs (`…-username-0`, `…-use-1`, `…-account-label-0`).
|
|
20
|
+
- New testID `demoCredentialsAccountLabel`; new re-exported type `DemoAccount`.
|
|
21
|
+
- Bumps `@dloizides/auth-client` to `^4.4.0` for the `publishedAccounts` type.
|
|
22
|
+
|
|
3
23
|
## 1.16.0
|
|
4
24
|
|
|
5
25
|
**New shared `AccountSettingsScreen` — one authenticated account surface for all
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { BffAuthClient, BffUser, DemoCredentials, HttpClient, BffLoginRequest, BffForgotPasswordRequest, BffResetPasswordRequest, BffOtpRequestResult } from '@dloizides/auth-client';
|
|
3
|
-
export { BffAuthClient, BffAuthClientOptions, BffForgotPasswordRequest, BffLoginRequest, BffOtpRequestRequest, BffOtpRequestResult, BffOtpVerifyRequest, BffPinLoginRequest, BffRegisterRequest, BffResetPasswordRequest, BffUser, DemoCredentials, HttpClient, HttpRequest, HttpResponse, createFetchHttpClient } from '@dloizides/auth-client';
|
|
2
|
+
import { BffAuthClient, BffUser, DemoCredentials, HttpClient, DemoAccount, BffLoginRequest, BffForgotPasswordRequest, BffResetPasswordRequest, BffOtpRequestResult } from '@dloizides/auth-client';
|
|
3
|
+
export { BffAuthClient, BffAuthClientOptions, BffForgotPasswordRequest, BffLoginRequest, BffOtpRequestRequest, BffOtpRequestResult, BffOtpVerifyRequest, BffPinLoginRequest, BffRegisterRequest, BffResetPasswordRequest, BffUser, DemoAccount, DemoCredentials, HttpClient, HttpRequest, HttpResponse, createFetchHttpClient } from '@dloizides/auth-client';
|
|
4
4
|
import { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1609,9 +1609,18 @@ declare const enum DemoCredentialsHintVariant {
|
|
|
1609
1609
|
interface DemoCredentialsHintProps {
|
|
1610
1610
|
/**
|
|
1611
1611
|
* The demo credentials to advertise. `undefined` — or a pair with a blank
|
|
1612
|
-
* username or password — renders nothing at all.
|
|
1612
|
+
* username or password — renders nothing at all. When {@link accounts} is given
|
|
1613
|
+
* and non-empty it takes precedence; otherwise this single pair is resolved
|
|
1614
|
+
* (and, if it carries a `publishedAccounts` list, expanded) into the rows.
|
|
1613
1615
|
*/
|
|
1614
1616
|
credentials?: DemoCredentials;
|
|
1617
|
+
/**
|
|
1618
|
+
* The resolved list of demo accounts to advertise, one labelled row per entry.
|
|
1619
|
+
* Preferred over {@link credentials} when present and non-empty. A single entry
|
|
1620
|
+
* renders exactly like the legacy single-pair panel (no per-account heading).
|
|
1621
|
+
* This is what `useDemoCredentials().hintProps` supplies.
|
|
1622
|
+
*/
|
|
1623
|
+
accounts?: DemoAccount[];
|
|
1615
1624
|
/**
|
|
1616
1625
|
* Presentation. Defaults to `Disclosure` (one quiet expandable line); pass
|
|
1617
1626
|
* `Panel` for the original always-open block.
|
|
@@ -1631,7 +1640,7 @@ interface DemoCredentialsHintProps {
|
|
|
1631
1640
|
onUse?: (credentials: DemoCredentials) => void;
|
|
1632
1641
|
}
|
|
1633
1642
|
/** Themeable public-demo credentials surface. Renders `null` when there is no demo. */
|
|
1634
|
-
declare function DemoCredentialsHint({ credentials, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1643
|
+
declare function DemoCredentialsHint({ credentials, accounts, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1635
1644
|
|
|
1636
1645
|
/**
|
|
1637
1646
|
* React context for the `AuthTheme`.
|
|
@@ -1747,6 +1756,7 @@ declare const AuthTestIds: {
|
|
|
1747
1756
|
readonly changePasswordError: "auth-change-password-error";
|
|
1748
1757
|
readonly changePasswordSuccess: "auth-change-password-success";
|
|
1749
1758
|
readonly demoCredentialsHint: "auth-demo-credentials-hint";
|
|
1759
|
+
readonly demoCredentialsAccountLabel: "auth-demo-credentials-account-label";
|
|
1750
1760
|
readonly demoCredentialsUsername: "auth-demo-credentials-username";
|
|
1751
1761
|
readonly demoCredentialsPassword: "auth-demo-credentials-password";
|
|
1752
1762
|
readonly demoCredentialsUseButton: "auth-demo-credentials-use";
|
|
@@ -2283,6 +2293,13 @@ interface DemoCredentialsLoginFormProps {
|
|
|
2283
2293
|
/** The `<DemoCredentialsHint>` props that carry the credentials + fill action. */
|
|
2284
2294
|
interface DemoCredentialsHintWiring {
|
|
2285
2295
|
credentials?: DemoCredentials;
|
|
2296
|
+
/**
|
|
2297
|
+
* The resolved list of demo accounts (from `publishedAccounts`, else the legacy
|
|
2298
|
+
* single pair wrapped into one). The hint renders one labelled row per entry and
|
|
2299
|
+
* prefers this over {@link credentials} when present. Additive — a hint given only
|
|
2300
|
+
* `credentials` still resolves the same list itself.
|
|
2301
|
+
*/
|
|
2302
|
+
accounts: DemoAccount[];
|
|
2286
2303
|
onUse: (credentials: DemoCredentials) => void;
|
|
2287
2304
|
}
|
|
2288
2305
|
/** What {@link useDemoCredentials} hands back. */
|
|
@@ -2325,6 +2342,19 @@ declare function useDemoCredentials({ credentials, prefillOnMount, }?: Readonly<
|
|
|
2325
2342
|
*/
|
|
2326
2343
|
declare function resolveDemoCredentials(credentials?: DemoCredentials | null): DemoCredentials | null;
|
|
2327
2344
|
|
|
2345
|
+
/**
|
|
2346
|
+
* Validate a raw list of accounts, dropping any unusable entry. Used by the hint
|
|
2347
|
+
* when a consumer passes an `accounts` prop directly (the hook already routes its
|
|
2348
|
+
* list through here too, so validation happens in exactly one place).
|
|
2349
|
+
*/
|
|
2350
|
+
declare function resolveAccountList(accounts?: readonly DemoAccount[] | null): DemoAccount[];
|
|
2351
|
+
/**
|
|
2352
|
+
* Resolve the ordered list of demo accounts to advertise, from either the new
|
|
2353
|
+
* `publishedAccounts` list or the legacy single pair. Returns `[]` when nothing
|
|
2354
|
+
* is usable — the "render nothing" contract, as a list.
|
|
2355
|
+
*/
|
|
2356
|
+
declare function resolveDemoAccounts(credentials?: DemoCredentials | null): DemoAccount[];
|
|
2357
|
+
|
|
2328
2358
|
/**
|
|
2329
2359
|
* `createBffAuthClient` — the one-line wiring of a same-origin `BffAuthClient`.
|
|
2330
2360
|
*
|
|
@@ -2614,4 +2644,4 @@ interface UseChangePasswordResult {
|
|
|
2614
2644
|
}
|
|
2615
2645
|
declare function useChangePassword({ client, onChanged, }: UseChangePasswordArgs): UseChangePasswordResult;
|
|
2616
2646
|
|
|
2617
|
-
export { type AccountSettingsChangePasswordConfig, type AccountSettingsDevicePinConfig, type AccountSettingsLabels, type AccountSettingsPasskeysConfig, type AccountSettingsPreferredMethodConfig, AccountSettingsScreen, type AccountSettingsScreenProps, AuthScreen, type AuthScreenProps, AuthTestIds, type AuthTheme, type AuthThemeColors, AuthThemeProvider, type AuthThemeProviderProps, type AuthThemeRadii, type AuthThemeSpacing, type AuthThemeTypography, BffAuthStatus, type BffDeviceState, type BffLoginConfig, type BffLogoutClient, CHANGE_PASSWORD_ENDPOINT, type ChangePasswordCapableClient, ChangePasswordCard, type ChangePasswordCardProps, ChangePasswordErrorKey, type ChangePasswordRequest, type ChangePasswordResult, type CreateBffAuthClientOptions, type CreateBffChangePasswordClientOptions, DEFAULT_ACCOUNT_SETTINGS_LABELS, 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 UseChangePasswordArgs, type UseChangePasswordResult, 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, createBffChangePasswordClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useChangePassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
|
2647
|
+
export { type AccountSettingsChangePasswordConfig, type AccountSettingsDevicePinConfig, type AccountSettingsLabels, type AccountSettingsPasskeysConfig, type AccountSettingsPreferredMethodConfig, AccountSettingsScreen, type AccountSettingsScreenProps, AuthScreen, type AuthScreenProps, AuthTestIds, type AuthTheme, type AuthThemeColors, AuthThemeProvider, type AuthThemeProviderProps, type AuthThemeRadii, type AuthThemeSpacing, type AuthThemeTypography, BffAuthStatus, type BffDeviceState, type BffLoginConfig, type BffLogoutClient, CHANGE_PASSWORD_ENDPOINT, type ChangePasswordCapableClient, ChangePasswordCard, type ChangePasswordCardProps, ChangePasswordErrorKey, type ChangePasswordRequest, type ChangePasswordResult, type CreateBffAuthClientOptions, type CreateBffChangePasswordClientOptions, DEFAULT_ACCOUNT_SETTINGS_LABELS, 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 UseChangePasswordArgs, type UseChangePasswordResult, 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, createBffChangePasswordClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveAccountList, resolveDemoAccounts, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useChangePassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { BffAuthClient, BffUser, DemoCredentials, HttpClient, BffLoginRequest, BffForgotPasswordRequest, BffResetPasswordRequest, BffOtpRequestResult } from '@dloizides/auth-client';
|
|
3
|
-
export { BffAuthClient, BffAuthClientOptions, BffForgotPasswordRequest, BffLoginRequest, BffOtpRequestRequest, BffOtpRequestResult, BffOtpVerifyRequest, BffPinLoginRequest, BffRegisterRequest, BffResetPasswordRequest, BffUser, DemoCredentials, HttpClient, HttpRequest, HttpResponse, createFetchHttpClient } from '@dloizides/auth-client';
|
|
2
|
+
import { BffAuthClient, BffUser, DemoCredentials, HttpClient, DemoAccount, BffLoginRequest, BffForgotPasswordRequest, BffResetPasswordRequest, BffOtpRequestResult } from '@dloizides/auth-client';
|
|
3
|
+
export { BffAuthClient, BffAuthClientOptions, BffForgotPasswordRequest, BffLoginRequest, BffOtpRequestRequest, BffOtpRequestResult, BffOtpVerifyRequest, BffPinLoginRequest, BffRegisterRequest, BffResetPasswordRequest, BffUser, DemoAccount, DemoCredentials, HttpClient, HttpRequest, HttpResponse, createFetchHttpClient } from '@dloizides/auth-client';
|
|
4
4
|
import { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1609,9 +1609,18 @@ declare const enum DemoCredentialsHintVariant {
|
|
|
1609
1609
|
interface DemoCredentialsHintProps {
|
|
1610
1610
|
/**
|
|
1611
1611
|
* The demo credentials to advertise. `undefined` — or a pair with a blank
|
|
1612
|
-
* username or password — renders nothing at all.
|
|
1612
|
+
* username or password — renders nothing at all. When {@link accounts} is given
|
|
1613
|
+
* and non-empty it takes precedence; otherwise this single pair is resolved
|
|
1614
|
+
* (and, if it carries a `publishedAccounts` list, expanded) into the rows.
|
|
1613
1615
|
*/
|
|
1614
1616
|
credentials?: DemoCredentials;
|
|
1617
|
+
/**
|
|
1618
|
+
* The resolved list of demo accounts to advertise, one labelled row per entry.
|
|
1619
|
+
* Preferred over {@link credentials} when present and non-empty. A single entry
|
|
1620
|
+
* renders exactly like the legacy single-pair panel (no per-account heading).
|
|
1621
|
+
* This is what `useDemoCredentials().hintProps` supplies.
|
|
1622
|
+
*/
|
|
1623
|
+
accounts?: DemoAccount[];
|
|
1615
1624
|
/**
|
|
1616
1625
|
* Presentation. Defaults to `Disclosure` (one quiet expandable line); pass
|
|
1617
1626
|
* `Panel` for the original always-open block.
|
|
@@ -1631,7 +1640,7 @@ interface DemoCredentialsHintProps {
|
|
|
1631
1640
|
onUse?: (credentials: DemoCredentials) => void;
|
|
1632
1641
|
}
|
|
1633
1642
|
/** Themeable public-demo credentials surface. Renders `null` when there is no demo. */
|
|
1634
|
-
declare function DemoCredentialsHint({ credentials, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1643
|
+
declare function DemoCredentialsHint({ credentials, accounts, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
|
|
1635
1644
|
|
|
1636
1645
|
/**
|
|
1637
1646
|
* React context for the `AuthTheme`.
|
|
@@ -1747,6 +1756,7 @@ declare const AuthTestIds: {
|
|
|
1747
1756
|
readonly changePasswordError: "auth-change-password-error";
|
|
1748
1757
|
readonly changePasswordSuccess: "auth-change-password-success";
|
|
1749
1758
|
readonly demoCredentialsHint: "auth-demo-credentials-hint";
|
|
1759
|
+
readonly demoCredentialsAccountLabel: "auth-demo-credentials-account-label";
|
|
1750
1760
|
readonly demoCredentialsUsername: "auth-demo-credentials-username";
|
|
1751
1761
|
readonly demoCredentialsPassword: "auth-demo-credentials-password";
|
|
1752
1762
|
readonly demoCredentialsUseButton: "auth-demo-credentials-use";
|
|
@@ -2283,6 +2293,13 @@ interface DemoCredentialsLoginFormProps {
|
|
|
2283
2293
|
/** The `<DemoCredentialsHint>` props that carry the credentials + fill action. */
|
|
2284
2294
|
interface DemoCredentialsHintWiring {
|
|
2285
2295
|
credentials?: DemoCredentials;
|
|
2296
|
+
/**
|
|
2297
|
+
* The resolved list of demo accounts (from `publishedAccounts`, else the legacy
|
|
2298
|
+
* single pair wrapped into one). The hint renders one labelled row per entry and
|
|
2299
|
+
* prefers this over {@link credentials} when present. Additive — a hint given only
|
|
2300
|
+
* `credentials` still resolves the same list itself.
|
|
2301
|
+
*/
|
|
2302
|
+
accounts: DemoAccount[];
|
|
2286
2303
|
onUse: (credentials: DemoCredentials) => void;
|
|
2287
2304
|
}
|
|
2288
2305
|
/** What {@link useDemoCredentials} hands back. */
|
|
@@ -2325,6 +2342,19 @@ declare function useDemoCredentials({ credentials, prefillOnMount, }?: Readonly<
|
|
|
2325
2342
|
*/
|
|
2326
2343
|
declare function resolveDemoCredentials(credentials?: DemoCredentials | null): DemoCredentials | null;
|
|
2327
2344
|
|
|
2345
|
+
/**
|
|
2346
|
+
* Validate a raw list of accounts, dropping any unusable entry. Used by the hint
|
|
2347
|
+
* when a consumer passes an `accounts` prop directly (the hook already routes its
|
|
2348
|
+
* list through here too, so validation happens in exactly one place).
|
|
2349
|
+
*/
|
|
2350
|
+
declare function resolveAccountList(accounts?: readonly DemoAccount[] | null): DemoAccount[];
|
|
2351
|
+
/**
|
|
2352
|
+
* Resolve the ordered list of demo accounts to advertise, from either the new
|
|
2353
|
+
* `publishedAccounts` list or the legacy single pair. Returns `[]` when nothing
|
|
2354
|
+
* is usable — the "render nothing" contract, as a list.
|
|
2355
|
+
*/
|
|
2356
|
+
declare function resolveDemoAccounts(credentials?: DemoCredentials | null): DemoAccount[];
|
|
2357
|
+
|
|
2328
2358
|
/**
|
|
2329
2359
|
* `createBffAuthClient` — the one-line wiring of a same-origin `BffAuthClient`.
|
|
2330
2360
|
*
|
|
@@ -2614,4 +2644,4 @@ interface UseChangePasswordResult {
|
|
|
2614
2644
|
}
|
|
2615
2645
|
declare function useChangePassword({ client, onChanged, }: UseChangePasswordArgs): UseChangePasswordResult;
|
|
2616
2646
|
|
|
2617
|
-
export { type AccountSettingsChangePasswordConfig, type AccountSettingsDevicePinConfig, type AccountSettingsLabels, type AccountSettingsPasskeysConfig, type AccountSettingsPreferredMethodConfig, AccountSettingsScreen, type AccountSettingsScreenProps, AuthScreen, type AuthScreenProps, AuthTestIds, type AuthTheme, type AuthThemeColors, AuthThemeProvider, type AuthThemeProviderProps, type AuthThemeRadii, type AuthThemeSpacing, type AuthThemeTypography, BffAuthStatus, type BffDeviceState, type BffLoginConfig, type BffLogoutClient, CHANGE_PASSWORD_ENDPOINT, type ChangePasswordCapableClient, ChangePasswordCard, type ChangePasswordCardProps, ChangePasswordErrorKey, type ChangePasswordRequest, type ChangePasswordResult, type CreateBffAuthClientOptions, type CreateBffChangePasswordClientOptions, DEFAULT_ACCOUNT_SETTINGS_LABELS, 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 UseChangePasswordArgs, type UseChangePasswordResult, 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, createBffChangePasswordClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useChangePassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
|
2647
|
+
export { type AccountSettingsChangePasswordConfig, type AccountSettingsDevicePinConfig, type AccountSettingsLabels, type AccountSettingsPasskeysConfig, type AccountSettingsPreferredMethodConfig, AccountSettingsScreen, type AccountSettingsScreenProps, AuthScreen, type AuthScreenProps, AuthTestIds, type AuthTheme, type AuthThemeColors, AuthThemeProvider, type AuthThemeProviderProps, type AuthThemeRadii, type AuthThemeSpacing, type AuthThemeTypography, BffAuthStatus, type BffDeviceState, type BffLoginConfig, type BffLogoutClient, CHANGE_PASSWORD_ENDPOINT, type ChangePasswordCapableClient, ChangePasswordCard, type ChangePasswordCardProps, ChangePasswordErrorKey, type ChangePasswordRequest, type ChangePasswordResult, type CreateBffAuthClientOptions, type CreateBffChangePasswordClientOptions, DEFAULT_ACCOUNT_SETTINGS_LABELS, 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 UseChangePasswordArgs, type UseChangePasswordResult, 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, createBffChangePasswordClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, resolveAccessibleRoutes, resolveAccountList, resolveDemoAccounts, resolveDemoCredentials, resolvePostLoginRoute, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useChangePassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
package/dist/index.js
CHANGED
|
@@ -415,6 +415,8 @@ var AuthTestIds = {
|
|
|
415
415
|
changePasswordSuccess: "auth-change-password-success",
|
|
416
416
|
// Public-demo credentials panel
|
|
417
417
|
demoCredentialsHint: "auth-demo-credentials-hint",
|
|
418
|
+
// Per-account heading, present only when >1 account is published (multi-account).
|
|
419
|
+
demoCredentialsAccountLabel: "auth-demo-credentials-account-label",
|
|
418
420
|
demoCredentialsUsername: "auth-demo-credentials-username",
|
|
419
421
|
demoCredentialsPassword: "auth-demo-credentials-password",
|
|
420
422
|
demoCredentialsUseButton: "auth-demo-credentials-use",
|
|
@@ -3571,9 +3573,21 @@ function DemoCredentialsBody({
|
|
|
3571
3573
|
styles: styles3,
|
|
3572
3574
|
authStyles,
|
|
3573
3575
|
testIdPrefix,
|
|
3576
|
+
accountLabel,
|
|
3577
|
+
testIdIndex,
|
|
3574
3578
|
onUse
|
|
3575
3579
|
}) {
|
|
3580
|
+
const testId = (base) => withTestIdPrefix(testIdIndex === void 0 ? base : `${base}-${testIdIndex}`, testIdPrefix);
|
|
3581
|
+
const hasLabel = typeof accountLabel === "string" && accountLabel.length > 0;
|
|
3576
3582
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { children: [
|
|
3583
|
+
hasLabel ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3584
|
+
reactNative.Text,
|
|
3585
|
+
{
|
|
3586
|
+
style: styles3.accountLabel,
|
|
3587
|
+
testID: testId(AuthTestIds.demoCredentialsAccountLabel),
|
|
3588
|
+
children: accountLabel
|
|
3589
|
+
}
|
|
3590
|
+
) : null,
|
|
3577
3591
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.row, children: [
|
|
3578
3592
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.rowLabel, children: labels.usernameLabel }),
|
|
3579
3593
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3581,7 +3595,7 @@ function DemoCredentialsBody({
|
|
|
3581
3595
|
{
|
|
3582
3596
|
selectable: true,
|
|
3583
3597
|
style: styles3.rowValue,
|
|
3584
|
-
testID:
|
|
3598
|
+
testID: testId(AuthTestIds.demoCredentialsUsername),
|
|
3585
3599
|
children: credentials.username
|
|
3586
3600
|
}
|
|
3587
3601
|
)
|
|
@@ -3593,7 +3607,7 @@ function DemoCredentialsBody({
|
|
|
3593
3607
|
{
|
|
3594
3608
|
selectable: true,
|
|
3595
3609
|
style: styles3.rowValue,
|
|
3596
|
-
testID:
|
|
3610
|
+
testID: testId(AuthTestIds.demoCredentialsPassword),
|
|
3597
3611
|
children: credentials.password
|
|
3598
3612
|
}
|
|
3599
3613
|
)
|
|
@@ -3605,7 +3619,7 @@ function DemoCredentialsBody({
|
|
|
3605
3619
|
accessibilityLabel: labels.useCredentials,
|
|
3606
3620
|
accessibilityRole: "button",
|
|
3607
3621
|
style: [authStyles.secondaryButton, styles3.useButton],
|
|
3608
|
-
testID:
|
|
3622
|
+
testID: testId(AuthTestIds.demoCredentialsUseButton),
|
|
3609
3623
|
onPress: onUse,
|
|
3610
3624
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: authStyles.secondaryButtonText, children: labels.useCredentials })
|
|
3611
3625
|
}
|
|
@@ -3658,6 +3672,15 @@ function useDemoCredentialsStyles(theme) {
|
|
|
3658
3672
|
marginBottom: spacing.sm,
|
|
3659
3673
|
color: colors.textSecondary
|
|
3660
3674
|
},
|
|
3675
|
+
accountLabel: {
|
|
3676
|
+
fontSize: typography.caption,
|
|
3677
|
+
fontWeight: "700",
|
|
3678
|
+
color: colors.text,
|
|
3679
|
+
// Separates one account block from the previous one; the first block sits
|
|
3680
|
+
// under the panel description / disclosure divider, which already spaces it.
|
|
3681
|
+
marginTop: spacing.sm,
|
|
3682
|
+
marginBottom: spacing.xs / HALF
|
|
3683
|
+
},
|
|
3661
3684
|
row: {
|
|
3662
3685
|
flexDirection: "row",
|
|
3663
3686
|
alignItems: "center",
|
|
@@ -3733,8 +3756,39 @@ function resolveDemoCredentials(credentials) {
|
|
|
3733
3756
|
}
|
|
3734
3757
|
return { username, password };
|
|
3735
3758
|
}
|
|
3759
|
+
|
|
3760
|
+
// src/demo/resolveDemoAccounts.ts
|
|
3761
|
+
function resolveAccount(account) {
|
|
3762
|
+
if (account === void 0 || account === null) {
|
|
3763
|
+
return null;
|
|
3764
|
+
}
|
|
3765
|
+
const pair = resolveDemoCredentials(account);
|
|
3766
|
+
if (pair === null) {
|
|
3767
|
+
return null;
|
|
3768
|
+
}
|
|
3769
|
+
const label = typeof account.label === "string" ? account.label : "";
|
|
3770
|
+
return { label, username: pair.username, password: pair.password };
|
|
3771
|
+
}
|
|
3772
|
+
function resolveAccountList(accounts) {
|
|
3773
|
+
if (!Array.isArray(accounts)) {
|
|
3774
|
+
return [];
|
|
3775
|
+
}
|
|
3776
|
+
return accounts.map(resolveAccount).filter((account) => account !== null);
|
|
3777
|
+
}
|
|
3778
|
+
function resolveDemoAccounts(credentials) {
|
|
3779
|
+
if (credentials === void 0 || credentials === null) {
|
|
3780
|
+
return [];
|
|
3781
|
+
}
|
|
3782
|
+
const fromList = resolveAccountList(credentials.publishedAccounts);
|
|
3783
|
+
if (fromList.length > 0) {
|
|
3784
|
+
return fromList;
|
|
3785
|
+
}
|
|
3786
|
+
const single = resolveDemoCredentials(credentials);
|
|
3787
|
+
return single === null ? [] : [{ label: "", username: single.username, password: single.password }];
|
|
3788
|
+
}
|
|
3736
3789
|
function DemoCredentialsHint({
|
|
3737
3790
|
credentials,
|
|
3791
|
+
accounts,
|
|
3738
3792
|
variant = "disclosure" /* Disclosure */,
|
|
3739
3793
|
theme: themeProp,
|
|
3740
3794
|
labels: labelsProp,
|
|
@@ -3749,29 +3803,35 @@ function DemoCredentialsHint({
|
|
|
3749
3803
|
() => ({ ...DEFAULT_DEMO_CREDENTIALS_HINT_LABELS, ...labelsProp }),
|
|
3750
3804
|
[labelsProp]
|
|
3751
3805
|
);
|
|
3752
|
-
const
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3806
|
+
const resolvedAccounts = react.useMemo(
|
|
3807
|
+
() => accounts !== void 0 && accounts.length > 0 ? resolveAccountList(accounts) : resolveDemoAccounts(credentials),
|
|
3808
|
+
[accounts, credentials]
|
|
3809
|
+
);
|
|
3810
|
+
const makeUse = react.useCallback(
|
|
3811
|
+
(account) => onUse === void 0 ? void 0 : () => onUse({ username: account.username, password: account.password }),
|
|
3812
|
+
[onUse]
|
|
3813
|
+
);
|
|
3758
3814
|
const handleToggle = react.useCallback(() => {
|
|
3759
3815
|
setExpanded((current) => !current);
|
|
3760
3816
|
}, []);
|
|
3761
|
-
if (
|
|
3817
|
+
if (resolvedAccounts.length === 0) {
|
|
3762
3818
|
return null;
|
|
3763
3819
|
}
|
|
3764
|
-
const
|
|
3820
|
+
const isSingle = resolvedAccounts.length === 1;
|
|
3821
|
+
const body = resolvedAccounts.map((account, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3765
3822
|
DemoCredentialsBody,
|
|
3766
3823
|
{
|
|
3824
|
+
accountLabel: isSingle ? void 0 : account.label,
|
|
3767
3825
|
authStyles,
|
|
3768
|
-
credentials:
|
|
3826
|
+
credentials: { username: account.username, password: account.password },
|
|
3769
3827
|
labels,
|
|
3770
3828
|
styles: styles3,
|
|
3829
|
+
testIdIndex: isSingle ? void 0 : index,
|
|
3771
3830
|
testIdPrefix,
|
|
3772
|
-
onUse:
|
|
3773
|
-
}
|
|
3774
|
-
|
|
3831
|
+
onUse: makeUse(account)
|
|
3832
|
+
},
|
|
3833
|
+
`${account.username}-${String(index)}`
|
|
3834
|
+
));
|
|
3775
3835
|
if (variant === "panel" /* Panel */) {
|
|
3776
3836
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3777
3837
|
reactNative.View,
|
|
@@ -3927,7 +3987,11 @@ function useDemoCredentials({
|
|
|
3927
3987
|
credentials,
|
|
3928
3988
|
prefillOnMount = false
|
|
3929
3989
|
} = {}) {
|
|
3930
|
-
const
|
|
3990
|
+
const accounts = react.useMemo(() => resolveDemoAccounts(credentials), [credentials]);
|
|
3991
|
+
const resolved = react.useMemo(() => {
|
|
3992
|
+
const first = accounts[0];
|
|
3993
|
+
return first === void 0 ? null : { username: first.username, password: first.password };
|
|
3994
|
+
}, [accounts]);
|
|
3931
3995
|
const [filled, setFilled] = react.useState(
|
|
3932
3996
|
prefillOnMount ? resolved : null
|
|
3933
3997
|
);
|
|
@@ -3959,11 +4023,12 @@ function useDemoCredentials({
|
|
|
3959
4023
|
prefillIntent
|
|
3960
4024
|
},
|
|
3961
4025
|
// `credentials` is passed through unresolved on purpose: the hint applies
|
|
3962
|
-
// `
|
|
3963
|
-
// standalone, without this hook.
|
|
3964
|
-
|
|
4026
|
+
// `resolveDemoAccounts` itself, so it fails closed even when it is used
|
|
4027
|
+
// standalone, without this hook. `accounts` is the already-resolved list the
|
|
4028
|
+
// hint prefers — one labelled row per entry.
|
|
4029
|
+
hintProps: { credentials, accounts, onUse: handleUse }
|
|
3965
4030
|
}),
|
|
3966
|
-
[filled, prefillNonce, prefillIntent, credentials, handleUse]
|
|
4031
|
+
[filled, prefillNonce, prefillIntent, credentials, accounts, handleUse]
|
|
3967
4032
|
);
|
|
3968
4033
|
}
|
|
3969
4034
|
async function lazyFetchHttpClient(request) {
|
|
@@ -4179,6 +4244,8 @@ exports.readCachedPreferredMethod = readCachedPreferredMethod;
|
|
|
4179
4244
|
exports.readPasskeyError = readPasskeyError;
|
|
4180
4245
|
exports.readPasskeyRegistered = readPasskeyRegistered;
|
|
4181
4246
|
exports.resolveAccessibleRoutes = resolveAccessibleRoutes;
|
|
4247
|
+
exports.resolveAccountList = resolveAccountList;
|
|
4248
|
+
exports.resolveDemoAccounts = resolveDemoAccounts;
|
|
4182
4249
|
exports.resolveDemoCredentials = resolveDemoCredentials;
|
|
4183
4250
|
exports.resolvePostLoginRoute = resolvePostLoginRoute;
|
|
4184
4251
|
exports.startPasskeyLogin = startPasskeyLogin;
|