@magicfeedback/popup-sdk 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/assets/style.css +1487 -593
- package/dist/chunk-AN7JIVWB.mjs +1965 -0
- package/dist/chunk-AN7JIVWB.mjs.map +1 -0
- package/dist/chunk-Z3LLJMSH.mjs +1944 -0
- package/dist/chunk-Z3LLJMSH.mjs.map +1 -0
- package/dist/index.js +3030 -549
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -11
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.js +1825 -56
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +13 -11
- package/dist/react-native.mjs.map +1 -1
- package/dist/{renderPopup-PXJEND4Y.mjs → renderPopup-M6MKTDEH.mjs} +1232 -528
- package/dist/renderPopup-M6MKTDEH.mjs.map +1 -0
- package/dist/{renderPopup-4WZ7V435.mjs → renderPopup-SELXQ3UE.mjs} +41 -49
- package/dist/renderPopup-SELXQ3UE.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-D7QAGWGC.mjs +0 -176
- package/dist/chunk-D7QAGWGC.mjs.map +0 -1
- package/dist/chunk-JSBMP4MI.mjs +0 -197
- package/dist/chunk-JSBMP4MI.mjs.map +0 -1
- package/dist/renderPopup-4WZ7V435.mjs.map +0 -1
- package/dist/renderPopup-PXJEND4Y.mjs.map +0 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
sdkLog,
|
|
9
9
|
sdkWarn,
|
|
10
10
|
style_default
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AN7JIVWB.mjs";
|
|
12
12
|
|
|
13
13
|
// node_modules/@magicfeedback/native/dist/magicfeedback-sdk.browser.js
|
|
14
14
|
var require_magicfeedback_sdk_browser = __commonJS({
|
|
@@ -17,7 +17,7 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
17
17
|
!(function(e, t) {
|
|
18
18
|
"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();
|
|
19
19
|
})(self, (() => {
|
|
20
|
-
return e = {
|
|
20
|
+
return e = { 326: function(e2, t2) {
|
|
21
21
|
var i = "undefined" != typeof self ? self : this, n = (function() {
|
|
22
22
|
function e3() {
|
|
23
23
|
this.fetch = false, this.DOMException = i.DOMException;
|
|
@@ -32,9 +32,9 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
32
32
|
} catch (e4) {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
|
-
})(), s = "FormData" in e3,
|
|
36
|
-
if (
|
|
37
|
-
return e4 &&
|
|
35
|
+
})(), s = "FormData" in e3, o = "ArrayBuffer" in e3;
|
|
36
|
+
if (o) var a = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"], l = ArrayBuffer.isView || function(e4) {
|
|
37
|
+
return e4 && a.indexOf(Object.prototype.toString.call(e4)) > -1;
|
|
38
38
|
};
|
|
39
39
|
function d(e4) {
|
|
40
40
|
if ("string" != typeof e4 && (e4 = String(e4)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e4)) throw new TypeError("Invalid character in header field name");
|
|
@@ -61,11 +61,11 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
61
61
|
this.append(t4, e4[t4]);
|
|
62
62
|
}), this);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function h(e4) {
|
|
65
65
|
if (e4.bodyUsed) return Promise.reject(new TypeError("Already read"));
|
|
66
66
|
e4.bodyUsed = true;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function m(e4) {
|
|
69
69
|
return new Promise((function(t4, i3) {
|
|
70
70
|
e4.onload = function() {
|
|
71
71
|
t4(e4.result);
|
|
@@ -75,31 +75,31 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
75
75
|
}));
|
|
76
76
|
}
|
|
77
77
|
function f(e4) {
|
|
78
|
-
var t4 = new FileReader(), i3 =
|
|
78
|
+
var t4 = new FileReader(), i3 = m(t4);
|
|
79
79
|
return t4.readAsArrayBuffer(e4), i3;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function g(e4) {
|
|
82
82
|
if (e4.slice) return e4.slice(0);
|
|
83
83
|
var t4 = new Uint8Array(e4.byteLength);
|
|
84
84
|
return t4.set(new Uint8Array(e4)), t4.buffer;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function v() {
|
|
87
87
|
return this.bodyUsed = false, this._initBody = function(e4) {
|
|
88
88
|
var t4;
|
|
89
|
-
this._bodyInit = e4, e4 ? "string" == typeof e4 ? this._bodyText = e4 : r2 && Blob.prototype.isPrototypeOf(e4) ? this._bodyBlob = e4 : s && FormData.prototype.isPrototypeOf(e4) ? this._bodyFormData = e4 : i2 && URLSearchParams.prototype.isPrototypeOf(e4) ? this._bodyText = e4.toString() :
|
|
89
|
+
this._bodyInit = e4, e4 ? "string" == typeof e4 ? this._bodyText = e4 : r2 && Blob.prototype.isPrototypeOf(e4) ? this._bodyBlob = e4 : s && FormData.prototype.isPrototypeOf(e4) ? this._bodyFormData = e4 : i2 && URLSearchParams.prototype.isPrototypeOf(e4) ? this._bodyText = e4.toString() : o && r2 && (t4 = e4) && DataView.prototype.isPrototypeOf(t4) ? (this._bodyArrayBuffer = g(e4.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : o && (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"));
|
|
90
90
|
}, r2 && (this.blob = function() {
|
|
91
|
-
var e4 =
|
|
91
|
+
var e4 = h(this);
|
|
92
92
|
if (e4) return e4;
|
|
93
93
|
if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
|
|
94
94
|
if (this._bodyArrayBuffer) return Promise.resolve(new Blob([this._bodyArrayBuffer]));
|
|
95
95
|
if (this._bodyFormData) throw new Error("could not read FormData body as blob");
|
|
96
96
|
return Promise.resolve(new Blob([this._bodyText]));
|
|
97
97
|
}, this.arrayBuffer = function() {
|
|
98
|
-
return this._bodyArrayBuffer ?
|
|
98
|
+
return this._bodyArrayBuffer ? h(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(f);
|
|
99
99
|
}), this.text = function() {
|
|
100
|
-
var e4, t4, i3, n3 =
|
|
100
|
+
var e4, t4, i3, n3 = h(this);
|
|
101
101
|
if (n3) return n3;
|
|
102
|
-
if (this._bodyBlob) return e4 = this._bodyBlob, i3 =
|
|
102
|
+
if (this._bodyBlob) return e4 = this._bodyBlob, i3 = m(t4 = new FileReader()), t4.readAsText(e4), i3;
|
|
103
103
|
if (this._bodyArrayBuffer) return Promise.resolve((function(e5) {
|
|
104
104
|
for (var t5 = new Uint8Array(e5), i4 = new Array(t5.length), n4 = 0; n4 < t5.length; n4++) i4[n4] = String.fromCharCode(t5[n4]);
|
|
105
105
|
return i4.join("");
|
|
@@ -161,21 +161,21 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
161
161
|
}
|
|
162
162
|
})), t4;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function A(e4, t4) {
|
|
165
165
|
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);
|
|
166
166
|
}
|
|
167
167
|
b.prototype.clone = function() {
|
|
168
168
|
return new b(this, { body: this._bodyInit });
|
|
169
|
-
},
|
|
170
|
-
return new
|
|
171
|
-
},
|
|
172
|
-
var e4 = new
|
|
169
|
+
}, v.call(b.prototype), v.call(A.prototype), A.prototype.clone = function() {
|
|
170
|
+
return new A(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new p(this.headers), url: this.url });
|
|
171
|
+
}, A.error = function() {
|
|
172
|
+
var e4 = new A(null, { status: 0, statusText: "" });
|
|
173
173
|
return e4.type = "error", e4;
|
|
174
174
|
};
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
if (-1 ===
|
|
178
|
-
return new
|
|
175
|
+
var k = [301, 302, 303, 307, 308];
|
|
176
|
+
A.redirect = function(e4, t4) {
|
|
177
|
+
if (-1 === k.indexOf(t4)) throw new RangeError("Invalid status code");
|
|
178
|
+
return new A(null, { status: t4, headers: { location: e4 } });
|
|
179
179
|
}, t3.DOMException = e3.DOMException;
|
|
180
180
|
try {
|
|
181
181
|
new t3.DOMException();
|
|
@@ -188,37 +188,37 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
188
188
|
}
|
|
189
189
|
function C(e4, i3) {
|
|
190
190
|
return new Promise((function(n3, s2) {
|
|
191
|
-
var
|
|
192
|
-
if (
|
|
193
|
-
var
|
|
191
|
+
var o2 = new b(e4, i3);
|
|
192
|
+
if (o2.signal && o2.signal.aborted) return s2(new t3.DOMException("Aborted", "AbortError"));
|
|
193
|
+
var a2 = new XMLHttpRequest();
|
|
194
194
|
function l2() {
|
|
195
|
-
|
|
195
|
+
a2.abort();
|
|
196
196
|
}
|
|
197
|
-
|
|
198
|
-
var e5, t4, i4 = { status:
|
|
197
|
+
a2.onload = function() {
|
|
198
|
+
var e5, t4, i4 = { status: a2.status, statusText: a2.statusText, headers: (e5 = a2.getAllResponseHeaders() || "", t4 = new p(), e5.replace(/\r?\n[\t ]+/g, " ").split(/\r?\n/).forEach((function(e6) {
|
|
199
199
|
var i5 = e6.split(":"), n4 = i5.shift().trim();
|
|
200
200
|
if (n4) {
|
|
201
201
|
var r4 = i5.join(":").trim();
|
|
202
202
|
t4.append(n4, r4);
|
|
203
203
|
}
|
|
204
204
|
})), t4) };
|
|
205
|
-
i4.url = "responseURL" in
|
|
206
|
-
var r3 = "response" in
|
|
207
|
-
n3(new
|
|
208
|
-
},
|
|
205
|
+
i4.url = "responseURL" in a2 ? a2.responseURL : i4.headers.get("X-Request-URL");
|
|
206
|
+
var r3 = "response" in a2 ? a2.response : a2.responseText;
|
|
207
|
+
n3(new A(r3, i4));
|
|
208
|
+
}, a2.onerror = function() {
|
|
209
209
|
s2(new TypeError("Network request failed"));
|
|
210
|
-
},
|
|
210
|
+
}, a2.ontimeout = function() {
|
|
211
211
|
s2(new TypeError("Network request failed"));
|
|
212
|
-
},
|
|
212
|
+
}, a2.onabort = function() {
|
|
213
213
|
s2(new t3.DOMException("Aborted", "AbortError"));
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
})),
|
|
217
|
-
4 ===
|
|
218
|
-
}),
|
|
214
|
+
}, a2.open(o2.method, o2.url, true), "include" === o2.credentials ? a2.withCredentials = true : "omit" === o2.credentials && (a2.withCredentials = false), "responseType" in a2 && r2 && (a2.responseType = "blob"), o2.headers.forEach((function(e5, t4) {
|
|
215
|
+
a2.setRequestHeader(t4, e5);
|
|
216
|
+
})), o2.signal && (o2.signal.addEventListener("abort", l2), a2.onreadystatechange = function() {
|
|
217
|
+
4 === a2.readyState && o2.signal.removeEventListener("abort", l2);
|
|
218
|
+
}), a2.send(void 0 === o2._bodyInit ? null : o2._bodyInit);
|
|
219
219
|
}));
|
|
220
220
|
}
|
|
221
|
-
C.polyfill = true, e3.fetch || (e3.fetch = C, e3.Headers = p, e3.Request = b, e3.Response =
|
|
221
|
+
C.polyfill = true, e3.fetch || (e3.fetch = C, e3.Headers = p, e3.Request = b, e3.Response = A), t3.Headers = p, t3.Request = b, t3.Response = A, t3.fetch = C, Object.defineProperty(t3, "__esModule", { value: true });
|
|
222
222
|
})({});
|
|
223
223
|
})(n), n.fetch.ponyfill = true, delete n.fetch.polyfill;
|
|
224
224
|
var r = n;
|
|
@@ -239,14 +239,14 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
239
239
|
"use strict";
|
|
240
240
|
var n = this && this.__awaiter || function(e3, t3, i2, n2) {
|
|
241
241
|
return new (i2 || (i2 = Promise))((function(r2, s2) {
|
|
242
|
-
function
|
|
242
|
+
function o2(e4) {
|
|
243
243
|
try {
|
|
244
244
|
l2(n2.next(e4));
|
|
245
245
|
} catch (e5) {
|
|
246
246
|
s2(e5);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function a2(e4) {
|
|
250
250
|
try {
|
|
251
251
|
l2(n2.throw(e4));
|
|
252
252
|
} catch (e5) {
|
|
@@ -257,34 +257,42 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
257
257
|
var t4;
|
|
258
258
|
e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
259
259
|
e5(t4);
|
|
260
|
-
}))).then(
|
|
260
|
+
}))).then(o2, a2);
|
|
261
261
|
}
|
|
262
262
|
l2((n2 = n2.apply(e3, t3 || [])).next());
|
|
263
263
|
}));
|
|
264
264
|
};
|
|
265
265
|
Object.defineProperty(t2, "__esModule", { value: true });
|
|
266
|
-
const r = i(57), s = i(665), a = i(256),
|
|
266
|
+
const r = i(57), s = i(544), o = i(665), a = i(256), l = i(313), d = i(317);
|
|
267
267
|
t2.default = function() {
|
|
268
|
-
const e3 = new
|
|
268
|
+
const e3 = new o.Config();
|
|
269
269
|
let t3 = new a.Log(e3);
|
|
270
270
|
return { init: function(i2) {
|
|
271
|
-
"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) ?
|
|
272
|
-
}, send: function(i2, r2, s2,
|
|
271
|
+
"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);
|
|
272
|
+
}, send: function(i2, r2, s2, o2 = true, a2, d2) {
|
|
273
273
|
return n(this, void 0, void 0, (function* () {
|
|
274
274
|
i2 || t3.err("No appID provided"), r2 || t3.err("No publicKey provided"), s2 || t3.err("No feedback provided"), s2.answers || s2.profile || s2.metrics || s2.metadata || t3.err("No feedback data provided");
|
|
275
|
-
const n2 = e3.get("url"), c = { integration: i2, publicKey: r2, privateKey:
|
|
275
|
+
const n2 = e3.get("url"), c = { integration: i2, publicKey: r2, privateKey: d2, completed: o2, id: a2, feedback: s2 };
|
|
276
276
|
try {
|
|
277
277
|
if (e3.get("dryRun")) return t3.log("Dry run enabled: skipping native feedback submit"), `dry-run-${Date.now()}`;
|
|
278
|
-
const i3 = yield (0,
|
|
278
|
+
const i3 = yield (0, l.sendFeedback)(n2, c, t3);
|
|
279
279
|
return t3.log("sent native feedback"), i3;
|
|
280
280
|
} catch (e4) {
|
|
281
281
|
return t3.err("error native feedback", e4), false;
|
|
282
282
|
}
|
|
283
283
|
}));
|
|
284
|
-
}, form: function(i2, n2, s2,
|
|
285
|
-
return i2 || t3.err("No appID provided"), n2 || t3.err("No publicKey provided"), new r.Form(e3, i2, n2, s2,
|
|
284
|
+
}, form: function(i2, n2, s2, o2) {
|
|
285
|
+
return i2 || t3.err("No appID provided"), n2 || t3.err("No publicKey provided"), new r.Form(e3, i2, n2, s2, o2);
|
|
286
|
+
}, agentForm: function(i2, n2, r2) {
|
|
287
|
+
return i2 || t3.err("No integrationId provided"), n2 || t3.err("No publicKey provided"), new s.AgentForm(e3, i2, n2, r2);
|
|
286
288
|
}, session: function(i2) {
|
|
287
289
|
return i2 || t3.err("No sessionId provided"), new r.Form(e3, i2);
|
|
290
|
+
}, previewPage: function(i2, s2, o2) {
|
|
291
|
+
return n(this, void 0, void 0, (function* () {
|
|
292
|
+
i2 || t3.err("No selector provided"), s2 && s2.page || t3.err("No page provided for preview");
|
|
293
|
+
const n2 = (null == s2 ? void 0 : s2.appId) || `preview-${Date.now()}`, a2 = new r.Form(e3, n2);
|
|
294
|
+
return yield a2.previewPage(i2, s2, o2), a2;
|
|
295
|
+
}));
|
|
288
296
|
} };
|
|
289
297
|
};
|
|
290
298
|
}, 79: (e2, t2) => {
|
|
@@ -318,6 +326,243 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
318
326
|
return this.items[e3];
|
|
319
327
|
}
|
|
320
328
|
};
|
|
329
|
+
}, 544: function(e2, t2, i) {
|
|
330
|
+
"use strict";
|
|
331
|
+
var n = this && this.__awaiter || function(e3, t3, i2, n2) {
|
|
332
|
+
return new (i2 || (i2 = Promise))((function(r2, s2) {
|
|
333
|
+
function o2(e4) {
|
|
334
|
+
try {
|
|
335
|
+
l2(n2.next(e4));
|
|
336
|
+
} catch (e5) {
|
|
337
|
+
s2(e5);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function a2(e4) {
|
|
341
|
+
try {
|
|
342
|
+
l2(n2.throw(e4));
|
|
343
|
+
} catch (e5) {
|
|
344
|
+
s2(e5);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function l2(e4) {
|
|
348
|
+
var t4;
|
|
349
|
+
e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
350
|
+
e5(t4);
|
|
351
|
+
}))).then(o2, a2);
|
|
352
|
+
}
|
|
353
|
+
l2((n2 = n2.apply(e3, t3 || [])).next());
|
|
354
|
+
}));
|
|
355
|
+
};
|
|
356
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.AgentForm = void 0;
|
|
357
|
+
const r = i(256), s = i(279), o = i(945), a = i(177), l = i(107), d = i(565), c = i(571), u = i(213);
|
|
358
|
+
t2.AgentForm = class {
|
|
359
|
+
constructor(e3, t3, i2, n2) {
|
|
360
|
+
this.config = e3, this.log = new r.Log(e3), this.url = e3.get("url"), this.integrationId = t3, this.publicKey = i2, this.privateKey = n2, this.formOptionsConfig = { addButton: true, sendButtonText: "Send", backButtonText: "Back", nextButtonText: "Next", addSuccessScreen: true, questionFormat: "standard", answerDelimiter: a.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;
|
|
361
|
+
}
|
|
362
|
+
generate(e3, t3 = {}) {
|
|
363
|
+
var i2;
|
|
364
|
+
return n(this, void 0, void 0, (function* () {
|
|
365
|
+
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");
|
|
366
|
+
try {
|
|
367
|
+
const e4 = false !== this.formOptionsConfig.resume ? this.restore() : null;
|
|
368
|
+
if (e4) this.log.log(`Resuming agent session ${e4.sessionId} at turn ${e4.currentTurn}`), this.mountForm(), this.renderStep();
|
|
369
|
+
else {
|
|
370
|
+
const e5 = yield this.startWithRetry();
|
|
371
|
+
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);
|
|
372
|
+
const t4 = (0, a.toAgentStep)(e5, this.adapterContext());
|
|
373
|
+
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 })));
|
|
374
|
+
this.acceptQuestion(t4), this.renderStep(), this.persist();
|
|
375
|
+
}
|
|
376
|
+
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 }));
|
|
377
|
+
} catch (e4) {
|
|
378
|
+
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 }));
|
|
379
|
+
}
|
|
380
|
+
}));
|
|
381
|
+
}
|
|
382
|
+
next() {
|
|
383
|
+
return n(this, void 0, void 0, (function* () {
|
|
384
|
+
return this.runTurn();
|
|
385
|
+
}));
|
|
386
|
+
}
|
|
387
|
+
answer() {
|
|
388
|
+
const e3 = document.getElementById(this.formId());
|
|
389
|
+
return e3 ? (0, l.scrapeInputs)(e3) : [];
|
|
390
|
+
}
|
|
391
|
+
getConversation() {
|
|
392
|
+
return [...this.conversation];
|
|
393
|
+
}
|
|
394
|
+
getSessionId() {
|
|
395
|
+
return this.sessionId;
|
|
396
|
+
}
|
|
397
|
+
reset() {
|
|
398
|
+
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();
|
|
399
|
+
}
|
|
400
|
+
runTurn() {
|
|
401
|
+
var e3;
|
|
402
|
+
return n(this, void 0, void 0, (function* () {
|
|
403
|
+
if (this.busy || this.completed || !this.currentQuestion) return;
|
|
404
|
+
this.busy = true, this.setSubmitDisabled(true), this.clearError();
|
|
405
|
+
const t3 = this.currentQuestion;
|
|
406
|
+
try {
|
|
407
|
+
const i2 = document.getElementById(this.formId()), n2 = document.getElementById(this.questionsId());
|
|
408
|
+
if (!i2) throw new Error("Agent form not found");
|
|
409
|
+
yield (0, c.awaitUploadReady)(n2);
|
|
410
|
+
const r2 = (0, l.scrapeInputs)(i2);
|
|
411
|
+
let s2 = (0, a.encodeAnswer)(r2, t3, this.formOptionsConfig.answerDelimiter);
|
|
412
|
+
if ("" === s2) {
|
|
413
|
+
if (t3.require) return void this.showError(this.formOptionsConfig.requiredMessage || "Please answer before continuing.");
|
|
414
|
+
s2 = this.formOptionsConfig.emptyAnswerText || "";
|
|
415
|
+
}
|
|
416
|
+
this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
|
|
417
|
+
const d2 = { role: "user", content: s2, questionType: t3.type, questionRef: t3.ref }, u2 = this.currentTurn + 1, p = yield (0, o.nextAgentTurn)(this.url, { publicKey: this.publicKey, privateKey: this.privateKey, integrationId: this.integrationId, sessionId: this.sessionId, conversation: [...this.conversation], currentTurn: u2, lastAnswer: s2, lastQuestionRef: t3.ref, askedRefs: [...this.askedRefs] }, this.log);
|
|
418
|
+
this.conversation.push(d2), this.currentTurn = null !== (e3 = p.currentTurn) && void 0 !== e3 ? e3 : u2, p.maxTurns && (this.maxTurns = p.maxTurns), this.total = Math.max(this.maxTurns - 1, 0);
|
|
419
|
+
const h = (0, a.toAgentStep)(p, this.adapterContext());
|
|
420
|
+
if ("END" === h.kind) return void (yield this.renderEnd(h));
|
|
421
|
+
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 }));
|
|
422
|
+
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 }));
|
|
423
|
+
} catch (e4) {
|
|
424
|
+
yield this.handleTurnError(e4);
|
|
425
|
+
} finally {
|
|
426
|
+
this.completed || (this.busy = false, this.rateLimitTimer || this.setSubmitDisabled(false));
|
|
427
|
+
}
|
|
428
|
+
}));
|
|
429
|
+
}
|
|
430
|
+
handleTurnError(e3) {
|
|
431
|
+
return n(this, void 0, void 0, (function* () {
|
|
432
|
+
this.log.err(`An error occurred during the agent turn ${this.integrationId}:`, e3), e3 instanceof s.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 }));
|
|
433
|
+
}));
|
|
434
|
+
}
|
|
435
|
+
acceptQuestion(e3) {
|
|
436
|
+
const t3 = e3.question;
|
|
437
|
+
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);
|
|
438
|
+
}
|
|
439
|
+
formId() {
|
|
440
|
+
return "magicfeedback-agent-" + this.integrationId;
|
|
441
|
+
}
|
|
442
|
+
questionsId() {
|
|
443
|
+
return "magicfeedback-agent-questions-" + this.integrationId;
|
|
444
|
+
}
|
|
445
|
+
mountForm() {
|
|
446
|
+
const e3 = (0, d.generateContainer)(this.selector, this.integrationId);
|
|
447
|
+
this.primaryColor && (0, d.applyPrimaryColor)(e3, this.primaryColor);
|
|
448
|
+
const t3 = document.createElement("form");
|
|
449
|
+
t3.classList.add("magicfeedback-form"), t3.classList.add("magicfeedback-agent-form"), t3.id = this.formId(), t3.addEventListener("submit", ((e4) => {
|
|
450
|
+
e4.preventDefault(), this.runTurn();
|
|
451
|
+
}));
|
|
452
|
+
const i2 = document.createElement("div");
|
|
453
|
+
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, this.formOptionsConfig.backButtonText, this.formOptionsConfig.nextButtonText)), e3.appendChild(t3);
|
|
454
|
+
}
|
|
455
|
+
renderStep() {
|
|
456
|
+
const e3 = document.getElementById(this.questionsId());
|
|
457
|
+
e3 && this.currentQuestion && (e3.innerHTML = "", (0, u.renderQuestions)([this.currentQuestion], this.formOptionsConfig.questionFormat, this.language, this.product, (() => this.runTurn())).forEach(((t3) => e3.appendChild(t3))));
|
|
458
|
+
}
|
|
459
|
+
renderEnd(e3) {
|
|
460
|
+
return n(this, void 0, void 0, (function* () {
|
|
461
|
+
this.completed = true, this.currentQuestion = null, this.busy = false, this.timeToCompleted = this.timeToCompleted ? Date.now() - this.timeToCompleted : 0, this.clearRateLimitTimer(), this.clearPersisted();
|
|
462
|
+
const t3 = document.getElementById("magicfeedback-container-" + this.integrationId);
|
|
463
|
+
if (t3 && false !== this.formOptionsConfig.addSuccessScreen) {
|
|
464
|
+
t3.innerHTML = "";
|
|
465
|
+
const i2 = "BLOCKED" === e3.reason ? this.formOptionsConfig.blockedMessage || "Thanks for your time \u2014 we'll end the conversation here." : this.formOptionsConfig.successMessage || "Thank you for your feedback!", n2 = (0, u.renderSuccess)(i2);
|
|
466
|
+
n2.classList.add("magicfeedback-success-message"), n2.classList.add("magicfeedback-agent-end"), "BLOCKED" === e3.reason && n2.classList.add("magicfeedback-agent-end--blocked"), t3.appendChild(n2);
|
|
467
|
+
}
|
|
468
|
+
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 }));
|
|
469
|
+
}));
|
|
470
|
+
}
|
|
471
|
+
back() {
|
|
472
|
+
return n(this, void 0, void 0, (function* () {
|
|
473
|
+
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 }))));
|
|
474
|
+
}));
|
|
475
|
+
}
|
|
476
|
+
renderFatal(e3) {
|
|
477
|
+
try {
|
|
478
|
+
(0, d.generateContainer)(this.selector, this.integrationId).appendChild((0, u.renderError)(this.errorMessageFor(e3)));
|
|
479
|
+
} catch (e4) {
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
errorMessageFor(e3) {
|
|
483
|
+
if (!(e3 instanceof s.AgentApiError)) return "Something went wrong. Please try again.";
|
|
484
|
+
switch (e3.kind) {
|
|
485
|
+
case "AUTH":
|
|
486
|
+
case "NOT_FOUND":
|
|
487
|
+
case "BAD_CONFIG":
|
|
488
|
+
return "This survey is not available right now.";
|
|
489
|
+
case "AI_UNAVAILABLE":
|
|
490
|
+
return "We couldn't start the survey. Please try again in a moment.";
|
|
491
|
+
default:
|
|
492
|
+
return "Something went wrong. Please try again.";
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
adapterContext() {
|
|
496
|
+
return { integrationId: this.integrationId, sessionId: this.sessionId, language: this.language, log: this.log };
|
|
497
|
+
}
|
|
498
|
+
startWithRetry() {
|
|
499
|
+
return n(this, void 0, void 0, (function* () {
|
|
500
|
+
const e3 = { publicKey: this.publicKey, privateKey: this.privateKey, integrationId: this.integrationId };
|
|
501
|
+
try {
|
|
502
|
+
return yield (0, o.startAgentSurvey)(this.url, e3, this.log);
|
|
503
|
+
} catch (t3) {
|
|
504
|
+
if (t3 instanceof s.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, o.startAgentSurvey)(this.url, e3, this.log);
|
|
505
|
+
throw t3;
|
|
506
|
+
}
|
|
507
|
+
}));
|
|
508
|
+
}
|
|
509
|
+
setSubmitDisabled(e3) {
|
|
510
|
+
const t3 = document.getElementById("magicfeedback-submit");
|
|
511
|
+
t3 && (t3.disabled = e3);
|
|
512
|
+
}
|
|
513
|
+
clearError() {
|
|
514
|
+
const e3 = document.getElementById(this.questionsId());
|
|
515
|
+
null == e3 || e3.querySelectorAll(".magicfeedback-error").forEach(((e4) => e4.remove()));
|
|
516
|
+
}
|
|
517
|
+
showError(e3) {
|
|
518
|
+
const t3 = document.getElementById(this.questionsId());
|
|
519
|
+
t3 && (this.clearError(), t3.insertBefore((0, u.renderError)(e3), t3.firstChild));
|
|
520
|
+
}
|
|
521
|
+
startRateLimitCountdown(e3) {
|
|
522
|
+
this.clearRateLimitTimer(), this.setSubmitDisabled(true);
|
|
523
|
+
let t3 = Math.ceil(e3 / 1e3);
|
|
524
|
+
const i2 = this.formOptionsConfig.rateLimitMessage || "Too many requests. Retrying in {seconds}s\u2026", n2 = () => {
|
|
525
|
+
if (t3 <= 0) return this.clearRateLimitTimer(), this.clearError(), void this.setSubmitDisabled(false);
|
|
526
|
+
this.showError(i2.replace("{seconds}", String(t3))), t3 -= 1;
|
|
527
|
+
};
|
|
528
|
+
n2(), this.rateLimitTimer = setInterval(n2, 1e3);
|
|
529
|
+
}
|
|
530
|
+
clearRateLimitTimer() {
|
|
531
|
+
this.rateLimitTimer && (clearInterval(this.rateLimitTimer), this.rateLimitTimer = null);
|
|
532
|
+
}
|
|
533
|
+
storageKey() {
|
|
534
|
+
return `magicfeedback-agent-${this.integrationId}`;
|
|
535
|
+
}
|
|
536
|
+
persist() {
|
|
537
|
+
if (false !== this.formOptionsConfig.resume) try {
|
|
538
|
+
const e3 = { sessionId: this.sessionId, conversation: this.conversation, currentTurn: this.currentTurn, maxTurns: this.maxTurns, askedRefs: this.askedRefs, questionHistory: this.questionHistory, savedAt: Date.now() };
|
|
539
|
+
localStorage.setItem(this.storageKey(), JSON.stringify(e3));
|
|
540
|
+
} catch (e3) {
|
|
541
|
+
this.log.log("Could not persist the agent session", e3);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
restore() {
|
|
545
|
+
var e3;
|
|
546
|
+
try {
|
|
547
|
+
const t3 = localStorage.getItem(this.storageKey());
|
|
548
|
+
if (!t3) return null;
|
|
549
|
+
const i2 = JSON.parse(t3);
|
|
550
|
+
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;
|
|
551
|
+
} catch (e4) {
|
|
552
|
+
return this.log.log("Could not restore the agent session", e4), null;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
clearPersisted() {
|
|
556
|
+
try {
|
|
557
|
+
localStorage.removeItem(this.storageKey());
|
|
558
|
+
} catch (e3) {
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
applyIntegrationContext(e3) {
|
|
562
|
+
var t3, i2;
|
|
563
|
+
(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);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
321
566
|
}, 665: (e2, t2) => {
|
|
322
567
|
"use strict";
|
|
323
568
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.Config = void 0, t2.Config = class {
|
|
@@ -335,14 +580,14 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
335
580
|
"use strict";
|
|
336
581
|
var n = this && this.__awaiter || function(e3, t3, i2, n2) {
|
|
337
582
|
return new (i2 || (i2 = Promise))((function(r2, s2) {
|
|
338
|
-
function
|
|
583
|
+
function o2(e4) {
|
|
339
584
|
try {
|
|
340
585
|
l2(n2.next(e4));
|
|
341
586
|
} catch (e5) {
|
|
342
587
|
s2(e5);
|
|
343
588
|
}
|
|
344
589
|
}
|
|
345
|
-
function
|
|
590
|
+
function a2(e4) {
|
|
346
591
|
try {
|
|
347
592
|
l2(n2.throw(e4));
|
|
348
593
|
} catch (e5) {
|
|
@@ -353,33 +598,48 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
353
598
|
var t4;
|
|
354
599
|
e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
355
600
|
e5(t4);
|
|
356
|
-
}))).then(
|
|
601
|
+
}))).then(o2, a2);
|
|
357
602
|
}
|
|
358
603
|
l2((n2 = n2.apply(e3, t3 || [])).next());
|
|
359
604
|
}));
|
|
360
605
|
};
|
|
361
606
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.Form = void 0;
|
|
362
|
-
const r = i(558), s = i(256), a = i(313),
|
|
607
|
+
const r = i(558), s = i(544), o = i(256), a = i(313), l = i(213), d = i(571), c = i(565), u = i(107), p = i(989), h = i(700), m = i(591), f = i(79), g = i(636);
|
|
363
608
|
t2.Form = class {
|
|
364
609
|
constructor(e3, t3, i2, n2, r2) {
|
|
365
|
-
this.config = e3, this.log = new
|
|
610
|
+
this.config = e3, this.log = new o.Log(e3), this.formOptionsConfig = { addButton: true, sendButtonText: "Send", backButtonText: "Back", nextButtonText: "Next", 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 != n2 ? n2 : [], metrics: [], metadata: null != r2 ? r2 : [] }, 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;
|
|
366
611
|
}
|
|
367
612
|
generate(e3, t3) {
|
|
368
|
-
var i2, r2,
|
|
613
|
+
var i2, r2, o2, l2, d2, c2, u2;
|
|
369
614
|
return n(this, void 0, void 0, (function* () {
|
|
370
615
|
try {
|
|
371
616
|
this.formOptionsConfig = Object.assign(Object.assign({}, this.formOptionsConfig), t3), this.selector = e3;
|
|
372
617
|
let n2 = this.formData;
|
|
373
618
|
if (void 0 !== this.formData && this.formData || (n2 = "" !== this.publicKey ? yield (0, a.getForm)(this.url, this.appId, this.publicKey, this.log) : yield (0, a.getSessionForm)(this.url, this.appId, this.log)), void 0 === n2 || !n2) throw new Error(`No data for app ${this.appId}`);
|
|
374
619
|
if (null === (i2 = n2.error) || void 0 === i2 ? void 0 : i2.message) throw new Error(n2.error.message);
|
|
375
|
-
if (
|
|
620
|
+
if ("AGENT" === n2.mode) return this.agentForm = new s.AgentForm(this.config, this.appId, this.publicKey), this.agentForm.applyIntegrationContext(n2), void (yield this.agentForm.generate(e3, t3));
|
|
621
|
+
if (n2.questions = (null === (r2 = n2.questions) || void 0 === r2 ? void 0 : r2.filter(((e4) => "ACTIVE" === e4.status))) || [], n2.pages = (null === (o2 = n2.pages) || void 0 === o2 ? void 0 : o2.filter(((e4) => "ACTIVE" === e4.status))) || [], null === (l2 = n2.pages) || void 0 === l2 || l2.forEach(((e4) => {
|
|
376
622
|
var t4;
|
|
377
623
|
return e4.integrationQuestions = null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.filter(((e5) => "ACTIVE" === e5.status));
|
|
378
624
|
})), this.formData = n2, 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}`);
|
|
379
|
-
this.formData.pages && 0 !== (null === (
|
|
625
|
+
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) => {
|
|
380
626
|
var t4;
|
|
381
627
|
return (null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.length) > 0;
|
|
382
|
-
})), this.formOptionsConfig.getMetaData && this.getMetaData(), (null === (
|
|
628
|
+
})), 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();
|
|
629
|
+
} catch (e4) {
|
|
630
|
+
return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 })));
|
|
631
|
+
}
|
|
632
|
+
}));
|
|
633
|
+
}
|
|
634
|
+
previewPage(e3, t3, i2 = {}) {
|
|
635
|
+
var r2, s2, o2, a2, l2, d2, c2, u2, p2;
|
|
636
|
+
return n(this, void 0, void 0, (function* () {
|
|
637
|
+
try {
|
|
638
|
+
if (!t3 || !t3.page) throw new Error("[MagicFeedback] No page provided for preview");
|
|
639
|
+
if (!t3.page.integrationQuestions || 0 === t3.page.integrationQuestions.length) throw new Error("[MagicFeedback] No questions provided for preview");
|
|
640
|
+
this.config.set("dryRun", true), this.formOptionsConfig = Object.assign(Object.assign(Object.assign({}, this.formOptionsConfig), { getMetaData: false }), i2), this.selector = e3;
|
|
641
|
+
const n2 = (t3.page.integrationQuestions || []).filter(((e4) => !e4.status || "ACTIVE" === e4.status)).sort(((e4, t4) => e4.position - t4.position)), m2 = new h.Page(null !== (r2 = t3.page.id) && void 0 !== r2 ? r2 : "1", null !== (s2 = t3.page.position) && void 0 !== s2 ? s2 : 1, null !== (o2 = t3.appId) && void 0 !== o2 ? o2 : this.appId, n2, null !== (a2 = t3.page.integrationPageRoutes) && void 0 !== a2 ? a2 : []);
|
|
642
|
+
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: n2, pages: [m2] }, yield this.generateForm();
|
|
383
643
|
} catch (e4) {
|
|
384
644
|
return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 })));
|
|
385
645
|
}
|
|
@@ -391,35 +651,35 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
391
651
|
case "MAGICSURVEY":
|
|
392
652
|
this.formData.pages = [], null === (e3 = this.formData.questions) || void 0 === e3 || e3.forEach(((e4) => {
|
|
393
653
|
var t4, i2;
|
|
394
|
-
const n2 = new
|
|
654
|
+
const n2 = new m.PageRoute(e4.id, e4.ref, m.OperatorType.NOEQUAL, [], m.TransitionType.PAGE, (e4.position + 1).toString(), e4.position.toString()), r2 = new h.Page(e4.position.toString(), e4.position, this.appId, [e4], [n2]);
|
|
395
655
|
null === (i2 = null === (t4 = this.formData) || void 0 === t4 ? void 0 : t4.pages) || void 0 === i2 || i2.push(r2);
|
|
396
656
|
}));
|
|
397
657
|
break;
|
|
398
658
|
case "MAGICFORM":
|
|
399
|
-
const t3 = new
|
|
659
|
+
const t3 = new h.Page("1", 1, this.appId, this.formData.questions, []);
|
|
400
660
|
this.formData.pages = [t3];
|
|
401
661
|
}
|
|
402
662
|
}
|
|
403
663
|
generateContainer() {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
return
|
|
664
|
+
var e3, t3;
|
|
665
|
+
const i2 = (0, c.generateContainer)(this.selector, this.appId), n2 = null === (t3 = null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.style) || void 0 === t3 ? void 0 : t3.primaryColor;
|
|
666
|
+
return n2 && (0, c.applyPrimaryColor)(i2, n2), i2;
|
|
407
667
|
}
|
|
408
668
|
generateForm() {
|
|
409
669
|
var e3, t3, i2, r2;
|
|
410
670
|
return n(this, void 0, void 0, (function* () {
|
|
411
671
|
try {
|
|
412
672
|
if (!this.formData || !this.formData.pages || 0 === this.formData.pages.length) throw new Error("No form data");
|
|
413
|
-
this.graph = new
|
|
673
|
+
this.graph = new p.PageGraph(this.formData.pages.sort(((e4, t4) => e4.position - t4.position)));
|
|
414
674
|
let n2 = this.generateContainer();
|
|
415
675
|
const s2 = document.createElement("form");
|
|
416
676
|
s2.classList.add("magicfeedback-form"), s2.id = "magicfeedback-" + this.appId, s2.addEventListener("submit", ((e4) => e4.preventDefault()));
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
if (!
|
|
421
|
-
if (this.total = this.graph.findMaxDepth(),
|
|
422
|
-
const e4 = (0,
|
|
677
|
+
const o2 = document.createElement("div");
|
|
678
|
+
o2.classList.add("magicfeedback-questions"), o2.id = "magicfeedback-questions-" + this.appId;
|
|
679
|
+
const a2 = this.graph.getFirstPage();
|
|
680
|
+
if (!a2) throw new Error("No page found");
|
|
681
|
+
if (this.total = this.graph.findMaxDepth(), a2.elements = (0, l.renderQuestions)(a2.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 = a2.elements) || void 0 === i2 || i2.forEach(((e4) => o2.appendChild(e4))), s2.appendChild(o2), this.history.enqueue(a2), n2.appendChild(s2), this.progress = this.total - this.graph.findMaxDepth(a2), this.formOptionsConfig.addButton) {
|
|
682
|
+
const e4 = (0, l.renderActions)(null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.identity, (() => this.back()), this.formOptionsConfig.sendButtonText, this.formOptionsConfig.backButtonText, this.formOptionsConfig.nextButtonText);
|
|
423
683
|
s2.appendChild(e4);
|
|
424
684
|
}
|
|
425
685
|
this.formOptionsConfig.addButton && s2.addEventListener("submit", ((e4) => {
|
|
@@ -436,7 +696,7 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
436
696
|
generateWelcomeMessage(e3) {
|
|
437
697
|
return n(this, void 0, void 0, (function* () {
|
|
438
698
|
try {
|
|
439
|
-
const t3 = this.generateContainer(), i2 = (0,
|
|
699
|
+
const t3 = this.generateContainer(), i2 = (0, l.renderStartMessage)(e3, this.formOptionsConfig.addButton, this.formOptionsConfig.startButtonText, (() => this.startForm()));
|
|
440
700
|
t3.appendChild(i2), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, formData: this.formData }));
|
|
441
701
|
} catch (e4) {
|
|
442
702
|
return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
|
|
@@ -451,14 +711,21 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
451
711
|
i2.length > 0 && this.feedback.metadata.push({ key: `query-${t3}`, value: i2 });
|
|
452
712
|
})), 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] });
|
|
453
713
|
}
|
|
454
|
-
send(e3, t3, i2) {
|
|
714
|
+
send(e3, t3, i2, s2) {
|
|
455
715
|
return n(this, void 0, void 0, (function* () {
|
|
716
|
+
if (this.agentForm) return this.agentForm.next();
|
|
456
717
|
const n2 = document.getElementById("magicfeedback-questions-" + this.appId);
|
|
457
718
|
try {
|
|
458
|
-
i2 && (this.feedback.profile = [...this.feedback.profile, ...i2]), t3 && (this.feedback.metrics = [...this.feedback.metrics, ...t3]), e3 && (this.feedback.metadata = [...this.feedback.metadata, ...e3]),
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
719
|
+
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]), s2) {
|
|
720
|
+
this.feedback.answers = [...this.feedback.answers, ...s2], this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
|
|
721
|
+
const e4 = yield this.pushAnswers(false);
|
|
722
|
+
if (!e4) throw new Error("No response");
|
|
723
|
+
return this.id = e4, void (this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total })));
|
|
724
|
+
}
|
|
725
|
+
yield (0, d.awaitUploadReady)(n2), this.answer(), this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
|
|
726
|
+
const o2 = this.history.back();
|
|
727
|
+
if (!o2) throw new Error("No page found");
|
|
728
|
+
for (const e4 of o2.questions.filter(((e5) => e5.require && ![r.FEEDBACKAPPANSWERTYPE.CONSENT, r.FEEDBACKAPPANSWERTYPE.INFO_PAGE].includes(e5.type)))) {
|
|
462
729
|
const t4 = e4.assets, i3 = this.feedback.answers.filter(((t5) => t5.key.includes(e4.ref) && !t5.key.includes("extra-option")));
|
|
463
730
|
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");
|
|
464
731
|
if (null == t4 ? void 0 : t4.minOptions) {
|
|
@@ -489,35 +756,17 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
489
756
|
const e3 = document.getElementById("magicfeedback-" + this.appId);
|
|
490
757
|
if (!e3) return this.log.err(`Form "${e3}" not found.`), this.feedback.answers = [], [];
|
|
491
758
|
const t3 = this.history.back();
|
|
492
|
-
if (!t3)
|
|
493
|
-
const t4 = e3.querySelectorAll(".magicfeedback-input"), i3 = [], n3 = {};
|
|
494
|
-
return t4.forEach(((e4) => {
|
|
495
|
-
var t5;
|
|
496
|
-
const r2 = e4, s3 = r2.name;
|
|
497
|
-
if (!s3) return;
|
|
498
|
-
const a2 = r2.type;
|
|
499
|
-
if (("radio" === a2 || "checkbox" === a2) && !r2.checked) return;
|
|
500
|
-
const o3 = r2.value, l3 = r2.classList[0];
|
|
501
|
-
if ((null == l3 ? void 0 : l3.includes("magicfeedback-priority-list")) || (null === (t5 = r2.id) || void 0 === t5 ? void 0 : t5.startsWith("priority-list-"))) return n3[s3] || (n3[s3] = []), void n3[s3].push(o3);
|
|
502
|
-
const d3 = "magicfeedback-consent" === l3 ? r2.checked.toString() : o3;
|
|
503
|
-
if (null == d3) return;
|
|
504
|
-
const c2 = { key: s3, value: [d3] };
|
|
505
|
-
i3.push(c2);
|
|
506
|
-
})), Object.entries(n3).forEach((([e4, t5]) => {
|
|
507
|
-
const n4 = t5.slice().sort(((e5, t6) => Number(e5.split(".")[0]) - Number(t6.split(".")[0])));
|
|
508
|
-
i3.push({ key: e4, value: n4 });
|
|
509
|
-
})), this.feedback.answers = i3, i3;
|
|
510
|
-
}
|
|
759
|
+
if (!t3) return this.feedback.answers = (0, u.scrapeInputs)(e3), this.feedback.answers;
|
|
511
760
|
const i2 = [];
|
|
512
761
|
let n2 = false;
|
|
513
|
-
const s2 = e3.querySelectorAll(".magicfeedback-input"), o2 = {}, l2 = {},
|
|
762
|
+
const s2 = e3.querySelectorAll(".magicfeedback-input"), o2 = {}, l2 = {}, c2 = {};
|
|
514
763
|
if (s2.forEach(((e4) => {
|
|
515
|
-
const s3 = e4,
|
|
764
|
+
const s3 = e4, u2 = t3.questions.find(((e5) => {
|
|
516
765
|
var t4;
|
|
517
766
|
return null === (t4 = s3.name) || void 0 === t4 ? void 0 : t4.includes(e5.ref);
|
|
518
|
-
})),
|
|
519
|
-
if (
|
|
520
|
-
else switch (null ==
|
|
767
|
+
})), p2 = s3.type, h2 = s3.classList[0], m2 = { key: s3.name, value: [] }, f2 = "magicfeedback-consent" === h2 ? s3.checked.toString() : s3.value;
|
|
768
|
+
if (m2.key && "" !== m2.key) if (m2.key.startsWith("extra-option-")) "" !== f2 && (m2.value.push(f2), i2.push(m2));
|
|
769
|
+
else switch (null == u2 ? void 0 : u2.type) {
|
|
521
770
|
case r.FEEDBACKAPPANSWERTYPE.EMAIL:
|
|
522
771
|
case r.FEEDBACKAPPANSWERTYPE.TEXT:
|
|
523
772
|
case r.FEEDBACKAPPANSWERTYPE.LONGTEXT:
|
|
@@ -525,44 +774,49 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
525
774
|
case r.FEEDBACKAPPANSWERTYPE.DATE:
|
|
526
775
|
case r.FEEDBACKAPPANSWERTYPE.CONTACT:
|
|
527
776
|
case r.FEEDBACKAPPANSWERTYPE.PASSWORD:
|
|
528
|
-
"" !==
|
|
777
|
+
"" !== f2 && ("email" === p2 ? (0, a.validateEmail)(f2) ? (this.feedback.profile.push({ key: "email", value: [f2] }), m2.value.push(f2), i2.push(m2)) : (this.log.err("Invalid email"), n2 = true) : (m2.value.push(f2), i2.push(m2)));
|
|
529
778
|
break;
|
|
530
779
|
case r.FEEDBACKAPPANSWERTYPE.RADIO:
|
|
531
|
-
s3.checked && (
|
|
780
|
+
s3.checked && (m2.value.push(f2), i2.push(m2));
|
|
532
781
|
break;
|
|
533
782
|
case r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE:
|
|
534
783
|
case r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE:
|
|
535
|
-
s3.checked && (l2[
|
|
784
|
+
s3.checked && (l2[m2.key] || (l2[m2.key] = []), l2[m2.key].push(f2));
|
|
536
785
|
break;
|
|
537
786
|
case r.FEEDBACKAPPANSWERTYPE.BOOLEAN:
|
|
538
|
-
s3.checked && (
|
|
787
|
+
s3.checked && (m2.value.push(f2), i2.push(m2));
|
|
539
788
|
break;
|
|
540
789
|
case r.FEEDBACKAPPANSWERTYPE.CONSENT:
|
|
541
|
-
|
|
790
|
+
m2.value.push(s3.checked.toString()), i2.push(m2);
|
|
542
791
|
break;
|
|
543
792
|
case r.FEEDBACKAPPANSWERTYPE.RATING_EMOJI:
|
|
544
793
|
case r.FEEDBACKAPPANSWERTYPE.RATING_NUMBER:
|
|
545
794
|
case r.FEEDBACKAPPANSWERTYPE.RATING_STAR:
|
|
546
|
-
s3.checked && (
|
|
795
|
+
s3.checked && (m2.value.push(f2), i2.push(m2));
|
|
547
796
|
break;
|
|
548
797
|
case r.FEEDBACKAPPANSWERTYPE.SELECT:
|
|
549
|
-
"" !==
|
|
798
|
+
"" !== f2 && (m2.value.push(f2), i2.push(m2));
|
|
550
799
|
break;
|
|
551
800
|
case r.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM:
|
|
552
|
-
"number" ===
|
|
801
|
+
"number" === p2 && s3.id && (c2[m2.key] || (c2[m2.key] = []), "" !== f2 && c2[m2.key].push(`${s3.id}:${f2}%`));
|
|
553
802
|
break;
|
|
554
803
|
case r.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST:
|
|
555
|
-
"hidden" ===
|
|
804
|
+
"hidden" === p2 && (o2[m2.key] || (o2[m2.key] = []), o2[m2.key].push(f2));
|
|
556
805
|
break;
|
|
557
806
|
case r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX:
|
|
558
|
-
e4.checked && (
|
|
807
|
+
e4.checked && (m2.value.push(f2), i2.push(m2));
|
|
808
|
+
break;
|
|
559
809
|
case r.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE:
|
|
560
|
-
case r.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE:
|
|
810
|
+
case r.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE: {
|
|
811
|
+
const e5 = (0, d.getUploadValues)(s3);
|
|
812
|
+
e5.length && (m2.value.push(...e5), i2.push(m2));
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
561
815
|
}
|
|
562
816
|
})), n2) return [];
|
|
563
817
|
Object.entries(l2).forEach((([e4, t4]) => {
|
|
564
818
|
t4 && 0 !== t4.length && i2.push({ key: e4, value: t4 });
|
|
565
|
-
})), Object.entries(
|
|
819
|
+
})), Object.entries(c2).forEach((([e4, t4]) => {
|
|
566
820
|
t4 && 0 !== t4.length && i2.push({ key: e4, value: t4 });
|
|
567
821
|
})), Object.entries(o2).forEach((([e4, t4]) => {
|
|
568
822
|
if (!t4 || 0 === t4.length) return;
|
|
@@ -578,8 +832,8 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
578
832
|
const t5 = i2.findIndex(((t6) => t6.key === e5.key));
|
|
579
833
|
-1 !== t5 && i2.splice(t5, 1);
|
|
580
834
|
}
|
|
581
|
-
const
|
|
582
|
-
-1 !==
|
|
835
|
+
const o3 = i2.findIndex(((t5) => t5.key === e4.ref));
|
|
836
|
+
-1 !== o3 ? i2[o3] = s3 : i2.push(s3);
|
|
583
837
|
}));
|
|
584
838
|
} catch (e4) {
|
|
585
839
|
this.log.err("Error agrupando MULTI_QUESTION_MATRIX", e4);
|
|
@@ -591,7 +845,7 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
591
845
|
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) {
|
|
592
846
|
const e3 = document.getElementById("magicfeedback-container-" + this.appId);
|
|
593
847
|
e3.childNodes.length > 0 && e3.removeChild(e3.childNodes[0]);
|
|
594
|
-
const t3 = (0,
|
|
848
|
+
const t3 = (0, l.renderSuccess)(this.formOptionsConfig.successMessage || "Thank you for your feedback!");
|
|
595
849
|
e3.appendChild(t3);
|
|
596
850
|
}
|
|
597
851
|
this.answer();
|
|
@@ -623,7 +877,6 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
623
877
|
return n(this, void 0, void 0, (function* () {
|
|
624
878
|
if (!(null == e3 ? void 0 : e3.followup)) return null;
|
|
625
879
|
try {
|
|
626
|
-
if (this.config.get("dryRun")) return this.log.log(`Dry run enabled: skipping follow up API for question ${e3.ref}`), null;
|
|
627
880
|
if (0 === this.feedback.answers.length) throw new Error("No answers provided");
|
|
628
881
|
const i2 = this.config.get("url"), n2 = 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 });
|
|
629
882
|
return yield (0, a.getFollowUpQuestion)(i2, n2, this.log);
|
|
@@ -639,66 +892,66 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
639
892
|
if (!n2) throw new Error("No page found");
|
|
640
893
|
const s2 = n2.getFollowupQuestions();
|
|
641
894
|
if (0 === (null == s2 ? void 0 : s2.length)) return void (yield this.renderNextQuestion(e3, n2));
|
|
642
|
-
const
|
|
895
|
+
const o2 = [];
|
|
643
896
|
for (const e4 of s2) {
|
|
644
897
|
const t4 = n2.questions.find(((t5) => t5.ref === e4));
|
|
645
898
|
if (t4) {
|
|
646
899
|
const e5 = yield this.callFollowUpQuestion(t4);
|
|
647
|
-
e5 &&
|
|
900
|
+
e5 && o2.push(e5);
|
|
648
901
|
}
|
|
649
902
|
}
|
|
650
|
-
if (0 ===
|
|
651
|
-
const
|
|
652
|
-
|
|
903
|
+
if (0 === o2.length) return void (yield this.renderNextQuestion(e3, n2));
|
|
904
|
+
const a2 = new h.Page(n2.id, n2.position, this.appId, o2, n2.edges), d2 = new g.PageNode(n2.id, n2.position, n2.edges, a2, o2, true);
|
|
905
|
+
d2.elements = (0, l.renderQuestions)(o2, 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 === (r2 = d2.elements) || void 0 === r2 || r2.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 }));
|
|
653
906
|
}));
|
|
654
907
|
}
|
|
655
908
|
renderNextQuestion(e3, t3) {
|
|
656
|
-
var i2, s2,
|
|
909
|
+
var i2, s2, o2, a2, d2;
|
|
657
910
|
return n(this, void 0, void 0, (function* () {
|
|
658
911
|
let n2 = this.graph.getNextPage(t3, this.feedback.answers);
|
|
659
912
|
if (!n2) return void this.finish();
|
|
660
|
-
const
|
|
661
|
-
if ((null ==
|
|
662
|
-
const t4 =
|
|
663
|
-
let
|
|
664
|
-
for (const t5 of
|
|
665
|
-
let
|
|
913
|
+
const c2 = n2.edges.filter(((e4) => "PRECONDITIONAL" === e4.typeCondition)).sort(((e4, t4) => e4.position < t4.position ? -1 : e4.position > t4.position ? 1 : 0));
|
|
914
|
+
if ((null == c2 ? void 0 : c2.length) > 0) {
|
|
915
|
+
const t4 = c2.some(((e4) => e4.transition === m.TransitionType.ALLOW));
|
|
916
|
+
let o3 = t4;
|
|
917
|
+
for (const t5 of c2) {
|
|
918
|
+
let a3;
|
|
666
919
|
for (let e4 = this.history.size() - 1; e4 >= 0; e4--) {
|
|
667
920
|
const n3 = this.history.get(e4);
|
|
668
|
-
if (n3 && (
|
|
921
|
+
if (n3 && (a3 = null === (i2 = n3.answers) || void 0 === i2 ? void 0 : i2.find(((e5) => e5.key === t5.questionRef)), a3)) break;
|
|
669
922
|
}
|
|
670
|
-
let
|
|
671
|
-
if (
|
|
672
|
-
const e4 = null === (s2 = this.formData) || void 0 === s2 ? void 0 : s2.questions.find(((e5) => e5.ref === t5.questionRef)), i3 = Array.isArray(
|
|
673
|
-
if ((null == e4 ? void 0 : e4.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX)
|
|
923
|
+
let l2 = false;
|
|
924
|
+
if (a3) {
|
|
925
|
+
const e4 = null === (s2 = this.formData) || void 0 === s2 ? void 0 : s2.questions.find(((e5) => e5.ref === t5.questionRef)), i3 = Array.isArray(a3.value) ? a3.value : [a3.value], n3 = Array.isArray(t5.value) ? t5.value : [t5.value];
|
|
926
|
+
if ((null == e4 ? void 0 : e4.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) l2 = this.evaluateMatrixPreconditional(t5, a3);
|
|
674
927
|
else switch (t5.typeOperator) {
|
|
675
928
|
case "EQUAL":
|
|
676
929
|
case "INQ":
|
|
677
|
-
|
|
930
|
+
l2 = i3.some(((e5) => n3.includes(e5)));
|
|
678
931
|
break;
|
|
679
932
|
case "NOEQUAL":
|
|
680
933
|
case "NINQ":
|
|
681
|
-
|
|
934
|
+
l2 = i3.every(((e5) => !n3.includes(e5)));
|
|
682
935
|
break;
|
|
683
936
|
case "GREATER":
|
|
684
|
-
|
|
937
|
+
l2 = i3.some(((e5) => Number(e5) > Number(n3[0])));
|
|
685
938
|
break;
|
|
686
939
|
case "LESS":
|
|
687
|
-
|
|
940
|
+
l2 = i3.some(((e5) => Number(e5) < Number(n3[0])));
|
|
688
941
|
break;
|
|
689
942
|
case "GREATEREQUAL":
|
|
690
|
-
|
|
943
|
+
l2 = i3.some(((e5) => Number(e5) >= Number(n3[0])));
|
|
691
944
|
break;
|
|
692
945
|
case "LESSEQUAL":
|
|
693
|
-
|
|
946
|
+
l2 = i3.some(((e5) => Number(e5) <= Number(n3[0])));
|
|
694
947
|
}
|
|
695
948
|
}
|
|
696
|
-
if (t5.transition ===
|
|
697
|
-
else if (t5.transition ===
|
|
949
|
+
if (t5.transition === m.TransitionType.ALLOW) l2 || (o3 = false);
|
|
950
|
+
else if (t5.transition === m.TransitionType.NEXT && l2) return this.feedback.answers = [], void (n2 && (yield this.renderNextQuestion(e3, n2)));
|
|
698
951
|
}
|
|
699
|
-
if (t4 && !
|
|
952
|
+
if (t4 && !o3) return this.feedback.answers = [], void (n2 && (yield this.renderNextQuestion(e3, n2)));
|
|
700
953
|
}
|
|
701
|
-
n2.elements = (0,
|
|
954
|
+
n2.elements = (0, l.renderQuestions)(n2.questions, this.formOptionsConfig.questionFormat, null === (o2 = this.formData) || void 0 === o2 ? void 0 : o2.lang[0], null === (a2 = this.formData) || void 0 === a2 ? void 0 : a2.product, (() => this.send())), e3.innerHTML = "", null === (d2 = n2.elements) || void 0 === d2 || d2.forEach(((t4) => e3.appendChild(t4))), this.history.enqueue(n2), this.progress = this.total - this.graph.findMaxDepth(n2), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: n2.isFollowup, completed: this.completed, error: null }));
|
|
702
955
|
}));
|
|
703
956
|
}
|
|
704
957
|
back() {
|
|
@@ -712,25 +965,25 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
712
965
|
}));
|
|
713
966
|
}
|
|
714
967
|
previewQuestion(e3, t3, i2) {
|
|
715
|
-
var n2, r2;
|
|
716
|
-
const
|
|
717
|
-
if (!
|
|
968
|
+
var n2, r2, s2;
|
|
969
|
+
const o2 = Array.isArray(t3) ? t3 : [t3];
|
|
970
|
+
if (!o2 || 0 === o2.length) throw new Error("[MagicFeedback] No question provided for preview");
|
|
718
971
|
const a2 = document.getElementById(e3);
|
|
719
972
|
if (!a2) throw new Error(`[MagicFeedback] Element with ID '${e3}' not found.`);
|
|
720
|
-
const { format:
|
|
721
|
-
|
|
722
|
-
let
|
|
973
|
+
const { format: d2 = this.formOptionsConfig.questionFormat || "standard", language: u2 = (null === (n2 = this.formData) || void 0 === n2 ? void 0 : n2.lang) && this.formData.lang[0] || "en", product: p2 = (null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.product) || { customIcons: false }, style: h2 = (null === (s2 = this.formData) || void 0 === s2 ? void 0 : s2.style) || {}, clearContainer: m2 = true, wrap: f2 = true } = i2 || {};
|
|
974
|
+
m2 && (a2.innerHTML = ""), (null == h2 ? void 0 : h2.primaryColor) && (0, c.applyPrimaryColor)(a2, h2.primaryColor);
|
|
975
|
+
let g2 = [];
|
|
723
976
|
try {
|
|
724
|
-
|
|
977
|
+
g2 = (0, l.renderQuestions)(o2, d2, u2, p2);
|
|
725
978
|
} catch (e4) {
|
|
726
979
|
throw this.log.err(e4), e4;
|
|
727
980
|
}
|
|
728
|
-
let
|
|
729
|
-
if (
|
|
981
|
+
let v = a2;
|
|
982
|
+
if (f2) {
|
|
730
983
|
const e4 = document.createElement("div");
|
|
731
|
-
e4.classList.add("magicfeedback-preview-question"),
|
|
984
|
+
e4.classList.add("magicfeedback-preview-question"), v.appendChild(e4), v = e4;
|
|
732
985
|
}
|
|
733
|
-
return
|
|
986
|
+
return g2.forEach(((e4) => v.appendChild(e4))), a2;
|
|
734
987
|
}
|
|
735
988
|
parseMatrixAnswerPre(e3) {
|
|
736
989
|
if (!e3 || !e3.value) return [];
|
|
@@ -814,28 +1067,28 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
814
1067
|
if (!e3) return;
|
|
815
1068
|
e3.edges.sort(((e4, t4) => "DIRECT" === e4.typeCondition ? 1 : "DIRECT" === t4.typeCondition ? -1 : 0));
|
|
816
1069
|
const n2 = e3.edges.find(((i3) => {
|
|
817
|
-
const n3 = e3.questions.find(((e4) => e4.ref === i3.questionRef)),
|
|
1070
|
+
const n3 = e3.questions.find(((e4) => e4.ref === i3.questionRef)), o = null == t3 ? void 0 : t3.filter(((e4) => e4.key === i3.questionRef));
|
|
818
1071
|
if ("DIRECT" === i3.typeCondition) return true;
|
|
819
|
-
if (!
|
|
820
|
-
if ((null == n3 ? void 0 : n3.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) return this.evaluateMatrixCondition(i3,
|
|
821
|
-
const
|
|
1072
|
+
if (!o || 0 === o.length) return false;
|
|
1073
|
+
if ((null == n3 ? void 0 : n3.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) return this.evaluateMatrixCondition(i3, o);
|
|
1074
|
+
const a = Array.isArray(i3.value) ? i3.value : [i3.value];
|
|
822
1075
|
switch (i3.typeOperator) {
|
|
823
1076
|
case s.OperatorType.EQUAL:
|
|
824
|
-
return
|
|
1077
|
+
return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => a.includes(e5)))));
|
|
825
1078
|
case s.OperatorType.NOEQUAL:
|
|
826
|
-
return
|
|
1079
|
+
return o.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !a.includes(e5)))));
|
|
827
1080
|
case s.OperatorType.GREATER:
|
|
828
|
-
return
|
|
1081
|
+
return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => a.some(((t4) => Number(e5) > Number(t4)))))));
|
|
829
1082
|
case s.OperatorType.LESS:
|
|
830
|
-
return
|
|
1083
|
+
return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => a.some(((t4) => Number(e5) < Number(t4)))))));
|
|
831
1084
|
case s.OperatorType.GREATEREQUAL:
|
|
832
|
-
return
|
|
1085
|
+
return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => a.some(((t4) => Number(e5) >= Number(t4)))))));
|
|
833
1086
|
case s.OperatorType.LESSEQUAL:
|
|
834
|
-
return
|
|
1087
|
+
return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => a.some(((t4) => Number(e5) <= Number(t4)))))));
|
|
835
1088
|
case s.OperatorType.INQ:
|
|
836
|
-
return
|
|
1089
|
+
return o.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => a.includes(e5)))));
|
|
837
1090
|
case s.OperatorType.NINQ:
|
|
838
|
-
return
|
|
1091
|
+
return o.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !a.includes(e5)))));
|
|
839
1092
|
default:
|
|
840
1093
|
return false;
|
|
841
1094
|
}
|
|
@@ -872,17 +1125,17 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
872
1125
|
DFSUtil(e3, t3, i2) {
|
|
873
1126
|
t3.add(e3);
|
|
874
1127
|
let n2 = i2;
|
|
875
|
-
const r2 = [...e3.edges.filter(((e4) => e4.typeCondition !== s.ConditionType.PRECONDITIONAL)) || []],
|
|
876
|
-
if (
|
|
877
|
-
const i3 = this.getNodeById(
|
|
1128
|
+
const r2 = [...e3.edges.filter(((e4) => e4.typeCondition !== s.ConditionType.PRECONDITIONAL)) || []], o = this.getNextEdgeByDefault(e3);
|
|
1129
|
+
if (o) {
|
|
1130
|
+
const i3 = this.getNodeById(o);
|
|
878
1131
|
i3 && !t3.has(i3) && r2.push(new s.PageRoute(i3.id, "", s.OperatorType.DEFAULT, [""], s.TransitionType.PAGE, i3.id, e3.id));
|
|
879
1132
|
}
|
|
880
1133
|
for (const e4 of r2) {
|
|
881
1134
|
if (!e4.transitionDestiny) continue;
|
|
882
1135
|
const r3 = this.getNodeById(e4.transitionDestiny);
|
|
883
1136
|
if (r3 && !t3.has(r3)) {
|
|
884
|
-
const e5 = i2 + 1, s2 = new Set(t3),
|
|
885
|
-
n2 = Math.max(n2,
|
|
1137
|
+
const e5 = i2 + 1, s2 = new Set(t3), o2 = this.DFSUtil(r3, s2, e5);
|
|
1138
|
+
n2 = Math.max(n2, o2);
|
|
886
1139
|
}
|
|
887
1140
|
}
|
|
888
1141
|
return n2;
|
|
@@ -898,25 +1151,25 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
898
1151
|
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 : [];
|
|
899
1152
|
}
|
|
900
1153
|
evaluateMatrixCondition(e3, t3) {
|
|
901
|
-
const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), r2 = t3[0],
|
|
902
|
-
if (!a.length) return false;
|
|
903
|
-
const o = n2.size > 0 ? a.filter(((e4) => n2.has(e4.key))) : a;
|
|
1154
|
+
const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), r2 = t3[0], o = this.parseMatrixAnswer(r2);
|
|
904
1155
|
if (!o.length) return false;
|
|
1156
|
+
const a = n2.size > 0 ? o.filter(((e4) => n2.has(e4.key))) : o;
|
|
1157
|
+
if (!a.length) return false;
|
|
905
1158
|
switch (e3.typeOperator) {
|
|
906
1159
|
case s.OperatorType.EQUAL:
|
|
907
1160
|
case s.OperatorType.INQ:
|
|
908
|
-
return
|
|
1161
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.includes(e5)))));
|
|
909
1162
|
case s.OperatorType.NOEQUAL:
|
|
910
1163
|
case s.OperatorType.NINQ:
|
|
911
|
-
return
|
|
1164
|
+
return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !i2.includes(e5)))));
|
|
912
1165
|
case s.OperatorType.GREATER:
|
|
913
|
-
return
|
|
1166
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) > Number(t4)))))));
|
|
914
1167
|
case s.OperatorType.LESS:
|
|
915
|
-
return
|
|
1168
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) < Number(t4)))))));
|
|
916
1169
|
case s.OperatorType.GREATEREQUAL:
|
|
917
|
-
return
|
|
1170
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) >= Number(t4)))))));
|
|
918
1171
|
case s.OperatorType.LESSEQUAL:
|
|
919
|
-
return
|
|
1172
|
+
return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => i2.some(((t4) => Number(e5) <= Number(t4)))))));
|
|
920
1173
|
default:
|
|
921
1174
|
return false;
|
|
922
1175
|
}
|
|
@@ -946,17 +1199,26 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
946
1199
|
})(i = t2.ConditionType || (t2.ConditionType = {})), (r = t2.OperatorType || (t2.OperatorType = {})).EQUAL = "EQUAL", r.NOEQUAL = "NOEQUAL", r.GREATER = "GREATER", r.LESS = "LESS", r.GREATEREQUAL = "GREATEREQUAL", r.LESSEQUAL = "LESSEQUAL", r.INQ = "INQ", r.NINQ = "NINQ", r.DEFAULT = "DEFAULT", (function(e3) {
|
|
947
1200
|
e3.ACTIVE = "ACTIVE", e3.DEPRECATED = "DEPRECATED", e3.DELETE = "DELETE";
|
|
948
1201
|
})(n = t2.StatusType || (t2.StatusType = {})), t2.PageRoute = class {
|
|
949
|
-
constructor(e3, t3, r2, s2,
|
|
950
|
-
this.id = e3, this.questionRef = t3, this.typeCondition = d || i.LOGICAL, this.typeOperator = r2, this.value = s2 || [], this.transition =
|
|
1202
|
+
constructor(e3, t3, r2, s2, o, a, l, d, c, u) {
|
|
1203
|
+
this.id = e3, this.questionRef = t3, this.typeCondition = d || i.LOGICAL, this.typeOperator = r2, this.value = s2 || [], this.transition = o, this.transitionDestiny = a, this.status = n.ACTIVE, this.generatedAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.integrationPageId = l, this.position = c || 0, this.option = u || [];
|
|
951
1204
|
}
|
|
952
1205
|
};
|
|
953
1206
|
}, 558: (e2, t2) => {
|
|
954
1207
|
"use strict";
|
|
955
1208
|
var i, n;
|
|
956
|
-
Object.defineProperty(t2, "__esModule", { value: true }), t2.QuestionType = t2.FEEDBACKAPPANSWERTYPE = void 0, (n = t2.FEEDBACKAPPANSWERTYPE || (t2.FEEDBACKAPPANSWERTYPE = {})).CONTACT = "CONTACT", n.MULTIPLECHOISE_IMAGE = "MULTIPLECHOISE_IMAGE", n.EMAIL = "EMAIL", n.RATING_STAR = "RATING_STAR", n.RADIO = "RADIO", n.MULTIPLECHOICE = "MULTIPLECHOICE", n.SELECT = "SELECT", n.TEXT = "TEXT", n.LONGTEXT = "LONGTEXT", n.NUMBER = "NUMBER", n.RATING_EMOJI = "RATING_EMOJI", n.RATING_NUMBER = "RATING_NUMBER", n.DATE = "DATE", n.BOOLEAN = "BOOLEAN", n.PASSWORD = "PASSWORD", n.CONSENT = "CONSENT", n.MULTI_QUESTION_MATRIX = "MULTI_QUESTION_MATRIX", n.POINT_SYSTEM = "POINT_SYSTEM", n.PRIORITY_LIST = "PRIORITY_LIST", n.INFO_PAGE = "INFO_PAGE", n.UPLOAD_FILE = "UPLOAD_FILE", n.UPLOAD_IMAGE = "UPLOAD_IMAGE", t2.QuestionType = class {
|
|
957
|
-
}, (function(e3) {
|
|
1209
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.AGENT_ANSWER_TYPE_BLOCKED = t2.QuestionType = t2.FEEDBACKAPPANSWERTYPE = void 0, (n = t2.FEEDBACKAPPANSWERTYPE || (t2.FEEDBACKAPPANSWERTYPE = {})).CONTACT = "CONTACT", n.MULTIPLECHOISE_IMAGE = "MULTIPLECHOISE_IMAGE", n.EMAIL = "EMAIL", n.RATING_STAR = "RATING_STAR", n.RADIO = "RADIO", n.MULTIPLECHOICE = "MULTIPLECHOICE", n.SELECT = "SELECT", n.TEXT = "TEXT", n.LONGTEXT = "LONGTEXT", n.NUMBER = "NUMBER", n.RATING_EMOJI = "RATING_EMOJI", n.RATING_NUMBER = "RATING_NUMBER", n.DATE = "DATE", n.BOOLEAN = "BOOLEAN", n.PASSWORD = "PASSWORD", n.CONSENT = "CONSENT", n.MULTI_QUESTION_MATRIX = "MULTI_QUESTION_MATRIX", n.POINT_SYSTEM = "POINT_SYSTEM", n.PRIORITY_LIST = "PRIORITY_LIST", n.INFO_PAGE = "INFO_PAGE", n.UPLOAD_FILE = "UPLOAD_FILE", n.UPLOAD_IMAGE = "UPLOAD_IMAGE", t2.QuestionType = class {
|
|
1210
|
+
}, t2.AGENT_ANSWER_TYPE_BLOCKED = "ABUSIVE_OR_OFFENSIVE", (function(e3) {
|
|
958
1211
|
e3.FORM = "form", e3.DIV = "div";
|
|
959
1212
|
})(i || (i = {}));
|
|
1213
|
+
}, 565: (e2, t2) => {
|
|
1214
|
+
"use strict";
|
|
1215
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.applyPrimaryColor = t2.generateContainer = void 0, t2.generateContainer = function(e3, t3) {
|
|
1216
|
+
let i = document.getElementById(e3);
|
|
1217
|
+
if (!i && (i = document.getElementById("magicfeedback-container-" + t3), !i)) throw new Error(`Element with ID '${e3}' not found.`);
|
|
1218
|
+
return i.classList.add("magicfeedback-container"), i.id = "magicfeedback-container-" + t3, i.innerHTML = "", i;
|
|
1219
|
+
}, t2.applyPrimaryColor = function(e3, t3) {
|
|
1220
|
+
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);
|
|
1221
|
+
};
|
|
960
1222
|
}, 516: (e2, t2) => {
|
|
961
1223
|
"use strict";
|
|
962
1224
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.getUrlParam = t2.getBooleanOptions = t2.parseTitle = void 0, t2.parseTitle = function(e3, t3) {
|
|
@@ -1004,81 +1266,106 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1004
1266
|
};
|
|
1005
1267
|
}, 559: (e2, t2) => {
|
|
1006
1268
|
"use strict";
|
|
1007
|
-
function i(e3, t3, i2
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1013
|
-
return
|
|
1269
|
+
function i(e3, t3, i2 = "ltr") {
|
|
1270
|
+
const n = document.createElement("div");
|
|
1271
|
+
n.classList.add("magicfeedback-rating-placeholder");
|
|
1272
|
+
const r = document.createElement("span");
|
|
1273
|
+
r.textContent = null != e3 ? e3 : "", r.classList.add("magicfeedback-rating-placeholder-value");
|
|
1274
|
+
const s = document.createElement("span");
|
|
1275
|
+
return s.textContent = null != t3 ? t3 : "", s.classList.add("magicfeedback-rating-placeholder-value"), "ltr" === i2 ? (e3 && n.appendChild(r), t3 && n.appendChild(s)) : (t3 && n.appendChild(s), e3 && n.appendChild(r)), n;
|
|
1014
1276
|
}
|
|
1015
1277
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.createRatingNumberElement = t2.createStarRating = t2.createRatingPlaceholder = void 0, t2.createRatingPlaceholder = i, t2.createStarRating = function(e3, t3, n, r = () => {
|
|
1016
1278
|
}, s) {
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1279
|
+
const o = "magicfeedback-rating-star-selected", a = document.createElement("div");
|
|
1280
|
+
a.classList.add("magicfeedback-rating-star-container"), a.style.maxWidth = "300px", a.style.margin = "auto", a.dataset.originalSelection = "0";
|
|
1019
1281
|
for (let t4 = 1; t4 <= 5; t4++) {
|
|
1020
1282
|
const i2 = document.createElement("label");
|
|
1021
1283
|
i2.classList.add("magicfeedback-rating-star-option");
|
|
1022
1284
|
const n2 = document.createElement("input");
|
|
1023
1285
|
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"), s && s === n2.value && (n2.checked = true), n2.addEventListener("change", (() => {
|
|
1024
|
-
const e4 =
|
|
1025
|
-
for (let t5 = 0; t5 < e4.length; t5++) t5 + 1 <= Number(n2.value) ? e4[t5].classList.contains(
|
|
1026
|
-
|
|
1286
|
+
const e4 = a.querySelectorAll(".rating__star");
|
|
1287
|
+
for (let t5 = 0; t5 < e4.length; t5++) t5 + 1 <= Number(n2.value) ? e4[t5].classList.contains(o) || e4[t5].classList.add(o) : e4[t5].classList.contains(o) && e4[t5].classList.remove(o);
|
|
1288
|
+
a.dataset.originalSelection = n2.value, r && r();
|
|
1027
1289
|
})), i2.appendChild(n2);
|
|
1028
1290
|
const l2 = document.createElement("label");
|
|
1029
1291
|
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", (() => {
|
|
1030
|
-
const e4 =
|
|
1292
|
+
const e4 = a.querySelectorAll(".rating__star"), i3 = t4 - 1;
|
|
1031
1293
|
e4.forEach(((e5, t5) => {
|
|
1032
|
-
t5 <= i3 ? e5.classList.contains(
|
|
1294
|
+
t5 <= i3 ? e5.classList.contains(o) || e5.classList.add(o) : e5.classList.contains(o) && e5.classList.remove(o);
|
|
1033
1295
|
}));
|
|
1034
1296
|
})), l2.addEventListener("mouseleave", (() => {
|
|
1035
|
-
const e4 = Number(
|
|
1036
|
-
|
|
1037
|
-
i3 < e4 ? t5.classList.contains(
|
|
1297
|
+
const e4 = Number(a.dataset.originalSelection || "0");
|
|
1298
|
+
a.querySelectorAll(".rating__star").forEach(((t5, i3) => {
|
|
1299
|
+
i3 < e4 ? t5.classList.contains(o) || t5.classList.add(o) : t5.classList.contains(o) && t5.classList.remove(o);
|
|
1038
1300
|
}));
|
|
1039
|
-
})), i2.appendChild(l2),
|
|
1301
|
+
})), i2.appendChild(l2), a.appendChild(i2);
|
|
1302
|
+
}
|
|
1303
|
+
const l = i(t3, n);
|
|
1304
|
+
return l.childElementCount > 0 && a.appendChild(l), a;
|
|
1305
|
+
}, t2.createRatingNumberElement = function(e3, t3, i2, n, r, s, o) {
|
|
1306
|
+
var a, l;
|
|
1307
|
+
const d = document.createElement("div");
|
|
1308
|
+
d.classList.add("magicfeedback-rating-number");
|
|
1309
|
+
const c = "column" === n, u = "ltr" === i2 ? n : `${n}-reverse`, p = document.createElement("div");
|
|
1310
|
+
p.classList.add("magicfeedback-rating-number-container"), p.classList.add(`magicfeedback-rating-number-container-${i2}`), p.classList.add(`magicfeedback-rating-number-container-${n}`), p.style.display = "flex", p.style.flexDirection = u, p.setAttribute("role", "radiogroup"), p.setAttribute("aria-label", (null == t3 ? void 0 : t3.ariaLabel) || "Rating");
|
|
1311
|
+
const h = (null == t3 ? void 0 : t3.max) ? Number(null == t3 ? void 0 : t3.max) : 10, m = (null == t3 ? void 0 : t3.min) ? Number(null == t3 ? void 0 : t3.min) : 0;
|
|
1312
|
+
!c && h - m + 1 > 6 && p.classList.add("magicfeedback-rating-number-container-row--dense");
|
|
1313
|
+
const f = (null == t3 ? void 0 : t3.numberPlaceholders) || null, g = !(!f || !Object.keys(f).length);
|
|
1314
|
+
let v = null;
|
|
1315
|
+
if (!c && ((null == t3 ? void 0 : t3.minPlaceholder) || (null == t3 ? void 0 : t3.maxPlaceholder))) {
|
|
1316
|
+
v = document.createElement("div"), v.classList.add("magicfeedback-rating-number-scale-labels");
|
|
1317
|
+
const e4 = document.createElement("span");
|
|
1318
|
+
e4.classList.add("magicfeedback-rating-number-scale-label"), e4.textContent = null !== (a = null == t3 ? void 0 : t3.minPlaceholder) && void 0 !== a ? a : "";
|
|
1319
|
+
const n2 = document.createElement("span");
|
|
1320
|
+
n2.classList.add("magicfeedback-rating-number-scale-label"), n2.textContent = null !== (l = null == t3 ? void 0 : t3.maxPlaceholder) && void 0 !== l ? l : "", "ltr" === i2 ? (v.appendChild(e4), v.appendChild(n2)) : (v.appendChild(n2), v.appendChild(e4));
|
|
1321
|
+
}
|
|
1322
|
+
let y = null;
|
|
1323
|
+
if (c && !g && (p.classList.add("magicfeedback-rating-number-container-column--bare"), (null == t3 ? void 0 : t3.minPlaceholder) || (null == t3 ? void 0 : t3.maxPlaceholder))) {
|
|
1324
|
+
const e4 = "ltr" === i2 ? null == t3 ? void 0 : t3.minPlaceholder : null == t3 ? void 0 : t3.maxPlaceholder, n2 = "ltr" === i2 ? null == t3 ? void 0 : t3.maxPlaceholder : null == t3 ? void 0 : t3.minPlaceholder;
|
|
1325
|
+
if (e4) {
|
|
1326
|
+
const t4 = document.createElement("div");
|
|
1327
|
+
t4.classList.add("magicfeedback-rating-number-scale-label-block"), t4.textContent = e4, d.appendChild(t4);
|
|
1328
|
+
}
|
|
1329
|
+
n2 && (y = document.createElement("div"), y.classList.add("magicfeedback-rating-number-scale-label-block"), y.textContent = n2);
|
|
1040
1330
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
var d;
|
|
1045
|
-
const c = document.createElement("div");
|
|
1046
|
-
c.classList.add("magicfeedback-rating-number");
|
|
1047
|
-
const u = "ltr" === n ? r : `${r}-reverse`, p = document.createElement("div");
|
|
1048
|
-
p.classList.add("magicfeedback-rating-number-container"), p.classList.add(`magicfeedback-rating-number-container-${n}`), p.classList.add(`magicfeedback-rating-number-container-${r}`), p.style.display = "flex", p.style.flexDirection = u, p.setAttribute("role", "radiogroup"), p.setAttribute("aria-label", (null == t3 ? void 0 : t3.ariaLabel) || "Rating");
|
|
1049
|
-
const m = (null == t3 ? void 0 : t3.max) ? Number(null == t3 ? void 0 : t3.max) : 10, h = (null == t3 ? void 0 : t3.min) ? Number(null == t3 ? void 0 : t3.min) : 0, f = (null == t3 ? void 0 : t3.numberPlaceholders) || null, v = !(s || "column" === r) && ((null == t3 ? void 0 : t3.minPlaceholder) || (null == t3 ? void 0 : t3.maxPlaceholder));
|
|
1050
|
-
if (v) {
|
|
1051
|
-
const e4 = i(h, m, null == t3 ? void 0 : t3.minPlaceholder, null == t3 ? void 0 : t3.maxPlaceholder, null !== (d = null == t3 ? void 0 : t3.extraOption) && void 0 !== d && d, false, n, "row");
|
|
1052
|
-
e4.childElementCount > 0 && (p.classList.add("magicfeedback-rating-number-container--with-placeholder"), p.insertBefore(e4, p.firstChild));
|
|
1053
|
-
}
|
|
1054
|
-
for (let i2 = h; i2 <= m; i2++) {
|
|
1055
|
-
const n2 = document.createElement("div");
|
|
1056
|
-
n2.classList.add("magicfeedback-rating-number-option"), n2.classList.add(`magicfeedback-rating-number-option-${r}`);
|
|
1057
|
-
const d2 = document.createElement("label");
|
|
1058
|
-
d2.htmlFor = `rating-${e3}-${i2}`, d2.classList.add("magicfeedback-rating-number-option-label-container");
|
|
1059
|
-
let c2 = i2.toString();
|
|
1060
|
-
v ? f && f[i2] && !s && (d2.title = f[i2]) : f && f[i2] ? c2 += ` = ${f[i2]}` : i2 === h && (null == t3 ? void 0 : t3.minPlaceholder) ? c2 += ` = ${null == t3 ? void 0 : t3.minPlaceholder}` : i2 === m && (null == t3 ? void 0 : t3.maxPlaceholder) && (c2 += ` = ${null == t3 ? void 0 : t3.maxPlaceholder}`);
|
|
1061
|
-
const u2 = document.createElement("input");
|
|
1062
|
-
u2.id = `rating-${e3}-${i2}`, u2.type = "radio", u2.name = e3, u2.value = i2.toString(), u2.classList.add(a), u2.classList.add("magicfeedback-input"), u2.setAttribute("aria-label", `${i2}`), o && u2.addEventListener("change", (() => o())), l && l === u2.value && (u2.checked = true);
|
|
1063
|
-
const g = document.createElement("label");
|
|
1064
|
-
g.htmlFor = `rating-${e3}-${i2}`, g.textContent = c2, g.classList.add("magicfeedback-rating-number-value"), d2.appendChild(u2), d2.appendChild(g), n2.appendChild(d2), p.appendChild(n2);
|
|
1065
|
-
}
|
|
1066
|
-
if ((null == t3 ? void 0 : t3.extraOption) && (null == t3 ? void 0 : t3.extraOptionText)) {
|
|
1067
|
-
const i2 = document.createElement("div");
|
|
1068
|
-
i2.classList.add("magicfeedback-rating-number-option");
|
|
1069
|
-
const r2 = document.createElement("label");
|
|
1070
|
-
r2.htmlFor = `rating-${e3}-extra`, r2.classList.add("magicfeedback-rating-number-option-label-container");
|
|
1071
|
-
const s2 = document.createElement("input");
|
|
1072
|
-
s2.id = `rating-${e3}-extra`, s2.type = "radio", s2.name = e3, s2.value = "-", s2.classList.add(a), s2.classList.add("magicfeedback-input"), s2.setAttribute("aria-label", null == t3 ? void 0 : t3.extraOptionText), o && s2.addEventListener("change", (() => o()));
|
|
1331
|
+
for (let i3 = m; i3 <= h; i3++) {
|
|
1332
|
+
const a2 = document.createElement("div");
|
|
1333
|
+
a2.classList.add("magicfeedback-rating-number-option"), a2.classList.add(`magicfeedback-rating-number-option-${n}`);
|
|
1073
1334
|
const l2 = document.createElement("label");
|
|
1074
|
-
l2.htmlFor = `rating-${e3}
|
|
1335
|
+
l2.htmlFor = `rating-${e3}-${i3}`, l2.classList.add("magicfeedback-rating-number-option-label-container");
|
|
1336
|
+
const d2 = g && (f[i3] || (i3 === m ? null == t3 ? void 0 : t3.minPlaceholder : void 0) || (i3 === h ? null == t3 ? void 0 : t3.maxPlaceholder : void 0)), u2 = document.createElement("input");
|
|
1337
|
+
u2.id = `rating-${e3}-${i3}`, u2.type = "radio", u2.name = e3, u2.value = i3.toString(), u2.classList.add(r), u2.classList.add("magicfeedback-input"), u2.setAttribute("aria-label", d2 ? `${i3} \u2014 ${d2}` : `${i3}`), s && u2.addEventListener("change", (() => s())), o && o === u2.value && (u2.checked = true), l2.appendChild(u2);
|
|
1338
|
+
const v2 = document.createElement("span");
|
|
1339
|
+
v2.classList.add("magicfeedback-rating-number-value");
|
|
1340
|
+
const y2 = document.createElement("span");
|
|
1341
|
+
if (y2.textContent = i3.toString(), y2.classList.add("magicfeedback-rating-number-value-num"), v2.appendChild(y2), c) {
|
|
1342
|
+
if (d2) {
|
|
1343
|
+
const e4 = document.createElement("span");
|
|
1344
|
+
e4.textContent = d2, e4.classList.add("magicfeedback-rating-number-value-label"), v2.appendChild(e4);
|
|
1345
|
+
}
|
|
1346
|
+
} else f && f[i3] && (l2.title = f[i3]);
|
|
1347
|
+
l2.appendChild(v2), a2.appendChild(l2), p.appendChild(a2);
|
|
1075
1348
|
}
|
|
1076
|
-
|
|
1349
|
+
if (d.appendChild(p), v && d.appendChild(v), y && d.appendChild(y), (null == t3 ? void 0 : t3.extraOption) && (null == t3 ? void 0 : t3.extraOptionText)) {
|
|
1350
|
+
const i3 = document.createElement("div");
|
|
1351
|
+
i3.classList.add("magicfeedback-rating-number-extra-row");
|
|
1352
|
+
const n2 = document.createElement("div");
|
|
1353
|
+
n2.classList.add("magicfeedback-rating-number-option"), n2.classList.add("magicfeedback-rating-number-option--extra");
|
|
1354
|
+
const o2 = document.createElement("label");
|
|
1355
|
+
o2.htmlFor = `rating-${e3}-extra`, o2.classList.add("magicfeedback-rating-number-option-label-container");
|
|
1356
|
+
const a2 = document.createElement("input");
|
|
1357
|
+
a2.id = `rating-${e3}-extra`, a2.type = "radio", a2.name = e3, a2.value = "-", a2.classList.add(r), a2.classList.add("magicfeedback-input"), a2.setAttribute("aria-label", null == t3 ? void 0 : t3.extraOptionText), s && a2.addEventListener("change", (() => s()));
|
|
1358
|
+
const l2 = document.createElement("span");
|
|
1359
|
+
l2.classList.add("magicfeedback-rating-number-value");
|
|
1360
|
+
const c2 = document.createElement("span");
|
|
1361
|
+
c2.textContent = null == t3 ? void 0 : t3.extraOptionText, c2.classList.add("magicfeedback-rating-number-value-label"), l2.appendChild(c2), o2.appendChild(a2), o2.appendChild(l2), n2.appendChild(o2), i3.appendChild(n2), d.appendChild(i3);
|
|
1362
|
+
}
|
|
1363
|
+
return d;
|
|
1077
1364
|
};
|
|
1078
1365
|
}, 42: (e2, t2, i) => {
|
|
1079
1366
|
"use strict";
|
|
1080
1367
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.getQuestionRenderer = void 0;
|
|
1081
|
-
const n = i(558), r = i(998), s = i(72),
|
|
1368
|
+
const n = i(558), r = i(998), s = i(72), o = i(732), a = i(90), l = i(65), d = i(85), c = i(817), u = i(965), p = i(180), h = i(991), m = i(152), f = i(917), g = i(452), v = i(644), y = i(773), b = i(66), E = i(843), A = i(250), k = i(409), C = i(282), T = /* @__PURE__ */ new Map([[n.FEEDBACKAPPANSWERTYPE.TEXT, a.renderText], [n.FEEDBACKAPPANSWERTYPE.LONGTEXT, s.renderLongText], [n.FEEDBACKAPPANSWERTYPE.NUMBER, o.renderNumber], [n.FEEDBACKAPPANSWERTYPE.RADIO, r.renderChoice], [n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE, r.renderChoice], [n.FEEDBACKAPPANSWERTYPE.BOOLEAN, l.renderBoolean], [n.FEEDBACKAPPANSWERTYPE.SELECT, d.renderSelect], [n.FEEDBACKAPPANSWERTYPE.DATE, c.renderDate], [n.FEEDBACKAPPANSWERTYPE.EMAIL, u.renderEmail], [n.FEEDBACKAPPANSWERTYPE.PASSWORD, p.renderPassword], [n.FEEDBACKAPPANSWERTYPE.CONSENT, h.renderConsent], [n.FEEDBACKAPPANSWERTYPE.RATING_EMOJI, m.renderRatingEmoji], [n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER, f.renderRatingNumber], [n.FEEDBACKAPPANSWERTYPE.RATING_STAR, g.renderRatingStar], [n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX, v.renderMatrix], [n.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST, y.renderPriorityList], [n.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM, b.renderPointSystem], [n.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE, E.renderUploadImage], [n.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE, A.renderUploadFile], [n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE, k.renderMultipleChoiceImage], [n.FEEDBACKAPPANSWERTYPE.INFO_PAGE, C.renderInfoPage]]);
|
|
1082
1369
|
t2.getQuestionRenderer = function(e3) {
|
|
1083
1370
|
return T.get(e3);
|
|
1084
1371
|
};
|
|
@@ -1087,59 +1374,59 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1087
1374
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderBoolean = void 0;
|
|
1088
1375
|
const n = i(516);
|
|
1089
1376
|
t2.renderBoolean = ({ question: e3, language: t3, urlParamValue: i2, send: r }) => {
|
|
1090
|
-
const { ref: s, assets:
|
|
1091
|
-
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 ==
|
|
1377
|
+
const { ref: s, assets: o } = e3, a = document.createElement("div"), l = "magicfeedback-radio", d = document.createElement("div");
|
|
1378
|
+
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 == o ? void 0 : o.addIcon) ? ["\u{1F44D}", "\u{1F44E}"] : (0, n.getBooleanOptions)(t3)).forEach(((e4, t4) => {
|
|
1092
1379
|
const n2 = document.createElement("label");
|
|
1093
1380
|
n2.classList.add("magicfeedback-boolean-option"), n2.htmlFor = `rating-${s}-${t4}`, n2.style.cursor = "pointer", n2.style.display = "flex", n2.style.justifyContent = "center", n2.style.alignItems = "center", n2.style.margin = "auto", n2.style.padding = "0", n2.style.width = "45%", n2.style.height = "38px";
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1381
|
+
const o2 = document.createElement("label");
|
|
1382
|
+
o2.htmlFor = `rating-${s}-${t4}`, o2.textContent = e4, o2.style.margin = "0", o2.style.padding = "0";
|
|
1383
|
+
const a2 = document.createElement("input");
|
|
1384
|
+
a2.id = `rating-${s}-${t4}`, a2.type = "radio", a2.name = s, a2.value = ["Yes", "No"][t4], a2.classList.add(l), a2.classList.add("magicfeedback-input"), a2.style.position = "absolute", a2.style.opacity = "0", a2.style.width = "0", a2.style.height = "0", a2.style.margin = "0", a2.addEventListener("change", (() => {
|
|
1098
1385
|
r && r();
|
|
1099
|
-
})), i2 && i2.toLowerCase() ===
|
|
1100
|
-
})),
|
|
1386
|
+
})), i2 && i2.toLowerCase() === a2.value.toLowerCase() && (a2.checked = true), n2.appendChild(a2), n2.appendChild(o2), d.appendChild(n2);
|
|
1387
|
+
})), a.appendChild(d), { element: a, elementTypeClass: l };
|
|
1101
1388
|
};
|
|
1102
1389
|
}, 998: (e2, t2, i) => {
|
|
1103
1390
|
"use strict";
|
|
1104
1391
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderChoice = void 0;
|
|
1105
1392
|
const n = i(558), r = i(784);
|
|
1106
|
-
t2.renderChoice = ({ question: e3, language: t3, urlParamValue: i2, randomPosition: s, send:
|
|
1107
|
-
const { type:
|
|
1108
|
-
let
|
|
1109
|
-
s && (
|
|
1393
|
+
t2.renderChoice = ({ question: e3, language: t3, urlParamValue: i2, randomPosition: s, send: o }) => {
|
|
1394
|
+
const { type: a, ref: l, value: d, defaultValue: c, assets: u } = e3, p = document.createElement("div"), h = "magicfeedback-" + ("MULTIPLECHOICE" === a ? "checkbox" : "radio");
|
|
1395
|
+
let m = d || [];
|
|
1396
|
+
s && (m = m.sort((() => Math.random() - 0.5)));
|
|
1110
1397
|
let f = (null == u ? void 0 : u.exclusiveAnswers) || [];
|
|
1111
1398
|
(null == u ? void 0 : u.extraOption) && (f = f.filter(((e4) => e4 !== u.extraOptionText))), f.length > 0 && (null == f || f.forEach(((e4) => {
|
|
1112
|
-
|
|
1399
|
+
m.includes(e4) || m.push(e4);
|
|
1113
1400
|
})));
|
|
1114
|
-
const
|
|
1115
|
-
return (null == u ? void 0 : u.extraOption) &&
|
|
1401
|
+
const g = null == u ? void 0 : u.extraOptionText;
|
|
1402
|
+
return (null == u ? void 0 : u.extraOption) && g && !m.includes(g) && m.push(g), m.forEach(((e4, s2) => {
|
|
1116
1403
|
const d2 = document.createElement("div");
|
|
1117
|
-
d2.classList.add(`magicfeedback-${"MULTIPLECHOICE" ===
|
|
1118
|
-
const
|
|
1119
|
-
if (
|
|
1120
|
-
document.querySelectorAll(`input[name="${l}"]:checked`).length > (null == u ? void 0 : u.maxOptions) && (
|
|
1121
|
-
})),
|
|
1122
|
-
|
|
1123
|
-
})), e4 !== c && e4 !== i2 || (
|
|
1404
|
+
d2.classList.add(`magicfeedback-${"MULTIPLECHOICE" === a ? "checkbox" : "radio"}-container`);
|
|
1405
|
+
const g2 = document.createElement("label"), v = document.createElement("input");
|
|
1406
|
+
if (v.id = `rating-${l}-${s2}`, v.type = "MULTIPLECHOICE" === a ? "checkbox" : "radio", v.name = l, v.value = e4, v.classList.add(h), v.classList.add("magicfeedback-input"), a === n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE && (null == u ? void 0 : u.maxOptions) && (null == u ? void 0 : u.maxOptions) > 0 && v.addEventListener("change", (() => {
|
|
1407
|
+
document.querySelectorAll(`input[name="${l}"]:checked`).length > (null == u ? void 0 : u.maxOptions) && (v.checked = false);
|
|
1408
|
+
})), a === n.FEEDBACKAPPANSWERTYPE.RADIO && o && (!(null == u ? void 0 : u.extraOptionText) || (null == u ? void 0 : u.extraOptionText) && e4 !== (null == u ? void 0 : u.extraOptionText)) && v.addEventListener("change", (() => {
|
|
1409
|
+
o();
|
|
1410
|
+
})), e4 !== c && e4 !== i2 || (v.checked = true), g2.textContent = e4, g2.htmlFor = `rating-${l}-${s2}`, v.addEventListener("change", ((t4) => {
|
|
1124
1411
|
const i3 = document.getElementById(`extra-option-${l}`);
|
|
1125
|
-
t4.target.checked && f.includes(e4) ? (
|
|
1412
|
+
t4.target.checked && f.includes(e4) ? (m.forEach(((t5) => {
|
|
1126
1413
|
t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
|
|
1127
1414
|
})), i3 && (i3.style.display = "none")) : f.forEach(((t5) => {
|
|
1128
1415
|
t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
|
|
1129
1416
|
})), (null == u ? void 0 : u.extraOption) && e4 === (null == u ? void 0 : u.extraOptionText) && i3 && (i3.style.display = t4.target.checked ? "block" : "none");
|
|
1130
|
-
})), d2.appendChild(
|
|
1417
|
+
})), d2.appendChild(v), d2.appendChild(g2), p.appendChild(d2), (null == u ? void 0 : u.extraOption) && e4 === (null == u ? void 0 : u.extraOptionText)) {
|
|
1131
1418
|
const e5 = document.createElement("input");
|
|
1132
1419
|
e5.type = "text", e5.placeholder = (null == u ? void 0 : u.extraOptionPlaceholder) || r.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);
|
|
1133
1420
|
}
|
|
1134
|
-
})), { element: p, elementTypeClass:
|
|
1421
|
+
})), { element: p, elementTypeClass: h };
|
|
1135
1422
|
};
|
|
1136
1423
|
}, 991: (e2, t2) => {
|
|
1137
1424
|
"use strict";
|
|
1138
1425
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderConsent = void 0, t2.renderConsent = ({ question: e3, urlParamValue: t3, send: i }) => {
|
|
1139
|
-
const { id: n, ref: r, value: s, require:
|
|
1140
|
-
return
|
|
1426
|
+
const { id: n, ref: r, value: s, require: o } = e3, a = document.createElement("input");
|
|
1427
|
+
return a.type = "checkbox", a.id = `magicfeedback-${n}`, a.name = r, a.value = "true", a.required = o, a.classList.add("magicfeedback-consent"), a.classList.add("magicfeedback-input"), t3 && s.includes(t3) && (a.checked = true), i && a.addEventListener("change", (() => {
|
|
1141
1428
|
i();
|
|
1142
|
-
})), { element:
|
|
1429
|
+
})), { element: a, elementTypeClass: "magicfeedback-consent" };
|
|
1143
1430
|
};
|
|
1144
1431
|
}, 817: (e2, t2, i) => {
|
|
1145
1432
|
"use strict";
|
|
@@ -1177,8 +1464,8 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1177
1464
|
}, 644: (e2, t2) => {
|
|
1178
1465
|
"use strict";
|
|
1179
1466
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMatrix = void 0, t2.renderMatrix = ({ question: e3, isPhone: t3, randomPosition: i }) => {
|
|
1180
|
-
const { ref: n, value: r, assets: s } = e3,
|
|
1181
|
-
|
|
1467
|
+
const { ref: n, value: r, assets: s } = e3, o = document.createElement("div"), a = document.createElement("div");
|
|
1468
|
+
a.classList.add("magicfeedback-multi-question-matrix-container");
|
|
1182
1469
|
let l = (null == s ? void 0 : s.options) || [], d = [...r], c = [];
|
|
1183
1470
|
if (i && (l = null == l ? void 0 : l.sort((() => Math.random() - 0.5)), d = [...d].sort((() => Math.random() - 0.5))), (null == s ? void 0 : s.exclusiveAnswers) && (c = null == s ? void 0 : s.exclusiveAnswers, null == c || c.forEach(((e4) => {
|
|
1184
1471
|
d.includes(e4) || d.push(e4);
|
|
@@ -1191,10 +1478,10 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1191
1478
|
r2.classList.add("magicfeedback-multi-question-matrix-label"), r2.style.paddingBottom = "10px", r2.textContent = t4, i2.appendChild(r2), d.forEach(((e5) => {
|
|
1192
1479
|
const r3 = document.createElement("div");
|
|
1193
1480
|
r3.classList.add("magicfeedback-radio-container"), r3.style.display = "flex", r3.style.alignItems = "center", r3.style.justifyContent = "flex-start", r3.style.width = "99%", r3.style.margin = "5px auto";
|
|
1194
|
-
const s2 = document.createElement("label"),
|
|
1195
|
-
|
|
1481
|
+
const s2 = document.createElement("label"), o2 = document.createElement("input");
|
|
1482
|
+
o2.id = `${n}-${t4}-${e5}`, o2.type = "radio", o2.name = `${n}-${t4}`, o2.value = e5, o2.classList.add("magicfeedback-input"), s2.textContent = e5, s2.htmlFor = `${n}-${t4}-${e5}`, r3.appendChild(o2), r3.appendChild(s2), i2.appendChild(r3);
|
|
1196
1483
|
})), e4.appendChild(i2);
|
|
1197
|
-
})),
|
|
1484
|
+
})), a.appendChild(e4);
|
|
1198
1485
|
} else {
|
|
1199
1486
|
const e4 = document.createElement("table");
|
|
1200
1487
|
e4.classList.add("magicfeedback-multi-question-matrix-table");
|
|
@@ -1216,18 +1503,18 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1216
1503
|
const r4 = document.createElement("td"), s3 = document.createElement("input");
|
|
1217
1504
|
s3.type = "radio", s3.name = `${n}-${e5}`, s3.value = i4, s3.id = `${n}-${e5}-${i4}`, s3.classList.add("magicfeedback-input"), r4.appendChild(s3), t5.appendChild(r4);
|
|
1218
1505
|
})), s2.appendChild(t5);
|
|
1219
|
-
})), e4.appendChild(s2),
|
|
1506
|
+
})), e4.appendChild(s2), a.appendChild(e4);
|
|
1220
1507
|
}
|
|
1221
|
-
return
|
|
1508
|
+
return o.appendChild(a), { element: o, elementTypeClass: "magicfeedback-multi-question-matrix" };
|
|
1222
1509
|
};
|
|
1223
1510
|
}, 409: (e2, t2) => {
|
|
1224
1511
|
"use strict";
|
|
1225
1512
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMultipleChoiceImage = void 0, t2.renderMultipleChoiceImage = ({ question: e3, randomPosition: t3, urlParamValue: i, send: n }) => {
|
|
1226
|
-
const r = document.createElement("div"), { ref: s, assets:
|
|
1227
|
-
let
|
|
1513
|
+
const r = document.createElement("div"), { ref: s, assets: o } = e3;
|
|
1514
|
+
let a = [...e3.value];
|
|
1228
1515
|
const l = document.createElement("div");
|
|
1229
1516
|
l.classList.add("magicfeedback-multiple-choice-image-container"), l.style.display = "flex", l.style.flexDirection = "row", l.style.flexWrap = "wrap", l.style.justifyContent = "center";
|
|
1230
|
-
const d =
|
|
1517
|
+
const d = a.length;
|
|
1231
1518
|
let c = 1, u = 1;
|
|
1232
1519
|
if (window.innerWidth < 600) c = 1, u = d;
|
|
1233
1520
|
else switch (d) {
|
|
@@ -1249,38 +1536,38 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1249
1536
|
default:
|
|
1250
1537
|
u = 4, c = Math.ceil(d / u);
|
|
1251
1538
|
}
|
|
1252
|
-
const p = void 0 !== (null ==
|
|
1539
|
+
const p = void 0 !== (null == o ? void 0 : o.addTitle) && (null == o ? void 0 : o.addTitle), h = void 0 !== (null == o ? void 0 : o.multiOption) && (null == o ? void 0 : o.multiOption), m = void 0 !== (null == o ? void 0 : o.extraOption) && (null == o ? void 0 : o.extraOption);
|
|
1253
1540
|
function f(e4) {
|
|
1254
1541
|
try {
|
|
1255
|
-
const { position: t4, url: r2, value:
|
|
1256
|
-
|
|
1542
|
+
const { position: t4, url: r2, value: o2 } = e4, a2 = document.createElement("div");
|
|
1543
|
+
a2.classList.add("magicfeedback-multiple-choice-image-option"), a2.style.width = `calc(100% / ${c} - 2px)`, a2.style.height = `calc(100% / ${u} - 2px)`, a2.style.padding = "8px", a2.style.margin = "0";
|
|
1257
1544
|
const d2 = document.createElement("label");
|
|
1258
1545
|
d2.classList.add("magicfeedback-image-option-label-container"), d2.htmlFor = `rating-${s}-${t4}`, d2.style.cursor = "pointer", d2.addEventListener("click", (() => {
|
|
1259
1546
|
d2.style.border = "2px solid #000";
|
|
1260
1547
|
}));
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1548
|
+
const m2 = document.createElement("label");
|
|
1549
|
+
m2.textContent = o2, m2.classList.add("magicfeedback-multiple-choice-image-label");
|
|
1263
1550
|
const f2 = document.createElement("input");
|
|
1264
|
-
f2.id = `rating-${s}-${t4}`, f2.type =
|
|
1551
|
+
f2.id = `rating-${s}-${t4}`, f2.type = h ? "checkbox" : "radio", f2.name = s, f2.value = o2, 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), !h && n && f2.addEventListener("change", (() => {
|
|
1265
1552
|
n();
|
|
1266
1553
|
}));
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1554
|
+
const g = document.createElement("img");
|
|
1555
|
+
g.classList.add("magicfeedback-multiple-choice-image-image"), g.src = r2, 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(m2), a2.appendChild(d2), l.appendChild(a2);
|
|
1269
1556
|
} catch (e5) {
|
|
1270
1557
|
console.error(e5);
|
|
1271
1558
|
}
|
|
1272
1559
|
}
|
|
1273
|
-
return t3 && (
|
|
1560
|
+
return t3 && (a = a.sort((() => Math.random() - 0.5))), a.forEach(((e4) => f(JSON.parse(e4)))), m && (null == o ? void 0 : o.extraOptionValue) && (null == o ? void 0 : o.extraOptionValue.length) > 0 && f(null == o ? void 0 : o.extraOptionValue[0]), r.appendChild(l), { element: r, elementTypeClass: "magicfeedback-multiple-choice-image" };
|
|
1274
1561
|
};
|
|
1275
1562
|
}, 732: (e2, t2, i) => {
|
|
1276
1563
|
"use strict";
|
|
1277
1564
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderNumber = void 0;
|
|
1278
1565
|
const n = i(784), r = i(516);
|
|
1279
1566
|
t2.renderNumber = ({ question: e3, format: t3, language: i2, urlParamValue: s }) => {
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1282
|
-
const { value:
|
|
1283
|
-
return
|
|
1567
|
+
const o = document.createElement("input");
|
|
1568
|
+
o.type = "number", o.placeholder = "slim" === t3 ? (0, r.parseTitle)(e3.title, i2) : n.placeholder.number(i2 || "en");
|
|
1569
|
+
const { value: a } = e3;
|
|
1570
|
+
return a.length && (a.sort(((e4, t4) => Number(e4) - Number(t4))), o.max = a[a.length - 1], o.min = a[0], o.value = a[0]), s && !isNaN(Number(s)) && (o.value = s), { element: o, elementTypeClass: "magicfeedback-number" };
|
|
1284
1571
|
};
|
|
1285
1572
|
}, 180: (e2, t2, i) => {
|
|
1286
1573
|
"use strict";
|
|
@@ -1295,10 +1582,10 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1295
1582
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPointSystem = void 0;
|
|
1296
1583
|
const n = i(784);
|
|
1297
1584
|
t2.renderPointSystem = ({ question: e3, language: t3 }) => {
|
|
1298
|
-
const { ref: i2, value: r } = e3, s = document.createElement("div"),
|
|
1299
|
-
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1585
|
+
const { ref: i2, value: r } = e3, s = document.createElement("div"), o = document.createElement("div");
|
|
1586
|
+
o.classList.add("magicfeedback-point-system-container");
|
|
1587
|
+
const a = document.createElement("ul");
|
|
1588
|
+
a.classList.add("magicfeedback-point-system-list"), a.style.padding = "0";
|
|
1302
1589
|
const l = 100 / r.length, d = document.createElement("div");
|
|
1303
1590
|
d.classList.add("magicfeedback-error"), d.textContent = n.placeholder.pointsystemerror(t3 || "en"), d.style.color = "#C70039", d.style.fontSize = "14px", d.style.textAlign = "right", d.style.width = "100%", d.style.display = "none";
|
|
1304
1591
|
const c = document.createElement("div");
|
|
@@ -1309,108 +1596,108 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1309
1596
|
r2.textContent = e4, r2.style.fontSize = "15px", n2.appendChild(r2);
|
|
1310
1597
|
const s2 = document.createElement("span");
|
|
1311
1598
|
s2.classList.add("magicfeedback-point-system-input-container");
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1599
|
+
const o2 = document.createElement("input");
|
|
1600
|
+
o2.name = i2, o2.id = `${e4}`, o2.type = "number", o2.min = "0", o2.max = "100", o2.value = "0", o2.classList.add("magicfeedback-input"), o2.style.width = "40px", o2.style.border = "0", o2.style.textAlign = "center", o2.style.margin = "0 5px", o2.autofocus = 0 === t4;
|
|
1314
1601
|
const u = document.createElement("span");
|
|
1315
|
-
u.textContent = "%", u.style.color = "#000",
|
|
1316
|
-
const e5 =
|
|
1602
|
+
u.textContent = "%", u.style.color = "#000", o2.addEventListener("input", (() => {
|
|
1603
|
+
const e5 = a.querySelectorAll("input");
|
|
1317
1604
|
let t5 = 0;
|
|
1318
1605
|
e5.forEach(((e6) => {
|
|
1319
1606
|
t5 += Number(e6.value);
|
|
1320
|
-
})), t5 > 100 && (
|
|
1607
|
+
})), t5 > 100 && (o2.value = `${l}%`, t5 -= Number(o2.value));
|
|
1321
1608
|
const i3 = document.getElementById("magicfeedback-submit");
|
|
1322
1609
|
i3 && (t5 < 100 ? (c.style.color = "orange", i3.setAttribute("disabled", "true")) : (d.style.display = "none", c.style.color = "green", i3.removeAttribute("disabled"))), c.textContent = `${t5} / 100 %`;
|
|
1323
|
-
})),
|
|
1610
|
+
})), o2.addEventListener("focus", (() => {
|
|
1324
1611
|
const e5 = document.getElementById("magicfeedback-submit");
|
|
1325
1612
|
e5 && (e5.setAttribute("disabled", "true"), e5.addEventListener("pointerover", (() => {
|
|
1326
|
-
const e6 =
|
|
1613
|
+
const e6 = a.querySelectorAll("input");
|
|
1327
1614
|
let t5 = 0;
|
|
1328
1615
|
e6.forEach(((e7) => {
|
|
1329
1616
|
t5 += Number(e7.value);
|
|
1330
1617
|
})), t5 < 100 && (d.style.display = "block");
|
|
1331
1618
|
})));
|
|
1332
|
-
})), s2.appendChild(
|
|
1333
|
-
})),
|
|
1619
|
+
})), s2.appendChild(o2), s2.appendChild(u), n2.appendChild(s2), a.appendChild(n2);
|
|
1620
|
+
})), o.appendChild(a), o.appendChild(c), o.appendChild(d), s.appendChild(o), { element: s, elementTypeClass: "magicfeedback-point-system" };
|
|
1334
1621
|
};
|
|
1335
1622
|
}, 773: (e2, t2) => {
|
|
1336
1623
|
"use strict";
|
|
1337
1624
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPriorityList = void 0, t2.renderPriorityList = ({ question: e3, randomPosition: t3, language: i }) => {
|
|
1338
1625
|
var n, r, s;
|
|
1339
|
-
const
|
|
1340
|
-
const { value: t4, ref: i2, randomPosition: n2 = false, limitPriority: r2 = false, maxPriority: s2 = 0, language:
|
|
1626
|
+
const o = document.createElement("div"), a = (function(e4) {
|
|
1627
|
+
const { value: t4, ref: i2, randomPosition: n2 = false, limitPriority: r2 = false, maxPriority: s2 = 0, language: o2 = "en", placeholder: a2 = "" } = e4, l = (e5) => {
|
|
1341
1628
|
const t5 = { en: { selectUpTo: "Select up to", options: "options", thenOrder: "and then order them", selectOptions: "Select options", cancel: "Cancel", confirm: "Confirm", selectOptionNumber: "Select option #", prioritized: "Prioritized", of: "of", 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." }, es: { selectUpTo: "Selecciona hasta", options: "opciones", thenOrder: "y luego ord\xE9nalas", selectOptions: "Seleccionar opciones", cancel: "Cancelar", confirm: "Confirmar", selectOptionNumber: "Selecciona la opci\xF3n #", prioritized: "Priorizadas", of: "de", instruction: 'Tu lista priorizada se muestra abajo. Si deseas, puedes reordenar las opciones con las flechas. Haz clic en "Siguiente" para confirmar y continuar.' }, pt: { selectUpTo: "Selecione at\xE9", options: "op\xE7\xF5es", thenOrder: "e depois ordene-as", selectOptions: "Selecionar op\xE7\xF5es", cancel: "Cancelar", confirm: "Confirmar", selectOptionNumber: "Selecione a op\xE7\xE3o #", prioritized: "Priorizadas", of: "de", 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.' }, fr: { selectUpTo: "S\xE9lectionnez jusqu'\xE0", options: "options", thenOrder: "puis classez-les", selectOptions: "S\xE9lectionner des options", cancel: "Annuler", confirm: "Confirmer", selectOptionNumber: "S\xE9lectionnez l'option #", prioritized: "Prioris\xE9es", of: "sur", 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.` }, de: { selectUpTo: "W\xE4hlen Sie bis zu", options: "Optionen", thenOrder: "und ordnen Sie sie dann", selectOptions: "Optionen ausw\xE4hlen", cancel: "Abbrechen", confirm: "Best\xE4tigen", selectOptionNumber: "W\xE4hlen Sie Option #", prioritized: "Priorisiert", of: "von", 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.' }, it: { selectUpTo: "Seleziona fino a", options: "opzioni", thenOrder: "e poi ordinali", selectOptions: "Seleziona opzioni", cancel: "Annulla", confirm: "Conferma", selectOptionNumber: "Seleziona opzione #", prioritized: "Prioritizzate", of: "di", 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: { selectUpTo: "Selecteer tot", options: "opties", thenOrder: "en rangschik ze vervolgens", selectOptions: "Selecteer opties", cancel: "Annuleren", confirm: "Bevestigen", selectOptionNumber: "Selecteer optie #", prioritized: "Geprioriteerd", of: "van", 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: { selectUpTo: "Wybierz do", options: "opcje", thenOrder: "a nast\u0119pnie je uporz\u0105dkuj", selectOptions: "Wybierz opcje", cancel: "Anuluj", confirm: "Potwierd\u017A", selectOptionNumber: "Wybierz opcj\u0119 #", prioritized: "Priorytetowe", of: "z", 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: { selectUpTo: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043E", options: "\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432", thenOrder: "\u0430 \u0437\u0430\u0442\u0435\u043C \u0443\u043F\u043E\u0440\u044F\u0434\u043E\u0447\u044C\u0442\u0435 \u0438\u0445", selectOptions: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B", cancel: "\u041E\u0442\u043C\u0435\u043D\u0430", confirm: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C", selectOptionNumber: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442 #", prioritized: "\u041F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u044B", of: "\u0438\u0437", 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: { selectUpTo: "\u6700\u5927", options: "\u500B\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", thenOrder: "\u305D\u306E\u5F8C\u4E26\u3079\u66FF\u3048\u3066\u304F\u3060\u3055\u3044", selectOptions: "\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB", confirm: "\u78BA\u8A8D", selectOptionNumber: "\u30AA\u30D7\u30B7\u30E7\u30F3 # \u3092\u9078\u629E", prioritized: "\u512A\u5148\u9806\u4F4D", of: "\u306E\u3046\u3061", 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: { selectUpTo: "\u6700\u591A\u9009\u62E9", options: "\u4E2A\u9009\u9879", thenOrder: "\u7136\u540E\u6392\u5E8F\u5B83\u4EEC", selectOptions: "\u9009\u62E9\u9009\u9879", cancel: "\u53D6\u6D88", confirm: "\u786E\u8BA4", selectOptionNumber: "\u9009\u62E9\u9009\u9879 #", prioritized: "\u5DF2\u4F18\u5148", of: "\u5171", 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: { selectUpTo: "\uCD5C\uB300", options: "\uAC1C\uC758 \uC635\uC158 \uC120\uD0DD", thenOrder: "\uADF8\uB7F0 \uB2E4\uC74C \uC815\uB82C\uD558\uC138\uC694", selectOptions: "\uC635\uC158 \uC120\uD0DD", cancel: "\uCDE8\uC18C", confirm: "\uD655\uC778", selectOptionNumber: "\uC635\uC158 # \uC120\uD0DD", prioritized: "\uC6B0\uC120\uC21C\uC704", of: "\uC911", 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.' }, ar: { selectUpTo: "\u0627\u062E\u062A\u0631 \u062D\u062A\u0649", options: "\u062E\u064A\u0627\u0631\u0627\u062A", thenOrder: "\u062B\u0645 \u0631\u062A\u0628\u0647\u0627", selectOptions: "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A", cancel: "\u0625\u0644\u063A\u0627\u0621", confirm: "\u062A\u0623\u0643\u064A\u062F", selectOptionNumber: "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631 #", prioritized: "\u062A\u0645 \u0627\u0644\u062A\u0631\u062A\u064A\u0628", of: "\u0645\u0646", 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.' }, bn: { selectUpTo: "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", options: "\u099F\u09BF \u09AC\u09BF\u0995\u09B2\u09CD\u09AA", thenOrder: "\u09A4\u09BE\u09B0\u09AA\u09B0 \u09B8\u09C7\u0997\u09C1\u09B2\u09CB \u09B8\u09BE\u099C\u09BE\u09A8", selectOptions: "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", cancel: "\u09AC\u09BE\u09A4\u09BF\u09B2", confirm: "\u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4 \u0995\u09B0\u09C1\u09A8", selectOptionNumber: "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA # \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", prioritized: "\u0985\u0997\u09CD\u09B0\u09BE\u09A7\u09BF\u0995\u09BE\u09B0\u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4", of: "\u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7", 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 \u201C\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0\u201D \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" }, da: { selectUpTo: "V\xE6lg op til", options: "muligheder", thenOrder: "og sorter dem derefter", selectOptions: "V\xE6lg muligheder", cancel: "Annuller", confirm: "Bekr\xE6ft", selectOptionNumber: "V\xE6lg mulighed #", prioritized: "Prioriteret", of: "af", 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.' }, fi: { selectUpTo: "Valitse enint\xE4\xE4n", options: "vaihtoehtoa", thenOrder: "ja j\xE4rjest\xE4 ne sitten", selectOptions: "Valitse vaihtoehdot", cancel: "Peruuta", confirm: "Vahvista", selectOptionNumber: "Valitse vaihtoehto #", prioritized: "Priorisoitu", of: " / ", instruction: 'Prioriteettilistasi n\xE4kyy alla. Voit halutessasi j\xE4rjest\xE4\xE4 valinnat uudelleen nuolien avulla. Napsauta "Seuraava" vahvistaaksesi valinnan ja jatkaaksesi.' }, sv: { selectUpTo: "V\xE4lj upp till", options: "alternativ", thenOrder: "och ordna dem sedan", selectOptions: "V\xE4lj alternativ", cancel: "Avbryt", confirm: "Bekr\xE4fta", selectOptionNumber: "V\xE4lj alternativ #", prioritized: "Prioriterat", of: "av", 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.' }, no: { selectUpTo: "Velg opptil", options: "alternativer", thenOrder: "og ordne dem deretter", selectOptions: "Velg alternativer", cancel: "Avbryt", confirm: "Bekreft", selectOptionNumber: "Velg alternativ #", prioritized: "Prioritert", of: "av", 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.' } };
|
|
1342
|
-
return t5[t5[
|
|
1629
|
+
return t5[t5[o2] ? o2 : "en"][e5];
|
|
1343
1630
|
}, d = document.createElement("div");
|
|
1344
1631
|
if (d.classList.add("magicfeedback-priority-list-container"), r2 && s2 && s2 > 0) {
|
|
1345
1632
|
const e5 = [], r3 = document.createElement("div");
|
|
1346
1633
|
r3.classList.add("magicfeedback-priority-list-header");
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1634
|
+
const o3 = document.createElement("div");
|
|
1635
|
+
o3.classList.add("magicfeedback-priority-list-instruction"), o3.textContent = "" !== a2 ? a2 : `${l("instruction")}`, o3.style.display = "none";
|
|
1349
1636
|
const c2 = document.createElement("button");
|
|
1350
|
-
c2.type = "button", c2.textContent = l("selectOptions"), c2.classList.add("magicfeedback-button"), c2.classList.add("magicfeedback-priority-list-open-btn"), r3.appendChild(c2), r3.appendChild(
|
|
1637
|
+
c2.type = "button", c2.textContent = l("selectOptions"), c2.classList.add("magicfeedback-button"), c2.classList.add("magicfeedback-priority-list-open-btn"), r3.appendChild(c2), r3.appendChild(o3);
|
|
1351
1638
|
const u2 = document.createElement("div");
|
|
1352
1639
|
u2.classList.add("magicfeedback-priority-list-reorder");
|
|
1353
1640
|
const p = document.createElement("ul");
|
|
1354
1641
|
p.classList.add("magicfeedback-priority-list-list"), u2.appendChild(p);
|
|
1355
|
-
const
|
|
1642
|
+
const h = () => {
|
|
1356
1643
|
p.innerHTML = "", e5.forEach(((t5, n3) => {
|
|
1357
1644
|
const r4 = document.createElement("li");
|
|
1358
1645
|
r4.classList.add("magicfeedback-priority-list-item");
|
|
1359
1646
|
const s3 = document.createElement("input");
|
|
1360
1647
|
s3.classList.add("magicfeedback-input-magicfeedback-priority-list"), s3.classList.add("magicfeedback-input"), s3.type = "hidden", s3.id = `priority-list-${i2}`, s3.name = i2, s3.value = `${n3 + 1}. ${t5}`, r4.appendChild(s3);
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1648
|
+
const o4 = document.createElement("label");
|
|
1649
|
+
o4.classList.add("magicfeedback-priority-list-item-label"), o4.textContent = `${n3 + 1}. ${t5}`, r4.appendChild(o4);
|
|
1650
|
+
const a3 = document.createElement("div");
|
|
1651
|
+
a3.classList.add("magicfeedback-priority-list-arrows");
|
|
1365
1652
|
const l2 = document.createElement("img");
|
|
1366
1653
|
l2.classList.add("magicfeedback-priority-list-arrow-up"), l2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l2.style.visibility = 0 === n3 ? "hidden" : "visible";
|
|
1367
1654
|
const d2 = document.createElement("img");
|
|
1368
1655
|
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 = n3 === e5.length - 1 ? "hidden" : "visible", l2.addEventListener("click", (() => {
|
|
1369
|
-
var i3, n4,
|
|
1656
|
+
var i3, n4, a4, c3;
|
|
1370
1657
|
const u3 = r4.previousElementSibling;
|
|
1371
1658
|
if (u3) {
|
|
1372
|
-
const
|
|
1373
|
-
s3.value = `${
|
|
1374
|
-
const
|
|
1375
|
-
if (
|
|
1376
|
-
const t6 = Number(null === (n4 =
|
|
1377
|
-
|
|
1659
|
+
const h2 = Number(null === (i3 = s3.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) - 1;
|
|
1660
|
+
s3.value = `${h2}. ${t5}`, o4.textContent = `${h2}. ${t5}`, l2.style.visibility = 1 === h2 ? "hidden" : "visible", d2.style.visibility = h2 === e5.length ? "hidden" : "visible";
|
|
1661
|
+
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"), v2 = u3.querySelector(".magicfeedback-priority-list-arrow-down");
|
|
1662
|
+
if (m2 && f2 && g2 && v2) {
|
|
1663
|
+
const t6 = Number(null === (n4 = m2.value) || void 0 === n4 ? void 0 : n4.split(".")[0]) + 1;
|
|
1664
|
+
m2.value = `${t6}.${null === (a4 = f2.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f2.textContent = `${t6}.${null === (c3 = f2.textContent) || void 0 === c3 ? void 0 : c3.split(".")[1]}`, g2.style.visibility = 1 === t6 ? "hidden" : "visible", v2.style.visibility = t6 === e5.length ? "hidden" : "visible";
|
|
1378
1665
|
}
|
|
1379
1666
|
p.insertBefore(r4, u3);
|
|
1380
1667
|
}
|
|
1381
1668
|
})), d2.addEventListener("click", (() => {
|
|
1382
|
-
var i3, n4,
|
|
1669
|
+
var i3, n4, a4;
|
|
1383
1670
|
const c3 = r4.nextElementSibling;
|
|
1384
1671
|
if (c3) {
|
|
1385
1672
|
const u3 = Number(null === (i3 = s3.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) + 1;
|
|
1386
|
-
s3.value = `${u3}. ${t5}`,
|
|
1387
|
-
const
|
|
1388
|
-
if (
|
|
1389
|
-
const t6 = Number(
|
|
1390
|
-
|
|
1673
|
+
s3.value = `${u3}. ${t5}`, o4.textContent = `${u3}. ${t5}`, l2.style.visibility = 1 === u3 ? "hidden" : "visible", d2.style.visibility = u3 === e5.length ? "hidden" : "visible";
|
|
1674
|
+
const h2 = c3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), m2 = c3.querySelector(".magicfeedback-priority-list-item-label"), f2 = c3.querySelector(".magicfeedback-priority-list-arrow-up"), g2 = c3.querySelector(".magicfeedback-priority-list-arrow-down");
|
|
1675
|
+
if (h2 && m2 && f2 && g2) {
|
|
1676
|
+
const t6 = Number(h2.value.split(".")[0]) - 1;
|
|
1677
|
+
h2.value = `${t6}.${null === (n4 = m2.textContent) || void 0 === n4 ? void 0 : n4.split(".")[1]}`, m2.textContent = `${t6}.${null === (a4 = m2.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f2.style.visibility = 1 === t6 ? "hidden" : "visible", g2.style.visibility = t6 === e5.length ? "hidden" : "visible";
|
|
1391
1678
|
}
|
|
1392
1679
|
p.insertBefore(c3, r4);
|
|
1393
1680
|
}
|
|
1394
|
-
})),
|
|
1681
|
+
})), a3.appendChild(l2), a3.appendChild(d2), r4.appendChild(a3), p.appendChild(r4);
|
|
1395
1682
|
}));
|
|
1396
|
-
},
|
|
1397
|
-
|
|
1683
|
+
}, m = document.createElement("div");
|
|
1684
|
+
m.classList.add("magicfeedback-modal-backdrop"), m.style.position = "fixed", m.style.top = "0", m.style.left = "0", m.style.width = "100vw", m.style.height = "100vh", m.style.background = "rgba(0,0,0,0.4)", m.style.display = "none", m.style.alignItems = "center", m.style.justifyContent = "center", m.style.zIndex = "9999";
|
|
1398
1685
|
const f = document.createElement("div");
|
|
1399
|
-
f.classList.add("magicfeedback-modal"), f.style.background = "#fff", f.style.borderRadius = "8px", f.style.boxShadow = "0 8px 24px rgba(0,0,0,0.2)", f.style.maxWidth = "520px", f.style.width = "90%", f.style.maxHeight = "80vh", f.style.overflow = "
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1686
|
+
f.classList.add("magicfeedback-modal"), f.style.background = "#fff", f.style.borderRadius = "8px", f.style.boxShadow = "0 8px 24px rgba(0,0,0,0.2)", f.style.maxWidth = "520px", f.style.width = "90%", f.style.maxHeight = "80vh", f.style.display = "flex", f.style.flexDirection = "column", f.style.overflow = "hidden", f.style.padding = "16px", f.style.position = "relative";
|
|
1687
|
+
const g = document.createElement("h5");
|
|
1688
|
+
g.classList.add("magicfeedback-modal-title"), g.style.flexShrink = "0", g.style.marginTop = "0";
|
|
1689
|
+
const v = () => Math.min(e5.length + 1, s2), y = () => {
|
|
1690
|
+
g.textContent = `${l("selectOptionNumber")}${v()}`;
|
|
1404
1691
|
};
|
|
1405
1692
|
y();
|
|
1406
1693
|
const b = document.createElement("div");
|
|
1407
|
-
b.classList.add("magicfeedback-modal-list"), (n2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4]).forEach(((t5) => {
|
|
1694
|
+
b.classList.add("magicfeedback-modal-list"), b.style.flex = "1 1 auto", b.style.overflowY = "auto", b.style.minHeight = "0", (n2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4]).forEach(((t5) => {
|
|
1408
1695
|
const n3 = document.createElement("label");
|
|
1409
1696
|
n3.classList.add("magicfeedback-modal-row");
|
|
1410
1697
|
const r4 = document.createElement("input");
|
|
1411
1698
|
r4.type = "checkbox", r4.classList.add("magicfeedback-input"), r4.name = `${i2}-selection`, r4.value = t5;
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1699
|
+
const o4 = document.createElement("span");
|
|
1700
|
+
o4.textContent = t5, r4.addEventListener("change", (() => {
|
|
1414
1701
|
if (r4.checked) {
|
|
1415
1702
|
if (e5.length >= s2) return r4.checked = false, n3.classList.add("magicfeedback-warning"), void setTimeout((() => {
|
|
1416
1703
|
n3.classList.remove("magicfeedback-warning");
|
|
@@ -1420,30 +1707,36 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1420
1707
|
const i3 = e5.indexOf(t5);
|
|
1421
1708
|
-1 !== i3 && e5.splice(i3, 1);
|
|
1422
1709
|
}
|
|
1423
|
-
y(),
|
|
1424
|
-
})), n3.appendChild(r4), n3.appendChild(
|
|
1710
|
+
y(), k();
|
|
1711
|
+
})), n3.appendChild(r4), n3.appendChild(o4), b.appendChild(n3);
|
|
1425
1712
|
}));
|
|
1426
1713
|
const E = document.createElement("div");
|
|
1427
|
-
E.classList.add("magicfeedback-modal-actions");
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1430
|
-
const
|
|
1714
|
+
E.classList.add("magicfeedback-modal-actions"), E.style.flexShrink = "0";
|
|
1715
|
+
const A = document.createElement("div");
|
|
1716
|
+
A.classList.add("magicfeedback-modal-counter");
|
|
1717
|
+
const k = () => {
|
|
1431
1718
|
const t5 = l("of");
|
|
1432
|
-
|
|
1719
|
+
A.textContent = `${l("prioritized")} ${e5.length} ${t5} ${s2}`, o3.style.display = e5.length > 0 ? "block" : "none";
|
|
1433
1720
|
};
|
|
1434
|
-
|
|
1721
|
+
k();
|
|
1435
1722
|
const C = document.createElement("button");
|
|
1436
|
-
C.type = "button", C.classList.add("magicfeedback-modal-close"), C.setAttribute("aria-label", l("cancel")), C.title = l("cancel"), C.textContent = "\xD7", C.style.position = "absolute", C.style.top = "8px", C.style.right = "8px", C.style.border = "none", C.style.background = "transparent", C.style.fontSize = "24px", C.style.cursor = "pointer"
|
|
1437
|
-
|
|
1723
|
+
C.type = "button", C.classList.add("magicfeedback-modal-close"), C.setAttribute("aria-label", l("cancel")), C.title = l("cancel"), C.textContent = "\xD7", C.style.position = "absolute", C.style.top = "8px", C.style.right = "8px", C.style.border = "none", C.style.background = "transparent", C.style.fontSize = "24px", C.style.cursor = "pointer";
|
|
1724
|
+
const T = () => {
|
|
1725
|
+
document.body.appendChild(m), m.style.display = "flex", y(), k();
|
|
1726
|
+
}, P = () => {
|
|
1727
|
+
m.style.display = "none", d.appendChild(m);
|
|
1728
|
+
};
|
|
1729
|
+
C.addEventListener("click", (() => {
|
|
1730
|
+
P();
|
|
1438
1731
|
}));
|
|
1439
|
-
const
|
|
1440
|
-
return
|
|
1441
|
-
|
|
1442
|
-
})), E.appendChild(
|
|
1443
|
-
|
|
1444
|
-
})),
|
|
1445
|
-
e6.target ===
|
|
1446
|
-
})), d.appendChild(r3), d.appendChild(u2), d.appendChild(
|
|
1732
|
+
const O = document.createElement("button");
|
|
1733
|
+
return O.type = "button", O.textContent = l("confirm"), O.classList.add("magicfeedback-button"), O.classList.add("magicfeedback-button-primary"), O.addEventListener("click", (() => {
|
|
1734
|
+
P(), h();
|
|
1735
|
+
})), E.appendChild(A), E.appendChild(O), f.appendChild(C), f.appendChild(g), f.appendChild(b), f.appendChild(E), m.appendChild(f), c2.addEventListener("click", (() => {
|
|
1736
|
+
T();
|
|
1737
|
+
})), m.addEventListener("click", ((e6) => {
|
|
1738
|
+
e6.target === m && P();
|
|
1739
|
+
})), d.appendChild(r3), d.appendChild(u2), d.appendChild(m), h(), d;
|
|
1447
1740
|
}
|
|
1448
1741
|
const c = document.createElement("ul");
|
|
1449
1742
|
c.classList.add("magicfeedback-priority-list-list");
|
|
@@ -1455,108 +1748,107 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1455
1748
|
r3.classList.add("magicfeedback-input-magicfeedback-priority-list"), r3.classList.add("magicfeedback-input"), r3.type = "hidden", r3.id = `priority-list-${i2}`, r3.name = i2, r3.value = `${t5 + 1}. ${e5}`, n3.appendChild(r3);
|
|
1456
1749
|
const s3 = document.createElement("label");
|
|
1457
1750
|
s3.classList.add("magicfeedback-priority-list-item-label"), s3.textContent = `${t5 + 1}. ${e5}`, n3.appendChild(s3);
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1462
|
-
var t6, i3,
|
|
1751
|
+
const o3 = document.createElement("div");
|
|
1752
|
+
o3.style.display = "flex", o3.style.alignItems = "center", o3.style.justifyContent = "space-between";
|
|
1753
|
+
const a3 = document.createElement("img");
|
|
1754
|
+
a3.classList.add("magicfeedback-priority-list-arrow-up"), a3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", a3.style.width = "20px", a3.style.height = "20px", a3.style.cursor = "pointer", a3.style.margin = "0 5px", a3.style.color = "#000", a3.style.visibility = 0 === t5 ? "hidden" : "visible", a3.addEventListener("click", (() => {
|
|
1755
|
+
var t6, i3, o4, d2;
|
|
1463
1756
|
const p = n3.previousElementSibling;
|
|
1464
1757
|
if (p) {
|
|
1465
|
-
const
|
|
1466
|
-
r3.value = `${
|
|
1467
|
-
const
|
|
1468
|
-
if (
|
|
1469
|
-
const e6 = Number(null === (i3 =
|
|
1470
|
-
|
|
1758
|
+
const h = Number(null === (t6 = r3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) - 1;
|
|
1759
|
+
r3.value = `${h}. ${e5}`, s3.textContent = `${h}. ${e5}`, a3.style.visibility = 1 === h ? "hidden" : "visible", l2.style.visibility = h === u.length ? "hidden" : "visible";
|
|
1760
|
+
const m = p.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f = p.querySelector(".magicfeedback-priority-list-item-label"), g = p.querySelector(".magicfeedback-priority-list-arrow-up"), v = p.querySelector(".magicfeedback-priority-list-arrow-down");
|
|
1761
|
+
if (m && f && g && v) {
|
|
1762
|
+
const e6 = Number(null === (i3 = m.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) + 1;
|
|
1763
|
+
m.value = `${e6}.${null === (o4 = f.textContent) || void 0 === o4 ? void 0 : o4.split(".")[1]}`, f.textContent = `${e6}.${null === (d2 = f.textContent) || void 0 === d2 ? void 0 : d2.split(".")[1]}`, g.style.visibility = 1 === e6 ? "hidden" : "visible", v.style.visibility = e6 === u.length ? "hidden" : "visible";
|
|
1471
1764
|
}
|
|
1472
1765
|
c.insertBefore(n3, p);
|
|
1473
1766
|
}
|
|
1474
1767
|
}));
|
|
1475
1768
|
const l2 = document.createElement("img");
|
|
1476
1769
|
l2.classList.add("magicfeedback-priority-list-arrow-down"), l2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l2.style.width = "20px", l2.style.height = "20px", l2.style.cursor = "pointer", l2.style.margin = "0 5px", l2.style.color = "#000", l2.style.transform = "rotate(180deg)", l2.style.visibility = t5 === u.length - 1 ? "hidden" : "visible", l2.addEventListener("click", (() => {
|
|
1477
|
-
var t6, i3,
|
|
1770
|
+
var t6, i3, o4;
|
|
1478
1771
|
const d2 = n3.nextElementSibling;
|
|
1479
1772
|
if (d2) {
|
|
1480
1773
|
const p = Number(null === (t6 = r3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) + 1;
|
|
1481
|
-
r3.value = `${p}. ${e5}`, s3.textContent = `${p}. ${e5}`,
|
|
1482
|
-
const
|
|
1483
|
-
if (
|
|
1484
|
-
const e6 = Number(
|
|
1485
|
-
|
|
1774
|
+
r3.value = `${p}. ${e5}`, s3.textContent = `${p}. ${e5}`, a3.style.visibility = 1 === p ? "hidden" : "visible", l2.style.visibility = p === u.length ? "hidden" : "visible";
|
|
1775
|
+
const h = d2.querySelector(".magicfeedback-input-magicfeedback-priority-list"), m = d2.querySelector(".magicfeedback-priority-list-item-label"), f = d2.querySelector(".magicfeedback-priority-list-arrow-up"), g = d2.querySelector(".magicfeedback-priority-list-arrow-down");
|
|
1776
|
+
if (h && m && f && g) {
|
|
1777
|
+
const e6 = Number(h.value.split(".")[0]) - 1;
|
|
1778
|
+
h.value = `${e6}.${null === (i3 = m.textContent) || void 0 === i3 ? void 0 : i3.split(".")[1]}`, m.textContent = `${e6}.${null === (o4 = m.textContent) || void 0 === o4 ? void 0 : o4.split(".")[1]}`, f.style.visibility = 1 === e6 ? "hidden" : "visible", g.style.visibility = e6 === u.length ? "hidden" : "visible";
|
|
1486
1779
|
}
|
|
1487
1780
|
c.insertBefore(d2, n3);
|
|
1488
1781
|
}
|
|
1489
|
-
})),
|
|
1782
|
+
})), o3.appendChild(a3), o3.appendChild(l2), n3.appendChild(o3), c.appendChild(n3);
|
|
1490
1783
|
})), d.appendChild(c), d;
|
|
1491
1784
|
})({ value: e3.value, ref: e3.ref, randomPosition: t3, limitPriority: (null === (n = e3.assets) || void 0 === n ? void 0 : n.limitPriority) || false, maxPriority: (null === (r = e3.assets) || void 0 === r ? void 0 : r.maxPriority) || 0, placeholder: (null === (s = e3.assets) || void 0 === s ? void 0 : s.placeholder) || "", language: i || "en" });
|
|
1492
|
-
return
|
|
1785
|
+
return o.appendChild(a), { element: o, elementTypeClass: "magicfeedback-priority-list" };
|
|
1493
1786
|
};
|
|
1494
1787
|
}, 152: (e2, t2, i) => {
|
|
1495
1788
|
"use strict";
|
|
1496
1789
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingEmoji = void 0;
|
|
1497
1790
|
const n = i(559), r = "https://survey-dev.magicfeedback.io/assets/emojis";
|
|
1498
1791
|
t2.renderRatingEmoji = ({ question: e3, url: t3, send: i2, urlParamValue: s }) => {
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
u.
|
|
1502
|
-
|
|
1503
|
-
for (let e4 = m; e4 <= p; e4++) {
|
|
1792
|
+
const { ref: o, assets: a } = e3, l = document.createElement("div"), d = "magicfeedback-rating", c = document.createElement("div");
|
|
1793
|
+
c.classList.add("magicfeedback-rating-container");
|
|
1794
|
+
const u = (null == a ? void 0 : a.max) ? Number(null == a ? void 0 : a.max) : 5, p = (null == a ? void 0 : a.min) ? Number(null == a ? void 0 : a.min) : 1, h = (0, n.createRatingPlaceholder)(null == a ? void 0 : a.minPlaceholder, null == a ? void 0 : a.maxPlaceholder);
|
|
1795
|
+
for (let e4 = p; e4 <= u; e4++) {
|
|
1504
1796
|
const n2 = document.createElement("div");
|
|
1505
1797
|
n2.classList.add("magicfeedback-rating-option");
|
|
1506
1798
|
const a2 = document.createElement("label");
|
|
1507
1799
|
a2.htmlFor = `rating-${o}-${e4}`, a2.classList.add("magicfeedback-rating-option-label-container");
|
|
1508
1800
|
const l2 = document.createElement("label");
|
|
1509
1801
|
l2.htmlFor = `rating-${o}-${e4}`, l2.textContent = e4.toString();
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
else if (1 ===
|
|
1802
|
+
const h2 = document.createElement("img");
|
|
1803
|
+
if (h2.alt = `face-${o}-${e4}`, h2.className = `rating-image${e4}`, 0 === p && 10 === u) h2.src = `${t3}/${e4}.svg`, h2.onerror = () => h2.src = `${r}/${e4}.svg`;
|
|
1804
|
+
else if (1 === p && 5 === u) switch (e4) {
|
|
1513
1805
|
case 1:
|
|
1514
|
-
|
|
1806
|
+
h2.src = `${t3}/1.svg`, h2.onerror = () => h2.src = `${r}/1.svg`;
|
|
1515
1807
|
break;
|
|
1516
1808
|
case 2:
|
|
1517
|
-
|
|
1809
|
+
h2.src = `${t3}/2.svg`, h2.onerror = () => h2.src = `${r}/2.svg`;
|
|
1518
1810
|
break;
|
|
1519
1811
|
case 3:
|
|
1520
|
-
|
|
1812
|
+
h2.src = `${t3}/6.svg`, h2.onerror = () => h2.src = `${r}/6.svg`;
|
|
1521
1813
|
break;
|
|
1522
1814
|
case 4:
|
|
1523
|
-
|
|
1815
|
+
h2.src = `${t3}/9.svg`, h2.onerror = () => h2.src = `${r}/9.svg`;
|
|
1524
1816
|
break;
|
|
1525
1817
|
case 5:
|
|
1526
|
-
|
|
1818
|
+
h2.src = `${t3}/10.svg`, h2.onerror = () => h2.src = `${r}/10.svg`;
|
|
1527
1819
|
}
|
|
1528
1820
|
else {
|
|
1529
|
-
const i3 = Math.round(10 / (
|
|
1530
|
-
|
|
1821
|
+
const i3 = Math.round(10 / (u - p) * (e4 - p));
|
|
1822
|
+
h2.src = `${t3}/${i3}.svg`, h2.onerror = () => h2.src = `${r}/${i3}.svg`;
|
|
1531
1823
|
}
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1824
|
+
const m = document.createElement("input");
|
|
1825
|
+
m.id = `rating-${o}-${e4}`, m.type = "radio", m.name = o, m.value = e4.toString(), m.classList.add(d), m.classList.add("magicfeedback-input"), i2 && m.addEventListener("change", (() => {
|
|
1534
1826
|
i2();
|
|
1535
|
-
})), s && s ===
|
|
1827
|
+
})), s && s === m.value && (m.checked = true), a2.appendChild(m), a2.appendChild(h2), a2.appendChild(l2), n2.appendChild(a2), c.appendChild(n2);
|
|
1536
1828
|
}
|
|
1537
|
-
if ((null ==
|
|
1829
|
+
if ((null == a ? void 0 : a.extraOption) && (null == a ? void 0 : a.extraOptionText)) {
|
|
1538
1830
|
const e4 = document.createElement("div");
|
|
1539
1831
|
e4.classList.add("magicfeedback-rating-option");
|
|
1540
1832
|
const t4 = document.createElement("label");
|
|
1541
1833
|
t4.htmlFor = `rating-${o}-extra`, t4.classList.add("magicfeedback-rating-option-label-container");
|
|
1542
1834
|
const n2 = document.createElement("label");
|
|
1543
|
-
n2.htmlFor = `rating-${o}-extra`, n2.textContent = null ==
|
|
1835
|
+
n2.htmlFor = `rating-${o}-extra`, n2.textContent = null == a ? void 0 : a.extraOptionText;
|
|
1544
1836
|
const r2 = document.createElement("img");
|
|
1545
1837
|
r2.src = "https://magicfeedback-c6458-dev.web.app/assets/question.svg", r2.alt = `face-${o}-extra`, r2.className = "magicfeedback-rating-image-extra";
|
|
1546
1838
|
const s2 = document.createElement("input");
|
|
1547
|
-
s2.id = `rating-${o}-extra`, s2.type = "radio", s2.name = o, s2.value = "-", s2.classList.add(
|
|
1839
|
+
s2.id = `rating-${o}-extra`, s2.type = "radio", s2.name = o, s2.value = "-", s2.classList.add(d), s2.classList.add("magicfeedback-input"), i2 && s2.addEventListener("change", (() => {
|
|
1548
1840
|
i2();
|
|
1549
|
-
})), t4.appendChild(s2), t4.appendChild(r2), t4.appendChild(n2), e4.appendChild(t4),
|
|
1841
|
+
})), t4.appendChild(s2), t4.appendChild(r2), t4.appendChild(n2), e4.appendChild(t4), c.appendChild(e4);
|
|
1550
1842
|
}
|
|
1551
|
-
return h.childElementCount > 0 &&
|
|
1843
|
+
return h.childElementCount > 0 && c.appendChild(h), l.appendChild(c), { element: l, elementTypeClass: d };
|
|
1552
1844
|
};
|
|
1553
1845
|
}, 917: (e2, t2, i) => {
|
|
1554
1846
|
"use strict";
|
|
1555
1847
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingNumber = void 0;
|
|
1556
1848
|
const n = i(559);
|
|
1557
|
-
t2.renderRatingNumber = ({ question: e3, order: t3, direction: i2,
|
|
1849
|
+
t2.renderRatingNumber = ({ question: e3, order: t3, direction: i2, send: r, urlParamValue: s }) => {
|
|
1558
1850
|
const o = "magicfeedback-rating-number";
|
|
1559
|
-
return { element: (0, n.createRatingNumberElement)(e3.ref, e3.assets, t3, i2,
|
|
1851
|
+
return { element: (0, n.createRatingNumberElement)(e3.ref, e3.assets, t3, i2, o, r, s), elementTypeClass: o };
|
|
1560
1852
|
};
|
|
1561
1853
|
}, 452: (e2, t2, i) => {
|
|
1562
1854
|
"use strict";
|
|
@@ -1564,21 +1856,19 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1564
1856
|
const n = i(559);
|
|
1565
1857
|
t2.renderRatingStar = ({ question: e3, send: t3, urlParamValue: i2 }) => {
|
|
1566
1858
|
var r, s;
|
|
1567
|
-
const
|
|
1568
|
-
return
|
|
1859
|
+
const o = document.createElement("div"), a = (0, n.createStarRating)(e3.ref, null === (r = e3.assets) || void 0 === r ? void 0 : r.minPlaceholder, null === (s = e3.assets) || void 0 === s ? void 0 : s.maxPlaceholder, t3, i2);
|
|
1860
|
+
return o.appendChild(a), { element: o, elementTypeClass: "magicfeedback-rating-star" };
|
|
1569
1861
|
};
|
|
1570
1862
|
}, 85: (e2, t2, i) => {
|
|
1571
1863
|
"use strict";
|
|
1572
1864
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderSelect = void 0;
|
|
1573
1865
|
const n = i(516);
|
|
1574
|
-
t2.renderSelect = ({ question: e3, format: t3, language: i2, urlParamValue: r
|
|
1575
|
-
const { title:
|
|
1576
|
-
return
|
|
1866
|
+
t2.renderSelect = ({ question: e3, format: t3, language: i2, urlParamValue: r }) => {
|
|
1867
|
+
const { title: s, value: o, defaultValue: a } = e3, l = document.createElement("select"), d = document.createElement("option");
|
|
1868
|
+
return d.value = "", d.text = "slim" === t3 ? (0, n.parseTitle)(s, i2) : a || "Select an option", d.disabled = true, d.selected = true, l.appendChild(d), o.forEach(((e4) => {
|
|
1577
1869
|
const t4 = document.createElement("option");
|
|
1578
|
-
t4.value = e4, t4.text = e4,
|
|
1579
|
-
})), r && o.includes(r) && (
|
|
1580
|
-
s();
|
|
1581
|
-
})), { element: d, elementTypeClass: "magicfeedback-select" };
|
|
1870
|
+
t4.value = e4, t4.text = e4, l.appendChild(t4);
|
|
1871
|
+
})), r && o.includes(r) && (l.value = r), { element: l, elementTypeClass: "magicfeedback-select" };
|
|
1582
1872
|
};
|
|
1583
1873
|
}, 90: (e2, t2, i) => {
|
|
1584
1874
|
"use strict";
|
|
@@ -1590,23 +1880,314 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1590
1880
|
e4.preventDefault(), "Enter" === e4.key && r && r();
|
|
1591
1881
|
})), { element: s, elementTypeClass: "magicfeedback-text" };
|
|
1592
1882
|
};
|
|
1593
|
-
}, 250: (e2, t2) => {
|
|
1883
|
+
}, 250: (e2, t2, i) => {
|
|
1884
|
+
"use strict";
|
|
1885
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadFile = void 0;
|
|
1886
|
+
const n = i(571);
|
|
1887
|
+
t2.renderUploadFile = ({ question: e3, language: t3 }) => (0, n.createUploadControl)(e3, t3, "file");
|
|
1888
|
+
}, 843: (e2, t2, i) => {
|
|
1889
|
+
"use strict";
|
|
1890
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadImage = void 0;
|
|
1891
|
+
const n = i(571);
|
|
1892
|
+
t2.renderUploadImage = ({ question: e3, language: t3 }) => (0, n.createUploadControl)(e3, t3, "image");
|
|
1893
|
+
}, 571: function(e2, t2, i) {
|
|
1894
|
+
"use strict";
|
|
1895
|
+
var n = this && this.__awaiter || function(e3, t3, i2, n2) {
|
|
1896
|
+
return new (i2 || (i2 = Promise))((function(r2, s2) {
|
|
1897
|
+
function o2(e4) {
|
|
1898
|
+
try {
|
|
1899
|
+
l2(n2.next(e4));
|
|
1900
|
+
} catch (e5) {
|
|
1901
|
+
s2(e5);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
function a2(e4) {
|
|
1905
|
+
try {
|
|
1906
|
+
l2(n2.throw(e4));
|
|
1907
|
+
} catch (e5) {
|
|
1908
|
+
s2(e5);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
function l2(e4) {
|
|
1912
|
+
var t4;
|
|
1913
|
+
e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
1914
|
+
e5(t4);
|
|
1915
|
+
}))).then(o2, a2);
|
|
1916
|
+
}
|
|
1917
|
+
l2((n2 = n2.apply(e3, t3 || [])).next());
|
|
1918
|
+
}));
|
|
1919
|
+
};
|
|
1920
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.createUploadControl = t2.awaitUploadReady = t2.getUploadValues = t2.formatFileSize = void 0;
|
|
1921
|
+
const r = i(784), s = i(516), o = "__mfUploadValues", a = "__mfUploadReady";
|
|
1922
|
+
function l(e3) {
|
|
1923
|
+
if ("number" != typeof e3 || isNaN(e3)) return "";
|
|
1924
|
+
if (e3 < 1024) return `${e3} B`;
|
|
1925
|
+
const t3 = e3 / 1024;
|
|
1926
|
+
if (t3 < 1024) return `${t3 < 10 ? t3.toFixed(1) : Math.round(t3)} KB`;
|
|
1927
|
+
const i2 = t3 / 1024;
|
|
1928
|
+
return `${i2 < 10 ? i2.toFixed(1) : Math.round(i2)} MB`;
|
|
1929
|
+
}
|
|
1930
|
+
t2.formatFileSize = l, t2.getUploadValues = function(e3) {
|
|
1931
|
+
const t3 = e3[o];
|
|
1932
|
+
return Array.isArray(t3) ? t3 : [];
|
|
1933
|
+
}, t2.awaitUploadReady = function(e3) {
|
|
1934
|
+
return n(this, void 0, void 0, (function* () {
|
|
1935
|
+
if (!e3) return;
|
|
1936
|
+
const t3 = Array.from(e3.querySelectorAll(".magicfeedback-upload-native"));
|
|
1937
|
+
yield Promise.all(t3.map(((e4) => e4[a])).filter(Boolean));
|
|
1938
|
+
}));
|
|
1939
|
+
}, t2.createUploadControl = function(e3, t3, i2) {
|
|
1940
|
+
const { ref: n2, require: d, title: c, assets: u } = e3, p = "image" === i2 ? "magicfeedback-upload-image" : "magicfeedback-upload-file", h = (null == u ? void 0 : u.multiple) || false, m = h ? (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, v = document.createElement("div");
|
|
1941
|
+
v.classList.add("magicfeedback-upload");
|
|
1942
|
+
const y = document.createElement("input");
|
|
1943
|
+
y.type = "file", "image" === i2 && (y.accept = "image/*"), y.multiple = h, y.required = d, y.name = n2, y.id = `magicfeedback-upload-input-${n2}`, y.classList.add(p), y.classList.add("magicfeedback-input"), y.classList.add("magicfeedback-upload-native"), y[o] = [], y[a] = Promise.resolve();
|
|
1944
|
+
const b = (0, s.parseTitle)(c, t3);
|
|
1945
|
+
b && y.setAttribute("aria-label", b);
|
|
1946
|
+
const E = document.createElement("div");
|
|
1947
|
+
E.classList.add("magicfeedback-upload-dropzone");
|
|
1948
|
+
const A = document.createElement("span");
|
|
1949
|
+
A.classList.add("magicfeedback-upload-icon"), A.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>';
|
|
1950
|
+
const k = document.createElement("span");
|
|
1951
|
+
k.classList.add("magicfeedback-upload-cta"), k.textContent = r.placeholder.upload.cta(t3);
|
|
1952
|
+
const C = document.createElement("span");
|
|
1953
|
+
C.classList.add("magicfeedback-upload-hint"), C.textContent = (function(e4, t4, i3, n3, s2) {
|
|
1954
|
+
const o2 = [r.placeholder.upload.formats(e4, t4)];
|
|
1955
|
+
return i3 && n3 > 0 && o2.push(r.placeholder.upload.maxFiles(e4, n3)), s2 > 0 && o2.push(r.placeholder.upload.maxSize(e4, s2)), o2.filter(Boolean).join(" \xB7 ");
|
|
1956
|
+
})(t3, i2, h, m, f), E.appendChild(y), E.appendChild(A), E.appendChild(k), E.appendChild(C);
|
|
1957
|
+
const T = document.createElement("div");
|
|
1958
|
+
T.classList.add("magicfeedback-upload-error");
|
|
1959
|
+
const P = document.createElement("ul");
|
|
1960
|
+
P.classList.add("magicfeedback-upload-list"), v.appendChild(E), v.appendChild(T), v.appendChild(P);
|
|
1961
|
+
const O = /* @__PURE__ */ new WeakMap(), x = (e4) => {
|
|
1962
|
+
const t4 = O.get(e4);
|
|
1963
|
+
return t4 ? Promise.resolve(t4) : new Promise(((t5) => {
|
|
1964
|
+
const i3 = new FileReader(), n3 = (i4) => {
|
|
1965
|
+
const n4 = JSON.stringify({ name: e4.name, type: e4.type, size: e4.size, content: i4 });
|
|
1966
|
+
O.set(e4, n4), t5(n4);
|
|
1967
|
+
};
|
|
1968
|
+
i3.onload = () => n3("string" == typeof i3.result ? i3.result : ""), i3.onerror = () => n3(""), i3.readAsDataURL(e4);
|
|
1969
|
+
}));
|
|
1970
|
+
}, w = [], L = (e4) => {
|
|
1971
|
+
try {
|
|
1972
|
+
const t4 = m > 0 ? e4.slice(0, m) : e4, i3 = new DataTransfer();
|
|
1973
|
+
t4.forEach(((e5) => i3.items.add(e5))), y.files = i3.files;
|
|
1974
|
+
} catch (e5) {
|
|
1975
|
+
}
|
|
1976
|
+
!(function() {
|
|
1977
|
+
w.forEach(((e6) => URL.revokeObjectURL(e6))), w.length = 0, P.innerHTML = "";
|
|
1978
|
+
const e5 = Array.from(y.files || []);
|
|
1979
|
+
v.classList.toggle("magicfeedback-upload--has-files", e5.length > 0), e5.forEach(((e6, n3) => {
|
|
1980
|
+
const s2 = document.createElement("li");
|
|
1981
|
+
s2.classList.add("magicfeedback-upload-file-item");
|
|
1982
|
+
const o2 = document.createElement("span");
|
|
1983
|
+
if (o2.classList.add("magicfeedback-upload-thumb"), "image" === i2 && e6.type.startsWith("image/")) {
|
|
1984
|
+
const t4 = URL.createObjectURL(e6);
|
|
1985
|
+
w.push(t4);
|
|
1986
|
+
const i3 = document.createElement("img");
|
|
1987
|
+
i3.src = t4, i3.alt = e6.name, o2.appendChild(i3);
|
|
1988
|
+
} else o2.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>';
|
|
1989
|
+
const a2 = document.createElement("span");
|
|
1990
|
+
a2.classList.add("magicfeedback-upload-file-info");
|
|
1991
|
+
const d2 = document.createElement("span");
|
|
1992
|
+
d2.classList.add("magicfeedback-upload-file-name"), d2.textContent = e6.name, d2.title = e6.name;
|
|
1993
|
+
const c2 = document.createElement("span");
|
|
1994
|
+
c2.classList.add("magicfeedback-upload-file-size"), c2.textContent = l(e6.size), a2.appendChild(d2), a2.appendChild(c2);
|
|
1995
|
+
const u2 = document.createElement("button");
|
|
1996
|
+
u2.type = "button", u2.classList.add("magicfeedback-upload-remove"), u2.setAttribute("aria-label", `${r.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) => {
|
|
1997
|
+
e7.preventDefault(), e7.stopPropagation(), L(Array.from(y.files || []).filter(((e8, t4) => t4 !== n3)));
|
|
1998
|
+
})), s2.appendChild(o2), s2.appendChild(a2), s2.appendChild(u2), P.appendChild(s2);
|
|
1999
|
+
}));
|
|
2000
|
+
})(), (() => {
|
|
2001
|
+
const e5 = Array.from(y.files || []), t4 = Promise.all(e5.map(x)).then(((e6) => {
|
|
2002
|
+
y[o] = e6;
|
|
2003
|
+
}));
|
|
2004
|
+
y[a] = t4;
|
|
2005
|
+
})();
|
|
2006
|
+
}, S = (e4) => {
|
|
2007
|
+
if (!e4.length) return T.textContent = "", void T.classList.remove("is-visible");
|
|
2008
|
+
const i3 = e4.map(((e5) => e5.name)).join(", ");
|
|
2009
|
+
T.textContent = `${r.placeholder.upload.tooLarge(t3, f)}: ${i3}`, T.classList.add("is-visible");
|
|
2010
|
+
}, N = (e4) => {
|
|
2011
|
+
if (!g) return { accepted: e4, rejected: [] };
|
|
2012
|
+
const t4 = [], i3 = [];
|
|
2013
|
+
return e4.forEach(((e5) => (e5.size <= g ? t4 : i3).push(e5))), { accepted: t4, rejected: i3 };
|
|
2014
|
+
};
|
|
2015
|
+
y.addEventListener("change", (() => {
|
|
2016
|
+
const { accepted: e4, rejected: t4 } = N(Array.from(y.files || []));
|
|
2017
|
+
S(t4), L(e4);
|
|
2018
|
+
}));
|
|
2019
|
+
const I = (e4) => {
|
|
2020
|
+
e4.preventDefault(), e4.stopPropagation();
|
|
2021
|
+
};
|
|
2022
|
+
return ["dragenter", "dragover"].forEach(((e4) => E.addEventListener(e4, ((e5) => {
|
|
2023
|
+
I(e5), E.classList.add("is-dragover");
|
|
2024
|
+
})))), ["dragleave", "dragend"].forEach(((e4) => E.addEventListener(e4, ((e5) => {
|
|
2025
|
+
I(e5), E.classList.remove("is-dragover");
|
|
2026
|
+
})))), E.addEventListener("drop", ((e4) => {
|
|
2027
|
+
I(e4), E.classList.remove("is-dragover");
|
|
2028
|
+
const t4 = e4.dataTransfer;
|
|
2029
|
+
let n3 = t4 ? Array.from(t4.files) : [];
|
|
2030
|
+
if ("image" === i2 && (n3 = n3.filter(((e5) => e5.type.startsWith("image/")))), !n3.length) return;
|
|
2031
|
+
const { accepted: r2, rejected: s2 } = N(n3);
|
|
2032
|
+
if (S(s2), !r2.length) return;
|
|
2033
|
+
const o2 = h ? Array.from(y.files || []) : [];
|
|
2034
|
+
L(o2.concat(r2));
|
|
2035
|
+
})), { element: v, elementTypeClass: p };
|
|
2036
|
+
};
|
|
2037
|
+
}, 945: function(e2, t2, i) {
|
|
1594
2038
|
"use strict";
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
2039
|
+
var n = this && this.__awaiter || function(e3, t3, i2, n2) {
|
|
2040
|
+
return new (i2 || (i2 = Promise))((function(r2, s2) {
|
|
2041
|
+
function o2(e4) {
|
|
2042
|
+
try {
|
|
2043
|
+
l2(n2.next(e4));
|
|
2044
|
+
} catch (e5) {
|
|
2045
|
+
s2(e5);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
function a2(e4) {
|
|
2049
|
+
try {
|
|
2050
|
+
l2(n2.throw(e4));
|
|
2051
|
+
} catch (e5) {
|
|
2052
|
+
s2(e5);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
function l2(e4) {
|
|
2056
|
+
var t4;
|
|
2057
|
+
e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
2058
|
+
e5(t4);
|
|
2059
|
+
}))).then(o2, a2);
|
|
2060
|
+
}
|
|
2061
|
+
l2((n2 = n2.apply(e3, t3 || [])).next());
|
|
2062
|
+
}));
|
|
2063
|
+
}, r = this && this.__importDefault || function(e3) {
|
|
2064
|
+
return e3 && e3.__esModule ? e3 : { default: e3 };
|
|
1599
2065
|
};
|
|
1600
|
-
|
|
2066
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.nextAgentTurn = t2.startAgentSurvey = void 0;
|
|
2067
|
+
const s = r(i(326)), o = i(313), a = i(857), l = i(279);
|
|
2068
|
+
function d(e3, t3, i2, r2, a2) {
|
|
2069
|
+
var d2;
|
|
2070
|
+
return n(this, void 0, void 0, (function* () {
|
|
2071
|
+
let n2;
|
|
2072
|
+
try {
|
|
2073
|
+
n2 = yield (0, s.default)(e3 + t3, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, o.header), body: JSON.stringify(i2) });
|
|
2074
|
+
} catch (e4) {
|
|
2075
|
+
throw r2.err(`[agentSurvey/${a2}] network error`, e4), new l.AgentApiError("NETWORK", (null == e4 ? void 0 : e4.message) || "Network error");
|
|
2076
|
+
}
|
|
2077
|
+
if (!n2.ok) {
|
|
2078
|
+
let e4 = null;
|
|
2079
|
+
try {
|
|
2080
|
+
e4 = yield n2.json();
|
|
2081
|
+
} catch (e5) {
|
|
2082
|
+
}
|
|
2083
|
+
const t4 = (0, l.mapAgentStatus)(n2.status, a2);
|
|
2084
|
+
throw r2.err(`[agentSurvey/${a2}] ${n2.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) || n2.statusText, n2.status, "RATE_LIMITED" === t4 ? (function(e5) {
|
|
2085
|
+
var t5, i3;
|
|
2086
|
+
const n3 = 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"), r3 = n3 ? Number(n3) : NaN;
|
|
2087
|
+
return Number.isFinite(r3) && r3 > 0 ? 1e3 * r3 : 6e4;
|
|
2088
|
+
})(n2) : void 0, e4);
|
|
2089
|
+
}
|
|
2090
|
+
try {
|
|
2091
|
+
const e4 = yield n2.json();
|
|
2092
|
+
return r2.log(`[agentSurvey/${a2}] ok`, e4), e4;
|
|
2093
|
+
} catch (e4) {
|
|
2094
|
+
throw new l.AgentApiError("MALFORMED", "Unreadable response body", n2.status);
|
|
2095
|
+
}
|
|
2096
|
+
}));
|
|
2097
|
+
}
|
|
2098
|
+
t2.startAgentSurvey = function(e3, t3, i2) {
|
|
2099
|
+
return d(e3, a.endpoints.sdk.agentSurveyStart, t3, i2, "start");
|
|
2100
|
+
}, t2.nextAgentTurn = function(e3, t3, i2) {
|
|
2101
|
+
return d(e3, a.endpoints.sdk.agentSurveyNext, t3, i2, "next");
|
|
2102
|
+
};
|
|
2103
|
+
}, 279: (e2, t2) => {
|
|
2104
|
+
"use strict";
|
|
2105
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.mapAgentStatus = t2.AgentApiError = void 0;
|
|
2106
|
+
class i extends Error {
|
|
2107
|
+
constructor(e3, t3, n, r, s) {
|
|
2108
|
+
super(t3), this.kind = e3, this.status = n, this.retryAfterMs = r, this.body = s, this.name = "AgentApiError", Object.setPrototypeOf(this, i.prototype);
|
|
2109
|
+
}
|
|
2110
|
+
get retryable() {
|
|
2111
|
+
return "RATE_LIMITED" === this.kind || "AI_UNAVAILABLE" === this.kind || "NETWORK" === this.kind;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
t2.AgentApiError = i, t2.mapAgentStatus = function(e3, t3) {
|
|
2115
|
+
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";
|
|
2116
|
+
};
|
|
2117
|
+
}, 177: (e2, t2, i) => {
|
|
2118
|
+
"use strict";
|
|
2119
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.encodeAnswer = t2.toAgentStep = t2.ratingBounds = t2.mapAgentType = t2.DEFAULT_ANSWER_DELIMITER = void 0;
|
|
2120
|
+
const n = i(558), r = i(516);
|
|
2121
|
+
t2.DEFAULT_ANSWER_DELIMITER = ", ";
|
|
2122
|
+
const s = [n.FEEDBACKAPPANSWERTYPE.RADIO, n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE, n.FEEDBACKAPPANSWERTYPE.SELECT, n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE], o = Object.values(n.FEEDBACKAPPANSWERTYPE);
|
|
2123
|
+
function a(e3, t3, i2) {
|
|
2124
|
+
var a2, l2, d2;
|
|
2125
|
+
const c2 = String(e3 || "").trim().toUpperCase();
|
|
2126
|
+
return "RATING" === c2 ? n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER : c2 === n.FEEDBACKAPPANSWERTYPE.CONTACT ? (null === (a2 = i2.log) || void 0 === a2 || a2.log("[agentSurvey] CONTACT has no renderer, falling back to TEXT"), n.FEEDBACKAPPANSWERTYPE.TEXT) : o.includes(c2) ? s.includes(c2) && 0 === t3.length ? (null === (d2 = i2.log) || void 0 === d2 || d2.err(`[agentSurvey] ${c2} arrived with no options, falling back to TEXT`), n.FEEDBACKAPPANSWERTYPE.TEXT) : c2 !== n.FEEDBACKAPPANSWERTYPE.BOOLEAN || 2 !== t3.length || (function(e4, t4) {
|
|
2127
|
+
if (2 !== e4.length) return false;
|
|
2128
|
+
const i3 = e4.map(((e5) => String(e5).trim().toLowerCase())), n2 = (0, r.getBooleanOptions)(t4).map(((e5) => e5.toLowerCase())), s2 = ["yes", "no"];
|
|
2129
|
+
return i3[0] === s2[0] && i3[1] === s2[1] || i3[0] === n2[0] && i3[1] === n2[1];
|
|
2130
|
+
})(t3, i2.language) ? c2 : n.FEEDBACKAPPANSWERTYPE.RADIO : (null === (l2 = i2.log) || void 0 === l2 || l2.err(`[agentSurvey] unknown question type "${e3}", falling back to TEXT`), n.FEEDBACKAPPANSWERTYPE.TEXT);
|
|
2131
|
+
}
|
|
2132
|
+
function l(e3) {
|
|
2133
|
+
const t3 = e3.map(Number).filter(((e4) => Number.isFinite(e4)));
|
|
2134
|
+
return t3.length >= 2 ? { min: Math.min(...t3), max: Math.max(...t3) } : { min: 1, max: 5 };
|
|
2135
|
+
}
|
|
2136
|
+
function d(e3, t3, i2) {
|
|
2137
|
+
const r2 = { randomPosition: false, direction: "row", order: "ltr" };
|
|
2138
|
+
return e3 !== n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER && e3 !== n.FEEDBACKAPPANSWERTYPE.RATING_EMOJI || Object.assign(r2, l(t3)), e3 === n.FEEDBACKAPPANSWERTYPE.LONGTEXT && (r2.maxCharacters = 0), Object.assign(Object.assign({}, r2), (null == i2 ? void 0 : i2.assets) || {});
|
|
2139
|
+
}
|
|
2140
|
+
function c(e3, t3, i2) {
|
|
2141
|
+
var n2, r2, s2, o2;
|
|
2142
|
+
const { full: l2, title: c2 } = t3, u = [...null !== (r2 = null !== (n2 = e3.questionValues) && void 0 !== n2 ? n2 : null == l2 ? void 0 : l2.value) && void 0 !== r2 ? r2 : []], p = a(null !== (s2 = null == l2 ? void 0 : l2.type) && void 0 !== s2 ? s2 : e3.questionType, u, i2), h = e3.questionRef || (null == l2 ? void 0 : l2.ref) || `agent-q-${e3.currentTurn}`;
|
|
2143
|
+
return { id: (null == l2 ? void 0 : l2.id) || `agent-${i2.sessionId}-${e3.currentTurn}`, title: c2 || "", type: p, questionType: { conf: null }, ref: h, require: null === (o2 = null == l2 ? void 0 : l2.require) || void 0 === o2 || o2, 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" };
|
|
2144
|
+
}
|
|
2145
|
+
t2.mapAgentType = a, t2.ratingBounds = l, t2.toAgentStep = function(e3, t3) {
|
|
2146
|
+
var i2, r2, s2;
|
|
2147
|
+
const o2 = e3, a2 = e3.currentTurn, l2 = e3.maxTurns, d2 = o2.coverageSummary, u = (e4) => ({ kind: "END", reason: e4, currentTurn: a2, maxTurns: l2, coverageSummary: d2 });
|
|
2148
|
+
if (o2.answerType === n.AGENT_ANSWER_TYPE_BLOCKED) return u("BLOCKED");
|
|
2149
|
+
if (true === o2.shouldEnd) return u("SHOULD_END");
|
|
2150
|
+
const p = (function(e4) {
|
|
2151
|
+
const t4 = e4.question && "object" == typeof e4.question ? e4.question : e4.nextQuestion && "object" == typeof e4.nextQuestion ? e4.nextQuestion : null;
|
|
2152
|
+
if (t4) {
|
|
2153
|
+
const e5 = t4, i3 = e5.title;
|
|
2154
|
+
return { full: e5, title: "string" == typeof i3 ? i3 : i3 ? JSON.stringify(i3) : null };
|
|
2155
|
+
}
|
|
2156
|
+
return { full: null, title: "string" == typeof e4.nextQuestion ? e4.nextQuestion : null };
|
|
2157
|
+
})(e3);
|
|
2158
|
+
return "NONE" === String(null !== (s2 = null !== (r2 = null === (i2 = p.full) || void 0 === i2 ? void 0 : i2.type) && void 0 !== r2 ? r2 : e3.questionType) && void 0 !== s2 ? s2 : "").trim().toUpperCase() ? u("TYPE_NONE") : p.title && p.title.trim() ? { kind: "QUESTION", question: c(e3, p, t3), isFromBase: true === e3.isFromBase, currentTurn: a2, maxTurns: l2, topic: o2.topic, coverageGaps: e3.coverageGaps, coverageSummary: d2 } : u("NO_QUESTION");
|
|
2159
|
+
}, t2.encodeAnswer = function(e3, i2, n2 = t2.DEFAULT_ANSWER_DELIMITER) {
|
|
2160
|
+
const r2 = i2.ref, s2 = (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)), o2 = s2(e3.filter(((e4) => e4.key === r2))), a2 = s2(e3.filter(((e4) => e4.key === `extra-option-${r2}`)));
|
|
2161
|
+
return [o2.filter(((e4, t3) => o2.indexOf(e4) === t3)).join(n2), a2.join(n2)].filter(((e4) => "" !== e4)).join(n2);
|
|
2162
|
+
};
|
|
2163
|
+
}, 107: (e2, t2, i) => {
|
|
1601
2164
|
"use strict";
|
|
1602
|
-
Object.defineProperty(t2, "__esModule", { value: true }), t2.
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
2165
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.scrapeInputs = void 0;
|
|
2166
|
+
const n = i(571);
|
|
2167
|
+
t2.scrapeInputs = function(e3) {
|
|
2168
|
+
const t3 = e3.querySelectorAll(".magicfeedback-input"), i2 = [], r = {};
|
|
2169
|
+
return t3.forEach(((e4) => {
|
|
2170
|
+
var t4;
|
|
2171
|
+
const s = e4, o = s.name;
|
|
2172
|
+
if (!o) return;
|
|
2173
|
+
const a = s.type;
|
|
2174
|
+
if (("radio" === a || "checkbox" === a) && !s.checked) return;
|
|
2175
|
+
const l = s.value, d = s.classList[0];
|
|
2176
|
+
if ((null == d ? void 0 : d.includes("magicfeedback-priority-list")) || (null === (t4 = s.id) || void 0 === t4 ? void 0 : t4.startsWith("priority-list-"))) return r[o] || (r[o] = []), void r[o].push(l);
|
|
2177
|
+
if (null == d ? void 0 : d.includes("magicfeedback-upload")) {
|
|
2178
|
+
const e5 = (0, n.getUploadValues)(s);
|
|
2179
|
+
return void (e5.length && i2.push({ key: o, value: e5 }));
|
|
2180
|
+
}
|
|
2181
|
+
const c = "magicfeedback-consent" === d ? s.checked.toString() : l;
|
|
2182
|
+
null != c && i2.push({ key: o, value: [c] });
|
|
2183
|
+
})), Object.entries(r).forEach((([e4, t4]) => {
|
|
2184
|
+
const n2 = t4.slice().sort(((e5, t5) => Number(e5.split(".")[0]) - Number(t5.split(".")[0])));
|
|
2185
|
+
i2.push({ key: e4, value: n2 });
|
|
2186
|
+
})), i2;
|
|
1606
2187
|
};
|
|
1607
2188
|
}, 857: (e2, t2) => {
|
|
1608
2189
|
"use strict";
|
|
1609
|
-
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" } };
|
|
2190
|
+
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" } };
|
|
1610
2191
|
}, 784: (e2, t2) => {
|
|
1611
2192
|
"use strict";
|
|
1612
2193
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.placeholder = void 0, t2.placeholder = { answer: (e3) => {
|
|
@@ -1729,44 +2310,175 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1729
2310
|
case "bn":
|
|
1730
2311
|
return "\u09AE\u09CB\u099F \u09AA\u09AF\u09BC\u09C7\u09A8\u09CD\u099F 100 % \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7";
|
|
1731
2312
|
}
|
|
1732
|
-
}
|
|
2313
|
+
}, upload: { cta: (e3) => {
|
|
2314
|
+
switch (e3) {
|
|
2315
|
+
case "es":
|
|
2316
|
+
return "Arrastra y suelta o haz clic para subir";
|
|
2317
|
+
case "da":
|
|
2318
|
+
return "Tr\xE6k og slip eller klik for at uploade";
|
|
2319
|
+
case "fi":
|
|
2320
|
+
return "Ved\xE4 ja pudota tai napsauta ladataksesi";
|
|
2321
|
+
case "sv":
|
|
2322
|
+
return "Dra och sl\xE4pp eller klicka f\xF6r att ladda upp";
|
|
2323
|
+
case "no":
|
|
2324
|
+
return "Dra og slipp eller klikk for \xE5 laste opp";
|
|
2325
|
+
case "ar":
|
|
2326
|
+
return "\u0627\u0633\u062D\u0628 \u0648\u0623\u0641\u0644\u062A \u0623\u0648 \u0627\u0646\u0642\u0631 \u0644\u0644\u062A\u062D\u0645\u064A\u0644";
|
|
2327
|
+
case "bn":
|
|
2328
|
+
return "\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";
|
|
2329
|
+
default:
|
|
2330
|
+
return "Drag & drop or click to upload";
|
|
2331
|
+
}
|
|
2332
|
+
}, formats: (e3, t3) => {
|
|
2333
|
+
if ("image" === t3) switch (e3) {
|
|
2334
|
+
case "es":
|
|
2335
|
+
return "Solo im\xE1genes";
|
|
2336
|
+
case "da":
|
|
2337
|
+
return "Kun billeder";
|
|
2338
|
+
case "fi":
|
|
2339
|
+
return "Vain kuvat";
|
|
2340
|
+
case "sv":
|
|
2341
|
+
return "Endast bilder";
|
|
2342
|
+
case "no":
|
|
2343
|
+
return "Kun bilder";
|
|
2344
|
+
case "ar":
|
|
2345
|
+
return "\u0627\u0644\u0635\u0648\u0631 \u0641\u0642\u0637";
|
|
2346
|
+
case "bn":
|
|
2347
|
+
return "\u09B6\u09C1\u09A7\u09C1\u09AE\u09BE\u09A4\u09CD\u09B0 \u099B\u09AC\u09BF";
|
|
2348
|
+
default:
|
|
2349
|
+
return "Images only";
|
|
2350
|
+
}
|
|
2351
|
+
switch (e3) {
|
|
2352
|
+
case "es":
|
|
2353
|
+
return "Cualquier tipo de archivo";
|
|
2354
|
+
case "da":
|
|
2355
|
+
return "Enhver filtype";
|
|
2356
|
+
case "fi":
|
|
2357
|
+
return "Mik\xE4 tahansa tiedostotyyppi";
|
|
2358
|
+
case "sv":
|
|
2359
|
+
return "Alla filtyper";
|
|
2360
|
+
case "no":
|
|
2361
|
+
return "Alle filtyper";
|
|
2362
|
+
case "ar":
|
|
2363
|
+
return "\u0623\u064A \u0646\u0648\u0639 \u0645\u0646 \u0627\u0644\u0645\u0644\u0641\u0627\u062A";
|
|
2364
|
+
case "bn":
|
|
2365
|
+
return "\u09AF\u09C7\u0995\u09CB\u09A8\u09CB \u09A7\u09B0\u09A8\u09C7\u09B0 \u09AB\u09BE\u0987\u09B2";
|
|
2366
|
+
default:
|
|
2367
|
+
return "Any file type";
|
|
2368
|
+
}
|
|
2369
|
+
}, maxFiles: (e3, t3) => {
|
|
2370
|
+
switch (e3) {
|
|
2371
|
+
case "es":
|
|
2372
|
+
return `M\xE1x. ${t3} archivos`;
|
|
2373
|
+
case "da":
|
|
2374
|
+
return `Maks. ${t3} filer`;
|
|
2375
|
+
case "fi":
|
|
2376
|
+
return `Enint\xE4\xE4n ${t3} tiedostoa`;
|
|
2377
|
+
case "sv":
|
|
2378
|
+
return `Max ${t3} filer`;
|
|
2379
|
+
case "no":
|
|
2380
|
+
return `Maks ${t3} filer`;
|
|
2381
|
+
case "ar":
|
|
2382
|
+
return `${t3} \u0645\u0644\u0641\u0627\u062A \u0643\u062D\u062F \u0623\u0642\u0635\u0649`;
|
|
2383
|
+
case "bn":
|
|
2384
|
+
return `\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A ${t3}\u099F\u09BF \u09AB\u09BE\u0987\u09B2`;
|
|
2385
|
+
default:
|
|
2386
|
+
return `Max ${t3} files`;
|
|
2387
|
+
}
|
|
2388
|
+
}, maxSize: (e3, t3) => {
|
|
2389
|
+
switch (e3) {
|
|
2390
|
+
case "es":
|
|
2391
|
+
return `M\xE1x. ${t3} MB`;
|
|
2392
|
+
case "da":
|
|
2393
|
+
return `Maks. ${t3} MB`;
|
|
2394
|
+
case "fi":
|
|
2395
|
+
return `Enint\xE4\xE4n ${t3} MB`;
|
|
2396
|
+
case "sv":
|
|
2397
|
+
case "en":
|
|
2398
|
+
default:
|
|
2399
|
+
return `Max ${t3} MB`;
|
|
2400
|
+
case "no":
|
|
2401
|
+
return `Maks ${t3} MB`;
|
|
2402
|
+
case "ar":
|
|
2403
|
+
return `${t3} \u0645\u064A\u063A\u0627\u0628\u0627\u064A\u062A \u0643\u062D\u062F \u0623\u0642\u0635\u0649`;
|
|
2404
|
+
case "bn":
|
|
2405
|
+
return `\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A ${t3} MB`;
|
|
2406
|
+
}
|
|
2407
|
+
}, tooLarge: (e3, t3) => {
|
|
2408
|
+
switch (e3) {
|
|
2409
|
+
case "es":
|
|
2410
|
+
return `Archivo demasiado grande (m\xE1x. ${t3} MB)`;
|
|
2411
|
+
case "da":
|
|
2412
|
+
return `Filen er for stor (maks. ${t3} MB)`;
|
|
2413
|
+
case "fi":
|
|
2414
|
+
return `Tiedosto on liian suuri (enint\xE4\xE4n ${t3} MB)`;
|
|
2415
|
+
case "sv":
|
|
2416
|
+
return `Filen \xE4r f\xF6r stor (max ${t3} MB)`;
|
|
2417
|
+
case "no":
|
|
2418
|
+
return `Filen er for stor (maks ${t3} MB)`;
|
|
2419
|
+
case "ar":
|
|
2420
|
+
return `\u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 ${t3} \u0645\u064A\u063A\u0627\u0628\u0627\u064A\u062A)`;
|
|
2421
|
+
case "bn":
|
|
2422
|
+
return `\u09AB\u09BE\u0987\u09B2\u099F\u09BF \u0996\u09C1\u09AC \u09AC\u09A1\u09BC (\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A ${t3} MB)`;
|
|
2423
|
+
default:
|
|
2424
|
+
return `File is too large (max ${t3} MB)`;
|
|
2425
|
+
}
|
|
2426
|
+
}, remove: (e3) => {
|
|
2427
|
+
switch (e3) {
|
|
2428
|
+
case "es":
|
|
2429
|
+
return "Eliminar";
|
|
2430
|
+
case "da":
|
|
2431
|
+
case "no":
|
|
2432
|
+
return "Fjern";
|
|
2433
|
+
case "fi":
|
|
2434
|
+
return "Poista";
|
|
2435
|
+
case "sv":
|
|
2436
|
+
return "Ta bort";
|
|
2437
|
+
case "ar":
|
|
2438
|
+
return "\u0625\u0632\u0627\u0644\u0629";
|
|
2439
|
+
case "bn":
|
|
2440
|
+
return "\u09B8\u09B0\u09BE\u09A8";
|
|
2441
|
+
default:
|
|
2442
|
+
return "Remove";
|
|
2443
|
+
}
|
|
2444
|
+
} } };
|
|
1733
2445
|
}, 213: (e2, t2, i) => {
|
|
1734
2446
|
"use strict";
|
|
1735
2447
|
Object.defineProperty(t2, "__esModule", { value: true }), t2.renderStartMessage = t2.renderSuccess = t2.renderError = t2.renderActions = t2.renderQuestions = void 0;
|
|
1736
2448
|
const n = i(42), r = i(516), s = { small: "1rem", medium: "1.2rem", large: "1.5rem" };
|
|
1737
|
-
t2.renderQuestions = function e3(t3, i2 = "standard",
|
|
2449
|
+
t2.renderQuestions = function e3(t3, i2 = "standard", o = "en", a = { customIcons: false }, l) {
|
|
1738
2450
|
if (!t3) throw new Error("[MagicFeedback] No questions provided");
|
|
1739
|
-
const d = [], { customIcons: c, id: u } =
|
|
2451
|
+
const d = [], { customIcons: c, id: u } = a;
|
|
1740
2452
|
return t3.forEach(((p) => {
|
|
1741
|
-
var
|
|
1742
|
-
if ((null === (
|
|
2453
|
+
var h, m;
|
|
2454
|
+
if ((null === (m = null === (h = null == p ? void 0 : p.questionType) || void 0 === h ? void 0 : h.conf) || void 0 === m ? void 0 : m.length) > 0) {
|
|
1743
2455
|
let t4 = document.createElement("div");
|
|
1744
2456
|
t4.classList.add("magicfeedback-div");
|
|
1745
2457
|
const n2 = document.createElement("label");
|
|
1746
|
-
n2.setAttribute("for", `magicfeedback-${p.id}`), n2.textContent = (0, r.parseTitle)(p.title,
|
|
2458
|
+
n2.setAttribute("for", `magicfeedback-${p.id}`), n2.textContent = (0, r.parseTitle)(p.title, o), n2.classList.add("magicfeedback-label"), t4.appendChild(n2), p.questionType.conf.forEach(((e4) => {
|
|
1747
2459
|
e4.ref = p.ref, p.assets[e4.id] && (e4.assets = { placeholder: p.assets[e4.id] });
|
|
1748
|
-
})), e3(p.questionType.conf, i2,
|
|
2460
|
+
})), e3(p.questionType.conf, i2, o, a, l).forEach(((e4) => {
|
|
1749
2461
|
t4.appendChild(e4);
|
|
1750
2462
|
})), d.push(t4);
|
|
1751
2463
|
} else {
|
|
1752
|
-
const e4 = (function(e5, t4, i3,
|
|
2464
|
+
const e4 = (function(e5, t4, i3, o2, a2) {
|
|
1753
2465
|
var l2, d2, c2;
|
|
1754
|
-
let u2, p2, { id:
|
|
2466
|
+
let u2, p2, { id: h2, title: m2, type: f, ref: g, require: v, defaultValue: y, assets: b } = e5, E = document.createElement("div");
|
|
1755
2467
|
E.classList.add("magicfeedback-div");
|
|
1756
|
-
const
|
|
1757
|
-
if (!
|
|
2468
|
+
const A = window.innerWidth < 600, k = "slim" === t4 ? (0, r.parseTitle)(m2, i3) : null == b ? void 0 : b.placeholder, C = (0, r.getUrlParam)(g), T = (null == b ? void 0 : b.maxCharacters) || 0, P = void 0 !== (null == b ? void 0 : b.randomPosition) && (null == b ? void 0 : b.randomPosition), O = (null == b ? void 0 : b.direction) || "row", x = (null == b ? void 0 : b.order) || "ltr", w = (0, n.getQuestionRenderer)(f);
|
|
2469
|
+
if (!w) return E;
|
|
1758
2470
|
{
|
|
1759
|
-
const n2 =
|
|
2471
|
+
const n2 = w({ question: e5, format: t4, language: i3, url: o2, send: a2, isPhone: A, urlParamValue: C, placeholderText: k, maxCharacters: T, randomPosition: P, direction: O, order: x });
|
|
1760
2472
|
u2 = n2.element, p2 = n2.elementTypeClass;
|
|
1761
2473
|
}
|
|
1762
|
-
u2.id = `magicfeedback-${
|
|
2474
|
+
u2.id = `magicfeedback-${h2}`, u2.setAttribute("name", g), u2.classList.add(p2), (void 0 !== y || null !== C) && (u2.value = C || y), ["RADIO", "MULTIPLECHOICE", "UPLOAD_IMAGE", "UPLOAD_FILE"].includes(f) || (u2.classList.add("magicfeedback-input"), u2.required = v);
|
|
1763
2475
|
const L = document.createElement("label");
|
|
1764
|
-
L.setAttribute("for", `magicfeedback-${
|
|
2476
|
+
L.setAttribute("for", `magicfeedback-${h2}`), L.textContent = (0, r.parseTitle)(m2, i3), L.classList.add("magicfeedback-label"), (function(e6, t5) {
|
|
1765
2477
|
if ("INFO_PAGE" !== t5.type) return;
|
|
1766
2478
|
const { assets: i4 } = t5, n2 = (function(e7) {
|
|
1767
2479
|
if (e7) return s[e7] || e7;
|
|
1768
|
-
})(null == i4 ? void 0 : i4.titleSize), r2 = (
|
|
1769
|
-
var
|
|
2480
|
+
})(null == i4 ? void 0 : i4.titleSize), r2 = (o3 = null == i4 ? void 0 : i4.titleStyle, Array.isArray(o3) ? o3 : o3 ? [o3] : []);
|
|
2481
|
+
var o3;
|
|
1770
2482
|
n2 && e6.style.setProperty("font-size", n2, "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")), r2.includes("italic") && e6.style.setProperty("font-style", "italic", "important"), r2.includes("bold") && e6.style.setProperty("font-weight", "bold", "important"), r2.includes("underline") && e6.style.setProperty("text-decoration", "underline", "important");
|
|
1771
2483
|
})(L, e5);
|
|
1772
2484
|
const S = document.createElement("label");
|
|
@@ -1784,28 +2496,28 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1784
2496
|
const e7 = document.createElement("div");
|
|
1785
2497
|
e7.classList.add("magicfeedback-skip-container"), e7.classList.add("magicfeedback-checkbox-container"), e7.style.display = "flex", e7.style.justifyContent = "flex-start";
|
|
1786
2498
|
const t5 = document.createElement("input");
|
|
1787
|
-
t5.classList.add("magicfeedback-skip"), t5.type = "checkbox", t5.id = `skip-${
|
|
2499
|
+
t5.classList.add("magicfeedback-skip"), t5.type = "checkbox", t5.id = `skip-${g}`, t5.name = g, t5.value = "-", t5.style.cursor = "pointer";
|
|
1788
2500
|
const i4 = document.createElement("label");
|
|
1789
|
-
i4.htmlFor = `skip-${
|
|
1790
|
-
u2.value = "-",
|
|
2501
|
+
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", (() => {
|
|
2502
|
+
u2.value = "-", a2 && a2();
|
|
1791
2503
|
})), e7.appendChild(t5), e7.appendChild(i4), E.appendChild(e7);
|
|
1792
2504
|
}
|
|
1793
2505
|
} else E.appendChild(u2);
|
|
1794
2506
|
}
|
|
1795
2507
|
return E;
|
|
1796
|
-
})(p, i2,
|
|
2508
|
+
})(p, i2, o, "https://survey-dev.magicfeedback.io/assets/emojis" + (c ? `/${u}` : ""), 1 === t3.length ? l : void 0);
|
|
1797
2509
|
d.push(e4);
|
|
1798
2510
|
}
|
|
1799
2511
|
})), d;
|
|
1800
2512
|
}, t2.renderActions = function(e3 = "", t3, i2 = "Submit", n2 = "Back", r2 = "Next") {
|
|
1801
2513
|
const s2 = document.createElement("div");
|
|
1802
2514
|
s2.classList.add("magicfeedback-action-container");
|
|
1803
|
-
const a = document.createElement("button");
|
|
1804
|
-
a.id = "magicfeedback-submit", a.type = "submit", a.classList.add("magicfeedback-submit"), a.textContent = "MAGICSURVEY" === e3 ? r2 || "Next" : i2 || "Submit";
|
|
1805
2515
|
const o = document.createElement("button");
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
2516
|
+
o.id = "magicfeedback-submit", o.type = "submit", o.classList.add("magicfeedback-submit"), o.textContent = "MAGICSURVEY" === e3 ? r2 || "Next" : i2 || "Submit";
|
|
2517
|
+
const a = document.createElement("button");
|
|
2518
|
+
return a.id = "magicfeedback-back", a.type = "button", a.classList.add("magicfeedback-back"), a.textContent = n2 || "Back", a.addEventListener("click", t3), a.addEventListener("click", (() => {
|
|
2519
|
+
o.removeAttribute("disabled");
|
|
2520
|
+
})), "MAGICSURVEY" === e3 && s2.appendChild(a), s2.appendChild(o), s2;
|
|
1809
2521
|
}, t2.renderError = function(e3) {
|
|
1810
2522
|
const t3 = document.createElement("div");
|
|
1811
2523
|
return t3.classList.add("magicfeedback-error"), t3.textContent = e3, t3;
|
|
@@ -1827,84 +2539,84 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1827
2539
|
"use strict";
|
|
1828
2540
|
var n = this && this.__awaiter || function(e3, t3, i2, n2) {
|
|
1829
2541
|
return new (i2 || (i2 = Promise))((function(r2, s2) {
|
|
1830
|
-
function
|
|
2542
|
+
function o2(e4) {
|
|
1831
2543
|
try {
|
|
1832
|
-
|
|
2544
|
+
l(n2.next(e4));
|
|
1833
2545
|
} catch (e5) {
|
|
1834
2546
|
s2(e5);
|
|
1835
2547
|
}
|
|
1836
2548
|
}
|
|
1837
|
-
function
|
|
2549
|
+
function a2(e4) {
|
|
1838
2550
|
try {
|
|
1839
|
-
|
|
2551
|
+
l(n2.throw(e4));
|
|
1840
2552
|
} catch (e5) {
|
|
1841
2553
|
s2(e5);
|
|
1842
2554
|
}
|
|
1843
2555
|
}
|
|
1844
|
-
function
|
|
2556
|
+
function l(e4) {
|
|
1845
2557
|
var t4;
|
|
1846
2558
|
e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
|
|
1847
2559
|
e5(t4);
|
|
1848
|
-
}))).then(
|
|
2560
|
+
}))).then(o2, a2);
|
|
1849
2561
|
}
|
|
1850
|
-
|
|
2562
|
+
l((n2 = n2.apply(e3, t3 || [])).next());
|
|
1851
2563
|
}));
|
|
1852
2564
|
}, r = this && this.__importDefault || function(e3) {
|
|
1853
2565
|
return e3 && e3.__esModule ? e3 : { default: e3 };
|
|
1854
2566
|
};
|
|
1855
|
-
Object.defineProperty(t2, "__esModule", { value: true }), t2.getFollowUpQuestion = t2.sendFeedback = t2.getQuestions = t2.getSessionForm = t2.getForm = t2.validateEmail = void 0;
|
|
1856
|
-
const s = r(i(
|
|
1857
|
-
t2.validateEmail = function(e3) {
|
|
2567
|
+
Object.defineProperty(t2, "__esModule", { value: true }), t2.getFollowUpQuestion = t2.sendFeedback = t2.getQuestions = t2.getSessionForm = t2.getForm = t2.validateEmail = t2.header = void 0;
|
|
2568
|
+
const s = r(i(326)), o = r(i(330)), a = i(857);
|
|
2569
|
+
t2.header = { Accept: "application/json", "Magicfeedback-Sdk-Version": o.default.version, "x-magicfeedback-parameters": window.location.search || "" }, t2.validateEmail = function(e3) {
|
|
1858
2570
|
return /\S+@\S+\.\S+/.test(e3);
|
|
1859
|
-
}, t2.getForm = function(e3,
|
|
2571
|
+
}, t2.getForm = function(e3, i2, r2, o2) {
|
|
1860
2572
|
return n(this, void 0, void 0, (function* () {
|
|
1861
2573
|
try {
|
|
1862
|
-
const n2 = yield (0, s.default)(e3 +
|
|
2574
|
+
const n2 = yield (0, s.default)(e3 + a.endpoints.sdk.app_info(i2, r2), { method: "GET", headers: t2.header });
|
|
1863
2575
|
return yield n2.json();
|
|
1864
2576
|
} catch (e4) {
|
|
1865
|
-
|
|
2577
|
+
o2.err(e4);
|
|
1866
2578
|
}
|
|
1867
2579
|
}));
|
|
1868
|
-
}, t2.getSessionForm = function(e3,
|
|
2580
|
+
}, t2.getSessionForm = function(e3, i2, r2) {
|
|
1869
2581
|
return n(this, void 0, void 0, (function* () {
|
|
1870
2582
|
try {
|
|
1871
|
-
const
|
|
1872
|
-
return yield
|
|
2583
|
+
const n2 = yield (0, s.default)(e3 + a.endpoints.sdk.session(i2), { method: "GET", headers: t2.header });
|
|
2584
|
+
return yield n2.json();
|
|
1873
2585
|
} catch (e4) {
|
|
1874
|
-
|
|
2586
|
+
r2.err(e4);
|
|
1875
2587
|
}
|
|
1876
2588
|
}));
|
|
1877
|
-
}, t2.getQuestions = function(e3,
|
|
2589
|
+
}, t2.getQuestions = function(e3, i2, r2, o2) {
|
|
1878
2590
|
return n(this, void 0, void 0, (function* () {
|
|
1879
2591
|
try {
|
|
1880
|
-
const n2 = yield (0, s.default)(e3 +
|
|
2592
|
+
const n2 = yield (0, s.default)(e3 + a.endpoints.sdk.app(i2, r2), { method: "GET", headers: t2.header });
|
|
1881
2593
|
if (n2.ok) {
|
|
1882
2594
|
const e4 = yield n2.json();
|
|
1883
|
-
return
|
|
2595
|
+
return o2.log(`Received questions for app ${i2}`, e4), e4;
|
|
1884
2596
|
}
|
|
1885
|
-
throw
|
|
2597
|
+
throw o2.err(`Failed to get questions for app ${i2}:`, n2.status, n2.statusText), new Error("[MagicFeedback] Bad response from server");
|
|
1886
2598
|
} catch (e4) {
|
|
1887
|
-
return
|
|
2599
|
+
return o2.err(e4), [];
|
|
1888
2600
|
}
|
|
1889
2601
|
}));
|
|
1890
|
-
}, t2.sendFeedback = function(e3,
|
|
2602
|
+
}, t2.sendFeedback = function(e3, i2, r2) {
|
|
1891
2603
|
return n(this, void 0, void 0, (function* () {
|
|
1892
2604
|
try {
|
|
1893
|
-
const n2 = yield (0, s.default)(e3 +
|
|
1894
|
-
if (n2.ok) return
|
|
1895
|
-
throw
|
|
2605
|
+
const n2 = yield (0, s.default)(e3 + a.endpoints.sdk.feedback, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, t2.header), body: JSON.stringify(i2) });
|
|
2606
|
+
if (n2.ok) return r2.log(`Form ${i2.integration} submitted successfully!`), (yield n2.json()).sessionId;
|
|
2607
|
+
throw r2.err(`Failed to submit form ${i2.integration}:`, n2.status, n2.statusText), new Error(n2.statusText);
|
|
1896
2608
|
} catch (e4) {
|
|
1897
|
-
return
|
|
2609
|
+
return r2.err(e4), "";
|
|
1898
2610
|
}
|
|
1899
2611
|
}));
|
|
1900
|
-
}, t2.getFollowUpQuestion = function(e3,
|
|
2612
|
+
}, t2.getFollowUpQuestion = function(e3, i2, r2) {
|
|
1901
2613
|
return n(this, void 0, void 0, (function* () {
|
|
1902
2614
|
try {
|
|
1903
|
-
const n2 = yield (0, s.default)(e3 +
|
|
1904
|
-
if (n2.ok) return
|
|
1905
|
-
throw
|
|
2615
|
+
const n2 = yield (0, s.default)(e3 + a.endpoints.sdk.followUpQuestion, { method: "POST", headers: Object.assign({ "Content-Type": "application/json" }, t2.header), body: JSON.stringify(i2) });
|
|
2616
|
+
if (n2.ok) return r2.log(`Received follow up question for form ${i2.integration}`), (yield n2.json()) || "";
|
|
2617
|
+
throw r2.err(`Failed to get follow up question for form ${i2.integration}:`, n2.status, n2.statusText), new Error(n2.statusText);
|
|
1906
2618
|
} catch (e4) {
|
|
1907
|
-
return
|
|
2619
|
+
return r2.err(e4), "";
|
|
1908
2620
|
}
|
|
1909
2621
|
}));
|
|
1910
2622
|
};
|
|
@@ -1923,7 +2635,7 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1923
2635
|
};
|
|
1924
2636
|
}, 330: (e2) => {
|
|
1925
2637
|
"use strict";
|
|
1926
|
-
e2.exports = JSON.parse('{"name":"@magicfeedback/native","version":"2.2.
|
|
2638
|
+
e2.exports = JSON.parse('{"name":"@magicfeedback/native","version":"2.2.8","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"}');
|
|
1927
2639
|
} }, t = {}, (function i(n) {
|
|
1928
2640
|
var r = t[n];
|
|
1929
2641
|
if (void 0 !== r) return r.exports;
|
|
@@ -1935,6 +2647,41 @@ var require_magicfeedback_sdk_browser = __commonJS({
|
|
|
1935
2647
|
}
|
|
1936
2648
|
});
|
|
1937
2649
|
|
|
2650
|
+
// src/ui/logo.ts
|
|
2651
|
+
var BASE_CSS = "max-height:40px; max-width:100%; object-fit:contain; display:block; margin:12px 0 0 0;";
|
|
2652
|
+
var MAX_HEIGHT = {
|
|
2653
|
+
small: "30px",
|
|
2654
|
+
medium: "50px",
|
|
2655
|
+
large: "70px"
|
|
2656
|
+
};
|
|
2657
|
+
function insertPopupLogo(parent, anchor, style, id) {
|
|
2658
|
+
if (!style?.logo) return null;
|
|
2659
|
+
if (parent.ownerDocument.getElementById(id)) return null;
|
|
2660
|
+
const img = parent.ownerDocument.createElement("img");
|
|
2661
|
+
img.id = id;
|
|
2662
|
+
img.src = style.logo;
|
|
2663
|
+
img.alt = "Logo";
|
|
2664
|
+
img.style.cssText = BASE_CSS;
|
|
2665
|
+
if (style.logoSize && MAX_HEIGHT[style.logoSize]) {
|
|
2666
|
+
img.style.maxHeight = MAX_HEIGHT[style.logoSize];
|
|
2667
|
+
}
|
|
2668
|
+
switch (style.logoPosition) {
|
|
2669
|
+
case "left":
|
|
2670
|
+
img.style.margin = "12px 16px 0 0";
|
|
2671
|
+
img.style.marginLeft = "0";
|
|
2672
|
+
break;
|
|
2673
|
+
case "right":
|
|
2674
|
+
img.style.margin = "12px 0 0 16px";
|
|
2675
|
+
img.style.marginLeft = "auto";
|
|
2676
|
+
break;
|
|
2677
|
+
case "center":
|
|
2678
|
+
img.style.margin = "12px auto 0 auto";
|
|
2679
|
+
break;
|
|
2680
|
+
}
|
|
2681
|
+
parent.insertBefore(img, anchor);
|
|
2682
|
+
return img;
|
|
2683
|
+
}
|
|
2684
|
+
|
|
1938
2685
|
// src/ui/renderPopup.ts
|
|
1939
2686
|
var import_native = __toESM(require_magicfeedback_sdk_browser());
|
|
1940
2687
|
function ensureMagicFeedbackStyles(_popup) {
|
|
@@ -2038,7 +2785,6 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
|
|
|
2038
2785
|
// oscuros con texto blanco sobre el fondo claro del popup.
|
|
2039
2786
|
colorScheme: isDark ? "dark" : "light",
|
|
2040
2787
|
textPrimary: isDark ? "#f0f0f0" : "#111",
|
|
2041
|
-
closeBtnHoverBg: isDark ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.06)",
|
|
2042
2788
|
closeBtnHoverColor: isDark ? "#fff" : "#000000",
|
|
2043
2789
|
textMuted: isDark ? "#9ca3af" : "#6b7280",
|
|
2044
2790
|
progressTrack: isDark ? "#3f3f46" : "#e5e7eb"
|
|
@@ -2099,8 +2845,8 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
|
|
|
2099
2845
|
closeBtn.type = "button";
|
|
2100
2846
|
closeBtn.setAttribute("aria-label", "Close popup");
|
|
2101
2847
|
closeBtn.innerHTML = `
|
|
2102
|
-
<svg width="
|
|
2103
|
-
<path d="
|
|
2848
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2849
|
+
<path d="M5 5L19 19M5 19L19 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="butt"/>
|
|
2104
2850
|
</svg>
|
|
2105
2851
|
`;
|
|
2106
2852
|
closeBtn.style.cssText = `
|
|
@@ -2115,17 +2861,15 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
|
|
|
2115
2861
|
cursor:pointer;
|
|
2116
2862
|
color:${theme.textPrimary};
|
|
2117
2863
|
padding:4px;
|
|
2118
|
-
transition: color .15s ease, transform .15s ease
|
|
2864
|
+
transition: color .15s ease, transform .15s ease;
|
|
2119
2865
|
box-shadow: none !important;
|
|
2120
2866
|
`;
|
|
2121
2867
|
closeBtn.onmouseenter = () => {
|
|
2122
2868
|
closeBtn.style.color = theme.closeBtnHoverColor;
|
|
2123
|
-
closeBtn.style.background = theme.closeBtnHoverBg;
|
|
2124
2869
|
closeBtn.style.transform = "scale(1.06)";
|
|
2125
2870
|
};
|
|
2126
2871
|
closeBtn.onmouseleave = () => {
|
|
2127
2872
|
closeBtn.style.color = theme.textPrimary;
|
|
2128
|
-
closeBtn.style.background = "transparent";
|
|
2129
2873
|
closeBtn.style.transform = "scale(1)";
|
|
2130
2874
|
};
|
|
2131
2875
|
closeBtn.onclick = () => {
|
|
@@ -2515,47 +3259,7 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
|
|
|
2515
3259
|
backButton.style.color = s.buttonSecondaryColor;
|
|
2516
3260
|
backButton.style.border = "none";
|
|
2517
3261
|
}
|
|
2518
|
-
|
|
2519
|
-
if (!document.getElementById("deepdots-popup-logo")) {
|
|
2520
|
-
const logoImg = document.createElement("img");
|
|
2521
|
-
logoImg.id = "deepdots-popup-logo";
|
|
2522
|
-
logoImg.src = s.logo;
|
|
2523
|
-
logoImg.alt = "Logo";
|
|
2524
|
-
logoImg.style.cssText = "max-height:40px; max-width:100%; object-fit:contain;";
|
|
2525
|
-
if (s.logoSize) {
|
|
2526
|
-
switch (s.logoSize) {
|
|
2527
|
-
case "small":
|
|
2528
|
-
logoImg.style.maxHeight = "30px";
|
|
2529
|
-
break;
|
|
2530
|
-
case "medium":
|
|
2531
|
-
logoImg.style.maxHeight = "50px";
|
|
2532
|
-
break;
|
|
2533
|
-
case "large":
|
|
2534
|
-
logoImg.style.maxHeight = "70px";
|
|
2535
|
-
break;
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
if (s.logoPosition) {
|
|
2539
|
-
switch (s.logoPosition) {
|
|
2540
|
-
case "left":
|
|
2541
|
-
logoImg.style.margin = "0 16px 42px 0";
|
|
2542
|
-
logoImg.style.display = "block";
|
|
2543
|
-
logoImg.style.marginLeft = "0";
|
|
2544
|
-
break;
|
|
2545
|
-
case "right":
|
|
2546
|
-
logoImg.style.margin = "0 0 42px 16px";
|
|
2547
|
-
logoImg.style.display = "block";
|
|
2548
|
-
logoImg.style.marginLeft = "auto";
|
|
2549
|
-
break;
|
|
2550
|
-
case "center":
|
|
2551
|
-
logoImg.style.margin = "0 auto 42px auto";
|
|
2552
|
-
logoImg.style.display = "block";
|
|
2553
|
-
break;
|
|
2554
|
-
}
|
|
2555
|
-
}
|
|
2556
|
-
containerContent.insertBefore(logoImg, main);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
3262
|
+
insertPopupLogo(popup, progressEl, s, "deepdots-popup-logo");
|
|
2559
3263
|
if (s.startMessage && s.startMessage !== "") {
|
|
2560
3264
|
sdkLog(s.startMessage);
|
|
2561
3265
|
onStartPage = true;
|
|
@@ -2623,4 +3327,4 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
|
|
|
2623
3327
|
export {
|
|
2624
3328
|
renderPopup
|
|
2625
3329
|
};
|
|
2626
|
-
//# sourceMappingURL=renderPopup-
|
|
3330
|
+
//# sourceMappingURL=renderPopup-M6MKTDEH.mjs.map
|