@burdenoff/microfe-notification 2026.1109.1 → 2026.1113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/NotificationRoutes.js +108 -36
  2. package/dist/NotificationRoutes.js.map +1 -1
  3. package/dist/components/ConfirmDeleteDialog.d.ts +17 -0
  4. package/dist/components/ConfirmDeleteDialog.js +22 -0
  5. package/dist/components/ConfirmDeleteDialog.js.map +1 -0
  6. package/dist/components/NotificationCard.d.ts +10 -1
  7. package/dist/components/NotificationCard.js +103 -72
  8. package/dist/components/NotificationCard.js.map +1 -1
  9. package/dist/hooks/index.js +5 -5
  10. package/dist/hooks/usePreferenceToggles.d.ts +27 -0
  11. package/dist/hooks/usePreferenceToggles.js +84 -0
  12. package/dist/hooks/usePreferenceToggles.js.map +1 -0
  13. package/dist/navigation-v2/AdminPageV2.d.ts +14 -0
  14. package/dist/navigation-v2/AdminPageV2.js +51 -0
  15. package/dist/navigation-v2/AdminPageV2.js.map +1 -0
  16. package/dist/navigation-v2/AdminToolsMenu.d.ts +6 -0
  17. package/dist/navigation-v2/AdminToolsMenu.js +32 -0
  18. package/dist/navigation-v2/AdminToolsMenu.js.map +1 -0
  19. package/dist/navigation-v2/BackToNotifications.d.ts +2 -0
  20. package/dist/navigation-v2/BackToNotifications.js +20 -0
  21. package/dist/navigation-v2/BackToNotifications.js.map +1 -0
  22. package/dist/navigation-v2/FilterControls.d.ts +25 -0
  23. package/dist/navigation-v2/FilterControls.js +64 -0
  24. package/dist/navigation-v2/FilterControls.js.map +1 -0
  25. package/dist/navigation-v2/NotificationArchivedV2.d.ts +9 -0
  26. package/dist/navigation-v2/NotificationArchivedV2.js +174 -0
  27. package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -0
  28. package/dist/navigation-v2/NotificationInboxV2.d.ts +9 -0
  29. package/dist/navigation-v2/NotificationInboxV2.js +309 -0
  30. package/dist/navigation-v2/NotificationInboxV2.js.map +1 -0
  31. package/dist/navigation-v2/NotificationSettingsV2.d.ts +9 -0
  32. package/dist/navigation-v2/NotificationSettingsV2.js +203 -0
  33. package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -0
  34. package/dist/navigation-v2/NotificationsV2Landing.d.ts +9 -0
  35. package/dist/navigation-v2/NotificationsV2Landing.js +37 -0
  36. package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -0
  37. package/dist/navigation-v2/__tests__/uiMocks.d.ts +71 -0
  38. package/dist/navigation-v2/inboxFilters.d.ts +8 -0
  39. package/dist/navigation-v2/inboxFilters.js +10 -0
  40. package/dist/navigation-v2/inboxFilters.js.map +1 -0
  41. package/dist/navigation-v2/paths.d.ts +24 -0
  42. package/dist/navigation-v2/paths.js +31 -0
  43. package/dist/navigation-v2/paths.js.map +1 -0
  44. package/dist/navigation-v2/settingsOptions.d.ts +12 -0
  45. package/dist/navigation-v2/settingsOptions.js +58 -0
  46. package/dist/navigation-v2/settingsOptions.js.map +1 -0
  47. package/dist/navigation-v2/useAdminTools.d.ts +22 -0
  48. package/dist/navigation-v2/useAdminTools.js +76 -0
  49. package/dist/navigation-v2/useAdminTools.js.map +1 -0
  50. package/dist/pages/CreateNotificationPage.js +577 -558
  51. package/dist/pages/CreateNotificationPage.js.map +1 -1
  52. package/dist/pages/NotificationCenterPage.d.ts +3 -1
  53. package/dist/pages/NotificationCenterPage.js +79 -74
  54. package/dist/pages/NotificationCenterPage.js.map +1 -1
  55. package/dist/pages/NotificationHistoryPage.d.ts +5 -1
  56. package/dist/pages/NotificationHistoryPage.js +52 -47
  57. package/dist/pages/NotificationHistoryPage.js.map +1 -1
  58. package/dist/pages/NotificationPreferencesPage.d.ts +4 -0
  59. package/dist/pages/NotificationPreferencesPage.js +97 -158
  60. package/dist/pages/NotificationPreferencesPage.js.map +1 -1
  61. package/dist/pages/NotificationTemplatesPage.js +184 -166
  62. package/dist/pages/NotificationTemplatesPage.js.map +1 -1
  63. package/dist/pages/NotificationTopicsPage.js +123 -108
  64. package/dist/pages/NotificationTopicsPage.js.map +1 -1
  65. package/dist/pages/TemplateEditorPage.js +339 -308
  66. package/dist/pages/TemplateEditorPage.js.map +1 -1
  67. package/dist/providers/NotificationProvider.js +6 -5
  68. package/dist/providers/NotificationProvider.js.map +1 -1
  69. package/dist/types/index.d.ts +8 -0
  70. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationHistoryPage.js","names":["HISTORY_FILTER","NotificationHistoryPage","tr","useTr","permissionsLoading","usePermissions","useNotification","useNotificationTopics","useNotifications","hasActiveFilters","notificationFilter","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","PagePurpose","History","EmphasisPanel","Button","exportNotificationsAsCsv","notifications","Download","GlassCard","Search","updateFilter","event","topics","topic","NotificationCard","archiveNotification","recordAction","notification","unarchiveNotification","IllustratedEmptyState"],"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,IAAMA,IAAiB;CAAE,UAAU;CAAM,SAAS;AAAe;AAGjE,SAAgBC,IAA0B;CACxC,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,mBAAgBC,EAAgB,GAClC,EAAE,cAAWC,EAAsB,EAAE,UAAU,GAAK,CAAC,GACrD,EACJ,kBACA,uBACA,iBACA,wBACA,0BACA,oBACEC,EAAiB,EAAE,YAAYR,EAAe,CAAC,GAE7CS,IAAmB,GACvBC,EAAmB,UACnBA,EAAmB,WACnBA,EAAmB,UAAU,SAC7BA,EAAmB,UAAU;CAsB/B,OAnBIN,IAEA,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;CAC9F,CAAA,IAIL,CAACO,EAAcC,EAAyB,iBAAiB,KAAK,CAACC,GAAa,KAE5E,kBAAC,OAAD;EAAK,WAAU;EACZ,UAAAX,EACC,qCACA,yDACF;CACG,CAAA,IAKP,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAACY,GAAD;IAAa,MAAM,kBAACC,GAAD,EAAS,MAAM,GAAK,CAAA;I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EA,EACE,yCACA,oFACF;KAEP,CAAA;IACE,CAAA;GAEJ,CAAA;EACF;;AAET"}
