hazo_auth 10.22.2 → 10.23.2

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 (56) 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/admin-issues/plugin.server.d.ts.map +1 -1
  6. package/dist/admin-issues/plugin.server.js +29 -18
  7. package/dist/components/layouts/create_firm/hooks/use_create_firm_form.d.ts.map +1 -1
  8. package/dist/components/layouts/create_firm/hooks/use_create_firm_form.js +10 -8
  9. package/dist/components/layouts/create_firm/index.d.ts +1 -1
  10. package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
  11. package/dist/components/layouts/create_firm/index.js +15 -1
  12. package/dist/components/layouts/dev_lock/index.d.ts +1 -1
  13. package/dist/components/layouts/dev_lock/index.d.ts.map +1 -1
  14. package/dist/components/layouts/dev_lock/index.js +6 -2
  15. package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
  16. package/dist/components/layouts/my_settings/components/password_change_dialog.js +5 -20
  17. package/dist/components/layouts/my_settings/components/profile_picture_display.d.ts.map +1 -1
  18. package/dist/components/layouts/my_settings/components/profile_picture_display.js +3 -1
  19. package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
  20. package/dist/components/layouts/my_settings/components/set_password_section.js +7 -27
  21. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +3 -1
  22. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
  23. package/dist/components/layouts/my_settings/hooks/use_my_settings.js +45 -64
  24. package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
  25. package/dist/components/layouts/my_settings/index.js +2 -1
  26. package/dist/components/layouts/register/hooks/use_register_form.js +2 -2
  27. package/dist/components/layouts/scope_management/components/branding_editor.d.ts.map +1 -1
  28. package/dist/components/layouts/scope_management/components/branding_editor.js +16 -15
  29. package/dist/components/layouts/shared/components/profile_stamp.d.ts.map +1 -1
  30. package/dist/components/layouts/shared/components/profile_stamp.js +7 -3
  31. package/dist/components/layouts/user_management/components/app_user_data_editor.d.ts.map +1 -1
  32. package/dist/components/layouts/user_management/components/app_user_data_editor.js +13 -12
  33. package/dist/components/layouts/user_management/components/roles_matrix.js +2 -2
  34. package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts.map +1 -1
  35. package/dist/components/layouts/user_management/components/user_signup_stats_cards.js +11 -7
  36. package/dist/components/layouts/user_management/index.d.ts.map +1 -1
  37. package/dist/components/layouts/user_management/index.js +17 -17
  38. package/dist/components/otp/OTPRequestForm.js +1 -1
  39. package/dist/components/user_picker_select.d.ts +1 -1
  40. package/dist/components/user_picker_select.d.ts.map +1 -1
  41. package/dist/components/user_picker_select.js +6 -2
  42. package/dist/consent/cookie_consent_banner.d.ts.map +1 -1
  43. package/dist/consent/cookie_consent_banner.js +3 -1
  44. package/dist/consent/manage_modal.d.ts.map +1 -1
  45. package/dist/consent/manage_modal.js +3 -1
  46. package/dist/lib/services/password_change_service.d.ts.map +1 -1
  47. package/dist/lib/services/password_change_service.js +4 -26
  48. package/dist/lib/utils/password_validator.d.ts.map +1 -1
  49. package/dist/lib/utils/password_validator.js +17 -6
  50. package/dist/locales/en.json +193 -12
  51. package/dist/page_components/create_firm.d.ts.map +1 -1
  52. package/dist/page_components/create_firm.js +7 -4
  53. package/dist/page_components/my_settings.d.ts +1 -1
  54. package/dist/page_components/my_settings.d.ts.map +1 -1
  55. package/dist/page_components/my_settings.js +15 -1
  56. package/package.json +8 -8
@@ -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;IACx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,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzH,0BAA0B,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAGhD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,yBAAyB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,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;KAC1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AC,CAAC;IAClD,yBAAyB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAGjE,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,CAAC,EAAE,aAAa,CAAC;CAClB,CAAC;AA4BF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,oBAAoB,EACpB,CAAC,GACF,EAAE,mBAAmB,GAAG,mBAAmB,CA0X3C"}
@@ -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);
@@ -89,24 +90,24 @@ export function use_my_settings({ passwordRequirements, }) {
89
90
  });
90
91
  const data = await response.json();
