@dloizides/auth-web 1.22.1 → 1.24.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,5 +1,5 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { BffAuthClient, BffUser, DemoCredentials, HttpClient, DemoAccount, BffLoginRequest, BffForgotPasswordRequest, BffResetPasswordRequest, BffOtpRequestResult } from '@dloizides/auth-client';
2
+ import { BffAuthClient, BffUser, DemoCredentials, HttpClient, DemoAccount, BffLoginRequest, BffForgotPasswordRequest, BffResetPasswordRequest, BffOtpRequestResult, BffRegisterRequest } from '@dloizides/auth-client';
3
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
 
@@ -460,6 +460,8 @@ interface ResetPasswordFormLabels {
460
460
  errorTokenInvalid: string;
461
461
  /** Error: a network / 5xx failure. */
462
462
  errorNetwork: string;
463
+ /** Error: the BFF rate-limited the attempt. Falls back to `errorNetwork`. */
464
+ errorRateLimited?: string;
463
465
  }
464
466
  declare const DEFAULT_RESET_PASSWORD_LABELS: ResetPasswordFormLabels;
465
467
 
@@ -571,6 +573,11 @@ type RegisterInputField = Exclude<RegisterField, 'website'>;
571
573
  * honeypot is kept (empty for real users) so the BFF can enforce it as well.
572
574
  */
573
575
  type RegisterSubmitValues = Omit<RegisterFormValues, 'confirmPassword'>;
576
+ /** Extra request data for shared registration; only passed to `onSubmit` when it is on. */
577
+ interface RegisterSubmitMeta {
578
+ idempotencyKey: string;
579
+ formElapsedMs: number;
580
+ }
574
581
  /** `true` when the password is acceptable. */
575
582
  type RegisterPasswordPolicy = (password: string) => boolean;
