@abtnode/ux 1.8.59 → 1.8.61

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.
@@ -10,9 +10,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _get = _interopRequireDefault(require("lodash/get"));
11
11
  var _omit = _interopRequireDefault(require("lodash/omit"));
12
12
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
13
- var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
14
13
  var _Box = _interopRequireDefault(require("@mui/material/Box"));
15
- var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
16
14
  var _useTheme = _interopRequireDefault(require("@mui/material/styles/useTheme"));
17
15
  var _Switch = _interopRequireDefault(require("@mui/material/Switch"));
18
16
  var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
@@ -35,8 +33,10 @@ var _permission = require("../permission");
35
33
  var _addDomainAlias = _interopRequireDefault(require("./router/action/add-domain-alias"));
36
34
  var _domainStatus = _interopRequireDefault(require("./router/domain-status"));
37
35
  var _domainActions = _interopRequireDefault(require("./router/domain-actions"));
36
+ var _walletType = _interopRequireDefault(require("./preferences/wallet-type"));
37
+ var _appSk = _interopRequireDefault(require("./preferences/app-sk"));
38
38
  var _jsxRuntime = require("react/jsx-runtime");
39
- var _templateObject, _templateObject2;
39
+ var _templateObject;
40
40
  const _excluded = ["blocklet", "onUpdate", "hasPermission"],
41
41
  _excluded2 = ["value"];
42
42
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -91,13 +91,6 @@ function BlockletEnvironment(_ref) {
91
91
  if ((0, _util2.isInstalling)(blocklet.status)) {
92
92
  return null;
93
93
  }
94
- const WalletTypes = [{
95
- label: 'DID',
96
- value: 'default'
97
- }, {
98
- label: 'ETH',
99
- value: 'eth'
100
- }];
101
94
 
102
95
  // configurable blocklet environment
103
96
  const customType = blocklet.environments.find(x => x.key === 'BLOCKLET_WALLET_TYPE');
@@ -235,15 +228,12 @@ function BlockletEnvironment(_ref) {
235
228
  setLoading(false);
236
229
  }
237
230
  };
238
- const onWalletTypeChange = async e => {
231
+ const onWalletTypeChange = async value => {
239
232
  if (loading) {
240
233
  return;
241
234
  }
242
235
  setLoading(true);
243
236
  try {
244
- const {
245
- value
246
- } = e.target;
247
237
  const {
248
238
  blocklet: data
249
239
  } = await node.api.configBlocklet({
@@ -286,6 +276,30 @@ function BlockletEnvironment(_ref) {
286
276
  }
287
277
  return true;
288
278
  };
279
+ const onAppSkChange = async value => {
280
+ if (loading) {
281
+ return;
282
+ }
283
+ setLoading(true);
284
+ try {
285
+ const {
286
+ blocklet: data
287
+ } = await node.api.configBlocklet({
288
+ input: {
289
+ did: blocklet.meta.did,
290
+ configs: [{
291
+ key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,
292
+ value
293
+ }]
294
+ }
295
+ });
296
+ onUpdate(data);
297
+ } catch (err) {
298
+ _toast.default.error(err.message);
299
+ } finally {
300
+ setLoading(false);
301
+ }
302
+ };
289
303
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread({}, rest), {}, {
290
304
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_schemaForm.default, {
291
305
  disabled: disabled,
@@ -477,67 +491,48 @@ function BlockletEnvironment(_ref) {
477
491
  component: _Divider.default,
478
492
  my: 3
479
493
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
480
- className: "config-form",
481
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
482
- className: "config-item",
483
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
484
- className: "config-label",
485
- children: [t('blocklet.config.walletType.name'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
486
- className: "config-desc",
487
- children: t('blocklet.config.walletType.description')
494
+ mb: 2,
495
+ className: "config-label",
496
+ fontSize: 20,
497
+ children: t('blocklet.config.dangerZone')
498
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
499
+ px: 2,
500
+ py: 1,
501
+ sx: {
502
+ border: '1px solid red',
503
+ borderRadius: 2
504
+ },
505
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
506
+ className: "config-form",
507
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
508
+ className: "config-item",
509
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
510
+ className: "config-label",
511
+ children: [t('blocklet.config.walletType.name'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
512
+ className: "config-desc",
513
+ children: t('blocklet.config.walletType.description')
514
+ })]
515
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_walletType.default, {
516
+ value: (customType === null || customType === void 0 ? void 0 : customType.value) || 'default',
517
+ disabled: disabled,
518
+ onChange: onWalletTypeChange
488
519
  })]
489
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
490
- disabled: disabled,
491
- select: true,
492
- size: "small",
493
- value: (customType === null || customType === void 0 ? void 0 : customType.value) || 'default',
494
- onChange: onWalletTypeChange,
495
- children: WalletTypes.map(type => {
496
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledMenuItem, {
497
- value: type.value,
498
- sx: {
499
- display: 'block'
500
- },
501
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
502
- display: "flex",
503
- alignItems: "center",
504
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
505
- children: type.label
506
- })
507
- })
508
- });
509
- })
520
+ })
521
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
522
+ className: "config-form",
523
+ mt: 2,
524
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
525
+ className: "config-label",
526
+ fontSize: 14,
527
+ mb: 0,
528
+ children: t('blocklet.config.sk')
529
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_appSk.default, {
530
+ disabled: loading || disabled,
531
+ loading: loading,
532
+ initialValue: blocklet.environments.find(x => x.key === 'BLOCKLET_APP_SK').value,
533
+ onChange: onAppSkChange
510
534
  })]
