@burdenoff/microfe-notification 2026.1029.2 → 2026.1109.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 (218) hide show
  1. package/dist/AdminNotificationRoot.d.ts +33 -0
  2. package/dist/AdminNotificationRoot.js +9 -6
  3. package/dist/AdminNotificationRoot.js.map +1 -1
  4. package/dist/AdminNotificationRoutes.d.ts +1 -0
  5. package/dist/AdminNotificationRoutes.js +22 -23
  6. package/dist/AdminNotificationRoutes.js.map +1 -1
  7. package/dist/NotificationRoot.d.ts +29 -0
  8. package/dist/NotificationRoot.js +9 -6
  9. package/dist/NotificationRoot.js.map +1 -1
  10. package/dist/NotificationRoutes.d.ts +18 -0
  11. package/dist/NotificationRoutes.js +1 -2
  12. package/dist/NotificationRoutes.js.map +1 -1
  13. package/dist/UserNotificationRoot.d.ts +32 -0
  14. package/dist/UserNotificationRoot.js +9 -6
  15. package/dist/UserNotificationRoot.js.map +1 -1
  16. package/dist/UserNotificationRoutes.d.ts +16 -0
  17. package/dist/UserNotificationRoutes.js +9 -10
  18. package/dist/UserNotificationRoutes.js.map +1 -1
  19. package/dist/components/FeatureDisabledPage.d.ts +6 -0
  20. package/dist/components/FeatureDisabledPage.js +1 -2
  21. package/dist/components/FeatureDisabledPage.js.map +1 -1
  22. package/dist/components/NotificationBell.d.ts +13 -0
  23. package/dist/components/NotificationBell.js +6 -7
  24. package/dist/components/NotificationBell.js.map +1 -1
  25. package/dist/components/NotificationCard.d.ts +18 -0
  26. package/dist/components/NotificationCard.js +10 -11
  27. package/dist/components/NotificationCard.js.map +1 -1
  28. package/dist/components/NotificationPanel.d.ts +10 -0
  29. package/dist/components/NotificationPanel.js +5 -6
  30. package/dist/components/NotificationPanel.js.map +1 -1
  31. package/dist/components/RecipientSelector.d.ts +32 -0
  32. package/dist/components/RecipientSelector.js +2 -3
  33. package/dist/components/RecipientSelector.js.map +1 -1
  34. package/dist/components/TemplatePreview.d.ts +21 -0
  35. package/dist/components/TemplatePreview.js +3 -4
  36. package/dist/components/TemplatePreview.js.map +1 -1
  37. package/dist/components/VariableInserter.d.ts +11 -0
  38. package/dist/components/index.d.ts +3 -0
  39. package/dist/components/index.js +4 -3
  40. package/dist/constants/permissions.d.ts +23 -0
  41. package/dist/constants/permissions.js +1 -2
  42. package/dist/constants/permissions.js.map +1 -1
  43. package/dist/dev/main.d.ts +0 -0
  44. package/dist/generated/global-operations.d.ts +2119 -0
  45. package/dist/generated/global-operations.js +80 -69
  46. package/dist/generated/global-operations.js.map +1 -1
  47. package/dist/generated/global-types.d.ts +23507 -0
  48. package/dist/generated/wspace-operations.d.ts +4 -0
  49. package/dist/generated/wspace-types.d.ts +57831 -0
  50. package/dist/graphql/global-client.d.ts +32 -0
  51. package/dist/graphql/global-client.js +23 -30
  52. package/dist/graphql/global-client.js.map +1 -1
  53. package/dist/hooks/index.d.ts +7 -0
  54. package/dist/hooks/index.js +7 -6
  55. package/dist/hooks/useNotificationAdmin.d.ts +46 -0
  56. package/dist/hooks/useNotificationAdmin.js +18 -17
  57. package/dist/hooks/useNotificationAdmin.js.map +1 -1
  58. package/dist/hooks/useNotificationAnalytics.d.ts +65 -0
  59. package/dist/hooks/useNotificationAnalytics.js +1 -2
  60. package/dist/hooks/useNotificationAnalytics.js.map +1 -1
  61. package/dist/hooks/useNotificationPreferences.d.ts +10 -0
  62. package/dist/hooks/useNotificationPreferences.js +7 -7
  63. package/dist/hooks/useNotificationPreferences.js.map +1 -1
  64. package/dist/hooks/useNotificationTemplates.d.ts +131 -0
  65. package/dist/hooks/useNotificationTemplates.js +1 -2
  66. package/dist/hooks/useNotificationTemplates.js.map +1 -1
  67. package/dist/hooks/useNotificationTopics.d.ts +35 -0
  68. package/dist/hooks/useNotificationTopics.js +22 -22
  69. package/dist/hooks/useNotificationTopics.js.map +1 -1
  70. package/dist/hooks/useNotifications.d.ts +39 -0
  71. package/dist/hooks/useNotifications.js +6 -4
  72. package/dist/hooks/useNotifications.js.map +1 -1
  73. package/dist/hooks/useSendNotification.d.ts +158 -0
  74. package/dist/hooks/useSendNotification.js +12 -10
  75. package/dist/hooks/useSendNotification.js.map +1 -1
  76. package/dist/hooks/useUserSearch.d.ts +26 -0
  77. package/dist/hooks/useUserSearch.js +8 -10
  78. package/dist/hooks/useUserSearch.js.map +1 -1
  79. package/dist/index.d.ts +36 -0
  80. package/dist/index.js +8 -8
  81. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +1 -2
  82. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -1
  83. package/dist/node_modules/@apollo/client/errors/utils.js +1 -2
  84. package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -1
  85. package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +7 -8
  86. package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +1 -1
  87. package/dist/node_modules/@apollo/client/link/subscriptions/index.js +9 -10
  88. package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +1 -1
  89. package/dist/node_modules/@apollo/client/link/utils/createOperation.js +5 -6
  90. package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +1 -1
  91. package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -1
  92. package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +1 -1
  93. package/dist/node_modules/@apollo/client/utilities/graphql/print.js +4 -5
  94. package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +1 -1
  95. package/dist/node_modules/@apollo/client/utilities/internal/caches.js +1 -2
  96. package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +1 -1
  97. package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +1 -2
  98. package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +1 -1
  99. package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +2 -3
  100. package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +1 -1
  101. package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +1 -2
  102. package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +1 -1
  103. package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +1 -2
  104. package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +1 -1
  105. package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +1 -2
  106. package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +1 -1
  107. package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +1 -2
  108. package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +1 -1
  109. package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +1 -2
  110. package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +1 -1
  111. package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +1 -2
  112. package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +1 -1
  113. package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +1 -2
  114. package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +1 -1
  115. package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +1 -2
  116. package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +1 -1
  117. package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +1 -2
  118. package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +1 -1
  119. package/dist/node_modules/@apollo/client/utilities/invariant/index.js +2 -3
  120. package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +1 -1
  121. package/dist/node_modules/@apollo/client/version.js +2 -3
  122. package/dist/node_modules/@apollo/client/version.js.map +1 -1
  123. package/dist/node_modules/@wry/caches/lib/weak.js +1 -2
  124. package/dist/node_modules/@wry/caches/lib/weak.js.map +1 -1
  125. package/dist/node_modules/@wry/trie/lib/index.js +2 -3
  126. package/dist/node_modules/@wry/trie/lib/index.js.map +1 -1
  127. package/dist/node_modules/graphql-ws/dist/client.js +76 -69
  128. package/dist/node_modules/graphql-ws/dist/client.js.map +1 -1
  129. package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +2 -3
  130. package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +1 -1
  131. package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +2 -3
  132. package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +1 -1
  133. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +41 -42
  134. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +1 -1
  135. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +14 -15
  136. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +1 -1
  137. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +21 -18
  138. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +1 -1
  139. package/dist/node_modules/rxjs/dist/esm5/internal/config.js +1 -2
  140. package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +1 -1
  141. package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +1 -2
  142. package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +1 -1
  143. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +2 -3
  144. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +1 -1
  145. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +1 -2
  146. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +1 -1
  147. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +1 -2
  148. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +1 -1
  149. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +1 -2
  150. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +1 -1
  151. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +1 -2
  152. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +1 -1
  153. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +1 -2
  154. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +1 -1
  155. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +1 -2
  156. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +1 -1
  157. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +1 -2
  158. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +1 -1
  159. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +1 -2
  160. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +1 -1
  161. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +1 -2
  162. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +1 -1
  163. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +1 -2
  164. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +1 -1
  165. package/dist/node_modules/{rxjs/node_modules/tslib → tslib}/tslib.es6.js +1 -2
  166. package/dist/node_modules/tslib/tslib.es6.js.map +1 -0
  167. package/dist/pages/CreateNotificationPage.d.ts +5 -0
  168. package/dist/pages/CreateNotificationPage.js +18 -19
  169. package/dist/pages/CreateNotificationPage.js.map +1 -1
  170. package/dist/pages/NotificationCenterPage.d.ts +6 -0
  171. package/dist/pages/NotificationCenterPage.js +13 -14
  172. package/dist/pages/NotificationCenterPage.js.map +1 -1
  173. package/dist/pages/NotificationHistoryAdminPage.d.ts +2 -0
  174. package/dist/pages/NotificationHistoryAdminPage.js +7 -8
  175. package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
  176. package/dist/pages/NotificationHistoryPage.d.ts +2 -0
  177. package/dist/pages/NotificationHistoryPage.js +13 -14
  178. package/dist/pages/NotificationHistoryPage.js.map +1 -1
  179. package/dist/pages/NotificationLandingPage.d.ts +10 -0
  180. package/dist/pages/NotificationLandingPage.js +5 -6
  181. package/dist/pages/NotificationLandingPage.js.map +1 -1
  182. package/dist/pages/NotificationPreferencesPage.d.ts +1 -0
  183. package/dist/pages/NotificationPreferencesPage.js +14 -15
  184. package/dist/pages/NotificationPreferencesPage.js.map +1 -1
  185. package/dist/pages/NotificationTemplatesPage.d.ts +7 -0
  186. package/dist/pages/NotificationTemplatesPage.js +25 -23
  187. package/dist/pages/NotificationTemplatesPage.js.map +1 -1
  188. package/dist/pages/NotificationTopicsPage.d.ts +1 -0
  189. package/dist/pages/NotificationTopicsPage.js +6 -7
  190. package/dist/pages/NotificationTopicsPage.js.map +1 -1
  191. package/dist/pages/TemplateEditorPage.d.ts +12 -0
  192. package/dist/pages/TemplateEditorPage.js +294 -285
  193. package/dist/pages/TemplateEditorPage.js.map +1 -1
  194. package/dist/providers/NotificationProvider.d.ts +11 -0
  195. package/dist/providers/NotificationProvider.js +1 -2
  196. package/dist/providers/NotificationProvider.js.map +1 -1
  197. package/dist/shared/hooks/useTr.d.ts +13 -0
  198. package/dist/shared/hooks/useTr.js +1 -2
  199. package/dist/shared/hooks/useTr.js.map +1 -1
  200. package/dist/store/notificationStore.d.ts +30 -0
  201. package/dist/store/notificationStore.js +1 -2
  202. package/dist/store/notificationStore.js.map +1 -1
  203. package/dist/test/happydom.d.ts +1 -0
  204. package/dist/translations/en.d.ts +468 -0
  205. package/dist/types/index.d.ts +249 -0
  206. package/dist/utils/inAppNavigation.d.ts +37 -0
  207. package/dist/utils/inAppNavigation.js +2 -3
  208. package/dist/utils/inAppNavigation.js.map +1 -1
  209. package/dist/utils/index.d.ts +68 -0
  210. package/dist/utils/index.js +1 -2
  211. package/dist/utils/index.js.map +1 -1
  212. package/dist/utils/nativeBridge.d.ts +2 -0
  213. package/dist/utils/nativeBridge.js +1 -2
  214. package/dist/utils/notificationHistoryExport.d.ts +12 -0
  215. package/dist/utils/notificationHistoryExport.js +1 -2
  216. package/dist/utils/notificationHistoryExport.js.map +1 -1
  217. package/package.json +66 -48
  218. package/dist/node_modules/rxjs/node_modules/tslib/tslib.es6.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationTopicsPage.js","names":[],"sources":["../../src/pages/NotificationTopicsPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Plus, Save, Search, Trash2 } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\n\nconst topicTypeOptions = [\n { value: 'MARKETING', labelKey: 'notifications.topicType.marketing', label: 'Marketing' },\n {\n value: 'TRANSACTIONAL',\n labelKey: 'notifications.topicType.transactional',\n label: 'Transactional',\n },\n { value: 'SYSTEM', labelKey: 'notifications.topicType.system', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.topicType.alert', label: 'Alert' },\n];\n\nfunction slugify(value: string) {\n return value\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9\\s-]/g, '')\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-');\n}\n\nexport function NotificationTopicsPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { topics, isLoading, isForbidden, createTopic, updateTopic, deleteTopic } =\n useNotificationTopics();\n const [search, setSearch] = useState('');\n const [editingId, setEditingId] = useState<string | null>(null);\n const [form, setForm] = useState({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n\n // Topics live under the `notification` resource type in the backend (see\n // `global-notification-svc/src/modules/notification/schema/mutations.gql`),\n // and create/update/delete all require `notification:create` per the\n // @rbac directive. SUPER_ADMIN bypass is inherited from PermissionProvider.\n const canManage = hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_CREATE);\n\n const filteredTopics = useMemo(() => {\n if (!search.trim()) {\n return topics;\n }\n\n const query = search.toLowerCase();\n return topics.filter(\n (topic) =>\n topic.name.toLowerCase().includes(query) ||\n topic.slug.toLowerCase().includes(query) ||\n topic.description?.toLowerCase().includes(query)\n );\n }, [search, topics]);\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!canManage) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionTopics',\n \"You don't have permission to manage notification topics.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-4 sm:p-6\">\n <div>\n <h1 className=\"text-2xl font-bold text-primary\">\n {tr('notifications.topicsTitle', 'Notification Topics')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.topicsSubtitle',\n 'Create topics for campaigns so users can subscribe or unsubscribe with precision.'\n )}\n </p>\n </div>\n\n <PagePurpose icon={<Plus size={16} />}>\n {tr(\n 'notifications.topicsPurpose',\n '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.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"notification-topics\"\n steps={[\n {\n id: 'name-topic',\n label: tr('notifications.topicsNextNameLabel', 'Name your first topic'),\n description: tr(\n 'notifications.topicsNextNameDesc',\n 'Use the form to add a clear topic like \"Product updates\" — the slug is generated for you.'\n ),\n onClick: () => {\n setEditingId(null);\n setForm((prev) => ({ ...prev, name: '', slug: '', type: 'MARKETING' }));\n document\n .getElementById('notification-topic-name')\n ?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n document.getElementById('notification-topic-name')?.focus();\n },\n },\n {\n id: 'set-type',\n label: tr('notifications.topicsNextTypeLabel', 'Pick the right type'),\n description: tr(\n 'notifications.topicsNextTypeDesc',\n 'Marketing topics are opt-in for users; Transactional, System and Alert reach everyone.'\n ),\n onClick: () =>\n document\n .getElementById('notification-topic-type')\n ?.scrollIntoView({ behavior: 'smooth', block: 'center' }),\n },\n {\n id: 'let-subscribe',\n label: tr('notifications.topicsNextSubscribeLabel', 'Let people subscribe'),\n description: tr(\n 'notifications.topicsNextSubscribeDesc',\n 'Once a topic is active, users manage their own opt-ins from the Preferences page.'\n ),\n href: '../preferences',\n },\n ]}\n />\n\n <div className=\"grid gap-6 xl:grid-cols-[380px,1fr]\">\n {/* Single emphasis zone — the create/edit form is the primary action on this page. */}\n <EmphasisPanel className=\"p-4\">\n <form\n className=\"space-y-4\"\n onSubmit={async (event) => {\n event.preventDefault();\n\n if (!form.name.trim() || !form.slug.trim()) {\n return;\n }\n\n if (editingId) {\n await updateTopic(editingId, form);\n } else {\n await createTopic(form);\n }\n\n setEditingId(null);\n setForm({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n }}\n >\n <div className=\"flex items-center gap-2\">\n <Plus size={18} className=\"text-accent-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {editingId\n ? tr('notifications.editTopic', 'Edit Topic')\n : tr('notifications.createTopic', 'Create Topic')}\n </h2>\n </div>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicName', 'Name')}</span>\n <input\n id=\"notification-topic-name\"\n type=\"text\"\n value={form.name}\n onChange={(event) =>\n setForm((prev) => ({\n ...prev,\n name: event.target.value,\n slug: editingId ? prev.slug : slugify(event.target.value),\n }))\n }\n 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\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicSlug', 'Slug')}</span>\n <input\n type=\"text\"\n value={form.slug}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, slug: slugify(event.target.value) }))\n }\n 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\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicType', 'Type')}</span>\n <select\n id=\"notification-topic-type\"\n value={form.type}\n onChange={(event) => setForm((prev) => ({ ...prev, type: event.target.value }))}\n 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\"\n >\n {topicTypeOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicDescription', 'Description')}</span>\n <textarea\n value={form.description}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, description: event.target.value }))\n }\n rows={4}\n 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\"\n />\n </label>\n\n <label className=\"flex items-center gap-2 text-sm text-secondary\">\n <input\n type=\"checkbox\"\n checked={form.isActive}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, isActive: event.target.checked }))\n }\n />\n <span>{tr('notifications.topicIsActive', 'Active topic')}</span>\n </label>\n\n <div className=\"flex items-center gap-3\">\n <button\n type=\"submit\"\n 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\"\n >\n <Save size={16} />\n {editingId\n ? tr('notifications.saveTopic', 'Save Topic')\n : tr('notifications.createTopicButton', 'Create Topic')}\n </button>\n\n {editingId && (\n <button\n type=\"button\"\n onClick={() => {\n setEditingId(null);\n setForm({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n }}\n className=\"rounded-md border border-default px-4 py-2 text-sm text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.cancelTopicEdit', 'Cancel')}\n </button>\n )}\n </div>\n </form>\n </EmphasisPanel>\n\n <GlassCard treatment=\"plain\" className=\"space-y-4 border-border-seam p-4\">\n <div className=\"relative max-w-md\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={search}\n onChange={(event) => setSearch(event.target.value)}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n 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\"\n />\n </div>\n\n <div className=\"space-y-3\">\n {isLoading ? (\n <div className=\"text-sm text-secondary\">\n {tr('notifications.loadingTopics', 'Loading topics...')}\n </div>\n ) : isForbidden ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title={tr(\n 'notifications.topicsNoAccessTitle',\n \"You don't have access to notification topics\"\n )}\n description={tr(\n 'notifications.topicsNoAccessDescription',\n \"Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.\"\n )}\n />\n ) : filteredTopics.length === 0 ? (\n <IllustratedEmptyState\n illustration={search.trim() ? 'empty-search' : 'empty-data'}\n title={tr('notifications.noTopicsFound', 'No topics found.')}\n description={\n search.trim()\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.noTopicsYet',\n 'No notification topics have been created yet.'\n )\n }\n />\n ) : (\n filteredTopics.map((topic) => (\n <div\n key={topic.id}\n 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\"\n >\n <div className=\"space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h3 className=\"text-sm font-semibold text-primary\">{topic.name}</h3>\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {topic.slug}\n </span>\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {topic.type}\n </span>\n </div>\n {topic.description && (\n <p className=\"text-sm text-secondary\">{topic.description}</p>\n )}\n <p className=\"text-xs text-tertiary\">\n {tr('notifications.topicSubscribers', 'Subscribers')}: {topic.subscriberCount}\n </p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => {\n setEditingId(topic.id);\n setForm({\n name: topic.name,\n slug: topic.slug,\n description: topic.description || '',\n type: topic.type,\n isActive: topic.isActive,\n });\n }}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.edit', 'Edit')}\n </button>\n <button\n type=\"button\"\n onClick={() => deleteTopic(topic.id)}\n 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\"\n >\n <Trash2 size={14} />\n {tr('notifications.delete', 'Delete')}\n </button>\n </div>\n </div>\n ))\n )}\n </div>\n </GlassCard>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAcA,IAAM,IAAmB;CACvB;EAAE,OAAO;EAAa,UAAU;EAAqC,OAAO;EAAa;CACzF;EACE,OAAO;EACP,UAAU;EACV,OAAO;EACR;CACD;EAAE,OAAO;EAAU,UAAU;EAAkC,OAAO;EAAU;CAChF;EAAE,OAAO;EAAS,UAAU;EAAiC,OAAO;EAAS;CAC9E;AAED,SAAS,EAAQ,GAAe;AAC9B,QAAO,EACJ,aAAa,CACb,MAAM,CACN,QAAQ,iBAAiB,GAAG,CAC5B,QAAQ,QAAQ,IAAI,CACpB,QAAQ,OAAO,IAAI;;AAGxB,SAAgB,IAAyB;CACvC,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,WAAQ,cAAW,gBAAa,gBAAa,gBAAa,mBAChE,GAAuB,EACnB,CAAC,GAAQ,KAAa,EAAS,GA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QAAD;YAAM,WAAU;sBACb,EAAM;YACF,CAAA;WACH;;SACL,EAAM,eACL,kBAAC,KAAD;UAAG,WAAU;oBAA0B,EAAM;UAAgB,CAAA;SAE/D,kBAAC,KAAD;UAAG,WAAU;oBAAb;WACG,EAAG,kCAAkC,cAAc;WAAC;WAAG,EAAM;WAC5D;;SACA;WAEN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,UAAD;SACE,MAAK;SACL,eAAe;AAEb,UADA,EAAa,EAAM,GAAG,EACtB,EAAQ;WACN,MAAM,EAAM;WACZ,MAAM,EAAM;WACZ,aAAa,EAAM,eAAe;WAClC,MAAM,EAAM;WACZ,UAAU,EAAM;WACjB,CAAC;;SAEJ,WAAU;mBAET,EAAG,sBAAsB,OAAO;SAC1B,CAAA,EACT,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAY,EAAM,GAAG;SACpC,WAAU;mBAHZ,CAKE,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA,EACnB,EAAG,wBAAwB,SAAS,CAC9B;WACL;UACF;SA/CC,EAAM,GA+CP,CACN;MAEA,CAAA,CACI;OACR;;GACF;MArTJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,oCACA,2DACD;EACG,CAAA"}
1
+ {"version":3,"file":"NotificationTopicsPage.js","names":["topicTypeOptions","slugify","value","NotificationTopicsPage","tr","useTr","permissionsLoading","usePermissions","useNotificationTopics","search","setSearch","useState","editingId","setEditingId","form","setForm","canManage","hasPermission","NOTIFICATION_PERMISSIONS","filteredTopics","useMemo","topics","query","topic","PagePurpose","Plus","NextSteps","prev","EmphasisPanel","event","updateTopic","createTopic","option","Save","GlassCard","Search","isLoading","isForbidden","IllustratedEmptyState","deleteTopic","Trash2"],"sources":["../../src/pages/NotificationTopicsPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Plus, Save, Search, Trash2 } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\n\nconst topicTypeOptions = [\n { value: 'MARKETING', labelKey: 'notifications.topicType.marketing', label: 'Marketing' },\n {\n value: 'TRANSACTIONAL',\n labelKey: 'notifications.topicType.transactional',\n label: 'Transactional',\n },\n { value: 'SYSTEM', labelKey: 'notifications.topicType.system', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.topicType.alert', label: 'Alert' },\n];\n\nfunction slugify(value: string) {\n return value\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9\\s-]/g, '')\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-');\n}\n\nexport function NotificationTopicsPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { topics, isLoading, isForbidden, createTopic, updateTopic, deleteTopic } =\n useNotificationTopics();\n const [search, setSearch] = useState('');\n const [editingId, setEditingId] = useState<string | null>(null);\n const [form, setForm] = useState({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n\n // Topics live under the `notification` resource type in the backend (see\n // `global-notification-svc/src/modules/notification/schema/mutations.gql`),\n // and create/update/delete all require `notification:create` per the\n // @rbac directive. SUPER_ADMIN bypass is inherited from PermissionProvider.\n const canManage = hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_CREATE);\n\n const filteredTopics = useMemo(() => {\n if (!search.trim()) {\n return topics;\n }\n\n const query = search.toLowerCase();\n return topics.filter(\n (topic) =>\n topic.name.toLowerCase().includes(query) ||\n topic.slug.toLowerCase().includes(query) ||\n topic.description?.toLowerCase().includes(query)\n );\n }, [search, topics]);\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!canManage) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionTopics',\n \"You don't have permission to manage notification topics.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-4 sm:p-6\">\n <div>\n <h1 className=\"text-2xl font-bold text-primary\">\n {tr('notifications.topicsTitle', 'Notification Topics')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.topicsSubtitle',\n 'Create topics for campaigns so users can subscribe or unsubscribe with precision.'\n )}\n </p>\n </div>\n\n <PagePurpose icon={<Plus size={16} />}>\n {tr(\n 'notifications.topicsPurpose',\n '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.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"notification-topics\"\n steps={[\n {\n id: 'name-topic',\n label: tr('notifications.topicsNextNameLabel', 'Name your first topic'),\n description: tr(\n 'notifications.topicsNextNameDesc',\n 'Use the form to add a clear topic like \"Product updates\" — the slug is generated for you.'\n ),\n onClick: () => {\n setEditingId(null);\n setForm((prev) => ({ ...prev, name: '', slug: '', type: 'MARKETING' }));\n document\n .getElementById('notification-topic-name')\n ?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n document.getElementById('notification-topic-name')?.focus();\n },\n },\n {\n id: 'set-type',\n label: tr('notifications.topicsNextTypeLabel', 'Pick the right type'),\n description: tr(\n 'notifications.topicsNextTypeDesc',\n 'Marketing topics are opt-in for users; Transactional, System and Alert reach everyone.'\n ),\n onClick: () =>\n document\n .getElementById('notification-topic-type')\n ?.scrollIntoView({ behavior: 'smooth', block: 'center' }),\n },\n {\n id: 'let-subscribe',\n label: tr('notifications.topicsNextSubscribeLabel', 'Let people subscribe'),\n description: tr(\n 'notifications.topicsNextSubscribeDesc',\n 'Once a topic is active, users manage their own opt-ins from the Preferences page.'\n ),\n href: '../preferences',\n },\n ]}\n />\n\n <div className=\"grid gap-6 xl:grid-cols-[380px,1fr]\">\n {/* Single emphasis zone — the create/edit form is the primary action on this page. */}\n <EmphasisPanel className=\"p-4\">\n <form\n className=\"space-y-4\"\n onSubmit={async (event) => {\n event.preventDefault();\n\n if (!form.name.trim() || !form.slug.trim()) {\n return;\n }\n\n if (editingId) {\n await updateTopic(editingId, form);\n } else {\n await createTopic(form);\n }\n\n setEditingId(null);\n setForm({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n }}\n >\n <div className=\"flex items-center gap-2\">\n <Plus size={18} className=\"text-accent-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {editingId\n ? tr('notifications.editTopic', 'Edit Topic')\n : tr('notifications.createTopic', 'Create Topic')}\n </h2>\n </div>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicName', 'Name')}</span>\n <input\n id=\"notification-topic-name\"\n type=\"text\"\n value={form.name}\n onChange={(event) =>\n setForm((prev) => ({\n ...prev,\n name: event.target.value,\n slug: editingId ? prev.slug : slugify(event.target.value),\n }))\n }\n 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\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicSlug', 'Slug')}</span>\n <input\n type=\"text\"\n value={form.slug}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, slug: slugify(event.target.value) }))\n }\n 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\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicType', 'Type')}</span>\n <select\n id=\"notification-topic-type\"\n value={form.type}\n onChange={(event) => setForm((prev) => ({ ...prev, type: event.target.value }))}\n 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\"\n >\n {topicTypeOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n </label>\n\n <label className=\"block space-y-1 text-sm text-secondary\">\n <span>{tr('notifications.topicDescription', 'Description')}</span>\n <textarea\n value={form.description}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, description: event.target.value }))\n }\n rows={4}\n 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\"\n />\n </label>\n\n <label className=\"flex items-center gap-2 text-sm text-secondary\">\n <input\n type=\"checkbox\"\n checked={form.isActive}\n onChange={(event) =>\n setForm((prev) => ({ ...prev, isActive: event.target.checked }))\n }\n />\n <span>{tr('notifications.topicIsActive', 'Active topic')}</span>\n </label>\n\n <div className=\"flex items-center gap-3\">\n <button\n type=\"submit\"\n 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\"\n >\n <Save size={16} />\n {editingId\n ? tr('notifications.saveTopic', 'Save Topic')\n : tr('notifications.createTopicButton', 'Create Topic')}\n </button>\n\n {editingId && (\n <button\n type=\"button\"\n onClick={() => {\n setEditingId(null);\n setForm({\n name: '',\n slug: '',\n description: '',\n type: 'MARKETING',\n isActive: true,\n });\n }}\n className=\"rounded-md border border-default px-4 py-2 text-sm text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.cancelTopicEdit', 'Cancel')}\n </button>\n )}\n </div>\n </form>\n </EmphasisPanel>\n\n <GlassCard treatment=\"plain\" className=\"space-y-4 border-border-seam p-4\">\n <div className=\"relative max-w-md\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={search}\n onChange={(event) => setSearch(event.target.value)}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n 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\"\n />\n </div>\n\n <div className=\"space-y-3\">\n {isLoading ? (\n <div className=\"text-sm text-secondary\">\n {tr('notifications.loadingTopics', 'Loading topics...')}\n </div>\n ) : isForbidden ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title={tr(\n 'notifications.topicsNoAccessTitle',\n \"You don't have access to notification topics\"\n )}\n description={tr(\n 'notifications.topicsNoAccessDescription',\n \"Your role doesn't include permission to read notification topics. Ask a workspace admin if you need access.\"\n )}\n />\n ) : filteredTopics.length === 0 ? (\n <IllustratedEmptyState\n illustration={search.trim() ? 'empty-search' : 'empty-data'}\n title={tr('notifications.noTopicsFound', 'No topics found.')}\n description={\n search.trim()\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.noTopicsYet',\n 'No notification topics have been created yet.'\n )\n }\n />\n ) : (\n filteredTopics.map((topic) => (\n <div\n key={topic.id}\n 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\"\n >\n <div className=\"space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h3 className=\"text-sm font-semibold text-primary\">{topic.name}</h3>\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {topic.slug}\n </span>\n <span className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {topic.type}\n </span>\n </div>\n {topic.description && (\n <p className=\"text-sm text-secondary\">{topic.description}</p>\n )}\n <p className=\"text-xs text-tertiary\">\n {tr('notifications.topicSubscribers', 'Subscribers')}: {topic.subscriberCount}\n </p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => {\n setEditingId(topic.id);\n setForm({\n name: topic.name,\n slug: topic.slug,\n description: topic.description || '',\n type: topic.type,\n isActive: topic.isActive,\n });\n }}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.edit', 'Edit')}\n </button>\n <button\n type=\"button\"\n onClick={() => deleteTopic(topic.id)}\n 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\"\n >\n <Trash2 size={14} />\n {tr('notifications.delete', 'Delete')}\n </button>\n </div>\n </div>\n ))\n )}\n </div>\n </GlassCard>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAcA,IAAMA,IAAmB;CACvB;EAAE,OAAO;EAAa,UAAU;EAAqC,OAAO;CAAY;CACxF;EACE,OAAO;EACP,UAAU;EACV,OAAO;CACT;CACA;EAAE,OAAO;EAAU,UAAU;EAAkC,OAAO;CAAS;CAC/E;EAAE,OAAO;EAAS,UAAU;EAAiC,OAAO;CAAQ;AAC9E;AAEA,SAASC,EAAQ,GAAe;CAC9B,OAAOC,EACJ,YAAY,CAAC,CACb,KAAK,CAAC,CACN,QAAQ,iBAAiB,EAAE,CAAC,CAC5B,QAAQ,QAAQ,GAAG,CAAC,CACpB,QAAQ,OAAO,GAAG;AACvB;AAEA,SAAgBC,IAAyB;CACvC,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,WAAQ,cAAW,gBAAa,gBAAa,gBAAa,mBAChEC,EAAsB,GAClB,CAACC,GAAQC,KAAaC,EAAS,EAAE,GACjC,CAACC,GAAWC,KAAgBF,EAAwB,IAAI,GACxD,CAACG,GAAMC,KAAWJ,EAAS;EAC/B,MAAM;EACN,MAAM;EACN,aAAa;EACb,MAAM;EACN,UAAU;CACZ,CAAC,GAMKK,IAAYC,EAAcC,EAAyB,mBAAmB,GAEtEC,IAAiBC,QAAc;EACnC,IAAI,CAACX,EAAO,KAAK,GACf,OAAOY;EAGT,IAAMC,IAAQb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,kBAAC,MAAD;YAAI,WAAU;YAAsC,UAAAI,EAAM;WAAS,CAAA;WACnE,kBAAC,QAAD;YAAM,WAAU;YACb,UAAAA,EAAM;WACH,CAAA;WACN,kBAAC,QAAD;YAAM,WAAU;YACb,UAAAA,EAAM;WACH,CAAA;UACH;;SACJA,EAAM,eACL,kBAAC,KAAD;UAAG,WAAU;UAA0B,UAAAA,EAAM;SAAe,CAAA;SAE9D,kBAAC,KAAD;UAAG,WAAU;UAAb,UAAA;WACGnB,EAAG,kCAAkC,aAAa;WAAE;WAAGmB,EAAM;UAC7D;;QACA;OAEL,CAAA,GAAA,kBAAC,OAAD;QAAK,WAAU;QAAf,UAAA,CACE,kBAAC,UAAD;SACE,MAAK;SACL,eAAe;UAEb,AADAV,EAAaU,EAAM,EAAE,GACrBR,EAAQ;WACN,MAAMQ,EAAM;WACZ,MAAMA,EAAM;WACZ,aAAaA,EAAM,eAAe;WAClC,MAAMA,EAAM;WACZ,UAAUA,EAAM;UAClB,CAAC;SACH;SACA,WAAU;SAET,UAAAnB,EAAG,sBAAsB,MAAM;QAC1B,CAAA,GACR,kBAAC,UAAD;SACE,MAAK;SACL,eAAemC,EAAYhB,EAAM,EAAE;SACnC,WAAU;SAHZ,UAAA,CAKE,kBAACiB,GAAD,EAAQ,MAAM,GAAK,CAAA,GAClBpC,EAAG,wBAAwB,QAAQ,CAC9B;QACL,CAAA,CAAA;OACF,CAAA,CAAA;MA/CE,GAAAmB,EAAM,EA+CR,CACN;KAEA,CAAA,CACI;IACR,CAAA,CAAA;;EACF;C,KArTH,kBAAC,OAAD;EAAK,WAAU;EACZ,UAAAnB,EACC,oCACA,0DACF;CACG,CAAA;AAkTX"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Template Editor Page — Novu-inspired split-pane editor
3
+ *
4
+ * Left panel: Form fields (basic info, content, variables)
5
+ * Right panel: Live preview with variable substitution
6
+ *
7
+ * Supports create and edit modes.
8
+ * Routes:
9
+ * /templates/new → create mode
10
+ * /templates/:slug → edit mode (loads via useNotificationTemplate)
11
+ */
12
+ export declare function TemplateEditorPage(): import('react').JSX.Element;