1
+ {"version":3,"file":"NotificationHistoryPage.js","names":["HISTORY_FILTER","NotificationHistoryPage","useNotification","jsx","navigationV2","NotificationArchivedV2","ClassicNotificationHistoryPage","tr","useTr","permissionsLoading","usePermissions","useNotificationTopics","useNotifications","hasActiveFilters","notificationFilter","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","PagePurpose","History","EmphasisPanel","Button","exportNotificationsAsCsv","notifications","Download","GlassCard","Search","updateFilter","event","topics","topic","NotificationCard","archiveNotification","recordAction","notification","unarchiveNotification","IllustratedEmptyState"],"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';\nimport { NotificationArchivedV2 } from '../navigation-v2/NotificationArchivedV2';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\n\n/**\n * User Notification History — personal history, filter, CSV export,\n * archive/unarchive. Under FluidGrids' Navigation v2 (BOFF-11872) it is the\n * \"Archived\" view instead; every other app keeps this page.\n */\nexport function NotificationHistoryPage() {\n const { navigationV2 } = useNotification();\n return navigationV2 ? <NotificationArchivedV2 /> : <ClassicNotificationHistoryPage />;\n}\n\nfunction ClassicNotificationHistoryPage() {\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":";;;;;;;;;;;;;;AAiBA,IAAMA,IAAiB;CAAE,UAAU;CAAM,SAAS;AAAe;AAOjE,SAAgBC,IAA0B;CACxC,IAAM,EAAE,oBAAiBC,EAAgB;CACzC,OAAsBC,EAAfC,IAAgBC,IAA6BC,GAA9B,CAAyB,CAAqC;AACtF;AAEA,SAASA,IAAiC;CACxC,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,mBAAgBR,EAAgB,GAClC,EAAE,cAAWS,EAAsB,EAAE,UAAU,GAAK,CAAC,GACrD,EACJ,kBACA,uBACA,iBACA,wBACA,0BACA,oBACEC,EAAiB,EAAE,YAAYZ,EAAe,CAAC,GAE7Ca,IAAmB,GACvBC,EAAmB,UACnBA,EAAmB,WACnBA,EAAmB,UAAU,SAC7BA,EAAmB,UAAU;CAsB/B,OAnBIL,IAEA,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;CAC9F,CAAA,IAIL,CAACM,EAAcC,E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EAkBlB,CACN,IAED,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAACE,GAAD;MACE,cAAcvB,IAAmB,iBAAiB;MAClD,OACEA,IACIN,EAAG,sCAAsC,wBAAwB,IACjEA,EAAG,mCAAmC,gBAAgB;MAE5D,aACEM,IACIN,EAAG,yCAAyC,4BAA4B,IACxEA,EACE,yCACA,oFACF;KAEP,CAAA;IACE,CAAA;GAEJ,CAAA;EACF;;AAET"}
@@ -1 +1,5 @@
1
+ /**
2
+ * Notification preferences. Under FluidGrids' Navigation v2 (BOFF-11872) it
3
+ * is "Notification settings" instead; every other app keeps this page.
4
+ */
1
5
  export declare function NotificationPreferencesPage(): import('react').JSX.Element;
@@ -1,18 +1,17 @@
1
1
  import "../hooks/index.js";
2
- import { useNotificationAnalytics as e } from "../hooks/useNotificationAnalytics.js";
3
- import { useNotificationPreferences as t } from "../hooks/useNotificationPreferences.js";
4
- import { useNotificationTopics as n } from "../hooks/useNotificationTopics.js";
5
- import { NOTIFICATION_PERMISSIONS as r } from "../constants/permissions.js";
6
- import { useNotification as i } from "../providers/NotificationProvider.js";
7
- import { useTr as a } from "../shared/hooks/useTr.js";
8
- import { nativeImpact as o, nativeNotify as s } from "../utils/nativeBridge.js";
9
- import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
10
- import { usePermissions as f } from "@burdenoff/fe-libs/shared/providers/shell";
11
- import { BellRing as p, Search as m, ToggleLeft as h, ToggleRight as g } from "lucide-react";
12
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
- import { EmphasisPanel as y, IllustratedEmptyState as b, OptionalFields as x, PagePurpose as S } from "@burdenoff/fe-libs/ui";
2
+ import { useNotificationTopics as e } from "../hooks/useNotificationTopics.js";
3
+ import { usePreferenceToggles as t } from "../hooks/usePreferenceToggles.js";
4
+ import { NOTIFICATION_PERMISSIONS as n } from "../constants/permissions.js";
5
+ import { useNotification as r } from "../providers/NotificationProvider.js";
6
+ import { useTr as i } from "../shared/hooks/useTr.js";
7
+ import { NotificationSettingsV2 as a } from "../navigation-v2/NotificationSettingsV2.js";
8
+ import { useMemo as o, useState as s } from "react";
9
+ import { usePermissions as c } from "@burdenoff/fe-libs/shared/providers/shell";
10
+ import { BellRing as l, Search as u, ToggleLeft as d, ToggleRight as f } from "lucide-react";
11
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
12
+ import { EmphasisPanel as h, IllustratedEmptyState as g, OptionalFields as _, PagePurpose as v } from "@burdenoff/fe-libs/ui";
14
13
  // src/pages/NotificationPreferencesPage.tsx
