Skip to content

Commit

Permalink
Merge pull request #1141 from mailchimp/4.0
Browse files Browse the repository at this point in the history
4.0
  • Loading branch information
ryanhungate authored Apr 22, 2024
2 parents 961ae41 + 2786e5c commit b16e89d
Show file tree
Hide file tree
Showing 112 changed files with 4,918 additions and 299 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
== Changelog ==
= 4.0 =
* Allow orders to be sent to Mailchimp even if a Wordpress user role isn't set
* Support for custom order IDs
* Updated dependabot issues related to block-based checkouts
* Refreshed plugin interface
= 3.7 =
* Allow orders to be sent to Mailchimp even if a Wordpress user role isn't set
* Support for custom order IDs
Expand Down
10 changes: 6 additions & 4 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Tags: ecommerce,email,workflows,mailchimp
Donate link: https://mailchimp.com
Requires at least: 4.9
Tested up to: 6.5
Stable tag: 3.7
Stable tag: 4.0
Requires PHP: 7.4
WC requires at least: 4.2
WC tested up to: 8.7
WC tested up to: 8.8
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 @@ -77,8 +77,10 @@ At this time, the synchronization of product categories from WooCommerce to Mail
= My question is not listed =
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 ==

This comment has been minimized.

Copy link
@scottbuscemi

scottbuscemi May 7, 2024

@ryanhungate Removing this broke the "View version x.x.x details" link from the WordPress Admin "Updates" tab. Please re-add so the latest details are available to view there :)

This comment has been minimized.

Copy link
@ryanhungate

ryanhungate May 7, 2024

Author Collaborator

Ah! Thanks for the heads up - we missed that one! We will add that back in the next release coming out soon. Appreciate the feedback.

= 3.7 =

= 4.0 =
* Allow orders to be sent to Mailchimp even if a Wordpress user role isn't set
* Support for custom order IDs
* Updated dependabot issues related to block-based checkouts
* Refreshed plugin interface

580 changes: 371 additions & 209 deletions admin/class-mailchimp-woocommerce-admin.php

Large diffs are not rendered by default.

49 changes: 36 additions & 13 deletions admin/js/mailchimp-woocommerce-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
}
});

$('#mc_notice_button').on('click', function() {
$('.mc-wc-notice').fadeOut()
});

