hazo_auth 10.19.0 → 10.22.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 (238) hide show
  1. package/README.md +6 -0
  2. package/SETUP_CHECKLIST.md +27 -0
  3. package/cli-src/lib/already_logged_in_config.server.ts +11 -7
  4. package/cli-src/lib/auth_hooks.ts +52 -0
  5. package/cli-src/lib/config/config_loader.server.ts +34 -0
  6. package/cli-src/lib/email_verification_config.server.ts +2 -2
  7. package/cli-src/lib/forgot_password_config.server.ts +2 -2
  8. package/cli-src/lib/login_config.server.ts +25 -19
  9. package/cli-src/lib/my_settings_config.server.ts +22 -15
  10. package/cli-src/lib/navbar_config.server.ts +12 -8
  11. package/cli-src/lib/oauth_config.server.ts +14 -22
  12. package/cli-src/lib/otp_config.server.ts +11 -4
  13. package/cli-src/lib/profile_pic_menu_config.server.ts +16 -5
  14. package/cli-src/lib/register_config.server.ts +21 -16
  15. package/cli-src/lib/reset_password_config.server.ts +11 -17
  16. package/cli-src/lib/services/oauth_service.ts +16 -0
  17. package/cli-src/lib/services/otp_service.ts +7 -0
  18. package/cli-src/lib/services/registration_service.ts +8 -0
  19. package/cli-src/lib/ui_shell_config.server.ts +11 -13
  20. package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
  21. package/dist/components/layouts/create_firm/index.js +4 -3
  22. package/dist/components/layouts/dev_lock/index.d.ts.map +1 -1
  23. package/dist/components/layouts/dev_lock/index.js +4 -2
  24. package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts +5 -4
  25. package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -1
  26. package/dist/components/layouts/email_verification/config/email_verification_field_config.js +20 -20
  27. package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
  28. package/dist/components/layouts/email_verification/hooks/use_email_verification.js +5 -7
  29. package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
  30. package/dist/components/layouts/email_verification/index.js +13 -12
  31. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts +3 -2
  32. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -1
  33. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +16 -16
  34. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
  35. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +5 -7
  36. package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
  37. package/dist/components/layouts/forgot_password/index.js +15 -9
  38. package/dist/components/layouts/legal/legal_acceptance_gate.d.ts.map +1 -1
  39. package/dist/components/layouts/legal/legal_acceptance_gate.js +5 -3
  40. package/dist/components/layouts/legal/legal_doc_checkbox_list.d.ts.map +1 -1
  41. package/dist/components/layouts/legal/legal_doc_checkbox_list.js +3 -1
  42. package/dist/components/layouts/legal/legal_doc_combined_view.d.ts.map +1 -1
  43. package/dist/components/layouts/legal/legal_doc_combined_view.js +3 -1
  44. package/dist/components/layouts/login/config/login_field_config.d.ts +3 -2
  45. package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -1
  46. package/dist/components/layouts/login/config/login_field_config.js +24 -24
  47. package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
  48. package/dist/components/layouts/login/hooks/use_login_form.js +5 -7
  49. package/dist/components/layouts/login/index.d.ts +4 -4
  50. package/dist/components/layouts/login/index.d.ts.map +1 -1
  51. package/dist/components/layouts/login/index.js +30 -22
  52. package/dist/components/layouts/my_settings/components/connected_accounts_section.d.ts.map +1 -1
  53. package/dist/components/layouts/my_settings/components/connected_accounts_section.js +5 -5
  54. package/dist/components/layouts/my_settings/components/danger_zone_section.d.ts.map +1 -1
  55. package/dist/components/layouts/my_settings/components/danger_zone_section.js +12 -6
  56. package/dist/components/layouts/my_settings/components/editable_field.d.ts.map +1 -1
  57. package/dist/components/layouts/my_settings/components/editable_field.js +4 -2
  58. package/dist/components/layouts/my_settings/components/language_picker_section.d.ts.map +1 -1
  59. package/dist/components/layouts/my_settings/components/language_picker_section.js +7 -3
  60. package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
  61. package/dist/components/layouts/my_settings/components/password_change_dialog.js +28 -21
  62. package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -1
  63. package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +12 -9
  64. package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts.map +1 -1
  65. package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.js +3 -1
  66. package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +14 -11
  67. package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.d.ts.map +1 -1
  68. package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.js +26 -15
  69. package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
  70. package/dist/components/layouts/my_settings/components/set_password_section.js +9 -6
  71. package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts +2 -1
  72. package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -1
  73. package/dist/components/layouts/my_settings/config/my_settings_field_config.js +4 -7
  74. package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
  75. package/dist/components/layouts/my_settings/index.js +35 -27
  76. package/dist/components/layouts/otp/index.d.ts.map +1 -1
  77. package/dist/components/layouts/otp/index.js +8 -6
  78. package/dist/components/layouts/register/config/register_field_config.d.ts +3 -2
  79. package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -1
  80. package/dist/components/layouts/register/config/register_field_config.js +40 -40
  81. package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
  82. package/dist/components/layouts/register/hooks/use_register_form.js +7 -9
  83. package/dist/components/layouts/register/index.d.ts +4 -4
  84. package/dist/components/layouts/register/index.d.ts.map +1 -1
  85. package/dist/components/layouts/register/index.js +22 -19
  86. package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +4 -3
  87. package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -1
  88. package/dist/components/layouts/reset_password/config/reset_password_field_config.js +7 -10
  89. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
  90. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +4 -6
  91. package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
  92. package/dist/components/layouts/reset_password/index.js +12 -10
  93. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
  94. package/dist/components/layouts/shared/components/already_logged_in_guard.js +6 -5
  95. package/dist/components/layouts/shared/components/auth_navbar.d.ts +1 -1
  96. package/dist/components/layouts/shared/components/auth_navbar.d.ts.map +1 -1
  97. package/dist/components/layouts/shared/components/auth_navbar.js +7 -2
  98. package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -1
  99. package/dist/components/layouts/shared/components/facebook_sign_in_button.js +5 -5
  100. package/dist/components/layouts/shared/components/floating_home_link.d.ts.map +1 -1
  101. package/dist/components/layouts/shared/components/floating_home_link.js +6 -3
  102. package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -1
  103. package/dist/components/layouts/shared/components/form_action_buttons.js +9 -7
  104. package/dist/components/layouts/shared/components/google_sign_in_button.d.ts.map +1 -1
  105. package/dist/components/layouts/shared/components/google_sign_in_button.js +5 -5
  106. package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
  107. package/dist/components/layouts/shared/components/logout_button.js +2 -4
  108. package/dist/components/layouts/shared/components/oauth_divider.d.ts.map +1 -1
  109. package/dist/components/layouts/shared/components/oauth_divider.js +8 -6
  110. package/dist/components/layouts/shared/components/password_field.d.ts.map +1 -1
  111. package/dist/components/layouts/shared/components/password_field.js +2 -3
  112. package/dist/components/layouts/shared/components/profile_pic_menu.d.ts +4 -0
  113. package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
  114. package/dist/components/layouts/shared/components/profile_pic_menu.js +26 -18
  115. package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts +1 -0
  116. package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts.map +1 -1
  117. package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.js +1 -1
  118. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -1
  119. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +3 -1
  120. package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts.map +1 -1
  121. package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +6 -2
  122. package/dist/components/layouts/shared/components/unauthorized_guard.d.ts.map +1 -1
  123. package/dist/components/layouts/shared/components/unauthorized_guard.js +6 -5
  124. package/dist/components/layouts/shared/config/layout_customization.d.ts +2 -1
  125. package/dist/components/layouts/shared/config/layout_customization.d.ts.map +1 -1
  126. package/dist/components/layouts/shared/config/layout_customization.js +18 -7
  127. package/dist/components/layouts/shared/utils/validation.d.ts +5 -2
  128. package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -1
  129. package/dist/components/layouts/shared/utils/validation.js +4 -8
  130. package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
  131. package/dist/components/layouts/user_management/components/roles_matrix.js +2 -4
  132. package/dist/components/layouts/user_management/components/scope_hierarchy_tab.d.ts.map +1 -1
  133. package/dist/components/layouts/user_management/components/scope_hierarchy_tab.js +6 -8
  134. package/dist/components/layouts/user_management/components/user_scopes_tab.d.ts.map +1 -1
  135. package/dist/components/layouts/user_management/components/user_scopes_tab.js +2 -4
  136. package/dist/components/layouts/user_management/index.d.ts.map +1 -1
  137. package/dist/components/layouts/user_management/index.js +2 -4
  138. package/dist/components/otp/OTPRequestForm.d.ts.map +1 -1
  139. package/dist/components/otp/OTPRequestForm.js +7 -5
  140. package/dist/components/otp/OTPVerifyForm.d.ts.map +1 -1
  141. package/dist/components/otp/OTPVerifyForm.js +7 -5
  142. package/dist/components/permission_denied_dialog.client.d.ts.map +1 -1
  143. package/dist/components/permission_denied_dialog.client.js +6 -6
  144. package/dist/components/ui/sheet.d.ts +1 -1
  145. package/dist/components/ui/sidebar.js +5 -5
  146. package/dist/contexts/hazo_auth_config.d.ts +13 -0
  147. package/dist/contexts/hazo_auth_config.d.ts.map +1 -1
  148. package/dist/contexts/hazo_auth_config.js +4 -1
  149. package/dist/contexts/hazo_auth_provider.d.ts +22 -2
  150. package/dist/contexts/hazo_auth_provider.d.ts.map +1 -1
  151. package/dist/contexts/hazo_auth_provider.js +18 -2
  152. package/dist/lib/already_logged_in_config.server.d.ts +4 -2
  153. package/dist/lib/already_logged_in_config.server.d.ts.map +1 -1
  154. package/dist/lib/already_logged_in_config.server.js +7 -5
  155. package/dist/lib/auth_hooks.d.ts +20 -0
  156. package/dist/lib/auth_hooks.d.ts.map +1 -0
  157. package/dist/lib/auth_hooks.js +32 -0
  158. package/dist/lib/config/config_loader.server.d.ts +23 -0
  159. package/dist/lib/config/config_loader.server.d.ts.map +1 -1
  160. package/dist/lib/config/config_loader.server.js +29 -0
  161. package/dist/lib/email_verification_config.server.d.ts +2 -2
  162. package/dist/lib/email_verification_config.server.d.ts.map +1 -1
  163. package/dist/lib/forgot_password_config.server.d.ts +2 -2
  164. package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
  165. package/dist/lib/login_config.server.d.ts +8 -5
  166. package/dist/lib/login_config.server.d.ts.map +1 -1
  167. package/dist/lib/login_config.server.js +13 -6
  168. package/dist/lib/my_settings_config.server.d.ts.map +1 -1
  169. package/dist/lib/my_settings_config.server.js +22 -15
  170. package/dist/lib/navbar_config.server.d.ts +3 -2
  171. package/dist/lib/navbar_config.server.d.ts.map +1 -1
  172. package/dist/lib/navbar_config.server.js +4 -2
  173. package/dist/lib/oauth_config.server.d.ts +6 -6
  174. package/dist/lib/oauth_config.server.d.ts.map +1 -1
  175. package/dist/lib/oauth_config.server.js +8 -4
  176. package/dist/lib/otp_config.server.d.ts +2 -2
  177. package/dist/lib/otp_config.server.d.ts.map +1 -1
  178. package/dist/lib/otp_config.server.js +4 -2
  179. package/dist/lib/profile_pic_menu_config.server.d.ts +6 -2
  180. package/dist/lib/profile_pic_menu_config.server.d.ts.map +1 -1
  181. package/dist/lib/profile_pic_menu_config.server.js +5 -3
  182. package/dist/lib/register_config.server.d.ts +7 -6
  183. package/dist/lib/register_config.server.d.ts.map +1 -1
  184. package/dist/lib/register_config.server.js +8 -4
  185. package/dist/lib/reset_password_config.server.d.ts +6 -4
  186. package/dist/lib/reset_password_config.server.d.ts.map +1 -1
  187. package/dist/lib/reset_password_config.server.js +5 -5
  188. package/dist/lib/services/oauth_service.d.ts.map +1 -1
  189. package/dist/lib/services/oauth_service.js +13 -0
  190. package/dist/lib/services/otp_service.d.ts.map +1 -1
  191. package/dist/lib/services/otp_service.js +6 -0
  192. package/dist/lib/services/registration_service.d.ts.map +1 -1
  193. package/dist/lib/services/registration_service.js +7 -0
  194. package/dist/lib/ui_shell_config.server.d.ts +6 -2
  195. package/dist/lib/ui_shell_config.server.d.ts.map +1 -1
  196. package/dist/lib/ui_shell_config.server.js +5 -3
  197. package/dist/locales/en.json +135 -1
  198. package/dist/server-lib.d.ts +2 -0
  199. package/dist/server-lib.d.ts.map +1 -1
  200. package/dist/server-lib.js +2 -0
  201. package/dist/server_pages/forgot_password.d.ts +3 -2
  202. package/dist/server_pages/forgot_password.d.ts.map +1 -1
  203. package/dist/server_pages/forgot_password.js +8 -7
  204. package/dist/server_pages/forgot_password_client_wrapper.d.ts +2 -1
  205. package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -1
  206. package/dist/server_pages/forgot_password_client_wrapper.js +3 -1
  207. package/dist/server_pages/login.d.ts.map +1 -1
  208. package/dist/server_pages/login.js +9 -7
  209. package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
  210. package/dist/server_pages/login_client_wrapper.js +3 -1
  211. package/dist/server_pages/otp.d.ts +6 -3
  212. package/dist/server_pages/otp.d.ts.map +1 -1
  213. package/dist/server_pages/otp.js +11 -8
  214. package/dist/server_pages/register.d.ts.map +1 -1
  215. package/dist/server_pages/register.js +7 -6
  216. package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
  217. package/dist/server_pages/register_client_wrapper.js +3 -1
  218. package/dist/server_pages/reset_password.d.ts.map +1 -1
  219. package/dist/server_pages/reset_password.js +7 -6
  220. package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -1
  221. package/dist/server_pages/reset_password_client_wrapper.js +3 -1
  222. package/dist/server_pages/verify_email.d.ts.map +1 -1
  223. package/dist/server_pages/verify_email.js +6 -5
  224. package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -1
  225. package/dist/server_pages/verify_email_client_wrapper.js +4 -2
  226. package/dist/strings/default_strings.d.ts +15 -0
  227. package/dist/strings/default_strings.d.ts.map +1 -1
  228. package/dist/strings/default_strings.js +53 -0
  229. package/dist/strings/index.d.ts +1 -1
  230. package/dist/strings/index.d.ts.map +1 -1
  231. package/dist/strings/index.js +1 -1
  232. package/dist/strings/strings_context.d.ts +20 -3
  233. package/dist/strings/strings_context.d.ts.map +1 -1
  234. package/dist/strings/strings_context.js +39 -5
  235. package/dist/strings/strings_provider.d.ts +1 -5
  236. package/dist/strings/strings_provider.d.ts.map +1 -1
  237. package/dist/strings/strings_provider.js +5 -1
  238. package/package.json +10 -6
