@magicfeedback/popup-sdk 1.6.0 → 1.7.1
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 +34 -1
- package/dist/assets/assets/style.css +63 -14
- package/dist/{chunk-AN7JIVWB.mjs → chunk-W6MPSWMS.mjs} +352 -15
- package/dist/chunk-W6MPSWMS.mjs.map +1 -0
- package/dist/{chunk-Z3LLJMSH.mjs → chunk-WNIUIOKF.mjs} +332 -15
- package/dist/chunk-WNIUIOKF.mjs.map +1 -0
- package/dist/index.d.mts +99 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.js +1647 -1366
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +200 -28
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.d.mts +13 -0
- package/dist/react-native.d.ts +13 -0
- package/dist/react-native.js +550 -55
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +189 -28
- package/dist/react-native.mjs.map +1 -1
- package/dist/{renderPopup-SELXQ3UE.mjs → renderPopup-EWGKG53W.mjs} +42 -18
- package/dist/renderPopup-EWGKG53W.mjs.map +1 -0
- package/dist/renderPopup-HHQMAW3G.mjs +3114 -0
- package/dist/renderPopup-HHQMAW3G.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-AN7JIVWB.mjs.map +0 -1
- package/dist/chunk-Z3LLJMSH.mjs.map +0 -1
- package/dist/renderPopup-M6MKTDEH.mjs +0 -3330
- package/dist/renderPopup-M6MKTDEH.mjs.map +0 -1
- package/dist/renderPopup-SELXQ3UE.mjs.map +0 -1
|
@@ -0,0 +1,3114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__toESM,
|
|
4
|
+
buildFontFaceCss,
|
|
5
|
+
buildFontFamilyValue,
|
|
6
|
+
buildSurveyIdentity,
|
|
7
|
+
directionFor,
|
|
8
|
+
getLabels,
|
|
9
|
+
resolveActionLabels,
|
|
10
|
+
sdkError,
|
|
11
|
+
sdkLog,
|
|
12
|
+
sdkWarn,
|
|
13
|
+
style_default
|
|
14
|
+
} from "./chunk-W6MPSWMS.mjs";
|
|
15
|
+
|
|
16
|
+
// ../deepdots-popup-sdk/node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js
|
|
17
|
+
var require_magicfeedback_sdk_browser = __commonJS({
|
|
18
|
+
"../deepdots-popup-sdk/node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js"(exports, module) {
|
|
19
|
+
"use strict";
|
|
20
|
+
!(function(e, t) {
|
|
21
|
+
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.magicfeedback = t() : e.magicfeedback = t();
|
|
22
|
+
})(self, (() => {
|
|
23
|
+
return e = { 326: function(e2, t2) {
|
|
24
|
+
var i = "undefined" != typeof self ? self : this, r = (function() {
|
|
25
|
+
function e3() {
|
|
26
|
+
this.fetch = false, this.DOMException = i.DOMException;
|
|
27
|
+
}
|
|
28
|
+
return e3.prototype = i, new e3();
|
|
29
|
+
})();
|
|
30
|
+
!(function(e3) {
|
|
31
|
+
!(function(t3) {
|
|
32
|
+
var i2 = "URLSearchParams" in e3, r2 = "Symbol" in e3 && "iterator" in Symbol, n2 = "FileReader" in e3 && "Blob" in e3 && (function() {
|
|
33
|
+
try {
|
|
34
|
+
return new Blob(), true;
|
|
35
|
+
} catch (e4) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
})(), o = "FormData" in e3, a = "ArrayBuffer" in e3;
|
|
39
|
+
if (a) var s = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"], l = ArrayBuffer.isView || function(e4) {
|
|
40
|
+
return e4 && s.indexOf(Object.prototype.toString.call(e4)) > -1;
|
|
41
|
+
};
|
|
42
|
+
function d(e4) {
|
|
43
|
+
if ("string" != typeof e4 && (e4 = String(e4)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e4)) throw new TypeError("Invalid character in header field name");
|
|
44
|
+
return e4.toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
function c(e4) {
|
|
47
|
+
return "string" != typeof e4 && (e4 = String(e4)), e4;
|
|
48
|
+
}
|
|
49
|
+
function u(e4) {
|
|
50
|
+
var t4 = { next: function() {
|
|
51
|
+
var t5 = e4.shift();
|
|
52
|
+
return { done: void 0 === t5, value: t5 };
|
|
53
|
+
} };
|
|
54
|
+
return r2 && (t4[Symbol.iterator] = function() {
|
|
55
|
+
return t4;
|
|
56
|
+
}), t4;
|
|
57
|
+
}
|
|
58
|
+
function p(e4) {
|
|
59
|
+
this.map = {}, e4 instanceof p ? e4.forEach((function(e5, t4) {
|
|
60
|
+
this.append(t4, e5);
|
|
61
|
+
}), this) : Array.isArray(e4) ? e4.forEach((function(e5) {
|
|
62
|
+
this.append(e5[0], e5[1]);
|
|
63
|
+
}), this) : e4 && Object.getOwnPropertyNames(e4).forEach((function(t4) {
|
|
64
|
+
this.append(t4, e4[t4]);
|
|
65
|
+
}), this);
|
|
66
|
+
}
|
|
67
|
+
function m(e4) {
|
|
68
|
+
if (e4.bodyUsed) return Promise.reject(new TypeError("Already read"));
|
|
69
|
+
e4.bodyUsed = true;
|
|
70
|
+
}
|
|
71
|
+
function h(e4) {
|
|
72
|
+
return new Promise((function(t4, i3) {
|
|
73
|
+
e4.onload = function() {
|
|
74
|
+
t4(e4.result);
|
|
75
|
+
}, e4.onerror = function() {
|
|
76
|
+
i3(e4.error);
|
|
77
|
+
};
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
function f(e4) {
|
|
81
|
+
var t4 = new FileReader(), i3 = h(t4);
|
|
82
|
+
return t4.readAsArrayBuffer(e4), i3;
|
|
83
|
+
}
|
|
84
|
+
function g(e4) {
|
|
85
|
+
if (e4.slice) return e4.slice(0);
|
|
86
|
+
var t4 = new Uint8Array(e4.byteLength);
|
|
87
|
+
return t4.set(new Uint8Array(e4)), t4.buffer;
|
|
88
|
+
}
|
|
89
|
+
function y() {
|
|
90
|
+
return this.bodyUsed = false, this._initBody = function(e4) {
|
|
91
|
+
var t4;
|
|
92
|
+
this._bodyInit = e4, e4 ? "string" == typeof e4 ? this._bodyText = e4 : n2 && Blob.prototype.isPrototypeOf(e4) ? this._bodyBlob = e4 : o && FormData.prototype.isPrototypeOf(e4) ? this._bodyFormData = e4 : i2 && URLSearchParams.prototype.isPrototypeOf(e4) ? this._bodyText = e4.toString() : a && n2 && (t4 = e4) && DataView.prototype.isPrototypeOf(t4) ? (this._bodyArrayBuffer = g(e4.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a && (ArrayBuffer.prototype.isPrototypeOf(e4) || l(e4)) ? this._bodyArrayBuffer = g(e4) : this._bodyText = e4 = Object.prototype.toString.call(e4) : this._bodyText = "", this.headers.get("content-type") || ("string" == typeof e4 ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : i2 && URLSearchParams.prototype.isPrototypeOf(e4) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
93
|
+
}, n2 && (this.blob = function() {
|
|
94
|
+
var e4 = m(this);
|
|
95
|
+
if (e4) return e4;
|
|
96
|
+
if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
|
|
97
|
+
if (this._bodyArrayBuffer) return Promise.resolve(new Blob([this._bodyArrayBuffer]));
|
|
98
|
+
if (this._bodyFormData) throw new Error("could not read FormData body as blob");
|
|
99
|
+
return Promise.resolve(new Blob([this._bodyText]));
|
|
100
|
+
}, this.arrayBuffer = function() {
|
|
101
|
+
return this._bodyArrayBuffer ? m(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(f);
|
|
102
|
+
}), this.text = function() {
|
|
103
|
+
var e4, t4, i3, r3 = m(this);
|
|
104
|
+
if (r3) return r3;
|
|
105
|
+
if (this._bodyBlob) return e4 = this._bodyBlob, i3 = h(t4 = new FileReader()), t4.readAsText(e4), i3;
|
|
106
|
+
if (this._bodyArrayBuffer) return Promise.resolve((function(e5) {
|
|
107
|
+
for (var t5 = new Uint8Array(e5), i4 = new Array(t5.length), r4 = 0; r4 < t5.length; r4++) i4[r4] = String.fromCharCode(t5[r4]);
|
|
108
|
+
return i4.join("");
|
|
109
|
+
})(this._bodyArrayBuffer));
|
|
110
|
+
if (this._bodyFormData) throw new Error("could not read FormData body as text");
|
|
111
|
+
return Promise.resolve(this._bodyText);
|
|
112
|
+
}, o && (this.formData = function() {
|
|
113
|
+
return this.text().then(E);
|
|
114
|
+
}), this.json = function() {
|
|
115
|
+
return this.text().then(JSON.parse);
|
|
116
|
+
}, this;
|
|
117
|
+
}
|
|
118
|
+
p.prototype.append = function(e4, t4) {
|
|
119
|
+
e4 = d(e4), t4 = c(t4);
|
|
120
|
+
var i3 = this.map[e4];
|
|
121
|
+
this.map[e4] = i3 ? i3 + ", " + t4 : t4;
|
|
122
|
+
}, p.prototype.delete = function(e4) {
|
|
123
|
+
delete this.map[d(e4)];
|
|
124
|
+
}, p.prototype.get = function(e4) {
|
|
125
|
+
return e4 = d(e4), this.has(e4) ? this.map[e4] : null;
|
|
126
|
+
}, p.prototype.has = function(e4) {
|
|
127
|
+
return this.map.hasOwnProperty(d(e4));
|
|
128
|
+
}, p.prototype.set = function(e4, t4) {
|
|
129
|
+
this.map[d(e4)] = c(t4);
|
|
130
|
+
}, p.prototype.forEach = function(e4, t4) {
|
|
131
|
+
for (var i3 in this.map) this.map.hasOwnProperty(i3) && e4.call(t4, this.map[i3], i3, this);
|
|
132
|
+
}, p.prototype.keys = function() {
|
|
133
|
+
var e4 = [];
|
|
134
|
+
return this.forEach((function(t4, i3) {
|
|
135
|
+
e4.push(i3);
|
|
136
|
+
})), u(e4);
|
|
137
|
+
}, p.prototype.values = function() {
|
|
138
|
+
var e4 = [];
|
|
139
|
+
return this.forEach((function(t4) {
|
|
140
|
+
e4.push(t4);
|
|
141
|
+
})), u(e4);
|
|
142
|
+
}, p.prototype.entries = function() {
|
|
143
|
+
var e4 = [];
|
|
144
|
+
return this.forEach((function(t4, i3) {
|
|
145
|
+
e4.push([i3, t4]);
|
|
146
|
+
})), u(e4);
|
|
147
|
+
}, r2 && (p.prototype[Symbol.iterator] = p.prototype.entries);
|
|
148
|
+
var v = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
|
149
|
+
function b(e4, t4) {
|
|
150
|
+
var i3, r3, n3 = (t4 = t4 || {}).body;
|
|
151
|
+
if (e4 instanceof b) {
|
|
152
|
+
if (e4.bodyUsed) throw new TypeError("Already read");
|
|
153
|
+
this.url = e4.url, this.credentials = e4.credentials, t4.headers || (this.headers = new p(e4.headers)), this.method = e4.method, this.mode = e4.mode, this.signal = e4.signal, n3 || null == e4._bodyInit || (n3 = e4._bodyInit, e4.bodyUsed = true);
|
|
154
|
+
} else this.url = String(e4);
|
|
155
|
+
if (this.credentials = t4.credentials || this.credentials || "same-origin", !t4.headers && this.headers || (this.headers = new p(t4.headers)), this.method = (r3 = (i3 = t4.method || this.method || "GET").toUpperCase(), v.indexOf(r3) > -1 ? r3 : i3), this.mode = t4.mode || this.mode || null, this.signal = t4.signal || this.signal, this.referrer = null, ("GET" === this.method || "HEAD" === this.method) && n3) throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
156
|
+
this._initBody(n3);
|
|
157
|
+
}
|
|
158
|
+
function E(e4) {
|
|
159
|
+
var t4 = new FormData();
|
|
160
|
+
return e4.trim().split("&").forEach((function(e5) {
|
|
161
|
+
if (e5) {
|
|
162
|
+
var i3 = e5.split("="), r3 = i3.shift().replace(/\+/g, " "), n3 = i3.join("=").replace(/\+/g, " ");
|
|
163
|
+
t4.append(decodeURIComponent(r3), decodeURIComponent(n3));
|
|
164
|
+
}
|
|
165
|
+
})), t4;
|
|
166
|
+
}
|
|
167
|
+
function k(e4, t4) {
|
|
168
|
+
t4 || (t4 = {}), this.type = "default", this.status = void 0 === t4.status ? 200 : t4.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in t4 ? t4.statusText : "OK", this.headers = new p(t4.headers), this.url = t4.url || "", this._initBody(e4);
|
|
169
|
+
}
|
|
170
|
+
b.prototype.clone = function() {
|
|
171
|
+
return new b(this, { body: this._bodyInit });
|
|
172
|
+
}, y.call(b.prototype), y.call(k.prototype), k.prototype.clone = function() {
|
|
173
|
+
return new k(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new p(this.headers), url: this.url });
|
|
174
|
+
}, k.error = function() {
|
|
175
|
+
var e4 = new k(null, { status: 0, statusText: "" });
|
|
176
|
+
return e4.type = "error", e4;
|
|
177
|
+
};
|
|
178
|
+
var A = [301, 302, 303, 307, 308];
|
|
179
|
+
k.redirect = function(e4, t4) {
|
|
180
|
+
if (-1 === A.indexOf(t4)) throw new RangeError("Invalid status code");
|
|
181
|
+
return new k(null, { status: t4, headers: { location: e4 } });
|
|
182
|
+
}, t3.DOMException = e3.DOMException;
|
|
183
|
+
try {
|
|
184
|
+
new t3.DOMException();
|
|
185
|
+
} catch (e4) {
|
|
186
|
+
t3.DOMException = function(e5, t4) {
|
|
187
|
+
this.message = e5, this.name = t4;
|
|
188
|
+
var i3 = Error(e5);
|
|
189
|
+
this.stack = i3.stack;
|
|
190
|
+
}, t3.DOMException.prototype = Object.create(Error.prototype), t3.DOMException.prototype.constructor = t3.DOMException;
|
|
191
|
+
}
|
|
192
|
+
function T(e4, i3) {
|
|
193
|
+
return new Promise((function(r3, o2) {
|
|
194
|
+
var a2 = new b(e4, i3);
|
|
195
|
+
if (a2.signal && a2.signal.aborted) return o2(new t3.DOMException("Aborted", "AbortError"));
|
|
196
|
+
var s2 = new XMLHttpRequest();
|
|
197
|
+
function l2() {
|
|
198
|
+
s2.abort();
|
|
199
|
+
}
|
|
200
|
+
s2.onload = function() {
|
|
201
|
+
var e5, t4, i4 = { status: s2.status, statusText: s2.statusText, headers: (e5 = s2.getAllResponseHeaders() || "", t4 = new p(), e5.replace(/\r?\n[\t ]+/g, " ").split(/\r?\n/).forEach((function(e6) {
|
|
202
|
+
var i5 = e6.split(":"), r4 = i5.shift().trim();
|
|
203
|
+
if (r4) {
|
|
204
|
+
var n4 = i5.join(":").trim();
|
|
205
|
+
t4.append(r4, n4);
|
|
206
|
+
}
|
|
207
|
+
})), t4) };
|
|
208
|
+
i4.url = "responseURL" in s2 ? s2.responseURL : i4.headers.get("X-Request-URL");
|
|
209
|
+
var n3 = "response" in s2 ? s2.response : s2.responseText;
|
|
210
|
+
r3(new k(n3, i4));
|
|
211
|
+
}, s2.onerror = function() {
|
|
212
|
+
o2(new TypeError("Network request failed"));
|
|
213
|
+
}, s2.ontimeout = function() {
|
|
214
|
+
o2(new TypeError("Network request failed"));
|
|
215
|
+
}, s2.onabort = function() {
|
|
216
|
+
o2(new t3.DOMException("Aborted", "AbortError"));
|
|
217
|
+
}, s2.open(a2.method, a2.url, true), "include" === a2.credentials ? s2.withCredentials = true : "omit" === a2.credentials && (s2.withCredentials = false), "responseType" in s2 && n2 && (s2.responseType = "blob"), a2.headers.forEach((function(e5, t4) {
|
|
218
|
+
s2.setRequestHeader(t4, e5);
|
|
219
|
+
})), a2.signal && (a2.signal.addEventListener("abort", l2), s2.onreadystatechange = function() {
|
|
220
|
+
4 === s2.readyState && a2.signal.removeEventListener("abort", l2);
|
|
221
|
+
}), s2.send(void 0 === a2._bodyInit ? null : a2._bodyInit);
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
T.polyfill = true, e3.fetch || (e3.fetch = T, e3.Headers = p, e3.Request = b, e3.Response = k), t3.Headers = p, t3.Request = b, t3.Response = k, t3.fetch = T, Object.defineProperty(t3, "__esModule", { value: true });
|
|
225
|
+
})({});
|
|
226
|
+
})(r), r.fetch.ponyfill = true, delete r.fetch.polyfill;
|
|
227
|
+
var n = r;
|
|
228
|
+
(t2 = n.fetch).default = n.fetch, t2.fetch = n.fetch, t2.Headers = n.Headers, t2.Request = n.Request, t2.Response = n.Response, e2.exports = t2;
|
|
229
|
+
}, 317: (e2, t2) => {
|
|
230
|
+
"use strict";
|
|
231
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.HOST_API_URL_DEV = t2.HOST_API_URL = void 0, t2.HOST_API_URL = "https://api.deepdots.com/", t2.HOST_API_URL_DEV = "https://api-dev.deepdots.com/";
|
|
232
|
+
}, 156: function(e2, t2, i) {
|
|
233
|
+
"use strict";
|
|
234
|
+
var r = this && this.__importDefault || function(e3) {
|
|
235
|
+
return e3 && e3.__esModule ? e3 : { default: e3 };
|
|
236
|
+
};
|
|
237
|
+
Object.defineProperty(t2, "__esModule", { value: true });
|
|
238
|
+
const n = r(i(927));
|
|
239
|
+
let o = null;
|
|
240
|
+
o || (o = (0, n.default)()), t2.default = o;
|
|
241
|
+
}, 927: function(e2, t2, i) {
|
|
242
|
+
"use strict";
|
|
243
|
+
var r = this && this.__awaiter || function(e3, t3, i2, r2) {
|
|
244
|
+
return new (i2 || (i2 = Promise))((function(n2, o2) {
|
|
245
|
+
function a2(e4) {
|
|
246
|
+
try {
|
|
247
|
+
l2(r2.next(e4));
|
|
248
|
+
} catch (e5) {
|
|
249
|
+
o2(e5);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function s2(e4) {
|
|
253
|
+
try {
|
|
254
|
+
l2(r2.throw(e4));
|
|
255
|
+
} catch (e5) {
|
|
256
|
+
o2(e5);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function l2(e4) {
|
|
260
|
+
var t4;
|
|
261
|
+
e4.done ? n2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
262
|
+
e5(t4);
|
|
263
|
+
}))).then(a2, s2);
|
|
264
|
+
}
|
|
265
|
+
l2((r2 = r2.apply(e3, t3 || [])).next());
|
|
266
|
+
}));
|
|
267
|
+
};
|
|
268
|
+
Object.defineProperty(t2, "__esModule", { value: true });
|
|
269
|
+
const n = i(57), o = i(544), a = i(665), s = i(256), l = i(313), d = i(317);
|
|
270
|
+
t2.default = function() {
|
|
271
|
+
const e3 = new a.Config();
|
|
272
|
+
let t3 = new s.Log(e3);
|
|
273
|
+
return { init: function(i2) {
|
|
274
|
+
"boolean" == typeof (null == i2 ? void 0 : i2.debug) && e3.set("debug", i2.debug), "boolean" == typeof (null == i2 ? void 0 : i2.dryRun) && e3.set("dryRun", i2.dryRun), e3.set("url", (null == i2 ? void 0 : i2.env) && "dev" === (null == i2 ? void 0 : i2.env) ? d.HOST_API_URL_DEV : d.HOST_API_URL), e3.set("env", null == i2 ? void 0 : i2.env), t3.log("Initialized Magicfeedback", e3);
|
|
275
|
+
}, send: function(i2, n2, o2, a2 = true, s2, d2) {
|
|
276
|
+
return r(this, void 0, void 0, (function* () {
|
|
277
|
+
i2 || t3.err("No appID provided"), n2 || t3.err("No publicKey provided"), o2 || t3.err("No feedback provided"), o2.answers || o2.profile || o2.metrics || o2.metadata || t3.err("No feedback data provided");
|
|
278
|
+
const r2 = e3.get("url"), c = { integration: i2, publicKey: n2, privateKey: d2, completed: a2, id: s2, feedback: o2 };
|
|
279
|
+
try {
|
|
280
|
+
if (e3.get("dryRun")) return t3.log("Dry run enabled: skipping native feedback submit"), `dry-run-${Date.now()}`;
|
|
281
|
+
const i3 = yield (0, l.sendFeedback)(r2, c, t3);
|
|
282
|
+
return t3.log("sent native feedback"), i3;
|
|
283
|
+
} catch (e4) {
|
|
284
|
+
return t3.err("error native feedback", e4), false;
|
|
285
|
+
}
|
|
286
|
+
}));
|
|
287
|
+
}, form: function(i2, r2, o2, a2) {
|
|
288
|
+
return i2 || t3.err("No appID provided"), r2 || t3.err("No publicKey provided"), new n.Form(e3, i2, r2, o2, a2);
|
|
289
|
+
}, agentForm: function(i2, r2, n2) {
|
|
290
|
+
return i2 || t3.err("No integrationId provided"), r2 || t3.err("No publicKey provided"), new o.AgentForm(e3, i2, r2, n2);
|
|
291
|
+
}, session: function(i2) {
|
|
292
|
+
return i2 || t3.err("No sessionId provided"), new n.Form(e3, i2);
|
|
293
|
+
}, previewPage: function(i2, o2, a2) {
|
|
294
|
+
return r(this, void 0, void 0, (function* () {
|
|
295
|
+
i2 || t3.err("No selector provided"), o2 && o2.page || t3.err("No page provided for preview");
|
|
296
|
+
const r2 = (null == o2 ? void 0 : o2.appId) || `preview-${Date.now()}`, s2 = new n.Form(e3, r2);
|
|
297
|
+
return yield s2.previewPage(i2, o2, a2), s2;
|
|
298
|
+
}));
|
|
299
|
+
} };
|
|
300
|
+
};
|
|
301
|
+
}, 79: (e2, t2) => {
|
|
302
|
+
"use strict";
|
|
303
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.History = void 0, t2.History = class {
|
|
304
|
+
constructor() {
|
|
305
|
+
this.items = [];
|
|
306
|
+
}
|
|
307
|
+
enqueue(e3) {
|
|
308
|
+
this.items.push(e3);
|
|
309
|
+
}
|
|
310
|
+
dequeue() {
|
|
311
|
+
return this.items.shift();
|
|
312
|
+
}
|
|
313
|
+
rollback() {
|
|
314
|
+
return this.items.pop();
|
|
315
|
+
}
|
|
316
|
+
front() {
|
|
317
|
+
return this.items[0];
|
|
318
|
+
}
|
|
319
|
+
back() {
|
|
320
|
+
return this.items[this.items.length - 1];
|
|
321
|
+
}
|
|
322
|
+
isEmpty() {
|
|
323
|
+
return 0 === this.items.length;
|
|
324
|
+
}
|
|
325
|
+
size() {
|
|
326
|
+
return this.items.length;
|
|
327
|
+
}
|
|
328
|
+
get(e3) {
|
|
329
|
+
return this.items[e3];
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
}, 544: function(e2, t2, i) {
|
|
333
|
+
"use strict";
|
|
334
|
+
var r = this && this.__awaiter || function(e3, t3, i2, r2) {
|
|
335
|
+
return new (i2 || (i2 = Promise))((function(n2, o2) {
|
|
336
|
+
function a2(e4) {
|
|
337
|
+
try {
|
|
338
|
+
l2(r2.next(e4));
|
|
339
|
+
} catch (e5) {
|
|
340
|
+
o2(e5);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function s2(e4) {
|
|
344
|
+
try {
|
|
345
|
+
l2(r2.throw(e4));
|
|
346
|
+
} catch (e5) {
|
|
347
|
+
o2(e5);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function l2(e4) {
|
|
351
|
+
var t4;
|
|
352
|
+
e4.done ? n2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
353
|
+
e5(t4);
|
|
354
|
+
}))).then(a2, s2);
|
|
355
|
+
}
|
|
356
|
+
l2((r2 = r2.apply(e3, t3 || [])).next());
|
|
357
|
+
}));
|
|
358
|
+
};
|
|
359
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.AgentForm = void 0;
|
|
360
|
+
const n = i(256), o = i(279), a = i(945), s = i(177), l = i(107), d = i(565), c = i(571), u = i(213), p = i(881);
|
|
361
|
+
t2.AgentForm = class {
|
|
362
|
+
constructor(e3, t3, i2, r2) {
|
|
363
|
+
this.config = e3, this.log = new n.Log(e3), this.url = e3.get("url"), this.integrationId = t3, this.publicKey = i2, this.privateKey = r2, this.formOptionsConfig = { addButton: true, addSuccessScreen: true, questionFormat: "standard", answerDelimiter: s.DEFAULT_ANSWER_DELIMITER, resume: true, allowBack: false, emptyAnswerText: "" }, this.selector = "", this.language = "en", this.product = { customIcons: false }, this.sessionId = "", this.conversation = [], this.askedRefs = [], this.currentTurn = 1, this.maxTurns = 0, this.currentQuestion = null, this.questionHistory = [], this.busy = false, this.rateLimitTimer = null, this.progress = 0, this.total = 0, this.completed = false, this.timeToCompleted = 0;
|
|
364
|
+
}
|
|
365
|
+
generate(e3, t3 = {}) {
|
|
366
|
+
var i2;
|
|
367
|
+
return r(this, void 0, void 0, (function* () {
|
|
368
|
+
this.formOptionsConfig = Object.assign(Object.assign({}, this.formOptionsConfig), t3), this.selector = e3, t3.lang && (this.language = t3.lang), t3.primaryColor && (this.primaryColor = t3.primaryColor), this.config.get("dryRun") && this.log.log("dryRun has no effect in agent mode: the server drives the conversation");
|
|
369
|
+
try {
|
|
370
|
+
const e4 = false !== this.formOptionsConfig.resume ? this.restore() : null;
|
|
371
|
+
if (e4) this.log.log(`Resuming agent session ${e4.sessionId} at turn ${e4.currentTurn}`), this.mountForm(), this.renderStep();
|
|
372
|
+
else {
|
|
373
|
+
const e5 = yield this.startWithRetry();
|
|
374
|
+
this.sessionId = e5.sessionId, this.maxTurns = e5.maxTurns, this.currentTurn = null !== (i2 = e5.currentTurn) && void 0 !== i2 ? i2 : 1, this.total = Math.max(this.maxTurns - 1, 0);
|
|
375
|
+
const t4 = (0, s.toAgentStep)(e5, this.adapterContext());
|
|
376
|
+
if (this.mountForm(), "END" === t4.kind) return yield this.renderEnd(t4), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, sessionId: this.sessionId, completed: true })));
|
|
377
|
+
this.acceptQuestion(t4), this.renderStep(), this.persist();
|
|
378
|
+
}
|
|
379
|
+
this.timeToCompleted = Date.now(), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, sessionId: this.sessionId, formOptionsConfig: this.formOptionsConfig }));
|
|
380
|
+
} catch (e4) {
|
|
381
|
+
this.log.err(`Could not start the agent survey ${this.integrationId}:`, e4), this.renderFatal(e4), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
|
|
382
|
+
}
|
|
383
|
+
}));
|
|
384
|
+
}
|
|
385
|
+
next() {
|
|
386
|
+
return r(this, void 0, void 0, (function* () {
|
|
387
|
+
return this.runTurn();
|
|
388
|
+
}));
|
|
389
|
+
}
|
|
390
|
+
answer() {
|
|
391
|
+
const e3 = document.getElementById(this.formId());
|
|
392
|
+
return e3 ? (0, l.scrapeInputs)(e3) : [];
|
|
393
|
+
}
|
|
394
|
+
getConversation() {
|
|
395
|
+
return [...this.conversation];
|
|
396
|
+
}
|
|
397
|
+
getSessionId() {
|
|
398
|
+
return this.sessionId;
|
|
399
|
+
}
|
|
400
|
+
reset() {
|
|
401
|
+
this.sessionId = "", this.conversation = [], this.askedRefs = [], this.currentTurn = 1, this.maxTurns = 0, this.currentQuestion = null, this.questionHistory = [], this.busy = false, this.completed = false, this.progress = 0, this.clearRateLimitTimer(), this.clearPersisted();
|
|
402
|
+
}
|
|
403
|
+
runTurn() {
|
|
404
|
+
var e3;
|
|
405
|
+
return r(this, void 0, void 0, (function* () {
|
|
406
|
+
if (this.busy || this.completed || !this.currentQuestion) return;
|
|
407
|
+
this.busy = true, this.setSubmitDisabled(true), this.clearError();
|
|
408
|
+
const t3 = this.currentQuestion;
|
|
409
|
+
try {
|
|
410
|
+
const i2 = document.getElementById(this.formId()), r2 = document.getElementById(this.questionsId());
|
|
411
|
+
if (!i2) throw new Error("Agent form not found");
|
|
412
|
+
yield (0, c.awaitUploadReady)(r2);
|
|
413
|
+
const n2 = (0, l.scrapeInputs)(i2);
|
|
414
|
+
let o2 = (0, s.encodeAnswer)(n2, t3, this.formOptionsConfig.answerDelimiter);
|
|
415
|
+
if ("" === o2) {
|
|
416
|
+
if (t3.require) return void this.showError(this.formOptionsConfig.requiredMessage || (0, p.t)(this.language, "message.required"));
|
|
417
|
+
o2 = this.formOptionsConfig.emptyAnswerText || "";
|
|
418
|
+
}
|
|
419
|
+
this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
|
|
420
|
+
const d2 = { role: "user", content: o2, questionType: t3.type, questionRef: t3.ref }, u2 = this.currentTurn + 1, m = yield (0, a.nextAgentTurn)(this.url, { publicKey: this.publicKey, privateKey: this.privateKey, integrationId: this.integrationId, sessionId: this.sessionId, conversation: [...this.conversation], currentTurn: u2, lastAnswer: o2, lastQuestionRef: t3.ref, askedRefs: [...this.askedRefs] }, this.log);
|
|
421
|
+
this.conversation.push(d2), this.currentTurn = null !== (e3 = m.currentTurn) && void 0 !== e3 ? e3 : u2, m.maxTurns && (this.maxTurns = m.maxTurns), this.total = Math.max(this.maxTurns - 1, 0);
|
|
422
|
+
const h = (0, s.toAgentStep)(m, this.adapterContext());
|
|
423
|
+
if ("END" === h.kind) return void (yield this.renderEnd(h));
|
|
424
|
+
if (this.maxTurns > 0 && this.currentTurn > this.maxTurns + 1) return void (yield this.renderEnd({ kind: "END", reason: "MAX_TURNS", currentTurn: this.currentTurn, maxTurns: this.maxTurns }));
|
|
425
|
+
this.acceptQuestion(h), this.renderStep(), this.persist(), this.formOptionsConfig.onAgentTurnEvent && (yield this.formOptionsConfig.onAgentTurnEvent({ turn: this.currentTurn, maxTurns: this.maxTurns, question: h.question, isFromBase: h.isFromBase, topic: h.topic, coverageGaps: h.coverageGaps, coverageSummary: h.coverageSummary, conversation: this.getConversation() })), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.sessionId, loading: false, progress: this.progress, total: this.total, completed: false, error: null }));
|
|
426
|
+
} catch (e4) {
|
|
427
|
+
yield this.handleTurnError(e4);
|
|
428
|
+
} finally {
|
|
429
|
+
this.completed || (this.busy = false, this.rateLimitTimer || this.setSubmitDisabled(false));
|
|
430
|
+
}
|
|
431
|
+
}));
|
|
432
|
+
}
|
|
433
|
+
handleTurnError(e3) {
|
|
434
|
+
return r(this, void 0, void 0, (function* () {
|
|
435
|
+
this.log.err(`An error occurred during the agent turn ${this.integrationId}:`, e3), e3 instanceof o.AgentApiError && "RATE_LIMITED" === e3.kind ? this.startRateLimitCountdown(e3.retryAfterMs || 6e4) : this.showError(this.errorMessageFor(e3)), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, completed: false, error: e3 }));
|
|
436
|
+
}));
|
|
437
|
+
}
|
|
438
|
+
acceptQuestion(e3) {
|
|
439
|
+
const t3 = e3.question;
|
|
440
|
+
e3.isFromBase && t3.ref && !this.askedRefs.includes(t3.ref) && this.askedRefs.push(t3.ref), this.conversation.push({ role: "agent", content: t3.title, questionType: t3.type, questionRef: t3.ref }), this.currentQuestion = t3, this.questionHistory.push(t3), this.progress = Math.max(this.currentTurn - 1, 0);
|
|
441
|
+
}
|
|
442
|
+
formId() {
|
|
443
|
+
return "magicfeedback-agent-" + this.integrationId;
|
|
444
|
+
}
|
|
445
|
+
questionsId() {
|
|
446
|
+
return "magicfeedback-agent-questions-" + this.integrationId;
|
|
447
|
+
}
|
|
448
|
+
mountForm() {
|
|
449
|
+
const e3 = (0, d.generateContainer)(this.selector, this.integrationId);
|
|
450
|
+
this.primaryColor && (0, d.applyPrimaryColor)(e3, this.primaryColor), (0, d.applyDirection)(e3, this.language);
|
|
451
|
+
const t3 = document.createElement("form");
|
|
452
|
+
t3.classList.add("magicfeedback-form"), t3.classList.add("magicfeedback-agent-form"), t3.id = this.formId(), t3.addEventListener("submit", ((e4) => {
|
|
453
|
+
e4.preventDefault(), this.runTurn();
|
|
454
|
+
}));
|
|
455
|
+
const i2 = document.createElement("div");
|
|
456
|
+
i2.classList.add("magicfeedback-questions"), i2.id = this.questionsId(), t3.appendChild(i2), this.formOptionsConfig.addButton && t3.appendChild((0, u.renderActions)(this.formOptionsConfig.allowBack ? "MAGICSURVEY" : "MAGICFORM", (() => this.back()), this.formOptionsConfig.sendButtonText || (0, p.t)(this.language, "action.send"), this.formOptionsConfig.backButtonText || (0, p.t)(this.language, "action.back"), this.formOptionsConfig.nextButtonText || (0, p.t)(this.language, "action.next"))), e3.appendChild(t3);
|
|
457
|
+
}
|
|
458
|
+
renderStep() {
|
|
459
|
+
const e3 = document.getElementById(this.questionsId());
|
|
460
|
+
e3 && this.currentQuestion && (e3.innerHTML = "", (0, u.renderQuestions)([this.currentQuestion], this.formOptionsConfig.questionFormat, this.language, this.product, (() => this.runTurn())).forEach(((t3) => e3.appendChild(t3))));
|
|
461
|
+
}
|
|
462
|
+
renderEnd(e3) {
|
|
463
|
+
return r(this, void 0, void 0, (function* () {
|
|
464
|
+
this.completed = true, this.currentQuestion = null, this.busy = false, this.timeToCompleted = this.timeToCompleted ? Date.now() - this.timeToCompleted : 0, this.clearRateLimitTimer(), this.clearPersisted();
|
|
465
|
+
const t3 = document.getElementById("magicfeedback-container-" + this.integrationId);
|
|
466
|
+
if (t3 && false !== this.formOptionsConfig.addSuccessScreen) {
|
|
467
|
+
t3.innerHTML = "";
|
|
468
|
+
const i2 = "BLOCKED" === e3.reason ? this.formOptionsConfig.blockedMessage || (0, p.t)(this.language, "message.blocked") : this.formOptionsConfig.successMessage || (0, p.t)(this.language, "message.success"), r2 = (0, u.renderSuccess)(i2);
|
|
469
|
+
r2.classList.add("magicfeedback-success-message"), r2.classList.add("magicfeedback-agent-end"), "BLOCKED" === e3.reason && r2.classList.add("magicfeedback-agent-end--blocked"), t3.appendChild(r2);
|
|
470
|
+
}
|
|
471
|
+
this.formOptionsConfig.onFinishEvent && (yield this.formOptionsConfig.onFinishEvent({ sessionId: this.sessionId, reason: e3.reason, turns: this.currentTurn, maxTurns: this.maxTurns, conversation: this.getConversation(), coverageSummary: e3.coverageSummary, timeToCompleted: this.timeToCompleted })), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.sessionId, loading: false, progress: this.progress, total: this.total, completed: true, error: null }));
|
|
472
|
+
}));
|
|
473
|
+
}
|
|
474
|
+
back() {
|
|
475
|
+
return r(this, void 0, void 0, (function* () {
|
|
476
|
+
this.busy || this.completed || this.formOptionsConfig.allowBack && (this.questionHistory.length < 2 || (this.questionHistory.pop(), this.conversation.pop(), this.conversation.pop(), this.currentQuestion = this.questionHistory[this.questionHistory.length - 1], this.currentTurn = Math.max(this.currentTurn - 1, 1), this.progress = Math.max(this.currentTurn - 1, 0), this.clearError(), this.renderStep(), this.persist(), this.formOptionsConfig.onBackEvent && (yield this.formOptionsConfig.onBackEvent({ progress: this.progress, total: this.total }))));
|
|
477
|
+
}));
|
|
478
|
+
}
|
|
479
|
+
renderFatal(e3) {
|
|
480
|
+
try {
|
|
481
|
+
(0, d.generateContainer)(this.selector, this.integrationId).appendChild((0, u.renderError)(this.errorMessageFor(e3)));
|
|
482
|
+
} catch (e4) {
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
errorMessageFor(e3) {
|
|
486
|
+
if (!(e3 instanceof o.AgentApiError)) return "Something went wrong. Please try again.";
|
|
487
|
+
switch (e3.kind) {
|
|
488
|
+
case "AUTH":
|
|
489
|
+
case "NOT_FOUND":
|
|
490
|
+
case "BAD_CONFIG":
|
|
491
|
+
return "This survey is not available right now.";
|
|
492
|
+
case "AI_UNAVAILABLE":
|
|
493
|
+
return "We couldn't start the survey. Please try again in a moment.";
|
|
494
|
+
default:
|
|
495
|
+
return "Something went wrong. Please try again.";
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
adapterContext() {
|
|
499
|
+
return { integrationId: this.integrationId, sessionId: this.sessionId, language: this.language, log: this.log };
|
|
500
|
+
}
|
|
501
|
+
startWithRetry() {
|
|
502
|
+
return r(this, void 0, void 0, (function* () {
|
|
503
|
+
const e3 = { publicKey: this.publicKey, privateKey: this.privateKey, integrationId: this.integrationId };
|
|
504
|
+
try {
|
|
505
|
+
return yield (0, a.startAgentSurvey)(this.url, e3, this.log);
|
|
506
|
+
} catch (t3) {
|
|
507
|
+
if (t3 instanceof o.AgentApiError && "AI_UNAVAILABLE" === t3.kind) return this.log.log("Retrying /start after a transient AI failure"), yield new Promise(((e4) => setTimeout(e4, 1500))), yield (0, a.startAgentSurvey)(this.url, e3, this.log);
|
|
508
|
+
throw t3;
|
|
509
|
+
}
|
|
510
|
+
}));
|
|
511
|
+
}
|
|
512
|
+
setSubmitDisabled(e3) {
|
|
513
|
+
const t3 = document.getElementById("magicfeedback-submit");
|
|
514
|
+
t3 && (t3.disabled = e3);
|
|
515
|
+
}
|
|
516
|
+
clearError() {
|
|
517
|
+
const e3 = document.getElementById(this.questionsId());
|
|
518
|
+
null == e3 || e3.querySelectorAll(".magicfeedback-error").forEach(((e4) => e4.remove()));
|
|
519
|
+
}
|
|
520
|
+
showError(e3) {
|
|
521
|
+
const t3 = document.getElementById(this.questionsId());
|
|
522
|
+
t3 && (this.clearError(), t3.insertBefore((0, u.renderError)(e3), t3.firstChild));
|
|
523
|
+
}
|
|
524
|
+
startRateLimitCountdown(e3) {
|
|
525
|
+
this.clearRateLimitTimer(), this.setSubmitDisabled(true);
|
|
526
|
+
let t3 = Math.ceil(e3 / 1e3);
|
|
527
|
+
const i2 = this.formOptionsConfig.rateLimitMessage || (0, p.t)(this.language, "message.rateLimit"), r2 = () => {
|
|
528
|
+
if (t3 <= 0) return this.clearRateLimitTimer(), this.clearError(), void this.setSubmitDisabled(false);
|
|
529
|
+
this.showError(i2.replace("{seconds}", String(t3))), t3 -= 1;
|
|
530
|
+
};
|
|
531
|
+
r2(), this.rateLimitTimer = setInterval(r2, 1e3);
|
|
532
|
+
}
|
|
533
|
+
clearRateLimitTimer() {
|
|
534
|
+
this.rateLimitTimer && (clearInterval(this.rateLimitTimer), this.rateLimitTimer = null);
|
|
535
|
+
}
|
|
536
|
+
storageKey() {
|
|
537
|
+
return `magicfeedback-agent-${this.integrationId}`;
|
|
538
|
+
}
|
|
539
|
+
persist() {
|
|
540
|
+
if (false !== this.formOptionsConfig.resume) try {
|
|
541
|
+
const e3 = { sessionId: this.sessionId, conversation: this.conversation, currentTurn: this.currentTurn, maxTurns: this.maxTurns, askedRefs: this.askedRefs, questionHistory: this.questionHistory, savedAt: Date.now() };
|
|
542
|
+
localStorage.setItem(this.storageKey(), JSON.stringify(e3));
|
|
543
|
+
} catch (e3) {
|
|
544
|
+
this.log.log("Could not persist the agent session", e3);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
restore() {
|
|
548
|
+
var e3;
|
|
549
|
+
try {
|
|
550
|
+
const t3 = localStorage.getItem(this.storageKey());
|
|
551
|
+
if (!t3) return null;
|
|
552
|
+
const i2 = JSON.parse(t3);
|
|
553
|
+
return (null == i2 ? void 0 : i2.sessionId) && (null === (e3 = i2.questionHistory) || void 0 === e3 ? void 0 : e3.length) ? Date.now() - (i2.savedAt || 0) > 18e5 ? (this.clearPersisted(), null) : (this.sessionId = i2.sessionId, this.conversation = i2.conversation || [], this.currentTurn = i2.currentTurn || 1, this.maxTurns = i2.maxTurns || 0, this.askedRefs = i2.askedRefs || [], this.questionHistory = i2.questionHistory, this.currentQuestion = this.questionHistory[this.questionHistory.length - 1], this.total = Math.max(this.maxTurns - 1, 0), this.progress = Math.max(this.currentTurn - 1, 0), i2) : null;
|
|
554
|
+
} catch (e4) {
|
|
555
|
+
return this.log.log("Could not restore the agent session", e4), null;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
clearPersisted() {
|
|
559
|
+
try {
|
|
560
|
+
localStorage.removeItem(this.storageKey());
|
|
561
|
+
} catch (e3) {
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
applyIntegrationContext(e3) {
|
|
565
|
+
var t3, i2;
|
|
566
|
+
(null === (t3 = null == e3 ? void 0 : e3.lang) || void 0 === t3 ? void 0 : t3.length) && (this.language = e3.lang[0]), (null == e3 ? void 0 : e3.product) && (this.product = e3.product), (null === (i2 = null == e3 ? void 0 : e3.style) || void 0 === i2 ? void 0 : i2.primaryColor) && (this.primaryColor = e3.style.primaryColor);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
}, 665: (e2, t2) => {
|
|
570
|
+
"use strict";
|
|
571
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.Config = void 0, t2.Config = class {
|
|
572
|
+
constructor() {
|
|
573
|
+
this.variables = {}, this.variables.env = "prod", this.variables.debug = false, this.variables.dryRun = false;
|
|
574
|
+
}
|
|
575
|
+
get(e3) {
|
|
576
|
+
return this.variables[e3];
|
|
577
|
+
}
|
|
578
|
+
set(e3, t3) {
|
|
579
|
+
this.variables[e3] = t3;
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
}, 57: function(e2, t2, i) {
|
|
583
|
+
"use strict";
|
|
584
|
+
var r = this && this.__awaiter || function(e3, t3, i2, r2) {
|
|
585
|
+
return new (i2 || (i2 = Promise))((function(n2, o2) {
|
|
586
|
+
function a2(e4) {
|
|
587
|
+
try {
|
|
588
|
+
l2(r2.next(e4));
|
|
589
|
+
} catch (e5) {
|
|
590
|
+
o2(e5);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function s2(e4) {
|
|
594
|
+
try {
|
|
595
|
+
l2(r2.throw(e4));
|
|
596
|
+
} catch (e5) {
|
|
597
|
+
o2(e5);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function l2(e4) {
|
|
601
|
+
var t4;
|
|
602
|
+
e4.done ? n2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
603
|
+
e5(t4);
|
|
604
|
+
}))).then(a2, s2);
|
|
605
|
+
}
|
|
606
|
+
l2((r2 = r2.apply(e3, t3 || [])).next());
|
|
607
|
+
}));
|
|
608
|
+
};
|
|
609
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.Form = void 0;
|
|
610
|
+
const n = i(558), o = i(544), a = i(256), s = i(313), l = i(213), d = i(571), c = i(565), u = i(107), p = i(989), m = i(700), h = i(591), f = i(79), g = i(636), y = i(881);
|
|
611
|
+
t2.Form = class {
|
|
612
|
+
constructor(e3, t3, i2, r2, n2) {
|
|
613
|
+
this.config = e3, this.log = new a.Log(e3), this.formOptionsConfig = { addButton: true, addSuccessScreen: true, getMetaData: true, customMetaData: [], questionFormat: "standard" }, this.selector = "", this.appId = t3, this.publicKey = i2 || "", this.url = e3.get("url"), this.id = "", this.formData = null, this.feedback = { text: "", answers: [], profile: null != r2 ? r2 : [], metrics: [], metadata: null != n2 ? n2 : [] }, this.history = new f.History(), this.agentForm = null, this.graph = new p.PageGraph([]), this.progress = 0, this.total = 0, this.completed = false, this.timeToCompleted = 0;
|
|
614
|
+
}
|
|
615
|
+
generate(e3, t3) {
|
|
616
|
+
var i2, n2, a2, l2, d2, c2, u2;
|
|
617
|
+
return r(this, void 0, void 0, (function* () {
|
|
618
|
+
try {
|
|
619
|
+
this.formOptionsConfig = Object.assign(Object.assign({}, this.formOptionsConfig), t3), this.selector = e3;
|
|
620
|
+
let r2 = this.formData;
|
|
621
|
+
if (void 0 !== this.formData && this.formData || (r2 = "" !== this.publicKey ? yield (0, s.getForm)(this.url, this.appId, this.publicKey, this.log) : yield (0, s.getSessionForm)(this.url, this.appId, this.log)), void 0 === r2 || !r2) throw new Error(`No data for app ${this.appId}`);
|
|
622
|
+
if (null === (i2 = r2.error) || void 0 === i2 ? void 0 : i2.message) throw new Error(r2.error.message);
|
|
623
|
+
if ("AGENT" === r2.mode) return this.agentForm = new o.AgentForm(this.config, this.appId, this.publicKey), this.agentForm.applyIntegrationContext(r2), void (yield this.agentForm.generate(e3, t3));
|
|
624
|
+
if (r2.questions = (null === (n2 = r2.questions) || void 0 === n2 ? void 0 : n2.filter(((e4) => "ACTIVE" === e4.status))) || [], r2.pages = (null === (a2 = r2.pages) || void 0 === a2 ? void 0 : a2.filter(((e4) => "ACTIVE" === e4.status))) || [], null === (l2 = r2.pages) || void 0 === l2 || l2.forEach(((e4) => {
|
|
625
|
+
var t4;
|
|
626
|
+
return e4.integrationQuestions = null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.filter(((e5) => "ACTIVE" === e5.status));
|
|
627
|
+
})), this.formData = r2, this.formData.savedAt || (this.formData.savedAt = /* @__PURE__ */ new Date(), localStorage.setItem(`magicfeedback-${this.appId}`, JSON.stringify(this.formData))), void 0 === this.formData.questions || !this.formData.questions) throw new Error(`No questions for app ${this.appId}`);
|
|
628
|
+
this.formData.pages && 0 !== (null === (d2 = this.formData.pages) || void 0 === d2 ? void 0 : d2.length) || this.formatPages(), null === (c2 = this.formData.questions) || void 0 === c2 || c2.sort(((e4, t4) => e4.position - t4.position)), this.formData.pages = this.formData.pages.filter(((e4) => {
|
|
629
|
+
var t4;
|
|
630
|
+
return (null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.length) > 0;
|
|
631
|
+
})), this.formOptionsConfig.getMetaData && this.getMetaData(), (null === (u2 = this.formData.style) || void 0 === u2 ? void 0 : u2.startMessage) ? yield this.generateWelcomeMessage(this.formData.style.startMessage) : this.startForm();
|
|
632
|
+
} catch (e4) {
|
|
633
|
+
return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 })));
|
|
634
|
+
}
|
|
635
|
+
}));
|
|
636
|
+
}
|
|
637
|
+
previewPage(e3, t3, i2 = {}) {
|
|
638
|
+
var n2, o2, a2, s2, l2, d2, c2, u2, p2;
|
|
639
|
+
return r(this, void 0, void 0, (function* () {
|
|
640
|
+
try {
|
|
641
|
+
if (!t3 || !t3.page) throw new Error("[MagicFeedback] No page provided for preview");
|
|
642
|
+
if (!t3.page.integrationQuestions || 0 === t3.page.integrationQuestions.length) throw new Error("[MagicFeedback] No questions provided for preview");
|
|
643
|
+
this.config.set("dryRun", true), this.formOptionsConfig = Object.assign(Object.assign(Object.assign({}, this.formOptionsConfig), { getMetaData: false }), i2), this.selector = e3;
|
|
644
|
+
const r2 = (t3.page.integrationQuestions || []).filter(((e4) => !e4.status || "ACTIVE" === e4.status)).sort(((e4, t4) => e4.position - t4.position)), h2 = new m.Page(null !== (n2 = t3.page.id) && void 0 !== n2 ? n2 : "1", null !== (o2 = t3.page.position) && void 0 !== o2 ? o2 : 1, null !== (a2 = t3.appId) && void 0 !== a2 ? a2 : this.appId, r2, null !== (s2 = t3.page.integrationPageRoutes) && void 0 !== s2 ? s2 : []);
|
|
645
|
+
this.formData = { id: null !== (l2 = t3.appId) && void 0 !== l2 ? l2 : this.appId, identity: null !== (d2 = t3.identity) && void 0 !== d2 ? d2 : "MAGICFORM", lang: [null !== (c2 = t3.lang) && void 0 !== c2 ? c2 : "en"], product: null !== (u2 = t3.product) && void 0 !== u2 ? u2 : { customIcons: false }, style: null !== (p2 = t3.style) && void 0 !== p2 ? p2 : {}, questions: r2, pages: [h2] }, yield this.generateForm();
|
|
646
|
+
} catch (e4) {
|
|
647
|
+
return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 })));
|
|
648
|
+
}
|
|
649
|
+
}));
|
|
650
|
+
}
|
|
651
|
+
formatPages() {
|
|
652
|
+
var e3;
|
|
653
|
+
if (this.formData) switch (this.formData.identity) {
|
|
654
|
+
case "MAGICSURVEY":
|
|
655
|
+
this.formData.pages = [], null === (e3 = this.formData.questions) || void 0 === e3 || e3.forEach(((e4) => {
|
|
656
|
+
var t4, i2;
|
|
657
|
+
const r2 = new h.PageRoute(e4.id, e4.ref, h.OperatorType.NOEQUAL, [], h.TransitionType.PAGE, (e4.position + 1).toString(), e4.position.toString()), n2 = new m.Page(e4.position.toString(), e4.position, this.appId, [e4], [r2]);
|
|
658
|
+
null === (i2 = null === (t4 = this.formData) || void 0 === t4 ? void 0 : t4.pages) || void 0 === i2 || i2.push(n2);
|
|
659
|
+
}));
|
|
660
|
+
break;
|
|
661
|
+
case "MAGICFORM":
|
|
662
|
+
const t3 = new m.Page("1", 1, this.appId, this.formData.questions, []);
|
|
663
|
+
this.formData.pages = [t3];
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
generateContainer() {
|
|
667
|
+
var e3, t3;
|
|
668
|
+
const i2 = (0, c.generateContainer)(this.selector, this.appId), r2 = null === (t3 = null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.style) || void 0 === t3 ? void 0 : t3.primaryColor;
|
|
669
|
+
return r2 && (0, c.applyPrimaryColor)(i2, r2), (0, c.applyDirection)(i2, this.lang()), i2;
|
|
670
|
+
}
|
|
671
|
+
generateForm() {
|
|
672
|
+
var e3, t3, i2, n2;
|
|
673
|
+
return r(this, void 0, void 0, (function* () {
|
|
674
|
+
try {
|
|
675
|
+
if (!this.formData || !this.formData.pages || 0 === this.formData.pages.length) throw new Error("No form data");
|
|
676
|
+
this.graph = new p.PageGraph(this.formData.pages.sort(((e4, t4) => e4.position - t4.position)));
|
|
677
|
+
let r2 = this.generateContainer();
|
|
678
|
+
const o2 = document.createElement("form");
|
|
679
|
+
o2.classList.add("magicfeedback-form"), o2.id = "magicfeedback-" + this.appId, o2.addEventListener("submit", ((e4) => e4.preventDefault()));
|
|
680
|
+
const a2 = document.createElement("div");
|
|
681
|
+
a2.classList.add("magicfeedback-questions"), a2.id = "magicfeedback-questions-" + this.appId;
|
|
682
|
+
const s2 = this.graph.getFirstPage();
|
|
683
|
+
if (!s2) throw new Error("No page found");
|
|
684
|
+
if (this.total = this.graph.findMaxDepth(), s2.elements = (0, l.renderQuestions)(s2.questions, this.formOptionsConfig.questionFormat, null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.lang[0], null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.product, (() => this.send())), null === (i2 = s2.elements) || void 0 === i2 || i2.forEach(((e4) => a2.appendChild(e4))), o2.appendChild(a2), this.history.enqueue(s2), r2.appendChild(o2), this.progress = this.total - this.graph.findMaxDepth(s2), this.formOptionsConfig.addButton) {
|
|
685
|
+
const e4 = (0, l.renderActions)(null === (n2 = this.formData) || void 0 === n2 ? void 0 : n2.identity, (() => this.back()), this.formOptionsConfig.sendButtonText || (0, y.t)(this.lang(), "action.send"), this.formOptionsConfig.backButtonText || (0, y.t)(this.lang(), "action.back"), this.formOptionsConfig.nextButtonText || (0, y.t)(this.lang(), "action.next"));
|
|
686
|
+
o2.appendChild(e4);
|
|
687
|
+
}
|
|
688
|
+
this.formOptionsConfig.addButton && o2.addEventListener("submit", ((e4) => {
|
|
689
|
+
e4.preventDefault(), this.send();
|
|
690
|
+
})), this.timeToCompleted = Date.now(), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, formData: this.formData, formOptionsConfig: this.formOptionsConfig }));
|
|
691
|
+
} catch (e4) {
|
|
692
|
+
return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
|
|
693
|
+
}
|
|
694
|
+
}));
|
|
695
|
+
}
|
|
696
|
+
startForm() {
|
|
697
|
+
this.generateForm();
|
|
698
|
+
}
|
|
699
|
+
lang() {
|
|
700
|
+
var e3;
|
|
701
|
+
return (null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.lang) && this.formData.lang[0] || "en";
|
|
702
|
+
}
|
|
703
|
+
generateWelcomeMessage(e3) {
|
|
704
|
+
return r(this, void 0, void 0, (function* () {
|
|
705
|
+
try {
|
|
706
|
+
const t3 = this.generateContainer(), i2 = (0, l.renderStartMessage)(e3, this.formOptionsConfig.addButton, this.formOptionsConfig.startButtonText || (0, y.t)(this.lang(), "action.start"), (() => this.startForm()));
|
|
707
|
+
t3.appendChild(i2), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, formData: this.formData }));
|
|
708
|
+
} catch (e4) {
|
|
709
|
+
return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
|
|
710
|
+
}
|
|
711
|
+
}));
|
|
712
|
+
}
|
|
713
|
+
getMetaData() {
|
|
714
|
+
this.formOptionsConfig.customMetaData && (this.feedback.metadata = [...this.feedback.metadata, ...this.formOptionsConfig.customMetaData]), this.feedback.metadata.push({ key: "navigator-url", value: [window.location.href] }), this.feedback.metadata.push({ key: "navigator-origin", value: [window.location.origin] }), this.feedback.metadata.push({ key: "navigator-pathname", value: [window.location.pathname] }), this.feedback.metadata.push({ key: "navigator-search", value: [window.location.search] });
|
|
715
|
+
const e3 = new URLSearchParams(window.location.search);
|
|
716
|
+
Array.from(new Set(e3.keys())).forEach(((t3) => {
|
|
717
|
+
const i2 = e3.getAll(t3);
|
|
718
|
+
i2.length > 0 && this.feedback.metadata.push({ key: `query-${t3}`, value: i2 });
|
|
719
|
+
})), this.feedback.metadata.push({ key: "navigator-user", value: [navigator.userAgent] }), this.feedback.metadata.push({ key: "navigator-language", value: [navigator.language] }), this.feedback.metadata.push({ key: "navigator-platform", value: [navigator.platform] }), this.feedback.metadata.push({ key: "navigator-appVersion", value: [navigator.appVersion] }), this.feedback.metadata.push({ key: "navigator-appName", value: [navigator.appName] }), this.feedback.metadata.push({ key: "navigator-product", value: [navigator.product] }), this.feedback.metadata.push({ key: "screen-width", value: [window.screen.width.toString()] }), this.feedback.metadata.push({ key: "screen-height", value: [window.screen.height.toString()] }), this.appId && "" === this.publicKey && this.feedback.metadata.push({ key: "MAGICFEEDBACK_SESSION", value: [this.appId] });
|
|
720
|
+
}
|
|
721
|
+
send(e3, t3, i2, o2) {
|
|
722
|
+
return r(this, void 0, void 0, (function* () {
|
|
723
|
+
if (this.agentForm) return this.agentForm.next();
|
|
724
|
+
const r2 = document.getElementById("magicfeedback-questions-" + this.appId);
|
|
725
|
+
try {
|
|
726
|
+
if (i2 && (this.feedback.profile = [...this.feedback.profile, ...i2]), t3 && (this.feedback.metrics = [...this.feedback.metrics, ...t3]), e3 && (this.feedback.metadata = [...this.feedback.metadata, ...e3]), o2) {
|
|
727
|
+
this.feedback.answers = [...this.feedback.answers, ...o2], this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
|
|
728
|
+
const e4 = yield this.pushAnswers(false);
|
|
729
|
+
if (!e4) throw new Error("No response");
|
|
730
|
+
return this.id = e4, void (this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total })));
|
|
731
|
+
}
|
|
732
|
+
yield (0, d.awaitUploadReady)(r2), this.answer(), this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
|
|
733
|
+
const a2 = this.history.back();
|
|
734
|
+
if (!a2) throw new Error("No page found");
|
|
735
|
+
for (const e4 of a2.questions.filter(((e5) => e5.require && ![n.FEEDBACKAPPANSWERTYPE.CONSENT, n.FEEDBACKAPPANSWERTYPE.INFO_PAGE].includes(e5.type)))) {
|
|
736
|
+
const t4 = e4.assets, i3 = this.feedback.answers.filter(((t5) => t5.key.includes(e4.ref) && !t5.key.includes("extra-option")));
|
|
737
|
+
if (0 === i3.length || i3.find(((e5) => 0 === e5.value.length))) throw this.log.err(`The question ${e4.ref} is required`), new Error("No response");
|
|
738
|
+
if (null == t4 ? void 0 : t4.minOptions) {
|
|
739
|
+
let r3 = [];
|
|
740
|
+
if ((null == t4 ? void 0 : t4.exclusiveAnswers) && (r3 = null == t4 ? void 0 : t4.exclusiveAnswers), !i3[0].value.find(((e5) => r3.includes(e5))) && i3[0].value.length < (null == t4 ? void 0 : t4.minOptions)) throw this.log.err(`The question ${e4.ref} requires at least ${null == t4 ? void 0 : t4.minOptions} options`), new Error("No response");
|
|
741
|
+
}
|
|
742
|
+
if (e4.type === n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) {
|
|
743
|
+
const i4 = this.feedback.answers.find(((t5) => t5.key === e4.ref));
|
|
744
|
+
if (!i4) throw this.log.err(`The matrix question ${e4.ref} is required`), new Error("No response");
|
|
745
|
+
const r3 = this.parseMatrixAnswerPre(i4), n2 = Array.isArray(null == t4 ? void 0 : t4.options) ? t4.options : [];
|
|
746
|
+
if (n2.length > 0) {
|
|
747
|
+
if (n2.find(((e5) => {
|
|
748
|
+
const t5 = r3.find(((t6) => t6.key === e5));
|
|
749
|
+
return !t5 || !Array.isArray(t5.value) || 0 === t5.value.length;
|
|
750
|
+
}))) throw this.log.err(`The matrix question ${e4.ref} requires an answer in every row`), new Error("No response");
|
|
751
|
+
} else if (0 === r3.length || r3.some(((e5) => !Array.isArray(e5.value) || 0 === e5.value.length))) throw this.log.err(`The matrix question ${e4.ref} requires an answer in every row`), new Error("No response");
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
const s2 = yield this.pushAnswers(false);
|
|
755
|
+
if (!s2) throw new Error("No response");
|
|
756
|
+
this.id = s2, yield this.processNextQuestion(r2);
|
|
757
|
+
} catch (e4) {
|
|
758
|
+
this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, error: e4 }));
|
|
759
|
+
}
|
|
760
|
+
}));
|
|
761
|
+
}
|
|
762
|
+
answer() {
|
|
763
|
+
const e3 = document.getElementById("magicfeedback-" + this.appId);
|
|
764
|
+
if (!e3) return this.log.err(`Form "${e3}" not found.`), this.feedback.answers = [], [];
|
|
765
|
+
const t3 = this.history.back();
|
|
766
|
+
if (!t3) return this.feedback.answers = (0, u.scrapeInputs)(e3), this.feedback.answers;
|
|
767
|
+
const i2 = [];
|
|
768
|
+
let r2 = false;
|
|
769
|
+
const o2 = e3.querySelectorAll(".magicfeedback-input"), a2 = {}, l2 = {}, c2 = {};
|
|
770
|
+
if (o2.forEach(((e4) => {
|
|
771
|
+
const o3 = e4, u2 = t3.questions.find(((e5) => {
|
|
772
|
+
var t4;
|
|
773
|
+
return null === (t4 = o3.name) || void 0 === t4 ? void 0 : t4.includes(e5.ref);
|
|
774
|
+
})), p2 = o3.type, m2 = o3.classList[0], h2 = { key: o3.name, value: [] }, f2 = "magicfeedback-consent" === m2 ? o3.checked.toString() : o3.value;
|
|
775
|
+
if (h2.key && "" !== h2.key) if (h2.key.startsWith("extra-option-")) "" !== f2 && (h2.value.push(f2), i2.push(h2));
|
|
776
|
+
else switch (null == u2 ? void 0 : u2.type) {
|
|
777
|
+
case n.FEEDBACKAPPANSWERTYPE.EMAIL:
|
|
778
|
+
case n.FEEDBACKAPPANSWERTYPE.TEXT:
|
|
779
|
+
case n.FEEDBACKAPPANSWERTYPE.LONGTEXT:
|
|
780
|
+
case n.FEEDBACKAPPANSWERTYPE.NUMBER:
|
|
781
|
+
case n.FEEDBACKAPPANSWERTYPE.DATE:
|
|
782
|
+
case n.FEEDBACKAPPANSWERTYPE.CONTACT:
|
|
783
|
+
case n.FEEDBACKAPPANSWERTYPE.PASSWORD:
|
|
784
|
+
"" !== f2 && ("email" === p2 ? (0, s.validateEmail)(f2) ? (this.feedback.profile.push({ key: "email", value: [f2] }), h2.value.push(f2), i2.push(h2)) : (this.log.err("Invalid email"), r2 = true) : (h2.value.push(f2), i2.push(h2)));
|
|
785
|
+
break;
|
|
786
|
+
case n.FEEDBACKAPPANSWERTYPE.RADIO:
|
|
787
|
+
o3.checked && (h2.value.push(f2), i2.push(h2));
|
|
788
|
+
break;
|
|
789
|
+
case n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE:
|
|
790
|
+
case n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE:
|
|
791
|
+
o3.checked && (l2[h2.key] || (l2[h2.key] = []), l2[h2.key].push(f2));
|
|
792
|
+
break;
|
|
793
|
+
case n.FEEDBACKAPPANSWERTYPE.BOOLEAN:
|
|
794
|
+
o3.checked && (h2.value.push(f2), i2.push(h2));
|
|
795
|
+
break;
|
|
796
|
+
case n.FEEDBACKAPPANSWERTYPE.CONSENT:
|
|
797
|
+
h2.value.push(o3.checked.toString()), i2.push(h2);
|
|
798
|
+
break;
|
|
799
|
+
case n.FEEDBACKAPPANSWERTYPE.RATING_EMOJI:
|
|
800
|
+
case n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER:
|
|
801
|
+
case n.FEEDBACKAPPANSWERTYPE.RATING_STAR:
|
|
802
|
+
o3.checked && (h2.value.push(f2), i2.push(h2));
|
|
803
|
+
break;
|
|
804
|
+
case n.FEEDBACKAPPANSWERTYPE.SELECT:
|
|
805
|
+
"" !== f2 && (h2.value.push(f2), i2.push(h2));
|
|
806
|
+
break;
|
|
807
|
+
case n.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM:
|
|
808
|
+
"number" === p2 && o3.id && (c2[h2.key] || (c2[h2.key] = []), "" !== f2 && c2[h2.key].push(`${o3.id}:${f2}%`));
|
|
809
|
+
break;
|
|
810
|
+
case n.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST:
|
|
811
|
+
"hidden" === p2 && (a2[h2.key] || (a2[h2.key] = []), a2[h2.key].push(f2));
|
|
812
|
+
break;
|
|
813
|
+
case n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX:
|
|
814
|
+
e4.checked && (h2.value.push(f2), i2.push(h2));
|
|
815
|
+
break;
|
|
816
|
+
case n.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE:
|
|
817
|
+
case n.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE: {
|
|
818
|
+
const e5 = (0, d.getUploadValues)(o3);
|
|
819
|
+
e5.length && (h2.value.push(...e5), i2.push(h2));
|
|
820
|
+
break;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
})), r2) return [];
|
|
824
|
+
Object.entries(l2).forEach((([e4, t4]) => {
|
|
825
|
+
t4 && 0 !== t4.length && i2.push({ key: e4, value: t4 });
|
|
826
|
+
})), Object.entries(c2).forEach((([e4, t4]) => {
|
|
827
|
+
t4 && 0 !== t4.length && i2.push({ key: e4, value: t4 });
|
|
828
|
+
})), Object.entries(a2).forEach((([e4, t4]) => {
|
|
829
|
+
if (!t4 || 0 === t4.length) return;
|
|
830
|
+
const r3 = t4.slice().sort(((e5, t5) => Number(e5.split(".")[0]) - Number(t5.split(".")[0])));
|
|
831
|
+
i2.push({ key: e4, value: r3 });
|
|
832
|
+
}));
|
|
833
|
+
try {
|
|
834
|
+
t3.questions.filter(((e4) => e4.type === n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX)).forEach(((e4) => {
|
|
835
|
+
const t4 = e4.ref + "-", r3 = i2.filter(((e5) => e5.key.startsWith(t4)));
|
|
836
|
+
if (0 === r3.length) return;
|
|
837
|
+
const n2 = r3.map(((e5) => ({ key: e5.key.substring(t4.length), value: e5.value }))), o3 = { key: e4.ref, value: [JSON.stringify(n2)] };
|
|
838
|
+
for (const e5 of r3) {
|
|
839
|
+
const t5 = i2.findIndex(((t6) => t6.key === e5.key));
|
|
840
|
+
-1 !== t5 && i2.splice(t5, 1);
|
|
841
|
+
}
|
|
842
|
+
const a3 = i2.findIndex(((t5) => t5.key === e4.ref));
|
|
843
|
+
-1 !== a3 ? i2[a3] = o3 : i2.push(o3);
|
|
844
|
+
}));
|
|
845
|
+
} catch (e4) {
|
|
846
|
+
this.log.err("Error agrupando MULTI_QUESTION_MATRIX", e4);
|
|
847
|
+
}
|
|
848
|
+
return this.feedback.answers = i2, t3.setAnswer(i2), i2;
|
|
849
|
+
}
|
|
850
|
+
finish() {
|
|
851
|
+
return r(this, void 0, void 0, (function* () {
|
|
852
|
+
if (this.completed = true, this.timeToCompleted = Date.now() - this.timeToCompleted, this.feedback.metadata.push({ key: "time-to-complete", value: [this.timeToCompleted.toString()] }), this.formOptionsConfig.addSuccessScreen) {
|
|
853
|
+
const e3 = document.getElementById("magicfeedback-container-" + this.appId);
|
|
854
|
+
e3.childNodes.length > 0 && e3.removeChild(e3.childNodes[0]);
|
|
855
|
+
const t3 = (0, l.renderSuccess)(this.formOptionsConfig.successMessage || (0, y.t)(this.lang(), "message.success"));
|
|
856
|
+
e3.appendChild(t3);
|
|
857
|
+
}
|
|
858
|
+
this.answer();
|
|
859
|
+
try {
|
|
860
|
+
const e3 = yield this.pushAnswers(true);
|
|
861
|
+
if (!e3) throw this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, completed: this.completed, error: `An error occurred while submitting the form ${this.appId}:` })), new Error("An error occurred while submitting the form ${this.appId}:");
|
|
862
|
+
this.id = e3, this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, completed: this.completed, error: null }));
|
|
863
|
+
} catch (e3) {
|
|
864
|
+
this.log.err(`An error occurred while submitting the form ${this.appId}:`, e3), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, completed: this.completed, error: e3 }));
|
|
865
|
+
}
|
|
866
|
+
}));
|
|
867
|
+
}
|
|
868
|
+
pushAnswers(e3 = false) {
|
|
869
|
+
return r(this, void 0, void 0, (function* () {
|
|
870
|
+
try {
|
|
871
|
+
if (this.config.get("dryRun")) {
|
|
872
|
+
const e4 = this.id || `dry-run-${this.appId}-${Date.now()}`;
|
|
873
|
+
return this.log.log(`Dry run enabled: skipping feedback submit for form ${this.appId}`), e4;
|
|
874
|
+
}
|
|
875
|
+
const t3 = this.config.get("url"), i2 = { integration: this.appId, publicKey: this.publicKey, feedback: this.feedback, completed: e3 };
|
|
876
|
+
return yield (0, s.sendFeedback)(t3, this.id ? Object.assign(Object.assign({}, i2), { sessionId: this.id }) : i2, this.log);
|
|
877
|
+
} catch (e4) {
|
|
878
|
+
return this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), "";
|
|
879
|
+
}
|
|
880
|
+
}));
|
|
881
|
+
}
|
|
882
|
+
callFollowUpQuestion(e3) {
|
|
883
|
+
var t3;
|
|
884
|
+
return r(this, void 0, void 0, (function* () {
|
|
885
|
+
if (!(null == e3 ? void 0 : e3.followup)) return null;
|
|
886
|
+
try {
|
|
887
|
+
if (0 === this.feedback.answers.length) throw new Error("No answers provided");
|
|
888
|
+
const i2 = this.config.get("url"), r2 = Object.assign(Object.assign(Object.assign({ answer: null === (t3 = this.feedback.answers.find(((t4) => t4.key === e3.ref))) || void 0 === t3 ? void 0 : t3.value[0] }, "" !== this.publicKey && { publicKey: this.publicKey }), "" === this.publicKey && { campaignSessionId: this.appId }), { sessionId: this.id, question: e3 });
|
|
889
|
+
return yield (0, s.getFollowUpQuestion)(i2, r2, this.log);
|
|
890
|
+
} catch (e4) {
|
|
891
|
+
throw this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), e4;
|
|
892
|
+
}
|
|
893
|
+
}));
|
|
894
|
+
}
|
|
895
|
+
processNextQuestion(e3) {
|
|
896
|
+
var t3, i2, n2;
|
|
897
|
+
return r(this, void 0, void 0, (function* () {
|
|
898
|
+
const r2 = this.history.back();
|
|
899
|
+
if (!r2) throw new Error("No page found");
|
|
900
|
+
const o2 = r2.getFollowupQuestions();
|
|
901
|
+
if (0 === (null == o2 ? void 0 : o2.length)) return void (yield this.renderNextQuestion(e3, r2));
|
|
902
|
+
const a2 = [];
|
|
903
|
+
for (const e4 of o2) {
|
|
904
|
+
const t4 = r2.questions.find(((t5) => t5.ref === e4));
|
|
905
|
+
if (t4) {
|
|
906
|
+
const e5 = yield this.callFollowUpQuestion(t4);
|
|
907
|
+
e5 && a2.push(e5);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
if (0 === a2.length) return void (yield this.renderNextQuestion(e3, r2));
|
|
911
|
+
const s2 = new m.Page(r2.id, r2.position, this.appId, a2, r2.edges), d2 = new g.PageNode(r2.id, r2.position, r2.edges, s2, a2, true);
|
|
912
|
+
d2.elements = (0, l.renderQuestions)(a2, this.formOptionsConfig.questionFormat, null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.lang[0], null === (i2 = this.formData) || void 0 === i2 ? void 0 : i2.product, (() => this.send())), this.history.enqueue(d2), this.progress += 0.5, e3.innerHTML = "", null === (n2 = d2.elements) || void 0 === n2 || n2.forEach(((t4) => e3.appendChild(t4))), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: d2.isFollowup, completed: this.completed, error: null }));
|
|
913
|
+
}));
|
|
914
|
+
}
|
|
915
|
+
renderNextQuestion(e3, t3) {
|
|
916
|
+
var i2, o2, a2, s2, d2;
|
|
917
|
+
return r(this, void 0, void 0, (function* () {
|
|
918
|
+
let r2 = this.graph.getNextPage(t3, this.feedback.answers);
|
|
919
|
+
if (!r2) return void this.finish();
|
|
920
|
+
const c2 = r2.edges.filter(((e4) => "PRECONDITIONAL" === e4.typeCondition)).sort(((e4, t4) => e4.position < t4.position ? -1 : e4.position > t4.position ? 1 : 0));
|
|
921
|
+
if ((null == c2 ? void 0 : c2.length) > 0) {
|
|
922
|
+
const t4 = c2.some(((e4) => e4.transition === h.TransitionType.ALLOW));
|
|
923
|
+
let a3 = t4;
|
|
924
|
+
for (const t5 of c2) {
|
|
925
|
+
let s3;
|
|
926
|
+
for (let e4 = this.history.size() - 1; e4 >= 0; e4--) {
|
|
927
|
+
const r3 = this.history.get(e4);
|
|
928
|
+
if (r3 && (s3 = null === (i2 = r3.answers) || void 0 === i2 ? void 0 : i2.find(((e5) => e5.key === t5.questionRef)), s3)) break;
|
|
929
|
+
}
|
|
930
|
+
let l2 = false;
|
|
931
|
+
if (s3) {
|
|
932
|
+
const e4 = null === (o2 = this.formData) || void 0 === o2 ? void 0 : o2.questions.find(((e5) => e5.ref === t5.questionRef)), i3 = Array.isArray(s3.value) ? s3.value : [s3.value], r3 = Array.isArray(t5.value) ? t5.value : [t5.value];
|
|
933
|
+
if ((null == e4 ? void 0 : e4.type) === n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) l2 = this.evaluateMatrixPreconditional(t5, s3);
|
|
934
|
+
else switch (t5.typeOperator) {
|
|
935
|
+
case "EQUAL":
|
|
936
|
+
case "INQ":
|
|
937
|
+
l2 = i3.some(((e5) => r3.includes(e5)));
|
|
938
|
+
break;
|
|
939
|
+
case "NOEQUAL":
|
|
940
|
+
case "NINQ":
|
|
941
|
+
l2 = i3.every(((e5) => !r3.includes(e5)));
|
|
942
|
+
break;
|
|
943
|
+
case "GREATER":
|
|
944
|
+
l2 = i3.some(((e5) => Number(e5) > Number(r3[0])));
|
|
945
|
+
break;
|
|
946
|
+
case "LESS":
|
|
947
|
+
l2 = i3.some(((e5) => Number(e5) < Number(r3[0])));
|
|
948
|
+
break;
|
|
949
|
+
case "GREATEREQUAL":
|
|
950
|
+
l2 = i3.some(((e5) => Number(e5) >= Number(r3[0])));
|
|
951
|
+
break;
|
|
952
|
+
case "LESSEQUAL":
|
|
953
|
+
l2 = i3.some(((e5) => Number(e5) <= Number(r3[0])));
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
if (t5.transition === h.TransitionType.ALLOW) l2 || (a3 = false);
|
|
957
|
+
else if (t5.transition === h.TransitionType.NEXT && l2) return this.feedback.answers = [], void (r2 && (yield this.renderNextQuestion(e3, r2)));
|
|
958
|
+
}
|
|
959
|
+
if (t4 && !a3) return this.feedback.answers = [], void (r2 && (yield this.renderNextQuestion(e3, r2)));
|
|
960
|
+
}
|
|
961
|
+
r2.elements = (0, l.renderQuestions)(r2.questions, this.formOptionsConfig.questionFormat, null === (a2 = this.formData) || void 0 === a2 ? void 0 : a2.lang[0], null === (s2 = this.formData) || void 0 === s2 ? void 0 : s2.product, (() => this.send())), e3.innerHTML = "", null === (d2 = r2.elements) || void 0 === d2 || d2.forEach(((t4) => e3.appendChild(t4))), this.history.enqueue(r2), this.progress = this.total - this.graph.findMaxDepth(r2), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: r2.isFollowup, completed: this.completed, error: null }));
|
|
962
|
+
}));
|
|
963
|
+
}
|
|
964
|
+
back() {
|
|
965
|
+
var e3;
|
|
966
|
+
return r(this, void 0, void 0, (function* () {
|
|
967
|
+
if (0 === this.history.size()) return;
|
|
968
|
+
const t3 = document.getElementById("magicfeedback-questions-" + this.appId);
|
|
969
|
+
t3 && t3.childNodes.length > 0 && (t3.innerHTML = ""), this.history.rollback();
|
|
970
|
+
const i2 = this.history.back();
|
|
971
|
+
i2 ? (null === (e3 = i2.elements) || void 0 === e3 || e3.forEach(((e4) => t3.appendChild(e4))), this.progress = this.total - this.graph.findMaxDepth(i2)) : this.progress = this.history.size(), this.formOptionsConfig.onBackEvent && (yield this.formOptionsConfig.onBackEvent({ loading: false, progress: this.progress, followup: (null == i2 ? void 0 : i2.isFollowup) || false, error: i2 ? null : "No page found" }));
|
|
972
|
+
}));
|
|
973
|
+
}
|
|
974
|
+
previewQuestion(e3, t3, i2) {
|
|
975
|
+
var r2, n2, o2;
|
|
976
|
+
const a2 = Array.isArray(t3) ? t3 : [t3];
|
|
977
|
+
if (!a2 || 0 === a2.length) throw new Error("[MagicFeedback] No question provided for preview");
|
|
978
|
+
const s2 = document.getElementById(e3);
|
|
979
|
+
if (!s2) throw new Error(`[MagicFeedback] Element with ID '${e3}' not found.`);
|
|
980
|
+
const { format: d2 = this.formOptionsConfig.questionFormat || "standard", language: u2 = (null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.lang) && this.formData.lang[0] || "en", product: p2 = (null === (n2 = this.formData) || void 0 === n2 ? void 0 : n2.product) || { customIcons: false }, style: m2 = (null === (o2 = this.formData) || void 0 === o2 ? void 0 : o2.style) || {}, clearContainer: h2 = true, wrap: f2 = true } = i2 || {};
|
|
981
|
+
h2 && (s2.innerHTML = ""), (null == m2 ? void 0 : m2.primaryColor) && (0, c.applyPrimaryColor)(s2, m2.primaryColor), (0, c.applyDirection)(s2, u2);
|
|
982
|
+
let g2 = [];
|
|
983
|
+
try {
|
|
984
|
+
g2 = (0, l.renderQuestions)(a2, d2, u2, p2);
|
|
985
|
+
} catch (e4) {
|
|
986
|
+
throw this.log.err(e4), e4;
|
|
987
|
+
}
|
|
988
|
+
let y2 = s2;
|
|
989
|
+
if (f2) {
|
|
990
|
+
const e4 = document.createElement("div");
|
|
991
|
+
e4.classList.add("magicfeedback-preview-question"), y2.appendChild(e4), y2 = e4;
|
|
992
|
+
}
|
|
993
|
+
return g2.forEach(((e4) => y2.appendChild(e4))), s2;
|
|
994
|
+
}
|
|
995
|
+
parseMatrixAnswerPre(e3) {
|
|
996
|
+
if (!e3 || !e3.value) return [];
|
|
997
|
+
if (1 === e3.value.length && "string" == typeof e3.value[0] && e3.value[0].trim().startsWith("[")) try {
|
|
998
|
+
const t3 = JSON.parse(e3.value[0]);
|
|
999
|
+
if (Array.isArray(t3)) return t3;
|
|
1000
|
+
} catch (e4) {
|
|
1001
|
+
return [];
|
|
1002
|
+
}
|
|
1003
|
+
return Array.isArray(e3.value) && e3.value.length > 0 && "object" == typeof e3.value[0] && null !== e3.value[0] && "key" in e3.value[0] ? e3.value : [];
|
|
1004
|
+
}
|
|
1005
|
+
evaluateMatrixPreconditional(e3, t3) {
|
|
1006
|
+
const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], r2 = new Set(e3.option || []), n2 = this.parseMatrixAnswerPre(t3);
|
|
1007
|
+
if (!n2.length) return false;
|
|
1008
|
+
const o2 = r2.size > 0 ? n2.filter(((e4) => r2.has(e4.key))) : n2;
|
|
1009
|
+
if (!o2.length) return false;
|
|
1010
|
+
switch (e3.typeOperator) {
|
|
1011
|
+
case "EQUAL":
|
|
1012
|
+
case "INQ":
|
|
1013
|
+
return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.includes(e5)))));
|
|
1014
|
+
case "NOEQUAL":
|
|
1015
|
+
case "NINQ":
|
|
1016
|
+
return o2.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !i2.includes(e5)))));
|
|
1017
|
+
case "GREATER":
|
|
1018
|
+
return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) > Number(t4)))))));
|
|
1019
|
+
case "LESS":
|
|
1020
|
+
return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) < Number(t4)))))));
|
|
1021
|
+
case "GREATEREQUAL":
|
|
1022
|
+
return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) >= Number(t4)))))));
|
|
1023
|
+
case "LESSEQUAL":
|
|
1024
|
+
return o2.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) <= Number(t4)))))));
|
|
1025
|
+
default:
|
|
1026
|
+
return false;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
}, 700: (e2, t2) => {
|
|
1031
|
+
"use strict";
|
|
1032
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.Page = void 0, t2.Page = class {
|
|
1033
|
+
constructor(e3, t3, i, r, n) {
|
|
1034
|
+
this.id = e3, this.position = t3, this.generatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.status = "ACTIVE", this.integrationId = i, this.integrationQuestions = r, this.integrationPageRoutes = n;
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
}, 989: (e2, t2, i) => {
|
|
1038
|
+
"use strict";
|
|
1039
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.PageGraph = void 0;
|
|
1040
|
+
const r = i(636), n = i(558), o = i(591);
|
|
1041
|
+
t2.PageGraph = class {
|
|
1042
|
+
constructor(e3) {
|
|
1043
|
+
this.nodes = /* @__PURE__ */ new Map(), this.buildGraph(e3);
|
|
1044
|
+
}
|
|
1045
|
+
buildGraph(e3) {
|
|
1046
|
+
e3.forEach(((e4) => {
|
|
1047
|
+
var t3;
|
|
1048
|
+
e4.integrationPageRoutes && (e4.integrationPageRoutes = (null === (t3 = e4.integrationPageRoutes) || void 0 === t3 ? void 0 : t3.sort(((e5, t4) => {
|
|
1049
|
+
const i3 = new Date((null == e5 ? void 0 : e5.generatedAt) || 0).getTime(), r2 = new Date((null == t4 ? void 0 : t4.generatedAt) || 0).getTime();
|
|
1050
|
+
return i3 !== r2 ? i3 - r2 : "DIRECT" === e5.typeCondition && "DIRECT" !== t4.typeCondition ? 1 : "DIRECT" !== e5.typeCondition && "DIRECT" === t4.typeCondition ? -1 : 0;
|
|
1051
|
+
}))) || []);
|
|
1052
|
+
const i2 = new r.PageNode(e4.id, e4.position, e4.integrationPageRoutes || [], e4, e4.integrationQuestions);
|
|
1053
|
+
this.nodes.set(i2.id, i2);
|
|
1054
|
+
}));
|
|
1055
|
+
}
|
|
1056
|
+
getNodeById(e3) {
|
|
1057
|
+
return this.nodes.get(e3);
|
|
1058
|
+
}
|
|
1059
|
+
getNextEdgeByDefault(e3) {
|
|
1060
|
+
if (!e3) return;
|
|
1061
|
+
const t3 = e3.edges.find(((e4) => e4.typeCondition === o.ConditionType.DIRECT));
|
|
1062
|
+
if (!t3 || ![o.TransitionType.FINISH, o.TransitionType.REDIRECT].includes(t3.transition)) {
|
|
1063
|
+
if (t3 && t3.transitionDestiny) return t3.transitionDestiny;
|
|
1064
|
+
for (const t4 of this.nodes.values()) if (t4.position === e3.position + 1) return t4.id;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
getFirstPage() {
|
|
1068
|
+
let e3, t3 = Number.MAX_VALUE;
|
|
1069
|
+
for (const i2 of this.nodes.values()) i2.position < t3 && (t3 = i2.position, e3 = i2);
|
|
1070
|
+
return e3;
|
|
1071
|
+
}
|
|
1072
|
+
getNextPage(e3, t3) {
|
|
1073
|
+
var i2;
|
|
1074
|
+
if (!e3) return;
|
|
1075
|
+
e3.edges.sort(((e4, t4) => "DIRECT" === e4.typeCondition ? 1 : "DIRECT" === t4.typeCondition ? -1 : 0));
|
|
1076
|
+
const r2 = e3.edges.find(((i3) => {
|
|
1077
|
+
const r3 = e3.questions.find(((e4) => e4.ref === i3.questionRef)), a = null == t3 ? void 0 : t3.filter(((e4) => e4.key === i3.questionRef));
|
|
1078
|
+
if ("DIRECT" === i3.typeCondition) return true;
|
|
1079
|
+
if (!a || 0 === a.length) return false;
|
|
1080
|
+
if ((null == r3 ? void 0 : r3.type) === n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) return this.evaluateMatrixCondition(i3, a);
|
|
1081
|
+
const s = Array.isArray(i3.value) ? i3.value : [i3.value];
|
|
1082
|
+
switch (i3.typeOperator) {
|
|
1083
|
+
case o.OperatorType.EQUAL:
|
|
1084
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.includes(e5)))));
|
|
1085
|
+
case o.OperatorType.NOEQUAL:
|
|
1086
|
+
return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !s.includes(e5)))));
|
|
1087
|
+
case o.OperatorType.GREATER:
|
|
1088
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.some(((t4) => Number(e5) > Number(t4)))))));
|
|
1089
|
+
case o.OperatorType.LESS:
|
|
1090
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.some(((t4) => Number(e5) < Number(t4)))))));
|
|
1091
|
+
case o.OperatorType.GREATEREQUAL:
|
|
1092
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.some(((t4) => Number(e5) >= Number(t4)))))));
|
|
1093
|
+
case o.OperatorType.LESSEQUAL:
|
|
1094
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.some(((t4) => Number(e5) <= Number(t4)))))));
|
|
1095
|
+
case o.OperatorType.INQ:
|
|
1096
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => s.includes(e5)))));
|
|
1097
|
+
case o.OperatorType.NINQ:
|
|
1098
|
+
return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !s.includes(e5)))));
|
|
1099
|
+
default:
|
|
1100
|
+
return false;
|
|
1101
|
+
}
|
|
1102
|
+
}));
|
|
1103
|
+
if (!r2) {
|
|
1104
|
+
const t4 = this.getNextEdgeByDefault(e3);
|
|
1105
|
+
if (!t4) return;
|
|
1106
|
+
return this.getNodeById(t4);
|
|
1107
|
+
}
|
|
1108
|
+
switch (r2.transition) {
|
|
1109
|
+
case o.TransitionType.PAGE:
|
|
1110
|
+
if (!r2.transitionDestiny) return;
|
|
1111
|
+
return this.getNodeById(r2.transitionDestiny);
|
|
1112
|
+
case o.TransitionType.FINISH:
|
|
1113
|
+
return;
|
|
1114
|
+
case o.TransitionType.REDIRECT:
|
|
1115
|
+
return void (window.location.href = (null === (i2 = r2.transitionDestiny) || void 0 === i2 ? void 0 : i2.includes("?")) ? `${r2.transitionDestiny}&${window.location.search.slice(1)}` : `${r2.transitionDestiny}${window.location.search}`);
|
|
1116
|
+
default:
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
findDepth(e3) {
|
|
1121
|
+
const t3 = this.getNodeById(e3);
|
|
1122
|
+
if (!t3) return 0;
|
|
1123
|
+
const i2 = /* @__PURE__ */ new Set();
|
|
1124
|
+
return this.DFSUtil(t3, i2, 0);
|
|
1125
|
+
}
|
|
1126
|
+
findMaxDepth(e3) {
|
|
1127
|
+
if (e3 || (e3 = this.getFirstPage()), !e3) return 0;
|
|
1128
|
+
const t3 = /* @__PURE__ */ new Set();
|
|
1129
|
+
let i2 = 1;
|
|
1130
|
+
return i2 = Math.max(i2, this.DFSUtil(e3, t3, i2)), i2;
|
|
1131
|
+
}
|
|
1132
|
+
DFSUtil(e3, t3, i2) {
|
|
1133
|
+
t3.add(e3);
|
|
1134
|
+
let r2 = i2;
|
|
1135
|
+
const n2 = [...e3.edges.filter(((e4) => e4.typeCondition !== o.ConditionType.PRECONDITIONAL)) || []], a = this.getNextEdgeByDefault(e3);
|
|
1136
|
+
if (a) {
|
|
1137
|
+
const i3 = this.getNodeById(a);
|
|
1138
|
+
i3 && !t3.has(i3) && n2.push(new o.PageRoute(i3.id, "", o.OperatorType.DEFAULT, [""], o.TransitionType.PAGE, i3.id, e3.id));
|
|
1139
|
+
}
|
|
1140
|
+
for (const e4 of n2) {
|
|
1141
|
+
if (!e4.transitionDestiny) continue;
|
|
1142
|
+
const n3 = this.getNodeById(e4.transitionDestiny);
|
|
1143
|
+
if (n3 && !t3.has(n3)) {
|
|
1144
|
+
const e5 = i2 + 1, o2 = new Set(t3), a2 = this.DFSUtil(n3, o2, e5);
|
|
1145
|
+
r2 = Math.max(r2, a2);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
return r2;
|
|
1149
|
+
}
|
|
1150
|
+
parseMatrixAnswer(e3) {
|
|
1151
|
+
if (!e3 || !e3.value) return [];
|
|
1152
|
+
if (1 === e3.value.length && "string" == typeof e3.value[0] && e3.value[0].trim().startsWith("[")) try {
|
|
1153
|
+
const t3 = JSON.parse(e3.value[0]);
|
|
1154
|
+
if (Array.isArray(t3)) return t3;
|
|
1155
|
+
} catch (e4) {
|
|
1156
|
+
return [];
|
|
1157
|
+
}
|
|
1158
|
+
return Array.isArray(e3.value) && e3.value.length > 0 && "object" == typeof e3.value[0] && null !== e3.value[0] && "key" in e3.value[0] ? e3.value : [];
|
|
1159
|
+
}
|
|
1160
|
+
evaluateMatrixCondition(e3, t3) {
|
|
1161
|
+
const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], r2 = new Set(e3.option || []), n2 = t3[0], a = this.parseMatrixAnswer(n2);
|
|
1162
|
+
if (!a.length) return false;
|
|
1163
|
+
const s = r2.size > 0 ? a.filter(((e4) => r2.has(e4.key))) : a;
|
|
1164
|
+
if (!s.length) return false;
|
|
1165
|
+
switch (e3.typeOperator) {
|
|
1166
|
+
case o.OperatorType.EQUAL:
|
|
1167
|
+
case o.OperatorType.INQ:
|
|
1168
|
+
return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.includes(e5)))));
|
|
1169
|
+
case o.OperatorType.NOEQUAL:
|
|
1170
|
+
case o.OperatorType.NINQ:
|
|
1171
|
+
return s.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !i2.includes(e5)))));
|
|
1172
|
+
case o.OperatorType.GREATER:
|
|
1173
|
+
return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) > Number(t4)))))));
|
|
1174
|
+
case o.OperatorType.LESS:
|
|
1175
|
+
return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) < Number(t4)))))));
|
|
1176
|
+
case o.OperatorType.GREATEREQUAL:
|
|
1177
|
+
return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) >= Number(t4)))))));
|
|
1178
|
+
case o.OperatorType.LESSEQUAL:
|
|
1179
|
+
return s.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) <= Number(t4)))))));
|
|
1180
|
+
default:
|
|
1181
|
+
return false;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
}, 636: (e2, t2) => {
|
|
1186
|
+
"use strict";
|
|
1187
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.PageNode = void 0, t2.PageNode = class {
|
|
1188
|
+
constructor(e3, t3, i, r, n, o = false) {
|
|
1189
|
+
this.answers = [], this.id = e3, this.position = t3, this.edges = i, this.data = r, this.questions = n.sort(((e4, t4) => e4.position - t4.position)), this.elements = [], this.isFollowup = o;
|
|
1190
|
+
}
|
|
1191
|
+
getFollowupQuestions() {
|
|
1192
|
+
return this.questions.filter(((e3) => e3.followup)).map(((e3) => e3.ref));
|
|
1193
|
+
}
|
|
1194
|
+
getRequiredQuestions() {
|
|
1195
|
+
return this.questions.filter(((e3) => e3.require)).map(((e3) => e3.ref));
|
|
1196
|
+
}
|
|
1197
|
+
setAnswer(e3) {
|
|
1198
|
+
this.answers = e3;
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
}, 591: (e2, t2) => {
|
|
1202
|
+
"use strict";
|
|
1203
|
+
var i, r, n, o;
|
|
1204
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.PageRoute = t2.StatusType = t2.OperatorType = t2.ConditionType = t2.TransitionType = void 0, (o = t2.TransitionType || (t2.TransitionType = {})).PAGE = "PAGE", o.FINISH = "FINISH", o.REDIRECT = "REDIRECT", o.NEXT = "NEXT", o.ALLOW = "ALLOW", (function(e3) {
|
|
1205
|
+
e3.LOGICAL = "LOGICAL", e3.DIRECT = "DIRECT", e3.PRECONDITIONAL = "PRECONDITIONAL";
|
|
1206
|
+
})(i = t2.ConditionType || (t2.ConditionType = {})), (n = t2.OperatorType || (t2.OperatorType = {})).EQUAL = "EQUAL", n.NOEQUAL = "NOEQUAL", n.GREATER = "GREATER", n.LESS = "LESS", n.GREATEREQUAL = "GREATEREQUAL", n.LESSEQUAL = "LESSEQUAL", n.INQ = "INQ", n.NINQ = "NINQ", n.DEFAULT = "DEFAULT", (function(e3) {
|
|
1207
|
+
e3.ACTIVE = "ACTIVE", e3.DEPRECATED = "DEPRECATED", e3.DELETE = "DELETE";
|
|
1208
|
+
})(r = t2.StatusType || (t2.StatusType = {})), t2.PageRoute = class {
|
|
1209
|
+
constructor(e3, t3, n2, o2, a, s, l, d, c, u) {
|
|
1210
|
+
this.id = e3, this.questionRef = t3, this.typeCondition = d || i.LOGICAL, this.typeOperator = n2, this.value = o2 || [], this.transition = a, this.transitionDestiny = s, this.status = r.ACTIVE, this.generatedAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.integrationPageId = l, this.position = c || 0, this.option = u || [];
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
}, 558: (e2, t2) => {
|
|
1214
|
+
"use strict";
|
|
1215
|
+
var i, r;
|
|
1216
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.AGENT_ANSWER_TYPE_BLOCKED = t2.QuestionType = t2.FEEDBACKAPPANSWERTYPE = void 0, (r = t2.FEEDBACKAPPANSWERTYPE || (t2.FEEDBACKAPPANSWERTYPE = {})).CONTACT = "CONTACT", r.MULTIPLECHOISE_IMAGE = "MULTIPLECHOISE_IMAGE", r.EMAIL = "EMAIL", r.RATING_STAR = "RATING_STAR", r.RADIO = "RADIO", r.MULTIPLECHOICE = "MULTIPLECHOICE", r.SELECT = "SELECT", r.TEXT = "TEXT", r.LONGTEXT = "LONGTEXT", r.NUMBER = "NUMBER", r.RATING_EMOJI = "RATING_EMOJI", r.RATING_NUMBER = "RATING_NUMBER", r.DATE = "DATE", r.BOOLEAN = "BOOLEAN", r.PASSWORD = "PASSWORD", r.CONSENT = "CONSENT", r.MULTI_QUESTION_MATRIX = "MULTI_QUESTION_MATRIX", r.POINT_SYSTEM = "POINT_SYSTEM", r.PRIORITY_LIST = "PRIORITY_LIST", r.INFO_PAGE = "INFO_PAGE", r.UPLOAD_FILE = "UPLOAD_FILE", r.UPLOAD_IMAGE = "UPLOAD_IMAGE", t2.QuestionType = class {
|
|
1217
|
+
}, t2.AGENT_ANSWER_TYPE_BLOCKED = "ABUSIVE_OR_OFFENSIVE", (function(e3) {
|
|
1218
|
+
e3.FORM = "form", e3.DIV = "div";
|
|
1219
|
+
})(i || (i = {}));
|
|
1220
|
+
}, 565: (e2, t2, i) => {
|
|
1221
|
+
"use strict";
|
|
1222
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.applyDirection = t2.applyPrimaryColor = t2.generateContainer = void 0;
|
|
1223
|
+
const r = i(881);
|
|
1224
|
+
t2.generateContainer = function(e3, t3) {
|
|
1225
|
+
let i2 = document.getElementById(e3);
|
|
1226
|
+
if (!i2 && (i2 = document.getElementById("magicfeedback-container-" + t3), !i2)) throw new Error(`Element with ID '${e3}' not found.`);
|
|
1227
|
+
return i2.classList.add("magicfeedback-container"), i2.id = "magicfeedback-container-" + t3, i2.innerHTML = "", i2;
|
|
1228
|
+
}, t2.applyPrimaryColor = function(e3, t3) {
|
|
1229
|
+
e3.style.setProperty("--mf-primary", t3), e3.style.setProperty("--mf-primary-hover", `color-mix(in srgb, ${t3} 85%, black)`), e3.style.setProperty("--mf-primary-light", `color-mix(in srgb, ${t3} 15%, white)`), e3.style.setProperty("--mf-primary-border", `color-mix(in srgb, ${t3} 35%, transparent)`), e3.style.setProperty("--mf-border-focus", t3);
|
|
1230
|
+
}, t2.applyDirection = function(e3, t3) {
|
|
1231
|
+
const i2 = (0, r.isRtlLanguage)(t3);
|
|
1232
|
+
e3.setAttribute("dir", i2 ? "rtl" : "ltr"), e3.classList.toggle("magicfeedback-rtl", i2);
|
|
1233
|
+
};
|
|
1234
|
+
}, 516: (e2, t2, i) => {
|
|
1235
|
+
"use strict";
|
|
1236
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.getUrlParam = t2.getBooleanOptions = t2.parseTitle = void 0;
|
|
1237
|
+
const r = i(881);
|
|
1238
|
+
t2.parseTitle = function(e3, t3) {
|
|
1239
|
+
return e3 ? "object" == typeof e3 ? e3[t3] || e3.en : e3 : "";
|
|
1240
|
+
}, t2.getBooleanOptions = function(e3) {
|
|
1241
|
+
return [(0, r.t)(e3, "boolean.yes"), (0, r.t)(e3, "boolean.no")];
|
|
1242
|
+
}, t2.getUrlParam = function(e3) {
|
|
1243
|
+
return new URLSearchParams(window.location.search).get(e3);
|
|
1244
|
+
};
|
|
1245
|
+
}, 559: (e2, t2, i) => {
|
|
1246
|
+
"use strict";
|
|
1247
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.createRatingNumberElement = t2.createStarRating = t2.createRatingPlaceholder = void 0;
|
|
1248
|
+
const r = i(881);
|
|
1249
|
+
function n(e3, t3, i2 = "ltr") {
|
|
1250
|
+
const r2 = document.createElement("div");
|
|
1251
|
+
r2.classList.add("magicfeedback-rating-placeholder");
|
|
1252
|
+
const n2 = document.createElement("span");
|
|
1253
|
+
n2.textContent = null != e3 ? e3 : "", n2.classList.add("magicfeedback-rating-placeholder-value");
|
|
1254
|
+
const o = document.createElement("span");
|
|
1255
|
+
return o.textContent = null != t3 ? t3 : "", o.classList.add("magicfeedback-rating-placeholder-value"), "ltr" === i2 ? (e3 && r2.appendChild(n2), t3 && r2.appendChild(o)) : (t3 && r2.appendChild(o), e3 && r2.appendChild(n2)), r2;
|
|
1256
|
+
}
|
|
1257
|
+
t2.createRatingPlaceholder = n, t2.createStarRating = function(e3, t3, i2, r2 = () => {
|
|
1258
|
+
}, o) {
|
|
1259
|
+
const a = "magicfeedback-rating-star-selected", s = document.createElement("div");
|
|
1260
|
+
s.classList.add("magicfeedback-rating-star-container"), s.style.maxWidth = "300px", s.style.margin = "auto", s.dataset.originalSelection = "0";
|
|
1261
|
+
for (let t4 = 1; t4 <= 5; t4++) {
|
|
1262
|
+
const i3 = document.createElement("label");
|
|
1263
|
+
i3.classList.add("magicfeedback-rating-star-option");
|
|
1264
|
+
const n2 = document.createElement("input");
|
|
1265
|
+
n2.id = `rating-${e3}-${t4}`, n2.type = "radio", n2.name = e3, n2.value = t4.toString(), n2.style.position = "absolute", n2.style.opacity = "0", n2.style.width = "0", n2.style.height = "0", n2.classList.add("magicfeedback-input"), o && o === n2.value && (n2.checked = true), n2.addEventListener("change", (() => {
|
|
1266
|
+
const e4 = s.querySelectorAll(".rating__star");
|
|
1267
|
+
for (let t5 = 0; t5 < e4.length; t5++) t5 + 1 <= Number(n2.value) ? e4[t5].classList.contains(a) || e4[t5].classList.add(a) : e4[t5].classList.contains(a) && e4[t5].classList.remove(a);
|
|
1268
|
+
s.dataset.originalSelection = n2.value, r2 && r2();
|
|
1269
|
+
})), i3.appendChild(n2);
|
|
1270
|
+
const l2 = document.createElement("label");
|
|
1271
|
+
l2.htmlFor = `rating-${e3}-${t4}`, l2.classList.add("rating__star"), l2.textContent = "\u2605", l2.style.fontSize = "40px", l2.style.color = "#CCCCCC", l2.style.cursor = "pointer", l2.addEventListener("mouseenter", (() => {
|
|
1272
|
+
const e4 = s.querySelectorAll(".rating__star"), i4 = t4 - 1;
|
|
1273
|
+
e4.forEach(((e5, t5) => {
|
|
1274
|
+
t5 <= i4 ? e5.classList.contains(a) || e5.classList.add(a) : e5.classList.contains(a) && e5.classList.remove(a);
|
|
1275
|
+
}));
|
|
1276
|
+
})), l2.addEventListener("mouseleave", (() => {
|
|
1277
|
+
const e4 = Number(s.dataset.originalSelection || "0");
|
|
1278
|
+
s.querySelectorAll(".rating__star").forEach(((t5, i4) => {
|
|
1279
|
+
i4 < e4 ? t5.classList.contains(a) || t5.classList.add(a) : t5.classList.contains(a) && t5.classList.remove(a);
|
|
1280
|
+
}));
|
|
1281
|
+
})), i3.appendChild(l2), s.appendChild(i3);
|
|
1282
|
+
}
|
|
1283
|
+
const l = n(t3, i2);
|
|
1284
|
+
return l.childElementCount > 0 && s.appendChild(l), s;
|
|
1285
|
+
}, t2.createRatingNumberElement = function(e3, t3, i2, n2, o, a, s, l) {
|
|
1286
|
+
var d, c;
|
|
1287
|
+
const u = document.createElement("div");
|
|
1288
|
+
u.classList.add("magicfeedback-rating-number");
|
|
1289
|
+
const p = "column" === n2, m = "ltr" === i2 ? n2 : `${n2}-reverse`, h = document.createElement("div");
|
|
1290
|
+
h.classList.add("magicfeedback-rating-number-container"), h.classList.add(`magicfeedback-rating-number-container-${i2}`), h.classList.add(`magicfeedback-rating-number-container-${n2}`), h.style.display = "flex", h.style.flexDirection = m, h.setAttribute("role", "radiogroup"), h.setAttribute("aria-label", (null == t3 ? void 0 : t3.ariaLabel) || (0, r.t)(l, "rating.ariaLabel"));
|
|
1291
|
+
const f = (null == t3 ? void 0 : t3.max) ? Number(null == t3 ? void 0 : t3.max) : 10, g = (null == t3 ? void 0 : t3.min) ? Number(null == t3 ? void 0 : t3.min) : 0;
|
|
1292
|
+
!p && f - g + 1 > 6 && h.classList.add("magicfeedback-rating-number-container-row--dense");
|
|
1293
|
+
const y = (null == t3 ? void 0 : t3.numberPlaceholders) || null, v = !(!y || !Object.keys(y).length);
|
|
1294
|
+
let b = null;
|
|
1295
|
+
if (!p && ((null == t3 ? void 0 : t3.minPlaceholder) || (null == t3 ? void 0 : t3.maxPlaceholder))) {
|
|
1296
|
+
b = document.createElement("div"), b.classList.add("magicfeedback-rating-number-scale-labels");
|
|
1297
|
+
const e4 = document.createElement("span");
|
|
1298
|
+
e4.classList.add("magicfeedback-rating-number-scale-label"), e4.textContent = null !== (d = null == t3 ? void 0 : t3.minPlaceholder) && void 0 !== d ? d : "";
|
|
1299
|
+
const r2 = document.createElement("span");
|
|
1300
|
+
r2.classList.add("magicfeedback-rating-number-scale-label"), r2.textContent = null !== (c = null == t3 ? void 0 : t3.maxPlaceholder) && void 0 !== c ? c : "", "ltr" === i2 ? (b.appendChild(e4), b.appendChild(r2)) : (b.appendChild(r2), b.appendChild(e4));
|
|
1301
|
+
}
|
|
1302
|
+
let E = null;
|
|
1303
|
+
if (p && !v && (h.classList.add("magicfeedback-rating-number-container-column--bare"), (null == t3 ? void 0 : t3.minPlaceholder) || (null == t3 ? void 0 : t3.maxPlaceholder))) {
|
|
1304
|
+
const e4 = "ltr" === i2 ? null == t3 ? void 0 : t3.minPlaceholder : null == t3 ? void 0 : t3.maxPlaceholder, r2 = "ltr" === i2 ? null == t3 ? void 0 : t3.maxPlaceholder : null == t3 ? void 0 : t3.minPlaceholder;
|
|
1305
|
+
if (e4) {
|
|
1306
|
+
const t4 = document.createElement("div");
|
|
1307
|
+
t4.classList.add("magicfeedback-rating-number-scale-label-block"), t4.textContent = e4, u.appendChild(t4);
|
|
1308
|
+
}
|
|
1309
|
+
r2 && (E = document.createElement("div"), E.classList.add("magicfeedback-rating-number-scale-label-block"), E.textContent = r2);
|
|
1310
|
+
}
|
|
1311
|
+
for (let i3 = g; i3 <= f; i3++) {
|
|
1312
|
+
const r2 = document.createElement("div");
|
|
1313
|
+
r2.classList.add("magicfeedback-rating-number-option"), r2.classList.add(`magicfeedback-rating-number-option-${n2}`);
|
|
1314
|
+
const l2 = document.createElement("label");
|
|
1315
|
+
l2.htmlFor = `rating-${e3}-${i3}`, l2.classList.add("magicfeedback-rating-number-option-label-container");
|
|
1316
|
+
const d2 = v && (y[i3] || (i3 === g ? null == t3 ? void 0 : t3.minPlaceholder : void 0) || (i3 === f ? null == t3 ? void 0 : t3.maxPlaceholder : void 0)), c2 = document.createElement("input");
|
|
1317
|
+
c2.id = `rating-${e3}-${i3}`, c2.type = "radio", c2.name = e3, c2.value = i3.toString(), c2.classList.add(o), c2.classList.add("magicfeedback-input"), c2.setAttribute("aria-label", d2 ? `${i3} \u2014 ${d2}` : `${i3}`), a && c2.addEventListener("change", (() => a())), s && s === c2.value && (c2.checked = true), l2.appendChild(c2);
|
|
1318
|
+
const u2 = document.createElement("span");
|
|
1319
|
+
u2.classList.add("magicfeedback-rating-number-value");
|
|
1320
|
+
const m2 = document.createElement("span");
|
|
1321
|
+
if (m2.textContent = i3.toString(), m2.classList.add("magicfeedback-rating-number-value-num"), u2.appendChild(m2), p) {
|
|
1322
|
+
if (d2) {
|
|
1323
|
+
const e4 = document.createElement("span");
|
|
1324
|
+
e4.textContent = d2, e4.classList.add("magicfeedback-rating-number-value-label"), u2.appendChild(e4);
|
|
1325
|
+
}
|
|
1326
|
+
} else y && y[i3] && (l2.title = y[i3]);
|
|
1327
|
+
l2.appendChild(u2), r2.appendChild(l2), h.appendChild(r2);
|
|
1328
|
+
}
|
|
1329
|
+
if (u.appendChild(h), b && u.appendChild(b), E && u.appendChild(E), (null == t3 ? void 0 : t3.extraOption) && (null == t3 ? void 0 : t3.extraOptionText)) {
|
|
1330
|
+
const i3 = document.createElement("div");
|
|
1331
|
+
i3.classList.add("magicfeedback-rating-number-extra-row");
|
|
1332
|
+
const r2 = document.createElement("div");
|
|
1333
|
+
r2.classList.add("magicfeedback-rating-number-option"), r2.classList.add("magicfeedback-rating-number-option--extra");
|
|
1334
|
+
const n3 = document.createElement("label");
|
|
1335
|
+
n3.htmlFor = `rating-${e3}-extra`, n3.classList.add("magicfeedback-rating-number-option-label-container");
|
|
1336
|
+
const s2 = document.createElement("input");
|
|
1337
|
+
s2.id = `rating-${e3}-extra`, s2.type = "radio", s2.name = e3, s2.value = "-", s2.classList.add(o), s2.classList.add("magicfeedback-input"), s2.setAttribute("aria-label", null == t3 ? void 0 : t3.extraOptionText), a && s2.addEventListener("change", (() => a()));
|
|
1338
|
+
const l2 = document.createElement("span");
|
|
1339
|
+
l2.classList.add("magicfeedback-rating-number-value");
|
|
1340
|
+
const d2 = document.createElement("span");
|
|
1341
|
+
d2.textContent = null == t3 ? void 0 : t3.extraOptionText, d2.classList.add("magicfeedback-rating-number-value-label"), l2.appendChild(d2), n3.appendChild(s2), n3.appendChild(l2), r2.appendChild(n3), i3.appendChild(r2), u.appendChild(i3);
|
|
1342
|
+
}
|
|
1343
|
+
return u;
|
|
1344
|
+
};
|
|
1345
|
+
}, 42: (e2, t2, i) => {
|
|
1346
|
+
"use strict";
|
|
1347
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.getQuestionRenderer = void 0;
|
|
1348
|
+
const r = i(558), n = i(998), o = i(72), a = i(732), s = i(90), l = i(65), d = i(85), c = i(817), u = i(965), p = i(180), m = i(991), h = i(152), f = i(917), g = i(452), y = i(644), v = i(773), b = i(66), E = i(843), k = i(250), A = i(409), T = i(282), C = /* @__PURE__ */ new Map([[r.FEEDBACKAPPANSWERTYPE.TEXT, s.renderText], [r.FEEDBACKAPPANSWERTYPE.LONGTEXT, o.renderLongText], [r.FEEDBACKAPPANSWERTYPE.NUMBER, a.renderNumber], [r.FEEDBACKAPPANSWERTYPE.RADIO, n.renderChoice], [r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE, n.renderChoice], [r.FEEDBACKAPPANSWERTYPE.BOOLEAN, l.renderBoolean], [r.FEEDBACKAPPANSWERTYPE.SELECT, d.renderSelect], [r.FEEDBACKAPPANSWERTYPE.DATE, c.renderDate], [r.FEEDBACKAPPANSWERTYPE.EMAIL, u.renderEmail], [r.FEEDBACKAPPANSWERTYPE.PASSWORD, p.renderPassword], [r.FEEDBACKAPPANSWERTYPE.CONSENT, m.renderConsent], [r.FEEDBACKAPPANSWERTYPE.RATING_EMOJI, h.renderRatingEmoji], [r.FEEDBACKAPPANSWERTYPE.RATING_NUMBER, f.renderRatingNumber], [r.FEEDBACKAPPANSWERTYPE.RATING_STAR, g.renderRatingStar], [r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX, y.renderMatrix], [r.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST, v.renderPriorityList], [r.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM, b.renderPointSystem], [r.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE, E.renderUploadImage], [r.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE, k.renderUploadFile], [r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE, A.renderMultipleChoiceImage], [r.FEEDBACKAPPANSWERTYPE.INFO_PAGE, T.renderInfoPage]]);
|
|
1349
|
+
t2.getQuestionRenderer = function(e3) {
|
|
1350
|
+
return C.get(e3);
|
|
1351
|
+
};
|
|
1352
|
+
}, 65: (e2, t2, i) => {
|
|
1353
|
+
"use strict";
|
|
1354
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderBoolean = void 0;
|
|
1355
|
+
const r = i(516);
|
|
1356
|
+
t2.renderBoolean = ({ question: e3, language: t3, urlParamValue: i2, send: n }) => {
|
|
1357
|
+
const { ref: o, assets: a } = e3, s = document.createElement("div"), l = "magicfeedback-radio", d = document.createElement("div");
|
|
1358
|
+
return d.classList.add("magicfeedback-boolean-container"), d.style.display = "flex", d.style.flexDirection = "row", d.style.justifyContent = "space-between", d.style.width = "70%", d.style.margin = "auto", ((null == a ? void 0 : a.addIcon) ? ["\u{1F44D}", "\u{1F44E}"] : (0, r.getBooleanOptions)(t3)).forEach(((e4, t4) => {
|
|
1359
|
+
const r2 = document.createElement("label");
|
|
1360
|
+
r2.classList.add("magicfeedback-boolean-option"), r2.htmlFor = `rating-${o}-${t4}`, r2.style.cursor = "pointer", r2.style.display = "flex", r2.style.justifyContent = "center", r2.style.alignItems = "center", r2.style.margin = "auto", r2.style.padding = "0", r2.style.width = "45%", r2.style.height = "38px";
|
|
1361
|
+
const a2 = document.createElement("label");
|
|
1362
|
+
a2.htmlFor = `rating-${o}-${t4}`, a2.textContent = e4, a2.style.margin = "0", a2.style.padding = "0";
|
|
1363
|
+
const s2 = document.createElement("input");
|
|
1364
|
+
s2.id = `rating-${o}-${t4}`, s2.type = "radio", s2.name = o, s2.value = ["Yes", "No"][t4], s2.classList.add(l), s2.classList.add("magicfeedback-input"), s2.style.position = "absolute", s2.style.opacity = "0", s2.style.width = "0", s2.style.height = "0", s2.style.margin = "0", s2.addEventListener("change", (() => {
|
|
1365
|
+
n && n();
|
|
1366
|
+
})), i2 && i2.toLowerCase() === s2.value.toLowerCase() && (s2.checked = true), r2.appendChild(s2), r2.appendChild(a2), d.appendChild(r2);
|
|
1367
|
+
})), s.appendChild(d), { element: s, elementTypeClass: l };
|
|
1368
|
+
};
|
|
1369
|
+
}, 998: (e2, t2, i) => {
|
|
1370
|
+
"use strict";
|
|
1371
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderChoice = void 0;
|
|
1372
|
+
const r = i(558), n = i(784);
|
|
1373
|
+
t2.renderChoice = ({ question: e3, language: t3, urlParamValue: i2, randomPosition: o, send: a }) => {
|
|
1374
|
+
const { type: s, ref: l, value: d, defaultValue: c, assets: u } = e3, p = document.createElement("div"), m = "magicfeedback-" + ("MULTIPLECHOICE" === s ? "checkbox" : "radio");
|
|
1375
|
+
let h = d || [];
|
|
1376
|
+
o && (h = h.sort((() => Math.random() - 0.5)));
|
|
1377
|
+
let f = (null == u ? void 0 : u.exclusiveAnswers) || [];
|
|
1378
|
+
(null == u ? void 0 : u.extraOption) && (f = f.filter(((e4) => e4 !== u.extraOptionText))), f.length > 0 && (null == f || f.forEach(((e4) => {
|
|
1379
|
+
h.includes(e4) || h.push(e4);
|
|
1380
|
+
})));
|
|
1381
|
+
const g = null == u ? void 0 : u.extraOptionText;
|
|
1382
|
+
return (null == u ? void 0 : u.extraOption) && g && !h.includes(g) && h.push(g), h.forEach(((e4, o2) => {
|
|
1383
|
+
const d2 = document.createElement("div");
|
|
1384
|
+
d2.classList.add(`magicfeedback-${"MULTIPLECHOICE" === s ? "checkbox" : "radio"}-container`);
|
|
1385
|
+
const g2 = document.createElement("label"), y = document.createElement("input");
|
|
1386
|
+
if (y.id = `rating-${l}-${o2}`, y.type = "MULTIPLECHOICE" === s ? "checkbox" : "radio", y.name = l, y.value = e4, y.classList.add(m), y.classList.add("magicfeedback-input"), s === r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE && (null == u ? void 0 : u.maxOptions) && (null == u ? void 0 : u.maxOptions) > 0 && y.addEventListener("change", (() => {
|
|
1387
|
+
document.querySelectorAll(`input[name="${l}"]:checked`).length > (null == u ? void 0 : u.maxOptions) && (y.checked = false);
|
|
1388
|
+
})), s === r.FEEDBACKAPPANSWERTYPE.RADIO && a && (!(null == u ? void 0 : u.extraOptionText) || (null == u ? void 0 : u.extraOptionText) && e4 !== (null == u ? void 0 : u.extraOptionText)) && y.addEventListener("change", (() => {
|
|
1389
|
+
a();
|
|
1390
|
+
})), e4 !== c && e4 !== i2 || (y.checked = true), g2.textContent = e4, g2.htmlFor = `rating-${l}-${o2}`, y.addEventListener("change", ((t4) => {
|
|
1391
|
+
const i3 = document.getElementById(`extra-option-${l}`);
|
|
1392
|
+
t4.target.checked && f.includes(e4) ? (h.forEach(((t5) => {
|
|
1393
|
+
t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
|
|
1394
|
+
})), i3 && (i3.style.display = "none")) : f.forEach(((t5) => {
|
|
1395
|
+
t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
|
|
1396
|
+
})), (null == u ? void 0 : u.extraOption) && e4 === (null == u ? void 0 : u.extraOptionText) && i3 && (i3.style.display = t4.target.checked ? "block" : "none");
|
|
1397
|
+
})), d2.appendChild(y), d2.appendChild(g2), p.appendChild(d2), (null == u ? void 0 : u.extraOption) && e4 === (null == u ? void 0 : u.extraOptionText)) {
|
|
1398
|
+
const e5 = document.createElement("input");
|
|
1399
|
+
e5.type = "text", e5.placeholder = (null == u ? void 0 : u.extraOptionPlaceholder) || n.placeholder.answer(t3 || "en"), e5.classList.add("magicfeedback-extra-option"), e5.classList.add("magicfeedback-input"), e5.id = `extra-option-${l}`, e5.name = `extra-option-${l}`, e5.style.display = "none", p.appendChild(e5);
|
|
1400
|
+
}
|
|
1401
|
+
})), { element: p, elementTypeClass: m };
|
|
1402
|
+
};
|
|
1403
|
+
}, 991: (e2, t2) => {
|
|
1404
|
+
"use strict";
|
|
1405
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderConsent = void 0, t2.renderConsent = ({ question: e3, urlParamValue: t3, send: i }) => {
|
|
1406
|
+
const { id: r, ref: n, value: o, require: a } = e3, s = document.createElement("input");
|
|
1407
|
+
return s.type = "checkbox", s.id = `magicfeedback-${r}`, s.name = n, s.value = "true", s.required = a, s.classList.add("magicfeedback-consent"), s.classList.add("magicfeedback-input"), t3 && o.includes(t3) && (s.checked = true), i && s.addEventListener("change", (() => {
|
|
1408
|
+
i();
|
|
1409
|
+
})), { element: s, elementTypeClass: "magicfeedback-consent" };
|
|
1410
|
+
};
|
|
1411
|
+
}, 817: (e2, t2, i) => {
|
|
1412
|
+
"use strict";
|
|
1413
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderDate = void 0;
|
|
1414
|
+
const r = i(784);
|
|
1415
|
+
t2.renderDate = ({ language: e3, placeholderText: t3, urlParamValue: i2 }) => {
|
|
1416
|
+
const n = document.createElement("input");
|
|
1417
|
+
return n.type = "date", n.placeholder = t3 || r.placeholder.date(e3 || "en"), i2 && (n.value = i2), { element: n, elementTypeClass: "magicfeedback-date" };
|
|
1418
|
+
};
|
|
1419
|
+
}, 965: (e2, t2) => {
|
|
1420
|
+
"use strict";
|
|
1421
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderEmail = void 0, t2.renderEmail = ({ placeholderText: e3, urlParamValue: t3 }) => {
|
|
1422
|
+
const i = document.createElement("input");
|
|
1423
|
+
return i.type = "email", i.placeholder = e3 || "you@example.com", t3 && (i.value = t3), { element: i, elementTypeClass: "magicfeedback-email" };
|
|
1424
|
+
};
|
|
1425
|
+
}, 282: (e2, t2) => {
|
|
1426
|
+
"use strict";
|
|
1427
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderInfoPage = void 0, t2.renderInfoPage = ({ question: e3, placeholderText: t3 }) => {
|
|
1428
|
+
var i, r;
|
|
1429
|
+
const n = document.createElement("div");
|
|
1430
|
+
if ("string" == typeof (null === (i = e3.assets) || void 0 === i ? void 0 : i.placeholder) ? "" !== e3.assets.placeholder.trim() : Boolean(null === (r = e3.assets) || void 0 === r ? void 0 : r.placeholder)) {
|
|
1431
|
+
const e4 = document.createElement("div");
|
|
1432
|
+
e4.classList.add("magicfeedback-info-message"), e4.innerHTML = t3 || "", n.appendChild(e4);
|
|
1433
|
+
}
|
|
1434
|
+
return { element: n, elementTypeClass: "magicfeedback-info-page" };
|
|
1435
|
+
};
|
|
1436
|
+
}, 72: (e2, t2, i) => {
|
|
1437
|
+
"use strict";
|
|
1438
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderLongText = void 0;
|
|
1439
|
+
const r = i(784);
|
|
1440
|
+
t2.renderLongText = ({ language: e3, placeholderText: t3, urlParamValue: i2, maxCharacters: n }) => {
|
|
1441
|
+
const o = document.createElement("textarea");
|
|
1442
|
+
return o.rows = 3, n > 0 && (o.maxLength = n), o.placeholder = t3 || r.placeholder.answer(e3 || "en"), i2 && (o.value = i2), { element: o, elementTypeClass: "magicfeedback-longtext" };
|
|
1443
|
+
};
|
|
1444
|
+
}, 644: (e2, t2) => {
|
|
1445
|
+
"use strict";
|
|
1446
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMatrix = void 0, t2.renderMatrix = ({ question: e3, isPhone: t3, randomPosition: i }) => {
|
|
1447
|
+
const { ref: r, value: n, assets: o } = e3, a = document.createElement("div"), s = document.createElement("div");
|
|
1448
|
+
s.classList.add("magicfeedback-multi-question-matrix-container");
|
|
1449
|
+
let l = (null == o ? void 0 : o.options) || [], d = [...n], c = [];
|
|
1450
|
+
if (i && (l = null == l ? void 0 : l.sort((() => Math.random() - 0.5)), d = [...d].sort((() => Math.random() - 0.5))), (null == o ? void 0 : o.exclusiveAnswers) && (c = null == o ? void 0 : o.exclusiveAnswers, null == c || c.forEach(((e4) => {
|
|
1451
|
+
d.includes(e4) || d.push(e4);
|
|
1452
|
+
}))), t3) {
|
|
1453
|
+
const e4 = document.createElement("div");
|
|
1454
|
+
e4.classList.add("magicfeedback-multi-question-matrix-list"), null == l || l.forEach(((t4) => {
|
|
1455
|
+
const i2 = document.createElement("div");
|
|
1456
|
+
i2.classList.add("magicfeedback-multi-question-matrix-list-item"), i2.style.display = "flex", i2.style.flexDirection = "column", i2.style.alignItems = "flex-start", i2.style.marginBottom = "10px";
|
|
1457
|
+
const n2 = document.createElement("label");
|
|
1458
|
+
n2.classList.add("magicfeedback-multi-question-matrix-label"), n2.style.paddingBottom = "10px", n2.textContent = t4, i2.appendChild(n2), d.forEach(((e5) => {
|
|
1459
|
+
const n3 = document.createElement("div");
|
|
1460
|
+
n3.classList.add("magicfeedback-radio-container"), n3.style.display = "flex", n3.style.alignItems = "center", n3.style.justifyContent = "flex-start", n3.style.width = "99%", n3.style.margin = "5px auto";
|
|
1461
|
+
const o2 = document.createElement("label"), a2 = document.createElement("input");
|
|
1462
|
+
a2.id = `${r}-${t4}-${e5}`, a2.type = "radio", a2.name = `${r}-${t4}`, a2.value = e5, a2.classList.add("magicfeedback-input"), o2.textContent = e5, o2.htmlFor = `${r}-${t4}-${e5}`, n3.appendChild(a2), n3.appendChild(o2), i2.appendChild(n3);
|
|
1463
|
+
})), e4.appendChild(i2);
|
|
1464
|
+
})), s.appendChild(e4);
|
|
1465
|
+
} else {
|
|
1466
|
+
const e4 = document.createElement("table");
|
|
1467
|
+
e4.classList.add("magicfeedback-multi-question-matrix-table");
|
|
1468
|
+
const t4 = document.createElement("thead");
|
|
1469
|
+
t4.classList.add("magicfeedback-multi-question-matrix-header"), t4.style.paddingBottom = "15px";
|
|
1470
|
+
const i2 = document.createElement("tr"), n2 = document.createElement("th");
|
|
1471
|
+
i2.appendChild(n2), d.forEach(((e5) => {
|
|
1472
|
+
const t5 = document.createElement("th");
|
|
1473
|
+
t5.textContent = e5, i2.appendChild(t5);
|
|
1474
|
+
})), t4.appendChild(i2), e4.appendChild(t4);
|
|
1475
|
+
const o2 = document.createElement("tbody");
|
|
1476
|
+
null == l || l.forEach(((e5) => {
|
|
1477
|
+
const t5 = document.createElement("tr");
|
|
1478
|
+
t5.classList.add("magicfeedback-multi-question-matrix-row-tr");
|
|
1479
|
+
const i3 = document.createElement("td");
|
|
1480
|
+
i3.style.minWidth = "200px", i3.style.padding = "10px";
|
|
1481
|
+
const n3 = document.createElement("label");
|
|
1482
|
+
n3.classList.add("magicfeedback-multi-question-matrix-label"), n3.textContent = e5, i3.appendChild(n3), t5.appendChild(i3), d.forEach(((i4) => {
|
|
1483
|
+
const n4 = document.createElement("td"), o3 = document.createElement("input");
|
|
1484
|
+
o3.type = "radio", o3.name = `${r}-${e5}`, o3.value = i4, o3.id = `${r}-${e5}-${i4}`, o3.classList.add("magicfeedback-input"), n4.appendChild(o3), t5.appendChild(n4);
|
|
1485
|
+
})), o2.appendChild(t5);
|
|
1486
|
+
})), e4.appendChild(o2), s.appendChild(e4);
|
|
1487
|
+
}
|
|
1488
|
+
return a.appendChild(s), { element: a, elementTypeClass: "magicfeedback-multi-question-matrix" };
|
|
1489
|
+
};
|
|
1490
|
+
}, 409: (e2, t2) => {
|
|
1491
|
+
"use strict";
|
|
1492
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMultipleChoiceImage = void 0, t2.renderMultipleChoiceImage = ({ question: e3, randomPosition: t3, urlParamValue: i, send: r }) => {
|
|
1493
|
+
const n = document.createElement("div"), { ref: o, assets: a } = e3;
|
|
1494
|
+
let s = [...e3.value];
|
|
1495
|
+
const l = document.createElement("div");
|
|
1496
|
+
l.classList.add("magicfeedback-multiple-choice-image-container"), l.style.display = "flex", l.style.flexDirection = "row", l.style.flexWrap = "wrap", l.style.justifyContent = "center";
|
|
1497
|
+
const d = s.length;
|
|
1498
|
+
let c = 1, u = 1;
|
|
1499
|
+
if (window.innerWidth < 600) c = 1, u = d;
|
|
1500
|
+
else switch (d) {
|
|
1501
|
+
case 1:
|
|
1502
|
+
case 2:
|
|
1503
|
+
case 3:
|
|
1504
|
+
c = d, u = 1;
|
|
1505
|
+
break;
|
|
1506
|
+
case 4:
|
|
1507
|
+
case 5:
|
|
1508
|
+
case 6:
|
|
1509
|
+
u = 2, c = Math.ceil(d / u);
|
|
1510
|
+
break;
|
|
1511
|
+
case 7:
|
|
1512
|
+
case 8:
|
|
1513
|
+
case 9:
|
|
1514
|
+
u = 3, c = Math.ceil(d / u);
|
|
1515
|
+
break;
|
|
1516
|
+
default:
|
|
1517
|
+
u = 4, c = Math.ceil(d / u);
|
|
1518
|
+
}
|
|
1519
|
+
const p = void 0 !== (null == a ? void 0 : a.addTitle) && (null == a ? void 0 : a.addTitle), m = void 0 !== (null == a ? void 0 : a.multiOption) && (null == a ? void 0 : a.multiOption), h = void 0 !== (null == a ? void 0 : a.extraOption) && (null == a ? void 0 : a.extraOption);
|
|
1520
|
+
function f(e4) {
|
|
1521
|
+
try {
|
|
1522
|
+
const { position: t4, url: n2, value: a2 } = e4, s2 = document.createElement("div");
|
|
1523
|
+
s2.classList.add("magicfeedback-multiple-choice-image-option"), s2.style.width = `calc(100% / ${c} - 2px)`, s2.style.height = `calc(100% / ${u} - 2px)`, s2.style.padding = "8px", s2.style.margin = "0";
|
|
1524
|
+
const d2 = document.createElement("label");
|
|
1525
|
+
d2.classList.add("magicfeedback-image-option-label-container"), d2.htmlFor = `rating-${o}-${t4}`, d2.style.cursor = "pointer", d2.addEventListener("click", (() => {
|
|
1526
|
+
d2.style.border = "2px solid #000";
|
|
1527
|
+
}));
|
|
1528
|
+
const h2 = document.createElement("label");
|
|
1529
|
+
h2.textContent = a2, h2.classList.add("magicfeedback-multiple-choice-image-label");
|
|
1530
|
+
const f2 = document.createElement("input");
|
|
1531
|
+
f2.id = `rating-${o}-${t4}`, f2.type = m ? "checkbox" : "radio", f2.name = o, f2.value = a2, f2.style.position = "absolute", f2.style.opacity = "0", f2.style.width = "0", f2.style.height = "0", f2.classList.add("magicfeedback-input"), i && i === f2.value && (f2.checked = true), !m && r && f2.addEventListener("change", (() => {
|
|
1532
|
+
r();
|
|
1533
|
+
}));
|
|
1534
|
+
const g = document.createElement("img");
|
|
1535
|
+
g.classList.add("magicfeedback-multiple-choice-image-image"), g.src = n2, g.style.cursor = "pointer", g.style.backgroundSize = "cover", g.style.backgroundPosition = "center", g.style.width = "100%", g.style.height = "100%", g.style.objectFit = "cover", g.style.margin = "auto", d2.appendChild(f2), d2.appendChild(g), p && d2.appendChild(h2), s2.appendChild(d2), l.appendChild(s2);
|
|
1536
|
+
} catch (e5) {
|
|
1537
|
+
console.error(e5);
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
return t3 && (s = s.sort((() => Math.random() - 0.5))), s.forEach(((e4) => f(JSON.parse(e4)))), h && (null == a ? void 0 : a.extraOptionValue) && (null == a ? void 0 : a.extraOptionValue.length) > 0 && f(null == a ? void 0 : a.extraOptionValue[0]), n.appendChild(l), { element: n, elementTypeClass: "magicfeedback-multiple-choice-image" };
|
|
1541
|
+
};
|
|
1542
|
+
}, 732: (e2, t2, i) => {
|
|
1543
|
+
"use strict";
|
|
1544
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderNumber = void 0;
|
|
1545
|
+
const r = i(784), n = i(516);
|
|
1546
|
+
t2.renderNumber = ({ question: e3, format: t3, language: i2, urlParamValue: o }) => {
|
|
1547
|
+
const a = document.createElement("input");
|
|
1548
|
+
a.type = "number", a.placeholder = "slim" === t3 ? (0, n.parseTitle)(e3.title, i2) : r.placeholder.number(i2 || "en");
|
|
1549
|
+
const { value: s } = e3;
|
|
1550
|
+
return s.length && (s.sort(((e4, t4) => Number(e4) - Number(t4))), a.max = s[s.length - 1], a.min = s[0], a.value = s[0]), o && !isNaN(Number(o)) && (a.value = o), { element: a, elementTypeClass: "magicfeedback-number" };
|
|
1551
|
+
};
|
|
1552
|
+
}, 180: (e2, t2, i) => {
|
|
1553
|
+
"use strict";
|
|
1554
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPassword = void 0;
|
|
1555
|
+
const r = i(784);
|
|
1556
|
+
t2.renderPassword = ({ language: e3, placeholderText: t3, urlParamValue: i2 }) => {
|
|
1557
|
+
const n = document.createElement("input");
|
|
1558
|
+
return n.type = "password", n.placeholder = t3 || r.placeholder.password(e3 || "en"), i2 && (n.value = i2), { element: n, elementTypeClass: "magicfeedback-password" };
|
|
1559
|
+
};
|
|
1560
|
+
}, 66: (e2, t2, i) => {
|
|
1561
|
+
"use strict";
|
|
1562
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPointSystem = void 0;
|
|
1563
|
+
const r = i(784);
|
|
1564
|
+
t2.renderPointSystem = ({ question: e3, language: t3 }) => {
|
|
1565
|
+
const { ref: i2, value: n } = e3, o = document.createElement("div"), a = document.createElement("div");
|
|
1566
|
+
a.classList.add("magicfeedback-point-system-container");
|
|
1567
|
+
const s = document.createElement("ul");
|
|
1568
|
+
s.classList.add("magicfeedback-point-system-list"), s.style.padding = "0";
|
|
1569
|
+
const l = 100 / n.length, d = document.createElement("div");
|
|
1570
|
+
d.classList.add("magicfeedback-error"), d.textContent = r.placeholder.pointsystemerror(t3 || "en"), d.style.color = "#C70039", d.style.fontSize = "14px", d.style.textAlign = "end", d.style.width = "100%", d.style.display = "none";
|
|
1571
|
+
const c = document.createElement("div");
|
|
1572
|
+
c.classList.add("magicfeedback-point-system-total"), c.style.textAlign = "end", c.style.fontSize = "15px", c.style.marginTop = "5px";
|
|
1573
|
+
const u = document.createElement("bdi");
|
|
1574
|
+
return u.setAttribute("dir", "ltr"), u.textContent = "0 / 100 %", c.appendChild(u), n.forEach(((e4, t4) => {
|
|
1575
|
+
const r2 = document.createElement("li");
|
|
1576
|
+
r2.classList.add("magicfeedback-point-system-item"), r2.style.display = "flex", r2.style.justifyContent = "space-between", r2.style.alignItems = "center", r2.style.margin = "5px";
|
|
1577
|
+
const n2 = document.createElement("label");
|
|
1578
|
+
n2.textContent = e4, n2.style.fontSize = "15px", r2.appendChild(n2);
|
|
1579
|
+
const o2 = document.createElement("span");
|
|
1580
|
+
o2.classList.add("magicfeedback-point-system-input-container");
|
|
1581
|
+
const a2 = document.createElement("input");
|
|
1582
|
+
a2.name = i2, a2.id = `${e4}`, a2.type = "number", a2.min = "0", a2.max = "100", a2.value = "0", a2.classList.add("magicfeedback-input"), a2.style.width = "40px", a2.style.border = "0", a2.style.textAlign = "center", a2.style.margin = "0 5px", a2.autofocus = 0 === t4;
|
|
1583
|
+
const p = document.createElement("span");
|
|
1584
|
+
p.textContent = "%", p.style.color = "#000", a2.addEventListener("input", (() => {
|
|
1585
|
+
const e5 = s.querySelectorAll("input");
|
|
1586
|
+
let t5 = 0;
|
|
1587
|
+
e5.forEach(((e6) => {
|
|
1588
|
+
t5 += Number(e6.value);
|
|
1589
|
+
})), t5 > 100 && (a2.value = `${l}%`, t5 -= Number(a2.value));
|
|
1590
|
+
const i3 = document.getElementById("magicfeedback-submit");
|
|
1591
|
+
i3 && (t5 < 100 ? (c.style.color = "orange", i3.setAttribute("disabled", "true")) : (d.style.display = "none", c.style.color = "green", i3.removeAttribute("disabled"))), u.textContent = `${t5} / 100 %`;
|
|
1592
|
+
})), a2.addEventListener("focus", (() => {
|
|
1593
|
+
const e5 = document.getElementById("magicfeedback-submit");
|
|
1594
|
+
e5 && (e5.setAttribute("disabled", "true"), e5.addEventListener("pointerover", (() => {
|
|
1595
|
+
const e6 = s.querySelectorAll("input");
|
|
1596
|
+
let t5 = 0;
|
|
1597
|
+
e6.forEach(((e7) => {
|
|
1598
|
+
t5 += Number(e7.value);
|
|
1599
|
+
})), t5 < 100 && (d.style.display = "block");
|
|
1600
|
+
})));
|
|
1601
|
+
})), o2.appendChild(a2), o2.appendChild(p), r2.appendChild(o2), s.appendChild(r2);
|
|
1602
|
+
})), a.appendChild(s), a.appendChild(c), a.appendChild(d), o.appendChild(a), { element: o, elementTypeClass: "magicfeedback-point-system" };
|
|
1603
|
+
};
|
|
1604
|
+
}, 773: (e2, t2, i) => {
|
|
1605
|
+
"use strict";
|
|
1606
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPriorityList = void 0;
|
|
1607
|
+
const r = i(881);
|
|
1608
|
+
t2.renderPriorityList = ({ question: e3, randomPosition: t3, language: i2 }) => {
|
|
1609
|
+
var n, o, a;
|
|
1610
|
+
const s = document.createElement("div"), l = (function(e4) {
|
|
1611
|
+
const { value: t4, ref: i3, randomPosition: n2 = false, limitPriority: o2 = false, maxPriority: a2 = 0, language: s2 = "en", placeholder: l2 = "" } = e4, d = (e5) => (0, r.t)(s2, "priority." + e5), c = document.createElement("div");
|
|
1612
|
+
if (c.classList.add("magicfeedback-priority-list-container"), o2 && a2 && a2 > 0) {
|
|
1613
|
+
const e5 = [], o3 = document.createElement("div");
|
|
1614
|
+
o3.classList.add("magicfeedback-priority-list-header");
|
|
1615
|
+
const u2 = document.createElement("div");
|
|
1616
|
+
u2.classList.add("magicfeedback-priority-list-instruction"), u2.textContent = "" !== l2 ? l2 : `${d("instruction")}`, u2.style.display = "none";
|
|
1617
|
+
const p2 = document.createElement("button");
|
|
1618
|
+
p2.type = "button", p2.textContent = d("selectOptions"), p2.classList.add("magicfeedback-button"), p2.classList.add("magicfeedback-priority-list-open-btn"), o3.appendChild(p2), o3.appendChild(u2);
|
|
1619
|
+
const m = document.createElement("div");
|
|
1620
|
+
m.classList.add("magicfeedback-priority-list-reorder");
|
|
1621
|
+
const h = document.createElement("ul");
|
|
1622
|
+
h.classList.add("magicfeedback-priority-list-list"), m.appendChild(h);
|
|
1623
|
+
const f = () => {
|
|
1624
|
+
h.innerHTML = "", e5.forEach(((t5, r2) => {
|
|
1625
|
+
const n3 = document.createElement("li");
|
|
1626
|
+
n3.classList.add("magicfeedback-priority-list-item");
|
|
1627
|
+
const o4 = document.createElement("input");
|
|
1628
|
+
o4.classList.add("magicfeedback-input-magicfeedback-priority-list"), o4.classList.add("magicfeedback-input"), o4.type = "hidden", o4.id = `priority-list-${i3}`, o4.name = i3, o4.value = `${r2 + 1}. ${t5}`, n3.appendChild(o4);
|
|
1629
|
+
const a3 = document.createElement("label");
|
|
1630
|
+
a3.classList.add("magicfeedback-priority-list-item-label"), a3.textContent = `${r2 + 1}. ${t5}`, n3.appendChild(a3);
|
|
1631
|
+
const s3 = document.createElement("div");
|
|
1632
|
+
s3.classList.add("magicfeedback-priority-list-arrows");
|
|
1633
|
+
const l3 = document.createElement("img");
|
|
1634
|
+
l3.classList.add("magicfeedback-priority-list-arrow-up"), l3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l3.style.visibility = 0 === r2 ? "hidden" : "visible";
|
|
1635
|
+
const d2 = document.createElement("img");
|
|
1636
|
+
d2.classList.add("magicfeedback-priority-list-arrow-down"), d2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", d2.style.transform = "rotate(180deg)", d2.style.visibility = r2 === e5.length - 1 ? "hidden" : "visible", l3.addEventListener("click", (() => {
|
|
1637
|
+
var i4, r3, s4, c2;
|
|
1638
|
+
const u3 = n3.previousElementSibling;
|
|
1639
|
+
if (u3) {
|
|
1640
|
+
const p3 = Number(null === (i4 = o4.value) || void 0 === i4 ? void 0 : i4.split(".")[0]) - 1;
|
|
1641
|
+
o4.value = `${p3}. ${t5}`, a3.textContent = `${p3}. ${t5}`, l3.style.visibility = 1 === p3 ? "hidden" : "visible", d2.style.visibility = p3 === e5.length ? "hidden" : "visible";
|
|
1642
|
+
const m2 = u3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f2 = u3.querySelector(".magicfeedback-priority-list-item-label"), g2 = u3.querySelector(".magicfeedback-priority-list-arrow-up"), y2 = u3.querySelector(".magicfeedback-priority-list-arrow-down");
|
|
1643
|
+
if (m2 && f2 && g2 && y2) {
|
|
1644
|
+
const t6 = Number(null === (r3 = m2.value) || void 0 === r3 ? void 0 : r3.split(".")[0]) + 1;
|
|
1645
|
+
m2.value = `${t6}.${null === (s4 = f2.textContent) || void 0 === s4 ? void 0 : s4.split(".")[1]}`, f2.textContent = `${t6}.${null === (c2 = f2.textContent) || void 0 === c2 ? void 0 : c2.split(".")[1]}`, g2.style.visibility = 1 === t6 ? "hidden" : "visible", y2.style.visibility = t6 === e5.length ? "hidden" : "visible";
|
|
1646
|
+
}
|
|
1647
|
+
h.insertBefore(n3, u3);
|
|
1648
|
+
}
|
|
1649
|
+
})), d2.addEventListener("click", (() => {
|
|
1650
|
+
var i4, r3, s4;
|
|
1651
|
+
const c2 = n3.nextElementSibling;
|
|
1652
|
+
if (c2) {
|
|
1653
|
+
const u3 = Number(null === (i4 = o4.value) || void 0 === i4 ? void 0 : i4.split(".")[0]) + 1;
|
|
1654
|
+
o4.value = `${u3}. ${t5}`, a3.textContent = `${u3}. ${t5}`, l3.style.visibility = 1 === u3 ? "hidden" : "visible", d2.style.visibility = u3 === e5.length ? "hidden" : "visible";
|
|
1655
|
+
const p3 = c2.querySelector(".magicfeedback-input-magicfeedback-priority-list"), m2 = c2.querySelector(".magicfeedback-priority-list-item-label"), f2 = c2.querySelector(".magicfeedback-priority-list-arrow-up"), g2 = c2.querySelector(".magicfeedback-priority-list-arrow-down");
|
|
1656
|
+
if (p3 && m2 && f2 && g2) {
|
|
1657
|
+
const t6 = Number(p3.value.split(".")[0]) - 1;
|
|
1658
|
+
p3.value = `${t6}.${null === (r3 = m2.textContent) || void 0 === r3 ? void 0 : r3.split(".")[1]}`, m2.textContent = `${t6}.${null === (s4 = m2.textContent) || void 0 === s4 ? void 0 : s4.split(".")[1]}`, f2.style.visibility = 1 === t6 ? "hidden" : "visible", g2.style.visibility = t6 === e5.length ? "hidden" : "visible";
|
|
1659
|
+
}
|
|
1660
|
+
h.insertBefore(c2, n3);
|
|
1661
|
+
}
|
|
1662
|
+
})), s3.appendChild(l3), s3.appendChild(d2), n3.appendChild(s3), h.appendChild(n3);
|
|
1663
|
+
}));
|
|
1664
|
+
}, g = document.createElement("div");
|
|
1665
|
+
g.classList.add("magicfeedback-modal-backdrop"), g.setAttribute("dir", (0, r.isRtlLanguage)(s2) ? "rtl" : "ltr"), g.style.position = "fixed", g.style.top = "0", g.style.left = "0", g.style.width = "100vw", g.style.height = "100vh", g.style.background = "rgba(0,0,0,0.4)", g.style.display = "none", g.style.alignItems = "center", g.style.justifyContent = "center", g.style.zIndex = "9999";
|
|
1666
|
+
const y = document.createElement("div");
|
|
1667
|
+
y.classList.add("magicfeedback-modal"), y.style.background = "#fff", y.style.borderRadius = "8px", y.style.boxShadow = "0 8px 24px rgba(0,0,0,0.2)", y.style.maxWidth = "520px", y.style.width = "90%", y.style.maxHeight = "80vh", y.style.display = "flex", y.style.flexDirection = "column", y.style.overflow = "hidden", y.style.padding = "16px", y.style.position = "relative";
|
|
1668
|
+
const v = document.createElement("h5");
|
|
1669
|
+
v.classList.add("magicfeedback-modal-title"), v.style.flexShrink = "0", v.style.marginTop = "0";
|
|
1670
|
+
const b = () => Math.min(e5.length + 1, a2), E = () => {
|
|
1671
|
+
v.textContent = `${d("selectOptionNumber")}${b()}`;
|
|
1672
|
+
};
|
|
1673
|
+
E();
|
|
1674
|
+
const k = document.createElement("div");
|
|
1675
|
+
k.classList.add("magicfeedback-modal-list"), k.style.flex = "1 1 auto", k.style.overflowY = "auto", k.style.minHeight = "0", (n2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4]).forEach(((t5) => {
|
|
1676
|
+
const r2 = document.createElement("label");
|
|
1677
|
+
r2.classList.add("magicfeedback-modal-row");
|
|
1678
|
+
const n3 = document.createElement("input");
|
|
1679
|
+
n3.type = "checkbox", n3.classList.add("magicfeedback-input"), n3.name = `${i3}-selection`, n3.value = t5;
|
|
1680
|
+
const o4 = document.createElement("span");
|
|
1681
|
+
o4.textContent = t5, n3.addEventListener("change", (() => {
|
|
1682
|
+
if (n3.checked) {
|
|
1683
|
+
if (e5.length >= a2) return n3.checked = false, r2.classList.add("magicfeedback-warning"), void setTimeout((() => {
|
|
1684
|
+
r2.classList.remove("magicfeedback-warning");
|
|
1685
|
+
}), 800);
|
|
1686
|
+
e5.push(t5);
|
|
1687
|
+
} else {
|
|
1688
|
+
const i4 = e5.indexOf(t5);
|
|
1689
|
+
-1 !== i4 && e5.splice(i4, 1);
|
|
1690
|
+
}
|
|
1691
|
+
E(), C();
|
|
1692
|
+
})), r2.appendChild(n3), r2.appendChild(o4), k.appendChild(r2);
|
|
1693
|
+
}));
|
|
1694
|
+
const A = document.createElement("div");
|
|
1695
|
+
A.classList.add("magicfeedback-modal-actions"), A.style.flexShrink = "0";
|
|
1696
|
+
const T = document.createElement("div");
|
|
1697
|
+
T.classList.add("magicfeedback-modal-counter");
|
|
1698
|
+
const C = () => {
|
|
1699
|
+
const t5 = d("of");
|
|
1700
|
+
T.textContent = `${d("prioritized")} ${e5.length} ${t5} ${a2}`, u2.style.display = e5.length > 0 ? "block" : "none";
|
|
1701
|
+
};
|
|
1702
|
+
C();
|
|
1703
|
+
const L = document.createElement("button");
|
|
1704
|
+
L.type = "button", L.classList.add("magicfeedback-modal-close"), L.setAttribute("aria-label", d("cancel")), L.title = d("cancel"), L.textContent = "\xD7", L.style.position = "absolute", L.style.top = "8px", L.style.setProperty("inset-inline-end", "8px"), L.style.border = "none", L.style.background = "transparent", L.style.fontSize = "24px", L.style.cursor = "pointer";
|
|
1705
|
+
const x = () => {
|
|
1706
|
+
document.body.appendChild(g), g.style.display = "flex", E(), C();
|
|
1707
|
+
}, S = () => {
|
|
1708
|
+
g.style.display = "none", c.appendChild(g);
|
|
1709
|
+
};
|
|
1710
|
+
L.addEventListener("click", (() => {
|
|
1711
|
+
S();
|
|
1712
|
+
}));
|
|
1713
|
+
const O = document.createElement("button");
|
|
1714
|
+
return O.type = "button", O.textContent = d("confirm"), O.classList.add("magicfeedback-button"), O.classList.add("magicfeedback-button-primary"), O.addEventListener("click", (() => {
|
|
1715
|
+
S(), f();
|
|
1716
|
+
})), A.appendChild(T), A.appendChild(O), y.appendChild(L), y.appendChild(v), y.appendChild(k), y.appendChild(A), g.appendChild(y), p2.addEventListener("click", (() => {
|
|
1717
|
+
x();
|
|
1718
|
+
})), g.addEventListener("click", ((e6) => {
|
|
1719
|
+
e6.target === g && S();
|
|
1720
|
+
})), c.appendChild(o3), c.appendChild(m), c.appendChild(g), f(), c;
|
|
1721
|
+
}
|
|
1722
|
+
const u = document.createElement("ul");
|
|
1723
|
+
u.classList.add("magicfeedback-priority-list-list");
|
|
1724
|
+
const p = n2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4];
|
|
1725
|
+
return p.forEach(((e5, t5) => {
|
|
1726
|
+
const r2 = document.createElement("li");
|
|
1727
|
+
r2.classList.add("magicfeedback-priority-list-item"), r2.style.display = "flex", r2.style.justifyContent = "space-between", r2.style.alignItems = "center", r2.style.margin = "5px";
|
|
1728
|
+
const n3 = document.createElement("input");
|
|
1729
|
+
n3.classList.add("magicfeedback-input-magicfeedback-priority-list"), n3.classList.add("magicfeedback-input"), n3.type = "hidden", n3.id = `priority-list-${i3}`, n3.name = i3, n3.value = `${t5 + 1}. ${e5}`, r2.appendChild(n3);
|
|
1730
|
+
const o3 = document.createElement("label");
|
|
1731
|
+
o3.classList.add("magicfeedback-priority-list-item-label"), o3.textContent = `${t5 + 1}. ${e5}`, r2.appendChild(o3);
|
|
1732
|
+
const a3 = document.createElement("div");
|
|
1733
|
+
a3.style.display = "flex", a3.style.alignItems = "center", a3.style.justifyContent = "space-between";
|
|
1734
|
+
const s3 = document.createElement("img");
|
|
1735
|
+
s3.classList.add("magicfeedback-priority-list-arrow-up"), s3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", s3.style.width = "20px", s3.style.height = "20px", s3.style.cursor = "pointer", s3.style.margin = "0 5px", s3.style.color = "#000", s3.style.visibility = 0 === t5 ? "hidden" : "visible", s3.addEventListener("click", (() => {
|
|
1736
|
+
var t6, i4, a4, d2;
|
|
1737
|
+
const c2 = r2.previousElementSibling;
|
|
1738
|
+
if (c2) {
|
|
1739
|
+
const m = Number(null === (t6 = n3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) - 1;
|
|
1740
|
+
n3.value = `${m}. ${e5}`, o3.textContent = `${m}. ${e5}`, s3.style.visibility = 1 === m ? "hidden" : "visible", l3.style.visibility = m === p.length ? "hidden" : "visible";
|
|
1741
|
+
const h = c2.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f = c2.querySelector(".magicfeedback-priority-list-item-label"), g = c2.querySelector(".magicfeedback-priority-list-arrow-up"), y = c2.querySelector(".magicfeedback-priority-list-arrow-down");
|
|
1742
|
+
if (h && f && g && y) {
|
|
1743
|
+
const e6 = Number(null === (i4 = h.value) || void 0 === i4 ? void 0 : i4.split(".")[0]) + 1;
|
|
1744
|
+
h.value = `${e6}.${null === (a4 = f.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f.textContent = `${e6}.${null === (d2 = f.textContent) || void 0 === d2 ? void 0 : d2.split(".")[1]}`, g.style.visibility = 1 === e6 ? "hidden" : "visible", y.style.visibility = e6 === p.length ? "hidden" : "visible";
|
|
1745
|
+
}
|
|
1746
|
+
u.insertBefore(r2, c2);
|
|
1747
|
+
}
|
|
1748
|
+
}));
|
|
1749
|
+
const l3 = document.createElement("img");
|
|
1750
|
+
l3.classList.add("magicfeedback-priority-list-arrow-down"), l3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l3.style.width = "20px", l3.style.height = "20px", l3.style.cursor = "pointer", l3.style.margin = "0 5px", l3.style.color = "#000", l3.style.transform = "rotate(180deg)", l3.style.visibility = t5 === p.length - 1 ? "hidden" : "visible", l3.addEventListener("click", (() => {
|
|
1751
|
+
var t6, i4, a4;
|
|
1752
|
+
const d2 = r2.nextElementSibling;
|
|
1753
|
+
if (d2) {
|
|
1754
|
+
const c2 = Number(null === (t6 = n3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) + 1;
|
|
1755
|
+
n3.value = `${c2}. ${e5}`, o3.textContent = `${c2}. ${e5}`, s3.style.visibility = 1 === c2 ? "hidden" : "visible", l3.style.visibility = c2 === p.length ? "hidden" : "visible";
|
|
1756
|
+
const m = d2.querySelector(".magicfeedback-input-magicfeedback-priority-list"), h = d2.querySelector(".magicfeedback-priority-list-item-label"), f = d2.querySelector(".magicfeedback-priority-list-arrow-up"), g = d2.querySelector(".magicfeedback-priority-list-arrow-down");
|
|
1757
|
+
if (m && h && f && g) {
|
|
1758
|
+
const e6 = Number(m.value.split(".")[0]) - 1;
|
|
1759
|
+
m.value = `${e6}.${null === (i4 = h.textContent) || void 0 === i4 ? void 0 : i4.split(".")[1]}`, h.textContent = `${e6}.${null === (a4 = h.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f.style.visibility = 1 === e6 ? "hidden" : "visible", g.style.visibility = e6 === p.length ? "hidden" : "visible";
|
|
1760
|
+
}
|
|
1761
|
+
u.insertBefore(d2, r2);
|
|
1762
|
+
}
|
|
1763
|
+
})), a3.appendChild(s3), a3.appendChild(l3), r2.appendChild(a3), u.appendChild(r2);
|
|
1764
|
+
})), c.appendChild(u), c;
|
|
1765
|
+
})({ value: e3.value, ref: e3.ref, randomPosition: t3, limitPriority: (null === (n = e3.assets) || void 0 === n ? void 0 : n.limitPriority) || false, maxPriority: (null === (o = e3.assets) || void 0 === o ? void 0 : o.maxPriority) || 0, placeholder: (null === (a = e3.assets) || void 0 === a ? void 0 : a.placeholder) || "", language: i2 || "en" });
|
|
1766
|
+
return s.appendChild(l), { element: s, elementTypeClass: "magicfeedback-priority-list" };
|
|
1767
|
+
};
|
|
1768
|
+
}, 152: (e2, t2, i) => {
|
|
1769
|
+
"use strict";
|
|
1770
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingEmoji = void 0;
|
|
1771
|
+
const r = i(559), n = "https://survey-dev.magicfeedback.io/assets/emojis";
|
|
1772
|
+
t2.renderRatingEmoji = ({ question: e3, url: t3, send: i2, urlParamValue: o }) => {
|
|
1773
|
+
const { ref: a, assets: s } = e3, l = document.createElement("div"), d = "magicfeedback-rating", c = document.createElement("div");
|
|
1774
|
+
c.classList.add("magicfeedback-rating-container");
|
|
1775
|
+
const u = (null == s ? void 0 : s.max) ? Number(null == s ? void 0 : s.max) : 5, p = (null == s ? void 0 : s.min) ? Number(null == s ? void 0 : s.min) : 1, m = (0, r.createRatingPlaceholder)(null == s ? void 0 : s.minPlaceholder, null == s ? void 0 : s.maxPlaceholder);
|
|
1776
|
+
for (let e4 = p; e4 <= u; e4++) {
|
|
1777
|
+
const r2 = document.createElement("div");
|
|
1778
|
+
r2.classList.add("magicfeedback-rating-option");
|
|
1779
|
+
const s2 = document.createElement("label");
|
|
1780
|
+
s2.htmlFor = `rating-${a}-${e4}`, s2.classList.add("magicfeedback-rating-option-label-container");
|
|
1781
|
+
const l2 = document.createElement("label");
|
|
1782
|
+
l2.htmlFor = `rating-${a}-${e4}`, l2.textContent = e4.toString();
|
|
1783
|
+
const m2 = document.createElement("img");
|
|
1784
|
+
if (m2.alt = `face-${a}-${e4}`, m2.className = `rating-image${e4}`, 0 === p && 10 === u) m2.src = `${t3}/${e4}.svg`, m2.onerror = () => m2.src = `${n}/${e4}.svg`;
|
|
1785
|
+
else if (1 === p && 5 === u) switch (e4) {
|
|
1786
|
+
case 1:
|
|
1787
|
+
m2.src = `${t3}/1.svg`, m2.onerror = () => m2.src = `${n}/1.svg`;
|
|
1788
|
+
break;
|
|
1789
|
+
case 2:
|
|
1790
|
+
m2.src = `${t3}/2.svg`, m2.onerror = () => m2.src = `${n}/2.svg`;
|
|
1791
|
+
break;
|
|
1792
|
+
case 3:
|
|
1793
|
+
m2.src = `${t3}/6.svg`, m2.onerror = () => m2.src = `${n}/6.svg`;
|
|
1794
|
+
break;
|
|
1795
|
+
case 4:
|
|
1796
|
+
m2.src = `${t3}/9.svg`, m2.onerror = () => m2.src = `${n}/9.svg`;
|
|
1797
|
+
break;
|
|
1798
|
+
case 5:
|
|
1799
|
+
m2.src = `${t3}/10.svg`, m2.onerror = () => m2.src = `${n}/10.svg`;
|
|
1800
|
+
}
|
|
1801
|
+
else {
|
|
1802
|
+
const i3 = Math.round(10 / (u - p) * (e4 - p));
|
|
1803
|
+
m2.src = `${t3}/${i3}.svg`, m2.onerror = () => m2.src = `${n}/${i3}.svg`;
|
|
1804
|
+
}
|
|
1805
|
+
const h = document.createElement("input");
|
|
1806
|
+
h.id = `rating-${a}-${e4}`, h.type = "radio", h.name = a, h.value = e4.toString(), h.classList.add(d), h.classList.add("magicfeedback-input"), i2 && h.addEventListener("change", (() => {
|
|
1807
|
+
i2();
|
|
1808
|
+
})), o && o === h.value && (h.checked = true), s2.appendChild(h), s2.appendChild(m2), s2.appendChild(l2), r2.appendChild(s2), c.appendChild(r2);
|
|
1809
|
+
}
|
|
1810
|
+
if ((null == s ? void 0 : s.extraOption) && (null == s ? void 0 : s.extraOptionText)) {
|
|
1811
|
+
const e4 = document.createElement("div");
|
|
1812
|
+
e4.classList.add("magicfeedback-rating-option");
|
|
1813
|
+
const t4 = document.createElement("label");
|
|
1814
|
+
t4.htmlFor = `rating-${a}-extra`, t4.classList.add("magicfeedback-rating-option-label-container");
|
|
1815
|
+
const r2 = document.createElement("label");
|
|
1816
|
+
r2.htmlFor = `rating-${a}-extra`, r2.textContent = null == s ? void 0 : s.extraOptionText;
|
|
1817
|
+
const n2 = document.createElement("img");
|
|
1818
|
+
n2.src = "https://magicfeedback-c6458-dev.web.app/assets/question.svg", n2.alt = `face-${a}-extra`, n2.className = "magicfeedback-rating-image-extra";
|
|
1819
|
+
const o2 = document.createElement("input");
|
|
1820
|
+
o2.id = `rating-${a}-extra`, o2.type = "radio", o2.name = a, o2.value = "-", o2.classList.add(d), o2.classList.add("magicfeedback-input"), i2 && o2.addEventListener("change", (() => {
|
|
1821
|
+
i2();
|
|
1822
|
+
})), t4.appendChild(o2), t4.appendChild(n2), t4.appendChild(r2), e4.appendChild(t4), c.appendChild(e4);
|
|
1823
|
+
}
|
|
1824
|
+
return m.childElementCount > 0 && c.appendChild(m), l.appendChild(c), { element: l, elementTypeClass: d };
|
|
1825
|
+
};
|
|
1826
|
+
}, 917: (e2, t2, i) => {
|
|
1827
|
+
"use strict";
|
|
1828
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingNumber = void 0;
|
|
1829
|
+
const r = i(559);
|
|
1830
|
+
t2.renderRatingNumber = ({ question: e3, order: t3, direction: i2, send: n, urlParamValue: o, language: a }) => {
|
|
1831
|
+
const s = "magicfeedback-rating-number";
|
|
1832
|
+
return { element: (0, r.createRatingNumberElement)(e3.ref, e3.assets, t3, i2, s, n, o, a), elementTypeClass: s };
|
|
1833
|
+
};
|
|
1834
|
+
}, 452: (e2, t2, i) => {
|
|
1835
|
+
"use strict";
|
|
1836
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingStar = void 0;
|
|
1837
|
+
const r = i(559);
|
|
1838
|
+
t2.renderRatingStar = ({ question: e3, send: t3, urlParamValue: i2 }) => {
|
|
1839
|
+
var n, o;
|
|
1840
|
+
const a = document.createElement("div"), s = (0, r.createStarRating)(e3.ref, null === (n = e3.assets) || void 0 === n ? void 0 : n.minPlaceholder, null === (o = e3.assets) || void 0 === o ? void 0 : o.maxPlaceholder, t3, i2);
|
|
1841
|
+
return a.appendChild(s), { element: a, elementTypeClass: "magicfeedback-rating-star" };
|
|
1842
|
+
};
|
|
1843
|
+
}, 85: (e2, t2, i) => {
|
|
1844
|
+
"use strict";
|
|
1845
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderSelect = void 0;
|
|
1846
|
+
const r = i(516), n = i(881);
|
|
1847
|
+
t2.renderSelect = ({ question: e3, format: t3, language: i2, urlParamValue: o }) => {
|
|
1848
|
+
const { title: a, value: s, defaultValue: l } = e3, d = document.createElement("select"), c = document.createElement("option");
|
|
1849
|
+
return c.value = "", c.text = "slim" === t3 ? (0, r.parseTitle)(a, i2) : l || (0, n.t)(i2, "select.placeholder"), c.disabled = true, c.selected = true, d.appendChild(c), s.forEach(((e4) => {
|
|
1850
|
+
const t4 = document.createElement("option");
|
|
1851
|
+
t4.value = e4, t4.text = e4, d.appendChild(t4);
|
|
1852
|
+
})), o && s.includes(o) && (d.value = o), { element: d, elementTypeClass: "magicfeedback-select" };
|
|
1853
|
+
};
|
|
1854
|
+
}, 90: (e2, t2, i) => {
|
|
1855
|
+
"use strict";
|
|
1856
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderText = void 0;
|
|
1857
|
+
const r = i(784);
|
|
1858
|
+
t2.renderText = ({ language: e3, placeholderText: t3, urlParamValue: i2, send: n }) => {
|
|
1859
|
+
const o = document.createElement("input");
|
|
1860
|
+
return o.type = "text", o.placeholder = t3 || r.placeholder.answer(e3 || "en"), i2 && (o.value = i2), o.addEventListener("keyup", ((e4) => {
|
|
1861
|
+
e4.preventDefault(), "Enter" === e4.key && n && n();
|
|
1862
|
+
})), { element: o, elementTypeClass: "magicfeedback-text" };
|
|
1863
|
+
};
|
|
1864
|
+
}, 250: (e2, t2, i) => {
|
|
1865
|
+
"use strict";
|
|
1866
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadFile = void 0;
|
|
1867
|
+
const r = i(571);
|
|
1868
|
+
t2.renderUploadFile = ({ question: e3, language: t3 }) => (0, r.createUploadControl)(e3, t3, "file");
|
|
1869
|
+
}, 843: (e2, t2, i) => {
|
|
1870
|
+
"use strict";
|
|
1871
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadImage = void 0;
|
|
1872
|
+
const r = i(571);
|
|
1873
|
+
t2.renderUploadImage = ({ question: e3, language: t3 }) => (0, r.createUploadControl)(e3, t3, "image");
|
|
1874
|
+
}, 571: function(e2, t2, i) {
|
|
1875
|
+
"use strict";
|
|
1876
|
+
var r = this && this.__awaiter || function(e3, t3, i2, r2) {
|
|
1877
|
+
return new (i2 || (i2 = Promise))((function(n2, o2) {
|
|
1878
|
+
function a2(e4) {
|
|
1879
|
+
try {
|
|
1880
|
+
l2(r2.next(e4));
|
|
1881
|
+
} catch (e5) {
|
|
1882
|
+
o2(e5);
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
function s2(e4) {
|
|
1886
|
+
try {
|
|
1887
|
+
l2(r2.throw(e4));
|
|
1888
|
+
} catch (e5) {
|
|
1889
|
+
o2(e5);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
function l2(e4) {
|
|
1893
|
+
var t4;
|
|
1894
|
+
e4.done ? n2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
1895
|
+
e5(t4);
|
|
1896
|
+
}))).then(a2, s2);
|
|
1897
|
+
}
|
|
1898
|
+
l2((r2 = r2.apply(e3, t3 || [])).next());
|
|
1899
|
+
}));
|
|
1900
|
+
};
|
|
1901
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.createUploadControl = t2.awaitUploadReady = t2.getUploadValues = t2.formatFileSize = void 0;
|
|
1902
|
+
const n = i(784), o = i(516), a = "__mfUploadValues", s = "__mfUploadReady";
|
|
1903
|
+
function l(e3) {
|
|
1904
|
+
if ("number" != typeof e3 || isNaN(e3)) return "";
|
|
1905
|
+
if (e3 < 1024) return `${e3} B`;
|
|
1906
|
+
const t3 = e3 / 1024;
|
|
1907
|
+
if (t3 < 1024) return `${t3 < 10 ? t3.toFixed(1) : Math.round(t3)} KB`;
|
|
1908
|
+
const i2 = t3 / 1024;
|
|
1909
|
+
return `${i2 < 10 ? i2.toFixed(1) : Math.round(i2)} MB`;
|
|
1910
|
+
}
|
|
1911
|
+
t2.formatFileSize = l, t2.getUploadValues = function(e3) {
|
|
1912
|
+
const t3 = e3[a];
|
|
1913
|
+
return Array.isArray(t3) ? t3 : [];
|
|
1914
|
+
}, t2.awaitUploadReady = function(e3) {
|
|
1915
|
+
return r(this, void 0, void 0, (function* () {
|
|
1916
|
+
if (!e3) return;
|
|
1917
|
+
const t3 = Array.from(e3.querySelectorAll(".magicfeedback-upload-native"));
|
|
1918
|
+
yield Promise.all(t3.map(((e4) => e4[s])).filter(Boolean));
|
|
1919
|
+
}));
|
|
1920
|
+
}, t2.createUploadControl = function(e3, t3, i2) {
|
|
1921
|
+
const { ref: r2, require: d, title: c, assets: u } = e3, p = "image" === i2 ? "magicfeedback-upload-image" : "magicfeedback-upload-file", m = (null == u ? void 0 : u.multiple) || false, h = m ? (null == u ? void 0 : u.maxFiles) || 0 : 1, f = Number(null == u ? void 0 : u.maxFileSize) > 0 ? Number(null == u ? void 0 : u.maxFileSize) : 0, g = 1024 * f * 1024, y = document.createElement("div");
|
|
1922
|
+
y.classList.add("magicfeedback-upload");
|
|
1923
|
+
const v = document.createElement("input");
|
|
1924
|
+
v.type = "file", "image" === i2 && (v.accept = "image/*"), v.multiple = m, v.required = d, v.name = r2, v.id = `magicfeedback-upload-input-${r2}`, v.classList.add(p), v.classList.add("magicfeedback-input"), v.classList.add("magicfeedback-upload-native"), v[a] = [], v[s] = Promise.resolve();
|
|
1925
|
+
const b = (0, o.parseTitle)(c, t3);
|
|
1926
|
+
b && v.setAttribute("aria-label", b);
|
|
1927
|
+
const E = document.createElement("div");
|
|
1928
|
+
E.classList.add("magicfeedback-upload-dropzone");
|
|
1929
|
+
const k = document.createElement("span");
|
|
1930
|
+
k.classList.add("magicfeedback-upload-icon"), k.innerHTML = "image" === i2 ? '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg>' : '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 16l-4-4-4 4"/><path d="M12 12v9"/><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"/></svg>';
|
|
1931
|
+
const A = document.createElement("span");
|
|
1932
|
+
A.classList.add("magicfeedback-upload-cta"), A.textContent = n.placeholder.upload.cta(t3);
|
|
1933
|
+
const T = document.createElement("span");
|
|
1934
|
+
T.classList.add("magicfeedback-upload-hint"), T.textContent = (function(e4, t4, i3, r3, o2) {
|
|
1935
|
+
const a2 = [n.placeholder.upload.formats(e4, t4)];
|
|
1936
|
+
return i3 && r3 > 0 && a2.push(n.placeholder.upload.maxFiles(e4, r3)), o2 > 0 && a2.push(n.placeholder.upload.maxSize(e4, o2)), a2.filter(Boolean).join(" \xB7 ");
|
|
1937
|
+
})(t3, i2, m, h, f), E.appendChild(v), E.appendChild(k), E.appendChild(A), E.appendChild(T);
|
|
1938
|
+
const C = document.createElement("div");
|
|
1939
|
+
C.classList.add("magicfeedback-upload-error");
|
|
1940
|
+
const L = document.createElement("ul");
|
|
1941
|
+
L.classList.add("magicfeedback-upload-list"), y.appendChild(E), y.appendChild(C), y.appendChild(L);
|
|
1942
|
+
const x = /* @__PURE__ */ new WeakMap(), S = (e4) => {
|
|
1943
|
+
const t4 = x.get(e4);
|
|
1944
|
+
return t4 ? Promise.resolve(t4) : new Promise(((t5) => {
|
|
1945
|
+
const i3 = new FileReader(), r3 = (i4) => {
|
|
1946
|
+
const r4 = JSON.stringify({ name: e4.name, type: e4.type, size: e4.size, content: i4 });
|
|
1947
|
+
x.set(e4, r4), t5(r4);
|
|
1948
|
+
};
|
|
1949
|
+
i3.onload = () => r3("string" == typeof i3.result ? i3.result : ""), i3.onerror = () => r3(""), i3.readAsDataURL(e4);
|
|
1950
|
+
}));
|
|
1951
|
+
}, O = [], P = (e4) => {
|
|
1952
|
+
try {
|
|
1953
|
+
const t4 = h > 0 ? e4.slice(0, h) : e4, i3 = new DataTransfer();
|
|
1954
|
+
t4.forEach(((e5) => i3.items.add(e5))), v.files = i3.files;
|
|
1955
|
+
} catch (e5) {
|
|
1956
|
+
}
|
|
1957
|
+
!(function() {
|
|
1958
|
+
O.forEach(((e6) => URL.revokeObjectURL(e6))), O.length = 0, L.innerHTML = "";
|
|
1959
|
+
const e5 = Array.from(v.files || []);
|
|
1960
|
+
y.classList.toggle("magicfeedback-upload--has-files", e5.length > 0), e5.forEach(((e6, r3) => {
|
|
1961
|
+
const o2 = document.createElement("li");
|
|
1962
|
+
o2.classList.add("magicfeedback-upload-file-item");
|
|
1963
|
+
const a2 = document.createElement("span");
|
|
1964
|
+
if (a2.classList.add("magicfeedback-upload-thumb"), "image" === i2 && e6.type.startsWith("image/")) {
|
|
1965
|
+
const t4 = URL.createObjectURL(e6);
|
|
1966
|
+
O.push(t4);
|
|
1967
|
+
const i3 = document.createElement("img");
|
|
1968
|
+
i3.src = t4, i3.alt = e6.name, a2.appendChild(i3);
|
|
1969
|
+
} else a2.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/></svg>';
|
|
1970
|
+
const s2 = document.createElement("span");
|
|
1971
|
+
s2.classList.add("magicfeedback-upload-file-info");
|
|
1972
|
+
const d2 = document.createElement("span");
|
|
1973
|
+
d2.classList.add("magicfeedback-upload-file-name"), d2.textContent = e6.name, d2.title = e6.name;
|
|
1974
|
+
const c2 = document.createElement("span");
|
|
1975
|
+
c2.classList.add("magicfeedback-upload-file-size"), c2.textContent = l(e6.size), s2.appendChild(d2), s2.appendChild(c2);
|
|
1976
|
+
const u2 = document.createElement("button");
|
|
1977
|
+
u2.type = "button", u2.classList.add("magicfeedback-upload-remove"), u2.setAttribute("aria-label", `${n.placeholder.upload.remove(t3)}: ${e6.name}`), u2.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>', u2.addEventListener("click", ((e7) => {
|
|
1978
|
+
e7.preventDefault(), e7.stopPropagation(), P(Array.from(v.files || []).filter(((e8, t4) => t4 !== r3)));
|
|
1979
|
+
})), o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(u2), L.appendChild(o2);
|
|
1980
|
+
}));
|
|
1981
|
+
})(), (() => {
|
|
1982
|
+
const e5 = Array.from(v.files || []), t4 = Promise.all(e5.map(S)).then(((e6) => {
|
|
1983
|
+
v[a] = e6;
|
|
1984
|
+
}));
|
|
1985
|
+
v[s] = t4;
|
|
1986
|
+
})();
|
|
1987
|
+
}, w = (e4) => {
|
|
1988
|
+
if (!e4.length) return C.textContent = "", void C.classList.remove("is-visible");
|
|
1989
|
+
const i3 = e4.map(((e5) => e5.name)).join(", ");
|
|
1990
|
+
C.textContent = `${n.placeholder.upload.tooLarge(t3, f)}: ${i3}`, C.classList.add("is-visible");
|
|
1991
|
+
}, N = (e4) => {
|
|
1992
|
+
if (!g) return { accepted: e4, rejected: [] };
|
|
1993
|
+
const t4 = [], i3 = [];
|
|
1994
|
+
return e4.forEach(((e5) => (e5.size <= g ? t4 : i3).push(e5))), { accepted: t4, rejected: i3 };
|
|
1995
|
+
};
|
|
1996
|
+
v.addEventListener("change", (() => {
|
|
1997
|
+
const { accepted: e4, rejected: t4 } = N(Array.from(v.files || []));
|
|
1998
|
+
w(t4), P(e4);
|
|
1999
|
+
}));
|
|
2000
|
+
const I = (e4) => {
|
|
2001
|
+
e4.preventDefault(), e4.stopPropagation();
|
|
2002
|
+
};
|
|
2003
|
+
return ["dragenter", "dragover"].forEach(((e4) => E.addEventListener(e4, ((e5) => {
|
|
2004
|
+
I(e5), E.classList.add("is-dragover");
|
|
2005
|
+
})))), ["dragleave", "dragend"].forEach(((e4) => E.addEventListener(e4, ((e5) => {
|
|
2006
|
+
I(e5), E.classList.remove("is-dragover");
|
|
2007
|
+
})))), E.addEventListener("drop", ((e4) => {
|
|
2008
|
+
I(e4), E.classList.remove("is-dragover");
|
|
2009
|
+
const t4 = e4.dataTransfer;
|
|
2010
|
+
let r3 = t4 ? Array.from(t4.files) : [];
|
|
2011
|
+
if ("image" === i2 && (r3 = r3.filter(((e5) => e5.type.startsWith("image/")))), !r3.length) return;
|
|
2012
|
+
const { accepted: n2, rejected: o2 } = N(r3);
|
|
2013
|
+
if (w(o2), !n2.length) return;
|
|
2014
|
+
const a2 = m ? Array.from(v.files || []) : [];
|
|
2015
|
+
P(a2.concat(n2));
|
|
2016
|
+
})), { element: y, elementTypeClass: p };
|
|
2017
|
+
};
|
|
2018
|
+
}, 945: function(e2, t2, i) {
|
|
2019
|
+
"use strict";
|
|
2020
|
+
var r = this && this.__awaiter || function(e3, t3, i2, r2) {
|
|
2021
|
+
return new (i2 || (i2 = Promise))((function(n2, o2) {
|
|
2022
|
+
function a2(e4) {
|
|
2023
|
+
try {
|
|
2024
|
+
l2(r2.next(e4));
|
|
2025
|
+
} catch (e5) {
|
|
2026
|
+
o2(e5);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
function s2(e4) {
|
|
2030
|
+
try {
|
|
2031
|
+
l2(r2.throw(e4));
|
|
2032
|
+
} catch (e5) {
|
|
2033
|
+
o2(e5);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
function l2(e4) {
|
|
2037
|
+
var t4;
|
|
2038
|
+
e4.done ? n2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
2039
|
+
e5(t4);
|
|
2040
|
+
}))).then(a2, s2);
|
|
2041
|
+
}
|
|
2042
|
+
l2((r2 = r2.apply(e3, t3 || [])).next());
|
|
2043
|
+
}));
|
|
2044
|
+
}, n = this && this.__importDefault || function(e3) {
|
|
2045
|
+
return e3 && e3.__esModule ? e3 : { default: e3 };
|
|
2046
|
+
};
|
|
2047
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.nextAgentTurn = t2.startAgentSurvey = void 0;
|
|
2048
|
+
const o = n(i(326)), a = i(313), s = i(857), l = i(279);
|
|
2049
|
+
function d(e3, t3, i2, n2, s2) {
|
|
2050
|
+
var d2;
|
|
2051
|
+
return r(this, void 0, void 0, (function* () {
|
|
2052
|
+
let r2;
|
|
2053
|
+
try {
|
|
2054
|
+
r2 = yield (0, o.default)(e3 + t3, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, a.header), body: JSON.stringify(i2) });
|
|
2055
|
+
} catch (e4) {
|
|
2056
|
+
throw n2.err(`[agentSurvey/${s2}] network error`, e4), new l.AgentApiError("NETWORK", (null == e4 ? void 0 : e4.message) || "Network error");
|
|
2057
|
+
}
|
|
2058
|
+
if (!r2.ok) {
|
|
2059
|
+
let e4 = null;
|
|
2060
|
+
try {
|
|
2061
|
+
e4 = yield r2.json();
|
|
2062
|
+
} catch (e5) {
|
|
2063
|
+
}
|
|
2064
|
+
const t4 = (0, l.mapAgentStatus)(r2.status, s2);
|
|
2065
|
+
throw n2.err(`[agentSurvey/${s2}] ${r2.status}`, e4), new l.AgentApiError(t4, (null === (d2 = null == e4 ? void 0 : e4.error) || void 0 === d2 ? void 0 : d2.message) || (null == e4 ? void 0 : e4.message) || r2.statusText, r2.status, "RATE_LIMITED" === t4 ? (function(e5) {
|
|
2066
|
+
var t5, i3;
|
|
2067
|
+
const r3 = null === (i3 = null === (t5 = null == e5 ? void 0 : e5.headers) || void 0 === t5 ? void 0 : t5.get) || void 0 === i3 ? void 0 : i3.call(t5, "Retry-After"), n3 = r3 ? Number(r3) : NaN;
|
|
2068
|
+
return Number.isFinite(n3) && n3 > 0 ? 1e3 * n3 : 6e4;
|
|
2069
|
+
})(r2) : void 0, e4);
|
|
2070
|
+
}
|
|
2071
|
+
try {
|
|
2072
|
+
const e4 = yield r2.json();
|
|
2073
|
+
return n2.log(`[agentSurvey/${s2}] ok`, e4), e4;
|
|
2074
|
+
} catch (e4) {
|
|
2075
|
+
throw new l.AgentApiError("MALFORMED", "Unreadable response body", r2.status);
|
|
2076
|
+
}
|
|
2077
|
+
}));
|
|
2078
|
+
}
|
|
2079
|
+
t2.startAgentSurvey = function(e3, t3, i2) {
|
|
2080
|
+
return d(e3, s.endpoints.sdk.agentSurveyStart, t3, i2, "start");
|
|
2081
|
+
}, t2.nextAgentTurn = function(e3, t3, i2) {
|
|
2082
|
+
return d(e3, s.endpoints.sdk.agentSurveyNext, t3, i2, "next");
|
|
2083
|
+
};
|
|
2084
|
+
}, 279: (e2, t2) => {
|
|
2085
|
+
"use strict";
|
|
2086
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.mapAgentStatus = t2.AgentApiError = void 0;
|
|
2087
|
+
class i extends Error {
|
|
2088
|
+
constructor(e3, t3, r, n, o) {
|
|
2089
|
+
super(t3), this.kind = e3, this.status = r, this.retryAfterMs = n, this.body = o, this.name = "AgentApiError", Object.setPrototypeOf(this, i.prototype);
|
|
2090
|
+
}
|
|
2091
|
+
get retryable() {
|
|
2092
|
+
return "RATE_LIMITED" === this.kind || "AI_UNAVAILABLE" === this.kind || "NETWORK" === this.kind;
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
t2.AgentApiError = i, t2.mapAgentStatus = function(e3, t3) {
|
|
2096
|
+
return 429 === e3 ? "RATE_LIMITED" : 406 === e3 || 401 === e3 || 403 === e3 ? "AUTH" : 404 === e3 ? "NOT_FOUND" : 400 === e3 || 422 === e3 ? "BAD_CONFIG" : e3 >= 500 ? "start" === t3 ? "AI_UNAVAILABLE" : "NETWORK" : "MALFORMED";
|
|
2097
|
+
};
|
|
2098
|
+
}, 177: (e2, t2, i) => {
|
|
2099
|
+
"use strict";
|
|
2100
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.encodeAnswer = t2.toAgentStep = t2.ratingBounds = t2.mapAgentType = t2.DEFAULT_ANSWER_DELIMITER = void 0;
|
|
2101
|
+
const r = i(558), n = i(516);
|
|
2102
|
+
t2.DEFAULT_ANSWER_DELIMITER = ", ";
|
|
2103
|
+
const o = [r.FEEDBACKAPPANSWERTYPE.RADIO, r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE, r.FEEDBACKAPPANSWERTYPE.SELECT, r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE], a = Object.values(r.FEEDBACKAPPANSWERTYPE);
|
|
2104
|
+
function s(e3, t3, i2) {
|
|
2105
|
+
var s2, l2, d2;
|
|
2106
|
+
const c2 = String(e3 || "").trim().toUpperCase();
|
|
2107
|
+
return "RATING" === c2 ? r.FEEDBACKAPPANSWERTYPE.RATING_NUMBER : c2 === r.FEEDBACKAPPANSWERTYPE.CONTACT ? (null === (s2 = i2.log) || void 0 === s2 || s2.log("[agentSurvey] CONTACT has no renderer, falling back to TEXT"), r.FEEDBACKAPPANSWERTYPE.TEXT) : a.includes(c2) ? o.includes(c2) && 0 === t3.length ? (null === (d2 = i2.log) || void 0 === d2 || d2.err(`[agentSurvey] ${c2} arrived with no options, falling back to TEXT`), r.FEEDBACKAPPANSWERTYPE.TEXT) : c2 !== r.FEEDBACKAPPANSWERTYPE.BOOLEAN || 2 !== t3.length || (function(e4, t4) {
|
|
2108
|
+
if (2 !== e4.length) return false;
|
|
2109
|
+
const i3 = e4.map(((e5) => String(e5).trim().toLowerCase())), r2 = (0, n.getBooleanOptions)(t4).map(((e5) => e5.toLowerCase())), o2 = ["yes", "no"];
|
|
2110
|
+
return i3[0] === o2[0] && i3[1] === o2[1] || i3[0] === r2[0] && i3[1] === r2[1];
|
|
2111
|
+
})(t3, i2.language) ? c2 : r.FEEDBACKAPPANSWERTYPE.RADIO : (null === (l2 = i2.log) || void 0 === l2 || l2.err(`[agentSurvey] unknown question type "${e3}", falling back to TEXT`), r.FEEDBACKAPPANSWERTYPE.TEXT);
|
|
2112
|
+
}
|
|
2113
|
+
function l(e3) {
|
|
2114
|
+
const t3 = e3.map(Number).filter(((e4) => Number.isFinite(e4)));
|
|
2115
|
+
return t3.length >= 2 ? { min: Math.min(...t3), max: Math.max(...t3) } : { min: 1, max: 5 };
|
|
2116
|
+
}
|
|
2117
|
+
function d(e3, t3, i2) {
|
|
2118
|
+
const n2 = { randomPosition: false, direction: "row", order: "ltr" };
|
|
2119
|
+
return e3 !== r.FEEDBACKAPPANSWERTYPE.RATING_NUMBER && e3 !== r.FEEDBACKAPPANSWERTYPE.RATING_EMOJI || Object.assign(n2, l(t3)), e3 === r.FEEDBACKAPPANSWERTYPE.LONGTEXT && (n2.maxCharacters = 0), Object.assign(Object.assign({}, n2), (null == i2 ? void 0 : i2.assets) || {});
|
|
2120
|
+
}
|
|
2121
|
+
function c(e3, t3, i2) {
|
|
2122
|
+
var r2, n2, o2, a2;
|
|
2123
|
+
const { full: l2, title: c2 } = t3, u = [...null !== (n2 = null !== (r2 = e3.questionValues) && void 0 !== r2 ? r2 : null == l2 ? void 0 : l2.value) && void 0 !== n2 ? n2 : []], p = s(null !== (o2 = null == l2 ? void 0 : l2.type) && void 0 !== o2 ? o2 : e3.questionType, u, i2), m = e3.questionRef || (null == l2 ? void 0 : l2.ref) || `agent-q-${e3.currentTurn}`;
|
|
2124
|
+
return { id: (null == l2 ? void 0 : l2.id) || `agent-${i2.sessionId}-${e3.currentTurn}`, title: c2 || "", type: p, questionType: { conf: null }, ref: m, require: null === (a2 = null == l2 ? void 0 : l2.require) || void 0 === a2 || a2, external_id: (null == l2 ? void 0 : l2.external_id) || "", value: u, defaultValue: (null == l2 ? void 0 : l2.defaultValue) || "", followup: false, position: e3.currentTurn, assets: d(p, u, l2), refMetric: (null == l2 ? void 0 : l2.refMetric) || "", integrationId: i2.integrationId, integrationPageId: "", status: "ACTIVE" };
|
|
2125
|
+
}
|
|
2126
|
+
t2.mapAgentType = s, t2.ratingBounds = l, t2.toAgentStep = function(e3, t3) {
|
|
2127
|
+
var i2, n2, o2;
|
|
2128
|
+
const a2 = e3, s2 = e3.currentTurn, l2 = e3.maxTurns, d2 = a2.coverageSummary, u = (e4) => ({ kind: "END", reason: e4, currentTurn: s2, maxTurns: l2, coverageSummary: d2 });
|
|
2129
|
+
if (a2.answerType === r.AGENT_ANSWER_TYPE_BLOCKED) return u("BLOCKED");
|
|
2130
|
+
if (true === a2.shouldEnd) return u("SHOULD_END");
|
|
2131
|
+
const p = (function(e4) {
|
|
2132
|
+
const t4 = e4.question && "object" == typeof e4.question ? e4.question : e4.nextQuestion && "object" == typeof e4.nextQuestion ? e4.nextQuestion : null;
|
|
2133
|
+
if (t4) {
|
|
2134
|
+
const e5 = t4, i3 = e5.title;
|
|
2135
|
+
return { full: e5, title: "string" == typeof i3 ? i3 : i3 ? JSON.stringify(i3) : null };
|
|
2136
|
+
}
|
|
2137
|
+
return { full: null, title: "string" == typeof e4.nextQuestion ? e4.nextQuestion : null };
|
|
2138
|
+
})(e3);
|
|
2139
|
+
return "NONE" === String(null !== (o2 = null !== (n2 = null === (i2 = p.full) || void 0 === i2 ? void 0 : i2.type) && void 0 !== n2 ? n2 : e3.questionType) && void 0 !== o2 ? o2 : "").trim().toUpperCase() ? u("TYPE_NONE") : p.title && p.title.trim() ? { kind: "QUESTION", question: c(e3, p, t3), isFromBase: true === e3.isFromBase, currentTurn: s2, maxTurns: l2, topic: a2.topic, coverageGaps: e3.coverageGaps, coverageSummary: d2 } : u("NO_QUESTION");
|
|
2140
|
+
}, t2.encodeAnswer = function(e3, i2, r2 = t2.DEFAULT_ANSWER_DELIMITER) {
|
|
2141
|
+
const n2 = i2.ref, o2 = (e4) => e4.flatMap(((e5) => Array.isArray(e5.value) ? e5.value : [e5.value])).map(((e5) => "string" == typeof e5 ? e5 : JSON.stringify(e5))).map(((e5) => (e5 || "").trim())).filter(((e5) => "" !== e5)), a2 = o2(e3.filter(((e4) => e4.key === n2))), s2 = o2(e3.filter(((e4) => e4.key === `extra-option-${n2}`)));
|
|
2142
|
+
return [a2.filter(((e4, t3) => a2.indexOf(e4) === t3)).join(r2), s2.join(r2)].filter(((e4) => "" !== e4)).join(r2);
|
|
2143
|
+
};
|
|
2144
|
+
}, 107: (e2, t2, i) => {
|
|
2145
|
+
"use strict";
|
|
2146
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.scrapeInputs = void 0;
|
|
2147
|
+
const r = i(571);
|
|
2148
|
+
t2.scrapeInputs = function(e3) {
|
|
2149
|
+
const t3 = e3.querySelectorAll(".magicfeedback-input"), i2 = [], n = {};
|
|
2150
|
+
return t3.forEach(((e4) => {
|
|
2151
|
+
var t4;
|
|
2152
|
+
const o = e4, a = o.name;
|
|
2153
|
+
if (!a) return;
|
|
2154
|
+
const s = o.type;
|
|
2155
|
+
if (("radio" === s || "checkbox" === s) && !o.checked) return;
|
|
2156
|
+
const l = o.value, d = o.classList[0];
|
|
2157
|
+
if ((null == d ? void 0 : d.includes("magicfeedback-priority-list")) || (null === (t4 = o.id) || void 0 === t4 ? void 0 : t4.startsWith("priority-list-"))) return n[a] || (n[a] = []), void n[a].push(l);
|
|
2158
|
+
if (null == d ? void 0 : d.includes("magicfeedback-upload")) {
|
|
2159
|
+
const e5 = (0, r.getUploadValues)(o);
|
|
2160
|
+
return void (e5.length && i2.push({ key: a, value: e5 }));
|
|
2161
|
+
}
|
|
2162
|
+
const c = "magicfeedback-consent" === d ? o.checked.toString() : l;
|
|
2163
|
+
null != c && i2.push({ key: a, value: [c] });
|
|
2164
|
+
})), Object.entries(n).forEach((([e4, t4]) => {
|
|
2165
|
+
const r2 = t4.slice().sort(((e5, t5) => Number(e5.split(".")[0]) - Number(t5.split(".")[0])));
|
|
2166
|
+
i2.push({ key: e4, value: r2 });
|
|
2167
|
+
})), i2;
|
|
2168
|
+
};
|
|
2169
|
+
}, 881: (e2, t2) => {
|
|
2170
|
+
"use strict";
|
|
2171
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.t = t2.isLanguageSupported = t2.isRtlLanguage = t2.hasOwnTranslation = t2.TRANSLATION_KEYS = t2.normalizeLanguage = t2.RTL_LANGUAGES = t2.AVAILABLE_LANGUAGES = t2.SUPPORTED_LANGUAGES = void 0;
|
|
2172
|
+
const i = { "placeholder.answer": "Write your answer here...", "placeholder.number": "Write your number here...", "placeholder.email": "Write your email here...", "placeholder.date": "Write your date here...", "placeholder.password": "Write your password here...", "pointSystem.error": "The total points must be 100 %", "boolean.yes": "Yes", "boolean.no": "No", "upload.cta": "Drag & drop or click to upload", "upload.imagesOnly": "Images only", "upload.anyFileType": "Any file type", "upload.maxFiles": "Max {n} files", "upload.maxSize": "Max {mb} MB", "upload.tooLarge": "File is too large (max {mb} MB)", "upload.remove": "Remove", "select.placeholder": "Select an option", "rating.ariaLabel": "Rating", "priority.selectUpTo": "Select up to", "priority.options": "options", "priority.thenOrder": "and then order them", "priority.selectOptions": "Select options", "priority.cancel": "Cancel", "priority.confirm": "Confirm", "priority.selectOptionNumber": "Select option #", "priority.prioritized": "Prioritized", "priority.of": "of", "priority.instruction": "Your priority list can be seen below. If you wish, you can rearrange your choices using the arrows. Click 'Next' to confirm your selection and proceed.", "action.send": "Send", "action.back": "Back", "action.next": "Next", "action.start": "Go!", "message.success": "Thank you for your feedback!", "message.blocked": "Thanks for your time - we'll end the conversation here.", "message.required": "Please answer before continuing.", "message.rateLimit": "Too many requests. Retrying in {seconds}s..." }, r = { en: i, es: { "placeholder.answer": "Escribe tu respuesta aqu\xED...", "placeholder.number": "Escribe tu n\xFAmero aqu\xED...", "placeholder.email": "Escribe tu correo electr\xF3nico aqu\xED...", "placeholder.date": "Escribe tu fecha aqu\xED...", "placeholder.password": "Escribe tu contrase\xF1a aqu\xED...", "pointSystem.error": "El total de puntos debe ser 100 %", "boolean.yes": "S\xED", "boolean.no": "No", "upload.cta": "Arrastra y suelta o haz clic para subir", "upload.imagesOnly": "Solo im\xE1genes", "upload.anyFileType": "Cualquier tipo de archivo", "upload.maxFiles": "M\xE1x. {n} archivos", "upload.maxSize": "M\xE1x. {mb} MB", "upload.tooLarge": "Archivo demasiado grande (m\xE1x. {mb} MB)", "upload.remove": "Eliminar", "select.placeholder": "Selecciona una opci\xF3n", "rating.ariaLabel": "Valoraci\xF3n", "priority.selectUpTo": "Selecciona hasta", "priority.options": "opciones", "priority.thenOrder": "y luego ord\xE9nalas", "priority.selectOptions": "Seleccionar opciones", "priority.cancel": "Cancelar", "priority.confirm": "Confirmar", "priority.selectOptionNumber": "Selecciona la opci\xF3n #", "priority.prioritized": "Priorizadas", "priority.of": "de", "priority.instruction": 'Tu lista priorizada se muestra abajo. Si deseas, puedes reordenar las opciones con las flechas. Haz clic en "Siguiente" para confirmar y continuar.', "action.send": "Enviar", "action.back": "Atr\xE1s", "action.next": "Siguiente", "action.start": "\xA1Empezar!", "message.success": "\xA1Gracias por tus comentarios!", "message.blocked": "Gracias por tu tiempo, terminamos aqu\xED la conversaci\xF3n.", "message.required": "Por favor, responde antes de continuar.", "message.rateLimit": "Demasiadas solicitudes. Reintentando en {seconds} s..." }, de: { "placeholder.answer": "Schreiben Sie hier Ihre Antwort...", "placeholder.number": "Geben Sie hier Ihre Zahl ein...", "placeholder.email": "Geben Sie hier Ihre E-Mail-Adresse ein...", "placeholder.date": "Geben Sie hier Ihr Datum ein...", "placeholder.password": "Geben Sie hier Ihr Passwort ein...", "pointSystem.error": "Die Gesamtpunktzahl muss 100 % betragen", "boolean.yes": "Ja", "boolean.no": "Nein", "upload.cta": "Ziehen Sie Dateien hierher oder klicken Sie zum Hochladen", "upload.imagesOnly": "Nur Bilder", "upload.anyFileType": "Beliebiger Dateityp", "upload.maxFiles": "Max. {n} Dateien", "upload.maxSize": "Max. {mb} MB", "upload.tooLarge": "Datei ist zu gro\xDF (max. {mb} MB)", "upload.remove": "Entfernen", "select.placeholder": "Option ausw\xE4hlen", "rating.ariaLabel": "Bewertung", "priority.selectUpTo": "W\xE4hlen Sie bis zu", "priority.options": "Optionen", "priority.thenOrder": "und ordnen Sie sie dann", "priority.selectOptions": "Optionen ausw\xE4hlen", "priority.cancel": "Abbrechen", "priority.confirm": "Best\xE4tigen", "priority.selectOptionNumber": "W\xE4hlen Sie Option #", "priority.prioritized": "Priorisiert", "priority.of": "von", "priority.instruction": 'Ihre Priorit\xE4tenliste wird unten angezeigt. Wenn Sie m\xF6chten, k\xF6nnen Sie Ihre Auswahl mit den Pfeilen neu anordnen. Klicken Sie auf "Weiter", um Ihre Auswahl zu best\xE4tigen und fortzufahren.', "action.send": "Senden", "action.back": "Zur\xFCck", "action.next": "Weiter", "action.start": "Los!", "message.success": "Vielen Dank f\xFCr Ihr Feedback!", "message.blocked": "Danke f\xFCr Ihre Zeit - wir beenden das Gespr\xE4ch hier.", "message.required": "Bitte antworten Sie, bevor Sie fortfahren.", "message.rateLimit": "Zu viele Anfragen. Erneuter Versuch in {seconds} s..." }, fr: { "placeholder.answer": "\xC9crivez votre r\xE9ponse ici...", "placeholder.number": "\xC9crivez votre nombre ici...", "placeholder.email": "\xC9crivez votre e-mail ici...", "placeholder.date": "\xC9crivez votre date ici...", "placeholder.password": "\xC9crivez votre mot de passe ici...", "pointSystem.error": "Le total des points doit \xEAtre de 100 %", "boolean.yes": "Oui", "boolean.no": "Non", "upload.cta": "Glissez-d\xE9posez ou cliquez pour t\xE9l\xE9verser", "upload.imagesOnly": "Images uniquement", "upload.anyFileType": "Tout type de fichier", "upload.maxFiles": "Max. {n} fichiers", "upload.maxSize": "Max. {mb} Mo", "upload.tooLarge": "Fichier trop volumineux (max. {mb} Mo)", "upload.remove": "Supprimer", "select.placeholder": "S\xE9lectionnez une option", "rating.ariaLabel": "\xC9valuation", "priority.selectUpTo": "S\xE9lectionnez jusqu'\xE0", "priority.options": "options", "priority.thenOrder": "puis classez-les", "priority.selectOptions": "S\xE9lectionner des options", "priority.cancel": "Annuler", "priority.confirm": "Confirmer", "priority.selectOptionNumber": "S\xE9lectionnez l'option #", "priority.prioritized": "Prioris\xE9es", "priority.of": "sur", "priority.instruction": `Votre liste de priorit\xE9s est affich\xE9e ci-dessous. Si vous le souhaitez, vous pouvez r\xE9organiser vos choix \xE0 l'aide des fl\xE8ches. Cliquez sur "Suivant" pour confirmer votre s\xE9lection et continuer.`, "action.send": "Envoyer", "action.back": "Retour", "action.next": "Suivant", "action.start": "C'est parti !", "message.success": "Merci pour votre retour !", "message.blocked": "Merci pour votre temps, nous terminons la conversation ici.", "message.required": "Veuillez r\xE9pondre avant de continuer.", "message.rateLimit": "Trop de requ\xEAtes. Nouvelle tentative dans {seconds} s..." }, pt: { "placeholder.answer": "Escreva sua resposta aqui...", "placeholder.number": "Escreva seu n\xFAmero aqui...", "placeholder.email": "Escreva seu e-mail aqui...", "placeholder.date": "Escreva sua data aqui...", "placeholder.password": "Escreva sua senha aqui...", "pointSystem.error": "O total de pontos deve ser 100 %", "boolean.yes": "Sim", "boolean.no": "N\xE3o", "upload.cta": "Arraste e solte ou clique para enviar", "upload.imagesOnly": "Somente imagens", "upload.anyFileType": "Qualquer tipo de arquivo", "upload.maxFiles": "M\xE1x. {n} arquivos", "upload.maxSize": "M\xE1x. {mb} MB", "upload.tooLarge": "Arquivo muito grande (m\xE1x. {mb} MB)", "upload.remove": "Remover", "select.placeholder": "Selecione uma op\xE7\xE3o", "rating.ariaLabel": "Avalia\xE7\xE3o", "priority.selectUpTo": "Selecione at\xE9", "priority.options": "op\xE7\xF5es", "priority.thenOrder": "e depois ordene-as", "priority.selectOptions": "Selecionar op\xE7\xF5es", "priority.cancel": "Cancelar", "priority.confirm": "Confirmar", "priority.selectOptionNumber": "Selecione a op\xE7\xE3o #", "priority.prioritized": "Priorizadas", "priority.of": "de", "priority.instruction": 'Sua lista de prioridades pode ser vista abaixo. Se quiser, voc\xEA pode reorganizar suas escolhas usando as setas. Clique em "Pr\xF3ximo" para confirmar sua sele\xE7\xE3o e continuar.', "action.send": "Enviar", "action.back": "Voltar", "action.next": "Pr\xF3ximo", "action.start": "Come\xE7ar!", "message.success": "Obrigado pelo seu feedback!", "message.blocked": "Obrigado pelo seu tempo, encerramos a conversa por aqui.", "message.required": "Responda antes de continuar.", "message.rateLimit": "Muitas solicita\xE7\xF5es. Tentando novamente em {seconds} s..." }, da: { "placeholder.answer": "Skriv dit svar her...", "placeholder.number": "Skriv dit nummer her...", "placeholder.email": "Skriv din e-mail her...", "placeholder.date": "Skriv din dato her...", "placeholder.password": "Skriv dit kodeord her...", "pointSystem.error": "Samlet antal point skal v\xE6re 100 %", "boolean.yes": "Ja", "boolean.no": "Nej", "upload.cta": "Tr\xE6k og slip eller klik for at uploade", "upload.imagesOnly": "Kun billeder", "upload.anyFileType": "Enhver filtype", "upload.maxFiles": "Maks. {n} filer", "upload.maxSize": "Maks. {mb} MB", "upload.tooLarge": "Filen er for stor (maks. {mb} MB)", "upload.remove": "Fjern", "select.placeholder": "V\xE6lg en mulighed", "rating.ariaLabel": "Bed\xF8mmelse", "priority.selectUpTo": "V\xE6lg op til", "priority.options": "muligheder", "priority.thenOrder": "og sorter dem derefter", "priority.selectOptions": "V\xE6lg muligheder", "priority.cancel": "Annuller", "priority.confirm": "Bekr\xE6ft", "priority.selectOptionNumber": "V\xE6lg mulighed #", "priority.prioritized": "Prioriteret", "priority.of": "af", "priority.instruction": 'Din prioritetsliste vises nedenfor. Hvis du \xF8nsker det, kan du omarrangere dine valg ved hj\xE6lp af pilene. Klik p\xE5 "N\xE6ste" for at bekr\xE6fte dit valg og forts\xE6tte.', "action.send": "Send", "action.back": "Tilbage", "action.next": "N\xE6ste", "action.start": "Start!", "message.success": "Tak for din feedback!", "message.blocked": "Tak for din tid - vi afslutter samtalen her.", "message.required": "Svar venligst, f\xF8r du forts\xE6tter.", "message.rateLimit": "For mange foresp\xF8rgsler. Pr\xF8ver igen om {seconds} s..." }, fi: { "placeholder.answer": "Kirjoita vastauksesi t\xE4h\xE4n...", "placeholder.number": "Kirjoita numerosi t\xE4h\xE4n...", "placeholder.email": "Kirjoita s\xE4hk\xF6postiosoitteesi t\xE4h\xE4n...", "placeholder.date": "Kirjoita p\xE4iv\xE4m\xE4\xE4r\xE4si t\xE4h\xE4n...", "placeholder.password": "Kirjoita salasanasi t\xE4h\xE4n...", "pointSystem.error": "Kokonaispisteiden on oltava 100 %", "boolean.yes": "Kyll\xE4", "boolean.no": "Ei", "upload.cta": "Ved\xE4 ja pudota tai napsauta ladataksesi", "upload.imagesOnly": "Vain kuvat", "upload.anyFileType": "Mik\xE4 tahansa tiedostotyyppi", "upload.maxFiles": "Enint\xE4\xE4n {n} tiedostoa", "upload.maxSize": "Enint\xE4\xE4n {mb} MB", "upload.tooLarge": "Tiedosto on liian suuri (enint\xE4\xE4n {mb} MB)", "upload.remove": "Poista", "select.placeholder": "Valitse vaihtoehto", "rating.ariaLabel": "Arvio", "priority.selectUpTo": "Valitse enint\xE4\xE4n", "priority.options": "vaihtoehtoa", "priority.thenOrder": "ja j\xE4rjest\xE4 ne sitten", "priority.selectOptions": "Valitse vaihtoehdot", "priority.cancel": "Peruuta", "priority.confirm": "Vahvista", "priority.selectOptionNumber": "Valitse vaihtoehto #", "priority.prioritized": "Priorisoitu", "priority.of": " / ", "priority.instruction": 'Prioriteettilistasi n\xE4kyy alla. Voit halutessasi j\xE4rjest\xE4\xE4 valinnat uudelleen nuolien avulla. Napsauta "Seuraava" vahvistaaksesi valinnan ja jatkaaksesi.', "action.send": "L\xE4het\xE4", "action.back": "Takaisin", "action.next": "Seuraava", "action.start": "Aloita!", "message.success": "Kiitos palautteestasi!", "message.blocked": "Kiitos ajastasi - lopetamme keskustelun t\xE4h\xE4n.", "message.required": "Vastaa ennen jatkamista.", "message.rateLimit": "Liikaa pyynt\xF6j\xE4. Yritet\xE4\xE4n uudelleen {seconds} s kuluttua..." }, no: { "placeholder.answer": "Skriv svaret ditt her...", "placeholder.number": "Skriv nummeret ditt her...", "placeholder.email": "Skriv e-posten din her...", "placeholder.date": "Skriv datoen din her...", "placeholder.password": "Skriv passordet ditt her...", "pointSystem.error": "Totalt antall poeng m\xE5 v\xE6re 100 %", "boolean.yes": "Ja", "boolean.no": "Nei", "upload.cta": "Dra og slipp eller klikk for \xE5 laste opp", "upload.imagesOnly": "Kun bilder", "upload.anyFileType": "Alle filtyper", "upload.maxFiles": "Maks {n} filer", "upload.maxSize": "Maks {mb} MB", "upload.tooLarge": "Filen er for stor (maks {mb} MB)", "upload.remove": "Fjern", "select.placeholder": "Velg et alternativ", "rating.ariaLabel": "Vurdering", "priority.selectUpTo": "Velg opptil", "priority.options": "alternativer", "priority.thenOrder": "og ordne dem deretter", "priority.selectOptions": "Velg alternativer", "priority.cancel": "Avbryt", "priority.confirm": "Bekreft", "priority.selectOptionNumber": "Velg alternativ #", "priority.prioritized": "Prioritert", "priority.of": "av", "priority.instruction": 'Prioriteringslisten din vises nedenfor. Hvis du \xF8nsker det, kan du ordne valgene dine ved hjelp av pilene. Klikk p\xE5 "Neste" for \xE5 bekrefte valget ditt og fortsette.', "action.send": "Send", "action.back": "Tilbake", "action.next": "Neste", "action.start": "Start!", "message.success": "Takk for tilbakemeldingen!", "message.blocked": "Takk for tiden din - vi avslutter samtalen her.", "message.required": "Vennligst svar f\xF8r du fortsetter.", "message.rateLimit": "For mange foresp\xF8rsler. Pr\xF8ver igjen om {seconds} s..." }, sv: { "placeholder.answer": "Skriv ditt svar h\xE4r...", "placeholder.number": "Skriv ditt nummer h\xE4r...", "placeholder.email": "Skriv din e-post h\xE4r...", "placeholder.date": "Skriv ditt datum h\xE4r...", "placeholder.password": "Skriv ditt l\xF6senord h\xE4r...", "pointSystem.error": "Totala po\xE4ng m\xE5ste vara 100 %", "boolean.yes": "Ja", "boolean.no": "Nej", "upload.cta": "Dra och sl\xE4pp eller klicka f\xF6r att ladda upp", "upload.imagesOnly": "Endast bilder", "upload.anyFileType": "Alla filtyper", "upload.maxFiles": "Max {n} filer", "upload.maxSize": "Max {mb} MB", "upload.tooLarge": "Filen \xE4r f\xF6r stor (max {mb} MB)", "upload.remove": "Ta bort", "select.placeholder": "V\xE4lj ett alternativ", "rating.ariaLabel": "Betyg", "priority.selectUpTo": "V\xE4lj upp till", "priority.options": "alternativ", "priority.thenOrder": "och ordna dem sedan", "priority.selectOptions": "V\xE4lj alternativ", "priority.cancel": "Avbryt", "priority.confirm": "Bekr\xE4fta", "priority.selectOptionNumber": "V\xE4lj alternativ #", "priority.prioritized": "Prioriterat", "priority.of": "av", "priority.instruction": 'Din prioriteringslista visas nedan. Om du vill kan du ordna om dina val med hj\xE4lp av pilarna. Klicka p\xE5 "N\xE4sta" f\xF6r att bekr\xE4fta ditt val och forts\xE4tta.', "action.send": "Skicka", "action.back": "Tillbaka", "action.next": "N\xE4sta", "action.start": "K\xF6r!", "message.success": "Tack f\xF6r din feedback!", "message.blocked": "Tack f\xF6r din tid - vi avslutar samtalet h\xE4r.", "message.required": "Svara innan du forts\xE4tter.", "message.rateLimit": "F\xF6r m\xE5nga f\xF6rfr\xE5gningar. F\xF6rs\xF6ker igen om {seconds} s..." }, ar: { "placeholder.answer": "\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627...", "placeholder.number": "\u0627\u0643\u062A\u0628 \u0631\u0642\u0645\u0643 \u0647\u0646\u0627...", "placeholder.email": "\u0627\u0643\u062A\u0628 \u0628\u0631\u064A\u062F\u0643 \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A \u0647\u0646\u0627...", "placeholder.date": "\u0627\u0643\u062A\u0628 \u062A\u0627\u0631\u064A\u062E\u0643 \u0647\u0646\u0627...", "placeholder.password": "\u0627\u0643\u062A\u0628 \u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0647\u0646\u0627...", "pointSystem.error": "\u064A\u062C\u0628 \u0623\u0646 \u062A\u0643\u0648\u0646 \u0627\u0644\u0646\u0642\u0627\u0637 \u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A\u0629 100 %", "boolean.yes": "\u0646\u0639\u0645", "boolean.no": "\u0644\u0627", "upload.cta": "\u0627\u0633\u062D\u0628 \u0648\u0623\u0641\u0644\u062A \u0623\u0648 \u0627\u0646\u0642\u0631 \u0644\u0644\u062A\u062D\u0645\u064A\u0644", "upload.imagesOnly": "\u0627\u0644\u0635\u0648\u0631 \u0641\u0642\u0637", "upload.anyFileType": "\u0623\u064A \u0646\u0648\u0639 \u0645\u0646 \u0627\u0644\u0645\u0644\u0641\u0627\u062A", "upload.maxFiles": "{n} \u0645\u0644\u0641\u0627\u062A \u0643\u062D\u062F \u0623\u0642\u0635\u0649", "upload.maxSize": "{mb} \u0645\u064A\u063A\u0627\u0628\u0627\u064A\u062A \u0643\u062D\u062F \u0623\u0642\u0635\u0649", "upload.tooLarge": "\u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {mb} \u0645\u064A\u063A\u0627\u0628\u0627\u064A\u062A)", "upload.remove": "\u0625\u0632\u0627\u0644\u0629", "select.placeholder": "\u0627\u062E\u062A\u0631 \u062E\u064A\u0627\u0631\u064B\u0627", "rating.ariaLabel": "\u0627\u0644\u062A\u0642\u064A\u064A\u0645", "priority.selectUpTo": "\u0627\u062E\u062A\u0631 \u062D\u062A\u0649", "priority.options": "\u062E\u064A\u0627\u0631\u0627\u062A", "priority.thenOrder": "\u062B\u0645 \u0631\u062A\u0628\u0647\u0627", "priority.selectOptions": "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A", "priority.cancel": "\u0625\u0644\u063A\u0627\u0621", "priority.confirm": "\u062A\u0623\u0643\u064A\u062F", "priority.selectOptionNumber": "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631 #", "priority.prioritized": "\u062A\u0645 \u0627\u0644\u062A\u0631\u062A\u064A\u0628", "priority.of": "\u0645\u0646", "priority.instruction": '\u062A\u0638\u0647\u0631 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0623\u0648\u0644\u0648\u064A\u0627\u062A \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0623\u062F\u0646\u0627\u0647. \u0625\u0630\u0627 \u0631\u063A\u0628\u062A\u060C \u064A\u0645\u0643\u0646\u0643 \u0625\u0639\u0627\u062F\u0629 \u062A\u0631\u062A\u064A\u0628 \u0627\u062E\u062A\u064A\u0627\u0631\u0627\u062A\u0643 \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0623\u0633\u0647\u0645. \u0627\u0646\u0642\u0631 \u0639\u0644\u0649 "\u0627\u0644\u062A\u0627\u0644\u064A" \u0644\u062A\u0623\u0643\u064A\u062F \u0627\u062E\u062A\u064A\u0627\u0631\u0643 \u0648\u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0629.', "action.send": "\u0625\u0631\u0633\u0627\u0644", "action.back": "\u0631\u062C\u0648\u0639", "action.next": "\u0627\u0644\u062A\u0627\u0644\u064A", "action.start": "\u0627\u0628\u062F\u0623!", "message.success": "\u0634\u0643\u0631\u064B\u0627 \u0644\u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643!", "message.blocked": "\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0648\u0642\u062A\u0643\u060C \u0633\u0646\u0646\u0647\u064A \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0647\u0646\u0627.", "message.required": "\u064A\u0631\u062C\u0649 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0642\u0628\u0644 \u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0629.", "message.rateLimit": "\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627. \u0633\u0646\u0639\u064A\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u062E\u0644\u0627\u0644 {seconds} \u062B\u0627\u0646\u064A\u0629..." }, bn: { "placeholder.answer": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u0989\u09A4\u09CD\u09A4\u09B0 \u09B2\u09BF\u0996\u09C1\u09A8...", "placeholder.number": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09B8\u0982\u0996\u09CD\u09AF\u09BE \u09B2\u09BF\u0996\u09C1\u09A8...", "placeholder.email": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u0987\u09AE\u09C7\u0987\u09B2 \u09B2\u09BF\u0996\u09C1\u09A8...", "placeholder.date": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09A4\u09BE\u09B0\u09BF\u0996 \u09B2\u09BF\u0996\u09C1\u09A8...", "placeholder.password": "\u098F\u0996\u09BE\u09A8\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09AA\u09BE\u09B8\u0993\u09AF\u09BC\u09BE\u09B0\u09CD\u09A1 \u09B2\u09BF\u0996\u09C1\u09A8...", "pointSystem.error": "\u09AE\u09CB\u099F \u09AA\u09AF\u09BC\u09C7\u09A8\u09CD\u099F 100 % \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7", "boolean.yes": "\u09B9\u09CD\u09AF\u09BE\u0981", "boolean.no": "\u09A8\u09BE", "upload.cta": "\u099F\u09C7\u09A8\u09C7 \u0986\u09A8\u09C1\u09A8 \u09AC\u09BE \u0986\u09AA\u09B2\u09CB\u09A1 \u0995\u09B0\u09A4\u09C7 \u0995\u09CD\u09B2\u09BF\u0995 \u0995\u09B0\u09C1\u09A8", "upload.imagesOnly": "\u09B6\u09C1\u09A7\u09C1\u09AE\u09BE\u09A4\u09CD\u09B0 \u099B\u09AC\u09BF", "upload.anyFileType": "\u09AF\u09C7\u0995\u09CB\u09A8\u09CB \u09A7\u09B0\u09A8\u09C7\u09B0 \u09AB\u09BE\u0987\u09B2", "upload.maxFiles": "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A {n}\u099F\u09BF \u09AB\u09BE\u0987\u09B2", "upload.maxSize": "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A {mb} MB", "upload.tooLarge": "\u09AB\u09BE\u0987\u09B2\u099F\u09BF \u0996\u09C1\u09AC \u09AC\u09A1\u09BC (\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A {mb} MB)", "upload.remove": "\u09B8\u09B0\u09BE\u09A8", "select.placeholder": "\u098F\u0995\u099F\u09BF \u09AC\u09BF\u0995\u09B2\u09CD\u09AA \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", "rating.ariaLabel": "\u09B0\u09C7\u099F\u09BF\u0982", "priority.selectUpTo": "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", "priority.options": "\u099F\u09BF \u09AC\u09BF\u0995\u09B2\u09CD\u09AA", "priority.thenOrder": "\u09A4\u09BE\u09B0\u09AA\u09B0 \u09B8\u09C7\u0997\u09C1\u09B2\u09CB \u09B8\u09BE\u099C\u09BE\u09A8", "priority.selectOptions": "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", "priority.cancel": "\u09AC\u09BE\u09A4\u09BF\u09B2", "priority.confirm": "\u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4 \u0995\u09B0\u09C1\u09A8", "priority.selectOptionNumber": "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA # \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", "priority.prioritized": "\u0985\u0997\u09CD\u09B0\u09BE\u09A7\u09BF\u0995\u09BE\u09B0\u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4", "priority.of": "\u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7", "priority.instruction": '\u0986\u09AA\u09A8\u09BE\u09B0 \u0985\u0997\u09CD\u09B0\u09BE\u09A7\u09BF\u0995\u09BE\u09B0 \u09A4\u09BE\u09B2\u09BF\u0995\u09BE \u09A8\u09BF\u099A\u09C7 \u09A6\u09C7\u0996\u09BE\u09A8\u09CB \u09B9\u09AF\u09BC\u09C7\u099B\u09C7\u0964 \u099A\u09BE\u0987\u09B2\u09C7 \u09A4\u09C0\u09B0 \u099A\u09BF\u09B9\u09CD\u09A8 \u09AC\u09CD\u09AF\u09AC\u09B9\u09BE\u09B0 \u0995\u09B0\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09AA\u099B\u09A8\u09CD\u09A6\u0997\u09C1\u09B2\u09CB \u09AA\u09C1\u09A8\u09B0\u09BE\u09AF\u09BC \u09B8\u09BE\u099C\u09BE\u09A4\u09C7 \u09AA\u09BE\u09B0\u09C7\u09A8\u0964 "\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0" \u0995\u09CD\u09B2\u09BF\u0995 \u0995\u09B0\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4 \u0995\u09B0\u09C1\u09A8 \u098F\u09AC\u0982 \u098F\u0997\u09BF\u09AF\u09BC\u09C7 \u09AF\u09BE\u09A8\u0964', "action.send": "\u09AA\u09BE\u09A0\u09BE\u09A8", "action.back": "\u09AA\u09BF\u099B\u09A8\u09C7", "action.next": "\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0", "action.start": "\u09B6\u09C1\u09B0\u09C1 \u0995\u09B0\u09C1\u09A8!", "message.success": "\u0986\u09AA\u09A8\u09BE\u09B0 \u09AE\u09A4\u09BE\u09AE\u09A4\u09C7\u09B0 \u099C\u09A8\u09CD\u09AF \u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6!", "message.blocked": "\u0986\u09AA\u09A8\u09BE\u09B0 \u09B8\u09AE\u09AF\u09BC\u09C7\u09B0 \u099C\u09A8\u09CD\u09AF \u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6, \u0986\u09AE\u09B0\u09BE \u098F\u0996\u09BE\u09A8\u09C7\u0987 \u0995\u09A5\u09CB\u09AA\u0995\u09A5\u09A8 \u09B6\u09C7\u09B7 \u0995\u09B0\u099B\u09BF\u0964", "message.required": "\u099A\u09BE\u09B2\u09BF\u09AF\u09BC\u09C7 \u09AF\u09BE\u0993\u09AF\u09BC\u09BE\u09B0 \u0986\u0997\u09C7 \u0985\u09A8\u09C1\u0997\u09CD\u09B0\u09B9 \u0995\u09B0\u09C7 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A6\u09BF\u09A8\u0964", "message.rateLimit": "\u0985\u09A8\u09C7\u0995 \u09AC\u09C7\u09B6\u09BF \u0985\u09A8\u09C1\u09B0\u09CB\u09A7\u0964 {seconds} \u09B8\u09C7\u0995\u09C7\u09A8\u09CD\u09A1\u09C7 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09BE \u09B9\u099A\u09CD\u099B\u09C7..." }, it: { "boolean.yes": "S\xEC", "boolean.no": "No", "priority.selectUpTo": "Seleziona fino a", "priority.options": "opzioni", "priority.thenOrder": "e poi ordinali", "priority.selectOptions": "Seleziona opzioni", "priority.cancel": "Annulla", "priority.confirm": "Conferma", "priority.selectOptionNumber": "Seleziona opzione #", "priority.prioritized": "Prioritizzate", "priority.of": "di", "priority.instruction": 'La tua lista di priorit\xE0 \xE8 mostrata qui sotto. Se vuoi, puoi riordinare le tue scelte usando le frecce. Clicca su "Avanti" per confermare la selezione e continuare.' }, nl: { "boolean.yes": "Ja", "boolean.no": "Nee", "priority.selectUpTo": "Selecteer tot", "priority.options": "opties", "priority.thenOrder": "en rangschik ze vervolgens", "priority.selectOptions": "Selecteer opties", "priority.cancel": "Annuleren", "priority.confirm": "Bevestigen", "priority.selectOptionNumber": "Selecteer optie #", "priority.prioritized": "Geprioriteerd", "priority.of": "van", "priority.instruction": 'Je prioriteitenlijst wordt hieronder weergegeven. Als je wilt, kun je je keuzes herschikken met behulp van de pijlen. Klik op "Volgende" om je selectie te bevestigen en door te gaan.' }, pl: { "boolean.yes": "Tak", "boolean.no": "Nie", "priority.selectUpTo": "Wybierz do", "priority.options": "opcje", "priority.thenOrder": "a nast\u0119pnie je uporz\u0105dkuj", "priority.selectOptions": "Wybierz opcje", "priority.cancel": "Anuluj", "priority.confirm": "Potwierd\u017A", "priority.selectOptionNumber": "Wybierz opcj\u0119 #", "priority.prioritized": "Priorytetowe", "priority.of": "z", "priority.instruction": 'Twoja lista priorytet\xF3w jest pokazana poni\u017Cej. Je\u015Bli chcesz, mo\u017Cesz zmieni\u0107 kolejno\u015B\u0107 swoich wybor\xF3w za pomoc\u0105 strza\u0142ek. Kliknij "Dalej", aby potwierdzi\u0107 wyb\xF3r i kontynuowa\u0107.' }, ru: { "boolean.yes": "\u0414\u0430", "boolean.no": "\u041D\u0435\u0442", "priority.selectUpTo": "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043E", "priority.options": "\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432", "priority.thenOrder": "\u0430 \u0437\u0430\u0442\u0435\u043C \u0443\u043F\u043E\u0440\u044F\u0434\u043E\u0447\u044C\u0442\u0435 \u0438\u0445", "priority.selectOptions": "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B", "priority.cancel": "\u041E\u0442\u043C\u0435\u043D\u0430", "priority.confirm": "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C", "priority.selectOptionNumber": "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442 #", "priority.prioritized": "\u041F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u044B", "priority.of": "\u0438\u0437", "priority.instruction": '\u0412\u0430\u0448 \u0441\u043F\u0438\u0441\u043E\u043A \u043F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u043E\u0432 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044F \u043D\u0438\u0436\u0435. \u0415\u0441\u043B\u0438 \u0445\u043E\u0442\u0438\u0442\u0435, \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0440\u044F\u0434\u043E\u043A \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u0441\u0442\u0440\u0435\u043B\u043E\u043A. \u041D\u0430\u0436\u043C\u0438\u0442\u0435 "\u0414\u0430\u043B\u0435\u0435", \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0432\u044B\u0431\u043E\u0440 \u0438 \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C.' }, ja: { "boolean.yes": "\u306F\u3044", "boolean.no": "\u3044\u3044\u3048", "priority.selectUpTo": "\u6700\u5927", "priority.options": "\u500B\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", "priority.thenOrder": "\u305D\u306E\u5F8C\u4E26\u3079\u66FF\u3048\u3066\u304F\u3060\u3055\u3044", "priority.selectOptions": "\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", "priority.cancel": "\u30AD\u30E3\u30F3\u30BB\u30EB", "priority.confirm": "\u78BA\u8A8D", "priority.selectOptionNumber": "\u30AA\u30D7\u30B7\u30E7\u30F3 # \u3092\u9078\u629E", "priority.prioritized": "\u512A\u5148\u9806\u4F4D", "priority.of": "\u306E\u3046\u3061", "priority.instruction": "\u512A\u5148\u9806\u4F4D\u30EA\u30B9\u30C8\u306F\u4EE5\u4E0B\u306B\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u3001\u77E2\u5370\u3092\u4F7F\u3063\u3066\u9078\u629E\u80A2\u3092\u4E26\u3079\u66FF\u3048\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u300C\u6B21\u3078\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u9078\u629E\u3092\u78BA\u5B9A\u3057\u3001\u7D9A\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002" }, zh: { "boolean.yes": "\u662F", "boolean.no": "\u4E0D", "priority.selectUpTo": "\u6700\u591A\u9009\u62E9", "priority.options": "\u4E2A\u9009\u9879", "priority.thenOrder": "\u7136\u540E\u6392\u5E8F\u5B83\u4EEC", "priority.selectOptions": "\u9009\u62E9\u9009\u9879", "priority.cancel": "\u53D6\u6D88", "priority.confirm": "\u786E\u8BA4", "priority.selectOptionNumber": "\u9009\u62E9\u9009\u9879 #", "priority.prioritized": "\u5DF2\u4F18\u5148", "priority.of": "\u5171", "priority.instruction": "\u4F60\u7684\u4F18\u5148\u5217\u8868\u5982\u4E0B\u6240\u793A\u3002\u5982\u6709\u9700\u8981\uFF0C\u53EF\u4EE5\u4F7F\u7528\u7BAD\u5934\u91CD\u65B0\u6392\u5E8F\u9009\u9879\u3002\u70B9\u51FB\u201C\u4E0B\u4E00\u6B65\u201D\u786E\u8BA4\u9009\u62E9\u5E76\u7EE7\u7EED\u3002" }, ko: { "boolean.yes": "\uC608", "boolean.no": "\uC544\uB2C8", "priority.selectUpTo": "\uCD5C\uB300", "priority.options": "\uAC1C\uC758 \uC635\uC158 \uC120\uD0DD", "priority.thenOrder": "\uADF8\uB7F0 \uB2E4\uC74C \uC815\uB82C\uD558\uC138\uC694", "priority.selectOptions": "\uC635\uC158 \uC120\uD0DD", "priority.cancel": "\uCDE8\uC18C", "priority.confirm": "\uD655\uC778", "priority.selectOptionNumber": "\uC635\uC158 # \uC120\uD0DD", "priority.prioritized": "\uC6B0\uC120\uC21C\uC704", "priority.of": "\uC911", "priority.instruction": '\uC6B0\uC120\uC21C\uC704 \uBAA9\uB85D\uC740 \uC544\uB798\uC5D0 \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uC6D0\uD55C\uB2E4\uBA74 \uD654\uC0B4\uD45C\uB97C \uC0AC\uC6A9\uD574 \uC120\uD0DD \uD56D\uBAA9\uC744 \uC7AC\uC815\uB82C\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. "\uB2E4\uC74C"\uC744 \uD074\uB9AD\uD558\uC5EC \uC120\uD0DD\uC744 \uD655\uC778\uD558\uACE0 \uACC4\uC18D\uD558\uC138\uC694.' } };
|
|
2173
|
+
t2.SUPPORTED_LANGUAGES = ["en", "da", "fi", "no", "es", "sv", "ar", "bn", "de", "pt", "fr"], t2.AVAILABLE_LANGUAGES = Object.keys(r), t2.RTL_LANGUAGES = ["ar"];
|
|
2174
|
+
const n = { nb: "no", nn: "no", nob: "no", nno: "no", iw: "he", in: "id", cmn: "zh" };
|
|
2175
|
+
function o(e3) {
|
|
2176
|
+
if (!e3) return null;
|
|
2177
|
+
const t3 = e3.trim().toLowerCase().replace(/_/g, "-");
|
|
2178
|
+
if (!t3) return null;
|
|
2179
|
+
if (r[t3]) return t3;
|
|
2180
|
+
const i2 = t3.split("-")[0], o2 = n[i2] || i2;
|
|
2181
|
+
return r[o2] ? o2 : null;
|
|
2182
|
+
}
|
|
2183
|
+
function a(e3) {
|
|
2184
|
+
return o(e3) || "en";
|
|
2185
|
+
}
|
|
2186
|
+
t2.normalizeLanguage = a, t2.TRANSLATION_KEYS = Object.keys(i), t2.hasOwnTranslation = function(e3, t3) {
|
|
2187
|
+
const i2 = o(e3);
|
|
2188
|
+
return !!i2 && void 0 !== r[i2][t3];
|
|
2189
|
+
}, t2.isRtlLanguage = function(e3) {
|
|
2190
|
+
return -1 !== t2.RTL_LANGUAGES.indexOf(a(e3));
|
|
2191
|
+
}, t2.isLanguageSupported = function(e3) {
|
|
2192
|
+
const i2 = o(e3);
|
|
2193
|
+
return !!i2 && -1 !== t2.SUPPORTED_LANGUAGES.indexOf(i2);
|
|
2194
|
+
}, t2.t = function(e3, t3, n2) {
|
|
2195
|
+
const o2 = r[a(e3)] || i, s = void 0 !== o2[t3] ? o2[t3] : i[t3];
|
|
2196
|
+
return n2 ? (function(e4, t4) {
|
|
2197
|
+
return Object.keys(t4).reduce(((e5, i2) => e5.replace(new RegExp("\\{" + i2 + "\\}", "g"), String(t4[i2]))), e4);
|
|
2198
|
+
})(s, n2) : s;
|
|
2199
|
+
};
|
|
2200
|
+
}, 857: (e2, t2) => {
|
|
2201
|
+
"use strict";
|
|
2202
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.endpoints = void 0, t2.endpoints = { sdk: { app: (e3, t3) => `sdk/app/${e3}/${t3}`, app_info: (e3, t3) => `sdk/app/${e3}/${t3}/info`, session: (e3) => `sdk/app/session/${e3}/info`, feedback: "sdk/feedback", followUpQuestion: "sdk/followUpQuestion", agentSurveyStart: "sdk/agentSurvey/start", agentSurveyNext: "sdk/agentSurvey/next" } };
|
|
2203
|
+
}, 784: (e2, t2, i) => {
|
|
2204
|
+
"use strict";
|
|
2205
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.placeholder = void 0;
|
|
2206
|
+
const r = i(881);
|
|
2207
|
+
t2.placeholder = { answer: (e3) => (0, r.t)(e3, "placeholder.answer"), number: (e3) => (0, r.t)(e3, "placeholder.number"), email: (e3) => (0, r.t)(e3, "placeholder.email"), date: (e3) => (0, r.t)(e3, "placeholder.date"), password: (e3) => (0, r.t)(e3, "placeholder.password"), pointsystemerror: (e3) => (0, r.t)(e3, "pointSystem.error"), upload: { cta: (e3) => (0, r.t)(e3, "upload.cta"), formats: (e3, t3) => (0, r.t)(e3, "image" === t3 ? "upload.imagesOnly" : "upload.anyFileType"), maxFiles: (e3, t3) => (0, r.t)(e3, "upload.maxFiles", { n: t3 }), maxSize: (e3, t3) => (0, r.t)(e3, "upload.maxSize", { mb: t3 }), tooLarge: (e3, t3) => (0, r.t)(e3, "upload.tooLarge", { mb: t3 }), remove: (e3) => (0, r.t)(e3, "upload.remove") } };
|
|
2208
|
+
}, 213: (e2, t2, i) => {
|
|
2209
|
+
"use strict";
|
|
2210
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderStartMessage = t2.renderSuccess = t2.renderError = t2.renderActions = t2.renderQuestions = void 0;
|
|
2211
|
+
const r = i(42), n = i(516), o = { small: "1rem", medium: "1.2rem", large: "1.5rem" };
|
|
2212
|
+
t2.renderQuestions = function e3(t3, i2 = "standard", a = "en", s = { customIcons: false }, l) {
|
|
2213
|
+
if (!t3) throw new Error("[MagicFeedback] No questions provided");
|
|
2214
|
+
const d = [], { customIcons: c, id: u } = s;
|
|
2215
|
+
return t3.forEach(((p) => {
|
|
2216
|
+
var m, h;
|
|
2217
|
+
if ((null === (h = null === (m = null == p ? void 0 : p.questionType) || void 0 === m ? void 0 : m.conf) || void 0 === h ? void 0 : h.length) > 0) {
|
|
2218
|
+
let t4 = document.createElement("div");
|
|
2219
|
+
t4.classList.add("magicfeedback-div");
|
|
2220
|
+
const r2 = document.createElement("label");
|
|
2221
|
+
r2.setAttribute("for", `magicfeedback-${p.id}`), r2.textContent = (0, n.parseTitle)(p.title, a), r2.classList.add("magicfeedback-label"), t4.appendChild(r2), p.questionType.conf.forEach(((e4) => {
|
|
2222
|
+
e4.ref = p.ref, p.assets[e4.id] && (e4.assets = { placeholder: p.assets[e4.id] });
|
|
2223
|
+
})), e3(p.questionType.conf, i2, a, s, l).forEach(((e4) => {
|
|
2224
|
+
t4.appendChild(e4);
|
|
2225
|
+
})), d.push(t4);
|
|
2226
|
+
} else {
|
|
2227
|
+
const e4 = (function(e5, t4, i3, a2, s2) {
|
|
2228
|
+
var l2, d2, c2;
|
|
2229
|
+
let u2, p2, { id: m2, title: h2, type: f, ref: g, require: y, defaultValue: v, assets: b } = e5, E = document.createElement("div");
|
|
2230
|
+
E.classList.add("magicfeedback-div");
|
|
2231
|
+
const k = window.innerWidth < 600, A = "slim" === t4 ? (0, n.parseTitle)(h2, i3) : null == b ? void 0 : b.placeholder, T = (0, n.getUrlParam)(g), C = (null == b ? void 0 : b.maxCharacters) || 0, L = void 0 !== (null == b ? void 0 : b.randomPosition) && (null == b ? void 0 : b.randomPosition), x = (null == b ? void 0 : b.direction) || "row", S = (null == b ? void 0 : b.order) || "ltr", O = (0, r.getQuestionRenderer)(f);
|
|
2232
|
+
if (!O) return E;
|
|
2233
|
+
{
|
|
2234
|
+
const r2 = O({ question: e5, format: t4, language: i3, url: a2, send: s2, isPhone: k, urlParamValue: T, placeholderText: A, maxCharacters: C, randomPosition: L, direction: x, order: S });
|
|
2235
|
+
u2 = r2.element, p2 = r2.elementTypeClass;
|
|
2236
|
+
}
|
|
2237
|
+
u2.id = `magicfeedback-${m2}`, u2.setAttribute("name", g), u2.classList.add(p2), (void 0 !== v || null !== T) && (u2.value = T || v), ["RADIO", "MULTIPLECHOICE", "UPLOAD_IMAGE", "UPLOAD_FILE"].includes(f) || (u2.classList.add("magicfeedback-input"), u2.required = y);
|
|
2238
|
+
const P = document.createElement("label");
|
|
2239
|
+
P.setAttribute("for", `magicfeedback-${m2}`), P.textContent = (0, n.parseTitle)(h2, i3), P.classList.add("magicfeedback-label"), (function(e6, t5) {
|
|
2240
|
+
if ("INFO_PAGE" !== t5.type) return;
|
|
2241
|
+
const { assets: i4 } = t5, r2 = (function(e7) {
|
|
2242
|
+
if (e7) return o[e7] || e7;
|
|
2243
|
+
})(null == i4 ? void 0 : i4.titleSize), n2 = (a3 = null == i4 ? void 0 : i4.titleStyle, Array.isArray(a3) ? a3 : a3 ? [a3] : []);
|
|
2244
|
+
var a3;
|
|
2245
|
+
r2 && e6.style.setProperty("font-size", r2, "important"), (null == i4 ? void 0 : i4.titleAlign) && (e6.style.setProperty("width", "100%", "important"), e6.style.setProperty("align-self", "stretch", "important"), e6.style.setProperty("text-align", i4.titleAlign, "important")), n2.includes("italic") && e6.style.setProperty("font-style", "italic", "important"), n2.includes("bold") && e6.style.setProperty("font-weight", "bold", "important"), n2.includes("underline") && e6.style.setProperty("text-decoration", "underline", "important");
|
|
2246
|
+
})(P, e5);
|
|
2247
|
+
const w = document.createElement("label");
|
|
2248
|
+
if (w.textContent = (0, n.parseTitle)(null == b ? void 0 : b.subtitle, i3), w.classList.add("magicfeedback-sublabel"), (null === (l2 = null == b ? void 0 : b.subtitleStyle) || void 0 === l2 ? void 0 : l2.includes("italic")) && (w.style.fontStyle = "italic"), (null === (d2 = null == b ? void 0 : b.subtitleStyle) || void 0 === d2 ? void 0 : d2.includes("bold")) && (w.style.fontWeight = "bold"), (null === (c2 = null == b ? void 0 : b.subtitleStyle) || void 0 === c2 ? void 0 : c2.includes("underline")) && (w.style.textDecoration = "underline"), ["CONSENT"].includes(f)) E.classList.add("magicfeedback-consent-container"), E.appendChild(u2), E.appendChild(P), (null == b ? void 0 : b.subtitle) && E.appendChild(w);
|
|
2249
|
+
else {
|
|
2250
|
+
if ("slim" !== t4 && (E.appendChild(P), (null == b ? void 0 : b.subtitle) && E.appendChild(w), void 0 !== (null == b ? void 0 : b.general) && "" !== (null == b ? void 0 : b.general))) {
|
|
2251
|
+
const e6 = document.createElement("img");
|
|
2252
|
+
e6.src = null == b ? void 0 : b.general, e6.classList.add("magicfeedback-image"), e6.style.maxWidth = "auto", e6.style.height = "400px", e6.style.margin = "10px 0", E.appendChild(e6);
|
|
2253
|
+
}
|
|
2254
|
+
if ("LONGTEXT" === f && C > 0) {
|
|
2255
|
+
const e6 = document.createElement("div");
|
|
2256
|
+
if (e6.classList.add("magicfeedback-counter"), e6.textContent = `${u2.value.length}/${C}`, e6.style.textAlign = "end", e6.style.fontSize = "15px", e6.style.marginTop = "5px", u2.addEventListener("input", (() => {
|
|
2257
|
+
e6.textContent = `${u2.value.length}/${C}`;
|
|
2258
|
+
})), E.appendChild(u2), E.appendChild(e6), (null == b ? void 0 : b.extraOption) && (null == b ? void 0 : b.extraOptionText)) {
|
|
2259
|
+
const e7 = document.createElement("div");
|
|
2260
|
+
e7.classList.add("magicfeedback-skip-container"), e7.classList.add("magicfeedback-checkbox-container"), e7.style.display = "flex", e7.style.justifyContent = "flex-start";
|
|
2261
|
+
const t5 = document.createElement("input");
|
|
2262
|
+
t5.classList.add("magicfeedback-skip"), t5.type = "checkbox", t5.id = `skip-${g}`, t5.name = g, t5.value = "-", t5.style.cursor = "pointer";
|
|
2263
|
+
const i4 = document.createElement("label");
|
|
2264
|
+
i4.htmlFor = `skip-${g}`, i4.textContent = null == b ? void 0 : b.extraOptionText, i4.style.fontSize = "15px", i4.style.cursor = "pointer", i4.style.margin = "0 5px", t5.addEventListener("click", (() => {
|
|
2265
|
+
u2.value = "-", s2 && s2();
|
|
2266
|
+
})), e7.appendChild(t5), e7.appendChild(i4), E.appendChild(e7);
|
|
2267
|
+
}
|
|
2268
|
+
} else E.appendChild(u2);
|
|
2269
|
+
}
|
|
2270
|
+
return E;
|
|
2271
|
+
})(p, i2, a, "https://survey-dev.magicfeedback.io/assets/emojis" + (c ? `/${u}` : ""), 1 === t3.length ? l : void 0);
|
|
2272
|
+
d.push(e4);
|
|
2273
|
+
}
|
|
2274
|
+
})), d;
|
|
2275
|
+
}, t2.renderActions = function(e3 = "", t3, i2 = "Submit", r2 = "Back", n2 = "Next") {
|
|
2276
|
+
const o2 = document.createElement("div");
|
|
2277
|
+
o2.classList.add("magicfeedback-action-container");
|
|
2278
|
+
const a = document.createElement("button");
|
|
2279
|
+
a.id = "magicfeedback-submit", a.type = "submit", a.classList.add("magicfeedback-submit"), a.textContent = "MAGICSURVEY" === e3 ? n2 || "Next" : i2 || "Submit";
|
|
2280
|
+
const s = document.createElement("button");
|
|
2281
|
+
return s.id = "magicfeedback-back", s.type = "button", s.classList.add("magicfeedback-back"), s.textContent = r2 || "Back", s.addEventListener("click", t3), s.addEventListener("click", (() => {
|
|
2282
|
+
a.removeAttribute("disabled");
|
|
2283
|
+
})), "MAGICSURVEY" === e3 && o2.appendChild(s), o2.appendChild(a), o2;
|
|
2284
|
+
}, t2.renderError = function(e3) {
|
|
2285
|
+
const t3 = document.createElement("div");
|
|
2286
|
+
return t3.classList.add("magicfeedback-error"), t3.textContent = e3, t3;
|
|
2287
|
+
}, t2.renderSuccess = function(e3) {
|
|
2288
|
+
const t3 = document.createElement("div");
|
|
2289
|
+
return t3.classList.add("magicfeedback-success"), t3.textContent = e3, t3;
|
|
2290
|
+
}, t2.renderStartMessage = function(e3, t3 = false, i2 = "Go!", r2 = () => {
|
|
2291
|
+
}) {
|
|
2292
|
+
const n2 = document.createElement("div");
|
|
2293
|
+
n2.classList.add("magicfeedback-start-message-container");
|
|
2294
|
+
const o2 = document.createElement("div");
|
|
2295
|
+
if (o2.classList.add("magicfeedback-start-message"), o2.innerHTML = e3, n2.appendChild(o2), t3) {
|
|
2296
|
+
const e4 = document.createElement("button");
|
|
2297
|
+
e4.id = "magicfeedback-start-message-button", e4.classList.add("magicfeedback-start-message-button"), e4.textContent = i2, e4.addEventListener("click", (() => r2())), n2.appendChild(e4);
|
|
2298
|
+
}
|
|
2299
|
+
return n2;
|
|
2300
|
+
};
|
|
2301
|
+
}, 313: function(e2, t2, i) {
|
|
2302
|
+
"use strict";
|
|
2303
|
+
var r = this && this.__awaiter || function(e3, t3, i2, r2) {
|
|
2304
|
+
return new (i2 || (i2 = Promise))((function(n2, o2) {
|
|
2305
|
+
function a2(e4) {
|
|
2306
|
+
try {
|
|
2307
|
+
l(r2.next(e4));
|
|
2308
|
+
} catch (e5) {
|
|
2309
|
+
o2(e5);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
function s2(e4) {
|
|
2313
|
+
try {
|
|
2314
|
+
l(r2.throw(e4));
|
|
2315
|
+
} catch (e5) {
|
|
2316
|
+
o2(e5);
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
function l(e4) {
|
|
2320
|
+
var t4;
|
|
2321
|
+
e4.done ? n2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
2322
|
+
e5(t4);
|
|
2323
|
+
}))).then(a2, s2);
|
|
2324
|
+
}
|
|
2325
|
+
l((r2 = r2.apply(e3, t3 || [])).next());
|
|
2326
|
+
}));
|
|
2327
|
+
}, n = this && this.__importDefault || function(e3) {
|
|
2328
|
+
return e3 && e3.__esModule ? e3 : { default: e3 };
|
|
2329
|
+
};
|
|
2330
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.getFollowUpQuestion = t2.sendFeedback = t2.getQuestions = t2.getSessionForm = t2.getForm = t2.validateEmail = t2.header = void 0;
|
|
2331
|
+
const o = n(i(326)), a = n(i(330)), s = i(857);
|
|
2332
|
+
t2.header = { Accept: "application/json", "Magicfeedback-Sdk-Version": a.default.version, "x-magicfeedback-parameters": window.location.search || "" }, t2.validateEmail = function(e3) {
|
|
2333
|
+
return /\S+@\S+\.\S+/.test(e3);
|
|
2334
|
+
}, t2.getForm = function(e3, i2, n2, a2) {
|
|
2335
|
+
return r(this, void 0, void 0, (function* () {
|
|
2336
|
+
try {
|
|
2337
|
+
const r2 = yield (0, o.default)(e3 + s.endpoints.sdk.app_info(i2, n2), { method: "GET", headers: t2.header });
|
|
2338
|
+
return yield r2.json();
|
|
2339
|
+
} catch (e4) {
|
|
2340
|
+
a2.err(e4);
|
|
2341
|
+
}
|
|
2342
|
+
}));
|
|
2343
|
+
}, t2.getSessionForm = function(e3, i2, n2) {
|
|
2344
|
+
return r(this, void 0, void 0, (function* () {
|
|
2345
|
+
try {
|
|
2346
|
+
const r2 = yield (0, o.default)(e3 + s.endpoints.sdk.session(i2), { method: "GET", headers: t2.header });
|
|
2347
|
+
return yield r2.json();
|
|
2348
|
+
} catch (e4) {
|
|
2349
|
+
n2.err(e4);
|
|
2350
|
+
}
|
|
2351
|
+
}));
|
|
2352
|
+
}, t2.getQuestions = function(e3, i2, n2, a2) {
|
|
2353
|
+
return r(this, void 0, void 0, (function* () {
|
|
2354
|
+
try {
|
|
2355
|
+
const r2 = yield (0, o.default)(e3 + s.endpoints.sdk.app(i2, n2), { method: "GET", headers: t2.header });
|
|
2356
|
+
if (r2.ok) {
|
|
2357
|
+
const e4 = yield r2.json();
|
|
2358
|
+
return a2.log(`Received questions for app ${i2}`, e4), e4;
|
|
2359
|
+
}
|
|
2360
|
+
throw a2.err(`Failed to get questions for app ${i2}:`, r2.status, r2.statusText), new Error("[MagicFeedback] Bad response from server");
|
|
2361
|
+
} catch (e4) {
|
|
2362
|
+
return a2.err(e4), [];
|
|
2363
|
+
}
|
|
2364
|
+
}));
|
|
2365
|
+
}, t2.sendFeedback = function(e3, i2, n2) {
|
|
2366
|
+
return r(this, void 0, void 0, (function* () {
|
|
2367
|
+
try {
|
|
2368
|
+
const r2 = yield (0, o.default)(e3 + s.endpoints.sdk.feedback, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, t2.header), body: JSON.stringify(i2) });
|
|
2369
|
+
if (r2.ok) return n2.log(`Form ${i2.integration} submitted successfully!`), (yield r2.json()).sessionId;
|
|
2370
|
+
throw n2.err(`Failed to submit form ${i2.integration}:`, r2.status, r2.statusText), new Error(r2.statusText);
|
|
2371
|
+
} catch (e4) {
|
|
2372
|
+
return n2.err(e4), "";
|
|
2373
|
+
}
|
|
2374
|
+
}));
|
|
2375
|
+
}, t2.getFollowUpQuestion = function(e3, i2, n2) {
|
|
2376
|
+
return r(this, void 0, void 0, (function* () {
|
|
2377
|
+
try {
|
|
2378
|
+
const r2 = yield (0, o.default)(e3 + s.endpoints.sdk.followUpQuestion, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, t2.header), body: JSON.stringify(i2) });
|
|
2379
|
+
if (r2.ok) return n2.log(`Received follow up question for form ${i2.integration}`), (yield r2.json()) || "";
|
|
2380
|
+
throw n2.err(`Failed to get follow up question for form ${i2.integration}:`, r2.status, r2.statusText), new Error(r2.statusText);
|
|
2381
|
+
} catch (e4) {
|
|
2382
|
+
return n2.err(e4), "";
|
|
2383
|
+
}
|
|
2384
|
+
}));
|
|
2385
|
+
};
|
|
2386
|
+
}, 256: (e2, t2) => {
|
|
2387
|
+
"use strict";
|
|
2388
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.Log = void 0, t2.Log = class {
|
|
2389
|
+
constructor(e3) {
|
|
2390
|
+
this.config = e3;
|
|
2391
|
+
}
|
|
2392
|
+
log(...e3) {
|
|
2393
|
+
this.config.get("debug") && console.log("[MagicFeedback]:", ...e3);
|
|
2394
|
+
}
|
|
2395
|
+
err(...e3) {
|
|
2396
|
+
console.error("[MagicFeedback]:", ...e3);
|
|
2397
|
+
}
|
|
2398
|
+
};
|
|
2399
|
+
}, 330: (e2) => {
|
|
2400
|
+
"use strict";
|
|
2401
|
+
e2.exports = JSON.parse('{"name":"@magicfeedback/native","version":"2.2.22","main":"./dist/magicfeedback-sdk.node.js","browser":"./dist/magicfeedback-sdk.browser.js","types":"./dist/types/src/index.d.ts","repository":{"type":"git","url":"git+ssh://git@github.com/MagicFeedback/magicfeedback-sdk.git"},"author":"farias@magicfeedback.io","license":"MIT","private":false,"scripts":{"dev":"vite","build":"webpack","build:watch":"webpack --watch --mode development","release":"npm publish --access public","release:beta":"npm publish --access public --tag beta","release:alpha":"npm publish --access public --tag alpha","test":"jest","test:watch":"jest --watchAll","coverage":"vitest run --coverage","publish:sdk":"bash publish.sh","publish:sdk:dry-run":"NPM_DRY_RUN=1 bash publish.sh"},"files":["dist"],"devDependencies":{"@babel/preset-typescript":"^7.22.5","@types/node":"^17.0.21","@types/webpack":"^5.28.0","@types/webpack-node-externals":"^2.5.3","c8":"^7.11.0","copy-webpack-plugin":"^11.0.0","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","nock":"^13.2.4","ts-jest":"^29.1.0","ts-loader":"^9.2.7","ts-node":"^10.7.0","typescript":"^4.6.2","vite":"^2.8.0","vite-plugin-dts":"^0.9.9","vitest":"^0.5.9","webpack":"^5.70.0","webpack-cli":"^4.9.2","webpack-node-externals":"^3.0.0"},"dependencies":{"cross-fetch":"^3.1.5","is-bundling-for-browser-or-node":"^1.1.1"},"description":"MagicFeedbackAI JavaScript Library for [MagicFeedback.io](https://magicfeedback.io/)","bugs":{"url":"https://github.com/MagicFeedback/magicfeedback-sdk/issues"},"homepage":"https://github.com/MagicFeedback/magicfeedback-sdk#readme","directories":{"example":"examples","test":"test"},"style":"./dist/styles/magicfeedback-default.css"}');
|
|
2402
|
+
} }, t = {}, (function i(r) {
|
|
2403
|
+
var n = t[r];
|
|
2404
|
+
if (void 0 !== n) return n.exports;
|
|
2405
|
+
var o = t[r] = { exports: {} };
|
|
2406
|
+
return e[r].call(o.exports, o, o.exports, i), o.exports;
|
|
2407
|
+
})(156).default;
|
|
2408
|
+
var e, t;
|
|
2409
|
+
}));
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
|
|
2413
|
+
// src/ui/logo.ts
|
|
2414
|
+
var BASE_CSS = "max-height:40px; max-width:100%; object-fit:contain; display:block; margin:12px 0 0 0;";
|
|
2415
|
+
var MAX_HEIGHT = {
|
|
2416
|
+
small: "30px",
|
|
2417
|
+
medium: "50px",
|
|
2418
|
+
large: "70px"
|
|
2419
|
+
};
|
|
2420
|
+
function insertPopupLogo(parent, anchor, style, id) {
|
|
2421
|
+
if (!style?.logo) return null;
|
|
2422
|
+
if (parent.ownerDocument.getElementById(id)) return null;
|
|
2423
|
+
const img = parent.ownerDocument.createElement("img");
|
|
2424
|
+
img.id = id;
|
|
2425
|
+
img.src = style.logo;
|
|
2426
|
+
img.alt = "Logo";
|
|
2427
|
+
img.style.cssText = BASE_CSS;
|
|
2428
|
+
if (style.logoSize && MAX_HEIGHT[style.logoSize]) {
|
|
2429
|
+
img.style.maxHeight = MAX_HEIGHT[style.logoSize];
|
|
2430
|
+
}
|
|
2431
|
+
switch (style.logoPosition) {
|
|
2432
|
+
case "left":
|
|
2433
|
+
img.style.margin = "12px 0 0 0";
|
|
2434
|
+
img.style.setProperty("margin-inline-start", "0");
|
|
2435
|
+
img.style.setProperty("margin-inline-end", "16px");
|
|
2436
|
+
break;
|
|
2437
|
+
case "right":
|
|
2438
|
+
img.style.margin = "12px 0 0 0";
|
|
2439
|
+
img.style.setProperty("margin-inline-start", "auto");
|
|
2440
|
+
img.style.setProperty("margin-inline-end", "0");
|
|
2441
|
+
break;
|
|
2442
|
+
case "center":
|
|
2443
|
+
img.style.margin = "12px auto 0 auto";
|
|
2444
|
+
break;
|
|
2445
|
+
}
|
|
2446
|
+
parent.insertBefore(img, anchor);
|
|
2447
|
+
return img;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
// src/ui/renderPopup.ts
|
|
2451
|
+
var import_native = __toESM(require_magicfeedback_sdk_browser());
|
|
2452
|
+
function ensureMagicFeedbackStyles(_popup) {
|
|
2453
|
+
const STYLE_ID = "magicfeedback-sdk-styles";
|
|
2454
|
+
if (document.getElementById(STYLE_ID)) return;
|
|
2455
|
+
const style = document.createElement("style");
|
|
2456
|
+
style.id = STYLE_ID;
|
|
2457
|
+
style.textContent = style_default;
|
|
2458
|
+
document.head.appendChild(style);
|
|
2459
|
+
}
|
|
2460
|
+
function ensureSpinnerStyles(_popup) {
|
|
2461
|
+
if (document.getElementById("deepdots-spinner-styles")) return;
|
|
2462
|
+
const style = document.createElement("style");
|
|
2463
|
+
style.id = "deepdots-spinner-styles";
|
|
2464
|
+
style.textContent = `
|
|
2465
|
+
/* El enunciado trae margin-top:20px del CSS de surveys, que sumaba al hueco de la barra
|
|
2466
|
+
de progreso y descompensaba la simetr\xEDa. Solo se anula en el primero: entre preguntas
|
|
2467
|
+
de la misma p\xE1gina sigue separando. */
|
|
2468
|
+
.deepdots-popup .magicfeedback-questions .magicfeedback-div:first-child .magicfeedback-label { margin-top: 0; }
|
|
2469
|
+
@keyframes ddspin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
|
2470
|
+
.mf-spinner { display:flex; justify-content:center; align-items:center; padding:8px 0; }
|
|
2471
|
+
.mf-spinner-circle { width:28px; height:28px; border:3px solid #e0e6ed; border-top-color:#1E293B; border-radius:50%; animation: ddspin 0.9s linear infinite; }
|
|
2472
|
+
`;
|
|
2473
|
+
document.head.appendChild(style);
|
|
2474
|
+
}
|
|
2475
|
+
function ensureResponsiveStyles(_popup) {
|
|
2476
|
+
if (document.getElementById("deepdots-responsive-styles")) return;
|
|
2477
|
+
const style = document.createElement("style");
|
|
2478
|
+
style.id = "deepdots-responsive-styles";
|
|
2479
|
+
style.textContent = `
|
|
2480
|
+
/* Responsive adjustments */
|
|
2481
|
+
@media (max-width: 640px) {
|
|
2482
|
+
.deepdots-popup {
|
|
2483
|
+
width: calc(100% - 24px) !important;
|
|
2484
|
+
max-width: calc(100% - 24px) !important;
|
|
2485
|
+
height: auto !important;
|
|
2486
|
+
max-height: 90vh !important;
|
|
2487
|
+
border-radius: 12px !important;
|
|
2488
|
+
padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)) 16px !important;
|
|
2489
|
+
box-sizing: border-box;
|
|
2490
|
+
}
|
|
2491
|
+
.deepdots-popup .mf-spinner-circle { width: 32px; height: 32px; border-width: 4px; }
|
|
2492
|
+
.deepdots-popup button { font-size: 16px !important; }
|
|
2493
|
+
.deepdots-popup-header button { width:48px; height:48px; }
|
|
2494
|
+
.deepdots-popup-header button svg { width:26px; height:26px; }
|
|
2495
|
+
/* Apilados en el orden del DOM: la acci\xF3n principal (Send/Start/Complete) arriba y
|
|
2496
|
+
Back debajo. */
|
|
2497
|
+
.deepdots-popup-footer { flex-direction: column !important; gap: 4px !important; }
|
|
2498
|
+
.deepdots-popup-footer button { width: 100%; }
|
|
2499
|
+
}
|
|
2500
|
+
@media (max-width: 400px) {
|
|
2501
|
+
.deepdots-popup { padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) 12px !important; }
|
|
2502
|
+
.deepdots-popup-header button { width:48px; height:48px; }
|
|
2503
|
+
.deepdots-popup-header button svg { width:26px; height:26px; }
|
|
2504
|
+
}
|
|
2505
|
+
@media (orientation: landscape) and (max-height: 480px) {
|
|
2506
|
+
.deepdots-popup {
|
|
2507
|
+
height: 100vh !important;
|
|
2508
|
+
max-height: 100vh !important;
|
|
2509
|
+
overflow-y: auto !important;
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
`;
|
|
2513
|
+
document.head.appendChild(style);
|
|
2514
|
+
}
|
|
2515
|
+
function ensureCustomCss(css) {
|
|
2516
|
+
const STYLE_ID = "deepdots-custom-css";
|
|
2517
|
+
const existing = document.getElementById(STYLE_ID);
|
|
2518
|
+
if (!css) {
|
|
2519
|
+
existing?.remove();
|
|
2520
|
+
return;
|
|
2521
|
+
}
|
|
2522
|
+
const el = existing ?? document.createElement("style");
|
|
2523
|
+
el.id = STYLE_ID;
|
|
2524
|
+
if (el.textContent !== css) el.textContent = css;
|
|
2525
|
+
document.head.appendChild(el);
|
|
2526
|
+
}
|
|
2527
|
+
function ensureFontFace(family, url) {
|
|
2528
|
+
const css = buildFontFaceCss(family, url);
|
|
2529
|
+
if (!css) return;
|
|
2530
|
+
const STYLE_ID = "deepdots-font-face";
|
|
2531
|
+
let el = document.getElementById(STYLE_ID);
|
|
2532
|
+
if (!el) {
|
|
2533
|
+
el = document.createElement("style");
|
|
2534
|
+
el.id = STYLE_ID;
|
|
2535
|
+
document.head.appendChild(el);
|
|
2536
|
+
}
|
|
2537
|
+
if (el.textContent !== css) el.textContent = css;
|
|
2538
|
+
}
|
|
2539
|
+
async function renderPopup(container, surveyId, productId, actions, emit, onClose, env = "production", userId, style, sessionId, miniService, analyticsFeedbackSessionId, options) {
|
|
2540
|
+
let surveyCompletedEmitted = false;
|
|
2541
|
+
let stylesInjected = false;
|
|
2542
|
+
let pageDepth = 0;
|
|
2543
|
+
let onStartPage = false;
|
|
2544
|
+
let labels = getLabels(options?.language);
|
|
2545
|
+
let actionLabels = resolveActionLabels(actions, options?.language);
|
|
2546
|
+
let direction = directionFor(options?.language);
|
|
2547
|
+
const isDark = style?.theme === "dark";
|
|
2548
|
+
const theme = {
|
|
2549
|
+
popupBg: isDark ? "#1e1e1e" : "#fff",
|
|
2550
|
+
// El popup fija su propio fondo, así que debe fijar también el esquema de color.
|
|
2551
|
+
// Sin esto los controles de formulario (input/textarea/select) caen al estilo por
|
|
2552
|
+
// defecto del navegador: en un host con `prefers-color-scheme: dark` se pintan
|
|
2553
|
+
// oscuros con texto blanco sobre el fondo claro del popup.
|
|
2554
|
+
colorScheme: isDark ? "dark" : "light",
|
|
2555
|
+
textPrimary: isDark ? "#f0f0f0" : "#111",
|
|
2556
|
+
closeBtnHoverColor: isDark ? "#fff" : "#000000",
|
|
2557
|
+
textMuted: isDark ? "#9ca3af" : "#6b7280",
|
|
2558
|
+
progressTrack: isDark ? "#3f3f46" : "#e5e7eb"
|
|
2559
|
+
};
|
|
2560
|
+
const positionMap = {
|
|
2561
|
+
"center": { justifyContent: "center", alignItems: "center", background: "rgba(0,0,0,0.5)" },
|
|
2562
|
+
"bottom": { justifyContent: "center", alignItems: "flex-end", padding: "16px", background: "transparent" },
|
|
2563
|
+
"bottom-right": { justifyContent: "flex-end", alignItems: "flex-end", padding: "16px", background: "transparent" },
|
|
2564
|
+
"bottom-left": { justifyContent: "flex-start", alignItems: "flex-end", padding: "16px", background: "transparent" },
|
|
2565
|
+
"top": { justifyContent: "center", alignItems: "flex-start", padding: "16px", background: "transparent" },
|
|
2566
|
+
"top-right": { justifyContent: "flex-end", alignItems: "flex-start", padding: "16px", background: "transparent" },
|
|
2567
|
+
"top-left": { justifyContent: "flex-start", alignItems: "flex-start", padding: "16px", background: "transparent" }
|
|
2568
|
+
};
|
|
2569
|
+
const pos = positionMap[style?.position ?? "center"] ?? positionMap["center"];
|
|
2570
|
+
const popup = document.createElement("div");
|
|
2571
|
+
popup.id = "dd-popup";
|
|
2572
|
+
popup.className = "deepdots-popup";
|
|
2573
|
+
popup.setAttribute("dir", direction);
|
|
2574
|
+
popup.style.cssText = `
|
|
2575
|
+
position: relative;
|
|
2576
|
+
display: flex;
|
|
2577
|
+
flex-direction: column;
|
|
2578
|
+
justify-content: flex-start;
|
|
2579
|
+
background: ${theme.popupBg};
|
|
2580
|
+
color-scheme: ${theme.colorScheme};
|
|
2581
|
+
border-radius: 8px;
|
|
2582
|
+
padding: 24px;
|
|
2583
|
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
|
2584
|
+
max-width: 600px;
|
|
2585
|
+
width: 90%;
|
|
2586
|
+
max-height: 90vh;
|
|
2587
|
+
min-height: 200px;
|
|
2588
|
+
`;
|
|
2589
|
+
const font = style?.font;
|
|
2590
|
+
if (font?.family) {
|
|
2591
|
+
const familyValue = buildFontFamilyValue(font.family);
|
|
2592
|
+
popup.style.fontFamily = familyValue;
|
|
2593
|
+
popup.style.setProperty("--deepdots-font", familyValue);
|
|
2594
|
+
popup.classList.add("deepdots-has-font");
|
|
2595
|
+
if (font.url) ensureFontFace(font.family, font.url);
|
|
2596
|
+
}
|
|
2597
|
+
const header = document.createElement("div");
|
|
2598
|
+
header.className = "deepdots-popup-header";
|
|
2599
|
+
header.style.cssText = "display:flex; justify-content:space-between; align-items:center; gap:12px; width:100%; flex:0 0 auto;";
|
|
2600
|
+
const titleEl = document.createElement("h2");
|
|
2601
|
+
titleEl.id = "dd-title";
|
|
2602
|
+
titleEl.className = "deepdots-popup-title";
|
|
2603
|
+
titleEl.style.cssText = `margin:0; font-size:17px; font-weight:600; line-height:1.3; color:${theme.textPrimary}; text-transform:none; text-align:start; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;`;
|
|
2604
|
+
titleEl.hidden = true;
|
|
2605
|
+
const setTitle = (value) => {
|
|
2606
|
+
if (!value) return;
|
|
2607
|
+
titleEl.textContent = value;
|
|
2608
|
+
titleEl.hidden = false;
|
|
2609
|
+
};
|
|
2610
|
+
setTitle(options?.title);
|
|
2611
|
+
header.appendChild(titleEl);
|
|
2612
|
+
const closeBtn = document.createElement("button");
|
|
2613
|
+
closeBtn.id = "dd-close";
|
|
2614
|
+
closeBtn.type = "button";
|
|
2615
|
+
closeBtn.setAttribute("aria-label", labels.closeAria);
|
|
2616
|
+
closeBtn.innerHTML = `
|
|
2617
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2618
|
+
<path d="M5 5L19 19M5 19L19 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="butt"/>
|
|
2619
|
+
</svg>
|
|
2620
|
+
`;
|
|
2621
|
+
closeBtn.style.cssText = `
|
|
2622
|
+
background:transparent;
|
|
2623
|
+
border:none;
|
|
2624
|
+
width:32px;
|
|
2625
|
+
height:32px;
|
|
2626
|
+
display:flex;
|
|
2627
|
+
align-items:center;
|
|
2628
|
+
justify-content:center;
|
|
2629
|
+
border-radius: 8px;
|
|
2630
|
+
cursor:pointer;
|
|
2631
|
+
color:${theme.textPrimary};
|
|
2632
|
+
padding:4px;
|
|
2633
|
+
transition: color .15s ease, transform .15s ease;
|
|
2634
|
+
box-shadow: none !important;
|
|
2635
|
+
`;
|
|
2636
|
+
closeBtn.onmouseenter = () => {
|
|
2637
|
+
closeBtn.style.color = theme.closeBtnHoverColor;
|
|
2638
|
+
closeBtn.style.transform = "scale(1.06)";
|
|
2639
|
+
};
|
|
2640
|
+
closeBtn.onmouseleave = () => {
|
|
2641
|
+
closeBtn.style.color = theme.textPrimary;
|
|
2642
|
+
closeBtn.style.transform = "scale(1)";
|
|
2643
|
+
};
|
|
2644
|
+
closeBtn.onclick = () => {
|
|
2645
|
+
emit("popup_clicked", surveyId, { action: "close_icon" });
|
|
2646
|
+
onClose();
|
|
2647
|
+
};
|
|
2648
|
+
closeBtn.style.flex = "0 0 auto";
|
|
2649
|
+
closeBtn.style.marginLeft = "auto";
|
|
2650
|
+
header.appendChild(closeBtn);
|
|
2651
|
+
let progressEnabled = options?.showProgressBar === true;
|
|
2652
|
+
let progressShowUnit = true;
|
|
2653
|
+
let progressUnit = "fraction";
|
|
2654
|
+
const progressEl = document.createElement("div");
|
|
2655
|
+
progressEl.id = "dd-progress";
|
|
2656
|
+
progressEl.className = "deepdots-progress";
|
|
2657
|
+
progressEl.style.cssText = "display:none; flex-direction:column; gap:8px; width:100%; flex:0 0 auto; padding:16px 0; box-sizing:border-box;";
|
|
2658
|
+
const progressHead = document.createElement("div");
|
|
2659
|
+
progressHead.className = "deepdots-progress-head";
|
|
2660
|
+
progressHead.style.cssText = "display:flex; flex-direction:row; justify-content:space-between; align-items:center; width:100%; gap:8px;";
|
|
2661
|
+
const progressLabel = document.createElement("span");
|
|
2662
|
+
progressLabel.id = "dd-progress-label";
|
|
2663
|
+
progressLabel.style.cssText = "font-size:13px; line-height:1.2;";
|
|
2664
|
+
const progressCurrent = document.createElement("span");
|
|
2665
|
+
progressCurrent.id = "dd-progress-current";
|
|
2666
|
+
progressCurrent.style.cssText = `font-weight:700; color:${theme.textPrimary};`;
|
|
2667
|
+
const progressTotal = document.createElement("span");
|
|
2668
|
+
progressTotal.id = "dd-progress-total";
|
|
2669
|
+
progressTotal.style.cssText = `font-weight:400; color:${theme.textMuted};`;
|
|
2670
|
+
progressLabel.appendChild(progressCurrent);
|
|
2671
|
+
progressLabel.appendChild(progressTotal);
|
|
2672
|
+
const progressFollowUp = document.createElement("span");
|
|
2673
|
+
progressFollowUp.id = "dd-progress-followup";
|
|
2674
|
+
progressFollowUp.textContent = labels.followUp;
|
|
2675
|
+
progressFollowUp.style.cssText = "display:none; font-size:12px; font-weight:600; color:#fff; background:rgba(59,130,246,0.44); border-radius:999px; padding:2px 10px;";
|
|
2676
|
+
progressHead.appendChild(progressLabel);
|
|
2677
|
+
progressHead.appendChild(progressFollowUp);
|
|
2678
|
+
const progressTrack = document.createElement("div");
|
|
2679
|
+
progressTrack.className = "deepdots-progress-track";
|
|
2680
|
+
progressTrack.style.cssText = `width:100%; height:4px; border-radius:999px; background:${theme.progressTrack}; overflow:hidden;`;
|
|
2681
|
+
const progressBar = document.createElement("div");
|
|
2682
|
+
progressBar.id = "dd-progress-bar";
|
|
2683
|
+
progressBar.style.cssText = "height:100%; width:0%; background:#22C55E; border-radius:999px; transition:width 450ms ease;";
|
|
2684
|
+
progressTrack.appendChild(progressBar);
|
|
2685
|
+
progressEl.appendChild(progressHead);
|
|
2686
|
+
progressEl.appendChild(progressTrack);
|
|
2687
|
+
function updateProgress(p) {
|
|
2688
|
+
const total = typeof p.total === "number" ? p.total : 0;
|
|
2689
|
+
const progress = typeof p.progress === "number" ? p.progress : 0;
|
|
2690
|
+
if (!progressEnabled || onStartPage || p.completed || total <= 1) {
|
|
2691
|
+
progressEl.style.display = "none";
|
|
2692
|
+
containerContent.style.paddingTop = "16px";
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
progressEl.style.display = "flex";
|
|
2696
|
+
containerContent.style.paddingTop = "0";
|
|
2697
|
+
const current = Math.min(total, Math.max(1, progress + 1));
|
|
2698
|
+
const pct = Math.min(100, Math.max(0, current / total * 100));
|
|
2699
|
+
progressBar.style.width = `${pct}%`;
|
|
2700
|
+
const label = Math.min(total, Math.max(1, Math.floor(progress) + 1));
|
|
2701
|
+
progressLabel.style.display = progressShowUnit ? "block" : "none";
|
|
2702
|
+
if (progressUnit === "percentage") {
|
|
2703
|
+
progressCurrent.textContent = `${Math.round(pct)}%`;
|
|
2704
|
+
progressTotal.textContent = "";
|
|
2705
|
+
} else {
|
|
2706
|
+
progressCurrent.textContent = `${labels.question} ${label}`;
|
|
2707
|
+
progressTotal.textContent = ` ${labels.of} ${total}`;
|
|
2708
|
+
}
|
|
2709
|
+
progressFollowUp.style.display = p.followup ? "inline-block" : "none";
|
|
2710
|
+
}
|
|
2711
|
+
ensureMagicFeedbackStyles(popup);
|
|
2712
|
+
ensureSpinnerStyles(popup);
|
|
2713
|
+
ensureResponsiveStyles(popup);
|
|
2714
|
+
ensureCustomCss(options?.surveyCss);
|
|
2715
|
+
const containerContent = document.createElement("div");
|
|
2716
|
+
containerContent.id = "dd-content";
|
|
2717
|
+
containerContent.className = "deepdots-popup-container-content";
|
|
2718
|
+
containerContent.style.cssText = "display:flex; flex-direction:column; flex:1 1 auto; min-height:0; padding:16px 0 0 0; overflow:hidden;";
|
|
2719
|
+
const main = document.createElement("div");
|
|
2720
|
+
main.id = "dd-main";
|
|
2721
|
+
main.className = "deepdots-popup-main";
|
|
2722
|
+
main.style.cssText = "display:flex; flex-direction:column; width:100%; flex:1 1 auto; min-height:0; overflow-y:auto;";
|
|
2723
|
+
const formWrapper = document.createElement("div");
|
|
2724
|
+
formWrapper.id = "dd-form-wrapper";
|
|
2725
|
+
formWrapper.style.cssText = "width:100%; flex: 1 1 auto;";
|
|
2726
|
+
const errorHint = document.createElement("div");
|
|
2727
|
+
errorHint.id = "dd-error";
|
|
2728
|
+
errorHint.className = "deepdots-error-hint";
|
|
2729
|
+
errorHint.style.cssText = `
|
|
2730
|
+
display: none;
|
|
2731
|
+
margin: 12px 0 0 0;
|
|
2732
|
+
padding: 10px 12px;
|
|
2733
|
+
border-radius: 6px;
|
|
2734
|
+
background: #FEF3C7; /* amber-100 */
|
|
2735
|
+
color: #92400E; /* amber-700 */
|
|
2736
|
+
border: 1px solid #FCD34D; /* amber-300 */
|
|
2737
|
+
font-size: 13px;
|
|
2738
|
+
`;
|
|
2739
|
+
errorHint.setAttribute("role", "alert");
|
|
2740
|
+
errorHint.setAttribute("aria-live", "polite");
|
|
2741
|
+
const spinnerEl = document.createElement("div");
|
|
2742
|
+
spinnerEl.className = "mf-spinner";
|
|
2743
|
+
spinnerEl.setAttribute("role", "status");
|
|
2744
|
+
spinnerEl.setAttribute("aria-label", labels.loadingAria);
|
|
2745
|
+
spinnerEl.innerHTML = '<div class="mf-spinner-circle"></div>';
|
|
2746
|
+
spinnerEl.style.cssText = "position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);";
|
|
2747
|
+
const formDivId = `magicfeedback-form-${surveyId}`;
|
|
2748
|
+
const formHost = document.createElement("div");
|
|
2749
|
+
formHost.id = formDivId;
|
|
2750
|
+
formHost.style.cssText = "width:100%; visibility:hidden;";
|
|
2751
|
+
formWrapper.appendChild(spinnerEl);
|
|
2752
|
+
formWrapper.appendChild(formHost);
|
|
2753
|
+
main.appendChild(formWrapper);
|
|
2754
|
+
main.appendChild(errorHint);
|
|
2755
|
+
const footer = document.createElement("div");
|
|
2756
|
+
footer.id = "dd-footer";
|
|
2757
|
+
footer.className = "deepdots-popup-footer";
|
|
2758
|
+
footer.setAttribute("data-actions-wrapper", "true");
|
|
2759
|
+
footer.style.cssText = "display:flex; flex-direction: row-reverse ;justify-content:space-between; align-items:center; gap:4px; margin-top:auto; width:100%; padding-top:12px;";
|
|
2760
|
+
const backButton = document.createElement("button");
|
|
2761
|
+
backButton.id = "dd-back";
|
|
2762
|
+
backButton.className = "dd-nav-btn";
|
|
2763
|
+
backButton.textContent = actionLabels.back;
|
|
2764
|
+
backButton.style.cssText = `
|
|
2765
|
+
background: transparent;
|
|
2766
|
+
color: ${theme.textMuted};
|
|
2767
|
+
border: none;
|
|
2768
|
+
min-height: 44px;
|
|
2769
|
+
padding: 12px 24px;
|
|
2770
|
+
border-radius: 6px;
|
|
2771
|
+
cursor: pointer;
|
|
2772
|
+
font-size: 15px;
|
|
2773
|
+
font-weight: 600;
|
|
2774
|
+
transition: filter .15s ease;
|
|
2775
|
+
display: inline-flex;
|
|
2776
|
+
align-items: center;
|
|
2777
|
+
justify-content: center;
|
|
2778
|
+
text-align: center;
|
|
2779
|
+
`;
|
|
2780
|
+
backButton.onmouseenter = () => {
|
|
2781
|
+
backButton.style.filter = "brightness(0.9)";
|
|
2782
|
+
};
|
|
2783
|
+
backButton.onmouseleave = () => {
|
|
2784
|
+
backButton.style.filter = "brightness(1)";
|
|
2785
|
+
};
|
|
2786
|
+
backButton.onclick = () => {
|
|
2787
|
+
emit("popup_clicked", surveyId, { action: "back" });
|
|
2788
|
+
formInstance?.back?.();
|
|
2789
|
+
};
|
|
2790
|
+
const startButton = document.createElement("button");
|
|
2791
|
+
startButton.id = "dd-start";
|
|
2792
|
+
startButton.className = "dd-nav-btn";
|
|
2793
|
+
startButton.textContent = actionLabels.start;
|
|
2794
|
+
startButton.style.cssText = `
|
|
2795
|
+
background: #1E293B;
|
|
2796
|
+
color: #fff;
|
|
2797
|
+
border: none;
|
|
2798
|
+
min-height: 44px;
|
|
2799
|
+
padding: 12px 24px;
|
|
2800
|
+
border-radius: 6px;
|
|
2801
|
+
cursor: pointer;
|
|
2802
|
+
font-size: 15px;
|
|
2803
|
+
font-weight: 600;
|
|
2804
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
2805
|
+
transition: filter .15s ease;
|
|
2806
|
+
display: inline-flex;
|
|
2807
|
+
align-items: center;
|
|
2808
|
+
justify-content: center;
|
|
2809
|
+
text-align: center;
|
|
2810
|
+
`;
|
|
2811
|
+
startButton.onclick = () => {
|
|
2812
|
+
emit("popup_clicked", surveyId, { action: "start_survey" });
|
|
2813
|
+
formInstance?.startForm?.();
|
|
2814
|
+
onStartPage = false;
|
|
2815
|
+
updateProgress({ progress: formInstance?.progress, total: formInstance?.total });
|
|
2816
|
+
};
|
|
2817
|
+
const closeButton = document.createElement("button");
|
|
2818
|
+
closeButton.id = "dd-complete";
|
|
2819
|
+
closeButton.className = "dd-nav-btn";
|
|
2820
|
+
closeButton.textContent = actionLabels.complete;
|
|
2821
|
+
closeButton.style.cssText = `
|
|
2822
|
+
background: #1E293B;
|
|
2823
|
+
color: #fff;
|
|
2824
|
+
border: none;
|
|
2825
|
+
min-height: 44px;
|
|
2826
|
+
padding: 12px 24px;
|
|
2827
|
+
border-radius: 6px;
|
|
2828
|
+
cursor: pointer;
|
|
2829
|
+
font-size: 15px;
|
|
2830
|
+
font-weight: 600;
|
|
2831
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
2832
|
+
transition: filter .15s ease;
|
|
2833
|
+
display: inline-flex;
|
|
2834
|
+
align-items: center;
|
|
2835
|
+
justify-content: center;
|
|
2836
|
+
text-align: center;
|
|
2837
|
+
`;
|
|
2838
|
+
closeButton.onmouseenter = () => {
|
|
2839
|
+
closeButton.style.filter = "brightness(0.9)";
|
|
2840
|
+
};
|
|
2841
|
+
closeButton.onmouseleave = () => {
|
|
2842
|
+
closeButton.style.filter = "brightness(1)";
|
|
2843
|
+
};
|
|
2844
|
+
closeButton.onclick = () => {
|
|
2845
|
+
emit("popup_clicked", surveyId, { action: "complete" });
|
|
2846
|
+
onClose();
|
|
2847
|
+
};
|
|
2848
|
+
const submitButton = document.createElement("button");
|
|
2849
|
+
submitButton.id = "dd-submit";
|
|
2850
|
+
submitButton.className = "dd-nav-btn";
|
|
2851
|
+
submitButton.textContent = actionLabels.accept;
|
|
2852
|
+
submitButton.style.cssText = `
|
|
2853
|
+
background: #1E293B;
|
|
2854
|
+
color: #fff;
|
|
2855
|
+
border: none;
|
|
2856
|
+
min-height: 44px;
|
|
2857
|
+
padding: 12px 24px;
|
|
2858
|
+
border-radius: 6px;
|
|
2859
|
+
cursor: pointer;
|
|
2860
|
+
font-size: 15px;
|
|
2861
|
+
font-weight: 600;
|
|
2862
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
2863
|
+
transition: filter .15s ease;
|
|
2864
|
+
display: inline-flex;
|
|
2865
|
+
align-items: center;
|
|
2866
|
+
justify-content: center;
|
|
2867
|
+
text-align: center;
|
|
2868
|
+
`;
|
|
2869
|
+
submitButton.onclick = () => {
|
|
2870
|
+
if (!surveyCompletedEmitted) {
|
|
2871
|
+
emit("popup_clicked", surveyId, { action: "manual_send" });
|
|
2872
|
+
formInstance?.send?.();
|
|
2873
|
+
}
|
|
2874
|
+
};
|
|
2875
|
+
function applyLabels(lang) {
|
|
2876
|
+
labels = getLabels(lang);
|
|
2877
|
+
actionLabels = resolveActionLabels(actions, lang);
|
|
2878
|
+
backButton.textContent = actionLabels.back;
|
|
2879
|
+
startButton.textContent = actionLabels.start;
|
|
2880
|
+
closeButton.textContent = actionLabels.complete;
|
|
2881
|
+
submitButton.textContent = actionLabels.accept;
|
|
2882
|
+
closeBtn.setAttribute("aria-label", labels.closeAria);
|
|
2883
|
+
spinnerEl.setAttribute("aria-label", labels.loadingAria);
|
|
2884
|
+
progressFollowUp.textContent = labels.followUp;
|
|
2885
|
+
direction = directionFor(lang);
|
|
2886
|
+
popup.setAttribute("dir", direction);
|
|
2887
|
+
}
|
|
2888
|
+
backButton.style.display = "none";
|
|
2889
|
+
startButton.style.display = "none";
|
|
2890
|
+
submitButton.style.display = "none";
|
|
2891
|
+
closeButton.style.display = "none";
|
|
2892
|
+
footer.appendChild(submitButton);
|
|
2893
|
+
footer.appendChild(backButton);
|
|
2894
|
+
footer.appendChild(closeButton);
|
|
2895
|
+
footer.appendChild(startButton);
|
|
2896
|
+
containerContent.appendChild(main);
|
|
2897
|
+
footer.style.flex = "0 0 auto";
|
|
2898
|
+
containerContent.appendChild(footer);
|
|
2899
|
+
function updateButtons(state) {
|
|
2900
|
+
backButton.style.display = "none";
|
|
2901
|
+
startButton.style.display = "none";
|
|
2902
|
+
submitButton.style.display = "none";
|
|
2903
|
+
closeButton.style.display = "none";
|
|
2904
|
+
backButton.style.width = "";
|
|
2905
|
+
startButton.style.width = "";
|
|
2906
|
+
submitButton.style.width = "";
|
|
2907
|
+
closeButton.style.width = "";
|
|
2908
|
+
switch (state) {
|
|
2909
|
+
case "loading":
|
|
2910
|
+
break;
|
|
2911
|
+
case "start":
|
|
2912
|
+
startButton.style.display = "inline-flex";
|
|
2913
|
+
startButton.style.width = "100%";
|
|
2914
|
+
break;
|
|
2915
|
+
case "in_progress_first":
|
|
2916
|
+
submitButton.style.display = "inline-flex";
|
|
2917
|
+
submitButton.style.width = "";
|
|
2918
|
+
setLoading(false);
|
|
2919
|
+
break;
|
|
2920
|
+
case "in_progress_next":
|
|
2921
|
+
backButton.style.display = "inline-flex";
|
|
2922
|
+
submitButton.style.display = "inline-flex";
|
|
2923
|
+
setLoading(false);
|
|
2924
|
+
break;
|
|
2925
|
+
case "completed":
|
|
2926
|
+
closeButton.style.display = "inline-flex";
|
|
2927
|
+
closeButton.style.width = "100%";
|
|
2928
|
+
setLoading(false);
|
|
2929
|
+
break;
|
|
2930
|
+
case "error":
|
|
2931
|
+
setLoading(false);
|
|
2932
|
+
break;
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
function updateNavButtons() {
|
|
2936
|
+
updateButtons(pageDepth > 0 ? "in_progress_next" : "in_progress_first");
|
|
2937
|
+
}
|
|
2938
|
+
let successMessageHtml = "";
|
|
2939
|
+
function showSuccessScreen() {
|
|
2940
|
+
progressEl.style.display = "none";
|
|
2941
|
+
formWrapper.style.display = "none";
|
|
2942
|
+
let done = main.querySelector(".deepdots-success");
|
|
2943
|
+
if (!done) {
|
|
2944
|
+
done = document.createElement("div");
|
|
2945
|
+
done.className = "deepdots-success";
|
|
2946
|
+
done.style.cssText = `width:100%; text-align:center; padding:24px 0; color:${theme.textPrimary};`;
|
|
2947
|
+
main.insertBefore(done, errorHint);
|
|
2948
|
+
}
|
|
2949
|
+
done.innerHTML = successMessageHtml || "<p>Thank you for your feedback!</p>";
|
|
2950
|
+
done.querySelectorAll("img").forEach((img) => {
|
|
2951
|
+
img.style.cssText = "max-width:100%; height:auto; margin:0 auto 16px auto; display:block;";
|
|
2952
|
+
});
|
|
2953
|
+
}
|
|
2954
|
+
popup.appendChild(header);
|
|
2955
|
+
popup.appendChild(progressEl);
|
|
2956
|
+
popup.appendChild(containerContent);
|
|
2957
|
+
container.innerHTML = "";
|
|
2958
|
+
container.appendChild(popup);
|
|
2959
|
+
container.style.display = "flex";
|
|
2960
|
+
container.style.justifyContent = pos.justifyContent;
|
|
2961
|
+
container.style.alignItems = pos.alignItems;
|
|
2962
|
+
container.style.background = pos.background;
|
|
2963
|
+
if (pos.padding) container.style.padding = pos.padding;
|
|
2964
|
+
function setLoading(isLoading) {
|
|
2965
|
+
spinnerEl.style.display = isLoading ? "flex" : "none";
|
|
2966
|
+
if (!isLoading) {
|
|
2967
|
+
formHost.style.visibility = "visible";
|
|
2968
|
+
}
|
|
2969
|
+
footer.style.display = isLoading ? "none" : "flex";
|
|
2970
|
+
backButton.disabled = isLoading;
|
|
2971
|
+
startButton.disabled = isLoading;
|
|
2972
|
+
closeButton.disabled = isLoading;
|
|
2973
|
+
submitButton.disabled = isLoading;
|
|
2974
|
+
submitButton.style.opacity = isLoading ? "0.6" : "1";
|
|
2975
|
+
submitButton.style.cursor = isLoading ? "not-allowed" : "pointer";
|
|
2976
|
+
if (isLoading) {
|
|
2977
|
+
updateButtons("loading");
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
setLoading(true);
|
|
2981
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
2982
|
+
return;
|
|
2983
|
+
}
|
|
2984
|
+
let formInstance = null;
|
|
2985
|
+
try {
|
|
2986
|
+
if (!import_native.default || typeof import_native.default.form !== "function") {
|
|
2987
|
+
sdkWarn("[MagicFeedback] form() no disponible. Fallback manual.");
|
|
2988
|
+
setLoading(false);
|
|
2989
|
+
return;
|
|
2990
|
+
}
|
|
2991
|
+
import_native.default.init(
|
|
2992
|
+
{
|
|
2993
|
+
debug: true,
|
|
2994
|
+
env: env === "production" ? "prod" : "dev"
|
|
2995
|
+
}
|
|
2996
|
+
);
|
|
2997
|
+
const { profile, metadata } = buildSurveyIdentity(userId ?? null, sessionId ?? null, miniService ?? null, analyticsFeedbackSessionId ?? null);
|
|
2998
|
+
formInstance = import_native.default.form(surveyId, productId, profile, metadata);
|
|
2999
|
+
const generateOptions = {
|
|
3000
|
+
addButton: false,
|
|
3001
|
+
getMetaData: true,
|
|
3002
|
+
// La pantalla final la pinta el popup: `renderSuccess` de @magicfeedback/native usa
|
|
3003
|
+
// textContent, así que el mensaje de la plataforma (HTML con imagen) no se vería, y
|
|
3004
|
+
// su fallback es un literal genérico que ignora `style.successMessage`.
|
|
3005
|
+
addSuccessScreen: false
|
|
3006
|
+
};
|
|
3007
|
+
generateOptions.onLoadedEvent = ({ formData }) => {
|
|
3008
|
+
const surveyLang = Array.isArray(formData?.lang) ? formData.lang.find((l) => typeof l === "string" && l.trim().length > 0) : void 0;
|
|
3009
|
+
if (surveyLang) applyLabels(surveyLang);
|
|
3010
|
+
try {
|
|
3011
|
+
} catch {
|
|
3012
|
+
}
|
|
3013
|
+
const s = formData?.style;
|
|
3014
|
+
if (s && !stylesInjected) {
|
|
3015
|
+
stylesInjected = true;
|
|
3016
|
+
if (s.successMessage) successMessageHtml = s.successMessage;
|
|
3017
|
+
if (options?.showProgressBar === void 0) progressEnabled = s.showProgressBar === true;
|
|
3018
|
+
if (s.showProgressUnit !== void 0) progressShowUnit = s.showProgressUnit !== false;
|
|
3019
|
+
if (s.progressUnit) progressUnit = s.progressUnit;
|
|
3020
|
+
if (s.loadingBarColor) {
|
|
3021
|
+
progressBar.style.background = s.loadingBarColor;
|
|
3022
|
+
progressFollowUp.style.background = s.loadingBarColor;
|
|
3023
|
+
}
|
|
3024
|
+
if (s.boxBackgroundColor) {
|
|
3025
|
+
popup.style.background = s.boxBackgroundColor;
|
|
3026
|
+
}
|
|
3027
|
+
if (s.contentAlign) {
|
|
3028
|
+
main.style.justifyContent = s.contentAlign === "center" ? "center" : "flex-start";
|
|
3029
|
+
}
|
|
3030
|
+
if (s.buttonPrimaryColor) {
|
|
3031
|
+
submitButton.style.background = s.buttonPrimaryColor;
|
|
3032
|
+
submitButton.style.border = "none";
|
|
3033
|
+
submitButton.style.color = "#fff";
|
|
3034
|
+
startButton.style.background = s.buttonPrimaryColor;
|
|
3035
|
+
startButton.style.border = "none";
|
|
3036
|
+
startButton.style.color = "#fff";
|
|
3037
|
+
closeButton.style.background = s.buttonPrimaryColor;
|
|
3038
|
+
closeButton.style.border = "none";
|
|
3039
|
+
closeButton.style.color = "#fff";
|
|
3040
|
+
}
|
|
3041
|
+
if (s.buttonSecondaryColor) {
|
|
3042
|
+
backButton.style.background = "transparent";
|
|
3043
|
+
backButton.style.color = s.buttonSecondaryColor;
|
|
3044
|
+
backButton.style.border = "none";
|
|
3045
|
+
}
|
|
3046
|
+
insertPopupLogo(popup, progressEl, s, "deepdots-popup-logo");
|
|
3047
|
+
if (s.startMessage && s.startMessage !== "") {
|
|
3048
|
+
sdkLog(s.startMessage);
|
|
3049
|
+
onStartPage = true;
|
|
3050
|
+
updateButtons("start");
|
|
3051
|
+
} else {
|
|
3052
|
+
updateButtons("in_progress_first");
|
|
3053
|
+
}
|
|
3054
|
+
} else {
|
|
3055
|
+
updateButtons("in_progress_first");
|
|
3056
|
+
}
|
|
3057
|
+
updateProgress({ progress: formInstance.progress, total: formInstance.total });
|
|
3058
|
+
emit("popup_clicked", surveyId, { action: "loaded" });
|
|
3059
|
+
setLoading(false);
|
|
3060
|
+
};
|
|
3061
|
+
generateOptions.beforeSubmitEvent = () => {
|
|
3062
|
+
setLoading(true);
|
|
3063
|
+
emit("popup_clicked", surveyId, { action: "before_submit" });
|
|
3064
|
+
};
|
|
3065
|
+
generateOptions.afterSubmitEvent = ({ error, completed, total, progress, followup }) => {
|
|
3066
|
+
const errText = error ? typeof error === "string" ? error : error.message ?? String(error) : "";
|
|
3067
|
+
if (errText) {
|
|
3068
|
+
setLoading(false);
|
|
3069
|
+
if (errText.toLowerCase().includes("no response")) {
|
|
3070
|
+
errorHint.textContent = labels.errorRequired;
|
|
3071
|
+
errorHint.style.display = "block";
|
|
3072
|
+
emit("popup_clicked", surveyId, { action: "validation_error_required" });
|
|
3073
|
+
updateNavButtons();
|
|
3074
|
+
return;
|
|
3075
|
+
}
|
|
3076
|
+
errorHint.textContent = labels.errorSubmit;
|
|
3077
|
+
errorHint.style.display = "block";
|
|
3078
|
+
emit("popup_clicked", surveyId, { action: "submit_error", error: errText });
|
|
3079
|
+
return;
|
|
3080
|
+
}
|
|
3081
|
+
errorHint.style.display = "none";
|
|
3082
|
+
setLoading(false);
|
|
3083
|
+
if (completed) {
|
|
3084
|
+
emit("survey_completed", surveyId, { action: "completed" });
|
|
3085
|
+
surveyCompletedEmitted = true;
|
|
3086
|
+
showSuccessScreen();
|
|
3087
|
+
updateButtons("completed");
|
|
3088
|
+
updateProgress({ progress, total, completed: true });
|
|
3089
|
+
return;
|
|
3090
|
+
}
|
|
3091
|
+
emit("popup_clicked", surveyId, { action: "partial" });
|
|
3092
|
+
pageDepth++;
|
|
3093
|
+
updateNavButtons();
|
|
3094
|
+
updateProgress({ progress, total, followup });
|
|
3095
|
+
};
|
|
3096
|
+
generateOptions.onBackEvent = ({ progress, error, followup }) => {
|
|
3097
|
+
emit("popup_clicked", surveyId, { action: "back" });
|
|
3098
|
+
if (!error) pageDepth = Math.max(0, pageDepth - 1);
|
|
3099
|
+
updateNavButtons();
|
|
3100
|
+
updateProgress({ progress, total: formInstance.total, followup });
|
|
3101
|
+
};
|
|
3102
|
+
formInstance.generate(formDivId, generateOptions).catch((err) => {
|
|
3103
|
+
sdkError("[MagicFeedback] Error generating form:", err);
|
|
3104
|
+
setLoading(false);
|
|
3105
|
+
});
|
|
3106
|
+
} catch (e) {
|
|
3107
|
+
sdkError("[MagicFeedback] Exception initializing form:", e);
|
|
3108
|
+
setLoading(false);
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
export {
|
|
3112
|
+
renderPopup
|
|
3113
|
+
};
|
|
3114
|
+
//# sourceMappingURL=renderPopup-HHQMAW3G.mjs.map
|