hazo_auth 10.18.4 → 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 (243) 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/cli-src/lib/utils/password_validator.ts +12 -5
  21. package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
  22. package/dist/components/layouts/create_firm/index.js +4 -3
  23. package/dist/components/layouts/dev_lock/index.d.ts.map +1 -1
  24. package/dist/components/layouts/dev_lock/index.js +4 -2
  25. package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts +5 -4
  26. package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -1
  27. package/dist/components/layouts/email_verification/config/email_verification_field_config.js +32 -29
  28. package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
  29. package/dist/components/layouts/email_verification/hooks/use_email_verification.js +14 -13
  30. package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
  31. package/dist/components/layouts/email_verification/index.js +13 -9
  32. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts +3 -2
  33. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -1
  34. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +21 -18
  35. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
  36. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +10 -9
  37. package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
  38. package/dist/components/layouts/forgot_password/index.js +15 -6
  39. package/dist/components/layouts/legal/legal_acceptance_gate.d.ts.map +1 -1
  40. package/dist/components/layouts/legal/legal_acceptance_gate.js +5 -3
  41. package/dist/components/layouts/legal/legal_doc_checkbox_list.d.ts.map +1 -1
  42. package/dist/components/layouts/legal/legal_doc_checkbox_list.js +3 -1
  43. package/dist/components/layouts/legal/legal_doc_combined_view.d.ts.map +1 -1
  44. package/dist/components/layouts/legal/legal_doc_combined_view.js +3 -1
  45. package/dist/components/layouts/login/config/login_field_config.d.ts +3 -2
  46. package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -1
  47. package/dist/components/layouts/login/config/login_field_config.js +29 -26
  48. package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
  49. package/dist/components/layouts/login/hooks/use_login_form.js +8 -7
  50. package/dist/components/layouts/login/index.d.ts +4 -4
  51. package/dist/components/layouts/login/index.d.ts.map +1 -1
  52. package/dist/components/layouts/login/index.js +33 -22
  53. package/dist/components/layouts/my_settings/components/connected_accounts_section.d.ts.map +1 -1
  54. package/dist/components/layouts/my_settings/components/connected_accounts_section.js +7 -4
  55. package/dist/components/layouts/my_settings/components/danger_zone_section.d.ts.map +1 -1
  56. package/dist/components/layouts/my_settings/components/danger_zone_section.js +15 -6
  57. package/dist/components/layouts/my_settings/components/editable_field.d.ts.map +1 -1
  58. package/dist/components/layouts/my_settings/components/editable_field.js +4 -2
  59. package/dist/components/layouts/my_settings/components/language_picker_section.d.ts.map +1 -1
  60. package/dist/components/layouts/my_settings/components/language_picker_section.js +7 -3
  61. package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
  62. package/dist/components/layouts/my_settings/components/password_change_dialog.js +28 -21
  63. package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -1
  64. package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +12 -9
  65. package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts.map +1 -1
  66. package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.js +3 -1
  67. package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +14 -11
  68. package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.d.ts.map +1 -1
  69. package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.js +26 -15
  70. package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
  71. package/dist/components/layouts/my_settings/components/set_password_section.js +24 -14
  72. package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts +2 -1
  73. package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -1
  74. package/dist/components/layouts/my_settings/config/my_settings_field_config.js +10 -10
  75. package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
  76. package/dist/components/layouts/my_settings/index.js +35 -27
  77. package/dist/components/layouts/otp/index.d.ts.map +1 -1
  78. package/dist/components/layouts/otp/index.js +8 -3
  79. package/dist/components/layouts/register/config/register_field_config.d.ts +3 -2
  80. package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -1
  81. package/dist/components/layouts/register/config/register_field_config.js +45 -42
  82. package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
  83. package/dist/components/layouts/register/hooks/use_register_form.js +12 -11
  84. package/dist/components/layouts/register/index.d.ts +4 -4
  85. package/dist/components/layouts/register/index.d.ts.map +1 -1
  86. package/dist/components/layouts/register/index.js +25 -19
  87. package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +4 -3
  88. package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -1
  89. package/dist/components/layouts/reset_password/config/reset_password_field_config.js +17 -17
  90. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
  91. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +14 -13
  92. package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
  93. package/dist/components/layouts/reset_password/index.js +12 -7
  94. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
  95. package/dist/components/layouts/shared/components/already_logged_in_guard.js +6 -2
  96. package/dist/components/layouts/shared/components/auth_navbar.d.ts +1 -1
  97. package/dist/components/layouts/shared/components/auth_navbar.d.ts.map +1 -1
  98. package/dist/components/layouts/shared/components/auth_navbar.js +7 -2
  99. package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -1
  100. package/dist/components/layouts/shared/components/facebook_sign_in_button.js +5 -2
  101. package/dist/components/layouts/shared/components/floating_home_link.d.ts.map +1 -1
  102. package/dist/components/layouts/shared/components/floating_home_link.js +6 -3
  103. package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -1
  104. package/dist/components/layouts/shared/components/form_action_buttons.js +9 -4
  105. package/dist/components/layouts/shared/components/google_sign_in_button.d.ts.map +1 -1
  106. package/dist/components/layouts/shared/components/google_sign_in_button.js +5 -2
  107. package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
  108. package/dist/components/layouts/shared/components/logout_button.js +6 -5
  109. package/dist/components/layouts/shared/components/oauth_divider.d.ts.map +1 -1
  110. package/dist/components/layouts/shared/components/oauth_divider.js +8 -3
  111. package/dist/components/layouts/shared/components/password_field.d.ts.map +1 -1
  112. package/dist/components/layouts/shared/components/password_field.js +3 -1
  113. package/dist/components/layouts/shared/components/profile_pic_menu.d.ts +4 -0
  114. package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
  115. package/dist/components/layouts/shared/components/profile_pic_menu.js +26 -18
  116. package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts +1 -0
  117. package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts.map +1 -1
  118. package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.js +1 -1
  119. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -1
  120. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +3 -1
  121. package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts.map +1 -1
  122. package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +6 -2
  123. package/dist/components/layouts/shared/components/unauthorized_guard.d.ts.map +1 -1
  124. package/dist/components/layouts/shared/components/unauthorized_guard.js +7 -3
  125. package/dist/components/layouts/shared/config/layout_customization.d.ts +6 -0
  126. package/dist/components/layouts/shared/config/layout_customization.d.ts.map +1 -1
  127. package/dist/components/layouts/shared/config/layout_customization.js +26 -1
  128. package/dist/components/layouts/shared/utils/validation.d.ts +9 -2
  129. package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -1
  130. package/dist/components/layouts/shared/utils/validation.js +16 -8
  131. package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
  132. package/dist/components/layouts/user_management/components/roles_matrix.js +21 -18
  133. package/dist/components/layouts/user_management/components/scope_hierarchy_tab.d.ts.map +1 -1
  134. package/dist/components/layouts/user_management/components/scope_hierarchy_tab.js +32 -31
  135. package/dist/components/layouts/user_management/components/user_scopes_tab.d.ts.map +1 -1
  136. package/dist/components/layouts/user_management/components/user_scopes_tab.js +26 -20
  137. package/dist/components/layouts/user_management/index.d.ts.map +1 -1
  138. package/dist/components/layouts/user_management/index.js +47 -43
  139. package/dist/components/otp/OTPRequestForm.d.ts.map +1 -1
  140. package/dist/components/otp/OTPRequestForm.js +10 -5
  141. package/dist/components/otp/OTPVerifyForm.d.ts.map +1 -1
  142. package/dist/components/otp/OTPVerifyForm.js +12 -7
  143. package/dist/components/permission_denied_dialog.client.d.ts.map +1 -1
  144. package/dist/components/permission_denied_dialog.client.js +12 -9
  145. package/dist/components/ui/sheet.d.ts +1 -1
  146. package/dist/components/ui/sidebar.js +5 -5
  147. package/dist/contexts/hazo_auth_config.d.ts +13 -0
  148. package/dist/contexts/hazo_auth_config.d.ts.map +1 -1
  149. package/dist/contexts/hazo_auth_config.js +4 -1
  150. package/dist/contexts/hazo_auth_provider.d.ts +22 -2
  151. package/dist/contexts/hazo_auth_provider.d.ts.map +1 -1
  152. package/dist/contexts/hazo_auth_provider.js +18 -2
  153. package/dist/lib/already_logged_in_config.server.d.ts +4 -2
  154. package/dist/lib/already_logged_in_config.server.d.ts.map +1 -1
  155. package/dist/lib/already_logged_in_config.server.js +7 -5
  156. package/dist/lib/auth_hooks.d.ts +20 -0
  157. package/dist/lib/auth_hooks.d.ts.map +1 -0
  158. package/dist/lib/auth_hooks.js +32 -0
  159. package/dist/lib/config/config_loader.server.d.ts +23 -0
  160. package/dist/lib/config/config_loader.server.d.ts.map +1 -1
  161. package/dist/lib/config/config_loader.server.js +29 -0
  162. package/dist/lib/email_verification_config.server.d.ts +2 -2
  163. package/dist/lib/email_verification_config.server.d.ts.map +1 -1
  164. package/dist/lib/forgot_password_config.server.d.ts +2 -2
  165. package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
  166. package/dist/lib/login_config.server.d.ts +8 -5
  167. package/dist/lib/login_config.server.d.ts.map +1 -1
  168. package/dist/lib/login_config.server.js +13 -6
  169. package/dist/lib/my_settings_config.server.d.ts.map +1 -1
  170. package/dist/lib/my_settings_config.server.js +22 -15
  171. package/dist/lib/navbar_config.server.d.ts +3 -2
  172. package/dist/lib/navbar_config.server.d.ts.map +1 -1
  173. package/dist/lib/navbar_config.server.js +4 -2
  174. package/dist/lib/oauth_config.server.d.ts +6 -6
  175. package/dist/lib/oauth_config.server.d.ts.map +1 -1
  176. package/dist/lib/oauth_config.server.js +8 -4
  177. package/dist/lib/otp_config.server.d.ts +2 -2
  178. package/dist/lib/otp_config.server.d.ts.map +1 -1
  179. package/dist/lib/otp_config.server.js +4 -2
  180. package/dist/lib/profile_pic_menu_config.server.d.ts +6 -2
  181. package/dist/lib/profile_pic_menu_config.server.d.ts.map +1 -1
  182. package/dist/lib/profile_pic_menu_config.server.js +5 -3
  183. package/dist/lib/register_config.server.d.ts +7 -6
  184. package/dist/lib/register_config.server.d.ts.map +1 -1
  185. package/dist/lib/register_config.server.js +8 -4
  186. package/dist/lib/reset_password_config.server.d.ts +6 -4
  187. package/dist/lib/reset_password_config.server.d.ts.map +1 -1
  188. package/dist/lib/reset_password_config.server.js +5 -5
  189. package/dist/lib/services/oauth_service.d.ts.map +1 -1
  190. package/dist/lib/services/oauth_service.js +13 -0
  191. package/dist/lib/services/otp_service.d.ts.map +1 -1
  192. package/dist/lib/services/otp_service.js +6 -0
  193. package/dist/lib/services/registration_service.d.ts.map +1 -1
  194. package/dist/lib/services/registration_service.js +7 -0
  195. package/dist/lib/ui_shell_config.server.d.ts +6 -2
  196. package/dist/lib/ui_shell_config.server.d.ts.map +1 -1
  197. package/dist/lib/ui_shell_config.server.js +5 -3
  198. package/dist/lib/utils/password_validator.d.ts.map +1 -1
  199. package/dist/lib/utils/password_validator.js +5 -5
  200. package/dist/locales/en.json +517 -0
  201. package/dist/server/routes/library_photos.d.ts +2 -2
  202. package/dist/server/routes/set_password.js +1 -1
  203. package/dist/server-lib.d.ts +2 -0
  204. package/dist/server-lib.d.ts.map +1 -1
  205. package/dist/server-lib.js +2 -0
  206. package/dist/server_pages/forgot_password.d.ts +3 -2
  207. package/dist/server_pages/forgot_password.d.ts.map +1 -1
  208. package/dist/server_pages/forgot_password.js +8 -7
  209. package/dist/server_pages/forgot_password_client_wrapper.d.ts +2 -1
  210. package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -1
  211. package/dist/server_pages/forgot_password_client_wrapper.js +3 -1
  212. package/dist/server_pages/login.d.ts.map +1 -1
  213. package/dist/server_pages/login.js +9 -7
  214. package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
  215. package/dist/server_pages/login_client_wrapper.js +3 -1
  216. package/dist/server_pages/otp.d.ts +6 -3
  217. package/dist/server_pages/otp.d.ts.map +1 -1
  218. package/dist/server_pages/otp.js +11 -8
  219. package/dist/server_pages/register.d.ts.map +1 -1
  220. package/dist/server_pages/register.js +7 -6
  221. package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
  222. package/dist/server_pages/register_client_wrapper.js +3 -1
  223. package/dist/server_pages/reset_password.d.ts.map +1 -1
  224. package/dist/server_pages/reset_password.js +7 -6
  225. package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -1
  226. package/dist/server_pages/reset_password_client_wrapper.js +3 -1
  227. package/dist/server_pages/verify_email.d.ts.map +1 -1
  228. package/dist/server_pages/verify_email.js +6 -5
  229. package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -1
  230. package/dist/server_pages/verify_email_client_wrapper.js +4 -2
  231. package/dist/strings/default_strings.d.ts +15 -0
  232. package/dist/strings/default_strings.d.ts.map +1 -1
  233. package/dist/strings/default_strings.js +67 -11
  234. package/dist/strings/index.d.ts +1 -1
  235. package/dist/strings/index.d.ts.map +1 -1
  236. package/dist/strings/index.js +1 -1
  237. package/dist/strings/strings_context.d.ts +20 -3
  238. package/dist/strings/strings_context.d.ts.map +1 -1
  239. package/dist/strings/strings_context.js +39 -5
  240. package/dist/strings/strings_provider.d.ts +1 -5
  241. package/dist/strings/strings_provider.d.ts.map +1 -1
  242. package/dist/strings/strings_provider.js +5 -1
  243. package/package.json +27 -19