511
- })
512
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_schemaForm.default, {
513
- disabled: disabled,
514
- style: {
515
- marginTop: 0
516
- },
517
- loading: loading,
518
- schema: [{
519
- key: _constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,
520
- description: t('blocklet.config.sk'),
521
- value: blocklet.environments.find(x => x.key === 'BLOCKLET_APP_SK').value,
522
- secure: true
523
- }],
524
- defaultValue: {
525
- [_constant2.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK]: blocklet.environments.find(x => x.key === 'BLOCKLET_APP_SK').value
526
- },
527
- onChange: (changeValue, _ref4) => {
528
- let {
529
- action,
530
- currentItem
531
- } = _ref4;
532
- if (action === 'edit') {
533
- setEditingItem(currentItem);
534
- } else if (['cancel', 'confirm'].includes(action)) {
535
- setEditingItem(null);
536
- }
537
- if (action === 'confirm') {
538
- onSubmitConfig(changeValue[currentItem.key]);
539
- }
540
- }
535
+ })]
541
536
  })]
542
537
  }));
543
538
  }
@@ -561,5 +556,4 @@ BlockletEnvironment.defaultProps = {
561
556
  onUpdate: () => {},
562
557
  hasPermission: false
563
558
  };
564
- const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n ", " {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n max-height: 60vh;\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])), props => props.theme.breakpoints.down('md'));
565
- const StyledMenuItem = (0, _styled.default)(_MenuItem.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .tip {\n font-size: 12px;\n color: ", ";\n }\n"])), props => props.theme.palette.text.secondary);
559
+ const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n ", " {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n max-height: 60vh;\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])), props => props.theme.breakpoints.down('md'));
@@ -8,6 +8,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
8
8
  var _Box = _interopRequireDefault(require("@mui/material/Box"));
9
9
  var _util = require("@blocklet/meta/lib/util");
10
10
  var _logTerminal = require("../logs/log-terminal");
11
+ var _download = _interopRequireDefault(require("../logs/download"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  const _excluded = ["blocklet"];
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -48,7 +49,11 @@ function BlockletLog(_ref) {
48
49
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_logTerminal.LogTerminalGroup, {
49
50
  name: (0, _util.getDisplayName)(blocklet),
50
51
  logId: "blocklet-".concat(blocklet.meta.did),
51
- initialData: initialData
52
+ initialData: initialData,
53
+ postpend: /*#__PURE__*/(0, _jsxRuntime.jsx)(_download.default, {
54
+ id: blocklet.meta.did,
55
+ name: blocklet.meta.name
56
+ })
52
57
  })
53
58
  }));
