@abtnode/ux 1.8.38 → 1.8.40

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.
@@ -86,6 +86,7 @@ function BlockletPreferences(_ref) {
86
86
  label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
87
87
  display: "flex",
88
88
  alignItems: "center",
89
+ "data-cy": "configuration-tab-general",
89
90
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TuneRounded.default, {
90
91
  sx: {
91
92
  fontSize: 24
@@ -105,6 +106,7 @@ function BlockletPreferences(_ref) {
105
106
  label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
106
107
  display: "flex",
107
108
  alignItems: "center",
109
+ "data-cy": "configuration-tab-access",
108
110
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Key.default, {
109
111
  sx: {
110
112
  fontSize: 24
@@ -124,6 +126,7 @@ function BlockletPreferences(_ref) {
124
126
  label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
125
127
  display: "flex",
126
128
  alignItems: "center",
129
+ "data-cy": "configuration-tab-preference",
127
130
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
128
131
  ml: -2,
129
132
  style: {
@@ -137,6 +137,17 @@ function useBlocklet(_ref) {
137
137
  });
138
138
  }
139
139
  };
140
+ const configNavigations = async value => {
141
+ const {
142
+ blocklet: data
143
+ } = await client.configNavigations({
144
+ input: {
145
+ did,
146
+ navigations: value
147
+ }
148
+ });
149
+ setBlocklet(data);
150
+ };
140
151
  (0, _react.useEffect)(() => {
141
152
  if (domainListStr && !disableSubscription) {
142
153
  refreshDomainStatus();
@@ -181,7 +192,8 @@ function useBlocklet(_ref) {
181
192
  actions: {
182
193
  refreshBlocklet,
183
194
  refreshDomainStatus,
184
- setBlocklet
195
+ setBlocklet,
196
+ configNavigations
185
197
  }
186
198
  };
187
199
  }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useAvatar;
7
+ var _urlJoin = _interopRequireDefault(require("url-join"));
8
+ var _constant = require("@abtnode/constant");
9
+ var _node = require("../contexts/node");
10
+ var _util = require("../util");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function useAvatar(_ref) {
13
+ var _blocklet$meta;
14
+ let {
15
+ blocklet,
16
+ ancestors = []
17
+ } = _ref;
18
+ const node = (0, _node.useNodeContext)();
19
+ const {
20
+ inService
21
+ } = node;
22
+ const search = "?version=".concat(blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.version);
23
+ let logoUrl = inService ? (0, _urlJoin.default)(_util.APP_PREFIX, _constant.WELLKNOWN_SERVICE_PATH_PREFIX, '/blocklet/logo', search) : (0, _urlJoin.default)(node.prefix, 'blocklet.png');
24
+ if (blocklet.source === 'registry' && blocklet.deployedFrom && blocklet.meta.logo) {
25
+ logoUrl = (0, _urlJoin.default)(blocklet.deployedFrom, (0, _util.formatRegistryLogoPath)(blocklet.meta.bundleDid, blocklet.meta.logo), search);
26
+ } else {
27
+ const prefix = window.env.apiPrefix || '/';
28
+ const components = ancestors.concat(blocklet);
29
+ const list = inService ? components.slice(1) : components;
30
+ logoUrl = (0, _urlJoin.default)(prefix, "/blocklet/logo".concat(list.map(x => "/".concat(x.meta.did)).join('')), search);
31
+ }
32
+ return {
33
+ logoUrl,
34
+ inService
35
+ };
36
+ }
@@ -0,0 +1,373 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useNavigation;
7
+ var _ahooks = require("ahooks");
8
+ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
9
+ var _isNil = _interopRequireDefault(require("lodash/isNil"));
10
+ var _omit = _interopRequireDefault(require("lodash/omit"));
11
+ var _omitBy = _interopRequireDefault(require("lodash/omitBy"));
12
+ var _react = require("react");
13
+ var _nanoid = require("nanoid");
14
+ var _material = require("@mui/material");
15
+ var _parseNavigationFromBlocklet = require("@blocklet/meta/lib/parse-navigation-from-blocklet");
16
+ var _constant = require("@abtnode/constant");
17
+ var _blocklet = require("../contexts/blocklet");
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ 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; }
21
+ 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; }
22
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
+ const BASE_LINK = '/';
24
+ const DEFAULT_SECTION = 'header';
25
+ // 默认注入的数据
26
+ // 需要指定一些内置的 id
27
+ const injectNavigationData = {
28
+ sessionManager: [{
29
+ id: '/sessionManager',
30
+ title: {
31
+ en: 'Manage',
32
+ zh: '管理'
33
+ },
34
+ section: ['sessionManager'],
35
+ icon: 'ion:settings-outline',
36
+ link: "".concat(_constant.WELLKNOWN_SERVICE_PATH_PREFIX, "/admin"),
37
+ role: ['owner', 'admin'],
38
+ from: 'tmpl'
39
+ }],
40
+ dashboard: [{
41
+ id: '/access',
42
+ title: {
43
+ en: 'Access',
44
+ zh: '访问控制'
45
+ },
46
+ role: ['owner', 'admin', 'member'],
47
+ section: ['dashboard'],
48
+ link: '',
49
+ from: 'tmpl',
50
+ items: [{
51
+ id: 'member',
52
+ title: {
53
+ en: 'Members',
54
+ zh: '成员'
55
+ },
56
+ icon: 'ant-design:user-outlined',
57
+ link: "".concat(_constant.WELLKNOWN_SERVICE_PATH_PREFIX, "/admin/members"),
58
+ from: 'tmpl'
59
+ }, {
60
+ id: 'passport',
61
+ title: {
62
+ en: 'Passport',
63
+ zh: '通行证'
64
+ },
65
+ icon: 'icon-park-outline:passport',
66
+ link: "".concat(_constant.WELLKNOWN_SERVICE_PATH_PREFIX, "/admin/passports"),
67
+ from: 'tmpl'
68
+ }]
69
+ }, {
70
+ id: '/dashboard',
71
+ title: 'Blocklet',
72
+ role: ['owner', 'admin'],
73
+ section: ['dashboard'],
74
+ link: '',
75
+ from: 'tmpl',
76
+ items: [{
77
+ id: 'dashboard',
78
+ title: {
79
+ en: 'Dashboard',
80
+ zh: '仪表盘'
81
+ },
82
+ icon: 'ant-design:dashboard-outlined',
83
+ link: "".concat(_constant.WELLKNOWN_SERVICE_PATH_PREFIX, "/admin"),
84
+ from: 'tmpl'
85
+ }]
86
+ }]
87
+ };
88
+ function isSameNavigation(a, b) {
89
+ if (a.section && b.section) {
90
+ return a.section === b.section && a.id === b.id;
91
+ }
92
+ return a.id === b.id;
93
+ }
94
+ function hackBuiltinLink(treeList) {
95
+ const copyData = (0, _cloneDeep.default)(treeList);
96
+ (0, _parseNavigationFromBlocklet.deepWalk)(copyData, item => {
97
+ if (item.from === 'tmpl') {
98
+ item.link = '/';
99
+ }
100
+ }, {
101
+ key: 'items'
102
+ });
103
+ return copyData;
104
+ }
105
+ function useNavigation() {
106
+ const {
107
+ blocklet,
108
+ actions
109
+ } = (0, _blocklet.useBlockletContext)();
110
+ const {
111
+ navigationList,
112
+ components,
113
+ builtinList
114
+ } = (0, _parseNavigationFromBlocklet.parseNavigation)(blocklet, {
115
+ beforeProcess(rawList) {
116
+ const copyList = (0, _cloneDeep.default)(rawList);
117
+ // 注入默认的 dashboard 菜单
118
+ injectNavigationData.dashboard.forEach(item => {
119
+ if (!copyList.some(x => x.id === item.id)) {
120
+ copyList.push(item);
121
+ }
122
+ });
123
+ // 注入默认的 sessionManager 菜单
124
+ if (!copyList.some(x => x.id && (x.section || []).includes('sessionManager'))) {
125
+ copyList.push(...injectNavigationData.sessionManager);
126
+ }
127
+ return copyList;
128
+ }
129
+ });
130
+ const state = (0, _ahooks.useReactive)({
131
+ rawNavigation: (0, _cloneDeep.default)(navigationList),
132
+ activeSection: DEFAULT_SECTION,
133
+ components
134
+ });
135
+ const navigation = (0, _react.useMemo)(() => {
136
+ return (0, _parseNavigationFromBlocklet.nestNavigationList)(state.rawNavigation);
137
+ }, [state.rawNavigation]);
138
+ const treeNavigation = (0, _react.useMemo)(() => {
139
+ const rawData = (0, _parseNavigationFromBlocklet.filterNavigation)(state.rawNavigation, components);
140
+ const navigationWithLink = hackBuiltinLink((0, _parseNavigationFromBlocklet.joinLink)(rawData, components));
141
+ let hasSessionManager = false;
142
+ return navigationWithLink.filter(item => {
143
+ if ((0, _parseNavigationFromBlocklet.isMatchSection)(item.section, 'sessionManager')) {
144
+ if (hasSessionManager) {
145
+ return false;
146
+ }
147
+ hasSessionManager = true;
148
+ }
149
+ return true;
150
+ });
151
+ }, [components, state.rawNavigation]);
152
+ function getNavigationFullLink(navigationItem) {
153
+ if (!navigationItem.id) return '';
154
+ const fullList = (0, _parseNavigationFromBlocklet.flatternNavigation)((0, _parseNavigationFromBlocklet.joinLink)(navigation, components));
155
+ const findItem = fullList.find(item => item.id === navigationItem.id);
156
+ // eslint-disable-next-line react/prop-types
157
+ function Uninstalled(_ref) {
158
+ let {
159
+ name
160
+ } = _ref;
161
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
162
+ label: "Uninstalled: ".concat(name),
163
+ color: "error",
164
+ size: "small",
165
+ variant: "outlined",
166
+ sx: {
167
+ fontSize: 10,
168
+ height: 20
169
+ }
170
+ });
171
+ }
172
+ if (findItem !== null && findItem !== void 0 && findItem.component) {
173
+ if (!components.some(x => x.name === findItem.component)) {
174
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Uninstalled, {
175
+ name: findItem.component
176
+ });
177
+ }
178
+ } else if (findItem.parent) {
179
+ const parent = fullList.find(x => x.id === findItem.parent);
180
+ if (parent !== null && parent !== void 0 && parent.component) {
181
+ if (!components.some(x => x.name === parent.component)) {
182
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Uninstalled, {
183
+ name: parent.component
184
+ });
185
+ }
186
+ }
187
+ }
188
+ return findItem === null || findItem === void 0 ? void 0 : findItem.link;
189
+ }
190
+ function updateActiveSection(activeSection) {
191
+ state.activeSection = activeSection;
192
+ }
193
+ function updateNavigationTree(tree) {
194
+ const list = [];
195
+ (0, _parseNavigationFromBlocklet.deepWalk)(tree, (treeItem, parent) => {
196
+ const tmpData = _objectSpread(_objectSpread({}, (0, _omit.default)(treeItem, ['children', 'expand'])), {}, {
197
+ parent: parent === null || parent === void 0 ? void 0 : parent.id
198
+ });
199
+ list.push(tmpData);
200
+ });
201
+ const unchangedNavigation = state.rawNavigation.filter(item => {
202
+ if (!state.activeSection) {
203
+ return false;
204
+ }
205
+ const findItem = list.find(v => isSameNavigation(v, item));
206
+ if (findItem) {
207
+ return !(0, _parseNavigationFromBlocklet.isMatchSection)(findItem.section, state.activeSection);
208
+ }
209
+ return true;
210
+ });
211
+ state.rawNavigation = [...unchangedNavigation, ...list];
212
+ }
213
+ /**
214
+ * 更新导航的一个节点
215
+ * @param {object} itemData 更新的数据
216
+ */
217
+ function updateNavigationItem(itemData) {
218
+ _saveNavigationChange([itemData]);
219
+ }
220
+ function _saveNavigationChange() {
221
+ let changed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
222
+ const updatedNavigation = state.rawNavigation.map(item => {
223
+ const findChanged = changed.find(changeItem => isSameNavigation(_objectSpread(_objectSpread({}, changeItem), {}, {
224
+ section: state.activeSection
225
+ }), item));
226
+ if (findChanged) {
227
+ return _objectSpread(_objectSpread({}, item), findChanged);
228
+ }
229
+ return item;
230
+ });
231
+ state.rawNavigation = updatedNavigation;
232
+ }
233
+ /**
234
+ * 删除一个导航节点
235
+ * @param {string} id 导航的 ID
236
+ */
237
+ function delNavigationItem(id) {
238
+ const relatedNavigationId = state.rawNavigation.filter(item => item.id === id || item.parent === id).map(item => item.id);
239
+ state.rawNavigation = state.rawNavigation.filter(item => !relatedNavigationId.includes(item.id));
240
+ }
241
+ /**
242
+ * 增加一个导航节点
243
+ * @param {object} params 导航数据
244
+ */
245
+ function addNavigationItem() {
246
+ let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
247
+ const data = _objectSpread(_objectSpread({}, params), {}, {
248
+ // 新增的数据使用随机生成的 nanoid (A-Za-z0-9_-)
249
+ id: (0, _nanoid.nanoid)(),
250
+ section: state.activeSection,
251
+ visible: true
252
+ });
253
+ state.rawNavigation = [...state.rawNavigation, data];
254
+ }
255
+
256
+ /**
257
+ * 将树状结构转换为数据库存储的导航结构
258
+ * @param {array} tree 树状结构
259
+ * @returns array
260
+ */
261
+ // eslint-disable-next-line no-unused-vars
262
+ function tree2navigation(tree) {
263
+ const list = tree.map(item => {
264
+ const items = item.children || [];
265
+ return {
266
+ title: item.title,
267
+ icon: item.icon,
268
+ link: item.link,
269
+ items: tree2navigation(items),
270
+ section: item.section,
271
+ visible: item.visible,
272
+ parent: item.parent,
273
+ component: item.component,
274
+ role: item.role,
275
+ from: item.from,
276
+ id: item.id
277
+ };
278
+ });
279
+ return list;
280
+ }
281
+ /**
282
+ * 将数据库中的导航数据转换为树状结构
283
+ * @param {array} list 数据库中导航的结构
284
+ * @param {string} baseLink 当前 tree 的 base
285
+ * @returns 树状结构
286
+ */
287
+ function navigation2tree(list) {
288
+ let baseLink = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : BASE_LINK;
289
+ const tree = list.map(item => {
290
+ const findComponent = components.find(componentItem => componentItem.name === item.component);
291
+ const base = (findComponent === null || findComponent === void 0 ? void 0 : findComponent.link) || baseLink;
292
+ const children = item.items || [];
293
+ const {
294
+ link
295
+ } = item;
296
+ return {
297
+ title: item.title,
298
+ subtitle: getNavigationFullLink(item),
299
+ link,
300
+ icon: item.icon,
301
+ children: navigation2tree(children, link || BASE_LINK),
302
+ section: item.section,
303
+ visible: item.visible,
304
+ parent: item.parent,
305
+ component: item.component,
306
+ id: item.id,
307
+ role: item.role,
308
+ from: item.from,
309
+ __base: base
310
+ };
311
+ });
312
+ return tree;
313
+ }
314
+
315
+ /**
316
+ * 获取指定区块的导航数据
317
+ * @param {string} section 导航所属区块
318
+ * @returns 在指定导航区块内的导航数据
319
+ */
320
+ function getNavigation(section) {
321
+ const copyNavigation = (0, _cloneDeep.default)(navigation);
322
+ const filteredSectionNavigation = copyNavigation.filter(item => {
323
+ return (0, _parseNavigationFromBlocklet.isMatchSection)(item.section, section);
324
+ });
325
+ return navigation2tree(filteredSectionNavigation);
326
+ }
327
+
328
+ /**
329
+ * 将导航数据保存到后端
330
+ * @param {array} list 需要保存的导航数据
331
+ */
332
+ async function saveNavigationList(list) {
333
+ const data = list.map(item => {
334
+ return (0, _omitBy.default)(item, _isNil.default);
335
+ });
336
+ const formartedData = data.map(item => {
337
+ const tempData = _objectSpread({}, item);
338
+ if (tempData.role && Array.isArray(tempData.role)) {
339
+ tempData.role = JSON.stringify(tempData.role);
340
+ }
341
+ if (tempData.section && Array.isArray(tempData.section)) {
342
+ tempData.section = JSON.stringify(tempData.section);
343
+ }
344
+ if (tempData.title && tempData.title instanceof Object) {
345
+ tempData.title = JSON.stringify(tempData.title);
346
+ }
347
+ if (tempData.link && tempData.link instanceof Object) {
348
+ tempData.link = JSON.stringify(tempData.link);
349
+ }
350
+ return tempData;
351
+ });
352
+ // .filter((item) => item.from !== ' tmpl');
353
+ await actions.configNavigations(formartedData);
354
+ }
355
+ async function resetNavigation() {
356
+ await saveNavigationList([]);
357
+ state.rawNavigation = (0, _cloneDeep.default)(builtinList);
358
+ }
359
+ return {
360
+ state,
361
+ navigation: treeNavigation,
362
+ components,
363
+ getNavigationFullLink,
364
+ updateActiveSection,
365
+ updateNavigationItem,
366
+ delNavigationItem,
367
+ addNavigationItem,
368
+ updateNavigationTree,
369
+ getNavigation,
370
+ saveNavigationList,
371
+ resetNavigation
372
+ };
373
+ }
package/lib/locales/en.js CHANGED
@@ -100,6 +100,7 @@ module.exports = {
100
100
  components: 'Components',
101
101
  config: 'Configure',
102
102
  configuration: 'Configuration',
103
+ configNavigation: 'Navigation',
103
104
  configSuccess: 'Config successfully',
104
105
  confirm: 'Confirm',
105
106
  console: 'Console',
@@ -504,7 +505,7 @@ module.exports = {
504
505
  routingEngine: 'Routing Engine',
505
506
  ownerNftURL: 'Owner NFT',
506
507
  expirationLeft: 'Expiration Left',
507
- renewal: 'Renewal'
508
+ renew: 'Renew'
508
509
  },
509
510
  store: {
510
511
  nameSort: 'Name',
@@ -1110,5 +1111,27 @@ module.exports = {
1110
1111
  confirm: 'Confirm on your DID Wallet',
1111
1112
  success: 'You are successfully connected'
1112
1113
  }
1114
+ },
1115
+ navigation: {
1116
+ navigation: 'Navigation',
1117
+ form: {
1118
+ title: 'Title',
1119
+ titlePlaceholder: 'Please input navigation title',
1120
+ titleTooLong: 'Title length should small than {len}',
1121
+ icon: 'Navigation Icon',
1122
+ iconPlaceholder: 'Please input navigation icon',
1123
+ invalidIcon: 'Icon is invalid',
1124
+ findMoreIcon: 'Find more icons',
1125
+ link: 'Link',
1126
+ linkPlaceholder: 'Please input navigation link',
1127
+ invalidLink: 'Link is invalid',
1128
+ component: 'Component',
1129
+ componentPlaceholder: 'Please select navigation component',
1130
+ role: 'Role',
1131
+ rolePlaceholder: 'Please select navigation role',
1132
+ locale: 'Locale',
1133
+ localePlaceholder: 'Please input locale need to add',
1134
+ localeExists: '{value} is already exists'
1135
+ }
1113
1136
  }
1114
1137
  };
package/lib/locales/zh.js CHANGED
@@ -104,6 +104,7 @@ module.exports = {
104
104
  components: '组件',
105
105
  config: '配置',
106
106
  configuration: '配置',
107
+ configNavigation: '导航',
107
108
  configSuccess: '设置成功',
108
109
  confirm: '确认',
109
110
  console: '控制台',
@@ -512,7 +513,7 @@ module.exports = {
512
513
  routingEngine: '路由引擎',
513
514
  ownerNftURL: '所有者 NFT',
514
515
  expirationLeft: '有效期还剩',
515
- renewal: '续期'
516
+ renew: '续期'
516
517
  },
517
518
  store: {
518
519
  nameSort: '名称',
@@ -1115,5 +1116,27 @@ module.exports = {
1115
1116
  confirm: '在您的 DID 钱包上确认',
1116
1117
  success: '连接成功'
1117
1118
  }
1119
+ },
1120
+ navigation: {
1121
+ navigation: '导航',
1122
+ form: {
1123
+ title: '标题',
1124
+ titlePlaceholder: '请输入导航标题',
1125
+ titleTooLong: '标题最长为 {len}',
1126
+ icon: '图标',
1127
+ iconPlaceholder: '请输入导航图标',
1128
+ invalidIcon: '导航图标不存在',
1129
+ findMoreIcon: '找到更多图标',
1130
+ link: '链接',
1131
+ linkPlaceholder: '请输入导航链接',
1132
+ invalidLink: '链接格式不正确',
1133
+ component: '组件',
1134
+ componentPlaceholder: '请选择导航所属的组件',
1135
+ role: '角色',
1136
+ rolePlaceholder: '请选择导航可见的角色',
1137
+ locale: '语言',
1138
+ localePlaceholder: '请输入要添加的多语言标识符',
1139
+ localeExists: '{value} 已经存在'
1140
+ }
1118
1141
  }
1119
1142
  };
@@ -77,8 +77,7 @@ function Passports(_ref2) {
77
77
  t
78
78
  } = (0, _context.useLocaleContext)();
79
79
  const {
80
- session,
81
- inService
80
+ session
82
81
  } = (0, _session.useSessionContext)();
83
82
  const {
84
83
  roles,
@@ -91,7 +90,8 @@ function Passports(_ref2) {
91
90
  blocklet
92
91
  } = (0, _team.useTeamContext)();
93
92
  const {
94
- api
93
+ api,
94
+ inService
95
95
  } = (0, _node.useNodeContext)();
96
96
  const {
97
97
  enqueueSnackbar
@@ -47,8 +47,7 @@ function PassportColor(_ref) {
47
47
  const onSubmit = async () => {
48
48
  const params = [{
49
49
  key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,
50
- value: color,
51
- custom: true
50
+ value: color
52
51
  }];
53
52
  try {
54
53
  setLoading(true);
@@ -37,7 +37,6 @@ function PassportList() {
37
37
  } = (0, _react.useContext)(_context.LocaleContext);
38
38
  const {
39
39
  api,
40
- info: nodeInfo,
41
40
  inService
42
41
  } = (0, _node.useNodeContext)();
43
42
  const {
@@ -47,7 +46,8 @@ function PassportList() {
47
46
  teamName,
48
47
  refresh: refreshTeam,
49
48
  enablePassportIssuance,
50
- passportColor
49
+ passportColor,
50
+ isNodeTeam
51
51
  } = (0, _team.useTeamContext)();
52
52
  const [showCreate, setShowCreate] = (0, _react.useState)(false);
53
53
  const [updateForm, setUpdateForm] = (0, _react.useState)(false);
@@ -118,8 +118,9 @@ function PassportList() {
118
118
  })]
119
119
  })]
120
120
  })
