@brainfish-ai/widgets-initiator 1.5.2 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -10,7 +10,7 @@ var T = (a, t, n) => t in a ? Fe(a, t, { enumerable: !0, configurable: !0, writa
10
10
  We.call(t, n) && T(a, n, t[n]);
11
11
  return a;
12
12
  }, $ = (a, t) => Te(a, Le(t));
13
- var _ = (a, t, n) => T(a, typeof t != "symbol" ? t + "" : t, n);
13
+ var k = (a, t, n) => T(a, typeof t != "symbol" ? t + "" : t, n);
14
14
  var m = (a, t, n) => new Promise((i, o) => {
15
15
  var r = (s) => {
16
16
  try {
@@ -27,20 +27,20 @@ var m = (a, t, n) => new Promise((i, o) => {
27
27
  }, l = (s) => s.done ? i(s.value) : Promise.resolve(s.value).then(r, e);
28
28
  l((n = n.apply(a, t)).next());
29
29
  });
30
- var k, z;
30
+ var _, z;
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] = "3f03cfaa-f399-4f03-926b-3cd5c4aabd37", a._sentryDebugIdIdentifier = "sentry-dbid-3f03cfaa-f399-4f03-926b-3cd5c4aabd37");
34
+ t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "f5ce7c80-c3f2-4add-90bb-4a7e41b9d696", a._sentryDebugIdIdentifier = "sentry-dbid-f5ce7c80-c3f2-4add-90bb-4a7e41b9d696");
35
35
  } catch (n) {
36
36
  }
37
- })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "8e419dad60578a85eb8137655ef2251f84590af4" }, function(a) {
37
+ })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "18e27120541df46d79a1a60398b242824660e266" }, function(a) {
38
38
  a.Sidebar = "sidebar", a.Searchbar = "searchbar";
39
- }(k || (k = {})), k.Sidebar, k.Searchbar;
39
+ }(_ || (_ = {})), _.Sidebar, _.Searchbar;
40
40
  class ie extends Error {
41
41
  constructor(n, i) {
42
42
  super(n, i);
43
- _(this, "cause");
43
+ k(this, "cause");
44
44
  this.name = "BrainfishWidgetError", this.cause = i == null ? void 0 : i.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, n, i) => {
62
62
  ((e, l, s) => {
63
63
  if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
64
64
  const u = l.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.5.2. ${l.message}`, stack: l.stack, cause: { message: u.message, stack: u.stack, cause: u.cause } }) });
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.6.0. ${l.message}`, stack: l.stack, cause: { message: u.message, stack: u.stack, cause: u.cause } }) });
66
66
  })(a, new ie(o, { cause: r }), i);
67
67
  }, Ke = (a) => m(void 0, null, function* () {
68
68
  let { widgetKey: t, apiHost: n } = a;
@@ -129,7 +129,7 @@ const x = (a, t, n, i) => {
129
129
  return u.forEach((c) => d.set(c.label, c)), Array.from(d.values());
130
130
  }(t.settings[l], s));
131
131
  }), function(e, l) {
132
- l.widgetType === k.Searchbar || l.widgetType === "Search" ? e.SearchWidget.initStandard(l) : e.HelpWidget.initPopup(l);
132
+ l.widgetType === _.Searchbar || l.widgetType === "Search" ? e.SearchWidget.initStandard(l) : e.HelpWidget.initPopup(l);
133
133
  }(o, r), ge.add(a.widgetKey), o;
134
134
  }
