hazo_auth 10.23.1 → 10.23.3

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 (44) hide show
  1. package/cli-src/lib/services/email_service.ts +5 -1
  2. package/cli-src/lib/services/email_verification_service.ts +1 -1
  3. package/cli-src/lib/services/otp_service.ts +1 -1
  4. package/cli-src/lib/services/password_change_service.ts +2 -2
  5. package/cli-src/lib/services/password_reset_service.ts +2 -2
  6. package/cli-src/lib/services/registration_service.ts +1 -1
  7. package/dist/admin-issues/plugin.server.d.ts.map +1 -1
  8. package/dist/admin-issues/plugin.server.js +29 -18
  9. package/dist/components/layouts/create_firm/hooks/use_create_firm_form.d.ts.map +1 -1
  10. package/dist/components/layouts/create_firm/hooks/use_create_firm_form.js +10 -8
  11. package/dist/components/layouts/create_firm/index.d.ts +1 -1
  12. package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
  13. package/dist/components/layouts/create_firm/index.js +15 -1
  14. package/dist/components/layouts/dev_lock/index.d.ts +1 -1
  15. package/dist/components/layouts/dev_lock/index.d.ts.map +1 -1
  16. package/dist/components/layouts/dev_lock/index.js +6 -2
  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/hooks/use_my_settings.js +20 -20
  20. package/dist/components/layouts/register/hooks/use_register_form.js +2 -2
  21. package/dist/components/layouts/shared/components/profile_stamp.d.ts.map +1 -1
  22. package/dist/components/layouts/shared/components/profile_stamp.js +7 -3
  23. package/dist/components/layouts/user_management/components/roles_matrix.js +2 -2
  24. package/dist/components/layouts/user_management/index.d.ts.map +1 -1
  25. package/dist/components/layouts/user_management/index.js +17 -17
  26. package/dist/components/user_picker_select.d.ts +1 -1
  27. package/dist/components/user_picker_select.d.ts.map +1 -1
  28. package/dist/components/user_picker_select.js +6 -2
  29. package/dist/lib/services/email_service.d.ts +3 -1
  30. package/dist/lib/services/email_service.d.ts.map +1 -1
  31. package/dist/lib/services/email_service.js +6 -9
  32. package/dist/lib/services/email_verification_service.js +1 -1
  33. package/dist/lib/services/otp_service.js +1 -1
  34. package/dist/lib/services/password_change_service.js +1 -1
  35. package/dist/lib/services/password_reset_service.js +2 -2
  36. package/dist/lib/services/registration_service.js +1 -1
  37. package/dist/locales/en.json +98 -1
  38. package/dist/page_components/create_firm.d.ts.map +1 -1
  39. package/dist/page_components/create_firm.js +7 -4
  40. package/dist/page_components/my_settings.d.ts +1 -1
  41. package/dist/page_components/my_settings.d.ts.map +1 -1
  42. package/dist/page_components/my_settings.js +15 -1
  43. package/dist/server/routes/user_management_users.d.ts +1 -1
  44. package/package.json +6 -6
@@ -346,12 +346,15 @@ export async function send_email(options: EmailOptions): Promise<{ success: bool
346
346
  * @param template_type - System template name (email_verification | forgot_password | password_changed)
347
347
  * @param to - Recipient email address
348
348
  * @param data - Template data; `token` is auto-expanded into verification_url/reset_url
349
+ * @param recipient_user_id - Optional hazo_users id of the recipient. Forwarded to hazo_notify so
350
+ * the template locale resolves from the user's `preferred_locale`. Omit when unknown.
349
351
  * @returns Promise that resolves with success status
350
352
  */
351
353
  export async function send_template_email(
352
354
  template_type: EmailTemplateType,
353
355
  to: string,
354
- data: EmailTemplateData
356
+ data: EmailTemplateData,
357
+ recipient_user_id?: string
355
358
  ): Promise<{ success: boolean; error?: string }> {
356
359
  const logger = create_app_logger();
357
360
 
@@ -407,6 +410,7 @@ export async function send_template_email(
407
410
  subject,
408
411
  from,
409
412
  from_name,
413
+ ...(recipient_user_id ? { recipient_user_id } : {}),
410
414
  },
411
415
  hazo_notify_connect
412
416
  );
@@ -233,7 +233,7 @@ export async function resend_verification_email(
233
233
  token: token_result.raw_token,
234
234
  user_email: email,
235
235
  user_name: user.name as string | undefined,
236
- });
236
+ }, user_id);
237
237
 