@@ -18,6 +18,7 @@ import { PasswordField } from "../shared/components/password_field.js";
18
18
  import { FormFieldWrapper } from "../shared/components/form_field_wrapper.js";
19
19
  import { Pencil, Trash2 } from "lucide-react";
20
20
  import { cn } from "../../../lib/utils.js";
21
+ import { useAuthT } from "../../../contexts/hazo_auth_provider.js";
21
22
  // section: component
22
23
  /**
23
24
  * My Settings layout component with tabs for profile and security settings
@@ -26,17 +27,47 @@ import { cn } from "../../../lib/utils.js";
26
27
  * @param props - Component props including labels, button colors, password requirements, etc.
27
28
  * @returns My settings layout component
28
29
  */
29
- export default function my_settings_layout({ className, labels, button_colors, password_requirements, profilePicture, userFields, unauthorizedMessage = "You must be logged in to access this page.", loginButtonLabel = "Go to login", loginPath = "/hazo_auth/login", availableLocales, enableAccountDeletion = false, heading = "Account Settings", subHeading = "Manage your profile, password, and email preferences.", profilePhotoLabel = "Profile Photo", profilePhotoRecommendation = "Recommended size: 200x200px. JPG, PNG.", uploadPhotoButtonLabel = "Upload New Photo", removePhotoButtonLabel = "Remove", profileInformationLabel = "Profile Information", passwordLabel = "Password", currentPasswordLabel = "Current Password", newPasswordLabel = "New Password", confirmPasswordLabel = "Confirm Password", messages, uiSizes, fileTypes, }) {
30
+ export default function my_settings_layout({ className, labels, button_colors, password_requirements, profilePicture, userFields, unauthorizedMessage, loginButtonLabel, loginPath = "/hazo_auth/login", availableLocales, enableAccountDeletion = false, heading, subHeading, profilePhotoLabel, profilePhotoRecommendation, uploadPhotoButtonLabel, removePhotoButtonLabel, profileInformationLabel, passwordLabel, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, messages, uiSizes, fileTypes, }) {
30
31
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
31
- const resolvedLabels = resolveMySettingsLabels(labels);
32
+ const t = useAuthT();
33
+ const resolvedLabels = resolveMySettingsLabels(t, labels);
32
34
  const resolvedButtonPalette = resolveMySettingsButtonPalette(button_colors);
35
+ const resolvedUnauthorizedMessage = unauthorizedMessage !== null && unauthorizedMessage !== void 0 ? unauthorizedMessage : t("shared.guard.unauthorized_message_default");
36
+ const resolvedLoginButtonLabel = loginButtonLabel !== null && loginButtonLabel !== void 0 ? loginButtonLabel : t("shared.guard.login_button_default");
37
+ const resolvedHeading = heading !== null && heading !== void 0 ? heading : t("my_settings.page_title");
38
+ const resolvedSubHeading = subHeading !== null && subHeading !== void 0 ? subHeading : t("my_settings.sub_heading_default");
39
+ const resolvedProfilePhotoLabel = profilePhotoLabel !== null && profilePhotoLabel !== void 0 ? profilePhotoLabel : t("my_settings.profile_photo_label_default");
40
+ const resolvedProfilePhotoRecommendation = profilePhotoRecommendation !== null && profilePhotoRecommendation !== void 0 ? profilePhotoRecommendation : t("my_settings.profile_photo_recommendation_default");
41
+ const resolvedUploadPhotoButtonLabel = uploadPhotoButtonLabel !== null && uploadPhotoButtonLabel !== void 0 ? uploadPhotoButtonLabel : t("my_settings.upload_photo_button_default");
42
+ const resolvedRemovePhotoButtonLabel = removePhotoButtonLabel !== null && removePhotoButtonLabel !== void 0 ? removePhotoButtonLabel : t("my_settings.remove_photo_button_default");
43
+ const resolvedProfileInformationLabel = profileInformationLabel !== null && profileInformationLabel !== void 0 ? profileInformationLabel : t("my_settings.profile_information_label_default");
44
+ const resolvedPasswordLabel = passwordLabel !== null && passwordLabel !== void 0 ? passwordLabel : t("my_settings.password_label_default");
45
+ const resolvedCurrentPasswordLabel = currentPasswordLabel !== null && currentPasswordLabel !== void 0 ? currentPasswordLabel : t("my_settings.current_password_label_default");
46
+ const resolvedNewPasswordLabel = newPasswordLabel !== null && newPasswordLabel !== void 0 ? newPasswordLabel : t("my_settings.set_password.new_password_label");
47
+ const resolvedConfirmPasswordLabel = confirmPasswordLabel !== null && confirmPasswordLabel !== void 0 ? confirmPasswordLabel : t("my_settings.set_password.confirm_password_label");
48
+ const validateName = (name) => {
49
+ if (name.trim() === "") {
50
+ return t("my_settings.name_field.validation_empty_default");
51
+ }
52
+ return null;
53
+ };
54
+ const validateEmail = (email) => {
55
+ if (!email || email.trim() === "") {
56
+ return t("my_settings.email_field.validation_required_default");
57
+ }
58
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
59
+ if (!emailRegex.test(email)) {
60
+ return t("my_settings.email_field.validation_invalid_format_default");
61
+ }
62
+ return null;
63
+ };
33
64
  const settings = use_my_settings({
34
65
  passwordRequirements: password_requirements,
35
66
  });
36
- return (_jsx(UnauthorizedGuard, { message: unauthorizedMessage, loginButtonLabel: loginButtonLabel, loginPath: loginPath, children: _jsxs("div", { className: cn("cls_my_settings_layout flex flex-col gap-6 p-6 w-full", className), children: [_jsxs("div", { className: "cls_my_settings_layout_header flex flex-col gap-2", children: [_jsx("h1", { className: "cls_my_settings_layout_heading text-3xl font-bold text-[var(--hazo-text-primary)]", children: heading }), _jsx("p", { className: "cls_my_settings_layout_subheading text-[var(--hazo-text-muted)]", children: subHeading })] }), _jsxs("div", { className: "cls_my_settings_layout_profile_photo_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: profilePhotoLabel }), _jsx("div", { className: "cls_my_settings_layout_profile_photo_content flex flex-col items-center", children: _jsxs("div", { className: "cls_my_settings_layout_profile_photo_display relative", children: [_jsx(ProfilePictureDisplay, { profilePictureUrl: settings.profilePictureUrl, name: settings.name, email: settings.email, onEdit: settings.handleProfilePictureEdit }), _jsxs("div", { className: "cls_my_settings_layout_profile_photo_actions absolute left-0 right-0 flex items-center justify-between px-2", style: { bottom: '-20px' }, children: [_jsx(Button, { type: "button", onClick: settings.handleProfilePictureEdit, disabled: settings.loading, variant: "ghost", size: "icon", className: "cls_my_settings_layout_upload_photo_button", "aria-label": uploadPhotoButtonLabel, children: _jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), _jsx(Button, { type: "button", onClick: settings.handleProfilePictureRemove, disabled: settings.loading || !settings.profilePictureUrl, variant: "ghost", size: "icon", className: "cls_my_settings_layout_remove_photo_button text-red-600 hover:text-red-700 hover:bg-red-50", "aria-label": removePhotoButtonLabel, children: _jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" }) })] })] }) })] }), _jsxs("div", { className: "cls_my_settings_layout_profile_information_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: profileInformationLabel }), _jsxs("div", { className: "cls_my_settings_layout_profile_information_fields grid grid-cols-1 md:grid-cols-2 gap-6", children: [userFields.show_name_field && (_jsx(EditableField, { label: "Full Name", value: settings.name, type: "text", placeholder: "Enter your full name", onSave: settings.handleNameSave, validation: validateName, disabled: settings.loading, ariaLabel: "Full name input field" })), userFields.show_email_field && (_jsx(EditableField, { label: "Email Address", value: settings.email, type: "email", placeholder: "Enter your email address", onSave: settings.handleEmailSave, validation: validateEmail, disabled: settings.loading, ariaLabel: "Email address input field" })), _jsx(LanguagePickerSection, { availableLocales: availableLocales, currentLocale: settings.preferredLocale, onLocaleChange: settings.handlePreferredLocaleSave, disabled: settings.loading })] })] }), userFields.show_password_field && settings.hasPassword && (_jsxs("div", { className: "cls_my_settings_layout_password_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: passwordLabel }), _jsxs("div", { className: "cls_my_settings_layout_password_fields flex flex-col gap-6", children: [_jsx(FormFieldWrapper, { fieldId: "current-password", label: currentPasswordLabel, input: _jsx(PasswordField, { inputId: "current-password", ariaLabel: currentPasswordLabel, value: ((_a = settings.passwordFields) === null || _a === void 0 ? void 0 : _a.currentPassword) || "", placeholder: "Enter your current password", autoComplete: "current-password", isVisible: ((_b = settings.passwordFields) === null || _b === void 0 ? void 0 : _b.currentPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("currentPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("currentPassword"), errorMessage: (_d = (_c = settings.passwordFields) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d.currentPassword }) }), _jsxs("div", { className: "cls_my_settings_layout_password_fields_row grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsx(FormFieldWrapper, { fieldId: "new-password", label: newPasswordLabel, input: _jsx(PasswordField, { inputId: "new-password", ariaLabel: newPasswordLabel, value: ((_e = settings.passwordFields) === null || _e === void 0 ? void 0 : _e.newPassword) || "", placeholder: "Enter your new password", autoComplete: "new-password", isVisible: ((_f = settings.passwordFields) === null || _f === void 0 ? void 0 : _f.newPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("newPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("newPassword"), errorMessage: (_h = (_g = settings.passwordFields) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h.newPassword }) }), _jsx(FormFieldWrapper, { fieldId: "confirm-password", label: confirmPasswordLabel, input: _jsx(PasswordField, { inputId: "confirm-password", ariaLabel: confirmPasswordLabel, value: ((_j = settings.passwordFields) === null || _j === void 0 ? void 0 : _j.confirmPassword) || "", placeholder: "Confirm your new password", autoComplete: "new-password", isVisible: ((_k = settings.passwordFields) === null || _k === void 0 ? void 0 : _k.confirmPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("confirmPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("confirmPassword"), errorMessage: (_m = (_l = settings.passwordFields) === null || _l === void 0 ? void 0 : _l.errors) === null || _m === void 0 ? void 0 : _m.confirmPassword }) })] })] }), _jsx("div", { className: "cls_my_settings_layout_password_actions flex justify-end mt-4", children: _jsx(Button, { type: "button", onClick: settings.handlePasswordSave, disabled: settings.loading || settings.isPasswordSaveDisabled, className: "cls_my_settings_layout_save_password_button", style: {
67
+ return (_jsx(UnauthorizedGuard, { message: resolvedUnauthorizedMessage, loginButtonLabel: resolvedLoginButtonLabel, loginPath: loginPath, children: _jsxs("div", { className: cn("cls_my_settings_layout flex flex-col gap-6 p-6 w-full", className), children: [_jsxs("div", { className: "cls_my_settings_layout_header flex flex-col gap-2", children: [_jsx("h1", { className: "cls_my_settings_layout_heading text-3xl font-bold text-[var(--hazo-text-primary)]", children: resolvedHeading }), _jsx("p", { className: "cls_my_settings_layout_subheading text-[var(--hazo-text-muted)]", children: resolvedSubHeading })] }), _jsxs("div", { className: "cls_my_settings_layout_profile_photo_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedProfilePhotoLabel }), _jsx("div", { className: "cls_my_settings_layout_profile_photo_content flex flex-col items-center", children: _jsxs("div", { className: "cls_my_settings_layout_profile_photo_display relative", children: [_jsx(ProfilePictureDisplay, { profilePictureUrl: settings.profilePictureUrl, name: settings.name, email: settings.email, onEdit: settings.handleProfilePictureEdit }), _jsxs("div", { className: "cls_my_settings_layout_profile_photo_actions absolute left-0 right-0 flex items-center justify-between px-2", style: { bottom: '-20px' }, children: [_jsx(Button, { type: "button", onClick: settings.handleProfilePictureEdit, disabled: settings.loading, variant: "ghost", size: "icon", className: "cls_my_settings_layout_upload_photo_button", "aria-label": resolvedUploadPhotoButtonLabel, children: _jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), _jsx(Button, { type: "button", onClick: settings.handleProfilePictureRemove, disabled: settings.loading || !settings.profilePictureUrl, variant: "ghost", size: "icon", className: "cls_my_settings_layout_remove_photo_button text-red-600 hover:text-red-700 hover:bg-red-50", "aria-label": resolvedRemovePhotoButtonLabel, children: _jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" }) })] })] }) })] }), _jsxs("div", { className: "cls_my_settings_layout_profile_information_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedProfileInformationLabel }), _jsxs("div", { className: "cls_my_settings_layout_profile_information_fields grid grid-cols-1 md:grid-cols-2 gap-6", children: [userFields.show_name_field && (_jsx(EditableField, { label: t("my_settings.name_field.label_default"), value: settings.name, type: "text", placeholder: t("my_settings.name_field.placeholder_default"), onSave: settings.handleNameSave, validation: validateName, disabled: settings.loading, ariaLabel: t("my_settings.name_field.aria_label_default") })), userFields.show_email_field && (_jsx(EditableField, { label: t("my_settings.email_field.label_default"), value: settings.email, type: "email", placeholder: t("my_settings.email_field.placeholder_default"), onSave: settings.handleEmailSave, validation: validateEmail, disabled: settings.loading, ariaLabel: t("my_settings.email_field.aria_label_default") })), _jsx(LanguagePickerSection, { availableLocales: availableLocales, currentLocale: settings.preferredLocale, onLocaleChange: settings.handlePreferredLocaleSave, disabled: settings.loading })] })] }), userFields.show_password_field && settings.hasPassword && (_jsxs("div", { className: "cls_my_settings_layout_password_section bg-white rounded-lg border border-[var(--hazo-border)] p-6", children: [_jsx("h2", { className: "cls_my_settings_layout_section_heading text-lg font-semibold text-[var(--hazo-text-primary)] mb-4", children: resolvedPasswordLabel }), _jsxs("div", { className: "cls_my_settings_layout_password_fields flex flex-col gap-6", children: [_jsx(FormFieldWrapper, { fieldId: "current-password", label: resolvedCurrentPasswordLabel, input: _jsx(PasswordField, { inputId: "current-password", ariaLabel: resolvedCurrentPasswordLabel, value: ((_a = settings.passwordFields) === null || _a === void 0 ? void 0 : _a.currentPassword) || "", placeholder: t("my_settings.current_password_placeholder_default"), autoComplete: "current-password", isVisible: ((_b = settings.passwordFields) === null || _b === void 0 ? void 0 : _b.currentPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("currentPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("currentPassword"), errorMessage: (_d = (_c = settings.passwordFields) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d.currentPassword }) }), _jsxs("div", { className: "cls_my_settings_layout_password_fields_row grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsx(FormFieldWrapper, { fieldId: "new-password", label: resolvedNewPasswordLabel, input: _jsx(PasswordField, { inputId: "new-password", ariaLabel: resolvedNewPasswordLabel, value: ((_e = settings.passwordFields) === null || _e === void 0 ? void 0 : _e.newPassword) || "", placeholder: t("my_settings.set_password.new_password_placeholder"), autoComplete: "new-password", isVisible: ((_f = settings.passwordFields) === null || _f === void 0 ? void 0 : _f.newPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("newPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("newPassword"), errorMessage: (_h = (_g = settings.passwordFields) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h.newPassword }) }), _jsx(FormFieldWrapper, { fieldId: "confirm-password", label: resolvedConfirmPasswordLabel, input: _jsx(PasswordField, { inputId: "confirm-password", ariaLabel: resolvedConfirmPasswordLabel, value: ((_j = settings.passwordFields) === null || _j === void 0 ? void 0 : _j.confirmPassword) || "", placeholder: t("my_settings.set_password.confirm_password_placeholder"), autoComplete: "new-password", isVisible: ((_k = settings.passwordFields) === null || _k === void 0 ? void 0 : _k.confirmPasswordVisible) || false, onChange: (value) => settings.handlePasswordFieldChange("confirmPassword", value), onToggleVisibility: () => settings.togglePasswordVisibility("confirmPassword"), errorMessage: (_m = (_l = settings.passwordFields) === null || _l === void 0 ? void 0 : _l.errors) === null || _m === void 0 ? void 0 : _m.confirmPassword }) })] })] }), _jsx("div", { className: "cls_my_settings_layout_password_actions flex justify-end mt-4", children: _jsx(Button, { type: "button", onClick: settings.handlePasswordSave, disabled: settings.loading || settings.isPasswordSaveDisabled, className: "cls_my_settings_layout_save_password_button", style: {
37
68
  backgroundColor: resolvedButtonPalette.submitBackground,
38
69
  color: resolvedButtonPalette.submitText,
39
- }, "aria-label": "Save password", children: "Save Password" }) })] })), !settings.hasPassword && settings.googleConnected && (_jsx(SetPasswordSection, { passwordRequirements: password_requirements, onPasswordSet: settings.refreshUserData, parentLoading: settings.loading })), _jsx(ConnectedAccountsSection, { googleConnected: settings.googleConnected || false, email: settings.email, loading: settings.loading }), _jsx(DangerZoneSection, { enabled: enableAccountDeletion, email: settings.email }), _jsx(ProfilePictureDialog, { open: settings.profilePictureDialogOpen, onOpenChange: (open) => {
70
+ }, "aria-label": t("my_settings.save_password_aria_default"), children: t("my_settings.save_password_button_default") }) })] })), !settings.hasPassword && settings.googleConnected && (_jsx(SetPasswordSection, { passwordRequirements: password_requirements, onPasswordSet: settings.refreshUserData, parentLoading: settings.loading })), _jsx(ConnectedAccountsSection, { googleConnected: settings.googleConnected || false, email: settings.email, loading: settings.loading }), _jsx(DangerZoneSection, { enabled: enableAccountDeletion, email: settings.email }), _jsx(ProfilePictureDialog, { open: settings.profilePictureDialogOpen, onOpenChange: (open) => {
40
71
  if (open) {
41
72
  settings.handleProfilePictureEdit();
42
73
  }
@@ -45,26 +76,3 @@ export default function my_settings_layout({ className, labels, button_colors, p
45
76
  }
46
77
  }, onSave: settings.handleProfilePictureSave, email: settings.email, allowPhotoUpload: profilePicture.allow_photo_upload, maxPhotoSize: profilePicture.max_photo_size, libraryPhotoPath: profilePicture.library_photo_path, currentProfilePictureUrl: settings.profilePictureUrl, currentProfileSource: settings.profileSource, disabled: settings.loading, messages: messages, uiSizes: uiSizes, fileTypes: fileTypes })] }) }));
