@burdenoff/microfe-notification 2026.424.101 → 2026.513.2
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/NotificationCard.d.ts.map +1 -1
- package/dist/components/NotificationCard.js +62 -57
- package/dist/components/NotificationCard.js.map +1 -1
- package/dist/generated/global-operations.d.ts +556 -8
- package/dist/generated/global-operations.d.ts.map +1 -1
- package/dist/generated/global-operations.js +198 -155
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +2907 -153
- package/dist/generated/global-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.d.ts +4605 -117
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/graphql/global-client.d.ts.map +1 -1
- package/dist/graphql/global-client.js +41 -23
- package/dist/graphql/global-client.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useNotificationAdmin.d.ts.map +1 -1
- package/dist/hooks/useNotificationPreferences.d.ts +12 -0
- package/dist/hooks/useNotificationPreferences.d.ts.map +1 -0
- package/dist/hooks/useNotificationPreferences.js +114 -0
- package/dist/hooks/useNotificationPreferences.js.map +1 -0
- package/dist/hooks/useNotifications.d.ts +6 -1
- package/dist/hooks/useNotifications.d.ts.map +1 -1
- package/dist/hooks/useNotifications.js +148 -99
- package/dist/hooks/useNotifications.js.map +1 -1
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +24 -0
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -0
- package/dist/node_modules/@apollo/client/errors/utils.js +16 -0
- package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -0
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +52 -0
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +1 -0
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js +41 -0
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +1 -0
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js +34 -0
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +6 -0
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js +16 -0
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js +19 -0
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +21 -0
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +17 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +9 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +9 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +8 -0
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +9 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +10 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +8 -0
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +10 -0
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +23 -0
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +10 -0
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +1 -0
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +57 -0
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +1 -0
- package/dist/node_modules/@apollo/client/version.js +6 -0
- package/dist/node_modules/@apollo/client/version.js.map +1 -0
- package/dist/node_modules/@wry/caches/lib/weak.js +67 -0
- package/dist/node_modules/@wry/caches/lib/weak.js.map +1 -0
- package/dist/node_modules/@wry/trie/lib/index.js +53 -0
- package/dist/node_modules/@wry/trie/lib/index.js.map +1 -0
- package/dist/node_modules/graphql-ws/dist/client.js +272 -0
- package/dist/node_modules/graphql-ws/dist/client.js.map +1 -0
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +62 -0
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +21 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +78 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +117 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +93 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +12 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +9 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +16 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +11 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +11 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +22 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +6 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +1 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +14 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +1 -0
- package/dist/node_modules/rxjs/node_modules/tslib/tslib.es6.js +52 -0
- package/dist/node_modules/rxjs/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/pages/CreateNotificationPage.d.ts.map +1 -1
- package/dist/pages/CreateNotificationPage.js +449 -448
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.d.ts.map +1 -1
- package/dist/pages/NotificationCenterPage.js +128 -123
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.d.ts.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +35 -37
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.d.ts.map +1 -1
- package/dist/pages/NotificationPreferencesPage.js +224 -79
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.d.ts.map +1 -1
- package/dist/pages/NotificationTemplatesPage.js +155 -141
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/providers/NotificationProvider.d.ts.map +1 -1
- package/dist/providers/NotificationProvider.js +6 -5
- package/dist/providers/NotificationProvider.js.map +1 -1
- package/dist/types/index.d.ts +36 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/nativeBridge.d.ts +3 -0
- package/dist/utils/nativeBridge.d.ts.map +1 -0
- package/dist/utils/nativeBridge.js +2 -0
- package/package.json +5 -3
|
@@ -6,51 +6,49 @@ import { useTr as r } from "../shared/hooks/useTr.js";
|
|
|
6
6
|
import { NotificationCard as i } from "../components/NotificationCard.js";
|
|
7
7
|
import { NOTIFICATION_PERMISSIONS as a } from "../constants/permissions.js";
|
|
8
8
|
import { exportNotificationsAsCsv as o } from "../utils/notificationHistoryExport.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
|
+
import { Archive as s, Download as c, Search as l } from "lucide-react";
|
|
10
|
+
import { usePermissions as u } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
13
12
|
//#region src/pages/NotificationHistoryPage.tsx
|
|
13
|
+
var p = {
|
|
14
|
+
archived: null,
|
|
15
|
+
channel: "ALL"
|
|
16
|
+
};
|
|
14
17
|
function m() {
|
|
15
|
-
let m = r(), { hasPermission: h, isLoading: g } =
|
|
16
|
-
return
|
|
17
|
-
x({
|
|
18
|
-
archived: null,
|
|
19
|
-
channel: "ALL"
|
|
20
|
-
});
|
|
21
|
-
}, [x]), g ? /* @__PURE__ */ f("div", {
|
|
18
|
+
let m = r(), { hasPermission: h, isLoading: g } = u(), { currentUser: _ } = e(), { topics: v } = n({ isActive: !0 }), { notifications: y, notificationFilter: b, updateFilter: x, archiveNotification: S, unarchiveNotification: C, recordAction: w } = t({ baseFilter: p });
|
|
19
|
+
return g ? /* @__PURE__ */ d("div", {
|
|
22
20
|
className: "flex h-64 items-center justify-center",
|
|
23
|
-
children: /* @__PURE__ */
|
|
24
|
-
}) : !h(a.NOTIFICATION_LIST) && !_?.id ? /* @__PURE__ */
|
|
21
|
+
children: /* @__PURE__ */ d("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
22
|
+
}) : !h(a.NOTIFICATION_LIST) && !_?.id ? /* @__PURE__ */ d("div", {
|
|
25
23
|
className: "p-8 text-center text-text-secondary",
|
|
26
24
|
children: m("notifications.noPermissionHistory", "You don't have permission to view notification history.")
|
|
27
|
-
}) : /* @__PURE__ */
|
|
25
|
+
}) : /* @__PURE__ */ f("div", {
|
|
28
26
|
className: "space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-300",
|
|
29
27
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ f("div", {
|
|
31
29
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
32
|
-
children: [/* @__PURE__ */
|
|
30
|
+
children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h1", {
|
|
33
31
|
className: "text-xl sm:text-2xl font-bold text-primary",
|
|
34
32
|
children: m("notifications.historyTitle", "Notification History")
|
|
35
|
-
}), /* @__PURE__ */
|
|
33
|
+
}), /* @__PURE__ */ d("p", {
|
|
36
34
|
className: "text-sm text-secondary mt-1",
|
|
37
35
|
children: m("notifications.historySubtitle", "View and search all your notifications")
|
|
38
|
-
})] }), /* @__PURE__ */
|
|
36
|
+
})] }), /* @__PURE__ */ f("button", {
|
|
39
37
|
onClick: () => o(m, y),
|
|
40
38
|
disabled: y.length === 0,
|
|
41
39
|
className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-accent-primary hover:text-accent-primary/80 border border-accent-primary hover:border-accent-primary/80 rounded-lg transition-all duration-150 hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",
|
|
42
|
-
children: [/* @__PURE__ */
|
|
40
|
+
children: [/* @__PURE__ */ d(c, { size: 16 }), m("notifications.export", "Export")]
|
|
43
41
|
})]
|
|
44
42
|
}),
|
|
45
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ f("div", {
|
|
46
44
|
className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-5",
|
|
47
45
|
children: [
|
|
48
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ f("div", {
|
|
49
47
|
className: "relative sm:col-span-2 xl:col-span-2",
|
|
50
|
-
children: [/* @__PURE__ */
|
|
48
|
+
children: [/* @__PURE__ */ d(l, {
|
|
51
49
|
size: 16,
|
|
52
50
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
53
|
-
}), /* @__PURE__ */
|
|
51
|
+
}), /* @__PURE__ */ d("input", {
|
|
54
52
|
type: "text",
|
|
55
53
|
placeholder: m("notifications.searchByTitleOrContent", "Search by title or content..."),
|
|
56
54
|
value: b.search,
|
|
@@ -58,19 +56,19 @@ function m() {
|
|
|
58
56
|
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"
|
|
59
57
|
})]
|
|
60
58
|
}),
|
|
61
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ f("select", {
|
|
62
60
|
value: b.topicId || "",
|
|
63
61
|
onChange: (e) => x({ topicId: e.target.value || void 0 }),
|
|
64
62
|
className: "rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary",
|
|
65
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ d("option", {
|
|
66
64
|
value: "",
|
|
67
65
|
children: m("notifications.allTopics", "All Topics")
|
|
68
|
-
}), v.map((e) => /* @__PURE__ */
|
|
66
|
+
}), v.map((e) => /* @__PURE__ */ d("option", {
|
|
69
67
|
value: e.id,
|
|
70
68
|
children: e.name
|
|
71
69
|
}, e.id))]
|
|
72
70
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ d("input", {
|
|
74
72
|
type: "date",
|
|
75
73
|
"aria-label": m("notifications.startDate", "Start date"),
|
|
76
74
|
value: b.dateRange.start ? b.dateRange.start.toISOString().split("T")[0] : "",
|
|
@@ -80,7 +78,7 @@ function m() {
|
|
|
80
78
|
} }),
|
|
81
79
|
className: "rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary"
|
|
82
80
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ d("input", {
|
|
84
82
|
type: "date",
|
|
85
83
|
"aria-label": m("notifications.endDate", "End date"),
|
|
86
84
|
value: b.dateRange.end ? b.dateRange.end.toISOString().split("T")[0] : "",
|
|
@@ -92,35 +90,35 @@ function m() {
|
|
|
92
90
|
})
|
|
93
91
|
]
|
|
94
92
|
}),
|
|
95
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ d("div", {
|
|
96
94
|
className: "space-y-2",
|
|
97
|
-
children: y.length > 0 ? y.map((e) => /* @__PURE__ */
|
|
95
|
+
children: y.length > 0 ? y.map((e) => /* @__PURE__ */ f("div", {
|
|
98
96
|
className: "space-y-2",
|
|
99
|
-
children: [/* @__PURE__ */
|
|
97
|
+
children: [/* @__PURE__ */ d(i, {
|
|
100
98
|
notification: e,
|
|
101
99
|
onArchive: S,
|
|
102
100
|
onAction: w,
|
|
103
101
|
showArchivedState: !0
|
|
104
|
-
}), e.archivedAt && /* @__PURE__ */
|
|
102
|
+
}), e.archivedAt && /* @__PURE__ */ d("div", {
|
|
105
103
|
className: "flex justify-end",
|
|
106
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ d("button", {
|
|
107
105
|
onClick: () => C(e.id),
|
|
108
106
|
className: "rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-muted",
|
|
109
107
|
children: m("notifications.restore", "Restore")
|
|
110
108
|
})
|
|
111
109
|
})]
|
|
112
|
-
}, e.id)) : /* @__PURE__ */
|
|
110
|
+
}, e.id)) : /* @__PURE__ */ f("div", {
|
|
113
111
|
className: "flex flex-col items-center justify-center py-12 text-center animate-in fade-in duration-300",
|
|
114
112
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ d(s, {
|
|
116
114
|
size: 48,
|
|
117
115
|
className: "text-tertiary mb-4"
|
|
118
116
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ d("h3", {
|
|
120
118
|
className: "text-lg font-semibold text-primary mb-2",
|
|
121
119
|
children: m("notifications.noNotificationsFound", "No notifications found")
|
|
122
120
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ d("p", {
|
|
124
122
|
className: "text-sm text-secondary",
|
|
125
123
|
children: m("notifications.adjustSearchOrDateRange", "Try adjusting your filters")
|
|
126
124
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationHistoryPage.js","names":[],"sources":["../../src/pages/NotificationHistoryPage.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"NotificationHistoryPage.js","names":[],"sources":["../../src/pages/NotificationHistoryPage.tsx"],"sourcesContent":["import { Archive, Download, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\n\n/** User Notification History — personal history, filter, CSV export, archive/unarchive. */\nexport function NotificationHistoryPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics } = useNotificationTopics({ isActive: true });\n const {\n notifications,\n notificationFilter,\n updateFilter,\n archiveNotification,\n unarchiveNotification,\n recordAction,\n } = useNotifications({ baseFilter: HISTORY_FILTER });\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 (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\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-300\">\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.historyTitle', 'Notification History')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr('notifications.historySubtitle', 'View and search all your notifications')}\n </p>\n </div>\n\n <button\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"flex items-center gap-2 px-4 py-2 text-sm font-medium text-accent-primary hover:text-accent-primary/80 border border-accent-primary hover:border-accent-primary/80 rounded-lg transition-all duration-150 hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </button>\n </div>\n\n <div className=\"grid gap-3 sm:grid-cols-2 xl:grid-cols-5\">\n <div className=\"relative sm:col-span-2 xl:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\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 <select\n value={notificationFilter.topicId || ''}\n onChange={(event) => updateFilter({ topicId: event.target.value || undefined })}\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <input\n type=\"date\"\n aria-label={tr('notifications.startDate', 'Start date')}\n value={\n notificationFilter.dateRange.start\n ? notificationFilter.dateRange.start.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n start: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n\n <input\n type=\"date\"\n aria-label={tr('notifications.endDate', 'End date')}\n value={\n notificationFilter.dateRange.end\n ? notificationFilter.dateRange.end.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n end: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n </div>\n\n <div className=\"space-y-2\">\n {notifications.length > 0 ? (\n notifications.map((notification) => (\n <div key={notification.id} className=\"space-y-2\">\n <NotificationCard\n notification={notification}\n onArchive={archiveNotification}\n onAction={recordAction}\n showArchivedState\n />\n {notification.archivedAt && (\n <div className=\"flex justify-end\">\n <button\n onClick={() => unarchiveNotification(notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-muted\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n </div>\n )}\n </div>\n ))\n ) : (\n <div className=\"flex flex-col items-center justify-center py-12 text-center animate-in fade-in duration-300\">\n <Archive size={48} className=\"text-tertiary mb-4\" />\n <h3 className=\"text-lg font-semibold text-primary mb-2\">\n {tr('notifications.noNotificationsFound', 'No notifications found')}\n </h3>\n <p className=\"text-sm text-secondary\">\n {tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')}\n </p>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AASA,IAAM,IAAiB;CAAE,UAAU;CAAM,SAAS;CAAgB;AAGlE,SAAgB,IAA0B;CACxC,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,mBAAgB,GAAiB,EACnC,EAAE,cAAW,EAAsB,EAAE,UAAU,IAAM,CAAC,EACtD,EACJ,kBACA,uBACA,iBACA,wBACA,0BACA,oBACE,EAAiB,EAAE,YAAY,GAAgB,CAAC;AAqBpD,QAnBI,IAEA,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,kFAAmF,CAAA;EAC9F,CAAA,GAIN,CAAC,EAAc,EAAyB,kBAAkB,IAAI,CAAC,GAAa,KAE5E,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,qC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EAAa,EACX,WAAW;OACT,GAAG,EAAmB;OACtB,OAAO,EAAE,OAAO,QAAQ,IAAI,KAAK,EAAE,OAAO,MAAM,GAAG;OACpD,EACF,CAAC;MAEJ,WAAU;MACV,CAAA;KAEF,kBAAC,SAAD;MACE,MAAK;MACL,cAAY,EAAG,yBAAyB,WAAW;MACnD,OACE,EAAmB,UAAU,MACzB,EAAmB,UAAU,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,KAC1D;MAEN,WAAW,MACT,EAAa,EACX,WAAW;OACT,GAAG,EAAmB;OACtB,KAAK,EAAE,OAAO,QAAQ,IAAI,KAAK,EAAE,OAAO,MAAM,GAAG;OAClD,EACF,CAAC;MAEJ,WAAU;MACV,CAAA;KACE;;GAEN,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAc,SAAS,IACtB,EAAc,KAAK,MACjB,kBAAC,OAAD;KAA2B,WAAU;eAArC,CACE,kBAAC,GAAD;MACgB;MACd,WAAW;MACX,UAAU;MACV,mBAAA;MACA,CAAA,EACD,EAAa,cACZ,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,UAAD;OACE,eAAe,EAAsB,EAAa,GAAG;OACrD,WAAU;iBAET,EAAG,yBAAyB,UAAU;OAChC,CAAA;MACL,CAAA,CAEJ;OAjBI,EAAa,GAiBjB,CACN,GAEF,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,GAAD;OAAS,MAAM;OAAI,WAAU;OAAuB,CAAA;MACpD,kBAAC,MAAD;OAAI,WAAU;iBACX,EAAG,sCAAsC,yBAAyB;OAChE,CAAA;MACL,kBAAC,KAAD;OAAG,WAAU;iBACV,EAAG,yCAAyC,6BAA6B;OACxE,CAAA;MACA;;IAEJ,CAAA;GACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPreferencesPage.d.ts","sourceRoot":"","sources":["../../src/pages/NotificationPreferencesPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NotificationPreferencesPage.d.ts","sourceRoot":"","sources":["../../src/pages/NotificationPreferencesPage.tsx"],"names":[],"mappings":"AAsCA,wBAAgB,2BAA2B,4CAwQ1C"}
|
|
@@ -1,108 +1,253 @@
|
|
|
1
1
|
import { useNotification as e } from "../providers/NotificationProvider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useNotificationPreferences as t } from "../hooks/useNotificationPreferences.js";
|
|
3
|
+
import { useNotificationTopics as n } from "../hooks/useNotificationTopics.js";
|
|
3
4
|
import "../hooks/index.js";
|
|
4
|
-
import { useTr as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { useTr as r } from "../shared/hooks/useTr.js";
|
|
6
|
+
import { nativeImpact as i, nativeNotify as a } from "../utils/nativeBridge.js";
|
|
7
|
+
import { NOTIFICATION_PERMISSIONS as o } from "../constants/permissions.js";
|
|
8
|
+
import { useMemo as s, useState as c } from "react";
|
|
9
|
+
import { BellRing as l, Search as u, ToggleLeft as d, ToggleRight as f } from "lucide-react";
|
|
10
|
+
import { usePermissions as p } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
10
12
|
//#region src/pages/NotificationPreferencesPage.tsx
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
var g = [
|
|
14
|
+
{
|
|
15
|
+
value: "IN_APP",
|
|
16
|
+
labelKey: "notifications.channelInApp",
|
|
17
|
+
label: "In-app"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: "EMAIL",
|
|
21
|
+
labelKey: "notifications.channelEmail",
|
|
22
|
+
label: "Email"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "PUSH",
|
|
26
|
+
labelKey: "notifications.channelPush",
|
|
27
|
+
label: "Push"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "SMS",
|
|
31
|
+
labelKey: "notifications.channelSms",
|
|
32
|
+
label: "SMS"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: "WHATSAPP",
|
|
36
|
+
labelKey: "notifications.channelWhatsapp",
|
|
37
|
+
label: "WhatsApp"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
value: "SLACK",
|
|
41
|
+
labelKey: "notifications.channelSlack",
|
|
42
|
+
label: "Slack"
|
|
43
|
+
}
|
|
44
|
+
], _ = [
|
|
45
|
+
{
|
|
46
|
+
value: "TRANSACTIONAL",
|
|
47
|
+
labelKey: "notifications.typeTransactional",
|
|
48
|
+
label: "Transactional"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: "SYSTEM",
|
|
52
|
+
labelKey: "notifications.typeSystem",
|
|
53
|
+
label: "System"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
value: "ALERT",
|
|
57
|
+
labelKey: "notifications.typeAlert",
|
|
58
|
+
label: "Alerts"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: "MARKETING",
|
|
62
|
+
labelKey: "notifications.typeMarketing",
|
|
63
|
+
label: "Marketing"
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
function v(e) {
|
|
67
|
+
return e.scope === "CHANNEL" ? `CHANNEL:${e.channel || ""}` : e.scope === "TYPE" ? `TYPE:${e.type || ""}` : e.scope === "TOPIC" ? `TOPIC:${e.topicId || ""}` : "GLOBAL";
|
|
68
|
+
}
|
|
69
|
+
function y() {
|
|
70
|
+
let y = r(), { hasPermission: b, isLoading: x } = p(), { currentUser: S } = e(), { topics: C, isLoading: w } = n({
|
|
13
71
|
type: "MARKETING",
|
|
14
72
|
isActive: !0
|
|
15
|
-
}), [
|
|
16
|
-
if (!
|
|
17
|
-
let e =
|
|
18
|
-
return
|
|
19
|
-
}, [
|
|
20
|
-
|
|
73
|
+
}), { preferencesByKey: T, isLoading: E, setPreference: D, deletePreference: O } = t(), [k, A] = c(""), [j, M] = c(null), N = w || E, P = s(() => {
|
|
74
|
+
if (!k.trim()) return C;
|
|
75
|
+
let e = k.toLowerCase();
|
|
76
|
+
return C.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
|
|
77
|
+
}, [k, C]), F = async (e) => {
|
|
78
|
+
let t = v(e), n = T.get(t);
|
|
79
|
+
M(t), i("medium");
|
|
80
|
+
try {
|
|
81
|
+
await D({
|
|
82
|
+
...e,
|
|
83
|
+
enabled: !(n?.enabled ?? !0),
|
|
84
|
+
frequency: n?.frequency || "IMMEDIATE"
|
|
85
|
+
}), a("success");
|
|
86
|
+
} catch (e) {
|
|
87
|
+
throw a("error"), e;
|
|
88
|
+
} finally {
|
|
89
|
+
M(null);
|
|
90
|
+
}
|
|
91
|
+
}, I = async (e) => {
|
|
92
|
+
let t = T.get(e);
|
|
93
|
+
if (t) {
|
|
94
|
+
M(e);
|
|
95
|
+
try {
|
|
96
|
+
await O(t.id);
|
|
97
|
+
} finally {
|
|
98
|
+
M(null);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, L = (e) => {
|
|
102
|
+
let t = T.get(e.key), n = t?.enabled ?? !0, r = j === e.key;
|
|
103
|
+
return /* @__PURE__ */ m("div", {
|
|
104
|
+
className: "rounded-lg border border-default bg-surface p-4 shadow-sm",
|
|
105
|
+
children: /* @__PURE__ */ h("div", {
|
|
106
|
+
className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
|
|
107
|
+
children: [/* @__PURE__ */ h("div", {
|
|
108
|
+
className: "space-y-1",
|
|
109
|
+
children: [/* @__PURE__ */ h("div", {
|
|
110
|
+
className: "flex items-center gap-2",
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ m(l, {
|
|
113
|
+
size: 16,
|
|
114
|
+
className: "text-accent-primary"
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ m("h2", {
|
|
117
|
+
className: "text-sm font-semibold text-primary",
|
|
118
|
+
children: e.title
|
|
119
|
+
}),
|
|
120
|
+
t && /* @__PURE__ */ m("span", {
|
|
121
|
+
className: "rounded-full bg-muted px-2 py-0.5 text-xs text-secondary",
|
|
122
|
+
children: t.frequency.replace("_", " ").toLowerCase()
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
}), /* @__PURE__ */ m("p", {
|
|
126
|
+
className: "text-sm text-secondary",
|
|
127
|
+
children: e.description
|
|
128
|
+
})]
|
|
129
|
+
}), /* @__PURE__ */ h("div", {
|
|
130
|
+
className: "flex items-center gap-2",
|
|
131
|
+
children: [t && /* @__PURE__ */ m("button", {
|
|
132
|
+
type: "button",
|
|
133
|
+
disabled: r,
|
|
134
|
+
onClick: () => I(e.key),
|
|
135
|
+
className: "rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
136
|
+
children: y("notifications.reset", "Reset")
|
|
137
|
+
}), /* @__PURE__ */ h("button", {
|
|
138
|
+
type: "button",
|
|
139
|
+
"aria-pressed": n,
|
|
140
|
+
disabled: r,
|
|
141
|
+
onClick: () => F({
|
|
142
|
+
scope: e.scope,
|
|
143
|
+
channel: e.channel,
|
|
144
|
+
type: e.type,
|
|
145
|
+
topicId: e.topicId
|
|
146
|
+
}),
|
|
147
|
+
className: `inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${n ? "border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90" : "border-default bg-muted text-secondary hover:bg-muted/80"} disabled:cursor-not-allowed disabled:opacity-50`,
|
|
148
|
+
children: [m(n ? f : d, { size: 18 }), n ? y("notifications.enabled", "Enabled") : y("notifications.disabled", "Disabled")]
|
|
149
|
+
})]
|
|
150
|
+
})]
|
|
151
|
+
})
|
|
152
|
+
}, e.key);
|
|
153
|
+
};
|
|
154
|
+
return x ? /* @__PURE__ */ m("div", {
|
|
21
155
|
className: "flex h-64 items-center justify-center",
|
|
22
|
-
children: /* @__PURE__ */
|
|
23
|
-
}) : !
|
|
156
|
+
children: /* @__PURE__ */ m("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
157
|
+
}) : !b(o.NOTIFICATION_LIST) && !S?.id ? /* @__PURE__ */ m("div", {
|
|
24
158
|
className: "p-8 text-center text-text-secondary",
|
|
25
|
-
children:
|
|
26
|
-
}) : /* @__PURE__ */
|
|
159
|
+
children: y("notifications.noPermissionPreferences", "You don't have permission to manage notification preferences.")
|
|
160
|
+
}) : /* @__PURE__ */ h("div", {
|
|
27
161
|
className: "space-y-6 p-4 sm:p-6",
|
|
28
162
|
children: [
|
|
29
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
|
|
30
164
|
className: "text-2xl font-bold text-primary",
|
|
31
|
-
children:
|
|
32
|
-
}), /* @__PURE__ */
|
|
165
|
+
children: y("notifications.preferencesTitle", "Notification Preferences")
|
|
166
|
+
}), /* @__PURE__ */ m("p", {
|
|
33
167
|
className: "mt-1 text-sm text-secondary",
|
|
34
|
-
children:
|
|
168
|
+
children: y("notifications.preferencesSubtitle", "Control global, channel, type, and topic-level notification delivery.")
|
|
35
169
|
})] }),
|
|
36
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ h("section", {
|
|
171
|
+
className: "space-y-3",
|
|
172
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
173
|
+
className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
|
|
174
|
+
children: y("notifications.globalPreferences", "Global")
|
|
175
|
+
}), L({
|
|
176
|
+
key: "GLOBAL",
|
|
177
|
+
scope: "GLOBAL",
|
|
178
|
+
title: y("notifications.allNotifications", "All notifications"),
|
|
179
|
+
description: y("notifications.allNotificationsDescription", "Master preference for notification delivery across all channels and types.")
|
|
180
|
+
})]
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ h("section", {
|
|
183
|
+
className: "space-y-3",
|
|
184
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
185
|
+
className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
|
|
186
|
+
children: y("notifications.channelPreferences", "Channels")
|
|
187
|
+
}), /* @__PURE__ */ m("div", {
|
|
188
|
+
className: "grid gap-3 lg:grid-cols-2",
|
|
189
|
+
children: g.map((e) => L({
|
|
190
|
+
key: `CHANNEL:${e.value}`,
|
|
191
|
+
scope: "CHANNEL",
|
|
192
|
+
channel: e.value,
|
|
193
|
+
title: y(e.labelKey, e.label),
|
|
194
|
+
description: y("notifications.channelPreferenceDescription", "Control delivery for this channel.")
|
|
195
|
+
}))
|
|
196
|
+
})]
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ h("section", {
|
|
199
|
+
className: "space-y-3",
|
|
200
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
201
|
+
className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
|
|
202
|
+
children: y("notifications.typePreferences", "Notification Types")
|
|
203
|
+
}), /* @__PURE__ */ m("div", {
|
|
204
|
+
className: "grid gap-3 lg:grid-cols-2",
|
|
205
|
+
children: _.map((e) => L({
|
|
206
|
+
key: `TYPE:${e.value}`,
|
|
207
|
+
scope: "TYPE",
|
|
208
|
+
type: e.value,
|
|
209
|
+
title: y(e.labelKey, e.label),
|
|
210
|
+
description: y("notifications.typePreferenceDescription", "Control delivery for this notification type.")
|
|
211
|
+
}))
|
|
212
|
+
})]
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ h("div", {
|
|
37
215
|
className: "relative max-w-xl",
|
|
38
|
-
children: [/* @__PURE__ */
|
|
216
|
+
children: [/* @__PURE__ */ m(u, {
|
|
39
217
|
size: 16,
|
|
40
218
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
41
|
-
}), /* @__PURE__ */
|
|
219
|
+
}), /* @__PURE__ */ m("input", {
|
|
42
220
|
type: "text",
|
|
43
|
-
value:
|
|
44
|
-
onChange: (e) =>
|
|
45
|
-
|
|
221
|
+
value: k,
|
|
222
|
+
onChange: (e) => A(e.target.value),
|
|
223
|
+
"aria-label": y("notifications.searchTopics", "Search topics..."),
|
|
224
|
+
placeholder: y("notifications.searchTopics", "Search topics..."),
|
|
46
225
|
className: "w-full rounded-lg border border-default bg-surface py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent"
|
|
47
226
|
})]
|
|
48
227
|
}),
|
|
49
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ h("section", {
|
|
50
229
|
className: "space-y-3",
|
|
51
|
-
children:
|
|
230
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
231
|
+
className: "text-sm font-semibold uppercase tracking-wide text-tertiary",
|
|
232
|
+
children: y("notifications.topicPreferences", "Topics")
|
|
233
|
+
}), N ? /* @__PURE__ */ m("div", {
|
|
52
234
|
className: "rounded-lg border border-default bg-surface p-6 text-sm text-secondary",
|
|
53
|
-
children:
|
|
54
|
-
}) :
|
|
235
|
+
children: y("notifications.loadingPreferences", "Loading preferences...")
|
|
236
|
+
}) : P.length === 0 ? /* @__PURE__ */ m("div", {
|
|
55
237
|
className: "rounded-lg border border-default bg-surface p-6 text-sm text-secondary",
|
|
56
|
-
children:
|
|
57
|
-
}) :
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
className: "space-y-1",
|
|
65
|
-
children: [/* @__PURE__ */ f("div", {
|
|
66
|
-
className: "flex items-center gap-2",
|
|
67
|
-
children: [
|
|
68
|
-
/* @__PURE__ */ d(o, {
|
|
69
|
-
size: 16,
|
|
70
|
-
className: "text-accent-primary"
|
|
71
|
-
}),
|
|
72
|
-
/* @__PURE__ */ d("h2", {
|
|
73
|
-
className: "text-sm font-semibold text-primary",
|
|
74
|
-
children: e.name
|
|
75
|
-
}),
|
|
76
|
-
/* @__PURE__ */ d("span", {
|
|
77
|
-
className: "rounded-full bg-muted px-2 py-0.5 text-xs text-secondary",
|
|
78
|
-
children: e.slug
|
|
79
|
-
})
|
|
80
|
-
]
|
|
81
|
-
}), e.description && /* @__PURE__ */ d("p", {
|
|
82
|
-
className: "text-sm text-secondary",
|
|
83
|
-
children: e.description
|
|
84
|
-
})]
|
|
85
|
-
}), /* @__PURE__ */ f("button", {
|
|
86
|
-
disabled: n,
|
|
87
|
-
onClick: async () => {
|
|
88
|
-
C(e.id);
|
|
89
|
-
try {
|
|
90
|
-
await y(e.id, !t);
|
|
91
|
-
} finally {
|
|
92
|
-
C(null);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
className: `inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors ${t ? "bg-accent-primary text-white hover:opacity-90" : "bg-muted text-secondary hover:bg-muted/80"} disabled:cursor-not-allowed disabled:opacity-50`,
|
|
96
|
-
children: [d(t ? l : c, { size: 18 }), t ? p("notifications.subscribed", "Subscribed") : p("notifications.unsubscribed", "Unsubscribed")]
|
|
97
|
-
})]
|
|
98
|
-
})
|
|
99
|
-
}, e.id);
|
|
100
|
-
})
|
|
238
|
+
children: y("notifications.noTopicsFound", "No promotional topics available right now.")
|
|
239
|
+
}) : P.map((e) => L({
|
|
240
|
+
key: `TOPIC:${e.id}`,
|
|
241
|
+
scope: "TOPIC",
|
|
242
|
+
topicId: e.id,
|
|
243
|
+
title: e.name,
|
|
244
|
+
description: e.description || e.slug
|
|
245
|
+
}))]
|
|
101
246
|
})
|
|
102
247
|
]
|
|
103
248
|
});
|
|
104
249
|
}
|
|
105
250
|
//#endregion
|
|
106
|
-
export {
|
|
251
|
+
export { y as NotificationPreferencesPage };
|
|
107
252
|
|
|
108
253
|
//# sourceMappingURL=NotificationPreferencesPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPreferencesPage.js","names":[],"sources":["../../src/pages/NotificationPreferencesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { BellRing, Search, ToggleLeft, ToggleRight } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\n\nexport function NotificationPreferencesPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics, isLoading, setTopicSubscription } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const [search, setSearch] = useState('');\n const [savingTopicId, setSavingTopicId] = useState<string | null>(null);\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 (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionPreferences',\n \"You don't have permission to manage notification preferences.\"\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.preferencesTitle', 'Notification Preferences')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.preferencesSubtitle',\n 'Choose which promotional topics you want to keep receiving.'\n )}\n </p>\n </div>\n\n <div className=\"relative max-w-xl\">\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-lg border border-default bg-surface 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=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.loadingTopics', 'Loading topics...')}\n </div>\n ) : filteredTopics.length === 0 ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.noTopicsFound', 'No promotional topics available right now.')}\n </div>\n ) : (\n filteredTopics.map((topic) => {\n const isSubscribed = topic.mySubscription?.subscribed ?? true;\n const isSaving = savingTopicId === topic.id;\n\n return (\n <div\n key={topic.id}\n className=\"rounded-lg border border-default bg-surface p-4 shadow-sm\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"space-y-1\">\n <div className=\"flex items-center gap-2\">\n <BellRing size={16} className=\"text-accent-primary\" />\n <h2 className=\"text-sm font-semibold text-primary\">{topic.name}</h2>\n <span className=\"rounded-full bg-muted px-2 py-0.5 text-xs text-secondary\">\n {topic.slug}\n </span>\n </div>\n {topic.description && (\n <p className=\"text-sm text-secondary\">{topic.description}</p>\n )}\n </div>\n\n <button\n disabled={isSaving}\n onClick={async () => {\n setSavingTopicId(topic.id);\n try {\n await setTopicSubscription(topic.id, !isSubscribed);\n } finally {\n setSavingTopicId(null);\n }\n }}\n className={`inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors ${\n isSubscribed\n ? 'bg-accent-primary text-white hover:opacity-90'\n : 'bg-muted text-secondary hover:bg-muted/80'\n } disabled:cursor-not-allowed disabled:opacity-50`}\n >\n {isSubscribed ? <ToggleRight size={18} /> : <ToggleLeft size={18} />}\n {isSubscribed\n ? tr('notifications.subscribed', 'Subscribed')\n : tr('notifications.unsubscribed', 'Unsubscribed')}\n </button>\n </div>\n </div>\n );\n })\n )}\n </div>\n </div>\n );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V,CAAA,CACE;;GAEN,kBAAC,OAAD;IAAK,WAAU;cACZ,IACC,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,+BAA+B,oBAAoB;KACnD,CAAA,GACJ,EAAe,WAAW,IAC5B,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,+BAA+B,6CAA6C;KAC5E,CAAA,GAEN,EAAe,KAAK,MAAU;KAC5B,IAAM,IAAe,EAAM,gBAAgB,cAAc,IACnD,IAAW,MAAkB,EAAM;AAEzC,YACE,kBAAC,OAAD;MAEE,WAAU;gBAEV,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAf;UACE,kBAAC,GAAD;WAAU,MAAM;WAAI,WAAU;WAAwB,CAAA;UACtD,kBAAC,MAAD;WAAI,WAAU;qBAAsC,EAAM;WAAU,CAAA;UACpE,kBAAC,QAAD;WAAM,WAAU;qBACb,EAAM;WACF,CAAA;UACH;YACL,EAAM,eACL,kBAAC,KAAD;SAAG,WAAU;mBAA0B,EAAM;SAAgB,CAAA,CAE3D;WAEN,kBAAC,UAAD;QACE,UAAU;QACV,SAAS,YAAY;AACnB,WAAiB,EAAM,GAAG;AAC1B,aAAI;AACF,gBAAM,EAAqB,EAAM,IAAI,CAAC,EAAa;mBAC3C;AACR,YAAiB,KAAK;;;QAG1B,WAAW,6FACT,IACI,kDACA,4CACL;kBAdH,CAgBkB,EAAf,IAAgB,IAA4B,GAA7B,EAAa,MAAM,IAAM,CAA2B,EACnE,IACG,EAAG,4BAA4B,aAAa,GAC5C,EAAG,8BAA8B,eAAe,CAC7C;UACL;;MACF,EAvCC,EAAM,GAuCP;MAER;IAEA,CAAA;GACF"}
|
|
1
|
+
{"version":3,"file":"NotificationPreferencesPage.js","names":[],"sources":["../../src/pages/NotificationPreferencesPage.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { BellRing, Search, ToggleLeft, ToggleRight } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useNotificationPreferences, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationChannel, NotificationPreferenceScope, NotificationType } from '../types';\nimport { nativeImpact, nativeNotify } from '../utils/nativeBridge';\n\nconst CHANNEL_OPTIONS: Array<{ value: NotificationChannel; labelKey: string; label: string }> = [\n { value: 'IN_APP', labelKey: 'notifications.channelInApp', label: 'In-app' },\n { value: 'EMAIL', labelKey: 'notifications.channelEmail', label: 'Email' },\n { value: 'PUSH', labelKey: 'notifications.channelPush', label: 'Push' },\n { value: 'SMS', labelKey: 'notifications.channelSms', label: 'SMS' },\n { value: 'WHATSAPP', labelKey: 'notifications.channelWhatsapp', label: 'WhatsApp' },\n { value: 'SLACK', labelKey: 'notifications.channelSlack', label: 'Slack' },\n];\n\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alerts' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\n\nfunction preferenceKey(input: {\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n}) {\n if (input.scope === 'CHANNEL') return `CHANNEL:${input.channel || ''}`;\n if (input.scope === 'TYPE') return `TYPE:${input.type || ''}`;\n if (input.scope === 'TOPIC') return `TOPIC:${input.topicId || ''}`;\n return 'GLOBAL';\n}\n\nexport function NotificationPreferencesPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics, isLoading: topicsLoading } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const {\n preferencesByKey,\n isLoading: preferencesLoading,\n setPreference,\n deletePreference,\n } = useNotificationPreferences();\n const [search, setSearch] = useState('');\n const [savingKey, setSavingKey] = useState<string | null>(null);\n\n const isLoading = topicsLoading || preferencesLoading;\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 const togglePreference = async (input: {\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const key = preferenceKey(input);\n const existing = preferencesByKey.get(key);\n setSavingKey(key);\n nativeImpact('medium');\n try {\n await setPreference({\n ...input,\n enabled: !(existing?.enabled ?? true),\n frequency: existing?.frequency || 'IMMEDIATE',\n });\n void nativeNotify('success');\n } catch (err) {\n void nativeNotify('error');\n throw err;\n } finally {\n setSavingKey(null);\n }\n };\n\n const resetPreference = async (key: string) => {\n const existing = preferencesByKey.get(key);\n if (!existing) return;\n setSavingKey(key);\n try {\n await deletePreference(existing.id);\n } finally {\n setSavingKey(null);\n }\n };\n\n const renderPreferenceRow = (input: {\n key: string;\n title: string;\n description: string;\n scope: NotificationPreferenceScope;\n channel?: NotificationChannel;\n type?: NotificationType;\n topicId?: string;\n }) => {\n const existing = preferencesByKey.get(input.key);\n const isEnabled = existing?.enabled ?? true;\n const isSaving = savingKey === input.key;\n\n return (\n <div key={input.key} className=\"rounded-lg border border-default bg-surface p-4 shadow-sm\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"space-y-1\">\n <div className=\"flex items-center gap-2\">\n <BellRing size={16} className=\"text-accent-primary\" />\n <h2 className=\"text-sm font-semibold text-primary\">{input.title}</h2>\n {existing && (\n <span className=\"rounded-full bg-muted px-2 py-0.5 text-xs text-secondary\">\n {existing.frequency.replace('_', ' ').toLowerCase()}\n </span>\n )}\n </div>\n <p className=\"text-sm text-secondary\">{input.description}</p>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {existing && (\n <button\n type=\"button\"\n disabled={isSaving}\n onClick={() => resetPreference(input.key)}\n className=\"rounded-md border border-default px-3 py-2 text-sm text-secondary hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50\"\n >\n {tr('notifications.reset', 'Reset')}\n </button>\n )}\n <button\n type=\"button\"\n aria-pressed={isEnabled}\n disabled={isSaving}\n onClick={() =>\n togglePreference({\n scope: input.scope,\n channel: input.channel,\n type: input.type,\n topicId: input.topicId,\n })\n }\n className={`inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${\n isEnabled\n ? 'border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90'\n : 'border-default bg-muted text-secondary hover:bg-muted/80'\n } disabled:cursor-not-allowed disabled:opacity-50`}\n >\n {isEnabled ? <ToggleRight size={18} /> : <ToggleLeft size={18} />}\n {isEnabled\n ? tr('notifications.enabled', 'Enabled')\n : tr('notifications.disabled', 'Disabled')}\n </button>\n </div>\n </div>\n </div>\n );\n };\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 (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionPreferences',\n \"You don't have permission to manage notification preferences.\"\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.preferencesTitle', 'Notification Preferences')}\n </h1>\n <p className=\"mt-1 text-sm text-secondary\">\n {tr(\n 'notifications.preferencesSubtitle',\n 'Control global, channel, type, and topic-level notification delivery.'\n )}\n </p>\n </div>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.globalPreferences', 'Global')}\n </h2>\n {renderPreferenceRow({\n key: 'GLOBAL',\n scope: 'GLOBAL',\n title: tr('notifications.allNotifications', 'All notifications'),\n description: tr(\n 'notifications.allNotificationsDescription',\n 'Master preference for notification delivery across all channels and types.'\n ),\n })}\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.channelPreferences', 'Channels')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {CHANNEL_OPTIONS.map((channel) =>\n renderPreferenceRow({\n key: `CHANNEL:${channel.value}`,\n scope: 'CHANNEL',\n channel: channel.value,\n title: tr(channel.labelKey, channel.label),\n description: tr(\n 'notifications.channelPreferenceDescription',\n 'Control delivery for this channel.'\n ),\n })\n )}\n </div>\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.typePreferences', 'Notification Types')}\n </h2>\n <div className=\"grid gap-3 lg:grid-cols-2\">\n {TYPE_OPTIONS.map((type) =>\n renderPreferenceRow({\n key: `TYPE:${type.value}`,\n scope: 'TYPE',\n type: type.value,\n title: tr(type.labelKey, type.label),\n description: tr(\n 'notifications.typePreferenceDescription',\n 'Control delivery for this notification type.'\n ),\n })\n )}\n </div>\n </section>\n\n <div className=\"relative max-w-xl\">\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 aria-label={tr('notifications.searchTopics', 'Search topics...')}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n className=\"w-full rounded-lg border border-default bg-surface py-2 pl-9 pr-4 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </div>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold uppercase tracking-wide text-tertiary\">\n {tr('notifications.topicPreferences', 'Topics')}\n </h2>\n {isLoading ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.loadingPreferences', 'Loading preferences...')}\n </div>\n ) : filteredTopics.length === 0 ? (\n <div className=\"rounded-lg border border-default bg-surface p-6 text-sm text-secondary\">\n {tr('notifications.noTopicsFound', 'No promotional topics available right now.')}\n </div>\n ) : (\n filteredTopics.map((topic) =>\n renderPreferenceRow({\n key: `TOPIC:${topic.id}`,\n scope: 'TOPIC',\n topicId: topic.id,\n title: topic.name,\n description: topic.description || topic.slug,\n })\n )\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAUA,IAAM,IAA0F;CAC9F;EAAE,OAAO;EAAU,UAAU;EAA8B,OAAO;EAAU;CAC5E;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;EAAS;CAC1E;EAAE,OAAO;EAAQ,UAAU;EAA6B,OAAO;EAAQ;CACvE;EAAE,OAAO;EAAO,UAAU;EAA4B,OAAO;EAAO;CACpE;EAAE,OAAO;EAAY,UAAU;EAAiC,OAAO;EAAY;CACnF;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;EAAS;CAC3E,EAEK,IAAoF;CACxF;EAAE,OAAO;EAAiB,UAAU;EAAmC,OAAO;EAAiB;CAC/F;EAAE,OAAO;EAAU,UAAU;EAA4B,OAAO;EAAU;CAC1E;EAAE,OAAO;EAAS,UAAU;EAA2B,OAAO;EAAU;CACxE;EAAE,OAAO;EAAa,UAAU;EAA+B,OAAO;EAAa;CACpF;AAED,SAAS,EAAc,GAKpB;AAID,QAHI,EAAM,UAAU,YAAkB,WAAW,EAAM,WAAW,OAC9D,EAAM,UAAU,SAAe,QAAQ,EAAM,QAAQ,OACrD,EAAM,UAAU,UAAgB,SAAS,EAAM,WAAW,OACvD;;AAGT,SAAgB,IAA8B;CAC5C,IAAM,IAAK,GAAO,E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A,CACE;;GAEN,kBAAC,WAAD;IAAS,WAAU;cAAnB,CACE,kBAAC,MAAD;KAAI,WAAU;eACX,EAAG,kCAAkC,SAAS;KAC5C,CAAA,EACJ,IACC,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,oCAAoC,yBAAyB;KAC7D,CAAA,GACJ,EAAe,WAAW,IAC5B,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAG,+BAA+B,6CAA6C;KAC5E,CAAA,GAEN,EAAe,KAAK,MAClB,EAAoB;KAClB,KAAK,SAAS,EAAM;KACpB,OAAO;KACP,SAAS,EAAM;KACf,OAAO,EAAM;KACb,aAAa,EAAM,eAAe,EAAM;KACzC,CAAC,CACH,CAEK;;GACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationTemplatesPage.d.ts","sourceRoot":"","sources":["../../src/pages/NotificationTemplatesPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NotificationTemplatesPage.d.ts","sourceRoot":"","sources":["../../src/pages/NotificationTemplatesPage.tsx"],"names":[],"mappings":"AAsCA;;;;;GAKG;AACH,wBAAgB,yBAAyB,4CA+YxC"}
|