@abtnode/ux 1.16.21-beta-445a8baa → 1.16.21-beta-2e75c75c
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/es/blocklet/component/index.js +37 -26
- package/es/blocklet/storage/auto-check-update.js +70 -0
- package/es/contexts/blocklet-storage.js +19 -0
- package/es/hooks/use-auto-check-update.js +33 -0
- package/es/hooks/use-check-update-by-url.js +28 -0
- package/es/hooks/use-event-listen.js +11 -0
- package/es/hooks/use-passport-id.js +2 -1
- package/es/issue-passport.js +30 -19
- package/es/locales/en.js +7 -0
- package/es/locales/zh.js +7 -0
- package/es/notifications/list.js +31 -8
- package/lib/blocklet/component/index.js +37 -26
- package/lib/blocklet/storage/auto-check-update.js +83 -0
- package/lib/contexts/blocklet-storage.js +19 -0
- package/lib/hooks/use-auto-check-update.js +43 -0
- package/lib/hooks/use-check-update-by-url.js +37 -0
- package/lib/hooks/use-event-listen.js +17 -0
- package/lib/hooks/use-passport-id.js +2 -1
- package/lib/issue-passport.js +31 -19
- package/lib/locales/en.js +7 -0
- package/lib/locales/zh.js +7 -0
- package/lib/notifications/list.js +31 -8
- package/package.json +19 -19
|
@@ -39,6 +39,7 @@ import BlockletSource from '../blocklet-source';
|
|
|
39
39
|
import BlockletStatus from '../status';
|
|
40
40
|
import BlockletVersion from '../version';
|
|
41
41
|
import Confirm from '../../confirm';
|
|
42
|
+
import AutoCheckUpdate from '../storage/auto-check-update';
|
|
42
43
|
import { useNodeContext } from '../../contexts/node';
|
|
43
44
|
import { formatPerson, formatError, sleep, BlockletAdminRoles, formatToDatetime } from '../../util';
|
|
44
45
|
import Permission from '../../permission';
|
|
@@ -52,6 +53,7 @@ import AddComponent from './add';
|
|
|
52
53
|
import AddRule from '../router/action/add-rule';
|
|
53
54
|
import RuleList from '../router/rule-list';
|
|
54
55
|
import Actions from '../../actions';
|
|
56
|
+
import { useCheckUpdateByUrl } from '../../hooks/use-check-update-by-url';
|
|
55
57
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
56
58
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
57
59
|
const getEngineRows = (engine, t) => {
|
|
@@ -726,6 +728,7 @@ export default function BlockletComponent({
|
|
|
726
728
|
};
|
|
727
729
|
});
|
|
728
730
|
};
|
|
731
|
+
useCheckUpdateByUrl(checkForUpdates);
|
|
729
732
|
return /*#__PURE__*/_jsxs(Div, {
|
|
730
733
|
component: "div",
|
|
731
734
|
...rest,
|
|
@@ -733,36 +736,44 @@ export default function BlockletComponent({
|
|
|
733
736
|
display: "flex",
|
|
734
737
|
justifyContent: "space-between",
|
|
735
738
|
alignItems: "center",
|
|
736
|
-
children: [/*#__PURE__*/_jsxs(
|
|
739
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
737
740
|
className: "title",
|
|
741
|
+
flexDirection: "row",
|
|
742
|
+
display: "flex",
|
|
743
|
+
alignItems: "center",
|
|
744
|
+
style: {
|
|
745
|
+
marginLeft: '1em'
|
|
746
|
+
},
|
|
738
747
|
children: [t('common.components'), !needMigration && /*#__PURE__*/_jsx(Permission, {
|
|
739
748
|
permission: inService ? '' : 'mutate_blocklets',
|
|
740
749
|
role: inService ? BlockletAdminRoles : [],
|
|
741
|
-
children: /*#__PURE__*/_jsx(
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
750
|
+
children: /*#__PURE__*/_jsx(AutoCheckUpdate, {
|
|
751
|
+
children: /*#__PURE__*/_jsx(StyledBadge, {
|
|
752
|
+
top: 1.2,
|
|
753
|
+
right: 0.4,
|
|
754
|
+
color: "error",
|
|
755
|
+
badgeContent: "",
|
|
756
|
+
variant: "dot",
|
|
757
|
+
invisible: !showUpdateDot,
|
|
758
|
+
children: /*#__PURE__*/_jsxs(Button, {
|
|
759
|
+
disabled: loading || isInProgress(blocklet.status),
|
|
760
|
+
color: "secondary",
|
|
761
|
+
onClick: () => {
|
|
762
|
+
checkForUpdates();
|
|
763
|
+
},
|
|
764
|
+
"data-cy": "check-for-updates",
|
|
765
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
766
|
+
mr: 0.5,
|
|
767
|
+
display: "flex",
|
|
768
|
+
children: loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
769
|
+
size: 16
|
|
770
|
+
}) : /*#__PURE__*/_jsx(UpdateIcon, {
|
|
771
|
+
style: {
|
|
772
|
+
fontSize: '1em'
|
|
773
|
+
}
|
|
774
|
+
})
|
|
775
|
+
}), t('blocklet.component.checkUpdateTitle')]
|
|
776
|
+
})
|
|
766
777
|
})
|
|
767
778
|
})
|
|
768
779
|
})]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
7
|
+
import SwitchControl from '../component/switch-control';
|
|
8
|
+
import { useBlockletStorageContext } from '../../contexts/blocklet-storage';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* @param {{
|
|
13
|
+
* style: import('react').CSSProperties
|
|
14
|
+
* }} {...rest}
|
|
15
|
+
* @return {*}
|
|
16
|
+
*/
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
function AutoCheckUpdate({
|
|
20
|
+
children,
|
|
21
|
+
...rest
|
|
22
|
+
}) {
|
|
23
|
+
const {
|
|
24
|
+
t
|
|
25
|
+
} = useLocaleContext();
|
|
26
|
+
const {
|
|
27
|
+
updateAutoCheckUpdate,
|
|
28
|
+
autoCheckUpdate
|
|
29
|
+
} = useBlockletStorageContext();
|
|
30
|
+
const configAutoBackup = async () => {
|
|
31
|
+
try {
|
|
32
|
+
const enabled = !autoCheckUpdate?.enabled;
|
|
33
|
+
await updateAutoCheckUpdate({
|
|
34
|
+
enabled
|
|
35
|
+
});
|
|
36
|
+
Toast.success(enabled ? t('storage.spaces.autoCheckUpdate.enabled') : t('storage.spaces.autoCheckUpdate.disabled'));
|
|
37
|
+
} catch (error) {
|
|
38
|
+
Toast.error(error.message);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const enabled = Boolean(autoCheckUpdate?.enabled);
|
|
42
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "row",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
children: [children, /*#__PURE__*/_jsx(Tooltip, {
|
|
47
|
+
title: t('storage.spaces.autoCheckUpdate.title'),
|
|
48
|
+
arrow: true,
|
|
49
|
+
placement: "right",
|
|
50
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
51
|
+
children: /*#__PURE__*/_jsx(SwitchControl, {
|
|
52
|
+
checked: enabled,
|
|
53
|
+
onChange: configAutoBackup,
|
|
54
|
+
name: "enableWelcomePage",
|
|
55
|
+
style: {
|
|
56
|
+
...rest.style,
|
|
57
|
+
zoom: 0.8
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
AutoCheckUpdate.propTypes = {
|
|
65
|
+
children: PropTypes.any
|
|
66
|
+
};
|
|
67
|
+
AutoCheckUpdate.defaultProps = {
|
|
68
|
+
children: null
|
|
69
|
+
};
|
|
70
|
+
export default AutoCheckUpdate;
|
|
@@ -10,6 +10,7 @@ import { useNodeContext } from './node';
|
|
|
10
10
|
import useBackupProgress from '../hooks/use-backup-progress';
|
|
11
11
|
import useBackups from '../hooks/use-backups';
|
|
12
12
|
import { useAutoBackup } from '../hooks/use-auto-backup';
|
|
13
|
+
import { useAutoCheckUpdate } from '../hooks/use-auto-check-update';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @typedef {import('../blocklet/storage/connected').SpaceGateway} SpaceGateway
|
|
@@ -86,6 +87,10 @@ function BlockletStorageProvider({
|
|
|
86
87
|
const autoBackup = useAutoBackup({
|
|
87
88
|
deps: [autoBackupRefresh]
|
|
88
89
|
});
|
|
90
|
+
const [autoCheckUpdateRefresh, setAutoCheckUpdateRefresh] = useState(false);
|
|
91
|
+
const autoCheckUpdate = useAutoCheckUpdate({
|
|
92
|
+
deps: [autoCheckUpdateRefresh]
|
|
93
|
+
});
|
|
89
94
|
const refreshSpaceGateways = () => {
|
|
90
95
|
setSpaceGatewaysRefresh(p => !p);
|
|
91
96
|
};
|
|
@@ -95,6 +100,9 @@ function BlockletStorageProvider({
|
|
|
95
100
|
const refreshAutoBackup = () => {
|
|
96
101
|
setAutoBackupRefresh(x => !x);
|
|
97
102
|
};
|
|
103
|
+
const refreshAutoCheckUpdate = () => {
|
|
104
|
+
setAutoCheckUpdateRefresh(x => !x);
|
|
105
|
+
};
|
|
98
106
|
|
|
99
107
|
/**
|
|
100
108
|
* @description
|
|
@@ -200,6 +208,15 @@ function BlockletStorageProvider({
|
|
|
200
208
|
});
|
|
201
209
|
refreshAutoBackup();
|
|
202
210
|
};
|
|
211
|
+
const updateAutoCheckUpdate = async value => {
|
|
212
|
+
await api.updateAutoCheckUpdate({
|
|
213
|
+
input: {
|
|
214
|
+
did: blocklet.meta.did,
|
|
215
|
+
autoCheckUpdate: value
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
refreshAutoCheckUpdate();
|
|
219
|
+
};
|
|
203
220
|
return /*#__PURE__*/_jsx(Provider, {
|
|
204
221
|
value: {
|
|
205
222
|
spaceGateways,
|
|
@@ -211,6 +228,8 @@ function BlockletStorageProvider({
|
|
|
211
228
|
spaceGatewaysLoading,
|
|
212
229
|
spaceGatewayIsSelected,
|
|
213
230
|
updateAutoBackup,
|
|
231
|
+
updateAutoCheckUpdate,
|
|
232
|
+
autoCheckUpdate,
|
|
214
233
|
backupEndpoint,
|
|
215
234
|
backupProgress,
|
|
216
235
|
backups,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
import { useAsyncEffect } from 'ahooks';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useBlockletContext } from '../contexts/blocklet';
|
|
5
|
+
import { useNodeContext } from '../contexts/node';
|
|
6
|
+
export function useAutoCheckUpdate({
|
|
7
|
+
deps
|
|
8
|
+
} = {
|
|
9
|
+
deps: []
|
|
10
|
+
}) {
|
|
11
|
+
/** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
|
|
12
|
+
const {
|
|
13
|
+
blocklet
|
|
14
|
+
} = useBlockletContext();
|
|
15
|
+
/** @type {{api: import('@abtnode/client')}} */
|
|
16
|
+
const {
|
|
17
|
+
api
|
|
18
|
+
} = useNodeContext();
|
|
19
|
+
const [autoCheckUpdate, setAutoCheckUpdate] = useState(null);
|
|
20
|
+
useAsyncEffect(async () => {
|
|
21
|
+
if (blocklet?.meta?.did) {
|
|
22
|
+
const {
|
|
23
|
+
autoCheckUpdate: data
|
|
24
|
+
} = await api.getAutoCheckUpdate({
|
|
25
|
+
input: {
|
|
26
|
+
did: blocklet.meta.did
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
setAutoCheckUpdate(data);
|
|
30
|
+
}
|
|
31
|
+
}, [blocklet?.meta?.did].concat(deps));
|
|
32
|
+
return autoCheckUpdate;
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
|
+
import useEventListen from './use-event-listen';
|
|
6
|
+
export function dispatchCheckUpdate() {
|
|
7
|
+
window.dispatchEvent(new CustomEvent('checkUpdate'));
|
|
8
|
+
}
|
|
9
|
+
export function useCheckUpdateByUrl(event) {
|
|
10
|
+
const navigate = useNavigate();
|
|
11
|
+
const {
|
|
12
|
+
t
|
|
13
|
+
} = useLocaleContext();
|
|
14
|
+
const handle = () => {
|
|
15
|
+
const params = new URLSearchParams(window.location.search);
|
|
16
|
+
if (params.get('checkUpdate')) {
|
|
17
|
+
params.delete('checkUpdate');
|
|
18
|
+
navigate(params.toString());
|
|
19
|
+
event();
|
|
20
|
+
Toast.success(t('notification.checkingForUpdates'));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
useEffect(handle, []);
|
|
26
|
+
useEventListen('checkUpdate', handle);
|
|
27
|
+
}
|
|
28
|
+
export default useCheckUpdateByUrl;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
function useEventListen(key, callback) {
|
|
3
|
+
// reduce rerender
|
|
4
|
+
const ref = useRef(callback);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const event = e => ref.current(e.detail);
|
|
7
|
+
window.addEventListener(key, event);
|
|
8
|
+
return () => window.removeEventListener(key, event);
|
|
9
|
+
}, [key]);
|
|
10
|
+
}
|
|
11
|
+
export default useEventListen;
|
package/es/issue-passport.js
CHANGED
|
@@ -8,6 +8,7 @@ import Box from '@mui/material/Box';
|
|
|
8
8
|
import Center from '@arcblock/ux/lib/Center';
|
|
9
9
|
import Button from '@arcblock/ux/lib/Button';
|
|
10
10
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
11
|
+
import Fullpage from '@arcblock/did-connect/lib/Connect/fullpage';
|
|
11
12
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
12
13
|
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
13
14
|
import wrapLocale from './wrap-locale';
|
|
@@ -94,25 +95,35 @@ function IssuePassport({
|
|
|
94
95
|
})]
|
|
95
96
|
})
|
|
96
97
|
})
|
|
97
|
-
}) : /*#__PURE__*/_jsx(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
98
|
+
}) : /*#__PURE__*/_jsx(Fullpage, {
|
|
99
|
+
did: window?.blocklet?.appPid || window?.env?.appPid,
|
|
100
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
101
|
+
sx: {
|
|
102
|
+
width: '560px',
|
|
103
|
+
maxWidth: '100%',
|
|
104
|
+
height: '100%'
|
|
105
|
+
},
|
|
106
|
+
children: /*#__PURE__*/_jsx(DidConnect, {
|
|
107
|
+
className: "connect",
|
|
108
|
+
action: "issue-passport",
|
|
109
|
+
forceConnected: false,
|
|
110
|
+
autoConnect: false,
|
|
111
|
+
checkFn: api.get,
|
|
112
|
+
checkTimeout: 10 * 60 * 1000,
|
|
113
|
+
webWalletUrl: webWalletUrl,
|
|
114
|
+
onSuccess: onReceivePassport,
|
|
115
|
+
locale: locale,
|
|
116
|
+
messages: {
|
|
117
|
+
title: t('issuePassport.title'),
|
|
118
|
+
scan: t('issuePassport.description', {
|
|
119
|
+
name: window.env.appName
|
|
120
|
+
}),
|
|
121
|
+
confirm: t('issuePassport.dialog.confirm'),
|
|
122
|
+
success: t('issuePassport.dialog.success')
|
|
123
|
+
},
|
|
124
|
+
extraParams: extraParams
|
|
125
|
+
})
|
|
126
|
+
})
|
|
116
127
|
})
|
|
117
128
|
});
|
|
118
129
|
}
|
package/es/locales/en.js
CHANGED
|
@@ -842,6 +842,8 @@ export default {
|
|
|
842
842
|
showRead: 'Show Read',
|
|
843
843
|
markAllAsRead: 'Mark All as Read',
|
|
844
844
|
markAsRead: 'Mark As Read',
|
|
845
|
+
proceed: 'Proceed',
|
|
846
|
+
checkingForUpdates: 'Checking for updates...',
|
|
845
847
|
email: {
|
|
846
848
|
enable: 'Enable email notification',
|
|
847
849
|
from: 'Email sender',
|
|
@@ -1524,6 +1526,11 @@ export default {
|
|
|
1524
1526
|
enabled: 'Automatic backup is on',
|
|
1525
1527
|
disabled: 'Automatic backup is off'
|
|
1526
1528
|
},
|
|
1529
|
+
autoCheckUpdate: {
|
|
1530
|
+
title: 'Automatically check for new version notification',
|
|
1531
|
+
enabled: 'Automatically check for new version is on',
|
|
1532
|
+
disabled: 'Automatically check for new version is off'
|
|
1533
|
+
},
|
|
1527
1534
|
backupSuccessfully: 'Backup successfully',
|
|
1528
1535
|
restore: 'Restore',
|
|
1529
1536
|
restoreSuccessfully: 'Restore successfully',
|
package/es/locales/zh.js
CHANGED
|
@@ -845,6 +845,8 @@ export default {
|
|
|
845
845
|
showRead: '显示已读',
|
|
846
846
|
markAllAsRead: '全部标记为已读',
|
|
847
847
|
markAsRead: '标记为已读',
|
|
848
|
+
proceed: '处理',
|
|
849
|
+
checkingForUpdates: '正在检查更新...',
|
|
848
850
|
email: {
|
|
849
851
|
enable: '是否开启 Email 通知',
|
|
850
852
|
from: '发件人邮箱',
|
|
@@ -1529,6 +1531,11 @@ export default {
|
|
|
1529
1531
|
enabled: '自动备份已开启',
|
|
1530
1532
|
disabled: '自动备份已关闭'
|
|
1531
1533
|
},
|
|
1534
|
+
autoCheckUpdate: {
|
|
1535
|
+
title: '自动检测新版本提醒',
|
|
1536
|
+
enabled: '自动检测新版本提醒已开启',
|
|
1537
|
+
disabled: '自动检测新版本提醒已关闭'
|
|
1538
|
+
},
|
|
1532
1539
|
backupSuccessfully: '备份成功',
|
|
1533
1540
|
restore: '还原',
|
|
1534
1541
|
restoreSuccessfully: '还原成功',
|
package/es/notifications/list.js
CHANGED
|
@@ -22,6 +22,7 @@ import Permission from '../permission';
|
|
|
22
22
|
import RelativeTime from '../relative-time';
|
|
23
23
|
import { useNodeContext } from '../contexts/node';
|
|
24
24
|
import { BlockletAdminRoles } from '../util';
|
|
25
|
+
import { dispatchCheckUpdate } from '../hooks/use-check-update-by-url';
|
|
25
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
28
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -87,6 +88,12 @@ export default function NotificationsList({
|
|
|
87
88
|
onHide(e);
|
|
88
89
|
navigate(viewAllUrl);
|
|
89
90
|
};
|
|
91
|
+
const handleCheckForUpdates = (event, action) => {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
navigate(action);
|
|
95
|
+
dispatchCheckUpdate();
|
|
96
|
+
};
|
|
90
97
|
return /*#__PURE__*/_jsxs(Div, {
|
|
91
98
|
children: [/*#__PURE__*/_jsxs(Typography, {
|
|
92
99
|
component: "h3",
|
|
@@ -142,14 +149,30 @@ export default function NotificationsList({
|
|
|
142
149
|
'text-overflow': 'ellipsis'
|
|
143
150
|
},
|
|
144
151
|
children: x.description
|
|
145
|
-
}), /*#__PURE__*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
153
|
+
display: "flex",
|
|
154
|
+
flexDirection: "row",
|
|
155
|
+
justifyContent: "space-between",
|
|
156
|
+
alignItems: "center",
|
|
157
|
+
children: [/*#__PURE__*/_jsx(RelativeTime, {
|
|
158
|
+
value: x.createdAt,
|
|
159
|
+
locale: locale,
|
|
160
|
+
style: {
|
|
161
|
+
color: theme.palette.text.secondary,
|
|
162
|
+
fontSize: '0.875rem',
|
|
163
|
+
marginTop: '4px'
|
|
164
|
+
}
|
|
165
|
+
}), x.action && !x.read ? /*#__PURE__*/_jsx(Button, {
|
|
166
|
+
color: "primary",
|
|
167
|
+
variant: "outlined",
|
|
168
|
+
onPointerDown: event => {
|
|
169
|
+
event.stopPropagation();
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
},
|
|
172
|
+
onClick: e => handleCheckForUpdates(e, x.action),
|
|
173
|
+
"data-cy": "check-for-updates",
|
|
174
|
+
children: t('notification.proceed')
|
|
175
|
+
}) : null]
|
|
153
176
|
})]
|
|
154
177
|
})
|
|
155
178
|
})]
|
|
@@ -45,6 +45,7 @@ var _blockletSource = _interopRequireDefault(require("../blocklet-source"));
|
|
|
45
45
|
var _status = _interopRequireDefault(require("../status"));
|
|
46
46
|
var _version = _interopRequireDefault(require("../version"));
|
|
47
47
|
var _confirm = _interopRequireDefault(require("../../confirm"));
|
|
48
|
+
var _autoCheckUpdate = _interopRequireDefault(require("../storage/auto-check-update"));
|
|
48
49
|
var _node = require("../../contexts/node");
|
|
49
50
|
var _util2 = require("../../util");
|
|
50
51
|
var _permission = _interopRequireDefault(require("../../permission"));
|
|
@@ -58,6 +59,7 @@ var _add = _interopRequireDefault(require("./add"));
|
|
|
58
59
|
var _addRule = _interopRequireDefault(require("../router/action/add-rule"));
|
|
59
60
|
var _ruleList = _interopRequireDefault(require("../router/rule-list"));
|
|
60
61
|
var _actions = _interopRequireDefault(require("../../actions"));
|
|
62
|
+
var _useCheckUpdateByUrl = require("../../hooks/use-check-update-by-url");
|
|
61
63
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
62
64
|
const _excluded = ["blocklet", "onUpdate", "getComponentUrl"];
|
|
63
65
|
var _templateObject, _templateObject2, _templateObject3;
|
|
@@ -735,6 +737,7 @@ function BlockletComponent(_ref4) {
|
|
|
735
737
|
});
|
|
736
738
|
});
|
|
737
739
|
};
|
|
740
|
+
(0, _useCheckUpdateByUrl.useCheckUpdateByUrl)(checkForUpdates);
|
|
738
741
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread({
|
|
739
742
|
component: "div"
|
|
740
743
|
}, rest), {}, {
|
|
@@ -742,36 +745,44 @@ function BlockletComponent(_ref4) {
|
|
|
742
745
|
display: "flex",
|
|
743
746
|
justifyContent: "space-between",
|
|
744
747
|
alignItems: "center",
|
|
745
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
748
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
746
749
|
className: "title",
|
|
750
|
+
flexDirection: "row",
|
|
751
|
+
display: "flex",
|
|
752
|
+
alignItems: "center",
|
|
753
|
+
style: {
|
|
754
|
+
marginLeft: '1em'
|
|
755
|
+
},
|
|
747
756
|
children: [t('common.components'), !needMigration && /*#__PURE__*/(0, _jsxRuntime.jsx)(_permission.default, {
|
|
748
757
|
permission: inService ? '' : 'mutate_blocklets',
|
|
749
758
|
role: inService ? _util2.BlockletAdminRoles : [],
|
|
750
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
759
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_autoCheckUpdate.default, {
|
|
760
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledBadge, {
|
|
761
|
+
top: 1.2,
|
|
762
|
+
right: 0.4,
|
|
763
|
+
color: "error",
|
|
764
|
+
badgeContent: "",
|
|
765
|
+
variant: "dot",
|
|
766
|
+
invisible: !showUpdateDot,
|
|
767
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
768
|
+
disabled: loading || (0, _util.isInProgress)(blocklet.status),
|
|
769
|
+
color: "secondary",
|
|
770
|
+
onClick: () => {
|
|
771
|
+
checkForUpdates();
|
|
772
|
+
},
|
|
773
|
+
"data-cy": "check-for-updates",
|
|
774
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
775
|
+
mr: 0.5,
|
|
776
|
+
display: "flex",
|
|
777
|
+
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
778
|
+
size: 16
|
|
779
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Update.default, {
|
|
780
|
+
style: {
|
|
781
|
+
fontSize: '1em'
|
|
782
|
+
}
|
|
783
|
+
})
|
|
784
|
+
}), t('blocklet.component.checkUpdateTitle')]
|
|
785
|
+
})
|
|
775
786
|
})
|
|
776
787
|
})
|
|
777
788
|
})]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _material = require("@mui/material");
|
|
9
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
10
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
13
|
+
var _switchControl = _interopRequireDefault(require("../component/switch-control"));
|
|
14
|
+
var _blockletStorage = require("../../contexts/blocklet-storage");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const _excluded = ["children"];
|
|
17
|
+
/**
|
|
18
|
+
* @description
|
|
19
|
+
* @param {{
|
|
20
|
+
* style: import('react').CSSProperties
|
|
21
|
+
* }} {...rest}
|
|
22
|
+
* @return {*}
|
|
23
|
+
*/
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
29
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
30
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
31
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
32
|
+
function AutoCheckUpdate(_ref) {
|
|
33
|
+
let {
|
|
34
|
+
children
|
|
35
|
+
} = _ref,
|
|
36
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
const {
|
|
38
|
+
t
|
|
39
|
+
} = (0, _context.useLocaleContext)();
|
|
40
|
+
const {
|
|
41
|
+
updateAutoCheckUpdate,
|
|
42
|
+
autoCheckUpdate
|
|
43
|
+
} = (0, _blockletStorage.useBlockletStorageContext)();
|
|
44
|
+
const configAutoBackup = async () => {
|
|
45
|
+
try {
|
|
46
|
+
const enabled = !(autoCheckUpdate !== null && autoCheckUpdate !== void 0 && autoCheckUpdate.enabled);
|
|
47
|
+
await updateAutoCheckUpdate({
|
|
48
|
+
enabled
|
|
49
|
+
});
|
|
50
|
+
_Toast.default.success(enabled ? t('storage.spaces.autoCheckUpdate.enabled') : t('storage.spaces.autoCheckUpdate.disabled'));
|
|
51
|
+
} catch (error) {
|
|
52
|
+
_Toast.default.error(error.message);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const enabled = Boolean(autoCheckUpdate === null || autoCheckUpdate === void 0 ? void 0 : autoCheckUpdate.enabled);
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "row",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
61
|
+
title: t('storage.spaces.autoCheckUpdate.title'),
|
|
62
|
+
arrow: true,
|
|
63
|
+
placement: "right",
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_switchControl.default, {
|
|
66
|
+
checked: enabled,
|
|
67
|
+
onChange: configAutoBackup,
|
|
68
|
+
name: "enableWelcomePage",
|
|
69
|
+
style: _objectSpread(_objectSpread({}, rest.style), {}, {
|
|
70
|
+
zoom: 0.8
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
AutoCheckUpdate.propTypes = {
|
|
78
|
+
children: _propTypes.default.any
|
|
79
|
+
};
|
|
80
|
+
AutoCheckUpdate.defaultProps = {
|
|
81
|
+
children: null
|
|
82
|
+
};
|
|
83
|
+
var _default = exports.default = AutoCheckUpdate;
|
|
@@ -18,6 +18,7 @@ var _node = require("./node");
|
|
|
18
18
|
var _useBackupProgress = _interopRequireDefault(require("../hooks/use-backup-progress"));
|
|
19
19
|
var _useBackups = _interopRequireDefault(require("../hooks/use-backups"));
|
|
20
20
|
var _useAutoBackup = require("../hooks/use-auto-backup");
|
|
21
|
+
var _useAutoCheckUpdate = require("../hooks/use-auto-check-update");
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -96,6 +97,10 @@ function BlockletStorageProvider(_ref) {
|
|
|
96
97
|
const autoBackup = (0, _useAutoBackup.useAutoBackup)({
|
|
97
98
|
deps: [autoBackupRefresh]
|
|
98
99
|
});
|
|
100
|
+
const [autoCheckUpdateRefresh, setAutoCheckUpdateRefresh] = (0, _react.useState)(false);
|
|
101
|
+
const autoCheckUpdate = (0, _useAutoCheckUpdate.useAutoCheckUpdate)({
|
|
102
|
+
deps: [autoCheckUpdateRefresh]
|
|
103
|
+
});
|
|
99
104
|
const refreshSpaceGateways = () => {
|
|
100
105
|
setSpaceGatewaysRefresh(p => !p);
|
|
101
106
|
};
|
|
@@ -105,6 +110,9 @@ function BlockletStorageProvider(_ref) {
|
|
|
105
110
|
const refreshAutoBackup = () => {
|
|
106
111
|
setAutoBackupRefresh(x => !x);
|
|
107
112
|
};
|
|
113
|
+
const refreshAutoCheckUpdate = () => {
|
|
114
|
+
setAutoCheckUpdateRefresh(x => !x);
|
|
115
|
+
};
|
|
108
116
|
|
|
109
117
|
/**
|
|
110
118
|
* @description
|
|
@@ -210,6 +218,15 @@ function BlockletStorageProvider(_ref) {
|
|
|
210
218
|
});
|
|
211
219
|
refreshAutoBackup();
|
|
212
220
|
};
|
|
221
|
+
const updateAutoCheckUpdate = async value => {
|
|
222
|
+
await api.updateAutoCheckUpdate({
|
|
223
|
+
input: {
|
|
224
|
+
did: blocklet.meta.did,
|
|
225
|
+
autoCheckUpdate: value
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
refreshAutoCheckUpdate();
|
|
229
|
+
};
|
|
213
230
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
|
|
214
231
|
value: {
|
|
215
232
|
spaceGateways,
|
|
@@ -221,6 +238,8 @@ function BlockletStorageProvider(_ref) {
|
|
|
221
238
|
spaceGatewaysLoading,
|
|
222
239
|
spaceGatewayIsSelected,
|
|
223
240
|
updateAutoBackup,
|
|
241
|
+
updateAutoCheckUpdate,
|
|
242
|
+
autoCheckUpdate,
|
|
224
243
|
backupEndpoint,
|
|
225
244
|
backupProgress,
|
|
226
245
|
backups,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAutoCheckUpdate = useAutoCheckUpdate;
|
|
7
|
+
var _ahooks = require("ahooks");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _blocklet = require("../contexts/blocklet");
|
|
10
|
+
var _node = require("../contexts/node");
|
|
11
|
+
/* eslint-disable import/prefer-default-export */
|
|
12
|
+
|
|
13
|
+
function useAutoCheckUpdate() {
|
|
14
|
+
var _blocklet$meta2;
|
|
15
|
+
let {
|
|
16
|
+
deps
|
|
17
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
18
|
+
deps: []
|
|
19
|
+
};
|
|
20
|
+
/** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
|
|
21
|
+
const {
|
|
22
|
+
blocklet
|
|
23
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
24
|
+
/** @type {{api: import('@abtnode/client')}} */
|
|
25
|
+
const {
|
|
26
|
+
api
|
|
27
|
+
} = (0, _node.useNodeContext)();
|
|
28
|
+
const [autoCheckUpdate, setAutoCheckUpdate] = (0, _react.useState)(null);
|
|
29
|
+
(0, _ahooks.useAsyncEffect)(async () => {
|
|
30
|
+
var _blocklet$meta;
|
|
31
|
+
if (blocklet !== null && blocklet !== void 0 && (_blocklet$meta = blocklet.meta) !== null && _blocklet$meta !== void 0 && _blocklet$meta.did) {
|
|
32
|
+
const {
|
|
33
|
+
autoCheckUpdate: data
|
|
34
|
+
} = await api.getAutoCheckUpdate({
|
|
35
|
+
input: {
|
|
36
|
+
did: blocklet.meta.did
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
setAutoCheckUpdate(data);
|
|
40
|
+
}
|
|
41
|
+
}, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta2 = blocklet.meta) === null || _blocklet$meta2 === void 0 ? void 0 : _blocklet$meta2.did].concat(deps));
|
|
42
|
+
return autoCheckUpdate;
|
|
43
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.dispatchCheckUpdate = dispatchCheckUpdate;
|
|
8
|
+
exports.useCheckUpdateByUrl = useCheckUpdateByUrl;
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
11
|
+
var _reactRouterDom = require("react-router-dom");
|
|
12
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
13
|
+
var _useEventListen = _interopRequireDefault(require("./use-event-listen"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function dispatchCheckUpdate() {
|
|
16
|
+
window.dispatchEvent(new CustomEvent('checkUpdate'));
|
|
17
|
+
}
|
|
18
|
+
function useCheckUpdateByUrl(event) {
|
|
19
|
+
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
20
|
+
const {
|
|
21
|
+
t
|
|
22
|
+
} = (0, _context.useLocaleContext)();
|
|
23
|
+
const handle = () => {
|
|
24
|
+
const params = new URLSearchParams(window.location.search);
|
|
25
|
+
if (params.get('checkUpdate')) {
|
|
26
|
+
params.delete('checkUpdate');
|
|
27
|
+
navigate(params.toString());
|
|
28
|
+
event();
|
|
29
|
+
_Toast.default.success(t('notification.checkingForUpdates'));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
(0, _react.useEffect)(handle, []);
|
|
35
|
+
(0, _useEventListen.default)('checkUpdate', handle);
|
|
36
|
+
}
|
|
37
|
+
var _default = exports.default = useCheckUpdateByUrl;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
function useEventListen(key, callback) {
|
|
9
|
+
// reduce rerender
|
|
10
|
+
const ref = (0, _react.useRef)(callback);
|
|
11
|
+
(0, _react.useEffect)(() => {
|
|
12
|
+
const event = e => ref.current(e.detail);
|
|
13
|
+
window.addEventListener(key, event);
|
|
14
|
+
return () => window.removeEventListener(key, event);
|
|
15
|
+
}, [key]);
|
|
16
|
+
}
|
|
17
|
+
var _default = exports.default = useEventListen;
|
package/lib/issue-passport.js
CHANGED
|
@@ -13,6 +13,7 @@ var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
|
13
13
|
var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
|
|
14
14
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
15
15
|
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
16
|
+
var _fullpage = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect/fullpage"));
|
|
16
17
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
17
18
|
var _constant = require("@abtnode/constant");
|
|
18
19
|
var _wrapLocale = _interopRequireDefault(require("./wrap-locale"));
|
|
@@ -24,6 +25,7 @@ var _templateObject;
|
|
|
24
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
26
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
26
27
|
function IssuePassport(_ref) {
|
|
28
|
+
var _window, _window$blocklet, _window2, _window2$env;
|
|
27
29
|
let {
|
|
28
30
|
SessionContext,
|
|
29
31
|
webWalletUrl
|
|
@@ -103,25 +105,35 @@ function IssuePassport(_ref) {
|
|
|
103
105
|
})]
|
|
104
106
|
})
|
|
105
107
|
})
|
|
106
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
108
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_fullpage.default, {
|
|
109
|
+
did: ((_window = window) === null || _window === void 0 ? void 0 : (_window$blocklet = _window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.appPid) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$env = _window2.env) === null || _window2$env === void 0 ? void 0 : _window2$env.appPid),
|
|
110
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
111
|
+
sx: {
|
|
112
|
+
width: '560px',
|
|
113
|
+
maxWidth: '100%',
|
|
114
|
+
height: '100%'
|
|
115
|
+
},
|
|
116
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
117
|
+
className: "connect",
|
|
118
|
+
action: "issue-passport",
|
|
119
|
+
forceConnected: false,
|
|
120
|
+
autoConnect: false,
|
|
121
|
+
checkFn: api.get,
|
|
122
|
+
checkTimeout: 10 * 60 * 1000,
|
|
123
|
+
webWalletUrl: webWalletUrl,
|
|
124
|
+
onSuccess: onReceivePassport,
|
|
125
|
+
locale: locale,
|
|
126
|
+
messages: {
|
|
127
|
+
title: t('issuePassport.title'),
|
|
128
|
+
scan: t('issuePassport.description', {
|
|
129
|
+
name: window.env.appName
|
|
130
|
+
}),
|
|
131
|
+
confirm: t('issuePassport.dialog.confirm'),
|
|
132
|
+
success: t('issuePassport.dialog.success')
|
|
133
|
+
},
|
|
134
|
+
extraParams: extraParams
|
|
135
|
+
})
|
|
136
|
+
})
|
|
125
137
|
})
|
|
126
138
|
});
|
|
127
139
|
}
|
package/lib/locales/en.js
CHANGED
|
@@ -848,6 +848,8 @@ var _default = exports.default = {
|
|
|
848
848
|
showRead: 'Show Read',
|
|
849
849
|
markAllAsRead: 'Mark All as Read',
|
|
850
850
|
markAsRead: 'Mark As Read',
|
|
851
|
+
proceed: 'Proceed',
|
|
852
|
+
checkingForUpdates: 'Checking for updates...',
|
|
851
853
|
email: {
|
|
852
854
|
enable: 'Enable email notification',
|
|
853
855
|
from: 'Email sender',
|
|
@@ -1530,6 +1532,11 @@ var _default = exports.default = {
|
|
|
1530
1532
|
enabled: 'Automatic backup is on',
|
|
1531
1533
|
disabled: 'Automatic backup is off'
|
|
1532
1534
|
},
|
|
1535
|
+
autoCheckUpdate: {
|
|
1536
|
+
title: 'Automatically check for new version notification',
|
|
1537
|
+
enabled: 'Automatically check for new version is on',
|
|
1538
|
+
disabled: 'Automatically check for new version is off'
|
|
1539
|
+
},
|
|
1533
1540
|
backupSuccessfully: 'Backup successfully',
|
|
1534
1541
|
restore: 'Restore',
|
|
1535
1542
|
restoreSuccessfully: 'Restore successfully',
|
package/lib/locales/zh.js
CHANGED
|
@@ -851,6 +851,8 @@ var _default = exports.default = {
|
|
|
851
851
|
showRead: '显示已读',
|
|
852
852
|
markAllAsRead: '全部标记为已读',
|
|
853
853
|
markAsRead: '标记为已读',
|
|
854
|
+
proceed: '处理',
|
|
855
|
+
checkingForUpdates: '正在检查更新...',
|
|
854
856
|
email: {
|
|
855
857
|
enable: '是否开启 Email 通知',
|
|
856
858
|
from: '发件人邮箱',
|
|
@@ -1535,6 +1537,11 @@ var _default = exports.default = {
|
|
|
1535
1537
|
enabled: '自动备份已开启',
|
|
1536
1538
|
disabled: '自动备份已关闭'
|
|
1537
1539
|
},
|
|
1540
|
+
autoCheckUpdate: {
|
|
1541
|
+
title: '自动检测新版本提醒',
|
|
1542
|
+
enabled: '自动检测新版本提醒已开启',
|
|
1543
|
+
disabled: '自动检测新版本提醒已关闭'
|
|
1544
|
+
},
|
|
1538
1545
|
backupSuccessfully: '备份成功',
|
|
1539
1546
|
restore: '还原',
|
|
1540
1547
|
restoreSuccessfully: '还原成功',
|
|
@@ -27,6 +27,7 @@ var _permission = _interopRequireDefault(require("../permission"));
|
|
|
27
27
|
var _relativeTime = _interopRequireDefault(require("../relative-time"));
|
|
28
28
|
var _node = require("../contexts/node");
|
|
29
29
|
var _util = require("../util");
|
|
30
|
+
var _useCheckUpdateByUrl = require("../hooks/use-check-update-by-url");
|
|
30
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
32
|
var _templateObject;
|
|
32
33
|
/* eslint-disable operator-linebreak */
|
|
@@ -95,6 +96,12 @@ function NotificationsList(_ref) {
|
|
|
95
96
|
onHide(e);
|
|
96
97
|
navigate(viewAllUrl);
|
|
97
98
|
};
|
|
99
|
+
const handleCheckForUpdates = (event, action) => {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
event.stopPropagation();
|
|
102
|
+
navigate(action);
|
|
103
|
+
(0, _useCheckUpdateByUrl.dispatchCheckUpdate)();
|
|
104
|
+
};
|
|
98
105
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, {
|
|
99
106
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
100
107
|
component: "h3",
|
|
@@ -150,14 +157,30 @@ function NotificationsList(_ref) {
|
|
|
150
157
|
'text-overflow': 'ellipsis'
|
|
151
158
|
},
|
|
152
159
|
children: x.description
|
|
153
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
161
|
+
display: "flex",
|
|
162
|
+
flexDirection: "row",
|
|
163
|
+
justifyContent: "space-between",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_relativeTime.default, {
|
|
166
|
+
value: x.createdAt,
|
|
167
|
+
locale: locale,
|
|
168
|
+
style: {
|
|
169
|
+
color: theme.palette.text.secondary,
|
|
170
|
+
fontSize: '0.875rem',
|
|
171
|
+
marginTop: '4px'
|
|
172
|
+
}
|
|
173
|
+
}), x.action && !x.read ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
174
|
+
color: "primary",
|
|
175
|
+
variant: "outlined",
|
|
176
|
+
onPointerDown: event => {
|
|
177
|
+
event.stopPropagation();
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
},
|
|
180
|
+
onClick: e => handleCheckForUpdates(e, x.action),
|
|
181
|
+
"data-cy": "check-for-updates",
|
|
182
|
+
children: t('notification.proceed')
|
|
183
|
+
}) : null]
|
|
161
184
|
})]
|
|
162
185
|
})
|
|
163
186
|
})]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.21-beta-
|
|
3
|
+
"version": "1.16.21-beta-2e75c75c",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,24 +27,24 @@
|
|
|
27
27
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abtnode/auth": "1.16.21-beta-
|
|
31
|
-
"@abtnode/constant": "1.16.21-beta-
|
|
32
|
-
"@abtnode/util": "1.16.21-beta-
|
|
30
|
+
"@abtnode/auth": "1.16.21-beta-2e75c75c",
|
|
31
|
+
"@abtnode/constant": "1.16.21-beta-2e75c75c",
|
|
32
|
+
"@abtnode/util": "1.16.21-beta-2e75c75c",
|
|
33
33
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
34
|
-
"@arcblock/did": "^1.18.
|
|
35
|
-
"@arcblock/did-connect": "^2.
|
|
34
|
+
"@arcblock/did": "^1.18.108",
|
|
35
|
+
"@arcblock/did-connect": "^2.9.1",
|
|
36
36
|
"@arcblock/did-motif": "^1.1.13",
|
|
37
|
-
"@arcblock/icons": "^2.
|
|
38
|
-
"@arcblock/nft-display": "2.
|
|
39
|
-
"@arcblock/react-hooks": "^2.
|
|
40
|
-
"@arcblock/terminal": "^2.
|
|
41
|
-
"@arcblock/ux": "^2.
|
|
42
|
-
"@blocklet/constant": "1.16.21-beta-
|
|
43
|
-
"@blocklet/launcher-layout": "2.2.
|
|
44
|
-
"@blocklet/list": "^0.12.
|
|
45
|
-
"@blocklet/meta": "1.16.21-beta-
|
|
46
|
-
"@blocklet/ui-react": "^2.
|
|
47
|
-
"@blocklet/uploader": "^0.0.
|
|
37
|
+
"@arcblock/icons": "^2.9.1",
|
|
38
|
+
"@arcblock/nft-display": "2.9.1",
|
|
39
|
+
"@arcblock/react-hooks": "^2.9.1",
|
|
40
|
+
"@arcblock/terminal": "^2.9.1",
|
|
41
|
+
"@arcblock/ux": "^2.9.1",
|
|
42
|
+
"@blocklet/constant": "1.16.21-beta-2e75c75c",
|
|
43
|
+
"@blocklet/launcher-layout": "2.2.50",
|
|
44
|
+
"@blocklet/list": "^0.12.62",
|
|
45
|
+
"@blocklet/meta": "1.16.21-beta-2e75c75c",
|
|
46
|
+
"@blocklet/ui-react": "^2.9.1",
|
|
47
|
+
"@blocklet/uploader": "^0.0.59",
|
|
48
48
|
"@emotion/react": "^11.10.4",
|
|
49
49
|
"@emotion/styled": "^11.10.4",
|
|
50
50
|
"@iconify/react": "^4.0.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@mui/material": "^5.14.10",
|
|
55
55
|
"@mui/styles": "^5.14.10",
|
|
56
56
|
"@mui/x-date-pickers": "^6.14.0",
|
|
57
|
-
"@ocap/client": "1.18.
|
|
57
|
+
"@ocap/client": "1.18.108",
|
|
58
58
|
"@uiw/react-markdown-preview": "4.0.6",
|
|
59
59
|
"ahooks": "^3.7.1",
|
|
60
60
|
"axios": "^0.27.2",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"babel-plugin-inline-react-svg": "^1.1.2",
|
|
103
103
|
"glob": "^10.3.3"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "1fca0b58e1ed4f7a9bb268829a7c84290a01c89d",
|
|
106
106
|
"exports": {
|
|
107
107
|
".": {
|
|
108
108
|
"import": "./es/index.js",
|