@burdenoff/microfe-notification 2026.527.1 → 2026.529.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.
@@ -255,7 +255,7 @@ function m({ channel: t, subject: n, body: r, html: i, appName: s, onChannelChan
255
255
  /* @__PURE__ */ u("div", {
256
256
  className: "px-3 pb-6",
257
257
  children: /* @__PURE__ */ u("div", {
258
- className: "bg-white/90 backdrop-blur-xl rounded-2xl p-3.5 shadow-lg",
258
+ className: "bg-bg-surface/90 backdrop-blur-xl rounded-2xl p-3.5 shadow-lg",
259
259
  children: /* @__PURE__ */ d("div", {
260
260
  className: "flex items-start gap-2.5",
261
261
  children: [/* @__PURE__ */ u("div", {
@@ -298,7 +298,7 @@ function m({ channel: t, subject: n, body: r, html: i, appName: s, onChannelChan
298
298
  }),
299
299
  /* @__PURE__ */ u("div", {
300
300
  className: "flex justify-center pb-3",
301
- children: /* @__PURE__ */ u("div", { className: "w-28 h-1 bg-white/30 rounded-full" })
301
+ children: /* @__PURE__ */ u("div", { className: "w-28 h-1 bg-bg-surface/30 rounded-full" })
302
302
  })
303
303
  ]
304
304
  })
@@ -1 +1 @@
1
- {"version":3,"file":"TemplatePreview.js","names":[],"sources":["../../src/components/TemplatePreview.tsx"],"sourcesContent":["import { useState, useCallback, useEffect, useRef } from 'react';\nimport { Mail, MessageSquare, Bell, Smartphone, Monitor } from 'lucide-react';\nimport { useTr } from '../shared/hooks/useTr';\n\nexport type PreviewChannel = 'email' | 'sms' | 'push' | 'in_app';\n\nexport interface TemplatePreviewProps {\n channel: PreviewChannel;\n subject: string;\n body: string;\n html: string;\n appName: string;\n onChannelChange: (channel: PreviewChannel) => void;\n}\n\n/**\n * Hook to scale an iframe so the full-width email (600px) fits inside\n * the available container width while showing all content without scroll.\n */\nfunction useScaledIframe(html: string) {\n const containerRef = useRef<HTMLDivElement>(null);\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const [scale, setScale] = useState(1);\n const [iframeHeight, setIframeHeight] = useState(400);\n\n const EMAIL_WIDTH = 620; // email templates are typically 600px + a bit of padding\n\n const recalculate = useCallback(() => {\n const container = containerRef.current;\n const iframe = iframeRef.current;\n if (!container || !iframe) return;\n\n const containerWidth = container.clientWidth;\n const newScale = Math.min(1, containerWidth / EMAIL_WIDTH);\n setScale(newScale);\n\n // Give the iframe time to render, then measure its content height\n requestAnimationFrame(() => {\n try {\n const doc = iframe.contentDocument || iframe.contentWindow?.document;\n if (doc?.body) {\n const contentHeight = doc.body.scrollHeight;\n setIframeHeight(contentHeight);\n }\n } catch {\n // cross-origin guard — won't happen with srcDoc + allow-same-origin\n }\n });\n }, []);\n\n // Recalculate when html changes\n useEffect(() => {\n // Small delay to let iframe render new content\n const timer = setTimeout(recalculate, 100);\n return () => clearTimeout(timer);\n }, [html, recalculate]);\n\n // Recalculate on resize\n useEffect(() => {\n const observer = new ResizeObserver(recalculate);\n if (containerRef.current) observer.observe(containerRef.current);\n return () => observer.disconnect();\n }, [recalculate]);\n\n // Also recalculate when iframe loads\n const onIframeLoad = useCallback(() => {\n recalculate();\n }, [recalculate]);\n\n return { containerRef, iframeRef, scale, iframeHeight, onIframeLoad, EMAIL_WIDTH };\n}\n\nconst channelTabs: { id: PreviewChannel; label: string; icon: React.ReactNode }[] = [\n { id: 'email', label: 'Email', icon: <Mail size={14} /> },\n { id: 'sms', label: 'SMS', icon: <MessageSquare size={14} /> },\n { id: 'push', label: 'Push', icon: <Bell size={14} /> },\n { id: 'in_app', label: 'In-App', icon: <Smartphone size={14} /> },\n];\n\n/**\n * Template Preview Component\n *\n * Shows how a notification template will look across different channels.\n * Templates are channel-agnostic — this component lets you preview\n * the same content as it would render on Email, SMS, Push, or In-App.\n *\n * Uses semantic theme tokens (text-primary, bg-surface, etc.) for theme\n * compatibility, with hardcoded colors only inside device mockups where\n * the real device UI is always dark (iPhone SMS, Push lock screen).\n */\nexport function TemplatePreview({\n channel,\n subject,\n body,\n html,\n appName,\n onChannelChange,\n}: TemplatePreviewProps) {\n const tr = useTr();\n const { containerRef, iframeRef, scale, iframeHeight, onIframeLoad, EMAIL_WIDTH } =\n useScaledIframe(html);\n\n return (\n <div className=\"h-full flex flex-col overflow-hidden\">\n {/* ── Channel Tabs ─────────────────────────────────────────── */}\n <div className=\"flex items-center gap-1 p-2 border-b border-default bg-surface/50 shrink-0\">\n {channelTabs.map((tab) => (\n <button\n key={tab.id}\n onClick={() => onChannelChange(tab.id)}\n className={`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150 ${\n channel === tab.id\n ? 'bg-accent-primary/10 text-accent-primary'\n : 'text-tertiary hover:text-primary hover:bg-muted'\n }`}\n >\n {tab.icon}\n {tr(`notifCommon.previewChannel.${tab.id}`, tab.label)}\n </button>\n ))}\n </div>\n\n {/* ── Preview Area ─────────────────────────────────────────── */}\n <div className=\"flex-1 p-4 overflow-auto bg-muted/30\">\n {/* ═══════════════════════════════════════════════════════════\n EMAIL PREVIEW — Desktop email client mockup\n ═══════════════════════════════════════════════════════════ */}\n {channel === 'email' && (\n <div className=\"max-w-xl mx-auto\">\n <div className=\"bg-surface rounded-xl shadow-lg overflow-hidden border border-default\">\n {/* Window chrome */}\n <div className=\"bg-muted px-4 py-3 border-b border-default\">\n <div className=\"flex items-center gap-1.5 mb-3\">\n <div className=\"w-2.5 h-2.5 rounded-full bg-red-400\"></div>\n <div className=\"w-2.5 h-2.5 rounded-full bg-yellow-400\"></div>\n <div className=\"w-2.5 h-2.5 rounded-full bg-green-400\"></div>\n </div>\n <div className=\"space-y-1.5\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-[10px] font-medium text-tertiary w-12\">\n {tr('notifCommon.emailFromLabel', 'From:')}\n </span>\n <span className=\"text-xs text-secondary\">\n {appName || 'noreply@example.com'}\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-[10px] font-medium text-tertiary w-12\">\n {tr('notifCommon.emailToLabel', 'To:')}\n </span>\n <span className=\"text-xs text-secondary\">recipient@example.com</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-[10px] font-medium text-tertiary w-12\">\n {tr('notifCommon.emailSubjectLabel', 'Subject:')}\n </span>\n <span className=\"text-xs font-semibold text-primary\">\n {subject || (\n <span className=\"text-tertiary italic\">\n {tr('notifCommon.noSubject', 'No subject')}\n </span>\n )}\n </span>\n </div>\n </div>\n </div>\n\n {/* Email body — scaled iframe for pixel-perfect preview */}\n <div className=\"overflow-hidden\" ref={containerRef}>\n {html ? (\n <div\n style={{\n width: EMAIL_WIDTH,\n height: iframeHeight,\n transform: `scale(${scale})`,\n transformOrigin: 'top left',\n }}\n >\n <iframe\n ref={iframeRef}\n srcDoc={`<!DOCTYPE html><html><head><meta charset=\"utf-8\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/><style>body{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,sans-serif;font-size:14px;line-height:1.6;color:#1a1a1a;margin:0;padding:0}img{max-width:100%}a{color:#2563eb}table{border-collapse:collapse}</style></head><body>${html}</body></html>`}\n sandbox=\"allow-same-origin\"\n style={{ width: EMAIL_WIDTH, height: iframeHeight, border: 'none' }}\n title=\"Email preview\"\n onLoad={onIframeLoad}\n />\n </div>\n ) : body ? (\n <div className=\"p-5 min-h-[180px]\">\n <pre className=\"text-sm text-primary whitespace-pre-wrap font-sans leading-relaxed\">\n {body}\n </pre>\n </div>\n ) : (\n <div className=\"flex items-center justify-center h-40 text-tertiary p-5\">\n <p className=\"text-sm italic\">\n {tr('notifCommon.startTypingEmail', 'Start typing to see email preview...')}\n </p>\n </div>\n )}\n </div>\n\n {/* Scaled container height — collapse outer div to match scaled size */}\n {html && (\n <div\n style={{\n marginTop: -(iframeHeight - iframeHeight * scale),\n }}\n />\n )}\n </div>\n </div>\n )}\n\n {/* ═══════════════════════════════════════════════════════════\n SMS PREVIEW — iPhone Messages mockup\n ═══════════════════════════════════════════════════════════ */}\n {channel === 'sms' && (\n <div className=\"flex justify-center\">\n <div className=\"w-72 bg-black rounded-[2.5rem] p-2.5 shadow-2xl\">\n <div className=\"bg-gray-900 rounded-[2rem] overflow-hidden\">\n {/* Notch */}\n <div className=\"flex justify-center pt-1.5 pb-3 bg-black\">\n <div className=\"w-20 h-5 bg-black rounded-full\"></div>\n </div>\n\n {/* Messages header */}\n <div className=\"bg-gray-800 px-3 py-2.5 flex items-center justify-between border-b border-gray-700\">\n <span className=\"text-blue-400 text-xs\">&lt; Messages</span>\n <span className=\"text-white text-xs font-semibold\">{appName || 'Sender'}</span>\n <div className=\"w-6 h-6 bg-gray-600 rounded-full\"></div>\n </div>\n\n {/* Message area */}\n <div className=\"bg-black min-h-[280px] p-3 space-y-3\">\n <div className=\"text-center\">\n <span className=\"text-[10px] text-gray-500\">\n {tr('notifCommon.smsTimestamp', 'Today 10:30 AM')}\n </span>\n </div>\n\n {body ? (\n <div className=\"flex justify-start\">\n <div className=\"max-w-[80%] bg-gray-700 text-white text-xs px-3 py-2.5 rounded-2xl rounded-bl-md leading-relaxed\">\n {body}\n </div>\n </div>\n ) : (\n <div className=\"flex items-center justify-center h-24 text-gray-500\">\n <p className=\"text-xs italic\">\n {tr('notifCommon.noMessageContent', 'No message content')}\n </p>\n </div>\n )}\n </div>\n\n {/* Input bar */}\n <div className=\"bg-gray-900 px-3 py-2.5 flex items-center gap-2 border-t border-gray-800\">\n <div className=\"flex-1 bg-gray-700 rounded-full px-3 py-1.5\">\n <span className=\"text-gray-400 text-[10px]\">iMessage</span>\n </div>\n <div className=\"w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center\">\n <span className=\"text-white text-[10px]\">↑</span>\n </div>\n </div>\n </div>\n </div>\n </div>\n )}\n\n {/* ═══════════════════════════════════════════════════════════\n PUSH PREVIEW — iPhone lock screen mockup\n ═══════════════════════════════════════════════════════════ */}\n {channel === 'push' && (\n <div className=\"flex justify-center\">\n <div className=\"w-72 bg-black rounded-[2.5rem] p-2.5 shadow-2xl\">\n <div className=\"bg-gradient-to-b from-purple-900 via-blue-900 to-black rounded-[2rem] overflow-hidden\">\n {/* Notch */}\n <div className=\"flex justify-center pt-1.5 pb-1.5 bg-black/30\">\n <div className=\"w-20 h-5 bg-black rounded-full\"></div>\n </div>\n\n {/* Time */}\n <div className=\"text-center pt-8 pb-6\">\n <div className=\"text-5xl font-light text-white\">9:41</div>\n <div className=\"text-sm text-white/80 mt-1\">\n {tr('notifCommon.pushDate', 'Monday, January 27')}\n </div>\n </div>\n\n {/* Push notification card */}\n <div className=\"px-3 pb-6\">\n <div className=\"bg-white/90 backdrop-blur-xl rounded-2xl p-3.5 shadow-lg\">\n <div className=\"flex items-start gap-2.5\">\n <div className=\"w-8 h-8 bg-blue-500 rounded-xl flex items-center justify-center flex-shrink-0\">\n <Bell size={16} className=\"text-white\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-[10px] font-semibold text-gray-900 uppercase tracking-wide\">\n {appName || tr('notifCommon.pushAppNameFallback', 'App Name')}\n </span>\n <span className=\"text-[10px] text-gray-500\">\n {tr('notifCommon.pushTimestampNow', 'now')}\n </span>\n </div>\n <div className=\"text-xs font-semibold text-gray-900 mt-0.5\">\n {subject || (\n <span className=\"text-gray-400 italic\">\n {tr('notifCommon.noTitle', 'No title')}\n </span>\n )}\n </div>\n <div className=\"text-xs text-gray-600 line-clamp-2 mt-0.5 leading-relaxed\">\n {body || (\n <span className=\"italic\">\n {tr('notifCommon.noMessage', 'No message')}\n </span>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n\n {/* Home indicator */}\n <div className=\"flex justify-center pb-3\">\n <div className=\"w-28 h-1 bg-white/30 rounded-full\"></div>\n </div>\n </div>\n </div>\n </div>\n )}\n\n {/* ═══════════════════════════════════════════════════════════\n IN-APP PREVIEW — Desktop notification panel mockup\n ═══════════════════════════════════════════════════════════ */}\n {channel === 'in_app' && (\n <div className=\"max-w-sm mx-auto\">\n <div className=\"bg-surface rounded-xl shadow-lg overflow-hidden border border-default\">\n {/* Panel header */}\n <div className=\"bg-muted px-4 py-2.5 border-b border-default flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <Bell size={16} className=\"text-tertiary\" />\n <span className=\"text-sm font-semibold text-primary\">\n {tr('notifCommon.notifications', 'Notifications')}\n </span>\n </div>\n <span className=\"text-[10px] text-accent-primary font-medium\">\n {tr('notifCommon.markAllAsRead', 'Mark all as read')}\n </span>\n </div>\n\n {/* Notification items */}\n <div className=\"divide-y divide-default\">\n {/* Active notification (the template) */}\n <div className=\"p-3.5 bg-accent-primary/5 flex items-start gap-2.5\">\n <div className=\"w-8 h-8 bg-accent-primary/10 rounded-full flex items-center justify-center flex-shrink-0\">\n <Bell size={14} className=\"text-accent-primary\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center justify-between mb-0.5\">\n <span className=\"text-xs font-semibold text-primary\">\n {subject || appName || (\n <span className=\"text-tertiary italic\">\n {tr('notifCommon.notification', 'Notification')}\n </span>\n )}\n </span>\n <span className=\"text-[10px] text-tertiary\">\n {tr('notifCommon.inAppJustNow', 'Just now')}\n </span>\n </div>\n <p className=\"text-xs text-secondary leading-relaxed\">\n {body || (\n <span className=\"italic text-tertiary\">\n {tr('notifCommon.noMessageContent', 'No message content')}\n </span>\n )}\n </p>\n </div>\n <div className=\"w-1.5 h-1.5 bg-accent rounded-full flex-shrink-0 mt-1.5\"></div>\n </div>\n\n {/* Older notifications (dimmed placeholders) */}\n <div className=\"p-3.5 flex items-start gap-2.5 opacity-40\">\n <div className=\"w-8 h-8 bg-muted rounded-full flex items-center justify-center flex-shrink-0\">\n <Monitor size={14} className=\"text-tertiary\" />\n </div>\n <div className=\"flex-1\">\n <div className=\"flex items-center justify-between mb-0.5\">\n <span className=\"text-xs font-medium text-primary\">\n {tr('notifCommon.sampleSystemUpdate', 'System Update')}\n </span>\n <span className=\"text-[10px] text-tertiary\">\n {tr('notifCommon.sampleTwoHoursAgo', '2h ago')}\n </span>\n </div>\n <p className=\"text-xs text-secondary\">\n {tr(\n 'notifCommon.sampleSystemUpdateBody',\n 'Your system has been updated successfully.'\n )}\n </p>\n </div>\n </div>\n\n <div className=\"p-3.5 flex items-start gap-2.5 opacity-40\">\n <div className=\"w-8 h-8 bg-muted rounded-full flex items-center justify-center flex-shrink-0\">\n <Mail size={14} className=\"text-tertiary\" />\n </div>\n <div className=\"flex-1\">\n <div className=\"flex items-center justify-between mb-0.5\">\n <span className=\"text-xs font-medium text-primary\">\n {tr('notifCommon.sampleNewMessage', 'New Message')}\n </span>\n <span className=\"text-[10px] text-tertiary\">\n {tr('notifCommon.sampleOneDayAgo', '1d ago')}\n </span>\n </div>\n <p className=\"text-xs text-secondary\">\n {tr(\n 'notifCommon.sampleNewMessageBody',\n 'You have a new message from support.'\n )}\n </p>\n </div>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AAmBA,SAAS,EAAgB,GAAc;CACrC,IAAM,IAAe,EAAuB,KAAK,EAC3C,IAAY,EAA0B,KAAK,EAC3C,CAAC,GAAO,KAAY,EAAS,EAAE,EAC/B,CAAC,GAAc,KAAmB,EAAS,IAAI,EAI/C,IAAc,QAAkB;EACpC,IAAM,IAAY,EAAa,SACzB,IAAS,EAAU;AACzB,MAAI,CAAC,KAAa,CAAC,EAAQ;EAE3B,IAAM,IAAiB,EAAU;AAKjC,EAHA,EADiB,KAAK,IAAI,GAAG,IAAiB,IAAY,CACxC,EAGlB,4BAA4B;AAC1B,OAAI;IACF,IAAM,IAAM,EAAO,mBAAmB,EAAO,eAAe;AAC5D,QAAI,GAAK,MAAM;KACb,IAAM,IAAgB,EAAI,KAAK;AAC/B,OAAgB,EAAc;;WAE1B;IAGR;IACD,EAAE,CAAC;AAqBN,QAlBA,QAAgB;EAEd,IAAM,IAAQ,WAAW,GAAa,IAAI;AAC1C,eAAa,aAAa,EAAM;IAC/B,CAAC,GAAM,EAAY,CAAC,EAGvB,QAAgB;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AG,iCAAiC,SAAS;YACzC,CAAA,CACH;cACN,kBAAC,KAAD;WAAG,WAAU;qBACV,EACC,sCACA,6CACD;WACC,CAAA,CACA;YACF;;QAEN,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,OAAD;UAAK,WAAU;oBACb,kBAAC,GAAD;WAAM,MAAM;WAAI,WAAU;WAAkB,CAAA;UACxC,CAAA,EACN,kBAAC,OAAD;UAAK,WAAU;oBAAf,CACE,kBAAC,OAAD;WAAK,WAAU;qBAAf,CACE,kBAAC,QAAD;YAAM,WAAU;sBACb,EAAG,gCAAgC,cAAc;YAC7C,CAAA,EACP,kBAAC,QAAD;YAAM,WAAU;sBACb,EAAG,+BAA+B,SAAS;YACvC,CAAA,CACH;cACN,kBAAC,KAAD;WAAG,WAAU;qBACV,EACC,oCACA,uCACD;WACC,CAAA,CACA;YACF;;QACF;SACF;;KACF,CAAA;IAEJ;KACF"}
1
+ {"version":3,"file":"TemplatePreview.js","names":[],"sources":["../../src/components/TemplatePreview.tsx"],"sourcesContent":["import { useState, useCallback, useEffect, useRef } from 'react';\nimport { Mail, MessageSquare, Bell, Smartphone, Monitor } from 'lucide-react';\nimport { useTr } from '../shared/hooks/useTr';\n\nexport type PreviewChannel = 'email' | 'sms' | 'push' | 'in_app';\n\nexport interface TemplatePreviewProps {\n channel: PreviewChannel;\n subject: string;\n body: string;\n html: string;\n appName: string;\n onChannelChange: (channel: PreviewChannel) => void;\n}\n\n/**\n * Hook to scale an iframe so the full-width email (600px) fits inside\n * the available container width while showing all content without scroll.\n */\nfunction useScaledIframe(html: string) {\n const containerRef = useRef<HTMLDivElement>(null);\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const [scale, setScale] = useState(1);\n const [iframeHeight, setIframeHeight] = useState(400);\n\n const EMAIL_WIDTH = 620; // email templates are typically 600px + a bit of padding\n\n const recalculate = useCallback(() => {\n const container = containerRef.current;\n const iframe = iframeRef.current;\n if (!container || !iframe) return;\n\n const containerWidth = container.clientWidth;\n const newScale = Math.min(1, containerWidth / EMAIL_WIDTH);\n setScale(newScale);\n\n // Give the iframe time to render, then measure its content height\n requestAnimationFrame(() => {\n try {\n const doc = iframe.contentDocument || iframe.contentWindow?.document;\n if (doc?.body) {\n const contentHeight = doc.body.scrollHeight;\n setIframeHeight(contentHeight);\n }\n } catch {\n // cross-origin guard — won't happen with srcDoc + allow-same-origin\n }\n });\n }, []);\n\n // Recalculate when html changes\n useEffect(() => {\n // Small delay to let iframe render new content\n const timer = setTimeout(recalculate, 100);\n return () => clearTimeout(timer);\n }, [html, recalculate]);\n\n // Recalculate on resize\n useEffect(() => {\n const observer = new ResizeObserver(recalculate);\n if (containerRef.current) observer.observe(containerRef.current);\n return () => observer.disconnect();\n }, [recalculate]);\n\n // Also recalculate when iframe loads\n const onIframeLoad = useCallback(() => {\n recalculate();\n }, [recalculate]);\n\n return { containerRef, iframeRef, scale, iframeHeight, onIframeLoad, EMAIL_WIDTH };\n}\n\nconst channelTabs: { id: PreviewChannel; label: string; icon: React.ReactNode }[] = [\n { id: 'email', label: 'Email', icon: <Mail size={14} /> },\n { id: 'sms', label: 'SMS', icon: <MessageSquare size={14} /> },\n { id: 'push', label: 'Push', icon: <Bell size={14} /> },\n { id: 'in_app', label: 'In-App', icon: <Smartphone size={14} /> },\n];\n\n/**\n * Template Preview Component\n *\n * Shows how a notification template will look across different channels.\n * Templates are channel-agnostic — this component lets you preview\n * the same content as it would render on Email, SMS, Push, or In-App.\n *\n * Uses semantic theme tokens (text-primary, bg-surface, etc.) for theme\n * compatibility, with hardcoded colors only inside device mockups where\n * the real device UI is always dark (iPhone SMS, Push lock screen).\n */\nexport function TemplatePreview({\n channel,\n subject,\n body,\n html,\n appName,\n onChannelChange,\n}: TemplatePreviewProps) {\n const tr = useTr();\n const { containerRef, iframeRef, scale, iframeHeight, onIframeLoad, EMAIL_WIDTH } =\n useScaledIframe(html);\n\n return (\n <div className=\"h-full flex flex-col overflow-hidden\">\n {/* ── Channel Tabs ─────────────────────────────────────────── */}\n <div className=\"flex items-center gap-1 p-2 border-b border-default bg-surface/50 shrink-0\">\n {channelTabs.map((tab) => (\n <button\n key={tab.id}\n onClick={() => onChannelChange(tab.id)}\n className={`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150 ${\n channel === tab.id\n ? 'bg-accent-primary/10 text-accent-primary'\n : 'text-tertiary hover:text-primary hover:bg-muted'\n }`}\n >\n {tab.icon}\n {tr(`notifCommon.previewChannel.${tab.id}`, tab.label)}\n </button>\n ))}\n </div>\n\n {/* ── Preview Area ─────────────────────────────────────────── */}\n <div className=\"flex-1 p-4 overflow-auto bg-muted/30\">\n {/* ═══════════════════════════════════════════════════════════\n EMAIL PREVIEW — Desktop email client mockup\n ═══════════════════════════════════════════════════════════ */}\n {channel === 'email' && (\n <div className=\"max-w-xl mx-auto\">\n <div className=\"bg-surface rounded-xl shadow-lg overflow-hidden border border-default\">\n {/* Window chrome */}\n <div className=\"bg-muted px-4 py-3 border-b border-default\">\n <div className=\"flex items-center gap-1.5 mb-3\">\n <div className=\"w-2.5 h-2.5 rounded-full bg-red-400\"></div>\n <div className=\"w-2.5 h-2.5 rounded-full bg-yellow-400\"></div>\n <div className=\"w-2.5 h-2.5 rounded-full bg-green-400\"></div>\n </div>\n <div className=\"space-y-1.5\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-[10px] font-medium text-tertiary w-12\">\n {tr('notifCommon.emailFromLabel', 'From:')}\n </span>\n <span className=\"text-xs text-secondary\">\n {appName || 'noreply@example.com'}\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-[10px] font-medium text-tertiary w-12\">\n {tr('notifCommon.emailToLabel', 'To:')}\n </span>\n <span className=\"text-xs text-secondary\">recipient@example.com</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-[10px] font-medium text-tertiary w-12\">\n {tr('notifCommon.emailSubjectLabel', 'Subject:')}\n </span>\n <span className=\"text-xs font-semibold text-primary\">\n {subject || (\n <span className=\"text-tertiary italic\">\n {tr('notifCommon.noSubject', 'No subject')}\n </span>\n )}\n </span>\n </div>\n </div>\n </div>\n\n {/* Email body — scaled iframe for pixel-perfect preview */}\n <div className=\"overflow-hidden\" ref={containerRef}>\n {html ? (\n <div\n style={{\n width: EMAIL_WIDTH,\n height: iframeHeight,\n transform: `scale(${scale})`,\n transformOrigin: 'top left',\n }}\n >\n <iframe\n ref={iframeRef}\n srcDoc={`<!DOCTYPE html><html><head><meta charset=\"utf-8\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/><style>body{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,sans-serif;font-size:14px;line-height:1.6;color:#1a1a1a;margin:0;padding:0}img{max-width:100%}a{color:#2563eb}table{border-collapse:collapse}</style></head><body>${html}</body></html>`}\n sandbox=\"allow-same-origin\"\n style={{ width: EMAIL_WIDTH, height: iframeHeight, border: 'none' }}\n title=\"Email preview\"\n onLoad={onIframeLoad}\n />\n </div>\n ) : body ? (\n <div className=\"p-5 min-h-[180px]\">\n <pre className=\"text-sm text-primary whitespace-pre-wrap font-sans leading-relaxed\">\n {body}\n </pre>\n </div>\n ) : (\n <div className=\"flex items-center justify-center h-40 text-tertiary p-5\">\n <p className=\"text-sm italic\">\n {tr('notifCommon.startTypingEmail', 'Start typing to see email preview...')}\n </p>\n </div>\n )}\n </div>\n\n {/* Scaled container height — collapse outer div to match scaled size */}\n {html && (\n <div\n style={{\n marginTop: -(iframeHeight - iframeHeight * scale),\n }}\n />\n )}\n </div>\n </div>\n )}\n\n {/* ═══════════════════════════════════════════════════════════\n SMS PREVIEW — iPhone Messages mockup\n ═══════════════════════════════════════════════════════════ */}\n {channel === 'sms' && (\n <div className=\"flex justify-center\">\n <div className=\"w-72 bg-black rounded-[2.5rem] p-2.5 shadow-2xl\">\n <div className=\"bg-gray-900 rounded-[2rem] overflow-hidden\">\n {/* Notch */}\n <div className=\"flex justify-center pt-1.5 pb-3 bg-black\">\n <div className=\"w-20 h-5 bg-black rounded-full\"></div>\n </div>\n\n {/* Messages header */}\n <div className=\"bg-gray-800 px-3 py-2.5 flex items-center justify-between border-b border-gray-700\">\n <span className=\"text-blue-400 text-xs\">&lt; Messages</span>\n <span className=\"text-white text-xs font-semibold\">{appName || 'Sender'}</span>\n <div className=\"w-6 h-6 bg-gray-600 rounded-full\"></div>\n </div>\n\n {/* Message area */}\n <div className=\"bg-black min-h-[280px] p-3 space-y-3\">\n <div className=\"text-center\">\n <span className=\"text-[10px] text-gray-500\">\n {tr('notifCommon.smsTimestamp', 'Today 10:30 AM')}\n </span>\n </div>\n\n {body ? (\n <div className=\"flex justify-start\">\n <div className=\"max-w-[80%] bg-gray-700 text-white text-xs px-3 py-2.5 rounded-2xl rounded-bl-md leading-relaxed\">\n {body}\n </div>\n </div>\n ) : (\n <div className=\"flex items-center justify-center h-24 text-gray-500\">\n <p className=\"text-xs italic\">\n {tr('notifCommon.noMessageContent', 'No message content')}\n </p>\n </div>\n )}\n </div>\n\n {/* Input bar */}\n <div className=\"bg-gray-900 px-3 py-2.5 flex items-center gap-2 border-t border-gray-800\">\n <div className=\"flex-1 bg-gray-700 rounded-full px-3 py-1.5\">\n <span className=\"text-gray-400 text-[10px]\">iMessage</span>\n </div>\n <div className=\"w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center\">\n <span className=\"text-white text-[10px]\">↑</span>\n </div>\n </div>\n </div>\n </div>\n </div>\n )}\n\n {/* ═══════════════════════════════════════════════════════════\n PUSH PREVIEW — iPhone lock screen mockup\n ═══════════════════════════════════════════════════════════ */}\n {channel === 'push' && (\n <div className=\"flex justify-center\">\n <div className=\"w-72 bg-black rounded-[2.5rem] p-2.5 shadow-2xl\">\n <div className=\"bg-gradient-to-b from-purple-900 via-blue-900 to-black rounded-[2rem] overflow-hidden\">\n {/* Notch */}\n <div className=\"flex justify-center pt-1.5 pb-1.5 bg-black/30\">\n <div className=\"w-20 h-5 bg-black rounded-full\"></div>\n </div>\n\n {/* Time */}\n <div className=\"text-center pt-8 pb-6\">\n <div className=\"text-5xl font-light text-white\">9:41</div>\n <div className=\"text-sm text-white/80 mt-1\">\n {tr('notifCommon.pushDate', 'Monday, January 27')}\n </div>\n </div>\n\n {/* Push notification card */}\n <div className=\"px-3 pb-6\">\n <div className=\"bg-bg-surface/90 backdrop-blur-xl rounded-2xl p-3.5 shadow-lg\">\n <div className=\"flex items-start gap-2.5\">\n <div className=\"w-8 h-8 bg-blue-500 rounded-xl flex items-center justify-center flex-shrink-0\">\n <Bell size={16} className=\"text-white\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-[10px] font-semibold text-gray-900 uppercase tracking-wide\">\n {appName || tr('notifCommon.pushAppNameFallback', 'App Name')}\n </span>\n <span className=\"text-[10px] text-gray-500\">\n {tr('notifCommon.pushTimestampNow', 'now')}\n </span>\n </div>\n <div className=\"text-xs font-semibold text-gray-900 mt-0.5\">\n {subject || (\n <span className=\"text-gray-400 italic\">\n {tr('notifCommon.noTitle', 'No title')}\n </span>\n )}\n </div>\n <div className=\"text-xs text-gray-600 line-clamp-2 mt-0.5 leading-relaxed\">\n {body || (\n <span className=\"italic\">\n {tr('notifCommon.noMessage', 'No message')}\n </span>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n\n {/* Home indicator */}\n <div className=\"flex justify-center pb-3\">\n <div className=\"w-28 h-1 bg-bg-surface/30 rounded-full\"></div>\n </div>\n </div>\n </div>\n </div>\n )}\n\n {/* ═══════════════════════════════════════════════════════════\n IN-APP PREVIEW — Desktop notification panel mockup\n ═══════════════════════════════════════════════════════════ */}\n {channel === 'in_app' && (\n <div className=\"max-w-sm mx-auto\">\n <div className=\"bg-surface rounded-xl shadow-lg overflow-hidden border border-default\">\n {/* Panel header */}\n <div className=\"bg-muted px-4 py-2.5 border-b border-default flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <Bell size={16} className=\"text-tertiary\" />\n <span className=\"text-sm font-semibold text-primary\">\n {tr('notifCommon.notifications', 'Notifications')}\n </span>\n </div>\n <span className=\"text-[10px] text-accent-primary font-medium\">\n {tr('notifCommon.markAllAsRead', 'Mark all as read')}\n </span>\n </div>\n\n {/* Notification items */}\n <div className=\"divide-y divide-default\">\n {/* Active notification (the template) */}\n <div className=\"p-3.5 bg-accent-primary/5 flex items-start gap-2.5\">\n <div className=\"w-8 h-8 bg-accent-primary/10 rounded-full flex items-center justify-center flex-shrink-0\">\n <Bell size={14} className=\"text-accent-primary\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center justify-between mb-0.5\">\n <span className=\"text-xs font-semibold text-primary\">\n {subject || appName || (\n <span className=\"text-tertiary italic\">\n {tr('notifCommon.notification', 'Notification')}\n </span>\n )}\n </span>\n <span className=\"text-[10px] text-tertiary\">\n {tr('notifCommon.inAppJustNow', 'Just now')}\n </span>\n </div>\n <p className=\"text-xs text-secondary leading-relaxed\">\n {body || (\n <span className=\"italic text-tertiary\">\n {tr('notifCommon.noMessageContent', 'No message content')}\n </span>\n )}\n </p>\n </div>\n <div className=\"w-1.5 h-1.5 bg-accent rounded-full flex-shrink-0 mt-1.5\"></div>\n </div>\n\n {/* Older notifications (dimmed placeholders) */}\n <div className=\"p-3.5 flex items-start gap-2.5 opacity-40\">\n <div className=\"w-8 h-8 bg-muted rounded-full flex items-center justify-center flex-shrink-0\">\n <Monitor size={14} className=\"text-tertiary\" />\n </div>\n <div className=\"flex-1\">\n <div className=\"flex items-center justify-between mb-0.5\">\n <span className=\"text-xs font-medium text-primary\">\n {tr('notifCommon.sampleSystemUpdate', 'System Update')}\n </span>\n <span className=\"text-[10px] text-tertiary\">\n {tr('notifCommon.sampleTwoHoursAgo', '2h ago')}\n </span>\n </div>\n <p className=\"text-xs text-secondary\">\n {tr(\n 'notifCommon.sampleSystemUpdateBody',\n 'Your system has been updated successfully.'\n )}\n </p>\n </div>\n </div>\n\n <div className=\"p-3.5 flex items-start gap-2.5 opacity-40\">\n <div className=\"w-8 h-8 bg-muted rounded-full flex items-center justify-center flex-shrink-0\">\n <Mail size={14} className=\"text-tertiary\" />\n </div>\n <div className=\"flex-1\">\n <div className=\"flex items-center justify-between mb-0.5\">\n <span className=\"text-xs font-medium text-primary\">\n {tr('notifCommon.sampleNewMessage', 'New Message')}\n </span>\n <span className=\"text-[10px] text-tertiary\">\n {tr('notifCommon.sampleOneDayAgo', '1d ago')}\n </span>\n </div>\n <p className=\"text-xs text-secondary\">\n {tr(\n 'notifCommon.sampleNewMessageBody',\n 'You have a new message from support.'\n )}\n </p>\n </div>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AAmBA,SAAS,EAAgB,GAAc;CACrC,IAAM,IAAe,EAAuB,KAAK,EAC3C,IAAY,EAA0B,KAAK,EAC3C,CAAC,GAAO,KAAY,EAAS,EAAE,EAC/B,CAAC,GAAc,KAAmB,EAAS,IAAI,EAI/C,IAAc,QAAkB;EACpC,IAAM,IAAY,EAAa,SACzB,IAAS,EAAU;AACzB,MAAI,CAAC,KAAa,CAAC,EAAQ;EAE3B,IAAM,IAAiB,EAAU;AAKjC,EAHA,EADiB,KAAK,IAAI,GAAG,IAAiB,IAAY,CACxC,EAGlB,4BAA4B;AAC1B,OAAI;IACF,IAAM,IAAM,EAAO,mBAAmB,EAAO,eAAe;AAC5D,QAAI,GAAK,MAAM;KACb,IAAM,IAAgB,EAAI,KAAK;AAC/B,OAAgB,EAAc;;WAE1B;IAGR;IACD,EAAE,CAAC;AAqBN,QAlBA,QAAgB;EAEd,IAAM,IAAQ,WAAW,GAAa,IAAI;AAC1C,eAAa,aAAa,EAAM;IAC/B,CAAC,GAAM,EAAY,CAAC,EAGvB,QAAgB;EACd,IAAM,IAAW,IAAI,eAAe,EAAY;AAEhD,SADI,EAAa,WAAS,EAAS,QAAQ,EAAa,QAAQ,QACnD,EAAS,YAAY;IACjC,CAAC,EAAY,CAAC,EAOV;EAAE;EAAc;E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f,CACE,kBAAC,OAAD;UAAK,WAAU;oBACb,kBAAC,GAAD;WAAM,MAAM;WAAI,WAAU;WAAkB,CAAA;UACxC,CAAA,EACN,kBAAC,OAAD;UAAK,WAAU;oBAAf,CACE,kBAAC,OAAD;WAAK,WAAU;qBAAf,CACE,kBAAC,QAAD;YAAM,WAAU;sBACb,EAAG,gCAAgC,cAAc;YAC7C,CAAA,EACP,kBAAC,QAAD;YAAM,WAAU;sBACb,EAAG,+BAA+B,SAAS;YACvC,CAAA,CACH;cACN,kBAAC,KAAD;WAAG,WAAU;qBACV,EACC,oCACA,uCACD;WACC,CAAA,CACA;YACF;;QACF;SACF;;KACF,CAAA;IAEJ;KACF"}
@@ -1,5 +1,5 @@
1
1
  //#region node_modules/@apollo/client/version.js
2
- var e = "4.1.9";
2
+ var e = "4.2.0";
3
3
  //#endregion
4
4
  export { e as version };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../../../node_modules/@apollo/client/version.js"],"sourcesContent":["export const version = \"4.1.9\";\nexport const build = \"esm\";\n//# sourceMappingURL=version.js.map\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAa,IAAU"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../../../node_modules/@apollo/client/version.js"],"sourcesContent":["export const version = \"4.2.0\";\nexport const build = \"esm\";\n//# sourceMappingURL=version.js.map\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAa,IAAU"}
@@ -10,8 +10,9 @@ import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react"
10
10
  import { BellRing as f, Search as p, ToggleLeft as m, ToggleRight as h } from "lucide-react";
11
11
  import { usePermissions as g } from "@burdenoff/fe-libs/shared/providers/shell";
12
12
  import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
+ import { OptionalFields as y } from "@burdenoff/fe-libs/ui";
13
14
  //#region src/pages/NotificationPreferencesPage.tsx
14
- var y = [
15
+ var b = [
15
16
  {
16
17
  value: "IN_APP",
17
18
  labelKey: "notifications.channelInApp",
@@ -42,7 +43,7 @@ var y = [
42
43
  labelKey: "notifications.channelSlack",
43
44
  label: "Slack"
44
45
  }
45
- ], b = [
46
+ ], x = [
46
47
  {
47
48
  value: "TRANSACTIONAL",
48
49
  labelKey: "notifications.typeTransactional",
@@ -64,80 +65,80 @@ var y = [
64
65
  label: "Marketing"
65
66
  }
66
67
  ];
67
- function x(e) {
68
+ function S(e) {
68
69
  return e.scope === "CHANNEL" ? `CHANNEL:${e.channel || ""}` : e.scope === "TYPE" ? `TYPE:${e.type || ""}` : e.scope === "TOPIC" ? `TOPIC:${e.topicId || ""}` : "GLOBAL";
69
70
  }
70
- function S() {
71
- let S = i(), { hasPermission: C, isLoading: w } = g(), { currentUser: T } = e(), { topics: E, isLoading: D } = r({
71
+ function C() {
72
+ let C = i(), { hasPermission: w, isLoading: T } = g(), { currentUser: E } = e(), { topics: D, isLoading: O } = r({
72
73
  type: "MARKETING",
73
74
  isActive: !0
74
- }), { preferencesByKey: O, isLoading: k, setPreference: A, deletePreference: j } = n(), { trackPreferenceUpdated: M } = t(), [N, P] = d(""), [F, I] = d(null), [L, R] = d(null), z = u(null), B = D || k;
75
+ }), { preferencesByKey: k, isLoading: A, setPreference: j, deletePreference: M } = n(), { trackPreferenceUpdated: N } = t(), [P, F] = d(""), [I, L] = d(null), [R, z] = d(null), B = u(null), V = O || A;
75
76
  c(() => () => {
76
- z.current && clearTimeout(z.current);
77
+ B.current && clearTimeout(B.current);
77
78
  }, []);
78
- let V = (e) => {
79
- z.current && clearTimeout(z.current), R(e), z.current = setTimeout(() => {
80
- R((t) => t?.key === e.key ? null : t), z.current = null;
79
+ let H = (e) => {
80
+ B.current && clearTimeout(B.current), z(e), B.current = setTimeout(() => {
81
+ z((t) => t?.key === e.key ? null : t), B.current = null;
81
82
  }, 2500);
82
- }, H = l(() => {
83
- if (!N.trim()) return E;
84
- let e = N.toLowerCase();
85
- return E.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
86
- }, [N, E]), U = async (e) => {
87
- let t = x(e), n = O.get(t), r = !(n?.enabled ?? !0);
88
- I(t), a("medium");
83
+ }, U = l(() => {
84
+ if (!P.trim()) return D;
85
+ let e = P.toLowerCase();
86
+ return D.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
87
+ }, [P, D]), W = async (e) => {
88
+ let t = S(e), n = k.get(t), r = !(n?.enabled ?? !0);
89
+ L(t), a("medium");
89
90
  try {
90
- await A({
91
+ await j({
91
92
  ...e,
92
93
  enabled: r,
93
94
  frequency: n?.frequency || "IMMEDIATE"
94
- }), M({
95
+ }), N({
95
96
  action: "set",
96
97
  scope: e.scope,
97
98
  channel: e.channel,
98
99
  type: e.type,
99
100
  enabled: r
100
- }), V({
101
+ }), H({
101
102
  key: t,
102
103
  type: "success",
103
- message: S("notifications.preferenceSaved", "Preference saved.")
104
+ message: C("notifications.preferenceSaved", "Preference saved.")
104
105
  }), o("success");
105
106
  } catch {
106
- V({
107
+ H({
107
108
  key: t,
108
109
  type: "error",
109
- message: S("notifications.preferenceSaveFailed", "Could not save preference.")
110
+ message: C("notifications.preferenceSaveFailed", "Could not save preference.")
110
111
  }), o("error");
111
112
  } finally {
112
- I(null);
113
+ L(null);
113
114
  }
114
- }, W = async (e) => {
115
- let t = O.get(e);
115
+ }, G = async (e) => {
116
+ let t = k.get(e);
116
117
  if (t) {
117
- I(e);
118
+ L(e);
118
119
  try {
119
- await j(t.id), M({
120
+ await M(t.id), N({
120
121
  action: "reset",
121
122
  scope: t.scope,
122
123
  channel: t.channel,
123
124
  type: t.type
124
- }), V({
125
+ }), H({
125
126
  key: e,
126
127
  type: "success",
127
- message: S("notifications.preferenceReset", "Preference reset.")
128
+ message: C("notifications.preferenceReset", "Preference reset.")
128
129
  });
129
130
  } catch {
130
- V({
131
+ H({
131
132
  key: e,
132
133
  type: "error",
133
- message: S("notifications.preferenceResetFailed", "Could not reset preference.")
134
+ message: C("notifications.preferenceResetFailed", "Could not reset preference.")
134
135
  });
135
136
  } finally {
136
- I(null);
137
+ L(null);
137
138
  }
138
139
  }
139
- }, G = (e) => {
140
- let t = O.get(e.key), n = t?.enabled ?? !0, r = F === e.key, i = L?.key === e.key ? L : null;
140
+ }, K = (e) => {
141
+ let t = k.get(e.key), n = t?.enabled ?? !0, r = I === e.key, i = R?.key === e.key ? R : null;
141
142
  return /* @__PURE__ */ v("div", {
142
143
  className: "rounded-lg border border-default bg-surface p-4 shadow-sm",
143
144
  children: [/* @__PURE__ */ v("div", {
@@ -169,21 +170,21 @@ function S() {
169
170
  children: [t && /* @__PURE__ */ _("button", {
170
171
  type: "button",
171
172
  disabled: r,
172
- onClick: () => W(e.key),
173
+ onClick: () => G(e.key),
173
174
  className: "rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
174
- children: S("notifications.reset", "Reset")
175
+ children: C("notifications.reset", "Reset")
175
176
  }), /* @__PURE__ */ v("button", {
176
177
  type: "button",
177
178
  "aria-pressed": n,
178
179
  disabled: r,
179
- onClick: () => U({
180
+ onClick: () => W({
180
181
  scope: e.scope,
181
182
  channel: e.channel,
182
183
  type: e.type,
183
184
  topicId: e.topicId
184
185
  }),
185
186
  className: `inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${n ? "border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90" : "border-default bg-muted text-secondary hover:bg-muted/80"} disabled:cursor-not-allowed disabled:opacity-50`,
186
- children: [_(n ? h : m, { size: 18 }), r ? S("notifications.saving", "Saving...") : n ? S("notifications.enabled", "Enabled") : S("notifications.disabled", "Disabled")]
187
+ children: [_(n ? h : m, { size: 18 }), r ? C("notifications.saving", "Saving...") : n ? C("notifications.enabled", "Enabled") : C("notifications.disabled", "Disabled")]
187
188
  })]
188
189
  })]
189
190
  }), /* @__PURE__ */ _("div", {
@@ -196,68 +197,71 @@ function S() {
196
197
  })]
197
198
  }, e.key);
198
199
  };
199
- return w ? /* @__PURE__ */ _("div", {
200
+ return T ? /* @__PURE__ */ _("div", {
200
201
  className: "flex h-64 items-center justify-center",
201
202
  children: /* @__PURE__ */ _("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
202
- }) : !C(s.NOTIFICATION_LIST) && !T?.id ? /* @__PURE__ */ _("div", {
203
+ }) : !w(s.NOTIFICATION_LIST) && !E?.id ? /* @__PURE__ */ _("div", {
203
204
  className: "p-8 text-center text-text-secondary",
204
- children: S("notifications.noPermissionPreferences", "You don't have permission to manage notification preferences.")
205
+ children: C("notifications.noPermissionPreferences", "You don't have permission to manage notification preferences.")
205
206
  }) : /* @__PURE__ */ v("div", {
206
207
  "data-tour": "notification-preferences-page",
207
208
  className: "space-y-6 p-4 sm:p-6",
208
209
  children: [
209
210
  /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("h1", {
210
211
  className: "text-2xl font-bold text-primary",
211
- children: S("notifications.preferencesTitle", "Notification Preferences")
212
+ children: C("notifications.preferencesTitle", "Notification Preferences")
212
213
  }), /* @__PURE__ */ _("p", {
213
214
  className: "mt-1 text-sm text-secondary",
214
- children: S("notifications.preferencesSubtitle", "Control global, channel, type, and topic-level notification delivery.")
215
+ children: C("notifications.preferencesSubtitle", "Control global, channel, type, and topic-level notification delivery.")
215
216
  })] }),
216
217
  /* @__PURE__ */ v("section", {
217
218
  "data-tour": "notification-preferences-global",
218
219
  className: "space-y-3",
219
220
  children: [/* @__PURE__ */ _("h2", {
220
221
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
221
- children: S("notifications.globalPreferences", "Global")
222
- }), G({
222
+ children: C("notifications.globalPreferences", "Global")
223
+ }), K({
223
224
  key: "GLOBAL",
224
225
  scope: "GLOBAL",
225
- title: S("notifications.allNotifications", "All notifications"),
226
- description: S("notifications.allNotificationsDescription", "Master preference for notification delivery across all channels and types.")
226
+ title: C("notifications.allNotifications", "All notifications"),
227
+ description: C("notifications.allNotificationsDescription", "Master preference for notification delivery across all channels and types.")
227
228
  })]
228
229
  }),
229
- /* @__PURE__ */ v("section", {
230
- "data-tour": "notification-preferences-channels",
231
- className: "space-y-3",
232
- children: [/* @__PURE__ */ _("h2", {
233
- className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
234
- children: S("notifications.channelPreferences", "Channels")
235
- }), /* @__PURE__ */ _("div", {
236
- className: "grid gap-3 lg:grid-cols-2",
237
- children: y.map((e) => G({
238
- key: `CHANNEL:${e.value}`,
239
- scope: "CHANNEL",
240
- channel: e.value,
241
- title: S(e.labelKey, e.label),
242
- description: S("notifications.channelPreferenceDescription", "Control delivery for this channel.")
243
- }))
244
- })]
245
- }),
246
- /* @__PURE__ */ v("section", {
247
- "data-tour": "notification-preferences-types",
248
- className: "space-y-3",
249
- children: [/* @__PURE__ */ _("h2", {
250
- className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
251
- children: S("notifications.typePreferences", "Notification Types")
252
- }), /* @__PURE__ */ _("div", {
253
- className: "grid gap-3 lg:grid-cols-2",
254
- children: b.map((e) => G({
255
- key: `TYPE:${e.value}`,
256
- scope: "TYPE",
257
- type: e.value,
258
- title: S(e.labelKey, e.label),
259
- description: S("notifications.typePreferenceDescription", "Control delivery for this notification type.")
260
- }))
230
+ /* @__PURE__ */ v(y, {
231
+ title: C("notifications.advancedPreferences", "Advanced settings"),
232
+ description: C("notifications.advancedPreferencesDescription", "Per-channel filter rules, notification-type filters, and quiet-hour overrides."),
233
+ children: [/* @__PURE__ */ v("section", {
234
+ "data-tour": "notification-preferences-channels",
235
+ className: "space-y-3",
236
+ children: [/* @__PURE__ */ _("h2", {
237
+ className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
238
+ children: C("notifications.channelPreferences", "Channels")
239
+ }), /* @__PURE__ */ _("div", {
240
+ className: "grid gap-3 lg:grid-cols-2",
241
+ children: b.map((e) => K({
242
+ key: `CHANNEL:${e.value}`,
243
+ scope: "CHANNEL",
244
+ channel: e.value,
245
+ title: C(e.labelKey, e.label),
246
+ description: C("notifications.channelPreferenceDescription", "Control delivery for this channel.")
247
+ }))
248
+ })]
249
+ }), /* @__PURE__ */ v("section", {
250
+ "data-tour": "notification-preferences-types",
251
+ className: "mt-6 space-y-3",
252
+ children: [/* @__PURE__ */ _("h2", {
253
+ className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
254
+ children: C("notifications.typePreferences", "Notification Types")
255
+ }), /* @__PURE__ */ _("div", {
256
+ className: "grid gap-3 lg:grid-cols-2",
257
+ children: x.map((e) => K({
258
+ key: `TYPE:${e.value}`,
259
+ scope: "TYPE",
260
+ type: e.value,
261
+ title: C(e.labelKey, e.label),
262
+ description: C("notifications.typePreferenceDescription", "Control delivery for this notification type.")
263
+ }))
264
+ })]
261
265
  })]
262
266
  }),
263
267
  /* @__PURE__ */ v("div", {
@@ -267,10 +271,10 @@ function S() {
267
271
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
268
272
  }), /* @__PURE__ */ _("input", {
269
273
  type: "text",
270
- value: N,
271
- onChange: (e) => P(e.target.value),
272
- "aria-label": S("notifications.searchTopics", "Search topics..."),
273
- placeholder: S("notifications.searchTopics", "Search topics..."),
274
+ value: P,
275
+ onChange: (e) => F(e.target.value),
276
+ "aria-label": C("notifications.searchTopics", "Search topics..."),
277
+ placeholder: C("notifications.searchTopics", "Search topics..."),
274
278
  className: "w-full rounded-lg border border-default bg-surface py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent"
275
279
  })]
276
280
  }),
@@ -279,14 +283,14 @@ function S() {
279
283
  className: "space-y-3",
280
284
  children: [/* @__PURE__ */ _("h2", {
281
285
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
282
- children: S("notifications.topicPreferences", "Topics")
283
- }), B ? /* @__PURE__ */ _("div", {
286
+ children: C("notifications.topicPreferences", "Topics")
287
+ }), V ? /* @__PURE__ */ _("div", {
284
288
  className: "rounded-lg border border-default bg-surface p-6 text-sm text-secondary",
285
- children: S("notifications.loadingPreferences", "Loading preferences...")
286
- }) : H.length === 0 ? /* @__PURE__ */ _("div", {
289
+ children: C("notifications.loadingPreferences", "Loading preferences...")
290
+ }) : U.length === 0 ? /* @__PURE__ */ _("div", {
287
291
  className: "rounded-lg border border-default bg-surface p-6 text-sm text-secondary",
288
- children: S("notifications.noTopicsFound", "No promotional topics available right now.")
289
- }) : H.map((e) => G({
292
+ children: C("notifications.noTopicsFound", "No promotional topics available right now.")
293
+ }) : U.map((e) => K({
290
294
  key: `TOPIC:${e.id}`,
291
295
  scope: "TOPIC",
292
296
  topicId: e.id,
@@ -298,6 +302,6 @@ function S() {
298
302
  });
299
303
  }
300
304
  //#endregion
301
- export { S as NotificationPreferencesPage };
305
+ export { C as NotificationPreferencesPage };
302
306
 
303
307
  //# sourceMappingURL=NotificationPreferencesPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationPreferencesPage.js","names":[],"sources":["../../src/pages/NotificationPreferencesPage.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\nimport { BellRing, Search, ToggleLeft, ToggleRight } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useNotificationPreferences, useNotificationTopics } from '../hooks';\nimport { useNotificationAnalytics } from '../hooks/useNotificationAnalytics';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationChannel, NotificationPreferenceScope, NotificationType } from '../types';\nimport { nativeImpact, nativeNotify } from '../utils/nativeBridge';\n\nconst CHANNEL_OPTIONS: Array<{ value: NotificationChannel; labelKey: string; label: string }> = [\n { value: 'IN_APP', labelKey: 'notifications.channelInApp', label: 'In-app' },\n { value: 'EMAIL', labelKey: 'notifications.channelEmail', label: 'Email' },\n { value: 'PUSH', labelKey: 'notifications.channelPush', label: 'Push' },\n { value: 'SMS', labelKey: 'notifications.channelSms', label: 'SMS' },\n { value: 'WHATSAPP', labelKey: 'notifications.channelWhatsapp', label: 'WhatsApp' },\n { value: 'SLACK', labelKey: 'notifications.channelSlack', label: 'Slack' },\n];\n\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alerts' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\n\nfunction preferenceKey(input: {\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n}) {\n if (input.scope === 'CHANNEL') return `CHANNEL:${input.channel || ''}`;\n if (input.scope === 'TYPE') return `TYPE:${input.type || ''}`;\n if (input.scope === 'TOPIC') return `TOPIC:${input.topicId || ''}`;\n return 'GLOBAL';\n}\n\nexport function NotificationPreferencesPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics, isLoading: topicsLoading } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const {\n preferencesByKey,\n isLoading: preferencesLoading,\n setPreference,\n deletePreference,\n } = useNotificationPreferences();\n const { trackPreferenceUpdated } = useNotificationAnalytics();\n const [search, setSearch] = useState('');\n const [savingKey, setSavingKey] = useState<string | null>(null);\n const [saveFeedback, setSaveFeedback] = useState<{\n key: string;\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const feedbackTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const isLoading = topicsLoading || preferencesLoading;\n\n useEffect(() => {\n return () => {\n if (feedbackTimerRef.current) {\n clearTimeout(feedbackTimerRef.current);\n }\n };\n }, []);\n\n const showSaveFeedback = (feedback: {\n key: string;\n type: 'success' | 'error';\n message: string;\n }) => {\n if (feedbackTimerRef.current) {\n clearTimeout(feedbackTimerRef.current);\n }\n\n setSaveFeedback(feedback);\n feedbackTimerRef.current = setTimeout(() => {\n setSaveFeedback((current) => (current?.key === feedback.key ? null : current));\n feedbackTimerRef.current = null;\n }, 2500);\n };\n\n const filteredTopics = useMemo(() => {\n if (!search.trim()) {\n return topics;\n }\n\n const query = search.toLowerCase();\n return topics.filter(\n (topic) =>\n topic.name.toLowerCase().includes(query) ||\n topic.slug.toLowerCase().includes(query) ||\n topic.description?.toLowerCase().includes(query)\n );\n }, [search, topics]);\n\n const togglePreference = async (input: {\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const key = preferenceKey(input);\n const existing = preferencesByKey.get(key);\n const nextEnabled = !(existing?.enabled ?? true);\n setSavingKey(key);\n nativeImpact('medium');\n try {\n await setPreference({\n ...input,\n enabled: nextEnabled,\n frequency: existing?.frequency || 'IMMEDIATE',\n });\n trackPreferenceUpdated({\n action: 'set',\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n enabled: nextEnabled,\n });\n showSaveFeedback({\n key,\n type: 'success',\n message: tr('notifications.preferenceSaved', 'Preference saved.'),\n });\n void nativeNotify('success');\n } catch {\n showSaveFeedback({\n key,\n type: 'error',\n message: tr('notifications.preferenceSaveFailed', 'Could not save preference.'),\n });\n void nativeNotify('error');\n } finally {\n setSavingKey(null);\n }\n };\n\n const resetPreference = async (key: string) => {\n const existing = preferencesByKey.get(key);\n if (!existing) return;\n setSavingKey(key);\n try {\n await deletePreference(existing.id);\n trackPreferenceUpdated({\n action: 'reset',\n scope: existing.scope,\n channel: existing.channel,\n type: existing.type,\n });\n showSaveFeedback({\n key,\n type: 'success',\n message: tr('notifications.preferenceReset', 'Preference reset.'),\n });\n } catch {\n showSaveFeedback({\n key,\n type: 'error',\n message: tr('notifications.preferenceResetFailed', 'Could not reset preference.'),\n });\n } finally {\n setSavingKey(null);\n }\n };\n\n const renderPreferenceRow = (input: {\n key: string;\n title: string;\n description: string;\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const existing = preferencesByKey.get(input.key);\n const isEnabled = existing?.enabled ?? true;\n const isSaving = savingKey === input.key;\n const feedback = saveFeedback?.key === input.key ? saveFeedback : null;\n\n return (\n <div key={input.key} className=\"rounded-lg border border-default bg-surface p-4 shadow-sm\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"space-y-1\">\n <div className=\"flex items-center gap-2\">\n <BellRing size={16} className=\"text-accent-primary\" />\n <h2 className=\"text-sm font-semibold text-primary\">{input.title}</h2>\n {existing && (\n <span className=\"rounded-full bg-muted px-2 py-0.5 text-xs text-secondary\">\n {existing.frequency.replace('_', ' ').toLowerCase()}\n </span>\n )}\n </div>\n <p className=\"text-sm text-secondary\">{input.description}</p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {existing && (\n <button\n type=\"button\"\n disabled={isSaving}\n onClick={() => resetPreference(input.key)}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50\"\n >\n {tr('notifications.reset', 'Reset')}\n </button>\n )}\n <button\n type=\"button\"\n aria-pressed={isEnabled}\n disabled={isSaving}\n onClick={() =>\n togglePreference({\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n topicId: input.topicId,\n })\n }\n className={`inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${\n isEnabled\n ? 'border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90'\n : 'border-default bg-muted text-secondary hover:bg-muted/80'\n } disabled:cursor-not-allowed disabled:opacity-50`}\n >\n {isEnabled ? <ToggleRight size={18} /> : <ToggleLeft size={18} />}\n {isSaving\n ? tr('notifications.saving', 'Saving...')\n : isEnabled\n ? tr('notifications.enabled', 'Enabled')\n : tr('notifications.disabled', 'Disabled')}\n </button>\n </div>\n </div>\n <div className=\"mt-3 min-h-5\" aria-live=\"polite\">\n {feedback && (\n <p className={`text-xs ${feedback.type === 'success' ? 'text-success' : 'text-error'}`}>\n {feedback.message}\n </p>\n )}\n </div>\n </div>\n );\n };\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionPreferences',\n \"You don't have permission to manage notification preferences.\"\n )}\n </div>\n );\n }\n\n return (\n <div data-tour=\"notification-preferences-page\" className=\"space-y-6 p-4 sm:p-6\">\n <div>\n <h1 className=\"text-2xl font-bold text-primary\">\n {tr('notifications.preferencesTitle', 'Notification Preferences')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.preferencesSubtitle',\n 'Control global, channel, type, and topic-level notification delivery.'\n )}\n </p>\n </div>\n\n <section data-tour=\"notification-preferences-global\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.globalPreferences', 'Global')}\n </h2>\n {renderPreferenceRow({\n key: 'GLOBAL',\n scope: 'GLOBAL',\n title: tr('notifications.allNotifications', 'All notifications'),\n description: tr(\n 'notifications.allNotificationsDescription',\n 'Master preference for notification delivery across all channels and types.'\n ),\n })}\n </section>\n\n <section data-tour=\"notification-preferences-channels\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.channelPreferences', 'Channels')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {CHANNEL_OPTIONS.map((channel) =>\n renderPreferenceRow({\n key: `CHANNEL:${channel.value}`,\n scope: 'CHANNEL',\n channel: channel.value,\n title: tr(channel.labelKey, channel.label),\n description: tr(\n 'notifications.channelPreferenceDescription',\n 'Control delivery for this channel.'\n ),\n })\n )}\n </div>\n </section>\n\n <section data-tour=\"notification-preferences-types\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.typePreferences', 'Notification Types')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {TYPE_OPTIONS.map((type) =>\n renderPreferenceRow({\n key: `TYPE:${type.value}`,\n scope: 'TYPE',\n type: type.value,\n title: tr(type.labelKey, type.label),\n description: tr(\n 'notifications.typePreferenceDescription',\n 'Control delivery for this notification type.'\n ),\n })\n )}\n </div>\n </section>\n\n <div className=\"relative max-w-xl\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={search}\n onChange={(event) => setSearch(event.target.value)}\n aria-label={tr('notifications.searchTopics', 'Search topics...')}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n className=\"w-full rounded-lg border border-default bg-surface py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </div>\n\n <section data-tour=\"notification-preferences-topics\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.topicPreferences', 'Topics')}\n </h2>\n {isLoading ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.loadingPreferences', 'Loading preferences...')}\n </div>\n ) : filteredTopics.length === 0 ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.noTopicsFound', 'No promotional topics available right now.')}\n </div>\n ) : (\n filteredTopics.map((topic) =>\n renderPreferenceRow({\n key: `TOPIC:${topic.id}`,\n scope: 'TOPIC',\n topicId: topic.id,\n title: topic.name,\n description: topic.description || topic.slug,\n })\n )\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAM,IAA0F;CAC9F;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1C,aAAa,EACX,8CACA,qCACD;MACF,CAAC,CACH;KACG,CAAA,CACE;;GAEV,kBAAC,WAAD;IAAS,aAAU;IAAiC,WAAU;cAA9D,CACE,kBAAC,MAAD;KAAI,WAAU;eACX,EAAG,iCAAiC,qBAAqB;KACvD,CAAA,EACL,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAa,KAAK,MACjB,EAAoB;MAClB,KAAK,QAAQ,EAAK;MAClB,OAAO;MACP,MAAM,EAAK;MACX,OAAO,EAAG,EAAK,UAAU,EAAK,MAAM;MACpC,aAAa,EACX,2CACA,+CACD;MACF,CAAC,CACH;KACG,CAAA,CACE;;GAEV,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAQ,MAAM;KAAI,WAAU;KAA2D,CAAA,EACvF,kBAAC,SAAD;KACE,MAAK;KACL,OAAO;KACP,WAAW,MAAU,EAAU,EAAM,OAAO,MAAM;KAClD,cAAY,EAAG,8BAA8B,mBAAmB;KAChE,aAAa,EAAG,8BAA8B,mBAAmB;KACjE,WAAU;KACV,CAAA,CACE;;GAEN,kBAAC,WAAD;IAAS,aAAU;IAAkC,WAAU;cAA/D,CACE,kBAAC,MAAD;KAAI,WAAU;eACX,EAAG,kCAAkC,SAAS;KAC5C,CAAA,EACJ,IACC,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,oCAAoC,yBAAyB;KAC7D,CAAA,GACJ,EAAe,WAAW,IAC5B,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,+BAA+B,6CAA6C;KAC5E,CAAA,GAEN,EAAe,KAAK,MAClB,EAAoB;KAClB,KAAK,SAAS,EAAM;KACpB,OAAO;KACP,SAAS,EAAM;KACf,OAAO,EAAM;KACb,aAAa,EAAM,eAAe,EAAM;KACzC,CAAC,CACH,CAEK;;GACN"}
1
+ {"version":3,"file":"NotificationPreferencesPage.js","names":[],"sources":["../../src/pages/NotificationPreferencesPage.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\nimport { BellRing, Search, ToggleLeft, ToggleRight } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { OptionalFields } from '@burdenoff/fe-libs/ui';\nimport { useNotificationPreferences, useNotificationTopics } from '../hooks';\nimport { useNotificationAnalytics } from '../hooks/useNotificationAnalytics';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationChannel, NotificationPreferenceScope, NotificationType } from '../types';\nimport { nativeImpact, nativeNotify } from '../utils/nativeBridge';\n\nconst CHANNEL_OPTIONS: Array<{ value: NotificationChannel; labelKey: string; label: string }> = [\n { value: 'IN_APP', labelKey: 'notifications.channelInApp', label: 'In-app' },\n { value: 'EMAIL', labelKey: 'notifications.channelEmail', label: 'Email' },\n { value: 'PUSH', labelKey: 'notifications.channelPush', label: 'Push' },\n { value: 'SMS', labelKey: 'notifications.channelSms', label: 'SMS' },\n { value: 'WHATSAPP', labelKey: 'notifications.channelWhatsapp', label: 'WhatsApp' },\n { value: 'SLACK', labelKey: 'notifications.channelSlack', label: 'Slack' },\n];\n\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alerts' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\n\nfunction preferenceKey(input: {\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n}) {\n if (input.scope === 'CHANNEL') return `CHANNEL:${input.channel || ''}`;\n if (input.scope === 'TYPE') return `TYPE:${input.type || ''}`;\n if (input.scope === 'TOPIC') return `TOPIC:${input.topicId || ''}`;\n return 'GLOBAL';\n}\n\nexport function NotificationPreferencesPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics, isLoading: topicsLoading } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const {\n preferencesByKey,\n isLoading: preferencesLoading,\n setPreference,\n deletePreference,\n } = useNotificationPreferences();\n const { trackPreferenceUpdated } = useNotificationAnalytics();\n const [search, setSearch] = useState('');\n const [savingKey, setSavingKey] = useState<string | null>(null);\n const [saveFeedback, setSaveFeedback] = useState<{\n key: string;\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const feedbackTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const isLoading = topicsLoading || preferencesLoading;\n\n useEffect(() => {\n return () => {\n if (feedbackTimerRef.current) {\n clearTimeout(feedbackTimerRef.current);\n }\n };\n }, []);\n\n const showSaveFeedback = (feedback: {\n key: string;\n type: 'success' | 'error';\n message: string;\n }) => {\n if (feedbackTimerRef.current) {\n clearTimeout(feedbackTimerRef.current);\n }\n\n setSaveFeedback(feedback);\n feedbackTimerRef.current = setTimeout(() => {\n setSaveFeedback((current) => (current?.key === feedback.key ? null : current));\n feedbackTimerRef.current = null;\n }, 2500);\n };\n\n const filteredTopics = useMemo(() => {\n if (!search.trim()) {\n return topics;\n }\n\n const query = search.toLowerCase();\n return topics.filter(\n (topic) =>\n topic.name.toLowerCase().includes(query) ||\n topic.slug.toLowerCase().includes(query) ||\n topic.description?.toLowerCase().includes(query)\n );\n }, [search, topics]);\n\n const togglePreference = async (input: {\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const key = preferenceKey(input);\n const existing = preferencesByKey.get(key);\n const nextEnabled = !(existing?.enabled ?? true);\n setSavingKey(key);\n nativeImpact('medium');\n try {\n await setPreference({\n ...input,\n enabled: nextEnabled,\n frequency: existing?.frequency || 'IMMEDIATE',\n });\n trackPreferenceUpdated({\n action: 'set',\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n enabled: nextEnabled,\n });\n showSaveFeedback({\n key,\n type: 'success',\n message: tr('notifications.preferenceSaved', 'Preference saved.'),\n });\n void nativeNotify('success');\n } catch {\n showSaveFeedback({\n key,\n type: 'error',\n message: tr('notifications.preferenceSaveFailed', 'Could not save preference.'),\n });\n void nativeNotify('error');\n } finally {\n setSavingKey(null);\n }\n };\n\n const resetPreference = async (key: string) => {\n const existing = preferencesByKey.get(key);\n if (!existing) return;\n setSavingKey(key);\n try {\n await deletePreference(existing.id);\n trackPreferenceUpdated({\n action: 'reset',\n scope: existing.scope,\n channel: existing.channel,\n type: existing.type,\n });\n showSaveFeedback({\n key,\n type: 'success',\n message: tr('notifications.preferenceReset', 'Preference reset.'),\n });\n } catch {\n showSaveFeedback({\n key,\n type: 'error',\n message: tr('notifications.preferenceResetFailed', 'Could not reset preference.'),\n });\n } finally {\n setSavingKey(null);\n }\n };\n\n const renderPreferenceRow = (input: {\n key: string;\n title: string;\n description: string;\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const existing = preferencesByKey.get(input.key);\n const isEnabled = existing?.enabled ?? true;\n const isSaving = savingKey === input.key;\n const feedback = saveFeedback?.key === input.key ? saveFeedback : null;\n\n return (\n <div key={input.key} className=\"rounded-lg border border-default bg-surface p-4 shadow-sm\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"space-y-1\">\n <div className=\"flex items-center gap-2\">\n <BellRing size={16} className=\"text-accent-primary\" />\n <h2 className=\"text-sm font-semibold text-primary\">{input.title}</h2>\n {existing && (\n <span className=\"rounded-full bg-muted px-2 py-0.5 text-xs text-secondary\">\n {existing.frequency.replace('_', ' ').toLowerCase()}\n </span>\n )}\n </div>\n <p className=\"text-sm text-secondary\">{input.description}</p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {existing && (\n <button\n type=\"button\"\n disabled={isSaving}\n onClick={() => resetPreference(input.key)}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50\"\n >\n {tr('notifications.reset', 'Reset')}\n </button>\n )}\n <button\n type=\"button\"\n aria-pressed={isEnabled}\n disabled={isSaving}\n onClick={() =>\n togglePreference({\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n topicId: input.topicId,\n })\n }\n className={`inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${\n isEnabled\n ? 'border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90'\n : 'border-default bg-muted text-secondary hover:bg-muted/80'\n } disabled:cursor-not-allowed disabled:opacity-50`}\n >\n {isEnabled ? <ToggleRight size={18} /> : <ToggleLeft size={18} />}\n {isSaving\n ? tr('notifications.saving', 'Saving...')\n : isEnabled\n ? tr('notifications.enabled', 'Enabled')\n : tr('notifications.disabled', 'Disabled')}\n </button>\n </div>\n </div>\n <div className=\"mt-3 min-h-5\" aria-live=\"polite\">\n {feedback && (\n <p className={`text-xs ${feedback.type === 'success' ? 'text-success' : 'text-error'}`}>\n {feedback.message}\n </p>\n )}\n </div>\n </div>\n );\n };\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionPreferences',\n \"You don't have permission to manage notification preferences.\"\n )}\n </div>\n );\n }\n\n return (\n <div data-tour=\"notification-preferences-page\" className=\"space-y-6 p-4 sm:p-6\">\n <div>\n <h1 className=\"text-2xl font-bold text-primary\">\n {tr('notifications.preferencesTitle', 'Notification Preferences')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.preferencesSubtitle',\n 'Control global, channel, type, and topic-level notification delivery.'\n )}\n </p>\n </div>\n\n <section data-tour=\"notification-preferences-global\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.globalPreferences', 'Global')}\n </h2>\n {renderPreferenceRow({\n key: 'GLOBAL',\n scope: 'GLOBAL',\n title: tr('notifications.allNotifications', 'All notifications'),\n description: tr(\n 'notifications.allNotificationsDescription',\n 'Master preference for notification delivery across all channels and types.'\n ),\n })}\n </section>\n\n {/* Advanced: per-channel filter rules / quiet hours / custom templates — collapse the long-tail knobs */}\n <OptionalFields\n title={tr('notifications.advancedPreferences', 'Advanced settings')}\n description={tr(\n 'notifications.advancedPreferencesDescription',\n 'Per-channel filter rules, notification-type filters, and quiet-hour overrides.'\n )}\n >\n <section data-tour=\"notification-preferences-channels\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.channelPreferences', 'Channels')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {CHANNEL_OPTIONS.map((channel) =>\n renderPreferenceRow({\n key: `CHANNEL:${channel.value}`,\n scope: 'CHANNEL',\n channel: channel.value,\n title: tr(channel.labelKey, channel.label),\n description: tr(\n 'notifications.channelPreferenceDescription',\n 'Control delivery for this channel.'\n ),\n })\n )}\n </div>\n </section>\n\n <section data-tour=\"notification-preferences-types\" className=\"mt-6 space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.typePreferences', 'Notification Types')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {TYPE_OPTIONS.map((type) =>\n renderPreferenceRow({\n key: `TYPE:${type.value}`,\n scope: 'TYPE',\n type: type.value,\n title: tr(type.labelKey, type.label),\n description: tr(\n 'notifications.typePreferenceDescription',\n 'Control delivery for this notification type.'\n ),\n })\n )}\n </div>\n </section>\n </OptionalFields>\n\n <div className=\"relative max-w-xl\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={search}\n onChange={(event) => setSearch(event.target.value)}\n aria-label={tr('notifications.searchTopics', 'Search topics...')}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n className=\"w-full rounded-lg border border-default bg-surface py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </div>\n\n <section data-tour=\"notification-preferences-topics\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.topicPreferences', 'Topics')}\n </h2>\n {isLoading ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.loadingPreferences', 'Loading preferences...')}\n </div>\n ) : filteredTopics.length === 0 ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.noTopicsFound', 'No promotional topics available right now.')}\n </div>\n ) : (\n filteredTopics.map((topic) =>\n renderPreferenceRow({\n key: `TOPIC:${topic.id}`,\n scope: 'TOPIC',\n topicId: topic.id,\n title: topic.name,\n description: topic.description || topic.slug,\n })\n )\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,IAAM,IAA0F;CAC9F;EAAE,OAAO;EAAU,UAAU;EAA8B,OAAO;EAAU;CAC5E;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;EAAS;CAC1E;EAAE,OAAO;EAAQ,UAAU;EAA6B,OAAO;EAAQ;CACvE;EAAE,OAAO;EAAO,UAAU;EAA4B,OAAO;EAAO;CACpE;EAAE,OAAO;EAAY,UAAU;EAAiC,OAAO;EAAY;CACnF;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;EAAS;CAC3E,EAEK,IAAoF;CACxF;EAAE,OAAO;EAAiB,UAAU;EAAmC,OAAO;EAAiB;CAC/F;EAAE,OAAO;EAAU,UAAU;EAA4B,OAAO;EAAU;CAC1E;EAAE,OAAO;EAAS,UAAU;EAA2B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;OACF,CAAC,CACH;MACG,CAAA,CACE;OACK;;GAEjB,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAQ,MAAM;KAAI,WAAU;KAA2D,CAAA,EACvF,kBAAC,SAAD;KACE,MAAK;KACL,OAAO;KACP,WAAW,MAAU,EAAU,EAAM,OAAO,MAAM;KAClD,cAAY,EAAG,8BAA8B,mBAAmB;KAChE,aAAa,EAAG,8BAA8B,mBAAmB;KACjE,WAAU;KACV,CAAA,CACE;;GAEN,kBAAC,WAAD;IAAS,aAAU;IAAkC,WAAU;cAA/D,CACE,kBAAC,MAAD;KAAI,WAAU;eACX,EAAG,kCAAkC,SAAS;KAC5C,CAAA,EACJ,IACC,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,oCAAoC,yBAAyB;KAC7D,CAAA,GACJ,EAAe,WAAW,IAC5B,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,+BAA+B,6CAA6C;KAC5E,CAAA,GAEN,EAAe,KAAK,MAClB,EAAoB;KAClB,KAAK,SAAS,EAAM;KACpB,OAAO;KACP,SAAS,EAAM;KACf,OAAO,EAAM;KACb,aAAa,EAAM,eAAe,EAAM;KACzC,CAAC,CACH,CAEK;;GACN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-notification",
3
- "version": "2026.527.1",
3
+ "version": "2026.529.1",
4
4
  "description": "Notification microfrontend for multi-channel notification management",
5
5
  "type": "module",
6
6
  "imports": {
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@apollo/client": "^4.0.9",
52
- "@burdenoff/fe-libs": "2026.518.7",
52
+ "@burdenoff/fe-libs": "2026.529.1",
53
53
  "@types/lodash-es": "^4.17.12",
54
54
  "graphql": "^16.12.0",
55
55
  "graphql-ws": "^6.0.6",