@vitrinka/web 0.7.2 → 0.8.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/CHANGELOG.md +119 -0
- package/README.md +117 -19
- package/build/hud.iife.js +11 -11
- package/build/recorder/config.d.ts +6 -2
- package/build/recorder/hud/Hud.d.ts +3 -1
- package/build/recorder/hud/Hud.js +2 -2
- package/build/recorder/hud/Menu.d.ts +7 -1
- package/build/recorder/hud/Menu.js +2 -2
- package/build/recorder/hud/host.d.ts +13 -0
- package/build/recorder/hud/host.js +96 -1
- package/build/recorder/hud/icons.d.ts +2 -0
- package/build/recorder/hud/icons.js +4 -0
- package/build/recorder/hud/mount.d.ts +2 -0
- package/build/recorder/hud/mount.js +1 -0
- package/build/recorder/index.d.ts +6 -0
- package/build/recorder/index.js +3 -0
- package/build/recorder/link.js +1 -1
- package/build/recorder/version.d.ts +2 -2
- package/build/recorder/version.js +1 -1
- package/build/report/attachments.d.ts +56 -0
- package/build/report/attachments.js +91 -0
- package/build/report/drag.d.ts +18 -0
- package/build/report/drag.js +34 -0
- package/build/report/element.d.ts +11 -2
- package/build/report/element.js +106 -15
- package/build/report/engine.d.ts +5 -1
- package/build/report/engine.js +7 -1
- package/build/report/face.d.ts +23 -0
- package/build/report/face.js +92 -0
- package/build/report/i18n.d.ts +75 -3
- package/build/report/i18n.js +125 -6
- package/build/report/place.d.ts +26 -0
- package/build/report/place.js +33 -0
- package/build/report/reader.d.ts +42 -0
- package/build/report/reader.js +39 -0
- package/build/report/recorder-face.js +6 -2
- package/build/report/sent.d.ts +16 -0
- package/build/report/sent.js +39 -0
- package/build/report/settings.d.ts +32 -0
- package/build/report/settings.js +47 -0
- package/build/report/styles.d.ts +1 -1
- package/build/report/styles.js +216 -52
- package/build/report/widget.d.ts +109 -3
- package/build/report/widget.js +1063 -99
- package/build/report/wire.d.ts +20 -9
- package/build/report/wire.js +44 -9
- package/build/report-widget.mjs +223 -59
- package/package.json +1 -1
package/build/report/element.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { memberLinked, rememberFace, startFace, watchMemberLink } from './face';
|
|
1
2
|
import { parseLocale } from './i18n';
|
|
2
3
|
import { ReportWidget } from './widget';
|
|
3
4
|
export const REPORT_TAG = 'vitrinka-report';
|
|
@@ -14,36 +15,52 @@ export function defineReportElement(faces) {
|
|
|
14
15
|
return ATTRS;
|
|
15
16
|
}
|
|
16
17
|
options = {};
|
|
18
|
+
/** The mounted key and base; null until both are set. */
|
|
19
|
+
at = null;
|
|
20
|
+
/** The face on screen once mounted. */
|
|
21
|
+
shown = null;
|
|
17
22
|
widget = null;
|
|
23
|
+
/** Unmounts the recorder pill once its lazy face has loaded. */
|
|
24
|
+
pill = null;
|
|
25
|
+
/** Bumped whenever a face comes down: a pill that loads after its face was left never mounts. */
|
|
26
|
+
gen = 0;
|
|
27
|
+
/** The report widget currently offers Record. */
|
|
28
|
+
recordOffered = false;
|
|
29
|
+
offLink = null;
|
|
18
30
|
pendingIdentity = undefined;
|
|
31
|
+
get face() {
|
|
32
|
+
return this.shown ?? 'report';
|
|
33
|
+
}
|
|
19
34
|
connectedCallback() {
|
|
20
35
|
this.hidden = true;
|
|
21
|
-
this.
|
|
36
|
+
this.mount();
|
|
22
37
|
}
|
|
23
38
|
disconnectedCallback() {
|
|
24
|
-
this.
|
|
25
|
-
this.widget = null;
|
|
39
|
+
this.unmount();
|
|
26
40
|
}
|
|
27
41
|
attributeChangedCallback(name, old, value) {
|
|
28
42
|
if (old === value)
|
|
29
43
|
return;
|
|
30
|
-
if (!this.
|
|
44
|
+
if (!this.at) {
|
|
31
45
|
// Connected but waiting for its key or base (a host that configures later): mount now.
|
|
32
46
|
if (this.isConnected && (name === 'key' || name === 'base'))
|
|
33
|
-
this.
|
|
47
|
+
this.mount();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (name === 'key' || name === 'base') {
|
|
51
|
+
this.unmount();
|
|
52
|
+
this.mount();
|
|
34
53
|
return;
|
|
35
54
|
}
|
|
55
|
+
// The rest are the report face's: the pill reads none, and a switch back reads them afresh.
|
|
56
|
+
if (!this.widget)
|
|
57
|
+
return;
|
|
36
58
|
if (name === 'locale')
|
|
37
59
|
this.widget.setLocale(value);
|
|
38
60
|
else if (name === 'button')
|
|
39
61
|
this.widget.setButton(value !== 'false');
|
|
40
62
|
else if (name === 'open-selector')
|
|
41
63
|
this.widget.setOpenSelector(value);
|
|
42
|
-
else {
|
|
43
|
-
this.widget.unmount();
|
|
44
|
-
this.widget = null;
|
|
45
|
-
this.mountWidget();
|
|
46
|
-
}
|
|
47
64
|
}
|
|
48
65
|
open() {
|
|
49
66
|
this.widget?.open();
|
|
@@ -60,8 +77,8 @@ export function defineReportElement(faces) {
|
|
|
60
77
|
this.setAttribute('locale', String(locale));
|
|
61
78
|
}
|
|
62
79
|
/** Idempotent: an upgrade runs attributeChangedCallback before connectedCallback, and both land here. */
|
|
63
|
-
|
|
64
|
-
if (this.
|
|
80
|
+
mount() {
|
|
81
|
+
if (this.at)
|
|
65
82
|
return;
|
|
66
83
|
const key = (this.getAttribute('key') ?? '').trim();
|
|
67
84
|
const base = trimBase(this.getAttribute('base') ?? faces.defaultBase());
|
|
@@ -69,9 +86,60 @@ export function defineReportElement(faces) {
|
|
|
69
86
|
console.warn(`vitrinka: <${REPORT_TAG}> needs a key${base ? '' : ' and a base'} — nothing mounted`);
|
|
70
87
|
return;
|
|
71
88
|
}
|
|
89
|
+
this.at = { key, base };
|
|
90
|
+
// Only a build that carries the pill can switch to it (the single-file widget does not).
|
|
91
|
+
if (faces.recorderFace)
|
|
92
|
+
this.offLink = watchMemberLink(() => this.offerRecord());
|
|
93
|
+
this.show(faces.recorderFace ? startFace(base) : 'report');
|
|
94
|
+
}
|
|
95
|
+
unmount() {
|
|
96
|
+
this.offLink?.();
|
|
97
|
+
this.offLink = null;
|
|
98
|
+
this.takeDown();
|
|
99
|
+
this.at = null;
|
|
100
|
+
this.shown = null;
|
|
101
|
+
}
|
|
102
|
+
/** Take the face on screen down; the mount (and its link watch) stays. */
|
|
103
|
+
takeDown() {
|
|
104
|
+
this.gen++;
|
|
105
|
+
this.widget?.unmount();
|
|
106
|
+
this.widget = null;
|
|
107
|
+
this.recordOffered = false;
|
|
108
|
+
this.pill?.();
|
|
109
|
+
this.pill = null;
|
|
110
|
+
}
|
|
111
|
+
show(face) {
|
|
112
|
+
const at = this.at;
|
|
113
|
+
if (!at)
|
|
114
|
+
return;
|
|
115
|
+
this.takeDown();
|
|
116
|
+
const loadPill = faces.recorderFace;
|
|
117
|
+
if (face === 'recorder' && loadPill) {
|
|
118
|
+
this.shown = 'recorder';
|
|
119
|
+
const gen = this.gen;
|
|
120
|
+
loadPill()
|
|
121
|
+
.then((mountPill) => {
|
|
122
|
+
if (gen !== this.gen)
|
|
123
|
+
return;
|
|
124
|
+
// The member's own device link, never the host's key: a `vkb_` key cannot record.
|
|
125
|
+
this.pill = mountPill({
|
|
126
|
+
base: at.base,
|
|
127
|
+
appVersion: this.options.appVersion,
|
|
128
|
+
sanitizeUrl: this.options.sanitizeUrl,
|
|
129
|
+
onReportFace: () => this.switchTo('report'),
|
|
130
|
+
});
|
|
131
|
+
})
|
|
132
|
+
.catch((e) => {
|
|
133
|
+
console.warn('vitrinka: the recorder face did not load — showing Report a problem', e);
|
|
134
|
+
if (gen === this.gen)
|
|
135
|
+
this.show('report');
|
|
136
|
+
});
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
this.shown = 'report';
|
|
72
140
|
this.widget = new ReportWidget({
|
|
73
|
-
base,
|
|
74
|
-
key,
|
|
141
|
+
base: at.base,
|
|
142
|
+
key: at.key,
|
|
75
143
|
locale: parseLocale(this.getAttribute('locale')),
|
|
76
144
|
button: this.getAttribute('button') !== 'false',
|
|
77
145
|
openSelector: this.getAttribute('open-selector'),
|
|
@@ -81,6 +149,26 @@ export function defineReportElement(faces) {
|
|
|
81
149
|
sanitizeUrl: this.options.sanitizeUrl,
|
|
82
150
|
loadRecord: faces.loadRecord,
|
|
83
151
|
});
|
|
152
|
+
this.offerRecord();
|
|
153
|
+
}
|
|
154
|
+
/** Record is on the report face's menu exactly while this browser holds a member link for this base. */
|
|
155
|
+
offerRecord() {
|
|
156
|
+
if (!this.widget || !this.at)
|
|
157
|
+
return;
|
|
158
|
+
const offer = faces.recorderFace !== null && memberLinked(this.at.base);
|
|
159
|
+
if (offer === this.recordOffered)
|
|
160
|
+
return;
|
|
161
|
+
this.recordOffered = offer;
|
|
162
|
+
this.widget.setRecordSwitch(offer ? () => this.switchTo('recorder') : null);
|
|
163
|
+
}
|
|
164
|
+
/** The member's pick, remembered for this browser; applied once the menu that asked has let go of its click. */
|
|
165
|
+
switchTo(face) {
|
|
166
|
+
rememberFace(face);
|
|
167
|
+
const gen = this.gen;
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
if (gen === this.gen && this.shown !== face)
|
|
170
|
+
this.show(face);
|
|
171
|
+
}, 0);
|
|
84
172
|
}
|
|
85
173
|
}
|
|
86
174
|
customElements.define(REPORT_TAG, ReportElement);
|
|
@@ -106,7 +194,9 @@ export function mountReport(opts, faces) {
|
|
|
106
194
|
el.identify(opts.identity);
|
|
107
195
|
(opts.parent ?? document.body).append(el);
|
|
108
196
|
return {
|
|
109
|
-
face
|
|
197
|
+
get face() {
|
|
198
|
+
return el.face;
|
|
199
|
+
},
|
|
110
200
|
open: () => el.open(),
|
|
111
201
|
close: () => el.close(),
|
|
112
202
|
identify: (who) => el.identify(who),
|
|
@@ -125,6 +215,7 @@ function mountRecorder(opts, faces) {
|
|
|
125
215
|
faces
|
|
126
216
|
.recorderFace()
|
|
127
217
|
.then((mount) => {
|
|
218
|
+
// The host picked this face: no "Report a problem" row — there is no report key to swap back to.
|
|
128
219
|
if (!gone)
|
|
129
220
|
unmount = mount({ base, key: opts.key, appVersion: opts.appVersion, sanitizeUrl: opts.sanitizeUrl });
|
|
130
221
|
})
|
package/build/report/engine.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* driven by the project's capture profile instead of a recording:
|
|
4
4
|
*
|
|
5
5
|
* 1. `GET /api/v1/report-config` with the `vkb_` key → the capture profile
|
|
6
|
-
* (narrowed by the host's `capture` option)
|
|
6
|
+
* (narrowed by the host's `capture` option), the masking profile and the
|
|
7
|
+
* attachment caps (attachments.ts). An
|
|
7
8
|
* unreachable or older server means the safe fallback: memory, the last
|
|
8
9
|
* minute, strict masking.
|
|
9
10
|
* 2. The redaction rules first, then the lanes — so capture runs under the
|
|
@@ -25,6 +26,7 @@ import type { eventWithTime } from '@rrweb/types';
|
|
|
25
26
|
import { type RecordFn } from '../recorder/capture/rrweb-lane';
|
|
26
27
|
import { type FlightClip, type FlightLaneEvent } from '../recorder/flight';
|
|
27
28
|
import { EVENTS_PER_POST } from '../recorder/queue';
|
|
29
|
+
import { type AttachmentCaps } from './attachments';
|
|
28
30
|
import { type Marker } from './markers';
|
|
29
31
|
import { type CaptureLanes, type CaptureNarrowing, type CaptureProfile, type MaskingProfile } from './profile';
|
|
30
32
|
export { EVENTS_PER_POST };
|
|
@@ -50,6 +52,8 @@ export interface ReportConfig {
|
|
|
50
52
|
reachable: boolean;
|
|
51
53
|
/** This widget captures (false while the recorder face runs the page's capture). */
|
|
52
54
|
capturing: boolean;
|
|
55
|
+
/** What the reporter may attach (vt-8020 D9): the server's caps, else the defaults. */
|
|
56
|
+
attachments: AttachmentCaps;
|
|
53
57
|
}
|
|
54
58
|
export interface ConsoleEntry {
|
|
55
59
|
level: string;
|
package/build/report/engine.js
CHANGED
|
@@ -9,6 +9,7 @@ import { listen } from '../recorder/hud/listen';
|
|
|
9
9
|
import { EVENTS_PER_POST, splitRRWebEvents, utf8Bytes } from '../recorder/queue';
|
|
10
10
|
import { browserTabId, claimCapture, currentRoute, releaseCapture, setTabIdentity } from '../recorder/state';
|
|
11
11
|
import { deleteCaptureStore, openCaptureStore } from '../recorder/storage/capture';
|
|
12
|
+
import { DEFAULT_ATTACHMENT_CAPS, parseAttachmentCaps } from './attachments';
|
|
12
13
|
import { applyHides, hiddenNodeIds } from './markers';
|
|
13
14
|
import { lanesOf, legacyProfile, maskingOf, maskingPolicy, narrowProfile, parseProfile, UNMASK_SELECTOR, } from './profile';
|
|
14
15
|
export { EVENTS_PER_POST };
|
|
@@ -99,11 +100,15 @@ async function fetchConfig(target) {
|
|
|
99
100
|
profile: res.captureProfile == null ? legacyProfile(flight) : parseProfile(res.captureProfile, flight),
|
|
100
101
|
masking: maskingOf(res.profile),
|
|
101
102
|
reachable: true,
|
|
103
|
+
// vitrinka serves the caps inside the capture profile; a top-level `attachments` is read as a fallback.
|
|
104
|
+
attachments: parseAttachmentCaps(typeof res.captureProfile === 'object' && res.captureProfile !== null && 'attachments' in res.captureProfile
|
|
105
|
+
? res.captureProfile.attachments
|
|
106
|
+
: res.attachments),
|
|
102
107
|
};
|
|
103
108
|
}
|
|
104
109
|
catch (e) {
|
|
105
110
|
console.warn('vitrinka: report config unavailable — capturing the last minute, strictly masked', e);
|
|
106
|
-
return { project: '', profile: legacyProfile(), masking: 'strict', reachable: false };
|
|
111
|
+
return { project: '', profile: legacyProfile(), masking: 'strict', reachable: false, attachments: DEFAULT_ATTACHMENT_CAPS };
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
/** rrweb's mirror off the running recorder, when it carries one (the vendor build may not). */
|
|
@@ -149,6 +154,7 @@ export class CaptureEngine {
|
|
|
149
154
|
masking: fetched.masking,
|
|
150
155
|
reachable: fetched.reachable,
|
|
151
156
|
capturing: false,
|
|
157
|
+
attachments: fetched.attachments,
|
|
152
158
|
};
|
|
153
159
|
if (this.stopped)
|
|
154
160
|
return config;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReportFace } from './element';
|
|
2
|
+
/** localStorage key of the face this browser last picked on this origin. */
|
|
3
|
+
export declare const FACE_KEY = "vitrinka.report.face";
|
|
4
|
+
/**
|
|
5
|
+
* This browser holds a member link for `base`: one recorded as minted there,
|
|
6
|
+
* or — a link stored before links carried their base — one pinned to the
|
|
7
|
+
* workspace `base` addresses (any, for a bare origin).
|
|
8
|
+
*/
|
|
9
|
+
export declare function memberLinked(base: string): boolean;
|
|
10
|
+
/** The face this browser last picked here; null when it never picked (or storage is blocked). */
|
|
11
|
+
export declare function rememberedFace(): ReportFace | null;
|
|
12
|
+
export declare function rememberFace(face: ReportFace): void;
|
|
13
|
+
/** localStorage key of the linked member's display mode, as `/api/v1/recorder/me` last answered it. */
|
|
14
|
+
export declare const MODE_KEY = "vitrinka.report.mode";
|
|
15
|
+
export declare function rememberDisplayMode(mode: string | undefined): void;
|
|
16
|
+
/** The face a mount starts on: a member's last pick, else the pill for a dev-mode member; everyone else the report face. */
|
|
17
|
+
export declare function startFace(base: string): ReportFace;
|
|
18
|
+
/**
|
|
19
|
+
* Hear the stored link change: another tab's link or unlink (the storage
|
|
20
|
+
* event), or this document's (`storeLink` / `clearLink` notify). Returns the
|
|
21
|
+
* unsubscribe.
|
|
22
|
+
*/
|
|
23
|
+
export declare function watchMemberLink(onChange: () => void): () => void;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which face a `<vitrinka-report>` shows (vt-8020 D8): Report a problem, or —
|
|
3
|
+
* for a linked vitrinka member — the recorder pill, switched in place and
|
|
4
|
+
* remembered per browser and origin (`vitrinka.report.face` in localStorage).
|
|
5
|
+
*
|
|
6
|
+
* A member is a browser holding the device link the member link flow minted
|
|
7
|
+
* (`vitrinka.recorder.link`) on the widget's own `base`. A reporter holds
|
|
8
|
+
* none, and a `vkr_` key the host passes is a build's key, never a person:
|
|
9
|
+
* neither ever gets the switch. A member who never picked starts where their
|
|
10
|
+
* account's display mode says (D8: dev starts on the pill) — the mode
|
|
11
|
+
* `GET /api/v1/recorder/me` answers, remembered here once the widget read it.
|
|
12
|
+
*/
|
|
13
|
+
import { linkWorkspace } from '@vitrinka/link';
|
|
14
|
+
import { LINK_KEY, readLink } from '../recorder/config';
|
|
15
|
+
import { subscribe } from '../recorder/state';
|
|
16
|
+
import { getRecorderStorage } from '../recorder/storage';
|
|
17
|
+
/** localStorage key of the face this browser last picked on this origin. */
|
|
18
|
+
export const FACE_KEY = 'vitrinka.report.face';
|
|
19
|
+
const trimBase = (url) => url.trim().replace(/\/+$/, '');
|
|
20
|
+
function store() {
|
|
21
|
+
try {
|
|
22
|
+
return globalThis.localStorage ?? null;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null; // storage blocked (sandboxed frame, privacy mode): every mount starts on the report face
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This browser holds a member link for `base`: one recorded as minted there,
|
|
30
|
+
* or — a link stored before links carried their base — one pinned to the
|
|
31
|
+
* workspace `base` addresses (any, for a bare origin).
|
|
32
|
+
*/
|
|
33
|
+
export function memberLinked(base) {
|
|
34
|
+
const link = readLink();
|
|
35
|
+
if (!link)
|
|
36
|
+
return false;
|
|
37
|
+
if (link.base)
|
|
38
|
+
return trimBase(link.base) === trimBase(base);
|
|
39
|
+
try {
|
|
40
|
+
const ws = linkWorkspace(base);
|
|
41
|
+
return ws === undefined || ws === link.workspace;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false; // not a URL: no link can be for it
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** The face this browser last picked here; null when it never picked (or storage is blocked). */
|
|
48
|
+
export function rememberedFace() {
|
|
49
|
+
const v = store()?.getItem(FACE_KEY);
|
|
50
|
+
return v === 'recorder' || v === 'report' ? v : null;
|
|
51
|
+
}
|
|
52
|
+
export function rememberFace(face) {
|
|
53
|
+
try {
|
|
54
|
+
store()?.setItem(FACE_KEY, face);
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
console.warn('vitrinka: the picked face could not be remembered — the next load starts on Report a problem', e);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** localStorage key of the linked member's display mode, as `/api/v1/recorder/me` last answered it. */
|
|
61
|
+
export const MODE_KEY = 'vitrinka.report.mode';
|
|
62
|
+
export function rememberDisplayMode(mode) {
|
|
63
|
+
try {
|
|
64
|
+
if (mode === 'dev' || mode === 'regular')
|
|
65
|
+
store()?.setItem(MODE_KEY, mode);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
console.warn('vitrinka: the display mode could not be remembered — the next load starts on Report a problem', e);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** The face a mount starts on: a member's last pick, else the pill for a dev-mode member; everyone else the report face. */
|
|
72
|
+
export function startFace(base) {
|
|
73
|
+
if (!memberLinked(base))
|
|
74
|
+
return 'report';
|
|
75
|
+
const picked = rememberedFace();
|
|
76
|
+
if (picked)
|
|
77
|
+
return picked;
|
|
78
|
+
return store()?.getItem(MODE_KEY) === 'dev' ? 'recorder' : 'report';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Hear the stored link change: another tab's link or unlink (the storage
|
|
82
|
+
* event), or this document's (`storeLink` / `clearLink` notify). Returns the
|
|
83
|
+
* unsubscribe.
|
|
84
|
+
*/
|
|
85
|
+
export function watchMemberLink(onChange) {
|
|
86
|
+
const offOther = getRecorderStorage().watch?.(LINK_KEY, () => onChange());
|
|
87
|
+
const offHere = subscribe(onChange);
|
|
88
|
+
return () => {
|
|
89
|
+
offOther?.();
|
|
90
|
+
offHere();
|
|
91
|
+
};
|
|
92
|
+
}
|
package/build/report/i18n.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* first-time reporter does not know the word.
|
|
9
9
|
*/
|
|
10
10
|
export type Locale = 'cs' | 'en';
|
|
11
|
+
export type ReportKind = 'bug' | 'suggestion' | 'question' | 'other';
|
|
12
|
+
export declare const REPORT_KINDS: readonly ReportKind[];
|
|
11
13
|
export interface Strings {
|
|
12
14
|
button: string;
|
|
13
15
|
title: string;
|
|
@@ -32,7 +34,11 @@ export interface Strings {
|
|
|
32
34
|
incIdentity: string;
|
|
33
35
|
incMarks: string;
|
|
34
36
|
showWhere: string;
|
|
35
|
-
|
|
37
|
+
/** The reporter's own word for what this is (vt-8020 D11) — a hint Eve reads, never the category. */
|
|
38
|
+
kinds: Record<ReportKind, string>;
|
|
39
|
+
kindsLabel: string;
|
|
40
|
+
/** The marks' list in the card while there are none yet. */
|
|
41
|
+
linesEmpty: string;
|
|
36
42
|
notify: string;
|
|
37
43
|
send: string;
|
|
38
44
|
sending: string;
|
|
@@ -50,8 +56,13 @@ export interface Strings {
|
|
|
50
56
|
hide: string;
|
|
51
57
|
};
|
|
52
58
|
toolbar: string;
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
/** The marking bar's one plain line. */
|
|
60
|
+
barLead: string;
|
|
61
|
+
/** Leaves marking and drops the marks of this pass (vt-8020 D12). */
|
|
62
|
+
cancelMarking: string;
|
|
63
|
+
discardMarks: (n: number) => string;
|
|
64
|
+
discard: string;
|
|
65
|
+
keep: string;
|
|
55
66
|
coach: string;
|
|
56
67
|
coachMore: string;
|
|
57
68
|
/** The marking layer's name, for assistive technology. */
|
|
@@ -70,6 +81,67 @@ export interface Strings {
|
|
|
70
81
|
needModifier: string;
|
|
71
82
|
removeShortcut: string;
|
|
72
83
|
back: string;
|
|
84
|
+
account: string;
|
|
85
|
+
menu: string;
|
|
86
|
+
anonymous: string;
|
|
87
|
+
anonymousHint: string;
|
|
88
|
+
signedInByApp: string;
|
|
89
|
+
linkVitrinka: string;
|
|
90
|
+
linkedAs: (who: string) => string;
|
|
91
|
+
unlink: string;
|
|
92
|
+
myReports: string;
|
|
93
|
+
recentRecordings: string;
|
|
94
|
+
record: string;
|
|
95
|
+
openVitrinka: string;
|
|
96
|
+
openPortal: string;
|
|
97
|
+
loading: string;
|
|
98
|
+
listFailed: string;
|
|
99
|
+
noReports: string;
|
|
100
|
+
noRecordings: string;
|
|
101
|
+
fromThisBrowser: string;
|
|
102
|
+
/** A report's step as the portal names it; an unknown key shows as is. */
|
|
103
|
+
steps: Record<string, string>;
|
|
104
|
+
waiting: string;
|
|
105
|
+
sentQueued: string;
|
|
106
|
+
linkCode: string;
|
|
107
|
+
linkHint: string;
|
|
108
|
+
linkWaiting: string;
|
|
109
|
+
linkExpired: string;
|
|
110
|
+
linkFailed: string;
|
|
111
|
+
attach: string;
|
|
112
|
+
removeFile: (name: string) => string;
|
|
113
|
+
fileTooBig: (name: string, cap: string) => string;
|
|
114
|
+
tooManyFiles: (n: number) => string;
|
|
115
|
+
fileType: (name: string, types: string) => string;
|
|
116
|
+
/** The default caps' types as a person reads them (the rest show as configured). */
|
|
117
|
+
typeNames: {
|
|
118
|
+
image: string;
|
|
119
|
+
pdf: string;
|
|
120
|
+
text: string;
|
|
121
|
+
office: string;
|
|
122
|
+
};
|
|
123
|
+
incFiles: string;
|
|
124
|
+
errorFiles: string;
|
|
125
|
+
moveHint: string;
|
|
126
|
+
size: string;
|
|
127
|
+
sizes: {
|
|
128
|
+
sm: string;
|
|
129
|
+
md: string;
|
|
130
|
+
lg: string;
|
|
131
|
+
};
|
|
132
|
+
techDetails: string;
|
|
133
|
+
techVersion: string;
|
|
134
|
+
techWindow: string;
|
|
135
|
+
techCapture: string;
|
|
136
|
+
techBuffer: string;
|
|
137
|
+
techServer: string;
|
|
138
|
+
captureOn: string;
|
|
139
|
+
captureOff: string;
|
|
140
|
+
captureStarting: string;
|
|
141
|
+
bufferMemory: string;
|
|
142
|
+
bufferBrowser: string;
|
|
143
|
+
/** "5 minutes" for a capture window of `sec` seconds. */
|
|
144
|
+
windowLength: (sec: number) => string;
|
|
73
145
|
}
|
|
74
146
|
export declare function strings(locale: Locale): Strings;
|
|
75
147
|
/** `cs`, `cs-CZ`, `CS` → cs; `en-GB` → en; anything else → null. */
|
package/build/report/i18n.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export const REPORT_KINDS = ['bug', 'suggestion', 'question', 'other'];
|
|
1
2
|
/** Czech plural: 1 · 2–4 · 5+ (and 0). */
|
|
2
3
|
function csPlural(n, one, few, many) {
|
|
3
4
|
if (n === 1)
|
|
@@ -34,7 +35,9 @@ const en = {
|
|
|
34
35
|
incIdentity: 'Your name and email from this app',
|
|
35
36
|
incMarks: 'The places you marked, with your notes',
|
|
36
37
|
showWhere: 'Show us where',
|
|
37
|
-
|
|
38
|
+
kinds: { bug: 'Bug', suggestion: 'Suggestion', question: 'Question', other: 'Other' },
|
|
39
|
+
kindsLabel: 'What is it?',
|
|
40
|
+
linesEmpty: 'Each place you mark gets a line here for its note.',
|
|
38
41
|
notify: 'Email me when it’s fixed',
|
|
39
42
|
send: 'Send',
|
|
40
43
|
sending: 'Sending…',
|
|
@@ -47,8 +50,11 @@ const en = {
|
|
|
47
50
|
seeReport: 'See your report',
|
|
48
51
|
tools: { circle: 'Circle', box: 'Box', arrow: 'Arrow', hide: 'Hide' },
|
|
49
52
|
toolbar: 'Marking tools',
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
barLead: 'Mark where the problem is',
|
|
54
|
+
cancelMarking: 'Cancel',
|
|
55
|
+
discardMarks: (n) => (n === 1 ? 'Discard 1 mark?' : `Discard ${n} marks?`),
|
|
56
|
+
discard: 'Discard',
|
|
57
|
+
keep: 'Keep',
|
|
52
58
|
coach: 'Click, hold and move around the problem.',
|
|
53
59
|
coachMore: 'You can mark more than one place.',
|
|
54
60
|
marking: 'Marking',
|
|
@@ -65,6 +71,60 @@ const en = {
|
|
|
65
71
|
needModifier: 'Add Ctrl, Alt or ⌘ — a key on its own would get in the way of typing',
|
|
66
72
|
removeShortcut: 'Remove',
|
|
67
73
|
back: 'Back',
|
|
74
|
+
account: 'Your account',
|
|
75
|
+
menu: 'Menu',
|
|
76
|
+
anonymous: 'Not signed in',
|
|
77
|
+
anonymousHint: 'The team checks your report before it’s filed.',
|
|
78
|
+
signedInByApp: 'Signed in by this app',
|
|
79
|
+
linkVitrinka: 'Link your vitrinka account',
|
|
80
|
+
linkedAs: (who) => `Linked to vitrinka as ${who}`,
|
|
81
|
+
unlink: 'Unlink',
|
|
82
|
+
myReports: 'My reports',
|
|
83
|
+
recentRecordings: 'Recent recordings',
|
|
84
|
+
record: 'Record',
|
|
85
|
+
openVitrinka: 'Open vitrinka',
|
|
86
|
+
openPortal: 'Open the report portal',
|
|
87
|
+
loading: 'Loading…',
|
|
88
|
+
listFailed: 'Couldn’t load — try again',
|
|
89
|
+
noReports: 'No reports yet.',
|
|
90
|
+
noRecordings: 'No recordings yet.',
|
|
91
|
+
fromThisBrowser: 'Sent from this browser',
|
|
92
|
+
steps: { received: 'Received', planned: 'Planned', in_progress: 'In progress', fixed: 'Fixed', done: 'Done' },
|
|
93
|
+
waiting: 'Waiting for approval',
|
|
94
|
+
sentQueued: 'The team checks it before it’s filed.',
|
|
95
|
+
linkCode: 'Your code',
|
|
96
|
+
linkHint: 'Approve this code in vitrinka — on this device or another one where you’re signed in.',
|
|
97
|
+
linkWaiting: 'Waiting for approval…',
|
|
98
|
+
linkExpired: 'The code expired.',
|
|
99
|
+
linkFailed: 'Linking didn’t work.',
|
|
100
|
+
attach: 'Attach a file',
|
|
101
|
+
removeFile: (name) => `Remove ${name}`,
|
|
102
|
+
fileTooBig: (name, cap) => `${name} is over the ${cap} limit`,
|
|
103
|
+
tooManyFiles: (n) => (n === 1 ? 'Up to 1 file per report' : `Up to ${n} files per report`),
|
|
104
|
+
fileType: (name, types) => `${name} can’t be attached — ${types} only`,
|
|
105
|
+
typeNames: { image: 'images', pdf: 'PDF', text: 'text files', office: 'office documents' },
|
|
106
|
+
incFiles: 'The files you attached',
|
|
107
|
+
errorFiles: 'Your report arrived, a file not yet — try again to attach it',
|
|
108
|
+
moveHint: 'Click, hold and move it to another corner, or press Alt and an arrow key.',
|
|
109
|
+
size: 'Size',
|
|
110
|
+
sizes: { sm: 'Small', md: 'Medium', lg: 'Large' },
|
|
111
|
+
techDetails: 'Technical details',
|
|
112
|
+
techVersion: 'Version',
|
|
113
|
+
techWindow: 'Capture window',
|
|
114
|
+
techCapture: 'Capture',
|
|
115
|
+
techBuffer: 'Buffer',
|
|
116
|
+
techServer: 'Server',
|
|
117
|
+
captureOn: 'Running',
|
|
118
|
+
captureOff: 'Off',
|
|
119
|
+
captureStarting: 'Starting…',
|
|
120
|
+
bufferMemory: 'In memory',
|
|
121
|
+
bufferBrowser: 'In this browser',
|
|
122
|
+
windowLength: (sec) => {
|
|
123
|
+
if (sec < 60)
|
|
124
|
+
return sec === 1 ? '1 second' : `${sec} seconds`;
|
|
125
|
+
const min = Math.round(sec / 60);
|
|
126
|
+
return min === 1 ? '1 minute' : `${min} minutes`;
|
|
127
|
+
},
|
|
68
128
|
};
|
|
69
129
|
const cs = {
|
|
70
130
|
button: 'Nahlásit problém',
|
|
@@ -95,7 +155,9 @@ const cs = {
|
|
|
95
155
|
incIdentity: 'Vaše jméno a e-mail z této aplikace',
|
|
96
156
|
incMarks: 'Místa, která jste označili, i s poznámkami',
|
|
97
157
|
showWhere: 'Ukažte nám kde',
|
|
98
|
-
|
|
158
|
+
kinds: { bug: 'Chyba', suggestion: 'Návrh', question: 'Dotaz', other: 'Jiné' },
|
|
159
|
+
kindsLabel: 'Co to je?',
|
|
160
|
+
linesEmpty: 'Každé označené místo tu dostane řádek pro poznámku.',
|
|
99
161
|
notify: 'Pošlete mi e-mail, až to bude opravené',
|
|
100
162
|
send: 'Odeslat',
|
|
101
163
|
sending: 'Odesílám…',
|
|
@@ -108,8 +170,11 @@ const cs = {
|
|
|
108
170
|
seeReport: 'Zobrazit hlášení',
|
|
109
171
|
tools: { circle: 'Kruh', box: 'Obdélník', arrow: 'Šipka', hide: 'Skrýt' },
|
|
110
172
|
toolbar: 'Nástroje pro označení',
|
|
111
|
-
|
|
112
|
-
|
|
173
|
+
barLead: 'Označte, kde je problém',
|
|
174
|
+
cancelMarking: 'Zrušit',
|
|
175
|
+
discardMarks: (n) => csPlural(n, 'Zahodit 1 značku?', `Zahodit ${n} značky?`, `Zahodit ${n} značek?`),
|
|
176
|
+
discard: 'Zahodit',
|
|
177
|
+
keep: 'Ponechat',
|
|
113
178
|
coach: 'Klikněte, podržte a veďte kolem problému.',
|
|
114
179
|
coachMore: 'Označit můžete i více míst.',
|
|
115
180
|
marking: 'Označování',
|
|
@@ -126,6 +191,60 @@ const cs = {
|
|
|
126
191
|
needModifier: 'Přidejte Ctrl, Alt nebo ⌘ — samotná klávesa by překážela při psaní',
|
|
127
192
|
removeShortcut: 'Odebrat',
|
|
128
193
|
back: 'Zpět',
|
|
194
|
+
account: 'Váš účet',
|
|
195
|
+
menu: 'Nabídka',
|
|
196
|
+
anonymous: 'Nepřihlášeno',
|
|
197
|
+
anonymousHint: 'Hlášení nejdřív zkontroluje tým.',
|
|
198
|
+
signedInByApp: 'Přihlášen touto aplikací',
|
|
199
|
+
linkVitrinka: 'Propojit s vitrinkou',
|
|
200
|
+
linkedAs: (who) => `Propojeno s vitrinkou jako ${who}`,
|
|
201
|
+
unlink: 'Odpojit',
|
|
202
|
+
myReports: 'Moje hlášení',
|
|
203
|
+
recentRecordings: 'Nedávné nahrávky',
|
|
204
|
+
record: 'Nahrávat',
|
|
205
|
+
openVitrinka: 'Otevřít vitrinku',
|
|
206
|
+
openPortal: 'Otevřít portál hlášení',
|
|
207
|
+
loading: 'Načítám…',
|
|
208
|
+
listFailed: 'Nepodařilo se načíst — zkuste to znovu',
|
|
209
|
+
noReports: 'Zatím žádná hlášení.',
|
|
210
|
+
noRecordings: 'Zatím žádné nahrávky.',
|
|
211
|
+
fromThisBrowser: 'Odesláno z tohoto prohlížeče',
|
|
212
|
+
steps: { received: 'Přijato', planned: 'Naplánováno', in_progress: 'Řešíme', fixed: 'Opraveno', done: 'Hotovo' },
|
|
213
|
+
waiting: 'Čeká na schválení',
|
|
214
|
+
sentQueued: 'Než ho zařadíme, tým ho zkontroluje.',
|
|
215
|
+
linkCode: 'Váš kód',
|
|
216
|
+
linkHint: 'Schvalte kód ve vitrince — na tomto nebo jiném zařízení, kde jste přihlášeni.',
|
|
217
|
+
linkWaiting: 'Čekám na schválení…',
|
|
218
|
+
linkExpired: 'Kód vypršel.',
|
|
219
|
+
linkFailed: 'Propojení se nepodařilo.',
|
|
220
|
+
attach: 'Přiložit soubor',
|
|
221
|
+
removeFile: (name) => `Odebrat ${name}`,
|
|
222
|
+
fileTooBig: (name, cap) => `${name} přesahuje limit ${cap}`,
|
|
223
|
+
tooManyFiles: (n) => csPlural(n, 'Nejvýš 1 soubor na hlášení', `Nejvýš ${n} soubory na hlášení`, `Nejvýš ${n} souborů na hlášení`),
|
|
224
|
+
fileType: (name, types) => `${name} nelze přiložit — jen ${types}`,
|
|
225
|
+
typeNames: { image: 'obrázky', pdf: 'PDF', text: 'textové soubory', office: 'kancelářské dokumenty' },
|
|
226
|
+
incFiles: 'Soubory, které jste přiložili',
|
|
227
|
+
errorFiles: 'Hlášení dorazilo, soubor zatím ne — zkuste to znovu a přiložíme ho',
|
|
228
|
+
moveHint: 'Klikněte, podržte a veďte ho do jiného rohu, nebo stiskněte Alt a šipku.',
|
|
229
|
+
size: 'Velikost',
|
|
230
|
+
sizes: { sm: 'Malá', md: 'Střední', lg: 'Velká' },
|
|
231
|
+
techDetails: 'Technické údaje',
|
|
232
|
+
techVersion: 'Verze',
|
|
233
|
+
techWindow: 'Okno záznamu',
|
|
234
|
+
techCapture: 'Záznam',
|
|
235
|
+
techBuffer: 'Vyrovnávací paměť',
|
|
236
|
+
techServer: 'Server',
|
|
237
|
+
captureOn: 'Běží',
|
|
238
|
+
captureOff: 'Vypnutý',
|
|
239
|
+
captureStarting: 'Spouští se…',
|
|
240
|
+
bufferMemory: 'V paměti',
|
|
241
|
+
bufferBrowser: 'V tomto prohlížeči',
|
|
242
|
+
windowLength: (sec) => {
|
|
243
|
+
if (sec < 60)
|
|
244
|
+
return csPlural(sec, '1 sekunda', `${sec} sekundy`, `${sec} sekund`);
|
|
245
|
+
const min = Math.round(sec / 60);
|
|
246
|
+
return csPlural(min, '1 minuta', `${min} minuty`, `${min} minut`);
|
|
247
|
+
},
|
|
129
248
|
};
|
|
130
249
|
const CATALOGS = { cs, en };
|
|
131
250
|
export function strings(locale) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the one card sits while the reporter marks (vt-8020 D10 A): parked in
|
|
3
|
+
* a corner of the viewport, clear of the top bar, and moved only when a mark
|
|
4
|
+
* lands under it — then to the corner that covers the least of the marks. The
|
|
5
|
+
* card never jumps between equally good corners: the current one wins a tie.
|
|
6
|
+
*/
|
|
7
|
+
import type { Rect } from './markers';
|
|
8
|
+
export type Corner = 'br' | 'bl' | 'tr' | 'tl';
|
|
9
|
+
export interface Frame {
|
|
10
|
+
vw: number;
|
|
11
|
+
vh: number;
|
|
12
|
+
/** The card's fixed size. */
|
|
13
|
+
w: number;
|
|
14
|
+
h: number;
|
|
15
|
+
/**
|
|
16
|
+
* Clear space kept at the top (the marking bar), at the bottom and at the
|
|
17
|
+
* sides — the widget takes them from where the card rests when marking
|
|
18
|
+
* starts, so starting never moves it.
|
|
19
|
+
*/
|
|
20
|
+
top: number;
|
|
21
|
+
bottom: number;
|
|
22
|
+
edge: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function cornerRect(c: Corner, f: Frame): Rect;
|
|
25
|
+
/** The corner the card should be in: `current` while it covers no mark, else the least-covering one. */
|
|
26
|
+
export declare function pickCorner(current: Corner, marks: readonly Rect[], f: Frame): Corner;
|