@dloizides/auth-web 1.23.0 → 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/CHANGELOG.md +7 -0
- package/dist/index.d.mts +152 -1
- package/dist/index.d.ts +152 -1
- package/dist/index.js +503 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +493 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.24.0
|
|
4
|
+
|
|
5
|
+
**Account deletion request (BEAD-1 "Bead pattern app", D-RUN-3 "How a signed-in user starts account deletion").**
|
|
6
|
+
`createBffAccountDeletionClient` talks to `POST /bff/account/delete-request` and `POST /bff/step-up/password`;
|
|
7
|
+
`useAccountDeletion` and `<AccountDeletionForm>` run the flow: optional reason, password step-up on a stale login
|
|
8
|
+
followed by one retry, then check your email. A 429 blocks the button for its `Retry-After`. Purely additive.
|
|
9
|
+
|
|
3
10
|
## 1.23.0
|
|
4
11
|
|
|
5
12
|
**Opt-in shared registration (REGISTER-2 "One shared registration path").** `createSharedRegistrationClient` talks to
|
package/dist/index.d.mts
CHANGED
|
@@ -658,6 +658,42 @@ declare const DEFAULT_VERIFY_NEW_PASSWORD_LABELS: ResetPasswordFormLabels;
|
|
|
658
658
|
declare const DEFAULT_VERIFY_SIGN_IN_LABELS: VerifySignInLabels;
|
|
659
659
|
declare const DEFAULT_VERIFY_EMAIL_LABELS: VerifyEmailLabels;
|
|
660
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
|
+
|
|
661
697
|
/**
|
|
662
698
|
* Who asked for a prefill — the difference between "the user requested this" and
|
|
663
699
|
* "the app offered it".
|
|
@@ -3069,4 +3105,119 @@ interface SharedRegisterFormProps<TResult> extends RegisterFormProps<TResult> {
|
|
|
3069
3105
|
/** `<RegisterForm>` for the shared path: `onSubmit` also gets `meta`, and a 202 shows "check your email". */
|
|
3070
3106
|
declare function SharedRegisterForm<TResult>({ onSuccess, onAccepted, ...formProps }: Readonly<SharedRegisterFormProps<TResult>>): ReactElement;
|
|
3071
3107
|
|
|
3072
|
-
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -658,6 +658,42 @@ declare const DEFAULT_VERIFY_NEW_PASSWORD_LABELS: ResetPasswordFormLabels;
|
|
|
658
658
|
declare const DEFAULT_VERIFY_SIGN_IN_LABELS: VerifySignInLabels;
|
|
659
659
|
declare const DEFAULT_VERIFY_EMAIL_LABELS: VerifyEmailLabels;
|
|
660
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
|
+
|
|
661
697
|
/**
|
|
662
698
|
* Who asked for a prefill — the difference between "the user requested this" and
|
|
663
699
|
* "the app offered it".
|
|
@@ -3069,4 +3105,119 @@ interface SharedRegisterFormProps<TResult> extends RegisterFormProps<TResult> {
|
|
|
3069
3105
|
/** `<RegisterForm>` for the shared path: `onSubmit` also gets `meta`, and a 202 shows "check your email". */
|
|
3070
3106
|
declare function SharedRegisterForm<TResult>({ onSuccess, onAccepted, ...formProps }: Readonly<SharedRegisterFormProps<TResult>>): ReactElement;
|
|
3071
3107
|
|
|
3072
|
-
|
|
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 };
|