@burdenoff/microfe-notification 2026.1124.1 → 2026.1125.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/AdminNotificationRoutes.js +59 -51
  2. package/dist/AdminNotificationRoutes.js.map +1 -1
  3. package/dist/NotificationRoutes.js +76 -68
  4. package/dist/NotificationRoutes.js.map +1 -1
  5. package/dist/UserNotificationRoutes.js +39 -31
  6. package/dist/UserNotificationRoutes.js.map +1 -1
  7. package/dist/components/NotificationListFooter.js +1 -1
  8. package/dist/components/NotificationListFooter.js.map +1 -1
  9. package/dist/components/loadingSystem.d.ts +64 -0
  10. package/dist/components/loadingSystem.js +34 -0
  11. package/dist/components/loadingSystem.js.map +1 -0
  12. package/dist/navigation-v2/AdminPageV2.js +23 -16
  13. package/dist/navigation-v2/AdminPageV2.js.map +1 -1
  14. package/dist/navigation-v2/NotificationArchivedV2.js +100 -93
  15. package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
  16. package/dist/navigation-v2/NotificationInboxV2.js +130 -123
  17. package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
  18. package/dist/navigation-v2/NotificationSettingsV2.js +91 -84
  19. package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -1
  20. package/dist/navigation-v2/NotificationsV2Landing.js +31 -23
  21. package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -1
  22. package/dist/pages/CreateNotificationPage.js +442 -432
  23. package/dist/pages/CreateNotificationPage.js.map +1 -1
  24. package/dist/pages/NotificationCenterPage.js +91 -84
  25. package/dist/pages/NotificationCenterPage.js.map +1 -1
  26. package/dist/pages/NotificationHistoryAdminPage.js +226 -219
  27. package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
  28. package/dist/pages/NotificationHistoryPage.js +69 -62
  29. package/dist/pages/NotificationHistoryPage.js.map +1 -1
  30. package/dist/pages/NotificationLandingPage.js +42 -34
  31. package/dist/pages/NotificationLandingPage.js.map +1 -1
  32. package/dist/pages/NotificationPreferencesPage.js +80 -70
  33. package/dist/pages/NotificationPreferencesPage.js.map +1 -1
  34. package/dist/pages/NotificationTemplatesPage.js +192 -181
  35. package/dist/pages/NotificationTemplatesPage.js.map +1 -1
  36. package/dist/pages/NotificationTopicsPage.js +124 -117
  37. package/dist/pages/NotificationTopicsPage.js.map +1 -1
  38. package/dist/pages/TemplateEditorPage.js +248 -233
  39. package/dist/pages/TemplateEditorPage.js.map +1 -1
  40. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationTemplatesPage.js","names":["useI18n","useI18n$1","TYPE_COLORS","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","ThemedSelect","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 ThemedSelect,\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-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-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 <ThemedSelect\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 </ThemedSelect>\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-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-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 kind={filter.search ? 'no-results' : filter.type ? 'filtered' : 'first-use'}\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-text-secondary mb-2 line-clamp-2\">\n {template.description}\n </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-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":";;;;;;;;;;;;;;AAyBA,IAAME,IAAgD;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,GACXC,IAAQC,EAAqB,GAC7BC,IAAeC,EAAgB,GAE/B,CAACC,GAAgBC,KAAqBC,EAIlC,IAAI,GACRC,KAAiB,GAAe,MACpCL,IACI,IAAI,SAAS,MAAYG,EAAkB;EAAE;EAAO;EAAS;CAAQ,CAAC,CAAC,IACvE,QAAQ,QAAQ,OAAO,QAAQG,CAAO,CAAC,GACvC,EAAE,eAAWpB,EAAQ,GACrB,EAAE,kBAAe,WAAWqB,OAAuBC,EAAe,GAClE,EACJ,cACA,cACA,eACA,UACA,UACA,YACA,WACA,YACA,aACA,mBACA,oBACEC,EAAyB,GAEvB,CAACC,GAAYC,KAAiBP,EAAwB,IAAI,GAC1D,C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MAAM;MAAI,WAAU;KAAgB,CAAA,IAAI,MAC7D/C,EAAG,2BAA2B,WAAW,CACpC;;GACL,CAAA;GAGNI,KACC,kBAACoE,GAAD;IACE,MAAMlE,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,KAzVH,kBAAC,OAAD;EAAK,WAAU;EACZ,UAAAP,EACC,mCACA,2DACF;CACG,CAAA;AAsVX"}
