@pushwoosh/smart-components-kit 1.0.33 → 1.0.35
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/ExportCSV/ExportCsvBanner/ExportCsvBanner.d.ts +3 -2
- package/ExportCSV/ExportCsvBanner/ExportCsvBanner.js +13 -3
- package/ExportCSV/ExportCsvBanner/hooks/useExportVisibility.d.ts +1 -1
- package/ExportCSV/ExportCsvBanner/hooks/useExportVisibility.js +8 -3
- package/OpenActions/usePresetOpenActions.js +1 -0
- package/package.json +2 -2
|
@@ -11,8 +11,9 @@ export type ExportTask = {
|
|
|
11
11
|
type ExportCsvBannerProps = {
|
|
12
12
|
exportTask: ExportTask | undefined;
|
|
13
13
|
updateExportTask: (exportTask: Partial<ExportTask>) => void;
|
|
14
|
-
showLastExportLocalStorageKey
|
|
14
|
+
showLastExportLocalStorageKey?: string;
|
|
15
15
|
lastTasksParams?: GetLastTasksRequest;
|
|
16
|
+
isKeepPageOpenWarning?: boolean;
|
|
16
17
|
};
|
|
17
|
-
export declare const ExportCsvBanner: ({ exportTask, updateExportTask, showLastExportLocalStorageKey, lastTasksParams, }: ExportCsvBannerProps) => React.JSX.Element | null;
|
|
18
|
+
export declare const ExportCsvBanner: ({ exportTask, updateExportTask, showLastExportLocalStorageKey, lastTasksParams, isKeepPageOpenWarning, }: ExportCsvBannerProps) => React.JSX.Element | null;
|
|
18
19
|
export {};
|
|
@@ -3,13 +3,15 @@ import { ExportResult, ProgressBar, Button } from '@pushwoosh/dumb-components';
|
|
|
3
3
|
import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
4
4
|
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
5
5
|
import { DangerTriangleIcon, DownloadIcon } from '@pushwoosh/kit-icons';
|
|
6
|
+
import { Text } from '@pushwoosh/kit-typography';
|
|
6
7
|
import { useExportService } from '../useExportService';
|
|
7
8
|
import { useExportVisibility } from './hooks/useExportVisibility';
|
|
8
9
|
export const ExportCsvBanner = ({
|
|
9
10
|
exportTask,
|
|
10
11
|
updateExportTask,
|
|
11
12
|
showLastExportLocalStorageKey,
|
|
12
|
-
lastTasksParams
|
|
13
|
+
lastTasksParams,
|
|
14
|
+
isKeepPageOpenWarning
|
|
13
15
|
}) => {
|
|
14
16
|
const {
|
|
15
17
|
getLastTasks,
|
|
@@ -105,10 +107,18 @@ export const ExportCsvBanner = ({
|
|
|
105
107
|
view: "filled"
|
|
106
108
|
})
|
|
107
109
|
}, "Download CSV"))
|
|
108
|
-
}), status === 'STATUS_PENDING' && React.createElement(ProgressBar, {
|
|
110
|
+
}), status === 'STATUS_PENDING' && (isKeepPageOpenWarning ? React.createElement(ProgressBar, {
|
|
111
|
+
title: progressTitle,
|
|
112
|
+
percentValue: progress,
|
|
113
|
+
rightSlot: React.createElement(Text, {
|
|
114
|
+
"$color": Color.WARNING,
|
|
115
|
+
"$variant": "h5",
|
|
116
|
+
"$uppercase": true
|
|
117
|
+
}, "Keep page open during export")
|
|
118
|
+
}) : React.createElement(ProgressBar, {
|
|
109
119
|
title: progressTitle,
|
|
110
120
|
percentValue: progress
|
|
111
|
-
}), status === 'STATUS_FAILED' && React.createElement(ExportResult, {
|
|
121
|
+
})), status === 'STATUS_FAILED' && React.createElement(ExportResult, {
|
|
112
122
|
type: "error",
|
|
113
123
|
title: "Export failed",
|
|
114
124
|
subtitle: "Please try again",
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react';
|
|
2
2
|
export const useExportVisibility = key => {
|
|
3
|
-
const [isHidden, setIsHidden] = useState(() =>
|
|
3
|
+
const [isHidden, setIsHidden] = useState(() => {
|
|
4
|
+
if (!key) return false;
|
|
5
|
+
return Boolean(+(localStorage.getItem(key) ?? 0));
|
|
6
|
+
});
|
|
4
7
|
const hide = useCallback(() => {
|
|
5
|
-
localStorage.setItem(key, '1');
|
|
6
8
|
setIsHidden(true);
|
|
9
|
+
if (!key) return;
|
|
10
|
+
localStorage.setItem(key, '1');
|
|
7
11
|
}, [key]);
|
|
8
12
|
const show = useCallback(() => {
|
|
9
|
-
localStorage.setItem(key, '0');
|
|
10
13
|
setIsHidden(false);
|
|
14
|
+
if (!key) return;
|
|
15
|
+
localStorage.setItem(key, '0');
|
|
11
16
|
}, [key]);
|
|
12
17
|
return {
|
|
13
18
|
isHidden,
|
|
@@ -47,6 +47,7 @@ export const usePresetOpenActions = pushPreset => {
|
|
|
47
47
|
defaultDeeplinkUrl = deeplinkManual.url;
|
|
48
48
|
}
|
|
49
49
|
// setTimeout нужен, чтобы не получать ошибку 'ResizeObserver loop completed with undelivered notifications.'
|
|
50
|
+
// Она возникает, когда этот хук вызывается ВНУТРИ Modal и с пересчетом её размера. Подробности в тикете FRONT-750
|
|
50
51
|
setTimeout(() => {
|
|
51
52
|
setOpenActions({
|
|
52
53
|
webPageUrl,
|
package/package.json
CHANGED
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@pushwoosh/grpc-bridge": "^1.5.36",
|
|
44
44
|
"@pushwoosh/http-client": "^2.5.0",
|
|
45
|
-
"@pushwoosh/rpc-v2-http-api-data": "^0.1.501",
|
|
46
45
|
"@pushwoosh/rpc-gateway-journey-data": "^0.26.206",
|
|
46
|
+
"@pushwoosh/rpc-v2-http-api-data": "^0.1.566",
|
|
47
47
|
"@pushwoosh/session-store": "^2.5.0",
|
|
48
48
|
"react": "^16.14.0 || ^18.0.0",
|
|
49
49
|
"react-dom": "^16.14.0 || ^18.0.0"
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">= 18"
|
|
53
53
|
},
|
|
54
|
-
"version": "1.0.
|
|
54
|
+
"version": "1.0.35"
|
|
55
55
|
}
|