@burdenoff/microfe-notification 2026.1124.1 → 2026.1127.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 (132) 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/NotificationPanel.js +0 -1
  10. package/dist/components/NotificationPanel.js.map +1 -1
  11. package/dist/components/loadingSystem.d.ts +64 -0
  12. package/dist/components/loadingSystem.js +34 -0
  13. package/dist/components/loadingSystem.js.map +1 -0
  14. package/dist/graphql/global-client.js +34 -34
  15. package/dist/index.js +9 -11
  16. package/dist/navigation-v2/AdminPageV2.js +23 -16
  17. package/dist/navigation-v2/AdminPageV2.js.map +1 -1
  18. package/dist/navigation-v2/NotificationArchivedV2.js +104 -98
  19. package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
  20. package/dist/navigation-v2/NotificationInboxV2.js +133 -127
  21. package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
  22. package/dist/navigation-v2/NotificationSettingsV2.js +91 -85
  23. package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -1
  24. package/dist/navigation-v2/NotificationsV2Landing.js +31 -23
  25. package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -1
  26. package/dist/pages/CreateNotificationPage.js +442 -432
  27. package/dist/pages/CreateNotificationPage.js.map +1 -1
  28. package/dist/pages/NotificationCenterPage.js +93 -87
  29. package/dist/pages/NotificationCenterPage.js.map +1 -1
  30. package/dist/pages/NotificationHistoryAdminPage.js +231 -225
  31. package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
  32. package/dist/pages/NotificationHistoryPage.js +72 -66
  33. package/dist/pages/NotificationHistoryPage.js.map +1 -1
  34. package/dist/pages/NotificationLandingPage.js +42 -34
  35. package/dist/pages/NotificationLandingPage.js.map +1 -1
  36. package/dist/pages/NotificationPreferencesPage.js +80 -71
  37. package/dist/pages/NotificationPreferencesPage.js.map +1 -1
  38. package/dist/pages/NotificationTemplatesPage.js +192 -181
  39. package/dist/pages/NotificationTemplatesPage.js.map +1 -1
  40. package/dist/pages/NotificationTopicsPage.js +124 -118
  41. package/dist/pages/NotificationTopicsPage.js.map +1 -1
  42. package/dist/pages/TemplateEditorPage.js +248 -233
  43. package/dist/pages/TemplateEditorPage.js.map +1 -1
  44. package/package.json +5 -2
  45. package/dist/components/index.js +0 -4
  46. package/dist/hooks/index.js +0 -8
  47. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +0 -23
  48. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +0 -1
  49. package/dist/node_modules/@apollo/client/errors/utils.js +0 -15
  50. package/dist/node_modules/@apollo/client/errors/utils.js.map +0 -1
  51. package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +0 -51
  52. package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +0 -1
  53. package/dist/node_modules/@apollo/client/link/subscriptions/index.js +0 -40
  54. package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +0 -1
  55. package/dist/node_modules/@apollo/client/link/utils/createOperation.js +0 -33
  56. package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +0 -1
  57. package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -5
  58. package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +0 -1
  59. package/dist/node_modules/@apollo/client/utilities/graphql/print.js +0 -15
  60. package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +0 -1
  61. package/dist/node_modules/@apollo/client/utilities/internal/caches.js +0 -18
  62. package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +0 -1
  63. package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +0 -20
  64. package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +0 -1
  65. package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +0 -16
  66. package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +0 -1
  67. package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +0 -8
  68. package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +0 -1
  69. package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +0 -8
  70. package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +0 -1
  71. package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +0 -7
  72. package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +0 -1
  73. package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +0 -8
  74. package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +0 -1
  75. package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +0 -9
  76. package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +0 -1
  77. package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +0 -7
  78. package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +0 -1
  79. package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +0 -9
  80. package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +0 -1
  81. package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +0 -22
  82. package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +0 -1
  83. package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +0 -9
  84. package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +0 -1
  85. package/dist/node_modules/@apollo/client/utilities/invariant/index.js +0 -56
  86. package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +0 -1
  87. package/dist/node_modules/@apollo/client/version.js +0 -5
  88. package/dist/node_modules/@apollo/client/version.js.map +0 -1
  89. package/dist/node_modules/@wry/caches/lib/weak.js +0 -66
  90. package/dist/node_modules/@wry/caches/lib/weak.js.map +0 -1
  91. package/dist/node_modules/@wry/trie/lib/index.js +0 -52
  92. package/dist/node_modules/@wry/trie/lib/index.js.map +0 -1
  93. package/dist/node_modules/graphql-ws/dist/client.js +0 -279
  94. package/dist/node_modules/graphql-ws/dist/client.js.map +0 -1
  95. package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +0 -61
  96. package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +0 -1
  97. package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +0 -20
  98. package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +0 -1
  99. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -77
  100. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +0 -1
  101. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -116
  102. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +0 -1
  103. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -96
  104. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +0 -1
  105. package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -11
  106. package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +0 -1
  107. package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +0 -8
  108. package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +0 -1
  109. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -15
  110. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +0 -1
  111. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -7
  112. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +0 -1
  113. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -12
  114. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +0 -1
  115. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -10
  116. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +0 -1
  117. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -10
  118. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +0 -1
  119. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -21
  120. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +0 -1
  121. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -7
  122. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +0 -1
  123. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -7
  124. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +0 -1
  125. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
  126. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +0 -1
  127. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -12
  128. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +0 -1
  129. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -13
  130. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +0 -1
  131. package/dist/node_modules/tslib/tslib.es6.js +0 -51
  132. package/dist/node_modules/tslib/tslib.es6.js.map +0 -1
