@abtnode/ux 1.16.13-beta-423a40b1 → 1.16.13-beta-a83ad86d

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.
@@ -330,7 +330,7 @@ function BlockletEnvironment(_ref) {
330
330
  disabled: loading || disabled,
331
331
  loading: loading,
332
332
  options: languages,
333
- initialValue: customLanguages ? customLanguages.value.split(',') : ['en'],
333
+ initialValue: customLanguages ? customLanguages.value.split(',') : ['en', 'zh'],
334
334
  onSubmit: value => onSubmitConfig('BLOCKLET_APP_LANGUAGES', value)
335
335
  })]
336
336
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
@@ -24,16 +24,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
24
24
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
25
25
  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); }
26
26
  const defaultForm = {
27
- cacheTtl: 10 * 60,
28
27
  ttl: 86400 * 7
29
28
  };
30
29
  function fixTtl(data) {
31
30
  let reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
32
31
  const ttl = reverse ? data.ttl * 86400 : data.ttl / 86400;
33
- const cacheTtl = reverse ? data.cacheTtl * 60 : data.cacheTtl / 60;
34
32
  return _objectSpread(_objectSpread({}, data), {}, {
35
- ttl,
36
- cacheTtl
33
+ ttl
37
34
  });
38
35
  }
39
36
  function CommonSettings() {
@@ -52,7 +49,7 @@ function CommonSettings() {
52
49
  formState,
53
50
  reset
54
51
  } = (0, _reactHookForm.useForm)({
55
- defaultValues: (0, _pick.default)(fixTtl(sessionSettings), ['cacheTtl', 'ttl'])
52
+ defaultValues: (0, _pick.default)(fixTtl(sessionSettings), ['ttl'])
56
53
  });
57
54
  const {
58
55
  t
@@ -68,7 +65,7 @@ function CommonSettings() {
68
65
  config: fixTtl(data, true)
69
66
  }
70
67
  });
71
- const defaultValues = Object.assign({}, defaultForm, (blockletChanged === null || blockletChanged === void 0 ? void 0 : (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.session) || {});
68
+ const defaultValues = Object.assign({}, defaultForm, (0, _pick.default)((blockletChanged === null || blockletChanged === void 0 ? void 0 : (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.session) || {}, ['ttl']));
72
69
  // 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
73
70
  reset(fixTtl(defaultValues));
74
71
  _Toast.default.success(t('common.configSuccess'));
package/lib/locales/en.js CHANGED
@@ -1458,6 +1458,8 @@ module.exports = {
1458
1458
  success: 'Subscription will expire after {validity}',
1459
1459
  warning: 'Subscription will expire after {validity}',
1460
1460
  error: 'Subscription Expired'
1461
- }
1461
+ },
1462
+ loading: 'Load subscription...',
1463
+ loadFailed: 'Failed to load subscription info, please retry!'
1462
1464
  }
1463
1465
  };
package/lib/locales/zh.js CHANGED
@@ -1461,6 +1461,8 @@ module.exports = {
1461
1461
  success: '订阅将在{validity}后到期',
1462
1462
  warning: '订阅将在{validity}后到期',
1463
1463
  error: '订阅已过期'
1464
- }
1464
+ },
1465
+ loadFailed: '加载订阅信息失败,请重试!',
1466
+ loading: '加载订阅信息...'
1465
1467
  }
1466
1468
  };
@@ -7,7 +7,9 @@ exports.default = void 0;
7
7
  var _prettyMsI18n = _interopRequireDefault(require("pretty-ms-i18n"));
8
8
  var _context = require("@arcblock/ux/lib/Locale/context");
9
9
  var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
10
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
10
11
  var _Popover = _interopRequireDefault(require("@mui/material/Popover"));
12
+ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
11
13
  var _dayjs = _interopRequireDefault(require("dayjs"));
12
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
15
  var _react = require("react");
@@ -26,7 +28,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
26
28
  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; }
27
29
  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; }
28
30
  const ALERT_THRESHOLD_MS = 30 * 24 * 60 * 60 * 1000;
29
- function Expiration(_ref) {
31
+ function Subscription(_ref) {
30
32
  var _assetState$value, _assetState$value$dat, _assetState$value$dat2;
31
33
  let {
32
34
  chainHost,
@@ -49,11 +51,31 @@ function Expiration(_ref) {
49
51
  rest = _objectWithoutProperties(props, _excluded2);
50
52
  const assetState = (0, _useAsyncRetry.default)(() => (0, _util.getAsset)(chainHost, nftId));
51
53
  if (assetState.loading) {
52
- return '';
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, _objectSpread(_objectSpread({
55
+ sx: _objectSpread({
56
+ display: 'flex',
57
+ alignItems: 'center',
58
+ color: 'grey',
59
+ gap: 1
60
+ }, sx)
61
+ }, rest), {}, {
62
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
63
+ size: 16
64
+ }), t('expiration.loading')]
65
+ }));
53
66
  }
