@brainfish-ai/widgets-initiator 1.6.1 → 1.7.0-alpha.4
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.cjs.js +7 -7
- package/dist/web.cjs.js.map +1 -1
- package/dist/web.js +61 -51
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
package/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var je = Object.defineProperty, Fe = Object.defineProperties;
|
|
2
2
|
var Le = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var pe = Object.getOwnPropertySymbols;
|
|
4
4
|
var $e = Object.prototype.hasOwnProperty, Ke = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var F = (a, t, r) => t in a ?
|
|
5
|
+
var F = (a, t, r) => t in a ? je(a, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[t] = r, L = (a, t) => {
|
|
6
6
|
for (var r in t || (t = {}))
|
|
7
7
|
$e.call(t, r) && F(a, r, t[r]);
|
|
8
8
|
if (pe)
|
|
@@ -10,7 +10,7 @@ var F = (a, t, r) => t in a ? Te(a, t, { enumerable: !0, configurable: !0, writa
|
|
|
10
10
|
Ke.call(t, r) && F(a, r, t[r]);
|
|
11
11
|
return a;
|
|
12
12
|
}, $ = (a, t) => Fe(a, Le(t));
|
|
13
|
-
var
|
|
13
|
+
var _ = (a, t, r) => F(a, typeof t != "symbol" ? t + "" : t, r);
|
|
14
14
|
var m = (a, t, r) => new Promise((d, o) => {
|
|
15
15
|
var n = (s) => {
|
|
16
16
|
try {
|
|
@@ -27,20 +27,20 @@ var m = (a, t, r) => new Promise((d, o) => {
|
|
|
27
27
|
}, i = (s) => s.done ? d(s.value) : Promise.resolve(s.value).then(n, e);
|
|
28
28
|
i((r = r.apply(a, t)).next());
|
|
29
29
|
});
|
|
30
|
-
var
|
|
30
|
+
var S, H;
|
|
31
31
|
(function() {
|
|
32
32
|
try {
|
|
33
33
|
var a = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, t = new a.Error().stack;
|
|
34
|
-
t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "
|
|
34
|
+
t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "c2e4d529-5343-4185-ae6a-5d6f260a70e0", a._sentryDebugIdIdentifier = "sentry-dbid-c2e4d529-5343-4185-ae6a-5d6f260a70e0");
|
|
35
35
|
} catch (r) {
|
|
36
36
|
}
|
|
37
|
-
})(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "
|
|
37
|
+
})(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "651c59539d178331f755a564d3ff100ea1dba17c" }, function(a) {
|
|
38
38
|
a.Sidebar = "sidebar", a.Searchbar = "searchbar";
|
|
39
|
-
}(
|
|
39
|
+
}(S || (S = {})), S.Sidebar, S.Searchbar;
|
|
40
40
|
class ie extends Error {
|
|
41
41
|
constructor(r, d) {
|
|
42
42
|
super(r, d);
|
|
43
|
-
|
|
43
|
+
_(this, "cause");
|
|
44
44
|
this.name = "BrainfishWidgetError", this.cause = d == null ? void 0 : d.cause, Error.captureStackTrace && Error.captureStackTrace(this, ie), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
|
|
45
45
|
Caused by: ` + this.cause.stack);
|
|
46
46
|
}
|
|
@@ -62,7 +62,7 @@ const x = (a, t, r, d) => {
|
|
|
62
62
|
((e, i, s) => {
|
|
63
63
|
if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
|
|
64
64
|
const l = i.toJSON();
|
|
65
|
-
fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": s }, body: JSON.stringify({ error: `WebWidgetVersion: 1.
|
|
65
|
+
fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": s }, body: JSON.stringify({ error: `WebWidgetVersion: 1.7.0-alpha.4. ${i.message}`, stack: i.stack, cause: { message: l.message, stack: l.stack, cause: l.cause } }) });
|
|
66
66
|
})(a, new ie(o, { cause: n }), d);
|
|
67
67
|
}, We = (a) => m(void 0, null, function* () {
|
|
68
68
|
let { widgetKey: t, apiHost: r } = a;
|
|
@@ -114,7 +114,7 @@ const x = (a, t, r, d) => {
|
|
|
114
114
|
} catch (o) {
|
|
115
115
|
x(t, o, o.message, r);
|
|
116
116
|
}
|
|
117
|
-
}), ge = /* @__PURE__ */ new Set(),
|
|
117
|
+
}), ge = /* @__PURE__ */ new Set(), De = (a, t) => m(void 0, null, function* () {
|
|
118
118
|
const r = se(a.overrides);
|
|
119
119
|
try {
|
|
120
120
|
if (ge.has(a.widgetKey)) return;
|
|
@@ -129,7 +129,7 @@ const x = (a, t, r, d) => {
|
|
|
129
129
|
return l.forEach((c) => u.set(c.label, c)), Array.from(u.values());
|
|
130
130
|
}(t.settings[i], s));
|
|
131
131
|
}), function(e, i) {
|
|
132
|
-
i.widgetType ===
|
|
132
|
+
i.widgetType === S.Searchbar || i.widgetType === "Search" ? e.SearchWidget.initStandard(i) : e.HelpWidget.initPopup(i);
|
|
133
133
|
}(o, n), ge.add(a.widgetKey), o;
|
|
134
134
|
}
|
|
135
135
|
} catch (d) {
|
|
@@ -137,28 +137,34 @@ const x = (a, t, r, d) => {
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
let he = !1;
|
|
140
|
-
const
|
|
140
|
+
const Ne = function(d, o, n) {
|
|
141
141
|
return m(this, arguments, function* (a, t, r) {
|
|
142
142
|
let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", i = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
|
|
143
143
|
if (t || x(r, new Error("Access key is required"), "Access key is required", a), !he) try {
|
|
144
144
|
const s = (() => {
|
|
145
145
|
if (typeof window == "undefined" || typeof navigator == "undefined") return !1;
|
|
146
|
-
const
|
|
147
|
-
return ["1", "yes", "true"].includes(
|
|
146
|
+
const u = navigator, c = window, f = (u.doNotTrack || c.doNotTrack || u.msDoNotTrack || "0").toString().toLowerCase();
|
|
147
|
+
return ["1", "yes", "true"].includes(f);
|
|
148
148
|
})();
|
|
149
|
-
window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !s, trackAttributes: !s, trackOutgoingLinks: !s, enableRecording: !s && i })
|
|
149
|
+
window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !s, trackAttributes: !s, trackOutgoingLinks: !s, enableRecording: !s && i });
|
|
150
|
+
const l = window.BrainfishAnalytics;
|
|
151
|
+
window.BrainfishAnalytics = function() {
|
|
152
|
+
for (var u = arguments.length, c = new Array(u), f = 0; f < u; f++) c[f] = arguments[f];
|
|
153
|
+
var g;
|
|
154
|
+
return c[0] === "identify" && (g = c[1], window.dispatchEvent(new CustomEvent("brainfish:identify", { detail: g }))), l.apply(this, c);
|
|
155
|
+
}, he = !0, yield ((u, c) => m(this, null, function* () {
|
|
150
156
|
if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
x(
|
|
154
|
-
}, document.head.appendChild(
|
|
157
|
+
const f = document.createElement("script");
|
|
158
|
+
f.id = "brainfish-analytics", f.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@latest/dist/tracker.js", f.type = "module", f.async = !0, f.crossOrigin = "anonymous", f.onerror = () => {
|
|
159
|
+
x(u, new Error(`Failed to load script: ${f.src}`), `Failed to load script: ${f.src}`, c);
|
|
160
|
+
}, document.head.appendChild(f);
|
|
155
161
|
}))(r, a);
|
|
156
162
|
} catch (s) {
|
|
157
163
|
x(r, s, "Failed to initialize BrainfishAnalytics", a);
|
|
158
164
|
}
|
|
159
165
|
});
|
|
160
166
|
};
|
|
161
|
-
function
|
|
167
|
+
function B(a, t) {
|
|
162
168
|
let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
163
169
|
const d = document.createElement(a);
|
|
164
170
|
return d.className = t, Object.entries(r).forEach((o) => {
|
|
@@ -166,7 +172,7 @@ function M(a, t) {
|
|
|
166
172
|
d.setAttribute(n, e);
|
|
167
173
|
}), d;
|
|
168
174
|
}
|
|
169
|
-
const
|
|
175
|
+
const T = "bf-iframe-container", j = "bf-trigger-button";
|
|
170
176
|
class v {
|
|
171
177
|
static get isWidgetOpen() {
|
|
172
178
|
return this.isOpen;
|
|
@@ -190,14 +196,14 @@ class v {
|
|
|
190
196
|
(t = this.button) === null || t === void 0 || t.classList.add("hidden");
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
|
-
|
|
194
|
-
function
|
|
199
|
+
_(v, "isOpen", !1), _(v, "button", null), _(v, "icon", null);
|
|
200
|
+
function qe(a) {
|
|
195
201
|
let { widgetHost: t, apiHost: r, widgetKey: d, signal: o } = a;
|
|
196
202
|
window.addEventListener("message", (n) => {
|
|
197
203
|
if (n.origin !== t) return;
|
|
198
204
|
const { type: e } = n.data;
|
|
199
205
|
if (e === "TOGGLE_WIDGET_SIZE" && function() {
|
|
200
|
-
const i = document.querySelector(`.${
|
|
206
|
+
const i = document.querySelector(`.${T}`);
|
|
201
207
|
i.classList.contains("expanded") ? i.classList.remove("expanded") : i.classList.add("expanded");
|
|
202
208
|
}(), e === "TRACK_EVENT") {
|
|
203
209
|
if (!window.BrainfishAnalytics) return;
|
|
@@ -220,7 +226,7 @@ function De(a) {
|
|
|
220
226
|
function de(a) {
|
|
221
227
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
222
228
|
}
|
|
223
|
-
var z = { exports: {} },
|
|
229
|
+
var z = { exports: {} }, D = { exports: {} }, N = { exports: {} };
|
|
224
230
|
(function(a, t) {
|
|
225
231
|
function r(o) {
|
|
226
232
|
return Math.round(255 * o);
|
|
@@ -235,8 +241,8 @@ var z = { exports: {} }, N = { exports: {} }, q = { exports: {} };
|
|
|
235
241
|
var h = e - l / 2;
|
|
236
242
|
return i(c + h, f + h, g + h);
|
|
237
243
|
}, a.exports = t.default;
|
|
238
|
-
})(
|
|
239
|
-
var le =
|
|
244
|
+
})(N, N.exports);
|
|
245
|
+
var le = N.exports, q = { exports: {} };
|
|
240
246
|
(function(a, t) {
|
|
241
247
|
t.__esModule = !0, t.default = void 0;
|
|
242
248
|
var r = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "00ffff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000", blanchedalmond: "ffebcd", blue: "0000ff", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "00ffff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969", dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "ff00ff", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3", lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "789", lightslategrey: "789", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "0f0", limegreen: "32cd32", linen: "faf0e6", magenta: "f0f", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "639", red: "f00", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3", white: "fff", whitesmoke: "f5f5f5", yellow: "ff0", yellowgreen: "9acd32" };
|
|
@@ -245,8 +251,8 @@ var le = q.exports, D = { exports: {} };
|
|
|
245
251
|
var o = d.toLowerCase();
|
|
246
252
|
return r[o] ? "#" + r[o] : d;
|
|
247
253
|
}, a.exports = t.default;
|
|
248
|
-
})(
|
|
249
|
-
var Re =
|
|
254
|
+
})(q, q.exports);
|
|
255
|
+
var Re = q.exports, R = { exports: {} };
|
|
250
256
|
(function(a, t) {
|
|
251
257
|
function r(s) {
|
|
252
258
|
var l = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
@@ -491,15 +497,15 @@ var k = R.exports;
|
|
|
491
497
|
if (y) return { red: parseInt("" + y[1], 10), green: parseInt("" + y[2], 10), blue: parseInt("" + y[3], 10), alpha: parseFloat("" + y[4]) > 1 ? parseFloat("" + y[4]) / 100 : parseFloat("" + y[4]) };
|
|
492
498
|
var A = f.exec(p);
|
|
493
499
|
if (A) {
|
|
494
|
-
var
|
|
495
|
-
if (!
|
|
496
|
-
return { red: parseInt("" +
|
|
500
|
+
var Ie = parseInt("" + A[1], 10), Oe = parseInt("" + A[2], 10) / 100, Be = parseInt("" + A[3], 10) / 100, fe = "rgb(" + (0, r.default)(Ie, Oe, Be) + ")", I = u.exec(fe);
|
|
501
|
+
if (!I) throw new o.default(4, p, fe);
|
|
502
|
+
return { red: parseInt("" + I[1], 10), green: parseInt("" + I[2], 10), blue: parseInt("" + I[3], 10) };
|
|
497
503
|
}
|
|
498
504
|
var w = g.exec(p.substring(0, 50));
|
|
499
505
|
if (w) {
|
|
500
|
-
var
|
|
501
|
-
if (!
|
|
502
|
-
return { red: parseInt("" +
|
|
506
|
+
var Me = parseInt("" + w[1], 10), Pe = parseInt("" + w[2], 10) / 100, Te = parseInt("" + w[3], 10) / 100, ce = "rgb(" + (0, r.default)(Me, Pe, Te) + ")", O = u.exec(ce);
|
|
507
|
+
if (!O) throw new o.default(4, p, ce);
|
|
508
|
+
return { red: parseInt("" + O[1], 10), green: parseInt("" + O[2], 10), blue: parseInt("" + O[3], 10), alpha: parseFloat("" + w[4]) > 1 ? parseFloat("" + w[4]) / 100 : parseFloat("" + w[4]) };
|
|
503
509
|
}
|
|
504
510
|
throw new o.default(5);
|
|
505
511
|
};
|
|
@@ -509,8 +515,8 @@ var k = R.exports;
|
|
|
509
515
|
}
|
|
510
516
|
var e = /^#[a-fA-F0-9]{6}$/, i = /^#[a-fA-F0-9]{8}$/, s = /^#[a-fA-F0-9]{3}$/, l = /^#[a-fA-F0-9]{4}$/, u = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i, c = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i, f = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i, g = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
|
|
511
517
|
a.exports = t.default;
|
|
512
|
-
})(
|
|
513
|
-
var ue =
|
|
518
|
+
})(D, D.exports);
|
|
519
|
+
var ue = D.exports;
|
|
514
520
|
(function(a, t) {
|
|
515
521
|
t.__esModule = !0, t.default = function(o) {
|
|
516
522
|
if (o === "transparent") return 0;
|
|
@@ -536,10 +542,10 @@ var Y = { exports: {} }, J = { exports: {} };
|
|
|
536
542
|
return r(d, d.length, []);
|
|
537
543
|
}, a.exports = t.default;
|
|
538
544
|
})(J, J.exports);
|
|
539
|
-
var me,
|
|
540
|
-
me = U, (
|
|
545
|
+
var me, M, we = J.exports, U = { exports: {} };
|
|
546
|
+
me = U, (M = U.exports).__esModule = !0, M.default = void 0, M.default = function(a, t, r) {
|
|
541
547
|
return Math.max(a, Math.min(t, r));
|
|
542
|
-
}, me.exports =
|
|
548
|
+
}, me.exports = M.default;
|
|
543
549
|
var xe = U.exports, G = { exports: {} }, V = { exports: {} };
|
|
544
550
|
(function(a, t) {
|
|
545
551
|
t.__esModule = !0, t.default = void 0, t.default = function(r) {
|
|
@@ -576,17 +582,17 @@ var ke = G.exports, Z = { exports: {} }, Q = { exports: {} }, X = { exports: {}
|
|
|
576
582
|
return r.length === 7 && r[1] === r[2] && r[3] === r[4] && r[5] === r[6] ? "#" + r[1] + r[3] + r[5] : r;
|
|
577
583
|
}, a.exports = t.default;
|
|
578
584
|
})(ee, ee.exports);
|
|
579
|
-
var
|
|
585
|
+
var _e = ee.exports, te = { exports: {} };
|
|
580
586
|
(function(a, t) {
|
|
581
587
|
t.__esModule = !0, t.default = void 0, t.default = function(r) {
|
|
582
588
|
var d = r.toString(16);
|
|
583
589
|
return d.length === 1 ? "0" + d : d;
|
|
584
590
|
}, a.exports = t.default;
|
|
585
591
|
})(te, te.exports);
|
|
586
|
-
var
|
|
592
|
+
var Se = te.exports;
|
|
587
593
|
(function(a, t) {
|
|
588
594
|
t.__esModule = !0, t.default = void 0;
|
|
589
|
-
var r = n(le), d = n(
|
|
595
|
+
var r = n(le), d = n(_e), o = n(Se);
|
|
590
596
|
function n(s) {
|
|
591
597
|
return s && s.__esModule ? s : { default: s };
|
|
592
598
|
}
|
|
@@ -633,7 +639,7 @@ var Ge = ne.exports, re = { exports: {} };
|
|
|
633
639
|
if (typeof e == "object" && i === void 0 && s === void 0) return (0, r.default)("#" + (0, d.default)(e.red) + (0, d.default)(e.green) + (0, d.default)(e.blue));
|
|
634
640
|
throw new o.default(6);
|
|
635
641
|
};
|
|
636
|
-
var r = n(
|
|
642
|
+
var r = n(_e), d = n(Se), o = n(k);
|
|
637
643
|
function n(e) {
|
|
638
644
|
return e && e.__esModule ? e : { default: e };
|
|
639
645
|
}
|
|
@@ -739,8 +745,8 @@ function Xe(a) {
|
|
|
739
745
|
const e = Ye(d) > 0.5;
|
|
740
746
|
n.textContent = `
|
|
741
747
|
.bf-trigger-button{position:fixed;bottom:16px;right:16px;width:56px;height:56px;border-radius:50%;border:none;box-shadow:0 20px 25px -5px #1212171a,0 10px 10px -5px #1212170a;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{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 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{position:fixed;bottom:0;right:0;width:100vw;height:100vh;border:none;overflow:hidden;z-index:999;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{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))}}
|
|
742
|
-
.${
|
|
743
|
-
.${
|
|
748
|
+
.${j} { background: ${d}; }
|
|
749
|
+
.${j}:hover {
|
|
744
750
|
background: ${e ? Ze(0.05, d) : Qe(0.05, d)};
|
|
745
751
|
}
|
|
746
752
|
.trigger-button-icon { color: ${o}; }
|
|
@@ -788,7 +794,7 @@ function be(a) {
|
|
|
788
794
|
const ve = /* @__PURE__ */ new Set();
|
|
789
795
|
function nt(a, t) {
|
|
790
796
|
const r = document.createDocumentFragment(), d = function(e) {
|
|
791
|
-
const i =
|
|
797
|
+
const i = B("button", j, { id: `trigger-button-${e}`, "aria-controls": T, "aria-expanded": "false", "data-name": j }), s = B("div", "trigger-button-icon", { "aria-hidden": "true" });
|
|
792
798
|
return s.innerHTML = `
|
|
793
799
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
|
|
794
800
|
<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>
|
|
@@ -798,8 +804,12 @@ function nt(a, t) {
|
|
|
798
804
|
</svg>
|
|
799
805
|
`, i.setAttribute("aria-label", "Open Brainfish widget"), i.appendChild(s), v.initialize(i, s), i;
|
|
800
806
|
}(a), { iframeContainer: o, iframe: n } = function(e) {
|
|
801
|
-
const i =
|
|
802
|
-
return
|
|
807
|
+
const i = B("div", T, { id: T, "aria-live": "polite", "aria-hidden": "true" }), s = B("iframe", "trigger-iframe", { src: e, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
|
|
808
|
+
return window.addEventListener("brainfish:identify", (l) => {
|
|
809
|
+
var u;
|
|
810
|
+
const c = l;
|
|
811
|
+
(u = s.contentWindow) === null || u === void 0 || u.postMessage({ type: "IDENTIFY_DATA", data: c.detail }, "*");
|
|
812
|
+
}), i.appendChild(s), { iframeContainer: i, iframe: s };
|
|
803
813
|
}(t);
|
|
804
814
|
return r.appendChild(d), r.appendChild(o), { fragment: r, iframe: n };
|
|
805
815
|
}
|
|
@@ -815,7 +825,7 @@ const rt = (a, t) => {
|
|
|
815
825
|
const { fragment: l, iframe: u } = nt(a.widgetKey, i), c = new AbortController(), { signal: f } = c;
|
|
816
826
|
u.onload = () => {
|
|
817
827
|
setTimeout(() => {
|
|
818
|
-
et(u, f),
|
|
828
|
+
et(u, f), qe({ widgetHost: d, apiHost: r, widgetKey: a.widgetKey, signal: f }), tt(u, f);
|
|
819
829
|
}, 0);
|
|
820
830
|
}, document.body.appendChild(l), ve.add(a.widgetKey);
|
|
821
831
|
const g = () => {
|
|
@@ -892,7 +902,7 @@ ye.Widgets.init = (a) => m(void 0, null, function* () {
|
|
|
892
902
|
return m(this, null, function* () {
|
|
893
903
|
var l, u, c;
|
|
894
904
|
const f = ((l = n.overrides) === null || l === void 0 ? void 0 : l.enableRecording) || (e == null || (u = e.settings) === null || u === void 0 ? void 0 : u.enableRecording) || !1, g = ((c = n.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), h = [];
|
|
895
|
-
g != null && g.startsWith("2.") ? rt(n, e) : h.push(
|
|
905
|
+
g != null && g.startsWith("2.") ? rt(n, e) : h.push(De(n, e)), h.push(Ne(n.widgetKey, e.trackingToken || "", i, s, f));
|
|
896
906
|
const [p] = yield Promise.allSettled(h);
|
|
897
907
|
p && p.status === "fulfilled" && p.value && ye._setRealBrainfish(p.value);
|
|
898
908
|
});
|