pollcatch 1.0.5 → 1.0.7
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 +196 -253
package/package.json
CHANGED
package/pc.js
CHANGED
|
@@ -22,14 +22,14 @@ let de = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const Te = (e) => new de(typeof e == "string" ? e : e + "", void 0, At), B = (e, ...t) => {
|
|
26
26
|
const s = e.length === 1 ? e[0] : t.reduce((i, o, r) => i + ((a) => {
|
|
27
27
|
if (a._$cssResult$ === !0) return a.cssText;
|
|
28
28
|
if (typeof a == "number") return a;
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(o) + e[r + 1], e[0]);
|
|
31
31
|
return new de(s, e, At);
|
|
32
|
-
},
|
|
32
|
+
}, Oe = (e, t) => {
|
|
33
33
|
if (Et) e.adoptedStyleSheets = t.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
|
|
34
34
|
else for (const s of t) {
|
|
35
35
|
const i = document.createElement("style"), o = pt.litNonce;
|
|
@@ -38,14 +38,14 @@ const Oe = (e) => new de(typeof e == "string" ? e : e + "", void 0, At), B = (e,
|
|
|
38
38
|
}, Dt = Et ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let s = "";
|
|
40
40
|
for (const i of t.cssRules) s += i.cssText;
|
|
41
|
-
return
|
|
41
|
+
return Te(s);
|
|
42
42
|
})(e) : e;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: Me, defineProperty: ze, getOwnPropertyDescriptor: Ne, getOwnPropertyNames:
|
|
48
|
+
const { is: Me, defineProperty: ze, getOwnPropertyDescriptor: Ne, getOwnPropertyNames: Re, getOwnPropertySymbols: Ie, getPrototypeOf: Ue } = Object, D = globalThis, Vt = D.trustedTypes, Le = Vt ? Vt.emptyScript : "", gt = D.reactiveElementPolyfillSupport, st = (e, t) => e, ht = { toAttribute(e, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
51
|
e = e ? Le : null;
|
|
@@ -112,7 +112,7 @@ let J = class extends HTMLElement {
|
|
|
112
112
|
static finalize() {
|
|
113
113
|
if (this.hasOwnProperty(st("finalized"))) return;
|
|
114
114
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(st("properties"))) {
|
|
115
|
-
const s = this.properties, i = [...
|
|
115
|
+
const s = this.properties, i = [...Re(s), ...Ie(s)];
|
|
116
116
|
for (const o of i) this.createProperty(o, s[o]);
|
|
117
117
|
}
|
|
118
118
|
const t = this[Symbol.metadata];
|
|
@@ -161,7 +161,7 @@ let J = class extends HTMLElement {
|
|
|
161
161
|
}
|
|
162
162
|
createRenderRoot() {
|
|
163
163
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
-
return
|
|
164
|
+
return Oe(t, this.constructor.elementStyles), t;
|
|
165
165
|
}
|
|
166
166
|
connectedCallback() {
|
|
167
167
|
var t;
|
|
@@ -273,14 +273,14 @@ let J = class extends HTMLElement {
|
|
|
273
273
|
firstUpdated(t) {
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
J.elementStyles = [], J.shadowRootOptions = { mode: "open" }, J[st("elementProperties")] = /* @__PURE__ */ new Map(), J[st("finalized")] = /* @__PURE__ */ new Map(),
|
|
276
|
+
J.elementStyles = [], J.shadowRootOptions = { mode: "open" }, J[st("elementProperties")] = /* @__PURE__ */ new Map(), J[st("finalized")] = /* @__PURE__ */ new Map(), gt == null || gt({ ReactiveElement: J }), (D.reactiveElementVersions ?? (D.reactiveElementVersions = [])).push("2.0.4");
|
|
277
277
|
/**
|
|
278
278
|
* @license
|
|
279
279
|
* Copyright 2017 Google LLC
|
|
280
280
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
281
281
|
*/
|
|
282
|
-
const it = globalThis, ut = it.trustedTypes, Bt = ut ? ut.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, pe = "$lit$", j = `lit$${Math.random().toFixed(9).slice(2)}$`, he = "?" + j, je = `<${he}>`, W = document, rt = () => W.createComment(""), at = (e) => e === null || typeof e != "object" && typeof e != "function", Pt = Array.isArray, De = (e) => Pt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function",
|
|
283
|
-
\f\r]`, et = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Ft = /-->/g, qt = />/g, K = RegExp(`>|${
|
|
282
|
+
const it = globalThis, ut = it.trustedTypes, Bt = ut ? ut.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, pe = "$lit$", j = `lit$${Math.random().toFixed(9).slice(2)}$`, he = "?" + j, je = `<${he}>`, W = document, rt = () => W.createComment(""), at = (e) => e === null || typeof e != "object" && typeof e != "function", Pt = Array.isArray, De = (e) => Pt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", ft = `[
|
|
283
|
+
\f\r]`, et = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Ft = /-->/g, qt = />/g, K = RegExp(`>|${ft}(?:([^\\s"'>=/]+)(${ft}*=${ft}*(?:[^
|
|
284
284
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), Kt = /'/g, Yt = /"/g, ue = /^(?:script|style|textarea|title)$/i, Ve = (e) => (t, ...s) => ({ _$litType$: e, strings: t, values: s }), l = Ve(1), H = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), Gt = /* @__PURE__ */ new WeakMap(), Y = W.createTreeWalker(W, 129);
|
|
285
285
|
function me(e, t) {
|
|
286
286
|
if (!Pt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
@@ -902,7 +902,64 @@ const Je = B`
|
|
|
902
902
|
padding: 0.2em 0;
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
|
-
|
|
905
|
+
|
|
906
|
+
.thank-you-msg {
|
|
907
|
+
font-size: 0.8em;
|
|
908
|
+
color: var(--pc-text-color, #333);
|
|
909
|
+
background: white;
|
|
910
|
+
padding: 1em 1.5em;
|
|
911
|
+
border-radius: var(--pc-border-radius, 0.375em);
|
|
912
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
913
|
+
border: 1px solid var(--pc-mute-color, #ddd);
|
|
914
|
+
max-width: 300px;
|
|
915
|
+
font-style: normal;
|
|
916
|
+
white-space: normal;
|
|
917
|
+
word-wrap: break-word;
|
|
918
|
+
overflow-wrap: break-word;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/* Unified thank you overlay section and overlay */
|
|
922
|
+
.pc-thank-you-section-with-overlay {
|
|
923
|
+
position: relative;
|
|
924
|
+
}
|
|
925
|
+
.pc-thank-you-overlay {
|
|
926
|
+
position: absolute;
|
|
927
|
+
top: 0;
|
|
928
|
+
left: 0;
|
|
929
|
+
right: 0;
|
|
930
|
+
bottom: 0;
|
|
931
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
932
|
+
backdrop-filter: blur(2px);
|
|
933
|
+
display: flex;
|
|
934
|
+
align-items: center;
|
|
935
|
+
justify-content: center;
|
|
936
|
+
z-index: 10;
|
|
937
|
+
animation: fadeInOverlay 0.3s ease-out;
|
|
938
|
+
}
|
|
939
|
+
@keyframes fadeInOverlay {
|
|
940
|
+
from {
|
|
941
|
+
opacity: 0;
|
|
942
|
+
backdrop-filter: blur(0px);
|
|
943
|
+
}
|
|
944
|
+
to {
|
|
945
|
+
opacity: 1;
|
|
946
|
+
backdrop-filter: blur(2px);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
.pc-thank-you-overlay .thank-you-msg {
|
|
950
|
+
animation: slideInUp 0.4s ease-out;
|
|
951
|
+
}
|
|
952
|
+
@keyframes slideInUp {
|
|
953
|
+
from {
|
|
954
|
+
transform: translateY(20px);
|
|
955
|
+
opacity: 0;
|
|
956
|
+
}
|
|
957
|
+
to {
|
|
958
|
+
transform: translateY(0);
|
|
959
|
+
opacity: 1;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
`, ge = "https://jpxwfjorwcsrqraorpbj.supabase.co/functions/v1/data", Xe = "pc_session_id", Qe = 24 * 60 * 60 * 1e3;
|
|
906
963
|
function ts(e) {
|
|
907
964
|
return {
|
|
908
965
|
debug: (t, ...s) => {
|
|
@@ -916,27 +973,27 @@ function ts(e) {
|
|
|
916
973
|
}
|
|
917
974
|
};
|
|
918
975
|
}
|
|
919
|
-
const
|
|
976
|
+
const g = ts("Pollcatch");
|
|
920
977
|
function Wt() {
|
|
921
|
-
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (
|
|
978
|
+
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (g.warn("crypto.randomUUID not available, using fallback UUID generator"), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
922
979
|
const t = Math.random() * 16 | 0;
|
|
923
980
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
924
981
|
}));
|
|
925
982
|
}
|
|
926
|
-
function
|
|
983
|
+
function Tt() {
|
|
927
984
|
const e = "test-local-storage";
|
|
928
985
|
try {
|
|
929
986
|
return localStorage.setItem(e, e), localStorage.removeItem(e), !0;
|
|
930
987
|
} catch {
|
|
931
|
-
return
|
|
988
|
+
return g.warn("localStorage not available, session ID will not persist"), !1;
|
|
932
989
|
}
|
|
933
990
|
}
|
|
934
|
-
function
|
|
991
|
+
function fe(e) {
|
|
935
992
|
try {
|
|
936
993
|
const t = localStorage.getItem(e);
|
|
937
994
|
return t ? JSON.parse(t) : void 0;
|
|
938
995
|
} catch (t) {
|
|
939
|
-
|
|
996
|
+
g.warn(`Failed to get item from localStorage: ${e}`, t);
|
|
940
997
|
return;
|
|
941
998
|
}
|
|
942
999
|
}
|
|
@@ -944,29 +1001,29 @@ function ye(e, t) {
|
|
|
944
1001
|
try {
|
|
945
1002
|
return localStorage.setItem(e, JSON.stringify(t)), !0;
|
|
946
1003
|
} catch (s) {
|
|
947
|
-
return
|
|
1004
|
+
return g.warn(`Failed to set item in localStorage: ${e}`, s), !1;
|
|
948
1005
|
}
|
|
949
1006
|
}
|
|
950
1007
|
async function es() {
|
|
951
1008
|
if (typeof window < "u") {
|
|
952
1009
|
if (window.pcProject !== void 0)
|
|
953
|
-
return
|
|
1010
|
+
return g.debug("Found project key in global variable"), window.pcProject;
|
|
954
1011
|
const e = document.querySelectorAll("script[pc-project]");
|
|
955
1012
|
if (e.length > 0) {
|
|
956
1013
|
const t = e[e.length - 1], s = t == null ? void 0 : t.getAttribute("pc-project");
|
|
957
1014
|
if (s)
|
|
958
|
-
return
|
|
1015
|
+
return g.debug("Found project key in script tag attribute"), s;
|
|
959
1016
|
}
|
|
960
1017
|
}
|
|
961
|
-
|
|
1018
|
+
g.warn("No project key found in global variable or script tags");
|
|
962
1019
|
}
|
|
963
1020
|
async function Zt() {
|
|
964
1021
|
const e = Xe, t = Qe;
|
|
965
|
-
if (
|
|
966
|
-
const s =
|
|
1022
|
+
if (Tt()) {
|
|
1023
|
+
const s = fe(e);
|
|
967
1024
|
if (s && s.id && s.timestamp && Date.now() - s.timestamp < t)
|
|
968
|
-
return
|
|
969
|
-
|
|
1025
|
+
return g.debug("Using existing session ID from localStorage"), s.id;
|
|
1026
|
+
g.debug(
|
|
970
1027
|
s ? "Session ID expired" : "No session ID found",
|
|
971
1028
|
"generating new one"
|
|
972
1029
|
);
|
|
@@ -974,24 +1031,24 @@ async function Zt() {
|
|
|
974
1031
|
return ye(e, {
|
|
975
1032
|
id: i,
|
|
976
1033
|
timestamp: Date.now()
|
|
977
|
-
}) ?
|
|
1034
|
+
}) ? g.debug("Generated and stored new session ID") : g.warn("Generated session ID but failed to store it"), i;
|
|
978
1035
|
} else {
|
|
979
1036
|
const s = Wt();
|
|
980
|
-
return
|
|
1037
|
+
return g.debug("Generated non-persistent session ID"), s;
|
|
981
1038
|
}
|
|
982
1039
|
}
|
|
983
1040
|
async function ss(e, t) {
|
|
984
1041
|
try {
|
|
985
1042
|
if (!e)
|
|
986
1043
|
throw new Error("Name parameter is required");
|
|
987
|
-
const s = `${
|
|
988
|
-
|
|
1044
|
+
const s = `${ge}/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;
|
|
1045
|
+
g.debug(`Fetching stats for: ${e}`, { projectKey: t });
|
|
989
1046
|
const i = await fetch(s);
|
|
990
1047
|
if (!i.ok)
|
|
991
1048
|
throw new Error(`API request failed with status: ${i.status}`);
|
|
992
1049
|
const o = await i.json();
|
|
993
1050
|
if (!o.success)
|
|
994
|
-
throw
|
|
1051
|
+
throw g.error("Backend returned unsuccessful response", o), new Error("Backend returned unsuccessful response");
|
|
995
1052
|
const r = o.data || {}, a = r.count > 0 ? Math.round(r.sum / r.count) : 0, n = Math.round(r.sum / r.count * 100);
|
|
996
1053
|
return {
|
|
997
1054
|
count: r.count ?? 0,
|
|
@@ -1002,18 +1059,18 @@ async function ss(e, t) {
|
|
|
1002
1059
|
updated: r.updated_at || (/* @__PURE__ */ new Date()).toISOString()
|
|
1003
1060
|
};
|
|
1004
1061
|
} catch (s) {
|
|
1005
|
-
throw
|
|
1062
|
+
throw g.error("Error loading stats:", s), s;
|
|
1006
1063
|
}
|
|
1007
1064
|
}
|
|
1008
1065
|
async function is(e) {
|
|
1009
|
-
const t = JSON.stringify(e), s = `${
|
|
1066
|
+
const t = JSON.stringify(e), s = `${ge}`;
|
|
1010
1067
|
try {
|
|
1011
|
-
if (
|
|
1068
|
+
if (g.debug("Sending stats", e), typeof navigator < "u" && navigator.sendBeacon)
|
|
1012
1069
|
if (navigator.sendBeacon(s, t)) {
|
|
1013
|
-
|
|
1070
|
+
g.debug("Successfully sent stats via sendBeacon");
|
|
1014
1071
|
return;
|
|
1015
1072
|
} else
|
|
1016
|
-
|
|
1073
|
+
g.debug("sendBeacon failed, falling back to fetch");
|
|
1017
1074
|
const i = await fetch(s, {
|
|
1018
1075
|
body: t,
|
|
1019
1076
|
method: "POST",
|
|
@@ -1024,15 +1081,15 @@ async function is(e) {
|
|
|
1024
1081
|
});
|
|
1025
1082
|
if (!i.ok)
|
|
1026
1083
|
throw new Error(`API request failed with status: ${i.status}`);
|
|
1027
|
-
|
|
1084
|
+
g.debug("Successfully sent stats via fetch");
|
|
1028
1085
|
} catch (i) {
|
|
1029
|
-
throw
|
|
1086
|
+
throw g.error("Failed to send analytics:", i), i;
|
|
1030
1087
|
}
|
|
1031
1088
|
}
|
|
1032
1089
|
function ve(e) {
|
|
1033
1090
|
return !e || typeof e != "string" ? !1 : /^[\p{Emoji}]$/u.test(e) ? !0 : new RegExp("^\\p{Emoji}(\\p{Emoji_Modifier}|\\u200D\\p{Emoji})*$", "u").test(e);
|
|
1034
1091
|
}
|
|
1035
|
-
function
|
|
1092
|
+
function Ot(e) {
|
|
1036
1093
|
if (!e || typeof e != "string")
|
|
1037
1094
|
return !1;
|
|
1038
1095
|
const t = e.trim();
|
|
@@ -1073,7 +1130,7 @@ function as(e, t) {
|
|
|
1073
1130
|
s ^= i.charCodeAt(o), s += (s << 1) + (s << 4) + (s << 7) + (s << 8) + (s << 24);
|
|
1074
1131
|
return (s >>> 0).toString(16).padStart(8, "0");
|
|
1075
1132
|
}
|
|
1076
|
-
var ns = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
1133
|
+
var ns = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, R = function(e) {
|
|
1077
1134
|
return typeof e == "string" ? e.length > 0 : typeof e == "number";
|
|
1078
1135
|
}, x = function(e, t, s) {
|
|
1079
1136
|
return t === void 0 && (t = 0), s === void 0 && (s = Math.pow(10, t)), Math.round(s * e) / s + 0;
|
|
@@ -1119,15 +1176,15 @@ var ns = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, I = function(e) {
|
|
|
1119
1176
|
return te(o);
|
|
1120
1177
|
}, "hsl"]], object: [[function(e) {
|
|
1121
1178
|
var t = e.r, s = e.g, i = e.b, o = e.a, r = o === void 0 ? 1 : o;
|
|
1122
|
-
return
|
|
1179
|
+
return R(t) && R(s) && R(i) ? Jt({ r: Number(t), g: Number(s), b: Number(i), a: Number(r) }) : null;
|
|
1123
1180
|
}, "rgb"], [function(e) {
|
|
1124
1181
|
var t = e.h, s = e.s, i = e.l, o = e.a, r = o === void 0 ? 1 : o;
|
|
1125
|
-
if (!
|
|
1182
|
+
if (!R(t) || !R(s) || !R(i)) return null;
|
|
1126
1183
|
var a = Xt({ h: Number(t), s: Number(s), l: Number(i), a: Number(r) });
|
|
1127
1184
|
return te(a);
|
|
1128
1185
|
}, "hsl"], [function(e) {
|
|
1129
1186
|
var t = e.h, s = e.s, i = e.v, o = e.a, r = o === void 0 ? 1 : o;
|
|
1130
|
-
if (!
|
|
1187
|
+
if (!R(t) || !R(s) || !R(i)) return null;
|
|
1131
1188
|
var a = function(n) {
|
|
1132
1189
|
return { h: xe(n.h), s: k(n.s, 0, 100), v: k(n.v, 0, 100), a: k(n.a) };
|
|
1133
1190
|
}({ h: Number(t), s: Number(s), v: Number(i), a: Number(r) });
|
|
@@ -1229,7 +1286,7 @@ function St(e, t) {
|
|
|
1229
1286
|
return (o + 0.05) / (r + 0.05);
|
|
1230
1287
|
}
|
|
1231
1288
|
function re(e) {
|
|
1232
|
-
const t =
|
|
1289
|
+
const t = gs(e), s = t.r / 255, i = t.g / 255, o = t.b / 255, r = s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4), a = i <= 0.03928 ? i / 12.92 : Math.pow((i + 0.055) / 1.055, 2.4), n = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
|
|
1233
1290
|
return 0.2126 * r + 0.7152 * a + 0.0722 * n;
|
|
1234
1291
|
}
|
|
1235
1292
|
function ae(e, t = {}) {
|
|
@@ -1263,17 +1320,17 @@ function ae(e, t = {}) {
|
|
|
1263
1320
|
}
|
|
1264
1321
|
return c;
|
|
1265
1322
|
}
|
|
1266
|
-
function
|
|
1323
|
+
function gs(e) {
|
|
1267
1324
|
const s = bs(e) || e, i = _(s);
|
|
1268
1325
|
if (!i.isValid())
|
|
1269
1326
|
return console.warn(`Invalid color provided: ${e}`), { r: 0, g: 0, b: 0 };
|
|
1270
1327
|
const { r: o, g: r, b: a } = i.toRgb();
|
|
1271
1328
|
return { r: o, g: r, b: a };
|
|
1272
1329
|
}
|
|
1273
|
-
function
|
|
1330
|
+
function I(e, t) {
|
|
1274
1331
|
return e === "left" || e === "right" ? t || "center" : e === "top" || e === "bottom" ? t || "start" : t || "center";
|
|
1275
1332
|
}
|
|
1276
|
-
function
|
|
1333
|
+
function fs(e, t = "1rem") {
|
|
1277
1334
|
if (!e) return t;
|
|
1278
1335
|
const s = {
|
|
1279
1336
|
xs: "0.75rem",
|
|
@@ -1323,22 +1380,22 @@ function G() {
|
|
|
1323
1380
|
};
|
|
1324
1381
|
}
|
|
1325
1382
|
function vs(e) {
|
|
1326
|
-
if (!
|
|
1383
|
+
if (!Tt())
|
|
1327
1384
|
return G();
|
|
1328
1385
|
try {
|
|
1329
|
-
const t =
|
|
1386
|
+
const t = fe(e);
|
|
1330
1387
|
return t ? { ...G(), ...t } : G();
|
|
1331
1388
|
} catch (t) {
|
|
1332
|
-
return
|
|
1389
|
+
return g.warn("Failed to load localStats from localStorage", t), G();
|
|
1333
1390
|
}
|
|
1334
1391
|
}
|
|
1335
1392
|
function xs(e, t) {
|
|
1336
|
-
if (!
|
|
1393
|
+
if (!Tt())
|
|
1337
1394
|
return !1;
|
|
1338
1395
|
try {
|
|
1339
|
-
return ye(e, t) ? (
|
|
1396
|
+
return ye(e, t) ? (g.debug("Saved localStats to localStorage", t), !0) : !1;
|
|
1340
1397
|
} catch (s) {
|
|
1341
|
-
return
|
|
1398
|
+
return g.warn("Failed to save localStats to localStorage", s), !1;
|
|
1342
1399
|
}
|
|
1343
1400
|
}
|
|
1344
1401
|
function $s(e, t) {
|
|
@@ -1390,7 +1447,7 @@ function Ss(e) {
|
|
|
1390
1447
|
const o = t / i * 100, r = s / i * 100;
|
|
1391
1448
|
return Math.round(o - r);
|
|
1392
1449
|
}
|
|
1393
|
-
var ks = Object.defineProperty,
|
|
1450
|
+
var ks = Object.defineProperty, f = (e, t, s, i) => {
|
|
1394
1451
|
for (var o = void 0, r = e.length - 1, a; r >= 0; r--)
|
|
1395
1452
|
(a = e[r]) && (o = a(t, s, o) || o);
|
|
1396
1453
|
return o && ks(t, s, o), o;
|
|
@@ -1419,9 +1476,9 @@ const Lt = class Lt extends V {
|
|
|
1419
1476
|
async loadLocalStatsFromStorage() {
|
|
1420
1477
|
try {
|
|
1421
1478
|
const t = await this.getLocalStatsKey();
|
|
1422
|
-
this.localStats = vs(t),
|
|
1479
|
+
this.localStats = vs(t), g.debug("Loaded localStats from localStorage", this.localStats);
|
|
1423
1480
|
} catch (t) {
|
|
1424
|
-
|
|
1481
|
+
g.warn("Failed to generate localStorage key for localStats", t), this.localStats = G();
|
|
1425
1482
|
}
|
|
1426
1483
|
}
|
|
1427
1484
|
/**
|
|
@@ -1430,9 +1487,9 @@ const Lt = class Lt extends V {
|
|
|
1430
1487
|
async saveLocalStatsToStorage() {
|
|
1431
1488
|
try {
|
|
1432
1489
|
const t = await this.getLocalStatsKey();
|
|
1433
|
-
xs(t, this.localStats) ||
|
|
1490
|
+
xs(t, this.localStats) || g.warn("Failed to save localStats to localStorage");
|
|
1434
1491
|
} catch (t) {
|
|
1435
|
-
|
|
1492
|
+
g.warn("Failed to save localStats to localStorage", t);
|
|
1436
1493
|
}
|
|
1437
1494
|
}
|
|
1438
1495
|
/**
|
|
@@ -1471,7 +1528,7 @@ const Lt = class Lt extends V {
|
|
|
1471
1528
|
try {
|
|
1472
1529
|
is({ ...n, hash: c });
|
|
1473
1530
|
} catch (h) {
|
|
1474
|
-
|
|
1531
|
+
g.warn("Failed to send stats event", h);
|
|
1475
1532
|
}
|
|
1476
1533
|
return n;
|
|
1477
1534
|
}
|
|
@@ -1522,7 +1579,7 @@ const Lt = class Lt extends V {
|
|
|
1522
1579
|
}
|
|
1523
1580
|
if (this.textColor && (s += `--pc-text-color: ${this.textColor} !important;
|
|
1524
1581
|
`), this.size) {
|
|
1525
|
-
const i =
|
|
1582
|
+
const i = fs(this.size);
|
|
1526
1583
|
s += `font-size: ${i} !important;
|
|
1527
1584
|
`;
|
|
1528
1585
|
}
|
|
@@ -1539,7 +1596,7 @@ const Lt = class Lt extends V {
|
|
|
1539
1596
|
const t = await this.getProjectKey();
|
|
1540
1597
|
this.stats = await ss(this.name, t);
|
|
1541
1598
|
} catch (t) {
|
|
1542
|
-
|
|
1599
|
+
g.debug("Error loading stats", t), this.stats = void 0;
|
|
1543
1600
|
} finally {
|
|
1544
1601
|
this.statsIsLoading = !1;
|
|
1545
1602
|
}
|
|
@@ -1554,7 +1611,7 @@ const Lt = class Lt extends V {
|
|
|
1554
1611
|
const i = await this.submitStats(t, s);
|
|
1555
1612
|
this.dispatchEvent(new CustomEvent("change", { detail: i }));
|
|
1556
1613
|
} else
|
|
1557
|
-
|
|
1614
|
+
g.warn("Widget name is not set, skipping data submission.");
|
|
1558
1615
|
}
|
|
1559
1616
|
// Common rendering for label
|
|
1560
1617
|
renderLabel() {
|
|
@@ -1574,79 +1631,79 @@ const Lt = class Lt extends V {
|
|
|
1574
1631
|
};
|
|
1575
1632
|
Lt.styles = [Je];
|
|
1576
1633
|
let u = Lt;
|
|
1577
|
-
|
|
1634
|
+
f([
|
|
1578
1635
|
p({ type: Boolean, reflect: !0 })
|
|
1579
1636
|
], u.prototype, "readonly");
|
|
1580
|
-
|
|
1637
|
+
f([
|
|
1581
1638
|
p({ type: String, attribute: "project" })
|
|
1582
1639
|
], u.prototype, "projectKey");
|
|
1583
|
-
|
|
1640
|
+
f([
|
|
1584
1641
|
p({ type: String })
|
|
1585
1642
|
], u.prototype, "tags");
|
|
1586
|
-
|
|
1643
|
+
f([
|
|
1587
1644
|
p({ type: String })
|
|
1588
1645
|
], u.prototype, "name");
|
|
1589
|
-
|
|
1646
|
+
f([
|
|
1590
1647
|
p({ type: Boolean, attribute: "show-stats" })
|
|
1591
1648
|
], u.prototype, "showStats");
|
|
1592
|
-
|
|
1649
|
+
f([
|
|
1593
1650
|
p({ type: Boolean, attribute: "show-counts" })
|
|
1594
1651
|
], u.prototype, "showCounts");
|
|
1595
|
-
|
|
1652
|
+
f([
|
|
1596
1653
|
p({ type: Boolean, attribute: "show-chart" })
|
|
1597
1654
|
], u.prototype, "showChart");
|
|
1598
|
-
|
|
1655
|
+
f([
|
|
1599
1656
|
p({ type: String, attribute: "stats-text" })
|
|
1600
1657
|
], u.prototype, "statsText");
|
|
1601
|
-
|
|
1658
|
+
f([
|
|
1602
1659
|
p({ type: String, attribute: "stats-position" })
|
|
1603
1660
|
], u.prototype, "statsPosition");
|
|
1604
|
-
|
|
1661
|
+
f([
|
|
1605
1662
|
p({ type: String, attribute: "stats-align" })
|
|
1606
1663
|
], u.prototype, "statsAlign");
|
|
1607
|
-
|
|
1664
|
+
f([
|
|
1608
1665
|
p({ type: String })
|
|
1609
1666
|
], u.prototype, "icon");
|
|
1610
|
-
|
|
1667
|
+
f([
|
|
1611
1668
|
p({ type: String, attribute: "icon-active" })
|
|
1612
1669
|
], u.prototype, "iconActive");
|
|
1613
|
-
|
|
1670
|
+
f([
|
|
1614
1671
|
p({ type: String, attribute: "primary-color" })
|
|
1615
1672
|
], u.prototype, "primaryColor");
|
|
1616
|
-
|
|
1673
|
+
f([
|
|
1617
1674
|
p({ type: String, attribute: "mute-color" })
|
|
1618
1675
|
], u.prototype, "muteColor");
|
|
1619
|
-
|
|
1676
|
+
f([
|
|
1620
1677
|
p({ type: String, attribute: "text-color" })
|
|
1621
1678
|
], u.prototype, "textColor");
|
|
1622
|
-
|
|
1679
|
+
f([
|
|
1623
1680
|
p({ type: String })
|
|
1624
1681
|
], u.prototype, "size");
|
|
1625
|
-
|
|
1682
|
+
f([
|
|
1626
1683
|
p({ type: String, attribute: "button-radius" })
|
|
1627
1684
|
], u.prototype, "buttonRadius");
|
|
1628
|
-
|
|
1685
|
+
f([
|
|
1629
1686
|
p({ type: Number, attribute: "min-contrast" })
|
|
1630
1687
|
], u.prototype, "minContrast");
|
|
1631
|
-
|
|
1688
|
+
f([
|
|
1632
1689
|
p({ type: String })
|
|
1633
1690
|
], u.prototype, "css");
|
|
1634
|
-
|
|
1691
|
+
f([
|
|
1635
1692
|
p({ type: String })
|
|
1636
1693
|
], u.prototype, "label");
|
|
1637
|
-
|
|
1694
|
+
f([
|
|
1638
1695
|
p({ type: String, attribute: "label-position" })
|
|
1639
1696
|
], u.prototype, "labelPosition");
|
|
1640
|
-
|
|
1697
|
+
f([
|
|
1641
1698
|
p({ type: String, attribute: "label-align" })
|
|
1642
1699
|
], u.prototype, "labelAlign");
|
|
1643
|
-
|
|
1700
|
+
f([
|
|
1644
1701
|
y()
|
|
1645
1702
|
], u.prototype, "statsIsLoading");
|
|
1646
|
-
|
|
1703
|
+
f([
|
|
1647
1704
|
y()
|
|
1648
1705
|
], u.prototype, "stats");
|
|
1649
|
-
|
|
1706
|
+
f([
|
|
1650
1707
|
y()
|
|
1651
1708
|
], u.prototype, "localStats");
|
|
1652
1709
|
const Cs = B`
|
|
@@ -1689,7 +1746,7 @@ const Cs = B`
|
|
|
1689
1746
|
gap: 0.5em;
|
|
1690
1747
|
}
|
|
1691
1748
|
|
|
1692
|
-
.thank-you-msg {
|
|
1749
|
+
.nps-thank-you-msg {
|
|
1693
1750
|
font-size: 0.8em;
|
|
1694
1751
|
color: var(--pc-text-color, #666);
|
|
1695
1752
|
font-style: italic;
|
|
@@ -1976,7 +2033,7 @@ function Mt(e, t = {}) {
|
|
|
1976
2033
|
`;
|
|
1977
2034
|
}
|
|
1978
2035
|
const lt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='20'%20height='5'%20viewBox='0%200%2020%205'%20fill='currentColor'%3e%3ccircle%20cx='3'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3ccircle%20cx='10'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0.2s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3ccircle%20cx='17'%20cy='2.5'%20r='1.5'%20opacity='0.3'%3e%3canimate%20attributeName='opacity'%20begin='0.4s'%20dur='1s'%20values='0.3;0.8;0.3'%20repeatCount='indefinite'/%3e%3c/circle%3e%3c/svg%3e", bt = "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", zt = "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", Nt = "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";
|
|
1979
|
-
var
|
|
2036
|
+
var Rt = /* @__PURE__ */ ((e) => (e.DECORATIVE = "decorative", e.FUNCTIONAL = "functional", e.STATUS = "status", e))(Rt || {});
|
|
1980
2037
|
function Ae(e, t = {}) {
|
|
1981
2038
|
const {
|
|
1982
2039
|
type: s = "functional",
|
|
@@ -1992,14 +2049,14 @@ function Ae(e, t = {}) {
|
|
|
1992
2049
|
s === "functional" && !i && !o && console.warn(
|
|
1993
2050
|
`No alt text or aria-label provided for functional icon in ${a}. This may cause accessibility issues.`
|
|
1994
2051
|
);
|
|
1995
|
-
const n = r ? " (selected)" : "", c =
|
|
2052
|
+
const n = r ? " (selected)" : "", c = Ot(e) && !i ? "" : i || e, h = o || (c ? `${c}${n}` : n);
|
|
1996
2053
|
return {
|
|
1997
2054
|
alt: c,
|
|
1998
2055
|
ariaLabel: h,
|
|
1999
2056
|
ariaHidden: !1
|
|
2000
2057
|
};
|
|
2001
2058
|
}
|
|
2002
|
-
function
|
|
2059
|
+
function It(e, t = "polite") {
|
|
2003
2060
|
let s = document.getElementById("screen-reader-announcer");
|
|
2004
2061
|
s ? s.setAttribute("aria-live", t) : (s = document.createElement("div"), s.id = "screen-reader-announcer", s.setAttribute("aria-live", t), s.setAttribute("role", "status"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.width = "1px", s.style.height = "1px", s.style.margin = "-1px", s.style.padding = "0", s.style.overflow = "hidden", s.style.clip = "rect(0, 0, 0, 0)", s.style.whiteSpace = "nowrap", s.style.border = "0", document.body.appendChild(s)), s.textContent = "", setTimeout(() => {
|
|
2005
2062
|
s.textContent = e;
|
|
@@ -2009,7 +2066,7 @@ function Ut(e, t) {
|
|
|
2009
2066
|
return `${e}: ${t}`;
|
|
2010
2067
|
}
|
|
2011
2068
|
var w = /* @__PURE__ */ ((e) => (e.BUTTON = "button", e.CHECKBOX = "checkbox", e.RADIO = "radio", e.RADIOGROUP = "radiogroup", e.SWITCH = "switch", e.TAB = "tab", e.TABLIST = "tablist", e.TABPANEL = "tabpanel", e.MENU = "menu", e.MENUITEM = "menuitem", e.MENUITEMCHECKBOX = "menuitemcheckbox", e.MENUITEMRADIO = "menuitemradio", e.SLIDER = "slider", e.TEXTBOX = "textbox", e.COMBOBOX = "combobox", e.LISTBOX = "listbox", e.OPTION = "option", e.PROGRESSBAR = "progressbar", e.STATUS = "status", e.ALERT = "alert", e.DIALOG = "dialog", e.GROUP = "group", e.REGION = "region", e.NONE = "none", e.PRESENTATION = "presentation", e))(w || {});
|
|
2012
|
-
function
|
|
2069
|
+
function T(e) {
|
|
2013
2070
|
const t = {};
|
|
2014
2071
|
e.role !== void 0 && (t.role = e.role);
|
|
2015
2072
|
for (const [s, i] of Object.entries(e)) {
|
|
@@ -2020,7 +2077,7 @@ function O(e) {
|
|
|
2020
2077
|
return t;
|
|
2021
2078
|
}
|
|
2022
2079
|
function Es(e, t, s) {
|
|
2023
|
-
return
|
|
2080
|
+
return T({
|
|
2024
2081
|
role: "button",
|
|
2025
2082
|
ariaLabel: e,
|
|
2026
2083
|
ariaPressed: t,
|
|
@@ -2028,7 +2085,7 @@ function Es(e, t, s) {
|
|
|
2028
2085
|
});
|
|
2029
2086
|
}
|
|
2030
2087
|
function ne(e, t, s, i = !1) {
|
|
2031
|
-
return
|
|
2088
|
+
return T({
|
|
2032
2089
|
role: i ? "radio" : "checkbox",
|
|
2033
2090
|
ariaLabel: e,
|
|
2034
2091
|
ariaChecked: t,
|
|
@@ -2040,7 +2097,7 @@ var As = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, q = (e, t,
|
|
|
2040
2097
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
2041
2098
|
return i && o && As(t, s, o), o;
|
|
2042
2099
|
};
|
|
2043
|
-
let
|
|
2100
|
+
let O = class extends u {
|
|
2044
2101
|
constructor() {
|
|
2045
2102
|
super(), this.min = 0, this.max = 10, this.minLabel = "Not at all", this.maxLabel = "Extremely", this.thankYouMsg = "Thank you for sharing your feedback!", this.minMaxPosition = "top", this.isChartVisible = !1, this.isEditMode = !0, this.hoverValue = -1, this.handleChartToggleKeyDown = (e) => {
|
|
2046
2103
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.toggleChart());
|
|
@@ -2089,7 +2146,7 @@ let T = class extends u {
|
|
|
2089
2146
|
* Render NPS buttons for edit mode
|
|
2090
2147
|
*/
|
|
2091
2148
|
renderEditNps() {
|
|
2092
|
-
const e = this.getCurrentScore(), t = this.hasUserScore(), s = Array.from({ length: this.max - this.min + 1 }, (a, n) => n + this.min), i = `nps-control-${this.name || this.widgetType}`, o =
|
|
2149
|
+
const e = this.getCurrentScore(), t = this.hasUserScore(), s = Array.from({ length: this.max - this.min + 1 }, (a, n) => n + this.min), i = `nps-control-${this.name || this.widgetType}`, o = T({
|
|
2093
2150
|
role: w.GROUP,
|
|
2094
2151
|
ariaLabel: this.label || "NPS Rating",
|
|
2095
2152
|
ariaDescribedby: `${i}-description`
|
|
@@ -2140,7 +2197,7 @@ let T = class extends u {
|
|
|
2140
2197
|
"nps-button": !0,
|
|
2141
2198
|
selected: !0,
|
|
2142
2199
|
"view-mode": !0
|
|
2143
|
-
}, i =
|
|
2200
|
+
}, i = T({
|
|
2144
2201
|
role: w.PRESENTATION
|
|
2145
2202
|
}), o = l`
|
|
2146
2203
|
<button
|
|
@@ -2172,7 +2229,7 @@ let T = class extends u {
|
|
|
2172
2229
|
barColor: o,
|
|
2173
2230
|
labelFormatter: (c) => `${c}`,
|
|
2174
2231
|
valueFormatter: (c) => `${t > 0 ? Math.round(c / t * 100) : 0}%`
|
|
2175
|
-
}), a =
|
|
2232
|
+
}), a = T({
|
|
2176
2233
|
role: w.REGION,
|
|
2177
2234
|
ariaLabel: `Results chart for ${this.label || "NPS Rating"}`
|
|
2178
2235
|
});
|
|
@@ -2231,7 +2288,7 @@ let T = class extends u {
|
|
|
2231
2288
|
const e = this.hasUserScore(), t = e ? "Edit rating" : "Add rating";
|
|
2232
2289
|
return l`
|
|
2233
2290
|
<div class="action-button-container">
|
|
2234
|
-
${e ? l`<span class="thank-you-msg" data-testid="nps-thank-you-msg"
|
|
2291
|
+
${e ? l`<span class="nps-thank-you-msg" data-testid="nps-thank-you-msg"
|
|
2235
2292
|
>${this.thankYouMsg}</span
|
|
2236
2293
|
>` : d}
|
|
2237
2294
|
<button
|
|
@@ -2258,7 +2315,7 @@ let T = class extends u {
|
|
|
2258
2315
|
if (this.readonly) return;
|
|
2259
2316
|
this.hoverValue = -1;
|
|
2260
2317
|
const t = this.label || "NPS", s = `Rated ${e} out of ${this.max}`;
|
|
2261
|
-
|
|
2318
|
+
It(Ut(t, s)), await this.handleChange(e, [String(e)]), this.isEditMode = !1;
|
|
2262
2319
|
}
|
|
2263
2320
|
/**
|
|
2264
2321
|
* Render min/max labels
|
|
@@ -2293,14 +2350,14 @@ let T = class extends u {
|
|
|
2293
2350
|
render() {
|
|
2294
2351
|
const e = {
|
|
2295
2352
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
2296
|
-
[`pc-flex-align-${
|
|
2353
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0,
|
|
2297
2354
|
"edit-mode": this.isEditMode,
|
|
2298
2355
|
"view-mode": !this.isEditMode
|
|
2299
2356
|
}, t = {
|
|
2300
2357
|
nps: !0,
|
|
2301
2358
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
2302
|
-
[`pc-flex-align-${
|
|
2303
|
-
}, s =
|
|
2359
|
+
[`pc-flex-align-${I(this.statsPosition, this.statsAlign)}`]: !0
|
|
2360
|
+
}, s = T({
|
|
2304
2361
|
role: w.REGION,
|
|
2305
2362
|
ariaLabel: this.label || "NPS Rating"
|
|
2306
2363
|
});
|
|
@@ -2320,31 +2377,31 @@ let T = class extends u {
|
|
|
2320
2377
|
`;
|
|
2321
2378
|
}
|
|
2322
2379
|
};
|
|
2323
|
-
|
|
2380
|
+
O.styles = [...u.styles, Cs];
|
|
2324
2381
|
q([
|
|
2325
2382
|
p({ type: String, attribute: "min-label" })
|
|
2326
|
-
],
|
|
2383
|
+
], O.prototype, "minLabel", 2);
|
|
2327
2384
|
q([
|
|
2328
2385
|
p({ type: String, attribute: "max-label" })
|
|
2329
|
-
],
|
|
2386
|
+
], O.prototype, "maxLabel", 2);
|
|
2330
2387
|
q([
|
|
2331
2388
|
p({ type: String, attribute: "thank-you-msg" })
|
|
2332
|
-
],
|
|
2389
|
+
], O.prototype, "thankYouMsg", 2);
|
|
2333
2390
|
q([
|
|
2334
2391
|
p({ type: String, attribute: "min-max-position" })
|
|
2335
|
-
],
|
|
2392
|
+
], O.prototype, "minMaxPosition", 2);
|
|
2336
2393
|
q([
|
|
2337
2394
|
y()
|
|
2338
|
-
],
|
|
2395
|
+
], O.prototype, "isChartVisible", 2);
|
|
2339
2396
|
q([
|
|
2340
2397
|
y()
|
|
2341
|
-
],
|
|
2398
|
+
], O.prototype, "isEditMode", 2);
|
|
2342
2399
|
q([
|
|
2343
2400
|
y()
|
|
2344
|
-
],
|
|
2345
|
-
|
|
2401
|
+
], O.prototype, "hoverValue", 2);
|
|
2402
|
+
O = q([
|
|
2346
2403
|
F("pc-nps")
|
|
2347
|
-
],
|
|
2404
|
+
], O);
|
|
2348
2405
|
const Ps = B`
|
|
2349
2406
|
/* Add responsive sizing with CSS variables */
|
|
2350
2407
|
:host {
|
|
@@ -2648,17 +2705,6 @@ const Ps = B`
|
|
|
2648
2705
|
text-align: center;
|
|
2649
2706
|
}
|
|
2650
2707
|
|
|
2651
|
-
.thank-you-msg {
|
|
2652
|
-
font-size: 1em;
|
|
2653
|
-
color: var(--pc-text-color, #333);
|
|
2654
|
-
background: white;
|
|
2655
|
-
padding: 1em 1.5em;
|
|
2656
|
-
border-radius: var(--pc-border-radius, 0.375em);
|
|
2657
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
2658
|
-
border: 1px solid var(--pc-mute-color, #ddd);
|
|
2659
|
-
max-width: 300px;
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
2708
|
/* Edit toggle icon styles */
|
|
2663
2709
|
.edit-toggle-icon {
|
|
2664
2710
|
width: 1em;
|
|
@@ -2715,52 +2761,6 @@ const Ps = B`
|
|
|
2715
2761
|
}
|
|
2716
2762
|
}
|
|
2717
2763
|
|
|
2718
|
-
/* Overlay styles */
|
|
2719
|
-
.poll-section-with-overlay {
|
|
2720
|
-
position: relative;
|
|
2721
|
-
}
|
|
2722
|
-
|
|
2723
|
-
.poll-thank-you-overlay {
|
|
2724
|
-
position: absolute;
|
|
2725
|
-
top: 0;
|
|
2726
|
-
left: 0;
|
|
2727
|
-
right: 0;
|
|
2728
|
-
bottom: 0;
|
|
2729
|
-
background-color: rgba(255, 255, 255, 0.2);
|
|
2730
|
-
backdrop-filter: blur(2px);
|
|
2731
|
-
display: flex;
|
|
2732
|
-
align-items: center;
|
|
2733
|
-
justify-content: center;
|
|
2734
|
-
z-index: 10;
|
|
2735
|
-
animation: fadeInOverlay 0.3s ease-out;
|
|
2736
|
-
}
|
|
2737
|
-
|
|
2738
|
-
@keyframes fadeInOverlay {
|
|
2739
|
-
from {
|
|
2740
|
-
opacity: 0;
|
|
2741
|
-
backdrop-filter: blur(0px);
|
|
2742
|
-
}
|
|
2743
|
-
to {
|
|
2744
|
-
opacity: 1;
|
|
2745
|
-
backdrop-filter: blur(2px);
|
|
2746
|
-
}
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
.poll-thank-you-overlay .poll-thank-you {
|
|
2750
|
-
animation: slideInUp 0.4s ease-out;
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
@keyframes slideInUp {
|
|
2754
|
-
from {
|
|
2755
|
-
transform: translateY(20px);
|
|
2756
|
-
opacity: 0;
|
|
2757
|
-
}
|
|
2758
|
-
to {
|
|
2759
|
-
transform: translateY(0);
|
|
2760
|
-
opacity: 1;
|
|
2761
|
-
}
|
|
2762
|
-
}
|
|
2763
|
-
|
|
2764
2764
|
/* Disabled poll options styles */
|
|
2765
2765
|
.poll-container--disabled {
|
|
2766
2766
|
filter: brightness(0.95);
|
|
@@ -2782,10 +2782,10 @@ const Ps = B`
|
|
|
2782
2782
|
gap: 0.5em;
|
|
2783
2783
|
}
|
|
2784
2784
|
`;
|
|
2785
|
-
var
|
|
2786
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
2785
|
+
var Ts = Object.defineProperty, Os = Object.getOwnPropertyDescriptor, Q = (e, t, s, i) => {
|
|
2786
|
+
for (var o = i > 1 ? void 0 : i ? Os(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
2787
2787
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
2788
|
-
return i && o &&
|
|
2788
|
+
return i && o && Ts(t, s, o), o;
|
|
2789
2789
|
};
|
|
2790
2790
|
let P = class extends V {
|
|
2791
2791
|
constructor() {
|
|
@@ -2964,7 +2964,7 @@ let C = class extends u {
|
|
|
2964
2964
|
*/
|
|
2965
2965
|
renderOptionIcon(e, t) {
|
|
2966
2966
|
if (!e) return "";
|
|
2967
|
-
const s =
|
|
2967
|
+
const s = Rt.DECORATIVE, i = `Poll for: ${t == null ? void 0 : t.label}`, o = (t == null ? void 0 : t.label) || "", r = t ? this.isSelected(t.value) : !1, a = Ae(e, {
|
|
2968
2968
|
type: s,
|
|
2969
2969
|
alt: o,
|
|
2970
2970
|
isSelected: r,
|
|
@@ -2974,7 +2974,7 @@ let C = class extends u {
|
|
|
2974
2974
|
class="poll-option-icon"
|
|
2975
2975
|
aria-hidden="${a.ariaHidden ? "true" : "false"}"
|
|
2976
2976
|
>${e}</span
|
|
2977
|
-
>` :
|
|
2977
|
+
>` : Ot(e) ? l`<img
|
|
2978
2978
|
src="${e}"
|
|
2979
2979
|
alt="${a.alt}"
|
|
2980
2980
|
class="poll-option-icon-img"
|
|
@@ -3047,7 +3047,7 @@ let C = class extends u {
|
|
|
3047
3047
|
* Render poll options with proper grouping role
|
|
3048
3048
|
*/
|
|
3049
3049
|
renderPollOptions() {
|
|
3050
|
-
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s =
|
|
3050
|
+
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s = T({
|
|
3051
3051
|
role: e,
|
|
3052
3052
|
ariaLabel: t
|
|
3053
3053
|
});
|
|
@@ -3100,7 +3100,7 @@ let C = class extends u {
|
|
|
3100
3100
|
renderStats() {
|
|
3101
3101
|
if (!this.statsText) return d;
|
|
3102
3102
|
if (this.statsIsLoading) {
|
|
3103
|
-
const s =
|
|
3103
|
+
const s = T({
|
|
3104
3104
|
ariaLabel: "Loading poll statistics",
|
|
3105
3105
|
ariaBusy: !0
|
|
3106
3106
|
});
|
|
@@ -3185,7 +3185,7 @@ let C = class extends u {
|
|
|
3185
3185
|
* Render poll options with previous selections but disabled (for view mode)
|
|
3186
3186
|
*/
|
|
3187
3187
|
renderDisabledPollOptions() {
|
|
3188
|
-
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s =
|
|
3188
|
+
const e = this.multiple ? w.GROUP : w.RADIOGROUP, t = this.label || this.name || "Options", s = T({
|
|
3189
3189
|
role: e,
|
|
3190
3190
|
ariaLabel: t
|
|
3191
3191
|
});
|
|
@@ -3235,9 +3235,9 @@ let C = class extends u {
|
|
|
3235
3235
|
*/
|
|
3236
3236
|
renderContent() {
|
|
3237
3237
|
return this.isEditMode ? l`<div class="pc-section">${this.renderPollOptions()}</div>` : this.showChart ? l`<div class="pc-section">${this.renderLinkedInChart()}</div>` : this.hasUserVote() ? l`
|
|
3238
|
-
<div class="pc-section
|
|
3238
|
+
<div class="pc-section pc-thank-you-section-with-overlay">
|
|
3239
3239
|
${this.renderDisabledPollOptions()}
|
|
3240
|
-
<div class="
|
|
3240
|
+
<div class="pc-thank-you-overlay" data-testid="poll-thank-you-overlay">
|
|
3241
3241
|
${this.renderThankYouMessage()}
|
|
3242
3242
|
</div>
|
|
3243
3243
|
</div>
|
|
@@ -3271,17 +3271,17 @@ let C = class extends u {
|
|
|
3271
3271
|
announceSelectionChange(e, t, s) {
|
|
3272
3272
|
const i = `Poll for: ${e.label}`;
|
|
3273
3273
|
let o = "";
|
|
3274
|
-
this.multiple ? o = (t == null ? void 0 : t.includes(e.value)) || !1 ? `${e.label} selected` : `${e.label} unselected` : o = t && t.length > 0 ? `${e.label} selected` : "Selection cleared",
|
|
3274
|
+
this.multiple ? o = (t == null ? void 0 : t.includes(e.value)) || !1 ? `${e.label} selected` : `${e.label} unselected` : o = t && t.length > 0 ? `${e.label} selected` : "Selection cleared", It(Ut(i, o));
|
|
3275
3275
|
}
|
|
3276
3276
|
render() {
|
|
3277
3277
|
const e = {
|
|
3278
3278
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
3279
|
-
[`pc-flex-align-${
|
|
3279
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0
|
|
3280
3280
|
}, t = "bottom", s = {
|
|
3281
3281
|
poll: !0,
|
|
3282
3282
|
[`pc-flex-pos-${t}`]: !0,
|
|
3283
|
-
[`pc-flex-align-${
|
|
3284
|
-
}, i =
|
|
3283
|
+
[`pc-flex-align-${I(t, this.statsAlign)}`]: !0
|
|
3284
|
+
}, i = T({
|
|
3285
3285
|
role: w.REGION,
|
|
3286
3286
|
ariaLabel: this.label || this.name || "Poll"
|
|
3287
3287
|
});
|
|
@@ -3458,17 +3458,6 @@ const Ns = B`
|
|
|
3458
3458
|
text-align: center;
|
|
3459
3459
|
}
|
|
3460
3460
|
|
|
3461
|
-
.thank-you-msg {
|
|
3462
|
-
font-size: 1em;
|
|
3463
|
-
color: var(--pc-text-color, #333);
|
|
3464
|
-
background: white;
|
|
3465
|
-
padding: 1em 1.5em;
|
|
3466
|
-
border-radius: var(--pc-border-radius, 0.375em);
|
|
3467
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
3468
|
-
border: 1px solid var(--pc-mute-color, #ddd);
|
|
3469
|
-
max-width: 300px;
|
|
3470
|
-
}
|
|
3471
|
-
|
|
3472
3461
|
/* Edit toggle icon styles */
|
|
3473
3462
|
.edit-toggle-icon {
|
|
3474
3463
|
width: 1em;
|
|
@@ -3489,52 +3478,6 @@ const Ns = B`
|
|
|
3489
3478
|
border-radius: 2px;
|
|
3490
3479
|
}
|
|
3491
3480
|
|
|
3492
|
-
/* Overlay styles */
|
|
3493
|
-
.text-section-with-overlay {
|
|
3494
|
-
position: relative;
|
|
3495
|
-
}
|
|
3496
|
-
|
|
3497
|
-
.text-thank-you-overlay {
|
|
3498
|
-
position: absolute;
|
|
3499
|
-
top: 0;
|
|
3500
|
-
left: 0;
|
|
3501
|
-
right: 0;
|
|
3502
|
-
bottom: 0;
|
|
3503
|
-
background-color: rgba(255, 255, 255, 0.2);
|
|
3504
|
-
backdrop-filter: blur(2px);
|
|
3505
|
-
display: flex;
|
|
3506
|
-
align-items: center;
|
|
3507
|
-
justify-content: center;
|
|
3508
|
-
z-index: 10;
|
|
3509
|
-
animation: fadeInOverlay 0.3s ease-out;
|
|
3510
|
-
}
|
|
3511
|
-
|
|
3512
|
-
@keyframes fadeInOverlay {
|
|
3513
|
-
from {
|
|
3514
|
-
opacity: 0;
|
|
3515
|
-
backdrop-filter: blur(0px);
|
|
3516
|
-
}
|
|
3517
|
-
to {
|
|
3518
|
-
opacity: 1;
|
|
3519
|
-
backdrop-filter: blur(2px);
|
|
3520
|
-
}
|
|
3521
|
-
}
|
|
3522
|
-
|
|
3523
|
-
.text-thank-you-overlay .text-thank-you {
|
|
3524
|
-
animation: slideInUp 0.4s ease-out;
|
|
3525
|
-
}
|
|
3526
|
-
|
|
3527
|
-
@keyframes slideInUp {
|
|
3528
|
-
from {
|
|
3529
|
-
transform: translateY(20px);
|
|
3530
|
-
opacity: 0;
|
|
3531
|
-
}
|
|
3532
|
-
to {
|
|
3533
|
-
transform: translateY(0);
|
|
3534
|
-
opacity: 1;
|
|
3535
|
-
}
|
|
3536
|
-
}
|
|
3537
|
-
|
|
3538
3481
|
/* Disabled text input styles */
|
|
3539
3482
|
.text-input-container--disabled {
|
|
3540
3483
|
filter: brightness(0.95);
|
|
@@ -3564,10 +3507,10 @@ const Ns = B`
|
|
|
3564
3507
|
}
|
|
3565
3508
|
}
|
|
3566
3509
|
`;
|
|
3567
|
-
var
|
|
3568
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
3510
|
+
var Rs = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, A = (e, t, s, i) => {
|
|
3511
|
+
for (var o = i > 1 ? void 0 : i ? Is(t, s) : t, r = e.length - 1, a; r >= 0; r--)
|
|
3569
3512
|
(a = e[r]) && (o = (i ? a(t, s, o) : a(o)) || o);
|
|
3570
|
-
return i && o &&
|
|
3513
|
+
return i && o && Rs(t, s, o), o;
|
|
3571
3514
|
};
|
|
3572
3515
|
let $ = class extends u {
|
|
3573
3516
|
constructor() {
|
|
@@ -3746,9 +3689,9 @@ let $ = class extends u {
|
|
|
3746
3689
|
*/
|
|
3747
3690
|
renderContent() {
|
|
3748
3691
|
return this.isEditMode ? l`<div class="pc-section">${this.renderTextarea()}</div>` : this.hasSubmitted() ? l`
|
|
3749
|
-
<div class="pc-section
|
|
3692
|
+
<div class="pc-section pc-thank-you-section-with-overlay">
|
|
3750
3693
|
${this.renderDisabledTextarea()}
|
|
3751
|
-
<div class="
|
|
3694
|
+
<div class="pc-thank-you-overlay" data-testid="text-thank-you-overlay">
|
|
3752
3695
|
${this.renderThankYouMessage()}
|
|
3753
3696
|
</div>
|
|
3754
3697
|
</div>
|
|
@@ -3766,7 +3709,7 @@ let $ = class extends u {
|
|
|
3766
3709
|
render() {
|
|
3767
3710
|
const e = {
|
|
3768
3711
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
3769
|
-
[`pc-flex-align-${
|
|
3712
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0
|
|
3770
3713
|
};
|
|
3771
3714
|
return l`
|
|
3772
3715
|
<div class="pc-container ${v(e)}" data-testid="text-container">
|
|
@@ -4171,7 +4114,7 @@ const Us = B`
|
|
|
4171
4114
|
};
|
|
4172
4115
|
function Ls(e) {
|
|
4173
4116
|
let t = "❓", s = !1;
|
|
4174
|
-
return e ? e in le ? t = le[e] : ve(e) ? t = e :
|
|
4117
|
+
return e ? e in le ? t = le[e] : ve(e) ? t = e : Ot(e) ? (s = !0, t = e) : /^\w+@\w+$/.test(e) ? t = e : e.endsWith(".svg") ? (t = `https://cdn.jsdelivr.net/npm/@mdi/svg@7.4.47/svg/${e}`, s = !0) : t = e : t = "❓", {
|
|
4175
4118
|
icon: t,
|
|
4176
4119
|
isRemoteImage: s
|
|
4177
4120
|
};
|
|
@@ -4330,7 +4273,7 @@ let E = class extends u {
|
|
|
4330
4273
|
* Renders the icon for a reaction
|
|
4331
4274
|
*/
|
|
4332
4275
|
renderReactionIcon(e, t) {
|
|
4333
|
-
const { icon: s, isRemoteImage: i } = Ls(e), o =
|
|
4276
|
+
const { icon: s, isRemoteImage: i } = Ls(e), o = Rt.FUNCTIONAL, r = "reaction", a = t.tooltip || `${t.name} reaction`, n = Ae(s, {
|
|
4334
4277
|
type: o,
|
|
4335
4278
|
alt: a,
|
|
4336
4279
|
ariaLabel: a,
|
|
@@ -4571,15 +4514,15 @@ let E = class extends u {
|
|
|
4571
4514
|
*/
|
|
4572
4515
|
announceReactionChange(e, t) {
|
|
4573
4516
|
const s = this.componentName, i = t ? `Added ${e.name} reaction` : `Removed ${e.name} reaction`;
|
|
4574
|
-
|
|
4517
|
+
It(Ut(s, i));
|
|
4575
4518
|
}
|
|
4576
4519
|
render() {
|
|
4577
4520
|
const e = {
|
|
4578
4521
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
4579
|
-
[`pc-flex-align-${
|
|
4522
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0
|
|
4580
4523
|
}, t = {
|
|
4581
4524
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
4582
|
-
[`pc-flex-align-${
|
|
4525
|
+
[`pc-flex-align-${I(this.statsPosition, this.statsAlign)}`]: !0
|
|
4583
4526
|
};
|
|
4584
4527
|
return l`
|
|
4585
4528
|
<div class="pc-container ${v(e)}" data-testid="reaction-container">
|
|
@@ -5230,13 +5173,13 @@ let U = class extends u {
|
|
|
5230
5173
|
render() {
|
|
5231
5174
|
const e = {
|
|
5232
5175
|
[`pc-flex-pos-${this.labelPosition}`]: !0,
|
|
5233
|
-
[`pc-flex-align-${
|
|
5176
|
+
[`pc-flex-align-${I(this.labelPosition, this.labelAlign)}`]: !0,
|
|
5234
5177
|
"edit-mode": this.isEditMode,
|
|
5235
5178
|
"view-mode": !this.isEditMode
|
|
5236
5179
|
}, t = {
|
|
5237
5180
|
stars: !0,
|
|
5238
5181
|
[`pc-flex-pos-${this.statsPosition}`]: !0,
|
|
5239
|
-
[`pc-flex-align-${
|
|
5182
|
+
[`pc-flex-align-${I(this.statsPosition, this.statsAlign)}`]: !0
|
|
5240
5183
|
};
|
|
5241
5184
|
return l`
|
|
5242
5185
|
<div class="pc-container ${v(e)}" data-testid="stars-container">
|
|
@@ -5347,7 +5290,7 @@ Ct = Pe([
|
|
|
5347
5290
|
F("poll-catch")
|
|
5348
5291
|
], Ct);
|
|
5349
5292
|
export {
|
|
5350
|
-
|
|
5293
|
+
O as PcNps,
|
|
5351
5294
|
C as PcPoll,
|
|
5352
5295
|
P as PcPollOption,
|
|
5353
5296
|
E as PcReaction,
|