@@ -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,WAA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AAf,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,EAAM;OAC/E;;KACA;IAjFE,GAAA2B,EAAS,EAiFX,CACN;GACE,CAAA;GAGJ+C,KACC,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,UAAD;KACE,SAASC;KACT,UAAUzB;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,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,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,GAAQ,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,CAACQ,GAAaC,KAAkBT,EAAwB,IAAI,GAC5D,CAACU,GAAqBC,KAA0BX,kBAAsB,IAAI,IAAI,CAAC,GAE/EY,IAAoBC,QAClBC,EAAU,QAAQ,MAAaJ,EAAoB,IAAIK,EAAS,EAAE,CAAC,GACzE,C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I,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"}
@@ -1,16 +1,16 @@
1
1
  import { useNotificationTopics as e } from "../hooks/useNotificationTopics.js";
2
- import "../hooks/index.js";
3
2
  import { NOTIFICATION_PERMISSIONS as t } from "../constants/permissions.js";
4
3
  import { useTr as n } from "../shared/hooks/useTr.js";
5
4
  import { ConfirmDeleteDialog as r } from "../components/ConfirmDeleteDialog.js";
6
5
  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";
6
+ import { CompactMarkOr as a, SectionLoaderOr as o } from "../components/loadingSystem.js";
7
+ import { useMemo as s, useState as c } from "react";
8
+ import { usePermissions as l } from "@burdenoff/fe-libs/shared/providers/shell";
9
+ import { Plus as u, Save as d, Search as f, Trash2 as p } from "lucide-react";
10
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
11
+ import { EmphasisPanel as g, GlassCard as _, IllustratedEmptyState as v, NextSteps as y, PagePurpose as b, ThemedSelect as x } from "@burdenoff/fe-libs/ui";
12
12
  // src/pages/NotificationTopicsPage.tsx