@@ -4,10 +4,7 @@ import { useCallback, useMemo, useState } from "react";
4
4
  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
- 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);
7
+ import { useHazoAuthConfig, useAuthT } from "../../../../contexts/hazo_auth_provider.js";
11
8
  // section: constants
12
9
  const PASSWORD_FIELDS = [
13
10
  REGISTER_FIELD_IDS.PASSWORD,
@@ -23,6 +20,7 @@ const buildInitialValues = () => ({
23
20
  // section: hook
24
21
  export const use_register_form = ({ showNameField, passwordRequirements, dataClient, urlOnLogon, legalDocs, }) => {
25
22
  const { apiBasePath } = useHazoAuthConfig();
23
+ const t = useAuthT();
26
24
  const initialValues = useMemo(() => buildInitialValues(), []);
27
25
  const [values, setValues] = useState(initialValues);
28
26
  const [errors, setErrors] = useState({});
@@ -89,7 +87,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
89
87
  const updatedErrors = Object.assign({}, previousErrors);
90
88
  // Only validate email on change if it has been touched (blurred)
91
89
  if (fieldId === REGISTER_FIELD_IDS.EMAIL && emailTouched) {
92
- const emailError = validateEmail(value);
90
+ const emailError = validateEmail(value, t);
93
91
  if (emailError) {
94
92
  updatedErrors[REGISTER_FIELD_IDS.EMAIL] = emailError;
95
93
  }
@@ -98,7 +96,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
98
96
  }
99
97
  }
100
98
  if (PASSWORD_FIELDS.includes(fieldId)) {
101
- const passwordError = validatePassword(nextValues[REGISTER_FIELD_IDS.PASSWORD], passwordRequirements);
99
+ const passwordError = validatePassword(nextValues[REGISTER_FIELD_IDS.PASSWORD], passwordRequirements, t);
102
100
  if (passwordError) {
103
101
  updatedErrors[REGISTER_FIELD_IDS.PASSWORD] = passwordError;
104
102
  }
@@ -125,7 +123,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
125
123
  setErrors((previousErrors) => {
126
124
  const updatedErrors = Object.assign({}, previousErrors);
127
125
  const emailValue = values[REGISTER_FIELD_IDS.EMAIL];
128
- const emailError = validateEmail(emailValue);
126
+ const emailError = validateEmail(emailValue, t);
129
127
  if (emailError) {
130
128
  updatedErrors[REGISTER_FIELD_IDS.EMAIL] = emailError;
131
129
  }
@@ -138,8 +136,8 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
138
136
  const handleSubmit = useCallback(async (event) => {
139
137
  event.preventDefault();
140
138
  // Final validation
141
- const emailError = validateEmail(values[REGISTER_FIELD_IDS.EMAIL]);
142
- const passwordError = validatePassword(values[REGISTER_FIELD_IDS.PASSWORD], passwordRequirements);
139
+ const emailError = validateEmail(values[REGISTER_FIELD_IDS.EMAIL], t);
140
+ const passwordError = validatePassword(values[REGISTER_FIELD_IDS.PASSWORD], passwordRequirements, t);
143
141
  if (emailError || passwordError) {
144
142
  setErrors(Object.assign(Object.assign({}, (emailError ? { [REGISTER_FIELD_IDS.EMAIL]: emailError } : {})), (passwordError ? { [REGISTER_FIELD_IDS.PASSWORD]: passwordError } : {})));
145
143
  return;
@@ -6,10 +6,10 @@ export type OAuthLayoutConfig = {
6
6
  enable_google: boolean;
7
7
  /** Enable traditional email/password login */
8
8
  enable_email_password: boolean;
9
- /** Text displayed on the Google sign-in button */
10
- google_button_text: string;
11
- /** Text displayed on the divider between OAuth and email/password form */
12
- oauth_divider_text: string;
9
+ /** Text displayed on the Google sign-in button. Undefined falls back to `t("register.oauth.google_button_default")`. */
10
+ google_button_text?: string;
11
+ /** Text displayed on the divider between OAuth and email/password form. Undefined falls back to `t("shared.oauth_divider_default")`. */
12
+ oauth_divider_text?: string;
13
13
  /** Enable Facebook OAuth login */
14
14
  enable_facebook_oauth?: boolean;
15
15
  /** Text displayed on the Facebook sign-in button */
@@ -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;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"}
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,wHAAwH;IACxH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wIAAwI;IACxI,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,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,sBAAsB,EACtB,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqB,EACrB,cAAoB,EACpB,UAA+B,EAC/B,WAAW,EACX,UAAU,EACV,KAAK,EACL,MAAqB,GACtB,EAAE,mBAAmB,CAAC,OAAO,CAAC,+BA8R9B"}
@@ -21,10 +21,7 @@ import { REGISTER_FIELD_IDS, createRegisterFieldDefinitions, resolveRegisterButt
21
21
  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
- 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);
24
+ import { useHazoAuthConfig, useAuthT } from "../../../contexts/hazo_auth_provider.js";
28
25
  const ORDERED_FIELDS = [
29
26
  REGISTER_FIELD_IDS.NAME,
30
27
  REGISTER_FIELD_IDS.EMAIL,
@@ -32,16 +29,22 @@ const ORDERED_FIELDS = [
32
29
  REGISTER_FIELD_IDS.CONFIRM_PASSWORD,
33
30
  ];
34
31
  // section: component
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", }) {
36
- var _a;
37
- // Default OAuth config: both enabled
38
- const oauthConfig = oauth || {
39
- enable_google: true,
40
- enable_email_password: true,
41
- google_button_text: t("register.oauth.google_button_default"),
42
- oauth_divider_text: t("shared.oauth_divider_default"),
43
- enable_facebook_oauth: false,
44
- facebook_button_text: t("shared.oauth.facebook_button_default"),
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, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel, returnHomePath = "/", signInPath = "/hazo_auth/login", signInLabel, urlOnLogon, oauth, layout = "two_column", }) {
33
+ var _a, _b, _c, _d, _e, _f, _g;
34
+ const t = useAuthT();
35
+ const resolvedAlreadyLoggedInMessage = alreadyLoggedInMessage !== null && alreadyLoggedInMessage !== void 0 ? alreadyLoggedInMessage : t("shared.guard.already_logged_in_prop_default");
36
+ const resolvedReturnHomeButtonLabel = returnHomeButtonLabel !== null && returnHomeButtonLabel !== void 0 ? returnHomeButtonLabel : t("shared.guard.return_home_default");
37
+ const resolvedSignInLabel = signInLabel !== null && signInLabel !== void 0 ? signInLabel : t("shared.sign_in_default");
38
+ // Resolve OAuth config per-field (not `oauth || {defaults}` as a whole
39
+ // object) — see LoginLayout for the full rationale: a partial `oauth` prop
40
+ // must still get `t()`-resolved locale-aware text for any field it left unset.
41
+ const oauthConfig = {
42
+ enable_google: (_a = oauth === null || oauth === void 0 ? void 0 : oauth.enable_google) !== null && _a !== void 0 ? _a : true,
43
+ enable_email_password: (_b = oauth === null || oauth === void 0 ? void 0 : oauth.enable_email_password) !== null && _b !== void 0 ? _b : true,
44
+ google_button_text: (_c = oauth === null || oauth === void 0 ? void 0 : oauth.google_button_text) !== null && _c !== void 0 ? _c : t("register.oauth.google_button_default"),
45
+ oauth_divider_text: (_d = oauth === null || oauth === void 0 ? void 0 : oauth.oauth_divider_text) !== null && _d !== void 0 ? _d : t("shared.oauth_divider_default"),
46
+ enable_facebook_oauth: (_e = oauth === null || oauth === void 0 ? void 0 : oauth.enable_facebook_oauth) !== null && _e !== void 0 ? _e : false,
47
+ facebook_button_text: (_f = oauth === null || oauth === void 0 ? void 0 : oauth.facebook_button_text) !== null && _f !== void 0 ? _f : t("shared.oauth.facebook_button_default"),
45
48
  };
46
49
  // Read OAuth error from URL query params (e.g., ?error=AccessDenied)
47
50
  const searchParams = useSearchParams();
@@ -56,7 +59,7 @@ export default function register_layout({ image_src, image_alt, image_background
56
59
  const oauthCallbackUrl = safeRedirect
57
60
  ? `/api/hazo_auth/oauth/google/callback?next=${encodeURIComponent(safeRedirect)}`
58
61
  : "/api/hazo_auth/oauth/google/callback";
59
- const effectiveUrlOnLogon = (_a = urlOnLogon !== null && urlOnLogon !== void 0 ? urlOnLogon : safeRedirect) !== null && _a !== void 0 ? _a : undefined;
62
+ const effectiveUrlOnLogon = (_g = urlOnLogon !== null && urlOnLogon !== void 0 ? urlOnLogon : safeRedirect) !== null && _g !== void 0 ? _g : undefined;
60
63
  const getOAuthErrorMessage = (error) => {
61
64
  switch (error) {
62
65
  case "AccessDenied":
@@ -84,8 +87,8 @@ export default function register_layout({ image_src, image_alt, image_background
84
87
  })
85
88
  .catch(() => { });
86
89
  }, [apiBasePath]);
87
- const fieldDefinitions = createRegisterFieldDefinitions(field_overrides);
88
- const resolvedLabels = resolveRegisterLabels(labels);
90
+ const fieldDefinitions = createRegisterFieldDefinitions(t, field_overrides);
91
+ const resolvedLabels = resolveRegisterLabels(t, labels);
89
92
  const resolvedButtonPalette = resolveRegisterButtonPalette(button_colors);
90
93
  const resolvedPasswordRequirements = resolveRegisterPasswordRequirements(password_requirements);
91
94
  const form = use_register_form({
@@ -121,13 +124,13 @@ export default function register_layout({ image_src, image_alt, image_background
121
124
  // Form content — used in both layout modes. See `login_layout` for the
122
125
  // rationale: keeps the form independent of TwoColumnAuthLayout / AuthPageShell
123
126
  // so consumers can compose it into their own brand chrome.
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 })] }))] }));
127
+ 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: resolvedSignInLabel })] }), 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: resolvedSignInLabel })] }))] }));
125
128
  // form_only mode: emit just the form content. See login_layout for the