54
59
  }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = AppSk;
7
+ var _react = require("react");
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _styled = _interopRequireDefault(require("@emotion/styled"));
10
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
11
+ var _context = require("@arcblock/ux/lib/Locale/context");
12
+ var _formTextInput = _interopRequireDefault(require("../../form/form-text-input"));
13
+ var _confirm = _interopRequireDefault(require("../../confirm"));
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ var _templateObject;
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
18
+ function AppSk(_ref) {
19
+ let {
20
+ initialValue,
21
+ onChange,
22
+ disabled,
23
+ loading
24
+ } = _ref;
25
+ const {
26
+ t
27
+ } = (0, _context.useLocaleContext)();
28
+ const [confirmAppSk, setConfirmAppSk] = (0, _react.useState)(null);
29
+ const onAppSkChange = value => {
30
+ setConfirmAppSk({
31
+ value
32
+ });
33
+ return false;
34
+ };
35
+ const _onConfirm = async v => {
36
+ try {
37
+ await onChange(v);
38
+ } finally {
39
+ setConfirmAppSk(null);
40
+ }
41
+ };
42
+ return [/*#__PURE__*/(0, _jsxRuntime.jsx)(_formTextInput.default, {
43
+ disabled: disabled,
44
+ loading: loading,
45
+ initialValue: initialValue,
46
+ onSubmit: onAppSkChange,
47
+ secure: true
48
+ }), confirmAppSk && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
49
+ title: t('blocklet.config.appSkTitle'),
50
+ description: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
51
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
52
+ children: t('blocklet.config.appSkChangeTip')
53
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
54
+ fontWeight: "bold",
55
+ mt: 2,
56
+ children: t('blocklet.config.appDidChangeTip')
57
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(UL, {
58
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
59
+ children: t('blocklet.config.appDidChangeTipL1')
60
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
61
+ children: t('blocklet.config.appDidChangeTipL2')
62
+ })]
63
+ })]
64
+ }),
65
+ confirm: t('confirm'),
66
+ cancel: t('cancel'),
67
+ onConfirm: () => _onConfirm(confirmAppSk.value),
68
+ onCancel: () => setConfirmAppSk(null)
69
+ })];
70
+ }
71
+ AppSk.propTypes = {
72
+ initialValue: _propTypes.default.string,
73
+ onChange: _propTypes.default.func,
74
+ disabled: _propTypes.default.bool,
75
+ loading: _propTypes.default.bool
76
+ };
77
+ AppSk.defaultProps = {
78
+ initialValue: 'default',
79
+ onChange: () => {},
80
+ disabled: false,
81
+ loading: false
82
+ };
83
+ const UL = (0, _styled.default)('ul')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = WalletType;
7
+ var _react = require("react");
8
+ var _styled = _interopRequireDefault(require("@emotion/styled"));
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
11
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
12
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
13
+ var _context = require("@arcblock/ux/lib/Locale/context");
14
+ var _confirm = _interopRequireDefault(require("../../confirm"));
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ var _templateObject, _templateObject2;
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
19
+ function WalletType(_ref) {
20
+ let {
21
+ value,
22
+ onChange,
23
+ disabled
24
+ } = _ref;
25
+ const {
26
+ t
27
+ } = (0, _context.useLocaleContext)();
28
+ const [confirmCustomType, setConfirmCustomType] = (0, _react.useState)(null);
29
+ const WalletTypes = [{
30
+ label: 'DID',
31
+ value: 'default'
32
+ }, {
33
+ label: 'ETH',
34
+ value: 'eth'
35
+ }];
36
+ const onWalletTypeChange = async e => {
37
+ setConfirmCustomType({
38
+ value: e.target.value
39
+ });
40
+ };
41
+ const _onConfirm = async v => {
42
+ try {
43
+ await onChange(v);
44
+ } finally {
45
+ setConfirmCustomType(null);
46
+ }
47
+ };
48
+ return [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
49
+ disabled: disabled,
50
+ select: true,
51
+ size: "small",
52
+ value: value || 'default',
53
+ onChange: onWalletTypeChange,
54
+ children: WalletTypes.map(type => {
55
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledMenuItem, {
56
+ value: type.value,
57
+ sx: {
58
+ display: 'block'
59
+ },
60
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
61
+ display: "flex",
62
+ alignItems: "center",
63
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
64
+ children: type.label
65
+ })
66
+ })
67
+ });
68
+ })
69
+ }), confirmCustomType && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
70
+ title: t('blocklet.config.walletTypeTitle'),
71
+ description: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
72
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
73
+ dangerouslySetInnerHTML: {
74
+ __html: t('blocklet.config.blockletTypeChangeTip', {
75
+ value: WalletTypes.find(x => x.value === confirmCustomType.value).label
76
+ })
77
+ }
78
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
79
+ fontWeight: "bold",
80
+ mt: 2,
81
+ children: t('blocklet.config.appDidChangeTip')
82
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(UL, {
83
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
84
+ children: t('blocklet.config.appDidChangeTipL1')
85
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
86
+ children: t('blocklet.config.appDidChangeTipL2')
87
+ })]
88
+ })]
89
+ }),
90
+ confirm: t('confirm'),
91
+ cancel: t('cancel'),
92
+ onConfirm: () => _onConfirm(confirmCustomType.value),
93
+ onCancel: () => setConfirmCustomType(null)
94
+ })];
95
+ }
96
+ WalletType.propTypes = {
97
+ value: _propTypes.default.string,
98
+ onChange: _propTypes.default.func,
99
+ disabled: _propTypes.default.bool
100
+ };
101
+ WalletType.defaultProps = {
102
+ value: 'default',
103
+ onChange: () => {},
104
+ disabled: false
105
+ };
106
+ const StyledMenuItem = (0, _styled.default)(_MenuItem.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .tip {\n font-size: 12px;\n color: ", ";\n }\n"])), props => props.theme.palette.text.secondary);
107
+ const UL = (0, _styled.default)('ul')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));
@@ -16,7 +16,7 @@ var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
16
16
  var _required = _interopRequireDefault(require("./required"));
