hazo_auth 10.22.2 → 10.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/cli-src/lib/services/password_change_service.ts +4 -30
  2. package/cli-src/lib/utils/password_validator.ts +20 -12
  3. package/dist/admin-issues/plugin.client.d.ts.map +1 -1
  4. package/dist/admin-issues/plugin.client.js +7 -5
  5. package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
  6. package/dist/components/layouts/my_settings/components/password_change_dialog.js +5 -20
  7. package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
  8. package/dist/components/layouts/my_settings/components/set_password_section.js +7 -27
  9. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +3 -1
  10. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
  11. package/dist/components/layouts/my_settings/hooks/use_my_settings.js +25 -44
  12. package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
  13. package/dist/components/layouts/my_settings/index.js +2 -1
  14. package/dist/components/layouts/scope_management/components/branding_editor.d.ts.map +1 -1
  15. package/dist/components/layouts/scope_management/components/branding_editor.js +16 -15
  16. package/dist/components/layouts/user_management/components/app_user_data_editor.d.ts.map +1 -1
  17. package/dist/components/layouts/user_management/components/app_user_data_editor.js +13 -12
  18. package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts.map +1 -1
  19. package/dist/components/layouts/user_management/components/user_signup_stats_cards.js +11 -7
  20. package/dist/components/otp/OTPRequestForm.js +1 -1
  21. package/dist/consent/cookie_consent_banner.d.ts.map +1 -1
  22. package/dist/consent/cookie_consent_banner.js +3 -1
  23. package/dist/consent/manage_modal.d.ts.map +1 -1
  24. package/dist/consent/manage_modal.js +3 -1
  25. package/dist/lib/services/password_change_service.d.ts.map +1 -1
  26. package/dist/lib/services/password_change_service.js +4 -26
  27. package/dist/lib/utils/password_validator.d.ts.map +1 -1
  28. package/dist/lib/utils/password_validator.js +17 -6
  29. package/dist/locales/en.json +96 -12
  30. package/package.json +6 -6
@@ -6,6 +6,7 @@ import argon2 from "argon2";
6
6
  import { get_password_requirements_config } from "../password_requirements_config.server.js";
7
7
  import { send_template_email } from "./email_service.js";
8
8
  import { create_app_logger } from "../app_logger.js";
9
+ import { validate_password } from "../utils/password_validator.js";
9
10
 
10
11
  // section: types
