@opencx/widget 2.4.3 → 2.4.4-rn.0
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/README.md +30 -30
- package/dist/basic.cjs +51 -51
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +1983 -1981
- package/dist/basic.js.map +1 -1
- package/dist/core/client/api.d.ts +36 -6
- package/dist/core/client/chat.d.ts +10 -20
- package/dist/core/client/config.d.ts +2 -3
- package/dist/core/client/contact.d.ts +13 -12
- package/dist/core/client/index.d.ts +1 -0
- package/dist/core/index.d.ts +0 -1
- package/dist/core/platform/index.d.ts +5 -5
- package/dist/core/platform/logger.d.ts +14 -0
- package/dist/core/platform/storage.d.ts +46 -0
- package/dist/core/types/helpers.d.ts +12 -0
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/messages.d.ts +2 -2
- package/dist/core/types/pub-sub.d.ts +24 -8
- package/dist/core/types/schemas-v2.d.ts +22 -25
- package/dist/{index-Bb4FAD9K.cjs → index-BVoLVQCZ.cjs} +3 -3
- package/dist/index-BVoLVQCZ.cjs.map +1 -0
- package/dist/{index-D2ByqkLZ.js → index-Cjs7ckCU.js} +92 -87
- package/dist/index-Cjs7ckCU.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +705 -343
- package/dist/index.js.map +1 -1
- package/dist/package.json.d.ts +156 -0
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/schemas-BBAV6Sd_.js.map +1 -1
- package/dist/schemas-wky4fpbc.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist-embed/script.js +5 -5
- package/dist-embed/script.js.map +1 -1
- package/package.json +3 -1
- package/dist/core/client/chat.test.d.ts +0 -1
- package/dist/core/client/client.d.ts +0 -9
- package/dist/core/client/config.test.d.ts +0 -1
- package/dist/core/client/contact.test.d.ts +0 -1
- package/dist/index-Bb4FAD9K.cjs.map +0 -1
- package/dist/index-D2ByqkLZ.js.map +0 -1
- package/dist/react-bindings/context/ChatContext.d.ts +0 -127
- package/dist/react-bindings/hooks/useContact.d.ts +0 -9
- package/dist/react-bindings/hooks/usePubsub.d.ts +0 -3
- package/dist/react-bindings/hooks/useSendMessage.d.ts +0 -6
- package/dist/react-bindings/index.d.ts +0 -3
|
@@ -54,7 +54,7 @@ function We(e, t, n = "session") {
|
|
|
54
54
|
};
|
|
55
55
|
}, [e, s]), [s, a, l];
|
|
56
56
|
}
|
|
57
|
-
const hn = "@opencx/widget", mt = "2.4.
|
|
57
|
+
const hn = "@opencx/widget", mt = "2.4.4-rn.0", mn = "module", yn = {
|
|
58
58
|
access: "public"
|
|
59
59
|
}, Sn = {
|
|
60
60
|
clean: "rm -rf ./dist ./dist-embed",
|
|
@@ -92,6 +92,7 @@ const hn = "@opencx/widget", mt = "2.4.3", mn = "module", yn = {
|
|
|
92
92
|
clsx: "^2.1.1",
|
|
93
93
|
"date-fns": "^4.1.0",
|
|
94
94
|
"framer-motion": "^11.3.30",
|
|
95
|
+
"lodash.isequal": "^4.5.0",
|
|
95
96
|
"lodash.set": "^4.3.2",
|
|
96
97
|
"lucide-react": "^0.436.0",
|
|
97
98
|
mutative: "^1.0.11",
|
|
@@ -126,7 +127,7 @@ const hn = "@opencx/widget", mt = "2.4.3", mn = "module", yn = {
|
|
|
126
127
|
}, Cn = {
|
|
127
128
|
name: "openchatai",
|
|
128
129
|
url: "https://github.com/openchatai"
|
|
129
|
-
},
|
|
130
|
+
}, Dn = "./dist/index.js", Nn = "./dist/index.js", _n = "./dist/index.d.ts", xn = !1, In = {
|
|
130
131
|
".": {
|
|
131
132
|
types: "./dist/index.d.ts",
|
|
132
133
|
import: "./dist/index.js",
|
|
@@ -144,7 +145,7 @@ const hn = "@opencx/widget", mt = "2.4.3", mn = "module", yn = {
|
|
|
144
145
|
},
|
|
145
146
|
"./package.json": "./package.json",
|
|
146
147
|
"./dist/*.css": "./dist/*.css"
|
|
147
|
-
},
|
|
148
|
+
}, Pn = {
|
|
148
149
|
"@biomejs/biome": "1.9.4",
|
|
149
150
|
"@changesets/cli": "^2.27.9",
|
|
150
151
|
"@radix-ui/react-popover": "^1.1.2",
|
|
@@ -153,6 +154,7 @@ const hn = "@opencx/widget", mt = "2.4.3", mn = "module", yn = {
|
|
|
153
154
|
"@testing-library/jest-dom": "^6.5.0",
|
|
154
155
|
"@testing-library/react": "^16.0.1",
|
|
155
156
|
"@types/lodash.debounce": "^4.0.9",
|
|
157
|
+
"@types/lodash.isequal": "^4.5.8",
|
|
156
158
|
"@types/lodash.set": "^4.3.9",
|
|
157
159
|
"@types/node": "^20.14.8",
|
|
158
160
|
"@types/react": "^18.3.4",
|
|
@@ -199,12 +201,12 @@ const hn = "@opencx/widget", mt = "2.4.3", mn = "module", yn = {
|
|
|
199
201
|
files: Tn,
|
|
200
202
|
bugs: Rn,
|
|
201
203
|
author: Cn,
|
|
202
|
-
main:
|
|
203
|
-
module:
|
|
204
|
+
main: Dn,
|
|
205
|
+
module: Nn,
|
|
204
206
|
types: _n,
|
|
205
207
|
sideEffects: xn,
|
|
206
|
-
exports:
|
|
207
|
-
devDependencies:
|
|
208
|
+
exports: In,
|
|
209
|
+
devDependencies: Pn
|
|
208
210
|
}, kn = "X-Bot-Token", Mn = "X-Widget-Version";
|
|
209
211
|
function yt(e) {
|
|
210
212
|
const t = ne(() => fn.create({
|
|
@@ -859,10 +861,10 @@ function Rt(e) {
|
|
|
859
861
|
function Ct(e, t, n) {
|
|
860
862
|
return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
|
|
861
863
|
}
|
|
862
|
-
function
|
|
864
|
+
function Dt(e, t) {
|
|
863
865
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
864
866
|
}
|
|
865
|
-
function
|
|
867
|
+
function Nt(e, t, n, r) {
|
|
866
868
|
function s(o) {
|
|
867
869
|
return o instanceof n ? o : new n(function(a) {
|
|
868
870
|
a(o);
|
|
@@ -949,7 +951,7 @@ function _t(e, t) {
|
|
|
949
951
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
950
952
|
}
|
|
951
953
|
}
|
|
952
|
-
var
|
|
954
|
+
var De = Object.create ? function(e, t, n, r) {
|
|
953
955
|
r === void 0 && (r = n);
|
|
954
956
|
var s = Object.getOwnPropertyDescriptor(t, n);
|
|
955
957
|
(!s || ("get" in s ? !t.__esModule : s.writable || s.configurable)) && (s = { enumerable: !0, get: function() {
|
|
@@ -959,7 +961,7 @@ var Ne = Object.create ? function(e, t, n, r) {
|
|
|
959
961
|
r === void 0 && (r = n), e[r] = t[n];
|
|
960
962
|
};
|
|
961
963
|
function xt(e, t) {
|
|
962
|
-
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) &&
|
|
964
|
+
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && De(t, e, n);
|
|
963
965
|
}
|
|
964
966
|
function Re(e) {
|
|
965
967
|
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
|
|
@@ -988,12 +990,12 @@ function Ke(e, t) {
|
|
|
988
990
|
}
|
|
989
991
|
return o;
|
|
990
992
|
}
|
|
991
|
-
function
|
|
993
|
+
function It() {
|
|
992
994
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
993
995
|
e = e.concat(Ke(arguments[t]));
|
|
994
996
|
return e;
|
|
995
997
|
}
|
|
996
|
-
function
|
|
998
|
+
function Pt() {
|
|
997
999
|
for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
|
|
998
1000
|
for (var r = Array(e), s = 0, t = 0; t < n; t++)
|
|
999
1001
|
for (var o = arguments[t], a = 0, l = o.length; a < l; a++, s++)
|
|
@@ -1089,7 +1091,7 @@ var er = Object.create ? function(e, t) {
|
|
|
1089
1091
|
function Vt(e) {
|
|
1090
1092
|
if (e && e.__esModule) return e;
|
|
1091
1093
|
var t = {};
|
|
1092
|
-
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) &&
|
|
1094
|
+
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) && De(t, e, n);
|
|
1093
1095
|
return er(t, e), t;
|
|
1094
1096
|
}
|
|
1095
1097
|
function Ut(e) {
|
|
@@ -1175,15 +1177,15 @@ const nr = {
|
|
|
1175
1177
|
__runInitializers: Tt,
|
|
1176
1178
|
__propKey: Rt,
|
|
1177
1179
|
__setFunctionName: Ct,
|
|
1178
|
-
__metadata:
|
|
1179
|
-
__awaiter:
|
|
1180
|
+
__metadata: Dt,
|
|
1181
|
+
__awaiter: Nt,
|
|
1180
1182
|
__generator: _t,
|
|
1181
|
-
__createBinding:
|
|
1183
|
+
__createBinding: De,
|
|
1182
1184
|
__exportStar: xt,
|
|
1183
1185
|
__values: Re,
|
|
1184
1186
|
__read: Ke,
|
|
1185
|
-
__spread:
|
|
1186
|
-
__spreadArrays:
|
|
1187
|
+
__spread: It,
|
|
1188
|
+
__spreadArrays: Pt,
|
|
1187
1189
|
__spreadArray: jt,
|
|
1188
1190
|
__await: he,
|
|
1189
1191
|
__asyncGenerator: kt,
|
|
@@ -1208,11 +1210,11 @@ const nr = {
|
|
|
1208
1210
|
__asyncGenerator: kt,
|
|
1209
1211
|
__asyncValues: Ft,
|
|
1210
1212
|
__await: he,
|
|
1211
|
-
__awaiter:
|
|
1213
|
+
__awaiter: Nt,
|
|
1212
1214
|
__classPrivateFieldGet: Ht,
|
|
1213
1215
|
__classPrivateFieldIn: zt,
|
|
1214
1216
|
__classPrivateFieldSet: Gt,
|
|
1215
|
-
__createBinding:
|
|
1217
|
+
__createBinding: De,
|
|
1216
1218
|
__decorate: bt,
|
|
1217
1219
|
__disposeResources: Bt,
|
|
1218
1220
|
__esDecorate: At,
|
|
@@ -1222,7 +1224,7 @@ const nr = {
|
|
|
1222
1224
|
__importDefault: Ut,
|
|
1223
1225
|
__importStar: Vt,
|
|
1224
1226
|
__makeTemplateObject: Lt,
|
|
1225
|
-
__metadata:
|
|
1227
|
+
__metadata: Dt,
|
|
1226
1228
|
__param: Ot,
|
|
1227
1229
|
__propKey: Rt,
|
|
1228
1230
|
__read: Ke,
|
|
@@ -1230,9 +1232,9 @@ const nr = {
|
|
|
1230
1232
|
__rewriteRelativeImportExtension: qt,
|
|
1231
1233
|
__runInitializers: Tt,
|
|
1232
1234
|
__setFunctionName: Ct,
|
|
1233
|
-
__spread:
|
|
1235
|
+
__spread: It,
|
|
1234
1236
|
__spreadArray: jt,
|
|
1235
|
-
__spreadArrays:
|
|
1237
|
+
__spreadArrays: Pt,
|
|
1236
1238
|
__values: Re,
|
|
1237
1239
|
default: nr
|
|
1238
1240
|
}, Symbol.toStringTag, { value: "Module" })), sr = /* @__PURE__ */ $n(rr);
|
|
@@ -1254,10 +1256,10 @@ function or() {
|
|
|
1254
1256
|
return be.default = t, be;
|
|
1255
1257
|
}
|
|
1256
1258
|
Object.defineProperty(vt, "__esModule", { value: !0 });
|
|
1257
|
-
var He = sr,
|
|
1259
|
+
var He = sr, Ie = de, ar = He.__importDefault(or());
|
|
1258
1260
|
function ir(e, t, n) {
|
|
1259
1261
|
t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
|
|
1260
|
-
var r =
|
|
1262
|
+
var r = Ie.useRef(0), s = ar.default(), o = Ie.useState(n), a = o[0], l = o[1], p = Ie.useCallback(function() {
|
|
1261
1263
|
for (var u = [], c = 0; c < arguments.length; c++)
|
|
1262
1264
|
u[c] = arguments[c];
|
|
1263
1265
|
var i = ++r.current;
|
|
@@ -1385,7 +1387,8 @@ function at(e) {
|
|
|
1385
1387
|
content: a.message,
|
|
1386
1388
|
id: a.publicId || ee(),
|
|
1387
1389
|
deliveredAt: a.created_at || "",
|
|
1388
|
-
attachments: a.attachments
|
|
1390
|
+
attachments: a.attachments,
|
|
1391
|
+
timestamp: a.created_at || ""
|
|
1389
1392
|
});
|
|
1390
1393
|
else
|
|
1391
1394
|
switch (a.type) {
|
|
@@ -1588,19 +1591,19 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1588
1591
|
async (A) => {
|
|
1589
1592
|
if (!d) return [];
|
|
1590
1593
|
try {
|
|
1591
|
-
const { data:
|
|
1592
|
-
return
|
|
1593
|
-
} catch (
|
|
1594
|
-
throw console.error("Error fetching history:",
|
|
1594
|
+
const { data: D } = await l.apis.fetchHistory(A);
|
|
1595
|
+
return D ? Array.isArray(D) ? at(D) : [] : [];
|
|
1596
|
+
} catch (D) {
|
|
1597
|
+
throw console.error("Error fetching history:", D), D;
|
|
1595
1598
|
}
|
|
1596
1599
|
},
|
|
1597
1600
|
[d, l.apis]
|
|
1598
1601
|
), [b, v] = Y(
|
|
1599
|
-
async (A,
|
|
1602
|
+
async (A, D) => {
|
|
1600
1603
|
try {
|
|
1601
1604
|
const L = await l.apis.getHistoryPooling({
|
|
1602
1605
|
sessionId: A,
|
|
1603
|
-
lastMessageTimestamp:
|
|
1606
|
+
lastMessageTimestamp: D
|
|
1604
1607
|
});
|
|
1605
1608
|
if (L.data) {
|
|
1606
1609
|
const k = at(L.data);
|
|
@@ -1625,15 +1628,15 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1625
1628
|
[l.apis, n, g]
|
|
1626
1629
|
);
|
|
1627
1630
|
le(() => {
|
|
1628
|
-
let A,
|
|
1631
|
+
let A, D;
|
|
1629
1632
|
return d && (A = setInterval(() => {
|
|
1630
1633
|
q(d.id);
|
|
1631
|
-
}, lr),
|
|
1634
|
+
}, lr), D = setInterval(() => {
|
|
1632
1635
|
var k;
|
|
1633
1636
|
const L = (k = t.messages.at(-1)) == null ? void 0 : k.timestamp;
|
|
1634
1637
|
L && v(d.id, L);
|
|
1635
1638
|
}, dr)), () => {
|
|
1636
|
-
clearInterval(A), clearInterval(
|
|
1639
|
+
clearInterval(A), clearInterval(D);
|
|
1637
1640
|
};
|
|
1638
1641
|
}, [d, q, v]);
|
|
1639
1642
|
const [F, O] = Y(
|
|
@@ -1642,8 +1645,8 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1642
1645
|
try {
|
|
1643
1646
|
const A = await m(d.id);
|
|
1644
1647
|
if (A) {
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1648
|
+
const D = await y(A.id);
|
|
1649
|
+
D && n({ type: "PREPEND_HISTORY", payload: D });
|
|
1647
1650
|
}
|
|
1648
1651
|
} catch (A) {
|
|
1649
1652
|
throw console.error("Error initializing session:", A), A;
|
|
@@ -1674,7 +1677,7 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1674
1677
|
}
|
|
1675
1678
|
},
|
|
1676
1679
|
[x, l.apis, a, h]
|
|
1677
|
-
), j = async ({ content: A, user:
|
|
1680
|
+
), j = async ({ content: A, user: D, attachments: L, ...k }) => {
|
|
1678
1681
|
var ue;
|
|
1679
1682
|
try {
|
|
1680
1683
|
let U = d, H = !1;
|
|
@@ -1708,9 +1711,10 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1708
1711
|
type: "FROM_USER",
|
|
1709
1712
|
id: z,
|
|
1710
1713
|
content: A.text,
|
|
1714
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1711
1715
|
user: {
|
|
1712
1716
|
...i.user,
|
|
1713
|
-
...
|
|
1717
|
+
...D
|
|
1714
1718
|
},
|
|
1715
1719
|
deliveredAt: null,
|
|
1716
1720
|
attachments: L
|
|
@@ -1734,7 +1738,7 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1734
1738
|
query_params: we,
|
|
1735
1739
|
user: {
|
|
1736
1740
|
...i.user,
|
|
1737
|
-
...
|
|
1741
|
+
...D
|
|
1738
1742
|
},
|
|
1739
1743
|
language: c,
|
|
1740
1744
|
attachments: L,
|
|
@@ -1779,6 +1783,7 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1779
1783
|
payload: {
|
|
1780
1784
|
type: "FROM_BOT",
|
|
1781
1785
|
id: ee(),
|
|
1786
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1782
1787
|
component: "TEXT",
|
|
1783
1788
|
data: {
|
|
1784
1789
|
message: w,
|
|
@@ -1798,8 +1803,8 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1798
1803
|
content: {
|
|
1799
1804
|
text: A
|
|
1800
1805
|
}
|
|
1801
|
-
}).catch((
|
|
1802
|
-
console.error("Error handling keyboard input:",
|
|
1806
|
+
}).catch((D) => {
|
|
1807
|
+
console.error("Error handling keyboard input:", D);
|
|
1803
1808
|
}), n({
|
|
1804
1809
|
type: "SET_KEYBOARD",
|
|
1805
1810
|
payload: null
|
|
@@ -1880,7 +1885,7 @@ function hs({
|
|
|
1880
1885
|
}) {
|
|
1881
1886
|
return /* @__PURE__ */ te(Zn, { data: t, children: /* @__PURE__ */ te(vr, { children: /* @__PURE__ */ te(St, { children: /* @__PURE__ */ te(mr, { children: e }) }) }) });
|
|
1882
1887
|
}
|
|
1883
|
-
var Ge = { exports: {} },
|
|
1888
|
+
var Ge = { exports: {} }, Pe = {};
|
|
1884
1889
|
/**
|
|
1885
1890
|
* @license React
|
|
1886
1891
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -1892,7 +1897,7 @@ var Ge = { exports: {} }, Ie = {};
|
|
|
1892
1897
|
*/
|
|
1893
1898
|
var it;
|
|
1894
1899
|
function Er() {
|
|
1895
|
-
if (it) return
|
|
1900
|
+
if (it) return Pe;
|
|
1896
1901
|
it = 1;
|
|
1897
1902
|
var e = de;
|
|
1898
1903
|
function t(i, g) {
|
|
@@ -1923,7 +1928,7 @@ function Er() {
|
|
|
1923
1928
|
return g();
|
|
1924
1929
|
}
|
|
1925
1930
|
var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
|
|
1926
|
-
return
|
|
1931
|
+
return Pe.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : c, Pe;
|
|
1927
1932
|
}
|
|
1928
1933
|
var je = {};
|
|
1929
1934
|
/**
|
|
@@ -2037,7 +2042,7 @@ const ve = (e) => {
|
|
|
2037
2042
|
} else
|
|
2038
2043
|
s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
2039
2044
|
return s;
|
|
2040
|
-
}, $ = /* @__PURE__ */ new WeakMap(), Me = {}, Ae = {}, Je = "undefined",
|
|
2045
|
+
}, $ = /* @__PURE__ */ new WeakMap(), Me = {}, Ae = {}, Je = "undefined", Ne = typeof window != Je, ze = typeof document != Je, Tr = () => Ne && typeof window.requestAnimationFrame != Je, Xt = (e, t) => {
|
|
2041
2046
|
const n = $.get(e);
|
|
2042
2047
|
return [
|
|
2043
2048
|
// Getter
|
|
@@ -2056,7 +2061,7 @@ const ve = (e) => {
|
|
|
2056
2061
|
];
|
|
2057
2062
|
};
|
|
2058
2063
|
let Ye = !0;
|
|
2059
|
-
const Rr = () => Ye, [Be, qe] =
|
|
2064
|
+
const Rr = () => Ye, [Be, qe] = Ne && window.addEventListener ? [
|
|
2060
2065
|
window.addEventListener.bind(window),
|
|
2061
2066
|
window.removeEventListener.bind(window)
|
|
2062
2067
|
] : [
|
|
@@ -2065,9 +2070,9 @@ const Rr = () => Ye, [Be, qe] = De && window.addEventListener ? [
|
|
|
2065
2070
|
], Cr = () => {
|
|
2066
2071
|
const e = ze && document.visibilityState;
|
|
2067
2072
|
return E(e) || e !== "hidden";
|
|
2068
|
-
},
|
|
2073
|
+
}, Dr = (e) => (ze && document.addEventListener("visibilitychange", e), Be("focus", e), () => {
|
|
2069
2074
|
ze && document.removeEventListener("visibilitychange", e), qe("focus", e);
|
|
2070
|
-
}),
|
|
2075
|
+
}), Nr = (e) => {
|
|
2071
2076
|
const t = () => {
|
|
2072
2077
|
Ye = !0, e();
|
|
2073
2078
|
}, n = () => {
|
|
@@ -2080,9 +2085,9 @@ const Rr = () => Ye, [Be, qe] = De && window.addEventListener ? [
|
|
|
2080
2085
|
isOnline: Rr,
|
|
2081
2086
|
isVisible: Cr
|
|
2082
2087
|
}, xr = {
|
|
2083
|
-
initFocus:
|
|
2084
|
-
initReconnect:
|
|
2085
|
-
}, ut = !de.useId, Ee = !
|
|
2088
|
+
initFocus: Dr,
|
|
2089
|
+
initReconnect: Nr
|
|
2090
|
+
}, ut = !de.useId, Ee = !Ne || "Deno" in window, Ir = (e) => Tr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Fe = Ee ? le : cn, Le = typeof navigator < "u" && navigator.connection, lt = !Ee && Le && ([
|
|
2086
2091
|
"slow-2g",
|
|
2087
2092
|
"2g"
|
|
2088
2093
|
].includes(Le.effectiveType) || Le.saveData), Ze = (e) => {
|
|
@@ -2098,8 +2103,8 @@ const Rr = () => Ye, [Be, qe] = De && window.addEventListener ? [
|
|
|
2098
2103
|
t
|
|
2099
2104
|
];
|
|
2100
2105
|
};
|
|
2101
|
-
let
|
|
2102
|
-
const Xe = () => ++
|
|
2106
|
+
let Pr = 0;
|
|
2107
|
+
const Xe = () => ++Pr, Qt = 0, Wt = 1, Kt = 2, jr = 3;
|
|
2103
2108
|
var Se = {
|
|
2104
2109
|
__proto__: null,
|
|
2105
2110
|
ERROR_REVALIDATE_EVENT: jr,
|
|
@@ -2266,7 +2271,7 @@ const dt = (e, t) => {
|
|
|
2266
2271
|
r && o && (n.use = r.concat(o)), s && a && (n.fallback = ce(s, a));
|
|
2267
2272
|
}
|
|
2268
2273
|
return n;
|
|
2269
|
-
}, Hr = gt({}), Gr = "$inf$", $t =
|
|
2274
|
+
}, Hr = gt({}), Gr = "$inf$", $t = Ne && window.__SWR_DEVTOOLS_USE__, zr = $t ? window.__SWR_DEVTOOLS_USE__ : [], Yr = () => {
|
|
2270
2275
|
$t && (window.__SWR_DEVTOOLS_REACT__ = de);
|
|
2271
2276
|
}, Br = (e) => W(e[1]) ? [
|
|
2272
2277
|
e[0],
|
|
@@ -2310,13 +2315,13 @@ const ft = de.use || ((e) => {
|
|
|
2310
2315
|
}), Ve = {
|
|
2311
2316
|
dedupe: !0
|
|
2312
2317
|
}, Jr = (e, t, n) => {
|
|
2313
|
-
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: l, revalidateIfStale: p, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: g } = n, [f, m, d, S] = $.get(r), [h, q] = Ze(e), C = ae(!1), y = ae(!1), b = ae(h), v = ae(t), F = ae(n), O = () => F.current, _ = () => O().isVisible() && O().isOnline(), [x, X, K, j] = Xt(r, h), re = ae({}).current, A = E(a) ? n.fallback[h] : a,
|
|
2314
|
-
for (const
|
|
2315
|
-
const
|
|
2316
|
-
if (
|
|
2317
|
-
if (!s(T[
|
|
2318
|
+
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: l, revalidateIfStale: p, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: g } = n, [f, m, d, S] = $.get(r), [h, q] = Ze(e), C = ae(!1), y = ae(!1), b = ae(h), v = ae(t), F = ae(n), O = () => F.current, _ = () => O().isVisible() && O().isOnline(), [x, X, K, j] = Xt(r, h), re = ae({}).current, A = E(a) ? n.fallback[h] : a, D = (T, R) => {
|
|
2319
|
+
for (const P in re) {
|
|
2320
|
+
const N = P;
|
|
2321
|
+
if (N === "data") {
|
|
2322
|
+
if (!s(T[N], R[N]) && (!E(T[N]) || !s(se, R[N])))
|
|
2318
2323
|
return !1;
|
|
2319
|
-
} else if (R[
|
|
2324
|
+
} else if (R[N] !== T[N])
|
|
2320
2325
|
return !1;
|
|
2321
2326
|
}
|
|
2322
2327
|
return !0;
|
|
@@ -2328,12 +2333,12 @@ const ft = de.use || ((e) => {
|
|
|
2328
2333
|
isLoading: !0,
|
|
2329
2334
|
...J
|
|
2330
2335
|
} : J;
|
|
2331
|
-
},
|
|
2332
|
-
let
|
|
2336
|
+
}, P = x(), N = j(), Q = R(P), pe = P === N ? Q : R(N);
|
|
2337
|
+
let I = Q;
|
|
2333
2338
|
return [
|
|
2334
2339
|
() => {
|
|
2335
2340
|
const M = R(x());
|
|
2336
|
-
return
|
|
2341
|
+
return D(M, I) ? (I.data = M.data, I.isLoading = M.isLoading, I.isValidating = M.isValidating, I.error = M.error, I) : (I = M, M);
|
|
2337
2342
|
},
|
|
2338
2343
|
() => pe
|
|
2339
2344
|
];
|
|
@@ -2341,8 +2346,8 @@ const ft = de.use || ((e) => {
|
|
|
2341
2346
|
r,
|
|
2342
2347
|
h
|
|
2343
2348
|
]), k = br.useSyncExternalStore(ge(
|
|
2344
|
-
(T) => K(h, (R,
|
|
2345
|
-
|
|
2349
|
+
(T) => K(h, (R, P) => {
|
|
2350
|
+
D(P, R) || T();
|
|
2346
2351
|
}),
|
|
2347
2352
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2348
2353
|
[
|
|
@@ -2354,40 +2359,40 @@ const ft = de.use || ((e) => {
|
|
|
2354
2359
|
const R = v.current;
|
|
2355
2360
|
if (!h || !R || y.current || O().isPaused())
|
|
2356
2361
|
return !1;
|
|
2357
|
-
let
|
|
2358
|
-
const pe = T || {},
|
|
2362
|
+
let P, N, Q = !0;
|
|
2363
|
+
const pe = T || {}, I = !d[h] || !pe.dedupe, M = () => ut ? !y.current && h === b.current && C.current : h === b.current, J = {
|
|
2359
2364
|
isValidating: !1,
|
|
2360
2365
|
isLoading: !1
|
|
2361
2366
|
}, et = () => {
|
|
2362
2367
|
X(J);
|
|
2363
2368
|
}, tt = () => {
|
|
2364
2369
|
const G = d[h];
|
|
2365
|
-
G && G[1] ===
|
|
2370
|
+
G && G[1] === N && delete d[h];
|
|
2366
2371
|
}, nt = {
|
|
2367
2372
|
isValidating: !0
|
|
2368
2373
|
};
|
|
2369
2374
|
E(x().data) && (nt.isLoading = !0);
|
|
2370
2375
|
try {
|
|
2371
|
-
if (
|
|
2376
|
+
if (I && (X(nt), n.loadingTimeout && E(x().data) && setTimeout(() => {
|
|
2372
2377
|
Q && M() && O().onLoadingSlow(h, n);
|
|
2373
2378
|
}, n.loadingTimeout), d[h] = [
|
|
2374
2379
|
R(q),
|
|
2375
2380
|
Xe()
|
|
2376
|
-
]), [
|
|
2377
|
-
return
|
|
2381
|
+
]), [P, N] = d[h], P = await P, I && setTimeout(tt, n.dedupingInterval), !d[h] || d[h][1] !== N)
|
|
2382
|
+
return I && M() && O().onDiscarded(h), !1;
|
|
2378
2383
|
J.error = V;
|
|
2379
2384
|
const G = m[h];
|
|
2380
2385
|
if (!E(G) && // case 1
|
|
2381
|
-
(
|
|
2382
|
-
|
|
2386
|
+
(N <= G[0] || // case 2
|
|
2387
|
+
N <= G[1] || // case 3
|
|
2383
2388
|
G[1] === 0))
|
|
2384
|
-
return et(),
|
|
2389
|
+
return et(), I && M() && O().onDiscarded(h), !1;
|
|
2385
2390
|
const Z = x().data;
|
|
2386
|
-
J.data = s(Z,
|
|
2391
|
+
J.data = s(Z, P) ? Z : P, I && M() && O().onSuccess(P, h, n);
|
|
2387
2392
|
} catch (G) {
|
|
2388
2393
|
tt();
|
|
2389
2394
|
const Z = O(), { shouldRetryOnError: _e } = Z;
|
|
2390
|
-
Z.isPaused() || (J.error = G,
|
|
2395
|
+
Z.isPaused() || (J.error = G, I && M() && (Z.onError(G, h, Z), (_e === !0 || W(_e) && _e(G)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || _()) && Z.onErrorRetry(G, h, Z, (nn) => {
|
|
2391
2396
|
const xe = f[h];
|
|
2392
2397
|
xe && xe[0] && xe[0](Se.ERROR_REVALIDATE_EVENT, nn);
|
|
2393
2398
|
}, {
|
|
@@ -2424,10 +2429,10 @@ const ft = de.use || ((e) => {
|
|
|
2424
2429
|
if (!h) return;
|
|
2425
2430
|
const T = ye.bind(V, Ve);
|
|
2426
2431
|
let R = 0;
|
|
2427
|
-
const
|
|
2432
|
+
const N = Kr(h, f, (Q, pe = {}) => {
|
|
2428
2433
|
if (Q == Se.FOCUS_EVENT) {
|
|
2429
|
-
const
|
|
2430
|
-
O().revalidateOnFocus &&
|
|
2434
|
+
const I = Date.now();
|
|
2435
|
+
O().revalidateOnFocus && I > R && _() && (R = I + O().focusThrottleInterval, T());
|
|
2431
2436
|
} else if (Q == Se.RECONNECT_EVENT)
|
|
2432
2437
|
O().revalidateOnReconnect && _() && T();
|
|
2433
2438
|
else {
|
|
@@ -2439,18 +2444,18 @@ const ft = de.use || ((e) => {
|
|
|
2439
2444
|
});
|
|
2440
2445
|
return y.current = !1, b.current = h, C.current = !0, X({
|
|
2441
2446
|
_k: q
|
|
2442
|
-
}), w && (E(z) || Ee ? T() :
|
|
2443
|
-
y.current = !0,
|
|
2447
|
+
}), w && (E(z) || Ee ? T() : Ir(T)), () => {
|
|
2448
|
+
y.current = !0, N();
|
|
2444
2449
|
};
|
|
2445
2450
|
}, [
|
|
2446
2451
|
h
|
|
2447
2452
|
]), Fe(() => {
|
|
2448
2453
|
let T;
|
|
2449
2454
|
function R() {
|
|
2450
|
-
const
|
|
2451
|
-
|
|
2455
|
+
const N = W(u) ? u(x().data) : u;
|
|
2456
|
+
N && T !== -1 && (T = setTimeout(P, N));
|
|
2452
2457
|
}
|
|
2453
|
-
function
|
|
2458
|
+
function P() {
|
|
2454
2459
|
!x().error && (c || O().isVisible()) && (i || O().isOnline()) ? ye(Ve).then(R) : R();
|
|
2455
2460
|
}
|
|
2456
2461
|
return R(), () => {
|
|
@@ -2518,4 +2523,4 @@ export {
|
|
|
2518
2523
|
ur as n,
|
|
2519
2524
|
us as u
|
|
2520
2525
|
};
|
|
2521
|
-
//# sourceMappingURL=index-
|
|
2526
|
+
//# sourceMappingURL=index-Cjs7ckCU.js.map
|