17
17
  var _formWrapper = _interopRequireDefault(require("./form-wrapper"));
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
- const _excluded = ["label", "disabled", "required", "initialValue", "onChange", "placeholder", "style", "onSubmit"];
19
+ const _excluded = ["label", "disabled", "required", "initialValue", "onChange", "placeholder", "style", "onSubmit", "secure"];
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
  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; }
22
22
  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; }
@@ -34,12 +34,13 @@ function FormTextInput(_ref) {
34
34
  onChange,
35
35
  placeholder,
36
36
  style,
37
- onSubmit
37
+ onSubmit,
38
+ secure
38
39
  } = _ref,
39
40
  rest = _objectWithoutProperties(_ref, _excluded);
40
41
  const [editing, setEditing] = (0, _react.useState)(false);
41
42
  const [loading, setLoading] = (0, _react.useState)(false);
42
- const [defaultValue, setDefaultValue] = (0, _react.useState)(initialValue);
43
+ const [defaultValue, setDefaultValue] = (0, _react.useState)(secure && initialValue === '__encrypted__' ? '' : initialValue);
43
44
  const [value, setValue] = (0, _react.useState)(defaultValue);
44
45
  const handleSubmit = async () => {
45
46
  setLoading(true);
@@ -82,14 +83,15 @@ function FormTextInput(_ref) {
82
83
  variant: "outlined",
83
84
  placeholder: placeholder,
84
85
  onKeyDown: handleKeydown,
85
- disabled: disabled
86
+ disabled: disabled,
87
+ type: secure ? 'password' : 'text'
86
88
  }, rest)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