11
12
  export type PasswordChangeData = {
@@ -75,38 +76,11 @@ export async function change_password(
75
76
  const password_requirements = get_password_requirements_config();
76
77
 
77
78
  // Validate new password
78
- if (!new_password || new_password.length < password_requirements.minimum_length) {
79
+ const password_validation = validate_password(new_password, password_requirements);
80
+ if (!password_validation.valid) {
79
81
  return {
80
82
  success: false,
81
- error: `Password must be at least ${password_requirements.minimum_length} characters long`,
82
- };
83
- }
84
-
85
- if (password_requirements.require_uppercase && !/[A-Z]/.test(new_password)) {
86
- return {
87
- success: false,
88
- error: "Password must contain at least one uppercase letter",
89
- };
90
- }
91
-
92
- if (password_requirements.require_lowercase && !/[a-z]/.test(new_password)) {
93
- return {
94
- success: false,
95
- error: "Password must contain at least one lowercase letter",
96
- };
97
- }
98
-
99
- if (password_requirements.require_number && !/[0-9]/.test(new_password)) {
100
- return {
101
- success: false,
102
- error: "Password must contain at least one number",
103
- };
104
- }
105
-
106
- if (password_requirements.require_special && !/[^A-Za-z0-9]/.test(new_password)) {
107
- return {
108
- success: false,
109
- error: "Password must contain at least one special character",
83
+ error: password_validation.errors[0],
110
84
  };
111
85
  }
112
86
 
@@ -1,11 +1,16 @@
1
1
  // file_description: server-side password validation utility
2
2
  //
3
- // Message wording is kept identical (character-for-character) to the
4
- // client-side `validatePassword()` in
5
- // `components/layouts/shared/utils/validation.ts` — that file is the
6
- // i18n-wired canonical source (PRD §16.8 Step 0 dedup); this server-only
7
- // utility mirrors its literal English text so both call sites produce the
8
- // same string, without pulling the `t()` catalog into API route code.
3
+ // Message strings are sourced directly from `../../locales/en.json` (single
4
+ // source of truth, shared with the client-side `validatePassword()` in
5
+ // `components/layouts/shared/utils/validation.ts`) rather than duplicated as
6
+ // hardcoded English literals — this mirrors the pattern already used by
7
+ // `src/strings/default_strings.ts` for importing locale JSON server-side.
8
+ // section: imports
9
+ import en from "../../locales/en.json" with { type: "json" };
10
+
11
+ // section: constants
12
+ const messages = en as Record<string, string>;
13
+
9
14
  // section: types
10
15
  export type PasswordRequirementOptions = {
11
16
  minimum_length: number;
@@ -36,33 +41,36 @@ export function validate_password(
36
41
  if (!password || password.trim().length === 0) {
37
42
  return {
38
43
  valid: false,
39
- errors: ["Password is required"],
44
+ errors: [messages["validation.password_required"]],
40
45
  };
41
46
  }
42
47
 
43
48
  if (password.length < requirements.minimum_length) {
44
49
  errors.push(
45
- `Password must be at least ${requirements.minimum_length} characters.`
50
+ messages["validation.password_too_short"].replace(
51
+ "{{count}}",
52
+ String(requirements.minimum_length)
53
+ )
46
54
  );
47
55
  }
48
56
 
49
57
  if (requirements.require_uppercase && !/[A-Z]/.test(password)) {
50
- errors.push("Password must include at least one uppercase letter.");
58
+ errors.push(messages["validation.password_missing_uppercase"]);
51
59
  }
52
60
 
53
61
  if (requirements.require_lowercase && !/[a-z]/.test(password)) {
54
- errors.push("Password must include at least one lowercase letter.");
62
+ errors.push(messages["validation.password_missing_lowercase"]);
55
63
  }
56
64
 
57
65
  if (requirements.require_number && !/\d/.test(password)) {
58
- errors.push("Password must include at least one number.");
66
+ errors.push(messages["validation.password_missing_number"]);
59
67
  }
60
68
 
61
69
  if (
62
70
  requirements.require_special &&
63
71
  !/[!@#$%^&*(),.?":{}|<>\-_+=\[\];'/\\]/.test(password)
64
72
  ) {
65
- errors.push("Password must include at least one special character.");
73
+ errors.push(messages["validation.password_missing_special"]);
66
74
  }
67
75
 
68
76
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.client.d.ts","sourceRoot":"","sources":["../../src/admin-issues/plugin.client.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,UAAU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CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,UAAU,sBAAsB;IAC9B,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClF;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,sBAAsB,qBAgJxE;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;CACpG,GAAG,IAAI,CAEP"}
@@ -1,7 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
+ import { useAuthT } from "../contexts/hazo_auth_provider.js";
4
5
  export function AuthIssueCard({ issue, onAction }) {
6
+ const t = useAuthT();
5
7
  const [showGrant, setShowGrant] = useState(false);
6
8
  const [showDeny, setShowDeny] = useState(false);
7
9
  const [roleId, setRoleId] = useState('');
@@ -16,7 +18,7 @@ export function AuthIssueCard({ issue, onAction }) {
16
18
  const isActive = issue.status === 'new' || issue.status === 'wip';
17
19
  const handleGrant = async () => {
18
20
  if (!roleId.trim()) {
19
- setError('Please enter a role ID.');
21
+ setError(t("admin_issues.error.role_id_required"));
20
22
  return;
21
23
  }
22
24
  setLoading(true);
@@ -27,7 +29,7 @@ export function AuthIssueCard({ issue, onAction }) {
27
29
  }
28
30
  catch (e) {
29
31
  const err = e;
30
- setError((err === null || err === void 0 ? void 0 : err.message) || 'Grant failed');
32
+ setError((err === null || err === void 0 ? void 0 : err.message) || t("admin_issues.error.grant_failed"));
31
33
  }
32
34
  finally {
33
35
  setLoading(false);
@@ -35,7 +37,7 @@ export function AuthIssueCard({ issue, onAction }) {
35
37
  };
36
38
  const handleDeny = async () => {
37
39
  if (!denyReason.trim()) {
38
- setError('Please provide a reason.');
40
+ setError(t("admin_issues.error.reason_required"));
39
41
  return;
40
42
  }
41
43
  setLoading(true);
@@ -46,13 +48,13 @@ export function AuthIssueCard({ issue, onAction }) {
46
48
  }
47
49
  catch (e) {
48
50
  const err = e;
49
- setError((err === null || err === void 0 ? void 0 : err.message) || 'Deny failed');
51
+ setError((err === null || err === void 0 ? void 0 : err.message) || t("admin_issues.error.deny_failed"));
50
52
  }
51
53
  finally {
52
54
  setLoading(false);
53
55
  }
54
56
  };
55
- return (_jsxs("div", { className: "text-sm space-y-2", children: [_jsx("div", { className: "text-gray-700", children: issue.summary }), missingPerms.length > 0 && (_jsxs("div", { className: "text-xs text-gray-500", children: [_jsx("span", { className: "font-medium", children: "Needs: " }), missingPerms.map((p) => descriptions[p] || p).join(', ')] })), actionLabel && (_jsxs("div", { className: "text-xs text-gray-400", children: [_jsx("span", { className: "font-medium", children: "Tried to: " }), actionLabel] })), originUrl && (_jsxs("div", { className: "text-xs text-gray-400", children: [_jsx("span", { className: "font-medium", children: "From: " }), _jsx("span", { className: "font-mono", children: originUrl })] })), issue.occurrence_count > 1 && (_jsxs("div", { className: "text-xs text-amber-600 font-medium", children: ["Occurred ", issue.occurrence_count, "\u00D7 (first: ", new Date(issue.first_seen_at).toLocaleDateString(), ")"] })), isActive && onAction && (_jsxs("div", { className: "flex gap-2 pt-1", children: [_jsx("button", { onClick: () => { setShowGrant(true); setShowDeny(false); setError(null); }, className: "px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700", children: "Grant" }), _jsx("button", { onClick: () => { setShowDeny(true); setShowGrant(false); setError(null); }, className: "px-2 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700", children: "Deny" })] })), showGrant && (_jsxs("div", { className: "mt-2 p-2 border rounded bg-green-50 space-y-2", children: [_jsx("div", { className: "text-xs font-medium text-green-800", children: "Grant access \u2014 enter the role ID to assign:" }), _jsx("input", { type: "text", value: roleId, onChange: (e) => setRoleId(e.target.value), placeholder: "Role ID (UUID)", className: "w-full text-xs border rounded px-2 py-1" }), error && _jsx("div", { className: "text-xs text-red-600", children: error }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: handleGrant, disabled: loading, className: "px-2 py-1 text-xs bg-green-600 text-white rounded disabled:opacity-50", children: loading ? 'Granting…' : 'Confirm Grant' }), _jsx("button", { onClick: () => setShowGrant(false), className: "px-2 py-1 text-xs border rounded", children: "Cancel" })] })] })), showDeny && (_jsxs("div", { className: "mt-2 p-2 border rounded bg-red-50 space-y-2", children: [_jsx("div", { className: "text-xs font-medium text-red-800", children: "Deny request \u2014 provide a reason:" }), _jsx("textarea", { value: denyReason, onChange: (e) => setDenyReason(e.target.value), placeholder: "Reason for denial", rows: 2, className: "w-full text-xs border rounded px-2 py-1" }), error && _jsx("div", { className: "text-xs text-red-600", children: error }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: handleDeny, disabled: loading, className: "px-2 py-1 text-xs bg-red-600 text-white rounded disabled:opacity-50", children: loading ? 'Denying…' : 'Confirm Deny' }), _jsx("button", { onClick: () => setShowDeny(false), className: "px-2 py-1 text-xs border rounded", children: "Cancel" })] })] })), issue.resolution && (_jsxs("div", { className: `text-xs mt-1 ${issue.resolution === 'granted' ? 'text-green-700' : 'text-red-700'}`, children: [issue.resolution === 'granted' ? '✓ Granted' : '✗ Denied', issue.resolution_reason && `: ${issue.resolution_reason}`] }))] }));
57
+ return (_jsxs("div", { className: "text-sm space-y-2", children: [_jsx("div", { className: "text-gray-700", children: issue.summary }), missingPerms.length > 0 && (_jsxs("div", { className: "text-xs text-gray-500", children: [_jsx("span", { className: "font-medium", children: t("admin_issues.needs_label") }), missingPerms.map((p) => descriptions[p] || p).join(', ')] })), actionLabel && (_jsxs("div", { className: "text-xs text-gray-400", children: [_jsx("span", { className: "font-medium", children: t("admin_issues.tried_to_label") }), actionLabel] })), originUrl && (_jsxs("div", { className: "text-xs text-gray-400", children: [_jsx("span", { className: "font-medium", children: t("admin_issues.from_label") }), _jsx("span", { className: "font-mono", children: originUrl })] })), issue.occurrence_count > 1 && (_jsx("div", { className: "text-xs text-amber-600 font-medium", children: t("admin_issues.occurred_count", { count: issue.occurrence_count, date: new Date(issue.first_seen_at).toLocaleDateString() }) })), isActive && onAction && (_jsxs("div", { className: "flex gap-2 pt-1", children: [_jsx("button", { onClick: () => { setShowGrant(true); setShowDeny(false); setError(null); }, className: "px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700", children: t("admin_issues.grant_button") }), _jsx("button", { onClick: () => { setShowDeny(true); setShowGrant(false); setError(null); }, className: "px-2 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700", children: t("admin_issues.deny_button") })] })), showGrant && (_jsxs("div", { className: "mt-2 p-2 border rounded bg-green-50 space-y-2", children: [_jsx("div", { className: "text-xs font-medium text-green-800", children: t("admin_issues.grant_form_heading") }), _jsx("input", { type: "text", value: roleId, onChange: (e) => setRoleId(e.target.value), placeholder: t("admin_issues.role_id_placeholder"), className: "w-full text-xs border rounded px-2 py-1" }), error && _jsx("div", { className: "text-xs text-red-600", children: error }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: handleGrant, disabled: loading, className: "px-2 py-1 text-xs bg-green-600 text-white rounded disabled:opacity-50", children: loading ? t("admin_issues.granting") : t("admin_issues.confirm_grant") }), _jsx("button", { onClick: () => setShowGrant(false), className: "px-2 py-1 text-xs border rounded", children: t("shared.cancel_button") })] })] })), showDeny && (_jsxs("div", { className: "mt-2 p-2 border rounded bg-red-50 space-y-2", children: [_jsx("div", { className: "text-xs font-medium text-red-800", children: t("admin_issues.deny_form_heading") }), _jsx("textarea", { value: denyReason, onChange: (e) => setDenyReason(e.target.value), placeholder: t("admin_issues.deny_reason_placeholder"), rows: 2, className: "w-full text-xs border rounded px-2 py-1" }), error && _jsx("div", { className: "text-xs text-red-600", children: error }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: handleDeny, disabled: loading, className: "px-2 py-1 text-xs bg-red-600 text-white rounded disabled:opacity-50", children: loading ? t("admin_issues.denying") : t("admin_issues.confirm_deny") }), _jsx("button", { onClick: () => setShowDeny(false), className: "px-2 py-1 text-xs border rounded", children: t("shared.cancel_button") })] })] })), issue.resolution && (_jsxs("div", { className: `text-xs mt-1 ${issue.resolution === 'granted' ? 'text-green-700' : 'text-red-700'}`, children: [issue.resolution === 'granted' ? t("admin_issues.resolution_granted") : t("admin_issues.resolution_denied"), issue.resolution_reason && `: ${issue.resolution_reason}`] }))] }));
56
58
  }