576
583
  type RegisterSubmitOutcome<TResult> = {
@@ -603,9 +610,20 @@ interface RegisterFormLabels {
603
610
  fields: Record<RegisterInputField, RegisterFieldLabels>;
604
611
  /** Copy for the single "Your name" input of the compact form. Defaults to English. */
605
612
  fullName?: RegisterFieldLabels;
613
+ /** Heading shown after a 202 with shared registration on. Defaults to English. */
614
+ checkEmailTitle?: string;
615
+ /** Body shown after a 202 with shared registration on. Defaults to English. */
616
+ checkEmailBody?: string;
606
617
  }
607
618
  declare const DEFAULT_REGISTER_LABELS: RegisterFormLabels;
608
619
 
620
+ /** Copy for the verified account whose automatic sign-in failed. */
621
+ interface VerifySignInLabels {
622
+ title: string;
623
+ body: string;
624
+ action: string;
625
+ actionHint: string;
626
+ }
609
627
  /** Strings rendered by `<VerifyEmailScreen>`. */
610
628
  interface VerifyEmailLabels {
611
629
  loadingTitle: string;
@@ -629,9 +647,53 @@ interface VerifyEmailLabels {
629
647
  resendSubmit: string;
630
648
  resendSubmitHint: string;
631
649
  resendConfirmation: string;
632
- }
650
+ /** Shown when the BFF rate-limits the link. Falls back to `errorGeneric`. */
651
+ errorRateLimited?: string;
652
+ /** Copy for the set-new-password step of shared registration. */
653
+ newPassword?: Partial<ResetPasswordFormLabels>;
654
+ /** Copy for the verified-but-not-signed-in step of shared registration. */
655
+ signIn?: Partial<VerifySignInLabels>;
656
+ }
657
+ declare const DEFAULT_VERIFY_NEW_PASSWORD_LABELS: ResetPasswordFormLabels;
658
+ declare const DEFAULT_VERIFY_SIGN_IN_LABELS: VerifySignInLabels;
633
659
  declare const DEFAULT_VERIFY_EMAIL_LABELS: VerifyEmailLabels;
634
660
 
661
+ interface AccountDeletionFieldLabels {
662
+ label: string;
663
+ placeholder: string;
664
+ hint: string;
665
+ inputLabel: string;
666
+ }
667
+ /** Strings rendered by `<AccountDeletionForm>`. `{seconds}` and `{date}` are filled in. */
668
+ interface AccountDeletionLabels {
669
+ title: string;
670
+ subtitle: string;
671
+ reason: AccountDeletionFieldLabels;
672
+ submit: string;
673
+ submitHint: string;
674
+ submitting: string;
675
+ stepUpTitle: string;
676
+ stepUpSubtitle: string;
677
+ password: AccountDeletionFieldLabels;
678
+ stepUpSubmit: string;
679
+ stepUpSubmitHint: string;
680
+ checkEmailTitle: string;
681
+ checkEmailBody: string;
682
+ emailNotSentTitle: string;
683
+ emailNotSentBody: string;
684
+ scheduledDate: string;
685
+ alreadyRequestedTitle: string;
686
+ alreadyRequestedBody: string;
687
+ errorPasswordRequired: string;
688
+ errorWrongPassword: string;
689
+ errorSignInRequired: string;
690
+ errorRateLimited: string;
691
+ errorRateLimitedSeconds: string;
692
+ errorRetryLater: string;
693
+ errorFailed: string;
694
+ }
695
+ declare const DEFAULT_ACCOUNT_DELETION_LABELS: AccountDeletionLabels;
696
+
635
697
  /**
636
698
  * Who asked for a prefill — the difference between "the user requested this" and
637
699
  * "the app offered it".
@@ -1897,6 +1959,8 @@ declare const AuthTestIds: {
1897
1959
  readonly verifyEmailSuccess: "auth-verify-email-success";
1898
1960
  readonly verifyEmailContinue: "auth-verify-email-continue";
1899
1961
  readonly verifyEmailError: "auth-verify-email-error";
1962
+ readonly verifyEmailSignIn: "auth-verify-email-sign-in";
1963
+ readonly verifyEmailSignInContinue: "auth-verify-email-sign-in-continue";
1900
1964
  readonly verifyEmailResendCta: "auth-verify-email-resend-cta";
1901
1965
  readonly verifyEmailResendForm: "auth-verify-email-resend-form";
1902
1966
  readonly verifyEmailResendEmail: "auth-verify-email-resend-email";
@@ -2004,7 +2068,9 @@ declare const enum ResetPasswordError {
2004
2068
  /** The reset token is missing, expired, or already consumed. */
2005
2069
  TokenInvalid = "tokenInvalid",
2006
2070
  /** A network or 5xx failure prevented the reset from completing. */
2007
- Network = "network"
2071
+ Network = "network",
2072
+ /** The BFF rate-limited the attempt (HTTP 429). */
2073
+ RateLimited = "rateLimited"
2008
2074
  }
2009
2075
 
