create-pmos 0.397.0 → 0.398.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.
Files changed (145) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. package/workspace/public/pm/premium.js +0 -1146
@@ -1,42 +1,46 @@
1
- /* pm/premium-chart-tab.js — the Chart tab beside a chat (initiative premium-reports-from-chat, slice C; PRD C1–C3). It replaces the Insight Studio's
2
- * Chart and Dashboard modes: the PM asks in the chat, Claude ends its answer with a `pmos-report` block of kind chart or dashboard
3
- * (public/pm/report-chat.js), and this tab draws it from the KR metric records, as the Insights page draws it (premium-chart-draw.js).
1
+ /* pm/premium-chart-tab.js — a chart or a dashboard from a chat, in the Viewer card (initiative premium-reports-from-chat, slice C; PRD C1–C3;
2
+ * re-drawn for premium-agreed-design, area viewer: Main.dc.html viewer "metrics"). The PM asks in the chat, Claude ends its answer with a
3
+ * `pmos-report` block of kind chart or dashboard (public/pm/report-chat.js), and this view draws it from the KR metric records.
4
4
  *
5
- * A CHART (block.kind 'chart'): the measure's chart as proposed, with its four forms to pick from. Save chart posts POST /api/premium-charts/save.
6
- * A saved chart (block.id) shows as saved; a change Claude proposes to it shows drawn, and Save the change posts the whole chart. Delete chart
7
- * asks once, then posts { id, remove: true }.
8
- * A DASHBOARD (block.kind 'dashboard'): its name, what it is for and its charts in order. Save dashboard posts POST /api/premium-dashboards/save;
9
- * Delete dashboard asks once, then posts { id, remove: true }. Pinning stays on the Insights page.
5
+ * A CHART (block.kind 'chart'): the design's metrics view: three stat tiles (now, since the last reading, the target), then the readings as a
6
+ * chart with the newest one in ember. Below it, the parts the design does not draw yet ("Waiting for design"): the four forms to pick from
7
+ * (Line, Bars, Number, Meter), Save chart (POST /api/premium-charts/save), and Delete chart, which asks once in the card ({ id, remove: true }).
8
+ * A saved chart (block.id) shows as saved; a change Claude proposes to it shows drawn, and Save the change posts the whole chart.
9
+ * A DASHBOARD (block.kind 'dashboard'): its charts in order as small tiles (a measure with fewer than two readings is named, not drawn), then
10
+ * Save dashboard (POST /api/premium-dashboards/save) and Delete dashboard, Waiting for design. Pinning stays on the Insights page.
10
11
  *
11
- * The model is GET /api/insights-premium (the board the page shows). Every value drawn is a reading of a record; a measure with fewer than two
12
- * readings is named, not drawn. Every write is a press here, behind the launch nonce (http.js pmPost). Claude writes nothing: the routes refuse an
13
- * agent session. Nothing is sent outward. */
12
+ * The model is GET /api/insights-premium (the board Insights shows). Every value drawn is a reading of a record. Every write is a press here,
13
+ * behind the launch nonce (http.js pmPost). Claude writes nothing: the routes refuse an agent session. Nothing is sent outward.
14
+ * The view draws in the czViewer card (cozy-viewer.js): no #dlg, no old tab, no premium.css. */
14
15
  import { pmGet, pmPost } from './http.js';
15
- import { vwOpen, vwStyle, vwConfirm } from './premium-viewer.js';
16
- import { tileHtml, deriveChart } from './premium-chart-draw.js';
16
+ import { open as vOpen, current as vCur, body as vBody } from './cozy-viewer.js';
17
+ import { vzStyle } from './premium-vw-open.js';
18
+ import { deriveChart, unitTxt } from './premium-chart-draw.js';
17
19
 
18
20
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
19
21
  const FORMS = [['line', 'Line'], ['bars', 'Bars'], ['number', 'Number'], ['meter', 'Meter']];
20
22
  const ws = () => new URLSearchParams(location.search).get('ws') || '';
21
23
  const post = (p, body) => pmPost(p, Object.assign(ws() ? { ws: ws() } : {}, body)).catch(() => null);
22
- const btn = (a, label, o = {}) => `<button type="button" class="btn${o.sec ? ' sec' : ''}${o.cls ? ' ' + o.cls : ''}" data-ct="${esc(a)}"${o.off ? ' disabled' : ''}${o.pressed != null ? ` aria-pressed="${o.pressed}"` : ''}>${esc(label)}</button>`;
24
+ const WAIT = (f) => `<span class="vz-wait" data-cz-placeholder="${esc(f)}">Waiting for design</span>`;
25
+ const btn = (a, label, o = {}) => `<button type="button" class="${o.sec ? 'vz-sec2' : 'vz-issue'} vz-hv${o.cls ? ' ' + o.cls : ''}" data-ct="${esc(a)}"${o.off ? ' disabled' : ''}>${esc(label)}</button>`;
23
26
 
