|
@@ -1,6 +1,7 @@
|
1
|
1
|
import { Theme } from '@mui/material';
|
2
|
2
|
import React, { isValidElement, useCallback, useContext } from 'react';
|
3
|
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+import { useSelector } from 'react-redux';
|
4
|
5
|
import { keyframes } from 'tss-react';
|
5
|
6
|
import { makeStyles } from 'tss-react/mui';
|
6
|
7
|
|
|
@@ -15,6 +16,7 @@ import {
|
15
|
16
|
IconWarningCircle
|
16
|
17
|
} from '../../../base/icons/svg';
|
17
|
18
|
import Message from '../../../base/react/components/web/Message';
|
|
19
|
+import { getSupportUrl } from '../../../base/react/functions';
|
18
|
20
|
import { withPixelLineHeight } from '../../../base/styles/functions.web';
|
19
|
21
|
import { NOTIFICATION_ICON, NOTIFICATION_TYPE } from '../../constants';
|
20
|
22
|
import { INotificationProps } from '../../types';
|
|
@@ -190,6 +192,7 @@ const Notification = ({
|
190
|
192
|
const { classes, cx, theme } = useStyles();
|
191
|
193
|
const { t } = useTranslation();
|
192
|
194
|
const { unmounting } = useContext(NotificationsTransitionContext);
|
|
195
|
+ const supportUrl = useSelector(getSupportUrl);
|
193
|
196
|
|
194
|
197
|
const ICON_COLOR = {
|
195
|
198
|
error: theme.palette.iconError,
|
|
@@ -229,9 +232,9 @@ const Notification = ({
|
229
|
232
|
);
|
230
|
233
|
}, [ description, descriptionArguments, descriptionKey, classes ]);
|
231
|
234
|
|
232
|
|
- const _onOpenSupportLink = () => {
|
233
|
|
- window.open(interfaceConfig.SUPPORT_URL, '_blank', 'noopener');
|
234
|
|
- };
|
|
235
|
+ const _onOpenSupportLink = useCallback(() => {
|
|
236
|
+ window.open(supportUrl, '_blank', 'noopener');
|
|
237
|
+ }, [ supportUrl ]);
|
235
|
238
|
|
236
|
239
|
const mapAppearanceToButtons = useCallback((): {
|
237
|
240
|
content: string; onClick: () => void; testId?: string; type?: string; }[] => {
|
|
@@ -244,7 +247,7 @@ const Notification = ({
|
244
|
247
|
}
|
245
|
248
|
];
|
246
|
249
|
|
247
|
|
- if (!hideErrorSupportLink && interfaceConfig.SUPPORT_URL) {
|
|
250
|
+ if (!hideErrorSupportLink && supportUrl) {
|
248
|
251
|
buttons.push({
|
249
|
252
|
content: t('dialog.contactSupport'),
|
250
|
253
|
onClick: _onOpenSupportLink
|
|
@@ -279,7 +282,7 @@ const Notification = ({
|
279
|
282
|
|
280
|
283
|
return [];
|
281
|
284
|
}
|
282
|
|
- }, [ appearance, onDismiss, customActionHandler, customActionNameKey, hideErrorSupportLink ]);
|
|
285
|
+ }, [ appearance, onDismiss, customActionHandler, customActionNameKey, hideErrorSupportLink, supportUrl ]);
|
283
|
286
|
|
284
|
287
|
const getIcon = useCallback(() => {
|
285
|
288
|
let iconToDisplay;
|
|
@@ -313,7 +316,7 @@ const Notification = ({
|
313
|
316
|
<div
|
314
|
317
|
aria-atomic = 'false'
|
315
|
318
|
aria-live = 'polite'
|
316
|
|
- className = { cx(classes.container, unmounting.get(uid ?? '') && 'unmount') }
|
|
319
|
+ className = { cx(classes.container, (unmounting.get(uid ?? '') && 'unmount') as string | undefined) }
|
317
|
320
|
data-testid = { titleKey || descriptionKey }
|
318
|
321
|
id = { uid }>
|
319
|
322
|
<div className = { cx(classes.ribbon, appearance) } />
|