@abtnode/ux 1.16.11-beta-8e4c6e5c → 1.16.11-beta-0ae58a71

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.
@@ -34,6 +34,7 @@ var _util3 = require("./util");
34
34
  var _node = require("../contexts/node");
35
35
  var _confirm = _interopRequireDefault(require("../confirm"));
36
36
  var _icons = _interopRequireDefault(require("./icons"));
37
+ var _blocklet = require("../contexts/blocklet");
37
38
  var _jsxRuntime = require("react/jsx-runtime");
38
39
  var _templateObject;
39
40
  const _excluded = ["blocklet", "onStart", "onComplete", "variant", "hasPermission", "useBlockletUrlEvaluation"];
@@ -49,6 +50,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
49
50
  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; }
50
51
  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; }
51
52
  function BlockletActions(_ref) {
53
+ var _blocklet$controller, _blocklet$controller$, _blocklet$controller2, _blocklet$controller3;
52
54
  let {
53
55
  blocklet,
54
56
  onStart,
@@ -72,7 +74,14 @@ function BlockletActions(_ref) {
72
74
  loading: recommendedUrlLoading,
73
75
  recommendedUrl
74
76
  } = useBlockletUrlEvaluation(blocklet);
77
+ const {
78
+ nftState
79
+ } = (0, _blocklet.useBlockletContext)();
75
80
  const inProgress = (0, _util.isInProgress)(blocklet.status);
81
+ let disableStart = (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$controller = blocklet.controller) === null || _blocklet$controller === void 0 ? void 0 : (_blocklet$controller$ = _blocklet$controller.status) === null || _blocklet$controller$ === void 0 ? void 0 : _blocklet$controller$.value) === _constant.BLOCKLET_CONTROLLER_STATUS.suspended;
82
+ if (!(nftState !== null && nftState !== void 0 && nftState.expired) && (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$controller2 = blocklet.controller) === null || _blocklet$controller2 === void 0 ? void 0 : (_blocklet$controller3 = _blocklet$controller2.status) === null || _blocklet$controller3 === void 0 ? void 0 : _blocklet$controller3.reason) === _constant.SUSPENDED_REASON.expired) {
83
+ disableStart = false;
84
+ }
76
85
  const {
77
86
  inService
78
87
  } = node;
