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