hazo_auth 10.18.3 → 10.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/cli-src/lib/utils/password_validator.ts +12 -5
  2. package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -1
  3. package/dist/components/layouts/email_verification/config/email_verification_field_config.js +18 -15
  4. package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
  5. package/dist/components/layouts/email_verification/hooks/use_email_verification.js +12 -9
  6. package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
  7. package/dist/components/layouts/email_verification/index.js +6 -3
  8. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -1
  9. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +11 -8
  10. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
  11. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +8 -5
  12. package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
  13. package/dist/components/layouts/forgot_password/index.js +6 -3
  14. package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -1
  15. package/dist/components/layouts/login/config/login_field_config.js +14 -11
  16. package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
  17. package/dist/components/layouts/login/hooks/use_login_form.js +7 -4
  18. package/dist/components/layouts/login/index.d.ts.map +1 -1
  19. package/dist/components/layouts/login/index.js +11 -8
  20. package/dist/components/layouts/my_settings/components/connected_accounts_section.d.ts.map +1 -1
  21. package/dist/components/layouts/my_settings/components/connected_accounts_section.js +7 -4
  22. package/dist/components/layouts/my_settings/components/danger_zone_section.d.ts.map +1 -1
  23. package/dist/components/layouts/my_settings/components/danger_zone_section.js +8 -5
  24. package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
  25. package/dist/components/layouts/my_settings/components/set_password_section.js +20 -13
  26. package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -1
  27. package/dist/components/layouts/my_settings/config/my_settings_field_config.js +9 -6
  28. package/dist/components/layouts/otp/index.d.ts.map +1 -1
  29. package/dist/components/layouts/otp/index.js +4 -1
  30. package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -1
  31. package/dist/components/layouts/register/config/register_field_config.js +20 -17
  32. package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
  33. package/dist/components/layouts/register/hooks/use_register_form.js +8 -5
  34. package/dist/components/layouts/register/index.d.ts.map +1 -1
  35. package/dist/components/layouts/register/index.js +11 -8
  36. package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +1 -1
  37. package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -1
  38. package/dist/components/layouts/reset_password/config/reset_password_field_config.js +14 -11
  39. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
  40. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +13 -10
  41. package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
  42. package/dist/components/layouts/reset_password/index.js +7 -4
  43. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
  44. package/dist/components/layouts/shared/components/already_logged_in_guard.js +4 -1
  45. package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -1
  46. package/dist/components/layouts/shared/components/facebook_sign_in_button.js +5 -2
  47. package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -1
  48. package/dist/components/layouts/shared/components/form_action_buttons.js +4 -1
  49. package/dist/components/layouts/shared/components/google_sign_in_button.d.ts.map +1 -1
  50. package/dist/components/layouts/shared/components/google_sign_in_button.js +5 -2
  51. package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
  52. package/dist/components/layouts/shared/components/logout_button.js +7 -4
  53. package/dist/components/layouts/shared/components/oauth_divider.d.ts.map +1 -1
  54. package/dist/components/layouts/shared/components/oauth_divider.js +4 -1
  55. package/dist/components/layouts/shared/components/password_field.d.ts.map +1 -1
  56. package/dist/components/layouts/shared/components/password_field.js +4 -1
  57. package/dist/components/layouts/shared/components/unauthorized_guard.d.ts.map +1 -1
  58. package/dist/components/layouts/shared/components/unauthorized_guard.js +6 -3
  59. package/dist/components/layouts/shared/config/layout_customization.d.ts +5 -0
  60. package/dist/components/layouts/shared/config/layout_customization.d.ts.map +1 -1
  61. package/dist/components/layouts/shared/config/layout_customization.js +14 -0
  62. package/dist/components/layouts/shared/utils/validation.d.ts +4 -0
  63. package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -1
  64. package/dist/components/layouts/shared/utils/validation.js +18 -6
  65. package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
  66. package/dist/components/layouts/user_management/components/roles_matrix.js +22 -17
  67. package/dist/components/layouts/user_management/components/scope_hierarchy_tab.d.ts.map +1 -1
  68. package/dist/components/layouts/user_management/components/scope_hierarchy_tab.js +29 -26
  69. package/dist/components/layouts/user_management/components/user_scopes_tab.d.ts.map +1 -1
  70. package/dist/components/layouts/user_management/components/user_scopes_tab.js +27 -19
  71. package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts +2 -1
  72. package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts.map +1 -1
  73. package/dist/components/layouts/user_management/components/user_signup_stats_cards.js +64 -21
  74. package/dist/components/layouts/user_management/index.d.ts.map +1 -1
  75. package/dist/components/layouts/user_management/index.js +48 -42
  76. package/dist/components/otp/OTPRequestForm.d.ts.map +1 -1
  77. package/dist/components/otp/OTPRequestForm.js +8 -5
  78. package/dist/components/otp/OTPVerifyForm.d.ts.map +1 -1
  79. package/dist/components/otp/OTPVerifyForm.js +10 -7
  80. package/dist/components/permission_denied_dialog.client.d.ts.map +1 -1
  81. package/dist/components/permission_denied_dialog.client.js +12 -9
  82. package/dist/lib/utils/password_validator.d.ts.map +1 -1
  83. package/dist/lib/utils/password_validator.js +5 -5
  84. package/dist/locales/en.json +383 -0
  85. package/dist/server/routes/library_photos.d.ts +2 -2
  86. package/dist/server/routes/set_password.js +1 -1
  87. package/dist/strings/default_strings.d.ts.map +1 -1
  88. package/dist/strings/default_strings.js +14 -11
  89. package/package.json +22 -17
@@ -4,14 +4,17 @@
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  // section: imports
6
6
  import { GoogleIcon } from "../../shared/components/google_icon.js";
7
+ import en from "../../../../locales/en.json" with { type: "json" };
8
+ import { createPackageT } from "hazo_core/i18n";
9
+ const t = createPackageT("hazo_auth", en);
7
10
  // section: component
8
11
  /**
9
12
  * Connected Accounts Section for My Settings
10
13
  * Shows which OAuth providers are linked to the user's account
11
14
  * Currently supports Google, designed for future extensibility
12
15
  */
