create-pmos 0.632.0 → 0.633.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +14 -50
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +3 -0
- package/workspace/briefing-premium-board-test.js +4 -2
- package/workspace/briefing-premium-doc-edit-test.js +3 -0
- package/workspace/briefing-premium-initiative-test.js +4 -0
- package/workspace/briefing-premium-insights-test.js +1 -1
- package/workspace/briefing-premium-sources-test.js +2 -2
- package/workspace/changelog.json +13 -0
- package/workspace/core-docs-workflow-test.js +3 -0
- package/workspace/ev-everywhere-test.js +7 -17
- package/workspace/guide/layout.md +12 -5
- package/workspace/ini-workflow-test.js +3 -0
- package/workspace/lib/meeting-focus.js +5 -3
- package/workspace/lib/routes-meeting-focus.js +2 -2
- package/workspace/live-pill-round-test.js +7 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +3 -1
- package/workspace/premium-vw-backlog-test.js +2 -2
- package/workspace/premium-vw-doc-test.js +3 -0
- package/workspace/premium-vw-item-test.js +1 -1
- package/workspace/premium-vw-jira-test.js +4 -3
- package/workspace/public/pm/bd-ini-panel.js +4 -1
- package/workspace/public/pm/bd-prog-panel.js +3 -3
- package/workspace/public/pm/bd-views.js +8 -2
- package/workspace/public/pm/buddy-core.js +2 -2
- package/workspace/public/pm/cozy-board.css +15 -0
- package/workspace/public/pm/cozy-ev.css +25 -0
- package/workspace/public/pm/cozy-home.css +38 -2
- package/workspace/public/pm/cozy-nav.js +72 -6
- package/workspace/public/pm/cozy-phone-rec.css +68 -0
- package/workspace/public/pm/cozy-phone-rec.js +105 -0
- package/workspace/public/pm/cozy-phone-settings.css +18 -0
- package/workspace/public/pm/cozy-phone-settings.js +73 -0
- package/workspace/public/pm/cozy-phone-swipe.js +51 -0
- package/workspace/public/pm/cozy-pop-work.css +56 -0
- package/workspace/public/pm/cozy-pop-work.js +72 -4
- package/workspace/public/pm/cozy-rec-tab.js +10 -0
- package/workspace/public/pm/cozy-today-app.js +56 -5
- package/workspace/public/pm/cozy-today-page.css +75 -1
- package/workspace/public/pm/cozy-today-view.js +87 -0
- package/workspace/public/pm/cozy-viewer.js +27 -7
- package/workspace/public/pm/home-app.js +31 -2
- package/workspace/public/pm/home-chat.js +8 -0
- package/workspace/public/pm/home-ini.js +7 -3
- package/workspace/public/pm/phone-ask.js +57 -0
- package/workspace/split-merge-ui-test.js +3 -1
- package/workspace/stage-card-tasks-test.js +6 -0
- package/workspace/stage-card-test.js +3 -0
- package/workspace/task-delete-test.js +3 -0
- package/workspace/task-links-test.js +3 -0
- package/workspace/task-plans-test.js +3 -0
- package/workspace/task-views-test.js +3 -0
- package/workspace/test-lists/phone-design-v2.json +9 -0
- package/workspace/tk-tasks-test.js +4 -0
|
@@ -141,3 +141,90 @@ export const headHtml = (Hd) => `<header class="td-top"><span class="td-when">${
|
|
|
141
141
|
|
|
142
142
|
/** The whole page: the Overview and the log at the left, the agenda beside them. o.overview: overviewModel(). */
|
|
143
143
|
export function pageHtml(L, A, o = {}) { return `${o.head ? headHtml(o.head) : ''}<div class="td"><div class="td-main">${o.overview ? overviewHtml(o.overview, o) : ''}${logHtml(L, o)}</div>${agendaHtml(A)}</div>`; }
|
|
144
|
+
|
|
145
|
+
/* ── Today on a phone (phone design, boards Ph2_today, Ph2_todayzero, Ph2_recdone; build brief nav-structure/phone/build-brief-v2.md) ──
|
|
146
|
+
* One column, no cards and no boxes: the day and the greeting, "Recording filed under …" with Undo after a meeting, the ✦ Overview with at
|
|
147
|
+
* most one ✦ proposal and the one hint line, the next event with ● Record, Today's log (its count and an "All" filter), then Can wait folded
|
|
148
|
+
* to one line. A row is two lines: the title, then its type, its work and its reason; no action words. Rows and the proposal SWIPE
|
|
149
|
+
* (pm/cozy-phone-swipe.js): right does or accepts, left drops or puts off, and the toast says what happened with Undo. A row rests flat.
|
|
150
|
+
* Pure: Node imports it (today-log.test.js). */
|
|
151
|
+
export const SWIPE_HINT = 'Swipe any row: right to do or accept, left to drop or put off.';
|
|
152
|
+
const PI = { undo: 'M9 14L4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3', chev: 'M9 6l6 6-6 6', down: 'M7 10l5 5 5-5', spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
|
|
153
|
+
/** What a swipe does on a row: { right, left } acts of the click handler ('done', 'tomorrow', 'lab-keep', …), '' when that way does nothing. */
|
|
154
|
+
export function swipeActs(r) {
|
|
155
|
+
if (!r || r.done || r.src === 'note' || r.src === 'gone') return { right: '', left: '' };
|
|
156
|
+
if (r.src === 'lab') return { right: 'lab-keep', left: 'lab-drop' };
|
|
157
|
+
if (r.drop) return { right: 'drop', left: 'keep' }; // PMOS suggests to drop it: right accepts the suggestion, left keeps the line
|
|
158
|
+
if (r.looks) return { right: 'lk-yes', left: 'lk-no' };
|
|
159
|
+
if (r.members && r.drafts) return { right: 'same-yes', left: 'same-no' };
|
|
160
|
+
return { right: 'done', left: 'tomorrow' };
|
|
161
|
+
}
|
|
162
|
+
/** The next event of the day for the phone's one line: { key, title, sub, play } or the quiet line when there is none. A: agendaModel(). */
|
|
163
|
+
export function nextEvent(A, now = Date.now()) {
|
|
164
|
+
const m = (A && A.items ? A.items : []).filter((x) => (x.kind === 'meeting' || x.kind === 'own') && x.b > now).sort((p, q) => p.a - q.a)[0];
|
|
165
|
+
const free = A && A.free ? durPhone(A.free) + ' free' : '';
|
|
166
|
+
if (!m) return { key: '', title: 'No events today', sub: free, play: false, own: false };
|
|
167
|
+
const on = m.a <= now;
|
|
168
|
+
return { key: m.key, title: m.title, sub: (on ? 'Now · ' : '') + m.sub + (m.kind === 'own' ? '' : ''), play: m.kind === 'meeting', own: m.kind === 'own', ref: m };
|
|
169
|
+
}
|
|
170
|
+
const durPhone = (min) => { const h = Math.floor(min / 60), m = min % 60; return h ? (m >= 30 ? h + '.5 h' : h + ' h') : m + ' min'; };
|
|
171
|
+
|
|
172
|
+
/** One row of the phone's log: the bullet, the title, then "Task · IDPF · Ready to send"; a ✦ line under it when PMOS proposes. */
|
|
173
|
+
export function phoneRowHtml(r) {
|
|
174
|
+
const [b, bl] = r.done ? ['×', 'Done'] : BULLET[r.bullet] || BULLET.task;
|
|
175
|
+
const sw = swipeActs(r);
|
|
176
|
+
const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
|
|
177
|
+
const title = opens ? `<button type="button" class="tdp-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>` : `<span class="tdp-t">${esc(r.title)}</span>`;
|
|
178
|
+
const meta = [r.type ? `${svg(TI[r.type] || TI.Task, 13, 1.8)}<span>${esc(r.type)}</span>` : '', r.work ? esc(r.work) : '', r.reason ? esc(r.reason) : '', r.when && r.late && !r.done ? `<em>${esc(r.when)}</em>` : '']
|
|
179
|
+
.filter(Boolean).join('<i aria-hidden="true">·</i>');
|
|
180
|
+
const pro = (t) => `<span class="tdp-pro">${svg(PI.spark, 13, 1.9)}<span>${esc(t)}</span></span>`;
|
|
181
|
+
const sug = r.drop ? pro('PMOS suggests: drop it from your log.')
|
|
182
|
+
: r.looks && !r.done ? pro('Looks answered: ' + (r.looks.who ? r.looks.who + ' replied' : 'someone replied') + ' “' + r.looks.text + '”. Close it?')
|
|
183
|
+
: r.members && r.drafts && !r.done ? pro('PMOS drafts them for you to read.')
|
|
184
|
+
: r.src === 'lab' && r.why ? pro(r.why) : '';
|
|
185
|
+
const say = sw.right ? ` aria-describedby="tdpHint"` : '';
|
|
186
|
+
return `<li class="tdp-r${r.done ? ' done' : ''}${r.first && !r.done ? ' first' : ''}" data-key="${esc(r.key)}"${sw.right ? ` data-sw-right="${sw.right}"` : ''}${sw.left ? ` data-sw-left="${sw.left}"` : ''}${say}>`
|
|
187
|
+
+ `<i class="tdp-b" role="img" aria-label="${esc(bl)}">${b}</i><div class="tdp-x">${title}${meta ? `<small class="tdp-m">${meta}</small>` : ''}${sug}</div></li>`;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Today on a phone. L: logModel(), A: agendaModel(), O: overviewModel(); o: { head, type, open, filed: { title, sub, id } | null, now } */
|
|
191
|
+
export function phonePageHtml(L, A, O, o = {}) {
|
|
192
|
+
const H = o.head ? `<header class="tdp-top"><span class="td-when">${esc(o.head.when)}</span><h1>${esc(o.head.hello)}</h1></header>` : '';
|
|
193
|
+
const filed = o.filed ? `<section class="tdp-filed" aria-label="The meeting you recorded"><div><b>${esc('Recording filed under ' + o.filed.title)}</b>${o.filed.sub ? `<small>${esc(o.filed.sub)}</small>` : ''}</div>`
|
|
194
|
+
+ `<button type="button" class="tdp-ib" data-td="filed-undo" data-key="${esc(o.filed.id)}" aria-label="${esc('Undo: take the recording out of ' + o.filed.title)}" title="Undo">${svg(PI.undo, 18, 1.8)}</button></section>` : '';
|
|
195
|
+
const pick = (rows) => (o.type ? (rows || []).filter((r) => r.type === o.type) : rows || []);
|
|
196
|
+
const shown = pick(L.first).concat(pick(L.todayRows));
|
|
197
|
+
const wait = pick(L.wait);
|
|
198
|
+
const sg = O && O.suggest && O.suggest[0];
|
|
199
|
+
const anySwipe = !!sg || shown.some((r) => swipeActs(r).right);
|
|
200
|
+
// the Overview: PMOS's words, at most one ✦ proposal, and the hint once there is something to swipe. Nothing open: one sentence.
|
|
201
|
+
const zero = !shown.length;
|
|
202
|
+
const ov = zero
|
|
203
|
+
? `<p class="tdp-zero">${esc(o.quiet || 'Nothing is open for today.')}</p>`
|
|
204
|
+
: `<section class="tdp-ov" aria-label="Overview"><h2>${svg(PI.spark, 15, 1.9)}<span>Overview</span></h2>${O && O.said ? `<p>${esc(O.said)}</p>` : ''}`
|
|
205
|
+
+ (sg ? `<ul class="tdp-sgl"><li class="tdp-sg" data-key="${esc(sg.key)}" data-sw-right="ov-yes" data-sw-left="ov-no" aria-describedby="tdpHint"><button type="button" class="tdp-sgt" data-td="ov-open" data-key="${esc(sg.key)}">${svg(PI.spark, 13, 1.9)}<span>${esc(sg.text)}</span></button></li></ul>` : '')
|
|
206
|
+
+ (anySwipe ? `<p class="tdp-hint" id="tdpHint">${esc(SWIPE_HINT)}</p>` : '') + '</section>';
|
|
207
|
+
// the next event, with ● Record (a meeting records; with no event, Record starts a recording of its own)
|
|
208
|
+
const N = nextEvent(A, o.now);
|
|
209
|
+
const ev = `<section class="tdp-ev" aria-label="Next event"><button type="button" class="tdp-evt"${N.key && !N.own ? ` data-td="ev" data-key="${esc(N.key)}"` : ' tabindex="-1" disabled'}><b>${esc(N.title)}</b>${N.sub ? `<small>${esc(N.sub)}</small>` : ''}</button>`
|
|
210
|
+
+ `<button type="button" class="tdp-rec" data-td="${N.play ? 'rec-ev' : 'rec'}" data-key="${esc(N.key)}" aria-label="${esc(N.play ? 'Record ' + N.title : 'Record a meeting')}"><i aria-hidden="true"></i>Record</button></section>`;
|
|
211
|
+
// the log: its count and the type filter, then the rows
|
|
212
|
+
const types = O && O.chips ? O.chips : [];
|
|
213
|
+
const total = types.reduce((n, c) => n + c.n, 0);
|
|
214
|
+
const filter = types.length > 1 ? `<label class="tdp-f"><span class="td-vh">Show</span><select data-td-type aria-label="Show one type"><option value=""${o.type ? '' : ' selected'}>All</option>`
|
|
215
|
+
+ types.map((c) => `<option value="${esc(c.type)}"${o.type === c.type ? ' selected' : ''}>${esc((PLURAL[c.type] || c.type) + ' ' + c.n)}</option>`).join('') + `</select>${svg(PI.down, 14)}</label>` : '';
|
|
216
|
+
const log = zero ? '' : `<section class="tdp-log" aria-label="Today’s log"><div class="tdp-lh"><h2>Today’s log · ${esc(o.type ? shown.length : L.open || total || shown.length)}</h2>${filter}</div>`
|
|
217
|
+
+ `<ul class="tdp-rows">${shown.map((r) => phoneRowHtml(r) + (r.members && (o.sopen || []).includes(r.key) ? r.members.map((m) => phoneRowHtml(m)).join('') : '')).join('')}</ul></section>`;
|
|
218
|
+
// Can wait: one line, folded; a zero day says it as its own short section (Ph2_todayzero)
|
|
219
|
+
let cw = '';
|
|
220
|
+
if (wait.length) {
|
|
221
|
+
const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
|
|
222
|
+
const old = oldest ? 'the oldest waits ' + oldest + (oldest === 1 ? ' day' : ' days') : '';
|
|
223
|
+
if (zero) cw = `<section class="tdp-cw0" aria-label="Can wait"><h2>Can wait <em>${esc(wait.length)}</em></h2><button type="button" class="tdp-cwl" data-td="fold" aria-expanded="${!!o.open}"><span>${esc(old ? cap(old) : plural3(wait.length))}</span>${svg(o.open ? PI.down : PI.chev, 16)}</button></section>`;
|
|
224
|
+
else cw = `<button type="button" class="tdp-cw" data-td="fold" aria-expanded="${!!o.open}"><b>Can wait</b><span>${esc(wait.length + ' more' + (old ? ' · ' + old : ''))}</span>${svg(PI.down, 14)}</button>`;
|
|
225
|
+
if (o.open) cw += `<ul class="tdp-rows tdp-waitl">${wait.map((r) => phoneRowHtml(r)).join('')}</ul>`;
|
|
226
|
+
}
|
|
227
|
+
return `${H}${filed}${ov}${ev}${log}${cw}`;
|
|
228
|
+
}
|
|
229
|
+
const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
230
|
+
const plural3 = (n) => n + (n === 1 ? ' line' : ' lines');
|
|
@@ -438,18 +438,38 @@ function grip(el) {
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
/* ── the ⋯ menu ── */
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
const items = ((typeof V.cur.more === 'function' ? V.cur.more() : V.cur.more) || []).filter(Boolean).slice(); // a function is asked each time ⋯ opens, so its notes are current
|
|
441
|
+
/** The ⋯ menu's items for one viewer: its own, the presses that left the header, Open in a new tab. b: the press that opened it. */
|
|
442
|
+
function itemsOf(X, b) {
|
|
443
|
+
const items = ((typeof X.cur.more === 'function' ? X.cur.more() : X.cur.more) || []).filter(Boolean).slice(); // a function is asked each time ⋯ opens, so its notes are current
|
|
445
444
|
// on a phone the presses marked menu lead the menu (they left the header)
|
|
446
|
-
if (
|
|
447
|
-
if (
|
|
448
|
-
const at = items.findIndex((x) => x && x.danger), tab = { label:
|
|
445
|
+
if (X.ph || X.pop) { const mp = (X.cur.presses || []).filter((x) => x && x.act && x.label && (X.ph ? x.menu : !x.solid)); if (mp.length) items.unshift(...mp.map((x) => ({ label: x.label, icon: x.icon, on: () => { if (typeof X.cur.onPress === 'function') X.cur.onPress(x.act, b); } })), { sep: true }); }
|
|
446
|
+
if (X.cur.url) { // the item's own address looks back, so it goes before the red stop-or-remove group, which stays last
|
|
447
|
+
const at = items.findIndex((x) => x && x.danger), tab = { label: X.cur.full ? 'Open in full' : 'Open in a new tab', on: () => window.open(X.cur.url, '_blank', 'noopener') };
|
|
449
448
|
if (at < 0) items.push({ sep: true }, tab); else items.splice(at > 0 && items[at - 1].sep ? at - 1 : at, 0, { sep: true }, tab);
|
|
450
449
|
}
|
|
451
450
|
while (items.length && items[0].sep) items.shift();
|
|
452
451
|
for (let i = items.length - 1; i > 0; i--) if (items[i].sep && items[i - 1].sep) items.splice(i, 1);
|
|
452
|
+
return items;
|
|
453
|
+
}
|
|
454
|
+
/** A phone (phone design, Ph2_init): the page has one ⋯, the menu's (pm/cozy-nav.js). The shown item's own ⋯ items lead that menu, so the
|
|
455
|
+
* item's header has no ⋯ of its own. → [{ label, danger, go }] or [] when no item is shown. */
|
|
456
|
+
/** The presses that lead an item's header (an initiative's kind of work), as ⋯ rows: a phone's item page hides them (cozy-pop-work.css). */
|
|
457
|
+
function leadsOf(X, anchor) {
|
|
458
|
+
return (X.cur.presses || []).filter((x) => x && x.lead && x.act && x.label).map((x) => ({ label: x.label.replace(/\. Tap to change\.$/, ''), on: () => { if (typeof X.cur.onPress === 'function') X.cur.onPress(x.act, anchor); } }));
|
|
459
|
+
}
|
|
460
|
+
export function phoneMoreRows(anchor) {
|
|
461
|
+
const X = ALL.find((x) => x.ph && shown(x)); if (!X) return [];
|
|
462
|
+
// the presses that lead the header (an initiative's kind of work) are hidden on a phone's item page (cozy-pop-work.css): they lead the rows
|
|
463
|
+
return leadsOf(X, anchor).concat(itemsOf(X, anchor)).filter((it) => it && !it.sep && !it.disabled && it.label).map((it) => ({ label: it.label, danger: !!it.danger, go: () => { try { it.on(anchor); } catch (err) { console.error(err); } } }));
|
|
464
|
+
}
|
|
465
|
+
if (typeof window !== 'undefined') window.__czVwMore = phoneMoreRows;
|
|
466
|
+
function moreMenu(b) {
|
|
467
|
+
const old = V.el.querySelector('.cz-vw-menu');
|
|
468
|
+
if (old) { old.remove(); b.setAttribute('aria-expanded', 'false'); return; }
|
|
469
|
+
// a phone (phone design, Ph2_menu): an open item's ⋯ is the screen's one ⋯, so the places follow its own rows (pm/cozy-nav.js)
|
|
470
|
+
const places = typeof window !== 'undefined' && typeof window.__czPhonePlaces === 'function' ? window.__czPhonePlaces() : [];
|
|
471
|
+
const lead = places.length && V.el.querySelector('.pw-ph') ? leadsOf(V, b) : [];
|
|
472
|
+
const items = lead.concat(itemsOf(V, b), places.length ? [{ sep: true }, ...places] : []);
|
|
453
473
|
const m = document.createElement('div');
|
|
454
474
|
m.className = 'cz-vw-menu'; m.setAttribute('role', 'menu'); m.setAttribute('aria-label', 'More'); m.dataset.escLayer = '1';
|
|
455
475
|
m.innerHTML = items.map((it, i) => (it.sep ? '<hr>' : `<button type="button" role="menuitem" data-cz-vw-mi="${i}"${it.danger ? ' class="bad"' : ''}${it.disabled ? ' disabled' : ''}>${it.icon ? svg(path(it.icon), 16) : ''}<span>${esc(it.label)}</span>${it.note || it.hint ? `<span class="k">${esc(it.note || it.hint)}</span>` : ''}</button>`)).join('');
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* press (pmPost). Nothing here opens the old dialog or links to the console. */
|
|
17
17
|
import './fetch-share.js'; // first: identical GETs in flight are asked once (page-open-speed)
|
|
18
18
|
import { mountNav, openMenu } from './cozy-nav.js';
|
|
19
|
+
import { askGroups, askHtml } from './phone-ask.js'; // Ask PMOS on a phone (phone design, Ph2_asklist): the chats by work
|
|
20
|
+
import { sessionRows } from './pop-sessions.js';
|
|
19
21
|
import { mountPhoneHead } from './phone-chat-head.js'; // the phone chat's top bar: the context line, its sheet and ⋯ (batch 31 item 5)
|
|
20
22
|
import { mountSetupChecklist } from './setup-checklist.js';
|
|
21
23
|
import { mountOnboard } from './cozy-onboard.js';
|
|
@@ -287,7 +289,7 @@ function otherProducts(D) {
|
|
|
287
289
|
const av = (D.brief && D.brief.products && D.brief.products.available) || [];
|
|
288
290
|
const own = ((D.board && D.board.board) || {}).ws || WS;
|
|
289
291
|
// Today reads every product (slice 5 of the six-place navigation): the product pick is Work's and Goals', not Today's
|
|
290
|
-
return av.filter((a) => (a.on ||
|
|
292
|
+
return av.filter((a) => (a.on || TD_PAGE) && a.ws && a.ws !== own).slice(0, 4); // a phone's Today too (phone design, Ph2_today)
|
|
291
293
|
}
|
|
292
294
|
async function loadIni() {
|
|
293
295
|
const id = S.ini;
|
|
@@ -370,7 +372,7 @@ function homeListHtml() {
|
|
|
370
372
|
S.M = M;
|
|
371
373
|
// Adler's ears over the floating button (batch 17 item 4-B, AdP6): the place menu hears how many calls are the PM's
|
|
372
374
|
// on Today (a desk) the number is Today's own (pm/cozy-today-app.js: Do first and what waits today), so it is not sent here
|
|
373
|
-
if (!
|
|
375
|
+
if (!TD_PAGE) { const n = (M.move || []).filter((r) => r.call).length; if (n !== S.calls) { S.calls = n; document.dispatchEvent(new CustomEvent('cz:calls', { detail: { count: n } })); } }
|
|
374
376
|
// the ✦ chip on "Not in an initiative" is gone (UI grill delete list): Claude's clean-up is a row in Your move (rankIn extra)
|
|
375
377
|
const R = L.reviewModel(S.D, NOW());
|
|
376
378
|
// a group is open until the PM folds it; another product starts folded; "Not in an initiative" starts folded on a phone (HvAC, HvACDesk)
|
|
@@ -914,8 +916,33 @@ function drawList() {
|
|
|
914
916
|
document.body.classList.toggle('hm-plist', isPhone() && !S.phoneChat); // a phone: the list is the page until a row opens its conversation (HmPhone)
|
|
915
917
|
drawRailCard();
|
|
916
918
|
drawRecTop();
|
|
919
|
+
drawAsk();
|
|
917
920
|
if (TDY) TDY.draw(); // Today on a desk (today.html): the log and the agenda, from the same reads
|
|
918
921
|
}
|
|
922
|
+
/* Ask PMOS on a phone (phone design, board Ph2_asklist): Home's page is the list of chats by work; Home's own list is not drawn there
|
|
923
|
+
* (cozy-home.css). A row opens its chat as Home does; the composer at the foot starts a chat with PMOS. today.html draws Today instead. */
|
|
924
|
+
const ASK_PAGE = new URLSearchParams(location.search).has('chats'); // the menu's Ask PMOS (cozy-nav.js); a bare /premium.html keeps Home's list
|
|
925
|
+
function drawAsk() {
|
|
926
|
+
const on = isPhone() && !TD_PAGE && ASK_PAGE;
|
|
927
|
+
document.body.classList.toggle('pa-on', on);
|
|
928
|
+
let el = document.getElementById('paList');
|
|
929
|
+
if (!on) { if (el) el.hidden = true; return; }
|
|
930
|
+
if (!el) {
|
|
931
|
+
el = document.createElement('section'); el.id = 'paList'; el.className = 'pa-page'; el.setAttribute('aria-label', 'Ask PMOS');
|
|
932
|
+
$('#hmDesk').prepend(el);
|
|
933
|
+
el.addEventListener('click', (e) => {
|
|
934
|
+
const b = e.target.closest('[data-ask-sid], [data-ask-new]'); if (!b) return;
|
|
935
|
+
if ('askNew' in b.dataset) { S.phoneChat = true; VW.close(); openTarget(homeTarget()); drawList(); chat.focus(); return; }
|
|
936
|
+
const sx = (S.D.sessions || []).find((x) => x.id === b.dataset.askSid);
|
|
937
|
+
if (!sx) { toast('That chat has ended. It is not on this computer any more.'); return; }
|
|
938
|
+
S.phoneChat = true; VW.close(); S.sel = 's:' + sx.id; openTarget(sessionTarget(sx)); followViewer(sx); drawList(); chat.focus();
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
el.hidden = false;
|
|
942
|
+
const R = sessionRows(S.D.sessions || [], { titleOf: (id) => (iniRowOf(id) ? iniTitle(id) : ''), now: NOW() });
|
|
943
|
+
const h = askHtml(askGroups(R.all, S.D.sessions || [], { titleOf: (id) => (iniRowOf(id) ? iniTitle(id) : ''), now: NOW() }), { ready: S.ready });
|
|
944
|
+
if (el.__h !== h) { el.__h = h; el.innerHTML = h; }
|
|
945
|
+
}
|
|
919
946
|
/** The list's own fold (batch 20 item 6): kept on this computer, the one thing that folds or unfolds the list. With a Viewer open it is the rail. */
|
|
920
947
|
function setFold(on) {
|
|
921
948
|
S.folded = !!on; store.set('pmos.home.fold', on ? '1' : '0'); drawList(); // '0': the PM opened it, and a full Viewer keeps it open from now on
|
|
@@ -2417,6 +2444,8 @@ if (TD_PAGE) TDY = mountToday({ S, VW, POP, pmGet, pmPost, toast, toastUndo, isP
|
|
|
2417
2444
|
const x = await startAgent({ ws: w.ws || WS || undefined, task: 'draft', initiative: w.initiative, what: w.what }); if (x.ok) started++; else failed++; }
|
|
2418
2445
|
if (started) load(); return { started, failed, error: started ? '' : 'PMOS did not start them. Nothing changed.' }; },
|
|
2419
2446
|
openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D), record: (row) => (REC ? REC.record(row) : Promise.resolve({ ok: false, error: 'PMOS is still starting. Press play again in a moment.' })),
|
|
2447
|
+
// the phone's Record with no event (Ph2_today): a recording of its own; the notes, for "Recording filed under …" (Ph2_recdone)
|
|
2448
|
+
fresh: () => (REC ? REC.fresh() : Promise.resolve({ ok: false, error: 'PMOS is still starting. Press Record again in a moment.' })), notes: () => noteRows(),
|
|
2420
2449
|
news: () => (S.news && S.news.ok ? S.news.count || 0 : 0), chatNow: () => (chat.current ? chat.current() : null),
|
|
2421
2450
|
openLab: (f) => import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: f.ws, board: f.board }), iniHref: (id) => '/premium-initiative.html?' + (f.ws ? 'ws=' + encodeURIComponent(f.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })) });
|
|
2422
2451
|
PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m), skip: ['meeting'] }); drawList();
|
|
@@ -752,6 +752,14 @@ export function mountChat(el, host) {
|
|
|
752
752
|
holdT = setTimeout(() => { unhold(); a.classList.add('held'); }, 450);
|
|
753
753
|
});
|
|
754
754
|
for (const ev of ['pointerup', 'pointercancel', 'pointermove']) el.addEventListener(ev, (e) => { if (ev !== 'pointermove' || Math.abs(e.movementX) + Math.abs(e.movementY) > 6) clearTimeout(holdT); });
|
|
755
|
+
/* The phone (phone design, Ph2_ask): the tools and the "Worked …" line show only on a touch of the message, the newest one too. A tap on a
|
|
756
|
+
* message shows them, a second tap or a tap on another message moves them; a press on a link or a button inside does its own job. */
|
|
757
|
+
el.addEventListener('click', (e) => {
|
|
758
|
+
if (!(typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches) || el.closest('.cz-pop-chat')) return;
|
|
759
|
+
const a = e.target.closest('.hm-a'); if (!a || a.classList.contains('hm-intro') || e.target.closest('button, a, input, textarea, select, summary, .hm-tools')) return;
|
|
760
|
+
if (String(getSelection ? getSelection() : '').trim()) return; // selecting words to copy them is not a tap
|
|
761
|
+
const was = a.classList.contains('held'); unhold(); if (!was) a.classList.add('held');
|
|
762
|
+
});
|
|
755
763
|
el.addEventListener('change', (e) => { if (e.target.id === 'hmFile') { upload([...e.target.files]); e.target.value = ''; } });
|
|
756
764
|
// a pasted file, or one dropped on the conversation, is attached like a picked one
|
|
757
765
|
el.addEventListener('paste', (e) => { if (e.target.id !== 'hmIn' || !C.t || !C.t.key) return; const fs = e.clipboardData ? [...e.clipboardData.files] : []; if (!fs.length) return; e.preventDefault(); upload(fs); });
|
|
@@ -281,7 +281,7 @@ function popExtra(id) {
|
|
|
281
281
|
allParts: () => {
|
|
282
282
|
C.VW.drill();
|
|
283
283
|
C.VW.open({ kind: X.ctx.kindOf(id), title: C.iniTitle(id), icon: 'goal', id: 'all:' + id, back: true,
|
|
284
|
-
render: (b) => { b.dataset.pwAll = '1'; const M = curM(); b.innerHTML = M ? pageHtml(id, M) : ''; wire(b, id); wirePage(b, id); } });
|
|
284
|
+
render: (b) => { b.dataset.pwAll = '1'; ALLB = b; const M = curM(); b.innerHTML = M ? pageHtml(id, M) : ''; wire(b, id); wirePage(b, id); } });
|
|
285
285
|
},
|
|
286
286
|
props: () => { const v = X.ctx.view(id); if (v) PP.open(v, H); },
|
|
287
287
|
};
|
|
@@ -495,7 +495,7 @@ export function iniPage(o = {}) {
|
|
|
495
495
|
let rename = X.ctx.renameIni ? X.ctx.renameIni(id, '') : null;
|
|
496
496
|
if (rename) rename = { ...rename, value: X.ctx.iniTitle(id) };
|
|
497
497
|
const dh = dashFor(id);
|
|
498
|
-
BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => (PW.on(BODY) ? PW.moreItems(null, popExtra(id)) : []).concat(pageMore(id)), rename, pop: o.pop || undefined,
|
|
498
|
+
BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => (PW.on(BODY) ? PW.moreItems(null, popExtra(id)) : []).concat(pageMore(id), PW.on(BODY) && !PW.inPop(BODY) ? moreOf(id, 'page').filter((x) => x.sep || /full record|Sprint/.test(x.label)) : []), rename, // a phone's page (Ph2_init) keeps the record and the sprint pop: o.pop || undefined,
|
|
499
499
|
discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
|
|
500
500
|
// the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds
|
|
501
501
|
presses: [WK.pressOf(kindNow(id))].concat(dh ? dh.presses() : []), onPress: (a, btn) => {
|
|
@@ -526,6 +526,7 @@ export function iniAddTask() {
|
|
|
526
526
|
const KIND = { docs: 'Documents', stage: 'Stage' };
|
|
527
527
|
const ICON = { docs: 'doc', stage: 'goal' };
|
|
528
528
|
let BODY = null;
|
|
529
|
+
let ALLB = null; // the body of Every part, while it is open
|
|
529
530
|
/* round 3 item 11b: a Today row that is a task opens its initiative at that task: the row lit, open in place (date, owner, status), in view */
|
|
530
531
|
let LIT = null; // { id, uid, seen }
|
|
531
532
|
/** The task the initiative's next draw lights. id: the initiative; uid: the task. */
|
|
@@ -600,7 +601,10 @@ function draw(b) {
|
|
|
600
601
|
}
|
|
601
602
|
function redrawView() {
|
|
602
603
|
if (!BODY || !BODY.isConnected || !X.ctx) return;
|
|
603
|
-
const cur = X.ctx.VW.current(); if (!cur
|
|
604
|
+
const cur = X.ctx.VW.current(); if (!cur) return;
|
|
605
|
+
// Every part (the old page as a drill-in, the way a phone reaches it): its presses redraw it in place
|
|
606
|
+
if (cur.id === 'all:' + X.ctx.S.ini) { if (ALLB && ALLB.isConnected) { const M = curM(), st = ALLB.scrollTop; ALLB.innerHTML = M ? pageHtml(X.ctx.S.ini, M) : ''; light(ALLB, X.ctx.S.ini); ALLB.scrollTop = st; } return; }
|
|
607
|
+
if (cur.id !== 'ov:' + X.ctx.S.ini) return;
|
|
604
608
|
const ae = document.activeElement, keep = ae && BODY.contains(ae) && ae.id ? ae.id : null, val = keep && ae.value != null ? ae.value : null;
|
|
605
609
|
const st = BODY.scrollTop; draw(BODY); BODY.scrollTop = st;
|
|
606
610
|
if (keep) { const n = BODY.querySelector('#' + keep); if (n) { if (val != null) n.value = val; n.focus(); } }
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* pm/phone-ask.js — Ask PMOS on a phone (phone design, board Ph2_asklist on Exploring 2; build brief nav-structure/phone/build-brief-v2.md).
|
|
2
|
+
*
|
|
3
|
+
* On a phone, Home's page (premium.html) is Ask PMOS: the chats, grouped by the work each is about, "Not in a work yet" last. The header is
|
|
4
|
+
* the title only (the ⋯ of the menu at its right); no search and no new-chat icon: a new chat starts from the composer at the foot. A chat
|
|
5
|
+
* that waits for you carries a blue dot. A row: the chat's name and when it was last used, then its last words ("PMOS: …").
|
|
6
|
+
*
|
|
7
|
+
* askGroups(rows, raw, { titleOf }) → [{ ini, title, n, rows: [{ id, name, word, last, wait }] }] PURE
|
|
8
|
+
* rows: pop-sessions.js sessionRows(...).all; raw: GET /api/sessions .sessions (for each chat's last words). Groups keep the order of
|
|
9
|
+
* their newest chat; "Not in a work yet" (ini null) is last.
|
|
10
|
+
* askHtml(groups, { ready }) → string PURE
|
|
11
|
+
* The rows are buttons data-ask-sid="<session id>"; the composer is a button data-ask-new. home-app.js opens them (the chat as on Home).
|
|
12
|
+
* Reads and writes nothing itself. Text from records goes through esc(). */
|
|
13
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
14
|
+
const svg = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
15
|
+
const IC = {
|
|
16
|
+
ini: 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M12 9a3 3 0 1 0 0 6a3 3 0 1 0 0-6',
|
|
17
|
+
loose: 'M4 5h16v11H9l-5 4z', plus: 'M12 5v14M5 12h14', mic: 'M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3zM5 11a7 7 0 0 0 14 0M12 18v3', up: 'M12 19V5M6 11l6-6 6 6',
|
|
18
|
+
};
|
|
19
|
+
const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
|
|
20
|
+
/** The chat's last words: "PMOS: …" from the session's last output, '' when there is none (zero is silence). */
|
|
21
|
+
export function lastLine(s) {
|
|
22
|
+
const w = s && (s.lastWords || (s.hx && s.hx.lastWords));
|
|
23
|
+
const t = Array.isArray(w) ? w.filter(Boolean).slice(-1)[0] : w;
|
|
24
|
+
return t ? 'PMOS: ' + clip(t, 120) : '';
|
|
25
|
+
}
|
|
26
|
+
export function askGroups(rows, raw = [], o = {}) {
|
|
27
|
+
const titleOf = o.titleOf || (() => '');
|
|
28
|
+
const byId = new Map((raw || []).filter(Boolean).map((s) => [s.id, s]));
|
|
29
|
+
const G = new Map();
|
|
30
|
+
for (const r of rows || []) {
|
|
31
|
+
const k = r.ini || '';
|
|
32
|
+
if (!G.has(k)) G.set(k, { ini: r.ini || null, title: r.ini ? titleOf(r.ini) || r.work || r.ini : 'Not in a work yet', rows: [] });
|
|
33
|
+
G.get(k).rows.push({ id: r.id, name: r.name, word: r.state === 'wait' || r.state === 'work' ? r.at ? timeOnly(r.at, o.now) : '' : r.word, last: lastLine(byId.get(r.id)), wait: r.state === 'wait', work: r.state === 'work' });
|
|
34
|
+
}
|
|
35
|
+
const out = [...G.values()].map((g) => ({ ...g, n: g.rows.length }));
|
|
36
|
+
return out.filter((g) => g.ini).concat(out.filter((g) => !g.ini));
|
|
37
|
+
}
|
|
38
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
39
|
+
const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
40
|
+
/** The time word of a chat that works or waits: when it was last touched ("10:20", "Tue", "12 Nov"). */
|
|
41
|
+
function timeOnly(iso, now = Date.now()) {
|
|
42
|
+
const d = new Date(iso); if (Number.isNaN(d.getTime())) return '';
|
|
43
|
+
const n = new Date(now);
|
|
44
|
+
if (d.toDateString() === n.toDateString()) return pad(d.getHours()) + ':' + pad(d.getMinutes());
|
|
45
|
+
if (now - d.getTime() < 6 * 864e5 && d.getTime() <= now) return DOW[d.getDay()];
|
|
46
|
+
return d.getDate() + ' ' + MON[d.getMonth()];
|
|
47
|
+
}
|
|
48
|
+
export function askHtml(groups, o = {}) {
|
|
49
|
+
const head = '<header class="pa-top"><h1>Ask PMOS</h1></header>';
|
|
50
|
+
const body = !o.ready ? '<p class="pa-none">Reading your chats.</p>'
|
|
51
|
+
: !groups.length ? '<p class="pa-none">No chats yet. Write to PMOS below to start one.</p>'
|
|
52
|
+
: groups.map((g) => `<section class="pa-g" aria-label="${esc(g.title)}"><h2><span class="pa-gi${g.ini ? '' : ' loose'}">${svg(g.ini ? IC.ini : IC.loose, 14)}</span><span class="pa-gt">${esc(g.title)}</span><em>${esc(g.n)}</em></h2>`
|
|
53
|
+
+ `<ul>${g.rows.map((r) => `<li><button type="button" class="pa-r${r.wait ? ' wait' : ''}" data-ask-sid="${esc(r.id)}" aria-label="${esc(r.name + (r.wait ? '. Waits for you' : r.work ? '. PMOS is working' : '') + (r.last ? '. ' + r.last : ''))}">`
|
|
54
|
+
+ `${r.wait ? '<i class="pa-d" aria-hidden="true"></i>' : ''}<span class="pa-x"><b>${esc(r.name)}</b>${r.last ? `<small>${esc(r.last)}</small>` : ''}</span>${r.word ? `<time>${esc(r.word)}</time>` : ''}</button></li>`).join('')}</ul></section>`).join('');
|
|
55
|
+
const foot = `<div class="pa-foot"><button type="button" class="pa-new" data-ask-new aria-label="Message PMOS: start a new chat"><span class="pa-pl">${svg(IC.plus, 18)}</span><span class="pa-ph">Message PMOS</span><span class="pa-mic">${svg(IC.mic, 18)}</span><span class="pa-go">${svg(IC.up, 18, 2)}</span></button></div>`;
|
|
56
|
+
return `<div class="pa">${head}${body}</div>${foot}`;
|
|
57
|
+
}
|
|
@@ -22,6 +22,8 @@ const { makeRepos, codeRepo, write, git } = require('./plan-test-repos');
|
|
|
22
22
|
|
|
23
23
|
const BASE = T.BASE;
|
|
24
24
|
const SHOTS = process.env.SHOTS || '';
|
|
25
|
+
// the phone design (Ph2_init): a phone shows an initiative as the popup's phone page; the old page is ⋯ › Every part
|
|
26
|
+
const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 }); await pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); }); await pg.waitForTimeout(800); };
|
|
25
27
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
26
28
|
const until = async (fn, ms = 15000, step = 150) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
27
29
|
const results = [];
|
|
@@ -164,7 +166,7 @@ const shot = (p, name) => (SHOTS ? p.screenshot({ path: path.join(SHOTS, name) }
|
|
|
164
166
|
const { ctx, page: p, errors } = await open({ w: 390, h: 844 });
|
|
165
167
|
const key = await p.evaluate(() => { const d = document.querySelector('#ibBody .sm-dot'); const b = d && d.closest('[data-key]'); return b ? b.dataset.key : null; });
|
|
166
168
|
ok('P phone: the dot on the row', !!key);
|
|
167
|
-
if (key) await p.click(`#ibBody [data-key="${key}"]`);
|
|
169
|
+
if (key) { await p.click(`#ibBody [data-key="${key}"]`); await everyPart(p); }
|
|
168
170
|
ok('P phone: the card in the full-screen Viewer', await until(() => p.evaluate(() => !!document.querySelector('#czViewer .sm-card'))));
|
|
169
171
|
await shot(p, 'phone-suggest.png');
|
|
170
172
|
await p.click('#czViewer [data-sm="no"]');
|
|
@@ -110,12 +110,18 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
|
|
|
110
110
|
await until(() => page.evaluate(() => document.querySelectorAll('#ibBody .ini2, #ibBody .bt-l').length > 0), 20000);
|
|
111
111
|
await page.evaluate(() => { const b = [...document.querySelectorAll('[data-row="board:usage-billing"] .bt-nm, [data-key="board:usage-billing"]')].find((x) => x.offsetParent); if (b) b.click(); });
|
|
112
112
|
}
|
|
113
|
+
// a phone shows the initiative as the popup's phone page (phone design, Ph2_init); the old page with its Tasks is ⋯ › Every part
|
|
114
|
+
if (touch && where === 'home') { await everyPart(page); await sleep(800); }
|
|
113
115
|
await until(() => page.evaluate((v) => !!document.querySelector(v === 'list' ? '#czViewer .iv-wbs' : '#czViewer :is(.ivt, .iva, .ivk)'), view), 20000);
|
|
114
116
|
// Build and Deliver open (the Board's initiative is in Discover; Home's is in Build)
|
|
115
117
|
await openStage(page, 'build'); await openStage(page, 'deliver');
|
|
116
118
|
await sleep(200);
|
|
117
119
|
return { ctx, page, errors, posts, S };
|
|
118
120
|
};
|
|
121
|
+
const everyPart = async (pg) => {
|
|
122
|
+
await until(() => pg.evaluate(() => !!document.querySelector('#czViewer .pw-ph')), 20000);
|
|
123
|
+
return pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); return !!r; });
|
|
124
|
+
};
|
|
119
125
|
const openStage = (pg, key) => pg.evaluate((k) => {
|
|
120
126
|
const rest = document.querySelector('#czViewer .iv-rest[aria-expanded="false"]');
|
|
121
127
|
const h = document.querySelector(`#czViewer .iv-ws[data-iv-sec="${k}"]`);
|
|
@@ -25,6 +25,8 @@ const BRF = require('./fixtures/briefing-premium-facts.js');
|
|
|
25
25
|
|
|
26
26
|
const BASE = T.BASE;
|
|
27
27
|
const SHOTS = process.env.PMOS_SHOTS || '';
|
|
28
|
+
// the phone design (Ph2_init): a phone shows an initiative as the popup's phone page; the old page is ⋯ › Every part
|
|
29
|
+
const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 }); await pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); }); await pg.waitForTimeout(800); };
|
|
28
30
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
29
31
|
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
30
32
|
const results = [];
|
|
@@ -116,6 +118,7 @@ async function pure() {
|
|
|
116
118
|
if (sessions) await page.route(/\/api\/sessions(\?.*)?$/, (r) => json(r, { sessions }));
|
|
117
119
|
if (trail) await page.route('**/api/board-trail*', (r) => json(r, trail));
|
|
118
120
|
await page.goto(BASE + '/premium.html?ini=self-serve-v2&ws=w1&board=w1&theme=' + theme);
|
|
121
|
+
if (w <= 760) await everyPart(page);
|
|
119
122
|
const up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer [data-hi-v="page"] .iv-mc')), 30000);
|
|
120
123
|
return { ctx, page, errors, posts, up };
|
|
121
124
|
};
|
|
@@ -48,6 +48,8 @@ const openCard = async (pg, uid, V = '#czViewer') => {
|
|
|
48
48
|
await pg.waitForSelector('.tkc.ivq [data-ive-card]', { timeout: 8000 });
|
|
49
49
|
return pg.click('.tkc.ivq [data-ive-card]');
|
|
50
50
|
};
|
|
51
|
+
// the phone design (Ph2_init): a phone shows an initiative as the popup's phone page; the old page is ⋯ › Every part
|
|
52
|
+
const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 }); await pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); }); await pg.waitForTimeout(800); };
|
|
51
53
|
(async () => {
|
|
52
54
|
const exe = findBrowser();
|
|
53
55
|
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
@@ -149,6 +151,7 @@ const openCard = async (pg, uid, V = '#czViewer') => {
|
|
|
149
151
|
{
|
|
150
152
|
const { ctx, page: p, errors } = await open({ w: 390, h: 844, phone: true });
|
|
151
153
|
const opened = await p.evaluate(() => { const r = document.querySelector('#ibBody [data-key="board:scarlet"], #ibBody [data-row="board:scarlet"] .tg-n'); if (r) r.click(); return !!r; });
|
|
154
|
+
await everyPart(p);
|
|
152
155
|
await p.waitForSelector('.iv-tr', { timeout: 8000 }).catch(() => {});
|
|
153
156
|
await unfold(p);
|
|
154
157
|
const box = await p.$('.iv-tr:has(.iv-tt:text-is("Ship the article summaries API")) .iv-cb');
|
|
@@ -65,6 +65,8 @@ function model() {
|
|
|
65
65
|
return m;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// the phone design (Ph2_init): a phone shows an initiative as the popup's phone page; the old page is ⋯ › Every part
|
|
69
|
+
const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 }); await pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); }); await pg.waitForTimeout(800); };
|
|
68
70
|
(async () => {
|
|
69
71
|
const exe = findBrowser();
|
|
70
72
|
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
@@ -102,6 +104,7 @@ function model() {
|
|
|
102
104
|
await page.waitForSelector('#ibBody [data-key]', { timeout: 15000 });
|
|
103
105
|
await page.waitForTimeout(400);
|
|
104
106
|
await page.locator(`[data-key="board:${INI}"]`).first().click();
|
|
107
|
+
if ((o.w || 1520) <= 760) await everyPart(page);
|
|
105
108
|
await page.waitForSelector('#czViewer .iv-th', { timeout: 8000 });
|
|
106
109
|
await page.waitForTimeout(400);
|
|
107
110
|
return { ctx, page, errors, posts };
|
|
@@ -66,6 +66,8 @@ function model() {
|
|
|
66
66
|
return m;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
// the phone design (Ph2_init): a phone shows an initiative as the popup's phone page; the old page is ⋯ › Every part
|
|
70
|
+
const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 }); await pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); }); await pg.waitForTimeout(800); };
|
|
69
71
|
(async () => {
|
|
70
72
|
const exe = findBrowser();
|
|
71
73
|
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
@@ -164,6 +166,7 @@ function model() {
|
|
|
164
166
|
const { ctx, page, errors } = await open({ w: 390, h: 844 });
|
|
165
167
|
const n = page.locator('[data-key="board:partner-rate-limits"]').first();
|
|
166
168
|
await n.click();
|
|
169
|
+
await everyPart(page);
|
|
167
170
|
await page.waitForSelector('#czViewer [data-vs-chip]', { timeout: 8000 });
|
|
168
171
|
await page.locator('#czViewer [data-vs-chip]').click();
|
|
169
172
|
await page.waitForSelector('.vs-pop.sheet', { timeout: 4000 });
|
|
@@ -65,6 +65,8 @@ const BRF = require('./fixtures/briefing-premium-facts.js');
|
|
|
65
65
|
const IP = require('./lib/initiative-premium.js');
|
|
66
66
|
const IF = require('./fixtures/initiative-premium-facts.js');
|
|
67
67
|
|
|
68
|
+
// the phone design (Ph2_init): a phone shows an initiative as the popup's phone page; the old page is ⋯ › Every part
|
|
69
|
+
const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 }); await pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); }); await pg.waitForTimeout(800); };
|
|
68
70
|
(async () => {
|
|
69
71
|
const exe = findBrowser();
|
|
70
72
|
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
@@ -89,6 +91,7 @@ const IF = require('./fixtures/initiative-premium-facts.js');
|
|
|
89
91
|
await until(() => page.evaluate(() => document.querySelectorAll('#ibBody .ini2, #ibBody .bt-l').length > 0), 20000);
|
|
90
92
|
// the initiative's panel, from its row's name
|
|
91
93
|
await page.evaluate(() => { const b = [...document.querySelectorAll('[data-row="board:usage-billing"] .bt-nm, [data-key="board:usage-billing"]')].find((x) => x.offsetParent); if (b) b.click(); });
|
|
94
|
+
if (w <= 760) await everyPart(page);
|
|
92
95
|
await until(() => page.evaluate(() => !!document.querySelector('#czViewer .iv .iv-th')));
|
|
93
96
|
return { ctx, page, errors, posts };
|
|
94
97
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "The agreed phone design (phone-design-v2, done test C1-C5, C8): the pure parts of the phone menu, swipe, Today rows, Ask PMOS, the recording's So far and slides. No browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"phone-design-v2.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"phone-design-v2.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -71,6 +71,8 @@ const BOARD = (() => { const M = BP.build(BF.facts()); const r = M.rows.find((x)
|
|
|
71
71
|
const BRIEF = BRP.build(BRF.facts());
|
|
72
72
|
const LAYOUT = { ok: true, auto: true, held: [], by: 'stage', names: [], of: {}, stage: {}, sets: [] };
|
|
73
73
|
|
|
74
|
+
// the phone design (Ph2_init): a phone shows an initiative as the popup's phone page; the old page is ⋯ › Every part
|
|
75
|
+
const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 }); await pg.evaluate(() => { const r = (window.__czVwMore ? window.__czVwMore(document.body) : []).find((x) => x.label === 'Every part'); if (r) r.go(); }); await pg.waitForTimeout(800); };
|
|
74
76
|
(async () => {
|
|
75
77
|
const exe = findBrowser();
|
|
76
78
|
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
@@ -111,10 +113,12 @@ const LAYOUT = { ok: true, auto: true, held: [], by: 'stage', names: [], of: {},
|
|
|
111
113
|
await page.goto(BASE + '/premium-board.html?theme=' + theme);
|
|
112
114
|
await until(() => page.evaluate(() => document.querySelectorAll('#ibBody .ini2, #ibBody .bt-l').length > 0), 20000);
|
|
113
115
|
await page.evaluate((id) => { const b = [...document.querySelectorAll(`[data-row="board:${id}"] .bt-nm, [data-key="board:${id}"]`)].find((x) => x.offsetParent); if (b) b.click(); }, I);
|
|
116
|
+
if (w <= 760) await everyPart(page);
|
|
114
117
|
const up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer .iv .iv-th')), 20000);
|
|
115
118
|
return { ctx, page, errors, posts, up, set: (v) => { cur = v; } };
|
|
116
119
|
}
|
|
117
120
|
await page.goto(BASE + '/premium.html?ini=' + I + '&ws=w1&board=w1&theme=' + theme);
|
|
121
|
+
if (w <= 760) await everyPart(page);
|
|
118
122
|
const up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer .iv-mc')), 30000);
|
|
119
123
|
return { ctx, page, errors, posts, up, set: (v) => { cur = v; } };
|
|
120
124
|
};
|