135
135
  } catch (i) {
@@ -141,12 +141,17 @@ const De = function(i, o, r) {
141
141
  return m(this, arguments, function* (a, t, n) {
142
142
  let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", l = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
143
143
  if (t || x(n, new Error("Access key is required"), "Access key is required", a), !he) try {
144
- window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !0, trackOutgoingLinks: !0, enableRecording: l }), he = !0, yield ((s, u) => m(this, null, function* () {
144
+ const s = (() => {
145
+ if (typeof window == "undefined" || typeof navigator == "undefined") return !1;
146
+ const u = navigator, d = window, c = (u.doNotTrack || d.doNotTrack || u.msDoNotTrack || "0").toString().toLowerCase();
147
+ return ["1", "yes", "true"].includes(c);
148
+ })();
149
+ window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !s, trackAttributes: !s, trackOutgoingLinks: !s, enableRecording: !s && l }), he = !0, yield ((u, d) => m(this, null, function* () {
145
150
  if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
146
- const d = document.createElement("script");
147
- d.id = "brainfish-analytics", d.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@latest/dist/tracker.js", d.type = "module", d.async = !0, d.crossOrigin = "anonymous", d.onerror = () => {
148
- x(s, new Error(`Failed to load script: ${d.src}`), `Failed to load script: ${d.src}`, u);
149
- }, document.head.appendChild(d);
151
+ const c = document.createElement("script");
152
+ c.id = "brainfish-analytics", c.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@latest/dist/tracker.js", c.type = "module", c.async = !0, c.crossOrigin = "anonymous", c.onerror = () => {
153
+ x(u, new Error(`Failed to load script: ${c.src}`), `Failed to load script: ${c.src}`, d);
154
+ }, document.head.appendChild(c);
150
155
  }))(n, a);
151
156
  } catch (s) {
152
157
  x(n, s, "Failed to initialize BrainfishAnalytics", a);
@@ -185,8 +190,8 @@ class v {
185
190
  (t = this.button) === null || t === void 0 || t.classList.add("hidden");
186
191
  }
187
192
  }
188
- _(v, "isOpen", !1), _(v, "button", null), _(v, "icon", null);
189
- function Re(a, t) {
193
+ k(v, "isOpen", !1), k(v, "button", null), k(v, "icon", null);
194
+ function Ne(a, t) {
190
195
  window.addEventListener("message", (n) => {
191
196
  if (n.origin !== a) return;
192
197
  const { type: i } = n.data;
@@ -220,7 +225,7 @@ var H = { exports: {} }, q = { exports: {} }, D = { exports: {} };
220
225
  return l(c + g, f + g, h + g);
221
226
  }, a.exports = t.default;
222
227
  })(D, D.exports);
223
- var le = D.exports, R = { exports: {} };
228
+ var le = D.exports, N = { exports: {} };
224
229
  (function(a, t) {
225
230
  t.__esModule = !0, t.default = void 0;
226
231
  var n = { 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" };
@@ -229,8 +234,8 @@ var le = D.exports, R = { exports: {} };
229
234
  var o = i.toLowerCase();
230
235
  return n[o] ? "#" + n[o] : i;
231
236
  }, a.exports = t.default;
232
- })(R, R.exports);
233
- var Ne = R.exports, N = { exports: {} };
237
+ })(N, N.exports);
238
+ var Re = N.exports, R = { exports: {} };
234
239
  (function(a, t) {
235
240
  function n(s) {
236
241
  var u = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
@@ -453,8 +458,8 @@ To pass a single animation please supply them in simple values, e.g. animation('
453
458
  }
454
459
  return d = s, (u = c).prototype = Object.create(d.prototype), u.prototype.constructor = u, o(u, d), c;
455
460
  }(n(Error)), a.exports = t.default;
456
- })(N, N.exports);
457
- var S = N.exports;
461
+ })(R, R.exports);
462
+ var S = R.exports;
458
463
  (function(a, t) {
459
464
  t.__esModule = !0, t.default = function(g) {
460
465
  if (typeof g != "string") throw new o.default(3);
@@ -487,7 +492,7 @@ var S = N.exports;
487
492
  }
488
493
  throw new o.default(5);
489
494
  };
490
- var n = r(le), i = r(Ne), o = r(S);
495
+ var n = r(le), i = r(Re), o = r(S);
491
496
  function r(g) {
492
497
  return g && g.__esModule ? g : { default: g };
493
498
  }
@@ -560,17 +565,17 @@ var Se = G.exports, Z = { exports: {} }, Q = { exports: {} }, X = { exports: {}
560
565
  return n.length === 7 && n[1] === n[2] && n[3] === n[4] && n[5] === n[6] ? "#" + n[1] + n[3] + n[5] : n;
561
566
  }, a.exports = t.default;
562
567
  })(ee, ee.exports);
563
- var _e = ee.exports, te = { exports: {} };
568
+ var ke = ee.exports, te = { exports: {} };
564
569
  (function(a, t) {
565
570
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
566
571
  var i = n.toString(16);
567
572
  return i.length === 1 ? "0" + i : i;
568
573
  }, a.exports = t.default;
569
574
  })(te, te.exports);
570
- var ke = te.exports;
575
+ var _e = te.exports;
571
576
  (function(a, t) {
572
577
  t.__esModule = !0, t.default = void 0;
573
- var n = r(le), i = r(_e), o = r(ke);
578
+ var n = r(le), i = r(ke), o = r(_e);
574
579
  function r(s) {
575
580
  return s && s.__esModule ? s : { default: s };
576
581
  }
@@ -617,7 +622,7 @@ var Ge = ne.exports, re = { exports: {} };
617
622
  if (typeof e == "object" && l === void 0 && s === void 0) return (0, n.default)("#" + (0, i.default)(e.red) + (0, i.default)(e.green) + (0, i.default)(e.blue));
618
623
  throw new o.default(6);
619
624
  };
620
- var n = r(_e), i = r(ke), o = r(S);
625
+ var n = r(ke), i = r(_e), o = r(S);
621
626
  function r(e) {
622
627
  return e && e.__esModule ? e : { default: e };
623
628
  }
@@ -799,7 +804,7 @@ const rt = (a, t) => {
799
804
  const { fragment: u, iframe: d } = nt(a.widgetKey, l), c = new AbortController(), { signal: f } = c;
800
805
  d.onload = () => {
801
806
  setTimeout(() => {
802
- et(d, f), Re(i, f), tt(d, f);
807
+ et(d, f), Ne(i, f), tt(d, f);
803
808
  }, 0);
804
809
  }, document.body.appendChild(u), ve.add(a.widgetKey);
805
810
  const h = () => {