@compilot/web-sdk 2.145.0-dev → 2.146.0-dev

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.
@@ -14,274 +14,116 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
14
14
 
15
15
  var jwtDecode__default = /*#__PURE__*/_interopDefault(jwtDecode);
16
16
 
17
- function _regeneratorRuntime() {
18
- _regeneratorRuntime = function () {
19
- return r;
20
- };
21
- var t,
22
- r = {},
23
- e = Object.prototype,
24
- n = e.hasOwnProperty,
25
- o = "function" == typeof Symbol ? Symbol : {},
26
- i = o.iterator || "@@iterator",
27
- a = o.asyncIterator || "@@asyncIterator",
28
- u = o.toStringTag || "@@toStringTag";
29
- function c(t, r, e, n) {
30
- Object.defineProperty(t, r, {
31
- value: e,
32
- enumerable: !n,
33
- configurable: !n,
34
- writable: !n
35
- });
36
- }
17
+ function _regeneratorDefine(e, r, n, t) {
18
+ var i = Object.defineProperty;
37
19
  try {
38
- c({}, "");
39
- } catch (t) {
40
- c = function (t, r, e) {
41
- return t[r] = e;
42
- };
20
+ i({}, "", {});
21
+ } catch (e) {
22
+ i = 0;
43
23
  }
44
- function h(r, e, n, o) {
45
- var i = e && e.prototype instanceof Generator ? e : Generator,
46
- a = Object.create(i.prototype);
47
- return c(a, "_invoke", function (r, e, n) {
48
- var o = 1;
49
- return function (i, a) {
50
- if (3 === o) throw Error("Generator is already running");
51
- if (4 === o) {
52
- if ("throw" === i) throw a;
53
- return {
54
- value: t,
55
- done: !0
56
- };
57
- }
58
- for (n.method = i, n.arg = a;;) {
59
- var u = n.delegate;
60
- if (u) {
61
- var c = d(u, n);
62
- if (c) {
63
- if (c === f) continue;
64
- return c;
65
- }
24
+ _regeneratorDefine = function (e, r, n, t) {
25
+ if (r) i ? i(e, r, {
26
+ value: n,
27
+ enumerable: !t,
28
+ configurable: !t,
29
+ writable: !t
30
+ }) : e[r] = n;else {
31
+ function o(r, n) {
32
+ _regeneratorDefine(e, r, function (e) {
33
+ return this._invoke(r, n, e);
34
+ });
35
+ }
36
+ o("next", 0), o("throw", 1), o("return", 2);
37
+ }
38
+ }, _regeneratorDefine(e, r, n, t);
39
+ }
40
+
41
+ function _regenerator() {
42
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
43
+ var e,
44
+ t,
45
+ r = "function" == typeof Symbol ? Symbol : {},
46
+ n = r.iterator || "@@iterator",
47
+ o = r.toStringTag || "@@toStringTag";
48
+ function i(r, n, o, i) {
49
+ var c = n && n.prototype instanceof Generator ? n : Generator,
50
+ u = Object.create(c.prototype);
51
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
52
+ var i,
53
+ c,
54
+ u,
55
+ f = 0,
56
+ p = o || [],
57
+ y = !1,
58
+ G = {
59
+ p: 0,
60
+ n: 0,
61
+ v: e,
62
+ a: d,
63
+ f: d.bind(e, 4),
64
+ d: function (t, r) {
65
+ return i = t, c = 0, u = e, G.n = r, a;
66
66
  }
67
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
68
- if (1 === o) throw o = 4, n.arg;
69
- n.dispatchException(n.arg);
70
- } else "return" === n.method && n.abrupt("return", n.arg);
71
- o = 3;
72
- var h = s(r, e, n);
73
- if ("normal" === h.type) {
74
- if (o = n.done ? 4 : 2, h.arg === f) continue;
75
- return {
76
- value: h.arg,
77
- done: n.done
78
- };
67
+ };
68
+ function d(r, n) {
69
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
70
+ var o,
71
+ i = p[t],
72
+ d = G.p,
73
+ l = i[2];
74
+ r > 3 ? (o = l === n) && (c = i[4] || 3, u = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
75
+ }
76
+ if (o || r > 1) return a;
77
+ throw y = !0, n;
78
+ }
79
+ return function (o, p, l) {
80
+ if (f > 1) throw TypeError("Generator is already running");
81
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
82
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
83
+ try {
84
+ if (f = 2, i) {
85
+ if (c || (o = "next"), t = i[o]) {
86
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
87
+ if (!t.done) return t;
88
+ u = t.value, c < 2 && (c = 0);
89
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
90
+ i = e;
91
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
92
+ } catch (t) {
93
+ i = e, c = 1, u = t;
94
+ } finally {
95
+ f = 1;
79
96
  }
80
- "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
81
97
  }
98
+ return {
99
+ value: t,
100
+ done: y
101
+ };
82
102
  };
83
- }(r, n, new Context(o || [])), !0), a;
84
- }
85
- function s(t, r, e) {
86
- try {
87
- return {
88
- type: "normal",
89
- arg: t.call(r, e)
90
- };
91
- } catch (t) {
92
- return {
93
- type: "throw",
94
- arg: t
95
- };
96
- }
103
+ }(r, o, i), !0), u;
97
104
  }
98
- r.wrap = h;
99
- var f = {};
105
+ var a = {};
100
106
  function Generator() {}
101
107
  function GeneratorFunction() {}
102
108
  function GeneratorFunctionPrototype() {}
103
- var l = {};
104
- c(l, i, function () {
105
- return this;
106
- });
107
- var p = Object.getPrototypeOf,
108
- y = p && p(p(x([])));
109
- y && y !== e && n.call(y, i) && (l = y);
110
- var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
111
- function g(t) {
112
- ["next", "throw", "return"].forEach(function (r) {
113
- c(t, r, function (t) {
114
- return this._invoke(r, t);
115
- });
116
- });
117
- }
118
- function AsyncIterator(t, r) {
119
- function e(o, i, a, u) {
120
- var c = s(t[o], t, i);
121
- if ("throw" !== c.type) {
122
- var h = c.arg,
123
- f = h.value;
124
- return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
125
- e("next", t, a, u);
126
- }, function (t) {
127
- e("throw", t, a, u);
128
- }) : r.resolve(f).then(function (t) {
129
- h.value = t, a(h);
130
- }, function (t) {
131
- return e("throw", t, a, u);
132
- });
133
- }
134
- u(c.arg);
135
- }
136
- var o;
137
- c(this, "_invoke", function (t, n) {
138
- function i() {
139
- return new r(function (r, o) {
140
- e(t, n, r, o);
141
- });
142
- }
143
- return o = o ? o.then(i, i) : i();
144
- }, !0);
145
- }
146
- function d(r, e) {
147
- var n = e.method,
148
- o = r.i[n];
149
- if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f;
150
- var i = s(o, r.i, e.arg);
151
- if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
152
- var a = i.arg;
153
- return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f);
154
- }
155
- function w(t) {
156
- this.tryEntries.push(t);
109
+ t = Object.getPrototypeOf;
110
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
111
+ return this;
112
+ }), t),
113
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
114
+ function f(e) {
115
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
157
116
  }
