@abtnode/ux 1.8.36 → 1.8.37
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.
- package/lib/blocklet/actions.js +1 -3
- package/lib/blocklet/agreement-app.js +28 -0
- package/lib/blocklet/agreement.js +72 -0
- package/lib/blocklet/avatar.js +1 -10
- package/lib/blocklet/component/add.js +1083 -0
- package/lib/blocklet/component/configuration.js +1 -1
- package/lib/blocklet/component/index.js +7 -9
- package/lib/blocklet/component/select-store.js +151 -0
- package/lib/blocklet/component/store-blocklet-list.js +203 -0
- package/lib/blocklet/configuration.js +1 -1
- package/lib/blocklet/install-from-url.js +362 -0
- package/lib/blocklet/preferences/index.js +168 -0
- package/lib/blocklet/purchase/common.js +103 -0
- package/lib/blocklet/purchase/component-purchase.js +251 -0
- package/lib/blocklet/purchase/index.js +13 -0
- package/lib/blocklet/util.js +4 -16
- package/lib/blocklet/version.js +1 -1
- package/lib/hooks/blocklet.js +26 -10
- package/lib/locales/en.js +2 -0
- package/lib/locales/zh.js +2 -0
- package/lib/schema-form/index.js +1 -1
- package/lib/store/add.js +185 -0
- package/lib/store/delete.js +102 -0
- package/lib/store/item.js +84 -0
- package/lib/util/api.js +21 -0
- package/lib/util/constants.js +10 -0
- package/lib/util/index.js +24 -8
- package/package.json +10 -7
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = StoreItem;
|
|
7
|
+
var _styles = require("@mui/styles");
|
|
8
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
9
|
+
var _ListItemSecondaryAction = _interopRequireDefault(require("@mui/material/ListItemSecondaryAction"));
|
|
10
|
+
var _Launch = _interopRequireDefault(require("@mui/icons-material/Launch"));
|
|
11
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _delete = _interopRequireDefault(require("./delete"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
/* eslint-disable react/jsx-one-expression-per-line */
|
|
17
|
+
|
|
18
|
+
const useStyles = (0, _styles.makeStyles)(() => ({
|
|
19
|
+
buttonText: {
|
|
20
|
+
textTransform: 'none !important'
|
|
21
|
+
},
|
|
22
|
+
iconRoot: {
|
|
23
|
+
minWidth: 24
|
|
24
|
+
},
|
|
25
|
+
menuName: {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
marginRight: '100px',
|
|
29
|
+
'& span': {
|
|
30
|
+
overflow: 'hidden',
|
|
31
|
+
textOverflow: 'ellipsis',
|
|
32
|
+
whiteSpace: 'nowrap'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
function StoreItem(_ref) {
|
|
37
|
+
let {
|
|
38
|
+
teamDid,
|
|
39
|
+
store,
|
|
40
|
+
onDelete
|
|
41
|
+
} = _ref;
|
|
42
|
+
const classes = useStyles();
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
44
|
+
className: classes.menuName,
|
|
45
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
46
|
+
component: "span",
|
|
47
|
+
variant: "subtitle1",
|
|
48
|
+
style: {
|
|
49
|
+
fontWeight: '400'
|
|
50
|
+
},
|
|
51
|
+
children: store.name
|
|
52
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
53
|
+
className: "url",
|
|
54
|
+
component: "span",
|
|
55
|
+
variant: "inherit",
|
|
56
|
+
children: "".concat(store.url)
|
|
57
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ListItemSecondaryAction.default, {
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
59
|
+
onClick: e => {
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
window.open(store.url);
|
|
62
|
+
},
|
|
63
|
+
size: "large",
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Launch.default, {})
|
|
65
|
+
}), !store.protected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.default, {
|
|
66
|
+
store: store,
|
|
67
|
+
onDelete: onDelete,
|
|
68
|
+
teamDid: teamDid
|
|
69
|
+
})]
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
StoreItem.propTypes = {
|
|
74
|
+
teamDid: _propTypes.default.string.isRequired,
|
|
75
|
+
store: _propTypes.default.shape({
|
|
76
|
+
name: _propTypes.default.string.isRequired,
|
|
77
|
+
url: _propTypes.default.string.isRequired,
|
|
78
|
+
protected: _propTypes.default.bool
|
|
79
|
+
}).isRequired,
|
|
80
|
+
onDelete: _propTypes.default.func
|
|
81
|
+
};
|
|
82
|
+
StoreItem.defaultProps = {
|
|
83
|
+
onDelete: () => {}
|
|
84
|
+
};
|
package/lib/util/api.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.api = void 0;
|
|
7
|
+
Object.defineProperty(exports, "axios", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _axios.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports.default = void 0;
|
|
14
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
_axios.default.defaults.timeout = 10 * 1000; // 超时时间设为10s
|
|
17
|
+
|
|
18
|
+
const api = _axios.default.create();
|
|
19
|
+
exports.api = api;
|
|
20
|
+
var _default = api;
|
|
21
|
+
exports.default = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.STORAGE_KEY_STORE_SERVER = exports.STORAGE_KEY_STORE_BLOCKLET = void 0;
|
|
7
|
+
const STORAGE_KEY_STORE_BLOCKLET = 'blocklet-add-component-registry';
|
|
8
|
+
exports.STORAGE_KEY_STORE_BLOCKLET = STORAGE_KEY_STORE_BLOCKLET;
|
|
9
|
+
const STORAGE_KEY_STORE_SERVER = 'server-add-registry';
|
|
10
|
+
exports.STORAGE_KEY_STORE_SERVER = STORAGE_KEY_STORE_SERVER;
|
package/lib/util/index.js
CHANGED
|
@@ -30,8 +30,9 @@ exports.getEndPoint = void 0;
|
|
|
30
30
|
exports.getExplorerLink = getExplorerLink;
|
|
31
31
|
exports.getPathPrefix = exports.getIssuePassportLink = exports.getInviteLink = void 0;
|
|
32
32
|
exports.getRelativeTime = getRelativeTime;
|
|
33
|
+
exports.getStoreList = void 0;
|
|
33
34
|
exports.getWebWalletUrl = getWebWalletUrl;
|
|
34
|
-
exports.
|
|
35
|
+
exports.isNewStoreUrl = exports.isInstalling = exports.isInProgress = exports.isDownloading = exports.isChrome = exports.isCertificateMatch = exports.isBlockletDev = void 0;
|
|
35
36
|
exports.isProtectedRole = isProtectedRole;
|
|
36
37
|
exports.isUrlAccessible = exports.isSafari = void 0;
|
|
37
38
|
exports.isValidClusterSize = isValidClusterSize;
|
|
@@ -443,7 +444,7 @@ function getWebWalletUrl(info) {
|
|
|
443
444
|
} catch (err) {
|
|
444
445
|
// Do nothing
|
|
445
446
|
}
|
|
446
|
-
return info && info.webWalletUrl ? info.webWalletUrl :
|
|
447
|
+
return info && info.webWalletUrl ? info.webWalletUrl : _constant.WEB_WALLET_URL;
|
|
447
448
|
}
|
|
448
449
|
function isValidClusterSize(data) {
|
|
449
450
|
const {
|
|
@@ -620,15 +621,15 @@ function getRelativeTime(datetime) {
|
|
|
620
621
|
}
|
|
621
622
|
|
|
622
623
|
/**
|
|
623
|
-
* 检查url是否 未添加到 store
|
|
624
|
+
* 检查url是否 未添加到 store list 中
|
|
624
625
|
* @param {string} url - 需要检查的url
|
|
625
|
-
* @param {object[]}
|
|
626
|
+
* @param {object[]} storeList - 后端的store list, 一般是 node.blockletRegistryList 或 blocklet.settings.storeList
|
|
626
627
|
* @returns {Object.freeze({
|
|
627
628
|
* isNew: boolean;
|
|
628
629
|
* decoded: string;
|
|
629
630
|
* })} - 返回判断是否是新的url和解码后的url
|
|
630
631
|
*/
|
|
631
|
-
const
|
|
632
|
+
const isNewStoreUrl = (url, storeList) => {
|
|
632
633
|
if (typeof url === 'string') {
|
|
633
634
|
let decoded = decodeURIComponent(url === null || url === void 0 ? void 0 : url.trim());
|
|
634
635
|
const regex = /^https?:\/\//;
|
|
@@ -643,7 +644,7 @@ const isNewRegistryUrl = (url, blockletRegistryList) => {
|
|
|
643
644
|
} catch (_unused2) {
|
|
644
645
|
throw new Error('Invalid Blocklet Store URL');
|
|
645
646
|
}
|
|
646
|
-
if (
|
|
647
|
+
if (storeList !== null && storeList !== void 0 && storeList.some(item => [url, decoded].includes(item.url))) {
|
|
647
648
|
return {
|
|
648
649
|
isNew: false,
|
|
649
650
|
decoded
|
|
@@ -659,7 +660,7 @@ const isNewRegistryUrl = (url, blockletRegistryList) => {
|
|
|
659
660
|
decoded: ''
|
|
660
661
|
};
|
|
661
662
|
};
|
|
662
|
-
exports.
|
|
663
|
+
exports.isNewStoreUrl = isNewStoreUrl;
|
|
663
664
|
const isBlockletDev = blocklet => blocklet.mode === _constant2.BLOCKLET_MODES.DEVELOPMENT;
|
|
664
665
|
exports.isBlockletDev = isBlockletDev;
|
|
665
666
|
const APP_PREFIX = ((_window$env = window.env) === null || _window$env === void 0 ? void 0 : _window$env.groupPathPrefix) || '/';
|
|
@@ -676,4 +677,19 @@ const toSlotDomain = domain => {
|
|
|
676
677
|
}
|
|
677
678
|
return domain;
|
|
678
679
|
};
|
|
679
|
-
exports.toSlotDomain = toSlotDomain;
|
|
680
|
+
exports.toSlotDomain = toSlotDomain;
|
|
681
|
+
const getStoreList = _ref5 => {
|
|
682
|
+
var _blocklet$meta, _blocklet$settings;
|
|
683
|
+
let {
|
|
684
|
+
fromBlocklet,
|
|
685
|
+
nodeInfo,
|
|
686
|
+
blocklet
|
|
687
|
+
} = _ref5;
|
|
688
|
+
const teamDid = fromBlocklet ? blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did : nodeInfo === null || nodeInfo === void 0 ? void 0 : nodeInfo.did;
|
|
689
|
+
const storeList = fromBlocklet ? (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.storeList) || [] : (nodeInfo === null || nodeInfo === void 0 ? void 0 : nodeInfo.blockletRegistryList) || [];
|
|
690
|
+
return {
|
|
691
|
+
teamDid,
|
|
692
|
+
storeList
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
exports.getStoreList = getStoreList;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.37",
|
|
7
7
|
"description": "UX components shared across abtnode packages",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -21,17 +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.
|
|
25
|
-
"@abtnode/constant": "1.8.
|
|
26
|
-
"@abtnode/util": "1.8.
|
|
24
|
+
"@abtnode/auth": "1.8.37",
|
|
25
|
+
"@abtnode/constant": "1.8.37",
|
|
26
|
+
"@abtnode/util": "1.8.37",
|
|
27
27
|
"@arcblock/did-connect": "^2.4.52",
|
|
28
28
|
"@arcblock/did-motif": "^1.1.10",
|
|
29
29
|
"@arcblock/icons": "^2.4.52",
|
|
30
30
|
"@arcblock/terminal": "^2.4.52",
|
|
31
31
|
"@arcblock/ux": "^2.4.52",
|
|
32
|
-
"@blocklet/constant": "1.8.
|
|
32
|
+
"@blocklet/constant": "1.8.37",
|
|
33
33
|
"@blocklet/launcher-layout": "^1.9.10",
|
|
34
|
-
"@blocklet/
|
|
34
|
+
"@blocklet/list": "^0.10.34",
|
|
35
|
+
"@blocklet/meta": "1.8.37",
|
|
35
36
|
"@emotion/react": "^11.10.4",
|
|
36
37
|
"@emotion/styled": "^11.10.4",
|
|
37
38
|
"@material-table/core": "^0.2.48",
|
|
@@ -60,6 +61,8 @@
|
|
|
60
61
|
"prop-types": "^15.8.1",
|
|
61
62
|
"react": "^18.2.0",
|
|
62
63
|
"react-color": "^2.19.3",
|
|
64
|
+
"react-error-boundary": "^3.1.4",
|
|
65
|
+
"react-iframe": "^1.8.5",
|
|
63
66
|
"react-router-dom": "^6.4.2",
|
|
64
67
|
"react-use": "^17.4.0",
|
|
65
68
|
"semver": "^7.3.8",
|
|
@@ -73,5 +76,5 @@
|
|
|
73
76
|
"@babel/preset-react": "^7.18.6",
|
|
74
77
|
"babel-plugin-inline-react-svg": "^1.1.2"
|
|
75
78
|
},
|
|
76
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "f26f451c6e2b1168b36f78269eafdf3f671236bf"
|
|
77
80
|
}
|