@@ -297,7 +306,7 @@ function BlockletActions(_ref) {
297
306
  icon: _icons.default.Start,
298
307
  name: t('common.start'),
299
308
  handler: createHandler('start', node.api.startBlocklet),
300
- disabled: blocklet.status === 'running' || blocklet.status === 'corrupted' || missingRequiredConfigs.length > 0 || (0, _util2.isDownloading)(blocklet.status) || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT || recommendedUrlLoading || inProgress
309
+ disabled: disableStart || blocklet.status === 'running' || blocklet.status === 'corrupted' || missingRequiredConfigs.length > 0 || (0, _util2.isDownloading)(blocklet.status) || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT || recommendedUrlLoading || inProgress
301
310
  }, {
302
311
  action: 'stop',
303
312
  icon: _icons.default.Stop,
@@ -309,13 +318,13 @@ function BlockletActions(_ref) {
309
318
  icon: _icons.default.Restart,
310
319
  name: t('common.restart'),
311
320
  handler: createHandler('restart', node.api.restartBlocklet, true),
312
- disabled: blocklet.status !== 'running' || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT
321
+ disabled: disableStart || blocklet.status !== 'running' || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT
313
322
  }, {
314
323
  action: 'reload',
315
324
  icon: _icons.default.Reload,
316
325
  name: t('common.reload'),
317
326
  handler: createHandler('reload', node.api.reloadBlocklet),
318
- disabled: blocklet.status !== 'running' || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT
327
+ disabled: disableStart || blocklet.status !== 'running' || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT
319
328
  }, (0, _util2.isDownloading)(blocklet.status) ? cancelDownloadAction : removeAction, {
320
329
  separator: true
321
330
  }, {
@@ -5,20 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
8
- var _get = _interopRequireDefault(require("lodash/get"));
9
- var _last = _interopRequireDefault(require("lodash/last"));
10
- var _urlJoin = _interopRequireDefault(require("url-join"));
11
- var _useAsync = _interopRequireDefault(require("react-use/lib/useAsync"));
12
8
  var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
13
9
  var _context = require("@arcblock/ux/lib/Locale/context");
14
10
  var _Button = _interopRequireDefault(require("@mui/material/Button"));
15
11
  var _Link = _interopRequireDefault(require("@mui/material/Link"));
16
12
  var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
13
+ var _blocklet = require("../../contexts/blocklet");
17
14
  var _util = require("../../util");
18
15
  var _jsxRuntime = require("react/jsx-runtime");
19
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
17
  function Expiration(_ref) {
21
- var _state$value, _state$value$data, _state$value$data$val;
22
18
  let {
23
19
  controller
24
20
  } = _ref;
@@ -26,18 +22,15 @@ function Expiration(_ref) {
26
22
  t,
27
23
  locale
28
24
  } = (0, _context.useLocaleContext)();
29
- const state = (0, _useAsync.default)(async () => (0, _util.getAsset)(controller.chainHost, controller.nftId));
30
- if (state.loading) {
31
- return '';
32
- }
33
- if (state.error) {
34
- console.error('load nft expiration failed, nfId:', controller === null || controller === void 0 ? void 0 : controller.nftId, 'chainHost:', controller === null || controller === void 0 ? void 0 : controller.chainHost, state.error);
25
+ const {
26
+ nftState
27
+ } = (0, _blocklet.useBlockletContext)();
28
+ if (!nftState) {
35
29
  return '-';
36
30
  }
37
- const expirationDate = (0, _last.default)((0, _get.default)(state.value, 'data.value.expirationDate', []));
38
31
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
39
32
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.default, {
40
- value: expirationDate,
33
+ value: nftState === null || nftState === void 0 ? void 0 : nftState.expirationDate,
41
34
  locale: locale
42
35
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
43
36
  style: {
@@ -45,7 +38,11 @@ function Expiration(_ref) {
45
38
  },
46
39
  variant: "contained",
47
40
  component: _Link.default,
48
- href: (0, _urlJoin.default)((_state$value = state.value) === null || _state$value === void 0 ? void 0 : (_state$value$data = _state$value.data) === null || _state$value$data === void 0 ? void 0 : (_state$value$data$val = _state$value$data.value) === null || _state$value$data$val === void 0 ? void 0 : _state$value$data$val.launcherUrl, "/instances/".concat(controller.nftId, "/renewal?locale=").concat(locale, "&return-url=").concat(encodeURIComponent(window.location.href))),
41
+ href: (0, _util.getRenewBlockletURL)({
42
+ nftState,
43
+ nftId: controller.nftId,
44
+ locale
45
+ }),
49
46
  children: t('common.renew')
50
47
  })]
51
48
  });
@@ -59,7 +59,8 @@ function PassportList() {
59
59
  const [showTrustedFactories, setShowTrustedFactories] = (0, _react.useState)(false);
60
60
  const [search, setSearch] = (0, _react.useState)('');
61
61
  const [loading, setLoading] = (0, _react.useState)(false);
62
- const toggleShowIssue = async () => {
62
+ const toggleShowIssue = async e => {
63
+ e.stopPropagation();
63
64
  if (loading) {
64
65
  return;
65
66
  }
@@ -113,9 +114,7 @@ function PassportList() {
113
114
  })
114
115
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SplitButton.default.Item, {
115
116
  "data-cy": "config-show-issue-passport",
116
- onClick: () => {
117
- toggleShowIssue();
118
- },
117
+ onClick: toggleShowIssue,
119
118
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
120
119
  display: "flex",
121
120
  alignItems: "center",
@@ -22,6 +22,7 @@ var _FormHelperText = _interopRequireDefault(require("@mui/material/FormHelperTe
22
22
  var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
23
23
  var _ToggleButton = _interopRequireDefault(require("@mui/material/ToggleButton"));
24
24
  var _ToggleButtonGroup = _interopRequireDefault(require("@mui/material/ToggleButtonGroup"));
25
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
25
26
  var _constant = require("@abtnode/constant");
26
27
  var _context = require("@arcblock/ux/lib/Locale/context");
27
28
  var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
@@ -277,26 +278,32 @@ function TrustedFactory(_ref) {
277
278
  }),
278
279
  "data-cy": "input-passport-ttl-since",
279
280
  "aria-label": "Expire Policy",
280
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
281
- title: t('team.passport.ttlNeverTip'),
282
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleButton.default, {
283
- value: "never",
284
- "data-cy": "input-passport-ttl-never",
285
- children: t('team.passport.ttlNever')
281
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleButton.default, {
282
+ value: "never",
283
+ "data-cy": "input-passport-ttl-never",
284
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
285
+ title: t('team.passport.ttlNeverTip'),
286
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
287
+ children: t('team.passport.ttlNever')
288
+ })
286
289
  })
287
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
288
- title: t('team.passport.ttlMintTip'),
289
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleButton.default, {
290
- value: "mint",
291
- "data-cy": "input-passport-ttl-mint",
292
- children: t('team.passport.ttlMint')
290
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleButton.default, {
291
+ value: "mint",
292
+ "data-cy": "input-passport-ttl-mint",
293
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
294
+ title: t('team.passport.ttlMintTip'),
295
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
296
+ children: t('team.passport.ttlMint')
297
+ })
293
298
  })
294
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
295
- title: t('team.passport.ttlExchangeTip'),
296
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleButton.default, {
297
- value: "exchange",
298
- "data-cy": "input-passport-ttl-exchange",
299
- children: t('team.passport.ttlExchange')
299
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleButton.default, {
300
+ value: "exchange",
301
+ "data-cy": "input-passport-ttl-exchange",
302
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
303
+ title: t('team.passport.ttlExchangeTip'),
304
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
305
+ children: t('team.passport.ttlExchange')
306
+ })
300
307
  })
