hazo_auth 10.22.1 → 10.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/cli-src/lib/services/password_change_service.ts +4 -30
  2. package/cli-src/lib/utils/password_validator.ts +20 -12
  3. package/dist/admin-issues/plugin.client.d.ts.map +1 -1
  4. package/dist/admin-issues/plugin.client.js +7 -5
  5. package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
  6. package/dist/components/layouts/my_settings/components/password_change_dialog.js +5 -20
  7. package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
  8. package/dist/components/layouts/my_settings/components/set_password_section.js +7 -27
  9. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +3 -1
  10. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
  11. package/dist/components/layouts/my_settings/hooks/use_my_settings.js +25 -44
  12. package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
  13. package/dist/components/layouts/my_settings/index.js +2 -1
  14. package/dist/components/layouts/scope_management/components/branding_editor.d.ts.map +1 -1
  15. package/dist/components/layouts/scope_management/components/branding_editor.js +16 -15
  16. package/dist/components/layouts/shared/components/sidebar_locale_switcher.d.ts +2 -0
  17. package/dist/components/layouts/shared/components/sidebar_locale_switcher.d.ts.map +1 -0
  18. package/dist/components/layouts/shared/components/sidebar_locale_switcher.js +30 -0
  19. package/dist/components/layouts/shared/components/sidebar_translate_nav.d.ts +2 -0
  20. package/dist/components/layouts/shared/components/sidebar_translate_nav.d.ts.map +1 -0
  21. package/dist/components/layouts/shared/components/sidebar_translate_nav.js +16 -0
  22. package/dist/components/layouts/user_management/components/app_user_data_editor.d.ts.map +1 -1
  23. package/dist/components/layouts/user_management/components/app_user_data_editor.js +13 -12
  24. package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts.map +1 -1
  25. package/dist/components/layouts/user_management/components/user_signup_stats_cards.js +11 -7
  26. package/dist/components/otp/OTPRequestForm.js +1 -1
  27. package/dist/consent/cookie_consent_banner.d.ts.map +1 -1
  28. package/dist/consent/cookie_consent_banner.js +3 -1
  29. package/dist/consent/manage_modal.d.ts.map +1 -1
  30. package/dist/consent/manage_modal.js +3 -1
  31. package/dist/lib/services/password_change_service.d.ts.map +1 -1
  32. package/dist/lib/services/password_change_service.js +4 -26
  33. package/dist/lib/utils/password_validator.d.ts.map +1 -1
  34. package/dist/lib/utils/password_validator.js +17 -6
  35. package/dist/locales/en.json +96 -12
  36. package/package.json +6 -8
@@ -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
  }
@@ -0,0 +1,2 @@
1
+ export declare function SidebarLocaleSwitcher(): import("react").JSX.Element | null;
2
+ //# sourceMappingURL=sidebar_locale_switcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar_locale_switcher.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/sidebar_locale_switcher.tsx"],"names":[],"mappings":"AAUA,wBAAgB,qBAAqB,uCA6BpC"}
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect, useState } from "react";
4
+ export function SidebarLocaleSwitcher() {
5
+ const [Switcher, setSwitcher] = useState(null);
6
+ const [locales, setLocales] = useState([]);
7
+ useEffect(() => {
8
+ import("hazo_i18n/ui")
9
+ .then((m) => {
10
+ setSwitcher(() => m.LocaleSwitcher);
11
+ fetch("/api/hazo_auth/i18n?action=locales")
12
+ .then((r) => r.json())
13
+ .then((body) => {
14
+ var _a, _b;
15
+ const defs = (_b = (_a = body === null || body === void 0 ? void 0 : body.data) === null || _a === void 0 ? void 0 : _a.locales) !== null && _b !== void 0 ? _b : [];
16
+ setLocales(defs
17
+ .filter((d) => d.enabled !== false)
18
+ .map((d) => ({
19
+ code: d.code,
20
+ label: d.native_name || d.english_name || d.code,
21
+ })));
22
+ })
23
+ .catch(() => { });
24
+ })
25
+ .catch(() => { });
26
+ }, []);
27
+ if (!Switcher || locales.length === 0)
28
+ return null;
29
+ return _jsx(Switcher, { locales: locales, display: "code", variant: "sidebar" });
30
+ }
@@ -0,0 +1,2 @@
1
+ export declare function SidebarTranslateNav(): import("react").JSX.Element | null;
2
+ //# sourceMappingURL=sidebar_translate_nav.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar_translate_nav.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/sidebar_translate_nav.tsx"],"names":[],"mappings":"AAMA,wBAAgB,mBAAmB,uCAkBlC"}
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect, useState } from "react";
4
+ import { usePathname } from "next/navigation";
5
+ export function SidebarTranslateNav() {
6
+ const [NavItem, setNavItem] = useState(null);
7
+ const pathname = usePathname();
8
+ useEffect(() => {
9
+ import("hazo_i18n/ui")
10
+ .then((m) => setNavItem(() => m.TranslateNavItem))
11
+ .catch(() => { });
12
+ }, []);
13
+ if (!NavItem)
14
+ return null;
15
+ return (_jsx(NavItem, { href: "/hazo_auth/translations", active: pathname === "/hazo_auth/translations" }));
16
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"app_user_data_editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/app_user_data_editor.tsx"],"names":[],"mappings":"AA6CA,MAAM,MAAM,sBAAsB,GAAG;IACnC,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5C,kCAAkC;IAClC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAgDF,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,WAAW,EACX,MAAM,EACN,OAAO,EACP,QAAgB,GACjB,EAAE,sBAAsB,+BAkXxB"}
1
+ {"version":3,"file":"app_user_data_editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/app_user_data_editor.tsx"],"names":[],"mappings":"AA6CA,MAAM,MAAM,sBAAsB,GAAG;IACnC,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5C,kCAAkC;IAClC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAgDF,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,WAAW,EACX,MAAM,EACN,OAAO,EACP,QAAgB,GACjB,EAAE,sBAAsB,+BAmXxB"}
@@ -12,7 +12,7 @@ import { Switch } from "../../../ui/switch.js";
12
12
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../../../ui/alert-dialog.js";
13
13
  import { ChevronDown, ChevronRight, Edit, Loader2, Save, Trash2, X } from "lucide-react";
