create-pmos 0.398.0 → 0.400.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 (515) hide show
  1. package/package.json +30 -25
  2. package/payload/KIT-VERSION +1 -1
  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/workspace/briefing-premium-adddoc-test.js +19 -15
  7. package/workspace/briefing-premium-board-test.js +82 -50
  8. package/workspace/briefing-premium-calendar-2-test.js +36 -36
  9. package/workspace/briefing-premium-calendar-3-test.js +39 -39
  10. package/workspace/briefing-premium-calendar-test.js +23 -24
  11. package/workspace/briefing-premium-doc-edit-test.js +8 -10
  12. package/workspace/briefing-premium-initiative-test.js +38 -16
  13. package/workspace/briefing-premium-insights-test.js +114 -37
  14. package/workspace/briefing-premium-metrics-test.js +6 -4
  15. package/workspace/briefing-premium-products-test.js +10 -7
  16. package/workspace/briefing-premium-sources-test.js +25 -22
  17. package/workspace/briefing-premium-test.js +48 -43
  18. package/workspace/briefing-premium-work-test.js +16 -11
  19. package/workspace/c3-capture-test.js +0 -17
  20. package/workspace/changelog.json +29 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +11 -6
  23. package/workspace/guide/briefing-premium.md +2 -2
  24. package/workspace/guide/home.md +58 -19
  25. package/workspace/guide/index.md +1 -1
  26. package/workspace/guide/layout.md +2 -2
  27. package/workspace/guide/notes.md +2 -2
  28. package/workspace/guide/phone-companion.md +1 -1
  29. package/workspace/lib/board-grill.js +63 -0
  30. package/workspace/lib/board-premium.js +36 -5
  31. package/workspace/lib/initiative-layout.js +77 -0
  32. package/workspace/lib/insights-premium.js +3 -2
  33. package/workspace/lib/insights-records.js +21 -7
  34. package/workspace/lib/meeting-points.js +52 -0
  35. package/workspace/lib/news-for-you.js +88 -0
  36. package/workspace/lib/notes-series.js +29 -6
  37. package/workspace/lib/report-confirm.js +48 -0
  38. package/workspace/lib/route-modules.js +9 -9
  39. package/workspace/lib/routes-board-docs.js +46 -0
  40. package/workspace/lib/routes-board-grill.js +90 -0
  41. package/workspace/lib/routes-home-review.js +108 -0
  42. package/workspace/lib/routes-initiative-layout.js +57 -0
  43. package/workspace/lib/routes-insights-premium.js +4 -1
  44. package/workspace/lib/routes-insights-records.js +8 -4
  45. package/workspace/lib/routes-meeting-points.js +37 -0
  46. package/workspace/lib/routes-news.js +57 -0
  47. package/workspace/lib/routes-notes.js +2 -1
  48. package/workspace/lib/routes-phone-day.js +18 -9
  49. package/workspace/lib/routes-report-confirm.js +31 -0
  50. package/workspace/lib/routes-search.js +38 -0
  51. package/workspace/lib/routes-slash.js +95 -0
  52. package/workspace/lib/search-index.js +176 -0
  53. package/workspace/package-lock.json +2 -2
  54. package/workspace/package.json +1 -2
  55. package/workspace/premium-board-actions-test.js +86 -50
  56. package/workspace/premium-briefing-depth-test.js +55 -54
  57. package/workspace/premium-chat-chart-tab-test.js +4 -2
  58. package/workspace/premium-chat-goal-view-test.js +1 -1
  59. package/workspace/premium-chat-report-tab-test.js +16 -2
  60. package/workspace/premium-chat-term-test.js +0 -10
  61. package/workspace/premium-core-doc-issue-test.js +15 -13
  62. package/workspace/premium-menu-rows-test.js +1 -1
  63. package/workspace/premium-phone-card-test.js +7 -5
  64. package/workspace/premium-report-read-test.js +55 -18
  65. package/workspace/premium-vw-backlog-test.js +2 -2
  66. package/workspace/premium-vw-cal-test.js +50 -35
  67. package/workspace/premium-vw-doc-test.js +10 -11
  68. package/workspace/premium-vw-item-test.js +1 -1
  69. package/workspace/premium-vw-jira-test.js +2 -2
  70. package/workspace/premium-vw-meet-test.js +37 -40
  71. package/workspace/premium-vw-notes-test.js +21 -19
  72. package/workspace/premium-vw-rec-test.js +11 -12
  73. package/workspace/premium-welcome-test.js +3 -3
  74. package/workspace/premium-work-depth-test.js +5 -6
  75. package/workspace/public/capture.html +23 -0
  76. package/workspace/public/pm/bd-acts.js +303 -225
  77. package/workspace/public/pm/bd-asks.js +261 -0
  78. package/workspace/public/pm/bd-pop.js +59 -0
  79. package/workspace/public/pm/bd-span.js +49 -13
  80. package/workspace/public/pm/bd-views.js +169 -0
  81. package/workspace/public/pm/c3-base.js +47 -0
  82. package/workspace/public/pm/c3-capture.js +1 -1
  83. package/workspace/public/pm/c3-ini-ui.js +1 -1
  84. package/workspace/public/pm/c3-sheet.js +1 -1
  85. package/workspace/public/pm/c3-toast.js +1 -1
  86. package/workspace/public/pm/console3.css +3 -0
  87. package/workspace/public/pm/cozy-board.css +301 -0
  88. package/workspace/public/pm/cozy-ev.css +228 -0
  89. package/workspace/public/pm/cozy-evmodel.js +106 -0
  90. package/workspace/public/pm/cozy-evui.js +47 -0
  91. package/workspace/public/pm/cozy-home.css +20 -5
  92. package/workspace/public/pm/cozy-insights.css +148 -10
  93. package/workspace/public/pm/cozy-nav.js +103 -39
  94. package/workspace/public/pm/cozy-news.js +140 -0
  95. package/workspace/public/pm/cozy-search.js +203 -0
  96. package/workspace/public/pm/cozy-settings.js +198 -0
  97. package/workspace/public/pm/cozy-sources.js +89 -0
  98. package/workspace/public/pm/cozy-today.css +220 -0
  99. package/workspace/public/pm/cozy-viewer.js +5 -2
  100. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  101. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  102. package/workspace/public/pm/cozy.css +9 -0
  103. package/workspace/public/pm/goal-chat.js +5 -1
  104. package/workspace/public/pm/home-adddoc.js +5 -5
  105. package/workspace/public/pm/home-app.js +365 -70
  106. package/workspace/public/pm/home-around.js +24 -126
  107. package/workspace/public/pm/home-chat.js +77 -18
  108. package/workspace/public/pm/home-data.js +9 -7
  109. package/workspace/public/pm/home-dictate.js +57 -0
  110. package/workspace/public/pm/home-draft.js +6 -6
  111. package/workspace/public/pm/home-ini-model.js +190 -0
  112. package/workspace/public/pm/home-ini.css +171 -0
  113. package/workspace/public/pm/home-ini.js +466 -0
  114. package/workspace/public/pm/home-list.js +289 -0
  115. package/workspace/public/pm/home-more.js +18 -135
  116. package/workspace/public/pm/home-phone-card.js +13 -8
  117. package/workspace/public/pm/home-review.js +103 -0
  118. package/workspace/public/pm/home-task.js +67 -0
  119. package/workspace/public/pm/home-today.js +148 -0
  120. package/workspace/public/pm/home-work.js +63 -28
  121. package/workspace/public/pm/note-dock.js +1 -2
  122. package/workspace/public/pm/notes-links.js +1 -2
  123. package/workspace/public/pm/notes-task.js +3 -4
  124. package/workspace/public/pm/premium-board.js +164 -40
  125. package/workspace/public/pm/premium-chart-tab.js +4 -5
  126. package/workspace/public/pm/premium-first.js +5 -7
  127. package/workspace/public/pm/premium-initiative-head.js +3 -3
  128. package/workspace/public/pm/premium-insights.js +499 -202
  129. package/workspace/public/pm/premium-mtg-present.js +138 -0
  130. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  131. package/workspace/public/pm/premium-report-read.js +216 -52
  132. package/workspace/public/pm/premium-report-tab.js +44 -19
  133. package/workspace/public/pm/premium-shell.js +7 -7
  134. package/workspace/public/pm/premium-vw-cal.js +150 -60
  135. package/workspace/public/pm/premium-vw-doc.css +20 -2
  136. package/workspace/public/pm/premium-vw-doc.js +22 -7
  137. package/workspace/public/pm/premium-vw-mtg.js +488 -261
  138. package/workspace/public/pm/premium-vw-notes.js +61 -0
  139. package/workspace/public/pm/rp-parts.js +269 -0
  140. package/workspace/public/pm/view-notes.js +2 -2
  141. package/workspace/public/premium-board.html +4 -3
  142. package/workspace/public/premium-insights.html +10 -10
  143. package/workspace/public/premium.html +3 -1
  144. package/workspace/r/m1.png +0 -0
  145. package/workspace/r/m2.png +0 -0
  146. package/workspace/r/m3.png +0 -0
  147. package/workspace/r/nl.png +0 -0
  148. package/workspace/replaced-tests.json +435 -0
  149. package/workspace/run-tests.js +323 -28
  150. package/workspace/server.js +15 -10
  151. package/workspace/test-files.json +3 -140
  152. package/workspace/test-lists/base.json +1 -2
  153. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  154. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  155. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  156. package/workspace/test-lists/c3-work-agent.json +1 -2
  157. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  158. package/workspace/test-lists/console3-reports.json +1 -2
  159. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  160. package/workspace/test-lists/extension-capture.json +5 -0
  161. package/workspace/test-lists/initiative-layout.json +9 -0
  162. package/workspace/test-lists/jira-wbs.json +1 -2
  163. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  164. package/workspace/test-lists/meeting-material.json +1 -2
  165. package/workspace/test-lists/meeting-notes.json +2 -36
  166. package/workspace/test-lists/meeting-replay.json +1 -2
  167. package/workspace/test-lists/mm-capture.json +2 -12
  168. package/workspace/test-lists/my-work.json +2 -10
  169. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  170. package/workspace/test-lists/people-directory.json +1 -2
  171. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  172. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  173. package/workspace/test-lists/run2-a.json +1 -2
  174. package/workspace/test-lists/run2-d.json +2 -19
  175. package/workspace/test-lists/run3-b.json +1 -2
  176. package/workspace/test-lists/run3-c.json +2 -12
  177. package/workspace/test-lists/run4-b.json +1 -2
  178. package/workspace/test-lists/run4-d.json +1 -5
  179. package/workspace/test-lists/run5-c.json +1 -11
  180. package/workspace/test-lists/run6.json +1 -5
  181. package/workspace/test-lists/uf-everywhere.json +15 -0
  182. package/workspace/test-lists/uf-home.json +9 -0
  183. package/workspace/test-lists/uncovered-board.json +9 -0
  184. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  185. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  186. package/workspace/test-timings.json +242 -123
  187. package/workspace/c3-briefing-test.js +0 -136
  188. package/workspace/c3-core-docs-test.js +0 -170
  189. package/workspace/c3-driver-fixture.js +0 -64
  190. package/workspace/c3-driver-test.js +0 -169
  191. package/workspace/c3-foundation-test.js +0 -163
  192. package/workspace/c3-ib-items-test.js +0 -114
  193. package/workspace/c3-ib-more-test.js +0 -146
  194. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  195. package/workspace/c3-ini-harness.js +0 -66
  196. package/workspace/c3-ini-life-test.js +0 -167
  197. package/workspace/c3-initiatives-test.js +0 -186
  198. package/workspace/c3-light-load-test.js +0 -112
  199. package/workspace/c3-one-home-test.js +0 -149
  200. package/workspace/c3-phone-test.js +0 -289
  201. package/workspace/c3-quiet-test.js +0 -157
  202. package/workspace/c3-report-design-real-test.js +0 -264
  203. package/workspace/c3-report-design-test.js +0 -442
  204. package/workspace/c3-report-setup-test.js +0 -192
  205. package/workspace/c3-report-structure-real-test.js +0 -248
  206. package/workspace/c3-report-structure-test.js +0 -397
  207. package/workspace/c3-reports-test.js +0 -288
  208. package/workspace/c3-scan-test.js +0 -517
  209. package/workspace/c3-sessions-panel-test.js +0 -365
  210. package/workspace/c3-settings-test.js +0 -204
  211. package/workspace/c3-updates-test.js +0 -131
  212. package/workspace/c3-work-test.js +0 -260
  213. package/workspace/cut-stub.js +0 -40
  214. package/workspace/first-paint-audit.js +0 -160
  215. package/workspace/lib/c3-full-console.js +0 -15
  216. package/workspace/lib/engine/derived/trust.js +0 -3
  217. package/workspace/lib/engine/plan-forecast.js +0 -342
  218. package/workspace/lib/engine/report-families.js +0 -175
  219. package/workspace/lib/engine/truth-table.js +0 -57
  220. package/workspace/lib/routes-c3-init.js +0 -54
  221. package/workspace/lib/routes-c3-life.js +0 -120
  222. package/workspace/lib/routes-c3-timeline.js +0 -192
  223. package/workspace/lib/routes-forecast.js +0 -86
  224. package/workspace/lib/routes-releases.js +0 -130
  225. package/workspace/lib/routes-report-facts.js +0 -85
  226. package/workspace/lib/routes-report-families.js +0 -33
  227. package/workspace/lib/routes-signals.js +0 -51
  228. package/workspace/lib/routes-timeline.js +0 -197
  229. package/workspace/public/c3.html +0 -35
  230. package/workspace/public/index.html +0 -156
  231. package/workspace/public/pm/app.js +0 -831
  232. package/workspace/public/pm/bd-board.js +0 -159
  233. package/workspace/public/pm/bd-drag.js +0 -59
  234. package/workspace/public/pm/bd-model.js +0 -152
  235. package/workspace/public/pm/bd-timeline.js +0 -233
  236. package/workspace/public/pm/bd-tree.js +0 -244
  237. package/workspace/public/pm/board-copy.js +0 -59
  238. package/workspace/public/pm/board-read.js +0 -38
  239. package/workspace/public/pm/branches-sheet.js +0 -56
  240. package/workspace/public/pm/breakdown-api.js +0 -58
  241. package/workspace/public/pm/breakdown-copy.js +0 -138
  242. package/workspace/public/pm/briefing-deck.js +0 -441
  243. package/workspace/public/pm/briefing-model.js +0 -251
  244. package/workspace/public/pm/c3-ambient.js +0 -100
  245. package/workspace/public/pm/c3-audience-link.js +0 -21
  246. package/workspace/public/pm/c3-audience.js +0 -46
  247. package/workspace/public/pm/c3-boot.js +0 -13
  248. package/workspace/public/pm/c3-breakdown.js +0 -240
  249. package/workspace/public/pm/c3-brief-data.js +0 -11
  250. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  251. package/workspace/public/pm/c3-brief-needs.js +0 -288
  252. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  253. package/workspace/public/pm/c3-brief-summary.js +0 -139
  254. package/workspace/public/pm/c3-brief-today.js +0 -79
  255. package/workspace/public/pm/c3-brief.js +0 -279
  256. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  257. package/workspace/public/pm/c3-calendar.js +0 -965
  258. package/workspace/public/pm/c3-calpop.js +0 -111
  259. package/workspace/public/pm/c3-case.js +0 -196
  260. package/workspace/public/pm/c3-core-docs.css +0 -18
  261. package/workspace/public/pm/c3-core-docs.js +0 -236
  262. package/workspace/public/pm/c3-daypart.js +0 -176
  263. package/workspace/public/pm/c3-demo-boards.js +0 -764
  264. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  265. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  266. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  267. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  268. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  269. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  270. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  271. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  272. package/workspace/public/pm/c3-demo-data.js +0 -552
  273. package/workspace/public/pm/c3-demo-focus.js +0 -181
  274. package/workspace/public/pm/c3-demo-init.js +0 -430
  275. package/workspace/public/pm/c3-demo-life.js +0 -77
  276. package/workspace/public/pm/c3-demo-material.js +0 -58
  277. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  278. package/workspace/public/pm/c3-demo-phone.js +0 -48
  279. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  280. package/workspace/public/pm/c3-demo-rd.js +0 -432
  281. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  282. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  283. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  284. package/workspace/public/pm/c3-demo-rs.js +0 -287
  285. package/workspace/public/pm/c3-demo-term.js +0 -153
  286. package/workspace/public/pm/c3-demo-time.js +0 -49
  287. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  288. package/workspace/public/pm/c3-demo.js +0 -131
  289. package/workspace/public/pm/c3-design-studio.js +0 -369
  290. package/workspace/public/pm/c3-doc-formats.js +0 -153
  291. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  292. package/workspace/public/pm/c3-dock.js +0 -206
  293. package/workspace/public/pm/c3-docs.js +0 -291
  294. package/workspace/public/pm/c3-driver-work.js +0 -110
  295. package/workspace/public/pm/c3-driver.css +0 -18
  296. package/workspace/public/pm/c3-driver.js +0 -298
  297. package/workspace/public/pm/c3-focus.css +0 -304
  298. package/workspace/public/pm/c3-focus.js +0 -983
  299. package/workspace/public/pm/c3-ib-docs.js +0 -92
  300. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  301. package/workspace/public/pm/c3-ib-items.js +0 -210
  302. package/workspace/public/pm/c3-ib-releases.js +0 -48
  303. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  304. package/workspace/public/pm/c3-ib-triage.js +0 -177
  305. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  306. package/workspace/public/pm/c3-ini-life.css +0 -34
  307. package/workspace/public/pm/c3-ini-life.js +0 -379
  308. package/workspace/public/pm/c3-ini-records.js +0 -197
  309. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  310. package/workspace/public/pm/c3-ini-work.js +0 -139
  311. package/workspace/public/pm/c3-init-extras.js +0 -170
  312. package/workspace/public/pm/c3-initiatives.js +0 -852
  313. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  314. package/workspace/public/pm/c3-look.js +0 -27
  315. package/workspace/public/pm/c3-material.css +0 -22
  316. package/workspace/public/pm/c3-material.js +0 -321
  317. package/workspace/public/pm/c3-md.js +0 -3
  318. package/workspace/public/pm/c3-misc-panels.js +0 -89
  319. package/workspace/public/pm/c3-new-session.js +0 -110
  320. package/workspace/public/pm/c3-notes.js +0 -751
  321. package/workspace/public/pm/c3-phone-boot.js +0 -47
  322. package/workspace/public/pm/c3-phone-detail.js +0 -97
  323. package/workspace/public/pm/c3-phone-model.js +0 -3
  324. package/workspace/public/pm/c3-phone.css +0 -66
  325. package/workspace/public/pm/c3-phone.js +0 -444
  326. package/workspace/public/pm/c3-plan-panels.js +0 -163
  327. package/workspace/public/pm/c3-plan.js +0 -193
  328. package/workspace/public/pm/c3-quiet.css +0 -113
  329. package/workspace/public/pm/c3-quiet.js +0 -177
  330. package/workspace/public/pm/c3-replay.css +0 -133
  331. package/workspace/public/pm/c3-replay.js +0 -429
  332. package/workspace/public/pm/c3-report-deck.css +0 -163
  333. package/workspace/public/pm/c3-report-deck.js +0 -598
  334. package/workspace/public/pm/c3-report-frame.css +0 -20
  335. package/workspace/public/pm/c3-report-print.css +0 -20
  336. package/workspace/public/pm/c3-report-setup.css +0 -67
  337. package/workspace/public/pm/c3-report-setup.js +0 -298
  338. package/workspace/public/pm/c3-report-store.js +0 -244
  339. package/workspace/public/pm/c3-report-structure.css +0 -44
  340. package/workspace/public/pm/c3-report-structure.js +0 -473
  341. package/workspace/public/pm/c3-reports.css +0 -68
  342. package/workspace/public/pm/c3-reports.js +0 -377
  343. package/workspace/public/pm/c3-roadmap.js +0 -249
  344. package/workspace/public/pm/c3-scan-api.js +0 -167
  345. package/workspace/public/pm/c3-scan-next.js +0 -248
  346. package/workspace/public/pm/c3-scan-setup.js +0 -313
  347. package/workspace/public/pm/c3-scan-words.js +0 -41
  348. package/workspace/public/pm/c3-scan.css +0 -74
  349. package/workspace/public/pm/c3-scan.js +0 -93
  350. package/workspace/public/pm/c3-session-chat.js +0 -103
  351. package/workspace/public/pm/c3-session-conv.js +0 -165
  352. package/workspace/public/pm/c3-session-term.js +0 -216
  353. package/workspace/public/pm/c3-settings.css +0 -85
  354. package/workspace/public/pm/c3-settings.js +0 -1045
  355. package/workspace/public/pm/c3-shell.js +0 -628
  356. package/workspace/public/pm/c3-signals.js +0 -196
  357. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  358. package/workspace/public/pm/c3-swipe.js +0 -230
  359. package/workspace/public/pm/c3-terminal-data.js +0 -48
  360. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  361. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  362. package/workspace/public/pm/c3-terminal-results.js +0 -141
  363. package/workspace/public/pm/c3-terminal.js +0 -52
  364. package/workspace/public/pm/c3-tickets.js +0 -163
  365. package/workspace/public/pm/c3-timeline.js +0 -201
  366. package/workspace/public/pm/calendar-views.js +0 -1049
  367. package/workspace/public/pm/console3-lift.md +0 -220
  368. package/workspace/public/pm/cozy-home.js +0 -172
  369. package/workspace/public/pm/cozy-initiative.css +0 -138
  370. package/workspace/public/pm/cycle-review.js +0 -125
  371. package/workspace/public/pm/data.js +0 -1577
  372. package/workspace/public/pm/dest-board.js +0 -444
  373. package/workspace/public/pm/dest-docs.js +0 -530
  374. package/workspace/public/pm/dest-initiatives.js +0 -162
  375. package/workspace/public/pm/dest-mywork.js +0 -307
  376. package/workspace/public/pm/dest-notes.js +0 -537
  377. package/workspace/public/pm/dest-people.js +0 -449
  378. package/workspace/public/pm/dest-reports.js +0 -383
  379. package/workspace/public/pm/dest-settings.js +0 -601
  380. package/workspace/public/pm/dest-today.js +0 -267
  381. package/workspace/public/pm/display-word.js +0 -56
  382. package/workspace/public/pm/doc-editor.js +0 -473
  383. package/workspace/public/pm/doc-graph.js +0 -272
  384. package/workspace/public/pm/doc-health-panel.js +0 -110
  385. package/workspace/public/pm/doc-rail.js +0 -167
  386. package/workspace/public/pm/doc-remote.js +0 -180
  387. package/workspace/public/pm/dock-sessions.js +0 -472
  388. package/workspace/public/pm/dock.js +0 -216
  389. package/workspace/public/pm/fixture.js +0 -821
  390. package/workspace/public/pm/flag-picker.js +0 -104
  391. package/workspace/public/pm/frame-copy.js +0 -278
  392. package/workspace/public/pm/freshness-line.js +0 -149
  393. package/workspace/public/pm/handoff-box.js +0 -82
  394. package/workspace/public/pm/initiative-list.js +0 -235
  395. package/workspace/public/pm/initiative-sheet.js +0 -331
  396. package/workspace/public/pm/initiatives-api.js +0 -95
  397. package/workspace/public/pm/initiatives-copy.js +0 -287
  398. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  399. package/workspace/public/pm/initiatives-timeline.js +0 -410
  400. package/workspace/public/pm/initiatives-ui.js +0 -291
  401. package/workspace/public/pm/item-sheet.js +0 -268
  402. package/workspace/public/pm/keep-card.js +0 -204
  403. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  404. package/workspace/public/pm/lifecycle-lens.js +0 -276
  405. package/workspace/public/pm/lifecycle.js +0 -111
  406. package/workspace/public/pm/mobile.css +0 -366
  407. package/workspace/public/pm/mobile.js +0 -581
  408. package/workspace/public/pm/modes-live.js +0 -453
  409. package/workspace/public/pm/modes.js +0 -147
  410. package/workspace/public/pm/my-work-card.js +0 -51
  411. package/workspace/public/pm/my-work-data.js +0 -36
  412. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  413. package/workspace/public/pm/next-step-ui.js +0 -190
  414. package/workspace/public/pm/outbox-panel.js +0 -125
  415. package/workspace/public/pm/palette-copy.js +0 -55
  416. package/workspace/public/pm/palette.js +0 -343
  417. package/workspace/public/pm/panel-breakdown.js +0 -702
  418. package/workspace/public/pm/panel-cockpit.js +0 -425
  419. package/workspace/public/pm/panel-detail.js +0 -1513
  420. package/workspace/public/pm/panel-initiatives.js +0 -929
  421. package/workspace/public/pm/panel-newsess.js +0 -709
  422. package/workspace/public/pm/panel-repos.js +0 -741
  423. package/workspace/public/pm/panel-tabs.js +0 -1506
  424. package/workspace/public/pm/panel-trees.js +0 -204
  425. package/workspace/public/pm/people-link.js +0 -106
  426. package/workspace/public/pm/phone-deck.js +0 -167
  427. package/workspace/public/pm/pm-work-view.js +0 -1533
  428. package/workspace/public/pm/portfolio-report.js +0 -61
  429. package/workspace/public/pm/premium-acts.js +0 -280
  430. package/workspace/public/pm/premium-brief.js +0 -111
  431. package/workspace/public/pm/premium-chat.js +0 -22
  432. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  433. package/workspace/public/pm/premium-initiative.js +0 -324
  434. package/workspace/public/pm/premium-insights.css +0 -228
  435. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  436. package/workspace/public/pm/premium-report-brief.js +0 -132
  437. package/workspace/public/pm/premium-vw-rec.js +0 -67
  438. package/workspace/public/pm/premium-wide.css +0 -30
  439. package/workspace/public/pm/print.css +0 -44
  440. package/workspace/public/pm/provider-cards.js +0 -136
  441. package/workspace/public/pm/registry.js +0 -203
  442. package/workspace/public/pm/release-card.js +0 -110
  443. package/workspace/public/pm/releases-view.js +0 -248
  444. package/workspace/public/pm/report-families-view.js +0 -505
  445. package/workspace/public/pm/report-slides.js +0 -438
  446. package/workspace/public/pm/report-tab.js +0 -33
  447. package/workspace/public/pm/report-view.js +0 -337
  448. package/workspace/public/pm/reports-copy.js +0 -134
  449. package/workspace/public/pm/roadmap.js +0 -294
  450. package/workspace/public/pm/run-card.js +0 -260
  451. package/workspace/public/pm/sessions-panel.js +0 -219
  452. package/workspace/public/pm/sheet-jira.js +0 -353
  453. package/workspace/public/pm/shell-bell.js +0 -163
  454. package/workspace/public/pm/shell-model.js +0 -83
  455. package/workspace/public/pm/shell-phone.js +0 -124
  456. package/workspace/public/pm/shell-readaloud.js +0 -53
  457. package/workspace/public/pm/shell-recording.js +0 -274
  458. package/workspace/public/pm/shell-ticker.js +0 -90
  459. package/workspace/public/pm/sig-watch.js +0 -41
  460. package/workspace/public/pm/slide-confirm.js +0 -163
  461. package/workspace/public/pm/slides-copy.js +0 -52
  462. package/workspace/public/pm/status-banner.js +0 -95
  463. package/workspace/public/pm/tab-doc.js +0 -859
  464. package/workspace/public/pm/tab-gone.js +0 -21
  465. package/workspace/public/pm/tab-term.js +0 -1210
  466. package/workspace/public/pm/tab-web.js +0 -90
  467. package/workspace/public/pm/timeline-copy.js +0 -48
  468. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  469. package/workspace/public/pm/today-agenda.js +0 -331
  470. package/workspace/public/pm/today-cards.js +0 -244
  471. package/workspace/public/pm/today-copy.js +0 -506
  472. package/workspace/public/pm/today-day.js +0 -1371
  473. package/workspace/public/pm/today-goals.js +0 -297
  474. package/workspace/public/pm/today-jobs.js +0 -84
  475. package/workspace/public/pm/today-mentions.js +0 -50
  476. package/workspace/public/pm/topbar.js +0 -202
  477. package/workspace/public/pm/triage-card.js +0 -60
  478. package/workspace/public/pm/undo-hold.js +0 -103
  479. package/workspace/public/pm/view-addrepo.js +0 -208
  480. package/workspace/public/pm/view-files.js +0 -197
  481. package/workspace/public/pm/view-livenotes.js +0 -399
  482. package/workspace/public/pm/view-today.js +0 -13
  483. package/workspace/public/pm/view-validate.js +0 -171
  484. package/workspace/public/pm/welcome.js +0 -391
  485. package/workspace/public/pm/work-place.js +0 -68
  486. package/workspace/public/pm/xlsx-read.js +0 -117
  487. package/workspace/public/welcome.html +0 -22
  488. package/workspace/test-lists/browser-suites-green.json +0 -5
  489. package/workspace/test-lists/c3-core-docs.json +0 -9
  490. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  491. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  492. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  493. package/workspace/test-lists/c3-ib-items.json +0 -9
  494. package/workspace/test-lists/c3-ib-more.json +0 -9
  495. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  496. package/workspace/test-lists/c3-ini-life.json +0 -9
  497. package/workspace/test-lists/c3-meeting-board.json +0 -5
  498. package/workspace/test-lists/c3-meeting-card.json +0 -5
  499. package/workspace/test-lists/c3-notes-place.json +0 -5
  500. package/workspace/test-lists/c3-notes-series.json +0 -5
  501. package/workspace/test-lists/calendar-time-page.json +0 -5
  502. package/workspace/test-lists/calpop.json +0 -4
  503. package/workspace/test-lists/console3-briefing.json +0 -9
  504. package/workspace/test-lists/console3-foundation.json +0 -9
  505. package/workspace/test-lists/console3-work-page.json +0 -9
  506. package/workspace/test-lists/premium-brief-parity.json +0 -9
  507. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  508. package/workspace/test-lists/report-structure-ui.json +0 -11
  509. package/workspace/test-lists/report-workspace-ui.json +0 -5
  510. package/workspace/test-lists/run3-a.json +0 -5
  511. package/workspace/test-lists/run3-d.json +0 -6
  512. package/workspace/test-lists/run4-c.json +0 -13
  513. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  514. package/workspace/test-lists/today-mentions-cards.json +0 -5
  515. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,505 +0,0 @@
