@abtnode/ux 1.16.14-beta-ab7f615e → 1.16.14-beta-cb53c14b

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.
Files changed (202) hide show
  1. package/es/actions.js +97 -0
  2. package/es/analytics/card.js +92 -0
  3. package/es/analytics/chart.js +96 -0
  4. package/es/analytics/cpu.js +36 -0
  5. package/es/analytics/disk.js +111 -0
  6. package/es/analytics/memory.js +72 -0
  7. package/es/analytics/runtime.js +173 -0
  8. package/es/analytics/traffic.js +259 -0
  9. package/es/blocklet/access/config-access.js +307 -0
  10. package/es/blocklet/access/index.js +216 -0
  11. package/es/blocklet/actions.js +474 -0
  12. package/es/blocklet/add-cert.js +177 -0
  13. package/es/blocklet/agreement-app.js +21 -0
  14. package/es/blocklet/agreement.js +127 -0
  15. package/es/blocklet/app-avatar.js +57 -0
  16. package/es/blocklet/audit-logs.js +259 -0
  17. package/es/blocklet/blocklet-source.js +48 -0
  18. package/es/blocklet/bundle-avatar.js +64 -0
  19. package/es/blocklet/component/add.js +1308 -0
  20. package/es/blocklet/component/configuration.js +122 -0
  21. package/es/blocklet/component/delete.js +134 -0
  22. package/es/blocklet/component/environment.js +370 -0
  23. package/es/blocklet/component/index.js +975 -0
  24. package/es/blocklet/component/line.js +20 -0
  25. package/es/blocklet/component/navigation/locale-tabs.js +225 -0
  26. package/es/blocklet/component/navigation/navigation-actions.js +112 -0
  27. package/es/blocklet/component/navigation/navigation-dialog.js +607 -0
  28. package/es/blocklet/component/navigation/navigation-preview.js +101 -0
  29. package/es/blocklet/component/navigation/simple-select.js +124 -0
  30. package/es/blocklet/component/select-store.js +155 -0
  31. package/es/blocklet/component/setting.js +109 -0
  32. package/es/blocklet/component/sortable-tree.js +126 -0
  33. package/es/blocklet/component/space-connector.js +199 -0
  34. package/es/blocklet/component/space-selector.js +178 -0
  35. package/es/blocklet/component/start.js +101 -0
  36. package/es/blocklet/component/store-blocklet-list.js +200 -0
  37. package/es/blocklet/component/switch-control.js +57 -0
  38. package/es/blocklet/config-navigation.js +331 -0
  39. package/es/blocklet/configuration.js +603 -0
  40. package/es/blocklet/disk-info.js +75 -0
  41. package/es/blocklet/icons.js +18 -0
  42. package/es/blocklet/install-from-url.js +337 -0
  43. package/es/blocklet/log.js +90 -0
  44. package/es/blocklet/migration.js +149 -0
  45. package/es/blocklet/mode.js +19 -0
  46. package/es/blocklet/notification/email.js +257 -0
  47. package/es/blocklet/notification/index.js +49 -0
  48. package/es/blocklet/oauth/auth0.js +145 -0
  49. package/es/blocklet/oauth/common-settings.js +133 -0
  50. package/es/blocklet/oauth/federated-detail-dialog.js +175 -0
  51. package/es/blocklet/oauth/federated-invite-dialog.js +83 -0
  52. package/es/blocklet/oauth/federated-join-dialog.js +111 -0
  53. package/es/blocklet/oauth/federated-site-list.js +338 -0
  54. package/es/blocklet/oauth/federated.js +81 -0
  55. package/es/blocklet/oauth/index.js +69 -0
  56. package/es/blocklet/overview.js +293 -0
  57. package/es/blocklet/page-group.js +19 -0
  58. package/es/blocklet/preferences/app-sk.js +142 -0
  59. package/es/blocklet/preferences/index.js +305 -0
  60. package/es/blocklet/purchase/common.js +95 -0
  61. package/es/blocklet/purchase/component-purchase.js +237 -0
  62. package/es/blocklet/purchase/index.js +4 -0
  63. package/es/blocklet/router/action/add-domain-alias.js +167 -0
  64. package/es/blocklet/router/action/add-rule.js +211 -0
  65. package/es/blocklet/router/action/config-routing-rule.js +232 -0
  66. package/es/blocklet/router/action/delete-domain-alias.js +99 -0
  67. package/es/blocklet/router/action/delete-rule.js +108 -0
  68. package/es/blocklet/router/action/update-rule.js +209 -0
  69. package/es/blocklet/router/domain-actions.js +64 -0
  70. package/es/blocklet/router/domain-status.js +88 -0
  71. package/es/blocklet/router/rule-actions.js +66 -0
  72. package/es/blocklet/router/rule-list.js +190 -0
  73. package/es/blocklet/router/util.js +131 -0
  74. package/es/blocklet/runtime-info.js +68 -0
  75. package/es/blocklet/status.js +91 -0
  76. package/es/blocklet/storage/action.js +134 -0
  77. package/es/blocklet/storage/backups.js +241 -0
  78. package/es/blocklet/storage/connect-to.js +373 -0
  79. package/es/blocklet/storage/connected.js +198 -0
  80. package/es/blocklet/storage/delete.js +113 -0
  81. package/es/blocklet/storage/disconnect.js +243 -0
  82. package/es/blocklet/storage/index.js +19 -0
  83. package/es/blocklet/storage/item.js +558 -0
  84. package/es/blocklet/storage/preview-nft.js +286 -0
  85. package/es/blocklet/transfer-owner.js +198 -0
  86. package/es/blocklet/types.js +18 -0
  87. package/es/blocklet/util.js +145 -0
  88. package/es/blocklet/version.js +141 -0
  89. package/es/card-selector.js +134 -0
  90. package/es/certificate.js +105 -0
  91. package/es/chain.js +13 -0
  92. package/es/click-to-copy.js +22 -0
  93. package/es/confirm.js +149 -0
  94. package/es/contexts/audit-log.js +152 -0
  95. package/es/contexts/blocklet.js +10 -0
  96. package/es/contexts/deleting-blocklets.js +70 -0
  97. package/es/contexts/node.js +17 -0
  98. package/es/contexts/session.js +8 -0
  99. package/es/contexts/team.js +10 -0
  100. package/es/delete-confirm.js +121 -0
  101. package/es/did-address.js +46 -0
  102. package/es/dot.js +14 -0
  103. package/es/exchange-passport.js +102 -0
  104. package/es/form/form-select-input.js +184 -0
  105. package/es/form/form-text-input.js +178 -0
  106. package/es/form/form-wrapper.js +88 -0
  107. package/es/form/input-triggers.js +98 -0
  108. package/es/form/required.js +8 -0
  109. package/es/hooks/blocklet.js +229 -0
  110. package/es/hooks/confirm.js +90 -0
  111. package/es/hooks/mobile-width.js +11 -0
  112. package/es/hooks/url-evaluation.js +155 -0
  113. package/es/hooks/use-app-logo.js +16 -0
  114. package/es/hooks/use-backup-progress.js +31 -0
  115. package/es/hooks/use-blocklet-info-for-connect-did-spaces.js +50 -0
  116. package/es/hooks/use-bundle-logo.js +27 -0
  117. package/es/hooks/use-navigation.js +347 -0
  118. package/es/hooks/use-passport-id.js +14 -0
  119. package/es/hooks/use-subscription.js +22 -0
  120. package/es/icons/empty-space-nft.svg +59 -0
  121. package/es/icons/empty-spaces-nft.svg +58 -0
  122. package/es/icons/long-arrow.svg +5 -0
  123. package/es/icons/space-connected.svg +3 -0
  124. package/es/icons/space-disconnect.svg +3 -0
  125. package/es/index.js +3 -0
  126. package/es/invitation/invitation-app.js +58 -0
  127. package/es/invitation/invitation-login.js +68 -0
  128. package/es/invitation/invitation-passport.js +144 -0
  129. package/es/invitation/invitation-receive.js +138 -0
  130. package/es/invitation/invitation-success.js +93 -0
  131. package/es/invitation/invitation-user.js +90 -0
  132. package/es/invitation/invitation.js +90 -0
  133. package/es/issue-passport.js +142 -0
  134. package/es/launch-blocklet/content-layout.js +58 -0
  135. package/es/launch-blocklet/page-header.js +43 -0
  136. package/es/layout/addon.js +114 -0
  137. package/es/layout/feedback.js +55 -0
  138. package/es/locales/en.js +1534 -0
  139. package/es/locales/index.js +9 -0
  140. package/es/locales/zh.js +1537 -0
  141. package/es/logs/clock.js +11 -0
  142. package/es/logs/download.js +132 -0
  143. package/es/logs/log-terminal.js +253 -0
  144. package/es/lost-passport.js +452 -0
  145. package/es/nav-logo.js +219 -0
  146. package/es/passport-tag.js +43 -0
  147. package/es/permission.js +57 -0
  148. package/es/relative-time.js +53 -0
  149. package/es/result-message.js +11 -0
  150. package/es/schema-form/color-input.js +98 -0
  151. package/es/schema-form/common-prop-types.js +13 -0
  152. package/es/schema-form/index.js +215 -0
  153. package/es/schema-form/passport-input.js +54 -0
  154. package/es/schema-form/text-input.js +57 -0
  155. package/es/store/add.js +179 -0
  156. package/es/store/delete.js +96 -0
  157. package/es/store/item.js +76 -0
  158. package/es/subscription.js +144 -0
  159. package/es/table-icons.js +34 -0
  160. package/es/table.js +52 -0
  161. package/es/tag.js +21 -0
  162. package/es/team/members/actions.js +89 -0
  163. package/es/team/members/index.js +636 -0
  164. package/es/team/members/invitations.js +188 -0
  165. package/es/team/members/invite-member.js +208 -0
  166. package/es/team/members/issue-passport.js +152 -0
  167. package/es/team/members/member.js +408 -0
  168. package/es/team/members/passport-issuances.js +155 -0
  169. package/es/team/members/passports.js +364 -0
  170. package/es/team/members/toggle-user-approval.js +122 -0
  171. package/es/team/members/transfer-node.js +256 -0
  172. package/es/team/members/util.js +14 -0
  173. package/es/team/passports/color.js +126 -0
  174. package/es/team/passports/detail.js +312 -0
  175. package/es/team/passports/index.js +282 -0
  176. package/es/team/passports/mutate-role.js +198 -0
  177. package/es/team/passports/trusted-factories.js +221 -0
  178. package/es/team/passports/trusted-factory.js +343 -0
  179. package/es/team/passports/trusted-issuer.js +296 -0
  180. package/es/team/passports/trusted-issuers.js +226 -0
  181. package/es/team/search-input.js +46 -0
  182. package/es/team/styles/dialog.js +72 -0
  183. package/es/team/styles/list-header.js +31 -0
  184. package/es/util/api.js +6 -0
  185. package/es/util/constants.js +2 -0
  186. package/es/util/index.js +598 -0
  187. package/es/util/mode.js +4 -0
  188. package/es/util/space-gateway.js +51 -0
  189. package/es/util/spaces.js +151 -0
  190. package/es/who-can-access/config.js +38 -0
  191. package/es/wrap-locale.js +15 -0
  192. package/lib/blocklet/component/space-connector.js +1 -1
  193. package/lib/blocklet/component/space-selector.js +1 -1
  194. package/lib/blocklet/storage/backups.js +1 -1
  195. package/lib/blocklet/storage/connect-to.js +1 -1
  196. package/lib/blocklet/storage/connected.js +1 -1
  197. package/lib/blocklet/storage/disconnect.js +1 -1
  198. package/lib/blocklet/storage/index.js +1 -1
  199. package/lib/blocklet/storage/item.js +1 -1
  200. package/lib/invitation/invitation-receive.js +1 -1
  201. package/lib/team/passports/trusted-factory.js +1 -1
  202. package/package.json +81 -18