87
89
  px: 1,
88
90
  className: "form-item-input slot",
89
91
  style: {
90
92
  whiteSpace: 'pre-wrap'
91
93
  },
92
- children: value
94
+ children: secure ? '******' : value
93
95
  });
94
96
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_formWrapper.default, {
95
97
  className: "form",
@@ -145,7 +147,8 @@ FormTextInput.propTypes = {
145
147
  initialValue: _propTypes.default.string,
146
148
  placeholder: _propTypes.default.string,
147
149
  required: _propTypes.default.bool,
148
- disabled: _propTypes.default.bool
150
+ disabled: _propTypes.default.bool,
151
+ secure: _propTypes.default.bool
149
152
  };
150
153
  FormTextInput.defaultProps = {
151
154
  style: {},
@@ -155,5 +158,6 @@ FormTextInput.defaultProps = {
155
158
  initialValue: '',
156
159
  placeholder: '',
157
160
  required: false,
158
- disabled: false
161
+ disabled: false,
162
+ secure: false
159
163
  };
@@ -19,7 +19,7 @@ function useAvatar(_ref) {
19
19
  const {
20
20
  inService
21
21
  } = node;
22
- const search = "?v=".concat(blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.version);
22
+ const search = "?v=".concat(blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.version).concat((0, _util.isDownloading)(blocklet === null || blocklet === void 0 ? void 0 : blocklet.status) ? '~' : '');
23
23
  let logoUrl = inService ? (0, _urlJoin.default)(_util.APP_PREFIX, _constant.WELLKNOWN_SERVICE_PATH_PREFIX, '/blocklet/logo-bundle', search) : (0, _urlJoin.default)(node.imgPrefix, 'blocklet.png');
24
24
  if (blocklet.source === 'registry' && blocklet.deployedFrom && blocklet.meta.logo) {
25
25
  logoUrl = (0, _urlJoin.default)(blocklet.deployedFrom, (0, _util.formatRegistryLogoPath)(blocklet.meta.bundleDid, blocklet.meta.logo), search);
package/lib/locales/en.js CHANGED
@@ -387,7 +387,15 @@ module.exports = {
387
387
  invalidKey: 'Configuration key must not start with BLOCKLET_ or COMPONENT_',
388
388
  deleteForbidden: 'This configuration is required and should not be deleted',
389
389
  tip: 'Configurations prefixed with BWA_ should not contain sensitive information because they will be sent to the browser'
390
- }
390
+ },
391
+ dangerZone: 'Danger Zone',
392
+ blockletTypeChangeTip: 'Wallet Type will be changed to <b>{value}</b>',
393
+ appDidChangeTip: 'This operation will change the DID of the application, which will lead to the following problems. Please confirm after careful evaluation:',
394
+ appDidChangeTipL1: "The user's account connected to this application will change",
395
+ appDidChangeTipL2: 'The DID domain name of the application will change, and the original domain name will become invalid',
396
+ appSkChangeTip: 'You are changing application secret key',
397
+ walletTypeTitle: 'Update Wallet Type',
398
+ appSkTitle: 'Update Application Secret Key'
391
399
  },
392
400
  overview: {
393
401
  source: 'Source',
@@ -1165,5 +1173,11 @@ module.exports = {
1165
1173
  noEdit: "Uninstalled component can't edit",
1166
1174
  noDel: 'Not allowed delete built-in navigation'
1167
1175
  }
1176
+ },
1177
+ log: {
1178
+ lastDays: {
1179
+ 1: 'Last 1 Day',
1180
+ 7: 'Last 1 Week'
1181
+ }
1168
1182
  }
1169
1183
  };
package/lib/locales/zh.js CHANGED
@@ -393,7 +393,15 @@ module.exports = {
393
393
  invalidKey: '键不能以 BLOCKLET_ 或 COMPONENT_ 开头',
394
394
  deleteForbidden: '该配置项是必填项,不能删除',
395
395
  tip: '包含 BWA_ 前缀的配置项不应该包含敏感信息,因为他们会被发送到前端页面'
396
- }
396
+ },
397
+ dangerZone: '危险操作',
398
+ blockletTypeChangeTip: '钱包类型将被修改为 <b>{value}</b>',
399
+ appDidChangeTip: '该操作会导致应用 DID 发生变化,进而导致如下问题,请仔细评估后确认:',
400
+ appDidChangeTipL1: '用户连接此应用的账户会发生变化',
401
+ appDidChangeTipL2: '应用的 DID 域名会发生变化,原域名将会失效',
402
+ appSkChangeTip: '你正在修改应用私钥',
403
+ walletTypeTitle: '修改钱包类型',
404
+ appSkTitle: '修改应用私钥'
397
405
  },
