@burdenoff/microfe-notification 2026.830.1 → 2026.1012.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/AdminNotificationRoot.js +44 -42
- package/dist/AdminNotificationRoot.js.map +1 -1
- package/dist/AdminNotificationRoutes.js +65 -64
- package/dist/AdminNotificationRoutes.js.map +1 -1
- package/dist/NotificationRoot.js +1 -1
- package/dist/NotificationRoot.js.map +1 -1
- package/dist/UserNotificationRoot.js +1 -1
- package/dist/UserNotificationRoot.js.map +1 -1
- package/dist/UserNotificationRoutes.js +33 -32
- package/dist/UserNotificationRoutes.js.map +1 -1
- package/dist/components/NotificationCard.js +1 -1
- package/dist/components/NotificationCard.js.map +1 -1
- package/dist/components/TemplatePreview.js +3 -3
- package/dist/components/TemplatePreview.js.map +1 -1
- package/dist/pages/CreateNotificationPage.js +20 -8
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.js +61 -59
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +16 -11
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.js +5 -1
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/shared/hooks/useTr.js +3 -3
- package/dist/shared/hooks/useTr.js.map +1 -1
- package/dist/utils/index.js +18 -18
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -11,18 +11,22 @@ import { EmphasisPanel as f, GlassCard as p, IllustratedEmptyState as m, NextSte
|
|
|
11
11
|
var _ = [
|
|
12
12
|
{
|
|
13
13
|
value: "MARKETING",
|
|
14
|
+
labelKey: "notifications.topicType.marketing",
|
|
14
15
|
label: "Marketing"
|
|
15
16
|
},
|
|
16
17
|
{
|
|
17
18
|
value: "TRANSACTIONAL",
|
|
19
|
+
labelKey: "notifications.topicType.transactional",
|
|
18
20
|
label: "Transactional"
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
23
|
value: "SYSTEM",
|
|
24
|
+
labelKey: "notifications.topicType.system",
|
|
22
25
|
label: "System"
|
|
23
26
|
},
|
|
24
27
|
{
|
|
25
28
|
value: "ALERT",
|
|
29
|
+
labelKey: "notifications.topicType.alert",
|
|
26
30
|
label: "Alert"
|
|
27
31
|
}
|
|
28
32
|
];
|
|
@@ -158,7 +162,7 @@ function y() {
|
|
|
158
162
|
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",
|
|
159
163
|
children: _.map((e) => /* @__PURE__ */ u("option", {
|
|
160
164
|
value: e.value,
|
|
161
|
-
children: e.label
|
|
165
|
+
children: y(e.labelKey, e.label)
|
|
162
166
|
}, e.value))
|
|
163
167
|
})]
|
|
164
168
|
}),
|
|
@@ -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', label: 'Marketing' },\n { value: 'TRANSACTIONAL', label: 'Transactional' },\n { value: 'SYSTEM', label: 'System' },\n { value: '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, createTopic, updateTopic, deleteTopic } = 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\"\n >\n {topicTypeOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {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 ) : 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,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAiB,OAAO;EAAiB;CAClD;EAAE,OAAO;EAAU,OAAO;EAAU;CACpC;EAAE,OAAO;EAAS,OAAO;EAAS;CACnC;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,mBAAgB,GAAuB,EACtF,CAAC,GAAQ,K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A;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;MAzSJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,oCACA,2DACD;EACG,CAAA"}
|
|
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, createTopic, updateTopic, deleteTopic } = 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\"\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 ) : 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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CAIE,kBAAC,OAAD;QAAK,WAAU;kBAAf;SACE,kBAAC,OAAD;UAAK,WAAU;oBAAf;WACE,kBAAC,MAAD;YAAI,WAAU;sBAAsC,EAAM;YAAU,CAAA;WACpE,kBAAC,QAAD;YAAM,WAAU;sBACb,EAAM;YACF,CAAA;WACP,kBAAC,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;MAzSJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,oCACA,2DACD;EACG,CAAA"}
|
|
@@ -3,9 +3,9 @@ import { useI18n as t } from "@burdenoff/fe-libs/shared/providers/shell/I18nProv
|
|
|
3
3
|
//#region src/shared/hooks/useTr.ts
|
|
4
4
|
function n() {
|
|
5
5
|
let { t: n } = t();
|
|
6
|
-
return e((e, t) => {
|
|
7
|
-
let
|
|
8
|
-
return r
|
|
6
|
+
return e((e, t, r) => {
|
|
7
|
+
let i = n(e), a = i === e ? t : i;
|
|
8
|
+
return r ? Object.entries(r).reduce((e, [t, n]) => e.replace(RegExp(`\\{\\{${t}\\}\\}`, "g"), String(n)), a) : a;
|
|
9
9
|
}, [n]);
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTr.js","names":[],"sources":["../../../src/shared/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('notification.title', 'Notifications')}</h1>;\n */\nexport function useTr(): (key: string
|
|
1
|
+
{"version":3,"file":"useTr.js","names":[],"sources":["../../../src/shared/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('notification.title', 'Notifications')}</h1>;\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string {\n const { t } = useI18n();\n return useCallback(\n (key: string, fallback: string, params?: Record<string, string | number>): string => {\n const translated = t(key);\n const raw = translated === key ? fallback : translated;\n if (!params) return raw;\n return Object.entries(params).reduce(\n (str, [k, v]) => str.replace(new RegExp(`\\\\{\\\\{${k}\\\\}\\\\}`, 'g'), String(v)),\n raw\n );\n },\n [t]\n );\n}\n"],"mappings":";;;AAeA,SAAgB,IAIJ;CACV,IAAM,EAAE,SAAM,GAAS;AACvB,QAAO,GACJ,GAAa,GAAkB,MAAqD;EACnF,IAAM,IAAa,EAAE,EAAI,EACnB,IAAM,MAAe,IAAM,IAAW;AAE5C,SADK,IACE,OAAO,QAAQ,EAAO,CAAC,QAC3B,GAAK,CAAC,GAAG,OAAO,EAAI,QAAY,OAAO,SAAS,EAAE,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC,EAC5E,EACD,GAJmB;IAMtB,CAAC,EAAE,CACJ"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/utils/index.ts
|
|
2
|
-
function e(e) {
|
|
3
|
-
let
|
|
4
|
-
return
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = /* @__PURE__ */ new Date(), r = new Date(e), i = n.getTime() - r.getTime(), a = Math.floor(i / 1e3), o = Math.floor(a / 60), s = Math.floor(o / 60), c = Math.floor(s / 24);
|
|
4
|
+
return a < 60 ? t ? t("notifCommon.time.justNow", "just now") : "just now" : o < 60 ? o === 1 ? t ? t("notifCommon.time.minuteAgo", "a minute ago") : "a minute ago" : t ? t("notifCommon.time.minutesAgo", "{{count}} minutes ago", { count: o }) : `${o} minutes ago` : s < 24 ? s === 1 ? t ? t("notifCommon.time.hourAgo", "an hour ago") : "an hour ago" : t ? t("notifCommon.time.hoursAgo", "{{count}} hours ago", { count: s }) : `${s} hours ago` : c < 7 ? c === 1 ? t ? t("notifCommon.time.dayAgo", "a day ago") : "a day ago" : t ? t("notifCommon.time.daysAgo", "{{count}} days ago", { count: c }) : `${c} days ago` : r.toLocaleDateString();
|
|
5
5
|
}
|
|
6
6
|
function t(e) {
|
|
7
7
|
switch (e) {
|
|
@@ -60,23 +60,23 @@ function a(e, t) {
|
|
|
60
60
|
function o(e) {
|
|
61
61
|
return [...e].sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime());
|
|
62
62
|
}
|
|
63
|
-
function s(e) {
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
function s(e, t) {
|
|
64
|
+
let n = /* @__PURE__ */ new Date(), r = new Date(n.getFullYear(), n.getMonth(), n.getDate()), i = new Date(r);
|
|
65
|
+
i.setDate(i.getDate() - 1);
|
|
66
|
+
let a = new Date(r);
|
|
67
|
+
a.setDate(a.getDate() - a.getDay());
|
|
68
|
+
let o = t ? t("notifCommon.dateGroup.today", "Today") : "Today", s = t ? t("notifCommon.dateGroup.yesterday", "Yesterday") : "Yesterday", c = t ? t("notifCommon.dateGroup.thisWeek", "This Week") : "This Week", l = t ? t("notifCommon.dateGroup.earlier", "Earlier") : "Earlier", u = {
|
|
69
|
+
[o]: [],
|
|
70
|
+
[s]: [],
|
|
71
|
+
[c]: [],
|
|
72
|
+
[l]: []
|
|
73
73
|
};
|
|
74
74
|
return e.forEach((e) => {
|
|
75
|
-
let t = new Date(e.createdAt),
|
|
76
|
-
|
|
77
|
-
}), Object.keys(
|
|
78
|
-
|
|
79
|
-
}),
|
|
75
|
+
let t = new Date(e.createdAt), n = new Date(t.getFullYear(), t.getMonth(), t.getDate());
|
|
76
|
+
n.getTime() === r.getTime() ? u[o].push(e) : n.getTime() === i.getTime() ? u[s].push(e) : n >= a ? u[c].push(e) : u[l].push(e);
|
|
77
|
+
}), Object.keys(u).forEach((e) => {
|
|
78
|
+
u[e].length === 0 && delete u[e];
|
|
79
|
+
}), u;
|
|
80
80
|
}
|
|
81
81
|
function c(e, t) {
|
|
82
82
|
return e.length <= t ? e : e.slice(0, t) + "...";
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["import type {\n Notification,\n NotificationFilter,\n NotificationPriority,\n NotificationType,\n} from '../types';\n\n/**\n * Format a relative time string (e.g., \"2 minutes ago\", \"1 hour ago\")\n */\nexport function formatRelativeTime(date: string | Date): string {\n const now = new Date();\n const past = new Date(date);\n const diffInMs = now.getTime() - past.getTime();\n const diffInSeconds = Math.floor(diffInMs / 1000);\n const diffInMinutes = Math.floor(diffInSeconds / 60);\n const diffInHours = Math.floor(diffInMinutes / 60);\n const diffInDays = Math.floor(diffInHours / 24);\n\n if (diffInSeconds < 60) {\n return 'just now';\n } else if (diffInMinutes < 60) {\n return `${diffInMinutes} ${diffInMinutes === 1 ? 'minute' : 'minutes'} ago`;\n } else if (diffInHours < 24) {\n return `${diffInHours} ${diffInHours === 1 ? 'hour' : 'hours'} ago`;\n } else if (diffInDays < 7) {\n return `${diffInDays} ${diffInDays === 1 ? 'day' : 'days'} ago`;\n } else {\n return past.toLocaleDateString();\n }\n}\n\n/**\n * Get priority color class name (for use with semantic tokens)\n */\nexport function getPriorityColor(priority: NotificationPriority): string {\n switch (priority) {\n case 'URGENT':\n return 'text-error-500';\n case 'HIGH':\n return 'text-warning-500';\n case 'NORMAL':\n return 'text-info-500';\n case 'LOW':\n return 'text-text-secondary';\n default:\n return 'text-text-secondary';\n }\n}\n\n/**\n * Get priority icon/indicator\n */\nexport function getPriorityIcon(priority: NotificationPriority): string {\n switch (priority) {\n case 'URGENT':\n return '🔴';\n case 'HIGH':\n return '🟠';\n case 'NORMAL':\n return '🟢';\n case 'LOW':\n return '⚪';\n default:\n return '⚪';\n }\n}\n\n/**\n * Get notification type label\n */\nexport function getNotificationTypeLabel(type: NotificationType): string {\n switch (type) {\n case 'TRANSACTIONAL':\n return 'Transactional';\n case 'MARKETING':\n return 'Marketing';\n case 'SYSTEM':\n return 'System';\n case 'ALERT':\n return 'Alert';\n default:\n return 'Unknown';\n }\n}\n\n/**\n * Get notification type icon\n */\nexport function getNotificationTypeIcon(type: NotificationType): string {\n switch (type) {\n case 'TRANSACTIONAL':\n return '📧';\n case 'MARKETING':\n return '📢';\n case 'SYSTEM':\n return '⚙️';\n case 'ALERT':\n return '🚨';\n default:\n return '🔔';\n }\n}\n\n/**\n * Filter notifications based on criteria\n */\nexport function filterNotifications(\n notifications: Notification[],\n filter: NotificationFilter\n): Notification[] {\n return notifications.filter((notification) => {\n // Search filter\n if (filter.search) {\n const searchLower = filter.search.toLowerCase();\n const titleMatch = notification.title.toLowerCase().includes(searchLower);\n const bodyMatch = notification.body.toLowerCase().includes(searchLower);\n if (!titleMatch && !bodyMatch) return false;\n }\n\n // Type filter\n if (filter.type !== 'ALL' && notification.type !== filter.type) {\n return false;\n }\n\n // Status filter\n if (filter.status !== 'ALL' && notification.status !== filter.status) {\n return false;\n }\n\n // Priority filter\n if (filter.priority !== 'ALL' && notification.priority !== filter.priority) {\n return false;\n }\n\n // Read/Unread filter\n if (filter.isRead !== null) {\n const isRead = !!notification.readAt;\n if (filter.isRead !== isRead) return false;\n }\n\n // Date range filter\n if (filter.dateRange.start || filter.dateRange.end) {\n const notificationDate = new Date(notification.createdAt);\n if (filter.dateRange.start && notificationDate < filter.dateRange.start) {\n return false;\n }\n if (filter.dateRange.end && notificationDate > filter.dateRange.end) {\n return false;\n }\n }\n\n return true;\n });\n}\n\n/**\n * Sort notifications by created date (newest first)\n */\nexport function sortNotificationsByDate(notifications: Notification[]): Notification[] {\n return [...notifications].sort((a, b) => {\n return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();\n });\n}\n\n/**\n * Group notifications by date (Today, Yesterday, This Week, etc.)\n */\nexport function groupNotificationsByDate(\n notifications: Notification[]\n): Record<string, Notification[]> {\n const now = new Date();\n const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n const yesterday = new Date(today);\n yesterday.setDate(yesterday.getDate() - 1);\n const thisWeekStart = new Date(today);\n thisWeekStart.setDate(thisWeekStart.getDate() - thisWeekStart.getDay());\n\n const groups: Record<string, Notification[]> = {\n Today: [],\n Yesterday: [],\n 'This Week': [],\n Earlier: [],\n };\n\n notifications.forEach((notification) => {\n const notificationDate = new Date(notification.createdAt);\n const notificationDay = new Date(\n notificationDate.getFullYear(),\n notificationDate.getMonth(),\n notificationDate.getDate()\n );\n\n if (notificationDay.getTime() === today.getTime()) {\n groups.Today.push(notification);\n } else if (notificationDay.getTime() === yesterday.getTime()) {\n groups.Yesterday.push(notification);\n } else if (notificationDay >= thisWeekStart) {\n groups['This Week'].push(notification);\n } else {\n groups.Earlier.push(notification);\n }\n });\n\n // Remove empty groups\n Object.keys(groups).forEach((key) => {\n if (groups[key].length === 0) {\n delete groups[key];\n }\n });\n\n return groups;\n}\n\n/**\n * Truncate text to a maximum length\n */\nexport function truncateText(text: string, maxLength: number): string {\n if (text.length <= maxLength) return text;\n return text.slice(0, maxLength) + '...';\n}\n\n/**\n * Validate template variable substitution\n */\nexport function validateTemplateVariables(\n template: string,\n variables: Record<string, unknown>\n): { isValid: boolean; missingVariables: string[] } {\n const variableRegex = /\\{\\{([^}]+)\\}\\}/g;\n const matches = template.matchAll(variableRegex);\n const missingVariables: string[] = [];\n\n for (const match of matches) {\n const variableName = match[1].trim();\n if (!(variableName in variables)) {\n missingVariables.push(variableName);\n }\n }\n\n return {\n isValid: missingVariables.length === 0,\n missingVariables,\n };\n}\n\n/**\n * Substitute template variables\n */\nexport function substituteTemplateVariables(\n template: string,\n variables: Record<string, unknown>\n): string {\n return template.replace(/\\{\\{([^}]+)\\}\\}/g, (match, variableName) => {\n const trimmedName = variableName.trim();\n const value = variables[trimmedName];\n return value !== undefined ? String(value) : match;\n });\n}\n\n/**\n * Get delivery status color\n */\nexport function getDeliveryStatusColor(\n status: 'PENDING' | 'SENT' | 'DELIVERED' | 'FAILED' | 'ARCHIVED'\n): string {\n switch (status) {\n case 'DELIVERED':\n return 'text-success-500';\n case 'SENT':\n return 'text-info-500';\n case 'PENDING':\n return 'text-warning-500';\n case 'FAILED':\n return 'text-error-500';\n case 'ARCHIVED':\n return 'text-text-secondary';\n default:\n return 'text-text-secondary';\n }\n}\n\n/**\n * Calculate delivery rate percentage\n */\nexport function calculateDeliveryRate(delivered: number, total: number): number {\n if (total === 0) return 0;\n return Math.round((delivered / total) * 100);\n}\n\n/**\n * Check whether a mutation error represents a gateway-level authorization\n * failure (the RBAC gateway rejected the request because the actor lacks\n * the required permission). Callers surface these with a friendly toast and\n * refresh the permission cache to recover from stale client state.\n *\n * 401/UNAUTHENTICATED is handled separately by the shell's auth flow — this\n * helper intentionally ignores it.\n */\nexport function isPermissionError(err: unknown): boolean {\n if (!err) return false;\n\n type GqlErrorLike = { extensions?: Record<string, unknown> };\n\n const hasForbiddenCode = (errors: readonly GqlErrorLike[]): boolean => {\n for (const gqlErr of errors) {\n const code = typeof gqlErr.extensions?.code === 'string' ? gqlErr.extensions.code : '';\n const errorCode =\n typeof gqlErr.extensions?.errorCode === 'string' ? gqlErr.extensions.errorCode : '';\n if (code === 'FORBIDDEN' || errorCode === 'FORBIDDEN') return true;\n }\n return false;\n };\n\n // Apollo v3 shape: `err.graphQLErrors[]`. Apollo v4 (what `global-client.ts` targets): `err.errors[]`.\n // Check both so the structured signal works regardless of which Apollo major we're on.\n const v3 = (err as { graphQLErrors?: GqlErrorLike[] }).graphQLErrors;\n if (Array.isArray(v3) && hasForbiddenCode(v3)) return true;\n const v4 = (err as { errors?: GqlErrorLike[] }).errors;\n if (Array.isArray(v4) && hasForbiddenCode(v4)) return true;\n\n // Non-Apollo shapes (fetch-wrapped errors, custom throws) may hang extensions off the error itself.\n const extensionsLike = (err as { extensions?: Record<string, unknown> }).extensions;\n const codeFromExtensions = typeof extensionsLike?.code === 'string' ? extensionsLike.code : '';\n const errorCodeFromExtensions =\n typeof extensionsLike?.errorCode === 'string' ? extensionsLike.errorCode : '';\n if (codeFromExtensions === 'FORBIDDEN' || errorCodeFromExtensions === 'FORBIDDEN') return true;\n\n // Last-resort message substring match. Gated on the absence of any structured error payload so\n // a notification title / template body containing \"forbidden\" doesn't trigger a false positive.\n if (extensionsLike || Array.isArray(v3) || Array.isArray(v4)) return false;\n const messageFromError = (err as { message?: unknown }).message;\n const message = typeof messageFromError === 'string' ? messageFromError.toLowerCase() : '';\n return message.includes('forbidden') || message.includes('permission denied');\n}\n"],"mappings":";AAUA,SAAgB,EAAmB,GAA6B;CAC9D,IAAM,oBAAM,IAAI,MAAM,EAChB,IAAO,IAAI,KAAK,EAAK,EACrB,IAAW,EAAI,SAAS,GAAG,EAAK,SAAS,EACzC,IAAgB,KAAK,MAAM,IAAW,IAAK,EAC3C,IAAgB,KAAK,MAAM,IAAgB,GAAG,EAC9C,IAAc,KAAK,MAAM,IAAgB,GAAG,EAC5C,IAAa,KAAK,MAAM,IAAc,GAAG;AAW7C,QATE,IAAgB,KACX,aACE,IAAgB,KAClB,GAAG,EAAc,GAAG,MAAkB,IAAI,WAAW,UAAU,QAC7D,IAAc,KAChB,GAAG,EAAY,GAAG,MAAgB,IAAI,SAAS,QAAQ,QACrD,IAAa,IACf,GAAG,EAAW,GAAG,MAAe,IAAI,QAAQ,OAAO,QAEnD,EAAK,oBAAoB;;AAOpC,SAAgB,EAAiB,GAAwC;AACvE,SAAQ,GAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,QACE,QAAO;;;AAOb,SAAgB,EAAgB,GAAwC;AACtE,SAAQ,GAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,QACE,QAAO;;;AAOb,SAAgB,EAAyB,GAAgC;AACvE,SAAQ,GAAR;EACE,KAAK,gBACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,QACE,QAAO;;;AAOb,SAAgB,EAAwB,GAAgC;AACtE,SAAQ,GAAR;EACE,KAAK,gBACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,QACE,QAAO;;;AAOb,SAAgB,EACd,GACA,GACgB;AAChB,QAAO,EAAc,QAAQ,MAAiB;A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ACJ,OAAO,EAAO,YAAY,aAAc,WAAW,EAAO,WAAW,YAAY;AACnF,OAAI,MAAS,eAAe,MAAc,YAAa,QAAO;;AAEhE,SAAO;IAKH,IAAM,EAA2C;AACvD,KAAI,MAAM,QAAQ,EAAG,IAAI,EAAiB,EAAG,CAAE,QAAO;CACtD,IAAM,IAAM,EAAoC;AAChD,KAAI,MAAM,QAAQ,EAAG,IAAI,EAAiB,EAAG,CAAE,QAAO;CAGtD,IAAM,IAAkB,EAAiD,YACnE,IAAqB,OAAO,GAAgB,QAAS,WAAW,EAAe,OAAO,IACtF,IACJ,OAAO,GAAgB,aAAc,WAAW,EAAe,YAAY;AAC7E,KAAI,MAAuB,eAAe,MAA4B,YAAa,QAAO;AAI1F,KAAI,KAAkB,MAAM,QAAQ,EAAG,IAAI,MAAM,QAAQ,EAAG,CAAE,QAAO;CACrE,IAAM,IAAoB,EAA8B,SAClD,IAAU,OAAO,KAAqB,WAAW,EAAiB,aAAa,GAAG;AACxF,QAAO,EAAQ,SAAS,YAAY,IAAI,EAAQ,SAAS,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["import type {\n Notification,\n NotificationFilter,\n NotificationPriority,\n NotificationType,\n} from '../types';\n\n/**\n * Format a relative time string (e.g., \"2 minutes ago\", \"1 hour ago\").\n * Pass an optional `tr` translator to localize the units.\n */\nexport function formatRelativeTime(\n date: string | Date,\n tr?: (key: string, fallback: string, params?: Record<string, string | number>) => string\n): string {\n const now = new Date();\n const past = new Date(date);\n const diffInMs = now.getTime() - past.getTime();\n const diffInSeconds = Math.floor(diffInMs / 1000);\n const diffInMinutes = Math.floor(diffInSeconds / 60);\n const diffInHours = Math.floor(diffInMinutes / 60);\n const diffInDays = Math.floor(diffInHours / 24);\n\n if (diffInSeconds < 60) {\n return tr ? tr('notifCommon.time.justNow', 'just now') : 'just now';\n } else if (diffInMinutes < 60) {\n if (diffInMinutes === 1) {\n return tr ? tr('notifCommon.time.minuteAgo', 'a minute ago') : 'a minute ago';\n }\n return tr\n ? tr('notifCommon.time.minutesAgo', '{{count}} minutes ago', { count: diffInMinutes })\n : `${diffInMinutes} minutes ago`;\n } else if (diffInHours < 24) {\n if (diffInHours === 1) {\n return tr ? tr('notifCommon.time.hourAgo', 'an hour ago') : 'an hour ago';\n }\n return tr\n ? tr('notifCommon.time.hoursAgo', '{{count}} hours ago', { count: diffInHours })\n : `${diffInHours} hours ago`;\n } else if (diffInDays < 7) {\n if (diffInDays === 1) {\n return tr ? tr('notifCommon.time.dayAgo', 'a day ago') : 'a day ago';\n }\n return tr\n ? tr('notifCommon.time.daysAgo', '{{count}} days ago', { count: diffInDays })\n : `${diffInDays} days ago`;\n } else {\n return past.toLocaleDateString();\n }\n}\n\n/**\n * Get priority color class name (for use with semantic tokens)\n */\nexport function getPriorityColor(priority: NotificationPriority): string {\n switch (priority) {\n case 'URGENT':\n return 'text-error-500';\n case 'HIGH':\n return 'text-warning-500';\n case 'NORMAL':\n return 'text-info-500';\n case 'LOW':\n return 'text-text-secondary';\n default:\n return 'text-text-secondary';\n }\n}\n\n/**\n * Get priority icon/indicator\n */\nexport function getPriorityIcon(priority: NotificationPriority): string {\n switch (priority) {\n case 'URGENT':\n return '🔴';\n case 'HIGH':\n return '🟠';\n case 'NORMAL':\n return '🟢';\n case 'LOW':\n return '⚪';\n default:\n return '⚪';\n }\n}\n\n/**\n * Get notification type label\n */\nexport function getNotificationTypeLabel(type: NotificationType): string {\n switch (type) {\n case 'TRANSACTIONAL':\n return 'Transactional';\n case 'MARKETING':\n return 'Marketing';\n case 'SYSTEM':\n return 'System';\n case 'ALERT':\n return 'Alert';\n default:\n return 'Unknown';\n }\n}\n\n/**\n * Get notification type icon\n */\nexport function getNotificationTypeIcon(type: NotificationType): string {\n switch (type) {\n case 'TRANSACTIONAL':\n return '📧';\n case 'MARKETING':\n return '📢';\n case 'SYSTEM':\n return '⚙️';\n case 'ALERT':\n return '🚨';\n default:\n return '🔔';\n }\n}\n\n/**\n * Filter notifications based on criteria\n */\nexport function filterNotifications(\n notifications: Notification[],\n filter: NotificationFilter\n): Notification[] {\n return notifications.filter((notification) => {\n // Search filter\n if (filter.search) {\n const searchLower = filter.search.toLowerCase();\n const titleMatch = notification.title.toLowerCase().includes(searchLower);\n const bodyMatch = notification.body.toLowerCase().includes(searchLower);\n if (!titleMatch && !bodyMatch) return false;\n }\n\n // Type filter\n if (filter.type !== 'ALL' && notification.type !== filter.type) {\n return false;\n }\n\n // Status filter\n if (filter.status !== 'ALL' && notification.status !== filter.status) {\n return false;\n }\n\n // Priority filter\n if (filter.priority !== 'ALL' && notification.priority !== filter.priority) {\n return false;\n }\n\n // Read/Unread filter\n if (filter.isRead !== null) {\n const isRead = !!notification.readAt;\n if (filter.isRead !== isRead) return false;\n }\n\n // Date range filter\n if (filter.dateRange.start || filter.dateRange.end) {\n const notificationDate = new Date(notification.createdAt);\n if (filter.dateRange.start && notificationDate < filter.dateRange.start) {\n return false;\n }\n if (filter.dateRange.end && notificationDate > filter.dateRange.end) {\n return false;\n }\n }\n\n return true;\n });\n}\n\n/**\n * Sort notifications by created date (newest first)\n */\nexport function sortNotificationsByDate(notifications: Notification[]): Notification[] {\n return [...notifications].sort((a, b) => {\n return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();\n });\n}\n\n/**\n * Group notifications by date (Today, Yesterday, This Week, etc.).\n * Pass an optional `tr` translator to localize the group labels.\n */\nexport function groupNotificationsByDate(\n notifications: Notification[],\n tr?: (key: string, fallback: string) => string\n): Record<string, Notification[]> {\n const now = new Date();\n const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n const yesterday = new Date(today);\n yesterday.setDate(yesterday.getDate() - 1);\n const thisWeekStart = new Date(today);\n thisWeekStart.setDate(thisWeekStart.getDate() - thisWeekStart.getDay());\n\n const labelToday = tr ? tr('notifCommon.dateGroup.today', 'Today') : 'Today';\n const labelYesterday = tr ? tr('notifCommon.dateGroup.yesterday', 'Yesterday') : 'Yesterday';\n const labelThisWeek = tr ? tr('notifCommon.dateGroup.thisWeek', 'This Week') : 'This Week';\n const labelEarlier = tr ? tr('notifCommon.dateGroup.earlier', 'Earlier') : 'Earlier';\n\n const groups: Record<string, Notification[]> = {\n [labelToday]: [],\n [labelYesterday]: [],\n [labelThisWeek]: [],\n [labelEarlier]: [],\n };\n\n notifications.forEach((notification) => {\n const notificationDate = new Date(notification.createdAt);\n const notificationDay = new Date(\n notificationDate.getFullYear(),\n notificationDate.getMonth(),\n notificationDate.getDate()\n );\n\n if (notificationDay.getTime() === today.getTime()) {\n groups[labelToday].push(notification);\n } else if (notificationDay.getTime() === yesterday.getTime()) {\n groups[labelYesterday].push(notification);\n } else if (notificationDay >= thisWeekStart) {\n groups[labelThisWeek].push(notification);\n } else {\n groups[labelEarlier].push(notification);\n }\n });\n\n // Remove empty groups\n Object.keys(groups).forEach((key) => {\n if (groups[key].length === 0) {\n delete groups[key];\n }\n });\n\n return groups;\n}\n\n/**\n * Truncate text to a maximum length\n */\nexport function truncateText(text: string, maxLength: number): string {\n if (text.length <= maxLength) return text;\n return text.slice(0, maxLength) + '...';\n}\n\n/**\n * Validate template variable substitution\n */\nexport function validateTemplateVariables(\n template: string,\n variables: Record<string, unknown>\n): { isValid: boolean; missingVariables: string[] } {\n const variableRegex = /\\{\\{([^}]+)\\}\\}/g;\n const matches = template.matchAll(variableRegex);\n const missingVariables: string[] = [];\n\n for (const match of matches) {\n const variableName = match[1].trim();\n if (!(variableName in variables)) {\n missingVariables.push(variableName);\n }\n }\n\n return {\n isValid: missingVariables.length === 0,\n missingVariables,\n };\n}\n\n/**\n * Substitute template variables\n */\nexport function substituteTemplateVariables(\n template: string,\n variables: Record<string, unknown>\n): string {\n return template.replace(/\\{\\{([^}]+)\\}\\}/g, (match, variableName) => {\n const trimmedName = variableName.trim();\n const value = variables[trimmedName];\n return value !== undefined ? String(value) : match;\n });\n}\n\n/**\n * Get delivery status color\n */\nexport function getDeliveryStatusColor(\n status: 'PENDING' | 'SENT' | 'DELIVERED' | 'FAILED' | 'ARCHIVED'\n): string {\n switch (status) {\n case 'DELIVERED':\n return 'text-success-500';\n case 'SENT':\n return 'text-info-500';\n case 'PENDING':\n return 'text-warning-500';\n case 'FAILED':\n return 'text-error-500';\n case 'ARCHIVED':\n return 'text-text-secondary';\n default:\n return 'text-text-secondary';\n }\n}\n\n/**\n * Calculate delivery rate percentage\n */\nexport function calculateDeliveryRate(delivered: number, total: number): number {\n if (total === 0) return 0;\n return Math.round((delivered / total) * 100);\n}\n\n/**\n * Check whether a mutation error represents a gateway-level authorization\n * failure (the RBAC gateway rejected the request because the actor lacks\n * the required permission). Callers surface these with a friendly toast and\n * refresh the permission cache to recover from stale client state.\n *\n * 401/UNAUTHENTICATED is handled separately by the shell's auth flow — this\n * helper intentionally ignores it.\n */\nexport function isPermissionError(err: unknown): boolean {\n if (!err) return false;\n\n type GqlErrorLike = { extensions?: Record<string, unknown> };\n\n const hasForbiddenCode = (errors: readonly GqlErrorLike[]): boolean => {\n for (const gqlErr of errors) {\n const code = typeof gqlErr.extensions?.code === 'string' ? gqlErr.extensions.code : '';\n const errorCode =\n typeof gqlErr.extensions?.errorCode === 'string' ? gqlErr.extensions.errorCode : '';\n if (code === 'FORBIDDEN' || errorCode === 'FORBIDDEN') return true;\n }\n return false;\n };\n\n // Apollo v3 shape: `err.graphQLErrors[]`. Apollo v4 (what `global-client.ts` targets): `err.errors[]`.\n // Check both so the structured signal works regardless of which Apollo major we're on.\n const v3 = (err as { graphQLErrors?: GqlErrorLike[] }).graphQLErrors;\n if (Array.isArray(v3) && hasForbiddenCode(v3)) return true;\n const v4 = (err as { errors?: GqlErrorLike[] }).errors;\n if (Array.isArray(v4) && hasForbiddenCode(v4)) return true;\n\n // Non-Apollo shapes (fetch-wrapped errors, custom throws) may hang extensions off the error itself.\n const extensionsLike = (err as { extensions?: Record<string, unknown> }).extensions;\n const codeFromExtensions = typeof extensionsLike?.code === 'string' ? extensionsLike.code : '';\n const errorCodeFromExtensions =\n typeof extensionsLike?.errorCode === 'string' ? extensionsLike.errorCode : '';\n if (codeFromExtensions === 'FORBIDDEN' || errorCodeFromExtensions === 'FORBIDDEN') return true;\n\n // Last-resort message substring match. Gated on the absence of any structured error payload so\n // a notification title / template body containing \"forbidden\" doesn't trigger a false positive.\n if (extensionsLike || Array.isArray(v3) || Array.isArray(v4)) return false;\n const messageFromError = (err as { message?: unknown }).message;\n const message = typeof messageFromError === 'string' ? messageFromError.toLowerCase() : '';\n return message.includes('forbidden') || message.includes('permission denied');\n}\n"],"mappings":";AAWA,SAAgB,EACd,GACA,GACQ;CACR,IAAM,oBAAM,IAAI,MAAM,EAChB,IAAO,IAAI,KAAK,EAAK,EACrB,IAAW,EAAI,SAAS,GAAG,EAAK,SAAS,EACzC,IAAgB,KAAK,MAAM,IAAW,IAAK,EAC3C,IAAgB,KAAK,MAAM,IAAgB,GAAG,EAC9C,IAAc,KAAK,MAAM,IAAgB,GAAG,EAC5C,IAAa,KAAK,MAAM,IAAc,GAAG;AA0B7C,QAxBE,IAAgB,KACX,IAAK,EAAG,4BAA4B,WAAW,GAAG,aAChD,IAAgB,KACrB,MAAkB,IACb,IAAK,EAAG,8BAA8B,eAAe,GAAG,iBAE1D,IACH,EAAG,+BAA+B,yBAAyB,EAAE,OAAO,GAAe,CAAC,GACpF,GAAG,EAAc,gBACZ,IAAc,KACnB,MAAgB,IACX,IAAK,EAAG,4BAA4B,cAAc,GAAG,gBAEvD,IACH,EAAG,6BAA6B,uBAAuB,EAAE,OAAO,GAAa,CAAC,GAC9E,GAAG,EAAY,cACV,IAAa,IAClB,MAAe,IACV,IAAK,EAAG,2BAA2B,YAAY,GAAG,cAEpD,IACH,EAAG,4BAA4B,sBAAsB,EAAE,OAAO,GAAY,CAAC,GAC3E,GAAG,EAAW,aAEX,EAAK,oBAAoB;;AAOpC,SAAgB,EAAiB,GAAwC;AACvE,SAAQ,GAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,OACH,Q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AI1F,KAAI,KAAkB,MAAM,QAAQ,EAAG,IAAI,MAAM,QAAQ,EAAG,CAAE,QAAO;CACrE,IAAM,IAAoB,EAA8B,SAClD,IAAU,OAAO,KAAqB,WAAW,EAAiB,aAAa,GAAG;AACxF,QAAO,EAAQ,SAAS,YAAY,IAAI,EAAQ,SAAS,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-notification",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1012.1",
|
|
4
4
|
"description": "Notification microfrontend for multi-channel notification management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@apollo/client": "^4.0.9",
|
|
52
|
-
"@burdenoff/fe-libs": "2026.
|
|
52
|
+
"@burdenoff/fe-libs": "2026.1012.2",
|
|
53
53
|
"@types/lodash-es": "^4.17.12",
|
|
54
54
|
"graphql": "^16.12.0",
|
|
55
55
|
"graphql-ws": "^6.0.6",
|