126
129
  // rationale; AlreadyLoggedInGuard is intentionally skipped here.
127
130
  if (layout === "form_only") {
128
131
  return mainContent;
129
132
  }
130
- return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: mainContent }) }));
133
+ return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: resolvedAlreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: resolvedReturnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: mainContent }) }));
131
134
  }
132
135
  // Same-origin path validator. See login/index.tsx for the rationale.
133
136
  function isSafeRedirectPath(value) {
@@ -1,13 +1,14 @@
1
1
  import type { LayoutFieldMap, LayoutFieldMapOverrides } from "../../shared/config/layout_customization";
2
2
  import { type ButtonPaletteDefaults, type ButtonPaletteOverrides, type LayoutLabelDefaults, type LayoutLabelOverrides, type PasswordRequirementOptions, type PasswordRequirementOverrides } from "../../shared/config/layout_customization.js";
3
+ import type { AuthTFunction } from "../../../../contexts/hazo_auth_config";
3
4
  export declare const RESET_PASSWORD_FIELD_IDS: {
4
5
  readonly PASSWORD: "password";
5
6
  readonly CONFIRM_PASSWORD: "confirm_password";
6
7
  };
7
8
  export type ResetPasswordFieldId = (typeof RESET_PASSWORD_FIELD_IDS)[keyof typeof RESET_PASSWORD_FIELD_IDS];
8
- export declare const createResetPasswordFieldDefinitions: (overrides?: LayoutFieldMapOverrides) => LayoutFieldMap;
9
- export declare const resolveResetPasswordLabels: (overrides?: LayoutLabelOverrides) => LayoutLabelDefaults;
9
+ export declare const createResetPasswordFieldDefinitions: (t: AuthTFunction, overrides?: LayoutFieldMapOverrides) => LayoutFieldMap;
10
+ export declare const resolveResetPasswordLabels: (t: AuthTFunction, overrides?: LayoutLabelOverrides) => LayoutLabelDefaults;
10
11
  export declare const resolveResetPasswordButtonPalette: (overrides?: ButtonPaletteOverrides) => ButtonPaletteDefaults;
11
12
  export declare const resolveResetPasswordPasswordRequirements: (overrides?: PasswordRequirementOverrides) => PasswordRequirementOptions;
12
- export declare const RESET_PASSWORD_ALREADY_LOGGED_IN_MESSAGE_DEFAULT: string;
13
+ export declare const getResetPasswordAlreadyLoggedInMessageDefault: (t: AuthTFunction) => string;
13
14
  //# 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;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
+ {"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;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAG3E,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,GAAG,aAAa,EAChB,YAAY,uBAAuB,mBACyC,CAAC;AAU/E,eAAO,MAAM,0BAA0B,GAAI,GAAG,aAAa,EAAE,YAAY,oBAAoB,wBAC/B,CAAC;AAU/D,eAAO,MAAM,iCAAiC,GAAI,YAAY,sBAAsB,0BACX,CAAC;AAW1E,eAAO,MAAM,wCAAwC,GACnD,YAAY,4BAA4B,+BAC+C,CAAC;AAG1F,eAAO,MAAM,6CAA6C,GAAI,GAAG,aAAa,WACjC,CAAC"}
@@ -1,14 +1,11 @@
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);
5
2
  // section: field_identifiers
