@burdenoff/microfe-notification 2026.1109.1 → 2026.1113.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.
Files changed (70) hide show
  1. package/dist/NotificationRoutes.js +108 -36
  2. package/dist/NotificationRoutes.js.map +1 -1
  3. package/dist/components/ConfirmDeleteDialog.d.ts +17 -0
  4. package/dist/components/ConfirmDeleteDialog.js +22 -0
  5. package/dist/components/ConfirmDeleteDialog.js.map +1 -0
  6. package/dist/components/NotificationCard.d.ts +10 -1
  7. package/dist/components/NotificationCard.js +103 -72
  8. package/dist/components/NotificationCard.js.map +1 -1
  9. package/dist/hooks/index.js +5 -5
  10. package/dist/hooks/usePreferenceToggles.d.ts +27 -0
  11. package/dist/hooks/usePreferenceToggles.js +84 -0
  12. package/dist/hooks/usePreferenceToggles.js.map +1 -0
  13. package/dist/navigation-v2/AdminPageV2.d.ts +14 -0
  14. package/dist/navigation-v2/AdminPageV2.js +51 -0
  15. package/dist/navigation-v2/AdminPageV2.js.map +1 -0
  16. package/dist/navigation-v2/AdminToolsMenu.d.ts +6 -0
  17. package/dist/navigation-v2/AdminToolsMenu.js +32 -0
  18. package/dist/navigation-v2/AdminToolsMenu.js.map +1 -0
  19. package/dist/navigation-v2/BackToNotifications.d.ts +2 -0
  20. package/dist/navigation-v2/BackToNotifications.js +20 -0
  21. package/dist/navigation-v2/BackToNotifications.js.map +1 -0
  22. package/dist/navigation-v2/FilterControls.d.ts +25 -0
  23. package/dist/navigation-v2/FilterControls.js +64 -0
  24. package/dist/navigation-v2/FilterControls.js.map +1 -0
  25. package/dist/navigation-v2/NotificationArchivedV2.d.ts +9 -0
  26. package/dist/navigation-v2/NotificationArchivedV2.js +174 -0
  27. package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -0
  28. package/dist/navigation-v2/NotificationInboxV2.d.ts +9 -0
  29. package/dist/navigation-v2/NotificationInboxV2.js +309 -0
  30. package/dist/navigation-v2/NotificationInboxV2.js.map +1 -0
  31. package/dist/navigation-v2/NotificationSettingsV2.d.ts +9 -0
  32. package/dist/navigation-v2/NotificationSettingsV2.js +203 -0
  33. package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -0
  34. package/dist/navigation-v2/NotificationsV2Landing.d.ts +9 -0
  35. package/dist/navigation-v2/NotificationsV2Landing.js +37 -0
  36. package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -0
  37. package/dist/navigation-v2/__tests__/uiMocks.d.ts +71 -0
  38. package/dist/navigation-v2/inboxFilters.d.ts +8 -0
  39. package/dist/navigation-v2/inboxFilters.js +10 -0
  40. package/dist/navigation-v2/inboxFilters.js.map +1 -0
  41. package/dist/navigation-v2/paths.d.ts +24 -0
  42. package/dist/navigation-v2/paths.js +31 -0
  43. package/dist/navigation-v2/paths.js.map +1 -0
  44. package/dist/navigation-v2/settingsOptions.d.ts +12 -0
  45. package/dist/navigation-v2/settingsOptions.js +58 -0
  46. package/dist/navigation-v2/settingsOptions.js.map +1 -0
  47. package/dist/navigation-v2/useAdminTools.d.ts +22 -0
  48. package/dist/navigation-v2/useAdminTools.js +76 -0
  49. package/dist/navigation-v2/useAdminTools.js.map +1 -0
  50. package/dist/pages/CreateNotificationPage.js +577 -558
  51. package/dist/pages/CreateNotificationPage.js.map +1 -1
  52. package/dist/pages/NotificationCenterPage.d.ts +3 -1
  53. package/dist/pages/NotificationCenterPage.js +79 -74
  54. package/dist/pages/NotificationCenterPage.js.map +1 -1
  55. package/dist/pages/NotificationHistoryPage.d.ts +5 -1
  56. package/dist/pages/NotificationHistoryPage.js +52 -47
  57. package/dist/pages/NotificationHistoryPage.js.map +1 -1
  58. package/dist/pages/NotificationPreferencesPage.d.ts +4 -0
  59. package/dist/pages/NotificationPreferencesPage.js +97 -158
  60. package/dist/pages/NotificationPreferencesPage.js.map +1 -1
  61. package/dist/pages/NotificationTemplatesPage.js +184 -166
  62. package/dist/pages/NotificationTemplatesPage.js.map +1 -1
  63. package/dist/pages/NotificationTopicsPage.js +123 -108
  64. package/dist/pages/NotificationTopicsPage.js.map +1 -1
  65. package/dist/pages/TemplateEditorPage.js +339 -308
  66. package/dist/pages/TemplateEditorPage.js.map +1 -1
  67. package/dist/providers/NotificationProvider.js +6 -5
  68. package/dist/providers/NotificationProvider.js.map +1 -1
  69. package/dist/types/index.d.ts +8 -0
  70. package/package.json +2 -2