13
- export function ConnectedAccountsSection({ googleConnected, email, heading = "Connected Accounts", loading = false, }) {
14
- return (_jsxs("div", { className: "cls_my_settings_connected_accounts_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: heading }), _jsx("div", { className: "cls_connected_accounts_list flex flex-col gap-3", children: _jsxs("div", { className: "cls_connected_account_item flex items-center justify-between p-3 rounded-md border border-[var(--hazo-border)] bg-[var(--hazo-surface-muted)]", children: [_jsxs("div", { className: "cls_connected_account_info flex items-center gap-3", children: [_jsx("div", { className: "cls_connected_account_icon flex items-center justify-center w-10 h-10 rounded-full bg-white border border-[var(--hazo-border)]", children: _jsx(GoogleIcon, { width: 20, height: 20 }) }), _jsxs("div", { className: "cls_connected_account_details flex flex-col", children: [_jsx("span", { className: "cls_connected_account_name font-medium text-[var(--hazo-text-primary)]", children: "Google" }), googleConnected && email && (_jsx("span", { className: "cls_connected_account_email text-sm text-[var(--hazo-text-muted)]", children: email }))] })] }), _jsx("div", { className: "cls_connected_account_status", children: loading ? (_jsx("span", { className: "cls_connected_account_loading text-sm text-[var(--hazo-text-muted)] animate-pulse", children: "Loading..." })) : googleConnected ? (_jsxs("span", { className: "cls_connected_account_connected inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700", children: [_jsx("span", { className: "cls_connected_indicator w-1.5 h-1.5 rounded-full bg-green-500" }), "Connected"] })) : (_jsxs("span", { className: "cls_connected_account_not_connected inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-100 text-slate-600", children: [_jsx("span", { className: "cls_not_connected_indicator w-1.5 h-1.5 rounded-full bg-slate-400" }), "Not connected"] })) })] }) }), _jsx("p", { className: "cls_connected_accounts_help text-sm text-[var(--hazo-text-muted)] mt-4", children: googleConnected
15
- ? "Your Google account is linked. You can sign in using either your password or Google."
16
- : "Link your Google account to enable quick sign-in with Google." })] }));
16
+ export function ConnectedAccountsSection({ googleConnected, email, heading = t("my_settings.connected_accounts.heading"), loading = false, }) {
17
+ return (_jsxs("div", { className: "cls_my_settings_connected_accounts_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: heading }), _jsx("div", { className: "cls_connected_accounts_list flex flex-col gap-3", children: _jsxs("div", { className: "cls_connected_account_item flex items-center justify-between p-3 rounded-md border border-[var(--hazo-border)] bg-[var(--hazo-surface-muted)]", children: [_jsxs("div", { className: "cls_connected_account_info flex items-center gap-3", children: [_jsx("div", { className: "cls_connected_account_icon flex items-center justify-center w-10 h-10 rounded-full bg-white border border-[var(--hazo-border)]", children: _jsx(GoogleIcon, { width: 20, height: 20 }) }), _jsxs("div", { className: "cls_connected_account_details flex flex-col", children: [_jsx("span", { className: "cls_connected_account_name font-medium text-[var(--hazo-text-primary)]", children: t("my_settings.connected_accounts.google_name") }), googleConnected && email && (_jsx("span", { className: "cls_connected_account_email text-sm text-[var(--hazo-text-muted)]", children: email }))] })] }), _jsx("div", { className: "cls_connected_account_status", children: loading ? (_jsx("span", { className: "cls_connected_account_loading text-sm text-[var(--hazo-text-muted)] animate-pulse", children: t("my_settings.connected_accounts.loading") })) : googleConnected ? (_jsxs("span", { className: "cls_connected_account_connected inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700", children: [_jsx("span", { className: "cls_connected_indicator w-1.5 h-1.5 rounded-full bg-green-500" }), t("my_settings.connected_accounts.connected")] })) : (_jsxs("span", { className: "cls_connected_account_not_connected inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-100 text-slate-600", children: [_jsx("span", { className: "cls_not_connected_indicator w-1.5 h-1.5 rounded-full bg-slate-400" }), t("my_settings.connected_accounts.not_connected")] })) })] }) }), _jsx("p", { className: "cls_connected_accounts_help text-sm text-[var(--hazo-text-muted)] mt-4", children: googleConnected
18
+ ? t("my_settings.connected_accounts.help_connected")
19
+ : t("my_settings.connected_accounts.help_not_connected") })] }));
17
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"danger_zone_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/danger_zone_section.tsx"],"names":[],"mappings":"AA2BA,MAAM,MAAM,sBAAsB,GAAG;IACnC,+FAA+F;IAC/F,KAAK,EAAE,MAAM,CAAC;IACd,uHAAuH;IACvH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAGF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAe,EACf,OAAuB,EACvB,WAAsG,EACtG,iBAAuC,EACvC,WAAoC,EACpC,iBAAiK,EACjK,iBAAwD,EACxD,kBAAoD,EACpD,iBAA4B,EAC5B,YAAiC,GAClC,EAAE,sBAAsB,sCA8JxB"}
1
+ {"version":3,"file":"danger_zone_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/danger_zone_section.tsx"],"names":[],"mappings":"AA+BA,MAAM,MAAM,sBAAsB,GAAG;IACnC,+FAA+F;IAC/F,KAAK,EAAE,MAAM,CAAC;IACd,uHAAuH;IACvH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAGF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAe,EACf,OAA8C,EAC9C,WAAsD,EACtD,iBAA8D,EAC9D,WAAuD,EACvD,iBAAmE,EACnE,iBAAoE,EACpE,kBAAgE,EAChE,iBAA6C,EAC7C,YAAiC,GAClC,EAAE,sBAAsB,sCA8JxB"}
@@ -16,6 +16,9 @@ import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogFoo
16
16
  import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js";
17
17
  import { trigger_auth_status_refresh } from "../../shared/hooks/use_auth_status.js";
18
18
  import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
19
+ import en from "../../../../locales/en.json" with { type: "json" };
20
+ import { createPackageT } from "hazo_core/i18n";
21
+ const t = createPackageT("hazo_auth", en);
19
22
  // section: component
20
23
  /**
21
24
  * Danger Zone Section for My Settings
@@ -25,7 +28,7 @@ import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
25
28
  * account-deletion API route and signs the user out on success.
26
29
  * Renders nothing when `enabled` is false (config-gated, default off).
27
30
  */
