@abtnode/ux 1.8.65-beta-bfcc12ce → 1.8.65-beta-b8810d3f

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.
@@ -29,7 +29,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
29
29
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
30
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); }
31
31
  function Storage() {
32
- var _localStorage$getItem, _blocklet$environment;
32
+ var _localStorage$getItem, _blocklet$environment, _blocklet$environment2, _blocklet$environment3;
33
33
  const options = [
34
34
  // TODO: 测试用,上线后才需删除
35
35
  {
@@ -42,7 +42,6 @@ function Storage() {
42
42
  value: 'https://service.didspaces.com/app',
43
43
  label: 'prod spaces'
44
44
  }];
45
- const [didSpacesUrl, setDidSpacesUrl] = (0, _react.useState)(options[0].value);
46
45
 
47
46
  /** @type {{ api: import('@abtnode/client').ABTNodeClient }} */
48
47
  const {
@@ -58,6 +57,7 @@ function Storage() {
58
57
  blocklet
59
58
  } = (0, _blocklet.useBlockletContext)();
60
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) || '');
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);
61
61
  const [isLoading, setIsLoading] = (0, _react.useState)(false);
62
62
  const {
63
63
  appDid
@@ -91,6 +91,15 @@ function Storage() {
91
91
  _toast.default.error(error.message);
92
92
  });
93
93
  }
94
+ const onAuthorizeConnectSuccess = async (response, decrypt) => {
95
+ setEndpoint(decrypt(response.endpoint));
96
+ await saveStorageEndpoint(blocklet.meta.did, decrypt(response.endpoint));
97
+ setTimeout(() => {
98
+ setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
99
+ open: false
100
+ }));
101
+ }, 3000);
102
+ };
94
103
  const [authorizeConnect, setAuthorizeConnect] = (0, _react.useState)({
95
104
  open: false,
96
105
  action: 'one-click-authorization',
@@ -98,19 +107,6 @@ function Storage() {
98
107
  checkFn: _axios.default.create({
99
108
  baseURL: (0, _urlJoin.default)(didSpacesUrl, 'space')
100
109
  }).get,
101
- /**
102
- *
103
- * @param {{endpoint: string}} response
104
- */
105
- onSuccess: async (response, decrypt) => {
106
- setEndpoint(decrypt(response.endpoint));
107
- await saveStorageEndpoint(blocklet.meta.did, decrypt(response.endpoint));
108
- setTimeout(() => {
109
- setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
110
- open: false
111
- }));
112
- }, 3000);
113
- },
114
110
  onClose: () => {
115
111
  setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
116
112
  open: false
@@ -259,7 +255,7 @@ function Storage() {
259
255
  action: authorizeConnect.action,
260
256
  baseUrl: authorizeConnect.baseUrl,
261
257
  checkFn: authorizeConnect.checkFn,
262
- onSuccess: authorizeConnect.onSuccess,
258
+ onSuccess: onAuthorizeConnectSuccess,
263
259
  onClose: authorizeConnect.onClose,
264
260
  checkTimeout: authorizeConnect.checkTimeout,
265
261
  extraParams: authorizeConnect.extraParams,
@@ -21,7 +21,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
21
21
  const formatNumber = x => "".concat(x, "%");
22
22
  function CpuMonitor(_ref) {
23
23
  let {
24
- physicalCores,
24
+ cpus,
25
25
  currentLoad,
26
26
  history,
27
27
  hideDescription
@@ -91,18 +91,18 @@ function CpuMonitor(_ref) {
91
91
  children: tooltipState.textContent
92
92
  })]
93
93
  }),
94
- description: "".concat(t('system.cores'), ": ").concat(physicalCores || 0),
94
+ description: "".concat(t('system.cores'), ": ").concat((cpus === null || cpus === void 0 ? void 0 : cpus.length) || 0),
95
95
  hideDescription: hideDescription
96
96
  });
97
97
  }
98
98
  CpuMonitor.propTypes = {
99
- physicalCores: _propTypes.default.number,
99
+ cpus: _propTypes.default.array,
100
100
  currentLoad: _propTypes.default.number,
101
101
  history: _propTypes.default.array,
102
102
  hideDescription: _propTypes.default.bool
103
103
  };
104
104
  CpuMonitor.defaultProps = {
105
- physicalCores: 0,
105
+ cpus: [],
106
106
  currentLoad: 0,
107
107
  history: [],
108
108
  hideDescription: false
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.65-beta-bfcc12ce",
6
+ "version": "1.8.65-beta-b8810d3f",
7
7
  "description": "UX components shared across abtnode packages",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -21,18 +21,18 @@
21
21
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@abtnode/auth": "1.8.65-beta-bfcc12ce",
25
- "@abtnode/constant": "1.8.65-beta-bfcc12ce",
26
- "@abtnode/util": "1.8.65-beta-bfcc12ce",
24
+ "@abtnode/auth": "1.8.65-beta-b8810d3f",
25
+ "@abtnode/constant": "1.8.65-beta-b8810d3f",
26
+ "@abtnode/util": "1.8.65-beta-b8810d3f",
27
27
  "@arcblock/did-connect": "^2.4.71",
28
28
  "@arcblock/did-motif": "^1.1.10",
29
29
  "@arcblock/icons": "^2.4.71",
30
30
  "@arcblock/terminal": "^2.4.71",
31
31
  "@arcblock/ux": "^2.4.71",
32
- "@blocklet/constant": "1.8.65-beta-bfcc12ce",
32
+ "@blocklet/constant": "1.8.65-beta-b8810d3f",
33
33
  "@blocklet/launcher-layout": "^1.9.58",
34
34
  "@blocklet/list": "^0.10.50",
35
- "@blocklet/meta": "1.8.65-beta-bfcc12ce",
35
+ "@blocklet/meta": "1.8.65-beta-b8810d3f",
36
36
  "@blocklet/ui-react": "^2.4.71",
37
37
  "@emotion/react": "^11.10.4",
38
38
  "@emotion/styled": "^11.10.4",
@@ -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": "f6a56512275a55feecf2f3953542ea98777a08f2"
89
+ "gitHead": "a09db09103a4815026376a4af4c07acc2a7040e3"
90
90
  }