hazo_auth 6.0.0 → 7.0.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/README.md +233 -8
- package/SETUP_CHECKLIST.md +240 -0
- package/cli-src/cli/validate.ts +4 -0
- package/cli-src/lib/auth/nextauth_config.ts +101 -1
- package/cli-src/lib/cookies_config.server.ts +1 -0
- package/cli-src/lib/email_verification_config.server.ts +0 -34
- package/cli-src/lib/forgot_password_config.server.ts +0 -34
- package/cli-src/lib/login_config.server.ts +14 -31
- package/cli-src/lib/my_settings_config.server.ts +0 -3
- package/cli-src/lib/oauth_config.server.ts +58 -0
- package/cli-src/lib/otp_config.server.ts +91 -0
- package/cli-src/lib/register_config.server.ts +11 -31
- package/cli-src/lib/reset_password_config.server.ts +0 -31
- package/cli-src/lib/services/email_service.ts +3 -1
- package/cli-src/lib/services/email_template_manifest.ts +17 -0
- package/cli-src/lib/services/email_templates/otp_signin_code.html +13 -0
- package/cli-src/lib/services/email_templates/otp_signin_code.txt +5 -0
- package/cli-src/lib/services/index.ts +8 -2
- package/cli-src/lib/services/oauth_service.ts +197 -0
- package/cli-src/lib/services/otp_service.ts +295 -0
- package/cli-src/lib/services/session_token_service.ts +4 -1
- package/config/hazo_auth_config.example.ini +76 -41
- package/dist/cli/validate.d.ts.map +1 -1
- package/dist/cli/validate.js +4 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/components/layouts/create_firm/index.d.ts +4 -8
- package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
- package/dist/components/layouts/create_firm/index.js +3 -3
- package/dist/components/layouts/email_verification/index.d.ts +4 -5
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/index.js +4 -4
- package/dist/components/layouts/forgot_password/index.d.ts +4 -5
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/index.js +2 -2
- package/dist/components/layouts/login/index.d.ts +19 -9
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/login/index.js +12 -6
- package/dist/components/layouts/otp/index.d.ts +17 -0
- package/dist/components/layouts/otp/index.d.ts.map +1 -0
- package/dist/components/layouts/otp/index.js +16 -0
- package/dist/components/layouts/register/index.d.ts +11 -7
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/register/index.js +8 -4
- package/dist/components/layouts/reset_password/index.d.ts +4 -5
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/index.js +5 -5
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +3 -5
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.js +2 -2
- package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts +25 -0
- package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/facebook_sign_in_button.js +49 -0
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +8 -3
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +3 -6
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/two_column_auth_layout.js +8 -5
- package/dist/components/otp/OTPRequestForm.d.ts +11 -0
- package/dist/components/otp/OTPRequestForm.d.ts.map +1 -0
- package/dist/components/otp/OTPRequestForm.js +42 -0
- package/dist/components/otp/OTPVerifyForm.d.ts +16 -0
- package/dist/components/otp/OTPVerifyForm.d.ts.map +1 -0
- package/dist/components/otp/OTPVerifyForm.js +75 -0
- package/dist/components/otp/index.d.ts +5 -0
- package/dist/components/otp/index.d.ts.map +1 -0
- package/dist/components/otp/index.js +2 -0
- package/dist/components/ui/input-otp.d.ts +35 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +44 -0
- package/dist/consent/consent_state.d.ts +18 -0
- package/dist/consent/consent_state.d.ts.map +1 -0
- package/dist/consent/consent_state.js +29 -0
- package/dist/consent/cookie_consent_banner.d.ts +11 -0
- package/dist/consent/cookie_consent_banner.d.ts.map +1 -0
- package/dist/consent/cookie_consent_banner.js +40 -0
- package/dist/consent/gtm_mapping.d.ts +13 -0
- package/dist/consent/gtm_mapping.d.ts.map +1 -0
- package/dist/consent/gtm_mapping.js +30 -0
- package/dist/consent/index.d.ts +7 -0
- package/dist/consent/index.d.ts.map +1 -0
- package/dist/consent/index.js +7 -0
- package/dist/consent/manage_modal.d.ts +2 -0
- package/dist/consent/manage_modal.d.ts.map +1 -0
- package/dist/consent/manage_modal.js +33 -0
- package/dist/consent/read_consent.d.ts +15 -0
- package/dist/consent/read_consent.d.ts.map +1 -0
- package/dist/consent/read_consent.js +23 -0
- package/dist/consent/use_consent.d.ts +7 -0
- package/dist/consent/use_consent.d.ts.map +1 -0
- package/dist/consent/use_consent.js +55 -0
- package/dist/lib/auth/nextauth_config.d.ts +10 -0
- package/dist/lib/auth/nextauth_config.d.ts.map +1 -1
- package/dist/lib/auth/nextauth_config.js +80 -2
- package/dist/lib/cookies_config.server.d.ts +1 -0
- package/dist/lib/cookies_config.server.d.ts.map +1 -1
- package/dist/lib/cookies_config.server.js +1 -0
- package/dist/lib/email_verification_config.server.d.ts +0 -3
- package/dist/lib/email_verification_config.server.d.ts.map +1 -1
- package/dist/lib/email_verification_config.server.js +0 -15
- package/dist/lib/forgot_password_config.server.d.ts +0 -3
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
- package/dist/lib/forgot_password_config.server.js +0 -15
- package/dist/lib/login_config.server.d.ts +6 -3
- package/dist/lib/login_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.js +7 -13
- package/dist/lib/my_settings_config.server.d.ts +0 -1
- package/dist/lib/my_settings_config.server.d.ts.map +1 -1
- package/dist/lib/my_settings_config.server.js +0 -2
- package/dist/lib/oauth_config.server.d.ts +17 -0
- package/dist/lib/oauth_config.server.d.ts.map +1 -1
- package/dist/lib/oauth_config.server.js +25 -0
- package/dist/lib/otp_config.server.d.ts +49 -0
- package/dist/lib/otp_config.server.d.ts.map +1 -0
- package/dist/lib/otp_config.server.js +48 -0
- package/dist/lib/register_config.server.d.ts +2 -3
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +4 -13
- package/dist/lib/reset_password_config.server.d.ts +0 -3
- package/dist/lib/reset_password_config.server.d.ts.map +1 -1
- package/dist/lib/reset_password_config.server.js +0 -13
- package/dist/lib/services/email_service.d.ts +1 -1
- package/dist/lib/services/email_service.d.ts.map +1 -1
- package/dist/lib/services/email_service.js +2 -0
- package/dist/lib/services/email_template_manifest.d.ts.map +1 -1
- package/dist/lib/services/email_template_manifest.js +17 -0
- package/dist/lib/services/email_templates/otp_signin_code.html +13 -0
- package/dist/lib/services/email_templates/otp_signin_code.txt +5 -0
- package/dist/lib/services/index.d.ts +2 -0
- package/dist/lib/services/index.d.ts.map +1 -1
- package/dist/lib/services/index.js +1 -0
- package/dist/lib/services/oauth_service.d.ts +24 -0
- package/dist/lib/services/oauth_service.d.ts.map +1 -1
- package/dist/lib/services/oauth_service.js +155 -0
- package/dist/lib/services/otp_service.d.ts +46 -0
- package/dist/lib/services/otp_service.d.ts.map +1 -0
- package/dist/lib/services/otp_service.js +238 -0
- package/dist/lib/services/session_token_service.d.ts +3 -1
- package/dist/lib/services/session_token_service.d.ts.map +1 -1
- package/dist/lib/services/session_token_service.js +4 -2
- package/dist/page_components/create_firm.d.ts +13 -1
- package/dist/page_components/create_firm.d.ts.map +1 -1
- package/dist/page_components/create_firm.js +10 -6
- package/dist/page_components/forgot_password.d.ts +1 -4
- package/dist/page_components/forgot_password.d.ts.map +1 -1
- package/dist/page_components/forgot_password.js +2 -6
- package/dist/page_components/login.d.ts +1 -4
- package/dist/page_components/login.d.ts.map +1 -1
- package/dist/page_components/login.js +2 -6
- package/dist/page_components/otp.d.ts +4 -0
- package/dist/page_components/otp.d.ts.map +1 -0
- package/dist/page_components/otp.js +5 -0
- package/dist/page_components/register.d.ts +1 -4
- package/dist/page_components/register.d.ts.map +1 -1
- package/dist/page_components/register.js +2 -6
- package/dist/page_components/reset_password.d.ts +1 -4
- package/dist/page_components/reset_password.d.ts.map +1 -1
- package/dist/page_components/reset_password.js +2 -6
- package/dist/page_components/verify_email.d.ts +1 -4
- package/dist/page_components/verify_email.d.ts.map +1 -1
- package/dist/page_components/verify_email.js +2 -6
- package/dist/server/routes/index.d.ts +3 -0
- package/dist/server/routes/index.d.ts.map +1 -1
- package/dist/server/routes/index.js +4 -0
- package/dist/server/routes/me.d.ts.map +1 -1
- package/dist/server/routes/me.js +43 -1
- package/dist/server/routes/oauth_facebook_callback.d.ts +8 -0
- package/dist/server/routes/oauth_facebook_callback.d.ts.map +1 -0
- package/dist/server/routes/oauth_facebook_callback.js +157 -0
- package/dist/server/routes/oauth_google_callback.js +1 -1
- package/dist/server/routes/otp/request.d.ts +3 -0
- package/dist/server/routes/otp/request.d.ts.map +1 -0
- package/dist/server/routes/otp/request.js +33 -0
- package/dist/server/routes/otp/verify.d.ts +3 -0
- package/dist/server/routes/otp/verify.d.ts.map +1 -0
- package/dist/server/routes/otp/verify.js +58 -0
- package/dist/server-lib.d.ts +3 -0
- package/dist/server-lib.d.ts.map +1 -1
- package/dist/server-lib.js +2 -0
- package/dist/server_pages/forgot_password.d.ts +13 -17
- package/dist/server_pages/forgot_password.d.ts.map +1 -1
- package/dist/server_pages/forgot_password.js +12 -8
- package/dist/server_pages/forgot_password_client_wrapper.d.ts +7 -6
- package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/forgot_password_client_wrapper.js +2 -2
- package/dist/server_pages/login.d.ts +22 -21
- package/dist/server_pages/login.d.ts.map +1 -1
- package/dist/server_pages/login.js +15 -19
- package/dist/server_pages/login_client_wrapper.d.ts +10 -6
- package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/login_client_wrapper.js +2 -2
- package/dist/server_pages/my_settings.d.ts +2 -0
- package/dist/server_pages/my_settings.d.ts.map +1 -1
- package/dist/server_pages/my_settings.js +8 -2
- package/dist/server_pages/otp.d.ts +56 -0
- package/dist/server_pages/otp.d.ts.map +1 -0
- package/dist/server_pages/otp.js +45 -0
- package/dist/server_pages/register.d.ts +19 -16
- package/dist/server_pages/register.d.ts.map +1 -1
- package/dist/server_pages/register.js +15 -12
- package/dist/server_pages/register_client_wrapper.d.ts +10 -6
- package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/register_client_wrapper.js +2 -2
- package/dist/server_pages/reset_password.d.ts +11 -16
- package/dist/server_pages/reset_password.d.ts.map +1 -1
- package/dist/server_pages/reset_password.js +11 -9
- package/dist/server_pages/reset_password_client_wrapper.d.ts +7 -6
- package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/reset_password_client_wrapper.js +2 -2
- package/dist/server_pages/verify_email.d.ts +11 -17
- package/dist/server_pages/verify_email.d.ts.map +1 -1
- package/dist/server_pages/verify_email.js +11 -8
- package/dist/server_pages/verify_email_client_wrapper.d.ts +7 -6
- package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/verify_email_client_wrapper.js +2 -2
- package/dist/strings/default_strings.d.ts +47 -0
- package/dist/strings/default_strings.d.ts.map +1 -0
- package/dist/strings/default_strings.js +18 -0
- package/dist/strings/index.d.ts +4 -0
- package/dist/strings/index.d.ts.map +1 -0
- package/dist/strings/index.js +3 -0
- package/dist/strings/strings_context.d.ts +12 -0
- package/dist/strings/strings_context.d.ts.map +1 -0
- package/dist/strings/strings_context.js +23 -0
- package/dist/strings/strings_provider.d.ts +26 -0
- package/dist/strings/strings_provider.d.ts.map +1 -0
- package/dist/strings/strings_provider.js +45 -0
- package/dist/theme/create_theme.d.ts +7 -0
- package/dist/theme/create_theme.d.ts.map +1 -0
- package/dist/theme/create_theme.js +97 -0
- package/dist/theme/hex_to_hsl.d.ts +16 -0
- package/dist/theme/hex_to_hsl.d.ts.map +1 -0
- package/dist/theme/hex_to_hsl.js +110 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +3 -0
- package/dist/theme/luminance.d.ts +11 -0
- package/dist/theme/luminance.d.ts.map +1 -0
- package/dist/theme/luminance.js +45 -0
- package/dist/theme/theme_provider.d.ts +14 -0
- package/dist/theme/theme_provider.d.ts.map +1 -0
- package/dist/theme/theme_provider.js +23 -0
- package/dist/theme/theme_types.d.ts +36 -0
- package/dist/theme/theme_types.d.ts.map +1 -0
- package/dist/theme/theme_types.js +1 -0
- package/dist/themes/index.d.ts +3 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +2 -0
- package/dist/themes/preset_indigo_sunset.d.ts +3 -0
- package/dist/themes/preset_indigo_sunset.d.ts.map +1 -0
- package/dist/themes/preset_indigo_sunset.js +20 -0
- package/dist/themes/preset_neutral.d.ts +3 -0
- package/dist/themes/preset_neutral.d.ts.map +1 -0
- package/dist/themes/preset_neutral.js +14 -0
- package/package.json +36 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/cli/validate.ts"],"names":[],"mappings":"AAOA,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/cli/validate.ts"],"names":[],"mappings":"AAOA,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AA+rBF,wBAAgB,cAAc,IAAI,iBAAiB,CA2ElD"}
|
package/dist/cli/validate.js
CHANGED
|
@@ -44,6 +44,9 @@ const REQUIRED_API_ROUTES = [
|
|
|
44
44
|
{ path: "api/hazo_auth/user_management/users/roles", method: "GET" },
|
|
45
45
|
{ path: "api/hazo_auth/user_management/users/roles", method: "POST" },
|
|
46
46
|
{ path: "api/hazo_auth/user_management/users/roles", method: "PUT" },
|
|
47
|
+
// OTP routes
|
|
48
|
+
{ path: "api/hazo_auth/otp/request", method: "POST" },
|
|
49
|
+
{ path: "api/hazo_auth/otp/verify", method: "POST" },
|
|
47
50
|
];
|
|
48
51
|
// section: helpers
|
|
49
52
|
function get_project_root() {
|
|
@@ -486,6 +489,7 @@ const REQUIRED_TABLES = [
|
|
|
486
489
|
"hazo_role_permissions",
|
|
487
490
|
"hazo_invitations",
|
|
488
491
|
"hazo_refresh_tokens",
|
|
492
|
+
"hazo_email_otps",
|
|
489
493
|
];
|
|
490
494
|
const TEXT_ID_TABLES = [
|
|
491
495
|
"hazo_users",
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from "./components/index.js";
|
|
2
|
+
export { OTPRequestForm, OTPVerifyForm } from "./components/otp.js";
|
|
3
|
+
export type { OTPRequestFormProps, OTPVerifyFormProps } from "./components/otp";
|
|
2
4
|
export { cn, merge_class_names } from "./lib/utils.js";
|
|
3
5
|
export * from "./lib/auth/auth_types.js";
|
|
4
6
|
export { use_auth_status, trigger_auth_status_refresh } from "./components/layouts/shared/hooks/use_auth_status.js";
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAYA,cAAc,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAYA,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAIhF,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIpD,cAAc,uBAAuB,CAAC;AAItC,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AACjH,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC3G,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AACnH,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAGvI,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI/E,cAAc,8CAA8C,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// section: component_exports
|
|
11
11
|
// All UI and layout components are client-safe
|
|
12
12
|
export * from "./components/index.js";
|
|
13
|
+
export { OTPRequestForm, OTPVerifyForm } from "./components/otp.js";
|
|
13
14
|
// section: utility_exports
|
|
14
15
|
// CSS utility functions
|
|
15
16
|
export { cn, merge_class_names } from "./lib/utils.js";
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type { StaticImageData } from "next/image";
|
|
2
1
|
import { type ButtonPaletteOverrides } from "../shared/config/layout_customization.js";
|
|
2
|
+
import type { HazoAuthTheme } from "../../../theme/theme_types";
|
|
3
3
|
export type CreateFirmLayoutProps = {
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
/** Alt text for the image */
|
|
7
|
-
image_alt?: string;
|
|
8
|
-
/** Background color for the image panel */
|
|
9
|
-
image_background_color?: string;
|
|
4
|
+
/** Theme that controls visual appearance and layout mode. */
|
|
5
|
+
theme?: HazoAuthTheme;
|
|
10
6
|
/** Page heading */
|
|
11
7
|
heading?: string;
|
|
12
8
|
/** Page sub-heading */
|
|
@@ -39,6 +35,6 @@ export type CreateFirmLayoutProps = {
|
|
|
39
35
|
error: (message: string, data?: Record<string, unknown>) => void;
|
|
40
36
|
};
|
|
41
37
|
};
|
|
42
|
-
export default function CreateFirmLayout({
|
|
38
|
+
export default function CreateFirmLayout({ theme, heading, sub_heading, firm_name_label, firm_name_placeholder, org_structure_label, org_structure_placeholder, default_org_structure, submit_button_label, success_message, redirect_route, apiBasePath, onSuccess, button_colors, logger, }: CreateFirmLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
43
39
|
export { CreateFirmLayout };
|
|
44
40
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/create_firm/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/create_firm/index.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,sBAAsB,EAC5B,MAAM,uCAAuC,CAAC;AAM/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,MAAM,MAAM,qBAAqB,GAAG;IAClC,6DAA6D;IAC7D,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oCAAoC;IACpC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0CAA0C;IAC1C,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,sCAAsC;IACtC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,8BAA8B;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,6BAA6B;IAC7B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,2BAA2B;IAC3B,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;KAClE,CAAC;CACH,CAAC;AAGF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,KAAK,EACL,OAA4B,EAC5B,WAAuD,EACvD,eAA6B,EAC7B,qBAA8C,EAC9C,mBAA8C,EAC9C,yBAA6D,EAC7D,qBAAsC,EACtC,mBAAmC,EACnC,eAA4D,EAC5D,cAAoB,EACpB,WAAW,EACX,SAAS,EACT,aAAa,EACb,MAAM,GACP,EAAE,qBAAqB,2CAuJvB;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { CheckCircle, Building2 } from "lucide-react";
|
|
|
11
11
|
import { use_create_firm_form, } from "./hooks/use_create_firm_form.js";
|
|
12
12
|
import { useHazoAuthConfig } from "../../../contexts/hazo_auth_provider.js";
|
|
13
13
|
// section: component
|
|
14
|
-
export default function CreateFirmLayout({
|
|
14
|
+
export default function CreateFirmLayout({ theme, heading = "Create Your Firm", sub_heading = "Set up your organisation to get started", firm_name_label = "Firm Name", firm_name_placeholder = "Enter your firm name", org_structure_label = "Organisation Structure", org_structure_placeholder = "e.g., Headquarters, Head Office", default_org_structure = "Headquarters", submit_button_label = "Create Firm", success_message = "Your firm has been created successfully!", redirect_route = "/", apiBasePath, onSuccess, button_colors, logger, }) {
|
|
15
15
|
const { apiBasePath: contextApiBasePath } = useHazoAuthConfig();
|
|
16
16
|
const resolvedApiBasePath = apiBasePath || contextApiBasePath;
|
|
17
17
|
const form = use_create_firm_form({
|
|
@@ -37,9 +37,9 @@ export default function CreateFirmLayout({ image_src, image_alt = "Create your f
|
|
|
37
37
|
};
|
|
38
38
|
// Show success message after firm creation
|
|
39
39
|
if (form.isSuccess) {
|
|
40
|
-
return (_jsx(TwoColumnAuthLayout, {
|
|
40
|
+
return (_jsx(TwoColumnAuthLayout, { theme: theme, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: heading, subHeading: sub_heading }), _jsxs("div", { className: "cls_create_firm_layout_success flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(CheckCircle, { className: "cls_create_firm_layout_success_icon h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsx("p", { className: "cls_create_firm_layout_success_message text-lg font-medium text-slate-900", children: success_message }), _jsx("p", { className: "cls_create_firm_layout_redirect_message text-sm text-muted-foreground", children: "Redirecting you to the application..." })] })] }) }));
|
|
41
41
|
}
|
|
42
|
-
return (_jsx(TwoColumnAuthLayout, {
|
|
42
|
+
return (_jsx(TwoColumnAuthLayout, { theme: theme, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: heading, subHeading: sub_heading }), _jsxs("div", { className: "cls_create_firm_layout_info mb-6 flex items-start gap-3 rounded-lg border border-blue-200 bg-blue-50 p-4", children: [_jsx(Building2, { className: "mt-0.5 h-5 w-5 flex-shrink-0 text-blue-600" }), _jsxs("div", { className: "text-sm text-blue-800", children: [_jsx("p", { className: "font-medium", children: "Welcome!" }), _jsx("p", { children: "Create your firm to start using the application. You'll become the administrator of your firm and can invite team members later." })] })] }), _jsxs("form", { className: "cls_create_firm_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": "Create firm form", children: [renderFields(form), form.errors.form && (_jsx("div", { className: "cls_create_firm_layout_form_error rounded-md bg-red-50 p-3 text-sm text-red-600", children: form.errors.form })), form.hasAutofillPreview && !form.values.firm_name && (_jsx("div", { className: "cls_create_firm_layout_autofill_hint rounded-md bg-amber-50 p-3 text-sm text-amber-700", children: "Click in the firm name field to confirm the autofilled value" })), _jsx(FormActionButtons, { submitLabel: submit_button_label, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, submitAriaLabel: "Create your firm", hideCancel: true })] })] }) }));
|
|
43
43
|
}
|
|
44
44
|
// section: exports
|
|
45
45
|
export { CreateFirmLayout };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { StaticImageData } from "next/image";
|
|
2
1
|
import { type ButtonPaletteOverrides, type LayoutFieldMapOverrides, type LayoutLabelOverrides } from "../shared/config/layout_customization.js";
|
|
3
2
|
import { type EmailVerificationSuccessLabels, type EmailVerificationErrorLabels } from "./config/email_verification_field_config.js";
|
|
4
3
|
import { type LayoutDataClient } from "../shared/data/layout_data_client.js";
|
|
4
|
+
import type { HazoAuthTheme } from "../../../theme/theme_types";
|
|
5
5
|
export type EmailVerificationLayoutProps<TClient = unknown> = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
image_background_color?: string;
|
|
6
|
+
/** Theme that controls visual appearance and layout mode. */
|
|
7
|
+
theme?: HazoAuthTheme;
|
|
9
8
|
field_overrides?: LayoutFieldMapOverrides;
|
|
10
9
|
labels?: LayoutLabelOverrides;
|
|
11
10
|
button_colors?: ButtonPaletteOverrides;
|
|
@@ -21,5 +20,5 @@ export type EmailVerificationLayoutProps<TClient = unknown> = {
|
|
|
21
20
|
returnHomePath?: string;
|
|
22
21
|
data_client: LayoutDataClient<TClient>;
|
|
23
22
|
};
|
|
24
|
-
export default function email_verification_layout<TClient>({
|
|
23
|
+
export default function email_verification_layout<TClient>({ theme, field_overrides, labels, button_colors, success_labels, error_labels, redirect_delay, login_path, sign_in_label, data_client, already_logged_in_message, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, }: EmailVerificationLayoutProps<TClient>): import("react/jsx-runtime").JSX.Element;
|
|
25
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/email_verification/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/email_verification/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAOL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAClC,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAI1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,MAAM,MAAM,4BAA4B,CAAC,OAAO,GAAG,OAAO,IAAI;IAC5D,6DAA6D;IAC7D,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC;IACzD,YAAY,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACxC,CAAC;AASF,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,OAAO,EAAE,EACzD,KAAK,EACL,eAAe,EACf,MAAM,EACN,aAAa,EACb,cAAc,EACd,YAAY,EACZ,cAAkB,EAClB,UAA+B,EAC/B,aAAyB,EACzB,WAAW,EACX,yBAAyB,EACzB,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,GACrB,EAAE,4BAA4B,CAAC,OAAO,CAAC,2CAsNvC"}
|
|
@@ -18,7 +18,7 @@ const ORDERED_FIELDS = [
|
|
|
18
18
|
EMAIL_VERIFICATION_FIELD_IDS.EMAIL,
|
|
19
19
|
];
|
|
20
20
|
// section: component
|
|
21
|
-
export default function email_verification_layout({
|
|
21
|
+
export default function email_verification_layout({ theme, field_overrides, labels, button_colors, success_labels, error_labels, redirect_delay = 5, login_path = "/hazo_auth/login", sign_in_label = "Sign in", data_client, already_logged_in_message, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = "Return home", returnHomePath = "/", }) {
|
|
22
22
|
const fieldDefinitions = createEmailVerificationFieldDefinitions(field_overrides);
|
|
23
23
|
const resolvedLabels = resolveEmailVerificationLabels(labels);
|
|
24
24
|
const resolvedButtonPalette = resolveEmailVerificationButtonPalette(button_colors);
|
|
@@ -48,15 +48,15 @@ export default function email_verification_layout({ image_src, image_alt, image_
|
|
|
48
48
|
};
|
|
49
49
|
// Verifying state
|
|
50
50
|
if (verification.isVerifying) {
|
|
51
|
-
return (_jsx(AlreadyLoggedInGuard, {
|
|
51
|
+
return (_jsx(AlreadyLoggedInGuard, { theme: theme, message: already_logged_in_message, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, requireEmailVerified: false, children: _jsx(TwoColumnAuthLayout, { theme: theme, formContent: _jsxs("div", { className: "cls_email_verification_verifying flex flex-col items-center justify-center gap-4 py-8", children: [_jsx(Loader2, { className: "h-12 w-12 animate-spin text-slate-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_email_verification_verifying_text text-center", children: [_jsx("h1", { className: "cls_email_verification_verifying_heading text-2xl font-semibold text-slate-900", children: resolvedLabels.heading }), _jsx("p", { className: "cls_email_verification_verifying_subheading mt-2 text-sm text-slate-600", children: resolvedLabels.subHeading })] })] }) }) }));
|
|
52
52
|
}
|
|
53
53
|
// Success state
|
|
54
54
|
if (verification.isVerified) {
|
|
55
|
-
return (_jsx(AlreadyLoggedInGuard, {
|
|
55
|
+
return (_jsx(AlreadyLoggedInGuard, { theme: theme, message: already_logged_in_message, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, requireEmailVerified: false, children: _jsx(TwoColumnAuthLayout, { theme: theme, formContent: _jsxs("div", { className: "cls_email_verification_success flex flex-col gap-6", children: [_jsxs("div", { className: "cls_email_verification_success_content flex flex-col items-center gap-4 text-center", children: [_jsx(CheckCircle, { className: "h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_email_verification_success_text", children: [_jsx("h1", { className: "cls_email_verification_success_heading text-2xl font-semibold text-slate-900", children: resolvedSuccessLabels.heading }), _jsx("p", { className: "cls_email_verification_success_message mt-2 text-sm text-slate-600", children: resolvedSuccessLabels.message })] }), _jsxs("div", { className: "cls_email_verification_redirect_info mt-2 text-sm text-slate-500", children: [resolvedSuccessLabels.redirectMessage, " ", verification.redirectCountdown, " seconds..."] })] }), _jsx("div", { className: "cls_email_verification_success_actions flex justify-center", children: _jsx(Button, { type: "button", onClick: verification.handleGoToLogin, className: "cls_email_verification_go_to_login_button", style: {
|
|
56
56
|
backgroundColor: resolvedButtonPalette.submitBackground,
|
|
57
57
|
color: resolvedButtonPalette.submitText,
|
|
58
58
|
}, children: resolvedSuccessLabels.goToLoginButton }) })] }) }) }));
|
|
59
59
|
}
|
|
60
60
|
// Error state with resend form
|
|
61
|
-
return (_jsx(AlreadyLoggedInGuard, {
|
|
61
|
+
return (_jsx(AlreadyLoggedInGuard, { theme: theme, message: already_logged_in_message, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, requireEmailVerified: false, children: _jsx(TwoColumnAuthLayout, { theme: theme, formContent: _jsxs(_Fragment, { children: [_jsxs("div", { className: "cls_email_verification_error_header flex flex-col items-center gap-4 text-center", children: [_jsx(XCircle, { className: "h-12 w-12 text-red-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_email_verification_error_text", children: [_jsx("h1", { className: "cls_email_verification_error_heading text-2xl font-semibold text-slate-900", children: resolvedErrorLabels.heading }), _jsx("p", { className: "cls_email_verification_error_message mt-2 text-sm text-slate-600", children: verification.errorMessage || resolvedErrorLabels.message })] })] }), _jsxs("div", { className: "cls_email_verification_resend_form", children: [_jsx(FormHeader, { heading: resolvedErrorLabels.resendFormHeading, subHeading: "Enter your email address to receive a new verification link." }), _jsxs("form", { className: "cls_email_verification_layout_form_fields flex flex-col gap-5", onSubmit: verification.handleResendSubmit, "aria-label": "Resend verification email form", children: [renderFields(verification), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: verification.isSubmitDisabled, onCancel: verification.handleCancel, submitAriaLabel: "Submit resend verification email form", cancelAriaLabel: "Cancel resend verification email form" }), verification.isSubmitting && (_jsx("div", { className: "cls_email_verification_submitting_indicator text-sm text-slate-600 text-center", children: "Sending verification email..." }))] }), _jsxs("div", { className: "cls_email_verification_sign_in_link mt-4 text-center text-sm text-slate-600", children: ["Already verified?", " ", _jsx(Link, { href: login_path, className: "font-medium text-slate-900 hover:underline", children: sign_in_label })] })] })] }) }) }));
|
|
62
62
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { StaticImageData } from "next/image";
|
|
2
1
|
import { type ButtonPaletteOverrides, type LayoutFieldMapOverrides, type LayoutLabelOverrides } from "../shared/config/layout_customization.js";
|
|
3
2
|
import { type LayoutDataClient } from "../shared/data/layout_data_client.js";
|
|
3
|
+
import type { HazoAuthTheme } from "../../../theme/theme_types";
|
|
4
4
|
export type ForgotPasswordLayoutProps<TClient = unknown> = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
image_background_color?: string;
|
|
5
|
+
/** Theme that controls visual appearance and layout mode. */
|
|
6
|
+
theme?: HazoAuthTheme;
|
|
8
7
|
field_overrides?: LayoutFieldMapOverrides;
|
|
9
8
|
labels?: LayoutLabelOverrides;
|
|
10
9
|
button_colors?: ButtonPaletteOverrides;
|
|
@@ -23,5 +22,5 @@ export type ForgotPasswordLayoutProps<TClient = unknown> = {
|
|
|
23
22
|
mySettingsPath?: string;
|
|
24
23
|
mySettingsLabel?: string;
|
|
25
24
|
};
|
|
26
|
-
export default function forgot_password_layout<TClient>({
|
|
25
|
+
export default function forgot_password_layout<TClient>({ theme, field_overrides, labels, button_colors, data_client, sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, googleOnlyAccountHeading, googleOnlyAccountMessage, googleOnlyAccountHelpText, mySettingsPath, mySettingsLabel, }: ForgotPasswordLayoutProps<TClient>): import("react/jsx-runtime").JSX.Element;
|
|
27
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/forgot_password/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/forgot_password/index.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,MAAM,MAAM,yBAAyB,CAAC,OAAO,GAAG,OAAO,IAAI;IACzD,6DAA6D;IAC7D,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AASF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,OAAO,EAAE,EACtD,KAAK,EACL,eAAe,EACf,MAAM,EACN,aAAa,EACb,WAAW,EACX,YAAiC,EACjC,aAAyB,EACzB,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,wBAAoD,EACpD,wBAA2G,EAC3G,yBAA0I,EAC1I,cAAyC,EACzC,eAAkC,GACnC,EAAE,yBAAyB,CAAC,OAAO,CAAC,2CA4IpC"}
|
|
@@ -17,7 +17,7 @@ const ORDERED_FIELDS = [
|
|
|
17
17
|
FORGOT_PASSWORD_FIELD_IDS.EMAIL,
|
|
18
18
|
];
|
|
19
19
|
// section: component
|
|
20
|
-
export default function forgot_password_layout({
|
|
20
|
+
export default function forgot_password_layout({ theme, field_overrides, labels, button_colors, data_client, sign_in_path = "/hazo_auth/login", sign_in_label = "Sign in", alreadyLoggedInMessage = "You are already logged in", showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = "Return home", returnHomePath = "/", googleOnlyAccountHeading = "Google Account Detected", googleOnlyAccountMessage = "Your account was created using Google Sign-In and doesn't have a password set.", googleOnlyAccountHelpText = "Sign in with Google, then set a password in your account settings if you'd like to use email/password login.", mySettingsPath = "/hazo_auth/my_settings", mySettingsLabel = "Go to Settings", }) {
|
|
21
21
|
const fieldDefinitions = createForgotPasswordFieldDefinitions(field_overrides);
|
|
22
22
|
const resolvedLabels = resolveForgotPasswordLabels(labels);
|
|
23
23
|
const resolvedButtonPalette = resolveForgotPasswordButtonPalette(button_colors);
|
|
@@ -41,7 +41,7 @@ export default function forgot_password_layout({ image_src, image_alt, image_bac
|
|
|
41
41
|
return (_jsx(FormFieldWrapper, { fieldId: fieldDefinition.id, label: fieldDefinition.label, input: inputElement, errorMessage: shouldShowError }, fieldId));
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
return (_jsx(AlreadyLoggedInGuard, {
|
|
44
|
+
return (_jsx(AlreadyLoggedInGuard, { theme: theme, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { theme: theme, formContent: _jsx(_Fragment, { children: form.isGoogleOnlyAccount ? (
|
|
45
45
|
/* Google-only account message */
|
|
46
46
|
_jsxs("div", { className: "cls_forgot_password_google_only flex flex-col gap-5", children: [_jsx(FormHeader, { heading: googleOnlyAccountHeading, subHeading: googleOnlyAccountMessage }), _jsx("p", { className: "cls_forgot_password_google_only_help text-sm text-slate-600", children: googleOnlyAccountHelpText }), _jsxs("div", { className: "cls_forgot_password_google_only_actions flex flex-col gap-3", children: [_jsx(GoogleSignInButton, { label: "Sign in with Google" }), _jsx(Link, { href: mySettingsPath, className: "cls_forgot_password_settings_link text-center text-sm font-medium text-slate-700 hover:text-slate-900 hover:underline", children: mySettingsLabel })] }), _jsx("div", { className: "cls_forgot_password_sign_in_link mt-2 text-center text-sm text-slate-600", children: _jsxs(Link, { href: sign_in_path, className: "font-medium text-slate-900 hover:underline", children: ["Back to ", sign_in_label] }) })] })) : (
|
|
47
47
|
/* Normal forgot password form */
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import type { StaticImageData } from "next/image";
|
|
2
1
|
import { type ButtonPaletteOverrides, type LayoutFieldMapOverrides, type LayoutLabelOverrides } from "../shared/config/layout_customization.js";
|
|
3
2
|
import { type LayoutDataClient } from "../shared/data/layout_data_client.js";
|
|
3
|
+
import type { HazoAuthTheme } from "../../../theme/theme_types";
|
|
4
|
+
import type { ReactNode } from "react";
|
|
4
5
|
export type OAuthLayoutConfig = {
|
|
5
6
|
/** Enable Google OAuth login */
|
|
6
7
|
enable_google: boolean;
|
|
8
|
+
/** Enable Facebook OAuth login */
|
|
9
|
+
enable_facebook?: boolean;
|
|
7
10
|
/** Enable traditional email/password login */
|
|
8
11
|
enable_email_password: boolean;
|
|
9
12
|
/** Text displayed on the Google sign-in button */
|
|
10
13
|
google_button_text: string;
|
|
14
|
+
/** Text displayed on the Facebook sign-in button */
|
|
15
|
+
facebook_button_text?: string;
|
|
11
16
|
/** Text displayed on the divider between OAuth and email/password form */
|
|
12
17
|
oauth_divider_text: string;
|
|
13
18
|
};
|
|
14
19
|
export type LoginLayoutProps<TClient = unknown> = {
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/** Image alt text. Required when `layout` is `"two_column"` (the default); ignored when `"form_only"`. */
|
|
18
|
-
image_alt?: string;
|
|
19
|
-
image_background_color?: string;
|
|
20
|
+
/** Theme that controls visual appearance and layout mode. */
|
|
21
|
+
theme?: HazoAuthTheme;
|
|
20
22
|
field_overrides?: LayoutFieldMapOverrides;
|
|
21
23
|
labels?: LayoutLabelOverrides;
|
|
22
24
|
button_colors?: ButtonPaletteOverrides;
|
|
@@ -43,10 +45,16 @@ export type LoginLayoutProps<TClient = unknown> = {
|
|
|
43
45
|
urlOnLogon?: string;
|
|
44
46
|
/** OAuth configuration */
|
|
45
47
|
oauth?: OAuthLayoutConfig;
|
|
48
|
+
/** Show the OTP sign-in link below the login form (default: false) */
|
|
49
|
+
otp_signin_enabled?: boolean;
|
|
50
|
+
/** Label for the OTP sign-in link */
|
|
51
|
+
otp_signin_label?: string;
|
|
52
|
+
/** href for the OTP sign-in link */
|
|
53
|
+
otp_signin_href?: string;
|
|
46
54
|
/**
|
|
47
55
|
* Layout mode (default: `"two_column"`).
|
|
48
|
-
* - `"two_column"` — renders the form inside the package's TwoColumnAuthLayout
|
|
49
|
-
*
|
|
56
|
+
* - `"two_column"` — renders the form inside the package's TwoColumnAuthLayout.
|
|
57
|
+
* Layout appearance is controlled by `theme.layout` (split or centered).
|
|
50
58
|
* - `"form_only"` — renders just the form content (header, OAuth button,
|
|
51
59
|
* divider, fields, action buttons, support links). For consumers who want
|
|
52
60
|
* to wrap the form in their own brand chrome. The "already logged in"
|
|
@@ -54,6 +62,8 @@ export type LoginLayoutProps<TClient = unknown> = {
|
|
|
54
62
|
* (e.g. via `use_auth_status` from `hazo_auth/components/layouts/shared`).
|
|
55
63
|
*/
|
|
56
64
|
layout?: "two_column" | "form_only";
|
|
65
|
+
/** Optional legal text rendered below the form (accepts ReactNode for links/JSX) */
|
|
66
|
+
legalText?: ReactNode;
|
|
57
67
|
};
|
|
58
|
-
export default function login_layout<TClient>({
|
|
68
|
+
export default function login_layout<TClient>({ theme, field_overrides, labels, button_colors, data_client, logger, redirectRoute, successMessage, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, forgot_password_path, forgot_password_label, create_account_path, create_account_label, show_create_account_link, urlOnLogon, oauth, otp_signin_enabled, otp_signin_label, otp_signin_href, layout, legalText, }: LoginLayoutProps<TClient>): import("react/jsx-runtime").JSX.Element;
|
|
59
69
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/login/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/login/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,kCAAkC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8CAA8C;IAC9C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kDAAkD;IAClD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0EAA0E;IAC1E,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,OAAO,GAAG,OAAO,IAAI;IAChD,6DAA6D;IAC7D,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QACjE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;KAClE,CAAC;IACF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sDAAsD;IACtD,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,sEAAsE;IACtE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IACpC,oFAAoF;IACpF,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,OAAO,EAAE,EAC5C,KAAK,EACL,eAAe,EACf,MAAM,EACN,aAAa,EACb,WAAW,EACX,MAAM,EACN,aAAa,EACb,cAAyC,EACzC,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,oBAAmD,EACnD,qBAA0C,EAC1C,mBAA2C,EAC3C,oBAAuC,EACvC,wBAA+B,EAC/B,UAAU,EACV,KAAK,EACL,kBAA0B,EAC1B,gBAA4C,EAC5C,eAAkC,EAClC,MAAqB,EACrB,SAAS,GACV,EAAE,gBAAgB,CAAC,OAAO,CAAC,2CAkS3B"}
|
|
@@ -14,6 +14,7 @@ import { TwoColumnAuthLayout } from "../shared/components/two_column_auth_layout
|
|
|
14
14
|
import { CheckCircle, AlertCircle } from "lucide-react";
|
|
15
15
|
import { AlreadyLoggedInGuard } from "../shared/components/already_logged_in_guard.js";
|
|
16
16
|
import { GoogleSignInButton } from "../shared/components/google_sign_in_button.js";
|
|
17
|
+
import { FacebookSignInButton } from "../shared/components/facebook_sign_in_button.js";
|
|
17
18
|
import { OAuthDivider } from "../shared/components/oauth_divider.js";
|
|
18
19
|
import { LOGIN_FIELD_IDS, createLoginFieldDefinitions, resolveLoginButtonPalette, resolveLoginLabels, } from "./config/login_field_config.js";
|
|
19
20
|
import { use_login_form, } from "./hooks/use_login_form.js";
|
|
@@ -22,8 +23,8 @@ const ORDERED_FIELDS = [
|
|
|
22
23
|
LOGIN_FIELD_IDS.PASSWORD,
|
|
23
24
|
];
|
|
24
25
|
// section: component
|
|
25
|
-
export default function login_layout({
|
|
26
|
-
var _a;
|
|
26
|
+
export default function login_layout({ theme, field_overrides, labels, button_colors, data_client, logger, redirectRoute, successMessage = "Successfully logged in", alreadyLoggedInMessage = "You are already logged in", showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = "Return home", returnHomePath = "/", forgot_password_path = "/hazo_auth/forgot_password", forgot_password_label = "Forgot password?", create_account_path = "/hazo_auth/register", create_account_label = "Create account", show_create_account_link = true, urlOnLogon, oauth, otp_signin_enabled = false, otp_signin_label = "Sign in with email code", otp_signin_href = "/hazo_auth/otp", layout = "two_column", legalText, }) {
|
|
27
|
+
var _a, _b;
|
|
27
28
|
// Default OAuth config: both enabled
|
|
28
29
|
const oauthConfig = oauth || {
|
|
29
30
|
enable_google: true,
|
|
@@ -48,6 +49,9 @@ export default function login_layout({ image_src, image_alt, image_background_co
|
|
|
48
49
|
const oauthCallbackUrl = safeRedirect
|
|
49
50
|
? `/api/hazo_auth/oauth/google/callback?next=${encodeURIComponent(safeRedirect)}`
|
|
50
51
|
: "/api/hazo_auth/oauth/google/callback";
|
|
52
|
+
const facebookCallbackUrl = safeRedirect
|
|
53
|
+
? `/api/hazo_auth/oauth/facebook/callback?next=${encodeURIComponent(safeRedirect)}`
|
|
54
|
+
: "/api/hazo_auth/oauth/facebook/callback";
|
|
51
55
|
const effectiveRedirectRoute = (_a = redirectRoute !== null && redirectRoute !== void 0 ? redirectRoute : safeRedirect) !== null && _a !== void 0 ? _a : undefined;
|
|
52
56
|
const getOAuthErrorMessage = (error) => {
|
|
53
57
|
switch (error) {
|
|
@@ -56,7 +60,9 @@ export default function login_layout({ image_src, image_alt, image_background_co
|
|
|
56
60
|
case "OAuthSignin":
|
|
57
61
|
case "OAuthCallback":
|
|
58
62
|
case "OAuthCreateAccount":
|
|
59
|
-
return "Something went wrong with
|
|
63
|
+
return "Something went wrong with sign-in. Please try again.";
|
|
64
|
+
case "link_blocked_unverified":
|
|
65
|
+
return "This email is already registered but not verified. Please verify your email before linking a social account.";
|
|
60
66
|
default:
|
|
61
67
|
return "An error occurred during sign-in. Please try again.";
|
|
62
68
|
}
|
|
@@ -95,7 +101,7 @@ export default function login_layout({ image_src, image_alt, image_background_co
|
|
|
95
101
|
// into TwoColumnAuthLayout's `formContent`; in "form_only" mode it's returned
|
|
96
102
|
// as the entire output for the consumer to compose into their own chrome.
|
|
97
103
|
const successContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("div", { className: "cls_login_layout_success flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(CheckCircle, { className: "cls_login_layout_success_icon h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsx("p", { className: "cls_login_layout_success_message text-lg font-medium text-slate-900", children: successMessage })] })] }));
|
|
98
|
-
const mainContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), oauthError && (_jsxs("div", { className: "cls_login_layout_oauth_error flex items-center gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: [_jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: getOAuthErrorMessage(oauthError) })] })), oauthConfig.enable_google && (_jsx("div", { className: "cls_login_layout_oauth_section", children: _jsx(GoogleSignInButton, { label: oauthConfig.google_button_text, callbackUrl: oauthCallbackUrl }) })), oauthConfig.enable_google && oauthConfig.enable_email_password && (_jsx(OAuthDivider, { text: oauthConfig.oauth_divider_text })), oauthConfig.enable_email_password && (_jsxs("form", { className: "cls_login_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": "Login form", children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: "Submit login form", cancelAriaLabel: "Cancel login form" }), ((forgot_password_path && forgot_password_label) || (show_create_account_link && create_account_path && create_account_label)) && (_jsxs("div", { className: "cls_login_layout_support_links flex flex-col gap-1 text-sm text-muted-foreground", children: [forgot_password_path && forgot_password_label && (_jsx(Link, { href: forgot_password_path, className: "cls_login_layout_forgot_password_link text-primary underline-offset-4 hover:underline", "aria-label": "Go to forgot password page", children: forgot_password_label })), show_create_account_link && create_account_path && create_account_label && (_jsx(Link, { href: create_account_path, className: "cls_login_layout_create_account_link text-primary underline-offset-4 hover:underline", "aria-label": "Go to create account page", children: create_account_label }))] }))] })), show_create_account_link && create_account_path && create_account_label && !oauthConfig.enable_email_password && oauthConfig.enable_google && (_jsx("div", { className: "cls_login_layout_support_links mt-4 text-center text-sm text-muted-foreground", children: _jsx(Link, { href: create_account_path, className: "cls_login_layout_create_account_link text-primary underline-offset-4 hover:underline", "aria-label": "Go to create account page", children: create_account_label }) }))] }));
|
|
104
|
+
const mainContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), oauthError && (_jsxs("div", { className: "cls_login_layout_oauth_error flex items-center gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: [_jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: getOAuthErrorMessage(oauthError) })] })), oauthConfig.enable_google && (_jsx("div", { className: "cls_login_layout_oauth_section", children: _jsx(GoogleSignInButton, { label: oauthConfig.google_button_text, callbackUrl: oauthCallbackUrl }) })), oauthConfig.enable_facebook && (_jsx("div", { className: "cls_login_layout_facebook_oauth_section", children: _jsx(FacebookSignInButton, { label: (_b = oauthConfig.facebook_button_text) !== null && _b !== void 0 ? _b : "Continue with Facebook", callbackUrl: facebookCallbackUrl }) })), (oauthConfig.enable_google || oauthConfig.enable_facebook) && oauthConfig.enable_email_password && (_jsx(OAuthDivider, { text: oauthConfig.oauth_divider_text })), oauthConfig.enable_email_password && (_jsxs("form", { className: "cls_login_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": "Login form", children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: "Submit login form", cancelAriaLabel: "Cancel login form" }), ((forgot_password_path && forgot_password_label) || (show_create_account_link && create_account_path && create_account_label)) && (_jsxs("div", { className: "cls_login_layout_support_links flex flex-col gap-1 text-sm text-muted-foreground", children: [forgot_password_path && forgot_password_label && (_jsx(Link, { href: forgot_password_path, className: "cls_login_layout_forgot_password_link text-primary underline-offset-4 hover:underline", "aria-label": "Go to forgot password page", children: forgot_password_label })), show_create_account_link && create_account_path && create_account_label && (_jsx(Link, { href: create_account_path, className: "cls_login_layout_create_account_link text-primary underline-offset-4 hover:underline", "aria-label": "Go to create account page", children: create_account_label }))] }))] })), show_create_account_link && create_account_path && create_account_label && !oauthConfig.enable_email_password && (oauthConfig.enable_google || oauthConfig.enable_facebook) && (_jsx("div", { className: "cls_login_layout_support_links mt-4 text-center text-sm text-muted-foreground", children: _jsx(Link, { href: create_account_path, className: "cls_login_layout_create_account_link text-primary underline-offset-4 hover:underline", "aria-label": "Go to create account page", children: create_account_label }) })), otp_signin_enabled && otp_signin_href && (_jsx("div", { className: "cls_login_layout_otp_link mt-4 text-center text-sm", children: _jsx("a", { href: otp_signin_href, className: "underline text-muted-foreground hover:text-foreground", "aria-label": "Sign in with email code", children: otp_signin_label !== null && otp_signin_label !== void 0 ? otp_signin_label : "Sign in with email code" }) })), legalText && (_jsx("p", { className: "cls_login_layout_legal_text text-xs text-muted-foreground mt-4 text-center", children: legalText }))] }));
|
|
99
105
|
// Form-only mode: return the content directly. Consumer is expected to wrap
|
|
100
106
|
// it in their own page/brand chrome. We deliberately skip AlreadyLoggedInGuard
|
|
101
107
|
// here — its 2-col fallback would defeat the purpose of form_only. Consumer
|
|
@@ -105,10 +111,10 @@ export default function login_layout({ image_src, image_alt, image_background_co
|
|
|
105
111
|
}
|
|
106
112
|
// Two-column mode (default): success state.
|
|
107
113
|
if (form.isSuccess) {
|
|
108
|
-
return (_jsx(TwoColumnAuthLayout, {
|
|
114
|
+
return (_jsx(TwoColumnAuthLayout, { theme: theme, formContent: successContent }));
|
|
109
115
|
}
|
|
110
116
|
// Two-column mode (default): main flow with already-logged-in guard.
|
|
111
|
-
return (_jsx(AlreadyLoggedInGuard, {
|
|
117
|
+
return (_jsx(AlreadyLoggedInGuard, { theme: theme, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { theme: theme, formContent: mainContent }) }));
|
|
112
118
|
}
|
|
113
119
|
// Same-origin path validator for the `?redirect=` query param. Accepts
|
|
114
120
|
// values like "/foo" or "/foo?bar". Rejects anything that could redirect
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { HazoAuthTheme } from "../../../theme/theme_types";
|
|
3
|
+
export interface OTPLayoutProps {
|
|
4
|
+
/** URL to redirect to after successful sign-in. Defaults to "/" */
|
|
5
|
+
redirect_url?: string;
|
|
6
|
+
/** Page heading. Defaults to "Sign in with email code" */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** Page subtitle shown below the heading. */
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
/** Submit button label for the OTP verification step (default: "Verify") */
|
|
11
|
+
ctaText?: string;
|
|
12
|
+
/** Theme that controls visual appearance and layout mode. */
|
|
13
|
+
theme?: HazoAuthTheme;
|
|
14
|
+
}
|
|
15
|
+
export declare function OTPLayout({ redirect_url, title, subtitle, ctaText, theme, }: OTPLayoutProps): React.ReactElement;
|
|
16
|
+
export default OTPLayout;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/otp/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAGD,wBAAgB,SAAS,CAAC,EACxB,YAAkB,EAClB,KAAiC,EACjC,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE,cAAc,GAAG,KAAK,CAAC,YAAY,CA2BrC;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// file_description: OTP (email one-time-password) sign-in layout component
|
|
2
|
+
// section: client_directive
|
|
3
|
+
"use client";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
// section: imports
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { OTPRequestForm } from "../../otp/OTPRequestForm.js";
|
|
8
|
+
import { OTPVerifyForm } from "../../otp/OTPVerifyForm.js";
|
|
9
|
+
import { TwoColumnAuthLayout } from "../shared/components/two_column_auth_layout.js";
|
|
10
|
+
// section: component
|
|
11
|
+
export function OTPLayout({ redirect_url = "/", title = "Sign in with email code", subtitle, ctaText, theme, }) {
|
|
12
|
+
const [sent_to, set_sent_to] = React.useState(null);
|
|
13
|
+
const formContent = (_jsxs("div", { className: "mx-auto w-full max-w-sm py-12", children: [_jsx("h1", { className: `text-2xl font-semibold ${subtitle ? "mb-2" : "mb-6"}`, children: title }), subtitle && (_jsx("p", { className: "text-sm text-muted-foreground mb-6", children: subtitle })), sent_to ? (_jsx(OTPVerifyForm, { email: sent_to, redirect_url: redirect_url, submit_label: ctaText })) : (_jsx(OTPRequestForm, { on_sent: (email) => set_sent_to(email) }))] }));
|
|
14
|
+
return (_jsx(TwoColumnAuthLayout, { theme: theme, formContent: formContent }));
|
|
15
|
+
}
|
|
16
|
+
export default OTPLayout;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { type ButtonPaletteOverrides, type LayoutFieldMapOverrides, type LayoutLabelOverrides, type PasswordRequirementOverrides } from "../shared/config/layout_customization.js";
|
|
2
2
|
import { type LayoutDataClient } from "../shared/data/layout_data_client.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { HazoAuthTheme } from "../../../theme/theme_types";
|
|
4
|
+
import type { ReactNode } from "react";
|
|
4
5
|
export type OAuthLayoutConfig = {
|
|
5
6
|
/** Enable Google OAuth login */
|
|
6
7
|
enable_google: boolean;
|
|
8
|
+
/** Enable Facebook OAuth login */
|
|
9
|
+
enable_facebook?: boolean;
|
|
7
10
|
/** Enable traditional email/password login */
|
|
8
11
|
enable_email_password: boolean;
|
|
9
12
|
/** Text displayed on the Google sign-in button */
|
|
10
13
|
google_button_text: string;
|
|
14
|
+
/** Text displayed on the Facebook sign-in button */
|
|
15
|
+
facebook_button_text?: string;
|
|
11
16
|
/** Text displayed on the divider between OAuth and email/password form */
|
|
12
17
|
oauth_divider_text: string;
|
|
13
18
|
};
|
|
14
19
|
export type RegisterLayoutProps<TClient = unknown> = {
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/** Image alt text. Required when `layout` is `"two_column"` (the default); ignored when `"form_only"`. */
|
|
18
|
-
image_alt?: string;
|
|
19
|
-
image_background_color?: string;
|
|
20
|
+
/** Theme that controls visual appearance and layout mode. */
|
|
21
|
+
theme?: HazoAuthTheme;
|
|
20
22
|
field_overrides?: LayoutFieldMapOverrides;
|
|
21
23
|
labels?: LayoutLabelOverrides;
|
|
22
24
|
button_colors?: ButtonPaletteOverrides;
|
|
@@ -35,6 +37,8 @@ export type RegisterLayoutProps<TClient = unknown> = {
|
|
|
35
37
|
oauth?: OAuthLayoutConfig;
|
|
36
38
|
/** Layout mode (default: `"two_column"`). See `LoginLayoutProps.layout` for the full description. */
|
|
37
39
|
layout?: "two_column" | "form_only";
|
|
40
|
+
/** Optional legal text rendered below the form (accepts ReactNode for links/JSX) */
|
|
41
|
+
legalText?: ReactNode;
|
|
38
42
|
};
|
|
39
|
-
export default function register_layout<TClient>({
|
|
43
|
+
export default function register_layout<TClient>({ theme, field_overrides, labels, button_colors, password_requirements, show_name_field, data_client, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, signInPath, signInLabel, urlOnLogon, oauth, layout, legalText, }: RegisterLayoutProps<TClient>): import("react/jsx-runtime").JSX.Element;
|
|
40
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/register/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/register/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;AAY/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,kCAAkC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8CAA8C;IAC9C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kDAAkD;IAClD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0EAA0E;IAC1E,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,OAAO,GAAG,OAAO,IAAI;IACnD,6DAA6D;IAC7D,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,qBAAqB,CAAC,EAAE,4BAA4B,CAAC;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,qGAAqG;IACrG,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IACpC,oFAAoF;IACpF,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAYF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,EAC/C,KAAK,EACL,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,eAAsB,EACtB,WAAW,EACX,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,UAA+B,EAC/B,WAAuB,EACvB,UAAU,EACV,KAAK,EACL,MAAqB,EACrB,SAAS,GACV,EAAE,mBAAmB,CAAC,OAAO,CAAC,2CAqP9B"}
|
|
@@ -13,6 +13,7 @@ import { FormActionButtons } from "../shared/components/form_action_buttons.js";
|
|
|
13
13
|
import { TwoColumnAuthLayout } from "../shared/components/two_column_auth_layout.js";
|
|
14
14
|
import { AlreadyLoggedInGuard } from "../shared/components/already_logged_in_guard.js";
|
|
15
15
|
import { GoogleSignInButton } from "../shared/components/google_sign_in_button.js";
|
|
16
|
+
import { FacebookSignInButton } from "../shared/components/facebook_sign_in_button.js";
|
|
16
17
|
import { OAuthDivider } from "../shared/components/oauth_divider.js";
|
|
17
18
|
import { AlertCircle } from "lucide-react";
|
|
18
19
|
import { REGISTER_FIELD_IDS, createRegisterFieldDefinitions, resolveRegisterButtonPalette, resolveRegisterLabels, resolveRegisterPasswordRequirements, } from "./config/register_field_config.js";
|
|
@@ -24,8 +25,8 @@ const ORDERED_FIELDS = [
|
|
|
24
25
|
REGISTER_FIELD_IDS.CONFIRM_PASSWORD,
|
|
25
26
|
];
|
|
26
27
|
// section: component
|
|
27
|
-
export default function register_layout({
|
|
28
|
-
var _a;
|
|
28
|
+
export default function register_layout({ theme, field_overrides, labels, button_colors, password_requirements, show_name_field = true, data_client, alreadyLoggedInMessage = "You are already logged in", showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = "Return home", returnHomePath = "/", signInPath = "/hazo_auth/login", signInLabel = "Sign in", urlOnLogon, oauth, layout = "two_column", legalText, }) {
|
|
29
|
+
var _a, _b;
|
|
29
30
|
// Default OAuth config: both enabled
|
|
30
31
|
const oauthConfig = oauth || {
|
|
31
32
|
enable_google: true,
|
|
@@ -46,6 +47,9 @@ export default function register_layout({ image_src, image_alt, image_background
|
|
|
46
47
|
const oauthCallbackUrl = safeRedirect
|
|
47
48
|
? `/api/hazo_auth/oauth/google/callback?next=${encodeURIComponent(safeRedirect)}`
|
|
48
49
|
: "/api/hazo_auth/oauth/google/callback";
|
|
50
|
+
const facebookCallbackUrl = safeRedirect
|
|
51
|
+
? `/api/hazo_auth/oauth/facebook/callback?next=${encodeURIComponent(safeRedirect)}`
|
|
52
|
+
: "/api/hazo_auth/oauth/facebook/callback";
|
|
49
53
|
const effectiveUrlOnLogon = (_a = urlOnLogon !== null && urlOnLogon !== void 0 ? urlOnLogon : safeRedirect) !== null && _a !== void 0 ? _a : undefined;
|
|
50
54
|
const getOAuthErrorMessage = (error) => {
|
|
51
55
|
switch (error) {
|
|
@@ -95,13 +99,13 @@ export default function register_layout({ image_src, image_alt, image_background
|
|
|
95
99
|
// Form content — used in both layout modes. See `login_layout` for the
|
|
96
100
|
// rationale: keeps the form independent of TwoColumnAuthLayout / AuthPageShell
|
|
97
101
|
// so consumers can compose it into their own brand chrome.
|
|
98
|
-
const mainContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), oauthError && (_jsxs("div", { className: "cls_register_layout_oauth_error flex items-center gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: [_jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: getOAuthErrorMessage(oauthError) })] })), oauthConfig.enable_google && (_jsx("div", { className: "cls_register_layout_oauth_section", children: _jsx(GoogleSignInButton, { label: oauthConfig.google_button_text, callbackUrl: oauthCallbackUrl }) })), oauthConfig.enable_google && oauthConfig.enable_email_password && (_jsx(OAuthDivider, { text: oauthConfig.oauth_divider_text })), oauthConfig.enable_email_password && (_jsxs("form", { className: "cls_register_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": "Registration form", children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: "Submit registration form", cancelAriaLabel: "Cancel registration form" }), _jsxs("div", { className: "cls_register_layout_sign_in_link flex items-center justify-center gap-1 text-sm text-muted-foreground", children: [_jsx("span", { children: "Already have an account?" }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": "Go to sign in page", children: signInLabel })] }), form.isSubmitting && (_jsx("div", { className: "cls_register_submitting_indicator text-sm text-slate-600 text-center", children: "Registering..." }))] })), !oauthConfig.enable_email_password && oauthConfig.enable_google && (_jsxs("div", { className: "cls_register_layout_sign_in_link mt-4 flex items-center justify-center gap-1 text-sm text-muted-foreground", children: [_jsx("span", { children: "Already have an account?" }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": "Go to sign in page", children: signInLabel })] }))] }));
|
|
102
|
+
const mainContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), oauthError && (_jsxs("div", { className: "cls_register_layout_oauth_error flex items-center gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: [_jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: getOAuthErrorMessage(oauthError) })] })), oauthConfig.enable_google && (_jsx("div", { className: "cls_register_layout_oauth_section", children: _jsx(GoogleSignInButton, { label: oauthConfig.google_button_text, callbackUrl: oauthCallbackUrl }) })), oauthConfig.enable_facebook && (_jsx("div", { className: "cls_register_layout_facebook_oauth_section", children: _jsx(FacebookSignInButton, { label: (_b = oauthConfig.facebook_button_text) !== null && _b !== void 0 ? _b : "Sign up with Facebook", callbackUrl: facebookCallbackUrl }) })), (oauthConfig.enable_google || oauthConfig.enable_facebook) && oauthConfig.enable_email_password && (_jsx(OAuthDivider, { text: oauthConfig.oauth_divider_text })), oauthConfig.enable_email_password && (_jsxs("form", { className: "cls_register_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": "Registration form", children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: "Submit registration form", cancelAriaLabel: "Cancel registration form" }), _jsxs("div", { className: "cls_register_layout_sign_in_link flex items-center justify-center gap-1 text-sm text-muted-foreground", children: [_jsx("span", { children: "Already have an account?" }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": "Go to sign in page", children: signInLabel })] }), form.isSubmitting && (_jsx("div", { className: "cls_register_submitting_indicator text-sm text-slate-600 text-center", children: "Registering..." }))] })), !oauthConfig.enable_email_password && (oauthConfig.enable_google || oauthConfig.enable_facebook) && (_jsxs("div", { className: "cls_register_layout_sign_in_link mt-4 flex items-center justify-center gap-1 text-sm text-muted-foreground", children: [_jsx("span", { children: "Already have an account?" }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": "Go to sign in page", children: signInLabel })] })), legalText && (_jsx("p", { className: "cls_register_layout_legal_text text-xs text-muted-foreground mt-4 text-center", children: legalText }))] }));
|
|
99
103
|
// form_only mode: emit just the form content. See login_layout for the
|
|
100
104
|
// rationale; AlreadyLoggedInGuard is intentionally skipped here.
|
|
101
105
|
if (layout === "form_only") {
|
|
102
106
|
return mainContent;
|
|
103
107
|
}
|
|
104
|
-
return (_jsx(AlreadyLoggedInGuard, {
|
|
108
|
+
return (_jsx(AlreadyLoggedInGuard, { theme: theme, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { theme: theme, formContent: mainContent }) }));
|
|
105
109
|
}
|
|
106
110
|
// Same-origin path validator. See login/index.tsx for the rationale.
|
|
107
111
|
function isSafeRedirectPath(value) {
|