57
59
  /**
58
60
  * Convenience registration function.
@@ -1 +1 @@
1
- {"version":3,"file":"password_change_dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/password_change_dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAI3F,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAGF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,EAAE,yBAAyB,+BAuP3B"}
1
+ {"version":3,"file":"password_change_dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/password_change_dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAK3F,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAGF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,EAAE,yBAAyB,+BAiO3B"}
@@ -9,6 +9,7 @@ import { Button } from "../../../ui/button.js";
9
9
  import { PasswordField } from "../../shared/components/password_field.js";
10
10
  import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js";
11
11
  import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
12
+ import { validatePassword as validateSharedPassword } from "../../shared/utils/validation.js";
12
13
  // section: component
13
14
  /**
14
15
  * Dialog component for changing password
@@ -33,26 +34,10 @@ export function PasswordChangeDialog({ open, onOpenChange, onSave, passwordRequi
33
34
  const [errors, setErrors] = useState({});
34
35
  const [isSubmitting, setIsSubmitting] = useState(false);
35
36
  const validatePassword = (password) => {
36
- if (!password || password.length < passwordRequirements.minimum_length) {
37
- return t("my_settings.set_password.validation.min_length", { length: passwordRequirements.minimum_length });
37
+ if (!password) {
38
+ return t("validation.password_required");
38
39
  }
39
- const errors = [];
40
- if (passwordRequirements.require_uppercase && !/[A-Z]/.test(password)) {
41
- errors.push(t("my_settings.set_password.validation.uppercase_item"));
42
- }
43
- if (passwordRequirements.require_lowercase && !/[a-z]/.test(password)) {
44
- errors.push(t("my_settings.set_password.validation.lowercase_item"));
45
- }
46
- if (passwordRequirements.require_number && !/[0-9]/.test(password)) {
47
- errors.push(t("my_settings.set_password.validation.number_item"));
48
- }
49
- if (passwordRequirements.require_special && !/[^A-Za-z0-9]/.test(password)) {
50
- errors.push(t("my_settings.set_password.validation.special_item"));
51
- }
52
- if (errors.length > 0) {
53
- return t("my_settings.set_password.validation.missing_requirements", { list: errors.join(", ") });
54
- }
55
- return null;
40
+ return validateSharedPassword(password, passwordRequirements, t);
56
41
  };
57
42
  const validateForm = () => {
58
43
  const newErrors = {};
@@ -67,7 +52,7 @@ export function PasswordChangeDialog({ open, onOpenChange, onSave, passwordRequi
67
52
  newErrors.confirmPassword = t("my_settings.set_password.validation.confirm_required");
68
53
  }
69
54
  else if (newPassword !== confirmPassword) {
70
- newErrors.confirmPassword = t("my_settings.set_password.validation.mismatch");
55
+ newErrors.confirmPassword = t("validation.passwords_do_not_match");
71
56
  }
72
57
  setErrors(newErrors);
73
58
  return Object.keys(newErrors).length === 0;
@@ -1 +1 @@
1
- {"version":3,"file":"set_password_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/set_password_section.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAI3F,MAAM,MAAM,uBAAuB,GAAG;IACpC,2CAA2C;IAC3C,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gCAAgC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,oBAAoB,EACpB,aAAa,EACb,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAqB,GACtB,EAAE,uBAAuB,+BA6NzB"}
1
+ {"version":3,"file":"set_password_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/set_password_section.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAK3F,MAAM,MAAM,uBAAuB,GAAG;IACpC,2CAA2C;IAC3C,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gCAAgC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,oBAAoB,EACpB,aAAa,EACb,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAqB,GACtB,EAAE,uBAAuB,+BAgMzB"}
@@ -9,6 +9,7 @@ import { PasswordField } from "../../shared/components/password_field.js";
9
9
  import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js";
10
10
  import { toast } from "sonner";
11
11
  import { useHazoAuthConfig, useAuthT } from "../../../../contexts/hazo_auth_provider.js";
12
+ import { validatePassword as validateSharedPassword } from "../../shared/utils/validation.js";
12
13
  // section: component
13
14
  /**
14
15
  * Set Password Section for My Settings
@@ -33,32 +34,11 @@ export function SetPasswordSection({ passwordRequirements, onPasswordSet, headin
33
34
  * Validates password against requirements
34
35
  */