158
- function m(r) {
159
- var e = r[4] || {};
160
- e.type = "normal", e.arg = t, r[4] = e;
161
- }
162
- function Context(t) {
163
- this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0);
164
- }
165
- function x(r) {
166
- if (null != r) {
167
- var e = r[i];
168
- if (e) return e.call(r);
169
- if ("function" == typeof r.next) return r;
170
- if (!isNaN(r.length)) {
171
- var o = -1,
172
- a = function e() {
173
- for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e;
174
- return e.value = t, e.done = !0, e;
175
- };
176
- return a.next = a;
177
- }
178
- }
179
- throw new TypeError(typeof r + " is not iterable");
180
- }
181
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) {
182
- var r = "function" == typeof t && t.constructor;
183
- return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
184
- }, r.mark = function (t) {
185
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
186
- }, r.awrap = function (t) {
187
- return {
188
- __await: t
189
- };
190
- }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
191
- return this;
192
- }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
193
- void 0 === i && (i = Promise);
194
- var a = new AsyncIterator(h(t, e, n, o), i);
195
- return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
196
- return t.done ? t.value : a.next();
197
- });
198
- }, g(v), c(v, u, "Generator"), c(v, i, function () {
117
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
199
118
  return this;
200
- }), c(v, "toString", function () {
119
+ }), _regeneratorDefine(u, "toString", function () {
201
120
  return "[object Generator]";
202
- }), r.keys = function (t) {
203
- var r = Object(t),
204
- e = [];
205
- for (var n in r) e.unshift(n);
206
- return function t() {
207
- for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t;
208
- return t.done = !0, t;
121
+ }), (_regenerator = function () {
122
+ return {
123
+ w: i,
124
+ m: f
209
125
  };
210
- }, r.values = x, Context.prototype = {
211
- constructor: Context,
212
- reset: function (r) {
213
- if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t);
214
- },
215
- stop: function () {
216
- this.done = !0;
217
- var t = this.tryEntries[0][4];
218
- if ("throw" === t.type) throw t.arg;
219
- return this.rval;
220
- },
221
- dispatchException: function (r) {
222
- if (this.done) throw r;
223
- var e = this;
224
- function n(t) {
225
- a.type = "throw", a.arg = r, e.next = t;
226
- }
227
- for (var o = e.tryEntries.length - 1; o >= 0; --o) {
228
- var i = this.tryEntries[o],
229
- a = i[4],
230
- u = this.prev,
231
- c = i[1],
232
- h = i[2];
233
- if (-1 === i[0]) return n("end"), !1;
234
- if (!c && !h) throw Error("try statement without catch or finally");
235
- if (null != i[0] && i[0] <= u) {
236
- if (u < c) return this.method = "next", this.arg = t, n(c), !0;
237
- if (u < h) return n(h), !1;
238
- }
239
- }
240
- },
241
- abrupt: function (t, r) {
242
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
243
- var n = this.tryEntries[e];
244
- if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
245
- var o = n;
246
- break;
247
- }
248
- }
249
- o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
250
- var i = o ? o[4] : {};
251
- return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
252
- },
253
- complete: function (t, r) {
254
- if ("throw" === t.type) throw t.arg;
255
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f;
256
- },
257
- finish: function (t) {
258
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
259
- var e = this.tryEntries[r];
260
- if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
261
- }
262
- },
263
- catch: function (t) {
264
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
265
- var e = this.tryEntries[r];
266
- if (e[0] === t) {
267
- var n = e[4];
268
- if ("throw" === n.type) {
269
- var o = n.arg;
270
- m(e);
271
- }
272
- return o;
273
- }
274
- }
275
- throw Error("illegal catch attempt");
276
- },
277
- delegateYield: function (r, e, n) {
278
- return this.delegate = {
279
- i: x(r),
280
- r: e,
281
- n: n
282
- }, "next" === this.method && (this.arg = t), f;
283
- }
284
- }, r;
126
+ })();
285
127
  }
286
128
 
287
129
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
@@ -710,17 +552,14 @@ var createAuthAdapter = function createAuthAdapter(params) {
710
552
  createSession = _parsed$data.createSession,
711
553
  isAuthenticated = _parsed$data.isAuthenticated;
712
554
  var login = /*#__PURE__*/function () {
713
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
714
- return _regeneratorRuntime().wrap(function _callee$(_context) {
715
- while (1) switch (_context.prev = _context.next) {
555
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
556
+ return _regenerator().w(function (_context) {
557
+ while (1) switch (_context.n) {
716
558
  case 0:
717
- _context.next = 2;
559
+ _context.n = 1;
718
560
  return createSession();
719
- case 2:
720
- return _context.abrupt("return", _context.sent);
721
- case 3:
722
- case "end":
723
- return _context.stop();
561
+ case 1:
562
+ return _context.a(2, _context.v);
724
563
  }
725
564
  }, _callee);
726
565
  }));
@@ -976,36 +815,35 @@ function createIframeHandler(_ref) {
976
815
  }
977
816
  window.addEventListener("message", handleMessage);
978
817
  var waitForIframeLoad = /*#__PURE__*/function () {
979
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
818
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref2) {
980
819
  var _ref2$maxWaitTime, maxWaitTime, _ref2$interval, interval, _ref2$onTimeout, onTimeout, count;
981
- return _regeneratorRuntime().wrap(function _callee$(_context) {
982
- while (1) switch (_context.prev = _context.next) {
820
+ return _regenerator().w(function (_context) {
821
+ while (1) switch (_context.n) {
983
822
  case 0:
984
823
  _ref2$maxWaitTime = _ref2.maxWaitTime, maxWaitTime = _ref2$maxWaitTime === void 0 ? 3000 : _ref2$maxWaitTime, _ref2$interval = _ref2.interval, interval = _ref2$interval === void 0 ? 100 : _ref2$interval, _ref2$onTimeout = _ref2.onTimeout, onTimeout = _ref2$onTimeout === void 0 ? function () {
985
824
  logger.error("iframe not loaded");
986
825
  throw new Error("iframe not loaded");
987
826
  } : _ref2$onTimeout;
988
827
  count = maxWaitTime / interval;
989
- case 2:
828
+ case 1:
990
829
  if (!(!iframe && count > 0)) {
991
- _context.next = 8;
830
+ _context.n = 3;
992
831
  break;
993
832
  }
994
- _context.next = 5;
833
+ _context.n = 2;
995
834
  return new Promise(function (resolve) {
996
835
  return setTimeout(resolve, interval);
997
836
  });
998
- case 5:
837
+ case 2:
999
838
  count--;
1000
- _context.next = 2;
839
+ _context.n = 1;
1001
840
  break;
1002
- case 8:
841
+ case 3:
1003
842
  if (!iframe) {
1004
843
  onTimeout === null || onTimeout === void 0 || onTimeout();
1005
844
  }
1006
- case 9:
1007
- case "end":
1008
- return _context.stop();
845
+ case 4:
846
+ return _context.a(2);
1009
847
  }
1010
848
  }, _callee);
1011
849
  }));
@@ -1032,23 +870,22 @@ function createIframeHandler(_ref) {
1032
870
  }
1033
871
  },
1034
872
  show: function () {
1035
- var _show = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1036
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1037
- while (1) switch (_context2.prev = _context2.next) {
873
+ var _show = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
874
+ return _regenerator().w(function (_context2) {
875
+ while (1) switch (_context2.n) {
1038
876
  case 0:
1039
877
  if (iframe) {
1040
- _context2.next = 3;
878
+ _context2.n = 1;
1041
879
  break;
1042
880
  }
1043
- _context2.next = 3;
881
+ _context2.n = 1;
1044
882
  return waitForIframeLoad({});
1045
- case 3:
883
+ case 1:
1046
884
  showElement(backdrop);
1047
885
  showElement(iframe);
1048
886
  onShow();
1049
- case 6:
1050
- case "end":
1051
- return _context2.stop();
887
+ case 2:
888
+ return _context2.a(2);
1052
889
  }
1053
890
  }, _callee2);
1054
891
  }));
@@ -1058,22 +895,21 @@ function createIframeHandler(_ref) {
1058
895
  return show;
1059
896
  }(),
1060
897
  hide: function () {
1061
- var _hide = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
1062
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1063
- while (1) switch (_context3.prev = _context3.next) {
898
+ var _hide = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
899
+ return _regenerator().w(function (_context3) {
900
+ while (1) switch (_context3.n) {
1064
901
  case 0:
1065
902
  if (iframe) {
1066
- _context3.next = 3;
903
+ _context3.n = 1;
1067
904
  break;
1068
905
  }
1069
- _context3.next = 3;
906
+ _context3.n = 1;
1070
907
  return waitForIframeLoad({});
1071
- case 3:
908
+ case 1:
1072
909
  hideElement(iframe);
1073
910
  hideElement(backdrop);
1074
- case 5:
1075
- case "end":
1076
- return _context3.stop();
911
+ case 2:
912
+ return _context3.a(2);
1077
913
  }
1078
914
  }, _callee3);
1079
915
  }));
@@ -1083,21 +919,18 @@ function createIframeHandler(_ref) {
1083
919
  return hide;
1084
920
  }(),
