From d5ea0fab0249b3214906df14da2c3780a6cd75d5 Mon Sep 17 00:00:00 2001 From: Brezo Cordero <8002881+brezocordero@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:30:03 -0500 Subject: [PATCH] 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] --- .../src/notices/automations_info_notice.tsx | 42 +++++++++++++++++++ .../pages/woo_commerce/woo_commerce.tsx | 16 ++++--- mailpoet/views/settings_translations.html | 1 + 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 mailpoet/assets/js/src/notices/automations_info_notice.tsx diff --git a/mailpoet/assets/js/src/notices/automations_info_notice.tsx b/mailpoet/assets/js/src/notices/automations_info_notice.tsx new file mode 100644 index 0000000000..09e0f6c6d2 --- /dev/null +++ b/mailpoet/assets/js/src/notices/automations_info_notice.tsx @@ -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) => ( + + {match} + + ), + ); + automationsInfo = ReactStringReplace( + automationsInfo, + /\[link2\](.*?)\[\/link2\]/g, + (match) => ( + + {match} + + ), + ); + return ( + +

{automationsInfo}

+
+ ); +} + +export { AutomationsInfoNotice }; diff --git a/mailpoet/assets/js/src/settings/pages/woo_commerce/woo_commerce.tsx b/mailpoet/assets/js/src/settings/pages/woo_commerce/woo_commerce.tsx index 03477908e9..f58118d120 100644 --- a/mailpoet/assets/js/src/settings/pages/woo_commerce/woo_commerce.tsx +++ b/mailpoet/assets/js/src/settings/pages/woo_commerce/woo_commerce.tsx @@ -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 ( -
- - - - -
+ <> + +
+ + + + +
+ ); } diff --git a/mailpoet/views/settings_translations.html b/mailpoet/views/settings_translations.html index 3058746a95..fed7813356 100644 --- a/mailpoet/views/settings_translations.html +++ b/mailpoet/views/settings_translations.html @@ -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!"),