@dloizides/auth-web 1.14.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/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
  /**
@@ -463,6 +463,50 @@ interface ResetPasswordFormLabels {
463
463
  }
464
464
  declare const DEFAULT_RESET_PASSWORD_LABELS: ResetPasswordFormLabels;
465
465
 
466
+ /**
467
+ * Strings rendered by `<AccountSettingsScreen>` and its `ChangePasswordCard`.
468
+ *
469
+ * As with every auth label bag, the consuming app supplies already-localised
470
+ * strings; the `DEFAULT_*` English constant lets the screen render with no
471
+ * `labels` prop and lets an app spread-override only the keys it cares about.
472
+ */
473
+ /** Strings for the account-settings screen shell + the in-app change-password form. */
474
+ interface AccountSettingsLabels {
475
+ /** The screen heading above the stacked settings cards. */
476
+ heading: string;
477
+ /** Card title. */
478
+ changePasswordTitle: string;
479
+ /** Card body copy above the fields. */
480
+ changePasswordDescription: string;
481
+ currentPasswordLabel: string;
482
+ currentPasswordPlaceholder: string;
483
+ newPasswordLabel: string;
484
+ newPasswordPlaceholder: string;
485
+ confirmPasswordLabel: string;
486
+ confirmPasswordPlaceholder: string;
487
+ /** Submit button. */
488
+ submit: string;
489
+ /** Shown while the submit is in flight. */
490
+ submitting: string;
491
+ /** Accessibility hint for the submit button. */
492
+ submitHint: string;
493
+ /** Shown after a successful change. */
494
+ success: string;
495
+ /** New password fails the shared policy. */
496
+ errorWeakNewPassword: string;
497
+ /** New password and confirmation do not match. */
498
+ errorMismatch: string;
499
+ /** Current password field left blank. */
500
+ errorCurrentRequired: string;
501
+ /** BFF 400 — current password wrong or new one rejected server-side. */
502
+ errorInvalidCurrent: string;
503
+ /** BFF 401 — session not authenticated. */
504
+ errorUnauthorized: string;
505
+ /** Any other failure. */
506
+ errorFailed: string;
507
+ }
508
+ declare const DEFAULT_ACCOUNT_SETTINGS_LABELS: AccountSettingsLabels;
509
+
466
510
  /**
467
511
  * Who asked for a prefill — the difference between "the user requested this" and
468
512
  * "the app offered it".
@@ -1281,6 +1325,175 @@ interface PreferredMethodSettingsCardProps {
1281
1325
  /** Themeable authenticated preferred-method picker. */
1282
1326
  declare function PreferredMethodSettingsCard({ client, availableMethods, theme: themeProp, labels: labelsProp, testIdPrefix, onChanged, }: Readonly<PreferredMethodSettingsCardProps>): ReactElement;
1283
1327
 