13
- var b = [
13
+ var S = [
14
14
  {
15
15
  value: "MARKETING",
16
16
  labelKey: "notifications.topicType.marketing",
@@ -32,47 +32,53 @@ var b = [
32
32
  label: "Alert"
33
33
  }
34
34
  ];
35
- function x(e) {
35
+ function C(e) {
36
36
  return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
37
37
  }
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({
38
+ function w() {
39
+ 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
40
  name: "",
41
41
  slug: "",
42
42
  description: "",
43
43
  type: "MARKETING",
44
44
  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", {
45
+ }), H = T(t.NOTIFICATION_CREATE), U = s(() => {
46
+ if (!P.trim()) return D;
47
+ let e = P.toLowerCase();
48
+ return D.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
49
+ }, [P, D]);
50
+ return E ? /* @__PURE__ */ m(o, {
51
+ minHeight: "16rem",
52
+ today: /* @__PURE__ */ m("div", {
53
+ className: "flex h-64 items-center justify-center",
54
+ children: /* @__PURE__ */ m(a, {
55
+ className: "h-8 w-8",
56
+ today: /* @__PURE__ */ m("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
57
+ })
58
+ })
59
+ }) : H ? /* @__PURE__ */ h("div", {
54
60
  className: "space-y-6 p-4 sm:p-6",
55
61
  children: [
56
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", {
62
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
57
63
  className: "text-2xl font-bold text-primary",
58
- children: S("notifications.topicsTitle", "Notification Topics")
59
- }), /* @__PURE__ */ f("p", {
64
+ children: w("notifications.topicsTitle", "Notification Topics")
65
+ }), /* @__PURE__ */ m("p", {
60
66
  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.")
67
+ children: w("notifications.topicsSubtitle", "Create topics for campaigns so users can subscribe or unsubscribe with precision.")
62
68
  })] }),
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.")
69
+ /* @__PURE__ */ m(b, {
70
+ icon: /* @__PURE__ */ m(u, { size: 16 }),
71
+ 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
72
  }),
67
- /* @__PURE__ */ f(_, {
73
+ /* @__PURE__ */ m(y, {
68
74
  storageKey: "notification-topics",
69
75
  steps: [
70
76
  {
71
77
  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."),
78
+ label: w("notifications.topicsNextNameLabel", "Name your first topic"),
79
+ description: w("notifications.topicsNextNameDesc", "Use the form to add a clear topic like \"Product updates\" — the slug is generated for you."),
74
80
  onClick: () => {
75
- L(null), z((e) => ({
81
+ z(null), V((e) => ({
76
82
  ...e,
77
83
  name: "",
78
84
  slug: "",
@@ -85,8 +91,8 @@ function S() {
85
91
  },
86
92
  {
87
93
  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."),
94
+ label: w("notifications.topicsNextTypeLabel", "Pick the right type"),
95
+ description: w("notifications.topicsNextTypeDesc", "Marketing topics are opt-in for users; Transactional, System and Alert reach everyone."),
90
96
  onClick: () => document.getElementById("notification-topic-type")?.scrollIntoView({
91
97
  behavior: "smooth",
92
98
  block: "center"
@@ -94,20 +100,20 @@ function S() {
94
100
  },
95
101
  {
96
102
  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
103
+ label: w("notifications.topicsNextSubscribeLabel", "Let people subscribe"),
104
+ description: w("notifications.topicsNextSubscribeDesc", "Once a topic is active, users manage their own opt-ins from the Preferences page."),
105
+ href: N.preferences
100
106
  }
101
107
  ]
102
108
  }),
103
- /* @__PURE__ */ p("div", {
109
+ /* @__PURE__ */ h("div", {
104
110
  className: "grid gap-6 xl:grid-cols-[380px,1fr]",
105
- children: [/* @__PURE__ */ f(m, {
111
+ children: [/* @__PURE__ */ m(g, {
106
112
  className: "p-4",
107
- children: /* @__PURE__ */ p("form", {
113
+ children: /* @__PURE__ */ h("form", {
108
114
  className: "space-y-4",
109
115
  onSubmit: async (e) => {
110
- e.preventDefault(), R.name.trim() && R.slug.trim() && (I ? await k(I, R) : await O(R), L(null), z({
116
+ e.preventDefault(), B.name.trim() && B.slug.trim() && (R ? await j(R, B) : await A(B), z(null), V({
111
117
  name: "",
112
118
  slug: "",
113
119
  description: "",
@@ -116,63 +122,63 @@ function S() {
116
122
  }));
117
123
  },
118
124
  children: [
119
- /* @__PURE__ */ p("div", {
125
+ /* @__PURE__ */ h("div", {
120
126
  className: "flex items-center gap-2",
121
- children: [/* @__PURE__ */ f(c, {
127
+ children: [/* @__PURE__ */ m(u, {
122
128
  size: 18,
123
129
  className: "text-accent-primary"
124
- }), /* @__PURE__ */ f("h2", {
130
+ }), /* @__PURE__ */ m("h2", {
125
131
  className: "text-base font-semibold text-primary",
126
- children: I ? S("notifications.editTopic", "Edit Topic") : S("notifications.createTopic", "Create Topic")
132
+ children: R ? w("notifications.editTopic", "Edit Topic") : w("notifications.createTopic", "Create Topic")
127
133
  })]
128
134
  }),
129
- /* @__PURE__ */ p("label", {
135
+ /* @__PURE__ */ h("label", {
130
136
  className: "block space-y-1 text-sm text-text-secondary",
131
- children: [/* @__PURE__ */ f("span", { children: S("notifications.topicName", "Name") }), /* @__PURE__ */ f("input", {
137
+ children: [/* @__PURE__ */ m("span", { children: w("notifications.topicName", "Name") }), /* @__PURE__ */ m("input", {
132
138
  id: "notification-topic-name",
133
139
  type: "text",
134
- value: R.name,
135
- onChange: (e) => z((t) => ({
140
+ value: B.name,
141
+ onChange: (e) => V((t) => ({
136
142
  ...t,
137
143
  name: e.target.value,
138
- slug: I ? t.slug : x(e.target.value)
144
+ slug: R ? t.slug : C(e.target.value)
139
145
  })),
140
146
  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
147
  })]
142
148
  }),
143
- /* @__PURE__ */ p("label", {
149
+ /* @__PURE__ */ h("label", {
144
150
  className: "block space-y-1 text-sm text-text-secondary",
145
- children: [/* @__PURE__ */ f("span", { children: S("notifications.topicSlug", "Slug") }), /* @__PURE__ */ f("input", {
151
+ children: [/* @__PURE__ */ m("span", { children: w("notifications.topicSlug", "Slug") }), /* @__PURE__ */ m("input", {
146
152
  type: "text",
147
- value: R.slug,
148
- onChange: (e) => z((t) => ({
153
+ value: B.slug,
154
+ onChange: (e) => V((t) => ({
149
155
  ...t,
150
- slug: x(e.target.value)
156
+ slug: C(e.target.value)
151
157
  })),
152
158
  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
159
  })]
154
160
  }),
155
- /* @__PURE__ */ p("label", {
161
+ /* @__PURE__ */ h("label", {
156
162
  className: "block space-y-1 text-sm text-text-secondary",
157
- children: [/* @__PURE__ */ f("span", { children: S("notifications.topicType", "Type") }), /* @__PURE__ */ f(y, {
163
+ children: [/* @__PURE__ */ m("span", { children: w("notifications.topicType", "Type") }), /* @__PURE__ */ m(x, {
158
164
  id: "notification-topic-type",
159
- value: R.type,
160
- onChange: (e) => z((t) => ({
165
+ value: B.type,
166
+ onChange: (e) => V((t) => ({
161
167
  ...t,
162
168
  type: e.target.value
163
169
  })),
164
170
  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", {
171
+ children: S.map((e) => /* @__PURE__ */ m("option", {
166
172
  value: e.value,
167
- children: S(e.labelKey, e.label)
173
+ children: w(e.labelKey, e.label)
168
174
  }, e.value))
169
175
  })]
170
176
  }),
171
- /* @__PURE__ */ p("label", {
177
+ /* @__PURE__ */ h("label", {
172
178
  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) => ({
179
+ children: [/* @__PURE__ */ m("span", { children: w("notifications.topicDescription", "Description") }), /* @__PURE__ */ m("textarea", {
180
+ value: B.description,
181
+ onChange: (e) => V((t) => ({
176
182
  ...t,
177
183
  description: e.target.value
178
184
  })),
@@ -180,27 +186,27 @@ function S() {
180
186
  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
187
  })]
182
188
  }),
183
- /* @__PURE__ */ p("label", {
189
+ /* @__PURE__ */ h("label", {
184
190
  className: "flex items-center gap-2 text-sm text-text-secondary",
185
- children: [/* @__PURE__ */ f("input", {
191
+ children: [/* @__PURE__ */ m("input", {
186
192
  type: "checkbox",
187
- checked: R.isActive,
188
- onChange: (e) => z((t) => ({
193
+ checked: B.isActive,
194
+ onChange: (e) => V((t) => ({
189
195
  ...t,
190
196
  isActive: e.target.checked
191
197
  }))
192
- }), /* @__PURE__ */ f("span", { children: S("notifications.topicIsActive", "Active topic") })]
198
+ }), /* @__PURE__ */ m("span", { children: w("notifications.topicIsActive", "Active topic") })]
193
199
  }),
194
- /* @__PURE__ */ p("div", {
200
+ /* @__PURE__ */ h("div", {
195
201
  className: "flex items-center gap-3",
196
- children: [/* @__PURE__ */ p("button", {
202
+ children: [/* @__PURE__ */ h("button", {
197
203
  type: "submit",
198
204
  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", {
205
+ children: [/* @__PURE__ */ m(d, { size: 16 }), R ? w("notifications.saveTopic", "Save Topic") : w("notifications.createTopicButton", "Create Topic")]
206
+ }), R && /* @__PURE__ */ m("button", {
201
207
  type: "button",
202
208
  onClick: () => {
203
- L(null), z({
209
+ z(null), V({
204
210
  name: "",
205
211
  slug: "",
206
212
  description: "",
@@ -209,83 +215,83 @@ function S() {
209
215
  });
210
216
  },
211
217
  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")
218
+ children: w("notifications.cancelTopicEdit", "Cancel")
213
219
  })]
214
220
  })
215
221
  ]
216
222
  })
217
- }), /* @__PURE__ */ p(h, {
223
+ }), /* @__PURE__ */ h(_, {
218
224
  treatment: "plain",
219
225
  className: "space-y-4 border-border-seam p-4",
220
- children: [/* @__PURE__ */ p("div", {
226
+ children: [/* @__PURE__ */ h("div", {
221
227
  className: "relative max-w-md",
222
- children: [/* @__PURE__ */ f(u, {
228
+ children: [/* @__PURE__ */ m(f, {
223
229
  size: 16,
224
230
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
225
- }), /* @__PURE__ */ f("input", {
231
+ }), /* @__PURE__ */ m("input", {
226
232
  type: "text",
227
- value: M,
228
- onChange: (e) => N(e.target.value),
229
- placeholder: S("notifications.searchTopics", "Search topics..."),
233
+ value: P,
234
+ onChange: (e) => F(e.target.value),
235
+ placeholder: w("notifications.searchTopics", "Search topics..."),
230
236
  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
237
  })]
232
- }), /* @__PURE__ */ f("div", {
238
+ }), /* @__PURE__ */ m("div", {
233
239
  className: "space-y-3",
234
- children: E ? /* @__PURE__ */ f("div", {
240
+ children: O ? /* @__PURE__ */ m("div", {
235
241
  className: "text-sm text-text-secondary",
236
- children: S("notifications.loadingTopics", "Loading topics...")
237
- }) : D ? /* @__PURE__ */ f(g, {
242
+ children: w("notifications.loadingTopics", "Loading topics...")
243
+ }) : k ? /* @__PURE__ */ m(v, {
238
244
  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."),
245
+ title: w("notifications.topicsNoAccessTitle", "You don't have access to notification topics"),
246
+ description: w("notifications.topicsNoAccessDescription", "Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access."),
241
247
  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",
248
+ }) : U.length === 0 ? /* @__PURE__ */ m(v, {
249
+ illustration: P.trim() ? "empty-search" : "empty-data",
250
+ title: w("notifications.noTopicsFound", "No topics found."),
251
+ description: P.trim() ? w("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : w("notifications.noTopicsYet", "No notification topics have been created yet."),
252
+ kind: P.trim() ? "no-results" : "first-use",
247
253
  glassIllustration: "notifications"
248
- }) : V.map((e) => /* @__PURE__ */ p("div", {
254
+ }) : U.map((e) => /* @__PURE__ */ h("div", {
249
255
  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", {
256
+ children: [/* @__PURE__ */ h("div", {
251
257
  className: "space-y-1",
252
258
  children: [
253
- /* @__PURE__ */ p("div", {
259
+ /* @__PURE__ */ h("div", {
254
260
  className: "flex flex-wrap items-center gap-2",
255
261
  children: [
256
- /* @__PURE__ */ f("h3", {
262
+ /* @__PURE__ */ m("h3", {
257
263
  className: "text-sm font-semibold text-primary",
258
264
  children: e.name
259
265
  }),
260
- /* @__PURE__ */ f("span", {
266
+ /* @__PURE__ */ m("span", {
261
267
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
262
268
  children: e.slug
263
269
  }),
264
- /* @__PURE__ */ f("span", {
270
+ /* @__PURE__ */ m("span", {
265
271
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
266
272
  children: e.type
267
273
  })
268
274
  ]
269
275
  }),
270
- e.description && /* @__PURE__ */ f("p", {
276
+ e.description && /* @__PURE__ */ m("p", {
271
277
  className: "text-sm text-text-secondary",
272
278
  children: e.description
273
279
  }),
274
- /* @__PURE__ */ p("p", {
280
+ /* @__PURE__ */ h("p", {
275
281
  className: "text-xs text-tertiary",
276
282
  children: [
277
- S("notifications.topicSubscribers", "Subscribers"),
283
+ w("notifications.topicSubscribers", "Subscribers"),
278
284
  ": ",
279
285
  e.subscriberCount
280
286
  ]
281
287
  })
282
288
  ]
283
- }), /* @__PURE__ */ p("div", {
289
+ }), /* @__PURE__ */ h("div", {
284
290
  className: "flex items-center gap-2",
285
- children: [/* @__PURE__ */ f("button", {
291
+ children: [/* @__PURE__ */ m("button", {
286
292
  type: "button",
287
293
  onClick: () => {
288
- L(e.id), z({
294
+ z(e.id), V({
289
295
  name: e.name,
290
296
  slug: e.slug,
291
297
  description: e.description || "",
@@ -294,37 +300,37 @@ function S() {
294
300
  });
295
301
  },
296
302
  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", {
303
+ children: w("notifications.edit", "Edit")
304
+ }), /* @__PURE__ */ h("button", {
299
305
  type: "button",
300
- onClick: () => F({
306
+ onClick: () => L({
301
307
  id: e.id,
302
308
  name: e.name
303
309
  }),
304
310
  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")]
311
+ children: [/* @__PURE__ */ m(p, { size: 14 }), w("notifications.delete", "Delete")]
306
312
  })]
307
313
  })]
308
314
  }, e.id))
309
315
  })]
310
316
  })]
311
317
  }),
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),
318
+ /* @__PURE__ */ m(r, {
319
+ open: I !== null,
320
+ title: w("notifications.deleteTopicTitle", "Delete topic"),
321
+ description: w("notifications.deleteTopicConfirm", "Delete the topic \"{{name}}\"? It is removed for everyone and this cannot be undone.", { name: I?.name ?? "" }),
322
+ onCancel: () => L(null),
317
323
  onConfirm: () => {
318
- let e = P;
319
- F(null), e && A(e.id);
324
+ let e = I;
325
+ L(null), e && M(e.id);
320
326
  }
321
327
  })
322
328
  ]
323
- }) : /* @__PURE__ */ f("div", {
329
+ }) : /* @__PURE__ */ m("div", {
324
330
  className: "p-8 text-center text-text-secondary",
325
- children: S("notifications.noPermissionTopics", "You don't have permission to manage notification topics.")
331
+ children: w("notifications.noPermissionTopics", "You don't have permission to manage notification topics.")
326
332
  });
327
333
  }
328
- export { S as NotificationTopicsPage };
334
+ export { w as NotificationTopicsPage };
329
335
 
330
336
  //# sourceMappingURL=NotificationTopicsPage.js.map