@opencx/widget 3.0.79 → 3.0.80
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/designs.cjs +2 -2
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +4 -2
- package/dist/designs.js.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/src/designs/react/index.d.ts +2 -1
- package/dist/src/headless/react/WidgetProvider.d.ts +7 -2
- package/dist/{useWidgetTrigger-B3AmRoO3.cjs → useWidgetTrigger-BMUbLNnW.cjs} +4 -4
- package/dist/useWidgetTrigger-BMUbLNnW.cjs.map +1 -0
- package/dist/{useWidgetTrigger-BNZHwm7w.js → useWidgetTrigger-CY_10B--.js} +105 -104
- package/dist/useWidgetTrigger-CY_10B--.js.map +1 -0
- package/dist-embed/script.js +3 -3
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -1
- package/dist/useWidgetTrigger-B3AmRoO3.cjs.map +0 -1
- package/dist/useWidgetTrigger-BNZHwm7w.js.map +0 -1
|
@@ -2,7 +2,7 @@ import z, { createContext as Fe, useRef as W, useState as Me, useMemo as Ne, use
|
|
|
2
2
|
import { v4 as Qt } from "uuid";
|
|
3
3
|
import { jsx as it } from "react/jsx-runtime";
|
|
4
4
|
import { W as Zt } from "./widget.ctx-DRC-z8Ql.js";
|
|
5
|
-
const en = "3.0.
|
|
5
|
+
const en = "3.0.80";
|
|
6
6
|
class tn {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
this.components = [];
|
|
@@ -33,30 +33,31 @@ function Qn({
|
|
|
33
33
|
options: e,
|
|
34
34
|
children: t,
|
|
35
35
|
components: n,
|
|
36
|
-
storage: r
|
|
36
|
+
storage: r,
|
|
37
|
+
loadingComponent: o
|
|
37
38
|
}) {
|
|
38
|
-
const
|
|
39
|
+
const s = W(null), i = W(!1), [d, h] = Me(null), c = Ne(
|
|
39
40
|
() => new tn({
|
|
40
41
|
components: n
|
|
41
42
|
}),
|
|
42
43
|
[n]
|
|
43
44
|
);
|
|
44
45
|
return he(() => {
|
|
45
|
-
|
|
46
|
-
}, []),
|
|
46
|
+
i.current || (i.current = !0, Zt.initialize({ config: e, storage: r }).then(h));
|
|
47
|
+
}, []), d ? /* @__PURE__ */ it(
|
|
47
48
|
at.Provider,
|
|
48
49
|
{
|
|
49
50
|
value: {
|
|
50
|
-
widgetCtx:
|
|
51
|
+
widgetCtx: d,
|
|
51
52
|
config: e,
|
|
52
53
|
components: n,
|
|
53
|
-
componentStore:
|
|
54
|
+
componentStore: c,
|
|
54
55
|
version: en,
|
|
55
|
-
contentIframeRef:
|
|
56
|
+
contentIframeRef: s
|
|
56
57
|
},
|
|
57
58
|
children: t
|
|
58
59
|
}
|
|
59
|
-
) : null;
|
|
60
|
+
) : o || null;
|
|
60
61
|
}
|
|
61
62
|
function Y() {
|
|
62
63
|
const e = Ue(at);
|
|
@@ -138,29 +139,29 @@ function an() {
|
|
|
138
139
|
}
|
|
139
140
|
var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, o = e.useEffect, s = e.useLayoutEffect, i = e.useDebugValue;
|
|
140
141
|
function d(u, l) {
|
|
141
|
-
var
|
|
142
|
+
var f = l(), y = r({ inst: { value: f, getSnapshot: l } }), _ = y[0].inst, T = y[1];
|
|
142
143
|
return s(function() {
|
|
143
|
-
_.value =
|
|
144
|
-
}, [u,
|
|
144
|
+
_.value = f, _.getSnapshot = l, h(_) && T({ inst: _ });
|
|
145
|
+
}, [u, f, l]), o(function() {
|
|
145
146
|
return h(_) && T({ inst: _ }), u(function() {
|
|
146
147
|
h(_) && T({ inst: _ });
|
|
147
148
|
});
|
|
148
|
-
}, [u]), i(
|
|
149
|
+
}, [u]), i(f), f;
|
|
149
150
|
}
|
|
150
151
|
function h(u) {
|
|
151
152
|
var l = u.getSnapshot;
|
|
152
153
|
u = u.value;
|
|
153
154
|
try {
|
|
154
|
-
var
|
|
155
|
-
return !n(u,
|
|
155
|
+
var f = l();
|
|
156
|
+
return !n(u, f);
|
|
156
157
|
} catch {
|
|
157
158
|
return !0;
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
|
-
function
|
|
161
|
+
function c(u, l) {
|
|
161
162
|
return l();
|
|
162
163
|
}
|
|
163
|
-
var a = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ?
|
|
164
|
+
var a = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : d;
|
|
164
165
|
return Se.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : a, Se;
|
|
165
166
|
}
|
|
166
167
|
var we = {};
|
|
@@ -198,7 +199,7 @@ function un() {
|
|
|
198
199
|
function o(O, E) {
|
|
199
200
|
return O === E && (O !== 0 || 1 / O === 1 / E) || O !== O && E !== E;
|
|
200
201
|
}
|
|
201
|
-
var s = typeof Object.is == "function" ? Object.is : o, i = e.useState, d = e.useEffect, h = e.useLayoutEffect,
|
|
202
|
+
var s = typeof Object.is == "function" ? Object.is : o, i = e.useState, d = e.useEffect, h = e.useLayoutEffect, c = e.useDebugValue, a = !1, u = !1;
|
|
202
203
|
function l(O, E, S) {
|
|
203
204
|
a || e.startTransition !== void 0 && (a = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
204
205
|
var v = E();
|
|
@@ -213,22 +214,22 @@ function un() {
|
|
|
213
214
|
}
|
|
214
215
|
}), C = w[0].inst, j = w[1];
|
|
215
216
|
return h(function() {
|
|
216
|
-
C.value = v, C.getSnapshot = E,
|
|
217
|
+
C.value = v, C.getSnapshot = E, f(C) && j({
|
|
217
218
|
inst: C
|
|
218
219
|
});
|
|
219
220
|
}, [O, v, E]), d(function() {
|
|
220
|
-
|
|
221
|
+
f(C) && j({
|
|
221
222
|
inst: C
|
|
222
223
|
});
|
|
223
224
|
var B = function() {
|
|
224
|
-
|
|
225
|
+
f(C) && j({
|
|
225
226
|
inst: C
|
|
226
227
|
});
|
|
227
228
|
};
|
|
228
229
|
return O(B);
|
|
229
|
-
}, [O]),
|
|
230
|
+
}, [O]), c(v), v;
|
|
230
231
|
}
|
|
231
|
-
function
|
|
232
|
+
function f(O) {
|
|
232
233
|
var E = O.getSnapshot, S = O.value;
|
|
233
234
|
try {
|
|
234
235
|
var v = E();
|
|
@@ -355,27 +356,27 @@ async function dt(...e) {
|
|
|
355
356
|
let i = s.populateCache;
|
|
356
357
|
const d = s.rollbackOnError;
|
|
357
358
|
let h = s.optimisticData;
|
|
358
|
-
const
|
|
359
|
+
const c = (l) => typeof d == "function" ? d(l) : d !== !1, a = s.throwOnError;
|
|
359
360
|
if (M(n)) {
|
|
360
|
-
const l = n,
|
|
361
|
+
const l = n, f = [], y = t.keys();
|
|
361
362
|
for (const _ of y)
|
|
362
363
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
363
|
-
!/^\$(inf|sub)\$/.test(_) && l(t.get(_)._k) &&
|
|
364
|
-
return Promise.all(
|
|
364
|
+
!/^\$(inf|sub)\$/.test(_) && l(t.get(_)._k) && f.push(_);
|
|
365
|
+
return Promise.all(f.map(u));
|
|
365
366
|
}
|
|
366
367
|
return u(n);
|
|
367
368
|
async function u(l) {
|
|
368
|
-
const [
|
|
369
|
-
if (!
|
|
370
|
-
const [y, _] = ut(t,
|
|
371
|
-
const V = T[
|
|
372
|
-
return (M(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete k[
|
|
369
|
+
const [f] = qe(l);
|
|
370
|
+
if (!f) return;
|
|
371
|
+
const [y, _] = ut(t, f), [T, p, k, O] = q.get(t), E = () => {
|
|
372
|
+
const V = T[f];
|
|
373
|
+
return (M(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete k[f], delete O[f], V && V[0]) ? V[0](lt).then(() => y().data) : y().data;
|
|
373
374
|
};
|
|
374
375
|
if (e.length < 3)
|
|
375
376
|
return E();
|
|
376
377
|
let S = r, v;
|
|
377
378
|
const L = Le();
|
|
378
|
-
p[
|
|
379
|
+
p[f] = [
|
|
379
380
|
L,
|
|
380
381
|
0
|
|
381
382
|
];
|
|
@@ -392,10 +393,10 @@ async function dt(...e) {
|
|
|
392
393
|
if (S && fn(S))
|
|
393
394
|
if (S = await S.catch((V) => {
|
|
394
395
|
v = V;
|
|
395
|
-
}), L !== p[
|
|
396
|
+
}), L !== p[f][0]) {
|
|
396
397
|
if (v) throw v;
|
|
397
398
|
return S;
|
|
398
|
-
} else v && w &&
|
|
399
|
+
} else v && w && c(v) && (i = !0, _({
|
|
399
400
|
data: K,
|
|
400
401
|
_c: P
|
|
401
402
|
}));
|
|
@@ -413,7 +414,7 @@ async function dt(...e) {
|
|
|
413
414
|
error: P,
|
|
414
415
|
_c: P
|
|
415
416
|
});
|
|
416
|
-
if (p[
|
|
417
|
+
if (p[f][1] = Le(), Promise.resolve(E()).then(() => {
|
|
417
418
|
_({
|
|
418
419
|
_c: P
|
|
419
420
|
});
|
|
@@ -436,11 +437,11 @@ const rt = (e, t) => {
|
|
|
436
437
|
return i[a] = l, l.push(u), () => l.splice(l.indexOf(u), 1);
|
|
437
438
|
}, h = (a, u, l) => {
|
|
438
439
|
e.set(a, u);
|
|
439
|
-
const
|
|
440
|
-
if (
|
|
441
|
-
for (const y of
|
|
440
|
+
const f = i[a];
|
|
441
|
+
if (f)
|
|
442
|
+
for (const y of f)
|
|
442
443
|
y(u, l);
|
|
443
|
-
},
|
|
444
|
+
}, c = () => {
|
|
444
445
|
if (!q.has(e) && (q.set(e, [
|
|
445
446
|
r,
|
|
446
447
|
{},
|
|
@@ -456,10 +457,10 @@ const rt = (e, t) => {
|
|
|
456
457
|
};
|
|
457
458
|
}
|
|
458
459
|
};
|
|
459
|
-
return
|
|
460
|
+
return c(), [
|
|
460
461
|
e,
|
|
461
462
|
o,
|
|
462
|
-
|
|
463
|
+
c,
|
|
463
464
|
s
|
|
464
465
|
];
|
|
465
466
|
}
|
|
@@ -523,7 +524,7 @@ const rt = (e, t) => {
|
|
|
523
524
|
}), r), Vn = xn.concat(In), Fn = (e) => function(...n) {
|
|
524
525
|
const r = Ln(), [o, s, i] = Pn(n), d = Cn(r, i);
|
|
525
526
|
let h = e;
|
|
526
|
-
const { use:
|
|
527
|
+
const { use: c } = d, a = (c || []).concat(Vn);
|
|
527
528
|
for (let u = a.length; u--; )
|
|
528
529
|
h = a[u](h);
|
|
529
530
|
return h(o, s || d.fetcher || null, d);
|
|
@@ -548,7 +549,7 @@ const ot = z.use || ((e) => {
|
|
|
548
549
|
}), Te = {
|
|
549
550
|
dedupe: !0
|
|
550
551
|
}, Nn = (e, t, n) => {
|
|
551
|
-
const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval:
|
|
552
|
+
const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval: c, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: l } = n, [f, y, _, T] = q.get(r), [p, k] = qe(e), O = W(!1), E = W(!1), S = W(p), v = W(t), L = W(n), w = () => L.current, C = () => w().isVisible() && w().isOnline(), [j, B, K, V] = ut(r, p), J = W({}).current, $t = g(i) ? n.fallback[p] : i, He = (m, b) => {
|
|
552
553
|
for (const A in J) {
|
|
553
554
|
const R = A;
|
|
554
555
|
if (R === "data") {
|
|
@@ -587,7 +588,7 @@ const ot = z.use || ((e) => {
|
|
|
587
588
|
r,
|
|
588
589
|
p
|
|
589
590
|
]
|
|
590
|
-
), $e[0], $e[1]), Ge = !O.current, Gt =
|
|
591
|
+
), $e[0], $e[1]), Ge = !O.current, Gt = f[p] && f[p].length > 0, Q = X.data, Z = g(Q) ? $t : Q, ae = X.error, Ke = W(Z), ue = l ? g(Q) ? Ke.current : Q : Z, ze = Gt && !g(ae) ? !1 : Ge && !g(d) ? d : w().isPaused() ? !1 : s ? g(Z) ? !1 : h : g(Z) || h, Ye = !!(p && t && Ge && ze), Kt = g(X.isValidating) ? Ye : X.isValidating, zt = g(X.isLoading) ? Ye : X.isLoading, ne = ve(
|
|
591
592
|
async (m) => {
|
|
592
593
|
const b = v.current;
|
|
593
594
|
if (!p || !b || E.current || w().isPaused())
|
|
@@ -626,7 +627,7 @@ const ot = z.use || ((e) => {
|
|
|
626
627
|
Xe();
|
|
627
628
|
const U = w(), { shouldRetryOnError: ge } = U;
|
|
628
629
|
U.isPaused() || (N.error = I, D && x() && (U.onError(I, p, U), (ge === !0 || M(ge) && ge(I)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || C()) && U.onErrorRetry(I, p, U, (Yt) => {
|
|
629
|
-
const Ee =
|
|
630
|
+
const Ee = f[p];
|
|
630
631
|
Ee && Ee[0] && Ee[0](re.ERROR_REVALIDATE_EVENT, Yt);
|
|
631
632
|
}, {
|
|
632
633
|
retryCount: (ee.retryCount || 0) + 1,
|
|
@@ -662,7 +663,7 @@ const ot = z.use || ((e) => {
|
|
|
662
663
|
if (!p) return;
|
|
663
664
|
const m = ne.bind(P, Te);
|
|
664
665
|
let b = 0;
|
|
665
|
-
const R = Mn(p,
|
|
666
|
+
const R = Mn(p, f, (F, ee = {}) => {
|
|
666
667
|
if (F == re.FOCUS_EVENT) {
|
|
667
668
|
const D = Date.now();
|
|
668
669
|
w().revalidateOnFocus && D > b && C() && (b = D + w().focusThrottleInterval, m());
|
|
@@ -685,7 +686,7 @@ const ot = z.use || ((e) => {
|
|
|
685
686
|
]), Oe(() => {
|
|
686
687
|
let m;
|
|
687
688
|
function b() {
|
|
688
|
-
const R = M(
|
|
689
|
+
const R = M(c) ? c(j().data) : c;
|
|
689
690
|
R && m !== -1 && (m = setTimeout(A, R));
|
|
690
691
|
}
|
|
691
692
|
function A() {
|
|
@@ -695,7 +696,7 @@ const ot = z.use || ((e) => {
|
|
|
695
696
|
m && (clearTimeout(m), m = -1);
|
|
696
697
|
};
|
|
697
698
|
}, [
|
|
698
|
-
|
|
699
|
+
c,
|
|
699
700
|
a,
|
|
700
701
|
u,
|
|
701
702
|
p
|
|
@@ -793,7 +794,7 @@ function St(e, t, n, r, o, s) {
|
|
|
793
794
|
if (p !== void 0 && typeof p != "function") throw new TypeError("Function expected");
|
|
794
795
|
return p;
|
|
795
796
|
}
|
|
796
|
-
for (var d = r.kind, h = d === "getter" ? "get" : d === "setter" ? "set" : "value",
|
|
797
|
+
for (var d = r.kind, h = d === "getter" ? "get" : d === "setter" ? "set" : "value", c = !t && e ? r.static ? e : e.prototype : null, a = t || (c ? Object.getOwnPropertyDescriptor(c, r.name) : {}), u, l = !1, f = n.length - 1; f >= 0; f--) {
|
|
797
798
|
var y = {};
|
|
798
799
|
for (var _ in r) y[_] = _ === "access" ? {} : r[_];
|
|
799
800
|
for (var _ in r.access) y.access[_] = r.access[_];
|
|
@@ -801,14 +802,14 @@ function St(e, t, n, r, o, s) {
|
|
|
801
802
|
if (l) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
802
803
|
s.push(i(p || null));
|
|
803
804
|
};
|
|
804
|
-
var T = (0, n[
|
|
805
|
+
var T = (0, n[f])(d === "accessor" ? { get: a.get, set: a.set } : a[h], y);
|
|
805
806
|
if (d === "accessor") {
|
|
806
807
|
if (T === void 0) continue;
|
|
807
808
|
if (T === null || typeof T != "object") throw new TypeError("Object expected");
|
|
808
809
|
(u = i(T.get)) && (a.get = u), (u = i(T.set)) && (a.set = u), (u = i(T.init)) && o.unshift(u);
|
|
809
810
|
} else (u = i(T)) && (d === "field" ? o.unshift(u) : a[h] = u);
|
|
810
811
|
}
|
|
811
|
-
|
|
812
|
+
c && Object.defineProperty(c, r.name, a), l = !0;
|
|
812
813
|
}
|
|
813
814
|
function wt(e, t, n) {
|
|
814
815
|
for (var r = arguments.length > 2, o = 0; o < t.length; o++)
|
|
@@ -833,22 +834,22 @@ function Rt(e, t, n, r) {
|
|
|
833
834
|
return new (n || (n = Promise))(function(s, i) {
|
|
834
835
|
function d(a) {
|
|
835
836
|
try {
|
|
836
|
-
|
|
837
|
+
c(r.next(a));
|
|
837
838
|
} catch (u) {
|
|
838
839
|
i(u);
|
|
839
840
|
}
|
|
840
841
|
}
|
|
841
842
|
function h(a) {
|
|
842
843
|
try {
|
|
843
|
-
|
|
844
|
+
c(r.throw(a));
|
|
844
845
|
} catch (u) {
|
|
845
846
|
i(u);
|
|
846
847
|
}
|
|
847
848
|
}
|
|
848
|
-
function
|
|
849
|
+
function c(a) {
|
|
849
850
|
a.done ? s(a.value) : o(a.value).then(d, h);
|
|
850
851
|
}
|
|
851
|
-
|
|
852
|
+
c((r = r.apply(e, t || [])).next());
|
|
852
853
|
});
|
|
853
854
|
}
|
|
854
855
|
function Tt(e, t) {
|
|
@@ -859,56 +860,56 @@ function Tt(e, t) {
|
|
|
859
860
|
return i.next = d(0), i.throw = d(1), i.return = d(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
|
|
860
861
|
return this;
|
|
861
862
|
}), i;
|
|
862
|
-
function d(
|
|
863
|
+
function d(c) {
|
|
863
864
|
return function(a) {
|
|
864
|
-
return h([
|
|
865
|
+
return h([c, a]);
|
|
865
866
|
};
|
|
866
867
|
}
|
|
867
|
-
function h(
|
|
868
|
+
function h(c) {
|
|
868
869
|
if (r) throw new TypeError("Generator is already executing.");
|
|
869
|
-
for (; i && (i = 0,
|
|
870
|
-
if (r = 1, o && (s =
|
|
871
|
-
switch (o = 0, s && (
|
|
870
|
+
for (; i && (i = 0, c[0] && (n = 0)), n; ) try {
|
|
871
|
+
if (r = 1, o && (s = c[0] & 2 ? o.return : c[0] ? o.throw || ((s = o.return) && s.call(o), 0) : o.next) && !(s = s.call(o, c[1])).done) return s;
|
|
872
|
+
switch (o = 0, s && (c = [c[0] & 2, s.value]), c[0]) {
|
|
872
873
|
case 0:
|
|
873
874
|
case 1:
|
|
874
|
-
s =
|
|
875
|
+
s = c;
|
|
875
876
|
break;
|
|
876
877
|
case 4:
|
|
877
|
-
return n.label++, { value:
|
|
878
|
+
return n.label++, { value: c[1], done: !1 };
|
|
878
879
|
case 5:
|
|
879
|
-
n.label++, o =
|
|
880
|
+
n.label++, o = c[1], c = [0];
|
|
880
881
|
continue;
|
|
881
882
|
case 7:
|
|
882
|
-
|
|
883
|
+
c = n.ops.pop(), n.trys.pop();
|
|
883
884
|
continue;
|
|
884
885
|
default:
|
|
885
|
-
if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (
|
|
886
|
+
if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
886
887
|
n = 0;
|
|
887
888
|
continue;
|
|
888
889
|
}
|
|
889
|
-
if (
|
|
890
|
-
n.label =
|
|
890
|
+
if (c[0] === 3 && (!s || c[1] > s[0] && c[1] < s[3])) {
|
|
891
|
+
n.label = c[1];
|
|
891
892
|
break;
|
|
892
893
|
}
|
|
893
|
-
if (
|
|
894
|
-
n.label = s[1], s =
|
|
894
|
+
if (c[0] === 6 && n.label < s[1]) {
|
|
895
|
+
n.label = s[1], s = c;
|
|
895
896
|
break;
|
|
896
897
|
}
|
|
897
898
|
if (s && n.label < s[2]) {
|
|
898
|
-
n.label = s[2], n.ops.push(
|
|
899
|
+
n.label = s[2], n.ops.push(c);
|
|
899
900
|
break;
|
|
900
901
|
}
|
|
901
902
|
s[2] && n.ops.pop(), n.trys.pop();
|
|
902
903
|
continue;
|
|
903
904
|
}
|
|
904
|
-
|
|
905
|
+
c = t.call(e, n);
|
|
905
906
|
} catch (a) {
|
|
906
|
-
|
|
907
|
+
c = [6, a], o = 0;
|
|
907
908
|
} finally {
|
|
908
909
|
r = s = 0;
|
|
909
910
|
}
|
|
910
|
-
if (
|
|
911
|
-
return { value:
|
|
911
|
+
if (c[0] & 5) throw c[1];
|
|
912
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
912
913
|
}
|
|
913
914
|
}
|
|
914
915
|
var ye = Object.create ? function(e, t, n, r) {
|
|
@@ -976,36 +977,36 @@ function jt(e, t, n) {
|
|
|
976
977
|
return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), d("next"), d("throw"), d("return", i), o[Symbol.asyncIterator] = function() {
|
|
977
978
|
return this;
|
|
978
979
|
}, o;
|
|
979
|
-
function i(
|
|
980
|
+
function i(f) {
|
|
980
981
|
return function(y) {
|
|
981
|
-
return Promise.resolve(y).then(
|
|
982
|
+
return Promise.resolve(y).then(f, u);
|
|
982
983
|
};
|
|
983
984
|
}
|
|
984
|
-
function d(
|
|
985
|
-
r[
|
|
985
|
+
function d(f, y) {
|
|
986
|
+
r[f] && (o[f] = function(_) {
|
|
986
987
|
return new Promise(function(T, p) {
|
|
987
|
-
s.push([
|
|
988
|
+
s.push([f, _, T, p]) > 1 || h(f, _);
|
|
988
989
|
});
|
|
989
|
-
}, y && (o[
|
|
990
|
+
}, y && (o[f] = y(o[f])));
|
|
990
991
|
}
|
|
991
|
-
function h(
|
|
992
|
+
function h(f, y) {
|
|
992
993
|
try {
|
|
993
|
-
|
|
994
|
+
c(r[f](y));
|
|
994
995
|
} catch (_) {
|
|
995
996
|
l(s[0][3], _);
|
|
996
997
|
}
|
|
997
998
|
}
|
|
998
|
-
function f
|
|
999
|
-
|
|
999
|
+
function c(f) {
|
|
1000
|
+
f.value instanceof te ? Promise.resolve(f.value.v).then(a, u) : l(s[0][2], f);
|
|
1000
1001
|
}
|
|
1001
|
-
function a(
|
|
1002
|
-
h("next",
|
|
1002
|
+
function a(f) {
|
|
1003
|
+
h("next", f);
|
|
1003
1004
|
}
|
|
1004
|
-
function u(
|
|
1005
|
-
h("throw",
|
|
1005
|
+
function u(f) {
|
|
1006
|
+
h("throw", f);
|
|
1006
1007
|
}
|
|
1007
|
-
function l(
|
|
1008
|
-
|
|
1008
|
+
function l(f, y) {
|
|
1009
|
+
f(y), s.shift(), s.length && h(s[0][0], s[0][1]);
|
|
1009
1010
|
}
|
|
1010
1011
|
}
|
|
1011
1012
|
function Pt(e) {
|
|
@@ -1035,8 +1036,8 @@ function Lt(e) {
|
|
|
1035
1036
|
};
|
|
1036
1037
|
}
|
|
1037
1038
|
function o(s, i, d, h) {
|
|
1038
|
-
Promise.resolve(h).then(function(
|
|
1039
|
-
s({ value:
|
|
1039
|
+
Promise.resolve(h).then(function(c) {
|
|
1040
|
+
s({ value: c, done: d });
|
|
1040
1041
|
}, i);
|
|
1041
1042
|
}
|
|
1042
1043
|
}
|
|
@@ -1220,12 +1221,12 @@ var Ve = $n, Ce = z, Kn = Ve.__importDefault(Gn());
|
|
|
1220
1221
|
function zn(e, t, n) {
|
|
1221
1222
|
t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
|
|
1222
1223
|
var r = Ce.useRef(0), o = Kn.default(), s = Ce.useState(n), i = s[0], d = s[1], h = Ce.useCallback(function() {
|
|
1223
|
-
for (var
|
|
1224
|
-
|
|
1224
|
+
for (var c = [], a = 0; a < arguments.length; a++)
|
|
1225
|
+
c[a] = arguments[a];
|
|
1225
1226
|
var u = ++r.current;
|
|
1226
1227
|
return i.loading || d(function(l) {
|
|
1227
1228
|
return Ve.__assign(Ve.__assign({}, l), { loading: !0 });
|
|
1228
|
-
}), e.apply(void 0,
|
|
1229
|
+
}), e.apply(void 0, c).then(function(l) {
|
|
1229
1230
|
return o() && u === r.current && d({ value: l, loading: !1 }), l;
|
|
1230
1231
|
}, function(l) {
|
|
1231
1232
|
return o() && u === r.current && d({ error: l, loading: !1 }), l;
|
|
@@ -1250,7 +1251,7 @@ function ir() {
|
|
|
1250
1251
|
}
|
|
1251
1252
|
function o(a, u) {
|
|
1252
1253
|
t(
|
|
1253
|
-
(l) => l.map((
|
|
1254
|
+
(l) => l.map((f) => f.id === a ? { ...f, ...u } : f)
|
|
1254
1255
|
);
|
|
1255
1256
|
}
|
|
1256
1257
|
function s(a) {
|
|
@@ -1261,15 +1262,15 @@ function ir() {
|
|
|
1261
1262
|
H.set(a.id, u);
|
|
1262
1263
|
try {
|
|
1263
1264
|
t(
|
|
1264
|
-
(
|
|
1265
|
+
(f) => f.map(
|
|
1265
1266
|
(y) => y.id === a.id ? { ...y, status: "uploading", progress: 0 } : y
|
|
1266
1267
|
)
|
|
1267
1268
|
);
|
|
1268
1269
|
const l = await n.uploadFile({
|
|
1269
1270
|
file: a.file,
|
|
1270
1271
|
abortSignal: u.signal,
|
|
1271
|
-
onProgress: (
|
|
1272
|
-
o(a.id, { progress:
|
|
1272
|
+
onProgress: (f) => {
|
|
1273
|
+
o(a.id, { progress: f });
|
|
1273
1274
|
}
|
|
1274
1275
|
});
|
|
1275
1276
|
o(a.id, {
|
|
@@ -1290,7 +1291,7 @@ function ir() {
|
|
|
1290
1291
|
const u = H.get(a);
|
|
1291
1292
|
u && (u.abort(), H.delete(a)), s(a);
|
|
1292
1293
|
}, h = Ne(() => e.filter((a) => a.status === "success" && a.fileUrl), [e]);
|
|
1293
|
-
function
|
|
1294
|
+
function c() {
|
|
1294
1295
|
H.forEach((a) => a.abort()), H.clear(), t([]);
|
|
1295
1296
|
}
|
|
1296
1297
|
return he(() => () => {
|
|
@@ -1300,7 +1301,7 @@ function ir() {
|
|
|
1300
1301
|
appendFiles: r,
|
|
1301
1302
|
handleCancelUpload: d,
|
|
1302
1303
|
successFiles: h,
|
|
1303
|
-
emptyTheFiles:
|
|
1304
|
+
emptyTheFiles: c,
|
|
1304
1305
|
getFileById: (a) => e.find((u) => u.id === a),
|
|
1305
1306
|
getUploadProgress: (a) => {
|
|
1306
1307
|
var u;
|
|
@@ -1347,4 +1348,4 @@ export {
|
|
|
1347
1348
|
nr as m,
|
|
1348
1349
|
Y as u
|
|
1349
1350
|
};
|
|
1350
|
-
//# sourceMappingURL=useWidgetTrigger-
|
|
1351
|
+
//# sourceMappingURL=useWidgetTrigger-CY_10B--.js.map
|