238
238
  if (!email_result.success) {
239
239
  const logger = create_app_logger();
@@ -157,7 +157,7 @@ export async function request_email_otp(args: {
157
157
  await send_template_email("otp_signin_code", email, {
158
158
  otp_code: code,
159
159
  expires_in_minutes: String(Math.round(cfg.code_ttl_seconds / 60)),
160
- });
160
+ }, existing_user?.id ? String(existing_user.id) : undefined);
161
161
  } catch (err) {
162
162
  logger.error("otp_request_email_dispatch_failed", {
163
163
  email,
@@ -98,8 +98,8 @@ export async function change_password(
98
98
  const email_result = await send_template_email("password_changed", email, {
99
99
  user_email: email,
100
100
  user_name: user_name,
101
- });
102
-
101
+ }, user_id);
102
+
103
103
  if (!email_result.success) {
104
104
  const logger = create_app_logger();
105
105
  logger.error("password_change_service_email_failed", {
@@ -106,7 +106,7 @@ export async function request_password_reset(
106
106
  token: token_result.raw_token,
107
107
  user_email: email,
108
108
  user_name: user.name as string | undefined,
109
- });
109
+ }, user_id);
110
110
 
111
111
  if (!email_result.success) {
112
112
  const logger = create_app_logger();
@@ -386,7 +386,7 @@ export async function reset_password(
386
386
  const email_result = await send_template_email("password_changed", email, {
387
387
  user_email: email,
388
388
  user_name: user.name as string | undefined,
389
- });
389
+ }, user_id);
390
390
 
391
391
  if (!email_result.success) {
392
392
  const logger = create_app_logger();
@@ -167,7 +167,7 @@ export async function register_user(
167
167
  token: token_result.raw_token,
168
168
  user_email: email,
169
169
  user_name: name,
170
- });
170
+ }, user_id);
171
171
 