6
3
  export const RESET_PASSWORD_FIELD_IDS = {
7
4
  PASSWORD: "password",
8
5
  CONFIRM_PASSWORD: "confirm_password",
9
6
  };
10
7
  // section: field_definitions
11
- const RESET_PASSWORD_FIELD_DEFINITIONS = {
8
+ const buildResetPasswordFieldDefinitions = (t) => ({
12
9
  [RESET_PASSWORD_FIELD_IDS.PASSWORD]: {
13
10
  id: RESET_PASSWORD_FIELD_IDS.PASSWORD,
14
11
  label: t("reset_password.field.password.label"),
@@ -25,16 +22,16 @@ const RESET_PASSWORD_FIELD_DEFINITIONS = {
25
22
  placeholder: t("reset_password.field.confirm_password.placeholder"),
26
23
  ariaLabel: t("reset_password.field.confirm_password.aria_label"),
27
24
  },
28
- };
29
- export const createResetPasswordFieldDefinitions = (overrides) => resolveFieldDefinitions(RESET_PASSWORD_FIELD_DEFINITIONS, overrides);
25
+ });
26
+ export const createResetPasswordFieldDefinitions = (t, overrides) => resolveFieldDefinitions(buildResetPasswordFieldDefinitions(t), overrides);
30
27
  // section: label_defaults
31
- const RESET_PASSWORD_LABEL_DEFAULTS = {
28
+ const buildResetPasswordLabelDefaults = (t) => ({
32
29
  heading: t("reset_password.heading"),
33
30
  subHeading: t("reset_password.sub_heading"),
34
31
  submitButton: t("reset_password.submit_button"),
35
32
  cancelButton: t("shared.cancel_button"),
36
- };
37
- export const resolveResetPasswordLabels = (overrides) => resolveLabels(RESET_PASSWORD_LABEL_DEFAULTS, overrides);
33
+ });
34
+ export const resolveResetPasswordLabels = (t, overrides) => resolveLabels(buildResetPasswordLabelDefaults(t), overrides);
38
35
  // section: button_palette_defaults
39
36
  const RESET_PASSWORD_BUTTON_PALETTE_DEFAULTS = {
40
37
  submitBackground: "#0f172a",
@@ -53,4 +50,4 @@ const RESET_PASSWORD_PASSWORD_REQUIREMENT_DEFAULTS = {
53
50
  };
54
51
  export const resolveResetPasswordPasswordRequirements = (overrides) => resolvePasswordRequirements(RESET_PASSWORD_PASSWORD_REQUIREMENT_DEFAULTS, overrides);
55
52
  // section: already_logged_in_label
56
- export const RESET_PASSWORD_ALREADY_LOGGED_IN_MESSAGE_DEFAULT = t("shared.guard.already_logged_in_message");
53
+ export const getResetPasswordAlreadyLoggedInMessageDefault = (t) => 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;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"}
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,0BA2NxC,CAAC"}
@@ -5,10 +5,7 @@ import { useSearchParams, useRouter } from "next/navigation";
5
5
  import { toast } from "sonner";
6
6
  import { RESET_PASSWORD_FIELD_IDS } from "../config/reset_password_field_config.js";
7
7
  import { validatePassword } from "../../shared/utils/validation.js";
8
- import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
9
- import en from "../../../../locales/en.json" with { type: "json" };
10
- import { createPackageT } from "hazo_core/i18n";
11
- const t = createPackageT("hazo_auth", en);
8
+ import { useHazoAuthConfig, useAuthT } from "../../../../contexts/hazo_auth_provider.js";
12
9
  // section: constants
13
10
  const PASSWORD_FIELDS = [
14
11
  RESET_PASSWORD_FIELD_IDS.PASSWORD,
@@ -22,6 +19,7 @@ const buildInitialValues = () => ({
22
19
  // section: hook
23
20
  export const use_reset_password_form = ({ passwordRequirements, dataClient, loginPath = "/hazo_auth/login", }) => {
24
21
  const { apiBasePath } = useHazoAuthConfig();
22
+ const t = useAuthT();
25
23
  const router = useRouter();
26
24
  const searchParams = useSearchParams();
27
25
  const tokenParam = searchParams.get("token");
@@ -95,7 +93,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
95
93
  }
96
94
  // Validate password fields in real-time
97
95
  if (fieldId === RESET_PASSWORD_FIELD_IDS.PASSWORD) {
98
- const passwordError = validatePassword(value, passwordRequirements);
96
+ const passwordError = validatePassword(value, passwordRequirements, t);
99
97
  if (passwordError) {
100
98
  setErrors((prev) => (Object.assign(Object.assign({}, prev), { [RESET_PASSWORD_FIELD_IDS.PASSWORD]: passwordError })));
101
99
  }
@@ -143,7 +141,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
143
141
  return;
144
142
  }
145
143
  // Validate all fields
146
- const passwordError = validatePassword(values[RESET_PASSWORD_FIELD_IDS.PASSWORD], passwordRequirements);
144
+ const passwordError = validatePassword(values[RESET_PASSWORD_FIELD_IDS.PASSWORD], passwordRequirements, t);
147
145
  const confirmPasswordError = values[RESET_PASSWORD_FIELD_IDS.PASSWORD] !== values[RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]
148
146
  ? t("validation.passwords_do_not_match")
149
147
  : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/reset_password/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,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;AAQ1E,MAAM,MAAM,wBAAwB,CAAC,OAAO,GAAG,OAAO,IAAI;IACxD,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,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,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,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,OAAO,EAAE,EACrD,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,gBAAuB,EACvB,oBAA4B,EAC5B,qBAA6D,EAC7D,cAAoB,EACpB,YAAuD,EACvD,cAA4D,EAC5D,SAA8B,EAC9B,kBAAiD,GAClD,EAAE,wBAAwB,CAAC,OAAO,CAAC,+BAqNnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/reset_password/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,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;AAK1E,MAAM,MAAM,wBAAwB,CAAC,OAAO,GAAG,OAAO,IAAI;IACxD,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,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,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,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,OAAO,EAAE,EACrD,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqB,EACrB,cAAoB,EACpB,YAAY,EACZ,cAAc,EACd,SAA8B,EAC9B,kBAAiD,GAClD,EAAE,wBAAwB,CAAC,OAAO,CAAC,+BA0NnC"}
@@ -13,17 +13,19 @@ import { AlreadyLoggedInGuard } from "../shared/components/already_logged_in_gua
13
13
  import { RESET_PASSWORD_FIELD_IDS, createResetPasswordFieldDefinitions, resolveResetPasswordButtonPalette, resolveResetPasswordLabels, resolveResetPasswordPasswordRequirements, } from "./config/reset_password_field_config.js";
14
14
  import { use_reset_password_form, } from "./hooks/use_reset_password_form.js";
15
15
  import Link from "next/link";
16
- import en from "../../../locales/en.json" with { type: "json" };
17
- import { createPackageT } from "hazo_core/i18n";
18
- const t = createPackageT("hazo_auth", en);
16
+ import { useAuthT } from "../../../contexts/hazo_auth_provider.js";
19
17
  const ORDERED_FIELDS = [
20
18
  RESET_PASSWORD_FIELD_IDS.PASSWORD,
21
19
  RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD,
22
20
  ];
23
21
  // section: component
24
- export default function reset_password_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, password_requirements, data_client, alreadyLoggedInMessage, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = t("shared.guard.return_home_default"), returnHomePath = "/", errorMessage = t("reset_password.link_invalid_message"), successMessage = t("reset_password.success_message_default"), loginPath = "/hazo_auth/login", forgotPasswordPath = "/hazo_auth/forgot_password", }) {
25
- const fieldDefinitions = createResetPasswordFieldDefinitions(field_overrides);
26
- const resolvedLabels = resolveResetPasswordLabels(labels);
22
+ export default function reset_password_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, password_requirements, data_client, alreadyLoggedInMessage, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel, returnHomePath = "/", errorMessage, successMessage, loginPath = "/hazo_auth/login", forgotPasswordPath = "/hazo_auth/forgot_password", }) {
23
+ const t = useAuthT();
24
+ const resolvedReturnHomeButtonLabel = returnHomeButtonLabel !== null && returnHomeButtonLabel !== void 0 ? returnHomeButtonLabel : t("shared.guard.return_home_default");
25
+ const resolvedErrorMessage = errorMessage !== null && errorMessage !== void 0 ? errorMessage : t("reset_password.link_invalid_message");
26
+ const resolvedSuccessMessage = successMessage !== null && successMessage !== void 0 ? successMessage : t("reset_password.success_message_default");
27
+ const fieldDefinitions = createResetPasswordFieldDefinitions(t, field_overrides);
28
+ const resolvedLabels = resolveResetPasswordLabels(t, labels);
27
29
  const resolvedButtonPalette = resolveResetPasswordButtonPalette(button_colors);
28
30
  const resolvedPasswordRequirements = resolveResetPasswordPasswordRequirements(password_requirements);
29
31
  const form = use_reset_password_form({
@@ -42,15 +44,15 @@ export default function reset_password_layout({ image_src, image_alt, image_back
42
44
  };
43
45
  // Show success message if password reset was successful
44
46
  if (form.isSuccess) {
45
- return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("div", { className: "cls_reset_password_layout_success flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(CheckCircle, { className: "cls_reset_password_layout_success_icon h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsx("p", { className: "cls_reset_password_layout_success_message text-lg font-medium text-slate-900", children: successMessage })] })] }) }) }));
47
+ return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: resolvedReturnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("div", { className: "cls_reset_password_layout_success flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(CheckCircle, { className: "cls_reset_password_layout_success_icon h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsx("p", { className: "cls_reset_password_layout_success_message text-lg font-medium text-slate-900", children: resolvedSuccessMessage })] })] }) }) }));
46
48
  }
