@abtnode/ux 1.16.5 → 1.16.6-beta-4562aa60
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 +24 -12
- package/lib/blocklet/configuration.js +33 -0
- package/lib/blocklet/preferences/index.js +25 -22
- package/lib/blocklet/transfer-owner.js +201 -0
- package/lib/exchange-passport.js +100 -0
- package/lib/locales/en.js +55 -1
- package/lib/locales/zh.js +55 -2
- package/lib/team/passports/index.js +29 -9
- package/lib/team/passports/trusted-factories.js +240 -0
- package/lib/team/passports/trusted-factory.js +194 -0
- package/lib/team/passports/trusted-issuer.js +2 -2
- package/lib/team/passports/trusted-issuers.js +7 -3
- package/lib/util/index.js +21 -7
- package/package.json +15 -14
package/lib/blocklet/actions.js
CHANGED
|
@@ -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'
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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:
|
|
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,
|
|
@@ -20,6 +20,7 @@ var _context = require("@arcblock/ux/lib/Locale/context");
|
|
|
20
20
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
21
21
|
var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
|
|
22
22
|
var _LockIcon = _interopRequireDefault(require("@arcblock/icons/lib/LockIcon"));
|
|
23
|
+
var _Loop = _interopRequireDefault(require("@mui/icons-material/Loop"));
|
|
23
24
|
var _constant = require("@abtnode/constant");
|
|
24
25
|
var _constant2 = require("@blocklet/constant");
|
|
25
26
|
var _util = require("@blocklet/meta/lib/util");
|
|
@@ -34,6 +35,7 @@ var _domainActions = _interopRequireDefault(require("./router/domain-actions"));
|
|
|
34
35
|
var _walletType = _interopRequireDefault(require("./preferences/wallet-type"));
|
|
35
36
|
var _appSk = _interopRequireDefault(require("./preferences/app-sk"));
|
|
36
37
|
var _addCert = _interopRequireDefault(require("./add-cert"));
|
|
38
|
+
var _transferOwner = _interopRequireDefault(require("./transfer-owner"));
|
|
37
39
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
38
40
|
var _templateObject;
|
|
39
41
|
const _excluded = ["blocklet", "onUpdate", "hasPermission"];
|
|
@@ -62,6 +64,7 @@ function BlockletEnvironment(_ref) {
|
|
|
62
64
|
} = (0, _react.useContext)(_context.LocaleContext);
|
|
63
65
|
const [cpuCores, setCpuCores] = (0, _react.useState)('');
|
|
64
66
|
const [loading, setLoading] = (0, _react.useState)('');
|
|
67
|
+
const [showTransferOwner, setShowTransferOwner] = (0, _react.useState)(false);
|
|
65
68
|
const whoCanAccess = (0, _util.getWhoCanAccess)(blocklet);
|
|
66
69
|
const publicToStore = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.publicToStore;
|
|
67
70
|
const theme = (0, _useTheme.default)();
|
|
@@ -533,6 +536,36 @@ function BlockletEnvironment(_ref) {
|
|
|
533
536
|
initialValue: blocklet.environments.find(x => x.key === 'BLOCKLET_APP_SK').value,
|
|
534
537
|
onChange: onAppSkChange
|
|
535
538
|
})]
|
|
539
|
+
}), inService && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
540
|
+
className: "config-form",
|
|
541
|
+
mt: 2,
|
|
542
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
543
|
+
className: "config-item",
|
|
544
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
545
|
+
className: "config-label",
|
|
546
|
+
mb: 0,
|
|
547
|
+
children: t('team.transferApp.name')
|
|
548
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
549
|
+
style: {
|
|
550
|
+
flexShrink: 0
|
|
551
|
+
},
|
|
552
|
+
variant: "contained",
|
|
553
|
+
edge: "end",
|
|
554
|
+
color: "error",
|
|
555
|
+
size: "small",
|
|
556
|
+
"data-cy": "transfer-app",
|
|
557
|
+
onClick: () => setShowTransferOwner(true),
|
|
558
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Loop.default, {
|
|
559
|
+
style: {
|
|
560
|
+
fontSize: '1.3em',
|
|
561
|
+
marginRight: 4
|
|
562
|
+
}
|
|
563
|
+
}), t('team.transferApp.name')]
|
|
564
|
+
})]
|
|
565
|
+
}), showTransferOwner && /*#__PURE__*/(0, _jsxRuntime.jsx)(_transferOwner.default, {
|
|
566
|
+
onCancel: () => setShowTransferOwner(false),
|
|
567
|
+
onSuccess: () => setShowTransferOwner(false)
|
|
568
|
+
})]
|
|
536
569
|
})]
|
|
537
570
|
})]
|
|
538
571
|
}));
|
|
@@ -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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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);
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = TransferOwner;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
+
var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
|
|
11
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
12
|
+
var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
|
|
13
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
14
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
15
|
+
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
16
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
17
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
18
|
+
var _Alert = _interopRequireDefault(require("@arcblock/ux/lib/Alert"));
|
|
19
|
+
var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
|
|
20
|
+
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
21
|
+
var _clickToCopy = _interopRequireDefault(require("../click-to-copy"));
|
|
22
|
+
var _util = require("../util");
|
|
23
|
+
var _session = require("../contexts/session");
|
|
24
|
+
var _team = require("../contexts/team");
|
|
25
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
+
var _templateObject;
|
|
27
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
+
function TransferOwner(_ref) {
|
|
30
|
+
let {
|
|
31
|
+
onCancel,
|
|
32
|
+
onSuccess,
|
|
33
|
+
onError
|
|
34
|
+
} = _ref;
|
|
35
|
+
const {
|
|
36
|
+
api: sessionAPI
|
|
37
|
+
} = (0, _react.useContext)(_session.SessionContext);
|
|
38
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
39
|
+
const {
|
|
40
|
+
locale
|
|
41
|
+
} = (0, _context.useLocaleContext)();
|
|
42
|
+
const [error, setError] = (0, _react.useState)('');
|
|
43
|
+
const {
|
|
44
|
+
t
|
|
45
|
+
} = (0, _context.useLocaleContext)();
|
|
46
|
+
const [openTransferOwner, setOpenTransferOwner] = (0, _react.useState)(false);
|
|
47
|
+
const [activeStep, setActiveStep] = (0, _react.useState)(0);
|
|
48
|
+
const [result, setResult] = (0, _react.useState)('');
|
|
49
|
+
const {
|
|
50
|
+
endpoint
|
|
51
|
+
} = (0, _team.useTeamContext)();
|
|
52
|
+
const [confirmCopied, setConfirmCopied] = (0, _react.useState)(false);
|
|
53
|
+
const onCreateSession = async res => {
|
|
54
|
+
setError(null);
|
|
55
|
+
setLoading(true);
|
|
56
|
+
try {
|
|
57
|
+
setResult(res.result);
|
|
58
|
+
setActiveStep(steps.length - 1); // 跳转到最后一步
|
|
59
|
+
} catch (err) {
|
|
60
|
+
const errMsg = (0, _util.formatError)(err);
|
|
61
|
+
setError(errMsg);
|
|
62
|
+
onError(err);
|
|
63
|
+
} finally {
|
|
64
|
+
setLoading(false);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const handleTransferOwner = () => {
|
|
68
|
+
setOpenTransferOwner(true);
|
|
69
|
+
setActiveStep(1);
|
|
70
|
+
};
|
|
71
|
+
const handleCancelTransferOwner = () => {
|
|
72
|
+
setOpenTransferOwner(false);
|
|
73
|
+
setActiveStep(0);
|
|
74
|
+
};
|
|
75
|
+
const steps = [{
|
|
76
|
+
body: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
77
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
78
|
+
children: t('team.transferApp.transferDialog.tips.progress')
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
80
|
+
mt: 3,
|
|
81
|
+
mb: 2,
|
|
82
|
+
children: t('team.transferApp.transferDialog.tips.newOwnerPermissions')
|
|
83
|
+
})]
|
|
84
|
+
}),
|
|
85
|
+
cancel: t('common.cancel'),
|
|
86
|
+
confirm: t('team.transferApp.transferDialog.createTransferLink'),
|
|
87
|
+
onCancel,
|
|
88
|
+
onConfirm: handleTransferOwner
|
|
89
|
+
}, {
|
|
90
|
+
body: () => {
|
|
91
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
92
|
+
action: "transfer-app-owner",
|
|
93
|
+
open: openTransferOwner,
|
|
94
|
+
locale: locale,
|
|
95
|
+
checkFn: sessionAPI.get,
|
|
96
|
+
onClose: handleCancelTransferOwner,
|
|
97
|
+
onSuccess: onCreateSession,
|
|
98
|
+
checkTimeout: 5 * 60 * 1000,
|
|
99
|
+
extraParams: {},
|
|
100
|
+
messages: {
|
|
101
|
+
title: t('team.transferApp.connectDialog.title'),
|
|
102
|
+
scan: t('team.transferApp.connectDialog.scan'),
|
|
103
|
+
confirm: t('team.transferApp.connectDialog.confirm'),
|
|
104
|
+
success: t('team.transferApp.connectDialog.success')
|
|
105
|
+
},
|
|
106
|
+
popup: true
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
body: () => {
|
|
111
|
+
const link = (0, _util.getTransferAppLink)({
|
|
112
|
+
transferId: result.transferId,
|
|
113
|
+
endpoint
|
|
114
|
+
});
|
|
115
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
116
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
117
|
+
component: Bold,
|
|
118
|
+
dangerouslySetInnerHTML: {
|
|
119
|
+
__html: t('team.transferApp.transferDialog.createSuccessTip1')
|
|
120
|
+
}
|
|
121
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
122
|
+
component: Bold,
|
|
123
|
+
mt: 2,
|
|
124
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Bold, {
|
|
125
|
+
children: t('team.transferApp.transferDialog.createSuccessTip3')
|
|
126
|
+
})
|
|
127
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
128
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
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
|
+
})
|
|
141
|
+
})]
|
|
142
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
143
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
144
|
+
value: "end",
|
|
145
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, {
|
|
146
|
+
checked: confirmCopied,
|
|
147
|
+
onChange: e => setConfirmCopied(e.target.checked)
|
|
148
|
+
}),
|
|
149
|
+
label: t('team.transferApp.transferDialog.iKnow'),
|
|
150
|
+
labelPlacement: "end"
|
|
151
|
+
})
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
confirm: t('common.confirm'),
|
|
156
|
+
onConfirm: onSuccess
|
|
157
|
+
}];
|
|
158
|
+
const step = steps[activeStep];
|
|
159
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dialog.default, {
|
|
160
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsx)(Bold, {
|
|
161
|
+
className: "title",
|
|
162
|
+
children: t('team.transferApp.transferDialog.title')
|
|
163
|
+
}),
|
|
164
|
+
fullWidth: true,
|
|
165
|
+
open: true,
|
|
166
|
+
showCloseButton: false,
|
|
167
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
168
|
+
children: [step.cancel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
169
|
+
onClick: step.onCancel,
|
|
170
|
+
color: "inherit",
|
|
171
|
+
children: step.cancel
|
|
172
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
173
|
+
onClick: step.onConfirm,
|
|
174
|
+
color: "error",
|
|
175
|
+
disabled: loading || activeStep === steps.length - 1 && !confirmCopied,
|
|
176
|
+
variant: "contained",
|
|
177
|
+
autoFocus: true,
|
|
178
|
+
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
179
|
+
size: 16
|
|
180
|
+
}), step.confirm]
|
|
181
|
+
})]
|
|
182
|
+
}),
|
|
183
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogContentText.default, {
|
|
184
|
+
component: "div",
|
|
185
|
+
children: typeof step.body === 'function' ? step.body() : step.body
|
|
186
|
+
}), !!error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
187
|
+
type: "error",
|
|
188
|
+
variant: "icon",
|
|
189
|
+
children: error
|
|
190
|
+
})]
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
TransferOwner.propTypes = {
|
|
194
|
+
onCancel: _propTypes.default.func.isRequired,
|
|
195
|
+
onSuccess: _propTypes.default.func.isRequired,
|
|
196
|
+
onError: _propTypes.default.func
|
|
197
|
+
};
|
|
198
|
+
TransferOwner.defaultProps = {
|
|
199
|
+
onError: () => {}
|
|
200
|
+
};
|
|
201
|
+
const Bold = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"])));
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var _reactRouterDom = require("react-router-dom");
|
|
10
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
11
|
+
var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
|
|
12
|
+
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
13
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
14
|
+
var _constant = require("@abtnode/constant");
|
|
15
|
+
var _wrapLocale = _interopRequireDefault(require("./wrap-locale"));
|
|
16
|
+
var _toast = _interopRequireDefault(require("./toast"));
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
var _templateObject;
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
23
|
+
function ExchangePassport(_ref) {
|
|
24
|
+
let {
|
|
25
|
+
SessionContext,
|
|
26
|
+
webWalletUrl,
|
|
27
|
+
onSuccess
|
|
28
|
+
} = _ref;
|
|
29
|
+
const {
|
|
30
|
+
api,
|
|
31
|
+
session
|
|
32
|
+
} = (0, _react.useContext)(SessionContext);
|
|
33
|
+
const {
|
|
34
|
+
t,
|
|
35
|
+
locale
|
|
36
|
+
} = (0, _context.useLocaleContext)();
|
|
37
|
+
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
38
|
+
const {
|
|
39
|
+
searchParams
|
|
40
|
+
} = new URL(window.location.href);
|
|
41
|
+
const redirect = searchParams.get('redirect');
|
|
42
|
+
const onDone = async (result, decrypt) => {
|
|
43
|
+
onSuccess(result, decrypt);
|
|
44
|
+
await session.refresh();
|
|
45
|
+
_toast.default.success(t('exchangePassport.success'));
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
if (redirect) {
|
|
48
|
+
const url = decodeURIComponent(redirect);
|
|
49
|
+
if (url.startsWith(_constant.WELLKNOWN_SERVICE_PATH_PREFIX)) {
|
|
50
|
+
navigate(url, {
|
|
51
|
+
replace: true
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
window.location = url;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
window.location = window.env.pathPrefix || window.env.apiPrefix || '/';
|
|
58
|
+
}
|
|
59
|
+
}, 3000);
|
|
60
|
+
};
|
|
61
|
+
const onError = err => {
|
|
62
|
+
_toast.default.error(err.message);
|
|
63
|
+
};
|
|
64
|
+
const extraParams = {};
|
|
65
|
+
const componentId = searchParams.get('componentId');
|
|
66
|
+
if (componentId) {
|
|
67
|
+
extraParams.componentId = componentId;
|
|
68
|
+
}
|
|
69
|
+
if (session.loading) {
|
|
70
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Center.default, {
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Div, {
|
|
75
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
76
|
+
className: "connect-wrapper",
|
|
77
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
78
|
+
className: "connect",
|
|
79
|
+
action: "exchange-passport",
|
|
80
|
+
checkFn: api.get,
|
|
81
|
+
checkTimeout: 10 * 60 * 1000,
|
|
82
|
+
webWalletUrl: webWalletUrl,
|
|
83
|
+
onSuccess: onDone,
|
|
84
|
+
onError: onError,
|
|
85
|
+
locale: locale,
|
|
86
|
+
messages: {
|
|
87
|
+
title: t('exchangePassport.dialog.title'),
|
|
88
|
+
scan: t('exchangePassport.dialog.scan'),
|
|
89
|
+
confirm: t('exchangePassport.dialog.confirm'),
|
|
90
|
+
success: t('exchangePassport.dialog.success')
|
|
91
|
+
},
|
|
92
|
+
extraParams: extraParams,
|
|
93
|
+
extraContent: null
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
var _default = (0, _wrapLocale.default)(ExchangePassport);
|
|
99
|
+
exports.default = _default;
|
|
100
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n box-sizing: border-box;\n width: 100%;\n height: 100vh;\n position: relative;\n display: flex;\n flex-direction: column;\n .connect-wrapper {\n flex: 1;\n }\n .connect {\n background: #fafafa;\n }\n"])));
|
package/lib/locales/en.js
CHANGED
|
@@ -53,6 +53,18 @@ module.exports = {
|
|
|
53
53
|
title: 'Claim Server with Ownership NFT',
|
|
54
54
|
tooltip: 'If you received a server ownership nft, you can claim your owner passport with this link.'
|
|
55
55
|
},
|
|
56
|
+
exchangePassport: {
|
|
57
|
+
title: 'Exchange Passport with NFT',
|
|
58
|
+
success: 'You have successfully exchanged your passport and logged in with the passport',
|
|
59
|
+
login: 'Login',
|
|
60
|
+
tooltip: 'If you own NFT from collection {collections}, you can exchange your passport with this link.',
|
|
61
|
+
dialog: {
|
|
62
|
+
title: 'Exchange Passport with NFT',
|
|
63
|
+
scan: 'Connect your DID Wallet to present your NFT to get a passport',
|
|
64
|
+
confirm: 'Select NFT on your DID Wallet',
|
|
65
|
+
success: 'Passport has been successfully exchanged'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
56
68
|
sidebar: {
|
|
57
69
|
dashboard: 'Dashboard',
|
|
58
70
|
blocklets: 'Blocklets',
|
|
@@ -120,7 +132,7 @@ module.exports = {
|
|
|
120
132
|
dAddress: 'Decentralized Identifiers (DID)',
|
|
121
133
|
dataStorage: 'Data Storage',
|
|
122
134
|
delConfirm: 'Delete',
|
|
123
|
-
delConfirmDescription: 'Confirm delete?',
|
|
135
|
+
delConfirmDescription: 'Confirm delete {data}?',
|
|
124
136
|
delete: 'Delete',
|
|
125
137
|
dependents: 'Dependents',
|
|
126
138
|
description: 'Description',
|
|
@@ -309,6 +321,7 @@ module.exports = {
|
|
|
309
321
|
statusTip: 'Blocklet is {status}',
|
|
310
322
|
initialUptime: 'Less than 1m',
|
|
311
323
|
dashboard: 'Blocklet Dashboard',
|
|
324
|
+
noComponent: 'Application has no components and cannot be started',
|
|
312
325
|
fromUrl: {
|
|
313
326
|
title: 'Install Blocklet',
|
|
314
327
|
label: 'Blocklet Meta URL',
|
|
@@ -974,6 +987,36 @@ module.exports = {
|
|
|
974
987
|
success: 'Authorization Successfully'
|
|
975
988
|
}
|
|
976
989
|
},
|
|
990
|
+
transferApp: {
|
|
991
|
+
name: 'Transfer Ownership',
|
|
992
|
+
transferDialog: {
|
|
993
|
+
title: 'Transfer Application',
|
|
994
|
+
tips: {
|
|
995
|
+
progress: 'Transfer the application needs to be accepted by the receiver to complete the transfer operation, and once the receiver accepts it, you cannot log in to the application with the current passport again.',
|
|
996
|
+
newOwnerPermissions: 'The new Owner will have the right to manage all operations such as members, passports, and settings.'
|
|
997
|
+
},
|
|
998
|
+
createTransferLink: 'Generate Transfer Link',
|
|
999
|
+
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',
|
|
1000
|
+
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',
|
|
1001
|
+
createSuccessTip3: 'After the transfer is successful, the application will automatically restart to make the changes take effect',
|
|
1002
|
+
link: 'Transfer Link',
|
|
1003
|
+
iKnow: 'I have copied and saved the link'
|
|
1004
|
+
},
|
|
1005
|
+
connectDialog: {
|
|
1006
|
+
title: 'Authorize Required',
|
|
1007
|
+
scan: 'Scan following QR code with DID Wallet to authorize application to transfer ownership.',
|
|
1008
|
+
confirm: 'Confirm on your DID Wallet',
|
|
1009
|
+
success: 'Authorization Successfully'
|
|
1010
|
+
},
|
|
1011
|
+
receiveDialog: {
|
|
1012
|
+
title: 'Receive Application Ownership',
|
|
1013
|
+
scan: 'Scan following QR code with DID Wallet to receive the application ownership.',
|
|
1014
|
+
confirm: 'Confirm on your DID Wallet',
|
|
1015
|
+
success: 'Receive Ownership Successfully'
|
|
1016
|
+
},
|
|
1017
|
+
successTitle: 'You have become the new owner of this application',
|
|
1018
|
+
visitDashboard: 'Visit Application Dashboard'
|
|
1019
|
+
},
|
|
977
1020
|
permission: {
|
|
978
1021
|
create: {
|
|
979
1022
|
title: 'Create Permission',
|
|
@@ -1028,6 +1071,16 @@ module.exports = {
|
|
|
1028
1071
|
enableIssuanceTip: '"Issue Passport", "Invite Member" and other operations will be enabled',
|
|
1029
1072
|
trustedPassportIssuers: 'Trusted Passport Issuers',
|
|
1030
1073
|
trustedIssuers: 'Trusted Issuers',
|
|
1074
|
+
trustedFactories: 'Trusted NFT Collections',
|
|
1075
|
+
trustedFactoriesTip: 'Mange trusted NFT Collections that can be used to exchange for a passport',
|
|
1076
|
+
searchFactoryAddress: 'Search Collection DID',
|
|
1077
|
+
configFactories: 'Config Trusted NFT Collections',
|
|
1078
|
+
configFactoriesTip: 'Allow users to exchange NFTs for passport',
|
|
1079
|
+
factoryAddress: 'NFT Collection Address',
|
|
1080
|
+
factoryAddressTip: 'The NFT Collection address must exist on ArcBlock Main Chain',
|
|
1081
|
+
role: 'Passport Type',
|
|
1082
|
+
ttl: 'Passport Valid Period',
|
|
1083
|
+
ttlTip: 'Calculated since NFT genesis time, 0 means no expiration',
|
|
1031
1084
|
externalPassport: 'External Passport',
|
|
1032
1085
|
notTrustedIssuerTip: 'The passport cannot be used because the issuer is not on the list of trusted issuers',
|
|
1033
1086
|
issuerDid: 'Issuer DID',
|
|
@@ -1041,6 +1094,7 @@ module.exports = {
|
|
|
1041
1094
|
searchIssuerDid: 'Search Issuer DID',
|
|
1042
1095
|
issueBy: 'Issue by {name}',
|
|
1043
1096
|
configColor: 'Config Passport Color',
|
|
1097
|
+
configColorTip: 'Customize the color of the passport',
|
|
1044
1098
|
color: 'Passport Color'
|
|
1045
1099
|
},
|
|
1046
1100
|
inviting: {
|