35
36
  const validatePassword = useCallback((password) => {
36
- if (!password || password.length < passwordRequirements.minimum_length) {
37
- return t("my_settings.set_password.validation.min_length", {
38
- length: passwordRequirements.minimum_length,
39
- });
40
- }
41
- const missingRequirements = [];
42
- if (passwordRequirements.require_uppercase && !/[A-Z]/.test(password)) {
43
- missingRequirements.push(t("my_settings.set_password.validation.uppercase_item"));
44
- }
45
- if (passwordRequirements.require_lowercase && !/[a-z]/.test(password)) {
46
- missingRequirements.push(t("my_settings.set_password.validation.lowercase_item"));
47
- }
48
- if (passwordRequirements.require_number && !/[0-9]/.test(password)) {
49
- missingRequirements.push(t("my_settings.set_password.validation.number_item"));
50
- }
51
- if (passwordRequirements.require_special &&
52
- !/[^A-Za-z0-9]/.test(password)) {
53
- missingRequirements.push(t("my_settings.set_password.validation.special_item"));
54
- }
55
- if (missingRequirements.length > 0) {
56
- return t("my_settings.set_password.validation.missing_requirements", {
57
- list: missingRequirements.join(", "),
58
- });
37
+ if (!password) {
38
+ return t("validation.password_required");
59
39
  }
60
- return null;
61
- }, [passwordRequirements]);
40
+ return validateSharedPassword(password, passwordRequirements, t);
41
+ }, [passwordRequirements, t]);
62
42
  /**
63
43
  * Validates the form before submission
64
44
  */