47
49
  // Show loading state while validating token
48
50
  if (form.isValidatingToken) {
49
- return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_validating 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_reset_password_layout_validating_text text-center", children: [_jsx("h1", { className: "cls_reset_password_layout_validating_heading text-2xl font-semibold text-slate-900", children: resolvedLabels.heading }), _jsx("p", { className: "cls_reset_password_layout_validating_subheading mt-2 text-sm text-slate-600", children: t("reset_password.validating_message") })] })] }) }) }));
51
+ return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: resolvedReturnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_validating 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_reset_password_layout_validating_text text-center", children: [_jsx("h1", { className: "cls_reset_password_layout_validating_heading text-2xl font-semibold text-slate-900", children: resolvedLabels.heading }), _jsx("p", { className: "cls_reset_password_layout_validating_subheading mt-2 text-sm text-slate-600", children: t("reset_password.validating_message") })] })] }) }) }));
50
52
  }
51
53
  // Show error message if token is invalid or missing
52
54
  if (form.tokenError || !form.token) {
53
- return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_error flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(XCircle, { className: "cls_reset_password_layout_error_icon h-16 w-16 text-red-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_reset_password_layout_error_text", children: [_jsx("h1", { className: "cls_reset_password_layout_error_heading text-2xl font-semibold text-slate-900", children: t("reset_password.invalid_link_heading") }), _jsx("p", { className: "cls_reset_password_layout_error_message mt-2 text-sm text-slate-600", children: form.tokenError || errorMessage })] }), _jsx(Link, { href: forgotPasswordPath, className: "cls_reset_password_layout_forgot_password_link mt-4 text-sm text-blue-600 hover:text-blue-800 underline", children: t("reset_password.invalid_link_page_link") })] }) }) }));
55
+ return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: resolvedReturnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_error flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(XCircle, { className: "cls_reset_password_layout_error_icon h-16 w-16 text-red-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_reset_password_layout_error_text", children: [_jsx("h1", { className: "cls_reset_password_layout_error_heading text-2xl font-semibold text-slate-900", children: t("reset_password.invalid_link_heading") }), _jsx("p", { className: "cls_reset_password_layout_error_message mt-2 text-sm text-slate-600", children: form.tokenError || resolvedErrorMessage })] }), _jsx(Link, { href: forgotPasswordPath, className: "cls_reset_password_layout_forgot_password_link mt-4 text-sm text-blue-600 hover:text-blue-800 underline", children: t("reset_password.invalid_link_page_link") })] }) }) }));
54
56
  }
