Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.5'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.txt
  • Loading branch information
ryanhungate committed Dec 14, 2023
2 parents d1e1385 + eb56c1d commit 196560c
Show file tree
Hide file tree
Showing 33 changed files with 4,483 additions and 2,291 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
== Changelog ==
= 3.5 =
* Support for updated Mailchimp attribution methods
* Adds a Continue to Mailchimp CTA to Woo Dashboard UI
* Tested for WooCommerce v8.4 compatibility
= 3.4 =
* Fix rest_url function for installs that are not using wp_rewrite
* Strict type-checks before calling unserialize
* Better wp-cli detection for support
* Fix webhook validation during plugin updates
= 3.3 =
* Performance enhancement: Removing excessive double opt-in api calls during initial sync
* Fix for translated product issue
* Fix for ongoing sync settings failing when double opt-in enabled
* Fix for permalink conflicting with Webhook creation
* Fix for GDPR Marketing Preferences not captured on checkout
* Word-wrap version update to 1.2.3 in blocks
= 3.2 =
* Released: 08-21-2023
* fix for too few arguments to function MailChimp_Service::handleOrderUpdate()
Expand Down
16 changes: 7 additions & 9 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Contributors: ryanhungate, Mailchimp
Tags: ecommerce,email,workflows,mailchimp
Donate link: https://mailchimp.com
Requires at least: 4.9
Tested up to: 6.3
Stable tag: 3.2
Tested up to: 6.4
Stable tag: 3.5
Requires PHP: 7.4
WC requires at least: 4.2
WC tested up to: 8.0
WC tested up to: 8.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Connect your store to your Mailchimp audience to track sales, create targeted emails, send abandoned cart emails, and more.
Expand Down Expand Up @@ -78,9 +78,7 @@ At this time, the synchronization of product categories from WooCommerce to Mail
If you are unable to sync or connect with Mailchimp, you can open a ticket on our [Github plugin page](https://github.com/mailchimp/mc-woocommerce/issues). Please provide the version of the plugin and PHP you're using, any fatal errors in the WooCommerce logs (WooCommerce -> Status -> Logs) you're seeing, along with relevant information to the problem you're experiencing.

== Changelog ==
= 3.2 =
* Released: 08-21-2023
* fix for too few arguments to function MailChimp_Service::handleOrderUpdate()
* update to lateset version of core blocks for the site editor
* adds the plugin icon back to wp-admin menu
* adds automatic webhook cleaning
= 3.5 =
* Support for updated Mailchimp attribution methods
* Adds a Continue to Mailchimp CTA to Woo Dashboard UI
* Tested for WooCommerce v8.4 compatibility
18 changes: 14 additions & 4 deletions admin/class-mailchimp-woocommerce-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function enqueue_styles( $hook ) {
if ( get_bloginfo( 'version' ) < '5.3' ) {
wp_enqueue_style( $this->plugin_name . '-settings', plugin_dir_url( __FILE__ ) . 'css/mailchimp-woocommerce-admin-settings-5.2.css', array(), $this->version );
}
wp_enqueue_style( $this->plugin_name . '-settings', plugin_dir_url( __FILE__ ) . 'css/mailchimp-woocommerce-admin-settings.css', array(), $this->version );
wp_enqueue_style( $this->plugin_name . '-settings', plugin_dir_url( __FILE__ ) . 'css/mailchimp-woocommerce-admin-settings.css', array(), $this->version . '.01' );
wp_style_add_data( $this->plugin_name . '-settings', 'rtl', 'replace' );
}
}
Expand Down Expand Up @@ -364,7 +364,15 @@ public function options_update() {
* Displays notice when plugin is installed but not yet configured / connected to Mailchimp.
*/
public function initial_notice() {
if ( ! mailchimp_is_configured() ) {
global $pagenow;

// if we're on the mc admin setup pages - don't do anything
if ($pagenow == 'admin.php' && isset( $_GET ) && isset( $_GET['page'] ) && 'mailchimp-woocommerce' === $_GET['page'] ) {
return null;
}

// if they've logged in oauth - but have not selected a list id yet - show the admin notice.
if ( (bool) (mailchimp_get_api_key() && !mailchimp_get_list_id())) {
$class = 'notice notice-warning is-dismissible';
$message = sprintf(
/* translators: Placeholders %1$s - opening strong HTML tag, %2$s - closing strong HTML tag, %3$s - opening link HTML tag, %4$s - closing link HTML tag */
Expand Down Expand Up @@ -546,7 +554,7 @@ public function update_plugin_check() {

$this->update_db_check();

mailchimp_log('webhooks', 'Deleted old plugin webhooks');
mailchimp_log('webhooks', 'Ran plugin updater');
}
}

Expand Down Expand Up @@ -2119,7 +2127,9 @@ public function defineWebHooks() {
*/
protected function adminOnlyMiddleware( $message = "You're not allowed to do this" ) {
if ( ! current_user_can( mailchimp_get_allowed_capability() ) ) {
wp_send_json_error( array( 'message' => $message ) );
$error = new \Exception();
mailchimp_debug('admin', 'tracing admin json error', $error->getTrace());
wp_send_json_error( array( 'message' => $message, 'from' => 'mailchimp-for-woocommerce' ) );
}
return true;
}
Expand Down
14 changes: 14 additions & 0 deletions admin/css/mailchimp-woocommerce-admin-settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ a.button.back-step {
padding-left: 58px;
}

.mc-woocommerce-settings-subtitles-row {
display: flex;
align-items: center;
justify-content: space-between;
}

.mc-woocommerce-settings-subtitles {
font-family: "proxima-nova", Arial, Helvetica, sans-serif;
font-size: 22px !important;
Expand Down Expand Up @@ -1228,6 +1234,14 @@ a.button.create-account {
background: linear-gradient(0deg, rgba(255,255,255,0) 10%, rgba(255,255,255,0.6964986678265056) 36%, rgba(255,255,255,1) 100%);
}

@media screen and (max-width: 960px) {
.mc-woocommerce-settings-subtitles-row {
flex-direction: column;
align-items: flex-start;
margin-bottom: 1.69em;
}
}

@media screen and (max-width: 782px) {
.tab-content-wrapper, .notices-content-wrapper {
padding: 0 1em;
Expand Down
79 changes: 42 additions & 37 deletions admin/partials/mailchimp-woocommerce-admin-tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,55 +162,60 @@
<path d="M12.1324 33.1577C12.0456 33.0492 11.9056 33.0827 11.7695 33.1143C11.6749 33.136 11.5664 33.1616 11.448 33.1596C11.1936 33.1557 10.9786 33.0452 10.8583 32.8598C10.7006 32.6192 10.7104 32.2583 10.884 31.8461C10.9076 31.7909 10.9353 31.7297 10.9648 31.6607C11.241 31.0394 11.7064 30 11.1857 29.008C10.7932 28.2625 10.1542 27.797 9.38702 27.7004C8.64939 27.6077 7.89006 27.8798 7.40685 28.4143C6.64358 29.2565 6.52328 30.4044 6.6712 30.8087C6.72445 30.9566 6.80925 30.998 6.87237 31.0059C7.00254 31.0237 7.19385 30.929 7.31416 30.6055C7.32205 30.5819 7.33388 30.5464 7.34769 30.501C7.40094 30.3294 7.50152 30.0099 7.66522 29.7555C7.86245 29.4478 8.17012 29.2348 8.53105 29.1579C8.89789 29.079 9.2746 29.15 9.58819 29.3551C10.1227 29.7062 10.3298 30.361 10.101 30.9862C9.98264 31.3096 9.79133 31.9289 9.83275 32.4378C9.91756 33.4673 10.5507 33.8795 11.1206 33.9249C11.6729 33.9466 12.0594 33.6349 12.1581 33.4081C12.2133 33.274 12.164 33.1932 12.1324 33.1577Z" fill="black"/>
<path d="M44.044 31.2761C44.0223 31.2012 43.8862 30.7002 43.6969 30.0967C43.5075 29.4932 43.3142 29.0672 43.3142 29.0672C44.0696 27.9351 44.0834 26.9233 43.9828 26.3514C43.8763 25.6414 43.5805 25.0359 42.9829 24.4107C42.3873 23.7854 41.1684 23.1445 39.4545 22.6632C39.2593 22.608 38.6123 22.4305 38.5551 22.4127C38.5512 22.3753 38.5078 20.2945 38.4684 19.3991C38.4408 18.7522 38.3836 17.7444 38.0719 16.7504C37.6992 15.4053 37.0483 14.2298 36.2377 13.4764C38.4763 11.157 39.8726 8.60091 39.8707 6.40774C39.8647 2.19102 34.6855 0.914962 28.3033 3.55781C28.2974 3.55978 26.9602 4.1278 26.9503 4.13174C26.9444 4.12582 24.5066 1.73346 24.4692 1.7019C17.1954 -4.64488 -5.55475 20.6436 1.71899 26.7853L3.30864 28.1323C2.89644 29.2013 2.73471 30.4241 2.86685 31.7396C3.03647 33.4299 3.90822 35.0511 5.32234 36.3015C6.66348 37.4908 8.42669 38.2422 10.1386 38.2402C12.9688 44.7626 19.4359 48.7643 27.0193 48.9891C35.153 49.2317 41.981 45.4134 44.8428 38.5578C45.0301 38.0765 45.825 35.909 45.825 33.9939C45.825 32.0729 44.7382 31.2761 44.044 31.2761ZM10.7638 36.41C10.5173 36.4514 10.2649 36.4691 10.0104 36.4632C7.55298 36.3981 4.90027 34.1852 4.63598 31.5621C4.34409 28.6629 5.82527 26.4322 8.44839 25.9017C8.76198 25.8386 9.14066 25.8011 9.54892 25.8228C11.0183 25.9037 13.1838 27.0318 13.6789 30.2328C14.1187 33.0689 13.4225 35.9564 10.7638 36.41ZM8.02041 24.1681C6.38736 24.4856 4.9476 25.4106 4.06797 26.6886C3.54137 26.2508 2.56115 25.4007 2.38956 25.0694C0.985306 22.4009 3.92202 17.2138 5.97516 14.285C11.0478 7.04676 18.9922 1.56581 22.6705 2.55984C23.2681 2.72945 25.2482 5.02518 25.2482 5.02518C25.2482 5.02518 21.5719 7.06451 18.1618 9.90853C13.5704 13.4468 10.0992 18.5885 8.02041 24.1681ZM33.8079 35.3252C33.8611 35.3035 33.8986 35.2424 33.8927 35.1812C33.8848 35.1063 33.8177 35.0531 33.7448 35.0609C33.7448 35.0609 29.8969 35.6309 26.26 34.2996C26.6564 33.0117 27.7096 33.4772 29.3012 33.6054C32.1709 33.777 34.7408 33.3569 36.642 32.8125C38.2889 32.3392 40.4505 31.4083 42.1309 30.0829C42.6969 31.3274 42.8981 32.6962 42.8981 32.6962C42.8981 32.6962 43.3359 32.6173 43.7028 32.8441C44.0499 33.0571 44.3024 33.5009 44.1288 34.6448C43.7758 36.7847 42.8665 38.5223 41.338 40.1198C40.4071 41.1217 39.277 41.9935 37.9852 42.6266C37.2988 42.9875 36.5671 43.2991 35.7959 43.5516C30.033 45.4331 24.1339 43.3642 22.2326 38.9207C22.0807 38.5874 21.9525 38.2363 21.852 37.8714C21.0414 34.9426 21.7297 31.43 23.8795 29.2171C23.8795 29.2171 23.8795 29.2171 23.8795 29.2151C24.0116 29.0751 24.1477 28.9094 24.1477 28.7004C24.1477 28.5248 24.0372 28.3414 23.9406 28.2112C23.1892 27.1206 20.5818 25.2607 21.1045 21.6613C21.4792 19.0757 23.7414 17.2553 25.8498 17.3637C26.0273 17.3736 26.2067 17.3834 26.3842 17.3953C27.2974 17.4485 28.0942 17.5669 28.8476 17.5984C30.1059 17.6537 31.238 17.4702 32.5792 16.3519C33.0308 15.9752 33.3937 15.6478 34.0071 15.5453C34.0722 15.5335 34.2319 15.4763 34.5534 15.492C34.8808 15.5098 35.1924 15.5985 35.4725 15.7859C36.5474 16.5018 36.6992 18.2335 36.7545 19.4997C36.786 20.2235 36.8728 21.9729 36.9044 22.4759C36.9734 23.6237 37.2751 23.7874 37.8846 23.9886C38.2278 24.101 38.5473 24.1858 39.0167 24.318C40.4387 24.7183 41.2828 25.1227 41.8153 25.6433C42.1329 25.9688 42.2808 26.3139 42.3261 26.6433C42.4938 27.8661 41.3755 29.3788 38.4171 30.7515C35.1826 32.2524 31.2577 32.6331 28.5459 32.3313C28.3388 32.3076 27.5992 32.2248 27.5952 32.2248C25.4257 31.9329 24.1891 34.7355 25.4908 36.6565C26.329 37.8951 28.6149 38.6998 30.9008 38.6998C36.1431 38.6998 40.1724 36.4613 41.6713 34.5284C41.7167 34.4712 41.7206 34.4633 41.7916 34.3568C41.8646 34.2464 41.8055 34.1852 41.7128 34.2464C40.488 35.0846 35.0484 38.4099 29.2322 37.4099C29.2322 37.4099 28.5261 37.2936 27.8792 37.0431C27.3664 36.8439 26.2935 36.3508 26.1634 35.2483C30.8514 36.6979 33.8079 35.3252 33.8079 35.3252ZM26.3704 34.4476C26.3704 34.4476 26.3724 34.4476 26.3704 34.4476C26.3724 34.4495 26.3724 34.4495 26.3724 34.4515C26.3724 34.4495 26.3724 34.4476 26.3704 34.4476ZM17.3887 14.2554C19.1914 12.1707 21.4121 10.3602 23.4002 9.34249C23.4692 9.30699 23.5422 9.38193 23.5047 9.44899C23.3469 9.73497 23.0432 10.3464 22.9466 10.8118C22.9308 10.8848 23.0097 10.9381 23.0708 10.8966C24.3074 10.0525 26.4612 9.14921 28.3486 9.03284C28.4295 9.02693 28.4689 9.13146 28.4039 9.18076C28.1159 9.40166 27.8023 9.70539 27.5735 10.0131C27.5341 10.0663 27.5716 10.1413 27.6366 10.1413C28.962 10.1511 30.8317 10.6146 32.0486 11.297C32.1315 11.3424 32.0723 11.5021 31.9796 11.4824C30.1375 11.0603 27.1199 10.7389 23.986 11.5041C21.1893 12.1865 19.0533 13.2397 17.4952 14.3738C17.4203 14.4329 17.3256 14.3304 17.3887 14.2554Z" fill="black"/>
</svg>
<p class="mc-woocommerce-settings-subtitles">
<?php
<div class="mc-woocommerce-settings-subtitles-row">
<p class="mc-woocommerce-settings-subtitles">
<?php

$allowed_html = array(
'br' => array(),
);
$allowed_html = array(
'br' => array(),
);

if ( 'api_key' === $active_tab ) {
echo wp_kses( __( 'Add Mailchimp for WooCommerce to build custom segments, send automations, and track purchase activity in Mailchimp', 'mailchimp-for-woocommerce' ), $allowed_html );
}
if ( 'api_key' === $active_tab ) {
echo wp_kses( __( 'Add Mailchimp for WooCommerce to build custom segments, send automations, and track purchase activity in Mailchimp', 'mailchimp-for-woocommerce' ), $allowed_html );
}

if ( 'store_info' === $active_tab && $has_valid_api_key ) {
if ( $show_sync_tab ) {
echo wp_kses( __( 'WooCommerce store and location', 'mailchimp-for-woocommerce' ), $allowed_html );
} else {
echo wp_kses( __( 'Please provide a bit of information about your WooCommerce store', 'mailchimp-for-woocommerce' ), $allowed_html );
if ( 'store_info' === $active_tab && $has_valid_api_key ) {
if ( $show_sync_tab ) {
echo wp_kses( __( 'WooCommerce store and location', 'mailchimp-for-woocommerce' ), $allowed_html );
} else {
echo wp_kses( __( 'Please provide a bit of information about your WooCommerce store', 'mailchimp-for-woocommerce' ), $allowed_html );
}
}
}

if ( 'newsletter_settings' === $active_tab ) {
if ( $show_sync_tab ) {
echo wp_kses( __( 'Campaign and messaging settings', 'mailchimp-for-woocommerce' ), $allowed_html );
} else {
if ( $only_one_list ) {
echo wp_kses( __( 'Please apply your audience settings.', 'mailchimp-for-woocommerce' ), $allowed_html );
if ( 'newsletter_settings' === $active_tab ) {
if ( $show_sync_tab ) {
echo wp_kses( __( 'Campaign and messaging settings', 'mailchimp-for-woocommerce' ), $allowed_html );
} else {
echo wp_kses( __( 'Please apply your audience settings. ', 'mailchimp-for-woocommerce' ), $allowed_html );
echo wp_kses( __( 'If you don’t have an audience, you can choose to create one', 'mailchimp-for-woocommerce' ), $allowed_html );
if ( $only_one_list ) {
echo wp_kses( __( 'Please apply your audience settings.', 'mailchimp-for-woocommerce' ), $allowed_html );
} else {
echo wp_kses( __( 'Please apply your audience settings. ', 'mailchimp-for-woocommerce' ), $allowed_html );
echo wp_kses( __( 'If you don’t have an audience, you can choose to create one', 'mailchimp-for-woocommerce' ), $allowed_html );
}
}
}
}

if ( 'sync' === $active_tab && $show_sync_tab ) {
if ( mailchimp_is_done_syncing() ) {
echo wp_kses( __( 'Success! You are connected to Mailchimp', 'mailchimp-for-woocommerce' ), $allowed_html );
} else {
echo wp_kses( __( 'Your WooCommerce store is syncing to Mailchimp', 'mailchimp-for-woocommerce' ), $allowed_html );
if ( 'sync' === $active_tab && $show_sync_tab ) {
if ( mailchimp_is_done_syncing() ) {
echo wp_kses( __( 'Success! You are connected to Mailchimp', 'mailchimp-for-woocommerce' ), $allowed_html );
} else {
echo wp_kses( __( 'Your WooCommerce store is syncing to Mailchimp', 'mailchimp-for-woocommerce' ), $allowed_html );
}
}
}

if ( 'logs' === $active_tab && $show_sync_tab ) {
echo wp_kses( __( 'Log events from the Mailchimp plugin', 'mailchimp-for-woocommerce' ), $allowed_html );
}
if ( 'logs' === $active_tab && $show_sync_tab ) {
echo wp_kses( __( 'Log events from the Mailchimp plugin', 'mailchimp-for-woocommerce' ), $allowed_html );
}

if ( 'plugin_settings' === $active_tab && $show_sync_tab ) {
echo wp_kses( __( 'Connection settings', 'mailchimp-for-woocommerce' ), $allowed_html );
}
?>
</p>
if ( 'plugin_settings' === $active_tab && $show_sync_tab ) {
echo wp_kses( __( 'Connection settings', 'mailchimp-for-woocommerce' ), $allowed_html );
}
?>
</p>
<?php if ( 'sync' === $active_tab && $show_sync_tab ): ?>
<a href="http://admin.mailchimp.com/integrations/manage?name=woocommerce&source=partner" target="_blank" class="button button-primary tab-content-submit mc-woocommerce-settings-subtitles-cta">Continue to Mailchimp</a>
<?php endif; ?>
</div>
<div class="nav-tab-wrapper">
<?php if ( $has_valid_api_key ) : ?>
<?php if ( 'api_key' === $active_tab ) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const Block = ( { cart, extensions, text, gdprHeadline, gdprStatus, gdpr, checko
}, [ checked, setExtensionData ] );

return (
<>
<div style={{ display: gdprStatus === 'hide' ? 'none' : 'block' }}>
<div className='wc-block-components-checkout-step__container'>
<div style={{ display: gdprStatus === 'hide' ? 'none' : '' }} className='wc-block-components-checkout-step__content'>
<CheckboxControl
id="subscribe-to-newsletter"
checked={ checked }
Expand All @@ -48,7 +48,7 @@ const Block = ( { cart, extensions, text, gdprHeadline, gdprStatus, gdpr, checko
</CheckboxControl>);
}) : ''}
</div>
</>
</div>
);
};

Expand Down
28 changes: 13 additions & 15 deletions blocks/assets/js/checkout-newsletter-subscription-block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Edit = ( { attributes, setAttributes } ) => {
/>
</PanelBody>
</InspectorControls>
<div style={{display: 'flex', lineHeight: '1.5em', alignItems: 'center'}}>
<div style={{display: gdprStatus === 'hide' ? 'none' : 'flex', lineHeight: '1.5em', alignItems: 'center'}}>
<CheckboxControl
id="newsletter-text"
checked={ checked }
Expand All @@ -51,7 +51,7 @@ export const Edit = ( { attributes, setAttributes } ) => {
/>
</div>
{
gdpr && gdpr.length &&
gdpr && gdpr.length && gdprStatus != 'hide' &&
(
<>
<div style={{display: 'flex', marginTop: '2rem'}}>
Expand All @@ -63,26 +63,24 @@ export const Edit = ( { attributes, setAttributes } ) => {
</div>
{gdpr.map((gdprItem, index) => {
return (
<div style={{display: 'flex', marginTop: '1rem'}}>
<CheckboxControl
id={'gdpr_'+gdprItem.marketing_permission_id}
checked={ gdpr[index].enabled }
onChange={ () => {
gdpr[index].enabled = !gdpr[index].enabled;
setAttributes({gdpr: gdpr});
}}
>
<span dangerouslySetInnerHTML={ {__html: gdprItem.text} }/>
</CheckboxControl>
</div>
<CheckboxControl
id={'gdpr_'+gdprItem.marketing_permission_id}
checked={ gdpr[index].enabled }
onChange={ () => {
gdpr[index].enabled = !gdpr[index].enabled;
setAttributes({gdpr: gdpr});
}}
>
<span dangerouslySetInnerHTML={ {__html: gdprItem.text} }/>
</CheckboxControl>
)
})}
</>
)
}
</div>
);
};
}

// not sure
export const Save = () => {
Expand Down
2 changes: 1 addition & 1 deletion blocks/build/newsletter-block-frontend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wc-blocks-checkout', 'wc-blocks-shared-hocs', 'wc-settings', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'ddc7ea2065d45684b756');
<?php return array('dependencies' => array('wc-blocks-checkout', 'wc-blocks-shared-hocs', 'wc-settings', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '6c38ea938266abe7c582');
Loading

0 comments on commit 196560c

Please sign in to comment.