28
- export function DangerZoneSection({ email, enabled = false, heading = "Danger Zone", description = "Permanently delete your account and all associated data. This action cannot be undone.", deleteButtonLabel = "Delete my account", dialogTitle = "Delete your account?", dialogDescription = "This will permanently delete your account and all associated data. This action cannot be undone. To confirm, type your email address below.", confirmInputLabel = "Type your email address to confirm", confirmButtonLabel = "Permanently delete my account", cancelButtonLabel = "Cancel", redirectPath = "/hazo_auth/login", }) {
31
+ export function DangerZoneSection({ email, enabled = false, heading = t("my_settings.danger_zone.heading"), description = t("my_settings.danger_zone.description"), deleteButtonLabel = t("my_settings.danger_zone.delete_button"), dialogTitle = t("my_settings.danger_zone.dialog_title"), dialogDescription = t("my_settings.danger_zone.dialog_description"), confirmInputLabel = t("my_settings.danger_zone.confirm_input_label"), confirmButtonLabel = t("my_settings.danger_zone.confirm_button"), cancelButtonLabel = t("shared.cancel_button"), redirectPath = "/hazo_auth/login", }) {
29
32
  const { apiBasePath } = useHazoAuthConfig();
30
33
  const router = useRouter();
31
34
  const [dialogOpen, setDialogOpen] = useState(false);
@@ -68,12 +71,12 @@ export function DangerZoneSection({ email, enabled = false, heading = "Danger Zo
68
71
  });
69
72
  const data = await response.json();
70
73
  if (!response.ok || !data.success) {
71
- const errorMessage = data.error || "Failed to delete account";
74
+ const errorMessage = data.error || t("my_settings.danger_zone.error.default");
72
75
  toast.error(errorMessage);
73
76
  setLoading(false);
74
77
  return;
75
78
  }
76
- toast.success("Your account has been deleted.");
79
+ toast.success(t("my_settings.danger_zone.success"));
77
80
  setDialogOpen(false);
78
81
  resetDialogState();
79
82
  // Sign the user out client-side and send them away from the now-deleted account
@@ -81,7 +84,7 @@ export function DangerZoneSection({ email, enabled = false, heading = "Danger Zo
81
84
  router.push(redirectPath);
82
85
  }
83
86
  catch (error) {
84
- const errorMessage = error instanceof Error ? error.message : "Failed to delete account";
87
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.danger_zone.error.default");
85
88
  toast.error(errorMessage);
86
89
  setLoading(false);
87
90
  }
@@ -89,5 +92,5 @@ export function DangerZoneSection({ email, enabled = false, heading = "Danger Zo
89
92
  if (!enabled) {
90
93
  return null;
91
94
  }
92
- return (_jsxs("div", { className: "cls_my_settings_danger_zone_section bg-white rounded-lg border border-red-200 p-6", children: [_jsxs("div", { className: "cls_danger_zone_header flex items-center gap-2 mb-2", children: [_jsx(AlertTriangle, { className: "h-5 w-5 text-red-600", "aria-hidden": "true" }), _jsx("h2", { className: "cls_danger_zone_heading text-lg font-semibold text-red-700", children: heading })] }), _jsx("p", { className: "cls_danger_zone_description text-sm text-[var(--hazo-text-muted)] mb-4", children: description }), _jsx("div", { className: "cls_danger_zone_actions flex justify-end", children: _jsx(Button, { type: "button", onClick: () => setDialogOpen(true), variant: "destructive", className: "cls_danger_zone_delete_button", "aria-label": deleteButtonLabel, children: deleteButtonLabel }) }), _jsx(AlertDialog, { open: dialogOpen, onOpenChange: handleOpenChange, children: _jsxs(AlertDialogContent, { className: "cls_delete_account_dialog", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { className: "cls_delete_account_dialog_title", children: dialogTitle }), _jsx(AlertDialogDescription, { className: "cls_delete_account_dialog_description", children: dialogDescription })] }), _jsx("div", { className: "cls_delete_account_dialog_content py-2", children: _jsx(FormFieldWrapper, { fieldId: "delete-account-confirm-email", label: confirmInputLabel, input: _jsx(Input, { id: "delete-account-confirm-email", type: "email", value: confirmEmail, onChange: (event) => setConfirmEmail(event.target.value), placeholder: email, autoComplete: "off", disabled: loading, "aria-label": confirmInputLabel, className: "cls_delete_account_confirm_input" }) }) }), _jsxs(AlertDialogFooter, { children: [_jsx(Button, { type: "button", onClick: handleDeleteAccount, disabled: !emailMatches || loading, variant: "destructive", className: "cls_delete_account_confirm_button", "aria-label": confirmButtonLabel, children: loading ? "Deleting..." : confirmButtonLabel }), _jsx(Button, { type: "button", onClick: () => handleOpenChange(false), disabled: loading, variant: "outline", className: "cls_delete_account_cancel_button", "aria-label": cancelButtonLabel, children: cancelButtonLabel })] })] }) })] }));
95
+ return (_jsxs("div", { className: "cls_my_settings_danger_zone_section bg-white rounded-lg border border-red-200 p-6", children: [_jsxs("div", { className: "cls_danger_zone_header flex items-center gap-2 mb-2", children: [_jsx(AlertTriangle, { className: "h-5 w-5 text-red-600", "aria-hidden": "true" }), _jsx("h2", { className: "cls_danger_zone_heading text-lg font-semibold text-red-700", children: heading })] }), _jsx("p", { className: "cls_danger_zone_description text-sm text-[var(--hazo-text-muted)] mb-4", children: description }), _jsx("div", { className: "cls_danger_zone_actions flex justify-end", children: _jsx(Button, { type: "button", onClick: () => setDialogOpen(true), variant: "destructive", className: "cls_danger_zone_delete_button", "aria-label": deleteButtonLabel, children: deleteButtonLabel }) }), _jsx(AlertDialog, { open: dialogOpen, onOpenChange: handleOpenChange, children: _jsxs(AlertDialogContent, { className: "cls_delete_account_dialog", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { className: "cls_delete_account_dialog_title", children: dialogTitle }), _jsx(AlertDialogDescription, { className: "cls_delete_account_dialog_description", children: dialogDescription })] }), _jsx("div", { className: "cls_delete_account_dialog_content py-2", children: _jsx(FormFieldWrapper, { fieldId: "delete-account-confirm-email", label: confirmInputLabel, input: _jsx(Input, { id: "delete-account-confirm-email", type: "email", value: confirmEmail, onChange: (event) => setConfirmEmail(event.target.value), placeholder: email, autoComplete: "off", disabled: loading, "aria-label": confirmInputLabel, className: "cls_delete_account_confirm_input" }) }) }), _jsxs(AlertDialogFooter, { children: [_jsx(Button, { type: "button", onClick: handleDeleteAccount, disabled: !emailMatches || loading, variant: "destructive", className: "cls_delete_account_confirm_button", "aria-label": confirmButtonLabel, children: loading ? t("my_settings.danger_zone.deleting") : confirmButtonLabel }), _jsx(Button, { type: "button", onClick: () => handleOpenChange(false), disabled: loading, variant: "outline", className: "cls_delete_account_cancel_button", "aria-label": cancelButtonLabel, children: cancelButtonLabel })] })] }) })] }));
93
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"set_password_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/set_password_section.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAI3F,MAAM,MAAM,uBAAuB,GAAG;IACpC,2CAA2C;IAC3C,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gCAAgC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,oBAAoB,EACpB,aAAa,EACb,OAAwB,EACxB,WAA4G,EAC5G,gBAAiC,EACjC,oBAAyC,EACzC,iBAAkC,EAClC,aAAqB,GACtB,EAAE,uBAAuB,+BAoNzB"}
1
+ {"version":3,"file":"set_password_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/set_password_section.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAQ3F,MAAM,MAAM,uBAAuB,GAAG;IACpC,2CAA2C;IAC3C,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gCAAgC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,oBAAoB,EACpB,aAAa,EACb,OAA+C,EAC/C,WAAuD,EACvD,gBAAmE,EACnE,oBAA2E,EAC3E,iBAA+D,EAC/D,aAAqB,GACtB,EAAE,uBAAuB,+BAsNzB"}
@@ -9,13 +9,16 @@ import { PasswordField } from "../../shared/components/password_field.js";
9
9
  import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js";
10
10
  import { toast } from "sonner";
11
11
  import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
12
+ import en from "../../../../locales/en.json" with { type: "json" };
13
+ import { createPackageT } from "hazo_core/i18n";
14
+ const t = createPackageT("hazo_auth", en);
12
15
  // section: component
13
16
  /**
14
17
  * Set Password Section for My Settings
15
18
  * Allows Google-only users to set a password for email/password login
16
19
  * Only shown when user has no password set (Google-only account)
17
20
  */