24
- const T = new Map(); // tab id → its state
25
- /** Open (or refresh) the Chart tab for a checked chart or dashboard block (report-chat.js cleanBlock). */
27
+ const T = new Map(); // view id → its state
28
+ /** Open (or refresh) the view of a checked chart or dashboard block (report-chat.js cleanBlock). */
26
29
  export function openChartTab(block) {
27
30
  if (!block || (block.kind !== 'chart' && block.kind !== 'dashboard')) return null;
28
- vwStyle('report');
31
+ vzStyle();
29
32
  const P = block.proposal || {};
30
33
  const id = block.kind + ':' + String(block.id || P.measure || P.name || 'new').toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 60);
31
34
  let t = T.get(id);
32
35
  if (!t || JSON.stringify(t.block) !== JSON.stringify(block)) {
33
- t = { id, block, M: null, loaded: false, busy: false, msg: '', d: null, gone: false, removed: false };
36
+ t = { id, block, M: null, loaded: false, busy: false, msg: '', d: null, gone: false, removed: false, ask: null };
34
37
  T.set(id, t);
35
38
  load(t);
36
39
  }
37
- return vwOpen({ id, title: block.kind === 'chart' ? 'Chart' : 'Dashboard', icon: 'list', render: (el) => draw(t, el), wire: (el) => { el.onclick = (e) => press(t, e); } });
40
+ return vOpen({ id, kind: block.kind === 'chart' ? 'Chart' : 'Dashboard', title: titleOf(t), icon: 'chart', render: (el) => { el.onclick = (e) => press(t, e); draw(t, el); } });
38
41
  }
39
- const paneOf = (t) => document.querySelector(`#dOut .obody.vw[data-vw="${CSS.escape(t.id)}"]`);
42
+ const titleOf = (t) => { const P = t.block.proposal || {}, d = t.d || {}; return t.block.kind === 'chart' ? d.title || P.title || P.measure || t.block.id || 'Chart' : d.name || P.name || t.block.id || 'Dashboard'; };
43
+ const paneOf = (t) => (vCur() && vCur().id === t.id ? vBody() : null);
40
44
  const redraw = (t) => { const el = paneOf(t); if (el) draw(t, el); };
41
45
 
