@burdenoff/microfe-notification 2026.1109.1 → 2026.1114.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":"NotificationTemplatesPage.js","names":["useI18n","useI18n$1","TYPE_COLORS","TYPE_LABELS","formatDate","iso","locale","NotificationTemplatesPage","navigate","useNavigate","tr","useTr","permissionsLoading","usePermissions","useNotificationTemplates","deletingId","setDeletingId","useState","deleteError","setDeleteError","selectedTemplateIds","setSelectedTemplateIds","selectedTemplates","useMemo","templates","template","allVisibleSelected","partiallySelected","canCreateTemplate","hasPermission","NOTIFICATION_PERMISSIONS","canDeleteTemplate","handleDelete","nativeImpact","message","nativeResult","nativeConfirm","deleteTemplate","nativeNotify","err","handleBulkDelete","failed","r","toggleTemplateSelection","next","prev","checked","templateId","toggleAllTemplates","isLoading","Loader2","error","AlertCircle","refetch","RefreshCw","PagePurpose","FileText","EmphasisPanel","total","Button","Plus","NextSteps","updateFilter","Search","filter","GlassCard","input","event","isDeleting","Trash2","IllustratedEmptyState","e","hasMore","loadMore"],"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,IAAME,KAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;AACT,GAEMC,IAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;AACT;AAEA,SAASC,EAAW,GAAa,GAAiB;CAChD,OAAO,IAAI,KAAKC,CAAG,CAAC,CAAC,mBAAmBC,KAAU,SAAS;EACzD,OAAO;EACP,KAAK;EACL,MAAM;CACR,CAAC;AACH;AAUA,SAAgBC,IAA4B;CAC1C,IAAMC,IAAWC,EAAY,GACvBC,IAAKC,EAAM,GACX,EAAE,cAAWX,GAAQ,GACrB,EAAE,kBAAe,WAAWY,MAAuBC,EAAe,GAClE,EACJ,cACA,cACA,eACA,UACA,UACA,YACA,WACA,YACA,aACA,mBACA,oBACEC,EAAyB,GAEvB,CAACC,GAAYC,KAAiBC,EAAwB,IAAI,GAC1D,CAACC,GAAaC,KAAkBF,EAAwB,IAAI,GAC5D,CAACG,GAAqB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","TYPE_LABELS","formatDate","iso","locale","NotificationTemplatesPage","navigate","useNavigate","tr","useTr","paths","useNotificationPaths","navigationV2","useNavigationV2","pendingConfirm","setPendingConfirm","useState","confirmInPage","message","permissionsLoading","usePermissions","useNotificationTemplates","deletingId","setDeletingId","deleteError","setDeleteError","selectedTemplateIds","setSelectedTemplateIds","selectedTemplates","useMemo","templates","template","allVisibleSelected","partiallySelected","canCreateTemplate","hasPermission","NOTIFICATION_PERMISSIONS","canDeleteTemplate","handleDelete","nativeImpact","nativeResult","nativeConfirm","deleteTemplate","nativeNotify","err","handleBulkDelete","failed","r","toggleTemplateSelection","next","prev","checked","templateId","toggleAllTemplates","isLoading","Loader2","error","AlertCircle","refetch","RefreshCw","PagePurpose","FileText","EmphasisPanel","total","Button","Plus","NextSteps","updateFilter","Search","filter","GlassCard","input","event","isDeleting","Trash2","IllustratedEmptyState","e","hasMore","loadMore","ConfirmDeleteDialog"],"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';\nimport { ConfirmDeleteDialog } from '../components/ConfirmDeleteDialog';\nimport { useNavigationV2, useNotificationPaths } from '../navigation-v2/paths';\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 paths = useNotificationPaths();\n const navigationV2 = useNavigationV2();\n // Navigation v2: the confirmation is the shared dialog, not window.confirm.\n const [pendingConfirm, setPendingConfirm] = useState<{\n title: string;\n message: string;\n resolve: (confirmed: boolean) => void;\n } | null>(null);\n const confirmInPage = (title: string, message: string): Promise<boolean> =>\n navigationV2\n ? new Promise((resolve) => setPendingConfirm({ title, message, resolve }))\n : Promise.resolve(window.confirm(message));\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 =\n nativeResult === null\n ? await confirmInPage(tr('notifTemplates.deleteTitle', 'Delete template'), message)\n : 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 =\n nativeResult === null\n ? await confirmInPage(tr('notifTemplates.bulkDeleteTitle', 'Delete templates'), message)\n : 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(paths.newTemplate)} 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(paths.newTemplate),\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 // Absolute: '../send' resolved to a page that does not exist\n // (BOFF-11872 §8 item 4); the Send page's route is `create`.\n href: paths.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(paths.newTemplate)} 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(paths.template(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\n {navigationV2 && (\n <ConfirmDeleteDialog\n open={pendingConfirm !== null}\n title={pendingConfirm?.title ?? ''}\n description={pendingConfirm?.message ?? ''}\n confirmLabel={tr('notifTemplates.delete', 'Delete')}\n onCancel={() => {\n pendingConfirm?.resolve(false);\n setPendingConfirm(null);\n }}\n onConfirm={() => {\n pendingConfirm?.resolve(true);\n setPendingConfirm(null);\n }}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAwBA,IAAME,IAAgD;CACpD,eAAe;CACf,WAA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;OAAK,WAAU;OAAf,UAAA;QACE,kBAAC,QAAD;SAAM,WAAU;SACb,UAAAA,EAAS;QACN,CAAA;QACN,kBAAC,QAAD,EAAA,UAAM,IAAO,CAAA;QACb,kBAAC,QAAD,EAAA,UAAOA,EAAS,UAAU,KAAW,CAAA;QACrC,kBAAC,QAAD,EAAA,UAAM,IAAO,CAAA;QACb,kBAAC,QAAD;SAAM,WAAWA,EAAS,UAAU,iBAAiB;SAClD,UAAAA,EAAS,UACNvB,EAAG,0BAA0B,SAAS,IACtCA,EAAG,2BAA2B,UAAU;QACxC,CAAA;OACH;;MAGL,kBAAC,KAAD;OAAG,WAAU;OAAb,UAAA;QACGA,EAAG,0BAA0B,SAAS;QAAE;QAAEN,EAAW6B,EAAS,WAAW3B,CAAM;OAC/E;;KACA;IA/EE,GAAA2B,EAAS,EA+EX,CACN;GACE,CAAA;GAGJ8C,KACC,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,UAAD;KACE,SAASC;KACT,UAAUxB;KACV,WAAU;KAHZ,UAAA,CAKGA,IAAY,kBAACC,GAAD;MAAS,MAAM;MAAI,WAAU;KAAgB,CAAA,IAAI,MAC7D/C,EAAG,2BAA2B,WAAW,CACpC;;GACL,CAAA;GAGNI,KACC,kBAACmE,GAAD;IACE,MAAMjE,MAAmB;IACzB,OAAOA,GAAgB,SAAS;IAChC,aAAaA,GAAgB,WAAW;IACxC,cAAcN,EAAG,yBAAyB,QAAQ;IAClD,gBAAgB;KAEd,AADAM,GAAgB,QAAQ,EAAK,GAC7BC,EAAkB,IAAI;IACxB;IACA,iBAAiB;KAEf,AADAD,GAAgB,QAAQ,EAAI,GAC5BC,EAAkB,IAAI;IACxB;GACD,CAAA;EAEA;C,KAtVH,kBAAC,OAAD;EAAK,WAAU;EACZ,UAAAP,EACC,mCACA,2DACF;CACG,CAAA;AAmVX"}
@@ -2,13 +2,15 @@ import { useNotificationTopics as e } from "../hooks/useNotificationTopics.js";
2
2
  import "../hooks/index.js";
3
3
  import { NOTIFICATION_PERMISSIONS as t } from "../constants/permissions.js";
4
4
  import { useTr as n } from "../shared/hooks/useTr.js";
5
- import { useMemo as r, useState as i } from "react";
6
- import { usePermissions as a } from "@burdenoff/fe-libs/shared/providers/shell";
7
- import { Plus as o, Save as s, Search as c, Trash2 as l } from "lucide-react";
8
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
- import { EmphasisPanel as f, GlassCard as p, IllustratedEmptyState as m, NextSteps as h, PagePurpose as g } from "@burdenoff/fe-libs/ui";
5
+ import { ConfirmDeleteDialog as r } from "../components/ConfirmDeleteDialog.js";
6
+ import { useNotificationPaths as i } from "../navigation-v2/paths.js";
7
+ import { useMemo as a, useState as o } from "react";
8
+ import { usePermissions as s } from "@burdenoff/fe-libs/shared/providers/shell";
9
+ import { Plus as c, Save as l, Search as u, Trash2 as d } from "lucide-react";
10
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
11
+ import { EmphasisPanel as m, GlassCard as h, IllustratedEmptyState as g, NextSteps as _, PagePurpose as v } from "@burdenoff/fe-libs/ui";
10
12
  // src/pages/NotificationTopicsPage.tsx
11
- var _ = [
13
+ var y = [
12
14
  {
13
15
  value: "MARKETING",
14
16
  labelKey: "notifications.topicType.marketing",
@@ -30,47 +32,47 @@ var _ = [
30
32
  label: "Alert"
31
33
  }
32
34
  ];
33
- function v(e) {
35
+ function b(e) {
34
36
  return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
35
37
  }
36
- function y() {
37
- let y = n(), { hasPermission: b, isLoading: x } = a(), { topics: S, isLoading: C, isForbidden: w, createTopic: T, updateTopic: E, deleteTopic: D } = e(), [O, k] = i(""), [A, j] = i(null), [M, N] = i({
38
+ function x() {
39
+ let x = n(), { hasPermission: S, isLoading: C } = s(), { topics: w, isLoading: T, isForbidden: E, createTopic: D, updateTopic: O, deleteTopic: k } = e(), A = i(), [j, M] = o(""), [N, P] = o(null), [F, I] = o(null), [L, R] = o({
38
40
  name: "",
39
41
  slug: "",
40
42
  description: "",
41
43
  type: "MARKETING",
42
44
  isActive: !0
43
- }), P = b(t.NOTIFICATION_CREATE), F = r(() => {
44
- if (!O.trim()) return S;
45
- let e = O.toLowerCase();
46
- return S.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
47
- }, [O, S]);
48
- return x ? /* @__PURE__ */ u("div", {
45
+ }), z = S(t.NOTIFICATION_CREATE), B = a(() => {
46
+ if (!j.trim()) return w;
47
+ let e = j.toLowerCase();
48
+ return w.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
49
+ }, [j, w]);
50
+ return C ? /* @__PURE__ */ f("div", {
49
51
  className: "flex h-64 items-center justify-center",
50
- children: /* @__PURE__ */ u("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
51
- }) : P ? /* @__PURE__ */ d("div", {
52
+ children: /* @__PURE__ */ f("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
53
+ }) : z ? /* @__PURE__ */ p("div", {
52
54
  className: "space-y-6 p-4 sm:p-6",
53
55
  children: [
54
- /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h1", {
56
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", {
55
57
  className: "text-2xl font-bold text-primary",
56
- children: y("notifications.topicsTitle", "Notification Topics")
57
- }), /* @__PURE__ */ u("p", {
58
+ children: x("notifications.topicsTitle", "Notification Topics")
59
+ }), /* @__PURE__ */ f("p", {
58
60
  className: "mt-1 text-sm text-secondary",
59
- children: y("notifications.topicsSubtitle", "Create topics for campaigns so users can subscribe or unsubscribe with precision.")
61
+ children: x("notifications.topicsSubtitle", "Create topics for campaigns so users can subscribe or unsubscribe with precision.")
60
62
  })] }),
61
- /* @__PURE__ */ u(g, {
62
- icon: /* @__PURE__ */ u(o, { size: 16 }),
63
- children: y("notifications.topicsPurpose", "Topics group related notifications (e.g. \"Product updates\", \"Billing reminders\", \"Weekly digest\") so people can opt in or out of exactly what they care about. Create a topic here, then target it when sending a campaign and let users manage their own subscriptions in Preferences.")
63
+ /* @__PURE__ */ f(v, {
64
+ icon: /* @__PURE__ */ f(c, { size: 16 }),
65
+ children: x("notifications.topicsPurpose", "Topics group related notifications (e.g. \"Product updates\", \"Billing reminders\", \"Weekly digest\") so people can opt in or out of exactly what they care about. Create a topic here, then target it when sending a campaign and let users manage their own subscriptions in Preferences.")
64
66
  }),
65
- /* @__PURE__ */ u(h, {
67
+ /* @__PURE__ */ f(_, {
66
68
  storageKey: "notification-topics",
67
69
  steps: [
68
70
  {
69
71
  id: "name-topic",
70
- label: y("notifications.topicsNextNameLabel", "Name your first topic"),
71
- description: y("notifications.topicsNextNameDesc", "Use the form to add a clear topic like \"Product updates\" — the slug is generated for you."),
72
+ label: x("notifications.topicsNextNameLabel", "Name your first topic"),
73
+ description: x("notifications.topicsNextNameDesc", "Use the form to add a clear topic like \"Product updates\" — the slug is generated for you."),
72
74
  onClick: () => {
73
- j(null), N((e) => ({
75
+ I(null), R((e) => ({
74
76
  ...e,
75
77
  name: "",
76
78
  slug: "",
@@ -83,8 +85,8 @@ function y() {
83
85
  },
84
86
  {
85
87
  id: "set-type",
86
- label: y("notifications.topicsNextTypeLabel", "Pick the right type"),
87
- description: y("notifications.topicsNextTypeDesc", "Marketing topics are opt-in for users; Transactional, System and Alert reach everyone."),
88
+ label: x("notifications.topicsNextTypeLabel", "Pick the right type"),
89
+ description: x("notifications.topicsNextTypeDesc", "Marketing topics are opt-in for users; Transactional, System and Alert reach everyone."),
88
90
  onClick: () => document.getElementById("notification-topic-type")?.scrollIntoView({
89
91
  behavior: "smooth",
90
92
  block: "center"
@@ -92,20 +94,20 @@ function y() {
92
94
  },
93
95
  {
94
96
  id: "let-subscribe",
95
- label: y("notifications.topicsNextSubscribeLabel", "Let people subscribe"),
96
- description: y("notifications.topicsNextSubscribeDesc", "Once a topic is active, users manage their own opt-ins from the Preferences page."),
97
- href: "../preferences"
97
+ label: x("notifications.topicsNextSubscribeLabel", "Let people subscribe"),
98
+ description: x("notifications.topicsNextSubscribeDesc", "Once a topic is active, users manage their own opt-ins from the Preferences page."),
99
+ href: A.preferences
98
100
  }
99
101
  ]
100
102
  }),
101
- /* @__PURE__ */ d("div", {
103
+ /* @__PURE__ */ p("div", {
102
104
  className: "grid gap-6 xl:grid-cols-[380px,1fr]",
103
- children: [/* @__PURE__ */ u(f, {
105
+ children: [/* @__PURE__ */ f(m, {
104
106
  className: "p-4",
105
- children: /* @__PURE__ */ d("form", {
107
+ children: /* @__PURE__ */ p("form", {
106
108
  className: "space-y-4",
107
109
  onSubmit: async (e) => {
108
- e.preventDefault(), M.name.trim() && M.slug.trim() && (A ? await E(A, M) : await T(M), j(null), N({
110
+ e.preventDefault(), L.name.trim() && L.slug.trim() && (F ? await O(F, L) : await D(L), I(null), R({
109
111
  name: "",
110
112
  slug: "",
111
113
  description: "",
@@ -114,63 +116,63 @@ function y() {
114
116
  }));
115
117
  },
116
118
  children: [
117
- /* @__PURE__ */ d("div", {
119
+ /* @__PURE__ */ p("div", {
118
120
  className: "flex items-center gap-2",
119
- children: [/* @__PURE__ */ u(o, {
121
+ children: [/* @__PURE__ */ f(c, {
120
122
  size: 18,
121
123
  className: "text-accent-primary"
122
- }), /* @__PURE__ */ u("h2", {
124
+ }), /* @__PURE__ */ f("h2", {
123
125
  className: "text-base font-semibold text-primary",
124
- children: A ? y("notifications.editTopic", "Edit Topic") : y("notifications.createTopic", "Create Topic")
126
+ children: F ? x("notifications.editTopic", "Edit Topic") : x("notifications.createTopic", "Create Topic")
125
127
  })]
126
128
  }),
127
- /* @__PURE__ */ d("label", {
129
+ /* @__PURE__ */ p("label", {
128
130
  className: "block space-y-1 text-sm text-secondary",
129
- children: [/* @__PURE__ */ u("span", { children: y("notifications.topicName", "Name") }), /* @__PURE__ */ u("input", {
131
+ children: [/* @__PURE__ */ f("span", { children: x("notifications.topicName", "Name") }), /* @__PURE__ */ f("input", {
130
132
  id: "notification-topic-name",
131
133
  type: "text",
132
- value: M.name,
133
- onChange: (e) => N((t) => ({
134
+ value: L.name,
135
+ onChange: (e) => R((t) => ({
134
136
  ...t,
135
137
  name: e.target.value,
136
- slug: A ? t.slug : v(e.target.value)
138
+ slug: F ? t.slug : b(e.target.value)
137
139
  })),
138
140
  className: "w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent"
139
141
  })]
140
142
  }),
141
- /* @__PURE__ */ d("label", {
143
+ /* @__PURE__ */ p("label", {
142
144
  className: "block space-y-1 text-sm text-secondary",
143
- children: [/* @__PURE__ */ u("span", { children: y("notifications.topicSlug", "Slug") }), /* @__PURE__ */ u("input", {
145
+ children: [/* @__PURE__ */ f("span", { children: x("notifications.topicSlug", "Slug") }), /* @__PURE__ */ f("input", {
144
146
  type: "text",
145
- value: M.slug,
146
- onChange: (e) => N((t) => ({
147
+ value: L.slug,
148
+ onChange: (e) => R((t) => ({
147
149
  ...t,
148
- slug: v(e.target.value)
150
+ slug: b(e.target.value)
149
151
  })),
150
152
  className: "w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent"
151
153
  })]
152
154
  }),
153
- /* @__PURE__ */ d("label", {
155
+ /* @__PURE__ */ p("label", {
154
156
  className: "block space-y-1 text-sm text-secondary",
155
- children: [/* @__PURE__ */ u("span", { children: y("notifications.topicType", "Type") }), /* @__PURE__ */ u("select", {
157
+ children: [/* @__PURE__ */ f("span", { children: x("notifications.topicType", "Type") }), /* @__PURE__ */ f("select", {
156
158
  id: "notification-topic-type",
157
- value: M.type,
158
- onChange: (e) => N((t) => ({
159
+ value: L.type,
160
+ onChange: (e) => R((t) => ({
159
161
  ...t,
160
162
  type: e.target.value
161
163
  })),
162
164
  className: "w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
163
- children: _.map((e) => /* @__PURE__ */ u("option", {
165
+ children: y.map((e) => /* @__PURE__ */ f("option", {
164
166
  value: e.value,
165
- children: y(e.labelKey, e.label)
167
+ children: x(e.labelKey, e.label)
166
168
  }, e.value))
167
169
  })]
168
170
  }),
169
- /* @__PURE__ */ d("label", {
171
+ /* @__PURE__ */ p("label", {
170
172
  className: "block space-y-1 text-sm text-secondary",
171
- children: [/* @__PURE__ */ u("span", { children: y("notifications.topicDescription", "Description") }), /* @__PURE__ */ u("textarea", {
172
- value: M.description,
173
- onChange: (e) => N((t) => ({
173
+ children: [/* @__PURE__ */ f("span", { children: x("notifications.topicDescription", "Description") }), /* @__PURE__ */ f("textarea", {
174
+ value: L.description,
175
+ onChange: (e) => R((t) => ({
174
176
  ...t,
175
177
  description: e.target.value
176
178
  })),
@@ -178,27 +180,27 @@ function y() {
178
180
  className: "w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent"
179
181
  })]
180
182
  }),
181
- /* @__PURE__ */ d("label", {
183
+ /* @__PURE__ */ p("label", {
182
184
  className: "flex items-center gap-2 text-sm text-secondary",
183
- children: [/* @__PURE__ */ u("input", {
185
+ children: [/* @__PURE__ */ f("input", {
184
186
  type: "checkbox",
185
- checked: M.isActive,
186
- onChange: (e) => N((t) => ({
187
+ checked: L.isActive,
188
+ onChange: (e) => R((t) => ({
187
189
  ...t,
188
190
  isActive: e.target.checked
189
191
  }))
190
- }), /* @__PURE__ */ u("span", { children: y("notifications.topicIsActive", "Active topic") })]
192
+ }), /* @__PURE__ */ f("span", { children: x("notifications.topicIsActive", "Active topic") })]
191
193
  }),
192
- /* @__PURE__ */ d("div", {
194
+ /* @__PURE__ */ p("div", {
193
195
  className: "flex items-center gap-3",
194
- children: [/* @__PURE__ */ d("button", {
196
+ children: [/* @__PURE__ */ p("button", {
195
197
  type: "submit",
196
198
  className: "inline-flex items-center gap-2 rounded-md bg-accent-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90",
197
- children: [/* @__PURE__ */ u(s, { size: 16 }), A ? y("notifications.saveTopic", "Save Topic") : y("notifications.createTopicButton", "Create Topic")]
198
- }), A && /* @__PURE__ */ u("button", {
199
+ children: [/* @__PURE__ */ f(l, { size: 16 }), F ? x("notifications.saveTopic", "Save Topic") : x("notifications.createTopicButton", "Create Topic")]
200
+ }), F && /* @__PURE__ */ f("button", {
199
201
  type: "button",
200
202
  onClick: () => {
201
- j(null), N({
203
+ I(null), R({
202
204
  name: "",
203
205
  slug: "",
204
206
  description: "",
@@ -207,80 +209,80 @@ function y() {
207
209
  });
208
210
  },
209
211
  className: "rounded-md border border-default px-4 py-2 text-sm text-secondary hover:bg-bg-sunken",
210
- children: y("notifications.cancelTopicEdit", "Cancel")
212
+ children: x("notifications.cancelTopicEdit", "Cancel")
211
213
  })]
212
214
  })
213
215
  ]
214
216
  })
215
- }), /* @__PURE__ */ d(p, {
217
+ }), /* @__PURE__ */ p(h, {
216
218
  treatment: "plain",
217
219
  className: "space-y-4 border-border-seam p-4",
218
- children: [/* @__PURE__ */ d("div", {
220
+ children: [/* @__PURE__ */ p("div", {
219
221
  className: "relative max-w-md",
220
- children: [/* @__PURE__ */ u(c, {
222
+ children: [/* @__PURE__ */ f(u, {
221
223
  size: 16,
222
224
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
223
- }), /* @__PURE__ */ u("input", {
225
+ }), /* @__PURE__ */ f("input", {
224
226
  type: "text",
225
- value: O,
226
- onChange: (e) => k(e.target.value),
227
- placeholder: y("notifications.searchTopics", "Search topics..."),
227
+ value: j,
228
+ onChange: (e) => M(e.target.value),
229
+ placeholder: x("notifications.searchTopics", "Search topics..."),
228
230
  className: "w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent"
229
231
  })]
230
- }), /* @__PURE__ */ u("div", {
232
+ }), /* @__PURE__ */ f("div", {
231
233
  className: "space-y-3",
232
- children: C ? /* @__PURE__ */ u("div", {
234
+ children: T ? /* @__PURE__ */ f("div", {
233
235
  className: "text-sm text-secondary",
234
- children: y("notifications.loadingTopics", "Loading topics...")
235
- }) : w ? /* @__PURE__ */ u(m, {
236
+ children: x("notifications.loadingTopics", "Loading topics...")
237
+ }) : E ? /* @__PURE__ */ f(g, {
236
238
  illustration: "empty-generic",
237
- title: y("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
238
- description: y("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.")
239
- }) : F.length === 0 ? /* @__PURE__ */ u(m, {
240
- illustration: O.trim() ? "empty-search" : "empty-data",
241
- title: y("notifications.noTopicsFound", "No topics found."),
242
- description: O.trim() ? y("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : y("notifications.noTopicsYet", "No notification topics have been created yet.")
243
- }) : F.map((e) => /* @__PURE__ */ d("div", {
239
+ title: x("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
240
+ description: x("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.")
241
+ }) : B.length === 0 ? /* @__PURE__ */ f(g, {
242
+ illustration: j.trim() ? "empty-search" : "empty-data",
243
+ title: x("notifications.noTopicsFound", "No topics found."),
244
+ description: j.trim() ? x("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : x("notifications.noTopicsYet", "No notification topics have been created yet.")
245
+ }) : B.map((e) => /* @__PURE__ */ p("div", {
244
246
  className: "flex flex-col gap-3 rounded-lg border border-border-seam bg-surface p-4 transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)] sm:flex-row sm:items-start sm:justify-between",
245
- children: [/* @__PURE__ */ d("div", {
247
+ children: [/* @__PURE__ */ p("div", {
246
248
  className: "space-y-1",
247
249
  children: [
248
- /* @__PURE__ */ d("div", {
250
+ /* @__PURE__ */ p("div", {
249
251
  className: "flex flex-wrap items-center gap-2",
250
252
  children: [
251
- /* @__PURE__ */ u("h3", {
253
+ /* @__PURE__ */ f("h3", {
252
254
  className: "text-sm font-semibold text-primary",
253
255
  children: e.name
254
256
  }),
255
- /* @__PURE__ */ u("span", {
257
+ /* @__PURE__ */ f("span", {
256
258
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary",
257
259
  children: e.slug
258
260
  }),
259
- /* @__PURE__ */ u("span", {
261
+ /* @__PURE__ */ f("span", {
260
262
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary",
261
263
  children: e.type
262
264
  })
263
265
  ]
264
266
  }),
265
- e.description && /* @__PURE__ */ u("p", {
267
+ e.description && /* @__PURE__ */ f("p", {
266
268
  className: "text-sm text-secondary",
267
269
  children: e.description
268
270
  }),
269
- /* @__PURE__ */ d("p", {
271
+ /* @__PURE__ */ p("p", {
270
272
  className: "text-xs text-tertiary",
271
273
  children: [
272
- y("notifications.topicSubscribers", "Subscribers"),
274
+ x("notifications.topicSubscribers", "Subscribers"),
273
275
  ": ",
274
276
  e.subscriberCount
275
277
  ]
276
278
  })
277
279
  ]
278
- }), /* @__PURE__ */ d("div", {
280
+ }), /* @__PURE__ */ p("div", {
279
281
  className: "flex items-center gap-2",
280
- children: [/* @__PURE__ */ u("button", {
282
+ children: [/* @__PURE__ */ f("button", {
281
283
  type: "button",
282
284
  onClick: () => {
283
- j(e.id), N({
285
+ I(e.id), R({
284
286
  name: e.name,
285
287
  slug: e.slug,
286
288
  description: e.description || "",
@@ -289,24 +291,37 @@ function y() {
289
291
  });
290
292
  },
291
293
  className: "rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken",
292
- children: y("notifications.edit", "Edit")
293
- }), /* @__PURE__ */ d("button", {
294
+ children: x("notifications.edit", "Edit")
295
+ }), /* @__PURE__ */ p("button", {
294
296
  type: "button",
295
- onClick: () => D(e.id),
297
+ onClick: () => P({
298
+ id: e.id,
299
+ name: e.name
300
+ }),
296
301
  className: "inline-flex items-center gap-2 rounded-md border border-status-error-border px-3 py-2 text-sm text-status-error-text hover:bg-status-error-bg-subtle",
297
- children: [/* @__PURE__ */ u(l, { size: 14 }), y("notifications.delete", "Delete")]
302
+ children: [/* @__PURE__ */ f(d, { size: 14 }), x("notifications.delete", "Delete")]
298
303
  })]
299
304
  })]
300
305
  }, e.id))
301
306
  })]
302
307
  })]
308
+ }),
309
+ /* @__PURE__ */ f(r, {
310
+ open: N !== null,
311
+ title: x("notifications.deleteTopicTitle", "Delete topic"),
312
+ description: x("notifications.deleteTopicConfirm", "Delete the topic \"{{name}}\"? It is removed for everyone and this cannot be undone.", { name: N?.name ?? "" }),
313
+ onCancel: () => P(null),
314
+ onConfirm: () => {
315
+ let e = N;
316
+ P(null), e && k(e.id);
317
+ }
303
318
  })
304
319
  ]
305
- }) : /* @__PURE__ */ u("div", {
320
+ }) : /* @__PURE__ */ f("div", {
306
321
  className: "p-8 text-center text-text-secondary",
307
- children: y("notifications.noPermissionTopics", "You don't have permission to manage notification topics.")
322
+ children: x("notifications.noPermissionTopics", "You don't have permission to manage notification topics.")
308
323
  });
309
324
  }
310
- export { y as NotificationTopicsPage };
325
+ export { x as NotificationTopicsPage };
311
326
 
312
327
  //# sourceMappingURL=NotificationTopicsPage.js.map