Skip to content

Commit b16e89d

Browse files
authored
Merge pull request #1141 from mailchimp/4.0
4.0
2 parents 961ae41 + 2786e5c commit b16e89d

File tree

112 files changed

+4918
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+4918
-299
lines changed

CHANGELOG.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
== Changelog ==
2+
= 4.0 =
3+
* Allow orders to be sent to Mailchimp even if a Wordpress user role isn't set
4+
* Support for custom order IDs
5+
* Updated dependabot issues related to block-based checkouts
6+
* Refreshed plugin interface
27
= 3.7 =
38
* Allow orders to be sent to Mailchimp even if a Wordpress user role isn't set
49
* Support for custom order IDs

README.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Tags: ecommerce,email,workflows,mailchimp
44
Donate link: https://mailchimp.com
55
Requires at least: 4.9
66
Tested up to: 6.5
7-
Stable tag: 3.7
7+
Stable tag: 4.0
88
Requires PHP: 7.4
99
WC requires at least: 4.2
10-
WC tested up to: 8.7
10+
WC tested up to: 8.8
1111
License: GPLv2 or later
1212
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1313
Connect your store to your Mailchimp audience to track sales, create targeted emails, send abandoned cart emails, and more.
@@ -77,8 +77,10 @@ At this time, the synchronization of product categories from WooCommerce to Mail
7777
= My question is not listed =
7878
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.
7979

80-
== Changelog ==
81-
= 3.7 =
80+
81+
= 4.0 =
8282
* Allow orders to be sent to Mailchimp even if a Wordpress user role isn't set
8383
* Support for custom order IDs
8484
* Updated dependabot issues related to block-based checkouts
85+
* Refreshed plugin interface
86+

admin/class-mailchimp-woocommerce-admin.php

+371-209
Large diffs are not rendered by default.

admin/js/mailchimp-woocommerce-admin.js

+36-13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
}
1818
});
1919

