Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/mailchimp related tweaks #3381

Merged
merged 5 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/wizards/engagement/components/active-campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ export default function ActiveCampaign( { value, onChange } ) {
title={ __( 'ActiveCampaign settings', 'newspack-plugin' ) }
description={ __( 'Settings for the ActiveCampaign integration.', 'newspack-plugin' ) }
/>
{ value.masterList === '' && (
<Notice
noticeText={ __(
'No Master List selected. You will not be able to send reader activity data to ActiveCampaign.',
'newspack-plugin'
) }
isError
/>
)}
<SelectControl
label={ __( 'Master List', 'newspack-plugin' ) }
help={ __(
Expand Down
17 changes: 13 additions & 4 deletions src/wizards/engagement/components/mailchimp.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ export default function Mailchimp( { value, onChange } ) {
title={ __( 'Mailchimp settings', 'newspack-plugin' ) }
description={ __( 'Settings for the Mailchimp integration.', 'newspack-plugin' ) }
/>
{ value.audienceId === '' && (
<Notice
noticeText={ __(
'No Mailchimp audience selected. You will not be able to send reader activity data to Mailchimp.',
'newspack-plugin'
) }
isError
/>
)}
<SelectControl
label={ __( 'Audience ID', 'newspack-plugin' ) }
help={ __( 'Choose an audience to receive reader activity data.', 'newspack-plugin' ) }
Expand All @@ -51,17 +60,17 @@ export default function Mailchimp( { value, onChange } ) {
/>
{ value.audienceId && (
<SelectControl
label={ __( 'Default reader status', 'newspack' ) }
label={ __( 'Default reader status', 'newspack-plugin' ) }
help={ __(
'Choose which MailChimp status readers should have by default if they are not subscribed to any newsletters',
'newspack'
'newspack-plugin'
) }
disabled={ inFlight }
value={ value.readerDefaultStatus }
onChange={ handleChange( 'readerDefaultStatus' ) }
options={ [
{ value: 'transactional', label: __( 'Transactional/Non-Subscribed', 'newspack' ) },
{ value: 'subscribed', label: __( 'Subscribed', 'newspack' ) },
{ value: 'transactional', label: __( 'Transactional/Non-Subscribed', 'newspack-plugin' ) },
{ value: 'subscribed', label: __( 'Subscribed', 'newspack-plugin' ) },
] }
/>
) }
Expand Down
8 changes: 0 additions & 8 deletions src/wizards/engagement/views/newsletters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
ActionCard,
Grid,
PluginInstaller,
SectionHeader,
SelectControl,
TextControl,
Waiting,
Expand Down Expand Up @@ -413,13 +412,6 @@ const Newsletters = () => {
setInitialProvider={ setInitialProvider }
/>
<SubscriptionLists lockedLists={ lockedLists } initialProvider={ initialProvider } />
{ 'mailchimp' === newslettersConfig?.newspack_newsletters_service_provider && (
<>
<hr />
<SectionHeader title={ __( 'WooCommerce integration', 'newspack-plugin' ) } />
<PluginInstaller plugins={ [ 'mailchimp-for-woocommerce' ] } withoutFooterButton />
</>
) }
</>
);
};
Expand Down
12 changes: 12 additions & 0 deletions src/wizards/engagement/views/reader-activation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,18 @@ export default withWizardScreen( ( { wizardApiFetch } ) => {
<Button
isPrimary
onClick={ () => {
if ( config.sync_esp ) {
if (isMailchimp && config.mailchimp_audience_id === '') {
// eslint-disable-next-line no-alert
alert( __( 'Please select a Mailchimp Audience ID.', 'newspack-plugin' ) );
return
}
if (isActiveCampaign && config.active_campaign_master_list === '') {
// eslint-disable-next-line no-alert
alert( __( 'Please select an ActiveCampaign Master List.', 'newspack-plugin' ) );
return
}
}
saveConfig( {
newsletters_label: config.newsletters_label, // TODO: Deprecate this in favor of user input via the prompt copy wizard.
mailchimp_audience_id: config.mailchimp_audience_id,
Expand Down