@getpinax/widget 1.0.0-beta.1 → 1.0.0-beta.2
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/README.md +270 -24
- package/dist/a11y/scan.d.ts +25 -0
- package/dist/api.d.ts +25 -4
- package/dist/capture/breadcrumbs.d.ts +1 -1
- package/dist/capture/network.d.ts +1 -1
- package/dist/capture/signature.d.ts +5 -0
- package/dist/capture/text.d.ts +17 -1
- package/dist/chunks/{editor-DbHLGwOA.mjs → editor-0Kr31Uly.mjs} +35 -35
- package/dist/chunks/{privacy-DmU6v5Fr.mjs → privacy-B_b1_Y1n.mjs} +2 -2
- package/dist/chunks/{recorder-BUtEB_em.mjs → recorder-tu4yugLw.mjs} +52 -37
- package/dist/chunks/scan-CFQwrtAQ.mjs +46137 -0
- package/dist/chunks/text-D9SaDBT0.mjs +36 -0
- package/dist/chunks/{widget-CkR1Ptzb.mjs → widget-BpTBdX2R.mjs} +530 -219
- package/dist/editor-loader.d.ts +3 -0
- package/dist/editor-loader.embed.d.ts +2 -1
- package/dist/fixcheck.d.ts +11 -0
- package/dist/index.d.ts +41 -2
- package/dist/known.d.ts +27 -0
- package/dist/pinax-axe.js +46167 -0
- package/dist/pinax-editor.js +252 -252
- package/dist/pinax-recorder.js +52 -39
- package/dist/pinax.js +28 -6
- package/dist/pinax.mjs +598 -369
- package/dist/preview.d.ts +14 -1
- package/dist/preview.mjs +36 -23
- package/dist/privacy.d.ts +4 -2
- package/dist/queue.d.ts +2 -1
- package/dist/replay/recorder.d.ts +10 -0
- package/dist/replay/sanitize.d.ts +9 -3
- package/dist/report.d.ts +21 -2
- package/dist/settings.d.ts +11 -2
- package/dist/types.d.ts +113 -3
- package/dist/ui/widget.d.ts +82 -2
- package/package.json +5 -4
- package/dist/chunks/text-8QYEyRYs.mjs +0 -18
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as e, i as t, n, t as r } from "./text-D9SaDBT0.mjs";
|
|
2
|
+
import { o as i } from "./privacy-B_b1_Y1n.mjs";
|
|
2
3
|
// src/report.ts
|
|
3
|
-
var
|
|
4
|
+
var a = [
|
|
5
|
+
"see",
|
|
6
|
+
"keyboard",
|
|
7
|
+
"screen-reader",
|
|
8
|
+
"media",
|
|
9
|
+
"other"
|
|
10
|
+
], o = {
|
|
4
11
|
message: 5e3,
|
|
5
12
|
email: 320,
|
|
6
13
|
entries: 50,
|
|
@@ -15,95 +22,97 @@ var n = {
|
|
|
15
22
|
fieldId: 40,
|
|
16
23
|
fieldText: 200,
|
|
17
24
|
bodyBytes: 11534336
|
|
18
|
-
},
|
|
19
|
-
function
|
|
20
|
-
return e.length <=
|
|
25
|
+
}, s = 65536, c = /^[A-Za-z0-9+/=]+$/, l = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9-]*\.)+[A-Za-z]{2,}$/, u = /^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/=]+$/;
|
|
26
|
+
function d(e) {
|
|
27
|
+
return e.length <= o.email && l.test(e);
|
|
21
28
|
}
|
|
22
|
-
function
|
|
29
|
+
function f(e) {
|
|
23
30
|
let t = e.slice(e.indexOf(",") + 1), n = t.endsWith("==") ? 2 : +!!t.endsWith("=");
|
|
24
31
|
return Math.floor(t.length * 3 / 4) - n;
|
|
25
32
|
}
|
|
26
|
-
function
|
|
27
|
-
return e.length <=
|
|
33
|
+
function p(e) {
|
|
34
|
+
return e.length <= o.screenshotChars && u.test(e) && f(e) <= o.screenshotBytes;
|
|
28
35
|
}
|
|
29
|
-
function
|
|
30
|
-
return e.message.trim().length > 0 || e.type === "GENERAL" && e.rating !== void 0 || e.screenshot !== void 0;
|
|
36
|
+
function m(e) {
|
|
37
|
+
return e.message.trim().length > 0 || e.type === "GENERAL" && e.rating !== void 0 || e.type === "ACCESSIBILITY" && e.barrier !== void 0 || e.screenshot !== void 0;
|
|
31
38
|
}
|
|
32
|
-
var
|
|
33
|
-
function
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
let e = new URL(r);
|
|
38
|
-
return e.toString().length > 2e3 && (e.search = ""), t(e.toString(), 2e3);
|
|
39
|
-
} catch {
|
|
40
|
-
return r.slice(0, 2e3);
|
|
41
|
-
}
|
|
39
|
+
var h = (e, t) => Number.isFinite(e) ? Math.round(Math.min(1, Math.max(t, e)) * 1e4) / 1e4 : 0;
|
|
40
|
+
function g(i) {
|
|
41
|
+
let a = t(e(i), r);
|
|
42
|
+
return a.length <= 2e3 ? a : n(a.split("?")[0], 2e3);
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function _(e) {
|
|
44
45
|
if (!e) return;
|
|
45
|
-
let
|
|
46
|
-
e.id != null && String(e.id) && (
|
|
47
|
-
let r = e.email?.trim();
|
|
48
|
-
return r && s(r) && (n.email = r), Object.keys(n).length ? n : void 0;
|
|
46
|
+
let t = {};
|
|
47
|
+
return e.id != null && String(e.id) && (t.id = n(String(e.id), 200)), e.name && (t.name = n(String(e.name), 200)), Object.keys(t).length ? t : void 0;
|
|
49
48
|
}
|
|
50
|
-
function
|
|
51
|
-
let
|
|
49
|
+
function v(e, t) {
|
|
50
|
+
let r = {
|
|
52
51
|
type: e.type,
|
|
53
|
-
message:
|
|
52
|
+
message: n(e.message.trim(), o.message),
|
|
54
53
|
page: {
|
|
55
|
-
url:
|
|
56
|
-
title:
|
|
54
|
+
url: g(t.page.url),
|
|
55
|
+
title: t.page.title ? n(t.page.title, 500) : void 0
|
|
57
56
|
},
|
|
58
|
-
environment:
|
|
57
|
+
environment: t.environment
|
|
59
58
|
};
|
|
60
|
-
e.type === "GENERAL" && e.rating !== void 0 && Number.isInteger(e.rating) && e.rating >= 1 && e.rating <= 5 && (
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
let
|
|
59
|
+
e.type === "GENERAL" && e.rating !== void 0 && Number.isInteger(e.rating) && e.rating >= 1 && e.rating <= 5 && (r.rating = e.rating);
|
|
60
|
+
let s = e.email?.trim().toLowerCase();
|
|
61
|
+
s && d(s) && (r.email = s);
|
|
62
|
+
let c = _(e.user);
|
|
63
|
+
c && (r.user = c), t.console.length && (r.console = t.console.slice(-o.entries).map((e) => {
|
|
64
|
+
let t = {
|
|
65
|
+
...e,
|
|
66
|
+
message: i(e.message)
|
|
67
|
+
};
|
|
68
|
+
return e.stack && (t.stack = i(e.stack)), t;
|
|
69
|
+
})), t.network.length && (r.network = t.network.slice(-o.entries)), t.breadcrumbs?.length && (r.breadcrumbs = t.breadcrumbs.slice(-o.breadcrumbs).map((e) => {
|
|
70
|
+
let t = {
|
|
66
71
|
kind: e.kind,
|
|
67
|
-
at:
|
|
68
|
-
path:
|
|
72
|
+
at: n(e.at, 40),
|
|
73
|
+
path: n(e.path, 500)
|
|
69
74
|
};
|
|
70
|
-
return e.target && (
|
|
75
|
+
return e.target && (t.target = n(i(e.target), 200)), t;
|
|
71
76
|
}));
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
question:
|
|
75
|
-
answer:
|
|
77
|
+
let l = e.followUp?.question.trim(), u = e.followUp?.answer.trim();
|
|
78
|
+
l && u && (r.followUp = {
|
|
79
|
+
question: n(l, o.followUpQuestion),
|
|
80
|
+
answer: n(u, o.followUpAnswer)
|
|
76
81
|
});
|
|
77
|
-
let
|
|
82
|
+
let f = (e.fields ?? []).filter((e) => typeof e.id == "string" && e.id.length <= o.fieldId && (typeof e.value == "boolean" || typeof e.value == "string" && e.value.trim())).slice(0, o.fields).map((e) => ({
|
|
78
83
|
id: e.id,
|
|
79
|
-
value: typeof e.value == "boolean" ? e.value :
|
|
84
|
+
value: typeof e.value == "boolean" ? e.value : n(e.value.trim(), o.fieldText)
|
|
80
85
|
}));
|
|
81
|
-
return
|
|
82
|
-
|
|
86
|
+
return f.length && (r.fields = f), e.type === "ACCESSIBILITY" && (e.barrier && a.includes(e.barrier) && (r.barrier = e.barrier), e.a11yScan && (r.a11yScan = e.a11yScan)), e.consent && (r.consent = {
|
|
87
|
+
diagnostics: e.consent.diagnostics === !0,
|
|
88
|
+
replay: e.consent.replay === !0
|
|
89
|
+
}), e.includeLogs === !0 && (r.includeLogs = !0), e.hp && (r.hp = n(e.hp, 500)), e.elapsedMs !== void 0 && Number.isFinite(e.elapsedMs) && e.elapsedMs >= 0 && (r.elapsedMs = Math.min(Math.round(e.elapsedMs), 864e5)), e.screenshot && p(e.screenshot) && (r.screenshot = e.screenshot, e.annotations?.length && (r.annotations = e.annotations.slice(0, o.annotations).map((e) => {
|
|
90
|
+
let t = e.type === "arrow" ? -1 : 0, r = {
|
|
83
91
|
type: e.type,
|
|
84
|
-
x:
|
|
85
|
-
y:
|
|
86
|
-
w:
|
|
87
|
-
h:
|
|
92
|
+
x: h(e.x, 0),
|
|
93
|
+
y: h(e.y, 0),
|
|
94
|
+
w: h(e.w, t),
|
|
95
|
+
h: h(e.h, t)
|
|
88
96
|
};
|
|
89
|
-
return e.type === "text" && e.text && (r.text =
|
|
90
|
-
}))),
|
|
97
|
+
return e.type === "text" && e.text && (r.text = n(e.text, 500)), r;
|
|
98
|
+
}))), r;
|
|
91
99
|
}
|
|
92
|
-
function
|
|
100
|
+
function y(e) {
|
|
93
101
|
return new TextEncoder().encode(JSON.stringify(e)).length;
|
|
94
102
|
}
|
|
95
|
-
function
|
|
96
|
-
return !t || t.length >
|
|
103
|
+
function b(e, t) {
|
|
104
|
+
return !t || t.length > o.replayChars || !c.test(t) || y(e) + t.length + 12 > o.bodyBytes - s ? !1 : (e.replay = t, !0);
|
|
97
105
|
}
|
|
98
106
|
// src/settings.ts
|
|
99
|
-
var
|
|
107
|
+
var x = {
|
|
100
108
|
color: "#B8F35C",
|
|
101
109
|
text: "Feedback",
|
|
102
110
|
position: "bottom-right",
|
|
103
111
|
types: {
|
|
104
112
|
problem: !0,
|
|
105
113
|
idea: !0,
|
|
106
|
-
general: !0
|
|
114
|
+
general: !0,
|
|
115
|
+
accessibility: !1
|
|
107
116
|
},
|
|
108
117
|
rating: !0,
|
|
109
118
|
hidePaths: [],
|
|
@@ -115,6 +124,7 @@ var _ = {
|
|
|
115
124
|
problemTitle: "",
|
|
116
125
|
ideaTitle: "",
|
|
117
126
|
generalTitle: "",
|
|
127
|
+
accessibilityTitle: "",
|
|
118
128
|
messagePlaceholder: "",
|
|
119
129
|
confirmation: ""
|
|
120
130
|
},
|
|
@@ -122,30 +132,37 @@ var _ = {
|
|
|
122
132
|
capture: {
|
|
123
133
|
console: !0,
|
|
124
134
|
network: !0
|
|
125
|
-
}
|
|
126
|
-
|
|
135
|
+
},
|
|
136
|
+
knownIssues: {
|
|
137
|
+
enabled: !0,
|
|
138
|
+
notify: !0
|
|
139
|
+
},
|
|
140
|
+
consent: { required: !1 },
|
|
141
|
+
privacyUrl: "",
|
|
142
|
+
identifyPrefill: !0
|
|
143
|
+
}, S = {
|
|
127
144
|
fields: 10,
|
|
128
145
|
label: 80,
|
|
129
146
|
options: 20,
|
|
130
147
|
option: 80,
|
|
131
148
|
text: 200
|
|
132
|
-
},
|
|
149
|
+
}, C = [
|
|
133
150
|
"bottom-right",
|
|
134
151
|
"bottom-left",
|
|
135
152
|
"right-edge"
|
|
136
|
-
],
|
|
153
|
+
], w = Object.keys(x.wording), T = (e, t) => typeof e == "string" ? e.trim().slice(0, t) : "", E = (e, t) => typeof e == "boolean" ? e : t, D = [
|
|
137
154
|
"select",
|
|
138
155
|
"text",
|
|
139
156
|
"checkbox"
|
|
140
157
|
];
|
|
141
|
-
function
|
|
158
|
+
function O(e) {
|
|
142
159
|
if (!Array.isArray(e)) return [];
|
|
143
160
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
144
161
|
for (let r of e) {
|
|
145
162
|
if (!r || typeof r != "object") continue;
|
|
146
|
-
let e = r, i = typeof e.id == "string" ? e.id.slice(0, 40) : "", a = e.type, o =
|
|
147
|
-
if (!i || n.has(i) || !
|
|
148
|
-
let s = a === "select" && Array.isArray(e.options) ? [...new Set(e.options.map((e) =>
|
|
163
|
+
let e = r, i = typeof e.id == "string" ? e.id.slice(0, 40) : "", a = e.type, o = T(e.label, S.label);
|
|
164
|
+
if (!i || n.has(i) || !D.includes(a) || !o) continue;
|
|
165
|
+
let s = a === "select" && Array.isArray(e.options) ? [...new Set(e.options.map((e) => T(e, S.option)).filter(Boolean))].slice(0, S.options) : [];
|
|
149
166
|
if (a === "select" && !s.length) continue;
|
|
150
167
|
let c = e.types ?? {};
|
|
151
168
|
if (n.add(i), t.push({
|
|
@@ -155,63 +172,99 @@ function w(e) {
|
|
|
155
172
|
required: e.required === !0,
|
|
156
173
|
options: s,
|
|
157
174
|
types: {
|
|
158
|
-
problem:
|
|
159
|
-
idea:
|
|
160
|
-
general:
|
|
175
|
+
problem: E(c.problem, !0),
|
|
176
|
+
idea: E(c.idea, !0),
|
|
177
|
+
general: E(c.general, !0)
|
|
161
178
|
}
|
|
162
|
-
}), t.length >=
|
|
179
|
+
}), t.length >= S.fields) break;
|
|
163
180
|
}
|
|
164
181
|
return t;
|
|
165
182
|
}
|
|
166
|
-
function
|
|
167
|
-
let t = e ?? {}, n =
|
|
168
|
-
problem:
|
|
169
|
-
idea:
|
|
170
|
-
general:
|
|
171
|
-
|
|
172
|
-
|
|
183
|
+
function k(e) {
|
|
184
|
+
let t = e ?? {}, n = x, r = t.types ?? {}, i = {
|
|
185
|
+
problem: E(r.problem, !0),
|
|
186
|
+
idea: E(r.idea, !0),
|
|
187
|
+
general: E(r.general, !0),
|
|
188
|
+
accessibility: E(r.accessibility, !1)
|
|
189
|
+
}, a = i.problem || i.idea || i.general || i.accessibility, o = t.wording ?? {}, s = { ...n.wording };
|
|
190
|
+
for (let e of w) s[e] = T(o[e], 120);
|
|
173
191
|
return {
|
|
174
192
|
color: typeof t.color == "string" ? t.color : n.color,
|
|
175
|
-
text:
|
|
176
|
-
position:
|
|
193
|
+
text: T(t.text, 40) || n.text,
|
|
194
|
+
position: C.includes(t.position) ? t.position : n.position,
|
|
177
195
|
types: a ? i : { ...n.types },
|
|
178
|
-
rating:
|
|
196
|
+
rating: E(t.rating, n.rating),
|
|
179
197
|
hidePaths: Array.isArray(t.hidePaths) ? t.hidePaths.filter((e) => typeof e == "string") : [],
|
|
180
|
-
smallOnMobile:
|
|
181
|
-
hideButton:
|
|
182
|
-
segment:
|
|
198
|
+
smallOnMobile: E(t.smallOnMobile, n.smallOnMobile),
|
|
199
|
+
hideButton: E(t.hideButton, n.hideButton),
|
|
200
|
+
segment: E(t.segment, n.segment),
|
|
183
201
|
wording: s,
|
|
184
|
-
fields:
|
|
202
|
+
fields: O(t.fields),
|
|
185
203
|
capture: {
|
|
186
|
-
console:
|
|
187
|
-
network:
|
|
188
|
-
}
|
|
204
|
+
console: E(t.capture?.console, !0),
|
|
205
|
+
network: E(t.capture?.network, !0)
|
|
206
|
+
},
|
|
207
|
+
knownIssues: {
|
|
208
|
+
enabled: E(t.knownIssues?.enabled, !0),
|
|
209
|
+
notify: E(t.knownIssues?.notify, !0)
|
|
210
|
+
},
|
|
211
|
+
consent: { required: t.consent?.required === !0 },
|
|
212
|
+
privacyUrl: A(t.privacyUrl),
|
|
213
|
+
identifyPrefill: E(t.identifyPrefill, !0)
|
|
189
214
|
};
|
|
190
215
|
}
|
|
191
|
-
|
|
192
|
-
|
|
216
|
+
function A(e) {
|
|
217
|
+
let t = typeof e == "string" ? e.trim() : "";
|
|
218
|
+
try {
|
|
219
|
+
return t.length <= 500 && new URL(t).protocol === "https:" ? t : "";
|
|
220
|
+
} catch {
|
|
221
|
+
return "";
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
var j = /^#[0-9a-fA-F]{6}$/, M = (e) => typeof e == "string" && j.test(e) ? e : null;
|
|
225
|
+
function N(e) {
|
|
193
226
|
let t = e && typeof e == "object" ? e : {}, n = typeof t.logoUrl == "string" && /^https?:\/\//i.test(t.logoUrl) ? t.logoUrl.slice(0, 2e3) : null;
|
|
194
227
|
return {
|
|
195
228
|
poweredBy: t.poweredBy === !0,
|
|
196
229
|
logoUrl: n,
|
|
197
|
-
primary:
|
|
198
|
-
accent:
|
|
230
|
+
primary: M(t.primary),
|
|
231
|
+
accent: M(t.accent)
|
|
199
232
|
};
|
|
200
233
|
}
|
|
201
|
-
var
|
|
202
|
-
function
|
|
203
|
-
let n = e && typeof e == "object" ? e : {}, r = typeof t == "number" ?
|
|
234
|
+
var P = (e) => typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
235
|
+
function F(e, t) {
|
|
236
|
+
let n = e && typeof e == "object" ? e : {}, r = typeof t == "number" ? P(t) : 1, i = Array.isArray(n.fixChecks) ? n.fixChecks : [];
|
|
204
237
|
return {
|
|
205
238
|
followUp: n.followUp === !0,
|
|
206
239
|
autoBlur: n.autoBlur === !0,
|
|
207
240
|
replay: n.replay === !0,
|
|
208
|
-
replaySampleRate: Math.min(n.replaySampleRate === void 0 ? 1 :
|
|
241
|
+
replaySampleRate: Math.min(n.replaySampleRate === void 0 ? 1 : P(n.replaySampleRate), r),
|
|
242
|
+
replayMask: n.replayMask === "inputs" ? "inputs" : "all",
|
|
209
243
|
fixChecks: i.filter((e) => !!e && typeof e.id == "string" && typeof e.path == "string" && typeof e.signature == "string"),
|
|
210
|
-
|
|
244
|
+
watches: I(n.watches),
|
|
245
|
+
fixCheckSampleRate: Math.min(P(n.fixCheckSampleRate), r)
|
|
211
246
|
};
|
|
212
247
|
}
|
|
248
|
+
function I(e) {
|
|
249
|
+
return (Array.isArray(e) ? e : []).filter((e) => !!e && typeof e.id == "string" && typeof e.signature == "string").slice(0, 50);
|
|
250
|
+
}
|
|
251
|
+
function L(e, t) {
|
|
252
|
+
if (!Array.isArray(e) || t?.enabled === !1) return [];
|
|
253
|
+
let n = [];
|
|
254
|
+
for (let t of e) {
|
|
255
|
+
if (!t || typeof t != "object") continue;
|
|
256
|
+
let e = t, r = typeof e.id == "string" ? e.id.slice(0, 64) : "", i = T(e.title, 120);
|
|
257
|
+
if (r && i && (n.push({
|
|
258
|
+
id: r,
|
|
259
|
+
title: i,
|
|
260
|
+
paths: (Array.isArray(e.paths) ? e.paths : []).filter((e) => typeof e == "string" && e[0] === "/").slice(0, 10),
|
|
261
|
+
signature: typeof e.signature == "string" && e.signature ? e.signature : null
|
|
262
|
+
}), n.length >= 20)) break;
|
|
263
|
+
}
|
|
264
|
+
return n;
|
|
265
|
+
}
|
|
213
266
|
// src/ui/color.ts
|
|
214
|
-
function
|
|
267
|
+
function R(e) {
|
|
215
268
|
let t = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
216
269
|
if (!t) return null;
|
|
217
270
|
let n = t[1];
|
|
@@ -226,43 +279,43 @@ function j(e) {
|
|
|
226
279
|
});
|
|
227
280
|
return .2126 * r + .7152 * i + .0722 * a;
|
|
228
281
|
}
|
|
229
|
-
function
|
|
282
|
+
function z(e, t) {
|
|
230
283
|
let [n, r] = e > t ? [e, t] : [t, e];
|
|
231
284
|
return (n + .05) / (r + .05);
|
|
232
285
|
}
|
|
233
|
-
function
|
|
234
|
-
let t =
|
|
235
|
-
return t === null ? "#FFFFFF" :
|
|
286
|
+
function B(e) {
|
|
287
|
+
let t = R(e);
|
|
288
|
+
return t === null ? "#FFFFFF" : z(t, R("#0B1300")) >= z(t, 1) ? "#0B1300" : "#FFFFFF";
|
|
236
289
|
}
|
|
237
|
-
function
|
|
238
|
-
return typeof e == "string" &&
|
|
290
|
+
function V(e, t = "#B8F35C") {
|
|
291
|
+
return typeof e == "string" && R(e) !== null ? e.trim() : t;
|
|
239
292
|
}
|
|
240
293
|
// src/ui/dom.ts
|
|
241
|
-
function
|
|
294
|
+
function H(e, t = {}, ...n) {
|
|
242
295
|
let r = document.createElement(e);
|
|
243
296
|
for (let [e, n] of Object.entries(t)) n != null && n !== !1 && r.setAttribute(e, n === !0 ? "" : String(n));
|
|
244
297
|
for (let e of n) e != null && e !== !1 && r.append(e);
|
|
245
298
|
return r;
|
|
246
299
|
}
|
|
247
|
-
var
|
|
248
|
-
function
|
|
249
|
-
let n = document.createElementNS(
|
|
300
|
+
var U = "http://www.w3.org/2000/svg";
|
|
301
|
+
function W(e, t = 16) {
|
|
302
|
+
let n = document.createElementNS(U, "svg");
|
|
250
303
|
n.setAttribute("width", String(t)), n.setAttribute("height", String(t)), n.setAttribute("viewBox", "0 0 24 24"), n.setAttribute("fill", "none"), n.setAttribute("stroke", "currentColor"), n.setAttribute("stroke-width", "2.2"), n.setAttribute("stroke-linecap", "round"), n.setAttribute("stroke-linejoin", "round"), n.setAttribute("aria-hidden", "true");
|
|
251
|
-
let r = document.createElementNS(
|
|
304
|
+
let r = document.createElementNS(U, "path");
|
|
252
305
|
return r.setAttribute("d", e), n.append(r), n;
|
|
253
306
|
}
|
|
254
|
-
var
|
|
307
|
+
var G = {
|
|
255
308
|
close: "M18 6L6 18M6 6l12 12",
|
|
256
309
|
back: "M15 18l-6-6 6-6",
|
|
257
310
|
pen: "M12 20h9M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z",
|
|
258
311
|
camera: "M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2zM12 17a4 4 0 100-8 4 4 0 000 8z",
|
|
259
312
|
trash: "M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6"
|
|
260
|
-
},
|
|
261
|
-
function
|
|
262
|
-
let n =
|
|
313
|
+
}, K = "\n $ .panel, $.pos-bottom-right .panel, $.pos-bottom-left .panel, $.pos-right-edge .panel { left: 0; right: 0; bottom: 0; width: 100%; max-width: none; max-height: 88vh; border-radius: 16px 16px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }\n $.open .launcher { display: none; }\n $ .field textarea, $ .field input, $ .field select { font-size: 16px; }\n $ .launcher { padding: 11px 16px; font-size: 14px; }\n $.pos-bottom-right .launcher { right: 16px; bottom: 16px; }\n $.pos-bottom-left .launcher { left: 16px; bottom: 16px; }\n $.small .launcher { padding: 8px 12px; font-size: 13px; box-shadow: 0 8px 20px -6px rgba(0,0,0,0.35); }\n $.small.pos-bottom-right .launcher { right: 12px; bottom: 12px; }\n $.small.pos-bottom-left .launcher { left: 12px; bottom: 12px; }\n $.small.pos-right-edge .launcher { padding: 8px 10px; }\n";
|
|
314
|
+
function q(e, t) {
|
|
315
|
+
let n = K.replace(/\$/g, t);
|
|
263
316
|
return e ? `${e}${n}}` : n;
|
|
264
317
|
}
|
|
265
|
-
var
|
|
318
|
+
var J = `
|
|
266
319
|
:host { all: initial; }
|
|
267
320
|
* { box-sizing: border-box; }
|
|
268
321
|
.pnx { font-family: Manrope, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #111827; font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
|
|
@@ -324,6 +377,14 @@ button:disabled { cursor: default; }
|
|
|
324
377
|
.field.check input { flex: none; width: 20px; height: 20px; margin: 0; padding: 0; accent-color: #2E46BF; box-shadow: none; }
|
|
325
378
|
.field.check label { font-size: 13px; color: #111827; font-weight: 600; line-height: 1.45; }
|
|
326
379
|
.field.check input[aria-invalid="true"] { outline: 2px solid #B42318; outline-offset: 2px; }
|
|
380
|
+
.a11y-note { margin: 0; font-size: 13px; line-height: 1.45; color: #374151; }
|
|
381
|
+
fieldset.barriers { border: 0; margin: 0; padding: 0; min-width: 0; gap: 2px; }
|
|
382
|
+
fieldset.barriers legend { padding: 0; margin-bottom: 4px; }
|
|
383
|
+
.radio { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 8px; border-radius: 8px; }
|
|
384
|
+
.radio:hover { background: #F2F4F8; }
|
|
385
|
+
.field .radio input, .field .radio input:focus { flex: none; width: 20px; height: 20px; margin: 0; padding: 0; border-radius: 50%; background: none; accent-color: #0F766E; box-shadow: none; }
|
|
386
|
+
.radio input:focus-visible { outline: 2px solid #2E46BF; outline-offset: 2px; }
|
|
387
|
+
.radio label { flex: 1; font-size: 14px; color: #111827; font-weight: 500; line-height: 1.35; padding: 8px 0; cursor: pointer; }
|
|
327
388
|
.brand { display: flex; align-items: center; min-height: 28px; }
|
|
328
389
|
.brand .logo { display: block; max-height: 32px; max-width: 160px; width: auto; height: auto; object-fit: contain; }
|
|
329
390
|
.accented .panel { border-top: 4px solid var(--pnx-accent); }
|
|
@@ -354,13 +415,27 @@ button:disabled { cursor: default; }
|
|
|
354
415
|
.field textarea.answer { min-height: 64px; }
|
|
355
416
|
.skip { width: 100%; padding: 8px; text-align: center; }
|
|
356
417
|
.skip:disabled, .send:disabled + .skip { opacity: .7; }
|
|
418
|
+
|
|
419
|
+
.known { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
|
|
420
|
+
.known > li { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border-radius: 10px; background: #F2F4F8; }
|
|
421
|
+
.known-title { margin: 0; font-size: 14px; font-weight: 700; color: #111827; overflow-wrap: anywhere; }
|
|
422
|
+
.known-thanks { margin: 0; font-size: 13px; font-weight: 600; color: #374151; }
|
|
423
|
+
.known .field { align-self: stretch; }
|
|
424
|
+
.known .field input { background: #FFFFFF; box-shadow: inset 0 0 0 1px #6B7280; }
|
|
425
|
+
.known .field input:focus { box-shadow: inset 0 0 0 2px #2E46BF; }
|
|
426
|
+
.known .field [aria-invalid="true"] { box-shadow: inset 0 0 0 2px #B42318; }
|
|
427
|
+
.subtitle { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: #5B6474; }
|
|
428
|
+
.privacy { display: flex; flex-direction: column; gap: 10px; }
|
|
429
|
+
.notice { margin: 0; font-size: 12px; line-height: 1.45; color: #5B6474; overflow-wrap: anywhere; }
|
|
430
|
+
.notice a { color: #2E46BF; font-weight: 700; text-decoration: underline; }
|
|
431
|
+
.notice a:hover { color: #111827; }
|
|
357
432
|
.hint.auto-blur { display: flex; align-items: center; gap: 6px; }
|
|
358
433
|
.hint.auto-blur i { flex: none; width: 16px; height: 10px; border-radius: 3px; background: repeating-linear-gradient(90deg, #D8DEE9 0 4px, #C7CFDC 4px 8px); box-shadow: 0 0 0 1px #C7CFDC; }
|
|
359
434
|
|
|
360
|
-
${
|
|
435
|
+
${q("@media (max-width: 520px) {", ".pnx")}
|
|
361
436
|
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
|
|
362
|
-
@media (forced-colors: active) { .launcher, .choice, .send, .chip, .star { border: 1px solid ButtonText; } }
|
|
363
|
-
`,
|
|
437
|
+
@media (forced-colors: active) { .launcher, .choice, .send, .chip, .star { border: 1px solid ButtonText; } .known > li { border: 1px solid CanvasText; } }
|
|
438
|
+
`, Y = [
|
|
364
439
|
{
|
|
365
440
|
type: "PROBLEM",
|
|
366
441
|
key: "problem",
|
|
@@ -387,24 +462,46 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
387
462
|
dot: "#3DBF6E",
|
|
388
463
|
send: "#3DBF6E",
|
|
389
464
|
ink: "#0B1300"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
type: "ACCESSIBILITY",
|
|
468
|
+
key: "accessibility",
|
|
469
|
+
label: "Report an accessibility barrier",
|
|
470
|
+
desc: "Something you can't see, reach or use",
|
|
471
|
+
dot: "#2FB8AC",
|
|
472
|
+
send: "#0F766E",
|
|
473
|
+
ink: "#FFFFFF"
|
|
390
474
|
}
|
|
391
|
-
],
|
|
475
|
+
], X = [
|
|
476
|
+
["see", "Hard to see or read"],
|
|
477
|
+
["keyboard", "Can't use it with a keyboard"],
|
|
478
|
+
["screen-reader", "Doesn't work with my screen reader"],
|
|
479
|
+
["media", "Video or audio"],
|
|
480
|
+
["other", "Something else"]
|
|
481
|
+
], Z = 4e3, Q = "What would you like to do?", $ = "Thanks! We've got it.", ee = {
|
|
392
482
|
problem: "problemTitle",
|
|
393
483
|
idea: "ideaTitle",
|
|
394
|
-
general: "generalTitle"
|
|
395
|
-
|
|
484
|
+
general: "generalTitle",
|
|
485
|
+
accessibility: "accessibilityTitle"
|
|
486
|
+
}, te = class {
|
|
396
487
|
constructor(e, t, n, r = {}) {
|
|
397
|
-
this.root = e, this.config = t, this.handlers = n, this.kind = null, this.shot = { kind: "none" }, this.message = "", this.email = "", this.answers = {}, this.sendColour = null, this.sending = !1, this.openedAt = 0, this.hp = "", this.uid = Math.random().toString(36).slice(2, 8), this.pathHidden = !1, this.returnFocus = null, this.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
488
|
+
this.root = e, this.config = t, this.handlers = n, this.kind = null, this.shot = { kind: "none" }, this.message = "", this.email = "", this.emailEdited = !1, this.answers = {}, this.sendColour = null, this.sending = !1, this.openedAt = 0, this.hp = "", this.uid = Math.random().toString(36).slice(2, 8), this.pathHidden = !1, this.returnFocus = null, this.known = [], this.knownHidden = /* @__PURE__ */ new Set(), this.meToo = {}, this.includeLogs = !1, this.privacy = null, this.noticeText = null, this.shown = {
|
|
489
|
+
logs: !0,
|
|
490
|
+
askLogs: !1,
|
|
491
|
+
replay: !1
|
|
492
|
+
}, this.view = "choose", this.queued = !1, this.asked = null, this.answer = "";
|
|
493
|
+
let i = t.settings, a = t.branding?.primary ? V(t.branding.primary, "") : "", o = t.branding?.accent ? V(t.branding.accent, "") : "", s = a || V(i.color);
|
|
494
|
+
this.sendColour = a || null;
|
|
495
|
+
let c = (e) => e.key === "accessibility" ? i.types?.accessibility === !0 : i.types?.[e.key] !== !1;
|
|
496
|
+
this.kinds = Y.filter(c), this.kinds.length || (this.kinds = Y.slice(0, 3));
|
|
497
|
+
let l = H("style");
|
|
498
|
+
l.textContent = r.css ? J + r.css : J, this.launcher = H("button", {
|
|
402
499
|
type: "button",
|
|
403
500
|
class: "launcher",
|
|
404
501
|
"aria-haspopup": "dialog",
|
|
405
502
|
"aria-expanded": "false",
|
|
406
503
|
"aria-controls": `pnx-panel-${this.uid}`
|
|
407
|
-
}, (i.text || "Feedback").slice(0, 40)), this.launcher.addEventListener("click", () => this.isOpen() ? this.close() : this.open()), this.panel =
|
|
504
|
+
}, (i.text || "Feedback").slice(0, 40)), this.launcher.addEventListener("click", () => this.isOpen() ? this.close() : this.open()), this.panel = H("div", {
|
|
408
505
|
class: "panel",
|
|
409
506
|
id: `pnx-panel-${this.uid}`,
|
|
410
507
|
role: "dialog",
|
|
@@ -413,17 +510,17 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
413
510
|
hidden: !0
|
|
414
511
|
}), this.panel.addEventListener("keydown", (e) => {
|
|
415
512
|
e.key === "Escape" && (e.stopPropagation(), this.close());
|
|
416
|
-
}), this.panel.addEventListener("pointerdown", () => this.holdOpen()), this.panel.addEventListener("focusin", () => this.holdOpen()), this.live =
|
|
513
|
+
}), this.panel.addEventListener("pointerdown", () => this.holdOpen()), this.panel.addEventListener("focusin", () => this.holdOpen()), this.live = H("div", {
|
|
417
514
|
class: "sr",
|
|
418
515
|
role: "status",
|
|
419
516
|
"aria-live": "polite"
|
|
420
517
|
});
|
|
421
|
-
let
|
|
518
|
+
let u = [
|
|
422
519
|
"bottom-right",
|
|
423
520
|
"bottom-left",
|
|
424
521
|
"right-edge"
|
|
425
522
|
].includes(i.position) ? i.position : "bottom-right";
|
|
426
|
-
this.wrap =
|
|
523
|
+
this.wrap = H("div", { class: `pnx pos-${u}${r.className ? ` ${r.className}` : ""}` }), i.smallOnMobile && this.wrap.classList.add("small"), this.updateButton(), this.wrap.style.setProperty("--pnx-brand", s), this.wrap.style.setProperty("--pnx-ink", B(s)), o && (this.wrap.classList.add("accented"), this.wrap.style.setProperty("--pnx-accent", o), this.wrap.style.setProperty("--pnx-accent-ink", B(o))), this.wrap.append(this.launcher, this.panel, this.live), e.append(l, this.wrap);
|
|
427
524
|
}
|
|
428
525
|
isOpen() {
|
|
429
526
|
return !this.panel.hidden;
|
|
@@ -444,7 +541,7 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
444
541
|
return;
|
|
445
542
|
}
|
|
446
543
|
let t = document.activeElement;
|
|
447
|
-
this.returnFocus = t instanceof HTMLElement && t !== this.root.host ? t : null, this.openedAt || (this.openedAt = Date.now()), this.panel.hidden = !1, this.wrap.classList.add("open"), this.launcher.setAttribute("aria-expanded", "true"), !this.kind && this.kinds.length === 1 && this.pick(this.kinds[0], !1), this.render(), e && this.focusFirst();
|
|
544
|
+
this.returnFocus = t instanceof HTMLElement && t !== this.root.host ? t : null, this.openedAt || (this.openedAt = Date.now()), (this.view === "choose" || this.kinds.length === 1 && this.view === "form" && !this.message.trim()) && this.offerKnown(), this.panel.hidden = !1, this.wrap.classList.add("open"), this.launcher.setAttribute("aria-expanded", "true"), !this.kind && this.kinds.length === 1 && !this.knownShown().length && this.pick(this.kinds[0], !1), this.render(), e && this.focusFirst();
|
|
448
545
|
try {
|
|
449
546
|
this.handlers.opened?.();
|
|
450
547
|
} catch {}
|
|
@@ -458,7 +555,7 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
458
555
|
showView(e) {
|
|
459
556
|
if (clearTimeout(this.closeTimer), e === "button") this.close(!1);
|
|
460
557
|
else {
|
|
461
|
-
if (this.reset(), e === "done") this.view = "done";
|
|
558
|
+
if (this.reset(), this.knownHidden.clear(), this.meToo = {}, e === "choose" && this.offerKnown(), e === "done") this.view = "done";
|
|
462
559
|
else if (e !== "choose") {
|
|
463
560
|
let t = this.kinds.find((t) => t.key === e);
|
|
464
561
|
t && this.pick(t, !1);
|
|
@@ -470,7 +567,7 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
470
567
|
return this.config.settings.wording?.[e]?.trim() || t;
|
|
471
568
|
}
|
|
472
569
|
kindTitle(e, t = e.label) {
|
|
473
|
-
return this.word(
|
|
570
|
+
return this.word(ee[e.key], t);
|
|
474
571
|
}
|
|
475
572
|
setSuspended(e) {
|
|
476
573
|
this.wrap.style.display = e ? "none" : "";
|
|
@@ -479,7 +576,7 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
479
576
|
clearTimeout(this.closeTimer), this.wrap.remove();
|
|
480
577
|
}
|
|
481
578
|
reset() {
|
|
482
|
-
this.view = "choose", this.kind = null, this.shot = { kind: "none" }, this.message = "", this.rating = void 0, this.answers = {}, this.queued = !1, this.asked = null, this.answer = "", this.openedAt = this.isOpen() ? Date.now() : 0, this.hp = "", this.kinds.length === 1 && this.pick(this.kinds[0], !1);
|
|
579
|
+
this.view = "choose", this.kind = null, this.shot = { kind: "none" }, this.message = "", this.rating = void 0, this.barrier = void 0, this.answers = {}, this.includeLogs = !1, this.queued = !1, this.asked = null, this.answer = "", this.openedAt = this.isOpen() ? Date.now() : 0, this.hp = "", this.kinds.length === 1 && this.pick(this.kinds[0], !1);
|
|
483
580
|
}
|
|
484
581
|
holdOpen() {
|
|
485
582
|
clearTimeout(this.closeTimer);
|
|
@@ -504,7 +601,7 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
504
601
|
}, 30);
|
|
505
602
|
}
|
|
506
603
|
pick(e, t = !0) {
|
|
507
|
-
this.kind = e, this.view = "form", this.rating = void 0, this.email
|
|
604
|
+
this.kind = e, this.view = "form", this.rating = void 0, !this.email && !this.emailEdited && this.config.settings.identifyPrefill !== !1 && (this.email = this.handlers.user()?.email || ""), e.type === "PROBLEM" && this.shot.kind === "none" && this.capture(), e.type !== "PROBLEM" && this.shot.kind === "busy" && (this.shot = { kind: "none" }), t && (this.render(), this.focusFirst());
|
|
508
605
|
}
|
|
509
606
|
async capture() {
|
|
510
607
|
this.shot = { kind: "busy" }, this.render();
|
|
@@ -543,32 +640,32 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
543
640
|
}
|
|
544
641
|
}
|
|
545
642
|
header(e, t, n) {
|
|
546
|
-
let r =
|
|
643
|
+
let r = H("div", { class: "head" });
|
|
547
644
|
if (t) {
|
|
548
|
-
let e =
|
|
645
|
+
let e = H("button", {
|
|
549
646
|
type: "button",
|
|
550
647
|
class: "icon-btn",
|
|
551
648
|
"aria-label": "Back",
|
|
552
649
|
"data-key": "back"
|
|
553
650
|
});
|
|
554
|
-
e.append(
|
|
651
|
+
e.append(W(G.back)), e.addEventListener("click", () => {
|
|
555
652
|
n ? n() : (this.view = "choose", this.kind = null, this.render(), this.focusFirst());
|
|
556
653
|
}), r.append(e);
|
|
557
654
|
}
|
|
558
|
-
r.append(
|
|
655
|
+
r.append(H("h2", {
|
|
559
656
|
class: "title",
|
|
560
657
|
id: `pnx-title-${this.uid}`
|
|
561
658
|
}, e));
|
|
562
|
-
let i =
|
|
659
|
+
let i = H("button", {
|
|
563
660
|
type: "button",
|
|
564
661
|
class: "icon-btn",
|
|
565
662
|
"aria-label": "Close feedback",
|
|
566
663
|
"data-key": "close"
|
|
567
664
|
});
|
|
568
|
-
return i.append(
|
|
665
|
+
return i.append(W(G.close)), i.addEventListener("click", () => this.close()), r.append(i), r;
|
|
569
666
|
}
|
|
570
667
|
powered() {
|
|
571
|
-
return this.config.branding?.poweredBy ?
|
|
668
|
+
return this.config.branding?.poweredBy ? H("div", { class: "powered" }, H("a", {
|
|
572
669
|
href: "https://getpinax.com",
|
|
573
670
|
target: "_blank",
|
|
574
671
|
rel: "noopener"
|
|
@@ -577,13 +674,13 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
577
674
|
logo() {
|
|
578
675
|
let e = this.config.branding?.logoUrl;
|
|
579
676
|
if (!e || !/^https?:\/\//i.test(e)) return null;
|
|
580
|
-
let t =
|
|
677
|
+
let t = H("img", {
|
|
581
678
|
src: e,
|
|
582
679
|
alt: "",
|
|
583
680
|
class: "logo",
|
|
584
681
|
referrerpolicy: "no-referrer"
|
|
585
682
|
});
|
|
586
|
-
return t.addEventListener("error", () => t.remove()),
|
|
683
|
+
return t.addEventListener("error", () => t.remove()), H("div", { class: "brand" }, t);
|
|
587
684
|
}
|
|
588
685
|
render() {
|
|
589
686
|
let e = [], t = this.logo();
|
|
@@ -592,72 +689,172 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
592
689
|
n && e.push(n), this.panel.replaceChildren(...e);
|
|
593
690
|
}
|
|
594
691
|
renderChoose() {
|
|
595
|
-
let e =
|
|
596
|
-
for (let
|
|
597
|
-
let
|
|
692
|
+
let e = this.knownShown(), t = this.word("chooserTitle", Q), n = H("ul", { class: "choices" });
|
|
693
|
+
for (let e of this.kinds) {
|
|
694
|
+
let t = H("button", {
|
|
598
695
|
type: "button",
|
|
599
696
|
class: "choice"
|
|
600
|
-
},
|
|
697
|
+
}, H("span", {
|
|
601
698
|
class: "dot",
|
|
602
699
|
"aria-hidden": "true"
|
|
603
|
-
}),
|
|
604
|
-
|
|
700
|
+
}), H("span", {}, this.kindTitle(e), H("small", {}, e.desc)));
|
|
701
|
+
t.style.setProperty("--dot", e.dot), t.addEventListener("click", () => this.pick(e)), n.append(H("li", {}, t));
|
|
702
|
+
}
|
|
703
|
+
return e.length ? [
|
|
704
|
+
this.header("We know about this", !1),
|
|
705
|
+
...this.renderKnown(e),
|
|
706
|
+
H("h3", { class: "subtitle" }, t),
|
|
707
|
+
n
|
|
708
|
+
] : [this.header(t, !1), n];
|
|
709
|
+
}
|
|
710
|
+
knownShown() {
|
|
711
|
+
return this.config.settings.knownIssues?.enabled === !1 ? [] : this.known.filter((e) => !this.knownHidden.has(e.id));
|
|
712
|
+
}
|
|
713
|
+
offerKnown() {
|
|
714
|
+
try {
|
|
715
|
+
this.known = this.handlers.knownIssues?.().slice(0, 3) ?? [];
|
|
716
|
+
} catch {
|
|
717
|
+
this.known = [];
|
|
718
|
+
}
|
|
719
|
+
this.knownShown().length && (this.view = "choose", this.kind = null);
|
|
720
|
+
}
|
|
721
|
+
renderKnown(e) {
|
|
722
|
+
let t = this.config.settings.knownIssues?.notify !== !1, n = H("ul", { class: "known" }), r = !0;
|
|
723
|
+
e.forEach((e, i) => {
|
|
724
|
+
let a = this.meToo[e.id], o = `pnx-k${i}-${this.uid}`, s = H("p", {
|
|
725
|
+
class: "error",
|
|
726
|
+
role: "alert",
|
|
727
|
+
id: `pnx-k${i}-err-${this.uid}`
|
|
728
|
+
}), c = H("li", {}, H("p", {
|
|
729
|
+
class: "known-title",
|
|
730
|
+
id: o
|
|
731
|
+
}, e.title));
|
|
732
|
+
if (!a || a === "busy") {
|
|
733
|
+
let t = H("button", {
|
|
734
|
+
type: "button",
|
|
735
|
+
class: "chip primary",
|
|
736
|
+
"aria-describedby": o,
|
|
737
|
+
"data-key": `metoo-${i}`,
|
|
738
|
+
"data-autofocus": r || void 0,
|
|
739
|
+
disabled: a === "busy"
|
|
740
|
+
}, "Me too");
|
|
741
|
+
r = !1, t.addEventListener("click", () => this.sendMeToo(e, i, s)), c.append(t, s);
|
|
742
|
+
} else if (a === "emailed" || !t) c.append(H("p", { class: "known-thanks" }, a === "emailed" ? "Thanks. We'll email you when it's fixed." : "Thanks, we've added you."));
|
|
743
|
+
else {
|
|
744
|
+
let t = `pnx-k${i}-email-${this.uid}`, n = `${t}-hint`, r = H("input", {
|
|
745
|
+
id: t,
|
|
746
|
+
type: "email",
|
|
747
|
+
inputmode: "email",
|
|
748
|
+
autocomplete: "email",
|
|
749
|
+
maxlength: 254,
|
|
750
|
+
"aria-describedby": n,
|
|
751
|
+
"data-key": `known-email-${i}`,
|
|
752
|
+
placeholder: "you@example.com"
|
|
753
|
+
});
|
|
754
|
+
r.value = this.email, r.addEventListener("input", () => {
|
|
755
|
+
this.email = r.value, this.emailEdited = !0;
|
|
756
|
+
});
|
|
757
|
+
let o = H("button", {
|
|
758
|
+
type: "button",
|
|
759
|
+
class: "chip primary",
|
|
760
|
+
"data-key": `known-send-${i}`,
|
|
761
|
+
disabled: a === "sending"
|
|
762
|
+
}, a === "sending" ? "Sending…" : "Send");
|
|
763
|
+
o.addEventListener("click", () => this.sendMeToo(e, i, s, r)), c.append(H("p", { class: "known-thanks" }, "Thanks, we've added you."), H("div", { class: "field" }, H("label", { for: t }, "Email me when it's fixed"), r, H("span", {
|
|
764
|
+
class: "hint",
|
|
765
|
+
id: n
|
|
766
|
+
}, "Only used to tell you when it's fixed.")), s, o);
|
|
767
|
+
}
|
|
768
|
+
n.append(c);
|
|
769
|
+
});
|
|
770
|
+
let i = H("button", {
|
|
771
|
+
type: "button",
|
|
772
|
+
class: "link",
|
|
773
|
+
"data-key": "known-else"
|
|
774
|
+
}, "Report something else");
|
|
775
|
+
return i.addEventListener("click", () => {
|
|
776
|
+
for (let t of e) this.knownHidden.add(t.id);
|
|
777
|
+
this.kinds.length === 1 ? this.pick(this.kinds[0]) : (this.render(), this.panel.querySelector(".choice")?.focus());
|
|
778
|
+
}), [n, i];
|
|
779
|
+
}
|
|
780
|
+
async sendMeToo(e, t, n, r) {
|
|
781
|
+
let i = this.meToo[e.id];
|
|
782
|
+
if (i === "busy" || i === "sending") return;
|
|
783
|
+
n.textContent = "";
|
|
784
|
+
let a = r ? this.email.trim() : void 0;
|
|
785
|
+
if (r && (!a || !d(a))) {
|
|
786
|
+
n.textContent = "Please check your email address.", r.setAttribute("aria-invalid", "true"), r.setAttribute("aria-errormessage", n.id), r.focus();
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
this.meToo[e.id] = r ? "sending" : "busy", this.renderKeepingFocus();
|
|
790
|
+
let o = !1;
|
|
791
|
+
try {
|
|
792
|
+
o = await this.handlers.meToo?.(e.id, a) ?? !1;
|
|
793
|
+
} catch {
|
|
794
|
+
o = !1;
|
|
795
|
+
}
|
|
796
|
+
if (o || r ? this.meToo[e.id] = o && r ? "emailed" : "done" : delete this.meToo[e.id], !this.isOpen() || this.view !== "choose") return;
|
|
797
|
+
this.render();
|
|
798
|
+
let s = (e) => this.panel.querySelector(`[data-key="${e}"]`);
|
|
799
|
+
if (o) (s(`known-email-${t}`) ?? s("known-else"))?.focus(), this.announce(r ? "Thanks. We'll email you when it's fixed." : "Thanks, we've added you.");
|
|
800
|
+
else {
|
|
801
|
+
let e = this.panel.querySelector(`#pnx-k${t}-err-${this.uid}`);
|
|
802
|
+
e && (e.textContent = "Something went wrong. Please try again."), s(r ? `known-send-${t}` : `metoo-${t}`)?.focus();
|
|
605
803
|
}
|
|
606
|
-
return [this.header(this.word("chooserTitle", W), !1), e];
|
|
607
804
|
}
|
|
608
805
|
renderShot(e) {
|
|
609
806
|
let t = this.shot;
|
|
610
807
|
if (t.kind === "none") {
|
|
611
808
|
if (e.type === "GENERAL") return null;
|
|
612
|
-
let t =
|
|
809
|
+
let t = H("button", {
|
|
613
810
|
type: "button",
|
|
614
811
|
class: "chip",
|
|
615
812
|
"data-key": "add-shot"
|
|
616
|
-
},
|
|
617
|
-
return t.addEventListener("click", () => this.capture()),
|
|
813
|
+
}, W(G.camera), "Add a screenshot");
|
|
814
|
+
return t.addEventListener("click", () => this.capture()), H("div", { class: "shot-actions" }, t);
|
|
618
815
|
}
|
|
619
|
-
if (t.kind === "busy") return
|
|
816
|
+
if (t.kind === "busy") return H("div", {
|
|
620
817
|
class: "shot",
|
|
621
818
|
"aria-busy": "true"
|
|
622
|
-
},
|
|
819
|
+
}, H("span", { class: "wait" }, "Taking a screenshot…"));
|
|
623
820
|
if (t.kind === "failed") {
|
|
624
|
-
let e =
|
|
821
|
+
let e = H("button", {
|
|
625
822
|
type: "button",
|
|
626
823
|
class: "chip",
|
|
627
824
|
"data-key": "retry-shot"
|
|
628
825
|
}, "Try again");
|
|
629
|
-
return e.addEventListener("click", () => this.capture()),
|
|
826
|
+
return e.addEventListener("click", () => this.capture()), H("div", { class: "field" }, H("span", { class: "hint" }, "Couldn't take a screenshot of this page."), H("div", { class: "shot-actions" }, e));
|
|
630
827
|
}
|
|
631
|
-
let n = t.shot.annotations.length, r = t.shot.autoBlurred ?? 0, i =
|
|
828
|
+
let n = t.shot.annotations.length, r = t.shot.autoBlurred ?? 0, i = H("img", {
|
|
632
829
|
src: t.shot.dataUrl,
|
|
633
830
|
alt: `Screenshot of this page${n ? ` with ${n} ${n === 1 ? "mark" : "marks"}` : ""}${r ? `, ${r} private ${r === 1 ? "detail" : "details"} blurred` : ""}`
|
|
634
|
-
}), a =
|
|
831
|
+
}), a = H("button", {
|
|
635
832
|
type: "button",
|
|
636
833
|
class: "chip primary",
|
|
637
834
|
"data-markup": !0,
|
|
638
835
|
"data-key": "markup"
|
|
639
|
-
},
|
|
836
|
+
}, W(G.pen), n ? "Edit marks" : "Mark up");
|
|
640
837
|
a.addEventListener("click", () => this.markUp());
|
|
641
|
-
let o =
|
|
838
|
+
let o = H("button", {
|
|
642
839
|
type: "button",
|
|
643
840
|
class: "chip",
|
|
644
841
|
"data-key": "remove-shot"
|
|
645
|
-
},
|
|
842
|
+
}, W(G.trash), "Remove", H("span", { class: "sr" }, " screenshot"));
|
|
646
843
|
return o.addEventListener("click", () => {
|
|
647
844
|
this.shot = { kind: "none" }, this.announce("Screenshot removed."), this.render(), this.panel.querySelector("[data-key=\"add-shot\"]")?.focus();
|
|
648
|
-
}),
|
|
845
|
+
}), H("div", { class: "field" }, H("div", { class: "shot" }, i, H("span", {
|
|
649
846
|
class: "tag",
|
|
650
847
|
"aria-hidden": "true"
|
|
651
|
-
}, "Screenshot")),
|
|
848
|
+
}, "Screenshot")), H("div", { class: "shot-actions" }, a, o), r ? H("span", { class: "hint auto-blur" }, H("i", { "aria-hidden": "true" }), `We blurred ${r === 1 ? "1 private detail" : `${r} private details`} for you.`) : null);
|
|
652
849
|
}
|
|
653
850
|
renderStars() {
|
|
654
|
-
let e =
|
|
851
|
+
let e = H("div", {
|
|
655
852
|
class: "stars",
|
|
656
853
|
role: "radiogroup",
|
|
657
854
|
"aria-labelledby": `pnx-rate-${this.uid}`
|
|
658
855
|
}), t = [], n = (this.rating ?? 1) - 1;
|
|
659
856
|
for (let e = 1; e <= 5; e++) {
|
|
660
|
-
let r =
|
|
857
|
+
let r = H("button", {
|
|
661
858
|
type: "button",
|
|
662
859
|
class: this.rating !== void 0 && e <= this.rating ? "star on" : "star",
|
|
663
860
|
role: "radio",
|
|
@@ -676,54 +873,159 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
676
873
|
this.rating = n, this.render(), this.panel.querySelector(`[data-key="star-${n}"]`)?.focus();
|
|
677
874
|
}), t.push(r);
|
|
678
875
|
}
|
|
679
|
-
return e.append(...t),
|
|
876
|
+
return e.append(...t), H("div", { class: "field" }, H("span", {
|
|
680
877
|
class: "legend",
|
|
681
878
|
id: `pnx-rate-${this.uid}`
|
|
682
879
|
}, "How's your visit so far? (optional)"), e);
|
|
683
880
|
}
|
|
684
881
|
renderForm(e) {
|
|
882
|
+
if (e.type === "ACCESSIBILITY") return this.renderAccessibility(e);
|
|
685
883
|
let t = e.type === "GENERAL" && this.config.settings.rating !== !1, n = this.kindTitle(e, t ? "How was your visit?" : e.label), r = [this.header(n, this.kinds.length > 1)], i = this.renderShot(e);
|
|
686
884
|
i && r.push(i), t && r.push(this.renderStars());
|
|
687
|
-
let a = `pnx-msg-${this.uid}`, o =
|
|
885
|
+
let a = `pnx-msg-${this.uid}`, o = H("textarea", {
|
|
688
886
|
id: a,
|
|
689
887
|
maxlength: 5e3,
|
|
690
888
|
"data-key": "message",
|
|
691
889
|
"data-autofocus": e.type !== "PROBLEM" && !t || void 0,
|
|
692
890
|
placeholder: this.word("messagePlaceholder", e.type === "PROBLEM" ? "What happened?" : e.type === "IDEA" ? "What would make this better?" : "Tell us what you think")
|
|
693
891
|
});
|
|
694
|
-
o.value = this.message, o.addEventListener("input", () => {
|
|
892
|
+
return o.value = this.message, o.addEventListener("input", () => {
|
|
695
893
|
this.message = o.value;
|
|
696
|
-
}), r.push(
|
|
697
|
-
|
|
698
|
-
|
|
894
|
+
}), r.push(H("div", { class: "field" }, H("label", { for: a }, e.type === "PROBLEM" ? "What went wrong?" : e.type === "IDEA" ? "Your idea" : "Anything to add?"), o)), r.push(...this.renderFields(e)), r.push(...this.renderEmailAndSend(e, o, e.type === "PROBLEM" ? "Only used to tell you about this report." : "Only used to reply to you about this.")), r;
|
|
895
|
+
}
|
|
896
|
+
renderEmailAndSend(e, t, n) {
|
|
897
|
+
let r = [], i = `pnx-email-${this.uid}`, a = `pnx-email-hint-${this.uid}`, o = H("input", {
|
|
898
|
+
id: i,
|
|
699
899
|
type: "email",
|
|
700
900
|
inputmode: "email",
|
|
701
901
|
autocomplete: "email",
|
|
702
902
|
maxlength: 320,
|
|
703
|
-
"aria-describedby":
|
|
903
|
+
"aria-describedby": a,
|
|
704
904
|
"data-key": "email",
|
|
705
905
|
placeholder: "you@example.com"
|
|
706
906
|
});
|
|
707
|
-
|
|
708
|
-
this.email =
|
|
709
|
-
}), r.push(
|
|
907
|
+
o.value = this.email, o.addEventListener("input", () => {
|
|
908
|
+
this.email = o.value, this.emailEdited = !0;
|
|
909
|
+
}), r.push(H("div", { class: "field" }, H("label", { for: i }, "Your email (optional)"), o, H("span", {
|
|
710
910
|
class: "hint",
|
|
711
|
-
id:
|
|
712
|
-
},
|
|
713
|
-
let
|
|
911
|
+
id: a
|
|
912
|
+
}, n)));
|
|
913
|
+
let s = H("p", {
|
|
714
914
|
class: "error",
|
|
715
915
|
role: "alert",
|
|
716
916
|
id: `pnx-err-${this.uid}`
|
|
717
|
-
}),
|
|
917
|
+
}), c = H("button", {
|
|
718
918
|
type: "button",
|
|
719
919
|
class: "send",
|
|
720
920
|
"data-key": "send",
|
|
921
|
+
"aria-describedby": `pnx-notice-${this.uid}`,
|
|
721
922
|
disabled: this.sending
|
|
722
923
|
}, this.sending ? "Sending…" : "Send");
|
|
723
|
-
return this.colourSend(
|
|
924
|
+
return this.colourSend(c, e), c.addEventListener("click", () => this.send(e, s, o, t)), r.push(this.renderPrivacy(), this.honeypot(), s, c), r;
|
|
925
|
+
}
|
|
926
|
+
attachments() {
|
|
927
|
+
try {
|
|
928
|
+
return this.handlers.attachments?.() ?? {
|
|
929
|
+
logs: !0,
|
|
930
|
+
askLogs: !1,
|
|
931
|
+
replay: !1
|
|
932
|
+
};
|
|
933
|
+
} catch {
|
|
934
|
+
return {
|
|
935
|
+
logs: !1,
|
|
936
|
+
askLogs: !1,
|
|
937
|
+
replay: !1
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
renderPrivacy() {
|
|
942
|
+
let e = this.attachments();
|
|
943
|
+
this.shown = e;
|
|
944
|
+
let t = H("div", { class: "privacy" });
|
|
945
|
+
if (e.askLogs) {
|
|
946
|
+
let e = `pnx-logs-${this.uid}`, n = H("input", {
|
|
947
|
+
id: e,
|
|
948
|
+
type: "checkbox",
|
|
949
|
+
"data-key": "include-logs"
|
|
950
|
+
});
|
|
951
|
+
n.checked = this.includeLogs, n.addEventListener("change", () => {
|
|
952
|
+
this.includeLogs = n.checked, this.updateNotice();
|
|
953
|
+
}), t.append(H("div", { class: "field check" }, n, H("label", { for: e }, "Include technical details (console messages and failed requests) to help fix this")));
|
|
954
|
+
}
|
|
955
|
+
this.noticeText = H("span", {});
|
|
956
|
+
let n = H("p", {
|
|
957
|
+
class: "notice",
|
|
958
|
+
id: `pnx-notice-${this.uid}`
|
|
959
|
+
}, this.noticeText), r = this.config.settings.privacyUrl;
|
|
960
|
+
return r && /^https:\/\//i.test(r) && n.append(" ", H("a", {
|
|
961
|
+
href: r,
|
|
962
|
+
target: "_blank",
|
|
963
|
+
rel: "noopener noreferrer"
|
|
964
|
+
}, "Privacy policy", H("span", { class: "sr" }, " (opens in a new tab)"))), t.append(n), this.privacy = t, this.updateNotice(), t;
|
|
965
|
+
}
|
|
966
|
+
updateNotice() {
|
|
967
|
+
if (!this.noticeText) return;
|
|
968
|
+
let e = this.shown, t = ["the page address", "your browser details"];
|
|
969
|
+
this.shot.kind === "ready" && t.push("the screenshot"), (e.logs || e.askLogs && this.includeLogs) && t.push("technical logs"), e.replay && t.push("a recording of the last 30 seconds");
|
|
970
|
+
let n = "";
|
|
971
|
+
try {
|
|
972
|
+
n = this.handlers.site?.() ?? "";
|
|
973
|
+
} catch {}
|
|
974
|
+
n = n || location.hostname.replace(/^www\./, "") || "this website", this.noticeText.textContent = `Sent to ${n} with your note: ${t.join(", ")}.`;
|
|
975
|
+
}
|
|
976
|
+
refresh() {
|
|
977
|
+
let e = this.privacy;
|
|
978
|
+
if (!e?.isConnected) return;
|
|
979
|
+
let t = this.attachments();
|
|
980
|
+
if (t.askLogs === this.shown.askLogs) {
|
|
981
|
+
this.shown = t, this.updateNotice();
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
let n = e.contains(this.root.activeElement), r = this.renderPrivacy();
|
|
985
|
+
e.replaceWith(r), n && (r.querySelector("input") ?? this.panel.querySelector("[data-key=\"send\"]"))?.focus();
|
|
986
|
+
}
|
|
987
|
+
renderAccessibility(e) {
|
|
988
|
+
let t = [this.header(this.kindTitle(e), this.kinds.length > 1)], n = `pnx-a11y-note-${this.uid}`;
|
|
989
|
+
t.push(H("p", {
|
|
990
|
+
class: "a11y-note",
|
|
991
|
+
id: n
|
|
992
|
+
}, "We'll pass this to the team that runs this website. We also check this page for common accessibility problems and send the results with it."));
|
|
993
|
+
let r = `pnx-barrier-${this.uid}`, i = H("fieldset", {
|
|
994
|
+
class: "field barriers",
|
|
995
|
+
"aria-labelledby": r,
|
|
996
|
+
"aria-describedby": n
|
|
997
|
+
}, H("legend", {
|
|
998
|
+
class: "legend",
|
|
999
|
+
id: r
|
|
1000
|
+
}, "What's getting in the way? ", H("span", { class: "optional" }, "(optional)")));
|
|
1001
|
+
X.forEach(([e, t], n) => {
|
|
1002
|
+
let r = `pnx-b${n}-${this.uid}`, a = H("input", {
|
|
1003
|
+
id: r,
|
|
1004
|
+
type: "radio",
|
|
1005
|
+
name: `pnx-barrier-${this.uid}`,
|
|
1006
|
+
value: e,
|
|
1007
|
+
"data-key": `barrier-${e}`,
|
|
1008
|
+
"data-autofocus": (this.barrier ? this.barrier === e : n === 0) || void 0
|
|
1009
|
+
});
|
|
1010
|
+
a.checked = this.barrier === e, a.addEventListener("change", () => {
|
|
1011
|
+
a.checked && (this.barrier = e);
|
|
1012
|
+
}), i.append(H("div", { class: "radio" }, a, H("label", { for: r }, t)));
|
|
1013
|
+
}), t.push(i);
|
|
1014
|
+
let a = `pnx-msg-${this.uid}`, o = H("textarea", {
|
|
1015
|
+
id: a,
|
|
1016
|
+
maxlength: 5e3,
|
|
1017
|
+
"data-key": "message",
|
|
1018
|
+
"aria-describedby": n,
|
|
1019
|
+
placeholder: this.word("messagePlaceholder", "For example: I couldn't reach the Pay button with the Tab key")
|
|
1020
|
+
});
|
|
1021
|
+
o.value = this.message, o.addEventListener("input", () => {
|
|
1022
|
+
this.message = o.value;
|
|
1023
|
+
}), t.push(H("div", { class: "field" }, H("label", { for: a }, "What were you trying to do, and what stopped you?"), o));
|
|
1024
|
+
let s = this.renderShot(e);
|
|
1025
|
+
return s && t.push(s), t.push(...this.renderEmailAndSend(e, o, "Only used to reply to you about this.")), t;
|
|
724
1026
|
}
|
|
725
1027
|
honeypot() {
|
|
726
|
-
let e =
|
|
1028
|
+
let e = H("input", {
|
|
727
1029
|
type: "text",
|
|
728
1030
|
name: "website",
|
|
729
1031
|
tabindex: -1,
|
|
@@ -733,14 +1035,14 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
733
1035
|
e.value = this.hp, e.addEventListener("input", () => {
|
|
734
1036
|
this.hp = e.value;
|
|
735
1037
|
});
|
|
736
|
-
let t =
|
|
1038
|
+
let t = H("div", { "aria-hidden": "true" }, e);
|
|
737
1039
|
return t.style.cssText = "position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden", t;
|
|
738
1040
|
}
|
|
739
1041
|
async send(e, t, n, r) {
|
|
740
1042
|
if (this.sending) return;
|
|
741
1043
|
t.textContent = "", n.removeAttribute("aria-invalid");
|
|
742
1044
|
let i = this.email.trim();
|
|
743
|
-
if (i && !
|
|
1045
|
+
if (i && !d(i)) {
|
|
744
1046
|
t.textContent = "Please check your email address, or leave it empty.", n.setAttribute("aria-invalid", "true"), n.setAttribute("aria-errormessage", t.id), n.focus();
|
|
745
1047
|
return;
|
|
746
1048
|
}
|
|
@@ -756,22 +1058,23 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
756
1058
|
return;
|
|
757
1059
|
}
|
|
758
1060
|
let a = this.shot.kind === "ready" ? this.shot.shot : void 0, o = e.type === "GENERAL" ? this.rating : void 0;
|
|
759
|
-
if (!
|
|
1061
|
+
if (!m({
|
|
760
1062
|
type: e.type,
|
|
761
1063
|
message: this.message,
|
|
762
1064
|
rating: o,
|
|
763
|
-
screenshot: a?.dataUrl
|
|
1065
|
+
screenshot: a?.dataUrl,
|
|
1066
|
+
barrier: e.type === "ACCESSIBILITY" ? this.barrier : void 0
|
|
764
1067
|
})) {
|
|
765
|
-
t.textContent = e.type === "GENERAL" && this.config.settings.rating !== !1 ? "Add a few words or a star rating." : "Add a few words so we know what you mean.", r.focus();
|
|
1068
|
+
t.textContent = e.type === "GENERAL" && this.config.settings.rating !== !1 ? "Add a few words or a star rating." : e.type === "ACCESSIBILITY" ? "Choose what's in the way, or add a few words." : "Add a few words so we know what you mean.", r.focus();
|
|
766
1069
|
return;
|
|
767
1070
|
}
|
|
768
1071
|
this.sending = !0, this.renderKeepingFocus(), this.announce("Sending…");
|
|
769
|
-
let
|
|
770
|
-
this.view !== "form" || this.kind !== e || !this.isOpen() ? (this.sending = !1, this.isOpen() && this.renderKeepingFocus()) :
|
|
1072
|
+
let s = await this.askFollowUp(e);
|
|
1073
|
+
this.view !== "form" || this.kind !== e || !this.isOpen() ? (this.sending = !1, this.isOpen() && this.renderKeepingFocus()) : s ? (this.sending = !1, this.view = "question", this.render(), this.focusFirst()) : await this.submitNow(e, i, o, a);
|
|
771
1074
|
}
|
|
772
1075
|
async askFollowUp(e) {
|
|
773
1076
|
let t = this.handlers.followUp, n = this.message.trim();
|
|
774
|
-
if (!t || e.type === "GENERAL" || !n || n.length > 140) return null;
|
|
1077
|
+
if (!t || e.type === "GENERAL" || e.type === "ACCESSIBILITY" || !n || n.length > 140) return null;
|
|
775
1078
|
if (this.asked?.message === n) return this.asked.question;
|
|
776
1079
|
let r = null;
|
|
777
1080
|
try {
|
|
@@ -799,6 +1102,12 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
799
1102
|
shot: r,
|
|
800
1103
|
followUp: i,
|
|
801
1104
|
fields: this.fieldAnswers(e),
|
|
1105
|
+
barrier: e.type === "ACCESSIBILITY" ? this.barrier : void 0,
|
|
1106
|
+
includeLogs: this.shown.askLogs && this.includeLogs ? !0 : void 0,
|
|
1107
|
+
listed: {
|
|
1108
|
+
logs: this.shown.logs || this.shown.askLogs && this.includeLogs,
|
|
1109
|
+
replay: this.shown.replay
|
|
1110
|
+
},
|
|
802
1111
|
hp: this.hp || void 0,
|
|
803
1112
|
elapsedMs: this.openedAt ? Math.max(0, Date.now() - this.openedAt) : void 0
|
|
804
1113
|
});
|
|
@@ -812,17 +1121,17 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
812
1121
|
this.view = "form", this.render();
|
|
813
1122
|
let e = this.panel.querySelector(".error");
|
|
814
1123
|
e && (e.textContent = a.message), this.panel.querySelector("[data-key=\"send\"]")?.focus();
|
|
815
|
-
} else this.queued = a.status === "queued", this.view = "done", this.render(), this.focusFirst(), this.announce(this.queued ? "Saved. We'll send it when you're back online." : this.word("confirmation",
|
|
1124
|
+
} else this.queued = a.status === "queued", this.view = "done", this.render(), this.focusFirst(), this.announce(this.queued ? "Saved. We'll send it when you're back online." : this.word("confirmation", $)), this.closeTimer = setTimeout(() => this.close(this.panel.contains(this.root.activeElement)), Z);
|
|
816
1125
|
}
|
|
817
1126
|
renderQuestion(e, t) {
|
|
818
1127
|
let n = [this.header("One quick question", !0, () => {
|
|
819
1128
|
this.view = "form", this.render(), this.panel.querySelector("[data-key=\"message\"]")?.focus();
|
|
820
|
-
})], r =
|
|
1129
|
+
})], r = H("div", { class: "note" }, H("span", {
|
|
821
1130
|
class: "dot",
|
|
822
1131
|
"aria-hidden": "true"
|
|
823
|
-
}),
|
|
1132
|
+
}), H("span", {}, H("span", { class: "sr" }, "Your note: "), `“${this.message.trim()}”`));
|
|
824
1133
|
r.style.setProperty("--dot", e.dot), n.push(r);
|
|
825
|
-
let i = `pnx-answer-${this.uid}`, a = `pnx-answer-hint-${this.uid}`, o =
|
|
1134
|
+
let i = `pnx-answer-${this.uid}`, a = `pnx-answer-hint-${this.uid}`, o = H("textarea", {
|
|
826
1135
|
id: i,
|
|
827
1136
|
class: "answer",
|
|
828
1137
|
maxlength: 2e3,
|
|
@@ -833,17 +1142,17 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
833
1142
|
});
|
|
834
1143
|
o.value = this.answer, o.addEventListener("input", () => {
|
|
835
1144
|
this.answer = o.value;
|
|
836
|
-
}), n.push(
|
|
1145
|
+
}), n.push(H("div", { class: "field" }, H("label", {
|
|
837
1146
|
for: i,
|
|
838
1147
|
class: "question"
|
|
839
|
-
}, t), o,
|
|
1148
|
+
}, t), o, H("span", {
|
|
840
1149
|
class: "hint",
|
|
841
1150
|
id: a
|
|
842
1151
|
}, "Optional. It helps us fix it faster.")));
|
|
843
|
-
let s =
|
|
1152
|
+
let s = H("p", {
|
|
844
1153
|
class: "error",
|
|
845
1154
|
role: "alert"
|
|
846
|
-
}), c = this.email.trim(), l = e.type === "GENERAL" ? this.rating : void 0, u = this.shot.kind === "ready" ? this.shot.shot : void 0, d =
|
|
1155
|
+
}), c = this.email.trim(), l = e.type === "GENERAL" ? this.rating : void 0, u = this.shot.kind === "ready" ? this.shot.shot : void 0, d = H("button", {
|
|
847
1156
|
type: "button",
|
|
848
1157
|
class: "send",
|
|
849
1158
|
"data-key": "send",
|
|
@@ -857,7 +1166,7 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
857
1166
|
answer: n.slice(0, 2e3)
|
|
858
1167
|
} : void 0);
|
|
859
1168
|
});
|
|
860
|
-
let f =
|
|
1169
|
+
let f = H("button", {
|
|
861
1170
|
type: "button",
|
|
862
1171
|
class: "link skip",
|
|
863
1172
|
"data-key": "skip",
|
|
@@ -869,10 +1178,12 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
869
1178
|
}
|
|
870
1179
|
colourSend(e, t) {
|
|
871
1180
|
let n = this.sendColour ?? t.send;
|
|
872
|
-
e.style.setProperty("--type", n), e.style.setProperty("--type-ink", this.sendColour ?
|
|
1181
|
+
e.style.setProperty("--type", n), e.style.setProperty("--type-ink", this.sendColour ? B(n) : t.ink);
|
|
873
1182
|
}
|
|
874
1183
|
fieldsFor(e) {
|
|
875
|
-
|
|
1184
|
+
if (e.key === "accessibility") return [];
|
|
1185
|
+
let t = e.key;
|
|
1186
|
+
return (this.config.settings.fields ?? []).filter((e) => e.types?.[t] !== !1);
|
|
876
1187
|
}
|
|
877
1188
|
fieldAnswers(e) {
|
|
878
1189
|
let t = [];
|
|
@@ -892,12 +1203,12 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
892
1203
|
return this.fieldsFor(e).map((e, t) => {
|
|
893
1204
|
let n = `pnx-f${t}-${this.uid}`, r = `field-${e.id}`, i = (e) => {
|
|
894
1205
|
e.removeAttribute("aria-invalid"), e.removeAttribute("aria-errormessage");
|
|
895
|
-
}, a = (t) =>
|
|
1206
|
+
}, a = (t) => H("label", {
|
|
896
1207
|
for: n,
|
|
897
1208
|
class: t
|
|
898
|
-
}, e.label, e.required ? null :
|
|
1209
|
+
}, e.label, e.required ? null : H("span", { class: "optional" }, " (optional)"));
|
|
899
1210
|
if (e.type === "checkbox") {
|
|
900
|
-
let t =
|
|
1211
|
+
let t = H("input", {
|
|
901
1212
|
id: n,
|
|
902
1213
|
type: "checkbox",
|
|
903
1214
|
"data-key": r,
|
|
@@ -905,19 +1216,19 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
905
1216
|
});
|
|
906
1217
|
return t.checked = this.answers[e.id] === !0, t.addEventListener("change", () => {
|
|
907
1218
|
this.answers[e.id] = t.checked, i(t);
|
|
908
|
-
}),
|
|
1219
|
+
}), H("div", { class: "field check" }, t, a());
|
|
909
1220
|
}
|
|
910
1221
|
if (e.type === "select") {
|
|
911
|
-
let t =
|
|
1222
|
+
let t = H("select", {
|
|
912
1223
|
id: n,
|
|
913
1224
|
"data-key": r,
|
|
914
1225
|
"aria-required": e.required ? "true" : void 0
|
|
915
|
-
},
|
|
1226
|
+
}, H("option", { value: "" }, "Choose…"), ...e.options.map((e) => H("option", { value: e }, e)));
|
|
916
1227
|
return t.value = String(this.answers[e.id] ?? ""), t.addEventListener("change", () => {
|
|
917
1228
|
this.answers[e.id] = t.value, i(t);
|
|
918
|
-
}),
|
|
1229
|
+
}), H("div", { class: "field" }, a(), t);
|
|
919
1230
|
}
|
|
920
|
-
let o =
|
|
1231
|
+
let o = H("input", {
|
|
921
1232
|
id: n,
|
|
922
1233
|
type: "text",
|
|
923
1234
|
maxlength: 200,
|
|
@@ -926,11 +1237,11 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
926
1237
|
});
|
|
927
1238
|
return o.value = String(this.answers[e.id] ?? ""), o.addEventListener("input", () => {
|
|
928
1239
|
this.answers[e.id] = o.value, i(o);
|
|
929
|
-
}),
|
|
1240
|
+
}), H("div", { class: "field" }, a(), o);
|
|
930
1241
|
});
|
|
931
1242
|
}
|
|
932
1243
|
renderDone() {
|
|
933
|
-
let e =
|
|
1244
|
+
let e = H("button", {
|
|
934
1245
|
type: "button",
|
|
935
1246
|
class: "link",
|
|
936
1247
|
"data-key": "again"
|
|
@@ -938,24 +1249,24 @@ ${B("@media (max-width: 520px) {", ".pnx")}
|
|
|
938
1249
|
e.addEventListener("click", () => {
|
|
939
1250
|
this.reset(), this.render(), this.focusFirst();
|
|
940
1251
|
});
|
|
941
|
-
let t =
|
|
942
|
-
t.append(
|
|
943
|
-
let n =
|
|
1252
|
+
let t = H("div", { class: "head" });
|
|
1253
|
+
t.append(H("span", { class: "title" }));
|
|
1254
|
+
let n = H("button", {
|
|
944
1255
|
type: "button",
|
|
945
1256
|
class: "icon-btn",
|
|
946
1257
|
"aria-label": "Close feedback"
|
|
947
1258
|
});
|
|
948
|
-
return n.append(
|
|
1259
|
+
return n.append(W(G.close)), n.addEventListener("click", () => this.close()), t.append(n), [t, H("div", { class: "done" }, H("span", {
|
|
949
1260
|
class: "tick",
|
|
950
1261
|
"aria-hidden": "true"
|
|
951
|
-
}, "✓"),
|
|
1262
|
+
}, "✓"), H("h2", {
|
|
952
1263
|
class: "title",
|
|
953
1264
|
id: `pnx-title-${this.uid}`,
|
|
954
1265
|
tabindex: -1,
|
|
955
1266
|
"data-autofocus": !0
|
|
956
|
-
}, this.queued ? "Saved for later" : this.word("confirmation",
|
|
1267
|
+
}, this.queued ? "Saved for later" : this.word("confirmation", $)), this.queued ? H("p", {}, "You're offline. We'll send it as soon as you're back.", this.email.trim() ? " If you leave this page first, it goes without your email address." : "") : null, e)];
|
|
957
1268
|
}
|
|
958
1269
|
};
|
|
959
|
-
export {
|
|
1270
|
+
export { N as a, o as c, g as d, F as i, b as l, q as n, L as o, H as r, k as s, te as t, v as u };
|
|
960
1271
|
|
|
961
|
-
//# sourceMappingURL=widget-
|
|
1272
|
+
//# sourceMappingURL=widget-BpTBdX2R.mjs.map
|