@burdenoff/microfe-notification 2026.1202.2 → 2026.1203.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.
Files changed (37) hide show
  1. package/dist/components/NotificationBell.js +1 -1
  2. package/dist/components/NotificationBell.js.map +1 -1
  3. package/dist/components/NotificationCard.js +5 -5
  4. package/dist/components/NotificationCard.js.map +1 -1
  5. package/dist/components/NotificationPanel.js +1 -1
  6. package/dist/components/NotificationPanel.js.map +1 -1
  7. package/dist/navigation-v2/FilterControls.js +2 -2
  8. package/dist/navigation-v2/FilterControls.js.map +1 -1
  9. package/dist/navigation-v2/NotificationSettingsV2.js +3 -3
  10. package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -1
  11. package/dist/pages/CreateNotificationPage.js +9 -9
  12. package/dist/pages/CreateNotificationPage.js.map +1 -1
  13. package/dist/pages/NotificationCenterPage.js +2 -2
  14. package/dist/pages/NotificationCenterPage.js.map +1 -1
  15. package/dist/pages/NotificationHistoryAdminPage.js +3 -3
  16. package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
  17. package/dist/pages/NotificationHistoryPage.js +2 -2
  18. package/dist/pages/NotificationHistoryPage.js.map +1 -1
  19. package/dist/pages/NotificationPreferencesPage.js +2 -2
  20. package/dist/pages/NotificationPreferencesPage.js.map +1 -1
  21. package/dist/pages/NotificationTemplatesPage.js +2 -2
  22. package/dist/pages/NotificationTemplatesPage.js.map +1 -1
  23. package/dist/pages/NotificationTopicsPage.js +2 -2
  24. package/dist/pages/NotificationTopicsPage.js.map +1 -1
  25. package/dist/pages/TemplateEditorPage.js +2 -2
  26. package/dist/pages/TemplateEditorPage.js.map +1 -1
  27. package/dist/v2/InboxPage.js +2 -2
  28. package/dist/v2/InboxPage.js.map +1 -1
  29. package/dist/v2/InboxRows.js +1 -1
  30. package/dist/v2/InboxRows.js.map +1 -1
  31. package/dist/v2/PreferencesPage.js +2 -2
  32. package/dist/v2/PreferencesPage.js.map +1 -1
  33. package/dist/v2/admin/DeliveryLogPage.js +1 -1
  34. package/dist/v2/admin/DeliveryLogPage.js.map +1 -1
  35. package/dist/v2/admin/TemplatesPage.js +2 -2
  36. package/dist/v2/admin/TemplatesPage.js.map +1 -1
  37. package/package.json +6 -2
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesPage.js","names":["PreferencesPage","tr","useTr","navigate","useNavigate","paths","useNotificationPaths","toggles","usePreferenceToggles","topicsLoading","topicsUpdatedAt","useNotificationTopics","search","setSearch","useState","shownTopics","useMemo","query","topics","topic","paused","preferenceKey","row","PreferenceRow","target","WorkspacePage","PageHeader","Button","Inbox","StaleHint","oldestLoad","SettingsSection","BellOff","Bell","EVERYDAY_CHANNELS","MORE_CHANNELS","channel","PushOptInToggle","TYPES","type","isForbidden","Megaphone","Search","Input","event","connection","useNeedsConnection","key","existing","enabled","feedback","description","options","Icon","Check","X","SettingRow","waitingButton","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 { useNeedsConnection, waitingButton } from './useNeedsConnection';\nimport { useNotificationPaths } from '../navigation-v2/paths';\nimport { EVERYDAY_CHANNELS, MORE_CHANNELS, TYPES } from '../navigation-v2/settingsOptions';\nimport { StaleHint } from './StaleHint';\nimport { oldestLoad } from './model/loadedAt';\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 dataUpdatedAt: topicsUpdatedAt,\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 {/* Settings and the topics you can opt into are two reads: the earliest of them. */}\n <StaleHint loadedAt={oldestLoad(toggles.preferencesUpdatedAt, topicsUpdatedAt)} />\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 connection = useNeedsConnection();\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 {...waitingButton(connection, 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 {...waitingButton(connection, 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":";;;;;;;;;;;;;;;AAgCA,SAAgBA,IAAkB;CAChC,IAAMC,IAAKC,EAAM,GACXC,IAAWC,EAAY,GACvBC,IAAQC,EAAqB,GAC7BC,IAAUC,EAAqB,GAC/B,EACJ,WACA,WAAWC,GACX,gBACA,eAAeC,MACbC,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,KAA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wC,CAAG,GAC3CE,IAAUD,GAAU,WAAW,IAC/BE,IAAW3C,EAAQ,cAAc,QAAQwC,IAAMxC,EAAQ,eAAe,MACxE4C,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,kBAACrB,GAAD;IACE,MAAK;IACL,SAAQ;IACR,GAAI8B,EAAcZ,GAAYtC,EAAQ,cAAcwC,CAAG;IACvD,eAAe,KAAKxC,EAAQ,gBAAgBwC,CAAG;IAE9C,UAAA9C,EAAG,qCAAqC,aAAa;GAChD,CAAA,IACN,MACJ,kBAACyD,GAAD;IACE,SAASN,EAAQ,WAAW,CAACH,IAAUA;IACvC,GAAIQ,EAAcZ,GAAYtC,EAAQ,cAAcwC,CAAG;IACvD,uBAAuB,KAAKxC,EAAQ,iBAAiBiB,CAAM;IAC3D,mBAAiBmC,EAAI;IACrB,oBAAkBA,EAAI;IACtB,eAAa,QAAQZ;GACtB,CAAA,CACG;;CAET,CAAA;AAEL"}
1
+ {"version":3,"file":"PreferencesPage.js","names":["PreferencesPage","tr","useTr","navigate","useNavigate","paths","useNotificationPaths","toggles","usePreferenceToggles","topicsLoading","topicsUpdatedAt","useNotificationTopics","search","setSearch","useState","shownTopics","useMemo","query","topics","topic","paused","preferenceKey","row","PreferenceRow","target","WorkspacePage","PageHeader","Button","Inbox","StaleHint","oldestLoad","SettingsSection","BellOff","Bell","EVERYDAY_CHANNELS","MORE_CHANNELS","channel","PushOptInToggle","TYPES","type","isForbidden","Megaphone","Search","Input","event","connection","useNeedsConnection","key","existing","enabled","feedback","description","options","Icon","Check","X","SettingRow","waitingButton","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 { useNeedsConnection, waitingButton } from './useNeedsConnection';\nimport { useNotificationPaths } from '../navigation-v2/paths';\nimport { EVERYDAY_CHANNELS, MORE_CHANNELS, TYPES } from '../navigation-v2/settingsOptions';\nimport { StaleHint } from './StaleHint';\nimport { oldestLoad } from './model/loadedAt';\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 dataUpdatedAt: topicsUpdatedAt,\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 {/* Settings and the topics you can opt into are two reads: the earliest of them. */}\n <StaleHint loadedAt={oldestLoad(toggles.preferencesUpdatedAt, topicsUpdatedAt)} />\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 start-4 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\n className=\"ps-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 connection = useNeedsConnection();\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 {...waitingButton(connection, 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 {...waitingButton(connection, 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":";;;;;;;;;;;;;;;AAgCA,SAAgBA,IAAkB;CAChC,IAAMC,IAAKC,EAAM,GACXC,IAAWC,EAAY,GACvBC,IAAQC,EAAqB,GAC7BC,IAAUC,EAAqB,GAC/B,EACJ,WACA,WAAWC,GACX,gBACA,eAAeC,MACbC,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,IACJb,EAAQ,iBAAiB,IAAIc,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,kBAACC,GAAD,EAAA,UAAA;EACE,kBAACC,GAAD;GACE,SAAQ;GACR,OAAOzB,EAAG,0BAA0B,eAAe;GACnD,aAAaA,EAAG,kCAAkC,qCAAqC;GACvF,WACE,kBAAC0B,GAAD;IAAQ,SAAQ;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CACGR,IACC,kBAACrB,GAAD;IACE,MAAK;IACL,SAAQ;IACR,GAAI8B,EAAcZ,GAAYtC,EAAQ,cAAcwC,CAAG;IACvD,eAAe,KAAKxC,EAAQ,gBAAgBwC,CAAG;IAE9C,UAAA9C,EAAG,qCAAqC,aAAa;GAChD,CAAA,IACN,MACJ,kBAACyD,GAAD;IACE,SAASN,EAAQ,WAAW,CAACH,IAAUA;IACvC,GAAIQ,EAAcZ,GAAYtC,EAAQ,cAAcwC,CAAG;IACvD,uBAAuB,KAAKxC,EAAQ,iBAAiBiB,CAAM;IAC3D,mBAAiBmC,EAAI;IACrB,oBAAkBA,EAAI;IACtB,eAAa,QAAQZ;GACtB,CAAA,CACG;;CAET,CAAA;AAEL"}
@@ -88,7 +88,7 @@ function M({ item: e, onOpen: n }) {
88
88
  "data-row-id": a.id,
89
89
  children: /* @__PURE__ */ _("button", {
90
90
  type: "button",
91
- className: "flex w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-3 py-2.5 text-left",
91
+ className: "flex w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-3 py-2.5 text-start",
92
92
  onClick: () => n(a.id),
93
93
  children: [
94
94
  /* @__PURE__ */ g(c, {
@@ -1 +1 @@
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","StaleHint","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';\nimport { StaleHint } from '../StaleHint';\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 <StaleHint loadedAt={admin.dataUpdatedAt} />\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":";;;;;;;;;;;;;;;;AAiCA,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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,GAAD;EACE,MAAMvC,EAAG,8BAA8B,cAAc;EACrD,OAAO0B,EAAM;EACb,eAAe,KAAKA,EAAM,QAAQ;CACnC,CAAA,IAEMA,EAAM,aAAaW,IAC5B,IAAO,kBAACd,GAAD,CAAkB,CAAA,IAChBa,EAAM,WAAW,MAC1B,IAAO,kBAAChB,GAAD,EAAe,UAAUd,MAAS,MAAQ,CAAA,IAIjD,kBAACkC,GAAD,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,kBAACkD,GAAD,EAAW,UAAUhB,EAAM,cAAgB,CAAA;EAC3C,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACzB,GAAD;IAAwB;IAAc;IAAM,QAAQ2B;GAAU,CAAA,GAC7DU,CACE;;EACL,kBAACK,GAAD;GAAyB,IAAIb;GAAQ,eAAeC,EAAU,IAAI;EAAI,CAAA;CACzD,EAAA,CAAA;AAEnB"}
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","StaleHint","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';\nimport { StaleHint } from '../StaleHint';\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-start\"\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 <StaleHint loadedAt={admin.dataUpdatedAt} />\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":";;;;;;;;;;;;;;;;AAiCA,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,QA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B,cAAc;EACrD,OAAO0B,EAAM;EACb,eAAe,KAAKA,EAAM,QAAQ;CACnC,CAAA,IAEMA,EAAM,aAAaW,IAC5B,IAAO,kBAACd,GAAD,CAAkB,CAAA,IAChBa,EAAM,WAAW,MAC1B,IAAO,kBAAChB,GAAD,EAAe,UAAUd,MAAS,MAAQ,CAAA,IAIjD,kBAACkC,GAAD,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,kBAACkD,GAAD,EAAW,UAAUhB,EAAM,cAAgB,CAAA;EAC3C,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACzB,GAAD;IAAwB;IAAc;IAAM,QAAQ2B;GAAU,CAAA,GAC7DU,CACE;;EACL,kBAACK,GAAD;GAAyB,IAAIb;GAAQ,eAAeC,EAAU,IAAI;EAAI,CAAA;CACzD,EAAA,CAAA;AAEnB"}
@@ -81,12 +81,12 @@ function P() {
81
81
  children: o("notifications.v3.templates.search", "Search templates")
82
82
  }),
83
83
  /* @__PURE__ */ v(g, {
84
- className: "pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-text-muted",
84
+ className: "pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-text-muted",
85
85
  "aria-hidden": "true"
86
86
  }),
87
87
  /* @__PURE__ */ v(E, {
88
88
  type: "search",
89
- className: "pl-9",
89
+ className: "ps-9",
90
90
  value: V,
91
91
  placeholder: o("notifications.v3.templates.search", "Search templates"),
92
92
  onChange: (e) => H(e.target.value)
@@ -1 +1 @@
1
- {"version":3,"file":"TemplatesPage.js","names":["TemplatesPage","AdminPageV2","TemplatesList","tr","useTr","connection","useNeedsConnection","navigate","useNavigate","paths","useNotificationPaths","confirm","useConfirm","gate","useConnectionGate","notify","useNotify","when","useWhenLabels","templates","useNotificationTemplates","search","setSearch","useState","shown","useMemo","query","all","template","toggle","remove","WorkspacePage","PageHeader","Button","Plus","StaleHint","Search","Input","event","LoadError","EmptyState","DataRows","IconTile","Mail","toReadable","readDetails","kindWord","channelWord","StatusChip","ActionMenu","waitingItem"],"sources":["../../../src/v2/admin/TemplatesPage.tsx"],"sourcesContent":["/**\n * Templates (BOFF-16785, C2; the mockup's `ntemplates`), under fe-libs' `accountPagesV2`: the\n * messages this product sends, at the list width. A row each (what it's about, how it's sent,\n * when it was edited, on or off), search, New template, and ⋯ (turn off or on, delete). Admins\n * only: anyone else sees who to ask (`AdminPageV2`). Today's hook and storage.\n */\nimport { useMemo, useState } from 'react';\nimport { useNavigate } from 'react-router';\nimport { Mail, Plus, Search } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport {\n ActionMenu,\n Button,\n DataRows,\n EmptyState,\n IconTile,\n Input,\n LoadError,\n StatusChip,\n WorkspacePage,\n useConfirm,\n useNotify,\n useWhenLabels,\n} from '@burdenoff/fe-libs/ui';\nimport {\n useNotificationTemplates,\n type BackendNotificationTemplate,\n} from '../../hooks/useNotificationTemplates';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useConnectionGate, useNeedsConnection, waitingItem } from '../useNeedsConnection';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { AdminPageV2 } from '../../navigation-v2/AdminPageV2';\nimport { channelWord, kindWord } from './words';\nimport { readDetails, toReadable } from './templateText';\nimport { StaleHint } from '../StaleHint';\n\nexport function TemplatesPage() {\n return (\n <AdminPageV2 tool=\"templates\" back={false}>\n <TemplatesList />\n </AdminPageV2>\n );\n}\n\nfunction TemplatesList() {\n const tr = useTr();\n const connection = useNeedsConnection();\n const navigate = useNavigate();\n const paths = useNotificationPaths();\n const confirm = useConfirm();\n const gate = useConnectionGate();\n const notify = useNotify();\n const when = useWhenLabels();\n const templates = useNotificationTemplates();\n const [search, setSearch] = useState('');\n const shown = useMemo(() => {\n const query = search.trim().toLowerCase();\n const all = templates.allTemplates;\n if (!query) return all;\n return all.filter(\n (template) =>\n template.name.toLowerCase().includes(query) ||\n (template.subject ?? '').toLowerCase().includes(query)\n );\n }, [search, templates.allTemplates]);\n\n const toggle = async (template: BackendNotificationTemplate) => {\n try {\n await templates.updateTemplate(template.id, { enabled: !template.enabled });\n notify({\n title: template.enabled\n ? tr('notifications.v3.templates.turnedOff', '{{name}} is off', { name: template.name })\n : tr('notifications.v3.templates.turnedOn', '{{name}} is on', { name: template.name }),\n tone: 'success',\n });\n await templates.refetch();\n } catch {\n notify({\n title: tr('notifications.v3.templates.saveFailed', 'Couldn’t save. Try again.'),\n tone: 'error',\n });\n }\n };\n\n const remove = async (template: BackendNotificationTemplate) => {\n const yes = await confirm({\n title: tr('notifications.v3.templates.deleteTitle', 'Delete {{name}}?', {\n name: template.name,\n }),\n description: tr(\n 'notifications.v3.templates.deleteBody',\n 'Anything that sends this template stops sending it. Messages already sent stay as they are.'\n ),\n confirmLabel: tr('notifications.v3.templates.delete', 'Delete'),\n tone: 'danger',\n typeToConfirm: template.name,\n });\n // The connection may have dropped while the question was open (BOFF-18043).\n if (!yes || gate()) return;\n try {\n await templates.deleteTemplate(template.id);\n notify({\n title: tr('notifications.v3.templates.deleted', 'Deleted {{name}}', {\n name: template.name,\n }),\n tone: 'success',\n });\n await templates.refetch();\n } catch {\n notify({\n title: tr('notifications.v3.templates.deleteFailed', 'Couldn’t delete it. Try again.'),\n tone: 'error',\n });\n }\n };\n\n return (\n <WorkspacePage>\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.templates.title', 'Templates')}\n description={tr(\n 'notifications.v3.templates.purpose',\n 'Messages written once and sent many times: what they say, and how they’re sent.'\n )}\n back={{ label: tr('notifications.v3.title', 'Notifications'), to: paths.inbox }}\n primary={\n <Button onClick={() => navigate(paths.newTemplate)} data-testid=\"templates-new\">\n <Plus aria-hidden=\"true\" />\n {tr('notifications.v3.templates.new', 'New template')}\n </Button>\n }\n />\n <StaleHint loadedAt={templates.dataUpdatedAt} />\n <div className=\"flex flex-col gap-3\">\n <label className=\"relative block max-w-md\">\n <span className=\"sr-only\">\n {tr('notifications.v3.templates.search', 'Search templates')}\n </span>\n <Search\n className=\"pointer-events-none absolute top-1/2 left-3 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.v3.templates.search', 'Search templates')}\n onChange={(event) => setSearch(event.target.value)}\n />\n </label>\n {templates.error && shown.length === 0 ? (\n <LoadError\n what={tr('notifications.v3.templates.title', 'Templates')}\n error={templates.error}\n onRetry={() => void templates.refetch()}\n />\n ) : !templates.isLoading && shown.length === 0 ? (\n search.trim() ? (\n <EmptyState\n kind=\"no-results\"\n title={tr('notifications.v3.templates.noMatch', 'No templates match')}\n description={tr('notifications.v3.empty.searchBody', 'Try other words.')}\n />\n ) : (\n <EmptyState\n kind=\"first-use\"\n title={tr('notifications.v3.templates.emptyTitle', 'No templates yet')}\n description={tr(\n 'notifications.v3.templates.emptyBody',\n 'A template is a message you write once, like a welcome email, and send many times.'\n )}\n action={\n <Button onClick={() => navigate(paths.newTemplate)}>\n {tr('notifications.v3.templates.new', 'New template')}\n </Button>\n }\n />\n )\n ) : (\n <DataRows\n items={shown}\n loading={templates.isLoading && shown.length === 0}\n skeletonRows={5}\n getId={(template) => template.id}\n label={tr('notifications.v3.templates.title', 'Templates')}\n lead={{\n header: tr('notifications.v3.templates.template', 'Template'),\n media: () => (\n <IconTile size=\"sm\">\n <Mail aria-hidden=\"true\" />\n </IconTile>\n ),\n title: (template) => template.name,\n subtitle: (template) =>\n template.subject\n ? toReadable(template.subject, readDetails(template.variables))\n : undefined,\n onOpen: (template) => navigate(paths.template(template.slug)),\n }}\n columns={[\n {\n id: 'kind',\n header: tr('notifications.v3.templates.kind', 'About'),\n cell: (template) => kindWord(template.type, tr),\n },\n {\n id: 'channel',\n header: tr('notifications.v3.templates.channel', 'Sent by'),\n cell: (template) => channelWord(template.channel, tr),\n },\n {\n id: 'edited',\n header: tr('notifications.v3.templates.edited', 'Edited'),\n cell: (template) => when.moment(template.updatedAt),\n },\n {\n id: 'status',\n header: tr('notifications.v3.templates.status', 'Status'),\n cell: (template) =>\n 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 },\n ]}\n actions={(template) => (\n <ActionMenu\n placement=\"row\"\n label={tr('notifications.v3.templates.actionsFor', 'Actions for {{name}}', {\n name: template.name,\n })}\n items={[\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 ...waitingItem(connection),\n onSelect: () => void toggle(template),\n },\n {\n id: 'delete',\n label: tr('notifications.v3.templates.delete', 'Delete'),\n danger: true,\n ...waitingItem(connection),\n onSelect: () => void remove(template),\n },\n ]}\n />\n )}\n />\n )}\n </div>\n </WorkspacePage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,SAAgBA,IAAgB;CAC9B,OACE,kBAACC,GAAD;EAAa,MAAK;EAAY,MAAM;EAClC,UAAA,kBAACC,GAAD,CAAgB,CAAA;CACL,CAAA;AAEjB;AAEA,SAASA,IAAgB;CACvB,IAAMC,IAAKC,EAAM,GACXC,IAAaC,EAAmB,GAChCC,IAAWC,EAAY,GACvBC,IAAQC,EAAqB,GAC7BC,IAAUC,EAAW,GACrBC,IAAOC,EAAkB,GACzBC,IAASC,EAAU,GACnBC,IAAOC,EAAc,GACrBC,IAAYC,EAAyB,GACrC,CAACC,GAAQC,KAAaC,EAAS,EAAE,GACjCC,IAAQC,QAAc;EAC1B,IAAMC,IAAQL,EAAO,KAAK,CAAC,CAAC,YAAY,GAClCM,IAAMR,EAAU;EAEtB,OADKO,IACEC,EAAI,QAC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,IACnDA,EAAG,qCAAqC,SAAS;MACrD,GAAG+C,EAAY7C,CAAU;MACzB,gBAAgB,KAAKwB,EAAOD,CAAQ;KACtC,GACA;MACE,IAAI;MACJ,OAAOzB,EAAG,qCAAqC,QAAQ;MACvD,QAAQ;MACR,GAAG+C,EAAY7C,CAAU;MACzB,gBAAgB,KAAKyB,EAAOF,CAAQ;KACtC,CACF;IACD,CAAA;GAEJ,CAAA,CAEA;;CACQ,EAAA,CAAA;AAEnB"}
1
+ {"version":3,"file":"TemplatesPage.js","names":["TemplatesPage","AdminPageV2","TemplatesList","tr","useTr","connection","useNeedsConnection","navigate","useNavigate","paths","useNotificationPaths","confirm","useConfirm","gate","useConnectionGate","notify","useNotify","when","useWhenLabels","templates","useNotificationTemplates","search","setSearch","useState","shown","useMemo","query","all","template","toggle","remove","WorkspacePage","PageHeader","Button","Plus","StaleHint","Search","Input","event","LoadError","EmptyState","DataRows","IconTile","Mail","toReadable","readDetails","kindWord","channelWord","StatusChip","ActionMenu","waitingItem"],"sources":["../../../src/v2/admin/TemplatesPage.tsx"],"sourcesContent":["/**\n * Templates (BOFF-16785, C2; the mockup's `ntemplates`), under fe-libs' `accountPagesV2`: the\n * messages this product sends, at the list width. A row each (what it's about, how it's sent,\n * when it was edited, on or off), search, New template, and ⋯ (turn off or on, delete). Admins\n * only: anyone else sees who to ask (`AdminPageV2`). Today's hook and storage.\n */\nimport { useMemo, useState } from 'react';\nimport { useNavigate } from 'react-router';\nimport { Mail, Plus, Search } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport {\n ActionMenu,\n Button,\n DataRows,\n EmptyState,\n IconTile,\n Input,\n LoadError,\n StatusChip,\n WorkspacePage,\n useConfirm,\n useNotify,\n useWhenLabels,\n} from '@burdenoff/fe-libs/ui';\nimport {\n useNotificationTemplates,\n type BackendNotificationTemplate,\n} from '../../hooks/useNotificationTemplates';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useConnectionGate, useNeedsConnection, waitingItem } from '../useNeedsConnection';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { AdminPageV2 } from '../../navigation-v2/AdminPageV2';\nimport { channelWord, kindWord } from './words';\nimport { readDetails, toReadable } from './templateText';\nimport { StaleHint } from '../StaleHint';\n\nexport function TemplatesPage() {\n return (\n <AdminPageV2 tool=\"templates\" back={false}>\n <TemplatesList />\n </AdminPageV2>\n );\n}\n\nfunction TemplatesList() {\n const tr = useTr();\n const connection = useNeedsConnection();\n const navigate = useNavigate();\n const paths = useNotificationPaths();\n const confirm = useConfirm();\n const gate = useConnectionGate();\n const notify = useNotify();\n const when = useWhenLabels();\n const templates = useNotificationTemplates();\n const [search, setSearch] = useState('');\n const shown = useMemo(() => {\n const query = search.trim().toLowerCase();\n const all = templates.allTemplates;\n if (!query) return all;\n return all.filter(\n (template) =>\n template.name.toLowerCase().includes(query) ||\n (template.subject ?? '').toLowerCase().includes(query)\n );\n }, [search, templates.allTemplates]);\n\n const toggle = async (template: BackendNotificationTemplate) => {\n try {\n await templates.updateTemplate(template.id, { enabled: !template.enabled });\n notify({\n title: template.enabled\n ? tr('notifications.v3.templates.turnedOff', '{{name}} is off', { name: template.name })\n : tr('notifications.v3.templates.turnedOn', '{{name}} is on', { name: template.name }),\n tone: 'success',\n });\n await templates.refetch();\n } catch {\n notify({\n title: tr('notifications.v3.templates.saveFailed', 'Couldn’t save. Try again.'),\n tone: 'error',\n });\n }\n };\n\n const remove = async (template: BackendNotificationTemplate) => {\n const yes = await confirm({\n title: tr('notifications.v3.templates.deleteTitle', 'Delete {{name}}?', {\n name: template.name,\n }),\n description: tr(\n 'notifications.v3.templates.deleteBody',\n 'Anything that sends this template stops sending it. Messages already sent stay as they are.'\n ),\n confirmLabel: tr('notifications.v3.templates.delete', 'Delete'),\n tone: 'danger',\n typeToConfirm: template.name,\n });\n // The connection may have dropped while the question was open (BOFF-18043).\n if (!yes || gate()) return;\n try {\n await templates.deleteTemplate(template.id);\n notify({\n title: tr('notifications.v3.templates.deleted', 'Deleted {{name}}', {\n name: template.name,\n }),\n tone: 'success',\n });\n await templates.refetch();\n } catch {\n notify({\n title: tr('notifications.v3.templates.deleteFailed', 'Couldn’t delete it. Try again.'),\n tone: 'error',\n });\n }\n };\n\n return (\n <WorkspacePage>\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.templates.title', 'Templates')}\n description={tr(\n 'notifications.v3.templates.purpose',\n 'Messages written once and sent many times: what they say, and how they’re sent.'\n )}\n back={{ label: tr('notifications.v3.title', 'Notifications'), to: paths.inbox }}\n primary={\n <Button onClick={() => navigate(paths.newTemplate)} data-testid=\"templates-new\">\n <Plus aria-hidden=\"true\" />\n {tr('notifications.v3.templates.new', 'New template')}\n </Button>\n }\n />\n <StaleHint loadedAt={templates.dataUpdatedAt} />\n <div className=\"flex flex-col gap-3\">\n <label className=\"relative block max-w-md\">\n <span className=\"sr-only\">\n {tr('notifications.v3.templates.search', 'Search templates')}\n </span>\n <Search\n className=\"pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\n className=\"ps-9\"\n value={search}\n placeholder={tr('notifications.v3.templates.search', 'Search templates')}\n onChange={(event) => setSearch(event.target.value)}\n />\n </label>\n {templates.error && shown.length === 0 ? (\n <LoadError\n what={tr('notifications.v3.templates.title', 'Templates')}\n error={templates.error}\n onRetry={() => void templates.refetch()}\n />\n ) : !templates.isLoading && shown.length === 0 ? (\n search.trim() ? (\n <EmptyState\n kind=\"no-results\"\n title={tr('notifications.v3.templates.noMatch', 'No templates match')}\n description={tr('notifications.v3.empty.searchBody', 'Try other words.')}\n />\n ) : (\n <EmptyState\n kind=\"first-use\"\n title={tr('notifications.v3.templates.emptyTitle', 'No templates yet')}\n description={tr(\n 'notifications.v3.templates.emptyBody',\n 'A template is a message you write once, like a welcome email, and send many times.'\n )}\n action={\n <Button onClick={() => navigate(paths.newTemplate)}>\n {tr('notifications.v3.templates.new', 'New template')}\n </Button>\n }\n />\n )\n ) : (\n <DataRows\n items={shown}\n loading={templates.isLoading && shown.length === 0}\n skeletonRows={5}\n getId={(template) => template.id}\n label={tr('notifications.v3.templates.title', 'Templates')}\n lead={{\n header: tr('notifications.v3.templates.template', 'Template'),\n media: () => (\n <IconTile size=\"sm\">\n <Mail aria-hidden=\"true\" />\n </IconTile>\n ),\n title: (template) => template.name,\n subtitle: (template) =>\n template.subject\n ? toReadable(template.subject, readDetails(template.variables))\n : undefined,\n onOpen: (template) => navigate(paths.template(template.slug)),\n }}\n columns={[\n {\n id: 'kind',\n header: tr('notifications.v3.templates.kind', 'About'),\n cell: (template) => kindWord(template.type, tr),\n },\n {\n id: 'channel',\n header: tr('notifications.v3.templates.channel', 'Sent by'),\n cell: (template) => channelWord(template.channel, tr),\n },\n {\n id: 'edited',\n header: tr('notifications.v3.templates.edited', 'Edited'),\n cell: (template) => when.moment(template.updatedAt),\n },\n {\n id: 'status',\n header: tr('notifications.v3.templates.status', 'Status'),\n cell: (template) =>\n 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 },\n ]}\n actions={(template) => (\n <ActionMenu\n placement=\"row\"\n label={tr('notifications.v3.templates.actionsFor', 'Actions for {{name}}', {\n name: template.name,\n })}\n items={[\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 ...waitingItem(connection),\n onSelect: () => void toggle(template),\n },\n {\n id: 'delete',\n label: tr('notifications.v3.templates.delete', 'Delete'),\n danger: true,\n ...waitingItem(connection),\n onSelect: () => void remove(template),\n },\n ]}\n />\n )}\n />\n )}\n </div>\n </WorkspacePage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,SAAgBA,IAAgB;CAC9B,OACE,kBAACC,GAAD;EAAa,MAAK;EA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;KACpD;KACA;MACE,IAAI;MACJ,QAAQzB,EAAG,qCAAqC,QAAQ;MACxD,OAAO,MACLyB,EAAS,UACP,kBAACoB,GAAD;OAAY,QAAO;OAAM,UAAA7C,EAAG,uBAAuB,IAAI;MAAc,CAAA,IAErE,kBAAC6C,GAAD;OAAY,QAAO;OAAU,UAAA7C,EAAG,wBAAwB,KAAK;MAAc,CAAA;KAEjF;IACF;IACA,UAAU,MACR,kBAAC8C,GAAD;KACE,WAAU;KACV,OAAO9C,EAAG,yCAAyC,wBAAwB,EACzE,MAAMyB,EAAS,KACjB,CAAC;KACD,OAAO,CACL;MACE,IAAI;MACJ,OAAOA,EAAS,UACZzB,EAAG,sCAAsC,UAAU,IACnDA,EAAG,qCAAqC,SAAS;MACrD,GAAG+C,EAAY7C,CAAU;MACzB,gBAAgB,KAAKwB,EAAOD,CAAQ;KACtC,GACA;MACE,IAAI;MACJ,OAAOzB,EAAG,qCAAqC,QAAQ;MACvD,QAAQ;MACR,GAAG+C,EAAY7C,CAAU;MACzB,gBAAgB,KAAKyB,EAAOF,CAAQ;KACtC,CACF;IACD,CAAA;GAEJ,CAAA,CAEA;;CACQ,EAAA,CAAA;AAEnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-notification",
3
- "version": "2026.1202.2",
3
+ "version": "2026.1203.2",
4
4
  "description": "Notification microfrontend for multi-channel notification management",
5
5
  "type": "module",
6
6
  "imports": {
@@ -46,7 +46,8 @@
46
46
  "switch:check": "boff deps-mode check",
47
47
  "switch:local": "boff deps-mode local",
48
48
  "switch:remote": "boff deps-mode remote",
49
- "switch:status": "boff deps-mode status"
49
+ "switch:status": "boff deps-mode status",
50
+ "check:logical-direction": "bun scripts/check-logical-direction.ts"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "react": ">=18.0.0",
@@ -125,6 +126,9 @@
125
126
  "sanity": {
126
127
  "formatPaths": [
127
128
  "src"
129
+ ],
130
+ "extra": [
131
+ "check:logical-direction"
128
132
  ]
129
133
  },
130
134
  "scripts": {