47
78
  }
48
- // section: validation_helpers
49
- /**
50
- * Validates name (optional, but if provided should not be empty)
51
- */
52
- function validateName(name) {
53
- if (name.trim() === "") {
54
- return "Name cannot be empty";
55
- }
56
- return null;
57
- }
58
- /**
59
- * Validates email format
60
- */
61
- function validateEmail(email) {
62
- if (!email || email.trim() === "") {
63
- return "Email is required";
64
- }
65
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
66
- if (!emailRegex.test(email)) {
67
- return "Invalid email address format";
68
- }
69
- return null;
70
- }
@@ -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;AAIhE,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,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAK,EACL,SAAiD,EACjD,SAAS,GACV,EAAE,cAAc,GAAG,KAAK,CAAC,YAAY,CAgCrC;AAED,eAAe,SAAS,CAAC"}
@@ -7,10 +7,15 @@ 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 { useAuthT } from "../../../contexts/hazo_auth_provider.js";
10
11
  // 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", }) {
12
+ export function OTPLayout({ redirect_url = "/", title, subtitle, ctaText, theme, image_src = "/hazo_auth/images/login_default.jpg", image_alt, }) {
13
+ const t = useAuthT();
14
+ const resolvedTitle = title !== null && title !== void 0 ? title : t("otp.layout.title");
15
+ const resolvedSubtitle = subtitle !== null && subtitle !== void 0 ? subtitle : t("otp.layout.subtitle");
16
+ const resolvedImageAlt = image_alt !== null && image_alt !== void 0 ? image_alt : t("otp.layout.image_alt");
12
17
  const [sent_to, set_sent_to] = React.useState(null);
13
- const formContent = (_jsxs("div", { className: "mx-auto w-full max-w-sm py-12", children: [_jsx("h1", { className: `text-2xl font-semibold ${subtitle ? "mb-2" : "mb-6"}`, children: title }), subtitle && (_jsx("p", { className: "text-sm text-muted-foreground mb-6", children: subtitle })), sent_to ? (_jsx(OTPVerifyForm, { email: sent_to, redirect_url: redirect_url, submit_label: ctaText })) : (_jsx(OTPRequestForm, { on_sent: (email) => set_sent_to(email) }))] }));
14
- return (_jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, formContent: formContent }));
18
+ const formContent = (_jsxs("div", { className: "mx-auto w-full max-w-sm py-12", children: [_jsx("h1", { className: `text-2xl font-semibold ${resolvedSubtitle ? "mb-2" : "mb-6"}`, children: resolvedTitle }), resolvedSubtitle && (_jsx("p", { className: "text-sm text-muted-foreground mb-6", children: resolvedSubtitle })), sent_to ? (_jsx(OTPVerifyForm, { email: sent_to, redirect_url: redirect_url, submit_label: ctaText })) : (_jsx(OTPRequestForm, { on_sent: (email) => set_sent_to(email) }))] }));
19
+ return (_jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: resolvedImageAlt, formContent: formContent }));
15
20
  }
