@elliemae/pui-app-sdk 5.2.0 → 5.2.2
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 +9 -8
- package/dist/cjs/data/types.js +16 -0
- package/dist/esm/data/listenerMiddleware.js +14 -9
- package/dist/esm/data/types.js +0 -0
- package/dist/types/lib/data/listenerMiddleware.d.ts +5 -6
- package/dist/types/lib/data/types.d.ts +6 -0
- package/dist/types/lib/data/useAppDispatch.d.ts +1 -7
- package/dist/types/lib/data/useInjectListener.d.ts +3 -3
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -38,21 +38,22 @@ const addListener = ({
|
|
|
38
38
|
}) => {
|
|
39
39
|
if (listenerDispatchFns.has(key) && listenerAPI) {
|
|
40
40
|
listenerDispatchFns.set(key, listener);
|
|
41
|
-
|
|
41
|
+
listenerAPI.dispatch((0, import_toolkit.addListener)(listener));
|
|
42
42
|
}
|
|
43
|
-
return null;
|
|
44
43
|
};
|
|
45
44
|
const removeListener = (key) => {
|
|
46
45
|
const listener = listenerDispatchFns.get(key);
|
|
47
|
-
if (listener) {
|
|
46
|
+
if (listener && listenerAPI) {
|
|
48
47
|
listenerDispatchFns.delete(key);
|
|
49
|
-
|
|
48
|
+
listenerAPI.dispatch((0, import_toolkit.removeListener)(listener));
|
|
50
49
|
}
|
|
51
50
|
return true;
|
|
52
51
|
};
|
|
53
52
|
const resetListeners = () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
if (listenerAPI) {
|
|
54
|
+
listenerDispatchFns.forEach((listener) => {
|
|
55
|
+
listenerAPI.dispatch((0, import_toolkit.removeListener)(listener));
|
|
56
|
+
});
|
|
57
|
+
listenerDispatchFns.clear();
|
|
58
|
+
}
|
|
58
59
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createListenerMiddleware,
|
|
3
|
+
addListener as rtkAddListener,
|
|
4
|
+
removeListener as rtkRemoveListener
|
|
5
|
+
} from "@reduxjs/toolkit";
|
|
2
6
|
let listenerAPI;
|
|
3
7
|
const rtkListenerMiddleware = createListenerMiddleware();
|
|
4
8
|
const listenerDispatchFns = /* @__PURE__ */ new Map();
|
|
@@ -12,23 +16,24 @@ const addListener = ({
|
|
|
12
16
|
}) => {
|
|
13
17
|
if (listenerDispatchFns.has(key) && listenerAPI) {
|
|
14
18
|
listenerDispatchFns.set(key, listener);
|
|
15
|
-
|
|
19
|
+
listenerAPI.dispatch(rtkAddListener(listener));
|
|
16
20
|
}
|
|
17
|
-
return null;
|
|
18
21
|
};
|
|
19
22
|
const removeListener = (key) => {
|
|
20
23
|
const listener = listenerDispatchFns.get(key);
|
|
21
|
-
if (listener) {
|
|
24
|
+
if (listener && listenerAPI) {
|
|
22
25
|
listenerDispatchFns.delete(key);
|
|
23
|
-
|
|
26
|
+
listenerAPI.dispatch(rtkRemoveListener(listener));
|
|
24
27
|
}
|
|
25
28
|
return true;
|
|
26
29
|
};
|
|
27
30
|
const resetListeners = () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
if (listenerAPI) {
|
|
32
|
+
listenerDispatchFns.forEach((listener) => {
|
|
33
|
+
listenerAPI.dispatch(rtkRemoveListener(listener));
|
|
34
|
+
});
|
|
35
|
+
listenerDispatchFns.clear();
|
|
36
|
+
}
|
|
32
37
|
};
|
|
33
38
|
export {
|
|
34
39
|
addListener,
|
|
File without changes
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Middleware
|
|
2
|
-
|
|
3
|
-
export type
|
|
1
|
+
import { Middleware } from 'redux';
|
|
2
|
+
import { TypedAddListener } from '@reduxjs/toolkit';
|
|
3
|
+
export type TypedAddListnerArgs<State> = Parameters<TypedAddListener<State>>[0];
|
|
4
4
|
export declare const listenerMiddleware: Middleware<any, any>;
|
|
5
5
|
export declare const addListener: ({ key, listener, }: {
|
|
6
6
|
key: string;
|
|
7
|
-
listener:
|
|
8
|
-
}) =>
|
|
7
|
+
listener: TypedAddListnerArgs<any>;
|
|
8
|
+
}) => void;
|
|
9
9
|
export declare const removeListener: (key: string) => boolean;
|
|
10
10
|
export declare const resetListeners: () => void;
|
|
11
|
-
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Dispatch, PayloadAction, AnyAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { WaitMessageState } from './wait-message/reducer.js';
|
|
3
|
+
import { BreakpointState } from './breakpoint/index.js';
|
|
4
|
+
import { ErrorState } from './error/index.js';
|
|
5
|
+
import { LiveMessageState } from './live-message/index.js';
|
|
6
|
+
export type AppDispatch = Dispatch<PayloadAction<WaitMessageState> | PayloadAction<BreakpointState> | PayloadAction<ErrorState> | PayloadAction<LiveMessageState> | AnyAction>;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { WaitMessageState } from './wait-message/reducer.js';
|
|
3
|
-
import { BreakpointState } from './breakpoint/index.js';
|
|
4
|
-
import { ErrorState } from './error/index.js';
|
|
5
|
-
import { LiveMessageState } from './live-message/index.js';
|
|
6
|
-
type AppDispatch = Dispatch<PayloadAction<WaitMessageState> | PayloadAction<BreakpointState> | PayloadAction<ErrorState> | PayloadAction<LiveMessageState> | AnyAction>;
|
|
1
|
+
import { AppDispatch } from './types.js';
|
|
7
2
|
export declare const useAppDispatch: () => AppDispatch;
|
|
8
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useInjectListener: ({ key, listener, }: {
|
|
1
|
+
import { TypedAddListnerArgs } from './listenerMiddleware.js';
|
|
2
|
+
export declare const useInjectListener: <State>({ key, listener, }: {
|
|
3
3
|
key: string;
|
|
4
|
-
listener:
|
|
4
|
+
listener: TypedAddListnerArgs<State>;
|
|
5
5
|
}) => void;
|
|
@@ -10,7 +10,7 @@ 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
12
|
export { useInjectQuery, useInjectListener, useAppDispatch, useAppSelector, useAppMiddleware, } from './data/react.js';
|
|
13
|
-
export type {
|
|
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';
|
|
16
16
|
export { getRedirectUrl, removeDoubleSlash } from './utils/url.js';
|