@abtnode/ux 1.16.6-beta-8be2fe37 → 1.16.6-beta-4ea1eb90

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.
@@ -87,20 +87,32 @@ function BlockletActions(_ref) {
87
87
  setConfirmSetting(null);
88
88
  let isRemoved = false;
89
89
  try {
90
- var _blocklet$settings;
91
90
  if (action === 'remove') {
92
91
  await fn(params);
93
- } else if (action === 'start' && !inService && !skipSetup && !((_blocklet$settings = blocklet.settings) !== null && _blocklet$settings !== void 0 && _blocklet$settings.initialized)) {
94
- // 启动 blocklet 并跳转到 setup 流程界面时携带 serverUrl 查询参数
95
- const serverUrl = (0, _util3.getServerUrl)(node.info);
96
- const url = new URL(recommendedUrl);
97
- url.searchParams.set('serverUrl', serverUrl);
98
- window.open(url.href);
99
- onComplete({
100
- action,
101
- blocklet
92
+ } else if (action === 'start') {
93
+ var _blocklet$settings;
94
+ if (!inService && !skipSetup && !((_blocklet$settings = blocklet.settings) !== null && _blocklet$settings !== void 0 && _blocklet$settings.initialized)) {
95
+ // 跳转到 setup 流程界面时携带 serverUrl 查询参数
96
+ const serverUrl = (0, _util3.getServerUrl)(node.info);
97
+ const url = new URL(recommendedUrl);
98
+ url.searchParams.set('serverUrl', serverUrl);
99
+ window.open(url.href);
100
+ onComplete({
101
+ action,
102
+ blocklet
103
+ });
104
+ return;
105
+ }
106
+ if (!(0, _util.hasRunnableComponent)(blocklet)) {
107
+ _toast.default.error(t('blocklet.noComponent'));
108
+ return;
109
+ }
110
+ const input = {
111
+ did: blocklet.meta.did
112
+ };
113
+ await fn({
114
+ input
102
115
  });
103
- return;
104
116
  } else {
105
117
  const input = {
106
118
  did: blocklet.meta.did
@@ -283,7 +295,7 @@ function BlockletActions(_ref) {
283
295
  icon: _icons.default.Start,
284
296
  name: t('common.start'),
285
297
  handler: createHandler('start', node.api.startBlocklet),
286
- disabled: !(0, _util.hasRunnableComponent)(blocklet) || blocklet.status === 'running' || blocklet.status === 'corrupted' || missingRequiredConfigs.length > 0 || (0, _util2.isDownloading)(blocklet.status) || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT || recommendedUrlLoading || inProgress
298
+ disabled: blocklet.status === 'running' || blocklet.status === 'corrupted' || missingRequiredConfigs.length > 0 || (0, _util2.isDownloading)(blocklet.status) || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT || recommendedUrlLoading || inProgress
287
299
  }, {
288
300
  action: 'stop',
289
301
  icon: _icons.default.Stop,
@@ -30,6 +30,20 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
30
30
  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; }
31
31
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
32
32
  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); }
33
+ const getDescription = (data, t) => {
34
+ let {
35
+ description
36
+ } = data;
37
+ if (Object.values(_constant.CHAIN_PROP_MAP).includes(data.key)) {
38
+ description = "".concat(data.description, " (").concat(t('blocklet.config.sharedToAllComponents'), ")");
39
+ }
40
+ return description && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
41
+ style: {
42
+ marginLeft: 12
43
+ },
44
+ children: description
45
+ });
46
+ };
33
47
  function ComponentEnvironment(_ref) {
34
48
  let {
35
49
  blocklet,
@@ -141,7 +155,7 @@ function ComponentEnvironment(_ref) {
141
155
  const sharedConfigObj = (0, _util.getSharedConfigObj)(blocklet, ancestors);
142
156
  const missingRequiredConfigs = (0, _util.getComponentMissingConfigs)(blocklet, ancestors);
143
157
  const configs = componentConfigs.map(x => _objectSpread(_objectSpread({}, x), {}, {
144
- value: sharedConfigObj[x.key] || x.value
158
+ value: Object.values(_constant.CHAIN_PROP_MAP).includes(x.key) && Object.keys(sharedConfigObj).includes(x.key) ? sharedConfigObj[x.key] : sharedConfigObj[x.key] || x.value
145
159
  }));
146
160
  const hasBWAConfig = configs.some(x => x.key && x.key.startsWith('BWA_'));
147
161
  const action = {
@@ -224,12 +238,7 @@ function ComponentEnvironment(_ref) {
224
238
  placeholder: t('blocklet.config.environment.value'),
225
239
  margin: "dense",
226
240
  autoFocus: true
227
- }), rowData.description && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
228
- style: {
229
- marginLeft: 12
230
- },
231
- children: rowData.description
232
- })]
241
+ }), getDescription(rowData, t)]
233
242
  });
