@brainfish-ai/widgets-initiator 1.7.0-alpha.3 → 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.js CHANGED
@@ -27,16 +27,16 @@ 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 k, H;
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] = "65d8351e-5447-4dbb-a42e-1db7729f2a76", a._sentryDebugIdIdentifier = "sentry-dbid-65d8351e-5447-4dbb-a42e-1db7729f2a76");
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: "50484184eb4e18af6665e054d85d45509aab6751" }, function(a) {
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
- }(k || (k = {})), k.Sidebar, k.Searchbar;
39
+ }(S || (S = {})), S.Sidebar, S.Searchbar;
40
40
  class ie extends Error {
41
41
  constructor(r, d) {
42
42
  super(r, d);
@@ -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.7.0-alpha.3. ${i.message}`, stack: i.stack, cause: { message: l.message, stack: l.stack, cause: l.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.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;
@@ -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 === k.Searchbar || i.widgetType === "Search" ? e.SearchWidget.initStandard(i) : e.HelpWidget.initPopup(i);
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) {
@@ -150,11 +150,8 @@ const Ne = function(d, o, n) {
150
150
  const l = window.BrainfishAnalytics;
151
151
  window.BrainfishAnalytics = function() {
152
152
  for (var u = arguments.length, c = new Array(u), f = 0; f < u; f++) c[f] = arguments[f];
153
- if (c[0] === "identify") {
154
- const g = document.querySelector("#bf-iframe-container .trigger-iframe");
155
- g != null && g.contentWindow && g.contentWindow.postMessage({ type: "IDENTIFY_DATA", data: c[1] }, "*");
156
- }
157
- return l.apply(this, c);
153
+ var g;
154
+ return c[0] === "identify" && (g = c[1], window.dispatchEvent(new CustomEvent("brainfish:identify", { detail: g }))), l.apply(this, c);
158
155
  }, he = !0, yield ((u, c) => m(this, null, function* () {
159
156
  if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
160
157
  const f = document.createElement("script");
@@ -479,7 +476,7 @@ To pass a single animation please supply them in simple values, e.g. animation('
479
476
  return u = s, (l = c).prototype = Object.create(u.prototype), l.prototype.constructor = l, o(l, u), c;
480
477
  }(r(Error)), a.exports = t.default;
481
478
  })(R, R.exports);
482
- var S = R.exports;
479
+ var k = R.exports;
483
480
  (function(a, t) {
484
481
  t.__esModule = !0, t.default = function(h) {
485
482
  if (typeof h != "string") throw new o.default(3);
@@ -512,7 +509,7 @@ var S = R.exports;
512
509
  }
513
510
  throw new o.default(5);
514
511
  };
515
- var r = n(le), d = n(Re), o = n(S);
512
+ var r = n(le), d = n(Re), o = n(k);
516
513
  function n(h) {
517
514
  return h && h.__esModule ? h : { default: h };
518
515
  }
@@ -579,7 +576,7 @@ var Je = V.exports;
579
576
  }
580
577
  a.exports = t.default;
581
578
  })(G, G.exports);
582
- var Se = G.exports, Z = { exports: {} }, Q = { exports: {} }, X = { exports: {} }, ee = { exports: {} };
579
+ var ke = G.exports, Z = { exports: {} }, Q = { exports: {} }, X = { exports: {} }, ee = { exports: {} };
583
580
  (function(a, t) {
584
581
  t.__esModule = !0, t.default = void 0, t.default = function(r) {
585
582
  return r.length === 7 && r[1] === r[2] && r[3] === r[4] && r[5] === r[6] ? "#" + r[1] + r[3] + r[5] : r;
@@ -592,10 +589,10 @@ var _e = ee.exports, te = { exports: {} };
592
589
  return d.length === 1 ? "0" + d : d;
593
590
  }, a.exports = t.default;
594
591
  })(te, te.exports);
595
- var ke = te.exports;
592
+ var Se = te.exports;
596
593
  (function(a, t) {
597
594
  t.__esModule = !0, t.default = void 0;
598
- var r = n(le), d = n(_e), o = n(ke);
595
+ var r = n(le), d = n(_e), o = n(Se);
599
596
  function n(s) {
600
597
  return s && s.__esModule ? s : { default: s };
601
598
  }
@@ -616,7 +613,7 @@ var Ce = X.exports;
616
613
  if (typeof n == "object" && e === void 0 && i === void 0) return (0, r.default)(n.hue, n.saturation, n.lightness);
617
614
  throw new d.default(1);
618
615
  };
619
- var r = o(Ce), d = o(S);
616
+ var r = o(Ce), d = o(k);
620
617
  function o(n) {
621
618
  return n && n.__esModule ? n : { default: n };
622
619
  }
@@ -629,7 +626,7 @@ var Ue = Q.exports, ne = { exports: {} };
629
626
  if (typeof e == "object" && i === void 0 && s === void 0 && l === void 0) return e.alpha >= 1 ? (0, r.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, d.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
630
627
  throw new o.default(2);
631
628
  };
632
- var r = n(Ce), d = n(le), o = n(S);
629
+ var r = n(Ce), d = n(le), o = n(k);
633
630
  function n(e) {
634
631
  return e && e.__esModule ? e : { default: e };
635
632
  }
@@ -642,7 +639,7 @@ var Ge = ne.exports, re = { exports: {} };
642
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));
643
640
  throw new o.default(6);
644
641
  };
645
- var r = n(_e), d = n(ke), o = n(S);
642
+ var r = n(_e), d = n(Se), o = n(k);
646
643
  function n(e) {
647
644
  return e && e.__esModule ? e : { default: e };
648
645
  }
@@ -659,7 +656,7 @@ var Ee = re.exports, ae = { exports: {} };
659
656
  if (typeof e == "object" && i === void 0 && s === void 0 && l === void 0) return e.alpha >= 1 ? (0, d.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
660
657
  throw new o.default(7);
661
658
  };
662
- var r = n(ue), d = n(Ee), o = n(S);
659
+ var r = n(ue), d = n(Ee), o = n(k);
663
660
  function n(e) {
664
661
  return e && e.__esModule ? e : { default: e };
665
662
  }
@@ -675,7 +672,7 @@ var Ve = ae.exports;
675
672
  if (u(f)) return (0, r.default)(f);
676
673
  throw new e.default(8);
677
674
  };
678
- var r = i(Ue), d = i(Ge), o = i(Ee), n = i(Ve), e = i(S);
675
+ var r = i(Ue), d = i(Ge), o = i(Ee), n = i(Ve), e = i(k);
679
676
  function i(f) {
680
677
  return f && f.__esModule ? f : { default: f };
681
678
  }
@@ -693,7 +690,7 @@ var Ve = ae.exports;
693
690
  var Ae = Z.exports;
694
691
  (function(a, t) {
695
692
  t.__esModule = !0, t.default = void 0;
696
- var r = e(we), d = e(xe), o = e(Se), n = e(Ae);
693
+ var r = e(we), d = e(xe), o = e(ke), n = e(Ae);
697
694
  function e(l) {
698
695
  return l && l.__esModule ? l : { default: l };
699
696
  }
@@ -717,7 +714,7 @@ const Ze = de(Y.exports);
717
714
  var oe = { exports: {} };
718
715
  (function(a, t) {
719
716
  t.__esModule = !0, t.default = void 0;
720
- var r = e(we), d = e(xe), o = e(Se), n = e(Ae);
717
+ var r = e(we), d = e(xe), o = e(ke), n = e(Ae);
721
718
  function e(l) {
722
719
  return l && l.__esModule ? l : { default: l };
723
720
  }
@@ -808,7 +805,11 @@ function nt(a, t) {
808
805
  `, i.setAttribute("aria-label", "Open Brainfish widget"), i.appendChild(s), v.initialize(i, s), i;
809
806
  }(a), { iframeContainer: o, iframe: n } = function(e) {
810
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" });
811
- return i.appendChild(s), { iframeContainer: i, iframe: s };
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 };
812
813
  }(t);
813
814
  return r.appendChild(d), r.appendChild(o), { fragment: r, iframe: n };
814
815
  }