42
46
  async function load(t) {
@@ -59,18 +63,43 @@ async function load(t) {
59
63
  redraw(t);
60
64
  }
61
65
 
62
- /** A measure's or a saved chart's tile, as Insights draws it. */
63
- function chartOf(M, ref) {
64
- return (M.mine || []).find((c) => c.id === ref) || (M.charts || []).find((c) => c.id === ref) || null;
66
+ /* ── drawing (Main.dc.html viewer "metrics") ── */
67
+ const shortDay = (s) => String(s || '').replace(/^\d{4}-/, '').replace(/^(\d{2})-(\d{2}).*$/, (m, a, b) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+a - 1] + ' ' + +b);
68
+ const labelOf = (p) => shortDay(String(p.at || p.d || '').slice(0, 10)) || String(p.d || '');
69
+ /** The three stat tiles: the reading now, the step since the last one, and the target. */
70
+ function kpisHtml(c, d) {
71
+ const u = c.unit && /^[%°]/.test(c.unit) ? c.unit : c.unit ? ' ' + c.unit : '';
72
+ const step = c.step === 0 ? 'No change' : (c.step > 0 ? 'Up ' : 'Down ') + Math.abs(c.step) + u;
73
+ const K = [['Now', c.v, 'on ' + c.at], ['Since the last reading', step, c.good === null ? 'Same as before' : c.good ? 'The right way' : 'The wrong way'],
74
+ ['Target', c.target !== null ? unitTxt(c, c.target) : 'None set', d.better === 'lower' ? 'Lower is better' : 'Higher is better']];
75
+ return `<div class="vz-kpis">${K.map(([l, v, n]) => `<div class="vz-kpi"><p>${esc(l)}</p><b>${esc(v)}</b><small>${esc(n)}</small></div>`).join('')}</div>`;
65
76
  }
66
- function draftTile(t) {
67
- const d = t.d, base = (t.M.charts || []).find((c) => c.id === d.measure);
68
- if (!base) {
69
- const m = (t.M.measures || []).find((x) => x.id === d.measure);
70
- return `<p class="rt-msg">${esc(m ? m.title + ' has fewer than two readings, so it has no chart yet.' : 'No KR metric record is called ' + d.measure + ' in this workspace.')}</p>`;
77
+ /** The readings drawn in the picked form, the newest in ember. Bars and a meter start at zero; a value below zero is drawn as a line. */
78
+ function figHtml(c, form, cap) {
79
+ const pts = c.pts, n = pts.length, neg = pts.some((p) => p.v < 0) || (c.target !== null && c.target < 0);
80
+ const f = form === 'bars' && !neg ? 'bars' : form === 'meter' && !neg && c.target !== null ? 'meter' : form === 'number' ? 'number' : 'line';
81
+ const alt = `${c.title}: ${n} readings from ${pts[0].txt} on ${pts[0].d} to ${c.v} on ${c.at}${c.targetTxt ? ', ' + c.targetTxt : ''}`;
82
+ if (f === 'number') return `<figure class="vz-mx-fig" data-form="number"><figcaption>${esc(cap)}</figcaption><p class="vz-mx-big" role="img" aria-label="${esc(alt)}">${esc(c.v)}</p></figure>`;
83
+ const W = 440, H = 150, B = 128, top = 22;
84
+ const hi = Math.max(...pts.map((p) => p.v), c.target !== null ? c.target : 0) || 1;
85
+ if (f === 'meter') {
86
+ const v = pts[n - 1].v, mx = Math.max(v, c.target) * 1.15 || 1, x = (k) => (k / mx * W).toFixed(1);
87
+ return `<figure class="vz-mx-fig" data-form="meter"><figcaption>${esc(cap)}</figcaption><svg class="vz-mx-svg" viewBox="0 0 ${W} 44" role="img" aria-label="${esc(alt)}"><rect class="vz-trk0" x="0" y="14" width="${W}" height="14" rx="7"/><rect class="vz-bar now" x="0" y="14" width="${x(v)}" height="14" rx="7"/><line class="vz-tgt" x1="${x(c.target)}" x2="${x(c.target)}" y1="6" y2="36"/></svg><p class="vz-note">${esc(c.v)} against ${esc(c.targetTxt)}</p></figure>`;
71
88
  }
72
- const c = deriveChart(base, { title: d.title || base.title, form: d.form || 'line', range: d.range || null, target: d.target, better: d.better || 'higher', note: d.note || '' });
73
- return c ? `<div class="ntw ct-tile">${tileHtml(c)}</div>` : '<p class="rt-msg">The range holds fewer than two readings, so nothing is drawn.</p>';
89
+ const slot = W / n, bw = Math.min(36, slot * 0.6), yOf = (v) => B - (v / hi) * (B - top);
90
+ const ty = c.target !== null ? yOf(c.target) : null;
91
+ let g = `<line class="vz-ax" x1="0" x2="${W}" y1="${B}" y2="${B}"/>`;
92
+ if (f === 'bars') g += pts.map((p, i) => { const y = yOf(Math.max(0, p.v)); return `<text class="vz-bv" x="${(slot * i + slot / 2).toFixed(1)}" y="${(y - 6).toFixed(1)}">${esc(p.txt)}</text><rect class="vz-bar${i === n - 1 ? ' now' : ''}" x="${(slot * i + (slot - bw) / 2).toFixed(1)}" y="${y.toFixed(1)}" width="${bw.toFixed(1)}" height="${Math.max(1, B - y).toFixed(1)}" rx="6"/>`; }).join('');
93
+ else {
94
+ const lo = Math.min(...pts.map((p) => p.v), c.target !== null ? c.target : Infinity), rg = (hi - lo) || 1, yL = (v) => B - ((v - lo) / rg) * (B - top);
95
+ const P = pts.map((p, i) => [slot * i + slot / 2, yL(p.v)]);
96
+ g += `<polyline class="vz-ln" points="${P.map((q) => q[0].toFixed(1) + ',' + q[1].toFixed(1)).join(' ')}"/>` + P.map((q, i) => `<circle class="vz-pt${i === n - 1 ? ' now' : ''}" cx="${q[0].toFixed(1)}" cy="${q[1].toFixed(1)}" r="${i === n - 1 ? 6 : 4}"/><text class="vz-bv" x="${q[0].toFixed(1)}" y="${(q[1] - 10).toFixed(1)}">${esc(pts[i].txt)}</text>`).join('');
97
+ if (c.target !== null) g += `<line class="vz-tgt" x1="0" x2="${W}" y1="${yL(c.target).toFixed(1)}" y2="${yL(c.target).toFixed(1)}"/>`;
98
+ }
99
+ if (f === 'bars' && ty !== null) g += `<line class="vz-tgt" x1="0" x2="${W}" y1="${ty.toFixed(1)}" y2="${ty.toFixed(1)}"/>`;
100
+ g += pts.map((p, i) => `<text class="vz-bx" x="${(slot * i + slot / 2).toFixed(1)}" y="${H - 4}">${esc(labelOf(p))}</text>`).join('');
101
+ const why = form !== f ? (neg ? 'A value is below zero, so it is drawn as a line.' : 'No target is set, so it is drawn as a line.') : '';
102
+ return `<figure class="vz-mx-fig" data-form="${f}"><figcaption>${esc(cap)}</figcaption><svg class="vz-mx-svg" viewBox="0 0 ${W} ${H}" role="img" aria-label="${esc(alt)}">${g}</svg>${c.target !== null ? '<p class="vz-note">The dashed line is the target.</p>' : ''}${why ? `<p class="vz-note">${esc(why)}</p>` : ''}</figure>`;
74
103
  }
75
104
  const sameChart = (a, b) => ['measure', 'title', 'question', 'form', 'range', 'target', 'better', 'note'].every((k) => (a[k] == null ? '' : String(a[k])) === (b[k] == null ? '' : String(b[k])));
76
105
 
@@ -78,46 +107,62 @@ function chartHtml(t) {
78
107
  const d = t.d, s = t.saved, base = (t.M.charts || []).find((c) => c.id === d.measure);
79
108
  const changed = !s || !sameChart(s, d);
80
109
  const eye = !s ? 'New chart · from this chat' : changed ? 'Chart change · from this chat' : 'Saved chart';
81
- const forms = `<div class="rt-seg" role="group" aria-label="Form">${FORMS.map(([f, l]) => btn('form|' + f, l, { sec: (d.form || 'line') !== f, pressed: (d.form || 'line') === f })).join('')}</div>`;
82
- const meter = d.form === 'meter' && (d.target === null || d.target === undefined) ? '<p class="rt-note">A meter needs a target. Say one in the chat, or pick another form.</p>' : '';
83
- return `<p class="rt-eye">${esc(eye)}</p><h3 class="rt-h">${esc(d.title || (base ? base.title : d.measure))}</h3>${d.question ? `<p class="rt-sub">${esc(d.question)}</p>` : ''}`
84
- + `<p class="rt-meta">${esc(base ? base.title : d.measure)}${d.range ? ' · last ' + d.range + ' readings' : ' · every reading'}${d.target != null ? ' · target ' + esc(d.target) : ''} · ${d.better === 'lower' ? 'lower is better' : 'higher is better'}</p>`
85
- + forms + draftTile(t) + meter
86
- + `<div class="rt-foot">${changed ? btn('save', t.busy ? 'Saving' : s ? 'Save the change' : 'Save chart', { off: t.busy || !base || !!meter }) : ''}</div>`
87
- + `<p class="rt-note">${s ? 'It shows on Insights under Your charts.' : 'Saved, it shows on Insights under Your charts and can go on a dashboard.'} Ask in the chat to change it.</p>`
88
- + (s ? `<div class="rt-foot rt-end">${btn('remove', 'Delete chart', { sec: true, cls: 'rt-del', off: t.busy })}</div>` : '');
110
+ const form = d.form || 'line';
111
+ let shown;
112
+ if (!base) { const m = (t.M.measures || []).find((x) => x.id === d.measure); shown = `<p class="vz-msg">${esc(m ? m.title + ' has fewer than two readings, so it has no chart yet.' : 'No KR metric record is called ' + d.measure + ' in this workspace.')}</p>`; }
113
+ else {
114
+ const c = deriveChart(base, { title: d.title || base.title, form, range: d.range || null, target: d.target, better: d.better || 'higher', note: d.note || '' });
115
+ const cap = (d.question || c && c.title || base.title) + (d.better === 'lower' ? ' (lower is better)' : '');
116
+ shown = c ? kpisHtml(c, d) + figHtml(c, form, cap) + (d.note ? `<p class="vz-note">${esc(d.note)}</p>` : '') : '<p class="vz-msg">The range holds fewer than two readings, so nothing is drawn.</p>';
117
+ }
118
+ const meter = form === 'meter' && (d.target === null || d.target === undefined) ? '<p class="vz-note">A meter needs a target. Say one in the chat, or pick another form.</p>' : '';
119
+ return shown
120
+ + `<section class="vz-blk" aria-label="${esc(eye)}"><div class="vz-r1"><h3>${esc(eye)}</h3>${WAIT('Chart setup from a chat')}</div>`
121
+ + `<p class="vz-note">${esc(base ? base.title : d.measure)}${d.range ? ' · last ' + d.range + ' readings' : ' · every reading'}${d.target != null ? ' · target ' + esc(d.target) : ''}</p>`
122
+ + `<div class="vz-sg" role="group" aria-label="Form">${FORMS.map(([f, l]) => `<button type="button" data-ct="form|${f}" aria-pressed="${form === f}">${l}</button>`).join('')}</div>${meter}`
123
+ + (changed ? `<div class="vz-r1">${btn('save', t.busy ? 'Saving' : s ? 'Save the change' : 'Save chart', { off: t.busy || !base || !!meter })}</div>` : '')
124
+ + `<p class="vz-note">${s ? 'It shows on Insights under Your charts.' : 'Saved, it shows on Insights under Your charts and can go on a dashboard.'} Ask in the chat to change it.</p>`
125
+ + (s ? `<div class="vz-r1">${btn('remove', 'Delete chart', { sec: true, off: t.busy })}</div>` : '') + '</section>';
126
+ }
127
+ /** A dashboard's chart as a small tile: its name, the reading now and its readings as small bars. */
128
+ function tileHtml(c) {
129
+ const pts = c.pts, n = pts.length, hi = Math.max(...pts.map((p) => Math.max(0, p.v))) || 1, slot = 200 / n, bw = Math.min(16, slot * 0.6);
130
+ return `<div class="vz-mx-tile"><p>${esc(c.title)}</p><b>${esc(c.v)}</b><small>on ${esc(c.at)}${c.targetTxt ? ' · ' + esc(c.targetTxt) : ''}</small>`
131
+ + `<svg class="vz-mx-svg" viewBox="0 0 200 44" role="img" aria-label="${esc(c.title + ': ' + n + ' readings, now ' + c.v)}">${pts.map((p, i) => { const h = Math.max(1, Math.max(0, p.v) / hi * 40); return `<rect class="vz-bar${i === n - 1 ? ' now' : ''}" x="${(slot * i + (slot - bw) / 2).toFixed(1)}" y="${(44 - h).toFixed(1)}" width="${bw.toFixed(1)}" height="${h.toFixed(1)}" rx="3"/>`; }).join('')}</svg></div>`;
89
132
  }
90
133
  function dashHtml(t) {
91
134
  const d = t.d, s = t.saved, M = t.M;
92
135
  const changed = !s || d.name !== s.name || d.purpose !== s.purpose || d.charts.join() !== s.charts.join();
93
136
  const eye = !s ? 'New dashboard · from this chat' : changed ? 'Dashboard change · from this chat' : 'Saved dashboard';
94
137
  const tiles = d.charts.map((ref) => {
95
- const c = chartOf(M, ref);
96
- if (c) return `<div class="ntw">${tileHtml(c)}</div>`;
138
+ const c = (M.mine || []).find((x) => x.id === ref) || (M.charts || []).find((x) => x.id === ref);
139
+ if (c) return tileHtml(c);
97
140
  const m = (M.measures || []).find((x) => x.id === ref);
98
- return `<div class="nempty"><p><b>${esc(m ? m.title : ref)}</b><br>${esc(m ? 'It has fewer than two readings, so it has no chart yet.' : 'No KR metric record or saved chart is called ' + ref + '.')}</p></div>`;
141
+ return `<div class="vz-mx-none"><p><b>${esc(m ? m.title : ref)}</b></p><small>${esc(m ? 'It has fewer than two readings, so it has no chart yet.' : 'No KR metric record or saved chart is called ' + ref + '.')}</small></div>`;
99
142
  }).join('');
100
- const many = d.charts.length > 6 ? '<p class="rt-note">This dashboard holds more than six charts. A dashboard that serves one routine usually holds six or fewer.</p>' : '';
101
- return `<p class="rt-eye">${esc(eye)}</p><h3 class="rt-h">${esc(d.name)}</h3>${d.purpose ? `<p class="rt-sub">${esc(d.purpose)}</p>` : ''}`
102
- + `<p class="rt-meta">${d.charts.length} ${d.charts.length === 1 ? 'chart' : 'charts'}${s && s.main ? ' · pinned on Insights' : ''}</p>`
103
- + `<div class="ngrid ct-grid">${tiles}</div>${many}`
104
- + `<div class="rt-foot">${changed ? btn('save', t.busy ? 'Saving' : s ? 'Save the change' : 'Save dashboard', { off: t.busy }) : ''}</div>`
105
- + `<p class="rt-note">${s ? 'It is in the list on Insights.' : 'Saved, it is in the list on Insights, where you can pin it.'} Ask in the chat to change it.</p>`
106
- + (s ? `<div class="rt-foot rt-end">${btn('remove', 'Delete dashboard', { sec: true, cls: 'rt-del', off: t.busy })}</div>` : '');
143
+ const many = d.charts.length > 6 ? '<p class="vz-note">This dashboard holds more than six charts. A dashboard that serves one routine usually holds six or fewer.</p>' : '';
144
+ return `${d.purpose ? `<p class="vz-sum">${esc(d.purpose)}</p>` : ''}<div class="vz-mx-grid">${tiles}</div>${many}`
145
+ + `<section class="vz-blk" aria-label="${esc(eye)}"><div class="vz-r1"><h3>${esc(eye)}</h3>${WAIT('Dashboard setup from a chat')}</div>`
146
+ + `<p class="vz-note">${d.charts.length} ${d.charts.length === 1 ? 'chart' : 'charts'}${s && s.main ? ' · pinned on Insights' : ''}</p>`
147
+ + (changed ? `<div class="vz-r1">${btn('save', t.busy ? 'Saving' : s ? 'Save the change' : 'Save dashboard', { off: t.busy })}</div>` : '')
148
+ + `<p class="vz-note">${s ? 'It is in the list on Insights.' : 'Saved, it is in the list on Insights, where you can pin it.'} Ask in the chat to change it.</p>`
149
+ + (s ? `<div class="vz-r1">${btn('remove', 'Delete dashboard', { sec: true, off: t.busy })}</div>` : '') + '</section>';
107
150
  }
108
151
  function bodyHtml(t) {
109
152
  const noun = t.block.kind;
110
- if (!t.loaded) return `<p class="rt-note" role="status">Reading the ${noun}.</p>`;
111
- if (!t.M) return `<p class="rt-note">The Insights records could not be read, so the ${noun} cannot be drawn. Try again in a moment.</p>`;
112
- if (t.removed) return `<p class="rt-eye">${noun === 'chart' ? 'Chart' : 'Dashboard'}</p><p class="rt-note">Deleted. Ask in the chat for a new one.</p>`;
113
- if (t.gone) return `<p class="rt-eye">${noun === 'chart' ? 'Chart' : 'Dashboard'}</p><h3 class="rt-h">${esc(t.block.id)}</h3><p class="rt-note">This ${noun} is deleted, or it is not saved on this board.</p>`;
114
- if (!t.M.board.id) return '<p class="rt-note">This workspace has no board to save on, so nothing can be saved here.</p>';
153
+ if (!t.loaded) return `<p class="vz-empty" role="status">Reading the ${noun}.</p>`;
154
+ if (!t.M) return `<p class="vz-msg">The Insights records could not be read, so the ${noun} cannot be drawn. Try again in a moment.</p>`;
155
+ if (t.removed) return '<p class="vz-msg">Deleted. Ask in the chat for a new one.</p>';
156
+ if (t.gone) return `<p class="vz-msg">This ${noun} (${esc(t.block.id)}) is deleted, or it is not saved on this board.</p>`;
157
+ if (!t.M.board.id) return '<p class="vz-msg">This workspace has no board to save on, so nothing can be saved here.</p>';
115
158
  return noun === 'chart' ? chartHtml(t) : dashHtml(t);
116
159
  }
160
+ function askHtml(t) {
161
+ const A = t.ask; if (!A) return '';
162
+ return `<div class="vz-ask2" role="group" aria-label="${esc(A.yes)}"><span>${esc(A.text)}</span><div><button type="button" class="vz-issue vz-hv vz-h36" data-ct="askyes" data-k="bad">${esc(A.yes)}</button><button type="button" class="vz-sec2 vz-hv vz-h36" data-ct="askno">${esc(A.no)}</button></div></div>`;
163
+ }
117
164
  function draw(t, el) {
118
- const ask = el.querySelector(':scope > .vcf'); // an open confirm card outlives a redraw, so its answer still lands
119
- el.innerHTML = `<div class="rt">${bodyHtml(t)}${t.msg ? `<p class="rt-msg" role="status">${esc(t.msg)}</p>` : ''}</div>`;
120
- if (ask) el.prepend(ask);
165
+ el.innerHTML = `<div class="vz vz-mx" data-vw="${esc(t.id)}">${askHtml(t)}${bodyHtml(t)}${t.msg ? `<p class="vz-msg" role="status">${esc(t.msg)}</p>` : ''}</div>`;
121
166
  }
122
167
 
123
168
  async function act(t, fn) { t.busy = true; t.msg = ''; redraw(t); const m = await fn(); t.busy = false; if (m != null) t.msg = m; redraw(t); }
@@ -127,6 +172,8 @@ async function press(t, e) {
127
172
  const [a, v] = [b.dataset.ct.split('|')[0], b.dataset.ct.slice(b.dataset.ct.indexOf('|') + 1)];
128
173
  const board = t.M && t.M.board.id, kind = t.block.kind;
129
174
  if (a === 'form') { t.d = Object.assign({}, t.d, { form: v }); t.msg = ''; redraw(t); return; }
175
+ if (a === 'askno') { t.ask = null; redraw(t); return; }
176
+ if (a === 'askyes') { const A = t.ask; t.ask = null; if (A) await A.run(); return; }
130
177
  if (a === 'save') {
131
178
  await act(t, async () => {
132
179
  if (kind === 'chart') {
@@ -147,11 +194,12 @@ async function press(t, e) {
147
194
  }
148
195
  if (a === 'remove') {
149
196
  const noun = kind === 'chart' ? 'chart' : 'dashboard';
150
- if (!(await vwConfirm(paneOf(t), { text: kind === 'chart' ? 'Delete this chart? A dashboard that holds it shows it as removed.' : 'Delete this dashboard? Its charts and records stay.', yes: 'Delete ' + noun, no: 'Keep it' }))) return;
151
- await act(t, async () => {
152
- const r = await post(kind === 'chart' ? '/api/premium-charts/save' : '/api/premium-dashboards/save', { board, id: t.saved.id, remove: true });
153
- if (!r || !r.ok) return 'It was not deleted: ' + why(r, 'the page could not reach PMOS') + '.';
154
- t.removed = true; return null;
155
- });
197
+ t.ask = { text: kind === 'chart' ? 'Delete this chart? A dashboard that holds it shows it as removed.' : 'Delete this dashboard? Its charts and records stay.', yes: 'Delete ' + noun, no: 'Keep it',
198
+ run: () => act(t, async () => {
199
+ const r = await post(kind === 'chart' ? '/api/premium-charts/save' : '/api/premium-dashboards/save', { board, id: t.saved.id, remove: true });
200
+ if (!r || !r.ok) return 'It was not deleted: ' + why(r, 'the page could not reach PMOS') + '.';
201
+ t.removed = true; return null;
202
+ }) };
203
+ redraw(t);
156
204
  }
157
205
  }
@@ -15,7 +15,7 @@
15
15
  export const W = 960, H = 540;
16
16
  export const LAYOUTS = [['title', 'Title'], ['content', 'Title and text'], ['two', 'Two columns'], ['chart', 'Chart and text'], ['big', 'Big number'], ['image', 'Image and text'], ['quote', 'Quote'], ['section', 'Section break']];
17
17
  export const ROLES = [['title', 'Title'], ['heading', 'Heading'], ['body', 'Body'], ['small', 'Small'], ['kicker', 'Kicker'], ['big', 'Big number'], ['quote', 'Quote']];
18
- export const THEMES = [['ember', 'Ember'], ['paper', 'Paper'], ['sky', 'Sky']];
18
+ export const THEMES = [['report', 'Report blue'], ['ember', 'Ember'], ['paper', 'Paper'], ['sky', 'Sky']]; // report: the report panel's slide (ReportPanel.dc.html), the default
19
19
  export const COLORS = [['', 'Theme text'], ['acc', 'Accent'], ['mut', 'Muted']];
20
20
  export const FILLS = [['acc', 'Accent'], ['fg', 'Text colour'], ['soft', 'Soft']];
21
21
  const has = (list, k) => list.some((x) => x[0] === k);
@@ -108,7 +108,7 @@ export function mkLayout(l, c = {}) {
108
108
  const T = (k, role, x, y, w, h, html, align) => ({ t: 'text', k, role, x, y, w, h, html, align: align || 'left' });
109
109
  const ti = c.title != null ? c.title : '', bo = c.body != null ? c.body : '';
110
110
  switch (l) {
111
- case 'title': return [T('kicker', 'kicker', 72, 232, 816, 28, c.kicker || ''), T('title', 'title', 72, 272, 816, 140, ti), T('body', 'body', 72, 424, 816, 70, bo)];
111
+ case 'title': return [T('kicker', 'kicker', 48, 44, 816, 36, c.kicker || ''), T('title', 'title', 48, 96, 640, 150, ti), T('body', 'body', 48, 420, 816, 80, bo)]; // the report's title slide: tag, title, then the lines at the foot
112
112
  case 'two': return [T('title', 'heading', 72, 60, 816, 56, ti), T('body', 'body', 72, 150, 390, 330, bo), T('body2', 'body', 498, 150, 390, 330, c.body2 || '')];
113
113
  case 'chart': return [T('title', 'heading', 72, 60, 816, 56, ti), c.chart ? { ...c.chart, k: 'chart', x: 72, y: 150, w: 520, h: 320 } : { t: 'chart', k: 'chart', x: 72, y: 150, w: 520, h: 320, kind: 'bar', data: [['', 0]] }, T('body', 'body', 624, 160, 264, 310, bo)];
114
114
  case 'big': return [T('big', 'big', 72, 96, 816, 170, c.big || ''), T('body', 'body', 72, 300, 700, 140, bo), ...(ti ? [T('title', 'small', 72, 470, 700, 40, ti)] : [])];
@@ -158,7 +158,7 @@ function fromSection(head, body, l) {
158
158
  /** The file as a deck. A file with no blocks (a report) is read as its title slide and one slide per section, as the report reader does. */
159
159
  export function parseDeck(md, fallbackTitle) {
160
160
  const { front, rest } = splitFront(String(md || '').replace(/\r\n/g, '\n'));
161
- const theme = has(THEMES, frontVal(front, 'deck_theme')) ? frontVal(front, 'deck_theme') : 'ember';
161
+ const theme = has(THEMES, frontVal(front, 'deck_theme')) ? frontVal(front, 'deck_theme') : 'report';
162
162
  const secs = []; let cur = null, pre = [];
163
163
  for (const line of rest.split('\n')) {
164
164
  const h1 = /^# (?!#)(.*)/.exec(line), h2 = /^## (?!#)(.*)/.exec(line);
@@ -1,36 +1,40 @@
1
- /* pm/premium-first.js — the "Your first Briefing" card on the premium Briefing (initiative premium-welcome). It shows only when the page was opened with
2
- * first=<import id>, which the premium Welcome sets after an import. It reads GET /api/onboarding/briefing, lists each item, the state of the tools the PM
3
- * ticked (what Welcome recorded in this browser) and Undo this import (POST /api/onboarding/undo), which goes back to Welcome's found step.
4
- * The card keeps the page's own rows untouched: it is inserted above the columns. Text from the scanned folder is untrusted and goes through esc(). */
1
+ /* pm/premium-first.js — the "Your first Briefing" card on Home (initiative premium-welcome; rebuilt for the Agreed design, initiative
2
+ * premium-agreed-design, Home). The Agreed design does not draw a first-run card, so this is a plain minimal cozy card with a
3
+ * "Waiting for design" marker. It shows only when Home was opened with first=<import id>, which the premium Welcome sets after an import.
4
+ * It reads GET /api/onboarding/briefing, lists each item, the state of the tools the PM ticked (what Welcome recorded in this browser) and
5
+ * Undo this import (POST /api/onboarding/undo), which goes back to Welcome's found step.
6
+ * mountFirst() → the card element (a <section id="wlFirst">), or null when the address has no first=. Home puts it at the top of its list.
7
+ * Text from the scanned folder is untrusted and goes through esc(). */
5
8
  import { pmGet, pmPost } from './http.js';
6
9
  import { firstView, FIRST_KEY } from './premium-welcome-model.js';
7
10
 
8
11
  const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
9
- const SUN = '<svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>';
12
+ const WAIT = '<p class="hx-wait"><i aria-hidden="true"></i>Waiting for design</p>';
10
13
 
11
14
  function toolState() {
12
15
  try { return JSON.parse(sessionStorage.getItem(FIRST_KEY) || '{}'); } catch { return {}; }
13
16
  }
14
- export async function mountFirst() {
17
+ export function mountFirst() {
15
18
  const q = new URLSearchParams(location.search), id = q.get('first'), ws = q.get('ws') || '';
16
- const cols = document.querySelector('.cols2');
17
- if (!id || !cols || document.getElementById('wlFirst')) return;
18
- const r = await pmGet(`/api/onboarding/briefing?ws=${encodeURIComponent(ws)}`);
19
- const v = firstView(r, toolState());
19
+ if (!id) return null;
20
20
  const sec = document.createElement('section');
21
- sec.className = 'card wl-first'; sec.id = 'wlFirst'; sec.setAttribute('aria-labelledby', 'hWl');
22
- const items = v.items.map((f, i) => `<li class="wl-row"><span class="wl-ic wl-n">${String(i + 1).padStart(2, '0')}</span><span><b>${esc(f.title)}</b>${f.why ? `<small>${esc(f.why)}</small>` : ''}<span class="path">${f.ini ? esc(f.ini) + ' · ' : ''}${esc(f.ref)}</span></span><span></span></li>`).join('');
23
- const tools = v.tools.map((t) => `<li class="wl-row"><span class="wl-ic">${SUN}</span><span><b>${esc(t.name)}</b><small${t.started ? '' : ' class="wl-bad"'}>${t.started ? `${esc(t.name)} is being read in an agent session. Its items join your Briefing when it finishes.` : esc(t.error || 'It did not start.')}</small></span><span></span></li>`).join('');
24
- sec.innerHTML = `<div class="ch"><span class="ic">${SUN}</span><h2 id="hWl">Your first Briefing</h2><small>From the scan</small></div>
25
- <p class="note wl-first-note">${r && r.ok ? (v.calm ? 'Your portfolio is in. Nothing needs you right now.' : 'Your portfolio is in. These need you first.') : esc((r && r.error) || 'The scan\'s Briefing could not be read.')}</p>
26
- ${items ? `<ol class="wl-list">${items}</ol>` : ''}${tools ? `<p class="wl-sec">Your tools</p><ul class="wl-list">${tools}</ul>` : ''}
27
- <div class="wl-actions"><button class="wl-btn alt" type="button" id="wlUndo">Undo this import</button></div><p class="note wl-first-err" id="wlUndoErr" role="alert" hidden></p>`;
28
- cols.parentNode.insertBefore(sec, cols);
29
- document.addEventListener('click', async (e) => {
21
+ sec.className = 'hm-first hx'; sec.id = 'wlFirst'; sec.setAttribute('aria-labelledby', 'hWl');
22
+ sec.innerHTML = `${WAIT}<h2 id="hWl">Your first Briefing</h2><p class="hx-n">Reading what the scan found.</p>`;
23
+ pmGet(`/api/onboarding/briefing?ws=${encodeURIComponent(ws)}`).then((r) => {
24
+ const v = firstView(r, toolState());
25
+ const items = v.items.map((f) => `<li class="hx-row"><span class="hx-t"><b>${esc(f.title)}</b>${f.why ? `<em>${esc(f.why)}</em>` : ''}<small>${f.ini ? esc(f.ini) + ' · ' : ''}${esc(f.ref)}</small></span></li>`).join('');
26
+ const tools = v.tools.map((t) => `<li class="hx-row"><span class="hx-t"><b>${esc(t.name)}</b><em${t.started ? '' : ' class="bad"'}>${t.started ? `${esc(t.name)} is being read in an agent session. Its items join your list when it finishes.` : esc(t.error || 'It did not start.')}</em></span></li>`).join('');
27
+ const lede = r && r.ok ? (v.calm ? 'Your portfolio is in. Nothing needs you right now.' : 'Your portfolio is in. These need you first.') : esc((r && r.error) || 'The scan\'s Briefing could not be read.');
28
+ sec.innerHTML = `${WAIT}<h2 id="hWl">Your first Briefing</h2><p class="hx-n">${lede}</p>`
29
+ + (items ? `<ol class="hm-first-l">${items}</ol>` : '') + (tools ? `<h4>Your tools</h4><ul class="hm-first-l">${tools}</ul>` : '')
30
+ + '<div class="hx-top"><button class="hx-b" type="button" id="wlUndo">Undo this import</button></div><p class="hx-n" id="wlUndoErr" role="alert" hidden></p>';
31
+ });
32
+ sec.onclick = async (e) => {
30
33
  const b = e.target.closest('#wlUndo'); if (!b || b.disabled) return;
31
34
  b.disabled = true;
32
35
  const u = await pmPost('/api/onboarding/undo', { ws, import_id: id });
33
- if (!u || !u.ok) { b.disabled = false; const e = document.getElementById('wlUndoErr'); e.textContent = (u && u.error) || 'Undo did not work.'; e.hidden = false; return; }
36
+ if (!u || !u.ok) { b.disabled = false; const m = sec.querySelector('#wlUndoErr'); m.textContent = (u && u.error) || 'Undo did not work.'; m.hidden = false; return; }
34
37
  location.assign('/premium-welcome.html?ws=' + encodeURIComponent(ws) + '&step=found');
35
- });
38
+ };
39
+ return sec;
36
40
  }