Skip to content

Commit

Permalink
Merge pull request #1196 from mailchimp/4.3.1
Browse files Browse the repository at this point in the history
4.3.1
  • Loading branch information
ryanhungate authored Sep 3, 2024
2 parents 3dbeebe + a1161c3 commit 535eaa4
Show file tree
Hide file tree
Showing 151 changed files with 1,999 additions and 14,191 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
== Changelog ==
= 4.3 =
* Adds Order HPOS function for pagination
* Now starts syncing customers via HPOS
* Changes sync order: customers > products > coupons > orders — and make sync actions more atomic
* Use direct WP DB SELECT / INSERT for sync options to circumvent object caching
* Removes the bundled version of Action Scheduler
* Removes checkout opt-in if customers already subscribed
* Fixes cli sync issue where historical Orders Not Syncing Correctly
* Fixes Account Connection Issue Related to Object Caching
* Fixes HTTP worker warning
* Change to replace option, transient functions with direct DB queries
* Fallback function to check for options autoloader
= 4.2.1 =
* Bug fix for product variations
* Front end optimizations
= 4.2 =
* Remote diagnostics setting maintenance
* Adds support for syncing Wordpress user/customer account language to Mailchimp contact
* Fix for WooCommerce coupons date_expires not syncing to Mailchimp
* Design update for disconnect modal
* Fix for issue with setting logging preference to none
* Enhances syncing orders by starting from newest to oldest
* Adds WooCommerce plugin dependency feature
* Bump braces from 3.0.2 to 3.0.3 in /blocks
= 4.1 =
* Introduced a new filter for coupons (details available in the Wiki).
* Restored the "Resync Now" button.
Expand Down
27 changes: 16 additions & 11 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.5
Stable tag: 4.1
Tested up to: 6.6
Stable tag: 4.3
Requires PHP: 7.4
WC requires at least: 4.2
WC tested up to: 9.0
WC tested up to: 9.2
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,11 +78,16 @@ 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 ==
= 4.1 =
* Introduced a new filter for coupons (details available in the Wiki).
* Restored the "Resync Now" button.
* Reinstated the Mailchimp icon in the WordPress admin sidebar.
* Updated the design of the Mailchimp account creation user experience.
* Fix for duplicated parent products when variation's info is edited.
* Tested up to Woocommerce v9.0
* Support for customization of the cookie options being set
= 4.3 =
* Adds Order HPOS function for pagination
* Now starts syncing customers via HPOS
* Changes sync order: customers > products > coupons > orders — and make sync actions more atomic
* Use direct WP DB SELECT / INSERT for sync options to circumvent object caching
* Removes the bundled version of Action Scheduler
* Removes checkout opt-in if customers already subscribed
* Fixes cli sync issue where historical Orders Not Syncing Correctly
* Fixes Account Connection Issue Related to Object Caching
* Fixes HTTP worker warning
* Change to replace option, transient functions with direct DB queries
* Fallback function to check for options autoloader

136 changes: 83 additions & 53 deletions admin/class-mailchimp-woocommerce-admin.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/js/mailchimp-woocommerce-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@

const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'button button-primary tab-content-submit disconnect-confirm',
confirmButton: 'button button-default mc-wc-btn-disconnect',
cancelButton: 'button button-default mc-woocommerce-resync-button disconnect-button'
},
buttonsStyling: false,
Expand Down
4 changes: 2 additions & 2 deletions admin/partials/mailchimp-woocommerce-admin-tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/** Grab all options for this particular tab we're viewing. */

$options = get_option( $this->plugin_name, array() );
$options = \Mailchimp_Woocommerce_DB_Helpers::get_option( $this->plugin_name, array() );

/** Verify that the nonce is correct for the GET and POST variables. */

Expand All @@ -30,7 +30,7 @@
$show_sync_tab = isset( $_GET['resync'] ) ? ( esc_attr( sanitize_key( $_GET['resync'] ) ) === '1' ) : false;
/** If we have a transient set to start the sync on this page view, initiate it now that the values have been saved. */

