@brainfish-ai/widgets-initiator 1.5.2-alpha.1 → 1.5.2

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 k = (a, t, n) => T(a, typeof t != "symbol" ? t + "" : t, n);
13
+ var _ = (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 _, z;
30
+ var k, 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] = "a2d370e0-7c92-455e-8531-4709e3124e11", a._sentryDebugIdIdentifier = "sentry-dbid-a2d370e0-7c92-455e-8531-4709e3124e11");
34
+ t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "3f03cfaa-f399-4f03-926b-3cd5c4aabd37", a._sentryDebugIdIdentifier = "sentry-dbid-3f03cfaa-f399-4f03-926b-3cd5c4aabd37");
35
35
  } catch (n) {
36
36
  }
37
- })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "0db1a5b1b12617982f19010096ad4bc95955f4b5" }, function(a) {
37
+ })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "8e419dad60578a85eb8137655ef2251f84590af4" }, function(a) {
38
38
  a.Sidebar = "sidebar", a.Searchbar = "searchbar";
39
- }(_ || (_ = {})), _.Sidebar, _.Searchbar;
39
+ }(k || (k = {})), k.Sidebar, k.Searchbar;
40
40
  class ie extends Error {
41
41
  constructor(n, i) {
42
42
  super(n, i);
43
- k(this, "cause");
43
+ _(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-alpha.1. ${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.5.2. ${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 === _.Searchbar || l.widgetType === "Search" ? e.SearchWidget.initStandard(l) : e.HelpWidget.initPopup(l);
132
+ l.widgetType === k.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,17 +141,12 @@ 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
- const s = (() => {
145
- if (typeof window == "undefined" || typeof navigator == "undefined") return !1;
146
- const u = ["1", "yes", "true"], d = navigator, c = window, f = (d.doNotTrack || c.doNotTrack || d.msDoNotTrack || "0").toString().toLowerCase();
147
- return console.log("web-widget: dnt", f, u.includes(f)), u.includes(f);
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* () {
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* () {
150
145
  if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
151
- const c = document.createElement("script");
152
- c.id = "brainfish-analytics", c.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@alpha/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);
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);
155
150
  }))(n, a);
156
151
  } catch (s) {
157
152
  x(n, s, "Failed to initialize BrainfishAnalytics", a);
@@ -190,8 +185,8 @@ class v {
190
185
  (t = this.button) === null || t === void 0 || t.classList.add("hidden");
191
186
  }
192
187
  }
193
- k(v, "isOpen", !1), k(v, "button", null), k(v, "icon", null);
194
- function Ne(a, t) {
188
+ _(v, "isOpen", !1), _(v, "button", null), _(v, "icon", null);
189
+ function Re(a, t) {
195
190
  window.addEventListener("message", (n) => {
196
191
  if (n.origin !== a) return;
197
192
  const { type: i } = n.data;
@@ -225,7 +220,7 @@ var H = { exports: {} }, q = { exports: {} }, D = { exports: {} };
225
220
  return l(c + g, f + g, h + g);
226
221
  }, a.exports = t.default;
227
222
  })(D, D.exports);
228
- var le = D.exports, N = { exports: {} };
223
+ var le = D.exports, R = { exports: {} };
229
224
  (function(a, t) {
230
225
  t.__esModule = !0, t.default = void 0;
231
226
  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" };
@@ -234,8 +229,8 @@ var le = D.exports, N = { exports: {} };
234
229
  var o = i.toLowerCase();
235
230
  return n[o] ? "#" + n[o] : i;
236
231
  }, a.exports = t.default;
237
- })(N, N.exports);
238
- var Re = N.exports, R = { exports: {} };
232
+ })(R, R.exports);
233
+ var Ne = R.exports, N = { exports: {} };
239
234
  (function(a, t) {
240
235
  function n(s) {
241
236
  var u = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
@@ -458,8 +453,8 @@ To pass a single animation please supply them in simple values, e.g. animation('
458
453
  }
459
454
  return d = s, (u = c).prototype = Object.create(d.prototype), u.prototype.constructor = u, o(u, d), c;
460
455
  }(n(Error)), a.exports = t.default;
461
- })(R, R.exports);
462
- var S = R.exports;
456
+ })(N, N.exports);
457
+ var S = N.exports;
463
458
  (function(a, t) {
464
459
  t.__esModule = !0, t.default = function(g) {
465
460
  if (typeof g != "string") throw new o.default(3);
@@ -492,7 +487,7 @@ var S = R.exports;
492
487
  }
493
488
  throw new o.default(5);
494
489
  };
495
- var n = r(le), i = r(Re), o = r(S);
490
+ var n = r(le), i = r(Ne), o = r(S);
496
491
  function r(g) {
497
492
  return g && g.__esModule ? g : { default: g };
498
493
  }
@@ -565,17 +560,17 @@ var Se = G.exports, Z = { exports: {} }, Q = { exports: {} }, X = { exports: {}
565
560
  return n.length === 7 && n[1] === n[2] && n[3] === n[4] && n[5] === n[6] ? "#" + n[1] + n[3] + n[5] : n;
566
561
  }, a.exports = t.default;
567
562
  })(ee, ee.exports);