15
- var C = [
14
+ var y = [
16
15
  {
17
16
  value: "IN_APP",
18
17
  labelKey: "notifications.channelInApp",
@@ -43,7 +42,7 @@ var C = [
43
42
  labelKey: "notifications.channelSlack",
44
43
  label: "Slack"
45
44
  }
46
- ], w = [
45
+ ], b = [
47
46
  {
48
47
  value: "TRANSACTIONAL",
49
48
  labelKey: "notifications.typeTransactional",
@@ -65,241 +64,181 @@ var C = [
65
64
  label: "Marketing"
66
65
  }
67
66
  ];
68
- function T(e) {
69
- return e.scope === "CHANNEL" ? `CHANNEL:${e.channel || ""}` : e.scope === "TYPE" ? `TYPE:${e.type || ""}` : e.scope === "TOPIC" ? `TOPIC:${e.topicId || ""}` : "GLOBAL";
67
+ function x() {
68
+ let { navigationV2: e } = r();
69
+ return p(e ? a : S, {});
70
70
  }
71
- function E() {
72
- let E = a(), { hasPermission: D, isLoading: O } = f(), { currentUser: k } = i(), { topics: A, isLoading: j, isForbidden: M } = n({
71
+ function S() {
72
+ let a = i(), { hasPermission: x, isLoading: S } = c(), { currentUser: C } = r(), { topics: w, isLoading: T, isForbidden: E } = e({
73
73
  type: "MARKETING",
74
74
  isActive: !0
75
- }), { preferencesByKey: N, isLoading: P, setPreference: F, deletePreference: I } = t(), { trackPreferenceUpdated: L } = e(), [R, z] = d(""), [B, V] = d(null), [H, U] = d(null), W = u(null), G = j || P;
76
- c(() => () => {
77
- W.current && clearTimeout(W.current);
78
- }, []);
79
- let K = (e) => {
80
- W.current && clearTimeout(W.current), U(e), W.current = setTimeout(() => {
81
- U((t) => t?.key === e.key ? null : t), W.current = null;
82
- }, 2500);
83
- }, q = l(() => {
84
- if (!R.trim()) return A;
85
- let e = R.toLowerCase();
86
- return A.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
87
- }, [R, A]), J = async (e) => {
88
- let t = T(e), n = N.get(t), r = !(n?.enabled ?? !0);
89
- V(t), o("medium");
90
- try {
91
- await F({
92
- ...e,
93
- enabled: r,
94
- frequency: n?.frequency || "IMMEDIATE"
95
- }), L({
96
- action: "set",
97
- scope: e.scope,
98
- channel: e.channel,
99
- type: e.type,
100
- enabled: r
101
- }), K({
102
- key: t,
103
- type: "success",
104
- message: E("notifications.preferenceSaved", "Preference saved.")
105
- }), s("success");
106
- } catch {
107
- K({
108
- key: t,
109
- type: "error",
110
- message: E("notifications.preferenceSaveFailed", "Could not save preference.")
111
- }), s("error");
112
- } finally {
113
- V(null);
114
- }
115
- }, Y = async (e) => {
116
- let t = N.get(e);
117
- if (t) {
118
- V(e);
119
- try {
120
- await I(t.id), L({
121
- action: "reset",
122
- scope: t.scope,
123
- channel: t.channel,
124
- type: t.type
125
- }), K({
126
- key: e,
127
- type: "success",
128
- message: E("notifications.preferenceReset", "Preference reset.")
129
- });
130
- } catch {
131
- K({
132
- key: e,
133
- type: "error",
134
- message: E("notifications.preferenceResetFailed", "Could not reset preference.")
135
- });
136
- } finally {
137
- V(null);
138
- }
139
- }
140
- }, X = (e) => {
141
- let t = N.get(e.key), n = t?.enabled ?? !0, r = B === e.key, i = H?.key === e.key ? H : null;
142
- return /* @__PURE__ */ v("div", {
75
+ }), { preferencesByKey: D, preferencesLoading: O, savingKey: k, saveFeedback: A, togglePreference: j, resetPreference: M } = t(), [N, P] = s(""), F = T || O, I = o(() => {
76
+ if (!N.trim()) return w;
77
+ let e = N.toLowerCase();
78
+ return w.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
79
+ }, [N, w]), L = (e) => {
80
+ let t = D.get(e.key), n = t?.enabled ?? !0, r = k === e.key, i = A?.key === e.key ? A : null;
81
+ return /* @__PURE__ */ m("div", {
143
82
  className: "rounded-lg border border-border-seam bg-gloss-card p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)]",
144
- children: [/* @__PURE__ */ v("div", {
83
+ children: [/* @__PURE__ */ m("div", {
145
84
  className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
146
- children: [/* @__PURE__ */ v("div", {
85
+ children: [/* @__PURE__ */ m("div", {
147
86
  className: "space-y-1",
148
- children: [/* @__PURE__ */ v("div", {
87
+ children: [/* @__PURE__ */ m("div", {
149
88
  className: "flex items-center gap-2",
150
89
  children: [
151
- /* @__PURE__ */ _(p, {
90
+ /* @__PURE__ */ p(l, {
152
91
  size: 16,
153
92
  className: "text-accent-primary"
154
93
  }),
155
- /* @__PURE__ */ _("h2", {
94
+ /* @__PURE__ */ p("h2", {
156
95
  className: "text-sm font-semibold text-primary",
157
96
  children: e.title
158
97
  }),
159
- t && /* @__PURE__ */ _("span", {
98
+ t && /* @__PURE__ */ p("span", {
160
99
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary",
161
100
  children: t.frequency.replace("_", " ").toLowerCase()
162
101
  })
163
102
  ]
164
- }), /* @__PURE__ */ _("p", {
103
+ }), /* @__PURE__ */ p("p", {
165
104
  className: "text-sm text-secondary",
166
105
  children: e.description
167
106
  })]
168
- }), /* @__PURE__ */ v("div", {
107
+ }), /* @__PURE__ */ m("div", {
169
108
  className: "flex items-center gap-2",
170
- children: [t && /* @__PURE__ */ _("button", {
109
+ children: [t && /* @__PURE__ */ p("button", {
171
110
  type: "button",
172
111
  disabled: r,
173
- onClick: () => Y(e.key),
112
+ onClick: () => M(e.key),
174
113
  className: "rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50",
175
- children: E("notifications.reset", "Reset")
176
- }), /* @__PURE__ */ v("button", {
114
+ children: a("notifications.reset", "Reset")
115
+ }), /* @__PURE__ */ m("button", {
177
116
  type: "button",
178
117
  "aria-pressed": n,
179
118
  disabled: r,
180
- onClick: () => J({
119
+ onClick: () => j({
181
120
  scope: e.scope,
182
121
  channel: e.channel,
183
122
  type: e.type,
184
123
  topicId: e.topicId
185
124
  }),
186
125
  className: `inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${n ? "border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90" : "border-default bg-bg-sunken text-secondary hover:bg-bg-sunken/80"} disabled:cursor-not-allowed disabled:opacity-50`,
187
- children: [_(n ? g : h, { size: 18 }), r ? E("notifications.saving", "Saving...") : n ? E("notifications.enabled", "Enabled") : E("notifications.disabled", "Disabled")]
126
+ children: [p(n ? f : d, { size: 18 }), r ? a("notifications.saving", "Saving...") : n ? a("notifications.enabled", "Enabled") : a("notifications.disabled", "Disabled")]
188
127
  })]
189
128
  })]
190
- }), /* @__PURE__ */ _("div", {
129
+ }), /* @__PURE__ */ p("div", {
191
130
  className: "mt-3 min-h-5",
192
131
  "aria-live": "polite",
193
- children: i && /* @__PURE__ */ _("p", {
132
+ children: i && /* @__PURE__ */ p("p", {
194
133
  className: `text-xs ${i.type === "success" ? "text-success" : "text-error"}`,
195
134
  children: i.message
196
135
  })
197
136
  })]
198
137
  }, e.key);
199
138
  };
200
- return O ? /* @__PURE__ */ _("div", {
139
+ return S ? /* @__PURE__ */ p("div", {
201
140
  className: "flex h-64 items-center justify-center",
202
- children: /* @__PURE__ */ _("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
203
- }) : !D(r.NOTIFICATION_LIST) && !k?.id ? /* @__PURE__ */ _("div", {
141
+ children: /* @__PURE__ */ p("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
142
+ }) : !x(n.NOTIFICATION_LIST) && !C?.id ? /* @__PURE__ */ p("div", {
204
143
  className: "p-8 text-center text-text-secondary",
205
- children: E("notifications.noPermissionPreferences", "You don't have permission to manage notification preferences.")
206
- }) : /* @__PURE__ */ v("div", {
144
+ children: a("notifications.noPermissionPreferences", "You don't have permission to manage notification preferences.")
145
+ }) : /* @__PURE__ */ m("div", {
207
146
  "data-tour": "notification-preferences-page",
208
147
  className: "space-y-6 p-4 sm:p-6",
209
148
  children: [
210
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("h1", {
149
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
211
150
  className: "text-2xl font-bold text-primary",
212
- children: E("notifications.preferencesTitle", "Notification Preferences")
213
- }), /* @__PURE__ */ _("p", {
151
+ children: a("notifications.preferencesTitle", "Notification Preferences")
152
+ }), /* @__PURE__ */ p("p", {
214
153
  className: "mt-1 text-sm text-secondary",
215
- children: E("notifications.preferencesSubtitle", "Control global, channel, type, and topic-level notification delivery.")
154
+ children: a("notifications.preferencesSubtitle", "Control global, channel, type, and topic-level notification delivery.")
216
155
  })] }),
217
- /* @__PURE__ */ _(S, {
218
- icon: /* @__PURE__ */ _(p, { size: 16 }),
219
- children: E("notifications.preferencesPurpose", "Decide how and when we reach you. The Global switch is your master on/off, then you can fine-tune individual channels (email, push, SMS…), notification types and the marketing topics you have subscribed to. Settings cascade — turning a channel off silences it everywhere.")
156
+ /* @__PURE__ */ p(v, {
157
+ icon: /* @__PURE__ */ p(l, { size: 16 }),
158
+ children: a("notifications.preferencesPurpose", "Decide how and when we reach you. The Global switch is your master on/off, then you can fine-tune individual channels (email, push, SMS…), notification types and the marketing topics you have subscribed to. Settings cascade — turning a channel off silences it everywhere.")
220
159
  }),
221
- /* @__PURE__ */ v(y, {
160
+ /* @__PURE__ */ m(h, {
222
161
  "data-tour": "notification-preferences-global",
223
162
  className: "space-y-3 p-5 sm:p-6",
224
- children: [/* @__PURE__ */ _("h2", {
163
+ children: [/* @__PURE__ */ p("h2", {
225
164
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
226
- children: E("notifications.globalPreferences", "Global")
227
- }), X({
165
+ children: a("notifications.globalPreferences", "Global")
166
+ }), L({
228
167
  key: "GLOBAL",
229
168
  scope: "GLOBAL",
230
- title: E("notifications.allNotifications", "All notifications"),
231
- description: E("notifications.allNotificationsDescription", "Master preference for notification delivery across all channels and types.")
169
+ title: a("notifications.allNotifications", "All notifications"),
170
+ description: a("notifications.allNotificationsDescription", "Master preference for notification delivery across all channels and types.")
232
171
  })]
233
172
  }),
234
- /* @__PURE__ */ v(x, {
235
- title: E("notifications.advancedPreferences", "Advanced settings"),
236
- description: E("notifications.advancedPreferencesDescription", "Per-channel filter rules, notification-type filters, and quiet-hour overrides."),
237
- children: [/* @__PURE__ */ v("section", {
173
+ /* @__PURE__ */ m(_, {
174
+ title: a("notifications.advancedPreferences", "Advanced settings"),
175
+ description: a("notifications.advancedPreferencesDescription", "Per-channel filter rules, notification-type filters, and quiet-hour overrides."),
176
+ children: [/* @__PURE__ */ m("section", {
238
177
  "data-tour": "notification-preferences-channels",
239
178
  className: "space-y-3",
240
- children: [/* @__PURE__ */ _("h2", {
179
+ children: [/* @__PURE__ */ p("h2", {
241
180
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
242
- children: E("notifications.channelPreferences", "Channels")
243
- }), /* @__PURE__ */ _("div", {
181
+ children: a("notifications.channelPreferences", "Channels")
182
+ }), /* @__PURE__ */ p("div", {
244
183
  className: "grid gap-3 lg:grid-cols-2",
245
- children: C.map((e) => X({
184
+ children: y.map((e) => L({
246
185
  key: `CHANNEL:${e.value}`,
247
186
  scope: "CHANNEL",
248
187
  channel: e.value,
249
- title: E(e.labelKey, e.label),
250
- description: E("notifications.channelPreferenceDescription", "Control delivery for this channel.")
188
+ title: a(e.labelKey, e.label),
189
+ description: a("notifications.channelPreferenceDescription", "Control delivery for this channel.")
251
190
  }))
252
191
  })]
253
- }), /* @__PURE__ */ v("section", {
192
+ }), /* @__PURE__ */ m("section", {
254
193
  "data-tour": "notification-preferences-types",
255
194
  className: "mt-6 space-y-3",
256
- children: [/* @__PURE__ */ _("h2", {
195
+ children: [/* @__PURE__ */ p("h2", {
257
196
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
258
- children: E("notifications.typePreferences", "Notification Types")
259
- }), /* @__PURE__ */ _("div", {
197
+ children: a("notifications.typePreferences", "Notification Types")
198
+ }), /* @__PURE__ */ p("div", {
260
199
  className: "grid gap-3 lg:grid-cols-2",
261
- children: w.map((e) => X({
200
+ children: b.map((e) => L({
262
201
  key: `TYPE:${e.value}`,
263
202
  scope: "TYPE",
264
203
  type: e.value,
265
- title: E(e.labelKey, e.label),
266
- description: E("notifications.typePreferenceDescription", "Control delivery for this notification type.")
204
+ title: a(e.labelKey, e.label),
205
+ description: a("notifications.typePreferenceDescription", "Control delivery for this notification type.")
267
206
  }))
268
207
  })]
269
208
  })]
270
209
  }),
271
- /* @__PURE__ */ v("div", {
210
+ /* @__PURE__ */ m("div", {
272
211
  className: "relative max-w-xl",
273
- children: [/* @__PURE__ */ _(m, {
212
+ children: [/* @__PURE__ */ p(u, {
274
213
  size: 16,
275
214
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
276
- }), /* @__PURE__ */ _("input", {
215
+ }), /* @__PURE__ */ p("input", {
277
216
  type: "text",
278
- value: R,
279
- onChange: (e) => z(e.target.value),
280
- "aria-label": E("notifications.searchTopics", "Search topics..."),
281
- placeholder: E("notifications.searchTopics", "Search topics..."),
217
+ value: N,
218
+ onChange: (e) => P(e.target.value),
219
+ "aria-label": a("notifications.searchTopics", "Search topics..."),
220
+ placeholder: a("notifications.searchTopics", "Search topics..."),
282
221
  className: "w-full rounded-lg border border-default bg-surface py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent"
283
222
  })]
284
223
  }),
285
- /* @__PURE__ */ v("section", {
224
+ /* @__PURE__ */ m("section", {
286
225
  "data-tour": "notification-preferences-topics",
287
226
  className: "space-y-3",
288
- children: [/* @__PURE__ */ _("h2", {
227
+ children: [/* @__PURE__ */ p("h2", {
289
228
  className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
290
- children: E("notifications.topicPreferences", "Topics")
291
- }), G ? /* @__PURE__ */ _("div", {
229
+ children: a("notifications.topicPreferences", "Topics")
230
+ }), F ? /* @__PURE__ */ p("div", {
292
231
  className: "rounded-lg border border-default bg-surface p-6 text-sm text-secondary",
293
- children: E("notifications.loadingPreferences", "Loading preferences...")
294
- }) : M ? /* @__PURE__ */ _(b, {
232
+ children: a("notifications.loadingPreferences", "Loading preferences...")
233
+ }) : E ? /* @__PURE__ */ p(g, {
295
234
  illustration: "empty-generic",
296
- title: E("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
297
- description: E("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.")
298
- }) : q.length === 0 ? /* @__PURE__ */ _(b, {
299
- illustration: R.trim() ? "empty-search" : "empty-data",
300
- title: R.trim() ? E("notifications.noTopicsFound", "No topics match your search") : E("notifications.noTopicsAvailableTitle", "No subscribable topics yet"),
301
- description: R.trim() ? E("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : E("notifications.noTopicsAvailableDescription", "When marketing topics are published you can subscribe or unsubscribe from each one here.")
302
- }) : q.map((e) => X({
235
+ title: a("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
236
+ description: a("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.")
237
+ }) : I.length === 0 ? /* @__PURE__ */ p(g, {
238
+ illustration: N.trim() ? "empty-search" : "empty-data",
239
+ title: N.trim() ? a("notifications.noTopicsFound", "No topics match your search") : a("notifications.noTopicsAvailableTitle", "No subscribable topics yet"),
240
+ description: N.trim() ? a("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : a("notifications.noTopicsAvailableDescription", "When marketing topics are published you can subscribe or unsubscribe from each one here.")
241
+ }) : I.map((e) => L({
303
242
  key: `TOPIC:${e.id}`,
304
243
  scope: "TOPIC",
305
244
  topicId: e.id,
@@ -310,6 +249,6 @@ function E() {
310
249
  ]
311
250
  });
312
251
  }
313
- export { E as NotificationPreferencesPage };
252
+ export { x as NotificationPreferencesPage };
314
253
 
315
254
  //# sourceMappingURL=NotificationPreferencesPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationPreferencesPage.js","names":["CHANNEL_OPTIONS","TYPE_OPTIONS","preferenceKey","input","NotificationPreferencesPage","tr","useTr","permissionsLoading","usePermissions","useNotification","topicsLoading","topicsForbidden","useNotificationTopics","preferencesLoading","useNotificationPreferences","useNotificationAnalytics","search","setSearch","useState","savingKey","setSavingKey","saveFeedback","setSaveFeedback","feedbackTimerRef","useRef","isLoading","showSaveFeedback","feedback","current","filteredTopics","useMemo","topics","query","topic","togglePreference","key","existing","preferencesByKey","nextEnabled","nativeImpact","setPreference","trackPreferenceUpdated","nativeNotify","resetPreference","deletePreference","renderPreferenceRow","isEnabled","isSaving","BellRing","jsx","ToggleRight","ToggleLeft","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","PagePurpose","EmphasisPanel","OptionalFields","channel","type","Search","event","IllustratedEmptyState"],"sources":["../../src/pages/NotificationPreferencesPage.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\nimport { BellRing, Search, ToggleLeft, ToggleRight } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n EmphasisPanel,\n IllustratedEmptyState,\n OptionalFields,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationPreferences, useNotificationTopics } from '../hooks';\nimport { useNotificationAnalytics } from '../hooks/useNotificationAnalytics';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationChannel, NotificationPreferenceScope, NotificationType } from '../types';\nimport { nativeImpact, nativeNotify } from '../utils/nativeBridge';\n\nconst CHANNEL_OPTIONS: Array<{ value: NotificationChannel; labelKey: string; label: string }> = [\n { value: 'IN_APP', labelKey: 'notifications.channelInApp', label: 'In-app' },\n { value: 'EMAIL', labelKey: 'notifications.channelEmail', label: 'Email' },\n { value: 'PUSH', labelKey: 'notifications.channelPush', label: 'Push' },\n { value: 'SMS', labelKey: 'notifications.channelSms', label: 'SMS' },\n { value: 'WHATSAPP', labelKey: 'notifications.channelWhatsapp', label: 'WhatsApp' },\n { value: 'SLACK', labelKey: 'notifications.channelSlack', label: 'Slack' },\n];\n\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alerts' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\n\nfunction preferenceKey(input: {\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n}) {\n if (input.scope === 'CHANNEL') return `CHANNEL:${input.channel || ''}`;\n if (input.scope === 'TYPE') return `TYPE:${input.type || ''}`;\n if (input.scope === 'TOPIC') return `TOPIC:${input.topicId || ''}`;\n return 'GLOBAL';\n}\n\nexport function NotificationPreferencesPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n topics,\n isLoading: topicsLoading,\n isForbidden: topicsForbidden,\n } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const {\n preferencesByKey,\n isLoading: preferencesLoading,\n setPreference,\n deletePreference,\n } = useNotificationPreferences();\n const { trackPreferenceUpdated } = useNotificationAnalytics();\n const [search, setSearch] = useState('');\n const [savingKey, setSavingKey] = useState<string | null>(null);\n const [saveFeedback, setSaveFeedback] = useState<{\n key: string;\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const feedbackTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const isLoading = topicsLoading || preferencesLoading;\n\n useEffect(() => {\n return () => {\n if (feedbackTimerRef.current) {\n clearTimeout(feedbackTimerRef.current);\n }\n };\n }, []);\n\n const showSaveFeedback = (feedback: {\n key: string;\n type: 'success' | 'error';\n message: string;\n }) => {\n if (feedbackTimerRef.current) {\n clearTimeout(feedbackTimerRef.current);\n }\n\n setSaveFeedback(feedback);\n feedbackTimerRef.current = setTimeout(() => {\n setSaveFeedback((current) => (current?.key === feedback.key ? null : current));\n feedbackTimerRef.current = null;\n }, 2500);\n };\n\n const filteredTopics = useMemo(() => {\n if (!search.trim()) {\n return topics;\n }\n\n const query = search.toLowerCase();\n return topics.filter(\n (topic) =>\n topic.name.toLowerCase().includes(query) ||\n topic.slug.toLowerCase().includes(query) ||\n topic.description?.toLowerCase().includes(query)\n );\n }, [search, topics]);\n\n const togglePreference = async (input: {\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const key = preferenceKey(input);\n const existing = preferencesByKey.get(key);\n const nextEnabled = !(existing?.enabled ?? true);\n setSavingKey(key);\n nativeImpact('medium');\n try {\n await setPreference({\n ...input,\n enabled: nextEnabled,\n frequency: existing?.frequency || 'IMMEDIATE',\n });\n trackPreferenceUpdated({\n action: 'set',\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n enabled: nextEnabled,\n });\n showSaveFeedback({\n key,\n type: 'success',\n message: tr('notifications.preferenceSaved', 'Preference saved.'),\n });\n void nativeNotify('success');\n } catch {\n showSaveFeedback({\n key,\n type: 'error',\n message: tr('notifications.preferenceSaveFailed', 'Could not save preference.'),\n });\n void nativeNotify('error');\n } finally {\n setSavingKey(null);\n }\n };\n\n const resetPreference = async (key: string) => {\n const existing = preferencesByKey.get(key);\n if (!existing) return;\n setSavingKey(key);\n try {\n await deletePreference(existing.id);\n trackPreferenceUpdated({\n action: 'reset',\n scope: existing.scope,\n channel: existing.channel,\n type: existing.type,\n });\n showSaveFeedback({\n key,\n type: 'success',\n message: tr('notifications.preferenceReset', 'Preference reset.'),\n });\n } catch {\n showSaveFeedback({\n key,\n type: 'error',\n message: tr('notifications.preferenceResetFailed', 'Could not reset preference.'),\n });\n } finally {\n setSavingKey(null);\n }\n };\n\n const renderPreferenceRow = (input: {\n key: string;\n title: string;\n description: string;\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const existing = preferencesByKey.get(input.key);\n const isEnabled = existing?.enabled ?? true;\n const isSaving = savingKey === input.key;\n const feedback = saveFeedback?.key === input.key ? saveFeedback : null;\n\n return (\n <div\n key={input.key}\n className=\"rounded-lg border border-border-seam bg-gloss-card p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)]\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"space-y-1\">\n <div className=\"flex items-center gap-2\">\n <BellRing size={16} className=\"text-accent-primary\" />\n <h2 className=\"text-sm font-semibold text-primary\">{input.title}</h2>\n {existing && (\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {existing.frequency.replace('_', ' ').toLowerCase()}\n </span>\n )}\n </div>\n <p className=\"text-sm text-secondary\">{input.description}</p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {existing && (\n <button\n type=\"button\"\n disabled={isSaving}\n onClick={() => resetPreference(input.key)}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50\"\n >\n {tr('notifications.reset', 'Reset')}\n </button>\n )}\n <button\n type=\"button\"\n aria-pressed={isEnabled}\n disabled={isSaving}\n onClick={() =>\n togglePreference({\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n topicId: input.topicId,\n })\n }\n className={`inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${\n isEnabled\n ? 'border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90'\n : 'border-default bg-bg-sunken text-secondary hover:bg-bg-sunken/80'\n } disabled:cursor-not-allowed disabled:opacity-50`}\n >\n {isEnabled ? <ToggleRight size={18} /> : <ToggleLeft size={18} />}\n {isSaving\n ? tr('notifications.saving', 'Saving...')\n : isEnabled\n ? tr('notifications.enabled', 'Enabled')\n : tr('notifications.disabled', 'Disabled')}\n </button>\n </div>\n </div>\n <div className=\"mt-3 min-h-5\" aria-live=\"polite\">\n {feedback && (\n <p className={`text-xs ${feedback.type === 'success' ? 'text-success' : 'text-error'}`}>\n {feedback.message}\n </p>\n )}\n </div>\n </div>\n );\n };\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionPreferences',\n \"You don't have permission to manage notification preferences.\"\n )}\n </div>\n );\n }\n\n return (\n <div data-tour=\"notification-preferences-page\" className=\"space-y-6 p-4 sm:p-6\">\n <div>\n <h1 className=\"text-2xl font-bold text-primary\">\n {tr('notifications.preferencesTitle', 'Notification Preferences')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.preferencesSubtitle',\n 'Control global, channel, type, and topic-level notification delivery.'\n )}\n </p>\n </div>\n\n <PagePurpose icon={<BellRing size={16} />}>\n {tr(\n 'notifications.preferencesPurpose',\n 'Decide how and when we reach you. The Global switch is your master on/off, then you can fine-tune individual channels (email, push, SMS…), notification types and the marketing topics you have subscribed to. Settings cascade — turning a channel off silences it everywhere.'\n )}\n </PagePurpose>\n\n <EmphasisPanel data-tour=\"notification-preferences-global\" className=\"space-y-3 p-5 sm:p-6\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.globalPreferences', 'Global')}\n </h2>\n {renderPreferenceRow({\n key: 'GLOBAL',\n scope: 'GLOBAL',\n title: tr('notifications.allNotifications', 'All notifications'),\n description: tr(\n 'notifications.allNotificationsDescription',\n 'Master preference for notification delivery across all channels and types.'\n ),\n })}\n </EmphasisPanel>\n\n {/* Advanced: per-channel filter rules / quiet hours / custom templates — collapse the long-tail knobs */}\n <OptionalFields\n title={tr('notifications.advancedPreferences', 'Advanced settings')}\n description={tr(\n 'notifications.advancedPreferencesDescription',\n 'Per-channel filter rules, notification-type filters, and quiet-hour overrides.'\n )}\n >\n <section data-tour=\"notification-preferences-channels\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.channelPreferences', 'Channels')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {CHANNEL_OPTIONS.map((channel) =>\n renderPreferenceRow({\n key: `CHANNEL:${channel.value}`,\n scope: 'CHANNEL',\n channel: channel.value,\n title: tr(channel.labelKey, channel.label),\n description: tr(\n 'notifications.channelPreferenceDescription',\n 'Control delivery for this channel.'\n ),\n })\n )}\n </div>\n </section>\n\n <section data-tour=\"notification-preferences-types\" className=\"mt-6 space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.typePreferences', 'Notification Types')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {TYPE_OPTIONS.map((type) =>\n renderPreferenceRow({\n key: `TYPE:${type.value}`,\n scope: 'TYPE',\n type: type.value,\n title: tr(type.labelKey, type.label),\n description: tr(\n 'notifications.typePreferenceDescription',\n 'Control delivery for this notification type.'\n ),\n })\n )}\n </div>\n </section>\n </OptionalFields>\n\n <div className=\"relative max-w-xl\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={search}\n onChange={(event) => setSearch(event.target.value)}\n aria-label={tr('notifications.searchTopics', 'Search topics...')}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n className=\"w-full rounded-lg border border-default bg-surface py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </div>\n\n <section data-tour=\"notification-preferences-topics\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.topicPreferences', 'Topics')}\n </h2>\n {isLoading ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.loadingPreferences', 'Loading preferences...')}\n </div>\n ) : topicsForbidden ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title={tr(\n 'notifications.topicsNoAccessTitle',\n \"You don't have access to notification topics\"\n )}\n description={tr(\n 'notifications.topicsNoAccessDescription',\n \"Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.\"\n )}\n />\n ) : filteredTopics.length === 0 ? (\n <IllustratedEmptyState\n illustration={search.trim() ? 'empty-search' : 'empty-data'}\n title={\n search.trim()\n ? tr('notifications.noTopicsFound', 'No topics match your search')\n : tr('notifications.noTopicsAvailableTitle', 'No subscribable topics yet')\n }\n description={\n search.trim()\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.noTopicsAvailableDescription',\n 'When marketing topics are published you can subscribe or unsubscribe from each one here.'\n )\n }\n />\n ) : (\n filteredTopics.map((topic) =>\n renderPreferenceRow({\n key: `TOPIC:${topic.id}`,\n scope: 'TOPIC',\n topicId: topic.id,\n title: topic.name,\n description: topic.description || topic.slug,\n })\n )\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAMA,IAA0F;CAC9F;EAAE,OAAO;EAAU,UAAU;EAA8B,OAAO;CAAS;CAC3E;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;CAAQ;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K;KACL,OAAO5C;KACP,WAAW,MAAUC,EAAU4C,EAAM,OAAO,KAAK;KACjD,cAAYxD,EAAG,8BAA8B,kBAAkB;KAC/D,aAAaA,EAAG,8BAA8B,kBAAkB;KAChE,WAAU;IACX,CAAA,CACE;;GAEL,kBAAC,WAAD;IAAS,aAAU;IAAkC,WAAU;IAA/D,UAAA,CACE,kBAAC,MAAD;KAAI,WAAU;KACX,UAAAA,EAAG,kCAAkC,QAAQ;IAC5C,CAAA,GACHoB,IACC,kBAAC,OAAD;KAAK,WAAU;KACZ,UAAApB,EAAG,oCAAoC,wBAAwB;IAC7D,CAAA,IACHM,IACF,kBAACmD,GAAD;KACE,cAAa;KACb,OAAOzD,EACL,qCACA,8CACF;KACA,aAAaA,EACX,2CACA,6GACF;IACD,CAAA,IACCwB,EAAe,WAAW,IAC5B,kBAACiC,GAAD;KACE,cAAc9C,EAAO,KAAK,IAAI,iBAAiB;KAC/C,OACEA,EAAO,KAAK,IACRX,EAAG,+BAA+B,6BAA6B,IAC/DA,EAAG,wCAAwC,4BAA4B;KAE7E,aACEW,EAAO,KAAK,IACRX,EAAG,yCAAyC,4BAA4B,IACxEA,EACE,8CACA,0FACF;IAEP,CAAA,IAEDwB,EAAe,KAAK,MAClBgB,EAAoB;KAClB,KAAK,SAASZ,EAAM;KACpB,OAAO;KACP,SAASA,EAAM;KACf,OAAOA,EAAM;KACb,aAAaA,EAAM,eAAeA,EAAM;IAC1C,CAAC,CACH,CAEK;;EACN;;AAET"}
1
+ {"version":3,"file":"NotificationPreferencesPage.js","names":["CHANNEL_OPTIONS","TYPE_OPTIONS","NotificationPreferencesPage","useNotification","jsx","navigationV2","NotificationSettingsV2","ClassicNotificationPreferencesPage","tr","useTr","permissionsLoading","usePermissions","topicsLoading","topicsForbidden","useNotificationTopics","usePreferenceToggles","search","setSearch","useState","isLoading","preferencesLoading","filteredTopics","useMemo","topics","query","topic","renderPreferenceRow","existing","preferencesByKey","input","isEnabled","isSaving","savingKey","feedback","saveFeedback","BellRing","resetPreference","togglePreference","ToggleRight","ToggleLeft","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","PagePurpose","EmphasisPanel","OptionalFields","channel","type","Search","event","IllustratedEmptyState"],"sources":["../../src/pages/NotificationPreferencesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { BellRing, Search, ToggleLeft, ToggleRight } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n EmphasisPanel,\n IllustratedEmptyState,\n OptionalFields,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport { usePreferenceToggles } from '../hooks/usePreferenceToggles';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationChannel, NotificationPreferenceScope, NotificationType } from '../types';\nimport { NotificationSettingsV2 } from '../navigation-v2/NotificationSettingsV2';\n\nconst CHANNEL_OPTIONS: Array<{ value: NotificationChannel; labelKey: string; label: string }> = [\n { value: 'IN_APP', labelKey: 'notifications.channelInApp', label: 'In-app' },\n { value: 'EMAIL', labelKey: 'notifications.channelEmail', label: 'Email' },\n { value: 'PUSH', labelKey: 'notifications.channelPush', label: 'Push' },\n { value: 'SMS', labelKey: 'notifications.channelSms', label: 'SMS' },\n { value: 'WHATSAPP', labelKey: 'notifications.channelWhatsapp', label: 'WhatsApp' },\n { value: 'SLACK', labelKey: 'notifications.channelSlack', label: 'Slack' },\n];\n\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alerts' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\n\n/**\n * Notification preferences. Under FluidGrids' Navigation v2 (BOFF-11872) it\n * is \"Notification settings\" instead; every other app keeps this page.\n */\nexport function NotificationPreferencesPage() {\n const { navigationV2 } = useNotification();\n return navigationV2 ? <NotificationSettingsV2 /> : <ClassicNotificationPreferencesPage />;\n}\n\nfunction ClassicNotificationPreferencesPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n topics,\n isLoading: topicsLoading,\n isForbidden: topicsForbidden,\n } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const {\n preferencesByKey,\n preferencesLoading,\n savingKey,\n saveFeedback,\n togglePreference,\n resetPreference,\n } = usePreferenceToggles();\n const [search, setSearch] = useState('');\n\n const isLoading = topicsLoading || preferencesLoading;\n\n const filteredTopics = useMemo(() => {\n if (!search.trim()) {\n return topics;\n }\n\n const query = search.toLowerCase();\n return topics.filter(\n (topic) =>\n topic.name.toLowerCase().includes(query) ||\n topic.slug.toLowerCase().includes(query) ||\n topic.description?.toLowerCase().includes(query)\n );\n }, [search, topics]);\n\n const renderPreferenceRow = (input: {\n key: string;\n title: string;\n description: string;\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const existing = preferencesByKey.get(input.key);\n const isEnabled = existing?.enabled ?? true;\n const isSaving = savingKey === input.key;\n const feedback = saveFeedback?.key === input.key ? saveFeedback : null;\n\n return (\n <div\n key={input.key}\n className=\"rounded-lg border border-border-seam bg-gloss-card p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)]\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"space-y-1\">\n <div className=\"flex items-center gap-2\">\n <BellRing size={16} className=\"text-accent-primary\" />\n <h2 className=\"text-sm font-semibold text-primary\">{input.title}</h2>\n {existing && (\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {existing.frequency.replace('_', ' ').toLowerCase()}\n </span>\n )}\n </div>\n <p className=\"text-sm text-secondary\">{input.description}</p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {existing && (\n <button\n type=\"button\"\n disabled={isSaving}\n onClick={() => resetPreference(input.key)}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50\"\n >\n {tr('notifications.reset', 'Reset')}\n </button>\n )}\n <button\n type=\"button\"\n aria-pressed={isEnabled}\n disabled={isSaving}\n onClick={() =>\n togglePreference({\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n topicId: input.topicId,\n })\n }\n className={`inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${\n isEnabled\n ? 'border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90'\n : 'border-default bg-bg-sunken text-secondary hover:bg-bg-sunken/80'\n } disabled:cursor-not-allowed disabled:opacity-50`}\n >\n {isEnabled ? <ToggleRight size={18} /> : <ToggleLeft size={18} />}\n {isSaving\n ? tr('notifications.saving', 'Saving...')\n : isEnabled\n ? tr('notifications.enabled', 'Enabled')\n : tr('notifications.disabled', 'Disabled')}\n </button>\n </div>\n </div>\n <div className=\"mt-3 min-h-5\" aria-live=\"polite\">\n {feedback && (\n <p className={`text-xs ${feedback.type === 'success' ? 'text-success' : 'text-error'}`}>\n {feedback.message}\n </p>\n )}\n </div>\n </div>\n );\n };\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionPreferences',\n \"You don't have permission to manage notification preferences.\"\n )}\n </div>\n );\n }\n\n return (\n <div data-tour=\"notification-preferences-page\" className=\"space-y-6 p-4 sm:p-6\">\n <div>\n <h1 className=\"text-2xl font-bold text-primary\">\n {tr('notifications.preferencesTitle', 'Notification Preferences')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.preferencesSubtitle',\n 'Control global, channel, type, and topic-level notification delivery.'\n )}\n </p>\n </div>\n\n <PagePurpose icon={<BellRing size={16} />}>\n {tr(\n 'notifications.preferencesPurpose',\n 'Decide how and when we reach you. The Global switch is your master on/off, then you can fine-tune individual channels (email, push, SMS…), notification types and the marketing topics you have subscribed to. Settings cascade — turning a channel off silences it everywhere.'\n )}\n </PagePurpose>\n\n <EmphasisPanel data-tour=\"notification-preferences-global\" className=\"space-y-3 p-5 sm:p-6\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.globalPreferences', 'Global')}\n </h2>\n {renderPreferenceRow({\n key: 'GLOBAL',\n scope: 'GLOBAL',\n title: tr('notifications.allNotifications', 'All notifications'),\n description: tr(\n 'notifications.allNotificationsDescription',\n 'Master preference for notification delivery across all channels and types.'\n ),\n })}\n </EmphasisPanel>\n\n {/* Advanced: per-channel filter rules / quiet hours / custom templates — collapse the long-tail knobs */}\n <OptionalFields\n title={tr('notifications.advancedPreferences', 'Advanced settings')}\n description={tr(\n 'notifications.advancedPreferencesDescription',\n 'Per-channel filter rules, notification-type filters, and quiet-hour overrides.'\n )}\n >\n <section data-tour=\"notification-preferences-channels\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.channelPreferences', 'Channels')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {CHANNEL_OPTIONS.map((channel) =>\n renderPreferenceRow({\n key: `CHANNEL:${channel.value}`,\n scope: 'CHANNEL',\n channel: channel.value,\n title: tr(channel.labelKey, channel.label),\n description: tr(\n 'notifications.channelPreferenceDescription',\n 'Control delivery for this channel.'\n ),\n })\n )}\n </div>\n </section>\n\n <section data-tour=\"notification-preferences-types\" className=\"mt-6 space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.typePreferences', 'Notification Types')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {TYPE_OPTIONS.map((type) =>\n renderPreferenceRow({\n key: `TYPE:${type.value}`,\n scope: 'TYPE',\n type: type.value,\n title: tr(type.labelKey, type.label),\n description: tr(\n 'notifications.typePreferenceDescription',\n 'Control delivery for this notification type.'\n ),\n })\n )}\n </div>\n </section>\n </OptionalFields>\n\n <div className=\"relative max-w-xl\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={search}\n onChange={(event) => setSearch(event.target.value)}\n aria-label={tr('notifications.searchTopics', 'Search topics...')}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n className=\"w-full rounded-lg border border-default bg-surface py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </div>\n\n <section data-tour=\"notification-preferences-topics\" className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.topicPreferences', 'Topics')}\n </h2>\n {isLoading ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.loadingPreferences', 'Loading preferences...')}\n </div>\n ) : topicsForbidden ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title={tr(\n 'notifications.topicsNoAccessTitle',\n \"You don't have access to notification topics\"\n )}\n description={tr(\n 'notifications.topicsNoAccessDescription',\n \"Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.\"\n )}\n />\n ) : filteredTopics.length === 0 ? (\n <IllustratedEmptyState\n illustration={search.trim() ? 'empty-search' : 'empty-data'}\n title={\n search.trim()\n ? tr('notifications.noTopicsFound', 'No topics match your search')\n : tr('notifications.noTopicsAvailableTitle', 'No subscribable topics yet')\n }\n description={\n search.trim()\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.noTopicsAvailableDescription',\n 'When marketing topics are published you can subscribe or unsubscribe from each one here.'\n )\n }\n />\n ) : (\n filteredTopics.map((topic) =>\n renderPreferenceRow({\n key: `TOPIC:${topic.id}`,\n scope: 'TOPIC',\n topicId: topic.id,\n title: topic.name,\n description: topic.description || topic.slug,\n })\n )\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,IAAMA,IAA0F;CAC9F;EAAE,OAAO;EAAU,UAAU;EAA8B,OAAO;CAAS;CAC3E;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;CAAQ;CACzE;EAAE,OAAO;EAAQ,UAAU;EAA6B,OAAO;CAAO;CACtE;EAAE,OAAO;EAAO,UAAU;EAA4B,OAAO;CAAM;CACnE;EAAE,OAAO;EAAY,UAAU;EAAiC,OAAO;CAAW;CAClF;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;CAAQ;AAC3E,GAEMC,IAAoF;CACxF;EAAE,OAAO;EAAiB,UAAU;EAAmC,OAAO;CAAgB;CAC9F;EAAE,OAAO;EAAU,UAAU;EAA4B,OAAO;CAAS;CACzE;EAAE,OAAO;EAAS,UAAU;EAA2B,OAAO;CAAS;CACvE;EAAE,OAAO;EAAa,UAAU;EAA+B,OAAO;CAAY;AACpF;AAMA,SAAgBC,IAA8B;CAC5C,IAAM,EAAE,oBAAiBC,EAAgB;CACzC,OAAsBC,EAAfC,IAAgBC,IAA6BC,GAA9B,CAAyB,CAAyC;AAC1F;AAEA,SAASA,IAAqC;CAC5C,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,mBAAgBR,EAAgB,GAClC,EACJ,WACA,WAAWS,GACX,aAAaC,MACXC,EAAsB;EACxB,MAAM;EACN,UAAU;CACZ,CAAC,GACK,EACJ,qBACA,uBACA,cACA,iBACA,qBACA,uBACEC,EAAqB,GACnB,CAACC,GAAQ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