@abtnode/ux 1.17.8-beta-20260106-113136-b3c09e14 → 1.17.8-beta-20260108-120904-21cb5fb6
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/aigne-config/components/credit.js +14 -8
- package/lib/blocklet/authentication/auth-text/action-item.js +272 -0
- package/lib/blocklet/authentication/auth-text/add-language-dialog.js +67 -0
- package/lib/blocklet/authentication/auth-text/constants.js +74 -0
- package/lib/blocklet/authentication/auth-text/visual-mode.js +277 -0
- package/lib/blocklet/authentication/did-connect-settings.js +87 -23
- package/lib/blocklet/authentication/providers/email.js +16 -4
- package/lib/blocklet/authentication/providers/index.js +1 -1
- package/lib/blocklet/notification/index.js +14 -4
- package/lib/locales/ar.js +11 -8
- package/lib/locales/de.js +10 -7
- package/lib/locales/en.js +9 -1
- package/lib/locales/es.js +11 -8
- package/lib/locales/fr.js +11 -8
- package/lib/locales/hi.js +11 -8
- package/lib/locales/i18n.json +181 -21
- package/lib/locales/id.js +11 -8
- package/lib/locales/ja.js +11 -8
- package/lib/locales/ko.js +11 -8
- package/lib/locales/pt.js +11 -8
- package/lib/locales/ru.js +11 -8
- package/lib/locales/th.js +11 -8
- package/lib/locales/vi.js +11 -8
- package/lib/locales/zh-tw.js +11 -8
- package/lib/locales/zh.js +10 -7
- package/package.json +25 -25
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { Box, Button, Stack, Typography } from '@mui/material';
|
|
2
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
3
|
+
import SaveIcon from '@mui/icons-material/Save';
|
|
4
|
+
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
5
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
|
+
import { useMemoizedFn } from 'ahooks';
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { defaultConfig, configTemplate, defaultAction, defaultActions, isValidActionName } from './constants';
|
|
10
|
+
import ActionItem from './action-item';
|
|
11
|
+
import AddLanguageDialog from './add-language-dialog';
|
|
12
|
+
|
|
13
|
+
// TODO: 先禁用添加新的 action
|
|
14
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const disabledAddAction = true;
|
|
16
|
+
export default function AuthTextVisualMode({
|
|
17
|
+
open = false,
|
|
18
|
+
onClose = () => {},
|
|
19
|
+
onSave = () => {},
|
|
20
|
+
initialConfig = null
|
|
21
|
+
}) {
|
|
22
|
+
const {
|
|
23
|
+
t,
|
|
24
|
+
locale
|
|
25
|
+
} = useLocaleContext();
|
|
26
|
+
const [actions, setActions] = useState({});
|
|
27
|
+
const [expandedAction, setExpandedAction] = useState('login');
|
|
28
|
+
const [selectedLanguages, setSelectedLanguages] = useState({});
|
|
29
|
+
const [addLanguageOpen, setAddLanguageOpen] = useState(false);
|
|
30
|
+
const [addLanguageAction, setAddLanguageAction] = useState('');
|
|
31
|
+
const [newLanguage, setNewLanguage] = useState('');
|
|
32
|
+
const [editingAction, setEditingAction] = useState(null);
|
|
33
|
+
const [editingName, setEditingName] = useState('');
|
|
34
|
+
const currentLocale = locale || 'en';
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!open) return;
|
|
37
|
+
const parsedDialogs = initialConfig || defaultConfig;
|
|
38
|
+
setActions(parsedDialogs);
|
|
39
|
+
const dialogKeys = Object.keys(parsedDialogs);
|
|
40
|
+
setExpandedAction(dialogKeys[0] || 'login');
|
|
41
|
+
const initialSelected = {};
|
|
42
|
+
dialogKeys.forEach(key => {
|
|
43
|
+
const langs = Object.keys(parsedDialogs[key] || {});
|
|
44
|
+
initialSelected[key] = langs.includes(currentLocale) ? currentLocale : langs[0] || 'en';
|
|
45
|
+
});
|
|
46
|
+
setSelectedLanguages(initialSelected);
|
|
47
|
+
setEditingAction(null);
|
|
48
|
+
}, [open, initialConfig, currentLocale]);
|
|
49
|
+
const isActionEmpty = useMemoizedFn(actionData => {
|
|
50
|
+
if (!actionData) return true;
|
|
51
|
+
return Object.values(actionData).every(langData => !langData?.title?.trim() && !langData?.scan?.trim());
|
|
52
|
+
});
|
|
53
|
+
const canAddNewAction = useMemoizedFn(() => {
|
|
54
|
+
const hasEmpty = Object.keys(actions).some(key => !defaultActions.includes(key) && isActionEmpty(actions[key]));
|
|
55
|
+
return !hasEmpty && !actions[defaultAction];
|
|
56
|
+
});
|
|
57
|
+
const handleAddAction = useMemoizedFn(() => {
|
|
58
|
+
if (!canAddNewAction()) return;
|
|
59
|
+
setActions(prev => ({
|
|
60
|
+
...prev,
|
|
61
|
+
[defaultAction]: configTemplate
|
|
62
|
+
}));
|
|
63
|
+
setExpandedAction(defaultAction);
|
|
64
|
+
setSelectedLanguages(prev => ({
|
|
65
|
+
...prev,
|
|
66
|
+
[defaultAction]: currentLocale
|
|
67
|
+
}));
|
|
68
|
+
setEditingAction(defaultAction);
|
|
69
|
+
setEditingName(defaultAction);
|
|
70
|
+
});
|
|
71
|
+
const handleEditingNameChange = useMemoizedFn(e => {
|
|
72
|
+
const {
|
|
73
|
+
value
|
|
74
|
+
} = e.target;
|
|
75
|
+
if (value === '' || /^[a-z-]*$/.test(value)) {
|
|
76
|
+
setEditingName(value);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const handleFinishEditing = useMemoizedFn(() => {
|
|
80
|
+
const newName = editingName.trim();
|
|
81
|
+
if (!newName || !isValidActionName(newName) || newName !== editingAction && actions[newName]) {
|
|
82
|
+
setEditingAction(null);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (newName !== editingAction) {
|
|
86
|
+
const newActions = {};
|
|
87
|
+
Object.keys(actions).forEach(key => {
|
|
88
|
+
newActions[key === editingAction ? newName : key] = actions[key];
|
|
89
|
+
});
|
|
90
|
+
setActions(newActions);
|
|
91
|
+
if (expandedAction === editingAction) setExpandedAction(newName);
|
|
92
|
+
if (selectedLanguages[editingAction]) {
|
|
93
|
+
setSelectedLanguages(prev => {
|
|
94
|
+
const updated = {
|
|
95
|
+
...prev,
|
|
96
|
+
[newName]: prev[editingAction]
|
|
97
|
+
};
|
|
98
|
+
delete updated[editingAction];
|
|
99
|
+
return updated;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
setEditingAction(null);
|
|
104
|
+
});
|
|
105
|
+
const handleEditingKeyDown = useMemoizedFn(e => {
|
|
106
|
+
if (e.key === 'Enter') handleFinishEditing();else if (e.key === 'Escape') setEditingAction(null);
|
|
107
|
+
});
|
|
108
|
+
const handleDeleteAction = useMemoizedFn((actionKey, e) => {
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
const newActions = {
|
|
111
|
+
...actions
|
|
112
|
+
};
|
|
113
|
+
delete newActions[actionKey];
|
|
114
|
+
setActions(newActions);
|
|
115
|
+
if (expandedAction === actionKey) {
|
|
116
|
+
setExpandedAction(Object.keys(newActions)[0] || false);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const handleAddLanguage = useMemoizedFn(() => {
|
|
120
|
+
if (!newLanguage || !addLanguageAction) return;
|
|
121
|
+
setActions(prev => ({
|
|
122
|
+
...prev,
|
|
123
|
+
[addLanguageAction]: {
|
|
124
|
+
...prev[addLanguageAction],
|
|
125
|
+
[newLanguage]: {
|
|
126
|
+
title: '',
|
|
127
|
+
scan: '',
|
|
128
|
+
confirm: '',
|
|
129
|
+
success: ''
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}));
|
|
133
|
+
setSelectedLanguages(prev => ({
|
|
134
|
+
...prev,
|
|
135
|
+
[addLanguageAction]: newLanguage
|
|
136
|
+
}));
|
|
137
|
+
setAddLanguageOpen(false);
|
|
138
|
+
});
|
|
139
|
+
const handleDeleteLanguage = useMemoizedFn((actionKey, langCode, e) => {
|
|
140
|
+
e.stopPropagation();
|
|
141
|
+
const actionData = actions[actionKey];
|
|
142
|
+
const langs = Object.keys(actionData || {});
|
|
143
|
+
if (langs.length <= 1) return;
|
|
144
|
+
const newActionData = {
|
|
145
|
+
...actionData
|
|
146
|
+
};
|
|
147
|
+
delete newActionData[langCode];
|
|
148
|
+
setActions(prev => ({
|
|
149
|
+
...prev,
|
|
150
|
+
[actionKey]: newActionData
|
|
151
|
+
}));
|
|
152
|
+
if (selectedLanguages[actionKey] === langCode) {
|
|
153
|
+
setSelectedLanguages(prev => ({
|
|
154
|
+
...prev,
|
|
155
|
+
[actionKey]: Object.keys(newActionData)[0] || 'en'
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
const handleSave = useMemoizedFn(() => {
|
|
160
|
+
onSave(JSON.stringify(actions));
|
|
161
|
+
onClose();
|
|
162
|
+
});
|
|
163
|
+
const addEnabled = canAddNewAction();
|
|
164
|
+
const dialogActions = /*#__PURE__*/_jsxs(_Fragment, {
|
|
165
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
166
|
+
onClick: onClose,
|
|
167
|
+
variant: "outlined",
|
|
168
|
+
children: t('common.cancel')
|
|
169
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
170
|
+
onClick: handleSave,
|
|
171
|
+
variant: "contained",
|
|
172
|
+
startIcon: /*#__PURE__*/_jsx(SaveIcon, {}),
|
|
173
|
+
children: t('common.confirm')
|
|
174
|
+
})]
|
|
175
|
+
});
|
|
176
|
+
return /*#__PURE__*/_jsxs(Dialog, {
|
|
177
|
+
open: open,
|
|
178
|
+
onClose: onClose,
|
|
179
|
+
maxWidth: "md",
|
|
180
|
+
fullWidth: true,
|
|
181
|
+
title: t('authentication.didConnect.configDialogTitle'),
|
|
182
|
+
actions: dialogActions,
|
|
183
|
+
children: [/*#__PURE__*/_jsxs(Stack, {
|
|
184
|
+
spacing: 1.5,
|
|
185
|
+
children: [Object.keys(actions).map(actionKey => {
|
|
186
|
+
const actionData = actions[actionKey] || {};
|
|
187
|
+
const langs = Object.keys(actionData);
|
|
188
|
+
const selectedLang = selectedLanguages[actionKey] || langs[0] || 'en';
|
|
189
|
+
return /*#__PURE__*/_jsx(ActionItem, {
|
|
190
|
+
actionKey: actionKey,
|
|
191
|
+
actionData: actionData,
|
|
192
|
+
expanded: expandedAction === actionKey,
|
|
193
|
+
selectedLang: selectedLang,
|
|
194
|
+
editing: {
|
|
195
|
+
actionKey: editingAction,
|
|
196
|
+
name: editingName,
|
|
197
|
+
allActions: actions
|
|
198
|
+
},
|
|
199
|
+
onChange: {
|
|
200
|
+
accordion: isExpanded => setExpandedAction(isExpanded ? actionKey : false),
|
|
201
|
+
language: langCode => setSelectedLanguages(prev => ({
|
|
202
|
+
...prev,
|
|
203
|
+
[actionKey]: langCode
|
|
204
|
+
})),
|
|
205
|
+
field: (field, value) => setActions(prev => ({
|
|
206
|
+
...prev,
|
|
207
|
+
[actionKey]: {
|
|
208
|
+
...prev[actionKey],
|
|
209
|
+
[selectedLang]: {
|
|
210
|
+
...prev[actionKey]?.[selectedLang],
|
|
211
|
+
[field]: value
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
})),
|
|
215
|
+
startEditing: e => {
|
|
216
|
+
e.stopPropagation();
|
|
217
|
+
setEditingAction(actionKey);
|
|
218
|
+
setEditingName(actionKey);
|
|
219
|
+
},
|
|
220
|
+
editingName: handleEditingNameChange,
|
|
221
|
+
finishEditing: handleFinishEditing,
|
|
222
|
+
editingKeyDown: handleEditingKeyDown,
|
|
223
|
+
delete: e => handleDeleteAction(actionKey, e),
|
|
224
|
+
addLanguage: e => {
|
|
225
|
+
e.stopPropagation();
|
|
226
|
+
setAddLanguageAction(actionKey);
|
|
227
|
+
setNewLanguage('');
|
|
228
|
+
setAddLanguageOpen(true);
|
|
229
|
+
},
|
|
230
|
+
deleteLanguage: (langCode, e) => handleDeleteLanguage(actionKey, langCode, e)
|
|
231
|
+
}
|
|
232
|
+
}, actionKey);
|
|
233
|
+
}), !disabledAddAction && /*#__PURE__*/_jsxs(Box, {
|
|
234
|
+
onClick: addEnabled ? handleAddAction : undefined,
|
|
235
|
+
sx: {
|
|
236
|
+
border: '2px dashed',
|
|
237
|
+
borderColor: addEnabled ? 'grey.300' : 'grey.200',
|
|
238
|
+
borderRadius: 2,
|
|
239
|
+
py: 1.5,
|
|
240
|
+
display: 'flex',
|
|
241
|
+
alignItems: 'center',
|
|
242
|
+
justifyContent: 'center',
|
|
243
|
+
cursor: addEnabled ? 'pointer' : 'not-allowed',
|
|
244
|
+
color: addEnabled ? 'text.secondary' : 'text.disabled',
|
|
245
|
+
transition: 'all 0.2s',
|
|
246
|
+
...(addEnabled && {
|
|
247
|
+
'&:hover': {
|
|
248
|
+
borderColor: 'primary.main',
|
|
249
|
+
color: 'primary.main',
|
|
250
|
+
bgcolor: 'primary.lighter'
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
},
|
|
254
|
+
children: [/*#__PURE__*/_jsx(AddIcon, {
|
|
255
|
+
sx: {
|
|
256
|
+
mr: 0.5
|
|
257
|
+
}
|
|
258
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
259
|
+
children: t('authentication.didConnect.addNewAction')
|
|
260
|
+
})]
|
|
261
|
+
})]
|
|
262
|
+
}), /*#__PURE__*/_jsx(AddLanguageDialog, {
|
|
263
|
+
open: addLanguageOpen,
|
|
264
|
+
onClose: () => setAddLanguageOpen(false),
|
|
265
|
+
existingLanguages: Object.keys(actions[addLanguageAction] || {}),
|
|
266
|
+
selectedLanguage: newLanguage,
|
|
267
|
+
onLanguageChange: setNewLanguage,
|
|
268
|
+
onAdd: handleAddLanguage
|
|
269
|
+
})]
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
AuthTextVisualMode.propTypes = {
|
|
273
|
+
open: PropTypes.bool,
|
|
274
|
+
onClose: PropTypes.func,
|
|
275
|
+
onSave: PropTypes.func,
|
|
276
|
+
initialConfig: PropTypes.object
|
|
277
|
+
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import SwitchControl from '@arcblock/ux/lib/Switch';
|
|
4
|
-
import { Box, Button, Stack } from '@mui/material';
|
|
4
|
+
import { Box, Button, Divider, Stack } from '@mui/material';
|
|
5
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
|
+
import { useState } from 'react';
|
|
6
7
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
7
|
-
import { useMemoizedFn } from 'ahooks';
|
|
8
|
+
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
8
9
|
import merge from 'lodash/merge';
|
|
10
|
+
import isEmpty from 'lodash/isEmpty';
|
|
9
11
|
import Section from '../../component/section';
|
|
10
12
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
11
13
|
import { useNodeContext } from '../../contexts/node';
|
|
14
|
+
import AuthTextVisualMode from './auth-text/visual-mode';
|
|
15
|
+
import { defaultConfig } from './auth-text/constants';
|
|
12
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
17
|
const defaultForm = {
|
|
14
18
|
showDidColor: true,
|
|
@@ -31,24 +35,34 @@ export default function DIDConnectSettings() {
|
|
|
31
35
|
} = useBlockletContext();
|
|
32
36
|
const did = blocklet?.meta?.did;
|
|
33
37
|
const {
|
|
34
|
-
handleSubmit,
|
|
35
38
|
control,
|
|
36
|
-
formState,
|
|
37
39
|
reset
|
|
38
40
|
} = useForm({
|
|
39
41
|
defaultValues: merge({}, defaultForm, blocklet?.settings?.didConnect || {})
|
|
40
42
|
});
|
|
43
|
+
|
|
44
|
+
// action config is a json object
|
|
45
|
+
const actionConfig = useCreation(() => {
|
|
46
|
+
const config = blocklet?.settings?.actionConfig;
|
|
47
|
+
return config && !isEmpty(config) ? config : defaultConfig;
|
|
48
|
+
}, [blocklet?.settings?.actionConfig]);
|
|
41
49
|
const {
|
|
42
50
|
t
|
|
43
51
|
} = useLocaleContext();
|
|
44
|
-
const
|
|
52
|
+
const [openDialog, setOpenDialog] = useState(false);
|
|
53
|
+
const handleSave = useMemoizedFn(async (fieldName, value) => {
|
|
45
54
|
try {
|
|
55
|
+
const currentData = {
|
|
56
|
+
showDidColor: control._defaultValues?.showDidColor ?? defaultForm.showDidColor,
|
|
57
|
+
showAppInfo: control._defaultValues?.showAppInfo ?? defaultForm.showAppInfo
|
|
58
|
+
};
|
|
59
|
+
currentData[fieldName] = value;
|
|
46
60
|
const {
|
|
47
61
|
blocklet: blockletChanged
|
|
48
62
|
} = await api.configDidConnect({
|
|
49
63
|
input: {
|
|
50
64
|
did,
|
|
51
|
-
didConnect: JSON.stringify(
|
|
65
|
+
didConnect: JSON.stringify(currentData)
|
|
52
66
|
}
|
|
53
67
|
});
|
|
54
68
|
const defaultValues = Object.assign({}, defaultForm, blockletChanged?.settings?.didConnect || {});
|
|
@@ -56,17 +70,43 @@ export default function DIDConnectSettings() {
|
|
|
56
70
|
Toast.success(t('common.configSuccess'));
|
|
57
71
|
} catch (err) {
|
|
58
72
|
Toast.error(err.message);
|
|
73
|
+
reset(control._defaultValues);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const handleCloseDialog = useMemoizedFn(() => {
|
|
77
|
+
setOpenDialog(false);
|
|
78
|
+
});
|
|
79
|
+
const handleOpenDialog = useMemoizedFn(() => {
|
|
80
|
+
setOpenDialog(true);
|
|
81
|
+
});
|
|
82
|
+
const handleSaveCustomConfig = useMemoizedFn(async config => {
|
|
83
|
+
try {
|
|
84
|
+
await api.configDidConnectActions({
|
|
85
|
+
input: {
|
|
86
|
+
did,
|
|
87
|
+
actionConfig: config
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Toast.success(t('common.configSuccess'));
|
|
91
|
+
} catch (err) {
|
|
92
|
+
console.error(err);
|
|
93
|
+
Toast.error(err.message);
|
|
59
94
|
}
|
|
60
95
|
});
|
|
61
|
-
return /*#__PURE__*/
|
|
62
|
-
|
|
63
|
-
children: /*#__PURE__*/_jsxs(Stack, {
|
|
96
|
+
return /*#__PURE__*/_jsxs(Div, {
|
|
97
|
+
children: [/*#__PURE__*/_jsxs(Stack, {
|
|
64
98
|
direction: "column",
|
|
65
99
|
sx: {
|
|
66
100
|
gap: 4
|
|
67
101
|
},
|
|
68
|
-
children: [/*#__PURE__*/
|
|
69
|
-
children: /*#__PURE__*/
|
|
102
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
103
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
104
|
+
children: t('authentication.didConnect.basicSettings')
|
|
105
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
106
|
+
sx: {
|
|
107
|
+
my: 2
|
|
108
|
+
}
|
|
109
|
+
}), /*#__PURE__*/_jsxs(Stack, {
|
|
70
110
|
sx: {
|
|
71
111
|
gap: 2
|
|
72
112
|
},
|
|
@@ -87,7 +127,11 @@ export default function DIDConnectSettings() {
|
|
|
87
127
|
}) => {
|
|
88
128
|
return /*#__PURE__*/_jsx(Switch, {
|
|
89
129
|
...field,
|
|
90
|
-
checked: field.value
|
|
130
|
+
checked: field.value,
|
|
131
|
+
onChange: e => {
|
|
132
|
+
handleSave('showDidColor', e.target.checked);
|
|
133
|
+
field.onChange(e);
|
|
134
|
+
}
|
|
91
135
|
});
|
|
92
136
|
}
|
|
93
137
|
})
|
|
@@ -109,25 +153,45 @@ export default function DIDConnectSettings() {
|
|
|
109
153
|
}) => {
|
|
110
154
|
return /*#__PURE__*/_jsx(Switch, {
|
|
111
155
|
...field,
|
|
112
|
-
checked: field.value
|
|
156
|
+
checked: field.value,
|
|
157
|
+
onChange: e => {
|
|
158
|
+
handleSave('showAppInfo', e.target.checked);
|
|
159
|
+
field.onChange(e);
|
|
160
|
+
}
|
|
113
161
|
});
|
|
114
162
|
}
|
|
115
163
|
})
|
|
116
164
|
})
|
|
117
165
|
})]
|
|
118
|
-
})
|
|
119
|
-
}), /*#__PURE__*/
|
|
120
|
-
children: /*#__PURE__*/_jsx(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
166
|
+
})]
|
|
167
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
168
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
169
|
+
children: t('authentication.didConnect.customSettings')
|
|
170
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
171
|
+
sx: {
|
|
172
|
+
my: 2
|
|
173
|
+
}
|
|
174
|
+
}), /*#__PURE__*/_jsx(Stack, {
|
|
175
|
+
direction: "row",
|
|
176
|
+
sx: {
|
|
177
|
+
gap: 2
|
|
178
|
+
},
|
|
179
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
180
|
+
variant: "outlined",
|
|
181
|
+
onClick: handleOpenDialog,
|
|
182
|
+
children: t('authentication.didConnect.configDialogTitle')
|
|
183
|
+
})
|
|
184
|
+
})]
|
|
126
185
|
})]
|
|
127
|
-
})
|
|
186
|
+
}), /*#__PURE__*/_jsx(AuthTextVisualMode, {
|
|
187
|
+
open: openDialog,
|
|
188
|
+
onClose: handleCloseDialog,
|
|
189
|
+
onSave: handleSaveCustomConfig,
|
|
190
|
+
initialConfig: actionConfig
|
|
191
|
+
})]
|
|
128
192
|
});
|
|
129
193
|
}
|
|
130
|
-
const Div = styled.
|
|
194
|
+
const Div = styled.div`
|
|
131
195
|
max-width: 1536px;
|
|
132
196
|
|
|
133
197
|
.advanced-config {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useImperativeHandle } from 'react';
|
|
2
2
|
import { Box, Button } from '@mui/material';
|
|
3
3
|
import noop from 'lodash/noop';
|
|
4
|
-
import { useMemoizedFn } from 'ahooks';
|
|
4
|
+
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
5
5
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
6
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
7
7
|
import { Link } from 'react-router-dom';
|
|
8
|
-
import { joinURL } from 'ufo';
|
|
8
|
+
import { joinURL, withQuery } from 'ufo';
|
|
9
9
|
import { WELLKNOWN_BLOCKLET_ADMIN_PATH } from '@abtnode/constant';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import { useNodeContext } from '../../../contexts/node';
|
|
@@ -17,7 +17,8 @@ function LoginProviderEmail({
|
|
|
17
17
|
sortMaps = {}
|
|
18
18
|
}) {
|
|
19
19
|
const {
|
|
20
|
-
api
|
|
20
|
+
api,
|
|
21
|
+
inService
|
|
21
22
|
} = useNodeContext();
|
|
22
23
|
const {
|
|
23
24
|
blocklet
|
|
@@ -47,13 +48,24 @@ function LoginProviderEmail({
|
|
|
47
48
|
Toast.error(err.message || t('common.saveFailed'));
|
|
48
49
|
}
|
|
49
50
|
});
|
|
51
|
+
const emailSettingUrl = useCreation(() => {
|
|
52
|
+
if (inService) {
|
|
53
|
+
return withQuery(joinURL(WELLKNOWN_BLOCKLET_ADMIN_PATH, '/notification/settings'), {
|
|
54
|
+
type: 'email'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return withQuery(joinURL('/blocklets', blocklet.appPid, '/configuration'), {
|
|
58
|
+
tab: 'notification',
|
|
59
|
+
type: 'email'
|
|
60
|
+
});
|
|
61
|
+
}, [inService, blocklet.appPid]);
|
|
50
62
|
useImperativeHandle(ref, () => ({
|
|
51
63
|
submit: onSubmit
|
|
52
64
|
}), [onSubmit]);
|
|
53
65
|
return /*#__PURE__*/_jsxs(Box, {
|
|
54
66
|
children: [t('authentication.emailLoginDescription'), /*#__PURE__*/_jsx("br", {}), t('authentication.emailNotificationRequired'), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx(Box, {
|
|
55
67
|
component: Link,
|
|
56
|
-
to:
|
|
68
|
+
to: emailSettingUrl,
|
|
57
69
|
sx: {
|
|
58
70
|
mt: 1,
|
|
59
71
|
display: 'inline-block'
|
|
@@ -220,7 +220,7 @@ export default function LoginProviders() {
|
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
delete sortMaps[name];
|
|
223
|
-
Toast.success(t('common.
|
|
223
|
+
Toast.success(t('common.removeSuccess'));
|
|
224
224
|
close();
|
|
225
225
|
} catch (err) {
|
|
226
226
|
Toast.error(err.message || t('common.deleteFailed'));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
2
|
import Tabs from '@arcblock/ux/lib/Tabs';
|
|
3
3
|
import { Box, Typography } from '@mui/material';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useSearchParams } from 'react-router-dom';
|
|
5
|
+
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
6
|
+
import { useContext, useMemo } from 'react';
|
|
6
7
|
import NotificationEmail from './email';
|
|
7
8
|
import NotificationPushKit from './push-kit';
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -43,11 +44,14 @@ const tabs = [{
|
|
|
43
44
|
}),
|
|
44
45
|
value: 'webhooks'
|
|
45
46
|
}];
|
|
47
|
+
const validTabs = tabs.map(t => t.value);
|
|
46
48
|
function BlockletNotification() {
|
|
47
|
-
const [currentTab, setCurrentTab] = useState(tabs[0].value);
|
|
48
49
|
const {
|
|
49
50
|
t
|
|
50
51
|
} = useContext(LocaleContext);
|
|
52
|
+
const [params, setParams] = useSearchParams();
|
|
53
|
+
const typeParam = params.get('type');
|
|
54
|
+
const currentTab = validTabs.includes(typeParam) ? typeParam : tabs[0].value;
|
|
51
55
|
const contents = useCreation(() => ({
|
|
52
56
|
email: /*#__PURE__*/_jsx(NotificationEmail, {}),
|
|
53
57
|
pushKit: /*#__PURE__*/_jsx(NotificationPushKit, {}),
|
|
@@ -60,6 +64,12 @@ function BlockletNotification() {
|
|
|
60
64
|
children: t('notification.webhooks.description')
|
|
61
65
|
})
|
|
62
66
|
}), [t]);
|
|
67
|
+
const onTablChange = useMemoizedFn(tab => {
|
|
68
|
+
params.set('type', tab);
|
|
69
|
+
setParams(params, {
|
|
70
|
+
replace: true
|
|
71
|
+
});
|
|
72
|
+
});
|
|
63
73
|
const tabBodyStyle = useMemo(() => {
|
|
64
74
|
return {
|
|
65
75
|
padding: '10px 0'
|
|
@@ -70,7 +80,7 @@ function BlockletNotification() {
|
|
|
70
80
|
variant: "card",
|
|
71
81
|
tabs: tabs,
|
|
72
82
|
current: currentTab,
|
|
73
|
-
onChange:
|
|
83
|
+
onChange: onTablChange
|
|
74
84
|
}), /*#__PURE__*/_jsx(Box, {
|
|
75
85
|
style: tabBodyStyle,
|
|
76
86
|
children: contents[currentTab]
|
package/lib/locales/ar.js
CHANGED
|
@@ -144,7 +144,7 @@ export default {
|
|
|
144
144
|
community: 'رابط المجتمع',
|
|
145
145
|
complete: 'اكتمال',
|
|
146
146
|
componentBasicInfo: 'معلومات القطعة الأساسية',
|
|
147
|
-
components: '
|
|
147
|
+
components: 'Blocklets',
|
|
148
148
|
config: 'تكوين',
|
|
149
149
|
configuration: 'تكوين',
|
|
150
150
|
appearance: 'المظهر',
|
|
@@ -2398,10 +2398,6 @@ export default {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
},
|
|
2400
2400
|
oauth: {
|
|
2401
|
-
auth0: {},
|
|
2402
|
-
github: {},
|
|
2403
|
-
google: {},
|
|
2404
|
-
apple: {},
|
|
2405
2401
|
authorize: 'أذن OAuth',
|
|
2406
2402
|
client: {
|
|
2407
2403
|
tab: 'تطبيقات OAuth',
|
|
@@ -2499,8 +2495,7 @@ export default {
|
|
|
2499
2495
|
listTitle: 'تمكين الوصول الآمن للجهات الخارجية باستخدام تطبيقات OAuth',
|
|
2500
2496
|
tooltipTitle: 'استخدم خادم OAuth المدمج في تطبيقك لتفويض التطبيقات الخارجية باستخدام بروتوكولات قياسية في الصناعة. تمكين المستخدمين من خلال مصادقة آمنة وسلسة والتحكم في الوصول الموكّل.',
|
|
2501
2497
|
empty: 'لم يتم إضافة بيانات'
|
|
2502
|
-
}
|
|
2503
|
-
twitter: {}
|
|
2498
|
+
}
|
|
2504
2499
|
},
|
|
2505
2500
|
expiration: {
|
|
2506
2501
|
mobile: {
|
|
@@ -2898,7 +2893,15 @@ export default {
|
|
|
2898
2893
|
},
|
|
2899
2894
|
didConnect: {
|
|
2900
2895
|
showDidColor: 'عرض لون DID Connect',
|
|
2901
|
-
showAppInfo: 'عرض معلومات Blocklet'
|
|
2896
|
+
showAppInfo: 'عرض معلومات Blocklet',
|
|
2897
|
+
basicSettings: 'الإعدادات الأساسية',
|
|
2898
|
+
customSettings: 'إعدادات مخصصة',
|
|
2899
|
+
configDialogTitle: 'نص نافذة المصادقة للتكوين',
|
|
2900
|
+
addNewAction: 'إضافة إجراء',
|
|
2901
|
+
addLanguage: 'إضافة لغة',
|
|
2902
|
+
selectLanguage: 'اختر لغتك...',
|
|
2903
|
+
actionNameError: 'يسمح فقط بالحروف الصغيرة والشرطات؛ لا يجوز البدء بشرطة.',
|
|
2904
|
+
actionNameDuplicate: 'اسم الإجراء موجود بالفعل'
|
|
2902
2905
|
}
|
|
2903
2906
|
}
|
|
2904
2907
|
};
|
package/lib/locales/de.js
CHANGED
|
@@ -2398,10 +2398,6 @@ export default {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
},
|
|
2400
2400
|
oauth: {
|
|
2401
|
-
auth0: {},
|
|
2402
|
-
github: {},
|
|
2403
|
-
google: {},
|
|
2404
|
-
apple: {},
|
|
2405
2401
|
authorize: 'OAuth-Autorisierung',
|
|
2406
2402
|
client: {
|
|
2407
2403
|
tab: 'OAuth-Apps',
|
|
@@ -2499,8 +2495,7 @@ export default {
|
|
|
2499
2495
|
listTitle: 'Aktiviere sicheren Drittanbieterzugriff mit OAuth Apps',
|
|
2500
2496
|
tooltipTitle: 'Autorisieren Sie externe Anwendungen mit Industriestandardprotokollen über den integrierten OAuth-Server Ihrer App. Ermöglichen Sie Benutzern sichere, nahtlose Authentifizierung und delegierte Zugriffssteuerung.',
|
|
2501
2497
|
empty: 'Keine Daten hinzugefügt'
|
|
2502
|
-
}
|
|
2503
|
-
twitter: {}
|
|
2498
|
+
}
|
|
2504
2499
|
},
|
|
2505
2500
|
expiration: {
|
|
2506
2501
|
mobile: {
|
|
@@ -2898,7 +2893,15 @@ export default {
|
|
|
2898
2893
|
},
|
|
2899
2894
|
didConnect: {
|
|
2900
2895
|
showDidColor: 'Zeige DID Connect Farbe',
|
|
2901
|
-
showAppInfo: 'Zeige Blocklet-Informationen'
|
|
2896
|
+
showAppInfo: 'Zeige Blocklet-Informationen',
|
|
2897
|
+
basicSettings: 'Grundeinstellungen',
|
|
2898
|
+
customSettings: 'Benutzerdefinierte Einstellungen',
|
|
2899
|
+
configDialogTitle: 'Konfig Auth Popup-Text',
|
|
2900
|
+
addNewAction: 'Aktion hinzufügen',
|
|
2901
|
+
addLanguage: 'Sprache Hinzufügen',
|
|
2902
|
+
selectLanguage: 'Wähle eine Sprache...',
|
|
2903
|
+
actionNameError: 'Nur Kleinbuchstaben und Bindestriche sind erlaubt; es darf nicht mit einem Bindestrich beginnen.',
|
|
2904
|
+
actionNameDuplicate: 'Aktionsname existiert bereits'
|
|
2902
2905
|
}
|
|
2903
2906
|
}
|
|
2904
2907
|
};
|
package/lib/locales/en.js
CHANGED
|
@@ -2588,7 +2588,15 @@ export default {
|
|
|
2588
2588
|
},
|
|
2589
2589
|
didConnect: {
|
|
2590
2590
|
showDidColor: 'Show DID Connect color',
|
|
2591
|
-
showAppInfo: 'Show blocklet information'
|
|
2591
|
+
showAppInfo: 'Show blocklet information',
|
|
2592
|
+
basicSettings: 'Basic Settings',
|
|
2593
|
+
customSettings: 'Custom Settings',
|
|
2594
|
+
configDialogTitle: 'Config Auth Popup Text',
|
|
2595
|
+
addNewAction: 'Add Action',
|
|
2596
|
+
addLanguage: 'Add Language',
|
|
2597
|
+
selectLanguage: 'Select a language...',
|
|
2598
|
+
actionNameError: 'Only lowercase letters and hyphens allowed, cannot start with hyphen',
|
|
2599
|
+
actionNameDuplicate: 'Action name already exists'
|
|
2592
2600
|
}
|
|
2593
2601
|
},
|
|
2594
2602
|
expiration: {
|