55
- return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("form", { className: "cls_reset_password_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": t("reset_password.aria.form"), children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: t("reset_password.aria.submit"), cancelAriaLabel: t("reset_password.aria.cancel") }), form.isSubmitting && (_jsx("div", { className: "cls_reset_password_layout_submitting_indicator text-sm text-slate-600 text-center", children: t("reset_password.submitting_indicator") }))] })] }) }) }));
57
+ return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: resolvedReturnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("form", { className: "cls_reset_password_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": t("reset_password.aria.form"), children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: t("reset_password.aria.submit"), cancelAriaLabel: t("reset_password.aria.cancel") }), form.isSubmitting && (_jsx("div", { className: "cls_reset_password_layout_submitting_indicator text-sm text-slate-600 text-center", children: t("reset_password.submitting_indicator") }))] })] }) }) }));
56
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"already_logged_in_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/already_logged_in_guard.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,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,OAAO,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,OAAqD,EACrD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAA6D,EAC7D,cAAoB,EACpB,oBAA4B,EAC5B,QAAQ,GACT,EAAE,yBAAyB,+BAiD3B"}
1
+ {"version":3,"file":"already_logged_in_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/already_logged_in_guard.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,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,OAAO,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,OAAO,EACP,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqB,EACrB,cAAoB,EACpB,oBAA4B,EAC5B,QAAQ,GACT,EAAE,yBAAyB,+BAoD3B"}
@@ -9,9 +9,7 @@ import { Button } from "../../../ui/button.js";
9
9
  import { TwoColumnAuthLayout } from "./two_column_auth_layout.js";
10
10
  import { useRouter } from "next/navigation";
11
11
  import { Home } from "lucide-react";
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
+ import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
15
13
  // section: component
16
14
  /**
17
15
  * Guard component that shows "already logged in" message if user is authenticated
@@ -19,7 +17,10 @@ const t = createPackageT("hazo_auth", en);
19
17
  * @param props - Component props including layout config and message customization
20
18
  * @returns Either the "already logged in" UI or the children
21
19
  */
22
- export function AlreadyLoggedInGuard({ image_src, image_alt, image_background_color = "#f1f5f9", message = t("shared.guard.already_logged_in_message"), showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = t("shared.guard.return_home_default"), returnHomePath = "/", requireEmailVerified = false, children, }) {
20
+ export function AlreadyLoggedInGuard({ image_src, image_alt, image_background_color = "#f1f5f9", message, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel, returnHomePath = "/", requireEmailVerified = false, children, }) {
21
+ const t = useAuthT();
22
+ const resolvedMessage = message !== null && message !== void 0 ? message : t("shared.guard.already_logged_in_message");
23
+ const resolvedReturnHomeButtonLabel = returnHomeButtonLabel !== null && returnHomeButtonLabel !== void 0 ? returnHomeButtonLabel : t("shared.guard.return_home_default");
23
24
  const router = useRouter();
24
25
  const authStatus = use_auth_status();
25
26
  // Check if user should see "already logged in" message
@@ -29,7 +30,7 @@ export function AlreadyLoggedInGuard({ image_src, image_alt, image_background_co
29
30
  !authStatus.loading &&
30
31
  (!requireEmailVerified || authStatus.email_verified === true);
31
32
  if (shouldShowAlreadyLoggedIn) {
32
- return (_jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_already_logged_in_guard flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx("p", { className: "cls_already_logged_in_guard_message text-lg font-medium text-slate-900", children: message }), _jsxs("div", { className: "cls_already_logged_in_guard_actions flex flex-col gap-3 items-center mt-4", children: [showLogoutButton && (_jsx(LogoutButton, { className: "cls_already_logged_in_guard_logout_button", variant: "default" })), showReturnHomeButton && (_jsxs(Button, { onClick: () => router.push(returnHomePath), variant: "outline", className: "cls_already_logged_in_guard_return_home_button", "aria-label": returnHomeButtonLabel, children: [_jsx(Home, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), returnHomeButtonLabel] }))] })] }) }));
33
+ return (_jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_already_logged_in_guard flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx("p", { className: "cls_already_logged_in_guard_message text-lg font-medium text-slate-900", children: resolvedMessage }), _jsxs("div", { className: "cls_already_logged_in_guard_actions flex flex-col gap-3 items-center mt-4", children: [showLogoutButton && (_jsx(LogoutButton, { className: "cls_already_logged_in_guard_logout_button", variant: "default" })), showReturnHomeButton && (_jsxs(Button, { onClick: () => router.push(returnHomePath), variant: "outline", className: "cls_already_logged_in_guard_return_home_button", "aria-label": resolvedReturnHomeButtonLabel, children: [_jsx(Home, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), resolvedReturnHomeButtonLabel] }))] })] }) }));
33
34
  }
34
35
  return _jsx(_Fragment, { children: children });
35
36
  }
