@elliemae/pui-app-sdk 5.17.6 → 6.0.0-alpha.1
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/wait-message/actions.js +2 -2
- package/dist/cjs/data/wait-message/reducer.js +3 -1
- package/dist/cjs/view/wait-message/index.js +11 -7
- package/dist/esm/data/wait-message/actions.js +2 -2
- package/dist/esm/data/wait-message/reducer.js +3 -1
- package/dist/esm/view/wait-message/index.js +11 -7
- package/dist/types/lib/data/wait-message/actions.d.ts +2 -1
- package/dist/types/lib/data/wait-message/reducer.d.ts +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -27,9 +27,9 @@ const ACTIONS = {
|
|
|
27
27
|
CLOSE: "wait-message/CLOSE"
|
|
28
28
|
};
|
|
29
29
|
const waitMessage = {
|
|
30
|
-
open: (message = "loading...") => ({
|
|
30
|
+
open: (message = "loading...", delay = true) => ({
|
|
31
31
|
type: ACTIONS.OPEN,
|
|
32
|
-
payload: { message }
|
|
32
|
+
payload: { message, delay }
|
|
33
33
|
}),
|
|
34
34
|
close: () => ({
|
|
35
35
|
type: ACTIONS.CLOSE,
|
|
@@ -36,13 +36,15 @@ var import_immer = __toESM(require("immer"));
|
|
|
36
36
|
var import_actions = require("./actions.js");
|
|
37
37
|
const initialState = {
|
|
38
38
|
isOpen: null,
|
|
39
|
-
message: "loading..."
|
|
39
|
+
message: "loading...",
|
|
40
|
+
delay: true
|
|
40
41
|
};
|
|
41
42
|
const waitMessageReducer = (state = initialState, action) => (0, import_immer.default)(state, (draft) => {
|
|
42
43
|
switch (action.type) {
|
|
43
44
|
case import_actions.ACTIONS.OPEN:
|
|
44
45
|
draft.isOpen = true;
|
|
45
46
|
draft.message = action.payload.message;
|
|
47
|
+
draft.delay = action.payload.delay;
|
|
46
48
|
break;
|
|
47
49
|
case import_actions.ACTIONS.CLOSE:
|
|
48
50
|
draft.isOpen = false;
|
|
@@ -58,20 +58,24 @@ const WaitMessage = (0, import_react.memo)(
|
|
|
58
58
|
const ref = (0, import_react.useRef)(false);
|
|
59
59
|
const [show, setShow] = (0, import_react.useState)(false);
|
|
60
60
|
const isOpen = (0, import_react2.useAppSelector)((state) => state.waitMessage?.isOpen);
|
|
61
|
+
const delay = (0, import_react2.useAppSelector)((state) => state.waitMessage?.delay);
|
|
61
62
|
ref.current = isOpen ?? false;
|
|
62
63
|
const message = (0, import_react2.useAppSelector)((state) => state.waitMessage?.message);
|
|
63
64
|
(0, import_react.useEffect)(() => {
|
|
64
|
-
setTimeout(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
setTimeout(
|
|
66
|
+
() => {
|
|
67
|
+
if (isOpen && ref.current) {
|
|
68
|
+
setShow(true);
|
|
69
|
+
(0, import_user_wait_event.waitStartEvent)();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
delay ? 1e3 : 0
|
|
73
|
+
);
|
|
70
74
|
if (!isOpen) {
|
|
71
75
|
setShow(false);
|
|
72
76
|
(0, import_user_wait_event.waitEndEvent)();
|
|
73
77
|
}
|
|
74
|
-
}, [isOpen]);
|
|
78
|
+
}, [delay, isOpen]);
|
|
75
79
|
(0, import_use_html_wait_message.useHTMLWaitMessage)(isOpen !== null);
|
|
76
80
|
return show ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
77
81
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_backdrop.DSBackdrop, { zIndex: theme.zIndex.loader }),
|
|
@@ -3,9 +3,9 @@ const ACTIONS = {
|
|
|
3
3
|
CLOSE: "wait-message/CLOSE"
|
|
4
4
|
};
|
|
5
5
|
const waitMessage = {
|
|
6
|
-
open: (message = "loading...") => ({
|
|
6
|
+
open: (message = "loading...", delay = true) => ({
|
|
7
7
|
type: ACTIONS.OPEN,
|
|
8
|
-
payload: { message }
|
|
8
|
+
payload: { message, delay }
|
|
9
9
|
}),
|
|
10
10
|
close: () => ({
|
|
11
11
|
type: ACTIONS.CLOSE,
|
|
@@ -2,13 +2,15 @@ import produce from "immer";
|
|
|
2
2
|
import { ACTIONS } from "./actions.js";
|
|
3
3
|
const initialState = {
|
|
4
4
|
isOpen: null,
|
|
5
|
-
message: "loading..."
|
|
5
|
+
message: "loading...",
|
|
6
|
+
delay: true
|
|
6
7
|
};
|
|
7
8
|
const waitMessageReducer = (state = initialState, action) => produce(state, (draft) => {
|
|
8
9
|
switch (action.type) {
|
|
9
10
|
case ACTIONS.OPEN:
|
|
10
11
|
draft.isOpen = true;
|
|
11
12
|
draft.message = action.payload.message;
|
|
13
|
+
draft.delay = action.payload.delay;
|
|
12
14
|
break;
|
|
13
15
|
case ACTIONS.CLOSE:
|
|
14
16
|
draft.isOpen = false;
|
|
@@ -28,20 +28,24 @@ const WaitMessage = memo(
|
|
|
28
28
|
const ref = useRef(false);
|
|
29
29
|
const [show, setShow] = useState(false);
|
|
30
30
|
const isOpen = useAppSelector((state) => state.waitMessage?.isOpen);
|
|
31
|
+
const delay = useAppSelector((state) => state.waitMessage?.delay);
|
|
31
32
|
ref.current = isOpen ?? false;
|
|
32
33
|
const message = useAppSelector((state) => state.waitMessage?.message);
|
|
33
34
|
useEffect(() => {
|
|
34
|
-
setTimeout(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
setTimeout(
|
|
36
|
+
() => {
|
|
37
|
+
if (isOpen && ref.current) {
|
|
38
|
+
setShow(true);
|
|
39
|
+
waitStartEvent();
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
delay ? 1e3 : 0
|
|
43
|
+
);
|
|
40
44
|
if (!isOpen) {
|
|
41
45
|
setShow(false);
|
|
42
46
|
waitEndEvent();
|
|
43
47
|
}
|
|
44
|
-
}, [isOpen]);
|
|
48
|
+
}, [delay, isOpen]);
|
|
45
49
|
useHTMLWaitMessage(isOpen !== null);
|
|
46
50
|
return show ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
47
51
|
/* @__PURE__ */ jsx(DSBackdrop, { zIndex: theme.zIndex.loader }),
|
|
@@ -4,8 +4,9 @@ export declare const ACTIONS: {
|
|
|
4
4
|
CLOSE: string;
|
|
5
5
|
};
|
|
6
6
|
export declare const waitMessage: {
|
|
7
|
-
open: (message?: string) => PayloadAction<{
|
|
7
|
+
open: (message?: string, delay?: boolean) => PayloadAction<{
|
|
8
8
|
message: string;
|
|
9
|
+
delay: boolean;
|
|
9
10
|
}>;
|
|
10
11
|
close: () => PayloadAction<null>;
|
|
11
12
|
};
|
|
@@ -2,6 +2,7 @@ import { PayloadAction } from '@reduxjs/toolkit';
|
|
|
2
2
|
export type WaitMessageState = {
|
|
3
3
|
isOpen: boolean | null;
|
|
4
4
|
message: string;
|
|
5
|
+
delay: boolean;
|
|
5
6
|
};
|
|
6
7
|
export declare const initialState: WaitMessageState;
|
|
7
8
|
export declare const waitMessageReducer: (state: WaitMessageState | undefined, action: PayloadAction<WaitMessageState>) => WaitMessageState;
|