@burdenoff/microfe-notification 2026.1123.1 → 2026.1125.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 (40) hide show
  1. package/dist/AdminNotificationRoutes.js +59 -51
  2. package/dist/AdminNotificationRoutes.js.map +1 -1
  3. package/dist/NotificationRoutes.js +76 -68
  4. package/dist/NotificationRoutes.js.map +1 -1
  5. package/dist/UserNotificationRoutes.js +39 -31
  6. package/dist/UserNotificationRoutes.js.map +1 -1
  7. package/dist/components/NotificationListFooter.js +1 -1
  8. package/dist/components/NotificationListFooter.js.map +1 -1
  9. package/dist/components/loadingSystem.d.ts +64 -0
  10. package/dist/components/loadingSystem.js +34 -0
  11. package/dist/components/loadingSystem.js.map +1 -0
  12. package/dist/navigation-v2/AdminPageV2.js +23 -16
  13. package/dist/navigation-v2/AdminPageV2.js.map +1 -1
  14. package/dist/navigation-v2/NotificationArchivedV2.js +100 -93
  15. package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
  16. package/dist/navigation-v2/NotificationInboxV2.js +130 -123
  17. package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
  18. package/dist/navigation-v2/NotificationSettingsV2.js +91 -84
  19. package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -1
  20. package/dist/navigation-v2/NotificationsV2Landing.js +31 -23
  21. package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -1
  22. package/dist/pages/CreateNotificationPage.js +442 -432
  23. package/dist/pages/CreateNotificationPage.js.map +1 -1
  24. package/dist/pages/NotificationCenterPage.js +91 -84
  25. package/dist/pages/NotificationCenterPage.js.map +1 -1
  26. package/dist/pages/NotificationHistoryAdminPage.js +226 -219
  27. package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
  28. package/dist/pages/NotificationHistoryPage.js +69 -62
  29. package/dist/pages/NotificationHistoryPage.js.map +1 -1
  30. package/dist/pages/NotificationLandingPage.js +42 -34
  31. package/dist/pages/NotificationLandingPage.js.map +1 -1
  32. package/dist/pages/NotificationPreferencesPage.js +80 -70
  33. package/dist/pages/NotificationPreferencesPage.js.map +1 -1
  34. package/dist/pages/NotificationTemplatesPage.js +192 -181
  35. package/dist/pages/NotificationTemplatesPage.js.map +1 -1
  36. package/dist/pages/NotificationTopicsPage.js +124 -117
  37. package/dist/pages/NotificationTopicsPage.js.map +1 -1
  38. package/dist/pages/TemplateEditorPage.js +248 -233
  39. package/dist/pages/TemplateEditorPage.js.map +1 -1
  40. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationLandingPage.js","names":["NotificationHistoryAdminPage","lazy","m","NotificationTemplatesPage","CreateNotificationPage","NotificationTopicsPage","TabBodyLoader","NotificationLandingPage","params","setParams","useSearchParams","tr","useTr","templatesDetails","useFeatureFlagDetails","createDetails","historyDetails","templatesEnabled","createEnabled","historyEnabled","tabs","useMemo","rawTab","activeId","t","useEffect","next","prev","Tabs","id","NotificationCenterPage","Suspense"],"sources":["../../src/pages/NotificationLandingPage.tsx"],"sourcesContent":["import { Suspense, lazy, useEffect, useMemo } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { Tabs, type TabItem } from '@burdenoff/fe-libs/chrome';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\n\nimport { NotificationCenterPage } from './NotificationCenterPage';\nimport { useTr } from '../shared/hooks/useTr';\n\n// Lazy-load admin tab bodies — each tab pulls its bundle only when activated,\n// matching the code-splitting done in AdminNotificationRoutes.\nconst NotificationHistoryAdminPage = lazy(() =>\n import('./NotificationHistoryAdminPage').then((m) => ({\n default: m.NotificationHistoryAdminPage,\n }))\n);\nconst NotificationTemplatesPage = lazy(() =>\n import('./NotificationTemplatesPage').then((m) => ({\n default: m.NotificationTemplatesPage,\n }))\n);\nconst CreateNotificationPage = lazy(() =>\n import('./CreateNotificationPage').then((m) => ({\n default: m.CreateNotificationPage,\n }))\n);\nconst NotificationTopicsPage = lazy(() =>\n import('./NotificationTopicsPage').then((m) => ({\n default: m.NotificationTopicsPage,\n }))\n);\n\nfunction TabBodyLoader() {\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/**\n * Tabbed landing page for the Notification microfrontend.\n *\n * Admin-only tabs (Send, History, Templates, Topics) are gated by the\n * notification.* feature flags. Gating is applied here because this\n * page bypasses the route-level flag gates in AdminNotificationRoutes:\n * without this check an admin landing on /notifications could click\n * into any tab regardless of flag state.\n */\nexport function NotificationLandingPage() {\n const [params, setParams] = useSearchParams();\n const tr = useTr();\n\n // Explicit `false` fallback prevents the provider's default-allow from\n // leaking unseeded flags — same pattern as AdminNotificationRoot.tsx.\n const templatesDetails = useFeatureFlagDetails('notification.templates');\n const createDetails = useFeatureFlagDetails('notification.create');\n const historyDetails = useFeatureFlagDetails('notification.history');\n const templatesEnabled = templatesDetails ? Boolean(templatesDetails.value) : false;\n const createEnabled = createDetails ? Boolean(createDetails.value) : false;\n const historyEnabled = historyDetails ? Boolean(historyDetails.value) : false;\n\n const tabs: TabItem[] = useMemo(\n () => [\n { id: 'inbox', label: tr('notification.landing.tabs.inbox', 'Inbox') },\n ...(createEnabled\n ? [{ id: 'send', label: tr('notification.landing.tabs.send', 'Send') }]\n : []),\n ...(historyEnabled\n ? [{ id: 'history', label: tr('notification.landing.tabs.history', 'History') }]\n : []),\n ...(templatesEnabled\n ? [{ id: 'templates', label: tr('notification.landing.tabs.templates', 'Templates') }]\n : []),\n // Topics CRUD maps to `notification.create` per the backend @rbac (see\n // AdminNotificationRoutes.tsx: topics route is gated by createEnabled).\n ...(createEnabled\n ? [{ id: 'topics', label: tr('notification.landing.tabs.topics', 'Topics') }]\n : []),\n ],\n [tr, templatesEnabled, createEnabled, historyEnabled]\n );\n\n // Validate the `?tab=` query param against the filtered tab list — an\n // unknown value (stale URL, disabled flag) would otherwise leave the body\n // empty and the Tabs strip with no active item.\n const rawTab = params.get('tab');\n const activeId = rawTab && tabs.some((t) => t.id === rawTab) ? rawTab : tabs[0].id;\n\n // Rule 3 of COMPONENT_LEVEL_GATING.md: when a flag flips off while the\n // user is viewing that tab, clear the `tab` query param so subsequent\n // reloads don't resurrect the disabled view. Using the functional setter\n // form avoids depending on the `params` reference (which would re-fire\n // this effect on every update).\n useEffect(() => {\n if (rawTab && !tabs.some((t) => t.id === rawTab)) {\n setParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n next.delete('tab');\n return next;\n },\n { replace: true }\n );\n }\n }, [rawTab, tabs, setParams]);\n\n // Functional setter avoids capturing a stale `params` reference in the\n // closure — prevents dropping a concurrent query param on rapid clicks.\n const handleTabChange = (id: string) => {\n setParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n if (id === tabs[0].id) {\n next.delete('tab');\n } else {\n next.set('tab', id);\n }\n return next;\n },\n { replace: true }\n );\n };\n\n return (\n <div className=\"flex flex-col h-full\">\n <div className=\"border-b border-border-seam px-4 pt-3\">\n <Tabs\n items={tabs}\n activeTabId={activeId}\n onTabChange={handleTabChange}\n variant=\"underline\"\n />\n </div>\n <div className=\"flex-1 min-h-0 overflow-auto\">\n {/*\n History tab is flag-gated but not PermissionGate-wrapped at this layer\n — it mirrors AdminNotificationRoutes where the /history route is the\n same: the admin page itself requires NOTIFICATION_LIST permission and\n renders its own no-permission fallback when missing. Templates and\n Create tabs go through separate flag-gated routes with PermissionGate\n in AdminNotificationRoutes, so when navigated via tab here they\n bypass that gate — but the inner pages (TemplateEditor, CreateNotificationPage,\n NotificationTemplatesPage) each perform their own permission checks\n and hide write actions for read-only users.\n */}\n {activeId === 'inbox' && <NotificationCenterPage />}\n <Suspense fallback={<TabBodyLoader />}>\n {activeId === 'send' && createEnabled && <CreateNotificationPage />}\n {activeId === 'history' && historyEnabled && <NotificationHistoryAdminPage />}\n {activeId === 'templates' && templatesEnabled && <NotificationTemplatesPage />}\n {activeId === 'topics' && createEnabled && <NotificationTopicsPage />}\n </Suspense>\n </div>\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AACb,GAAD,CAAyB,CAAA;IAC5D;GACP,CAAA,CAAA;EACF,CAAA,CAAA;;AAET"}