// re-enable disable select input on audience settings submit
$('#mailchimp_woocommerce_options').on('submit', function() {
$('select[name="mailchimp-woocommerce[mailchimp_list]"]').prop('disabled', false);
Expand Down Expand Up @@ -331,11 +335,12 @@
$('#mailchimp-oauth-error').hide();
$('#mailchimp-oauth-connecting').hide();
$('#mailchimp-oauth-connected').show();


let body = JSON.parse(finishResponse.data.body);
// get access_token from finishResponse and fill api-key field value including data_center
var accessToken = JSON.parse(finishResponse.data.body).access_token + '-' + JSON.parse(finishResponse.data.body).data_center
var accessToken = body.access_token + '-' + body.data_center
$('#mailchimp-woocommerce-mailchimp-api-key').val(accessToken);

// always go to next step on success, so change url of wp_http_referer
if ($('input[name=mailchimp_woocommerce_wizard_on]').val() == 1) {
var query = window.location.href.match(/^(.*)\&/);
Expand Down Expand Up @@ -374,6 +379,14 @@
$('#tower_box_switch').change(function (e){
var switch_button = this;
var opt = this.checked ? 1 : 0;
var notice = $('.mc-wc-notice');
let notice_content = $('#mc_notice_text');
var content = $('.mc-wc-tab-content');

//content.addClass('loading');

notice_content.text('');
notice.removeClass('error success');

var data = {
action: 'mailchimp_woocommerce_tower_status',
Expand All @@ -384,14 +397,14 @@
$('#tower_box_status_' + opt).show();

$.post(ajaxurl, data, function(response) {
content.removeClass('loading');
if (response.success) {
$('#mc-tower-save').html(response.data);
$('#mc-tower-save').css('color', '#628735').show().fadeOut(3000);
notice_content.text(response.data);
notice.addClass('success').fadeIn();
switch_button.checked = opt;
}
else {
$('#mc-tower-save').html(response.data.error);
$('#mc-tower-save').css('color', 'red').show().fadeOut(3000);
$('<div class="notices-content-wrapper sync-notices"><div class="notice notice-error inline is-dismissible"><p>' + response.data.error +'</p></div></div>').insertAfter('.mc-wc-tab-buttons');
switch_button.checked = 1 - opt;
$('.tower_box_status').hide();
$('#tower_box_status_' + (1 - opt)).show();
Expand All @@ -402,24 +415,34 @@
$('#comm_box_switch').change(function (e){
var switch_button = this;
var opt = this.checked ? 1 : 0;

var notice = $('.mc-wc-notice');
let notice_content = $('#mc_notice_text');
var content = $('.mc-wc-tab-content');

//content.addClass('loading');

notice_content.text('');
notice.removeClass('error success');

var data = {
action: 'mailchimp_woocommerce_communication_status',
action: 'mailchimp_woocommerce_communication_status',
opt: opt
}

$('.comm_box_status').hide();
$('#comm_box_status_' + opt).show();

$.post(ajaxurl, data, function(response) {
content.removeClass('loading');
if (response.success) {
$('#mc-comm-save').html(response.data);
$('#mc-comm-save').css('color', '#628735').show().fadeOut(3000);
notice_content.text(response.data);
notice
.addClass('success')
.fadeIn();
switch_button.checked = opt;
}
else {
$('#mc-comm-save').html(response.data.error);
$('#mc-comm-save').css('color', 'red').show().fadeOut(3000);
$('<div class="notices-content-wrapper sync-notices"><div class="notice notice-error inline is-dismissible"><p>' + response.data.error +'</p></div></div>').insertAfter('.mc-wc-tab-buttons');
switch_button.checked = 1 - opt;
$('.comm_box_status').hide();
$('#comm_box_status_' + (1 - opt)).show();
Expand Down
5 changes: 1 addition & 4 deletions admin/partials/tabs/api-key.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@
<legend class="screen-reader-text">
<span><?php esc_html_e( 'Connect your store to Mailchimp', 'mailchimp-for-woocommerce' ); ?></span>
</legend>
<a id="mailchimp-oauth-connect" class="button button-primary tab-content-submit oauth-connect"><?php isset( $has_valid_api_key ) && $has_valid_api_key ? esc_html_e( 'Reconnect account', 'mailchimp-for-woocommerce' ) : esc_html_e( 'Connect account', 'mailchimp-for-woocommerce' ); ?></a>
<a id="mailchimp-oauth-connect" class="button button-primary tab-content-submit oauth-connect"><?php esc_html_e( 'Connect account', 'mailchimp-for-woocommerce' ); ?></a>
<a class="button create-account" href='#mc-woocommerce-create-account'>Create account</a>
<input type="hidden" id="<?php echo esc_attr( $this->plugin_name ); ?>-mailchimp-api-key" name="<?php echo esc_attr( $this->plugin_name ); ?>[mailchimp_api_key]" value="<?php echo isset( $options['mailchimp_api_key'] ) ? esc_html( $options['mailchimp_api_key'] ) : ''; ?>" required/>
<?php if ( isset( $has_valid_api_key ) && $has_valid_api_key ) : ?>
<p id="mailchimp-oauth-api-key-valid"><?php esc_html_e( 'Already connected. You can reconnect with another Mailchimp account if you want.', 'mailchimp-for-woocommerce' ); ?></p>
<?php endif; ?>
<p id="mailchimp-oauth-waiting" class="oauth-description"><?php esc_html_e( 'Connecting. A new window will open with Mailchimp\'s OAuth service. Please log-in and we will take care of the rest.', 'mailchimp-for-woocommerce' ); ?></p>
<p id="mailchimp-oauth-error" class="oauth-description"><?php esc_html_e( 'Error, can\'t login.', 'mailchimp-for-woocommerce' ); ?></p>
<p id="mailchimp-oauth-connecting" class="oauth-description"><?php esc_html_e( 'Connection in progress', 'mailchimp-for-woocommerce' ); ?><span class="spinner" style="visibility:visible; margin: 0 10px;"></span></p>
Expand Down
6 changes: 3 additions & 3 deletions admin/partials/tabs/newsletter-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@
</label>
<div class="mailchimp-select-wrapper">
<select id="<?php echo esc_attr( $this->plugin_name ); ?>-campaign-language-label" name="<?php echo esc_attr( $this->plugin_name ); ?>[campaign_language]" required>
<?php $selected_locale = isset( $options['store_locale'] ) && ! empty( $options['store_locale'] ) ? esc_html( $options['store_locale'] ) : get_locale(); ?> ?>
<?php $selected_locale = isset( $options['campaign_language'] ) && ! empty( $options['campaign_language'] ) ? esc_html( $options['campaign_language'] ) : get_locale(); ?> ?>
<?php
foreach ( MailChimp_Api_Locales::all() as $locale_key => $local_value ) {
echo '<option value="' . esc_attr( $locale_key ) . '" ' . selected( $locale_key === $selected_locale, true, false ) . '>' . esc_html( $local_value ) . '</option>';
}
?>
</select>
</select>
</div>
</div>
<div class="box">
Expand Down Expand Up @@ -200,7 +200,7 @@
<div class="box fieldset-header margin-large" >
<h3><?php esc_html_e( 'Opt-In Checkbox Settings', 'mailchimp-for-woocommerce' ); ?></h3>
</div>
<?php if ( has_block( 'woocommerce/checkout', get_post($checkout_page_id ) ) ) : ?>
<?php if ( has_block( 'woocommerce/checkout', get_post($checkout_page_id ) ) ) : ?>
<div class="box">
<h4><?= sprintf(__('Checkout page is using Woocommerce blocks. Settings are available within the block options while editing the <a href="%s">checkout page</a>.', 'mailchimp-for-woocommerce'), get_the_permalink($checkout_page_id) ) ?></h4>
</div>
Expand Down
Loading

0 comments on commit b16e89d

Please sign in to comment.