@@ -0,0 +1,636 @@
1
+ /* eslint-disable react/no-unstable-nested-components */
2
+ /* eslint-disable jsx-a11y/aria-role */
3
+ import { useContext, useState, useEffect } from 'react';
4
+ import styled from '@emotion/styled';
5
+ import isEmpty from 'lodash/isEmpty';
6
+ import PropTypes from 'prop-types';
7
+ import classnames from 'classnames';
8
+ import Dialog from '@arcblock/ux/lib/Dialog';
9
+ import Tooltip from '@mui/material/Tooltip';
10
+ import Box from '@mui/material/Box';
11
+ import FormControlLabel from '@mui/material/FormControlLabel';
12
+ import Checkbox from '@mui/material/Checkbox';
13
+ import AddIcon from '@mui/icons-material/Add';
14
+ import LoopIcon from '@mui/icons-material/Loop';
15
+ import Avatar from '@arcblock/did-connect/lib/Avatar';
16
+ import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
17
+ import Button from '@arcblock/ux/lib/Button';
18
+ import PersonIcon from '@arcblock/icons/lib/PersonIcon';
19
+ import ExternalIssuerIcon from '@arcblock/icons/lib/ExternalIssuerIcon';
20
+ import Datatable, { getDurableData } from '@arcblock/ux/lib/Datatable';
21
+ import RelativeTime from '@arcblock/ux/lib/RelativeTime';
22
+ import { EVENTS, USER_TYPE } from '@abtnode/constant';
23
+ import useUrlState from '@ahooksjs/use-url-state';
24
+ import { useMount } from 'ahooks';
25
+ import Toast from '@arcblock/ux/lib/Toast';
26
+ import DidAddress from '../../did-address';
27
+ import { useNodeContext } from '../../contexts/node';
28
+ import { useTeamContext } from '../../contexts/team';
29
+ import { useBlockletContext } from '../../contexts/blocklet';
30
+ import Permission from '../../permission';
31
+ import { BlockletAdminRoles } from '../../util';
32
+ import InviteMember from './invite-member';
33
+ import TransferMember from './transfer-node';
34
+ import Member from './member';
35
+ import Invitations from './invitations';
36
+ import Actions from './actions';
37
+ import { parseAvatar } from './util';
38
+ import { jsx as _jsx } from "react/jsx-runtime";
39
+ import { jsxs as _jsxs } from "react/jsx-runtime";
40
+ const ROLE_ALL = '$all';
41
+ const ROLE_NONE = '$none';
42
+ const getCount = (counts, name) => {
43
+ const item = counts.find(x => x.key === name);
44
+ return item?.value || 0;
45
+ };
46
+ const isFromExternal = (user, appIdList) => {
47
+ const list = user.passports || [];
48
+ if (!list.length) {
49
+ return false;
50
+ }
51
+ return !list.some(z => appIdList.includes(z.issuer?.id));
52
+ };
53
+ function SimpleInfo({
54
+ user
55
+ }) {
56
+ const {
57
+ t
58
+ } = useContext(LocaleContext);
59
+ const main = /*#__PURE__*/_jsxs("div", {
60
+ className: "member-block",
61
+ children: [/*#__PURE__*/_jsxs("div", {
62
+ className: "member-avatar",
63
+ children: [/*#__PURE__*/_jsx(Avatar, {
64
+ src: `${user.avatar}?imageFilter=resize&w=48&h=48`,
65
+ size: 24,
66
+ did: user.did,
67
+ shape: "circle",
68
+ style: {
69
+ borderRadius: '100%',
70
+ overflow: 'hidden'
71
+ }
72
+ }), !user.approved && /*#__PURE__*/_jsx("did", {
73
+ className: "badge-block"
74
+ }), user.isFromExternal && /*#__PURE__*/_jsx(Tooltip, {
75
+ title: t('team.passport.externalPassport'),
76
+ children: /*#__PURE__*/_jsx(Box, {
77
+ ml: 1,
78
+ className: "icon",
79
+ children: /*#__PURE__*/_jsx(ExternalIssuerIcon, {})
80
+ })
81
+ })]
82
+ }), /*#__PURE__*/_jsx("div", {
83
+ className: "member-text",
84
+ children: user.fullName
85
+ })]
86
+ });
87
+ return user.approved ? main : /*#__PURE__*/_jsx(Box, {
88
+ display: "flex",
89
+ alignItems: "center",
90
+ children: /*#__PURE__*/_jsx(Tooltip, {
91
+ title: t('team.member.forbidLoginDescription'),
92
+ children: main
93
+ })
94
+ });
95
+ }
96
+ SimpleInfo.propTypes = {
97
+ user: PropTypes.object.isRequired
98
+ };
99
+ export default function MemberList({
100
+ type,
101
+ createPassportSvg
102
+ }) {
103
+ const {
104
+ appIdList = []
105
+ } = useBlockletContext();
106
+ const {
107
+ teamDid,
108
+ invitations,
109
+ teamIssuerDid,
110
+ roles,
111
+ refresh,
112
+ enablePassportIssuance,
113
+ endpoint,
114
+ api
115
+ } = useTeamContext();
116
+ const {
117
+ inService,
118
+ ws: {
119
+ useSubscription
120
+ }
121
+ } = useNodeContext();
122
+ const {
123
+ t,
124
+ locale
125
+ } = useContext(LocaleContext);
126
+ const [showInviteMember, setShowInviteMember] = useState(false);
127
+ const [showTransferMember, setShowTransferMember] = useState(false);
128
+ const [showInviting, setShowInviting] = useState(false);
129
+ const [memberDialog, setMemberDialog] = useState(false); // member, inviting
130
+ const [loading, setLoading] = useState(false);
131
+ const [users, setUsers] = useState([]);
132
+ const [rowCount, setRowCount] = useState();
133
+ const [userCounts, setUserCounts] = useState([]);
134
+ const [urlState] = useUrlState({
135
+ did: undefined
136
+ });
137
+ const durableKey = `members-${teamDid}`;
138
+ const tableDurableData = getDurableData(durableKey);
139
+ const [search, setSearch] = useState({
140
+ role: ROLE_ALL,
141
+ searchText: tableDurableData.searchText || '',
142
+ hideBlocked: false,
143
+ pageSize: tableDurableData.rowsPerPage || 10,
144
+ page: tableDurableData.page ? tableDurableData.page + 1 : 1
145
+ });
146
+ useMount(async () => {
147
+ if (urlState.did) {
148
+ const {
149
+ user
150
+ } = await api.getUser({
151
+ did: urlState.did
152
+ });
153
+ if (user) {
154
+ setMemberDialog(user);
155
+ }
156
+ }
157
+ });
158
+ const sideList = (roles || []).map(x => ({
159
+ name: x.name,
160
+ title: x.title,
161
+ num: getCount(userCounts, x.name)
162
+ }));
163
+ sideList.unshift({
164
+ name: ROLE_ALL,
165
+ title: 'All Members',
166
+ num: getCount(userCounts, ROLE_ALL)
167
+ });
168
+ sideList.push({
169
+ name: ROLE_NONE,
170
+ title: 'Other',
171
+ num: getCount(userCounts, ROLE_NONE)
172
+ });
173
+ const getUsers = () => {
174
+ const query = {};
175
+ if (search.hideBlocked) {
176
+ query.approved = true;
177
+ }
178
+ query.role = search.role;
179
+ if (search.searchText) {
180
+ query.search = search.searchText;
181
+ }
182
+ setLoading(true);
183
+ api.getUsers({
184
+ query,
185
+ paging: {
186
+ page: search.page,
187
+ pageSize: search.pageSize
188
+ }
189
+ }).then(res => {
190
+ setLoading(false);
191
+ (res.users || []).forEach(x => {
192
+ x.isFromExternal = isFromExternal(x, isEmpty(appIdList) ? [teamIssuerDid] : appIdList);
193
+ x.avatar = parseAvatar(x.avatar, teamDid, inService);
194
+
195
+ // for backwards compatibility
196
+ x.passports = (x.passports || []).filter(y => y.issuer);
197
+ });
198
+ setUsers(res.users || []);
199
+ setRowCount(res.paging.total);
200
+ }).catch(err => {
201
+ setLoading(false);
202
+ Toast.error(err.message);
203
+ });
204
+ };
205
+ const getUserCounts = () => {
206
+ api.getUsersCountPerRole().then(res => {
207
+ setUserCounts(res.counts || []);
208
+ }).catch(err => {
209
+ Toast.error(err.message);
210
+ });
211
+ };
212
+ const handleUserChange = data => {
213
+ if (data.teamDid === teamDid) {
214
+ getUsers();
215
+ getUserCounts();
216
+ }
217
+ };
218
+ useEffect(() => {
219
+ getUsers();
220
+ }, [`${search.hideBlocked}-${search.role}-${search.page}-${search.pageSize}-${search.searchText}`]); //eslint-disable-line
221
+
222
+ // user counts
223
+ useEffect(() => {
224
+ getUserCounts();
225
+ }, []); //eslint-disable-line
226
+
227
+ useSubscription(EVENTS.USER_UPDATED, handleUserChange, [search]);
228
+ useSubscription(EVENTS.USER_ADDED, handleUserChange, [search]);
229
+ const isInvitationEnabled = enablePassportIssuance;
230
+ const columns = [{
231
+ label: t('common.name'),
232
+ name: 'fullName',
233
+ options: {
234
+ customBodyRenderLite: rawIndex => {
235
+ const x = users[rawIndex];
236
+ return /*#__PURE__*/_jsx("div", {
237
+ "data-cy": `member-name-${x.fullName}`,
238
+ children: /*#__PURE__*/_jsx(SimpleInfo, {
239
+ user: x
240
+ })
241
+ }, x.did);
242
+ }
243
+ }
244
+ }, {
245
+ label: t('common.address'),
246
+ name: 'did',
247
+ options: {
248
+ customBodyRender: e => {
249
+ return /*#__PURE__*/_jsx(DidAddress, {
250
+ size: 14,
251
+ responsive: true,
252
+ copyable: false,
253
+ did: e
254
+ });
255
+ }
256
+ }
257
+ }, {
258
+ label: t('team.member.lastLogin'),
259
+ name: 'lastLoginAt',
260
+ options: {
261
+ customBodyRender: e => {
262
+ return /*#__PURE__*/_jsx(RelativeTime, {
263
+ value: e,
264
+ locale: locale
265
+ });
266
+ }
267
+ }
268
+ }, {
269
+ label: t('team.member.lastLoginIp'),
270
+ name: 'lastLoginIp',
271
+ options: {
272
+ customBodyRender: e => {
273
+ return e || '-';
274
+ }
275
+ }
276
+ }, {
277
+ label: t('team.member.source'),
278
+ name: 'sourceProvider',
279
+ options: {
280
+ customBodyRender: e => {
281
+ const source = e || USER_TYPE.WALLET;
282
+ const providerNameMap = {
283
+ auth0: 'Auth0',
284
+ wallet: 'DID wallet',
285
+ federated: 'Federated'
286
+ };
287
+ return providerNameMap[source] || source;
288
+ }
289
+ }
290
+ }, {
291
+ label: t('common.actions'),
292
+ name: '',
293
+ width: 100,
294
+ align: 'center',
295
+ verticalKeyAlign: 'center',
296
+ options: {
297
+ customBodyRenderLite: rawIndex => {
298
+ const x = users[rawIndex];
299
+ return /*#__PURE__*/_jsx(Permission, {
300
+ permission: inService ? '' : 'mutate_team',
301
+ role: inService ? BlockletAdminRoles : [],
302
+ children: /*#__PURE__*/_jsx(Actions, {
303
+ user: x,
304
+ onIssuePassport: () => setMemberDialog({
305
+ ...x,
306
+ initTab: 'issuances'
307
+ })
308
+ })
309
+ });
310
+ }
311
+ }
312
+ }];
313
+ const customButtons = [];
314
+ if (isInvitationEnabled) {
315
+ customButtons.push( /*#__PURE__*/_jsxs(Button, {
316
+ variant: "outlined",
317
+ style: {
318
+ flexShrink: 0,
319
+ marginRight: 16
320
+ },
321
+ color: "primary",
322
+ size: "small",
323
+ onClick: () => {
324
+ setShowInviting(true);
325
+ },
326
+ children: [/*#__PURE__*/_jsx(PersonIcon, {
327
+ style: {
328
+ height: '1em',
329
+ marginRight: 4
330
+ }
331
+ }), t('common.inviting'), invitations.length ? ` (${invitations.length})` : '']
332
+ }), /*#__PURE__*/_jsx(Permission, {
333
+ permission: inService ? '' : 'mutate_team',
334
+ role: inService ? BlockletAdminRoles : [],
335
+ children: /*#__PURE__*/_jsxs(Button, {
336
+ style: {
337
+ flexShrink: 0,
338
+ marginRight: 16
339
+ },
340
+ variant: "contained",
341
+ edge: "end",
342
+ color: "primary",
343
+ size: "small",
344
+ "data-cy": "invite-member",
345
+ onClick: () => setShowInviteMember(true),
346
+ children: [/*#__PURE__*/_jsx(AddIcon, {
347
+ style: {
348
+ fontSize: '1.3em',
349
+ marginRight: 4
350
+ }
351
+ }), t('team.invite')]
352
+ })
353
+ }));
354
+ if (type === 'server') {
355
+ customButtons.push( /*#__PURE__*/_jsx(Permission, {
356
+ role: "owner",
357
+ children: /*#__PURE__*/_jsxs(Button, {
358
+ style: {
359
+ flexShrink: 0
360
+ },
361
+ variant: "contained",
362
+ edge: "end",
363
+ color: "error",
364
+ size: "small",
365
+ "data-cy": "invite-member",
366
+ onClick: () => setShowTransferMember(true),
367
+ children: [/*#__PURE__*/_jsx(LoopIcon, {
368
+ style: {
369
+ fontSize: '1.3em',
370
+ marginRight: 4
371
+ }
372
+ }), t('team.transferNode.name')]
373
+ })
374
+ }));
375
+ }
376
+ }
377
+ const onRoleChange = role => {
378
+ if (loading) {
379
+ return;
380
+ }
381
+ setSearch(x => ({
382
+ ...x,
383
+ role,
384
+ hideBlocked: false,
385
+ searchText: '',
386
+ page: 1
387
+ }));
388
+ };
389
+ const onHideBlockedChange = value => {
390
+ setSearch(x => ({
391
+ ...x,
392
+ hideBlocked: value,
393
+ page: 1
394
+ }));
395
+ };
396
+ const onTableChange = ({
397
+ page,
398
+ rowsPerPage,
399
+ searchText
400
+ }) => {
401
+ if (search.pageSize !== rowsPerPage) {
402
+ setSearch(x => ({
403
+ ...x,
404
+ pageSize: rowsPerPage,
405
+ page: 1
406
+ }));
407
+ } else if (search.page !== page + 1) {
408
+ setSearch(x => ({
409
+ ...x,
410
+ page: page + 1
411
+ }));
412
+ } else if (search.searchText !== searchText) {
413
+ setSearch(x => ({
414
+ ...x,
415
+ searchText,
416
+ page: 1
417
+ }));
418
+ }
419
+ };
420
+ const tableOptions = {
421
+ sort: false,
422
+ download: false,
423
+ filter: false,
424
+ print: false,
425
+ expandableRowsOnClick: true,
426
+ onRowClick(e, {
427
+ dataIndex
428
+ }) {
429
+ const x = users[dataIndex];
430
+ setMemberDialog(x);
431
+ },
432
+ page: search.page - 1,
433
+ rowsPerPage: search.pageSize,
434
+ count: rowCount,
435
+ searchDebounceTime: 600
436
+ };
437
+ return /*#__PURE__*/_jsxs(Div, {
438
+ children: [/*#__PURE__*/_jsxs(Box, {
439
+ className: "main",
440
+ display: "flex",
441
+ children: [/*#__PURE__*/_jsx("div", {
442
+ className: "left",
443
+ children: /*#__PURE__*/_jsx("div", {
444
+ className: "tabs",
445
+ children: sideList.map(x => /*#__PURE__*/_jsxs("div", {
446
+ className: `tab ${search.role === x.name ? 'active' : ''}`,
447
+ onClick: () => onRoleChange(x.name),
448
+ children: [/*#__PURE__*/_jsx("span", {
449
+ className: "text",
450
+ children: x.title
451
+ }), /*#__PURE__*/_jsx("span", {
452
+ className: classnames('badge', {
453
+ 'is-rect': x.num > 999
454
+ }),
455
+ children: x.num
456
+ })]
457
+ }, x.name))
458
+ })
459
+ }), /*#__PURE__*/_jsx("div", {
460
+ className: "right",
461
+ children: /*#__PURE__*/_jsx(Datatable, {
462
+ className: "main-table",
463
+ verticalKeyWidth: 100,
464
+ locale: locale,
465
+ durable: durableKey,
466
+ durableKeys: ['page', 'rowsPerPage'],
467
+ title: /*#__PURE__*/_jsx("div", {
468
+ className: "table-toolbar-left",
469
+ children: /*#__PURE__*/_jsx(FormControlLabel, {
470
+ control: /*#__PURE__*/_jsx(Checkbox, {
471
+ sx: {
472
+ display: 'flex !important'
473
+ },
474
+ disabled: loading,
475
+ color: "primary",
476
+ checked: search.hideBlocked,
477
+ onChange: e => onHideBlockedChange(e.target.checked)
478
+ }),
479
+ label: t('team.member.hideBlockedMember')
480
+ })
481
+ }),
482
+ data: users,
483
+ columns: columns,
484
+ customButtons: customButtons,
485
+ options: tableOptions,
486
+ loading: loading,
487
+ onChange: onTableChange
488
+ })
489
+ })]
490
+ }), /*#__PURE__*/_jsx(Dialog, {
491
+ title: t('common.inviting'),
492
+ onClose: () => setShowInviting(false),
493
+ open: showInviting,
494
+ maxWidth: "lg",
495
+ fullWidth: true,
496
+ children: /*#__PURE__*/_jsx(Invitations, {})
497
+ }), memberDialog && /*#__PURE__*/_jsx(Member, {
498
+ onCancel: () => setMemberDialog(null),
499
+ userDid: memberDialog.did,
500
+ createPassportSvg: createPassportSvg,
501
+ initTab: memberDialog.initTab
502
+ }), showInviteMember && /*#__PURE__*/_jsx(InviteMember, {
503
+ teamDid: teamDid,
504
+ endpoint: endpoint,
505
+ roles: roles,
506
+ onCancel: () => setShowInviteMember(false),
507
+ onSuccess: () => {
508
+ refresh();
509
+ setShowInviteMember(false);
510
+ }
511
+ }), showTransferMember && /*#__PURE__*/_jsx(TransferMember, {
512
+ teamDid: teamDid,
513
+ endpoint: endpoint,
514
+ roles: roles,
515
+ onCancel: () => setShowTransferMember(false),
516
+ onSuccess: () => {
517
+ refresh();
518
+ setShowTransferMember(false);
519
+ }
520
+ })]
521
+ });
522
+ }
523
+ const Div = styled.div`
524
+ .main {
525
+ .left {
526
+ width: 168px;
527
+ flex-shrink: 0;
528
+ margin-right: 65px;
529
+ .tabs {
530
+ padding-top: 16px;
531
+ .tab {
532
+ display: flex;
533
+ justify-content: space-between;
534
+ align-items: center;
535
+ padding: 8px 16px;
536
+ transition: background 0.4s;
537
+
538
+ width: 168px;
539
+ height: 36px;
540
+ border-radius: 8px;
541
+
542
+ cursor: pointer;
543
+ user-select: none;
544
+
545
+ &:nth-child(n + 2) {
546
+ margin-top: 24px;
547
+ }
548
+
549
+ &.active {
550
+ background: #f2f2f2;
551
+ }
552
+
553
+ &:hover {
554
+ background: #f2f2f2;
555
+ }
556
+
557
+ .text {
558
+ font-weight: 400;
559
+ font-size: 16px;
560
+ line-height: 19px;
561
+
562
+ color: #222222;
563
+ }
564
+
565
+ .badge {
566
+ display: flex;
567
+ justify-content: center;
568
+ align-items: center;
569
+ width: 20px;
570
+ height: 20px;
571
+ border-radius: 100%;
572
+ color: #fff;
573
+ background: #666666;
574
+ font-size: 10px;
575
+ font-weight: 400;
576
+ &.is-rect {
577
+ width: auto;
578
+ border-radius: 8px;
579
+ padding: 0 4px;
580
+ }
581
+ }
582
+ }
583
+ }
584
+ @media (max-width: ${props => props.theme.breakpoints.values.md}px) {
585
+ display: none;
586
+ }
587
+ }
588
+ .right {
589
+ flex-grow: 1;
590
+ }
591
+ }
592
+
593
+ .member-block {
594
+ display: flex;
595
+ justify-content: flex-start;
596
+ align-items: center;
597
+ .member-avatar {
598
+ position: relative;
599
+ display: flex;
600
+ justify-content: center;
601
+ align-items: center;
602
+ }
603
+ .member-text {
604
+ margin-left: 10px;
605
+ }
606
+ .badge-block {
607
+ width: 14px;
608
+ height: 14px;
609
+ position: absolute;
610
+ right: -4px;
611
+ top: -4px;
612
+ background: #ff5757;
613
+ border-radius: 100%;
614
+ display: flex;
615
+ align-items: center;
616
+ justify-content: center;
617
+ &::after {
618
+ content: '';
619
+ width: 6px;
620
+ height: 2px;
621
+ background: #fefefe;
622
+ }
623
+ }
624
+ }
625
+
626
+ .table-toolbar-left {
627
+ display: flex;
628
+ justify-content: center;
629
+ align-items: center;
630
+ padding: 7px 0;
631
+ }
632
+ `;
633
+ MemberList.propTypes = {
634
+ type: PropTypes.oneOf(['server', 'blocklet']).isRequired,
635
+ createPassportSvg: PropTypes.func.isRequired
636
+ };