1
+ {"version":3,"file":"NotificationTemplatesPage.js","names":["useI18n","useI18n$1","TYPE_COLORS","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","SectionLoaderOr","CompactMarkOr","isLoading","SpinnerIcon","error","AlertCircle","refetch","RefreshCw","PagePurpose","FileText","EmphasisPanel","total","Button","Plus","NextSteps","updateFilter","Search","filter","ThemedSelect","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, 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 ThemedSelect,\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';\nimport { CompactMarkOr, SectionLoaderOr, SpinnerIcon } from '../components/loadingSystem';\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 <SectionLoaderOr\n minHeight=\"16rem\"\n today={\n <div className=\"flex h-64 items-center justify-center\">\n <CompactMarkOr\n className=\"h-8 w-8\"\n today={\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n }\n />\n </div>\n }\n />\n );\n }\n\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 <SectionLoaderOr\n label={tr('notifTemplates.loading', 'Loading templates...')}\n minHeight=\"16rem\"\n today={\n <div className=\"flex flex-col items-center justify-center h-64 gap-3\">\n <SpinnerIcon size={28} className=\"animate-spin text-accent-primary\" />\n <p className=\"text-sm text-text-secondary\">\n {tr('notifTemplates.loading', 'Loading templates...')}\n </p>\n </div>\n }\n />\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-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 <ThemedSelect\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 </ThemedSelect>\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-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-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 kind={filter.search ? 'no-results' : filter.type ? 'filtered' : 'first-use'}\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 <SpinnerIcon 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-text-secondary mb-2 line-clamp-2\">\n {template.description}\n </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-text-secondary hover:text-primary border border-default rounded-lg transition-all duration-150 hover:shadow-sm\"\n >\n {isLoading ? <SpinnerIcon 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":";;;;;;;;;;;;;;;AA0BA,IAAME,KAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;AACT,GAEMC,KAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;AACT;AAEA,SAASC,GAAW,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,GAAY,GACvBC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7BC,IAAeC,E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b,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,GAAW6B,EAAS,WAAW3B,EAAM;OAC/E;;KACA;IAjFE,GAAA2B,EAAS,EAiFX,CACN;GACE,CAAA;GAGJiD,KACC,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,UAAD;KACE,SAASC;KACT,UAAUzB;KACV,WAAU;KAHZ,UAAA,CAKGA,IAAY,kBAACC,GAAD;MAAa,MAAM;MAAI,WAAU;KAAgB,CAAA,IAAI,MACjEjD,EAAG,2BAA2B,WAAW,CACpC;;GACL,CAAA;GAGNI,KACC,kBAACsE,GAAD;IACE,MAAMpE,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,KA/VH,kBAAC,OAAD;EAAK,WAAU;EACZ,UAAAP,EACC,mCACA,2DACF;CACG,CAAA;AA4VX"}
@@ -4,13 +4,14 @@ import { NOTIFICATION_PERMISSIONS as t } from "../constants/permissions.js";
4
4
  import { useTr as n } from "../shared/hooks/useTr.js";
5
5
  import { ConfirmDeleteDialog as r } from "../components/ConfirmDeleteDialog.js";
6
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, ThemedSelect as y } from "@burdenoff/fe-libs/ui";
7
+ import { CompactMarkOr as a, SectionLoaderOr as o } from "../components/loadingSystem.js";
8
+ import { useMemo as s, useState as c } from "react";
9
+ import { usePermissions as l } from "@burdenoff/fe-libs/shared/providers/shell";
10
+ import { Plus as u, Save as d, Search as f, Trash2 as p } from "lucide-react";
11
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
12
+ import { EmphasisPanel as g, GlassCard as _, IllustratedEmptyState as v, NextSteps as y, PagePurpose as b, ThemedSelect as x } from "@burdenoff/fe-libs/ui";
12
13
  // src/pages/NotificationTopicsPage.tsx
