@burdenoff/microfe-notification 2026.1013.1 → 2026.1013.2

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.
@@ -130,7 +130,7 @@ function O() {
130
130
  /* @__PURE__ */ h("select", {
131
131
  value: P.type,
132
132
  onChange: (e) => z({ type: e.target.value }),
133
- className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150",
133
+ className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
134
134
  children: [/* @__PURE__ */ m("option", {
135
135
  value: "ALL",
136
136
  children: O("notifications.allTypes", "All Types")
@@ -142,7 +142,7 @@ function O() {
142
142
  /* @__PURE__ */ h("select", {
143
143
  value: P.priority,
144
144
  onChange: (e) => z({ priority: e.target.value }),
145
- className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150",
145
+ className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
146
146
  children: [/* @__PURE__ */ m("option", {
147
147
  value: "ALL",
148
148
  children: O("notifications.allPriorities", "All Priorities")
@@ -154,7 +154,7 @@ function O() {
154
154
  /* @__PURE__ */ h("select", {
155
155
  value: P.topicId || "",
156
156
  onChange: (e) => z({ topicId: e.target.value || void 0 }),
157
- className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150",
157
+ className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
158
158
  children: [/* @__PURE__ */ m("option", {
159
159
  value: "",
160
160
  children: O("notifications.allTopics", "All Topics")
@@ -166,7 +166,7 @@ function O() {
166
166
  /* @__PURE__ */ h("select", {
167
167
  value: P.isRead === null ? "ALL" : P.isRead ? "READ" : "UNREAD",
168
168
  onChange: (e) => z({ isRead: e.target.value === "ALL" ? null : e.target.value === "READ" }),
169
- className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150",
169
+ className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
170
170
  children: [
171
171
  /* @__PURE__ */ m("option", {
172
172
  value: "ALL",
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationCenterPage.js","names":[],"sources":["../../src/pages/NotificationCenterPage.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Search, CheckCheck, BellRing } from 'lucide-react';\nimport { PushOptInToggle } from '@burdenoff/fe-libs/chrome';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n AuroraBackground,\n Button,\n EmphasisPanel,\n GlassCard,\n GradientText,\n IllustratedEmptyState,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { filterNotifications, groupNotificationsByDate } from '../utils';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationPriority, NotificationType } from '../types';\n\nconst CENTER_FILTER = { archived: false, channel: 'IN_APP' as const };\nconst CENTER_UNREAD_FILTER = { channel: 'IN_APP' };\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alert' },\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\nconst PRIORITY_OPTIONS: Array<{ value: NotificationPriority; labelKey: string; label: string }> = [\n { value: 'URGENT', labelKey: 'notifications.priorityUrgent', label: 'Urgent' },\n { value: 'HIGH', labelKey: 'notifications.priorityHigh', label: 'High' },\n { value: 'NORMAL', labelKey: 'notifications.priorityNormal', label: 'Normal' },\n { value: 'LOW', labelKey: 'notifications.priorityLow', label: 'Low' },\n];\n\n/**\n * Notification Center Page\n *\n * Main page for viewing and managing in-app notifications\n */\nexport function NotificationCenterPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n notifications,\n unreadCount,\n notificationFilter,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n updateFilter,\n resetFilter,\n } = useNotifications({ baseFilter: CENTER_FILTER, unreadFilter: CENTER_UNREAD_FILTER });\n const { topics } = useNotificationTopics({ isActive: true });\n\n // Filter and group notifications\n const filteredNotifications = useMemo(\n () => filterNotifications(notifications, notificationFilter),\n [notifications, notificationFilter]\n );\n const groupedNotifications = useMemo(\n () => groupNotificationsByDate(filteredNotifications, tr),\n [filteredNotifications, tr]\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('notifications.noPermissionView', \"You don't have permission to view notifications.\")}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<BellRing size={16} />}>\n {tr(\n 'notifications.centerPurpose',\n 'Your in-app inbox. Everything the platform needs you to see — task assignments, mentions, alerts and system updates — lands here. Filter by type, priority or topic, mark items as read, and archive what you no longer need.'\n )}\n </PagePurpose>\n\n {/* Header — the page's single emphasis zone (unread summary + the one CTA).\n Wrapped in a relative overflow-hidden container so the AuroraBackground\n can sit behind it (at -z-10) without ever moving content. This is the\n MFE's single aurora hero. */}\n <div className=\"relative overflow-hidden rounded-2xl\">\n <AuroraBackground intensity=\"subtle\" />\n <EmphasisPanel\n data-tour=\"notification-center-header\"\n className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\"\n >\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n <GradientText>{tr('notifications.centerTitle', 'Notification Center')}</GradientText>\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {unreadCount > 0 ? (\n <>\n {tr('notifications.youHave', 'You have')}{' '}\n <span\n className=\"inline-flex items-center gap-1.5 font-semibold text-primary\"\n data-tour=\"notification-center-unread-count\"\n >\n <span className=\"inline-block h-2 w-2 rounded-full bg-accent-primary motion-safe:animate-vc-glow-pulse\" />\n {unreadCount}\n </span>{' '}\n {tr(\n unreadCount === 1\n ? 'notifications.unreadNotification'\n : 'notifications.unreadNotifications',\n unreadCount === 1 ? 'unread notification' : 'unread notifications'\n )}\n </>\n ) : (\n tr('notifications.allCaughtUp', 'All caught up!')\n )}\n </p>\n </div>\n\n {unreadCount > 0 && (\n <Button\n data-tour=\"notification-center-mark-all-read\"\n variant=\"outline\"\n onClick={markAllAsRead}\n className=\"gap-2\"\n >\n <CheckCheck size={16} />\n {tr('notifications.markAllAsRead', 'Mark All as Read')}\n </Button>\n )}\n </EmphasisPanel>\n </div>\n\n {/* Push opt-in — renders nothing when the surface has no push support\n (web without a service worker, or a shell that never registered a\n controller), so no wrapper card here to avoid an empty box in that\n case. Placed here too since this page, not just the bell dropdown,\n can be the first notification surface a user reaches. */}\n <PushOptInToggle />\n\n {/* Filters */}\n <GlassCard\n treatment=\"plain\"\n data-tour=\"notification-center-filters\"\n className=\"flex flex-col gap-3 border-border-seam p-3 sm:flex-row sm:flex-wrap sm:items-center sm:gap-4 sm:p-4\"\n >\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n data-tour=\"notification-center-search\"\n type=\"text\"\n placeholder={tr('notifications.searchPlaceholder', 'Search notifications...')}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n {/* Type filter */}\n <select\n value={notificationFilter.type}\n onChange={(e) => updateFilter({ type: e.target.value as NotificationType | 'ALL' })}\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n >\n <option value=\"ALL\">{tr('notifications.allTypes', 'All Types')}</option>\n {TYPE_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n\n {/* Priority filter */}\n <select\n value={notificationFilter.priority}\n onChange={(e) =>\n updateFilter({ priority: e.target.value as NotificationPriority | 'ALL' })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n >\n <option value=\"ALL\">{tr('notifications.allPriorities', 'All Priorities')}</option>\n {PRIORITY_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n\n <select\n value={notificationFilter.topicId || ''}\n onChange={(e) => updateFilter({ topicId: e.target.value || undefined })}\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n {/* Read/Unread filter */}\n <select\n value={\n notificationFilter.isRead === null\n ? 'ALL'\n : notificationFilter.isRead\n ? 'READ'\n : 'UNREAD'\n }\n onChange={(e) =>\n updateFilter({\n isRead: e.target.value === 'ALL' ? null : e.target.value === 'READ',\n })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n >\n <option value=\"ALL\">{tr('notifications.filterAll', 'All')}</option>\n <option value=\"UNREAD\">{tr('notifications.filterUnread', 'Unread')}</option>\n <option value=\"READ\">{tr('notifications.filterRead', 'Read')}</option>\n </select>\n\n {/* Reset filters */}\n {(notificationFilter.search ||\n notificationFilter.type !== 'ALL' ||\n notificationFilter.priority !== 'ALL' ||\n notificationFilter.isRead !== null ||\n Boolean(notificationFilter.topicId)) && (\n <button\n onClick={resetFilter}\n className=\"px-3 py-2 text-sm text-tertiary hover:text-primary transition-colors duration-150\"\n >\n {tr('notifications.resetFilters', 'Reset')}\n </button>\n )}\n </GlassCard>\n\n {/* Notifications list */}\n <div data-tour=\"notification-center-list\" className=\"space-y-6\">\n {filteredNotifications.length > 0 ? (\n Object.entries(groupedNotifications).map(([group, groupNotifications]) => (\n <div key={group} className=\"animate-in fade-in slide-in-from-bottom-2 duration-200\">\n <h2 className=\"text-sm font-semibold text-tertiary mb-3\">{group}</h2>\n <div className=\"space-y-2\">\n {groupNotifications.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n analyticsSource=\"center\"\n />\n ))}\n </div>\n </div>\n ))\n ) : (\n <div className=\"animate-in fade-in duration-200\">\n <IllustratedEmptyState\n illustration={notifications.length === 0 ? 'empty-notifications' : 'empty-search'}\n title={tr('notifications.noNotificationsFound', 'No notifications found')}\n description={\n notifications.length === 0\n ? tr(\n 'notifications.noNotificationsYet',\n \"You don't have any notifications yet. We'll notify you when something important happens.\"\n )\n : tr(\n 'notifications.adjustFilters',\n 'Try adjusting your filters to see more notifications.'\n )\n }\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,IAAM,IAAgB;CAAE,UAAU;CAAO,SAAS;CAAmB,EAC/D,IAAuB,EAAE,SAAS,UAAU,EAC5C,IAAoF;CACxF;EAAE,OAAO;EAAU,UAAU;EAA4B,OAAO;EAAU;CAC1E;EAAE,OAAO;EAAS,UAAU;EAA2B,OAAO;EAAS;CACvE;EAAE,OAAO;EAAiB,UAAU;EAAmC,OAAO;EAAiB;CAC/F;EAAE,OAAO;EAAa,UAAU;EAA+B,OAAO;EAAa;CACpF,EACK,IAA4F;CAChG;EAAE,OAAO;EAAU,UAAU;EAAgC,OAAO;EAAU;CAC9E;EAAE,OAAO;EAAQ,UAAU;EAA8B,OAAO;EAAQ;CACxE;EAAE,OAAO;EAAU,UAAU;EAAgC,OAAO;EAAU;CAC9E;EAAE,OAAO;EAAO,UAAU;EAA6B,OAAO;EAAO;CACtE;AAOD,SAAgB,IAAyB;CACvC,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,mBAAgB,GAAiB,EACnC,EACJ,kBACA,gBACA,uBACA,eACA,kBACA,wBACA,iBACA,iBACA,mBACE,EAAiB;EAAE,YAAY;EAAe,cAAc;EAAsB,CAAC,EACjF,EAAE,cAAW,EAAsB,EAAE,UAAU,IAAM,CAAC,EAGtD,IAAwB,QACtB,EAAoB,GAAe,EAAmB,EAC5D,CAAC,GAAe,EAAmB,CACpC,EACK,IAAuB,QACrB,EAAyB,GAAuB,EAAG,EACzD,CAAC,GAAuB,EAAG,CAC5B;AAkBD,QAhBI,IAEA,kBAAC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}
1
+ {"version":3,"file":"NotificationCenterPage.js","names":[],"sources":["../../src/pages/NotificationCenterPage.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Search, CheckCheck, BellRing } from 'lucide-react';\nimport { PushOptInToggle } from '@burdenoff/fe-libs/chrome';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n AuroraBackground,\n Button,\n EmphasisPanel,\n GlassCard,\n GradientText,\n IllustratedEmptyState,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { filterNotifications, groupNotificationsByDate } from '../utils';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationPriority, NotificationType } from '../types';\n\nconst CENTER_FILTER = { archived: false, channel: 'IN_APP' as const };\nconst CENTER_UNREAD_FILTER = { channel: 'IN_APP' };\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alert' },\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\nconst PRIORITY_OPTIONS: Array<{ value: NotificationPriority; labelKey: string; label: string }> = [\n { value: 'URGENT', labelKey: 'notifications.priorityUrgent', label: 'Urgent' },\n { value: 'HIGH', labelKey: 'notifications.priorityHigh', label: 'High' },\n { value: 'NORMAL', labelKey: 'notifications.priorityNormal', label: 'Normal' },\n { value: 'LOW', labelKey: 'notifications.priorityLow', label: 'Low' },\n];\n\n/**\n * Notification Center Page\n *\n * Main page for viewing and managing in-app notifications\n */\nexport function NotificationCenterPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n notifications,\n unreadCount,\n notificationFilter,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n updateFilter,\n resetFilter,\n } = useNotifications({ baseFilter: CENTER_FILTER, unreadFilter: CENTER_UNREAD_FILTER });\n const { topics } = useNotificationTopics({ isActive: true });\n\n // Filter and group notifications\n const filteredNotifications = useMemo(\n () => filterNotifications(notifications, notificationFilter),\n [notifications, notificationFilter]\n );\n const groupedNotifications = useMemo(\n () => groupNotificationsByDate(filteredNotifications, tr),\n [filteredNotifications, tr]\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('notifications.noPermissionView', \"You don't have permission to view notifications.\")}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<BellRing size={16} />}>\n {tr(\n 'notifications.centerPurpose',\n 'Your in-app inbox. Everything the platform needs you to see — task assignments, mentions, alerts and system updates — lands here. Filter by type, priority or topic, mark items as read, and archive what you no longer need.'\n )}\n </PagePurpose>\n\n {/* Header — the page's single emphasis zone (unread summary + the one CTA).\n Wrapped in a relative overflow-hidden container so the AuroraBackground\n can sit behind it (at -z-10) without ever moving content. This is the\n MFE's single aurora hero. */}\n <div className=\"relative overflow-hidden rounded-2xl\">\n <AuroraBackground intensity=\"subtle\" />\n <EmphasisPanel\n data-tour=\"notification-center-header\"\n className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\"\n >\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n <GradientText>{tr('notifications.centerTitle', 'Notification Center')}</GradientText>\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {unreadCount > 0 ? (\n <>\n {tr('notifications.youHave', 'You have')}{' '}\n <span\n className=\"inline-flex items-center gap-1.5 font-semibold text-primary\"\n data-tour=\"notification-center-unread-count\"\n >\n <span className=\"inline-block h-2 w-2 rounded-full bg-accent-primary motion-safe:animate-vc-glow-pulse\" />\n {unreadCount}\n </span>{' '}\n {tr(\n unreadCount === 1\n ? 'notifications.unreadNotification'\n : 'notifications.unreadNotifications',\n unreadCount === 1 ? 'unread notification' : 'unread notifications'\n )}\n </>\n ) : (\n tr('notifications.allCaughtUp', 'All caught up!')\n )}\n </p>\n </div>\n\n {unreadCount > 0 && (\n <Button\n data-tour=\"notification-center-mark-all-read\"\n variant=\"outline\"\n onClick={markAllAsRead}\n className=\"gap-2\"\n >\n <CheckCheck size={16} />\n {tr('notifications.markAllAsRead', 'Mark All as Read')}\n </Button>\n )}\n </EmphasisPanel>\n </div>\n\n {/* Push opt-in — renders nothing when the surface has no push support\n (web without a service worker, or a shell that never registered a\n controller), so no wrapper card here to avoid an empty box in that\n case. Placed here too since this page, not just the bell dropdown,\n can be the first notification surface a user reaches. */}\n <PushOptInToggle />\n\n {/* Filters */}\n <GlassCard\n treatment=\"plain\"\n data-tour=\"notification-center-filters\"\n className=\"flex flex-col gap-3 border-border-seam p-3 sm:flex-row sm:flex-wrap sm:items-center sm:gap-4 sm:p-4\"\n >\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n data-tour=\"notification-center-search\"\n type=\"text\"\n placeholder={tr('notifications.searchPlaceholder', 'Search notifications...')}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n {/* Type filter */}\n <select\n value={notificationFilter.type}\n onChange={(e) => updateFilter({ type: e.target.value as NotificationType | 'ALL' })}\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.allTypes', 'All Types')}</option>\n {TYPE_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n\n {/* Priority filter */}\n <select\n value={notificationFilter.priority}\n onChange={(e) =>\n updateFilter({ priority: e.target.value as NotificationPriority | 'ALL' })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.allPriorities', 'All Priorities')}</option>\n {PRIORITY_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n\n <select\n value={notificationFilter.topicId || ''}\n onChange={(e) => updateFilter({ topicId: e.target.value || undefined })}\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n {/* Read/Unread filter */}\n <select\n value={\n notificationFilter.isRead === null\n ? 'ALL'\n : notificationFilter.isRead\n ? 'READ'\n : 'UNREAD'\n }\n onChange={(e) =>\n updateFilter({\n isRead: e.target.value === 'ALL' ? null : e.target.value === 'READ',\n })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.filterAll', 'All')}</option>\n <option value=\"UNREAD\">{tr('notifications.filterUnread', 'Unread')}</option>\n <option value=\"READ\">{tr('notifications.filterRead', 'Read')}</option>\n </select>\n\n {/* Reset filters */}\n {(notificationFilter.search ||\n notificationFilter.type !== 'ALL' ||\n notificationFilter.priority !== 'ALL' ||\n notificationFilter.isRead !== null ||\n Boolean(notificationFilter.topicId)) && (\n <button\n onClick={resetFilter}\n className=\"px-3 py-2 text-sm text-tertiary hover:text-primary transition-colors duration-150\"\n >\n {tr('notifications.resetFilters', 'Reset')}\n </button>\n )}\n </GlassCard>\n\n {/* Notifications list */}\n <div data-tour=\"notification-center-list\" className=\"space-y-6\">\n {filteredNotifications.length > 0 ? (\n Object.entries(groupedNotifications).map(([group, groupNotifications]) => (\n <div key={group} className=\"animate-in fade-in slide-in-from-bottom-2 duration-200\">\n <h2 className=\"text-sm font-semibold text-tertiary mb-3\">{group}</h2>\n <div className=\"space-y-2\">\n {groupNotifications.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n analyticsSource=\"center\"\n />\n ))}\n </div>\n </div>\n ))\n ) : (\n <div className=\"animate-in fade-in duration-200\">\n <IllustratedEmptyState\n illustration={notifications.length === 0 ? 'empty-notifications' : 'empty-search'}\n title={tr('notifications.noNotificationsFound', 'No notifications found')}\n description={\n notifications.length === 0\n ? tr(\n 'notifications.noNotificationsYet',\n \"You don't have any notifications yet. We'll notify you when something important happens.\"\n )\n : tr(\n 'notifications.adjustFilters',\n 'Try adjusting your filters to see more notifications.'\n )\n }\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,IAAM,IAAgB;CAAE,UAAU;CAAO,SAAS;CAAmB,EAC/D,IAAuB,EAAE,SAAS,UA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OAC5E,kBAAC,UAAD;QAAQ,OAAM;kBAAQ,EAAG,4BAA4B,OAAO;QAAU,CAAA;OAC/D;;MAGP,EAAmB,UACnB,EAAmB,SAAS,SAC5B,EAAmB,aAAa,SAChC,EAAmB,WAAW,QAC9B,EAAQ,EAAmB,YAC3B,kBAAC,UAAD;MACE,SAAS;MACT,WAAU;gBAET,EAAG,8BAA8B,QAAQ;MACnC,CAAA;KAED;;GAGZ,kBAAC,OAAD;IAAK,aAAU;IAA2B,WAAU;cACjD,EAAsB,SAAS,IAC9B,OAAO,QAAQ,EAAqB,CAAC,KAAK,CAAC,GAAO,OAChD,kBAAC,OAAD;KAAiB,WAAU;eAA3B,CACE,kBAAC,MAAD;MAAI,WAAU;gBAA4C;MAAW,CAAA,EACrE,kBAAC,OAAD;MAAK,WAAU;gBACZ,EAAmB,KAAK,MACvB,kBAAC,GAAD;OAEgB;OACd,cAAc;OACd,WAAW;OACX,UAAU;OACV,iBAAgB;OAChB,EANK,EAAa,GAMlB,CACF;MACE,CAAA,CACF;OAdI,EAcJ,CACN,GAEF,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD;MACE,cAAc,EAAc,WAAW,IAAI,wBAAwB;MACnE,OAAO,EAAG,sCAAsC,yBAAyB;MACzE,aACE,EAAc,WAAW,IACrB,EACE,oCACA,2FACD,GACD,EACE,+BACA,wDACD;MAEP,CAAA;KACE,CAAA;IAEJ,CAAA;GACF"}
@@ -99,7 +99,7 @@ function C() {
99
99
  ...t,
100
100
  status: e.target.value
101
101
  })),
102
- className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary",
102
+ className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
103
103
  children: [
104
104
  /* @__PURE__ */ p("option", {
105
105
  value: "all",
@@ -133,7 +133,7 @@ function C() {
133
133
  ...t,
134
134
  channel: e.target.value
135
135
  })),
136
- className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary",
136
+ className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
137
137
  children: [
138
138
  /* @__PURE__ */ p("option", {
139
139
  value: "all",
@@ -167,7 +167,7 @@ function C() {
167
167
  ...t,
168
168
  deliveryStatus: e.target.value
169
169
  })),
170
- className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary",
170
+ className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
171
171
  children: [
172
172
  /* @__PURE__ */ p("option", {
173
173
  value: "all",
@@ -201,7 +201,7 @@ function C() {
201
201
  ...t,
202
202
  topicId: e.target.value
203
203
  })),
204
- className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary",
204
+ className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
205
205
  children: [/* @__PURE__ */ p("option", {
206
206
  value: "",
207
207
  children: C("notifications.allTopics", "All Topics")
@@ -216,7 +216,7 @@ function C() {
216
216
  ...t,
217
217
  archived: e.target.value
218
218
  })),
219
- className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary",
219
+ className: "rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
220
220
  children: [
221
221
  /* @__PURE__ */ p("option", {
222
222
  value: "all",
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationHistoryAdminPage.js","names":[],"sources":["../../src/pages/NotificationHistoryAdminPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { CalendarClock, Download, RefreshCw, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n ShowMore,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotificationAdmin, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nfunction formatDateTime(value?: string | null) {\n if (!value) return '—';\n return new Date(value).toLocaleString();\n}\n\n/** Admin Notification History — scheduled ops, delivery inspector, event timeline. */\nexport function NotificationHistoryAdminPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { topics } = useNotificationTopics();\n const {\n filters,\n setFilters,\n notifications,\n scheduledNotifications,\n selectedNotification,\n events,\n isLoading,\n loadNotification,\n archiveNotification,\n unarchiveNotification,\n cancelScheduledNotification,\n rescheduleNotification,\n clearSelection,\n } = useNotificationAdmin();\n const [rescheduleAt, setRescheduleAt] = useState('');\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)) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6\">\n <PagePurpose icon={<CalendarClock size={16} />}>\n {tr(\n 'notifications.adminHistoryPurpose',\n 'The operations console for everything your team has sent. Audit delivery outcomes (delivered, opened, clicked, failed, unsubscribed), inspect a single notification’s full event timeline, and manage the schedule — reschedule or cancel anything still pending. Use it to debug a campaign or prove a notification went out.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"notification-admin-history\"\n steps={[\n {\n id: 'inspect',\n label: tr('notifications.nextInspectLabel', 'Inspect a delivery'),\n description: tr(\n 'notifications.nextInspectDesc',\n 'Click any notification to see its receipts, opens, clicks and full event timeline.'\n ),\n onClick: () => {\n if (notifications[0]) {\n loadNotification(notifications[0].id);\n }\n },\n },\n {\n id: 'failed',\n label: tr('notifications.nextFailedLabel', 'Find failed deliveries'),\n description: tr(\n 'notifications.nextFailedDesc',\n 'Filter by a FAILED delivery state to triage what did not reach recipients.'\n ),\n onClick: () => setFilters((prev) => ({ ...prev, deliveryStatus: 'FAILED' })),\n },\n {\n id: 'export',\n label: tr('notifications.nextExportLabel', 'Export the current view'),\n description: tr(\n 'notifications.nextExportDesc',\n 'Download the filtered results as CSV for reporting or an external audit.'\n ),\n onClick: () => {\n if (notifications.length > 0) {\n exportNotificationsAsCsv(tr, notifications);\n }\n },\n },\n ]}\n />\n\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.adminHistoryTitle', 'Notification Operations')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr(\n 'notifications.adminHistorySubtitle',\n 'Review sent and scheduled notifications, delivery outcomes, opens, clicks, and user activity.'\n )}\n </p>\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"gap-2\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </Button>\n </div>\n\n <GlassCard treatment=\"plain\" className=\"grid gap-3 border-border-seam p-4 lg:grid-cols-6\">\n <label className=\"relative lg:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={filters.search}\n onChange={(event) => setFilters((prev) => ({ ...prev, search: event.target.value }))}\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n className=\"w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-3 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <select\n value={filters.status}\n onChange={(event) => setFilters((prev) => ({ ...prev, status: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary\"\n >\n <option value=\"all\">{tr('notifications.allStatuses', 'All Statuses')}</option>\n <option value=\"PENDING\">PENDING</option>\n <option value=\"TRIGGERED\">TRIGGERED</option>\n <option value=\"SENT\">SENT</option>\n <option value=\"FAILED\">FAILED</option>\n <option value=\"CANCELLED\">CANCELLED</option>\n </select>\n\n <select\n value={filters.channel}\n onChange={(event) => setFilters((prev) => ({ ...prev, channel: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary\"\n >\n <option value=\"all\">{tr('notifications.allChannels', 'All Channels')}</option>\n <option value=\"EMAIL\">EMAIL</option>\n <option value=\"SMS\">SMS</option>\n <option value=\"PUSH\">PUSH</option>\n <option value=\"WHATSAPP\">WHATSAPP</option>\n <option value=\"IN_APP\">IN_APP</option>\n </select>\n\n <select\n value={filters.deliveryStatus}\n onChange={(event) =>\n setFilters((prev) => ({ ...prev, deliveryStatus: event.target.value }))\n }\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary\"\n >\n <option value=\"all\">{tr('notifications.allDeliveryStates', 'All Delivery')}</option>\n <option value=\"DELIVERED\">DELIVERED</option>\n <option value=\"OPENED\">OPENED</option>\n <option value=\"CLICKED\">CLICKED</option>\n <option value=\"FAILED\">FAILED</option>\n <option value=\"UNSUBSCRIBED\">UNSUBSCRIBED</option>\n </select>\n\n <select\n value={filters.topicId}\n onChange={(event) => setFilters((prev) => ({ ...prev, topicId: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <select\n value={filters.archived}\n onChange={(event) =>\n setFilters((prev) => ({\n ...prev,\n archived: event.target.value as typeof prev.archived,\n }))\n }\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary\"\n >\n <option value=\"all\">{tr('notifications.activeAndArchived', 'Active + Archived')}</option>\n <option value=\"active\">{tr('notifications.activeOnly', 'Active Only')}</option>\n <option value=\"archived\">{tr('notifications.archivedOnly', 'Archived Only')}</option>\n </select>\n </GlassCard>\n\n <div className=\"grid gap-6 xl:grid-cols-[minmax(0,1fr),420px]\">\n <div className=\"space-y-6\">\n {/* Single emphasis zone — the live results list is the heart of this console. */}\n <EmphasisPanel className=\"p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifications.sentNotifications', 'Notifications')}\n </h2>\n <p className=\"text-sm text-secondary\">\n {notifications.length} {tr('notifications.resultsFoundShort', 'results')}\n </p>\n </div>\n {isLoading && <RefreshCw size={16} className=\"animate-spin text-tertiary\" />}\n </div>\n\n <div className=\"space-y-3\">\n {notifications.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={tr('notifications.noNotificationsFound', 'No notifications found')}\n description={tr(\n 'notifications.adjustSearchOrDateRange',\n 'Try adjusting your filters'\n )}\n />\n ) : (\n notifications.map((notification) => (\n <button\n key={notification.id}\n type=\"button\"\n onClick={() => loadNotification(notification.id)}\n className=\"block w-full text-left\"\n >\n <NotificationCard\n notification={notification}\n compact\n showArchivedState\n analyticsSource=\"admin_history\"\n />\n </button>\n ))\n )}\n </div>\n </EmphasisPanel>\n\n <section className=\"rounded-lg border border-border-seam bg-gloss-card p-4\">\n <div className=\"mb-4 flex items-center gap-2\">\n <CalendarClock size={18} className=\"text-accent-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifications.scheduledNotifications', 'Scheduled Notifications')}\n </h2>\n </div>\n\n <div className=\"space-y-3\">\n {scheduledNotifications.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('notifications.noScheduledNotifications', 'No scheduled notifications')}\n description={tr(\n 'notifications.noScheduledDescription',\n 'Notifications queued for a future send time will appear here, ready to reschedule or cancel.'\n )}\n />\n ) : (\n scheduledNotifications.map((scheduled) => (\n <div\n key={scheduled.id}\n className=\"rounded-md border border-default bg-bg-canvas p-4\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h3 className=\"text-sm font-semibold text-primary\">\n {scheduled.notification.title}\n </h3>\n <p className=\"text-xs text-secondary\">\n {scheduled.notification.channel} • {scheduled.notification.type} •{' '}\n {formatDateTime(scheduled.scheduledFor)}\n </p>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => loadNotification(scheduled.notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.view', 'View')}\n </button>\n {scheduled.status === 'PENDING' && (\n <button\n type=\"button\"\n onClick={() => cancelScheduledNotification(scheduled.id)}\n className=\"rounded-md border border-status-error-border px-3 py-2 text-xs text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n {tr('notifications.cancel', 'Cancel')}\n </button>\n )}\n </div>\n </div>\n </div>\n ))\n )}\n </div>\n </section>\n </div>\n\n <aside className=\"rounded-lg border border-border-seam bg-gloss-card p-4 xl:sticky xl:top-4 xl:max-h-[calc(100vh-2rem)] xl:self-start xl:overflow-y-auto\">\n {selectedNotification ? (\n <div className=\"space-y-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold text-primary\">\n {selectedNotification.title}\n </h2>\n <p className=\"text-sm text-secondary\">{selectedNotification.body}</p>\n </div>\n <button\n type=\"button\"\n onClick={clearSelection}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.close', 'Close')}\n </button>\n </div>\n\n <div className=\"grid gap-2 rounded-md border border-default bg-bg-canvas p-3 text-sm text-secondary\">\n <div>\n <strong>{tr('notifications.detail.status', 'Status')}:</strong>{' '}\n {selectedNotification.status}\n </div>\n <div>\n <strong>{tr('notifications.detail.delivery', 'Delivery')}:</strong>{' '}\n {selectedNotification.deliveryStatus || '—'}\n </div>\n <div>\n <strong>{tr('notifications.detail.topic', 'Topic')}:</strong>{' '}\n {selectedNotification.topic?.name || '—'}\n </div>\n <div>\n <strong>{tr('notifications.detail.created', 'Created')}:</strong>{' '}\n {formatDateTime(selectedNotification.createdAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.sent', 'Sent')}:</strong>{' '}\n {formatDateTime(selectedNotification.sentAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.delivered', 'Delivered')}:</strong>{' '}\n {formatDateTime(selectedNotification.deliveredAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.opened', 'Opened')}:</strong>{' '}\n {formatDateTime(selectedNotification.openedAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.clicked', 'Clicked')}:</strong>{' '}\n {formatDateTime(selectedNotification.clickedAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.read', 'Read')}:</strong>{' '}\n {formatDateTime(selectedNotification.readAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.recipient', 'Recipient')}:</strong>{' '}\n {selectedNotification.recipientEmail ||\n selectedNotification.recipientPhone ||\n selectedNotification.id}\n </div>\n </div>\n\n {selectedNotification.media.length > 0 && (\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.media', 'Media')}\n </h3>\n <div className=\"grid gap-3\">\n {selectedNotification.media.map((item) => (\n <a\n key={item.url}\n href={item.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"rounded-md border border-default bg-bg-canvas p-3 text-sm text-accent-primary hover:underline\"\n >\n {item.label || item.url}\n </a>\n ))}\n </div>\n </div>\n )}\n\n {selectedNotification.actions.length > 0 && (\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.actions', 'Actions')}\n </h3>\n <div className=\"grid gap-2\">\n {selectedNotification.actions.map((action) => (\n <div\n key={action.id}\n className=\"rounded-md border border-default bg-bg-canvas p-3 text-sm text-secondary\"\n >\n <div className=\"font-medium text-primary\">{action.label}</div>\n <div className=\"truncate text-xs\">{action.url}</div>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {selectedNotification.scheduledNotification && (\n <div className=\"space-y-3 rounded-md border border-default bg-bg-canvas p-3\">\n <div className=\"text-sm font-semibold text-primary\">\n {tr('notifications.scheduling', 'Scheduling')}\n </div>\n <div className=\"text-sm text-secondary\">\n {formatDateTime(selectedNotification.scheduledNotification.scheduledFor)}\n </div>\n {selectedNotification.scheduledNotification.status === 'PENDING' && (\n <>\n <input\n type=\"datetime-local\"\n value={rescheduleAt}\n onChange={(event) => setRescheduleAt(event.target.value)}\n className=\"w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() =>\n rescheduleAt &&\n rescheduleNotification(\n selectedNotification.scheduledNotification!.id,\n new Date(rescheduleAt).toISOString()\n )\n }\n className=\"rounded-md bg-accent-primary px-3 py-2 text-xs font-medium text-text-inverse hover:opacity-90\"\n >\n {tr('notifications.reschedule', 'Reschedule')}\n </button>\n <button\n type=\"button\"\n onClick={() =>\n cancelScheduledNotification(\n selectedNotification.scheduledNotification!.id\n )\n }\n className=\"rounded-md border border-status-error-border px-3 py-2 text-xs text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n {tr('notifications.cancel', 'Cancel')}\n </button>\n </div>\n </>\n )}\n </div>\n )}\n\n <div className=\"flex items-center gap-2\">\n {selectedNotification.archivedAt ? (\n <button\n type=\"button\"\n onClick={() => unarchiveNotification(selectedNotification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={() => archiveNotification(selectedNotification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.archive', 'Archive')}\n </button>\n )}\n </div>\n\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.eventTimeline', 'Event Timeline')}\n </h3>\n {events.length === 0 ? (\n <div className=\"rounded-md border border-dashed border-border-seam p-4 text-sm text-secondary\">\n {tr('notifications.noEvents', 'No events recorded yet.')}\n </div>\n ) : (\n <ShowMore collapsedHeight={180}>\n <div className=\"space-y-2\">\n {events.map((event) => (\n <div\n key={event.id}\n className=\"rounded-md border border-border-seam bg-surface p-3 text-sm text-secondary\"\n >\n <div className=\"font-medium text-primary\">{event.eventType}</div>\n <div>{formatDateTime(event.timestamp)}</div>\n {event.deliveryStatus && (\n <div>\n {tr('notifications.detail.delivery', 'Delivery')}:{' '}\n {event.deliveryStatus}\n </div>\n )}\n </div>\n ))}\n </div>\n </ShowMore>\n )}\n </div>\n </div>\n ) : (\n <div className=\"flex h-full min-h-[360px] items-center justify-center\">\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={tr('notifications.selectNotificationTitle', 'Nothing selected')}\n description={tr(\n 'notifications.selectNotificationForDetails',\n 'Select a notification to inspect details, delivery receipts, and activity.'\n )}\n />\n </div>\n )}\n </aside>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,EAAe,GAAuB;AAE7C,QADK,IACE,IAAI,KAAK,EAAM,CAAC,gBAAgB,GADpB;;AAKrB,SAAgB,IAA+B;CAC7C,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,cAAW,GAAuB,EACpC,EACJ,YACA,eACA,kBACA,2BACA,yBACA,WACA,cACA,qBACA,wBACA,0BACA,gCACA,2BACA,sBACE,GAAsB,EACpB,CAAC,GAAc,KAAmB,EA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BAAC,GAAD;OACE,cAAa;OACb,OAAO,EAAG,yCAAyC,mBAAmB;OACtE,aAAa,EACX,8CACA,6EACD;OACD,CAAA;MACE,CAAA;KAEF,CAAA,CACJ;;GACF;MA1eJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,qCACA,0DACD;EACG,CAAA"}
1
+ {"version":3,"file":"NotificationHistoryAdminPage.js","names":[],"sources":["../../src/pages/NotificationHistoryAdminPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { CalendarClock, Download, RefreshCw, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n ShowMore,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotificationAdmin, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nfunction formatDateTime(value?: string | null) {\n if (!value) return '—';\n return new Date(value).toLocaleString();\n}\n\n/** Admin Notification History — scheduled ops, delivery inspector, event timeline. */\nexport function NotificationHistoryAdminPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { topics } = useNotificationTopics();\n const {\n filters,\n setFilters,\n notifications,\n scheduledNotifications,\n selectedNotification,\n events,\n isLoading,\n loadNotification,\n archiveNotification,\n unarchiveNotification,\n cancelScheduledNotification,\n rescheduleNotification,\n clearSelection,\n } = useNotificationAdmin();\n const [rescheduleAt, setRescheduleAt] = useState('');\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)) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6\">\n <PagePurpose icon={<CalendarClock size={16} />}>\n {tr(\n 'notifications.adminHistoryPurpose',\n 'The operations console for everything your team has sent. Audit delivery outcomes (delivered, opened, clicked, failed, unsubscribed), inspect a single notification’s full event timeline, and manage the schedule — reschedule or cancel anything still pending. Use it to debug a campaign or prove a notification went out.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"notification-admin-history\"\n steps={[\n {\n id: 'inspect',\n label: tr('notifications.nextInspectLabel', 'Inspect a delivery'),\n description: tr(\n 'notifications.nextInspectDesc',\n 'Click any notification to see its receipts, opens, clicks and full event timeline.'\n ),\n onClick: () => {\n if (notifications[0]) {\n loadNotification(notifications[0].id);\n }\n },\n },\n {\n id: 'failed',\n label: tr('notifications.nextFailedLabel', 'Find failed deliveries'),\n description: tr(\n 'notifications.nextFailedDesc',\n 'Filter by a FAILED delivery state to triage what did not reach recipients.'\n ),\n onClick: () => setFilters((prev) => ({ ...prev, deliveryStatus: 'FAILED' })),\n },\n {\n id: 'export',\n label: tr('notifications.nextExportLabel', 'Export the current view'),\n description: tr(\n 'notifications.nextExportDesc',\n 'Download the filtered results as CSV for reporting or an external audit.'\n ),\n onClick: () => {\n if (notifications.length > 0) {\n exportNotificationsAsCsv(tr, notifications);\n }\n },\n },\n ]}\n />\n\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.adminHistoryTitle', 'Notification Operations')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr(\n 'notifications.adminHistorySubtitle',\n 'Review sent and scheduled notifications, delivery outcomes, opens, clicks, and user activity.'\n )}\n </p>\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"gap-2\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </Button>\n </div>\n\n <GlassCard treatment=\"plain\" className=\"grid gap-3 border-border-seam p-4 lg:grid-cols-6\">\n <label className=\"relative lg:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={filters.search}\n onChange={(event) => setFilters((prev) => ({ ...prev, search: event.target.value }))}\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n className=\"w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-3 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <select\n value={filters.status}\n onChange={(event) => setFilters((prev) => ({ ...prev, status: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allStatuses', 'All Statuses')}</option>\n <option value=\"PENDING\">PENDING</option>\n <option value=\"TRIGGERED\">TRIGGERED</option>\n <option value=\"SENT\">SENT</option>\n <option value=\"FAILED\">FAILED</option>\n <option value=\"CANCELLED\">CANCELLED</option>\n </select>\n\n <select\n value={filters.channel}\n onChange={(event) => setFilters((prev) => ({ ...prev, channel: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allChannels', 'All Channels')}</option>\n <option value=\"EMAIL\">EMAIL</option>\n <option value=\"SMS\">SMS</option>\n <option value=\"PUSH\">PUSH</option>\n <option value=\"WHATSAPP\">WHATSAPP</option>\n <option value=\"IN_APP\">IN_APP</option>\n </select>\n\n <select\n value={filters.deliveryStatus}\n onChange={(event) =>\n setFilters((prev) => ({ ...prev, deliveryStatus: event.target.value }))\n }\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allDeliveryStates', 'All Delivery')}</option>\n <option value=\"DELIVERED\">DELIVERED</option>\n <option value=\"OPENED\">OPENED</option>\n <option value=\"CLICKED\">CLICKED</option>\n <option value=\"FAILED\">FAILED</option>\n <option value=\"UNSUBSCRIBED\">UNSUBSCRIBED</option>\n </select>\n\n <select\n value={filters.topicId}\n onChange={(event) => setFilters((prev) => ({ ...prev, topicId: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <select\n value={filters.archived}\n onChange={(event) =>\n setFilters((prev) => ({\n ...prev,\n archived: event.target.value as typeof prev.archived,\n }))\n }\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.activeAndArchived', 'Active + Archived')}</option>\n <option value=\"active\">{tr('notifications.activeOnly', 'Active Only')}</option>\n <option value=\"archived\">{tr('notifications.archivedOnly', 'Archived Only')}</option>\n </select>\n </GlassCard>\n\n <div className=\"grid gap-6 xl:grid-cols-[minmax(0,1fr),420px]\">\n <div className=\"space-y-6\">\n {/* Single emphasis zone — the live results list is the heart of this console. */}\n <EmphasisPanel className=\"p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifications.sentNotifications', 'Notifications')}\n </h2>\n <p className=\"text-sm text-secondary\">\n {notifications.length} {tr('notifications.resultsFoundShort', 'results')}\n </p>\n </div>\n {isLoading && <RefreshCw size={16} className=\"animate-spin text-tertiary\" />}\n </div>\n\n <div className=\"space-y-3\">\n {notifications.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={tr('notifications.noNotificationsFound', 'No notifications found')}\n description={tr(\n 'notifications.adjustSearchOrDateRange',\n 'Try adjusting your filters'\n )}\n />\n ) : (\n notifications.map((notification) => (\n <button\n key={notification.id}\n type=\"button\"\n onClick={() => loadNotification(notification.id)}\n className=\"block w-full text-left\"\n >\n <NotificationCard\n notification={notification}\n compact\n showArchivedState\n analyticsSource=\"admin_history\"\n />\n </button>\n ))\n )}\n </div>\n </EmphasisPanel>\n\n <section className=\"rounded-lg border border-border-seam bg-gloss-card p-4\">\n <div className=\"mb-4 flex items-center gap-2\">\n <CalendarClock size={18} className=\"text-accent-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifications.scheduledNotifications', 'Scheduled Notifications')}\n </h2>\n </div>\n\n <div className=\"space-y-3\">\n {scheduledNotifications.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('notifications.noScheduledNotifications', 'No scheduled notifications')}\n description={tr(\n 'notifications.noScheduledDescription',\n 'Notifications queued for a future send time will appear here, ready to reschedule or cancel.'\n )}\n />\n ) : (\n scheduledNotifications.map((scheduled) => (\n <div\n key={scheduled.id}\n className=\"rounded-md border border-default bg-bg-canvas p-4\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h3 className=\"text-sm font-semibold text-primary\">\n {scheduled.notification.title}\n </h3>\n <p className=\"text-xs text-secondary\">\n {scheduled.notification.channel} • {scheduled.notification.type} •{' '}\n {formatDateTime(scheduled.scheduledFor)}\n </p>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => loadNotification(scheduled.notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.view', 'View')}\n </button>\n {scheduled.status === 'PENDING' && (\n <button\n type=\"button\"\n onClick={() => cancelScheduledNotification(scheduled.id)}\n className=\"rounded-md border border-status-error-border px-3 py-2 text-xs text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n {tr('notifications.cancel', 'Cancel')}\n </button>\n )}\n </div>\n </div>\n </div>\n ))\n )}\n </div>\n </section>\n </div>\n\n <aside className=\"rounded-lg border border-border-seam bg-gloss-card p-4 xl:sticky xl:top-4 xl:max-h-[calc(100vh-2rem)] xl:self-start xl:overflow-y-auto\">\n {selectedNotification ? (\n <div className=\"space-y-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold text-primary\">\n {selectedNotification.title}\n </h2>\n <p className=\"text-sm text-secondary\">{selectedNotification.body}</p>\n </div>\n <button\n type=\"button\"\n onClick={clearSelection}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.close', 'Close')}\n </button>\n </div>\n\n <div className=\"grid gap-2 rounded-md border border-default bg-bg-canvas p-3 text-sm text-secondary\">\n <div>\n <strong>{tr('notifications.detail.status', 'Status')}:</strong>{' '}\n {selectedNotification.status}\n </div>\n <div>\n <strong>{tr('notifications.detail.delivery', 'Delivery')}:</strong>{' '}\n {selectedNotification.deliveryStatus || '—'}\n </div>\n <div>\n <strong>{tr('notifications.detail.topic', 'Topic')}:</strong>{' '}\n {selectedNotification.topic?.name || '—'}\n </div>\n <div>\n <strong>{tr('notifications.detail.created', 'Created')}:</strong>{' '}\n {formatDateTime(selectedNotification.createdAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.sent', 'Sent')}:</strong>{' '}\n {formatDateTime(selectedNotification.sentAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.delivered', 'Delivered')}:</strong>{' '}\n {formatDateTime(selectedNotification.deliveredAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.opened', 'Opened')}:</strong>{' '}\n {formatDateTime(selectedNotification.openedAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.clicked', 'Clicked')}:</strong>{' '}\n {formatDateTime(selectedNotification.clickedAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.read', 'Read')}:</strong>{' '}\n {formatDateTime(selectedNotification.readAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.recipient', 'Recipient')}:</strong>{' '}\n {selectedNotification.recipientEmail ||\n selectedNotification.recipientPhone ||\n selectedNotification.id}\n </div>\n </div>\n\n {selectedNotification.media.length > 0 && (\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.media', 'Media')}\n </h3>\n <div className=\"grid gap-3\">\n {selectedNotification.media.map((item) => (\n <a\n key={item.url}\n href={item.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"rounded-md border border-default bg-bg-canvas p-3 text-sm text-accent-primary hover:underline\"\n >\n {item.label || item.url}\n </a>\n ))}\n </div>\n </div>\n )}\n\n {selectedNotification.actions.length > 0 && (\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.actions', 'Actions')}\n </h3>\n <div className=\"grid gap-2\">\n {selectedNotification.actions.map((action) => (\n <div\n key={action.id}\n className=\"rounded-md border border-default bg-bg-canvas p-3 text-sm text-secondary\"\n >\n <div className=\"font-medium text-primary\">{action.label}</div>\n <div className=\"truncate text-xs\">{action.url}</div>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {selectedNotification.scheduledNotification && (\n <div className=\"space-y-3 rounded-md border border-default bg-bg-canvas p-3\">\n <div className=\"text-sm font-semibold text-primary\">\n {tr('notifications.scheduling', 'Scheduling')}\n </div>\n <div className=\"text-sm text-secondary\">\n {formatDateTime(selectedNotification.scheduledNotification.scheduledFor)}\n </div>\n {selectedNotification.scheduledNotification.status === 'PENDING' && (\n <>\n <input\n type=\"datetime-local\"\n value={rescheduleAt}\n onChange={(event) => setRescheduleAt(event.target.value)}\n className=\"w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() =>\n rescheduleAt &&\n rescheduleNotification(\n selectedNotification.scheduledNotification!.id,\n new Date(rescheduleAt).toISOString()\n )\n }\n className=\"rounded-md bg-accent-primary px-3 py-2 text-xs font-medium text-text-inverse hover:opacity-90\"\n >\n {tr('notifications.reschedule', 'Reschedule')}\n </button>\n <button\n type=\"button\"\n onClick={() =>\n cancelScheduledNotification(\n selectedNotification.scheduledNotification!.id\n )\n }\n className=\"rounded-md border border-status-error-border px-3 py-2 text-xs text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n {tr('notifications.cancel', 'Cancel')}\n </button>\n </div>\n </>\n )}\n </div>\n )}\n\n <div className=\"flex items-center gap-2\">\n {selectedNotification.archivedAt ? (\n <button\n type=\"button\"\n onClick={() => unarchiveNotification(selectedNotification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={() => archiveNotification(selectedNotification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.archive', 'Archive')}\n </button>\n )}\n </div>\n\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.eventTimeline', 'Event Timeline')}\n </h3>\n {events.length === 0 ? (\n <div className=\"rounded-md border border-dashed border-border-seam p-4 text-sm text-secondary\">\n {tr('notifications.noEvents', 'No events recorded yet.')}\n </div>\n ) : (\n <ShowMore collapsedHeight={180}>\n <div className=\"space-y-2\">\n {events.map((event) => (\n <div\n key={event.id}\n className=\"rounded-md border border-border-seam bg-surface p-3 text-sm text-secondary\"\n >\n <div className=\"font-medium text-primary\">{event.eventType}</div>\n <div>{formatDateTime(event.timestamp)}</div>\n {event.deliveryStatus && (\n <div>\n {tr('notifications.detail.delivery', 'Delivery')}:{' '}\n {event.deliveryStatus}\n </div>\n )}\n </div>\n ))}\n </div>\n </ShowMore>\n )}\n </div>\n </div>\n ) : (\n <div className=\"flex h-full min-h-[360px] items-center justify-center\">\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={tr('notifications.selectNotificationTitle', 'Nothing selected')}\n description={tr(\n 'notifications.selectNotificationForDetails',\n 'Select a notification to inspect details, delivery receipts, and activity.'\n )}\n />\n </div>\n )}\n </aside>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,EAAe,GAAuB;AAE7C,QADK,IACE,IAAI,KAAK,EAAM,CAAC,gBAAgB,GADpB;;AAKrB,SAAgB,IAA+B;CAC7C,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,cAAW,GAAuB,EACpC,EACJ,YACA,eACA,kBACA,2BACA,yBACA,WACA,cACA,qBACA,wBACA,0BACA,gCACA,2BACA,sBACE,GAAsB,EACpB,CAAC,GAAc,KAAmB,EAAS,GAAG;AAqBpD,QAnBI,IAEA,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,kFAAmF,CAAA;EAC9F,CAAA,GAIL,EAAc,EAAyB,kBAAkB,GAY5D,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,GAAD;IAAa,MAAM,kBAAC,GAAD,EAAe,MAAM,IAAM,CAAA;cAC3C,EACC,qCACA,iUACD;IACW,CAAA;GAEd,kBAAC,GAAD;IACE,YAAW;IACX,OAAO;KACL;MACE,IAAI;MACJ,OAAO,EAAG,kCAAkC,qBAAqB;MACjE,aAAa,EACX,iCACA,qFACD;MACD,eAAe;AACb,OAAI,EAAc,MAChB,EAAiB,EAAc,GAAG,GAAG;;MAG1C;KACD;MACE,IAAI;MACJ,OAAO,EAAG,iCAAiC,yBAAyB;MACpE,aAAa,EACX,gCACA,6EACD;MACD,eAAe,GAAY,OAAU;OAAE,GA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kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,MAAD;SAAI,WAAU;mBACX,EAAG,+BAA+B,iBAAiB;SACjD,CAAA,EACJ,EAAO,WAAW,IACjB,kBAAC,OAAD;SAAK,WAAU;mBACZ,EAAG,0BAA0B,0BAA0B;SACpD,CAAA,GAEN,kBAAC,GAAD;SAAU,iBAAiB;mBACzB,kBAAC,OAAD;UAAK,WAAU;oBACZ,EAAO,KAAK,MACX,kBAAC,OAAD;WAEE,WAAU;qBAFZ;YAIE,kBAAC,OAAD;aAAK,WAAU;uBAA4B,EAAM;aAAgB,CAAA;YACjE,kBAAC,OAAD,EAAA,UAAM,EAAe,EAAM,UAAU,EAAO,CAAA;YAC3C,EAAM,kBACL,kBAAC,OAAD,EAAA,UAAA;aACG,EAAG,iCAAiC,WAAW;aAAC;aAAE;aAClD,EAAM;aACH,EAAA,CAAA;YAEJ;aAXC,EAAM,GAWP,CACN;UACE,CAAA;SACG,CAAA,CAET;;OACF;UAEN,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,GAAD;OACE,cAAa;OACb,OAAO,EAAG,yCAAyC,mBAAmB;OACtE,aAAa,EACX,8CACA,6EACD;OACD,CAAA;MACE,CAAA;KAEF,CAAA,CACJ;;GACF;MA1eJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,qCACA,0DACD;EACG,CAAA"}
@@ -68,7 +68,7 @@ function y() {
68
68
  /* @__PURE__ */ f("select", {
69
69
  value: T.topicId || "",
70
70
  onChange: (e) => E({ topicId: e.target.value || void 0 }),
71
- className: "rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary",
71
+ className: "rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
72
72
  children: [/* @__PURE__ */ d("option", {
73
73
  value: "",
74
74
  children: y("notifications.allTopics", "All Topics")
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationHistoryPage.js","names":[],"sources":["../../src/pages/NotificationHistoryPage.tsx"],"sourcesContent":["import { Download, History, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\n\n/** User Notification History — personal history, filter, CSV export, archive/unarchive. */\nexport function NotificationHistoryPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics } = useNotificationTopics({ isActive: true });\n const {\n notifications,\n notificationFilter,\n updateFilter,\n archiveNotification,\n unarchiveNotification,\n recordAction,\n } = useNotifications({ baseFilter: HISTORY_FILTER });\n\n const hasActiveFilters = Boolean(\n notificationFilter.search ||\n notificationFilter.topicId ||\n notificationFilter.dateRange.start ||\n notificationFilter.dateRange.end\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.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<History size={16} />}>\n {tr(\n 'notifications.historyPurpose',\n 'A searchable archive of every notification you have ever received, across all channels (in-app, email, push and more). Look back through anything you read or archived, narrow by topic or date range, and export the results to CSV for your own records.'\n )}\n </PagePurpose>\n\n {/* Single emphasis zone — the header summary + the one export CTA. */}\n <EmphasisPanel\n data-tour=\"notification-history-header\"\n className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\"\n >\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.historyTitle', 'Notification History')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr('notifications.historySubtitle', 'View and search all your notifications')}\n </p>\n </div>\n\n <Button\n data-tour=\"notification-history-export\"\n variant=\"outline\"\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"gap-2\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </Button>\n </EmphasisPanel>\n\n <GlassCard\n treatment=\"plain\"\n className=\"grid gap-3 border-border-seam p-3 sm:grid-cols-2 sm:p-4 xl:grid-cols-5\"\n >\n <div className=\"relative sm:col-span-2 xl:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n <select\n value={notificationFilter.topicId || ''}\n onChange={(event) => updateFilter({ topicId: event.target.value || undefined })}\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <input\n type=\"date\"\n aria-label={tr('notifications.startDate', 'Start date')}\n value={\n notificationFilter.dateRange.start\n ? notificationFilter.dateRange.start.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n start: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n\n <input\n type=\"date\"\n aria-label={tr('notifications.endDate', 'End date')}\n value={\n notificationFilter.dateRange.end\n ? notificationFilter.dateRange.end.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n end: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n </GlassCard>\n\n <div className=\"space-y-2\">\n {notifications.length > 0 ? (\n notifications.map((notification) => (\n <div key={notification.id} className=\"space-y-2\">\n <NotificationCard\n notification={notification}\n onArchive={archiveNotification}\n onAction={recordAction}\n showArchivedState\n analyticsSource=\"history\"\n />\n {notification.archivedAt && (\n <div className=\"flex justify-end\">\n <button\n onClick={() => unarchiveNotification(notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n </div>\n )}\n </div>\n ))\n ) : (\n <div className=\"animate-in fade-in duration-200\">\n <IllustratedEmptyState\n illustration={hasActiveFilters ? 'empty-search' : 'empty-notifications'}\n title={\n hasActiveFilters\n ? tr('notifications.noNotificationsFound', 'No notifications found')\n : tr('notifications.historyEmptyTitle', 'No history yet')\n }\n description={\n hasActiveFilters\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.historyEmptyDescription',\n 'Notifications you receive will be archived here so you can always find them again.'\n )\n }\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,IAAM,IAAiB;CAAE,UAAU;CAAM,SAAS;CAAgB;AAGlE,SAAgB,IAA0B;CACxC,IAAM,IAAK,G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W;MACX,UAAU;MACV,mBAAA;MACA,iBAAgB;MAChB,CAAA,EACD,EAAa,cACZ,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,UAAD;OACE,eAAe,EAAsB,EAAa,GAAG;OACrD,WAAU;iBAET,EAAG,yBAAyB,UAAU;OAChC,CAAA;MACL,CAAA,CAEJ;OAlBI,EAAa,GAkBjB,CACN,GAEF,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD;MACE,cAAc,IAAmB,iBAAiB;MAClD,OACE,IACI,EAAG,sCAAsC,yBAAyB,GAClE,EAAG,mCAAmC,iBAAiB;MAE7D,aACE,IACI,EAAG,yCAAyC,6BAA6B,GACzE,EACE,yCACA,qFACD;MAEP,CAAA;KACE,CAAA;IAEJ,CAAA;GACF"}
1
+ {"version":3,"file":"NotificationHistoryPage.js","names":[],"sources":["../../src/pages/NotificationHistoryPage.tsx"],"sourcesContent":["import { Download, History, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\n\n/** User Notification History — personal history, filter, CSV export, archive/unarchive. */\nexport function NotificationHistoryPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics } = useNotificationTopics({ isActive: true });\n const {\n notifications,\n notificationFilter,\n updateFilter,\n archiveNotification,\n unarchiveNotification,\n recordAction,\n } = useNotifications({ baseFilter: HISTORY_FILTER });\n\n const hasActiveFilters = Boolean(\n notificationFilter.search ||\n notificationFilter.topicId ||\n notificationFilter.dateRange.start ||\n notificationFilter.dateRange.end\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.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<History size={16} />}>\n {tr(\n 'notifications.historyPurpose',\n 'A searchable archive of every notification you have ever received, across all channels (in-app, email, push and more). Look back through anything you read or archived, narrow by topic or date range, and export the results to CSV for your own records.'\n )}\n </PagePurpose>\n\n {/* Single emphasis zone — the header summary + the one export CTA. */}\n <EmphasisPanel\n data-tour=\"notification-history-header\"\n className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\"\n >\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.historyTitle', 'Notification History')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr('notifications.historySubtitle', 'View and search all your notifications')}\n </p>\n </div>\n\n <Button\n data-tour=\"notification-history-export\"\n variant=\"outline\"\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"gap-2\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </Button>\n </EmphasisPanel>\n\n <GlassCard\n treatment=\"plain\"\n className=\"grid gap-3 border-border-seam p-3 sm:grid-cols-2 sm:p-4 xl:grid-cols-5\"\n >\n <div className=\"relative sm:col-span-2 xl:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n <select\n value={notificationFilter.topicId || ''}\n onChange={(event) => updateFilter({ topicId: event.target.value || undefined })}\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <input\n type=\"date\"\n aria-label={tr('notifications.startDate', 'Start date')}\n value={\n notificationFilter.dateRange.start\n ? notificationFilter.dateRange.start.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n start: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n\n <input\n type=\"date\"\n aria-label={tr('notifications.endDate', 'End date')}\n value={\n notificationFilter.dateRange.end\n ? notificationFilter.dateRange.end.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n end: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n </GlassCard>\n\n <div className=\"space-y-2\">\n {notifications.length > 0 ? (\n notifications.map((notification) => (\n <div key={notification.id} className=\"space-y-2\">\n <NotificationCard\n notification={notification}\n onArchive={archiveNotification}\n onAction={recordAction}\n showArchivedState\n analyticsSource=\"history\"\n />\n {notification.archivedAt && (\n <div className=\"flex justify-end\">\n <button\n onClick={() => unarchiveNotification(notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n </div>\n )}\n </div>\n ))\n ) : (\n <div className=\"animate-in fade-in duration-200\">\n <IllustratedEmptyState\n illustration={hasActiveFilters ? 'empty-search' : 'empty-notifications'}\n title={\n hasActiveFilters\n ? tr('notifications.noNotificationsFound', 'No notifications found')\n : tr('notifications.historyEmptyTitle', 'No history yet')\n }\n description={\n hasActiveFilters\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.historyEmptyDescription',\n 'Notifications you receive will be archived here so you can always find them again.'\n )\n }\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,IAAM,IAAiB;CAAE,UAAU;CAAM,SAAS;CAAgB;AAGlE,SAAgB,IAA0B;CACxC,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,mBAAgB,GAAiB,EACnC,EAAE,cAAW,EAAsB,EAAE,UAAU,IAAM,CAAC,EACtD,EACJ,kBACA,uBACA,iBACA,wBACA,0BACA,oBACE,EAAiB,EAAE,YAAY,GAAgB,CAAC,EAE9C,IAAmB,GACvB,EAAmB,UACnB,EAAmB,WACnB,EAAmB,UAAU,SAC7B,EAAmB,UAAU;AAsB/B,QAnBI,IAEA,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,kFAAmF,CAAA;EAC9F,CAAA,GAIN,CAAC,EAAc,EAAyB,kBAAkB,IAAI,CAAC,GAAa,KAE5E,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,qCACA,0DACD;EACG,CAAA,GAKR,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,GAAD;IAAa,MAAM,kBAAC,GAAD,EAAS,MAAM,IAAM,CAAA;cACrC,EACC,gCACA,6PACD;IACW,CAAA;GAGd,kBAAC,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AAG,EAAmB;OACtB,OAAO,EAAE,OAAO,QAAQ,IAAI,KAAK,EAAE,OAAO,MAAM,GAAG;OACpD,EACF,CAAC;MAEJ,WAAU;MACV,CAAA;KAEF,kBAAC,SAAD;MACE,MAAK;MACL,cAAY,EAAG,yBAAyB,WAAW;MACnD,OACE,EAAmB,UAAU,MACzB,EAAmB,UAAU,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,KAC1D;MAEN,WAAW,MACT,EAAa,EACX,WAAW;OACT,GAAG,EAAmB;OACtB,KAAK,EAAE,OAAO,QAAQ,IAAI,KAAK,EAAE,OAAO,MAAM,GAAG;OAClD,EACF,CAAC;MAEJ,WAAU;MACV,CAAA;KACQ;;GAEZ,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAc,SAAS,IACtB,EAAc,KAAK,MACjB,kBAAC,OAAD;KAA2B,WAAU;eAArC,CACE,kBAAC,GAAD;MACgB;MACd,WAAW;MACX,UAAU;MACV,mBAAA;MACA,iBAAgB;MAChB,CAAA,EACD,EAAa,cACZ,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,UAAD;OACE,eAAe,EAAsB,EAAa,GAAG;OACrD,WAAU;iBAET,EAAG,yBAAyB,UAAU;OAChC,CAAA;MACL,CAAA,CAEJ;OAlBI,EAAa,GAkBjB,CACN,GAEF,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD;MACE,cAAc,IAAmB,iBAAiB;MAClD,OACE,IACI,EAAG,sCAAsC,yBAAyB,GAClE,EAAG,mCAAmC,iBAAiB;MAE7D,aACE,IACI,EAAG,yCAAyC,6BAA6B,GACzE,EACE,yCACA,qFACD;MAEP,CAAA;KACE,CAAA;IAEJ,CAAA;GACF"}
@@ -165,7 +165,7 @@ function D() {
165
165
  }), /* @__PURE__ */ v("select", {
166
166
  value: R.type || "",
167
167
  onChange: (e) => H({ type: e.target.value || void 0 }),
168
- className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150",
168
+ className: "px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
169
169
  children: [
170
170
  /* @__PURE__ */ _("option", {
171
171
  value: "",
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationTemplatesPage.js","names":[],"sources":["../../src/pages/NotificationTemplatesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { FileText, Plus, Search, Trash2, Loader2, AlertCircle, RefreshCw } from 'lucide-react';\nimport { useNavigate } from 'react-router';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTemplates } from '../hooks/useNotificationTemplates';\nimport type { BackendNotificationTemplate } from '../hooks/useNotificationTemplates';\nimport type { NotificationType } from '../types';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../utils/nativeBridge';\n\n// ── Helpers ────────────────────────────────────────────────────────────\n\nconst TYPE_COLORS: Record<NotificationType, string> = {\n TRANSACTIONAL: 'text-status-info-text bg-status-info-bg-subtle border-status-info-bg-subtle',\n MARKETING: 'text-accent-purple bg-accent-purple-subtle border-accent-purple-subtle',\n SYSTEM: 'text-status-warning-text bg-status-warning-bg-subtle border-status-warning-bg-subtle',\n ALERT: 'text-status-error-text bg-status-error-bg-subtle border-status-error-bg-subtle',\n};\n\nconst TYPE_LABELS: Record<NotificationType, string> = {\n TRANSACTIONAL: 'Transactional',\n MARKETING: 'Marketing',\n SYSTEM: 'System',\n ALERT: 'Alert',\n};\n\nfunction formatDate(iso: string, locale?: string) {\n return new Date(iso).toLocaleDateString(locale || 'en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n });\n}\n\n// ── Component ──────────────────────────────────────────────────────────\n\n/**\n * Notification Templates Page (Admin)\n *\n * Lists all notification templates from the real backend.\n * Supports search, type filtering, delete, and navigation to editor.\n */\nexport function NotificationTemplatesPage() {\n const navigate = useNavigate();\n const tr = useTr();\n const { locale } = useI18n();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const {\n templates,\n isLoading,\n isDeleting,\n error,\n total,\n hasMore,\n filter,\n refetch,\n loadMore,\n deleteTemplate,\n updateFilter,\n } = useNotificationTemplates();\n\n const [deletingId, setDeletingId] = useState<string | null>(null);\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [selectedTemplateIds, setSelectedTemplateIds] = useState<Set<string>>(new Set());\n\n const selectedTemplates = useMemo(\n () => templates.filter((template) => selectedTemplateIds.has(template.id)),\n [selectedTemplateIds, templates]\n );\n\n const allVisibleSelected =\n templates.length > 0 && templates.every((template) => selectedTemplateIds.has(template.id));\n const partiallySelected =\n templates.some((template) => selectedTemplateIds.has(template.id)) && !allVisibleSelected;\n\n const canCreateTemplate = hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_CREATE);\n const canDeleteTemplate = hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_DELETE);\n\n const handleDelete = async (e: React.MouseEvent, template: BackendNotificationTemplate) => {\n e.stopPropagation();\n nativeImpact('medium');\n const message = tr(\n 'notifTemplates.confirmDelete',\n `Delete template \"${template.name}\"? This cannot be undone.`\n );\n const nativeResult = await nativeConfirm({\n title: tr('notifTemplates.deleteTitle', 'Delete template'),\n message,\n okButtonTitle: tr('notifTemplates.delete', 'Delete'),\n });\n const confirmed = nativeResult === null ? confirm(message) : nativeResult;\n if (!confirmed) return;\n\n setDeletingId(template.id);\n setDeleteError(null);\n try {\n await deleteTemplate(template.id);\n void nativeNotify('success');\n } catch (err: unknown) {\n void nativeNotify('error');\n setDeleteError(\n err instanceof Error\n ? err.message\n : tr('notifTemplates.deleteFailed', 'Failed to delete template')\n );\n } finally {\n setDeletingId(null);\n }\n };\n\n const handleBulkDelete = async () => {\n if (selectedTemplates.length === 0) return;\n nativeImpact('medium');\n const message = tr(\n 'notifTemplates.confirmBulkDelete',\n `Delete ${selectedTemplates.length} selected template${selectedTemplates.length === 1 ? '' : 's'}? This cannot be undone.`\n );\n const nativeResult = await nativeConfirm({\n title: tr('notifTemplates.bulkDeleteTitle', 'Delete templates'),\n message,\n okButtonTitle: tr('notifTemplates.delete', 'Delete'),\n });\n const confirmed = nativeResult === null ? window.confirm(message) : nativeResult;\n if (!confirmed) return;\n\n setDeleteError(null);\n const results = await Promise.allSettled(\n selectedTemplates.map((template) => deleteTemplate(template.id))\n );\n const failed = results.some((r) => r.status === 'rejected');\n void nativeNotify(failed ? 'error' : 'success');\n setSelectedTemplateIds(new Set());\n };\n\n const toggleTemplateSelection = (templateId: string, checked: boolean) => {\n setSelectedTemplateIds((prev) => {\n const next = new Set(prev);\n if (checked) {\n next.add(templateId);\n } else {\n next.delete(templateId);\n }\n return next;\n });\n };\n\n const toggleAllTemplates = (checked: boolean) => {\n setSelectedTemplateIds((prev) => {\n const next = new Set(prev);\n templates.forEach((template) => {\n if (checked) {\n next.add(template.id);\n } else {\n next.delete(template.id);\n }\n });\n return next;\n });\n };\n\n // ── Permission guards ────────────────────────────────────────────────\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 // TEMPLATE_LIST admits read-only admins; the page already hides/disables write actions for them.\n const canViewTemplates =\n hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_LIST) ||\n canCreateTemplate ||\n canDeleteTemplate ||\n hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_UPDATE);\n\n if (!canViewTemplates) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifTemplates.noPermissionView',\n \"You don't have permission to view notification templates.\"\n )}\n </div>\n );\n }\n\n // ── Loading state ────────────────────────────────────────────────────\n if (isLoading && templates.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center h-64 gap-3\">\n <Loader2 size={28} className=\"animate-spin text-accent-primary\" />\n <p className=\"text-sm text-secondary\">\n {tr('notifTemplates.loading', 'Loading templates...')}\n </p>\n </div>\n );\n }\n\n // ── Error state ──────────────────────────────────────────────────────\n if (error && templates.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center h-64 gap-4\">\n <AlertCircle size={28} className=\"text-error\" />\n <p className=\"text-sm text-error\">{error}</p>\n <button\n onClick={refetch}\n className=\"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-accent-primary hover:bg-accent-primary/90 rounded-lg transition-all duration-150\"\n >\n <RefreshCw size={14} />\n {tr('notifTemplates.retry', 'Retry')}\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<FileText size={16} />}>\n {tr(\n 'notifTemplates.purpose',\n 'Reusable, versioned message blueprints — subject lines, bodies and channel layouts with {{variables}} you fill in at send time. Build a template once (e.g. a welcome email or a payment receipt) and reuse it from the Send page so every notification stays on-brand and consistent.'\n )}\n </PagePurpose>\n\n {/* Header — single emphasis zone (count summary + the one create CTA). */}\n <EmphasisPanel className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\">\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifTemplates.title', 'Notification Templates')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {total} {tr('notifTemplates.templateCount', 'template')}\n {total !== 1 ? 's' : ''} {tr('notifTemplates.total', 'total')}\n </p>\n </div>\n\n {canCreateTemplate && (\n <Button onClick={() => navigate('new')} className=\"gap-2\">\n <Plus size={16} />\n {tr('notifTemplates.createTemplate', 'Create Template')}\n </Button>\n )}\n </EmphasisPanel>\n\n <NextSteps\n storageKey=\"notification-templates\"\n steps={[\n ...(canCreateTemplate\n ? [\n {\n id: 'create-template',\n label: tr('notifTemplates.nextCreateLabel', 'Create your first template'),\n description: tr(\n 'notifTemplates.nextCreateDesc',\n 'Build a reusable message blueprint with {{variables}} you fill in at send time.'\n ),\n onClick: () => navigate('new'),\n },\n ]\n : []),\n {\n id: 'filter-type',\n label: tr('notifTemplates.nextFilterLabel', 'Filter by type'),\n description: tr(\n 'notifTemplates.nextFilterDesc',\n 'Narrow to Transactional, Marketing, System or Alert templates to find one fast.'\n ),\n onClick: () => updateFilter({ type: 'TRANSACTIONAL' }),\n },\n {\n id: 'use-on-send',\n label: tr('notifTemplates.nextUseLabel', 'Send with a template'),\n description: tr(\n 'notifTemplates.nextUseDesc',\n 'Pick any saved template from the Send page so every notification stays on-brand.'\n ),\n href: '../send',\n },\n ]}\n />\n\n {/* Search + Type filter row */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={filter.search || ''}\n onChange={(e) => updateFilter({ search: e.target.value })}\n placeholder={tr('notifTemplates.searchPlaceholder', 'Search templates...')}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n {/* Type filter */}\n <select\n value={filter.type || ''}\n onChange={(e) =>\n updateFilter({ type: (e.target.value || undefined) as NotificationType | undefined })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n >\n <option value=\"\">{tr('notifTemplates.allTypes', 'All Types')}</option>\n <option value=\"TRANSACTIONAL\">\n {tr('notifTemplates.typeTransactional', 'Transactional')}\n </option>\n <option value=\"MARKETING\">{tr('notifTemplates.typeMarketing', 'Marketing')}</option>\n <option value=\"SYSTEM\">{tr('notifTemplates.typeSystem', 'System')}</option>\n <option value=\"ALERT\">{tr('notifTemplates.typeAlert', 'Alert')}</option>\n </select>\n </div>\n\n {templates.length > 0 && (\n <GlassCard\n treatment=\"plain\"\n className=\"flex flex-col gap-3 border-border-seam p-4 sm:flex-row sm:items-center sm:justify-between\"\n >\n <label className=\"flex items-center gap-2 text-sm text-primary\">\n <input\n type=\"checkbox\"\n checked={allVisibleSelected}\n ref={(input) => {\n if (input) {\n input.indeterminate = partiallySelected && !allVisibleSelected;\n }\n }}\n onChange={(event) => toggleAllTemplates(event.target.checked)}\n aria-label={tr(\n 'notifTemplates.selectAllVisibleAria',\n 'Select all notification templates'\n )}\n className=\"h-4 w-4 rounded border-default text-accent-primary\"\n />\n <span>{tr('notifTemplates.selectAllVisible', 'Select all visible')}</span>\n </label>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-secondary\">\n {selectedTemplateIds.size} {tr('notifTemplates.selected', 'selected')}\n </span>\n {selectedTemplateIds.size > 0 && (\n <button\n onClick={() => setSelectedTemplateIds(new Set())}\n className=\"text-sm text-secondary hover:text-primary\"\n >\n {tr('notifTemplates.clearSelection', 'Clear selection')}\n </button>\n )}\n {canDeleteTemplate && (\n <button\n onClick={handleBulkDelete}\n disabled={selectedTemplates.length === 0 || isDeleting}\n className=\"flex items-center gap-2 px-3 py-2 text-sm font-medium text-error border border-error/30 hover:bg-error/10 rounded-lg transition-all duration-150 disabled:opacity-50\"\n >\n <Trash2 size={14} />\n {tr('notifTemplates.deleteSelected', 'Delete Selected')}\n {selectedTemplates.length > 0 ? ` (${selectedTemplates.length})` : ''}\n </button>\n )}\n </div>\n </GlassCard>\n )}\n\n {/* Delete error banner */}\n {deleteError && (\n <div className=\"flex items-center gap-3 p-3 bg-error/10 border border-error/30 rounded-lg\">\n <AlertCircle size={16} className=\"text-error shrink-0\" />\n <p className=\"text-sm text-error\">{deleteError}</p>\n </div>\n )}\n\n {/* Empty state */}\n {templates.length === 0 && !isLoading && (\n <IllustratedEmptyState\n illustration={filter.search || filter.type ? 'empty-search' : 'empty-files'}\n title={\n filter.search || filter.type\n ? tr('notifTemplates.noMatchingTemplates', 'No templates match your filters')\n : tr('notifTemplates.noTemplatesYet', 'No templates yet. Create your first one!')\n }\n description={\n filter.search || filter.type\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifTemplates.noTemplatesDescription',\n 'Reusable templates let you send consistent notifications fast.'\n )\n }\n action={\n !filter.search && !filter.type && canCreateTemplate ? (\n <Button onClick={() => navigate('new')} className=\"gap-2\">\n <Plus size={16} />\n {tr('notifTemplates.createTemplate', 'Create Template')}\n </Button>\n ) : undefined\n }\n />\n )}\n\n {/* Templates grid */}\n <div className=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {templates.map((template) => (\n <div\n key={template.id}\n onClick={() => navigate(template.slug)}\n className={`group relative p-4 bg-gloss-card border rounded-lg cursor-pointer transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)] hover:border-accent-primary/30 ${selectedTemplateIds.has(template.id) ? 'border-accent-primary/50 ring-1 ring-accent-primary/20' : 'border-border-seam'}`}\n >\n {/* Top row: icon + type badge + delete */}\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-2\">\n <input\n type=\"checkbox\"\n checked={selectedTemplateIds.has(template.id)}\n onChange={(event) => {\n event.stopPropagation();\n toggleTemplateSelection(template.id, event.target.checked);\n }}\n onClick={(event) => event.stopPropagation()}\n aria-label={tr(\n 'notifTemplates.selectTemplateAria',\n 'Select template {{name}}'\n ).replace('{{name}}', template.name)}\n className=\"h-4 w-4 rounded border-default text-accent-primary\"\n />\n <FileText size={20} className=\"text-accent-primary\" />\n </div>\n <div className=\"flex items-center gap-2\">\n <span\n className={`px-2 py-0.5 text-[10px] font-semibold rounded-full border ${\n TYPE_COLORS[template.type as NotificationType] ||\n 'text-tertiary bg-bg-sunken border-default'\n }`}\n >\n {tr(\n `notifTemplates.type.${template.type as NotificationType}`,\n TYPE_LABELS[template.type as NotificationType] || template.type\n )}\n </span>\n {canDeleteTemplate && (\n <button\n onClick={(e) => handleDelete(e, template)}\n disabled={isDeleting && deletingId === template.id}\n className=\"opacity-0 group-hover:opacity-100 p-1 text-tertiary hover:text-error rounded transition-all duration-150\"\n title={tr('notifTemplates.deleteTemplate', 'Delete template')}\n >\n {isDeleting && deletingId === template.id ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Trash2 size={14} />\n )}\n </button>\n )}\n </div>\n </div>\n\n {/* Name */}\n <h3 className=\"text-sm font-semibold text-primary mb-1 truncate\">{template.name}</h3>\n\n {/* Description */}\n {template.description && (\n <p className=\"text-xs text-secondary mb-2 line-clamp-2\">{template.description}</p>\n )}\n\n {/* Bottom row: slug + enabled badge + locale */}\n <div className=\"flex items-center gap-2 text-[11px] text-tertiary mt-auto pt-2 border-t border-default/50\">\n <code className=\"px-1.5 py-0.5 bg-bg-sunken rounded text-[10px]\">\n {template.slug}\n </code>\n <span>•</span>\n <span>{template.locale || 'en'}</span>\n <span>•</span>\n <span className={template.enabled ? 'text-success' : 'text-tertiary'}>\n {template.enabled\n ? tr('notifTemplates.enabled', 'Enabled')\n : tr('notifTemplates.disabled', 'Disabled')}\n </span>\n </div>\n\n {/* Updated date */}\n <p className=\"text-[10px] text-tertiary mt-1.5\">\n {tr('notifTemplates.updated', 'Updated')} {formatDate(template.updatedAt, locale)}\n </p>\n </div>\n ))}\n </div>\n\n {/* Load more */}\n {hasMore && (\n <div className=\"flex justify-center pt-2\">\n <button\n onClick={loadMore}\n disabled={isLoading}\n className=\"flex items-center gap-2 px-4 py-2 text-sm text-secondary hover:text-primary border border-default rounded-lg transition-all duration-150 hover:shadow-sm\"\n >\n {isLoading ? <Loader2 size={14} className=\"animate-spin\" /> : null}\n {tr('notifTemplates.loadMore', 'Load More')}\n </button>\n </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AD;OAAI,WAAU;iBAAoD,EAAS;OAAU,CAAA;MAGpF,EAAS,eACR,kBAAC,KAAD;OAAG,WAAU;iBAA4C,EAAS;OAAgB,CAAA;MAIpF,kBAAC,OAAD;OAAK,WAAU;iBAAf;QACE,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAS;SACL,CAAA;QACP,kBAAC,QAAD,EAAA,UAAM,KAAQ,CAAA;QACd,kBAAC,QAAD,EAAA,UAAO,EAAS,UAAU,MAAY,CAAA;QACtC,kBAAC,QAAD,EAAA,UAAM,KAAQ,CAAA;QACd,kBAAC,QAAD;SAAM,WAAW,EAAS,UAAU,iBAAiB;mBAClD,EAAS,UACN,EAAG,0BAA0B,UAAU,GACvC,EAAG,2BAA2B,WAAW;SACxC,CAAA;QACH;;MAGN,kBAAC,KAAD;OAAG,WAAU;iBAAb;QACG,EAAG,0BAA0B,UAAU;QAAC;QAAE,EAAW,EAAS,WAAW,EAAO;QAC/E;;MACA;OA/EC,EAAS,GA+EV,CACN;IACE,CAAA;GAGL,KACC,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,UAAD;KACE,SAAS;KACT,UAAU;KACV,WAAU;eAHZ,CAKG,IAAY,kBAAC,GAAD;MAAS,MAAM;MAAI,WAAU;MAAiB,CAAA,GAAG,MAC7D,EAAG,2BAA2B,YAAY,CACpC;;IACL,CAAA;GAEJ;MAnUJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,mCACA,4DACD;EACG,CAAA"}
1
+ {"version":3,"file":"NotificationTemplatesPage.js","names":[],"sources":["../../src/pages/NotificationTemplatesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { FileText, Plus, Search, Trash2, Loader2, AlertCircle, RefreshCw } from 'lucide-react';\nimport { useNavigate } from 'react-router';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTemplates } from '../hooks/useNotificationTemplates';\nimport type { BackendNotificationTemplate } from '../hooks/useNotificationTemplates';\nimport type { NotificationType } from '../types';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../utils/nativeBridge';\n\n// ── Helpers ────────────────────────────────────────────────────────────\n\nconst TYPE_COLORS: Record<NotificationType, string> = {\n TRANSACTIONAL: 'text-status-info-text bg-status-info-bg-subtle border-status-info-bg-subtle',\n MARKETING: 'text-accent-purple bg-accent-purple-subtle border-accent-purple-subtle',\n SYSTEM: 'text-status-warning-text bg-status-warning-bg-subtle border-status-warning-bg-subtle',\n ALERT: 'text-status-error-text bg-status-error-bg-subtle border-status-error-bg-subtle',\n};\n\nconst TYPE_LABELS: Record<NotificationType, string> = {\n TRANSACTIONAL: 'Transactional',\n MARKETING: 'Marketing',\n SYSTEM: 'System',\n ALERT: 'Alert',\n};\n\nfunction formatDate(iso: string, locale?: string) {\n return new Date(iso).toLocaleDateString(locale || 'en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n });\n}\n\n// ── Component ──────────────────────────────────────────────────────────\n\n/**\n * Notification Templates Page (Admin)\n *\n * Lists all notification templates from the real backend.\n * Supports search, type filtering, delete, and navigation to editor.\n */\nexport function NotificationTemplatesPage() {\n const navigate = useNavigate();\n const tr = useTr();\n const { locale } = useI18n();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const {\n templates,\n isLoading,\n isDeleting,\n error,\n total,\n hasMore,\n filter,\n refetch,\n loadMore,\n deleteTemplate,\n updateFilter,\n } = useNotificationTemplates();\n\n const [deletingId, setDeletingId] = useState<string | null>(null);\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [selectedTemplateIds, setSelectedTemplateIds] = useState<Set<string>>(new Set());\n\n const selectedTemplates = useMemo(\n () => templates.filter((template) => selectedTemplateIds.has(template.id)),\n [selectedTemplateIds, templates]\n );\n\n const allVisibleSelected =\n templates.length > 0 && templates.every((template) => selectedTemplateIds.has(template.id));\n const partiallySelected =\n templates.some((template) => selectedTemplateIds.has(template.id)) && !allVisibleSelected;\n\n const canCreateTemplate = hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_CREATE);\n const canDeleteTemplate = hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_DELETE);\n\n const handleDelete = async (e: React.MouseEvent, template: BackendNotificationTemplate) => {\n e.stopPropagation();\n nativeImpact('medium');\n const message = tr(\n 'notifTemplates.confirmDelete',\n `Delete template \"${template.name}\"? This cannot be undone.`\n );\n const nativeResult = await nativeConfirm({\n title: tr('notifTemplates.deleteTitle', 'Delete template'),\n message,\n okButtonTitle: tr('notifTemplates.delete', 'Delete'),\n });\n const confirmed = nativeResult === null ? confirm(message) : nativeResult;\n if (!confirmed) return;\n\n setDeletingId(template.id);\n setDeleteError(null);\n try {\n await deleteTemplate(template.id);\n void nativeNotify('success');\n } catch (err: unknown) {\n void nativeNotify('error');\n setDeleteError(\n err instanceof Error\n ? err.message\n : tr('notifTemplates.deleteFailed', 'Failed to delete template')\n );\n } finally {\n setDeletingId(null);\n }\n };\n\n const handleBulkDelete = async () => {\n if (selectedTemplates.length === 0) return;\n nativeImpact('medium');\n const message = tr(\n 'notifTemplates.confirmBulkDelete',\n `Delete ${selectedTemplates.length} selected template${selectedTemplates.length === 1 ? '' : 's'}? This cannot be undone.`\n );\n const nativeResult = await nativeConfirm({\n title: tr('notifTemplates.bulkDeleteTitle', 'Delete templates'),\n message,\n okButtonTitle: tr('notifTemplates.delete', 'Delete'),\n });\n const confirmed = nativeResult === null ? window.confirm(message) : nativeResult;\n if (!confirmed) return;\n\n setDeleteError(null);\n const results = await Promise.allSettled(\n selectedTemplates.map((template) => deleteTemplate(template.id))\n );\n const failed = results.some((r) => r.status === 'rejected');\n void nativeNotify(failed ? 'error' : 'success');\n setSelectedTemplateIds(new Set());\n };\n\n const toggleTemplateSelection = (templateId: string, checked: boolean) => {\n setSelectedTemplateIds((prev) => {\n const next = new Set(prev);\n if (checked) {\n next.add(templateId);\n } else {\n next.delete(templateId);\n }\n return next;\n });\n };\n\n const toggleAllTemplates = (checked: boolean) => {\n setSelectedTemplateIds((prev) => {\n const next = new Set(prev);\n templates.forEach((template) => {\n if (checked) {\n next.add(template.id);\n } else {\n next.delete(template.id);\n }\n });\n return next;\n });\n };\n\n // ── Permission guards ────────────────────────────────────────────────\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 // TEMPLATE_LIST admits read-only admins; the page already hides/disables write actions for them.\n const canViewTemplates =\n hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_LIST) ||\n canCreateTemplate ||\n canDeleteTemplate ||\n hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_UPDATE);\n\n if (!canViewTemplates) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifTemplates.noPermissionView',\n \"You don't have permission to view notification templates.\"\n )}\n </div>\n );\n }\n\n // ── Loading state ────────────────────────────────────────────────────\n if (isLoading && templates.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center h-64 gap-3\">\n <Loader2 size={28} className=\"animate-spin text-accent-primary\" />\n <p className=\"text-sm text-secondary\">\n {tr('notifTemplates.loading', 'Loading templates...')}\n </p>\n </div>\n );\n }\n\n // ── Error state ──────────────────────────────────────────────────────\n if (error && templates.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center h-64 gap-4\">\n <AlertCircle size={28} className=\"text-error\" />\n <p className=\"text-sm text-error\">{error}</p>\n <button\n onClick={refetch}\n className=\"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-accent-primary hover:bg-accent-primary/90 rounded-lg transition-all duration-150\"\n >\n <RefreshCw size={14} />\n {tr('notifTemplates.retry', 'Retry')}\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<FileText size={16} />}>\n {tr(\n 'notifTemplates.purpose',\n 'Reusable, versioned message blueprints — subject lines, bodies and channel layouts with {{variables}} you fill in at send time. Build a template once (e.g. a welcome email or a payment receipt) and reuse it from the Send page so every notification stays on-brand and consistent.'\n )}\n </PagePurpose>\n\n {/* Header — single emphasis zone (count summary + the one create CTA). */}\n <EmphasisPanel className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\">\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifTemplates.title', 'Notification Templates')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {total} {tr('notifTemplates.templateCount', 'template')}\n {total !== 1 ? 's' : ''} {tr('notifTemplates.total', 'total')}\n </p>\n </div>\n\n {canCreateTemplate && (\n <Button onClick={() => navigate('new')} className=\"gap-2\">\n <Plus size={16} />\n {tr('notifTemplates.createTemplate', 'Create Template')}\n </Button>\n )}\n </EmphasisPanel>\n\n <NextSteps\n storageKey=\"notification-templates\"\n steps={[\n ...(canCreateTemplate\n ? [\n {\n id: 'create-template',\n label: tr('notifTemplates.nextCreateLabel', 'Create your first template'),\n description: tr(\n 'notifTemplates.nextCreateDesc',\n 'Build a reusable message blueprint with {{variables}} you fill in at send time.'\n ),\n onClick: () => navigate('new'),\n },\n ]\n : []),\n {\n id: 'filter-type',\n label: tr('notifTemplates.nextFilterLabel', 'Filter by type'),\n description: tr(\n 'notifTemplates.nextFilterDesc',\n 'Narrow to Transactional, Marketing, System or Alert templates to find one fast.'\n ),\n onClick: () => updateFilter({ type: 'TRANSACTIONAL' }),\n },\n {\n id: 'use-on-send',\n label: tr('notifTemplates.nextUseLabel', 'Send with a template'),\n description: tr(\n 'notifTemplates.nextUseDesc',\n 'Pick any saved template from the Send page so every notification stays on-brand.'\n ),\n href: '../send',\n },\n ]}\n />\n\n {/* Search + Type filter row */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={filter.search || ''}\n onChange={(e) => updateFilter({ search: e.target.value })}\n placeholder={tr('notifTemplates.searchPlaceholder', 'Search templates...')}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n {/* Type filter */}\n <select\n value={filter.type || ''}\n onChange={(e) =>\n updateFilter({ type: (e.target.value || undefined) as NotificationType | undefined })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifTemplates.allTypes', 'All Types')}</option>\n <option value=\"TRANSACTIONAL\">\n {tr('notifTemplates.typeTransactional', 'Transactional')}\n </option>\n <option value=\"MARKETING\">{tr('notifTemplates.typeMarketing', 'Marketing')}</option>\n <option value=\"SYSTEM\">{tr('notifTemplates.typeSystem', 'System')}</option>\n <option value=\"ALERT\">{tr('notifTemplates.typeAlert', 'Alert')}</option>\n </select>\n </div>\n\n {templates.length > 0 && (\n <GlassCard\n treatment=\"plain\"\n className=\"flex flex-col gap-3 border-border-seam p-4 sm:flex-row sm:items-center sm:justify-between\"\n >\n <label className=\"flex items-center gap-2 text-sm text-primary\">\n <input\n type=\"checkbox\"\n checked={allVisibleSelected}\n ref={(input) => {\n if (input) {\n input.indeterminate = partiallySelected && !allVisibleSelected;\n }\n }}\n onChange={(event) => toggleAllTemplates(event.target.checked)}\n aria-label={tr(\n 'notifTemplates.selectAllVisibleAria',\n 'Select all notification templates'\n )}\n className=\"h-4 w-4 rounded border-default text-accent-primary\"\n />\n <span>{tr('notifTemplates.selectAllVisible', 'Select all visible')}</span>\n </label>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-secondary\">\n {selectedTemplateIds.size} {tr('notifTemplates.selected', 'selected')}\n </span>\n {selectedTemplateIds.size > 0 && (\n <button\n onClick={() => setSelectedTemplateIds(new Set())}\n className=\"text-sm text-secondary hover:text-primary\"\n >\n {tr('notifTemplates.clearSelection', 'Clear selection')}\n </button>\n )}\n {canDeleteTemplate && (\n <button\n onClick={handleBulkDelete}\n disabled={selectedTemplates.length === 0 || isDeleting}\n className=\"flex items-center gap-2 px-3 py-2 text-sm font-medium text-error border border-error/30 hover:bg-error/10 rounded-lg transition-all duration-150 disabled:opacity-50\"\n >\n <Trash2 size={14} />\n {tr('notifTemplates.deleteSelected', 'Delete Selected')}\n {selectedTemplates.length > 0 ? ` (${selectedTemplates.length})` : ''}\n </button>\n )}\n </div>\n </GlassCard>\n )}\n\n {/* Delete error banner */}\n {deleteError && (\n <div className=\"flex items-center gap-3 p-3 bg-error/10 border border-error/30 rounded-lg\">\n <AlertCircle size={16} className=\"text-error shrink-0\" />\n <p className=\"text-sm text-error\">{deleteError}</p>\n </div>\n )}\n\n {/* Empty state */}\n {templates.length === 0 && !isLoading && (\n <IllustratedEmptyState\n illustration={filter.search || filter.type ? 'empty-search' : 'empty-files'}\n title={\n filter.search || filter.type\n ? tr('notifTemplates.noMatchingTemplates', 'No templates match your filters')\n : tr('notifTemplates.noTemplatesYet', 'No templates yet. Create your first one!')\n }\n description={\n filter.search || filter.type\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifTemplates.noTemplatesDescription',\n 'Reusable templates let you send consistent notifications fast.'\n )\n }\n action={\n !filter.search && !filter.type && canCreateTemplate ? (\n <Button onClick={() => navigate('new')} className=\"gap-2\">\n <Plus size={16} />\n {tr('notifTemplates.createTemplate', 'Create Template')}\n </Button>\n ) : undefined\n }\n />\n )}\n\n {/* Templates grid */}\n <div className=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {templates.map((template) => (\n <div\n key={template.id}\n onClick={() => navigate(template.slug)}\n className={`group relative p-4 bg-gloss-card border rounded-lg cursor-pointer transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)] hover:border-accent-primary/30 ${selectedTemplateIds.has(template.id) ? 'border-accent-primary/50 ring-1 ring-accent-primary/20' : 'border-border-seam'}`}\n >\n {/* Top row: icon + type badge + delete */}\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-2\">\n <input\n type=\"checkbox\"\n checked={selectedTemplateIds.has(template.id)}\n onChange={(event) => {\n event.stopPropagation();\n toggleTemplateSelection(template.id, event.target.checked);\n }}\n onClick={(event) => event.stopPropagation()}\n aria-label={tr(\n 'notifTemplates.selectTemplateAria',\n 'Select template {{name}}'\n ).replace('{{name}}', template.name)}\n className=\"h-4 w-4 rounded border-default text-accent-primary\"\n />\n <FileText size={20} className=\"text-accent-primary\" />\n </div>\n <div className=\"flex items-center gap-2\">\n <span\n className={`px-2 py-0.5 text-[10px] font-semibold rounded-full border ${\n TYPE_COLORS[template.type as NotificationType] ||\n 'text-tertiary bg-bg-sunken border-default'\n }`}\n >\n {tr(\n `notifTemplates.type.${template.type as NotificationType}`,\n TYPE_LABELS[template.type as NotificationType] || template.type\n )}\n </span>\n {canDeleteTemplate && (\n <button\n onClick={(e) => handleDelete(e, template)}\n disabled={isDeleting && deletingId === template.id}\n className=\"opacity-0 group-hover:opacity-100 p-1 text-tertiary hover:text-error rounded transition-all duration-150\"\n title={tr('notifTemplates.deleteTemplate', 'Delete template')}\n >\n {isDeleting && deletingId === template.id ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Trash2 size={14} />\n )}\n </button>\n )}\n </div>\n </div>\n\n {/* Name */}\n <h3 className=\"text-sm font-semibold text-primary mb-1 truncate\">{template.name}</h3>\n\n {/* Description */}\n {template.description && (\n <p className=\"text-xs text-secondary mb-2 line-clamp-2\">{template.description}</p>\n )}\n\n {/* Bottom row: slug + enabled badge + locale */}\n <div className=\"flex items-center gap-2 text-[11px] text-tertiary mt-auto pt-2 border-t border-default/50\">\n <code className=\"px-1.5 py-0.5 bg-bg-sunken rounded text-[10px]\">\n {template.slug}\n </code>\n <span>•</span>\n <span>{template.locale || 'en'}</span>\n <span>•</span>\n <span className={template.enabled ? 'text-success' : 'text-tertiary'}>\n {template.enabled\n ? tr('notifTemplates.enabled', 'Enabled')\n : tr('notifTemplates.disabled', 'Disabled')}\n </span>\n </div>\n\n {/* Updated date */}\n <p className=\"text-[10px] text-tertiary mt-1.5\">\n {tr('notifTemplates.updated', 'Updated')} {formatDate(template.updatedAt, locale)}\n </p>\n </div>\n ))}\n </div>\n\n {/* Load more */}\n {hasMore && (\n <div className=\"flex justify-center pt-2\">\n <button\n onClick={loadMore}\n disabled={isLoading}\n className=\"flex items-center gap-2 px-4 py-2 text-sm text-secondary hover:text-primary border border-default rounded-lg transition-all duration-150 hover:shadow-sm\"\n >\n {isLoading ? <Loader2 size={14} className=\"animate-spin\" /> : null}\n {tr('notifTemplates.loadMore', 'Load More')}\n </button>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAM,KAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;CACR,EAEK,KAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;CACR;AAED,SAAS,EAAW,GAAa,GAAiB;AAChD,QAAO,IAAI,KAAK,EAAI,CAAC,mBAAmB,KAAU,SAAS;EACzD,OAAO;EACP,KAAK;EACL,MAAM;EACP,CAAC;;AAWJ,SAAgB,IAA4B;CAC1C,IAAM,IAAW,GAAa,EACxB,IAAK,GAAO,EACZ,EAAE,cAAW,GAAS,EACtB,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EACJ,cACA,cACA,eACA,UACA,UACA,YACA,WACA,YACA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