54
67
  if (assetState.error) {
55
68
  console.error(assetState.error);
56
- return '';
69
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, _objectSpread(_objectSpread({
70
+ label: t('expiration.loadFailed'),
71
+ color: "error",
72
+ variant: "success",
73
+ sx: _objectSpread({
74
+ cursor: 'pointer'
75
+ }, sx)
76
+ }, rest), {}, {
77
+ onClick: () => assetState.retry()
78
+ }));
57
79
  }
58
80
  const expirationDate = (0, _util.getAssetExpiration)(assetState.value);
59
81
  const launcherUrl = (_assetState$value = assetState.value) === null || _assetState$value === void 0 ? void 0 : (_assetState$value$dat = _assetState$value.data) === null || _assetState$value$dat === void 0 ? void 0 : (_assetState$value$dat2 = _assetState$value$dat.value) === null || _assetState$value$dat2 === void 0 ? void 0 : _assetState$value$dat2.launcherUrl;
@@ -99,7 +121,11 @@ function Expiration(_ref) {
99
121
  onClose: handlePopoverClose,
100
122
  anchorOrigin: {
101
123
  vertical: 'bottom',
102
- horizontal: 'left'
124
+ horizontal: 'right'
125
+ },
126
+ transformOrigin: {
127
+ vertical: 'top',
128
+ horizontal: 'right'
103
129
  },
104
130
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
105
131
  ref: iframeRef,
@@ -118,15 +144,15 @@ function Expiration(_ref) {
118
144
  })]
119
145
  });
120
146
  }
121
- Expiration.propTypes = {
147
+ Subscription.propTypes = {
122
148
  chainHost: _propTypes.default.string.isRequired,
123
149
  nftId: _propTypes.default.string.isRequired,
124
150
  sx: _propTypes.default.object,
125
151
  retention: _propTypes.default.number
126
152
  };
127
- Expiration.defaultProps = {
153
+ Subscription.defaultProps = {
128
154
  sx: {},
129
155
  retention: 0
130
156
  };
131
- var _default = Expiration;
157
+ var _default = Subscription;
132
158
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.13-beta-423a40b1",
3
+ "version": "1.16.13-beta-a83ad86d",
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.13-beta-423a40b1",
27
- "@abtnode/constant": "1.16.13-beta-423a40b1",
28
- "@abtnode/util": "1.16.13-beta-423a40b1",
26
+ "@abtnode/auth": "1.16.13-beta-a83ad86d",
27
+ "@abtnode/constant": "1.16.13-beta-a83ad86d",
28
+ "@abtnode/util": "1.16.13-beta-a83ad86d",
29
29
  "@ahooksjs/use-url-state": "^3.5.1",
30
30
  "@arcblock/did": "^1.18.84",
31
- "@arcblock/did-connect": "^2.5.52",
32
- "@arcblock/did-motif": "^1.1.11",
33
- "@arcblock/icons": "^2.5.52",
34
- "@arcblock/react-hooks": "^2.5.52",
35
- "@arcblock/terminal": "^2.5.52",
36
- "@arcblock/ux": "^2.5.52",
37
- "@blocklet/constant": "1.16.13-beta-423a40b1",
38
- "@blocklet/launcher-layout": "2.1.21",
39
- "@blocklet/list": "^0.12.3",
40
- "@blocklet/meta": "1.16.13-beta-423a40b1",
41
- "@blocklet/ui-react": "^2.5.52",
31
+ "@arcblock/did-connect": "^2.5.53",
32
+ "@arcblock/did-motif": "^1.1.12",
33
+ "@arcblock/icons": "^2.5.53",
34
+ "@arcblock/react-hooks": "^2.5.53",
35
+ "@arcblock/terminal": "^2.5.53",
36
+ "@arcblock/ux": "^2.5.53",
37
+ "@blocklet/constant": "1.16.13-beta-a83ad86d",
38
+ "@blocklet/launcher-layout": "2.1.26",
39
+ "@blocklet/list": "^0.12.4",
40
+ "@blocklet/meta": "1.16.13-beta-a83ad86d",
41
+ "@blocklet/ui-react": "^2.5.53",
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": "1aee04f45042bd4784ca72f9f8b93918980be4d4"
97
+ "gitHead": "dc2a4f7d5b55da109ebf873d8aa4d24f27a088c9"
98
98
  }