172
172
  if (!email_result.success) {
173
173
  const logger = create_app_logger();
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.server.d.ts","sourceRoot":"","sources":["../../src/admin-issues/plugin.server.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,CAAC;AASrB,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,G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AC3C,GAAG,IAAI,CAEP"}
@@ -1,20 +1,28 @@
1
1
  // file_description: hazo_auth issue type plugin for hazo_admin — auth permission access requests
2
2
  import 'server-only';
3
3
  import { createLogger } from 'hazo_core';
4
+ import { createPackageT } from 'hazo_core/i18n';
4
5
  import { GLOBAL_ADMIN_PERMISSION } from '../lib/constants.js';
5
6
  import { find_roles_with_permission } from '../lib/services/find_roles_with_permission.js';
7
+ import en from '../locales/en.json';
6
8
  const log = createLogger('hazo_auth:auth-issues-plugin');
9
+ const t = createPackageT('hazo_auth', en);
7
10
  export const authIssueTypeDef = {
8
11
  typeKey: 'auth_permission',
9
- label: 'Permission Access Request',
12
+ label: t('admin_issues.server.type_label'),
10
13
  buildDescriptor(payload) {
11
- const actionLabel = payload.action_label || 'Perform action';
14
+ const actionLabel = payload.action_label || t('admin_issues.server.default_action_label');
12
15
  const missingPerms = payload.missing_permissions || [];
13
16
  const descriptions = payload.permission_descriptions || {};
14
17
  const permLabel = missingPerms.map((p) => descriptions[p] || p).join(', ');
18
+ const permissions = permLabel || missingPerms.join(', ');
15
19
  return {
16
- title: `Access request: ${permLabel || missingPerms.join(', ')}`,
17
- summary: `A user attempted to "${actionLabel}" but lacks the required permission${missingPerms.length > 1 ? 's' : ''}: ${permLabel || missingPerms.join(', ')}.`,
20
+ title: t('admin_issues.server.descriptor_title', { permissions }),
21
+ summary: t('admin_issues.server.descriptor_summary', {
22
+ action: actionLabel,
23
+ plural: missingPerms.length > 1 ? 's' : '',
24
+ permissions,
25
+ }),
18
26
  };
19
27
  },
20
28
  async resolveRecipients(issue, ctx) {
@@ -71,7 +79,7 @@ export const authIssueTypeDef = {
71
79
  actions: [
72
80
  {
73
81
  key: 'grant',
74
- label: 'Grant Access',
82
+ label: t('admin_issues.server.action_grant_label'),
75
83
  requiredPermission: 'admin_user_scope_assignment',
76
84
  async run(issue, params, ctx) {
77
85
  const { role_id } = params;
@@ -81,12 +89,15 @@ export const authIssueTypeDef = {
81
89
  const missingPerms = issue.payload.missing_permissions || [];
82
90
  const permission = missingPerms[0];
83
91
  if (!permission)
84
- return { success: false, message: 'No missing permission specified' };
92
+ return { success: false, message: t('admin_issues.server.error_no_missing_permission') };
85
93
  const roles = await find_roles_with_permission(adapter, issue.scope_id, permission);
86
94
  if (roles.length === 0) {
87
95
  return {
88
96
  success: false,
89
- message: `No role in scope ${issue.scope_id} grants the permission "${permission}". Please create a role or use role management.`,
97
+ message: t('admin_issues.server.error_no_role_grants_permission', {
98
+ scope_id: issue.scope_id,
99
+ permission,
100
+ }),
90
101
  data: {
91
102
  noRolesFound: true,
92
103
  permission,
@@ -96,7 +107,7 @@ export const authIssueTypeDef = {
96
107
  }
97
108
  return {
98
109
  success: false,
99
- message: 'Please select a role to grant.',
110
+ message: t('admin_issues.server.error_select_role'),
100
111
  data: { availableRoles: roles },
101
112
  };
102
113
  }
@@ -109,25 +120,25 @@ export const authIssueTypeDef = {
109
120
  role_id: role_id,
110
121
  });
111
122
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
112
- return { success: false, message: (result === null || result === void 0 ? void 0 : result.error) || 'Failed to assign scope' };
123
+ return { success: false, message: (result === null || result === void 0 ? void 0 : result.error) || t('admin_issues.server.error_assign_scope_failed') };
113
124
  }
114
125
  return {
115
126
  success: true,
116
- message: 'Access granted successfully.',
127
+ message: t('admin_issues.server.success_granted'),
117
128
  data: { roleId: role_id },
118
129
  };
119
130
  },
120
131
  },
121
132
  {
122
133
  key: 'deny',
123
- label: 'Deny Request',
134
+ label: t('admin_issues.server.action_deny_label'),
124
135
  requiredPermission: 'admin_issue_triage',
125
136
  async run(_issue, params, _ctx) {
126
137
  const { reason } = params;
127
138
  if (!reason || typeof reason !== 'string' || reason.trim().length === 0) {
128
- return { success: false, message: 'A reason is required to deny the request.' };
139
+ return { success: false, message: t('admin_issues.server.error_reason_required') };
129
140
  }
130
- return { success: true, message: 'Request denied.', data: { reason } };
141
+ return { success: true, message: t('admin_issues.server.success_denied'), data: { reason } };
131
142
  },
132
143
  },
133
144
  ],
@@ -140,9 +151,9 @@ export const authIssueTypeDef = {
140
151
  const permLabel = missingPerms.map((p) => descriptions[p] || p).join(', ');
141
152
  if (actionKey === 'grant') {
142
153
  const roleId = (_a = result.data) === null || _a === void 0 ? void 0 : _a.roleId;
143
- const body = `Your request for access to "${permLabel}" has been approved.${originUrl ? ` You can now return to the page where you needed access.` : ''}`;
154
+ const body = `${t('admin_issues.server.notice_grant_body', { permissions: permLabel })}${originUrl ? t('admin_issues.server.notice_grant_return_hint') : ''}`;
144
155
  return {
145
- subject: 'Access Request Approved',
156
+ subject: t('admin_issues.server.notice_grant_subject'),
146
157
  body,
147
158
  deep_link: originUrl,
148
159
  payload: { resolution: 'granted', role_id: roleId },
@@ -150,10 +161,10 @@ export const authIssueTypeDef = {
150
161
  }
151
162
  const reason = ((_b = result.data) === null || _b === void 0 ? void 0 : _b.reason) ||
152
163
  issue.resolution_reason ||
153
- 'No reason provided.';
164
+ t('admin_issues.server.notice_no_reason');
154
165
  return {
155
- subject: 'Access Request Denied',
156
- body: `Your request for access to "${permLabel}" was denied. Reason: ${reason}`,
166
+ subject: t('admin_issues.server.notice_deny_subject'),
167
+ body: t('admin_issues.server.notice_deny_body', { permissions: permLabel, reason }),
157
168
  payload: { resolution: 'denied', reason },
158
169
  };
159
170
  },
@@ -1 +1 @@
1
- {"version":3,"file":"use_create_firm_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/create_firm/hooks/use_create_firm_form.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqD,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAA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+ {"version":3,"file":"use_create_firm_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/create_firm/hooks/use_create_firm_form.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqD,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;KAClE,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,6EAA6E;IAC7E,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,oBAAoB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9E,YAAY,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,0DAA0D;IAC1D,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC/C,8DAA8D;IAC9D,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACnD,oEAAoE;IACpE,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAGF,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,wBAA6B,GACrC,uBAAuB,CAuQzB"}
@@ -2,9 +2,11 @@
2
2
  "use client";
3
3
  // section: imports
4
4
  import { useState, useCallback, useRef, useEffect, useMemo } from "react";
5
+ import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
5
6
  // section: hook
6
7
  export function use_create_firm_form(options = {}) {
7
8
  const { default_org_structure = "Headquarters", onSuccess, redirectRoute = "/", apiBasePath = "/api/hazo_auth", logger, } = options;
9
+ const t = useAuthT();
8
10
  const [values, setValues] = useState({
9
11
  firm_name: "",
10
12
  org_structure: default_org_structure,
@@ -120,20 +122,20 @@ export function use_create_firm_form(options = {}) {
120
122
  const validateForm = useCallback(() => {
121
123
  const newErrors = {};
122
124
  if (!values.firm_name.trim()) {
123
- newErrors.firm_name = "Firm name is required";
125
+ newErrors.firm_name = t("create_firm.validation.firm_name_required");
124
126
  }
125
127
  else if (values.firm_name.length > 100) {
126
- newErrors.firm_name = "Firm name must be 100 characters or less";
128
+ newErrors.firm_name = t("create_firm.validation.firm_name_max_length");
127
129
  }
128
130
  if (!values.org_structure.trim()) {
129
- newErrors.org_structure = "Organisation structure is required";
131
+ newErrors.org_structure = t("create_firm.validation.org_structure_required");
130
132
  }
131
133
  else if (values.org_structure.length > 50) {
132
- newErrors.org_structure = "Organisation structure must be 50 characters or less";
134
+ newErrors.org_structure = t("create_firm.validation.org_structure_max_length");
133
135
  }
134
136
  setErrors(newErrors);
135
137
  return Object.keys(newErrors).length === 0;
136
- }, [values]);
138
+ }, [values, t]);
137
139
  const handleSubmit = useCallback(async (e) => {
138
140
  var _a, _b;
139
141
  e.preventDefault();
@@ -155,7 +157,7 @@ export function use_create_firm_form(options = {}) {
155
157
  });
156
158
  const data = await response.json();
157
159
  if (!response.ok) {
158
- setErrors({ form: data.error || "Failed to create firm" });
160
+ setErrors({ form: data.error || t("create_firm.error.create_failed") });
159
161
  logger === null || logger === void 0 ? void 0 : logger.error("create_firm_form_error", {
160
162
  error: data.error,
161
163
  status: response.status,
@@ -177,7 +179,7 @@ export function use_create_firm_form(options = {}) {
177
179
  }
178
180
  catch (error) {
179
181
  const error_message = error instanceof Error ? error.message : "Unknown error";
180
- setErrors({ form: "An unexpected error occurred. Please try again." });
182
+ setErrors({ form: t("create_firm.error.unexpected") });
181
183
  logger === null || logger === void 0 ? void 0 : logger.error("create_firm_form_error", {
182
184
  error: error_message,
183
185
  });
@@ -185,7 +187,7 @@ export function use_create_firm_form(options = {}) {
185
187
  finally {
186
188
  setIsSubmitting(false);
187
189
  }
188
- }, [values, validateForm, onSuccess, redirectRoute, apiBasePath, logger]);
190
+ }, [values, validateForm, onSuccess, redirectRoute, apiBasePath, logger, t]);
189
191
  // Calculate disabled state using both React state AND refs as fallback
190
192
  // This handles cases where DOM is populated but React state hasn't caught up
191
193
  // (browser autocomplete, password managers, form restoration, etc.)
@@ -58,6 +58,6 @@ export type CreateFirmLayoutProps = {
58
58
  error: (message: string, data?: Record<string, unknown>) => void;
59
59
  };
60
60
  };
61
- export default function CreateFirmLayout({ image_src, keyword, keyword_lower, verb, image_alt, image_background_color, banner_body, heading, sub_heading, firm_name_label, firm_name_placeholder, org_structure_label, org_structure_placeholder, default_org_structure, show_org_structure, submit_button_label, success_message, redirect_route, apiBasePath, onSuccess, button_colors, logger, }: CreateFirmLayoutProps): React.JSX.Element;
61
+ export default function CreateFirmLayout({ image_src, keyword: keywordProp, keyword_lower: keywordLowerProp, verb: verbProp, image_alt: imageAltProp, image_background_color, banner_body: bannerBodyProp, heading: headingProp, sub_heading: subHeadingProp, firm_name_label: firmNameLabelProp, firm_name_placeholder: firmNamePlaceholderProp, org_structure_label: orgStructureLabelProp, org_structure_placeholder: orgStructurePlaceholderProp, default_org_structure: defaultOrgStructureProp, show_org_structure, submit_button_label: submitButtonLabelProp, success_message: successMessageProp, redirect_route, apiBasePath, onSuccess, button_colors, logger, }: CreateFirmLayoutProps): React.JSX.Element;
62
62
  export { CreateFirmLayout };
63
63
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/create_firm/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,OAAO,EACL,KAAK,sBAAsB,EAC5B,MAAM,uCAAuC,CAAC;AAQ/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,sCAAsC;IACtC,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oCAAoC;IACpC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gB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/create_firm/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,OAAO,EACL,KAAK,sBAAsB,EAC5B,MAAM,uCAAuC,CAAC;AAQ/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,sCAAsC;IACtC,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oCAAoC;IACpC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0CAA0C;IAC1C,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,sCAAsC;IACtC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,8BAA8B;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,6BAA6B;IAC7B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,2BAA2B;IAC3B,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;KAClE,CAAC;CACH,CAAC;AAGF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,SAAS,EACT,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,gBAAgB,EAC/B,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,YAAY,EACvB,sBAAkC,EAClC,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,cAAc,EAC3B,eAAe,EAAE,iBAAiB,EAClC,qBAAqB,EAAE,uBAAuB,EAC9C,mBAAmB,EAAE,qBAAqB,EAC1C,yBAAyB,EAAE,2BAA2B,EACtD,qBAAqB,EAAE,uBAAuB,EAC9C,kBAAyB,EACzB,mBAAmB,EAAE,qBAAqB,EAC1C,eAAe,EAAE,kBAAkB,EACnC,cAAoB,EACpB,WAAW,EACX,SAAS,EACT,aAAa,EACb,MAAM,GACP,EAAE,qBAAqB,qBAyKvB;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -11,10 +11,24 @@ import { CheckCircle, Building2 } from "lucide-react";
11
11
  import { use_create_firm_form, } from "./hooks/use_create_firm_form.js";
12
12
  import { useHazoAuthConfig, useAuthT } from "../../../contexts/hazo_auth_provider.js";
13
13
  // section: component
14
- export default function CreateFirmLayout({ image_src, keyword = "Firm", keyword_lower = "firm", verb = "Create", image_alt = `${verb} your ${keyword_lower}`, image_background_color = "#f1f5f9", banner_body = `${verb} your ${keyword_lower} to start using the application. You'll become the administrator of your ${keyword_lower} and can invite team members later.`, heading = `${verb} Your ${keyword}`, sub_heading = "Set up your organisation to get started", firm_name_label = `${keyword} Name`, firm_name_placeholder = `Enter your ${keyword_lower} name`, org_structure_label = "Organisation Structure", org_structure_placeholder = "e.g., Headquarters, Head Office", default_org_structure = "Headquarters", show_org_structure = true, submit_button_label = `${verb} ${keyword}`, success_message = `Your ${keyword_lower} has been created successfully!`, redirect_route = "/", apiBasePath, onSuccess, button_colors, logger, }) {
14
+ export default function CreateFirmLayout({ image_src, keyword: keywordProp, keyword_lower: keywordLowerProp, verb: verbProp, image_alt: imageAltProp, image_background_color = "#f1f5f9", banner_body: bannerBodyProp, heading: headingProp, sub_heading: subHeadingProp, firm_name_label: firmNameLabelProp, firm_name_placeholder: firmNamePlaceholderProp, org_structure_label: orgStructureLabelProp, org_structure_placeholder: orgStructurePlaceholderProp, default_org_structure: defaultOrgStructureProp, show_org_structure = true, submit_button_label: submitButtonLabelProp, success_message: successMessageProp, redirect_route = "/", apiBasePath, onSuccess, button_colors, logger, }) {
15
15
  const { apiBasePath: contextApiBasePath } = useHazoAuthConfig();
16
16
  const t = useAuthT();
17
17
  const resolvedApiBasePath = apiBasePath || contextApiBasePath;
18
+ const keyword = keywordProp !== null && keywordProp !== void 0 ? keywordProp : t("create_firm.keyword");
19
+ const keyword_lower = keywordLowerProp !== null && keywordLowerProp !== void 0 ? keywordLowerProp : t("create_firm.keyword_lower");
20
+ const verb = verbProp !== null && verbProp !== void 0 ? verbProp : t("create_firm.verb");
21
+ const image_alt = imageAltProp !== null && imageAltProp !== void 0 ? imageAltProp : `${verb} your ${keyword_lower}`;
22
+ const banner_body = bannerBodyProp !== null && bannerBodyProp !== void 0 ? bannerBodyProp : t("create_firm.banner_body", { verb, keyword_lower });
23
+ const heading = headingProp !== null && headingProp !== void 0 ? headingProp : `${verb} Your ${keyword}`;
24
+ const sub_heading = subHeadingProp !== null && subHeadingProp !== void 0 ? subHeadingProp : t("create_firm.subtitle");
25
+ const firm_name_label = firmNameLabelProp !== null && firmNameLabelProp !== void 0 ? firmNameLabelProp : `${keyword} Name`;
26
+ const firm_name_placeholder = firmNamePlaceholderProp !== null && firmNamePlaceholderProp !== void 0 ? firmNamePlaceholderProp : `Enter your ${keyword_lower} name`;
27
+ const org_structure_label = orgStructureLabelProp !== null && orgStructureLabelProp !== void 0 ? orgStructureLabelProp : t("create_firm.org_structure_label");
28
+ const org_structure_placeholder = orgStructurePlaceholderProp !== null && orgStructurePlaceholderProp !== void 0 ? orgStructurePlaceholderProp : t("create_firm.org_structure_placeholder");
29
+ const default_org_structure = defaultOrgStructureProp !== null && defaultOrgStructureProp !== void 0 ? defaultOrgStructureProp : t("create_firm.default_org_structure");
30
+ const submit_button_label = submitButtonLabelProp !== null && submitButtonLabelProp !== void 0 ? submitButtonLabelProp : `${verb} ${keyword}`;
31
+ const success_message = successMessageProp !== null && successMessageProp !== void 0 ? successMessageProp : `Your ${keyword_lower} has been created successfully!`;
18
32
  const form = use_create_firm_form({
19
33
  default_org_structure,
20
34
  onSuccess,
@@ -24,6 +24,6 @@ export type DevLockLayoutProps = {
24
24
  /** Callback when unlock is successful */
25
25
  onUnlock?: () => void;
26
26
  };
27
- export default function DevLockLayout({ background_color, logo_path, logo_width, logo_height, application_name, limited_access_text, password_placeholder, submit_button_text, error_message, text_color, accent_color, onUnlock, }: DevLockLayoutProps): import("react").JSX.Element;
27
+ export default function DevLockLayout({ background_color, logo_path, logo_width, logo_height, application_name, limited_access_text: limitedAccessTextProp, password_placeholder: passwordPlaceholderProp, submit_button_text: submitButtonTextProp, error_message: errorMessageProp, text_color, accent_color, onUnlock, }: DevLockLayoutProps): import("react").JSX.Element;
28
28
  export { DevLockLayout };
29
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/dev_lock/index.tsx"],"names":[],"mappings":"AAcA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAGF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,gBAA4B,EAC5B,SAAc,EACd,UAAgB,EAChB,WAAiB,EACjB,gBAAqB,EACrB,mBAAsC,EACtC,oBAA8C,EAC9C,kBAA6B,EAC7B,aAAoC,EACpC,UAAsB,EACtB,YAAwB,EACxB,QAAQ,GACT,EAAE,kBAAkB,+BAuJpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/dev_lock/index.tsx"],"names":[],"mappings":"AAcA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAGF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,gBAA4B,EAC5B,SAAc,EACd,UAAgB,EAChB,WAAiB,EACjB,gBAAqB,EACrB,mBAAmB,EAAE,qBAAqB,EAC1C,oBAAoB,EAAE,uBAAuB,EAC7C,kBAAkB,EAAE,oBAAoB,EACxC,aAAa,EAAE,gBAAgB,EAC/B,UAAsB,EACtB,YAAwB,EACxB,QAAQ,GACT,EAAE,kBAAkB,+BA2JpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -11,13 +11,17 @@ import { Button } from "../../ui/button.js";
11
11
  import { Lock, AlertCircle, Loader2 } from "lucide-react";
12
12
  import { useAuthT } from "../../../contexts/hazo_auth_provider.js";
13
13
  // section: component
14
- export default function DevLockLayout({ background_color = "#000000", logo_path = "", logo_width = 120, logo_height = 120, application_name = "", limited_access_text = "Limited Access", password_placeholder = "Enter access password", submit_button_text = "Unlock", error_message = "Incorrect password", text_color = "#ffffff", accent_color = "#3b82f6", onUnlock, }) {
14
+ export default function DevLockLayout({ background_color = "#000000", logo_path = "", logo_width = 120, logo_height = 120, application_name = "", limited_access_text: limitedAccessTextProp, password_placeholder: passwordPlaceholderProp, submit_button_text: submitButtonTextProp, error_message: errorMessageProp, text_color = "#ffffff", accent_color = "#3b82f6", onUnlock, }) {
15
15
  // Only show logo if logo_path is configured (non-empty)
16
16
  const showLogo = logo_path !== "";
17
17
  const [password, setPassword] = useState("");
18
18
  const [error, setError] = useState(null);
19
19
  const [isLoading, setIsLoading] = useState(false);
20
20
  const t = useAuthT();
21
+ const limited_access_text = limitedAccessTextProp !== null && limitedAccessTextProp !== void 0 ? limitedAccessTextProp : t("dev_lock.limited_access");
22
+ const password_placeholder = passwordPlaceholderProp !== null && passwordPlaceholderProp !== void 0 ? passwordPlaceholderProp : t("dev_lock.password_placeholder");
23
+ const submit_button_text = submitButtonTextProp !== null && submitButtonTextProp !== void 0 ? submitButtonTextProp : t("dev_lock.unlock_button");
24
+ const error_message = errorMessageProp !== null && errorMessageProp !== void 0 ? errorMessageProp : t("dev_lock.incorrect_password");
21
25
  const handleSubmit = useCallback(async (e) => {
22
26
  e.preventDefault();
23
27
  setError(null);
@@ -61,7 +65,7 @@ export default function DevLockLayout({ background_color = "#000000", logo_path
61
65
  setError(null);
62
66
  }
63
67
  }, [error]);
64
- return (_jsx("div", { className: "cls_dev_lock_layout min-h-screen flex flex-col items-center justify-center p-4", style: { backgroundColor: background_color }, children: _jsxs("div", { className: "cls_dev_lock_container flex flex-col items-center gap-6 max-w-sm w-full", children: [showLogo && (_jsx("div", { className: "cls_dev_lock_logo", children: _jsx(Image, { src: logo_path, alt: "Application logo", width: logo_width, height: logo_height, className: "object-contain", priority: true }) })), application_name && (_jsx("h1", { className: "cls_dev_lock_app_name text-2xl font-bold text-center", style: { color: text_color }, children: application_name })), _jsxs("div", { className: "cls_dev_lock_header flex items-center gap-2", children: [_jsx(Lock, { className: "w-5 h-5", style: { color: text_color } }), _jsx("span", { className: "cls_dev_lock_text text-sm font-medium uppercase tracking-wider", style: { color: text_color, opacity: 0.8 }, children: limited_access_text })] }), _jsxs("form", { onSubmit: handleSubmit, className: "cls_dev_lock_form flex flex-col gap-4 w-full", children: [_jsx("div", { className: "cls_dev_lock_input_wrapper relative", children: _jsx(Input, { type: "password", value: password, onChange: handlePasswordChange, placeholder: password_placeholder, className: "cls_dev_lock_input h-12 bg-white/10 border-white/20 text-white placeholder:text-white/50 focus:border-white/40 focus:ring-white/20", disabled: isLoading, autoFocus: true, autoComplete: "current-password" }) }), error && (_jsxs("div", { className: "cls_dev_lock_error flex items-center gap-2 text-sm", style: { color: "#ef4444" }, children: [_jsx(AlertCircle, { className: "w-4 h-4 flex-shrink-0" }), _jsx("span", { children: error })] })), _jsx(Button, { type: "submit", className: "cls_dev_lock_button h-12 font-medium transition-colors", style: {
68
+ return (_jsx("div", { className: "cls_dev_lock_layout min-h-screen flex flex-col items-center justify-center p-4", style: { backgroundColor: background_color }, children: _jsxs("div", { className: "cls_dev_lock_container flex flex-col items-center gap-6 max-w-sm w-full", children: [showLogo && (_jsx("div", { className: "cls_dev_lock_logo", children: _jsx(Image, { src: logo_path, alt: t("dev_lock.logo_alt"), width: logo_width, height: logo_height, className: "object-contain", priority: true }) })), application_name && (_jsx("h1", { className: "cls_dev_lock_app_name text-2xl font-bold text-center", style: { color: text_color }, children: application_name })), _jsxs("div", { className: "cls_dev_lock_header flex items-center gap-2", children: [_jsx(Lock, { className: "w-5 h-5", style: { color: text_color } }), _jsx("span", { className: "cls_dev_lock_text text-sm font-medium uppercase tracking-wider", style: { color: text_color, opacity: 0.8 }, children: limited_access_text })] }), _jsxs("form", { onSubmit: handleSubmit, className: "cls_dev_lock_form flex flex-col gap-4 w-full", children: [_jsx("div", { className: "cls_dev_lock_input_wrapper relative", children: _jsx(Input, { type: "password", value: password, onChange: handlePasswordChange, placeholder: password_placeholder, className: "cls_dev_lock_input h-12 bg-white/10 border-white/20 text-white placeholder:text-white/50 focus:border-white/40 focus:ring-white/20", disabled: isLoading, autoFocus: true, autoComplete: "current-password" }) }), error && (_jsxs("div", { className: "cls_dev_lock_error flex items-center gap-2 text-sm", style: { color: "#ef4444" }, children: [_jsx(AlertCircle, { className: "w-4 h-4 flex-shrink-0" }), _jsx("span", { children: error })] })), _jsx(Button, { type: "submit", className: "cls_dev_lock_button h-12 font-medium transition-colors", style: {
65
69
  backgroundColor: accent_color,
66
70
  color: "#ffffff",
67
71
  }, disabled: isLoading || !password, children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "w-4 h-4 animate-spin mr-2" }), t("dev_lock.verifying")] })) : (submit_button_text) })] })] }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"profile_picture_display.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/profile_picture_display.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,0BAA0B,GAAG;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAGF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,iBAAiB,EACjB,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAgB,GACjB,EAAE,0BAA0B,+BAgC5B"}
1
+ {"version":3,"file":"profile_picture_display.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/profile_picture_display.tsx"],"names":[],"mappings":"AAWA,MAAM,MAAM,0BAA0B,GAAG;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAGF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,iBAAiB,EACjB,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAgB,GACjB,EAAE,0BAA0B,+BAiC5B"}
@@ -4,6 +4,7 @@
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  // section: imports
6
6
  import { Avatar, AvatarImage, AvatarFallback } from "../../../ui/avatar.js";
7
+ import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
7
8
  // section: component
8
9
  /**
9
10
  * Profile picture display component
@@ -13,6 +14,7 @@ import { Avatar, AvatarImage, AvatarFallback } from "../../../ui/avatar.js";
13
14
  * @returns Profile picture display component
14
15
  */
15
16
  export function ProfilePictureDisplay({ profilePictureUrl, name, email, onEdit, disabled = false, }) {
17
+ const t = useAuthT();
16
18
  // Get initials from name or email
17
19
  const getInitials = () => {
18
20
  var _a, _b;
@@ -29,5 +31,5 @@ export function ProfilePictureDisplay({ profilePictureUrl, name, email, onEdit,
29
31
  return "?";
30
32
  };
31
33
  const initials = getInitials();
32
- return (_jsx("div", { className: "cls_profile_picture_display", children: _jsxs(Avatar, { className: "cls_profile_picture_display_avatar h-32 w-32", children: [_jsx(AvatarImage, { src: profilePictureUrl, alt: name ? `Profile picture of ${name}` : "Profile picture", className: "cls_profile_picture_display_image" }), _jsx(AvatarFallback, { className: "cls_profile_picture_display_fallback bg-[var(--hazo-bg-emphasis)] text-[var(--hazo-text-muted)] text-3xl", children: initials })] }) }));
34
+ return (_jsx("div", { className: "cls_profile_picture_display", children: _jsxs(Avatar, { className: "cls_profile_picture_display_avatar h-32 w-32", children: [_jsx(AvatarImage, { src: profilePictureUrl, alt: name ? t("shared.avatar.alt_named", { name }) : t("shared.avatar.alt_default"), className: "cls_profile_picture_display_image" }), _jsx(AvatarFallback, { className: "cls_profile_picture_display_fallback bg-[var(--hazo-bg-emphasis)] text-[var(--hazo-text-muted)] text-3xl", children: initials })] }) }));
33
35
  }
@@ -90,15 +90,15 @@ export function use_my_settings({ passwordRequirements, t, }) {
90
90
  });
91
91
  const data = await response.json();
92
92
  if (!response.ok || !data.success) {
93
- const errorMessage = data.error || "Failed to update name";
93
+ const errorMessage = data.error || t("my_settings.toast.name_error");
94
94
  toast.error(errorMessage);
95
95
  throw new Error(errorMessage);
96
96
  }
97
- toast.success("Name updated successfully");
97
+ toast.success(t("my_settings.toast.name_success"));
98
98
  await refreshUserData();
99
99
  }
100
100
  catch (error) {
101
- 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");
102
102
  toast.error(errorMessage);
103
103
  throw error;
104
104
  }
@@ -123,7 +123,7 @@ export function use_my_settings({ passwordRequirements, t, }) {
123
123
  });
124
124
  const data = await response.json();
125
125
  if (!response.ok || !data.success) {
126
- const errorMessage = data.error || "Failed to update email";
126
+ const errorMessage = data.error || t("my_settings.toast.email_error");
127
127
  toast.error(errorMessage);
128
128
  throw new Error(errorMessage);
129
129
  }
@@ -136,7 +136,7 @@ export function use_my_settings({ passwordRequirements, t, }) {
136
136
  await refreshUserData();
137
137
  }
138
138
  catch (error) {
139
- 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");
140
140
  toast.error(errorMessage);
141
141
  throw error;
142
142
  }
@@ -156,19 +156,19 @@ export function use_my_settings({ passwordRequirements, t, }) {
156
156
  });
157
157
  const data = await response.json();
158
158
  if (!response.ok || !data.success) {
159
- const errorMessage = data.error || "Failed to update language preference";
159
+ const errorMessage = data.error || t("my_settings.toast.language_error");
160
160
  toast.error(errorMessage);
161
161
  throw new Error(errorMessage);
162
162
  }
163
- toast.success("Language preference updated");
163
+ toast.success(t("my_settings.toast.language_success"));
164
164
  await refreshUserData();
165
165
  }
166
166
  catch (error) {
167
- 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");
168
168
  toast.error(errorMessage);
169
169
  throw error;
170
170
  }
171
- }, [apiBasePath, refreshUserData]);
171
+ }, [apiBasePath, refreshUserData, t]);
172
172
  /**
173
173
  * Handles password field change
174
174
  */
@@ -245,12 +245,12 @@ export function use_my_settings({ passwordRequirements, t, }) {
245
245
  });
246
246
  const data = await response.json();
247
247
  if (!response.ok || !data.success) {
248
- const errorMessage = data.error || "Failed to change password";
248
+ const errorMessage = data.error || t("my_settings.toast.password_error");
249
249
  setPasswordFields((prev) => (Object.assign(Object.assign({}, prev), { errors: { currentPassword: errorMessage } })));
250
250
  toast.error(errorMessage);
251
251
  throw new Error(errorMessage);
252
252
  }
253
- toast.success("Password changed successfully");
253
+ toast.success(t("my_settings.toast.password_success"));
254
254
  // Reset password fields
255
255
  setPasswordFields({
256
256
  currentPassword: "",
@@ -263,7 +263,7 @@ export function use_my_settings({ passwordRequirements, t, }) {
263
263
  });
264
264
  }
265
265
  catch (error) {
266
- 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");
267
267
  toast.error(errorMessage);
268
268
  throw error;
269
269
  }
@@ -303,20 +303,20 @@ export function use_my_settings({ passwordRequirements, t, }) {
303
303
  });
304
304
  const data = await response.json();
305
305
  if (!response.ok || !data.success) {
306
- const errorMessage = data.error || "Failed to update profile picture";
306
+ const errorMessage = data.error || t("my_settings.toast.profile_picture_error");
307
307
  toast.error(errorMessage);
308
308
  throw new Error(errorMessage);
309
309
  }
310
- toast.success("Profile picture updated successfully");
310
+ toast.success(t("my_settings.toast.profile_picture_success"));
311
311
  await refreshUserData();
312
312
  setProfilePictureDialogOpen(false);
313
313
  }
314
314
  catch (error) {
315
- 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");
316
316
  toast.error(errorMessage);
317
317
  throw error;
318
318
  }
319
- }, [refreshUserData]);
319
+ }, [refreshUserData, t]);
320
320
  /**
321
321
  * Removes profile picture
322
322
  * - If upload: deletes the file and clears profile_picture_url and profile_source
@@ -333,19 +333,19 @@ export function use_my_settings({ passwordRequirements, t, }) {
333
333
  });
334
334
  const data = await response.json();
335
335
  if (!response.ok || !data.success) {
336
- const errorMessage = data.error || "Failed to remove profile picture";
336
+ const errorMessage = data.error || t("my_settings.toast.profile_picture_remove_error");
337
337
  toast.error(errorMessage);
338
338
  throw new Error(errorMessage);
339
339
  }
340
- toast.success("Profile picture removed successfully");
340
+ toast.success(t("my_settings.toast.profile_picture_removed"));
341
341
  await refreshUserData();
342
342
  }
343
343
  catch (error) {
344
- 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");
345
345
  toast.error(errorMessage);
346
346
  throw error;
347
347
  }
348
- }, [refreshUserData]);
348
+ }, [refreshUserData, t]);
349
349
  return {
350
350
  name,
351
351
  email,
@@ -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":"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"}