@abtnode/ux 1.16.14-beta-c308dc3b → 1.16.14-beta-963cb583
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/es/actions.js +97 -0
- package/es/analytics/card.js +92 -0
- package/es/analytics/chart.js +96 -0
- package/es/analytics/cpu.js +36 -0
- package/es/analytics/disk.js +111 -0
- package/es/analytics/memory.js +72 -0
- package/es/analytics/runtime.js +173 -0
- package/es/analytics/traffic.js +259 -0
- package/es/blocklet/access/config-access.js +307 -0
- package/es/blocklet/access/index.js +216 -0
- package/es/blocklet/actions.js +474 -0
- package/es/blocklet/add-cert.js +177 -0
- package/es/blocklet/agreement-app.js +21 -0
- package/es/blocklet/agreement.js +127 -0
- package/es/blocklet/app-avatar.js +57 -0
- package/es/blocklet/audit-logs.js +259 -0
- package/es/blocklet/blocklet-source.js +48 -0
- package/es/blocklet/bundle-avatar.js +64 -0
- package/es/blocklet/component/add.js +1313 -0
- package/es/blocklet/component/configuration.js +122 -0
- package/es/blocklet/component/delete.js +134 -0
- package/es/blocklet/component/environment.js +370 -0
- package/es/blocklet/component/index.js +975 -0
- package/es/blocklet/component/line.js +20 -0
- package/es/blocklet/component/navigation/locale-tabs.js +225 -0
- package/es/blocklet/component/navigation/navigation-actions.js +112 -0
- package/es/blocklet/component/navigation/navigation-dialog.js +607 -0
- package/es/blocklet/component/navigation/navigation-preview.js +101 -0
- package/es/blocklet/component/navigation/simple-select.js +124 -0
- package/es/blocklet/component/select-store.js +155 -0
- package/es/blocklet/component/selected/index.js +94 -0
- package/es/blocklet/component/setting.js +109 -0
- package/es/blocklet/component/sortable-tree.js +126 -0
- package/es/blocklet/component/space-connector.js +199 -0
- package/es/blocklet/component/space-selector.js +178 -0
- package/es/blocklet/component/start.js +101 -0
- package/es/blocklet/component/store-blocklet-list.js +200 -0
- package/es/blocklet/component/switch-control.js +57 -0
- package/es/blocklet/config-navigation.js +331 -0
- package/es/blocklet/configuration.js +603 -0
- package/es/blocklet/disk-info.js +75 -0
- package/es/blocklet/icons.js +18 -0
- package/es/blocklet/install-from-url.js +337 -0
- package/es/blocklet/log.js +90 -0
- package/es/blocklet/migration.js +149 -0
- package/es/blocklet/mode.js +19 -0
- package/es/blocklet/notification/email.js +257 -0
- package/es/blocklet/notification/index.js +49 -0
- package/es/blocklet/oauth/auth0.js +145 -0
- package/es/blocklet/oauth/common-settings.js +133 -0
- package/es/blocklet/oauth/federated-detail-dialog.js +175 -0
- package/es/blocklet/oauth/federated-invite-dialog.js +83 -0
- package/es/blocklet/oauth/federated-join-dialog.js +111 -0
- package/es/blocklet/oauth/federated-site-list.js +338 -0
- package/es/blocklet/oauth/federated.js +81 -0
- package/es/blocklet/oauth/index.js +69 -0
- package/es/blocklet/overview.js +293 -0
- package/es/blocklet/page-group.js +19 -0
- package/es/blocklet/preferences/app-sk.js +142 -0
- package/es/blocklet/preferences/index.js +305 -0
- package/es/blocklet/purchase/common.js +95 -0
- package/es/blocklet/purchase/component-purchase.js +237 -0
- package/es/blocklet/purchase/index.js +4 -0
- package/es/blocklet/router/action/add-domain-alias.js +167 -0
- package/es/blocklet/router/action/add-rule.js +211 -0
- package/es/blocklet/router/action/config-routing-rule.js +232 -0
- package/es/blocklet/router/action/delete-domain-alias.js +99 -0
- package/es/blocklet/router/action/delete-rule.js +108 -0
- package/es/blocklet/router/action/update-rule.js +209 -0
- package/es/blocklet/router/domain-actions.js +64 -0
- package/es/blocklet/router/domain-status.js +88 -0
- package/es/blocklet/router/rule-actions.js +66 -0
- package/es/blocklet/router/rule-list.js +190 -0
- package/es/blocklet/router/util.js +131 -0
- package/es/blocklet/runtime-info.js +68 -0
- package/es/blocklet/status.js +91 -0
- package/es/blocklet/storage/action.js +134 -0
- package/es/blocklet/storage/backups.js +241 -0
- package/es/blocklet/storage/connect-to.js +372 -0
- package/es/blocklet/storage/connected.js +198 -0
- package/es/blocklet/storage/delete.js +113 -0
- package/es/blocklet/storage/disconnect.js +243 -0
- package/es/blocklet/storage/index.js +19 -0
- package/es/blocklet/storage/item.js +558 -0
- package/es/blocklet/storage/preview-nft.js +286 -0
- package/es/blocklet/transfer-owner.js +198 -0
- package/es/blocklet/types.js +18 -0
- package/es/blocklet/util.js +145 -0
- package/es/blocklet/version.js +141 -0
- package/es/card-selector.js +134 -0
- package/es/certificate.js +105 -0
- package/es/chain.js +13 -0
- package/es/click-to-copy.js +22 -0
- package/es/confirm.js +149 -0
- package/es/contexts/audit-log.js +152 -0
- package/es/contexts/blocklet.js +10 -0
- package/es/contexts/deleting-blocklets.js +70 -0
- package/es/contexts/node.js +17 -0
- package/es/contexts/session.js +8 -0
- package/es/contexts/team.js +10 -0
- package/es/delete-confirm.js +121 -0
- package/es/did-address.js +46 -0
- package/es/dot.js +14 -0
- package/es/exchange-passport.js +102 -0
- package/es/form/form-select-input.js +184 -0
- package/es/form/form-text-input.js +178 -0
- package/es/form/form-wrapper.js +88 -0
- package/es/form/input-triggers.js +98 -0
- package/es/form/required.js +8 -0
- package/es/hooks/blocklet.js +229 -0
- package/es/hooks/confirm.js +90 -0
- package/es/hooks/mobile-width.js +11 -0
- package/es/hooks/url-evaluation.js +155 -0
- package/es/hooks/use-app-logo.js +16 -0
- package/es/hooks/use-backup-progress.js +31 -0
- package/es/hooks/use-blocklet-info-for-connect-did-spaces.js +50 -0
- package/es/hooks/use-bundle-logo.js +27 -0
- package/es/hooks/use-navigation.js +347 -0
- package/es/hooks/use-passport-id.js +14 -0
- package/es/hooks/use-subscription.js +22 -0
- package/es/icons/empty-space-nft.svg +59 -0
- package/es/icons/empty-spaces-nft.svg +58 -0
- package/es/icons/long-arrow.svg +5 -0
- package/es/icons/space-connected.svg +3 -0
- package/es/icons/space-disconnect.svg +3 -0
- package/es/index.js +3 -0
- package/es/invitation/invitation-app.js +58 -0
- package/es/invitation/invitation-login.js +68 -0
- package/es/invitation/invitation-passport.js +146 -0
- package/es/invitation/invitation-receive.js +138 -0
- package/es/invitation/invitation-success.js +93 -0
- package/es/invitation/invitation-user.js +90 -0
- package/es/invitation/invitation.js +90 -0
- package/es/issue-passport.js +142 -0
- package/es/launch-blocklet/content-layout.js +58 -0
- package/es/launch-blocklet/page-header.js +43 -0
- package/es/layout/addon.js +114 -0
- package/es/layout/feedback.js +55 -0
- package/es/locales/en.js +1541 -0
- package/es/locales/index.js +9 -0
- package/es/locales/zh.js +1544 -0
- package/es/logs/clock.js +11 -0
- package/es/logs/download.js +132 -0
- package/es/logs/log-terminal.js +253 -0
- package/es/lost-passport.js +452 -0
- package/es/nav-logo.js +219 -0
- package/es/passport-tag.js +43 -0
- package/es/permission.js +57 -0
- package/es/relative-time.js +53 -0
- package/es/result-message.js +11 -0
- package/es/schema-form/color-input.js +98 -0
- package/es/schema-form/common-prop-types.js +13 -0
- package/es/schema-form/index.js +215 -0
- package/es/schema-form/passport-input.js +55 -0
- package/es/schema-form/text-input.js +57 -0
- package/es/store/add.js +179 -0
- package/es/store/delete.js +96 -0
- package/es/store/item.js +76 -0
- package/es/subscription.js +144 -0
- package/es/table-icons.js +34 -0
- package/es/table.js +52 -0
- package/es/tag.js +21 -0
- package/es/team/members/actions.js +89 -0
- package/es/team/members/index.js +636 -0
- package/es/team/members/invitations.js +188 -0
- package/es/team/members/invite-member.js +208 -0
- package/es/team/members/issue-passport.js +152 -0
- package/es/team/members/member.js +408 -0
- package/es/team/members/passport-issuances.js +155 -0
- package/es/team/members/passports.js +364 -0
- package/es/team/members/toggle-user-approval.js +122 -0
- package/es/team/members/transfer-node.js +256 -0
- package/es/team/members/util.js +14 -0
- package/es/team/passports/color.js +127 -0
- package/es/team/passports/detail.js +312 -0
- package/es/team/passports/index.js +282 -0
- package/es/team/passports/mutate-role.js +198 -0
- package/es/team/passports/trusted-factories.js +221 -0
- package/es/team/passports/trusted-factory.js +343 -0
- package/es/team/passports/trusted-issuer.js +296 -0
- package/es/team/passports/trusted-issuers.js +226 -0
- package/es/team/search-input.js +46 -0
- package/es/team/styles/dialog.js +72 -0
- package/es/team/styles/list-header.js +31 -0
- package/es/util/api.js +6 -0
- package/es/util/constants.js +2 -0
- package/es/util/index.js +598 -0
- package/es/util/mode.js +4 -0
- package/es/util/space-gateway.js +51 -0
- package/es/util/spaces.js +160 -0
- package/es/who-can-access/config.js +38 -0
- package/es/wrap-locale.js +15 -0
- package/lib/blocklet/component/add.js +5 -0
- package/lib/blocklet/component/selected/index.js +47 -0
- package/lib/blocklet/component/space-connector.js +1 -1
- package/lib/blocklet/component/space-selector.js +1 -1
- package/lib/blocklet/storage/backups.js +1 -1
- package/lib/blocklet/storage/connect-to.js +6 -7
- package/lib/blocklet/storage/connected.js +1 -1
- package/lib/blocklet/storage/disconnect.js +1 -1
- package/lib/blocklet/storage/index.js +1 -1
- package/lib/blocklet/storage/item.js +1 -1
- package/lib/card-selector.js +14 -14
- package/lib/invitation/invitation-passport.js +7 -6
- package/lib/invitation/invitation-receive.js +1 -1
- package/lib/locales/en.js +12 -5
- package/lib/locales/zh.js +10 -3
- package/lib/lost-passport.js +2 -2
- package/lib/schema-form/passport-input.js +12 -11
- package/lib/team/passports/color.js +14 -14
- package/lib/team/passports/trusted-factory.js +1 -1
- package/lib/util/spaces.js +13 -1
- package/package.json +88 -21
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
+
import { useContext, useState } from 'react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
|
+
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
8
|
+
import Empty from '@arcblock/ux/lib/Empty';
|
|
9
|
+
import Datatable from '@arcblock/ux/lib/Datatable';
|
|
10
|
+
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
|
11
|
+
import { useNodeContext } from '../../contexts/node';
|
|
12
|
+
import { useTeamContext } from '../../contexts/team';
|
|
13
|
+
import Confirm from '../../confirm';
|
|
14
|
+
import Permission from '../../permission';
|
|
15
|
+
import ClickToCopy from '../../click-to-copy';
|
|
16
|
+
import { sleep, getInviteLink, BlockletAdminRoles } from '../../util';
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
export default function Invitations() {
|
|
20
|
+
const {
|
|
21
|
+
api: client,
|
|
22
|
+
inService
|
|
23
|
+
} = useNodeContext();
|
|
24
|
+
const {
|
|
25
|
+
t,
|
|
26
|
+
locale
|
|
27
|
+
} = useContext(LocaleContext);
|
|
28
|
+
const {
|
|
29
|
+
teamDid,
|
|
30
|
+
invitations,
|
|
31
|
+
refresh,
|
|
32
|
+
endpoint
|
|
33
|
+
} = useTeamContext();
|
|
34
|
+
const [delConfirm, setDelConfirm] = useState(null);
|
|
35
|
+
const [loading, setLoading] = useState(false);
|
|
36
|
+
const deleteInvitation = async ({
|
|
37
|
+
inviteId
|
|
38
|
+
}) => {
|
|
39
|
+
if (loading) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
setLoading(true);
|
|
43
|
+
try {
|
|
44
|
+
await client.deleteInvitation({
|
|
45
|
+
input: {
|
|
46
|
+
teamDid,
|
|
47
|
+
inviteId
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
refresh();
|
|
51
|
+
await sleep(800);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error(error);
|
|
54
|
+
} finally {
|
|
55
|
+
setLoading(false);
|
|
56
|
+
setDelConfirm(null);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const onCancel = () => {
|
|
60
|
+
setLoading(false);
|
|
61
|
+
setDelConfirm(null);
|
|
62
|
+
};
|
|
63
|
+
const getLink = column => {
|
|
64
|
+
if (!endpoint) {
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
return getInviteLink({
|
|
68
|
+
inviteId: column.inviteId,
|
|
69
|
+
endpoint
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const columns = [{
|
|
73
|
+
label: t('team.inviting.link'),
|
|
74
|
+
name: 'inviteId',
|
|
75
|
+
options: {
|
|
76
|
+
sort: false,
|
|
77
|
+
customBodyRenderLite: rawIndex => {
|
|
78
|
+
const d = invitations[rawIndex];
|
|
79
|
+
if (!endpoint) {
|
|
80
|
+
return /*#__PURE__*/_jsx(CircularProgress, {
|
|
81
|
+
size: 16
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/_jsx(ClickToCopy, {
|
|
85
|
+
children: getLink(d)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
label: t('common.role'),
|
|
91
|
+
name: 'role',
|
|
92
|
+
widtn: 70
|
|
93
|
+
}, {
|
|
94
|
+
label: t('common.remark'),
|
|
95
|
+
name: 'remark',
|
|
96
|
+
options: {
|
|
97
|
+
customBodyRender: e => {
|
|
98
|
+
return e || '--';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
label: t('team.inviting.inviter'),
|
|
103
|
+
name: 'inviter.fullName',
|
|
104
|
+
options: {
|
|
105
|
+
sort: false,
|
|
106
|
+
customBodyRender: (e, {
|
|
107
|
+
rowIndex
|
|
108
|
+
}) => {
|
|
109
|
+
const d = invitations[rowIndex];
|
|
110
|
+
return d?.inviter?.fullName;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
label: t('common.expires'),
|
|
115
|
+
name: 'expireDate',
|
|
116
|
+
options: {
|
|
117
|
+
customBodyRender: e => {
|
|
118
|
+
return /*#__PURE__*/_jsx(RelativeTime, {
|
|
119
|
+
value: e,
|
|
120
|
+
locale: locale
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
label: t('common.actions'),
|
|
126
|
+
name: '',
|
|
127
|
+
width: 100,
|
|
128
|
+
align: 'center',
|
|
129
|
+
options: {
|
|
130
|
+
sort: false,
|
|
131
|
+
customBodyRenderLite: rawIndex => {
|
|
132
|
+
const item = invitations[rawIndex];
|
|
133
|
+
return /*#__PURE__*/_jsx(Permission, {
|
|
134
|
+
permission: inService ? '' : 'mutate_team',
|
|
135
|
+
role: inService ? BlockletAdminRoles : [],
|
|
136
|
+
children: /*#__PURE__*/_jsxs(Button, {
|
|
137
|
+
onClick: () => setDelConfirm({
|
|
138
|
+
title: t('team.inviting.delete.title'),
|
|
139
|
+
description: t('team.inviting.delete.description', {
|
|
140
|
+
link: getLink(item)
|
|
141
|
+
}),
|
|
142
|
+
confirm: t('common.delConfirm'),
|
|
143
|
+
cancel: t('common.cancel'),
|
|
144
|
+
onConfirm: () => deleteInvitation(item),
|
|
145
|
+
onCancel
|
|
146
|
+
}),
|
|
147
|
+
size: "small",
|
|
148
|
+
color: "error",
|
|
149
|
+
variant: "text",
|
|
150
|
+
children: [/*#__PURE__*/_jsx(DeleteIcon, {
|
|
151
|
+
style: {
|
|
152
|
+
fontSize: '1.2em'
|
|
153
|
+
}
|
|
154
|
+
}), t('common.delete')]
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}];
|
|
160
|
+
return /*#__PURE__*/_jsxs(Div, {
|
|
161
|
+
children: [invitations.length ? /*#__PURE__*/_jsx(Datatable, {
|
|
162
|
+
locale: locale,
|
|
163
|
+
data: [...invitations],
|
|
164
|
+
columns: columns,
|
|
165
|
+
verticalKeyWidth: 100,
|
|
166
|
+
options: {
|
|
167
|
+
download: false,
|
|
168
|
+
filter: false,
|
|
169
|
+
print: false
|
|
170
|
+
}
|
|
171
|
+
}) : /*#__PURE__*/_jsx(Empty, {
|
|
172
|
+
children: t('common.empty')
|
|
173
|
+
}), delConfirm && /*#__PURE__*/_jsx(Confirm, {
|
|
174
|
+
title: delConfirm.title,
|
|
175
|
+
description: delConfirm.description,
|
|
176
|
+
confirm: delConfirm.confirm,
|
|
177
|
+
cancel: delConfirm.cancel,
|
|
178
|
+
params: delConfirm.params,
|
|
179
|
+
onConfirm: delConfirm.onConfirm,
|
|
180
|
+
onCancel: delConfirm.onCancel
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const Div = styled.div`
|
|
185
|
+
margin-top: -20px;
|
|
186
|
+
`;
|
|
187
|
+
Invitations.propTypes = {};
|
|
188
|
+
Invitations.defaultProps = {};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
5
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
6
|
+
import DialogContentText from '@mui/material/DialogContentText';
|
|
7
|
+
import Typography from '@mui/material/Typography';
|
|
8
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
9
|
+
import Select from '@mui/material/Select';
|
|
10
|
+
import TextField from '@mui/material/TextField';
|
|
11
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
12
|
+
import FormControl from '@mui/material/FormControl';
|
|
13
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
14
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
15
|
+
import Alert from '@arcblock/ux/lib/Alert';
|
|
16
|
+
import ClickToCopy from '../../click-to-copy';
|
|
17
|
+
import { useNodeContext } from '../../contexts/node';
|
|
18
|
+
import { formatError, getInviteLink, formatToDatetime } from '../../util';
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
+
export default function InviteMember({
|
|
23
|
+
teamDid,
|
|
24
|
+
roles,
|
|
25
|
+
onCancel,
|
|
26
|
+
onSuccess,
|
|
27
|
+
onError,
|
|
28
|
+
endpoint
|
|
29
|
+
}) {
|
|
30
|
+
const {
|
|
31
|
+
api
|
|
32
|
+
} = useNodeContext();
|
|
33
|
+
const [loading, setLoading] = useState(false);
|
|
34
|
+
const [error, setError] = useState('');
|
|
35
|
+
const {
|
|
36
|
+
t,
|
|
37
|
+
locale
|
|
38
|
+
} = useLocaleContext();
|
|
39
|
+
const [activeStep, setActiveStep] = useState(0);
|
|
40
|
+
const [inviteInfo, setInviteInfo] = useState('');
|
|
41
|
+
const [role, setRole] = useState('');
|
|
42
|
+
const [remark, setRemark] = useState('');
|
|
43
|
+
const onCreate = async () => {
|
|
44
|
+
if (!role) {
|
|
45
|
+
setError(t('team.member.error.passportEmpty'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const trimRemark = remark.trim();
|
|
49
|
+
setError(null);
|
|
50
|
+
setLoading(true);
|
|
51
|
+
try {
|
|
52
|
+
const {
|
|
53
|
+
inviteInfo: info
|
|
54
|
+
} = await api.createMemberInvitation({
|
|
55
|
+
input: {
|
|
56
|
+
teamDid,
|
|
57
|
+
role,
|
|
58
|
+
remark: trimRemark
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
setInviteInfo(info);
|
|
62
|
+
setActiveStep(1);
|
|
63
|
+
} catch (err) {
|
|
64
|
+
const errMsg = formatError(err);
|
|
65
|
+
setError(errMsg);
|
|
66
|
+
onError(err);
|
|
67
|
+
} finally {
|
|
68
|
+
setLoading(false);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const steps = [{
|
|
72
|
+
body: /*#__PURE__*/_jsxs(Typography, {
|
|
73
|
+
component: "div",
|
|
74
|
+
children: [/*#__PURE__*/_jsxs(FormControl, {
|
|
75
|
+
style: {
|
|
76
|
+
width: '100%'
|
|
77
|
+
},
|
|
78
|
+
variant: "outlined",
|
|
79
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
80
|
+
children: t('common.passport')
|
|
81
|
+
}), /*#__PURE__*/_jsx(Select, {
|
|
82
|
+
"data-cy": "invite-member-select-role",
|
|
83
|
+
value: role,
|
|
84
|
+
onChange: e => {
|
|
85
|
+
setError(null);
|
|
86
|
+
setRole(e.target.value);
|
|
87
|
+
},
|
|
88
|
+
fullWidth: true,
|
|
89
|
+
label: t('common.passport'),
|
|
90
|
+
disabled: loading,
|
|
91
|
+
onKeyPress: e => {
|
|
92
|
+
if (e.key === 'Enter') {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
onCreate();
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
children: roles.filter(d => d.name !== 'owner').map(r => /*#__PURE__*/_jsx(MenuItem, {
|
|
98
|
+
value: r.name,
|
|
99
|
+
"data-cy": `invite-member-select-option-${r.name}`,
|
|
100
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
101
|
+
children: r.title || r.name
|
|
102
|
+
})
|
|
103
|
+
}, r.name))
|
|
104
|
+
})]
|
|
105
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
106
|
+
style: {
|
|
107
|
+
marginTop: 20,
|
|
108
|
+
marginBottom: 10
|
|
109
|
+
}
|
|
110
|
+
}), /*#__PURE__*/_jsx(TextField, {
|
|
111
|
+
label: t('common.remark'),
|
|
112
|
+
autoComplete: "off",
|
|
113
|
+
variant: "outlined",
|
|
114
|
+
fullWidth: true,
|
|
115
|
+
style: {
|
|
116
|
+
marginBottom: 8
|
|
117
|
+
},
|
|
118
|
+
value: remark,
|
|
119
|
+
onChange: e => {
|
|
120
|
+
setError(null);
|
|
121
|
+
setRemark(e.target.value);
|
|
122
|
+
},
|
|
123
|
+
disabled: loading,
|
|
124
|
+
"data-cy": "invite-member-input-remark"
|
|
125
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
126
|
+
style: {
|
|
127
|
+
marginTop: 20,
|
|
128
|
+
marginBottom: 10
|
|
129
|
+
}
|
|
130
|
+
})]
|
|
131
|
+
}),
|
|
132
|
+
cancel: t('common.cancel'),
|
|
133
|
+
confirm: t('team.member.inviteDialog.createInviteLink'),
|
|
134
|
+
onCancel,
|
|
135
|
+
onConfirm: onCreate
|
|
136
|
+
}, {
|
|
137
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
138
|
+
body: () => {
|
|
139
|
+
const link = getInviteLink({
|
|
140
|
+
inviteId: inviteInfo.inviteId,
|
|
141
|
+
endpoint
|
|
142
|
+
});
|
|
143
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
144
|
+
children: [/*#__PURE__*/_jsx(Bold, {
|
|
145
|
+
children: t('team.member.inviteDialog.createSuccessTip', {
|
|
146
|
+
expireDate: formatToDatetime(inviteInfo.expireDate, locale)
|
|
147
|
+
})
|
|
148
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
149
|
+
style: {
|
|
150
|
+
marginTop: '40px'
|
|
151
|
+
}
|
|
152
|
+
}), /*#__PURE__*/_jsx(ClickToCopy, {
|
|
153
|
+
children: link
|
|
154
|
+
})]
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
confirm: t('common.confirm'),
|
|
158
|
+
onConfirm: onSuccess
|
|
159
|
+
}];
|
|
160
|
+
const step = steps[activeStep];
|
|
161
|
+
return /*#__PURE__*/_jsxs(Dialog, {
|
|
162
|
+
title: t('common.invite'),
|
|
163
|
+
fullWidth: true,
|
|
164
|
+
open: true,
|
|
165
|
+
showCloseButton: false,
|
|
166
|
+
actions: /*#__PURE__*/_jsxs(_Fragment, {
|
|
167
|
+
children: [step.cancel && /*#__PURE__*/_jsx(Button, {
|
|
168
|
+
onClick: step.onCancel,
|
|
169
|
+
color: "inherit",
|
|
170
|
+
children: step.cancel
|
|
171
|
+
}), /*#__PURE__*/_jsxs(Button, {
|
|
172
|
+
onClick: step.onConfirm,
|
|
173
|
+
color: "primary",
|
|
174
|
+
disabled: loading || !role,
|
|
175
|
+
variant: "contained",
|
|
176
|
+
autoFocus: true,
|
|
177
|
+
children: [loading && /*#__PURE__*/_jsx(Spinner, {
|
|
178
|
+
size: 16
|
|
179
|
+
}), step.confirm]
|
|
180
|
+
})]
|
|
181
|
+
}),
|
|
182
|
+
children: [/*#__PURE__*/_jsx(DialogContentText, {
|
|
183
|
+
component: "div",
|
|
184
|
+
children: typeof step.body === 'function' ? step.body() : step.body
|
|
185
|
+
}), !!error && /*#__PURE__*/_jsx(Alert, {
|
|
186
|
+
type: "error",
|
|
187
|
+
variant: "icon",
|
|
188
|
+
children: error
|
|
189
|
+
})]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
InviteMember.propTypes = {
|
|
193
|
+
teamDid: PropTypes.string.isRequired,
|
|
194
|
+
onCancel: PropTypes.func.isRequired,
|
|
195
|
+
onSuccess: PropTypes.func.isRequired,
|
|
196
|
+
onError: PropTypes.func,
|
|
197
|
+
roles: PropTypes.array,
|
|
198
|
+
endpoint: PropTypes.string
|
|
199
|
+
};
|
|
200
|
+
InviteMember.defaultProps = {
|
|
201
|
+
onError: () => {},
|
|
202
|
+
roles: [],
|
|
203
|
+
endpoint: ''
|
|
204
|
+
};
|
|
205
|
+
const Bold = styled.div`
|
|
206
|
+
font-size: 16px;
|
|
207
|
+
font-weight: bold;
|
|
208
|
+
`;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
4
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
5
|
+
import DialogContentText from '@mui/material/DialogContentText';
|
|
6
|
+
import Typography from '@mui/material/Typography';
|
|
7
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
8
|
+
import Select from '@mui/material/Select';
|
|
9
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
10
|
+
import FormControl from '@mui/material/FormControl';
|
|
11
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
12
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
13
|
+
import Alert from '@arcblock/ux/lib/Alert';
|
|
14
|
+
import { useNodeContext } from '../../contexts/node';
|
|
15
|
+
import { formatError } from '../../util';
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
export default function IssuePassport({
|
|
20
|
+
teamDid,
|
|
21
|
+
ownerDid,
|
|
22
|
+
needReceive,
|
|
23
|
+
roles,
|
|
24
|
+
onCancel,
|
|
25
|
+
onSuccess,
|
|
26
|
+
onError,
|
|
27
|
+
showOwnerPassport
|
|
28
|
+
}) {
|
|
29
|
+
const {
|
|
30
|
+
api
|
|
31
|
+
} = useNodeContext();
|
|
32
|
+
const [loading, setLoading] = useState(false);
|
|
33
|
+
const [error, setError] = useState('');
|
|
34
|
+
const {
|
|
35
|
+
t
|
|
36
|
+
} = useLocaleContext();
|
|
37
|
+
const [role, setRole] = useState('');
|
|
38
|
+
const onCreate = async () => {
|
|
39
|
+
if (!role) {
|
|
40
|
+
setError(t('team.member.error.passportEmpty'));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setError(null);
|
|
44
|
+
setLoading(true);
|
|
45
|
+
try {
|
|
46
|
+
await api.createPassportIssuance({
|
|
47
|
+
input: {
|
|
48
|
+
teamDid,
|
|
49
|
+
name: role,
|
|
50
|
+
ownerDid
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
onSuccess();
|
|
54
|
+
} catch (err) {
|
|
55
|
+
const errMsg = formatError(err);
|
|
56
|
+
setError(errMsg);
|
|
57
|
+
onError(err);
|
|
58
|
+
} finally {
|
|
59
|
+
setLoading(false);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return /*#__PURE__*/_jsxs(Dialog, {
|
|
63
|
+
title: t('team.passport.issue'),
|
|
64
|
+
fullWidth: true,
|
|
65
|
+
open: true,
|
|
66
|
+
onClick: e => e.stopPropagation(),
|
|
67
|
+
onClose: onCancel,
|
|
68
|
+
disableEscapeKeyDown: true,
|
|
69
|
+
PaperProps: {
|
|
70
|
+
style: {
|
|
71
|
+
minHeight: 'auto'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
actions: /*#__PURE__*/_jsxs(_Fragment, {
|
|
75
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
76
|
+
onClick: onCancel,
|
|
77
|
+
color: "inherit",
|
|
78
|
+
size: "small",
|
|
79
|
+
children: t('common.cancel')
|
|
80
|
+
}), /*#__PURE__*/_jsxs(Button, {
|
|
81
|
+
onClick: onCreate,
|
|
82
|
+
color: "primary",
|
|
83
|
+
size: "small",
|
|
84
|
+
disabled: loading || !role,
|
|
85
|
+
variant: "contained",
|
|
86
|
+
autoFocus: true,
|
|
87
|
+
"data-cy": "issue-passport-create-btn",
|
|
88
|
+
children: [loading && /*#__PURE__*/_jsx(Spinner, {
|
|
89
|
+
size: 16
|
|
90
|
+
}), needReceive ? t('team.passport.issuance.create.title') : t('oauth.issued')]
|
|
91
|
+
})]
|
|
92
|
+
}),
|
|
93
|
+
children: [/*#__PURE__*/_jsx(DialogContentText, {
|
|
94
|
+
component: "div",
|
|
95
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
96
|
+
component: "div",
|
|
97
|
+
children: /*#__PURE__*/_jsxs(FormControl, {
|
|
98
|
+
style: {
|
|
99
|
+
width: '100%'
|
|
100
|
+
},
|
|
101
|
+
variant: "outlined",
|
|
102
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
103
|
+
children: t('common.passport')
|
|
104
|
+
}), /*#__PURE__*/_jsx(Select, {
|
|
105
|
+
"data-cy": "issue-passport-select-passport",
|
|
106
|
+
value: role,
|
|
107
|
+
onChange: e => {
|
|
108
|
+
setError(null);
|
|
109
|
+
setRole(e.target.value);
|
|
110
|
+
},
|
|
111
|
+
fullWidth: true,
|
|
112
|
+
label: t('common.passport'),
|
|
113
|
+
disabled: loading,
|
|
114
|
+
onKeyPress: e => {
|
|
115
|
+
if (e.key === 'Enter') {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
onCreate();
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
children: roles.filter(d => showOwnerPassport || d.name !== 'owner').map(r => /*#__PURE__*/_jsx(MenuItem, {
|
|
121
|
+
value: r.name,
|
|
122
|
+
"data-cy": `issue-passport-select-option-${r.name}`,
|
|
123
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
124
|
+
children: r.title || r.name
|
|
125
|
+
})
|
|
126
|
+
}, r.name))
|
|
127
|
+
})]
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
}), !!error && /*#__PURE__*/_jsx(Alert, {
|
|
131
|
+
type: "error",
|
|
132
|
+
variant: "icon",
|
|
133
|
+
children: error
|
|
134
|
+
})]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
IssuePassport.propTypes = {
|
|
138
|
+
teamDid: PropTypes.string.isRequired,
|
|
139
|
+
ownerDid: PropTypes.string.isRequired,
|
|
140
|
+
needReceive: PropTypes.bool,
|
|
141
|
+
onCancel: PropTypes.func.isRequired,
|
|
142
|
+
onSuccess: PropTypes.func.isRequired,
|
|
143
|
+
onError: PropTypes.func,
|
|
144
|
+
roles: PropTypes.array,
|
|
145
|
+
showOwnerPassport: PropTypes.bool
|
|
146
|
+
};
|
|
147
|
+
IssuePassport.defaultProps = {
|
|
148
|
+
onError: () => {},
|
|
149
|
+
roles: [],
|
|
150
|
+
showOwnerPassport: false,
|
|
151
|
+
needReceive: true
|
|
152
|
+
};
|