@encatch/web-sdk 0.0.35 → 1.0.0-beta.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/README.md +140 -638
- package/dist/encatch.es.js +2 -0
- package/dist/encatch.es.js.map +1 -0
- package/dist/encatch.iife.js +2 -0
- package/dist/encatch.iife.js.map +1 -0
- package/dist/index.d.ts +191 -0
- package/package.json +32 -50
- package/dist-sdk/plugin/sdk/core-wrapper-BMvOyc0u.js +0 -22926
- package/dist-sdk/plugin/sdk/module-DC2Edddk.js +0 -481
- package/dist-sdk/plugin/sdk/module.js +0 -5
- package/dist-sdk/plugin/sdk/preview-sdk.html +0 -1182
- package/dist-sdk/plugin/sdk/vite.svg +0 -15
- package/dist-sdk/plugin/sdk/web-form-engine-core.css +0 -1
- package/index.d.ts +0 -207
- package/src/@types/encatch-type.ts +0 -111
- package/src/encatch-instance.ts +0 -161
- package/src/feedback-api-types.ts +0 -18
- package/src/hooks/useDevice.ts +0 -30
- package/src/hooks/useFeedbackInterval.ts +0 -71
- package/src/hooks/useFeedbackTriggers.ts +0 -342
- package/src/hooks/useFetchElligibleFeedbackConfiguration.ts +0 -363
- package/src/hooks/useFetchFeedbackConfigurationDetails.ts +0 -92
- package/src/hooks/usePageChangeTracker.ts +0 -88
- package/src/hooks/usePrepopulatedAnswers.ts +0 -123
- package/src/hooks/useRefineTextForm.ts +0 -55
- package/src/hooks/useSubmitFeedbackForm.ts +0 -134
- package/src/hooks/useUserSession.ts +0 -53
- package/src/module.tsx +0 -428
- package/src/store/formResponses.ts +0 -211
- package/src/utils/browser-details.ts +0 -36
- package/src/utils/duration-utils.ts +0 -158
- package/src/utils/feedback-frequency-storage.ts +0 -214
- package/src/utils/feedback-storage.ts +0 -166
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
var $, p, te, ue, F, Q, ne, ie, se, K, z, j, I = {}, oe = [], de = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, W = Array.isArray;
|
|
2
|
-
function k(t, e) {
|
|
3
|
-
for (var n in e) t[n] = e[n];
|
|
4
|
-
return t;
|
|
5
|
-
}
|
|
6
|
-
function V(t) {
|
|
7
|
-
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
|
-
}
|
|
9
|
-
function he(t, e, n) {
|
|
10
|
-
var i, r, s, _ = {};
|
|
11
|
-
for (s in e) s == "key" ? i = e[s] : s == "ref" ? r = e[s] : _[s] = e[s];
|
|
12
|
-
if (arguments.length > 2 && (_.children = arguments.length > 3 ? $.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) _[s] === void 0 && (_[s] = t.defaultProps[s]);
|
|
13
|
-
return T(t, _, i, r, null);
|
|
14
|
-
}
|
|
15
|
-
function T(t, e, n, i, r) {
|
|
16
|
-
var s = { type: t, props: e, key: n, ref: i, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: r ?? ++te, __i: -1, __u: 0 };
|
|
17
|
-
return r == null && p.vnode != null && p.vnode(s), s;
|
|
18
|
-
}
|
|
19
|
-
function H(t) {
|
|
20
|
-
return t.children;
|
|
21
|
-
}
|
|
22
|
-
function B(t, e) {
|
|
23
|
-
this.props = t, this.context = e;
|
|
24
|
-
}
|
|
25
|
-
function P(t, e) {
|
|
26
|
-
if (e == null) return t.__ ? P(t.__, t.__i + 1) : null;
|
|
27
|
-
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
28
|
-
return typeof t.type == "function" ? P(t) : null;
|
|
29
|
-
}
|
|
30
|
-
function re(t) {
|
|
31
|
-
var e, n;
|
|
32
|
-
if ((t = t.__) != null && t.__c != null) {
|
|
33
|
-
for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
|
|
34
|
-
t.__e = t.__c.base = n.__e;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
return re(t);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function X(t) {
|
|
41
|
-
(!t.__d && (t.__d = !0) && F.push(t) && !A.__r++ || Q != p.debounceRendering) && ((Q = p.debounceRendering) || ne)(A);
|
|
42
|
-
}
|
|
43
|
-
function A() {
|
|
44
|
-
for (var t, e, n, i, r, s, _, a = 1; F.length; ) F.length > a && F.sort(ie), t = F.shift(), a = F.length, t.__d && (n = void 0, i = void 0, r = (i = (e = t).__v).__e, s = [], _ = [], e.__P && ((n = k({}, i)).__v = i.__v + 1, p.vnode && p.vnode(n), q(e.__P, n, i, e.__n, e.__P.namespaceURI, 32 & i.__u ? [r] : null, s, r ?? P(i), !!(32 & i.__u), _), n.__v = i.__v, n.__.__k[n.__i] = n, ae(s, n, _), i.__e = i.__ = null, n.__e != r && re(n)));
|
|
45
|
-
A.__r = 0;
|
|
46
|
-
}
|
|
47
|
-
function _e(t, e, n, i, r, s, _, a, f, c, u) {
|
|
48
|
-
var o, m, l, g, y, v, d, h = i && i.__k || oe, S = e.length;
|
|
49
|
-
for (f = pe(n, e, h, f, S), o = 0; o < S; o++) (l = n.__k[o]) != null && (m = l.__i == -1 ? I : h[l.__i] || I, l.__i = o, v = q(t, l, m, r, s, _, a, f, c, u), g = l.__e, l.ref && m.ref != l.ref && (m.ref && G(m.ref, null, l), u.push(l.ref, l.__c || g, l)), y == null && g != null && (y = g), (d = !!(4 & l.__u)) || m.__k === l.__k ? f = ce(l, f, t, d) : typeof l.type == "function" && v !== void 0 ? f = v : g && (f = g.nextSibling), l.__u &= -7);
|
|
50
|
-
return n.__e = y, f;
|
|
51
|
-
}
|
|
52
|
-
function pe(t, e, n, i, r) {
|
|
53
|
-
var s, _, a, f, c, u = n.length, o = u, m = 0;
|
|
54
|
-
for (t.__k = new Array(r), s = 0; s < r; s++) (_ = e[s]) != null && typeof _ != "boolean" && typeof _ != "function" ? (f = s + m, (_ = t.__k[s] = typeof _ == "string" || typeof _ == "number" || typeof _ == "bigint" || _.constructor == String ? T(null, _, null, null, null) : W(_) ? T(H, { children: _ }, null, null, null) : _.constructor == null && _.__b > 0 ? T(_.type, _.props, _.key, _.ref ? _.ref : null, _.__v) : _).__ = t, _.__b = t.__b + 1, a = null, (c = _.__i = me(_, n, f, o)) != -1 && (o--, (a = n[c]) && (a.__u |= 2)), a == null || a.__v == null ? (c == -1 && (r > u ? m-- : r < u && m++), typeof _.type != "function" && (_.__u |= 4)) : c != f && (c == f - 1 ? m-- : c == f + 1 ? m++ : (c > f ? m-- : m++, _.__u |= 4))) : t.__k[s] = null;
|
|
55
|
-
if (o) for (s = 0; s < u; s++) (a = n[s]) != null && (2 & a.__u) == 0 && (a.__e == i && (i = P(a)), fe(a, a));
|
|
56
|
-
return i;
|
|
57
|
-
}
|
|
58
|
-
function ce(t, e, n, i) {
|
|
59
|
-
var r, s;
|
|
60
|
-
if (typeof t.type == "function") {
|
|
61
|
-
for (r = t.__k, s = 0; r && s < r.length; s++) r[s] && (r[s].__ = t, e = ce(r[s], e, n, i));
|
|
62
|
-
return e;
|
|
63
|
-
}
|
|
64
|
-
t.__e != e && (i && (e && t.type && !e.parentNode && (e = P(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
|
|
65
|
-
do
|
|
66
|
-
e = e && e.nextSibling;
|
|
67
|
-
while (e != null && e.nodeType == 8);
|
|
68
|
-
return e;
|
|
69
|
-
}
|
|
70
|
-
function me(t, e, n, i) {
|
|
71
|
-
var r, s, _, a = t.key, f = t.type, c = e[n], u = c != null && (2 & c.__u) == 0;
|
|
72
|
-
if (c === null && t.key == null || u && a == c.key && f == c.type) return n;
|
|
73
|
-
if (i > (u ? 1 : 0)) {
|
|
74
|
-
for (r = n - 1, s = n + 1; r >= 0 || s < e.length; ) if ((c = e[_ = r >= 0 ? r-- : s++]) != null && (2 & c.__u) == 0 && a == c.key && f == c.type) return _;
|
|
75
|
-
}
|
|
76
|
-
return -1;
|
|
77
|
-
}
|
|
78
|
-
function Y(t, e, n) {
|
|
79
|
-
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || de.test(e) ? n : n + "px";
|
|
80
|
-
}
|
|
81
|
-
function U(t, e, n, i, r) {
|
|
82
|
-
var s, _;
|
|
83
|
-
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
84
|
-
else {
|
|
85
|
-
if (typeof i == "string" && (t.style.cssText = i = ""), i) for (e in i) n && e in n || Y(t.style, e, "");
|
|
86
|
-
if (n) for (e in n) i && n[e] == i[e] || Y(t.style, e, n[e]);
|
|
87
|
-
}
|
|
88
|
-
else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(se, "$1")), _ = e.toLowerCase(), e = _ in t || e == "onFocusOut" || e == "onFocusIn" ? _.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = n, n ? i ? n.u = i.u : (n.u = K, t.addEventListener(e, s ? j : z, s)) : t.removeEventListener(e, s ? j : z, s);
|
|
89
|
-
else {
|
|
90
|
-
if (r == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
91
|
-
else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
|
|
92
|
-
t[e] = n ?? "";
|
|
93
|
-
break e;
|
|
94
|
-
} catch {
|
|
95
|
-
}
|
|
96
|
-
typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function Z(t) {
|
|
100
|
-
return function(e) {
|
|
101
|
-
if (this.l) {
|
|
102
|
-
var n = this.l[e.type + t];
|
|
103
|
-
if (e.t == null) e.t = K++;
|
|
104
|
-
else if (e.t < n.u) return;
|
|
105
|
-
return n(p.event ? p.event(e) : e);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function q(t, e, n, i, r, s, _, a, f, c) {
|
|
110
|
-
var u, o, m, l, g, y, v, d, h, S, w, M, x, J, L, D, O, b = e.type;
|
|
111
|
-
if (e.constructor != null) return null;
|
|
112
|
-
128 & n.__u && (f = !!(32 & n.__u), s = [a = e.__e = n.__e]), (u = p.__b) && u(e);
|
|
113
|
-
e: if (typeof b == "function") try {
|
|
114
|
-
if (d = e.props, h = "prototype" in b && b.prototype.render, S = (u = b.contextType) && i[u.__c], w = u ? S ? S.props.value : u.__ : i, n.__c ? v = (o = e.__c = n.__c).__ = o.__E : (h ? e.__c = o = new b(d, w) : (e.__c = o = new B(d, w), o.constructor = b, o.render = ve), S && S.sub(o), o.props = d, o.state || (o.state = {}), o.context = w, o.__n = i, m = o.__d = !0, o.__h = [], o._sb = []), h && o.__s == null && (o.__s = o.state), h && b.getDerivedStateFromProps != null && (o.__s == o.state && (o.__s = k({}, o.__s)), k(o.__s, b.getDerivedStateFromProps(d, o.__s))), l = o.props, g = o.state, o.__v = e, m) h && b.getDerivedStateFromProps == null && o.componentWillMount != null && o.componentWillMount(), h && o.componentDidMount != null && o.__h.push(o.componentDidMount);
|
|
115
|
-
else {
|
|
116
|
-
if (h && b.getDerivedStateFromProps == null && d !== l && o.componentWillReceiveProps != null && o.componentWillReceiveProps(d, w), !o.__e && o.shouldComponentUpdate != null && o.shouldComponentUpdate(d, o.__s, w) === !1 || e.__v == n.__v) {
|
|
117
|
-
for (e.__v != n.__v && (o.props = d, o.state = o.__s, o.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(C) {
|
|
118
|
-
C && (C.__ = e);
|
|
119
|
-
}), M = 0; M < o._sb.length; M++) o.__h.push(o._sb[M]);
|
|
120
|
-
o._sb = [], o.__h.length && _.push(o);
|
|
121
|
-
break e;
|
|
122
|
-
}
|
|
123
|
-
o.componentWillUpdate != null && o.componentWillUpdate(d, o.__s, w), h && o.componentDidUpdate != null && o.__h.push(function() {
|
|
124
|
-
o.componentDidUpdate(l, g, y);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
if (o.context = w, o.props = d, o.__P = t, o.__e = !1, x = p.__r, J = 0, h) {
|
|
128
|
-
for (o.state = o.__s, o.__d = !1, x && x(e), u = o.render(o.props, o.state, o.context), L = 0; L < o._sb.length; L++) o.__h.push(o._sb[L]);
|
|
129
|
-
o._sb = [];
|
|
130
|
-
} else do
|
|
131
|
-
o.__d = !1, x && x(e), u = o.render(o.props, o.state, o.context), o.state = o.__s;
|
|
132
|
-
while (o.__d && ++J < 25);
|
|
133
|
-
o.state = o.__s, o.getChildContext != null && (i = k(k({}, i), o.getChildContext())), h && !m && o.getSnapshotBeforeUpdate != null && (y = o.getSnapshotBeforeUpdate(l, g)), D = u, u != null && u.type === H && u.key == null && (D = le(u.props.children)), a = _e(t, W(D) ? D : [D], e, n, i, r, s, _, a, f, c), o.base = e.__e, e.__u &= -161, o.__h.length && _.push(o), v && (o.__E = o.__ = null);
|
|
134
|
-
} catch (C) {
|
|
135
|
-
if (e.__v = null, f || s != null) if (C.then) {
|
|
136
|
-
for (e.__u |= f ? 160 : 128; a && a.nodeType == 8 && a.nextSibling; ) a = a.nextSibling;
|
|
137
|
-
s[s.indexOf(a)] = null, e.__e = a;
|
|
138
|
-
} else {
|
|
139
|
-
for (O = s.length; O--; ) V(s[O]);
|
|
140
|
-
R(e);
|
|
141
|
-
}
|
|
142
|
-
else e.__e = n.__e, e.__k = n.__k, C.then || R(e);
|
|
143
|
-
p.__e(C, e, n);
|
|
144
|
-
}
|
|
145
|
-
else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : a = e.__e = ge(n.__e, e, n, i, r, s, _, f, c);
|
|
146
|
-
return (u = p.diffed) && u(e), 128 & e.__u ? void 0 : a;
|
|
147
|
-
}
|
|
148
|
-
function R(t) {
|
|
149
|
-
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(R);
|
|
150
|
-
}
|
|
151
|
-
function ae(t, e, n) {
|
|
152
|
-
for (var i = 0; i < n.length; i++) G(n[i], n[++i], n[++i]);
|
|
153
|
-
p.__c && p.__c(e, t), t.some(function(r) {
|
|
154
|
-
try {
|
|
155
|
-
t = r.__h, r.__h = [], t.some(function(s) {
|
|
156
|
-
s.call(r);
|
|
157
|
-
});
|
|
158
|
-
} catch (s) {
|
|
159
|
-
p.__e(s, r.__v);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
function le(t) {
|
|
164
|
-
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : W(t) ? t.map(le) : k({}, t);
|
|
165
|
-
}
|
|
166
|
-
function ge(t, e, n, i, r, s, _, a, f) {
|
|
167
|
-
var c, u, o, m, l, g, y, v = n.props, d = e.props, h = e.type;
|
|
168
|
-
if (h == "svg" ? r = "http://www.w3.org/2000/svg" : h == "math" ? r = "http://www.w3.org/1998/Math/MathML" : r || (r = "http://www.w3.org/1999/xhtml"), s != null) {
|
|
169
|
-
for (c = 0; c < s.length; c++) if ((l = s[c]) && "setAttribute" in l == !!h && (h ? l.localName == h : l.nodeType == 3)) {
|
|
170
|
-
t = l, s[c] = null;
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (t == null) {
|
|
175
|
-
if (h == null) return document.createTextNode(d);
|
|
176
|
-
t = document.createElementNS(r, h, d.is && d), a && (p.__m && p.__m(e, s), a = !1), s = null;
|
|
177
|
-
}
|
|
178
|
-
if (h == null) v === d || a && t.data == d || (t.data = d);
|
|
179
|
-
else {
|
|
180
|
-
if (s = s && $.call(t.childNodes), v = n.props || I, !a && s != null) for (v = {}, c = 0; c < t.attributes.length; c++) v[(l = t.attributes[c]).name] = l.value;
|
|
181
|
-
for (c in v) if (l = v[c], c != "children") {
|
|
182
|
-
if (c == "dangerouslySetInnerHTML") o = l;
|
|
183
|
-
else if (!(c in d)) {
|
|
184
|
-
if (c == "value" && "defaultValue" in d || c == "checked" && "defaultChecked" in d) continue;
|
|
185
|
-
U(t, c, null, l, r);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
for (c in d) l = d[c], c == "children" ? m = l : c == "dangerouslySetInnerHTML" ? u = l : c == "value" ? g = l : c == "checked" ? y = l : a && typeof l != "function" || v[c] === l || U(t, c, l, v[c], r);
|
|
189
|
-
if (u) a || o && (u.__html == o.__html || u.__html == t.innerHTML) || (t.innerHTML = u.__html), e.__k = [];
|
|
190
|
-
else if (o && (t.innerHTML = ""), _e(e.type == "template" ? t.content : t, W(m) ? m : [m], e, n, i, h == "foreignObject" ? "http://www.w3.org/1999/xhtml" : r, s, _, s ? s[0] : n.__k && P(n, 0), a, f), s != null) for (c = s.length; c--; ) V(s[c]);
|
|
191
|
-
a || (c = "value", h == "progress" && g == null ? t.removeAttribute("value") : g != null && (g !== t[c] || h == "progress" && !g || h == "option" && g != v[c]) && U(t, c, g, v[c], r), c = "checked", y != null && y != t[c] && U(t, c, y, v[c], r));
|
|
192
|
-
}
|
|
193
|
-
return t;
|
|
194
|
-
}
|
|
195
|
-
function G(t, e, n) {
|
|
196
|
-
try {
|
|
197
|
-
if (typeof t == "function") {
|
|
198
|
-
var i = typeof t.__u == "function";
|
|
199
|
-
i && t.__u(), i && e == null || (t.__u = t(e));
|
|
200
|
-
} else t.current = e;
|
|
201
|
-
} catch (r) {
|
|
202
|
-
p.__e(r, n);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
function fe(t, e, n) {
|
|
206
|
-
var i, r;
|
|
207
|
-
if (p.unmount && p.unmount(t), (i = t.ref) && (i.current && i.current != t.__e || G(i, null, e)), (i = t.__c) != null) {
|
|
208
|
-
if (i.componentWillUnmount) try {
|
|
209
|
-
i.componentWillUnmount();
|
|
210
|
-
} catch (s) {
|
|
211
|
-
p.__e(s, e);
|
|
212
|
-
}
|
|
213
|
-
i.base = i.__P = null;
|
|
214
|
-
}
|
|
215
|
-
if (i = t.__k) for (r = 0; r < i.length; r++) i[r] && fe(i[r], e, n || typeof t.type != "function");
|
|
216
|
-
n || V(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
217
|
-
}
|
|
218
|
-
function ve(t, e, n) {
|
|
219
|
-
return this.constructor(t, n);
|
|
220
|
-
}
|
|
221
|
-
function ye(t, e, n) {
|
|
222
|
-
var i, r, s, _;
|
|
223
|
-
e == document && (e = document.documentElement), p.__ && p.__(t, e), r = (i = !1) ? null : e.__k, s = [], _ = [], q(e, t = e.__k = he(H, null, [t]), r || I, I, e.namespaceURI, r ? null : e.firstChild ? $.call(e.childNodes) : null, s, r ? r.__e : e.firstChild, i, _), ae(s, t, _);
|
|
224
|
-
}
|
|
225
|
-
$ = oe.slice, p = { __e: function(t, e, n, i) {
|
|
226
|
-
for (var r, s, _; e = e.__; ) if ((r = e.__c) && !r.__) try {
|
|
227
|
-
if ((s = r.constructor) && s.getDerivedStateFromError != null && (r.setState(s.getDerivedStateFromError(t)), _ = r.__d), r.componentDidCatch != null && (r.componentDidCatch(t, i || {}), _ = r.__d), _) return r.__E = r;
|
|
228
|
-
} catch (a) {
|
|
229
|
-
t = a;
|
|
230
|
-
}
|
|
231
|
-
throw t;
|
|
232
|
-
} }, te = 0, ue = function(t) {
|
|
233
|
-
return t != null && t.constructor == null;
|
|
234
|
-
}, B.prototype.setState = function(t, e) {
|
|
235
|
-
var n;
|
|
236
|
-
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = k({}, this.state), typeof t == "function" && (t = t(k({}, n), this.props)), t && k(n, t), t != null && this.__v && (e && this._sb.push(e), X(this));
|
|
237
|
-
}, B.prototype.forceUpdate = function(t) {
|
|
238
|
-
this.__v && (this.__e = !0, t && this.__h.push(t), X(this));
|
|
239
|
-
}, B.prototype.render = H, F = [], ne = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, ie = function(t, e) {
|
|
240
|
-
return t.__v.__b - e.__v.__b;
|
|
241
|
-
}, A.__r = 0, se = /(PointerCapture)$|Capture$/i, K = 0, z = Z(!1), j = Z(!0);
|
|
242
|
-
var be = 0;
|
|
243
|
-
function ke(t, e, n, i, r, s) {
|
|
244
|
-
e || (e = {});
|
|
245
|
-
var _, a, f = e;
|
|
246
|
-
if ("ref" in f) for (a in f = {}, e) a == "ref" ? _ = e[a] : f[a] = e[a];
|
|
247
|
-
var c = { type: t, props: f, key: n, ref: _, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --be, __i: -1, __u: 0, __source: r, __self: s };
|
|
248
|
-
if (typeof t == "function" && (_ = t.defaultProps)) for (a in _) f[a] === void 0 && (f[a] = _[a]);
|
|
249
|
-
return p.vnode && p.vnode(c), c;
|
|
250
|
-
}
|
|
251
|
-
function Se() {
|
|
252
|
-
const t = {
|
|
253
|
-
_i: [],
|
|
254
|
-
apiKey: "",
|
|
255
|
-
config: {
|
|
256
|
-
host: "https://app.encatch.com",
|
|
257
|
-
autoStartEnabled: !1,
|
|
258
|
-
autoStartSessionDisabled: !0,
|
|
259
|
-
themeMode: "light",
|
|
260
|
-
language: "en",
|
|
261
|
-
customCssLink: ""
|
|
262
|
-
},
|
|
263
|
-
initialized: !1,
|
|
264
|
-
chunkUrlLoader: (n) => t.config.host + n,
|
|
265
|
-
init(n, i) {
|
|
266
|
-
if (!t.initialized && (t.apiKey = n, i?.host && (t.config.host = i.host), i?.autoStartSessionDisabled !== void 0 && (t.config.autoStartSessionDisabled = i.autoStartSessionDisabled), i?.processAfterIdentitySet !== void 0 ? t.config.processAfterIdentitySet = i.processAfterIdentitySet : t.config.processAfterIdentitySet = !1, i?.autoStartEnabled !== void 0 && (t.config.autoStartEnabled = i.autoStartEnabled), i?.themeMode ? t.config.themeMode = i.themeMode : t.config.themeMode = "light", i?.language ? t.config.language = i.language : t.config.language = "en", i?.customCssLink && (t.config.customCssLink = i.customCssLink), i?.setUser && (t.config.setUser = i.setUser), i?.onFormEvent && (t.config.onFormEvent = i.onFormEvent), i?.customProperties && (t.config.customProperties = i.customProperties), i?.onSessionDisabled && (t.config.onSessionDisabled = i.onSessionDisabled), t.initialized = !0, typeof window < "u")) {
|
|
267
|
-
let r = "";
|
|
268
|
-
r && !r.startsWith("/") && (r = "/" + r), r = r.replace(/\/+$/, "");
|
|
269
|
-
const s = `${t.config.host}${r}/encatch-web-sdk.js`, _ = document.createElement("script");
|
|
270
|
-
_.src = s, _.type = "module", _.async = !0;
|
|
271
|
-
const a = document.head.firstChild;
|
|
272
|
-
a ? document.head.insertBefore(_, a) : document.head.appendChild(_);
|
|
273
|
-
const f = document.createElement("div");
|
|
274
|
-
f.id = "enisght-root", document.body.appendChild(f);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}, e = [
|
|
278
|
-
"trackEvent",
|
|
279
|
-
"stop",
|
|
280
|
-
"start",
|
|
281
|
-
"setUser",
|
|
282
|
-
"setThemeMode",
|
|
283
|
-
"setLanguage",
|
|
284
|
-
"setCustomProperties",
|
|
285
|
-
"openFeedbackById",
|
|
286
|
-
"openFeedbackByName",
|
|
287
|
-
"verifyFeedbackIds",
|
|
288
|
-
"forceFetchEligibleFeedbacks",
|
|
289
|
-
"capturePageScrollEvent"
|
|
290
|
-
];
|
|
291
|
-
return t._eventSubscriptions = [], t.on = ((n, i) => {
|
|
292
|
-
const r = { eventType: n, callback: i };
|
|
293
|
-
return t._eventSubscriptions.push(r), () => {
|
|
294
|
-
const s = t._eventSubscriptions.indexOf(r);
|
|
295
|
-
s > -1 && t._eventSubscriptions.splice(s, 1);
|
|
296
|
-
};
|
|
297
|
-
}), e.forEach((n) => {
|
|
298
|
-
t[n] = ((...i) => {
|
|
299
|
-
t._i.push([n, ...i]);
|
|
300
|
-
});
|
|
301
|
-
}), t;
|
|
302
|
-
}
|
|
303
|
-
let ee = !1;
|
|
304
|
-
async function we() {
|
|
305
|
-
if (!(ee || typeof window > "u" || typeof document > "u")) {
|
|
306
|
-
ee = !0;
|
|
307
|
-
try {
|
|
308
|
-
const t = (await import("./core-wrapper-BMvOyc0u.js")).default;
|
|
309
|
-
if (typeof document > "u") return;
|
|
310
|
-
let e = document.getElementById("enisght-root");
|
|
311
|
-
!e && document.body && (e = document.createElement("div"), e.id = "enisght-root", document.body.appendChild(e)), e && ye(/* @__PURE__ */ ke(t, {}), e);
|
|
312
|
-
} catch (t) {
|
|
313
|
-
console.error("Failed to load Encatch core:", t);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
let E = null;
|
|
318
|
-
class N {
|
|
319
|
-
constructor() {
|
|
320
|
-
if (this.instance = Se(), typeof window < "u" && (window.encatch || (window.encatch = this.instance)), typeof window < "u" && typeof document < "u" && !document.getElementById("enisght-root")) {
|
|
321
|
-
const e = document.createElement("div");
|
|
322
|
-
e.id = "enisght-root", document.body ? document.body.appendChild(e) : document.readyState === "loading" && document.addEventListener("DOMContentLoaded", () => {
|
|
323
|
-
!document.getElementById("enisght-root") && document.body && document.body.appendChild(e);
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Static method to initialize the default Encatch instance
|
|
329
|
-
* This provides a convenient API: Encatch.init(apiKey, options)
|
|
330
|
-
*/
|
|
331
|
-
static init(e, n) {
|
|
332
|
-
return E || (E = new N()), E.init(e, n), E;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Get the default singleton instance
|
|
336
|
-
*/
|
|
337
|
-
static getInstance() {
|
|
338
|
-
return E || (E = new N()), E;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Initialize the Encatch SDK
|
|
342
|
-
* SSR-safe: Can be called on server, but only initializes in browser
|
|
343
|
-
*/
|
|
344
|
-
init(e, n) {
|
|
345
|
-
if (typeof window > "u" || typeof document > "u") {
|
|
346
|
-
this.instance.apiKey = e, n && Object.assign(this.instance.config, n);
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
this.instance.initialized || (this.instance.apiKey = e, this.instance.config.host = n?.host || "https://app.encatch.com", n?.autoStartSessionDisabled !== void 0 && (this.instance.config.autoStartSessionDisabled = n.autoStartSessionDisabled), n?.processAfterIdentitySet !== void 0 ? this.instance.config.processAfterIdentitySet = n.processAfterIdentitySet : this.instance.config.processAfterIdentitySet = !1, n?.autoStartEnabled !== void 0 && (this.instance.config.autoStartEnabled = n.autoStartEnabled), n?.themeMode ? this.instance.config.themeMode = n.themeMode : this.instance.config.themeMode = "light", n?.language ? this.instance.config.language = n.language : this.instance.config.language = "en", n?.customCssLink && (this.instance.config.customCssLink = n.customCssLink), n?.setUser && (this.instance.config.setUser = n.setUser), n?.onFormEvent && (this.instance.config.onFormEvent = n.onFormEvent), n?.customProperties && (this.instance.config.customProperties = n.customProperties), n?.onSessionDisabled && (this.instance.config.onSessionDisabled = n.onSessionDisabled), this.instance.initialized = !0, typeof window < "u" && (window.encatch = this.instance), we());
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Track a custom event
|
|
353
|
-
*/
|
|
354
|
-
trackEvent(e, n) {
|
|
355
|
-
this.instance.trackEvent ? this.instance.trackEvent(e, n) : this.instance._i.push(["trackEvent", e, n]);
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Start the SDK session
|
|
359
|
-
*/
|
|
360
|
-
start(e, n) {
|
|
361
|
-
this.instance.start ? this.instance.start(e, n) : this.instance._i.push(["start", e, n]);
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Stop the SDK session
|
|
365
|
-
*/
|
|
366
|
-
stop() {
|
|
367
|
-
this.instance.stop ? this.instance.stop() : this.instance._i.push(["stop"]);
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Set or update user identity
|
|
371
|
-
*/
|
|
372
|
-
setUser(e, n) {
|
|
373
|
-
this.instance.setUser ? this.instance.setUser(e, n) : this.instance._i.push(["setUser", e, n]);
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Set theme mode
|
|
377
|
-
*/
|
|
378
|
-
setThemeMode(e) {
|
|
379
|
-
this.instance.setThemeMode ? this.instance.setThemeMode(e) : this.instance._i.push(["setThemeMode", e]);
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Set language
|
|
383
|
-
*/
|
|
384
|
-
setLanguage(e) {
|
|
385
|
-
this.instance.setLanguage ? this.instance.setLanguage(e) : this.instance._i.push(["setLanguage", e]);
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Set custom properties
|
|
389
|
-
*/
|
|
390
|
-
setCustomProperties(e) {
|
|
391
|
-
this.instance.setCustomProperties ? this.instance.setCustomProperties(e) : this.instance._i.push(["setCustomProperties", e]);
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Open feedback by configuration ID
|
|
395
|
-
*/
|
|
396
|
-
openFeedbackById(e, n, i, r, s, _) {
|
|
397
|
-
this.instance.openFeedbackById ? this.instance.openFeedbackById(
|
|
398
|
-
e,
|
|
399
|
-
n,
|
|
400
|
-
i,
|
|
401
|
-
r,
|
|
402
|
-
s,
|
|
403
|
-
_
|
|
404
|
-
) : this.instance._i.push([
|
|
405
|
-
"openFeedbackById",
|
|
406
|
-
e,
|
|
407
|
-
n,
|
|
408
|
-
i,
|
|
409
|
-
r,
|
|
410
|
-
s,
|
|
411
|
-
_
|
|
412
|
-
]);
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Open feedback by configuration name
|
|
416
|
-
*/
|
|
417
|
-
openFeedbackByName(e, n, i, r, s, _) {
|
|
418
|
-
this.instance.openFeedbackByName ? this.instance.openFeedbackByName(
|
|
419
|
-
e,
|
|
420
|
-
n,
|
|
421
|
-
i,
|
|
422
|
-
r,
|
|
423
|
-
s,
|
|
424
|
-
_
|
|
425
|
-
) : this.instance._i.push([
|
|
426
|
-
"openFeedbackByName",
|
|
427
|
-
e,
|
|
428
|
-
n,
|
|
429
|
-
i,
|
|
430
|
-
r,
|
|
431
|
-
s,
|
|
432
|
-
_
|
|
433
|
-
]);
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Verify which feedback IDs are eligible
|
|
437
|
-
*/
|
|
438
|
-
verifyFeedbackIds(e) {
|
|
439
|
-
return this.instance.verifyFeedbackIds ? this.instance.verifyFeedbackIds(e) : [];
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Force fetch eligible feedbacks
|
|
443
|
-
*/
|
|
444
|
-
async forceFetchEligibleFeedbacks() {
|
|
445
|
-
return this.instance.forceFetchEligibleFeedbacks ? this.instance.forceFetchEligibleFeedbacks() : Promise.resolve();
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Capture page scroll event
|
|
449
|
-
*/
|
|
450
|
-
capturePageScrollEvent(e) {
|
|
451
|
-
this.instance.capturePageScrollEvent ? this.instance.capturePageScrollEvent(e) : this.instance._i.push(["capturePageScrollEvent", e]);
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Subscribe to form events
|
|
455
|
-
*/
|
|
456
|
-
on(e, n) {
|
|
457
|
-
if (this.instance.on)
|
|
458
|
-
return this.instance.on(e, n);
|
|
459
|
-
const i = { eventType: e, callback: n };
|
|
460
|
-
return this.instance._eventSubscriptions = this.instance._eventSubscriptions || [], this.instance._eventSubscriptions.push(i), () => {
|
|
461
|
-
const r = this.instance._eventSubscriptions?.indexOf(i);
|
|
462
|
-
r !== void 0 && r > -1 && this.instance._eventSubscriptions?.splice(r, 1);
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Get the internal instance (for advanced usage)
|
|
467
|
-
*/
|
|
468
|
-
getInstance() {
|
|
469
|
-
return this.instance;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
const Ee = typeof window < "u" ? new N() : null;
|
|
473
|
-
export {
|
|
474
|
-
N as E,
|
|
475
|
-
Ee as e,
|
|
476
|
-
H as k,
|
|
477
|
-
p as l,
|
|
478
|
-
ue as t,
|
|
479
|
-
ke as u,
|
|
480
|
-
B as x
|
|
481
|
-
};
|