quidproquo-web-react 0.0.253 → 0.0.255
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 +2 -2
- package/lib/commonjs/api/hooks/index.js +18 -18
- package/lib/commonjs/api/hooks/useAuthenticatedNetworkRequest.d.ts +2 -2
- package/lib/commonjs/api/hooks/useAuthenticatedNetworkRequest.js +14 -14
- package/lib/commonjs/api/hooks/useNetworkRequest.d.ts +2 -2
- package/lib/commonjs/api/hooks/useNetworkRequest.js +10 -10
- package/lib/commonjs/api/index.d.ts +1 -1
- package/lib/commonjs/api/index.js +17 -17
- package/lib/commonjs/auth/RefreshAuthTokensProvider.d.ts +7 -8
- package/lib/commonjs/auth/RefreshAuthTokensProvider.js +12 -12
- package/lib/commonjs/auth/authContext.d.ts +2 -3
- package/lib/commonjs/auth/authContext.js +8 -8
- package/lib/commonjs/auth/hooks/index.d.ts +3 -3
- package/lib/commonjs/auth/hooks/index.js +19 -19
- package/lib/commonjs/auth/hooks/useAuthAccessToken.d.ts +1 -1
- package/lib/commonjs/auth/hooks/useAuthAccessToken.js +12 -12
- package/lib/commonjs/auth/hooks/useIsLoggedIn.d.ts +1 -1
- package/lib/commonjs/auth/hooks/useIsLoggedIn.js +9 -9
- package/lib/commonjs/auth/hooks/useRefreshTokens.d.ts +2 -2
- package/lib/commonjs/auth/hooks/useRefreshTokens.js +35 -35
- package/lib/commonjs/auth/index.d.ts +4 -4
- package/lib/commonjs/auth/index.js +20 -20
- package/lib/commonjs/auth/types/AuthState.d.ts +8 -8
- package/lib/commonjs/auth/types/AuthState.js +2 -2
- package/lib/commonjs/auth/types/index.d.ts +1 -1
- package/lib/commonjs/auth/types/index.js +17 -17
- package/lib/commonjs/baseUrl/BaseUrlContext.d.ts +2 -3
- package/lib/commonjs/baseUrl/BaseUrlContext.js +9 -9
- package/lib/commonjs/baseUrl/BaseUrlProvider.d.ts +6 -7
- package/lib/commonjs/baseUrl/BaseUrlProvider.js +9 -9
- package/lib/commonjs/baseUrl/hooks/index.d.ts +1 -1
- package/lib/commonjs/baseUrl/hooks/index.js +17 -17
- package/lib/commonjs/baseUrl/hooks/useBaseUrlResolvers.d.ts +2 -2
- package/lib/commonjs/baseUrl/hooks/useBaseUrlResolvers.js +10 -10
- package/lib/commonjs/baseUrl/index.d.ts +3 -3
- package/lib/commonjs/baseUrl/index.js +19 -19
- package/lib/commonjs/baseUrl/types/BaseUrlResolver.d.ts +6 -6
- package/lib/commonjs/baseUrl/types/BaseUrlResolver.js +2 -2
- package/lib/commonjs/baseUrl/types/index.d.ts +1 -1
- package/lib/commonjs/baseUrl/types/index.js +17 -17
- package/lib/commonjs/hooks/asmj/QpqContextProvider.d.ts +10 -10
- package/lib/commonjs/hooks/asmj/QpqContextProvider.js +20 -20
- package/lib/commonjs/hooks/asmj/QpqMappedApi.d.ts +6 -6
- package/lib/commonjs/hooks/asmj/QpqMappedApi.js +2 -2
- package/lib/commonjs/hooks/asmj/QpqRuntimeEffectCatcher.d.ts +16 -16
- package/lib/commonjs/hooks/asmj/QpqRuntimeEffectCatcher.js +35 -35
- package/lib/commonjs/hooks/asmj/actionProcessor/getStateDispatchActionProcessor.d.ts +3 -3
- package/lib/commonjs/hooks/asmj/actionProcessor/getStateDispatchActionProcessor.js +23 -23
- package/lib/commonjs/hooks/asmj/actionProcessor/getStateReadActionProcessor.d.ts +2 -2
- package/lib/commonjs/hooks/asmj/actionProcessor/getStateReadActionProcessor.js +22 -22
- package/lib/commonjs/hooks/asmj/actionProcessor/index.d.ts +3 -3
- package/lib/commonjs/hooks/asmj/actionProcessor/index.js +18 -18
- package/lib/commonjs/hooks/asmj/createQpqRuntimeDefinition.d.ts +22 -16
- package/lib/commonjs/hooks/asmj/createQpqRuntimeDefinition.js +52 -39
- package/lib/commonjs/hooks/asmj/index.d.ts +6 -6
- package/lib/commonjs/hooks/asmj/index.js +22 -22
- package/lib/commonjs/hooks/asmj/useQpqRuntime.d.ts +4 -4
- package/lib/commonjs/hooks/asmj/useQpqRuntime.js +35 -36
- package/lib/commonjs/hooks/index.d.ts +8 -8
- package/lib/commonjs/hooks/index.js +24 -24
- package/lib/commonjs/hooks/useAsyncEffect.d.ts +2 -2
- package/lib/commonjs/hooks/useAsyncEffect.js +36 -36
- package/lib/commonjs/hooks/useFastCallback.d.ts +2 -2
- package/lib/commonjs/hooks/useFastCallback.js +19 -20
- package/lib/commonjs/hooks/useMetadata/index.d.ts +1 -1
- package/lib/commonjs/hooks/useMetadata/index.js +17 -17
- package/lib/commonjs/hooks/useMetadata/useMetadata.d.ts +5 -5
- package/lib/commonjs/hooks/useMetadata/useMetadata.js +14 -15
- package/lib/commonjs/hooks/useOnKeyDownEffect.d.ts +1 -1
- package/lib/commonjs/hooks/useOnKeyDownEffect.js +22 -23
- package/lib/commonjs/hooks/useQpq.d.ts +2 -2
- package/lib/commonjs/hooks/useQpq.js +45 -44
- package/lib/commonjs/hooks/useRunEvery.d.ts +1 -1
- package/lib/commonjs/hooks/useRunEvery.js +21 -22
- package/lib/commonjs/hooks/useThrottledMemo.d.ts +1 -1
- package/lib/commonjs/hooks/useThrottledMemo.js +31 -32
- package/lib/commonjs/index.d.ts +10 -8
- package/lib/commonjs/index.js +26 -24
- package/lib/commonjs/state/index.d.ts +1 -1
- package/lib/commonjs/state/index.js +17 -17
- package/lib/commonjs/state/useStateUpdater.d.ts +3 -4
- package/lib/commonjs/state/useStateUpdater.js +12 -12
- package/lib/commonjs/useFieldBinding/index.d.ts +1 -0
- package/lib/commonjs/useFieldBinding/index.js +17 -0
- package/lib/commonjs/useFieldBinding/useFieldBinding.d.ts +2 -0
- package/lib/commonjs/useFieldBinding/useFieldBinding.js +21 -0
- package/lib/commonjs/useSharedQueryParams/index.d.ts +2 -0
- package/lib/commonjs/useSharedQueryParams/index.js +18 -0
- package/lib/commonjs/useSharedQueryParams/logic/index.d.ts +4 -0
- package/lib/commonjs/useSharedQueryParams/logic/index.js +20 -0
- package/lib/commonjs/useSharedQueryParams/logic/runtime/askSetParam.d.ts +2 -0
- package/lib/commonjs/useSharedQueryParams/logic/runtime/askSetParam.js +9 -0
- package/lib/commonjs/useSharedQueryParams/logic/runtime/askSyncParams.d.ts +2 -0
- package/lib/commonjs/useSharedQueryParams/logic/runtime/askSyncParams.js +11 -0
- package/lib/commonjs/useSharedQueryParams/logic/runtime/index.d.ts +2 -0
- package/lib/commonjs/useSharedQueryParams/logic/runtime/index.js +18 -0
- package/lib/commonjs/useSharedQueryParams/logic/runtime/sharedQueryParamsLogic.d.ts +4 -0
- package/lib/commonjs/useSharedQueryParams/logic/runtime/sharedQueryParamsLogic.js +7 -0
- package/lib/commonjs/useSharedQueryParams/logic/sharedQueryParamsActionCreator.d.ts +2 -0
- package/lib/commonjs/useSharedQueryParams/logic/sharedQueryParamsActionCreator.js +11 -0
- package/lib/commonjs/useSharedQueryParams/logic/sharedQueryParamsReducer.d.ts +3 -0
- package/lib/commonjs/useSharedQueryParams/logic/sharedQueryParamsReducer.js +13 -0
- package/lib/commonjs/useSharedQueryParams/logic/sharedQueryParamsTypes.d.ts +10 -0
- package/lib/commonjs/useSharedQueryParams/logic/sharedQueryParamsTypes.js +7 -0
- package/lib/commonjs/useSharedQueryParams/sharedQueryParamsRuntime.d.ts +3 -0
- package/lib/commonjs/useSharedQueryParams/sharedQueryParamsRuntime.js +7 -0
- package/lib/commonjs/webSocketQueue/hooks/index.d.ts +2 -2
- package/lib/commonjs/webSocketQueue/hooks/index.js +18 -18
- package/lib/commonjs/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.d.ts +3 -3
- package/lib/commonjs/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.js +8 -8
- package/lib/commonjs/webSocketQueue/hooks/useWebsocketQueueSendEvent.d.ts +2 -2
- package/lib/commonjs/webSocketQueue/hooks/useWebsocketQueueSendEvent.js +9 -9
- package/lib/commonjs/webSocketQueue/index.d.ts +1 -1
- package/lib/commonjs/webSocketQueue/index.js +17 -17
- package/lib/commonjs/websocket/WebSocketAuthSync/WebSocketAuthSync.d.ts +6 -7
- package/lib/commonjs/websocket/WebSocketAuthSync/WebSocketAuthSync.js +14 -14
- package/lib/commonjs/websocket/WebSocketAuthSync/hooks/index.d.ts +2 -2
- package/lib/commonjs/websocket/WebSocketAuthSync/hooks/index.js +18 -18
- package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.d.ts +2 -2
- package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.js +37 -37
- package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.d.ts +1 -1
- package/lib/commonjs/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.js +16 -16
- package/lib/commonjs/websocket/WebSocketAuthSync/index.d.ts +1 -1
- package/lib/commonjs/websocket/WebSocketAuthSync/index.js +17 -17
- package/lib/commonjs/websocket/WebsocketContext.d.ts +2 -3
- package/lib/commonjs/websocket/WebsocketContext.js +5 -5
- package/lib/commonjs/websocket/WebsocketProvider.d.ts +5 -6
- package/lib/commonjs/websocket/WebsocketProvider.js +11 -11
- package/lib/commonjs/websocket/hooks/index.d.ts +5 -5
- package/lib/commonjs/websocket/hooks/index.js +21 -21
- package/lib/commonjs/websocket/hooks/useSubscribeToWebSocketEvent.d.ts +3 -3
- package/lib/commonjs/websocket/hooks/useSubscribeToWebSocketEvent.js +17 -17
- package/lib/commonjs/websocket/hooks/useSubscribeToWebsocket.d.ts +2 -2
- package/lib/commonjs/websocket/hooks/useSubscribeToWebsocket.js +17 -17
- package/lib/commonjs/websocket/hooks/useWebsocketApi.d.ts +1 -1
- package/lib/commonjs/websocket/hooks/useWebsocketApi.js +10 -10
- package/lib/commonjs/websocket/hooks/useWebsocketManagement.d.ts +2 -2
- package/lib/commonjs/websocket/hooks/useWebsocketManagement.js +17 -17
- package/lib/commonjs/websocket/hooks/useWebsocketSendEvent.d.ts +2 -2
- package/lib/commonjs/websocket/hooks/useWebsocketSendEvent.js +15 -15
- package/lib/commonjs/websocket/index.d.ts +3 -3
- package/lib/commonjs/websocket/index.js +19 -19
- package/lib/esm/api/hooks/index.d.ts +2 -2
- package/lib/esm/api/hooks/index.js +2 -2
- package/lib/esm/api/hooks/useAuthenticatedNetworkRequest.d.ts +2 -2
- package/lib/esm/api/hooks/useAuthenticatedNetworkRequest.js +17 -17
- package/lib/esm/api/hooks/useNetworkRequest.d.ts +2 -2
- package/lib/esm/api/hooks/useNetworkRequest.js +6 -6
- package/lib/esm/api/index.d.ts +1 -1
- package/lib/esm/api/index.js +1 -1
- package/lib/esm/auth/RefreshAuthTokensProvider.d.ts +7 -8
- package/lib/esm/auth/RefreshAuthTokensProvider.js +9 -9
- package/lib/esm/auth/authContext.d.ts +2 -3
- package/lib/esm/auth/authContext.js +5 -5
- package/lib/esm/auth/hooks/index.d.ts +3 -3
- package/lib/esm/auth/hooks/index.js +3 -3
- package/lib/esm/auth/hooks/useAuthAccessToken.d.ts +1 -1
- package/lib/esm/auth/hooks/useAuthAccessToken.js +7 -7
- package/lib/esm/auth/hooks/useIsLoggedIn.d.ts +1 -1
- package/lib/esm/auth/hooks/useIsLoggedIn.js +5 -5
- package/lib/esm/auth/hooks/useRefreshTokens.d.ts +2 -2
- package/lib/esm/auth/hooks/useRefreshTokens.js +31 -31
- package/lib/esm/auth/index.d.ts +4 -4
- package/lib/esm/auth/index.js +4 -4
- package/lib/esm/auth/types/AuthState.d.ts +8 -8
- package/lib/esm/auth/types/AuthState.js +1 -1
- package/lib/esm/auth/types/index.d.ts +1 -1
- package/lib/esm/auth/types/index.js +1 -1
- package/lib/esm/baseUrl/BaseUrlContext.d.ts +2 -3
- package/lib/esm/baseUrl/BaseUrlContext.js +6 -6
- package/lib/esm/baseUrl/BaseUrlProvider.d.ts +6 -7
- package/lib/esm/baseUrl/BaseUrlProvider.js +5 -5
- package/lib/esm/baseUrl/hooks/index.d.ts +1 -1
- package/lib/esm/baseUrl/hooks/index.js +1 -1
- package/lib/esm/baseUrl/hooks/useBaseUrlResolvers.d.ts +2 -2
- package/lib/esm/baseUrl/hooks/useBaseUrlResolvers.js +6 -6
- package/lib/esm/baseUrl/index.d.ts +3 -3
- package/lib/esm/baseUrl/index.js +3 -3
- package/lib/esm/baseUrl/types/BaseUrlResolver.d.ts +6 -6
- package/lib/esm/baseUrl/types/BaseUrlResolver.js +1 -1
- package/lib/esm/baseUrl/types/index.d.ts +1 -1
- package/lib/esm/baseUrl/types/index.js +1 -1
- package/lib/esm/hooks/asmj/QpqContextProvider.d.ts +10 -10
- package/lib/esm/hooks/asmj/QpqContextProvider.js +15 -15
- package/lib/esm/hooks/asmj/QpqMappedApi.d.ts +6 -6
- package/lib/esm/hooks/asmj/QpqMappedApi.js +1 -1
- package/lib/esm/hooks/asmj/QpqRuntimeEffectCatcher.d.ts +16 -16
- package/lib/esm/hooks/asmj/QpqRuntimeEffectCatcher.js +30 -30
- package/lib/esm/hooks/asmj/actionProcessor/getStateDispatchActionProcessor.d.ts +3 -3
- package/lib/esm/hooks/asmj/actionProcessor/getStateDispatchActionProcessor.js +8 -8
- package/lib/esm/hooks/asmj/actionProcessor/getStateReadActionProcessor.d.ts +2 -2
- package/lib/esm/hooks/asmj/actionProcessor/getStateReadActionProcessor.js +7 -7
- package/lib/esm/hooks/asmj/actionProcessor/index.d.ts +3 -3
- package/lib/esm/hooks/asmj/actionProcessor/index.js +6 -6
- package/lib/esm/hooks/asmj/createQpqRuntimeDefinition.d.ts +22 -16
- package/lib/esm/hooks/asmj/createQpqRuntimeDefinition.js +46 -34
- package/lib/esm/hooks/asmj/index.d.ts +6 -6
- package/lib/esm/hooks/asmj/index.js +6 -6
- package/lib/esm/hooks/asmj/useQpqRuntime.d.ts +4 -4
- package/lib/esm/hooks/asmj/useQpqRuntime.js +32 -32
- package/lib/esm/hooks/index.d.ts +8 -8
- package/lib/esm/hooks/index.js +8 -8
- package/lib/esm/hooks/useAsyncEffect.d.ts +2 -2
- package/lib/esm/hooks/useAsyncEffect.js +23 -23
- package/lib/esm/hooks/useFastCallback.d.ts +2 -2
- package/lib/esm/hooks/useFastCallback.js +16 -16
- package/lib/esm/hooks/useMetadata/index.d.ts +1 -1
- package/lib/esm/hooks/useMetadata/index.js +1 -1
- package/lib/esm/hooks/useMetadata/useMetadata.d.ts +5 -5
- package/lib/esm/hooks/useMetadata/useMetadata.js +11 -11
- package/lib/esm/hooks/useOnKeyDownEffect.d.ts +1 -1
- package/lib/esm/hooks/useOnKeyDownEffect.js +19 -19
- package/lib/esm/hooks/useQpq.d.ts +2 -2
- package/lib/esm/hooks/useQpq.js +34 -32
- package/lib/esm/hooks/useRunEvery.d.ts +1 -1
- package/lib/esm/hooks/useRunEvery.js +18 -18
- package/lib/esm/hooks/useThrottledMemo.d.ts +1 -1
- package/lib/esm/hooks/useThrottledMemo.js +28 -28
- package/lib/esm/index.d.ts +10 -8
- package/lib/esm/index.js +10 -8
- package/lib/esm/state/index.d.ts +1 -1
- package/lib/esm/state/index.js +1 -1
- package/lib/esm/state/useStateUpdater.d.ts +3 -4
- package/lib/esm/state/useStateUpdater.js +11 -11
- package/lib/esm/useFieldBinding/index.d.ts +1 -0
- package/lib/esm/useFieldBinding/index.js +1 -0
- package/lib/esm/useFieldBinding/useFieldBinding.d.ts +2 -0
- package/lib/esm/useFieldBinding/useFieldBinding.js +17 -0
- package/lib/esm/useSharedQueryParams/index.d.ts +2 -0
- package/lib/esm/useSharedQueryParams/index.js +2 -0
- package/lib/esm/useSharedQueryParams/logic/index.d.ts +4 -0
- package/lib/esm/useSharedQueryParams/logic/index.js +4 -0
- package/lib/esm/useSharedQueryParams/logic/runtime/askSetParam.d.ts +2 -0
- package/lib/esm/useSharedQueryParams/logic/runtime/askSetParam.js +6 -0
- package/lib/esm/useSharedQueryParams/logic/runtime/askSyncParams.d.ts +2 -0
- package/lib/esm/useSharedQueryParams/logic/runtime/askSyncParams.js +8 -0
- package/lib/esm/useSharedQueryParams/logic/runtime/index.d.ts +2 -0
- package/lib/esm/useSharedQueryParams/logic/runtime/index.js +2 -0
- package/lib/esm/useSharedQueryParams/logic/runtime/sharedQueryParamsLogic.d.ts +4 -0
- package/lib/esm/useSharedQueryParams/logic/runtime/sharedQueryParamsLogic.js +4 -0
- package/lib/esm/useSharedQueryParams/logic/sharedQueryParamsActionCreator.d.ts +2 -0
- package/lib/esm/useSharedQueryParams/logic/sharedQueryParamsActionCreator.js +8 -0
- package/lib/esm/useSharedQueryParams/logic/sharedQueryParamsReducer.d.ts +3 -0
- package/lib/esm/useSharedQueryParams/logic/sharedQueryParamsReducer.js +10 -0
- package/lib/esm/useSharedQueryParams/logic/sharedQueryParamsTypes.d.ts +10 -0
- package/lib/esm/useSharedQueryParams/logic/sharedQueryParamsTypes.js +4 -0
- package/lib/esm/useSharedQueryParams/sharedQueryParamsRuntime.d.ts +3 -0
- package/lib/esm/useSharedQueryParams/sharedQueryParamsRuntime.js +4 -0
- package/lib/esm/webSocketQueue/hooks/index.d.ts +2 -2
- package/lib/esm/webSocketQueue/hooks/index.js +2 -2
- package/lib/esm/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.d.ts +3 -3
- package/lib/esm/webSocketQueue/hooks/useSubscribeToWebSocketQueueEvent.js +4 -4
- package/lib/esm/webSocketQueue/hooks/useWebsocketQueueSendEvent.d.ts +2 -2
- package/lib/esm/webSocketQueue/hooks/useWebsocketQueueSendEvent.js +5 -5
- package/lib/esm/webSocketQueue/index.d.ts +1 -1
- package/lib/esm/webSocketQueue/index.js +1 -1
- package/lib/esm/websocket/WebSocketAuthSync/WebSocketAuthSync.d.ts +6 -7
- package/lib/esm/websocket/WebSocketAuthSync/WebSocketAuthSync.js +11 -11
- package/lib/esm/websocket/WebSocketAuthSync/hooks/index.d.ts +2 -2
- package/lib/esm/websocket/WebSocketAuthSync/hooks/index.js +2 -2
- package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.d.ts +2 -2
- package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebsocketAuthSync.js +33 -33
- package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.d.ts +1 -1
- package/lib/esm/websocket/WebSocketAuthSync/hooks/useWebsocketPingPong.js +12 -12
- package/lib/esm/websocket/WebSocketAuthSync/index.d.ts +1 -1
- package/lib/esm/websocket/WebSocketAuthSync/index.js +1 -1
- package/lib/esm/websocket/WebsocketContext.d.ts +2 -3
- package/lib/esm/websocket/WebsocketContext.js +2 -2
- package/lib/esm/websocket/WebsocketProvider.d.ts +5 -6
- package/lib/esm/websocket/WebsocketProvider.js +7 -7
- package/lib/esm/websocket/hooks/index.d.ts +5 -5
- package/lib/esm/websocket/hooks/index.js +5 -5
- package/lib/esm/websocket/hooks/useSubscribeToWebSocketEvent.d.ts +3 -3
- package/lib/esm/websocket/hooks/useSubscribeToWebSocketEvent.js +13 -13
- package/lib/esm/websocket/hooks/useSubscribeToWebsocket.d.ts +2 -2
- package/lib/esm/websocket/hooks/useSubscribeToWebsocket.js +13 -13
- package/lib/esm/websocket/hooks/useWebsocketApi.d.ts +1 -1
- package/lib/esm/websocket/hooks/useWebsocketApi.js +6 -6
- package/lib/esm/websocket/hooks/useWebsocketManagement.d.ts +2 -2
- package/lib/esm/websocket/hooks/useWebsocketManagement.js +13 -13
- package/lib/esm/websocket/hooks/useWebsocketSendEvent.d.ts +2 -2
- package/lib/esm/websocket/hooks/useWebsocketSendEvent.js +11 -11
- package/lib/esm/websocket/index.d.ts +3 -3
- package/lib/esm/websocket/index.js +3 -3
- package/package.json +8 -8
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { preformNetworkRequest } from 'quidproquo-web';
|
|
2
|
-
import { useAuthAccessToken } from '../../auth';
|
|
3
|
-
import { useFastCallback } from '../../hooks';
|
|
4
|
-
export const useAuthenticatedNetworkRequest = (payload) => {
|
|
5
|
-
const authToken = useAuthAccessToken();
|
|
6
|
-
const payloadWithAuthHeaders = authToken
|
|
7
|
-
? {
|
|
8
|
-
...payload,
|
|
9
|
-
headers: {
|
|
10
|
-
...(payload.headers || {}),
|
|
11
|
-
Authorization: `Bearer ${authToken}`,
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
: payload;
|
|
15
|
-
const requeser = useFastCallback(() => preformNetworkRequest(payloadWithAuthHeaders));
|
|
16
|
-
return requeser;
|
|
17
|
-
};
|
|
1
|
+
import { preformNetworkRequest } from 'quidproquo-web';
|
|
2
|
+
import { useAuthAccessToken } from '../../auth';
|
|
3
|
+
import { useFastCallback } from '../../hooks';
|
|
4
|
+
export const useAuthenticatedNetworkRequest = (payload) => {
|
|
5
|
+
const authToken = useAuthAccessToken();
|
|
6
|
+
const payloadWithAuthHeaders = authToken
|
|
7
|
+
? {
|
|
8
|
+
...payload,
|
|
9
|
+
headers: {
|
|
10
|
+
...(payload.headers || {}),
|
|
11
|
+
Authorization: `Bearer ${authToken}`,
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
: payload;
|
|
15
|
+
const requeser = useFastCallback(() => preformNetworkRequest(payloadWithAuthHeaders));
|
|
16
|
+
return requeser;
|
|
17
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HTTPNetworkResponse, NetworkRequestActionPayload } from 'quidproquo-core';
|
|
2
|
-
export declare const useNetworkRequest: <R>(payload: NetworkRequestActionPayload<any>) => () => Promise<HTTPNetworkResponse<R
|
|
1
|
+
import { HTTPNetworkResponse, NetworkRequestActionPayload } from 'quidproquo-core';
|
|
2
|
+
export declare const useNetworkRequest: <R>(payload: NetworkRequestActionPayload<any>) => (() => Promise<HTTPNetworkResponse<R>>);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { preformNetworkRequest } from 'quidproquo-web';
|
|
2
|
-
import { useFastCallback } from '../../hooks';
|
|
3
|
-
export const useNetworkRequest = (payload) => {
|
|
4
|
-
const requeser = useFastCallback(() => preformNetworkRequest(payload));
|
|
5
|
-
return requeser;
|
|
6
|
-
};
|
|
1
|
+
import { preformNetworkRequest } from 'quidproquo-web';
|
|
2
|
+
import { useFastCallback } from '../../hooks';
|
|
3
|
+
export const useNetworkRequest = (payload) => {
|
|
4
|
+
const requeser = useFastCallback(() => preformNetworkRequest(payload));
|
|
5
|
+
return requeser;
|
|
6
|
+
};
|
package/lib/esm/api/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './hooks';
|
|
1
|
+
export * from './hooks';
|
package/lib/esm/api/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './hooks';
|
|
1
|
+
export * from './hooks';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
authenticationInfo
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const RefreshAuthTokensProvider: import("react").NamedExoticComponent<RefreshAuthTokensProviderProps>;
|
|
1
|
+
import { AuthenticationInfo } from 'quidproquo-core';
|
|
2
|
+
export type RefreshAuthTokensProviderProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
authenticationInfo?: AuthenticationInfo;
|
|
5
|
+
refreshTokens: (authenticationInfo: AuthenticationInfo) => Promise<any>;
|
|
6
|
+
};
|
|
7
|
+
export declare const RefreshAuthTokensProvider: import("react").NamedExoticComponent<RefreshAuthTokensProviderProps>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { useRefreshTokens } from './hooks';
|
|
4
|
-
const RefreshAuthTokensProviderComponent = ({ children, authenticationInfo, refreshTokens }) => {
|
|
5
|
-
useRefreshTokens(authenticationInfo, refreshTokens);
|
|
6
|
-
// This fragment is not useless!
|
|
7
|
-
return _jsx(_Fragment, { children: children });
|
|
8
|
-
};
|
|
9
|
-
export const RefreshAuthTokensProvider = memo(RefreshAuthTokensProviderComponent);
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { useRefreshTokens } from './hooks';
|
|
4
|
+
const RefreshAuthTokensProviderComponent = ({ children, authenticationInfo, refreshTokens }) => {
|
|
5
|
+
useRefreshTokens(authenticationInfo, refreshTokens);
|
|
6
|
+
// This fragment is not useless!
|
|
7
|
+
return _jsx(_Fragment, { children: children });
|
|
8
|
+
};
|
|
9
|
+
export const RefreshAuthTokensProvider = memo(RefreshAuthTokensProviderComponent);
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const authContext: import("react").Context<AuthState>;
|
|
1
|
+
import { AuthState } from './types';
|
|
2
|
+
export declare const authContext: import("react").Context<AuthState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
export const authContext = createContext({
|
|
3
|
-
username: '',
|
|
4
|
-
password: '',
|
|
5
|
-
});
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
export const authContext = createContext({
|
|
3
|
+
username: '',
|
|
4
|
+
password: '',
|
|
5
|
+
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './useAuthAccessToken';
|
|
2
|
-
export * from './useIsLoggedIn';
|
|
3
|
-
export * from './useRefreshTokens';
|
|
1
|
+
export * from './useAuthAccessToken';
|
|
2
|
+
export * from './useIsLoggedIn';
|
|
3
|
+
export * from './useRefreshTokens';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './useAuthAccessToken';
|
|
2
|
-
export * from './useIsLoggedIn';
|
|
3
|
-
export * from './useRefreshTokens';
|
|
1
|
+
export * from './useAuthAccessToken';
|
|
2
|
+
export * from './useIsLoggedIn';
|
|
3
|
+
export * from './useRefreshTokens';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useAuthAccessToken: () => string | undefined;
|
|
1
|
+
export declare const useAuthAccessToken: () => string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { authContext } from '../authContext';
|
|
3
|
-
export const useAuthAccessToken = () => {
|
|
4
|
-
const authState = useContext(authContext);
|
|
5
|
-
// TODO: dont return access token if it has expired.
|
|
6
|
-
return authState.authenticationInfo?.accessToken;
|
|
7
|
-
};
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { authContext } from '../authContext';
|
|
3
|
+
export const useAuthAccessToken = () => {
|
|
4
|
+
const authState = useContext(authContext);
|
|
5
|
+
// TODO: dont return access token if it has expired.
|
|
6
|
+
return authState.authenticationInfo?.accessToken;
|
|
7
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useIsLoggedIn: () => boolean;
|
|
1
|
+
export declare const useIsLoggedIn: () => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useAuthAccessToken } from './useAuthAccessToken';
|
|
2
|
-
export const useIsLoggedIn = () => {
|
|
3
|
-
const accessToken = useAuthAccessToken();
|
|
4
|
-
return !!accessToken;
|
|
5
|
-
};
|
|
1
|
+
import { useAuthAccessToken } from './useAuthAccessToken';
|
|
2
|
+
export const useIsLoggedIn = () => {
|
|
3
|
+
const accessToken = useAuthAccessToken();
|
|
4
|
+
return !!accessToken;
|
|
5
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AuthenticationInfo } from 'quidproquo-core';
|
|
2
|
-
export declare const useRefreshTokens: (authenticationInfo: AuthenticationInfo | undefined, refreshTokens: (authenticationInfo: AuthenticationInfo) => Promise<any>) => void;
|
|
1
|
+
import { AuthenticationInfo } from 'quidproquo-core';
|
|
2
|
+
export declare const useRefreshTokens: (authenticationInfo: AuthenticationInfo | undefined, refreshTokens: (authenticationInfo: AuthenticationInfo) => Promise<any>) => void;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
export const useRefreshTokens = (authenticationInfo, refreshTokens) => {
|
|
3
|
-
const refresh = () => {
|
|
4
|
-
if (authenticationInfo && authenticationInfo.refreshToken && authenticationInfo.expiresAt) {
|
|
5
|
-
const now = new Date().toISOString();
|
|
6
|
-
const timeToExpire = new Date(authenticationInfo.expiresAt).getTime() - new Date(now).getTime();
|
|
7
|
-
// Refresh the token 10 minutes before it expires to ensure there's a buffer
|
|
8
|
-
const bufferTime = 10 * 60 * 1000;
|
|
9
|
-
const refreshTime = timeToExpire - bufferTime;
|
|
10
|
-
if (refreshTime > 0) {
|
|
11
|
-
return setTimeout(() => {
|
|
12
|
-
refreshTokens(authenticationInfo);
|
|
13
|
-
}, refreshTime);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
// If the token is already expired or very close to expiration, refresh immediately
|
|
17
|
-
refreshTokens(authenticationInfo);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
};
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
const timerId = refresh();
|
|
24
|
-
return () => {
|
|
25
|
-
// Cleanup on unmount or when authState changes
|
|
26
|
-
if (timerId) {
|
|
27
|
-
clearTimeout(timerId);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}, [authenticationInfo, refreshTokens]);
|
|
31
|
-
};
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export const useRefreshTokens = (authenticationInfo, refreshTokens) => {
|
|
3
|
+
const refresh = () => {
|
|
4
|
+
if (authenticationInfo && authenticationInfo.refreshToken && authenticationInfo.expiresAt) {
|
|
5
|
+
const now = new Date().toISOString();
|
|
6
|
+
const timeToExpire = new Date(authenticationInfo.expiresAt).getTime() - new Date(now).getTime();
|
|
7
|
+
// Refresh the token 10 minutes before it expires to ensure there's a buffer
|
|
8
|
+
const bufferTime = 10 * 60 * 1000;
|
|
9
|
+
const refreshTime = timeToExpire - bufferTime;
|
|
10
|
+
if (refreshTime > 0) {
|
|
11
|
+
return setTimeout(() => {
|
|
12
|
+
refreshTokens(authenticationInfo);
|
|
13
|
+
}, refreshTime);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
// If the token is already expired or very close to expiration, refresh immediately
|
|
17
|
+
refreshTokens(authenticationInfo);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const timerId = refresh();
|
|
24
|
+
return () => {
|
|
25
|
+
// Cleanup on unmount or when authState changes
|
|
26
|
+
if (timerId) {
|
|
27
|
+
clearTimeout(timerId);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}, [authenticationInfo, refreshTokens]);
|
|
31
|
+
};
|
package/lib/esm/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './authContext';
|
|
2
|
-
export * from './hooks';
|
|
3
|
-
export * from './RefreshAuthTokensProvider';
|
|
4
|
-
export * from './types';
|
|
1
|
+
export * from './authContext';
|
|
2
|
+
export * from './hooks';
|
|
3
|
+
export * from './RefreshAuthTokensProvider';
|
|
4
|
+
export * from './types';
|
package/lib/esm/auth/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './authContext';
|
|
2
|
-
export * from './hooks';
|
|
3
|
-
export * from './RefreshAuthTokensProvider';
|
|
4
|
-
export * from './types';
|
|
1
|
+
export * from './authContext';
|
|
2
|
+
export * from './hooks';
|
|
3
|
+
export * from './RefreshAuthTokensProvider';
|
|
4
|
+
export * from './types';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AuthenticationInfo } from 'quidproquo-core';
|
|
2
|
-
export type AuthState = {
|
|
3
|
-
challenge?: string;
|
|
4
|
-
session?: string;
|
|
5
|
-
username: string;
|
|
6
|
-
password: string;
|
|
7
|
-
authenticationInfo?: AuthenticationInfo;
|
|
8
|
-
};
|
|
1
|
+
import { AuthenticationInfo } from 'quidproquo-core';
|
|
2
|
+
export type AuthState = {
|
|
3
|
+
challenge?: string;
|
|
4
|
+
session?: string;
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
7
|
+
authenticationInfo?: AuthenticationInfo;
|
|
8
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './AuthState';
|
|
1
|
+
export * from './AuthState';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './AuthState';
|
|
1
|
+
export * from './AuthState';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const BaseUrlContext: import("react").Context<BaseUrlResolvers>;
|
|
1
|
+
import { BaseUrlResolvers } from './types';
|
|
2
|
+
export declare const BaseUrlContext: import("react").Context<BaseUrlResolvers>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
export const BaseUrlContext = createContext({
|
|
3
|
-
getApiUrl: () => '',
|
|
4
|
-
getWsUrl: () => '',
|
|
5
|
-
getMFManifestUrl: () => '',
|
|
6
|
-
});
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
export const BaseUrlContext = createContext({
|
|
3
|
+
getApiUrl: () => '',
|
|
4
|
+
getWsUrl: () => '',
|
|
5
|
+
getMFManifestUrl: () => '',
|
|
6
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare const BaseUrlProvider: React.FC<BaseUrlContextProps>;
|
|
1
|
+
import { BaseUrlResolvers } from './types';
|
|
2
|
+
export type BaseUrlContextProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
urlResolvers: BaseUrlResolvers;
|
|
5
|
+
};
|
|
6
|
+
export declare const BaseUrlProvider: React.FC<BaseUrlContextProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BaseUrlContext } from './BaseUrlContext';
|
|
3
|
-
export const BaseUrlProvider = ({ children, urlResolvers }) => {
|
|
4
|
-
return _jsx(BaseUrlContext.Provider, { value: urlResolvers, children: children });
|
|
5
|
-
};
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BaseUrlContext } from './BaseUrlContext';
|
|
3
|
+
export const BaseUrlProvider = ({ children, urlResolvers }) => {
|
|
4
|
+
return _jsx(BaseUrlContext.Provider, { value: urlResolvers, children: children });
|
|
5
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './useBaseUrlResolvers';
|
|
1
|
+
export * from './useBaseUrlResolvers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './useBaseUrlResolvers';
|
|
1
|
+
export * from './useBaseUrlResolvers';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BaseUrlResolvers } from '../types';
|
|
2
|
-
export declare const useBaseUrlResolvers: () => BaseUrlResolvers;
|
|
1
|
+
import { BaseUrlResolvers } from '../types';
|
|
2
|
+
export declare const useBaseUrlResolvers: () => BaseUrlResolvers;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { BaseUrlContext } from '../BaseUrlContext';
|
|
3
|
-
export const useBaseUrlResolvers = () => {
|
|
4
|
-
const baseUrlResolvers = useContext(BaseUrlContext);
|
|
5
|
-
return baseUrlResolvers;
|
|
6
|
-
};
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { BaseUrlContext } from '../BaseUrlContext';
|
|
3
|
+
export const useBaseUrlResolvers = () => {
|
|
4
|
+
const baseUrlResolvers = useContext(BaseUrlContext);
|
|
5
|
+
return baseUrlResolvers;
|
|
6
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './BaseUrlProvider';
|
|
2
|
-
export * from './hooks';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './BaseUrlProvider';
|
|
2
|
+
export * from './hooks';
|
|
3
|
+
export * from './types';
|
package/lib/esm/baseUrl/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './BaseUrlProvider';
|
|
2
|
-
export * from './hooks';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './BaseUrlProvider';
|
|
2
|
+
export * from './hooks';
|
|
3
|
+
export * from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type BaseUrlResolver = () => string;
|
|
2
|
-
export type BaseUrlResolvers = {
|
|
3
|
-
getApiUrl: BaseUrlResolver;
|
|
4
|
-
getWsUrl: BaseUrlResolver;
|
|
5
|
-
getMFManifestUrl: BaseUrlResolver;
|
|
6
|
-
};
|
|
1
|
+
export type BaseUrlResolver = () => string;
|
|
2
|
+
export type BaseUrlResolvers = {
|
|
3
|
+
getApiUrl: BaseUrlResolver;
|
|
4
|
+
getWsUrl: BaseUrlResolver;
|
|
5
|
+
getMFManifestUrl: BaseUrlResolver;
|
|
6
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './BaseUrlResolver';
|
|
1
|
+
export * from './BaseUrlResolver';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './BaseUrlResolver';
|
|
1
|
+
export * from './BaseUrlResolver';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { QpqContext, QpqContextIdentifier } from 'quidproquo-core';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
interface QpqContextProviderProps<T> {
|
|
4
|
-
contextIdentifier: QpqContextIdentifier<T>;
|
|
5
|
-
value: T;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare const useQpqContextValues: () => QpqContext<any>;
|
|
9
|
-
export declare const QpqContextProvider: <T>({ contextIdentifier, value, children }: QpqContextProviderProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
1
|
+
import { QpqContext, QpqContextIdentifier } from 'quidproquo-core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
interface QpqContextProviderProps<T> {
|
|
4
|
+
contextIdentifier: QpqContextIdentifier<T>;
|
|
5
|
+
value: T;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const useQpqContextValues: () => QpqContext<any>;
|
|
9
|
+
export declare const QpqContextProvider: <T>({ contextIdentifier, value, children }: QpqContextProviderProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useMemo } from 'react';
|
|
3
|
-
// Define a generic type for the React Context
|
|
4
|
-
const qpqReactContext = createContext({});
|
|
5
|
-
export const useQpqContextValues = () => {
|
|
6
|
-
return useContext(qpqReactContext);
|
|
7
|
-
};
|
|
8
|
-
export const QpqContextProvider = ({ contextIdentifier, value, children }) => {
|
|
9
|
-
// Get the parent context value
|
|
10
|
-
const parentContext = useContext(qpqReactContext);
|
|
11
|
-
// Merge parent and current value
|
|
12
|
-
const mergedContext = useMemo(() => ({ ...parentContext, [contextIdentifier.uniqueName]: value }), [parentContext, contextIdentifier.uniqueName, value]);
|
|
13
|
-
// Provide the merged context down
|
|
14
|
-
return _jsx(qpqReactContext.Provider, { value: mergedContext, children: children });
|
|
15
|
-
};
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
3
|
+
// Define a generic type for the React Context
|
|
4
|
+
const qpqReactContext = createContext({});
|
|
5
|
+
export const useQpqContextValues = () => {
|
|
6
|
+
return useContext(qpqReactContext);
|
|
7
|
+
};
|
|
8
|
+
export const QpqContextProvider = ({ contextIdentifier, value, children }) => {
|
|
9
|
+
// Get the parent context value
|
|
10
|
+
const parentContext = useContext(qpqReactContext);
|
|
11
|
+
// Merge parent and current value
|
|
12
|
+
const mergedContext = useMemo(() => ({ ...parentContext, [contextIdentifier.uniqueName]: value }), [parentContext, contextIdentifier.uniqueName, value]);
|
|
13
|
+
// Provide the merged context down
|
|
14
|
+
return _jsx(qpqReactContext.Provider, { value: mergedContext, children: children });
|
|
15
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AskResponse, AskResponseReturnType, Story } from 'quidproquo-core';
|
|
2
|
-
export type RemoveQpqAskPrefix<K extends string> = K extends `ask${infer R}` ? Uncapitalize<R> : never;
|
|
3
|
-
export type QpqApi = Record<`ask${string}`, Story<any, any>>;
|
|
4
|
-
export type QpqMappedApi<TApi extends QpqApi> = {
|
|
5
|
-
[K in Extract<keyof TApi, string> as RemoveQpqAskPrefix<K>]: TApi[K] extends (...args: infer P) => infer R ? R extends AskResponse<any> ? (...args: P) => Promise<AskResponseReturnType<R>> : never : never;
|
|
6
|
-
};
|
|
1
|
+
import { AskResponse, AskResponseReturnType, Story } from 'quidproquo-core';
|
|
2
|
+
export type RemoveQpqAskPrefix<K extends string> = K extends `ask${infer R}` ? Uncapitalize<R> : never;
|
|
3
|
+
export type QpqApi = Record<`ask${string}`, Story<any, any>>;
|
|
4
|
+
export type QpqMappedApi<TApi extends QpqApi> = {
|
|
5
|
+
[K in Extract<keyof TApi, string> as RemoveQpqAskPrefix<K>]: TApi[K] extends (...args: infer P) => infer R ? R extends AskResponse<any> ? (...args: P) => Promise<AskResponseReturnType<R>> : never : never;
|
|
6
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { QpqApi } from './QpqMappedApi';
|
|
3
|
-
import { QpqRuntimeDefinition } from '.';
|
|
4
|
-
export type QpqBubbleReducer<S, A> = (prevState: S, action: A) => [S, boolean];
|
|
5
|
-
type QpqRuntimeEffectCatcher = {
|
|
6
|
-
runtime: QpqRuntimeDefinition<any, any, any>;
|
|
7
|
-
name?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const useQpqRuntimeBubblingReducer: <TState, TAction, TApi extends QpqApi>(runtimeDefinition: QpqRuntimeDefinition<TState, TAction, TApi>, name?: string) => [TState, (action: TAction) => void, () => TState];
|
|
10
|
-
export declare const QpqRuntimeEffectCatcherComponent: <TState, TAction, TApi extends QpqApi>({ children, runtime, name, }: QpqRuntimeEffectCatcher & {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export declare const QpqRuntimeEffectCatcher: import("react").MemoExoticComponent<(<TState, TAction, TApi extends QpqApi>({ children, runtime, name, }: QpqRuntimeEffectCatcher & {
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
}) => import("react/jsx-runtime").JSX.Element)>;
|
|
16
|
-
export {};
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { QpqApi } from './QpqMappedApi';
|
|
3
|
+
import { QpqRuntimeDefinition } from '.';
|
|
4
|
+
export type QpqBubbleReducer<S, A> = (prevState: S, action: A) => [S, boolean];
|
|
5
|
+
type QpqRuntimeEffectCatcher = {
|
|
6
|
+
runtime: QpqRuntimeDefinition<any, any, any>;
|
|
7
|
+
name?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const useQpqRuntimeBubblingReducer: <TState, TAction, TApi extends QpqApi>(runtimeDefinition: QpqRuntimeDefinition<TState, TAction, TApi>, name?: string) => [TState, (action: TAction) => void, () => TState];
|
|
10
|
+
export declare const QpqRuntimeEffectCatcherComponent: <TState, TAction, TApi extends QpqApi>({ children, runtime, name, }: QpqRuntimeEffectCatcher & {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const QpqRuntimeEffectCatcher: import("react").MemoExoticComponent<(<TState, TAction, TApi extends QpqApi>({ children, runtime, name, }: QpqRuntimeEffectCatcher & {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element)>;
|
|
16
|
+
export {};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, memo, useContext } from 'react';
|
|
3
|
-
import { useFastCallback } from '../useFastCallback';
|
|
4
|
-
import { useQpqRuntime, useQpqRuntimeState } from '.';
|
|
5
|
-
// Create a context with a default NOOP dispatcher
|
|
6
|
-
const BubbleReducerDispatchContext = createContext((_action) => {
|
|
7
|
-
// NOOP
|
|
8
|
-
});
|
|
9
|
-
export const useQpqRuntimeBubblingReducer = (runtimeDefinition, name) => {
|
|
10
|
-
const runtimeDefinitionInfo = runtimeDefinition(name);
|
|
11
|
-
const [state, setState, getState] = useQpqRuntimeState(runtimeDefinition, name);
|
|
12
|
-
// Get the parent dispatch from the context
|
|
13
|
-
const parentDispatch = useContext(BubbleReducerDispatchContext);
|
|
14
|
-
// Custom Dispatch using functional updates
|
|
15
|
-
const dispatch = useFastCallback((action) => {
|
|
16
|
-
const [newState, preventBubble] = runtimeDefinitionInfo.reducer(getState(), action);
|
|
17
|
-
if (preventBubble) {
|
|
18
|
-
setState(newState);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
parentDispatch(action);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return [state, dispatch, getState];
|
|
25
|
-
};
|
|
26
|
-
export const QpqRuntimeEffectCatcherComponent = ({ children, runtime, name, }) => {
|
|
27
|
-
const [api, state, dispatch] = useQpqRuntime(runtime, undefined, name);
|
|
28
|
-
return _jsx(BubbleReducerDispatchContext.Provider, { value: dispatch, children: children });
|
|
29
|
-
};
|
|
30
|
-
export const QpqRuntimeEffectCatcher = memo(QpqRuntimeEffectCatcherComponent);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, memo, useContext, useMemo } from 'react';
|
|
3
|
+
import { useFastCallback } from '../useFastCallback';
|
|
4
|
+
import { useQpqRuntime, useQpqRuntimeState } from '.';
|
|
5
|
+
// Create a context with a default NOOP dispatcher
|
|
6
|
+
const BubbleReducerDispatchContext = createContext((_action) => {
|
|
7
|
+
// NOOP
|
|
8
|
+
});
|
|
9
|
+
export const useQpqRuntimeBubblingReducer = (runtimeDefinition, name) => {
|
|
10
|
+
const runtimeDefinitionInfo = useMemo(() => runtimeDefinition(name), [runtimeDefinition, name]);
|
|
11
|
+
const [state, setState, getState] = useQpqRuntimeState(runtimeDefinition, name);
|
|
12
|
+
// Get the parent dispatch from the context
|
|
13
|
+
const parentDispatch = useContext(BubbleReducerDispatchContext);
|
|
14
|
+
// Custom Dispatch using functional updates
|
|
15
|
+
const dispatch = useFastCallback((action) => {
|
|
16
|
+
const [newState, preventBubble] = runtimeDefinitionInfo.reducer(getState(), action);
|
|
17
|
+
if (preventBubble) {
|
|
18
|
+
setState(newState);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
parentDispatch(action);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return [state, dispatch, getState];
|
|
25
|
+
};
|
|
26
|
+
export const QpqRuntimeEffectCatcherComponent = ({ children, runtime, name, }) => {
|
|
27
|
+
const [api, state, dispatch] = useQpqRuntime(runtime, undefined, name);
|
|
28
|
+
return _jsx(BubbleReducerDispatchContext.Provider, { value: dispatch, children: children });
|
|
29
|
+
};
|
|
30
|
+
export const QpqRuntimeEffectCatcher = memo(QpqRuntimeEffectCatcherComponent);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
import { Dispatch } from 'react';
|
|
3
|
-
export declare const getStateDispatchActionListResolver: (dispatch: Dispatch<any>) => ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
import { Dispatch } from 'react';
|
|
3
|
+
export declare const getStateDispatchActionListResolver: (dispatch: Dispatch<any>) => ActionProcessorListResolver;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { actionResult, StateActionType } from 'quidproquo-core';
|
|
2
|
-
const getProcessStateDispatch = (dispatch) => async ({ action }) => {
|
|
3
|
-
dispatch(action);
|
|
4
|
-
return actionResult(undefined);
|
|
5
|
-
};
|
|
6
|
-
export const getStateDispatchActionListResolver = (dispatch) => async (_qpqConfig, _dynamicModuleLoader) => ({
|
|
7
|
-
[StateActionType.Dispatch]: getProcessStateDispatch(dispatch),
|
|
8
|
-
});
|
|
1
|
+
import { actionResult, StateActionType } from 'quidproquo-core';
|
|
2
|
+
const getProcessStateDispatch = (dispatch) => async ({ action }) => {
|
|
3
|
+
dispatch(action);
|
|
4
|
+
return actionResult(undefined);
|
|
5
|
+
};
|
|
6
|
+
export const getStateDispatchActionListResolver = (dispatch) => async (_qpqConfig, _dynamicModuleLoader) => ({
|
|
7
|
+
[StateActionType.Dispatch]: getProcessStateDispatch(dispatch),
|
|
8
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getStateReadActionListResolver: <State>(getCurrentState: () => State) => ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getStateReadActionListResolver: <State>(getCurrentState: () => State) => ActionProcessorListResolver;
|