@@ -0,0 +1,37 @@
1
+ import { NotificationCenterPage as e } from "../pages/NotificationCenterPage.js";
2
+ import { AdminPageV2 as t } from "./AdminPageV2.js";
3
+ import { useNotificationPaths as n } from "./paths.js";
4
+ import { Suspense as r, lazy as i } from "react";
5
+ import { useFeatureFlagDetails as a } from "@burdenoff/fe-libs/shared/feature-flags";
6
+ import { Navigate as o, useSearchParams as s } from "react-router";
7
+ import { jsx as c } from "react/jsx-runtime";
8
+ // src/navigation-v2/NotificationsV2Landing.tsx
9
+ var l = i(() => import("../pages/NotificationHistoryAdminPage.js").then((e) => ({ default: e.NotificationHistoryAdminPage })));
10
+ function u() {
11
+ return /* @__PURE__ */ c("div", {
12
+ className: "flex h-64 items-center justify-center",
13
+ children: /* @__PURE__ */ c("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
14
+ });
15
+ }
16
+ function d() {
17
+ let [i] = s(), d = n(), f = i.get("tab"), p = a("notification.history"), m = p ? !!p.value : !1;
18
+ return f === "send" ? /* @__PURE__ */ c(o, {
19
+ to: d.send,
20
+ replace: !0
21
+ }) : f === "templates" ? /* @__PURE__ */ c(o, {
22
+ to: d.templates,
23
+ replace: !0
24
+ }) : f === "topics" ? /* @__PURE__ */ c(o, {
25
+ to: d.topics,
26
+ replace: !0
27
+ }) : f === "history" && m ? /* @__PURE__ */ c(t, {
28
+ tool: "deliveryLog",
29
+ children: /* @__PURE__ */ c(r, {
30
+ fallback: /* @__PURE__ */ c(u, {}),
31
+ children: /* @__PURE__ */ c(l, {})
32
+ })
33
+ }) : /* @__PURE__ */ c(e, {});
34
+ }
35
+ export { d as NotificationsV2Landing };
36
+
37
+ //# sourceMappingURL=NotificationsV2Landing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationsV2Landing.js","names":["NotificationHistoryAdminPage","lazy","m","PageLoader","NotificationsV2Landing","params","useSearchParams","paths","useNotificationPaths","tab","historyDetails","useFeatureFlagDetails","historyEnabled","Navigate","AdminPageV2","Suspense","NotificationCenterPage"],"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 <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\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 (which has no route of its own, and, as on the old landing, opens only\n * while `notification.history` is on), and `inbox` or anything unknown is the\n * inbox.\n */\nexport function NotificationsV2Landing() {\n const [params] = useSearchParams();\n const paths = useNotificationPaths();\n const tab = params.get('tab');\n const historyDetails = useFeatureFlagDetails('notification.history');\n const historyEnabled = historyDetails ? Boolean(historyDetails.value) : false;\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' && historyEnabled) {\n return (\n <AdminPageV2 tool=\"deliveryLog\">\n <Suspense fallback={<PageLoader />}>\n <NotificationHistoryAdminPage />\n </Suspense>\n </AdminPageV2>\n );\n }\n return <NotificationCenterPage />;\n}\n"],"mappings":";;;;;;;;AAOA,IAAMA,IAA+BC,QACnC,OAAO,2CAAwC,CAAC,MAAM,OAAO,EAC3D,SAASC,EAAE,6BACb,EAAE,CACJ;AAEA,SAASC,IAAa;CACpB,OACE,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;CAC9F,CAAA;AAET;AAUA,SAAgBC,IAAyB;CACvC,IAAM,CAACC,KAAUC,EAAgB,GAC3BC,IAAQC,EAAqB,GAC7BC,IAAMJ,EAAO,IAAI,KAAK,GACtBK,IAAiBC,EAAsB,sBAAsB,GAC7DC,IAAiBF,IAAiB,EAAQA,EAAe,QAAS;CAcxE,OAZID,MAAQ,SAAe,kBAACI,GAAD;EAAU,IAAIN,EAAM;EAAM,SAAA;CAAS,CAAA,IAC1DE,MAAQ,cAAoB,kBAACI,GAAD;EAAU,IAAIN,EAAM;EAAW,SAAA;CAAS,CAAA,IACpEE,MAAQ,WAAiB,kBAACI,GAAD;EAAU,IAAIN,EAAM;EAAQ,SAAA;CAAS,CAAA,IAC9DE,MAAQ,aAAaG,IAErB,kBAACE,GAAD;EAAa,MAAK;EAChB,UAAA,kBAACC,GAAD;GAAU,UAAU,kBAACZ,GAAD,CAAa,CAAA;GAC/B,UAAA,kBAACH,GAAD,CAA+B,CAAA;EACvB,CAAA;CACC,CAAA,IAGV,kBAACgB,GAAD,CAAyB,CAAA;AAClC"}
@@ -0,0 +1,71 @@
1
+ import { ReactNode } from 'react';
2
+ type Children = {
3
+ children?: ReactNode;
4
+ };
5
+ export declare function Passthrough({ children }: Children): import('react').JSX.Element;
6
+ export declare const feLibsUiMock: {
7
+ Button: ({ children, asChild, ...rest }: Children & {
8
+ asChild?: boolean;
9
+ } & Record<string, unknown>) => import('react').JSX.Element;
10
+ Input: (props: Record<string, unknown>) => import('react').JSX.Element;
11
+ NativeSelect: ({ options, value, onValueChange, "aria-label": ariaLabel, }: {
12
+ options: Array<{
13
+ value: string;
14
+ label: string;
15
+ }>;
16
+ value?: string;
17
+ onValueChange?: (value: string) => void;
18
+ "aria-label"?: string;
19
+ }) => import('react').JSX.Element;
20
+ IllustratedEmptyState: ({ title, description, action, }: {
21
+ title: string;
22
+ description?: ReactNode;
23
+ action?: ReactNode;
24
+ }) => import('react').JSX.Element;
25
+ useRememberedOpen: (_key: string, initial?: boolean) => [boolean, import('react').Dispatch<import('react').SetStateAction<boolean>>];
26
+ DropdownMenu: typeof Passthrough;
27
+ DropdownMenuTrigger: typeof Passthrough;
28
+ DropdownMenuContent: typeof Passthrough;
29
+ DropdownMenuItem: ({ children, onSelect, disabled, ...rest }: Children & {
30
+ onSelect?: () => void;
31
+ disabled?: boolean;
32
+ } & Record<string, unknown>) => import('react').JSX.Element;
33
+ Tooltip: typeof Passthrough;
34
+ TooltipTrigger: typeof Passthrough;
35
+ TooltipContent: ({ children }: Children) => import('react').JSX.Element;
36
+ Switch: ({ id, checked, disabled, onCheckedChange, }: {
37
+ id?: string;
38
+ checked?: boolean;
39
+ disabled?: boolean;
40
+ onCheckedChange?: (checked: boolean) => void;
41
+ }) => import('react').JSX.Element;
42
+ OptionalFields: ({ children }: Children) => import('react').JSX.Element;
43
+ EmphasisPanel: ({ children }: Children) => import('react').JSX.Element;
44
+ GlassCard: ({ children }: Children) => import('react').JSX.Element;
45
+ PagePurpose: () => null;
46
+ NextSteps: ({ steps }: {
47
+ steps: Array<{
48
+ id: string;
49
+ label: string;
50
+ href?: string;
51
+ }>;
52
+ }) => import('react').JSX.Element;
53
+ AlertDialog: ({ open, children }: Children & {
54
+ open?: boolean;
55
+ }) => import('react').JSX.Element | null;
56
+ AlertDialogContent: typeof Passthrough;
57
+ AlertDialogHeader: typeof Passthrough;
58
+ AlertDialogFooter: typeof Passthrough;
59
+ AlertDialogTitle: ({ children }: Children) => import('react').JSX.Element;
60
+ AlertDialogDescription: ({ children }: Children) => import('react').JSX.Element;
61
+ AlertDialogCancel: ({ children, onClick }: Children & {
62
+ onClick?: () => void;
63
+ }) => import('react').JSX.Element;
64
+ AlertDialogAction: ({ children, onClick }: Children & {
65
+ onClick?: () => void;
66
+ }) => import('react').JSX.Element;
67
+ AccessGate: ({ message }: {
68
+ message: string;
69
+ }) => import('react').JSX.Element;
70
+ };
71
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Notification } from '../types';
2
+ /** The read-state chips at level 1. "Needs action" means the item carries action buttons. */
3
+ export type InboxView = 'all' | 'unread' | 'action';
4
+ /** Items that ask the person to do something: they carry action buttons (approvals). */
5
+ export declare function needsAction(notification: Notification): boolean;
6
+ /** "Archived" shows what you archived; "Everything" is the full personal history. */
7
+ export type ArchivedView = 'archived' | 'everything';
8
+ export declare function inArchivedView(notification: Notification, view: ArchivedView): boolean;
@@ -0,0 +1,10 @@
1
+ // src/navigation-v2/inboxFilters.ts
2
+ function e(e) {
3
+ return e.actions.length > 0;
4
+ }
5
+ function t(e, t) {
6
+ return t === "everything" || !!e.archivedAt;
7
+ }
8
+ export { t as inArchivedView, e as needsAction };
9
+
10
+ //# sourceMappingURL=inboxFilters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inboxFilters.js","names":["needsAction","notification","inArchivedView","view"],"sources":["../../src/navigation-v2/inboxFilters.ts"],"sourcesContent":["import type { Notification } from '../types';\n\n/** The read-state chips at level 1. \"Needs action\" means the item carries action buttons. */\nexport type InboxView = 'all' | 'unread' | 'action';\n\n/** Items that ask the person to do something: they carry action buttons (approvals). */\nexport function needsAction(notification: Notification): boolean {\n return notification.actions.length > 0;\n}\n\n/** \"Archived\" shows what you archived; \"Everything\" is the full personal history. */\nexport type ArchivedView = 'archived' | 'everything';\n\nexport function inArchivedView(notification: Notification, view: ArchivedView): boolean {\n return view === 'everything' || Boolean(notification.archivedAt);\n}\n"],"mappings":";AAMA,SAAgBA,EAAY,GAAqC;CAC/D,OAAOC,EAAa,QAAQ,SAAS;AACvC;AAKA,SAAgBC,EAAe,GAA4B,GAA6B;CACtF,OAAOC,MAAS,gBAAgB,EAAQF,EAAa;AACvD"}
@@ -0,0 +1,24 @@
1
+ /** `base` + `sub` with exactly one slash between them; `sub` empty gives `base`. */
2
+ export declare function joinNotificationPath(basePath: string | undefined, sub?: string): string;
3
+ /** Absolute paths for every page of the module, from where the shell mounted it. */
4
+ export interface NotificationPaths {
5
+ inbox: string;
6
+ center: string;
7
+ archived: string;
8
+ preferences: string;
9
+ send: string;
10
+ templates: string;
11
+ newTemplate: string;
12
+ template: (idOrSlug: string) => string;
13
+ topics: string;
14
+ deliveryLog: string;
15
+ }
16
+ export declare function buildNotificationPaths(basePath: string | undefined): NotificationPaths;
17
+ /**
18
+ * The module's paths, absolute. Navigating with these (never a relative
19
+ * `navigate('new')`) means a page works the same whether it was opened by its
20
+ * own route or inside the old tabbed landing (BOFF-11872 §8 items 3, 4, 11).
21
+ */
22
+ export declare function useNotificationPaths(): NotificationPaths;
23
+ /** True when the host turned on FluidGrids' Navigation v2 layout. */
24
+ export declare function useNavigationV2(): boolean;
@@ -0,0 +1,31 @@
1
+ import { useNotification as e } from "../providers/NotificationProvider.js";
2
+ import { useMemo as t } from "react";
3
+ // src/navigation-v2/paths.ts
4
+ function n(e, t = "") {
5
+ let n = (e ?? "/").replace(/\/+$/, ""), r = t.replace(/^\/+/, "");
6
+ return r ? `${n}/${r}` : n || "/";
7
+ }
8
+ function r(e) {
9
+ return {
10
+ inbox: n(e),
11
+ center: n(e, "center"),
12
+ archived: n(e, "history"),
13
+ preferences: n(e, "preferences"),
14
+ send: n(e, "create"),
15
+ templates: n(e, "templates"),
16
+ newTemplate: n(e, "templates/new"),
17
+ template: (t) => n(e, `templates/${encodeURIComponent(t)}`),
18
+ topics: n(e, "topics"),
19
+ deliveryLog: `${n(e)}?tab=history`
20
+ };
21
+ }
22
+ function i() {
23
+ let { basePath: n } = e();
24
+ return t(() => r(n), [n]);
25
+ }
26
+ function a() {
27
+ return !!e().navigationV2;
28
+ }
29
+ export { r as buildNotificationPaths, n as joinNotificationPath, a as useNavigationV2, i as useNotificationPaths };
30
+
31
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","names":["joinNotificationPath","base","basePath","tail","sub","buildNotificationPaths","idOrSlug","useNotificationPaths","useNotification","useMemo","useNavigationV2"],"sources":["../../src/navigation-v2/paths.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useNotification } from '../providers/NotificationProvider';\n\n/** `base` + `sub` with exactly one slash between them; `sub` empty gives `base`. */\nexport function joinNotificationPath(basePath: string | undefined, sub = ''): string {\n const base = (basePath ?? '/').replace(/\\/+$/, '');\n const tail = sub.replace(/^\\/+/, '');\n if (!tail) return base || '/';\n return `${base}/${tail}`;\n}\n\n/** Absolute paths for every page of the module, from where the shell mounted it. */\nexport interface NotificationPaths {\n inbox: string;\n center: string;\n archived: string;\n preferences: string;\n send: string;\n templates: string;\n newTemplate: string;\n template: (idOrSlug: string) => string;\n topics: string;\n deliveryLog: string;\n}\n\nexport function buildNotificationPaths(basePath: string | undefined): NotificationPaths {\n return {\n inbox: joinNotificationPath(basePath),\n center: joinNotificationPath(basePath, 'center'),\n archived: joinNotificationPath(basePath, 'history'),\n preferences: joinNotificationPath(basePath, 'preferences'),\n send: joinNotificationPath(basePath, 'create'),\n templates: joinNotificationPath(basePath, 'templates'),\n newTemplate: joinNotificationPath(basePath, 'templates/new'),\n template: (idOrSlug: string) =>\n joinNotificationPath(basePath, `templates/${encodeURIComponent(idOrSlug)}`),\n topics: joinNotificationPath(basePath, 'topics'),\n // The delivery log has no route of its own; it is the old landing's\n // `?tab=history`, kept so every old link still opens it.\n deliveryLog: `${joinNotificationPath(basePath)}?tab=history`,\n };\n}\n\n/**\n * The module's paths, absolute. Navigating with these (never a relative\n * `navigate('new')`) means a page works the same whether it was opened by its\n * own route or inside the old tabbed landing (BOFF-11872 §8 items 3, 4, 11).\n */\nexport function useNotificationPaths(): NotificationPaths {\n const { basePath } = useNotification();\n return useMemo(() => buildNotificationPaths(basePath), [basePath]);\n}\n\n/** True when the host turned on FluidGrids' Navigation v2 layout. */\nexport function useNavigationV2(): boolean {\n return Boolean(useNotification().navigationV2);\n}\n"],"mappings":";;;AAIA,SAAgBA,EAAqB,GAA8B,IAAM,IAAY;CACnF,IAAMC,KAAQC,KAAY,IAAA,CAAK,QAAQ,QAAQ,EAAE,GAC3CC,IAAOC,EAAI,QAAQ,QAAQ,EAAE;CAEnC,OADKD,IACE,GAAGF,EAAK,GAAGE,MADAF,KAAQ;AAE5B;AAgBA,SAAgBI,EAAuB,GAAiD;CACtF,OAAO;EACL,OAAOL,EAAqBE,CAAQ;EACpC,QAAQF,EAAqBE,GAAU,QAAQ;EAC/C,UAAUF,EAAqBE,GAAU,SAAS;EAClD,aAAaF,EAAqBE,GAAU,aAAa;EACzD,MAAMF,EAAqBE,GAAU,QAAQ;EAC7C,WAAWF,EAAqBE,GAAU,WAAW;EACrD,aAAaF,EAAqBE,GAAU,eAAe;EAC3D,WAAW,MACTF,EAAqBE,GAAU,aAAa,mBAAmBI,CAAQ,GAAG;EAC5E,QAAQN,EAAqBE,GAAU,QAAQ;EAG/C,aAAa,GAAGF,EAAqBE,CAAQ,EAAE;CACjD;AACF;AAOA,SAAgBK,IAA0C;CACxD,IAAM,EAAE,gBAAaC,EAAgB;CACrC,OAAOC,QAAcJ,EAAuBH,CAAQ,GAAG,CAACA,CAAQ,CAAC;AACnE;AAGA,SAAgBQ,IAA2B;CACzC,OAAO,EAAQF,EAAgB,CAAC,CAAC;AACnC"}
@@ -0,0 +1,12 @@
1
+ import { NotificationChannel, NotificationType } from '../types';
2
+ export type Option<T> = {
3
+ value: T;
4
+ labelKey: string;
5
+ label: string;
6
+ };
7
+ /** "How to reach you", shown first. */
8
+ export declare const EVERYDAY_CHANNELS: Array<Option<NotificationChannel>>;
9
+ /** The other channels, under "More options". */
10
+ export declare const MORE_CHANNELS: Array<Option<NotificationChannel>>;
11
+ /** The type toggles, in plain words, under "More options". */
12
+ export declare const TYPES: Array<Option<NotificationType>>;
@@ -0,0 +1,58 @@
1
+ // src/navigation-v2/settingsOptions.ts
2
+ var e = [
3
+ {
4
+ value: "IN_APP",
5
+ labelKey: "notifications.channelInApp",
6
+ label: "In-app"
7
+ },
8
+ {
9
+ value: "EMAIL",
10
+ labelKey: "notifications.channelEmail",
11
+ label: "Email"
12
+ },
13
+ {
14
+ value: "PUSH",
15
+ labelKey: "notifications.channelPush",
16
+ label: "Push"
17
+ }
18
+ ], t = [
19
+ {
20
+ value: "SMS",
21
+ labelKey: "notifications.channelSms",
22
+ label: "SMS"
23
+ },
24
+ {
25
+ value: "WHATSAPP",
26
+ labelKey: "notifications.channelWhatsapp",
27
+ label: "WhatsApp"
28
+ },
29
+ {
30
+ value: "SLACK",
31
+ labelKey: "notifications.channelSlack",
32
+ label: "Slack"
33
+ }
34
+ ], n = [
35
+ {
36
+ value: "TRANSACTIONAL",
37
+ labelKey: "notifications.v2.type.transactional",
38
+ label: "About your account and activity"
39
+ },
40
+ {
41
+ value: "SYSTEM",
42
+ labelKey: "notifications.v2.type.system",
43
+ label: "Product and service updates"
44
+ },
45
+ {
46
+ value: "ALERT",
47
+ labelKey: "notifications.v2.type.alert",
48
+ label: "Urgent alerts"
49
+ },
50
+ {
51
+ value: "MARKETING",
52
+ labelKey: "notifications.v2.type.marketing",
53
+ label: "News and offers"
54
+ }
55
+ ];
56
+ export { e as EVERYDAY_CHANNELS, t as MORE_CHANNELS, n as TYPES };
57
+
58
+ //# sourceMappingURL=settingsOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsOptions.js","names":["EVERYDAY_CHANNELS","MORE_CHANNELS","TYPES"],"sources":["../../src/navigation-v2/settingsOptions.ts"],"sourcesContent":["import type { NotificationChannel, NotificationType } from '../types';\n\nexport type Option<T> = { value: T; labelKey: string; label: string };\n\n/** \"How to reach you\", shown first. */\nexport const EVERYDAY_CHANNELS: Array<Option<NotificationChannel>> = [\n { value: 'IN_APP', labelKey: 'notifications.channelInApp', label: 'In-app' },\n { value: 'EMAIL', labelKey: 'notifications.channelEmail', label: 'Email' },\n { value: 'PUSH', labelKey: 'notifications.channelPush', label: 'Push' },\n];\n\n/** The other channels, under \"More options\". */\nexport const MORE_CHANNELS: Array<Option<NotificationChannel>> = [\n { value: 'SMS', labelKey: 'notifications.channelSms', label: 'SMS' },\n { value: 'WHATSAPP', labelKey: 'notifications.channelWhatsapp', label: 'WhatsApp' },\n { value: 'SLACK', labelKey: 'notifications.channelSlack', label: 'Slack' },\n];\n\n/** The type toggles, in plain words, under \"More options\". */\nexport const TYPES: Array<Option<NotificationType>> = [\n {\n value: 'TRANSACTIONAL',\n labelKey: 'notifications.v2.type.transactional',\n label: 'About your account and activity',\n },\n {\n value: 'SYSTEM',\n labelKey: 'notifications.v2.type.system',\n label: 'Product and service updates',\n },\n { value: 'ALERT', labelKey: 'notifications.v2.type.alert', label: 'Urgent alerts' },\n { value: 'MARKETING', labelKey: 'notifications.v2.type.marketing', label: 'News and offers' },\n];\n"],"mappings":";AAKA,IAAaA,IAAwD;CACnE;EAAE,OAAO;EAAU,UAAU;EAA8B,OAAO;CAAS;CAC3E;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;CAAQ;CACzE;EAAE,OAAO;EAAQ,UAAU;EAA6B,OAAO;CAAO;AACxE,GAGaC,IAAoD;CAC/D;EAAE,OAAO;EAAO,UAAU;EAA4B,OAAO;CAAM;CACnE;EAAE,OAAO;EAAY,UAAU;EAAiC,OAAO;CAAW;CAClF;EAAE,OAAO;EAAS,UAAU;EAA8B,OAAO;CAAQ;AAC3E,GAGaC,IAAyC;CACpD;EACE,OAAO;EACP,UAAU;EACV,OAAO;CACT;CACA;EACE,OAAO;EACP,UAAU;EACV,OAAO;CACT;CACA;EAAE,OAAO;EAAS,UAAU;EAA+B,OAAO;CAAgB;CAClF;EAAE,OAAO;EAAa,UAAU;EAAmC,OAAO;CAAkB;AAC9F"}
@@ -0,0 +1,22 @@
1
+ import { NotificationPermission } from '../constants/permissions';
2
+ export type AdminToolId = 'send' | 'deliveryLog' | 'templates' | 'topics';
3
+ export interface AdminTool {
4
+ id: AdminToolId;
5
+ label: string;
6
+ href: string;
7
+ }
8
+ /** Which permission(s) each admin page needs: the same as AdminNotificationRoutes. */
9
+ export declare const ADMIN_TOOL_PERMISSIONS: Record<AdminToolId, {
10
+ anyOf?: NotificationPermission[];
11
+ allOf?: NotificationPermission[];
12
+ }>;
13
+ export declare function holdsAdminToolPermission(id: AdminToolId, hasPermission: (permission: string) => boolean): boolean;
14
+ /**
15
+ * The admin tools this person may use, in menu order: each needs both its
16
+ * feature flag and its permission (BOFF-11872, NOTIF-LAND-01…06). A page left
17
+ * out is still open by its URL to anyone who holds the permission.
18
+ */
19
+ export declare function useAdminTools(): {
20
+ tools: AdminTool[];
21
+ isLoading: boolean;
22
+ };
@@ -0,0 +1,76 @@
1
+ import { NOTIFICATION_PERMISSIONS as e } from "../constants/permissions.js";
2
+ import { useTr as t } from "../shared/hooks/useTr.js";
3
+ import { useNotificationPaths as n } from "./paths.js";
4
+ import { useMemo as r } from "react";
5
+ import { useFeatureFlagDetails as i } from "@burdenoff/fe-libs/shared/feature-flags";
6
+ import { usePermissions as a } from "@burdenoff/fe-libs/shared/providers/shell";
7
+ // src/navigation-v2/useAdminTools.ts
8
+ var o = {
9
+ send: { allOf: [e.NOTIFICATION_CREATE, e.NOTIFICATION_SEND] },
10
+ deliveryLog: { anyOf: [e.NOTIFICATION_LIST] },
11
+ templates: { anyOf: [
12
+ e.TEMPLATE_LIST,
13
+ e.TEMPLATE_CREATE,
14
+ e.TEMPLATE_UPDATE,
15
+ e.TEMPLATE_DELETE
16
+ ] },
17
+ topics: { anyOf: [e.NOTIFICATION_CREATE] }
18
+ };
19
+ function s(e, t) {
20
+ let n = o[e];
21
+ return !(n.allOf && !n.allOf.every((e) => t(e)) || n.anyOf && !n.anyOf.some((e) => t(e)));
22
+ }
23
+ function c(e) {
24
+ let t = i(e);
25
+ return t ? !!t.value : !1;
26
+ }
27
+ function l() {
28
+ let e = t(), i = n(), { hasPermission: o, isLoading: l } = a(), u = c("notification.templates"), d = c("notification.create"), f = c("notification.history");
29
+ return {
30
+ tools: r(() => {
31
+ let t = [
32
+ {
33
+ id: "send",
34
+ label: e("notifications.v2.admin.send", "Send"),
35
+ href: i.send,
36
+ enabled: d
37
+ },
38
+ {
39
+ id: "deliveryLog",
40
+ label: e("notifications.v2.admin.deliveryLog", "Delivery log"),
41
+ href: i.deliveryLog,
42
+ enabled: f
43
+ },
44
+ {
45
+ id: "templates",
46
+ label: e("notifications.v2.admin.templates", "Templates"),
47
+ href: i.templates,
48
+ enabled: u
49
+ },
50
+ {
51
+ id: "topics",
52
+ label: e("notifications.v2.admin.topics", "Topics"),
53
+ href: i.topics,
54
+ enabled: d
55
+ }
56
+ ];
57
+ return l ? [] : t.filter((e) => e.enabled && s(e.id, o)).map(({ id: e, label: t, href: n }) => ({
58
+ id: e,
59
+ label: t,
60
+ href: n
61
+ }));
62
+ }, [
63
+ e,
64
+ i,
65
+ d,
66
+ f,
67
+ u,
68
+ l,
69
+ o
70
+ ]),
71
+ isLoading: l
72
+ };
73
+ }
74
+ export { o as ADMIN_TOOL_PERMISSIONS, s as holdsAdminToolPermission, l as useAdminTools };
75
+
76
+ //# sourceMappingURL=useAdminTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAdminTools.js","names":["ADMIN_TOOL_PERMISSIONS","NOTIFICATION_PERMISSIONS","holdsAdminToolPermission","rule","id","hasPermission","p","useFlag","details","useFeatureFlagDetails","key","useAdminTools","tr","useTr","paths","useNotificationPaths","usePermissions","templatesEnabled","createEnabled","historyEnabled","useMemo","all","isLoading","tool"],"sources":["../../src/navigation-v2/useAdminTools.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { NOTIFICATION_PERMISSIONS, type NotificationPermission } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { useNotificationPaths } from './paths';\n\nexport type AdminToolId = 'send' | 'deliveryLog' | 'templates' | 'topics';\n\nexport interface AdminTool {\n id: AdminToolId;\n label: string;\n href: string;\n}\n\n/** Which permission(s) each admin page needs: the same as AdminNotificationRoutes. */\nexport const ADMIN_TOOL_PERMISSIONS: Record<\n AdminToolId,\n { anyOf?: NotificationPermission[]; allOf?: NotificationPermission[] }\n> = {\n send: {\n allOf: [\n NOTIFICATION_PERMISSIONS.NOTIFICATION_CREATE,\n NOTIFICATION_PERMISSIONS.NOTIFICATION_SEND,\n ],\n },\n deliveryLog: { anyOf: [NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST] },\n templates: {\n anyOf: [\n NOTIFICATION_PERMISSIONS.TEMPLATE_LIST,\n NOTIFICATION_PERMISSIONS.TEMPLATE_CREATE,\n NOTIFICATION_PERMISSIONS.TEMPLATE_UPDATE,\n NOTIFICATION_PERMISSIONS.TEMPLATE_DELETE,\n ],\n },\n // Topics CRUD maps to `notification:create` per the backend @rbac (BOFF-2386).\n topics: { anyOf: [NOTIFICATION_PERMISSIONS.NOTIFICATION_CREATE] },\n};\n\nexport function holdsAdminToolPermission(\n id: AdminToolId,\n hasPermission: (permission: string) => boolean\n): boolean {\n const rule = ADMIN_TOOL_PERMISSIONS[id];\n if (rule.allOf && !rule.allOf.every((p) => hasPermission(p))) return false;\n if (rule.anyOf && !rule.anyOf.some((p) => hasPermission(p))) return false;\n return true;\n}\n\n/** Explicit `false` when a flag is unseeded, as the old tabbed landing does. */\nfunction useFlag(key: string): boolean {\n const details = useFeatureFlagDetails(key);\n return details ? Boolean(details.value) : false;\n}\n\n/**\n * The admin tools this person may use, in menu order: each needs both its\n * feature flag and its permission (BOFF-11872, NOTIF-LAND-01…06). A page left\n * out is still open by its URL to anyone who holds the permission.\n */\nexport function useAdminTools(): { tools: AdminTool[]; isLoading: boolean } {\n const tr = useTr();\n const paths = useNotificationPaths();\n const { hasPermission, isLoading } = usePermissions();\n const templatesEnabled = useFlag('notification.templates');\n const createEnabled = useFlag('notification.create');\n const historyEnabled = useFlag('notification.history');\n\n const tools = useMemo(() => {\n const all: Array<AdminTool & { enabled: boolean }> = [\n {\n id: 'send',\n label: tr('notifications.v2.admin.send', 'Send'),\n href: paths.send,\n enabled: createEnabled,\n },\n {\n id: 'deliveryLog',\n label: tr('notifications.v2.admin.deliveryLog', 'Delivery log'),\n href: paths.deliveryLog,\n enabled: historyEnabled,\n },\n {\n id: 'templates',\n label: tr('notifications.v2.admin.templates', 'Templates'),\n href: paths.templates,\n enabled: templatesEnabled,\n },\n {\n id: 'topics',\n label: tr('notifications.v2.admin.topics', 'Topics'),\n href: paths.topics,\n enabled: createEnabled,\n },\n ];\n if (isLoading) return [];\n return all\n .filter((tool) => tool.enabled && holdsAdminToolPermission(tool.id, hasPermission))\n .map(({ id, label, href }) => ({ id, label, href }));\n }, [tr, paths, createEnabled, historyEnabled, templatesEnabled, isLoading, hasPermission]);\n\n return { tools, isLoading };\n}\n"],"mappings":";;;;;;;AAgBA,IAAaA,IAGT;CACF,MAAM,EACJ,OAAO,CACLC,EAAyB,qBACzBA,EAAyB,iBAC3B,EACF;CACA,aAAa,EAAE,OAAO,CAACA,EAAyB,iBAAiB,EAAE;CACnE,WAAW,EACT,OAAO;EACLA,EAAyB;EACzBA,EAAyB;EACzBA,EAAyB;EACzBA,EAAyB;CAC3B,EACF;CAEA,QAAQ,EAAE,OAAO,CAACA,EAAyB,mBAAmB,EAAE;AAClE;AAEA,SAAgBC,EACd,GACA,GACS;CACT,IAAMC,IAAOH,EAAuBI;CAGpC,OADA,EADID,EAAK,SAAS,CAACA,EAAK,MAAM,OAAO,MAAME,EAAcC,CAAC,CAAC,KACvDH,EAAK,SAAS,CAACA,EAAK,MAAM,MAAM,MAAME,EAAcC,CAAC,CAAC;AAE5D;AAGA,SAASC,EAAQ,GAAsB;CACrC,IAAMC,IAAUC,EAAsBC,CAAG;CACzC,OAAOF,IAAU,EAAQA,EAAQ,QAAS;AAC5C;AAOA,SAAgBG,IAA4D;CAC1E,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7B,EAAE,kBAAe,iBAAcC,EAAe,GAC9CC,IAAmBV,EAAQ,wBAAwB,GACnDW,IAAgBX,EAAQ,qBAAqB,GAC7CY,IAAiBZ,EAAQ,sBAAsB;CAmCrD,OAAO;EAAE,OAjCKa,QAAc;GAC1B,IAAMC,IAA+C;IACnD;KACE,IAAI;KACJ,OAAOT,EAAG,+BAA+B,MAAM;KAC/C,MAAME,EAAM;KACZ,SAASI;IACX;IACA;KACE,IAAI;KACJ,OAAON,EAAG,sCAAsC,cAAc;KAC9D,MAAME,EAAM;KACZ,SAASK;IACX;IACA;KACE,IAAI;KACJ,OAAOP,EAAG,oCAAoC,WAAW;KACzD,MAAME,EAAM;KACZ,SAASG;IACX;IACA;KACE,IAAI;KACJ,OAAOL,EAAG,iCAAiC,QAAQ;KACnD,MAAME,EAAM;KACZ,SAASI;IACX;GACF;GAEA,OADII,IAAkB,CAAC,IAChBD,EACJ,QAAQ,MAASE,EAAK,WAAWrB,EAAyBqB,EAAK,IAAIlB,CAAa,CAAC,CAAC,CAClF,KAAK,EAAE,OAAI,UAAO,eAAY;IAAE;IAAI;IAAO;GAAK,EAAE;EACvD,GAAG;GAACO;GAAIE;GAAOI;GAAeC;GAAgBF;GAAkBK;GAAWjB;EAAa,CAE/E;EAAO;CAAU;AAC5B"}