@brainfish-ai/widgets-initiator 1.11.0-alpha.1 → 1.11.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/web.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
1
|
+
var je = Object.defineProperty, Le = Object.defineProperties;
|
|
2
2
|
var Fe = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var me = Object.getOwnPropertySymbols;
|
|
4
4
|
var He = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var L = (r, t, n) => t in r ? je(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n, F = (r, t) => {
|
|
6
6
|
for (var n in t || (t = {}))
|
|
7
|
-
He.call(t, n) &&
|
|
7
|
+
He.call(t, n) && L(r, n, t[n]);
|
|
8
8
|
if (me)
|
|
9
9
|
for (var n of me(t))
|
|
10
|
-
$e.call(t, n) &&
|
|
10
|
+
$e.call(t, n) && L(r, n, t[n]);
|
|
11
11
|
return r;
|
|
12
|
-
}, H = (r, t) =>
|
|
13
|
-
var
|
|
12
|
+
}, H = (r, t) => Le(r, Fe(t));
|
|
13
|
+
var E = (r, t, n) => L(r, typeof t != "symbol" ? t + "" : t, n);
|
|
14
14
|
var v = (r, t, n) => new Promise((d, i) => {
|
|
15
15
|
var a = (l) => {
|
|
16
16
|
try {
|
|
@@ -27,20 +27,20 @@ var v = (r, t, n) => new Promise((d, i) => {
|
|
|
27
27
|
}, s = (l) => l.done ? d(l.value) : Promise.resolve(l.value).then(a, e);
|
|
28
28
|
s((n = n.apply(r, t)).next());
|
|
29
29
|
});
|
|
30
|
-
var
|
|
30
|
+
var S, z;
|
|
31
31
|
(function() {
|
|
32
32
|
try {
|
|
33
33
|
var r = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, t = new r.Error().stack;
|
|
34
|
-
t && (r._sentryDebugIds = r._sentryDebugIds || {}, r._sentryDebugIds[t] = "
|
|
34
|
+
t && (r._sentryDebugIds = r._sentryDebugIds || {}, r._sentryDebugIds[t] = "f40f135d-53a2-4a4c-85d9-76eb82e60760", r._sentryDebugIdIdentifier = "sentry-dbid-f40f135d-53a2-4a4c-85d9-76eb82e60760");
|
|
35
35
|
} catch (n) {
|
|
36
36
|
}
|
|
37
|
-
})(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "
|
|
38
|
-
r.Sidebar = "sidebar", r.Searchbar = "searchbar";
|
|
39
|
-
}(
|
|
37
|
+
})(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "4df95e9ce81e4f6919ae4d1bbf6331ee4ce62c2f" }, function(r) {
|
|
38
|
+
r.Sidebar = "sidebar", r.Searchbar = "searchbar", r.Popup = "popup";
|
|
39
|
+
}(S || (S = {})), S.Sidebar, S.Searchbar, S.Popup;
|
|
40
40
|
class le extends Error {
|
|
41
41
|
constructor(n, d) {
|
|
42
42
|
super(n, d);
|
|
43
|
-
|
|
43
|
+
E(this, "cause");
|
|
44
44
|
this.name = "BrainfishWidgetError", this.cause = d == null ? void 0 : d.cause, Error.captureStackTrace && Error.captureStackTrace(this, le), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
|
|
45
45
|
Caused by: ` + this.cause.stack);
|
|
46
46
|
}
|
|
@@ -51,7 +51,7 @@ Caused by: ` + this.cause.stack);
|
|
|
51
51
|
(function(r) {
|
|
52
52
|
r.LINK = "link", r.CALLBACK = "callback", r.EMAIL = "email", r.PHONE = "phone";
|
|
53
53
|
})(z || (z = {}));
|
|
54
|
-
const
|
|
54
|
+
const _ = (r, t, n, d) => {
|
|
55
55
|
let i = n, a = {};
|
|
56
56
|
if (t instanceof Error) try {
|
|
57
57
|
a = JSON.parse(t.message), i += ` - ${a.message || t.message}`;
|
|
@@ -62,7 +62,7 @@ const S = (r, t, n, d) => {
|
|
|
62
62
|
((e, s, l) => {
|
|
63
63
|
if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
|
|
64
64
|
const o = s.toJSON();
|
|
65
|
-
fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": l }, body: JSON.stringify({ error: `WebWidgetVersion: 1.11.0
|
|
65
|
+
fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": l }, body: JSON.stringify({ error: `WebWidgetVersion: 1.11.0. ${s.message}`, stack: s.stack, cause: { message: o.message, stack: o.stack, cause: o.cause } }) });
|
|
66
66
|
})(r, new le(i, { cause: a }), d);
|
|
67
67
|
}, Re = (r) => v(void 0, null, function* () {
|
|
68
68
|
let { widgetKey: t, apiHost: n } = r;
|
|
@@ -76,7 +76,7 @@ const S = (r, t, n, d) => {
|
|
|
76
76
|
if (!o) throw new Error("Error loading config: empty response");
|
|
77
77
|
return o;
|
|
78
78
|
} catch (l) {
|
|
79
|
-
if (e = l, s++, s >= 3) throw
|
|
79
|
+
if (e = l, s++, s >= 3) throw _(d, l, "Error fetching config", a), e;
|
|
80
80
|
yield new Promise((o) => setTimeout(o, 500));
|
|
81
81
|
}
|
|
82
82
|
});
|
|
@@ -112,7 +112,7 @@ const S = (r, t, n, d) => {
|
|
|
112
112
|
});
|
|
113
113
|
}))(a) };
|
|
114
114
|
} catch (i) {
|
|
115
|
-
|
|
115
|
+
_(t, i, i.message, n);
|
|
116
116
|
}
|
|
117
117
|
}), be = /* @__PURE__ */ new Set(), Ne = (r, t) => v(void 0, null, function* () {
|
|
118
118
|
const n = ue(r.overrides);
|
|
@@ -129,18 +129,18 @@ const S = (r, t, n, d) => {
|
|
|
129
129
|
return o.forEach((c) => u.set(c.label, c)), Array.from(u.values());
|
|
130
130
|
}(t.settings[s], l));
|
|
131
131
|
}), function(e, s) {
|
|
132
|
-
s.widgetType ===
|
|
132
|
+
s.widgetType === S.Searchbar || s.widgetType === "Search" ? e.SearchWidget.initStandard(s) : e.HelpWidget.initPopup(s);
|
|
133
133
|
}(i, a), be.add(r.widgetKey), i;
|
|
134
134
|
}
|
|
135
135
|
} catch (d) {
|
|
136
|
-
|
|
136
|
+
_(n, d, d.message, r.widgetKey);
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
let ve = !1;
|
|
140
140
|
const qe = function(d, i, a) {
|
|
141
141
|
return v(this, arguments, function* (r, t, n) {
|
|
142
142
|
let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", s = arguments.length > 4 && arguments[4] !== void 0 && arguments[4], l = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [], o = arguments.length > 6 ? arguments[6] : void 0;
|
|
143
|
-
if (t ||
|
|
143
|
+
if (t || _(n, new Error("Access key is required"), "Access key is required", r), !ve) try {
|
|
144
144
|
const u = (() => {
|
|
145
145
|
if (typeof window == "undefined" || typeof navigator == "undefined") return !1;
|
|
146
146
|
const c = navigator, f = window, g = (c.doNotTrack || f.doNotTrack || c.msDoNotTrack || "0").toString().toLowerCase();
|
|
@@ -150,11 +150,11 @@ const qe = function(d, i, a) {
|
|
|
150
150
|
if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
|
|
151
151
|
const g = document.createElement("script");
|
|
152
152
|
g.id = "brainfish-analytics", g.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@latest/dist/tracker.js", g.type = "module", g.async = !0, g.crossOrigin = "anonymous", g.onerror = () => {
|
|
153
|
-
|
|
153
|
+
_(c, new Error(`Failed to load script: ${g.src}`), `Failed to load script: ${g.src}`, f);
|
|
154
154
|
}, document.head.appendChild(g);
|
|
155
155
|
}))(n, r);
|
|
156
156
|
} catch (u) {
|
|
157
|
-
|
|
157
|
+
_(n, u, "Failed to initialize BrainfishAnalytics", r);
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
};
|
|
@@ -166,7 +166,7 @@ function k(r, t) {
|
|
|
166
166
|
d.setAttribute(a, e);
|
|
167
167
|
}), d;
|
|
168
168
|
}
|
|
169
|
-
const
|
|
169
|
+
const P = "bf-iframe-container", j = "bf-trigger-button";
|
|
170
170
|
class y {
|
|
171
171
|
static get isWidgetOpen() {
|
|
172
172
|
return this.isOpen;
|
|
@@ -208,14 +208,14 @@ class y {
|
|
|
208
208
|
(t = this.button) === null || t === void 0 || t.classList.add("hidden");
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
E(y, "isOpen", !1), E(y, "button", null), E(y, "icon", null), E(y, "isButtonHidden", !1);
|
|
212
212
|
function De(r) {
|
|
213
213
|
let { widgetHost: t, apiHost: n, widgetKey: d, signal: i } = r;
|
|
214
214
|
window.addEventListener("message", (a) => {
|
|
215
215
|
if (a.origin !== t) return;
|
|
216
216
|
const { type: e } = a.data;
|
|
217
217
|
if (e === "TOGGLE_WIDGET_SIZE" && function() {
|
|
218
|
-
const s = document.querySelector(`.${
|
|
218
|
+
const s = document.querySelector(`.${P}`);
|
|
219
219
|
s.classList.contains("expanded") ? s.classList.remove("expanded") : s.classList.add("expanded");
|
|
220
220
|
}(), e === "TRACK_EVENT") {
|
|
221
221
|
if (!window.BrainfishAnalytics) return;
|
|
@@ -488,7 +488,7 @@ To pass a single animation please supply them in simple values, e.g. animation('
|
|
|
488
488
|
return u = l, (o = c).prototype = Object.create(u.prototype), o.prototype.constructor = o, i(o, u), c;
|
|
489
489
|
}(n(Error)), r.exports = t.default;
|
|
490
490
|
})(J, J.exports);
|
|
491
|
-
var
|
|
491
|
+
var B = J.exports;
|
|
492
492
|
(function(r, t) {
|
|
493
493
|
t.__esModule = !0, t.default = function(h) {
|
|
494
494
|
if (typeof h != "string") throw new i.default(3);
|
|
@@ -503,8 +503,8 @@ var E = J.exports;
|
|
|
503
503
|
var b = parseFloat((parseInt("" + p[4] + p[4], 16) / 255).toFixed(2));
|
|
504
504
|
return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16), alpha: b };
|
|
505
505
|
}
|
|
506
|
-
var
|
|
507
|
-
if (
|
|
506
|
+
var C = u.exec(p);
|
|
507
|
+
if (C) return { red: parseInt("" + C[1], 10), green: parseInt("" + C[2], 10), blue: parseInt("" + C[3], 10) };
|
|
508
508
|
var w = c.exec(p.substring(0, 50));
|
|
509
509
|
if (w) return { red: parseInt("" + w[1], 10), green: parseInt("" + w[2], 10), blue: parseInt("" + w[3], 10), alpha: parseFloat("" + w[4]) > 1 ? parseFloat("" + w[4]) / 100 : parseFloat("" + w[4]) };
|
|
510
510
|
var I = f.exec(p);
|
|
@@ -515,13 +515,13 @@ var E = J.exports;
|
|
|
515
515
|
}
|
|
516
516
|
var x = g.exec(p.substring(0, 50));
|
|
517
517
|
if (x) {
|
|
518
|
-
var Me = parseInt("" + x[1], 10), We = parseInt("" + x[2], 10) / 100,
|
|
518
|
+
var Me = parseInt("" + x[1], 10), We = parseInt("" + x[2], 10) / 100, Pe = parseInt("" + x[3], 10) / 100, he = "rgb(" + (0, n.default)(Me, We, Pe) + ")", T = u.exec(he);
|
|
519
519
|
if (!T) throw new i.default(4, p, he);
|
|
520
520
|
return { red: parseInt("" + T[1], 10), green: parseInt("" + T[2], 10), blue: parseInt("" + T[3], 10), alpha: parseFloat("" + x[4]) > 1 ? parseFloat("" + x[4]) / 100 : parseFloat("" + x[4]) };
|
|
521
521
|
}
|
|
522
522
|
throw new i.default(5);
|
|
523
523
|
};
|
|
524
|
-
var n = a(ce), d = a(Ue), i = a(
|
|
524
|
+
var n = a(ce), d = a(Ue), i = a(B);
|
|
525
525
|
function a(h) {
|
|
526
526
|
return h && h.__esModule ? h : { default: h };
|
|
527
527
|
}
|
|
@@ -625,7 +625,7 @@ var Ee = te.exports;
|
|
|
625
625
|
if (typeof a == "object" && e === void 0 && s === void 0) return (0, n.default)(a.hue, a.saturation, a.lightness);
|
|
626
626
|
throw new d.default(1);
|
|
627
627
|
};
|
|
628
|
-
var n = i(Ee), d = i(
|
|
628
|
+
var n = i(Ee), d = i(B);
|
|
629
629
|
function i(a) {
|
|
630
630
|
return a && a.__esModule ? a : { default: a };
|
|
631
631
|
}
|
|
@@ -638,7 +638,7 @@ var Ge = ee.exports, ae = { exports: {} };
|
|
|
638
638
|
if (typeof e == "object" && s === void 0 && l === void 0 && o === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, d.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
|
|
639
639
|
throw new i.default(2);
|
|
640
640
|
};
|
|
641
|
-
var n = a(Ee), d = a(ce), i = a(
|
|
641
|
+
var n = a(Ee), d = a(ce), i = a(B);
|
|
642
642
|
function a(e) {
|
|
643
643
|
return e && e.__esModule ? e : { default: e };
|
|
644
644
|
}
|
|
@@ -651,7 +651,7 @@ var Ve = ae.exports, ie = { exports: {} };
|
|
|
651
651
|
if (typeof e == "object" && s === void 0 && l === void 0) return (0, n.default)("#" + (0, d.default)(e.red) + (0, d.default)(e.green) + (0, d.default)(e.blue));
|
|
652
652
|
throw new i.default(6);
|
|
653
653
|
};
|
|
654
|
-
var n = a(_e), d = a(Ce), i = a(
|
|
654
|
+
var n = a(_e), d = a(Ce), i = a(B);
|
|
655
655
|
function a(e) {
|
|
656
656
|
return e && e.__esModule ? e : { default: e };
|
|
657
657
|
}
|
|
@@ -668,7 +668,7 @@ var Be = ie.exports, oe = { exports: {} };
|
|
|
668
668
|
if (typeof e == "object" && s === void 0 && l === void 0 && o === void 0) return e.alpha >= 1 ? (0, d.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
|
|
669
669
|
throw new i.default(7);
|
|
670
670
|
};
|
|
671
|
-
var n = a(pe), d = a(Be), i = a(
|
|
671
|
+
var n = a(pe), d = a(Be), i = a(B);
|
|
672
672
|
function a(e) {
|
|
673
673
|
return e && e.__esModule ? e : { default: e };
|
|
674
674
|
}
|
|
@@ -684,7 +684,7 @@ var Ze = oe.exports;
|
|
|
684
684
|
if (u(f)) return (0, n.default)(f);
|
|
685
685
|
throw new e.default(8);
|
|
686
686
|
};
|
|
687
|
-
var n = s(Ge), d = s(Ve), i = s(Be), a = s(Ze), e = s(
|
|
687
|
+
var n = s(Ge), d = s(Ve), i = s(Be), a = s(Ze), e = s(B);
|
|
688
688
|
function s(f) {
|
|
689
689
|
return f && f.__esModule ? f : { default: f };
|
|
690
690
|
}
|
|
@@ -757,8 +757,8 @@ function et(r) {
|
|
|
757
757
|
const e = Je(d) > 0.5;
|
|
758
758
|
a.textContent = `
|
|
759
759
|
.bf-trigger-button{position:fixed;bottom:16px;right:16px;width:36px;height:36px;border-radius:50%;border:none;box-shadow:0 1px 6px #0000000f,0 2px 32px #00000029;transition:transform 167ms cubic-bezier(.33,0,0,1);box-sizing:content-box;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:1000;padding:12px;gap:10px;overflow:hidden}.bf-trigger-button.hidden{display:none}.trigger-button-icon{display:flex;align-items:center;justify-content:center;width:36px;height:36px;position:relative}.trigger-button-icon svg{width:100%;height:100%;position:absolute;inset:0}.trigger-button-icon>svg>path{transition:transform .3s ease,opacity .3s ease;transform:scale(.5);transform-origin:center;opacity:0}.trigger-button-icon .fish-icon{display:none}.trigger-button-icon .fish-icon.visible{display:block}.trigger-button-icon svg.visible{display:block}.trigger-button-icon>svg.visible>path{opacity:1;transform:scale(1)}.trigger-iframe{position:relative;width:100%;height:100%;border:none;outline:none;transform:translateZ(0)}.bf-iframe-container{display:none;position:fixed;z-index:2147483000000;background-color:#fff;bottom:0;right:0;width:100vw;height:100vh;border:none;overflow:hidden;opacity:0;pointer-events:none;transform:translateY(20px);transition:opacity .3s ease,transform .3s ease,width .2s ease-in-out,height .2s ease-in-out}.bf-iframe-container.open{display:block;opacity:1;transform:translateY(0);pointer-events:auto;top:0;left:0}@media (min-width: 576px){.bf-iframe-container{bottom:80px;right:24px;width:448px;height:min(750px,calc(100vh - 80px));border-radius:8px;border:1px solid var(--Dark-300, #D4D4D4);box-shadow:0 20px 25px -5px #1212171a,0 10px 10px -5px #1212170a}.bf-iframe-container.open{top:unset;left:unset}.bf-iframe-container.expanded{width:min(calc(448px * 1.35),calc(100vw - 16px));height:min(calc(750px * 1.35),calc(100vh - 80px))}}.iframe-loading-indicator{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;z-index:10}.spinner{width:24px;height:24px;border:2px solid rgba(0,0,0,.1);border-radius:50%;border-top-color:#3498db;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.loading-error{width:24px;height:24px;position:relative;display:flex;align-items:center;justify-content:center}.loading-error:before,.loading-error:after{content:"";position:absolute;width:16px;height:2px;background-color:#e74c3c;border-radius:2px}.loading-error:before{transform:rotate(45deg)}.loading-error:after{transform:rotate(-45deg)}
|
|
760
|
-
.${
|
|
761
|
-
.${
|
|
760
|
+
.${j} { background: ${d}; }
|
|
761
|
+
.${j}:hover {
|
|
762
762
|
background: ${e ? Qe(0.05, d) : Xe(0.05, d)};
|
|
763
763
|
}
|
|
764
764
|
.trigger-button-icon { color: ${i}; }
|
|
@@ -810,7 +810,7 @@ function rt(r, t, n) {
|
|
|
810
810
|
if (d) y.initialize({ isButtonHidden: d });
|
|
811
811
|
else {
|
|
812
812
|
const { button: l, icon: o } = function(u, c) {
|
|
813
|
-
const f = k("button",
|
|
813
|
+
const f = k("button", j, { id: `trigger-button-${u}`, "aria-controls": P, "aria-expanded": "false", "data-name": j }), g = k("div", "trigger-button-icon", { "aria-hidden": "true" });
|
|
814
814
|
return g.innerHTML = c ? `
|
|
815
815
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
|
|
816
816
|
<path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path>
|
|
@@ -828,7 +828,7 @@ function rt(r, t, n) {
|
|
|
828
828
|
a.appendChild(l), y.initialize({ button: l, icon: o });
|
|
829
829
|
}
|
|
830
830
|
const { iframeContainer: e, iframe: s } = function(l) {
|
|
831
|
-
const o = k("div",
|
|
831
|
+
const o = k("div", P, { id: P, "aria-live": "polite", "aria-hidden": "true" }), u = k("div", "iframe-loading-indicator"), c = k("div", "spinner");
|
|
832
832
|
u.setAttribute("aria-label", "Loading content"), u.setAttribute("role", "status"), u.appendChild(c), o.appendChild(u);
|
|
833
833
|
const f = k("iframe", "trigger-iframe", { src: l, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
|
|
834
834
|
return f.style.opacity = "0", f.addEventListener("load", () => {
|
|
@@ -847,8 +847,8 @@ const at = (r, t) => {
|
|
|
847
847
|
var a;
|
|
848
848
|
const { theme: e, settings: s } = t, l = R(JSON.stringify((n = r.overrides) === null || n === void 0 ? void 0 : n.redirectRules)), o = `${i}/?widgetKey=${r.widgetKey}#${new URLSearchParams({ theme: R(JSON.stringify(e)), settings: R(JSON.stringify(s)), redirectRules: l }).toString()}`, u = s == null ? void 0 : s.hideTriggerButton, c = s == null ? void 0 : s.triggerButtonIcon;
|
|
849
849
|
try {
|
|
850
|
-
if (f = r.widgetKey, we.has(f) || function(
|
|
851
|
-
return !!document.getElementById(`trigger-button-${
|
|
850
|
+
if (f = r.widgetKey, we.has(f) || function(C) {
|
|
851
|
+
return !!document.getElementById(`trigger-button-${C}`);
|
|
852
852
|
}(r.widgetKey)) return;
|
|
853
853
|
et(t);
|
|
854
854
|
const { fragment: g, iframe: h } = rt(r.widgetKey, o, { isButtonHidden: u || !1, triggerButtonIcon: c || "" }), p = new AbortController(), { signal: m } = p;
|
|
@@ -863,22 +863,24 @@ const at = (r, t) => {
|
|
|
863
863
|
return void window.addEventListener("beforeunload", b);
|
|
864
864
|
} catch (g) {
|
|
865
865
|
(function(h, p, m) {
|
|
866
|
-
|
|
866
|
+
_(h, p, p.message, m);
|
|
867
867
|
})(d, g, r.widgetKey);
|
|
868
868
|
}
|
|
869
869
|
var f;
|
|
870
870
|
};
|
|
871
871
|
var de = ((r) => (r.FRESHCHAT = "freshchat", r.INTERCOM = "intercom", r.ZENDESK = "zendesk", r.HELPSCOUT = "helpscout", r))(de || {});
|
|
872
|
-
const it = () => v(void 0, null, function* () {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
window.fcWidget.hide()
|
|
877
|
-
|
|
878
|
-
|
|
872
|
+
const it = (r) => v(void 0, null, function* () {
|
|
873
|
+
if (r.widgetType === S.Popup) {
|
|
874
|
+
const t = window.fcWidget ? de.FRESHCHAT : null;
|
|
875
|
+
t && t === de.FRESHCHAT && (yield v(void 0, null, function* () {
|
|
876
|
+
window.fcWidget || (yield new Promise((n) => setTimeout(n, 100))), window.fcWidget.hide(), window.fcWidget.on("widget:closed", () => {
|
|
877
|
+
window.fcWidget.hide();
|
|
878
|
+
});
|
|
879
|
+
}));
|
|
880
|
+
}
|
|
879
881
|
});
|
|
880
882
|
let W = null;
|
|
881
|
-
const
|
|
883
|
+
const A = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (W || (W = /* @__PURE__ */ function() {
|
|
882
884
|
let r = [], t = null;
|
|
883
885
|
function n(i, a) {
|
|
884
886
|
if (t) {
|
|
@@ -918,9 +920,9 @@ const B = typeof window != "undefined" && window.Brainfish ? window.Brainfish :
|
|
|
918
920
|
} };
|
|
919
921
|
}(), typeof window != "undefined" && (window.Brainfish = W)), W);
|
|
920
922
|
let K = null;
|
|
921
|
-
|
|
923
|
+
A.Widgets.isReady = !1, A.Widgets.identify = (r) => {
|
|
922
924
|
window.BrainfishAnalytics("identify", r);
|
|
923
|
-
},
|
|
925
|
+
}, A.Widgets.init = (r) => v(void 0, null, function* () {
|
|
924
926
|
window && (window.BrainfishAnalytics = window.BrainfishAnalytics || function() {
|
|
925
927
|
for (var a = arguments.length, e = new Array(a), s = 0; s < a; s++) e[s] = arguments[s];
|
|
926
928
|
(window.BrainfishAnalytics.q = window.BrainfishAnalytics.q || []).push(e);
|
|
@@ -947,15 +949,15 @@ B.Widgets.isReady = !1, B.Widgets.identify = (r) => {
|
|
|
947
949
|
const h = ((o = a.overrides) === null || o === void 0 ? void 0 : o.enableRecording) || (e == null || (u = e.settings) === null || u === void 0 ? void 0 : u.enableRecording) || !1, p = ((c = a.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), m = [];
|
|
948
950
|
p != null && p.startsWith("2.") ? at(a, e) : m.push(Ne(a, e)), m.push(qe(a.widgetKey, e.trackingToken || "", s, l, h, (e == null || (f = e.settings) === null || f === void 0 ? void 0 : f.recordingBlocklist) || [], e == null || (g = e.settings) === null || g === void 0 ? void 0 : g._allowLocalhostRecording));
|
|
949
951
|
const [b] = yield Promise.allSettled(m);
|
|
950
|
-
b && b.status === "fulfilled" && b.value &&
|
|
952
|
+
b && b.status === "fulfilled" && b.value && A._setRealBrainfish(b.value);
|
|
951
953
|
});
|
|
952
|
-
}(r, i, t, n)), yield K, yield it(),
|
|
954
|
+
}(r, i, t, n)), yield K, yield it(i), A.Widgets.isReady = !0, window.dispatchEvent(new Event("onBrainfishReady"));
|
|
953
955
|
});
|
|
954
956
|
const st = function() {
|
|
955
957
|
typeof window != "undefined" && window.BrainfishAnalytics && window.BrainfishAnalytics(...arguments);
|
|
956
958
|
};
|
|
957
959
|
export {
|
|
958
960
|
st as BrainfishAnalytics,
|
|
959
|
-
|
|
961
|
+
A as default
|
|
960
962
|
};
|
|
961
963
|
//# sourceMappingURL=web.js.map
|