398
406
  overview: {
399
407
  source: '来源',
@@ -1170,5 +1178,11 @@ module.exports = {
1170
1178
  noEdit: '未安装组件的导航无法编辑',
1171
1179
  noDel: '内置的导航无法删除'
1172
1180
  }
1181
+ },
1182
+ log: {
1183
+ lastDays: {
1184
+ 1: '最近 1 天',
1185
+ 7: '最近 1 周'
1186
+ }
1173
1187
  }
1174
1188
  };
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = DownloadLog;
7
+ var _react = require("react");
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _dayjs = _interopRequireDefault(require("dayjs"));
10
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
11
+ var _Download = _interopRequireDefault(require("@mui/icons-material/Download"));
12
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
13
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
14
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
15
+ var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
16
+ var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
17
+ var _context = require("@arcblock/ux/lib/Locale/context");
18
+ var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
19
+ var _formatName = _interopRequireDefault(require("@abtnode/util/lib/format-name"));
20
+ var _node = require("../contexts/node");
21
+ var _toast = _interopRequireDefault(require("../toast"));
22
+ var _jsxRuntime = require("react/jsx-runtime");
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+ const DAYS = [1, 7];
25
+ function DownloadLog(_ref) {
26
+ let {
27
+ id,
28
+ name
29
+ } = _ref;
30
+ const {
31
+ t
32
+ } = (0, _context.useLocaleContext)();
33
+ const {
34
+ restApi,
35
+ inService
36
+ } = (0, _node.useNodeContext)();
37
+ const [showDialog, setShowDialog] = (0, _react.useState)(false);
38
+ const [isDownloading, setIsDownloading] = (0, _react.useState)(false);
39
+ const [days, setDays] = (0, _react.useState)(1);
40
+ const onDownload = async () => {
41
+ if (isDownloading) {
42
+ return;
43
+ }
44
+ try {
45
+ setIsDownloading(true);
46
+ const logId = inService ? '' : "/".concat(id);
47
+ const res = await restApi.get("/download/log".concat(logId, "?days=").concat(days), {
48
+ responseType: 'blob'
49
+ });
50
+ const href = URL.createObjectURL(res.data);
51
+ const link = document.createElement('a');
52
+ link.href = href;
53
+ link.setAttribute('download', "".concat((0, _formatName.default)(name || id), ".").concat((0, _dayjs.default)().format('YYYYMMDDHHmmss'), ".log.zip"));
54
+ document.body.appendChild(link);
55
+ link.click();
56
+ document.body.removeChild(link);
57
+ URL.revokeObjectURL(href);
58
+ setIsDownloading(false);
59
+ } catch (error) {
60
+ setIsDownloading(false);
61
+ _toast.default.error(error.message);
62
+ }
63
+ };
64
+ const onDaysChange = e => {
65
+ setDays(e.target.value);
66
+ };
67
+ return [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
68
+ display: "flex",
69
+ alignItems: "center",
70
+ style: {
71
+ gap: 16
72
+ },
73
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
74
+ "data-cy": "download-logs",
75
+ variant: "outlined",
76
+ onClick: () => setShowDialog(true),
77
+ disabled: isDownloading,
78
+ children: [isDownloading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
79
+ size: [16, 10]
80
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Download.default, {
81
+ fontSize: "small",
82
+ style: {
83
+ transform: 'translateY(2px)'
84
+ }
85
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
86
+ ml: 0.5,
87
+ children: t('common.download')
88
+ })]
89
+ })
90
+ }), showDialog && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
91
+ open: true,
92
+ onClose: () => {
93
+ setShowDialog(false);
94
+ },
95
+ disableEscapeKeyDown: true,
96
+ title: t('common.download'),
97
+ PaperProps: {
98
+ style: {
99
+ minHeight: 'auto'
100
+ }
101
+ },
102
+ actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
103
+ "data-cy": "download-logs",
104
+ variant: "outlined",
105
+ onClick: () => onDownload(),
106
+ disabled: isDownloading,
107
+ children: [isDownloading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
108
+ size: [16, 10]
109
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
110
+ ml: 0.5,
111
+ children: t('common.confirm')
112
+ })]
113
+ }),
114
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
115
+ mb: 2,
116
+ display: "flex",
117
+ justifyContent: "center",
118
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControl.default, {
119
+ size: "small",
120
+ fullWidth: true,
121
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
122
+ value: days,
123
+ onChange: onDaysChange,
124
+ children: DAYS.map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
125
+ value: x,
126
+ children: t("log.lastDays.".concat(x))
127
+ }, x))
128
+ })
129
+ })
130
+ })
131
+ })];
132
+ }
133
+ DownloadLog.propTypes = {
134
+ id: _propTypes.default.string.isRequired,
135
+ name: _propTypes.default.string
136
+ };
137
+ DownloadLog.defaultProps = {
138
+ name: ''
139
+ };
@@ -16,7 +16,7 @@ var _clock = _interopRequireDefault(require("./clock"));
16
16
  var _node = require("../contexts/node");
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  var _templateObject, _templateObject2;
19
- const _excluded = ["name", "logId", "types", "initialData", "prepend"],
19
+ const _excluded = ["name", "logId", "types", "initialData", "prepend", "postpend"],
20
20
  _excluded2 = ["logFile"];
