Add automations info notice on Woo Settings tab

This is for Woo Express customers where the automations are hidden when AutomateWoo is enabled.

[MAILPOET-5598]
This commit is contained in:
Brezo Cordero
2023-09-21 16:30:03 -05:00
committed by Aschepikov
parent 946d4a87f8
commit d5ea0fab02
3 changed files with 53 additions and 6 deletions

View File

@@ -0,0 +1,42 @@
import ReactStringReplace from 'react-string-replace';
import { MailPoet } from 'mailpoet';
import { Notice } from 'notices/notice';
function AutomationsInfoNotice() {
if (!MailPoet.hideAutomations) return null;
let automationsInfo = ReactStringReplace(
MailPoet.I18n.t('automationsInfoNotice'),
/\[link1\](.*?)\[\/link1\]/g,
(match) => (
<a
key={match}
rel="noreferrer"
href="https://kb.mailpoet.com/article/397-how-to-set-up-an-automation"
target="_blank"
>
{match}
</a>
),
);
automationsInfo = ReactStringReplace(
automationsInfo,
/\[link2\](.*?)\[\/link2\]/g,
(match) => (
<a
key={match}
rel="noreferrer"
href="https://href.li/?https://kb.mailpoet.com/article/408-integration-with-automatewoo"
target="_blank"
>
{match}
</a>
),
);
return (
<Notice type="warning" scroll renderInPlace timeout={false}>
<p>{automationsInfo}</p>
</Notice>
);
}
export { AutomationsInfoNotice };

View File

@@ -1,15 +1,19 @@
import { SaveButton } from 'settings/components';
import { AutomationsInfoNotice } from 'notices/automations_info_notice';
import { EmailCustomizer } from './email_customizer';
import { CheckoutOptin } from './checkout_optin';
import { SubscribeOldCustomers } from './subscribe_old_customers';
export function WooCommerce() {
return (
<div className="mailpoet-settings-grid">
<EmailCustomizer />
<CheckoutOptin />
<SubscribeOldCustomers />
<SaveButton />
</div>
<>
<AutomationsInfoNotice />
<div className="mailpoet-settings-grid">
<EmailCustomizer />
<CheckoutOptin />
<SubscribeOldCustomers />
<SaveButton />
</div>
</>
);
}

View File

@@ -168,6 +168,7 @@
'wcOptinMsgCannotBeEmpty': __('The checkbox opt-in message cannot be empty.'),
'subscribeOldWCTitle': __('Subscribe old WooCommerce customers'),
'subscribeOldWCDescription': __('Subscribe all my past customers to this list because they agreed to receive marketing emails from me.'),
'automationsInfoNotice': __('Looking for [link1]MailPoet Automations[/link1]? Read how to [link2]enable them[/link2].'),
'mssTitle': __('MailPoet Sending Service'),
'youreSendingWithMss': __("You're now sending with MailPoet!"),