ontrackd 0.14.0 → 0.15.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/dist/core/attachmentTypes.d.ts +4 -1
- package/dist/core/attachmentTypes.js +25 -4
- package/dist/core/attachmentTypes.js.map +1 -1
- package/dist/core/feedbackTypes.d.ts +4 -1
- package/dist/core/untrusted.js +3 -2
- package/dist/core/untrusted.js.map +1 -1
- package/dist/integration/middleware.js +11 -0
- package/dist/integration/middleware.js.map +1 -1
- package/dist/overlay/api.d.ts +9 -1
- package/dist/overlay/api.js +10 -2
- package/dist/overlay/api.js.map +1 -1
- package/dist/overlay/camera.d.ts +130 -0
- package/dist/overlay/camera.js +388 -0
- package/dist/overlay/camera.js.map +1 -0
- package/dist/overlay/cameraEffects.d.ts +10 -0
- package/dist/overlay/cameraEffects.js +240 -0
- package/dist/overlay/cameraEffects.js.map +1 -0
- package/dist/overlay/cameraPanel.d.ts +39 -0
- package/dist/overlay/cameraPanel.js +275 -0
- package/dist/overlay/cameraPanel.js.map +1 -0
- package/dist/overlay/cameraPlayback.d.ts +75 -0
- package/dist/overlay/cameraPlayback.js +291 -0
- package/dist/overlay/cameraPlayback.js.map +1 -0
- package/dist/overlay/directReviewer.d.ts +10 -1
- package/dist/overlay/directReviewer.js +22 -9
- package/dist/overlay/directReviewer.js.map +1 -1
- package/dist/overlay/effects/NOTICE.md +10 -0
- package/dist/overlay/effects/selfie_segmenter.tflite +0 -0
- package/dist/overlay/effects/vision_wasm_internal.js +9155 -0
- package/dist/overlay/effects/vision_wasm_internal.wasm +0 -0
- package/dist/overlay/icons.js +8 -1
- package/dist/overlay/icons.js.map +1 -1
- package/dist/overlay/recorder.d.ts +3 -0
- package/dist/overlay/recorder.js +27 -3
- package/dist/overlay/recorder.js.map +1 -1
- package/dist/overlay/recordingEditor.js +6 -5
- package/dist/overlay/recordingEditor.js.map +1 -1
- package/dist/overlay/recordingPlayer.d.ts +11 -1
- package/dist/overlay/recordingPlayer.js +113 -45
- package/dist/overlay/recordingPlayer.js.map +1 -1
- package/dist/overlay/recordingPlayerShell.d.ts +19 -0
- package/dist/overlay/recordingPlayerShell.js +51 -0
- package/dist/overlay/recordingPlayerShell.js.map +1 -0
- package/dist/overlay/runtime.js +324 -31
- package/dist/overlay/runtime.js.map +1 -1
- package/dist/overlay/storageFull.d.ts +16 -0
- package/dist/overlay/storageFull.js +39 -0
- package/dist/overlay/storageFull.js.map +1 -0
- package/dist/overlay/styles.js +88 -20
- package/dist/overlay/styles.js.map +1 -1
- package/dist/overlay/tasks-vision.js +3 -0
- package/dist/overlay/upload.d.ts +2 -2
- package/dist/overlay/upload.js +4 -2
- package/dist/overlay/upload.js.map +1 -1
- package/dist/sidecar/commentFiles.js +4 -2
- package/dist/sidecar/commentFiles.js.map +1 -1
- package/dist/storage/localAttachments.js +1 -1
- package/dist/storage/localAttachments.js.map +1 -1
- package/package.json +7 -2
package/dist/overlay/runtime.js
CHANGED
|
@@ -11,13 +11,17 @@ import { leaveReviewMode } from './reviewMode.js';
|
|
|
11
11
|
import { api, attachmentsAvailable, recordingSupported, remoteFeedbackStatus, renderable } from './api.js';
|
|
12
12
|
import { acceptAttribute } from '../core/attachmentTypes.js';
|
|
13
13
|
import { AttachmentTray, filesMarkup, trayMarkup } from './attachments.js';
|
|
14
|
-
import { unavailableFile } from './upload.js';
|
|
14
|
+
import { unavailableFile, UploadRefused } from './upload.js';
|
|
15
|
+
import { storageDialogMarkup } from './storageFull.js';
|
|
16
|
+
import { cameraIcon, CameraCapture, loadCameraPrefs, saveCameraPrefs, touchScreen } from './camera.js';
|
|
17
|
+
import { CameraPanel } from './cameraPanel.js';
|
|
15
18
|
import { clock, Recorder } from './recorder.js';
|
|
16
19
|
import { captureElement } from './snapshot.js';
|
|
17
20
|
import { isLocalMachine, notLocalMessage } from './localMachine.js';
|
|
18
21
|
import { hidePinCursor, showPinCursor } from './cursor.js';
|
|
19
22
|
import { colorForId, forgetIdentity, identify, initialsFor, saveIdentity } from './identity.js';
|
|
20
23
|
import { icon } from './icons.js';
|
|
24
|
+
import { recordingPlayerShellMarkup } from './recordingPlayerShell.js';
|
|
21
25
|
import { observeRoute, pageUrl, sameOriginRoute } from './route.js';
|
|
22
26
|
import { cssScopeFor } from './cssScope.js';
|
|
23
27
|
import { flushTrace, trace } from './trace.js';
|
|
@@ -106,6 +110,8 @@ class FeedbackOverlay {
|
|
|
106
110
|
return await api.uploadAttachment(file, onProgress);
|
|
107
111
|
}
|
|
108
112
|
catch (error) {
|
|
113
|
+
if (error instanceof UploadRefused && error.reason === 'storage_full')
|
|
114
|
+
void this.refusedForStorage(file.name.endsWith('.rrweb') ? file : null);
|
|
109
115
|
if (error instanceof SessionExpiredError && this.shared && !this.signIn) {
|
|
110
116
|
if (this.recordingSaving)
|
|
111
117
|
this.pendingRecordingSave = true;
|
|
@@ -132,7 +138,15 @@ class FeedbackOverlay {
|
|
|
132
138
|
* cannot be recorded. Record is offered in a new comment's composer, on a Cloud session, with room to record.
|
|
133
139
|
*/
|
|
134
140
|
recordingLimit;
|
|
141
|
+
/** The workspace's storage as last read: undefined until asked, null where unknown. Only a read that says "full" blocks. */
|
|
142
|
+
storage;
|
|
143
|
+
askingStorage = false;
|
|
144
|
+
storageDialog = null;
|
|
135
145
|
askingRecordingLimit = false;
|
|
146
|
+
/** What the plan allows of a camera file: undefined until asked, null where unknown (no camera is offered). */
|
|
147
|
+
cameraLimit;
|
|
148
|
+
askingCameraLimit = false;
|
|
149
|
+
cameraPanel = null;
|
|
136
150
|
/** The recording in progress: the page is the reviewer's meanwhile (the mode they were in comes back after). */
|
|
137
151
|
recording = null;
|
|
138
152
|
startingRecording = false;
|
|
@@ -391,6 +405,9 @@ class FeedbackOverlay {
|
|
|
391
405
|
for (const type of ['pointerdown', 'pointerup', 'mousedown', 'mouseup', 'touchstart', 'touchend']) {
|
|
392
406
|
document.addEventListener(type, (event) => this.holdTapFromPage(event), true);
|
|
393
407
|
}
|
|
408
|
+
// Back from the dashboard, where space may have been freed: a workspace last seen full is read again.
|
|
409
|
+
document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible' && this.storage?.full)
|
|
410
|
+
void this.stillFull(); });
|
|
394
411
|
document.addEventListener('keydown', (event) => this.handleKeydown(event), true);
|
|
395
412
|
window.addEventListener('scroll', () => this.schedulePositionUpdate(), true);
|
|
396
413
|
window.addEventListener('resize', () => this.schedulePositionUpdate());
|
|
@@ -1135,6 +1152,36 @@ class FeedbackOverlay {
|
|
|
1135
1152
|
this.render();
|
|
1136
1153
|
}
|
|
1137
1154
|
handleKeydown(event) {
|
|
1155
|
+
if (this.storageDialog) {
|
|
1156
|
+
event.stopPropagation();
|
|
1157
|
+
if (event.key === 'Escape') {
|
|
1158
|
+
event.preventDefault();
|
|
1159
|
+
this.closeStorageDialog();
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
if (event.key === 'Tab') {
|
|
1163
|
+
event.preventDefault();
|
|
1164
|
+
const controls = Array.from(this.storageDialog.element.querySelectorAll('a, button'));
|
|
1165
|
+
const at = controls.indexOf(this.root.activeElement);
|
|
1166
|
+
controls[(at + (event.shiftKey ? -1 : 1) + controls.length) % controls.length]?.focus();
|
|
1167
|
+
}
|
|
1168
|
+
else if (event.key !== 'Enter' && event.key !== ' ')
|
|
1169
|
+
event.preventDefault();
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
if (this.cameraPanel) {
|
|
1173
|
+
if (event.key === 'Escape') {
|
|
1174
|
+
event.preventDefault();
|
|
1175
|
+
event.stopPropagation();
|
|
1176
|
+
this.closeCameraPanel();
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
if (event.key === 'Tab') {
|
|
1180
|
+
event.stopPropagation();
|
|
1181
|
+
this.cameraPanel.panel.trapTab(event, this.root.activeElement);
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1138
1185
|
if (this.recordingDiscard) {
|
|
1139
1186
|
const confirm = this.recordingDialog.querySelector('[data-fb-recording-discard]');
|
|
1140
1187
|
const inside = event.composedPath().includes(confirm);
|
|
@@ -1774,6 +1821,9 @@ class FeedbackOverlay {
|
|
|
1774
1821
|
return;
|
|
1775
1822
|
}
|
|
1776
1823
|
const { fbAction: name, fbValue: value } = action.dataset;
|
|
1824
|
+
// The storage dialog is the only interactive surface until it is closed.
|
|
1825
|
+
if (this.storageDialog && name !== 'close-storage-dialog' && name !== 'download-refused-recording')
|
|
1826
|
+
return;
|
|
1777
1827
|
// The alertdialog is the only interactive surface until its choice is made.
|
|
1778
1828
|
if (this.recordingDiscard && name !== 'keep-recording' && name !== 'discard-recording')
|
|
1779
1829
|
return;
|
|
@@ -1781,9 +1831,21 @@ class FeedbackOverlay {
|
|
|
1781
1831
|
if (this.recording && name !== 'stop-recording')
|
|
1782
1832
|
return;
|
|
1783
1833
|
switch (name) {
|
|
1834
|
+
case 'close-storage-dialog':
|
|
1835
|
+
this.closeStorageDialog();
|
|
1836
|
+
break;
|
|
1837
|
+
case 'download-refused-recording':
|
|
1838
|
+
this.downloadRefusedRecording();
|
|
1839
|
+
break;
|
|
1784
1840
|
case 'record-journey':
|
|
1785
1841
|
void this.startRecording(true);
|
|
1786
1842
|
break;
|
|
1843
|
+
case 'camera-panel':
|
|
1844
|
+
if (this.cameraPanel)
|
|
1845
|
+
this.closeCameraPanel();
|
|
1846
|
+
else
|
|
1847
|
+
this.openCameraPanel();
|
|
1848
|
+
break;
|
|
1787
1849
|
case 'record':
|
|
1788
1850
|
void this.startRecording(false);
|
|
1789
1851
|
break;
|
|
@@ -2022,6 +2084,12 @@ class FeedbackOverlay {
|
|
|
2022
2084
|
const which = value === 'reply' ? 'reply' : value === 'recording' ? 'recording' : 'draft';
|
|
2023
2085
|
if (!this.takesFiles(which) || (which === 'recording' ? this.recordingSaving : this.sending === which))
|
|
2024
2086
|
break;
|
|
2087
|
+
if (this.storage?.full) {
|
|
2088
|
+
this.openStorageDialog();
|
|
2089
|
+
void api.storageStatus().then((status) => { this.storage = status; }, () => { });
|
|
2090
|
+
break;
|
|
2091
|
+
}
|
|
2092
|
+
this.ensureStorage();
|
|
2025
2093
|
this.pickingFor = which;
|
|
2026
2094
|
this.fileInput.click();
|
|
2027
2095
|
break;
|
|
@@ -2343,10 +2411,18 @@ class FeedbackOverlay {
|
|
|
2343
2411
|
]);
|
|
2344
2412
|
if (!snapshot)
|
|
2345
2413
|
return;
|
|
2414
|
+
if (this.storage?.full && await this.stillFull()) {
|
|
2415
|
+
this.openStorageDialog();
|
|
2416
|
+
return;
|
|
2417
|
+
}
|
|
2346
2418
|
try {
|
|
2347
2419
|
await api.uploadScreenshot(commentId, snapshot);
|
|
2348
2420
|
}
|
|
2349
2421
|
catch (error) {
|
|
2422
|
+
if (error instanceof UploadRefused && error.reason === 'storage_full') {
|
|
2423
|
+
this.openStorageDialog();
|
|
2424
|
+
return;
|
|
2425
|
+
}
|
|
2350
2426
|
this.trace('screenshot-failed', { reason: error instanceof Error ? error.message.slice(0, 120) : 'unknown' });
|
|
2351
2427
|
}
|
|
2352
2428
|
}
|
|
@@ -2394,15 +2470,111 @@ class FeedbackOverlay {
|
|
|
2394
2470
|
this.askingRecordingLimit = true;
|
|
2395
2471
|
void api.recordingLimit().then((limit) => { this.recordingLimit = limit; this.askingRecordingLimit = false; this.render(); });
|
|
2396
2472
|
}
|
|
2473
|
+
if (this.cameraLimit === undefined && !this.askingCameraLimit) {
|
|
2474
|
+
this.askingCameraLimit = true;
|
|
2475
|
+
void api.cameraLimit().then((limit) => { this.cameraLimit = limit; this.askingCameraLimit = false; this.render(); }, () => { this.cameraLimit = null; this.askingCameraLimit = false; });
|
|
2476
|
+
}
|
|
2477
|
+
this.ensureStorage();
|
|
2397
2478
|
return this.recordingLimit?.available === true;
|
|
2398
2479
|
}
|
|
2480
|
+
/** The camera is offered where Record is, the plan has it, and the device is not a touch screen. Hidden entirely otherwise. */
|
|
2481
|
+
cameraOffered() {
|
|
2482
|
+
return this.recordOffered() && this.cameraLimit?.available === true && !touchScreen();
|
|
2483
|
+
}
|
|
2484
|
+
openCameraPanel() {
|
|
2485
|
+
if (this.cameraPanel || this.recording || this.startingRecording || this.recordingSaving || this.recordingDraft || !this.cameraOffered())
|
|
2486
|
+
return;
|
|
2487
|
+
const focus = this.root.activeElement;
|
|
2488
|
+
const panel = new CameraPanel(this.root, {
|
|
2489
|
+
start: () => { this.closeCameraPanel(false); void this.startRecording(true); },
|
|
2490
|
+
pageOnly: () => { this.closeCameraPanel(false); void this.startRecording(true, { pageOnly: true }); },
|
|
2491
|
+
close: () => this.closeCameraPanel(),
|
|
2492
|
+
});
|
|
2493
|
+
this.cameraPanel = { panel, focus };
|
|
2494
|
+
}
|
|
2495
|
+
closeCameraPanel(restoreFocus = true) {
|
|
2496
|
+
const open = this.cameraPanel;
|
|
2497
|
+
if (!open)
|
|
2498
|
+
return;
|
|
2499
|
+
this.cameraPanel = null;
|
|
2500
|
+
open.panel.close();
|
|
2501
|
+
if (restoreFocus) {
|
|
2502
|
+
const button = this.root.querySelector('[data-fb-action="camera-panel"]');
|
|
2503
|
+
if (open.focus instanceof HTMLElement && open.focus.isConnected)
|
|
2504
|
+
open.focus.focus();
|
|
2505
|
+
else
|
|
2506
|
+
button?.focus();
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
/** Asks the workspace's storage once; a failed read leaves it unknown, and unknown never blocks. */
|
|
2510
|
+
ensureStorage() {
|
|
2511
|
+
if (this.storage !== undefined || this.askingStorage)
|
|
2512
|
+
return;
|
|
2513
|
+
this.askingStorage = true;
|
|
2514
|
+
void api.storageStatus().then((status) => { this.storage = status; }, () => { this.storage = null; }).finally(() => { this.askingStorage = false; });
|
|
2515
|
+
}
|
|
2516
|
+
/** Whether a workspace last seen full still is: read again, since space may have been freed meanwhile. */
|
|
2517
|
+
async stillFull() {
|
|
2518
|
+
const fresh = await api.storageStatus().catch(() => undefined);
|
|
2519
|
+
if (fresh !== undefined)
|
|
2520
|
+
this.storage = fresh;
|
|
2521
|
+
return this.storage?.full === true;
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* The "Storage is full" dialog, in place of whatever was about to start. The buttons are the Worker's `actions`
|
|
2525
|
+
* for this reviewer; with no dashboard known there are no links. A refused recording can be saved locally.
|
|
2526
|
+
*/
|
|
2527
|
+
openStorageDialog(recording = null) {
|
|
2528
|
+
if (this.storage)
|
|
2529
|
+
this.storage = { ...this.storage, full: true };
|
|
2530
|
+
else
|
|
2531
|
+
this.storage = { used: 0, limit: null, full: true, actions: [], dashboard: null };
|
|
2532
|
+
this.closeStorageDialog(false);
|
|
2533
|
+
const holder = document.createElement('div');
|
|
2534
|
+
holder.innerHTML = storageDialogMarkup(this.storage, recording !== null);
|
|
2535
|
+
const element = holder.firstElementChild;
|
|
2536
|
+
this.storageDialog = { element, recording, focus: this.root.activeElement };
|
|
2537
|
+
this.root.append(element);
|
|
2538
|
+
element.querySelector('a, button')?.focus();
|
|
2539
|
+
}
|
|
2540
|
+
/** Another reviewer took the last room: the dialog's buttons come from a fresh read, not from what was cached. */
|
|
2541
|
+
async refusedForStorage(recording) {
|
|
2542
|
+
const fresh = await api.storageStatus().catch(() => null);
|
|
2543
|
+
if (fresh)
|
|
2544
|
+
this.storage = fresh;
|
|
2545
|
+
this.openStorageDialog(recording);
|
|
2546
|
+
}
|
|
2547
|
+
closeStorageDialog(restoreFocus = true) {
|
|
2548
|
+
const open = this.storageDialog;
|
|
2549
|
+
if (!open)
|
|
2550
|
+
return;
|
|
2551
|
+
this.storageDialog = null;
|
|
2552
|
+
open.element.remove();
|
|
2553
|
+
if (restoreFocus && open.focus instanceof HTMLElement && open.focus.isConnected)
|
|
2554
|
+
open.focus.focus();
|
|
2555
|
+
}
|
|
2556
|
+
downloadRefusedRecording() {
|
|
2557
|
+
const file = this.storageDialog?.recording;
|
|
2558
|
+
if (!file)
|
|
2559
|
+
return;
|
|
2560
|
+
const url = URL.createObjectURL(file);
|
|
2561
|
+
const link = document.createElement('a');
|
|
2562
|
+
link.href = url;
|
|
2563
|
+
link.download = file.name;
|
|
2564
|
+
link.rel = 'noopener';
|
|
2565
|
+
this.root.append(link);
|
|
2566
|
+
link.click();
|
|
2567
|
+
link.remove();
|
|
2568
|
+
window.setTimeout(() => URL.revokeObjectURL(url), 30_000);
|
|
2569
|
+
}
|
|
2399
2570
|
/**
|
|
2400
2571
|
* Records the page while the reviewer reproduces the problem. The mode they were in is set aside, so the page
|
|
2401
2572
|
* behaves as if the tool were absent; the draft stays. The limit is asked again: the plan may have changed.
|
|
2402
2573
|
*/
|
|
2403
|
-
async startRecording(journey) {
|
|
2574
|
+
async startRecording(journey, options = {}) {
|
|
2404
2575
|
if (this.recording || this.startingRecording || this.recordingSaving)
|
|
2405
2576
|
return;
|
|
2577
|
+
this.closeCameraPanel(false);
|
|
2406
2578
|
if (journey && this.recordingDraft) {
|
|
2407
2579
|
this.askToDiscardRecording(true);
|
|
2408
2580
|
return;
|
|
@@ -2420,8 +2592,14 @@ class FeedbackOverlay {
|
|
|
2420
2592
|
}
|
|
2421
2593
|
};
|
|
2422
2594
|
try {
|
|
2423
|
-
const limit = await api.recordingLimit();
|
|
2595
|
+
const [limit, storage, cameraLimit] = await Promise.all([api.recordingLimit(), api.storageStatus().catch(() => null), journey ? api.cameraLimit() : Promise.resolve(null)]);
|
|
2424
2596
|
this.recordingLimit = limit;
|
|
2597
|
+
this.cameraLimit = cameraLimit;
|
|
2598
|
+
this.storage = storage;
|
|
2599
|
+
if (storage?.full && limit?.available) {
|
|
2600
|
+
this.openStorageDialog();
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2425
2603
|
if (!journey && this.draft !== pinDraft)
|
|
2426
2604
|
return;
|
|
2427
2605
|
if (!limit?.available) {
|
|
@@ -2430,17 +2608,33 @@ class FeedbackOverlay {
|
|
|
2430
2608
|
}
|
|
2431
2609
|
const recorder = new Recorder(limit, '[data-feedback-overlay]', (elapsed) => this.showRecordingTime(elapsed), api.recordingOrigin());
|
|
2432
2610
|
const from = this.state.mode;
|
|
2611
|
+
// The saved camera and microphone choices, for Record and Alt+Shift+R alike: with both off this is the plain page recording.
|
|
2612
|
+
let camera = null;
|
|
2613
|
+
const prefs = loadCameraPrefs();
|
|
2614
|
+
if (journey && !options.pageOnly && cameraLimit?.available && !touchScreen() && (prefs.camera || prefs.mic)) {
|
|
2615
|
+
const opened = await CameraCapture.open(this.root, prefs, cameraLimit.bytes, (move, final) => {
|
|
2616
|
+
recorder.emitCustom('ontrackd-camera', move);
|
|
2617
|
+
if (final && camera?.bubble) {
|
|
2618
|
+
saveCameraPrefs({ ...loadCameraPrefs(), at: camera.bubble.centre });
|
|
2619
|
+
}
|
|
2620
|
+
});
|
|
2621
|
+
camera = opened.capture;
|
|
2622
|
+
if (opened.problems.length)
|
|
2623
|
+
this.showReviewerNotice(`${opened.problems[0]}${camera ? '' : ' Recording the page only.'}`);
|
|
2624
|
+
}
|
|
2433
2625
|
const recording = {
|
|
2434
2626
|
recorder, journey, from, limit, elapsed: 0, route: location.pathname,
|
|
2435
|
-
moved: false, countdown: COUNTDOWN_SECONDS,
|
|
2627
|
+
moved: false, countdown: COUNTDOWN_SECONDS, ...(camera ? { camera } : {}),
|
|
2436
2628
|
};
|
|
2437
2629
|
this.recording = recording;
|
|
2438
2630
|
// The page as it is without the pin cursor and the highlight: that is where the recording begins.
|
|
2439
2631
|
this.state.setMode('visible');
|
|
2440
2632
|
this.render();
|
|
2441
2633
|
this.root.querySelector('[data-fb-action="stop-recording"]')?.focus();
|
|
2442
|
-
if (!await this.countDown(recording))
|
|
2634
|
+
if (!await this.countDown(recording)) {
|
|
2635
|
+
camera?.dispose();
|
|
2443
2636
|
return;
|
|
2637
|
+
}
|
|
2444
2638
|
if (recording.journey) {
|
|
2445
2639
|
recording.route = location.pathname;
|
|
2446
2640
|
recording.url = remoteFeedbackStatus ? pageUrl(window.location.href, { query: false }) ?? undefined : undefined;
|
|
@@ -2449,6 +2643,7 @@ class FeedbackOverlay {
|
|
|
2449
2643
|
await recorder.start();
|
|
2450
2644
|
}
|
|
2451
2645
|
catch {
|
|
2646
|
+
camera?.dispose();
|
|
2452
2647
|
if (this.recording !== recording)
|
|
2453
2648
|
return;
|
|
2454
2649
|
this.recording = null;
|
|
@@ -2460,11 +2655,23 @@ class FeedbackOverlay {
|
|
|
2460
2655
|
}
|
|
2461
2656
|
// Cancelled at zero, while it loaded: it is stopped, and what it recorded is dropped.
|
|
2462
2657
|
if (this.recording !== recording) {
|
|
2658
|
+
camera?.dispose();
|
|
2463
2659
|
recorder.stop();
|
|
2464
2660
|
return;
|
|
2465
2661
|
}
|
|
2466
2662
|
recording.countdown = null;
|
|
2467
|
-
|
|
2663
|
+
if (camera) {
|
|
2664
|
+
if (!camera.start()) {
|
|
2665
|
+
recording.camera = undefined;
|
|
2666
|
+
this.showReviewerNotice('The camera could not be recorded here. Recording the page only.');
|
|
2667
|
+
}
|
|
2668
|
+
else if (camera.bubble)
|
|
2669
|
+
recorder.emitCustom('ontrackd-camera', camera.bubble.move);
|
|
2670
|
+
}
|
|
2671
|
+
void recorder.ended.then(async (end) => {
|
|
2672
|
+
const captured = recording.camera ? await recording.camera.finish() : null;
|
|
2673
|
+
this.recordingEnded(recording, end, captured);
|
|
2674
|
+
});
|
|
2468
2675
|
this.render();
|
|
2469
2676
|
this.root.querySelector('[data-fb-action="stop-recording"]')?.focus();
|
|
2470
2677
|
}
|
|
@@ -2517,7 +2724,7 @@ class FeedbackOverlay {
|
|
|
2517
2724
|
this.showCountdown();
|
|
2518
2725
|
});
|
|
2519
2726
|
}
|
|
2520
|
-
recordingEnded(recording, end) {
|
|
2727
|
+
recordingEnded(recording, end, captured = null) {
|
|
2521
2728
|
if (this.recording !== recording)
|
|
2522
2729
|
return;
|
|
2523
2730
|
this.recording = null;
|
|
@@ -2532,6 +2739,7 @@ class FeedbackOverlay {
|
|
|
2532
2739
|
}
|
|
2533
2740
|
this.recordingDraft = {
|
|
2534
2741
|
...end,
|
|
2742
|
+
...(captured?.file ? { camera: captured.file } : {}),
|
|
2535
2743
|
route: recording.route,
|
|
2536
2744
|
...(recording.url ? { url: recording.url } : {}),
|
|
2537
2745
|
createIdentity: { id: newId('cmt'), idempotencyKey: newIdempotencyKey() },
|
|
@@ -2539,6 +2747,8 @@ class FeedbackOverlay {
|
|
|
2539
2747
|
this.recordingError = end.reason === 'user' ? null
|
|
2540
2748
|
: end.reason === 'limit' ? `Stopped at ${clock(recording.limit.seconds * 1000)}, the most your plan records`
|
|
2541
2749
|
: 'Stopped: the recording got too long';
|
|
2750
|
+
if (captured?.tooBig)
|
|
2751
|
+
this.recordingError = `${this.recordingError ? `${this.recordingError}. ` : ''}The camera video was over your plan's size and was left out. The page recording is kept.`;
|
|
2542
2752
|
this.recordingUiFailed = false;
|
|
2543
2753
|
this.recordingDiscard = null;
|
|
2544
2754
|
this.recordingTray.reset();
|
|
@@ -2591,11 +2801,17 @@ class FeedbackOverlay {
|
|
|
2591
2801
|
return;
|
|
2592
2802
|
const focusEditor = !this.recordingEditor;
|
|
2593
2803
|
this.recordingEditor ??= new ui.RecordingEditor(editorHost);
|
|
2804
|
+
// The paperclip joins the formatting toolbar once it exists; it waits beside the editor until then,
|
|
2805
|
+
// so a recording whose editor failed to load can still take files.
|
|
2806
|
+
const attach = this.recordingDialog.querySelector('[data-fb-recording-attach] [data-fb-action="attach"]');
|
|
2807
|
+
if (attach)
|
|
2808
|
+
editorHost.querySelector('.fb-recording-editor__toolbar')?.append(attach);
|
|
2594
2809
|
this.renderRecordingDialog();
|
|
2595
2810
|
if (focusEditor)
|
|
2596
2811
|
this.recordingEditor.element.focus();
|
|
2597
2812
|
if (!this.recordingPlayer) {
|
|
2598
|
-
const
|
|
2813
|
+
const camera = draft.camera ? { file: Promise.resolve(draft.camera), voice: draft.camera.type.startsWith('audio/') } : null;
|
|
2814
|
+
const player = new ui.RecordingPlayer(playerHost, draft.file, undefined, { w: window.innerWidth, h: window.innerHeight }, camera);
|
|
2599
2815
|
this.recordingPlayer = player;
|
|
2600
2816
|
try {
|
|
2601
2817
|
await player.ready;
|
|
@@ -2641,6 +2857,9 @@ class FeedbackOverlay {
|
|
|
2641
2857
|
this.recordingEditor?.element.focus();
|
|
2642
2858
|
}
|
|
2643
2859
|
discardRecording() {
|
|
2860
|
+
const cameraUpload = this.recordingDraft?.cameraUpload;
|
|
2861
|
+
if (cameraUpload)
|
|
2862
|
+
void api.discardUpload(cameraUpload.id).catch(() => undefined);
|
|
2644
2863
|
this.recordingPlayer?.destroy();
|
|
2645
2864
|
this.recordingPlayer = null;
|
|
2646
2865
|
this.recordingEditor = null;
|
|
@@ -2682,6 +2901,49 @@ class FeedbackOverlay {
|
|
|
2682
2901
|
this.renderRecordingDialog();
|
|
2683
2902
|
return;
|
|
2684
2903
|
}
|
|
2904
|
+
// The camera video is paired with the recording upload it belongs to. A failure other than a full storage or an
|
|
2905
|
+
// expired session costs only the camera: the page recording is saved without it.
|
|
2906
|
+
const recordingId = recordingUploads[0].upload.id;
|
|
2907
|
+
const cameraIds = [];
|
|
2908
|
+
if (draft.camera) {
|
|
2909
|
+
if (draft.cameraUpload && draft.cameraUpload.pairedWith !== recordingId) {
|
|
2910
|
+
void api.discardUpload(draft.cameraUpload.id).catch(() => undefined);
|
|
2911
|
+
draft.cameraUpload = undefined;
|
|
2912
|
+
}
|
|
2913
|
+
if (!draft.cameraUpload) {
|
|
2914
|
+
try {
|
|
2915
|
+
const upload = await api.uploadAttachment(draft.camera, () => undefined, { pairsWith: recordingId });
|
|
2916
|
+
if (this.recordingDraft !== draft) {
|
|
2917
|
+
void api.discardUpload(upload.id).catch(() => undefined);
|
|
2918
|
+
this.recordingSaving = false;
|
|
2919
|
+
return;
|
|
2920
|
+
}
|
|
2921
|
+
draft.cameraUpload = { id: upload.id, pairedWith: recordingId };
|
|
2922
|
+
}
|
|
2923
|
+
catch (error) {
|
|
2924
|
+
if (this.recordingDraft !== draft) {
|
|
2925
|
+
this.recordingSaving = false;
|
|
2926
|
+
return;
|
|
2927
|
+
}
|
|
2928
|
+
if (error instanceof SessionExpiredError && this.shared) {
|
|
2929
|
+
this.recordingSaving = false;
|
|
2930
|
+
this.pendingRecordingSave = true;
|
|
2931
|
+
this.handleSessionExpired();
|
|
2932
|
+
return;
|
|
2933
|
+
}
|
|
2934
|
+
if (error instanceof UploadRefused && error.reason === 'storage_full') {
|
|
2935
|
+
this.recordingSaving = false;
|
|
2936
|
+
this.renderRecordingDialog();
|
|
2937
|
+
void this.refusedForStorage(draft.file);
|
|
2938
|
+
return;
|
|
2939
|
+
}
|
|
2940
|
+
draft.camera = undefined;
|
|
2941
|
+
this.recordingError = 'The camera video could not be uploaded, so it was left out. The page recording is kept.';
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
if (draft.cameraUpload)
|
|
2945
|
+
cameraIds.push(draft.cameraUpload.id);
|
|
2946
|
+
}
|
|
2685
2947
|
let created;
|
|
2686
2948
|
try {
|
|
2687
2949
|
created = await api.createComment({
|
|
@@ -2698,17 +2960,18 @@ class FeedbackOverlay {
|
|
|
2698
2960
|
recording: { durationMs: draft.durationMs, startedAt: draft.startedAt },
|
|
2699
2961
|
journey: draft.journey,
|
|
2700
2962
|
...(draft.journeyTruncated ? { journeyTruncated: true } : {}),
|
|
2701
|
-
attachmentIds,
|
|
2963
|
+
attachmentIds: [...attachmentIds, ...cameraIds],
|
|
2702
2964
|
}, draft.createIdentity);
|
|
2703
2965
|
}
|
|
2704
2966
|
catch (error) {
|
|
2705
2967
|
this.recordingSaving = false;
|
|
2706
2968
|
const unavailable = unavailableFile(error);
|
|
2969
|
+
if (unavailable && draft.cameraUpload?.id === unavailable)
|
|
2970
|
+
draft.cameraUpload = undefined;
|
|
2707
2971
|
const refusedRecording = recordingAttachmentRefusal(error);
|
|
2708
|
-
if (unavailable)
|
|
2972
|
+
if (unavailable && unavailable !== cameraIds[0])
|
|
2709
2973
|
this.recordingTray.fail(unavailable, 'No longer available: remove it and add it again');
|
|
2710
2974
|
if (refusedRecording) {
|
|
2711
|
-
const recordingId = recordingUploads[0]?.upload?.id;
|
|
2712
2975
|
if (recordingId)
|
|
2713
2976
|
this.recordingTray.fail(recordingId, 'Upload expired: Save again to retry');
|
|
2714
2977
|
// This refusal is definitive and can be cached under the idempotency key. A new upload
|
|
@@ -2806,7 +3069,11 @@ class FeedbackOverlay {
|
|
|
2806
3069
|
if (this.threadRecordingFile?.key !== key) {
|
|
2807
3070
|
this.threadRecordingFile?.abort.abort();
|
|
2808
3071
|
const abort = new AbortController();
|
|
2809
|
-
|
|
3072
|
+
// The camera or voice file recorded with it is fetched beside it; the replay does not wait for it.
|
|
3073
|
+
const video = comment.attachments?.find((item) => item.kind === 'video' && item.pairsWith === attachment.id);
|
|
3074
|
+
const camera = video ? { file: api.attachmentBlob(comment.id, video.id, abort.signal), voice: video.mime.startsWith('audio/') } : null;
|
|
3075
|
+
camera?.file.catch(() => undefined);
|
|
3076
|
+
this.threadRecordingFile = { key, abort, promise: api.attachmentBlob(comment.id, attachment.id, abort.signal), camera };
|
|
2810
3077
|
}
|
|
2811
3078
|
const loading = this.threadRecordingFile;
|
|
2812
3079
|
try {
|
|
@@ -2815,7 +3082,7 @@ class FeedbackOverlay {
|
|
|
2815
3082
|
this.threadRecordingFile = null;
|
|
2816
3083
|
if (generation !== this.threadRecordingGeneration || this.state.openThreadId !== comment.id || !host.isConnected)
|
|
2817
3084
|
return;
|
|
2818
|
-
const player = new ui.RecordingPlayer(host, file);
|
|
3085
|
+
const player = new ui.RecordingPlayer(host, file, undefined, comment.context?.viewport, loading.camera);
|
|
2819
3086
|
this.threadRecordingPlayer = player;
|
|
2820
3087
|
this.threadRecordingPlayerId = comment.id;
|
|
2821
3088
|
try {
|
|
@@ -2859,11 +3126,11 @@ class FeedbackOverlay {
|
|
|
2859
3126
|
pill.innerHTML = phase === 'countdown'
|
|
2860
3127
|
? `<span class="fb-sr" role="status">Recording starts in ${COUNTDOWN_SECONDS} seconds. Cancel recording is the last button on the page.</span>
|
|
2861
3128
|
<span class="fb-recorder__dot" aria-hidden="true"></span><span class="fb-recorder__label" aria-hidden="true">Recording in <span data-fb-countdown-text>${this.recording.countdown}</span></span>
|
|
2862
|
-
<button type="button" class="fb-recorder__stop" data-fb-action="stop-recording" aria-label="Cancel recording"
|
|
3129
|
+
<button type="button" class="fb-recorder__stop" data-fb-action="stop-recording" aria-label="Cancel recording">${icon('close', 15)}</button>`
|
|
2863
3130
|
: `<span class="fb-sr" role="status">Recording started. Stop recording is the last button on the page.</span>
|
|
2864
3131
|
<span class="fb-recorder__dot" aria-hidden="true"></span><span class="fb-recorder__label" aria-hidden="true">Recording</span>
|
|
2865
3132
|
<span class="fb-recorder__time" data-fb-recorder-time aria-hidden="true">${clock(0)} / ${clock(this.recording.limit.seconds * 1000)}</span>
|
|
2866
|
-
<button type="button" class="fb-recorder__stop" data-fb-action="stop-recording" aria-label="Stop recording"
|
|
3133
|
+
<button type="button" class="fb-recorder__stop" data-fb-action="stop-recording" aria-label="Stop recording">${icon('stop', 14)}</button>`;
|
|
2867
3134
|
this.showCountdown();
|
|
2868
3135
|
}
|
|
2869
3136
|
/** The seconds left, big on the page and in the indicator; both gone once the recording starts. */
|
|
@@ -3697,7 +3964,7 @@ class FeedbackOverlay {
|
|
|
3697
3964
|
delete this.bar.dataset.compact;
|
|
3698
3965
|
this.bar.innerHTML = closed
|
|
3699
3966
|
? closedBarMarkup()
|
|
3700
|
-
: openBarMarkup(this.state, this.identity, this.notifications?.unread ?? 0, this.recordOffered());
|
|
3967
|
+
: openBarMarkup(this.state, this.identity, this.notifications?.unread ?? 0, this.recordOffered(), this.cameraOffered());
|
|
3701
3968
|
// After the markup: the open bar is wider than the closed one, and the placement is
|
|
3702
3969
|
// clamped against the size it actually has.
|
|
3703
3970
|
this.placeBar();
|
|
@@ -4384,10 +4651,21 @@ class FeedbackOverlay {
|
|
|
4384
4651
|
const composing = this.editingKey ? this.editingBody : this.replyBody;
|
|
4385
4652
|
this.popover.dataset.draft = 'false';
|
|
4386
4653
|
this.popover.dataset.resolved = String(thread.status === 'resolved');
|
|
4387
|
-
|
|
4654
|
+
const markup = recordingThreadMarkup(thread, this.identity, composing, this.editingKey, this.editingKey ? this.saveError : null, this.sending === (this.editingKey ? 'edit' : 'reply'), { offered: this.takesFiles('reply'), tray: this.editingKey || (this.claimingReplyFor && this.claimingReplyFor !== thread.id) ? '' : trayMarkup(this.replyTray, 'reply'),
|
|
4388
4655
|
blocked: this.replyTray.blocked && (!this.claimingReplyFor || this.claimingReplyFor === thread.id) }, (attachment) => this.fileUrl(thread.id, attachment), this.compact && this.sheetBack !== null, mayChange(thread, this.identity, this.direct?.moderates ?? true));
|
|
4389
4656
|
if (retainedHost) {
|
|
4390
|
-
|
|
4657
|
+
/**
|
|
4658
|
+
* Everything but the player is replaced. The player holds the replay's iframe, and an
|
|
4659
|
+
* iframe taken out of the page, even for a moment, comes back as an empty document: the
|
|
4660
|
+
* cursor kept moving over a white frame.
|
|
4661
|
+
*/
|
|
4662
|
+
const fresh = document.createElement('template');
|
|
4663
|
+
fresh.innerHTML = markup;
|
|
4664
|
+
this.popover.querySelector('.fb-card-head')?.replaceWith(fresh.content.querySelector('.fb-card-head'));
|
|
4665
|
+
this.popover.querySelector('[data-fb-recording-thread-side]')?.replaceWith(fresh.content.querySelector('[data-fb-recording-thread-side]'));
|
|
4666
|
+
}
|
|
4667
|
+
else {
|
|
4668
|
+
this.popover.innerHTML = markup;
|
|
4391
4669
|
}
|
|
4392
4670
|
this.popover.style.display = 'block';
|
|
4393
4671
|
this.positionPopover();
|
|
@@ -4690,6 +4968,12 @@ class FeedbackOverlay {
|
|
|
4690
4968
|
this.popover.dataset.stackBelow = String(this.popover.getBoundingClientRect().top < 64);
|
|
4691
4969
|
return;
|
|
4692
4970
|
}
|
|
4971
|
+
// A recording has no pin to sit beside: its two-column card is centred like a dialog.
|
|
4972
|
+
if (this.popover.querySelector('.fb-recording-thread')) {
|
|
4973
|
+
this.popover.style.left = `${fit((window.innerWidth - width) / 2, width, window.innerWidth)}px`;
|
|
4974
|
+
this.popover.style.top = `${fit((window.innerHeight - height) / 2, height, window.innerHeight)}px`;
|
|
4975
|
+
return;
|
|
4976
|
+
}
|
|
4693
4977
|
const origin = this.popoverOrigin();
|
|
4694
4978
|
const gap = 12;
|
|
4695
4979
|
// Prefer below-right of the origin, flip up or left only when it would overflow.
|
|
@@ -4782,18 +5066,18 @@ function recordingDialogMarkup() {
|
|
|
4782
5066
|
<button type="button" class="fb-icon-btn" data-fb-action="cancel-recording" aria-label="Cancel">${icon('close', 16)}</button>
|
|
4783
5067
|
</header>
|
|
4784
5068
|
<div class="fb-recording-dialog__columns">
|
|
4785
|
-
<div class="fb-recording-dialog__player" data-fb-recording-player
|
|
5069
|
+
<div class="fb-recording-dialog__player" data-fb-recording-player>${recordingPlayerShellMarkup({ w: window.innerWidth, h: window.innerHeight })}</div>
|
|
4786
5070
|
<div class="fb-recording-dialog__compose">
|
|
4787
5071
|
<div data-fb-recording-error class="fb-savefail" role="alert" hidden></div>
|
|
5072
|
+
<div class="fb-recording-dialog__attach" data-fb-recording-attach>${attachButton('recording', false)}</div>
|
|
4788
5073
|
<div data-fb-recording-editor-host><span class="fb-recording-loading">Loading editor…</span></div>
|
|
4789
5074
|
<div data-fb-recording-tray></div>
|
|
4790
|
-
<div class="fb-recording-dialog__actions">
|
|
4791
|
-
${attachButton('recording', false)}
|
|
4792
|
-
<button type="button" class="fb-threadblock__cancel" data-fb-action="cancel-recording">Cancel</button>
|
|
4793
|
-
<button type="button" class="fb-primary" data-fb-action="save-recording">Save</button>
|
|
4794
|
-
</div>
|
|
4795
5075
|
</div>
|
|
4796
5076
|
</div>
|
|
5077
|
+
<footer class="fb-recording-dialog__foot">
|
|
5078
|
+
<button type="button" class="fb-recording-dialog__cancel" data-fb-action="cancel-recording">Cancel</button>
|
|
5079
|
+
<button type="button" class="fb-recording-dialog__save" data-fb-action="save-recording">Save</button>
|
|
5080
|
+
</footer>
|
|
4797
5081
|
</section>
|
|
4798
5082
|
</div>`;
|
|
4799
5083
|
}
|
|
@@ -4801,8 +5085,8 @@ function recordingDiscardMarkup() {
|
|
|
4801
5085
|
return `<div class="fb-recording-discard" data-fb-recording-discard role="alertdialog" aria-modal="true" aria-label="Discard this recording?">
|
|
4802
5086
|
<div class="fb-recording-discard__card">
|
|
4803
5087
|
<p>Discard this recording?</p>
|
|
4804
|
-
<div><button type="button" class="fb-
|
|
4805
|
-
<button type="button" class="fb-
|
|
5088
|
+
<div><button type="button" class="fb-recording-discard__keep" data-fb-action="keep-recording">Keep</button>
|
|
5089
|
+
<button type="button" class="fb-recording-discard__drop" data-fb-action="discard-recording">Discard</button></div>
|
|
4806
5090
|
</div>
|
|
4807
5091
|
</div>`;
|
|
4808
5092
|
}
|
|
@@ -4819,7 +5103,7 @@ function closedBarMarkup() {
|
|
|
4819
5103
|
return `<button type="button" data-fb-action="close-overlay" data-tip="Show feedback" data-tip-keys="${toggleKeys}"
|
|
4820
5104
|
aria-label="Show feedback" aria-keyshortcuts="Alt+Shift+F">${icon('comment', 17)}</button>`;
|
|
4821
5105
|
}
|
|
4822
|
-
function openBarMarkup(state, identity, unread = 0, record = false) {
|
|
5106
|
+
function openBarMarkup(state, identity, unread = 0, record = false, camera = false) {
|
|
4823
5107
|
const commenting = state.mode === 'commenting';
|
|
4824
5108
|
const count = state.routeCount();
|
|
4825
5109
|
unread += state.newRemoteComments;
|
|
@@ -4843,7 +5127,8 @@ function openBarMarkup(state, identity, unread = 0, record = false) {
|
|
|
4843
5127
|
*/
|
|
4844
5128
|
unread > 0 ? '<span class="fb-dot" aria-label="Unread feedback"></span>' : ''}</button>
|
|
4845
5129
|
${record ? `<button type="button" data-fb-action="record-journey" data-tip="Record" data-tip-keys="Alt+Shift+R"
|
|
4846
|
-
aria-label="Record" aria-keyshortcuts="Alt+Shift+R"
|
|
5130
|
+
aria-label="Record" aria-keyshortcuts="Alt+Shift+R">${icon('record', 17)}</button>` : ''}
|
|
5131
|
+
${record && camera ? `<button type="button" data-fb-action="camera-panel" data-tip="Camera and microphone" aria-label="Camera and microphone" aria-haspopup="dialog">${cameraIcon(17)}</button>` : ''}
|
|
4847
5132
|
${state.remoteNotice ? `<span role="status" style="font-size:11px;max-width:180px">${escapeHtml(state.remoteNotice)}</span>` : ''}
|
|
4848
5133
|
<span class="fb-sep"></span>
|
|
4849
5134
|
${identity
|
|
@@ -5180,9 +5465,17 @@ function threadMarkup(comment, identity, value, editing, editError, sending, fil
|
|
|
5180
5465
|
function recordingThreadMarkup(comment, identity, value, editing, editError, sending, files, fileUrl, back = false, changeable = true) {
|
|
5181
5466
|
const markup = threadMarkup(comment, identity, value, editing, editError, sending, files, fileUrl, back, changeable);
|
|
5182
5467
|
const duration = clock(comment.recording?.durationMs ?? 0);
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5468
|
+
const split = markup.indexOf('<div class="fb-card-body">');
|
|
5469
|
+
// Two columns: the video on the left, the messages and the reply box on the right. The right
|
|
5470
|
+
// column is its own element so a render can swap it without touching the player beside it.
|
|
5471
|
+
return `${markup.slice(0, split)}
|
|
5472
|
+
<div class="fb-recording-thread">
|
|
5473
|
+
<div class="fb-recording-thread__media">
|
|
5474
|
+
<div class="fb-recording-thread-head"><span>Recording</span><time>${escapeHtml(duration)}</time></div>
|
|
5475
|
+
<div data-fb-recording-thread-player class="fb-recording-thread-player">${recordingPlayerShellMarkup(comment.context?.viewport)}</div>
|
|
5476
|
+
</div>
|
|
5477
|
+
<div class="fb-recording-thread__side" data-fb-recording-thread-side>${markup.slice(split)}</div>
|
|
5478
|
+
</div>`;
|
|
5186
5479
|
}
|
|
5187
5480
|
/**
|
|
5188
5481
|
* The one place in a thread where anything is typed, and the one place the actions live.
|