@burdenoff/microfe-notification 2026.1118.1 → 2026.1120.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.
- package/dist/components/NotificationPanel.js +30 -24
- package/dist/components/NotificationPanel.js.map +1 -1
- package/dist/navigation-v2/NotificationArchivedV2.js +2 -1
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
- package/dist/navigation-v2/NotificationInboxV2.js +2 -1
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
- package/dist/pages/CreateNotificationPage.js +110 -109
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.js +49 -48
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +127 -122
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +35 -34
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.js +7 -2
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.js +142 -141
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.js +77 -74
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/pages/TemplateEditorPage.js +361 -361
- package/dist/pages/TemplateEditorPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationTemplatesPage.js","names":["useI18n","useI18n$1","TYPE_COLORS","TYPE_LABELS","formatDate","iso","locale","NotificationTemplatesPage","navigate","useNavigate","tr","useTr","paths","useNotificationPaths","navigationV2","useNavigationV2","pendingConfirm","setPendingConfirm","useState","confirmInPage","message","permissionsLoading","usePermissions","useNotificationTemplates","deletingId","setDeletingId","deleteError","setDeleteError","selectedTemplateIds","setSelectedTemplateIds","selectedTemplates","useMemo","templates","template","allVisibleSelected","partiallySelected","canCreateTemplate","hasPermission","NOTIFICATION_PERMISSIONS","canDeleteTemplate","handleDelete","nativeImpact","nativeResult","nativeConfirm","deleteTemplate","nativeNotify","err","handleBulkDelete","failed","r","toggleTemplateSelection","next","prev","checked","templateId","toggleAllTemplates","isLoading","Loader2","error","AlertCircle","refetch","RefreshCw","PagePurpose","FileText","EmphasisPanel","total","Button","Plus","NextSteps","updateFilter","Search","filter","GlassCard","input","event","isDeleting","Trash2","IllustratedEmptyState","e","hasMore","loadMore","ConfirmDeleteDialog"],"sources":["../../src/pages/NotificationTemplatesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { FileText, Plus, Search, Trash2, Loader2, AlertCircle, RefreshCw } from 'lucide-react';\nimport { useNavigate } from 'react-router';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTemplates } from '../hooks/useNotificationTemplates';\nimport type { BackendNotificationTemplate } from '../hooks/useNotificationTemplates';\nimport type { NotificationType } from '../types';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../utils/nativeBridge';\nimport { ConfirmDeleteDialog } from '../components/ConfirmDeleteDialog';\nimport { useNavigationV2, useNotificationPaths } from '../navigation-v2/paths';\n\n// ── Helpers ────────────────────────────────────────────────────────────\n\nconst TYPE_COLORS: Record<NotificationType, string> = {\n TRANSACTIONAL: 'text-status-info-text bg-status-info-bg-subtle border-status-info-bg-subtle',\n MARKETING: 'text-accent-purple bg-accent-purple-subtle border-accent-purple-subtle',\n SYSTEM: 'text-status-warning-text bg-status-warning-bg-subtle border-status-warning-bg-subtle',\n ALERT: 'text-status-error-text bg-status-error-bg-subtle border-status-error-bg-subtle',\n};\n\nconst TYPE_LABELS: Record<NotificationType, string> = {\n TRANSACTIONAL: 'Transactional',\n MARKETING: 'Marketing',\n SYSTEM: 'System',\n ALERT: 'Alert',\n};\n\nfunction formatDate(iso: string, locale?: string) {\n return new Date(iso).toLocaleDateString(locale || 'en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n });\n}\n\n// ── Component ──────────────────────────────────────────────────────────\n\n/**\n * Notification Templates Page (Admin)\n *\n * Lists all notification templates from the real backend.\n * Supports search, type filtering, delete, and navigation to editor.\n */\nexport function NotificationTemplatesPage() {\n const navigate = useNavigate();\n const tr = useTr();\n const paths = useNotificationPaths();\n const navigationV2 = useNavigationV2();\n // Navigation v2: the confirmation is the shared dialog, not window.confirm.\n const [pendingConfirm, setPendingConfirm] = useState<{\n title: string;\n message: string;\n resolve: (confirmed: boolean) => void;\n } | null>(null);\n const confirmInPage = (title: string, message: string): Promise<boolean> =>\n navigationV2\n ? new Promise((resolve) => setPendingConfirm({ title, message, resolve }))\n : Promise.resolve(window.confirm(message));\n const { locale } = useI18n();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const {\n templates,\n isLoading,\n isDeleting,\n error,\n total,\n hasMore,\n filter,\n refetch,\n loadMore,\n deleteTemplate,\n updateFilter,\n } = useNotificationTemplates();\n\n const [deletingId, setDeletingId] = useState<string | null>(null);\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [selectedTemplateIds, setSelectedTemplateIds] = useState<Set<string>>(new Set());\n\n const selectedTemplates = useMemo(\n () => templates.filter((template) => selectedTemplateIds.has(template.id)),\n [selectedTemplateIds, templates]\n );\n\n const allVisibleSelected =\n templates.length > 0 && templates.every((template) => selectedTemplateIds.has(template.id));\n const partiallySelected =\n templates.some((template) => selectedTemplateIds.has(template.id)) && !allVisibleSelected;\n\n const canCreateTemplate = hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_CREATE);\n const canDeleteTemplate = hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_DELETE);\n\n const handleDelete = async (e: React.MouseEvent, template: BackendNotificationTemplate) => {\n e.stopPropagation();\n nativeImpact('medium');\n const message = tr(\n 'notifTemplates.confirmDelete',\n `Delete template \"${template.name}\"? This cannot be undone.`\n );\n const nativeResult = await nativeConfirm({\n title: tr('notifTemplates.deleteTitle', 'Delete template'),\n message,\n okButtonTitle: tr('notifTemplates.delete', 'Delete'),\n });\n const confirmed =\n nativeResult === null\n ? await confirmInPage(tr('notifTemplates.deleteTitle', 'Delete template'), message)\n : nativeResult;\n if (!confirmed) return;\n\n setDeletingId(template.id);\n setDeleteError(null);\n try {\n await deleteTemplate(template.id);\n void nativeNotify('success');\n } catch (err: unknown) {\n void nativeNotify('error');\n setDeleteError(\n err instanceof Error\n ? err.message\n : tr('notifTemplates.deleteFailed', 'Failed to delete template')\n );\n } finally {\n setDeletingId(null);\n }\n };\n\n const handleBulkDelete = async () => {\n if (selectedTemplates.length === 0) return;\n nativeImpact('medium');\n const message = tr(\n 'notifTemplates.confirmBulkDelete',\n `Delete ${selectedTemplates.length} selected template${selectedTemplates.length === 1 ? '' : 's'}? This cannot be undone.`\n );\n const nativeResult = await nativeConfirm({\n title: tr('notifTemplates.bulkDeleteTitle', 'Delete templates'),\n message,\n okButtonTitle: tr('notifTemplates.delete', 'Delete'),\n });\n const confirmed =\n nativeResult === null\n ? await confirmInPage(tr('notifTemplates.bulkDeleteTitle', 'Delete templates'), message)\n : nativeResult;\n if (!confirmed) return;\n\n setDeleteError(null);\n const results = await Promise.allSettled(\n selectedTemplates.map((template) => deleteTemplate(template.id))\n );\n const failed = results.some((r) => r.status === 'rejected');\n void nativeNotify(failed ? 'error' : 'success');\n setSelectedTemplateIds(new Set());\n };\n\n const toggleTemplateSelection = (templateId: string, checked: boolean) => {\n setSelectedTemplateIds((prev) => {\n const next = new Set(prev);\n if (checked) {\n next.add(templateId);\n } else {\n next.delete(templateId);\n }\n return next;\n });\n };\n\n const toggleAllTemplates = (checked: boolean) => {\n setSelectedTemplateIds((prev) => {\n const next = new Set(prev);\n templates.forEach((template) => {\n if (checked) {\n next.add(template.id);\n } else {\n next.delete(template.id);\n }\n });\n return next;\n });\n };\n\n // ── Permission guards ────────────────────────────────────────────────\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n // TEMPLATE_LIST admits read-only admins; the page already hides/disables write actions for them.\n const canViewTemplates =\n hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_LIST) ||\n canCreateTemplate ||\n canDeleteTemplate ||\n hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_UPDATE);\n\n if (!canViewTemplates) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifTemplates.noPermissionView',\n \"You don't have permission to view notification templates.\"\n )}\n </div>\n );\n }\n\n // ── Loading state ────────────────────────────────────────────────────\n if (isLoading && templates.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center h-64 gap-3\">\n <Loader2 size={28} className=\"animate-spin text-accent-primary\" />\n <p className=\"text-sm text-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 <select\n value={filter.type || ''}\n onChange={(e) =>\n updateFilter({ type: (e.target.value || undefined) as NotificationType | undefined })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifTemplates.allTypes', 'All Types')}</option>\n <option value=\"TRANSACTIONAL\">\n {tr('notifTemplates.typeTransactional', 'Transactional')}\n </option>\n <option value=\"MARKETING\">{tr('notifTemplates.typeMarketing', 'Marketing')}</option>\n <option value=\"SYSTEM\">{tr('notifTemplates.typeSystem', 'System')}</option>\n <option value=\"ALERT\">{tr('notifTemplates.typeAlert', 'Alert')}</option>\n </select>\n </div>\n\n {templates.length > 0 && (\n <GlassCard\n treatment=\"plain\"\n className=\"flex flex-col gap-3 border-border-seam p-4 sm:flex-row sm:items-center sm:justify-between\"\n >\n <label className=\"flex items-center gap-2 text-sm text-primary\">\n <input\n type=\"checkbox\"\n checked={allVisibleSelected}\n ref={(input) => {\n if (input) {\n input.indeterminate = partiallySelected && !allVisibleSelected;\n }\n }}\n onChange={(event) => toggleAllTemplates(event.target.checked)}\n aria-label={tr(\n 'notifTemplates.selectAllVisibleAria',\n 'Select all notification templates'\n )}\n className=\"h-4 w-4 rounded border-default text-accent-primary\"\n />\n <span>{tr('notifTemplates.selectAllVisible', 'Select all visible')}</span>\n </label>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-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 />\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":";;;;;;;;;;;;;;AAwBA,IAAME,IAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;AACT,GAEMC,KAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;AACT;AAEA,SAASC,EAAW,GAAa,GAAiB;CAChD,OAAO,IAAI,KAAKC,CAAG,CAAC,CAAC,mBAAmBC,KAAU,SAAS;EACzD,OAAO;EACP,KAAK;EACL,MAAM;CACR,CAAC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AAD;SAAM,WAAWA,EAAS,UAAU,iBAAiB;SAClD,UAAAA,EAAS,UACNvB,EAAG,0BAA0B,SAAS,IACtCA,EAAG,2BAA2B,UAAU;QACxC,CAAA;OACH;;MAGL,kBAAC,KAAD;OAAG,WAAU;OAAb,UAAA;QACGA,EAAG,0BAA0B,SAAS;QAAE;QAAEN,EAAW6B,EAAS,WAAW3B,CAAM;OAC/E;;KACA;IAjFE,GAAA2B,EAAS,EAiFX,CACN;GACE,CAAA;GAGJ8C,KACC,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,UAAD;KACE,SAASC;KACT,UAAUxB;KACV,WAAU;KAHZ,UAAA,CAKGA,IAAY,kBAACC,GAAD;MAAS,MAAM;MAAI,WAAU;KAAgB,CAAA,IAAI,MAC7D/C,EAAG,2BAA2B,WAAW,CACpC;;GACL,CAAA;GAGNI,KACC,kBAACmE,GAAD;IACE,MAAMjE,MAAmB;IACzB,OAAOA,GAAgB,SAAS;IAChC,aAAaA,GAAgB,WAAW;IACxC,cAAcN,EAAG,yBAAyB,QAAQ;IAClD,gBAAgB;KAEd,AADAM,GAAgB,QAAQ,EAAK,GAC7BC,EAAkB,IAAI;IACxB;IACA,iBAAiB;KAEf,AADAD,GAAgB,QAAQ,EAAI,GAC5BC,EAAkB,IAAI;IACxB;GACD,CAAA;EAEA;C,KAxVH,kBAAC,OAAD;EAAK,WAAU;EACZ,UAAAP,EACC,mCACA,2DACF;CACG,CAAA;AAqVX"}
|
|
1
|
+
{"version":3,"file":"NotificationTemplatesPage.js","names":["useI18n","useI18n$1","TYPE_COLORS","TYPE_LABELS","formatDate","iso","locale","NotificationTemplatesPage","navigate","useNavigate","tr","useTr","paths","useNotificationPaths","navigationV2","useNavigationV2","pendingConfirm","setPendingConfirm","useState","confirmInPage","message","permissionsLoading","usePermissions","useNotificationTemplates","deletingId","setDeletingId","deleteError","setDeleteError","selectedTemplateIds","setSelectedTemplateIds","selectedTemplates","useMemo","templates","template","allVisibleSelected","partiallySelected","canCreateTemplate","hasPermission","NOTIFICATION_PERMISSIONS","canDeleteTemplate","handleDelete","nativeImpact","nativeResult","nativeConfirm","deleteTemplate","nativeNotify","err","handleBulkDelete","failed","r","toggleTemplateSelection","next","prev","checked","templateId","toggleAllTemplates","isLoading","Loader2","error","AlertCircle","refetch","RefreshCw","PagePurpose","FileText","EmphasisPanel","total","Button","Plus","NextSteps","updateFilter","Search","filter","ThemedSelect","GlassCard","input","event","isDeleting","Trash2","IllustratedEmptyState","e","hasMore","loadMore","ConfirmDeleteDialog"],"sources":["../../src/pages/NotificationTemplatesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { FileText, Plus, Search, Trash2, Loader2, AlertCircle, RefreshCw } from 'lucide-react';\nimport { useNavigate } from 'react-router';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n ThemedSelect,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTemplates } from '../hooks/useNotificationTemplates';\nimport type { BackendNotificationTemplate } from '../hooks/useNotificationTemplates';\nimport type { NotificationType } from '../types';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../utils/nativeBridge';\nimport { ConfirmDeleteDialog } from '../components/ConfirmDeleteDialog';\nimport { useNavigationV2, useNotificationPaths } from '../navigation-v2/paths';\n\n// ── Helpers ────────────────────────────────────────────────────────────\n\nconst TYPE_COLORS: Record<NotificationType, string> = {\n TRANSACTIONAL: 'text-status-info-text bg-status-info-bg-subtle border-status-info-bg-subtle',\n MARKETING: 'text-accent-purple bg-accent-purple-subtle border-accent-purple-subtle',\n SYSTEM: 'text-status-warning-text bg-status-warning-bg-subtle border-status-warning-bg-subtle',\n ALERT: 'text-status-error-text bg-status-error-bg-subtle border-status-error-bg-subtle',\n};\n\nconst TYPE_LABELS: Record<NotificationType, string> = {\n TRANSACTIONAL: 'Transactional',\n MARKETING: 'Marketing',\n SYSTEM: 'System',\n ALERT: 'Alert',\n};\n\nfunction formatDate(iso: string, locale?: string) {\n return new Date(iso).toLocaleDateString(locale || 'en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n });\n}\n\n// ── Component ──────────────────────────────────────────────────────────\n\n/**\n * Notification Templates Page (Admin)\n *\n * Lists all notification templates from the real backend.\n * Supports search, type filtering, delete, and navigation to editor.\n */\nexport function NotificationTemplatesPage() {\n const navigate = useNavigate();\n const tr = useTr();\n const paths = useNotificationPaths();\n const navigationV2 = useNavigationV2();\n // Navigation v2: the confirmation is the shared dialog, not window.confirm.\n const [pendingConfirm, setPendingConfirm] = useState<{\n title: string;\n message: string;\n resolve: (confirmed: boolean) => void;\n } | null>(null);\n const confirmInPage = (title: string, message: string): Promise<boolean> =>\n navigationV2\n ? new Promise((resolve) => setPendingConfirm({ title, message, resolve }))\n : Promise.resolve(window.confirm(message));\n const { locale } = useI18n();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const {\n templates,\n isLoading,\n isDeleting,\n error,\n total,\n hasMore,\n filter,\n refetch,\n loadMore,\n deleteTemplate,\n updateFilter,\n } = useNotificationTemplates();\n\n const [deletingId, setDeletingId] = useState<string | null>(null);\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [selectedTemplateIds, setSelectedTemplateIds] = useState<Set<string>>(new Set());\n\n const selectedTemplates = useMemo(\n () => templates.filter((template) => selectedTemplateIds.has(template.id)),\n [selectedTemplateIds, templates]\n );\n\n const allVisibleSelected =\n templates.length > 0 && templates.every((template) => selectedTemplateIds.has(template.id));\n const partiallySelected =\n templates.some((template) => selectedTemplateIds.has(template.id)) && !allVisibleSelected;\n\n const canCreateTemplate = hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_CREATE);\n const canDeleteTemplate = hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_DELETE);\n\n const handleDelete = async (e: React.MouseEvent, template: BackendNotificationTemplate) => {\n e.stopPropagation();\n nativeImpact('medium');\n const message = tr(\n 'notifTemplates.confirmDelete',\n `Delete template \"${template.name}\"? This cannot be undone.`\n );\n const nativeResult = await nativeConfirm({\n title: tr('notifTemplates.deleteTitle', 'Delete template'),\n message,\n okButtonTitle: tr('notifTemplates.delete', 'Delete'),\n });\n const confirmed =\n nativeResult === null\n ? await confirmInPage(tr('notifTemplates.deleteTitle', 'Delete template'), message)\n : nativeResult;\n if (!confirmed) return;\n\n setDeletingId(template.id);\n setDeleteError(null);\n try {\n await deleteTemplate(template.id);\n void nativeNotify('success');\n } catch (err: unknown) {\n void nativeNotify('error');\n setDeleteError(\n err instanceof Error\n ? err.message\n : tr('notifTemplates.deleteFailed', 'Failed to delete template')\n );\n } finally {\n setDeletingId(null);\n }\n };\n\n const handleBulkDelete = async () => {\n if (selectedTemplates.length === 0) return;\n nativeImpact('medium');\n const message = tr(\n 'notifTemplates.confirmBulkDelete',\n `Delete ${selectedTemplates.length} selected template${selectedTemplates.length === 1 ? '' : 's'}? This cannot be undone.`\n );\n const nativeResult = await nativeConfirm({\n title: tr('notifTemplates.bulkDeleteTitle', 'Delete templates'),\n message,\n okButtonTitle: tr('notifTemplates.delete', 'Delete'),\n });\n const confirmed =\n nativeResult === null\n ? await confirmInPage(tr('notifTemplates.bulkDeleteTitle', 'Delete templates'), message)\n : nativeResult;\n if (!confirmed) return;\n\n setDeleteError(null);\n const results = await Promise.allSettled(\n selectedTemplates.map((template) => deleteTemplate(template.id))\n );\n const failed = results.some((r) => r.status === 'rejected');\n void nativeNotify(failed ? 'error' : 'success');\n setSelectedTemplateIds(new Set());\n };\n\n const toggleTemplateSelection = (templateId: string, checked: boolean) => {\n setSelectedTemplateIds((prev) => {\n const next = new Set(prev);\n if (checked) {\n next.add(templateId);\n } else {\n next.delete(templateId);\n }\n return next;\n });\n };\n\n const toggleAllTemplates = (checked: boolean) => {\n setSelectedTemplateIds((prev) => {\n const next = new Set(prev);\n templates.forEach((template) => {\n if (checked) {\n next.add(template.id);\n } else {\n next.delete(template.id);\n }\n });\n return next;\n });\n };\n\n // ── Permission guards ────────────────────────────────────────────────\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n // TEMPLATE_LIST admits read-only admins; the page already hides/disables write actions for them.\n const canViewTemplates =\n hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_LIST) ||\n canCreateTemplate ||\n canDeleteTemplate ||\n hasPermission(NOTIFICATION_PERMISSIONS.TEMPLATE_UPDATE);\n\n if (!canViewTemplates) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifTemplates.noPermissionView',\n \"You don't have permission to view notification templates.\"\n )}\n </div>\n );\n }\n\n // ── Loading state ────────────────────────────────────────────────────\n if (isLoading && templates.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center h-64 gap-3\">\n <Loader2 size={28} className=\"animate-spin text-accent-primary\" />\n <p className=\"text-sm text-text-secondary\">\n {tr('notifTemplates.loading', 'Loading templates...')}\n </p>\n </div>\n );\n }\n\n // ── Error state ──────────────────────────────────────────────────────\n if (error && templates.length === 0) {\n return (\n <div className=\"flex flex-col items-center justify-center h-64 gap-4\">\n <AlertCircle size={28} className=\"text-error\" />\n <p className=\"text-sm text-error\">{error}</p>\n <button\n onClick={refetch}\n className=\"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-accent-primary hover:bg-accent-primary/90 rounded-lg transition-all duration-150\"\n >\n <RefreshCw size={14} />\n {tr('notifTemplates.retry', 'Retry')}\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<FileText size={16} />}>\n {tr(\n 'notifTemplates.purpose',\n 'Reusable, versioned message blueprints — subject lines, bodies and channel layouts with {{variables}} you fill in at send time. Build a template once (e.g. a welcome email or a payment receipt) and reuse it from the Send page so every notification stays on-brand and consistent.'\n )}\n </PagePurpose>\n\n {/* Header — single emphasis zone (count summary + the one create CTA). */}\n <EmphasisPanel className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\">\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifTemplates.title', 'Notification Templates')}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n {total} {tr('notifTemplates.templateCount', 'template')}\n {total !== 1 ? 's' : ''} {tr('notifTemplates.total', 'total')}\n </p>\n </div>\n\n {canCreateTemplate && (\n <Button onClick={() => navigate(paths.newTemplate)} className=\"gap-2\">\n <Plus size={16} />\n {tr('notifTemplates.createTemplate', 'Create Template')}\n </Button>\n )}\n </EmphasisPanel>\n\n <NextSteps\n storageKey=\"notification-templates\"\n steps={[\n ...(canCreateTemplate\n ? [\n {\n id: 'create-template',\n label: tr('notifTemplates.nextCreateLabel', 'Create your first template'),\n description: tr(\n 'notifTemplates.nextCreateDesc',\n 'Build a reusable message blueprint with {{variables}} you fill in at send time.'\n ),\n onClick: () => navigate(paths.newTemplate),\n },\n ]\n : []),\n {\n id: 'filter-type',\n label: tr('notifTemplates.nextFilterLabel', 'Filter by type'),\n description: tr(\n 'notifTemplates.nextFilterDesc',\n 'Narrow to Transactional, Marketing, System or Alert templates to find one fast.'\n ),\n onClick: () => updateFilter({ type: 'TRANSACTIONAL' }),\n },\n {\n id: 'use-on-send',\n label: tr('notifTemplates.nextUseLabel', 'Send with a template'),\n description: tr(\n 'notifTemplates.nextUseDesc',\n 'Pick any saved template from the Send page so every notification stays on-brand.'\n ),\n // Absolute: '../send' resolved to a page that does not exist\n // (BOFF-11872 §8 item 4); the Send page's route is `create`.\n href: paths.send,\n },\n ]}\n />\n\n {/* Search + Type filter row */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={filter.search || ''}\n onChange={(e) => updateFilter({ search: e.target.value })}\n placeholder={tr('notifTemplates.searchPlaceholder', 'Search templates...')}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n {/* Type filter */}\n <ThemedSelect\n value={filter.type || ''}\n onChange={(e) =>\n updateFilter({ type: (e.target.value || undefined) as NotificationType | undefined })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifTemplates.allTypes', 'All Types')}</option>\n <option value=\"TRANSACTIONAL\">\n {tr('notifTemplates.typeTransactional', 'Transactional')}\n </option>\n <option value=\"MARKETING\">{tr('notifTemplates.typeMarketing', 'Marketing')}</option>\n <option value=\"SYSTEM\">{tr('notifTemplates.typeSystem', 'System')}</option>\n <option value=\"ALERT\">{tr('notifTemplates.typeAlert', 'Alert')}</option>\n </ThemedSelect>\n </div>\n\n {templates.length > 0 && (\n <GlassCard\n treatment=\"plain\"\n className=\"flex flex-col gap-3 border-border-seam p-4 sm:flex-row sm:items-center sm:justify-between\"\n >\n <label className=\"flex items-center gap-2 text-sm text-primary\">\n <input\n type=\"checkbox\"\n checked={allVisibleSelected}\n ref={(input) => {\n if (input) {\n input.indeterminate = partiallySelected && !allVisibleSelected;\n }\n }}\n onChange={(event) => toggleAllTemplates(event.target.checked)}\n aria-label={tr(\n 'notifTemplates.selectAllVisibleAria',\n 'Select all notification templates'\n )}\n className=\"h-4 w-4 rounded border-default text-accent-primary\"\n />\n <span>{tr('notifTemplates.selectAllVisible', 'Select all visible')}</span>\n </label>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-text-secondary\">\n {selectedTemplateIds.size} {tr('notifTemplates.selected', 'selected')}\n </span>\n {selectedTemplateIds.size > 0 && (\n <button\n onClick={() => setSelectedTemplateIds(new Set())}\n className=\"text-sm text-text-secondary hover:text-primary\"\n >\n {tr('notifTemplates.clearSelection', 'Clear selection')}\n </button>\n )}\n {canDeleteTemplate && (\n <button\n onClick={handleBulkDelete}\n disabled={selectedTemplates.length === 0 || isDeleting}\n className=\"flex items-center gap-2 px-3 py-2 text-sm font-medium text-error border border-error/30 hover:bg-error/10 rounded-lg transition-all duration-150 disabled:opacity-50\"\n >\n <Trash2 size={14} />\n {tr('notifTemplates.deleteSelected', 'Delete Selected')}\n {selectedTemplates.length > 0 ? ` (${selectedTemplates.length})` : ''}\n </button>\n )}\n </div>\n </GlassCard>\n )}\n\n {/* Delete error banner */}\n {deleteError && (\n <div className=\"flex items-center gap-3 p-3 bg-error/10 border border-error/30 rounded-lg\">\n <AlertCircle size={16} className=\"text-error shrink-0\" />\n <p className=\"text-sm text-error\">{deleteError}</p>\n </div>\n )}\n\n {/* Empty state */}\n {templates.length === 0 && !isLoading && (\n <IllustratedEmptyState\n illustration={filter.search || filter.type ? 'empty-search' : 'empty-files'}\n title={\n filter.search || filter.type\n ? tr('notifTemplates.noMatchingTemplates', 'No templates match your filters')\n : tr('notifTemplates.noTemplatesYet', 'No templates yet. Create your first one!')\n }\n description={\n filter.search || filter.type\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifTemplates.noTemplatesDescription',\n 'Reusable templates let you send consistent notifications fast.'\n )\n }\n action={\n !filter.search && !filter.type && canCreateTemplate ? (\n <Button onClick={() => navigate(paths.newTemplate)} className=\"gap-2\">\n <Plus size={16} />\n {tr('notifTemplates.createTemplate', 'Create Template')}\n </Button>\n ) : undefined\n }\n kind={filter.search ? 'no-results' : filter.type ? 'filtered' : 'first-use'}\n />\n )}\n\n {/* Templates grid */}\n <div className=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {templates.map((template) => (\n <div\n key={template.id}\n onClick={() => navigate(paths.template(template.slug))}\n className={`group relative p-4 bg-gloss-card border rounded-lg cursor-pointer transition-[box-shadow,border-color] duration-200 hover:shadow-[var(--shadow-pop)] hover:border-accent-primary/30 ${selectedTemplateIds.has(template.id) ? 'border-accent-primary/50 ring-1 ring-accent-primary/20' : 'border-border-seam'}`}\n >\n {/* Top row: icon + type badge + delete */}\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-2\">\n <input\n type=\"checkbox\"\n checked={selectedTemplateIds.has(template.id)}\n onChange={(event) => {\n event.stopPropagation();\n toggleTemplateSelection(template.id, event.target.checked);\n }}\n onClick={(event) => event.stopPropagation()}\n aria-label={tr(\n 'notifTemplates.selectTemplateAria',\n 'Select template {{name}}'\n ).replace('{{name}}', template.name)}\n className=\"h-4 w-4 rounded border-default text-accent-primary\"\n />\n <FileText size={20} className=\"text-accent-primary\" />\n </div>\n <div className=\"flex items-center gap-2\">\n <span\n className={`px-2 py-0.5 text-[10px] font-semibold rounded-full border ${\n TYPE_COLORS[template.type as NotificationType] ||\n 'text-tertiary bg-bg-sunken border-default'\n }`}\n >\n {tr(\n `notifTemplates.type.${template.type as NotificationType}`,\n TYPE_LABELS[template.type as NotificationType] || template.type\n )}\n </span>\n {canDeleteTemplate && (\n <button\n onClick={(e) => handleDelete(e, template)}\n disabled={isDeleting && deletingId === template.id}\n className=\"opacity-0 group-hover:opacity-100 p-1 text-tertiary hover:text-error rounded transition-all duration-150\"\n title={tr('notifTemplates.deleteTemplate', 'Delete template')}\n >\n {isDeleting && deletingId === template.id ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Trash2 size={14} />\n )}\n </button>\n )}\n </div>\n </div>\n\n {/* Name */}\n <h3 className=\"text-sm font-semibold text-primary mb-1 truncate\">{template.name}</h3>\n\n {/* Description */}\n {template.description && (\n <p className=\"text-xs text-text-secondary mb-2 line-clamp-2\">\n {template.description}\n </p>\n )}\n\n {/* Bottom row: slug + enabled badge + locale */}\n <div className=\"flex items-center gap-2 text-[11px] text-tertiary mt-auto pt-2 border-t border-default/50\">\n <code className=\"px-1.5 py-0.5 bg-bg-sunken rounded text-[10px]\">\n {template.slug}\n </code>\n <span>•</span>\n <span>{template.locale || 'en'}</span>\n <span>•</span>\n <span className={template.enabled ? 'text-success' : 'text-tertiary'}>\n {template.enabled\n ? tr('notifTemplates.enabled', 'Enabled')\n : tr('notifTemplates.disabled', 'Disabled')}\n </span>\n </div>\n\n {/* Updated date */}\n <p className=\"text-[10px] text-tertiary mt-1.5\">\n {tr('notifTemplates.updated', 'Updated')} {formatDate(template.updatedAt, locale)}\n </p>\n </div>\n ))}\n </div>\n\n {/* Load more */}\n {hasMore && (\n <div className=\"flex justify-center pt-2\">\n <button\n onClick={loadMore}\n disabled={isLoading}\n className=\"flex items-center gap-2 px-4 py-2 text-sm text-text-secondary hover:text-primary border border-default rounded-lg transition-all duration-150 hover:shadow-sm\"\n >\n {isLoading ? <Loader2 size={14} className=\"animate-spin\" /> : null}\n {tr('notifTemplates.loadMore', 'Load More')}\n </button>\n </div>\n )}\n\n {navigationV2 && (\n <ConfirmDeleteDialog\n open={pendingConfirm !== null}\n title={pendingConfirm?.title ?? ''}\n description={pendingConfirm?.message ?? ''}\n confirmLabel={tr('notifTemplates.delete', 'Delete')}\n onCancel={() => {\n pendingConfirm?.resolve(false);\n setPendingConfirm(null);\n }}\n onConfirm={() => {\n pendingConfirm?.resolve(true);\n setPendingConfirm(null);\n }}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,IAAME,IAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;AACT,GAEMC,IAAgD;CACpD,eAAe;CACf,WAAW;CACX,QAAQ;CACR,OAAO;AACT;AAEA,SAASC,EAAW,GAAa,GAAiB;CAChD,OAAO,IAAI,K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,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"}
|
|
@@ -8,9 +8,9 @@ import { useMemo as a, useState as o } from "react";
|
|
|
8
8
|
import { usePermissions as s } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
9
9
|
import { Plus as c, Save as l, Search as u, Trash2 as d } from "lucide-react";
|
|
10
10
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
-
import { EmphasisPanel as m, GlassCard as h, IllustratedEmptyState as g, NextSteps as _, PagePurpose as v } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
import { EmphasisPanel as m, GlassCard as h, IllustratedEmptyState as g, NextSteps as _, PagePurpose as v, ThemedSelect as y } from "@burdenoff/fe-libs/ui";
|
|
12
12
|
// src/pages/NotificationTopicsPage.tsx
|
|
13
|
-
var
|
|
13
|
+
var b = [
|
|
14
14
|
{
|
|
15
15
|
value: "MARKETING",
|
|
16
16
|
labelKey: "notifications.topicType.marketing",
|
|
@@ -32,47 +32,47 @@ var y = [
|
|
|
32
32
|
label: "Alert"
|
|
33
33
|
}
|
|
34
34
|
];
|
|
35
|
-
function
|
|
35
|
+
function x(e) {
|
|
36
36
|
return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
let
|
|
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({
|
|
40
40
|
name: "",
|
|
41
41
|
slug: "",
|
|
42
42
|
description: "",
|
|
43
43
|
type: "MARKETING",
|
|
44
44
|
isActive: !0
|
|
45
|
-
}),
|
|
46
|
-
if (!
|
|
47
|
-
let e =
|
|
48
|
-
return
|
|
49
|
-
}, [
|
|
50
|
-
return
|
|
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
51
|
className: "flex h-64 items-center justify-center",
|
|
52
52
|
children: /* @__PURE__ */ f("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
53
|
-
}) :
|
|
53
|
+
}) : B ? /* @__PURE__ */ p("div", {
|
|
54
54
|
className: "space-y-6 p-4 sm:p-6",
|
|
55
55
|
children: [
|
|
56
56
|
/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", {
|
|
57
57
|
className: "text-2xl font-bold text-primary",
|
|
58
|
-
children:
|
|
58
|
+
children: S("notifications.topicsTitle", "Notification Topics")
|
|
59
59
|
}), /* @__PURE__ */ f("p", {
|
|
60
60
|
className: "mt-1 text-sm text-text-secondary",
|
|
61
|
-
children:
|
|
61
|
+
children: S("notifications.topicsSubtitle", "Create topics for campaigns so users can subscribe or unsubscribe with precision.")
|
|
62
62
|
})] }),
|
|
63
63
|
/* @__PURE__ */ f(v, {
|
|
64
64
|
icon: /* @__PURE__ */ f(c, { size: 16 }),
|
|
65
|
-
children:
|
|
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.")
|
|
66
66
|
}),
|
|
67
67
|
/* @__PURE__ */ f(_, {
|
|
68
68
|
storageKey: "notification-topics",
|
|
69
69
|
steps: [
|
|
70
70
|
{
|
|
71
71
|
id: "name-topic",
|
|
72
|
-
label:
|
|
73
|
-
description:
|
|
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."),
|
|
74
74
|
onClick: () => {
|
|
75
|
-
|
|
75
|
+
L(null), z((e) => ({
|
|
76
76
|
...e,
|
|
77
77
|
name: "",
|
|
78
78
|
slug: "",
|
|
@@ -85,8 +85,8 @@ function x() {
|
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
id: "set-type",
|
|
88
|
-
label:
|
|
89
|
-
description:
|
|
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."),
|
|
90
90
|
onClick: () => document.getElementById("notification-topic-type")?.scrollIntoView({
|
|
91
91
|
behavior: "smooth",
|
|
92
92
|
block: "center"
|
|
@@ -94,9 +94,9 @@ function x() {
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
id: "let-subscribe",
|
|
97
|
-
label:
|
|
98
|
-
description:
|
|
99
|
-
href:
|
|
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
|
|
100
100
|
}
|
|
101
101
|
]
|
|
102
102
|
}),
|
|
@@ -107,7 +107,7 @@ function x() {
|
|
|
107
107
|
children: /* @__PURE__ */ p("form", {
|
|
108
108
|
className: "space-y-4",
|
|
109
109
|
onSubmit: async (e) => {
|
|
110
|
-
e.preventDefault(),
|
|
110
|
+
e.preventDefault(), R.name.trim() && R.slug.trim() && (I ? await k(I, R) : await O(R), L(null), z({
|
|
111
111
|
name: "",
|
|
112
112
|
slug: "",
|
|
113
113
|
description: "",
|
|
@@ -123,56 +123,56 @@ function x() {
|
|
|
123
123
|
className: "text-accent-primary"
|
|
124
124
|
}), /* @__PURE__ */ f("h2", {
|
|
125
125
|
className: "text-base font-semibold text-primary",
|
|
126
|
-
children:
|
|
126
|
+
children: I ? S("notifications.editTopic", "Edit Topic") : S("notifications.createTopic", "Create Topic")
|
|
127
127
|
})]
|
|
128
128
|
}),
|
|
129
129
|
/* @__PURE__ */ p("label", {
|
|
130
130
|
className: "block space-y-1 text-sm text-text-secondary",
|
|
131
|
-
children: [/* @__PURE__ */ f("span", { children:
|
|
131
|
+
children: [/* @__PURE__ */ f("span", { children: S("notifications.topicName", "Name") }), /* @__PURE__ */ f("input", {
|
|
132
132
|
id: "notification-topic-name",
|
|
133
133
|
type: "text",
|
|
134
|
-
value:
|
|
135
|
-
onChange: (e) =>
|
|
134
|
+
value: R.name,
|
|
135
|
+
onChange: (e) => z((t) => ({
|
|
136
136
|
...t,
|
|
137
137
|
name: e.target.value,
|
|
138
|
-
slug:
|
|
138
|
+
slug: I ? t.slug : x(e.target.value)
|
|
139
139
|
})),
|
|
140
140
|
className: "w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent"
|
|
141
141
|
})]
|
|
142
142
|
}),
|
|
143
143
|
/* @__PURE__ */ p("label", {
|
|
144
144
|
className: "block space-y-1 text-sm text-text-secondary",
|
|
145
|
-
children: [/* @__PURE__ */ f("span", { children:
|
|
145
|
+
children: [/* @__PURE__ */ f("span", { children: S("notifications.topicSlug", "Slug") }), /* @__PURE__ */ f("input", {
|
|
146
146
|
type: "text",
|
|
147
|
-
value:
|
|
148
|
-
onChange: (e) =>
|
|
147
|
+
value: R.slug,
|
|
148
|
+
onChange: (e) => z((t) => ({
|
|
149
149
|
...t,
|
|
150
|
-
slug:
|
|
150
|
+
slug: x(e.target.value)
|
|
151
151
|
})),
|
|
152
152
|
className: "w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent"
|
|
153
153
|
})]
|
|
154
154
|
}),
|
|
155
155
|
/* @__PURE__ */ p("label", {
|
|
156
156
|
className: "block space-y-1 text-sm text-text-secondary",
|
|
157
|
-
children: [/* @__PURE__ */ f("span", { children:
|
|
157
|
+
children: [/* @__PURE__ */ f("span", { children: S("notifications.topicType", "Type") }), /* @__PURE__ */ f(y, {
|
|
158
158
|
id: "notification-topic-type",
|
|
159
|
-
value:
|
|
160
|
-
onChange: (e) =>
|
|
159
|
+
value: R.type,
|
|
160
|
+
onChange: (e) => z((t) => ({
|
|
161
161
|
...t,
|
|
162
162
|
type: e.target.value
|
|
163
163
|
})),
|
|
164
164
|
className: "w-full rounded-md border border-default bg-bg-canvas px-3 py-2 text-primary focus:outline-none focus:ring-2 focus:ring-accent scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
165
|
-
children:
|
|
165
|
+
children: b.map((e) => /* @__PURE__ */ f("option", {
|
|
166
166
|
value: e.value,
|
|
167
|
-
children:
|
|
167
|
+
children: S(e.labelKey, e.label)
|
|
168
168
|
}, e.value))
|
|
169
169
|
})]
|
|
170
170
|
}),
|
|
171
171
|
/* @__PURE__ */ p("label", {
|
|
172
172
|
className: "block space-y-1 text-sm text-text-secondary",
|
|
173
|
-
children: [/* @__PURE__ */ f("span", { children:
|
|
174
|
-
value:
|
|
175
|
-
onChange: (e) =>
|
|
173
|
+
children: [/* @__PURE__ */ f("span", { children: S("notifications.topicDescription", "Description") }), /* @__PURE__ */ f("textarea", {
|
|
174
|
+
value: R.description,
|
|
175
|
+
onChange: (e) => z((t) => ({
|
|
176
176
|
...t,
|
|
177
177
|
description: e.target.value
|
|
178
178
|
})),
|
|
@@ -184,23 +184,23 @@ function x() {
|
|
|
184
184
|
className: "flex items-center gap-2 text-sm text-text-secondary",
|
|
185
185
|
children: [/* @__PURE__ */ f("input", {
|
|
186
186
|
type: "checkbox",
|
|
187
|
-
checked:
|
|
188
|
-
onChange: (e) =>
|
|
187
|
+
checked: R.isActive,
|
|
188
|
+
onChange: (e) => z((t) => ({
|
|
189
189
|
...t,
|
|
190
190
|
isActive: e.target.checked
|
|
191
191
|
}))
|
|
192
|
-
}), /* @__PURE__ */ f("span", { children:
|
|
192
|
+
}), /* @__PURE__ */ f("span", { children: S("notifications.topicIsActive", "Active topic") })]
|
|
193
193
|
}),
|
|
194
194
|
/* @__PURE__ */ p("div", {
|
|
195
195
|
className: "flex items-center gap-3",
|
|
196
196
|
children: [/* @__PURE__ */ p("button", {
|
|
197
197
|
type: "submit",
|
|
198
198
|
className: "inline-flex items-center gap-2 rounded-md bg-accent-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90",
|
|
199
|
-
children: [/* @__PURE__ */ f(l, { size: 16 }),
|
|
200
|
-
}),
|
|
199
|
+
children: [/* @__PURE__ */ f(l, { size: 16 }), I ? S("notifications.saveTopic", "Save Topic") : S("notifications.createTopicButton", "Create Topic")]
|
|
200
|
+
}), I && /* @__PURE__ */ f("button", {
|
|
201
201
|
type: "button",
|
|
202
202
|
onClick: () => {
|
|
203
|
-
|
|
203
|
+
L(null), z({
|
|
204
204
|
name: "",
|
|
205
205
|
slug: "",
|
|
206
206
|
description: "",
|
|
@@ -209,7 +209,7 @@ function x() {
|
|
|
209
209
|
});
|
|
210
210
|
},
|
|
211
211
|
className: "rounded-md border border-default px-4 py-2 text-sm text-text-secondary hover:bg-bg-sunken",
|
|
212
|
-
children:
|
|
212
|
+
children: S("notifications.cancelTopicEdit", "Cancel")
|
|
213
213
|
})]
|
|
214
214
|
})
|
|
215
215
|
]
|
|
@@ -224,25 +224,28 @@ function x() {
|
|
|
224
224
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
225
225
|
}), /* @__PURE__ */ f("input", {
|
|
226
226
|
type: "text",
|
|
227
|
-
value:
|
|
228
|
-
onChange: (e) =>
|
|
229
|
-
placeholder:
|
|
227
|
+
value: M,
|
|
228
|
+
onChange: (e) => N(e.target.value),
|
|
229
|
+
placeholder: S("notifications.searchTopics", "Search topics..."),
|
|
230
230
|
className: "w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent"
|
|
231
231
|
})]
|
|
232
232
|
}), /* @__PURE__ */ f("div", {
|
|
233
233
|
className: "space-y-3",
|
|
234
|
-
children:
|
|
234
|
+
children: E ? /* @__PURE__ */ f("div", {
|
|
235
235
|
className: "text-sm text-text-secondary",
|
|
236
|
-
children:
|
|
237
|
-
}) :
|
|
236
|
+
children: S("notifications.loadingTopics", "Loading topics...")
|
|
237
|
+
}) : D ? /* @__PURE__ */ f(g, {
|
|
238
238
|
illustration: "empty-generic",
|
|
239
|
-
title:
|
|
240
|
-
description:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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."),
|
|
241
|
+
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",
|
|
247
|
+
glassIllustration: "notifications"
|
|
248
|
+
}) : V.map((e) => /* @__PURE__ */ p("div", {
|
|
246
249
|
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",
|
|
247
250
|
children: [/* @__PURE__ */ p("div", {
|
|
248
251
|
className: "space-y-1",
|
|
@@ -271,7 +274,7 @@ function x() {
|
|
|
271
274
|
/* @__PURE__ */ p("p", {
|
|
272
275
|
className: "text-xs text-tertiary",
|
|
273
276
|
children: [
|
|
274
|
-
|
|
277
|
+
S("notifications.topicSubscribers", "Subscribers"),
|
|
275
278
|
": ",
|
|
276
279
|
e.subscriberCount
|
|
277
280
|
]
|
|
@@ -282,7 +285,7 @@ function x() {
|
|
|
282
285
|
children: [/* @__PURE__ */ f("button", {
|
|
283
286
|
type: "button",
|
|
284
287
|
onClick: () => {
|
|
285
|
-
|
|
288
|
+
L(e.id), z({
|
|
286
289
|
name: e.name,
|
|
287
290
|
slug: e.slug,
|
|
288
291
|
description: e.description || "",
|
|
@@ -291,15 +294,15 @@ function x() {
|
|
|
291
294
|
});
|
|
292
295
|
},
|
|
293
296
|
className: "rounded-md border border-default px-3 py-2 text-sm text-text-secondary hover:bg-bg-sunken",
|
|
294
|
-
children:
|
|
297
|
+
children: S("notifications.edit", "Edit")
|
|
295
298
|
}), /* @__PURE__ */ p("button", {
|
|
296
299
|
type: "button",
|
|
297
|
-
onClick: () =>
|
|
300
|
+
onClick: () => F({
|
|
298
301
|
id: e.id,
|
|
299
302
|
name: e.name
|
|
300
303
|
}),
|
|
301
304
|
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",
|
|
302
|
-
children: [/* @__PURE__ */ f(d, { size: 14 }),
|
|
305
|
+
children: [/* @__PURE__ */ f(d, { size: 14 }), S("notifications.delete", "Delete")]
|
|
303
306
|
})]
|
|
304
307
|
})]
|
|
305
308
|
}, e.id))
|
|
@@ -307,21 +310,21 @@ function x() {
|
|
|
307
310
|
})]
|
|
308
311
|
}),
|
|
309
312
|
/* @__PURE__ */ f(r, {
|
|
310
|
-
open:
|
|
311
|
-
title:
|
|
312
|
-
description:
|
|
313
|
-
onCancel: () =>
|
|
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),
|
|
314
317
|
onConfirm: () => {
|
|
315
|
-
let e =
|
|
316
|
-
|
|
318
|
+
let e = P;
|
|
319
|
+
F(null), e && A(e.id);
|
|
317
320
|
}
|
|
318
321
|
})
|
|
319
322
|
]
|
|
320
323
|
}) : /* @__PURE__ */ f("div", {
|
|
321
324
|
className: "p-8 text-center text-text-secondary",
|
|
322
|
-
children:
|
|
325
|
+
children: S("notifications.noPermissionTopics", "You don't have permission to manage notification topics.")
|
|
323
326
|
});
|
|
324
327
|
}
|
|
325
|
-
export {
|
|
328
|
+
export { S as NotificationTopicsPage };
|
|
326
329
|
|
|
327
330
|
//# sourceMappingURL=NotificationTopicsPage.js.map
|