@gen3/core 0.10.87 → 0.10.89
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/cjs/index.js +39 -41
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/features/user/index.d.ts +2 -2
- package/dist/dts/features/user/index.d.ts.map +1 -1
- package/dist/dts/features/user/userSlice.d.ts +1 -2
- package/dist/dts/features/user/userSlice.d.ts.map +1 -1
- package/dist/dts/features/user/userSliceRTK.d.ts.map +1 -1
- package/dist/esm/index.js +42 -43
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -4,8 +4,8 @@ var toolkit = require('@reduxjs/toolkit');
|
|
|
4
4
|
var react = require('@reduxjs/toolkit/query/react');
|
|
5
5
|
var cookiesNext = require('cookies-next');
|
|
6
6
|
var query = require('@reduxjs/toolkit/query');
|
|
7
|
-
var React = require('react');
|
|
8
7
|
var reactRedux = require('react-redux');
|
|
8
|
+
var React = require('react');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
10
|
var idb = require('idb');
|
|
11
11
|
var useSWR = require('swr');
|
|
@@ -383,43 +383,6 @@ const { useGetJWKKeysQuery } = jwtApi;
|
|
|
383
383
|
*/ const useCoreSelector = reactRedux.useSelector.withTypes();
|
|
384
384
|
const useCoreDispatch = reactRedux.useDispatch.withTypes();
|
|
385
385
|
|
|
386
|
-
const usePrevious = (value)=>{
|
|
387
|
-
const ref = React.useRef();
|
|
388
|
-
React.useEffect(()=>{
|
|
389
|
-
ref.current = value;
|
|
390
|
-
});
|
|
391
|
-
return ref.current;
|
|
392
|
-
};
|
|
393
|
-
const createUseCoreDataHook = (fetchDataActionCreator, dataSelector)=>{
|
|
394
|
-
return (...params)=>{
|
|
395
|
-
const coreDispatch = useCoreDispatch();
|
|
396
|
-
const { data, status, error } = useCoreSelector(dataSelector);
|
|
397
|
-
const action = fetchDataActionCreator(...params);
|
|
398
|
-
const prevParams = usePrevious(params);
|
|
399
|
-
React.useEffect(()=>{
|
|
400
|
-
if (status === 'uninitialized' || !lodash.isEqual(prevParams, params)) {
|
|
401
|
-
// createDispatchHook types forces the input to AnyAction, which is
|
|
402
|
-
// not compatible with thunk actions. hence, the `as any` cast. ;(
|
|
403
|
-
coreDispatch(action); // eslint-disable-line
|
|
404
|
-
}
|
|
405
|
-
}, [
|
|
406
|
-
status,
|
|
407
|
-
coreDispatch,
|
|
408
|
-
action,
|
|
409
|
-
params,
|
|
410
|
-
prevParams
|
|
411
|
-
]);
|
|
412
|
-
return {
|
|
413
|
-
data,
|
|
414
|
-
error,
|
|
415
|
-
isUninitialized: status === 'uninitialized',
|
|
416
|
-
isFetching: status === 'pending',
|
|
417
|
-
isSuccess: status === 'fulfilled',
|
|
418
|
-
isError: status === 'rejected'
|
|
419
|
-
};
|
|
420
|
-
};
|
|
421
|
-
};
|
|
422
|
-
|
|
423
386
|
/**
|
|
424
387
|
* Creates an async thunk for fetching user permissions details from fence
|
|
425
388
|
* @see https://redux-toolkit.js.org/api/createAsyncThunk
|
|
@@ -467,7 +430,7 @@ const initialState$8 = {
|
|
|
467
430
|
extraReducers: (builder)=>{
|
|
468
431
|
builder.addCase(fetchUserState.fulfilled, (_, action)=>{
|
|
469
432
|
const response = action.payload;
|
|
470
|
-
if (response
|
|
433
|
+
if (response?.status !== 200) {
|
|
471
434
|
return {
|
|
472
435
|
status: 'rejected',
|
|
473
436
|
loginStatus: 'unauthenticated'
|
|
@@ -500,7 +463,6 @@ const selectUserData = (state)=>{
|
|
|
500
463
|
};
|
|
501
464
|
const selectUser = (state)=>state.user;
|
|
502
465
|
const selectUserLoginStatus = (state)=>state.user.loginStatus;
|
|
503
|
-
const useUser = createUseCoreDataHook(fetchUserState, selectUserData);
|
|
504
466
|
const useIsUserLoggedIn = ()=>{
|
|
505
467
|
return useCoreSelector((state)=>isAuthenticated(selectUserLoginStatus(state)));
|
|
506
468
|
};
|
|
@@ -2694,6 +2656,43 @@ const fetchFencePresignedURL = async ({ guid, method = 'GET', onAbort = ()=>null
|
|
|
2694
2656
|
return response.json();
|
|
2695
2657
|
};
|
|
2696
2658
|
|
|
2659
|
+
const usePrevious = (value)=>{
|
|
2660
|
+
const ref = React.useRef();
|
|
2661
|
+
React.useEffect(()=>{
|
|
2662
|
+
ref.current = value;
|
|
2663
|
+
});
|
|
2664
|
+
return ref.current;
|
|
2665
|
+
};
|
|
2666
|
+
const createUseCoreDataHook = (fetchDataActionCreator, dataSelector)=>{
|
|
2667
|
+
return (...params)=>{
|
|
2668
|
+
const coreDispatch = useCoreDispatch();
|
|
2669
|
+
const { data, status, error } = useCoreSelector(dataSelector);
|
|
2670
|
+
const action = fetchDataActionCreator(...params);
|
|
2671
|
+
const prevParams = usePrevious(params);
|
|
2672
|
+
React.useEffect(()=>{
|
|
2673
|
+
if (status === 'uninitialized' || !lodash.isEqual(prevParams, params)) {
|
|
2674
|
+
// createDispatchHook types forces the input to AnyAction, which is
|
|
2675
|
+
// not compatible with thunk actions. hence, the `as any` cast. ;(
|
|
2676
|
+
coreDispatch(action); // eslint-disable-line
|
|
2677
|
+
}
|
|
2678
|
+
}, [
|
|
2679
|
+
status,
|
|
2680
|
+
coreDispatch,
|
|
2681
|
+
action,
|
|
2682
|
+
params,
|
|
2683
|
+
prevParams
|
|
2684
|
+
]);
|
|
2685
|
+
return {
|
|
2686
|
+
data,
|
|
2687
|
+
error,
|
|
2688
|
+
isUninitialized: status === 'uninitialized',
|
|
2689
|
+
isFetching: status === 'pending',
|
|
2690
|
+
isSuccess: status === 'fulfilled',
|
|
2691
|
+
isError: status === 'rejected'
|
|
2692
|
+
};
|
|
2693
|
+
};
|
|
2694
|
+
};
|
|
2695
|
+
|
|
2697
2696
|
const persistor = reduxPersist.persistStore(coreStore);
|
|
2698
2697
|
const CoreProvider = ({ children })=>{
|
|
2699
2698
|
return /*#__PURE__*/ React.createElement(reactRedux.Provider, {
|
|
@@ -3735,7 +3734,6 @@ exports.useSetCurrentPayModelMutation = useSetCurrentPayModelMutation;
|
|
|
3735
3734
|
exports.useSubmitSowerJobMutation = useSubmitSowerJobMutation;
|
|
3736
3735
|
exports.useTerminateWorkspaceMutation = useTerminateWorkspaceMutation;
|
|
3737
3736
|
exports.useUpdateDataLibraryListMutation = useUpdateDataLibraryListMutation;
|
|
3738
|
-
exports.useUser = useUser;
|
|
3739
3737
|
exports.useUserAuth = useUserAuth;
|
|
3740
3738
|
exports.userHasCreateOrUpdateOnAnyProject = userHasCreateOrUpdateOnAnyProject;
|
|
3741
3739
|
exports.userHasDataUpload = userHasDataUpload;
|