1
+ {"version":3,"file":"NotificationLandingPage.js","names":["NotificationHistoryAdminPage","lazy","m","NotificationTemplatesPage","CreateNotificationPage","NotificationTopicsPage","TabBodyLoader","SectionLoaderOr","CompactMarkOr","NotificationLandingPage","params","setParams","useSearchParams","tr","useTr","templatesDetails","useFeatureFlagDetails","createDetails","historyDetails","templatesEnabled","createEnabled","historyEnabled","tabs","useMemo","rawTab","activeId","t","useEffect","next","prev","Tabs","id","NotificationCenterPage","Suspense"],"sources":["../../src/pages/NotificationLandingPage.tsx"],"sourcesContent":["import { Suspense, lazy, useEffect, useMemo } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { Tabs, type TabItem } from '@burdenoff/fe-libs/chrome';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\n\nimport { NotificationCenterPage } from './NotificationCenterPage';\nimport { useTr } from '../shared/hooks/useTr';\nimport { CompactMarkOr, SectionLoaderOr } from '../components/loadingSystem';\n\n// Lazy-load admin tab bodies — each tab pulls its bundle only when activated,\n// matching the code-splitting done in AdminNotificationRoutes.\nconst NotificationHistoryAdminPage = lazy(() =>\n import('./NotificationHistoryAdminPage').then((m) => ({\n default: m.NotificationHistoryAdminPage,\n }))\n);\nconst NotificationTemplatesPage = lazy(() =>\n import('./NotificationTemplatesPage').then((m) => ({\n default: m.NotificationTemplatesPage,\n }))\n);\nconst CreateNotificationPage = lazy(() =>\n import('./CreateNotificationPage').then((m) => ({\n default: m.CreateNotificationPage,\n }))\n);\nconst NotificationTopicsPage = lazy(() =>\n import('./NotificationTopicsPage').then((m) => ({\n default: m.NotificationTopicsPage,\n }))\n);\n\nfunction TabBodyLoader() {\n return (\n <SectionLoaderOr\n route\n minHeight=\"16rem\"\n today={\n <div className=\"flex h-64 items-center justify-center\">\n <CompactMarkOr\n className=\"h-8 w-8\"\n today={\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n }\n />\n </div>\n }\n />\n );\n}\n\n/**\n * Tabbed landing page for the Notification microfrontend.\n *\n * Admin-only tabs (Send, History, Templates, Topics) are gated by the\n * notification.* feature flags. Gating is applied here because this\n * page bypasses the route-level flag gates in AdminNotificationRoutes:\n * without this check an admin landing on /notifications could click\n * into any tab regardless of flag state.\n */\nexport function NotificationLandingPage() {\n const [params, setParams] = useSearchParams();\n const tr = useTr();\n\n // Explicit `false` fallback prevents the provider's default-allow from\n // leaking unseeded flags — same pattern as AdminNotificationRoot.tsx.\n const templatesDetails = useFeatureFlagDetails('notification.templates');\n const createDetails = useFeatureFlagDetails('notification.create');\n const historyDetails = useFeatureFlagDetails('notification.history');\n const templatesEnabled = templatesDetails ? Boolean(templatesDetails.value) : false;\n const createEnabled = createDetails ? Boolean(createDetails.value) : false;\n const historyEnabled = historyDetails ? Boolean(historyDetails.value) : false;\n\n const tabs: TabItem[] = useMemo(\n () => [\n { id: 'inbox', label: tr('notification.landing.tabs.inbox', 'Inbox') },\n ...(createEnabled\n ? [{ id: 'send', label: tr('notification.landing.tabs.send', 'Send') }]\n : []),\n ...(historyEnabled\n ? [{ id: 'history', label: tr('notification.landing.tabs.history', 'History') }]\n : []),\n ...(templatesEnabled\n ? [{ id: 'templates', label: tr('notification.landing.tabs.templates', 'Templates') }]\n : []),\n // Topics CRUD maps to `notification.create` per the backend @rbac (see\n // AdminNotificationRoutes.tsx: topics route is gated by createEnabled).\n ...(createEnabled\n ? [{ id: 'topics', label: tr('notification.landing.tabs.topics', 'Topics') }]\n : []),\n ],\n [tr, templatesEnabled, createEnabled, historyEnabled]\n );\n\n // Validate the `?tab=` query param against the filtered tab list — an\n // unknown value (stale URL, disabled flag) would otherwise leave the body\n // empty and the Tabs strip with no active item.\n const rawTab = params.get('tab');\n const activeId = rawTab && tabs.some((t) => t.id === rawTab) ? rawTab : tabs[0].id;\n\n // Rule 3 of COMPONENT_LEVEL_GATING.md: when a flag flips off while the\n // user is viewing that tab, clear the `tab` query param so subsequent\n // reloads don't resurrect the disabled view. Using the functional setter\n // form avoids depending on the `params` reference (which would re-fire\n // this effect on every update).\n useEffect(() => {\n if (rawTab && !tabs.some((t) => t.id === rawTab)) {\n setParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n next.delete('tab');\n return next;\n },\n { replace: true }\n );\n }\n }, [rawTab, tabs, setParams]);\n\n // Functional setter avoids capturing a stale `params` reference in the\n // closure — prevents dropping a concurrent query param on rapid clicks.\n const handleTabChange = (id: string) => {\n setParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n if (id === tabs[0].id) {\n next.delete('tab');\n } else {\n next.set('tab', id);\n }\n return next;\n },\n { replace: true }\n );\n };\n\n return (\n <div className=\"flex flex-col h-full\">\n <div className=\"border-b border-border-seam px-4 pt-3\">\n <Tabs\n items={tabs}\n activeTabId={activeId}\n onTabChange={handleTabChange}\n variant=\"underline\"\n />\n </div>\n <div className=\"flex-1 min-h-0 overflow-auto\">\n {/*\n History tab is flag-gated but not PermissionGate-wrapped at this layer\n — it mirrors AdminNotificationRoutes where the /history route is the\n same: the admin page itself requires NOTIFICATION_LIST permission and\n renders its own no-permission fallback when missing. Templates and\n Create tabs go through separate flag-gated routes with PermissionGate\n in AdminNotificationRoutes, so when navigated via tab here they\n bypass that gate — but the inner pages (TemplateEditor, CreateNotificationPage,\n NotificationTemplatesPage) each perform their own permission checks\n and hide write actions for read-only users.\n */}\n {activeId === 'inbox' && <NotificationCenterPage />}\n <Suspense fallback={<TabBodyLoader />}>\n {activeId === 'send' && createEnabled && <CreateNotificationPage />}\n {activeId === 'history' && historyEnabled && <NotificationHistoryAdminPage />}\n {activeId === 'templates' && templatesEnabled && <NotificationTemplatesPage />}\n {activeId === 'topics' && createEnabled && <NotificationTopicsPage />}\n </Suspense>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAWA,IAAMA,IAA+BC,QACnC,OAAO,oCAAiC,CAAC,MAAM,OAAO,EACpD,SAASC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BAACf,GAAD,CAAyB,CAAA;IAC5D;GACP,CAAA,CAAA;EACF,CAAA,CAAA;;AAET"}
@@ -5,13 +5,14 @@ import { NOTIFICATION_PERMISSIONS as n } from "../constants/permissions.js";
5
5
  import { useNotification as r } from "../providers/NotificationProvider.js";
6
6
  import { useTr as i } from "../shared/hooks/useTr.js";
7
7
  import { NotificationSettingsV2 as a } from "../navigation-v2/NotificationSettingsV2.js";
8
- import { useMemo as o, useState as s } from "react";
9
- import { usePermissions as c } from "@burdenoff/fe-libs/shared/providers/shell";
10
- import { BellRing as l, Search as u, ToggleLeft as d, ToggleRight as f } from "lucide-react";
11
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
12
- import { EmphasisPanel as h, IllustratedEmptyState as g, OptionalFields as _, PagePurpose as v } from "@burdenoff/fe-libs/ui";
8
+ import { CompactMarkOr as o, SectionLoaderOr as s } from "../components/loadingSystem.js";
9
+ import { useMemo as c, useState as l } from "react";
10
+ import { usePermissions as u } from "@burdenoff/fe-libs/shared/providers/shell";
11
+ import { BellRing as d, Search as f, ToggleLeft as p, ToggleRight as m } from "lucide-react";
12
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
13
+ import { EmphasisPanel as _, IllustratedEmptyState as v, OptionalFields as y, PagePurpose as b } from "@burdenoff/fe-libs/ui";
13
14
  // src/pages/NotificationPreferencesPage.tsx
14
- var y = [
15
+ var x = [
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
+ ], S = [
46
47
  {
47
48
  value: "TRANSACTIONAL",
48
49
  labelKey: "notifications.typeTransactional",
@@ -64,124 +65,133 @@ var y = [
64
65
  label: "Marketing"
65
66
  }
66
67
  ];
67
- function x() {
68
+ function C() {
68
69
  let { navigationV2: e } = r();
69
- return p(e ? a : S, {});
70
+ return h(e ? a : T, {});
70
71
  }
71
- function S() {
72
- let a = i(), { hasPermission: x, isLoading: S } = c(), { currentUser: C } = r(), { topics: w, isLoading: T, isForbidden: E } = e({
72
+ function w() {
73
+ return /* @__PURE__ */ h(s, {
74
+ minHeight: "16rem",
75
+ today: /* @__PURE__ */ h("div", {
76
+ className: "flex h-64 items-center justify-center",
77
+ children: /* @__PURE__ */ h(o, {
78
+ className: "h-8 w-8",
79
+ today: /* @__PURE__ */ h("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
80
+ })
81
+ })
82
+ });
83
+ }
84
+ function T() {
85
+ let a = i(), { hasPermission: o, isLoading: s } = u(), { currentUser: C } = r(), { topics: T, isLoading: E, isForbidden: D } = e({
73
86
  type: "MARKETING",
74
87
  isActive: !0
75
- }), { preferencesByKey: D, preferencesLoading: O, savingKey: k, saveFeedback: A, togglePreference: j, resetPreference: M } = t(), [N, P] = s(""), F = T || O, I = o(() => {
76
- if (!N.trim()) return w;
77
- let e = N.toLowerCase();
78
- return w.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
79
- }, [N, w]), L = (e) => {
80
- let t = D.get(e.key), n = t?.enabled ?? !0, r = k === e.key, i = A?.key === e.key ? A : null;
81
- return /* @__PURE__ */ m("div", {
88
+ }), { preferencesByKey: O, preferencesLoading: k, savingKey: A, saveFeedback: j, togglePreference: M, resetPreference: N } = t(), [P, F] = l(""), I = E || k, L = c(() => {
89
+ if (!P.trim()) return T;
90
+ let e = P.toLowerCase();
91
+ return T.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
92
+ }, [P, T]), R = (e) => {
93
+ let t = O.get(e.key), n = t?.enabled ?? !0, r = A === e.key, i = j?.key === e.key ? j : null;
94
+ return /* @__PURE__ */ g("div", {
82
95
  className: "rounded-lg border border-border-seam bg-gloss-card p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)]",
83
- children: [/* @__PURE__ */ m("div", {
96
+ children: [/* @__PURE__ */ g("div", {
84
97
  className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
85
- children: [/* @__PURE__ */ m("div", {
98
+ children: [/* @__PURE__ */ g("div", {
86
99
  className: "space-y-1",
87
- children: [/* @__PURE__ */ m("div", {
100
+ children: [/* @__PURE__ */ g("div", {
88
101
  className: "flex items-center gap-2",
89
102
  children: [
90
- /* @__PURE__ */ p(l, {
103
+ /* @__PURE__ */ h(d, {
91
104
  size: 16,
92
105
  className: "text-accent-primary"
93
106
  }),
94
- /* @__PURE__ */ p("h2", {
107
+ /* @__PURE__ */ h("h2", {
95
108
  className: "text-sm font-semibold text-primary",
96
109
  children: e.title
97
110
  }),
98
- t && /* @__PURE__ */ p("span", {
111
+ t && /* @__PURE__ */ h("span", {
99
112
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
100
113
  children: t.frequency.replace("_", " ").toLowerCase()
101
114
  })
102
115
  ]
103
- }), /* @__PURE__ */ p("p", {
116
+ }), /* @__PURE__ */ h("p", {
104
117
  className: "text-sm text-text-secondary",
105
118
  children: e.description
106
119
  })]
107
- }), /* @__PURE__ */ m("div", {
120
+ }), /* @__PURE__ */ g("div", {
108
121
  className: "flex items-center gap-2",
109
- children: [t && /* @__PURE__ */ p("button", {
122
+ children: [t && /* @__PURE__ */ h("button", {
110
123
  type: "button",
111
124
  disabled: r,
112
- onClick: () => M(e.key),
125
+ onClick: () => N(e.key),
113
126
  className: "rounded-md border border-default px-3 py-2 text-sm text-text-secondary hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50",
114
127
  children: a("notifications.reset", "Reset")
115
- }), /* @__PURE__ */ m("button", {
128
+ }), /* @__PURE__ */ g("button", {
116
129
  type: "button",
117
130
  "aria-pressed": n,
118
131
  disabled: r,
119
- onClick: () => j({
132
+ onClick: () => M({
120
133
  scope: e.scope,
121
134
  channel: e.channel,
122
135
  type: e.type,
123
136
  topicId: e.topicId
124
137
  }),
125
138
  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-bg-sunken text-text-secondary hover:bg-bg-sunken/80"} disabled:cursor-not-allowed disabled:opacity-50`,
126
- children: [p(n ? f : d, { size: 18 }), r ? a("notifications.saving", "Saving...") : n ? a("notifications.enabled", "Enabled") : a("notifications.disabled", "Disabled")]
139
+ children: [h(n ? m : p, { size: 18 }), r ? a("notifications.saving", "Saving...") : n ? a("notifications.enabled", "Enabled") : a("notifications.disabled", "Disabled")]
127
140
  })]
128
141
  })]
129
- }), /* @__PURE__ */ p("div", {
142
+ }), /* @__PURE__ */ h("div", {
130
143
  className: "mt-3 min-h-5",
131
144
  "aria-live": "polite",
132
- children: i && /* @__PURE__ */ p("p", {
145
+ children: i && /* @__PURE__ */ h("p", {
133
146
  className: `text-xs ${i.type === "success" ? "text-success" : "text-error"}`,
134
147
  children: i.message
135
148
  })
136
149
  })]
137
150
  }, e.key);
138
151
  };
139
- return S ? /* @__PURE__ */ p("div", {
140
- className: "flex h-64 items-center justify-center",
141
- children: /* @__PURE__ */ p("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
142
- }) : !x(n.NOTIFICATION_LIST) && !C?.id ? /* @__PURE__ */ p("div", {
152
+ return s ? /* @__PURE__ */ h(w, {}) : !o(n.NOTIFICATION_LIST) && !C?.id ? /* @__PURE__ */ h("div", {
143
153
  className: "p-8 text-center text-text-secondary",
144
154
  children: a("notifications.noPermissionPreferences", "You don't have permission to manage notification preferences.")
145
- }) : /* @__PURE__ */ m("div", {
155
+ }) : /* @__PURE__ */ g("div", {
146
156
  "data-tour": "notification-preferences-page",
147
157
  className: "space-y-6 p-4 sm:p-6",
148
158
  children: [
149
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
159
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("h1", {
150
160
  className: "text-2xl font-bold text-primary",
151
161
  children: a("notifications.preferencesTitle", "Notification Preferences")
152
- }), /* @__PURE__ */ p("p", {
162
+ }), /* @__PURE__ */ h("p", {
153
163
  className: "mt-1 text-sm text-text-secondary",
154
164
  children: a("notifications.preferencesSubtitle", "Control global, channel, type, and topic-level notification delivery.")
155
165
  })] }),
156
- /* @__PURE__ */ p(v, {
157
- icon: /* @__PURE__ */ p(l, { size: 16 }),
166
+ /* @__PURE__ */ h(b, {
167
+ icon: /* @__PURE__ */ h(d, { size: 16 }),
158
168
  children: a("notifications.preferencesPurpose", "Decide how and when we reach you. The Global switch is your master on/off, then you can fine-tune individual channels (email, push, SMS…), notification types and the marketing topics you have subscribed to. Settings cascade — turning a channel off silences it everywhere.")
159
169
  }),
160
- /* @__PURE__ */ m(h, {
170
+ /* @__PURE__ */ g(_, {
161
171
  "data-tour": "notification-preferences-global",
162
172
  className: "space-y-3 p-5 sm:p-6",
163
- children: [/* @__PURE__ */ p("h2", {
173
+ children: [/* @__PURE__ */ h("h2", {
164
174
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
165
175
  children: a("notifications.globalPreferences", "Global")
166
- }), L({
176
+ }), R({
167
177
  key: "GLOBAL",
168
178
  scope: "GLOBAL",
169
179
  title: a("notifications.allNotifications", "All notifications"),
170
180
  description: a("notifications.allNotificationsDescription", "Master preference for notification delivery across all channels and types.")
171
181
  })]
172
182
  }),
173
- /* @__PURE__ */ m(_, {
183
+ /* @__PURE__ */ g(y, {
174
184
  title: a("notifications.advancedPreferences", "Advanced settings"),
175
185
  description: a("notifications.advancedPreferencesDescription", "Per-channel filter rules, notification-type filters, and quiet-hour overrides."),
176
- children: [/* @__PURE__ */ m("section", {
186
+ children: [/* @__PURE__ */ g("section", {
177
187
  "data-tour": "notification-preferences-channels",
178
188
  className: "space-y-3",
179
- children: [/* @__PURE__ */ p("h2", {
189
+ children: [/* @__PURE__ */ h("h2", {
180
190
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
181
191
  children: a("notifications.channelPreferences", "Channels")
182
- }), /* @__PURE__ */ p("div", {
192
+ }), /* @__PURE__ */ h("div", {
183
193
  className: "grid gap-3 lg:grid-cols-2",
184
- children: y.map((e) => L({
194
+ children: x.map((e) => R({
185
195
  key: `CHANNEL:${e.value}`,
186
196
  scope: "CHANNEL",
187
197
  channel: e.value,
@@ -189,15 +199,15 @@ function S() {
189
199
  description: a("notifications.channelPreferenceDescription", "Control delivery for this channel.")
190
200
  }))
191
201
  })]
192
- }), /* @__PURE__ */ m("section", {
202
+ }), /* @__PURE__ */ g("section", {
193
203
  "data-tour": "notification-preferences-types",
194
204
  className: "mt-6 space-y-3",
195
- children: [/* @__PURE__ */ p("h2", {
205
+ children: [/* @__PURE__ */ h("h2", {
196
206
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
197
207
  children: a("notifications.typePreferences", "Notification Types")
198
- }), /* @__PURE__ */ p("div", {
208
+ }), /* @__PURE__ */ h("div", {
199
209
  className: "grid gap-3 lg:grid-cols-2",
200
- children: b.map((e) => L({
210
+ children: S.map((e) => R({
201
211
  key: `TYPE:${e.value}`,
202
212
  scope: "TYPE",
203
213
  type: e.value,
@@ -207,43 +217,43 @@ function S() {
207
217
  })]
208
218
  })]
209
219
  }),
210
- /* @__PURE__ */ m("div", {
220
+ /* @__PURE__ */ g("div", {
211
221
  className: "relative max-w-xl",
212
- children: [/* @__PURE__ */ p(u, {
222
+ children: [/* @__PURE__ */ h(f, {
213
223
  size: 16,
214
224
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
215
- }), /* @__PURE__ */ p("input", {
225
+ }), /* @__PURE__ */ h("input", {
216
226
  type: "text",
217
- value: N,
218
- onChange: (e) => P(e.target.value),
227
+ value: P,
228
+ onChange: (e) => F(e.target.value),
219
229
  "aria-label": a("notifications.searchTopics", "Search topics..."),
220
230
  placeholder: a("notifications.searchTopics", "Search topics..."),
221
231
  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"
222
232
  })]
223
233
  }),
224
- /* @__PURE__ */ m("section", {
234
+ /* @__PURE__ */ g("section", {
225
235
  "data-tour": "notification-preferences-topics",
226
236
  className: "space-y-3",
227
- children: [/* @__PURE__ */ p("h2", {
237
+ children: [/* @__PURE__ */ h("h2", {
228
238
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
229
239
  children: a("notifications.topicPreferences", "Topics")
230
- }), F ? /* @__PURE__ */ p("div", {
240
+ }), I ? /* @__PURE__ */ h("div", {
231
241
  className: "rounded-lg border border-default bg-surface p-6 text-sm text-text-secondary",
232
242
  children: a("notifications.loadingPreferences", "Loading preferences...")
233
- }) : E ? /* @__PURE__ */ p(g, {
243
+ }) : D ? /* @__PURE__ */ h(v, {
234
244
  illustration: "empty-generic",
235
245
  title: a("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
236
246
  description: a("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access."),
237
247
  kind: "no-access",
238
248
  size: "panel"
239
- }) : I.length === 0 ? /* @__PURE__ */ p(g, {
240
- illustration: N.trim() ? "empty-search" : "empty-data",
241
- title: N.trim() ? a("notifications.noTopicsFound", "No topics match your search") : a("notifications.noTopicsAvailableTitle", "No subscribable topics yet"),
242
- description: N.trim() ? a("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : a("notifications.noTopicsAvailableDescription", "When marketing topics are published you can subscribe or unsubscribe from each one here."),
243
- kind: N.trim() ? "no-results" : "first-use",
249
+ }) : L.length === 0 ? /* @__PURE__ */ h(v, {
250
+ illustration: P.trim() ? "empty-search" : "empty-data",
251
+ title: P.trim() ? a("notifications.noTopicsFound", "No topics match your search") : a("notifications.noTopicsAvailableTitle", "No subscribable topics yet"),
252
+ description: P.trim() ? a("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : a("notifications.noTopicsAvailableDescription", "When marketing topics are published you can subscribe or unsubscribe from each one here."),
253
+ kind: P.trim() ? "no-results" : "first-use",
244
254
  glassIllustration: "notifications",
245
255
  size: "panel"
246
- }) : I.map((e) => L({
256
+ }) : L.map((e) => R({
247
257
  key: `TOPIC:${e.id}`,
248
258
  scope: "TOPIC",
249
259
  topicId: e.id,
@@ -254,6 +264,6 @@ function S() {
254
264
  ]
255
265
  });
256
266
  }
257
- export { x as NotificationPreferencesPage };
267
+ export { C as NotificationPreferencesPage };
258
268
 
259
269
  //# sourceMappingURL=NotificationPreferencesPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationPreferencesPage.js","names":["CHANNEL_OPTIONS","TYPE_OPTIONS","NotificationPreferencesPage","useNotification","jsx","navigationV2","NotificationSettingsV2","ClassicNotificationPreferencesPage","tr","useTr","permissionsLoading","usePermissions","topicsLoading","topicsForbidden","useNotificationTopics","usePreferenceToggles","search","setSearch","useState","isLoading","preferencesLoading","filteredTopics","useMemo","topics","query","topic","renderPreferenceRow","existing","preferencesByKey","input","isEnabled","isSaving","savingKey","feedback","saveFeedback","BellRing","resetPreference","togglePreference","ToggleRight","ToggleLeft","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","PagePurpose","EmphasisPanel","OptionalFields","channel","type","Search","event","IllustratedEmptyState"],"sources":["../../src/pages/NotificationPreferencesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { BellRing, Search, ToggleLeft, ToggleRight } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n EmphasisPanel,\n IllustratedEmptyState,\n OptionalFields,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport { usePreferenceToggles } from '../hooks/usePreferenceToggles';\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 { NotificationSettingsV2 } from '../navigation-v2/NotificationSettingsV2';\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\n/**\n * Notification preferences. Under FluidGrids' Navigation v2 (BOFF-11872) it\n * is \"Notification settings\" instead; every other app keeps this page.\n */\nexport function NotificationPreferencesPage() {\n const { navigationV2 } = useNotification();\n return navigationV2 ? <NotificationSettingsV2 /> : <ClassicNotificationPreferencesPage />;\n}\n\nfunction ClassicNotificationPreferencesPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n topics,\n isLoading: topicsLoading,\n isForbidden: topicsForbidden,\n } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const {\n preferencesByKey,\n preferencesLoading,\n savingKey,\n saveFeedback,\n togglePreference,\n resetPreference,\n } = usePreferenceToggles();\n const [search, setSearch] = useState('');\n\n const isLoading = topicsLoading || preferencesLoading;\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 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\n key={input.key}\n className=\"rounded-lg border border-border-seam bg-gloss-card p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)]\"\n >\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-bg-sunken px-2 py-0.5 text-xs text-text-secondary\">\n {existing.frequency.replace('_', ' ').toLowerCase()}\n </span>\n )}\n </div>\n <p className=\"text-sm text-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-text-secondary hover:bg-bg-sunken 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-bg-sunken text-text-secondary hover:bg-bg-sunken/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-text-secondary\">\n {tr(\n 'notifications.preferencesSubtitle',\n 'Control global, channel, type, and topic-level notification delivery.'\n )}\n </p>\n </div>\n\n <PagePurpose icon={<BellRing size={16} />}>\n {tr(\n 'notifications.preferencesPurpose',\n 'Decide how and when we reach you. The Global switch is your master on/off, then you can fine-tune individual channels (email, push, SMS…), notification types and the marketing topics you have subscribed to. Settings cascade — turning a channel off silences it everywhere.'\n )}\n </PagePurpose>\n\n <EmphasisPanel data-tour=\"notification-preferences-global\" className=\"space-y-3 p-5 sm:p-6\">\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 </EmphasisPanel>\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-text-secondary\">\n {tr('notifications.loadingPreferences', 'Loading preferences...')}\n </div>\n ) : topicsForbidden ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title={tr(\n 'notifications.topicsNoAccessTitle',\n \"You don't have access to notification topics\"\n )}\n description={tr(\n 'notifications.topicsNoAccessDescription',\n \"Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.\"\n )}\n kind=\"no-access\"\n size=\"panel\"\n />\n ) : filteredTopics.length === 0 ? (\n <IllustratedEmptyState\n illustration={search.trim() ? 'empty-search' : 'empty-data'}\n title={\n search.trim()\n ? tr('notifications.noTopicsFound', 'No topics match your search')\n : tr('notifications.noTopicsAvailableTitle', 'No subscribable topics yet')\n }\n description={\n search.trim()\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.noTopicsAvailableDescription',\n 'When marketing topics are published you can subscribe or unsubscribe from each one here.'\n )\n }\n kind={search.trim() ? 'no-results' : 'first-use'}\n glassIllustration=\"notifications\"\n size=\"panel\"\n />\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":";;;;;;;;;;;;;AAiBA,IAAMA,IAA0F;CAC9F;EAAE,OAAO;EAAU,UAAU;EAA8B,OAAO;CAAS;CAC3E;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;CAAQ;CACzE;EAAE,OAAO;EAAQ,UAAU;EAA6B,OAAO;CAAO;CACtE;EAAE,OAAO;EAAO,UAAU;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ACF;KACA,MAAK;KACL,MAAK;IACN,CAAA,IACCa,EAAe,WAAW,IAC5B,kBAAC6B,GAAD;KACE,cAAclC,EAAO,KAAK,IAAI,iBAAiB;KAC/C,OACEA,EAAO,KAAK,IACRR,EAAG,+BAA+B,6BAA6B,IAC/DA,EAAG,wCAAwC,4BAA4B;KAE7E,aACEQ,EAAO,KAAK,IACRR,EAAG,yCAAyC,4BAA4B,IACxEA,EACE,8CACA,0FACF;KAEN,MAAMQ,EAAO,KAAK,IAAI,eAAe;KACrC,mBAAkB;KAClB,MAAK;IACN,CAAA,IAEDK,EAAe,KAAK,MAClBK,EAAoB;KAClB,KAAK,SAASD,EAAM;KACpB,OAAO;KACP,SAASA,EAAM;KACf,OAAOA,EAAM;KACb,aAAaA,EAAM,eAAeA,EAAM;IAC1C,CAAC,CACH,CAEK;;EACN;;AAET"}
1
+ {"version":3,"file":"NotificationPreferencesPage.js","names":["CHANNEL_OPTIONS","TYPE_OPTIONS","NotificationPreferencesPage","useNotification","jsx","navigationV2","NotificationSettingsV2","ClassicNotificationPreferencesPage","PreferencesLoading","SectionLoaderOr","CompactMarkOr","tr","useTr","permissionsLoading","usePermissions","topicsLoading","topicsForbidden","useNotificationTopics","usePreferenceToggles","search","setSearch","useState","isLoading","preferencesLoading","filteredTopics","useMemo","topics","query","topic","renderPreferenceRow","existing","preferencesByKey","input","isEnabled","isSaving","savingKey","feedback","saveFeedback","BellRing","resetPreference","togglePreference","ToggleRight","ToggleLeft","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","PagePurpose","EmphasisPanel","OptionalFields","channel","type","Search","event","IllustratedEmptyState"],"sources":["../../src/pages/NotificationPreferencesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { BellRing, Search, ToggleLeft, ToggleRight } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n EmphasisPanel,\n IllustratedEmptyState,\n OptionalFields,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport { usePreferenceToggles } from '../hooks/usePreferenceToggles';\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 { NotificationSettingsV2 } from '../navigation-v2/NotificationSettingsV2';\nimport { CompactMarkOr, SectionLoaderOr } from '../components/loadingSystem';\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\n/**\n * Notification preferences. Under FluidGrids' Navigation v2 (BOFF-11872) it\n * is \"Notification settings\" instead; every other app keeps this page.\n */\nexport function NotificationPreferencesPage() {\n const { navigationV2 } = useNotification();\n return navigationV2 ? <NotificationSettingsV2 /> : <ClassicNotificationPreferencesPage />;\n}\n\n/** While the reader's permissions load: today's ring, or the loading system's section loader. */\nfunction PreferencesLoading() {\n return (\n <SectionLoaderOr\n minHeight=\"16rem\"\n today={\n <div className=\"flex h-64 items-center justify-center\">\n <CompactMarkOr\n className=\"h-8 w-8\"\n today={\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n }\n />\n </div>\n }\n />\n );\n}\n\nfunction ClassicNotificationPreferencesPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n topics,\n isLoading: topicsLoading,\n isForbidden: topicsForbidden,\n } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const {\n preferencesByKey,\n preferencesLoading,\n savingKey,\n saveFeedback,\n togglePreference,\n resetPreference,\n } = usePreferenceToggles();\n const [search, setSearch] = useState('');\n\n const isLoading = topicsLoading || preferencesLoading;\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 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\n key={input.key}\n className=\"rounded-lg border border-border-seam bg-gloss-card p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)]\"\n >\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-bg-sunken px-2 py-0.5 text-xs text-text-secondary\">\n {existing.frequency.replace('_', ' ').toLowerCase()}\n </span>\n )}\n </div>\n <p className=\"text-sm text-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-text-secondary hover:bg-bg-sunken 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-bg-sunken text-text-secondary hover:bg-bg-sunken/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 <PreferencesLoading />;\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-text-secondary\">\n {tr(\n 'notifications.preferencesSubtitle',\n 'Control global, channel, type, and topic-level notification delivery.'\n )}\n </p>\n </div>\n\n <PagePurpose icon={<BellRing size={16} />}>\n {tr(\n 'notifications.preferencesPurpose',\n 'Decide how and when we reach you. The Global switch is your master on/off, then you can fine-tune individual channels (email, push, SMS…), notification types and the marketing topics you have subscribed to. Settings cascade — turning a channel off silences it everywhere.'\n )}\n </PagePurpose>\n\n <EmphasisPanel data-tour=\"notification-preferences-global\" className=\"space-y-3 p-5 sm:p-6\">\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 </EmphasisPanel>\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-text-secondary\">\n {tr('notifications.loadingPreferences', 'Loading preferences...')}\n </div>\n ) : topicsForbidden ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title={tr(\n 'notifications.topicsNoAccessTitle',\n \"You don't have access to notification topics\"\n )}\n description={tr(\n 'notifications.topicsNoAccessDescription',\n \"Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.\"\n )}\n kind=\"no-access\"\n size=\"panel\"\n />\n ) : filteredTopics.length === 0 ? (\n <IllustratedEmptyState\n illustration={search.trim() ? 'empty-search' : 'empty-data'}\n title={\n search.trim()\n ? tr('notifications.noTopicsFound', 'No topics match your search')\n : tr('notifications.noTopicsAvailableTitle', 'No subscribable topics yet')\n }\n description={\n search.trim()\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.noTopicsAvailableDescription',\n 'When marketing topics are published you can subscribe or unsubscribe from each one here.'\n )\n }\n kind={search.trim() ? 'no-results' : 'first-use'}\n glassIllustration=\"notifications\"\n size=\"panel\"\n />\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":";;;;;;;;;;;;;;AAkBA,IAAMA,IAA0F;CAC9F;EAAE,OAAO;EAAU,UAAU;EAA8B,OAAO;CAAS;CAC3E;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;CAAQ;CACzE;EAAE,OAAO;EAAQ,UAAU;EAA6B,OAAO;CAAO;CACtE;EAAE,OAAO;EAAO,UAAU;EAA4B,OAAO;CAAM;CACnE;EAAE,OAAO;EAAY,UAAU;EAAiC,OAAO;CAAW;CAClF;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;CAAQ;AAC3E,GAEMC,IAAoF;CACxF;EAAE,OAAO;EAAiB,UAAU;EAAmC,OAAO;CAAgB;CAC9F;EAAE,OAAO;EAAU,UAAU;EAA4B,OAAO;CAAS;CACzE;EAAE,OAAO;EAAS,UAAU;EAA2B,OAAO;CAAS;CACvE;EAAE,OAAO;EAAa,UAAU;EAA+B,OAAO;CAAY;AACpF;AAMA,SAAgBC,IAA8B;CAC5C,IAAM,EAAE,oBAAiBC,EAAgB;CACzC,OAAsBC,EAAfC,IAAgBC,IAA6BC,GAA9B,CAAyB,CAAyC;AAC1F;AAGA,SAASC,IAAqB;CAC5B,OACE,kBAACC,GAAD;EACE,WAAU;EACV,OACE,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAACC,GAAD;IACE,WAAU;IACV,OACE,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;GAEpG,CAAA;EACE,CAAA;CAER,CAAA;AAEL;AAEA,SAASH,IAAqC;CAC5C,IAAMI,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,mBAAg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