14
14
  import { toast } from "sonner";
15
- import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
15
+ import { useHazoAuthConfig, useAuthT } from "../../../../contexts/hazo_auth_provider.js";
16
16
  // section: helpers
17
17
  /**
18
18
  * Get nested value from object using dot-notation path
@@ -52,6 +52,7 @@ function setNestedValue(obj, path, value) {
52
52
  // section: component
53
53
  export function AppUserDataEditor({ userId, currentData, onSave, onClear, readOnly = false, }) {
54
54
  const { apiBasePath } = useHazoAuthConfig();
55
+ const t = useAuthT();
55
56
  const [schemaResponse, setSchemaResponse] = useState(null);
56
57
  const [schemaLoading, setSchemaLoading] = useState(true);
57
58
  const [isEditing, setIsEditing] = useState(false);
@@ -108,22 +109,22 @@ export function AppUserDataEditor({ userId, currentData, onSave, onClear, readOn
108
109
  });
109
110
  const data = await response.json();
110
111
  if (data.success) {
111
- toast.success("App user data saved");
112
+ toast.success(t("app_user_data.toast.save_success"));
112
113
  setIsEditing(false);
113
114
  onSave === null || onSave === void 0 ? void 0 : onSave(editData);
114
115
  }
115
116
  else {
116
- toast.error(data.error || "Failed to save");
117
+ toast.error(data.error || t("app_user_data.toast.save_failed"));
117
118
  }
118
119
  }
119
120
  catch (error) {
120
- toast.error("Failed to save app user data");
121
+ toast.error(t("app_user_data.toast.save_failed"));
121
122
  console.error("Save error:", error);
122
123
  }
123
124
  finally {
124
125
  setSaving(false);
125
126
  }
126
- }, [apiBasePath, userId, editData, onSave]);
127
+ }, [apiBasePath, userId, editData, onSave, t]);
127
128
  // Clear app_user_data - uses user_management/users PATCH endpoint with null
128
129
  const handleClear = useCallback(async () => {
129
130
  setClearing(true);
@@ -138,22 +139,22 @@ export function AppUserDataEditor({ userId, currentData, onSave, onClear, readOn
138
139
  });
139
140
  const data = await response.json();
140
141
  if (data.success) {
141
- toast.success("App user data cleared");
142
+ toast.success(t("app_user_data.toast.clear_success"));
142
143
  setShowClearConfirmation(false);
143
144
  onClear === null || onClear === void 0 ? void 0 : onClear();
144
145
  }
145
146
  else {
146
- toast.error(data.error || "Failed to clear");
147
+ toast.error(data.error || t("app_user_data.toast.clear_failed"));
147
148
  }
148
149
  }
149
150
  catch (error) {
150
- toast.error("Failed to clear app user data");
151
+ toast.error(t("app_user_data.toast.clear_failed"));
151
152
  console.error("Clear error:", error);
152
153
  }
153
154
  finally {
154
155
  setClearing(false);
155
156
  }
156
- }, [apiBasePath, userId, onClear]);
157
+ }, [apiBasePath, userId, onClear, t]);
157
158
  // Update field value
158
159
  const updateField = useCallback((path, value) => {
159
160
  setEditData((prev) => setNestedValue(prev, path, value));
@@ -202,7 +203,7 @@ export function AppUserDataEditor({ userId, currentData, onSave, onClear, readOn
202
203
  displayValue = "-";
203
204
  }
204
205
  else if (typeof currentValue === "boolean") {
205
- displayValue = currentValue ? "Yes" : "No";
206
+ displayValue = currentValue ? t("app_user_data.boolean_yes") : t("app_user_data.boolean_no");
206
207
  }
207
208
  else {
208
209
  displayValue = String(currentValue);
@@ -230,8 +231,8 @@ export function AppUserDataEditor({ userId, currentData, onSave, onClear, readOn
230
231
  }
231
232
  // Schema not enabled - show raw data
232
233
  if (!(schemaResponse === null || schemaResponse === void 0 ? void 0 : schemaResponse.enabled) || !(schemaResponse === null || schemaResponse === void 0 ? void 0 : schemaResponse.schema)) {
233
- return (_jsx("div", { className: "text-sm", children: currentData && Object.keys(currentData).length > 0 ? (_jsx("pre", { className: "border rounded-lg p-2 bg-slate-50 overflow-x-auto text-xs", children: JSON.stringify(currentData, null, 2) })) : (_jsx("span", { className: "text-muted-foreground", children: "No app user data" })) }));
234
+ return (_jsx("div", { className: "text-sm", children: currentData && Object.keys(currentData).length > 0 ? (_jsx("pre", { className: "border rounded-lg p-2 bg-slate-50 overflow-x-auto text-xs", children: JSON.stringify(currentData, null, 2) })) : (_jsx("span", { className: "text-muted-foreground", children: t("app_user_data.empty_state") })) }));
234
235
  }
235
236
  // Render schema-based editor
236
- return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h3", { className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: "App User Data" }), !readOnly && !isEditing && (_jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: handleEdit, className: "h-8", children: [_jsx(Edit, { className: "h-3.5 w-3.5 mr-1.5" }), "Edit"] }), currentData && Object.keys(currentData).length > 0 && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setShowClearConfirmation(true), className: "h-8 text-destructive hover:text-destructive hover:bg-destructive/10", children: [_jsx(Trash2, { className: "h-3.5 w-3.5 mr-1.5" }), "Clear"] }))] }))] }), _jsx("div", { className: "flex flex-col gap-3", children: Object.entries(schemaResponse.schema.properties).map(([sectionKey, sectionSchema]) => renderSection(sectionKey, sectionSchema)) }), isEditing && (_jsxs("div", { className: "flex justify-end gap-2 pt-3 border-t", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: handleCancel, disabled: saving, className: "h-9", children: [_jsx(X, { className: "h-4 w-4 mr-1.5" }), "Cancel"] }), _jsxs(Button, { size: "sm", onClick: handleSave, disabled: saving, className: "h-9", children: [saving ? (_jsx(Loader2, { className: "h-4 w-4 mr-1.5 animate-spin" })) : (_jsx(Save, { className: "h-4 w-4 mr-1.5" })), "Save"] })] })), _jsx(AlertDialog, { open: showClearConfirmation, onOpenChange: setShowClearConfirmation, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Clear App User Data?" }), _jsx(AlertDialogDescription, { children: "This will permanently delete all app user data for this user. This action cannot be undone." })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: clearing, children: "Cancel" }), _jsx(AlertDialogAction, { onClick: handleClear, disabled: clearing, className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: clearing ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "h-4 w-4 mr-1.5 animate-spin" }), "Clearing..."] })) : ("Clear Data") })] })] }) })] }));
237
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h3", { className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: t("app_user_data.heading") }), !readOnly && !isEditing && (_jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: handleEdit, className: "h-8", children: [_jsx(Edit, { className: "h-3.5 w-3.5 mr-1.5" }), t("app_user_data.edit_button")] }), currentData && Object.keys(currentData).length > 0 && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setShowClearConfirmation(true), className: "h-8 text-destructive hover:text-destructive hover:bg-destructive/10", children: [_jsx(Trash2, { className: "h-3.5 w-3.5 mr-1.5" }), t("app_user_data.clear_button")] }))] }))] }), _jsx("div", { className: "flex flex-col gap-3", children: Object.entries(schemaResponse.schema.properties).map(([sectionKey, sectionSchema]) => renderSection(sectionKey, sectionSchema)) }), isEditing && (_jsxs("div", { className: "flex justify-end gap-2 pt-3 border-t", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: handleCancel, disabled: saving, className: "h-9", children: [_jsx(X, { className: "h-4 w-4 mr-1.5" }), t("shared.cancel_button")] }), _jsxs(Button, { size: "sm", onClick: handleSave, disabled: saving, className: "h-9", children: [saving ? (_jsx(Loader2, { className: "h-4 w-4 mr-1.5 animate-spin" })) : (_jsx(Save, { className: "h-4 w-4 mr-1.5" })), t("shared.save_button")] })] })), _jsx(AlertDialog, { open: showClearConfirmation, onOpenChange: setShowClearConfirmation, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: t("app_user_data.clear_dialog.title") }), _jsx(AlertDialogDescription, { children: t("app_user_data.clear_dialog.description") })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: clearing, children: t("shared.cancel_button") }), _jsx(AlertDialogAction, { onClick: handleClear, disabled: clearing, className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: clearing ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "h-4 w-4 mr-1.5 animate-spin" }), t("app_user_data.clear_dialog.confirming")] })) : (t("app_user_data.clear_dialog.confirm")) })] })] }) })] }));
237
238
  }
@@ -1 +1 @@
1
- {"version":3,"file":"user_signup_stats_cards.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/user_signup_stats_cards.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAOjD,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,aAAa,CAAC;QAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACrD,8DAA8D;IAC9D,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA2ND;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,yBAAyB,qBAaxF"}
1
+ {"version":3,"file":"user_signup_stats_cards.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/user_signup_stats_cards.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAQjD,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,aAAa,CAAC;QAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACrD,8DAA8D;IAC9D,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkOD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,yBAAyB,qBAaxF"}
@@ -6,18 +6,21 @@
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  import { useMemo, useState } from "react";
8
8
  import { computeUserSignupStats, } from "../../../../lib/user_signup_stats.js";
9
+ import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
9
10
  function DeltaBadge({ pct }) {
11
+ const t = useAuthT();
10
12
  if (pct === null) {
11
13
  return _jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" });
12
14
  }
13
15
  const up = pct >= 0;
14
16
  const cls = up ? "text-emerald-600" : "text-red-600";
15
17
  const arrow = up ? "▲" : "▼";
16
- return (_jsxs("span", { className: `text-xs font-medium ${cls}`, title: "vs. previous equal period", children: [arrow, " ", up ? "+" : "", pct, "%"] }));
18
+ return (_jsxs("span", { className: `text-xs font-medium ${cls}`, title: t("user_management.signup_stats.vs_previous"), children: [arrow, " ", up ? "+" : "", pct, "%"] }));
17
19
  }
18
20
  const STAT_CARD_HEIGHT_PX = 168;
19
21
  function StatCard({ w }) {
20
- return (_jsxs("div", { className: "cls_user_signup_stat_card flex min-w-0 flex-col justify-between rounded-lg border bg-card p-4", style: { height: STAT_CARD_HEIGHT_PX }, children: [_jsx("div", { className: "truncate text-xs text-muted-foreground", children: w.label }), _jsxs("div", { className: "flex items-baseline justify-between gap-1", children: [_jsx("span", { className: "text-3xl font-bold tabular-nums", children: w.count.toLocaleString() }), w.key !== "all" && _jsx(DeltaBadge, { pct: w.pctChange })] }), w.key !== "all" && w.prevCount !== null && (_jsxs("div", { className: "truncate text-xs text-muted-foreground", children: ["prev ", w.prevCount.toLocaleString()] })), w.key === "all" && (_jsx("div", { className: "truncate text-xs text-muted-foreground", children: "total users" }))] }));
22
+ const t = useAuthT();
23
+ return (_jsxs("div", { className: "cls_user_signup_stat_card flex min-w-0 flex-col justify-between rounded-lg border bg-card p-4", style: { height: STAT_CARD_HEIGHT_PX }, children: [_jsx("div", { className: "truncate text-xs text-muted-foreground", children: w.label }), _jsxs("div", { className: "flex items-baseline justify-between gap-1", children: [_jsx("span", { className: "text-3xl font-bold tabular-nums", children: w.count.toLocaleString() }), w.key !== "all" && _jsx(DeltaBadge, { pct: w.pctChange })] }), w.key !== "all" && w.prevCount !== null && (_jsx("div", { className: "truncate text-xs text-muted-foreground", children: t("user_management.signup_stats.prev_count", { count: w.prevCount.toLocaleString() }) })), w.key === "all" && (_jsx("div", { className: "truncate text-xs text-muted-foreground", children: t("user_management.signup_stats.total_users") }))] }));
21
24
  }
22
25
  /** Round a value up to a "nice" axis maximum (1/2/5 * 10^n steps). */