2010
2076
  interface UseResetPasswordFormArgs {
@@ -2508,7 +2574,7 @@ declare function resolveDemoAccounts(credentials?: DemoCredentials | null): Demo
2508
2574
 
2509
2575
  interface RegisterFormProps<TResult> {
2510
2576
  /** Send the registration (build the request, call the BFF). Throw on failure. */
2511
- onSubmit: (values: RegisterSubmitValues) => Promise<TResult>;
2577
+ onSubmit: (values: RegisterSubmitValues, meta?: RegisterSubmitMeta) => Promise<TResult>;
2512
2578
  /** Called with whatever `onSubmit` resolved to. */
2513
2579
  onSuccess: (result: TResult) => void;
2514
2580
  /** Called with the failure code; map it to localised copy. */
@@ -2533,7 +2599,7 @@ interface RegisterFormProps<TResult> {
2533
2599
  compact?: boolean;
2534
2600
  }
2535
2601
  /** Themeable registration form built on `useRegisterForm`. */
2536
- declare function RegisterForm<TResult>({ onSubmit, onSuccess, onError, onSubmitAttempt, passwordPolicy, labels: labelsProp, theme: themeProp, footer, testIdPrefix, compact, }: Readonly<RegisterFormProps<TResult>>): ReactElement;
2602
+ declare function RegisterForm<TResult>(props: Readonly<RegisterFormProps<TResult>>): ReactElement;
2537
2603
 
2538
2604
  /**
2539
2605
  * `testID` values for `<RegisterForm>`.
@@ -2558,11 +2624,12 @@ declare const RegisterTestIds: {
2558
2624
  readonly tenantNameInput: "register-tenant-name-input";
2559
2625
  readonly submitButton: "register-submit-button";
2560
2626
  readonly websiteInput: "register-website";
2627
+ readonly checkEmail: "register-check-email";
2561
2628
  };
2562
2629
 
2563
2630
  interface UseRegisterFormArgs<TResult> {
2564
2631
  /** Send the registration. Throw on failure; the message is decoded to a code. */
2565
- onSubmit: (values: RegisterSubmitValues) => Promise<TResult>;
2632
+ onSubmit: (values: RegisterSubmitValues, meta?: RegisterSubmitMeta) => Promise<TResult>;
2566
2633
  /** Password rule. Defaults to {@link isRegisterPasswordStrong}. */
2567
2634
  passwordPolicy?: RegisterPasswordPolicy;
2568
2635
  /**
@@ -2575,6 +2642,8 @@ interface UseRegisterFormArgs<TResult> {
2575
2642
  * (from the email) and the password confirmation are derived before validation.
2576
2643
  */
2577
2644
  compact?: boolean;
2645
+ /** Opt-in shared registration: `onSubmit` also gets the key and form time; an accepted result clears the passwords. */
2646
+ sharedRegistration?: boolean;
2578
2647
  }
2579
2648
  interface UseRegisterFormResult<TResult> {
2580
2649
  state: RegisterFormValues;
@@ -2585,7 +2654,7 @@ interface UseRegisterFormResult<TResult> {
2585
2654
  error: RegisterErrorCode | null;
2586
2655
  }
2587
2656
  /** Headless registration form logic. */
2588
- declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAttempt, compact, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
2657
+ declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAttempt, compact, sharedRegistration, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
2589
2658
 
2590
2659
  /**
2591
2660
  * Pure registration helpers: trimming, client-side validation and decoding of a
@@ -2919,6 +2988,10 @@ declare const enum VerifyEmailErrorCode {
2919
2988
  TokenUsed = "TOKEN_USED",
2920
2989
  KeycloakUpdateFailed = "KEYCLOAK_UPDATE_FAILED",
2921
2990
  MissingToken = "MISSING_TOKEN",
2991
+ NewPasswordRequired = "NEW_PASSWORD_REQUIRED",
2992
+ WeakPassword = "WEAK_PASSWORD",
2993
+ RateLimited = "RATE_LIMITED",
2994
+ SignInFailed = "SIGN_IN_FAILED",
2922
2995
  Generic = "GENERIC"
2923
2996
  }
2924
2997
 
@@ -2932,6 +3005,7 @@ type VerifyEmailResult = {
2932
3005
  interface VerifyEmailCapableClient {
2933
3006
  verifyEmail(token: string): Promise<VerifyEmailResult>;
2934
3007
  resendVerification(email: string, verifyUrlTemplate?: string): Promise<boolean>;
3008
+ setNewPassword?(token: string, newPassword: string): Promise<VerifyEmailResult>;
2935
3009
  }
2936
3010
 
2937
3011
  interface VerifyEmailScreenProps {
@@ -2948,11 +3022,12 @@ interface VerifyEmailScreenProps {
2948
3022
  /** Verifies the emailed token on mount, then offers Continue or a resend-link form. */
2949
3023
  declare function VerifyEmailScreen({ client, token, onContinue, theme: themeProp, labels: labelsProp, verifyUrlTemplate, onVerified, onFailed, testIdPrefix, }: Readonly<VerifyEmailScreenProps>): ReactElement;
2950
3024
 
2951
- /** The three states the verify-email screen moves through. */
3025
+ /** The states the verify-email screen moves through. */
2952
3026
  declare const enum VerifyEmailPhase {
2953
3027
  Loading = "loading",
2954
3028
  Success = "success",
2955
- Failure = "failure"
3029
+ Failure = "failure",
3030
+ NewPasswordRequired = "newPasswordRequired"
2956
3031
  }
2957
3032
 
2958
3033
  interface UseVerifyEmailArgs {
@@ -3006,4 +3081,143 @@ declare function readVerifyToken(raw: string | readonly string[] | undefined): s
3006
3081
  /** The failure body copy for a verification error code. */
3007
3082
  declare function verifyEmailErrorText(code: VerifyEmailErrorCode, labels: VerifyEmailLabels): string;
3008
3083
 
3009
- 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, type BuildVerifyUrlTemplateOptions, CHANGE_PASSWORD_ENDPOINT, type ChangePasswordCapableClient, ChangePasswordCard, type ChangePasswordCardProps, ChangePasswordErrorKey, type ChangePasswordRequest, type ChangePasswordResult, type CreateBffAuthClientOptions, type CreateBffChangePasswordClientOptions, type CreateBffVerifyEmailClientOptions, 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_REGISTER_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEFAULT_VERIFY_EMAIL_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, RESEND_VERIFICATION_ENDPOINT, RegisterErrorCode, type RegisterField, type RegisterFieldLabels, RegisterForm, type RegisterFormLabels, type RegisterFormProps, type RegisterFormValues, type RegisterInputField, type RegisterPasswordPolicy, type RegisterSubmitOutcome, type RegisterSubmitValues, RegisterTestIds, ResetPasswordError, ResetPasswordForm, type ResetPasswordFormLabels, type ResetPasswordFormProps, type RoleRoute, type RoleRouteTable, type SplitName, 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 UseRegisterFormArgs, type UseRegisterFormResult, type UseResendVerificationArgs, type UseResendVerificationResult, type UseResetPasswordFormArgs, type UseResetPasswordFormResult, type UseVerifyEmailArgs, type UseVerifyEmailResult, VERIFY_EMAIL_ENDPOINT, VERIFY_TOKEN_PLACEHOLDER, type VerifyEmailCapableClient, VerifyEmailErrorCode, type VerifyEmailLabels, VerifyEmailPhase, type VerifyEmailResult, VerifyEmailScreen, type VerifyEmailScreenProps, buildVerifyUrlTemplate, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createBffChangePasswordClient, createBffVerifyEmailClient, createPreferencesClient, defaultAuthTheme, deriveUsernameFromEmail, isAllowedPinDigits, isPasswordValid, isRegisterPasswordStrong, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, readVerifyToken, resolveAccessibleRoutes, resolveAccountList, resolveDemoAccounts, resolveDemoCredentials, resolvePostLoginRoute, splitFullName, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useChangePassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useRegisterForm, useResendVerification, useResetPasswordForm, useVerifyEmail, validatePasswordPolicy, verifyEmailErrorText, withTestIdPrefix };
3084
+ /** What the shared `/bff/register` resolves to; `accepted` means a 202 with no session. */
3085
+ interface SharedRegisterResult {
3086
+ accepted: boolean;
3087
+ body: unknown;
3088
+ }
3089
+ /** `true` when `result` reports an accepted registration waiting on the emailed link. */
3090
+ declare function isRegisterAccepted(result: unknown): boolean;
3091
+
3092
+ declare const REGISTER_ENDPOINT = "/bff/register";
3093
+ declare const VERIFY_AND_LOGIN_ENDPOINT = "/bff/verify-and-login";
3094
+ interface SharedRegistrationClient extends VerifyEmailCapableClient {
3095
+ register(request: BffRegisterRequest, meta?: RegisterSubmitMeta): Promise<SharedRegisterResult>;
3096
+ setNewPassword(token: string, newPassword: string): Promise<VerifyEmailResult>;
3097
+ }
3098
+ /** Same-origin client for the shared registration path; never calls `/bff/verify-email`. */
3099
+ declare function createSharedRegistrationClient(options?: CreateBffVerifyEmailClientOptions): SharedRegistrationClient;
3100
+
3101
+ interface SharedRegisterFormProps<TResult> extends RegisterFormProps<TResult> {
3102
+ /** Called once when the BFF accepts the signup (202). `onSuccess` is not called then: no session exists. */
3103
+ onAccepted?: (result: TResult) => void;
3104
+ }
3105
+ /** `<RegisterForm>` for the shared path: `onSubmit` also gets `meta`, and a 202 shows "check your email". */
3106
+ declare function SharedRegisterForm<TResult>({ onSuccess, onAccepted, ...formProps }: Readonly<SharedRegisterFormProps<TResult>>): ReactElement;
3107
+
3108
+ /** What `POST /bff/account/delete-request` answered, as the form routes on it. */
3109
+ declare const enum AccountDeletionStatus {
3110
+ Accepted = "accepted",
3111
+ StepUpRequired = "stepUpRequired",
3112
+ AlreadyRequested = "alreadyRequested",
3113
+ SignInRequired = "signInRequired",
3114
+ RateLimited = "rateLimited",
3115
+ RetryLater = "retryLater",
3116
+ Failed = "failed"
3117
+ }
3118
+
3119
+ /** What `POST /bff/step-up/password` answered. */
3120
+ declare const enum StepUpStatus {
3121
+ Confirmed = "confirmed",
3122
+ WrongPassword = "wrongPassword",
3123
+ RateLimited = "rateLimited",
3124
+ Failed = "failed"
3125
+ }
3126
+
3127
+ declare const ACCOUNT_DELETE_REQUEST_ENDPOINT = "/bff/account/delete-request";
3128
+ declare const STEP_UP_PASSWORD_ENDPOINT = "/bff/step-up/password";
3129
+ /** The 202 body: the request is recorded and waits on the emailed confirmation. */
3130
+ interface AccountDeletionReceipt {
3131
+ requestId: string;
3132
+ scheduledDeletionDate: string;
3133
+ confirmationEmailSent: boolean;
3134
+ }
3135
+ type AccountDeletionResult = {
3136
+ status: AccountDeletionStatus.Accepted;
3137
+ receipt: AccountDeletionReceipt;
3138
+ } | {
3139
+ status: AccountDeletionStatus.RateLimited;
3140
+ retryAfterSeconds: number | null;
3141
+ } | {
3142
+ status: AccountDeletionStatus.StepUpRequired | AccountDeletionStatus.AlreadyRequested | AccountDeletionStatus.SignInRequired | AccountDeletionStatus.RetryLater | AccountDeletionStatus.Failed;
3143
+ };
3144
+ type StepUpResult = {
3145
+ status: StepUpStatus.RateLimited;
3146
+ retryAfterSeconds: number | null;
3147
+ } | {
3148
+ status: StepUpStatus.Confirmed | StepUpStatus.WrongPassword | StepUpStatus.Failed;
3149
+ };
3150
+ /** The two calls the account deletion form needs. Neither rejects on an expected outcome. */
3151
+ interface AccountDeletionCapableClient {
3152
+ requestDeletion(reason?: string): Promise<AccountDeletionResult>;
3153
+ stepUpPassword(password: string): Promise<StepUpResult>;
3154
+ }
3155
+ /** Same-origin client: session cookie, `X-BFF-Csrf: 1`, JSON. A transport error resolves to `Failed`. */
3156
+ declare function createBffAccountDeletionClient(options?: CreateBffVerifyEmailClientOptions): AccountDeletionCapableClient;
3157
+
3158
+ /** Failure causes of the account deletion form. */
3159
+ declare const enum AccountDeletionErrorKey {
3160
+ PasswordRequired = "passwordRequired",
3161
+ WrongPassword = "wrongPassword",
3162
+ SignInRequired = "signInRequired",
3163
+ RateLimited = "rateLimited",
3164
+ RetryLater = "retryLater",
3165
+ Failed = "failed"
3166
+ }
3167
+
3168
+ /** Which view the account deletion form shows. */
3169
+ declare const enum AccountDeletionPhase {
3170
+ Confirm = "confirm",
3171
+ StepUp = "stepUp",
3172
+ Accepted = "accepted",
3173
+ AlreadyRequested = "alreadyRequested"
3174
+ }
3175
+
3176
+ interface UseAccountDeletionArgs {
3177
+ client: AccountDeletionCapableClient;
3178
+ onAccepted?: (receipt: AccountDeletionReceipt) => void;
3179
+ onSignInRequired?: () => void;
3180
+ }
3181
+ interface UseAccountDeletionResult {
3182
+ phase: AccountDeletionPhase;
3183
+ reason: string;
3184
+ password: string;
3185
+ setReason: (value: string) => void;
3186
+ setPassword: (value: string) => void;
3187
+ submitting: boolean;
3188
+ blocked: boolean;
3189
+ retryAfterSeconds: number | null;
3190
+ errorKey: AccountDeletionErrorKey | null;
3191
+ receipt: AccountDeletionReceipt | null;
3192
+ submit: () => void;
3193
+ }
3194
+ /** State behind the account deletion form: request, password step-up + one retry, 429 wait. */
3195
+ declare function useAccountDeletion(args: UseAccountDeletionArgs): UseAccountDeletionResult;
3196
+
3197
+ interface AccountDeletionFormProps {
3198
+ client: AccountDeletionCapableClient;
3199
+ /** Localised copy. Partial: unspecified top-level keys fall back to English defaults. */
3200
+ labels?: Partial<AccountDeletionLabels>;
3201
+ theme?: AuthTheme;
3202
+ testIdPrefix?: string;
3203
+ /** Rendered at the end of every view (e.g. a cancel link). */
3204
+ footer?: ReactNode;
3205
+ onAccepted?: (receipt: AccountDeletionReceipt) => void;
3206
+ onSignInRequired?: () => void;
3207
+ }
3208
+ /** Asks for an optional reason, steps up with the password when the login is stale, then says check your email. */
3209
+ declare function AccountDeletionForm({ client, labels: labelsProp, theme: themeProp, testIdPrefix, footer, onAccepted, onSignInRequired, }: Readonly<AccountDeletionFormProps>): ReactElement;
3210
+
3211
+ /** `testID` values for `<AccountDeletionForm>`. */
3212
+ declare const AccountDeletionTestIds: {
3213
+ readonly form: "account-deletion-form";
3214
+ readonly reasonInput: "account-deletion-reason-input";
3215
+ readonly stepUpInput: "account-deletion-password-input";
3216
+ readonly submitButton: "account-deletion-submit-button";
3217
+ readonly error: "account-deletion-error";
3218
+ readonly checkEmail: "account-deletion-check-email";
3219
+ readonly emailNotSent: "account-deletion-email-not-sent";
3220
+ readonly alreadyRequested: "account-deletion-already-requested";
3221
+ };
3222
+
3223
+ export { ACCOUNT_DELETE_REQUEST_ENDPOINT, type AccountDeletionCapableClient, AccountDeletionErrorKey, type AccountDeletionFieldLabels, AccountDeletionForm, type AccountDeletionFormProps, type AccountDeletionLabels, AccountDeletionPhase, type AccountDeletionReceipt, type AccountDeletionResult, AccountDeletionStatus, AccountDeletionTestIds, 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, type BuildVerifyUrlTemplateOptions, CHANGE_PASSWORD_ENDPOINT, type ChangePasswordCapableClient, ChangePasswordCard, type ChangePasswordCardProps, ChangePasswordErrorKey, type ChangePasswordRequest, type ChangePasswordResult, type CreateBffAuthClientOptions, type CreateBffChangePasswordClientOptions, type CreateBffVerifyEmailClientOptions, DEFAULT_ACCOUNT_DELETION_LABELS, 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_REGISTER_LABELS, DEFAULT_RESET_PASSWORD_LABELS, DEFAULT_VERIFY_EMAIL_LABELS, DEFAULT_VERIFY_NEW_PASSWORD_LABELS, DEFAULT_VERIFY_SIGN_IN_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, REGISTER_ENDPOINT, RESEND_VERIFICATION_ENDPOINT, RegisterErrorCode, type RegisterField, type RegisterFieldLabels, RegisterForm, type RegisterFormLabels, type RegisterFormProps, type RegisterFormValues, type RegisterInputField, type RegisterPasswordPolicy, type RegisterSubmitMeta, type RegisterSubmitOutcome, type RegisterSubmitValues, RegisterTestIds, ResetPasswordError, ResetPasswordForm, type ResetPasswordFormLabels, type ResetPasswordFormProps, type RoleRoute, type RoleRouteTable, STEP_UP_PASSWORD_ENDPOINT, SharedRegisterForm, type SharedRegisterFormProps, type SharedRegisterResult, type SharedRegistrationClient, type SplitName, type StepUpResult, StepUpStatus, type UseAccountDeletionArgs, type UseAccountDeletionResult, 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 UseRegisterFormArgs, type UseRegisterFormResult, type UseResendVerificationArgs, type UseResendVerificationResult, type UseResetPasswordFormArgs, type UseResetPasswordFormResult, type UseVerifyEmailArgs, type UseVerifyEmailResult, VERIFY_AND_LOGIN_ENDPOINT, VERIFY_EMAIL_ENDPOINT, VERIFY_TOKEN_PLACEHOLDER, type VerifyEmailCapableClient, VerifyEmailErrorCode, type VerifyEmailLabels, VerifyEmailPhase, type VerifyEmailResult, VerifyEmailScreen, type VerifyEmailScreenProps, type VerifySignInLabels, buildVerifyUrlTemplate, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAccountDeletionClient, createBffAuthClient, createBffChangePasswordClient, createBffVerifyEmailClient, createPreferencesClient, createSharedRegistrationClient, defaultAuthTheme, deriveUsernameFromEmail, isAllowedPinDigits, isPasswordValid, isRegisterAccepted, isRegisterPasswordStrong, isValidForgotPasswordEmail, performBffLogout, readCachedPreferredMethod, readPasskeyError, readPasskeyRegistered, readVerifyToken, resolveAccessibleRoutes, resolveAccountList, resolveDemoAccounts, resolveDemoCredentials, resolvePostLoginRoute, splitFullName, startPasskeyLogin, startPasskeyRegistration, syncPreferredMethodFromServer, useAccountDeletion, useAuthTheme, useBffAuth, useBffForgotPassword, useBffLoginConfig, useBffResetPassword, useChangePassword, useDemoCredentials, useDevicePinDisable, useDevicePinEnroll, useDevicePinUnlock, useForgotPasswordSubmit, useOtpLogin, usePasskeyCeremony, usePinLogin, usePreferredMethodSetting, useRegisterForm, useResendVerification, useResetPasswordForm, useVerifyEmail, validatePasswordPolicy, verifyEmailErrorText, withTestIdPrefix };