@dloizides/auth-web 1.24.0 → 1.25.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 +13 -0
- package/dist/index.d.mts +8 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.js +70 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.25.1
|
|
4
|
+
|
|
5
|
+
**Deletion date as yyyy-MM-dd (BEAD-1 "Bead pattern app" step 15).** `<AccountDeletionForm>` shows the scheduled deletion
|
|
6
|
+
date as the UTC calendar day in `yyyy-MM-dd`, matching the server pages, instead of the viewer's locale and timezone.
|
|
7
|
+
|
|
8
|
+
## 1.25.0
|
|
9
|
+
|
|
10
|
+
**Opt-in hidden tenant name (BEAD-1 "Bead pattern app", D-RUN-33 "Jinx sign-up drops the Workspace name box").**
|
|
11
|
+
`<RegisterForm>`, `<SharedRegisterForm>` and `useRegisterForm` gain `deriveTenantName?: () => string`: the box is not
|
|
12
|
+
rendered, not required, and the value comes from the function, once per attempt (a retry under one idempotency key
|
|
13
|
+
resends it; `TENANT_NAME_TAKEN` or an edit draws a new one). `createOpaqueTenantName` is a ready source. Unset, nothing
|
|
14
|
+
changes.
|
|
15
|
+
|
|
3
16
|
## 1.24.0
|
|
4
17
|
|
|
5
18
|
**Account deletion request (BEAD-1 "Bead pattern app", D-RUN-3 "How a signed-in user starts account deletion").**
|
package/dist/index.d.mts
CHANGED
|
@@ -2597,6 +2597,8 @@ interface RegisterFormProps<TResult> {
|
|
|
2597
2597
|
* the username is derived from the email, and there is no confirm-password field.
|
|
2598
2598
|
*/
|
|
2599
2599
|
compact?: boolean;
|
|
2600
|
+
/** Hides the tenant name box; this supplies a unique name instead, e.g. `createOpaqueTenantName`. */
|
|
2601
|
+
deriveTenantName?: () => string;
|
|
2600
2602
|
}
|
|
2601
2603
|
/** Themeable registration form built on `useRegisterForm`. */
|
|
2602
2604
|
declare function RegisterForm<TResult>(props: Readonly<RegisterFormProps<TResult>>): ReactElement;
|
|
@@ -2644,6 +2646,8 @@ interface UseRegisterFormArgs<TResult> {
|
|
|
2644
2646
|
compact?: boolean;
|
|
2645
2647
|
/** Opt-in shared registration: `onSubmit` also gets the key and form time; an accepted result clears the passwords. */
|
|
2646
2648
|
sharedRegistration?: boolean;
|
|
2649
|
+
/** Supplies a unique tenant name so none is typed or required. It gets no arguments, so it cannot embed the email. */
|
|
2650
|
+
deriveTenantName?: () => string;
|
|
2647
2651
|
}
|
|
2648
2652
|
interface UseRegisterFormResult<TResult> {
|
|
2649
2653
|
state: RegisterFormValues;
|
|
@@ -2654,7 +2658,7 @@ interface UseRegisterFormResult<TResult> {
|
|
|
2654
2658
|
error: RegisterErrorCode | null;
|
|
2655
2659
|
}
|
|
2656
2660
|
/** Headless registration form logic. */
|
|
2657
|
-
declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAttempt, compact, sharedRegistration, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
|
|
2661
|
+
declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAttempt, compact, sharedRegistration, deriveTenantName, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
|
|
2658
2662
|
|
|
2659
2663
|
/**
|
|
2660
2664
|
* Pure registration helpers: trimming, client-side validation and decoding of a
|
|
@@ -2668,14 +2672,6 @@ declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAt
|
|
|
2668
2672
|
/** The default password rule: 8+ characters with a letter, a digit and a special character. */
|
|
2669
2673
|
declare function isRegisterPasswordStrong(password: string): boolean;
|
|
2670
2674
|
|
|
2671
|
-
/**
|
|
2672
|
-
* Compact registration (AUTH-REG-1 "Compact register form"): the form shows only
|
|
2673
|
-
* "Your name", Email, Password (+ tenant name). Keycloak still needs a username,
|
|
2674
|
-
* a first name AND a last name, so they are derived here before validation.
|
|
2675
|
-
*
|
|
2676
|
-
* In compact mode the single "Your name" input is stored in `firstName`.
|
|
2677
|
-
*/
|
|
2678
|
-
|
|
2679
2675
|
interface SplitName {
|
|
2680
2676
|
firstName: string;
|
|
2681
2677
|
lastName: string;
|
|
@@ -2691,6 +2687,8 @@ declare function splitFullName(fullName: string): SplitName;
|
|
|
2691
2687
|
* `[a-z0-9._-]` replaced by `_`. `Ada+shop@Example.com` becomes `ada_shop_example.com`.
|
|
2692
2688
|
*/
|
|
2693
2689
|
declare function deriveUsernameFromEmail(email: string): string;
|
|
2690
|
+
/** A random tenant name for a form with no tenant box; it reveals nothing about the user and is its own slug. */
|
|
2691
|
+
declare function createOpaqueTenantName(): string;
|
|
2694
2692
|
|
|
2695
2693
|
/**
|
|
2696
2694
|
* `createBffAuthClient` — the one-line wiring of a same-origin `BffAuthClient`.
|
|
@@ -3220,4 +3218,4 @@ declare const AccountDeletionTestIds: {
|
|
|
3220
3218
|
readonly alreadyRequested: "account-deletion-already-requested";
|
|
3221
3219
|
};
|
|
3222
3220
|
|
|
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 };
|
|
3221
|
+
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, createOpaqueTenantName, 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
|
@@ -2597,6 +2597,8 @@ interface RegisterFormProps<TResult> {
|
|
|
2597
2597
|
* the username is derived from the email, and there is no confirm-password field.
|
|
2598
2598
|
*/
|
|
2599
2599
|
compact?: boolean;
|
|
2600
|
+
/** Hides the tenant name box; this supplies a unique name instead, e.g. `createOpaqueTenantName`. */
|
|
2601
|
+
deriveTenantName?: () => string;
|
|
2600
2602
|
}
|
|
2601
2603
|
/** Themeable registration form built on `useRegisterForm`. */
|
|
2602
2604
|
declare function RegisterForm<TResult>(props: Readonly<RegisterFormProps<TResult>>): ReactElement;
|
|
@@ -2644,6 +2646,8 @@ interface UseRegisterFormArgs<TResult> {
|
|
|
2644
2646
|
compact?: boolean;
|
|
2645
2647
|
/** Opt-in shared registration: `onSubmit` also gets the key and form time; an accepted result clears the passwords. */
|
|
2646
2648
|
sharedRegistration?: boolean;
|
|
2649
|
+
/** Supplies a unique tenant name so none is typed or required. It gets no arguments, so it cannot embed the email. */
|
|
2650
|
+
deriveTenantName?: () => string;
|
|
2647
2651
|
}
|
|
2648
2652
|
interface UseRegisterFormResult<TResult> {
|
|
2649
2653
|
state: RegisterFormValues;
|
|
@@ -2654,7 +2658,7 @@ interface UseRegisterFormResult<TResult> {
|
|
|
2654
2658
|
error: RegisterErrorCode | null;
|
|
2655
2659
|
}
|
|
2656
2660
|
/** Headless registration form logic. */
|
|
2657
|
-
declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAttempt, compact, sharedRegistration, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
|
|
2661
|
+
declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAttempt, compact, sharedRegistration, deriveTenantName, }: UseRegisterFormArgs<TResult>): UseRegisterFormResult<TResult>;
|
|
2658
2662
|
|
|
2659
2663
|
/**
|
|
2660
2664
|
* Pure registration helpers: trimming, client-side validation and decoding of a
|
|
@@ -2668,14 +2672,6 @@ declare function useRegisterForm<TResult>({ onSubmit, passwordPolicy, onSubmitAt
|
|
|
2668
2672
|
/** The default password rule: 8+ characters with a letter, a digit and a special character. */
|
|
2669
2673
|
declare function isRegisterPasswordStrong(password: string): boolean;
|
|
2670
2674
|
|
|
2671
|
-
/**
|
|
2672
|
-
* Compact registration (AUTH-REG-1 "Compact register form"): the form shows only
|
|
2673
|
-
* "Your name", Email, Password (+ tenant name). Keycloak still needs a username,
|
|
2674
|
-
* a first name AND a last name, so they are derived here before validation.
|
|
2675
|
-
*
|
|
2676
|
-
* In compact mode the single "Your name" input is stored in `firstName`.
|
|
2677
|
-
*/
|
|
2678
|
-
|
|
2679
2675
|
interface SplitName {
|
|
2680
2676
|
firstName: string;
|
|
2681
2677
|
lastName: string;
|
|
@@ -2691,6 +2687,8 @@ declare function splitFullName(fullName: string): SplitName;
|
|
|
2691
2687
|
* `[a-z0-9._-]` replaced by `_`. `Ada+shop@Example.com` becomes `ada_shop_example.com`.
|
|
2692
2688
|
*/
|
|
2693
2689
|
declare function deriveUsernameFromEmail(email: string): string;
|
|
2690
|
+
/** A random tenant name for a form with no tenant box; it reveals nothing about the user and is its own slug. */
|
|
2691
|
+
declare function createOpaqueTenantName(): string;
|
|
2694
2692
|
|
|
2695
2693
|
/**
|
|
2696
2694
|
* `createBffAuthClient` — the one-line wiring of a same-origin `BffAuthClient`.
|
|
@@ -3220,4 +3218,4 @@ declare const AccountDeletionTestIds: {
|
|
|
3220
3218
|
readonly alreadyRequested: "account-deletion-already-requested";
|
|
3221
3219
|
};
|
|
3222
3220
|
|
|
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 };
|
|
3221
|
+
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, createOpaqueTenantName, 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.js
CHANGED
|
@@ -4278,10 +4278,12 @@ function RegisterFormFields({
|
|
|
4278
4278
|
onChange,
|
|
4279
4279
|
onSubmitEditing,
|
|
4280
4280
|
testIdPrefix,
|
|
4281
|
-
compact = false
|
|
4281
|
+
compact = false,
|
|
4282
|
+
hideTenantName = false
|
|
4282
4283
|
}) {
|
|
4284
|
+
const fields = compact ? COMPACT_FIELDS : FIELDS;
|
|
4283
4285
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4284
|
-
(
|
|
4286
|
+
fields.filter((config) => !(hideTenantName && config.key === "tenantName")).map((config) => {
|
|
4285
4287
|
const copy = copyFor(config.key, labels, compact);
|
|
4286
4288
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.fieldGroup, children: [
|
|
4287
4289
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.label, children: copy.label }),
|
|
@@ -4411,19 +4413,19 @@ function trimRegisterValues(values) {
|
|
|
4411
4413
|
website: values.website.trim()
|
|
4412
4414
|
};
|
|
4413
4415
|
}
|
|
4414
|
-
function hasMissingRequiredField(values) {
|
|
4416
|
+
function hasMissingRequiredField(values, tenantNameHidden) {
|
|
4415
4417
|
const required = [
|
|
4416
4418
|
values.firstName,
|
|
4417
4419
|
values.lastName,
|
|
4418
4420
|
values.username,
|
|
4419
4421
|
values.email,
|
|
4420
4422
|
values.password,
|
|
4421
|
-
values.tenantName
|
|
4423
|
+
...tenantNameHidden ? [] : [values.tenantName]
|
|
4422
4424
|
];
|
|
4423
4425
|
return required.some((value) => value === "");
|
|
4424
4426
|
}
|
|
4425
|
-
function validateRegisterValues(values, passwordPolicy) {
|
|
4426
|
-
if (hasMissingRequiredField(values)) {
|
|
4427
|
+
function validateRegisterValues(values, passwordPolicy, tenantNameHidden = false) {
|
|
4428
|
+
if (hasMissingRequiredField(values, tenantNameHidden)) {
|
|
4427
4429
|
return "missingFields" /* MissingFields */;
|
|
4428
4430
|
}
|
|
4429
4431
|
if (!isEmailShaped(values.email)) {
|
|
@@ -4492,6 +4494,24 @@ function mapRegisterErrorCode(error) {
|
|
|
4492
4494
|
return match === void 0 ? "validationFailed" /* ValidationFailed */ : match[1];
|
|
4493
4495
|
}
|
|
4494
4496
|
|
|
4497
|
+
// src/hooks/newIdempotencyKey.ts
|
|
4498
|
+
var HEX_RADIX = 16;
|
|
4499
|
+
var HEX_BYTE_LENGTH = 2;
|
|
4500
|
+
var KEY_BYTES = 16;
|
|
4501
|
+
var fallbackSequence = 0;
|
|
4502
|
+
function newIdempotencyKey() {
|
|
4503
|
+
const cryptoApi = globalThis.crypto;
|
|
4504
|
+
if (typeof cryptoApi?.randomUUID === "function") {
|
|
4505
|
+
return cryptoApi.randomUUID();
|
|
4506
|
+
}
|
|
4507
|
+
if (typeof cryptoApi?.getRandomValues === "function") {
|
|
4508
|
+
const bytes = cryptoApi.getRandomValues(new Uint8Array(KEY_BYTES));
|
|
4509
|
+
return Array.from(bytes, (byte) => byte.toString(HEX_RADIX).padStart(HEX_BYTE_LENGTH, "0")).join("");
|
|
4510
|
+
}
|
|
4511
|
+
fallbackSequence += 1;
|
|
4512
|
+
return `${Date.now().toString(HEX_RADIX)}-${String(fallbackSequence)}`;
|
|
4513
|
+
}
|
|
4514
|
+
|
|
4495
4515
|
// src/hooks/registerCompact.ts
|
|
4496
4516
|
var WHITESPACE_RUN = /\s+/;
|
|
4497
4517
|
var UNSAFE_USERNAME_CHARS = /[^a-z0-9._-]/g;
|
|
@@ -4514,26 +4534,26 @@ function expandCompactRegisterValues(values) {
|
|
|
4514
4534
|
confirmPassword: values.password
|
|
4515
4535
|
};
|
|
4516
4536
|
}
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4537
|
+
function createOpaqueTenantName() {
|
|
4538
|
+
return `workspace-${newIdempotencyKey()}`;
|
|
4539
|
+
}
|
|
4540
|
+
function useDerivedTenantName(derive) {
|
|
4541
|
+
const deriveRef = react.useRef(derive);
|
|
4542
|
+
deriveRef.current = derive;
|
|
4543
|
+
const name = react.useRef(null);
|
|
4544
|
+
return react.useMemo(
|
|
4545
|
+
() => ({
|
|
4546
|
+
current: () => {
|
|
4547
|
+
name.current ?? (name.current = deriveRef.current?.() ?? "");
|
|
4548
|
+
return name.current;
|
|
4549
|
+
},
|
|
4550
|
+
reset: () => {
|
|
4551
|
+
name.current = null;
|
|
4552
|
+
}
|
|
4553
|
+
}),
|
|
4554
|
+
[]
|
|
4555
|
+
);
|
|
4534
4556
|
}
|
|
4535
|
-
|
|
4536
|
-
// src/hooks/useRegisterSubmitMeta.ts
|
|
4537
4557
|
function useRegisterSubmitMeta() {
|
|
4538
4558
|
const openedAt = react.useRef(Date.now());
|
|
4539
4559
|
const key = react.useRef(null);
|
|
@@ -4581,17 +4601,21 @@ function useRegisterForm({
|
|
|
4581
4601
|
passwordPolicy = isRegisterPasswordStrong,
|
|
4582
4602
|
onSubmitAttempt,
|
|
4583
4603
|
compact = false,
|
|
4584
|
-
sharedRegistration = false
|
|
4604
|
+
sharedRegistration = false,
|
|
4605
|
+
deriveTenantName
|
|
4585
4606
|
}) {
|
|
4586
4607
|
const [state, setState] = react.useState(EMPTY_VALUES);
|
|
4587
4608
|
const [isSubmitting, setIsSubmitting] = react.useState(false);
|
|
4588
4609
|
const [error, setError] = react.useState(null);
|
|
4589
4610
|
const inFlight = react.useRef(false);
|
|
4590
4611
|
const submitMeta = useRegisterSubmitMeta();
|
|
4612
|
+
const derivedName = useDerivedTenantName(deriveTenantName);
|
|
4613
|
+
const tenantNameHidden = deriveTenantName !== void 0;
|
|
4591
4614
|
const setField = react.useCallback((field2, value) => {
|
|
4592
4615
|
submitMeta.resetKey();
|
|
4616
|
+
derivedName.reset();
|
|
4593
4617
|
setState((prev) => ({ ...prev, [field2]: value }));
|
|
4594
|
-
}, [submitMeta]);
|
|
4618
|
+
}, [derivedName, submitMeta]);
|
|
4595
4619
|
const submit = react.useCallback(async () => {
|
|
4596
4620
|
if (inFlight.current) {
|
|
4597
4621
|
return { ok: false, error: "inFlight" /* InFlight */ };
|
|
@@ -4599,7 +4623,7 @@ function useRegisterForm({
|
|
|
4599
4623
|
onSubmitAttempt?.();
|
|
4600
4624
|
const trimmedRaw = trimRegisterValues(state);
|
|
4601
4625
|
const trimmed = compact ? expandCompactRegisterValues(trimmedRaw) : trimmedRaw;
|
|
4602
|
-
const refusal = trimmed.website === "" ? validateRegisterValues(trimmed, passwordPolicy) : "failed" /* Failed */;
|
|
4626
|
+
const refusal = trimmed.website === "" ? validateRegisterValues(trimmed, passwordPolicy, tenantNameHidden) : "failed" /* Failed */;
|
|
4603
4627
|
if (refusal !== null) {
|
|
4604
4628
|
setError(refusal);
|
|
4605
4629
|
return { ok: false, error: refusal };
|
|
@@ -4608,7 +4632,7 @@ function useRegisterForm({
|
|
|
4608
4632
|
setError(null);
|
|
4609
4633
|
setIsSubmitting(true);
|
|
4610
4634
|
try {
|
|
4611
|
-
const values = toSubmitValues(trimmed);
|
|
4635
|
+
const values = toSubmitValues(tenantNameHidden ? { ...trimmed, tenantName: derivedName.current() } : trimmed);
|
|
4612
4636
|
const result = await (sharedRegistration ? onSubmit(values, submitMeta.next()) : onSubmit(values));
|
|
4613
4637
|
if (sharedRegistration && isRegisterAccepted(result)) {
|
|
4614
4638
|
setState(withoutPasswords);
|
|
@@ -4617,12 +4641,16 @@ function useRegisterForm({
|
|
|
4617
4641
|
} catch (caught) {
|
|
4618
4642
|
const code = mapRegisterErrorCode(caught);
|
|
4619
4643
|
setError(code);
|
|
4644
|
+
if (tenantNameHidden && code === "tenantNameTaken" /* TenantNameTaken */) {
|
|
4645
|
+
derivedName.reset();
|
|
4646
|
+
submitMeta.resetKey();
|
|
4647
|
+
}
|
|
4620
4648
|
return { ok: false, error: code };
|
|
4621
4649
|
} finally {
|
|
4622
4650
|
inFlight.current = false;
|
|
4623
4651
|
setIsSubmitting(false);
|
|
4624
4652
|
}
|
|
4625
|
-
}, [compact, onSubmit, onSubmitAttempt, passwordPolicy, sharedRegistration, state, submitMeta]);
|
|
4653
|
+
}, [compact, derivedName, onSubmit, onSubmitAttempt, passwordPolicy, sharedRegistration, state, submitMeta, tenantNameHidden]);
|
|
4626
4654
|
return { state, setField, submit, isSubmitting, error };
|
|
4627
4655
|
}
|
|
4628
4656
|
function RegisterFormCore({
|
|
@@ -4636,6 +4664,7 @@ function RegisterFormCore({
|
|
|
4636
4664
|
footer,
|
|
4637
4665
|
testIdPrefix,
|
|
4638
4666
|
compact = false,
|
|
4667
|
+
deriveTenantName,
|
|
4639
4668
|
sharedRegistration
|
|
4640
4669
|
}) {
|
|
4641
4670
|
const theme = useAuthTheme(themeProp);
|
|
@@ -4649,7 +4678,8 @@ function RegisterFormCore({
|
|
|
4649
4678
|
onSubmitAttempt,
|
|
4650
4679
|
passwordPolicy,
|
|
4651
4680
|
compact,
|
|
4652
|
-
sharedRegistration
|
|
4681
|
+
sharedRegistration,
|
|
4682
|
+
deriveTenantName
|
|
4653
4683
|
});
|
|
4654
4684
|
const handlePress = react.useCallback(async () => {
|
|
4655
4685
|
routeRegisterOutcome(await submit(), { onSuccess, onError });
|
|
@@ -4663,6 +4693,7 @@ function RegisterFormCore({
|
|
|
4663
4693
|
{
|
|
4664
4694
|
compact,
|
|
4665
4695
|
disabled: isSubmitting,
|
|
4696
|
+
hideTenantName: deriveTenantName !== void 0,
|
|
4666
4697
|
labels,
|
|
4667
4698
|
styles: styles3,
|
|
4668
4699
|
testIdPrefix,
|
|
@@ -5798,6 +5829,13 @@ var AccountDeletionTestIds = {
|
|
|
5798
5829
|
emailNotSent: "account-deletion-email-not-sent",
|
|
5799
5830
|
alreadyRequested: "account-deletion-already-requested"
|
|
5800
5831
|
};
|
|
5832
|
+
|
|
5833
|
+
// src/components/scheduledDetail.ts
|
|
5834
|
+
var ISO_CALENDAR_DATE_LENGTH = 10;
|
|
5835
|
+
function scheduledDetail(receipt, labels) {
|
|
5836
|
+
const date = new Date(receipt?.scheduledDeletionDate ?? "");
|
|
5837
|
+
return Number.isNaN(date.getTime()) ? null : interpolate(labels.scheduledDate, { date: date.toISOString().slice(0, ISO_CALENDAR_DATE_LENGTH) });
|
|
5838
|
+
}
|
|
5801
5839
|
function errorText(errorKey, seconds, labels) {
|
|
5802
5840
|
switch (errorKey) {
|
|
5803
5841
|
case null:
|
|
@@ -5816,10 +5854,6 @@ function errorText(errorKey, seconds, labels) {
|
|
|
5816
5854
|
return labels.errorFailed;
|
|
5817
5855
|
}
|
|
5818
5856
|
}
|
|
5819
|
-
function scheduledDetail(receipt, labels) {
|
|
5820
|
-
const date = new Date(receipt?.scheduledDeletionDate ?? "");
|
|
5821
|
-
return Number.isNaN(date.getTime()) ? null : interpolate(labels.scheduledDate, { date: date.toLocaleDateString() });
|
|
5822
|
-
}
|
|
5823
5857
|
function noticeCopy(phase, receipt, labels) {
|
|
5824
5858
|
if (phase === "alreadyRequested" /* AlreadyRequested */) {
|
|
5825
5859
|
return {
|
|
@@ -6002,6 +6036,7 @@ exports.createBffAccountDeletionClient = createBffAccountDeletionClient;
|
|
|
6002
6036
|
exports.createBffAuthClient = createBffAuthClient;
|
|
6003
6037
|
exports.createBffChangePasswordClient = createBffChangePasswordClient;
|
|
6004
6038
|
exports.createBffVerifyEmailClient = createBffVerifyEmailClient;
|
|
6039
|
+
exports.createOpaqueTenantName = createOpaqueTenantName;
|
|
6005
6040
|
exports.createPreferencesClient = createPreferencesClient;
|
|
6006
6041
|
exports.createSharedRegistrationClient = createSharedRegistrationClient;
|
|
6007
6042
|
exports.defaultAuthTheme = defaultAuthTheme;
|