rc-lib-ui 1.1.28 → 1.1.46
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/NetworkAndSocket/Socket/api/SocketApi.d.ts +6 -7
- package/dist/NetworkAndSocket/Socket/api/SocketApi.types.d.ts +5 -3
- package/dist/NetworkAndSocket/Socket/api/deps/NetworkStatusTracker/NetworkStatusTracker.d.ts +0 -1
- package/dist/NetworkAndSocket/Socket/api/deps/WsApi/WsApi.d.ts +2 -2
- package/dist/NetworkAndSocket/Socket/api/deps/WsApi/WsApi.types.d.ts +2 -2
- package/dist/NetworkAndSocket/Socket/api/helpers/createRequestSocket/createRequestSocket.d.ts +2 -1
- package/dist/NetworkAndSocket/Socket/api/helpers/createRequestSocket/createRequestSocket.types.d.ts +3 -3
- package/dist/NetworkAndSocket/Socket/api/hooks/index.d.ts +1 -0
- package/dist/NetworkAndSocket/Socket/api/hooks/useRequestSocketApi/generators/generator1.d.ts +1 -0
- package/dist/NetworkAndSocket/Socket/api/hooks/useRequestSocketApi/generators/generator2.d.ts +1 -0
- package/dist/NetworkAndSocket/Socket/api/hooks/useRequestSocketApi/useRequestSocketApi.d.ts +11 -1
- package/dist/NetworkAndSocket/Socket/api/hooks/useRequestSocketApi/useRequestSocketApi.types.d.ts +9 -0
- package/dist/NetworkAndSocket/Socket/api/index.d.ts +2 -1
- package/dist/NetworkAndSocket/Socket/components/index.d.ts +2 -4
- package/dist/NetworkAndSocket/Socket/components/ui/CollapseCustom.d.ts +1 -2
- package/dist/NetworkAndSocket/Socket/store/socket.store.d.ts +1 -0
- package/dist/NetworkAndSocket/Socket/store/socket.types.d.ts +2 -0
- package/dist/socket.js +218 -190
- package/package.json +2 -2
- package/dist/NetworkAndSocket/index.d.ts +0 -2
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { NetworkInfo } from './deps/NetworkControls';
|
|
2
1
|
import { WsApi_Options_P } from './deps/WsApi';
|
|
3
2
|
import { WsApi_Events } from './deps/WsApi/WsApi.types';
|
|
4
|
-
import { SocketApi_Options_P, SocketApi_StateProps_P, SocketApiOptionsRequest } from './SocketApi.types';
|
|
3
|
+
import { BasePayloadSocket, SocketApi_Options_P, SocketApi_StateProps_P, SocketApiOptionsRequest } from './SocketApi.types';
|
|
4
|
+
import { NetworkStatusInfoTracker } from './deps/NetworkStatusTracker/NetworkStatusTracker.types';
|
|
5
5
|
interface SocketApi_Events {
|
|
6
6
|
timeOffReConnect(info: {
|
|
7
7
|
status: boolean;
|
|
8
8
|
msg: string;
|
|
9
9
|
}): void;
|
|
10
10
|
reConnect(status: boolean): void;
|
|
11
|
-
network(info:
|
|
11
|
+
network(info: NetworkStatusInfoTracker): void;
|
|
12
12
|
}
|
|
13
13
|
type CommonEvents = SocketApi_Events & WsApi_Events;
|
|
14
14
|
export declare class SocketApi {
|
|
15
|
-
#private;
|
|
16
15
|
private static state;
|
|
17
16
|
private static options;
|
|
18
17
|
private static wsApi;
|
|
@@ -47,7 +46,7 @@ export declare class SocketApi {
|
|
|
47
46
|
action: string;
|
|
48
47
|
[key: string]: any;
|
|
49
48
|
};
|
|
50
|
-
|
|
49
|
+
request_id: string;
|
|
51
50
|
cb: any;
|
|
52
51
|
}[];
|
|
53
52
|
static getStatusSocket: () => import('./deps/WsApi').WsApiE_StatusConnect_OR;
|
|
@@ -56,9 +55,9 @@ export declare class SocketApi {
|
|
|
56
55
|
static init: (options: WsApi_Options_P & SocketApi_Options_P) => void;
|
|
57
56
|
static connect(): Promise<void>;
|
|
58
57
|
static disconnect(): void;
|
|
59
|
-
static send<P
|
|
58
|
+
static send<P extends BasePayloadSocket, Data extends BasePayloadSocket>(payload: P, cb?: (data: Data) => void): void;
|
|
60
59
|
static stopReConnect(status?: boolean): void;
|
|
61
60
|
static socketReConnect: () => void;
|
|
62
|
-
static request<P
|
|
61
|
+
static request<P extends BasePayloadSocket, Data extends BasePayloadSocket>(payload: P, options?: SocketApiOptionsRequest): Promise<Data>;
|
|
63
62
|
}
|
|
64
63
|
export {};
|
|
@@ -4,13 +4,15 @@ export interface SocketApi_Options_P {
|
|
|
4
4
|
isReConnectNetworkOnline?: boolean;
|
|
5
5
|
listUrlsCheckConnectNetwork?: string[];
|
|
6
6
|
}
|
|
7
|
-
type SocketApi_StateProps_OR = 'isDisconnect' | 'isActiveReConnect' | 'isOfflineSocket' | '
|
|
7
|
+
type SocketApi_StateProps_OR = 'isDisconnect' | 'isActiveReConnect' | 'isOfflineSocket' | 'isGotWasFirstConnection' | 'isStartCheckNetwork';
|
|
8
8
|
export type SocketApi_StateProps_P = Record<SocketApi_StateProps_OR, boolean>;
|
|
9
9
|
export type SocketApi_StatusConnect_OR = WsApiE_StatusConnect_OR;
|
|
10
|
-
export
|
|
10
|
+
export type BasePayloadSocket = {
|
|
11
11
|
action: string;
|
|
12
|
+
request_id?: string;
|
|
13
|
+
} & {
|
|
12
14
|
[key: string]: any;
|
|
13
|
-
}
|
|
15
|
+
};
|
|
14
16
|
export type SocketResponse<P = any, Data = any> = WsApi_Response<P, Data>;
|
|
15
17
|
export interface SocketApiOptionsRequest {
|
|
16
18
|
timeout?: number;
|
|
@@ -27,7 +27,7 @@ export declare class WsApi {
|
|
|
27
27
|
action: string;
|
|
28
28
|
[key: string]: any;
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
request_id: string;
|
|
31
31
|
cb: any;
|
|
32
32
|
}[];
|
|
33
33
|
getOptions: () => WsApi_Options_P;
|
|
@@ -46,7 +46,7 @@ export declare class WsApi {
|
|
|
46
46
|
action: string;
|
|
47
47
|
[key: string]: any;
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
request_id: string;
|
|
50
50
|
cb: any;
|
|
51
51
|
};
|
|
52
52
|
}
|
|
@@ -16,7 +16,7 @@ export interface WsApi_RequestMeta<P> {
|
|
|
16
16
|
requestAction: string;
|
|
17
17
|
requestTime: number;
|
|
18
18
|
payload: P;
|
|
19
|
-
|
|
19
|
+
request_id: string;
|
|
20
20
|
}
|
|
21
21
|
export type WsApi_Response<P, D> = D & {
|
|
22
22
|
request: WsApi_RequestMeta<P>;
|
|
@@ -34,7 +34,7 @@ export interface WsApi_StateProps {
|
|
|
34
34
|
action: string;
|
|
35
35
|
[key: string]: any;
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
request_id: string;
|
|
38
38
|
cb: any;
|
|
39
39
|
}[];
|
|
40
40
|
}
|
package/dist/NetworkAndSocket/Socket/api/helpers/createRequestSocket/createRequestSocket.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { BasePayloadSocket } from './../../SocketApi.types';
|
|
1
2
|
import { CreateRequestSocketProps } from './createRequestSocket.types';
|
|
2
|
-
export declare const createRequestSocket: <ResponseSocket
|
|
3
|
+
export declare const createRequestSocket: <RequestSocket, ResponseSocket extends BasePayloadSocket & { [key in string]: any; }>(cb: (data: ResponseSocket) => void, { payload, signal }: CreateRequestSocketProps<RequestSocket>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useRequestSocketApi';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UseRequestSocketOptions } from './useRequestSocketApi.types';
|
|
2
|
-
|
|
2
|
+
import { BasePayloadSocket } from '../../SocketApi.types';
|
|
3
|
+
export declare const useRequestSocketApi: <P extends BasePayloadSocket, Data extends BasePayloadSocket>(payload: P, options?: UseRequestSocketOptions<Data>) => {
|
|
3
4
|
data: Data | null;
|
|
4
5
|
error: Error | null;
|
|
5
6
|
isLoading: boolean;
|
|
@@ -8,3 +9,12 @@ export declare const useRequestSocketApi: <P = any, Data = any>(keyRequest: stri
|
|
|
8
9
|
refetch: () => Promise<void>;
|
|
9
10
|
abort: () => void;
|
|
10
11
|
};
|
|
12
|
+
export declare const createRequestSocketApi: <P extends BasePayloadSocket, D extends BasePayloadSocket>(p: P, d?: UseRequestSocketOptions<D>) => {
|
|
13
|
+
data: D | null;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
isError: boolean;
|
|
17
|
+
isSuccess: boolean;
|
|
18
|
+
refetch: () => Promise<void>;
|
|
19
|
+
abort: () => void;
|
|
20
|
+
};
|
package/dist/NetworkAndSocket/Socket/api/hooks/useRequestSocketApi/useRequestSocketApi.types.d.ts
CHANGED
|
@@ -4,3 +4,12 @@ export interface UseRequestSocketOptions<Data = any> {
|
|
|
4
4
|
onSuccess?: (data: Data) => void;
|
|
5
5
|
onError?: (error: Error) => void;
|
|
6
6
|
}
|
|
7
|
+
export interface ResultUseRequestSocketApi<Data = any> {
|
|
8
|
+
data: Data | null;
|
|
9
|
+
error: Error | null;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
isError: boolean;
|
|
12
|
+
isSuccess: boolean;
|
|
13
|
+
refetch: () => Promise<void>;
|
|
14
|
+
abort: () => void;
|
|
15
|
+
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export * from './SocketApi';
|
|
2
|
-
export
|
|
2
|
+
export * from './hooks';
|
|
3
|
+
export { type SocketApi_StateProps_P, type SocketApi_StatusConnect_OR, type BasePayloadSocket } from './SocketApi.types';
|
|
@@ -2,14 +2,12 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { SocketConnectDetectionProps } from './ConnectDetection/ConnectDetection';
|
|
3
3
|
import { InitializationSocketProps } from './Initialization/Initialization';
|
|
4
4
|
import { SocketOfflineDetectionPayloadProps, SocketOfflineDetectionProps } from './OfflineDetection/OfflineDetection';
|
|
5
|
-
import { ReConnectButtonProps } from './Buttons/ReConnect';
|
|
6
|
-
import { OfflineButtonProps } from './Buttons/OfflineButton';
|
|
7
5
|
export declare const Socket: {
|
|
8
6
|
ConnectDetection: React.NamedExoticComponent<SocketConnectDetectionProps>;
|
|
9
7
|
OfflineDetection: React.NamedExoticComponent<SocketOfflineDetectionProps>;
|
|
10
8
|
Buttons: {
|
|
11
|
-
OfflineActive: React.NamedExoticComponent<OfflineButtonProps>;
|
|
12
|
-
ReConnect: React.NamedExoticComponent<ReConnectButtonProps>;
|
|
9
|
+
OfflineActive: React.NamedExoticComponent<import('./Buttons/OfflineButton').OfflineButtonProps>;
|
|
10
|
+
ReConnect: React.NamedExoticComponent<import('./Buttons/ReConnect').ReConnectButtonProps>;
|
|
13
11
|
};
|
|
14
12
|
Initialization: React.NamedExoticComponent<InitializationSocketProps>;
|
|
15
13
|
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { CollapseProps } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
export declare const SocketCollapse: import('@emotion/styled').StyledComponent<CollapseProps & import('@mui/system').MUIStyledCommonProps<Theme>, {}, {}>;
|
|
2
|
+
export declare const SocketCollapse: import('@emotion/styled').StyledComponent<CollapseProps & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
|
|
@@ -4,6 +4,7 @@ export declare const socketActions: SocketActions;
|
|
|
4
4
|
export declare const socketSelectors: {
|
|
5
5
|
getStatusConnectSocket: (state: InitialStatePropsSocket) => "ready" | "close" | "error" | "pending" | "disconnect";
|
|
6
6
|
getStatusIsReConnectSocket: (state: InitialStatePropsSocket) => boolean;
|
|
7
|
+
getStatusReady: (state: InitialStatePropsSocket) => boolean;
|
|
7
8
|
getIsOfflineSocket: (state: InitialStatePropsSocket) => boolean;
|
|
8
9
|
getInfoNoConnectServer: (state: InitialStatePropsSocket) => {
|
|
9
10
|
isModal: boolean;
|
|
@@ -4,6 +4,7 @@ export interface InitialStatePropsSocket {
|
|
|
4
4
|
isReConnectSocket: boolean;
|
|
5
5
|
isOfflineSocket: boolean;
|
|
6
6
|
isDisableConnectSocket: boolean;
|
|
7
|
+
isReadySocket: boolean;
|
|
7
8
|
infoNoConnectServer: {
|
|
8
9
|
isModal: boolean;
|
|
9
10
|
isSelectOffline: boolean;
|
|
@@ -13,6 +14,7 @@ export interface SocketActions {
|
|
|
13
14
|
resetState: () => void;
|
|
14
15
|
setStatusConnectSocket: (payload: Pick<InitialStatePropsSocket, 'statusConnect'>) => void;
|
|
15
16
|
setStatusIsReConnectSocket: (payload: Pick<InitialStatePropsSocket, 'isReConnectSocket'>) => void;
|
|
17
|
+
setStatusReady: (payload: Pick<InitialStatePropsSocket, 'isReadySocket'>) => void;
|
|
16
18
|
setIsOfflineSocket: (payload: Pick<InitialStatePropsSocket, 'isOfflineSocket'>) => void;
|
|
17
19
|
setInfoNoConnectServer: (payload: Partial<InitialStatePropsSocket['infoNoConnectServer']>) => void;
|
|
18
20
|
setIsDisableConnectSocket: (payload: Pick<InitialStatePropsSocket, 'isDisableConnectSocket'>) => void;
|
package/dist/socket.js
CHANGED
|
@@ -1,69 +1,68 @@
|
|
|
1
|
-
import './socket.css';var
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import b, { useEffect as I, useCallback as x } from "react";
|
|
10
|
-
import { styled as y, Collapse as H } from "@mui/material";
|
|
11
|
-
import T from "classnames";
|
|
12
|
-
const D = (o) => {
|
|
1
|
+
import './socket.css';var z = Object.defineProperty;
|
|
2
|
+
var G = (o, t, e) => t in o ? z(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var r = (o, t, e) => G(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { jsx as M } from "react/jsx-runtime";
|
|
5
|
+
import w, { useState as O, useRef as $, useCallback as A, useEffect as E } from "react";
|
|
6
|
+
import { styled as x, Collapse as V } from "@mui/material";
|
|
7
|
+
import U from "classnames";
|
|
8
|
+
const T = (o) => {
|
|
13
9
|
let t;
|
|
14
|
-
const e = /* @__PURE__ */ new Set(), n = (u,
|
|
10
|
+
const e = /* @__PURE__ */ new Set(), n = (u, d) => {
|
|
15
11
|
const f = typeof u == "function" ? u(t) : u;
|
|
16
12
|
if (!Object.is(f, t)) {
|
|
17
|
-
const
|
|
18
|
-
t =
|
|
13
|
+
const h = t;
|
|
14
|
+
t = d ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((g) => g(t, h));
|
|
19
15
|
}
|
|
20
|
-
}, i = () => t,
|
|
21
|
-
return
|
|
22
|
-
},
|
|
23
|
-
function
|
|
24
|
-
const e =
|
|
16
|
+
}, i = () => t, l = { setState: n, getState: i, getInitialState: () => S, subscribe: (u) => (e.add(u), () => e.delete(u)) }, S = t = o(n, i, l);
|
|
17
|
+
return l;
|
|
18
|
+
}, K = (o) => o ? T(o) : T, Q = (o) => o;
|
|
19
|
+
function X(o, t = Q) {
|
|
20
|
+
const e = w.useSyncExternalStore(
|
|
25
21
|
o.subscribe,
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
w.useCallback(() => t(o.getState()), [o, t]),
|
|
23
|
+
w.useCallback(() => t(o.getInitialState()), [o, t])
|
|
28
24
|
);
|
|
29
|
-
return
|
|
25
|
+
return w.useDebugValue(e), e;
|
|
30
26
|
}
|
|
31
|
-
const
|
|
32
|
-
const t =
|
|
27
|
+
const W = (o) => {
|
|
28
|
+
const t = K(o), e = (n) => X(t, n);
|
|
33
29
|
return Object.assign(e, t), e;
|
|
34
|
-
},
|
|
30
|
+
}, Y = (o) => o ? W(o) : W, P = {
|
|
35
31
|
statusConnect: "disconnect",
|
|
36
32
|
isOfflineSocket: !1,
|
|
37
33
|
//Текущее состояние сокета. Зависит от события timeOffReConnect и если задаёться isDisableConnectSocket: true
|
|
38
|
-
isDisableConnectSocket: !1,
|
|
39
34
|
isReConnectSocket: !1,
|
|
35
|
+
isDisableConnectSocket: !1,
|
|
36
|
+
isReadySocket: !1,
|
|
40
37
|
infoNoConnectServer: {
|
|
41
38
|
isModal: !1,
|
|
42
39
|
isSelectOffline: !1
|
|
43
40
|
//Для того что бы 2й раз окно не показывать
|
|
44
41
|
}
|
|
45
|
-
},
|
|
46
|
-
resetState: () =>
|
|
47
|
-
setStatusConnectSocket: ({ statusConnect: o }) =>
|
|
48
|
-
setStatusIsReConnectSocket: ({ isReConnectSocket: o }) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
}, Z = JSON.parse(JSON.stringify(P)), b = Y(() => P), C = {
|
|
43
|
+
resetState: () => b.setState(Z),
|
|
44
|
+
setStatusConnectSocket: ({ statusConnect: o }) => b.setState({ statusConnect: o }),
|
|
45
|
+
setStatusIsReConnectSocket: ({ isReConnectSocket: o }) => b.setState({ isReConnectSocket: o }),
|
|
46
|
+
setStatusReady: ({ isReadySocket: o }) => b.setState({ isReadySocket: o }),
|
|
47
|
+
setIsOfflineSocket: ({ isOfflineSocket: o }) => b.setState({ isOfflineSocket: o }),
|
|
48
|
+
setInfoNoConnectServer: (o) => b.setState((t) => ({ infoNoConnectServer: { ...t.infoNoConnectServer, ...o } })),
|
|
49
|
+
setIsDisableConnectSocket: ({ isDisableConnectSocket: o }) => b.setState({ isDisableConnectSocket: o })
|
|
52
50
|
}, m = {
|
|
53
51
|
getStatusConnectSocket: (o) => o.statusConnect,
|
|
54
52
|
getStatusIsReConnectSocket: (o) => o.isReConnectSocket,
|
|
53
|
+
getStatusReady: (o) => o.isReadySocket,
|
|
55
54
|
getIsOfflineSocket: (o) => o.isOfflineSocket,
|
|
56
55
|
getInfoNoConnectServer: (o) => o.infoNoConnectServer,
|
|
57
56
|
getIsDisableConnectSocket: (o) => o.isDisableConnectSocket
|
|
58
|
-
},
|
|
57
|
+
}, R = (o) => b(o), _ = x("span")({
|
|
59
58
|
backgroundColor: "rgba(0,0,0,0.3)",
|
|
60
59
|
color: "#fff",
|
|
61
60
|
display: "flex",
|
|
62
61
|
alignItems: "center",
|
|
63
62
|
padding: "1px 10px",
|
|
64
63
|
borderRadius: "3px 3px 3px 3px"
|
|
65
|
-
}),
|
|
66
|
-
({ children: o, ...t }) => /* @__PURE__ */
|
|
64
|
+
}), F = x(
|
|
65
|
+
({ children: o, ...t }) => /* @__PURE__ */ M(V, { ...t, unmountOnExit: !0, children: /* @__PURE__ */ M(_, { children: o }) })
|
|
67
66
|
)(({ theme: o }) => ({
|
|
68
67
|
fontSize: 10,
|
|
69
68
|
position: "absolute",
|
|
@@ -80,12 +79,12 @@ const M = (o) => {
|
|
|
80
79
|
color: "#151616",
|
|
81
80
|
letterSpacing: 1
|
|
82
81
|
}
|
|
83
|
-
})),
|
|
82
|
+
})), tt = "_connect-server-anim_1lp7f_1", et = "_loading-stripes_1lp7f_1", st = {
|
|
84
83
|
"connect-server-anim": "_connect-server-anim_1lp7f_1",
|
|
85
|
-
connectServerAnim:
|
|
84
|
+
connectServerAnim: tt,
|
|
86
85
|
"loading-stripes": "_loading-stripes_1lp7f_1",
|
|
87
|
-
loadingStripes:
|
|
88
|
-
},
|
|
86
|
+
loadingStripes: et
|
|
87
|
+
}, nt = x(F, {
|
|
89
88
|
shouldForwardProp: (o) => ![""].includes(o)
|
|
90
89
|
})(({ theme: o }) => ({
|
|
91
90
|
top: "100%",
|
|
@@ -95,29 +94,29 @@ const M = (o) => {
|
|
|
95
94
|
"& span": {
|
|
96
95
|
height: "100%"
|
|
97
96
|
}
|
|
98
|
-
})),
|
|
99
|
-
const i =
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
|
|
97
|
+
})), ot = ({ text: o = "Происходит подключение к серверу", className: t, ...e }) => {
|
|
98
|
+
const i = R(m.getStatusConnectSocket) === "pending";
|
|
99
|
+
return /* @__PURE__ */ M(
|
|
100
|
+
nt,
|
|
102
101
|
{
|
|
103
102
|
in: i,
|
|
104
103
|
collapsedSize: "1px",
|
|
105
|
-
className:
|
|
104
|
+
className: U(st["connect-server-anim"], t),
|
|
106
105
|
unmountOnExit: !0,
|
|
107
106
|
...e,
|
|
108
107
|
children: o
|
|
109
108
|
}
|
|
110
109
|
);
|
|
111
|
-
},
|
|
112
|
-
function
|
|
113
|
-
return
|
|
110
|
+
}, it = w.memo(ot), rt = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
111
|
+
function ct(o) {
|
|
112
|
+
return rt.test(o);
|
|
114
113
|
}
|
|
115
|
-
function
|
|
114
|
+
function L() {
|
|
116
115
|
var o = URL.createObjectURL(new Blob()), t = o.toString();
|
|
117
116
|
return URL.revokeObjectURL(o), t.split(/[:\/]/g).pop().toLowerCase();
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
class
|
|
118
|
+
L.valid = ct;
|
|
119
|
+
class at {
|
|
121
120
|
constructor() {
|
|
122
121
|
r(this, "defaultProps", {
|
|
123
122
|
interval: 5e3
|
|
@@ -128,25 +127,25 @@ class st {
|
|
|
128
127
|
}, i = (f) => {
|
|
129
128
|
e != null && e.controlAction && (e == null || e.controlAction(f));
|
|
130
129
|
};
|
|
131
|
-
let c = !0,
|
|
130
|
+
let c = !0, a, l, S;
|
|
132
131
|
const u = (f = !0) => {
|
|
133
|
-
const
|
|
134
|
-
c = !1, clearInterval(
|
|
132
|
+
const h = "Ручное завершение startActionEvery";
|
|
133
|
+
c = !1, clearInterval(a), n(null), f ? l && l({ status: f, msg: h + ": (true)" }) : S && S({ status: f, msg: h + ": (false)" });
|
|
135
134
|
};
|
|
136
135
|
return {
|
|
137
|
-
promise: new Promise((f,
|
|
138
|
-
|
|
139
|
-
let
|
|
140
|
-
|
|
136
|
+
promise: new Promise((f, h) => {
|
|
137
|
+
l = f, S = h;
|
|
138
|
+
let g = 0, v = 0;
|
|
139
|
+
a = setInterval(
|
|
141
140
|
() => {
|
|
142
|
-
if (
|
|
143
|
-
c = !1, clearInterval(
|
|
141
|
+
if (g += e.interval, v += 1, e != null && e.cutoffTime && g > e.cutoffTime || e != null && e.countAction && (e == null ? void 0 : e.countAction) < v) {
|
|
142
|
+
c = !1, clearInterval(a), n(null), h({ status: !1, msg: Error("Время загрузки истекло") });
|
|
144
143
|
return;
|
|
145
144
|
}
|
|
146
|
-
t() && (c = !1, clearInterval(
|
|
145
|
+
t() && (c = !1, clearInterval(a), n(null), f({ status: !0, msg: "cb вернул true" }));
|
|
147
146
|
},
|
|
148
147
|
e.interval < 200 ? 200 : e.interval
|
|
149
|
-
), n(
|
|
148
|
+
), n(a), i({
|
|
150
149
|
getIsActiveEvent: () => c,
|
|
151
150
|
stop: u
|
|
152
151
|
});
|
|
@@ -164,16 +163,16 @@ class st {
|
|
|
164
163
|
}, n * 1e3);
|
|
165
164
|
});
|
|
166
165
|
r(this, "oneOfPromise", (t, e, { second: n }) => new Promise((i, c) => {
|
|
167
|
-
let
|
|
166
|
+
let a = 1, l = { status: !1, msg: "" };
|
|
168
167
|
t().then((u) => {
|
|
169
|
-
|
|
168
|
+
a === 1 && (a = 0, i(u));
|
|
170
169
|
}).catch((u) => {
|
|
171
|
-
|
|
170
|
+
a === 1 && (a = 0, l.msg = u, c(u));
|
|
172
171
|
});
|
|
173
172
|
let S = setInterval(() => {
|
|
174
|
-
if (
|
|
175
|
-
if (
|
|
176
|
-
c({ status: !1, msg: "", ...e(
|
|
173
|
+
if (a === 1) {
|
|
174
|
+
if (a = 0, typeof e == "function") {
|
|
175
|
+
c({ status: !1, msg: "", ...e(l) });
|
|
177
176
|
return;
|
|
178
177
|
}
|
|
179
178
|
c({ status: !1, msg: "oneOfPromise reject" });
|
|
@@ -183,7 +182,7 @@ class st {
|
|
|
183
182
|
}));
|
|
184
183
|
}
|
|
185
184
|
}
|
|
186
|
-
class
|
|
185
|
+
class H {
|
|
187
186
|
constructor(t) {
|
|
188
187
|
r(this, "subscribersEvents", {});
|
|
189
188
|
r(this, "getListNameEvents", () => Object.keys(this.subscribersEvents));
|
|
@@ -204,7 +203,7 @@ class W {
|
|
|
204
203
|
});
|
|
205
204
|
r(this, "resetSubscribers", () => {
|
|
206
205
|
const t = Object.entries(this.subscribersEvents);
|
|
207
|
-
for (const [e
|
|
206
|
+
for (const [e] of t)
|
|
208
207
|
this.subscribersEvents[e] = [];
|
|
209
208
|
});
|
|
210
209
|
t.forEach((e) => {
|
|
@@ -212,7 +211,7 @@ class W {
|
|
|
212
211
|
});
|
|
213
212
|
}
|
|
214
213
|
}
|
|
215
|
-
class
|
|
214
|
+
class lt {
|
|
216
215
|
constructor(t) {
|
|
217
216
|
r(this, "networkInfo");
|
|
218
217
|
r(this, "listUrls", []);
|
|
@@ -221,16 +220,6 @@ class nt {
|
|
|
221
220
|
isMonitoring: !1,
|
|
222
221
|
checkIntervalId: null
|
|
223
222
|
});
|
|
224
|
-
r(this, "getFetchOptions", (t) => ({
|
|
225
|
-
method: "HEAD",
|
|
226
|
-
cache: "no-store",
|
|
227
|
-
signal: t.signal,
|
|
228
|
-
headers: {
|
|
229
|
-
"Cache-Control": "no-cache, no-store, must-revalidate",
|
|
230
|
-
Pragma: "no-cache",
|
|
231
|
-
Expires: "0"
|
|
232
|
-
}
|
|
233
|
-
}));
|
|
234
223
|
r(this, "getIsNetwork", (t) => !["unknown", "none"].includes(t));
|
|
235
224
|
r(this, "getTypeNetwork", ({ effectiveType: t, type: e }, n) => (n || n === null) && (t || e) || "none");
|
|
236
225
|
/*-----------------------------------------------------------------------------*/
|
|
@@ -257,6 +246,16 @@ class nt {
|
|
|
257
246
|
getState() {
|
|
258
247
|
return this.state;
|
|
259
248
|
}
|
|
249
|
+
// private getFetchOptions = (controller: AbortController) => ({
|
|
250
|
+
// method: 'HEAD',
|
|
251
|
+
// cache: 'no-store',
|
|
252
|
+
// signal: controller.signal,
|
|
253
|
+
// headers: {
|
|
254
|
+
// 'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
255
|
+
// 'Pragma': 'no-cache',
|
|
256
|
+
// 'Expires': '0'
|
|
257
|
+
// }
|
|
258
|
+
// } as const);
|
|
260
259
|
getConnection() {
|
|
261
260
|
var t;
|
|
262
261
|
return (t = window == null ? void 0 : window.navigator) == null ? void 0 : t.connection;
|
|
@@ -275,7 +274,7 @@ class nt {
|
|
|
275
274
|
this.controllersEvents = { ...this.controllersEvents, ...t };
|
|
276
275
|
}
|
|
277
276
|
startEvents(t) {
|
|
278
|
-
var
|
|
277
|
+
var l, S, u, d;
|
|
279
278
|
const { isActiveEvents: e } = this.getState();
|
|
280
279
|
if (e)
|
|
281
280
|
return;
|
|
@@ -286,15 +285,15 @@ class nt {
|
|
|
286
285
|
change: new AbortController()
|
|
287
286
|
};
|
|
288
287
|
this.setControllersEvents(n);
|
|
289
|
-
const i = this.getConnection(), c = this.getTypeNetwork(i, window.navigator.onLine),
|
|
290
|
-
this.updateState(
|
|
288
|
+
const i = this.getConnection(), c = this.getTypeNetwork(i, window.navigator.onLine), a = this.getIsNetwork(c);
|
|
289
|
+
this.updateState(a, t), window.addEventListener("online", () => {
|
|
291
290
|
this.updateState(!0, t);
|
|
292
|
-
}, { signal: (
|
|
291
|
+
}, { signal: (l = n.online) == null ? void 0 : l.signal }), window.addEventListener("offline", () => {
|
|
293
292
|
this.updateState(!1, t);
|
|
294
293
|
}, { signal: (S = n.offline) == null ? void 0 : S.signal }), (u = this.getConnection()) != null && u.addEventListener && this.getConnection().addEventListener("change", () => {
|
|
295
|
-
const f = this.getConnection(),
|
|
296
|
-
this.updateState(
|
|
297
|
-
}, { signal: (
|
|
294
|
+
const f = this.getConnection(), h = this.getTypeNetwork(f, null), g = this.getIsNetwork(h);
|
|
295
|
+
this.updateState(g, t);
|
|
296
|
+
}, { signal: (d = n.change) == null ? void 0 : d.signal });
|
|
298
297
|
}
|
|
299
298
|
stopEvents() {
|
|
300
299
|
const { isActiveEvents: t } = this.getState();
|
|
@@ -363,7 +362,7 @@ class nt {
|
|
|
363
362
|
return this.networkInfo;
|
|
364
363
|
}
|
|
365
364
|
}
|
|
366
|
-
class
|
|
365
|
+
class ut {
|
|
367
366
|
constructor() {
|
|
368
367
|
r(this, "options", {
|
|
369
368
|
timeReConnect: 5e3,
|
|
@@ -376,7 +375,7 @@ class ot {
|
|
|
376
375
|
arrSaveReq: []
|
|
377
376
|
});
|
|
378
377
|
r(this, "initOptions", !1);
|
|
379
|
-
r(this, "events", new
|
|
378
|
+
r(this, "events", new H(["status", "msg", "error"]));
|
|
380
379
|
r(this, "stateDefault", this.copyState(this.state));
|
|
381
380
|
r(this, "eventListener", (t) => {
|
|
382
381
|
var n, i;
|
|
@@ -387,8 +386,8 @@ class ot {
|
|
|
387
386
|
["error", this.errHandler]
|
|
388
387
|
];
|
|
389
388
|
for (let c = 0; c < e.length; c++) {
|
|
390
|
-
const [
|
|
391
|
-
t === "add" ? (n = this.state.ws) == null || n.addEventListener(
|
|
389
|
+
const [a, l] = e[c];
|
|
390
|
+
t === "add" ? (n = this.state.ws) == null || n.addEventListener(a, l) : (i = this.state.ws) == null || i.removeEventListener(a, l);
|
|
392
391
|
}
|
|
393
392
|
});
|
|
394
393
|
r(this, "openHandler", () => {
|
|
@@ -402,8 +401,8 @@ class ot {
|
|
|
402
401
|
try {
|
|
403
402
|
const { action: n } = e, i = this.findDataRequestByAction(n);
|
|
404
403
|
if (i) {
|
|
405
|
-
const { cb: c, ...
|
|
406
|
-
this.events.publish("msg", { ...e, request: { ...S, ...
|
|
404
|
+
const { cb: c, ...a } = i, { payload: l, ...S } = a;
|
|
405
|
+
this.events.publish("msg", { ...e, request: { ...S, ...l } });
|
|
407
406
|
} else
|
|
408
407
|
this.events.publish("msg", e);
|
|
409
408
|
n && this.filterSaveItemsByResponse(e);
|
|
@@ -490,7 +489,6 @@ class ot {
|
|
|
490
489
|
});
|
|
491
490
|
}
|
|
492
491
|
}
|
|
493
|
-
var E, it;
|
|
494
492
|
const s = class s {
|
|
495
493
|
static copyState(t) {
|
|
496
494
|
return JSON.parse(JSON.stringify(t));
|
|
@@ -514,17 +512,17 @@ const s = class s {
|
|
|
514
512
|
s.state.isDisconnect || (s.setState({ isDisconnect: !0 }), console.log("DISCONNECT WS"), s.wsApi.disconnect(), s.resetState(), s.events.resetSubscribers());
|
|
515
513
|
}
|
|
516
514
|
static send(t, e) {
|
|
517
|
-
const { action: n, ...i } = t, c =
|
|
515
|
+
const { action: n, ...i } = t, c = i != null && i.request_id ? i.request_id : L(), a = Date.now();
|
|
518
516
|
s.wsApi.setRequestSave({
|
|
519
517
|
requestAction: n,
|
|
520
|
-
|
|
521
|
-
requestTime:
|
|
518
|
+
request_id: c,
|
|
519
|
+
requestTime: a,
|
|
522
520
|
payload: { action: n, ...i },
|
|
523
521
|
cb: e
|
|
524
522
|
});
|
|
525
|
-
const
|
|
526
|
-
if (!
|
|
527
|
-
console.log("Нет подключения к
|
|
523
|
+
const l = s.wsApi.getSocket();
|
|
524
|
+
if (!l || l.readyState !== 1) {
|
|
525
|
+
console.log("Нет подключения к сокету. Запрос сохранён в getRequestSave");
|
|
528
526
|
return;
|
|
529
527
|
}
|
|
530
528
|
s.wsApi.send(t);
|
|
@@ -532,58 +530,58 @@ const s = class s {
|
|
|
532
530
|
static stopReConnect(t) {
|
|
533
531
|
console.dir("функция stop не присвоена к stopReConnect");
|
|
534
532
|
}
|
|
535
|
-
static async request(t, e
|
|
536
|
-
return new Promise((
|
|
537
|
-
var
|
|
538
|
-
if ((
|
|
539
|
-
|
|
533
|
+
static async request(t, e = {}) {
|
|
534
|
+
return new Promise((n, i) => {
|
|
535
|
+
var h, g;
|
|
536
|
+
if ((h = e == null ? void 0 : e.signal) != null && h.aborted) {
|
|
537
|
+
i(new DOMException("Aborted", "AbortError"));
|
|
540
538
|
return;
|
|
541
539
|
}
|
|
542
|
-
const
|
|
540
|
+
const c = t.action, a = t.request_id ? t.request_id : L(), l = Date.now();
|
|
543
541
|
s.wsApi.setRequestSave({
|
|
544
|
-
requestAction:
|
|
545
|
-
|
|
546
|
-
requestTime:
|
|
547
|
-
payload:
|
|
542
|
+
requestAction: c,
|
|
543
|
+
request_id: a,
|
|
544
|
+
requestTime: l,
|
|
545
|
+
payload: t,
|
|
548
546
|
cb: void 0
|
|
549
547
|
});
|
|
550
548
|
let S;
|
|
551
|
-
|
|
552
|
-
s.off("msg",
|
|
553
|
-
},
|
|
554
|
-
const u = (
|
|
555
|
-
s.off("msg",
|
|
556
|
-
},
|
|
557
|
-
var
|
|
558
|
-
const
|
|
559
|
-
((
|
|
549
|
+
e != null && e.timeout && (S = setTimeout(() => {
|
|
550
|
+
s.off("msg", d), s.off("error", u), i(new Error("Request timeout"));
|
|
551
|
+
}, e == null ? void 0 : e.timeout));
|
|
552
|
+
const u = (v) => {
|
|
553
|
+
s.off("msg", d), s.off("error", u), i(v);
|
|
554
|
+
}, d = (v) => {
|
|
555
|
+
var y;
|
|
556
|
+
const N = this.wsApi.findDataRequestByAction(c);
|
|
557
|
+
((y = v == null ? void 0 : v.request) == null ? void 0 : y.requestAction) === N.requestAction && (s.off("msg", d), s.off("error", u), n({ ...v }));
|
|
560
558
|
};
|
|
561
|
-
s.on("msg",
|
|
559
|
+
s.on("msg", d), s.on("error", u), (g = e == null ? void 0 : e.signal) == null || g.addEventListener("abort", () => {
|
|
562
560
|
debugger;
|
|
563
|
-
S && clearTimeout(S), s.off("msg",
|
|
561
|
+
S && clearTimeout(S), s.off("msg", d), s.off("error", u), i(new DOMException("Aborted", "AbortError"));
|
|
564
562
|
});
|
|
565
563
|
const f = s.wsApi.getSocket();
|
|
566
564
|
if (!f || f.readyState !== 1) {
|
|
567
|
-
|
|
565
|
+
const v = "Нет подключения к сокету";
|
|
566
|
+
console.error(v), i(new Error(v));
|
|
568
567
|
return;
|
|
569
568
|
}
|
|
570
|
-
s.wsApi.send(
|
|
569
|
+
s.wsApi.send(t);
|
|
571
570
|
});
|
|
572
571
|
}
|
|
573
572
|
};
|
|
574
|
-
|
|
575
|
-
}, q(s, E), r(s, "state", {
|
|
573
|
+
r(s, "state", {
|
|
576
574
|
isDisconnect: !0,
|
|
577
575
|
isActiveReConnect: !1,
|
|
578
576
|
isOfflineSocket: !0,
|
|
579
|
-
isReady: !1,
|
|
580
577
|
isGotWasFirstConnection: !1,
|
|
581
578
|
isStartCheckNetwork: !1
|
|
579
|
+
//не используеться
|
|
582
580
|
}), r(s, "options", {
|
|
583
581
|
isReConnectNetworkOnline: !1,
|
|
584
582
|
listUrlsCheckConnectNetwork: ["https://jsonplaceholder.typicode.com/posts/1"]
|
|
585
|
-
}), r(s, "wsApi", new
|
|
586
|
-
r(s, "networkTicker", null), r(s, "events", new
|
|
583
|
+
}), r(s, "wsApi", new ut()), r(s, "delay", new at()), // private static internetControl:NetworkControls | null = null
|
|
584
|
+
r(s, "networkTicker", null), r(s, "events", new H(["timeOffReConnect", "reConnect", "network"])), r(s, "saveID", {
|
|
587
585
|
idReConnect: null,
|
|
588
586
|
checkConnect: null
|
|
589
587
|
}), r(s, "stateDefault", s.copyState(s.state)), r(s, "setInfoConnect", (t) => {
|
|
@@ -610,63 +608,91 @@ r(s, "setNetworkStatus", (t) => {
|
|
|
610
608
|
s.events.publish("network", t), t.isNetwork ? s.online() : s.offline();
|
|
611
609
|
}), r(s, "init", (t) => {
|
|
612
610
|
const { WsOptions: e, SocketApiOptions: n } = s.splitOptions(t);
|
|
613
|
-
s.networkTicker = new
|
|
611
|
+
s.networkTicker = new lt(n.listUrlsCheckConnectNetwork ?? []), s.networkTicker.startEvents((i) => {
|
|
614
612
|
s.setNetworkStatus(i);
|
|
615
613
|
}), s.setOptions(n), s.wsApi.init(e);
|
|
616
614
|
}), /*------------------------------------------------------------------------------------------------------*/
|
|
617
615
|
r(s, "socketReConnect", () => {
|
|
618
616
|
if (s.wsApi.getIsInitWS())
|
|
619
|
-
if (console.log("
|
|
617
|
+
if (console.log("reConnect"), s.saveID.idReConnect)
|
|
620
618
|
console.groupCollapsed("Процесс socketReConnect уже запущен"), console.log("SocketApi.saveID: ", s.saveID), console.groupEnd();
|
|
621
619
|
else {
|
|
622
620
|
s.setStatusReConnect(!0), s.connect();
|
|
623
|
-
const { timeReConnect: t, numberOfRepit: e } = s.wsApi.getOptions();
|
|
621
|
+
const { timeReConnect: t, numberOfRepit: e } = s.wsApi.getOptions(), i = e && e > 1 ? e - 1 : 3;
|
|
624
622
|
s.delay.startActionEvery(
|
|
625
623
|
() => (console.log("reconnect:>>delay"), s.wsApi.getStatusSocket() === "ready" ? (console.dir("Подключение установлено"), !0) : (s.connect(), !1)),
|
|
626
624
|
{
|
|
627
625
|
interval: t,
|
|
628
|
-
countAction:
|
|
629
|
-
watchIdInterval: (
|
|
630
|
-
s.saveID.idReConnect =
|
|
626
|
+
countAction: i,
|
|
627
|
+
watchIdInterval: (a) => {
|
|
628
|
+
s.saveID.idReConnect = a;
|
|
631
629
|
},
|
|
632
|
-
controlAction: ({ stop:
|
|
633
|
-
s.stopReConnect =
|
|
630
|
+
controlAction: ({ stop: a, getIsActiveEvent: l }) => {
|
|
631
|
+
s.stopReConnect = a;
|
|
634
632
|
}
|
|
635
633
|
}
|
|
636
|
-
).promise.then((
|
|
637
|
-
s.setInfoConnect(
|
|
638
|
-
}).catch((
|
|
639
|
-
s.setInfoConnect(
|
|
634
|
+
).promise.then((a) => {
|
|
635
|
+
s.setInfoConnect(a);
|
|
636
|
+
}).catch((a) => {
|
|
637
|
+
s.setInfoConnect(a);
|
|
640
638
|
});
|
|
641
639
|
}
|
|
642
640
|
});
|
|
643
|
-
let
|
|
644
|
-
const
|
|
645
|
-
const {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
641
|
+
let p = s;
|
|
642
|
+
const ft = (o, t = {}) => {
|
|
643
|
+
const e = o.action, { skip: n = !1, timeout: i = 5e3, onSuccess: c, onError: a } = t, [l, S] = O(null), [u, d] = O(null), [f, h] = O(!1), [g, v] = O(!1), [N, y] = O(!1), k = $(null), q = A(async () => {
|
|
644
|
+
if (n) return;
|
|
645
|
+
h(!0), v(!1), y(!1), d(null), S(null), k.current = new AbortController();
|
|
646
|
+
const D = k.current.signal;
|
|
647
|
+
try {
|
|
648
|
+
const I = await p.request(
|
|
649
|
+
o,
|
|
650
|
+
{ timeout: i, signal: D }
|
|
651
|
+
);
|
|
652
|
+
if (D.aborted) return;
|
|
653
|
+
S(I), y(!0), c == null || c(I);
|
|
654
|
+
} catch (I) {
|
|
655
|
+
if (D.aborted) return;
|
|
656
|
+
const B = I instanceof Error ? I : new Error(String(I));
|
|
657
|
+
d(B), v(!0), a == null || a(B);
|
|
658
|
+
} finally {
|
|
659
|
+
D.aborted || h(!1);
|
|
660
|
+
}
|
|
661
|
+
}, [n, e, o, i, c, a]);
|
|
662
|
+
E(() => (n || q(), () => {
|
|
663
|
+
k.current && k.current.abort();
|
|
664
|
+
}), [q, n]);
|
|
665
|
+
const j = A(() => (k.current && k.current.abort(), q()), [q]), J = A(() => {
|
|
666
|
+
k.current && (k.current.abort(), h(!1));
|
|
667
|
+
}, []);
|
|
668
|
+
return { data: l, error: u, isLoading: f, isError: g, isSuccess: N, refetch: j, abort: J };
|
|
669
|
+
}, Ot = (o, t) => ft(o, t), St = (o) => {
|
|
670
|
+
const { isNetwork: t, typeNetwork: e } = o, { isModal: n } = R(m.getInfoNoConnectServer), i = R(m.getStatusIsReConnectSocket), c = R(m.getIsDisableConnectSocket), a = R(m.getStatusConnectSocket);
|
|
671
|
+
return E(() => (p.init(o.init), typeof o.onMount == "function" && o.onMount(), p.on("status", (l) => {
|
|
672
|
+
const S = b.getState(), { isReadySocket: u } = S;
|
|
673
|
+
l !== "ready" && u && C.setStatusReady({ isReadySocket: !1 }), !u && l === "ready" && C.setStatusReady({ isReadySocket: !0 }), C.setStatusConnectSocket({ statusConnect: l });
|
|
674
|
+
}), p.on("error", (l) => {
|
|
675
|
+
console.log("error: ", l);
|
|
676
|
+
}), p.on("reConnect", (l) => {
|
|
677
|
+
console.log('on"reConnect" (status): ', l);
|
|
678
|
+
const S = b.getState(), { isReConnectSocket: u, infoNoConnectServer: { isModal: d } } = S;
|
|
679
|
+
u !== l && C.setStatusIsReConnectSocket({ isReConnectSocket: l }), d && l && C.setInfoNoConnectServer({ isModal: !1 });
|
|
680
|
+
}), p.on("timeOffReConnect", (l) => {
|
|
681
|
+
if (console.log("timeOffReConnect: ", l), C.setIsOfflineSocket({ isOfflineSocket: !l.status }), !l.status) {
|
|
682
|
+
const S = b.getState(), { infoNoConnectServer: { isModal: u, isSelectOffline: d } } = S;
|
|
657
683
|
let f = !1;
|
|
658
|
-
!u && !
|
|
684
|
+
!u && !d && (f = !0), f && C.setInfoNoConnectServer({ isModal: f });
|
|
659
685
|
}
|
|
660
|
-
}),
|
|
661
|
-
typeof o.onUnmount == "function" && o.onUnmount(), console.dir("disconnect"),
|
|
662
|
-
}), []),
|
|
663
|
-
t && !c && !n && !i && ["close"].includes(
|
|
664
|
-
}, [c, n, i,
|
|
665
|
-
i && (!t ||
|
|
666
|
-
}, [i, t,
|
|
667
|
-
c && (console.log("isDisableConnectSocket: ", c),
|
|
686
|
+
}), p.connect(), () => {
|
|
687
|
+
typeof o.onUnmount == "function" && o.onUnmount(), console.dir("disconnect"), p.disconnect();
|
|
688
|
+
}), []), E(() => {
|
|
689
|
+
t && !c && !n && !i && ["close"].includes(a) && e !== "none" && (console.log("Запущен socketReConnect"), p.socketReConnect());
|
|
690
|
+
}, [c, n, i, a, e, t]), E(() => {
|
|
691
|
+
i && (!t || a === "ready") && (console.log("Запущен stopReConnect"), p.stopReConnect());
|
|
692
|
+
}, [i, t, a]), E(() => {
|
|
693
|
+
c && (console.log("isDisableConnectSocket: ", c), C.setIsOfflineSocket({ isOfflineSocket: !0 }), p.close());
|
|
668
694
|
}, [c]), null;
|
|
669
|
-
},
|
|
695
|
+
}, dt = w.memo(St), ht = x(F, {
|
|
670
696
|
shouldForwardProp: (o) => ![""].includes(o)
|
|
671
697
|
})(({ theme: o }) => ({
|
|
672
698
|
bottom: "100%",
|
|
@@ -676,41 +702,43 @@ const rt = (o) => {
|
|
|
676
702
|
"& span": {
|
|
677
703
|
padding: "1px 10px"
|
|
678
704
|
}
|
|
679
|
-
})),
|
|
680
|
-
const i =
|
|
681
|
-
return /* @__PURE__ */
|
|
682
|
-
|
|
705
|
+
})), vt = ({ children: o, className: t, isNetwork: e, ...n }) => {
|
|
706
|
+
const i = R(m.getIsOfflineSocket), c = R(m.getIsDisableConnectSocket), a = i || !e, l = "Оффлайн";
|
|
707
|
+
return /* @__PURE__ */ M(
|
|
708
|
+
ht,
|
|
683
709
|
{
|
|
684
|
-
in:
|
|
685
|
-
className:
|
|
710
|
+
in: a,
|
|
711
|
+
className: U("socket-offline", t),
|
|
686
712
|
...n,
|
|
687
|
-
children: typeof o == "function" ? o({ isDisableConnectSocket: c }) : c ? `Режим ${
|
|
713
|
+
children: typeof o == "function" ? o({ isDisableConnectSocket: c }) : c ? `Режим ${l}` : l
|
|
688
714
|
}
|
|
689
715
|
);
|
|
690
|
-
},
|
|
691
|
-
const t =
|
|
692
|
-
|
|
716
|
+
}, pt = w.memo(vt), gt = ({ children: o }) => {
|
|
717
|
+
const t = A(() => {
|
|
718
|
+
C.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !1 });
|
|
693
719
|
}, []);
|
|
694
720
|
return o({ reConnect: t });
|
|
695
|
-
},
|
|
696
|
-
const t =
|
|
697
|
-
|
|
721
|
+
}, Ct = w.memo(gt), bt = ({ children: o }) => {
|
|
722
|
+
const t = A(() => {
|
|
723
|
+
C.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !0 }), C.setIsDisableConnectSocket({ isDisableConnectSocket: !0 });
|
|
698
724
|
}, []);
|
|
699
725
|
return o({ offlineActive: t });
|
|
700
|
-
},
|
|
701
|
-
ConnectDetection:
|
|
702
|
-
OfflineDetection:
|
|
726
|
+
}, wt = w.memo(bt), Et = {
|
|
727
|
+
ConnectDetection: it,
|
|
728
|
+
OfflineDetection: pt,
|
|
703
729
|
Buttons: {
|
|
704
|
-
OfflineActive:
|
|
705
|
-
ReConnect:
|
|
730
|
+
OfflineActive: wt,
|
|
731
|
+
ReConnect: Ct
|
|
706
732
|
},
|
|
707
|
-
Initialization:
|
|
733
|
+
Initialization: dt
|
|
708
734
|
};
|
|
709
735
|
export {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
736
|
+
Et as Socket,
|
|
737
|
+
p as SocketApi,
|
|
738
|
+
Ot as createRequestSocketApi,
|
|
739
|
+
C as socketActions,
|
|
713
740
|
m as socketSelectors,
|
|
714
|
-
|
|
715
|
-
|
|
741
|
+
b as socketStore,
|
|
742
|
+
ft as useRequestSocketApi,
|
|
743
|
+
R as useSocketSelector
|
|
716
744
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rc-lib-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.46",
|
|
5
5
|
"author": "SinGlEBW",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
42
|
"dev": "vite",
|
|
43
|
-
"build": "tsc && vite build",
|
|
43
|
+
"build": "tsc --project tsconfig.prod.json && vite build",
|
|
44
44
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
45
45
|
"preview": "vite preview",
|
|
46
46
|
"send": "node publishVersion.js"
|