@abtnode/ux 1.8.36 → 1.8.38
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/access/config-access.js +299 -0
- package/lib/blocklet/access/index.js +220 -0
- 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 +9 -18
- package/lib/blocklet/component/add.js +1083 -0
- package/lib/blocklet/component/configuration.js +1 -1
- package/lib/blocklet/component/environment.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 +5 -87
- package/lib/blocklet/install-from-url.js +362 -0
- package/lib/blocklet/overview.js +21 -12
- package/lib/blocklet/preferences/index.js +233 -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/runtime-info.js +1 -0
- package/lib/blocklet/util.js +4 -16
- package/lib/blocklet/version.js +1 -1
- package/lib/hooks/blocklet.js +26 -10
- package/lib/layout/feedback.js +8 -10
- package/lib/locales/en.js +9 -2
- package/lib/locales/zh.js +9 -2
- 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/team/passports/color.js +1 -1
- package/lib/team/passports/detail.js +39 -31
- package/lib/util/api.js +21 -0
- package/lib/util/constants.js +10 -0
- package/lib/util/index.js +24 -8
- package/lib/who-can-access/config.js +13 -13
- package/package.json +11 -8
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CustomSelect = CustomSelect;
|
|
7
|
+
exports.useStyles = exports.commonProps = void 0;
|
|
8
|
+
var _styles = require("@mui/styles");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _List = _interopRequireDefault(require("@mui/material/List"));
|
|
11
|
+
var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
|
|
12
|
+
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
13
|
+
var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
|
|
14
|
+
var _ShoppingCart = _interopRequireDefault(require("@mui/icons-material/ShoppingCart"));
|
|
15
|
+
var _VerifiedUser = _interopRequireDefault(require("@mui/icons-material/VerifiedUser"));
|
|
16
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
17
|
+
var _Colors = _interopRequireDefault(require("@arcblock/ux/lib/Colors"));
|
|
18
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
const commonProps = {
|
|
22
|
+
meta: _propTypes.default.object.isRequired,
|
|
23
|
+
onCancel: _propTypes.default.func.isRequired
|
|
24
|
+
};
|
|
25
|
+
exports.commonProps = commonProps;
|
|
26
|
+
const useStyles = (0, _styles.makeStyles)(() => ({
|
|
27
|
+
dialogAuth: {
|
|
28
|
+
padding: '0 0 24px !important',
|
|
29
|
+
'& .auth-title': {
|
|
30
|
+
textAlign: 'center !important',
|
|
31
|
+
marginBottom: '4px !important'
|
|
32
|
+
},
|
|
33
|
+
'& .auth-tip--scan': {
|
|
34
|
+
textAlign: 'center !important'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
iconRoot: {
|
|
38
|
+
minWidth: 48
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
exports.useStyles = useStyles;
|
|
42
|
+
function CustomSelect(_ref) {
|
|
43
|
+
let {
|
|
44
|
+
action,
|
|
45
|
+
onSelect,
|
|
46
|
+
onNext
|
|
47
|
+
} = _ref;
|
|
48
|
+
const classes = useStyles();
|
|
49
|
+
const {
|
|
50
|
+
t
|
|
51
|
+
} = (0, _context.useLocaleContext)();
|
|
52
|
+
const options = [{
|
|
53
|
+
action: 'purchase',
|
|
54
|
+
title: t('store.purchase.purchase.title'),
|
|
55
|
+
description: t('store.purchase.purchase.description')
|
|
56
|
+
}, {
|
|
57
|
+
action: 'verify',
|
|
58
|
+
title: t('store.purchase.verify.title'),
|
|
59
|
+
description: t('store.purchase.verify.description')
|
|
60
|
+
}];
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
62
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_List.default, {
|
|
63
|
+
className: classes.tabPanel,
|
|
64
|
+
children: options.map(x => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ListItem.default, {
|
|
65
|
+
button: true,
|
|
66
|
+
selected: action === x.action,
|
|
67
|
+
onClick: () => onSelect(x.action),
|
|
68
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
69
|
+
className: classes.iconRoot,
|
|
70
|
+
children: x.action === 'purchase' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ShoppingCart.default, {
|
|
71
|
+
style: {
|
|
72
|
+
color: action === 'purchase' ? _Colors.default.primary.main : '#AAA',
|
|
73
|
+
fontSize: 32
|
|
74
|
+
}
|
|
75
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_VerifiedUser.default, {
|
|
76
|
+
style: {
|
|
77
|
+
color: action === 'verify' ? _Colors.default.primary.main : '#AAA',
|
|
78
|
+
fontSize: 32
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
82
|
+
primary: x.title,
|
|
83
|
+
secondary: x.description
|
|
84
|
+
})]
|
|
85
|
+
}, x.action))
|
|
86
|
+
}), onNext && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
87
|
+
fullWidth: true,
|
|
88
|
+
disabled: !action,
|
|
89
|
+
variant: "contained",
|
|
90
|
+
color: "primary",
|
|
91
|
+
style: {
|
|
92
|
+
marginTop: 16
|
|
93
|
+
},
|
|
94
|
+
onClick: onNext,
|
|
95
|
+
children: t('common.next')
|
|
96
|
+
})]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
CustomSelect.propTypes = {
|
|
100
|
+
action: _propTypes.default.oneOf(['both', 'purchase', 'verify']).isRequired,
|
|
101
|
+
onSelect: _propTypes.default.func.isRequired,
|
|
102
|
+
onNext: _propTypes.default.func.isRequired
|
|
103
|
+
};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ComponentPurchase = ComponentPurchase;
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
10
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
11
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
12
|
+
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _pWaitFor = _interopRequireDefault(require("p-wait-for"));
|
|
15
|
+
var _toast = _interopRequireDefault(require("../../toast"));
|
|
16
|
+
var _node = require("../../contexts/node");
|
|
17
|
+
var _util2 = require("../../util");
|
|
18
|
+
var _api = require("../../util/api");
|
|
19
|
+
var _common = require("./common");
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
const _excluded = ["mode"];
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
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; }
|
|
28
|
+
function ComponentPurchase(_ref) {
|
|
29
|
+
let {
|
|
30
|
+
meta,
|
|
31
|
+
onCancel,
|
|
32
|
+
mode,
|
|
33
|
+
handlePaySuccess
|
|
34
|
+
} = _ref;
|
|
35
|
+
const {
|
|
36
|
+
t,
|
|
37
|
+
locale
|
|
38
|
+
} = (0, _context.useLocaleContext)();
|
|
39
|
+
const {
|
|
40
|
+
info
|
|
41
|
+
} = (0, _node.useNodeContext)();
|
|
42
|
+
const webWalletUrl = (0, _util2.getWebWalletUrl)(info);
|
|
43
|
+
const [nw, setNw] = (0, _react.useState)(null);
|
|
44
|
+
const baseUrl = new URL(meta === null || meta === void 0 ? void 0 : meta.registryUrl).origin;
|
|
45
|
+
const name = (0, _util.getDisplayName)({
|
|
46
|
+
meta
|
|
47
|
+
});
|
|
48
|
+
const handleConnectSuccess = async (result, decrypt) => {
|
|
49
|
+
const success = async _ref2 => {
|
|
50
|
+
let {
|
|
51
|
+
downloadTokenList
|
|
52
|
+
} = _ref2;
|
|
53
|
+
handlePaySuccess({
|
|
54
|
+
downloadTokenList
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const failure = async errorMessage => {
|
|
58
|
+
_toast.default.error(errorMessage);
|
|
59
|
+
onCancel(errorMessage);
|
|
60
|
+
};
|
|
61
|
+
async function handleConnectSessionStatus(url) {
|
|
62
|
+
return (0, _pWaitFor.default)(() => {
|
|
63
|
+
return _api.api.get(url).then(async _ref3 => {
|
|
64
|
+
let {
|
|
65
|
+
data
|
|
66
|
+
} = _ref3;
|
|
67
|
+
const downloadTokenList = data === null || data === void 0 ? void 0 : data.downloadTokenList;
|
|
68
|
+
if (data.status === 'succeed') {
|
|
69
|
+
if (downloadTokenList && downloadTokenList.length) {
|
|
70
|
+
await success({
|
|
71
|
+
downloadTokenList
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
await failure(t('blocklet.component.missDownloadTokenTip'));
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (data.status === 'error') {
|
|
80
|
+
console.error('vc error: ', data);
|
|
81
|
+
await failure(data === null || data === void 0 ? void 0 : data.error);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
});
|
|
86
|
+
}, {
|
|
87
|
+
interval: 1000
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (mode === 'purchase' && nw) {
|
|
91
|
+
const {
|
|
92
|
+
statusUrl
|
|
93
|
+
} = (0, _util2.extractStatusUrlFromNextWorkflow)(nw);
|
|
94
|
+
// poll status url, to get download token
|
|
95
|
+
await handleConnectSessionStatus(statusUrl);
|
|
96
|
+
} else {
|
|
97
|
+
await success({
|
|
98
|
+
downloadTokenList: result.downloadTokenList && decrypt(result.downloadTokenList)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
(0, _react.useEffect)(() => {
|
|
103
|
+
// only purchase mode has nw
|
|
104
|
+
if (mode === 'purchase') {
|
|
105
|
+
const nextWorkflowUrl = new URL(baseUrl);
|
|
106
|
+
nextWorkflowUrl.pathname = '/api/did/verify-purchase-blocklet/token';
|
|
107
|
+
nextWorkflowUrl.searchParams.set('serverDid', info.did);
|
|
108
|
+
nextWorkflowUrl.searchParams.set('blockletDid', meta === null || meta === void 0 ? void 0 : meta.did);
|
|
109
|
+
try {
|
|
110
|
+
_api.api.get(nextWorkflowUrl.href).then(_ref4 => {
|
|
111
|
+
let {
|
|
112
|
+
data
|
|
113
|
+
} = _ref4;
|
|
114
|
+
const url = "".concat(data.url);
|
|
115
|
+
setNw(url);
|
|
116
|
+
});
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error('get next workflow url error: ', error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return () => {
|
|
122
|
+
setNw(null);
|
|
123
|
+
};
|
|
124
|
+
}, [mode]); // eslint-disable-line
|
|
125
|
+
|
|
126
|
+
// If nw does not exist, then connect should not be render
|
|
127
|
+
if (mode === 'purchase' && !nw) {
|
|
128
|
+
return '';
|
|
129
|
+
}
|
|
130
|
+
const modePropsMap = {
|
|
131
|
+
verify: {
|
|
132
|
+
action: 'verify-purchase-blocklet',
|
|
133
|
+
checkFn: _api.axios.create({
|
|
134
|
+
baseURL: baseUrl
|
|
135
|
+
}).get,
|
|
136
|
+
extraParams: {
|
|
137
|
+
serverDid: info.did,
|
|
138
|
+
blockletDid: meta === null || meta === void 0 ? void 0 : meta.did
|
|
139
|
+
},
|
|
140
|
+
messages: {
|
|
141
|
+
title: t('store.purchase.verify.auth.title', {
|
|
142
|
+
name
|
|
143
|
+
}),
|
|
144
|
+
scan: t('store.purchase.verify.auth.scan'),
|
|
145
|
+
confirm: t('store.purchase.verify.auth.confirm'),
|
|
146
|
+
success: t('store.purchase.verify.auth.success')
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
purchase: {
|
|
150
|
+
action: 'acquire-asset',
|
|
151
|
+
checkFn: _api.axios.create({
|
|
152
|
+
baseURL: (0, _urlJoin.default)(baseUrl, '/store')
|
|
153
|
+
}).get,
|
|
154
|
+
extraParams: {
|
|
155
|
+
factory: meta.nftFactory,
|
|
156
|
+
nw
|
|
157
|
+
},
|
|
158
|
+
messages: {
|
|
159
|
+
title: t('store.purchase.auth.title', {
|
|
160
|
+
name
|
|
161
|
+
}),
|
|
162
|
+
scan: t('store.purchase.auth.scan'),
|
|
163
|
+
confirm: t('store.purchase.auth.confirm'),
|
|
164
|
+
success: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
165
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
166
|
+
children: t('store.purchase.auth.success')
|
|
167
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
168
|
+
children: t('blocklet.component.purchaseComponentSecondCheckTip')
|
|
169
|
+
})]
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, _objectSpread({
|
|
175
|
+
open: true,
|
|
176
|
+
locale: locale,
|
|
177
|
+
popup: false,
|
|
178
|
+
saveConnect: false,
|
|
179
|
+
className: "connect",
|
|
180
|
+
baseUrl: baseUrl,
|
|
181
|
+
onSuccess: handleConnectSuccess,
|
|
182
|
+
cancelWhenScanned: onCancel,
|
|
183
|
+
onClose: onCancel,
|
|
184
|
+
checkTimeout: 60 * 5000,
|
|
185
|
+
webWalletUrl: webWalletUrl,
|
|
186
|
+
disableClose: true,
|
|
187
|
+
showDownload: false
|
|
188
|
+
}, modePropsMap[mode]));
|
|
189
|
+
}
|
|
190
|
+
ComponentPurchase.propTypes = _objectSpread(_objectSpread({}, _common.commonProps), {}, {
|
|
191
|
+
handlePaySuccess: _propTypes.default.func,
|
|
192
|
+
mode: _propTypes.default.oneOf(['verify', 'purchase']).isRequired
|
|
193
|
+
});
|
|
194
|
+
ComponentPurchase.defaultProps = {
|
|
195
|
+
handlePaySuccess: () => {}
|
|
196
|
+
};
|
|
197
|
+
const ComponentPurchaseSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
198
|
+
let {
|
|
199
|
+
mode
|
|
200
|
+
} = _ref5,
|
|
201
|
+
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
202
|
+
const [action, setAction] = (0, _react.useState)(mode !== 'both' ? mode : 'verify');
|
|
203
|
+
const [step, setStep] = (0, _react.useState)(mode !== 'both' ? 2 : 1);
|
|
204
|
+
const onSelect = async act => {
|
|
205
|
+
if (act === action) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
setAction(act);
|
|
209
|
+
};
|
|
210
|
+
const onNext = async () => {
|
|
211
|
+
if (!action) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (step === 2) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
setStep(2);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// expose the func and activeStep
|
|
221
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
222
|
+
onNext,
|
|
223
|
+
getCurrentStep: () => {
|
|
224
|
+
return step;
|
|
225
|
+
}
|
|
226
|
+
}));
|
|
227
|
+
if (step === 1) {
|
|
228
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
229
|
+
style: {
|
|
230
|
+
maxWidth: 520
|
|
231
|
+
},
|
|
232
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.CustomSelect, {
|
|
233
|
+
action: action,
|
|
234
|
+
onNext: null,
|
|
235
|
+
onSelect: onSelect
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentPurchase, _objectSpread(_objectSpread({}, rest), {}, {
|
|
240
|
+
mode: action
|
|
241
|
+
}));
|
|
242
|
+
});
|
|
243
|
+
ComponentPurchaseSelect.propTypes = {
|
|
244
|
+
mode: _propTypes.default.oneOf(['both', 'verify', 'purchase']).isRequired,
|
|
245
|
+
ref: _propTypes.default.any
|
|
246
|
+
};
|
|
247
|
+
ComponentPurchaseSelect.defaultProps = {
|
|
248
|
+
ref: {}
|
|
249
|
+
};
|
|
250
|
+
var _default = ComponentPurchaseSelect;
|
|
251
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ComponentPurchaseSelect", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _componentPurchase.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _componentPurchase = _interopRequireDefault(require("./component-purchase"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/blocklet/util.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.downloadExportedSource = downloadExportedSource;
|
|
7
7
|
exports.fixBlocklet = exports.ensureDomainAliases = void 0;
|
|
8
8
|
exports.genExportedMeta = genExportedMeta;
|
|
9
|
-
exports.
|
|
9
|
+
exports.getLaunchAgreementUrl = void 0;
|
|
10
10
|
exports.getNameByTitle = getNameByTitle;
|
|
11
11
|
exports.getServerUrl = void 0;
|
|
12
12
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
@@ -112,21 +112,9 @@ const getServerUrl = function getServerUrl(info) {
|
|
|
112
112
|
return encodeURI ? encodeURIComponent((0, _urlJoin.default)(window.location.origin, adminPath)) : (0, _urlJoin.default)(window.location.origin, adminPath);
|
|
113
113
|
};
|
|
114
114
|
exports.getServerUrl = getServerUrl;
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const metaUrl = (0, _urlJoin.default)(info === null || info === void 0 ? void 0 : info.blockletRegistry, "/api/blocklets/".concat(meta.did, "/blocklet.json"));
|
|
119
|
-
return {
|
|
120
|
-
serverUrl,
|
|
121
|
-
metaUrl
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
exports.getLaunchURL = getLaunchURL;
|
|
125
|
-
const getLaunchAgreementUrl = (meta, info) => {
|
|
126
|
-
const {
|
|
127
|
-
metaUrl,
|
|
128
|
-
serverUrl
|
|
129
|
-
} = getLaunchURL(meta, info);
|
|
115
|
+
const getLaunchAgreementUrl = (meta, info, storeUrl) => {
|
|
116
|
+
const serverUrl = getServerUrl(info);
|
|
117
|
+
const metaUrl = (0, _urlJoin.default)(storeUrl, "/api/blocklets/".concat(meta.did, "/blocklet.json"));
|
|
130
118
|
const url = new URL((0, _urlJoin.default)(serverUrl, '/launch-blocklet/agreement'));
|
|
131
119
|
url.searchParams.set('blocklet_meta_url', metaUrl);
|
|
132
120
|
url.searchParams.set('from', window.location.href);
|
package/lib/blocklet/version.js
CHANGED
|
@@ -89,7 +89,7 @@ function Version(_ref) {
|
|
|
89
89
|
const input = {
|
|
90
90
|
did: blocklet.meta.did,
|
|
91
91
|
version: newVersionBlocklet.version,
|
|
92
|
-
|
|
92
|
+
storeUrl: newVersionBlocklet.registryUrl || ''
|
|
93
93
|
};
|
|
94
94
|
await (0, _util2.sleep)(2000);
|
|
95
95
|
await api.upgradeBlocklet({
|
package/lib/hooks/blocklet.js
CHANGED
|
@@ -18,7 +18,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
18
18
|
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; }
|
|
19
19
|
// eslint-disable-next-line import/prefer-default-export
|
|
20
20
|
function useBlocklet(_ref) {
|
|
21
|
-
var _blocklet$site, _blocklet$site$domain, _blocklet$meta, _blocklet$meta2, _blocklet$meta3, _blocklet$meta4, _blocklet$meta5, _blocklet$meta6, _blocklet$meta7, _blocklet$meta8;
|
|
21
|
+
var _blocklet$site, _blocklet$site$domain, _blocklet$meta, _blocklet$meta2, _blocklet$meta3, _blocklet$meta4, _blocklet$meta5, _blocklet$meta6, _blocklet$meta7, _blocklet$meta8, _blocklet$meta9;
|
|
22
22
|
let {
|
|
23
23
|
did,
|
|
24
24
|
client,
|
|
@@ -109,6 +109,23 @@ function useBlocklet(_ref) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
+
const handleRefresh = data => {
|
|
113
|
+
var _data$meta;
|
|
114
|
+
if ((data === null || data === void 0 ? void 0 : (_data$meta = data.meta) === null || _data$meta === void 0 ? void 0 : _data$meta.did) === blocklet.meta.did) {
|
|
115
|
+
refreshBlocklet({
|
|
116
|
+
showError: false
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const handleRefreshWithoutRuntime = data => {
|
|
121
|
+
var _data$meta2;
|
|
122
|
+
if ((data === null || data === void 0 ? void 0 : (_data$meta2 = data.meta) === null || _data$meta2 === void 0 ? void 0 : _data$meta2.did) === blocklet.meta.did) {
|
|
123
|
+
refreshBlocklet({
|
|
124
|
+
attachRuntimeInfo: false,
|
|
125
|
+
showError: false
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
};
|
|
112
129
|
const refreshDomainStatus = () => {
|
|
113
130
|
if (did && domainListStr) {
|
|
114
131
|
client.checkDomains({
|
|
@@ -131,15 +148,14 @@ function useBlocklet(_ref) {
|
|
|
131
148
|
[data.domain]: _objectSpread(_objectSpread({}, pre[data.domain]), data)
|
|
132
149
|
}));
|
|
133
150
|
}, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did, !disableSubscription]);
|
|
134
|
-
useSubscription(_constant.BlockletEvents.statusChange, ()
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
useSubscription(_constant.BlockletEvents.
|
|
138
|
-
useSubscription(_constant.BlockletEvents.
|
|
139
|
-
useSubscription(_constant.BlockletEvents.
|
|
140
|
-
useSubscription(_constant.BlockletEvents.
|
|
141
|
-
useSubscription(_constant.BlockletEvents.
|
|
142
|
-
useSubscription(_constant.BlockletEvents.updated, refreshBlocklet, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta8 = blocklet.meta) === null || _blocklet$meta8 === void 0 ? void 0 : _blocklet$meta8.did, !disableSubscription]);
|
|
151
|
+
useSubscription(_constant.BlockletEvents.statusChange, handleRefreshWithoutRuntime, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta2 = blocklet.meta) === null || _blocklet$meta2 === void 0 ? void 0 : _blocklet$meta2.did, !disableSubscription]); // eslint-disable-line prettier/prettier
|
|
152
|
+
useSubscription(_constant.BlockletEvents.storeChange, handleRefreshWithoutRuntime, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta3 = blocklet.meta) === null || _blocklet$meta3 === void 0 ? void 0 : _blocklet$meta3.did, !disableSubscription]);
|
|
153
|
+
useSubscription(_constant.BlockletEvents.started, handleRefresh, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta4 = blocklet.meta) === null || _blocklet$meta4 === void 0 ? void 0 : _blocklet$meta4.did, !disableSubscription]);
|
|
154
|
+
useSubscription(_constant.BlockletEvents.startFailed, handleRefresh, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta5 = blocklet.meta) === null || _blocklet$meta5 === void 0 ? void 0 : _blocklet$meta5.did, !disableSubscription]);
|
|
155
|
+
useSubscription(_constant.BlockletEvents.installed, handleRefresh, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta6 = blocklet.meta) === null || _blocklet$meta6 === void 0 ? void 0 : _blocklet$meta6.did, !disableSubscription]);
|
|
156
|
+
useSubscription(_constant.BlockletEvents.upgraded, handleRefresh, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta7 = blocklet.meta) === null || _blocklet$meta7 === void 0 ? void 0 : _blocklet$meta7.did, !disableSubscription]);
|
|
157
|
+
useSubscription(_constant.BlockletEvents.downgraded, handleRefresh, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta8 = blocklet.meta) === null || _blocklet$meta8 === void 0 ? void 0 : _blocklet$meta8.did, !disableSubscription]);
|
|
158
|
+
useSubscription(_constant.BlockletEvents.updated, handleRefresh, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta9 = blocklet.meta) === null || _blocklet$meta9 === void 0 ? void 0 : _blocklet$meta9.did, !disableSubscription]);
|
|
143
159
|
const data = blocklet ? (0, _merge.default)(blocklet, {
|
|
144
160
|
site: {
|
|
145
161
|
domainAliases: blocklet.site.domainAliases.map(x => {
|
package/lib/layout/feedback.js
CHANGED
|
@@ -14,16 +14,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
|
|
15
15
|
function Feedback(_ref) {
|
|
16
16
|
let {
|
|
17
|
-
|
|
18
|
-
version,
|
|
19
|
-
bundleName
|
|
17
|
+
infos
|
|
20
18
|
} = _ref;
|
|
21
19
|
const {
|
|
22
20
|
t
|
|
23
21
|
} = (0, _context.useLocaleContext)();
|
|
22
|
+
const infoStr = infos.map(x => "* ".concat(x.label, ": ").concat(x.value)).join('\n');
|
|
24
23
|
const feedbackUrl = new URL('https://github.com/blocklet/blocklet-site/issues/new');
|
|
25
24
|
feedbackUrl.searchParams.set('title', '[Feedback]');
|
|
26
|
-
feedbackUrl.searchParams.set('body', "
|
|
25
|
+
feedbackUrl.searchParams.set('body', "<!-- [Enter feedback here] -->\n\n\n\n<!--\nDocument Details\n".concat(infoStr, "\n* Page: ").concat(window.location.href, "\n-->\n"));
|
|
27
26
|
return (0, _jsxRuntime.jsx)(_material.Box, {
|
|
28
27
|
sx: {
|
|
29
28
|
mx: {
|
|
@@ -46,12 +45,11 @@ function Feedback(_ref) {
|
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
47
|
Feedback.propTypes = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
infos: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
49
|
+
label: _propTypes.default.string,
|
|
50
|
+
value: _propTypes.default.string
|
|
51
|
+
}))
|
|
52
52
|
};
|
|
53
53
|
Feedback.defaultProps = {
|
|
54
|
-
|
|
55
|
-
version: '',
|
|
56
|
-
bundleName: ''
|
|
54
|
+
infos: []
|
|
57
55
|
};
|
package/lib/locales/en.js
CHANGED
|
@@ -60,6 +60,9 @@ module.exports = {
|
|
|
60
60
|
},
|
|
61
61
|
common: {
|
|
62
62
|
about: 'About',
|
|
63
|
+
access: 'Access',
|
|
64
|
+
general: 'General',
|
|
65
|
+
preferences: 'Preferences',
|
|
63
66
|
auditLogs: 'Audit Trail',
|
|
64
67
|
logs: 'Logs',
|
|
65
68
|
filter: 'Log Filter',
|
|
@@ -226,6 +229,8 @@ module.exports = {
|
|
|
226
229
|
scheduleSuccess: 'successfully scheduled',
|
|
227
230
|
search: 'Search',
|
|
228
231
|
security: 'Security',
|
|
232
|
+
serverDid: 'Server DID',
|
|
233
|
+
serverVersion: 'Server Version',
|
|
229
234
|
setting: 'Settings',
|
|
230
235
|
start: 'Start',
|
|
231
236
|
status: 'Status',
|
|
@@ -364,7 +369,8 @@ module.exports = {
|
|
|
364
369
|
}
|
|
365
370
|
},
|
|
366
371
|
publicToStore: 'Public On Store',
|
|
367
|
-
publicInstanceTip: 'The access address of this blocklet will be displayed in the Store (along with your DID for accepting donations)'
|
|
372
|
+
publicInstanceTip: 'The access address of this blocklet will be displayed in the Store (along with your DID for accepting donations)',
|
|
373
|
+
updatedTip: 'Access Control Modified'
|
|
368
374
|
},
|
|
369
375
|
disabledText: 'Please edit environment variables in ".env" file or "blocklet.yml" file',
|
|
370
376
|
changedTip: 'Configuration updated, please restart Blocklet',
|
|
@@ -374,7 +380,7 @@ module.exports = {
|
|
|
374
380
|
key: 'Configuration key',
|
|
375
381
|
value: 'Configuration value',
|
|
376
382
|
keyValueRequired: 'Configuration key and value must be specified',
|
|
377
|
-
invalidKey: 'Configuration key must not start with BLOCKLET_',
|
|
383
|
+
invalidKey: 'Configuration key must not start with BLOCKLET_ or COMPONENT_',
|
|
378
384
|
deleteForbidden: 'This configuration is required and should not be deleted',
|
|
379
385
|
tip: 'Configurations prefixed with BWA_ should not contain sensitive information because they will be sent to the browser'
|
|
380
386
|
}
|
|
@@ -1031,6 +1037,7 @@ module.exports = {
|
|
|
1031
1037
|
dialog: {
|
|
1032
1038
|
title: 'Authorization Required',
|
|
1033
1039
|
freeDescription: 'You need to present Blocklet Server Ownership NFT or Blocklet Server Passport to launch application',
|
|
1040
|
+
freeServerlessDescription: 'Please provide serverless NFT',
|
|
1034
1041
|
nonFreeDescription: 'You need to present application purchase NFT and Blocklet Server NFT to launch application',
|
|
1035
1042
|
confirm: 'Confirm on your DID Wallet',
|
|
1036
1043
|
success: 'Authorization Successfully',
|
package/lib/locales/zh.js
CHANGED
|
@@ -64,6 +64,9 @@ module.exports = {
|
|
|
64
64
|
},
|
|
65
65
|
common: {
|
|
66
66
|
about: '关于',
|
|
67
|
+
access: '访问',
|
|
68
|
+
general: '通用',
|
|
69
|
+
preferences: '偏好',
|
|
67
70
|
auditLogs: '审计记录',
|
|
68
71
|
logs: '日志',
|
|
69
72
|
filter: '筛选',
|
|
@@ -232,6 +235,8 @@ module.exports = {
|
|
|
232
235
|
scheduleSuccess: '成功加入任务队列',
|
|
233
236
|
search: '搜索',
|
|
234
237
|
security: '安全',
|
|
238
|
+
serverDid: '服务器 DID',
|
|
239
|
+
serverVersion: '服务器版本',
|
|
235
240
|
setting: '设置',
|
|
236
241
|
start: '启动',
|
|
237
242
|
status: '状态',
|
|
@@ -370,7 +375,8 @@ module.exports = {
|
|
|
370
375
|
}
|
|
371
376
|
},
|
|
372
377
|
publicToStore: '在 Store 公开',
|
|
373
|
-
publicInstanceTip: '此应用的访问地址将展示在 Store 中(同时也会展示你的 DID,用于接受捐赠)'
|
|
378
|
+
publicInstanceTip: '此应用的访问地址将展示在 Store 中(同时也会展示你的 DID,用于接受捐赠)',
|
|
379
|
+
updatedTip: '访问控制已修改'
|
|
374
380
|
},
|
|
375
381
|
disabledText: '请在 ".env" 文件或 "blocklet.yml" 文件中编辑环境变量',
|
|
376
382
|
changedTip: '配置已更新,请重启 Blocklet',
|
|
@@ -380,7 +386,7 @@ module.exports = {
|
|
|
380
386
|
key: '配置键',
|
|
381
387
|
value: '配置值',
|
|
382
388
|
keyValueRequired: '键和值不能为空',
|
|
383
|
-
invalidKey: '键不能以 BLOCKLET_ 开头',
|
|
389
|
+
invalidKey: '键不能以 BLOCKLET_ 或 COMPONENT_ 开头',
|
|
384
390
|
deleteForbidden: '该配置项是必填项,不能删除',
|
|
385
391
|
tip: '包含 BWA_ 前缀的配置项不应该包含敏感信息,因为他们会被发送到前端页面'
|
|
386
392
|
}
|
|
@@ -1037,6 +1043,7 @@ module.exports = {
|
|
|
1037
1043
|
dialog: {
|
|
1038
1044
|
title: '需要您的授权',
|
|
1039
1045
|
freeDescription: '你需要提供节点所有权 NFT 或节点通行证凭据来启动应用',
|
|
1046
|
+
freeServerlessDescription: '请提供无服务 NFT',
|
|
1040
1047
|
nonFreeDescription: '你需要提供应用购买凭证和节点通行证来启动应用',
|
|
1041
1048
|
confirm: '在您的 DID 钱包上确认',
|
|
1042
1049
|
success: '授权成功',
|
package/lib/schema-form/index.js
CHANGED
|
@@ -224,4 +224,4 @@ SchemaForm.defaultProps = {
|
|
|
224
224
|
style: {},
|
|
225
225
|
disabled: false
|
|
226
226
|
};
|
|
227
|
-
const StyledFormWrapper = (0, _styled.default)(_formWrapper.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["
|
|
227
|
+
const StyledFormWrapper = (0, _styled.default)(_formWrapper.default)(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
|