@compilot/react-sdk 2.146.0-dev → 2.147.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.
- package/dist/compilot-react-sdk.cjs.dev.cjs +178 -350
- package/dist/compilot-react-sdk.cjs.prod.cjs +178 -350
- package/dist/compilot-react-sdk.esm.mjs +178 -350
- package/dist/package.json +2 -2
- package/package.json +5 -5
|
@@ -257,274 +257,116 @@ var useComPilotConfig = function useComPilotConfig() {
|
|
|
257
257
|
return config;
|
|
258
258
|
};
|
|
259
259
|
|
|
260
|
-
function
|
|
261
|
-
|
|
262
|
-
return r;
|
|
263
|
-
};
|
|
264
|
-
var t,
|
|
265
|
-
r = {},
|
|
266
|
-
e = Object.prototype,
|
|
267
|
-
n = e.hasOwnProperty,
|
|
268
|
-
o = "function" == typeof Symbol ? Symbol : {},
|
|
269
|
-
i = o.iterator || "@@iterator",
|
|
270
|
-
a = o.asyncIterator || "@@asyncIterator",
|
|
271
|
-
u = o.toStringTag || "@@toStringTag";
|
|
272
|
-
function c(t, r, e, n) {
|
|
273
|
-
Object.defineProperty(t, r, {
|
|
274
|
-
value: e,
|
|
275
|
-
enumerable: !n,
|
|
276
|
-
configurable: !n,
|
|
277
|
-
writable: !n
|
|
278
|
-
});
|
|
279
|
-
}
|
|
260
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
261
|
+
var i = Object.defineProperty;
|
|
280
262
|
try {
|
|
281
|
-
|
|
282
|
-
} catch (
|
|
283
|
-
|
|
284
|
-
return t[r] = e;
|
|
285
|
-
};
|
|
263
|
+
i({}, "", {});
|
|
264
|
+
} catch (e) {
|
|
265
|
+
i = 0;
|
|
286
266
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
267
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
268
|
+
if (r) i ? i(e, r, {
|
|
269
|
+
value: n,
|
|
270
|
+
enumerable: !t,
|
|
271
|
+
configurable: !t,
|
|
272
|
+
writable: !t
|
|
273
|
+
}) : e[r] = n;else {
|
|
274
|
+
function o(r, n) {
|
|
275
|
+
_regeneratorDefine(e, r, function (e) {
|
|
276
|
+
return this._invoke(r, n, e);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
280
|
+
}
|
|
281
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function _regenerator() {
|
|
285
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
286
|
+
var e,
|
|
287
|
+
t,
|
|
288
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
289
|
+
n = r.iterator || "@@iterator",
|
|
290
|
+
o = r.toStringTag || "@@toStringTag";
|
|
291
|
+
function i(r, n, o, i) {
|
|
292
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
293
|
+
u = Object.create(c.prototype);
|
|
294
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
295
|
+
var i,
|
|
296
|
+
c,
|
|
297
|
+
u,
|
|
298
|
+
f = 0,
|
|
299
|
+
p = o || [],
|
|
300
|
+
y = !1,
|
|
301
|
+
G = {
|
|
302
|
+
p: 0,
|
|
303
|
+
n: 0,
|
|
304
|
+
v: e,
|
|
305
|
+
a: d,
|
|
306
|
+
f: d.bind(e, 4),
|
|
307
|
+
d: function (t, r) {
|
|
308
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
309
309
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
310
|
+
};
|
|
311
|
+
function d(r, n) {
|
|
312
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
313
|
+
var o,
|
|
314
|
+
i = p[t],
|
|
315
|
+
d = G.p,
|
|
316
|
+
l = i[2];
|
|
317
|
+
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));
|
|
318
|
+
}
|
|
319
|
+
if (o || r > 1) return a;
|
|
320
|
+
throw y = !0, n;
|
|
321
|
+
}
|
|
322
|
+
return function (o, p, l) {
|
|
323
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
324
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
325
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
326
|
+
try {
|
|
327
|
+
if (f = 2, i) {
|
|
328
|
+
if (c || (o = "next"), t = i[o]) {
|
|
329
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
330
|
+
if (!t.done) return t;
|
|
331
|
+
u = t.value, c < 2 && (c = 0);
|
|
332
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
333
|
+
i = e;
|
|
334
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
335
|
+
} catch (t) {
|
|
336
|
+
i = e, c = 1, u = t;
|
|
337
|
+
} finally {
|
|
338
|
+
f = 1;
|
|
322
339
|
}
|
|
323
|
-
"throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
|
|
324
340
|
}
|
|
341
|
+
return {
|
|
342
|
+
value: t,
|
|
343
|
+
done: y
|
|
344
|
+
};
|
|
325
345
|
};
|
|
326
|
-
}(r,
|
|
327
|
-
}
|
|
328
|
-
function s(t, r, e) {
|
|
329
|
-
try {
|
|
330
|
-
return {
|
|
331
|
-
type: "normal",
|
|
332
|
-
arg: t.call(r, e)
|
|
333
|
-
};
|
|
334
|
-
} catch (t) {
|
|
335
|
-
return {
|
|
336
|
-
type: "throw",
|
|
337
|
-
arg: t
|
|
338
|
-
};
|
|
339
|
-
}
|
|
346
|
+
}(r, o, i), !0), u;
|
|
340
347
|
}
|
|
341
|
-
|
|
342
|
-
var f = {};
|
|
348
|
+
var a = {};
|
|
343
349
|
function Generator() {}
|
|
344
350
|
function GeneratorFunction() {}
|
|
345
351
|
function GeneratorFunctionPrototype() {}
|
|
346
|
-
|
|
347
|
-
c(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
|
|
354
|
-
function g(t) {
|
|
355
|
-
["next", "throw", "return"].forEach(function (r) {
|
|
356
|
-
c(t, r, function (t) {
|
|
357
|
-
return this._invoke(r, t);
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
function AsyncIterator(t, r) {
|
|
362
|
-
function e(o, i, a, u) {
|
|
363
|
-
var c = s(t[o], t, i);
|
|
364
|
-
if ("throw" !== c.type) {
|
|
365
|
-
var h = c.arg,
|
|
366
|
-
f = h.value;
|
|
367
|
-
return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
|
|
368
|
-
e("next", t, a, u);
|
|
369
|
-
}, function (t) {
|
|
370
|
-
e("throw", t, a, u);
|
|
371
|
-
}) : r.resolve(f).then(function (t) {
|
|
372
|
-
h.value = t, a(h);
|
|
373
|
-
}, function (t) {
|
|
374
|
-
return e("throw", t, a, u);
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
u(c.arg);
|
|
378
|
-
}
|
|
379
|
-
var o;
|
|
380
|
-
c(this, "_invoke", function (t, n) {
|
|
381
|
-
function i() {
|
|
382
|
-
return new r(function (r, o) {
|
|
383
|
-
e(t, n, r, o);
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
return o = o ? o.then(i, i) : i();
|
|
387
|
-
}, !0);
|
|
388
|
-
}
|
|
389
|
-
function d(r, e) {
|
|
390
|
-
var n = e.method,
|
|
391
|
-
o = r.i[n];
|
|
392
|
-
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;
|
|
393
|
-
var i = s(o, r.i, e.arg);
|
|
394
|
-
if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
|
|
395
|
-
var a = i.arg;
|
|
396
|
-
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);
|
|
397
|
-
}
|
|
398
|
-
function w(t) {
|
|
399
|
-
this.tryEntries.push(t);
|
|
400
|
-
}
|
|
401
|
-
function m(r) {
|
|
402
|
-
var e = r[4] || {};
|
|
403
|
-
e.type = "normal", e.arg = t, r[4] = e;
|
|
404
|
-
}
|
|
405
|
-
function Context(t) {
|
|
406
|
-
this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0);
|
|
352
|
+
t = Object.getPrototypeOf;
|
|
353
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
354
|
+
return this;
|
|
355
|
+
}), t),
|
|
356
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
357
|
+
function f(e) {
|
|
358
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
407
359
|
}
|
|
408
|
-
function
|
|
409
|
-
if (null != r) {
|
|
410
|
-
var e = r[i];
|
|
411
|
-
if (e) return e.call(r);
|
|
412
|
-
if ("function" == typeof r.next) return r;
|
|
413
|
-
if (!isNaN(r.length)) {
|
|
414
|
-
var o = -1,
|
|
415
|
-
a = function e() {
|
|
416
|
-
for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e;
|
|
417
|
-
return e.value = t, e.done = !0, e;
|
|
418
|
-
};
|
|
419
|
-
return a.next = a;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
throw new TypeError(typeof r + " is not iterable");
|
|
423
|
-
}
|
|
424
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) {
|
|
425
|
-
var r = "function" == typeof t && t.constructor;
|
|
426
|
-
return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
|
|
427
|
-
}, r.mark = function (t) {
|
|
428
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
|
|
429
|
-
}, r.awrap = function (t) {
|
|
430
|
-
return {
|
|
431
|
-
__await: t
|
|
432
|
-
};
|
|
433
|
-
}, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
|
|
360
|
+
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 () {
|
|
434
361
|
return this;
|
|
435
|
-
}),
|
|
436
|
-
void 0 === i && (i = Promise);
|
|
437
|
-
var a = new AsyncIterator(h(t, e, n, o), i);
|
|
438
|
-
return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
|
|
439
|
-
return t.done ? t.value : a.next();
|
|
440
|
-
});
|
|
441
|
-
}, g(v), c(v, u, "Generator"), c(v, i, function () {
|
|
442
|
-
return this;
|
|
443
|
-
}), c(v, "toString", function () {
|
|
362
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
444
363
|
return "[object Generator]";
|
|
445
|
-
}),
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
return function t() {
|
|
450
|
-
for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t;
|
|
451
|
-
return t.done = !0, t;
|
|
364
|
+
}), (_regenerator = function () {
|
|
365
|
+
return {
|
|
366
|
+
w: i,
|
|
367
|
+
m: f
|
|
452
368
|
};
|
|
453
|
-
}
|
|
454
|
-
constructor: Context,
|
|
455
|
-
reset: function (r) {
|
|
456
|
-
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);
|
|
457
|
-
},
|
|
458
|
-
stop: function () {
|
|
459
|
-
this.done = !0;
|
|
460
|
-
var t = this.tryEntries[0][4];
|
|
461
|
-
if ("throw" === t.type) throw t.arg;
|
|
462
|
-
return this.rval;
|
|
463
|
-
},
|
|
464
|
-
dispatchException: function (r) {
|
|
465
|
-
if (this.done) throw r;
|
|
466
|
-
var e = this;
|
|
467
|
-
function n(t) {
|
|
468
|
-
a.type = "throw", a.arg = r, e.next = t;
|
|
469
|
-
}
|
|
470
|
-
for (var o = e.tryEntries.length - 1; o >= 0; --o) {
|
|
471
|
-
var i = this.tryEntries[o],
|
|
472
|
-
a = i[4],
|
|
473
|
-
u = this.prev,
|
|
474
|
-
c = i[1],
|
|
475
|
-
h = i[2];
|
|
476
|
-
if (-1 === i[0]) return n("end"), !1;
|
|
477
|
-
if (!c && !h) throw Error("try statement without catch or finally");
|
|
478
|
-
if (null != i[0] && i[0] <= u) {
|
|
479
|
-
if (u < c) return this.method = "next", this.arg = t, n(c), !0;
|
|
480
|
-
if (u < h) return n(h), !1;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
},
|
|
484
|
-
abrupt: function (t, r) {
|
|
485
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
486
|
-
var n = this.tryEntries[e];
|
|
487
|
-
if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
|
|
488
|
-
var o = n;
|
|
489
|
-
break;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
|
|
493
|
-
var i = o ? o[4] : {};
|
|
494
|
-
return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
|
|
495
|
-
},
|
|
496
|
-
complete: function (t, r) {
|
|
497
|
-
if ("throw" === t.type) throw t.arg;
|
|
498
|
-
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;
|
|
499
|
-
},
|
|
500
|
-
finish: function (t) {
|
|
501
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
502
|
-
var e = this.tryEntries[r];
|
|
503
|
-
if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
|
|
504
|
-
}
|
|
505
|
-
},
|
|
506
|
-
catch: function (t) {
|
|
507
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
508
|
-
var e = this.tryEntries[r];
|
|
509
|
-
if (e[0] === t) {
|
|
510
|
-
var n = e[4];
|
|
511
|
-
if ("throw" === n.type) {
|
|
512
|
-
var o = n.arg;
|
|
513
|
-
m(e);
|
|
514
|
-
}
|
|
515
|
-
return o;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
throw Error("illegal catch attempt");
|
|
519
|
-
},
|
|
520
|
-
delegateYield: function (r, e, n) {
|
|
521
|
-
return this.delegate = {
|
|
522
|
-
i: x(r),
|
|
523
|
-
r: e,
|
|
524
|
-
n: n
|
|
525
|
-
}, "next" === this.method && (this.arg = t), f;
|
|
526
|
-
}
|
|
527
|
-
}, r;
|
|
369
|
+
})();
|
|
528
370
|
}
|
|
529
371
|
|
|
530
372
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
@@ -590,11 +432,12 @@ var useAsyncMutationState = function useAsyncMutationState(_ref) {
|
|
|
590
432
|
_useGlobalState2 = _slicedToArray(_useGlobalState, 2),
|
|
591
433
|
globalState = _useGlobalState2[0],
|
|
592
434
|
setState = _useGlobalState2[1];
|
|
593
|
-
var mutateAsync = react.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
435
|
+
var mutateAsync = react.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
594
436
|
var result,
|
|
595
|
-
_args = arguments
|
|
596
|
-
|
|
597
|
-
|
|
437
|
+
_args = arguments,
|
|
438
|
+
_t;
|
|
439
|
+
return _regenerator().w(function (_context) {
|
|
440
|
+
while (1) switch (_context.n) {
|
|
598
441
|
case 0:
|
|
599
442
|
setState(function (state) {
|
|
600
443
|
return {
|
|
@@ -606,11 +449,11 @@ var useAsyncMutationState = function useAsyncMutationState(_ref) {
|
|
|
606
449
|
error: null
|
|
607
450
|
};
|
|
608
451
|
});
|
|
609
|
-
_context.
|
|
610
|
-
_context.
|
|
452
|
+
_context.p = 1;
|
|
453
|
+
_context.n = 2;
|
|
611
454
|
return mutationFn.apply(void 0, _args);
|
|
612
|
-
case
|
|
613
|
-
result = _context.
|
|
455
|
+
case 2:
|
|
456
|
+
result = _context.v;
|
|
614
457
|
setState(function (_state) {
|
|
615
458
|
return {
|
|
616
459
|
data: result,
|
|
@@ -623,10 +466,10 @@ var useAsyncMutationState = function useAsyncMutationState(_ref) {
|
|
|
623
466
|
});
|
|
624
467
|
|
|
625
468
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
626
|
-
return _context.
|
|
627
|
-
case
|
|
628
|
-
_context.
|
|
629
|
-
|
|
469
|
+
return _context.a(2, result);
|
|
470
|
+
case 3:
|
|
471
|
+
_context.p = 3;
|
|
472
|
+
_t = _context.v;
|
|
630
473
|
setState(function (state) {
|
|
631
474
|
return {
|
|
632
475
|
data: state.data,
|
|
@@ -634,14 +477,13 @@ var useAsyncMutationState = function useAsyncMutationState(_ref) {
|
|
|
634
477
|
isPending: false,
|
|
635
478
|
isError: true,
|
|
636
479
|
isSuccess: false,
|
|
637
|
-
error:
|
|
480
|
+
error: _t instanceof Error ? _t : new Error(String(_t))
|
|
638
481
|
};
|
|
639
482
|
});
|
|
640
|
-
case
|
|
641
|
-
|
|
642
|
-
return _context.stop();
|
|
483
|
+
case 4:
|
|
484
|
+
return _context.a(2);
|
|
643
485
|
}
|
|
644
|
-
}, _callee, null, [[1,
|
|
486
|
+
}, _callee, null, [[1, 3]]);
|
|
645
487
|
})), [setState, mutationFn]);
|
|
646
488
|
var setData = react.useCallback(function (data) {
|
|
647
489
|
setState(function (_state) {
|
|
@@ -883,32 +725,31 @@ var useCustomerStatus = function useCustomerStatus() {
|
|
|
883
725
|
}, [config._internal.externalEventEmitter, config._internal.identifier]);
|
|
884
726
|
react.useEffect(function () {
|
|
885
727
|
var updateStatus = /*#__PURE__*/function () {
|
|
886
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
887
|
-
var status;
|
|
888
|
-
return
|
|
889
|
-
while (1) switch (_context.
|
|
728
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
729
|
+
var status, _t;
|
|
730
|
+
return _regenerator().w(function (_context) {
|
|
731
|
+
while (1) switch (_context.n) {
|
|
890
732
|
case 0:
|
|
891
|
-
_context.
|
|
892
|
-
_context.
|
|
733
|
+
_context.p = 0;
|
|
734
|
+
_context.n = 1;
|
|
893
735
|
return fetchCustomerStatus(config);
|
|
894
|
-
case
|
|
895
|
-
status = _context.
|
|
736
|
+
case 1:
|
|
737
|
+
status = _context.v;
|
|
896
738
|
setResult(status);
|
|
897
|
-
_context.
|
|
739
|
+
_context.n = 3;
|
|
898
740
|
break;
|
|
899
|
-
case
|
|
900
|
-
_context.
|
|
901
|
-
|
|
741
|
+
case 2:
|
|
742
|
+
_context.p = 2;
|
|
743
|
+
_t = _context.v;
|
|
902
744
|
config._internal.logger.error({
|
|
903
745
|
msg: "Failed to fetch user status",
|
|
904
|
-
error:
|
|
746
|
+
error: _t
|
|
905
747
|
});
|
|
906
|
-
setError(
|
|
907
|
-
case
|
|
908
|
-
|
|
909
|
-
return _context.stop();
|
|
748
|
+
setError(_t instanceof Error ? _t : new Error(String(_t)));
|
|
749
|
+
case 3:
|
|
750
|
+
return _context.a(2);
|
|
910
751
|
}
|
|
911
|
-
}, _callee, null, [[0,
|
|
752
|
+
}, _callee, null, [[0, 2]]);
|
|
912
753
|
}));
|
|
913
754
|
return function updateStatus() {
|
|
914
755
|
return _ref2.apply(this, arguments);
|
|
@@ -954,19 +795,16 @@ var useCustomerStatus = function useCustomerStatus() {
|
|
|
954
795
|
|
|
955
796
|
// ensure the debounce is global accross all react hook instances
|
|
956
797
|
var fetchCustomerStatus = simpleLeadingDebounce(/*#__PURE__*/function () {
|
|
957
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
798
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(config) {
|
|
958
799
|
var status;
|
|
959
|
-
return
|
|
960
|
-
while (1) switch (_context2.
|
|
800
|
+
return _regenerator().w(function (_context2) {
|
|
801
|
+
while (1) switch (_context2.n) {
|
|
961
802
|
case 0:
|
|
962
|
-
_context2.
|
|
803
|
+
_context2.n = 1;
|
|
963
804
|
return webSdk.getCustomerStatus(config);
|
|
964
|
-
case
|
|
965
|
-
status = _context2.
|
|
966
|
-
return _context2.
|
|
967
|
-
case 4:
|
|
968
|
-
case "end":
|
|
969
|
-
return _context2.stop();
|
|
805
|
+
case 1:
|
|
806
|
+
status = _context2.v;
|
|
807
|
+
return _context2.a(2, status);
|
|
970
808
|
}
|
|
971
809
|
}, _callee2);
|
|
972
810
|
}));
|
|
@@ -1002,19 +840,16 @@ var fetchCustomerStatus = simpleLeadingDebounce(/*#__PURE__*/function () {
|
|
|
1002
840
|
*/
|
|
1003
841
|
var useDisconnect = function useDisconnect() {
|
|
1004
842
|
var config = useComPilotConfig();
|
|
1005
|
-
var mutationFn = react.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
843
|
+
var mutationFn = react.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1006
844
|
var isDisconnected;
|
|
1007
|
-
return
|
|
1008
|
-
while (1) switch (_context.
|
|
845
|
+
return _regenerator().w(function (_context) {
|
|
846
|
+
while (1) switch (_context.n) {
|
|
1009
847
|
case 0:
|
|
1010
|
-
_context.
|
|
848
|
+
_context.n = 1;
|
|
1011
849
|
return webSdk.disconnect(config);
|
|
1012
|
-
case
|
|
1013
|
-
isDisconnected = _context.
|
|
1014
|
-
return _context.
|
|
1015
|
-
case 4:
|
|
1016
|
-
case "end":
|
|
1017
|
-
return _context.stop();
|
|
850
|
+
case 1:
|
|
851
|
+
isDisconnected = _context.v;
|
|
852
|
+
return _context.a(2, !isDisconnected);
|
|
1018
853
|
}
|
|
1019
854
|
}, _callee);
|
|
1020
855
|
})), [config]);
|
|
@@ -1186,19 +1021,16 @@ var useDisconnect = function useDisconnect() {
|
|
|
1186
1021
|
var useGetTxAuthDataSignature = function useGetTxAuthDataSignature() {
|
|
1187
1022
|
var config = useComPilotConfig();
|
|
1188
1023
|
var mutationFn = react.useCallback(/*#__PURE__*/function () {
|
|
1189
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1024
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
1190
1025
|
var res;
|
|
1191
|
-
return
|
|
1192
|
-
while (1) switch (_context.
|
|
1026
|
+
return _regenerator().w(function (_context) {
|
|
1027
|
+
while (1) switch (_context.n) {
|
|
1193
1028
|
case 0:
|
|
1194
|
-
_context.
|
|
1029
|
+
_context.n = 1;
|
|
1195
1030
|
return webSdk.getTxAuthDataSignature(config, params);
|
|
1196
|
-
case
|
|
1197
|
-
res = _context.
|
|
1198
|
-
return _context.
|
|
1199
|
-
case 4:
|
|
1200
|
-
case "end":
|
|
1201
|
-
return _context.stop();
|
|
1031
|
+
case 1:
|
|
1032
|
+
res = _context.v;
|
|
1033
|
+
return _context.a(2, res);
|
|
1202
1034
|
}
|
|
1203
1035
|
}, _callee);
|
|
1204
1036
|
}));
|
|
@@ -1240,36 +1072,35 @@ var useIdentityId = function useIdentityId() {
|
|
|
1240
1072
|
}
|
|
1241
1073
|
var unsubscribe = webSdk.watchIsAuthenticated(config, {
|
|
1242
1074
|
onIsAuthenticatedChange: function () {
|
|
1243
|
-
var _onIsAuthenticatedChange = _asyncToGenerator(/*#__PURE__*/
|
|
1244
|
-
var res;
|
|
1245
|
-
return
|
|
1246
|
-
while (1) switch (_context.
|
|
1075
|
+
var _onIsAuthenticatedChange = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(isAuthenticated) {
|
|
1076
|
+
var res, _t;
|
|
1077
|
+
return _regenerator().w(function (_context) {
|
|
1078
|
+
while (1) switch (_context.n) {
|
|
1247
1079
|
case 0:
|
|
1248
1080
|
if (isAuthenticated) {
|
|
1249
|
-
_context.
|
|
1081
|
+
_context.n = 1;
|
|
1250
1082
|
break;
|
|
1251
1083
|
}
|
|
1252
1084
|
setResult(null);
|
|
1253
|
-
return _context.
|
|
1254
|
-
case
|
|
1255
|
-
_context.
|
|
1256
|
-
_context.
|
|
1085
|
+
return _context.a(2);
|
|
1086
|
+
case 1:
|
|
1087
|
+
_context.p = 1;
|
|
1088
|
+
_context.n = 2;
|
|
1257
1089
|
return webSdk.getIdentityId(config);
|
|
1258
|
-
case
|
|
1259
|
-
res = _context.
|
|
1090
|
+
case 2:
|
|
1091
|
+
res = _context.v;
|
|
1260
1092
|
setResult(res);
|
|
1261
|
-
_context.
|
|
1093
|
+
_context.n = 4;
|
|
1262
1094
|
break;
|
|
1263
|
-
case
|
|
1264
|
-
_context.
|
|
1265
|
-
|
|
1266
|
-
config._internal.logger.error("Failed to fetch identity id",
|
|
1267
|
-
setError(
|
|
1268
|
-
case
|
|
1269
|
-
|
|
1270
|
-
return _context.stop();
|
|
1095
|
+
case 3:
|
|
1096
|
+
_context.p = 3;
|
|
1097
|
+
_t = _context.v;
|
|
1098
|
+
config._internal.logger.error("Failed to fetch identity id", _t);
|
|
1099
|
+
setError(_t instanceof Error ? _t : new Error("Unknown error"));
|
|
1100
|
+
case 4:
|
|
1101
|
+
return _context.a(2);
|
|
1271
1102
|
}
|
|
1272
|
-
}, _callee, null, [[
|
|
1103
|
+
}, _callee, null, [[1, 3]]);
|
|
1273
1104
|
}));
|
|
1274
1105
|
function onIsAuthenticatedChange(_x) {
|
|
1275
1106
|
return _onIsAuthenticatedChange.apply(this, arguments);
|
|
@@ -1320,26 +1151,23 @@ var useIdentityWallets = function useIdentityWallets() {
|
|
|
1320
1151
|
});
|
|
1321
1152
|
}, [config, queryCacheBuster]);
|
|
1322
1153
|
var mutationFn = react.useCallback(/*#__PURE__*/function () {
|
|
1323
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1154
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(wallet) {
|
|
1324
1155
|
var res;
|
|
1325
|
-
return
|
|
1326
|
-
while (1) switch (_context.
|
|
1156
|
+
return _regenerator().w(function (_context) {
|
|
1157
|
+
while (1) switch (_context.n) {
|
|
1327
1158
|
case 0:
|
|
1328
|
-
_context.
|
|
1159
|
+
_context.n = 1;
|
|
1329
1160
|
return webSdk.attachWalletToIdentity(config, {
|
|
1330
1161
|
wallet: wallet
|
|
1331
1162
|
});
|
|
1332
|
-
case
|
|
1333
|
-
res = _context.
|
|
1163
|
+
case 1:
|
|
1164
|
+
res = _context.v;
|
|
1334
1165
|
if (res) {
|
|
1335
1166
|
setQueryCacheBuster(function (prev) {
|
|
1336
1167
|
return prev + 1;
|
|
1337
1168
|
});
|
|
1338
1169
|
}
|
|
1339
|
-
return _context.
|
|
1340
|
-
case 5:
|
|
1341
|
-
case "end":
|
|
1342
|
-
return _context.stop();
|
|
1170
|
+
return _context.a(2, res);
|
|
1343
1171
|
}
|
|
1344
1172
|
}, _callee);
|
|
1345
1173
|
}));
|