121
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SplitButton.default.Item, {
121
+ }), !isNodeTeam && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SplitButton.default.Item, {
122
122
  onClick: () => setShowColor(true),
123
+ "data-cy": "config-passport-color",
123
124
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
124
125
  children: t('team.passport.configColor')
125
126
  })
@@ -138,7 +139,7 @@ function PassportList() {
138
139
  }
139
140
  }), t('team.passport.trustedPassportIssuers')]
140
141
  })
141
- }), (inService || nodeInfo.did !== teamDid) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
142
+ }), !isNodeTeam && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
142
143
  style: {
143
144
  marginLeft: 16
144
145
  },
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ // https://www.maigoo.com/top/393790.html
8
+ // https://zh.wikipedia.org/zh-my/ISO_639-1代码表
9
+ var _default = {
10
+ en: 'English',
11
+ zh: '中文',
12
+ fr: 'Français',
13
+ // 法语
14
+ ru: 'Russian',
15
+ // 俄语
16
+ ar: 'العربية',
17
+ // 阿拉伯语
18
+ es: 'Español',
19
+ // 西班牙语
20
+ de: 'Deutsch',
21
+ // 德语
22
+ pt: 'Português do Brasil',
23
+ // 葡萄牙语
24
+ ja: '日本語',
25
+ // 日语
26
+ hi: 'हिन्दी' // 印地语
27
+ };
28
+ exports.default = _default;