18
- export function SetPasswordSection({ passwordRequirements, onPasswordSet, heading = "Set Password", description = "Add a password to your account to enable email/password login in addition to Google sign-in.", newPasswordLabel = "New Password", confirmPasswordLabel = "Confirm Password", submitButtonLabel = "Set Password", parentLoading = false, }) {
21
+ export function SetPasswordSection({ passwordRequirements, onPasswordSet, heading = t("my_settings.set_password.heading"), description = t("my_settings.set_password.description"), newPasswordLabel = t("my_settings.set_password.new_password_label"), confirmPasswordLabel = t("my_settings.set_password.confirm_password_label"), submitButtonLabel = t("my_settings.set_password.submit_button"), parentLoading = false, }) {
19
22
  const { apiBasePath } = useHazoAuthConfig();
20
23
  const [newPassword, setNewPassword] = useState("");
21
24
  const [confirmPassword, setConfirmPassword] = useState("");
@@ -28,24 +31,28 @@ export function SetPasswordSection({ passwordRequirements, onPasswordSet, headin
28
31
  */
29
32
  const validatePassword = useCallback((password) => {
30
33
  if (!password || password.length < passwordRequirements.minimum_length) {
31
- return `Password must be at least ${passwordRequirements.minimum_length} characters long`;
34
+ return t("my_settings.set_password.validation.min_length", {
35
+ length: passwordRequirements.minimum_length,
36
+ });
32
37
  }
33
38
  const missingRequirements = [];
34
39
  if (passwordRequirements.require_uppercase && !/[A-Z]/.test(password)) {
35
- missingRequirements.push("uppercase letter");
40
+ missingRequirements.push(t("my_settings.set_password.validation.uppercase_item"));
36
41
  }
37
42
  if (passwordRequirements.require_lowercase && !/[a-z]/.test(password)) {
38
- missingRequirements.push("lowercase letter");
43
+ missingRequirements.push(t("my_settings.set_password.validation.lowercase_item"));
39
44
  }
40
45
  if (passwordRequirements.require_number && !/[0-9]/.test(password)) {
41
- missingRequirements.push("number");
46
+ missingRequirements.push(t("my_settings.set_password.validation.number_item"));
42
47
  }
43
48
  if (passwordRequirements.require_special &&
44
49
  !/[^A-Za-z0-9]/.test(password)) {
45
- missingRequirements.push("special character");
50
+ missingRequirements.push(t("my_settings.set_password.validation.special_item"));
46
51
  }
47
52
  if (missingRequirements.length > 0) {
48
- return `Password must contain at least one: ${missingRequirements.join(", ")}`;
53
+ return t("my_settings.set_password.validation.missing_requirements", {
54
+ list: missingRequirements.join(", "),
55
+ });
49
56
  }
50
57
  return null;
51
58
  }, [passwordRequirements]);
@@ -59,10 +66,10 @@ export function SetPasswordSection({ passwordRequirements, onPasswordSet, headin
59
66
  newErrors.newPassword = passwordError;
60
67
  }
61
68
  if (!confirmPassword) {
62
- newErrors.confirmPassword = "Please confirm your new password";
69
+ newErrors.confirmPassword = t("my_settings.set_password.validation.confirm_required");
63
70
  }
64
71
  else if (newPassword !== confirmPassword) {
65
- newErrors.confirmPassword = "Passwords do not match";
72
+ newErrors.confirmPassword = t("my_settings.set_password.validation.mismatch");
66
73
  }
67
74
  setErrors(newErrors);
68
75
  return Object.keys(newErrors).length === 0;
@@ -88,11 +95,11 @@ export function SetPasswordSection({ passwordRequirements, onPasswordSet, headin
88
95
  });
89
96
  const data = await response.json();
90
97
  if (!response.ok || !data.success) {
91
- const errorMessage = data.error || "Failed to set password";
98
+ const errorMessage = data.error || t("my_settings.set_password.error.default");
92
99
  toast.error(errorMessage);
93
100
  return;
94
101
  }
95
- toast.success("Password set successfully! You can now sign in with your email and password.");
102
+ toast.success(t("my_settings.set_password.success"));
96
103
  // Reset form
97
104
  setNewPassword("");
98
105
  setConfirmPassword("");
@@ -101,7 +108,7 @@ export function SetPasswordSection({ passwordRequirements, onPasswordSet, headin
101
108
  onPasswordSet === null || onPasswordSet === void 0 ? void 0 : onPasswordSet();
102
109
  }
103
110
  catch (error) {
104
- const errorMessage = error instanceof Error ? error.message : "Failed to set password";
111
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.set_password.error.default");
105
112
  toast.error(errorMessage);
106
113
  }
107
114
  finally {
@@ -123,5 +130,5 @@ export function SetPasswordSection({ passwordRequirements, onPasswordSet, headin
123
130
  setErrors((prev) => (Object.assign(Object.assign({}, prev), { confirmPassword: undefined })));
124
131
  }, []);
125
132
  const isSubmitDisabled = loading || parentLoading || !newPassword || !confirmPassword;
126
- return (_jsxs("div", { className: "cls_my_settings_set_password_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-2", children: heading }), _jsx("p", { className: "cls_set_password_description text-sm text-[var(--hazo-text-muted)] mb-4", children: description }), _jsxs("div", { className: "cls_set_password_fields flex flex-col gap-4", children: [_jsxs("div", { className: "cls_set_password_fields_row grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(FormFieldWrapper, { fieldId: "set-new-password", label: newPasswordLabel, input: _jsx(PasswordField, { inputId: "set-new-password", ariaLabel: newPasswordLabel, value: newPassword, placeholder: "Enter your new password", autoComplete: "new-password", isVisible: newPasswordVisible, onChange: handleNewPasswordChange, onToggleVisibility: () => setNewPasswordVisible(!newPasswordVisible), errorMessage: errors.newPassword }) }), _jsx(FormFieldWrapper, { fieldId: "set-confirm-password", label: confirmPasswordLabel, input: _jsx(PasswordField, { inputId: "set-confirm-password", ariaLabel: confirmPasswordLabel, value: confirmPassword, placeholder: "Confirm your new password", autoComplete: "new-password", isVisible: confirmPasswordVisible, onChange: handleConfirmPasswordChange, onToggleVisibility: () => setConfirmPasswordVisible(!confirmPasswordVisible), errorMessage: errors.confirmPassword }) })] }), _jsx("div", { className: "cls_set_password_actions flex justify-end", children: _jsx(Button, { type: "button", onClick: handleSubmit, disabled: isSubmitDisabled, className: "cls_set_password_submit_button", "aria-label": submitButtonLabel, children: loading ? "Setting password..." : submitButtonLabel }) })] })] }));
133
+ return (_jsxs("div", { className: "cls_my_settings_set_password_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-2", children: heading }), _jsx("p", { className: "cls_set_password_description text-sm text-[var(--hazo-text-muted)] mb-4", children: description }), _jsxs("div", { className: "cls_set_password_fields flex flex-col gap-4", children: [_jsxs("div", { className: "cls_set_password_fields_row grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(FormFieldWrapper, { fieldId: "set-new-password", label: newPasswordLabel, input: _jsx(PasswordField, { inputId: "set-new-password", ariaLabel: newPasswordLabel, value: newPassword, placeholder: t("my_settings.set_password.new_password_placeholder"), autoComplete: "new-password", isVisible: newPasswordVisible, onChange: handleNewPasswordChange, onToggleVisibility: () => setNewPasswordVisible(!newPasswordVisible), errorMessage: errors.newPassword }) }), _jsx(FormFieldWrapper, { fieldId: "set-confirm-password", label: confirmPasswordLabel, input: _jsx(PasswordField, { inputId: "set-confirm-password", ariaLabel: confirmPasswordLabel, value: confirmPassword, placeholder: t("my_settings.set_password.confirm_password_placeholder"), autoComplete: "new-password", isVisible: confirmPasswordVisible, onChange: handleConfirmPasswordChange, onToggleVisibility: () => setConfirmPasswordVisible(!confirmPasswordVisible), errorMessage: errors.confirmPassword }) })] }), _jsx("div", { className: "cls_set_password_actions flex justify-end", children: _jsx(Button, { type: "button", onClick: handleSubmit, disabled: isSubmitDisabled, className: "cls_set_password_submit_button", "aria-label": submitButtonLabel, children: loading ? t("my_settings.set_password.submitting") : submitButtonLabel }) })] })] }));
127
134
  }
@@ -1 +1 @@
1
- {"version":3,"file":"my_settings_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/config/my_settings_field_config.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAE5B,MAAM,0CAA0C,CAAC;AAGlD,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAGnG,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAWF,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,uBAAuB,GAClC,YAAY,wBAAwB,KACnC,uBAKF,CAAC;AAUF,eAAO,MAAM,8BAA8B,GACzC,YAAY,sBAAsB,0BACqC,CAAC"}
1
+ {"version":3,"file":"my_settings_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/config/my_settings_field_config.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAE5B,MAAM,0CAA0C,CAAC;AAOlD,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAGnG,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAWF,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,uBAAuB,GAClC,YAAY,wBAAwB,KACnC,uBAKF,CAAC;AAUF,eAAO,MAAM,8BAA8B,GACzC,YAAY,sBAAsB,0BACqC,CAAC"}
@@ -1,4 +1,7 @@
1
1
  import { resolveButtonPalette, } from "../../shared/config/layout_customization.js";
2
+ import en from "../../../../locales/en.json" with { type: "json" };
3
+ import { createPackageT } from "hazo_core/i18n";
4
+ const t = createPackageT("hazo_auth", en);
2
5
  // section: field_identifiers
3
6
  export const MY_SETTINGS_FIELD_IDS = {
4
7
  NAME: "name",
@@ -6,12 +9,12 @@ export const MY_SETTINGS_FIELD_IDS = {
6
9
  PASSWORD: "password",
7
10
  };
8
11
  const MY_SETTINGS_LABEL_DEFAULTS = {
9
- heading: "My Settings",
10
- profileTab: "Profile",
11
- securityTab: "Security",
12
- lastLoggedInLabel: "Last logged in",
13
- profilePictureLabel: "Profile Picture",
14
- changePasswordButton: "Change Password",
12
+ heading: t("my_settings.heading"),
13
+ profileTab: t("my_settings.profile_tab"),
14
+ securityTab: t("my_settings.security_tab"),
15
+ lastLoggedInLabel: t("my_settings.last_logged_in_label"),
16
+ profilePictureLabel: t("my_settings.profile_picture_label"),
17
+ changePasswordButton: t("my_settings.change_password_button"),
15
18
  };
16
19
  export const resolveMySettingsLabels = (overrides) => {
17
20
  return Object.assign(Object.assign({}, MY_SETTINGS_LABEL_DEFAULTS), overrides);
@@ -1 +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;IACtB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAgB,SAAS,CAAC,EACxB,YAAkB,EAClB,KAAiC,EACjC,QAAQ,EACR,OAAO,EACP,KAAK,EACL,SAAiD,EACjD,SAA0C,GAC3C,EAAE,cAAc,GAAG,KAAK,CAAC,YAAY,CA4BrC;AAED,eAAe,SAAS,CAAC"}
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;AAOhE,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;IACtB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAgB,SAAS,CAAC,EACxB,YAAkB,EAClB,KAA6B,EAC7B,QAAQ,EACR,OAAO,EACP,KAAK,EACL,SAAiD,EACjD,SAAqC,GACtC,EAAE,cAAc,GAAG,KAAK,CAAC,YAAY,CA4BrC;AAED,eAAe,SAAS,CAAC"}
@@ -7,8 +7,11 @@ import * as React from "react";
7
7
  import { OTPRequestForm } from "../../otp/OTPRequestForm.js";
8
8
  import { OTPVerifyForm } from "../../otp/OTPVerifyForm.js";
9
9
  import { TwoColumnAuthLayout } from "../shared/components/two_column_auth_layout.js";
10
+ import en from "../../../locales/en.json" with { type: "json" };
11
+ import { createPackageT } from "hazo_core/i18n";
12
+ const t = createPackageT("hazo_auth", en);
10
13
  // section: component
11
- export function OTPLayout({ redirect_url = "/", title = "Sign in with email code", subtitle, ctaText, theme, image_src = "/hazo_auth/images/login_default.jpg", image_alt = "Sign in with a one-time code", }) {
14
+ export function OTPLayout({ redirect_url = "/", title = t("otp.layout.title"), subtitle, ctaText, theme, image_src = "/hazo_auth/images/login_default.jpg", image_alt = t("otp.layout.image_alt"), }) {
12
15
  const [sent_to, set_sent_to] = React.useState(null);
13
16
  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
17
  return (_jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, formContent: formContent }));
@@ -1 +1 @@
1
- {"version":3,"file":"register_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/register/config/register_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAClC,MAAM,0CAA0C,CAAC;AAGlD,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAsC3F,eAAO,MAAM,8BAA8B,GACzC,YAAY,uBAAuB,mBAC8B,CAAC;AAUpE,eAAO,MAAM,qBAAqB,GAAI,YAAY,oBAAoB,wBACnB,CAAC;AAUpD,eAAO,MAAM,4BAA4B,GAAI,YAAY,sBAAsB,0BACZ,CAAC;AAWpE,eAAO,MAAM,mCAAmC,GAC9C,YAAY,4BAA4B,+BACiC,CAAC"}
1
+ {"version":3,"file":"register_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/register/config/register_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAML,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAClC,MAAM,0CAA0C,CAAC;AAOlD,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAsC3F,eAAO,MAAM,8BAA8B,GACzC,YAAY,uBAAuB,mBAC8B,CAAC;AAUpE,eAAO,MAAM,qBAAqB,GAAI,YAAY,oBAAoB,wBACnB,CAAC;AAUpD,eAAO,MAAM,4BAA4B,GAAI,YAAY,sBAAsB,0BACZ,CAAC;AAWpE,eAAO,MAAM,mCAAmC,GAC9C,YAAY,4BAA4B,+BACiC,CAAC"}
@@ -1,4 +1,7 @@
1
- import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, resolvePasswordRequirements, } from "../../shared/config/layout_customization.js";
1
+ import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, resolvePasswordRequirements, SHARED_EMAIL_FIELD_COPY, } from "../../shared/config/layout_customization.js";
2
+ import en from "../../../../locales/en.json" with { type: "json" };
3
+ import { createPackageT } from "hazo_core/i18n";
4
+ const t = createPackageT("hazo_auth", en);
2
5
  // section: field_identifiers
3
6
  export const REGISTER_FIELD_IDS = {
4
7
  NAME: "name",
@@ -10,44 +13,44 @@ export const REGISTER_FIELD_IDS = {
10
13
  const REGISTER_FIELD_DEFINITIONS = {
11
14
  [REGISTER_FIELD_IDS.NAME]: {
12
15
  id: REGISTER_FIELD_IDS.NAME,
13
- label: "Full name",
16
+ label: t("register.field.name.label"),
14
17
  type: "text",
15
18
  autoComplete: "name",
16
- placeholder: "Enter your full name",
17
- ariaLabel: "Full name input field",
19
+ placeholder: t("register.field.name.placeholder"),
20
+ ariaLabel: t("register.field.name.aria_label"),
18
21
  },
19
22
  [REGISTER_FIELD_IDS.EMAIL]: {
20
23
  id: REGISTER_FIELD_IDS.EMAIL,
21
- label: "Email address",
24
+ label: SHARED_EMAIL_FIELD_COPY.label,
22
25
  type: "email",
23
26
  autoComplete: "email",
24
- placeholder: "Enter your email address",
25
- ariaLabel: "Email address input field",
27
+ placeholder: SHARED_EMAIL_FIELD_COPY.placeholder,
28
+ ariaLabel: SHARED_EMAIL_FIELD_COPY.ariaLabel,
26
29
  },
27
30
  [REGISTER_FIELD_IDS.PASSWORD]: {
28
31
  id: REGISTER_FIELD_IDS.PASSWORD,
29
- label: "Password",
32
+ label: t("register.field.password.label"),
30
33
  type: "password",
31
34
  autoComplete: "new-password",
32
- placeholder: "Enter your password",
33
- ariaLabel: "Password input field",
35
+ placeholder: t("register.field.password.placeholder"),
36
+ ariaLabel: t("register.field.password.aria_label"),
34
37
  },
35
38
  [REGISTER_FIELD_IDS.CONFIRM_PASSWORD]: {
36
39
  id: REGISTER_FIELD_IDS.CONFIRM_PASSWORD,
37
- label: "Re-enter password",
40
+ label: t("register.field.confirm_password.label"),
38
41
  type: "password",
39
42
  autoComplete: "new-password",
40
- placeholder: "Re-enter your password",
41
- ariaLabel: "Re-enter password input field",
43
+ placeholder: t("register.field.confirm_password.placeholder"),
44
+ ariaLabel: t("register.field.confirm_password.aria_label"),
42
45
  },
43
46
  };
44
47
  export const createRegisterFieldDefinitions = (overrides) => resolveFieldDefinitions(REGISTER_FIELD_DEFINITIONS, overrides);
45
48
  // section: label_defaults
46
49
  const REGISTER_LABEL_DEFAULTS = {
47
- heading: "Create your hazo account",
48
- subHeading: "Secure your access with editable fields powered by shadcn components.",
49
- submitButton: "Register",
50
- cancelButton: "Cancel",
50
+ heading: t("register.heading"),
51
+ subHeading: t("register.sub_heading"),
52
+ submitButton: t("register.submit_button"),
53
+ cancelButton: t("shared.cancel_button"),
51
54
  };
52
55
  export const resolveRegisterLabels = (overrides) => resolveLabels(REGISTER_LABEL_DEFAULTS, overrides);
53
56
  // section: button_palette_defaults
@@ -1 +1 @@
1
- {"version":3,"file":"use_register_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/register/hooks/use_register_form.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACzH,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAG3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AASvE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,GAAG;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,OAAO,CAAC,eAAe,EAAE,UAAU,GAAG,kBAAkB,CAAC,EACzD,OAAO,CACR,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,OAAO,GAAG,OAAO,IAAI;IACrD,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,wBAAwB,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,KAAK,IAAI,CAAC;IAC7E,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,yBAAyB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClE,CAAC;AAYF,eAAO,MAAM,iBAAiB,GAAI,OAAO,EAAG,6EAMzC,qBAAqB,CAAC,OAAO,CAAC,KAAG,qBA6QnC,CAAC"}
1
+ {"version":3,"file":"use_register_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/register/hooks/use_register_form.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACzH,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAG3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAavE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,GAAG;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,OAAO,CAAC,eAAe,EAAE,UAAU,GAAG,kBAAkB,CAAC,EACzD,OAAO,CACR,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,OAAO,GAAG,OAAO,IAAI;IACrD,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,wBAAwB,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,KAAK,IAAI,CAAC;IAC7E,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,yBAAyB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClE,CAAC;AAYF,eAAO,MAAM,iBAAiB,GAAI,OAAO,EAAG,6EAMzC,qBAAqB,CAAC,OAAO,CAAC,KAAG,qBA6QnC,CAAC"}
@@ -5,6 +5,9 @@ import { toast } from "sonner";
5
5
  import { REGISTER_FIELD_IDS } from "../config/register_field_config.js";
6
6
  import { validateEmail, validatePassword } from "../../shared/utils/validation.js";
7
7
  import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
8
+ import en from "../../../../locales/en.json" with { type: "json" };
9
+ import { createPackageT } from "hazo_core/i18n";
10
+ const t = createPackageT("hazo_auth", en);
8
11
  // section: constants
9
12
  const PASSWORD_FIELDS = [
10
13
  REGISTER_FIELD_IDS.PASSWORD,
@@ -105,7 +108,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
105
108
  if (nextValues[REGISTER_FIELD_IDS.CONFIRM_PASSWORD].trim().length > 0 &&
106
109
  nextValues[REGISTER_FIELD_IDS.PASSWORD] !==
107
110
  nextValues[REGISTER_FIELD_IDS.CONFIRM_PASSWORD]) {
108
- updatedErrors[REGISTER_FIELD_IDS.CONFIRM_PASSWORD] = "passwords do not match";
111
+ updatedErrors[REGISTER_FIELD_IDS.CONFIRM_PASSWORD] = t("validation.passwords_do_not_match");
109
112
  }
110
113
  else {
111
114
  delete updatedErrors[REGISTER_FIELD_IDS.CONFIRM_PASSWORD];
@@ -145,7 +148,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
145
148
  if (values[REGISTER_FIELD_IDS.PASSWORD] !==
146
149
  values[REGISTER_FIELD_IDS.CONFIRM_PASSWORD]) {
147
150
  setErrors({
148
- [REGISTER_FIELD_IDS.CONFIRM_PASSWORD]: "passwords do not match",
151
+ [REGISTER_FIELD_IDS.CONFIRM_PASSWORD]: t("validation.passwords_do_not_match"),
149
152
  });
150
153
  return;
151
154
  }
@@ -168,11 +171,11 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
168
171
  });
169
172
  const data = await response.json();
170
173
  if (!response.ok) {
171
- throw new Error(data.error || "Registration failed");
174
+ throw new Error(data.error || t("register.failed_message"));
172
175
  }
173
176
  // Show success notification
174
- toast.success("Registration successful!", {
175
- description: "Your account has been created successfully.",
177
+ toast.success(t("register.success_toast_title"), {
178
+ description: t("register.success_toast_description"),
176
179
  });
177
180
  // Reset form on success
178
181
  const resetValues = buildInitialValues();
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/register/index.tsx"],"names":[],"mappings":"AAmBA,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,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kDAAkD;IAClD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAClC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,OAAO,GAAG,OAAO,IAAI;IACnD,6HAA6H;IAC7H,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IACrC,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,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;CACrC,CAAC;AAYF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,EAC/C,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,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,GACtB,EAAE,mBAAmB,CAAC,OAAO,CAAC,+BAsR9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/register/index.tsx"],"names":[],"mappings":"AAmBA,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,eAAe,EAAE,MAAM,YAAY,CAAC;AAWlD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kDAAkD;IAClD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAClC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,OAAO,GAAG,OAAO,IAAI;IACnD,6HAA6H;IAC7H,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IACrC,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,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;CACrC,CAAC;AAYF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,EAC/C,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,eAAsB,EACtB,WAAW,EACX,sBAAyE,EACzE,gBAAuB,EACvB,oBAA4B,EAC5B,qBAA6D,EAC7D,cAAoB,EACpB,UAA+B,EAC/B,WAAyC,EACzC,UAAU,EACV,KAAK,EACL,MAAqB,GACtB,EAAE,mBAAmB,CAAC,OAAO,CAAC,+BAsR9B"}
@@ -22,6 +22,9 @@ import { use_register_form, } from "./hooks/use_register_form.js";
22
22
  import { LegalDocCheckboxList } from "../legal/legal_doc_checkbox_list.js";
23
23
  import { LegalDocCombinedView } from "../legal/legal_doc_combined_view.js";
24
24
  import { useHazoAuthConfig } from "../../../contexts/hazo_auth_provider.js";
25
+ import en from "../../../locales/en.json" with { type: "json" };
26
+ import { createPackageT } from "hazo_core/i18n";
27
+ const t = createPackageT("hazo_auth", en);
25
28
  const ORDERED_FIELDS = [
26
29
  REGISTER_FIELD_IDS.NAME,
27
30
  REGISTER_FIELD_IDS.EMAIL,
@@ -29,16 +32,16 @@ const ORDERED_FIELDS = [
29
32
  REGISTER_FIELD_IDS.CONFIRM_PASSWORD,
30
33
  ];
31
34
  // section: component
32
- export default function register_layout({ image_src, image_alt, image_background_color = "#f1f5f9", 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", }) {
35
+ export default function register_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, password_requirements, show_name_field = true, data_client, alreadyLoggedInMessage = t("shared.guard.already_logged_in_prop_default"), showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = t("shared.guard.return_home_default"), returnHomePath = "/", signInPath = "/hazo_auth/login", signInLabel = t("shared.sign_in_default"), urlOnLogon, oauth, layout = "two_column", }) {
33
36
  var _a;
34
37
  // Default OAuth config: both enabled
35
38
  const oauthConfig = oauth || {
36
39
  enable_google: true,
37
40
  enable_email_password: true,
38
- google_button_text: "Sign up with Google",
39
- oauth_divider_text: "or continue with email",
41
+ google_button_text: t("register.oauth.google_button_default"),
42
+ oauth_divider_text: t("shared.oauth_divider_default"),
40
43
  enable_facebook_oauth: false,
41
- facebook_button_text: "Continue with Facebook",
44
+ facebook_button_text: t("shared.oauth.facebook_button_default"),
42
45
  };
43
46
  // Read OAuth error from URL query params (e.g., ?error=AccessDenied)
44
47
  const searchParams = useSearchParams();
@@ -57,13 +60,13 @@ export default function register_layout({ image_src, image_alt, image_background
57
60
  const getOAuthErrorMessage = (error) => {
58
61
  switch (error) {
59
62
  case "AccessDenied":
60
- return "Access was denied. You may have cancelled the sign-in or your account is not authorized.";
63
+ return t("shared.oauth_error.access_denied");
61
64
  case "OAuthSignin":
62
65
  case "OAuthCallback":
63
66
  case "OAuthCreateAccount":
64
- return "Something went wrong with Google sign-in. Please try again.";
67
+ return t("shared.oauth_error.signin_failed");
65
68
  default:
66
- return "An error occurred during sign-in. Please try again.";
69
+ return t("shared.oauth_error.generic");
67
70
  }
68
71
  };
69
72
  const { apiBasePath } = useHazoAuthConfig();
@@ -118,7 +121,7 @@ export default function register_layout({ image_src, image_alt, image_background
118
121
  // Form content — used in both layout modes. See `login_layout` for the
119
122
  // rationale: keeps the form independent of TwoColumnAuthLayout / AuthPageShell
120
123
  // so consumers can compose it into their own brand chrome.
121
- 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_oauth && (_jsx("div", { className: "cls_register_layout_facebook_section", children: _jsx(FacebookSignInButton, { label: oauthConfig.facebook_button_text || "Continue with Facebook", callbackUrl: "/api/hazo_auth/oauth/facebook/callback" }) })), (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && 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), legal_docs.length > 0 && (_jsx("div", { className: "space-y-2", children: legal_display_mode === 'combined' ? (_jsx(LegalDocCombinedView, { docs: legal_docs, accepted: legal_docs.every(doc => form.legal_accepted[doc.key]), onAcceptedChange: (value) => legal_docs.forEach(doc => form.handleLegalAcceptedChange(doc.key, value)) })) : (_jsx(LegalDocCheckboxList, { docs: legal_docs, accepted: form.legal_accepted, onAcceptedChange: form.handleLegalAcceptedChange })) })), _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_oauth) && (_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 })] }))] }));
124
+ 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_oauth && (_jsx("div", { className: "cls_register_layout_facebook_section", children: _jsx(FacebookSignInButton, { label: oauthConfig.facebook_button_text || t("shared.oauth.facebook_button_default"), callbackUrl: "/api/hazo_auth/oauth/facebook/callback" }) })), (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && 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": t("register.aria.form"), children: [renderFields(form), legal_docs.length > 0 && (_jsx("div", { className: "space-y-2", children: legal_display_mode === 'combined' ? (_jsx(LegalDocCombinedView, { docs: legal_docs, accepted: legal_docs.every(doc => form.legal_accepted[doc.key]), onAcceptedChange: (value) => legal_docs.forEach(doc => form.handleLegalAcceptedChange(doc.key, value)) })) : (_jsx(LegalDocCheckboxList, { docs: legal_docs, accepted: form.legal_accepted, onAcceptedChange: form.handleLegalAcceptedChange })) })), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: t("register.aria.submit"), cancelAriaLabel: t("register.aria.cancel") }), _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: t("register.sign_in_prompt") }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": t("register.aria.sign_in_link"), children: signInLabel })] }), form.isSubmitting && (_jsx("div", { className: "cls_register_submitting_indicator text-sm text-slate-600 text-center", children: t("register.submitting_indicator") }))] })), !oauthConfig.enable_email_password && (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && (_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: t("register.sign_in_prompt") }), _jsx(Link, { href: signInPath, className: "cls_register_layout_sign_in_link_text text-primary underline-offset-4 hover:underline", "aria-label": t("register.aria.sign_in_link"), children: signInLabel })] }))] }));
122
125
  // form_only mode: emit just the form content. See login_layout for the
123
126
  // rationale; AlreadyLoggedInGuard is intentionally skipped here.
124
127
  if (layout === "form_only") {
@@ -9,5 +9,5 @@ export declare const createResetPasswordFieldDefinitions: (overrides?: LayoutFie
9
9
  export declare const resolveResetPasswordLabels: (overrides?: LayoutLabelOverrides) => LayoutLabelDefaults;
10
10
  export declare const resolveResetPasswordButtonPalette: (overrides?: ButtonPaletteOverrides) => ButtonPaletteDefaults;
11
11
  export declare const resolveResetPasswordPasswordRequirements: (overrides?: PasswordRequirementOverrides) => PasswordRequirementOptions;
12
- export declare const RESET_PASSWORD_ALREADY_LOGGED_IN_MESSAGE_DEFAULT = "You're already logged in.";
12
+ export declare const RESET_PASSWORD_ALREADY_LOGGED_IN_MESSAGE_DEFAULT: string;
13
13
  //# sourceMappingURL=reset_password_field_config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reset_password_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/reset_password/config/reset_password_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAElC,MAAM,0CAA0C,CAAC;AAGlD,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAC;AAsB5G,eAAO,MAAM,mCAAmC,GAC9C,YAAY,uBAAuB,mBACoC,CAAC;AAU1E,eAAO,MAAM,0BAA0B,GAAI,YAAY,oBAAoB,wBAClB,CAAC;AAU1D,eAAO,MAAM,iCAAiC,GAAI,YAAY,sBAAsB,0BACX,CAAC;AAW1E,eAAO,MAAM,wCAAwC,GACnD,YAAY,4BAA4B,+BAC+C,CAAC;AAG1F,eAAO,MAAM,gDAAgD,8BAA8B,CAAC"}
1
+ {"version":3,"file":"reset_password_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/reset_password/config/reset_password_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAElC,MAAM,0CAA0C,CAAC;AAOlD,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAC;AAsB5G,eAAO,MAAM,mCAAmC,GAC9C,YAAY,uBAAuB,mBACoC,CAAC;AAU1E,eAAO,MAAM,0BAA0B,GAAI,YAAY,oBAAoB,wBAClB,CAAC;AAU1D,eAAO,MAAM,iCAAiC,GAAI,YAAY,sBAAsB,0BACX,CAAC;AAW1E,eAAO,MAAM,wCAAwC,GACnD,YAAY,4BAA4B,+BAC+C,CAAC;AAG1F,eAAO,MAAM,gDAAgD,QAA8C,CAAC"}
@@ -1,4 +1,7 @@
1
1
  import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, resolvePasswordRequirements, } from "../../shared/config/layout_customization.js";
2
+ import en from "../../../../locales/en.json" with { type: "json" };
3
+ import { createPackageT } from "hazo_core/i18n";
4
+ const t = createPackageT("hazo_auth", en);
2
5
  // section: field_identifiers
3
6
  export const RESET_PASSWORD_FIELD_IDS = {
4
7
  PASSWORD: "password",
@@ -8,28 +11,28 @@ export const RESET_PASSWORD_FIELD_IDS = {
8
11
  const RESET_PASSWORD_FIELD_DEFINITIONS = {
9
12
  [RESET_PASSWORD_FIELD_IDS.PASSWORD]: {
10
13
  id: RESET_PASSWORD_FIELD_IDS.PASSWORD,
11
- label: "New password",
14
+ label: t("reset_password.field.password.label"),
12
15
  type: "password",
13
16
  autoComplete: "new-password",
14
- placeholder: "Enter your new password",
15
- ariaLabel: "New password input field",
17
+ placeholder: t("reset_password.field.password.placeholder"),
18
+ ariaLabel: t("reset_password.field.password.aria_label"),
16
19
  },
17
20
  [RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]: {
18
21
  id: RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD,
19
- label: "Confirm new password",
22
+ label: t("reset_password.field.confirm_password.label"),
20
23
  type: "password",
21
24
  autoComplete: "new-password",
22
- placeholder: "Re-enter your new password",
23
- ariaLabel: "Confirm new password input field",
25
+ placeholder: t("reset_password.field.confirm_password.placeholder"),
26
+ ariaLabel: t("reset_password.field.confirm_password.aria_label"),
24
27
  },
25
28
  };
26
29
  export const createResetPasswordFieldDefinitions = (overrides) => resolveFieldDefinitions(RESET_PASSWORD_FIELD_DEFINITIONS, overrides);
27
30
  // section: label_defaults
28
31
  const RESET_PASSWORD_LABEL_DEFAULTS = {
29
- heading: "Reset your password",
30
- subHeading: "Enter your new password below.",
31
- submitButton: "Reset password",
32
- cancelButton: "Cancel",
32
+ heading: t("reset_password.heading"),
33
+ subHeading: t("reset_password.sub_heading"),
34
+ submitButton: t("reset_password.submit_button"),
35
+ cancelButton: t("shared.cancel_button"),
33
36
  };
34
37
  export const resolveResetPasswordLabels = (overrides) => resolveLabels(RESET_PASSWORD_LABEL_DEFAULTS, overrides);
35
38
  // section: button_palette_defaults
@@ -50,4 +53,4 @@ const RESET_PASSWORD_PASSWORD_REQUIREMENT_DEFAULTS = {
50
53
  };
51
54
  export const resolveResetPasswordPasswordRequirements = (overrides) => resolvePasswordRequirements(RESET_PASSWORD_PASSWORD_REQUIREMENT_DEFAULTS, overrides);
52
55
  // section: already_logged_in_label
53
- export const RESET_PASSWORD_ALREADY_LOGGED_IN_MESSAGE_DEFAULT = "You're already logged in.";
56
+ export const RESET_PASSWORD_ALREADY_LOGGED_IN_MESSAGE_DEFAULT = t("shared.guard.already_logged_in_message");
@@ -1 +1 @@
1
- {"version":3,"file":"use_reset_password_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/reset_password/hooks/use_reset_password_form.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAA4B,KAAK,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAW5G,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAC3E,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;AAC/F,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,OAAO,CAAC,oBAAoB,EAAE,UAAU,GAAG,kBAAkB,CAAC,EAC9D,OAAO,CACR,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,OAAO,GAAG,OAAO,IAAI;IAC1D,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,uBAAuB,CAAC;IAChC,MAAM,EAAE,uBAAuB,CAAC;IAChC,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,wBAAwB,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,KAAK,IAAI,CAAC;IAC7E,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AASF,eAAO,MAAM,uBAAuB,GAAI,OAAO,EAAG,kDAI/C,0BAA0B,CAAC,OAAO,CAAC,KAAG,0BA0NxC,CAAC"}
1
+ {"version":3,"file":"use_reset_password_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/reset_password/hooks/use_reset_password_form.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAA4B,KAAK,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAe5G,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAC3E,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;AAC/F,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,OAAO,CAAC,oBAAoB,EAAE,UAAU,GAAG,kBAAkB,CAAC,EAC9D,OAAO,CACR,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,OAAO,GAAG,OAAO,IAAI;IAC1D,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,uBAAuB,CAAC;IAChC,MAAM,EAAE,uBAAuB,CAAC;IAChC,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,wBAAwB,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,KAAK,IAAI,CAAC;IAC7E,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AASF,eAAO,MAAM,uBAAuB,GAAI,OAAO,EAAG,kDAI/C,0BAA0B,CAAC,OAAO,CAAC,KAAG,0BA0NxC,CAAC"}