91
92
  if (!response.ok || !data.success) {
92
- const errorMessage = data.error || "Failed to update name";
93
+ const errorMessage = data.error || t("my_settings.toast.name_error");
93
94
  toast.error(errorMessage);
94
95
  throw new Error(errorMessage);
95
96
  }
96
- toast.success("Name updated successfully");
97
+ toast.success(t("my_settings.toast.name_success"));
97
98
  await refreshUserData();
98
99
  }
99
100
  catch (error) {
100
- const errorMessage = error instanceof Error ? error.message : "Failed to update name";
101
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.toast.name_error");
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);
@@ -122,24 +123,24 @@ export function use_my_settings({ passwordRequirements, }) {
122
123
  });
123
124
  const data = await response.json();
124
125
  if (!response.ok || !data.success) {
125
- const errorMessage = data.error || "Failed to update email";
126
+ const errorMessage = data.error || t("my_settings.toast.email_error");
126
127
  toast.error(errorMessage);
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
  }
137
138
  catch (error) {
138
- const errorMessage = error instanceof Error ? error.message : "Failed to update email";
139
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.toast.email_error");
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
  */
@@ -155,44 +156,19 @@ export function use_my_settings({ passwordRequirements, }) {
155
156
  });
156
157
  const data = await response.json();
157
158
  if (!response.ok || !data.success) {
158
- const errorMessage = data.error || "Failed to update language preference";
159
+ const errorMessage = data.error || t("my_settings.toast.language_error");
159
160
  toast.error(errorMessage);
160
161
  throw new Error(errorMessage);
161
162
  }
162
- toast.success("Language preference updated");
163
+ toast.success(t("my_settings.toast.language_success"));
163
164
  await refreshUserData();
164
165
  }
165
166
  catch (error) {
166
- const errorMessage = error instanceof Error ? error.message : "Failed to update language preference";
167
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.toast.language_error");
167
168
  toast.error(errorMessage);
168
169
  throw error;
169
170
  }
170
- }, [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]);
171
+ }, [apiBasePath, refreshUserData, t]);
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");
226
202
  }
227
- const newPasswordError = validatePassword(passwordFields.newPassword);
228
- if (newPasswordError) {
229
- errors.newPassword = newPasswordError;
203
+ if (!passwordFields.newPassword) {
204
+ errors.newPassword = t("validation.password_required");
205
+ }
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
  */
@@ -264,12 +245,12 @@ export function use_my_settings({ passwordRequirements, }) {
264
245
  });
265
246
  const data = await response.json();
266
247
  if (!response.ok || !data.success) {
267
- const errorMessage = data.error || "Failed to change password";
248
+ const errorMessage = data.error || t("my_settings.toast.password_error");
268
249
  setPasswordFields((prev) => (Object.assign(Object.assign({}, prev), { errors: { currentPassword: errorMessage } })));
269
250
  toast.error(errorMessage);
270
251
  throw new Error(errorMessage);
271
252
  }
272
- toast.success("Password changed successfully");
253
+ toast.success(t("my_settings.toast.password_success"));
273
254
  // Reset password fields
274
255
  setPasswordFields({
275
256
  currentPassword: "",
@@ -282,7 +263,7 @@ export function use_my_settings({ passwordRequirements, }) {
282
263
  });
283
264
  }
284
265
  catch (error) {
285
- const errorMessage = error instanceof Error ? error.message : "Failed to change password";
266
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.toast.password_error");
286
267
  toast.error(errorMessage);
287
268
  throw error;
288
269
  }
@@ -322,20 +303,20 @@ export function use_my_settings({ passwordRequirements, }) {
322
303
  });
323
304
  const data = await response.json();
324
305
  if (!response.ok || !data.success) {
325
- const errorMessage = data.error || "Failed to update profile picture";
306
+ const errorMessage = data.error || t("my_settings.toast.profile_picture_error");
326
307
  toast.error(errorMessage);
327
308
  throw new Error(errorMessage);
328
309
  }
329
- toast.success("Profile picture updated successfully");
310
+ toast.success(t("my_settings.toast.profile_picture_success"));
330
311
  await refreshUserData();
331
312
  setProfilePictureDialogOpen(false);
332
313
  }
333
314
  catch (error) {
334
- const errorMessage = error instanceof Error ? error.message : "Failed to update profile picture";
315
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.toast.profile_picture_error");
335
316
  toast.error(errorMessage);
336
317
  throw error;
337
318
  }