234
243
  }
235
244
  }];
@@ -74,7 +74,10 @@ const SpaceConnector = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
74
74
  } = (0, _react.useContext)(_context.LocaleContext);
75
75
  /** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
76
76
  const {
77
- blocklet
77
+ blocklet,
78
+ actions: {
79
+ refreshBlocklet
80
+ }
78
81
  } = (0, _blocklet.useBlockletContext)();
79
82
  const [gatewayUrl, setGatewayUrl] = (0, _react.useState)('');
80
83
  const spaceProps = (0, _react.useMemo)(() => {
@@ -116,6 +119,7 @@ const SpaceConnector = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
116
119
  open: false
117
120
  }));
118
121
  onConnect === null || onConnect === void 0 ? void 0 : onConnect();
122
+ refreshBlocklet();
119
123
  }, 3000);
120
124
  };
121
125
  const [authorizeConnect, setAuthorizeConnect] = (0, _react.useState)({
@@ -553,7 +553,7 @@ function BlockletEnvironment(_ref) {
553
553
  edge: "end",
554
554
  color: "error",
555
555
  size: "small",
556
- "data-cy": "invite-member",
556
+ "data-cy": "transfer-app",
557
557
  onClick: () => setShowTransferOwner(true),
558
558
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Loop.default, {
559
559
  style: {
@@ -43,28 +43,31 @@ const addComponentTabs = function addComponentTabs(tabs, blocklet) {
43
43
  let ancestors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
44
44
  let depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
45
45
  const key = [...ancestors.map(x => x.meta.did), blocklet.meta.did].join('/');
46
- tabs.push({
47
- label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
48
- pl: Math.max(1, depth - 1) * 2,
49
- display: "flex",
50
- alignItems: "center",
51
- justifyContent: "flex-start",
52
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_bundleAvatar.default, {
53
- size: 24,
54
- blocklet: blocklet,
55
- ancestors: ancestors
56
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
57
- ml: "16px",
58
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
59
- style: {
60
- color: '#222'
61
- },
62
- children: (0, _util.getDisplayName)(blocklet, true)
63
- })
64
- })]
65
- }, key),
66
- value: key
67
- });
46
+ const isContainer = !(ancestors !== null && ancestors !== void 0 && ancestors.length);
47
+ if (!isContainer) {
48
+ tabs.push({
49
+ label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
50
+ pl: Math.max(1, depth - 1) * 2,
51
+ display: "flex",
52
+ alignItems: "center",
53
+ justifyContent: "flex-start",
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_bundleAvatar.default, {
55
+ size: 24,
56
+ blocklet: blocklet,
57
+ ancestors: ancestors
58
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
59
+ ml: "16px",
60
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
61
+ style: {
62
+ color: '#222'
63
+ },
64
+ children: (0, _util.getDisplayName)(blocklet, true)
65
+ })
66
+ })]
67
+ }, key),
68
+ value: key
69
+ });
70
+ }
68
71
  if (blocklet.children.length > 0) {
69
72
  blocklet.children.forEach(x => {
70
73
  addComponentTabs(tabs, x, [...ancestors, blocklet], depth + 1);
@@ -44,17 +44,14 @@ function useBackupProgress(_ref) {
44
44
  completed: false
45
45
  });
46
46
  const node = (0, _node.useNodeContext)();
47
- const webSocketClient = node.ws.getWsClient();
48
- (0, _react.useEffect)(() => {
49
- webSocketClient.on(_constant.BlockletEvents.backupProgress, data => {
50
- if (appDid === (data === null || data === void 0 ? void 0 : data.appDid)) {
51
- setProgress(preValue => _objectSpread(_objectSpread({}, preValue), data));
52
- }
53
- });
54
- return () => {
55
- webSocketClient.off(_constant.BlockletEvents.backupProgress);
56
- };
57
- }, [appDid, webSocketClient]);
47
+ const {
48
+ ws: {
49
+ useSubscription
50
+ }
51
+ } = node;
52
+ useSubscription(_constant.BlockletEvents.backupProgress, data => {
53
+ setProgress(preValue => _objectSpread(_objectSpread({}, preValue), data));
54
+ }, [appDid]);
58
55
  return progress;
59
56
  }
60
57
  function Storage() {
@@ -162,7 +159,7 @@ function Storage() {
162
159
  },
163
160
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
164
161
  color: "primary",
165
- variant: "indeterminate",
162
+ variant: "determinate",
166
163
  value: progress === null || progress === void 0 ? void 0 : progress.progress
167
164
  })
168
165
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
@@ -115,24 +115,29 @@ function TransferOwner(_ref) {
115
115
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
116
116
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
117
117
  component: Bold,
118
- children: t('team.transferApp.transferDialog.createSuccessTip', {
119
- expireDate: (0, _util.formatToDatetime)(result.expireDate)
120
- })
118
+ dangerouslySetInnerHTML: {
119
+ __html: t('team.transferApp.transferDialog.createSuccessTip1')
120
+ }
121
121
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
122
122
  component: Bold,
123
- mt: 1,
123
+ mt: 2,
124
124
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Bold, {
125
- children: t('team.transferApp.transferDialog.createSuccessTip2')
125
+ children: t('team.transferApp.transferDialog.createSuccessTip3')
126
126
  })
127
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
128
- style: {
129
- marginTop: '20px'
130
- }
131
127
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
132
128
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
133
- children: t('team.transferApp.transferDialog.link')
134
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_clickToCopy.default, {
135
- children: link
129
+ component: Bold,
130
+ mt: 2,
131
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Bold, {
132
+ children: t('team.transferApp.transferDialog.createSuccessTip2', {
133
+ expireDate: (0, _util.formatToDatetime)(result.expireDate)
134
+ })
135
+ })
136
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
137
+ my: 1,
138
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_clickToCopy.default, {
139
+ children: link
140
+ })
136
141
  })]
137
142
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
138
143
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
package/lib/locales/en.js CHANGED
@@ -321,6 +321,7 @@ module.exports = {
321
321
  statusTip: 'Blocklet is {status}',
322
322
  initialUptime: 'Less than 1m',
323
323
  dashboard: 'Blocklet Dashboard',
324
+ noComponent: 'Application has no components and cannot be started',
324
325
  fromUrl: {
325
326
  title: 'Install Blocklet',
326
327
  label: 'Blocklet Meta URL',
@@ -423,7 +424,8 @@ module.exports = {
423
424
  appDidChangeTipL2: 'The DID domain name of the application will change, and the original domain name will become invalid',
424
425
  appSkChangeTip: 'You are changing application secret key',
425
426
  walletTypeTitle: 'Update Wallet Type',
426
- appSkTitle: 'Update Application Secret Key'
427
+ appSkTitle: 'Update Application Secret Key',
428
+ sharedToAllComponents: 'Will be shared to all components'
427
429
  },
428
430
  overview: {
429
431
  source: 'Source',
@@ -660,6 +662,7 @@ module.exports = {
660
662
  dialog: 'Click on "confirm" to install the update. Blocklet Server will enter maintenance mode until the update is completed and return to production mode automatically.',
661
663
  confirm: 'Upgrade',
662
664
  switchLabel: 'Auto Update Check',
665
+ enableBetaRelease: 'Enable Beta Release',
663
666
  setup: 'Preparing the upgrade',
664
667
  installing: 'Installing Blocklet Server v{version}',
665
668
  restarting: 'Restarting Blocklet Server',
@@ -995,8 +998,9 @@ module.exports = {
995
998
  newOwnerPermissions: 'The new Owner will have the right to manage all operations such as members, passports, and settings.'
996
999
  },
997
1000
  createTransferLink: 'Generate Transfer Link',
998
- createSuccessTip: 'The transfer link is successfully created, click to copy and send the link to the invited member, please note that this invitation link can not be reused and will expire on {expireDate}',
999
- createSuccessTip2: 'Your transfer link will only be shown once and will not be viewable again after closing this dialog',
1001
+ createSuccessTip1: 'The transfer link is successfully created, the invitee must use <a style="color: rgb(29, 193, 199)" target="_blank" href="https://www.didwallet.io/">DID Wallet</a> to receive the app ownership',
1002
+ createSuccessTip2: 'Please click to copy and send the link to the invited member, please note that this transfer link can not be reused and will expire on {expireDate}. Your transfer link will only be shown once and will not be viewable again after closing this dialog',
1003
+ createSuccessTip3: 'After the transfer is successful, the application will automatically restart to make the changes take effect',
1000
1004
  link: 'Transfer Link',
1001
1005
  iKnow: 'I have copied and saved the link'
1002
1006
  },
package/lib/locales/zh.js CHANGED
@@ -326,6 +326,7 @@ module.exports = {
326
326
  statusTip: 'Blocklet {status}',
327
327
  initialUptime: '少于1分钟',
328
328
  dashboard: 'Blocklet 控制台',
329
+ noComponent: '应用没有组件,无法启动',
329
330
  action: {
330
331
  stopDescription: '停止该基石程序将会使页面不可以访问,可能会导致使用它的用户出现错误',
331
332
  confirmStop: '是的,停止',
@@ -428,7 +429,8 @@ module.exports = {
428
429
  appDidChangeTipL2: '应用的 DID 域名会发生变化,原域名将会失效',
429
430
  appSkChangeTip: '你正在修改应用私钥',
430
431
  walletTypeTitle: '修改钱包类型',
431
- appSkTitle: '修改应用私钥'
432
+ appSkTitle: '修改应用私钥',
433
+ sharedToAllComponents: '将共享给所有组件'
432
434
  },
433
435
  overview: {
434
436
  source: '来源',
@@ -660,6 +662,7 @@ module.exports = {
660
662
  dialog: '点击 “确认” 安装更新。节点将进入维护模式,直到更新完成并自动返回生产模式。',
661
663
  confirm: '升级',
662
664
  switchLabel: '自动更新检查',
665
+ enableBetaRelease: '允许安装测试版',
663
666
  setup: '准备升级中',
664
667
  installing: '安装节点新版本(v{version})',
665
668
  restarting: '重新启动节点',
@@ -997,8 +1000,9 @@ module.exports = {
997
1000
  newOwnerPermissions: '新 Owner 将有权管理成员、通行证,以及设置等所有操作。'
998
1001
  },
999
1002
  createTransferLink: '生成转移链接',
1000
- createSuccessTip: '创建转移链接成功,请复制并发送给被邀请人。该链接只能使用一次,并将在 {expireDate} 过期',
1001
- createSuccessTip2: '你的转移链接只会展示一次,关闭此窗口后将无法再次查看',
1003
+ createSuccessTip1: '创建转移链接成功,被邀请人必须使用 <a style="color: rgb(29, 193, 199)" target="_blank" href="https://www.didwallet.io/">DID Wallet</a> 接收应用所有权',
1004
+ createSuccessTip2: '请复制并发送给被邀请人。该链接只能使用一次,并将在 {expireDate} 过期。你的转移链接只会展示一次,关闭此窗口后将无法再次查看',
1005
+ createSuccessTip3: '转移成功之后应用会自动重启以使变更生效',
1002
1006
  link: '邀请链接',
1003
1007
  iKnow: '我已复制保存好该链接'
1004
1008
  },
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.6-beta-8be2fe37",
6
+ "version": "1.16.6-beta-4ea1eb90",
7
7
  "description": "UX components shared across abtnode packages",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -22,20 +22,20 @@
22
22
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@abtnode/auth": "1.16.6-beta-8be2fe37",
26
- "@abtnode/constant": "1.16.6-beta-8be2fe37",
27
- "@abtnode/util": "1.16.6-beta-8be2fe37",
28
- "@arcblock/did-connect": "^2.5.25",
25
+ "@abtnode/auth": "1.16.6-beta-4ea1eb90",
26
+ "@abtnode/constant": "1.16.6-beta-4ea1eb90",
27
+ "@abtnode/util": "1.16.6-beta-4ea1eb90",
28
+ "@arcblock/did-connect": "^2.5.29",
29
29
  "@arcblock/did-motif": "^1.1.10",
30
- "@arcblock/icons": "^2.5.25",
31
- "@arcblock/react-hooks": "^2.5.25",
32
- "@arcblock/terminal": "^2.5.25",
33
- "@arcblock/ux": "^2.5.25",
34
- "@blocklet/constant": "1.16.6-beta-8be2fe37",
35
- "@blocklet/launcher-layout": "^2.0.30",
30
+ "@arcblock/icons": "^2.5.29",
31
+ "@arcblock/react-hooks": "^2.5.29",
32
+ "@arcblock/terminal": "^2.5.29",
33
+ "@arcblock/ux": "^2.5.29",
34
+ "@blocklet/constant": "1.16.6-beta-4ea1eb90",
35
+ "@blocklet/launcher-layout": "2.0.32",
36
36
  "@blocklet/list": "^0.11.18",
37
- "@blocklet/meta": "1.16.6-beta-8be2fe37",
38
- "@blocklet/ui-react": "^2.5.25",
37
+ "@blocklet/meta": "1.16.6-beta-4ea1eb90",
38
+ "@blocklet/ui-react": "^2.5.29",
39
39
  "@emotion/react": "^11.10.4",
40
40
  "@emotion/styled": "^11.10.4",
41
41
  "@iconify/react": "^4.0.0",
@@ -90,5 +90,5 @@
90
90
  "@babel/preset-react": "^7.18.6",
91
91
  "babel-plugin-inline-react-svg": "^1.1.2"
92
92
  },
93
- "gitHead": "27229a1a62850e95907b7a53e0259a809d99377b"
93
+ "gitHead": "0f0f63b552a88343a3f8e0d434b47c3bca6a75b9"
94
94
  }