@@ -9,7 +9,7 @@ export type AuthNavbarProps = {
9
9
  company_name?: string;
10
10
  /** Home link path */
11
11
  home_path?: string;
12
- /** Home link label */
12
+ /** Home link label. Undefined falls back to `t("navbar.home_label_default")`. */
13
13
  home_label?: string;
14
14
  /** Show home link */
15
15
  show_home_link?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"auth_navbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/auth_navbar.tsx"],"names":[],"mappings":"AAWA,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8BAA8B;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,wBAAgB,UAAU,CAAC,EACzB,SAAc,EACd,UAAe,EACf,WAAgB,EAChB,YAAiB,EACjB,SAAe,EACf,UAAmB,EACnB,cAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,MAAW,EACX,SAAS,GACV,EAAE,eAAe,+BAoDjB"}
1
+ {"version":3,"file":"auth_navbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/auth_navbar.tsx"],"names":[],"mappings":"AAYA,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8BAA8B;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,wBAAgB,UAAU,CAAC,EACzB,SAAc,EACd,UAAe,EACf,WAAgB,EAChB,YAAiB,EACjB,SAAe,EACf,UAAU,EACV,cAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,MAAW,EACX,SAAS,GACV,EAAE,eAAe,+BA0DjB"}
@@ -7,11 +7,16 @@ import Link from "next/link";
7
7
  import Image from "next/image";
8
8
  import { Home } from "lucide-react";
9
9
  import { cn } from "../../../../lib/utils.js";
10
+ import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
10
11
  // section: component
