quidproquo-web-react 0.0.232 → 0.0.234
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/lib/commonjs/api/hooks/index.d.ts +1 -1
- package/lib/commonjs/api/hooks/index.js +1 -1
- package/lib/commonjs/api/hooks/useAuthenticatedNetworkRequest.js +1 -1
- package/lib/commonjs/auth/hooks/index.d.ts +3 -3
- package/lib/commonjs/auth/hooks/index.js +1 -1
- package/lib/commonjs/auth/types/AuthState.d.ts +1 -1
- package/lib/commonjs/baseUrl/index.d.ts +1 -1
- package/lib/commonjs/baseUrl/index.js +1 -1
- package/lib/commonjs/hooks/index.d.ts +3 -3
- package/lib/commonjs/hooks/index.js +3 -3
- package/lib/commonjs/hooks/useAsyncEffect.js +0 -2
- package/lib/commonjs/hooks/useFastCallback.js +1 -0
- package/lib/commonjs/index.d.ts +3 -3
- package/lib/commonjs/index.js +3 -3
- package/lib/commonjs/websocket/WebSocketAuthSync/WebSocketAuthSync.js +0 -1
- package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.js +7 -7
- package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.js +1 -1
- package/lib/commonjs/websocket/WebsocketProvider.js +1 -1
- package/lib/commonjs/websocket/hooks/useSubscribeToWebsocket.d.ts +1 -1
- package/lib/commonjs/websocket/hooks/useWebsocketSendEvent.js +1 -1
- package/lib/esm/api/hooks/index.d.ts +1 -1
- package/lib/esm/api/hooks/index.js +1 -1
- package/lib/esm/api/hooks/useAuthenticatedNetworkRequest.js +1 -1
- package/lib/esm/auth/hooks/index.d.ts +3 -3
- package/lib/esm/auth/hooks/index.js +3 -3
- package/lib/esm/auth/hooks/useIsLoggedIn.js +2 -2
- package/lib/esm/auth/types/AuthState.d.ts +1 -1
- package/lib/esm/baseUrl/index.d.ts +1 -1
- package/lib/esm/baseUrl/index.js +1 -1
- package/lib/esm/hooks/index.d.ts +3 -3
- package/lib/esm/hooks/index.js +3 -3
- package/lib/esm/hooks/useAsyncEffect.js +0 -2
- package/lib/esm/hooks/useFastCallback.js +2 -1
- package/lib/esm/hooks/useRunEvery.js +1 -1
- package/lib/esm/hooks/useThrottledMemo.js +1 -1
- package/lib/esm/index.d.ts +3 -3
- package/lib/esm/index.js +3 -3
- package/lib/esm/websocket/WebSocketAuthSync/WebSocketAuthSync.js +0 -1
- package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.js +2 -2
- package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.js +1 -1
- package/lib/esm/websocket/WebsocketProvider.js +1 -1
- package/lib/esm/websocket/hooks/useSubscribeToWebsocket.d.ts +1 -1
- package/lib/esm/websocket/hooks/useWebsocketSendEvent.js +1 -1
- package/package.json +9 -6
|
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./useNetworkRequest"), exports);
|
|
18
17
|
__exportStar(require("./useAuthenticatedNetworkRequest"), exports);
|
|
18
|
+
__exportStar(require("./useNetworkRequest"), exports);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAuthenticatedNetworkRequest = void 0;
|
|
4
4
|
const quidproquo_web_1 = require("quidproquo-web");
|
|
5
|
-
const hooks_1 = require("../../hooks");
|
|
6
5
|
const auth_1 = require("../../auth");
|
|
6
|
+
const hooks_1 = require("../../hooks");
|
|
7
7
|
const useAuthenticatedNetworkRequest = (payload) => {
|
|
8
8
|
const authToken = (0, auth_1.useAuthAccessToken)();
|
|
9
9
|
const payloadWithAuthHeaders = authToken
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './useAuthAccessToken';
|
|
2
|
+
export * from './useIsLoggedIn';
|
|
3
|
+
export * from './useRefreshTokens';
|
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./useIsLoggedIn"), exports);
|
|
18
17
|
__exportStar(require("./useAuthAccessToken"), exports);
|
|
18
|
+
__exportStar(require("./useIsLoggedIn"), exports);
|
|
19
19
|
__exportStar(require("./useRefreshTokens"), exports);
|
|
@@ -15,5 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./BaseUrlProvider"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
18
|
__exportStar(require("./hooks"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./useThrottledMemo"), exports);
|
|
18
|
-
__exportStar(require("./useRunEvery"), exports);
|
|
19
|
-
__exportStar(require("./useFastCallback"), exports);
|
|
20
17
|
__exportStar(require("./useAsyncEffect"), exports);
|
|
18
|
+
__exportStar(require("./useFastCallback"), exports);
|
|
19
|
+
__exportStar(require("./useRunEvery"), exports);
|
|
20
|
+
__exportStar(require("./useThrottledMemo"), exports);
|
|
@@ -19,7 +19,6 @@ const useAsyncEffect = (effect, deps) => {
|
|
|
19
19
|
return yield effect(() => mountStatus.mounted);
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
22
|
console.error('Error in useAsyncEffect:', error);
|
|
24
23
|
}
|
|
25
24
|
});
|
|
@@ -32,7 +31,6 @@ const useAsyncEffect = (effect, deps) => {
|
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
33
|
};
|
|
35
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
34
|
}, deps);
|
|
37
35
|
};
|
|
38
36
|
exports.useAsyncEffect = useAsyncEffect;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useFastCallback = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
5
6
|
function useFastCallback(callback, deps) {
|
|
6
7
|
const callbackRef = (0, react_1.useRef)(callback);
|
|
7
8
|
const depsRef = (0, react_1.useRef)(deps);
|
package/lib/commonjs/index.d.ts
CHANGED
package/lib/commonjs/index.js
CHANGED
|
@@ -15,8 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api"), exports);
|
|
18
|
-
__exportStar(require("./websocket"), exports);
|
|
19
|
-
__exportStar(require("./hooks"), exports);
|
|
20
18
|
__exportStar(require("./auth"), exports);
|
|
21
|
-
__exportStar(require("./state"), exports);
|
|
22
19
|
__exportStar(require("./baseUrl"), exports);
|
|
20
|
+
__exportStar(require("./hooks"), exports);
|
|
21
|
+
__exportStar(require("./state"), exports);
|
|
22
|
+
__exportStar(require("./websocket"), exports);
|
|
@@ -9,7 +9,6 @@ const component = ({ children, accessToken }) => {
|
|
|
9
9
|
// Keep the active websocket alive
|
|
10
10
|
(0, hooks_1.useWebsocketPingPong)();
|
|
11
11
|
// This fragment is not useless!
|
|
12
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
13
12
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
14
13
|
};
|
|
15
14
|
exports.WebSocketAuthSync = (0, react_1.memo)(component);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useWebsocketAuthSync = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
4
|
const quidproquo_web_1 = require("quidproquo-web");
|
|
6
5
|
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const hooks_1 = require("../../../hooks");
|
|
8
|
+
const hooks_2 = require("../../hooks");
|
|
9
9
|
const useWebsocketAuthSync = (accessToken) => {
|
|
10
|
-
const sendMessage = (0,
|
|
11
|
-
const websocketApi = (0,
|
|
12
|
-
const updateAuthTokens = (0,
|
|
10
|
+
const sendMessage = (0, hooks_2.useWebsocketSendEvent)();
|
|
11
|
+
const websocketApi = (0, hooks_2.useWebsocketApi)();
|
|
12
|
+
const updateAuthTokens = (0, hooks_1.useFastCallback)(() => {
|
|
13
13
|
if (!(websocketApi === null || websocketApi === void 0 ? void 0 : websocketApi.isConnected())) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -30,7 +30,7 @@ const useWebsocketAuthSync = (accessToken) => {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
// Sync the tokens in on open
|
|
33
|
-
(0,
|
|
33
|
+
(0, hooks_2.useSubscribeToWebsocket)(quidproquo_web_1.WebsocketServiceEvent.OPEN, updateAuthTokens);
|
|
34
34
|
// Sync the tokens when they change
|
|
35
35
|
(0, react_1.useEffect)(updateAuthTokens, [accessToken, websocketApi]);
|
|
36
36
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useWebsocketPingPong = void 0;
|
|
4
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
4
5
|
const react_1 = require("react");
|
|
5
6
|
const hooks_1 = require("../../hooks");
|
|
6
|
-
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
7
7
|
const useWebsocketPingPong = () => {
|
|
8
8
|
const sendMessage = (0, hooks_1.useWebsocketSendEvent)();
|
|
9
9
|
(0, react_1.useEffect)(() => {
|
|
@@ -6,6 +6,6 @@ const hooks_1 = require("./hooks");
|
|
|
6
6
|
const WebsocketContext_1 = require("./WebsocketContext");
|
|
7
7
|
const WebsocketProvider = ({ children, wsUrl }) => {
|
|
8
8
|
const websocketManagement = (0, hooks_1.useWebsocketManagement)(wsUrl);
|
|
9
|
-
return (
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(WebsocketContext_1.WebSocketContext.Provider, Object.assign({ value: websocketManagement }, { children: children }));
|
|
10
10
|
};
|
|
11
11
|
exports.WebsocketProvider = WebsocketProvider;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WebsocketServiceEvent, WebSocketServiceSubscriptionFunction } from 'quidproquo-web';
|
|
2
2
|
export declare const useSubscribeToWebsocket: (subscriptionType: WebsocketServiceEvent, callback: WebSocketServiceSubscriptionFunction) => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useWebsocketSendEvent = void 0;
|
|
4
|
-
const useWebsocketApi_1 = require("./useWebsocketApi");
|
|
5
4
|
const hooks_1 = require("../../hooks");
|
|
5
|
+
const useWebsocketApi_1 = require("./useWebsocketApi");
|
|
6
6
|
const useWebsocketSendEvent = () => {
|
|
7
7
|
const websocketApi = (0, useWebsocketApi_1.useWebsocketApi)();
|
|
8
8
|
const sendMessage = (0, hooks_1.useFastCallback)((event) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { preformNetworkRequest } from 'quidproquo-web';
|
|
2
|
-
import { useFastCallback } from '../../hooks';
|
|
3
2
|
import { useAuthAccessToken } from '../../auth';
|
|
3
|
+
import { useFastCallback } from '../../hooks';
|
|
4
4
|
export const useAuthenticatedNetworkRequest = (payload) => {
|
|
5
5
|
const authToken = useAuthAccessToken();
|
|
6
6
|
const payloadWithAuthHeaders = authToken
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './useAuthAccessToken';
|
|
2
|
+
export * from './useIsLoggedIn';
|
|
3
|
+
export * from './useRefreshTokens';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './useAuthAccessToken';
|
|
2
|
+
export * from './useIsLoggedIn';
|
|
3
|
+
export * from './useRefreshTokens';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useContext } from
|
|
2
|
-
import { authContext } from
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { authContext } from '../authContext';
|
|
3
3
|
export const useIsLoggedIn = () => {
|
|
4
4
|
const authState = useContext(authContext);
|
|
5
5
|
return !!authState.authenticationInfo?.accessToken;
|
package/lib/esm/baseUrl/index.js
CHANGED
package/lib/esm/hooks/index.d.ts
CHANGED
package/lib/esm/hooks/index.js
CHANGED
|
@@ -7,7 +7,6 @@ export const useAsyncEffect = (effect, deps) => {
|
|
|
7
7
|
return await effect(() => mountStatus.mounted);
|
|
8
8
|
}
|
|
9
9
|
catch (error) {
|
|
10
|
-
// eslint-disable-next-line no-console
|
|
11
10
|
console.error('Error in useAsyncEffect:', error);
|
|
12
11
|
}
|
|
13
12
|
};
|
|
@@ -20,6 +19,5 @@ export const useAsyncEffect = (effect, deps) => {
|
|
|
20
19
|
}
|
|
21
20
|
});
|
|
22
21
|
};
|
|
23
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
22
|
}, deps);
|
|
25
23
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
2
3
|
export function useFastCallback(callback, deps) {
|
|
3
4
|
const callbackRef = useRef(callback);
|
|
4
5
|
const depsRef = useRef(deps);
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
|
@@ -6,7 +6,6 @@ const component = ({ children, accessToken }) => {
|
|
|
6
6
|
// Keep the active websocket alive
|
|
7
7
|
useWebsocketPingPong();
|
|
8
8
|
// This fragment is not useless!
|
|
9
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
10
9
|
return _jsx(_Fragment, { children: children });
|
|
11
10
|
};
|
|
12
11
|
export const WebSocketAuthSync = memo(component);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
1
|
import { WebsocketServiceEvent } from 'quidproquo-web';
|
|
3
2
|
import { WebsocketClientMessageEventType, } from 'quidproquo-webserver';
|
|
4
|
-
import {
|
|
3
|
+
import { useEffect } from 'react';
|
|
5
4
|
import { useFastCallback } from '../../../hooks';
|
|
5
|
+
import { useSubscribeToWebsocket, useWebsocketApi, useWebsocketSendEvent } from '../../hooks';
|
|
6
6
|
export const useWebsocketAuthSync = (accessToken) => {
|
|
7
7
|
const sendMessage = useWebsocketSendEvent();
|
|
8
8
|
const websocketApi = useWebsocketApi();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { WebsocketClientMessageEventType } from 'quidproquo-webserver';
|
|
1
2
|
import { useEffect } from 'react';
|
|
2
3
|
import { useWebsocketSendEvent } from '../../hooks';
|
|
3
|
-
import { WebsocketClientMessageEventType, } from 'quidproquo-webserver';
|
|
4
4
|
export const useWebsocketPingPong = () => {
|
|
5
5
|
const sendMessage = useWebsocketSendEvent();
|
|
6
6
|
useEffect(() => {
|
|
@@ -3,5 +3,5 @@ import { useWebsocketManagement } from './hooks';
|
|
|
3
3
|
import { WebSocketContext } from './WebsocketContext';
|
|
4
4
|
export const WebsocketProvider = ({ children, wsUrl }) => {
|
|
5
5
|
const websocketManagement = useWebsocketManagement(wsUrl);
|
|
6
|
-
return
|
|
6
|
+
return _jsx(WebSocketContext.Provider, { value: websocketManagement, children: children });
|
|
7
7
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WebsocketServiceEvent, WebSocketServiceSubscriptionFunction } from 'quidproquo-web';
|
|
2
2
|
export declare const useSubscribeToWebsocket: (subscriptionType: WebsocketServiceEvent, callback: WebSocketServiceSubscriptionFunction) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useWebsocketApi } from './useWebsocketApi';
|
|
2
1
|
import { useFastCallback } from '../../hooks';
|
|
2
|
+
import { useWebsocketApi } from './useWebsocketApi';
|
|
3
3
|
export const useWebsocketSendEvent = () => {
|
|
4
4
|
const websocketApi = useWebsocketApi();
|
|
5
5
|
const sendMessage = useFastCallback((event) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-web-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.234",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"build": "npm run clean && npm run build:esm && npm run build:cjs",
|
|
16
16
|
"watch": "tsc -p tsconfig.esm.json -w",
|
|
17
17
|
"build:cjs": "tsc -p tsconfig.commonjs.json",
|
|
18
|
-
"build:esm": "tsc -p tsconfig.esm.json"
|
|
18
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
19
|
+
"lint": "npx eslint .",
|
|
20
|
+
"lint:fix": "npx eslint . --fix",
|
|
21
|
+
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
|
|
19
22
|
},
|
|
20
23
|
"repository": {
|
|
21
24
|
"type": "git",
|
|
@@ -29,10 +32,10 @@
|
|
|
29
32
|
},
|
|
30
33
|
"homepage": "https://github.com/joe-coady/quidproquo#readme",
|
|
31
34
|
"devDependencies": {
|
|
32
|
-
"quidproquo-core": "0.0.
|
|
33
|
-
"quidproquo-tsconfig": "0.0.
|
|
34
|
-
"quidproquo-webserver": "0.0.
|
|
35
|
-
"quidproquo-web": "0.0.
|
|
35
|
+
"quidproquo-core": "0.0.234",
|
|
36
|
+
"quidproquo-tsconfig": "0.0.234",
|
|
37
|
+
"quidproquo-webserver": "0.0.234",
|
|
38
|
+
"quidproquo-web": "0.0.234",
|
|
36
39
|
"typescript": "^4.9.3"
|
|
37
40
|
},
|
|
38
41
|
"peerDependencies": {
|