@elliemae/pui-app-sdk 5.2.3 → 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/react.js +3 -3
- package/dist/cjs/data/{useInjectListener.js → useInjectSideEffect.js} +14 -14
- package/dist/cjs/index.js +1 -1
- package/dist/esm/data/listenerMiddleware.js +14 -18
- package/dist/esm/data/react.js +3 -3
- package/dist/esm/data/useInjectSideEffect.js +14 -0
- package/dist/esm/index.js +2 -2
- package/dist/types/lib/data/listenerMiddleware.d.ts +4 -5
- package/dist/types/lib/data/react.d.ts +1 -1
- package/dist/types/lib/data/useInjectSideEffect.d.ts +2 -0
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/esm/data/useInjectListener.js +0 -17
- package/dist/types/lib/data/useInjectListener.d.ts +0 -5
|
@@ -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
|
}
|
package/dist/cjs/data/react.js
CHANGED
|
@@ -21,12 +21,12 @@ __export(react_exports, {
|
|
|
21
21
|
useAppDispatch: () => import_useAppDispatch.useAppDispatch,
|
|
22
22
|
useAppMiddleware: () => import_useAppMiddleware.useAppMiddleware,
|
|
23
23
|
useAppSelector: () => import_useAppSelector.useAppSelector,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
useInjectQuery: () => import_useInjectQuery.useInjectQuery,
|
|
25
|
+
useInjectSideEffect: () => import_useInjectSideEffect.useInjectSideEffect
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(react_exports);
|
|
28
28
|
var import_useInjectQuery = require("./useInjectQuery.js");
|
|
29
|
-
var
|
|
29
|
+
var import_useInjectSideEffect = require("./useInjectSideEffect.js");
|
|
30
30
|
var import_useAppDispatch = require("./useAppDispatch.js");
|
|
31
31
|
var import_useAppSelector = require("./useAppSelector.js");
|
|
32
32
|
var import_useAppMiddleware = require("./useAppMiddleware.js");
|
|
@@ -16,19 +16,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var useInjectSideEffect_exports = {};
|
|
20
|
+
__export(useInjectSideEffect_exports, {
|
|
21
|
+
useInjectSideEffect: () => useInjectSideEffect
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(useInjectSideEffect_exports);
|
|
24
24
|
var import_react = require("react");
|
|
25
|
-
var
|
|
26
|
-
const
|
|
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
|
+
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -131,10 +131,10 @@ __export(lib_exports, {
|
|
|
131
131
|
useAppDispatch: () => import_react.useAppDispatch,
|
|
132
132
|
useAppMiddleware: () => import_react.useAppMiddleware,
|
|
133
133
|
useAppSelector: () => import_react.useAppSelector,
|
|
134
|
-
useInjectListener: () => import_react.useInjectListener,
|
|
135
134
|
useInjectQuery: () => import_react.useInjectQuery,
|
|
136
135
|
useInjectReducer: () => import_redux_injectors.useInjectReducer,
|
|
137
136
|
useInjectSaga: () => import_redux_injectors.useInjectSaga,
|
|
137
|
+
useInjectSideEffect: () => import_react.useInjectSideEffect,
|
|
138
138
|
useMediaQueryList: () => import_use_media_query_list.useMediaQueryList,
|
|
139
139
|
waitMessageAction: () => import_actions3.waitMessage,
|
|
140
140
|
withAppDecorator: () => import_decorator.withAppDecorator
|
|
@@ -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
|
};
|
package/dist/esm/data/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useInjectQuery } from "./useInjectQuery.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useInjectSideEffect } from "./useInjectSideEffect.js";
|
|
3
3
|
import { useAppDispatch } from "./useAppDispatch.js";
|
|
4
4
|
import { useAppSelector } from "./useAppSelector.js";
|
|
5
5
|
import { useAppMiddleware } from "./useAppMiddleware.js";
|
|
@@ -7,6 +7,6 @@ export {
|
|
|
7
7
|
useAppDispatch,
|
|
8
8
|
useAppMiddleware,
|
|
9
9
|
useAppSelector,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
useInjectQuery,
|
|
11
|
+
useInjectSideEffect
|
|
12
12
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
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
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
useInjectSideEffect
|
|
14
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "redux-injectors";
|
|
19
19
|
import {
|
|
20
20
|
useInjectQuery,
|
|
21
|
-
|
|
21
|
+
useInjectSideEffect,
|
|
22
22
|
useAppDispatch,
|
|
23
23
|
useAppSelector,
|
|
24
24
|
useAppMiddleware
|
|
@@ -225,10 +225,10 @@ export {
|
|
|
225
225
|
useAppDispatch,
|
|
226
226
|
useAppMiddleware,
|
|
227
227
|
useAppSelector,
|
|
228
|
-
useInjectListener,
|
|
229
228
|
useInjectQuery,
|
|
230
229
|
useInjectReducer,
|
|
231
230
|
useInjectSaga,
|
|
231
|
+
useInjectSideEffect,
|
|
232
232
|
useMediaQueryList,
|
|
233
233
|
waitMessage as waitMessageAction,
|
|
234
234
|
withAppDecorator
|
|
@@ -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,5 @@
|
|
|
1
1
|
export { useInjectQuery } from './useInjectQuery.js';
|
|
2
|
-
export {
|
|
2
|
+
export { useInjectSideEffect } from './useInjectSideEffect.js';
|
|
3
3
|
export { useAppDispatch } from './useAppDispatch.js';
|
|
4
4
|
export { useAppSelector } from './useAppSelector.js';
|
|
5
5
|
export { useAppMiddleware } from './useAppMiddleware.js';
|
|
@@ -9,7 +9,7 @@ export { authReducer } from './data/auth/reducer.js';
|
|
|
9
9
|
export { Page } from './view/page.js';
|
|
10
10
|
export { default as globalConstants } from './utils/constants.js';
|
|
11
11
|
export { useInjectReducer, useInjectSaga, createManager, } from 'redux-injectors';
|
|
12
|
-
export { useInjectQuery,
|
|
12
|
+
export { useInjectQuery, useInjectSideEffect, useAppDispatch, useAppSelector, useAppMiddleware, } from './data/react.js';
|
|
13
13
|
export type { AppDispatch } from './data/types.js';
|
|
14
14
|
export { errorMiddleware } from './data/errorMiddleware.js';
|
|
15
15
|
export { getAuthorizationHeader } from './utils/auth/helper.js';
|
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",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import {
|
|
3
|
-
addListener,
|
|
4
|
-
removeListener
|
|
5
|
-
} from "./listenerMiddleware.js";
|
|
6
|
-
const useInjectListener = ({
|
|
7
|
-
key,
|
|
8
|
-
listener
|
|
9
|
-
}) => useEffect(() => {
|
|
10
|
-
addListener({ key, listener });
|
|
11
|
-
return () => {
|
|
12
|
-
removeListener(key);
|
|
13
|
-
};
|
|
14
|
-
}, [key, listener]);
|
|
15
|
-
export {
|
|
16
|
-
useInjectListener
|
|
17
|
-
};
|