338
- }, [refreshUserData]);
319
+ }, [refreshUserData, t]);
339
320
  /**
340
321
  * Removes profile picture
341
322
  * - If upload: deletes the file and clears profile_picture_url and profile_source
@@ -352,19 +333,19 @@ export function use_my_settings({ passwordRequirements, }) {
352
333
  });
353
334
  const data = await response.json();
354
335
  if (!response.ok || !data.success) {
355
- const errorMessage = data.error || "Failed to remove profile picture";
336
+ const errorMessage = data.error || t("my_settings.toast.profile_picture_remove_error");
356
337
  toast.error(errorMessage);
357
338
  throw new Error(errorMessage);
358
339
  }
359
- toast.success("Profile picture removed successfully");
340
+ toast.success(t("my_settings.toast.profile_picture_removed"));
360
341
  await refreshUserData();
361
342
  }
362
343
  catch (error) {
363
- const errorMessage = error instanceof Error ? error.message : "Failed to remove profile picture";
344
+ const errorMessage = error instanceof Error ? error.message : t("my_settings.toast.profile_picture_remove_error");
364
345
  toast.error(errorMessage);
365
346
  throw error;
366
347
  }
367
- }, [refreshUserData]);
348
+ }, [refreshUserData, t]);
368
349
  return {
369
350
  name,
370
351
  email,
@@ -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;IACnB,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,qBAAqB,EAAE,0BAA0B,CAAC;IAClD,cAAc,EAAE;QACd,kBAAkB,EAAE,OAAO,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,4BAA4B,EAAE,UAAU,GAAG,SAAS,CAAC;QACrD,4BAA4B,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;QACtD,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,UAAU,EAAE;QACV,eAAe,EAAE,OAAO,CAAC;QACzB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,mBAAmB,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC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BAA6B,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,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,qBAAqB,EAAE,0BAA0B,CAAC;IAClD,cAAc,EAAE;QACd,kBAAkB,EAAE,OAAO,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,4BAA4B,EAAE,UAAU,GAAG,SAAS,CAAC;QACrD,4BAA4B,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;QACtD,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,UAAU,EAAE;QACV,eAAe,EAAE,OAAO,CAAC;QACzB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,mBAAmB,EAAE,OAAO,CAAC;KAC9B,CAAC;IACF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG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BAAgB,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) => {
@@ -187,9 +187,9 @@ export const use_register_form = ({ showNameField, passwordRequirements, dataCli
187
187
  set_legal_accepted({});
188
188
  }
189
189
  catch (error) {
190
- const errorMessage = error instanceof Error ? error.message : "Registration failed. Please try again.";
190
+ const errorMessage = error instanceof Error ? error.message : t("register.error.failed_retry_message");
191
191
  // Show error notification
192
- toast.error("Registration failed", {
192
+ toast.error(t("register.failed_message"), {
193
193
  description: errorMessage,
194
194
  });
195
195
  // Set error state
@@ -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"}
@@ -10,7 +10,7 @@ import { Label } from "../../../ui/label.js";
10
10
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../../../ui/dialog.js";
11
11
  import { Loader2, Upload, Trash2, CircleCheck, CircleX, Image as ImageIcon, Palette, Plus, } from "lucide-react";
12
12
  import { toast } from "sonner";
13
- import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
13
+ import { useHazoAuthConfig, useAuthT } from "../../../../contexts/hazo_auth_provider.js";
14
14
  // section: helpers
15
15
  function isValidHexColor(color) {
16
16
  return /^#[0-9A-Fa-f]{6}$/.test(color);
@@ -19,6 +19,7 @@ function isValidHexColor(color) {
19
19
  export function BrandingEditor({ scopeId, scopeName, isOpen, onClose, onSave, initialBranding, }) {
20
20
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
21
21
  const { apiBasePath } = useHazoAuthConfig();
22
+ const t = useAuthT();
22
23
  // State
23
24
  const [loading, setLoading] = useState(false);
24
25
  const [saving, setSaving] = useState(false);
@@ -68,7 +69,7 @@ export function BrandingEditor({ scopeId, scopeName, isOpen, onClose, onSave, in
68
69
  }
69
70
  }
70
71
  catch (error) {
71
- toast.error("Failed to load branding");
72
+ toast.error(t("branding.toast.load_failed"));
72
73
  }
73
74
  finally {
74
75
  setLoading(false);
@@ -88,14 +89,14 @@ export function BrandingEditor({ scopeId, scopeName, isOpen, onClose, onSave, in
88
89
  const data = await response.json();
89
90
  if (data.success) {
90
91
  setLogoUrl(data.logo_url);
91
- toast.success("Logo uploaded successfully");
92
+ toast.success(t("branding.toast.upload_success"));
92
93
  }
93
94
  else {
94
- toast.error(data.error || "Failed to upload logo");
95
+ toast.error(data.error || t("branding.toast.upload_failed"));
95
96
  }
96
97
  }
97
98
  catch (error) {
98
- toast.error("Failed to upload logo");
99
+ toast.error(t("branding.toast.upload_failed"));
99
100
  }
100
101
  finally {
101
102
  setUploading(false);
@@ -118,11 +119,11 @@ export function BrandingEditor({ scopeId, scopeName, isOpen, onClose, onSave, in
118
119
  const handleSave = async () => {
119
120
  // Validate colors
120
121
  if (primaryColor && !isValidHexColor(primaryColor)) {
121
- toast.error("Invalid primary color format (use #RRGGBB)");
122
+ toast.error(t("branding.toast.invalid_primary_color"));
122
123
  return;
123
124
  }
124
125
  if (secondaryColor && !isValidHexColor(secondaryColor)) {
125
- toast.error("Invalid secondary color format (use #RRGGBB)");
126
+ toast.error(t("branding.toast.invalid_secondary_color"));
126
127
  return;
127
128
  }
128
129
  setSaving(true);
@@ -158,16 +159,16 @@ export function BrandingEditor({ scopeId, scopeName, isOpen, onClose, onSave, in
158
159
  });
159
160
  const data = await response.json();
160
161
  if (data.success) {
161
- toast.success("Branding saved successfully");
162
+ toast.success(t("branding.toast.save_success"));
162
163
  onSave === null || onSave === void 0 ? void 0 : onSave(hasValues ? branding : null);
163
164
  onClose();
164
165
  }
165
166
  else {
166
- toast.error(data.error || "Failed to save branding");
167
+ toast.error(data.error || t("branding.toast.save_failed"));
167
168
  }
168
169
  }
169
170
  catch (error) {
170
- toast.error("Failed to save branding");
171
+ toast.error(t("branding.toast.save_failed"));
171
172
  }
172
173
  finally {
173
174
  setSaving(false);
@@ -191,15 +192,15 @@ export function BrandingEditor({ scopeId, scopeName, isOpen, onClose, onSave, in
191
192
  setPublicCopyright("");
192
193
  setPublicLinks([]);
193
194
  setAppCopyright("");
194
- toast.success("Branding cleared");
195
+ toast.success(t("branding.toast.clear_success"));
195
196
  onSave === null || onSave === void 0 ? void 0 : onSave(null);
196
197
  }
197
198
  else {
198
- toast.error(data.error || "Failed to clear branding");
199
+ toast.error(data.error || t("branding.toast.clear_failed"));
199
200
  }
200
201
  }
201
202
  catch (error) {
202
- toast.error("Failed to clear branding");
203
+ toast.error(t("branding.toast.clear_failed"));
203
204
  }
204
205
  finally {
205
206
  setSaving(false);
@@ -219,10 +220,10 @@ export function BrandingEditor({ scopeId, scopeName, isOpen, onClose, onSave, in
219
220
  const handleFooterLinkChange = (index, field, value) => {
220
221
  setPublicLinks((prev) => prev.map((link, i) => (i === index ? Object.assign(Object.assign({}, link), { [field]: value }) : link)));
221
222
  };
222
- return (_jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "cls_branding_editor_dialog max-w-lg", children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { className: "flex items-center gap-2", children: [_jsx(Palette, { className: "h-5 w-5" }), "Firm Branding"] }), _jsxs(DialogDescription, { children: ["Customize branding for \"", scopeName, "\""] })] }), loading ? (_jsx("div", { className: "flex items-center justify-center p-8", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-slate-400" }) })) : (_jsxs("div", { className: "flex flex-col gap-6 py-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Logo" }), _jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: "flex-shrink-0 w-24 h-24 border rounded-lg overflow-hidden bg-muted flex items-center justify-center", children: logoUrl ? (_jsx("img", { src: logoUrl, alt: "Firm logo", className: "w-full h-full object-contain" })) : (_jsx(ImageIcon, { className: "h-8 w-8 text-muted-foreground" })) }), _jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [_jsx("input", { type: "file", ref: fileInputRef, onChange: handleFileChange, accept: "image/png,image/jpeg,image/svg+xml,image/webp", className: "hidden" }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: handleUploadClick, disabled: uploading, children: uploading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }), "Uploading..."] })) : (_jsxs(_Fragment, { children: [_jsx(Upload, { className: "h-4 w-4 mr-2" }), "Upload Logo"] })) }), logoUrl && (_jsxs(Button, { type: "button", variant: "ghost", size: "sm", onClick: handleRemoveLogo, className: "text-destructive hover:text-destructive", children: [_jsx(Trash2, { className: "h-4 w-4 mr-2" }), "Remove"] })), _jsx("p", { className: "text-xs text-muted-foreground", children: "PNG, JPG, SVG or WebP. Max 500KB." })] })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "primary_color", children: "Primary Color" }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { id: "primary_color", type: "text", value: primaryColor, onChange: (e) => setPrimaryColor(e.target.value), placeholder: "#1a73e8", className: "flex-1" }), _jsx("input", { type: "color", value: primaryColor || "#000000", onChange: (e) => setPrimaryColor(e.target.value), className: "w-10 h-10 rounded border cursor-pointer", title: "Pick color" })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "secondary_color", children: "Secondary Color" }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { id: "secondary_color", type: "text", value: secondaryColor, onChange: (e) => setSecondaryColor(e.target.value), placeholder: "#4285f4", className: "flex-1" }), _jsx("input", { type: "color", value: secondaryColor || "#000000", onChange: (e) => setSecondaryColor(e.target.value), className: "w-10 h-10 rounded border cursor-pointer", title: "Pick color" })] })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "tagline", children: "Tagline" }), _jsx(Input, { id: "tagline", type: "text", value: tagline, onChange: (e) => setTagline(e.target.value), placeholder: "Your trusted partner", maxLength: 200 }), _jsx("p", { className: "text-xs text-muted-foreground", children: "A short company tagline (max 200 characters)" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "app_title", children: "App Title" }), _jsx(Input, { id: "app_title", type: "text", value: appTitle, onChange: (e) => setAppTitle(e.target.value), placeholder: "Acme Portal", maxLength: 200 }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Title shown in the app chrome (browser tab, header)" })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(Label, { children: "Footer" }), _jsxs("div", { className: "flex flex-col gap-2 rounded-lg border p-3", children: [_jsx(Label, { htmlFor: "public_footer_copyright", className: "text-xs text-muted-foreground", children: "Public Footer Copyright" }), _jsx(Input, { id: "public_footer_copyright", type: "text", value: publicCopyright, onChange: (e) => setPublicCopyright(e.target.value), placeholder: "\u00A9 2026 Acme Inc." }), _jsxs("div", { className: "flex flex-col gap-2 mt-2", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: "Public Footer Links" }), publicLinks.map((link, index) => (_jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Input, { type: "text", value: link.label, onChange: (e) => handleFooterLinkChange(index, "label", e.target.value), placeholder: "Label", className: "flex-1" }), _jsx(Input, { type: "text", value: link.href, onChange: (e) => handleFooterLinkChange(index, "href", e.target.value), placeholder: "/privacy", className: "flex-1" }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => handleRemoveFooterLink(index), className: "text-destructive hover:text-destructive", children: _jsx(Trash2, { className: "h-4 w-4" }) })] }, index))), _jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: handleAddFooterLink, className: "self-start", children: [_jsx(Plus, { className: "h-4 w-4 mr-2" }), "Add Link"] })] })] }), _jsxs("div", { className: "flex flex-col gap-2 rounded-lg border p-3", children: [_jsx(Label, { htmlFor: "app_footer_copyright", className: "text-xs text-muted-foreground", children: "App Footer Copyright" }), _jsx(Input, { id: "app_footer_copyright", type: "text", value: appCopyright, onChange: (e) => setAppCopyright(e.target.value), placeholder: "\u00A9 2026 Acme Inc." })] })] }), (logoUrl || primaryColor || tagline) && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Preview" }), _jsx("div", { className: "p-4 rounded-lg border", style: {
223
+ return (_jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "cls_branding_editor_dialog max-w-lg", children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { className: "flex items-center gap-2", children: [_jsx(Palette, { className: "h-5 w-5" }), t("branding.dialog_title")] }), _jsx(DialogDescription, { children: t("branding.dialog_description", { scopeName }) })] }), loading ? (_jsx("div", { className: "flex items-center justify-center p-8", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-slate-400" }) })) : (_jsxs("div", { className: "flex flex-col gap-6 py-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t("branding.logo_label") }), _jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: "flex-shrink-0 w-24 h-24 border rounded-lg overflow-hidden bg-muted flex items-center justify-center", children: logoUrl ? (_jsx("img", { src: logoUrl, alt: t("branding.logo_alt"), className: "w-full h-full object-contain" })) : (_jsx(ImageIcon, { className: "h-8 w-8 text-muted-foreground" })) }), _jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [_jsx("input", { type: "file", ref: fileInputRef, onChange: handleFileChange, accept: "image/png,image/jpeg,image/svg+xml,image/webp", className: "hidden" }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: handleUploadClick, disabled: uploading, children: uploading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }), t("branding.uploading")] })) : (_jsxs(_Fragment, { children: [_jsx(Upload, { className: "h-4 w-4 mr-2" }), t("branding.upload_logo_button")] })) }), logoUrl && (_jsxs(Button, { type: "button", variant: "ghost", size: "sm", onClick: handleRemoveLogo, className: "text-destructive hover:text-destructive", children: [_jsx(Trash2, { className: "h-4 w-4 mr-2" }), t("branding.remove_button")] })), _jsx("p", { className: "text-xs text-muted-foreground", children: t("branding.logo_hint") })] })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "primary_color", children: t("branding.primary_color_label") }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { id: "primary_color", type: "text", value: primaryColor, onChange: (e) => setPrimaryColor(e.target.value), placeholder: "#1a73e8", className: "flex-1" }), _jsx("input", { type: "color", value: primaryColor || "#000000", onChange: (e) => setPrimaryColor(e.target.value), className: "w-10 h-10 rounded border cursor-pointer", title: t("branding.pick_color_title") })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "secondary_color", children: t("branding.secondary_color_label") }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { id: "secondary_color", type: "text", value: secondaryColor, onChange: (e) => setSecondaryColor(e.target.value), placeholder: "#4285f4", className: "flex-1" }), _jsx("input", { type: "color", value: secondaryColor || "#000000", onChange: (e) => setSecondaryColor(e.target.value), className: "w-10 h-10 rounded border cursor-pointer", title: t("branding.pick_color_title") })] })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "tagline", children: t("branding.tagline_label") }), _jsx(Input, { id: "tagline", type: "text", value: tagline, onChange: (e) => setTagline(e.target.value), placeholder: t("branding.tagline_placeholder"), maxLength: 200 }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("branding.tagline_hint") })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "app_title", children: t("branding.app_title_label") }), _jsx(Input, { id: "app_title", type: "text", value: appTitle, onChange: (e) => setAppTitle(e.target.value), placeholder: t("branding.app_title_placeholder"), maxLength: 200 }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("branding.app_title_hint") })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(Label, { children: t("branding.footer_label") }), _jsxs("div", { className: "flex flex-col gap-2 rounded-lg border p-3", children: [_jsx(Label, { htmlFor: "public_footer_copyright", className: "text-xs text-muted-foreground", children: t("branding.public_footer_copyright_label") }), _jsx(Input, { id: "public_footer_copyright", type: "text", value: publicCopyright, onChange: (e) => setPublicCopyright(e.target.value), placeholder: t("branding.footer_copyright_placeholder") }), _jsxs("div", { className: "flex flex-col gap-2 mt-2", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: t("branding.public_footer_links_label") }), publicLinks.map((link, index) => (_jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Input, { type: "text", value: link.label, onChange: (e) => handleFooterLinkChange(index, "label", e.target.value), placeholder: t("branding.link_label_placeholder"), className: "flex-1" }), _jsx(Input, { type: "text", value: link.href, onChange: (e) => handleFooterLinkChange(index, "href", e.target.value), placeholder: t("branding.link_href_placeholder"), className: "flex-1" }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => handleRemoveFooterLink(index), className: "text-destructive hover:text-destructive", children: _jsx(Trash2, { className: "h-4 w-4" }) })] }, index))), _jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: handleAddFooterLink, className: "self-start", children: [_jsx(Plus, { className: "h-4 w-4 mr-2" }), t("branding.add_link_button")] })] })] }), _jsxs("div", { className: "flex flex-col gap-2 rounded-lg border p-3", children: [_jsx(Label, { htmlFor: "app_footer_copyright", className: "text-xs text-muted-foreground", children: t("branding.app_footer_copyright_label") }), _jsx(Input, { id: "app_footer_copyright", type: "text", value: appCopyright, onChange: (e) => setAppCopyright(e.target.value), placeholder: t("branding.footer_copyright_placeholder") })] })] }), (logoUrl || primaryColor || tagline) && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t("branding.preview_label") }), _jsx("div", { className: "p-4 rounded-lg border", style: {
223
224
  backgroundColor: primaryColor
224
225
  ? `${primaryColor}10`
225
226
  : undefined,
226
227
  borderColor: primaryColor || undefined,
227
- }, children: _jsxs("div", { className: "flex items-center gap-3", children: [logoUrl && (_jsx("img", { src: logoUrl, alt: "Logo preview", className: "h-10 w-10 object-contain" })), _jsxs("div", { children: [_jsx("div", { className: "font-semibold", style: { color: primaryColor || undefined }, children: scopeName }), tagline && (_jsx("div", { className: "text-sm", style: { color: secondaryColor || undefined }, children: tagline }))] })] }) })] }))] })), _jsxs(DialogFooter, { className: "flex gap-2 sm:gap-0", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: handleClear, disabled: saving || loading, className: "text-destructive hover:text-destructive", children: [_jsx(Trash2, { className: "h-4 w-4 mr-2" }), "Clear All"] }), _jsx("div", { className: "flex-1" }), _jsxs(Button, { variant: "outline", onClick: onClose, disabled: saving, children: [_jsx(CircleX, { className: "h-4 w-4 mr-2" }), "Cancel"] }), _jsx(Button, { onClick: handleSave, disabled: saving || loading, children: saving ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }), "Saving..."] })) : (_jsxs(_Fragment, { children: [_jsx(CircleCheck, { className: "h-4 w-4 mr-2" }), "Save"] })) })] })] }) }));
228
+ }, children: _jsxs("div", { className: "flex items-center gap-3", children: [logoUrl && (_jsx("img", { src: logoUrl, alt: t("branding.logo_preview_alt"), className: "h-10 w-10 object-contain" })), _jsxs("div", { children: [_jsx("div", { className: "font-semibold", style: { color: primaryColor || undefined }, children: scopeName }), tagline && (_jsx("div", { className: "text-sm", style: { color: secondaryColor || undefined }, children: tagline }))] })] }) })] }))] })), _jsxs(DialogFooter, { className: "flex gap-2 sm:gap-0", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: handleClear, disabled: saving || loading, className: "text-destructive hover:text-destructive", children: [_jsx(Trash2, { className: "h-4 w-4 mr-2" }), t("branding.clear_all_button")] }), _jsx("div", { className: "flex-1" }), _jsxs(Button, { variant: "outline", onClick: onClose, disabled: saving, children: [_jsx(CircleX, { className: "h-4 w-4 mr-2" }), t("shared.cancel_button")] }), _jsx(Button, { onClick: handleSave, disabled: saving || loading, children: saving ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }), t("branding.saving")] })) : (_jsxs(_Fragment, { children: [_jsx(CircleCheck, { className: "h-4 w-4 mr-2" }), t("shared.save_button")] })) })] })] }) }));
228
229
  }
@@ -1 +1 @@
1
- {"version":3,"file":"profile_stamp.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/profile_stamp.tsx"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC1C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAgB,EAChB,aAAkB,EAClB,SAAS,EACT,SAAgB,EAChB,UAAiB,GAClB,EAAE,iBAAiB,+BAwInB"}
1
+ {"version":3,"file":"profile_stamp.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/profile_stamp.tsx"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC1C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAgB,EAChB,aAAkB,EAClB,SAAS,EACT,SAAgB,EAChB,UAAiB,GAClB,EAAE,iBAAiB,+BA2InB"}