1328
+ /**
1329
+ * Discriminated result of an authenticated change-password attempt.
1330
+ *
1331
+ * Mirrors the device-PIN result shapes: the client never rejects for an expected
1332
+ * outcome — it resolves one of these so the form routes on the distinct causes
1333
+ * (a wrong current password / policy rejection vs. an expired session vs. an
1334
+ * unexpected error) rather than collapsing them into one opaque failure.
1335
+ */
1336
+ type ChangePasswordResult = {
1337
+ status: 'success';
1338
+ }
1339
+ /** BFF 400 — current password incorrect, or the new password failed the server policy. */
1340
+ | {
1341
+ status: 'invalidCurrent';
1342
+ }
1343
+ /** BFF 401 — the session is not / no longer authenticated. */
1344
+ | {
1345
+ status: 'unauthorized';
1346
+ }
1347
+ /** Any other status / transport failure. */
1348
+ | {
1349
+ status: 'error';
1350
+ };
1351
+
1352
+ /**
1353
+ * The client capability the authenticated change-password form depends on, plus
1354
+ * a ready-made same-origin BFF implementation.
1355
+ *
1356
+ * As with the device-PIN surfaces, the UI depends on a **structural** shape
1357
+ * ({@link ChangePasswordCapableClient}) — exactly one method — so a consuming app
1358
+ * may pass the ready-made client below or a thin hand-rolled object. The ready
1359
+ * client POSTs to the same-origin BFF and maps the response to a
1360
+ * {@link ChangePasswordResult}; it never rejects for an expected outcome.
1361
+ *
1362
+ * SECURITY: the password values live only in the request the end user's OWN
1363
+ * browser sends to their OWN app's BFF over the session cookie. This package
1364
+ * neither stores, logs, nor inspects them — it forwards `currentPassword` /
1365
+ * `newPassword` to the BFF and reads back only a status code.
1366
+ */
1367
+
1368
+ /** The request body posted to `POST /bff/account/change-password`. */
1369
+ interface ChangePasswordRequest {
1370
+ currentPassword: string;
1371
+ newPassword: string;
1372
+ }
1373
+ /** The single-method capability the change-password form needs. */
1374
+ interface ChangePasswordCapableClient {
1375
+ /** Change the signed-in user's password. Resolves a result; never rejects on an expected outcome. */
1376
+ changePassword(request: ChangePasswordRequest): Promise<ChangePasswordResult>;
1377
+ }
1378
+ /** Options for {@link createBffChangePasswordClient}. */
1379
+ interface CreateBffChangePasswordClientOptions {
1380
+ /**
1381
+ * BFF origin. Omit (the production default) for same-origin — the SPA's own
1382
+ * host is the BFF. An explicit origin is useful only for a non-same-origin BFF
1383
+ * or for tests.
1384
+ */
1385
+ baseUrl?: string;
1386
+ /**
1387
+ * Override the HTTP transport. Defaults to a lazily-resolved native `fetch`
1388
+ * (module load stays side-effect-free, so a `fetch`-less test runtime does not
1389
+ * blow up on import). Tests pass a fake `HttpClient`.
1390
+ */
1391
+ http?: HttpClient;
1392
+ }
1393
+ /** The BFF endpoint the ready client posts to. */
1394
+ declare const CHANGE_PASSWORD_ENDPOINT = "/bff/account/change-password";
1395
+ /**
1396
+ * Build a same-origin change-password client. With no arguments this is the exact
1397
+ * production wiring: same-origin, lazy `fetch`, session-cookie auth, the BFF CSRF
1398
+ * marker header attached. A thrown transport error resolves to `{ status: 'error' }`
1399
+ * so the caller never has to catch.
1400
+ */
1401
+ declare function createBffChangePasswordClient(options?: CreateBffChangePasswordClientOptions): ChangePasswordCapableClient;
1402
+
1403
+ /**
1404
+ * AccountSettingsScreen — the shared, composable authenticated account surface
1405
+ * every dloizides portal can mount to give a signed-in user one place to manage
1406
+ * their account. Self-contained and theme-driven: it stacks a set of independent,
1407
+ * individually-themed cards, each rendered only when its config is supplied.
1408
+ *
1409
+ * - **Change password** (always) — the in-app `<ChangePasswordCard>` form
1410
+ * (`POST /bff/account/change-password`). No password value is handled by this
1411
+ * package beyond forwarding it to the app's own BFF.
1412
+ * - **Device PIN** (optional) — the existing `<DevicePinSettingsCard>`, so every
1413
+ * portal gets quick-PIN enable/disable for free.
1414
+ * - **Passkeys** (optional) — the existing `<PasskeySettingsCard>`.
1415
+ * - **Preferred sign-in method** (optional) — the existing
1416
+ * `<PreferredMethodSettingsCard>`.
1417
+ *
1418
+ * Purely presentational assembly: each card owns its own behaviour + hooks (all
1419
+ * react-query-free). The screen only threads the shared `theme` / `testIdPrefix`
1420
+ * down and lays the cards out in a scrollable, centered column.
1421
+ */
1422
+
1423
+ /** Device-PIN section config — mirrors `DevicePinSettingsCard` (theme/testIdPrefix threaded by the screen). */
1424
+ interface AccountSettingsDevicePinConfig {
1425
+ client: DevicePinEnrollCapableClient & DevicePinDisableCapableClient;
1426
+ initialHasPin: boolean;
1427
+ labels?: Partial<DevicePinSettingsLabels>;
1428
+ enrollLabels?: Partial<DevicePinEnrollLabels>;
1429
+ onChanged?: (hasPin: boolean) => void;
1430
+ }
1431
+ /** Passkeys section config — mirrors `PasskeySettingsCard`. */
1432
+ interface AccountSettingsPasskeysConfig {
1433
+ returnUrl?: string;
1434
+ labels?: Partial<PasskeySettingsLabels>;
1435
+ }
1436
+ /** Preferred-method section config — mirrors `PreferredMethodSettingsCard`. */
1437
+ interface AccountSettingsPreferredMethodConfig {
1438
+ client: PreferredMethodClient;
1439
+ availableMethods: readonly string[];
1440
+ labels?: Partial<PreferredMethodSettingsLabels>;
1441
+ onChanged?: (method: string | null) => void;
1442
+ }
1443
+ /** Change-password section config. */
1444
+ interface AccountSettingsChangePasswordConfig {
1445
+ client: ChangePasswordCapableClient;
1446
+ onChanged?: () => void;
1447
+ }
1448
+ interface AccountSettingsScreenProps {
1449
+ /** Change-password form config (always rendered). */
1450
+ changePassword: AccountSettingsChangePasswordConfig;
1451
+ /** Device-PIN card config. Omit to hide the section. */
1452
+ devicePin?: AccountSettingsDevicePinConfig;
1453
+ /** Passkeys card config. Omit to hide the section. */
1454
+ passkeys?: AccountSettingsPasskeysConfig;
1455
+ /** Preferred-method card config. Omit to hide the section. */
1456
+ preferredMethod?: AccountSettingsPreferredMethodConfig;
1457
+ /** Explicit theme; overrides any `<AuthThemeProvider>`. Threaded to every card. */
1458
+ theme?: AuthTheme;
1459
+ /** Screen + change-password copy (partial; unspecified keys fall back to English). */
1460
+ labels?: Partial<AccountSettingsLabels>;
1461
+ /** Prefix applied to every `testID`, on the screen and every card. */
1462
+ testIdPrefix?: string;
1463
+ }
1464
+ /** The shared authenticated account-management surface. */
1465
+ declare function AccountSettingsScreen({ changePassword, devicePin, passkeys, preferredMethod, theme: themeProp, labels: labelsProp, testIdPrefix, }: Readonly<AccountSettingsScreenProps>): ReactElement;
1466
+
1467
+ /**
1468
+ * ChangePasswordCard — an authenticated, in-app "Change password" form.
1469
+ *
1470
+ * The signed-in user types their OWN current + new password in their OWN app;
1471
+ * that is a legitimate first-class feature (no Keycloak-console detour). The card
1472
+ * is purely presentational: all state, validation and submission live in
1473
+ * {@link useChangePassword}, which posts to `POST /bff/account/change-password`
1474
+ * through a {@link ChangePasswordCapableClient}. This package never stores, logs
1475
+ * or inspects the password values — it forwards them to the app's own BFF over
1476
+ * the session cookie and reads back only a status.
1477
+ *
1478
+ * Theme-driven and react-query-free, mirroring `DevicePinSettingsCard` /
1479
+ * `ResetPasswordForm`.
1480
+ */
1481
+
1482
+ interface ChangePasswordCardProps {
1483
+ /** The client exposing `changePassword` (see `createBffChangePasswordClient`). */
1484
+ client: ChangePasswordCapableClient;
1485
+ /** Explicit theme; overrides any `<AuthThemeProvider>`. */
1486
+ theme?: AuthTheme;
1487
+ /** Localised copy. Partial — unspecified keys fall back to English defaults. */
1488
+ labels?: Partial<AccountSettingsLabels>;
1489
+ /** Prefix applied to every `testID`. */
1490
+ testIdPrefix?: string;
1491
+ /** Called once after a successful password change. */
1492
+ onChanged?: () => void;
1493
+ }
1494
+ /** Themeable authenticated change-password form. */
1495
+ declare function ChangePasswordCard({ client, theme: themeProp, labels: labelsProp, testIdPrefix, onChanged, }: Readonly<ChangePasswordCardProps>): ReactElement;
1496
+
1284
1497
  /**
1285
1498
  * The login-screen "you usually sign in with…" hint (unified-login D5).
1286
1499
  *
@@ -1396,9 +1609,18 @@ declare const enum DemoCredentialsHintVariant {
1396
1609
  interface DemoCredentialsHintProps {
1397
1610
  /**
1398
1611
  * The demo credentials to advertise. `undefined` — or a pair with a blank
1399
- * 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.
1400
1615
  */