16
21
  export default OTPLayout;
@@ -1,5 +1,6 @@
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 REGISTER_FIELD_IDS: {
4
5
  readonly NAME: "name";
5
6
  readonly EMAIL: "email_address";
@@ -7,8 +8,8 @@ export declare const REGISTER_FIELD_IDS: {
7
8
  readonly CONFIRM_PASSWORD: "confirm_password";
8
9
  };
9
10
  export type RegisterFieldId = (typeof REGISTER_FIELD_IDS)[keyof typeof REGISTER_FIELD_IDS];
10
- export declare const createRegisterFieldDefinitions: (overrides?: LayoutFieldMapOverrides) => LayoutFieldMap;
11
- export declare const resolveRegisterLabels: (overrides?: LayoutLabelOverrides) => LayoutLabelDefaults;
11
+ export declare const createRegisterFieldDefinitions: (t: AuthTFunction, overrides?: LayoutFieldMapOverrides) => LayoutFieldMap;
12
+ export declare const resolveRegisterLabels: (t: AuthTFunction, overrides?: LayoutLabelOverrides) => LayoutLabelDefaults;
12
13
  export declare const resolveRegisterButtonPalette: (overrides?: ButtonPaletteOverrides) => ButtonPaletteDefaults;
13
14
  export declare const resolveRegisterPasswordRequirements: (overrides?: PasswordRequirementOverrides) => PasswordRequirementOptions;
14
15
  //# sourceMappingURL=register_field_config.d.ts.map
@@ -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;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAG3E,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AA0C3F,eAAO,MAAM,8BAA8B,GACzC,GAAG,aAAa,EAChB,YAAY,uBAAuB,mBACoC,CAAC;AAU1E,eAAO,MAAM,qBAAqB,GAAI,GAAG,aAAa,EAAE,YAAY,oBAAoB,wBAC/B,CAAC;AAU1D,eAAO,MAAM,4BAA4B,GAAI,YAAY,sBAAsB,0BACZ,CAAC;AAWpE,eAAO,MAAM,mCAAmC,GAC9C,YAAY,4BAA4B,+BACiC,CAAC"}
@@ -1,4 +1,4 @@
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
2
  // section: field_identifiers
3
3
  export const REGISTER_FIELD_IDS = {
4
4
  NAME: "name",
@@ -7,49 +7,52 @@ export const REGISTER_FIELD_IDS = {
7
7
  CONFIRM_PASSWORD: "confirm_password",
8
8
  };
9
9
  // section: field_definitions
10
- const REGISTER_FIELD_DEFINITIONS = {
11
- [REGISTER_FIELD_IDS.NAME]: {
12
- id: REGISTER_FIELD_IDS.NAME,
13
- label: "Full name",
14
- type: "text",
15
- autoComplete: "name",
16
- placeholder: "Enter your full name",
17
- ariaLabel: "Full name input field",
18
- },
19
- [REGISTER_FIELD_IDS.EMAIL]: {
20
- id: REGISTER_FIELD_IDS.EMAIL,
21
- label: "Email address",
22
- type: "email",
23
- autoComplete: "email",
24
- placeholder: "Enter your email address",
25
- ariaLabel: "Email address input field",
26
- },
27
- [REGISTER_FIELD_IDS.PASSWORD]: {
28
- id: REGISTER_FIELD_IDS.PASSWORD,
29
- label: "Password",
30
- type: "password",
31
- autoComplete: "new-password",
32
- placeholder: "Enter your password",
33
- ariaLabel: "Password input field",
34
- },
35
- [REGISTER_FIELD_IDS.CONFIRM_PASSWORD]: {
36
- id: REGISTER_FIELD_IDS.CONFIRM_PASSWORD,
37
- label: "Re-enter password",
38
- type: "password",
39
- autoComplete: "new-password",
40
- placeholder: "Re-enter your password",
41
- ariaLabel: "Re-enter password input field",
42
- },
10
+ const buildRegisterFieldDefinitions = (t) => {
11
+ const sharedEmailFieldCopy = SHARED_EMAIL_FIELD_COPY(t);
12
+ return {
13
+ [REGISTER_FIELD_IDS.NAME]: {
14
+ id: REGISTER_FIELD_IDS.NAME,
15
+ label: t("register.field.name.label"),
16
+ type: "text",
17
+ autoComplete: "name",
18
+ placeholder: t("register.field.name.placeholder"),
19
+ ariaLabel: t("register.field.name.aria_label"),
20
+ },
21
+ [REGISTER_FIELD_IDS.EMAIL]: {
22
+ id: REGISTER_FIELD_IDS.EMAIL,
23
+ label: sharedEmailFieldCopy.label,
24
+ type: "email",
25
+ autoComplete: "email",
26
+ placeholder: sharedEmailFieldCopy.placeholder,
27
+ ariaLabel: sharedEmailFieldCopy.ariaLabel,
28
+ },
29
+ [REGISTER_FIELD_IDS.PASSWORD]: {
30
+ id: REGISTER_FIELD_IDS.PASSWORD,
31
+ label: t("register.field.password.label"),
32
+ type: "password",
33
+ autoComplete: "new-password",
34
+ placeholder: t("register.field.password.placeholder"),
35
+ ariaLabel: t("register.field.password.aria_label"),
36
+ },
37
+ [REGISTER_FIELD_IDS.CONFIRM_PASSWORD]: {
38
+ id: REGISTER_FIELD_IDS.CONFIRM_PASSWORD,
39
+ label: t("register.field.confirm_password.label"),
40
+ type: "password",
41
+ autoComplete: "new-password",
42
+ placeholder: t("register.field.confirm_password.placeholder"),
43
+ ariaLabel: t("register.field.confirm_password.aria_label"),
44
+ },
45
+ };
43
46
  };
44
- export const createRegisterFieldDefinitions = (overrides) => resolveFieldDefinitions(REGISTER_FIELD_DEFINITIONS, overrides);
47
+ export const createRegisterFieldDefinitions = (t, overrides) => resolveFieldDefinitions(buildRegisterFieldDefinitions(t), overrides);
45
48
  // section: label_defaults
46
- 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",
51
- };
52
- export const resolveRegisterLabels = (overrides) => resolveLabels(REGISTER_LABEL_DEFAULTS, overrides);
49
+ const buildRegisterLabelDefaults = (t) => ({
50
+ heading: t("register.heading"),
51
+ subHeading: t("register.sub_heading"),
52
+ submitButton: t("register.submit_button"),
53
+ cancelButton: t("shared.cancel_button"),
54
+ });
55
+ export const resolveRegisterLabels = (t, overrides) => resolveLabels(buildRegisterLabelDefaults(t), overrides);
53
56
  // section: button_palette_defaults
54
57
  const REGISTER_BUTTON_PALETTE_DEFAULTS = {
55
58
  submitBackground: "#0f172a",
@@ -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;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,qBAgRnC,CAAC"}
@@ -4,7 +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";
7
+ import { useHazoAuthConfig, useAuthT } from "../../../../contexts/hazo_auth_provider.js";
8
8
  // section: constants
9
9
  const PASSWORD_FIELDS = [
10
10
  REGISTER_FIELD_IDS.PASSWORD,
@@ -20,6 +20,7 @@ const buildInitialValues = () => ({
20
20
  // section: hook
21
21
  export const use_register_form = ({ showNameField, passwordRequirements, dataClient, urlOnLogon, legalDocs, }) => {
22
22
  const { apiBasePath } = useHazoAuthConfig();
23
+ const t = useAuthT();
23
24
  const initialValues = useMemo(() => buildInitialValues(), []);
24
25
  const [values, setValues] = useState(initialValues);
25
26
  const [errors, setErrors] = useState({});
@@ -86,7 +87,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
86
87
  const updatedErrors = Object.assign({}, previousErrors);
87
88
  // Only validate email on change if it has been touched (blurred)
88
89
  if (fieldId === REGISTER_FIELD_IDS.EMAIL && emailTouched) {
89
- const emailError = validateEmail(value);
90
+ const emailError = validateEmail(value, t);
90
91
  if (emailError) {
91
92
  updatedErrors[REGISTER_FIELD_IDS.EMAIL] = emailError;
92
93
  }
@@ -95,7 +96,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
95
96
  }
96
97
  }
97
98
  if (PASSWORD_FIELDS.includes(fieldId)) {
98
- const passwordError = validatePassword(nextValues[REGISTER_FIELD_IDS.PASSWORD], passwordRequirements);
99
+ const passwordError = validatePassword(nextValues[REGISTER_FIELD_IDS.PASSWORD], passwordRequirements, t);
99
100
  if (passwordError) {
100
101
  updatedErrors[REGISTER_FIELD_IDS.PASSWORD] = passwordError;
101
102
  }
@@ -105,7 +106,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
105
106
  if (nextValues[REGISTER_FIELD_IDS.CONFIRM_PASSWORD].trim().length > 0 &&
106
107
  nextValues[REGISTER_FIELD_IDS.PASSWORD] !==
107
108
  nextValues[REGISTER_FIELD_IDS.CONFIRM_PASSWORD]) {
108
- updatedErrors[REGISTER_FIELD_IDS.CONFIRM_PASSWORD] = "passwords do not match";
109
+ updatedErrors[REGISTER_FIELD_IDS.CONFIRM_PASSWORD] = t("validation.passwords_do_not_match");
109
110
  }
110
111
  else {
111
112
  delete updatedErrors[REGISTER_FIELD_IDS.CONFIRM_PASSWORD];
@@ -122,7 +123,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
122
123
  setErrors((previousErrors) => {
123
124
  const updatedErrors = Object.assign({}, previousErrors);
124
125
  const emailValue = values[REGISTER_FIELD_IDS.EMAIL];
125
- const emailError = validateEmail(emailValue);
126
+ const emailError = validateEmail(emailValue, t);
126
127
  if (emailError) {
127
128
  updatedErrors[REGISTER_FIELD_IDS.EMAIL] = emailError;
128
129
  }
@@ -135,8 +136,8 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
135
136
  const handleSubmit = useCallback(async (event) => {
136
137
  event.preventDefault();
137
138
  // Final validation
138
- const emailError = validateEmail(values[REGISTER_FIELD_IDS.EMAIL]);
139
- 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);
140
141
  if (emailError || passwordError) {
141
142
  setErrors(Object.assign(Object.assign({}, (emailError ? { [REGISTER_FIELD_IDS.EMAIL]: emailError } : {})), (passwordError ? { [REGISTER_FIELD_IDS.PASSWORD]: passwordError } : {})));
142
143
  return;
@@ -145,7 +146,7 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
145
146
  if (values[REGISTER_FIELD_IDS.PASSWORD] !==
146
147
  values[REGISTER_FIELD_IDS.CONFIRM_PASSWORD]) {
147
148
  setErrors({
148
- [REGISTER_FIELD_IDS.CONFIRM_PASSWORD]: "passwords do not match",
149
+ [REGISTER_FIELD_IDS.CONFIRM_PASSWORD]: t("validation.passwords_do_not_match"),
149
150
  });
150
151
  return;
151
152
  }
@@ -168,11 +169,11 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
168
169
  });
169
170
  const data = await response.json();
170
171
  if (!response.ok) {
171
- throw new Error(data.error || "Registration failed");
172
+ throw new Error(data.error || t("register.failed_message"));
172
173
  }
173
174
  // Show success notification
174
- toast.success("Registration successful!", {
175
- description: "Your account has been created successfully.",
175
+ toast.success(t("register.success_toast_title"), {
176
+ description: t("register.success_toast_description"),
176
177
  });
177
178
  // Reset form on success
178
179
  const resetValues = buildInitialValues();
@@ -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;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;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,7 +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";
24
+ import { useHazoAuthConfig, useAuthT } from "../../../contexts/hazo_auth_provider.js";
25
25
  const ORDERED_FIELDS = [
26
26
  REGISTER_FIELD_IDS.NAME,
27
27
  REGISTER_FIELD_IDS.EMAIL,
@@ -29,16 +29,22 @@ const ORDERED_FIELDS = [
29
29
  REGISTER_FIELD_IDS.CONFIRM_PASSWORD,
30
30
  ];
31
31
  // 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", }) {
33
- var _a;
34
- // Default OAuth config: both enabled
35
- const oauthConfig = oauth || {
36
- enable_google: true,
37
- enable_email_password: true,
38
- google_button_text: "Sign up with Google",
39
- oauth_divider_text: "or continue with email",
40
- enable_facebook_oauth: false,
41
- facebook_button_text: "Continue with Facebook",
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"),
42
48
  };
43
49
  // Read OAuth error from URL query params (e.g., ?error=AccessDenied)
44
50
  const searchParams = useSearchParams();
@@ -53,17 +59,17 @@ export default function register_layout({ image_src, image_alt, image_background
53
59
  const oauthCallbackUrl = safeRedirect
54
60
  ? `/api/hazo_auth/oauth/google/callback?next=${encodeURIComponent(safeRedirect)}`
55
61
  : "/api/hazo_auth/oauth/google/callback";
56
- 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;
57
63
  const getOAuthErrorMessage = (error) => {
58
64
  switch (error) {
59
65
  case "AccessDenied":
60
- return "Access was denied. You may have cancelled the sign-in or your account is not authorized.";
66
+ return t("shared.oauth_error.access_denied");
61
67
  case "OAuthSignin":
62
68
  case "OAuthCallback":
63
69
  case "OAuthCreateAccount":
64
- return "Something went wrong with Google sign-in. Please try again.";
70
+ return t("shared.oauth_error.signin_failed");
65
71
  default:
66
- return "An error occurred during sign-in. Please try again.";
72
+ return t("shared.oauth_error.generic");
67
73
  }
68
74
  };
69
75
  const { apiBasePath } = useHazoAuthConfig();
@@ -81,8 +87,8 @@ export default function register_layout({ image_src, image_alt, image_background
81
87
  })
82
88
  .catch(() => { });
83
89
  }, [apiBasePath]);
84
- const fieldDefinitions = createRegisterFieldDefinitions(field_overrides);
85
- const resolvedLabels = resolveRegisterLabels(labels);
90
+ const fieldDefinitions = createRegisterFieldDefinitions(t, field_overrides);
91
+ const resolvedLabels = resolveRegisterLabels(t, labels);
86
92
  const resolvedButtonPalette = resolveRegisterButtonPalette(button_colors);
87
93
  const resolvedPasswordRequirements = resolveRegisterPasswordRequirements(password_requirements);
88
94
  const form = use_register_form({
@@ -118,13 +124,13 @@ export default function register_layout({ image_src, image_alt, image_background
118
124
  // Form content — used in both layout modes. See `login_layout` for the
119
125
  // rationale: keeps the form independent of TwoColumnAuthLayout / AuthPageShell
120
126
  // 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 })] }))] }));
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 })] }))] }));
122
128
  // form_only mode: emit just the form content. See login_layout for the
123
129
  // rationale; AlreadyLoggedInGuard is intentionally skipped here.
124
130
  if (layout === "form_only") {
125
131
  return mainContent;
126
132
  }
127
- 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 }) }));
128
134
  }
129
135
  // Same-origin path validator. See login/index.tsx for the rationale.
130
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 = "You're already logged in.";
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;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;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"}
@@ -5,33 +5,33 @@ export const RESET_PASSWORD_FIELD_IDS = {
5
5
  CONFIRM_PASSWORD: "confirm_password",
6
6
  };
7
7
  // section: field_definitions
8
- const RESET_PASSWORD_FIELD_DEFINITIONS = {
8
+ const buildResetPasswordFieldDefinitions = (t) => ({
9
9
  [RESET_PASSWORD_FIELD_IDS.PASSWORD]: {
10
10
  id: RESET_PASSWORD_FIELD_IDS.PASSWORD,
11
- label: "New password",
11
+ label: t("reset_password.field.password.label"),
12
12
  type: "password",
13
13
  autoComplete: "new-password",
14
- placeholder: "Enter your new password",
15
- ariaLabel: "New password input field",
14
+ placeholder: t("reset_password.field.password.placeholder"),
15
+ ariaLabel: t("reset_password.field.password.aria_label"),
16
16
  },
17
17
  [RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]: {
18
18
  id: RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD,
19
- label: "Confirm new password",
19
+ label: t("reset_password.field.confirm_password.label"),
20
20
  type: "password",
21
21
  autoComplete: "new-password",
22
- placeholder: "Re-enter your new password",
23
- ariaLabel: "Confirm new password input field",
22
+ placeholder: t("reset_password.field.confirm_password.placeholder"),
23
+ ariaLabel: t("reset_password.field.confirm_password.aria_label"),
24
24
  },
25
- };
26
- export const createResetPasswordFieldDefinitions = (overrides) => resolveFieldDefinitions(RESET_PASSWORD_FIELD_DEFINITIONS, overrides);
25
+ });
26
+ export const createResetPasswordFieldDefinitions = (t, overrides) => resolveFieldDefinitions(buildResetPasswordFieldDefinitions(t), overrides);
27
27
  // section: label_defaults
28
- const RESET_PASSWORD_LABEL_DEFAULTS = {
29
- heading: "Reset your password",
30
- subHeading: "Enter your new password below.",
31
- submitButton: "Reset password",
32
- cancelButton: "Cancel",
33
- };
34
- export const resolveResetPasswordLabels = (overrides) => resolveLabels(RESET_PASSWORD_LABEL_DEFAULTS, overrides);
28
+ const buildResetPasswordLabelDefaults = (t) => ({
29
+ heading: t("reset_password.heading"),
30
+ subHeading: t("reset_password.sub_heading"),
31
+ submitButton: t("reset_password.submit_button"),
32
+ cancelButton: t("shared.cancel_button"),
33
+ });
34
+ export const resolveResetPasswordLabels = (t, overrides) => resolveLabels(buildResetPasswordLabelDefaults(t), overrides);
35
35
  // section: button_palette_defaults
36
36
  const RESET_PASSWORD_BUTTON_PALETTE_DEFAULTS = {
37
37
  submitBackground: "#0f172a",
@@ -50,4 +50,4 @@ const RESET_PASSWORD_PASSWORD_REQUIREMENT_DEFAULTS = {
50
50
  };
51
51
  export const resolveResetPasswordPasswordRequirements = (overrides) => resolvePasswordRequirements(RESET_PASSWORD_PASSWORD_REQUIREMENT_DEFAULTS, overrides);
52
52
  // section: already_logged_in_label
53
- export const RESET_PASSWORD_ALREADY_LOGGED_IN_MESSAGE_DEFAULT = "You're already logged in.";
53
+ export const getResetPasswordAlreadyLoggedInMessageDefault = (t) => t("shared.guard.already_logged_in_message");