568
- var ke = ee.exports, te = { exports: {} };
563
+ var _e = ee.exports, te = { exports: {} };
569
564
  (function(a, t) {
570
565
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
571
566
  var i = n.toString(16);
572
567
  return i.length === 1 ? "0" + i : i;
573
568
  }, a.exports = t.default;
574
569
  })(te, te.exports);
575
- var _e = te.exports;
570
+ var ke = te.exports;
576
571
  (function(a, t) {
577
572
  t.__esModule = !0, t.default = void 0;
578
- var n = r(le), i = r(ke), o = r(_e);
573
+ var n = r(le), i = r(_e), o = r(ke);
579
574
  function r(s) {
580
575
  return s && s.__esModule ? s : { default: s };
581
576
  }
@@ -622,7 +617,7 @@ var Ge = ne.exports, re = { exports: {} };
622
617
  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));
623
618
  throw new o.default(6);
624
619
  };
625
- var n = r(ke), i = r(_e), o = r(S);
620
+ var n = r(_e), i = r(ke), o = r(S);
626
621
  function r(e) {
627
622
  return e && e.__esModule ? e : { default: e };
628
623
  }
@@ -787,7 +782,7 @@ function nt(a, t) {
787
782
  </svg>
788
783
  `, l.setAttribute("aria-label", "Open Brainfish widget"), l.appendChild(s), v.initialize(l, s), l;
789
784
  }(a), { iframeContainer: o, iframe: r } = function(e) {
790
- const l = M("div", j, { id: j, "aria-live": "polite", "aria-hidden": "true" }), s = M("iframe", "trigger-iframe", { src: e, sandbox: "allow-scripts allow-same-origin allow-popups", allow: "clipboard-write", role: "dialog" });
785
+ const l = M("div", j, { id: j, "aria-live": "polite", "aria-hidden": "true" }), s = M("iframe", "trigger-iframe", { src: e, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
791
786
  return l.appendChild(s), { iframeContainer: l, iframe: s };
792
787
  }(t);
793
788
  return n.appendChild(i), n.appendChild(o), { fragment: n, iframe: r };
@@ -804,7 +799,7 @@ const rt = (a, t) => {
804
799
  const { fragment: u, iframe: d } = nt(a.widgetKey, l), c = new AbortController(), { signal: f } = c;
805
800
  d.onload = () => {
806
801
  setTimeout(() => {
807
- et(d, f), Ne(i, f), tt(d, f);
802
+ et(d, f), Re(i, f), tt(d, f);
808
803
  }, 0);
809
804
  }, document.body.appendChild(u), ve.add(a.widgetKey);
810
805
  const h = () => {