Add KB link to the error message "Your MSS key is already used on another site"
MAILPOET-5162
This commit is contained in:
committed by
Aschepikov
parent
a4864f3ade
commit
4dba4f8b6a
@@ -1,7 +1,9 @@
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import ReactStringReplace from 'react-string-replace';
|
||||||
import { useSelector } from 'settings/store/hooks';
|
import { useSelector } from 'settings/store/hooks';
|
||||||
import { MssStatus } from 'settings/store/types';
|
import { MssStatus } from 'settings/store/types';
|
||||||
|
import { getLinkRegex } from '../../utils';
|
||||||
|
|
||||||
type MssActiveMessageProps = { canUseSuccessClass: boolean };
|
type MssActiveMessageProps = { canUseSuccessClass: boolean };
|
||||||
|
|
||||||
@@ -22,11 +24,22 @@ type NotValidMessageProps = { message?: string };
|
|||||||
function NotValidMessage({ message }: NotValidMessageProps) {
|
function NotValidMessage({ message }: NotValidMessageProps) {
|
||||||
return (
|
return (
|
||||||
<div className="mailpoet_error">
|
<div className="mailpoet_error">
|
||||||
{message ||
|
{message
|
||||||
__(
|
? ReactStringReplace(message, getLinkRegex(), (text) => (
|
||||||
'Your key is not valid for the MailPoet Sending Service',
|
<a
|
||||||
'mailpoet',
|
className="mailpoet-link"
|
||||||
)}
|
key={text}
|
||||||
|
href="https://kb.mailpoet.com/article/249-how-to-change-the-domain-associated-with-a-key"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{text}
|
||||||
|
</a>
|
||||||
|
))
|
||||||
|
: __(
|
||||||
|
'Your key is not valid for the MailPoet Sending Service',
|
||||||
|
'mailpoet',
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import ReactStringReplace from 'react-string-replace';
|
||||||
import { useSelector } from 'settings/store/hooks';
|
import { useSelector } from 'settings/store/hooks';
|
||||||
import { PremiumStatus } from 'settings/store/types';
|
import { PremiumStatus } from 'settings/store/types';
|
||||||
import { Button } from 'common/button/button';
|
import { Button } from 'common/button/button';
|
||||||
import { PremiumModal } from 'common/premium-modal';
|
import { PremiumModal } from 'common/premium-modal';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Data } from '../../premium-modal/upgrade-info';
|
import { Data } from '../../premium-modal/upgrade-info';
|
||||||
|
import { getLinkRegex } from '../../utils';
|
||||||
|
|
||||||
type ActiveMessageProps = { canUseSuccessClass: boolean };
|
type ActiveMessageProps = { canUseSuccessClass: boolean };
|
||||||
|
|
||||||
@@ -67,7 +69,19 @@ type NotValidMessageProps = { message?: string };
|
|||||||
function NotValidMessage({ message }: NotValidMessageProps) {
|
function NotValidMessage({ message }: NotValidMessageProps) {
|
||||||
return (
|
return (
|
||||||
<div className="mailpoet_error">
|
<div className="mailpoet_error">
|
||||||
{message || __('Your key is not valid for MailPoet Premium', 'mailpoet')}
|
{message
|
||||||
|
? ReactStringReplace(message, getLinkRegex(), (text) => (
|
||||||
|
<a
|
||||||
|
className="mailpoet-link"
|
||||||
|
key={text}
|
||||||
|
href="https://kb.mailpoet.com/article/249-how-to-change-the-domain-associated-with-a-key"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{text}
|
||||||
|
</a>
|
||||||
|
))
|
||||||
|
: __('Your key is not valid for MailPoet Premium', 'mailpoet')}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -140,7 +140,7 @@ class Services extends APIEndpoint {
|
|||||||
$error = __('Your key is not valid for the MailPoet Sending Service', 'mailpoet');
|
$error = __('Your key is not valid for the MailPoet Sending Service', 'mailpoet');
|
||||||
break;
|
break;
|
||||||
case Bridge::KEY_ALREADY_USED:
|
case Bridge::KEY_ALREADY_USED:
|
||||||
$error = __('Your MailPoet Sending Service key is already used on another site', 'mailpoet');
|
$error = __('Your MailPoet Sending Service key is already [link]used on another site[/link]', 'mailpoet');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$code = !empty($result['code']) ? $result['code'] : Bridge::CHECK_ERROR_UNKNOWN;
|
$code = !empty($result['code']) ? $result['code'] : Bridge::CHECK_ERROR_UNKNOWN;
|
||||||
@@ -209,7 +209,7 @@ class Services extends APIEndpoint {
|
|||||||
$error = __('Your key is not valid for MailPoet Premium', 'mailpoet');
|
$error = __('Your key is not valid for MailPoet Premium', 'mailpoet');
|
||||||
break;
|
break;
|
||||||
case Bridge::KEY_ALREADY_USED:
|
case Bridge::KEY_ALREADY_USED:
|
||||||
$error = __('Your Premium key is already used on another site', 'mailpoet');
|
$error = __('Your Premium key is already [link]used on another site[/link]', 'mailpoet');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$code = !empty($result['code']) ? $result['code'] : Bridge::CHECK_ERROR_UNKNOWN;
|
$code = !empty($result['code']) ? $result['code'] : Bridge::CHECK_ERROR_UNKNOWN;
|
||||||
|
Reference in New Issue
Block a user