20+
$('#mc_notice_button').on('click', function() {
21+
$('.mc-wc-notice').fadeOut()
22+
});
23+
2024
// re-enable disable select input on audience settings submit
2125
$('#mailchimp_woocommerce_options').on('submit', function() {
2226
$('select[name="mailchimp-woocommerce[mailchimp_list]"]').prop('disabled', false);
@@ -331,11 +335,12 @@
331335
$('#mailchimp-oauth-error').hide();
332336
$('#mailchimp-oauth-connecting').hide();
333337
$('#mailchimp-oauth-connected').show();
334-
338+
339+
let body = JSON.parse(finishResponse.data.body);
335340
// get access_token from finishResponse and fill api-key field value including data_center
336-
var accessToken = JSON.parse(finishResponse.data.body).access_token + '-' + JSON.parse(finishResponse.data.body).data_center
341+
var accessToken = body.access_token + '-' + body.data_center
337342
$('#mailchimp-woocommerce-mailchimp-api-key').val(accessToken);
338-
343+
339344
// always go to next step on success, so change url of wp_http_referer
340345
if ($('input[name=mailchimp_woocommerce_wizard_on]').val() == 1) {
341346
var query = window.location.href.match(/^(.*)\&/);
@@ -374,6 +379,14 @@
374379
$('#tower_box_switch').change(function (e){
375380
var switch_button = this;
376381
var opt = this.checked ? 1 : 0;
382+
var notice = $('.mc-wc-notice');
383+
let notice_content = $('#mc_notice_text');
384+
var content = $('.mc-wc-tab-content');
385+
386+
//content.addClass('loading');
387+
388+
notice_content.text('');
389+
notice.removeClass('error success');
377390

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

386399
$.post(ajaxurl, data, function(response) {
400+
content.removeClass('loading');
387401
if (response.success) {
388-
$('#mc-tower-save').html(response.data);
389-
$('#mc-tower-save').css('color', '#628735').show().fadeOut(3000);
402+
notice_content.text(response.data);
403+
notice.addClass('success').fadeIn();
390404
switch_button.checked = opt;
391405
}
392406
else {
393-
$('#mc-tower-save').html(response.data.error);
394-
$('#mc-tower-save').css('color', 'red').show().fadeOut(3000);
407+
$('<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');
395408
switch_button.checked = 1 - opt;
396409
$('.tower_box_status').hide();
397410
$('#tower_box_status_' + (1 - opt)).show();
@@ -402,24 +415,34 @@
402415
$('#comm_box_switch').change(function (e){
403416
var switch_button = this;
404417
var opt = this.checked ? 1 : 0;
405-
418+
var notice = $('.mc-wc-notice');
419+
let notice_content = $('#mc_notice_text');
420+
var content = $('.mc-wc-tab-content');
421+
422+
//content.addClass('loading');
423+
424+
notice_content.text('');
425+
notice.removeClass('error success');
426+
406427
var data = {
407-
action: 'mailchimp_woocommerce_communication_status',
428+
action: 'mailchimp_woocommerce_communication_status',
408429
opt: opt
409430
}
410431

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

414435
$.post(ajaxurl, data, function(response) {
436+
content.removeClass('loading');
415437
if (response.success) {
416-
$('#mc-comm-save').html(response.data);
417-
$('#mc-comm-save').css('color', '#628735').show().fadeOut(3000);
438+
notice_content.text(response.data);
439+
notice
440+
.addClass('success')
441+
.fadeIn();
418442
switch_button.checked = opt;
419443
}
420444
else {
421-
$('#mc-comm-save').html(response.data.error);
422-
$('#mc-comm-save').css('color', 'red').show().fadeOut(3000);
445+
$('<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');
423446
switch_button.checked = 1 - opt;
424447
$('.comm_box_status').hide();
425448
$('#comm_box_status_' + (1 - opt)).show();

admin/partials/tabs/api-key.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@
1212
<legend class="screen-reader-text">
1313
<span><?php esc_html_e( 'Connect your store to Mailchimp', 'mailchimp-for-woocommerce' ); ?></span>
1414
</legend>
15-
<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>
15+
<a id="mailchimp-oauth-connect" class="button button-primary tab-content-submit oauth-connect"><?php esc_html_e( 'Connect account', 'mailchimp-for-woocommerce' ); ?></a>
1616
<a class="button create-account" href='#mc-woocommerce-create-account'>Create account</a>
1717
<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/>
18-
<?php if ( isset( $has_valid_api_key ) && $has_valid_api_key ) : ?>
19-
<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>
20-
<?php endif; ?>
2118
<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>
2219
<p id="mailchimp-oauth-error" class="oauth-description"><?php esc_html_e( 'Error, can\'t login.', 'mailchimp-for-woocommerce' ); ?></p>
2320
<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>

admin/partials/tabs/newsletter-settings.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@
111111
</label>
112112
<div class="mailchimp-select-wrapper">
113113
<select id="<?php echo esc_attr( $this->plugin_name ); ?>-campaign-language-label" name="<?php echo esc_attr( $this->plugin_name ); ?>[campaign_language]" required>
114-
<?php $selected_locale = isset( $options['store_locale'] ) && ! empty( $options['store_locale'] ) ? esc_html( $options['store_locale'] ) : get_locale(); ?> ?>
114+
<?php $selected_locale = isset( $options['campaign_language'] ) && ! empty( $options['campaign_language'] ) ? esc_html( $options['campaign_language'] ) : get_locale(); ?> ?>
115115
<?php
116116
foreach ( MailChimp_Api_Locales::all() as $locale_key => $local_value ) {
117117
echo '<option value="' . esc_attr( $locale_key ) . '" ' . selected( $locale_key === $selected_locale, true, false ) . '>' . esc_html( $local_value ) . '</option>';
118118
}
119119
?>
120-
</select>
120+
</select>
121121
</div>
122122
</div>
123123
<div class="box">
@@ -200,7 +200,7 @@
200200
<div class="box fieldset-header margin-large" >
201201
<h3><?php esc_html_e( 'Opt-In Checkbox Settings', 'mailchimp-for-woocommerce' ); ?></h3>
202202
</div>
203-
<?php if ( has_block( 'woocommerce/checkout', get_post($checkout_page_id ) ) ) : ?>
203+
<?php if ( has_block( 'woocommerce/checkout', get_post($checkout_page_id ) ) ) : ?>
204204
<div class="box">
205205
<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>
206206
</div>

0 commit comments

Comments
 (0)