1401
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[];
1402
1624
  /**
1403
1625
  * Presentation. Defaults to `Disclosure` (one quiet expandable line); pass
1404
1626
  * `Panel` for the original always-open block.
@@ -1418,7 +1640,7 @@ interface DemoCredentialsHintProps {
1418
1640
  onUse?: (credentials: DemoCredentials) => void;
1419
1641
  }
1420
1642
  /** 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;
1643
+ declare function DemoCredentialsHint({ credentials, accounts, variant, theme: themeProp, labels: labelsProp, testIdPrefix, onUse, }: Readonly<DemoCredentialsHintProps>): ReactElement | null;
1422
1644
 
1423
1645
  /**
1424
1646
  * React context for the `AuthTheme`.
@@ -1525,7 +1747,16 @@ declare const AuthTestIds: {
1525
1747
  readonly preferredMethodSettingsOption: "auth-preferred-method-settings-option";
1526
1748
  readonly preferredMethodSettingsError: "auth-preferred-method-settings-error";
1527
1749
  readonly preferredMethodHint: "auth-preferred-method-hint";
1750
+ readonly accountSettings: "auth-account-settings";
1751
+ readonly accountSettingsChangePassword: "auth-account-settings-change-password";
1752
+ readonly changePasswordCurrentInput: "auth-change-password-current";
1753
+ readonly changePasswordNewInput: "auth-change-password-new";
1754
+ readonly changePasswordConfirmInput: "auth-change-password-confirm";
1755
+ readonly changePasswordSubmit: "auth-change-password-submit";
1756
+ readonly changePasswordError: "auth-change-password-error";
1757
+ readonly changePasswordSuccess: "auth-change-password-success";
1528
1758
  readonly demoCredentialsHint: "auth-demo-credentials-hint";
1759
+ readonly demoCredentialsAccountLabel: "auth-demo-credentials-account-label";
1529
1760
  readonly demoCredentialsUsername: "auth-demo-credentials-username";
1530
1761
  readonly demoCredentialsPassword: "auth-demo-credentials-password";
1531
1762
  readonly demoCredentialsUseButton: "auth-demo-credentials-use";
@@ -2062,6 +2293,13 @@ interface DemoCredentialsLoginFormProps {
2062
2293
  /** The `<DemoCredentialsHint>` props that carry the credentials + fill action. */