21
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
22
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
@@ -36,7 +36,8 @@ function LogTerminalGroup(_ref) {
36
36
  logId,
37
37
  types,
38
38
  initialData,
39
- prepend
39
+ prepend,
40
+ postpend
40
41
  } = _ref,
41
42
  rest = _objectWithoutProperties(_ref, _excluded);
42
43
  const {
@@ -83,18 +84,24 @@ function LogTerminalGroup(_ref) {
83
84
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(LogTerminalGroupRoot, _objectSpread(_objectSpread({}, rest), {}, {
84
85
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
85
86
  className: "log-terminal-group-head",
86
- children: [prepend, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
87
- variant: "outlined",
88
- size: isMobile ? 'small' : 'medium',
89
- children: types.map(type => {
90
- const props = type === currentType ? {
91
- variant: 'contained'
92
- } : {};
93
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread({}, props), {}, {
94
- onClick: () => setCurrentType(type),
95
- children: logTypeLabels[type]
96
- }), type);
97
- })
87
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
88
+ className: "log-terminal-group-head-start",
89
+ children: [prepend, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
90
+ variant: "outlined",
91
+ size: isMobile ? 'small' : 'medium',
92
+ children: types.map(type => {
93
+ const props = type === currentType ? {
94
+ variant: 'contained'
95
+ } : {};
96
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread({}, props), {}, {
97
+ onClick: () => setCurrentType(type),
98
+ children: logTypeLabels[type]
99
+ }), type);
100
+ })
101
+ })]
102
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
103
+ className: "log-terminal-group-head-end",
104
+ children: postpend
98
105
  })]
99
106
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
100
107
  className: "log-terminal-group-terminals",
