@truedat/core 7.6.1 → 7.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/core",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.3",
|
|
4
4
|
"description": "Truedat Web Core",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "7.6.
|
|
51
|
+
"@truedat/test": "7.6.3",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"slate-react": "^0.22.10",
|
|
86
86
|
"swr": "^2.3.3"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "bfd5e53aeb7fb8da6ad19e9403fc6d141fbe9693"
|
|
89
89
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { useDispatch } from "react-redux";
|
|
3
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
4
4
|
import { useLocation } from "react-router";
|
|
5
5
|
import { dismissAlert } from "../routines";
|
|
6
|
+
import { getMessage } from "../selectors";
|
|
6
7
|
|
|
7
8
|
export default function RouteListener() {
|
|
8
|
-
const
|
|
9
|
+
const { pathname } = useLocation();
|
|
9
10
|
const dispatch = useDispatch();
|
|
11
|
+
const message = useSelector(getMessage);
|
|
10
12
|
|
|
11
13
|
useEffect(() => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
if (!_.isEmpty(message)) {
|
|
15
|
+
dispatch(dismissAlert());
|
|
16
|
+
}
|
|
17
|
+
}, [pathname]);
|
|
14
18
|
|
|
15
19
|
return null;
|
|
16
20
|
}
|
|
@@ -23,6 +23,9 @@ describe("<RouteListener />", () => {
|
|
|
23
23
|
const { rerender } = render(<RouteListener />, {
|
|
24
24
|
routes: ["/initial"],
|
|
25
25
|
dispatch: mockDispatch,
|
|
26
|
+
state: {
|
|
27
|
+
ddMessage: { content: "test" },
|
|
28
|
+
},
|
|
26
29
|
});
|
|
27
30
|
|
|
28
31
|
// Change location
|
|
@@ -30,6 +33,9 @@ describe("<RouteListener />", () => {
|
|
|
30
33
|
routes: ["/initial", "/different"],
|
|
31
34
|
routeIndex: 1,
|
|
32
35
|
dispatch: mockDispatch,
|
|
36
|
+
state: {
|
|
37
|
+
ddMessage: { content: "test" },
|
|
38
|
+
},
|
|
33
39
|
});
|
|
34
40
|
|
|
35
41
|
expect(mockDispatch).toHaveBeenCalledWith(routines.dismissAlert());
|
|
@@ -1,31 +1,47 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
+
import { createSelector } from "reselect";
|
|
2
3
|
|
|
3
|
-
export const getMessage = (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
4
|
+
export const getMessage = createSelector(
|
|
5
|
+
[
|
|
6
|
+
_.prop("auditMessage"),
|
|
7
|
+
_.prop("authMessage"),
|
|
8
|
+
_.prop("bgMessage"),
|
|
9
|
+
_.prop("coreMessage"),
|
|
10
|
+
_.prop("ddMessage"),
|
|
11
|
+
_.prop("dfMessage"),
|
|
12
|
+
_.prop("dlMessage"),
|
|
13
|
+
_.prop("dqMessage"),
|
|
14
|
+
_.prop("ieMessage"),
|
|
15
|
+
_.prop("imMessage"),
|
|
16
|
+
_.prop("cxMessage"),
|
|
17
|
+
],
|
|
18
|
+
(
|
|
19
|
+
auditMessage,
|
|
20
|
+
authMessage,
|
|
21
|
+
bgMessage,
|
|
22
|
+
coreMessage,
|
|
23
|
+
ddMessage,
|
|
24
|
+
dfMessage,
|
|
25
|
+
dlMessage,
|
|
26
|
+
dqMessage,
|
|
27
|
+
ieMessage,
|
|
28
|
+
imMessage,
|
|
29
|
+
cxMessage
|
|
30
|
+
) =>
|
|
31
|
+
_.defaultTo(
|
|
32
|
+
{},
|
|
33
|
+
_.find(_.negate(_.isEmpty))([
|
|
34
|
+
auditMessage,
|
|
35
|
+
authMessage,
|
|
36
|
+
bgMessage,
|
|
37
|
+
ddMessage,
|
|
38
|
+
dfMessage,
|
|
39
|
+
dlMessage,
|
|
40
|
+
dqMessage,
|
|
41
|
+
ieMessage,
|
|
42
|
+
coreMessage,
|
|
43
|
+
imMessage,
|
|
44
|
+
cxMessage,
|
|
45
|
+
])
|
|
46
|
+
)
|
|
47
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { use, createContext } from "react";
|
|
2
|
+
|
|
3
|
+
const defaultContext = { disable_td_ai: false };
|
|
4
|
+
export const WebContext = createContext(defaultContext);
|
|
5
|
+
export const WebContextProvider = ({ children, value = {} }) => {
|
|
6
|
+
return (
|
|
7
|
+
<WebContext.Provider value={{ ...defaultContext, ...value }}>
|
|
8
|
+
{children}
|
|
9
|
+
</WebContext.Provider>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const useWebContext = () => use(WebContext);
|