@burdenoff/microfe-notification 2026.1129.3 → 2026.1130.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesPage.js","names":["PreferencesPage","tr","useTr","navigate","useNavigate","paths","useNotificationPaths","toggles","usePreferenceToggles","topicsLoading","useNotificationTopics","search","setSearch","useState","shownTopics","useMemo","query","topics","topic","paused","preferenceKey","row","PreferenceRow","target","PageHeader","Button","Inbox","SettingsSection","BellOff","Bell","EVERYDAY_CHANNELS","MORE_CHANNELS","channel","PushOptInToggle","TYPES","type","isForbidden","Megaphone","Search","Input","event","key","existing","enabled","feedback","description","options","Icon","Check","X","SettingRow","Switch","ids"],"sources":["../../src/v2/PreferencesPage.tsx"],"sourcesContent":["/**\n * Notification settings (BOFF-16785, C1; the mockup's `nprefs`), under fe-libs' `accountPagesV2`:\n * pause everything, where you hear from us, what you hear about, and the updates you can opt into,\n * as settings sections. Every switch makes the same calls as today's settings\n * (`usePreferenceToggles`); a choice you changed can go back to the default.\n */\nimport { useMemo, useState, type ReactNode } from 'react';\nimport { useNavigate } from 'react-router';\nimport { Bell, BellOff, Check, Inbox, Megaphone, Search, X } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { PushOptInToggle } from '@burdenoff/fe-libs/chrome';\nimport { Button, Input, SettingRow, SettingsSection, Switch } from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport {\n preferenceKey,\n usePreferenceToggles,\n type PreferenceTarget,\n} from '../hooks/usePreferenceToggles';\nimport { useTr } from '../shared/hooks/useTr';\nimport { useNotificationPaths } from '../navigation-v2/paths';\nimport { EVERYDAY_CHANNELS, MORE_CHANNELS, TYPES } from '../navigation-v2/settingsOptions';\n\nexport function PreferencesPage() {\n const tr = useTr();\n const navigate = useNavigate();\n const paths = useNotificationPaths();\n const toggles = usePreferenceToggles();\n const {\n topics,\n isLoading: topicsLoading,\n isForbidden,\n } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const [search, setSearch] = useState('');\n const shownTopics = useMemo(() => {\n const query = search.trim().toLowerCase();\n if (!query) return topics;\n return topics.filter(\n (topic) =>\n topic.name.toLowerCase().includes(query) || topic.description?.toLowerCase().includes(query)\n );\n }, [search, topics]);\n const paused =\n toggles.preferencesByKey.get(preferenceKey({ scope: 'GLOBAL' }))?.enabled === false;\n\n const row = (target: PreferenceTarget, label: string, options: RowOptions = {}) => (\n <PreferenceRow\n key={preferenceKey(target)}\n target={target}\n label={label}\n options={options}\n toggles={toggles}\n />\n );\n\n return (\n <div data-account-pages-v2=\"notification-settings\" className=\"flex w-full min-w-0 flex-col\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.title', 'Notifications')}\n description={tr('notifications.v3.prefs.purpose', 'Choose what reaches you, and where.')}\n secondary={\n <Button variant=\"outline\" onClick={() => navigate(paths.inbox)}>\n <Inbox aria-hidden=\"true\" />\n {tr('notifications.v3.prefs.openInbox', 'Open the inbox')}\n </Button>\n }\n />\n <div className=\"flex flex-col gap-4\">\n <SettingsSection\n icon={BellOff}\n title={tr('notifications.v3.prefs.pauseTitle', 'Pause everything')}\n >\n {row({ scope: 'GLOBAL' }, tr('notifications.v3.prefs.pause', 'Pause notifications'), {\n description: paused\n ? tr(\n 'notifications.v3.prefs.pausedNow',\n 'Paused. Nothing reaches you until you turn this off.'\n )\n : tr(\n 'notifications.v3.prefs.pauseHelp',\n 'Stop every notification, everywhere, until you turn this off.'\n ),\n inverted: true,\n })}\n </SettingsSection>\n <SettingsSection\n icon={Bell}\n title={tr('notifications.v3.prefs.whereTitle', 'Where you hear from us')}\n >\n {[...EVERYDAY_CHANNELS, ...MORE_CHANNELS].map((channel) =>\n row({ scope: 'CHANNEL', channel: channel.value }, tr(channel.labelKey, channel.label))\n )}\n <div className=\"px-1 py-2\">\n <PushOptInToggle />\n </div>\n </SettingsSection>\n <SettingsSection\n icon={Inbox}\n title={tr('notifications.v3.prefs.whatTitle', 'What you hear about')}\n >\n {TYPES.map((type) =>\n row({ scope: 'TYPE', type: type.value }, tr(type.labelKey, type.label))\n )}\n </SettingsSection>\n {!topicsLoading && !isForbidden && topics.length > 0 ? (\n <SettingsSection\n icon={Megaphone}\n title={tr('notifications.v3.prefs.topicsTitle', 'Updates you can opt into')}\n >\n {topics.length > 5 ? (\n <label className=\"relative block px-1 py-2\">\n <span className=\"sr-only\">\n {tr('notifications.searchTopics', 'Search topics...')}\n </span>\n <Search\n className=\"pointer-events-none absolute top-1/2 left-4 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\n className=\"pl-9\"\n value={search}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n onChange={(event) => setSearch(event.target.value)}\n />\n </label>\n ) : null}\n {shownTopics.length === 0 ? (\n <p className=\"m-0 px-1 py-2 text-sm text-text-secondary\">\n {tr('notifications.noTopicsFound', 'No topics match your search')}\n </p>\n ) : (\n shownTopics.map((topic) =>\n row({ scope: 'TOPIC', topicId: topic.id }, topic.name, {\n description: topic.description || undefined,\n })\n )\n )}\n </SettingsSection>\n ) : null}\n </div>\n </div>\n );\n}\n\ninterface RowOptions {\n description?: string;\n /** \"Pause\" reads the other way round: on means delivery is off. */\n inverted?: boolean;\n}\n\nfunction PreferenceRow({\n target,\n label,\n options,\n toggles,\n}: {\n target: PreferenceTarget;\n label: string;\n options: RowOptions;\n toggles: ReturnType<typeof usePreferenceToggles>;\n}) {\n const tr = useTr();\n const key = preferenceKey(target);\n const existing = toggles.preferencesByKey.get(key);\n const enabled = existing?.enabled ?? true;\n const feedback = toggles.saveFeedback?.key === key ? toggles.saveFeedback : null;\n let description: ReactNode = options.description;\n if (feedback) {\n const Icon = feedback.type === 'success' ? Check : X;\n description = (\n <span\n className={`inline-flex items-center gap-1 ${feedback.type === 'success' ? 'text-status-success-text' : 'text-status-error-text'}`}\n role={feedback.type === 'error' ? 'alert' : 'status'}\n >\n <Icon className=\"size-3.5\" aria-hidden=\"true\" />\n {feedback.message}\n </span>\n );\n }\n return (\n <SettingRow\n label={label}\n description={description}\n control={(ids) => (\n <span className=\"flex items-center gap-2\">\n {existing ? (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={toggles.savingKey === key}\n onClick={() => void toggles.resetPreference(key)}\n >\n {tr('notifications.v3.prefs.useDefault', 'Use default')}\n </Button>\n ) : null}\n <Switch\n checked={options.inverted ? !enabled : enabled}\n disabled={toggles.savingKey === key}\n onCheckedChange={() => void toggles.togglePreference(target)}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n data-testid={`pref-${key}`}\n />\n </span>\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AAsBA,SAAgBA,IAAkB;CAChC,IAAMC,IAAKC,EAAM,GACXC,IAAWC,EAAY,GACvBC,IAAQC,EAAqB,GAC7BC,IAAUC,EAAqB,GAC/B,EACJ,WACA,WAAWC,GACX,mBACEC,EAAsB;EACxB,MAAM;EACN,UAAU;CACZ,CAAC,GACK,CAACC,GAAQC,KAAaC,EAAS,EAAE,GACjCC,IAAcC,QAAc;EAChC,IAAMC,IAAQL,EAAO,KAAK,CAAC,CAAC,YAAY;EAExC,OADKK,IACEC,EAAO,QACX,MACCC,EAAM,KAAK,YAAY,CAAC,CAAC,SAASF,CAAK,KAAKE,EAAM,aAAa,YAAY,CAAC,CAAC,SAASF,CAAK,CAC/F,IAJmBC;CAKrB,GAAG,CAACN,GAAQM,CAAM,CAAC,GACbE,IACJZ,EAAQ,iBAAiB,IAAIa,EAAc,EAAE,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,IAE1EC,KAAO,GAA0B,GAAe,IAAsB,CAAC,MAC3E,kBAACC,GAAD;EAEU;EACD;EACE;EACA;CACV,GALMF,EAAcG,CAAM,CAK1B;CAGH,OACE,kBAAC,OAAD;EAAK,yBAAsB;EAAwB,WAAU;EAA7D,UAAA,C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,QAAD;GAAM,WAAU;GAAhB,UAAA,CACGR,IACC,kBAACjB,GAAD;IACE,MAAK;IACL,SAAQ;IACR,UAAUlB,EAAQ,cAAckC;IAChC,eAAe,KAAKlC,EAAQ,gBAAgBkC,CAAG;IAE9C,UAAAxC,EAAG,qCAAqC,aAAa;GAChD,CAAA,IACN,MACJ,kBAACkD,GAAD;IACE,SAASL,EAAQ,WAAW,CAACH,IAAUA;IACvC,UAAUpC,EAAQ,cAAckC;IAChC,uBAAuB,KAAKlC,EAAQ,iBAAiBgB,CAAM;IAC3D,mBAAiB6B,EAAI;IACrB,oBAAkBA,EAAI;IACtB,eAAa,QAAQX;GACtB,CAAA,CACG;;CAET,CAAA;AAEL"}
1
+ {"version":3,"file":"PreferencesPage.js","names":["PreferencesPage","tr","useTr","navigate","useNavigate","paths","useNotificationPaths","toggles","usePreferenceToggles","topicsLoading","useNotificationTopics","search","setSearch","useState","shownTopics","useMemo","query","topics","topic","paused","preferenceKey","row","PreferenceRow","target","WorkspacePage","PageHeader","Button","Inbox","SettingsSection","BellOff","Bell","EVERYDAY_CHANNELS","MORE_CHANNELS","channel","PushOptInToggle","TYPES","type","isForbidden","Megaphone","Search","Input","event","key","existing","enabled","feedback","description","options","Icon","Check","X","SettingRow","Switch","ids"],"sources":["../../src/v2/PreferencesPage.tsx"],"sourcesContent":["/**\n * Notification settings (BOFF-16785, C1; the mockup's `nprefs`), under fe-libs' `accountPagesV2`:\n * pause everything, where you hear from us, what you hear about, and the updates you can opt into,\n * as settings sections. Every switch makes the same calls as today's settings\n * (`usePreferenceToggles`); a choice you changed can go back to the default.\n */\nimport { useMemo, useState, type ReactNode } from 'react';\nimport { useNavigate } from 'react-router';\nimport { Bell, BellOff, Check, Inbox, Megaphone, Search, X } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { PushOptInToggle } from '@burdenoff/fe-libs/chrome';\nimport {\n Button,\n Input,\n SettingRow,\n SettingsSection,\n Switch,\n WorkspacePage,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../hooks';\nimport {\n preferenceKey,\n usePreferenceToggles,\n type PreferenceTarget,\n} from '../hooks/usePreferenceToggles';\nimport { useTr } from '../shared/hooks/useTr';\nimport { useNotificationPaths } from '../navigation-v2/paths';\nimport { EVERYDAY_CHANNELS, MORE_CHANNELS, TYPES } from '../navigation-v2/settingsOptions';\n\nexport function PreferencesPage() {\n const tr = useTr();\n const navigate = useNavigate();\n const paths = useNotificationPaths();\n const toggles = usePreferenceToggles();\n const {\n topics,\n isLoading: topicsLoading,\n isForbidden,\n } = useNotificationTopics({\n type: 'MARKETING',\n isActive: true,\n });\n const [search, setSearch] = useState('');\n const shownTopics = useMemo(() => {\n const query = search.trim().toLowerCase();\n if (!query) return topics;\n return topics.filter(\n (topic) =>\n topic.name.toLowerCase().includes(query) || topic.description?.toLowerCase().includes(query)\n );\n }, [search, topics]);\n const paused =\n toggles.preferencesByKey.get(preferenceKey({ scope: 'GLOBAL' }))?.enabled === false;\n\n const row = (target: PreferenceTarget, label: string, options: RowOptions = {}) => (\n <PreferenceRow\n key={preferenceKey(target)}\n target={target}\n label={label}\n options={options}\n toggles={toggles}\n />\n );\n\n return (\n <WorkspacePage>\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.title', 'Notifications')}\n description={tr('notifications.v3.prefs.purpose', 'Choose what reaches you, and where.')}\n secondary={\n <Button variant=\"outline\" onClick={() => navigate(paths.inbox)}>\n <Inbox aria-hidden=\"true\" />\n {tr('notifications.v3.prefs.openInbox', 'Open the inbox')}\n </Button>\n }\n />\n <div className=\"flex flex-col gap-4\">\n <SettingsSection\n icon={BellOff}\n title={tr('notifications.v3.prefs.pauseTitle', 'Pause everything')}\n >\n {row({ scope: 'GLOBAL' }, tr('notifications.v3.prefs.pause', 'Pause notifications'), {\n description: paused\n ? tr(\n 'notifications.v3.prefs.pausedNow',\n 'Paused. Nothing reaches you until you turn this off.'\n )\n : tr(\n 'notifications.v3.prefs.pauseHelp',\n 'Stop every notification, everywhere, until you turn this off.'\n ),\n inverted: true,\n })}\n </SettingsSection>\n <SettingsSection\n icon={Bell}\n title={tr('notifications.v3.prefs.whereTitle', 'Where you hear from us')}\n >\n {[...EVERYDAY_CHANNELS, ...MORE_CHANNELS].map((channel) =>\n row({ scope: 'CHANNEL', channel: channel.value }, tr(channel.labelKey, channel.label))\n )}\n <div className=\"px-1 py-2\">\n <PushOptInToggle />\n </div>\n </SettingsSection>\n <SettingsSection\n icon={Inbox}\n title={tr('notifications.v3.prefs.whatTitle', 'What you hear about')}\n >\n {TYPES.map((type) =>\n row({ scope: 'TYPE', type: type.value }, tr(type.labelKey, type.label))\n )}\n </SettingsSection>\n {!topicsLoading && !isForbidden && topics.length > 0 ? (\n <SettingsSection\n icon={Megaphone}\n title={tr('notifications.v3.prefs.topicsTitle', 'Updates you can opt into')}\n >\n {topics.length > 5 ? (\n <label className=\"relative block px-1 py-2\">\n <span className=\"sr-only\">\n {tr('notifications.searchTopics', 'Search topics...')}\n </span>\n <Search\n className=\"pointer-events-none absolute top-1/2 left-4 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\n className=\"pl-9\"\n value={search}\n placeholder={tr('notifications.searchTopics', 'Search topics...')}\n onChange={(event) => setSearch(event.target.value)}\n />\n </label>\n ) : null}\n {shownTopics.length === 0 ? (\n <p className=\"m-0 px-1 py-2 text-sm text-text-secondary\">\n {tr('notifications.noTopicsFound', 'No topics match your search')}\n </p>\n ) : (\n shownTopics.map((topic) =>\n row({ scope: 'TOPIC', topicId: topic.id }, topic.name, {\n description: topic.description || undefined,\n })\n )\n )}\n </SettingsSection>\n ) : null}\n </div>\n </WorkspacePage>\n );\n}\n\ninterface RowOptions {\n description?: string;\n /** \"Pause\" reads the other way round: on means delivery is off. */\n inverted?: boolean;\n}\n\nfunction PreferenceRow({\n target,\n label,\n options,\n toggles,\n}: {\n target: PreferenceTarget;\n label: string;\n options: RowOptions;\n toggles: ReturnType<typeof usePreferenceToggles>;\n}) {\n const tr = useTr();\n const key = preferenceKey(target);\n const existing = toggles.preferencesByKey.get(key);\n const enabled = existing?.enabled ?? true;\n const feedback = toggles.saveFeedback?.key === key ? toggles.saveFeedback : null;\n let description: ReactNode = options.description;\n if (feedback) {\n const Icon = feedback.type === 'success' ? Check : X;\n description = (\n <span\n className={`inline-flex items-center gap-1 ${feedback.type === 'success' ? 'text-status-success-text' : 'text-status-error-text'}`}\n role={feedback.type === 'error' ? 'alert' : 'status'}\n >\n <Icon className=\"size-3.5\" aria-hidden=\"true\" />\n {feedback.message}\n </span>\n );\n }\n return (\n <SettingRow\n label={label}\n description={description}\n control={(ids) => (\n <span className=\"flex items-center gap-2\">\n {existing ? (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={toggles.savingKey === key}\n onClick={() => void toggles.resetPreference(key)}\n >\n {tr('notifications.v3.prefs.useDefault', 'Use default')}\n </Button>\n ) : null}\n <Switch\n checked={options.inverted ? !enabled : enabled}\n disabled={toggles.savingKey === key}\n onCheckedChange={() => void toggles.togglePreference(target)}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n data-testid={`pref-${key}`}\n />\n </span>\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAgBA,IAAkB;CAChC,IAAMC,IAAKC,EAAM,GACXC,IAAWC,EAAY,GACvBC,IAAQC,EAAqB,GAC7BC,IAAUC,EAAqB,GAC/B,EACJ,WACA,WAAWC,GACX,mBACEC,EAAsB;EACxB,MAAM;EACN,UAAU;CACZ,CAAC,GACK,CAACC,GAAQC,KAAaC,EAAS,EAAE,GACjCC,IAAcC,QAAc;EAChC,IAAMC,IAAQL,EAAO,KAAK,CAAC,CAAC,YAAY;EAExC,OADKK,IACEC,EAAO,QACX,MACCC,EAAM,KAAK,YAAY,CAAC,CAAC,SAASF,CAAK,KAAKE,EAAM,aAAa,YAAY,CAAC,CAAC,SAASF,CAAK,CAC/F,IAJm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MG,IAAOH,EAAS,SAAS,YAAYI,IAAQC;EACnD,IACE,kBAAC,QAAD;GACE,WAAW,kCAAkCL,EAAS,SAAS,YAAY,6BAA6B;GACxG,MAAMA,EAAS,SAAS,UAAU,UAAU;GAF9C,UAAA,CAIE,kBAACG,GAAD;IAAM,WAAU;IAAW,eAAY;GAAQ,CAAA,GAC9CH,EAAS,OACN;;CAEV;CACA,OACE,kBAACM,GAAD;EACS;EACM;EACb,UAAU,MACR,kBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACGR,IACC,kBAACjB,GAAD;IACE,MAAK;IACL,SAAQ;IACR,UAAUnB,EAAQ,cAAcmC;IAChC,eAAe,KAAKnC,EAAQ,gBAAgBmC,CAAG;IAE9C,UAAAzC,EAAG,qCAAqC,aAAa;GAChD,CAAA,IACN,MACJ,kBAACmD,GAAD;IACE,SAASL,EAAQ,WAAW,CAACH,IAAUA;IACvC,UAAUrC,EAAQ,cAAcmC;IAChC,uBAAuB,KAAKnC,EAAQ,iBAAiBgB,CAAM;IAC3D,mBAAiB8B,EAAI;IACrB,oBAAkBA,EAAI;IACtB,eAAa,QAAQX;GACtB,CAAA,CACG;;CAET,CAAA;AAEL"}
@@ -2,38 +2,41 @@ import { useNotificationAdmin as e } from "../../hooks/useNotificationAdmin.js";
2
2
  import { useTr as t } from "../../shared/hooks/useTr.js";
3
3
  import { useNotificationPaths as n } from "../../navigation-v2/paths.js";
4
4
  import { AdminPageV2 as r } from "../../navigation-v2/AdminPageV2.js";
5
- import { NotificationCenterPage as i } from "../../pages/NotificationCenterPage.js";
6
- import { NotificationDetailPanel as a } from "../NotificationDetailPanel.js";
7
- import { groupByDay as o } from "../model/days.js";
8
- import { channelWord as s, deliveryState as c } from "./words.js";
9
- import { useMemo as l, useState as u } from "react";
10
- import { useFeatureFlagDetails as d } from "@burdenoff/fe-libs/shared/feature-flags";
11
- import { CheckCircle2 as f, Clock as p, XCircle as m } from "lucide-react";
5
+ import { NotificationDetailPanel as i } from "../NotificationDetailPanel.js";
6
+ import { groupByDay as a } from "../model/days.js";
7
+ import { channelWord as o, deliveryState as s } from "./words.js";
8
+ import { useMemo as c, useState as l } from "react";
9
+ import { useFeatureFlagDetails as u } from "@burdenoff/fe-libs/shared/feature-flags";
10
+ import { CheckCircle2 as d, Clock as f, XCircle as p } from "lucide-react";
11
+ import { Navigate as m } from "react-router";
12
12
  import { jsx as h, jsxs as g } from "react/jsx-runtime";
13
13
  import { PageHeader as _ } from "@burdenoff/fe-libs/chrome";
14
- import { EmptyState as v, LoadError as y, Segmented as b, Skeleton as x, StatusChip as S, useWhenLabels as C } from "@burdenoff/fe-libs/ui";
14
+ import { EmptyState as v, LoadError as y, Segmented as b, Skeleton as x, StatusChip as S, WorkspacePage as C, useWhenLabels as w } from "@burdenoff/fe-libs/ui";
15
15
  // src/v2/admin/DeliveryLogPage.tsx
16
- var w = {
17
- ok: f,
18
- bad: m,
19
- waiting: p
20
- }, T = new Intl.NumberFormat(), E = {
16
+ var T = {
17
+ ok: d,
18
+ bad: p,
19
+ waiting: f
20
+ }, E = new Intl.NumberFormat(), D = {
21
21
  ok: "text-status-success-text",
22
22
  bad: "text-status-error-text",
23
23
  waiting: "text-status-warning-text"
24
24
  };
25
- function D() {
26
- let e = d("notification.history");
27
- return e && e.value ? /* @__PURE__ */ h(r, {
25
+ function O() {
26
+ let e = u("notification.history"), t = n(), i = e ? !!e.value : !1;
27
+ return /* @__PURE__ */ h(r, {
28
28
  tool: "deliveryLog",
29
29
  back: !1,
30
- children: /* @__PURE__ */ h(P, {})
31
- }) : /* @__PURE__ */ h(i, {});
30
+ children: i ? /* @__PURE__ */ h(F, {}) : /* @__PURE__ */ h(m, {
31
+ to: t.inbox,
32
+ replace: !0
33
+ })
34
+ });
32
35
  }
33
- function O(e, t) {
36
+ function k(e, t) {
34
37
  return e.recipientEmail || e.recipientPhone || t("notifications.v3.log.inApp", "someone in the app");
35
38
  }
36
- function k({ counts: e, tone: n, onTone: r }) {
39
+ function A({ counts: e, tone: n, onTone: r }) {
37
40
  let i = t();
38
41
  return /* @__PURE__ */ g("div", {
39
42
  className: "flex flex-wrap items-center gap-2",
@@ -41,15 +44,15 @@ function k({ counts: e, tone: n, onTone: r }) {
41
44
  children: [
42
45
  /* @__PURE__ */ h(S, {
43
46
  status: "ok",
44
- children: i("notifications.v3.log.delivered", "{{count}} delivered", { count: T.format(e.ok) })
47
+ children: i("notifications.v3.log.delivered", "{{count}} delivered", { count: E.format(e.ok) })
45
48
  }),
46
49
  /* @__PURE__ */ h(S, {
47
50
  status: "bad",
48
- children: i("notifications.v3.log.failed", "{{count}} didn’t arrive", { count: T.format(e.bad) })
51
+ children: i("notifications.v3.log.failed", "{{count}} didn’t arrive", { count: E.format(e.bad) })
49
52
  }),
50
53
  /* @__PURE__ */ h(S, {
51
54
  status: "waiting",
52
- children: i("notifications.v3.log.waiting", "{{count}} waiting", { count: T.format(e.waiting) })
55
+ children: i("notifications.v3.log.waiting", "{{count}} waiting", { count: E.format(e.waiting) })
53
56
  }),
54
57
  /* @__PURE__ */ h("span", { className: "flex-1" }),
55
58
  /* @__PURE__ */ h(b, {
@@ -78,8 +81,8 @@ function k({ counts: e, tone: n, onTone: r }) {
78
81
  ]
79
82
  });
80
83
  }
81
- function A({ item: e, onOpen: n }) {
82
- let r = t(), i = C(), { notification: a, state: o } = e, c = w[o.tone];
84
+ function j({ item: e, onOpen: n }) {
85
+ let r = t(), i = w(), { notification: a, state: s } = e, c = T[s.tone];
83
86
  return /* @__PURE__ */ h("li", {
84
87
  "data-row-id": a.id,
85
88
  children: /* @__PURE__ */ g("button", {
@@ -88,7 +91,7 @@ function A({ item: e, onOpen: n }) {
88
91
  onClick: () => n(a.id),
89
92
  children: [
90
93
  /* @__PURE__ */ h(c, {
91
- className: `size-4 shrink-0 ${E[o.tone]}`,
94
+ className: `size-4 shrink-0 ${D[s.tone]}`,
92
95
  "aria-hidden": "true"
93
96
  }),
94
97
  /* @__PURE__ */ g("span", {
@@ -97,14 +100,14 @@ function A({ item: e, onOpen: n }) {
97
100
  className: "block truncate text-sm text-text-primary",
98
101
  children: r("notifications.v3.log.line", "{{title}} → {{who}}", {
99
102
  title: a.title,
100
- who: O(a, r)
103
+ who: k(a, r)
101
104
  })
102
105
  }), /* @__PURE__ */ g("span", {
103
106
  className: "block truncate text-xs text-text-secondary",
104
107
  children: [
105
- s(a.channel, r),
108
+ o(a.channel, r),
106
109
  " · ",
107
- o.word
110
+ s.word
108
111
  ]
109
112
  })]
110
113
  }),
@@ -117,12 +120,12 @@ function A({ item: e, onOpen: n }) {
117
120
  })
118
121
  });
119
122
  }
120
- function j({ items: e, onOpen: n }) {
123
+ function M({ items: e, onOpen: n }) {
121
124
  let r = t();
122
125
  return /* @__PURE__ */ h("div", {
123
126
  className: "flex flex-col gap-4",
124
127
  "data-testid": "log-rows",
125
- children: o(e, r).map((e) => /* @__PURE__ */ g("section", {
128
+ children: a(e, r).map((e) => /* @__PURE__ */ g("section", {
126
129
  "aria-label": e.label,
127
130
  className: "flex flex-col gap-1",
128
131
  children: [/* @__PURE__ */ h("h2", {
@@ -130,7 +133,7 @@ function j({ items: e, onOpen: n }) {
130
133
  children: e.label
131
134
  }), /* @__PURE__ */ h("ul", {
132
135
  className: "m-0 flex list-none flex-col divide-y divide-border-subtle overflow-hidden rounded-lg border border-border-subtle bg-bg-surface p-0",
133
- children: e.items.map((e) => /* @__PURE__ */ h(A, {
136
+ children: e.items.map((e) => /* @__PURE__ */ h(j, {
134
137
  item: e,
135
138
  onOpen: n
136
139
  }, e.notification.id))
@@ -138,7 +141,7 @@ function j({ items: e, onOpen: n }) {
138
141
  }, e.key))
139
142
  });
140
143
  }
141
- function M({ filtered: e }) {
144
+ function N({ filtered: e }) {
142
145
  let n = t();
143
146
  return /* @__PURE__ */ h(v, {
144
147
  kind: e ? "filtered" : "first-use",
@@ -146,19 +149,19 @@ function M({ filtered: e }) {
146
149
  description: n("notifications.v3.log.emptyBody", "Each notification sent is listed here with what happened to it.")
147
150
  });
148
151
  }
149
- function N() {
152
+ function P() {
150
153
  return /* @__PURE__ */ h("div", {
151
154
  className: "flex flex-col gap-2",
152
155
  "aria-busy": "true",
153
156
  children: Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ h(x, { className: "h-12 w-full rounded-lg" }, t))
154
157
  });
155
158
  }
156
- function P() {
157
- let r = t(), i = n(), o = e(), [s, d] = u("any"), [f, p] = u(null), m = l(() => o.notifications.map((e) => ({
159
+ function F() {
160
+ let r = t(), a = n(), o = e(), [u, d] = l("any"), [f, p] = l(null), m = c(() => o.notifications.map((e) => ({
158
161
  notification: e,
159
- state: c(e.deliveryStatus, r),
162
+ state: s(e.deliveryStatus, r),
160
163
  createdAt: e.createdAt
161
- })), [o.notifications, r]), v = l(() => {
164
+ })), [o.notifications, r]), v = c(() => {
162
165
  let e = {
163
166
  ok: 0,
164
167
  bad: 0,
@@ -166,7 +169,7 @@ function P() {
166
169
  };
167
170
  for (let t of m) e[t.state.tone] += 1;
168
171
  return e;
169
- }, [m]), b = s === "any" ? m : m.filter((e) => e.state.tone === s), x = m.length === 0, S = /* @__PURE__ */ h(j, {
172
+ }, [m]), b = u === "any" ? m : m.filter((e) => e.state.tone === u), x = m.length === 0, S = /* @__PURE__ */ h(M, {
170
173
  items: b,
171
174
  onOpen: p
172
175
  });
@@ -174,34 +177,30 @@ function P() {
174
177
  what: r("notifications.v3.log.title", "Delivery log"),
175
178
  error: o.error,
176
179
  onRetry: () => void o.refetch()
177
- }) : o.isLoading && x ? S = /* @__PURE__ */ h(N, {}) : b.length === 0 && (S = /* @__PURE__ */ h(M, { filtered: s !== "any" })), /* @__PURE__ */ g("div", {
178
- "data-account-pages-v2": "notification-delivery-log",
179
- className: "flex w-full min-w-0 flex-col",
180
- children: [
181
- /* @__PURE__ */ h(_, {
182
- variant: "compact",
183
- title: r("notifications.v3.log.title", "Delivery log"),
184
- description: r("notifications.v3.log.purpose", "Every notification sent, and whether it arrived."),
185
- back: {
186
- label: r("notifications.v3.title", "Notifications"),
187
- to: i.inbox
188
- }
189
- }),
190
- /* @__PURE__ */ g("div", {
191
- className: "flex flex-col gap-3",
192
- children: [/* @__PURE__ */ h(k, {
193
- counts: v,
194
- tone: s,
195
- onTone: d
196
- }), S]
197
- }),
198
- /* @__PURE__ */ h(a, {
199
- id: f,
200
- onClose: () => p(null)
201
- })
202
- ]
203
- });
180
+ }) : o.isLoading && x ? S = /* @__PURE__ */ h(P, {}) : b.length === 0 && (S = /* @__PURE__ */ h(N, { filtered: u !== "any" })), /* @__PURE__ */ g(C, { children: [
181
+ /* @__PURE__ */ h(_, {
182
+ variant: "compact",
183
+ title: r("notifications.v3.log.title", "Delivery log"),
184
+ description: r("notifications.v3.log.purpose", "Every notification sent, and whether it arrived."),
185
+ back: {
186
+ label: r("notifications.v3.title", "Notifications"),
187
+ to: a.inbox
188
+ }
189
+ }),
190
+ /* @__PURE__ */ g("div", {
191
+ className: "flex flex-col gap-3",
192
+ children: [/* @__PURE__ */ h(A, {
193
+ counts: v,
194
+ tone: u,
195
+ onTone: d
196
+ }), S]
197
+ }),
198
+ /* @__PURE__ */ h(i, {
199
+ id: f,
200
+ onClose: () => p(null)
201
+ })
202
+ ] });
204
203
  }
205
- export { D as DeliveryLogPage };
204
+ export { O as DeliveryLogPage };
206
205
 
207
206
  //# sourceMappingURL=DeliveryLogPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeliveryLogPage.js","names":["TONE_ICON","CheckCircle2","XCircle","Clock","COUNT","TONE_TEXT","DeliveryLogPage","details","useFeatureFlagDetails","AdminPageV2","DeliveryLog","NotificationCenterPage","recipientOf","notification","tr","DeliveryCounts","useTr","StatusChip","counts","Segmented","tone","onTone","DeliveryLine","when","useWhenLabels","item","Icon","state","onOpen","channelWord","DeliveryDays","groupByDay","items","group","DeliveryEmpty","EmptyState","filtered","DeliveryLoading","Skeleton","index","paths","useNotificationPaths","admin","useNotificationAdmin","setTone","useState","openId","setOpenId","withState","useMemo","deliveryState","out","shown","empty","body","LoadError","PageHeader","NotificationDetailPanel"],"sources":["../../../src/v2/admin/DeliveryLogPage.tsx"],"sourcesContent":["/**\n * The delivery log (BOFF-16785, C2; the mockup's `ndelivery`), under fe-libs' `accountPagesV2`:\n * every notification sent, and whether it arrived. Counts first (delivered, didn't arrive, waiting),\n * then a line each, grouped by day: what was sent to whom, how, and what happened, with an icon and a\n * word. A line opens the notification's panel, read-only. Admins only (`AdminPageV2`), behind the\n * same flag as today (`notification.history`). Today's hook (`useNotificationAdmin`).\n */\nimport { useMemo, useState } from 'react';\nimport { CheckCircle2, Clock, XCircle } from 'lucide-react';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport {\n EmptyState,\n LoadError,\n Segmented,\n Skeleton,\n StatusChip,\n useWhenLabels,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationAdmin } from '../../hooks/useNotificationAdmin';\nimport type { Notification } from '../../types';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { AdminPageV2 } from '../../navigation-v2/AdminPageV2';\nimport { NotificationCenterPage } from '../../pages/NotificationCenterPage';\nimport { NotificationDetailPanel } from '../NotificationDetailPanel';\nimport { groupByDay } from '../model/days';\nimport { channelWord, deliveryState, type DeliveryTone } from './words';\n\ntype ToneFilter = 'any' | DeliveryTone;\n\nconst TONE_ICON = { ok: CheckCircle2, bad: XCircle, waiting: Clock } as const;\nconst COUNT = new Intl.NumberFormat();\nconst TONE_TEXT: Record<DeliveryTone, string> = {\n ok: 'text-status-success-text',\n bad: 'text-status-error-text',\n waiting: 'text-status-warning-text',\n};\n\nexport function DeliveryLogPage() {\n const details = useFeatureFlagDetails('notification.history');\n // As today: only while `notification.history` is on; otherwise the inbox shows in its place.\n if (!(details ? Boolean(details.value) : false)) return <NotificationCenterPage />;\n return (\n <AdminPageV2 tool=\"deliveryLog\" back={false}>\n <DeliveryLog />\n </AdminPageV2>\n );\n}\n\nfunction recipientOf(\n notification: Notification,\n tr: (key: string, fallback: string) => string\n): string {\n return (\n notification.recipientEmail ||\n notification.recipientPhone ||\n tr('notifications.v3.log.inApp', 'someone in the app')\n );\n}\n\ntype LogItem = {\n notification: Notification;\n state: ReturnType<typeof deliveryState>;\n createdAt: string;\n};\n\nfunction DeliveryCounts({\n counts,\n tone,\n onTone,\n}: {\n counts: Record<DeliveryTone, number>;\n tone: ToneFilter;\n onTone: (tone: ToneFilter) => void;\n}) {\n const tr = useTr();\n return (\n <div className=\"flex flex-wrap items-center gap-2\" data-testid=\"log-counts\">\n <StatusChip status=\"ok\">\n {tr('notifications.v3.log.delivered', '{{count}} delivered', {\n count: COUNT.format(counts.ok),\n })}\n </StatusChip>\n <StatusChip status=\"bad\">\n {tr('notifications.v3.log.failed', '{{count}} didn’t arrive', {\n count: COUNT.format(counts.bad),\n })}\n </StatusChip>\n <StatusChip status=\"waiting\">\n {tr('notifications.v3.log.waiting', '{{count}} waiting', {\n count: COUNT.format(counts.waiting),\n })}\n </StatusChip>\n <span className=\"flex-1\" />\n <Segmented<ToneFilter>\n aria-label={tr('notifications.v3.log.show', 'Show')}\n value={tone}\n onValueChange={onTone}\n options={[\n { value: 'any', label: tr('notifications.v3.log.any', 'All') },\n { value: 'ok', label: tr('notifications.v3.delivery.delivered', 'Delivered') },\n { value: 'bad', label: tr('notifications.v3.delivery.failed', 'Didn’t arrive') },\n { value: 'waiting', label: tr('notifications.v3.log.waitingShort', 'Waiting') },\n ]}\n />\n </div>\n );\n}\n\nfunction DeliveryLine({ item, onOpen }: { item: LogItem; onOpen: (id: string) => void }) {\n const tr = useTr();\n const when = useWhenLabels();\n const { notification, state } = item;\n const Icon = TONE_ICON[state.tone];\n return (\n <li data-row-id={notification.id}>\n <button\n type=\"button\"\n className=\"flex w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-3 py-2.5 text-left\"\n onClick={() => onOpen(notification.id)}\n >\n <Icon className={`size-4 shrink-0 ${TONE_TEXT[state.tone]}`} aria-hidden=\"true\" />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-sm text-text-primary\">\n {tr('notifications.v3.log.line', '{{title}} → {{who}}', {\n title: notification.title,\n who: recipientOf(notification, tr),\n })}\n </span>\n <span className=\"block truncate text-xs text-text-secondary\">\n {channelWord(notification.channel, tr)} · {state.word}\n </span>\n </span>\n <time className=\"shrink-0 text-xs text-text-muted\" dateTime={notification.createdAt}>\n {when.moment(notification.createdAt)}\n </time>\n </button>\n </li>\n );\n}\n\nfunction DeliveryDays({ items, onOpen }: { items: LogItem[]; onOpen: (id: string) => void }) {\n const tr = useTr();\n return (\n <div className=\"flex flex-col gap-4\" data-testid=\"log-rows\">\n {groupByDay(items, tr).map((group) => (\n <section key={group.key} aria-label={group.label} className=\"flex flex-col gap-1\">\n <h2 className=\"m-0 px-1 text-xs font-medium text-text-muted\">{group.label}</h2>\n <ul className=\"m-0 flex list-none flex-col divide-y divide-border-subtle overflow-hidden rounded-lg border border-border-subtle bg-bg-surface p-0\">\n {group.items.map((item) => (\n <DeliveryLine key={item.notification.id} item={item} onOpen={onOpen} />\n ))}\n </ul>\n </section>\n ))}\n </div>\n );\n}\n\nfunction DeliveryEmpty({ filtered }: { filtered: boolean }) {\n const tr = useTr();\n return (\n <EmptyState\n kind={filtered ? 'filtered' : 'first-use'}\n title={\n filtered\n ? tr('notifications.v3.log.noneTitle', 'Nothing here')\n : tr('notifications.v3.log.emptyTitle', 'Nothing sent yet')\n }\n description={tr(\n 'notifications.v3.log.emptyBody',\n 'Each notification sent is listed here with what happened to it.'\n )}\n />\n );\n}\n\nfunction DeliveryLoading() {\n return (\n <div className=\"flex flex-col gap-2\" aria-busy=\"true\">\n {Array.from({ length: 6 }, (_, index) => (\n <Skeleton key={index} className=\"h-12 w-full rounded-lg\" />\n ))}\n </div>\n );\n}\n\nfunction DeliveryLog() {\n const tr = useTr();\n const paths = useNotificationPaths();\n const admin = useNotificationAdmin();\n const [tone, setTone] = useState<ToneFilter>('any');\n const [openId, setOpenId] = useState<string | null>(null);\n const withState = useMemo<LogItem[]>(\n () =>\n admin.notifications.map((notification) => ({\n notification,\n state: deliveryState(notification.deliveryStatus, tr),\n createdAt: notification.createdAt,\n })),\n [admin.notifications, tr]\n );\n const counts = useMemo(() => {\n const out = { ok: 0, bad: 0, waiting: 0 };\n for (const item of withState) out[item.state.tone] += 1;\n return out;\n }, [withState]);\n const shown = tone === 'any' ? withState : withState.filter((item) => item.state.tone === tone);\n const empty = withState.length === 0;\n\n let body = <DeliveryDays items={shown} onOpen={setOpenId} />;\n if (admin.error && empty) {\n body = (\n <LoadError\n what={tr('notifications.v3.log.title', 'Delivery log')}\n error={admin.error}\n onRetry={() => void admin.refetch()}\n />\n );\n } else if (admin.isLoading && empty) {\n body = <DeliveryLoading />;\n } else if (shown.length === 0) {\n body = <DeliveryEmpty filtered={tone !== 'any'} />;\n }\n\n return (\n <div data-account-pages-v2=\"notification-delivery-log\" className=\"flex w-full min-w-0 flex-col\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.log.title', 'Delivery log')}\n description={tr(\n 'notifications.v3.log.purpose',\n 'Every notification sent, and whether it arrived.'\n )}\n back={{ label: tr('notifications.v3.title', 'Notifications'), to: paths.inbox }}\n />\n <div className=\"flex flex-col gap-3\">\n <DeliveryCounts counts={counts} tone={tone} onTone={setTone} />\n {body}\n </div>\n <NotificationDetailPanel id={openId} onClose={() => setOpenId(null)} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,IAAMA,IAAY;CAAE,IAAIC;CAAc,KAAKC;CAAS,SAASC;AAAM,GAC7DC,IAAQ,IAAI,KAAK,aAAa,GAC9BC,IAA0C;CAC9C,IAAI;CACJ,KAAK;CACL,SAAS;AACX;AAEA,SAAgBC,IAAkB;CAChC,IAAMC,IAAUC,EAAsB,sBAAsB;CAG5D,OADMD,KAAkBA,EAAQ,QAE9B,kBAACE,GAAD;EAAa,MAAK;EAAc,MAA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IAC5B,IAAO,kBAAChB,GAAD,CAAkB,CAAA,IAChBe,EAAM,WAAW,MAC1B,IAAO,kBAAClB,GAAD,EAAe,UAAUd,MAAS,MAAQ,CAAA,IAIjD,kBAAC,OAAD;EAAK,yBAAsB;EAA4B,WAAU;EAAjE,UAAA;GACE,kBAACoC,GAAD;IACE,SAAQ;IACR,OAAO1C,EAAG,8BAA8B,cAAc;IACtD,aAAaA,EACX,gCACA,kDACF;IACA,MAAM;KAAE,OAAOA,EAAG,0BAA0B,eAAe;KAAG,IAAI0B,EAAM;IAAM;GAC/E,CAAA;GACD,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACzB,GAAD;KAAwB;KAAc;KAAM,QAAQ6B;IAAU,CAAA,GAC7DU,CACE;;GACL,kBAACG,GAAD;IAAyB,IAAIX;IAAQ,eAAeC,EAAU,IAAI;GAAI,CAAA;EACnE;;AAET"}
1
+ {"version":3,"file":"DeliveryLogPage.js","names":["TONE_ICON","CheckCircle2","XCircle","Clock","COUNT","TONE_TEXT","DeliveryLogPage","details","useFeatureFlagDetails","paths","useNotificationPaths","on","AdminPageV2","DeliveryLog","Navigate","recipientOf","notification","tr","DeliveryCounts","useTr","StatusChip","counts","Segmented","tone","onTone","DeliveryLine","when","useWhenLabels","item","Icon","state","onOpen","channelWord","DeliveryDays","groupByDay","items","group","DeliveryEmpty","EmptyState","filtered","DeliveryLoading","Skeleton","index","admin","useNotificationAdmin","setTone","useState","openId","setOpenId","withState","useMemo","deliveryState","out","shown","empty","body","LoadError","WorkspacePage","PageHeader","NotificationDetailPanel"],"sources":["../../../src/v2/admin/DeliveryLogPage.tsx"],"sourcesContent":["/**\n * The delivery log (BOFF-16785, C2; the mockup's `ndelivery`), under fe-libs' `accountPagesV2`:\n * every notification sent, and whether it arrived. Counts first (delivered, didn't arrive, waiting),\n * then a line each, grouped by day: what was sent to whom, how, and what happened, with an icon and a\n * word. A line opens the notification's panel, read-only. Admins only (`AdminPageV2`), behind the\n * same flag as today (`notification.history`). Today's hook (`useNotificationAdmin`).\n */\nimport { useMemo, useState } from 'react';\nimport { Navigate } from 'react-router';\nimport { CheckCircle2, Clock, XCircle } from 'lucide-react';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport {\n EmptyState,\n LoadError,\n Segmented,\n Skeleton,\n StatusChip,\n WorkspacePage,\n useWhenLabels,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationAdmin } from '../../hooks/useNotificationAdmin';\nimport type { Notification } from '../../types';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { AdminPageV2 } from '../../navigation-v2/AdminPageV2';\nimport { NotificationDetailPanel } from '../NotificationDetailPanel';\nimport { groupByDay } from '../model/days';\nimport { channelWord, deliveryState, type DeliveryTone } from './words';\n\ntype ToneFilter = 'any' | DeliveryTone;\n\nconst TONE_ICON = { ok: CheckCircle2, bad: XCircle, waiting: Clock } as const;\nconst COUNT = new Intl.NumberFormat();\nconst TONE_TEXT: Record<DeliveryTone, string> = {\n ok: 'text-status-success-text',\n bad: 'text-status-error-text',\n waiting: 'text-status-warning-text',\n};\n\nexport function DeliveryLogPage() {\n const details = useFeatureFlagDetails('notification.history');\n const paths = useNotificationPaths();\n const on = details ? Boolean(details.value) : false;\n // Someone without the permission sees the lock, whatever the flag says (alpha check BOFF-17355:\n // a member got today's inbox here). An admin while `notification.history` is off goes to the\n // inbox, as today, but the redesigned one, never today's page.\n return (\n <AdminPageV2 tool=\"deliveryLog\" back={false}>\n {on ? <DeliveryLog /> : <Navigate to={paths.inbox} replace />}\n </AdminPageV2>\n );\n}\n\nfunction recipientOf(\n notification: Notification,\n tr: (key: string, fallback: string) => string\n): string {\n return (\n notification.recipientEmail ||\n notification.recipientPhone ||\n tr('notifications.v3.log.inApp', 'someone in the app')\n );\n}\n\ntype LogItem = {\n notification: Notification;\n state: ReturnType<typeof deliveryState>;\n createdAt: string;\n};\n\nfunction DeliveryCounts({\n counts,\n tone,\n onTone,\n}: {\n counts: Record<DeliveryTone, number>;\n tone: ToneFilter;\n onTone: (tone: ToneFilter) => void;\n}) {\n const tr = useTr();\n return (\n <div className=\"flex flex-wrap items-center gap-2\" data-testid=\"log-counts\">\n <StatusChip status=\"ok\">\n {tr('notifications.v3.log.delivered', '{{count}} delivered', {\n count: COUNT.format(counts.ok),\n })}\n </StatusChip>\n <StatusChip status=\"bad\">\n {tr('notifications.v3.log.failed', '{{count}} didn’t arrive', {\n count: COUNT.format(counts.bad),\n })}\n </StatusChip>\n <StatusChip status=\"waiting\">\n {tr('notifications.v3.log.waiting', '{{count}} waiting', {\n count: COUNT.format(counts.waiting),\n })}\n </StatusChip>\n <span className=\"flex-1\" />\n <Segmented<ToneFilter>\n aria-label={tr('notifications.v3.log.show', 'Show')}\n value={tone}\n onValueChange={onTone}\n options={[\n { value: 'any', label: tr('notifications.v3.log.any', 'All') },\n { value: 'ok', label: tr('notifications.v3.delivery.delivered', 'Delivered') },\n { value: 'bad', label: tr('notifications.v3.delivery.failed', 'Didn’t arrive') },\n { value: 'waiting', label: tr('notifications.v3.log.waitingShort', 'Waiting') },\n ]}\n />\n </div>\n );\n}\n\nfunction DeliveryLine({ item, onOpen }: { item: LogItem; onOpen: (id: string) => void }) {\n const tr = useTr();\n const when = useWhenLabels();\n const { notification, state } = item;\n const Icon = TONE_ICON[state.tone];\n return (\n <li data-row-id={notification.id}>\n <button\n type=\"button\"\n className=\"flex w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-3 py-2.5 text-left\"\n onClick={() => onOpen(notification.id)}\n >\n <Icon className={`size-4 shrink-0 ${TONE_TEXT[state.tone]}`} aria-hidden=\"true\" />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-sm text-text-primary\">\n {tr('notifications.v3.log.line', '{{title}} → {{who}}', {\n title: notification.title,\n who: recipientOf(notification, tr),\n })}\n </span>\n <span className=\"block truncate text-xs text-text-secondary\">\n {channelWord(notification.channel, tr)} · {state.word}\n </span>\n </span>\n <time className=\"shrink-0 text-xs text-text-muted\" dateTime={notification.createdAt}>\n {when.moment(notification.createdAt)}\n </time>\n </button>\n </li>\n );\n}\n\nfunction DeliveryDays({ items, onOpen }: { items: LogItem[]; onOpen: (id: string) => void }) {\n const tr = useTr();\n return (\n <div className=\"flex flex-col gap-4\" data-testid=\"log-rows\">\n {groupByDay(items, tr).map((group) => (\n <section key={group.key} aria-label={group.label} className=\"flex flex-col gap-1\">\n <h2 className=\"m-0 px-1 text-xs font-medium text-text-muted\">{group.label}</h2>\n <ul className=\"m-0 flex list-none flex-col divide-y divide-border-subtle overflow-hidden rounded-lg border border-border-subtle bg-bg-surface p-0\">\n {group.items.map((item) => (\n <DeliveryLine key={item.notification.id} item={item} onOpen={onOpen} />\n ))}\n </ul>\n </section>\n ))}\n </div>\n );\n}\n\nfunction DeliveryEmpty({ filtered }: { filtered: boolean }) {\n const tr = useTr();\n return (\n <EmptyState\n kind={filtered ? 'filtered' : 'first-use'}\n title={\n filtered\n ? tr('notifications.v3.log.noneTitle', 'Nothing here')\n : tr('notifications.v3.log.emptyTitle', 'Nothing sent yet')\n }\n description={tr(\n 'notifications.v3.log.emptyBody',\n 'Each notification sent is listed here with what happened to it.'\n )}\n />\n );\n}\n\nfunction DeliveryLoading() {\n return (\n <div className=\"flex flex-col gap-2\" aria-busy=\"true\">\n {Array.from({ length: 6 }, (_, index) => (\n <Skeleton key={index} className=\"h-12 w-full rounded-lg\" />\n ))}\n </div>\n );\n}\n\nfunction DeliveryLog() {\n const tr = useTr();\n const paths = useNotificationPaths();\n const admin = useNotificationAdmin();\n const [tone, setTone] = useState<ToneFilter>('any');\n const [openId, setOpenId] = useState<string | null>(null);\n const withState = useMemo<LogItem[]>(\n () =>\n admin.notifications.map((notification) => ({\n notification,\n state: deliveryState(notification.deliveryStatus, tr),\n createdAt: notification.createdAt,\n })),\n [admin.notifications, tr]\n );\n const counts = useMemo(() => {\n const out = { ok: 0, bad: 0, waiting: 0 };\n for (const item of withState) out[item.state.tone] += 1;\n return out;\n }, [withState]);\n const shown = tone === 'any' ? withState : withState.filter((item) => item.state.tone === tone);\n const empty = withState.length === 0;\n\n let body = <DeliveryDays items={shown} onOpen={setOpenId} />;\n if (admin.error && empty) {\n body = (\n <LoadError\n what={tr('notifications.v3.log.title', 'Delivery log')}\n error={admin.error}\n onRetry={() => void admin.refetch()}\n />\n );\n } else if (admin.isLoading && empty) {\n body = <DeliveryLoading />;\n } else if (shown.length === 0) {\n body = <DeliveryEmpty filtered={tone !== 'any'} />;\n }\n\n return (\n <WorkspacePage>\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.log.title', 'Delivery log')}\n description={tr(\n 'notifications.v3.log.purpose',\n 'Every notification sent, and whether it arrived.'\n )}\n back={{ label: tr('notifications.v3.title', 'Notifications'), to: paths.inbox }}\n />\n <div className=\"flex flex-col gap-3\">\n <DeliveryCounts counts={counts} tone={tone} onTone={setTone} />\n {body}\n </div>\n <NotificationDetailPanel id={openId} onClose={() => setOpenId(null)} />\n </WorkspacePage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,IAAMA,IAAY;CAAE,IAAIC;CAAc,KAAKC;CAAS,SAASC;AAAM,GAC7DC,IAAQ,IAAI,KAAK,aAAa,GAC9BC,IAA0C;CAC9C,IAAI;CACJ,KAAK;CACL,SAAS;AACX;AAEA,SAAgBC,IAAkB;CAChC,IAAMC,IAAUC,EAAsB,sBAAsB,GACtDC,IAAQC,EAAqB,GAC7BC,IAAKJ,IAAU,EAAQA,EAAQ,QAAS;CAI9C,OACE,kBAACK,GAAD;EAAa,MAAK;EAAc,MAAM;EACnC,UAAAD,IAAK,kBAACE,GAAD,CAAc,CAAA,IAAI,kBAACC,GAAD;GAAU,IAAIL,EAAM;GAAO,SAAA;EAAS,CAAA;CACjD,CAAA;AAEjB;AAEA,SAASM,EACP,GACA,GACQ;CACR,OACEC,EAAa,kBACb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AAD,EAAA,UAAA;EACE,kBAACC,GAAD;GACE,SAAQ;GACR,OAAOzC,EAAG,8BAA8B,cAAc;GACtD,aAAaA,EACX,gCACA,kDACF;GACA,MAAM;IAAE,OAAOA,EAAG,0BAA0B,eAAe;IAAG,IAAIR,EAAM;GAAM;EAC/E,CAAA;EACD,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACS,GAAD;IAAwB;IAAc;IAAM,QAAQ2B;GAAU,CAAA,GAC7DU,CACE;;EACL,kBAACI,GAAD;GAAyB,IAAIZ;GAAQ,eAAeC,EAAU,IAAI;EAAI,CAAA;CACzD,EAAA,CAAA;AAEnB"}
@@ -9,9 +9,9 @@ import { useAppShell as c } from "@burdenoff/fe-libs/shared/providers/shell";
9
9
  import { Mail as l } from "lucide-react";
10
10
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
11
11
  import { PageHeader as f } from "@burdenoff/fe-libs/chrome";
12
- import { Button as p, IconTile as m, Notice as h, StatusChip as g } from "@burdenoff/fe-libs/ui";
12
+ import { Button as p, IconTile as m, Notice as h, StatusChip as g, WorkspacePage as _ } from "@burdenoff/fe-libs/ui";
13
13
  // src/v2/admin/TemplateEditor.tsx
14
- function _({ template: n, draft: r }) {
14
+ function v({ template: n, draft: r }) {
15
15
  let i = e(), s = t(), c = n?.enabled ? /* @__PURE__ */ u(g, {
16
16
  status: "ok",
17
17
  children: i("notifications.v3.on", "On")
@@ -54,39 +54,34 @@ function _({ template: n, draft: r }) {
54
54
  }] : void 0
55
55
  });
56
56
  }
57
- function v({ template: t, onChanged: a }) {
57
+ function y({ template: t, onChanged: a }) {
58
58
  let o = e(), { productName: l } = c(), f = s(null), p = s(null), m = i(t, f, p, a);
59
- return /* @__PURE__ */ d("div", {
60
- "data-account-pages-v2": "notification-template",
61
- className: "flex w-full min-w-0 flex-col",
62
- children: [
63
- /* @__PURE__ */ u(_, {
59
+ return /* @__PURE__ */ d(_, { children: [
60
+ /* @__PURE__ */ u(v, {
61
+ template: t,
62
+ draft: m
63
+ }),
64
+ m.problem ? /* @__PURE__ */ u(h, {
65
+ tone: "bad",
66
+ role: "alert",
67
+ children: m.problem
68
+ }) : null,
69
+ /* @__PURE__ */ d("div", {
70
+ className: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)] gap-6 max-lg:grid-cols-1",
71
+ children: [/* @__PURE__ */ u(n, {
64
72
  template: t,
65
- draft: m
66
- }),
67
- m.problem ? /* @__PURE__ */ u(h, {
68
- tone: "bad",
69
- role: "alert",
70
- className: "mb-4",
71
- children: m.problem
72
- }) : null,
73
- /* @__PURE__ */ d("div", {
74
- className: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)] gap-6 max-lg:grid-cols-1",
75
- children: [/* @__PURE__ */ u(n, {
76
- template: t,
77
- draft: m,
78
- titleRef: f,
79
- messageRef: p
80
- }), /* @__PURE__ */ u(r, {
81
- productName: l || o("notifications.v3.template.productFallback", "Your product"),
82
- title: m.stored.title,
83
- message: m.stored.message,
84
- details: m.details
85
- })]
86
- })
87
- ]
88
- });
73
+ draft: m,
74
+ titleRef: f,
75
+ messageRef: p
76
+ }), /* @__PURE__ */ u(r, {
77
+ productName: l || o("notifications.v3.template.productFallback", "Your product"),
78
+ title: m.stored.title,
79
+ message: m.stored.message,
80
+ details: m.details
81
+ })]
82
+ })
83
+ ] });
89
84
  }
90
- export { v as TemplateEditor };
85
+ export { y as TemplateEditor };
91
86
 
92
87
  //# sourceMappingURL=TemplateEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateEditor.js","names":["TemplateHeader","tr","useTr","paths","useNotificationPaths","onOff","template","StatusChip","PageHeader","draft","kindWord","channelWord","IconTile","Mail","Button","TemplateEditor","useAppShell","titleRef","useRef","messageRef","useTemplateDraft","onChanged","Notice","TemplateFields","TemplatePreview","productName"],"sources":["../../../src/v2/admin/TemplateEditor.tsx"],"sourcesContent":["/**\n * The template editor (BOFF-16785, C2): the header, the form and the live preview. Title and\n * message are edited as people read them (`[First name]`); saving stores today's text\n * (`{{firstName}}`) and the details as today's `variables`.\n */\nimport { useRef } from 'react';\nimport { Mail } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { Button, IconTile, Notice, StatusChip } from '@burdenoff/fe-libs/ui';\nimport { useAppShell } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { BackendNotificationTemplate } from '../../hooks/useNotificationTemplates';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { TemplateFields } from './TemplateFields';\nimport { TemplatePreview } from './TemplatePreview';\nimport { useTemplateDraft, type TemplateDraft } from './useTemplateDraft';\nimport { channelWord, kindWord } from './words';\n\nfunction TemplateHeader({\n template,\n draft,\n}: {\n template: BackendNotificationTemplate | null;\n draft: TemplateDraft;\n}) {\n const tr = useTr();\n const paths = useNotificationPaths();\n const onOff = template?.enabled ? (\n <StatusChip status=\"ok\">{tr('notifications.v3.on', 'On')}</StatusChip>\n ) : (\n <StatusChip status=\"paused\">{tr('notifications.v3.off', 'Off')}</StatusChip>\n );\n return (\n <PageHeader\n variant=\"compact\"\n title={\n template?.name || draft.name.trim() || tr('notifications.v3.template.new', 'New template')\n }\n description={\n template\n ? tr('notifications.v3.template.purpose', '{{kind}} · sent by {{channel}}', {\n kind: kindWord(template.type, tr),\n channel: channelWord(template.channel, tr).toLowerCase(),\n })\n : tr(\n 'notifications.v3.template.newPurpose',\n 'Write it once; it’s filled in for each person when it’s sent.'\n )\n }\n icon={\n <IconTile size=\"md\">\n <Mail aria-hidden=\"true\" />\n </IconTile>\n }\n back={{ label: tr('notifications.v3.templates.title', 'Templates'), to: paths.templates }}\n badge={template ? onOff : undefined}\n primary={\n <Button\n busy={draft.saving}\n disabled={!draft.ready}\n onClick={() => void draft.save()}\n data-testid=\"template-save\"\n >\n {template\n ? tr('notifications.v3.template.save', 'Save')\n : tr('notifications.v3.template.create', 'Create template')}\n </Button>\n }\n more={\n template\n ? [\n {\n id: 'toggle',\n label: template.enabled\n ? tr('notifications.v3.templates.turnOff', 'Turn off')\n : tr('notifications.v3.templates.turnOn', 'Turn on'),\n onSelect: () => void draft.toggle(),\n },\n {\n id: 'delete',\n label: tr('notifications.v3.templates.delete', 'Delete'),\n danger: true,\n onSelect: () => void draft.remove(),\n },\n ]\n : undefined\n }\n />\n );\n}\n\nexport function TemplateEditor({\n template,\n onChanged,\n}: {\n template: BackendNotificationTemplate | null;\n /** Read the template again after turning it on or off. */\n onChanged?: () => void;\n}) {\n const tr = useTr();\n const { productName } = useAppShell();\n const titleRef = useRef<HTMLInputElement>(null);\n const messageRef = useRef<HTMLTextAreaElement>(null);\n const draft = useTemplateDraft(template, titleRef, messageRef, onChanged);\n return (\n <div data-account-pages-v2=\"notification-template\" className=\"flex w-full min-w-0 flex-col\">\n <TemplateHeader template={template} draft={draft} />\n {draft.problem ? (\n <Notice tone=\"bad\" role=\"alert\" className=\"mb-4\">\n {draft.problem}\n </Notice>\n ) : null}\n <div className=\"grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)] gap-6 max-lg:grid-cols-1\">\n <TemplateFields\n template={template}\n draft={draft}\n titleRef={titleRef}\n messageRef={messageRef}\n />\n <TemplatePreview\n productName={\n productName || tr('notifications.v3.template.productFallback', 'Your product')\n }\n title={draft.stored.title}\n message={draft.stored.message}\n details={draft.details}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAASA,EAAe,EACtB,aACA,YAIC;CACD,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7BC,IAAQC,GAAU,UACtB,kBAACC,GAAD;EAAY,QAAO;EAAM,UAAAN,EAAG,uBAAuB,IAAI;CAAc,CAAA,IAErE,kBAACM,GAAD;EAAY,QAAO;EAAU,UAAAN,EAAG,wBAAwB,KAAK;CAAc,CAAA;CAE7E,OACE,kBAACO,GAAD;EACE,SAAQ;EACR,OACEF,GAAU,QAAQG,EAAM,KAAK,KAAK,KAAKR,EA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,MAAK;IAAQ,WAAU;IACvC,UAAAb,EAAM;GACD,CAAA,IACN;GACJ,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACc,GAAD;KACY;KACH;KACG;KACE;IACb,CAAA,GACD,kBAACC,GAAD;KACE,aACEC,KAAexB,EAAG,6CAA6C,cAAc;KAE/E,OAAOQ,EAAM,OAAO;KACpB,SAASA,EAAM,OAAO;KACtB,SAASA,EAAM;IAChB,CAAA,CACE;;EACF;;AAET"}
1
+ {"version":3,"file":"TemplateEditor.js","names":["TemplateHeader","tr","useTr","paths","useNotificationPaths","onOff","template","StatusChip","PageHeader","draft","kindWord","channelWord","IconTile","Mail","Button","TemplateEditor","useAppShell","titleRef","useRef","messageRef","useTemplateDraft","onChanged","WorkspacePage","Notice","TemplateFields","TemplatePreview","productName"],"sources":["../../../src/v2/admin/TemplateEditor.tsx"],"sourcesContent":["/**\n * The template editor (BOFF-16785, C2): the header, the form and the live preview. Title and\n * message are edited as people read them (`[First name]`); saving stores today's text\n * (`{{firstName}}`) and the details as today's `variables`.\n */\nimport { useRef } from 'react';\nimport { Mail } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { Button, IconTile, Notice, StatusChip, WorkspacePage } from '@burdenoff/fe-libs/ui';\nimport { useAppShell } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { BackendNotificationTemplate } from '../../hooks/useNotificationTemplates';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { TemplateFields } from './TemplateFields';\nimport { TemplatePreview } from './TemplatePreview';\nimport { useTemplateDraft, type TemplateDraft } from './useTemplateDraft';\nimport { channelWord, kindWord } from './words';\n\nfunction TemplateHeader({\n template,\n draft,\n}: {\n template: BackendNotificationTemplate | null;\n draft: TemplateDraft;\n}) {\n const tr = useTr();\n const paths = useNotificationPaths();\n const onOff = template?.enabled ? (\n <StatusChip status=\"ok\">{tr('notifications.v3.on', 'On')}</StatusChip>\n ) : (\n <StatusChip status=\"paused\">{tr('notifications.v3.off', 'Off')}</StatusChip>\n );\n return (\n <PageHeader\n variant=\"compact\"\n title={\n template?.name || draft.name.trim() || tr('notifications.v3.template.new', 'New template')\n }\n description={\n template\n ? tr('notifications.v3.template.purpose', '{{kind}} · sent by {{channel}}', {\n kind: kindWord(template.type, tr),\n channel: channelWord(template.channel, tr).toLowerCase(),\n })\n : tr(\n 'notifications.v3.template.newPurpose',\n 'Write it once; it’s filled in for each person when it’s sent.'\n )\n }\n icon={\n <IconTile size=\"md\">\n <Mail aria-hidden=\"true\" />\n </IconTile>\n }\n back={{ label: tr('notifications.v3.templates.title', 'Templates'), to: paths.templates }}\n badge={template ? onOff : undefined}\n primary={\n <Button\n busy={draft.saving}\n disabled={!draft.ready}\n onClick={() => void draft.save()}\n data-testid=\"template-save\"\n >\n {template\n ? tr('notifications.v3.template.save', 'Save')\n : tr('notifications.v3.template.create', 'Create template')}\n </Button>\n }\n more={\n template\n ? [\n {\n id: 'toggle',\n label: template.enabled\n ? tr('notifications.v3.templates.turnOff', 'Turn off')\n : tr('notifications.v3.templates.turnOn', 'Turn on'),\n onSelect: () => void draft.toggle(),\n },\n {\n id: 'delete',\n label: tr('notifications.v3.templates.delete', 'Delete'),\n danger: true,\n onSelect: () => void draft.remove(),\n },\n ]\n : undefined\n }\n />\n );\n}\n\nexport function TemplateEditor({\n template,\n onChanged,\n}: {\n template: BackendNotificationTemplate | null;\n /** Read the template again after turning it on or off. */\n onChanged?: () => void;\n}) {\n const tr = useTr();\n const { productName } = useAppShell();\n const titleRef = useRef<HTMLInputElement>(null);\n const messageRef = useRef<HTMLTextAreaElement>(null);\n const draft = useTemplateDraft(template, titleRef, messageRef, onChanged);\n return (\n <WorkspacePage>\n <TemplateHeader template={template} draft={draft} />\n {draft.problem ? (\n <Notice tone=\"bad\" role=\"alert\">\n {draft.problem}\n </Notice>\n ) : null}\n <div className=\"grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)] gap-6 max-lg:grid-cols-1\">\n <TemplateFields\n template={template}\n draft={draft}\n titleRef={titleRef}\n messageRef={messageRef}\n />\n <TemplatePreview\n productName={\n productName || tr('notifications.v3.template.productFallback', 'Your product')\n }\n title={draft.stored.title}\n message={draft.stored.message}\n details={draft.details}\n />\n </div>\n </WorkspacePage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAASA,EAAe,EACtB,aACA,YAIC;CACD,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7BC,IAAQC,GAAU,UACtB,kBAACC,GAAD;EAAY,QAAO;EAAM,UAAAN,EAAG,uBAAuB,IAAI;CAAc,CAAA,IAErE,kBAACM,GAAD;EAAY,QAAO;EAAU,UAAAN,EAAG,wBAAwB,KAAK;CAAc,CAAA;CAE7E,OACE,kBAACO,GAAD;EACE,SAAQ;EACR,OACEF,GAAU,QAAQG,EAAM,KAAK,KAAK,KAAKR,EAAG,iCAAiC,cAAc;EAE3F,aACEK,IACIL,EAAG,qCAAqC,kCAAkC;GACxE,MAAMS,EAASJ,EAAS,MAAML,CAAE;GAChC,SAASU,EAAYL,EAAS,SAASL,CAAE,CAAC,CAAC,YAAY;EACzD,CAAC,IACDA,EACE,wCACA,+DACF;EAEN,MACE,kBAACW,GAAD;GAAU,MAAK;GACb,UAAA,kBAACC,GAAD,EAAM,eAAY,OAAQ,CAAA;EAClB,CAAA;EAEZ,MAAM;GAAE,OAAOZ,EAAG,oCAAoC,WAAW;GAAG,IAAIE,EAAM;EAAU;EACxF,OAAOG,IAAWD,IAAQ,KAAA;EAC1B,SACE,kBAACS,GAAD;GACE,MAAML,EAAM;GACZ,UAAU,CAACA,EAAM;GACjB,eAAe,KAAKA,EAAM,KAAK;GAC/B,eAAY;GAEX,UAAAH,IACGL,EAAG,kCAAkC,MAAM,IAC3CA,EAAG,oCAAoC,iBAAiB;EACtD,CAAA;EAEV,MACEK,IACI,CACE;GACE,IAAI;GACJ,OAAOA,EAAS,UACZL,EAAG,sCAAsC,UAAU,IACnDA,EAAG,qCAAqC,SAAS;GACrD,gBAAgB,KAAKQ,EAAM,OAAO;EACpC,GACA;GACE,IAAI;GACJ,OAAOR,EAAG,qCAAqC,QAAQ;GACvD,QAAQ;GACR,gBAAgB,KAAKQ,EAAM,OAAO;EACpC,CACF,IACA,KAAA;CAEP,CAAA;AAEL;AAEA,SAAgBM,EAAe,EAC7B,aACA,gBAKC;CACD,IAAMd,IAAKC,EAAM,GACX,EAAE,mBAAgBc,EAAY,GAC9BC,IAAWC,EAAyB,IAAI,GACxCC,IAAaD,EAA4B,IAAI,GAC7CT,IAAQW,EAAiBd,GAAUW,GAAUE,GAAYE,CAAS;CACxE,OACE,kBAACC,GAAD,EAAA,UAAA;EACE,kBAACtB,GAAD;GAA0B;GAAiB;EAAQ,CAAA;EAClDS,EAAM,UACL,kBAACc,GAAD;GAAQ,MAAK;GAAM,MAAK;GACrB,UAAAd,EAAM;EACD,CAAA,IACN;EACJ,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACe,GAAD;IACY;IACH;IACG;IACE;GACb,CAAA,GACD,kBAACC,GAAD;IACE,aACEC,KAAezB,EAAG,6CAA6C,cAAc;IAE/E,OAAOQ,EAAM,OAAO;IACpB,SAASA,EAAM,OAAO;IACtB,SAASA,EAAM;GAChB,CAAA,CACE;;CACQ,EAAA,CAAA;AAEnB"}
@@ -7,56 +7,56 @@ import { Mail as a } from "lucide-react";
7
7
  import { useParams as o } from "react-router";
8
8
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
9
  import { PageHeader as l } from "@burdenoff/fe-libs/chrome";
10
- import { EmptyState as u, IconTile as d, LoadError as f, Skeleton as p } from "@burdenoff/fe-libs/ui";
10
+ import { EmptyState as u, IconTile as d, LoadError as f, Skeleton as p, WorkspacePage as m } from "@burdenoff/fe-libs/ui";
11
11
  // src/v2/admin/TemplatePage.tsx
12
- function m() {
12
+ function h() {
13
13
  return /* @__PURE__ */ s(r, {
14
14
  tool: "templates",
15
15
  back: !1,
16
- children: /* @__PURE__ */ s(h, {})
16
+ children: /* @__PURE__ */ s(g, {})
17
17
  });
18
18
  }
19
- function h() {
20
- let r = t(), m = n(), { templateId: h } = o(), g = e(h), _ = {
19
+ function g() {
20
+ let r = t(), h = n(), { templateId: g } = o(), _ = e(g), v = {
21
21
  label: r("notifications.v3.templates.title", "Templates"),
22
- to: m.templates
22
+ to: h.templates
23
23
  };
24
- return h ? g.isLoading && !g.template ? /* @__PURE__ */ c("div", {
24
+ return g ? _.isLoading && !_.template ? /* @__PURE__ */ s(m, { children: /* @__PURE__ */ c("div", {
25
25
  className: "flex flex-col gap-4",
26
26
  "aria-busy": "true",
27
27
  children: [/* @__PURE__ */ s(l, {
28
28
  variant: "compact",
29
29
  title: r("notifications.v3.template.loading", "Template"),
30
- back: _
30
+ back: v
31
31
  }), /* @__PURE__ */ s(p, { className: "h-64 w-full rounded-lg" })]
32
- }) : g.error && !g.template ? /* @__PURE__ */ c("div", {
32
+ }) }) : _.error && !_.template ? /* @__PURE__ */ s(m, { children: /* @__PURE__ */ c("div", {
33
33
  className: "flex flex-col gap-4",
34
34
  children: [/* @__PURE__ */ s(l, {
35
35
  variant: "compact",
36
36
  title: r("notifications.v3.template.loading", "Template"),
37
- back: _
37
+ back: v
38
38
  }), /* @__PURE__ */ s(f, {
39
39
  what: r("notifications.v3.template.what", "This template"),
40
- error: g.error,
41
- onRetry: () => void g.refetch()
40
+ error: _.error,
41
+ onRetry: () => void _.refetch()
42
42
  })]
43
- }) : g.template ? /* @__PURE__ */ s(i, {
44
- template: g.template,
45
- onChanged: () => void g.refetch()
46
- }, g.template.id) : /* @__PURE__ */ c("div", {
43
+ }) }) : _.template ? /* @__PURE__ */ s(i, {
44
+ template: _.template,
45
+ onChanged: () => void _.refetch()
46
+ }, _.template.id) : /* @__PURE__ */ s(m, { children: /* @__PURE__ */ c("div", {
47
47
  className: "flex flex-col gap-4",
48
48
  children: [/* @__PURE__ */ s(l, {
49
49
  variant: "compact",
50
50
  title: r("notifications.v3.template.loading", "Template"),
51
- back: _
51
+ back: v
52
52
  }), /* @__PURE__ */ s(u, {
53
53
  kind: "not-found",
54
54
  icon: /* @__PURE__ */ s(d, { children: /* @__PURE__ */ s(a, { "aria-hidden": "true" }) }),
55
55
  title: r("notifications.v3.template.missingTitle", "This template isn’t here"),
56
56
  description: r("notifications.v3.template.missingBody", "It may have been deleted.")
57
57
  })]
58
- }) : /* @__PURE__ */ s(i, { template: null });
58
+ }) }) : /* @__PURE__ */ s(i, { template: null });
59
59
  }
60
- export { m as TemplatePage };
60
+ export { h as TemplatePage };
61
61
 
62
62
  //# sourceMappingURL=TemplatePage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TemplatePage.js","names":["TemplatePage","AdminPageV2","TemplateLoader","tr","useTr","paths","useNotificationPaths","useParams","existing","useNotificationTemplate","templateId","back","PageHeader","Skeleton","LoadError","TemplateEditor","EmptyState","IconTile","Mail"],"sources":["../../../src/v2/admin/TemplatePage.tsx"],"sourcesContent":["/**\n * A template (BOFF-16785, C2; the mockup's `ntemplate`), under fe-libs' `accountPagesV2`: what it's\n * about, how it's sent, its title and message on the left, a live preview with sample details on the\n * right (In app · Email · Push). Insert adds a detail (a name, the workflow, a link), shown as\n * `[First name]` and saved as today's `{{firstName}}`. Admins only (`AdminPageV2`). Today's hooks\n * and storage: a template's channel is set once, when it's made.\n */\nimport { useParams } from 'react-router';\nimport { Mail } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { EmptyState, IconTile, LoadError, Skeleton } from '@burdenoff/fe-libs/ui';\nimport { useNotificationTemplate } from '../../hooks/useNotificationTemplates';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { AdminPageV2 } from '../../navigation-v2/AdminPageV2';\nimport { TemplateEditor } from './TemplateEditor';\n\nexport function TemplatePage() {\n return (\n <AdminPageV2 tool=\"templates\" back={false}>\n <TemplateLoader />\n </AdminPageV2>\n );\n}\n\nfunction TemplateLoader() {\n const tr = useTr();\n const paths = useNotificationPaths();\n const { templateId } = useParams<{ templateId?: string }>();\n const existing = useNotificationTemplate(templateId);\n const back = { label: tr('notifications.v3.templates.title', 'Templates'), to: paths.templates };\n\n if (!templateId) return <TemplateEditor template={null} />;\n if (existing.isLoading && !existing.template) {\n return (\n <div className=\"flex flex-col gap-4\" aria-busy=\"true\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.template.loading', 'Template')}\n back={back}\n />\n <Skeleton className=\"h-64 w-full rounded-lg\" />\n </div>\n );\n }\n if (existing.error && !existing.template) {\n return (\n <div className=\"flex flex-col gap-4\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.template.loading', 'Template')}\n back={back}\n />\n <LoadError\n what={tr('notifications.v3.template.what', 'This template')}\n error={existing.error}\n onRetry={() => void existing.refetch()}\n />\n </div>\n );\n }\n if (!existing.template) {\n return (\n <div className=\"flex flex-col gap-4\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.template.loading', 'Template')}\n back={back}\n />\n <EmptyState\n kind=\"not-found\"\n icon={\n <IconTile>\n <Mail aria-hidden=\"true\" />\n </IconTile>\n }\n title={tr('notifications.v3.template.missingTitle', 'This template isn’t here')}\n description={tr('notifications.v3.template.missingBody', 'It may have been deleted.')}\n />\n </div>\n );\n }\n return (\n <TemplateEditor\n key={existing.template.id}\n template={existing.template}\n onChanged={() => void existing.refetch()}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;AAiBA,SAAgBA,IAAe;CAC7B,OACE,kBAACC,GAAD;EAAa,MAAK;EAAY,MAAM;EAClC,UAAA,kBAACC,GAAD,CAAiB,CAAA;CACN,CAAA;AAEjB;AAEA,SAASA,IAAiB;CACxB,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7B,EAAE,kBAAeC,EAAmC,GACpDC,IAAWC,EAAwBC,CAAU,GAC7CC,IAAO;EAAE,OAAOR,EAAG,oCAAoC,WAAW;EAAG,IAAIE,EAAM;CAAU;CAoD/F,OAlDKK,IACDF,EAAS,aAAa,CAACA,EAAS,WAEhC,kBAAC,OAAD;EAAK,WAAU;EAAsB,aAAU;EAA/C,UAAA,CACE,kBAACI,GAAD;GACE,SAAQ;GACR,OAAOT,EAAG,qCAAqC,UAAU;GACnD;EACP,CAAA,GACD,kBAACU,GAAD,EAAU,WAAU,yBAA0B,CAAA,CAC3C;C,KAGLL,EAAS,SAAS,CAACA,EAAS,WAE5B,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACI,GAAD;GACE,SAAQ;GACR,OAAOT,EAAG,qCAAqC,UAAU;GACnD;EACP,CAAA,GACD,kBAACW,GAAD;GACE,MAAMX,EAAG,kCAAkC,eAAe;GAC1D,OAAOK,EAAS;GAChB,eAAe,KAAKA,EAAS,QAAQ;EACtC,CAAA,CACE;C,KAGJA,EAAS,WAsBZ,kBAACO,GAAD;EAEE,UAAUP,EAAS;EACnB,iBAAiB,KAAKA,EAAS,QAAQ;CACxC,GAHMA,EAAS,SAAS,EAGxB,IAxBC,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACI,GAAD;GACE,SAAQ;GACR,OAAOT,EAAG,qCAAqC,UAAU;GACnD;EACP,CAAA,GACD,kBAACa,GAAD;GACE,MAAK;GACL,MACE,kBAACC,GAAD,EAAA,UACE,kBAACC,GAAD,EAAM,eAAY,OAAQ,CAAA,EAClB,CAAA;GAEZ,OAAOf,EAAG,0CAA0C,0BAA0B;GAC9E,aAAaA,EAAG,yCAAyC,2BAA2B;EACrF,CAAA,CACE;C,KA/Ce,kBAACY,GAAD,EAAgB,UAAU,KAAO,CAAA;AAyD3D"}
1
+ {"version":3,"file":"TemplatePage.js","names":["TemplatePage","AdminPageV2","TemplateLoader","tr","useTr","paths","useNotificationPaths","useParams","existing","useNotificationTemplate","templateId","back","WorkspacePage","PageHeader","Skeleton","LoadError","TemplateEditor","EmptyState","IconTile","Mail"],"sources":["../../../src/v2/admin/TemplatePage.tsx"],"sourcesContent":["/**\n * A template (BOFF-16785, C2; the mockup's `ntemplate`), under fe-libs' `accountPagesV2`: what it's\n * about, how it's sent, its title and message on the left, a live preview with sample details on the\n * right (In app · Email · Push). Insert adds a detail (a name, the workflow, a link), shown as\n * `[First name]` and saved as today's `{{firstName}}`. Admins only (`AdminPageV2`). Today's hooks\n * and storage: a template's channel is set once, when it's made.\n */\nimport { useParams } from 'react-router';\nimport { Mail } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { EmptyState, IconTile, LoadError, Skeleton, WorkspacePage } from '@burdenoff/fe-libs/ui';\nimport { useNotificationTemplate } from '../../hooks/useNotificationTemplates';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { AdminPageV2 } from '../../navigation-v2/AdminPageV2';\nimport { TemplateEditor } from './TemplateEditor';\n\nexport function TemplatePage() {\n return (\n <AdminPageV2 tool=\"templates\" back={false}>\n <TemplateLoader />\n </AdminPageV2>\n );\n}\n\nfunction TemplateLoader() {\n const tr = useTr();\n const paths = useNotificationPaths();\n const { templateId } = useParams<{ templateId?: string }>();\n const existing = useNotificationTemplate(templateId);\n const back = { label: tr('notifications.v3.templates.title', 'Templates'), to: paths.templates };\n\n if (!templateId) return <TemplateEditor template={null} />;\n if (existing.isLoading && !existing.template) {\n return (\n <WorkspacePage>\n <div className=\"flex flex-col gap-4\" aria-busy=\"true\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.template.loading', 'Template')}\n back={back}\n />\n <Skeleton className=\"h-64 w-full rounded-lg\" />\n </div>\n </WorkspacePage>\n );\n }\n if (existing.error && !existing.template) {\n return (\n <WorkspacePage>\n <div className=\"flex flex-col gap-4\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.template.loading', 'Template')}\n back={back}\n />\n <LoadError\n what={tr('notifications.v3.template.what', 'This template')}\n error={existing.error}\n onRetry={() => void existing.refetch()}\n />\n </div>\n </WorkspacePage>\n );\n }\n if (!existing.template) {\n return (\n <WorkspacePage>\n <div className=\"flex flex-col gap-4\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.template.loading', 'Template')}\n back={back}\n />\n <EmptyState\n kind=\"not-found\"\n icon={\n <IconTile>\n <Mail aria-hidden=\"true\" />\n </IconTile>\n }\n title={tr('notifications.v3.template.missingTitle', 'This template isn’t here')}\n description={tr('notifications.v3.template.missingBody', 'It may have been deleted.')}\n />\n </div>\n </WorkspacePage>\n );\n }\n return (\n <TemplateEditor\n key={existing.template.id}\n template={existing.template}\n onChanged={() => void existing.refetch()}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;AAiBA,SAAgBA,IAAe;CAC7B,OACE,kBAACC,GAAD;EAAa,MAAK;EAAY,MAAM;EAClC,UAAA,kBAACC,GAAD,CAAiB,CAAA;CACN,CAAA;AAEjB;AAEA,SAASA,IAAiB;CACxB,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7B,EAAE,kBAAeC,EAAmC,GACpDC,IAAWC,EAAwBC,CAAU,GAC7CC,IAAO;EAAE,OAAOR,EAAG,oCAAoC,WAAW;EAAG,IAAIE,EAAM;CAAU;CA0D/F,OAxDKK,IACDF,EAAS,aAAa,CAACA,EAAS,WAEhC,kBAACI,GAAD,EAAA,UACE,kBAAC,OAAD;EAAK,WAAU;EAAsB,aAAU;EAA/C,UAAA,CACE,kBAACC,GAAD;GACE,SAAQ;GACR,OAAOV,EAAG,qCAAqC,UAAU;GACnD;EACP,CAAA,GACD,kBAACW,GAAD,EAAU,WAAU,yBAA0B,CAAA,CAC3C;CACQ,CAAA,EAAA,CAAA,IAGfN,EAAS,SAAS,CAACA,EAAS,WAE5B,kBAACI,GAAD,EAAA,UACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACC,GAAD;GACE,SAAQ;GACR,OAAOV,EAAG,qCAAqC,UAAU;GACnD;EACP,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