if ( $mc_configured && ! $show_sync_tab && (bool) get_site_transient( 'mailchimp_woocommerce_start_sync' ) ) {
if ( $mc_configured && ! $show_sync_tab && (bool) \Mailchimp_Woocommerce_DB_Helpers::get_transient( 'mailchimp_woocommerce_start_sync' ) ) {
$show_sync_tab = true;
$active_tab = 'sync';
}
Expand Down
4 changes: 2 additions & 2 deletions admin/partials/tabs/logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
}
}

$requested_log_file = get_site_transient( 'mailchimp-woocommerce-view-log-file' );
delete_site_transient( 'mailchimp-woocommerce-view-log-file' );
$requested_log_file = \Mailchimp_Woocommerce_DB_Helpers::get_transient( 'mailchimp-woocommerce-view-log-file' );
\Mailchimp_Woocommerce_DB_Helpers::delete_transient( 'mailchimp-woocommerce-view-log-file' );

if ( empty( $requested_log_file ) ) {
$requested_log_file = ! empty( $_REQUEST['log_file'] ) && check_admin_referer( 'mailchimp_woocommerce_options', 'mailchimp_woocommerce_nonce' ) ? esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['log_file'] ) ) ) : false;
Expand Down
4 changes: 2 additions & 2 deletions admin/partials/tabs/plugin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<?php
$store_id = mailchimp_get_store_id();

$opt = get_option( 'mailchimp-woocommerce-comm.opt' );
$tower_opt = get_option( 'mailchimp-woocommerce-tower.opt' );
$opt = \Mailchimp_Woocommerce_DB_Helpers::get_option( 'mailchimp-woocommerce-comm.opt' );
$tower_opt = \Mailchimp_Woocommerce_DB_Helpers::get_option( 'mailchimp-woocommerce-tower.opt' );
$admin_email = mailchimp_get_option( 'admin_email', get_option( 'admin_email' ) );
$comm_enabled = null !== $opt ? $opt : '0';
$tower_enabled = null !== $tower_opt ? $tower_opt : '0';
Expand Down
8 changes: 4 additions & 4 deletions admin/partials/tabs/store-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
$mailchimp_total_transactional = 0;

$store_syncing = false;
$last_updated_time = get_option( 'mailchimp-woocommerce-resource-last-updated' );
$sync_started_at = get_option( 'mailchimp-woocommerce-sync.started_at' );
$last_updated_time = \Mailchimp_Woocommerce_DB_Helpers::get_option( 'mailchimp-woocommerce-resource-last-updated' );
$sync_started_at = \Mailchimp_Woocommerce_DB_Helpers::get_option( 'mailchimp-woocommerce-sync.started_at' );
if ( ! empty( $sync_started_at ) ) {
$sync_started_at = mailchimp_date_local( $sync_started_at );
} else {
$sync_started_at = new DateTime();
}

$sync_completed_at = get_option( 'mailchimp-woocommerce-sync.completed_at' );
$sync_completed_at = \Mailchimp_Woocommerce_DB_Helpers::get_option( 'mailchimp-woocommerce-sync.completed_at' );
if ( ! empty( $sync_completed_at ) ) {
$sync_completed_at = mailchimp_date_local( $sync_completed_at );
} else {
Expand All @@ -47,7 +47,7 @@
}

