@burdenoff/microfe-notification 2026.1124.1 → 2026.1125.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/AdminNotificationRoutes.js +59 -51
- package/dist/AdminNotificationRoutes.js.map +1 -1
- package/dist/NotificationRoutes.js +76 -68
- package/dist/NotificationRoutes.js.map +1 -1
- package/dist/UserNotificationRoutes.js +39 -31
- package/dist/UserNotificationRoutes.js.map +1 -1
- package/dist/components/NotificationListFooter.js +1 -1
- package/dist/components/NotificationListFooter.js.map +1 -1
- package/dist/components/loadingSystem.d.ts +64 -0
- package/dist/components/loadingSystem.js +34 -0
- package/dist/components/loadingSystem.js.map +1 -0
- package/dist/navigation-v2/AdminPageV2.js +23 -16
- package/dist/navigation-v2/AdminPageV2.js.map +1 -1
- package/dist/navigation-v2/NotificationArchivedV2.js +100 -93
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
- package/dist/navigation-v2/NotificationInboxV2.js +130 -123
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
- package/dist/navigation-v2/NotificationSettingsV2.js +91 -84
- package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -1
- package/dist/navigation-v2/NotificationsV2Landing.js +31 -23
- package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -1
- package/dist/pages/CreateNotificationPage.js +442 -432
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.js +91 -84
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +226 -219
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +69 -62
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationLandingPage.js +42 -34
- package/dist/pages/NotificationLandingPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.js +80 -70
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.js +192 -181
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.js +124 -117
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/pages/TemplateEditorPage.js +248 -233
- package/dist/pages/TemplateEditorPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -6,57 +6,58 @@ import { useNotification as i } from "../providers/NotificationProvider.js";
|
|
|
6
6
|
import { useTr as a } from "../shared/hooks/useTr.js";
|
|
7
7
|
import { BackToNotifications as o } from "./BackToNotifications.js";
|
|
8
8
|
import { EVERYDAY_CHANNELS as s, MORE_CHANNELS as c, TYPES as l } from "./settingsOptions.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { CompactMarkOr as u, SectionLoaderOr as d } from "../components/loadingSystem.js";
|
|
10
|
+
import { useId as f, useMemo as p, useState as m } from "react";
|
|
11
|
+
import { usePermissions as h } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
12
|
+
import { MoreHorizontal as g, Search as _ } from "lucide-react";
|
|
13
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
14
|
+
import { Button as b, DropdownMenu as x, DropdownMenuContent as S, DropdownMenuItem as C, DropdownMenuTrigger as w, Input as T, OptionalFields as E, Switch as D } from "@burdenoff/fe-libs/ui";
|
|
14
15
|
// src/navigation-v2/NotificationSettingsV2.tsx
|
|
15
|
-
function
|
|
16
|
-
let l = a(),
|
|
17
|
-
return /* @__PURE__ */
|
|
16
|
+
function O({ title: e, description: t, checked: n, saving: r, feedback: i, onToggle: o, onUseDefault: s, testId: c }) {
|
|
17
|
+
let l = a(), u = f();
|
|
18
|
+
return /* @__PURE__ */ y("div", {
|
|
18
19
|
className: "py-3",
|
|
19
20
|
"data-testid": c,
|
|
20
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ y("div", {
|
|
21
22
|
className: "flex items-center justify-between gap-3",
|
|
22
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ y("div", {
|
|
23
24
|
className: "min-w-0",
|
|
24
|
-
children: [/* @__PURE__ */
|
|
25
|
-
htmlFor:
|
|
25
|
+
children: [/* @__PURE__ */ v("label", {
|
|
26
|
+
htmlFor: u,
|
|
26
27
|
className: "text-sm font-medium text-text-primary",
|
|
27
28
|
children: e
|
|
28
|
-
}), t && /* @__PURE__ */
|
|
29
|
+
}), t && /* @__PURE__ */ v("p", {
|
|
29
30
|
className: "text-sm text-text-secondary",
|
|
30
31
|
children: t
|
|
31
32
|
})]
|
|
32
|
-
}), /* @__PURE__ */
|
|
33
|
+
}), /* @__PURE__ */ y("div", {
|
|
33
34
|
className: "flex shrink-0 items-center gap-2",
|
|
34
35
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ v("span", {
|
|
36
37
|
className: "w-8 text-right text-sm text-text-secondary",
|
|
37
38
|
"aria-hidden": "true",
|
|
38
39
|
children: r ? "…" : n ? l("notifications.v2.on", "On") : l("notifications.v2.off", "Off")
|
|
39
40
|
}),
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
id:
|
|
41
|
+
/* @__PURE__ */ v(D, {
|
|
42
|
+
id: u,
|
|
42
43
|
checked: n,
|
|
43
44
|
disabled: r,
|
|
44
45
|
onCheckedChange: o
|
|
45
46
|
}),
|
|
46
|
-
s && /* @__PURE__ */
|
|
47
|
+
s && /* @__PURE__ */ y(x, { children: [/* @__PURE__ */ v(w, {
|
|
47
48
|
asChild: !0,
|
|
48
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ v(b, {
|
|
49
50
|
variant: "ghost",
|
|
50
51
|
size: "icon-sm",
|
|
51
52
|
"aria-label": l("notifications.v2.rowActions", "More for {{name}}", { name: e }),
|
|
52
|
-
children: /* @__PURE__ */ g
|
|
53
|
+
children: /* @__PURE__ */ v(g, {
|
|
53
54
|
size: 16,
|
|
54
55
|
"aria-hidden": "true"
|
|
55
56
|
})
|
|
56
57
|
})
|
|
57
|
-
}), /* @__PURE__ */
|
|
58
|
+
}), /* @__PURE__ */ v(S, {
|
|
58
59
|
align: "end",
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
+
children: /* @__PURE__ */ v(C, {
|
|
60
61
|
disabled: r,
|
|
61
62
|
onSelect: s,
|
|
62
63
|
children: l("notifications.v2.useDefault", "Use default")
|
|
@@ -64,133 +65,139 @@ function E({ title: e, description: t, checked: n, saving: r, feedback: i, onTog
|
|
|
64
65
|
})] })
|
|
65
66
|
]
|
|
66
67
|
})]
|
|
67
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ v("div", {
|
|
68
69
|
className: "min-h-5",
|
|
69
70
|
"aria-live": "polite",
|
|
70
|
-
children: i && /* @__PURE__ */
|
|
71
|
+
children: i && /* @__PURE__ */ v("p", {
|
|
71
72
|
className: `text-xs ${i.type === "success" ? "text-status-success-text" : "text-status-error-text"}`,
|
|
72
73
|
children: i.message
|
|
73
74
|
})
|
|
74
75
|
})]
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
-
return /* @__PURE__ */
|
|
78
|
+
function k({ title: e, description: t, children: n, testId: r }) {
|
|
79
|
+
return /* @__PURE__ */ y("section", {
|
|
79
80
|
"data-tour": r,
|
|
80
81
|
className: "rounded-lg border border-border-seam bg-bg-surface px-4 py-2",
|
|
81
82
|
children: [
|
|
82
|
-
e && /* @__PURE__ */
|
|
83
|
+
e && /* @__PURE__ */ v("h2", {
|
|
83
84
|
className: "pt-2 text-base font-semibold text-text-primary",
|
|
84
85
|
children: e
|
|
85
86
|
}),
|
|
86
|
-
t && /* @__PURE__ */
|
|
87
|
+
t && /* @__PURE__ */ v("p", {
|
|
87
88
|
className: "text-sm text-text-secondary",
|
|
88
89
|
children: t
|
|
89
90
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ v("div", {
|
|
91
92
|
className: "divide-y divide-border-seam",
|
|
92
93
|
children: n
|
|
93
94
|
})
|
|
94
95
|
]
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
let
|
|
98
|
+
function A() {
|
|
99
|
+
let f = a(), { hasPermission: g, isLoading: b } = h(), { currentUser: x } = i(), { topics: S, isLoading: C, isForbidden: w } = t({
|
|
99
100
|
type: "MARKETING",
|
|
100
101
|
isActive: !0
|
|
101
|
-
}), { preferencesByKey:
|
|
102
|
-
let e =
|
|
103
|
-
return e ?
|
|
104
|
-
}, [
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
}), { preferencesByKey: D, savingKey: A, saveFeedback: j, togglePreference: M, resetPreference: N } = r(), [P, F] = m(""), I = p(() => {
|
|
103
|
+
let e = P.trim().toLowerCase();
|
|
104
|
+
return e ? S.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e)) : S;
|
|
105
|
+
}, [P, S]);
|
|
106
|
+
if (b) return /* @__PURE__ */ v(d, {
|
|
107
|
+
minHeight: "16rem",
|
|
108
|
+
today: /* @__PURE__ */ v("div", {
|
|
109
|
+
className: "flex h-64 items-center justify-center",
|
|
110
|
+
children: /* @__PURE__ */ v(u, {
|
|
111
|
+
className: "h-8 w-8",
|
|
112
|
+
today: /* @__PURE__ */ v("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
113
|
+
})
|
|
114
|
+
})
|
|
108
115
|
});
|
|
109
|
-
if (!
|
|
116
|
+
if (!g(e.NOTIFICATION_LIST) && !x?.id) return /* @__PURE__ */ v("div", {
|
|
110
117
|
className: "p-8 text-center text-text-secondary",
|
|
111
|
-
children:
|
|
118
|
+
children: f("notifications.noPermissionPreferences", "You don't have permission to manage notification preferences.")
|
|
112
119
|
});
|
|
113
|
-
let
|
|
114
|
-
let i = n(e), a =
|
|
115
|
-
return /* @__PURE__ */
|
|
120
|
+
let L = (e, t, r = {}) => {
|
|
121
|
+
let i = n(e), a = D.get(i), o = a?.enabled ?? !0;
|
|
122
|
+
return /* @__PURE__ */ v(O, {
|
|
116
123
|
testId: `notification-setting-${i}`,
|
|
117
124
|
title: t,
|
|
118
125
|
description: r.description,
|
|
119
126
|
checked: r.inverted ? !o : o,
|
|
120
|
-
saving:
|
|
121
|
-
feedback:
|
|
122
|
-
onToggle: () => void
|
|
123
|
-
onUseDefault: a ? () => void
|
|
127
|
+
saving: A === i,
|
|
128
|
+
feedback: j?.key === i ? j : null,
|
|
129
|
+
onToggle: () => void M(e),
|
|
130
|
+
onUseDefault: a ? () => void N(i) : void 0
|
|
124
131
|
}, i);
|
|
125
|
-
},
|
|
126
|
-
return /* @__PURE__ */
|
|
132
|
+
}, R = !C && !w && S.length > 0;
|
|
133
|
+
return /* @__PURE__ */ y("div", {
|
|
127
134
|
"data-tour": "notification-preferences-page",
|
|
128
135
|
className: "mx-auto w-full max-w-3xl space-y-4 p-3 sm:space-y-5 sm:p-6",
|
|
129
136
|
children: [
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ v(o, {}),
|
|
138
|
+
/* @__PURE__ */ y("header", { children: [/* @__PURE__ */ v("h1", {
|
|
132
139
|
className: "text-xl font-semibold text-text-primary sm:text-2xl",
|
|
133
|
-
children:
|
|
134
|
-
}), /* @__PURE__ */
|
|
140
|
+
children: f("notifications.v2.settingsTitle", "Notification settings")
|
|
141
|
+
}), /* @__PURE__ */ v("p", {
|
|
135
142
|
className: "mt-1 text-sm text-text-secondary",
|
|
136
|
-
children:
|
|
143
|
+
children: f("notifications.v2.settingsSubtitle", "How and when we reach you.")
|
|
137
144
|
})] }),
|
|
138
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ v(k, {
|
|
139
146
|
testId: "notification-preferences-global",
|
|
140
|
-
children:
|
|
141
|
-
description:
|
|
147
|
+
children: L({ scope: "GLOBAL" }, f("notifications.v2.pauseAll", "Pause all notifications"), {
|
|
148
|
+
description: f("notifications.v2.pauseAllDescription", "Stop every notification on every channel until you turn this off."),
|
|
142
149
|
inverted: !0
|
|
143
150
|
})
|
|
144
151
|
}),
|
|
145
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ v(k, {
|
|
146
153
|
testId: "notification-preferences-channels",
|
|
147
|
-
title:
|
|
148
|
-
children: s.map((e) =>
|
|
154
|
+
title: f("notifications.v2.howToReachYou", "How to reach you"),
|
|
155
|
+
children: s.map((e) => L({
|
|
149
156
|
scope: "CHANNEL",
|
|
150
157
|
channel: e.value
|
|
151
|
-
},
|
|
158
|
+
}, f(e.labelKey, e.label)))
|
|
152
159
|
}),
|
|
153
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ v(E, {
|
|
154
161
|
storageKey: "notifications.settings.more",
|
|
155
|
-
children: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ y("div", {
|
|
156
163
|
className: "space-y-4",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
158
|
-
title:
|
|
159
|
-
children: c.map((e) =>
|
|
164
|
+
children: [/* @__PURE__ */ v(k, {
|
|
165
|
+
title: f("notifications.v2.moreChannels", "Other ways to reach you"),
|
|
166
|
+
children: c.map((e) => L({
|
|
160
167
|
scope: "CHANNEL",
|
|
161
168
|
channel: e.value
|
|
162
|
-
},
|
|
163
|
-
}), /* @__PURE__ */
|
|
169
|
+
}, f(e.labelKey, e.label)))
|
|
170
|
+
}), /* @__PURE__ */ v(k, {
|
|
164
171
|
testId: "notification-preferences-types",
|
|
165
|
-
title:
|
|
166
|
-
children: l.map((e) =>
|
|
172
|
+
title: f("notifications.v2.whatWeSend", "What we send you"),
|
|
173
|
+
children: l.map((e) => L({
|
|
167
174
|
scope: "TYPE",
|
|
168
175
|
type: e.value
|
|
169
|
-
},
|
|
176
|
+
}, f(e.labelKey, e.label)))
|
|
170
177
|
})]
|
|
171
178
|
})
|
|
172
179
|
}),
|
|
173
|
-
|
|
180
|
+
R && /* @__PURE__ */ y(k, {
|
|
174
181
|
testId: "notification-preferences-topics",
|
|
175
|
-
title:
|
|
176
|
-
children: [
|
|
182
|
+
title: f("notifications.v2.optInTopics", "Updates you can opt into"),
|
|
183
|
+
children: [S.length > 5 && /* @__PURE__ */ y("div", {
|
|
177
184
|
className: "relative py-3",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ v(_, {
|
|
179
186
|
size: 16,
|
|
180
187
|
className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary",
|
|
181
188
|
"aria-hidden": "true"
|
|
182
|
-
}), /* @__PURE__ */
|
|
189
|
+
}), /* @__PURE__ */ v(T, {
|
|
183
190
|
type: "search",
|
|
184
|
-
value:
|
|
185
|
-
onChange: (e) =>
|
|
186
|
-
"aria-label":
|
|
187
|
-
placeholder:
|
|
191
|
+
value: P,
|
|
192
|
+
onChange: (e) => F(e.target.value),
|
|
193
|
+
"aria-label": f("notifications.searchTopics", "Search topics..."),
|
|
194
|
+
placeholder: f("notifications.searchTopics", "Search topics..."),
|
|
188
195
|
className: "pl-9"
|
|
189
196
|
})]
|
|
190
|
-
}),
|
|
197
|
+
}), I.length === 0 ? /* @__PURE__ */ v("p", {
|
|
191
198
|
className: "py-3 text-sm text-text-secondary",
|
|
192
|
-
children:
|
|
193
|
-
}) :
|
|
199
|
+
children: f("notifications.noTopicsFound", "No topics match your search")
|
|
200
|
+
}) : I.map((e) => L({
|
|
194
201
|
scope: "TOPIC",
|
|
195
202
|
topicId: e.id
|
|
196
203
|
}, e.name, { description: e.description || void 0 }))]
|
|
@@ -198,6 +205,6 @@ function O() {
|
|
|
198
205
|
]
|
|
199
206
|
});
|
|
200
207
|
}
|
|
201
|
-
export {
|
|
208
|
+
export { A as NotificationSettingsV2 };
|
|
202
209
|
|
|
203
210
|
//# sourceMappingURL=NotificationSettingsV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationSettingsV2.js","names":["SwitchRow","tr","useTr","id","useId","testId","title","description","saving","checked","Switch","onToggle","onUseDefault","DropdownMenu","DropdownMenuTrigger","Button","MoreHorizontal","DropdownMenuContent","DropdownMenuItem","feedback","Section","NotificationSettingsV2","permissionsLoading","usePermissions","useNotification","topicsLoading","topicsForbidden","useNotificationTopics","usePreferenceToggles","search","setSearch","useState","filteredTopics","useMemo","query","topics","topic","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","row","key","preferenceKey","target","existing","preferencesByKey","enabled","options","savingKey","saveFeedback","togglePreference","resetPreference","showTopics","BackToNotifications","EVERYDAY_CHANNELS","channel","OptionalFields","MORE_CHANNELS","TYPES","type","Search","Input","event"],"sources":["../../src/navigation-v2/NotificationSettingsV2.tsx"],"sourcesContent":["import { useId, useMemo, useState } from 'react';\nimport { MoreHorizontal, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n Input,\n OptionalFields,\n Switch,\n} from '@burdenoff/fe-libs/ui';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotificationTopics } from '../hooks';\nimport {\n preferenceKey,\n usePreferenceToggles,\n type PreferenceFeedback,\n type PreferenceTarget,\n} from '../hooks/usePreferenceToggles';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport { BackToNotifications } from './BackToNotifications';\nimport { EVERYDAY_CHANNELS, MORE_CHANNELS, TYPES } from './settingsOptions';\n\ninterface SwitchRowProps {\n title: string;\n description?: string;\n checked: boolean;\n saving: boolean;\n feedback: PreferenceFeedback | null;\n onToggle: () => void;\n /** Present when the person changed this one: \"Use default\" removes their choice. */\n onUseDefault?: () => void;\n testId?: string;\n}\n\nfunction SwitchRow({\n title,\n description,\n checked,\n saving,\n feedback,\n onToggle,\n onUseDefault,\n testId,\n}: SwitchRowProps) {\n const tr = useTr();\n const id = useId();\n return (\n <div className=\"py-3\" data-testid={testId}>\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <label htmlFor={id} className=\"text-sm font-medium text-text-primary\">\n {title}\n </label>\n {description && <p className=\"text-sm text-text-secondary\">{description}</p>}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n <span className=\"w-8 text-right text-sm text-text-secondary\" aria-hidden=\"true\">\n {saving\n ? '…'\n : checked\n ? tr('notifications.v2.on', 'On')\n : tr('notifications.v2.off', 'Off')}\n </span>\n <Switch id={id} checked={checked} disabled={saving} onCheckedChange={onToggle} />\n {onUseDefault && (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={tr('notifications.v2.rowActions', 'More for {{name}}', {\n name: title,\n })}\n >\n <MoreHorizontal size={16} aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem disabled={saving} onSelect={onUseDefault}>\n {tr('notifications.v2.useDefault', 'Use default')}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n </div>\n </div>\n <div className=\"min-h-5\" aria-live=\"polite\">\n {feedback && (\n <p\n className={`text-xs ${feedback.type === 'success' ? 'text-status-success-text' : 'text-status-error-text'}`}\n >\n {feedback.message}\n </p>\n )}\n </div>\n </div>\n );\n}\n\nfunction Section({\n title,\n description,\n children,\n testId,\n}: {\n title?: string;\n description?: string;\n children: React.ReactNode;\n testId?: string;\n}) {\n return (\n <section\n data-tour={testId}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-4 py-2\"\n >\n {title && <h2 className=\"pt-2 text-base font-semibold text-text-primary\">{title}</h2>}\n {description && <p className=\"text-sm text-text-secondary\">{description}</p>}\n <div className=\"divide-y divide-border-seam\">{children}</div>\n </section>\n );\n}\n\n/**\n * Notification settings, Navigation v2 (BOFF-11872, mockup 48): \"how to reach\n * you\" first. \"Pause all notifications\" and the In-app, Email and Push\n * switches lead; SMS, WhatsApp, Slack and the type toggles sit under one\n * \"More options\"; the opt-in topics show only when there are any. \"Reset\" is\n * \"Use default\" in each row's \"⋯\". Every switch makes the same calls as the\n * classic Preferences page.\n */\nexport function NotificationSettingsV2() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n topics,\n isLoading: topicsLoading,\n isForbidden: topicsForbidden,\n } = useNotificationTopics({ type: 'MARKETING', isActive: true });\n const { preferencesByKey, savingKey, saveFeedback, togglePreference, resetPreference } =\n usePreferenceToggles();\n const [search, setSearch] = useState('');\n\n const filteredTopics = useMemo(() => {\n const query = search.trim().toLowerCase();\n if (!query) return topics;\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 const row = (\n target: PreferenceTarget,\n title: string,\n options: { description?: string; inverted?: boolean } = {}\n ) => {\n const key = preferenceKey(target);\n const existing = preferencesByKey.get(key);\n const enabled = existing?.enabled ?? true;\n return (\n <SwitchRow\n key={key}\n testId={`notification-setting-${key}`}\n title={title}\n description={options.description}\n // \"Pause all\" reads the other way round: on means delivery is off.\n checked={options.inverted ? !enabled : enabled}\n saving={savingKey === key}\n feedback={saveFeedback?.key === key ? saveFeedback : null}\n onToggle={() => void togglePreference(target)}\n onUseDefault={existing ? () => void resetPreference(key) : undefined}\n />\n );\n };\n\n const showTopics = !topicsLoading && !topicsForbidden && topics.length > 0;\n\n return (\n <div\n data-tour=\"notification-preferences-page\"\n className=\"mx-auto w-full max-w-3xl space-y-4 p-3 sm:space-y-5 sm:p-6\"\n >\n <BackToNotifications />\n <header>\n <h1 className=\"text-xl font-semibold text-text-primary sm:text-2xl\">\n {tr('notifications.v2.settingsTitle', 'Notification settings')}\n </h1>\n <p className=\"mt-1 text-sm text-text-secondary\">\n {tr('notifications.v2.settingsSubtitle', 'How and when we reach you.')}\n </p>\n </header>\n\n <Section testId=\"notification-preferences-global\">\n {row({ scope: 'GLOBAL' }, tr('notifications.v2.pauseAll', 'Pause all notifications'), {\n description: tr(\n 'notifications.v2.pauseAllDescription',\n 'Stop every notification on every channel until you turn this off.'\n ),\n inverted: true,\n })}\n </Section>\n\n <Section\n testId=\"notification-preferences-channels\"\n title={tr('notifications.v2.howToReachYou', 'How to reach you')}\n >\n {EVERYDAY_CHANNELS.map((channel) =>\n row({ scope: 'CHANNEL', channel: channel.value }, tr(channel.labelKey, channel.label))\n )}\n </Section>\n\n <OptionalFields storageKey=\"notifications.settings.more\">\n <div className=\"space-y-4\">\n <Section title={tr('notifications.v2.moreChannels', 'Other ways to reach you')}>\n {MORE_CHANNELS.map((channel) =>\n row({ scope: 'CHANNEL', channel: channel.value }, tr(channel.labelKey, channel.label))\n )}\n </Section>\n <Section\n testId=\"notification-preferences-types\"\n title={tr('notifications.v2.whatWeSend', 'What we send you')}\n >\n {TYPES.map((type) =>\n row({ scope: 'TYPE', type: type.value }, tr(type.labelKey, type.label))\n )}\n </Section>\n </div>\n </OptionalFields>\n\n {showTopics && (\n <Section\n testId=\"notification-preferences-topics\"\n title={tr('notifications.v2.optInTopics', 'Updates you can opt into')}\n >\n {topics.length > 5 && (\n <div className=\"relative py-3\">\n <Search\n size={16}\n className=\"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\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=\"pl-9\"\n />\n </div>\n )}\n {filteredTopics.length === 0 ? (\n <p className=\"py-3 text-sm text-text-secondary\">\n {tr('notifications.noTopicsFound', 'No topics match your search')}\n </p>\n ) : (\n filteredTopics.map((topic) =>\n row({ scope: 'TOPIC', topicId: topic.id }, topic.name, {\n description: topic.description || undefined,\n })\n )\n )}\n </Section>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,SAASA,EAAU,EACjB,UACA,gBACA,YACA,WACA,aACA,aACA,iBACA,aACiB;CACjB,IAAMC,IAAKC,EAAM,GACXC,IAAKC,EAAM;CACjB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAO,eAAaC;EAAnC,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,SAAD;KAAO,SAASF;KAAI,WAAU;KAC3B,UAAAG;IACI,CAAA,GACNC,KAAe,kBAAC,KAAD;KAAG,WAAU;KAA+B,UAAAA;IAAe,CAAA,CACxE;GACL,CAAA,GAAA,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,kBAAC,QAAD;MAAM,WAAU;MAA6C,eAAY;MACtE,UAAAC,IACG,MACAC,IACER,EAAG,uBAAuB,IAAI,IAC9BA,EAAG,wBAAwB,KAAK;KAClC,CAAA;KACN,kBAACS,GAAD;MAAY;MAAa;MAAS,UAAUF;MAAQ,iBAAiBG;KAAW,CAAA;KAC/EC,KACC,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;MAAqB,SAAA;MACnB,UAAA,kBAACC,GAAD;OACE,SAAQ;OACR,MAAK;OACL,cAAYd,EAAG,+BAA+B,qBAAqB,E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,WAAU;KACX,CAAA,CACE;IAEN,CAAA,GAAA+B,EAAe,WAAW,IACzB,kBAAC,KAAD;KAAG,WAAU;KACV,UAAA/B,EAAG,+BAA+B,6BAA6B;IAC/D,CAAA,IAEH+B,EAAe,KAAK,MAClBQ,EAAI;KAAE,OAAO;KAAS,SAASJ,EAAM;IAAG,GAAGA,EAAM,MAAM,EACrD,aAAaA,EAAM,eAAe,KAAA,EACpC,CAAC,CACH,CAEK;;EAER;;AAET"}
|
|
1
|
+
{"version":3,"file":"NotificationSettingsV2.js","names":["SwitchRow","tr","useTr","id","useId","testId","title","description","saving","checked","Switch","onToggle","onUseDefault","DropdownMenu","DropdownMenuTrigger","Button","MoreHorizontal","DropdownMenuContent","DropdownMenuItem","feedback","Section","NotificationSettingsV2","permissionsLoading","usePermissions","useNotification","topicsLoading","topicsForbidden","useNotificationTopics","usePreferenceToggles","search","setSearch","useState","filteredTopics","useMemo","query","topics","topic","SectionLoaderOr","CompactMarkOr","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","row","key","preferenceKey","target","existing","preferencesByKey","enabled","options","savingKey","saveFeedback","togglePreference","resetPreference","showTopics","BackToNotifications","EVERYDAY_CHANNELS","channel","OptionalFields","MORE_CHANNELS","TYPES","type","Search","Input","event"],"sources":["../../src/navigation-v2/NotificationSettingsV2.tsx"],"sourcesContent":["import { useId, useMemo, useState } from 'react';\nimport { MoreHorizontal, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n Input,\n OptionalFields,\n Switch,\n} from '@burdenoff/fe-libs/ui';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotificationTopics } from '../hooks';\nimport {\n preferenceKey,\n usePreferenceToggles,\n type PreferenceFeedback,\n type PreferenceTarget,\n} from '../hooks/usePreferenceToggles';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport { BackToNotifications } from './BackToNotifications';\nimport { EVERYDAY_CHANNELS, MORE_CHANNELS, TYPES } from './settingsOptions';\nimport { CompactMarkOr, SectionLoaderOr } from '../components/loadingSystem';\n\ninterface SwitchRowProps {\n title: string;\n description?: string;\n checked: boolean;\n saving: boolean;\n feedback: PreferenceFeedback | null;\n onToggle: () => void;\n /** Present when the person changed this one: \"Use default\" removes their choice. */\n onUseDefault?: () => void;\n testId?: string;\n}\n\nfunction SwitchRow({\n title,\n description,\n checked,\n saving,\n feedback,\n onToggle,\n onUseDefault,\n testId,\n}: SwitchRowProps) {\n const tr = useTr();\n const id = useId();\n return (\n <div className=\"py-3\" data-testid={testId}>\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <label htmlFor={id} className=\"text-sm font-medium text-text-primary\">\n {title}\n </label>\n {description && <p className=\"text-sm text-text-secondary\">{description}</p>}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n <span className=\"w-8 text-right text-sm text-text-secondary\" aria-hidden=\"true\">\n {saving\n ? '…'\n : checked\n ? tr('notifications.v2.on', 'On')\n : tr('notifications.v2.off', 'Off')}\n </span>\n <Switch id={id} checked={checked} disabled={saving} onCheckedChange={onToggle} />\n {onUseDefault && (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={tr('notifications.v2.rowActions', 'More for {{name}}', {\n name: title,\n })}\n >\n <MoreHorizontal size={16} aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem disabled={saving} onSelect={onUseDefault}>\n {tr('notifications.v2.useDefault', 'Use default')}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n </div>\n </div>\n <div className=\"min-h-5\" aria-live=\"polite\">\n {feedback && (\n <p\n className={`text-xs ${feedback.type === 'success' ? 'text-status-success-text' : 'text-status-error-text'}`}\n >\n {feedback.message}\n </p>\n )}\n </div>\n </div>\n );\n}\n\nfunction Section({\n title,\n description,\n children,\n testId,\n}: {\n title?: string;\n description?: string;\n children: React.ReactNode;\n testId?: string;\n}) {\n return (\n <section\n data-tour={testId}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-4 py-2\"\n >\n {title && <h2 className=\"pt-2 text-base font-semibold text-text-primary\">{title}</h2>}\n {description && <p className=\"text-sm text-text-secondary\">{description}</p>}\n <div className=\"divide-y divide-border-seam\">{children}</div>\n </section>\n );\n}\n\n/**\n * Notification settings, Navigation v2 (BOFF-11872, mockup 48): \"how to reach\n * you\" first. \"Pause all notifications\" and the In-app, Email and Push\n * switches lead; SMS, WhatsApp, Slack and the type toggles sit under one\n * \"More options\"; the opt-in topics show only when there are any. \"Reset\" is\n * \"Use default\" in each row's \"⋯\". Every switch makes the same calls as the\n * classic Preferences page.\n */\nexport function NotificationSettingsV2() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n topics,\n isLoading: topicsLoading,\n isForbidden: topicsForbidden,\n } = useNotificationTopics({ type: 'MARKETING', isActive: true });\n const { preferencesByKey, savingKey, saveFeedback, togglePreference, resetPreference } =\n usePreferenceToggles();\n const [search, setSearch] = useState('');\n\n const filteredTopics = useMemo(() => {\n const query = search.trim().toLowerCase();\n if (!query) return topics;\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 <SectionLoaderOr\n minHeight=\"16rem\"\n today={\n <div className=\"flex h-64 items-center justify-center\">\n <CompactMarkOr\n className=\"h-8 w-8\"\n today={\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n }\n />\n </div>\n }\n />\n );\n }\n\n 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 const row = (\n target: PreferenceTarget,\n title: string,\n options: { description?: string; inverted?: boolean } = {}\n ) => {\n const key = preferenceKey(target);\n const existing = preferencesByKey.get(key);\n const enabled = existing?.enabled ?? true;\n return (\n <SwitchRow\n key={key}\n testId={`notification-setting-${key}`}\n title={title}\n description={options.description}\n // \"Pause all\" reads the other way round: on means delivery is off.\n checked={options.inverted ? !enabled : enabled}\n saving={savingKey === key}\n feedback={saveFeedback?.key === key ? saveFeedback : null}\n onToggle={() => void togglePreference(target)}\n onUseDefault={existing ? () => void resetPreference(key) : undefined}\n />\n );\n };\n\n const showTopics = !topicsLoading && !topicsForbidden && topics.length > 0;\n\n return (\n <div\n data-tour=\"notification-preferences-page\"\n className=\"mx-auto w-full max-w-3xl space-y-4 p-3 sm:space-y-5 sm:p-6\"\n >\n <BackToNotifications />\n <header>\n <h1 className=\"text-xl font-semibold text-text-primary sm:text-2xl\">\n {tr('notifications.v2.settingsTitle', 'Notification settings')}\n </h1>\n <p className=\"mt-1 text-sm text-text-secondary\">\n {tr('notifications.v2.settingsSubtitle', 'How and when we reach you.')}\n </p>\n </header>\n\n <Section testId=\"notification-preferences-global\">\n {row({ scope: 'GLOBAL' }, tr('notifications.v2.pauseAll', 'Pause all notifications'), {\n description: tr(\n 'notifications.v2.pauseAllDescription',\n 'Stop every notification on every channel until you turn this off.'\n ),\n inverted: true,\n })}\n </Section>\n\n <Section\n testId=\"notification-preferences-channels\"\n title={tr('notifications.v2.howToReachYou', 'How to reach you')}\n >\n {EVERYDAY_CHANNELS.map((channel) =>\n row({ scope: 'CHANNEL', channel: channel.value }, tr(channel.labelKey, channel.label))\n )}\n </Section>\n\n <OptionalFields storageKey=\"notifications.settings.more\">\n <div className=\"space-y-4\">\n <Section title={tr('notifications.v2.moreChannels', 'Other ways to reach you')}>\n {MORE_CHANNELS.map((channel) =>\n row({ scope: 'CHANNEL', channel: channel.value }, tr(channel.labelKey, channel.label))\n )}\n </Section>\n <Section\n testId=\"notification-preferences-types\"\n title={tr('notifications.v2.whatWeSend', 'What we send you')}\n >\n {TYPES.map((type) =>\n row({ scope: 'TYPE', type: type.value }, tr(type.labelKey, type.label))\n )}\n </Section>\n </div>\n </OptionalFields>\n\n {showTopics && (\n <Section\n testId=\"notification-preferences-topics\"\n title={tr('notifications.v2.optInTopics', 'Updates you can opt into')}\n >\n {topics.length > 5 && (\n <div className=\"relative py-3\">\n <Search\n size={16}\n className=\"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\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=\"pl-9\"\n />\n </div>\n )}\n {filteredTopics.length === 0 ? (\n <p className=\"py-3 text-sm text-text-secondary\">\n {tr('notifications.noTopicsFound', 'No topics match your search')}\n </p>\n ) : (\n filteredTopics.map((topic) =>\n row({ scope: 'TOPIC', topicId: topic.id }, topic.name, {\n description: topic.description || undefined,\n })\n )\n )}\n </Section>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuCA,SAASA,EAAU,EACjB,UACA,gBACA,YACA,WACA,aACA,aACA,iBACA,aACiB;CACjB,IAAMC,IAAKC,EAAM,GACXC,IAAKC,EAAM;CACjB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAO,eAAaC;EAAnC,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,SAAD;KAAO,SAASF;KAAI,WAAU;KAC3B,UAAAG;IACI,CAAA,GACNC,KAAe,kBAAC,KAAD;KAAG,WAAU;KAA+B,UAAAA;IAAe,CAAA,CACxE;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EAAI;OAAE,OAAO;OAAQ,MAAMmB,EAAK;MAAM,GAAG5D,EAAG4D,EAAK,UAAUA,EAAK,KAAK,CAAC,CACxE;KACO,CAAA,CACN;;GACS,CAAA;GAEfP,KACC,kBAAClC,GAAD;IACE,QAAO;IACP,OAAOnB,EAAG,gCAAgC,0BAA0B;IAFtE,UAAA,CAIGkC,EAAO,SAAS,KACf,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC2B,GAAD;MACE,MAAM;MACN,WAAU;MACV,eAAY;KACb,CAAA,GACD,kBAACC,GAAD;MACE,MAAK;MACL,OAAOlC;MACP,WAAW,MAAUC,EAAUkC,EAAM,OAAO,KAAK;MACjD,cAAY/D,EAAG,8BAA8B,kBAAkB;MAC/D,aAAaA,EAAG,8BAA8B,kBAAkB;MAChE,WAAU;KACX,CAAA,CACE;IAEN,CAAA,GAAA+B,EAAe,WAAW,IACzB,kBAAC,KAAD;KAAG,WAAU;KACV,UAAA/B,EAAG,+BAA+B,6BAA6B;IAC/D,CAAA,IAEH+B,EAAe,KAAK,MAClBU,EAAI;KAAE,OAAO;KAAS,SAASN,EAAM;IAAG,GAAGA,EAAM,MAAM,EACrD,aAAaA,EAAM,eAAe,KAAA,EACpC,CAAC,CACH,CAEK;;EAER;;AAET"}
|
|
@@ -1,41 +1,49 @@
|
|
|
1
1
|
import { NotificationCenterPage as e } from "../pages/NotificationCenterPage.js";
|
|
2
2
|
import { AdminPageV2 as t } from "./AdminPageV2.js";
|
|
3
3
|
import { useNotificationPaths as n } from "./paths.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { CompactMarkOr as r, SectionLoaderOr as i } from "../components/loadingSystem.js";
|
|
5
|
+
import { Suspense as a, lazy as o } from "react";
|
|
6
|
+
import { useFeatureFlagDetails as s } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
7
|
+
import { Navigate as c, useSearchParams as l } from "react-router";
|
|
8
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
8
9
|
// src/navigation-v2/NotificationsV2Landing.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
var d = o(() => import("../pages/NotificationHistoryAdminPage.js").then((e) => ({ default: e.NotificationHistoryAdminPage })));
|
|
11
|
+
function f() {
|
|
12
|
+
return /* @__PURE__ */ u(i, {
|
|
13
|
+
route: !0,
|
|
14
|
+
minHeight: "16rem",
|
|
15
|
+
today: /* @__PURE__ */ u("div", {
|
|
16
|
+
className: "flex h-64 items-center justify-center",
|
|
17
|
+
children: /* @__PURE__ */ u(r, {
|
|
18
|
+
className: "h-8 w-8",
|
|
19
|
+
today: /* @__PURE__ */ u("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
20
|
+
})
|
|
21
|
+
})
|
|
14
22
|
});
|
|
15
23
|
}
|
|
16
|
-
function
|
|
17
|
-
let n =
|
|
18
|
-
return n && n.value ? /* @__PURE__ */
|
|
24
|
+
function p() {
|
|
25
|
+
let n = s("notification.history");
|
|
26
|
+
return n && n.value ? /* @__PURE__ */ u(t, {
|
|
19
27
|
tool: "deliveryLog",
|
|
20
|
-
children: /* @__PURE__ */
|
|
21
|
-
fallback: /* @__PURE__ */
|
|
22
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ u(a, {
|
|
29
|
+
fallback: /* @__PURE__ */ u(f, {}),
|
|
30
|
+
children: /* @__PURE__ */ u(d, {})
|
|
23
31
|
})
|
|
24
|
-
}) : /* @__PURE__ */
|
|
32
|
+
}) : /* @__PURE__ */ u(e, {});
|
|
25
33
|
}
|
|
26
|
-
function
|
|
27
|
-
let [t] =
|
|
28
|
-
return i === "send" ? /* @__PURE__ */ c
|
|
34
|
+
function m() {
|
|
35
|
+
let [t] = l(), r = n(), i = t.get("tab");
|
|
36
|
+
return i === "send" ? /* @__PURE__ */ u(c, {
|
|
29
37
|
to: r.send,
|
|
30
38
|
replace: !0
|
|
31
|
-
}) : i === "templates" ? /* @__PURE__ */ c
|
|
39
|
+
}) : i === "templates" ? /* @__PURE__ */ u(c, {
|
|
32
40
|
to: r.templates,
|
|
33
41
|
replace: !0
|
|
34
|
-
}) : i === "topics" ? /* @__PURE__ */ c
|
|
42
|
+
}) : i === "topics" ? /* @__PURE__ */ u(c, {
|
|
35
43
|
to: r.topics,
|
|
36
44
|
replace: !0
|
|
37
|
-
}) :
|
|
45
|
+
}) : u(i === "history" ? p : e, {});
|
|
38
46
|
}
|
|
39
|
-
export {
|
|
47
|
+
export { p as DeliveryLogV2, m as NotificationsV2Landing };
|
|
40
48
|
|
|
41
49
|
//# sourceMappingURL=NotificationsV2Landing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsV2Landing.js","names":["NotificationHistoryAdminPage","lazy","m","PageLoader","DeliveryLogV2","historyDetails","useFeatureFlagDetails","AdminPageV2","Suspense","NotificationCenterPage","NotificationsV2Landing","params","useSearchParams","paths","useNotificationPaths","tab","Navigate","jsx"],"sources":["../../src/navigation-v2/NotificationsV2Landing.tsx"],"sourcesContent":["import { Suspense, lazy } from 'react';\nimport { Navigate, useSearchParams } from 'react-router';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { NotificationCenterPage } from '../pages/NotificationCenterPage';\nimport { AdminPageV2 } from './AdminPageV2';\nimport { useNotificationPaths } from './paths';\n\nconst NotificationHistoryAdminPage = lazy(() =>\n import('../pages/NotificationHistoryAdminPage').then((m) => ({\n default: m.NotificationHistoryAdminPage,\n }))\n);\n\nfunction PageLoader() {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n
|
|
1
|
+
{"version":3,"file":"NotificationsV2Landing.js","names":["NotificationHistoryAdminPage","lazy","m","PageLoader","SectionLoaderOr","CompactMarkOr","DeliveryLogV2","historyDetails","useFeatureFlagDetails","AdminPageV2","Suspense","NotificationCenterPage","NotificationsV2Landing","params","useSearchParams","paths","useNotificationPaths","tab","Navigate","jsx"],"sources":["../../src/navigation-v2/NotificationsV2Landing.tsx"],"sourcesContent":["import { Suspense, lazy } from 'react';\nimport { Navigate, useSearchParams } from 'react-router';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { NotificationCenterPage } from '../pages/NotificationCenterPage';\nimport { AdminPageV2 } from './AdminPageV2';\nimport { useNotificationPaths } from './paths';\nimport { CompactMarkOr, SectionLoaderOr } from '../components/loadingSystem';\n\nconst NotificationHistoryAdminPage = lazy(() =>\n import('../pages/NotificationHistoryAdminPage').then((m) => ({\n default: m.NotificationHistoryAdminPage,\n }))\n);\n\nfunction PageLoader() {\n return (\n <SectionLoaderOr\n route\n minHeight=\"16rem\"\n today={\n <div className=\"flex h-64 items-center justify-center\">\n <CompactMarkOr\n className=\"h-8 w-8\"\n today={\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n }\n />\n </div>\n }\n />\n );\n}\n\n/**\n * The Delivery log (the Operations console, BOFF-11872). It opens, as on the\n * old landing's `?tab=history`, only while `notification.history` is on, and\n * behind the route-level permission gate; with the flag off the inbox shows\n * in its place (the URL is kept, so the page appears once the flag loads).\n */\nexport function DeliveryLogV2() {\n const historyDetails = useFeatureFlagDetails('notification.history');\n const historyEnabled = historyDetails ? Boolean(historyDetails.value) : false;\n if (!historyEnabled) return <NotificationCenterPage />;\n return (\n <AdminPageV2 tool=\"deliveryLog\">\n <Suspense fallback={<PageLoader />}>\n <NotificationHistoryAdminPage />\n </Suspense>\n </AdminPageV2>\n );\n}\n\n/**\n * `/notifications` under Navigation v2 (BOFF-11872): straight on the inbox,\n * no tab strip. Every old `?tab=` value still opens its page: `send`,\n * `templates` and `topics` go to their own routes, `history` is the Delivery\n * log (also at its own route, `delivery-log`), and `inbox` or anything\n * unknown is the inbox.\n */\nexport function NotificationsV2Landing() {\n const [params] = useSearchParams();\n const paths = useNotificationPaths();\n const tab = params.get('tab');\n\n if (tab === 'send') return <Navigate to={paths.send} replace />;\n if (tab === 'templates') return <Navigate to={paths.templates} replace />;\n if (tab === 'topics') return <Navigate to={paths.topics} replace />;\n if (tab === 'history') return <DeliveryLogV2 />;\n return <NotificationCenterPage />;\n}\n"],"mappings":";;;;;;;;;AAQA,IAAMA,IAA+BC,QACnC,OAAO,2CAAwC,CAAC,MAAM,OAAO,EAC3D,SAASC,EAAE,6BACb,EAAE,CACJ;AAEA,SAASC,IAAa;CACpB,OACE,kBAACC,GAAD;EACE,OAAA;EACA,WAAU;EACV,OACE,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAACC,GAAD;IACE,WAAU;IACV,OACE,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;GAEpG,CAAA;EACE,CAAA;CAER,CAAA;AAEL;AAQA,SAAgBC,IAAgB;CAC9B,IAAMC,IAAiBC,EAAsB,sBAAsB;CAGnE,OAFuBD,KAAyBA,EAAe,QAG7D,kBAACE,GAAD;EAAa,MAAK;EAChB,UAAA,kBAACC,GAAD;GAAU,UAAU,kBAACP,GAAD,CAAa,CAAA;GAC/B,UAAA,kBAACH,GAAD,CAA+B,CAAA;EACvB,CAAA;CACC,CAAA,IANa,kBAACW,GAAD,CAAyB,CAAA;AAQvD;AASA,SAAgBC,IAAyB;CACvC,IAAM,CAACC,KAAUC,EAAgB,GAC3BC,IAAQC,EAAqB,GAC7BC,IAAMJ,EAAO,IAAI,KAAK;CAM5B,OAJII,MAAQ,SAAe,kBAACC,GAAD;EAAU,IAAIH,EAAM;EAAM,SAAA;CAAS,CAAA,IAC1DE,MAAQ,cAAoB,kBAACC,GAAD;EAAU,IAAIH,EAAM;EAAW,SAAA;CAAS,CAAA,IACpEE,MAAQ,WAAiB,kBAACC,GAAD;EAAU,IAAIH,EAAM;EAAQ,SAAA;CAAS,CAAA,IACpCI,EAA1BF,MAAQ,YAAmBX,IACvBK,GADsB,CAAgB,CAAA;AAEhD"}
|