@burdenoff/microfe-notification 2026.1023.1 → 2026.1029.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.
@@ -69,76 +69,76 @@ function T(e) {
69
69
  return e.scope === "CHANNEL" ? `CHANNEL:${e.channel || ""}` : e.scope === "TYPE" ? `TYPE:${e.type || ""}` : e.scope === "TOPIC" ? `TOPIC:${e.topicId || ""}` : "GLOBAL";
70
70
  }
71
71
  function E() {
72
- let E = i(), { hasPermission: D, isLoading: O } = f(), { currentUser: k } = e(), { topics: A, isLoading: j } = r({
72
+ let E = i(), { hasPermission: D, isLoading: O } = f(), { currentUser: k } = e(), { topics: A, isLoading: j, isForbidden: M } = r({
73
73
  type: "MARKETING",
74
74
  isActive: !0
75
- }), { preferencesByKey: M, isLoading: N, setPreference: P, deletePreference: F } = n(), { trackPreferenceUpdated: I } = t(), [L, R] = d(""), [z, B] = d(null), [V, H] = d(null), U = u(null), W = j || N;
75
+ }), { preferencesByKey: N, isLoading: P, setPreference: F, deletePreference: I } = n(), { trackPreferenceUpdated: L } = t(), [R, z] = d(""), [B, V] = d(null), [H, U] = d(null), W = u(null), G = j || P;
76
76
  c(() => () => {
77
- U.current && clearTimeout(U.current);
77
+ W.current && clearTimeout(W.current);
78
78
  }, []);
79
- let G = (e) => {
80
- U.current && clearTimeout(U.current), H(e), U.current = setTimeout(() => {
81
- H((t) => t?.key === e.key ? null : t), U.current = null;
79
+ let K = (e) => {
80
+ W.current && clearTimeout(W.current), U(e), W.current = setTimeout(() => {
81
+ U((t) => t?.key === e.key ? null : t), W.current = null;
82
82
  }, 2500);
83
- }, K = l(() => {
84
- if (!L.trim()) return A;
85
- let e = L.toLowerCase();
83
+ }, q = l(() => {
84
+ if (!R.trim()) return A;
85
+ let e = R.toLowerCase();
86
86
  return A.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
87
- }, [L, A]), q = async (e) => {
88
- let t = T(e), n = M.get(t), r = !(n?.enabled ?? !0);
89
- B(t), a("medium");
87
+ }, [R, A]), J = async (e) => {
88
+ let t = T(e), n = N.get(t), r = !(n?.enabled ?? !0);
89
+ V(t), a("medium");
90
90
  try {
91
- await P({
91
+ await F({
92
92
  ...e,
93
93
  enabled: r,
94
94
  frequency: n?.frequency || "IMMEDIATE"
95
- }), I({
95
+ }), L({
96
96
  action: "set",
97
97
  scope: e.scope,
98
98
  channel: e.channel,
99
99
  type: e.type,
100
100
  enabled: r
101
- }), G({
101
+ }), K({
102
102
  key: t,
103
103
  type: "success",
104
104
  message: E("notifications.preferenceSaved", "Preference saved.")
105
105
  }), o("success");
106
106
  } catch {
107
- G({
107
+ K({
108
108
  key: t,
109
109
  type: "error",
110
110
  message: E("notifications.preferenceSaveFailed", "Could not save preference.")
111
111
  }), o("error");
112
112
  } finally {
113
- B(null);
113
+ V(null);
114
114
  }
115
- }, J = async (e) => {
116
- let t = M.get(e);
115
+ }, Y = async (e) => {
116
+ let t = N.get(e);
117
117
  if (t) {
118
- B(e);
118
+ V(e);
119
119
  try {
120
- await F(t.id), I({
120
+ await I(t.id), L({
121
121
  action: "reset",
122
122
  scope: t.scope,
123
123
  channel: t.channel,
124
124
  type: t.type
125
- }), G({
125
+ }), K({
126
126
  key: e,
127
127
  type: "success",
128
128
  message: E("notifications.preferenceReset", "Preference reset.")
129
129
  });
130
130
  } catch {
131
- G({
131
+ K({
132
132
  key: e,
133
133
  type: "error",
134
134
  message: E("notifications.preferenceResetFailed", "Could not reset preference.")
135
135
  });
136
136
  } finally {
137
- B(null);
137
+ V(null);
138
138
  }
139
139
  }
140
- }, Y = (e) => {
141
- let t = M.get(e.key), n = t?.enabled ?? !0, r = z === e.key, i = V?.key === e.key ? V : null;
140
+ }, X = (e) => {
141
+ let t = N.get(e.key), n = t?.enabled ?? !0, r = B === e.key, i = H?.key === e.key ? H : null;
142
142
  return /* @__PURE__ */ v("div", {
143
143
  className: "rounded-lg border border-border-seam bg-gloss-card p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)]",
144
144
  children: [/* @__PURE__ */ v("div", {
@@ -170,14 +170,14 @@ function E() {
170
170
  children: [t && /* @__PURE__ */ _("button", {
171
171
  type: "button",
172
172
  disabled: r,
173
- onClick: () => J(e.key),
173
+ onClick: () => Y(e.key),
174
174
  className: "rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50",
175
175
  children: E("notifications.reset", "Reset")
176
176
  }), /* @__PURE__ */ v("button", {
177
177
  type: "button",
178
178
  "aria-pressed": n,
179
179
  disabled: r,
180
- onClick: () => q({
180
+ onClick: () => J({
181
181
  scope: e.scope,
182
182
  channel: e.channel,
183
183
  type: e.type,
@@ -224,7 +224,7 @@ function E() {
224
224
  children: [/* @__PURE__ */ _("h2", {
225
225
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
226
226
  children: E("notifications.globalPreferences", "Global")
227
- }), Y({
227
+ }), X({
228
228
  key: "GLOBAL",
229
229
  scope: "GLOBAL",
230
230
  title: E("notifications.allNotifications", "All notifications"),
@@ -242,7 +242,7 @@ function E() {
242
242
  children: E("notifications.channelPreferences", "Channels")
243
243
  }), /* @__PURE__ */ _("div", {
244
244
  className: "grid gap-3 lg:grid-cols-2",
245
- children: C.map((e) => Y({
245
+ children: C.map((e) => X({
246
246
  key: `CHANNEL:${e.value}`,
247
247
  scope: "CHANNEL",
248
248
  channel: e.value,
@@ -258,7 +258,7 @@ function E() {
258
258
  children: E("notifications.typePreferences", "Notification Types")
259
259
  }), /* @__PURE__ */ _("div", {
260
260
  className: "grid gap-3 lg:grid-cols-2",
261
- children: w.map((e) => Y({
261
+ children: w.map((e) => X({
262
262
  key: `TYPE:${e.value}`,
263
263
  scope: "TYPE",
264
264
  type: e.value,
@@ -275,8 +275,8 @@ function E() {
275
275
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
276
276
  }), /* @__PURE__ */ _("input", {
277
277
  type: "text",
278
- value: L,
279
- onChange: (e) => R(e.target.value),
278
+ value: R,
279
+ onChange: (e) => z(e.target.value),
280
280
  "aria-label": E("notifications.searchTopics", "Search topics..."),
281
281
  placeholder: E("notifications.searchTopics", "Search topics..."),
282
282
  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"
@@ -288,14 +288,18 @@ function E() {
288
288
  children: [/* @__PURE__ */ _("h2", {
289
289
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
290
290
  children: E("notifications.topicPreferences", "Topics")
291
- }), W ? /* @__PURE__ */ _("div", {
291
+ }), G ? /* @__PURE__ */ _("div", {
292
292
  className: "rounded-lg border border-default bg-surface p-6 text-sm text-secondary",
293
293
  children: E("notifications.loadingPreferences", "Loading preferences...")
294
- }) : K.length === 0 ? /* @__PURE__ */ _(b, {
295
- illustration: L.trim() ? "empty-search" : "empty-data",
296
- title: L.trim() ? E("notifications.noTopicsFound", "No topics match your search") : E("notifications.noTopicsAvailableTitle", "No subscribable topics yet"),
297
- description: L.trim() ? E("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : E("notifications.noTopicsAvailableDescription", "When marketing topics are published you can subscribe or unsubscribe from each one here.")
298
- }) : K.map((e) => Y({
294
+ }) : M ? /* @__PURE__ */ _(b, {
295
+ illustration: "empty-generic",
296
+ title: E("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
297
+ description: E("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.")
298
+ }) : q.length === 0 ? /* @__PURE__ */ _(b, {
299
+ illustration: R.trim() ? "empty-search" : "empty-data",
300
+ title: R.trim() ? E("notifications.noTopicsFound", "No topics match your search") : E("notifications.noTopicsAvailableTitle", "No subscribable topics yet"),
301
+ description: R.trim() ? E("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : E("notifications.noTopicsAvailableDescription", "When marketing topics are published you can subscribe or unsubscribe from each one here.")
302
+ }) : q.map((e) => X({
299
303
  key: `TOPIC:${e.id}`,
300
304
  scope: "TOPIC",
301
305
  topicId: e.id,
@@ -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 {\n EmphasisPanel,\n IllustratedEmptyState,\n OptionalFields,\n PagePurpose,\n} 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\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-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-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-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-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-secondary\">\n {tr('notifications.loadingPreferences', 'Loading preferences...')}\n </div>\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 />\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,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,OAAO;EAAU;CACxE;EAAE,OAAO;EAAa,UAAU;EAA+B,OAAO;EAAa;CACpF;AAED,SAAS,EAAc,GAKpB;AAID,QAHI,EAAM,UAAU,YAAkB,WAAW,EAAM,WAAW,OAC9D,EAAM,UAAU,SAAe,QAAQ,EAAM,QAAQ,OACrD,EAAM,UAAU,UAAgB,SAAS,EAAM,WAAW,OACvD;;AAGT,SAAgB,IAA8B;CAC5C,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,mBAAgB,GAAiB,EACnC,EAAE,WAAQ,WAAW,MAAkB,EAAsB;EACjE,MAAM;EACN,UAAU;EACX,CAAC,EACI,EACJ,qBACA,WAAW,GACX,kBACA,wBACE,GAA4B,EAC1B,EAAE,8BAA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AI,WAAU;eACX,EAAG,kCAAkC,SAAS;KAC5C,CAAA,EACJ,IACC,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,oCAAoC,yBAAyB;KAC7D,CAAA,GACJ,EAAe,WAAW,IAC5B,kBAAC,GAAD;KACE,cAAc,EAAO,MAAM,GAAG,iBAAiB;KAC/C,OACE,EAAO,MAAM,GACT,EAAG,+BAA+B,8BAA8B,GAChE,EAAG,wCAAwC,6BAA6B;KAE9E,aACE,EAAO,MAAM,GACT,EAAG,yCAAyC,6BAA6B,GACzE,EACE,8CACA,2FACD;KAEP,CAAA,GAEF,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 {\n EmphasisPanel,\n IllustratedEmptyState,\n OptionalFields,\n PagePurpose,\n} 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 {\n topics,\n isLoading: topicsLoading,\n isForbidden: topicsForbidden,\n } = 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\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-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-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-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-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-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 />\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 />\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,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,EA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eAAe,EAAM;KACzC,CAAC,CACH,CAEK;;GACN"}
@@ -34,21 +34,21 @@ function v(e) {
34
34
  return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
35
35
  }
36
36
  function y() {
37
- let y = t(), { hasPermission: b, isLoading: x } = a(), { topics: S, isLoading: C, createTopic: w, updateTopic: T, deleteTopic: E } = e(), [D, O] = i(""), [k, A] = i(null), [j, M] = i({
37
+ let y = t(), { hasPermission: b, isLoading: x } = a(), { topics: S, isLoading: C, isForbidden: w, createTopic: T, updateTopic: E, deleteTopic: D } = e(), [O, k] = i(""), [A, j] = i(null), [M, N] = i({
38
38
  name: "",
39
39
  slug: "",
40
40
  description: "",
41
41
  type: "MARKETING",
42
42
  isActive: !0
43
- }), N = b(n.NOTIFICATION_CREATE), P = r(() => {
44
- if (!D.trim()) return S;
45
- let e = D.toLowerCase();
43
+ }), P = b(n.NOTIFICATION_CREATE), F = r(() => {
44
+ if (!O.trim()) return S;
45
+ let e = O.toLowerCase();
46
46
  return S.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
47
- }, [D, S]);
47
+ }, [O, S]);
48
48
  return x ? /* @__PURE__ */ u("div", {
49
49
  className: "flex h-64 items-center justify-center",
50
50
  children: /* @__PURE__ */ u("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
51
- }) : N ? /* @__PURE__ */ d("div", {
51
+ }) : P ? /* @__PURE__ */ d("div", {
52
52
  className: "space-y-6 p-4 sm:p-6",
53
53
  children: [
54
54
  /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h1", {
@@ -70,7 +70,7 @@ function y() {
70
70
  label: y("notifications.topicsNextNameLabel", "Name your first topic"),
71
71
  description: y("notifications.topicsNextNameDesc", "Use the form to add a clear topic like \"Product updates\" — the slug is generated for you."),
72
72
  onClick: () => {
73
- A(null), M((e) => ({
73
+ j(null), N((e) => ({
74
74
  ...e,
75
75
  name: "",
76
76
  slug: "",
@@ -105,7 +105,7 @@ function y() {
105
105
  children: /* @__PURE__ */ d("form", {
106
106
  className: "space-y-4",
107
107
  onSubmit: async (e) => {
108
- e.preventDefault(), !(!j.name.trim() || !j.slug.trim()) && (k ? await T(k, j) : await w(j), A(null), M({
108
+ e.preventDefault(), !(!M.name.trim() || !M.slug.trim()) && (A ? await E(A, M) : await T(M), j(null), N({
109
109
  name: "",
110
110
  slug: "",
111
111
  description: "",
@@ -121,7 +121,7 @@ function y() {
121
121
  className: "text-accent-primary"
122
122
  }), /* @__PURE__ */ u("h2", {
123
123
  className: "text-base font-semibold text-primary",
124
- children: k ? y("notifications.editTopic", "Edit Topic") : y("notifications.createTopic", "Create Topic")
124
+ children: A ? y("notifications.editTopic", "Edit Topic") : y("notifications.createTopic", "Create Topic")
125
125
  })]
126
126
  }),
127
127
  /* @__PURE__ */ d("label", {
@@ -129,11 +129,11 @@ function y() {
129
129
  children: [/* @__PURE__ */ u("span", { children: y("notifications.topicName", "Name") }), /* @__PURE__ */ u("input", {
130
130
  id: "notification-topic-name",
131
131
  type: "text",
132
- value: j.name,
133
- onChange: (e) => M((t) => ({
132
+ value: M.name,
133
+ onChange: (e) => N((t) => ({
134
134
  ...t,
135
135
  name: e.target.value,
136
- slug: k ? t.slug : v(e.target.value)
136
+ slug: A ? t.slug : v(e.target.value)
137
137
  })),
138
138
  className: "w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent"
139
139
  })]
@@ -142,8 +142,8 @@ function y() {
142
142
  className: "block space-y-1 text-sm text-secondary",
143
143
  children: [/* @__PURE__ */ u("span", { children: y("notifications.topicSlug", "Slug") }), /* @__PURE__ */ u("input", {
144
144
  type: "text",
145
- value: j.slug,
146
- onChange: (e) => M((t) => ({
145
+ value: M.slug,
146
+ onChange: (e) => N((t) => ({
147
147
  ...t,
148
148
  slug: v(e.target.value)
149
149
  })),
@@ -154,8 +154,8 @@ function y() {
154
154
  className: "block space-y-1 text-sm text-secondary",
155
155
  children: [/* @__PURE__ */ u("span", { children: y("notifications.topicType", "Type") }), /* @__PURE__ */ u("select", {
156
156
  id: "notification-topic-type",
157
- value: j.type,
158
- onChange: (e) => M((t) => ({
157
+ value: M.type,
158
+ onChange: (e) => N((t) => ({
159
159
  ...t,
160
160
  type: e.target.value
161
161
  })),
@@ -169,8 +169,8 @@ function y() {
169
169
  /* @__PURE__ */ d("label", {
170
170
  className: "block space-y-1 text-sm text-secondary",
171
171
  children: [/* @__PURE__ */ u("span", { children: y("notifications.topicDescription", "Description") }), /* @__PURE__ */ u("textarea", {
172
- value: j.description,
173
- onChange: (e) => M((t) => ({
172
+ value: M.description,
173
+ onChange: (e) => N((t) => ({
174
174
  ...t,
175
175
  description: e.target.value
176
176
  })),
@@ -182,8 +182,8 @@ function y() {
182
182
  className: "flex items-center gap-2 text-sm text-secondary",
183
183
  children: [/* @__PURE__ */ u("input", {
184
184
  type: "checkbox",
185
- checked: j.isActive,
186
- onChange: (e) => M((t) => ({
185
+ checked: M.isActive,
186
+ onChange: (e) => N((t) => ({
187
187
  ...t,
188
188
  isActive: e.target.checked
189
189
  }))
@@ -194,11 +194,11 @@ function y() {
194
194
  children: [/* @__PURE__ */ d("button", {
195
195
  type: "submit",
196
196
  className: "inline-flex items-center gap-2 rounded-md bg-accent-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90",
197
- children: [/* @__PURE__ */ u(s, { size: 16 }), k ? y("notifications.saveTopic", "Save Topic") : y("notifications.createTopicButton", "Create Topic")]
198
- }), k && /* @__PURE__ */ u("button", {
197
+ children: [/* @__PURE__ */ u(s, { size: 16 }), A ? y("notifications.saveTopic", "Save Topic") : y("notifications.createTopicButton", "Create Topic")]
198
+ }), A && /* @__PURE__ */ u("button", {
199
199
  type: "button",
200
200
  onClick: () => {
201
- A(null), M({
201
+ j(null), N({
202
202
  name: "",
203
203
  slug: "",
204
204
  description: "",
@@ -222,8 +222,8 @@ function y() {
222
222
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
223
223
  }), /* @__PURE__ */ u("input", {
224
224
  type: "text",
225
- value: D,
226
- onChange: (e) => O(e.target.value),
225
+ value: O,
226
+ onChange: (e) => k(e.target.value),
227
227
  placeholder: y("notifications.searchTopics", "Search topics..."),
228
228
  className: "w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent"
229
229
  })]
@@ -232,11 +232,15 @@ function y() {
232
232
  children: C ? /* @__PURE__ */ u("div", {
233
233
  className: "text-sm text-secondary",
234
234
  children: y("notifications.loadingTopics", "Loading topics...")
235
- }) : P.length === 0 ? /* @__PURE__ */ u(m, {
236
- illustration: D.trim() ? "empty-search" : "empty-data",
235
+ }) : w ? /* @__PURE__ */ u(m, {
236
+ illustration: "empty-generic",
237
+ title: y("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
238
+ description: y("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.")
239
+ }) : F.length === 0 ? /* @__PURE__ */ u(m, {
240
+ illustration: O.trim() ? "empty-search" : "empty-data",
237
241
  title: y("notifications.noTopicsFound", "No topics found."),
238
- description: D.trim() ? y("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : y("notifications.noTopicsYet", "No notification topics have been created yet.")
239
- }) : P.map((e) => /* @__PURE__ */ d("div", {
242
+ description: O.trim() ? y("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : y("notifications.noTopicsYet", "No notification topics have been created yet.")
243
+ }) : F.map((e) => /* @__PURE__ */ d("div", {
240
244
  className: "flex flex-col gap-3 rounded-lg border border-border-seam bg-surface p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)] sm:flex-row sm:items-start sm:justify-between",
241
245
  children: [/* @__PURE__ */ d("div", {
242
246
  className: "space-y-1",
@@ -276,7 +280,7 @@ function y() {
276
280
  children: [/* @__PURE__ */ u("button", {
277
281
  type: "button",
278
282
  onClick: () => {
279
- A(e.id), M({
283
+ j(e.id), N({
280
284
  name: e.name,
281
285
  slug: e.slug,
282
286
  description: e.description || "",
@@ -288,7 +292,7 @@ function y() {
288
292
  children: y("notifications.edit", "Edit")
289
293
  }), /* @__PURE__ */ d("button", {
290
294
  type: "button",
291
- onClick: () => E(e.id),
295
+ onClick: () => D(e.id),
292
296
  className: "inline-flex items-center gap-2 rounded-md border border-status-error-border px-3 py-2 text-sm text-status-error-text hover:bg-status-error-bg-subtle",
293
297
  children: [/* @__PURE__ */ u(l, { size: 14 }), y("notifications.delete", "Delete")]
294
298
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationTopicsPage.js","names":[],"sources":["../../src/pages/NotificationTopicsPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Plus, Save, Search, Trash2 } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\n\nconst topicTypeOptions = [\n { value: 'MARKETING', labelKey: 'notifications.topicType.marketing', label: 'Marketing' },\n {\n value: 'TRANSACTIONAL',\n labelKey: 'notifications.topicType.transactional',\n label: 'Transactional',\n },\n { value: 'SYSTEM', labelKey: 'notifications.topicType.system', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.topicType.alert', label: 'Alert' },\n];\n\nfunction slugify(value: string) {\n return value\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9\\s-]/g, '')\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-');\n}\n\nexport function NotificationTopicsPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { topics, isLoading, createTopic, updateTopic, deleteTopic } = useNotificationTopics();\n const [search, setSearch] = useState('');\n const [editingId, setEditingId] = useState<string | null>(null);\n const [form, setForm] = useState({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n\n // Topics live under the `notification` resource type in the backend (see\n // `global-notification-svc/src/modules/notification/schema/mutations.gql`),\n // and create/update/delete all require `notification:create` per the\n // @rbac directive. SUPER_ADMIN bypass is inherited from PermissionProvider.\n const canManage = hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_CREATE);\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 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 (!canManage) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionTopics',\n \"You don't have permission to manage notification topics.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-4 sm:p-6\">\n <div>\n <h1 className=\"text-2xl font-bold text-primary\">\n {tr('notifications.topicsTitle', 'Notification Topics')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.topicsSubtitle',\n 'Create topics for campaigns so users can subscribe or unsubscribe with precision.'\n )}\n </p>\n </div>\n\n <PagePurpose icon={<Plus size={16} />}>\n {tr(\n 'notifications.topicsPurpose',\n 'Topics group related notifications (e.g. \"Product updates\", \"Billing reminders\", \"Weekly digest\") so people can opt in or out of exactly what they care about. Create a topic here, then target it when sending a campaign and let users manage their own subscriptions in Preferences.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"notification-topics\"\n steps={[\n {\n id: 'name-topic',\n label: tr('notifications.topicsNextNameLabel', 'Name your first topic'),\n description: tr(\n 'notifications.topicsNextNameDesc',\n 'Use the form to add a clear topic like \"Product updates\" — the slug is generated for you.'\n ),\n onClick: () => {\n setEditingId(null);\n setForm((prev) => ({ ...prev, name: '', slug: '', type: 'MARKETING' }));\n document\n .getElementById('notification-topic-name')\n ?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n document.getElementById('notification-topic-name')?.focus();\n },\n },\n {\n id: 'set-type',\n label: tr('notifications.topicsNextTypeLabel', 'Pick the right type'),\n description: tr(\n 'notifications.topicsNextTypeDesc',\n 'Marketing topics are opt-in for users; Transactional, System and Alert reach everyone.'\n ),\n onClick: () =>\n document\n .getElementById('notification-topic-type')\n ?.scrollIntoView({ behavior: 'smooth', block: 'center' }),\n },\n {\n id: 'let-subscribe',\n label: tr('notifications.topicsNextSubscribeLabel', 'Let people subscribe'),\n description: tr(\n 'notifications.topicsNextSubscribeDesc',\n 'Once a topic is active, users manage their own opt-ins from the Preferences page.'\n ),\n href: '../preferences',\n },\n ]}\n />\n\n <div className=\"grid gap-6 xl:grid-cols-[380px,1fr]\">\n {/* Single emphasis zone — the create/edit form is the primary action on this page. */}\n <EmphasisPanel className=\"p-4\">\n <form\n className=\"space-y-4\"\n onSubmit={async (event) => {\n event.preventDefault();\n\n if (!form.name.trim() || !form.slug.trim()) {\n return;\n }\n\n if (editingId) {\n await updateTopic(editingId, form);\n } else {\n await createTopic(form);\n }\n\n setEditingId(null);\n setForm({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n }}\n >\n <div className=\"flex items-center gap-2\">\n <Plus size={18} className=\"text-accent-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {editingId\n ? tr('notifications.editTopic', 'Edit Topic')\n : tr('notifications.createTopic', 'Create Topic')}\n </h2>\n </div>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicName', 'Name')}</span>\n <input\n id=\"notification-topic-name\"\n type=\"text\"\n value={form.name}\n onChange={(event) =>\n setForm((prev) => ({\n ...prev,\n name: event.target.value,\n slug: editingId ? prev.slug : slugify(event.target.value),\n }))\n }\n className=\"w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicSlug', 'Slug')}</span>\n <input\n type=\"text\"\n value={form.slug}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, slug: slugify(event.target.value) }))\n }\n className=\"w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicType', 'Type')}</span>\n <select\n id=\"notification-topic-type\"\n value={form.type}\n onChange={(event) => setForm((prev) => ({ ...prev, type: event.target.value }))}\n className=\"w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n {topicTypeOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicDescription', 'Description')}</span>\n <textarea\n value={form.description}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, description: event.target.value }))\n }\n rows={4}\n className=\"w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <label className=\"flex items-center gap-2 text-sm text-secondary\">\n <input\n type=\"checkbox\"\n checked={form.isActive}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, isActive: event.target.checked }))\n }\n />\n <span>{tr('notifications.topicIsActive', 'Active topic')}</span>\n </label>\n\n <div className=\"flex items-center gap-3\">\n <button\n type=\"submit\"\n className=\"inline-flex items-center gap-2 rounded-md bg-accent-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90\"\n >\n <Save size={16} />\n {editingId\n ? tr('notifications.saveTopic', 'Save Topic')\n : tr('notifications.createTopicButton', 'Create Topic')}\n </button>\n\n {editingId && (\n <button\n type=\"button\"\n onClick={() => {\n setEditingId(null);\n setForm({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n }}\n className=\"rounded-md border border-default px-4 py-2 text-sm text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.cancelTopicEdit', 'Cancel')}\n </button>\n )}\n </div>\n </form>\n </EmphasisPanel>\n\n <GlassCard treatment=\"plain\" className=\"space-y-4 border-border-seam p-4\">\n <div className=\"relative max-w-md\">\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 placeholder={tr('notifications.searchTopics', 'Search topics...')}\n className=\"w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </div>\n\n <div className=\"space-y-3\">\n {isLoading ? (\n <div className=\"text-sm text-secondary\">\n {tr('notifications.loadingTopics', 'Loading topics...')}\n </div>\n ) : filteredTopics.length === 0 ? (\n <IllustratedEmptyState\n illustration={search.trim() ? 'empty-search' : 'empty-data'}\n title={tr('notifications.noTopicsFound', 'No topics found.')}\n description={\n search.trim()\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.noTopicsYet',\n 'No notification topics have been created yet.'\n )\n }\n />\n ) : (\n filteredTopics.map((topic) => (\n <div\n key={topic.id}\n className=\"flex flex-col gap-3 rounded-lg border border-border-seam bg-surface p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)] sm:flex-row sm:items-start sm:justify-between\"\n >\n <div className=\"space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h3 className=\"text-sm font-semibold text-primary\">{topic.name}</h3>\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {topic.slug}\n </span>\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {topic.type}\n </span>\n </div>\n {topic.description && (\n <p className=\"text-sm text-secondary\">{topic.description}</p>\n )}\n <p className=\"text-xs text-tertiary\">\n {tr('notifications.topicSubscribers', 'Subscribers')}: {topic.subscriberCount}\n </p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => {\n setEditingId(topic.id);\n setForm({\n name: topic.name,\n slug: topic.slug,\n description: topic.description || '',\n type: topic.type,\n isActive: topic.isActive,\n });\n }}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.edit', 'Edit')}\n </button>\n <button\n type=\"button\"\n onClick={() => deleteTopic(topic.id)}\n className=\"inline-flex items-center gap-2 rounded-md border border-status-error-border px-3 py-2 text-sm text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n <Trash2 size={14} />\n {tr('notifications.delete', 'Delete')}\n </button>\n </div>\n </div>\n ))\n )}\n </div>\n </GlassCard>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAcA,IAAM,IAAmB;CACvB;EAAE,OAAO;EAAa,UAAU;EAAqC,OAAO;EAAa;CACzF;EACE,OAAO;EACP,UAAU;EACV,OAAO;EACR;CACD;EAAE,OAAO;EAAU,UAAU;EAAkC,OAAO;EAAU;CAChF;EAAE,OAAO;EAAS,UAAU;EAAiC,OAAO;EAAS;CAC9E;AAED,SAAS,EAAQ,GAAe;AAC9B,QAAO,EACJ,aAAa,CACb,MAAM,CACN,QAAQ,iBAAiB,GAAG,CAC5B,QAAQ,QAAQ,IAAI,CACpB,QAAQ,OAAO,IAAI;;AAGxB,SAAgB,IAAyB;CACvC,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB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M,WAAU;sBACb,EAAM;YACF,CAAA;WACH;;SACL,EAAM,eACL,kBAAC,KAAD;UAAG,WAAU;oBAA0B,EAAM;UAAgB,CAAA;SAE/D,kBAAC,KAAD;UAAG,WAAU;oBAAb;WACG,EAAG,kCAAkC,cAAc;WAAC;WAAG,EAAM;WAC5D;;SACA;WAEN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,UAAD;SACE,MAAK;SACL,eAAe;AAEb,UADA,EAAa,EAAM,GAAG,EACtB,EAAQ;WACN,MAAM,EAAM;WACZ,MAAM,EAAM;WACZ,aAAa,EAAM,eAAe;WAClC,MAAM,EAAM;WACZ,UAAU,EAAM;WACjB,CAAC;;SAEJ,WAAU;mBAET,EAAG,sBAAsB,OAAO;SAC1B,CAAA,EACT,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAY,EAAM,GAAG;SACpC,WAAU;mBAHZ,CAKE,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA,EACnB,EAAG,wBAAwB,SAAS,CAC9B;WACL;UACF;SA/CC,EAAM,GA+CP,CACN;MAEA,CAAA,CACI;OACR;;GACF;MAzSJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,oCACA,2DACD;EACG,CAAA"}
1
+ {"version":3,"file":"NotificationTopicsPage.js","names":[],"sources":["../../src/pages/NotificationTopicsPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Plus, Save, Search, Trash2 } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\n\nconst topicTypeOptions = [\n { value: 'MARKETING', labelKey: 'notifications.topicType.marketing', label: 'Marketing' },\n {\n value: 'TRANSACTIONAL',\n labelKey: 'notifications.topicType.transactional',\n label: 'Transactional',\n },\n { value: 'SYSTEM', labelKey: 'notifications.topicType.system', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.topicType.alert', label: 'Alert' },\n];\n\nfunction slugify(value: string) {\n return value\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9\\s-]/g, '')\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-');\n}\n\nexport function NotificationTopicsPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { topics, isLoading, isForbidden, createTopic, updateTopic, deleteTopic } =\n useNotificationTopics();\n const [search, setSearch] = useState('');\n const [editingId, setEditingId] = useState<string | null>(null);\n const [form, setForm] = useState({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n\n // Topics live under the `notification` resource type in the backend (see\n // `global-notification-svc/src/modules/notification/schema/mutations.gql`),\n // and create/update/delete all require `notification:create` per the\n // @rbac directive. SUPER_ADMIN bypass is inherited from PermissionProvider.\n const canManage = hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_CREATE);\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 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 (!canManage) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionTopics',\n \"You don't have permission to manage notification topics.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-4 sm:p-6\">\n <div>\n <h1 className=\"text-2xl font-bold text-primary\">\n {tr('notifications.topicsTitle', 'Notification Topics')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.topicsSubtitle',\n 'Create topics for campaigns so users can subscribe or unsubscribe with precision.'\n )}\n </p>\n </div>\n\n <PagePurpose icon={<Plus size={16} />}>\n {tr(\n 'notifications.topicsPurpose',\n 'Topics group related notifications (e.g. \"Product updates\", \"Billing reminders\", \"Weekly digest\") so people can opt in or out of exactly what they care about. Create a topic here, then target it when sending a campaign and let users manage their own subscriptions in Preferences.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"notification-topics\"\n steps={[\n {\n id: 'name-topic',\n label: tr('notifications.topicsNextNameLabel', 'Name your first topic'),\n description: tr(\n 'notifications.topicsNextNameDesc',\n 'Use the form to add a clear topic like \"Product updates\" — the slug is generated for you.'\n ),\n onClick: () => {\n setEditingId(null);\n setForm((prev) => ({ ...prev, name: '', slug: '', type: 'MARKETING' }));\n document\n .getElementById('notification-topic-name')\n ?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n document.getElementById('notification-topic-name')?.focus();\n },\n },\n {\n id: 'set-type',\n label: tr('notifications.topicsNextTypeLabel', 'Pick the right type'),\n description: tr(\n 'notifications.topicsNextTypeDesc',\n 'Marketing topics are opt-in for users; Transactional, System and Alert reach everyone.'\n ),\n onClick: () =>\n document\n .getElementById('notification-topic-type')\n ?.scrollIntoView({ behavior: 'smooth', block: 'center' }),\n },\n {\n id: 'let-subscribe',\n label: tr('notifications.topicsNextSubscribeLabel', 'Let people subscribe'),\n description: tr(\n 'notifications.topicsNextSubscribeDesc',\n 'Once a topic is active, users manage their own opt-ins from the Preferences page.'\n ),\n href: '../preferences',\n },\n ]}\n />\n\n <div className=\"grid gap-6 xl:grid-cols-[380px,1fr]\">\n {/* Single emphasis zone — the create/edit form is the primary action on this page. */}\n <EmphasisPanel className=\"p-4\">\n <form\n className=\"space-y-4\"\n onSubmit={async (event) => {\n event.preventDefault();\n\n if (!form.name.trim() || !form.slug.trim()) {\n return;\n }\n\n if (editingId) {\n await updateTopic(editingId, form);\n } else {\n await createTopic(form);\n }\n\n setEditingId(null);\n setForm({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n }}\n >\n <div className=\"flex items-center gap-2\">\n <Plus size={18} className=\"text-accent-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {editingId\n ? tr('notifications.editTopic', 'Edit Topic')\n : tr('notifications.createTopic', 'Create Topic')}\n </h2>\n </div>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicName', 'Name')}</span>\n <input\n id=\"notification-topic-name\"\n type=\"text\"\n value={form.name}\n onChange={(event) =>\n setForm((prev) => ({\n ...prev,\n name: event.target.value,\n slug: editingId ? prev.slug : slugify(event.target.value),\n }))\n }\n className=\"w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicSlug', 'Slug')}</span>\n <input\n type=\"text\"\n value={form.slug}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, slug: slugify(event.target.value) }))\n }\n className=\"w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicType', 'Type')}</span>\n <select\n id=\"notification-topic-type\"\n value={form.type}\n onChange={(event) => setForm((prev) => ({ ...prev, type: event.target.value }))}\n className=\"w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n {topicTypeOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicDescription', 'Description')}</span>\n <textarea\n value={form.description}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, description: event.target.value }))\n }\n rows={4}\n className=\"w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <label className=\"flex items-center gap-2 text-sm text-secondary\">\n <input\n type=\"checkbox\"\n checked={form.isActive}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, isActive: event.target.checked }))\n }\n />\n <span>{tr('notifications.topicIsActive', 'Active topic')}</span>\n </label>\n\n <div className=\"flex items-center gap-3\">\n <button\n type=\"submit\"\n className=\"inline-flex items-center gap-2 rounded-md bg-accent-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90\"\n >\n <Save size={16} />\n {editingId\n ? tr('notifications.saveTopic', 'Save Topic')\n : tr('notifications.createTopicButton', 'Create Topic')}\n </button>\n\n {editingId && (\n <button\n type=\"button\"\n onClick={() => {\n setEditingId(null);\n setForm({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n }}\n className=\"rounded-md border border-default px-4 py-2 text-sm text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.cancelTopicEdit', 'Cancel')}\n </button>\n )}\n </div>\n </form>\n </EmphasisPanel>\n\n <GlassCard treatment=\"plain\" className=\"space-y-4 border-border-seam p-4\">\n <div className=\"relative max-w-md\">\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 placeholder={tr('notifications.searchTopics', 'Search topics...')}\n className=\"w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </div>\n\n <div className=\"space-y-3\">\n {isLoading ? (\n <div className=\"text-sm text-secondary\">\n {tr('notifications.loadingTopics', 'Loading topics...')}\n </div>\n ) : isForbidden ? (\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 />\n ) : filteredTopics.length === 0 ? (\n <IllustratedEmptyState\n illustration={search.trim() ? 'empty-search' : 'empty-data'}\n title={tr('notifications.noTopicsFound', 'No topics found.')}\n description={\n search.trim()\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.noTopicsYet',\n 'No notification topics have been created yet.'\n )\n }\n />\n ) : (\n filteredTopics.map((topic) => (\n <div\n key={topic.id}\n className=\"flex flex-col gap-3 rounded-lg border border-border-seam bg-surface p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)] sm:flex-row sm:items-start sm:justify-between\"\n >\n <div className=\"space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h3 className=\"text-sm font-semibold text-primary\">{topic.name}</h3>\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {topic.slug}\n </span>\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {topic.type}\n </span>\n </div>\n {topic.description && (\n <p className=\"text-sm text-secondary\">{topic.description}</p>\n )}\n <p className=\"text-xs text-tertiary\">\n {tr('notifications.topicSubscribers', 'Subscribers')}: {topic.subscriberCount}\n </p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => {\n setEditingId(topic.id);\n setForm({\n name: topic.name,\n slug: topic.slug,\n description: topic.description || '',\n type: topic.type,\n isActive: topic.isActive,\n });\n }}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.edit', 'Edit')}\n </button>\n <button\n type=\"button\"\n onClick={() => deleteTopic(topic.id)}\n className=\"inline-flex items-center gap-2 rounded-md border border-status-error-border px-3 py-2 text-sm text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n <Trash2 size={14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