pollcatch 2.1.11 → 2.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pc.js +90 -70
package/package.json
CHANGED
package/pc.js
CHANGED
|
@@ -291,10 +291,10 @@ const Re = (e, t) => {
|
|
|
291
291
|
let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = Z;
|
|
292
292
|
for (let n = 0; n < o; n++) {
|
|
293
293
|
const l = e[n];
|
|
294
|
-
let u, c, p = -1,
|
|
295
|
-
for (;
|
|
296
|
-
const
|
|
297
|
-
i += a === Z ? l + Ne : p >= 0 ? (r.push(u), l.slice(0, p) + ne + l.slice(p) + P +
|
|
294
|
+
let u, c, p = -1, w = 0;
|
|
295
|
+
for (; w < l.length && (a.lastIndex = w, c = a.exec(l), c !== null); ) w = a.lastIndex, a === Z ? c[1] === "!--" ? a = Dt : c[1] !== void 0 ? a = Vt : c[2] !== void 0 ? (ce.test(c[2]) && (s = RegExp("</" + c[2], "g")), a = N) : c[3] !== void 0 && (a = N) : a === N ? c[0] === ">" ? (a = s ?? Z, p = -1) : c[1] === void 0 ? p = -2 : (p = a.lastIndex - c[2].length, u = c[1], a = c[3] === void 0 ? N : c[3] === '"' ? Ht : qt) : a === Ht || a === qt ? a = N : a === Dt || a === Vt ? a = Z : (a = N, s = void 0);
|
|
296
|
+
const v = a === N && e[n + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
i += a === Z ? l + Ne : p >= 0 ? (r.push(u), l.slice(0, p) + ne + l.slice(p) + P + v) : l + P + (p === -2 ? n : v);
|
|
298
298
|
}
|
|
299
299
|
return [de(e, i + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
300
300
|
};
|
|
@@ -311,15 +311,15 @@ let kt = class pe {
|
|
|
311
311
|
for (; (s = M.nextNode()) !== null && l.length < n; ) {
|
|
312
312
|
if (s.nodeType === 1) {
|
|
313
313
|
if (s.hasAttributes()) for (const p of s.getAttributeNames()) if (p.endsWith(ne)) {
|
|
314
|
-
const
|
|
315
|
-
l.push({ type: 1, index: i, name: E[2], strings:
|
|
314
|
+
const w = c[a++], v = s.getAttribute(p).split(P), E = /([.?@])?(.*)/.exec(w);
|
|
315
|
+
l.push({ type: 1, index: i, name: E[2], strings: v, ctor: E[1] === "." ? je : E[1] === "?" ? Be : E[1] === "@" ? De : ct }), s.removeAttribute(p);
|
|
316
316
|
} else p.startsWith(P) && (l.push({ type: 6, index: i }), s.removeAttribute(p));
|
|
317
317
|
if (ce.test(s.tagName)) {
|
|
318
|
-
const p = s.textContent.split(P),
|
|
319
|
-
if (
|
|
318
|
+
const p = s.textContent.split(P), w = p.length - 1;
|
|
319
|
+
if (w > 0) {
|
|
320
320
|
s.textContent = nt ? nt.emptyScript : "";
|
|
321
|
-
for (let
|
|
322
|
-
s.append(p[
|
|
321
|
+
for (let v = 0; v < w; v++) s.append(p[v], X()), M.nextNode(), l.push({ type: 2, index: ++i });
|
|
322
|
+
s.append(p[w], X());
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
} else if (s.nodeType === 8) if (s.data === le) l.push({ type: 2, index: i });
|
|
@@ -595,11 +595,11 @@ function f(e) {
|
|
|
595
595
|
function Ot(e) {
|
|
596
596
|
return f({ ...e, state: !0, attribute: !1 });
|
|
597
597
|
}
|
|
598
|
-
var
|
|
598
|
+
var $ = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))($ || {});
|
|
599
599
|
const Ye = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M640-160v-280h160v280H640Zm-240%200v-640h160v640H400Zm-240%200v-440h160v440H160Z'/%3e%3c/svg%3e", Ze = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M160-160v-440h160v440H160Zm240%200v-400l160%20160v240H400Zm160-354L400-674v-126h160v286Zm240%20240L640-434v-6h160v166Zm-9%20219L55-791l57-57%20736%20736-57%2057Z'/%3e%3c/svg%3e", Ge = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='currentColor'%3e%3cpath%20d='M200-200h57l391-391-57-57-391%20391v57Zm-80%2080v-170l528-527q12-11%2026.5-17t30.5-6q16%200%2031%206t26%2018l55%2056q12%2011%2017.5%2026t5.5%2030q0%2016-5.5%2030.5T817-647L290-120H120Zm640-584-56-56%2056%2056Zm-141%2085-28-29%2057%2057-29-28Z'/%3e%3c/svg%3e", Ke = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20fill='%23666666'%20class='bi%20bi-x'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M4.646%204.646a.5.5%200%200%201%20.708%200L8%207.293l2.646-2.647a.5.5%200%200%201%20.708.708L8.707%208l2.647%202.646a.5.5%200%200%201-.708.708L8%208.707l-2.646%202.647a.5.5%200%200%201-.708-.708L7.293%208%204.646%205.354a.5.5%200%200%201%200-.708'/%3e%3c/svg%3e";
|
|
600
600
|
var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
601
601
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
602
|
-
},
|
|
602
|
+
}, x = function(e, t, o) {
|
|
603
603
|
return t === void 0 && (t = 0), o === void 0 && (o = Math.pow(10, t)), Math.round(o * e) / o + 0;
|
|
604
604
|
}, S = function(e, t, o) {
|
|
605
605
|
return t === void 0 && (t = 0), o === void 0 && (o = 1), e > o ? o : e > t ? e : t;
|
|
@@ -608,7 +608,7 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
608
608
|
}, Yt = function(e) {
|
|
609
609
|
return { r: S(e.r, 0, 255), g: S(e.g, 0, 255), b: S(e.b, 0, 255), a: S(e.a) };
|
|
610
610
|
}, yt = function(e) {
|
|
611
|
-
return { r:
|
|
611
|
+
return { r: x(e.r), g: x(e.g), b: x(e.b), a: x(e.a, 3) };
|
|
612
612
|
}, Je = /^#([0-9a-f]{3,8})$/i, rt = function(e) {
|
|
613
613
|
var t = e.toString(16);
|
|
614
614
|
return t.length < 2 ? "0" + t : t;
|
|
@@ -623,7 +623,7 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
623
623
|
}, Zt = function(e) {
|
|
624
624
|
return { h: ue(e.h), s: S(e.s, 0, 100), l: S(e.l, 0, 100), a: S(e.a) };
|
|
625
625
|
}, Gt = function(e) {
|
|
626
|
-
return { h:
|
|
626
|
+
return { h: x(e.h), s: x(e.s), l: x(e.l), a: x(e.a, 3) };
|
|
627
627
|
}, Kt = function(e) {
|
|
628
628
|
return fe((o = (t = e).s, { h: t.h, s: (o *= ((r = t.l) < 50 ? r : 100 - r) / 100) > 0 ? 2 * o / (r + o) * 100 : 0, v: r + o, a: t.a }));
|
|
629
629
|
var t, o, r;
|
|
@@ -632,7 +632,7 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
632
632
|
var t, o, r, s;
|
|
633
633
|
}, Xe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Qe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, to = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, eo = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Wt = { string: [[function(e) {
|
|
634
634
|
var t = Je.exec(e);
|
|
635
|
-
return t ? (e = t[1]).length <= 4 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: e.length === 4 ?
|
|
635
|
+
return t ? (e = t[1]).length <= 4 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: e.length === 4 ? x(parseInt(e[3] + e[3], 16) / 255, 2) : 1 } : e.length === 6 || e.length === 8 ? { r: parseInt(e.substr(0, 2), 16), g: parseInt(e.substr(2, 2), 16), b: parseInt(e.substr(4, 2), 16), a: e.length === 8 ? x(parseInt(e.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
636
636
|
}, "hex"], [function(e) {
|
|
637
637
|
var t = to.exec(e) || eo.exec(e);
|
|
638
638
|
return t ? t[2] !== t[4] || t[4] !== t[6] ? null : Yt({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: t[7] === void 0 ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
|
|
@@ -679,13 +679,13 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
679
679
|
return e.prototype.isValid = function() {
|
|
680
680
|
return this.parsed !== null;
|
|
681
681
|
}, e.prototype.brightness = function() {
|
|
682
|
-
return
|
|
682
|
+
return x($t(this.rgba), 2);
|
|
683
683
|
}, e.prototype.isDark = function() {
|
|
684
684
|
return $t(this.rgba) < 0.5;
|
|
685
685
|
}, e.prototype.isLight = function() {
|
|
686
686
|
return $t(this.rgba) >= 0.5;
|
|
687
687
|
}, e.prototype.toHex = function() {
|
|
688
|
-
return t = yt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? rt(
|
|
688
|
+
return t = yt(this.rgba), o = t.r, r = t.g, s = t.b, a = (i = t.a) < 1 ? rt(x(255 * i)) : "", "#" + rt(o) + rt(r) + rt(s) + a;
|
|
689
689
|
var t, o, r, s, i, a;
|
|
690
690
|
}, e.prototype.toRgb = function() {
|
|
691
691
|
return yt(this.rgba);
|
|
@@ -698,7 +698,7 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
698
698
|
return t = Gt(J(this.rgba)), o = t.h, r = t.s, s = t.l, (i = t.a) < 1 ? "hsla(" + o + ", " + r + "%, " + s + "%, " + i + ")" : "hsl(" + o + ", " + r + "%, " + s + "%)";
|
|
699
699
|
var t, o, r, s, i;
|
|
700
700
|
}, e.prototype.toHsv = function() {
|
|
701
|
-
return t = he(this.rgba), { h:
|
|
701
|
+
return t = he(this.rgba), { h: x(t.h), s: x(t.s), v: x(t.v), a: x(t.a, 3) };
|
|
702
702
|
var t;
|
|
703
703
|
}, e.prototype.invert = function() {
|
|
704
704
|
return C({ r: 255 - (t = this.rgba).r, g: 255 - t.g, b: 255 - t.b, a: t.a });
|
|
@@ -716,11 +716,11 @@ var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
|
|
|
716
716
|
}, e.prototype.rotate = function(t) {
|
|
717
717
|
return t === void 0 && (t = 15), this.hue(this.hue() + t);
|
|
718
718
|
}, e.prototype.alpha = function(t) {
|
|
719
|
-
return typeof t == "number" ? C({ r: (o = this.rgba).r, g: o.g, b: o.b, a: t }) :
|
|
719
|
+
return typeof t == "number" ? C({ r: (o = this.rgba).r, g: o.g, b: o.b, a: t }) : x(this.rgba.a, 3);
|
|
720
720
|
var o;
|
|
721
721
|
}, e.prototype.hue = function(t) {
|
|
722
722
|
var o = J(this.rgba);
|
|
723
|
-
return typeof t == "number" ? C({ h: t, s: o.s, l: o.l, a: o.a }) :
|
|
723
|
+
return typeof t == "number" ? C({ h: t, s: o.s, l: o.l, a: o.a }) : x(o.h);
|
|
724
724
|
}, e.prototype.isEqual = function(t) {
|
|
725
725
|
return this.toHex() === C(t).toHex();
|
|
726
726
|
}, e;
|
|
@@ -797,8 +797,8 @@ function ao(e, t = {}) {
|
|
|
797
797
|
l = a, u = c;
|
|
798
798
|
for (const p of n) {
|
|
799
799
|
if (p === a) continue;
|
|
800
|
-
const
|
|
801
|
-
|
|
800
|
+
const w = St(e, p);
|
|
801
|
+
w > u && (u = w, l = p);
|
|
802
802
|
}
|
|
803
803
|
m.warn(
|
|
804
804
|
`No color option met the minimum contrast ratio of ${r}:1 against ${e}. Using ${l} with contrast ratio ${u.toFixed(2)}:1 instead.`
|
|
@@ -1137,15 +1137,15 @@ class _o {
|
|
|
1137
1137
|
const o = await this.getProjectId(), r = t.name, s = t.type;
|
|
1138
1138
|
let i;
|
|
1139
1139
|
if (t.dataFunc && typeof window < "u") {
|
|
1140
|
-
const
|
|
1141
|
-
let
|
|
1142
|
-
for (const E of
|
|
1143
|
-
if (
|
|
1144
|
-
i =
|
|
1140
|
+
const w = t.dataFunc.replace(/^window\./, "").split(".");
|
|
1141
|
+
let v = window;
|
|
1142
|
+
for (const E of w)
|
|
1143
|
+
if (v = v == null ? void 0 : v[E], v === void 0) break;
|
|
1144
|
+
i = v;
|
|
1145
1145
|
}
|
|
1146
1146
|
let a, n;
|
|
1147
1147
|
if (i && typeof i == "function") {
|
|
1148
|
-
const p =
|
|
1148
|
+
const p = this.getOptionsForDataFunc(t);
|
|
1149
1149
|
if (m.debug(`Using data function for: ${r}`, {
|
|
1150
1150
|
dataFuncName: t.dataFunc,
|
|
1151
1151
|
projectKey: o,
|
|
@@ -1160,12 +1160,12 @@ class _o {
|
|
|
1160
1160
|
const p = t.dataEndpoint || ee;
|
|
1161
1161
|
if (!r)
|
|
1162
1162
|
throw new Error("Name parameter is required");
|
|
1163
|
-
const
|
|
1163
|
+
const w = `${p}/${encodeURIComponent(o)}/${encodeURIComponent(r)}`;
|
|
1164
1164
|
m.debug(`Fetching stats for: ${r}`, { endpoint: p, projectKey: o });
|
|
1165
|
-
const
|
|
1166
|
-
if (!
|
|
1167
|
-
throw new Error(`API request failed with status: ${
|
|
1168
|
-
if (a = await
|
|
1165
|
+
const v = await fetch(w);
|
|
1166
|
+
if (!v.ok)
|
|
1167
|
+
throw new Error(`API request failed with status: ${v.status}`);
|
|
1168
|
+
if (a = await v.json(), !a.success)
|
|
1169
1169
|
throw m.error("Backend returned unsuccessful response", a), new Error("Backend returned unsuccessful response");
|
|
1170
1170
|
n = a.data || {};
|
|
1171
1171
|
}
|
|
@@ -1174,7 +1174,7 @@ class _o {
|
|
|
1174
1174
|
sum: n.sum,
|
|
1175
1175
|
avg: l,
|
|
1176
1176
|
pct: u,
|
|
1177
|
-
nps: s ===
|
|
1177
|
+
nps: s === $.nps ? lt((n == null ? void 0 : n.breakdown) || {}) : 0,
|
|
1178
1178
|
breakdown: n.breakdown ?? {},
|
|
1179
1179
|
updated: n.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1180
1180
|
};
|
|
@@ -1185,6 +1185,26 @@ class _o {
|
|
|
1185
1185
|
this.isLoading = !1, this.host.requestUpdate();
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Gets the options array for the data function based on widget type.
|
|
1190
|
+
* - For poll/reaction: uses the options from pcBase.options
|
|
1191
|
+
* - For stars: generates ['1', '2', ..., numStars]
|
|
1192
|
+
* - For NPS: generates ['0', '1', '2', ..., '10']
|
|
1193
|
+
*/
|
|
1194
|
+
getOptionsForDataFunc(t) {
|
|
1195
|
+
switch (t.type) {
|
|
1196
|
+
case $.stars: {
|
|
1197
|
+
const r = t.numStars || 5;
|
|
1198
|
+
return Array.from({ length: r }, (s, i) => String(i + 1));
|
|
1199
|
+
}
|
|
1200
|
+
case $.nps:
|
|
1201
|
+
return Array.from({ length: 11 }, (r, s) => String(s));
|
|
1202
|
+
case $.poll:
|
|
1203
|
+
case $.reaction:
|
|
1204
|
+
default:
|
|
1205
|
+
return t.options.map((r) => r.value);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1188
1208
|
/**
|
|
1189
1209
|
* Loads the local stats from localStorage
|
|
1190
1210
|
*/
|
|
@@ -1220,7 +1240,7 @@ class _o {
|
|
|
1220
1240
|
updateStats(t, o) {
|
|
1221
1241
|
const r = this.host;
|
|
1222
1242
|
if (this.stats && (this.stats = $o(this.stats, this.localStats)), this.localStats = {
|
|
1223
|
-
count: t > 0 || r.type ===
|
|
1243
|
+
count: t > 0 || r.type === $.nps ? 1 : 0,
|
|
1224
1244
|
// always 1 or 0
|
|
1225
1245
|
sum: t,
|
|
1226
1246
|
// e.g. number of stars, nps value
|
|
@@ -1306,7 +1326,7 @@ class _o {
|
|
|
1306
1326
|
sum: (o == null ? void 0 : o.sum) || 0,
|
|
1307
1327
|
avg: (o == null ? void 0 : o.avg) || 0,
|
|
1308
1328
|
pct: (o == null ? void 0 : o.pct) || 0,
|
|
1309
|
-
nps: r.type ===
|
|
1329
|
+
nps: r.type === $.nps ? lt((o == null ? void 0 : o.breakdown) || {}) : 0
|
|
1310
1330
|
};
|
|
1311
1331
|
return m.debug("Stats data: ", this.stats), Co(t, s);
|
|
1312
1332
|
}
|
|
@@ -1334,7 +1354,7 @@ class _o {
|
|
|
1334
1354
|
toggleValueSelected(t, o) {
|
|
1335
1355
|
const r = Object.keys(this.localStats.breakdown || {}), s = r.includes(t), i = this.host;
|
|
1336
1356
|
let a = 1;
|
|
1337
|
-
if ((i.type ===
|
|
1357
|
+
if ((i.type === $.stars || i.type === $.nps) && (a = parseInt(t)), s)
|
|
1338
1358
|
if (o) {
|
|
1339
1359
|
const l = r.filter((u) => u !== t);
|
|
1340
1360
|
this.updateStats(l.length > 0 ? 1 : 0, l);
|
|
@@ -1532,7 +1552,7 @@ let xe = class {
|
|
|
1532
1552
|
* Copyright 2018 Google LLC
|
|
1533
1553
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1534
1554
|
*/
|
|
1535
|
-
const
|
|
1555
|
+
const y = $e(class extends xe {
|
|
1536
1556
|
constructor(e) {
|
|
1537
1557
|
var t;
|
|
1538
1558
|
if (super(e), e.type !== we.ATTRIBUTE || e.name !== "class" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
@@ -1735,7 +1755,7 @@ const st = {
|
|
|
1735
1755
|
"pc-status": !0,
|
|
1736
1756
|
[`pc-flex-content-${k(this.statsPosition, this.statsAlign)}`]: !0
|
|
1737
1757
|
};
|
|
1738
|
-
return d`<div class="${
|
|
1758
|
+
return d`<div class="${y(o)}" data-testid="pc-status">
|
|
1739
1759
|
${this.renderStatsText()} ${this.renderChartToggle()} ${this.renderEditToggleIcon()}
|
|
1740
1760
|
</div>`;
|
|
1741
1761
|
}
|
|
@@ -2623,7 +2643,7 @@ var Io = Object.defineProperty, No = Object.getOwnPropertyDescriptor, Y = (e, t,
|
|
|
2623
2643
|
};
|
|
2624
2644
|
let I = class extends b {
|
|
2625
2645
|
constructor() {
|
|
2626
|
-
super(), this.min = 0, this.max = 10, this.type =
|
|
2646
|
+
super(), this.min = 0, this.max = 10, this.type = $.nps, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.minMaxPosition = "top", this.hoverValue = -1, this.handleNumberLeave = () => {
|
|
2627
2647
|
this.hoverValue = -1;
|
|
2628
2648
|
}, this.handleKeyDown = (e) => {
|
|
2629
2649
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.hoverValue >= 0 && this.handleNumberClick(this.hoverValue));
|
|
@@ -2646,7 +2666,7 @@ let I = class extends b {
|
|
|
2646
2666
|
<button
|
|
2647
2667
|
data-testid="nps-button-${s}"
|
|
2648
2668
|
?disabled=${!this.displayController.allowEdit()}
|
|
2649
|
-
class=${
|
|
2669
|
+
class=${y(a)}
|
|
2650
2670
|
@click="${() => this.handleNumberClick(s)}"
|
|
2651
2671
|
@mouseenter="${() => this.handleNumberHover(s)}"
|
|
2652
2672
|
@focus="${() => this.handleNumberHover(s)}"
|
|
@@ -2739,9 +2759,9 @@ let I = class extends b {
|
|
|
2739
2759
|
[`pc-flex-align-${k(this.statsPosition, this.statsAlign)}`]: !0
|
|
2740
2760
|
};
|
|
2741
2761
|
return d`
|
|
2742
|
-
<div class="pc-container ${
|
|
2762
|
+
<div class="pc-container ${y(e)}" data-testid="nps-container">
|
|
2743
2763
|
${this.renderLabelAtStart()}
|
|
2744
|
-
<div class="pc-body ${
|
|
2764
|
+
<div class="pc-body ${y(t)}" data-testid="nps-body">
|
|
2745
2765
|
${this.renderStatusAtStart()} ${this.renderContent()} ${this.renderStatusAtEnd()}
|
|
2746
2766
|
</div>
|
|
2747
2767
|
${this.renderLabelAtEnd()}
|
|
@@ -3032,14 +3052,14 @@ var Lo = Object.defineProperty, Ro = Object.getOwnPropertyDescriptor, Nt = (e, t
|
|
|
3032
3052
|
};
|
|
3033
3053
|
let tt = class extends b {
|
|
3034
3054
|
constructor() {
|
|
3035
|
-
super(), this.type =
|
|
3055
|
+
super(), this.type = $.poll, this.multiple = !1, this.compact = !1, this.hasEditButton = !0, this.statsText = "{count} votes", this.questionPosition = "top", this.statsPosition = "bottom", this.showStats = "after-vote";
|
|
3036
3056
|
}
|
|
3037
3057
|
renderStatus() {
|
|
3038
3058
|
const t = {
|
|
3039
3059
|
"pc-status": !0,
|
|
3040
3060
|
[`pc-flex-content-${k("bottom", this.statsAlign)}`]: !0
|
|
3041
3061
|
};
|
|
3042
|
-
return d`<div class="${
|
|
3062
|
+
return d`<div class="${y(t)}" data-testid="pc-status">
|
|
3043
3063
|
<span>${this.renderStatsText()} ${this.renderEditToggleIcon("stats-edit-button")}</span>
|
|
3044
3064
|
</div>`;
|
|
3045
3065
|
}
|
|
@@ -3054,7 +3074,7 @@ let tt = class extends b {
|
|
|
3054
3074
|
}, t = this.displayController.shouldDisableSubmitButton();
|
|
3055
3075
|
return d`
|
|
3056
3076
|
<button
|
|
3057
|
-
class="${
|
|
3077
|
+
class="${y(e)}"
|
|
3058
3078
|
data-testid="pc-submit-button"
|
|
3059
3079
|
@click="${this.handleSubmit}"
|
|
3060
3080
|
?disabled="${t}"
|
|
@@ -3135,7 +3155,7 @@ let tt = class extends b {
|
|
|
3135
3155
|
return d`
|
|
3136
3156
|
<button
|
|
3137
3157
|
data-testid="poll-option-i${t}"
|
|
3138
|
-
class="${
|
|
3158
|
+
class="${y(s)}"
|
|
3139
3159
|
@click="${() => this.handleClick(e)}"
|
|
3140
3160
|
?disabled="${r}"
|
|
3141
3161
|
id="${a}-option-${t}"
|
|
@@ -3162,7 +3182,7 @@ let tt = class extends b {
|
|
|
3162
3182
|
});
|
|
3163
3183
|
return d`
|
|
3164
3184
|
<div
|
|
3165
|
-
class="${
|
|
3185
|
+
class="${y({
|
|
3166
3186
|
"poll-container": !0
|
|
3167
3187
|
})}"
|
|
3168
3188
|
data-testid="poll-option-container"
|
|
@@ -3179,12 +3199,12 @@ let tt = class extends b {
|
|
|
3179
3199
|
renderBarChart() {
|
|
3180
3200
|
var l, u;
|
|
3181
3201
|
const e = ((l = this.dataController.stats) == null ? void 0 : l.breakdown) || {}, t = ((u = this.dataController.localStats) == null ? void 0 : u.breakdown) || {}, o = Object.values(e).reduce((c, p) => c + p, 0), r = this.options.map((c, p) => {
|
|
3182
|
-
const
|
|
3202
|
+
const w = e[c.value] || 0, v = o > 0 ? Math.round(w / o * 100) : 0, E = (t[c.value] || 0) > 0;
|
|
3183
3203
|
return {
|
|
3184
3204
|
option: c,
|
|
3185
3205
|
index: p,
|
|
3186
|
-
voteCount:
|
|
3187
|
-
percentage:
|
|
3206
|
+
voteCount: w,
|
|
3207
|
+
percentage: v,
|
|
3188
3208
|
isSelected: E
|
|
3189
3209
|
};
|
|
3190
3210
|
}), s = this.multiple ? _.GROUP : _.RADIOGROUP, i = this.question || this.name || "Options", a = B({
|
|
@@ -3193,7 +3213,7 @@ let tt = class extends b {
|
|
|
3193
3213
|
});
|
|
3194
3214
|
return d`
|
|
3195
3215
|
<div
|
|
3196
|
-
class="${
|
|
3216
|
+
class="${y({
|
|
3197
3217
|
"poll-container": !0
|
|
3198
3218
|
})}"
|
|
3199
3219
|
data-testid="poll-chart-container"
|
|
@@ -3209,7 +3229,7 @@ let tt = class extends b {
|
|
|
3209
3229
|
};
|
|
3210
3230
|
return d`
|
|
3211
3231
|
<div
|
|
3212
|
-
class="${
|
|
3232
|
+
class="${y(p)}"
|
|
3213
3233
|
data-testid="poll-chart-item-${c.index}"
|
|
3214
3234
|
role="listitem"
|
|
3215
3235
|
aria-label="${c.option.label}: ${c.percentage}% (${c.voteCount} votes)"
|
|
@@ -3280,12 +3300,12 @@ let tt = class extends b {
|
|
|
3280
3300
|
});
|
|
3281
3301
|
return d`
|
|
3282
3302
|
<div
|
|
3283
|
-
class="pc-container ${
|
|
3303
|
+
class="pc-container ${y(t)}"
|
|
3284
3304
|
data-testid="poll-container"
|
|
3285
3305
|
...=${s}
|
|
3286
3306
|
>
|
|
3287
3307
|
${this.renderLabelAtStart()}
|
|
3288
|
-
<div class="${
|
|
3308
|
+
<div class="${y(r)}" data-testid="poll-body">
|
|
3289
3309
|
${this.renderContent()} ${this.renderFooter()}
|
|
3290
3310
|
</div>
|
|
3291
3311
|
${this.renderLabelAtEnd()}
|
|
@@ -3418,7 +3438,7 @@ var Do = Object.defineProperty, Vo = Object.getOwnPropertyDescriptor, ut = (e, t
|
|
|
3418
3438
|
};
|
|
3419
3439
|
let V = class extends b {
|
|
3420
3440
|
constructor() {
|
|
3421
|
-
super(), this.type =
|
|
3441
|
+
super(), this.type = $.stars, this.numStars = 5, this.hoverValue = -1, this.handleStarKeyDown = (e) => {
|
|
3422
3442
|
if (e.key === "Enter" || e.key === " ") {
|
|
3423
3443
|
e.preventDefault();
|
|
3424
3444
|
const t = e.target, o = parseInt(t.dataset.star || "0");
|
|
@@ -3452,7 +3472,7 @@ let V = class extends b {
|
|
|
3452
3472
|
<div class="pc-section" data-testid="pc-section">
|
|
3453
3473
|
<span
|
|
3454
3474
|
data-testid="stars-view-star-${n}"
|
|
3455
|
-
class=${
|
|
3475
|
+
class=${y(c)}
|
|
3456
3476
|
style=${Bo(p)}
|
|
3457
3477
|
role="${r ? "button" : "presentation"}"
|
|
3458
3478
|
tabindex="${r ? "0" : ""}"
|
|
@@ -3502,9 +3522,9 @@ let V = class extends b {
|
|
|
3502
3522
|
[`pc-flex-align-${o}`]: !0
|
|
3503
3523
|
};
|
|
3504
3524
|
return d`
|
|
3505
|
-
<div class="pc-container ${
|
|
3525
|
+
<div class="pc-container ${y(t)}" data-testid="pc-container">
|
|
3506
3526
|
${this.renderLabelAtStart()}
|
|
3507
|
-
<div class="${
|
|
3527
|
+
<div class="${y(r)}" data-testid="stars-body">
|
|
3508
3528
|
${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderStars()}
|
|
3509
3529
|
${this.renderStatusAtEnd()}
|
|
3510
3530
|
</div>
|
|
@@ -3878,7 +3898,7 @@ var Fo = Object.defineProperty, Yo = Object.getOwnPropertyDescriptor, ht = (e, t
|
|
|
3878
3898
|
};
|
|
3879
3899
|
let q = class extends b {
|
|
3880
3900
|
constructor() {
|
|
3881
|
-
super(), this.type =
|
|
3901
|
+
super(), this.type = $.reaction, this.showCounts = !1, this.compact = !1, this.popupPosition = "auto", this.hasEditButton = !1, this.statsText = "{count} votes", this.buttonRadius = "990px", this.muteColor = "#cccccc", this.questionPosition = "top", this.statsPosition = "right", this.popupPosition = "auto";
|
|
3882
3902
|
}
|
|
3883
3903
|
/**
|
|
3884
3904
|
* Get the display count for a specific reaction including local optimistic updates
|
|
@@ -3927,7 +3947,7 @@ let q = class extends b {
|
|
|
3927
3947
|
}, n = `${e.tooltip || e.value} reaction${o ? ", selected" : ""}${t ? `, ${r} votes` : ""}`;
|
|
3928
3948
|
return d`
|
|
3929
3949
|
<button
|
|
3930
|
-
class="${
|
|
3950
|
+
class="${y(a)}"
|
|
3931
3951
|
@click="${() => this.handleReactionClick(e)}"
|
|
3932
3952
|
?disabled="${s}"
|
|
3933
3953
|
aria-pressed="${o}"
|
|
@@ -3969,7 +3989,7 @@ let q = class extends b {
|
|
|
3969
3989
|
bottom: this.popupPosition === "bottom" || this.popupPosition === "auto" && !this.shouldShowPopoverOnTop()
|
|
3970
3990
|
};
|
|
3971
3991
|
return d`
|
|
3972
|
-
<div class="${
|
|
3992
|
+
<div class="${y(e)}" role="menu">
|
|
3973
3993
|
<div class="popover-content">
|
|
3974
3994
|
${this.options.map((t) => {
|
|
3975
3995
|
const o = this.displayController.shouldDisableOption(t);
|
|
@@ -4016,7 +4036,7 @@ let q = class extends b {
|
|
|
4016
4036
|
(o) => this.dataController.isValueSelected(o.value)
|
|
4017
4037
|
);
|
|
4018
4038
|
return d`
|
|
4019
|
-
<div class="${
|
|
4039
|
+
<div class="${y(e)}">
|
|
4020
4040
|
${this.renderTriggerButton()}
|
|
4021
4041
|
${t.length > 0 ? d`
|
|
4022
4042
|
<div class="reaction-list">
|
|
@@ -4030,7 +4050,7 @@ let q = class extends b {
|
|
|
4030
4050
|
`;
|
|
4031
4051
|
} else
|
|
4032
4052
|
return d`
|
|
4033
|
-
<div class="${
|
|
4053
|
+
<div class="${y(e)}">
|
|
4034
4054
|
<div class="reaction-list">
|
|
4035
4055
|
${this.options.map((t) => this.renderReactionButton(t, this.showCounts))}
|
|
4036
4056
|
</div>
|
|
@@ -4074,9 +4094,9 @@ let q = class extends b {
|
|
|
4074
4094
|
[`pc-flex-align-${o}`]: !0
|
|
4075
4095
|
};
|
|
4076
4096
|
return d`
|
|
4077
|
-
<div class="${
|
|
4097
|
+
<div class="${y(t)}" data-testid="reaction-container">
|
|
4078
4098
|
${this.renderLabelAtStart()}
|
|
4079
|
-
<div class="${
|
|
4099
|
+
<div class="${y(r)}" data-testid="reaction-body">
|
|
4080
4100
|
${this.renderStatusAtStart()} ${this.renderChart()} ${this.renderReactions()}
|
|
4081
4101
|
${this.renderStatusAtEnd()}
|
|
4082
4102
|
</div>
|
|
@@ -4192,13 +4212,13 @@ let H = class extends j {
|
|
|
4192
4212
|
*/
|
|
4193
4213
|
render() {
|
|
4194
4214
|
switch (this.type) {
|
|
4195
|
-
case
|
|
4215
|
+
case $.nps:
|
|
4196
4216
|
return d`<pc-nps></pc-nps>`;
|
|
4197
|
-
case
|
|
4217
|
+
case $.poll:
|
|
4198
4218
|
return d`<pc-poll .options=${this.parsedOptions}></pc-poll>`;
|
|
4199
|
-
case
|
|
4219
|
+
case $.stars:
|
|
4200
4220
|
return d`<pc-stars></pc-stars>`;
|
|
4201
|
-
case
|
|
4221
|
+
case $.reaction:
|
|
4202
4222
|
return d`<pc-reaction .options=${this.parsedOptions}></pc-reaction>`;
|
|
4203
4223
|
default:
|
|
4204
4224
|
return console.warn(
|