@burdenoff/microfe-notification 2026.1124.1 → 2026.1127.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/NotificationPanel.js +0 -1
- package/dist/components/NotificationPanel.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/graphql/global-client.js +34 -34
- package/dist/index.js +9 -11
- package/dist/navigation-v2/AdminPageV2.js +23 -16
- package/dist/navigation-v2/AdminPageV2.js.map +1 -1
- package/dist/navigation-v2/NotificationArchivedV2.js +104 -98
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
- package/dist/navigation-v2/NotificationInboxV2.js +133 -127
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
- package/dist/navigation-v2/NotificationSettingsV2.js +91 -85
- 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 +93 -87
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +231 -225
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +72 -66
- 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 -71
- 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 -118
- 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 +5 -2
- package/dist/components/index.js +0 -4
- package/dist/hooks/index.js +0 -8
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +0 -23
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +0 -1
- package/dist/node_modules/@apollo/client/errors/utils.js +0 -15
- package/dist/node_modules/@apollo/client/errors/utils.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +0 -51
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js +0 -40
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js +0 -33
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -5
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js +0 -15
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js +0 -18
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +0 -20
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +0 -16
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +0 -7
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +0 -7
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +0 -22
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +0 -56
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +0 -1
- package/dist/node_modules/@apollo/client/version.js +0 -5
- package/dist/node_modules/@apollo/client/version.js.map +0 -1
- package/dist/node_modules/@wry/caches/lib/weak.js +0 -66
- package/dist/node_modules/@wry/caches/lib/weak.js.map +0 -1
- package/dist/node_modules/@wry/trie/lib/index.js +0 -52
- package/dist/node_modules/@wry/trie/lib/index.js.map +0 -1
- package/dist/node_modules/graphql-ws/dist/client.js +0 -279
- package/dist/node_modules/graphql-ws/dist/client.js.map +0 -1
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +0 -61
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +0 -20
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -77
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -116
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -96
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -11
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +0 -8
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -15
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -12
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -21
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -12
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -13
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +0 -1
- package/dist/node_modules/tslib/tslib.es6.js +0 -51
- package/dist/node_modules/tslib/tslib.es6.js.map +0 -1
|
@@ -1,62 +1,62 @@
|
|
|
1
1
|
import { NOTIFICATION_PERMISSIONS as e } from "../constants/permissions.js";
|
|
2
2
|
import { useNotificationTopics as t } from "../hooks/useNotificationTopics.js";
|
|
3
|
-
import "../hooks/index.js";
|
|
4
3
|
import { preferenceKey as n, usePreferenceToggles as r } from "../hooks/usePreferenceToggles.js";
|
|
5
4
|
import { useNotification as i } from "../providers/NotificationProvider.js";
|
|
6
5
|
import { useTr as a } from "../shared/hooks/useTr.js";
|
|
7
6
|
import { BackToNotifications as o } from "./BackToNotifications.js";
|
|
8
7
|
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 {
|
|
8
|
+
import { CompactMarkOr as u, SectionLoaderOr as d } from "../components/loadingSystem.js";
|
|
9
|
+
import { useId as f, useMemo as p, useState as m } from "react";
|
|
10
|
+
import { usePermissions as h } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
|
+
import { MoreHorizontal as g, Search as _ } from "lucide-react";
|
|
12
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
13
|
+
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
14
|
// src/navigation-v2/NotificationSettingsV2.tsx
|
|
15
|
-
function
|
|
16
|
-
let l = a(),
|
|
17
|
-
return /* @__PURE__ */
|
|
15
|
+
function O({ title: e, description: t, checked: n, saving: r, feedback: i, onToggle: o, onUseDefault: s, testId: c }) {
|
|
16
|
+
let l = a(), u = f();
|
|
17
|
+
return /* @__PURE__ */ y("div", {
|
|
18
18
|
className: "py-3",
|
|
19
19
|
"data-testid": c,
|
|
20
|
-
children: [/* @__PURE__ */
|
|
20
|
+
children: [/* @__PURE__ */ y("div", {
|
|
21
21
|
className: "flex items-center justify-between gap-3",
|
|
22
|
-
children: [/* @__PURE__ */
|
|
22
|
+
children: [/* @__PURE__ */ y("div", {
|
|
23
23
|
className: "min-w-0",
|
|
24
|
-
children: [/* @__PURE__ */
|
|
25
|
-
htmlFor:
|
|
24
|
+
children: [/* @__PURE__ */ v("label", {
|
|
25
|
+
htmlFor: u,
|
|
26
26
|
className: "text-sm font-medium text-text-primary",
|
|
27
27
|
children: e
|
|
28
|
-
}), t && /* @__PURE__ */
|
|
28
|
+
}), t && /* @__PURE__ */ v("p", {
|
|
29
29
|
className: "text-sm text-text-secondary",
|
|
30
30
|
children: t
|
|
31
31
|
})]
|
|
32
|
-
}), /* @__PURE__ */
|
|
32
|
+
}), /* @__PURE__ */ y("div", {
|
|
33
33
|
className: "flex shrink-0 items-center gap-2",
|
|
34
34
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ v("span", {
|
|
36
36
|
className: "w-8 text-right text-sm text-text-secondary",
|
|
37
37
|
"aria-hidden": "true",
|
|
38
38
|
children: r ? "…" : n ? l("notifications.v2.on", "On") : l("notifications.v2.off", "Off")
|
|
39
39
|
}),
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
id:
|
|
40
|
+
/* @__PURE__ */ v(D, {
|
|
41
|
+
id: u,
|
|
42
42
|
checked: n,
|
|
43
43
|
disabled: r,
|
|
44
44
|
onCheckedChange: o
|
|
45
45
|
}),
|
|
46
|
-
s && /* @__PURE__ */
|
|
46
|
+
s && /* @__PURE__ */ y(x, { children: [/* @__PURE__ */ v(w, {
|
|
47
47
|
asChild: !0,
|
|
48
|
-
children: /* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ v(b, {
|
|
49
49
|
variant: "ghost",
|
|
50
50
|
size: "icon-sm",
|
|
51
51
|
"aria-label": l("notifications.v2.rowActions", "More for {{name}}", { name: e }),
|
|
52
|
-
children: /* @__PURE__ */ g
|
|
52
|
+
children: /* @__PURE__ */ v(g, {
|
|
53
53
|
size: 16,
|
|
54
54
|
"aria-hidden": "true"
|
|
55
55
|
})
|
|
56
56
|
})
|
|
57
|
-
}), /* @__PURE__ */
|
|
57
|
+
}), /* @__PURE__ */ v(S, {
|
|
58
58
|
align: "end",
|
|
59
|
-
children: /* @__PURE__ */
|
|
59
|
+
children: /* @__PURE__ */ v(C, {
|
|
60
60
|
disabled: r,
|
|
61
61
|
onSelect: s,
|
|
62
62
|
children: l("notifications.v2.useDefault", "Use default")
|
|
@@ -64,133 +64,139 @@ function E({ title: e, description: t, checked: n, saving: r, feedback: i, onTog
|
|
|
64
64
|
})] })
|
|
65
65
|
]
|
|
66
66
|
})]
|
|
67
|
-
}), /* @__PURE__ */
|
|
67
|
+
}), /* @__PURE__ */ v("div", {
|
|
68
68
|
className: "min-h-5",
|
|
69
69
|
"aria-live": "polite",
|
|
70
|
-
children: i && /* @__PURE__ */
|
|
70
|
+
children: i && /* @__PURE__ */ v("p", {
|
|
71
71
|
className: `text-xs ${i.type === "success" ? "text-status-success-text" : "text-status-error-text"}`,
|
|
72
72
|
children: i.message
|
|
73
73
|
})
|
|
74
74
|
})]
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return /* @__PURE__ */
|
|
77
|
+
function k({ title: e, description: t, children: n, testId: r }) {
|
|
78
|
+
return /* @__PURE__ */ y("section", {
|
|
79
79
|
"data-tour": r,
|
|
80
80
|
className: "rounded-lg border border-border-seam bg-bg-surface px-4 py-2",
|
|
81
81
|
children: [
|
|
82
|
-
e && /* @__PURE__ */
|
|
82
|
+
e && /* @__PURE__ */ v("h2", {
|
|
83
83
|
className: "pt-2 text-base font-semibold text-text-primary",
|
|
84
84
|
children: e
|
|
85
85
|
}),
|
|
86
|
-
t && /* @__PURE__ */
|
|
86
|
+
t && /* @__PURE__ */ v("p", {
|
|
87
87
|
className: "text-sm text-text-secondary",
|
|
88
88
|
children: t
|
|
89
89
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ v("div", {
|
|
91
91
|
className: "divide-y divide-border-seam",
|
|
92
92
|
children: n
|
|
93
93
|
})
|
|
94
94
|
]
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
let
|
|
97
|
+
function A() {
|
|
98
|
+
let f = a(), { hasPermission: g, isLoading: b } = h(), { currentUser: x } = i(), { topics: S, isLoading: C, isForbidden: w } = t({
|
|
99
99
|
type: "MARKETING",
|
|
100
100
|
isActive: !0
|
|
101
|
-
}), { preferencesByKey:
|
|
102
|
-
let e =
|
|
103
|
-
return e ?
|
|
104
|
-
}, [
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
}), { preferencesByKey: D, savingKey: A, saveFeedback: j, togglePreference: M, resetPreference: N } = r(), [P, F] = m(""), I = p(() => {
|
|
102
|
+
let e = P.trim().toLowerCase();
|
|
103
|
+
return e ? S.filter((t) => t.name.toLowerCase().includes(e) || t.slug.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e)) : S;
|
|
104
|
+
}, [P, S]);
|
|
105
|
+
if (b) return /* @__PURE__ */ v(d, {
|
|
106
|
+
minHeight: "16rem",
|
|
107
|
+
today: /* @__PURE__ */ v("div", {
|
|
108
|
+
className: "flex h-64 items-center justify-center",
|
|
109
|
+
children: /* @__PURE__ */ v(u, {
|
|
110
|
+
className: "h-8 w-8",
|
|
111
|
+
today: /* @__PURE__ */ v("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
112
|
+
})
|
|
113
|
+
})
|
|
108
114
|
});
|
|
109
|
-
if (!
|
|
115
|
+
if (!g(e.NOTIFICATION_LIST) && !x?.id) return /* @__PURE__ */ v("div", {
|
|
110
116
|
className: "p-8 text-center text-text-secondary",
|
|
111
|
-
children:
|
|
117
|
+
children: f("notifications.noPermissionPreferences", "You don't have permission to manage notification preferences.")
|
|
112
118
|
});
|
|
113
|
-
let
|
|
114
|
-
let i = n(e), a =
|
|
115
|
-
return /* @__PURE__ */
|
|
119
|
+
let L = (e, t, r = {}) => {
|
|
120
|
+
let i = n(e), a = D.get(i), o = a?.enabled ?? !0;
|
|
121
|
+
return /* @__PURE__ */ v(O, {
|
|
116
122
|
testId: `notification-setting-${i}`,
|
|
117
123
|
title: t,
|
|
118
124
|
description: r.description,
|
|
119
125
|
checked: r.inverted ? !o : o,
|
|
120
|
-
saving:
|
|
121
|
-
feedback:
|
|
122
|
-
onToggle: () => void
|
|
123
|
-
onUseDefault: a ? () => void
|
|
126
|
+
saving: A === i,
|
|
127
|
+
feedback: j?.key === i ? j : null,
|
|
128
|
+
onToggle: () => void M(e),
|
|
129
|
+
onUseDefault: a ? () => void N(i) : void 0
|
|
124
130
|
}, i);
|
|
125
|
-
},
|
|
126
|
-
return /* @__PURE__ */
|
|
131
|
+
}, R = !C && !w && S.length > 0;
|
|
132
|
+
return /* @__PURE__ */ y("div", {
|
|
127
133
|
"data-tour": "notification-preferences-page",
|
|
128
134
|
className: "mx-auto w-full max-w-3xl space-y-4 p-3 sm:space-y-5 sm:p-6",
|
|
129
135
|
children: [
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ v(o, {}),
|
|
137
|
+
/* @__PURE__ */ y("header", { children: [/* @__PURE__ */ v("h1", {
|
|
132
138
|
className: "text-xl font-semibold text-text-primary sm:text-2xl",
|
|
133
|
-
children:
|
|
134
|
-
}), /* @__PURE__ */
|
|
139
|
+
children: f("notifications.v2.settingsTitle", "Notification settings")
|
|
140
|
+
}), /* @__PURE__ */ v("p", {
|
|
135
141
|
className: "mt-1 text-sm text-text-secondary",
|
|
136
|
-
children:
|
|
142
|
+
children: f("notifications.v2.settingsSubtitle", "How and when we reach you.")
|
|
137
143
|
})] }),
|
|
138
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ v(k, {
|
|
139
145
|
testId: "notification-preferences-global",
|
|
140
|
-
children:
|
|
141
|
-
description:
|
|
146
|
+
children: L({ scope: "GLOBAL" }, f("notifications.v2.pauseAll", "Pause all notifications"), {
|
|
147
|
+
description: f("notifications.v2.pauseAllDescription", "Stop every notification on every channel until you turn this off."),
|
|
142
148
|
inverted: !0
|
|
143
149
|
})
|
|
144
150
|
}),
|
|
145
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ v(k, {
|
|
146
152
|
testId: "notification-preferences-channels",
|
|
147
|
-
title:
|
|
148
|
-
children: s.map((e) =>
|
|
153
|
+
title: f("notifications.v2.howToReachYou", "How to reach you"),
|
|
154
|
+
children: s.map((e) => L({
|
|
149
155
|
scope: "CHANNEL",
|
|
150
156
|
channel: e.value
|
|
151
|
-
},
|
|
157
|
+
}, f(e.labelKey, e.label)))
|
|
152
158
|
}),
|
|
153
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ v(E, {
|
|
154
160
|
storageKey: "notifications.settings.more",
|
|
155
|
-
children: /* @__PURE__ */
|
|
161
|
+
children: /* @__PURE__ */ y("div", {
|
|
156
162
|
className: "space-y-4",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
158
|
-
title:
|
|
159
|
-
children: c.map((e) =>
|
|
163
|
+
children: [/* @__PURE__ */ v(k, {
|
|
164
|
+
title: f("notifications.v2.moreChannels", "Other ways to reach you"),
|
|
165
|
+
children: c.map((e) => L({
|
|
160
166
|
scope: "CHANNEL",
|
|
161
167
|
channel: e.value
|
|
162
|
-
},
|
|
163
|
-
}), /* @__PURE__ */
|
|
168
|
+
}, f(e.labelKey, e.label)))
|
|
169
|
+
}), /* @__PURE__ */ v(k, {
|
|
164
170
|
testId: "notification-preferences-types",
|
|
165
|
-
title:
|
|
166
|
-
children: l.map((e) =>
|
|
171
|
+
title: f("notifications.v2.whatWeSend", "What we send you"),
|
|
172
|
+
children: l.map((e) => L({
|
|
167
173
|
scope: "TYPE",
|
|
168
174
|
type: e.value
|
|
169
|
-
},
|
|
175
|
+
}, f(e.labelKey, e.label)))
|
|
170
176
|
})]
|
|
171
177
|
})
|
|
172
178
|
}),
|
|
173
|
-
|
|
179
|
+
R && /* @__PURE__ */ y(k, {
|
|
174
180
|
testId: "notification-preferences-topics",
|
|
175
|
-
title:
|
|
176
|
-
children: [
|
|
181
|
+
title: f("notifications.v2.optInTopics", "Updates you can opt into"),
|
|
182
|
+
children: [S.length > 5 && /* @__PURE__ */ y("div", {
|
|
177
183
|
className: "relative py-3",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
184
|
+
children: [/* @__PURE__ */ v(_, {
|
|
179
185
|
size: 16,
|
|
180
186
|
className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary",
|
|
181
187
|
"aria-hidden": "true"
|
|
182
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ v(T, {
|
|
183
189
|
type: "search",
|
|
184
|
-
value:
|
|
185
|
-
onChange: (e) =>
|
|
186
|
-
"aria-label":
|
|
187
|
-
placeholder:
|
|
190
|
+
value: P,
|
|
191
|
+
onChange: (e) => F(e.target.value),
|
|
192
|
+
"aria-label": f("notifications.searchTopics", "Search topics..."),
|
|
193
|
+
placeholder: f("notifications.searchTopics", "Search topics..."),
|
|
188
194
|
className: "pl-9"
|
|
189
195
|
})]
|
|
190
|
-
}),
|
|
196
|
+
}), I.length === 0 ? /* @__PURE__ */ v("p", {
|
|
191
197
|
className: "py-3 text-sm text-text-secondary",
|
|
192
|
-
children:
|
|
193
|
-
}) :
|
|
198
|
+
children: f("notifications.noTopicsFound", "No topics match your search")
|
|
199
|
+
}) : I.map((e) => L({
|
|
194
200
|
scope: "TOPIC",
|
|
195
201
|
topicId: e.id
|
|
196
202
|
}, e.name, { description: e.description || void 0 }))]
|
|
@@ -198,6 +204,6 @@ function O() {
|
|
|
198
204
|
]
|
|
199
205
|
});
|
|
200
206
|
}
|
|
201
|
-
export {
|
|
207
|
+
export { A as NotificationSettingsV2 };
|
|
202
208
|
|
|
203
209
|
//# 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,e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AQ,UAAUA,EAAQ,KAAK,CAAC,CACvF;KACO,CAAA,GACT,kBAACnC,GAAD;MACE,QAAO;MACP,OAAOnB,EAAG,+BAA+B,kBAAkB;MAE1D,UAAAyD,EAAM,KAAK,MACVlB,EAAI;OAAE,OAAO;OAAQ,MAAMmB,EAAK;MAAM,GAAG1D,EAAG0D,EAAK,UAAUA,EAAK,KAAK,CAAC,CACxE;KACO,CAAA,CACN;;GACS,CAAA;GAEfP,KACC,kBAAChC,GAAD;IACE,QAAO;IACP,OAAOnB,EAAG,gCAAgC,0BAA0B;IAFtE,UAAA,CAIGkC,EAAO,SAAS,KACf,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAACyB,GAAD;MACE,MAAM;MACN,WAAU;MACV,eAAY;KACb,CAAA,GACD,kBAACC,GAAD;MACE,MAAK;MACL,OAAOhC;MACP,WAAW,MAAUC,EAAUgC,EAAM,OAAO,KAAK;MACjD,cAAY7D,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,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;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,EACjE,MAAMK,EACR,CAAC;OAED,UAAA,kBAACU,GAAD;QAAgB,MAAM;QAAI,eAAY;OAAQ,CAAA;MACxC,CAAA;KACW,CAAA,GACrB,kBAACC,GAAD;MAAqB,OAAM;MACzB,UAAA,kBAACC,GAAD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D;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"}
|