@soffits/dsh-notify-inbox 0.3.0 → 0.5.0

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/client.js CHANGED
@@ -3,86 +3,93 @@
3
3
  * unread count), its page, turning Web Push on for this browser, and the
4
4
  * buttons on each notification.
5
5
  *
6
- * Plain JavaScript in DSH's Client module format (no build step); React comes
7
- * from the page's module table. Everything the page shows comes from the
8
- * plugin's /api/notify-inbox routes, which decide per request who is asking.
9
- * A link with ?notify-inbox=<id> opens the page on that notification.
6
+ * Plain JavaScript in DSH's Client module format (no build step). The page is
7
+ * built from DSH's own controls (@deepseek-ai/dsh-client-ui-primitives, from
8
+ * the page's module table), the shared pieces DSH doesn't have from
9
+ * @soffits/dsh-ui-kit (ctx.uiKit) and the buttons from @soffits/dsh-ui-actions
10
+ * (ctx.uiActions); the little CSS of its own is in docs/ui.md, with why.
11
+ * Everything the page shows comes from the plugin's /api/notify-inbox routes,
12
+ * which decide per request who is asking. A link with ?notify-inbox=<id>
13
+ * opens the page on that notification.
10
14
  */
11
15
  window.__ModuleLoader__.load({
12
16
  id: '@soffits/dsh-notify-inbox',
13
17
  factory(require) {
14
18
  const React = require('react')
19
+ const { Button, Pill, Menu, Tooltip, StateDot, IconCheckCircleOutlineRegular, IconEllipsisOutlineRegular } = require('@deepseek-ai/dsh-client-ui-primitives')
15
20
  const h = React.createElement
16
21
  const { useState, useEffect, useCallback, useRef, useSyncExternalStore } = React
17
22
 
18
23
  const NS = 'dsh-notify-inbox'
19
24
  const PANEL = 'dsh-notify-inbox'
25
+ const OWNER = '@soffits/dsh-notify-inbox'
20
26
  const LINK_PARAM = 'notify-inbox'
21
27
  const STYLE_ID = 'dsh-notify-inbox-style'
22
28
  const PENDING_MS = 2 * 60 * 1000
29
+ const GROUPS = ['needs-you', 'live', 'handled', 'info']
30
+ /** The colour an item's tile takes from what it needs, unless its domain names one. */
31
+ const GROUP_TONE = { 'needs-you': 'accent', live: 'accent', handled: 'ok', info: 'muted' }
32
+ const GROUP_ICON = { 'needs-you': 'circle-alert', live: 'activity', handled: 'circle-check', info: 'info' }
23
33
  const api = path => new URL(`api/notify-inbox/${path}`, document.baseURI).href
24
34
 
35
+ // Only what DSH's components don't cover: the page frame and row layout mirror DSH's own pages
36
+ // (ui-schedule TaskManagerPage, plugin manager groups), since their CSS modules are private.
25
37
  const CSS = `
26
- .nib-page{width:100%;min-width:0;height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);font-size:14px;line-height:1.6}
27
- .nib-scroll{flex:1;min-height:0;overflow:auto;scrollbar-gutter:stable}
28
- .nib-content{max-width:820px;margin:0 auto;padding:0 clamp(16px,4vw,48px) 48px}
29
- .nib-head{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;padding-top:28px;margin-bottom:16px}
30
- [data-platform=darwin] .nib-head{padding-top:calc(28px + var(--dsh-frame-top-clearance,0px))}
31
- .nib-head h1{margin:0;font-size:20px;font-weight:500;line-height:28px;flex:1 0 auto;max-width:100%}
32
- .nib-count{color:var(--dsw-alias-label-tertiary);font-size:13px;margin-left:8px;font-weight:400}
33
- .nib-tabs{display:inline-flex;gap:2px;padding:2px;border-radius:10px;background:var(--dsw-alias-bg-layer-1,var(--dsw-alias-interactive-bg-hover))}
34
- .nib-tab{border:none;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;padding:2px 12px;border-radius:8px;cursor:pointer}
35
- .nib-tab[aria-pressed=true]{background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);box-shadow:0 0 0 .5px var(--dsw-alias-border-l3)}
36
- .nib-btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:4px;height:28px;padding:0 10px;border:none;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;line-height:18px;cursor:pointer;box-shadow:inset 0 0 0 var(--dsh-hairline-width,.5px) var(--dsh-button-outline-color,var(--dsw-alias-border-l3));text-decoration:none;white-space:nowrap}
37
- .nib-btn:disabled{cursor:not-allowed;opacity:.4}
38
- @media (hover:hover){.nib-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.nib-item:hover{background:var(--dsw-alias-interactive-bg-hover)}}
39
- .nib-primary{background:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-on-color,#fff);box-shadow:none}
40
- .nib-push{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:10px 12px;margin-bottom:16px;border-radius:12px;box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);font-size:13px}
41
- .nib-push strong{font-weight:500;color:var(--dsw-alias-label-primary)}
42
- .nib-push .nib-grow{flex:1;min-width:120px}
43
- .nib-hint{width:100%;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}
38
+ .nib-page{display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);font-size:14px;line-height:1.6}
39
+ .nib-page :focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
40
+ .nib-scroll{flex:1;min-height:0;overflow:auto;scrollbar-gutter:stable;--dsh-scrollbar-width:9px;--dsh-scrollbar-thumb-border:2px}
41
+ .nib-content{max-width:960px;margin:0 auto;padding:0 clamp(24px,4vw,48px) 48px}
42
+ .nib-heading{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;padding-top:28px;margin-bottom:4px}
43
+ [data-platform=darwin] .nib-heading{padding-top:calc(28px + var(--dsh-frame-top-clearance,0px))}
44
+ .nib-heading h1{flex:0 1 auto;min-width:0;margin:0;font-size:20px;line-height:28px;font-weight:500}
45
+ .nib-tools{display:flex;align-items:center;gap:8px}
46
+ .nib-said{margin:0;font-size:15px;line-height:24px;overflow-wrap:anywhere}
47
+ .nib-status{display:flex;flex-wrap:wrap;align-items:center;gap:0 16px;min-width:0;margin:2px 0 16px;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:21px}
48
+ .nib-counts>*+*::before{content:'·';padding:0 6px}
49
+ .nib-counts b{font-weight:500;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}
50
+ .nib-counts b[data-group=needs-you]{color:var(--dsw-alias-state-business-primary)}
51
+ .nib-filters{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}
52
+ .nib-n{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary)}
53
+ .nib-group{display:flex;flex-direction:column;gap:4px;margin-bottom:24px}
54
+ .nib-groupHead{display:flex;align-items:baseline;gap:8px;padding:0 8px}
55
+ .nib-groupHead h2{margin:0;font-size:14px;line-height:22px;font-weight:500}
44
56
  .nib-list{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}
45
- .nib-item{border-radius:12px;padding:10px 12px;position:relative}
46
- .nib-item.nib-open{background:var(--dsw-alias-bg-layer-1,var(--dsw-alias-interactive-bg-hover))}
47
- .nib-line{display:flex;align-items:flex-start;gap:4px}
48
- .nib-mark{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:-3px -6px -3px 0;border:none;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer}
49
- @media (hover:hover){.nib-mark:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}}
50
- .nib-row{display:flex;gap:10px;align-items:flex-start;width:100%;border:none;background:transparent;color:inherit;font:inherit;text-align:left;padding:0;cursor:pointer}
51
- .nib-dot{flex:none;width:8px;height:8px;border-radius:50%;margin-top:8px;background:transparent}
52
- .nib-unread .nib-dot{background:var(--dsw-alias-state-business-primary)}
53
- .nib-unread.nib-urgent .nib-dot{background:var(--dsw-alias-state-error-primary)}
57
+ .nib-item{border-radius:12px;padding:8px}
58
+ .nib-item.nib-open{background:var(--dsw-alias-bg-layer-1)}
59
+ @media (hover:hover){.nib-item:not(.nib-open):hover{background:var(--dsw-alias-interactive-bg-hover)}}
60
+ .nib-line{display:flex;gap:12px;align-items:flex-start}
54
61
  .nib-main{flex:1;min-width:0}
55
- .nib-titleLine{display:flex;align-items:baseline;gap:8px;min-width:0}
56
- .nib-title{flex:1;min-width:0;font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary)}
57
- .nib-unread .nib-title{font-weight:600;color:var(--dsw-alias-label-primary)}
58
- .nib-open .nib-title{white-space:normal;overflow-wrap:anywhere}
59
- .nib-time{flex:none;color:var(--dsw-alias-label-caption);font-size:12px}
60
- .nib-spoken{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:20px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow-wrap:anywhere}
61
- .nib-chip{display:inline-block;flex:none;padding:0 6px;border-radius:6px;font-size:11px;line-height:18px;font-weight:500;color:var(--dsw-alias-state-error-primary);box-shadow:inset 0 0 0 .5px currentColor}
62
- .nib-chip.nib-muted{color:var(--dsw-alias-label-tertiary);font-weight:400;max-width:45%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
63
- .nib-body{margin:8px 0 0 18px;display:flex;flex-direction:column;gap:10px}
64
- .nib-text{white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:22px}
62
+ .nib-head{display:block;width:100%;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}
63
+ .nib-titleLine{display:flex;align-items:flex-start;gap:8px;min-width:0;padding-top:4px}
64
+ .nib-titleLine>.uk-newDot{margin-top:8px}
65
+ .nib-title{flex:1;min-width:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:23px;overflow-wrap:anywhere;color:var(--dsw-alias-label-secondary)}
66
+ .nib-unread .nib-title,.nib-group[data-group=needs-you] .nib-title,.nib-group[data-group=live] .nib-title{font-weight:500;color:var(--dsw-alias-label-primary)}
67
+ .nib-open .nib-title{-webkit-line-clamp:unset}
68
+ .nib-when{flex:none;display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:23px;color:var(--dsw-alias-label-caption)}
69
+ .nib-sub{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:13px;line-height:21px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}
70
+ .nib-done{display:flex;gap:6px;align-items:flex-start;font-size:13px;line-height:21px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}
71
+ .nib-done svg{flex:none;margin-top:3px;color:var(--dsw-alias-state-success-primary)}
72
+ .nib-progress{margin-top:8px;max-width:560px}
73
+ .nib-body{display:flex;flex-direction:column;gap:12px;margin-top:10px}
74
+ .nib-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:22px}
65
75
  .nib-links{display:flex;flex-direction:column;gap:2px;font-size:13px}
66
- .nib-links a{color:var(--dsw-alias-state-business-primary);overflow-wrap:anywhere}
67
- .nib-meta{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}
68
- .nib-route{display:inline-flex;gap:3px;margin-right:10px}
76
+ .nib-links a{color:var(--dsw-alias-link,var(--dsw-alias-state-business-primary));overflow-wrap:anywhere}
77
+ .nib-actions{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
78
+ .nib-meta{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
69
79
  .nib-ok{color:var(--dsw-alias-state-success-primary)}
70
80
  .nib-bad{color:var(--dsw-alias-state-error-primary)}
71
- .nib-actions{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
72
- .nib-actions .nib-btn{height:32px;padding:0 12px}
73
- .nib-status{color:var(--dsw-alias-label-tertiary);font-size:12px}
74
- .nib-empty{color:var(--dsw-alias-label-tertiary);padding:24px 12px}
75
- .nib-error{color:var(--dsw-alias-state-error-primary);padding:12px}
76
- .nib-more{margin:12px auto 0;display:flex}
77
- .nib-icon{position:relative;display:inline-flex}
81
+ .nib-empty{padding:48px 20px;text-align:center;color:var(--dsw-alias-label-tertiary)}
82
+ .nib-error{color:var(--dsw-alias-state-error-primary)}
83
+ .nib-more{display:flex;justify-content:center}
78
84
  .nib-badge{position:absolute;top:-5px;right:-8px;min-width:14px;height:14px;padding:0 3px;box-sizing:border-box;border-radius:7px;background:var(--dsw-alias-state-error-primary);color:#fff;font-size:9px;font-weight:600;line-height:14px;text-align:center;pointer-events:none}
79
- @media (width<=640px),(pointer:coarse){.nib-btn,.nib-tab,.nib-page .ua-btn{min-height:40px;min-width:40px}.nib-mark{width:40px;height:40px;margin:-10px -8px -10px 0}.nib-tab{padding-inline:14px}.nib-tabs{border-radius:12px}}
80
- @media (width<=640px){.nib-content{padding-inline:12px}.nib-head{padding-top:16px}.nib-body{margin-left:0}.nib-item{padding:10px 8px}}
85
+ .nib-bell{position:relative;display:inline-flex}
86
+ @media (width<=640px){.nib-content{padding-inline:12px}.nib-heading{padding-top:16px}.nib-item{padding:8px 6px}.nib-line{gap:10px}}
87
+ @media (width<=640px),(pointer:coarse){.nib-page button,.nib-page .ua-btn,.nib-page .ua-step{min-height:40px}.nib-page .nib-tools button,.nib-page .nib-mark{min-width:40px}.nib-filters button{padding-inline:14px}.nib-head{min-height:40px}}
81
88
  `
82
89
 
83
- // ---- shared state: the unread count and a version that bumps when anything changes ----
90
+ // ---- shared state: the counts and a version that bumps when anything changes ----
84
91
 
85
- const shared = { unread: 0, version: 0, pollSeconds: 30, linked: null, ui: null }
92
+ const shared = { unread: 0, version: 0, pollSeconds: 30, linked: null, ui: null, kit: null, summary: null }
86
93
  const listeners = new Set()
87
94
  const emit = () => { for (const listener of listeners) listener() }
88
95
  const subscribe = listener => { listeners.add(listener); return () => listeners.delete(listener) }
@@ -103,10 +110,11 @@ window.__ModuleLoader__.load({
103
110
  try {
104
111
  const summary = await call('summary')
105
112
  shared.pollSeconds = summary.pollSeconds || 30
106
- const key = `${summary.unread}|${summary.latest}|${summary.total}|${summary.handled}`
113
+ const key = JSON.stringify([summary.unread, summary.latest, summary.total, summary.groups, summary.line])
107
114
  if (key !== lastSummary) {
108
115
  lastSummary = key
109
116
  shared.unread = summary.unread
117
+ shared.summary = summary
110
118
  shared.version += 1
111
119
  emit()
112
120
  }
@@ -116,114 +124,106 @@ window.__ModuleLoader__.load({
116
124
  }
117
125
  const changed = () => { lastSummary = ''; refreshSummary() }
118
126
 
119
- // ---- time ----
120
-
121
- function relative(iso, t) {
122
- const seconds = (Date.parse(iso) - Date.now()) / 1000
123
- const format = new Intl.RelativeTimeFormat(t('time.locale'), { numeric: 'auto', style: 'short' })
124
- const abs = Math.abs(seconds)
125
- if (abs < 60) return format.format(Math.round(seconds), 'second')
126
- if (abs < 3600) return format.format(Math.round(seconds / 60), 'minute')
127
- if (abs < 86400) return format.format(Math.round(seconds / 3600), 'hour')
128
- if (abs < 86400 * 7) return format.format(Math.round(seconds / 86400), 'day')
129
- return new Date(iso).toLocaleDateString(t('time.locale'), { month: 'short', day: 'numeric' })
130
- }
131
127
  const absolute = (iso, t) => new Date(iso).toLocaleString(t('time.locale'), { dateStyle: 'medium', timeStyle: 'short' })
128
+ /** Text a person reads: a string, or a map from language tag to text. */
129
+ const said = (value, t) => (typeof value === 'string' ? value : value?.[t('time.locale').split('-')[0]] ?? Object.values(value ?? {})[0] ?? '')
132
130
 
133
- /** What happened to this item's latest press, in words, or null. */
134
- function pressStatus(item, t) {
135
- const press = item.presses[item.presses.length - 1]
136
- if (press === undefined) return null
137
- const handled = item.handled.find(row => row.press === press.press)
138
- if (handled !== undefined) {
139
- if (handled.result === 'snoozed' && handled.until) return t('press.snoozed', { time: absolute(handled.until, t) })
140
- if (handled.result === 'done') return t('press.done')
141
- return handled.result
142
- }
143
- return Date.now() - Date.parse(press.at) < PENDING_MS ? t('press.pending') : t('press.unhandled')
144
- }
145
-
146
- // ---- the buttons: @soffits/dsh-ui-actions (ctx.uiActions), shared with other plugin pages ----
147
-
148
- const OWNER = '@soffits/dsh-notify-inbox'
131
+ // ---- the buttons ----
149
132
 
150
133
  /** The server's view of each button's last press: pending, done or unhandled. */
151
134
  function pressStates(item) {
152
135
  const states = {}
153
136
  for (const press of item.presses) {
154
- const action = item.actions.find(row => row.kind === press.action) ?? { id: press.action }
155
- const handled = item.handled.some(row => row.press === press.press)
137
+ const action = item.actions.find(row => row.id === press.id) ?? item.actions.find(row => row.kind === press.action) ?? { id: press.action }
138
+ const handled = item.outcomes.some(row => row.press === press.press)
156
139
  states[action.id] = handled ? 'done' : Date.now() - Date.parse(press.at) < PENDING_MS ? 'pending' : 'unhandled'
157
140
  }
158
141
  return states
159
142
  }
160
143
 
161
- function Actions({ item, t, ui, onMark }) {
162
- const markUnread = item.read && h('button', { type: 'button', className: 'nib-btn', onClick: () => onMark(item, false) }, t('markUnread'))
163
- if (ui === null) return markUnread ? h('div', { className: 'nib-actions' }, markUnread) : null
164
- // What "Ask" attaches to the conversation: the notification as a card, its ids for the agent.
165
- const about = {
166
- source: OWNER,
167
- title: item.title || item.spoken || item.text,
168
- lines: [item.title && item.spoken !== item.title ? item.spoken : '', ...(item.text || '').split('\n'), ...item.links].filter(line => line && line !== item.title),
169
- context: { notification: item.id, time: item.time, lane: item.lane, domain: item.domain || undefined },
170
- }
171
- const onPress = async (action, extra) => {
172
- await call('action', { record: item.id, action: action.id, ...(extra?.until ? { until: extra.until } : {}) })
173
- changed()
144
+ /** What happened to the latest press, in words, or null. */
145
+ function pressStatus(item, t) {
146
+ const press = item.presses[item.presses.length - 1]
147
+ if (press === undefined || press.action === 'step') return null
148
+ const outcome = item.outcomes.find(row => row.press === press.press)
149
+ if (outcome !== undefined) {
150
+ if (outcome.result === 'snoozed' && outcome.until) return t('press.snoozed', { time: absolute(outcome.until, t) })
151
+ if (outcome.result === 'done') return t('press.done')
152
+ return outcome.result
174
153
  }
175
- const status = pressStatus(item, t)
176
- return h('div', { className: 'nib-actions' }, h(ui.ActionBar, { actions: item.actions, states: pressStates(item), about, defaultChat: true, onPress }),
177
- markUnread,
178
- status && h('span', { className: 'nib-status' }, status))
154
+ return Date.now() - Date.parse(press.at) < PENDING_MS ? t('press.pending') : t('press.unhandled')
179
155
  }
180
156
 
181
- // ---- one notification ----
157
+ /** What "Ask" and a step attach to the conversation: the notification as a card. */
158
+ const aboutOf = item => ({
159
+ source: OWNER,
160
+ title: item.title || item.spoken || item.text,
161
+ lines: [item.title && item.spoken !== item.title ? item.spoken : '', ...(item.text || '').split('\n'), ...item.links].filter(line => line && line !== item.title),
162
+ context: { notification: item.id, time: item.time, lane: item.lane, domain: item.domain || undefined, thread: item.thread || undefined },
163
+ })
182
164
 
183
- function MarkUnreadIcon() {
184
- return h('svg', { width: 16, height: 16, viewBox: '0 0 16 16', fill: 'none', stroke: 'currentColor', strokeWidth: 1.3, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true, focusable: 'false' },
185
- h('path', { d: 'M9.5 3.5H3A1.5 1.5 0 0 0 1.5 5v6.5A1.5 1.5 0 0 0 3 13h9a1.5 1.5 0 0 0 1.5-1.5V8' }),
186
- h('path', { d: 'M1.8 4.6 7.5 8.6l2.3-1.6' }),
187
- h('circle', { cx: 12.5, cy: 3.5, r: 2, fill: 'currentColor', stroke: 'none' }))
188
- }
165
+ // ---- one item ----
189
166
 
190
- function Item({ item, t, open, onToggle, onMark, ui }) {
191
- const urgent = item.lane === 'interrupt'
192
- const className = ['nib-item', item.read ? '' : 'nib-unread', urgent ? 'nib-urgent' : '', open ? 'nib-open' : ''].filter(Boolean).join(' ')
167
+ function Item({ item, group, kit, ui, t, domains, open, onToggle, onMark }) {
168
+ const wash = kit.useWash(item.id, item.key)
169
+ const domain = domains[item.domain] ?? {}
170
+ const tone = domain.tone ?? (group === 'needs-you' && item.lane === 'interrupt' ? 'bad' : GROUP_TONE[group])
193
171
  const title = item.title || item.spoken || item.text.slice(0, 80)
194
172
  const sub = item.spoken && item.spoken !== title ? item.spoken : item.text !== title ? item.text : ''
195
- return h('li', { className, id: `nib-${item.id}` },
173
+ const doneText = item.handled?.text ?? (item.moved === 'done' ? t('moved.done') : null)
174
+ const status = item.moved === 'snoozed' ? pressStatus(item, t) : item.moved === 'ended' ? t('moved.ended') : null
175
+ const history = !item.liveNow && item.history.length > 0 && item.history.map(row => ({ at: row.time, text: said(row.spoken, t) || said(row.title, t) }))
176
+ const onPress = async (action, extra) => {
177
+ await call('action', { record: item.id, action: action.id, ...(extra?.until ? { until: extra.until } : {}) })
178
+ changed()
179
+ }
180
+ const className = ['nib-item', item.read ? '' : 'nib-unread', open ? 'nib-open' : '', wash].filter(Boolean).join(' ')
181
+ return h('li', { className, id: `nib-${item.key}` },
196
182
  h('div', { className: 'nib-line' },
197
- h('button', { type: 'button', className: 'nib-row', 'aria-expanded': open, onClick: () => onToggle(item) },
198
- h('span', { className: 'nib-dot', 'aria-hidden': true }),
199
- h('span', { className: 'nib-main' },
200
- h('span', { className: 'nib-titleLine' },
201
- urgent && h('span', { className: 'nib-chip' }, t('urgent')),
202
- item.test && h('span', { className: 'nib-chip nib-muted' }, t('test')),
203
- h('span', { className: 'nib-title' }, title),
204
- !open && item.presses.length > 0 && h('span', { className: 'nib-chip nib-muted' }, pressStatus(item, t)),
205
- h('span', { className: 'nib-time', title: absolute(item.time, t) }, relative(item.time, t))),
206
- !open && sub && h('span', { className: 'nib-spoken' }, sub))),
207
- item.read && !open && h('button', { type: 'button', className: 'nib-mark', title: t('markUnread'), 'aria-label': t('markUnread'), onClick: () => onMark(item, false) }, h(MarkUnreadIcon))),
208
- open && h('div', { className: 'nib-body' },
209
- item.text && item.text !== title && h('div', { className: 'nib-text' }, item.text),
210
- item.links.length > 0 && h('div', { className: 'nib-links' },
211
- item.links.map(link => h('a', { key: link, href: link, target: '_blank', rel: 'noopener noreferrer' }, link))),
212
- item.files.length > 0 && h('div', { className: 'nib-links' },
213
- h('span', { className: 'nib-meta' }, t('files')),
214
- item.files.map(file => file.stored
215
- ? h('a', { key: file.name, href: api(`file?id=${encodeURIComponent(item.id)}&name=${encodeURIComponent(file.name)}`), target: '_blank', rel: 'noopener' }, file.name)
216
- : h('span', { key: file.name, className: 'nib-meta' }, `${file.name} (${t('notStored', { reason: file.reason || '?' })})`))),
217
- h(Actions, { item, t, ui, onMark }),
218
- h('div', { className: 'nib-meta' },
219
- item.routed.length === 0 ? t('notSent') : h(React.Fragment, null, `${t('alsoSent')}: `,
220
- item.routed.map(row => h('span', { key: row.destination, className: 'nib-route', title: row.detail || '' },
221
- row.destination, h('span', { className: row.ok ? 'nib-ok' : 'nib-bad' }, row.ok ? '✓' : '✗'),
222
- !row.ok && row.detail ? ` ${row.detail}` : ''))),
223
- ` · ${absolute(item.time, t)}`)))
183
+ h(kit.Tile, { icon: domain.icon ?? GROUP_ICON[group], tone, size: 32 }),
184
+ h('div', { className: 'nib-main' },
185
+ h('button', { type: 'button', className: 'nib-head', 'aria-expanded': open, onClick: () => onToggle(item) },
186
+ h('span', { className: 'nib-titleLine' },
187
+ !item.read && h(kit.NewDot),
188
+ h('span', { className: 'nib-title' }, title),
189
+ h('span', { className: 'nib-when' },
190
+ item.liveNow && h(StateDot, { state: 'done' }),
191
+ h(kit.TimeAgo, { at: item.time }))),
192
+ !open && group !== 'handled' && sub && h('span', { className: 'nib-sub' }, status ? `${sub} · ${status}` : sub)),
193
+ doneText && h('div', { className: 'nib-done' }, h(IconCheckCircleOutlineRegular, { size: 14 }), h('span', null, doneText)),
194
+ item.liveNow && item.live?.progress && h('div', { className: 'nib-progress' },
195
+ h(kit.Progress, { from: item.live.progress.from, to: item.live.progress.to, end: h(kit.TimeUntil, { to: item.live.progress.to }) })),
196
+ history && h(kit.History, { items: history, max: 2 }),
197
+ open && h(Details, { item, kit, ui, t, onPress, onMark }))))
198
+ }
199
+
200
+ function Details({ item, kit, ui, t, onPress, onMark }) {
201
+ const status = pressStatus(item, t)
202
+ const about = aboutOf(item)
203
+ const states = pressStates(item)
204
+ return h('div', { className: 'nib-body' },
205
+ item.text && item.text !== item.title && h('div', { className: 'nib-text' }, item.text),
206
+ item.links.length > 0 && h('div', { className: 'nib-links' },
207
+ item.links.map(link => h('a', { key: link, href: link, target: '_blank', rel: 'noopener noreferrer' }, link))),
208
+ item.files.length > 0 && h('div', { className: 'nib-links' },
209
+ h('span', { className: 'nib-meta' }, t('files')),
210
+ item.files.map(file => file.stored
211
+ ? h('a', { key: file.name, href: api(`file?id=${encodeURIComponent(item.id)}&name=${encodeURIComponent(file.name)}`), target: '_blank', rel: 'noopener' }, file.name)
212
+ : h('span', { key: file.name, className: 'nib-meta' }, `${file.name} (${t('notStored', { reason: file.reason || '?' })})`))),
213
+ h('div', { className: 'nib-actions' },
214
+ ui !== null && h(ui.ActionBar, { actions: item.actions, states, about, defaultChat: true, part: 'buttons', onPress }),
215
+ item.read && h(Button, { variant: 'outline', size: 'sm', onClick: () => onMark(item, false) }, t('markUnread')),
216
+ status && h('span', { className: 'nib-meta' }, status)),
217
+ h(kit.Suggested, { actions: item.actions, about, states, onPress }),
218
+ h('div', { className: 'nib-meta' },
219
+ item.routed.length === 0 ? t('notSent') : h(React.Fragment, null, `${t('alsoSent')}: `,
220
+ item.routed.map((row, i) => h(React.Fragment, { key: row.destination },
221
+ i > 0 && ', ',
222
+ h('span', { title: row.detail || '' }, row.destination, ' ', h('span', { className: row.ok ? 'nib-ok' : 'nib-bad' }, row.ok ? '✓' : '✗'))))),
223
+ ` · ${absolute(item.time, t)}`))
224
224
  }
225
225
 
226
- // ---- push on this device ----
226
+ // ---- push on this device: items of the page's "more" menu ----
227
227
 
228
228
  const pushSupported = () => typeof navigator !== 'undefined' && 'serviceWorker' in navigator && typeof window.PushManager === 'function' && typeof window.Notification === 'function'
229
229
  const isIos = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)
@@ -238,43 +238,34 @@ window.__ModuleLoader__.load({
238
238
  const browser = /Edg\//.test(ua) ? 'Edge' : /Firefox\//.test(ua) ? 'Firefox' : /Chrome\//.test(ua) ? 'Chrome' : /Safari\//.test(ua) ? 'Safari' : 'Browser'
239
239
  return [browser, os].filter(Boolean).join(' · ')
240
240
  }
241
-
242
241
  async function currentSubscription() {
243
242
  const registration = await navigator.serviceWorker.getRegistration(api(''))
244
243
  return (await registration?.pushManager.getSubscription()) ?? null
245
244
  }
246
245
 
247
- function PushControl({ t }) {
246
+ /** This browser's push state and the steps to change it. */
247
+ function usePush(t) {
248
248
  const supported = pushSupported()
249
- const [state, setState] = useState('checking')
249
+ const [state, setState] = useState(supported ? 'checking' : 'unsupported')
250
250
  const [note, setNote] = useState(null)
251
- const [busy, setBusy] = useState(false)
252
251
  useEffect(() => {
253
- if (!supported) return
252
+ if (!supported) return undefined
254
253
  let live = true
255
254
  currentSubscription()
256
255
  .then(async sub => (sub === null ? false : (await call('push/state', { endpoint: sub.endpoint })).subscribed))
257
256
  .then(on => { if (live) setState(on ? 'on' : 'off') }, () => { if (live) setState('off') })
258
257
  return () => { live = false }
259
258
  }, [supported])
260
- if (!supported) {
261
- return h('div', { className: 'nib-push' }, h('span', { className: 'nib-grow' }, h('strong', null, t('push.title'))),
262
- h('span', { className: 'nib-hint' }, isIos() && !standalone() ? t('push.ios') : t('push.unsupported')))
263
- }
264
259
  const run = task => async () => {
265
- setBusy(true)
266
260
  setNote(null)
267
261
  try {
268
262
  await task()
269
263
  } catch (reason) {
270
264
  setNote(reason.message)
271
- } finally {
272
- setBusy(false)
273
265
  }
274
266
  }
275
267
  const enable = run(async () => {
276
- const permission = await Notification.requestPermission()
277
- if (permission !== 'granted') {
268
+ if (await Notification.requestPermission() !== 'granted') {
278
269
  setNote(t('push.denied'))
279
270
  return
280
271
  }
@@ -301,102 +292,171 @@ window.__ModuleLoader__.load({
301
292
  const result = await call('push/test', { title: t('push.testTitle'), body: t('push.testBody') })
302
293
  setNote(t('push.testSent', { n: result.sent }))
303
294
  })
304
- return h('div', { className: 'nib-push' },
305
- h('span', { className: 'nib-grow' }, h('strong', null, t('push.title')), ' · ', state === 'on' ? t('push.on') : state === 'off' ? t('push.off') : '…'),
306
- state === 'on' && h('button', { type: 'button', className: 'nib-btn', disabled: busy, onClick: test }, t('push.test')),
307
- state === 'on' && h('button', { type: 'button', className: 'nib-btn', disabled: busy, onClick: disable }, t('push.disable')),
308
- state === 'off' && h('button', { type: 'button', className: 'nib-btn nib-primary', disabled: busy, onClick: enable }, t('push.enable')),
309
- note && h('span', { className: 'nib-hint' }, note))
295
+ const explain = state === 'unsupported' ? t(isIos() && !standalone() ? 'push.ios' : 'push.unsupported') : null
296
+ return { state, note: note ?? explain, enable, disable, test }
297
+ }
298
+
299
+ function MoreMenu({ t }) {
300
+ const push = usePush(t)
301
+ const [open, setOpen] = useState(false)
302
+ const items = [
303
+ { type: 'label', id: 'push', text: `${t('push.title')} · ${t(`push.${push.state === 'on' ? 'on' : push.state === 'off' ? 'off' : 'unavailable'}`)}` },
304
+ ...(push.state === 'off' ? [{ id: 'enable', label: t('push.enable') }] : []),
305
+ ...(push.state === 'on' ? [{ id: 'test', label: t('push.test') }, { id: 'disable', label: t('push.disable') }] : []),
306
+ ]
307
+ const pick = id => {
308
+ setOpen(false)
309
+ if (id === 'enable') push.enable()
310
+ else if (id === 'disable') push.disable()
311
+ else if (id === 'test') push.test()
312
+ }
313
+ return h(React.Fragment, null,
314
+ push.note && h('span', { className: 'nib-meta', role: 'status' }, push.note),
315
+ h(Menu, {
316
+ open,
317
+ onClose: () => setOpen(false),
318
+ align: 'end',
319
+ portal: true,
320
+ items,
321
+ onSelect: pick,
322
+ anchor: h(Tooltip, { label: t('more'), side: 'bottom', portal: true, disabled: open },
323
+ h(Button, { variant: 'outline', size: 'sm', 'aria-label': t('more'), 'aria-haspopup': 'menu', 'aria-expanded': open, onClick: () => setOpen(value => !value) },
324
+ h(IconEllipsisOutlineRegular, null))),
325
+ }))
310
326
  }
311
327
 
312
328
  // ---- the page ----
313
329
 
314
330
  function InboxPage({ translate: t }) {
331
+ const kit = useShared(s => s.kit)
332
+ if (kit === null) return h('div', { className: 'nib-page' }, h('p', { className: 'nib-empty' }, t('kitMissing')))
333
+ return h(Inbox, { t, kit })
334
+ }
335
+
336
+ function Inbox({ t, kit }) {
315
337
  const version = useShared(s => s.version)
316
338
  const unread = useShared(s => s.unread)
339
+ const summary = useShared(s => s.summary)
317
340
  const linked = useShared(s => s.linked)
318
- const [filter, setFilter] = useState(() => (shared.linked ? 'all' : 'unread'))
341
+ const ui = useShared(s => s.ui)
342
+ const [view, setView] = useState('all')
319
343
  const [items, setItems] = useState(null)
320
344
  const [more, setMore] = useState(false)
321
345
  const [error, setError] = useState(null)
322
346
  const [open, setOpen] = useState(() => shared.linked)
323
- // Rows shown under Unread during this visit stay on screen as they turn read, done or snoozed,
324
- // so the list never moves under the person's finger; leaving the view (or tapping its tab again) lets them go.
325
- const shown = useRef(new Set())
347
+ // Items shown in this view stay where they first showed (their group, and in "Needs you" at all)
348
+ // as they turn read, done or snoozed, so nothing moves under the person's finger; leaving the
349
+ // view (or tapping its filter again) lets them go.
350
+ const placed = useRef(new Map())
326
351
  const [visit, setVisit] = useState(0)
327
- const ui = useShared(s => s.ui)
352
+ /** Remember where items first showed: the page's first items in order, later arrivals on top, older pages below. */
353
+ const place = (rows, append) => {
354
+ const ranks = [...placed.current.values()].map(spot => spot.rank)
355
+ let top = Math.min(0, ...ranks)
356
+ let bottom = Math.max(-1, ...ranks)
357
+ const fresh = placed.current.size === 0 || append
358
+ for (const row of fresh ? rows : [...rows].reverse()) {
359
+ if (placed.current.has(row.key)) continue
360
+ placed.current.set(row.key, { group: row.group, rank: fresh ? ++bottom : --top })
361
+ }
362
+ }
363
+ const stream = kit.useEventStream('api/notify-inbox/events', changed)
328
364
 
329
- const load = useCallback(async (append) => {
365
+ const load = useCallback(async append => {
330
366
  try {
331
367
  const params = new URLSearchParams()
332
- if (filter === 'unread') {
333
- params.set('unread', '1')
334
- if (shown.current.size > 0) params.set('keep', [...shown.current].join(','))
368
+ if (view === 'needs-you') {
369
+ params.set('view', 'needs-you')
370
+ if (placed.current.size > 0) params.set('keep', [...placed.current.keys()].join(','))
335
371
  }
336
- if (append && items?.length) params.set('before', items[items.length - 1].id)
372
+ if (append && items?.length) params.set('before', items[items.length - 1].key)
337
373
  const page = await call(`items?${params}`)
338
- if (filter === 'unread') for (const row of page.items) shown.current.add(row.id)
374
+ place(page.items, append)
339
375
  setItems(previous => (append && previous ? [...previous, ...page.items] : page.items))
340
376
  setMore(page.more)
341
377
  setError(null)
342
378
  } catch (reason) {
343
379
  setError(reason.message)
344
380
  }
345
- }, [filter, items])
381
+ }, [view, items])
346
382
 
347
- useEffect(() => { load(false) }, [filter, version, visit])
383
+ useEffect(() => { load(false) }, [view, version, visit])
348
384
  const showView = key => {
349
- shown.current = new Set()
350
- if (key === filter) setVisit(n => n + 1)
351
- else setFilter(key)
385
+ placed.current = new Map()
386
+ if (key === view) setVisit(n => n + 1)
387
+ else setView(key)
352
388
  }
353
389
  useEffect(() => {
354
390
  if (!linked) return
355
391
  showView('all')
356
392
  setOpen(linked)
357
393
  shared.linked = null
358
- call('read', { ids: [linked] }).then(changed, () => {})
359
- setTimeout(() => document.getElementById(`nib-${linked}`)?.scrollIntoView({ block: 'center' }), 300)
394
+ call('items').then(page => {
395
+ const item = page.items.find(row => row.ids.includes(linked) || row.key === linked)
396
+ if (item === undefined) return
397
+ setOpen(item.key)
398
+ call('read', { ids: item.ids }).then(changed, () => {})
399
+ setTimeout(() => document.getElementById(`nib-${item.key}`)?.scrollIntoView({ block: 'center' }), 300)
400
+ }, () => {})
360
401
  }, [linked])
361
402
 
362
403
  const mark = (item, read) => {
363
- setItems(list => list.map(row => (row.id === item.id ? { ...row, read } : row)))
364
- call('read', { ids: [item.id], read }).then(changed, reason => setError(reason.message))
404
+ setItems(list => list.map(row => (row.key === item.key ? { ...row, read } : row)))
405
+ call('read', { ids: read ? item.ids : [item.id], read }).then(changed, reason => setError(reason.message))
365
406
  }
366
407
  const toggle = item => {
367
- const next = open === item.id ? null : item.id
408
+ const next = open === item.key ? null : item.key
368
409
  setOpen(next)
369
410
  if (next !== null && !item.read) mark(item, true)
370
411
  }
371
412
  const markAll = () => call('read', { all: true }).then(changed, reason => setError(reason.message))
372
413
 
414
+ const groups = summary?.groups ?? {}
415
+ const domains = summary?.domains ?? {}
416
+ const total = summary?.total ?? 0
417
+ const byGroup = new Map(GROUPS.map(group => [group, []]))
418
+ for (const item of items ?? []) byGroup.get(placed.current.get(item.key)?.group ?? item.group)?.push(item)
419
+ const rank = item => placed.current.get(item.key)?.rank ?? 0
420
+ for (const list of byGroup.values()) list.sort((a, b) => rank(a) - rank(b))
421
+ const filters = [['needs-you', t('group.needs-you'), groups['needs-you'] ?? 0], ['all', t('filter.all'), total]]
422
+
373
423
  return h('div', { className: 'nib-page' },
374
424
  h('div', { className: 'nib-scroll' },
375
425
  h('div', { className: 'nib-content' },
376
- h('div', { className: 'nib-head' },
377
- h('h1', null, t('title'), unread > 0 && h('span', { className: 'nib-count' }, unread)),
378
- h('div', { className: 'nib-tabs', role: 'group' },
379
- ['unread', 'all'].map(key => h('button', { key, type: 'button', className: 'nib-tab', 'aria-pressed': filter === key, onClick: () => showView(key) }, t(`filter.${key}`)))),
380
- h('button', { type: 'button', className: 'nib-btn', disabled: unread === 0, onClick: markAll }, t('markAll'))),
381
- h(PushControl, { t }),
426
+ h('div', { className: 'nib-heading' },
427
+ h('h1', null, t('title')),
428
+ h('div', { className: 'nib-tools' },
429
+ h(Button, { variant: 'outline', size: 'sm', disabled: unread === 0, onClick: markAll }, t('markAll')),
430
+ h(MoreMenu, { t }))),
431
+ summary?.line && h('p', { className: 'nib-said' }, said(summary.line.text, t)),
432
+ h('div', { className: 'nib-status' },
433
+ h(kit.LiveStatus, { status: stream, updatedAt: summary?.latest ?? undefined }),
434
+ total > 0 && h('span', { className: 'nib-counts' },
435
+ GROUPS.filter(group => (groups[group] ?? 0) > 0).map(group => h('span', { key: group }, `${t(`group.${group}`)} `, h('b', { 'data-group': group }, groups[group]))))),
436
+ h('div', { className: 'nib-filters', role: 'group', 'aria-label': t('filter.label') },
437
+ filters.map(([key, label, n]) => h(Pill, { key, active: view === key, 'aria-pressed': view === key, onClick: () => showView(key) },
438
+ label, n > 0 && h('span', { className: 'nib-n' }, n)))),
382
439
  error && h('p', { className: 'nib-error', role: 'alert' }, t('error', { message: error })),
383
- items !== null && items.length === 0 && h('p', { className: 'nib-empty' }, t(filter === 'unread' ? 'empty.unread' : 'empty.all')),
384
- items !== null && h('ul', { className: 'nib-list' },
385
- items.map(item => h(Item, { key: item.id, item, t, open: open === item.id, onToggle: toggle, onMark: mark, ui }))),
386
- more && h('button', { type: 'button', className: 'nib-btn nib-more', onClick: () => load(true) }, t('loadMore')))))
440
+ items !== null && items.length === 0 && h('p', { className: 'nib-empty' }, t(`empty.${view}`)),
441
+ GROUPS.map(group => byGroup.get(group).length > 0 && h('section', { key: group, className: 'nib-group', 'data-group': group, 'aria-label': t(`group.${group}`) },
442
+ h('div', { className: 'nib-groupHead' },
443
+ h('h2', null, t(`group.${group}`)),
444
+ h('span', { className: 'nib-n' }, byGroup.get(group).length)),
445
+ h('ul', { className: 'nib-list' },
446
+ byGroup.get(group).map(item => h(Item, { key: item.key, item, group, kit, ui, t, domains, open: open === item.key, onToggle: toggle, onMark: mark }))))),
447
+ more && h('div', { className: 'nib-more' }, h(Button, { variant: 'outline', size: 'sm', onClick: () => load(true) }, t('loadMore'))))))
387
448
  }
388
449
 
389
- function BellIcon({ size }) {
390
- const stroke = { stroke: 'currentColor', strokeWidth: 1.2, strokeLinecap: 'round', strokeLinejoin: 'round' }
391
- return h('svg', { width: size, height: size, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': true, focusable: 'false' },
392
- h('path', { d: 'M8 2.2c-2.3 0-3.9 1.8-3.9 4v2.3L3 10.4c-.2.4.1.9.5.9h9c.4 0 .7-.5.5-.9l-1.1-1.9V6.2c0-2.2-1.6-4-3.9-4Z', ...stroke }),
393
- h('path', { d: 'M6.5 13.2c.3.7.9 1.1 1.5 1.1s1.2-.4 1.5-1.1', ...stroke }))
450
+ /** The bell, from the kit's icons (DSH has none). */
451
+ function BellGlyph({ size }) {
452
+ const kit = useShared(s => s.kit)
453
+ return kit === null ? null : h(kit.Icon, { name: 'bell', size })
394
454
  }
395
455
 
396
456
  function SidebarIcon({ size }) {
397
457
  const unread = useShared(s => s.unread)
398
- return h('span', { className: 'nib-icon' },
399
- h(BellIcon, { size }),
458
+ return h('span', { className: 'nib-bell' },
459
+ h(BellGlyph, { size }),
400
460
  unread > 0 && h('span', { className: 'nib-badge' }, unread > 99 ? '99+' : String(unread)))
401
461
  }
402
462
 
@@ -424,12 +484,21 @@ window.__ModuleLoader__.load({
424
484
  return () => tag.remove()
425
485
  }, 'notify-inbox: styles')
426
486
 
487
+ // Shared pieces DSH doesn't have (tiles, time, live status, history): @soffits/dsh-ui-kit.
488
+ ctx.inject(['uiKit'], scope => {
489
+ scope.effect(() => {
490
+ shared.kit = scope.uiKit
491
+ emit()
492
+ return () => { shared.kit = null; emit() }
493
+ }, 'notify-inbox: kit')
494
+ })
495
+
427
496
  // The buttons, when @soffits/dsh-ui-actions is installed; without it the page shows no buttons.
428
497
  ctx.inject(['uiActions'], scope => {
429
498
  scope.effect(() => {
430
499
  shared.ui = scope.uiActions
431
500
  emit()
432
- const unregister = scope.uiActions.registerSource({ id: OWNER, name: () => t('panel'), icon: BellIcon })
501
+ const unregister = scope.uiActions.registerSource({ id: OWNER, name: () => t('panel'), icon: BellGlyph })
433
502
  return () => { unregister(); shared.ui = null; emit() }
434
503
  }, 'notify-inbox: buttons')
435
504
  })
@@ -448,7 +517,8 @@ window.__ModuleLoader__.load({
448
517
  label: () => t('panel'),
449
518
  }, SidebarIcon))
450
519
 
451
- // The unread count: checked while the page is visible, and right away when it becomes visible.
520
+ // The counts: checked while the page is visible, right away when it becomes visible, and at
521
+ // once when the events stream says something changed.
452
522
  ctx.effect(() => {
453
523
  let timer
454
524
  const tick = () => {
@@ -460,7 +530,7 @@ window.__ModuleLoader__.load({
460
530
  document.addEventListener('visibilitychange', onVisible)
461
531
  tick()
462
532
  return () => { clearTimeout(timer); document.removeEventListener('visibilitychange', onVisible) }
463
- }, 'notify-inbox: unread count')
533
+ }, 'notify-inbox: counts')
464
534
 
465
535
  // ?notify-inbox=<id> (a tapped push, a shared link) opens the page on that notification.
466
536
  const openLinked = id => {