@@ -72,11 +52,11 @@ export function SetPasswordSection({ passwordRequirements, onPasswordSet, headin
72
52
  newErrors.confirmPassword = t("my_settings.set_password.validation.confirm_required");
73
53
  }
74
54
  else if (newPassword !== confirmPassword) {
75
- newErrors.confirmPassword = t("my_settings.set_password.validation.mismatch");
55
+ newErrors.confirmPassword = t("validation.passwords_do_not_match");
76
56
  }
77
57
  setErrors(newErrors);
78
58
  return Object.keys(newErrors).length === 0;
79
- }, [newPassword, confirmPassword, validatePassword]);
59
+ }, [newPassword, confirmPassword, validatePassword, t]);
80
60
  /**
81
61
  * Handles form submission
82
62
  */
@@ -1,4 +1,5 @@
1
1
  import type { PasswordRequirementOptions } from "../../shared/config/layout_customization";
2
+ import type { AuthTFunction } from "../../../../contexts/hazo_auth_config";
2
3
  export type PasswordFields = {
3
4
  currentPassword: string;
4
5
  newPassword: string;
@@ -40,6 +41,7 @@ export type UseMySettingsResult = {
40
41
  };
41
42
  export type UseMySettingsParams = {
42
43
  passwordRequirements: PasswordRequirementOptions;
44
+ t: AuthTFunction;
43
45
  };
44
46
  /**
45
47
  * Hook for managing my settings state and API calls
@@ -47,5 +49,5 @@ export type UseMySettingsParams = {
47
49
  * @param params - Hook parameters including password requirements
48
50
  * @returns My settings hook result with state and actions
49
51
  */
50
- export declare function use_my_settings({ passwordRequirements, }: UseMySettingsParams): UseMySettingsResult;
52
+ export declare function use_my_settings({ passwordRequirements, t, }: UseMySettingsParams): UseMySettingsResult;
51
53
  //# sourceMappingURL=use_my_settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_my_settings.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/hooks/use_my_settings.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAI3F,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,sBAAsB,EAAE,OAAO,CAAC;IAChC,MAAM,EAAE;QACN,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAChC,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAEhC,IAAI,EAAE,MAAM,CA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AAC,CAAC;IAGjE,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,oBAAoB,EAAE,0BAA0B,CAAC;CAClD,CAAC;AA4BF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,oBAAoB,GACrB,EAAE,mBAAmB,GAAG,mBAAmB,CAuZ3C"}
1
+ {"version":3,"file":"use_my_settings.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/hooks/use_my_settings.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAE3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAI3E,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,sBAAsB,EAAE,OAAO,CAAC;IAChC,MAAM,EAAE;QACN,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAChC,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAEhC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC7D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IAGjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB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@@ -6,26 +6,27 @@ import { useState, useCallback } from "react";
6
6
  import { use_auth_status, trigger_auth_status_refresh } from "../../shared/hooks/use_auth_status.js";
7
7
  import { toast } from "sonner";
8
8
  import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
9
+ import { validatePassword as validateSharedPassword } from "../../shared/utils/validation.js";
9
10
  // section: helpers
10
11
  /**
11
12
  * Validates email format
12
13
  */
13
- const validateEmail = (email) => {
14
+ const validateEmail = (email, t) => {
14
15
  if (!email || email.trim() === "") {
15
- return "Email is required";
16
+ return t("my_settings.email_field.validation_required_default");
16
17
  }
17
18
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
18
19
  if (!emailRegex.test(email)) {
19
- return "Invalid email address format";
20
+ return t("my_settings.email_field.validation_invalid_format_default");
20
21
  }
21
22
  return null;
22
23
  };
23
24
  /**
24
25
  * Validates name (optional, but if provided should not be empty)
25
26
  */
26
- const validateName = (name) => {
27
+ const validateName = (name, t) => {
27
28
  if (name.trim() === "") {
28
- return "Name cannot be empty";
29
+ return t("my_settings.name_field.validation_empty_default");
29
30
  }
30
31
  return null;
31
32
  };
@@ -36,7 +37,7 @@ const validateName = (name) => {
36
37
  * @param params - Hook parameters including password requirements
37
38
  * @returns My settings hook result with state and actions
38
39
  */
39
- export function use_my_settings({ passwordRequirements, }) {
40
+ export function use_my_settings({ passwordRequirements, t, }) {
40
41
  const { apiBasePath } = useHazoAuthConfig();
41
42
  const authStatus = use_auth_status();
42
43
  // Password fields state
@@ -73,7 +74,7 @@ export function use_my_settings({ passwordRequirements, }) {
73
74
  * Updates user name
74
75
  */
75
76
  const handleNameSave = useCallback(async (value) => {
76
- const validationError = validateName(value);
77
+ const validationError = validateName(value, t);
77
78
  if (validationError) {
78
79
  toast.error(validationError);
79
80
  throw new Error(validationError);
@@ -101,12 +102,12 @@ export function use_my_settings({ passwordRequirements, }) {
101
102
  toast.error(errorMessage);
102
103
  throw error;
103
104
  }
104
- }, [refreshUserData]);
105
+ }, [refreshUserData, t]);
105
106
  /**
106
107
  * Updates user email
107
108
  */
108
109
  const handleEmailSave = useCallback(async (value) => {
109
- const validationError = validateEmail(value);
110
+ const validationError = validateEmail(value, t);
110
111
  if (validationError) {
111
112
  toast.error(validationError);
112
113
  throw new Error(validationError);
@@ -127,10 +128,10 @@ export function use_my_settings({ passwordRequirements, }) {
127
128
  throw new Error(errorMessage);
128
129
  }
129
130
  if (data.email_changed) {
130
- toast.success("Email updated successfully. Please verify your new email address.");
131
+ toast.success(t("my_settings.email_field.update_success_verify"));
131
132
  }
132
133
  else {
133
- toast.success("Email updated successfully");
134
+ toast.success(t("my_settings.email_field.update_success"));
134
135
  }
135
136
  await refreshUserData();
136
137
  }
@@ -139,7 +140,7 @@ export function use_my_settings({ passwordRequirements, }) {
139
140
  toast.error(errorMessage);
140
141
  throw error;
141
142
  }
142
- }, [refreshUserData]);
143
+ }, [refreshUserData, t]);
143
144
  /**
144
145
  * Updates the user's preferred locale (BCP 47 tag, e.g. "en", "pt-BR")
145
146
  */
@@ -168,31 +169,6 @@ export function use_my_settings({ passwordRequirements, }) {
168
169
  throw error;
169
170
  }
170
171
  }, [apiBasePath, refreshUserData]);
171
- /**
172
- * Validates password requirements
173
- */
174
- const validatePassword = useCallback((password) => {
175
- if (!password || password.length < passwordRequirements.minimum_length) {
176
- return `Password must be at least ${passwordRequirements.minimum_length} characters long`;
177
- }
178
- const errors = [];
179
- if (passwordRequirements.require_uppercase && !/[A-Z]/.test(password)) {
180
- errors.push("uppercase letter");
181
- }
182
- if (passwordRequirements.require_lowercase && !/[a-z]/.test(password)) {
183
- errors.push("lowercase letter");
184
- }
185
- if (passwordRequirements.require_number && !/[0-9]/.test(password)) {
186
- errors.push("number");
187
- }
188
- if (passwordRequirements.require_special && !/[^A-Za-z0-9]/.test(password)) {
189
- errors.push("special character");
190
- }
191
- if (errors.length > 0) {
192
- return `Password must contain at least one: ${errors.join(", ")}`;
193
- }
194
- return null;
195
- }, [passwordRequirements]);
196
172
  /**
197
173
  * Handles password field change
198
174
  */
@@ -222,21 +198,26 @@ export function use_my_settings({ passwordRequirements, }) {
222
198
  const validatePasswordForm = useCallback(() => {
223
199
  const errors = {};
224
200
  if (!passwordFields.currentPassword) {
225
- errors.currentPassword = "Current password is required";
201
+ errors.currentPassword = t("my_settings.password_change_dialog.current_password_required");
202
+ }
203
+ if (!passwordFields.newPassword) {
204
+ errors.newPassword = t("validation.password_required");
226
205
  }
227
- const newPasswordError = validatePassword(passwordFields.newPassword);
228
- if (newPasswordError) {
229
- errors.newPassword = newPasswordError;
206
+ else {
207
+ const newPasswordErrors = validateSharedPassword(passwordFields.newPassword, passwordRequirements, t);
208
+ if (newPasswordErrors) {
209
+ errors.newPassword = newPasswordErrors;
210
+ }
230
211
  }
231
212
  if (!passwordFields.confirmPassword) {
232
- errors.confirmPassword = "Please confirm your new password";
213
+ errors.confirmPassword = t("my_settings.set_password.validation.confirm_required");
233
214
  }
234
215
  else if (passwordFields.newPassword !== passwordFields.confirmPassword) {
235
- errors.confirmPassword = "Passwords do not match";
216
+ errors.confirmPassword = t("validation.passwords_do_not_match");
236
217
  }
237
218
  setPasswordFields((prev) => (Object.assign(Object.assign({}, prev), { errors })));
238
219
  return Object.keys(errors).length === 0;
239
- }, [passwordFields, validatePassword]);
220
+ }, [passwordFields, passwordRequirements, t]);
240
221
  /**
241
222
  * Checks if password save should be disabled
242
223
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/my_settings/index.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGnG,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,uCAAuC,CAAC;AAS/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;I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C,sBAAsB,EAAE,MAAM,CAAC;QAC/B,2BAA2B,EAAE,MAAM,CAAC;QACpC,uBAAuB,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,yBAAyB,EAAE,MAAM,CAAC;QAClC,uBAAuB,EAAE,MAAM,CAAC;QAChC,0BAA0B,EAAE,MAAM,CAAC;QACnC,0BAA0B,EAAE,MAAM,CAAC;QACnC,+BAA+B,EAAE,MAAM,CAAC;QACxC,4BAA4B,EAAE,MAAM,CAAC;KACtC,CAAC;IACF,SAAS,EAAE;QACT,wBAAwB,EAAE,MAAM,EAAE,CAAC;QACnC,wBAAwB,EAAE,MAAM,EAAE,CAAC;KACpC,CAAC;CACH,CAAC;AAGF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,SAAS,EACT,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,SAA8B,EAC9B,gBAAgB,EAChB,qBAA6B,EAC7B,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE,qBAAqB,+BAiRvB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/my_settings/index.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGnG,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,uCAAuC,CAAC;AAS/C,MAAM,MAAM,qBAAqB,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,EAAE;QACR,6BAA6B,EAAE,MAAM,CAAC;QACtC,sBAAsB,EAAE,MAAM,CAAC;QAC/B,2BAA2B,EAAE,MAAM,CAAC;QACpC,uBAAuB,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,yBAAyB,EAAE,MAAM,CAAC;QAClC,uBAAuB,EAAE,MAAM,CAAC;QAChC,0BAA0B,EAAE,MAAM,CAAC;QACnC,0BAA0B,EAAE,MAAM,CAAC;QACnC,+BAA+B,EAAE,MAAM,CAAC;QACxC,4BAA4B,EAAE,MAAM,CAAC;KACtC,CAAC;IACF,SAAS,EAAE;QACT,wBAAwB,EAAE,MAAM,EAAE,CAAC;QACnC,wBAAwB,EAAE,MAAM,EAAE,CAAC;KACpC,CAAC;CACH,CAAC;AAGF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,SAAS,EACT,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,SAA8B,EAC9B,gBAAgB,EAChB,qBAA6B,EAC7B,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE,qBAAqB,+BAkRvB"}
@@ -63,8 +63,9 @@ export default function my_settings_layout({ className, labels, button_colors, p
63
63
  };
64
64
  const settings = use_my_settings({
65
65
  passwordRequirements: password_requirements,
66
+ t,
66
67
  });
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: {
68
+ 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("shared.field.email.label"), value: settings.email, type: "email", placeholder: t("shared.field.email.placeholder"), onSave: settings.handleEmailSave, validation: validateEmail, disabled: settings.loading, ariaLabel: t("shared.field.email.aria_label") })), _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: {
68
69
  backgroundColor: resolvedButtonPalette.submitBackground,
69
70
  color: resolvedButtonPalette.submitText,
70
71
  }, "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) => {
@@ -1 +1 @@
1
- {"version":3,"file":"branding_editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/scope_management/components/branding_editor.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,YAAY,CAAC;QAAC,GAAG,CAAC,EAAE,YAAY,CAAA;KAAE,CAAC;CACxD,CAAC;AAQF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,eAAe,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CACvC,CAAC;AAQF,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,MAAM,EACN,eAAe,GAChB,EAAE,mBAAmB,+BA2jBrB"}
1
+ {"version":3,"file":"branding_editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/scope_management/components/branding_editor.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,YAAY,CAAC;QAAC,GAAG,CAAC,EAAE,YAAY,CAAA;KAAE,CAAC;CACxD,CAAC;AAQF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,eAAe,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CACvC,CAAC;AAQF,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,MAAM,EACN,eAAe,GAChB,EAAE,mBAAmB,+BA4jBrB"}