// if we have a transient set to start the sync on this page view, initiate it now that the values have been saved.
if ( (bool) get_site_transient( 'mailchimp_woocommerce_start_sync' ) ) {
if ( (bool) \Mailchimp_Woocommerce_DB_Helpers::get_transient( 'mailchimp_woocommerce_start_sync' ) ) {
MailChimp_WooCommerce_Admin::connect()->startSync();
}
$mailchimp_api = mailchimp_get_api();
Expand Down
140 changes: 138 additions & 2 deletions admin/v2/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ input.mc-wc-btn {
border: 0;
}

.mc-wc-btn-disconnect {
background: linear-gradient(180deg, #674399 0%, #8661C1 100%) !important;
color: #fff !important;
padding-block: 8.5px;
border: 0;
font-family: proxima-nova, Arial, Helvetica, sans-serif !important;
font-size: 14px !important;
line-height: 16px !important;
padding: 15px 35px 15px 35px !important;
text-transform: uppercase !important;
border: none !important;
box-shadow: none !important;
}

.swal2-actions {
gap: 20px;
}

.mc-wc-btn.mc-wc-btn-md.mc-wc-btn-primary {
padding: 16.65px 37.27px;
}
Expand Down Expand Up @@ -185,7 +203,7 @@ input.mc-wc-btn {
font-size: 14px;
line-height: 20px;
width: 100%;
max-width: 728px;
max-width: 810px;
color: var(--mc-wc-text-color);
margin-left: 60px;
}
Expand Down Expand Up @@ -1518,7 +1536,7 @@ select#log_file {}
margin-top: 30px;
}

.mc-wc-button-disconnect .tab-content-submit:not(.create-account):not(.mc-woocommerce-disconnect-button):not(.disconnect-confirm) {
.mc-wc-button-disconnect .tab-content-submit:not(.create-account):not(.mc-woocommerce-disconnect-button) {
width: 161px !important;
text-align: center;
height: 40px !important;
Expand Down Expand Up @@ -1557,6 +1575,23 @@ select#log_file {}
transition: opacity 0.8s;
}

.mc-wc-tooltipper-text {
position: absolute;
top: -10px;
left: 50%;
z-index: 1;
transform: translate(-50%, -100%);
min-width: 200px;
padding: 10px;
font-size: 15px;
font-weight: normal;
background-color: #fff;
border-radius: var(--mc-wc-border-radius);
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
box-sizing: border-box;
display:none;
}

.mc-wc-tooltip:hover .mc-wc-tooltip-text {
opacity: 1;
visibility: visible;
Expand All @@ -1578,6 +1613,16 @@ select#log_file {}
z-index: 10;
}

.wink-icon {
display: inline-block;
min-width: 16px;
min-height: 16px;
max-width: 72px;
max-height: 72px;
height: 24px;
width: 24px;
fill: rgba(36, 28, 21, .65);
}
.mc-wc-notice.success {
color: #fff;
}
Expand Down Expand Up @@ -1647,13 +1692,104 @@ select#log_file {}
background-color: rgba(75,196,194,0.2);
}

.mc-promo-checks {
flex: 1 1 0;
height: 52px;
justify-content: center;
align-items: flex-start;
gap: 12px;
display: flex;
flex-wrap: wrap;
}
.mc-promo-check-wrapper {
border-radius: 4px;
justify-content: flex-start;
align-items: center;
gap: 8px;
display: flex;
}

.mc-promo-check {
width: 16px;
height: 16px;
background: #FFE01B;
border-radius: 100px;
justify-content: center;
align-items: center;
gap: 10px;
display: flex;
}

.mc-promo-check-text {
color: #241C15;
font-size: 13px;
font-family: 'Graphik Mailchimp Web';
font-weight: 400;
line-height: 20px;
word-wrap: break-word;
}

.mc-promo-check svg {
padding:2px;
}

.mc-wc-tooltipper {
cursor: pointer;
}
.promo.mc-wc-tooltipper-text {
width:500px;
text-align: left;
overflow: scroll;
}

.tooltipper-container {
max-height: 500px;
overflow: scroll;
margin-right: .25em;
margin-left: .25em;
}

.tooltipper-container p {
margin-right: 2.25em;
margin-left: 1em;
}

.promo.mc-wc-tooltipper-text .tooltip__close {
position: absolute;
z-index: 1;
cursor: pointer;
top: 0;
right: 0;
background-color: transparent;
border: none;
margin: 1rem;
padding: .3125rem;
}

.mc-wc-notice button svg {
fill: #fff;
width: 2.4rem;
height: 2.4rem;
padding:6px;
}

.promo-create-account:hover {
background: #ffec71 !important;
}

.promo-disclaimer {
color: rgba(36, 28, 21, 0.80);
font-size: 11px;
font-family: 'Graphik Mailchimp Web';
font-weight: 400;
line-height: 16px;
word-wrap: break-word;
display:flex;
align-content: center;
justify-content: center;
padding-top:1em;
}

@media screen and (max-width: 782px) {
#wpcontent {
padding-right: 10px;
Expand Down
43 changes: 43 additions & 0 deletions admin/v2/assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,49 @@
}
});
}