301
308
  })]
302
309
  }), state.ttlPolicy !== 'never' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
package/lib/util/index.js CHANGED
@@ -28,7 +28,7 @@ exports.getBlockletUrls = getBlockletUrls;
28
28
  exports.getExplorerLink = getExplorerLink;
29
29
  exports.getPathPrefix = exports.getIssuePassportLink = exports.getInviteLink = void 0;
30
30
  exports.getRelativeTime = getRelativeTime;
31
- exports.getTransferAppLink = exports.getStoreList = void 0;
31
+ exports.getTransferAppLink = exports.getStoreList = exports.getRenewBlockletURL = void 0;
32
32
  exports.getWebWalletUrl = getWebWalletUrl;
33
33
  exports.isNewStoreUrl = exports.isInstalling = exports.isDownloading = exports.isChrome = exports.isCertificateMatch = exports.isBlockletDev = void 0;
34
34
  exports.isProtectedRole = isProtectedRole;
@@ -717,4 +717,14 @@ const sortDomains = domains => {
717
717
  };
718
718
  exports.sortDomains = sortDomains;
719
719
  const formatMountPoint = value => (0, _normalizePathPrefix.default)((0, _urlPathFriendly.default)(value));
720
- exports.formatMountPoint = formatMountPoint;
720
+ exports.formatMountPoint = formatMountPoint;
721
+ const getRenewBlockletURL = _ref7 => {
722
+ var _nftState$data, _nftState$data$value;
723
+ let {
724
+ nftState,
725
+ nftId,
726
+ locale = 'en'
727
+ } = _ref7;
728
+ return (0, _urlJoin.default)(nftState === null || nftState === void 0 ? void 0 : (_nftState$data = nftState.data) === null || _nftState$data === void 0 ? void 0 : (_nftState$data$value = _nftState$data.value) === null || _nftState$data$value === void 0 ? void 0 : _nftState$data$value.launcherUrl, "/instances/".concat(nftId, "/renewal?locale=").concat(locale, "&return-url=").concat(encodeURIComponent(window.location.href)));
729
+ };
730
+ exports.getRenewBlockletURL = getRenewBlockletURL;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.11-beta-8e4c6e5c",
3
+ "version": "1.16.11-beta-0ae58a71",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,22 +23,22 @@
23
23
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@abtnode/auth": "1.16.11-beta-8e4c6e5c",
27
- "@abtnode/constant": "1.16.11-beta-8e4c6e5c",
28
- "@abtnode/util": "1.16.11-beta-8e4c6e5c",
26
+ "@abtnode/auth": "1.16.11-beta-0ae58a71",
27
+ "@abtnode/constant": "1.16.11-beta-0ae58a71",
28
+ "@abtnode/util": "1.16.11-beta-0ae58a71",
29
29
  "@ahooksjs/use-url-state": "^3.5.1",
30
30
  "@arcblock/did": "^1.18.80",
31
- "@arcblock/did-connect": "^2.5.46",
31
+ "@arcblock/did-connect": "^2.5.48",
32
32
  "@arcblock/did-motif": "^1.1.10",
33
- "@arcblock/icons": "^2.5.46",
34
- "@arcblock/react-hooks": "^2.5.46",
35
- "@arcblock/terminal": "^2.5.46",
36
- "@arcblock/ux": "^2.5.46",
37
- "@blocklet/constant": "1.16.11-beta-8e4c6e5c",
38
- "@blocklet/launcher-layout": "2.0.45",
33
+ "@arcblock/icons": "^2.5.48",
34
+ "@arcblock/react-hooks": "^2.5.48",
35
+ "@arcblock/terminal": "^2.5.48",
36
+ "@arcblock/ux": "^2.5.48",
37
+ "@blocklet/constant": "1.16.11-beta-0ae58a71",
38
+ "@blocklet/launcher-layout": "2.1.0",
39
39
  "@blocklet/list": "^0.11.28",
40
- "@blocklet/meta": "1.16.11-beta-8e4c6e5c",
41
- "@blocklet/ui-react": "^2.5.46",
40
+ "@blocklet/meta": "1.16.11-beta-0ae58a71",
41
+ "@blocklet/ui-react": "^2.5.48",
42
42
  "@emotion/react": "^11.10.4",
43
43
  "@emotion/styled": "^11.10.4",
44
44
  "@iconify/react": "^4.0.0",
@@ -94,5 +94,5 @@
94
94
  "@babel/preset-react": "^7.18.6",
95
95
  "babel-plugin-inline-react-svg": "^1.1.2"
96
96
  },
97
- "gitHead": "bd1beb1fb79e075d31359f438a263ee9077d3cd9"
97
+ "gitHead": "5d044a08b4399eb855563e670af7cbd0d3851e94"
98
98
  }