Version Description
- To address performance issues previously reported, we've changed the action hook of "woocommerce_cart_updated" to use a filter "woocommerce_update_cart_action_cart_updated"
Download this release
Release Info
Developer | MailChimp |
Plugin | MailChimp for WooCommerce |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
README.txt
CHANGED
@@ -50,6 +50,8 @@ You’ll need to do a few things to connect your WooCommerce store to MailChimp.
|
|
50 |
For more information on settings and configuration, please visit our Knowledge Base: [http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce](http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce)
|
51 |
|
52 |
== Changelog ==
|
|
|
|
|
53 |
|
54 |
= 2.1.0 =
|
55 |
* Added Promo Code support.
|
50 |
For more information on settings and configuration, please visit our Knowledge Base: [http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce](http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce)
|
51 |
|
52 |
== Changelog ==
|
53 |
+
= 2.1.1 =
|
54 |
+
* To address performance issues previously reported, we've changed the action hook of "woocommerce_cart_updated" to use a filter "woocommerce_update_cart_action_cart_updated"
|
55 |
|
56 |
= 2.1.0 =
|
57 |
* Added Promo Code support.
|
changelog.md
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
** 2.0.2 **
|
2 |
-
|
3 |
-
* Added new logs feature to help troubleshoot isolated sync and data feed issues.
|
4 |
-
* Fixed bug with setting customers as Transactional during checkout if they had already opted in previously.
|
5 |
-
* Fixed bug where abandoned cart automation still fired after a customer completed an order.
|
6 |
-
|
7 |
-
** 2.0.1 **
|
8 |
-
|
9 |
-
##### New Features: #####
|
10 |
-
* MC.js support added.
|
11 |
-
* Added pop-up forms to the site details page with a warning to upgrade to 2.0.1 before using them.
|
12 |
-
|
13 |
-
##### Fixes: #####
|
14 |
-
* Adding physical address as a required field for store setup, since this is also a field required by MailChimp.
|
15 |
-
* Order/carts timestamps now pass over as UTC.
|
16 |
-
* Improved handling of Order Notification and sending Order Invoice and Order Confirmation simultaneously when order is moved to “Processing” in Woocommerce.
|
17 |
-
* Tabs paginating on store set up, moving the user through each step automatically.
|
18 |
-
|
19 |
-
** 2.0 **
|
20 |
-
* Support WooComerce 3.0
|
21 |
-
* Support for manually uploaded WooCommerce plugin
|
22 |
-
* Fix for sync issues
|
23 |
-
* Fix for guest orders sync issue
|
24 |
-
* Remove MailChimp debug logger
|
25 |
-
|
26 |
-
** 1.1.1 **
|
27 |
-
* Support for site url changes
|
28 |
-
* Fix for WP Version 4.4 Compatibility issues
|
29 |
-
|
30 |
-
** 1.1.0 **
|
31 |
-
* Fix for persisting opt-in status
|
32 |
-
* Pass order URLs to MailChimp
|
33 |
-
* Pass partial refund status to MailChimp
|
34 |
-
|
35 |
-
** 1.0.9 **
|
36 |
-
* billing and shipping address support for orders
|
37 |
-
|
38 |
-
** 1.0.8 **
|
39 |
-
* add landing_site, financial status and discount information for orders
|
40 |
-
* fix to support php 5.3
|
41 |
-
|
42 |
-
** 1.0.7 **
|
43 |
-
* add options to move, hide and change defaults for opt-in checkbox
|
44 |
-
* add ability to re-sync and display connection details
|
45 |
-
* support for subscriptions without orders
|
46 |
-
* additional small fixes and some internal logging removal
|
47 |
-
|
48 |
-
** 1.0.6 **
|
49 |
-
* fixed conflict with the plugin updater where the class could not be loaded correctly.
|
50 |
-
* fixed error validation for store name.
|
51 |
-
* fixed cross device abandoned cart url's
|
52 |
-
|
53 |
-
** 1.0.4 **
|
54 |
-
* fix for Abandoned Carts without cookies
|
55 |
-
|
56 |
-
** 1.0.3 **
|
57 |
-
* fixed cart posts on dollar amounts greater than 1000
|
58 |
-
|
59 |
-
** 1.0.2**
|
60 |
-
* title correction for Product Variants
|
61 |
-
* added installation checks for WooCommerce and phone contact info
|
62 |
-
support for free orders
|
63 |
-
|
64 |
-
** 1.0 **
|
65 |
-
* added is_synicng flag to prevent sends during backfill
|
66 |
-
* fix for conflicts with Gravity Forms Pro and installation issues
|
67 |
-
* skip all Amazon orders
|
68 |
-
* allow users to set opt-in for pre-existing customers during first sync
|
69 |
-
* add Plugin Updater
|
70 |
-
|
71 |
-
** 0.1.22 **
|
72 |
-
* flag quantity as 1 if the product does not manage inventory
|
73 |
-
|
74 |
-
** 0.1.21 **
|
75 |
-
* php version check to display warnings < 5.5
|
76 |
-
|
77 |
-
** 0.1.19 **
|
78 |
-
* fix campaign tracking on new orders
|
79 |
-
|
80 |
-
** 0.1.18 **
|
81 |
-
* check woocommerce dependency before activating the plugin
|
82 |
-
|
83 |
-
** 0.1.17 **
|
84 |
-
* fix php version syntax errors for array's
|
85 |
-
|
86 |
-
** 0.1.16 **
|
87 |
-
* fix namespace conflicts
|
88 |
-
* fix free order 0.00 issue
|
89 |
-
* fix product variant naming issue
|
90 |
-
|
91 |
-
** 0.1.15 **
|
92 |
-
* adding special MailChimp header to requests
|
93 |
-
|
94 |
-
** 0.1.14 **
|
95 |
-
* removing jquery dependencies
|
96 |
-
|
97 |
-
** 0.1.13 **
|
98 |
-
* fixing a number format issue on total_spent
|
99 |
-
|
100 |
-
** 0.1.12 **
|
101 |
-
* skipping orders placed through amazon due to seller agreements
|
102 |
-
|
103 |
-
** 0.1.11 **
|
104 |
-
* removed an extra debug log that was not needed
|
105 |
-
|
106 |
-
** 0.1.10 **
|
107 |
-
* altered debug logging and fixed store settings validation requirements
|
108 |
-
|
109 |
-
** 0.1.9 **
|
110 |
-
* using fallback to stream context during failed patch requests
|
111 |
-
|
112 |
-
** 0.1.8 **
|
113 |
-
* fixing http request header for larger patch requests
|
114 |
-
|
115 |
-
** 0.1.7 **
|
116 |
-
* fixing various bugs with the sync and product issues.
|
117 |
-
|
118 |
-
** 0.1.2 **
|
119 |
-
* fixed admin order update hook.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-mailchimp-woocommerce-service.php
CHANGED
@@ -117,12 +117,13 @@ class MailChimp_Service extends MailChimp_Woocommerce_Options
|
|
117 |
}
|
118 |
|
119 |
/**
|
120 |
-
* @
|
|
|
121 |
*/
|
122 |
-
public function handleCartUpdated()
|
123 |
{
|
124 |
-
if ($this->is_admin || $this->cart_was_submitted || !$this->hasOption('mailchimp_api_key')) {
|
125 |
-
return false;
|
126 |
}
|
127 |
|
128 |
if (empty($this->cart)) {
|
@@ -161,10 +162,10 @@ class MailChimp_Service extends MailChimp_Woocommerce_Options
|
|
161 |
wp_queue($handler);
|
162 |
}
|
163 |
|
164 |
-
return true;
|
165 |
}
|
166 |
|
167 |
-
return false;
|
168 |
}
|
169 |
|
170 |
/**
|
117 |
}
|
118 |
|
119 |
/**
|
120 |
+
* @param null $updated
|
121 |
+
* @return bool|null
|
122 |
*/
|
123 |
+
public function handleCartUpdated($updated = null)
|
124 |
{
|
125 |
+
if ($updated === false || $this->is_admin || $this->cart_was_submitted || !$this->hasOption('mailchimp_api_key')) {
|
126 |
+
return !is_null($updated) ? $updated : false;
|
127 |
}
|
128 |
|
129 |
if (empty($this->cart)) {
|
162 |
wp_queue($handler);
|
163 |
}
|
164 |
|
165 |
+
return !is_null($updated) ? $updated : true;
|
166 |
}
|
167 |
|
168 |
+
return !is_null($updated) ? $updated : false;
|
169 |
}
|
170 |
|
171 |
/**
|
includes/class-mailchimp-woocommerce.php
CHANGED
@@ -337,7 +337,8 @@ class MailChimp_Woocommerce {
|
|
337 |
$this->loader->add_action('woocommerce_order_partially_refunded', $service, 'onPartiallyRefunded', 10);
|
338 |
|
339 |
// cart hooks
|
340 |
-
|
|
|
341 |
$this->loader->add_action('woocommerce_add_to_cart', $service, 'handleCartUpdated');
|
342 |
$this->loader->add_action('woocommerce_cart_item_removed', $service, 'handleCartUpdated');
|
343 |
|
337 |
$this->loader->add_action('woocommerce_order_partially_refunded', $service, 'onPartiallyRefunded', 10);
|
338 |
|
339 |
// cart hooks
|
340 |
+
//$this->loader->add_action('woocommerce_cart_updated', $service, 'handleCartUpdated');
|
341 |
+
$this->loader->add_filter('woocommerce_update_cart_action_cart_updated', $service, 'handleCartUpdated');
|
342 |
$this->loader->add_action('woocommerce_add_to_cart', $service, 'handleCartUpdated');
|
343 |
$this->loader->add_action('woocommerce_cart_item_removed', $service, 'handleCartUpdated');
|
344 |
|
mailchimp-woocommerce.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: MailChimp for WooCommerce
|
17 |
* Plugin URI: https://mailchimp.com/connect-your-store/
|
18 |
* Description: MailChimp - WooCommerce plugin
|
19 |
-
* Version: 2.1.
|
20 |
* Author: MailChimp
|
21 |
* Author URI: https://mailchimp.com
|
22 |
* License: GPL-2.0+
|
@@ -43,7 +43,7 @@ function mailchimp_environment_variables() {
|
|
43 |
return (object) array(
|
44 |
'repo' => 'master',
|
45 |
'environment' => 'production',
|
46 |
-
'version' => '2.1.
|
47 |
'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
|
48 |
'wc_version' => class_exists('WC') ? WC()->version : null,
|
49 |
'logging' => ($o && is_array($o) && isset($o['mailchimp_logging'])) ? $o['mailchimp_logging'] : 'none',
|
16 |
* Plugin Name: MailChimp for WooCommerce
|
17 |
* Plugin URI: https://mailchimp.com/connect-your-store/
|
18 |
* Description: MailChimp - WooCommerce plugin
|
19 |
+
* Version: 2.1.1
|
20 |
* Author: MailChimp
|
21 |
* Author URI: https://mailchimp.com
|
22 |
* License: GPL-2.0+
|
43 |
return (object) array(
|
44 |
'repo' => 'master',
|
45 |
'environment' => 'production',
|
46 |
+
'version' => '2.1.1',
|
47 |
'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
|
48 |
'wc_version' => class_exists('WC') ? WC()->version : null,
|
49 |
'logging' => ($o && is_array($o) && isset($o['mailchimp_logging'])) ? $o['mailchimp_logging'] : 'none',
|
public/js/mailchimp-woocommerce-public.js
CHANGED
@@ -13,10 +13,11 @@ function mailchimpGetCurrentUserByHash(a) {
|
|
13 |
console.log("mailchimp.get_email_by_hash.error", a)
|
14 |
}
|
15 |
}
|
16 |
-
function mailchimpHandleBillingEmail() {
|
17 |
-
|
18 |
-
|
19 |
-
if (
|
|
|
20 |
mailchimp_cart.setEmail(b);
|
21 |
try {
|
22 |
var c = mailchimp_public_data.ajax_url + "?action=mailchimp_set_user_by_email&email=" + b, d = new XMLHttpRequest;
|
@@ -24,14 +25,17 @@ function mailchimpHandleBillingEmail() {
|
|
24 |
d.status >= 200 && d.status < 400 ? console.log("mailchimp.handle_billing_email.request.success", d.responseText) : console.log("mailchimp.handle_billing_email.request.error", d.responseText)
|
25 |
}, d.onerror = function () {
|
26 |
console.log("mailchimp.handle_billing_email.request.error", d.responseText)
|
27 |
-
}, d.setRequestHeader("Content-Type", "application/json"), d.setRequestHeader("Accept", "application/json"), d.send(), mailchimp_submitted_email = b
|
|
|
28 |
} catch (a) {
|
29 |
console.log("mailchimp.handle_billing_email.error", a), mailchimp_submitted_email = !1
|
30 |
}
|
31 |
}
|
32 |
-
|
|
|
33 |
/in/.test(document.readyState) ? setTimeout("mailchimpReady(" + a + ")", 9) : a()
|
34 |
};
|
|
|
35 |
!function () {
|
36 |
"use strict";
|
37 |
function j() {
|
@@ -122,20 +126,39 @@ var mailchimp, mailchimp_cart, mailchimp_billing_email, mailchimp_submitted_emai
|
|
122 |
}
|
123 |
}, c.enabled = function () {
|
124 |
var a = "1" === c.set("cookies.js", "1").get("cookies.js");
|
125 |
-
return c.expire("cookies.js"), a
|
126 |
}(), c
|
127 |
}(document);
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
var b = mailchimp.utils.getQueryStringVars();
|
136 |
-
void 0 !== b.mc_cart_id && mailchimpGetCurrentUserByHash(b.mc_cart_id)
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
});
|
13 |
console.log("mailchimp.get_email_by_hash.error", a)
|
14 |
}
|
15 |
}
|
16 |
+
function mailchimpHandleBillingEmail(selector) {
|
17 |
+
if (!selector) selector = "#billing_email";
|
18 |
+
var a = document.querySelector(selector);b = void 0 !== a ? a.value : "";
|
19 |
+
if (!mailchimp_cart.valueEmail(b)) { return false; }
|
20 |
+
if (mailchimp_submitted_email === b) { return "already submitted " + b; }
|
21 |
mailchimp_cart.setEmail(b);
|
22 |
try {
|
23 |
var c = mailchimp_public_data.ajax_url + "?action=mailchimp_set_user_by_email&email=" + b, d = new XMLHttpRequest;
|
25 |
d.status >= 200 && d.status < 400 ? console.log("mailchimp.handle_billing_email.request.success", d.responseText) : console.log("mailchimp.handle_billing_email.request.error", d.responseText)
|
26 |
}, d.onerror = function () {
|
27 |
console.log("mailchimp.handle_billing_email.request.error", d.responseText)
|
28 |
+
}, d.setRequestHeader("Content-Type", "application/json"), d.setRequestHeader("Accept", "application/json"), d.send(), mailchimp_submitted_email = b;
|
29 |
+
return true;
|
30 |
} catch (a) {
|
31 |
console.log("mailchimp.handle_billing_email.error", a), mailchimp_submitted_email = !1
|
32 |
}
|
33 |
}
|
34 |
+
|
35 |
+
var mailchimp, mailchimp_cart, mailchimp_billing_email, mailchimp_username_email, mailchimp_registration_email, mailchimp_submitted_email = !1, mailchimpReady = function (a) {
|
36 |
/in/.test(document.readyState) ? setTimeout("mailchimpReady(" + a + ")", 9) : a()
|
37 |
};
|
38 |
+
|
39 |
!function () {
|
40 |
"use strict";
|
41 |
function j() {
|
126 |
}
|
127 |
}, c.enabled = function () {
|
128 |
var a = "1" === c.set("cookies.js", "1").get("cookies.js");
|
129 |
+
return c.expire("cookies.js"), a;
|
130 |
}(), c
|
131 |
}(document);
|
132 |
+
|
133 |
+
mailchimp = {storage: h, utils: g};
|
134 |
+
mailchimp_cart = new j;
|
135 |
+
}();
|
136 |
+
|
137 |
+
mailchimpReady(function () {
|
138 |
+
|
139 |
+
if (void 0 === a) {
|
140 |
+
var a = { site_url: document.location.origin, defaulted: !0, ajax_url: document.location.origin + "/wp-admin?admin-ajax.php" };
|
141 |
+
}
|
142 |
+
|
143 |
var b = mailchimp.utils.getQueryStringVars();
|
144 |
+
void 0 !== b.mc_cart_id && mailchimpGetCurrentUserByHash(b.mc_cart_id);
|
145 |
+
|
146 |
+
mailchimp_username_email = document.querySelector("#username");
|
147 |
+
mailchimp_billing_email = document.querySelector("#billing_email");
|
148 |
+
mailchimp_registration_email = document.querySelector("#reg_email");
|
149 |
+
|
150 |
+
if (mailchimp_billing_email) {
|
151 |
+
mailchimp_billing_email.onblur = function () { mailchimpHandleBillingEmail('#billing_email'); };
|
152 |
+
mailchimp_billing_email.onfocus = function () { mailchimpHandleBillingEmail('#billing_email'); }
|
153 |
+
}
|
154 |
+
|
155 |
+
if (mailchimp_username_email) {
|
156 |
+
mailchimp_username_email.onblur = function () { mailchimpHandleBillingEmail('#username'); };
|
157 |
+
mailchimp_username_email.onfocus = function () { mailchimpHandleBillingEmail('#username'); }
|
158 |
+
}
|
159 |
+
|
160 |
+
if (mailchimp_registration_email) {
|
161 |
+
mailchimp_registration_email.onblur = function () { mailchimpHandleBillingEmail('#reg_email'); };
|
162 |
+
mailchimp_registration_email.onfocus = function () { mailchimpHandleBillingEmail('#reg_email'); }
|
163 |
+
}
|
164 |
});
|
public/js/mailchimp-woocommerce-public.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function mailchimpGetCurrentUserByHash(
|
1 |
+
function mailchimpGetCurrentUserByHash(e){try{var i=mailchimp_public_data.ajax_url+"?action=mailchimp_get_user_by_hash&hash="+e,a=new XMLHttpRequest;a.open("POST",i,!0),a.onload=function(){if(a.status>=200&&a.status<400){var e=JSON.parse(a.responseText);mailchimp_cart.valueEmail(e.email)&&(mailchimp_cart.setEmail(e.email),console.log("mailchimp.get_email_by_hash.success","setting "+e.email+" as the current user"))}else console.log("mailchimp.get_email_by_hash.error",a.responseText)},a.onerror=function(){console.log("mailchimp.get_email_by_hash.request.error",a.responseText)},a.setRequestHeader("Content-Type","application/json"),a.setRequestHeader("Accept","application/json"),a.send()}catch(e){console.log("mailchimp.get_email_by_hash.error",e)}}function mailchimpHandleBillingEmail(e){e||(e="#billing_email");var i=document.querySelector(e);if(b=void 0!==i?i.value:"",!mailchimp_cart.valueEmail(b))return!1;if(mailchimp_submitted_email===b)return"already submitted "+b;mailchimp_cart.setEmail(b);try{var a=mailchimp_public_data.ajax_url+"?action=mailchimp_set_user_by_email&email="+b,t=new XMLHttpRequest;return t.open("POST",a,!0),t.onload=function(){t.status>=200&&t.status<400?console.log("mailchimp.handle_billing_email.request.success",t.responseText):console.log("mailchimp.handle_billing_email.request.error",t.responseText)},t.onerror=function(){console.log("mailchimp.handle_billing_email.request.error",t.responseText)},t.setRequestHeader("Content-Type","application/json"),t.setRequestHeader("Accept","application/json"),t.send(),mailchimp_submitted_email=b,!0}catch(i){console.log("mailchimp.handle_billing_email.error",i),mailchimp_submitted_email=!1}}var mailchimp,mailchimp_cart,mailchimp_billing_email,mailchimp_username_email,mailchimp_registration_email,mailchimp_submitted_email=!1,mailchimpReady=function(e){/in/.test(document.readyState)?setTimeout("mailchimpReady("+e+")",9):e()};!function(){"use strict";var e={extend:function(e,i){for(var a in i||{})i.hasOwnProperty(a)&&(e[a]=i[a]);return e},getQueryStringVars:function(){var e=window.location.search||"",i=[],a={};if((e=e.substr(1)).length){i=e.split("&");for(var t in i){var n=i[t];if("string"==typeof n){var l=n.split("="),r=l[0],m=l[1];r.length&&(void 0===a[r]&&(a[r]=[]),a[r].push(m))}}}return a},unEscape:function(e){return decodeURIComponent(e)},escape:function(e){return encodeURIComponent(e)},createDate:function(e,i){e||(e=0);var a=new Date,t=i?a.getDate()-e:a.getDate()+e;return a.setDate(t),a},arrayUnique:function(e){for(var i=e.concat(),a=0;a<i.length;++a)for(var t=a+1;t<i.length;++t)i[a]===i[t]&&i.splice(t,1);return i},objectCombineUnique:function(e){for(var i=e[0],a=1;a<e.length;a++){var t=e[a];for(var n in t)i[n]=t[n]}return i}},i=function(e,i){var a=function(e,i,t){return 1===arguments.length?a.get(e):a.set(e,i,t)};return a.get=function(i,t){return e.cookie!==a._cacheString&&a._populateCache(),void 0==a._cache[i]?t:a._cache[i]},a.defaults={path:"/"},a.set=function(t,n,l){switch(l={path:l&&l.path||a.defaults.path,domain:l&&l.domain||a.defaults.domain,expires:l&&l.expires||a.defaults.expires,secure:l&&l.secure!==i?l.secure:a.defaults.secure},n===i&&(l.expires=-1),typeof l.expires){case"number":l.expires=new Date((new Date).getTime()+1e3*l.expires);break;case"string":l.expires=new Date(l.expires)}return t=encodeURIComponent(t)+"="+(n+"").replace(/[^!#-+\--:<-\[\]-~]/g,encodeURIComponent),t+=l.path?";path="+l.path:"",t+=l.domain?";domain="+l.domain:"",t+=l.expires?";expires="+l.expires.toGMTString():"",t+=l.secure?";secure":"",e.cookie=t,a},a.expire=function(e,t){return a.set(e,i,t)},a._populateCache=function(){a._cache={};try{a._cacheString=e.cookie;for(var t=a._cacheString.split("; "),n=0;n<t.length;n++){var l=t[n].indexOf("="),r=decodeURIComponent(t[n].substr(0,l)),l=decodeURIComponent(t[n].substr(l+1));a._cache[r]===i&&(a._cache[r]=l)}}catch(e){console.log(e)}},a.enabled=function(){var e="1"===a.set("cookies.js","1").get("cookies.js");return a.expire("cookies.js"),e}(),a}(document);mailchimp={storage:i,utils:e},mailchimp_cart=new function(){return this.email_types="input[type=email]",this.regex_email=/^([A-Za-z0-9_+\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,this.current_email=null,this.previous_email=null,this.expireUser=function(){this.current_email=null,mailchimp.storage.expire("mailchimp.cart.current_email")},this.expireSaved=function(){mailchimp.storage.expire("mailchimp.cart.items")},this.setEmail=function(e){this.valueEmail(e)&&(this.setPreviousEmail(this.getEmail()),this.current_email=e,mailchimp.storage.set("mailchimp.cart.current_email",e))},this.getEmail=function(){if(this.current_email)return this.current_email;var e=mailchimp.storage.get("mailchimp.cart.current_email",!1);return!(!e||!this.valueEmail(e))&&(this.current_email=e,e)},this.setPreviousEmail=function(e){this.valueEmail(e)&&(mailchimp.storage.set("mailchimp.cart.previous_email",e),this.previous_email=e)},this.valueEmail=function(e){return this.regex_email.test(e)},this}}(),mailchimpReady(function(){if(void 0===e)var e={site_url:document.location.origin,defaulted:!0,ajax_url:document.location.origin+"/wp-admin?admin-ajax.php"};var i=mailchimp.utils.getQueryStringVars();void 0!==i.mc_cart_id&&mailchimpGetCurrentUserByHash(i.mc_cart_id),mailchimp_username_email=document.querySelector("#username"),mailchimp_billing_email=document.querySelector("#billing_email"),mailchimp_registration_email=document.querySelector("#reg_email"),mailchimp_billing_email&&(mailchimp_billing_email.onblur=function(){mailchimpHandleBillingEmail("#billing_email")},mailchimp_billing_email.onfocus=function(){mailchimpHandleBillingEmail("#billing_email")}),mailchimp_username_email&&(mailchimp_username_email.onblur=function(){mailchimpHandleBillingEmail("#username")},mailchimp_username_email.onfocus=function(){mailchimpHandleBillingEmail("#username")}),mailchimp_registration_email&&(mailchimp_registration_email.onblur=function(){mailchimpHandleBillingEmail("#reg_email")},mailchimp_registration_email.onfocus=function(){mailchimpHandleBillingEmail("#reg_email")})});
|