@abtnode/ux 1.16.26-beta-5251ab18 → 1.16.26-beta-351de484
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/blocklet/{oauth → authentication/federated}/federated-detail-dialog.js +2 -2
- package/es/blocklet/{oauth → authentication/federated}/federated-join-dialog.js +2 -2
- package/es/blocklet/{oauth → authentication/federated}/federated-site-list.js +3 -3
- package/es/blocklet/{oauth/federated.js → authentication/federated/index.js} +1 -1
- package/es/blocklet/{oauth → authentication}/index.js +7 -5
- package/es/blocklet/authentication/oauth/apple.js +198 -0
- package/es/blocklet/{oauth → authentication/oauth}/auth0.js +27 -7
- package/es/blocklet/authentication/oauth/drag-item.js +177 -0
- package/es/blocklet/authentication/oauth/github.js +145 -0
- package/es/blocklet/authentication/oauth/google.js +144 -0
- package/es/blocklet/authentication/oauth/index.js +122 -0
- package/es/blocklet/preferences/index.js +6 -6
- package/es/blocklet/publish/connect-store-list.js +8 -6
- package/es/blocklet/publish/create-release.js +16 -7
- package/es/blocklet/publish/project-list.js +30 -3
- package/es/blocklet/storage/action.js +8 -4
- package/es/blocklet/storage/item.js +2 -1
- package/es/confirm.js +5 -2
- package/es/contexts/blocklet-storage.js +0 -4
- package/es/layout/feedback.js +7 -4
- package/es/locales/ar.js +34 -5
- package/es/locales/de.js +35 -6
- package/es/locales/en.js +34 -5
- package/es/locales/es.js +35 -6
- package/es/locales/fr.js +35 -6
- package/es/locales/hi.js +35 -6
- package/es/locales/i18n.db +0 -0
- package/es/locales/id.js +35 -6
- package/es/locales/ja.js +34 -5
- package/es/locales/ko.js +35 -6
- package/es/locales/pt.js +35 -6
- package/es/locales/ru.js +34 -5
- package/es/locales/th.js +34 -5
- package/es/locales/vi.js +34 -5
- package/es/locales/zh-tw.js +34 -5
- package/es/locales/zh.js +35 -6
- package/es/store/connect-actions.js +14 -5
- package/es/store/delete.js +7 -3
- package/es/store/item.js +99 -20
- package/es/team/members/index.js +16 -13
- package/es/team/members/member.js +2 -7
- package/lib/blocklet/{oauth → authentication/federated}/federated-detail-dialog.js +2 -2
- package/lib/blocklet/{oauth → authentication/federated}/federated-join-dialog.js +2 -2
- package/lib/blocklet/{oauth → authentication/federated}/federated-site-list.js +3 -3
- package/lib/blocklet/{oauth/federated.js → authentication/federated/index.js} +1 -1
- package/lib/blocklet/{oauth → authentication}/index.js +7 -5
- package/lib/blocklet/authentication/oauth/apple.js +226 -0
- package/lib/blocklet/authentication/oauth/auth0.js +189 -0
- package/lib/blocklet/authentication/oauth/drag-item.js +185 -0
- package/lib/blocklet/{oauth/auth0.js → authentication/oauth/github.js} +26 -25
- package/lib/blocklet/authentication/oauth/google.js +166 -0
- package/lib/blocklet/authentication/oauth/index.js +136 -0
- package/lib/blocklet/preferences/index.js +6 -6
- package/lib/blocklet/publish/connect-store-list.js +9 -8
- package/lib/blocklet/publish/create-release.js +16 -6
- package/lib/blocklet/publish/project-list.js +29 -2
- package/lib/blocklet/storage/action.js +10 -6
- package/lib/blocklet/storage/item.js +2 -1
- package/lib/confirm.js +7 -4
- package/lib/contexts/blocklet-storage.js +0 -4
- package/lib/layout/feedback.js +6 -3
- package/lib/locales/ar.js +34 -5
- package/lib/locales/de.js +35 -6
- package/lib/locales/en.js +34 -5
- package/lib/locales/es.js +35 -6
- package/lib/locales/fr.js +35 -6
- package/lib/locales/hi.js +35 -6
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +35 -6
- package/lib/locales/ja.js +34 -5
- package/lib/locales/ko.js +35 -6
- package/lib/locales/pt.js +35 -6
- package/lib/locales/ru.js +34 -5
- package/lib/locales/th.js +34 -5
- package/lib/locales/vi.js +34 -5
- package/lib/locales/zh-tw.js +34 -5
- package/lib/locales/zh.js +35 -6
- package/lib/store/connect-actions.js +14 -5
- package/lib/store/delete.js +7 -3
- package/lib/store/item.js +111 -19
- package/lib/team/members/index.js +13 -11
- package/lib/team/members/member.js +1 -6
- package/package.json +32 -22
- /package/es/blocklet/{oauth → authentication}/common-settings.js +0 -0
- /package/es/blocklet/{oauth → authentication/federated}/federated-invite-dialog.js +0 -0
- /package/lib/blocklet/{oauth → authentication}/common-settings.js +0 -0
- /package/lib/blocklet/{oauth → authentication/federated}/federated-invite-dialog.js +0 -0
package/es/store/item.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { makeStyles } from '@mui/styles';
|
|
2
|
-
import { Typography, Button, ButtonGroup, CircularProgress } from '@mui/material';
|
|
1
|
+
import { makeStyles, styled } from '@mui/styles';
|
|
2
|
+
import { Typography, Button, ButtonGroup, CircularProgress, Box, Tooltip, tooltipClasses } from '@mui/material';
|
|
3
3
|
import LaunchIcon from '@mui/icons-material/Launch';
|
|
4
4
|
import PublishIcon from '@mui/icons-material/BackupOutlined';
|
|
5
5
|
import LinkOutlinedIcon from '@mui/icons-material/LinkOutlined';
|
|
6
|
+
import AdminPanelSettingsIcon from '@mui/icons-material/AdminPanelSettings';
|
|
6
7
|
import DoneIcon from '@mui/icons-material/Done';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
import { useEffect, useState } from 'react';
|
|
@@ -13,7 +14,8 @@ import DeleteStore from './delete';
|
|
|
13
14
|
import { useNodeContext } from '../contexts/node';
|
|
14
15
|
import { formatError } from '../util';
|
|
15
16
|
import ConnectActions from './connect-actions';
|
|
16
|
-
import
|
|
17
|
+
import DidAddress from '../did-address';
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
19
|
const useStyles = makeStyles(() => ({
|
|
18
20
|
buttonText: {
|
|
19
21
|
textTransform: 'none !important'
|
|
@@ -62,6 +64,28 @@ const useStyles = makeStyles(() => ({
|
|
|
62
64
|
backgroundColor: '#e0e0e0'
|
|
63
65
|
}
|
|
64
66
|
}));
|
|
67
|
+
const WhiteTooltip = styled(({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}) => /*#__PURE__*/_jsx(Tooltip, {
|
|
71
|
+
...props,
|
|
72
|
+
classes: {
|
|
73
|
+
popper: className
|
|
74
|
+
}
|
|
75
|
+
}))(({
|
|
76
|
+
theme
|
|
77
|
+
}) => ({
|
|
78
|
+
[`& .${tooltipClasses.tooltip}`]: {
|
|
79
|
+
backgroundColor: '#fff',
|
|
80
|
+
color: 'rgba(0, 0, 0, 0.87)',
|
|
81
|
+
maxWidth: 220,
|
|
82
|
+
borderRadius: 8,
|
|
83
|
+
padding: theme.spacing(2),
|
|
84
|
+
fontSize: theme.typography.pxToRem(12),
|
|
85
|
+
border: '1px solid rgba(0,0,0,0.08)',
|
|
86
|
+
boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.05)'
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
65
89
|
export default function StoreItem({
|
|
66
90
|
teamDid,
|
|
67
91
|
projectId,
|
|
@@ -70,7 +94,7 @@ export default function StoreItem({
|
|
|
70
94
|
onDelete,
|
|
71
95
|
kind,
|
|
72
96
|
published,
|
|
73
|
-
|
|
97
|
+
connectedStore,
|
|
74
98
|
releaseType,
|
|
75
99
|
onPublish
|
|
76
100
|
}) {
|
|
@@ -83,6 +107,7 @@ export default function StoreItem({
|
|
|
83
107
|
} = useNodeContext();
|
|
84
108
|
const [loading, setLoading] = useState(false);
|
|
85
109
|
const isPublish = kind === 'publish';
|
|
110
|
+
const connected = !!connectedStore;
|
|
86
111
|
const handleOpenUrl = e => {
|
|
87
112
|
e.stopPropagation();
|
|
88
113
|
if (isPublish) {
|
|
@@ -101,7 +126,8 @@ export default function StoreItem({
|
|
|
101
126
|
did: teamDid,
|
|
102
127
|
storeUrl: store.url,
|
|
103
128
|
storeId: store.id,
|
|
104
|
-
storeName: store.name
|
|
129
|
+
storeName: store.name,
|
|
130
|
+
projectId
|
|
105
131
|
}
|
|
106
132
|
}).then(res => {
|
|
107
133
|
if (!res?.url) {
|
|
@@ -145,18 +171,24 @@ export default function StoreItem({
|
|
|
145
171
|
}, [connected]);
|
|
146
172
|
return /*#__PURE__*/_jsxs("div", {
|
|
147
173
|
className: classes.box,
|
|
148
|
-
children: [loading && /*#__PURE__*/_jsx(CircularProgress, {
|
|
174
|
+
children: [!isPublish && loading && /*#__PURE__*/_jsx(CircularProgress, {
|
|
149
175
|
sx: {
|
|
150
176
|
marginRight: 2
|
|
151
177
|
},
|
|
152
178
|
size: 16
|
|
153
179
|
}), /*#__PURE__*/_jsxs("div", {
|
|
154
180
|
className: classes.menuName,
|
|
155
|
-
children: [/*#__PURE__*/_jsx(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
181
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
182
|
+
sx: {
|
|
183
|
+
display: 'flex',
|
|
184
|
+
flexDirection: 'row'
|
|
185
|
+
},
|
|
186
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
187
|
+
component: "span",
|
|
188
|
+
className: classes.title,
|
|
189
|
+
variant: "subtitle1",
|
|
190
|
+
children: store.name
|
|
191
|
+
})
|
|
160
192
|
}), /*#__PURE__*/_jsx(Typography, {
|
|
161
193
|
className: classes.url,
|
|
162
194
|
component: "span",
|
|
@@ -165,7 +197,29 @@ export default function StoreItem({
|
|
|
165
197
|
})]
|
|
166
198
|
}), /*#__PURE__*/_jsxs("div", {
|
|
167
199
|
className: classes.actions,
|
|
168
|
-
children: [
|
|
200
|
+
children: [connectedStore && /*#__PURE__*/_jsx(WhiteTooltip, {
|
|
201
|
+
placement: "left",
|
|
202
|
+
title: /*#__PURE__*/_jsxs(_Fragment, {
|
|
203
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
204
|
+
component: "span",
|
|
205
|
+
className: classes.title,
|
|
206
|
+
variant: "subtitle1",
|
|
207
|
+
children: connectedStore.developerName
|
|
208
|
+
}), /*#__PURE__*/_jsx(DidAddress, {
|
|
209
|
+
size: 14,
|
|
210
|
+
responsive: true,
|
|
211
|
+
did: connectedStore.developerDid
|
|
212
|
+
})]
|
|
213
|
+
}),
|
|
214
|
+
children: /*#__PURE__*/_jsx(AdminPanelSettingsIcon, {
|
|
215
|
+
sx: {
|
|
216
|
+
color: 'rgba(10,10,60,0.3)',
|
|
217
|
+
fontSize: 22,
|
|
218
|
+
marginRight: 1,
|
|
219
|
+
cursor: 'help'
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
}), isPublish && /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
169
223
|
disabled: loading,
|
|
170
224
|
variant: "outlined",
|
|
171
225
|
sx: {
|
|
@@ -176,10 +230,16 @@ export default function StoreItem({
|
|
|
176
230
|
sx: {
|
|
177
231
|
paddingLeft: 2,
|
|
178
232
|
paddingRight: 2,
|
|
179
|
-
fontSize: 15
|
|
233
|
+
fontSize: 15,
|
|
234
|
+
width: 130
|
|
180
235
|
},
|
|
181
236
|
onClick: handleConnectToStore,
|
|
182
|
-
children: [/*#__PURE__*/_jsx(
|
|
237
|
+
children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
|
|
238
|
+
sx: {
|
|
239
|
+
marginRight: 1
|
|
240
|
+
},
|
|
241
|
+
size: 16
|
|
242
|
+
}) : /*#__PURE__*/_jsx(LinkOutlinedIcon, {
|
|
183
243
|
sx: {
|
|
184
244
|
marginRight: 1
|
|
185
245
|
}
|
|
@@ -189,9 +249,15 @@ export default function StoreItem({
|
|
|
189
249
|
sx: {
|
|
190
250
|
paddingLeft: 2,
|
|
191
251
|
paddingRight: 2,
|
|
192
|
-
fontSize: 15
|
|
252
|
+
fontSize: 15,
|
|
253
|
+
width: 130
|
|
193
254
|
},
|
|
194
|
-
children: [/*#__PURE__*/_jsx(
|
|
255
|
+
children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
|
|
256
|
+
sx: {
|
|
257
|
+
marginRight: 1
|
|
258
|
+
},
|
|
259
|
+
size: 16
|
|
260
|
+
}) : /*#__PURE__*/_jsx(DoneIcon, {
|
|
195
261
|
sx: {
|
|
196
262
|
marginRight: 1
|
|
197
263
|
}
|
|
@@ -200,15 +266,23 @@ export default function StoreItem({
|
|
|
200
266
|
sx: {
|
|
201
267
|
paddingLeft: 2,
|
|
202
268
|
paddingRight: 2,
|
|
203
|
-
fontSize: 15
|
|
269
|
+
fontSize: 15,
|
|
270
|
+
width: 130
|
|
204
271
|
},
|
|
205
272
|
onClick: handleUploadToStore,
|
|
206
|
-
children: [/*#__PURE__*/_jsx(
|
|
273
|
+
children: [loading ? /*#__PURE__*/_jsx(CircularProgress, {
|
|
207
274
|
sx: {
|
|
208
275
|
marginRight: 1
|
|
276
|
+
},
|
|
277
|
+
size: 16
|
|
278
|
+
}) : /*#__PURE__*/_jsx(PublishIcon, {
|
|
279
|
+
sx: {
|
|
280
|
+
marginRight: 1,
|
|
281
|
+
fontSize: 20
|
|
209
282
|
}
|
|
210
283
|
}), t('common.upload')]
|
|
211
284
|
}), /*#__PURE__*/_jsx(ConnectActions, {
|
|
285
|
+
projectId: projectId,
|
|
212
286
|
connected: connected,
|
|
213
287
|
store: store,
|
|
214
288
|
onDelete: onDelete,
|
|
@@ -242,7 +316,12 @@ StoreItem.propTypes = {
|
|
|
242
316
|
kind: PropTypes.string,
|
|
243
317
|
teamDid: PropTypes.string.isRequired,
|
|
244
318
|
published: PropTypes.bool,
|
|
245
|
-
|
|
319
|
+
connectedStore: PropTypes.shape({
|
|
320
|
+
storeId: PropTypes.string,
|
|
321
|
+
storeUrl: PropTypes.string,
|
|
322
|
+
developerDid: PropTypes.string,
|
|
323
|
+
developerName: PropTypes.string
|
|
324
|
+
}),
|
|
246
325
|
projectId: PropTypes.string,
|
|
247
326
|
releaseId: PropTypes.string,
|
|
248
327
|
releaseType: PropTypes.string,
|
|
@@ -259,7 +338,7 @@ StoreItem.propTypes = {
|
|
|
259
338
|
StoreItem.defaultProps = {
|
|
260
339
|
kind: 'store',
|
|
261
340
|
published: false,
|
|
262
|
-
|
|
341
|
+
connectedStore: null,
|
|
263
342
|
releaseId: '',
|
|
264
343
|
projectId: '',
|
|
265
344
|
releaseType: '',
|
package/es/team/members/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import styled from '@emotion/styled';
|
|
|
5
5
|
import isEmpty from 'lodash/isEmpty';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
|
-
import { Badge, IconButton, Tooltip, Checkbox, Box, FormControlLabel } from '@mui/material';
|
|
8
|
+
import { Badge, IconButton, Tooltip, Checkbox, Box, FormControlLabel, useMediaQuery } from '@mui/material';
|
|
9
9
|
import Dialog, { useConfirm } from '@arcblock/ux/lib/Dialog';
|
|
10
10
|
import AddIcon from '@mui/icons-material/Add';
|
|
11
11
|
import LoopIcon from '@mui/icons-material/Loop';
|
|
@@ -20,7 +20,7 @@ import Datatable, { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
|
20
20
|
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
|
21
21
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
22
22
|
import { USER_TYPE } from '@abtnode/constant';
|
|
23
|
-
import { TeamEvents } from '@blocklet/constant';
|
|
23
|
+
import { TeamEvents, PROVIDER_NAME } from '@blocklet/constant';
|
|
24
24
|
import useUrlState from '@ahooksjs/use-url-state';
|
|
25
25
|
import { useMemoizedFn, useMount } from 'ahooks';
|
|
26
26
|
import { UserSessions } from '@blocklet/ui-react';
|
|
@@ -140,6 +140,7 @@ export default function MemberList({
|
|
|
140
140
|
const {
|
|
141
141
|
appIdList = []
|
|
142
142
|
} = useBlockletContext();
|
|
143
|
+
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
143
144
|
const {
|
|
144
145
|
teamDid,
|
|
145
146
|
invitations,
|
|
@@ -303,7 +304,8 @@ export default function MemberList({
|
|
|
303
304
|
customBodyRender: e => {
|
|
304
305
|
return /*#__PURE__*/_jsx(DidAddress, {
|
|
305
306
|
size: 14,
|
|
306
|
-
responsive:
|
|
307
|
+
responsive: !isMobile,
|
|
308
|
+
compact: isMobile,
|
|
307
309
|
copyable: false,
|
|
308
310
|
did: e
|
|
309
311
|
});
|
|
@@ -314,9 +316,14 @@ export default function MemberList({
|
|
|
314
316
|
name: 'lastLoginAt',
|
|
315
317
|
options: {
|
|
316
318
|
customBodyRender: e => {
|
|
317
|
-
return /*#__PURE__*/_jsx(
|
|
318
|
-
|
|
319
|
-
|
|
319
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
320
|
+
sx: {
|
|
321
|
+
minWidth: '100px'
|
|
322
|
+
},
|
|
323
|
+
children: /*#__PURE__*/_jsx(RelativeTime, {
|
|
324
|
+
value: e,
|
|
325
|
+
locale: locale
|
|
326
|
+
})
|
|
320
327
|
});
|
|
321
328
|
}
|
|
322
329
|
}
|
|
@@ -335,12 +342,7 @@ export default function MemberList({
|
|
|
335
342
|
customBodyRenderLite: rowIndex => {
|
|
336
343
|
const user = users[rowIndex];
|
|
337
344
|
const source = user.sourceProvider || USER_TYPE.WALLET;
|
|
338
|
-
const
|
|
339
|
-
auth0: 'Auth0',
|
|
340
|
-
wallet: 'DID wallet',
|
|
341
|
-
federated: 'Federated'
|
|
342
|
-
};
|
|
343
|
-
const providerName = providerNameMap[source] || source;
|
|
345
|
+
const providerName = PROVIDER_NAME[source] || source;
|
|
344
346
|
if (user.sourceAppPid) {
|
|
345
347
|
return `${providerName} (${t('team.member.federated')})`;
|
|
346
348
|
}
|
|
@@ -684,7 +686,8 @@ const Div = styled.div`
|
|
|
684
686
|
}
|
|
685
687
|
}
|
|
686
688
|
.right {
|
|
687
|
-
flex
|
|
689
|
+
flex: 1;
|
|
690
|
+
overflow: auto;
|
|
688
691
|
}
|
|
689
692
|
}
|
|
690
693
|
|
|
@@ -15,7 +15,7 @@ import AllowLoginIcon from '@arcblock/icons/lib/AllowLoginIcon';
|
|
|
15
15
|
import { getTextColor } from '@abtnode/auth/lib/util/create-passport-svg';
|
|
16
16
|
import { useReactive } from 'ahooks';
|
|
17
17
|
import { USER_TYPE } from '@abtnode/constant';
|
|
18
|
-
import { LOGIN_PROVIDER, TeamEvents } from '@blocklet/constant';
|
|
18
|
+
import { LOGIN_PROVIDER, PROVIDER_NAME, TeamEvents } from '@blocklet/constant';
|
|
19
19
|
import Tag from '../../tag';
|
|
20
20
|
import DidAddress from '../../did-address';
|
|
21
21
|
import Permission from '../../permission';
|
|
@@ -130,11 +130,6 @@ export default function Member({
|
|
|
130
130
|
await getData(teamDid, changedUser.did);
|
|
131
131
|
pageState.tab = defaultTab;
|
|
132
132
|
};
|
|
133
|
-
const providerNameMap = {
|
|
134
|
-
auth0: 'Auth0',
|
|
135
|
-
wallet: 'DID wallet',
|
|
136
|
-
federated: 'Federated'
|
|
137
|
-
};
|
|
138
133
|
|
|
139
134
|
// tab
|
|
140
135
|
const Info = () => {
|
|
@@ -149,7 +144,7 @@ export default function Member({
|
|
|
149
144
|
value: /*#__PURE__*/_jsx(Box, {
|
|
150
145
|
display: "flex",
|
|
151
146
|
alignItems: "center",
|
|
152
|
-
children:
|
|
147
|
+
children: PROVIDER_NAME[pageState.user?.sourceProvider || USER_TYPE.WALLET] || pageState.user?.sourceProvider
|
|
153
148
|
})
|
|
154
149
|
}, {
|
|
155
150
|
name: t('team.member.allowLogin'),
|
|
@@ -18,8 +18,8 @@ var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
|
|
|
18
18
|
var _Stars = _interopRequireDefault(require("@mui/icons-material/Stars"));
|
|
19
19
|
var _isUrl = _interopRequireDefault(require("is-url"));
|
|
20
20
|
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
21
|
-
var _blocklet = require("
|
|
22
|
-
var _node = require("
|
|
21
|
+
var _blocklet = require("../../../contexts/blocklet");
|
|
22
|
+
var _node = require("../../../contexts/node");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
const FederatedDetailDialog = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
@@ -14,8 +14,8 @@ var _material = require("@mui/material");
|
|
|
14
14
|
var _Theme = require("@arcblock/ux/lib/Theme");
|
|
15
15
|
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
16
16
|
var _isUrl = _interopRequireDefault(require("is-url"));
|
|
17
|
-
var _blocklet = require("
|
|
18
|
-
var _node = require("
|
|
17
|
+
var _blocklet = require("../../../contexts/blocklet");
|
|
18
|
+
var _node = require("../../../contexts/node");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
const FederatedJoinDialog = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
@@ -16,9 +16,9 @@ var _ahooks = require("ahooks");
|
|
|
16
16
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
17
17
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
18
18
|
var _constant = require("@blocklet/constant");
|
|
19
|
-
var _blocklet = require("
|
|
20
|
-
var _node = require("
|
|
21
|
-
var _confirm = _interopRequireDefault(require("
|
|
19
|
+
var _blocklet = require("../../../contexts/blocklet");
|
|
20
|
+
var _node = require("../../../contexts/node");
|
|
21
|
+
var _confirm = _interopRequireDefault(require("../../../hooks/confirm"));
|
|
22
22
|
var _federatedDetailDialog = _interopRequireDefault(require("./federated-detail-dialog"));
|
|
23
23
|
var _federatedInviteDialog = _interopRequireDefault(require("./federated-invite-dialog"));
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -11,7 +11,7 @@ var _ahooks = require("ahooks");
|
|
|
11
11
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
12
12
|
var _material = require("@mui/material");
|
|
13
13
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
14
|
-
var _blocklet = require("
|
|
14
|
+
var _blocklet = require("../../../contexts/blocklet");
|
|
15
15
|
var _federatedSiteList = _interopRequireDefault(require("./federated-site-list"));
|
|
16
16
|
var _federatedJoinDialog = _interopRequireDefault(require("./federated-join-dialog"));
|
|
17
17
|
var _federatedInviteDialog = _interopRequireDefault(require("./federated-invite-dialog"));
|
|
@@ -10,7 +10,7 @@ var _Tabs = _interopRequireDefault(require("@arcblock/ux/lib/Tabs"));
|
|
|
10
10
|
var _material = require("@mui/material");
|
|
11
11
|
var _ahooks = require("ahooks");
|
|
12
12
|
var _react = require("react");
|
|
13
|
-
var
|
|
13
|
+
var _oauth = _interopRequireDefault(require("./oauth"));
|
|
14
14
|
var _commonSettings = _interopRequireDefault(require("./common-settings"));
|
|
15
15
|
var _federated = _interopRequireDefault(require("./federated"));
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -37,9 +37,9 @@ function OAuth() {
|
|
|
37
37
|
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
38
38
|
textAlign: "center",
|
|
39
39
|
width: "100%",
|
|
40
|
-
children:
|
|
40
|
+
children: t('oauth.oauth')
|
|
41
41
|
}),
|
|
42
|
-
value: '
|
|
42
|
+
value: 'oauth'
|
|
43
43
|
}, {
|
|
44
44
|
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
45
45
|
textAlign: "center",
|
|
@@ -48,9 +48,11 @@ function OAuth() {
|
|
|
48
48
|
}),
|
|
49
49
|
value: 'more'
|
|
50
50
|
}];
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
// tabs[0].value
|
|
53
|
+
const [currentTab, setCurrentTab] = (0, _react.useState)('oauth');
|
|
52
54
|
const contents = (0, _ahooks.useCreation)(() => ({
|
|
53
|
-
|
|
55
|
+
oauth: /*#__PURE__*/(0, _jsxRuntime.jsx)(_oauth.default, {}),
|
|
54
56
|
federated: /*#__PURE__*/(0, _jsxRuntime.jsx)(_federated.default, {}),
|
|
55
57
|
more: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
56
58
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _material = require("@mui/material");
|
|
8
|
+
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
9
|
+
var _ahooks = require("ahooks");
|
|
10
|
+
var _reactHookForm = require("react-hook-form");
|
|
11
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
12
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
13
|
+
var _node = require("../../../contexts/node");
|
|
14
|
+
var _blocklet = require("../../../contexts/blocklet");
|
|
15
|
+
var _switchControl = _interopRequireDefault(require("../../component/switch-control"));
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
function OAuthApple() {
|
|
24
|
+
var _blocklet$meta, _blocklet$settings;
|
|
25
|
+
const {
|
|
26
|
+
api
|
|
27
|
+
} = (0, _node.useNodeContext)();
|
|
28
|
+
const {
|
|
29
|
+
blocklet
|
|
30
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
31
|
+
const {
|
|
32
|
+
t
|
|
33
|
+
} = (0, _context.useLocaleContext)();
|
|
34
|
+
const did = blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
|
|
35
|
+
const authData = Object.assign({
|
|
36
|
+
enabled: false,
|
|
37
|
+
teamId: '',
|
|
38
|
+
serviceId: '',
|
|
39
|
+
keyId: '',
|
|
40
|
+
authKey: ''
|
|
41
|
+
}, (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.apple) || {});
|
|
42
|
+
const {
|
|
43
|
+
handleSubmit,
|
|
44
|
+
control,
|
|
45
|
+
formState,
|
|
46
|
+
watch,
|
|
47
|
+
reset
|
|
48
|
+
} = (0, _reactHookForm.useForm)({
|
|
49
|
+
defaultValues: (0, _pick.default)(authData, ['enabled', 'teamId', 'serviceId', 'keyId', 'authKey'])
|
|
50
|
+
});
|
|
51
|
+
const enabled = watch('enabled');
|
|
52
|
+
const onSubmit = (0, _ahooks.useMemoizedFn)(async data => {
|
|
53
|
+
try {
|
|
54
|
+
var _blockletChanged$sett;
|
|
55
|
+
const {
|
|
56
|
+
blocklet: blockletChanged
|
|
57
|
+
} = await api.configOAuth({
|
|
58
|
+
input: {
|
|
59
|
+
did,
|
|
60
|
+
oauth: JSON.stringify({
|
|
61
|
+
apple: data
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const defaultValues = Object.assign({
|
|
66
|
+
enabled: false,
|
|
67
|
+
teamId: '',
|
|
68
|
+
serviceId: '',
|
|
69
|
+
keyId: '',
|
|
70
|
+
authKey: ''
|
|
71
|
+
}, (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.apple) || {});
|
|
72
|
+
// 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
|
|
73
|
+
reset(defaultValues);
|
|
74
|
+
_Toast.default.success(t('oauth.saveSuccess'));
|
|
75
|
+
} catch (err) {
|
|
76
|
+
_Toast.default.error(err.message || t('oauth.saveFailed'));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const validateTeamId = (0, _ahooks.useMemoizedFn)(val => {
|
|
80
|
+
if (!(val !== null && val !== void 0 && val.trim())) {
|
|
81
|
+
return t('oauth.apple.teamIdDescribe');
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
});
|
|
85
|
+
const validateServiceId = (0, _ahooks.useMemoizedFn)(val => {
|
|
86
|
+
if (!(val !== null && val !== void 0 && val.trim())) {
|
|
87
|
+
return t('oauth.apple.serviceIdDescribe');
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
});
|
|
91
|
+
const validateKeyId = (0, _ahooks.useMemoizedFn)(val => {
|
|
92
|
+
if (!(val !== null && val !== void 0 && val.trim())) {
|
|
93
|
+
return t('oauth.apple.keyIdDescribe');
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
});
|
|
97
|
+
const validateAuthKey = (0, _ahooks.useMemoizedFn)(val => {
|
|
98
|
+
if (!(val !== null && val !== void 0 && val.trim())) {
|
|
99
|
+
return t('oauth.apple.authKeyDescribe');
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
});
|
|
103
|
+
const noop = (0, _ahooks.useMemoizedFn)(() => true);
|
|
104
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
|
|
106
|
+
onSubmit: handleSubmit(onSubmit),
|
|
107
|
+
disabled: true,
|
|
108
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
109
|
+
name: "enabled",
|
|
110
|
+
control: control,
|
|
111
|
+
render: _ref => {
|
|
112
|
+
let {
|
|
113
|
+
field
|
|
114
|
+
} = _ref;
|
|
115
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
116
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_switchControl.default, _objectSpread({
|
|
117
|
+
checked: field.value,
|
|
118
|
+
style: {
|
|
119
|
+
marginRight: '6px'
|
|
120
|
+
}
|
|
121
|
+
}, field)),
|
|
122
|
+
label: t('oauth.apple.enable'),
|
|
123
|
+
sx: {
|
|
124
|
+
marginBottom: 2,
|
|
125
|
+
ml: 1
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
130
|
+
name: "teamId",
|
|
131
|
+
control: control,
|
|
132
|
+
rules: {
|
|
133
|
+
validate: enabled ? validateTeamId : noop
|
|
134
|
+
},
|
|
135
|
+
render: _ref2 => {
|
|
136
|
+
var _formState$errors$fie;
|
|
137
|
+
let {
|
|
138
|
+
field
|
|
139
|
+
} = _ref2;
|
|
140
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
141
|
+
fullWidth: true,
|
|
142
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
|
|
143
|
+
error: !!formState.errors[field.name],
|
|
144
|
+
label: t('oauth.apple.teamId'),
|
|
145
|
+
helperText: ((_formState$errors$fie = formState.errors[field.name]) === null || _formState$errors$fie === void 0 ? void 0 : _formState$errors$fie.message) || ' ',
|
|
146
|
+
disabled: !enabled
|
|
147
|
+
}))
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
151
|
+
name: "serviceId",
|
|
152
|
+
control: control,
|
|
153
|
+
rules: {
|
|
154
|
+
validate: enabled ? validateServiceId : noop
|
|
155
|
+
},
|
|
156
|
+
render: _ref3 => {
|
|
157
|
+
var _formState$errors$fie2;
|
|
158
|
+
let {
|
|
159
|
+
field
|
|
160
|
+
} = _ref3;
|
|
161
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
162
|
+
fullWidth: true,
|
|
163
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
|
|
164
|
+
error: !!formState.errors[field.name],
|
|
165
|
+
label: t('oauth.apple.serviceId'),
|
|
166
|
+
helperText: ((_formState$errors$fie2 = formState.errors[field.name]) === null || _formState$errors$fie2 === void 0 ? void 0 : _formState$errors$fie2.message) || ' ',
|
|
167
|
+
disabled: !enabled
|
|
168
|
+
}))
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
172
|
+
name: "keyId",
|
|
173
|
+
control: control,
|
|
174
|
+
rules: {
|
|
175
|
+
validate: enabled ? validateKeyId : noop
|
|
176
|
+
},
|
|
177
|
+
render: _ref4 => {
|
|
178
|
+
var _formState$errors$fie3;
|
|
179
|
+
let {
|
|
180
|
+
field
|
|
181
|
+
} = _ref4;
|
|
182
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
183
|
+
fullWidth: true,
|
|
184
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
|
|
185
|
+
error: !!formState.errors[field.name],
|
|
186
|
+
label: t('oauth.apple.keyId'),
|
|
187
|
+
helperText: ((_formState$errors$fie3 = formState.errors[field.name]) === null || _formState$errors$fie3 === void 0 ? void 0 : _formState$errors$fie3.message) || ' ',
|
|
188
|
+
disabled: !enabled
|
|
189
|
+
}))
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
193
|
+
name: "authKey",
|
|
194
|
+
control: control,
|
|
195
|
+
rules: {
|
|
196
|
+
validate: enabled ? validateAuthKey : noop
|
|
197
|
+
},
|
|
198
|
+
render: _ref5 => {
|
|
199
|
+
var _formState$errors$fie4;
|
|
200
|
+
let {
|
|
201
|
+
field
|
|
202
|
+
} = _ref5;
|
|
203
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
204
|
+
fullWidth: true,
|
|
205
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
|
|
206
|
+
type: "password",
|
|
207
|
+
multiline: true,
|
|
208
|
+
rows: 4,
|
|
209
|
+
label: t('oauth.apple.authKey'),
|
|
210
|
+
error: !!formState.errors[field.name],
|
|
211
|
+
helperText: ((_formState$errors$fie4 = formState.errors[field.name]) === null || _formState$errors$fie4 === void 0 ? void 0 : _formState$errors$fie4.message) || ' ',
|
|
212
|
+
disabled: !enabled
|
|
213
|
+
}))
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
217
|
+
type: "submit",
|
|
218
|
+
variant: "contained",
|
|
219
|
+
onSubmit: handleSubmit(onSubmit),
|
|
220
|
+
disabled: !formState.isDirty,
|
|
221
|
+
children: t('oauth.save')
|
|
222
|
+
})]
|
|
223
|
+
})
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
var _default = exports.default = OAuthApple;
|