@dloizides/auth-web 1.18.0 → 1.18.1
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 +586 -573
- package/dist/index.d.mts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +53 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.d.mts
CHANGED
|
@@ -2460,7 +2460,7 @@ interface RegisterFormProps<TResult> {
|
|
|
2460
2460
|
onSuccess: (result: TResult) => void;
|
|
2461
2461
|
/** Called with the failure code; map it to localised copy. */
|
|
2462
2462
|
onError?: (error: RegisterErrorCode) => void;
|
|
2463
|
-
/** Called
|
|
2463
|
+
/** Called once per accepted submit, before validation (e.g. a "signup started" event); never for a press ignored in flight. */
|
|
2464
2464
|
onSubmitAttempt?: () => void;
|
|
2465
2465
|
/** Password rule. Defaults to `isRegisterPasswordStrong`. */
|
|
2466
2466
|
passwordPolicy?: RegisterPasswordPolicy;
|
|
@@ -2506,6 +2506,11 @@ interface UseRegisterFormArgs<TResult> {
|
|
|
2506
2506
|
onSubmit: (values: RegisterSubmitValues) => Promise<TResult>;
|
|
2507
2507
|
/** Password rule. Defaults to {@link isRegisterPasswordStrong}. */
|
|
2508
2508
|
passwordPolicy?: RegisterPasswordPolicy;
|
|
2509
|
+
/**
|
|
2510
|
+
* Called once per ACCEPTED submit, before validation (e.g. a "signup started"
|
|
2511
|
+
* event). A press ignored because a submit is already in flight does not call it.
|
|
2512
|
+
*/
|
|
2513
|
+
onSubmitAttempt?: () => void;
|
|
2509
2514
|
}
|
|
2510
2515
|
interface UseRegisterFormResult<TResult> {
|
|
2511
2516
|
state: RegisterFormValues;
|
|
@@ -2516,7 +2521,7 @@ interface UseRegisterFormResult<TResult> {
|
|
|
2516
2521
|
error: RegisterErrorCode | null;
|
|
2517
2522
|
}
|
|
2518
2523
|
/** Headless registration form logic. */
|
|
2519
|
-
declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
|
|
2524
|
+
declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAttempt, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
|
|
2520
2525
|
|
|
2521
2526
|
/**
|
|
2522
2527
|
* Pure registration helpers: trimming, client-side validation and decoding of a
|
|
@@ -2529,8 +2534,6 @@ declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, }: UseRegi
|
|
|
2529
2534
|
|
|
2530
2535
|
/** The default password rule: 8+ characters with a letter, a digit and a special character. */
|
|
2531
2536
|
declare function isRegisterPasswordStrong(password: string): boolean;
|
|
2532
|
-
/** Decode a thrown registration failure into a {@link RegisterErrorCode}. */
|
|
2533
|
-
declare function mapRegisterErrorCode(error: unknown): RegisterErrorCode;
|
|
2534
2537
|
|
|
2535
2538
|
/**
|
|
2536
2539
|
* `createBffAuthClient` — the one-line wiring of a same-origin `BffAuthClient`.
|
|
@@ -2821,4 +2824,4 @@ interface UseChangePasswordResult {
|
|
|
2821
2824
|
}
|
|
2822
2825
|
declare function useChangePassword({ client, onChanged, }: UseChangePasswordArgs): UseChangePasswordResult;
|
|
2823
2826
|
|
|
2824
|
-
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_REGISTER_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, 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 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 UseResetPasswordFormArgs, type UseResetPasswordFormResult, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createBffChangePasswordClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isRegisterPasswordStrong, isValidForgotPasswordEmail,
|
|
2827
|
+
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_REGISTER_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, 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 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 UseResetPasswordFormArgs, type UseResetPasswordFormResult, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createBffChangePasswordClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isRegisterPasswordStrong, 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, useRegisterForm, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
package/dist/index.d.ts
CHANGED
|
@@ -2460,7 +2460,7 @@ interface RegisterFormProps<TResult> {
|
|
|
2460
2460
|
onSuccess: (result: TResult) => void;
|
|
2461
2461
|
/** Called with the failure code; map it to localised copy. */
|
|
2462
2462
|
onError?: (error: RegisterErrorCode) => void;
|
|
2463
|
-
/** Called
|
|
2463
|
+
/** Called once per accepted submit, before validation (e.g. a "signup started" event); never for a press ignored in flight. */
|
|
2464
2464
|
onSubmitAttempt?: () => void;
|
|
2465
2465
|
/** Password rule. Defaults to `isRegisterPasswordStrong`. */
|
|
2466
2466
|
passwordPolicy?: RegisterPasswordPolicy;
|
|
@@ -2506,6 +2506,11 @@ interface UseRegisterFormArgs<TResult> {
|
|
|
2506
2506
|
onSubmit: (values: RegisterSubmitValues) => Promise<TResult>;
|
|
2507
2507
|
/** Password rule. Defaults to {@link isRegisterPasswordStrong}. */
|
|
2508
2508
|
passwordPolicy?: RegisterPasswordPolicy;
|
|
2509
|
+
/**
|
|
2510
|
+
* Called once per ACCEPTED submit, before validation (e.g. a "signup started"
|
|
2511
|
+
* event). A press ignored because a submit is already in flight does not call it.
|
|
2512
|
+
*/
|
|
2513
|
+
onSubmitAttempt?: () => void;
|
|
2509
2514
|
}
|
|
2510
2515
|
interface UseRegisterFormResult<TResult> {
|
|
2511
2516
|
state: RegisterFormValues;
|
|
@@ -2516,7 +2521,7 @@ interface UseRegisterFormResult<TResult> {
|
|
|
2516
2521
|
error: RegisterErrorCode | null;
|
|
2517
2522
|
}
|
|
2518
2523
|
/** Headless registration form logic. */
|
|
2519
|
-
declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
|
|
2524
|
+
declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAttempt, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
|
|
2520
2525
|
|
|
2521
2526
|
/**
|
|
2522
2527
|
* Pure registration helpers: trimming, client-side validation and decoding of a
|
|
@@ -2529,8 +2534,6 @@ declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, }: UseRegi
|
|
|
2529
2534
|
|
|
2530
2535
|
/** The default password rule: 8+ characters with a letter, a digit and a special character. */
|
|
2531
2536
|
declare function isRegisterPasswordStrong(password: string): boolean;
|
|
2532
|
-
/** Decode a thrown registration failure into a {@link RegisterErrorCode}. */
|
|
2533
|
-
declare function mapRegisterErrorCode(error: unknown): RegisterErrorCode;
|
|
2534
2537
|
|
|
2535
2538
|
/**
|
|
2536
2539
|
* `createBffAuthClient` — the one-line wiring of a same-origin `BffAuthClient`.
|
|
@@ -2821,4 +2824,4 @@ interface UseChangePasswordResult {
|
|
|
2821
2824
|
}
|
|
2822
2825
|
declare function useChangePassword({ client, onChanged, }: UseChangePasswordArgs): UseChangePasswordResult;
|
|
2823
2826
|
|
|
2824
|
-
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_REGISTER_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, 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 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 UseResetPasswordFormArgs, type UseResetPasswordFormResult, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createBffChangePasswordClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isRegisterPasswordStrong, isValidForgotPasswordEmail,
|
|
2827
|
+
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_REGISTER_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, 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 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 UseResetPasswordFormArgs, type UseResetPasswordFormResult, cachePreferredMethod, clearCachedPreferredMethod, collectUserRoles, createBffAuthClient, createBffChangePasswordClient, createPreferencesClient, defaultAuthTheme, isAllowedPinDigits, isPasswordValid, isRegisterPasswordStrong, 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, useRegisterForm, useResetPasswordForm, validatePasswordPolicy, withTestIdPrefix };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var reactNative = require('react-native');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var uiButtons = require('@dloizides/ui-buttons');
|
|
6
7
|
var reactQuery = require('@tanstack/react-query');
|
|
7
8
|
var authClient = require('@dloizides/auth-client');
|
|
8
9
|
|
|
@@ -775,7 +776,6 @@ function LoginForm({
|
|
|
775
776
|
missingFieldsLabel: labels.missingFields,
|
|
776
777
|
invalidCredentialsLabel: labels.invalidCredentials
|
|
777
778
|
});
|
|
778
|
-
const submitButtonStyle = isSubmitting ? [styles3.primaryButton, styles3.primaryButtonDisabled] : styles3.primaryButton;
|
|
779
779
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
780
780
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.title, children: labels.title }),
|
|
781
781
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.subtitle, children: labels.subtitle }),
|
|
@@ -839,19 +839,18 @@ function LoginForm({
|
|
|
839
839
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.linkText, children: labels.forgotPassword })
|
|
840
840
|
}
|
|
841
841
|
) : null,
|
|
842
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
-
|
|
842
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.fieldGroup, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
+
uiButtons.Button,
|
|
844
844
|
{
|
|
845
|
+
fullWidth: true,
|
|
845
846
|
accessibilityHint: labels.submit,
|
|
846
847
|
accessibilityLabel: isSubmitting ? labels.submitting : labels.submit,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
style: submitButtonStyle,
|
|
848
|
+
label: labels.submit,
|
|
849
|
+
loading: isSubmitting,
|
|
850
850
|
testID: withTestIdPrefix(AuthTestIds.loginSubmitButton, testIdPrefix),
|
|
851
|
-
onPress: handleSubmit
|
|
852
|
-
children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.onPrimary, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.primaryButtonText, children: labels.submit })
|
|
851
|
+
onPress: handleSubmit
|
|
853
852
|
}
|
|
854
|
-
),
|
|
853
|
+
) }),
|
|
855
854
|
onSignUp !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
856
855
|
reactNative.TouchableOpacity,
|
|
857
856
|
{
|
|
@@ -4127,6 +4126,7 @@ function RegisterFormFields({
|
|
|
4127
4126
|
reactNative.TextInput,
|
|
4128
4127
|
{
|
|
4129
4128
|
accessibilityElementsHidden: true,
|
|
4129
|
+
accessibilityRole: "none",
|
|
4130
4130
|
autoComplete: "off",
|
|
4131
4131
|
focusable: false,
|
|
4132
4132
|
importantForAccessibility: "no-hide-descendants",
|
|
@@ -4155,9 +4155,21 @@ var RegisterErrorCode = /* @__PURE__ */ ((RegisterErrorCode2) => {
|
|
|
4155
4155
|
return RegisterErrorCode2;
|
|
4156
4156
|
})(RegisterErrorCode || {});
|
|
4157
4157
|
|
|
4158
|
+
// src/hooks/routeRegisterOutcome.ts
|
|
4159
|
+
function routeRegisterOutcome(outcome, handlers) {
|
|
4160
|
+
if (outcome.ok) {
|
|
4161
|
+
handlers.onSuccess(outcome.result);
|
|
4162
|
+
return;
|
|
4163
|
+
}
|
|
4164
|
+
if (outcome.error !== "inFlight" /* InFlight */) {
|
|
4165
|
+
handlers.onError?.(outcome.error);
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
|
|
4158
4169
|
// src/hooks/registerErrors.ts
|
|
4159
4170
|
var MIN_PASSWORD_LENGTH = 8;
|
|
4160
|
-
var
|
|
4171
|
+
var WHITESPACE_REGEX = /\s/;
|
|
4172
|
+
var EMAIL_PART_COUNT = 2;
|
|
4161
4173
|
var PASSWORD_LETTER_REGEX = /[a-zA-Z]/;
|
|
4162
4174
|
var PASSWORD_DIGIT_REGEX = /\d/;
|
|
4163
4175
|
var PASSWORD_SPECIAL_REGEX = /[^a-zA-Z0-9]/;
|
|
@@ -4179,6 +4191,17 @@ function isRegisterPasswordStrong(password) {
|
|
|
4179
4191
|
}
|
|
4180
4192
|
return PASSWORD_SPECIAL_REGEX.test(password);
|
|
4181
4193
|
}
|
|
4194
|
+
function isEmailShaped(email) {
|
|
4195
|
+
if (WHITESPACE_REGEX.test(email)) {
|
|
4196
|
+
return false;
|
|
4197
|
+
}
|
|
4198
|
+
const parts = email.split("@");
|
|
4199
|
+
if (parts.length !== EMAIL_PART_COUNT) {
|
|
4200
|
+
return false;
|
|
4201
|
+
}
|
|
4202
|
+
const [local = "", domain = ""] = parts;
|
|
4203
|
+
return local !== "" && domain.slice(1, -1).includes(".");
|
|
4204
|
+
}
|
|
4182
4205
|
function trimRegisterValues(values) {
|
|
4183
4206
|
return {
|
|
4184
4207
|
firstName: values.firstName.trim(),
|
|
@@ -4206,7 +4229,7 @@ function validateRegisterValues(values, passwordPolicy) {
|
|
|
4206
4229
|
if (hasMissingRequiredField(values)) {
|
|
4207
4230
|
return "missingFields" /* MissingFields */;
|
|
4208
4231
|
}
|
|
4209
|
-
if (!
|
|
4232
|
+
if (!isEmailShaped(values.email)) {
|
|
4210
4233
|
return "invalidEmail" /* InvalidEmail */;
|
|
4211
4234
|
}
|
|
4212
4235
|
if (!passwordPolicy(values.password)) {
|
|
@@ -4256,7 +4279,8 @@ function toSubmitValues(values) {
|
|
|
4256
4279
|
}
|
|
4257
4280
|
function useRegisterForm({
|
|
4258
4281
|
onSubmit,
|
|
4259
|
-
passwordPolicy = isRegisterPasswordStrong
|
|
4282
|
+
passwordPolicy = isRegisterPasswordStrong,
|
|
4283
|
+
onSubmitAttempt
|
|
4260
4284
|
}) {
|
|
4261
4285
|
const [state, setState] = react.useState(EMPTY_VALUES);
|
|
4262
4286
|
const [isSubmitting, setIsSubmitting] = react.useState(false);
|
|
@@ -4269,6 +4293,7 @@ function useRegisterForm({
|
|
|
4269
4293
|
if (inFlight.current) {
|
|
4270
4294
|
return { ok: false, error: "inFlight" /* InFlight */ };
|
|
4271
4295
|
}
|
|
4296
|
+
onSubmitAttempt?.();
|
|
4272
4297
|
const trimmed = trimRegisterValues(state);
|
|
4273
4298
|
const refusal = trimmed.website === "" ? validateRegisterValues(trimmed, passwordPolicy) : "failed" /* Failed */;
|
|
4274
4299
|
if (refusal !== null) {
|
|
@@ -4289,7 +4314,7 @@ function useRegisterForm({
|
|
|
4289
4314
|
inFlight.current = false;
|
|
4290
4315
|
setIsSubmitting(false);
|
|
4291
4316
|
}
|
|
4292
|
-
}, [onSubmit, passwordPolicy, state]);
|
|
4317
|
+
}, [onSubmit, onSubmitAttempt, passwordPolicy, state]);
|
|
4293
4318
|
return { state, setField, submit, isSubmitting, error };
|
|
4294
4319
|
}
|
|
4295
4320
|
function RegisterForm({
|
|
@@ -4309,18 +4334,14 @@ function RegisterForm({
|
|
|
4309
4334
|
() => ({ ...DEFAULT_REGISTER_LABELS, ...labelsProp }),
|
|
4310
4335
|
[labelsProp]
|
|
4311
4336
|
);
|
|
4312
|
-
const { state, setField, submit, isSubmitting } = useRegisterForm({
|
|
4313
|
-
|
|
4314
|
-
onSubmitAttempt
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
}
|
|
4321
|
-
});
|
|
4322
|
-
}, [onError, onSubmitAttempt, onSuccess, submit]);
|
|
4323
|
-
const buttonStyle = isSubmitting ? [styles3.primaryButton, styles3.primaryButtonDisabled] : styles3.primaryButton;
|
|
4337
|
+
const { state, setField, submit, isSubmitting } = useRegisterForm({
|
|
4338
|
+
onSubmit,
|
|
4339
|
+
onSubmitAttempt,
|
|
4340
|
+
passwordPolicy
|
|
4341
|
+
});
|
|
4342
|
+
const handlePress = react.useCallback(async () => {
|
|
4343
|
+
routeRegisterOutcome(await submit(), { onSuccess, onError });
|
|
4344
|
+
}, [onError, onSuccess, submit]);
|
|
4324
4345
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.screen, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.card, testID: withTestIdPrefix(RegisterTestIds.form, testIdPrefix), children: [
|
|
4325
4346
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.title, children: labels.title }),
|
|
4326
4347
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.subtitle, children: labels.subtitle }),
|
|
@@ -4336,19 +4357,18 @@ function RegisterForm({
|
|
|
4336
4357
|
onChange: setField
|
|
4337
4358
|
}
|
|
4338
4359
|
),
|
|
4339
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4340
|
-
|
|
4360
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.fieldGroup, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4361
|
+
uiButtons.Button,
|
|
4341
4362
|
{
|
|
4363
|
+
fullWidth: true,
|
|
4342
4364
|
accessibilityHint: labels.submitHint,
|
|
4343
4365
|
accessibilityLabel: isSubmitting ? labels.submitting : labels.submit,
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
style: buttonStyle,
|
|
4366
|
+
label: labels.submit,
|
|
4367
|
+
loading: isSubmitting,
|
|
4347
4368
|
testID: withTestIdPrefix(RegisterTestIds.submitButton, testIdPrefix),
|
|
4348
|
-
onPress: handlePress
|
|
4349
|
-
children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: theme.colors.onPrimary, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.primaryButtonText, children: labels.submit })
|
|
4369
|
+
onPress: handlePress
|
|
4350
4370
|
}
|
|
4351
|
-
),
|
|
4371
|
+
) }),
|
|
4352
4372
|
footer
|
|
4353
4373
|
] }) });
|
|
4354
4374
|
}
|
|
@@ -4565,7 +4585,6 @@ exports.isAllowedPinDigits = isAllowedPinDigits;
|
|
|
4565
4585
|
exports.isPasswordValid = isPasswordValid;
|
|
4566
4586
|
exports.isRegisterPasswordStrong = isRegisterPasswordStrong;
|
|
4567
4587
|
exports.isValidForgotPasswordEmail = isValidForgotPasswordEmail;
|
|
4568
|
-
exports.mapRegisterErrorCode = mapRegisterErrorCode;
|
|
4569
4588
|
exports.performBffLogout = performBffLogout;
|
|
4570
4589
|
exports.readCachedPreferredMethod = readCachedPreferredMethod;
|
|
4571
4590
|
exports.readPasskeyError = readPasskeyError;
|