11
- export function AuthNavbar({ logo_path = "", logo_width = 28, logo_height = 28, company_name = "", home_path = "/", home_label = "Home", show_home_link = true, background_color, text_color, height = 40, className, }) {
12
+ export function AuthNavbar({ logo_path = "", logo_width = 28, logo_height = 28, company_name = "", home_path = "/", home_label, show_home_link = true, background_color, text_color, height = 40, className, }) {
13
+ const t = useAuthT();
14
+ const resolvedHomeLabel = home_label !== null && home_label !== void 0 ? home_label : t("navbar.home_label_default");
12
15
  // Only show logo if logo_path is configured (non-empty)
13
16
  const showLogo = logo_path !== "";
14
17
  const hasBrand = showLogo || company_name !== "";
15
18
  const navStyle = Object.assign(Object.assign({ height: `${height}px` }, (background_color && { backgroundColor: background_color })), (text_color && { color: text_color }));
16
- return (_jsx("nav", { className: cn("cls_auth_navbar flex w-full items-center justify-between border-b border-border/40 bg-background/95 px-4 backdrop-blur supports-[backdrop-filter]:bg-background/60", className), style: navStyle, "aria-label": "Authentication page navigation", children: _jsxs("div", { className: "cls_auth_navbar_brand flex items-center gap-3", children: [hasBrand && (_jsxs(Link, { href: home_path, className: "cls_auth_navbar_logo_link flex items-center gap-3", children: [showLogo && (_jsx(Image, { src: logo_path, alt: company_name ? `${company_name} logo` : "Logo", width: logo_width, height: logo_height, className: "cls_auth_navbar_logo object-contain" })), company_name && (_jsx("span", { className: "cls_auth_navbar_company_name text-lg font-semibold text-foreground", children: company_name }))] })), !hasBrand && show_home_link && (_jsxs(Link, { href: home_path, className: "cls_auth_navbar_home_link flex items-center gap-2 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground", "aria-label": `Navigate to ${home_label}`, children: [_jsx(Home, { className: "h-4 w-4", "aria-hidden": "true" }), _jsx("span", { children: home_label })] }))] }) }));
19
+ return (_jsx("nav", { className: cn("cls_auth_navbar flex w-full items-center justify-between border-b border-border/40 bg-background/95 px-4 backdrop-blur supports-[backdrop-filter]:bg-background/60", className), style: navStyle, "aria-label": t("navbar.aria.navigation_default"), children: _jsxs("div", { className: "cls_auth_navbar_brand flex items-center gap-3", children: [hasBrand && (_jsxs(Link, { href: home_path, className: "cls_auth_navbar_logo_link flex items-center gap-3", children: [showLogo && (_jsx(Image, { src: logo_path, alt: company_name
20
+ ? t("navbar.company_logo_alt_default", { company_name })
21
+ : t("navbar.logo_alt_default"), width: logo_width, height: logo_height, className: "cls_auth_navbar_logo object-contain" })), company_name && (_jsx("span", { className: "cls_auth_navbar_company_name text-lg font-semibold text-foreground", children: company_name }))] })), !hasBrand && show_home_link && (_jsxs(Link, { href: home_path, className: "cls_auth_navbar_home_link flex items-center gap-2 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground", "aria-label": t("navbar.aria.navigate_to_default", { label: resolvedHomeLabel }), children: [_jsx(Home, { className: "h-4 w-4", "aria-hidden": "true" }), _jsx("span", { children: resolvedHomeLabel })] }))] }) }));
17
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"facebook_sign_in_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/facebook_sign_in_button.tsx"],"names":[],"mappings":"AAyBA,MAAM,MAAM,yBAAyB,GAAG;IACtC,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAiD,EACjD,OAAO,EACP,QAAgB,EAChB,SAAS,EACT,WAAsD,GACvD,EAAE,yBAAyB,+BA6C3B;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"facebook_sign_in_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/facebook_sign_in_button.tsx"],"names":[],"mappings":"AAsBA,MAAM,MAAM,yBAAyB,GAAG;IACtC,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,OAAO,EACP,QAAgB,EAChB,SAAS,EACT,WAAsD,GACvD,EAAE,yBAAyB,+BA+C3B;AAED,eAAe,oBAAoB,CAAC"}
@@ -8,9 +8,7 @@ import { cn } from "../../../../lib/utils.js";
8
8
  import { useState } from "react";
9
9
  import { Loader2 } from "lucide-react";
10
10
  import { signIn } from "next-auth/react";
11
- import en from "../../../../locales/en.json" with { type: "json" };
12
- import { createPackageT } from "hazo_core/i18n";
13
- const t = createPackageT("hazo_auth", en);
11
+ import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
14
12
  // Facebook "f" icon as inline SVG (no external dep)
15
13
  function FacebookIcon({ className }) {
16
14
  return (_jsx("svg", { className: cn("h-5 w-5", className), viewBox: "0 0 24 24", fill: "#1877F2", "aria-hidden": "true", children: _jsx("path", { d: "M24 12.073C24 5.404 18.627 0 12 0S0 5.404 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047V9.413c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z" }) }));
@@ -22,7 +20,9 @@ function FacebookIcon({ className }) {
22
20
  * Initiates the Facebook OAuth flow when clicked
23
21
  * Uses next-auth/react signIn function for proper OAuth flow
24
22
  */
25
- export function FacebookSignInButton({ label = t("shared.oauth.facebook_button_default"), onClick, disabled = false, className, callbackUrl = "/api/hazo_auth/oauth/facebook/callback", }) {
23
+ export function FacebookSignInButton({ label, onClick, disabled = false, className, callbackUrl = "/api/hazo_auth/oauth/facebook/callback", }) {
24
+ const t = useAuthT();
25
+ const resolvedLabel = label !== null && label !== void 0 ? label : t("shared.oauth.facebook_button_default");
26
26
  const [isLoading, setIsLoading] = useState(false);
27
27
  const handleClick = async () => {
28
28
  if (disabled || isLoading)
@@ -45,6 +45,6 @@ export function FacebookSignInButton({ label = t("shared.oauth.facebook_button_d
45
45
  }
46
46
  }
47
47
  };
48
- return (_jsxs(Button, { type: "button", variant: "outline", onClick: handleClick, disabled: disabled || isLoading, className: cn("cls_facebook_sign_in_button w-full flex items-center justify-center gap-3 h-11 border-slate-300 hover:bg-slate-50 hover:border-slate-400 transition-colors", className), "aria-label": label, children: [isLoading ? (_jsx(Loader2, { className: "h-5 w-5 animate-spin text-slate-600", "aria-hidden": "true" })) : (_jsx(FacebookIcon, { className: "h-5 w-5" })), _jsx("span", { className: "text-slate-700 font-medium", children: isLoading ? t("shared.oauth.signing_in") : label })] }));
48
+ return (_jsxs(Button, { type: "button", variant: "outline", onClick: handleClick, disabled: disabled || isLoading, className: cn("cls_facebook_sign_in_button w-full flex items-center justify-center gap-3 h-11 border-slate-300 hover:bg-slate-50 hover:border-slate-400 transition-colors", className), "aria-label": resolvedLabel, children: [isLoading ? (_jsx(Loader2, { className: "h-5 w-5 animate-spin text-slate-600", "aria-hidden": "true" })) : (_jsx(FacebookIcon, { className: "h-5 w-5" })), _jsx("span", { className: "text-slate-700 font-medium", children: isLoading ? t("shared.oauth.signing_in") : resolvedLabel })] }));
49
49
  }
50
50
  export default FacebookSignInButton;
@@ -1 +1 @@
1
- {"version":3,"file":"floating_home_link.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/floating_home_link.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,qBAAqB,GAAG;IAClC,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAU,EACV,KAAsB,EACtB,SAAS,GACV,EAAE,qBAAqB,+BAoBvB;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"floating_home_link.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/floating_home_link.tsx"],"names":[],"mappings":"AAWA,MAAM,MAAM,qBAAqB,GAAG;IAClC,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAU,EACV,KAAK,EACL,SAAS,GACV,EAAE,qBAAqB,+BAsBvB;AAED,eAAe,gBAAgB,CAAC"}
@@ -6,6 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import Link from "next/link";
7
7
  import { ArrowLeft } from "lucide-react";
8
8
  import { cn } from "../../../../lib/utils.js";
9
+ import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
9
10
  // section: component
10
11
  /**
11
12
  * Floating "← Back to home" link. Renders fixed top-left of the viewport so
@@ -16,14 +17,16 @@ import { cn } from "../../../../lib/utils.js";
16
17
  * Reads label/path from props so consumers can localise — the navbar config
17
18
  * helper `get_navbar_config()` is the typical source on the server side.
18
19
  */
19
- export function FloatingHomeLink({ path = "/", label = "Back to home", className, }) {
20
- return (_jsxs(Link, { href: path, "aria-label": label, className: cn(
20
+ export function FloatingHomeLink({ path = "/", label, className, }) {
21
+ const t = useAuthT();
22
+ const resolvedLabel = label !== null && label !== void 0 ? label : t("shared.floating_home_link.label");
23
+ return (_jsxs(Link, { href: path, "aria-label": resolvedLabel, className: cn(
21
24
  // Positioning: fixed top-left, above auth content, with a healthy
22
25
  // safe-area margin so it never collides with brand-panel chrome.
23
26
  "cls_floating_home_link fixed left-4 top-4 z-50 inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-sm font-medium",
24
27
  // Visuals: subtle pill that adapts to whatever brand backdrop the
25
28
  // consumer has rendered. Uses neutral text so it works on both light
26
29
  // brand panels and dark ones.
27
- "bg-background/70 text-foreground/80 shadow-sm backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground", className), children: [_jsx(ArrowLeft, { className: "h-4 w-4", "aria-hidden": "true" }), _jsx("span", { children: label })] }));
30
+ "bg-background/70 text-foreground/80 shadow-sm backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground", className), children: [_jsx(ArrowLeft, { className: "h-4 w-4", "aria-hidden": "true" }), _jsx("span", { children: resolvedLabel })] }));
28
31
  }
29
32
  export default FloatingHomeLink;
@@ -1 +1 @@
1
- {"version":3,"file":"form_action_buttons.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/form_action_buttons.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAO5E,KAAK,sBAAsB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,qBAAqB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAGF,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,WAAuC,EACvC,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,eAA6D,EAC7D,eAA6D,EAC7D,SAAS,EACT,UAAkB,GACnB,EAAE,sBAAsB,+BAoCxB"}
1
+ {"version":3,"file":"form_action_buttons.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/form_action_buttons.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAI5E,KAAK,sBAAsB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,qBAAqB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAGF,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,SAAS,EACT,UAAkB,GACnB,EAAE,sBAAsB,+BAwCxB"}
@@ -3,16 +3,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // section: imports
4
4
  import { CircleCheckBig, CircleX } from "lucide-react";
5
5
  import { Button } from "../../../ui/button.js";
6
- import en from "../../../../locales/en.json" with { type: "json" };
7
- import { createPackageT } from "hazo_core/i18n";
8
- const t = createPackageT("hazo_auth", en);
6
+ import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
9
7
  // section: component
10
- export function FormActionButtons({ submitLabel, cancelLabel = t("shared.cancel_button"), buttonPalette, isSubmitDisabled, onCancel, submitAriaLabel = t("shared.form_action.submit_aria_default"), cancelAriaLabel = t("shared.form_action.cancel_aria_default"), className, hideCancel = false, }) {
11
- return (_jsxs("div", { className: `cls_form_action_buttons mt-2 flex flex-wrap items-center justify-end gap-4 ${className !== null && className !== void 0 ? className : ""}`, children: [_jsxs(Button, { type: "submit", disabled: isSubmitDisabled, className: "cls_form_action_submit_button flex shrink-0 items-center gap-2", "aria-label": submitAriaLabel, style: {
8
+ export function FormActionButtons({ submitLabel, cancelLabel, buttonPalette, isSubmitDisabled, onCancel, submitAriaLabel, cancelAriaLabel, className, hideCancel = false, }) {
9
+ const t = useAuthT();
10
+ const resolvedCancelLabel = cancelLabel !== null && cancelLabel !== void 0 ? cancelLabel : t("shared.cancel_button");
11
+ const resolvedSubmitAriaLabel = submitAriaLabel !== null && submitAriaLabel !== void 0 ? submitAriaLabel : t("shared.form_action.submit_aria_default");
12
+ const resolvedCancelAriaLabel = cancelAriaLabel !== null && cancelAriaLabel !== void 0 ? cancelAriaLabel : t("shared.form_action.cancel_aria_default");
13
+ return (_jsxs("div", { className: `cls_form_action_buttons mt-2 flex flex-wrap items-center justify-end gap-4 ${className !== null && className !== void 0 ? className : ""}`, children: [_jsxs(Button, { type: "submit", disabled: isSubmitDisabled, className: "cls_form_action_submit_button flex shrink-0 items-center gap-2", "aria-label": resolvedSubmitAriaLabel, style: {
12
14
  backgroundColor: buttonPalette.submitBackground,
13
15
  color: buttonPalette.submitText,
14
- }, children: [_jsx(CircleCheckBig, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: submitLabel })] }), !hideCancel && onCancel && (_jsxs(Button, { type: "button", variant: "outline", onClick: onCancel, className: "cls_form_action_cancel_button flex shrink-0 items-center gap-2", "aria-label": cancelAriaLabel, style: {
16
+ }, children: [_jsx(CircleCheckBig, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: submitLabel })] }), !hideCancel && onCancel && (_jsxs(Button, { type: "button", variant: "outline", onClick: onCancel, className: "cls_form_action_cancel_button flex shrink-0 items-center gap-2", "aria-label": resolvedCancelAriaLabel, style: {
15
17
  borderColor: buttonPalette.cancelBorder,
16
18
  color: buttonPalette.cancelText,
17
- }, children: [_jsx(CircleX, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: cancelLabel })] }))] }));
19
+ }, children: [_jsx(CircleX, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: resolvedCancelLabel })] }))] }));
18
20
  }