23
26
  function niceMax(n) {
@@ -38,6 +41,7 @@ function niceMax(n) {
38
41
  return niceFrac * base;
39
42
  }
40
43
  function YtdMiniChart({ data }) {
44
+ const t = useAuthT();
41
45
  const [hoverIndex, setHoverIndex] = useState(null);
42
46
  const total = data.reduce((n, d) => n + d.count, 0);
43
47
  const rawMax = Math.max(1, ...data.map((d) => d.count));
@@ -60,9 +64,9 @@ function YtdMiniChart({ data }) {
60
64
  const bw = Math.max(1, colW - gap);
61
65
  const yFor = (value) => marginTop + plotH - (value / max) * plotH;
62
66
  const hovered = hoverIndex !== null ? data[hoverIndex] : null;
63
- return (_jsxs("div", { className: "cls_user_signup_ytd_chart col-span-6 flex min-w-0 flex-col rounded-lg border bg-card p-3", style: { height: STAT_CARD_HEIGHT_PX }, children: [_jsxs("div", { className: "flex shrink-0 items-baseline justify-between", children: [_jsx("div", { className: "truncate text-[11px] text-muted-foreground", children: "Signups by month (YTD)" }), _jsx("div", { className: "text-sm font-semibold tabular-nums", children: total.toLocaleString() })] }), _jsxs("div", { className: "relative mt-2 min-h-0 flex-1", children: [_jsxs("svg", { role: "img", "aria-label": `Year-to-date signups by month: ${data
64
- .map((d) => `${d.label} ${d.count}`)
65
- .join(", ")}`, viewBox: `0 0 ${W} ${H}`, preserveAspectRatio: "none", className: "h-full w-full", children: [[0, mid, max].map((tick) => {
67
+ return (_jsxs("div", { className: "cls_user_signup_ytd_chart col-span-6 flex min-w-0 flex-col rounded-lg border bg-card p-3", style: { height: STAT_CARD_HEIGHT_PX }, children: [_jsxs("div", { className: "flex shrink-0 items-baseline justify-between", children: [_jsx("div", { className: "truncate text-[11px] text-muted-foreground", children: t("user_management.signup_stats.ytd_title") }), _jsx("div", { className: "text-sm font-semibold tabular-nums", children: total.toLocaleString() })] }), _jsxs("div", { className: "relative mt-2 min-h-0 flex-1", children: [_jsxs("svg", { role: "img", "aria-label": t("user_management.signup_stats.ytd_aria", {
68
+ list: data.map((d) => `${d.label} ${d.count}`).join(", "),
69
+ }), viewBox: `0 0 ${W} ${H}`, preserveAspectRatio: "none", className: "h-full w-full", children: [[0, mid, max].map((tick) => {
66
70
  const y = yFor(tick);
67
71
  return (_jsxs("g", { children: [_jsx("line", { x1: marginLeft, x2: W - marginRight, y1: y, y2: y, stroke: "currentColor", strokeOpacity: 0.1 }), _jsx("text", { x: marginLeft - 6, y: y, dy: 3, textAnchor: "end", fontSize: 9, className: "fill-muted-foreground", children: tick.toLocaleString() })] }, tick));
68
72
  }), _jsx("line", { x1: marginLeft, x2: W - marginRight, y1: marginTop + plotH, y2: marginTop + plotH, stroke: "currentColor", strokeOpacity: 0.2 }), data.map((d, i) => {
@@ -72,11 +76,11 @@ function YtdMiniChart({ data }) {
72
76
  const barY = marginTop + plotH - barH;
73
77
  const centerX = colX + colW / 2;
74
78
  const isDimmed = hoverIndex !== null && hoverIndex !== i;
75
- return (_jsxs("g", { onMouseEnter: () => setHoverIndex(i), onMouseLeave: () => setHoverIndex(null), children: [_jsx("rect", { x: colX, y: marginTop, width: colW, height: plotH, fill: "transparent" }), _jsx("rect", { x: barX, y: barY, width: bw, height: Math.max(0, barH), rx: 2, className: "fill-primary", fillOpacity: isDimmed ? 0.45 : 1, children: _jsx("title", { children: `${d.label}: ${d.count}` }) }), _jsx("text", { x: centerX, y: barY - 4, textAnchor: "middle", fontSize: 10, fontWeight: 600, className: "fill-foreground", children: d.count }), _jsx("text", { x: centerX, y: marginTop + plotH + 14, textAnchor: "middle", fontSize: 9, className: "fill-muted-foreground", children: d.label })] }, d.label));
79
+ return (_jsxs("g", { onMouseEnter: () => setHoverIndex(i), onMouseLeave: () => setHoverIndex(null), children: [_jsx("rect", { x: colX, y: marginTop, width: colW, height: plotH, fill: "transparent" }), _jsx("rect", { x: barX, y: barY, width: bw, height: Math.max(0, barH), rx: 2, className: "fill-primary", fillOpacity: isDimmed ? 0.45 : 1, children: _jsx("title", { children: `${d.label}: ${d.count} ${t("user_management.signup_stats.tooltip_suffix")}` }) }), _jsx("text", { x: centerX, y: barY - 4, textAnchor: "middle", fontSize: 10, fontWeight: 600, className: "fill-foreground", children: d.count }), _jsx("text", { x: centerX, y: marginTop + plotH + 14, textAnchor: "middle", fontSize: 9, className: "fill-muted-foreground", children: d.label })] }, d.label));
76
80
  })] }), hovered && hoverIndex !== null && (_jsxs("div", { className: "pointer-events-none absolute z-10 -translate-x-1/2 -translate-y-full rounded-md border bg-popover px-2 py-1 text-[10px] font-medium text-popover-foreground shadow-sm", style: {
77
81
  left: `${Math.min(92, Math.max(8, ((marginLeft + hoverIndex * (plotW / n) + plotW / n / 2) / W) * 100))}%`,
78
82
  top: `${((marginTop + plotH - (hovered.count / max) * plotH) / H) * 100}%`,
79
- }, children: [hovered.label, ": ", hovered.count, " signups"] }))] })] }));
83
+ }, children: [hovered.label, ": ", hovered.count, " ", t("user_management.signup_stats.tooltip_suffix")] }))] })] }));
80
84
  }
81
85
  /**
82
86
  * Total + rolling-window signup cards (All time, 7d, 30d, 3mo, 6mo, YTD) each
@@ -7,7 +7,7 @@ import { Label } from "../ui/label.js";
7
7
  import { useAuthT } from "../../contexts/hazo_auth_provider.js";
8
8
  export function OTPRequestForm({ on_sent, api_base = "/api/hazo_auth", email_label, submit_label, pending_label, className, }) {
9
9
  const t = useAuthT();
10
- const resolvedEmailLabel = email_label !== null && email_label !== void 0 ? email_label : t("otp.request.email_label");
10
+ const resolvedEmailLabel = email_label !== null && email_label !== void 0 ? email_label : t("shared.field.email.label");
11
11
  const resolvedSubmitLabel = submit_label !== null && submit_label !== void 0 ? submit_label : t("otp.request.submit_label");
12
12
  const resolvedPendingLabel = pending_label !== null && pending_label !== void 0 ? pending_label : t("otp.request.pending_label");
13
13
  const [email, set_email] = React.useState("");
@@ -1 +1 @@
1
- {"version":3,"file":"cookie_consent_banner.d.ts","sourceRoot":"","sources":["../../src/consent/cookie_consent_banner.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,UAAU,wBAAwB;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,wBAAwB;IACxB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,cAAc,EACd,QAAQ,EACR,QAAmB,GACpB,EAAE,wBAAwB,+BA4E1B"}
1
+ {"version":3,"file":"cookie_consent_banner.d.ts","sourceRoot":"","sources":["../../src/consent/cookie_consent_banner.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,UAAU,wBAAwB;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,wBAAwB;IACxB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,cAAc,EACd,QAAQ,EACR,QAAmB,GACpB,EAAE,wBAAwB,+BA4E1B"}
@@ -5,8 +5,10 @@ import { useEffect, useRef } from "react";
5
5
  import { useConsent } from "./use_consent.js";
6
6
  import { ConsentManageModal } from "./manage_modal.js";
7
7
  import { to_gtm_signals, gtm_default_payload } from "./gtm_mapping.js";
8
+ import { useAuthT } from "../contexts/hazo_auth_provider.js";
8
9
  export function CookieConsentBanner({ enableGTM, gtmContainerId, onChange, position = "bottom", }) {
9
10
  const { consent, set_consent, open_manager } = useConsent();
11
+ const t = useAuthT();
10
12
  const gtm_default_pushed = useRef(false);
11
13
  // Push consent_default to GTM on first mount (before user has consented)
12
14
  useEffect(() => {
@@ -36,5 +38,5 @@ export function CookieConsentBanner({ enableGTM, gtmContainerId, onChange, posit
36
38
  return _jsx(ConsentManageModal, {});
37
39
  }
38
40
  const positionClass = position === "top" ? "top-0" : "bottom-0";
39
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `fixed ${positionClass} left-0 right-0 z-40 bg-primary text-primary-foreground p-4 flex flex-wrap items-center gap-3 justify-between`, children: [_jsx("p", { className: "text-sm flex-1 min-w-[200px]", children: "We use cookies to improve your experience. By continuing, you agree to our use of cookies." }), _jsxs("div", { className: "flex gap-2 flex-wrap", children: [_jsx("button", { onClick: () => set_consent({ functional: false, analytics: false, marketing: false }), className: "px-3 py-1.5 text-xs bg-primary-foreground/20 hover:bg-primary-foreground/30 rounded text-primary-foreground", children: "Decline all" }), _jsx("button", { onClick: () => open_manager(), className: "px-3 py-1.5 text-xs bg-primary-foreground/20 hover:bg-primary-foreground/30 rounded text-primary-foreground", children: "Manage" }), _jsx("button", { onClick: () => set_consent({ functional: true, analytics: true, marketing: true }), className: "px-3 py-1.5 text-xs bg-primary-foreground rounded text-primary font-medium", children: "Accept all" })] })] }), _jsx(ConsentManageModal, {})] }));
41
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `fixed ${positionClass} left-0 right-0 z-40 bg-primary text-primary-foreground p-4 flex flex-wrap items-center gap-3 justify-between`, children: [_jsx("p", { className: "text-sm flex-1 min-w-[200px]", children: t("consent.banner_body") }), _jsxs("div", { className: "flex gap-2 flex-wrap", children: [_jsx("button", { onClick: () => set_consent({ functional: false, analytics: false, marketing: false }), className: "px-3 py-1.5 text-xs bg-primary-foreground/20 hover:bg-primary-foreground/30 rounded text-primary-foreground", children: t("consent.decline_all") }), _jsx("button", { onClick: () => open_manager(), className: "px-3 py-1.5 text-xs bg-primary-foreground/20 hover:bg-primary-foreground/30 rounded text-primary-foreground", children: t("consent.manage") }), _jsx("button", { onClick: () => set_consent({ functional: true, analytics: true, marketing: true }), className: "px-3 py-1.5 text-xs bg-primary-foreground rounded text-primary font-medium", children: t("consent.accept_all") })] })] }), _jsx(ConsentManageModal, {})] }));
40
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"manage_modal.d.ts","sourceRoot":"","sources":["../../src/consent/manage_modal.tsx"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,gCA0GjC"}
1
+ {"version":3,"file":"manage_modal.d.ts","sourceRoot":"","sources":["../../src/consent/manage_modal.tsx"],"names":[],"mappings":"AAQA,wBAAgB,kBAAkB,gCA2GjC"}
@@ -4,7 +4,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import { useEffect, useState } from "react";
5
5
  import * as Dialog from "@radix-ui/react-dialog";
6
6
  import { useConsent } from "./use_consent.js";
7
+ import { useAuthT } from "../contexts/hazo_auth_provider.js";
7
8
  export function ConsentManageModal() {
9
+ const t = useAuthT();
8
10
  const { consent, set_consent } = useConsent();
9
11
  const [open, setOpen] = useState(false);
10
12
  const [local, setLocal] = useState({
@@ -29,5 +31,5 @@ export function ConsentManageModal() {
29
31
  set_consent(Object.assign(Object.assign({}, local), { necessary: true, version: 1 }));
30
32
  setOpen(false);
31
33
  };
32
- return (_jsx(Dialog.Root, { open: open, onOpenChange: setOpen, children: _jsxs(Dialog.Portal, { children: [_jsx(Dialog.Overlay, { className: "fixed inset-0 bg-black/50 z-50" }), _jsxs(Dialog.Content, { className: "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-background rounded-lg p-6 z-50 w-full max-w-md shadow-lg", children: [_jsx(Dialog.Title, { className: "text-lg font-semibold mb-4", children: "Cookie preferences" }), _jsxs("div", { className: "flex items-center justify-between py-3 border-b", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: "Necessary" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Required for the site to function" })] }), _jsx("input", { type: "checkbox", checked: true, disabled: true, className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center justify-between py-3 border-b", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: "Functional" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Remembers your preferences" })] }), _jsx("input", { type: "checkbox", checked: local.functional, onChange: (e) => setLocal((p) => (Object.assign(Object.assign({}, p), { functional: e.target.checked }))), className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center justify-between py-3 border-b", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: "Analytics" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Helps us understand how you use the site" })] }), _jsx("input", { type: "checkbox", checked: local.analytics, onChange: (e) => setLocal((p) => (Object.assign(Object.assign({}, p), { analytics: e.target.checked }))), className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: "Marketing" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Used for targeted advertising" })] }), _jsx("input", { type: "checkbox", checked: local.marketing, onChange: (e) => setLocal((p) => (Object.assign(Object.assign({}, p), { marketing: e.target.checked }))), className: "h-4 w-4" })] }), _jsxs("div", { className: "mt-6 flex gap-3 justify-end", children: [_jsx("button", { className: "px-4 py-2 text-sm border rounded-md hover:bg-muted", onClick: () => setOpen(false), children: "Cancel" }), _jsx("button", { className: "px-4 py-2 text-sm bg-primary text-primary-foreground rounded-md hover:opacity-90", onClick: save, children: "Save preferences" })] })] })] }) }));
34
+ return (_jsx(Dialog.Root, { open: open, onOpenChange: setOpen, children: _jsxs(Dialog.Portal, { children: [_jsx(Dialog.Overlay, { className: "fixed inset-0 bg-black/50 z-50" }), _jsxs(Dialog.Content, { className: "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-background rounded-lg p-6 z-50 w-full max-w-md shadow-lg", children: [_jsx(Dialog.Title, { className: "text-lg font-semibold mb-4", children: t("consent.preferences_title") }), _jsxs("div", { className: "flex items-center justify-between py-3 border-b", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t("consent.category_necessary") }), _jsx("p", { className: "text-sm text-muted-foreground", children: t("consent.category_necessary_desc") })] }), _jsx("input", { type: "checkbox", checked: true, disabled: true, className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center justify-between py-3 border-b", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t("consent.category_functional") }), _jsx("p", { className: "text-sm text-muted-foreground", children: t("consent.category_functional_desc") })] }), _jsx("input", { type: "checkbox", checked: local.functional, onChange: (e) => setLocal((p) => (Object.assign(Object.assign({}, p), { functional: e.target.checked }))), className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center justify-between py-3 border-b", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t("consent.category_analytics") }), _jsx("p", { className: "text-sm text-muted-foreground", children: t("consent.category_analytics_desc") })] }), _jsx("input", { type: "checkbox", checked: local.analytics, onChange: (e) => setLocal((p) => (Object.assign(Object.assign({}, p), { analytics: e.target.checked }))), className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t("consent.category_marketing") }), _jsx("p", { className: "text-sm text-muted-foreground", children: t("consent.category_marketing_desc") })] }), _jsx("input", { type: "checkbox", checked: local.marketing, onChange: (e) => setLocal((p) => (Object.assign(Object.assign({}, p), { marketing: e.target.checked }))), className: "h-4 w-4" })] }), _jsxs("div", { className: "mt-6 flex gap-3 justify-end", children: [_jsx("button", { className: "px-4 py-2 text-sm border rounded-md hover:bg-muted", onClick: () => setOpen(false), children: t("shared.cancel_button") }), _jsx("button", { className: "px-4 py-2 text-sm bg-primary text-primary-foreground rounded-md hover:opacity-90", onClick: save, children: t("consent.save_preferences") })] })] })] }) }));
33
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"password_change_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/password_change_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,oBAAoB,CAAC,CAuH/B"}
1
+ {"version":3,"file":"password_change_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/password_change_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AASvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,oBAAoB,CAAC,CA4F/B"}
@@ -3,6 +3,7 @@ import argon2 from "argon2";
3
3
  import { get_password_requirements_config } from "../password_requirements_config.server.js";
4
4
  import { send_template_email } from "./email_service.js";
5
5
  import { create_app_logger } from "../app_logger.js";
6
+ import { validate_password } from "../utils/password_validator.js";
6
7
  // section: helpers
7
8
  /**
8
9
  * Changes a user's password
@@ -50,34 +51,11 @@ export async function change_password(adapter, user_id, data) {
50
51
  // Get password requirements from config
51
52
  const password_requirements = get_password_requirements_config();
52
53
  // Validate new password
53
- if (!new_password || new_password.length < password_requirements.minimum_length) {
54
+ const password_validation = validate_password(new_password, password_requirements);
55
+ if (!password_validation.valid) {
54
56
  return {
55
57
  success: false,
56
- error: `Password must be at least ${password_requirements.minimum_length} characters long`,
57
- };
58
- }
59
- if (password_requirements.require_uppercase && !/[A-Z]/.test(new_password)) {
60
- return {
61
- success: false,
62
- error: "Password must contain at least one uppercase letter",
63
- };
64
- }
65
- if (password_requirements.require_lowercase && !/[a-z]/.test(new_password)) {
66
- return {
67
- success: false,
68
- error: "Password must contain at least one lowercase letter",
69
- };
70
- }
71
- if (password_requirements.require_number && !/[0-9]/.test(new_password)) {
72
- return {
73
- success: false,
74
- error: "Password must contain at least one number",
75
- };
76
- }
77
- if (password_requirements.require_special && !/[^A-Za-z0-9]/.test(new_password)) {
78
- return {
79
- success: false,
80
- error: "Password must contain at least one special character",
58
+ error: password_validation.errors[0],
81
59
  };
82
60
  }
83
61
  // Hash the new password
@@ -1 +1 @@
1
- {"version":3,"file":"password_validator.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/password_validator.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,0BAA0B,GAAG;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,0BAA0B,GACvC,wBAAwB,CAuC1B"}
1
+ {"version":3,"file":"password_validator.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/password_validator.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,0BAA0B,GAAG;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,0BAA0B,GACvC,wBAAwB,CA0C1B"}
@@ -1,3 +1,14 @@
1
+ // file_description: server-side password validation utility
2
+ //
3
+ // Message strings are sourced directly from `../../locales/en.json` (single
4
+ // source of truth, shared with the client-side `validatePassword()` in
5
+ // `components/layouts/shared/utils/validation.ts`) rather than duplicated as
6
+ // hardcoded English literals — this mirrors the pattern already used by
7
+ // `src/strings/default_strings.ts` for importing locale JSON server-side.
8
+ // section: imports
9
+ import en from "../../locales/en.json" with { type: "json" };
10
+ // section: constants
11
+ const messages = en;
1
12
  // section: helpers
2
13
  /**
3
14
  * Validates a password against specified requirements (server-side version)
@@ -10,24 +21,24 @@ export function validate_password(password, requirements) {
10
21
  if (!password || password.trim().length === 0) {
11
22
  return {
12
23
  valid: false,
13
- errors: ["Password is required"],
24
+ errors: [messages["validation.password_required"]],
14
25
  };
15
26
  }
16
27
  if (password.length < requirements.minimum_length) {
17
- errors.push(`Password must be at least ${requirements.minimum_length} characters.`);
28
+ errors.push(messages["validation.password_too_short"].replace("{{count}}", String(requirements.minimum_length)));
18
29
  }
19
30
  if (requirements.require_uppercase && !/[A-Z]/.test(password)) {
20
- errors.push("Password must include at least one uppercase letter.");
31
+ errors.push(messages["validation.password_missing_uppercase"]);
21
32
  }
22
33
  if (requirements.require_lowercase && !/[a-z]/.test(password)) {
23
- errors.push("Password must include at least one lowercase letter.");
34
+ errors.push(messages["validation.password_missing_lowercase"]);
24
35
  }
25
36
  if (requirements.require_number && !/\d/.test(password)) {
26
- errors.push("Password must include at least one number.");
37
+ errors.push(messages["validation.password_missing_number"]);
27
38
  }
28
39
  if (requirements.require_special &&
29
40
  !/[!@#$%^&*(),.?":{}|<>\-_+=\[\];'/\\]/.test(password)) {
30
- errors.push("Password must include at least one special character.");
41
+ errors.push(messages["validation.password_missing_special"]);
31
42
  }
32
43
  return {
33
44
  valid: errors.length === 0,