1
- /* pm/report-families-view.js — console3: the four report families, the claims check, the send slide and who-holds-what, behaving as the
2
- * console3 mockup's Reports tab does (console3.html lines 4205 to 4380: R2F, pjSecs/pdSecs/peSecs, rsRow, r2composer, cmRow, caseFor 'rpt:'/'com:').
3
- *
4
- * mountReportFamilies(host, ctx) / disposeReportFamilies(host). One persistent root per host.
5
- * Real mode: GET /api/report-families once; POST /api/report-families/check (pure); sections come from ctx.reportFacts (the facts route).
6
- * Demo mode (window.__c3demo, with window.__c3repix from c3-demo-rep-ix.js): the mockup's own reports, sections and messages; nothing is requested.
7
- *
8
- * What a press does:
9
- * - a section row opens IN PLACE (c3-expand): why it is here, the claims with their label and a Traced / Needs your input mark, the sources as
10
- * jump chips (they click the Initiatives, Calendar, Work or Briefing tab), and "Fix with the agent": it opens the report as a document on Ask the
11
- * agent with the fix written in, so the agent starts from the page and its draft is accepted only by the PM's slide (page-starts-agent).
12
- * - a swipe right approves a section and a swipe left cuts it (c3-swipe). In DEMO the decision is kept on the page, with an Undo toast. In REAL mode
13
- * no route stores a section decision, so the swipe is off and the legend and the row say why.
14
- * - the Send row opens the case file (c3-case) with the slide. DEMO: the slide marks the report Sent and adds it to the Sent card (nothing leaves).
15
- * REAL: opening the row queues ONE draft through POST /api/outbox/draft (the claim lines of the sections, labelled), the slide is bound to that
16
- * draft's hash and calls POST /api/outbox/confirm. With no channel connected the answer is "no channel connected" and the page says exactly that.
17
- * A claim line with no label or ticket key blocks the slide with the reason; customer-facing variants allow only fact and cited labels (server rule).
18
- * - Communications (demo): the message queue (swipe right sends, left holds, external needs the slide) and the who-holds-what truth table.
19
- * An agent can only draft. Sending is the PM's slide. Nothing here sends anything. */
20
- import { el } from './dom.js';
21
- import { strategyPanel } from './c3-strategy-panels.js';
22
- import { pmGet, pmPost } from './http.js';
23
- import { ensureC3Css, c3ic, c3ring, c3Phone } from './pm-work-view.js';
24
- import { attachExpand } from './c3-expand.js';
25
- import { attachSwipe } from './c3-swipe.js';
26
- import { renderCase } from './c3-case.js';
27
- import { openSheet } from './c3-sheet.js';
28
- import { toast } from './c3-toast.js';
29
- import { openDocSheet, splitDoc } from './c3-doc-sheet.js';
30
- import { forecastChecksCard } from './c3-misc-panels.js';
31
- import { c3btn } from './page-agent.js';
32
-
33
- const insts = new WeakMap();
34
- const FAM_ICON = { project: 'tree', product: 'target', communications: 'out', periodic: 'cal' };
35
- const fixPrompt = (s) => (s.st === 'stale' ? 'Bring the section “' + s.h + '” up to date with its sources.' : 'Fix the section “' + s.h + '”: give each claim a label (fact, cited or reported) and its source or ticket key.');
36
- const NO_STORE = 'Approving or cutting a section is not recorded here yet: no record stores a section decision.';
37
- const dim = (t) => el('span', { class: 'dim mono', style: 'font-size:var(--fs-2)' }, t);
38
- const rx = () => (typeof window !== 'undefined' && window.__c3demo && window.__c3repix) || null;
39
- const cap = (s) => { const t = String(s || '').replace(/_/g, ' '); return t.charAt(0).toUpperCase() + t.slice(1); };
40
-
41
- function make(host) {
42
- return { host, root: el('div', { class: 'c3', 'data-report-families': '' }), families: null, error: null, sel: null, variant: null, rep: { project: 'pj1', product: 'pd1' }, check: null, seq: 0,
43
- dec: {}, flagged: {}, sent: {}, csent: {}, chold: {}, open: {}, hist: null, docText: {}, cleanups: [], draft: null, draftErr: null, draftBusy: false, outMsg: {}, outSent: null };
44
- }
45
-
46
- /* ── jump to the source: the page's own tab buttons (the mockup's RSRC) ── */
47
- const RSRC = { time: ['init', 'forecast'], tix: ['init', 'tickets'], wbs: ['init', 'breakdown'], docs: ['init', 'documents'], sig: ['init', 'signals'], life: ['init', 'lifecycle'], roadmap: ['init', 'roadmap'], strat: ['init', 'lifecycle'], comms: ['rep', 'communications'], brief: ['brief'], cal: ['cal'], work: ['work'] };
48
- function jump(kind) {
49
- const t = RSRC[kind];
50
- if (!t) return;
51
- const tab = document.querySelector('[data-c3-tab="' + t[0] + '"]');
52
- if (tab) tab.click();
53
- if (!t[1]) return;
54
- let n = 0;
55
- const go = () => {
56
- const b = t[0] === 'init' ? document.querySelector('[data-c3-init="' + t[1] + '"]') : document.querySelector('[data-family="' + t[1] + '"]');
57
- if (b) b.click(); else if (++n < 25) setTimeout(go, 80);
58
- };
59
- go();
60
- }
61
- /* a real claim's source text → the view that holds it (only the ones that name one) */
62
- function kindOf(text) {
63
- const t = String(text || '').toLowerCase();
64
- if (/jira|ticket/.test(t)) return 'tix'; if (/calendar/.test(t)) return 'cal'; if (/timeline|forecast/.test(t)) return 'time'; if (/analytics|signal/.test(t)) return 'sig'; if (/brief/.test(t)) return 'brief';
65
- return '';
66
- }
67
-
68
- /* ── the model: variants, sections and counts, from the demo fixtures or the real facts ── */
69
- const famOf = (inst) => inst.families.find((f) => f.id === inst.sel);
70
- const variantsOf = (inst, fam) => { const R = rx(); return R ? R.pills(fam.id) : fam.variants.map((v) => ({ id: v.id, name: v.name, external: !!v.external })); };
71
- const repIdOf = (inst, fam) => (fam.id === 'periodic' ? inst.variant : (inst.rep[fam.id] || 'r'));
72
- const keyOf = (inst, fam) => fam.id + '.' + repIdOf(inst, fam) + '.' + (fam.id === 'periodic' ? 'x' : inst.variant);
73
- const variantOf = (inst, fam) => variantsOf(inst, fam).find((v) => v.id === inst.variant) || variantsOf(inst, fam)[0] || { id: '', name: '' };
74
- const repOf = (inst, fam) => { const R = rx(); return R ? ((R.REPORTS[fam.id] || []).find((r) => r.id === repIdOf(inst, fam)) || (R.REPORTS[fam.id] || [])[0] || null) : null; };
75
-
76
- /* a report is a document (the mockup's r2doc): the sections the sheet saved flow back into the rows (the mockup's r2text) */
77
- const docPath = (fam, rid, variant) => 'planning/reports/' + fam + '-' + rid + '-' + variant + '.md';
78
- const pathOf = (inst, fam) => docPath(fam.id, repIdOf(inst, fam), inst.variant);
79
- function withDoc(inst, fam, secs) {
80
- const text = inst.docText[pathOf(inst, fam)]; if (!text) return secs;
81
- const sp = splitDoc(text);
82
- return secs.map((s) => { const m = sp.find((x) => x.name === s.h); return m && m.text !== s.t ? { ...s, t: m.text, edited: true } : s; });
83
- }
84
- function sectionsOf(inst, fam, ctx) { return withDoc(inst, fam, baseSections(inst, fam, ctx)); }
85
- function baseSections(inst, fam, ctx) {
86
- const R = rx();
87
- if (R) return R.sections(fam.id, repIdOf(inst, fam), inst.variant);
88
- const given = (ctx && ctx.reportFacts && ctx.reportFacts[fam.id]) || [];
89
- return fam.sections.map((name, i) => {
90
- const g = given.find((s) => s.name === name) || { name, title: cap(name), claims: [] };
91
- const r = inst.check && inst.check.sections && inst.check.sections[i];
92
- const claims = (g.claims || []).map((c) => ({ text: (c && (c.text || c.id)) || String(c), label: c && c.basis, source: c && c.source, ok: !(c && c.ok === false) }));
93
- const st = !r ? 'check' : r.stale_source > 0 ? 'stale' : (r.needs_input > 0 || r.traced === 0) ? 'check' : 'ok';
94
- const src = []; const seen = new Set();
95
- for (const c of claims) if (c.source && !seen.has(c.source)) { seen.add(c.source); src.push(['doc', c.source, kindOf(c.source)]); }
96
- return { id: name, h: g.title ? cap(g.title) : cap(name), t: claims.length ? claims.map((c) => c.text).join(' ') : 'No claim has been written for this section yet.', src, st, by: 'Records', why: '', claims };
97
- });
98
- }
99
- const decOf = (inst, key, id) => inst.dec[key + '|' + id] || '';
100
- function readyOf(inst, key, secs) {
101
- const d = (s) => decOf(inst, key, s.id);
102
- return { n: secs.length - secs.filter((s) => d(s) === 'cut').length, ap: secs.filter((s) => d(s) === 'ok').length, fl: secs.filter((s) => s.st !== 'ok' && d(s) !== 'ok' && d(s) !== 'cut').length };
103
- }
104
-
105
- /* ── loading ── */
106
- async function load(inst, ctx) {
107
- const j = await pmGet('/api/report-families');
108
- if (!insts.has(inst.host)) return;
109
- if (!j || j.ok === false) inst.error = (j && j.error) || 'Could not read the report families.';
110
- else { inst.families = j.families || []; inst.error = null; if (!inst.sel && inst.families[0]) { inst.sel = inst.families[0].id; inst.variant = defaultVariant(inst, inst.families[0]); } }
111
- if (!rx()) { const o = await pmGet('/api/outbox'); if (insts.has(inst.host) && o && o.ok) inst.outSent = (o.entries || []).filter((e) => e.state === 'sent'); }
112
- inst.hist = null;
113
- await runCheck(inst, ctx);
114
- }
115
- const defaultVariant = (inst, fam) => (variantsOf(inst, fam)[0] || {}).id || null;
116
-
117
- async function runCheck(inst, ctx) {
118
- const fam = inst.families && famOf(inst);
119
- if (!fam) { draw(inst, ctx); return; }
120
- if (rx()) { draw(inst, ctx); return; } // the demo's sections carry their own state; no request
121
- const seq = ++inst.seq;
122
- const j = await pmPost('/api/report-families/check', { family: inst.sel, variant: inst.variant, sections: (fam.sections || []).map((name) => { const g = ((ctx && ctx.reportFacts && ctx.reportFacts[inst.sel]) || []).find((s) => s.name === name); return g || { name, title: cap(name), claims: [] }; }) });
123
- if (seq !== inst.seq || !insts.has(inst.host)) return;
124
- inst.check = j && j.ok ? j : null;
125
- draw(inst, ctx);
126
- }
127
-
128
- function pick(inst, ctx, fam, variant) { inst.sel = fam.id; inst.variant = variant || defaultVariant(inst, fam); inst.check = null; inst.draft = null; inst.draftErr = null; draw(inst, ctx); runCheck(inst, ctx); }
129
-
130
- /* ── pieces lifted from the demo path of the earlier pass: the forecast chart, the reports list ── */
131
- const NSV = 'http://www.w3.org/2000/svg';
132
- const sv = (tag, attrs, ...kids) => { const n = document.createElementNS(NSV, tag); for (const k of Object.keys(attrs || {})) n.setAttribute(k, attrs[k]); for (const c of kids) if (c) n.appendChild(c); return n; };
133
- const svt = (x, y, t, a) => { const n = sv('text', { x, y, ...(a || {}) }); n.textContent = t; return n; };
134
-
135
- function reportsList(inst, ctx, fam, list, selId) {
136
- const choose = (id) => { inst.rep[fam.id] = id; inst.draft = null; draw(inst, ctx); };
137
- return el('section', { class: 'card sect', 'data-rp-section': 'reports' }, el('div', { class: 'sh2' }, el('h2', null, c3ic('doc', 'sm'), 'Reports ', el('span', { class: 'bdg g' }, String(list.length)))),
138
- el('ul', { class: 'list' }, list.map((r) => {
139
- const on = r.id === selId;
140
- const li = el('li', { class: 'nrow', 'data-row': '', 'data-a': 'rsel', 'data-report': r.id, tabindex: '0', 'aria-current': String(on), style: on ? 'background:var(--accw);border-radius:8px' : null },
141
- el('span', { class: 'ki' }, c3ic(on ? 'eye' : 'doc')),
142
- el('div', { class: 'nb' }, el('span', { class: 'tt' }, r.n), el('div', { class: 'chips' }, el('span', { class: 'chip2' }, c3ic('clock', 'sm'), 'Due ' + r.due))));
143
- li.addEventListener('click', () => choose(r.id));
144
- li.addEventListener('keydown', (e) => { if (e.target === li && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); choose(r.id); } });
145
- return li;
146
- })));
147
- }
148
-
149
- /* ── a section row (the mockup's rsRow) ── */
150
- const ORIG = { Agent: ['spark', 'var(--purple)', 'Agent wrote'], You: ['user', 'var(--acc)', 'You'], Records: ['doc', 'var(--muted-foreground)', 'From records'] };
151
- const STATE = { ok: ['var(--success)', 'Traced', 'check'], stale: ['var(--warning)', 'Stale source', 'alert'], check: ['var(--acc)', 'Needs your input', 'eye'] };
152
- const LABEL_TONE = { fact: ['check', 'ok'], cited: ['check', 'ok'], reported: ['user', ''], estimate: ['clock', 'warn'], assumption: ['alert', 'warn'], judgement: ['eye', ''] };
153
-
154
- function claimRow(c) {
155
- const L = LABEL_TONE[c.label];
156
- const bad = c.ok === false || !L;
157
- const traced = !bad && (c.label === 'fact' || c.label === 'cited' || c.label === 'reported');
158
- return el('li', { class: bad ? 'bad' : L[1], 'data-claim': '' }, c3ic(bad ? 'alert' : L[0], 'sm'), el('span', null, c.text + ' ', el('b', { class: 'dim', style: 'font-weight:500' }, traced ? 'Traced' : 'Needs your input')),
159
- el('span', { class: 'tag' }, (c.label || 'unlabelled') + (c.source ? ' · ' + c.source : '')));
160
- }
161
- function detail(s, onFix) {
162
- const claims = s.claims && s.claims.length ? s.claims.map(claimRow) : [el('li', { class: s.st === 'ok' ? 'ok' : s.st === 'stale' ? 'warn' : 'warn' }, c3ic(STATE[s.st][2], 'sm'), el('span', null, STATE[s.st][1] + (s.st === 'stale' ? ': a source is out of date. Refresh it before this goes out.' : s.st === 'check' ? ': a person decides this one.' : ': every number has a source.')), el('span', { class: 'tag' }, 'claims check'))];
163
- const chips = s.src.length ? s.src.map((q) => (q[2] ? el('button', { type: 'button', class: 'chip2 lk', 'data-a': 'rsrc', 'data-k': q[2], onClick: (e) => { e.stopPropagation(); jump(q[2]); } }, c3ic(q[0], 'sm'), q[1], c3ic('next', 'sm'))
164
- : el('span', { class: 'chip2' }, c3ic(q[0], 'sm'), q[1]))) : [el('span', { class: 'dim', style: 'font-size:var(--fs-2)' }, s.by === 'You' ? 'Your judgement. No source to trace.' : 'No source is recorded for this section.')];
165
- return el('div', { class: 'dpn' },
166
- s.why ? el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, c3ic('info', 'sm'), ' Why it is here: ' + s.why) : null,
167
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Claims check'), el('ul', { class: 'chgl' }, claims),
168
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Where it comes from'), el('div', { class: 'chips2', style: 'flex-wrap:wrap' }, chips),
169
- s.st !== 'ok' ? el('div', { class: 'chips2' }, c3btn('chip2 lk', { 'data-rp-act': 'fix' }, [c3ic('spark', 'sm'), 'Fix with the agent'], (e) => { e.stopPropagation(); if (onFix) onFix(s); })) : null);
170
- }
171
-
172
- function sectionRow(inst, ctx, fam, key, s, onFix) {
173
- const DEMO = !!rx();
174
- const k = key + '|' + s.id; const dst = decOf(inst, key, s.id);
175
- const cc = STATE[s.st]; const o = ORIG[s.by] || ORIG.Agent;
176
- const li = el('li', { class: 'nrow' + (dst === 'cut' ? ' cutr' : ''), 'data-row': '', 'data-section': s.id, 'data-rs': k, tabindex: '0', style: dst === 'cut' ? 'opacity:.5' : null });
177
- const xp = el('div', { class: 'xp' }, el('div', { class: 'xi' }, detail(s, onFix)));
178
- li.append(el('span', { class: 'ki', style: 'color:' + (dst === 'ok' ? 'var(--success)' : cc[0]) }, c3ic(dst === 'ok' ? 'check' : dst === 'cut' ? 'x' : cc[2])),
179
- el('div', { class: 'nb' }, el('span', { class: 'tt' }, s.h), el('div', { class: 'dim', style: 'font-size:var(--fs-2);margin-top:2px' }, s.t),
180
- el('div', { class: 'chips' }, el('span', { class: 'chip2', style: 'color:' + o[1] }, c3ic(o[0], 'sm'), o[2]), el('span', { class: 'chip2', style: 'color:' + cc[0] }, c3ic(cc[2], 'sm'), cc[1]),
181
- dst ? el('span', { class: 'chip2' }, dst === 'ok' ? 'Approved' : 'Cut') : null), xp));
182
- if (DEMO) li.append(el('span', { class: 'sg', title: 'Suggested: approve (drag right)' }, el('span', { class: 'g l' }, c3ic('moon')), el('span', { class: 'g r y' }, c3ic('check'))));
183
- const ex = attachExpand(li, xp, { key: k, initial: !!inst.open[k], onToggle: (on) => { inst.open[k] = on; } });
184
- inst.cleanups.push(ex.detach);
185
- if (DEMO) {
186
- const decide = (side) => {
187
- const prev = inst.dec[k];
188
- inst.dec[k] = side === 'right' ? 'ok' : 'cut';
189
- li.classList.add('leave');
190
- setTimeout(() => { toast(side === 'right' ? 'Section approved' : 'Section cut', () => { if (prev) inst.dec[k] = prev; else delete inst.dec[k]; inst.draft = null; draw(inst, ctx); }); inst.draft = null; draw(inst, ctx); }, 230);
191
- };
192
- inst.cleanups.push(attachSwipe(li, { onRight: () => decide('right'), onLeft: () => decide('left'), labelRight: 'Approve', labelLeft: 'Cut', iconRight: 'check', iconLeft: 'moon' }));
193
- } else li.setAttribute('aria-description', NO_STORE);
194
- return li;
195
- }
196
-
197
- /* ── the report as a document (the mockup's docopen, console3.html 4136 and 4335): the DOCUMENT SHEET with its six modes ── */
198
- const mdOf = (secs) => secs.map((s) => '## ' + s.h + '\n' + s.t + '\n').join('\n');
199
- const EDGE = { ok: ['in sync', 'ok', 'check'], stale: ['out of sync', 'bad', 'alert'], check: ['needs your input', '', 'eye'] };
200
- const NO_STORE_WHY = 'Issue this report first. Editing by hand and asking the agent change a stored document, and this report has none yet: it is generated from the records each time the page opens. Nothing is lost.';
201
-
202
- /** Real mode with no stored document: the checks are the claims check, one per section (traced, or not). */
203
- function generatedHealth(secs) {
204
- const checks = secs.map((s) => ({ id: s.id, name: s.h, pass: s.st === 'ok', reason: s.st === 'ok' ? 'every number has a source' : s.st === 'stale' ? 'a source is out of date' : 'a person decides this one' }));
205
- return { passed: checks.filter((c) => c.pass).length, total: checks.length, checks };
206
- }
207
-
208
- function reportRelations(inst, secs, repName, getSheet) {
209
- return (doc) => {
210
- const seen = new Map();
211
- secs.forEach((s) => (s.src || []).forEach((q) => { const e = seen.get(q[1]) || { q, st: [] }; e.st.push(s); seen.set(q[1], e); }));
212
- const stOf = (e) => (e.st.some((s) => s.st === 'stale') ? 'stale' : e.st.some((s) => s.st === 'check') ? 'check' : 'ok');
213
- const R = rx(); const sent = R ? ((inst.hist && inst.hist[(famOf(inst) || {}).id]) || []).filter((h) => h[1] === repName) : (inst.outSent || []).filter((e) => (e.subject || '').indexOf(repName) === 0);
214
- const go = (kind) => { const sh = getSheet(); if (sh) sh.close(); jump(kind); };
215
- return el('div', { class: 'dpn', 'data-doc-relations': '' },
216
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'This report cites'),
217
- seen.size ? el('ul', { class: 'chgl' }, [...seen.values()].map((e) => { const x = EDGE[stOf(e)]; return el('li', { class: x[1], 'data-edge': stOf(e) }, c3ic(x[2], 'sm'),
218
- el('span', null, e.q[1] + ' · ', el('b', null, e.st.map((s) => s.h).join(', ')), ' · ' + x[0] + ' ', e.q[2] ? el('button', { type: 'button', class: 'chip2 lk', 'data-a': 'rsrc', 'data-k': e.q[2], onClick: () => go(e.q[2]) }, c3ic('next', 'sm'), 'Open') : null)); }))
219
- : el('div', { class: 'fold' }, c3ic('info', 'sm'), 'No section cites a source yet.'),
220
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Cited by'),
221
- sent.length ? el('ul', { class: 'chgl' }, sent.map((h) => (Array.isArray(h)
222
- ? el('li', { class: 'ok' }, c3ic('out', 'sm'), el('span', null, h[1] + ' · sent to ' + h[2] + ' · ' + h[0] + ' · ' + h[3]))
223
- : el('li', { class: 'ok' }, c3ic('out', 'sm'), el('span', null, (h.subject || h.channel) + ' · ' + h.state)))))
224
- : el('div', { class: 'fold' }, c3ic('info', 'sm'), 'Nothing cites this report yet: it has not been sent.'),
225
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Each section of the report is traced to its source in Initiatives, Calendar or Work.'));
226
- };
227
- }
228
-
229
- function secExtraOf(secs, getSheet) {
230
- return (name) => {
231
- const s = secs.find((x) => x.h === name); if (!s) return null;
232
- const claims = s.claims && s.claims.length ? s.claims.map(claimRow) : [];
233
- const chips = (s.src || []).map((q) => (q[2] ? el('button', { type: 'button', class: 'chip2 lk', 'data-a': 'rsrc', 'data-k': q[2], onClick: () => { const sh = getSheet(); if (sh) sh.close(); jump(q[2]); } }, c3ic(q[0], 'sm'), q[1], c3ic('next', 'sm')) : el('span', { class: 'chip2' }, c3ic(q[0], 'sm'), q[1])));
234
- const stt = STATE[s.st];
235
- return el('div', { class: 'dpn', 'data-rp-claims': s.id },
236
- claims.length ? el('ul', { class: 'chgl' }, claims) : null,
237
- el('div', { class: 'chips2', style: 'flex-wrap:wrap' }, el('span', { class: 'chip2', style: 'color:' + stt[0] }, c3ic(stt[2], 'sm'), stt[1]), chips.length ? chips : el('span', { class: 'dim', style: 'font-size:var(--fs-2)' }, s.by === 'You' ? 'Your judgement. No source to trace.' : 'No source is recorded for this section.')));
238
- };
239
- }
240
-
241
- /** Open a report (or a communications message) as a document. path/name name it; secs are its sections; mode is the segment to start on. */
242
- async function openReportDoc(inst, ctx, { fam, path, name, aud, repName, secs, mode, prompt }) {
243
- const ws = (ctx && ctx.ws) || '';
244
- let text = null;
245
- try { const r = await fetch('/api/doc?ws=' + encodeURIComponent(ws) + '&path=' + encodeURIComponent(path)); if (r.ok) text = await r.text(); } catch { /* no stored document */ }
246
- if (!insts.has(inst.host)) return;
247
- const stored = text != null;
248
- if (stored) inst.docText[path] = text;
249
- let sheet = null; const getSheet = () => sheet;
250
- const doc = { path, name, ty: 'Report', v: stored ? 'v1' : '', st: 'draft', ini: '', iniName: 'Portfolio' };
251
- sheet = openDocSheet({ ws, doc, mode: mode || 'read', prompt: prompt || '', relations: reportRelations(inst, secs, repName || name, getSheet), secExtra: secExtraOf(secs, getSheet),
252
- generated: stored ? null : { text: mdOf(secs), why: NO_STORE_WHY, health: generatedHealth(secs) },
253
- onChanged: async () => { try { const r = await fetch('/api/doc?ws=' + encodeURIComponent(ws) + '&path=' + encodeURIComponent(path)); if (r.ok) { inst.docText[path] = await r.text(); draw(inst, ctx); } } catch { /* the rows keep what they show */ } } });
254
- void aud; void fam;
255
- return sheet;
256
- }
257
-
258
- /* ── Send: the case file and the slide ── */
259
- function bodyOf(inst, key, fam, aud, secs) {
260
- const lines = [];
261
- for (const s of secs) {
262
- if (decOf(inst, key, s.id) === 'cut') continue;
263
- for (const c of s.claims || []) { const key = /\b[A-Z][A-Z0-9]+-\d+\b/.exec(c.source || ''); const lab = key ? key[0] : c.label; lines.push('- ' + c.text + (lab ? ' [' + lab + ']' : '')); }
264
- }
265
- return lines.length ? fam.name + ' report for ' + aud + '\n' + lines.join('\n') : '';
266
- }
267
- async function ensureDraft(inst, ctx, fam, key, aud, secs) {
268
- const body = bodyOf(inst, key, fam, aud, secs);
269
- if (!body || inst.draftBusy) return;
270
- if ((inst.draft && inst.draft.body === body) || (inst.draftErr && inst.draftErr.body === body)) return;
271
- inst.draftBusy = true;
272
- const r = await pmPost('/api/outbox/draft', { channel: 'customer-note', recipient: aud, subject: fam.name + ' report for ' + aud, body });
273
- inst.draftBusy = false;
274
- if (!insts.has(inst.host)) return;
275
- if (r && r.ok && r.entry) { inst.draft = { entry: r.entry, body }; inst.draftErr = null; } else { inst.draft = null; inst.draftErr = { body, error: (r && (r.error || r.reason)) || 'The draft could not be queued.' }; }
276
- draw(inst, ctx);
277
- }
278
- async function confirmReal(inst, ctx, hashFull) {
279
- const d = inst.draft; const hash = String(hashFull).split('|')[0];
280
- let text;
281
- if (!d || d.entry.hash !== hash) text = 'The content changed after the slide was prepared. Nothing was sent. Slide again.';
282
- else {
283
- const r = await pmPost('/api/outbox/confirm', { id: d.entry.id, hash });
284
- if (r && r.ok) text = 'Sent.';
285
- else if (r && r.reason === 'no channel connected') text = 'No channel connected. Nothing was sent. The draft stays queued in the outbox.';
286
- else text = 'Not sent: ' + ((r && (r.reason || r.error)) || 'no answer') + '.';
287
- }
288
- if (!insts.has(inst.host)) return;
289
- inst.outMsg[inst.draft ? inst.draft.entry.id : 'x'] = text;
290
- toast(text);
291
- draw(inst, ctx);
292
- }
293
-
294
- function sendCase(inst, ctx, fam, key, secs, q, aud, repName, vr) {
295
- const DEMO = !!rx();
296
- /* "Resolve the flagged sections first" (the mockup's confirmCase): the case settles on that choice with an undo, and a toast says "Flags opened." The sections themselves stay as they are. */
297
- const open = () => { inst.flagged[key] = 1; toast('Flags opened.', () => { delete inst.flagged[key]; draw(inst, ctx); }); draw(inst, ctx); };
298
- const settled = (cs) => {
299
- cs.querySelectorAll('.opts,.c3slide').forEach((n) => n.remove());
300
- cs.append(el('div', { class: 'chips2', 'data-flags-settled': '' }, c3ic('check', 'sm'), el('b', { style: 'font-size:var(--fs-3);color:var(--success)' }, 'Resolve the flagged sections first'),
301
- el('button', { type: 'button', class: 'chip2 lk', onclick: () => { delete inst.flagged[key]; draw(inst, ctx); } }, c3ic('undo', 'sm'), 'undo')));
302
- return cs;
303
- };
304
- if (DEMO) {
305
- const R = rx();
306
- const model = { id: 'rpt:' + key, sit: 'The ' + repName + ' for ' + aud + ' has ' + q.ap + ' of ' + q.n + ' sections approved' + (q.fl ? ' and ' + q.fl + ' still need a look' : '') + '. Sending is final: it goes in the history with what it said.', conf: q.fl ? 64 : 86,
307
- chg: [['check', q.ap + ' of ' + q.n + ' sections approved', 'sections', q.ap === q.n ? 'ok' : 'warn'], ['alert', q.fl ? q.fl + ' section' + (q.fl > 1 ? 's' : '') + ' stale or unconfirmed' : 'All sections traced', 'claims check', q.fl ? 'warn' : 'ok'], ['user', 'Audience: ' + aud, 'audience']],
308
- opts: [{ id: 's', l: 'Send it', rec: q.fl ? 0 : 1, outward: true, fx: [['check', 'Recorded with its sources', 'ok']] }, { id: 'r', l: 'Resolve the flagged sections first', rec: q.fl ? 1 : 0, fx: [['eye', 'Review what is stale', 'ok']] }, { id: 'h', l: 'Not yet', fx: [] }] };
309
- const cs = renderCase(model, { outbox: true, onConfirm: ({ option }) => {
310
- if (option.id === 's') {
311
- const hist = inst.hist[fam.id]; const ent = ['Thu 8 Oct', repName, aud, 'just sent', ''];
312
- inst.sent[key] = 1; hist.unshift(ent);
313
- toast('Sent to ' + aud + '. It is in the history.', () => { delete inst.sent[key]; const i = hist.indexOf(ent); if (i >= 0) hist.splice(i, 1); draw(inst, ctx); });
314
- draw(inst, ctx);
315
- } else if (option.id === 'r') open(); else { toast('Held.'); draw(inst, ctx); }
316
- } });
317
- void R;
318
- return inst.flagged[key] ? settled(cs) : cs;
319
- }
320
- /* REAL: the draft is the unit; the slide is bound to its hash */
321
- const d = inst.draft; const err = inst.draftErr;
322
- const claimsN = secs.reduce((n, s) => n + (s.claims || []).length, 0);
323
- const blocked = d && !d.entry.claims.ok;
324
- const none = !claimsN || (!d && !err && !inst.draftBusy && !bodyOf(inst, key, fam, aud, secs));
325
- const chg = [];
326
- chg.push(['out', none ? 'No section has a claim yet: there is nothing to send.' : d ? 'Draft queued in the outbox, hash ' + d.entry.hash.slice(0, 10) : err ? err.error : 'Queuing the draft in the outbox.', 'outbox', none || err ? 'warn' : 'ok']);
327
- if (d) chg.push([d.entry.claims.ok ? 'check' : 'alert', d.entry.claims.ok ? 'Every claim line has a label.' : d.entry.claims.refused.length + ' claim line' + (d.entry.claims.refused.length > 1 ? 's fail' : ' fails') + ' the outbound trust rules (a label with its source, or a ticket key).', 'claims check', d.entry.claims.ok ? 'ok' : 'bad']);
328
- if (blocked) d.entry.claims.refused.forEach((l) => chg.push(['x', l, 'refused', 'bad']));
329
- if (vr && vr.external) chg.push(['shield', 'A customer report allows only fact and cited labels.', 'rule', 'warn']);
330
- chg.push(['user', 'Audience: ' + aud, 'audience']);
331
- const msg = d && inst.outMsg[d.entry.id];
332
- const model = { id: d ? d.entry.hash : 'rpt:' + key, sit: msg || 'Nothing has been sent. The slide sends exactly this draft, bound to its hash, and only when a channel is connected.', conf: q.fl ? 40 : 70, chg,
333
- outboxReason: none ? 'Nothing to send: no section has a claim yet.' : blocked ? 'Blocked: a claim line has no label the rules accept, or no ticket key. Fix it or cut it.' : err ? err.error : 'The draft is not ready yet.',
334
- opts: [{ id: 's', l: 'Send it', rec: q.fl ? 0 : 1, outward: true, fx: [['out', 'Goes through the outbox, bound to the hash', 'ok']] }, { id: 'r', l: 'Resolve the flagged sections first', rec: q.fl ? 1 : 0, fx: [['eye', 'Review what is stale', 'ok']] }, { id: 'h', l: 'Not yet', fx: [] }] };
335
- const cr = renderCase(model, { outbox: !!d && !blocked, onConfirm: ({ option, hash }) => { if (option.id === 's') confirmReal(inst, ctx, hash); else if (option.id === 'r') open(); else { toast('Held.'); draw(inst, ctx); } } });
336
- return inst.flagged[key] ? settled(cr) : cr;
337
- }
338
-
339
- function sendRow(inst, ctx, fam, key, secs, q, aud, repName, vr) {
340
- const DEMO = !!rx(); const sent = DEMO && inst.sent[key]; const k = key + '|send';
341
- const li = el('li', { class: 'nrow', 'data-row': '', 'data-send': '', tabindex: '0' });
342
- const xp = el('div', { class: 'xp' }, el('div', { class: 'xi' }));
343
- const fill = () => { const xi = xp.querySelector('.xi'); xi.replaceChildren(sendCase(inst, ctx, fam, key, secs, q, aud, repName, vr)); };
344
- li.append(el('span', { class: 'ki', style: 'color:' + (sent ? 'var(--success)' : 'var(--acc)') }, c3ic(sent ? 'check' : 'out')),
345
- el('div', { class: 'nb' }, el('span', { class: 'tt' }, sent ? 'Sent' : 'Send'), el('div', { class: 'dim', style: 'font-size:var(--fs-2)' },
346
- sent ? 'It is in the history with its sources.' : DEMO ? q.ap + ' of ' + q.n + ' approved. Slide to send, or swipe sections first.' : 'Slide to send. Nothing is sent while no channel is connected.'), xp));
347
- if (!sent) fill(); else xp.querySelector('.xi').replaceChildren(el('div', { class: 'fold' }, c3ic('check', 'sm'), 'Sent. It is in the history with its sources.'));
348
- const ex = attachExpand(li, xp, { key: k, initial: !!inst.open[k], onToggle: (on) => { inst.open[k] = on; if (on && !DEMO) ensureDraft(inst, ctx, fam, key, aud, secs); } });
349
- inst.cleanups.push(ex.detach);
350
- if (inst.open[k] && !DEMO) ensureDraft(inst, ctx, fam, key, aud, secs);
351
- return li;
352
- }
353
-
354
- /* ── Communications (demo): the queue ── */
355
- function cmRow(inst, ctx, c) {
356
- const st = inst.csent[c.id] ? 'sent' : inst.chold[c.id] ? 'held' : 'draft';
357
- const sc = { draft: ['var(--acc)', 'Draft'], held: ['var(--mfg)', 'Held'], sent: ['var(--success)', 'Sent'] }[st];
358
- const k = 'cm' + c.id;
359
- const sendIt = () => { inst.csent[c.id] = 1; const was = inst.chold[c.id]; delete inst.chold[c.id]; toast(c.ext ? 'Approved. Sent to ' + c.to + '.' : 'Sent to ' + c.to + '.', () => { delete inst.csent[c.id]; if (was) inst.chold[c.id] = was; draw(inst, ctx); }); draw(inst, ctx); };
360
- const hold = () => { inst.chold[c.id] = 1; toast('Held.', () => { delete inst.chold[c.id]; draw(inst, ctx); }); draw(inst, ctx); };
361
- const model = { id: 'com:' + c.id, quote: c.body, sit: c.why, conf: c.ext ? 72 : 84,
362
- chg: [['out', 'To ' + c.to + ' by ' + c.ch, 'channel'], ['user', 'Tone: ' + c.tone, 'agent'], ['alert', c.risk, 'risk', c.ext ? 'warn' : '']],
363
- opts: [{ id: 's', l: c.ext ? 'Approve and send' : 'Send now', rec: c.ext ? 0 : 1, outward: true, fx: [['check', 'Logged in the history', 'ok']] }, { id: 'o', l: 'Open and edit it first', rec: c.ext ? 1 : 0, fx: [] }, { id: 'h', l: 'Hold it', fx: [['clock', 'Reminder tomorrow']] }] };
364
- const cs = renderCase(model, { outbox: true, onConfirm: ({ option }) => { if (option.id === 's') sendIt(); else if (option.id === 'h') hold(); else { const m = (id, h, t) => ({ id, h, t, src: [], st: 'ok', by: 'Agent', why: '', claims: [] }); openReportDoc(inst, ctx, { fam: 'communications', path: docPath('communications', c.id, 'msg'), name: c.t, repName: c.t, aud: c.to, mode: 'edit', secs: [m('m', 'Message', c.body), m('w', 'Why now', c.why), m('t', 'Tone and risk', c.tone + '. ' + c.risk)] }); } } });
365
- inst.cleanups.push(() => cs.c3case.dispose());
366
- const li = el('li', { class: 'nrow', 'data-row': '', 'data-cm': c.id, tabindex: '0' });
367
- const xp = el('div', { class: 'xp' }, el('div', { class: 'xi' }, cs));
368
- li.append(el('span', { class: 'ki', style: 'color:' + sc[0] }, c3ic(c.ext ? 'out' : 'reply')),
369
- el('div', { class: 'nb' }, el('span', { class: 'tt' }, c.t), el('div', { class: 'chips' }, el('span', { class: 'chip2', style: 'color:' + sc[0] }, sc[1]), el('span', { class: 'chip2' }, c3ic('user', 'sm'), c.to), el('span', { class: 'chip2' }, c3ic('clock', 'sm'), c.due), el('span', { class: 'tag' }, c.ch),
370
- c.ext ? el('span', { class: 'st warn' }, c3ic('shield', 'sm'), 'external, you approve') : null), xp),
371
- el('span', { class: 'sg', title: 'Suggested: send (drag right)' }, el('span', { class: 'g l' }, c3ic('moon')), el('span', { class: 'g r y' }, c3ic('check'))));
372
- inst.cleanups.push(attachExpand(li, xp, { key: k, initial: !!inst.open[k], onToggle: (on) => { inst.open[k] = on; } }).detach);
373
- inst.cleanups.push(attachSwipe(li, { onRight: sendIt, onLeft: hold, labelRight: c.ext ? 'Approve and send' : 'Send', labelLeft: 'Hold', iconRight: 'out', iconLeft: 'moon', disabled: () => st === 'sent' }));
374
- return li;
375
- }
376
- function commsQueue(inst, ctx, fam) {
377
- const R = rx(); const aud = inst.variant || 'all';
378
- const L = R.COMMS.filter((c) => aud === 'all' || c.aud === aud);
379
- return el('section', { class: 'card sect', 'data-rp-section': 'queue' }, el('div', { class: 'sh2' }, el('h2', null, c3ic('out', 'sm'), 'Messages ', el('span', { class: 'bdg g' }, String(L.length))), dim('by when it matters')),
380
- el('ul', { class: 'list' }, L.map((c) => cmRow(inst, ctx, c))),
381
- el('div', { class: 'pgl' }, el('span', null, 'swipe right: send'), el('span', null, 'swipe left: hold'), el('span', null, 'external: you approve')));
382
- }
383
-
384
- /* ── right-hand cards ── */
385
- const bars = (rows) => el('div', { class: 'hbs' }, rows.map((r, i) => el('div', { class: 'hbr', style: '--c:' + r[2] }, el('div', { class: 'l' }, el('span', null, r[0]), el('i', null, String(r[3]))), el('div', { class: 'tk' }, el('u', { style: 'width:' + Math.max(2, r[1] * 100) + '%;animation-delay:' + (i * 90) + 'ms' })))));
386
-
387
- function claimsCard(secs) {
388
- const t = { ok: 0, stale: 0, check: 0 }; secs.forEach((s) => { t[s.st]++; });
389
- const all = Math.max(1, secs.length);
390
- return el('section', { class: 'card', 'data-rp-section': 'claims' }, el('h3', null, c3ic('shield'), 'Claims check ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'every number traced')),
391
- bars([['Traced to a source', t.ok / all, 'var(--success)', t.ok], ['Source is stale', t.stale / all, 'var(--warning)', t.stale], ['Needs your input', t.check / all, 'var(--acc)', t.check]]),
392
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'A report with an untraced number does not go out. Guesses are labelled as guesses.'));
393
- }
394
- function sentCard(inst, fam) {
395
- const R = rx();
396
- const head = el('h3', null, c3ic('clock'), 'Sent ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'who read it, what came back'));
397
- if (R) {
398
- const list = (inst.hist && inst.hist[fam.id]) || [];
399
- return el('section', { class: 'card', 'data-rp-section': 'sent' }, head, el('ul', { class: 'hx' }, list.map((h) => el('li', null, el('span', { class: 'chip2' }, c3ic('out', 'sm'), h[2]), el('span', null, h[1], el('small', null, h[3] + (h[4] ? ' · ' + h[4] : ''))), el('span', { class: 'w' }, h[0])))));
400
- }
401
- const sent = inst.outSent || [];
402
- return el('section', { class: 'card', 'data-rp-section': 'sent' }, head, sent.length ? el('ul', { class: 'hx' }, sent.map((e) => el('li', null, el('span', { class: 'chip2' }, c3ic('out', 'sm'), e.recipient || e.channel), el('span', null, (e.subject || e.body.split('\n')[0]), el('small', null, e.channel)), el('span', { class: 'w' }, e.state))))
403
- : el('div', { class: 'fold' }, c3ic('check', 'sm'), 'Nothing has been sent. No channel is connected, so nothing can go out yet.'));
404
- }
405
- function truthBlock(inst, ctx) {
406
- const R = rx();
407
- const sec = el('section', { class: 'card', 'data-rp-section': 'who-holds-what' }, el('h3', null, c3ic('user'), 'Who holds what ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'told against true now')));
408
- if (R) {
409
- sec.appendChild(el('ul', { class: 'hx' }, R.TRUTH.map((x) => { const cur = !x[4] || inst.csent.c1;
410
- return el('li', { 'data-person': x[0], 'data-state': cur ? 'in sync' : 'stale' }, el('span', { class: 'chip2', style: 'color:' + (cur ? 'var(--success)' : 'var(--destructive)') }, c3ic(cur ? 'check' : 'alert', 'sm'), x[0]),
411
- el('span', null, 'Told: ' + x[2], el('small', null, 'Now: ' + x[3] + (cur ? '' : ' · ' + x[4] + ' days apart'))), el('span', { class: 'w' }, x[1])); })));
412
- return sec;
413
- }
414
- const rows = (ctx && ctx.reportFacts && ctx.reportFacts.truthTable) || [];
415
- if (!rows.length) { sec.appendChild(el('div', { class: 'fold' }, c3ic('check', 'sm'), 'No message has told anyone a claim yet.')); return sec; }
416
- const tone = (s) => (s === 'contradicted' ? 'var(--destructive)' : s === 'stale' ? 'var(--warning)' : 'var(--success)');
417
- sec.appendChild(el('ul', { class: 'hx' }, rows.flatMap((p) => p.claims.map((c) => el('li', { 'data-person': p.person, 'data-state': c.state },
418
- el('span', { class: 'chip2', style: 'color:' + tone(c.state) }, c3ic(c.state === 'contradicted' || c.state === 'stale' ? 'alert' : 'check', 'sm'), p.person),
419
- el('span', null, c.text || c.id, el('small', null, c.state)), el('span', { class: 'w' }, c.state))))));
420
- return sec;
421
- }
422
- const guardCard = () => el('section', { class: 'card', 'data-rp-section': 'guardrails' }, el('h3', null, c3ic('shield'), 'Guardrails'),
423
- el('ul', { class: 'chgl' }, ['External messages need your approval. They are never sent automatically.', 'A claim line with no label or ticket key blocks the slide.', 'Every message is logged with what it said.', 'With no channel connected nothing is sent, and the page says so.'].map((t) => el('li', { class: 'ok' }, c3ic('check', 'sm'), el('span', null, t)))));
424
-
425
- /* ── the page ── */
426
- function draw(inst, ctx) {
427
- const root = inst.root;
428
- inst.cleanups.splice(0).forEach((f) => { try { f(); } catch { /* a detach that fails changes nothing */ } });
429
- if (inst.error) { root.replaceChildren(el('div', { class: 'fold w', role: 'alert' }, c3ic('alert', 'sm'), inst.error)); return; }
430
- if (!inst.families) { root.replaceChildren(el('div', { class: 'fold a', role: 'status' }, el('span', { class: 'c3spin' }, c3ic('spark', 'sm')), 'Reading the report families.')); return; }
431
- const R = rx();
432
- if (R && !inst.hist) inst.hist = JSON.parse(JSON.stringify(R.HIST));
433
- const fam = famOf(inst);
434
- const badges = ctx && ctx.reportFacts && ctx.reportFacts.badges;
435
- const draftN = R ? R.COMMS.filter((c) => !inst.csent[c.id] && !inst.chold[c.id]).length : (badges && badges.communications) || 0;
436
- const seg = el('div', { class: 'seg', role: 'group', 'aria-label': 'Report type', 'data-rp-section': 'families' }, inst.families.map((f) => el('button', { type: 'button', 'data-a': 'rfam', 'data-family': f.id, 'aria-pressed': String(f.id === inst.sel), 'aria-current': f.id === inst.sel ? 'true' : null,
437
- title: f.intent + ' · ' + f.cadence, onClick: () => pick(inst, ctx, f) }, c3ic(FAM_ICON[f.id] || 'doc', 'sm'), f.name, f.id === 'communications' && draftN ? [' ', el('span', { class: 'bdg' }, String(draftN))] : null)));
438
- const bar = el('div', { class: 'calbar', style: 'flex-wrap:wrap' }, seg,
439
- fam ? el('div', { class: 'chips2', role: 'group', 'aria-label': fam.name + ' variants' }, variantsOf(inst, fam).map((v) => el('button', { type: 'button', class: 'pill', 'data-a': fam.id === 'periodic' ? 'rsel' : 'raud', 'data-variant': v.id, 'aria-pressed': String(v.id === inst.variant), onClick: () => { inst.variant = v.id; inst.draft = null; inst.draftErr = null; if (!R) { inst.check = null; draw(inst, ctx); runCheck(inst, ctx); } else draw(inst, ctx); } }, v.name))) : null);
440
- let body = el('div', { class: 'fold' }, c3ic('check', 'sm'), 'No report family is defined.');
441
- if (fam) {
442
- const key = keyOf(inst, fam); const vr = variantOf(inst, fam); const rep = repOf(inst, fam);
443
- const secs = sectionsOf(inst, fam, ctx);
444
- const q = readyOf(inst, key, secs);
445
- const audName = R ? (fam.id === 'periodic' ? rep.aud : vr.name) : (vr.name || fam.name);
446
- const repName = R && rep ? rep.n : fam.name;
447
- const comms = { drafts: draftN, sent: R ? R.COMMS.filter((c) => inst.csent[c.id]).length : 0 };
448
- const hd = R ? R.info(fam.id, repIdOf(inst, fam), audName, q, comms) : null;
449
- const traced = secs.filter((s) => s.st === 'ok').length;
450
- const head = el('div', { class: 'lh' }, el('span', { class: 'ki' }, c3ic(FAM_ICON[fam.id] || 'doc')),
451
- el('div', { style: 'min-width:0' }, el('b', null, hd ? hd.h : fam.name + ': ' + traced + ' of ' + secs.length + ' sections traced'), el('div', { class: 'dim', 'data-rp-section-purpose': '' }, hd ? hd.s : fam.purpose)),
452
- hd ? c3ring(hd.p[0], Math.max(1, hd.p[1]), 44) : c3ring(traced, Math.max(1, secs.length), 44, traced + '/' + secs.length));
453
- const F = R ? R.FAMS[fam.id] : null;
454
- const facts = el('div', { class: 'lkrow' }, [['target', 'Purpose', F ? F.purpose : fam.purpose], ['user', 'Audience', F ? F.aud : fam.variants.map((v) => v.audience).join(', ')], ['bolt', 'Intent', F ? F.intent : fam.intent], ['cal', 'Cadence', F ? F.cad : fam.cadence]]
455
- .map((x) => el('span', { class: 'chip2', title: x[2] }, c3ic(x[0], 'sm'), el('b', { style: 'font-weight:600' }, x[1]), ' ' + String(x[2] || '').slice(0, 38))));
456
- const c = inst.check;
457
- const notes = !R && c ? [...(c.reasons || []).map((t) => el('div', { class: 'fold w', 'data-blocked': '' }, c3ic('alert', 'sm'), t)), ...(c.warnings || []).map((t) => el('div', { class: 'fold w' }, c3ic('info', 'sm'), t))] : [];
458
- /* the report card: a row per section, then Send */
459
- const doc = el('section', { class: 'card sect', 'data-rp-section': 'family', 'aria-label': fam.name },
460
- el('div', { class: 'sh2' }, el('h2', null, c3ic('doc', 'sm'), repName + ' ', R ? el('span', { class: 'chip2' }, c3ic('user', 'sm'), audName) : el('span', { class: 'bdg g' }, String(secs.length)), R ? null : dim(vr.name)),
461
- el('span', { class: 'chips2' }, el('button', { type: 'button', class: 'ib sm', 'data-a': 'docopen', title: 'Open as a document to edit by hand or ask the agent', 'aria-label': 'Open as a document to edit by hand or ask the agent', onClick: () => openReportDoc(inst, ctx, { fam, path: pathOf(inst, fam), name: repName + ' for ' + audName, aud: audName, repName, secs: secs.filter((s) => decOf(inst, key, s.id) !== 'cut') }) }, c3ic('notes', 'sm')))),
462
- el('ul', { class: 'list' }, secs.length ? [...secs.map((s) => sectionRow(inst, ctx, fam, key, s, (x) => openReportDoc(inst, ctx, { fam, path: pathOf(inst, fam), name: repName + ' for ' + audName, aud: audName, repName, secs: secs.filter((q) => decOf(inst, key, q.id) !== 'cut'), mode: 'ask', prompt: fixPrompt(x) }))), sendRow(inst, ctx, fam, key, secs, q, audName, repName, vr)] : el('li', { class: 'fold' }, c3ic('check', 'sm'), 'This family has no sections.')),
463
- el('div', { class: 'pgl' }, R ? [el('span', null, 'swipe right: approve'), el('span', null, 'swipe left: cut'), el('span', null, 'tap: where it comes from')] : [el('span', null, 'tap: where it comes from'), el('span', null, 'approve and cut: off, no record stores them')]),
464
- notes.length ? el('div', { 'data-rp-section': 'check-notes', style: 'display:grid;gap:var(--sp-2)' }, notes) : null);
465
- const rf = (ctx && ctx.reportFacts) || {};
466
- const sctx = { goInit: (id) => { if (ctx && ctx.openInitiative) ctx.openInitiative(ctx.repo, id); } };
467
- const left = [(ctx && ctx.plan) || null];
468
- let right = [];
469
- if (R && fam.id === 'communications') { left.push(commsQueue(inst, ctx, fam)); right = [truthBlock(inst, ctx), el('section', { class: 'card', 'data-rp-section': 'channels' }, el('h3', null, c3ic('out'), 'Channels'), bars(R.CHANNELS)), guardCard(), sentCard(inst, fam)]; }
470
- else {
471
- if (R && R.REPORTS[fam.id] && fam.id !== 'periodic') left.push(reportsList(inst, ctx, fam, R.REPORTS[fam.id], repIdOf(inst, fam)));
472
- left.push(doc);
473
- if (fam.id === 'project') { const rp = repOf(inst, fam); const nm = (R && R.INM) || {}; right.push((ctx && ctx.portfolio) || null, forecastChecksCard(rp && rp.i ? { id: rp.i, title: nm[rp.i] || String(rp.n || '').replace(/ status$/, '') } : {})); }
474
- if (fam.id === 'product') right.push(strategyPanel('north', sctx, { view: 'year', plain: true }), strategyPanel('outcomes', sctx)); // the mockup's product report (line 4345): north star, quarter outcomes, then the benchmark
475
- if (R && fam.id === 'product') right.push(el('section', { class: 'card', 'data-rp-section': 'benchmark' }, el('h3', null, c3ic('report'), 'Benchmark ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'checkout conversion')), bars(R.BENCH)));
476
- if (R && fam.id === 'periodic') right.push(el('section', { class: 'card', 'data-rp-section': 'rhythm' }, el('h3', null, c3ic('cal'), 'Rhythm ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'next due')),
477
- el('ul', { class: 'hx' }, R.REPORTS.periodic.map((x) => el('li', null, el('span', { class: 'chip2', style: 'color:' + (x.pct >= 0.8 ? 'var(--success)' : 'var(--acc)') }, c3ic('doc', 'sm'), Math.round(x.pct * 100) + '%'), el('span', null, x.n, el('small', null, x.cad + ' · ' + x.aud)), el('span', { class: 'w' }, x.due))))));
478
- right.push(claimsCard(secs));
479
- if (fam.id === 'communications') right.push(truthBlock(inst, ctx), guardCard());
480
- right.push(sentCard(inst, fam));
481
- if (R && fam.id === 'periodic') right.push(el('section', { class: 'card', 'data-rp-section': 'questions' }, el('h3', null, c3ic('reply'), 'Open questions from readers'), el('ul', { class: 'chgl' }, R.QUESTIONS.map((t) => el('li', { class: 'warn' }, c3ic('reply', 'sm'), el('span', null, t))))));
482
- }
483
- body = el('div', null, head, facts, el('div', { class: 'brief sbb' }, el('div', { class: 'bcols' }, el('div', { class: 'bcol l' }, left), el('div', { class: 'bcol r' }, right))));
484
- }
485
- root.replaceChildren(el('div', { class: 'calwrap' }, bar, el('div', { class: 'calbody' }, body)));
486
- /* in demo the shell's own outbox host would repeat the Communications queue the page now draws */
487
- const oh = inst.host.parentNode && inst.host.parentNode.querySelector && inst.host.parentNode.querySelector('[data-c3pg="outbox-host"]');
488
- if (oh) { if (R) oh.setAttribute('data-rp-hide', ''); else oh.removeAttribute('data-rp-hide'); }
489
- }
490
-
491
- export function mountReportFamilies(host, ctx) {
492
- let inst = insts.get(host);
493
- if (!inst) { inst = make(host); insts.set(host, inst); inst.stopPhone = c3Phone(inst.root); }
494
- ensureC3Css();
495
- if (inst.root.parentNode !== host) host.replaceChildren(inst.root);
496
- if (ctx && ctx.FIXTURE) { inst.root.replaceChildren(el('div', { class: 'fold' }, c3ic('info', 'sm'), 'Report families are not shown in fixture mode.')); return; }
497
- if (!inst.families && !inst.loading) { inst.loading = true; draw(inst, ctx); load(inst, ctx).finally(() => { inst.loading = false; }); } else draw(inst, ctx);
498
- }
499
-
500
- export function disposeReportFamilies(host) {
501
- const inst = insts.get(host);
502
- if (!inst) return;
503
- inst.seq++; inst.cleanups.splice(0).forEach((f) => { try { f(); } catch { /* nothing */ } });
504
- if (inst.stopPhone) inst.stopPhone(); inst.root.remove(); insts.delete(host);
505
- }