@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
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Box, Button, FormControl, FormControlLabel, TextField } from '@mui/material';
|
|
2
|
+
import pick from 'lodash/pick';
|
|
3
|
+
import { useMemoizedFn } from 'ahooks';
|
|
4
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
5
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
7
|
+
import { useNodeContext } from '../../../contexts/node';
|
|
8
|
+
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
9
|
+
import SwitchControl from '../../component/switch-control';
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function OAuthGoogle() {
|
|
12
|
+
const {
|
|
13
|
+
api
|
|
14
|
+
} = useNodeContext();
|
|
15
|
+
const {
|
|
16
|
+
blocklet
|
|
17
|
+
} = useBlockletContext();
|
|
18
|
+
const {
|
|
19
|
+
t
|
|
20
|
+
} = useLocaleContext();
|
|
21
|
+
const did = blocklet?.meta?.did;
|
|
22
|
+
const authData = Object.assign({
|
|
23
|
+
enabled: false,
|
|
24
|
+
clientId: '',
|
|
25
|
+
clientSecret: ''
|
|
26
|
+
}, blocklet?.settings?.oauth?.google || {});
|
|
27
|
+
const {
|
|
28
|
+
handleSubmit,
|
|
29
|
+
control,
|
|
30
|
+
formState,
|
|
31
|
+
watch,
|
|
32
|
+
reset
|
|
33
|
+
} = useForm({
|
|
34
|
+
defaultValues: pick(authData, ['clientSecret', 'clientId', 'enabled'])
|
|
35
|
+
});
|
|
36
|
+
const enabled = watch('enabled');
|
|
37
|
+
const onSubmit = useMemoizedFn(async data => {
|
|
38
|
+
try {
|
|
39
|
+
const {
|
|
40
|
+
blocklet: blockletChanged
|
|
41
|
+
} = await api.configOAuth({
|
|
42
|
+
input: {
|
|
43
|
+
did,
|
|
44
|
+
oauth: JSON.stringify({
|
|
45
|
+
google: data
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const defaultValues = Object.assign({
|
|
50
|
+
enabled: false,
|
|
51
|
+
clientId: '',
|
|
52
|
+
clientSecret: ''
|
|
53
|
+
}, blockletChanged?.settings?.oauth?.google || {});
|
|
54
|
+
// 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
|
|
55
|
+
reset(defaultValues);
|
|
56
|
+
Toast.success(t('oauth.saveSuccess'));
|
|
57
|
+
} catch (err) {
|
|
58
|
+
Toast.error(err.message || t('oauth.saveFailed'));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const validateClientId = useMemoizedFn(val => {
|
|
62
|
+
if (!val?.trim()) {
|
|
63
|
+
return t('oauth.google.clientIdDescribe');
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
});
|
|
67
|
+
const validateClientSecret = useMemoizedFn(val => {
|
|
68
|
+
if (!val?.trim()) {
|
|
69
|
+
return t('oauth.google.clientSecretDescribe');
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
});
|
|
73
|
+
const noop = useMemoizedFn(() => true);
|
|
74
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
75
|
+
children: /*#__PURE__*/_jsxs("form", {
|
|
76
|
+
onSubmit: handleSubmit(onSubmit),
|
|
77
|
+
disabled: true,
|
|
78
|
+
children: [/*#__PURE__*/_jsx(Controller, {
|
|
79
|
+
name: "enabled",
|
|
80
|
+
control: control,
|
|
81
|
+
render: ({
|
|
82
|
+
field
|
|
83
|
+
}) => /*#__PURE__*/_jsx(FormControlLabel, {
|
|
84
|
+
control: /*#__PURE__*/_jsx(SwitchControl, {
|
|
85
|
+
checked: field.value,
|
|
86
|
+
style: {
|
|
87
|
+
marginRight: '6px'
|
|
88
|
+
},
|
|
89
|
+
...field
|
|
90
|
+
}),
|
|
91
|
+
label: t('oauth.google.enable'),
|
|
92
|
+
sx: {
|
|
93
|
+
marginBottom: 2,
|
|
94
|
+
ml: 1
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
}), /*#__PURE__*/_jsx(Controller, {
|
|
98
|
+
name: "clientId",
|
|
99
|
+
control: control,
|
|
100
|
+
rules: {
|
|
101
|
+
validate: enabled ? validateClientId : noop
|
|
102
|
+
},
|
|
103
|
+
render: ({
|
|
104
|
+
field
|
|
105
|
+
}) => /*#__PURE__*/_jsx(FormControl, {
|
|
106
|
+
fullWidth: true,
|
|
107
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
108
|
+
...field,
|
|
109
|
+
error: !!formState.errors[field.name],
|
|
110
|
+
label: t('oauth.google.clientId'),
|
|
111
|
+
helperText: formState.errors[field.name]?.message || ' ',
|
|
112
|
+
disabled: !enabled
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
}), /*#__PURE__*/_jsx(Controller, {
|
|
116
|
+
name: "clientSecret",
|
|
117
|
+
control: control,
|
|
118
|
+
rules: {
|
|
119
|
+
validate: enabled ? validateClientSecret : noop
|
|
120
|
+
},
|
|
121
|
+
render: ({
|
|
122
|
+
field
|
|
123
|
+
}) => /*#__PURE__*/_jsx(FormControl, {
|
|
124
|
+
fullWidth: true,
|
|
125
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
126
|
+
...field,
|
|
127
|
+
type: "password",
|
|
128
|
+
label: t('oauth.google.clientSecret'),
|
|
129
|
+
error: !!formState.errors[field.name],
|
|
130
|
+
helperText: formState.errors[field.name]?.message || ' ',
|
|
131
|
+
disabled: !enabled
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
135
|
+
type: "submit",
|
|
136
|
+
variant: "contained",
|
|
137
|
+
onSubmit: handleSubmit(onSubmit),
|
|
138
|
+
disabled: !formState.isDirty,
|
|
139
|
+
children: t('oauth.save')
|
|
140
|
+
})]
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
export default OAuthGoogle;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { useCreation, useMemoizedFn, useReactive } from 'ahooks';
|
|
3
|
+
import { DndProvider } from 'react-dnd';
|
|
4
|
+
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
5
|
+
import { Icon } from '@iconify/react';
|
|
6
|
+
import AppleIcon from '@iconify-icons/logos/apple';
|
|
7
|
+
import GithubIcon from '@iconify-icons/logos/github-icon';
|
|
8
|
+
import GoogleIcon from '@iconify-icons/logos/google-icon';
|
|
9
|
+
import Auth0Icon from '@iconify-icons/logos/auth0-icon';
|
|
10
|
+
import OAuthAuth0 from './auth0';
|
|
11
|
+
import OAuthGithub from './github';
|
|
12
|
+
import OAuthGoogle from './google';
|
|
13
|
+
import OAuthApple from './apple';
|
|
14
|
+
import DragItem from './drag-item';
|
|
15
|
+
import { useNodeContext } from '../../../contexts/node';
|
|
16
|
+
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
const avaliableAuthentication = [{
|
|
19
|
+
name: 'github',
|
|
20
|
+
title: 'GitHub',
|
|
21
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
22
|
+
icon: GithubIcon
|
|
23
|
+
}),
|
|
24
|
+
component: /*#__PURE__*/_jsx(OAuthGithub, {})
|
|
25
|
+
}, {
|
|
26
|
+
name: 'google',
|
|
27
|
+
title: 'Google',
|
|
28
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
29
|
+
icon: GoogleIcon
|
|
30
|
+
}),
|
|
31
|
+
component: /*#__PURE__*/_jsx(OAuthGoogle, {})
|
|
32
|
+
}, {
|
|
33
|
+
name: 'apple',
|
|
34
|
+
title: 'Apple',
|
|
35
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
36
|
+
icon: AppleIcon
|
|
37
|
+
}),
|
|
38
|
+
component: /*#__PURE__*/_jsx(OAuthApple, {})
|
|
39
|
+
}, {
|
|
40
|
+
name: 'auth0',
|
|
41
|
+
title: 'Auth0',
|
|
42
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
43
|
+
icon: Auth0Icon
|
|
44
|
+
}),
|
|
45
|
+
component: /*#__PURE__*/_jsx(OAuthAuth0, {})
|
|
46
|
+
}];
|
|
47
|
+
const DEFAULT_OAUTH_LIST = ['github', 'google', 'apple', 'auth0'];
|
|
48
|
+
export default function OAuthLogin() {
|
|
49
|
+
const {
|
|
50
|
+
api
|
|
51
|
+
} = useNodeContext();
|
|
52
|
+
const {
|
|
53
|
+
blocklet
|
|
54
|
+
} = useBlockletContext();
|
|
55
|
+
const did = blocklet?.meta?.did;
|
|
56
|
+
const oauthConfig = blocklet?.settings?.oauth || {};
|
|
57
|
+
const oauthSort = Object.keys(oauthConfig).sort((a, b) => {
|
|
58
|
+
if (oauthConfig[a]?.order !== undefined && oauthConfig[b]?.order !== undefined) {
|
|
59
|
+
return oauthConfig[a].order - oauthConfig[b].order;
|
|
60
|
+
}
|
|
61
|
+
if (oauthConfig[a]?.order !== undefined) {
|
|
62
|
+
return -1;
|
|
63
|
+
}
|
|
64
|
+
return 1;
|
|
65
|
+
});
|
|
66
|
+
for (const OAUTH_ITEM of DEFAULT_OAUTH_LIST) {
|
|
67
|
+
if (!oauthSort.includes(OAUTH_ITEM)) {
|
|
68
|
+
oauthSort.push(OAUTH_ITEM);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const sortMaps = useReactive(oauthSort.reduce((total, value, index) => Object.assign(total, {
|
|
72
|
+
[value]: index
|
|
73
|
+
}), {}));
|
|
74
|
+
const sortedAuthentication = useCreation(() => {
|
|
75
|
+
const list = [...avaliableAuthentication];
|
|
76
|
+
list.sort((a, b) => sortMaps[a.name] - sortMaps[b.name]);
|
|
77
|
+
return list;
|
|
78
|
+
}, [sortMaps.auth0, sortMaps.github, sortMaps.google]);
|
|
79
|
+
const dndProps = {};
|
|
80
|
+
if (typeof window !== 'undefined') {
|
|
81
|
+
dndProps.context = window;
|
|
82
|
+
}
|
|
83
|
+
const saveOrder = useMemoizedFn(async rawOrderData => {
|
|
84
|
+
const orderData = {};
|
|
85
|
+
Object.keys(rawOrderData).forEach(oauthName => {
|
|
86
|
+
orderData[oauthName] = {
|
|
87
|
+
order: rawOrderData[oauthName]
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
await api.configOAuth({
|
|
91
|
+
input: {
|
|
92
|
+
did,
|
|
93
|
+
oauth: JSON.stringify(orderData)
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
const handleMoveItem = useMemoizedFn((dragIndex, hoverIndex) => {
|
|
98
|
+
const dragItem = sortedAuthentication[dragIndex];
|
|
99
|
+
const hoverItem = sortedAuthentication[hoverIndex];
|
|
100
|
+
sortMaps[dragItem.name] = hoverIndex;
|
|
101
|
+
sortMaps[hoverItem.name] = dragIndex;
|
|
102
|
+
});
|
|
103
|
+
const handleSaveOrder = useMemoizedFn(async () => {
|
|
104
|
+
await saveOrder(sortMaps);
|
|
105
|
+
});
|
|
106
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
107
|
+
children: /*#__PURE__*/_jsx(DndProvider, {
|
|
108
|
+
backend: HTML5Backend,
|
|
109
|
+
...dndProps,
|
|
110
|
+
children: sortedAuthentication.map((x, index) => /*#__PURE__*/_jsx(DragItem, {
|
|
111
|
+
index: index,
|
|
112
|
+
id: x.name,
|
|
113
|
+
title: x.title,
|
|
114
|
+
icon: x.icon,
|
|
115
|
+
onMove: handleMoveItem,
|
|
116
|
+
onEnd: handleSaveOrder,
|
|
117
|
+
defaultExpand: x.enabled,
|
|
118
|
+
children: x.component
|
|
119
|
+
}, x.name))
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
}
|
|
@@ -22,7 +22,7 @@ import BlockletConfiguration from '../configuration';
|
|
|
22
22
|
import BlockletNotification from '../notification';
|
|
23
23
|
import Access from '../access/index';
|
|
24
24
|
import { useNodeContext } from '../../contexts/node';
|
|
25
|
-
import
|
|
25
|
+
import Authentication from '../authentication';
|
|
26
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
27
|
const addComponentTabs = ({
|
|
28
28
|
tabs,
|
|
@@ -129,7 +129,7 @@ export default function BlockletPreferences({
|
|
|
129
129
|
label: /*#__PURE__*/_jsxs(Box, {
|
|
130
130
|
display: "flex",
|
|
131
131
|
alignItems: "center",
|
|
132
|
-
"data-cy": "configuration-tab-
|
|
132
|
+
"data-cy": "configuration-tab-authentication",
|
|
133
133
|
children: [/*#__PURE__*/_jsx(LoginIcon, {
|
|
134
134
|
sx: {
|
|
135
135
|
fontSize: 24
|
|
@@ -143,8 +143,8 @@ export default function BlockletPreferences({
|
|
|
143
143
|
children: t('common.login')
|
|
144
144
|
})
|
|
145
145
|
})]
|
|
146
|
-
}, "
|
|
147
|
-
value: '
|
|
146
|
+
}, "authentication"),
|
|
147
|
+
value: 'authentication'
|
|
148
148
|
}, {
|
|
149
149
|
label: /*#__PURE__*/_jsxs(Box, {
|
|
150
150
|
display: "flex",
|
|
@@ -225,8 +225,8 @@ export default function BlockletPreferences({
|
|
|
225
225
|
});
|
|
226
226
|
} else if (current === 'access') {
|
|
227
227
|
content = /*#__PURE__*/_jsx(Access, {});
|
|
228
|
-
} else if (current === '
|
|
229
|
-
content = /*#__PURE__*/_jsx(
|
|
228
|
+
} else if (current === 'authentication') {
|
|
229
|
+
content = /*#__PURE__*/_jsx(Authentication, {});
|
|
230
230
|
} else if (current === 'notification') {
|
|
231
231
|
content = /*#__PURE__*/_jsx(BlockletNotification, {});
|
|
232
232
|
} else {
|
|
@@ -7,6 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
function ConnectStoreList({
|
|
8
8
|
blocklet,
|
|
9
9
|
releaseId,
|
|
10
|
+
connectedStores,
|
|
10
11
|
projectId,
|
|
11
12
|
releaseType,
|
|
12
13
|
publishedStoreIds,
|
|
@@ -15,14 +16,14 @@ function ConnectStoreList({
|
|
|
15
16
|
}) {
|
|
16
17
|
const storeList = blocklet?.settings?.storeList || [];
|
|
17
18
|
const connectedMap = useMemo(() => {
|
|
18
|
-
if (!
|
|
19
|
+
if (!connectedStores?.length) {
|
|
19
20
|
return {};
|
|
20
21
|
}
|
|
21
|
-
return
|
|
22
|
-
acc[x.
|
|
22
|
+
return connectedStores?.reduce((acc, x) => {
|
|
23
|
+
acc[x.storeId] = x;
|
|
23
24
|
return acc;
|
|
24
25
|
}, {});
|
|
25
|
-
}, [
|
|
26
|
+
}, [connectedStores]);
|
|
26
27
|
const did = blocklet?.meta?.did;
|
|
27
28
|
const handleAddStore = () => {};
|
|
28
29
|
return /*#__PURE__*/_jsxs(List, {
|
|
@@ -37,7 +38,7 @@ function ConnectStoreList({
|
|
|
37
38
|
teamDid: did,
|
|
38
39
|
store: x,
|
|
39
40
|
published: publishedStoreIds?.indexOf(x.id) > -1,
|
|
40
|
-
|
|
41
|
+
connectedStore: connectedMap[x.id],
|
|
41
42
|
onPublish: onPublish,
|
|
42
43
|
onDelete: onDelete
|
|
43
44
|
})
|
|
@@ -56,7 +57,8 @@ ConnectStoreList.propTypes = {
|
|
|
56
57
|
releaseType: PropTypes.string.isRequired,
|
|
57
58
|
onPublish: PropTypes.func,
|
|
58
59
|
onDelete: PropTypes.func,
|
|
59
|
-
publishedStoreIds: PropTypes.arrayOf(PropTypes.string)
|
|
60
|
+
publishedStoreIds: PropTypes.arrayOf(PropTypes.string),
|
|
61
|
+
connectedStores: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
60
62
|
};
|
|
61
63
|
ConnectStoreList.defaultProps = {
|
|
62
64
|
publishedStoreIds: [],
|
|
@@ -25,7 +25,7 @@ import Tabs from '@arcblock/ux/lib/Tabs';
|
|
|
25
25
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
26
26
|
import Alert from '@arcblock/ux/lib/Alert';
|
|
27
27
|
import { PROJECT } from '@blocklet/constant';
|
|
28
|
-
import { WELLKNOWN_SERVICE_PATH_PREFIX, UNOWNED_DID } from '@abtnode/constant';
|
|
28
|
+
import { EVENTS, STUDIO_CONNECTED_STORE, WELLKNOWN_SERVICE_PATH_PREFIX, UNOWNED_DID } from '@abtnode/constant';
|
|
29
29
|
import BlockletBundleAvatar from '../bundle-avatar';
|
|
30
30
|
import { useSessionContext } from '../../contexts/session';
|
|
31
31
|
import { useNodeContext } from '../../contexts/node';
|
|
@@ -108,9 +108,10 @@ const addComponentTabs = ({
|
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
110
|
const pickParams = (release, app) => {
|
|
111
|
-
const params = pick(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'blockletComponents', 'publishedStoreIds', 'note']);
|
|
111
|
+
const params = pick(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'blockletComponents', 'publishedStoreIds', 'connectedStores', 'note']);
|
|
112
112
|
params.blockletScreenshots ||= [];
|
|
113
113
|
params.publishedStoreIds ||= [];
|
|
114
|
+
params.connectedStores ||= [];
|
|
114
115
|
if (!params.blockletComponents) {
|
|
115
116
|
params.blockletComponents = (app.children || []).map(x => ({
|
|
116
117
|
did: x.meta.did,
|
|
@@ -150,7 +151,10 @@ export default function CreateRelease({
|
|
|
150
151
|
const [createLoading, setCreateLoading] = useState(false);
|
|
151
152
|
const [release, setRelease] = useState(null);
|
|
152
153
|
const {
|
|
153
|
-
api
|
|
154
|
+
api,
|
|
155
|
+
ws: {
|
|
156
|
+
useSubscription
|
|
157
|
+
}
|
|
154
158
|
} = useNodeContext();
|
|
155
159
|
const uploaderLogoRef = useRef(null);
|
|
156
160
|
const uploaderScreenshotRef = useRef(null);
|
|
@@ -217,7 +221,7 @@ export default function CreateRelease({
|
|
|
217
221
|
}
|
|
218
222
|
}).then(res => {
|
|
219
223
|
setLoading(false);
|
|
220
|
-
setParams(pickParams(res?.release, blocklet));
|
|
224
|
+
// setParams(pickParams(res?.release, blocklet));
|
|
221
225
|
setRelease(res?.release);
|
|
222
226
|
}).catch(err => {
|
|
223
227
|
setLoading(false);
|
|
@@ -232,9 +236,7 @@ export default function CreateRelease({
|
|
|
232
236
|
}
|
|
233
237
|
getRelease();
|
|
234
238
|
}
|
|
235
|
-
|
|
236
|
-
getProject();
|
|
237
|
-
}
|
|
239
|
+
getProject();
|
|
238
240
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
239
241
|
}, [mode, releaseId]);
|
|
240
242
|
const onRelease = status => {
|
|
@@ -367,6 +369,11 @@ export default function CreateRelease({
|
|
|
367
369
|
useEffect(() => {
|
|
368
370
|
getData();
|
|
369
371
|
}, [getData]);
|
|
372
|
+
useSubscription(EVENTS.NOTIFICATION_BLOCKLET_CREATE, notification => {
|
|
373
|
+
if (notification?.meta?.eventType === STUDIO_CONNECTED_STORE) {
|
|
374
|
+
getData();
|
|
375
|
+
}
|
|
376
|
+
}, [getData]);
|
|
370
377
|
if (!params && loading) {
|
|
371
378
|
return /*#__PURE__*/_jsx(EmptySpinner, {});
|
|
372
379
|
}
|
|
@@ -951,6 +958,8 @@ export default function CreateRelease({
|
|
|
951
958
|
projectId: projectId,
|
|
952
959
|
releaseId: releaseId,
|
|
953
960
|
onPublish: getRelease,
|
|
961
|
+
onDelete: getData,
|
|
962
|
+
connectedStores: params.connectedStores,
|
|
954
963
|
publishedStoreIds: release?.publishedStoreIds
|
|
955
964
|
})
|
|
956
965
|
})]
|
|
@@ -10,6 +10,7 @@ import DeleteIcon from '@mui/icons-material/Delete';
|
|
|
10
10
|
import VisibilityIcon from '@mui/icons-material/FileOpen';
|
|
11
11
|
import NewFileIcon from '@mui/icons-material/AddBox';
|
|
12
12
|
import HelpOutlineOutlinedIcon from '@mui/icons-material/HelpOutlineOutlined';
|
|
13
|
+
import ErrorIcon from '@mui/icons-material/Error';
|
|
13
14
|
import { UNOWNED_DID } from '@abtnode/constant';
|
|
14
15
|
import Datatable from '@arcblock/ux/lib/Datatable';
|
|
15
16
|
import Button from '@arcblock/ux/lib/Button';
|
|
@@ -17,7 +18,7 @@ import Toast from '@arcblock/ux/lib/Toast';
|
|
|
17
18
|
import Tag from '@arcblock/ux/lib/Tag';
|
|
18
19
|
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
|
19
20
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
20
|
-
import { Tooltip } from '@mui/material';
|
|
21
|
+
import { Tooltip, Typography } from '@mui/material';
|
|
21
22
|
import { useSessionContext } from '../../contexts/session';
|
|
22
23
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
23
24
|
import { useNodeContext } from '../../contexts/node';
|
|
@@ -357,10 +358,36 @@ export default function ProjectList() {
|
|
|
357
358
|
}
|
|
358
359
|
}), deleteConfirm && /*#__PURE__*/_jsx(Confirm, {
|
|
359
360
|
title: `${t('common.delete')} ${deleteConfirm.blockletTitle}`,
|
|
360
|
-
description: t('blocklet.publish.
|
|
361
|
+
description: t('blocklet.publish.deleteProject.description'),
|
|
361
362
|
confirm: t('common.confirm'),
|
|
362
363
|
onConfirm: confirmDeleteProject,
|
|
363
|
-
onCancel: () => setDeleteConfirm(null)
|
|
364
|
+
onCancel: () => setDeleteConfirm(null),
|
|
365
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
366
|
+
sx: {
|
|
367
|
+
marginTop: 2
|
|
368
|
+
},
|
|
369
|
+
children: [t('blocklet.publish.deleteProject.tip1'), t('blocklet.publish.deleteProject.tip2'), t('blocklet.publish.deleteProject.tip3')].map(x => /*#__PURE__*/_jsxs(Box, {
|
|
370
|
+
sx: {
|
|
371
|
+
display: 'flex',
|
|
372
|
+
marginTop: 1,
|
|
373
|
+
flexDirection: 'row',
|
|
374
|
+
alignItems: 'flex-start'
|
|
375
|
+
},
|
|
376
|
+
children: [/*#__PURE__*/_jsx(ErrorIcon, {
|
|
377
|
+
color: "warning",
|
|
378
|
+
sx: {
|
|
379
|
+
marginRight: 1,
|
|
380
|
+
fontSize: 20,
|
|
381
|
+
marginTop: '2px'
|
|
382
|
+
}
|
|
383
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
384
|
+
component: "span",
|
|
385
|
+
variant: "inherit",
|
|
386
|
+
color: "text.secondary",
|
|
387
|
+
children: x
|
|
388
|
+
})]
|
|
389
|
+
}))
|
|
390
|
+
})
|
|
364
391
|
}), didConnect]
|
|
365
392
|
});
|
|
366
393
|
}
|
|
@@ -17,7 +17,8 @@ import DeleteDIDSpacesGateWay from './delete';
|
|
|
17
17
|
* onDelete: (spaceGateway: import('./connected').SpaceGateway) => Promise<void>,
|
|
18
18
|
* onConnect: (spaceGateway: import('./connected').SpaceGateway) => Promise<void>,
|
|
19
19
|
* enableSwitchToSpace: true | false,
|
|
20
|
-
* connected: false | true
|
|
20
|
+
* connected: false | true,
|
|
21
|
+
* backupInProgress: false | true,
|
|
21
22
|
* } & import('@mui/material').IconButtonProps} { spaceGateway, onDelete, onConnect, enableSwitchToSpace, connected, ...rest }
|
|
22
23
|
* @return {React.Component}
|
|
23
24
|
*/
|
|
@@ -28,6 +29,7 @@ function SpaceItemAction({
|
|
|
28
29
|
onDelete,
|
|
29
30
|
onConnect,
|
|
30
31
|
enableSwitchToSpace,
|
|
32
|
+
backupInProgress,
|
|
31
33
|
...rest
|
|
32
34
|
}) {
|
|
33
35
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -117,7 +119,7 @@ function SpaceItemAction({
|
|
|
117
119
|
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
118
120
|
children: t('storage.spaces.connect.switchToSpace')
|
|
119
121
|
})]
|
|
120
|
-
}), !
|
|
122
|
+
}), !backupInProgress && /*#__PURE__*/_jsx(DeleteDIDSpacesGateWay, {
|
|
121
123
|
spaceGateway: spaceGateway,
|
|
122
124
|
onDelete: onDelete
|
|
123
125
|
})]
|
|
@@ -135,11 +137,13 @@ SpaceItemAction.propTypes = {
|
|
|
135
137
|
connected: PropTypes.bool.isRequired,
|
|
136
138
|
enableSwitchToSpace: PropTypes.bool,
|
|
137
139
|
onDelete: PropTypes.func,
|
|
138
|
-
onConnect: PropTypes.func
|
|
140
|
+
onConnect: PropTypes.func,
|
|
141
|
+
backupInProgress: PropTypes.bool
|
|
139
142
|
};
|
|
140
143
|
SpaceItemAction.defaultProps = {
|
|
141
144
|
onDelete: () => {},
|
|
142
145
|
onConnect: () => {},
|
|
143
|
-
enableSwitchToSpace: true
|
|
146
|
+
enableSwitchToSpace: true,
|
|
147
|
+
backupInProgress: false
|
|
144
148
|
};
|
|
145
149
|
export default SpaceItemAction;
|
|
@@ -442,7 +442,8 @@ function SpaceItem({
|
|
|
442
442
|
connected: connected,
|
|
443
443
|
onDelete: onDelete,
|
|
444
444
|
onConnect: onConnect,
|
|
445
|
-
enableSwitchToSpace: backupProgress?.completed || isEmpty(backupProgress?.message)
|
|
445
|
+
enableSwitchToSpace: backupProgress?.completed || isEmpty(backupProgress?.message),
|
|
446
|
+
backupInProgress: shouldDisplayBackupProgress
|
|
446
447
|
})]
|
|
447
448
|
})]
|
|
448
449
|
}), /*#__PURE__*/_jsx(DidConnect, {
|
package/es/confirm.js
CHANGED
|
@@ -27,6 +27,7 @@ export default function ConfirmDialog({
|
|
|
27
27
|
onConfirm,
|
|
28
28
|
loading: inputLoading,
|
|
29
29
|
displayError,
|
|
30
|
+
children,
|
|
30
31
|
...rest
|
|
31
32
|
}) {
|
|
32
33
|
const [params, setParams] = useState(initialParams);
|
|
@@ -89,7 +90,7 @@ export default function ConfirmDialog({
|
|
|
89
90
|
marginTop: 8
|
|
90
91
|
},
|
|
91
92
|
children: error
|
|
92
|
-
})]
|
|
93
|
+
}), children]
|
|
93
94
|
}), /*#__PURE__*/_jsxs(DialogActions, {
|
|
94
95
|
className: "delete-actions",
|
|
95
96
|
style: {
|
|
@@ -138,9 +139,11 @@ ConfirmDialog.propTypes = {
|
|
|
138
139
|
onCancel: PropTypes.func,
|
|
139
140
|
onConfirm: PropTypes.func.isRequired,
|
|
140
141
|
loading: PropTypes.bool,
|
|
141
|
-
displayError: PropTypes.bool
|
|
142
|
+
displayError: PropTypes.bool,
|
|
143
|
+
children: PropTypes.any
|
|
142
144
|
};
|
|
143
145
|
ConfirmDialog.defaultProps = {
|
|
146
|
+
children: undefined,
|
|
144
147
|
onCancel: () => {},
|
|
145
148
|
showCancel: true,
|
|
146
149
|
cancel: '',
|
|
@@ -144,10 +144,6 @@ function BlockletStorageProvider({
|
|
|
144
144
|
if (!spaceGateway) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
if (spaceGateway.endpoint === backupEndpoint) {
|
|
148
|
-
toast.warning(t('storage.spaces.gateway.delete.failedForConnected'));
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
147
|
await api.deleteBlockletSpaceGateway({
|
|
152
148
|
input: {
|
|
153
149
|
did: blocklet.meta.did,
|
package/es/layout/feedback.js
CHANGED
|
@@ -10,15 +10,18 @@ export default function Feedback({
|
|
|
10
10
|
const {
|
|
11
11
|
t
|
|
12
12
|
} = useLocaleContext();
|
|
13
|
+
const feedbackUrl = new URL('https://community.arcblock.io/discussions/add');
|
|
14
|
+
infos.forEach(x => {
|
|
15
|
+
feedbackUrl.searchParams.set(x.label, x.value);
|
|
16
|
+
});
|
|
13
17
|
const infoStr = infos.map(x => `* ${x.label}: ${x.value}`).join('\n');
|
|
14
|
-
|
|
15
|
-
feedbackUrl.searchParams.set('
|
|
16
|
-
feedbackUrl.searchParams.set('body', `<!-- [Enter feedback here] -->
|
|
18
|
+
feedbackUrl.searchParams.set('report', 'server');
|
|
19
|
+
feedbackUrl.searchParams.set('context', `[Enter feedback here]
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
|
|
20
23
|
<!--
|
|
21
|
-
|
|
24
|
+
[Server Info]
|
|
22
25
|
${infoStr}
|
|
23
26
|
* Page: ${window.location.href}
|
|
24
27
|
-->
|
package/es/locales/ar.js
CHANGED
|
@@ -663,7 +663,6 @@ export default {
|
|
|
663
663
|
blockletEmptyTip: 'لا توجد أي كتل هنا',
|
|
664
664
|
createBlockletTip: 'يمكنك إنشاء وحدة جديدة من خلال الموارد والمكونات والتكوين الحالي في هذا التطبيق',
|
|
665
665
|
createBlocklet: 'بلوكليت جديد',
|
|
666
|
-
deleteBlockletTip: 'لا يمكن استعادة البلوكليت بعد الحذف ، يرجى التأكيد',
|
|
667
666
|
componentNotRunning: 'المكون {name} غير قيد التشغيل ، يرجى تشغيله أولاً',
|
|
668
667
|
releaseEmptyTip: 'لا توجد أي إصدارات هنا',
|
|
669
668
|
createReleaseTip: 'يمكنك إنشاء إصدار للـ بلوكليت، جنباً إلى جنب مع ملاحظات الإصدار والموارد، ليستخدمها الآخرون.',
|
|
@@ -708,7 +707,11 @@ export default {
|
|
|
708
707
|
title: 'احذف {name}',
|
|
709
708
|
scan: 'امسح رمز الاستجابة السريعة أدناه لحذف {name}',
|
|
710
709
|
confirm: 'يرجى تأكيد استخدام محفظة الهوية اللامركزية',
|
|
711
|
-
success: 'تم حذف مشروع Blocklet ، يرجى متابعة العملية الخاصة بك.'
|
|
710
|
+
success: 'تم حذف مشروع Blocklet ، يرجى متابعة العملية الخاصة بك.',
|
|
711
|
+
tip1: 'لن يكون من الممكن استعادة مشروع Blocklet بعد الحذف',
|
|
712
|
+
tip2: 'لن تكون قادرًا بعد الآن على نشر إصدارات جديدة للبلوكليت المحذوف ، مما يعني أن البلوكليت لن يتم تحديثه في المتجر بعد الآن.',
|
|
713
|
+
tip3: 'سيؤدي حذف البلوكليت إلى ضرورة نشر الإصدار الحالي منه في المتجر.',
|
|
714
|
+
description: 'بعد حذف البلوكليت، ستواجه المشكلات التالية، هل أنت متأكد أنك تريد حذفه؟'
|
|
712
715
|
}
|
|
713
716
|
},
|
|
714
717
|
titleValidationError: 'يجب أن يكون طول العنوان على الأقل 3 أحرف',
|
|
@@ -1616,7 +1619,6 @@ export default {
|
|
|
1616
1619
|
title: 'حذف البوابة',
|
|
1617
1620
|
succeeded: 'حذف DID Spaces {name} بنجاح',
|
|
1618
1621
|
failed: 'فشل حذف البوابة',
|
|
1619
|
-
failedForConnected: 'غير قادر على حذف فضاء DID متصل',
|
|
1620
1622
|
failedForSelected: 'غير قادر على حذف مساحة DID المحددة'
|
|
1621
1623
|
},
|
|
1622
1624
|
connect: {
|
|
@@ -1686,12 +1688,39 @@ export default {
|
|
|
1686
1688
|
domain: 'مجال',
|
|
1687
1689
|
domainDescription: 'مطلوب نطاق Auth0',
|
|
1688
1690
|
clientId: 'معرف العميل',
|
|
1689
|
-
clientIdDescribe: 'مطلوب معرف عميل Auth0'
|
|
1691
|
+
clientIdDescribe: 'مطلوب معرف عميل Auth0',
|
|
1692
|
+
clientSecret: 'سر العميل'
|
|
1690
1693
|
},
|
|
1691
1694
|
comingSoon: 'تحت الإنشاء طرق تسجيل الدخول الأخرى.',
|
|
1692
1695
|
moreLogin: 'تسجيل الدخول المزيد',
|
|
1693
1696
|
federated: 'تسجيل الدخول الموحد',
|
|
1694
|
-
runTest: 'اختبار'
|
|
1697
|
+
runTest: 'اختبار',
|
|
1698
|
+
github: {
|
|
1699
|
+
enable: 'تمكين تسجيل الدخول على Github',
|
|
1700
|
+
clientId: 'معرف العميل',
|
|
1701
|
+
clientIdDescribe: 'مطلوب معرف عميل (clientId) لتطبيق Github OAuth',
|
|
1702
|
+
clientSecret: 'سر العميل',
|
|
1703
|
+
clientSecretDescribe: 'مطلوب clientSecret لتطبيق Github OAuth'
|
|
1704
|
+
},
|
|
1705
|
+
google: {
|
|
1706
|
+
enable: 'تفعيل تسجيل الدخول في جوجل',
|
|
1707
|
+
clientId: 'معرف العميل',
|
|
1708
|
+
clientIdDescribe: 'مطلوب معرف تطبيق Google OAuth',
|
|
1709
|
+
clientSecret: 'سر العميل',
|
|
1710
|
+
clientSecretDescribe: 'مطلوب clientSecret لتطبيق Google OAuth'
|
|
1711
|
+
},
|
|
1712
|
+
apple: {
|
|
1713
|
+
enable: 'تفعيل تسجيل الدخول الخاص بـ آبل',
|
|
1714
|
+
teamId: 'رقم فريق',
|
|
1715
|
+
teamIdDescribe: 'مطلوب معرف فريق لتطبيق Apple OAuth',
|
|
1716
|
+
serviceId: 'رقم الخدمة',
|
|
1717
|
+
serviceIdDescribe: 'مطلوب معرف خدمة لتطبيق Apple OAuth',
|
|
1718
|
+
keyId: 'مفتاح ID',
|
|
1719
|
+
keyIdDescribe: 'مطلوب مفتاح تطبيق OAuth لأبل',
|
|
1720
|
+
authKey: 'مفتاح Auth',
|
|
1721
|
+
authKeyDescribe: 'مفتاح المصادقة لتطبيق Apple OAuth مطلوب'
|
|
1722
|
+
},
|
|
1723
|
+
oauth: 'تسجيل الدخول من طرف ثالث'
|
|
1695
1724
|
},
|
|
1696
1725
|
expiration: {
|
|
1697
1726
|
mobile: {
|