@elliemae/pui-app-sdk 5.2.4 → 5.2.5
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/data/listenerMiddleware.js +13 -13
- package/dist/cjs/data/useInjectSideEffect.js +10 -10
- package/dist/esm/data/listenerMiddleware.js +14 -18
- package/dist/esm/data/useInjectSideEffect.js +10 -13
- package/dist/types/lib/data/listenerMiddleware.d.ts +4 -5
- package/dist/types/lib/data/useInjectSideEffect.d.ts +2 -5
- package/package.json +2 -2
|
@@ -18,10 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var listenerMiddleware_exports = {};
|
|
20
20
|
__export(listenerMiddleware_exports, {
|
|
21
|
-
|
|
21
|
+
addSideEffect: () => addSideEffect,
|
|
22
22
|
listenerMiddleware: () => listenerMiddleware,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
removeSideEffect: () => removeSideEffect,
|
|
24
|
+
resetSideEffects: () => resetSideEffects
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(listenerMiddleware_exports);
|
|
27
27
|
var import_toolkit = require("@reduxjs/toolkit");
|
|
@@ -32,27 +32,27 @@ const listenerMiddleware = (_listenerAPI) => {
|
|
|
32
32
|
listenerAPI = _listenerAPI;
|
|
33
33
|
return rtkListenerMiddleware.middleware(listenerAPI);
|
|
34
34
|
};
|
|
35
|
-
const
|
|
35
|
+
const addSideEffect = ({
|
|
36
36
|
key,
|
|
37
37
|
listener
|
|
38
38
|
}) => {
|
|
39
39
|
if (!listenerDispatchFns.has(key) && listenerAPI) {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const unsubscribe = listenerAPI.dispatch(listener);
|
|
41
|
+
listenerDispatchFns.set(key, unsubscribe);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
44
|
+
const removeSideEffect = (key) => {
|
|
45
|
+
const unsubscribe = listenerDispatchFns.get(key);
|
|
46
|
+
if (unsubscribe && listenerAPI) {
|
|
47
47
|
listenerDispatchFns.delete(key);
|
|
48
|
-
listenerAPI.dispatch(
|
|
48
|
+
listenerAPI.dispatch(unsubscribe);
|
|
49
49
|
}
|
|
50
50
|
return true;
|
|
51
51
|
};
|
|
52
|
-
const
|
|
52
|
+
const resetSideEffects = () => {
|
|
53
53
|
if (listenerAPI) {
|
|
54
|
-
listenerDispatchFns.forEach((
|
|
55
|
-
listenerAPI.dispatch(
|
|
54
|
+
listenerDispatchFns.forEach((unsubscribe) => {
|
|
55
|
+
listenerAPI.dispatch(unsubscribe);
|
|
56
56
|
});
|
|
57
57
|
listenerDispatchFns.clear();
|
|
58
58
|
}
|
|
@@ -22,13 +22,13 @@ __export(useInjectSideEffect_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(useInjectSideEffect_exports);
|
|
24
24
|
var import_react = require("react");
|
|
25
|
-
var
|
|
26
|
-
const useInjectSideEffect = ({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
}
|
|
25
|
+
var import_useAppDispatch = require("./useAppDispatch.js");
|
|
26
|
+
const useInjectSideEffect = (listener) => {
|
|
27
|
+
const dispatch = (0, import_useAppDispatch.useAppDispatch)();
|
|
28
|
+
(0, import_react.useEffect)(() => {
|
|
29
|
+
const unsubscribe = dispatch(listener);
|
|
30
|
+
return () => {
|
|
31
|
+
dispatch(unsubscribe);
|
|
32
|
+
};
|
|
33
|
+
}, [listener, dispatch]);
|
|
34
|
+
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createListenerMiddleware,
|
|
3
|
-
addListener as rtkAddListener,
|
|
4
|
-
removeListener as rtkRemoveListener
|
|
5
|
-
} from "@reduxjs/toolkit";
|
|
1
|
+
import { createListenerMiddleware } from "@reduxjs/toolkit";
|
|
6
2
|
let listenerAPI;
|
|
7
3
|
const rtkListenerMiddleware = createListenerMiddleware();
|
|
8
4
|
const listenerDispatchFns = /* @__PURE__ */ new Map();
|
|
@@ -10,34 +6,34 @@ const listenerMiddleware = (_listenerAPI) => {
|
|
|
10
6
|
listenerAPI = _listenerAPI;
|
|
11
7
|
return rtkListenerMiddleware.middleware(listenerAPI);
|
|
12
8
|
};
|
|
13
|
-
const
|
|
9
|
+
const addSideEffect = ({
|
|
14
10
|
key,
|
|
15
11
|
listener
|
|
16
12
|
}) => {
|
|
17
13
|
if (!listenerDispatchFns.has(key) && listenerAPI) {
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const unsubscribe = listenerAPI.dispatch(listener);
|
|
15
|
+
listenerDispatchFns.set(key, unsubscribe);
|
|
20
16
|
}
|
|
21
17
|
};
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
18
|
+
const removeSideEffect = (key) => {
|
|
19
|
+
const unsubscribe = listenerDispatchFns.get(key);
|
|
20
|
+
if (unsubscribe && listenerAPI) {
|
|
25
21
|
listenerDispatchFns.delete(key);
|
|
26
|
-
listenerAPI.dispatch(
|
|
22
|
+
listenerAPI.dispatch(unsubscribe);
|
|
27
23
|
}
|
|
28
24
|
return true;
|
|
29
25
|
};
|
|
30
|
-
const
|
|
26
|
+
const resetSideEffects = () => {
|
|
31
27
|
if (listenerAPI) {
|
|
32
|
-
listenerDispatchFns.forEach((
|
|
33
|
-
listenerAPI.dispatch(
|
|
28
|
+
listenerDispatchFns.forEach((unsubscribe) => {
|
|
29
|
+
listenerAPI.dispatch(unsubscribe);
|
|
34
30
|
});
|
|
35
31
|
listenerDispatchFns.clear();
|
|
36
32
|
}
|
|
37
33
|
};
|
|
38
34
|
export {
|
|
39
|
-
|
|
35
|
+
addSideEffect,
|
|
40
36
|
listenerMiddleware,
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
removeSideEffect,
|
|
38
|
+
resetSideEffects
|
|
43
39
|
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
removeListener(key);
|
|
13
|
-
};
|
|
14
|
-
}, [key, listener]);
|
|
2
|
+
import { useAppDispatch } from "./useAppDispatch.js";
|
|
3
|
+
const useInjectSideEffect = (listener) => {
|
|
4
|
+
const dispatch = useAppDispatch();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const unsubscribe = dispatch(listener);
|
|
7
|
+
return () => {
|
|
8
|
+
dispatch(unsubscribe);
|
|
9
|
+
};
|
|
10
|
+
}, [listener, dispatch]);
|
|
11
|
+
};
|
|
15
12
|
export {
|
|
16
13
|
useInjectSideEffect
|
|
17
14
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Middleware } from 'redux';
|
|
2
2
|
import { TypedAddListener } from '@reduxjs/toolkit';
|
|
3
|
-
export type TypedAddListnerArgs<State> = Parameters<TypedAddListener<State>>[0];
|
|
4
3
|
export declare const listenerMiddleware: Middleware<any, any>;
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const addSideEffect: ({ key, listener, }: {
|
|
6
5
|
key: string;
|
|
7
|
-
listener:
|
|
6
|
+
listener: TypedAddListener<unknown>;
|
|
8
7
|
}) => void;
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
8
|
+
export declare const removeSideEffect: (key: string) => boolean;
|
|
9
|
+
export declare const resetSideEffects: () => void;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useInjectSideEffect: <
|
|
3
|
-
key: string;
|
|
4
|
-
listener: TypedAddListnerArgs<State>;
|
|
5
|
-
}) => void;
|
|
1
|
+
import { TypedAddListener } from '@reduxjs/toolkit';
|
|
2
|
+
export declare const useInjectSideEffect: (listener: TypedAddListener<unknown>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/pui-app-sdk",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.5",
|
|
4
4
|
"description": "ICE MT UI Platform Application SDK ",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"@elliemae/ds-popperjs": "~3.14.13",
|
|
152
152
|
"@elliemae/ds-toast": "~3.14.13",
|
|
153
153
|
"@elliemae/em-ssf-guest": "~1.11.3",
|
|
154
|
-
"@elliemae/pui-cli": "~8.
|
|
154
|
+
"@elliemae/pui-cli": "~8.5.0",
|
|
155
155
|
"@elliemae/pui-diagnostics": "~3.1.0",
|
|
156
156
|
"@elliemae/pui-doc-gen": "~1.6.4",
|
|
157
157
|
"@elliemae/pui-e2e-test-sdk": "~8.0.0",
|