@abtnode/ux 1.16.29-beta-0070353c → 1.16.29-beta-e04c6f40
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/notification/push-kit.js +17 -3
- package/lib/blocklet/publish/create-release/branding.js +1 -0
- package/lib/blocklet/publish/create-release/connect-store-button.js +99 -23
- package/lib/blocklet/publish/create-release/connect-store-list.js +12 -6
- package/lib/blocklet/publish/create-release/index.js +3 -1
- package/lib/invitation/invitation-receive.js +46 -25
- package/lib/invitation/invitation.js +4 -4
- package/lib/locales/ar.js +7 -3
- package/lib/locales/de.js +7 -3
- package/lib/locales/en.js +5 -1
- package/lib/locales/es.js +7 -3
- package/lib/locales/fr.js +7 -3
- package/lib/locales/hi.js +7 -3
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +7 -3
- package/lib/locales/ja.js +7 -3
- package/lib/locales/ko.js +7 -3
- package/lib/locales/pt.js +7 -3
- package/lib/locales/ru.js +7 -3
- package/lib/locales/th.js +7 -3
- package/lib/locales/vi.js +7 -3
- package/lib/locales/zh-tw.js +7 -3
- package/lib/locales/zh.js +7 -3
- package/lib/store/add.js +24 -10
- package/lib/store/connect-actions.js +18 -18
- package/lib/store/item.js +28 -4
- package/lib/team/members/index.js +33 -1
- package/lib/team/members/invite-member.js +98 -66
- package/lib/util/sdk.js +3 -0
- package/package.json +8 -7
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
2
|
+
import { Alert, Box, CircularProgress, DialogContentText, MenuItem, Select, TextField, InputLabel, FormControl } from '@mui/material';
|
|
3
|
+
import { useReactive } from 'ahooks';
|
|
4
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
5
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
14
6
|
import Button from '@arcblock/ux/lib/Button';
|
|
15
|
-
import
|
|
7
|
+
import DID from '@arcblock/ux/lib/DID';
|
|
8
|
+
import Avatar from '@arcblock/ux/lib/Avatar';
|
|
16
9
|
import ClickToCopy from '../../click-to-copy';
|
|
17
10
|
import { useNodeContext } from '../../contexts/node';
|
|
18
11
|
import { formatError, getInviteLink, formatToDatetime } from '../../util';
|
|
@@ -20,6 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
20
13
|
export default function InviteMember({
|
|
21
14
|
teamDid,
|
|
22
15
|
roles,
|
|
16
|
+
apps,
|
|
23
17
|
onCancel,
|
|
24
18
|
onSuccess,
|
|
25
19
|
onError,
|
|
@@ -28,64 +22,110 @@ export default function InviteMember({
|
|
|
28
22
|
const {
|
|
29
23
|
api
|
|
30
24
|
} = useNodeContext();
|
|
31
|
-
const [loading, setLoading] = useState(false);
|
|
32
|
-
const [error, setError] = useState('');
|
|
33
25
|
const {
|
|
34
26
|
t,
|
|
35
27
|
locale
|
|
36
28
|
} = useLocaleContext();
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
const currentState = useReactive({
|
|
30
|
+
loading: false,
|
|
31
|
+
error: null,
|
|
32
|
+
activeStep: 0,
|
|
33
|
+
inviteInfo: null,
|
|
34
|
+
role: '',
|
|
35
|
+
remark: '',
|
|
36
|
+
sourceAppPid: apps.length > 0 ? apps[0].appId : null
|
|
37
|
+
});
|
|
41
38
|
const onCreate = async () => {
|
|
42
|
-
if (!role) {
|
|
43
|
-
|
|
39
|
+
if (!currentState.role) {
|
|
40
|
+
currentState.error = t('team.member.error.passportEmpty');
|
|
44
41
|
return;
|
|
45
42
|
}
|
|
46
|
-
const trimRemark = remark.trim();
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const trimRemark = currentState.remark.trim();
|
|
44
|
+
currentState.error = null;
|
|
45
|
+
currentState.loading = true;
|
|
49
46
|
try {
|
|
50
47
|
const {
|
|
51
|
-
inviteInfo
|
|
48
|
+
inviteInfo
|
|
52
49
|
} = await api.createMemberInvitation({
|
|
53
50
|
input: {
|
|
54
51
|
teamDid,
|
|
55
|
-
role,
|
|
56
|
-
remark: trimRemark
|
|
52
|
+
role: currentState.role,
|
|
53
|
+
remark: trimRemark,
|
|
54
|
+
sourceAppPid: currentState.sourceAppPid
|
|
57
55
|
}
|
|
58
56
|
});
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
currentState.inviteInfo = inviteInfo;
|
|
58
|
+
currentState.activeStep = 1;
|
|
61
59
|
} catch (err) {
|
|
62
60
|
const errMsg = formatError(err);
|
|
63
|
-
|
|
61
|
+
currentState.error = errMsg;
|
|
64
62
|
onError(err);
|
|
65
63
|
} finally {
|
|
66
|
-
|
|
64
|
+
currentState.loading = false;
|
|
67
65
|
}
|
|
68
66
|
};
|
|
69
67
|
const steps = [{
|
|
70
|
-
body: /*#__PURE__*/_jsxs(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
body: /*#__PURE__*/_jsxs(Box, {
|
|
69
|
+
sx: {
|
|
70
|
+
display: 'flex',
|
|
71
|
+
flexDirection: 'column',
|
|
72
|
+
gap: 3
|
|
73
|
+
},
|
|
74
|
+
children: [apps.length > 1 ? /*#__PURE__*/_jsxs(FormControl, {
|
|
75
|
+
fullWidth: true,
|
|
76
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
77
|
+
children: t('common.sourceApp')
|
|
78
|
+
}), /*#__PURE__*/_jsx(Select, {
|
|
79
|
+
value: currentState.sourceAppPid,
|
|
80
|
+
onChange: e => {
|
|
81
|
+
currentState.error = null;
|
|
82
|
+
currentState.sourceAppPid = e.target.value;
|
|
83
|
+
},
|
|
84
|
+
fullWidth: true,
|
|
85
|
+
label: t('common.passport'),
|
|
86
|
+
disabled: currentState.loading,
|
|
87
|
+
children: apps.map(r => /*#__PURE__*/_jsx(MenuItem, {
|
|
88
|
+
value: r.appId,
|
|
89
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
90
|
+
sx: {
|
|
91
|
+
display: 'flex',
|
|
92
|
+
justifyContent: 'space-between',
|
|
93
|
+
gap: 2,
|
|
94
|
+
width: '100%'
|
|
95
|
+
},
|
|
96
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
97
|
+
sx: {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
gap: 1
|
|
101
|
+
},
|
|
102
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
103
|
+
did: r.appId,
|
|
104
|
+
size: 28
|
|
105
|
+
}), r.appName]
|
|
106
|
+
}), /*#__PURE__*/_jsx(DID, {
|
|
107
|
+
did: r.appId,
|
|
108
|
+
compact: true,
|
|
109
|
+
responsive: false
|
|
110
|
+
})]
|
|
111
|
+
})
|
|
112
|
+
}, r.appId))
|
|
113
|
+
})]
|
|
114
|
+
}) : null, /*#__PURE__*/_jsxs(FormControl, {
|
|
115
|
+
fullWidth: true,
|
|
76
116
|
variant: "outlined",
|
|
77
117
|
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
78
118
|
children: t('common.passport')
|
|
79
119
|
}), /*#__PURE__*/_jsx(Select, {
|
|
80
120
|
"data-cy": "invite-member-select-role",
|
|
81
|
-
value: role,
|
|
121
|
+
value: currentState.role,
|
|
82
122
|
onChange: e => {
|
|
83
|
-
|
|
84
|
-
|
|
123
|
+
currentState.error = null;
|
|
124
|
+
currentState.role = e.target.value;
|
|
85
125
|
},
|
|
86
126
|
fullWidth: true,
|
|
87
127
|
label: t('common.passport'),
|
|
88
|
-
disabled: loading,
|
|
128
|
+
disabled: currentState.loading,
|
|
89
129
|
onKeyPress: e => {
|
|
90
130
|
if (e.key === 'Enter') {
|
|
91
131
|
e.preventDefault();
|
|
@@ -100,11 +140,6 @@ export default function InviteMember({
|
|
|
100
140
|
})
|
|
101
141
|
}, r.name))
|
|
102
142
|
})]
|
|
103
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
104
|
-
style: {
|
|
105
|
-
marginTop: 20,
|
|
106
|
-
marginBottom: 10
|
|
107
|
-
}
|
|
108
143
|
}), /*#__PURE__*/_jsx(TextField, {
|
|
109
144
|
label: t('common.remark'),
|
|
110
145
|
autoComplete: "off",
|
|
@@ -113,18 +148,13 @@ export default function InviteMember({
|
|
|
113
148
|
style: {
|
|
114
149
|
marginBottom: 8
|
|
115
150
|
},
|
|
116
|
-
value: remark,
|
|
151
|
+
value: currentState.remark,
|
|
117
152
|
onChange: e => {
|
|
118
|
-
|
|
119
|
-
|
|
153
|
+
currentState.error = null;
|
|
154
|
+
currentState.remark = e.target.value;
|
|
120
155
|
},
|
|
121
|
-
disabled: loading,
|
|
156
|
+
disabled: currentState.loading,
|
|
122
157
|
"data-cy": "invite-member-input-remark"
|
|
123
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
124
|
-
style: {
|
|
125
|
-
marginTop: 20,
|
|
126
|
-
marginBottom: 10
|
|
127
|
-
}
|
|
128
158
|
})]
|
|
129
159
|
}),
|
|
130
160
|
cancel: t('common.cancel'),
|
|
@@ -135,13 +165,17 @@ export default function InviteMember({
|
|
|
135
165
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
136
166
|
body: () => {
|
|
137
167
|
const link = getInviteLink({
|
|
138
|
-
inviteId: inviteInfo
|
|
168
|
+
inviteId: currentState.inviteInfo?.inviteId,
|
|
139
169
|
endpoint
|
|
140
170
|
});
|
|
141
171
|
return /*#__PURE__*/_jsxs("div", {
|
|
142
|
-
children: [/*#__PURE__*/_jsx(
|
|
172
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
173
|
+
sx: {
|
|
174
|
+
fontSize: 16,
|
|
175
|
+
fontWeight: 'bold'
|
|
176
|
+
},
|
|
143
177
|
children: t('team.member.inviteDialog.createSuccessTip', {
|
|
144
|
-
expireDate: formatToDatetime(inviteInfo
|
|
178
|
+
expireDate: formatToDatetime(currentState.inviteInfo?.expireDate, locale)
|
|
145
179
|
})
|
|
146
180
|
}), /*#__PURE__*/_jsx("div", {
|
|
147
181
|
style: {
|
|
@@ -155,7 +189,7 @@ export default function InviteMember({
|
|
|
155
189
|
confirm: t('common.confirm'),
|
|
156
190
|
onConfirm: onSuccess
|
|
157
191
|
}];
|
|
158
|
-
const step = steps[activeStep];
|
|
192
|
+
const step = steps[currentState.activeStep];
|
|
159
193
|
return /*#__PURE__*/_jsxs(Dialog, {
|
|
160
194
|
title: t('common.invite'),
|
|
161
195
|
fullWidth: true,
|
|
@@ -169,10 +203,10 @@ export default function InviteMember({
|
|
|
169
203
|
}), /*#__PURE__*/_jsxs(Button, {
|
|
170
204
|
onClick: step.onConfirm,
|
|
171
205
|
color: "primary",
|
|
172
|
-
disabled: loading || !role,
|
|
206
|
+
disabled: currentState.loading || !currentState.role,
|
|
173
207
|
variant: "contained",
|
|
174
208
|
autoFocus: true,
|
|
175
|
-
children: [loading && /*#__PURE__*/_jsx(
|
|
209
|
+
children: [currentState.loading && /*#__PURE__*/_jsx(CircularProgress, {
|
|
176
210
|
size: 16
|
|
177
211
|
}), step.confirm]
|
|
178
212
|
})]
|
|
@@ -180,10 +214,10 @@ export default function InviteMember({
|
|
|
180
214
|
children: [/*#__PURE__*/_jsx(DialogContentText, {
|
|
181
215
|
component: "div",
|
|
182
216
|
children: typeof step.body === 'function' ? step.body() : step.body
|
|
183
|
-
}), !!error && /*#__PURE__*/_jsx(Alert, {
|
|
217
|
+
}), !!currentState.error && /*#__PURE__*/_jsx(Alert, {
|
|
184
218
|
severity: "error",
|
|
185
219
|
variant: "icon",
|
|
186
|
-
children: error
|
|
220
|
+
children: currentState.error
|
|
187
221
|
})]
|
|
188
222
|
});
|
|
189
223
|
}
|
|
@@ -193,14 +227,12 @@ InviteMember.propTypes = {
|
|
|
193
227
|
onSuccess: PropTypes.func.isRequired,
|
|
194
228
|
onError: PropTypes.func,
|
|
195
229
|
roles: PropTypes.array,
|
|
230
|
+
apps: PropTypes.array,
|
|
196
231
|
endpoint: PropTypes.string
|
|
197
232
|
};
|
|
198
233
|
InviteMember.defaultProps = {
|
|
199
234
|
onError: () => {},
|
|
200
235
|
roles: [],
|
|
236
|
+
apps: [],
|
|
201
237
|
endpoint: ''
|
|
202
|
-
};
|
|
203
|
-
const Bold = styled.div`
|
|
204
|
-
font-size: 16px;
|
|
205
|
-
font-weight: bold;
|
|
206
|
-
`;
|
|
238
|
+
};
|
package/lib/util/sdk.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.29-beta-
|
|
3
|
+
"version": "1.16.29-beta-e04c6f40",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@abtnode/auth": "1.16.29-beta-
|
|
29
|
-
"@abtnode/constant": "1.16.29-beta-
|
|
30
|
-
"@abtnode/util": "1.16.29-beta-
|
|
28
|
+
"@abtnode/auth": "1.16.29-beta-e04c6f40",
|
|
29
|
+
"@abtnode/constant": "1.16.29-beta-e04c6f40",
|
|
30
|
+
"@abtnode/util": "1.16.29-beta-e04c6f40",
|
|
31
31
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
32
32
|
"@arcblock/did": "^1.18.123",
|
|
33
33
|
"@arcblock/did-connect": "^2.10.0",
|
|
@@ -37,10 +37,11 @@
|
|
|
37
37
|
"@arcblock/react-hooks": "^2.10.0",
|
|
38
38
|
"@arcblock/terminal": "^2.10.0",
|
|
39
39
|
"@arcblock/ux": "^2.10.0",
|
|
40
|
-
"@blocklet/constant": "1.16.29-beta-
|
|
40
|
+
"@blocklet/constant": "1.16.29-beta-e04c6f40",
|
|
41
|
+
"@blocklet/js-sdk": "1.16.29-beta-e04c6f40",
|
|
41
42
|
"@blocklet/launcher-layout": "2.3.22",
|
|
42
43
|
"@blocklet/list": "^0.12.114",
|
|
43
|
-
"@blocklet/meta": "1.16.29-beta-
|
|
44
|
+
"@blocklet/meta": "1.16.29-beta-e04c6f40",
|
|
44
45
|
"@blocklet/ui-react": "^2.10.0",
|
|
45
46
|
"@blocklet/uploader": "^0.1.10",
|
|
46
47
|
"@emotion/react": "^11.10.4",
|
|
@@ -107,5 +108,5 @@
|
|
|
107
108
|
"jest": "^29.7.0",
|
|
108
109
|
"jest-environment-jsdom": "^29.7.0"
|
|
109
110
|
},
|
|
110
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "f3e8f2ce931215b95ada33e87aee997d8ae52a69"
|
|
111
112
|
}
|