13
- var b = [
14
+ var S = [
14
15
  {
15
16
  value: "MARKETING",
16
17
  labelKey: "notifications.topicType.marketing",
@@ -32,47 +33,53 @@ var b = [
32
33
  label: "Alert"
33
34
  }
34
35
  ];
35
- function x(e) {
36
+ function C(e) {
36
37
  return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
37
38
  }
38
- function S() {
39
- let S = n(), { hasPermission: C, isLoading: w } = s(), { topics: T, isLoading: E, isForbidden: D, createTopic: O, updateTopic: k, deleteTopic: A } = e(), j = i(), [M, N] = o(""), [P, F] = o(null), [I, L] = o(null), [R, z] = o({
39
+ function w() {
40
+ let w = n(), { hasPermission: T, isLoading: E } = l(), { topics: D, isLoading: O, isForbidden: k, createTopic: A, updateTopic: j, deleteTopic: M } = e(), N = i(), [P, F] = c(""), [I, L] = c(null), [R, z] = c(null), [B, V] = c({
40
41
  name: "",
41
42
  slug: "",
42
43
  description: "",
43
44
  type: "MARKETING",
44
45
  isActive: !0
45
- }), B = C(t.NOTIFICATION_CREATE), V = a(() => {
46
- if (!M.trim()) return T;
47
- let e = M.toLowerCase();
48
- return T.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
49
- }, [M, T]);
50
- return w ? /* @__PURE__ */ f("div", {
51
- className: "flex h-64 items-center justify-center",
52
- children: /* @__PURE__ */ f("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
53
- }) : B ? /* @__PURE__ */ p("div", {
46
+ }), H = T(t.NOTIFICATION_CREATE), U = s(() => {
47
+ if (!P.trim()) return D;
48
+ let e = P.toLowerCase();
49
+ return D.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
50
+ }, [P, D]);
51
+ return E ? /* @__PURE__ */ m(o, {
52
+ minHeight: "16rem",
53
+ today: /* @__PURE__ */ m("div", {
54
+ className: "flex h-64 items-center justify-center",
55
+ children: /* @__PURE__ */ m(a, {
56
+ className: "h-8 w-8",
57
+ today: /* @__PURE__ */ m("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
58
+ })
59
+ })
60
+ }) : H ? /* @__PURE__ */ h("div", {
54
61
  className: "space-y-6 p-4 sm:p-6",
55
62
  children: [
56
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", {
63
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
57
64
  className: "text-2xl font-bold text-primary",
58
- children: S("notifications.topicsTitle", "Notification Topics")
59
- }), /* @__PURE__ */ f("p", {
65
+ children: w("notifications.topicsTitle", "Notification Topics")
66
+ }), /* @__PURE__ */ m("p", {
60
67
  className: "mt-1 text-sm text-text-secondary",
61
- children: S("notifications.topicsSubtitle", "Create topics for campaigns so users can subscribe or unsubscribe with precision.")
68
+ children: w("notifications.topicsSubtitle", "Create topics for campaigns so users can subscribe or unsubscribe with precision.")
62
69
  })] }),
63
- /* @__PURE__ */ f(v, {
64
- icon: /* @__PURE__ */ f(c, { size: 16 }),
65
- children: S("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.")
70
+ /* @__PURE__ */ m(b, {
71
+ icon: /* @__PURE__ */ m(u, { size: 16 }),
72
+ children: w("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.")
66
73
  }),
67
- /* @__PURE__ */ f(_, {
74
+ /* @__PURE__ */ m(y, {
68
75
  storageKey: "notification-topics",
69
76
  steps: [
70
77
  {
71
78
  id: "name-topic",
72
- label: S("notifications.topicsNextNameLabel", "Name your first topic"),
73
- description: S("notifications.topicsNextNameDesc", "Use the form to add a clear topic like \"Product updates\" — the slug is generated for you."),
79
+ label: w("notifications.topicsNextNameLabel", "Name your first topic"),
80
+ description: w("notifications.topicsNextNameDesc", "Use the form to add a clear topic like \"Product updates\" — the slug is generated for you."),
74
81
  onClick: () => {
75
- L(null), z((e) => ({
82
+ z(null), V((e) => ({
76
83
  ...e,
77
84
  name: "",
78
85
  slug: "",
@@ -85,8 +92,8 @@ function S() {
85
92
  },
86
93
  {
87
94
  id: "set-type",
88
- label: S("notifications.topicsNextTypeLabel", "Pick the right type"),
89
- description: S("notifications.topicsNextTypeDesc", "Marketing topics are opt-in for users; Transactional, System and Alert reach everyone."),
95
+ label: w("notifications.topicsNextTypeLabel", "Pick the right type"),
96
+ description: w("notifications.topicsNextTypeDesc", "Marketing topics are opt-in for users; Transactional, System and Alert reach everyone."),
90
97
  onClick: () => document.getElementById("notification-topic-type")?.scrollIntoView({
91
98
  behavior: "smooth",
92
99
  block: "center"
@@ -94,20 +101,20 @@ function S() {
94
101
  },
95
102
  {
96
103
  id: "let-subscribe",
97
- label: S("notifications.topicsNextSubscribeLabel", "Let people subscribe"),
98
- description: S("notifications.topicsNextSubscribeDesc", "Once a topic is active, users manage their own opt-ins from the Preferences page."),
99
- href: j.preferences
104
+ label: w("notifications.topicsNextSubscribeLabel", "Let people subscribe"),
105
+ description: w("notifications.topicsNextSubscribeDesc", "Once a topic is active, users manage their own opt-ins from the Preferences page."),
106
+ href: N.preferences
100
107
  }
101
108
  ]
102
109
  }),
103
- /* @__PURE__ */ p("div", {
110
+ /* @__PURE__ */ h("div", {
104
111
  className: "grid gap-6 xl:grid-cols-[380px,1fr]",
105
- children: [/* @__PURE__ */ f(m, {
112
+ children: [/* @__PURE__ */ m(g, {
106
113
  className: "p-4",
107
- children: /* @__PURE__ */ p("form", {
114
+ children: /* @__PURE__ */ h("form", {
108
115
  className: "space-y-4",
109
116
  onSubmit: async (e) => {
110
- e.preventDefault(), R.name.trim() && R.slug.trim() && (I ? await k(I, R) : await O(R), L(null), z({
117
+ e.preventDefault(), B.name.trim() && B.slug.trim() && (R ? await j(R, B) : await A(B), z(null), V({
111
118
  name: "",
112
119
  slug: "",
113
120
  description: "",
@@ -116,63 +123,63 @@ function S() {
116
123
  }));
117
124
  },
118
125
  children: [
119
- /* @__PURE__ */ p("div", {
126
+ /* @__PURE__ */ h("div", {
120
127
  className: "flex items-center gap-2",
121
- children: [/* @__PURE__ */ f(c, {
128
+ children: [/* @__PURE__ */ m(u, {
122
129
  size: 18,
123
130
  className: "text-accent-primary"
124
- }), /* @__PURE__ */ f("h2", {
131
+ }), /* @__PURE__ */ m("h2", {
125
132
  className: "text-base font-semibold text-primary",
126
- children: I ? S("notifications.editTopic", "Edit Topic") : S("notifications.createTopic", "Create Topic")
133
+ children: R ? w("notifications.editTopic", "Edit Topic") : w("notifications.createTopic", "Create Topic")
127
134
  })]
128
135
  }),
129
- /* @__PURE__ */ p("label", {
136
+ /* @__PURE__ */ h("label", {
130
137
  className: "block space-y-1 text-sm text-text-secondary",
131
- children: [/* @__PURE__ */ f("span", { children: S("notifications.topicName", "Name") }), /* @__PURE__ */ f("input", {
138
+ children: [/* @__PURE__ */ m("span", { children: w("notifications.topicName", "Name") }), /* @__PURE__ */ m("input", {
132
139
  id: "notification-topic-name",
133
140
  type: "text",
134
- value: R.name,
135
- onChange: (e) => z((t) => ({
141
+ value: B.name,
142
+ onChange: (e) => V((t) => ({
136
143
  ...t,
137
144
  name: e.target.value,
138
- slug: I ? t.slug : x(e.target.value)
145
+ slug: R ? t.slug : C(e.target.value)
139
146
  })),
140
147
  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"
141
148
  })]
142
149
  }),
143
- /* @__PURE__ */ p("label", {
150
+ /* @__PURE__ */ h("label", {
144
151
  className: "block space-y-1 text-sm text-text-secondary",
145
- children: [/* @__PURE__ */ f("span", { children: S("notifications.topicSlug", "Slug") }), /* @__PURE__ */ f("input", {
152
+ children: [/* @__PURE__ */ m("span", { children: w("notifications.topicSlug", "Slug") }), /* @__PURE__ */ m("input", {
146
153
  type: "text",
147
- value: R.slug,
148
- onChange: (e) => z((t) => ({
154
+ value: B.slug,
155
+ onChange: (e) => V((t) => ({
149
156
  ...t,
150
- slug: x(e.target.value)
157
+ slug: C(e.target.value)
151
158
  })),
152
159
  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"
153
160
  })]
154
161
  }),
155
- /* @__PURE__ */ p("label", {
162
+ /* @__PURE__ */ h("label", {
156
163
  className: "block space-y-1 text-sm text-text-secondary",
157
- children: [/* @__PURE__ */ f("span", { children: S("notifications.topicType", "Type") }), /* @__PURE__ */ f(y, {
164
+ children: [/* @__PURE__ */ m("span", { children: w("notifications.topicType", "Type") }), /* @__PURE__ */ m(x, {
158
165
  id: "notification-topic-type",
159
- value: R.type,
160
- onChange: (e) => z((t) => ({
166
+ value: B.type,
167
+ onChange: (e) => V((t) => ({
161
168
  ...t,
162
169
  type: e.target.value
163
170
  })),
164
171
  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",
165
- children: b.map((e) => /* @__PURE__ */ f("option", {
172
+ children: S.map((e) => /* @__PURE__ */ m("option", {
166
173
  value: e.value,
167
- children: S(e.labelKey, e.label)
174
+ children: w(e.labelKey, e.label)
168
175
  }, e.value))
169
176
  })]
170
177
  }),
171
- /* @__PURE__ */ p("label", {
178
+ /* @__PURE__ */ h("label", {
172
179
  className: "block space-y-1 text-sm text-text-secondary",
173
- children: [/* @__PURE__ */ f("span", { children: S("notifications.topicDescription", "Description") }), /* @__PURE__ */ f("textarea", {
174
- value: R.description,
175
- onChange: (e) => z((t) => ({
180
+ children: [/* @__PURE__ */ m("span", { children: w("notifications.topicDescription", "Description") }), /* @__PURE__ */ m("textarea", {
181
+ value: B.description,
182
+ onChange: (e) => V((t) => ({
176
183
  ...t,
177
184
  description: e.target.value
178
185
  })),
@@ -180,27 +187,27 @@ function S() {
180
187
  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"
181
188
  })]
182
189
  }),
183
- /* @__PURE__ */ p("label", {
190
+ /* @__PURE__ */ h("label", {
184
191
  className: "flex items-center gap-2 text-sm text-text-secondary",
185
- children: [/* @__PURE__ */ f("input", {
192
+ children: [/* @__PURE__ */ m("input", {
186
193
  type: "checkbox",
187
- checked: R.isActive,
188
- onChange: (e) => z((t) => ({
194
+ checked: B.isActive,
195
+ onChange: (e) => V((t) => ({
189
196
  ...t,
190
197
  isActive: e.target.checked
191
198
  }))
192
- }), /* @__PURE__ */ f("span", { children: S("notifications.topicIsActive", "Active topic") })]
199
+ }), /* @__PURE__ */ m("span", { children: w("notifications.topicIsActive", "Active topic") })]
193
200
  }),
194
- /* @__PURE__ */ p("div", {
201
+ /* @__PURE__ */ h("div", {
195
202
  className: "flex items-center gap-3",
196
- children: [/* @__PURE__ */ p("button", {
203
+ children: [/* @__PURE__ */ h("button", {
197
204
  type: "submit",
198
205
  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",
199
- children: [/* @__PURE__ */ f(l, { size: 16 }), I ? S("notifications.saveTopic", "Save Topic") : S("notifications.createTopicButton", "Create Topic")]
200
- }), I && /* @__PURE__ */ f("button", {
206
+ children: [/* @__PURE__ */ m(d, { size: 16 }), R ? w("notifications.saveTopic", "Save Topic") : w("notifications.createTopicButton", "Create Topic")]
207
+ }), R && /* @__PURE__ */ m("button", {
201
208
  type: "button",
202
209
  onClick: () => {
203
- L(null), z({
210
+ z(null), V({
204
211
  name: "",
205
212
  slug: "",
206
213
  description: "",
@@ -209,83 +216,83 @@ function S() {
209
216
  });
210
217
  },
211
218
  className: "rounded-md border border-default px-4 py-2 text-sm text-text-secondary hover:bg-bg-sunken",
212
- children: S("notifications.cancelTopicEdit", "Cancel")
219
+ children: w("notifications.cancelTopicEdit", "Cancel")
213
220
  })]
214
221
  })
215
222
  ]
216
223
  })
217
- }), /* @__PURE__ */ p(h, {
224
+ }), /* @__PURE__ */ h(_, {
218
225
  treatment: "plain",
219
226
  className: "space-y-4 border-border-seam p-4",
220
- children: [/* @__PURE__ */ p("div", {
227
+ children: [/* @__PURE__ */ h("div", {
221
228
  className: "relative max-w-md",
222
- children: [/* @__PURE__ */ f(u, {
229
+ children: [/* @__PURE__ */ m(f, {
223
230
  size: 16,
224
231
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
225
- }), /* @__PURE__ */ f("input", {
232
+ }), /* @__PURE__ */ m("input", {
226
233
  type: "text",
227
- value: M,
228
- onChange: (e) => N(e.target.value),
229
- placeholder: S("notifications.searchTopics", "Search topics..."),
234
+ value: P,
235
+ onChange: (e) => F(e.target.value),
236
+ placeholder: w("notifications.searchTopics", "Search topics..."),
230
237
  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"
231
238
  })]
232
- }), /* @__PURE__ */ f("div", {
239
+ }), /* @__PURE__ */ m("div", {
233
240
  className: "space-y-3",
234
- children: E ? /* @__PURE__ */ f("div", {
241
+ children: O ? /* @__PURE__ */ m("div", {
235
242
  className: "text-sm text-text-secondary",
236
- children: S("notifications.loadingTopics", "Loading topics...")
237
- }) : D ? /* @__PURE__ */ f(g, {
243
+ children: w("notifications.loadingTopics", "Loading topics...")
244
+ }) : k ? /* @__PURE__ */ m(v, {
238
245
  illustration: "empty-generic",
239
- title: S("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
240
- description: S("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access."),
246
+ title: w("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
247
+ description: w("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access."),
241
248
  kind: "no-access"
242
- }) : V.length === 0 ? /* @__PURE__ */ f(g, {
243
- illustration: M.trim() ? "empty-search" : "empty-data",
244
- title: S("notifications.noTopicsFound", "No topics found."),
245
- description: M.trim() ? S("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : S("notifications.noTopicsYet", "No notification topics have been created yet."),
246
- kind: M.trim() ? "no-results" : "first-use",
249
+ }) : U.length === 0 ? /* @__PURE__ */ m(v, {
250
+ illustration: P.trim() ? "empty-search" : "empty-data",
251
+ title: w("notifications.noTopicsFound", "No topics found."),
252
+ description: P.trim() ? w("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : w("notifications.noTopicsYet", "No notification topics have been created yet."),
253
+ kind: P.trim() ? "no-results" : "first-use",
247
254
  glassIllustration: "notifications"
248
- }) : V.map((e) => /* @__PURE__ */ p("div", {
255
+ }) : U.map((e) => /* @__PURE__ */ h("div", {
249
256
  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",
250
- children: [/* @__PURE__ */ p("div", {
257
+ children: [/* @__PURE__ */ h("div", {
251
258
  className: "space-y-1",
252
259
  children: [
253
- /* @__PURE__ */ p("div", {
260
+ /* @__PURE__ */ h("div", {
254
261
  className: "flex flex-wrap items-center gap-2",
255
262
  children: [
256
- /* @__PURE__ */ f("h3", {
263
+ /* @__PURE__ */ m("h3", {
257
264
  className: "text-sm font-semibold text-primary",
258
265
  children: e.name
259
266
  }),
260
- /* @__PURE__ */ f("span", {
267
+ /* @__PURE__ */ m("span", {
261
268
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
262
269
  children: e.slug
263
270
  }),
264
- /* @__PURE__ */ f("span", {
271
+ /* @__PURE__ */ m("span", {
265
272
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
266
273
  children: e.type
267
274
  })
268
275
  ]
269
276
  }),
270
- e.description && /* @__PURE__ */ f("p", {
277
+ e.description && /* @__PURE__ */ m("p", {
271
278
  className: "text-sm text-text-secondary",
272
279
  children: e.description
273
280
  }),
274
- /* @__PURE__ */ p("p", {
281
+ /* @__PURE__ */ h("p", {
275
282
  className: "text-xs text-tertiary",
276
283
  children: [
277
- S("notifications.topicSubscribers", "Subscribers"),
284
+ w("notifications.topicSubscribers", "Subscribers"),
278
285
  ": ",
279
286
  e.subscriberCount
280
287
  ]
281
288
  })
282
289
  ]
283
- }), /* @__PURE__ */ p("div", {
290
+ }), /* @__PURE__ */ h("div", {
284
291
  className: "flex items-center gap-2",
285
- children: [/* @__PURE__ */ f("button", {
292
+ children: [/* @__PURE__ */ m("button", {
286
293
  type: "button",
287
294
  onClick: () => {
288
- L(e.id), z({
295
+ z(e.id), V({
289
296
  name: e.name,
290
297
  slug: e.slug,
291
298
  description: e.description || "",
@@ -294,37 +301,37 @@ function S() {
294
301
  });
295
302
  },
296
303
  className: "rounded-md border border-default px-3 py-2 text-sm text-text-secondary hover:bg-bg-sunken",
297
- children: S("notifications.edit", "Edit")
298
- }), /* @__PURE__ */ p("button", {
304
+ children: w("notifications.edit", "Edit")
305
+ }), /* @__PURE__ */ h("button", {
299
306
  type: "button",
300
- onClick: () => F({
307
+ onClick: () => L({
301
308
  id: e.id,
302
309
  name: e.name
303
310
  }),
304
311
  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",
305
- children: [/* @__PURE__ */ f(d, { size: 14 }), S("notifications.delete", "Delete")]
312
+ children: [/* @__PURE__ */ m(p, { size: 14 }), w("notifications.delete", "Delete")]
306
313
  })]
307
314
  })]
308
315
  }, e.id))
309
316
  })]
310
317
  })]
311
318
  }),
312
- /* @__PURE__ */ f(r, {
313
- open: P !== null,
314
- title: S("notifications.deleteTopicTitle", "Delete topic"),
315
- description: S("notifications.deleteTopicConfirm", "Delete the topic \"{{name}}\"? It is removed for everyone and this cannot be undone.", { name: P?.name ?? "" }),
316
- onCancel: () => F(null),
319
+ /* @__PURE__ */ m(r, {
320
+ open: I !== null,
321
+ title: w("notifications.deleteTopicTitle", "Delete topic"),
322
+ description: w("notifications.deleteTopicConfirm", "Delete the topic \"{{name}}\"? It is removed for everyone and this cannot be undone.", { name: I?.name ?? "" }),
323
+ onCancel: () => L(null),
317
324
  onConfirm: () => {
318
- let e = P;
319
- F(null), e && A(e.id);
325
+ let e = I;
326
+ L(null), e && M(e.id);
320
327
  }
321
328
  })
322
329
  ]
323
- }) : /* @__PURE__ */ f("div", {
330
+ }) : /* @__PURE__ */ m("div", {
324
331
  className: "p-8 text-center text-text-secondary",
325
- children: S("notifications.noPermissionTopics", "You don't have permission to manage notification topics.")
332
+ children: w("notifications.noPermissionTopics", "You don't have permission to manage notification topics.")
326
333
  });
327
334
  }
328
- export { S as NotificationTopicsPage };
335
+ export { w as NotificationTopicsPage };
329
336
 
330
337
  //# sourceMappingURL=NotificationTopicsPage.js.map