2063
2294
  interface DemoCredentialsHintWiring {
2064
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[];
2065
2303
  onUse: (credentials: DemoCredentials) => void;
2066
2304
  }
2067
2305
  /** What {@link useDemoCredentials} hands back. */
@@ -2104,6 +2342,19 @@ declare function useDemoCredentials({ credentials, prefillOnMount, }?: Readonly<
2104
2342
  */
2105
2343
  declare function resolveDemoCredentials(credentials?: DemoCredentials | null): DemoCredentials | null;
2106
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
+
2107
2358
  /**
2108
2359
  * `createBffAuthClient` — the one-line wiring of a same-origin `BffAuthClient`.
2109
2360
  *
@@ -2347,4 +2598,50 @@ declare function validatePasswordPolicy(password: string): PasswordPolicyError[]
2347
2598
  /** `true` when the password satisfies every policy rule. */
2348
2599
  declare function isPasswordValid(password: string): boolean;
2349
2600
 
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 };
2601
+ /**
2602
+ * The localizable failure states the authenticated "Change password" form can
2603
+ * show. Client-side validation states never hit the network; the rest map from
2604
+ * the BFF's `POST /bff/account/change-password` response.
2605
+ */
2606
+ declare const enum ChangePasswordErrorKey {
2607
+ /** New password is empty / fails the shared password policy (no network call). */
2608
+ WeakNewPassword = "weak_new_password",
2609
+ /** New password and its confirmation do not match (no network call). */
2610
+ Mismatch = "mismatch",
2611
+ /** Current password field was left blank (no network call). */
2612
+ CurrentRequired = "current_required",
2613
+ /** BFF 400 — the current password is wrong, or the new one was rejected server-side. */
2614
+ InvalidCurrent = "invalid_current",
2615
+ /** BFF 401 — the session is not (or no longer) authenticated. */
2616
+ Unauthorized = "unauthorized",
2617
+ /** Any other failure (network / unexpected). */
2618
+ Failed = "failed"
2619
+ }
2620
+
2621
+ interface UseChangePasswordArgs {
2622
+ /** The client exposing `changePassword`. */
2623
+ client: ChangePasswordCapableClient;
2624
+ /** Called once after a successful change (the form has been cleared by then). */
2625
+ onChanged?: () => void;
2626
+ }
2627
+ interface UseChangePasswordResult {
2628
+ currentPassword: string;
2629
+ newPassword: string;
2630
+ confirmPassword: string;
2631
+ setCurrentPassword: (value: string) => void;
2632
+ setNewPassword: (value: string) => void;
2633
+ setConfirmPassword: (value: string) => void;
2634
+ /** `true` while a BFF submit is in flight. */
2635
+ submitting: boolean;
2636
+ /** `true` after a successful change (until `reset` / a field edit). */
2637
+ succeeded: boolean;
2638
+ /** The current failure cause, or `null` when there is none. */
2639
+ errorKey: ChangePasswordErrorKey | null;
2640
+ /** Validate then submit. A validation failure sets `errorKey` and skips the network call. */
2641
+ submit: () => void;
2642
+ /** Clear every field + status back to a blank form. */
2643
+ reset: () => void;
2644
+ }
2645
+ declare function useChangePassword({ client, onChanged, }: UseChangePasswordArgs): UseChangePasswordResult;
2646
+
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 };