@abtnode/ux 1.16.20-beta-e363262e → 1.16.20-beta-bb1cd034
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/notification/email.js +95 -9
- package/es/hooks/confirm.js +1 -1
- package/es/locales/en.js +25 -4
- package/es/locales/zh.js +25 -4
- package/lib/blocklet/notification/email.js +96 -8
- package/lib/hooks/confirm.js +1 -1
- package/lib/locales/en.js +25 -4
- package/lib/locales/zh.js +25 -4
- package/package.json +9 -9
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { Box,
|
|
1
|
+
import { Box, FormControl, FormControlLabel, Switch, TextField } from '@mui/material';
|
|
2
2
|
import pick from 'lodash/pick';
|
|
3
|
-
import { useMemoizedFn } from 'ahooks';
|
|
3
|
+
import { useMemoizedFn, useReactive } from 'ahooks';
|
|
4
4
|
import { Controller, useForm } from 'react-hook-form';
|
|
5
5
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
6
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
7
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
7
8
|
import isEmail from 'validator/lib/isEmail';
|
|
8
9
|
import isURL from 'validator/lib/isURL';
|
|
9
10
|
import isPort from 'validator/lib/isPort';
|
|
10
11
|
import { useNodeContext } from '../../contexts/node';
|
|
11
12
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
13
|
+
import useConfirm from '../../hooks/confirm';
|
|
12
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
16
|
const defaultFormValues = {
|
|
@@ -30,6 +32,10 @@ function NotificationEmail() {
|
|
|
30
32
|
const {
|
|
31
33
|
t
|
|
32
34
|
} = useLocaleContext();
|
|
35
|
+
const {
|
|
36
|
+
confirmApi,
|
|
37
|
+
confirmHolder
|
|
38
|
+
} = useConfirm();
|
|
33
39
|
const did = blocklet?.meta?.did;
|
|
34
40
|
const config = Object.assign({
|
|
35
41
|
...defaultFormValues
|
|
@@ -43,8 +49,12 @@ function NotificationEmail() {
|
|
|
43
49
|
} = useForm({
|
|
44
50
|
defaultValues: pick(config, Object.keys(defaultFormValues))
|
|
45
51
|
});
|
|
52
|
+
const pageState = useReactive({
|
|
53
|
+
testReceiver: '',
|
|
54
|
+
testReceiverError: ''
|
|
55
|
+
});
|
|
46
56
|
const enabled = watch('enabled');
|
|
47
|
-
const onSubmit = useMemoizedFn(async data => {
|
|
57
|
+
const onSubmit = useMemoizedFn(async (data, event, showNotification = true) => {
|
|
48
58
|
try {
|
|
49
59
|
const {
|
|
50
60
|
blocklet: blockletChanged
|
|
@@ -61,11 +71,79 @@ function NotificationEmail() {
|
|
|
61
71
|
}, blockletChanged?.settings?.notification?.email || {});
|
|
62
72
|
// 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
|
|
63
73
|
reset(defaultValues);
|
|
64
|
-
|
|
74
|
+
if (showNotification) {
|
|
75
|
+
Toast.success(t('oauth.saveSuccess'));
|
|
76
|
+
}
|
|
65
77
|
} catch (err) {
|
|
66
|
-
|
|
78
|
+
if (showNotification) {
|
|
79
|
+
Toast.error(err.message || t('oauth.saveFailed'));
|
|
80
|
+
} else {
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
67
83
|
}
|
|
68
84
|
});
|
|
85
|
+
const onTestEmail = useMemoizedFn(async (data, event, receiver) => {
|
|
86
|
+
try {
|
|
87
|
+
// HACK: 如果当前数据有修改,则需要先保存配置,才能测试
|
|
88
|
+
if (formState.isDirty) {
|
|
89
|
+
await onSubmit(data, event, false);
|
|
90
|
+
}
|
|
91
|
+
await api.sendEmail({
|
|
92
|
+
input: {
|
|
93
|
+
did,
|
|
94
|
+
receiver,
|
|
95
|
+
email: JSON.stringify({
|
|
96
|
+
body: 'Your SMTP configuration is correct!',
|
|
97
|
+
title: 'Test email',
|
|
98
|
+
type: 'notification'
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Toast.success(t('notification.email.testSuccess'));
|
|
103
|
+
} catch (err) {
|
|
104
|
+
Toast.error(err.message || t('notification.email.testfailed'));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const showTestEmailModal = useMemoizedFn((data, event) => {
|
|
108
|
+
pageState.testReceiver = '';
|
|
109
|
+
pageState.testReceiverError = '';
|
|
110
|
+
confirmApi.open({
|
|
111
|
+
title: t('notification.email.testSendEmail'),
|
|
112
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
113
|
+
content: () => {
|
|
114
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
115
|
+
sx: {
|
|
116
|
+
width: '300px'
|
|
117
|
+
},
|
|
118
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
119
|
+
fullWidth: true,
|
|
120
|
+
name: "testReceiver",
|
|
121
|
+
label: t('notification.email.inputTestReceiver'),
|
|
122
|
+
value: pageState.testReceiver,
|
|
123
|
+
onChange: e => {
|
|
124
|
+
pageState.testReceiver = e.target.value;
|
|
125
|
+
},
|
|
126
|
+
error: !!pageState.testReceiverError,
|
|
127
|
+
helperText: pageState.testReceiverError || ' '
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
async onConfirm(close) {
|
|
132
|
+
const receiverEmail = pageState.testReceiver?.trim();
|
|
133
|
+
if (!receiverEmail) {
|
|
134
|
+
pageState.testReceiverError = t('notification.email.receiverRequired');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (!isEmail(receiverEmail)) {
|
|
138
|
+
pageState.testReceiverError = t('notification.email.receiverInvalid');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
pageState.testReceiverError = '';
|
|
142
|
+
await onTestEmail(data, event, receiverEmail);
|
|
143
|
+
close();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
69
147
|
const validateFrom = useMemoizedFn(value => {
|
|
70
148
|
const val = value?.trim();
|
|
71
149
|
if (!val) {
|
|
@@ -111,8 +189,8 @@ function NotificationEmail() {
|
|
|
111
189
|
return true;
|
|
112
190
|
});
|
|
113
191
|
const noop = useMemoizedFn(() => true);
|
|
114
|
-
return /*#__PURE__*/
|
|
115
|
-
children: /*#__PURE__*/_jsxs("form", {
|
|
192
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
193
|
+
children: [/*#__PURE__*/_jsxs("form", {
|
|
116
194
|
onSubmit: handleSubmit(onSubmit),
|
|
117
195
|
disabled: true,
|
|
118
196
|
children: [/*#__PURE__*/_jsx(Controller, {
|
|
@@ -244,14 +322,22 @@ function NotificationEmail() {
|
|
|
244
322
|
}
|
|
245
323
|
})
|
|
246
324
|
})
|
|
325
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
326
|
+
variant: "outlined",
|
|
327
|
+
color: "warning",
|
|
328
|
+
onClick: handleSubmit(showTestEmailModal),
|
|
329
|
+
sx: {
|
|
330
|
+
mr: 2
|
|
331
|
+
},
|
|
332
|
+
disabled: !enabled,
|
|
333
|
+
children: t('oauth.runTest')
|
|
247
334
|
}), /*#__PURE__*/_jsx(Button, {
|
|
248
335
|
type: "submit",
|
|
249
336
|
variant: "contained",
|
|
250
|
-
onSubmit: handleSubmit(onSubmit),
|
|
251
337
|
disabled: !formState.isDirty,
|
|
252
338
|
children: t('oauth.save')
|
|
253
339
|
})]
|
|
254
|
-
})
|
|
340
|
+
}), confirmHolder]
|
|
255
341
|
});
|
|
256
342
|
}
|
|
257
343
|
export default NotificationEmail;
|
package/es/hooks/confirm.js
CHANGED
package/es/locales/en.js
CHANGED
|
@@ -850,14 +850,33 @@ export default {
|
|
|
850
850
|
password: 'SMTP server user password',
|
|
851
851
|
fromRequired: 'Email sender is required',
|
|
852
852
|
fromInvalid: 'Email sender is invalid',
|
|
853
|
+
receiverRequired: 'Email receiver is required',
|
|
854
|
+
receiverInvalid: 'Email receiver is invalid',
|
|
853
855
|
hostRequired: 'SMTP server host is required',
|
|
854
856
|
hostInvalid: 'SMTP server host is invalid',
|
|
855
857
|
portRequired: 'SMTP server port is required',
|
|
856
858
|
portInvalid: 'SMTP server port is invalid, port should be between 1 and 65535',
|
|
857
859
|
userRequired: 'SMTP server username is required',
|
|
858
|
-
passwordRequired: 'SMTP server user password is required'
|
|
860
|
+
passwordRequired: 'SMTP server user password is required',
|
|
861
|
+
testSuccess: 'Test email send successfully',
|
|
862
|
+
testFailed: 'Test email send failed',
|
|
863
|
+
testReceiver: 'Email receiver',
|
|
864
|
+
testSendEmail: 'Test email send',
|
|
865
|
+
inputTestReceiver: 'Please input test receiver email',
|
|
866
|
+
disable: 'Unsubscribe email notification',
|
|
867
|
+
disableDescription: 'After unsubscribe, you will no longer receive email notifications. To receive email notifications, you can subscribe it again on this page.',
|
|
868
|
+
unsubscribe: 'Unsubscribe email notification',
|
|
869
|
+
unsubscribeDescription: 'After unsubscribe, you will no longer receive any email notifications.',
|
|
870
|
+
subscribe: 'subscribe',
|
|
871
|
+
subscribeDescription: 'To receive email notifications, you can subscribe it again on settings page.'
|
|
859
872
|
},
|
|
860
|
-
comingSoon: 'More notification channel are under construction'
|
|
873
|
+
comingSoon: 'More notification channel are under construction',
|
|
874
|
+
unsubscribe: 'Unsubscribe',
|
|
875
|
+
unsubscribeSucceed: 'Unsubscribe succeeded',
|
|
876
|
+
unsubscribeFailed: 'Unsubscribe failed',
|
|
877
|
+
unsubscribeTokenRequired: 'Unsubscribe token in required',
|
|
878
|
+
unsubscribeTokenExpired: 'Unsubscribe token is expired',
|
|
879
|
+
unsubscribeTokenInvalid: 'Unsubscribe token is invalid'
|
|
861
880
|
},
|
|
862
881
|
router: {
|
|
863
882
|
routerSetting: 'Domains & URLs',
|
|
@@ -1269,7 +1288,8 @@ export default {
|
|
|
1269
1288
|
issueBy: 'Issue by {name}',
|
|
1270
1289
|
configColor: 'Config Passport Color',
|
|
1271
1290
|
configColorTip: 'Customize the color of the passport',
|
|
1272
|
-
color: 'Passport Color'
|
|
1291
|
+
color: 'Passport Color',
|
|
1292
|
+
description: 'Use this passport to connect {teamName} as {title}'
|
|
1273
1293
|
},
|
|
1274
1294
|
inviting: {
|
|
1275
1295
|
link: 'Invite Link',
|
|
@@ -1591,7 +1611,8 @@ export default {
|
|
|
1591
1611
|
},
|
|
1592
1612
|
comingSoon: 'More login methods are under construction',
|
|
1593
1613
|
moreLogin: 'More Login',
|
|
1594
|
-
federated: 'Federated Login'
|
|
1614
|
+
federated: 'Federated Login',
|
|
1615
|
+
runTest: 'Test'
|
|
1595
1616
|
},
|
|
1596
1617
|
expiration: {
|
|
1597
1618
|
mobile: {
|
package/es/locales/zh.js
CHANGED
|
@@ -853,14 +853,33 @@ export default {
|
|
|
853
853
|
password: 'SMTP 服务用户密码',
|
|
854
854
|
fromRequired: '请输入发件人邮箱',
|
|
855
855
|
fromInvalid: '发件人邮箱格式不正确',
|
|
856
|
+
receiverRequired: '请输入收件人邮箱',
|
|
857
|
+
receiverInvalid: '收件人邮箱格式不正确',
|
|
856
858
|
hostRequired: '请输入 SMTP 服务地址',
|
|
857
859
|
hostInvalid: '请输入 SMTP 服务地址格式不正确',
|
|
858
860
|
portRequired: '请输入 SMTP 服务端口',
|
|
859
861
|
portInvalid: '请输入 SMTP 服务端口,端口号应该在 0-65535 之间',
|
|
860
862
|
userRequired: '请输入 SMTP 服务用户名',
|
|
861
|
-
passwordRequired: '请输入 SMTP 服务用户密码'
|
|
863
|
+
passwordRequired: '请输入 SMTP 服务用户密码',
|
|
864
|
+
testSuccess: '测试邮件发送成功',
|
|
865
|
+
testFailed: '测试邮件发送失败',
|
|
866
|
+
testReceiver: '收件人邮箱',
|
|
867
|
+
testSendEmail: '测试邮件发送',
|
|
868
|
+
inputTestReceiver: '请输入测试邮件接收者的邮箱地址',
|
|
869
|
+
disable: '禁用邮件通知',
|
|
870
|
+
disableDescription: '禁用后将不再收到邮件通知,如需收到邮件通知,可以在本页面再次开启',
|
|
871
|
+
unsubscribe: '取消邮件订阅',
|
|
872
|
+
unsubscribeDescription: '取消邮件订阅后将不再收到所有邮件通知',
|
|
873
|
+
subscribe: '订阅邮件',
|
|
874
|
+
subscribeDescription: '如需收到邮件通知,可进入配置页再次开启订阅'
|
|
862
875
|
},
|
|
863
|
-
comingSoon: '更多通知方式正在建设中'
|
|
876
|
+
comingSoon: '更多通知方式正在建设中',
|
|
877
|
+
unsubscribe: '取消订阅',
|
|
878
|
+
unsubscribeSucceed: '取消订阅成功',
|
|
879
|
+
unsubscribeFailed: '取消订阅失败',
|
|
880
|
+
unsubscribeTokenRequired: '取消订阅链接不存在',
|
|
881
|
+
unsubscribeTokenExpired: '取消订阅链接已过期',
|
|
882
|
+
unsubscribeTokenInvalid: '取消订阅链接有误'
|
|
864
883
|
},
|
|
865
884
|
router: {
|
|
866
885
|
routerSetting: '域名和网址',
|
|
@@ -1275,7 +1294,8 @@ export default {
|
|
|
1275
1294
|
issueBy: '由 {name} 颁发',
|
|
1276
1295
|
configColor: '设置通行证颜色',
|
|
1277
1296
|
configColorTip: '通过调色盘来自定义通行证的主色调',
|
|
1278
|
-
color: '通行证颜色'
|
|
1297
|
+
color: '通行证颜色',
|
|
1298
|
+
description: '使用此通行证以 {title} 连接 {teamName}'
|
|
1279
1299
|
},
|
|
1280
1300
|
inviting: {
|
|
1281
1301
|
link: '邀请链接',
|
|
@@ -1595,7 +1615,8 @@ export default {
|
|
|
1595
1615
|
},
|
|
1596
1616
|
comingSoon: '更多登录方式正在建设中',
|
|
1597
1617
|
moreLogin: '更多登录方式',
|
|
1598
|
-
federated: '统一登录'
|
|
1618
|
+
federated: '统一登录',
|
|
1619
|
+
runTest: '测试'
|
|
1599
1620
|
},
|
|
1600
1621
|
expiration: {
|
|
1601
1622
|
mobile: {
|
|
@@ -10,11 +10,13 @@ var _ahooks = require("ahooks");
|
|
|
10
10
|
var _reactHookForm = require("react-hook-form");
|
|
11
11
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
12
12
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
13
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
13
14
|
var _isEmail = _interopRequireDefault(require("validator/lib/isEmail"));
|
|
14
15
|
var _isURL = _interopRequireDefault(require("validator/lib/isURL"));
|
|
15
16
|
var _isPort = _interopRequireDefault(require("validator/lib/isPort"));
|
|
16
17
|
var _node = require("../../contexts/node");
|
|
17
18
|
var _blocklet = require("../../contexts/blocklet");
|
|
19
|
+
var _confirm = _interopRequireDefault(require("../../hooks/confirm"));
|
|
18
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
22
|
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; }
|
|
@@ -42,6 +44,10 @@ function NotificationEmail() {
|
|
|
42
44
|
const {
|
|
43
45
|
t
|
|
44
46
|
} = (0, _context.useLocaleContext)();
|
|
47
|
+
const {
|
|
48
|
+
confirmApi,
|
|
49
|
+
confirmHolder
|
|
50
|
+
} = (0, _confirm.default)();
|
|
45
51
|
const did = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
|
|
46
52
|
const config = Object.assign(_objectSpread({}, defaultFormValues), (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : (_blocklet$settings$no = _blocklet$settings.notification) === null || _blocklet$settings$no === void 0 ? void 0 : _blocklet$settings$no.email) || {});
|
|
47
53
|
const {
|
|
@@ -53,8 +59,13 @@ function NotificationEmail() {
|
|
|
53
59
|
} = (0, _reactHookForm.useForm)({
|
|
54
60
|
defaultValues: (0, _pick.default)(config, Object.keys(defaultFormValues))
|
|
55
61
|
});
|
|
62
|
+
const pageState = (0, _ahooks.useReactive)({
|
|
63
|
+
testReceiver: '',
|
|
64
|
+
testReceiverError: ''
|
|
65
|
+
});
|
|
56
66
|
const enabled = watch('enabled');
|
|
57
|
-
const onSubmit = (0, _ahooks.useMemoizedFn)(async data
|
|
67
|
+
const onSubmit = (0, _ahooks.useMemoizedFn)(async function (data, event) {
|
|
68
|
+
let showNotification = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
58
69
|
try {
|
|
59
70
|
var _blockletChanged$sett, _blockletChanged$sett2;
|
|
60
71
|
const {
|
|
@@ -70,11 +81,80 @@ function NotificationEmail() {
|
|
|
70
81
|
const defaultValues = Object.assign(_objectSpread({}, defaultFormValues), (blockletChanged === null || blockletChanged === void 0 ? void 0 : (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 ? void 0 : (_blockletChanged$sett2 = _blockletChanged$sett.notification) === null || _blockletChanged$sett2 === void 0 ? void 0 : _blockletChanged$sett2.email) || {});
|
|
71
82
|
// 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
|
|
72
83
|
reset(defaultValues);
|
|
73
|
-
|
|
84
|
+
if (showNotification) {
|
|
85
|
+
_Toast.default.success(t('oauth.saveSuccess'));
|
|
86
|
+
}
|
|
74
87
|
} catch (err) {
|
|
75
|
-
|
|
88
|
+
if (showNotification) {
|
|
89
|
+
_Toast.default.error(err.message || t('oauth.saveFailed'));
|
|
90
|
+
} else {
|
|
91
|
+
throw err;
|
|
92
|
+
}
|
|
76
93
|
}
|
|
77
94
|
});
|
|
95
|
+
const onTestEmail = (0, _ahooks.useMemoizedFn)(async (data, event, receiver) => {
|
|
96
|
+
try {
|
|
97
|
+
// HACK: 如果当前数据有修改,则需要先保存配置,才能测试
|
|
98
|
+
if (formState.isDirty) {
|
|
99
|
+
await onSubmit(data, event, false);
|
|
100
|
+
}
|
|
101
|
+
await api.sendEmail({
|
|
102
|
+
input: {
|
|
103
|
+
did,
|
|
104
|
+
receiver,
|
|
105
|
+
email: JSON.stringify({
|
|
106
|
+
body: 'Your SMTP configuration is correct!',
|
|
107
|
+
title: 'Test email',
|
|
108
|
+
type: 'notification'
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
_Toast.default.success(t('notification.email.testSuccess'));
|
|
113
|
+
} catch (err) {
|
|
114
|
+
_Toast.default.error(err.message || t('notification.email.testfailed'));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const showTestEmailModal = (0, _ahooks.useMemoizedFn)((data, event) => {
|
|
118
|
+
pageState.testReceiver = '';
|
|
119
|
+
pageState.testReceiverError = '';
|
|
120
|
+
confirmApi.open({
|
|
121
|
+
title: t('notification.email.testSendEmail'),
|
|
122
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
123
|
+
content: () => {
|
|
124
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
125
|
+
sx: {
|
|
126
|
+
width: '300px'
|
|
127
|
+
},
|
|
128
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
129
|
+
fullWidth: true,
|
|
130
|
+
name: "testReceiver",
|
|
131
|
+
label: t('notification.email.inputTestReceiver'),
|
|
132
|
+
value: pageState.testReceiver,
|
|
133
|
+
onChange: e => {
|
|
134
|
+
pageState.testReceiver = e.target.value;
|
|
135
|
+
},
|
|
136
|
+
error: !!pageState.testReceiverError,
|
|
137
|
+
helperText: pageState.testReceiverError || ' '
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
async onConfirm(close) {
|
|
142
|
+
var _pageState$testReceiv;
|
|
143
|
+
const receiverEmail = (_pageState$testReceiv = pageState.testReceiver) === null || _pageState$testReceiv === void 0 ? void 0 : _pageState$testReceiv.trim();
|
|
144
|
+
if (!receiverEmail) {
|
|
145
|
+
pageState.testReceiverError = t('notification.email.receiverRequired');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (!(0, _isEmail.default)(receiverEmail)) {
|
|
149
|
+
pageState.testReceiverError = t('notification.email.receiverInvalid');
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
pageState.testReceiverError = '';
|
|
153
|
+
await onTestEmail(data, event, receiverEmail);
|
|
154
|
+
close();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
78
158
|
const validateFrom = (0, _ahooks.useMemoizedFn)(value => {
|
|
79
159
|
const val = value === null || value === void 0 ? void 0 : value.trim();
|
|
80
160
|
if (!val) {
|
|
@@ -120,8 +200,8 @@ function NotificationEmail() {
|
|
|
120
200
|
return true;
|
|
121
201
|
});
|
|
122
202
|
const noop = (0, _ahooks.useMemoizedFn)(() => true);
|
|
123
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
124
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
|
|
203
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
204
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
|
|
125
205
|
onSubmit: handleSubmit(onSubmit),
|
|
126
206
|
disabled: true,
|
|
127
207
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
@@ -273,14 +353,22 @@ function NotificationEmail() {
|
|
|
273
353
|
})
|
|
274
354
|
});
|
|
275
355
|
}
|
|
276
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
356
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
357
|
+
variant: "outlined",
|
|
358
|
+
color: "warning",
|
|
359
|
+
onClick: handleSubmit(showTestEmailModal),
|
|
360
|
+
sx: {
|
|
361
|
+
mr: 2
|
|
362
|
+
},
|
|
363
|
+
disabled: !enabled,
|
|
364
|
+
children: t('oauth.runTest')
|
|
365
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
277
366
|
type: "submit",
|
|
278
367
|
variant: "contained",
|
|
279
|
-
onSubmit: handleSubmit(onSubmit),
|
|
280
368
|
disabled: !formState.isDirty,
|
|
281
369
|
children: t('oauth.save')
|
|
282
370
|
})]
|
|
283
|
-
})
|
|
371
|
+
}), confirmHolder]
|
|
284
372
|
});
|
|
285
373
|
}
|
|
286
374
|
var _default = exports.default = NotificationEmail;
|
package/lib/hooks/confirm.js
CHANGED
package/lib/locales/en.js
CHANGED
|
@@ -856,14 +856,33 @@ var _default = exports.default = {
|
|
|
856
856
|
password: 'SMTP server user password',
|
|
857
857
|
fromRequired: 'Email sender is required',
|
|
858
858
|
fromInvalid: 'Email sender is invalid',
|
|
859
|
+
receiverRequired: 'Email receiver is required',
|
|
860
|
+
receiverInvalid: 'Email receiver is invalid',
|
|
859
861
|
hostRequired: 'SMTP server host is required',
|
|
860
862
|
hostInvalid: 'SMTP server host is invalid',
|
|
861
863
|
portRequired: 'SMTP server port is required',
|
|
862
864
|
portInvalid: 'SMTP server port is invalid, port should be between 1 and 65535',
|
|
863
865
|
userRequired: 'SMTP server username is required',
|
|
864
|
-
passwordRequired: 'SMTP server user password is required'
|
|
866
|
+
passwordRequired: 'SMTP server user password is required',
|
|
867
|
+
testSuccess: 'Test email send successfully',
|
|
868
|
+
testFailed: 'Test email send failed',
|
|
869
|
+
testReceiver: 'Email receiver',
|
|
870
|
+
testSendEmail: 'Test email send',
|
|
871
|
+
inputTestReceiver: 'Please input test receiver email',
|
|
872
|
+
disable: 'Unsubscribe email notification',
|
|
873
|
+
disableDescription: 'After unsubscribe, you will no longer receive email notifications. To receive email notifications, you can subscribe it again on this page.',
|
|
874
|
+
unsubscribe: 'Unsubscribe email notification',
|
|
875
|
+
unsubscribeDescription: 'After unsubscribe, you will no longer receive any email notifications.',
|
|
876
|
+
subscribe: 'subscribe',
|
|
877
|
+
subscribeDescription: 'To receive email notifications, you can subscribe it again on settings page.'
|
|
865
878
|
},
|
|
866
|
-
comingSoon: 'More notification channel are under construction'
|
|
879
|
+
comingSoon: 'More notification channel are under construction',
|
|
880
|
+
unsubscribe: 'Unsubscribe',
|
|
881
|
+
unsubscribeSucceed: 'Unsubscribe succeeded',
|
|
882
|
+
unsubscribeFailed: 'Unsubscribe failed',
|
|
883
|
+
unsubscribeTokenRequired: 'Unsubscribe token in required',
|
|
884
|
+
unsubscribeTokenExpired: 'Unsubscribe token is expired',
|
|
885
|
+
unsubscribeTokenInvalid: 'Unsubscribe token is invalid'
|
|
867
886
|
},
|
|
868
887
|
router: {
|
|
869
888
|
routerSetting: 'Domains & URLs',
|
|
@@ -1275,7 +1294,8 @@ var _default = exports.default = {
|
|
|
1275
1294
|
issueBy: 'Issue by {name}',
|
|
1276
1295
|
configColor: 'Config Passport Color',
|
|
1277
1296
|
configColorTip: 'Customize the color of the passport',
|
|
1278
|
-
color: 'Passport Color'
|
|
1297
|
+
color: 'Passport Color',
|
|
1298
|
+
description: 'Use this passport to connect {teamName} as {title}'
|
|
1279
1299
|
},
|
|
1280
1300
|
inviting: {
|
|
1281
1301
|
link: 'Invite Link',
|
|
@@ -1597,7 +1617,8 @@ var _default = exports.default = {
|
|
|
1597
1617
|
},
|
|
1598
1618
|
comingSoon: 'More login methods are under construction',
|
|
1599
1619
|
moreLogin: 'More Login',
|
|
1600
|
-
federated: 'Federated Login'
|
|
1620
|
+
federated: 'Federated Login',
|
|
1621
|
+
runTest: 'Test'
|
|
1601
1622
|
},
|
|
1602
1623
|
expiration: {
|
|
1603
1624
|
mobile: {
|
package/lib/locales/zh.js
CHANGED
|
@@ -859,14 +859,33 @@ var _default = exports.default = {
|
|
|
859
859
|
password: 'SMTP 服务用户密码',
|
|
860
860
|
fromRequired: '请输入发件人邮箱',
|
|
861
861
|
fromInvalid: '发件人邮箱格式不正确',
|
|
862
|
+
receiverRequired: '请输入收件人邮箱',
|
|
863
|
+
receiverInvalid: '收件人邮箱格式不正确',
|
|
862
864
|
hostRequired: '请输入 SMTP 服务地址',
|
|
863
865
|
hostInvalid: '请输入 SMTP 服务地址格式不正确',
|
|
864
866
|
portRequired: '请输入 SMTP 服务端口',
|
|
865
867
|
portInvalid: '请输入 SMTP 服务端口,端口号应该在 0-65535 之间',
|
|
866
868
|
userRequired: '请输入 SMTP 服务用户名',
|
|
867
|
-
passwordRequired: '请输入 SMTP 服务用户密码'
|
|
869
|
+
passwordRequired: '请输入 SMTP 服务用户密码',
|
|
870
|
+
testSuccess: '测试邮件发送成功',
|
|
871
|
+
testFailed: '测试邮件发送失败',
|
|
872
|
+
testReceiver: '收件人邮箱',
|
|
873
|
+
testSendEmail: '测试邮件发送',
|
|
874
|
+
inputTestReceiver: '请输入测试邮件接收者的邮箱地址',
|
|
875
|
+
disable: '禁用邮件通知',
|
|
876
|
+
disableDescription: '禁用后将不再收到邮件通知,如需收到邮件通知,可以在本页面再次开启',
|
|
877
|
+
unsubscribe: '取消邮件订阅',
|
|
878
|
+
unsubscribeDescription: '取消邮件订阅后将不再收到所有邮件通知',
|
|
879
|
+
subscribe: '订阅邮件',
|
|
880
|
+
subscribeDescription: '如需收到邮件通知,可进入配置页再次开启订阅'
|
|
868
881
|
},
|
|
869
|
-
comingSoon: '更多通知方式正在建设中'
|
|
882
|
+
comingSoon: '更多通知方式正在建设中',
|
|
883
|
+
unsubscribe: '取消订阅',
|
|
884
|
+
unsubscribeSucceed: '取消订阅成功',
|
|
885
|
+
unsubscribeFailed: '取消订阅失败',
|
|
886
|
+
unsubscribeTokenRequired: '取消订阅链接不存在',
|
|
887
|
+
unsubscribeTokenExpired: '取消订阅链接已过期',
|
|
888
|
+
unsubscribeTokenInvalid: '取消订阅链接有误'
|
|
870
889
|
},
|
|
871
890
|
router: {
|
|
872
891
|
routerSetting: '域名和网址',
|
|
@@ -1281,7 +1300,8 @@ var _default = exports.default = {
|
|
|
1281
1300
|
issueBy: '由 {name} 颁发',
|
|
1282
1301
|
configColor: '设置通行证颜色',
|
|
1283
1302
|
configColorTip: '通过调色盘来自定义通行证的主色调',
|
|
1284
|
-
color: '通行证颜色'
|
|
1303
|
+
color: '通行证颜色',
|
|
1304
|
+
description: '使用此通行证以 {title} 连接 {teamName}'
|
|
1285
1305
|
},
|
|
1286
1306
|
inviting: {
|
|
1287
1307
|
link: '邀请链接',
|
|
@@ -1601,7 +1621,8 @@ var _default = exports.default = {
|
|
|
1601
1621
|
},
|
|
1602
1622
|
comingSoon: '更多登录方式正在建设中',
|
|
1603
1623
|
moreLogin: '更多登录方式',
|
|
1604
|
-
federated: '统一登录'
|
|
1624
|
+
federated: '统一登录',
|
|
1625
|
+
runTest: '测试'
|
|
1605
1626
|
},
|
|
1606
1627
|
expiration: {
|
|
1607
1628
|
mobile: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.20-beta-
|
|
3
|
+
"version": "1.16.20-beta-bb1cd034",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abtnode/auth": "1.16.20-beta-
|
|
31
|
-
"@abtnode/constant": "1.16.20-beta-
|
|
32
|
-
"@abtnode/util": "1.16.20-beta-
|
|
30
|
+
"@abtnode/auth": "1.16.20-beta-bb1cd034",
|
|
31
|
+
"@abtnode/constant": "1.16.20-beta-bb1cd034",
|
|
32
|
+
"@abtnode/util": "1.16.20-beta-bb1cd034",
|
|
33
33
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
34
|
-
"@arcblock/did": "^1.18.
|
|
34
|
+
"@arcblock/did": "^1.18.105",
|
|
35
35
|
"@arcblock/did-connect": "^2.8.21",
|
|
36
36
|
"@arcblock/did-motif": "^1.1.13",
|
|
37
37
|
"@arcblock/icons": "^2.8.21",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"@arcblock/react-hooks": "^2.8.21",
|
|
40
40
|
"@arcblock/terminal": "^2.8.21",
|
|
41
41
|
"@arcblock/ux": "^2.8.21",
|
|
42
|
-
"@blocklet/constant": "1.16.20-beta-
|
|
42
|
+
"@blocklet/constant": "1.16.20-beta-bb1cd034",
|
|
43
43
|
"@blocklet/launcher-layout": "2.2.47",
|
|
44
44
|
"@blocklet/list": "^0.12.57",
|
|
45
|
-
"@blocklet/meta": "1.16.20-beta-
|
|
45
|
+
"@blocklet/meta": "1.16.20-beta-bb1cd034",
|
|
46
46
|
"@blocklet/ui-react": "^2.8.21",
|
|
47
47
|
"@blocklet/uploader": "^0.0.52",
|
|
48
48
|
"@emotion/react": "^11.10.4",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@mui/material": "^5.14.10",
|
|
55
55
|
"@mui/styles": "^5.14.10",
|
|
56
56
|
"@mui/x-date-pickers": "^6.14.0",
|
|
57
|
-
"@ocap/client": "1.18.
|
|
57
|
+
"@ocap/client": "1.18.105",
|
|
58
58
|
"@uiw/react-markdown-preview": "4.0.6",
|
|
59
59
|
"ahooks": "^3.7.1",
|
|
60
60
|
"axios": "^0.27.2",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"babel-plugin-inline-react-svg": "^1.1.2",
|
|
101
101
|
"glob": "^10.3.3"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "b000d880478911fbad7f5b197daf8a9065463ca8",
|
|
104
104
|
"exports": {
|
|
105
105
|
".": {
|
|
106
106
|
"import": "./es/index.js",
|