@@ -121,14 +128,16 @@ LogTerminalGroup.propTypes = {
121
128
  types: _propTypes.default.arrayOf(_propTypes.default.string),
122
129
  // 写入 terminal 的初始数据
123
130
  initialData: _propTypes.default.arrayOf(_propTypes.default.string),
124
- prepend: _propTypes.default.node
131
+ prepend: _propTypes.default.node,
132
+ postpend: _propTypes.default.node
125
133
  };
126
134
  LogTerminalGroup.defaultProps = {
127
135
  types: ['error', 'info', 'access', 'stdout', 'stderr'],
128
136
  initialData: [],
129
- prepend: null
137
+ prepend: null,
138
+ postpend: null
130
139
  };
131
- const LogTerminalGroupRoot = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n .log-terminal-group-head {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n gap: 16px;\n padding-bottom: 16px;\n\n ", " {\n flex-direction: column;\n align-items: start;\n }\n }\n .log-terminal-group-terminals {\n flex: 1;\n position: relative;\n overflow: hidden;\n > * {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n }\n"])), props => props.theme.breakpoints.down('md'));
140
+ const LogTerminalGroupRoot = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n .log-terminal-group-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-bottom: 16px;\n }\n\n .log-terminal-group-head-start {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n gap: 16px;\n ", " {\n flex-direction: column;\n align-items: start;\n }\n }\n\n .log-terminal-group-head-end {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n gap: 16px;\n ", " {\n flex-direction: column;\n align-items: start;\n }\n }\n .log-terminal-group-terminals {\n flex: 1;\n position: relative;\n overflow: hidden;\n > * {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n }\n"])), props => props.theme.breakpoints.down('md'), props => props.theme.breakpoints.down('md'));
132
141
  const LogTerminal = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
133
142
  let {
134
143
  logFile
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.59",
6
+ "version": "1.8.61",
7
7
  "description": "UX components shared across abtnode packages",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -21,19 +21,19 @@
21
21
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@abtnode/auth": "1.8.59",
25
- "@abtnode/constant": "1.8.59",
26
- "@abtnode/util": "1.8.59",
27
- "@arcblock/did-connect": "^2.4.64",
24
+ "@abtnode/auth": "1.8.61",
25
+ "@abtnode/constant": "1.8.61",
26
+ "@abtnode/util": "1.8.61",
27
+ "@arcblock/did-connect": "^2.4.65",
28
28
  "@arcblock/did-motif": "^1.1.10",
29
- "@arcblock/icons": "^2.4.64",
30
- "@arcblock/terminal": "^2.4.64",
31
- "@arcblock/ux": "^2.4.64",
32
- "@blocklet/constant": "1.8.59",
33
- "@blocklet/launcher-layout": "^1.9.30",
29
+ "@arcblock/icons": "^2.4.65",
30
+ "@arcblock/terminal": "^2.4.65",
31
+ "@arcblock/ux": "^2.4.65",
32
+ "@blocklet/constant": "1.8.61",
33
+ "@blocklet/launcher-layout": "^1.9.38",
34
34
  "@blocklet/list": "^0.10.47",
35
- "@blocklet/meta": "1.8.59",
36
- "@blocklet/ui-react": "^2.4.64",
35
+ "@blocklet/meta": "1.8.61",
36
+ "@blocklet/ui-react": "^2.4.65",
37
37
  "@emotion/react": "^11.10.4",
38
38
  "@emotion/styled": "^11.10.4",
39
39
  "@iconify/react": "^4.0.0",
@@ -86,5 +86,5 @@
86
86
  "@babel/preset-react": "^7.18.6",
87
87
  "babel-plugin-inline-react-svg": "^1.1.2"
88
88
  },
89
- "gitHead": "2cc84bf7f971585a6cc29b566d33c0a74d1ee94a"
89
+ "gitHead": "f68ac14c2074400d392e2171d328f12dbd2e64cb"
90
90
  }