// promo stuff
const plans = {
500: {send_up_to: 6000, regular_price: 20, promo_first_month_price: 1},
1500: {send_up_to: 18000, regular_price: 45, promo_first_month_price: 1},
2500: {send_up_to: 30000, regular_price: 60, promo_first_month_price: 1},
5000: {send_up_to: 60000, regular_price: 100, promo_first_month_price: 1},
10000: {send_up_to: 120000, regular_price: 135, promo_first_month_price: 1},
15000: {send_up_to: 180000, regular_price: 230, promo_first_month_price: 1},
20000: {send_up_to: 240000, regular_price: 285, promo_first_month_price: 1},
25000: {send_up_to: 300000, regular_price: 310, promo_first_month_price: 1},
30000: {send_up_to: 360000, regular_price: 340, promo_first_month_price: 1},
40000: {send_up_to: 480000, regular_price: 410, promo_first_month_price: 1},
50000: {send_up_to: 600000, regular_price: 450, promo_first_month_price: 1},
75000: {send_up_to: 900000, regular_price: 630, promo_first_month_price: 1},
100000: {send_up_to: 1200000, regular_price: 800, promo_first_month_price: 1}
};

function onPlanSelectorChanged (e) {
const selected = $('#mailchimp_plan_selector option:selected')?.val() || 0;
const found = plans[Number(selected)] || null;
if (!found) {
//console.log('plan value not found', selected);
return;
}
console.log('plan found', found);
$('.mc_contacts').text(Number(selected).toLocaleString());
$('.mc_send_up_to').text(found.send_up_to.toLocaleString());
$('.mc_regular_price').text('$'+found.regular_price.toString());
$('.mc_promo_first_month_price').text('$'+found.promo_first_month_price.toString());
}

$('#mailchimp_plan_selector').change(onPlanSelectorChanged);

$('.promo.mc-wc-tooltipper').on('click', function() {
$(this).parent().find('.mc-wc-tooltipper-text').css('visibility', 'visible').fadeIn();
});

$('.tooltip__close').on('click', function() {
$(this).closest('.mc-wc-tooltipper-text').fadeOut();
});

onPlanSelectorChanged();
});
})( jQuery );

4 changes: 2 additions & 2 deletions admin/v2/processes/class-mailchimp-woocommerce-event.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ public static function track(string $event, \DateTime $date = null)
return null;
}

if (!($mc_user_id = get_option('mailchimp-woocommerce-mailchimp_user_id', null))) {
if (!($mc_user_id = \Mailchimp_Woocommerce_DB_Helpers::get_option('mailchimp-woocommerce-mailchimp_user_id', null))) {
$mc_user_id = null;
}

if (!($mc_login_id = get_option('mailchimp-woocommerce-mailchimp_login_id', null))) {
if (!($mc_login_id = \Mailchimp_Woocommerce_DB_Helpers::get_option('mailchimp-woocommerce-mailchimp_login_id', null))) {
$mc_login_id = null;
}

Expand Down
Loading

0 comments on commit 535eaa4

Please sign in to comment.