@burdenoff/microfe-notification 2026.1129.2 → 2026.1130.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NotificationRoutes.js +73 -72
- package/dist/NotificationRoutes.js.map +1 -1
- package/dist/hooks/useSendNotification.d.ts +1 -1
- package/dist/hooks/useSendNotification.js.map +1 -1
- package/dist/translations/en.d.ts +55 -0
- package/dist/v2/InboxPage.js +150 -138
- package/dist/v2/InboxPage.js.map +1 -1
- package/dist/v2/NotificationDetailPanel.d.ts +9 -5
- package/dist/v2/NotificationDetailPanel.js +66 -51
- package/dist/v2/NotificationDetailPanel.js.map +1 -1
- package/dist/v2/PreferencesPage.js +80 -84
- package/dist/v2/PreferencesPage.js.map +1 -1
- package/dist/v2/admin/DeliveryLogPage.js +44 -48
- package/dist/v2/admin/DeliveryLogPage.js.map +1 -1
- package/dist/v2/admin/TemplateEditor.js +28 -33
- package/dist/v2/admin/TemplateEditor.js.map +1 -1
- package/dist/v2/admin/TemplateFields.js +1 -1
- package/dist/v2/admin/TemplateFields.js.map +1 -1
- package/dist/v2/admin/TemplatePage.js +19 -19
- package/dist/v2/admin/TemplatePage.js.map +1 -1
- package/dist/v2/admin/TemplatesPage.js +123 -127
- package/dist/v2/admin/TemplatesPage.js.map +1 -1
- package/dist/v2/admin/TopicsPage.js +101 -105
- package/dist/v2/admin/TopicsPage.js.map +1 -1
- package/dist/v2/admin/templateText.js +22 -17
- package/dist/v2/admin/templateText.js.map +1 -1
- package/dist/v2/send/MessageTab.d.ts +4 -0
- package/dist/v2/send/MessageTab.js +152 -0
- package/dist/v2/send/MessageTab.js.map +1 -0
- package/dist/v2/send/PeopleTab.d.ts +4 -0
- package/dist/v2/send/PeopleTab.js +156 -0
- package/dist/v2/send/PeopleTab.js.map +1 -0
- package/dist/v2/send/SendNotificationDialog.d.ts +4 -0
- package/dist/v2/send/SendNotificationDialog.js +98 -0
- package/dist/v2/send/SendNotificationDialog.js.map +1 -0
- package/dist/v2/send/SendRedirect.d.ts +1 -0
- package/dist/v2/send/SendRedirect.js +20 -0
- package/dist/v2/send/SendRedirect.js.map +1 -0
- package/dist/v2/send/WhenTab.d.ts +4 -0
- package/dist/v2/send/WhenTab.js +64 -0
- package/dist/v2/send/WhenTab.js.map +1 -0
- package/dist/v2/send/sendModel.d.ts +47 -0
- package/dist/v2/send/sendModel.js +90 -0
- package/dist/v2/send/sendModel.js.map +1 -0
- package/dist/v2/send/useSendDraft.d.ts +24 -0
- package/dist/v2/send/useSendDraft.js +120 -0
- package/dist/v2/send/useSendDraft.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationDetailPanel.js","names":["follow","navigateInApp","url","NotificationDetailPanel","tr","useTr","useNotificationDetail","id","ready","state","notification","mapBackendToMfeNotification","DetailPanel","next","onClose","PanelSub","IconTile","KindIcon","onMarkUnread","onArchive","onRestore","Button","Skeleton","LoadError","retry","PanelBody","when","useWhenLabels","needsAction","StatusChip","thing","notificationThing","data","actions","ThingBlock","index","action","ArrowUpRight","Timeline","facts","thingFacts","Workflow","fact","actionUrl","EVENT_ICON","CheckCircle2","XCircle","Clock","EVENT_TEXT","items","timeline","events","Icon","event"],"sources":["../../src/v2/NotificationDetailPanel.tsx"],"sourcesContent":["/**\n * A notification's panel (BOFF-16785, C1; decision 10, BE3): the message, \"the thing\" it is about\n * when the sender said (a workflow, its step, the attempt, how many runs it touched, since when),\n * its actions, and its timeline from the delivery events. Mark as unread and Archive at the foot.\n */\nimport { ArrowUpRight, CheckCircle2, Clock, Workflow, XCircle } from 'lucide-react';\nimport {\n Button,\n DetailPanel,\n IconTile,\n LoadError,\n Skeleton,\n StatusChip,\n useWhenLabels,\n} from '@burdenoff/fe-libs/ui';\nimport type { Notification } from '../types';\nimport { useTr } from '../shared/hooks/useTr';\nimport { navigateInApp } from '../utils/inAppNavigation';\nimport { mapBackendToMfeNotification } from '../hooks/useNotifications';\nimport { needsAction } from './model/inbox';\nimport { KindIcon } from './KindIcon';\nimport { notificationThing, thingFacts } from './model/thing';\nimport { timeline, type EventTone } from './model/events';\nimport { useNotificationDetail, type NotificationDetailData } from './useNotificationDetail';\n\n/** Open an action's address: inside the app when it is one of ours, else in a new tab. */\nfunction follow(url: string) {\n if (!navigateInApp(url)) window.open(url, '_blank', 'noopener,noreferrer');\n}\n\nexport function NotificationDetailPanel({\n id,\n onClose,\n onMarkUnread,\n onArchive,\n onRestore,\n}: {\n id: string | null;\n onClose: () => void;\n /** The person's own inbox: absent in the admins' delivery log, which only reads. */\n onMarkUnread?: (id: string) => void;\n onArchive?: (id: string) => void;\n onRestore?: (id: string) => void;\n}) {\n const tr = useTr();\n const { state, retry } = useNotificationDetail(id);\n const ready = state.status === 'ready' ? state.notification : null;\n const notification = ready ? mapBackendToMfeNotification(ready) : null;\n\n return (\n <DetailPanel\n open={Boolean(id)}\n onOpenChange={(next) => (next ? undefined : onClose())}\n title={notification?.title ?? tr('notifications.v3.panel.loading', 'Notification')}\n sub={notification ? <PanelSub notification={notification} /> : undefined}\n tile={\n notification ? (\n <IconTile size=\"md\">\n <KindIcon notification={notification} />\n </IconTile>\n ) : undefined\n }\n closeLabel={tr('notifications.v3.panel.close', 'Close')}\n data-testid=\"notification-panel\"\n footer={\n notification && onMarkUnread && onArchive && onRestore ? (\n <div className=\"flex w-full flex-wrap gap-2\">\n <Button variant=\"outline\" onClick={() => onMarkUnread(notification.id)}>\n {tr('notifications.v3.markUnread', 'Mark as unread')}\n </Button>\n {notification.archivedAt ? (\n <Button variant=\"ghost\" onClick={() => onRestore(notification.id)}>\n {tr('notifications.v3.restore', 'Move back to the inbox')}\n </Button>\n ) : (\n <Button variant=\"ghost\" onClick={() => onArchive(notification.id)}>\n {tr('notifications.v3.archive', 'Archive')}\n </Button>\n )}\n </div>\n ) : undefined\n }\n >\n {state.status === 'loading' ? (\n <div className=\"flex flex-col gap-3\" aria-busy=\"true\">\n <Skeleton className=\"h-4 w-3/4\" />\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-24 w-full\" />\n </div>\n ) : state.status === 'failed' ? (\n <LoadError\n what={tr('notifications.v3.panel.what', 'This notification')}\n error={state.error}\n onRetry={retry}\n />\n ) : state.status === 'missing' || !ready || !notification ? (\n <p className=\"m-0 text-sm text-text-secondary\">\n {tr(\n 'notifications.v3.panel.missing',\n 'This notification isn’t available any more. It may have been deleted.'\n )}\n </p>\n ) : (\n <PanelBody notification={notification} data={ready} />\n )}\n </DetailPanel>\n );\n}\n\nfunction PanelSub({ notification }: { notification: Notification }) {\n const tr = useTr();\n const when = useWhenLabels();\n return (\n <span className=\"flex flex-wrap items-center gap-2\">\n <time dateTime={notification.createdAt}>{when.moment(notification.createdAt)}</time>\n {needsAction(notification) ? (\n <StatusChip status=\"warn\">{tr('notifications.v3.needsYou', 'Needs you')}</StatusChip>\n ) : null}\n </span>\n );\n}\n\nfunction PanelBody({\n notification,\n data,\n}: {\n notification: Notification;\n data: NotificationDetailData;\n}) {\n const tr = useTr();\n const thing = notificationThing(data.metadata);\n const actions = notification.actions;\n return (\n <div className=\"flex flex-col gap-5\">\n <p className=\"m-0 text-sm whitespace-pre-wrap text-text-primary\" data-testid=\"panel-message\">\n {notification.body}\n </p>\n {thing ? <ThingBlock thing={thing} actionUrl={notification.actionUrl} /> : null}\n {actions.length > 0 || (notification.actionUrl && !thing) ? (\n <div className=\"flex flex-wrap gap-2\" data-testid=\"panel-actions\">\n {actions.map((action, index) => (\n <Button\n key={action.id}\n variant={index === 0 ? 'default' : 'outline'}\n onClick={() => follow(action.url)}\n >\n {action.label}\n </Button>\n ))}\n {/* \"Open the run\" in the thing's block already goes there. */}\n {actions.length === 0 && notification.actionUrl && !thing ? (\n <Button onClick={() => follow(notification.actionUrl ?? '')}>\n <ArrowUpRight aria-hidden=\"true\" />\n {tr('notifications.v3.panel.open', 'Open where it happened')}\n </Button>\n ) : null}\n </div>\n ) : null}\n <Timeline events={data.events} />\n </div>\n );\n}\n\nfunction ThingBlock({\n thing,\n actionUrl,\n}: {\n thing: NonNullable<ReturnType<typeof notificationThing>>;\n actionUrl?: string;\n}) {\n const tr = useTr();\n const when = useWhenLabels();\n const facts = thingFacts(thing, tr);\n return (\n <section\n className=\"flex flex-col gap-2 rounded-lg border border-border-subtle bg-bg-sunken p-3\"\n aria-label={tr('notifications.v3.thing.label', 'What it’s about')}\n data-testid=\"panel-thing\"\n >\n <div className=\"flex items-center gap-2\">\n <Workflow className=\"size-4 text-text-secondary\" aria-hidden=\"true\" />\n <span className=\"text-sm font-semibold text-text-primary\">{thing.workflowName}</span>\n </div>\n {facts.length > 0 ? (\n <dl className=\"m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm\">\n {facts.map((fact) => (\n <div key={fact.id} className=\"contents\">\n <dt className=\"text-text-secondary\">{fact.label}</dt>\n <dd className=\"m-0 text-text-primary\">{fact.value}</dd>\n </div>\n ))}\n </dl>\n ) : null}\n {thing.firstSeenAt ? (\n <p className=\"m-0 text-xs text-text-muted\">\n {tr('notifications.v3.thing.firstSeen', 'First seen {{when}}', {\n when: when.moment(thing.firstSeenAt),\n })}\n </p>\n ) : null}\n {actionUrl ? (\n <div>\n <Button size=\"sm\" variant=\"outline\" onClick={() => follow(actionUrl)}>\n {tr('notifications.v3.thing.openRun', 'Open the run')}\n </Button>\n </div>\n ) : null}\n </section>\n );\n}\n\nconst EVENT_ICON: Record<EventTone, typeof Clock> = {\n ok: CheckCircle2,\n bad: XCircle,\n waiting: Clock,\n neutral: Clock,\n};\nconst EVENT_TEXT: Record<EventTone, string> = {\n ok: 'text-status-success-text',\n bad: 'text-status-error-text',\n waiting: 'text-status-warning-text',\n neutral: 'text-text-muted',\n};\n\nfunction Timeline({ events }: { events: NotificationDetailData['events'] }) {\n const tr = useTr();\n const when = useWhenLabels();\n const items = timeline(events, tr);\n if (items.length === 0) return null;\n return (\n <section\n className=\"flex flex-col gap-2\"\n aria-label={tr('notifications.v3.timeline', 'What happened')}\n >\n <h3 className=\"m-0 text-xs font-medium text-text-muted\">\n {tr('notifications.v3.timeline', 'What happened')}\n </h3>\n <ol className=\"m-0 flex list-none flex-col gap-2 p-0\" data-testid=\"panel-timeline\">\n {items.map((event) => {\n const Icon = EVENT_ICON[event.tone];\n return (\n <li key={event.id} className=\"flex items-center gap-2 text-sm\">\n <Icon className={`size-4 ${EVENT_TEXT[event.tone]}`} aria-hidden=\"true\" />\n <span className=\"flex-1 text-text-primary\">{event.words}</span>\n <time className=\"text-xs text-text-muted\" dateTime={event.at}>\n {when.moment(event.at)}\n </time>\n </li>\n );\n })}\n </ol>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,SAASA,EAAO,GAAa;CAC3B,AAAKC,EAAcC,CAAG,KAAG,OAAO,KAAKA,GAAK,UAAU,qBAAqB;AAC3E;AAEA,SAAgBC,EAAwB,EACtC,OACA,YACA,iBACA,cACA,gBAQC;CACD,IAAMC,IAAKC,EAAM,GACX,EAAE,UAAO,aAAUC,EAAsBC,CAAE,GAC3CC,IAAQC,EAAM,WAAW,UAAUA,EAAM,eAAe,MACxDC,IAAeF,IAAQG,EAA4BH,CAAK,IAAI;CAElE,OACE,kBAACI,GAAD;EACE,MAAM,EAAQL;EACd,eAAe,MAAUM,IAAO,KAAA,IAAYC,EAAQ;EACpD,OAAOJ,GAAc,SAASN,EAAG,kCAAkC,cAAc;EACjF,KAAKM,IAAe,kBAACK,GAAD,EAAwB,gBAAe,CAAA,IAAI,KAAA;EAC/D,MACEL,IACE,kBAACM,GAAD;GAAU,MAAK;GACb,UAAA,kBAACC,GAAD,EAAwB,gBAAe,CAAA;EAC/B,CAAA,IACR,KAAA;EAEN,YAAYb,EAAG,gCAAgC,OAAO;EACtD,eAAY;EACZ,QACEM,KAAgBQ,KAAgBC,KAAaC,IAC3C,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACC,GAAD;IAAQ,SAAQ;IAAU,eAAeH,EAAaR,E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AAmB,WAAU;KAA7B,UAAA;MACE,kBAACD,GAAD;OAAM,WAAW,UAAUJ,EAAWK,EAAM;OAAS,eAAY;MAAQ,CAAA;MACzE,kBAAC,QAAD;OAAM,WAAU;OAA4B,UAAAA,EAAM;MAAY,CAAA;MAC9D,kBAAC,QAAD;OAAM,WAAU;OAA0B,UAAUA,EAAM;OACvD,UAAA3B,EAAK,OAAO2B,EAAM,EAAE;MACjB,CAAA;KACJ;IANK,GAAAA,EAAM,EAMX;GAER,CAAC;EACC,CAAA,CACG;;AAEb"}
|
|
1
|
+
{"version":3,"file":"NotificationDetailPanel.js","names":["follow","navigateInApp","url","NotificationDetailPanel","tr","useTr","useNotificationDetail","id","ready","state","notification","mapBackendToMfeNotification","footer","inboxActions","PanelFooter","DetailPanel","next","onClose","PanelSub","IconTile","KindIcon","PanelContent","Button","actions","Skeleton","LoadError","retry","PanelBody","when","useWhenLabels","needsAction","StatusChip","thing","notificationThing","data","ThingBlock","index","action","ArrowUpRight","Timeline","facts","thingFacts","Workflow","fact","actionUrl","EVENT_ICON","CheckCircle2","XCircle","Clock","EVENT_TEXT","items","timeline","events","Icon","event"],"sources":["../../src/v2/NotificationDetailPanel.tsx"],"sourcesContent":["/**\n * A notification's panel (BOFF-16785, C1; decision 10, BE3): the message, \"the thing\" it is about\n * when the sender said (a workflow, its step, the attempt, how many runs it touched, since when),\n * its actions, and its timeline from the delivery events. Mark as unread and Archive at the foot, in\n * the person's own inbox only.\n */\nimport { ArrowUpRight, CheckCircle2, Clock, Workflow, XCircle } from 'lucide-react';\nimport {\n Button,\n DetailPanel,\n IconTile,\n LoadError,\n Skeleton,\n StatusChip,\n useWhenLabels,\n} from '@burdenoff/fe-libs/ui';\nimport type { Notification } from '../types';\nimport { useTr } from '../shared/hooks/useTr';\nimport { navigateInApp } from '../utils/inAppNavigation';\nimport { mapBackendToMfeNotification } from '../hooks/useNotifications';\nimport { needsAction } from './model/inbox';\nimport { KindIcon } from './KindIcon';\nimport { notificationThing, thingFacts } from './model/thing';\nimport { timeline, type EventTone } from './model/events';\nimport {\n useNotificationDetail,\n type DetailState,\n type NotificationDetailData,\n} from './useNotificationDetail';\n\n/** Open an action's address: inside the app when it is one of ours, else in a new tab. */\nfunction follow(url: string) {\n if (!navigateInApp(url)) window.open(url, '_blank', 'noopener,noreferrer');\n}\n\n/** What the person can do with their own notification: absent in the admins' delivery log. */\nexport interface InboxActions {\n markUnread: (id: string) => void;\n archive: (id: string) => void;\n restore: (id: string) => void;\n}\n\nexport function NotificationDetailPanel({\n id,\n onClose,\n inboxActions,\n}: {\n id: string | null;\n onClose: () => void;\n /** The person's own inbox; the delivery log only reads, so it leaves these out. */\n inboxActions?: InboxActions;\n}) {\n const tr = useTr();\n const { state, retry } = useNotificationDetail(id);\n const ready = state.status === 'ready' ? state.notification : null;\n const notification = ready ? mapBackendToMfeNotification(ready) : null;\n const footer =\n notification && inboxActions ? (\n <PanelFooter notification={notification} actions={inboxActions} />\n ) : undefined;\n\n return (\n <DetailPanel\n open={Boolean(id)}\n onOpenChange={(next) => (next ? undefined : onClose())}\n title={notification?.title ?? tr('notifications.v3.panel.loading', 'Notification')}\n sub={notification ? <PanelSub notification={notification} /> : undefined}\n tile={\n notification ? (\n <IconTile size=\"md\">\n <KindIcon notification={notification} />\n </IconTile>\n ) : undefined\n }\n closeLabel={tr('notifications.v3.panel.close', 'Close')}\n data-testid=\"notification-panel\"\n footer={footer}\n >\n <PanelContent state={state} retry={retry} notification={notification} />\n </DetailPanel>\n );\n}\n\n/** Mark as unread, and Archive or Move back to the inbox. */\nfunction PanelFooter({\n notification,\n actions,\n}: {\n notification: Notification;\n actions: InboxActions;\n}) {\n const tr = useTr();\n return (\n <div className=\"flex w-full flex-wrap gap-2\">\n <Button variant=\"outline\" onClick={() => actions.markUnread(notification.id)}>\n {tr('notifications.v3.markUnread', 'Mark as unread')}\n </Button>\n {notification.archivedAt ? (\n <Button variant=\"ghost\" onClick={() => actions.restore(notification.id)}>\n {tr('notifications.v3.restore', 'Move back to the inbox')}\n </Button>\n ) : (\n <Button variant=\"ghost\" onClick={() => actions.archive(notification.id)}>\n {tr('notifications.v3.archive', 'Archive')}\n </Button>\n )}\n </div>\n );\n}\n\n/** Loading, couldn't load, gone, or the notification itself. */\nfunction PanelContent({\n state,\n retry,\n notification,\n}: {\n state: DetailState;\n retry: () => void;\n notification: Notification | null;\n}) {\n const tr = useTr();\n if (state.status === 'loading') {\n return (\n <div className=\"flex flex-col gap-3\" aria-busy=\"true\">\n <Skeleton className=\"h-4 w-3/4\" />\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-24 w-full\" />\n </div>\n );\n }\n if (state.status === 'failed') {\n return (\n <LoadError\n what={tr('notifications.v3.panel.what', 'This notification')}\n error={state.error}\n onRetry={retry}\n />\n );\n }\n if (state.status !== 'ready' || !notification) {\n return (\n <p className=\"m-0 text-sm text-text-secondary\">\n {tr(\n 'notifications.v3.panel.missing',\n 'This notification isn’t available any more. It may have been deleted.'\n )}\n </p>\n );\n }\n return <PanelBody notification={notification} data={state.notification} />;\n}\n\nfunction PanelSub({ notification }: { notification: Notification }) {\n const tr = useTr();\n const when = useWhenLabels();\n return (\n <span className=\"flex flex-wrap items-center gap-2\">\n <time dateTime={notification.createdAt}>{when.moment(notification.createdAt)}</time>\n {needsAction(notification) ? (\n <StatusChip status=\"warn\">{tr('notifications.v3.needsYou', 'Needs you')}</StatusChip>\n ) : null}\n </span>\n );\n}\n\nfunction PanelBody({\n notification,\n data,\n}: {\n notification: Notification;\n data: NotificationDetailData;\n}) {\n const tr = useTr();\n const thing = notificationThing(data.metadata);\n const actions = notification.actions;\n return (\n <div className=\"flex flex-col gap-5\">\n <p className=\"m-0 text-sm whitespace-pre-wrap text-text-primary\" data-testid=\"panel-message\">\n {notification.body}\n </p>\n {thing ? <ThingBlock thing={thing} actionUrl={notification.actionUrl} /> : null}\n {actions.length > 0 || (notification.actionUrl && !thing) ? (\n <div className=\"flex flex-wrap gap-2\" data-testid=\"panel-actions\">\n {actions.map((action, index) => (\n <Button\n key={action.id}\n variant={index === 0 ? 'default' : 'outline'}\n onClick={() => follow(action.url)}\n >\n {action.label}\n </Button>\n ))}\n {/* \"Open the run\" in the thing's block already goes there. */}\n {actions.length === 0 && notification.actionUrl && !thing ? (\n <Button onClick={() => follow(notification.actionUrl ?? '')}>\n <ArrowUpRight aria-hidden=\"true\" />\n {tr('notifications.v3.panel.open', 'Open where it happened')}\n </Button>\n ) : null}\n </div>\n ) : null}\n <Timeline events={data.events} />\n </div>\n );\n}\n\nfunction ThingBlock({\n thing,\n actionUrl,\n}: {\n thing: NonNullable<ReturnType<typeof notificationThing>>;\n actionUrl?: string;\n}) {\n const tr = useTr();\n const when = useWhenLabels();\n const facts = thingFacts(thing, tr);\n return (\n <section\n className=\"flex flex-col gap-2 rounded-lg border border-border-subtle bg-bg-sunken p-3\"\n aria-label={tr('notifications.v3.thing.label', 'What it’s about')}\n data-testid=\"panel-thing\"\n >\n <div className=\"flex items-center gap-2\">\n <Workflow className=\"size-4 text-text-secondary\" aria-hidden=\"true\" />\n <span className=\"text-sm font-semibold text-text-primary\">{thing.workflowName}</span>\n </div>\n {facts.length > 0 ? (\n <dl className=\"m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm\">\n {facts.map((fact) => (\n <div key={fact.id} className=\"contents\">\n <dt className=\"text-text-secondary\">{fact.label}</dt>\n <dd className=\"m-0 text-text-primary\">{fact.value}</dd>\n </div>\n ))}\n </dl>\n ) : null}\n {thing.firstSeenAt ? (\n <p className=\"m-0 text-xs text-text-muted\">\n {tr('notifications.v3.thing.firstSeen', 'First seen {{when}}', {\n when: when.moment(thing.firstSeenAt),\n })}\n </p>\n ) : null}\n {actionUrl ? (\n <div>\n <Button size=\"sm\" variant=\"outline\" onClick={() => follow(actionUrl)}>\n {tr('notifications.v3.thing.openRun', 'Open the run')}\n </Button>\n </div>\n ) : null}\n </section>\n );\n}\n\nconst EVENT_ICON: Record<EventTone, typeof Clock> = {\n ok: CheckCircle2,\n bad: XCircle,\n waiting: Clock,\n neutral: Clock,\n};\nconst EVENT_TEXT: Record<EventTone, string> = {\n ok: 'text-status-success-text',\n bad: 'text-status-error-text',\n waiting: 'text-status-warning-text',\n neutral: 'text-text-muted',\n};\n\nfunction Timeline({ events }: { events: NotificationDetailData['events'] }) {\n const tr = useTr();\n const when = useWhenLabels();\n const items = timeline(events, tr);\n if (items.length === 0) return null;\n return (\n <section\n className=\"flex flex-col gap-2\"\n aria-label={tr('notifications.v3.timeline', 'What happened')}\n >\n <h3 className=\"m-0 text-xs font-medium text-text-muted\">\n {tr('notifications.v3.timeline', 'What happened')}\n </h3>\n <ol className=\"m-0 flex list-none flex-col gap-2 p-0\" data-testid=\"panel-timeline\">\n {items.map((event) => {\n const Icon = EVENT_ICON[event.tone];\n return (\n <li key={event.id} className=\"flex items-center gap-2 text-sm\">\n <Icon className={`size-4 ${EVENT_TEXT[event.tone]}`} aria-hidden=\"true\" />\n <span className=\"flex-1 text-text-primary\">{event.words}</span>\n <time className=\"text-xs text-text-muted\" dateTime={event.at}>\n {when.moment(event.at)}\n </time>\n </li>\n );\n })}\n </ol>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,SAASA,EAAO,GAAa;CAC3B,AAAKC,EAAcC,CAAG,KAAG,OAAO,KAAKA,GAAK,UAAU,qBAAqB;AAC3E;AASA,SAAgBC,EAAwB,EACtC,OACA,YACA,mBAMC;CACD,IAAMC,IAAKC,EAAM,GACX,EAAE,UAAO,aAAUC,EAAsBC,CAAE,GAC3CC,IAAQC,EAAM,WAAW,UAAUA,EAAM,eAAe,MACxDC,IAAeF,IAAQG,EAA4BH,CAAK,IAAI,MAC5DI,IACJF,KAAgBG,IACd,kBAACC,GAAD;EAA2B;EAAc,SAASD;CAAe,CAAA,IAC/D,KAAA;CAEN,OACE,kBAACE,GAAD;EACE,MAAM,EAAQR;EACd,eAAe,MAAUS,IAAO,KAAA,IAAYC,EAAQ;EACpD,OAAO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AIC;CACJ,KAAKC;CACL,SAASC;CACT,SAASA;AACX,GACMC,IAAwC;CAC5C,IAAI;CACJ,KAAK;CACL,SAAS;CACT,SAAS;AACX;AAEA,SAASV,EAAS,EAAE,aAAwD;CAC1E,IAAMnC,IAAKC,EAAM,GACXuB,IAAOC,EAAc,GACrBqB,IAAQC,EAASC,GAAQhD,CAAE;CAEjC,OADI8C,EAAM,WAAW,IAAU,OAE7B,kBAAC,WAAD;EACE,WAAU;EACV,cAAY9C,EAAG,6BAA6B,eAAe;EAF7D,UAAA,CAIE,kBAAC,MAAD;GAAI,WAAU;GACX,UAAAA,EAAG,6BAA6B,eAAe;EAC9C,CAAA,GACJ,kBAAC,MAAD;GAAI,WAAU;GAAwC,eAAY;GAC/D,UAAA8C,EAAM,KAAK,MAAU;IACpB,IAAMG,IAAOR,EAAWS,EAAM;IAC9B,OACE,kBAAC,MAAD;KAAmB,WAAU;KAA7B,UAAA;MACE,kBAACD,GAAD;OAAM,WAAW,UAAUJ,EAAWK,EAAM;OAAS,eAAY;MAAQ,CAAA;MACzE,kBAAC,QAAD;OAAM,WAAU;OAA4B,UAAAA,EAAM;MAAY,CAAA;MAC9D,kBAAC,QAAD;OAAM,WAAU;OAA0B,UAAUA,EAAM;OACvD,UAAA1B,EAAK,OAAO0B,EAAM,EAAE;MACjB,CAAA;KACJ;IANK,GAAAA,EAAM,EAMX;GAER,CAAC;EACC,CAAA,CACG;;AAEb"}
|
|
@@ -8,98 +8,94 @@ import { Bell as u, BellOff as d, Check as f, Inbox as p, Megaphone as m, Search
|
|
|
8
8
|
import { useNavigate as _ } from "react-router";
|
|
9
9
|
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
10
10
|
import { PageHeader as b, PushOptInToggle as x } from "@burdenoff/fe-libs/chrome";
|
|
11
|
-
import { Button as S, Input as C, SettingRow as w, SettingsSection as T, Switch as E } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
import { Button as S, Input as C, SettingRow as w, SettingsSection as T, Switch as E, WorkspacePage as D } from "@burdenoff/fe-libs/ui";
|
|
12
12
|
// src/v2/PreferencesPage.tsx
|
|
13
|
-
function
|
|
14
|
-
let f = r(), g = _(), w = i(), E = n(), { topics:
|
|
13
|
+
function O() {
|
|
14
|
+
let f = r(), g = _(), w = i(), E = n(), { topics: O, isLoading: A, isForbidden: j } = e({
|
|
15
15
|
type: "MARKETING",
|
|
16
16
|
isActive: !0
|
|
17
|
-
}), [
|
|
18
|
-
let e =
|
|
19
|
-
return e ?
|
|
20
|
-
}, [
|
|
17
|
+
}), [M, N] = l(""), P = c(() => {
|
|
18
|
+
let e = M.trim().toLowerCase();
|
|
19
|
+
return e ? O.filter((t) => t.name.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e)) : O;
|
|
20
|
+
}, [M, O]), F = E.preferencesByKey.get(t({ scope: "GLOBAL" }))?.enabled === !1, I = (e, n, r = {}) => /* @__PURE__ */ v(k, {
|
|
21
21
|
target: e,
|
|
22
22
|
label: n,
|
|
23
23
|
options: r,
|
|
24
24
|
toggles: E
|
|
25
25
|
}, t(e));
|
|
26
|
-
return /* @__PURE__ */ y(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}) : null
|
|
98
|
-
]
|
|
99
|
-
})]
|
|
100
|
-
});
|
|
26
|
+
return /* @__PURE__ */ y(D, { children: [/* @__PURE__ */ v(b, {
|
|
27
|
+
variant: "compact",
|
|
28
|
+
title: f("notifications.v3.title", "Notifications"),
|
|
29
|
+
description: f("notifications.v3.prefs.purpose", "Choose what reaches you, and where."),
|
|
30
|
+
secondary: /* @__PURE__ */ y(S, {
|
|
31
|
+
variant: "outline",
|
|
32
|
+
onClick: () => g(w.inbox),
|
|
33
|
+
children: [/* @__PURE__ */ v(p, { "aria-hidden": "true" }), f("notifications.v3.prefs.openInbox", "Open the inbox")]
|
|
34
|
+
})
|
|
35
|
+
}), /* @__PURE__ */ y("div", {
|
|
36
|
+
className: "flex flex-col gap-4",
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ v(T, {
|
|
39
|
+
icon: d,
|
|
40
|
+
title: f("notifications.v3.prefs.pauseTitle", "Pause everything"),
|
|
41
|
+
children: I({ scope: "GLOBAL" }, f("notifications.v3.prefs.pause", "Pause notifications"), {
|
|
42
|
+
description: F ? f("notifications.v3.prefs.pausedNow", "Paused. Nothing reaches you until you turn this off.") : f("notifications.v3.prefs.pauseHelp", "Stop every notification, everywhere, until you turn this off."),
|
|
43
|
+
inverted: !0
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ y(T, {
|
|
47
|
+
icon: u,
|
|
48
|
+
title: f("notifications.v3.prefs.whereTitle", "Where you hear from us"),
|
|
49
|
+
children: [[...a, ...o].map((e) => I({
|
|
50
|
+
scope: "CHANNEL",
|
|
51
|
+
channel: e.value
|
|
52
|
+
}, f(e.labelKey, e.label))), /* @__PURE__ */ v("div", {
|
|
53
|
+
className: "px-1 py-2",
|
|
54
|
+
children: /* @__PURE__ */ v(x, {})
|
|
55
|
+
})]
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ v(T, {
|
|
58
|
+
icon: p,
|
|
59
|
+
title: f("notifications.v3.prefs.whatTitle", "What you hear about"),
|
|
60
|
+
children: s.map((e) => I({
|
|
61
|
+
scope: "TYPE",
|
|
62
|
+
type: e.value
|
|
63
|
+
}, f(e.labelKey, e.label)))
|
|
64
|
+
}),
|
|
65
|
+
!A && !j && O.length > 0 ? /* @__PURE__ */ y(T, {
|
|
66
|
+
icon: m,
|
|
67
|
+
title: f("notifications.v3.prefs.topicsTitle", "Updates you can opt into"),
|
|
68
|
+
children: [O.length > 5 ? /* @__PURE__ */ y("label", {
|
|
69
|
+
className: "relative block px-1 py-2",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ v("span", {
|
|
72
|
+
className: "sr-only",
|
|
73
|
+
children: f("notifications.searchTopics", "Search topics...")
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ v(h, {
|
|
76
|
+
className: "pointer-events-none absolute top-1/2 left-4 size-4 -translate-y-1/2 text-text-muted",
|
|
77
|
+
"aria-hidden": "true"
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ v(C, {
|
|
80
|
+
type: "search",
|
|
81
|
+
className: "pl-9",
|
|
82
|
+
value: M,
|
|
83
|
+
placeholder: f("notifications.searchTopics", "Search topics..."),
|
|
84
|
+
onChange: (e) => N(e.target.value)
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
}) : null, P.length === 0 ? /* @__PURE__ */ v("p", {
|
|
88
|
+
className: "m-0 px-1 py-2 text-sm text-text-secondary",
|
|
89
|
+
children: f("notifications.noTopicsFound", "No topics match your search")
|
|
90
|
+
}) : P.map((e) => I({
|
|
91
|
+
scope: "TOPIC",
|
|
92
|
+
topicId: e.id
|
|
93
|
+
}, e.name, { description: e.description || void 0 }))]
|
|
94
|
+
}) : null
|
|
95
|
+
]
|
|
96
|
+
})] });
|
|
101
97
|
}
|
|
102
|
-
function
|
|
98
|
+
function k({ target: e, label: n, options: i, toggles: a }) {
|
|
103
99
|
let o = r(), s = t(e), c = a.preferencesByKey.get(s), l = c?.enabled ?? !0, u = a.saveFeedback?.key === s ? a.saveFeedback : null, d = i.description;
|
|
104
100
|
if (u) {
|
|
105
101
|
let e = u.type === "success" ? f : g;
|
|
@@ -134,6 +130,6 @@ function O({ target: e, label: n, options: i, toggles: a }) {
|
|
|
134
130
|
})
|
|
135
131
|
});
|
|
136
132
|
}
|
|
137
|
-
export {
|
|
133
|
+
export { O as PreferencesPage };
|
|
138
134
|
|
|
139
135
|
//# sourceMappingURL=PreferencesPage.js.map
|
|
@@ -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,Q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AAMrB,EAAcG,CAAM,GAC1BmB,IAAWnC,EAAQ,iBAAiB,IAAIkC,CAAG,GAC3CE,IAAUD,GAAU,WAAW,IAC/BE,IAAWrC,EAAQ,cAAc,QAAQkC,IAAMlC,EAAQ,eAAe,MACxEsC,IAAyBC,EAAQ;CACrC,IAAIF,GAAU;EACZ,IAAMG,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,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.descript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;CAET,CAAA;AAEL"}
|
|
@@ -11,29 +11,29 @@ import { useFeatureFlagDetails as d } from "@burdenoff/fe-libs/shared/feature-fl
|
|
|
11
11
|
import { CheckCircle2 as f, Clock as p, XCircle as m } from "lucide-react";
|
|
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,
|
|
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
|
|
16
|
+
var T = {
|
|
17
17
|
ok: f,
|
|
18
18
|
bad: m,
|
|
19
19
|
waiting: p
|
|
20
|
-
},
|
|
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
|
|
25
|
+
function O() {
|
|
26
26
|
let e = d("notification.history");
|
|
27
27
|
return e && e.value ? /* @__PURE__ */ h(r, {
|
|
28
28
|
tool: "deliveryLog",
|
|
29
29
|
back: !1,
|
|
30
|
-
children: /* @__PURE__ */ h(
|
|
30
|
+
children: /* @__PURE__ */ h(F, {})
|
|
31
31
|
}) : /* @__PURE__ */ h(i, {});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function k(e, t) {
|
|
34
34
|
return e.recipientEmail || e.recipientPhone || t("notifications.v3.log.inApp", "someone in the app");
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function A({ counts: e, tone: n, onTone: r }) {
|
|
37
37
|
let i = t();
|
|
38
38
|
return /* @__PURE__ */ g("div", {
|
|
39
39
|
className: "flex flex-wrap items-center gap-2",
|
|
@@ -41,15 +41,15 @@ function k({ counts: e, tone: n, onTone: r }) {
|
|
|
41
41
|
children: [
|
|
42
42
|
/* @__PURE__ */ h(S, {
|
|
43
43
|
status: "ok",
|
|
44
|
-
children: i("notifications.v3.log.delivered", "{{count}} delivered", { count:
|
|
44
|
+
children: i("notifications.v3.log.delivered", "{{count}} delivered", { count: E.format(e.ok) })
|
|
45
45
|
}),
|
|
46
46
|
/* @__PURE__ */ h(S, {
|
|
47
47
|
status: "bad",
|
|
48
|
-
children: i("notifications.v3.log.failed", "{{count}} didn’t arrive", { count:
|
|
48
|
+
children: i("notifications.v3.log.failed", "{{count}} didn’t arrive", { count: E.format(e.bad) })
|
|
49
49
|
}),
|
|
50
50
|
/* @__PURE__ */ h(S, {
|
|
51
51
|
status: "waiting",
|
|
52
|
-
children: i("notifications.v3.log.waiting", "{{count}} waiting", { count:
|
|
52
|
+
children: i("notifications.v3.log.waiting", "{{count}} waiting", { count: E.format(e.waiting) })
|
|
53
53
|
}),
|
|
54
54
|
/* @__PURE__ */ h("span", { className: "flex-1" }),
|
|
55
55
|
/* @__PURE__ */ h(b, {
|
|
@@ -78,8 +78,8 @@ function k({ counts: e, tone: n, onTone: r }) {
|
|
|
78
78
|
]
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
let r = t(), i =
|
|
81
|
+
function j({ item: e, onOpen: n }) {
|
|
82
|
+
let r = t(), i = w(), { notification: a, state: o } = e, c = T[o.tone];
|
|
83
83
|
return /* @__PURE__ */ h("li", {
|
|
84
84
|
"data-row-id": a.id,
|
|
85
85
|
children: /* @__PURE__ */ g("button", {
|
|
@@ -88,7 +88,7 @@ function A({ item: e, onOpen: n }) {
|
|
|
88
88
|
onClick: () => n(a.id),
|
|
89
89
|
children: [
|
|
90
90
|
/* @__PURE__ */ h(c, {
|
|
91
|
-
className: `size-4 shrink-0 ${
|
|
91
|
+
className: `size-4 shrink-0 ${D[o.tone]}`,
|
|
92
92
|
"aria-hidden": "true"
|
|
93
93
|
}),
|
|
94
94
|
/* @__PURE__ */ g("span", {
|
|
@@ -97,7 +97,7 @@ function A({ item: e, onOpen: n }) {
|
|
|
97
97
|
className: "block truncate text-sm text-text-primary",
|
|
98
98
|
children: r("notifications.v3.log.line", "{{title}} → {{who}}", {
|
|
99
99
|
title: a.title,
|
|
100
|
-
who:
|
|
100
|
+
who: k(a, r)
|
|
101
101
|
})
|
|
102
102
|
}), /* @__PURE__ */ g("span", {
|
|
103
103
|
className: "block truncate text-xs text-text-secondary",
|
|
@@ -117,7 +117,7 @@ function A({ item: e, onOpen: n }) {
|
|
|
117
117
|
})
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function M({ items: e, onOpen: n }) {
|
|
121
121
|
let r = t();
|
|
122
122
|
return /* @__PURE__ */ h("div", {
|
|
123
123
|
className: "flex flex-col gap-4",
|
|
@@ -130,7 +130,7 @@ function j({ items: e, onOpen: n }) {
|
|
|
130
130
|
children: e.label
|
|
131
131
|
}), /* @__PURE__ */ h("ul", {
|
|
132
132
|
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(
|
|
133
|
+
children: e.items.map((e) => /* @__PURE__ */ h(j, {
|
|
134
134
|
item: e,
|
|
135
135
|
onOpen: n
|
|
136
136
|
}, e.notification.id))
|
|
@@ -138,7 +138,7 @@ function j({ items: e, onOpen: n }) {
|
|
|
138
138
|
}, e.key))
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function N({ filtered: e }) {
|
|
142
142
|
let n = t();
|
|
143
143
|
return /* @__PURE__ */ h(v, {
|
|
144
144
|
kind: e ? "filtered" : "first-use",
|
|
@@ -146,14 +146,14 @@ function M({ filtered: e }) {
|
|
|
146
146
|
description: n("notifications.v3.log.emptyBody", "Each notification sent is listed here with what happened to it.")
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function P() {
|
|
150
150
|
return /* @__PURE__ */ h("div", {
|
|
151
151
|
className: "flex flex-col gap-2",
|
|
152
152
|
"aria-busy": "true",
|
|
153
153
|
children: Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ h(x, { className: "h-12 w-full rounded-lg" }, t))
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function F() {
|
|
157
157
|
let r = t(), i = n(), o = e(), [s, d] = u("any"), [f, p] = u(null), m = l(() => o.notifications.map((e) => ({
|
|
158
158
|
notification: e,
|
|
159
159
|
state: c(e.deliveryStatus, r),
|
|
@@ -166,7 +166,7 @@ function P() {
|
|
|
166
166
|
};
|
|
167
167
|
for (let t of m) e[t.state.tone] += 1;
|
|
168
168
|
return e;
|
|
169
|
-
}, [m]), b = s === "any" ? m : m.filter((e) => e.state.tone === s), x = m.length === 0, S = /* @__PURE__ */ h(
|
|
169
|
+
}, [m]), b = s === "any" ? m : m.filter((e) => e.state.tone === s), x = m.length === 0, S = /* @__PURE__ */ h(M, {
|
|
170
170
|
items: b,
|
|
171
171
|
onOpen: p
|
|
172
172
|
});
|
|
@@ -174,34 +174,30 @@ function P() {
|
|
|
174
174
|
what: r("notifications.v3.log.title", "Delivery log"),
|
|
175
175
|
error: o.error,
|
|
176
176
|
onRetry: () => void o.refetch()
|
|
177
|
-
}) : o.isLoading && x ? S = /* @__PURE__ */ h(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
onClose: () => p(null)
|
|
201
|
-
})
|
|
202
|
-
]
|
|
203
|
-
});
|
|
177
|
+
}) : o.isLoading && x ? S = /* @__PURE__ */ h(P, {}) : b.length === 0 && (S = /* @__PURE__ */ h(N, { filtered: s !== "any" })), /* @__PURE__ */ g(C, { children: [
|
|
178
|
+
/* @__PURE__ */ h(_, {
|
|
179
|
+
variant: "compact",
|
|
180
|
+
title: r("notifications.v3.log.title", "Delivery log"),
|
|
181
|
+
description: r("notifications.v3.log.purpose", "Every notification sent, and whether it arrived."),
|
|
182
|
+
back: {
|
|
183
|
+
label: r("notifications.v3.title", "Notifications"),
|
|
184
|
+
to: i.inbox
|
|
185
|
+
}
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ g("div", {
|
|
188
|
+
className: "flex flex-col gap-3",
|
|
189
|
+
children: [/* @__PURE__ */ h(A, {
|
|
190
|
+
counts: v,
|
|
191
|
+
tone: s,
|
|
192
|
+
onTone: d
|
|
193
|
+
}), S]
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ h(a, {
|
|
196
|
+
id: f,
|
|
197
|
+
onClose: () => p(null)
|
|
198
|
+
})
|
|
199
|
+
] });
|
|
204
200
|
}
|
|
205
|
-
export {
|
|
201
|
+
export { O as DeliveryLogPage };
|
|
206
202
|
|
|
207
203
|
//# 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,MAAM;EACpC,UAAA,kBAACC,GAAD,CA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AkB,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","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","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 { 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 { 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 <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;CAG5D,OADMD,KAAkBA,EAAQ,QAE9B,kBAACE,GAAD;EAAa,MAAK;EAAc,MAAM;EACpC,UAAA,kBAACC,GAAD,CAAc,CAAA;CACH,CAAA,IAJyC,kBAACC,GAAD,CAAyB,CAAA;AAMnF;AAEA,SAASC,EACP,GACA,GACQ;CACR,OACEC,EAAa,kBACbA,EAAa,kBACbC,EAAG,8BAA8B,oBAAoB;AAEzD;AAQA,SAASC,EAAe,EACtB,WACA,SACA,aAKC;CACD,IAAMD,IAAKE,EAAM;CACjB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAoC,eAAY;EAA/D,UAAA;GACE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