rc-lib-ui 1.2.16-beta.1 → 1.2.16-beta.3
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/control-cards.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{index-80JSxasr.js → index-DjJlkTF6.js} +38 -30
- package/dist/socket.js +59 -58
- package/package.json +2 -2
- package/dist/NetworkAndSocket/Socket/api/deps/NetworkControls/NetworkControls.d.ts +0 -18
- package/dist/NetworkAndSocket/Socket/api/deps/NetworkControls/NetworkControls.types.d.ts +0 -19
- package/dist/NetworkAndSocket/Socket/api/deps/NetworkControls/index.d.ts +0 -2
package/dist/control-cards.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Box as M, styled as P, Card as xn, Typography as j, Button as yn, Linea
|
|
|
8
8
|
import Ve from "classnames";
|
|
9
9
|
import { createPortal as Un } from "react-dom";
|
|
10
10
|
import { Save as Yn, Close as ge, Delete as Gn, InfoOutlined as Kn, VerifiedUser as Zn, CheckCircle as bn, TaskAlt as Qn } from "@mui/icons-material";
|
|
11
|
-
import { C as Jn } from "./index-
|
|
11
|
+
import { C as Jn } from "./index-DjJlkTF6.js";
|
|
12
12
|
import './control-cards.css';const En = $n(void 0), et = () => {
|
|
13
13
|
const e = hn(En);
|
|
14
14
|
if (!e)
|
package/dist/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as h, useRef as m, useEffect as P, useCallback as r } from "react";
|
|
2
|
-
import { T as w } from "./index-
|
|
2
|
+
import { T as w } from "./index-DjJlkTF6.js";
|
|
3
3
|
import { s as f } from "./index-B7GqTJat.js";
|
|
4
4
|
const p = (s = { timerShowPanel: 5e3 }) => {
|
|
5
5
|
const [t, a] = h({
|
|
@@ -1414,7 +1414,7 @@ const resolveConfig = (t) => {
|
|
|
1414
1414
|
return;
|
|
1415
1415
|
const S = AxiosHeaders$1.from(
|
|
1416
1416
|
"getAllResponseHeaders" in f && f.getAllResponseHeaders()
|
|
1417
|
-
),
|
|
1417
|
+
), T = {
|
|
1418
1418
|
data: !i || i === "text" || i === "json" ? f.responseText : f.response,
|
|
1419
1419
|
status: f.status,
|
|
1420
1420
|
statusText: f.statusText,
|
|
@@ -1426,7 +1426,7 @@ const resolveConfig = (t) => {
|
|
|
1426
1426
|
e(R), p();
|
|
1427
1427
|
}, function(R) {
|
|
1428
1428
|
r(R), p();
|
|
1429
|
-
},
|
|
1429
|
+
}, T), f = null;
|
|
1430
1430
|
}
|
|
1431
1431
|
"onloadend" in f ? f.onloadend = w : f.onreadystatechange = function() {
|
|
1432
1432
|
!f || f.readyState !== 4 || f.status === 0 && !(f.responseURL && f.responseURL.indexOf("file:") === 0) || setTimeout(w);
|
|
@@ -1436,15 +1436,15 @@ const resolveConfig = (t) => {
|
|
|
1436
1436
|
r(new AxiosError("Network Error", AxiosError.ERR_NETWORK, t, f)), f = null;
|
|
1437
1437
|
}, f.ontimeout = function() {
|
|
1438
1438
|
let S = n.timeout ? "timeout of " + n.timeout + "ms exceeded" : "timeout exceeded";
|
|
1439
|
-
const
|
|
1439
|
+
const T = n.transitional || transitionalDefaults;
|
|
1440
1440
|
n.timeoutErrorMessage && (S = n.timeoutErrorMessage), r(new AxiosError(
|
|
1441
1441
|
S,
|
|
1442
|
-
|
|
1442
|
+
T.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
1443
1443
|
t,
|
|
1444
1444
|
f
|
|
1445
1445
|
)), f = null;
|
|
1446
|
-
}, o === void 0 && s.setContentType(null), "setRequestHeader" in f && utils$1.forEach(s.toJSON(), function(S,
|
|
1447
|
-
f.setRequestHeader(
|
|
1446
|
+
}, o === void 0 && s.setContentType(null), "setRequestHeader" in f && utils$1.forEach(s.toJSON(), function(S, T) {
|
|
1447
|
+
f.setRequestHeader(T, S);
|
|
1448
1448
|
}), utils$1.isUndefined(n.withCredentials) || (f.withCredentials = !!n.withCredentials), i && i !== "json" && (f.responseType = n.responseType), l && ([g, m] = progressEventReducer(l, !0), f.addEventListener("progress", g)), a && f.upload && ([d, b] = progressEventReducer(a), f.upload.addEventListener("progress", d), f.upload.addEventListener("loadend", b)), (n.cancelToken || n.signal) && (u = (S) => {
|
|
1449
1449
|
f && (r(!S || S.type ? new CanceledError(null, t, f) : S), f.abort(), f = null);
|
|
1450
1450
|
}, n.cancelToken && n.cancelToken.subscribe(u), n.signal && (n.signal.aborted ? u() : n.signal.addEventListener("abort", u)));
|
|
@@ -1623,8 +1623,8 @@ const getBodyLength = async (t) => {
|
|
|
1623
1623
|
credentials: v ? g : void 0
|
|
1624
1624
|
});
|
|
1625
1625
|
let S = await fetch(p);
|
|
1626
|
-
const
|
|
1627
|
-
if (supportsResponseStream && (a ||
|
|
1626
|
+
const T = supportsResponseStream && (u === "stream" || u === "response");
|
|
1627
|
+
if (supportsResponseStream && (a || T && f)) {
|
|
1628
1628
|
const D = {};
|
|
1629
1629
|
["status", "statusText", "headers"].forEach((_) => {
|
|
1630
1630
|
D[_] = S[_];
|
|
@@ -1642,7 +1642,7 @@ const getBodyLength = async (t) => {
|
|
|
1642
1642
|
}
|
|
1643
1643
|
u = u || "text";
|
|
1644
1644
|
let R = await resolvers[utils$1.findKey(resolvers, u) || "text"](S, t);
|
|
1645
|
-
return !
|
|
1645
|
+
return !T && f && f(), await new Promise((D, C) => {
|
|
1646
1646
|
settle(D, C, {
|
|
1647
1647
|
data: R,
|
|
1648
1648
|
headers: AxiosHeaders$1.from(S.headers),
|
|
@@ -2287,7 +2287,7 @@ c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerReques
|
|
|
2287
2287
|
s = { ...s, statusCode: f, data: w, res: m }, f === 200 && p && (E.saveToken(p), s.data = { ...s.data, token: p }), r(s);
|
|
2288
2288
|
},
|
|
2289
2289
|
(m) => {
|
|
2290
|
-
const p = E.errorsHandler.handleError(m), { url: f, status: w, headers: v, error: S, ...
|
|
2290
|
+
const p = E.errorsHandler.handleError(m), { url: f, status: w, headers: v, error: S, ...T } = m, R = typeof S == "string" ? Utils.isJSON(S.trim()) : !1, D = {
|
|
2291
2291
|
headers: v,
|
|
2292
2292
|
status: w,
|
|
2293
2293
|
message: ""
|
|
@@ -2306,7 +2306,7 @@ c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerReques
|
|
|
2306
2306
|
const m = b.status, p = b == null ? void 0 : b.data;
|
|
2307
2307
|
s = { ...s, statusCode: m, data: p, res: b }, r(s);
|
|
2308
2308
|
}).catch((b) => {
|
|
2309
|
-
const m = E.errorsHandler.handleError(b), { code: p, config: f, status: w, message: v, response: S, stack:
|
|
2309
|
+
const m = E.errorsHandler.handleError(b), { code: p, config: f, status: w, message: v, response: S, stack: T } = b, R = {
|
|
2310
2310
|
code: p,
|
|
2311
2311
|
config: f,
|
|
2312
2312
|
status: w || l,
|
|
@@ -2314,7 +2314,7 @@ c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerReques
|
|
|
2314
2314
|
headers: S == null ? void 0 : S.headers,
|
|
2315
2315
|
statusText: S == null ? void 0 : S.statusText,
|
|
2316
2316
|
data: S == null ? void 0 : S.data,
|
|
2317
|
-
stack:
|
|
2317
|
+
stack: T
|
|
2318
2318
|
};
|
|
2319
2319
|
n({ ...d, ...m, errExt: R });
|
|
2320
2320
|
});
|
|
@@ -2443,21 +2443,21 @@ class EventSubscribers {
|
|
|
2443
2443
|
});
|
|
2444
2444
|
}
|
|
2445
2445
|
}
|
|
2446
|
-
const y = class
|
|
2446
|
+
const y = class A {
|
|
2447
2447
|
static setState(e) {
|
|
2448
|
-
|
|
2448
|
+
A.state = { ...A.state, ...e };
|
|
2449
2449
|
}
|
|
2450
2450
|
static getState() {
|
|
2451
|
-
return
|
|
2451
|
+
return A.state;
|
|
2452
2452
|
}
|
|
2453
2453
|
static getIsNetwork() {
|
|
2454
|
-
return
|
|
2454
|
+
return A.state.isNetworkStatus;
|
|
2455
2455
|
}
|
|
2456
2456
|
static request({ keyAction: e, request: r }) {
|
|
2457
2457
|
const { url: n, ...o } = r;
|
|
2458
2458
|
return new Promise((s, i) => {
|
|
2459
|
-
|
|
2460
|
-
const a =
|
|
2459
|
+
A.getIsInit() || A.init();
|
|
2460
|
+
const a = A.getIsNetwork(), l = {
|
|
2461
2461
|
url: n,
|
|
2462
2462
|
keyAction: e,
|
|
2463
2463
|
isErr: !a,
|
|
@@ -2466,7 +2466,7 @@ const y = class T {
|
|
|
2466
2466
|
statusCode: a ? 0 : 520,
|
|
2467
2467
|
isReload: !1
|
|
2468
2468
|
};
|
|
2469
|
-
if (
|
|
2469
|
+
if (A.events.publish("fetch", l), a) {
|
|
2470
2470
|
apiRequest.requestInServer(n, o).then((u) => {
|
|
2471
2471
|
const d = {
|
|
2472
2472
|
isReq: !1,
|
|
@@ -2476,7 +2476,7 @@ const y = class T {
|
|
|
2476
2476
|
msg: "",
|
|
2477
2477
|
...u
|
|
2478
2478
|
};
|
|
2479
|
-
|
|
2479
|
+
A.events.publish("fetch", d), s(d);
|
|
2480
2480
|
}).catch((u) => {
|
|
2481
2481
|
const d = {
|
|
2482
2482
|
//TODO: Проверить. dataErr не верно возвращает
|
|
@@ -2485,11 +2485,11 @@ const y = class T {
|
|
|
2485
2485
|
keyAction: e,
|
|
2486
2486
|
...u
|
|
2487
2487
|
};
|
|
2488
|
-
|
|
2488
|
+
A.events.publish("fetch", d), i(d);
|
|
2489
2489
|
});
|
|
2490
2490
|
return;
|
|
2491
2491
|
}
|
|
2492
|
-
|
|
2492
|
+
A.events.publish("fetch", l), i(l);
|
|
2493
2493
|
});
|
|
2494
2494
|
}
|
|
2495
2495
|
};
|
|
@@ -2527,7 +2527,7 @@ c(Numbers, "getOnlyTheStringNumbers", (t) => t.split("").filter((e) => !Number.i
|
|
|
2527
2527
|
}), c(Numbers, "randomMinMax", (t, e) => Math.floor(Math.random() * (e - t + 1)) + t);
|
|
2528
2528
|
class NetworkStatusTracker {
|
|
2529
2529
|
constructor(e = []) {
|
|
2530
|
-
c(this, "networkInfo"), c(this, "listUrls", []), c(this, "state", {
|
|
2530
|
+
c(this, "networkInfo"), c(this, "configInit"), c(this, "listUrls", []), c(this, "state", {
|
|
2531
2531
|
isActiveEvents: !1,
|
|
2532
2532
|
isMonitoring: !1,
|
|
2533
2533
|
checkIntervalId: null,
|
|
@@ -2574,10 +2574,15 @@ class NetworkStatusTracker {
|
|
|
2574
2574
|
this.controllersEvents = { ...this.controllersEvents, ...e };
|
|
2575
2575
|
}
|
|
2576
2576
|
async initialize(e, r) {
|
|
2577
|
-
if (!this.state.isInitialized)
|
|
2577
|
+
if (this.configInit = r, !this.state.isInitialized)
|
|
2578
2578
|
try {
|
|
2579
|
-
|
|
2580
|
-
|
|
2579
|
+
if (this.listUrls.length > 0)
|
|
2580
|
+
await this.requestByUrls(e, r);
|
|
2581
|
+
else {
|
|
2582
|
+
const n = typeof navigator < "u" ? navigator.onLine : !1;
|
|
2583
|
+
this.updateState(n, e);
|
|
2584
|
+
}
|
|
2585
|
+
this.setState({ isInitialized: !0 });
|
|
2581
2586
|
} catch (n) {
|
|
2582
2587
|
console.error("NetworkStatusTracker initialization error:", n), this.updateState(!1, e), this.setState({ isInitialized: !0 });
|
|
2583
2588
|
}
|
|
@@ -2597,10 +2602,13 @@ class NetworkStatusTracker {
|
|
|
2597
2602
|
const u = this.getConnection();
|
|
2598
2603
|
u && u != null && u.addEventListener ? u.addEventListener(
|
|
2599
2604
|
"change",
|
|
2600
|
-
(d) => {
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2605
|
+
async (d) => {
|
|
2606
|
+
if (this.listUrls.length > 0)
|
|
2607
|
+
await this.requestByUrls(e, this.configInit);
|
|
2608
|
+
else {
|
|
2609
|
+
const g = navigator.onLine;
|
|
2610
|
+
this.updateState(g, e);
|
|
2611
|
+
}
|
|
2604
2612
|
},
|
|
2605
2613
|
{ signal: (s = l.change) == null ? void 0 : s.signal }
|
|
2606
2614
|
) : (window.addEventListener(
|
package/dist/socket.js
CHANGED
|
@@ -7,7 +7,7 @@ import { c as U } from "./react-CLnE01WS.js";
|
|
|
7
7
|
import { styled as M, Collapse as G } from "@mui/material";
|
|
8
8
|
import L from "classnames";
|
|
9
9
|
import { u as W } from "./browser-DJTk47DY.js";
|
|
10
|
-
import { N as $ } from "./index-
|
|
10
|
+
import { N as $ } from "./index-DjJlkTF6.js";
|
|
11
11
|
const T = {
|
|
12
12
|
statusConnect: "disconnect",
|
|
13
13
|
isOfflineSocket: !1,
|
|
@@ -20,22 +20,22 @@ const T = {
|
|
|
20
20
|
isSelectOffline: !1
|
|
21
21
|
//Для того что бы 2й раз окно не показывать
|
|
22
22
|
}
|
|
23
|
-
},
|
|
24
|
-
resetState: () =>
|
|
25
|
-
setStatusConnectSocket: ({ statusConnect: n }) =>
|
|
26
|
-
setStatusIsReConnectSocket: ({ isReConnectSocket: n }) =>
|
|
27
|
-
setStatusReady: ({ isReadySocket: n }) =>
|
|
28
|
-
setIsOfflineSocket: ({ isOfflineSocket: n }) =>
|
|
29
|
-
setInfoNoConnectServer: (n) =>
|
|
30
|
-
setIsDisableConnectSocket: ({ isDisableConnectSocket: n }) =>
|
|
31
|
-
},
|
|
23
|
+
}, K = JSON.parse(JSON.stringify(T)), g = U(() => T), R = {
|
|
24
|
+
resetState: () => g.setState(K),
|
|
25
|
+
setStatusConnectSocket: ({ statusConnect: n }) => g.setState({ statusConnect: n }),
|
|
26
|
+
setStatusIsReConnectSocket: ({ isReConnectSocket: n }) => g.setState({ isReConnectSocket: n }),
|
|
27
|
+
setStatusReady: ({ isReadySocket: n }) => g.setState({ isReadySocket: n }),
|
|
28
|
+
setIsOfflineSocket: ({ isOfflineSocket: n }) => g.setState({ isOfflineSocket: n }),
|
|
29
|
+
setInfoNoConnectServer: (n) => g.setState((e) => ({ infoNoConnectServer: { ...e.infoNoConnectServer, ...n } })),
|
|
30
|
+
setIsDisableConnectSocket: ({ isDisableConnectSocket: n }) => g.setState({ isDisableConnectSocket: n })
|
|
31
|
+
}, k = {
|
|
32
32
|
getStatusConnectSocket: (n) => n.statusConnect,
|
|
33
33
|
getStatusIsReConnectSocket: (n) => n.isReConnectSocket,
|
|
34
34
|
getStatusReady: (n) => n.isReadySocket,
|
|
35
35
|
getIsOfflineSocket: (n) => n.isOfflineSocket,
|
|
36
36
|
getInfoNoConnectServer: (n) => n.infoNoConnectServer,
|
|
37
37
|
getIsDisableConnectSocket: (n) => n.isDisableConnectSocket
|
|
38
|
-
},
|
|
38
|
+
}, b = (n) => g(n), Q = M("span")({
|
|
39
39
|
backgroundColor: "rgba(0,0,0,0.3)",
|
|
40
40
|
color: "#fff",
|
|
41
41
|
display: "flex",
|
|
@@ -43,7 +43,7 @@ const T = {
|
|
|
43
43
|
padding: "1px 10px",
|
|
44
44
|
borderRadius: "3px 3px 3px 3px"
|
|
45
45
|
}), P = M(
|
|
46
|
-
({ children: n, ...e }) => /* @__PURE__ */ D(G, { ...e, unmountOnExit: !0, children: /* @__PURE__ */ D(
|
|
46
|
+
({ children: n, ...e }) => /* @__PURE__ */ D(G, { ...e, unmountOnExit: !0, children: /* @__PURE__ */ D(Q, { children: n }) })
|
|
47
47
|
)(({ theme: n }) => ({
|
|
48
48
|
fontSize: 10,
|
|
49
49
|
position: "absolute",
|
|
@@ -60,12 +60,12 @@ const T = {
|
|
|
60
60
|
color: "#151616",
|
|
61
61
|
letterSpacing: 1
|
|
62
62
|
}
|
|
63
|
-
})),
|
|
63
|
+
})), V = "_connect-server-anim_1lp7f_1", X = "_loading-stripes_1lp7f_1", Y = {
|
|
64
64
|
"connect-server-anim": "_connect-server-anim_1lp7f_1",
|
|
65
|
-
connectServerAnim:
|
|
65
|
+
connectServerAnim: V,
|
|
66
66
|
"loading-stripes": "_loading-stripes_1lp7f_1",
|
|
67
|
-
loadingStripes:
|
|
68
|
-
},
|
|
67
|
+
loadingStripes: X
|
|
68
|
+
}, Z = M(P, {
|
|
69
69
|
shouldForwardProp: (n) => ![""].includes(n)
|
|
70
70
|
})(({ theme: n }) => ({
|
|
71
71
|
top: "100%",
|
|
@@ -75,20 +75,20 @@ const T = {
|
|
|
75
75
|
"& span": {
|
|
76
76
|
height: "100%"
|
|
77
77
|
}
|
|
78
|
-
})),
|
|
79
|
-
const o = k
|
|
78
|
+
})), j = ({ text: n = "Происходит подключение к серверу", className: e, ...t }) => {
|
|
79
|
+
const o = b(k.getStatusConnectSocket), i = b(k.getStatusIsReConnectSocket);
|
|
80
80
|
return /* @__PURE__ */ D(
|
|
81
|
-
|
|
81
|
+
Z,
|
|
82
82
|
{
|
|
83
83
|
in: o === "pending" || i,
|
|
84
84
|
collapsedSize: "1px",
|
|
85
|
-
className: L(
|
|
85
|
+
className: L(Y["connect-server-anim"], e),
|
|
86
86
|
unmountOnExit: !0,
|
|
87
87
|
...t,
|
|
88
88
|
children: n
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
|
-
}, _ = N.memo(
|
|
91
|
+
}, _ = N.memo(j);
|
|
92
92
|
class ee {
|
|
93
93
|
constructor() {
|
|
94
94
|
r(this, "defaultProps", {
|
|
@@ -100,14 +100,14 @@ class ee {
|
|
|
100
100
|
}, i = (S) => {
|
|
101
101
|
t != null && t.controlAction && (t == null || t.controlAction(S));
|
|
102
102
|
};
|
|
103
|
-
let c = !0, a, u,
|
|
103
|
+
let c = !0, a, u, v;
|
|
104
104
|
const l = (S = !0) => {
|
|
105
105
|
const d = "Ручное завершение startActionEvery";
|
|
106
|
-
c = !1, clearInterval(a), o(null), S ? u && u({ status: S, msg: d + ": (true)" }) :
|
|
106
|
+
c = !1, clearInterval(a), o(null), S ? u && u({ status: S, msg: d + ": (true)" }) : v && v({ status: S, msg: d + ": (false)" });
|
|
107
107
|
};
|
|
108
108
|
return {
|
|
109
109
|
promise: new Promise((S, d) => {
|
|
110
|
-
u = S,
|
|
110
|
+
u = S, v = d;
|
|
111
111
|
let m = 0, f = 0;
|
|
112
112
|
a = setInterval(
|
|
113
113
|
() => {
|
|
@@ -142,7 +142,7 @@ class ee {
|
|
|
142
142
|
}).catch((l) => {
|
|
143
143
|
a === 1 && (a = 0, u.msg = l, c(l));
|
|
144
144
|
});
|
|
145
|
-
let
|
|
145
|
+
let v = setInterval(() => {
|
|
146
146
|
if (a === 1) {
|
|
147
147
|
if (a = 0, typeof t == "function") {
|
|
148
148
|
c({ status: !1, msg: "", ...t(u) });
|
|
@@ -150,7 +150,7 @@ class ee {
|
|
|
150
150
|
}
|
|
151
151
|
c({ status: !1, msg: "oneOfPromise reject" });
|
|
152
152
|
}
|
|
153
|
-
clearInterval(
|
|
153
|
+
clearInterval(v);
|
|
154
154
|
}, o * 1e3);
|
|
155
155
|
}));
|
|
156
156
|
}
|
|
@@ -223,8 +223,8 @@ class te {
|
|
|
223
223
|
try {
|
|
224
224
|
const { action: o } = t, i = this.findDataRequestByAction(o);
|
|
225
225
|
if (i) {
|
|
226
|
-
const { cb: c, ...a } = i, { payload: u, ...
|
|
227
|
-
this.events.publish("msg", { ...t, request: { ...
|
|
226
|
+
const { cb: c, ...a } = i, { payload: u, ...v } = a;
|
|
227
|
+
this.events.publish("msg", { ...t, request: { ...v, ...u } });
|
|
228
228
|
} else
|
|
229
229
|
this.events.publish("msg", t);
|
|
230
230
|
o && this.filterSaveItemsByResponse(t);
|
|
@@ -331,7 +331,8 @@ const s = class s {
|
|
|
331
331
|
s.wsApi.getIsInitWS() && (console.log("CONNECT WS"), s.setState({ isDisconnect: !1 }), s.wsApi.connect());
|
|
332
332
|
}
|
|
333
333
|
static disconnect() {
|
|
334
|
-
|
|
334
|
+
var e;
|
|
335
|
+
s.state.isDisconnect || (s.setState({ isDisconnect: !0 }), console.log("DISCONNECT WS"), s.wsApi.disconnect(), s.resetState(), s.events.resetSubscribers(), (e = this.networkTicker) == null || e.destroy());
|
|
335
336
|
}
|
|
336
337
|
static send(e, t) {
|
|
337
338
|
const { action: o, ...i } = e, c = i != null && i.request_id ? i.request_id : W(), a = Date.now();
|
|
@@ -367,27 +368,27 @@ const s = class s {
|
|
|
367
368
|
payload: e,
|
|
368
369
|
cb: void 0
|
|
369
370
|
});
|
|
370
|
-
let
|
|
371
|
-
t != null && t.timeout && (
|
|
371
|
+
let v;
|
|
372
|
+
t != null && t.timeout && (v = setTimeout(() => {
|
|
372
373
|
d(), i(new Error("Request timeout"));
|
|
373
374
|
}, t.timeout));
|
|
374
|
-
const l = (
|
|
375
|
-
d(), i(
|
|
376
|
-
}, h = (
|
|
375
|
+
const l = (p) => {
|
|
376
|
+
d(), i(p);
|
|
377
|
+
}, h = (p) => {
|
|
377
378
|
var A;
|
|
378
379
|
const O = this.wsApi.findDataRequestByAction(c);
|
|
379
|
-
!O || ((A =
|
|
380
|
+
!O || ((A = p == null ? void 0 : p.request) == null ? void 0 : A.requestAction) !== O.requestAction || (d(), o({ ...p }));
|
|
380
381
|
}, S = () => {
|
|
381
382
|
d(), i(new DOMException("Aborted", "AbortError"));
|
|
382
383
|
}, d = () => {
|
|
383
|
-
var
|
|
384
|
-
s.off("msg", h), s.off("error", l),
|
|
384
|
+
var p;
|
|
385
|
+
s.off("msg", h), s.off("error", l), v && clearTimeout(v), (p = t == null ? void 0 : t.signal) == null || p.removeEventListener("abort", S);
|
|
385
386
|
};
|
|
386
387
|
s.on("msg", h), s.on("error", l), (w = t == null ? void 0 : t.signal) == null || w.addEventListener("abort", S);
|
|
387
388
|
const m = s.wsApi.getSocket();
|
|
388
389
|
if (!m || m.readyState !== 1) {
|
|
389
|
-
const
|
|
390
|
-
console.error(
|
|
390
|
+
const p = "Нет подключения к сокету";
|
|
391
|
+
console.error(p), d(), i(new Error(p));
|
|
391
392
|
return;
|
|
392
393
|
}
|
|
393
394
|
s.wsApi.send(e);
|
|
@@ -403,7 +404,7 @@ r(s, "state", {
|
|
|
403
404
|
//не используеться
|
|
404
405
|
}), r(s, "options", {
|
|
405
406
|
isReConnectNetworkOnline: !1,
|
|
406
|
-
listUrlsCheckConnectNetwork: ["https://
|
|
407
|
+
listUrlsCheckConnectNetwork: ["https://www.google.com/favicon.ico"]
|
|
407
408
|
}), r(s, "wsApi", new te()), r(s, "delay", new ee()), r(s, "networkTicker", null), r(s, "events", new H(["timeOffReConnect", "reConnect", "network"])), r(s, "saveID", {
|
|
408
409
|
idReConnect: null,
|
|
409
410
|
checkConnect: null
|
|
@@ -476,10 +477,10 @@ const se = (n, e = {}) => {
|
|
|
476
477
|
isLoading: !1,
|
|
477
478
|
isError: !1,
|
|
478
479
|
isSuccess: !1
|
|
479
|
-
}), u = k
|
|
480
|
+
}), u = b(k.getStatusReady), v = b(k.getStatusConnectSocket), l = x(null), h = x(e);
|
|
480
481
|
h.current = e;
|
|
481
482
|
const S = E(async () => {
|
|
482
|
-
var w,
|
|
483
|
+
var w, p, O, A;
|
|
483
484
|
if (o) return;
|
|
484
485
|
a((y) => ({
|
|
485
486
|
...y,
|
|
@@ -498,7 +499,7 @@ const se = (n, e = {}) => {
|
|
|
498
499
|
data: y,
|
|
499
500
|
isSuccess: !0,
|
|
500
501
|
isLoading: !1
|
|
501
|
-
})), (
|
|
502
|
+
})), (p = (w = h.current).onSuccess) == null || p.call(w, y);
|
|
502
503
|
} catch (y) {
|
|
503
504
|
if (f.aborted) return;
|
|
504
505
|
const q = y instanceof Error ? y.message : String(y);
|
|
@@ -514,13 +515,13 @@ const se = (n, e = {}) => {
|
|
|
514
515
|
var f;
|
|
515
516
|
(f = l.current) == null || f.abort();
|
|
516
517
|
}), [S, o, u]), I(() => {
|
|
517
|
-
!u &&
|
|
518
|
+
!u && v === "pending" && a((f) => ({
|
|
518
519
|
...f,
|
|
519
520
|
isError: !1,
|
|
520
521
|
isSuccess: !1,
|
|
521
522
|
error: "Потеряно соединение с сервером"
|
|
522
523
|
}));
|
|
523
|
-
}, [u,
|
|
524
|
+
}, [u, v]);
|
|
524
525
|
const d = E(() => {
|
|
525
526
|
var f;
|
|
526
527
|
return (f = l.current) == null || f.abort(), S();
|
|
@@ -533,25 +534,25 @@ const se = (n, e = {}) => {
|
|
|
533
534
|
refetch: d,
|
|
534
535
|
abort: m
|
|
535
536
|
};
|
|
536
|
-
},
|
|
537
|
-
const { isNetwork: e, typeNetwork: t } = n, { isModal: o } = k
|
|
537
|
+
}, ge = (n, e) => se(n, e), ne = (n) => {
|
|
538
|
+
const { isNetwork: e, typeNetwork: t } = n, { isModal: o } = b(k.getInfoNoConnectServer), i = b(k.getStatusIsReConnectSocket), c = b(k.getIsDisableConnectSocket), a = b(k.getStatusConnectSocket), [u, v] = B({
|
|
538
539
|
isNetwork: !1,
|
|
539
540
|
typeNetwork: ""
|
|
540
541
|
});
|
|
541
542
|
return console.group("InitializationSocket (Проверка внутреннего и внешнего статуса network)"), console.log("props:>>", n), console.log("networkState:>>", u), console.groupEnd(), I(() => (C.on("network", (l) => {
|
|
542
|
-
console.log("network: ", l),
|
|
543
|
+
console.log("network: ", l), v({ isNetwork: l.isNetwork, typeNetwork: l.typeNetwork });
|
|
543
544
|
}), C.init(n.init), typeof n.onMount == "function" && n.onMount(), C.on("status", (l) => {
|
|
544
|
-
const h =
|
|
545
|
+
const h = g.getState(), { isReadySocket: S, infoNoConnectServer: { isModal: d }, isOfflineSocket: m } = h;
|
|
545
546
|
l !== "ready" && S && R.setStatusReady({ isReadySocket: !1 }), !S && l === "ready" && (R.setStatusReady({ isReadySocket: !0 }), d && m && (console.log("Вырубаем модалку т.к. сокет законектился после окончания timeOffReConnect"), R.setInfoNoConnectServer({ isModal: !1 }), R.setIsOfflineSocket({ isOfflineSocket: !1 }))), R.setStatusConnectSocket({ statusConnect: l });
|
|
546
547
|
}), C.on("error", (l) => {
|
|
547
548
|
console.log("error: ", l);
|
|
548
549
|
}), C.on("reConnect", (l) => {
|
|
549
550
|
console.log('on"reConnect" (status): ', l);
|
|
550
|
-
const h =
|
|
551
|
+
const h = g.getState(), { isReConnectSocket: S, infoNoConnectServer: { isModal: d } } = h;
|
|
551
552
|
S !== l && R.setStatusIsReConnectSocket({ isReConnectSocket: l }), d && l && R.setInfoNoConnectServer({ isModal: !1 });
|
|
552
553
|
}), C.on("timeOffReConnect", (l) => {
|
|
553
554
|
if (console.log("timeOffReConnect: ", l), R.setIsOfflineSocket({ isOfflineSocket: !l.status }), !l.status) {
|
|
554
|
-
const h =
|
|
555
|
+
const h = g.getState(), { infoNoConnectServer: { isModal: S, isSelectOffline: d } } = h;
|
|
555
556
|
let m = !1;
|
|
556
557
|
!S && !d && (m = !0), m && R.setInfoNoConnectServer({ isModal: m });
|
|
557
558
|
}
|
|
@@ -575,7 +576,7 @@ const se = (n, e = {}) => {
|
|
|
575
576
|
padding: "1px 10px"
|
|
576
577
|
}
|
|
577
578
|
})), re = ({ children: n, className: e, isNetwork: t, ...o }) => {
|
|
578
|
-
const i = k
|
|
579
|
+
const i = b(k.getIsOfflineSocket), c = b(k.getIsDisableConnectSocket), a = i || !t, u = "Оффлайн";
|
|
579
580
|
return /* @__PURE__ */ D(
|
|
580
581
|
ie,
|
|
581
582
|
{
|
|
@@ -595,7 +596,7 @@ const se = (n, e = {}) => {
|
|
|
595
596
|
R.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !0 }), R.setIsDisableConnectSocket({ isDisableConnectSocket: !0 });
|
|
596
597
|
}, []);
|
|
597
598
|
return n({ offlineActive: e });
|
|
598
|
-
}, Se = N.memo(ue),
|
|
599
|
+
}, Se = N.memo(ue), ke = {
|
|
599
600
|
ConnectDetection: _,
|
|
600
601
|
OfflineDetection: ce,
|
|
601
602
|
Buttons: {
|
|
@@ -605,12 +606,12 @@ const se = (n, e = {}) => {
|
|
|
605
606
|
Initialization: oe
|
|
606
607
|
};
|
|
607
608
|
export {
|
|
608
|
-
|
|
609
|
+
ke as Socket,
|
|
609
610
|
C as SocketApi,
|
|
610
|
-
|
|
611
|
+
ge as createRequestSocketApi,
|
|
611
612
|
R as socketActions,
|
|
612
|
-
|
|
613
|
-
|
|
613
|
+
k as socketSelectors,
|
|
614
|
+
g as socketStore,
|
|
614
615
|
se as useRequestSocketApi,
|
|
615
|
-
|
|
616
|
+
b as useSocketSelector
|
|
616
617
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rc-lib-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.2.16-beta.
|
|
4
|
+
"version": "1.2.16-beta.3",
|
|
5
5
|
"author": "SinGlEBW",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"build:dev": "node buildEditVersion.js"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"dev-classes": "^1.5.
|
|
62
|
+
"dev-classes": "^1.5.3",
|
|
63
63
|
"notistack": "^3.0.2",
|
|
64
64
|
"react-transition-group": "^4.4.5",
|
|
65
65
|
"uuid4": "^2.0.3",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NetworkControlsConfigProps, NetworkControlsStateProps, NetworkMonitorCallback, NetworkMonitorCallbackInterval } from './NetworkControls.types';
|
|
2
|
-
type OnStatusChange = (info: {
|
|
3
|
-
isNetwork: boolean;
|
|
4
|
-
typeNetwork: string;
|
|
5
|
-
}) => void;
|
|
6
|
-
export declare class NetworkControls {
|
|
7
|
-
private networkTicker;
|
|
8
|
-
private state;
|
|
9
|
-
private config;
|
|
10
|
-
private setState;
|
|
11
|
-
getState(): NetworkControlsStateProps;
|
|
12
|
-
private saveCallback;
|
|
13
|
-
constructor(listUrlsCheckConnection: string[]);
|
|
14
|
-
getNetworkStatus(onStatusChange?: OnStatusChange): void;
|
|
15
|
-
motitorNetwirk(cbInterval: NetworkMonitorCallbackInterval, cb: NetworkMonitorCallback, options?: NetworkControlsConfigProps): Promise<void>;
|
|
16
|
-
stopMotitorNetwirk(): void;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type NetworkStatus = 'unknown' | 'none' | 'wifi' | '2g' | '3g' | '4g';
|
|
2
|
-
export interface NetworkInfo {
|
|
3
|
-
isNetwork: boolean;
|
|
4
|
-
typeNetwork: string;
|
|
5
|
-
}
|
|
6
|
-
export interface NetworkControlsStateProps extends NetworkInfo {
|
|
7
|
-
isActiveDelay: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface NetworkControlsConfigProps {
|
|
10
|
-
interval?: number;
|
|
11
|
-
isAutoStop?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export type NetworkMonitorCallback = (info: NetworkInfo) => void;
|
|
14
|
-
interface NetworkMonitorCallbackIntervalConfig {
|
|
15
|
-
reset: () => void;
|
|
16
|
-
sendNetworkInfo: NetworkMonitorCallback;
|
|
17
|
-
}
|
|
18
|
-
export type NetworkMonitorCallbackInterval = (config: NetworkMonitorCallbackIntervalConfig) => void;
|
|
19
|
-
export {};
|