@abtnode/ux 1.16.5 → 1.16.6-beta-8be2fe37
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/configuration.js +33 -0
- package/lib/blocklet/transfer-owner.js +196 -0
- package/lib/exchange-passport.js +100 -0
- package/lib/locales/en.js +53 -1
- package/lib/locales/zh.js +53 -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
|
@@ -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": "invite-member",
|
|
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
|
}));
|
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
children: t('team.transferApp.transferDialog.createSuccessTip', {
|
|
119
|
+
expireDate: (0, _util.formatToDatetime)(result.expireDate)
|
|
120
|
+
})
|
|
121
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
122
|
+
component: Bold,
|
|
123
|
+
mt: 1,
|
|
124
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Bold, {
|
|
125
|
+
children: t('team.transferApp.transferDialog.createSuccessTip2')
|
|
126
|
+
})
|
|
127
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
128
|
+
style: {
|
|
129
|
+
marginTop: '20px'
|
|
130
|
+
}
|
|
131
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
132
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
133
|
+
children: t('team.transferApp.transferDialog.link')
|
|
134
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_clickToCopy.default, {
|
|
135
|
+
children: link
|
|
136
|
+
})]
|
|
137
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
138
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
139
|
+
value: "end",
|
|
140
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, {
|
|
141
|
+
checked: confirmCopied,
|
|
142
|
+
onChange: e => setConfirmCopied(e.target.checked)
|
|
143
|
+
}),
|
|
144
|
+
label: t('team.transferApp.transferDialog.iKnow'),
|
|
145
|
+
labelPlacement: "end"
|
|
146
|
+
})
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
confirm: t('common.confirm'),
|
|
151
|
+
onConfirm: onSuccess
|
|
152
|
+
}];
|
|
153
|
+
const step = steps[activeStep];
|
|
154
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dialog.default, {
|
|
155
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsx)(Bold, {
|
|
156
|
+
className: "title",
|
|
157
|
+
children: t('team.transferApp.transferDialog.title')
|
|
158
|
+
}),
|
|
159
|
+
fullWidth: true,
|
|
160
|
+
open: true,
|
|
161
|
+
showCloseButton: false,
|
|
162
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
163
|
+
children: [step.cancel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
164
|
+
onClick: step.onCancel,
|
|
165
|
+
color: "inherit",
|
|
166
|
+
children: step.cancel
|
|
167
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
168
|
+
onClick: step.onConfirm,
|
|
169
|
+
color: "error",
|
|
170
|
+
disabled: loading || activeStep === steps.length - 1 && !confirmCopied,
|
|
171
|
+
variant: "contained",
|
|
172
|
+
autoFocus: true,
|
|
173
|
+
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
174
|
+
size: 16
|
|
175
|
+
}), step.confirm]
|
|
176
|
+
})]
|
|
177
|
+
}),
|
|
178
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogContentText.default, {
|
|
179
|
+
component: "div",
|
|
180
|
+
children: typeof step.body === 'function' ? step.body() : step.body
|
|
181
|
+
}), !!error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
182
|
+
type: "error",
|
|
183
|
+
variant: "icon",
|
|
184
|
+
children: error
|
|
185
|
+
})]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
TransferOwner.propTypes = {
|
|
189
|
+
onCancel: _propTypes.default.func.isRequired,
|
|
190
|
+
onSuccess: _propTypes.default.func.isRequired,
|
|
191
|
+
onError: _propTypes.default.func
|
|
192
|
+
};
|
|
193
|
+
TransferOwner.defaultProps = {
|
|
194
|
+
onError: () => {}
|
|
195
|
+
};
|
|
196
|
+
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',
|
|
@@ -974,6 +986,35 @@ module.exports = {
|
|
|
974
986
|
success: 'Authorization Successfully'
|
|
975
987
|
}
|
|
976
988
|
},
|
|
989
|
+
transferApp: {
|
|
990
|
+
name: 'Transfer Ownership',
|
|
991
|
+
transferDialog: {
|
|
992
|
+
title: 'Transfer Application',
|
|
993
|
+
tips: {
|
|
994
|
+
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.',
|
|
995
|
+
newOwnerPermissions: 'The new Owner will have the right to manage all operations such as members, passports, and settings.'
|
|
996
|
+
},
|
|
997
|
+
createTransferLink: 'Generate Transfer Link',
|
|
998
|
+
createSuccessTip: 'The transfer link is successfully created, click to copy and send the link to the invited member, please note that this invitation link can not be reused and will expire on {expireDate}',
|
|
999
|
+
createSuccessTip2: 'Your transfer link will only be shown once and will not be viewable again after closing this dialog',
|
|
1000
|
+
link: 'Transfer Link',
|
|
1001
|
+
iKnow: 'I have copied and saved the link'
|
|
1002
|
+
},
|
|
1003
|
+
connectDialog: {
|
|
1004
|
+
title: 'Authorize Required',
|
|
1005
|
+
scan: 'Scan following QR code with DID Wallet to authorize application to transfer ownership.',
|
|
1006
|
+
confirm: 'Confirm on your DID Wallet',
|
|
1007
|
+
success: 'Authorization Successfully'
|
|
1008
|
+
},
|
|
1009
|
+
receiveDialog: {
|
|
1010
|
+
title: 'Receive Application Ownership',
|
|
1011
|
+
scan: 'Scan following QR code with DID Wallet to receive the application ownership.',
|
|
1012
|
+
confirm: 'Confirm on your DID Wallet',
|
|
1013
|
+
success: 'Receive Ownership Successfully'
|
|
1014
|
+
},
|
|
1015
|
+
successTitle: 'You have become the new owner of this application',
|
|
1016
|
+
visitDashboard: 'Visit Application Dashboard'
|
|
1017
|
+
},
|
|
977
1018
|
permission: {
|
|
978
1019
|
create: {
|
|
979
1020
|
title: 'Create Permission',
|
|
@@ -1028,6 +1069,16 @@ module.exports = {
|
|
|
1028
1069
|
enableIssuanceTip: '"Issue Passport", "Invite Member" and other operations will be enabled',
|
|
1029
1070
|
trustedPassportIssuers: 'Trusted Passport Issuers',
|
|
1030
1071
|
trustedIssuers: 'Trusted Issuers',
|
|
1072
|
+
trustedFactories: 'Trusted NFT Collections',
|
|
1073
|
+
trustedFactoriesTip: 'Mange trusted NFT Collections that can be used to exchange for a passport',
|
|
1074
|
+
searchFactoryAddress: 'Search Collection DID',
|
|
1075
|
+
configFactories: 'Config Trusted NFT Collections',
|
|
1076
|
+
configFactoriesTip: 'Allow users to exchange NFTs for passport',
|
|
1077
|
+
factoryAddress: 'NFT Collection Address',
|
|
1078
|
+
factoryAddressTip: 'The NFT Collection address must exist on ArcBlock Main Chain',
|
|
1079
|
+
role: 'Passport Type',
|
|
1080
|
+
ttl: 'Passport Valid Period',
|
|
1081
|
+
ttlTip: 'Calculated since NFT genesis time, 0 means no expiration',
|
|
1031
1082
|
externalPassport: 'External Passport',
|
|
1032
1083
|
notTrustedIssuerTip: 'The passport cannot be used because the issuer is not on the list of trusted issuers',
|
|
1033
1084
|
issuerDid: 'Issuer DID',
|
|
@@ -1041,6 +1092,7 @@ module.exports = {
|
|
|
1041
1092
|
searchIssuerDid: 'Search Issuer DID',
|
|
1042
1093
|
issueBy: 'Issue by {name}',
|
|
1043
1094
|
configColor: 'Config Passport Color',
|
|
1095
|
+
configColorTip: 'Customize the color of the passport',
|
|
1044
1096
|
color: 'Passport Color'
|
|
1045
1097
|
},
|
|
1046
1098
|
inviting: {
|
package/lib/locales/zh.js
CHANGED
|
@@ -57,6 +57,17 @@ module.exports = {
|
|
|
57
57
|
title: '使用 Owner NFT 接收节点',
|
|
58
58
|
tooltip: '如果你收到了 Owner NFT,你可以通过这个链接申请你的节点所有者通行证'
|
|
59
59
|
},
|
|
60
|
+
exchangePassport: {
|
|
61
|
+
title: '用 NFT 来换取通行证',
|
|
62
|
+
success: '你已经成功换取通行证,并自动登录',
|
|
63
|
+
tooltip: '如果你拥有来自 {collections} 集合的 NFT,点击这里换取通行证',
|
|
64
|
+
dialog: {
|
|
65
|
+
title: '用 NFT 来换取通行证',
|
|
66
|
+
scan: '连接 DID 钱包出示 NFT 以换取通行证',
|
|
67
|
+
confirm: '在钱包中选择 NFT',
|
|
68
|
+
success: '通行证换取成功'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
60
71
|
sidebar: {
|
|
61
72
|
dashboard: '仪表盘',
|
|
62
73
|
blocklets: '基石程序',
|
|
@@ -124,7 +135,7 @@ module.exports = {
|
|
|
124
135
|
dAddress: '去中心化地址(DID)',
|
|
125
136
|
dataStorage: '数据存储',
|
|
126
137
|
delConfirm: '删除',
|
|
127
|
-
delConfirmDescription: '
|
|
138
|
+
delConfirmDescription: '确认删除 {data}?',
|
|
128
139
|
delete: '删除',
|
|
129
140
|
dependents: '被依赖',
|
|
130
141
|
description: '描述',
|
|
@@ -698,7 +709,7 @@ module.exports = {
|
|
|
698
709
|
accessKeyId: 'Access Key',
|
|
699
710
|
lastUsed: '最后使用',
|
|
700
711
|
tip: '请给 Access Key 起个名字',
|
|
701
|
-
saveSecretTip: '你的 Access Secret
|
|
712
|
+
saveSecretTip: '你的 Access Secret 只会展示一次,关闭此窗口后将无法再次查看,不过你可以随时重新创建新的 Access Key',
|
|
702
713
|
iKnow: '我已复制保存好该 Access Secret',
|
|
703
714
|
showSecret: '展示 Secret',
|
|
704
715
|
hideSecret: '隐藏 Secret',
|
|
@@ -977,6 +988,35 @@ module.exports = {
|
|
|
977
988
|
success: '授权成功'
|
|
978
989
|
}
|
|
979
990
|
},
|
|
991
|
+
transferApp: {
|
|
992
|
+
name: '转移所有者',
|
|
993
|
+
transferDialog: {
|
|
994
|
+
title: '转移应用',
|
|
995
|
+
tips: {
|
|
996
|
+
progress: '转移应用需要对方接受后才能完成转移操作,对方一旦接受,无法再使用当前应用所有者凭据登录应用。',
|
|
997
|
+
newOwnerPermissions: '新 Owner 将有权管理成员、通行证,以及设置等所有操作。'
|
|
998
|
+
},
|
|
999
|
+
createTransferLink: '生成转移链接',
|
|
1000
|
+
createSuccessTip: '创建转移链接成功,请复制并发送给被邀请人。该链接只能使用一次,并将在 {expireDate} 过期',
|
|
1001
|
+
createSuccessTip2: '你的转移链接只会展示一次,关闭此窗口后将无法再次查看',
|
|
1002
|
+
link: '邀请链接',
|
|
1003
|
+
iKnow: '我已复制保存好该链接'
|
|
1004
|
+
},
|
|
1005
|
+
connectDialog: {
|
|
1006
|
+
title: '需要授权',
|
|
1007
|
+
scan: '用 DID 钱包扫描下面的二维码,授权应用转让所有权',
|
|
1008
|
+
confirm: '在您的 DID 钱包上确认',
|
|
1009
|
+
success: '授权成功'
|
|
1010
|
+
},
|
|
1011
|
+
receiveDialog: {
|
|
1012
|
+
title: '接收应用程序所有权',
|
|
1013
|
+
scan: '用 DID 钱包扫描下面的二维码,获得应用程序所有权。',
|
|
1014
|
+
confirm: '在您的 DID 钱包上确认',
|
|
1015
|
+
success: '成功获得所有权'
|
|
1016
|
+
},
|
|
1017
|
+
successTitle: '你已成为应用的所有者',
|
|
1018
|
+
visitDashboard: '访问应用控制台'
|
|
1019
|
+
},
|
|
980
1020
|
permission: {
|
|
981
1021
|
create: {
|
|
982
1022
|
title: '创建权限',
|
|
@@ -1034,6 +1074,16 @@ module.exports = {
|
|
|
1034
1074
|
enableIssuanceTip: '“颁发通行证”,“邀请成员” 等操作将被允许',
|
|
1035
1075
|
trustedPassportIssuers: '信任的通行证颁发者',
|
|
1036
1076
|
trustedIssuers: '信任的颁发者',
|
|
1077
|
+
trustedFactories: '信任的 NFT 集合',
|
|
1078
|
+
trustedFactoriesTip: '管理信任的 NFT 集合,持有这些集合中 NFT 的用户可以领取指定通行证',
|
|
1079
|
+
searchFactoryAddress: '搜索集合 DID',
|
|
1080
|
+
configFactories: '配置信任的 NFT 集合',
|
|
1081
|
+
configFactoriesTip: '允许用户用特定 NFT 来换取通行证',
|
|
1082
|
+
factoryAddress: 'NFT 集合 DID',
|
|
1083
|
+
factoryAddressTip: 'NFT 集合必须 ArcBlock 主链上的',
|
|
1084
|
+
role: '通行证类型',
|
|
1085
|
+
ttl: '通行证有效期',
|
|
1086
|
+
ttlTip: '是根据 NFT 的创建日期来计算,0 表示用不过期,可以使用 365d 的语法',
|
|
1037
1087
|
externalPassport: '外部的通信证',
|
|
1038
1088
|
notTrustedIssuerTip: '该通行证无法使用,因为颁发者未在信任的颁发者列表中',
|
|
1039
1089
|
issuerDid: '颁发者 DID',
|
|
@@ -1047,6 +1097,7 @@ module.exports = {
|
|
|
1047
1097
|
searchIssuerDid: '搜索颁发者 DID',
|
|
1048
1098
|
issueBy: '由 {name} 颁发',
|
|
1049
1099
|
configColor: '设置通行证颜色',
|
|
1100
|
+
configColorTip: '通过调色盘来自定义通行证的主色调',
|
|
1050
1101
|
color: '通行证颜色'
|
|
1051
1102
|
},
|
|
1052
1103
|
inviting: {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = PassportList;
|
|
7
|
-
var _react = require("react");
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
9
|
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
10
10
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
@@ -27,9 +27,12 @@ var _detail = _interopRequireDefault(require("./detail"));
|
|
|
27
27
|
var _color = _interopRequireDefault(require("./color"));
|
|
28
28
|
var _mutateRole = _interopRequireDefault(require("./mutate-role"));
|
|
29
29
|
var _trustedIssuers = _interopRequireDefault(require("./trusted-issuers"));
|
|
30
|
+
var _trustedFactories = _interopRequireDefault(require("./trusted-factories"));
|
|
30
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
32
|
var _templateObject;
|
|
32
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
|
+
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); }
|
|
35
|
+
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; }
|
|
33
36
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
34
37
|
function PassportList() {
|
|
35
38
|
const {
|
|
@@ -52,7 +55,8 @@ function PassportList() {
|
|
|
52
55
|
const [showCreate, setShowCreate] = (0, _react.useState)(false);
|
|
53
56
|
const [updateForm, setUpdateForm] = (0, _react.useState)(false);
|
|
54
57
|
const [showColor, setShowColor] = (0, _react.useState)(false);
|
|
55
|
-
const [showTrustedIssuers, setShowTrustedIssuers] = (0, _react.useState)(
|
|
58
|
+
const [showTrustedIssuers, setShowTrustedIssuers] = (0, _react.useState)(false);
|
|
59
|
+
const [showTrustedFactories, setShowTrustedFactories] = (0, _react.useState)(false);
|
|
56
60
|
const [search, setSearch] = (0, _react.useState)('');
|
|
57
61
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
58
62
|
const toggleShowIssue = async () => {
|
|
@@ -98,6 +102,16 @@ function PassportList() {
|
|
|
98
102
|
},
|
|
99
103
|
menu: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
100
104
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SplitButton.default.Item, {
|
|
105
|
+
onClick: () => setShowTrustedFactories(true),
|
|
106
|
+
"data-cy": "config-show-trusted-factories",
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
108
|
+
children: [t('team.passport.configFactories'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
109
|
+
fontSize: 12,
|
|
110
|
+
color: "#888",
|
|
111
|
+
children: t('team.passport.configFactoriesTip')
|
|
112
|
+
})]
|
|
113
|
+
})
|
|
114
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SplitButton.default.Item, {
|
|
101
115
|
"data-cy": "config-show-issue-passport",
|
|
102
116
|
onClick: () => {
|
|
103
117
|
toggleShowIssue();
|
|
@@ -121,8 +135,12 @@ function PassportList() {
|
|
|
121
135
|
}), !isNodeTeam && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SplitButton.default.Item, {
|
|
122
136
|
onClick: () => setShowColor(true),
|
|
123
137
|
"data-cy": "config-passport-color",
|
|
124
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
125
|
-
children: t('team.passport.configColor')
|
|
138
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
139
|
+
children: [t('team.passport.configColor'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
140
|
+
fontSize: 12,
|
|
141
|
+
color: "#888",
|
|
142
|
+
children: t('team.passport.configColorTip')
|
|
143
|
+
})]
|
|
126
144
|
})
|
|
127
145
|
})]
|
|
128
146
|
}),
|
|
@@ -208,13 +226,13 @@ function PassportList() {
|
|
|
208
226
|
refreshTeam();
|
|
209
227
|
}
|
|
210
228
|
}), updateForm && /*#__PURE__*/(0, _jsxRuntime.jsx)(_detail.default, {
|
|
211
|
-
onCancel: () => setUpdateForm(
|
|
229
|
+
onCancel: () => setUpdateForm(false),
|
|
212
230
|
onSuccess: () => {
|
|
213
|
-
setUpdateForm(
|
|
231
|
+
setUpdateForm(false);
|
|
214
232
|
refreshTeam();
|
|
215
233
|
},
|
|
216
234
|
onDelete: () => {
|
|
217
|
-
setUpdateForm(
|
|
235
|
+
setUpdateForm(false);
|
|
218
236
|
refreshTeam();
|
|
219
237
|
},
|
|
220
238
|
mode: "update",
|
|
@@ -222,9 +240,11 @@ function PassportList() {
|
|
|
222
240
|
item: updateForm
|
|
223
241
|
}), showTrustedIssuers && /*#__PURE__*/(0, _jsxRuntime.jsx)(_trustedIssuers.default, {
|
|
224
242
|
onCancel: () => setShowTrustedIssuers(false)
|
|
243
|
+
}), showTrustedFactories && /*#__PURE__*/(0, _jsxRuntime.jsx)(_trustedFactories.default, {
|
|
244
|
+
onCancel: () => setShowTrustedFactories(false)
|
|
225
245
|
}), showColor && /*#__PURE__*/(0, _jsxRuntime.jsx)(_color.default, {
|
|
226
|
-
onCancel: () => setShowColor(
|
|
227
|
-
onSuccess: () => setShowColor(
|
|
246
|
+
onCancel: () => setShowColor(false),
|
|
247
|
+
onSuccess: () => setShowColor(false)
|
|
228
248
|
})]
|
|
229
249
|
});
|
|
230
250
|
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = TrustedFactoriesWithPermission;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
11
|
+
var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
|
|
12
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
+
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
14
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
15
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
16
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
17
|
+
var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
|
|
18
|
+
var _Tag = _interopRequireDefault(require("@arcblock/ux/lib/Tag"));
|
|
19
|
+
var _Address = _interopRequireDefault(require("@arcblock/did-connect/lib/Address"));
|
|
20
|
+
var _EditIcon = _interopRequireDefault(require("@arcblock/icons/lib/EditIcon"));
|
|
21
|
+
var _DeleteIcon = _interopRequireDefault(require("@arcblock/icons/lib/DeleteIcon"));
|
|
22
|
+
var _Avatar = _interopRequireDefault(require("@arcblock/did-connect/lib/Avatar"));
|
|
23
|
+
var _toast = _interopRequireDefault(require("../../toast"));
|
|
24
|
+
var _permission = require("../../permission");
|
|
25
|
+
var _node = require("../../contexts/node");
|
|
26
|
+
var _team = require("../../contexts/team");
|
|
27
|
+
var _util = require("../../util");
|
|
28
|
+
var _confirm = _interopRequireDefault(require("../../confirm"));
|
|
29
|
+
var _listHeader = _interopRequireDefault(require("../styles/list-header"));
|
|
30
|
+
var _searchInput = _interopRequireDefault(require("../search-input"));
|
|
31
|
+
var _trustedFactory = _interopRequireDefault(require("./trusted-factory"));
|
|
32
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
+
var _templateObject;
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
+
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); }
|
|
36
|
+
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; }
|
|
37
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
38
|
+
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; }
|
|
39
|
+
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; }
|
|
40
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
42
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
43
|
+
function TrustedFactories(_ref) {
|
|
44
|
+
let {
|
|
45
|
+
onCancel,
|
|
46
|
+
hasPermission
|
|
47
|
+
} = _ref;
|
|
48
|
+
const {
|
|
49
|
+
api
|
|
50
|
+
} = (0, _node.useNodeContext)();
|
|
51
|
+
const {
|
|
52
|
+
teamDid,
|
|
53
|
+
trustedFactories
|
|
54
|
+
} = (0, _team.useTeamContext)();
|
|
55
|
+
const {
|
|
56
|
+
t
|
|
57
|
+
} = (0, _context.useLocaleContext)();
|
|
58
|
+
const [delConfirm, setDelConfirm] = (0, _react.useState)(null);
|
|
59
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
60
|
+
const [trustedFactory, setTrustedFactory] = (0, _react.useState)(null);
|
|
61
|
+
const [search, setSearch] = (0, _react.useState)('');
|
|
62
|
+
const deleteTrustedFactory = async did => {
|
|
63
|
+
if (loading) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
setLoading(true);
|
|
68
|
+
await api.configTrustedFactories({
|
|
69
|
+
input: {
|
|
70
|
+
teamDid,
|
|
71
|
+
trustedFactories: trustedFactories.filter(x => x.factoryAddress !== did)
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
await (0, _util.sleep)(800);
|
|
75
|
+
setLoading(false);
|
|
76
|
+
_toast.default.success(t('common.saveSuccess'));
|
|
77
|
+
setDelConfirm(null);
|
|
78
|
+
} catch (err) {
|
|
79
|
+
setLoading(false);
|
|
80
|
+
_toast.default.error(err.message);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const filterFactories = trustedFactories.filter(x => !search || x.factoryAddress.toLowerCase().includes(search.toLowerCase()));
|
|
84
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dialog.default, {
|
|
85
|
+
title: t('team.passport.trustedFactories'),
|
|
86
|
+
open: true,
|
|
87
|
+
onClose: onCancel,
|
|
88
|
+
fullWidth: true,
|
|
89
|
+
PaperProps: {
|
|
90
|
+
style: {
|
|
91
|
+
minHeight: '80vh'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Div, {
|
|
95
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
96
|
+
className: "dialog-content",
|
|
97
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
98
|
+
className: "dialog-h1",
|
|
99
|
+
children: t('team.passport.trustedFactoriesTip')
|
|
100
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
101
|
+
component: _listHeader.default,
|
|
102
|
+
mt: 3,
|
|
103
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
104
|
+
className: "left",
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_searchInput.default, {
|
|
106
|
+
placeholder: t('team.passport.searchFactoryAddress'),
|
|
107
|
+
value: search,
|
|
108
|
+
onChange: e => setSearch(e.target.value)
|
|
109
|
+
})
|
|
110
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
111
|
+
className: "right",
|
|
112
|
+
children: hasPermission && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
113
|
+
variant: "contained",
|
|
114
|
+
color: "primary",
|
|
115
|
+
size: "small",
|
|
116
|
+
"data-cy": "add-trusted-factory",
|
|
117
|
+
onClick: () => setTrustedFactory({
|
|
118
|
+
mode: 'add'
|
|
119
|
+
}),
|
|
120
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {
|
|
121
|
+
style: {
|
|
122
|
+
fontSize: 16,
|
|
123
|
+
marginRight: 4
|
|
124
|
+
}
|
|
125
|
+
}), t('team.add')]
|
|
126
|
+
})
|
|
127
|
+
})]
|
|
128
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
129
|
+
className: "list",
|
|
130
|
+
children: [filterFactories.map(x => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
131
|
+
display: "flex",
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
justifyContent: "space-between",
|
|
134
|
+
mt: "20px",
|
|
135
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
136
|
+
flexGrow: 1,
|
|
137
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Address.default, {
|
|
138
|
+
copyable: false,
|
|
139
|
+
prepend: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
140
|
+
display: "flex",
|
|
141
|
+
alignItems: "center",
|
|
142
|
+
mr: 1,
|
|
143
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
144
|
+
did: x.factoryAddress,
|
|
145
|
+
size: 20
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
showDidLogo: false,
|
|
149
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
150
|
+
style: {
|
|
151
|
+
fontSize: 16
|
|
152
|
+
},
|
|
153
|
+
children: x.factoryAddress
|
|
154
|
+
})
|
|
155
|
+
}), !!x.remark && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
156
|
+
pl: 3.5,
|
|
157
|
+
fontSize: 12,
|
|
158
|
+
maxWidth: "300px",
|
|
159
|
+
children: x.remark
|
|
160
|
+
})]
|
|
161
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
162
|
+
color: "gray",
|
|
163
|
+
mr: "24px",
|
|
164
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tag.default, {
|
|
165
|
+
type: "success",
|
|
166
|
+
children: x.passport.role
|
|
167
|
+
})
|
|
168
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
169
|
+
flexShrink: 0,
|
|
170
|
+
display: "flex",
|
|
171
|
+
alignItems: "center",
|
|
172
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
173
|
+
onClick: () => setTrustedFactory({
|
|
174
|
+
mode: 'update',
|
|
175
|
+
data: (0, _cloneDeep.default)(x)
|
|
176
|
+
}),
|
|
177
|
+
"data-cy": "edit-trusted-factory",
|
|
178
|
+
size: "large",
|
|
179
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditIcon.default, {})
|
|
180
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
181
|
+
"data-cy": "delete-trusted-factory",
|
|
182
|
+
onClick: () => setDelConfirm({
|
|
183
|
+
title: t('common.delete'),
|
|
184
|
+
description: t('common.delConfirmDescription', {
|
|
185
|
+
data: x.factoryAddress
|
|
186
|
+
}),
|
|
187
|
+
confirm: t('common.delConfirm'),
|
|
188
|
+
cancel: t('common.cancel'),
|
|
189
|
+
onConfirm: () => deleteTrustedFactory(x.factoryAddress),
|
|
190
|
+
onCancel: () => {
|
|
191
|
+
setLoading(false);
|
|
192
|
+
setDelConfirm(null);
|
|
193
|
+
}
|
|
194
|
+
}),
|
|
195
|
+
size: "large",
|
|
196
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteIcon.default, {})
|
|
197
|
+
})]
|
|
198
|
+
})]
|
|
199
|
+
}, x.factoryAddress)), !trustedFactories.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
200
|
+
children: t('common.empty')
|
|
201
|
+
})]
|
|
202
|
+
})]
|
|
203
|
+
})
|
|
204
|
+
}), trustedFactory && /*#__PURE__*/(0, _jsxRuntime.jsx)(_trustedFactory.default, {
|
|
205
|
+
data: trustedFactory.data,
|
|
206
|
+
trustedFactories: (0, _cloneDeep.default)(trustedFactories),
|
|
207
|
+
onCancel: () => setTrustedFactory(null),
|
|
208
|
+
onSuccess: () => {
|
|
209
|
+
setTrustedFactory(null);
|
|
210
|
+
}
|
|
211
|
+
}), delConfirm && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
212
|
+
title: delConfirm.title,
|
|
213
|
+
description: delConfirm.description,
|
|
214
|
+
confirm: delConfirm.confirm,
|
|
215
|
+
cancel: delConfirm.cancel,
|
|
216
|
+
params: delConfirm.params,
|
|
217
|
+
onConfirm: delConfirm.onConfirm,
|
|
218
|
+
onCancel: delConfirm.onCancel
|
|
219
|
+
})]
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
TrustedFactories.propTypes = {
|
|
223
|
+
onCancel: _propTypes.default.func.isRequired,
|
|
224
|
+
hasPermission: _propTypes.default.bool
|
|
225
|
+
};
|
|
226
|
+
TrustedFactories.defaultProps = {
|
|
227
|
+
hasPermission: false
|
|
228
|
+
};
|
|
229
|
+
const TrustedFactoriesInDaemon = (0, _permission.withPermission)(TrustedFactories, 'mutate_team');
|
|
230
|
+
const TrustedFactoriesInService = (0, _permission.withPermission)(TrustedFactories, '', _util.BlockletAdminRoles);
|
|
231
|
+
function TrustedFactoriesWithPermission(props) {
|
|
232
|
+
const {
|
|
233
|
+
inService
|
|
234
|
+
} = (0, _node.useNodeContext)();
|
|
235
|
+
if (inService) {
|
|
236
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TrustedFactoriesInService, _objectSpread({}, props));
|
|
237
|
+
}
|
|
238
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TrustedFactoriesInDaemon, _objectSpread({}, props));
|
|
239
|
+
}
|
|
240
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .list {\n .MuiIconButton-root {\n svg {\n fill: #bfbfbf;\n }\n }\n }\n"])));
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = TrustedFactory;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
+
var _ms = _interopRequireDefault(require("ms"));
|
|
11
|
+
var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
|
|
12
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
13
|
+
var _ArrowBack = _interopRequireDefault(require("@mui/icons-material/ArrowBack"));
|
|
14
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
15
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
16
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
17
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
18
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
19
|
+
var _toast = _interopRequireDefault(require("../../toast"));
|
|
20
|
+
var _node = require("../../contexts/node");
|
|
21
|
+
var _team = require("../../contexts/team");
|
|
22
|
+
var _util = require("../../util");
|
|
23
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
+
var _templateObject;
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
+
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); }
|
|
27
|
+
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; }
|
|
28
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
+
function TrustedFactory(_ref) {
|
|
30
|
+
var _data$passport, _data$passport2;
|
|
31
|
+
let {
|
|
32
|
+
onCancel,
|
|
33
|
+
onSuccess,
|
|
34
|
+
data,
|
|
35
|
+
trustedFactories
|
|
36
|
+
} = _ref;
|
|
37
|
+
const {
|
|
38
|
+
api
|
|
39
|
+
} = (0, _node.useNodeContext)();
|
|
40
|
+
const {
|
|
41
|
+
roles,
|
|
42
|
+
teamDid
|
|
43
|
+
} = (0, _team.useTeamContext)();
|
|
44
|
+
const {
|
|
45
|
+
t
|
|
46
|
+
} = (0, _context.useLocaleContext)();
|
|
47
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
48
|
+
const [factoryAddress, setFactoryAddress] = (0, _react.useState)(data.factoryAddress || '');
|
|
49
|
+
const [remark, setRemark] = (0, _react.useState)(data.remark || '');
|
|
50
|
+
const [role, setRole] = (0, _react.useState)(((_data$passport = data.passport) === null || _data$passport === void 0 ? void 0 : _data$passport.role) || 'member');
|
|
51
|
+
// eslint-disable-next-line no-unsafe-optional-chaining
|
|
52
|
+
const [ttl, setTtl] = (0, _react.useState)((0, _ms.default)(+((_data$passport2 = data.passport) === null || _data$passport2 === void 0 ? void 0 : _data$passport2.ttl) || 0));
|
|
53
|
+
const editIndex = trustedFactories.findIndex(x => x.factoryAddress === data.factoryAddress);
|
|
54
|
+
const configTrustedFactories = async () => {
|
|
55
|
+
if (loading) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const item = {
|
|
59
|
+
factoryAddress,
|
|
60
|
+
remark,
|
|
61
|
+
passport: {
|
|
62
|
+
role,
|
|
63
|
+
ttl: (0, _ms.default)(ttl)
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const trustedList = [...trustedFactories];
|
|
67
|
+
if (editIndex === -1) {
|
|
68
|
+
trustedList.unshift(item);
|
|
69
|
+
} else {
|
|
70
|
+
trustedList[editIndex] = item;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
setLoading(true);
|
|
74
|
+
await api.configTrustedFactories({
|
|
75
|
+
input: {
|
|
76
|
+
teamDid,
|
|
77
|
+
trustedFactories: trustedList
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
await (0, _util.sleep)(800);
|
|
81
|
+
setLoading(false);
|
|
82
|
+
_toast.default.success(t('common.saveSuccess'));
|
|
83
|
+
onSuccess();
|
|
84
|
+
} catch (err) {
|
|
85
|
+
console.error(err);
|
|
86
|
+
setLoading(false);
|
|
87
|
+
_toast.default.error((0, _util.formatError)(err));
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
91
|
+
title: t('team.passport.trustedFactories'),
|
|
92
|
+
open: true,
|
|
93
|
+
showCloseButton: false,
|
|
94
|
+
PaperProps: {
|
|
95
|
+
style: {
|
|
96
|
+
minHeight: '80vh'
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
fullWidth: true,
|
|
100
|
+
prepend: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
101
|
+
onClick: onCancel,
|
|
102
|
+
"data-cy": "close-trusted-factory",
|
|
103
|
+
size: "large",
|
|
104
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowBack.default, {})
|
|
105
|
+
}),
|
|
106
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
107
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
108
|
+
onClick: onCancel,
|
|
109
|
+
color: "inherit",
|
|
110
|
+
children: t('common.cancel')
|
|
111
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
112
|
+
onClick: () => configTrustedFactories(),
|
|
113
|
+
color: "primary",
|
|
114
|
+
disabled: !factoryAddress || !remark || !role || loading,
|
|
115
|
+
variant: "contained",
|
|
116
|
+
autoFocus: true,
|
|
117
|
+
"data-cy": "save-trusted-factory",
|
|
118
|
+
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
119
|
+
size: 16
|
|
120
|
+
}), t('common.save')]
|
|
121
|
+
})]
|
|
122
|
+
}),
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Div, {
|
|
124
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
125
|
+
className: "dialog-content",
|
|
126
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
127
|
+
fullWidth: true,
|
|
128
|
+
"data-cy": "input-factory-address",
|
|
129
|
+
label: t('team.passport.factoryAddress'),
|
|
130
|
+
helperText: t('team.passport.factoryAddressTip'),
|
|
131
|
+
value: factoryAddress,
|
|
132
|
+
onChange: e => {
|
|
133
|
+
setFactoryAddress(e.target.value);
|
|
134
|
+
}
|
|
135
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
136
|
+
style: {
|
|
137
|
+
marginTop: 32
|
|
138
|
+
},
|
|
139
|
+
fullWidth: true,
|
|
140
|
+
"data-cy": "input-factory-remark",
|
|
141
|
+
label: t('common.remark'),
|
|
142
|
+
value: remark,
|
|
143
|
+
onChange: e => {
|
|
144
|
+
setRemark(e.target.value);
|
|
145
|
+
}
|
|
146
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
147
|
+
style: {
|
|
148
|
+
marginTop: 32
|
|
149
|
+
},
|
|
150
|
+
fullWidth: true,
|
|
151
|
+
"data-cy": "input-passport-role",
|
|
152
|
+
label: t('team.passport.role'),
|
|
153
|
+
select: true,
|
|
154
|
+
value: role,
|
|
155
|
+
onChange: e => {
|
|
156
|
+
setRole(e.target.value);
|
|
157
|
+
},
|
|
158
|
+
variant: "outlined",
|
|
159
|
+
children: roles.filter(d => d.name !== 'owner').map(r => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
160
|
+
value: r.name,
|
|
161
|
+
"data-cy": "passport-role-select-option-".concat(r.name),
|
|
162
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
163
|
+
children: r.title || r.name
|
|
164
|
+
})
|
|
165
|
+
}, r.name))
|
|
166
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
167
|
+
style: {
|
|
168
|
+
marginTop: 32
|
|
169
|
+
},
|
|
170
|
+
fullWidth: true,
|
|
171
|
+
type: "text",
|
|
172
|
+
"data-cy": "input-passport-ttl",
|
|
173
|
+
label: t('team.passport.ttl'),
|
|
174
|
+
helperText: t('team.passport.ttlTip'),
|
|
175
|
+
value: ttl,
|
|
176
|
+
onChange: e => {
|
|
177
|
+
setTtl(e.target.value);
|
|
178
|
+
}
|
|
179
|
+
})]
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
TrustedFactory.propTypes = {
|
|
185
|
+
onCancel: _propTypes.default.func.isRequired,
|
|
186
|
+
onSuccess: _propTypes.default.func.isRequired,
|
|
187
|
+
trustedFactories: _propTypes.default.array,
|
|
188
|
+
data: _propTypes.default.object
|
|
189
|
+
};
|
|
190
|
+
TrustedFactory.defaultProps = {
|
|
191
|
+
data: {},
|
|
192
|
+
trustedFactories: []
|
|
193
|
+
};
|
|
194
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .dialog-h1 {\n font-size: 18px;\n }\n\n .list {\n .MuiIconButton-root {\n svg {\n fill: #bfbfbf;\n }\n }\n }\n"])));
|
|
@@ -271,7 +271,7 @@ function TrustedIssuer(_ref) {
|
|
|
271
271
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteIcon.default, {})
|
|
272
272
|
})
|
|
273
273
|
})]
|
|
274
|
-
})), !mappings.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
274
|
+
}, "mapping-".concat(index))), !mappings.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
275
275
|
my: 2,
|
|
276
276
|
color: "text.secondary",
|
|
277
277
|
fontSize: "16px",
|
|
@@ -294,4 +294,4 @@ TrustedIssuer.defaultProps = {
|
|
|
294
294
|
data: {},
|
|
295
295
|
trustedPassports: []
|
|
296
296
|
};
|
|
297
|
-
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .dialog-h1 {\n font-size: 18px;\n }\n\n .
|
|
297
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .dialog-h1 {\n font-size: 18px;\n }\n\n .list {\n .MuiIconButton-root {\n svg {\n fill: #bfbfbf;\n }\n }\n }\n"])));
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = TrustedIssuersWithPermission;
|
|
7
|
-
var _react = require("react");
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
@@ -31,6 +31,8 @@ var _trustedIssuer = _interopRequireDefault(require("./trusted-issuer"));
|
|
|
31
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
32
|
var _templateObject;
|
|
33
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
|
+
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); }
|
|
35
|
+
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; }
|
|
34
36
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
35
37
|
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; }
|
|
36
38
|
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; }
|
|
@@ -182,7 +184,9 @@ function TrustedIssuers(_ref) {
|
|
|
182
184
|
"data-cy": "delete-mapping-rule",
|
|
183
185
|
onClick: () => setDelConfirm({
|
|
184
186
|
title: t('common.delete'),
|
|
185
|
-
description: t('common.delConfirmDescription'
|
|
187
|
+
description: t('common.delConfirmDescription', {
|
|
188
|
+
data: x.issuerDid
|
|
189
|
+
}),
|
|
186
190
|
confirm: t('common.delConfirm'),
|
|
187
191
|
cancel: t('common.cancel'),
|
|
188
192
|
onConfirm: () => deleteTrustedIssuer(x.issuerDid),
|
|
@@ -195,7 +199,7 @@ function TrustedIssuers(_ref) {
|
|
|
195
199
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteIcon.default, {})
|
|
196
200
|
})]
|
|
197
201
|
})]
|
|
198
|
-
})), !trustedPassports.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
202
|
+
}, x.issuerDid)), !trustedPassports.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
199
203
|
children: t('common.empty')
|
|
200
204
|
})]
|
|
201
205
|
})]
|
package/lib/util/index.js
CHANGED
|
@@ -28,7 +28,7 @@ exports.getBlockletUrls = getBlockletUrls;
|
|
|
28
28
|
exports.getExplorerLink = getExplorerLink;
|
|
29
29
|
exports.getPathPrefix = exports.getIssuePassportLink = exports.getInviteLink = void 0;
|
|
30
30
|
exports.getRelativeTime = getRelativeTime;
|
|
31
|
-
exports.getStoreList = void 0;
|
|
31
|
+
exports.getTransferAppLink = exports.getStoreList = void 0;
|
|
32
32
|
exports.getWebWalletUrl = getWebWalletUrl;
|
|
33
33
|
exports.isNewStoreUrl = exports.isInstalling = exports.isDownloading = exports.isChrome = exports.isCertificateMatch = exports.isBlockletDev = void 0;
|
|
34
34
|
exports.isProtectedRole = isProtectedRole;
|
|
@@ -384,15 +384,29 @@ const getInviteLink = _ref2 => {
|
|
|
384
384
|
return u.href;
|
|
385
385
|
};
|
|
386
386
|
exports.getInviteLink = getInviteLink;
|
|
387
|
-
const
|
|
387
|
+
const getTransferAppLink = _ref3 => {
|
|
388
388
|
let {
|
|
389
|
-
|
|
389
|
+
transferId,
|
|
390
390
|
endpoint
|
|
391
391
|
} = _ref3;
|
|
392
392
|
if (!endpoint) {
|
|
393
393
|
return '';
|
|
394
394
|
}
|
|
395
395
|
const u = new URL(endpoint);
|
|
396
|
+
u.pathname = (0, _urlJoin.default)(u.pathname, _constant.WELLKNOWN_SERVICE_PATH_PREFIX, 'transfer');
|
|
397
|
+
u.searchParams.set('transferId', transferId);
|
|
398
|
+
return u.href;
|
|
399
|
+
};
|
|
400
|
+
exports.getTransferAppLink = getTransferAppLink;
|
|
401
|
+
const getIssuePassportLink = _ref4 => {
|
|
402
|
+
let {
|
|
403
|
+
id,
|
|
404
|
+
endpoint
|
|
405
|
+
} = _ref4;
|
|
406
|
+
if (!endpoint) {
|
|
407
|
+
return '';
|
|
408
|
+
}
|
|
409
|
+
const u = new URL(endpoint);
|
|
396
410
|
u.pathname = (0, _urlJoin.default)(u.pathname, _constant.WELLKNOWN_SERVICE_PATH_PREFIX, 'issue-passport');
|
|
397
411
|
u.searchParams.set('id', id);
|
|
398
412
|
return u.href;
|
|
@@ -457,12 +471,12 @@ function formatFactoryPrice(blocklet) {
|
|
|
457
471
|
}));
|
|
458
472
|
return list;
|
|
459
473
|
}
|
|
460
|
-
const getBlockletLogoUrl =
|
|
474
|
+
const getBlockletLogoUrl = _ref5 => {
|
|
461
475
|
let {
|
|
462
476
|
did,
|
|
463
477
|
baseUrl,
|
|
464
478
|
logoPath
|
|
465
|
-
} =
|
|
479
|
+
} = _ref5;
|
|
466
480
|
if (logoPath && logoPath.startsWith('http')) {
|
|
467
481
|
return logoPath;
|
|
468
482
|
}
|
|
@@ -658,13 +672,13 @@ const toSlotDomain = domain => {
|
|
|
658
672
|
return domain;
|
|
659
673
|
};
|
|
660
674
|
exports.toSlotDomain = toSlotDomain;
|
|
661
|
-
const getStoreList =
|
|
675
|
+
const getStoreList = _ref6 => {
|
|
662
676
|
var _blocklet$meta, _blocklet$settings;
|
|
663
677
|
let {
|
|
664
678
|
fromBlocklet,
|
|
665
679
|
nodeInfo,
|
|
666
680
|
blocklet
|
|
667
|
-
} =
|
|
681
|
+
} = _ref6;
|
|
668
682
|
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;
|
|
669
683
|
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) || [];
|
|
670
684
|
return {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.
|
|
6
|
+
"version": "1.16.6-beta-8be2fe37",
|
|
7
7
|
"description": "UX components shared across abtnode packages",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@abtnode/auth": "1.16.
|
|
26
|
-
"@abtnode/constant": "1.16.
|
|
27
|
-
"@abtnode/util": "1.16.
|
|
28
|
-
"@arcblock/did-connect": "^2.5.
|
|
25
|
+
"@abtnode/auth": "1.16.6-beta-8be2fe37",
|
|
26
|
+
"@abtnode/constant": "1.16.6-beta-8be2fe37",
|
|
27
|
+
"@abtnode/util": "1.16.6-beta-8be2fe37",
|
|
28
|
+
"@arcblock/did-connect": "^2.5.25",
|
|
29
29
|
"@arcblock/did-motif": "^1.1.10",
|
|
30
|
-
"@arcblock/icons": "^2.5.
|
|
31
|
-
"@arcblock/react-hooks": "^2.5.
|
|
32
|
-
"@arcblock/terminal": "^2.5.
|
|
33
|
-
"@arcblock/ux": "^2.5.
|
|
34
|
-
"@blocklet/constant": "1.16.
|
|
35
|
-
"@blocklet/launcher-layout": "^2.0.
|
|
30
|
+
"@arcblock/icons": "^2.5.25",
|
|
31
|
+
"@arcblock/react-hooks": "^2.5.25",
|
|
32
|
+
"@arcblock/terminal": "^2.5.25",
|
|
33
|
+
"@arcblock/ux": "^2.5.25",
|
|
34
|
+
"@blocklet/constant": "1.16.6-beta-8be2fe37",
|
|
35
|
+
"@blocklet/launcher-layout": "^2.0.30",
|
|
36
36
|
"@blocklet/list": "^0.11.18",
|
|
37
|
-
"@blocklet/meta": "1.16.
|
|
38
|
-
"@blocklet/ui-react": "^2.5.
|
|
37
|
+
"@blocklet/meta": "1.16.6-beta-8be2fe37",
|
|
38
|
+
"@blocklet/ui-react": "^2.5.25",
|
|
39
39
|
"@emotion/react": "^11.10.4",
|
|
40
40
|
"@emotion/styled": "^11.10.4",
|
|
41
41
|
"@iconify/react": "^4.0.0",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"lodash": "^4.17.21",
|
|
62
62
|
"md5": "^2.3.0",
|
|
63
63
|
"moment": "^2.29.4",
|
|
64
|
+
"ms": "^2.1.3",
|
|
64
65
|
"nanoid": "^4.0.0",
|
|
65
66
|
"notistack": "2.0.5",
|
|
66
67
|
"p-wait-for": "^4.1.0",
|
|
@@ -89,5 +90,5 @@
|
|
|
89
90
|
"@babel/preset-react": "^7.18.6",
|
|
90
91
|
"babel-plugin-inline-react-svg": "^1.1.2"
|
|
91
92
|
},
|
|
92
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "27229a1a62850e95907b7a53e0259a809d99377b"
|
|
93
94
|
}
|