@abtnode/ux 1.8.68-beta-500af7e5 → 1.8.68
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/lib/blocklet/access/config-access.js +3 -3
- package/lib/blocklet/actions.js +3 -3
- package/lib/blocklet/audit-logs.js +2 -5
- package/lib/blocklet/component/add.js +7 -9
- package/lib/blocklet/component/index.js +5 -5
- package/lib/blocklet/component/select-store.js +1 -3
- package/lib/blocklet/component/store-blocklet-list.js +3 -3
- package/lib/blocklet/configuration.js +1 -3
- package/lib/blocklet/install-from-url.js +82 -125
- package/lib/blocklet/overview.js +5 -18
- package/lib/blocklet/preferences/app-sk.js +8 -54
- package/lib/blocklet/router/action/add-domain-alias.js +3 -3
- package/lib/blocklet/router/action/add-rule.js +3 -3
- package/lib/blocklet/router/action/delete-domain-alias.js +3 -3
- package/lib/blocklet/router/action/delete-rule.js +3 -3
- package/lib/blocklet/router/action/update-rule.js +3 -3
- package/lib/blocklet/status.js +3 -3
- package/lib/blocklet/storage.js +121 -161
- package/lib/blocklet/version.js +3 -3
- package/lib/confirm.js +3 -3
- package/lib/form/form-text-input.js +11 -106
- package/lib/invitation/invitation.js +2 -2
- package/lib/issue-passport.js +1 -0
- package/lib/locales/en.js +5 -18
- package/lib/locales/zh.js +4 -16
- package/lib/logs/download.js +5 -5
- package/lib/lost-passport.js +2 -0
- package/lib/store/add.js +3 -3
- package/lib/team/members/invite-member.js +3 -3
- package/lib/team/members/issue-passport.js +3 -3
- package/lib/team/members/member.js +2 -2
- package/lib/team/members/transfer-node.js +4 -4
- package/lib/team/passports/color.js +3 -3
- package/lib/team/passports/detail.js +4 -4
- package/lib/team/passports/index.js +3 -3
- package/lib/team/passports/mutate-role.js +3 -3
- package/lib/team/passports/trusted-issuer.js +3 -3
- package/lib/util/index.js +18 -0
- package/package.json +14 -14
- package/lib/blocklet/component/space-gateway-selector.js +0 -174
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = AppSk;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
-
var _useSetState = _interopRequireDefault(require("react-use/lib/useSetState"));
|
|
11
|
-
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
12
10
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
11
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
14
12
|
var _formTextInput = _interopRequireDefault(require("../../form/form-text-input"));
|
|
15
13
|
var _confirm = _interopRequireDefault(require("../../confirm"));
|
|
16
|
-
var _session = require("../../contexts/session");
|
|
17
|
-
var _blocklet = require("../../contexts/blocklet");
|
|
18
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
15
|
var _templateObject;
|
|
20
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -29,19 +25,10 @@ function AppSk(_ref) {
|
|
|
29
25
|
const {
|
|
30
26
|
t
|
|
31
27
|
} = (0, _context.useLocaleContext)();
|
|
32
|
-
const
|
|
33
|
-
api
|
|
34
|
-
} = (0, _session.useSessionContext)();
|
|
35
|
-
const {
|
|
36
|
-
blocklet
|
|
37
|
-
} = (0, _blocklet.useBlockletContext)();
|
|
38
|
-
const [state, setState] = (0, _useSetState.default)({
|
|
39
|
-
newAppSk: '',
|
|
40
|
-
isConnectOpen: false
|
|
41
|
-
});
|
|
28
|
+
const [confirmAppSk, setConfirmAppSk] = (0, _react.useState)(null);
|
|
42
29
|
const onAppSkChange = value => {
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
setConfirmAppSk({
|
|
31
|
+
value
|
|
45
32
|
});
|
|
46
33
|
return false;
|
|
47
34
|
};
|
|
@@ -49,29 +36,16 @@ function AppSk(_ref) {
|
|
|
49
36
|
try {
|
|
50
37
|
await onChange(v);
|
|
51
38
|
} finally {
|
|
52
|
-
|
|
53
|
-
newAppSk: ''
|
|
54
|
-
});
|
|
39
|
+
setConfirmAppSk(null);
|
|
55
40
|
}
|
|
56
41
|
};
|
|
57
|
-
const onClose = () => setState({
|
|
58
|
-
isConnectOpen: false
|
|
59
|
-
});
|
|
60
|
-
const triggers = [{
|
|
61
|
-
key: 'rotate-with-did-wallet',
|
|
62
|
-
title: 'Migrate with DID Wallet',
|
|
63
|
-
handler: () => setState({
|
|
64
|
-
isConnectOpen: true
|
|
65
|
-
})
|
|
66
|
-
}];
|
|
67
42
|
return [/*#__PURE__*/(0, _jsxRuntime.jsx)(_formTextInput.default, {
|
|
68
43
|
disabled: disabled,
|
|
69
44
|
loading: loading,
|
|
70
45
|
initialValue: initialValue,
|
|
71
46
|
onSubmit: onAppSkChange,
|
|
72
|
-
triggers: triggers,
|
|
73
47
|
secure: true
|
|
74
|
-
}),
|
|
48
|
+
}), confirmAppSk && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
75
49
|
title: t('blocklet.config.appSkTitle'),
|
|
76
50
|
description: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
77
51
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
@@ -90,28 +64,8 @@ function AppSk(_ref) {
|
|
|
90
64
|
}),
|
|
91
65
|
confirm: t('confirm'),
|
|
92
66
|
cancel: t('cancel'),
|
|
93
|
-
onConfirm: () => _onConfirm(
|
|
94
|
-
onCancel: () =>
|
|
95
|
-
newAppSk: ''
|
|
96
|
-
})
|
|
97
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
98
|
-
popup: true,
|
|
99
|
-
open: state.isConnectOpen,
|
|
100
|
-
forceConnected: false,
|
|
101
|
-
action: "rotate-key-pair",
|
|
102
|
-
checkFn: api.get,
|
|
103
|
-
checkTimeout: 5 * 60 * 1000,
|
|
104
|
-
onSuccess: onClose,
|
|
105
|
-
extraParams: {
|
|
106
|
-
appDid: blocklet.appDid
|
|
107
|
-
},
|
|
108
|
-
messages: {
|
|
109
|
-
title: t('setup.keyPair.title'),
|
|
110
|
-
scan: t('setup.keyPair.scan'),
|
|
111
|
-
confirm: t('setup.keyPair.confirm'),
|
|
112
|
-
success: t('setup.keyPair.success')
|
|
113
|
-
},
|
|
114
|
-
onClose: onClose
|
|
67
|
+
onConfirm: () => _onConfirm(confirmAppSk.value),
|
|
68
|
+
onCancel: () => setConfirmAppSk(null)
|
|
115
69
|
})];
|
|
116
70
|
}
|
|
117
71
|
AppSk.propTypes = {
|
|
@@ -7,7 +7,7 @@ exports.default = AddDomainAlias;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _CallMerge = _interopRequireDefault(require("@mui/icons-material/CallMerge"));
|
|
10
|
-
var
|
|
10
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
11
11
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
12
12
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
13
13
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
@@ -140,8 +140,8 @@ function AddDomainAlias(_ref) {
|
|
|
140
140
|
onClick: onMenuItemClick,
|
|
141
141
|
className: "rule-action",
|
|
142
142
|
"data-cy": "action-add-domain-alias",
|
|
143
|
-
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
144
|
-
size: 16
|
|
143
|
+
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
144
|
+
size: [16, 10]
|
|
145
145
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_CallMerge.default, {
|
|
146
146
|
style: {
|
|
147
147
|
fontSize: 18,
|
|
@@ -7,7 +7,7 @@ exports.default = AddRule;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _Link = _interopRequireDefault(require("@mui/icons-material/Link"));
|
|
10
|
-
var
|
|
10
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
11
11
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
12
12
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
13
13
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
@@ -176,8 +176,8 @@ function AddRule(_ref) {
|
|
|
176
176
|
onClick: onMenuItemClick,
|
|
177
177
|
className: "rule-action",
|
|
178
178
|
"data-cy": "action-add-rule",
|
|
179
|
-
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
180
|
-
size: 16
|
|
179
|
+
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
180
|
+
size: [16, 10]
|
|
181
181
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
|
|
182
182
|
style: {
|
|
183
183
|
fontSize: 18,
|
|
@@ -7,7 +7,7 @@ exports.default = DeleteDomainAlias;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
10
|
-
var
|
|
10
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
11
11
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
12
12
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
13
13
|
var _confirm = _interopRequireDefault(require("../../../confirm"));
|
|
@@ -78,8 +78,8 @@ function DeleteDomainAlias(props) {
|
|
|
78
78
|
className: "rule-action",
|
|
79
79
|
color: "error",
|
|
80
80
|
"data-cy": "action-delete-domain-alias",
|
|
81
|
-
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
82
|
-
size: 16
|
|
81
|
+
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
82
|
+
size: [16, 10]
|
|
83
83
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Delete.default, {
|
|
84
84
|
style: {
|
|
85
85
|
fontSize: 16
|
|
@@ -7,7 +7,7 @@ exports.default = DeleteRule;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
10
|
-
var
|
|
10
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
11
11
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
12
12
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
13
13
|
var _node = require("../../../contexts/node");
|
|
@@ -83,8 +83,8 @@ function DeleteRule(_ref) {
|
|
|
83
83
|
onClick: onMenuItemClick,
|
|
84
84
|
className: "rule-action",
|
|
85
85
|
"data-cy": "action-delete-rule",
|
|
86
|
-
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
87
|
-
size: 16
|
|
86
|
+
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
87
|
+
size: [16, 10]
|
|
88
88
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Delete.default, {
|
|
89
89
|
style: {
|
|
90
90
|
fontSize: 18,
|
|
@@ -7,7 +7,7 @@ exports.default = UpdateRule;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _Edit = _interopRequireDefault(require("@mui/icons-material/Edit"));
|
|
10
|
-
var
|
|
10
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
11
11
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
12
12
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
13
13
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
@@ -172,8 +172,8 @@ function UpdateRule(_ref) {
|
|
|
172
172
|
onClick: onMenuItemClick,
|
|
173
173
|
className: "rule-action",
|
|
174
174
|
"data-cy": "action-update-rule",
|
|
175
|
-
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
176
|
-
size: 16
|
|
175
|
+
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
176
|
+
size: [16, 10]
|
|
177
177
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Edit.default, {
|
|
178
178
|
style: {
|
|
179
179
|
fontSize: 18,
|
package/lib/blocklet/status.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = BlockletStatus;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
10
10
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
11
11
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
12
12
|
var _dot = _interopRequireDefault(require("../dot"));
|
|
@@ -85,8 +85,8 @@ function BlockletStatus(_ref) {
|
|
|
85
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_tag.default, _objectSpread(_objectSpread({
|
|
86
86
|
type: map[status]
|
|
87
87
|
}, rest), {}, {
|
|
88
|
-
children: [inProgress && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
89
|
-
size: 12,
|
|
88
|
+
children: [inProgress && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
89
|
+
size: [12, 6],
|
|
90
90
|
color: "inherit",
|
|
91
91
|
style: {
|
|
92
92
|
marginRight: 5
|
package/lib/blocklet/storage.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Storage;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
7
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
9
8
|
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
9
|
+
var _react = require("react");
|
|
10
10
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
11
11
|
var _constant = require("@blocklet/constant");
|
|
12
12
|
var _axios = _interopRequireDefault(require("axios"));
|
|
@@ -14,77 +14,35 @@ var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
|
14
14
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
15
15
|
var _lodash = require("lodash");
|
|
16
16
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
17
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
17
18
|
var _material = require("@mui/material");
|
|
18
19
|
var _blocklet = require("../../lib/contexts/blocklet");
|
|
19
20
|
var _node = require("../contexts/node");
|
|
20
21
|
var _toast = _interopRequireDefault(require("../../lib/toast"));
|
|
21
|
-
var _spaceGatewaySelector = _interopRequireDefault(require("./component/space-gateway-selector"));
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
var _templateObject;
|
|
23
|
+
var _templateObject, _templateObject2;
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
function
|
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
27
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
28
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
28
|
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; }
|
|
30
29
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
31
30
|
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); }
|
|
32
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
33
|
-
const Container = (0, _styled.default)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n overflow-y: auto;\n"])));
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @description 实时显示备份的进度
|
|
37
|
-
* @param {{appDid: string}} {appDid}
|
|
38
|
-
* @return {{message: string, progress: number, completed: boolean}}
|
|
39
|
-
*/
|
|
40
|
-
function useBackupProgress(_ref) {
|
|
41
|
-
let {
|
|
42
|
-
appDid
|
|
43
|
-
} = _ref;
|
|
44
|
-
const [progress, setProgress] = (0, _react.useState)({
|
|
45
|
-
message: '',
|
|
46
|
-
progress: 0,
|
|
47
|
-
completed: false
|
|
48
|
-
});
|
|
49
|
-
const node = (0, _node.useNodeContext)();
|
|
50
|
-
const webSocketClient = node.ws.getWsClient();
|
|
51
|
-
(0, _react.useEffect)(() => {
|
|
52
|
-
webSocketClient.on(_constant.BlockletEvents.backupProgress, data => {
|
|
53
|
-
if (appDid === (data === null || data === void 0 ? void 0 : data.did)) {
|
|
54
|
-
setProgress(preValue => _objectSpread(_objectSpread({}, preValue), data));
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
return () => {
|
|
58
|
-
webSocketClient.off(_constant.BlockletEvents.backupProgress);
|
|
59
|
-
};
|
|
60
|
-
}, [appDid, webSocketClient]);
|
|
61
|
-
return progress;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* @param {import('@abtnode/client').BlockletState} blocklet
|
|
68
|
-
* @return {*}
|
|
69
|
-
*/
|
|
70
|
-
function useAppUrl(blocklet) {
|
|
71
|
-
var _blocklet$site, _blocklet$site$domain, _blocklet$site$domain2;
|
|
72
|
-
const appUrls = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$site = blocklet.site) === null || _blocklet$site === void 0 ? void 0 : (_blocklet$site$domain = _blocklet$site.domainAliases) === null || _blocklet$site$domain === void 0 ? void 0 : (_blocklet$site$domain2 = _blocklet$site$domain.sort((a, b) => {
|
|
73
|
-
if (a.accessibility.accessible && b.accessibility.accessible) {
|
|
74
|
-
return +a.isProtected - +b.isProtected;
|
|
75
|
-
}
|
|
76
|
-
return +b.accessibility.accessible - +a.accessibility.accessible;
|
|
77
|
-
})) === null || _blocklet$site$domain2 === void 0 ? void 0 : _blocklet$site$domain2.map(domainAlias => domainAlias.accessibility.url);
|
|
78
|
-
const appUrl = appUrls === null || appUrls === void 0 ? void 0 : appUrls[0];
|
|
79
|
-
|
|
80
|
-
// 授权的时候提供 appUrl, 因为 appUrl 可能很久都拿不到值,所以加一个 loading 效果过渡一下
|
|
81
|
-
return {
|
|
82
|
-
appUrl,
|
|
83
|
-
isReady: Boolean(appUrl)
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
31
|
function Storage() {
|
|
87
|
-
var _blocklet$environment;
|
|
32
|
+
var _localStorage$getItem, _blocklet$environment, _blocklet$environment2, _blocklet$environment3;
|
|
33
|
+
const options = [
|
|
34
|
+
// TODO: 测试用,上线后才需删除
|
|
35
|
+
{
|
|
36
|
+
value: (_localStorage$getItem = localStorage.getItem('test-spaces')) !== null && _localStorage$getItem !== void 0 && _localStorage$getItem.startsWith('http') ? localStorage.getItem('test-spaces') : 'https://bbqazi2fhuczchrlggs4njj2bucbvnwjjm2xlq6yk6i.did.abtnet.io',
|
|
37
|
+
label: 'test spaces'
|
|
38
|
+
}, {
|
|
39
|
+
value: 'https://storage.staging.abtnet.io/app',
|
|
40
|
+
label: 'staging spaces'
|
|
41
|
+
}, {
|
|
42
|
+
value: 'https://service.didspaces.com/app',
|
|
43
|
+
label: 'prod spaces'
|
|
44
|
+
}];
|
|
45
|
+
|
|
88
46
|
/** @type {{ api: import('@abtnode/client').ABTNodeClient }} */
|
|
89
47
|
const {
|
|
90
48
|
api
|
|
@@ -93,15 +51,13 @@ function Storage() {
|
|
|
93
51
|
t,
|
|
94
52
|
locale
|
|
95
53
|
} = (0, _react.useContext)(_context.LocaleContext);
|
|
54
|
+
const [errorMessage, setErrorMessage] = (0, _react.useState)(false);
|
|
96
55
|
/** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
|
|
97
56
|
const {
|
|
98
57
|
blocklet
|
|
99
58
|
} = (0, _blocklet.useBlockletContext)();
|
|
100
|
-
const [gatewayUrl, setGatewayUrl] = (0, _react.useState)('');
|
|
101
59
|
const [endpoint, setEndpoint] = (0, _react.useState)(((_blocklet$environment = blocklet.environments.find(e => e.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)) === null || _blocklet$environment === void 0 ? void 0 : _blocklet$environment.value) || '');
|
|
102
|
-
const
|
|
103
|
-
appDid: blocklet === null || blocklet === void 0 ? void 0 : blocklet.appDid
|
|
104
|
-
});
|
|
60
|
+
const [didSpacesUrl, setDidSpacesUrl] = (0, _react.useState)((_blocklet$environment2 = (_blocklet$environment3 = blocklet.environments.find(e => e.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL)) === null || _blocklet$environment3 === void 0 ? void 0 : _blocklet$environment3.value) !== null && _blocklet$environment2 !== void 0 ? _blocklet$environment2 : options[0].value);
|
|
105
61
|
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
106
62
|
const {
|
|
107
63
|
appDid
|
|
@@ -110,24 +66,26 @@ function Storage() {
|
|
|
110
66
|
title: appName,
|
|
111
67
|
description: appDescription
|
|
112
68
|
} = blocklet.meta;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param {string} did
|
|
73
|
+
* @param {string} storageEndpoint
|
|
74
|
+
*/
|
|
117
75
|
async function saveStorageEndpoint(did, storageEndpoint) {
|
|
118
76
|
await api.configBlocklet({
|
|
119
77
|
input: {
|
|
120
78
|
did: [did],
|
|
121
79
|
configs: [{
|
|
122
80
|
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL,
|
|
123
|
-
value:
|
|
81
|
+
value: didSpacesUrl
|
|
124
82
|
}, {
|
|
125
83
|
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,
|
|
126
84
|
value: storageEndpoint
|
|
127
85
|
}]
|
|
128
86
|
}
|
|
129
87
|
}).then(() => {
|
|
130
|
-
_toast.default.success(t('storage.
|
|
88
|
+
_toast.default.success(t('storage.didSpaces.getSpacesAuthorizeSuccessfully', locale));
|
|
131
89
|
}).catch(error => {
|
|
132
90
|
console.error(error);
|
|
133
91
|
_toast.default.error(error.message);
|
|
@@ -143,41 +101,49 @@ function Storage() {
|
|
|
143
101
|
}, 3000);
|
|
144
102
|
};
|
|
145
103
|
const [authorizeConnect, setAuthorizeConnect] = (0, _react.useState)({
|
|
146
|
-
open: false
|
|
104
|
+
open: false,
|
|
105
|
+
action: 'one-click-authorization',
|
|
106
|
+
checkTimeout: 1000 * 300,
|
|
107
|
+
checkFn: _axios.default.create({
|
|
108
|
+
baseURL: (0, _urlJoin.default)(didSpacesUrl, 'space')
|
|
109
|
+
}).get,
|
|
110
|
+
onClose: () => {
|
|
111
|
+
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
112
|
+
open: false
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
147
115
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if ((0, _lodash.isEmpty)(gatewayUrl)) {
|
|
152
|
-
_toast.default.error(t('storage.spaces.addressCannotEmpty', locale));
|
|
116
|
+
const handleOnClickAuthorize = async () => {
|
|
117
|
+
if ((0, _lodash.isEmpty)(didSpacesUrl)) {
|
|
118
|
+
_toast.default.error(t('storage.didSpaces.addressCannotEmpty', locale));
|
|
153
119
|
return;
|
|
154
120
|
}
|
|
155
|
-
setGatewayUrl(gatewayUrl);
|
|
156
121
|
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
prefix: (0, _urlJoin.default)(gatewayUrl, 'space/api/did'),
|
|
160
|
-
baseUrl: new URL(gatewayUrl).origin,
|
|
122
|
+
prefix: (0, _urlJoin.default)(didSpacesUrl, 'space/api/did'),
|
|
123
|
+
baseUrl: new URL(didSpacesUrl).origin,
|
|
161
124
|
checkFn: _axios.default.create({
|
|
162
|
-
baseURL: (0, _urlJoin.default)(
|
|
125
|
+
baseURL: (0, _urlJoin.default)(didSpacesUrl, 'space')
|
|
163
126
|
}).get,
|
|
164
127
|
extraParams: {
|
|
165
128
|
appDid,
|
|
166
129
|
appName,
|
|
167
130
|
appDescription,
|
|
168
|
-
scopes: 'list:object read:object write:object'
|
|
169
|
-
appUrl,
|
|
170
|
-
referrer: window.location.href
|
|
171
|
-
},
|
|
172
|
-
onClose: () => {
|
|
173
|
-
// eslint-disable-next-line no-shadow
|
|
174
|
-
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
175
|
-
open: false
|
|
176
|
-
}));
|
|
131
|
+
scopes: 'list:object read:object write:object'
|
|
177
132
|
},
|
|
178
133
|
open: true
|
|
179
134
|
}));
|
|
180
135
|
};
|
|
136
|
+
const onDidSpacesUrlChange = event => {
|
|
137
|
+
const {
|
|
138
|
+
value
|
|
139
|
+
} = event.target;
|
|
140
|
+
if ((0, _lodash.isEmpty)(value)) {
|
|
141
|
+
setErrorMessage(t('storage.didSpaces.addressCannotEmpty', locale));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
setErrorMessage(null);
|
|
145
|
+
setDidSpacesUrl(value);
|
|
146
|
+
};
|
|
181
147
|
const onBackup = async () => {
|
|
182
148
|
try {
|
|
183
149
|
if (isLoading) {
|
|
@@ -189,7 +155,7 @@ function Storage() {
|
|
|
189
155
|
did: blocklet.appDid
|
|
190
156
|
}
|
|
191
157
|
});
|
|
192
|
-
_toast.default.success(t('storage.
|
|
158
|
+
_toast.default.success(t('storage.didSpaces.backupSuccessfully'));
|
|
193
159
|
} catch (error) {
|
|
194
160
|
_toast.default.error(error.message);
|
|
195
161
|
console.error(error);
|
|
@@ -200,96 +166,88 @@ function Storage() {
|
|
|
200
166
|
(0, _react.useEffect)(() => {
|
|
201
167
|
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
202
168
|
messages: {
|
|
203
|
-
title: t('storage.
|
|
169
|
+
title: t('storage.didSpaces.authorize.title', {
|
|
204
170
|
appName
|
|
205
171
|
}),
|
|
206
|
-
scan: t('storage.
|
|
172
|
+
scan: t('storage.didSpaces.authorize.scan', {
|
|
207
173
|
appName
|
|
208
174
|
}),
|
|
209
175
|
confirm: '',
|
|
210
176
|
success: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
211
177
|
gutterBottom: true,
|
|
212
|
-
children: t('storage.
|
|
178
|
+
children: t('storage.didSpaces.authorize.success')
|
|
213
179
|
})
|
|
214
180
|
}
|
|
215
181
|
}));
|
|
216
182
|
}, [appName, locale, t]);
|
|
217
|
-
(0, _react.useEffect)(() => {
|
|
218
|
-
if (progress !== null && progress !== void 0 && progress.completed) {
|
|
219
|
-
setIsLoading(false);
|
|
220
|
-
} else if (progress !== null && progress !== void 0 && progress.message) {
|
|
221
|
-
setIsLoading(true);
|
|
222
|
-
}
|
|
223
|
-
}, [progress === null || progress === void 0 ? void 0 : progress.completed, progress === null || progress === void 0 ? void 0 : progress.message, t]);
|
|
224
183
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
},
|
|
228
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_spaceGatewaySelector.default, {
|
|
184
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StorageUrlTextField, {
|
|
185
|
+
select: true,
|
|
229
186
|
sx: {
|
|
230
|
-
marginTop: '
|
|
231
|
-
marginBottom: '40px'
|
|
187
|
+
marginTop: '20px'
|
|
232
188
|
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
189
|
+
label: t('storage.didSpaces.label'),
|
|
190
|
+
value: didSpacesUrl,
|
|
191
|
+
onChange: onDidSpacesUrlChange,
|
|
192
|
+
autoFocus: true,
|
|
193
|
+
size: "small",
|
|
194
|
+
error: !!errorMessage,
|
|
195
|
+
helperText: errorMessage,
|
|
196
|
+
InputProps: {
|
|
197
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
198
|
+
variant: "contained",
|
|
199
|
+
onClick: handleOnClickAuthorize,
|
|
200
|
+
size: "small",
|
|
201
|
+
sx: {
|
|
202
|
+
position: 'absolute',
|
|
203
|
+
right: 0,
|
|
204
|
+
display: 'flex',
|
|
205
|
+
justifyContent: 'center',
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
width: '140px',
|
|
208
|
+
height: '100%'
|
|
209
|
+
},
|
|
210
|
+
children: endpoint ? t('storage.didSpaces.reAuthorization') : t('storage.didSpaces.goToAuthorization')
|
|
211
|
+
})
|
|
212
|
+
},
|
|
213
|
+
children: options.map(option => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
214
|
+
value: option.value,
|
|
215
|
+
children: option.label
|
|
216
|
+
}, option.value))
|
|
217
|
+
}), endpoint && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
218
|
+
color: "text.secondary",
|
|
219
|
+
sx: {
|
|
220
|
+
marginTop: '20px'
|
|
221
|
+
},
|
|
222
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
223
|
+
display: "flex",
|
|
224
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
244
225
|
display: "inline",
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
226
|
+
children: [t('storage.didSpaces.tips'), ": \xA0", ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
227
|
+
display: "inline",
|
|
228
|
+
color: "primary.main",
|
|
229
|
+
fontWeight: "fontWeightBold",
|
|
230
|
+
children: t('storage.didSpaces.getSpacesAuthorizeSuccessfully')
|
|
231
|
+
})]
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
235
|
+
display: "flex",
|
|
236
|
+
justifyContent: "center",
|
|
237
|
+
sx: {
|
|
238
|
+
maxWidth: '580px',
|
|
239
|
+
marginTop: '20px',
|
|
240
|
+
padding: '0px 0px'
|
|
241
|
+
},
|
|
242
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
250
243
|
onClick: onBackup,
|
|
251
244
|
loading: isLoading,
|
|
252
245
|
variant: "contained",
|
|
253
246
|
color: "primary",
|
|
254
247
|
"data-cy": "add-domain-alias",
|
|
255
248
|
disabled: !endpoint || isLoading,
|
|
256
|
-
children: t('storage.
|
|
257
|
-
})
|
|
258
|
-
}), isLoading && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
259
|
-
display: "flex",
|
|
260
|
-
flexDirection: "column",
|
|
261
|
-
justifyContent: "center",
|
|
262
|
-
textAlign: "center",
|
|
263
|
-
marginTop: "16px",
|
|
264
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
265
|
-
color: "primary",
|
|
266
|
-
children: progress === null || progress === void 0 ? void 0 : progress.message
|
|
267
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
268
|
-
sx: {
|
|
269
|
-
display: 'flex',
|
|
270
|
-
alignItems: 'center'
|
|
271
|
-
},
|
|
272
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
273
|
-
sx: {
|
|
274
|
-
width: '100%',
|
|
275
|
-
mr: 1
|
|
276
|
-
},
|
|
277
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
|
|
278
|
-
color: "primary",
|
|
279
|
-
variant: "determinate",
|
|
280
|
-
value: progress === null || progress === void 0 ? void 0 : progress.progress
|
|
281
|
-
})
|
|
282
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
283
|
-
sx: {
|
|
284
|
-
minWidth: 35
|
|
285
|
-
},
|
|
286
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
287
|
-
variant: "body2",
|
|
288
|
-
color: "text.secondary",
|
|
289
|
-
children: [progress === null || progress === void 0 ? void 0 : progress.progress, "%"]
|
|
290
|
-
})
|
|
291
|
-
})]
|
|
292
|
-
})]
|
|
249
|
+
children: t('storage.didSpaces.backup')
|
|
250
|
+
})
|
|
293
251
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
294
252
|
prefix: authorizeConnect.prefix,
|
|
295
253
|
open: authorizeConnect.open,
|
|
@@ -306,4 +264,6 @@ function Storage() {
|
|
|
306
264
|
})]
|
|
307
265
|
});
|
|
308
266
|
}
|
|
267
|
+
const Container = (0, _styled.default)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n overflow-y: auto;\n"])));
|
|
268
|
+
const StorageUrlTextField = (0, _styled.default)(_material.TextField)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 56px;\n width: 580px;\n ", " {\n width: 75%;\n }\n input.MuiInputBase-input {\n width: calc(100% - 144px);\n }\n"])), props => props.theme.breakpoints.down('md'));
|
|
309
269
|
Storage.propTypes = {};
|
package/lib/blocklet/version.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react = require("react");
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _semver = _interopRequireDefault(require("semver"));
|
|
10
10
|
var _notistack = require("notistack");
|
|
11
|
-
var
|
|
11
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
12
12
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
13
13
|
var _ArrowUpward = _interopRequireDefault(require("@mui/icons-material/ArrowUpward"));
|
|
14
14
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
@@ -130,8 +130,8 @@ function Version(_ref) {
|
|
|
130
130
|
},
|
|
131
131
|
disabled: loading,
|
|
132
132
|
onClick: () => setConfirmSetting(setting),
|
|
133
|
-
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
134
|
-
size: 16
|
|
133
|
+
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
134
|
+
size: [16, 10]
|
|
135
135
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowUpward.default, {
|
|
136
136
|
style: {
|
|
137
137
|
fontSize: 16,
|