@opencx/widget 3.0.49 → 3.0.50
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 +1 -1
- package/dist/designs.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/src/headless/core/api/api-caller.d.ts +9 -9
- package/dist/{useUploadFiles-DqC2xlX8.cjs → useUploadFiles-14yeba8q.cjs} +3 -3
- package/dist/{useUploadFiles-DqC2xlX8.cjs.map → useUploadFiles-14yeba8q.cjs.map} +1 -1
- package/dist/{useUploadFiles-Dp5D34Dp.js → useUploadFiles-l6HSHHvN.js} +43 -46
- package/dist/{useUploadFiles-Dp5D34Dp.js.map → useUploadFiles-l6HSHHvN.js.map} +1 -1
- package/dist/{widget.ctx-QcHsFXpb.js → widget.ctx-CMgNQpCm.js} +200 -180
- package/dist/widget.ctx-CMgNQpCm.js.map +1 -0
- package/dist/widget.ctx-DxGvxdZ2.cjs +5 -0
- package/dist/widget.ctx-DxGvxdZ2.cjs.map +1 -0
- package/dist-embed/script.js +114 -119
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -2
- package/dist/widget.ctx-DYom-6yC.cjs +0 -5
- package/dist/widget.ctx-DYom-6yC.cjs.map +0 -1
- package/dist/widget.ctx-QcHsFXpb.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import z, { createContext as rt, useContext as ot, useRef as H, useState as st, useMemo as Ve, useEffect as
|
|
1
|
+
import z, { createContext as rt, useContext as ot, useRef as H, useState as st, useMemo as Ve, useEffect as Fe, useSyncExternalStore as Kt, useLayoutEffect as zt, useCallback as Ee, useDebugValue as Yt } from "react";
|
|
2
2
|
import { jsx as kt } from "react/jsx-runtime";
|
|
3
|
-
import { W as Jt } from "./widget.ctx-
|
|
3
|
+
import { W as Jt } from "./widget.ctx-CMgNQpCm.js";
|
|
4
4
|
import { v4 as Xt } from "uuid";
|
|
5
5
|
class Qt {
|
|
6
6
|
constructor(t) {
|
|
@@ -36,7 +36,7 @@ function Zt(e) {
|
|
|
36
36
|
return r;
|
|
37
37
|
}, t.Provider];
|
|
38
38
|
}
|
|
39
|
-
const en = "3.0.
|
|
39
|
+
const en = "3.0.50", [Y, tn] = Zt();
|
|
40
40
|
function Xn({
|
|
41
41
|
options: e,
|
|
42
42
|
children: t,
|
|
@@ -49,7 +49,7 @@ function Xn({
|
|
|
49
49
|
}),
|
|
50
50
|
[n]
|
|
51
51
|
);
|
|
52
|
-
return
|
|
52
|
+
return Fe(() => {
|
|
53
53
|
o.current || (o.current = !0, Jt.initialize({ config: e, storage: r }).then(i));
|
|
54
54
|
}, []), s ? /* @__PURE__ */ kt(
|
|
55
55
|
tn,
|
|
@@ -250,10 +250,10 @@ const G = () => {
|
|
|
250
250
|
}, P = (
|
|
251
251
|
/*#__NOINLINE__*/
|
|
252
252
|
G()
|
|
253
|
-
), we = Object, g = (e) => e === P,
|
|
253
|
+
), we = Object, g = (e) => e === P, M = (e) => typeof e == "function", $ = (e, t) => ({
|
|
254
254
|
...e,
|
|
255
255
|
...t
|
|
256
|
-
}), cn = (e) =>
|
|
256
|
+
}), cn = (e) => M(e.then), ce = /* @__PURE__ */ new WeakMap();
|
|
257
257
|
let fn = 0;
|
|
258
258
|
const se = (e) => {
|
|
259
259
|
const t = typeof e, n = e && e.constructor, r = n == Date;
|
|
@@ -275,7 +275,7 @@ const se = (e) => {
|
|
|
275
275
|
} else
|
|
276
276
|
o = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
277
277
|
return o;
|
|
278
|
-
}, W = /* @__PURE__ */ new WeakMap(), me = {}, fe = {},
|
|
278
|
+
}, W = /* @__PURE__ */ new WeakMap(), me = {}, fe = {}, Me = "undefined", he = typeof window != Me, De = typeof document != Me, ln = () => he && typeof window.requestAnimationFrame != Me, it = (e, t) => {
|
|
279
279
|
const n = W.get(e);
|
|
280
280
|
return [
|
|
281
281
|
// Getter
|
|
@@ -320,11 +320,11 @@ const dn = () => Ae, [xe, je] = he && window.addEventListener ? [
|
|
|
320
320
|
}, gn = {
|
|
321
321
|
initFocus: hn,
|
|
322
322
|
initReconnect: _n
|
|
323
|
-
}, Qe = !z.useId, ie = !he || "Deno" in window, En = (e) => ln() ? window.requestAnimationFrame(e) : setTimeout(e, 1), be = ie ?
|
|
323
|
+
}, Qe = !z.useId, ie = !he || "Deno" in window, En = (e) => ln() ? window.requestAnimationFrame(e) : setTimeout(e, 1), be = ie ? Fe : zt, Oe = typeof navigator < "u" && navigator.connection, Ze = !ie && Oe && ([
|
|
324
324
|
"slow-2g",
|
|
325
325
|
"2g"
|
|
326
326
|
].includes(Oe.effectiveType) || Oe.saveData), Ne = (e) => {
|
|
327
|
-
if (
|
|
327
|
+
if (M(e))
|
|
328
328
|
try {
|
|
329
329
|
e = e();
|
|
330
330
|
} catch {
|
|
@@ -356,7 +356,7 @@ async function ft(...e) {
|
|
|
356
356
|
const d = s.rollbackOnError;
|
|
357
357
|
let h = s.optimisticData;
|
|
358
358
|
const f = (l) => typeof d == "function" ? d(l) : d !== !1, a = s.throwOnError;
|
|
359
|
-
if (
|
|
359
|
+
if (M(n)) {
|
|
360
360
|
const l = n, c = [], y = t.keys();
|
|
361
361
|
for (const _ of y)
|
|
362
362
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
@@ -369,7 +369,7 @@ async function ft(...e) {
|
|
|
369
369
|
if (!c) return;
|
|
370
370
|
const [y, _] = it(t, c), [C, p, k, O] = W.get(t), E = () => {
|
|
371
371
|
const V = C[c];
|
|
372
|
-
return (
|
|
372
|
+
return (M(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete k[c], delete O[c], V && V[0]) ? V[0](ct).then(() => y().data) : y().data;
|
|
373
373
|
};
|
|
374
374
|
if (e.length < 3)
|
|
375
375
|
return E();
|
|
@@ -380,10 +380,10 @@ async function ft(...e) {
|
|
|
380
380
|
0
|
|
381
381
|
];
|
|
382
382
|
const w = !g(h), T = y(), j = T.data, q = T._c, K = g(q) ? j : q;
|
|
383
|
-
if (w && (h =
|
|
383
|
+
if (w && (h = M(h) ? h(K, j) : h, _({
|
|
384
384
|
data: h,
|
|
385
385
|
_c: K
|
|
386
|
-
})),
|
|
386
|
+
})), M(S))
|
|
387
387
|
try {
|
|
388
388
|
S = S(K);
|
|
389
389
|
} catch (V) {
|
|
@@ -400,7 +400,7 @@ async function ft(...e) {
|
|
|
400
400
|
_c: P
|
|
401
401
|
}));
|
|
402
402
|
if (i && !v)
|
|
403
|
-
if (
|
|
403
|
+
if (M(i)) {
|
|
404
404
|
const V = i(S, K);
|
|
405
405
|
_({
|
|
406
406
|
data: V,
|
|
@@ -506,7 +506,7 @@ const et = (e, t) => {
|
|
|
506
506
|
return n;
|
|
507
507
|
}, Tn = rt({}), Dn = "$inf$", dt = he && window.__SWR_DEVTOOLS_USE__, An = dt ? window.__SWR_DEVTOOLS_USE__ : [], xn = () => {
|
|
508
508
|
dt && (window.__SWR_DEVTOOLS_REACT__ = z);
|
|
509
|
-
}, jn = (e) =>
|
|
509
|
+
}, jn = (e) => M(e[1]) ? [
|
|
510
510
|
e[0],
|
|
511
511
|
e[1],
|
|
512
512
|
e[2] || {}
|
|
@@ -527,7 +527,7 @@ const et = (e, t) => {
|
|
|
527
527
|
for (let u = a.length; u--; )
|
|
528
528
|
h = a[u](h);
|
|
529
529
|
return h(o, s || d.fetcher || null, d);
|
|
530
|
-
},
|
|
530
|
+
}, Fn = (e, t, n) => {
|
|
531
531
|
const r = t[e] || (t[e] = []);
|
|
532
532
|
return r.push(n), () => {
|
|
533
533
|
const o = r.indexOf(n);
|
|
@@ -547,7 +547,7 @@ const tt = z.use || ((e) => {
|
|
|
547
547
|
}), e);
|
|
548
548
|
}), Re = {
|
|
549
549
|
dedupe: !0
|
|
550
|
-
},
|
|
550
|
+
}, Mn = (e, t, n) => {
|
|
551
551
|
const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval: f, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: l } = n, [c, y, _, C] = W.get(r), [p, k] = Ne(e), O = H(!1), E = H(!1), S = H(p), v = H(t), L = H(n), w = () => L.current, T = () => w().isVisible() && w().isOnline(), [j, q, K, V] = it(r, p), J = H({}).current, qt = g(i) ? n.fallback[p] : i, We = (m, b) => {
|
|
552
552
|
for (const A in J) {
|
|
553
553
|
const R = A;
|
|
@@ -566,8 +566,8 @@ const tt = z.use || ((e) => {
|
|
|
566
566
|
isLoading: !0,
|
|
567
567
|
...N
|
|
568
568
|
} : N;
|
|
569
|
-
}, A = j(), R = V(),
|
|
570
|
-
let D =
|
|
569
|
+
}, A = j(), R = V(), F = b(A), ee = A === R ? F : b(R);
|
|
570
|
+
let D = F;
|
|
571
571
|
return [
|
|
572
572
|
() => {
|
|
573
573
|
const x = b(j());
|
|
@@ -592,7 +592,7 @@ const tt = z.use || ((e) => {
|
|
|
592
592
|
const b = v.current;
|
|
593
593
|
if (!p || !b || E.current || w().isPaused())
|
|
594
594
|
return !1;
|
|
595
|
-
let A, R,
|
|
595
|
+
let A, R, F = !0;
|
|
596
596
|
const ee = m || {}, D = !_[p] || !ee.dedupe, x = () => Qe ? !E.current && p === S.current && O.current : p === S.current, N = {
|
|
597
597
|
isValidating: !1,
|
|
598
598
|
isLoading: !1
|
|
@@ -607,7 +607,7 @@ const tt = z.use || ((e) => {
|
|
|
607
607
|
g(j().data) && (ke.isLoading = !0);
|
|
608
608
|
try {
|
|
609
609
|
if (D && (q(ke), n.loadingTimeout && g(j().data) && setTimeout(() => {
|
|
610
|
-
|
|
610
|
+
F && x() && w().onLoadingSlow(p, n);
|
|
611
611
|
}, n.loadingTimeout), _[p] = [
|
|
612
612
|
b(k),
|
|
613
613
|
Pe()
|
|
@@ -625,7 +625,7 @@ const tt = z.use || ((e) => {
|
|
|
625
625
|
} catch (I) {
|
|
626
626
|
Ye();
|
|
627
627
|
const U = w(), { shouldRetryOnError: ye } = U;
|
|
628
|
-
U.isPaused() || (N.error = I, D && x() && (U.onError(I, p, U), (ye === !0 ||
|
|
628
|
+
U.isPaused() || (N.error = I, D && x() && (U.onError(I, p, U), (ye === !0 || M(ye) && ye(I)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || T()) && U.onErrorRetry(I, p, U, ($t) => {
|
|
629
629
|
const ge = c[p];
|
|
630
630
|
ge && ge[0] && ge[0](re.ERROR_REVALIDATE_EVENT, $t);
|
|
631
631
|
}, {
|
|
@@ -633,7 +633,7 @@ const tt = z.use || ((e) => {
|
|
|
633
633
|
dedupe: !0
|
|
634
634
|
})));
|
|
635
635
|
}
|
|
636
|
-
return
|
|
636
|
+
return F = !1, ze(), !0;
|
|
637
637
|
},
|
|
638
638
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
639
639
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -662,16 +662,16 @@ const tt = z.use || ((e) => {
|
|
|
662
662
|
if (!p) return;
|
|
663
663
|
const m = ne.bind(P, Re);
|
|
664
664
|
let b = 0;
|
|
665
|
-
const R =
|
|
666
|
-
if (
|
|
665
|
+
const R = Fn(p, c, (F, ee = {}) => {
|
|
666
|
+
if (F == re.FOCUS_EVENT) {
|
|
667
667
|
const D = Date.now();
|
|
668
668
|
w().revalidateOnFocus && D > b && T() && (b = D + w().focusThrottleInterval, m());
|
|
669
|
-
} else if (
|
|
669
|
+
} else if (F == re.RECONNECT_EVENT)
|
|
670
670
|
w().revalidateOnReconnect && T() && m();
|
|
671
671
|
else {
|
|
672
|
-
if (
|
|
672
|
+
if (F == re.MUTATE_EVENT)
|
|
673
673
|
return ne();
|
|
674
|
-
if (
|
|
674
|
+
if (F == re.ERROR_REVALIDATE_EVENT)
|
|
675
675
|
return ne(ee);
|
|
676
676
|
}
|
|
677
677
|
});
|
|
@@ -685,7 +685,7 @@ const tt = z.use || ((e) => {
|
|
|
685
685
|
]), be(() => {
|
|
686
686
|
let m;
|
|
687
687
|
function b() {
|
|
688
|
-
const R =
|
|
688
|
+
const R = M(f) ? f(j().data) : f;
|
|
689
689
|
R && m !== -1 && (m = setTimeout(A, R));
|
|
690
690
|
}
|
|
691
691
|
function A() {
|
|
@@ -729,7 +729,7 @@ const tt = z.use || ((e) => {
|
|
|
729
729
|
return J.isLoading = !0, Gt;
|
|
730
730
|
}
|
|
731
731
|
};
|
|
732
|
-
}, Nn = Vn(
|
|
732
|
+
}, Nn = Vn(Mn);
|
|
733
733
|
function rr() {
|
|
734
734
|
const { widgetCtx: e } = Y();
|
|
735
735
|
return Nn([e.config.token], e.api.widgetPrelude, {
|
|
@@ -1062,13 +1062,13 @@ function Vt(e, t, n, r) {
|
|
|
1062
1062
|
if (typeof t == "function" ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1063
1063
|
return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function Ft(e, t, n, r, o) {
|
|
1066
1066
|
if (r === "m") throw new TypeError("Private method is not writable");
|
|
1067
1067
|
if (r === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
|
|
1068
1068
|
if (typeof t == "function" ? e !== t || !o : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1069
1069
|
return r === "a" ? o.call(e, n) : o ? o.value = n : t.set(e, n), n;
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function Mt(e, t) {
|
|
1072
1072
|
if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1073
1073
|
return typeof e == "function" ? t === e : e.has(t);
|
|
1074
1074
|
}
|
|
@@ -1155,8 +1155,8 @@ const qn = {
|
|
|
1155
1155
|
__importStar: Lt,
|
|
1156
1156
|
__importDefault: It,
|
|
1157
1157
|
__classPrivateFieldGet: Vt,
|
|
1158
|
-
__classPrivateFieldSet:
|
|
1159
|
-
__classPrivateFieldIn:
|
|
1158
|
+
__classPrivateFieldSet: Ft,
|
|
1159
|
+
__classPrivateFieldIn: Mt,
|
|
1160
1160
|
__addDisposableResource: Nt,
|
|
1161
1161
|
__disposeResources: Ut,
|
|
1162
1162
|
__rewriteRelativeImportExtension: Wt
|
|
@@ -1172,8 +1172,8 @@ const qn = {
|
|
|
1172
1172
|
__await: te,
|
|
1173
1173
|
__awaiter: bt,
|
|
1174
1174
|
__classPrivateFieldGet: Vt,
|
|
1175
|
-
__classPrivateFieldIn:
|
|
1176
|
-
__classPrivateFieldSet:
|
|
1175
|
+
__classPrivateFieldIn: Mt,
|
|
1176
|
+
__classPrivateFieldSet: Ft,
|
|
1177
1177
|
__createBinding: _e,
|
|
1178
1178
|
__decorate: yt,
|
|
1179
1179
|
__disposeResources: Ut,
|
|
@@ -1265,14 +1265,11 @@ function ir() {
|
|
|
1265
1265
|
(y) => y.id === a.id ? { ...y, status: "uploading", progress: 0 } : y
|
|
1266
1266
|
)
|
|
1267
1267
|
);
|
|
1268
|
-
const l = await n.uploadFile(
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
c.loaded * 100 / c.total
|
|
1274
|
-
);
|
|
1275
|
-
o(a.id, { progress: y });
|
|
1268
|
+
const l = await n.uploadFile({
|
|
1269
|
+
file: a.file,
|
|
1270
|
+
abortSignal: u.signal,
|
|
1271
|
+
onProgress: (c) => {
|
|
1272
|
+
o(a.id, { progress: c });
|
|
1276
1273
|
}
|
|
1277
1274
|
});
|
|
1278
1275
|
o(a.id, {
|
|
@@ -1296,7 +1293,7 @@ function ir() {
|
|
|
1296
1293
|
function f() {
|
|
1297
1294
|
B.forEach((a) => a.abort()), B.clear(), t([]);
|
|
1298
1295
|
}
|
|
1299
|
-
return
|
|
1296
|
+
return Fe(() => () => {
|
|
1300
1297
|
B.forEach((a) => a.abort()), B.clear();
|
|
1301
1298
|
}, []), {
|
|
1302
1299
|
allFiles: e,
|
|
@@ -1336,4 +1333,4 @@ export {
|
|
|
1336
1333
|
Dt as n,
|
|
1337
1334
|
Y as u
|
|
1338
1335
|
};
|
|
1339
|
-
//# sourceMappingURL=useUploadFiles-
|
|
1336
|
+
//# sourceMappingURL=useUploadFiles-l6HSHHvN.js.map
|