1085
921
  isShown: function () {
1086
- var _isShown = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
1087
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1088
- while (1) switch (_context4.prev = _context4.next) {
922
+ var _isShown = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
923
+ return _regenerator().w(function (_context4) {
924
+ while (1) switch (_context4.n) {
1089
925
  case 0:
1090
926
  if (iframe) {
1091
- _context4.next = 3;
927
+ _context4.n = 1;
1092
928
  break;
1093
929
  }
1094
- _context4.next = 3;
930
+ _context4.n = 1;
1095
931
  return waitForIframeLoad({});
1096
- case 3:
1097
- return _context4.abrupt("return", iframe.style.visibility === "visible");
1098
- case 4:
1099
- case "end":
1100
- return _context4.stop();
932
+ case 1:
933
+ return _context4.a(2, iframe.style.visibility === "visible");
1101
934
  }
1102
935
  }, _callee4);
1103
936
  }));
@@ -1107,17 +940,17 @@ function createIframeHandler(_ref) {
1107
940
  return isShown;
1108
941
  }(),
1109
942
  postMessage: function () {
1110
- var _postMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(message) {
1111
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1112
- while (1) switch (_context5.prev = _context5.next) {
943
+ var _postMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(message) {
944
+ return _regenerator().w(function (_context5) {
945
+ while (1) switch (_context5.n) {
1113
946
  case 0:
1114
947
  if (iframe) {
1115
- _context5.next = 3;
948
+ _context5.n = 1;
1116
949
  break;
1117
950
  }
1118
- _context5.next = 3;
951
+ _context5.n = 1;
1119
952
  return waitForIframeLoad({});
1120
- case 3:
953
+ case 1:
1121
954
  logger.debug({
1122
955
  msg: "🔧↗️📱 Sending message to identity app",
1123
956
  values: message
@@ -1128,9 +961,8 @@ function createIframeHandler(_ref) {
1128
961
  frames[iframe.name].postMessage(_objectSpread2(_objectSpread2({}, message), {}, {
1129
962
  identifier: identifier
1130
963
  }), baseURL);
1131
- case 5:
1132
- case "end":
1133
- return _context5.stop();
964
+ case 2:
965
+ return _context5.a(2);
1134
966
  }
1135
967
  }, _callee5);
1136
968
  }));
@@ -1306,36 +1138,36 @@ var createConfig = function createConfig(params) {
1306
1138
  var unsubscribe = widgetStateStore.subscribe(function (state) {
1307
1139
  return state.auth;
1308
1140
  }, /*#__PURE__*/function () {
1309
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth) {
1141
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(auth) {
1310
1142
  var maxWait, isLoaded;
1311
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1312
- while (1) switch (_context.prev = _context.next) {
1143
+ return _regenerator().w(function (_context) {
1144
+ while (1) switch (_context.n) {
1313
1145
  case 0:
1314
1146
  if (!(auth !== "not_authenticated" && auth !== "loading")) {
1315
- _context.next = 15;
1147
+ _context.n = 5;
1316
1148
  break;
1317
1149
  }
1318
1150
  // this might happen before the iframe is loaded, so we need to check for the ACK message
1319
1151
  // before sending the auth session to the iframe
1320
1152
  maxWait = 2000;
1321
1153
  isLoaded = false;
1322
- case 3:
1154
+ case 1:
1323
1155
  if (!(!isLoaded && maxWait > 0)) {
1324
- _context.next = 10;
1156
+ _context.n = 3;
1325
1157
  break;
1326
1158
  }
1327
1159
  isLoaded = widgetStateStore.select(function (state) {
1328
1160
  return state.injected === "loaded" || state.injected === "configured";
1329
1161
  });
1330
1162
  maxWait -= 100;
1331
- _context.next = 8;
1163
+ _context.n = 2;
1332
1164
  return new Promise(function (resolve) {
1333
1165
  return setTimeout(resolve, 100);
1334
1166
  });
1335
- case 8:
1336
- _context.next = 3;
1167
+ case 2:
1168
+ _context.n = 1;
1337
1169
  break;
1338
- case 10:
1170
+ case 3:
1339
1171
  if (!isLoaded) {
1340
1172
  logger$1.error({
1341
1173
  msg: "Failed to send auth session to iframe",
@@ -1344,39 +1176,38 @@ var createConfig = function createConfig(params) {
1344
1176
  }
1345
1177
  });
1346
1178
  }
1347
- _context.next = 13;
1179
+ _context.n = 4;
1348
1180
  return iframeHandler.postMessage({
1349
1181
  type: "appConfig",
1350
1182
  data: {
1351
1183
  authSession: auth
1352
1184
  }
1353
1185
  });
1354
- case 13:
1355
- _context.next = 21;
1186
+ case 4:
1187
+ _context.n = 7;
1356
1188
  break;
1357
- case 15:
1189
+ case 5:
1358
1190
  if (!(auth === "not_authenticated")) {
1359
- _context.next = 21;
1191
+ _context.n = 7;
1360
1192
  break;
1361
1193
  }
1362
1194
  if (!(widgetStateStore.select(function (state) {
1363
1195
  return state.visible;
1364
1196
  }) === "visible")) {
1365
- _context.next = 21;
1197
+ _context.n = 7;
1366
1198
  break;
1367
1199
  }
1368
- _context.next = 19;
1200
+ _context.n = 6;
1369
1201
  return iframeHandler.hide();
1370
- case 19:
1202
+ case 6:
1371
1203
  externalEventEmitter.emit("screenClosed");
1372
1204
  widgetStateStore.update(function (state) {
1373
1205
  return _objectSpread2(_objectSpread2({}, state), {}, {
1374
1206
  visible: "not_visible"
1375
1207
  });
1376
1208
  });
1377
- case 21:
1378
- case "end":
1379
- return _context.stop();
1209
+ case 7:
1210
+ return _context.a(2);
1380
1211
  }
1381
1212
  }, _callee);
1382
1213
  }));
@@ -1388,29 +1219,26 @@ var createConfig = function createConfig(params) {
1388
1219
  emitImmediately: true
1389
1220
  });
1390
1221
  var onSignMessage = /*#__PURE__*/function () {
1391
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
1222
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref2) {
1392
1223
  var message, _yield$authAdapter$si, signature;
1393
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1394
- while (1) switch (_context2.prev = _context2.next) {
1224
+ return _regenerator().w(function (_context2) {
1225
+ while (1) switch (_context2.n) {
1395
1226
  case 0:
1396
1227
  message = _ref2.message;
1397
1228
  if (isWeb3AuthAdapter(authAdapter)) {
1398
- _context2.next = 3;
1229
+ _context2.n = 1;
1399
1230
  break;
1400
1231
  }
1401
1232
  throw new Web3AuthRequiredForThisAction("signMessage");
1402
- case 3:
1403
- _context2.next = 5;
1233
+ case 1:
1234
+ _context2.n = 2;
1404
1235
  return authAdapter.signMessage({
1405
1236
  message: message
1406
1237
  });
1407
- case 5:
1408
- _yield$authAdapter$si = _context2.sent;
1238
+ case 2:
1239
+ _yield$authAdapter$si = _context2.v;
1409
1240
  signature = _yield$authAdapter$si.signature;
1410
- return _context2.abrupt("return", signature);
1411
- case 8:
1412
- case "end":
1413
- return _context2.stop();
1241
+ return _context2.a(2, signature);
1414
1242
  }
1415
1243
  }, _callee2);
1416
1244
  }));
@@ -1443,110 +1271,110 @@ var createConfig = function createConfig(params) {
1443
1271
  });
1444
1272
  },
1445
1273
  onMessage: function () {
1446
- var _onMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
1447
- var message, rawEvent, txHash, _message$data;
1448
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1449
- while (1) switch (_context3.prev = _context3.next) {
1274
+ var _onMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(_ref5) {
1275
+ var message, rawEvent, txHash, _message$data, _t, _t2, _t3, _t4, _t5, _t6;
1276
+ return _regenerator().w(function (_context3) {
1277
+ while (1) switch (_context3.n) {
1450
1278
  case 0:
1451
1279
  message = _ref5.message, rawEvent = _ref5.rawEvent;
1452
- _context3.t0 = message.type;
1453
- _context3.next = _context3.t0 === "identityAppLoaded" ? 4 : _context3.t0 === "identityAppConfigured" ? 7 : _context3.t0 === "authenticationExpired" ? 9 : _context3.t0 === "walletSignRequest" ? 11 : _context3.t0 === "sendTransactionRequest" ? 21 : _context3.t0 === "kycCompletion" ? 29 : _context3.t0 === "scenarioExecution" ? 31 : _context3.t0 === "closeScreen" ? 33 : _context3.t0 === "txAuthDataSignatureResponse" ? 38 : _context3.t0 === "txAuthDataSignatureGatingError" ? 40 : _context3.t0 === "getCustomerStatusResponse" ? 42 : 44;
1280
+ _t = message.type;
1281
+ _context3.n = _t === "identityAppLoaded" ? 1 : _t === "identityAppConfigured" ? 2 : _t === "authenticationExpired" ? 3 : _t === "walletSignRequest" ? 4 : _t === "sendTransactionRequest" ? 7 : _t === "kycCompletion" ? 11 : _t === "scenarioExecution" ? 12 : _t === "closeScreen" ? 13 : _t === "txAuthDataSignatureResponse" ? 15 : _t === "txAuthDataSignatureGatingError" ? 16 : _t === "getCustomerStatusResponse" ? 17 : 18;
1454
1282
  break;
1455
- case 4:
1283
+ case 1:
1456
1284
  externalEventEmitter.emit("appLoaded");
1457
1285
  widgetStateStore.update(function (state) {
1458
1286
  return _objectSpread2(_objectSpread2({}, state), {}, {
1459
1287
  injected: "loaded"
1460
1288
  });
1461
1289
  });
1462
- return _context3.abrupt("break", 46);
1463
- case 7:
1290
+ return _context3.a(3, 19);
1291
+ case 2:
1464
1292
  widgetStateStore.update(function (state) {
1465
1293
  return _objectSpread2(_objectSpread2({}, state), {}, {
1466
1294
  injected: "configured",
1467
1295
  auth: message.data.auth
1468
1296
  });
1469
1297
  });
1470
- return _context3.abrupt("break", 46);
1471
- case 9:
1298
+ return _context3.a(3, 19);
1299
+ case 3:
1472
1300
  widgetStateStore.update(function (state) {
1473
1301
  return _objectSpread2(_objectSpread2({}, state), {}, {
1474
1302
  auth: "not_authenticated"
1475
1303
  });
1476
1304
  });
1477
- return _context3.abrupt("break", 46);
1478
- case 11:
1479
- _context3.t1 = iframeHandler;
1480
- _context3.t2 = message.data.message;
1481
- _context3.next = 15;
1305
+ return _context3.a(3, 19);
1306
+ case 4:
1307
+ _t2 = iframeHandler;
1308
+ _t3 = message.data.message;
1309
+ _context3.n = 5;
1482
1310
  return onSignMessage({
1483
1311
  message: message.data.message
1484
1312
  });
1485
- case 15:
1486
- _context3.t3 = _context3.sent;
1487
- _context3.t4 = {
1488
- message: _context3.t2,
1489
- signature: _context3.t3
1313
+ case 5:
1314
+ _t4 = _context3.v;
1315
+ _t5 = {
1316
+ message: _t3,
1317
+ signature: _t4
1490
1318
  };
1491
- _context3.t5 = {
1319
+ _t6 = {
1492
1320
  type: "walletSignResponse",
1493
- data: _context3.t4
1321
+ data: _t5
1494
1322
  };
1495
- _context3.next = 20;
1496
- return _context3.t1.postMessage.call(_context3.t1, _context3.t5);
1497
- case 20:
1498
- return _context3.abrupt("break", 46);
1499
- case 21:
1500
- _context3.next = 23;
1323
+ _context3.n = 6;
1324
+ return _t2.postMessage.call(_t2, _t6);
1325
+ case 6:
1326
+ return _context3.a(3, 19);
1327
+ case 7:
1328
+ _context3.n = 8;
1501
1329
  return onSendTransaction({
1502
1330
  data: message.data
1503
1331
  });
1504
- case 23:
1505
- txHash = _context3.sent;
1332
+ case 8:
1333
+ txHash = _context3.v;
1506
1334
  if (!(txHash === undefined)) {
1507
- _context3.next = 26;
1335
+ _context3.n = 9;
1508
1336
  break;
1509
1337
  }
1510
1338
  throw new Error("Returned TxHash was undefined");
1511
- case 26:
1512
- _context3.next = 28;
1339
+ case 9:
1340
+ _context3.n = 10;
1513
1341
  return iframeHandler.postMessage({
1514
1342
  type: "transactionResponse",
1515
1343
  data: {
1516
1344
  txHash: txHash
1517
1345
  }
1518
1346
  });
1519
- case 28:
1520
- return _context3.abrupt("break", 46);
1521
- case 29:
1347
+ case 10:
1348
+ return _context3.a(3, 19);
1349
+ case 11:
1522
1350
  externalEventEmitter.emit("kycCompleted", identitySchemas.KycCompletionData.parse(message.data));
1523
- return _context3.abrupt("break", 46);
1524
- case 31:
1351
+ return _context3.a(3, 19);
1352
+ case 12:
1525
1353
  externalEventEmitter.emit("scenarioExecuted", identitySchemas.ScenarioExecutionData.parse(message.data));
1526
- return _context3.abrupt("break", 46);
1527
- case 33:
1528
- _context3.next = 35;
1354
+ return _context3.a(3, 19);
1355
+ case 13:
1356
+ _context3.n = 14;
1529
1357
  return iframeHandler.hide();
1530
- case 35:
1358
+ case 14:
1531
1359
  externalEventEmitter.emit("screenClosed");
1532
1360
  widgetStateStore.update(function (state) {
1533
1361
  return _objectSpread2(_objectSpread2({}, state), {}, {
1534
1362
  visible: "not_visible"
1535
1363
  });
1536
1364
  });
1537
- return _context3.abrupt("break", 46);
1538
- case 38:
1365
+ return _context3.a(3, 19);
1366
+ case 15:
1539
1367
  externalEventEmitter.emit("txAuthDataSignatureResponse", message.data);
1540
- return _context3.abrupt("break", 46);
1541
- case 40:
1368
+ return _context3.a(3, 19);
1369
+ case 16:
1542
1370
  externalEventEmitter.emit("txAuthDataSignatureGatingError", message.data);
1543
- return _context3.abrupt("break", 46);
1544
- case 42:
1371
+ return _context3.a(3, 19);
1372
+ case 17:
1545
1373
  externalEventEmitter.emit("getCustomerStatusResponse", {
1546
1374
  status: (_message$data = message.data) !== null && _message$data !== void 0 ? _message$data : null
1547
1375
  });
1548
- return _context3.abrupt("break", 46);
1549
- case 44:
1376
+ return _context3.a(3, 19);
1377
+ case 18:
1550
1378
  logger$1.debug({
1551
1379
  msg: "Unhandled message type:",
1552
1380
  values: {
@@ -1554,10 +1382,9 @@ var createConfig = function createConfig(params) {
1554
1382
  rawEvent: rawEvent
1555
1383
  }
1556
1384
  });
1557
- return _context3.abrupt("break", 46);
1558
- case 46:
1559
- case "end":
1560
- return _context3.stop();
1385
+ return _context3.a(3, 19);
1386
+ case 19:
1387
+ return _context3.a(2);
1561
1388
  }
1562
1389
  }, _callee3);
1563
1390
  }));
@@ -1650,54 +1477,54 @@ var createWeb3AuthAdapter = function createWeb3AuthAdapter(params) {
1650
1477
  env: getEnv()
1651
1478
  });
1652
1479
  var login = /*#__PURE__*/function () {
1653
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(loginParams) {
1654
- var address, blockchainId, challengeRes, signatureRes, VerifyWalletChallengeRequest, res;
1655
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1656
- while (1) switch (_context.prev = _context.next) {
1480
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(loginParams) {
1481
+ var address, blockchainId, challengeRes, signatureRes, VerifyWalletChallengeRequest, res, _t;
1482
+ return _regenerator().w(function (_context) {
1483
+ while (1) switch (_context.n) {
1657
1484
  case 0:
1658
- _context.next = 2;
1485
+ _context.n = 1;
1659
1486
  return wallet.getAddress();
1660
- case 2:
1661
- address = _context.sent;
1487
+ case 1:
1488
+ address = _context.v;
1662
1489
  if (address) {
1663
- _context.next = 5;
1490
+ _context.n = 2;
1664
1491
  break;
1665
1492
  }
1666
1493
  throw new AddressUndefinedButRequiredForLogin();
1667
- case 5:
1494
+ case 2:
1668
1495
  blockchainId = undefined;
1669
1496
  if (!wallet.getBlockchainId) {
1670
- _context.next = 10;
1497
+ _context.n = 4;
1671
1498
  break;
1672
1499
  }
1673
- _context.next = 9;
1500
+ _context.n = 3;
1674
1501
  return wallet.getBlockchainId();
1675
- case 9:
1676
- blockchainId = _context.sent;
1677
- case 10:
1678
- _context.next = 12;
1502
+ case 3:
1503
+ blockchainId = _context.v;
1504
+ case 4:
1505
+ _context.n = 5;
1679
1506
  return generateChallenge({
1680
1507
  address: address,
1681
1508
  namespace: wallet.namespace,
1682
1509
  blockchainId: blockchainId,
1683
1510
  origin: getOrigin(loginParams)
1684
1511
  });
1685
- case 12:
1686
- challengeRes = _context.sent;
1687
- _context.prev = 13;
1688
- _context.next = 16;
1512
+ case 5:
1513
+ challengeRes = _context.v;
1514
+ _context.p = 6;
1515
+ _context.n = 7;
1689
1516
  return wallet.sign({
1690
1517
  message: challengeRes.challenge
1691
1518
  });
1692
- case 16:
1693
- signatureRes = _context.sent;
1694
- _context.next = 22;
1519
+ case 7:
1520
+ signatureRes = _context.v;
1521
+ _context.n = 9;
1695
1522
  break;
1696
- case 19:
1697
- _context.prev = 19;
1698
- _context.t0 = _context["catch"](13);
1699
- throw new Web3SignatureRejected(_context.t0);
1700
- case 22:
1523
+ case 8:
1524
+ _context.p = 8;
1525
+ _t = _context.v;
1526
+ throw new Web3SignatureRejected(_t);
1527
+ case 9:
1701
1528
  VerifyWalletChallengeRequest = _objectSpread2({
1702
1529
  address: address,
1703
1530
  namespace: wallet.namespace,
@@ -1706,12 +1533,9 @@ var createWeb3AuthAdapter = function createWeb3AuthAdapter(params) {
1706
1533
  res = params.verifyChallenge ? params.verifyChallenge(VerifyWalletChallengeRequest) : identityApiClient$1.auth.verifyWalletChallenge({
1707
1534
  requestBody: VerifyWalletChallengeRequest
1708
1535
  });
1709
- return _context.abrupt("return", res);
1710
- case 25:
1711
- case "end":
1712
- return _context.stop();
1536
+ return _context.a(2, res);
1713
1537
  }
1714
- }, _callee, null, [[13, 19]]);
1538
+ }, _callee, null, [[6, 8]]);
1715
1539
  }));
1716
1540
  return function login(_x) {
1717
1541
  return _ref.apply(this, arguments);
@@ -1731,23 +1555,20 @@ var createWeb3AuthAdapter = function createWeb3AuthAdapter(params) {
1731
1555
  * @private
1732
1556
  */
1733
1557
  var getSessionData = /*#__PURE__*/function () {
1734
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth) {
1558
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(auth) {
1735
1559
  var decoded, res;
1736
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1737
- while (1) switch (_context.prev = _context.next) {
1560
+ return _regenerator().w(function (_context) {
1561
+ while (1) switch (_context.n) {
1738
1562
  case 0:
1739
1563
  decoded = jwtDecode__default["default"](auth.token);
1740
1564
  res = identitySchemas.IdentityWidgetAccessToken_NEW.safeParse(decoded);
1741
1565
  if (res.success) {
1742
- _context.next = 4;
1566
+ _context.n = 1;
1743
1567
  break;
1744
1568
  }
1745
1569
  throw new SessionDataIncompleteError(decoded, identitySchemas.IdentityWidgetAccessToken_NEW);
1746
- case 4:
1747
- return _context.abrupt("return", res.data);
1748
- case 5:
1749
- case "end":
1750
- return _context.stop();
1570
+ case 1:
1571
+ return _context.a(2, res.data);
1751
1572
  }
1752
1573
  }, _callee);
1753
1574
  }));
@@ -1783,71 +1604,71 @@ var isAuthenticated = function isAuthenticated(config) {
1783
1604
  * @throws {Web3SignatureRejected} if the signature is rejected
1784
1605
  */
1785
1606
  var attachWalletToIdentity = /*#__PURE__*/function () {
1786
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, options) {
1787
- var authSession, wallet, identityApiClient$1, address, origin, blockchainId, sessionData, workflowId, challengeRes, signatureRes, walletAddRes, _err$body;
1788
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1789
- while (1) switch (_context.prev = _context.next) {
1607
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config, options) {
1608
+ var authSession, wallet, identityApiClient$1, address, origin, blockchainId, sessionData, workflowId, challengeRes, signatureRes, walletAddRes, _err$body, _t, _t2, _t3;
1609
+ return _regenerator().w(function (_context) {
1610
+ while (1) switch (_context.n) {
1790
1611
  case 0:
1791
1612
  if (isAuthenticated(config)) {
1792
- _context.next = 2;
1613
+ _context.n = 1;
1793
1614
  break;
1794
1615
  }
1795
1616
  throw new MustBeLoggedIn(config._internal.logger, "attachWallet");
1796
- case 2:
1617
+ case 1:
1797
1618
  authSession = config._internal.widgetStateStore.select(function (state) {
1798
1619
  return state.auth;
1799
1620
  });
1800
1621
  if (!(authSession === "loading" || authSession === "not_authenticated")) {
1801
- _context.next = 5;
1622
+ _context.n = 2;
1802
1623
  break;
1803
1624
  }
1804
1625
  throw new MustBeLoggedIn(config._internal.logger, "attachWallet");
1805
- case 5:
1626
+ case 2:
1806
1627
  wallet = options.wallet;
1807
1628
  if (wallet) {
1808
- _context.next = 8;
1629
+ _context.n = 3;
1809
1630
  break;
1810
1631
  }
1811
1632
  throw new Web3AuthRequiredForThisAction("attachWallet");
1812
- case 8:
1633
+ case 3:
1813
1634
  // request a challenge to attach the wallet
1814
1635
  identityApiClient$1 = identityApiClient.createIdentityApiClient({
1815
1636
  env: getEnv(),
1816
1637
  jwt: authSession.token
1817
1638
  });
1818
- _context.next = 11;
1639
+ _context.n = 4;
1819
1640
  return wallet.getAddress();
1820
- case 11:
1821
- address = _context.sent;
1641
+ case 4:
1642
+ address = _context.v;
1822
1643
  if (address) {
1823
- _context.next = 14;
1644
+ _context.n = 5;
1824
1645
  break;
1825
1646
  }
1826
1647
  throw new AddressUndefinedButRequiredForLogin();
1827
- case 14:
1648
+ case 5:
1828
1649
  origin = getOrigin({
1829
1650
  origin: options.origin
1830
1651
  });
1831
1652
  if (!wallet.getBlockchainId) {
1832
- _context.next = 21;
1653
+ _context.n = 7;
1833
1654
  break;
1834
1655
  }
1835
- _context.next = 18;
1656
+ _context.n = 6;
1836
1657
  return wallet.getBlockchainId();
1837
- case 18:
1838
- _context.t0 = _context.sent;
1839
- _context.next = 22;
1658
+ case 6:
1659
+ _t = _context.v;
1660
+ _context.n = 8;
1840
1661
  break;
1841
- case 21:
1842
- _context.t0 = undefined;
1843
- case 22:
1844
- blockchainId = _context.t0;
1845
- _context.next = 25;
1662
+ case 7:
1663
+ _t = undefined;
1664
+ case 8:
1665
+ blockchainId = _t;
1666
+ _context.n = 9;
1846
1667
  return getSessionData(authSession);
1847
- case 25:
1848
- sessionData = _context.sent;
1668
+ case 9:
1669
+ sessionData = _context.v;
1849
1670
  workflowId = sessionData.workflowId;
1850
- _context.next = 29;
1671
+ _context.n = 10;
1851
1672
  return identityApiClient$1.identity.createWalletChallengeToAddWallet({
1852
1673
  requestBody: {
1853
1674
  address: address,
@@ -1858,52 +1679,51 @@ var attachWalletToIdentity = /*#__PURE__*/function () {
1858
1679
  workflowId: workflowId
1859
1680
  }
1860
1681
  });
1861
- case 29:
1862
- challengeRes = _context.sent;
1863
- _context.prev = 30;
1864
- _context.next = 33;
1682
+ case 10:
1683
+ challengeRes = _context.v;
1684
+ _context.p = 11;
1685
+ _context.n = 12;
1865
1686
  return wallet.sign({
1866
1687
  message: challengeRes.challenge
1867
1688
  });
1868
- case 33:
1869
- signatureRes = _context.sent;
1870
- _context.next = 39;
1689
+ case 12:
1690
+ signatureRes = _context.v;
1691
+ _context.n = 14;
1871
1692
  break;
1872
- case 36:
1873
- _context.prev = 36;
1874
- _context.t1 = _context["catch"](30);
1875
- throw new Web3SignatureRejected(_context.t1);
1876
- case 39:
1877
- _context.prev = 39;
1878
- _context.next = 42;
1693
+ case 13:
1694
+ _context.p = 13;
1695
+ _t2 = _context.v;
1696
+ throw new Web3SignatureRejected(_t2);
1697
+ case 14:
1698
+ _context.p = 14;
1699
+ _context.n = 15;
1879
1700
  return identityApiClient$1.identity.addWalletToIdentity({
1880
1701
  requestBody: signatureRes
1881
1702
  });
1882
- case 42:
1883
- walletAddRes = _context.sent;
1884
- return _context.abrupt("return", walletAddRes.success);
1885
- case 46:
1886
- _context.prev = 46;
1887
- _context.t2 = _context["catch"](39);
1888
- if (!(_context.t2 instanceof identityApiClient.ApiError &&
1703
+ case 15:
1704
+ walletAddRes = _context.v;
1705
+ return _context.a(2, walletAddRes.success);
1706
+ case 16:
1707
+ _context.p = 16;
1708
+ _t3 = _context.v;
1709
+ if (!(_t3 instanceof identityApiClient.ApiError &&
1889
1710
  // TODO: have a better way to check for this error
1890
1711
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1891
- (_context.t2 === null || _context.t2 === void 0 || (_err$body = _context.t2.body) === null || _err$body === void 0 ? void 0 : _err$body.message) === "Wallet already attached to another identity")) {
1892
- _context.next = 50;
1712
+ (_t3 === null || _t3 === void 0 || (_err$body = _t3.body) === null || _err$body === void 0 ? void 0 : _err$body.message) === "Wallet already attached to another identity")) {
1713
+ _context.n = 17;
1893
1714
  break;
1894
1715
  }
1895
- throw new WalletAlreadyLinkedToAnotherIdentity(config._internal.logger, _context.t2);
1896
- case 50:
1716
+ throw new WalletAlreadyLinkedToAnotherIdentity(config._internal.logger, _t3);
1717
+ case 17:
1897
1718
  config._internal.logger.error({
1898
1719
  msg: "Failed to add wallet to identity",
1899
- err: _context.t2
1720
+ err: _t3
1900
1721
  });
1901
- throw _context.t2;
1902
- case 52:
1903
- case "end":
1904
- return _context.stop();
1722
+ throw _t3;
1723
+ case 18:
1724
+ return _context.a(2);
1905
1725
  }
1906
- }, _callee, null, [[30, 36], [39, 46]]);
1726
+ }, _callee, null, [[14, 16], [11, 13]]);
1907
1727
  }));
1908
1728
  return function attachWalletToIdentity(_x, _x2) {
1909
1729
  return _ref.apply(this, arguments);
@@ -1919,10 +1739,10 @@ var attachWalletToIdentity = /*#__PURE__*/function () {
1919
1739
  * @returns a promise that resolves to true if the user has been successfully authenticated, false otherwise
1920
1740
  */
1921
1741
  var authenticate = /*#__PURE__*/function () {
1922
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, loginParams) {
1923
- var authAdapter, widgetStateStore, auth, authSession;
1924
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1925
- while (1) switch (_context.prev = _context.next) {
1742
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config, loginParams) {
1743
+ var authAdapter, widgetStateStore, auth, authSession, _t;
1744
+ return _regenerator().w(function (_context) {
1745
+ while (1) switch (_context.n) {
1926
1746
  case 0:
1927
1747
  authAdapter = config._internal.authAdapter;
1928
1748
  widgetStateStore = config._internal.widgetStateStore;
@@ -1930,46 +1750,46 @@ var authenticate = /*#__PURE__*/function () {
1930
1750
  return state.auth;
1931
1751
  });
1932
1752
  if (!(auth !== "not_authenticated" && auth !== "loading")) {
1933
- _context.next = 5;
1753
+ _context.n = 1;
1934
1754
  break;
1935
1755
  }
1936
- return _context.abrupt("return", true);
1937
- case 5:
1756
+ return _context.a(2, true);
1757
+ case 1:
1938
1758
  if (!(auth === "loading")) {
1939
- _context.next = 7;
1759
+ _context.n = 2;
1940
1760
  break;
1941
1761
  }
1942
- return _context.abrupt("return", false);
1943
- case 7:
1944
- _context.prev = 7;
1762
+ return _context.a(2, false);
1763
+ case 2:
1764
+ _context.p = 2;
1945
1765
  widgetStateStore.update(function (s) {
1946
1766
  return _objectSpread2(_objectSpread2({}, s), {}, {
1947
1767
  auth: "loading"
1948
1768
  });
1949
1769
  });
1950
- _context.next = 11;
1770
+ _context.n = 3;
1951
1771
  return authAdapter.login(loginParams);
1952
- case 11:
1953
- authSession = _context.sent;
1772
+ case 3:
1773
+ authSession = _context.v;
1954
1774
  widgetStateStore.update(function (s) {
1955
1775
  return _objectSpread2(_objectSpread2({}, s), {}, {
1956
1776
  auth: authSession
1957
1777
  });
1958
1778
  });
1959
- return _context.abrupt("return", true);
1960
- case 16:
1961
- _context.prev = 16;
1962
- _context.t0 = _context["catch"](7);
1779
+ return _context.a(2, true);
1780
+ case 4:
1781
+ _context.p = 4;
1782
+ _t = _context.v;
1963
1783
  // log less verbose for signature rejection as it is expected
1964
- if (_context.t0 instanceof Web3SignatureRejected) {
1784
+ if (_t instanceof Web3SignatureRejected) {
1965
1785
  config._internal.logger.debug({
1966
1786
  msg: "User rejected signature request",
1967
- err: _context.t0
1787
+ err: _t
1968
1788
  });
1969
1789
  } else {
1970
1790
  config._internal.logger.error({
1971
1791
  msg: "Failed to authenticate",
1972
- err: _context.t0
1792
+ err: _t
1973
1793
  });
1974
1794
  }
1975
1795
  widgetStateStore.update(function (s) {
@@ -1977,12 +1797,11 @@ var authenticate = /*#__PURE__*/function () {
1977
1797
  auth: "not_authenticated"
1978
1798
  });
1979
1799
  });
1980
- throw _context.t0;
1981
- case 21:
1982
- case "end":
1983
- return _context.stop();
1800
+ throw _t;
1801
+ case 5:
1802
+ return _context.a(2);
1984
1803
  }
1985
- }, _callee, null, [[7, 16]]);
1804
+ }, _callee, null, [[2, 4]]);
1986
1805
  }));
1987
1806
  return function authenticate(_x, _x2) {
1988
1807
  return _ref.apply(this, arguments);
@@ -2023,37 +1842,34 @@ var closeWidget = function closeWidget(config) {
2023
1842
  */
2024
1843
  // eslint-disable-next-line @typescript-eslint/require-await
2025
1844
  var disconnect = /*#__PURE__*/function () {
2026
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config) {
1845
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
2027
1846
  var widgetStateStore, auth;
2028
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2029
- while (1) switch (_context.prev = _context.next) {
1847
+ return _regenerator().w(function (_context) {
1848
+ while (1) switch (_context.n) {
2030
1849
  case 0:
2031
1850
  widgetStateStore = config._internal.widgetStateStore;
2032
1851
  auth = widgetStateStore.select(function (state) {
2033
1852
  return state.auth;
2034
1853
  });
2035
1854
  if (!(auth === "not_authenticated")) {
2036
- _context.next = 4;
1855
+ _context.n = 1;
2037
1856
  break;
2038
1857
  }
2039
- return _context.abrupt("return", true);
2040
- case 4:
1858
+ return _context.a(2, true);
1859
+ case 1:
2041
1860
  if (!(auth === "loading")) {
2042
- _context.next = 6;
1861
+ _context.n = 2;
2043
1862
  break;
2044
1863
  }
2045
- return _context.abrupt("return", false);
2046
- case 6:
1864
+ return _context.a(2, false);
1865
+ case 2:
2047
1866
  config._internal.iframeHandler.reset();
2048
1867
  widgetStateStore.update(function (s) {
2049
1868
  return _objectSpread2(_objectSpread2({}, s), {}, {
2050
1869
  auth: "not_authenticated"
2051
1870
  });
2052
1871
  });
2053
- return _context.abrupt("return", true);
2054
- case 9:
2055
- case "end":
2056
- return _context.stop();
1872
+ return _context.a(2, true);
2057
1873
  }
2058
1874
  }, _callee);
2059
1875
  }));
@@ -2149,49 +1965,48 @@ var waitForWidgetAppConfigured = function waitForWidgetAppConfigured(config) {
2149
1965
  * @returns the customer status
2150
1966
  */
2151
1967
  var getCustomerStatus = /*#__PURE__*/function () {
2152
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config) {
2153
- var authenticated;
2154
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2155
- while (1) switch (_context.prev = _context.next) {
1968
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
1969
+ var authenticated, _t;
1970
+ return _regenerator().w(function (_context) {
1971
+ while (1) switch (_context.n) {
2156
1972
  case 0:
2157
- _context.next = 2;
1973
+ _context.n = 1;
2158
1974
  return load(config);
2159
- case 2:
1975
+ case 1:
2160
1976
  authenticated = isAuthenticated(config);
2161
1977
  if (authenticated) {
2162
- _context.next = 5;
1978
+ _context.n = 2;
2163
1979
  break;
2164
1980
  }
2165
- return _context.abrupt("return", null);
2166
- case 5:
2167
- _context.prev = 5;
2168
- _context.next = 8;
1981
+ return _context.a(2, null);
1982
+ case 2:
1983
+ _context.p = 2;
1984
+ _context.n = 3;
2169
1985
  return waitForWidgetAppConfigured(config);
2170
- case 8:
2171
- _context.next = 10;
1986
+ case 3:
1987
+ _context.n = 4;
2172
1988
  return config._internal.iframeHandler.postMessage({
2173
1989
  type: "getCustomerStatusRequest"
2174
1990
  });
2175
- case 10:
2176
- return _context.abrupt("return", new Promise(function (resolve) {
1991
+ case 4:
1992
+ return _context.a(2, new Promise(function (resolve) {
2177
1993
  return config._internal.externalEventEmitter.once("getCustomerStatusResponse", function (_ref2) {
2178
1994
  var status = _ref2.status;
2179
1995
  return resolve(status);
2180
1996
  });
2181
1997
  }));
2182
- case 13:
2183
- _context.prev = 13;
2184
- _context.t0 = _context["catch"](5);
1998
+ case 5:
1999
+ _context.p = 5;
2000
+ _t = _context.v;
2185
2001
  config._internal.logger.error({
2186
2002
  msg: "Failed to fetch user status",
2187
- err: _context.t0
2003
+ err: _t
2188
2004
  });
2189
- throw _context.t0;
2190
- case 17:
2191
- case "end":
2192
- return _context.stop();
2005
+ throw _t;
2006
+ case 6:
2007
+ return _context.a(2);
2193
2008
  }
2194
- }, _callee, null, [[5, 13]]);
2009
+ }, _callee, null, [[2, 5]]);
2195
2010
  }));
2196
2011
  return function getCustomerStatus(_x) {
2197
2012
  return _ref.apply(this, arguments);
@@ -2207,34 +2022,31 @@ var getCustomerStatus = /*#__PURE__*/function () {
2207
2022
  * @throws {MustBeLoggedIn} if the user is not logged in
2208
2023
  */
2209
2024
  var getIdentityId = /*#__PURE__*/function () {
2210
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config) {
2025
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
2211
2026
  var authSession, sessionData;
2212
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2213
- while (1) switch (_context.prev = _context.next) {
2027
+ return _regenerator().w(function (_context) {
2028
+ while (1) switch (_context.n) {
2214
2029
  case 0:
2215
2030
  if (isAuthenticated(config)) {
2216
- _context.next = 2;
2031
+ _context.n = 1;
2217
2032
  break;
2218
2033
  }
2219
2034
  throw new MustBeLoggedIn(config._internal.logger, "attachWallet");
2220
- case 2:
2035
+ case 1:
2221
2036
  authSession = config._internal.widgetStateStore.select(function (state) {
2222
2037
  return state.auth;
2223
2038
  });
2224
2039
  if (!(authSession === "loading" || authSession === "not_authenticated")) {
2225
- _context.next = 5;
2040
+ _context.n = 2;
2226
2041
  break;
2227
2042
  }
2228
2043
  throw new MustBeLoggedIn(config._internal.logger, "attachWallet");
2229
- case 5:
2230
- _context.next = 7;
2044
+ case 2:
2045
+ _context.n = 3;
2231
2046
  return getSessionData(authSession);
2232
- case 7:
2233
- sessionData = _context.sent;
2234
- return _context.abrupt("return", sessionData.sub);
2235
- case 9:
2236
- case "end":
2237
- return _context.stop();
2047
+ case 3:
2048
+ sessionData = _context.v;
2049
+ return _context.a(2, sessionData.sub);
2238
2050
  }
2239
2051
  }, _callee);
2240
2052
  }));
@@ -2252,38 +2064,35 @@ var getIdentityId = /*#__PURE__*/function () {
2252
2064
  * @throws {MustBeLoggedIn} if the user is not logged in
2253
2065
  */
2254
2066
  var getIdentityWallets = /*#__PURE__*/function () {
2255
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config) {
2067
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
2256
2068
  var authSession, identityApiClient$1, wallets;
2257
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2258
- while (1) switch (_context.prev = _context.next) {
2069
+ return _regenerator().w(function (_context) {
2070
+ while (1) switch (_context.n) {
2259
2071
  case 0:
2260
2072
  if (isAuthenticated(config)) {
2261
- _context.next = 2;
2073
+ _context.n = 1;
2262
2074
  break;
2263
2075
  }
2264
2076
  throw new MustBeLoggedIn(config._internal.logger, "attachWallet");
2265
- case 2:
2077
+ case 1:
2266
2078
  authSession = config._internal.widgetStateStore.select(function (state) {
2267
2079
  return state.auth;
2268
2080
  });
2269
2081
  if (!(authSession === "loading" || authSession === "not_authenticated")) {
2270
- _context.next = 5;
2082
+ _context.n = 2;
2271
2083
  break;
2272
2084
  }
2273
2085
  throw new MustBeLoggedIn(config._internal.logger, "attachWallet");
2274
- case 5:
2086
+ case 2:
2275
2087
  identityApiClient$1 = identityApiClient.createIdentityApiClient({
2276
2088
  env: getEnv(),
2277
2089
  jwt: authSession.token
2278
2090
  });
2279
- _context.next = 8;
2091
+ _context.n = 3;
2280
2092
  return identityApiClient$1.identity.listWallets();
2281
- case 8:
2282
- wallets = _context.sent;
2283
- return _context.abrupt("return", wallets.wallets);
2284
- case 10:
2285
- case "end":
2286
- return _context.stop();
2093
+ case 3:
2094
+ wallets = _context.v;
2095
+ return _context.a(2, wallets.wallets);
2287
2096
  }
2288
2097
  }, _callee);
2289
2098
  }));
@@ -2293,7 +2102,7 @@ var getIdentityWallets = /*#__PURE__*/function () {
2293
2102
  }();
2294
2103
 
2295
2104
  var getTxAuthDataSignature = /*#__PURE__*/function () {
2296
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(
2105
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(
2297
2106
  /**
2298
2107
  * Request ComPilot to sign the user transaction data with Compilot's signer private key.
2299
2108
  * This is the action that should be used to handle signature gating.
@@ -2304,33 +2113,33 @@ var getTxAuthDataSignature = /*#__PURE__*/function () {
2304
2113
  * @returns a promise that resolves to the signed transaction data response.
2305
2114
  */
2306
2115
  config, input) {
2307
- var authenticated;
2308
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2309
- while (1) switch (_context.prev = _context.next) {
2116
+ var authenticated, _t;
2117
+ return _regenerator().w(function (_context) {
2118
+ while (1) switch (_context.n) {
2310
2119
  case 0:
2311
- _context.next = 2;
2120
+ _context.n = 1;
2312
2121
  return load(config);
2313
- case 2:
2122
+ case 1:
2314
2123
  authenticated = isAuthenticated(config);
2315
2124
  if (authenticated) {
2316
- _context.next = 5;
2125
+ _context.n = 2;
2317
2126
  break;
2318
2127
  }
2319
2128
  throw new Error("Not authenticated, cannot sign transaction data");
2320
- case 5:
2321
- _context.prev = 5;
2322
- _context.next = 8;
2129
+ case 2:
2130
+ _context.p = 2;
2131
+ _context.n = 3;
2323
2132
  return waitForWidgetAppConfigured(config);
2324
- case 8:
2325
- _context.next = 10;
2133
+ case 3:
2134
+ _context.n = 4;
2326
2135
  return config._internal.iframeHandler.postMessage({
2327
2136
  type: "txAuthDataSignatureGatingRequest",
2328
2137
  data: {
2329
2138
  input: input
2330
2139
  }
2331
2140
  });
2332
- case 10:
2333
- return _context.abrupt("return", new Promise(function (resolve, reject) {
2141
+ case 4:
2142
+ return _context.a(2, new Promise(function (resolve, reject) {
2334
2143
  var responseUnwatch = config._internal.externalEventEmitter.once("txAuthDataSignatureResponse", function (response) {
2335
2144
  unwatch();
2336
2145
  // the API will respond code 200 + error if the contract is not registered or not in the project
@@ -2368,19 +2177,18 @@ var getTxAuthDataSignature = /*#__PURE__*/function () {
2368
2177
  errorUnwatch();
2369
2178
  };
2370
2179
  }));
2371
- case 13:
2372
- _context.prev = 13;
2373
- _context.t0 = _context["catch"](5);
2180
+ case 5:
2181
+ _context.p = 5;
2182
+ _t = _context.v;
2374
2183
  config._internal.logger.error({
2375
2184
  msg: "Failed to sign transaction data",
2376
- err: _context.t0
2185
+ err: _t
2377
2186
  });
2378
- throw _context.t0;
2379
- case 17:
2380
- case "end":
2381
- return _context.stop();
2187
+ throw _t;
2188
+ case 6:
2189
+ return _context.a(2);
2382
2190
  }
2383
- }, _callee, null, [[5, 13]]);
2191
+ }, _callee, null, [[2, 5]]);
2384
2192
  }));
2385
2193
  return function getTxAuthDataSignature(_x, _x2) {
2386
2194
  return _ref.apply(this, arguments);
@@ -2433,48 +2241,47 @@ var isWidgetAppLoaded = function isWidgetAppLoaded(config) {
2433
2241
  * @returns A promise that resolves when the widget is open
2434
2242
  */
2435
2243
  var openWidget = /*#__PURE__*/function () {
2436
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, loginParams) {
2437
- var authenticated;
2438
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2439
- while (1) switch (_context.prev = _context.next) {
2244
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config, loginParams) {
2245
+ var authenticated, _t;
2246
+ return _regenerator().w(function (_context) {
2247
+ while (1) switch (_context.n) {
2440
2248
  case 0:
2441
- _context.next = 2;
2249
+ _context.n = 1;
2442
2250
  return load(config);
2443
- case 2:
2444
- _context.prev = 2;
2445
- _context.next = 5;
2251
+ case 1:
2252
+ _context.p = 1;
2253
+ _context.n = 2;
2446
2254
  return authenticate(config, loginParams);
2447
- case 5:
2448
- authenticated = _context.sent;
2255
+ case 2:
2256
+ authenticated = _context.v;
2449
2257
  if (!(authenticated && !isOpen(config))) {
2450
- _context.next = 9;
2258
+ _context.n = 3;
2451
2259
  break;
2452
2260
  }
2453
- _context.next = 9;
2261
+ _context.n = 3;
2454
2262
  return config._internal.iframeHandler.show();
2455
- case 9:
2456
- return _context.abrupt("return", true);
2457
- case 12:
2458
- _context.prev = 12;
2459
- _context.t0 = _context["catch"](2);
2263
+ case 3:
2264
+ return _context.a(2, true);
2265
+ case 4:
2266
+ _context.p = 4;
2267
+ _t = _context.v;
2460
2268
  // log less verbose for signature rejection as it is expected
2461
- if (_context.t0 instanceof Web3SignatureRejected) {
2269
+ if (_t instanceof Web3SignatureRejected) {
2462
2270
  config._internal.logger.debug({
2463
2271
  msg: "User rejected signature request",
2464
- err: _context.t0
2272
+ err: _t
2465
2273
  });
2466
2274
  } else {
2467
2275
  config._internal.logger.error({
2468
2276
  msg: "Failed to authenticate",
2469
- err: _context.t0
2277
+ err: _t
2470
2278
  });
2471
2279
  }
2472
- throw _context.t0;
2473
- case 16:
2474
- case "end":
2475
- return _context.stop();
2280
+ throw _t;
2281
+ case 5:
2282
+ return _context.a(2);
2476
2283
  }
2477
- }, _callee, null, [[2, 12]]);
2284
+ }, _callee, null, [[1, 4]]);
2478
2285
  }));
2479
2286
  return function openWidget(_x, _x2) {
2480
2287
  return _ref.apply(this, arguments);
@@ -2489,21 +2296,20 @@ var openWidget = /*#__PURE__*/function () {
2489
2296
  * @param adapter the auth adapter to use
2490
2297
  */
2491
2298
  var setAuthAdapter = /*#__PURE__*/function () {
2492
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, adapter) {
2493
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2494
- while (1) switch (_context.prev = _context.next) {
2299
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config, adapter) {
2300
+ return _regenerator().w(function (_context) {
2301
+ while (1) switch (_context.n) {
2495
2302
  case 0:
2496
2303
  if (!isAuthenticated(config)) {
2497
- _context.next = 3;
2304
+ _context.n = 1;
2498
2305
  break;
2499
2306
  }
2500
- _context.next = 3;
2307
+ _context.n = 1;
2501
2308
  return disconnect(config);
2502
- case 3:
2309
+ case 1:
2503
2310
  config._internal.authAdapter = adapter;
2504
- case 4:
2505
- case "end":
2506
- return _context.stop();
2311
+ case 2:
2312
+ return _context.a(2);
2507
2313
  }
2508
2314
  }, _callee);
2509
2315
  }));
@@ -2546,39 +2352,38 @@ var waitForWidgetAppLoaded = function waitForWidgetAppLoaded(config) {
2546
2352
  * @param adapter the auth adapter to use
2547
2353
  */
2548
2354
  var setAuthSession = /*#__PURE__*/function () {
2549
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, session) {
2550
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2551
- while (1) switch (_context.prev = _context.next) {
2355
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config, session) {
2356
+ return _regenerator().w(function (_context) {
2357
+ while (1) switch (_context.n) {
2552
2358
  case 0:
2553
- _context.next = 2;
2359
+ _context.n = 1;
2554
2360
  return waitForWidgetAppLoaded(config);
2555
- case 2:
2361
+ case 1:
2556
2362
  if (!isAuthenticated(config)) {
2557
- _context.next = 5;
2363
+ _context.n = 2;
2558
2364
  break;
2559
2365
  }
2560
- _context.next = 5;
2366
+ _context.n = 2;
2561
2367
  return disconnect(config);
2562
- case 5:
2368
+ case 2:
2563
2369
  if (!isAuthSessionExpired(session)) {
2564
- _context.next = 8;
2370
+ _context.n = 3;
2565
2371
  break;
2566
2372
  }
2567
2373
  config._internal.logger.warn({
2568
2374
  message: "Session is expired, ignoring",
2569
2375
  session: session
2570
2376
  });
2571
- return _context.abrupt("return");
2572
- case 8:
2377
+ return _context.a(2);
2378
+ case 3:
2573
2379
  // set the auth session, the config should be propagated by the createConfig code
2574
2380
  config._internal.widgetStateStore.update(function (state) {
2575
2381
  return _objectSpread2(_objectSpread2({}, state), {}, {
2576
2382
  auth: session
2577
2383
  });
2578
2384
  });
2579
- case 9:
2580
- case "end":
2581
- return _context.stop();
2385
+ case 4:
2386
+ return _context.a(2);
2582
2387
  }
2583
2388
  }, _callee);
2584
2389
  }));