MailChimp for WooCommerce - Version 2.6.2

Version Description

Download this release

Release Info

Developer ryanhungate
Plugin Icon wp plugin MailChimp for WooCommerce
Version 2.6.2
Comparing to
See all releases

Code changes from version 2.6.1 to 2.6.2

CHANGELOG.txt CHANGED
@@ -1,4 +1,12 @@
1
  == Changelog ==
 
 
 
 
 
 
 
 
2
  = 2.6 =
3
  * adds support for selectively syncing subscribers only
4
  * updates to action scheduler dependency
1
  == Changelog ==
2
+ = 2.6.2 =
3
+ * compatibility for woocommerce 6.3
4
+ * UI/UX updates for situations where Action Scheduler is missing during composer installs (via .gitignore)
5
+ * trigger double opt-in messages for customers who previously unsubscribed
6
+ * improved minification of mailchimp-woocommerce-public.min.js file
7
+ * mailchimp_woocommerce_landing_site URL improvements to reflect which page the customer entered on for the first time
8
+ * better error handling with Google Analytics
9
+ * fixed bug related to Mailchimp API submission when someone was already a list member
10
  = 2.6 =
11
  * adds support for selectively syncing subscribers only
12
  * updates to action scheduler dependency
README.txt CHANGED
@@ -4,10 +4,10 @@ Tags: ecommerce,email,workflows,mailchimp
4
  Donate link: https://mailchimp.com
5
  Requires at least: 4.9
6
  Tested up to: 5.9
7
- Stable tag: 2.6.1
8
  Requires PHP: 7.0
9
  WC requires at least: 3.5
10
- WC tested up to: 6.2
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
  Connect your store to your Mailchimp audience to track sales, create targeted emails, send abandoned cart emails, and more.
@@ -78,9 +78,14 @@ At this time, the synchronization of product categories from WooCommerce to Mail
78
  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.
79
 
80
  == Changelog ==
81
- = 2.6 =
82
- * Adds support for selectively syncing subscribers only
83
- * Updates to action scheduler dependency
 
 
 
 
 
84
 
85
 
86
  [Historical Changelog](https://raw.githubusercontent.com/mailchimp/mc-woocommerce/master/CHANGELOG.txt)
4
  Donate link: https://mailchimp.com
5
  Requires at least: 4.9
6
  Tested up to: 5.9
7
+ Stable tag: 2.6.2
8
  Requires PHP: 7.0
9
  WC requires at least: 3.5
10
+ WC tested up to: 6.3
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
  Connect your store to your Mailchimp audience to track sales, create targeted emails, send abandoned cart emails, and more.
78
  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.
79
 
80
  == Changelog ==
81
+ = 2.6.2 =
82
+ * compatibility for woocommerce 6.3
83
+ * UI/UX updates for situations where Action Scheduler is missing during composer installs (via .gitignore)
84
+ * trigger double opt-in messages for customers who previously unsubscribed
85
+ * improved minification of mailchimp-woocommerce-public.min.js file
86
+ * mailchimp_woocommerce_landing_site URL improvements to reflect which page the customer entered on for the first time
87
+ * better error handling with Google Analytics
88
+ * fixed bug related to Mailchimp API submission when someone was already a list member
89
 
90
 
91
  [Historical Changelog](https://raw.githubusercontent.com/mailchimp/mc-woocommerce/master/CHANGELOG.txt)
admin/class-mailchimp-woocommerce-admin.php CHANGED
@@ -306,6 +306,27 @@ class MailChimp_WooCommerce_Admin extends MailChimp_WooCommerce_Options {
306
  }
307
  }
308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  /**
310
  * Depending on the version we're on we may need to run some sort of migrations.
311
  */
306
  }
307
  }
308
 
309
+
310
+ /**
311
+ * Displays notice when action scheduler does not exist on the system
312
+ */
313
+ public function action_scheduler_notice() {
314
+ if (!mailchimp_action_scheduler_exists()) {
315
+ $class = 'notice notice-warning is-dismissible';
316
+ $message = sprintf(
317
+ /* translators: Placeholders %1$s - opening strong HTML tag, %2$s */
318
+ esc_html__(
319
+ '%1$sMailchimp for Woocommerce%2$s needs Action Scheduler plugin to function correctly, please confirm is installed',
320
+ 'mailchimp-for-woocommerce'
321
+ ),
322
+ '<strong>',
323
+ '</strong>'
324
+ );
325
+ printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
326
+ }
327
+ }
328
+
329
+
330
  /**
331
  * Depending on the version we're on we may need to run some sort of migrations.
332
  */
admin/partials/tabs/newsletter_settings.php CHANGED
@@ -250,7 +250,7 @@ $list_is_configured = isset($options['mailchimp_list']) && (!empty($options['mai
250
 
251
  <div class="box box-half">
252
  <label for="<?php echo $this->plugin_name; ?>-newsletter-checkbox-action">
253
- <p><?= sprintf(/* translators: %s - Woocommerce Actions documentation URL. */wp_kses( __( 'To change the position of the opt-in <br/>checkbox at checkout, input one of the <a href=%s target=_blank>available WooCommerce form actions</a>.', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://woocommerce.github.io/code-reference/hooks/hooks.html' ) ); ?></p>
254
  </label>
255
  </div>
256
 
250
 
251
  <div class="box box-half">
252
  <label for="<?php echo $this->plugin_name; ?>-newsletter-checkbox-action">
253
+ <p><?= sprintf(/* translators: %s - Woocommerce Actions documentation URL. */wp_kses( __( 'To change the position of the opt-in <br/>checkbox at checkout, input one of the <a href=%s target=_blank>available WooCommerce form actions</a>.', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/' ) ); ?></p>
254
  </label>
255
  </div>
256
 
blocks/.eslintignore DELETED
@@ -1,3 +0,0 @@
1
- !.eslintrc.js
2
- build
3
- node_modules
 
 
 
blocks/.eslintrc.js DELETED
@@ -1,18 +0,0 @@
1
- module.exports = {
2
- extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
3
- settings: {
4
- // List of modules that are externals in our webpack config.
5
- // This helps the `import/no-extraneous-dependencies` and
6
- //`import/no-unresolved` rules account for them.
7
- 'import/core-modules': [
8
- '@woocommerce/blocks-checkout',
9
- '@woocommerce/settings',
10
- '@woocommerce/shared-hocs',
11
- 'react',
12
- ],
13
- 'import/resolver': {
14
- node: {},
15
- webpack: {},
16
- },
17
- },
18
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
blocks/.gitignore DELETED
@@ -1,30 +0,0 @@
1
- /nbproject/private/
2
- node_modules
3
- project.xml
4
- project.properties
5
- .DS_Store
6
- Thumbs.db
7
- .buildpath
8
- .project
9
- .settings*
10
- .vscode
11
- sftp-config.json
12
- /deploy/
13
- /wc-apidocs/
14
- /languages/
15
- screenshots/
16
- .idea
17
-
18
- # Ignore all log files except for .htaccess
19
- /logs/*
20
- !/logs/.htaccess
21
-
22
- tests/e2e/config/local-*
23
- .eslintcache
24
-
25
- /vendor/
26
-
27
- dist
28
- build
29
-
30
- woocommerce-mailchimp-newsletter.zip
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
blocks/build/newsletter-block-frontend.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('wc-blocks-checkout', 'wc-blocks-shared-hocs', 'wc-settings', 'wp-element', 'wp-polyfill'), 'version' => '61a7dedef24e6fd0ce09ed832aac89fa');
blocks/build/newsletter-block-frontend.js ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "./assets/js/checkout-newsletter-subscription-block/frontend.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "./assets/js/checkout-newsletter-subscription-block/attributes.js":
90
+ /*!************************************************************************!*\
91
+ !*** ./assets/js/checkout-newsletter-subscription-block/attributes.js ***!
92
+ \************************************************************************/
93
+ /*! exports provided: default */
94
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
95
+
96
+ "use strict";
97
+ __webpack_require__.r(__webpack_exports__);
98
+ /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings");
99
+ /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__);
100
+ /**
101
+ * External dependencies
102
+ */
103
+
104
+ const {
105
+ optinDefaultText,
106
+ gdprHeadline,
107
+ gdprFields
108
+ } = Object(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__["getSetting"])('mailchimp-newsletter_data', '');
109
+ /* harmony default export */ __webpack_exports__["default"] = ({
110
+ text: {
111
+ type: 'string',
112
+ default: optinDefaultText
113
+ },
114
+ gdprHeadline: {
115
+ type: 'string',
116
+ default: gdprHeadline
117
+ },
118
+ gdpr: {
119
+ type: 'array',
120
+ default: gdprFields
121
+ }
122
+ });
123
+
124
+ /***/ }),
125
+
126
+ /***/ "./assets/js/checkout-newsletter-subscription-block/block.js":
127
+ /*!*******************************************************************!*\
128
+ !*** ./assets/js/checkout-newsletter-subscription-block/block.js ***!
129
+ \*******************************************************************/
130
+ /*! exports provided: default */
131
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
132
+
133
+ "use strict";
134
+ __webpack_require__.r(__webpack_exports__);
135
+ /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
136
+ /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
137
+ /* harmony import */ var _woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @woocommerce/blocks-checkout */ "@woocommerce/blocks-checkout");
138
+ /* harmony import */ var _woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_1__);
139
+
140
+
141
+ /**
142
+ * External dependencies
143
+ */
144
+
145
+
146
+
147
+ const Block = ({
148
+ cart,
149
+ extensions,
150
+ text,
151
+ checkoutExtensionData
152
+ }) => {
153
+ const [checked, setChecked] = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])(false);
154
+ const {
155
+ setExtensionData
156
+ } = checkoutExtensionData;
157
+ Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
158
+ setExtensionData('mailchimp-newsletter', 'optin', checked);
159
+ }, [checked, setExtensionData]);
160
+ return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_1__["CheckboxControl"], {
161
+ id: "subscribe-to-newsletter",
162
+ checked: checked,
163
+ onChange: setChecked
164
+ }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("span", {
165
+ dangerouslySetInnerHTML: {
166
+ __html: text
167
+ }
168
+ })));
169
+ };
170
+
171
+ /* harmony default export */ __webpack_exports__["default"] = (Block);
172
+
173
+ /***/ }),
174
+
175
+ /***/ "./assets/js/checkout-newsletter-subscription-block/block.json":
176
+ /*!*********************************************************************!*\
177
+ !*** ./assets/js/checkout-newsletter-subscription-block/block.json ***!
178
+ \*********************************************************************/
179
+ /*! exports provided: apiVersion, name, version, title, category, description, supports, parent, attributes, textdomain, editorStyle, default */
180
+ /***/ (function(module) {
181
+
182
+ module.exports = JSON.parse("{\"apiVersion\":2,\"name\":\"woocommerce/mailchimp-newsletter-subscription\",\"version\":\"1.0.0\",\"title\":\"Mailchimp Newsletter!\",\"category\":\"woocommerce\",\"description\":\"Adds a newsletter subscription checkbox to the checkout.\",\"supports\":{\"html\":true,\"align\":false,\"multiple\":false,\"reusable\":false},\"parent\":[\"woocommerce/checkout-contact-information-block\"],\"attributes\":{\"lock\":{\"type\":\"object\",\"default\":{\"remove\":true,\"move\":true}}},\"textdomain\":\"mailchimp-woocommerce\",\"editorStyle\":\"file:../../../build/style-newsletter-block.css\"}");
183
+
184
+ /***/ }),
185
+
186
+ /***/ "./assets/js/checkout-newsletter-subscription-block/frontend.js":
187
+ /*!**********************************************************************!*\
188
+ !*** ./assets/js/checkout-newsletter-subscription-block/frontend.js ***!
189
+ \**********************************************************************/
190
+ /*! no exports provided */
191
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
192
+
193
+ "use strict";
194
+ __webpack_require__.r(__webpack_exports__);
195
+ /* harmony import */ var _woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/blocks-checkout */ "@woocommerce/blocks-checkout");
196
+ /* harmony import */ var _woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_0__);
197
+ /* harmony import */ var _woocommerce_shared_hocs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @woocommerce/shared-hocs */ "@woocommerce/shared-hocs");
198
+ /* harmony import */ var _woocommerce_shared_hocs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_shared_hocs__WEBPACK_IMPORTED_MODULE_1__);
199
+ /* harmony import */ var _block__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block */ "./assets/js/checkout-newsletter-subscription-block/block.js");
200
+ /* harmony import */ var _attributes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./attributes */ "./assets/js/checkout-newsletter-subscription-block/attributes.js");
201
+ /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./assets/js/checkout-newsletter-subscription-block/block.json");
202
+ var _block_json__WEBPACK_IMPORTED_MODULE_4___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./block.json */ "./assets/js/checkout-newsletter-subscription-block/block.json", 1);
203
+ /**
204
+ * External dependencies
205
+ */
206
+
207
+
208
+ /**
209
+ * Internal dependencies
210
+ */
211
+
212
+
213
+
214
+
215
+ Object(_woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_0__["registerCheckoutBlock"])({
216
+ metadata: _block_json__WEBPACK_IMPORTED_MODULE_4__,
217
+ component: Object(_woocommerce_shared_hocs__WEBPACK_IMPORTED_MODULE_1__["withFilteredAttributes"])(_attributes__WEBPACK_IMPORTED_MODULE_3__["default"])(_block__WEBPACK_IMPORTED_MODULE_2__["default"])
218
+ });
219
+
220
+ /***/ }),
221
+
222
+ /***/ "@woocommerce/blocks-checkout":
223
+ /*!****************************************!*\
224
+ !*** external ["wc","blocksCheckout"] ***!
225
+ \****************************************/
226
+ /*! no static exports found */
227
+ /***/ (function(module, exports) {
228
+
229
+ (function() { module.exports = window["wc"]["blocksCheckout"]; }());
230
+
231
+ /***/ }),
232
+
233
+ /***/ "@woocommerce/settings":
234
+ /*!************************************!*\
235
+ !*** external ["wc","wcSettings"] ***!
236
+ \************************************/
237
+ /*! no static exports found */
238
+ /***/ (function(module, exports) {
239
+
240
+ (function() { module.exports = window["wc"]["wcSettings"]; }());
241
+
242
+ /***/ }),
243
+
244
+ /***/ "@woocommerce/shared-hocs":
245
+ /*!********************************************!*\
246
+ !*** external ["wc","wcBlocksSharedHocs"] ***!
247
+ \********************************************/
248
+ /*! no static exports found */
249
+ /***/ (function(module, exports) {
250
+
251
+ (function() { module.exports = window["wc"]["wcBlocksSharedHocs"]; }());
252
+
253
+ /***/ }),
254
+
255
+ /***/ "@wordpress/element":
256
+ /*!*********************************!*\
257
+ !*** external ["wp","element"] ***!
258
+ \*********************************/
259
+ /*! no static exports found */
260
+ /***/ (function(module, exports) {
261
+
262
+ (function() { module.exports = window["wp"]["element"]; }());
263
+
264
+ /***/ })
265
+
266
+ /******/ });
267
+ //# sourceMappingURL=newsletter-block-frontend.js.map
blocks/build/newsletter-block-frontend.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/js/checkout-newsletter-subscription-block/attributes.js","webpack:///./assets/js/checkout-newsletter-subscription-block/block.js","webpack:///./assets/js/checkout-newsletter-subscription-block/frontend.js","webpack:///external [\"wc\",\"blocksCheckout\"]","webpack:///external [\"wc\",\"wcSettings\"]","webpack:///external [\"wc\",\"wcBlocksSharedHocs\"]","webpack:///external [\"wp\",\"element\"]"],"names":["optinDefaultText","gdprHeadline","gdprFields","getSetting","text","type","default","gdpr","Block","cart","extensions","checkoutExtensionData","checked","setChecked","useState","setExtensionData","useEffect","__html","registerCheckoutBlock","metadata","component","withFilteredAttributes","attributes"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA,MAAM;AACLA,kBADK;AAELC,cAFK;AAGLC;AAHK,IAIFC,wEAAU,CAAE,2BAAF,EAA+B,EAA/B,CAJd;AAMe;AACdC,MAAI,EAAE;AACLC,QAAI,EAAE,QADD;AAELC,WAAO,EAAEN;AAFJ,GADQ;AAKdC,cAAY,EAAE;AACbI,QAAI,EAAE,QADO;AAEbC,WAAO,EAAEL;AAFI,GALA;AASdM,MAAI,EAAE;AACLF,QAAI,EAAE,OADD;AAELC,WAAO,EAAEJ;AAFJ;AATQ,CAAf,E;;;;;;;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;;AAEA,MAAMM,KAAK,GAAG,CAAE;AAAEC,MAAF;AAAQC,YAAR;AAAoBN,MAApB;AAA0BO;AAA1B,CAAF,KAAyD;AACtE,QAAM,CAAEC,OAAF,EAAWC,UAAX,IAA0BC,mEAAQ,CAAE,KAAF,CAAxC;AACA,QAAM;AAAEC;AAAF,MAAuBJ,qBAA7B;AAEAK,sEAAS,CAAE,MAAM;AAChBD,oBAAgB,CAAE,sBAAF,EAA0B,OAA1B,EAAmCH,OAAnC,CAAhB;AACA,GAFQ,EAEN,CAAEA,OAAF,EAAWG,gBAAX,CAFM,CAAT;AAIA,SACC,4IACC,yEAAC,4EAAD;AACC,MAAE,EAAC,yBADJ;AAEC,WAAO,EAAGH,OAFX;AAGC,YAAQ,EAAGC;AAHZ,KAKC;AAAM,2BAAuB,EAAG;AAACI,YAAM,EAAEb;AAAT;AAAhC,IALD,CADD,CADD;AAWA,CAnBD;;AAqBeI,oEAAf,E;;;;;;;;;;;;;;;;;;;;;;;AC3BA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AAEAU,0FAAqB,CAAE;AACtBC,oDADsB;AAEtBC,WAAS,EAAEC,uFAAsB,CAAEC,mDAAF,CAAtB,CAAsCd,8CAAtC;AAFW,CAAF,CAArB,C;;;;;;;;;;;ACZA,aAAa,iDAAiD,EAAE,I;;;;;;;;;;;ACAhE,aAAa,6CAA6C,EAAE,I;;;;;;;;;;;ACA5D,aAAa,qDAAqD,EAAE,I;;;;;;;;;;;ACApE,aAAa,0CAA0C,EAAE,I","file":"newsletter-block-frontend.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./assets/js/checkout-newsletter-subscription-block/frontend.js\");\n","/**\n * External dependencies\n */\nimport { getSetting } from '@woocommerce/settings';\n\nconst {\n\toptinDefaultText,\n\tgdprHeadline,\n\tgdprFields,\n} = getSetting( 'mailchimp-newsletter_data', '' );\n\nexport default {\n\ttext: {\n\t\ttype: 'string',\n\t\tdefault: optinDefaultText,\n\t},\n\tgdprHeadline: {\n\t\ttype: 'string',\n\t\tdefault: gdprHeadline,\n\t},\n\tgdpr: {\n\t\ttype: 'array',\n\t\tdefault: gdprFields\n\t}\n};\n","/**\n * External dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { CheckboxControl } from '@woocommerce/blocks-checkout';\n\nconst Block = ( { cart, extensions, text, checkoutExtensionData } ) => {\n\tconst [ checked, setChecked ] = useState( false );\n\tconst { setExtensionData } = checkoutExtensionData;\n\n\tuseEffect( () => {\n\t\tsetExtensionData( 'mailchimp-newsletter', 'optin', checked );\n\t}, [ checked, setExtensionData ] );\n\n\treturn (\n\t\t<>\n\t\t\t<CheckboxControl\n\t\t\t\tid=\"subscribe-to-newsletter\"\n\t\t\t\tchecked={ checked }\n\t\t\t\tonChange={ setChecked }\n\t\t\t>\n\t\t\t\t<span dangerouslySetInnerHTML={ {__html: text} }/>\n\t\t\t</CheckboxControl>\n\t\t</>\n\t);\n};\n\nexport default Block;\n","/**\n * External dependencies\n */\nimport { registerCheckoutBlock } from '@woocommerce/blocks-checkout';\nimport { withFilteredAttributes } from '@woocommerce/shared-hocs';\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport attributes from './attributes';\nimport metadata from './block.json';\n\nregisterCheckoutBlock( {\n\tmetadata,\n\tcomponent: withFilteredAttributes( attributes )( Block ),\n} );\n","(function() { module.exports = window[\"wc\"][\"blocksCheckout\"]; }());","(function() { module.exports = window[\"wc\"][\"wcSettings\"]; }());","(function() { module.exports = window[\"wc\"][\"wcBlocksSharedHocs\"]; }());","(function() { module.exports = window[\"wp\"][\"element\"]; }());"],"sourceRoot":""}
blocks/build/newsletter-block.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('wc-blocks-checkout', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'e0c2a4ce85cd127b74e23152b7a33f5f');
blocks/build/newsletter-block.js ADDED
@@ -0,0 +1,487 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (window["webpackJsonp_woocommerce_mailchimp_newsletter"] = window["webpackJsonp_woocommerce_mailchimp_newsletter"] || []).push([["style-newsletter-block"],{
2
+
3
+ /***/ "./assets/js/checkout-newsletter-subscription-block/style.scss":
4
+ /*!*********************************************************************!*\
5
+ !*** ./assets/js/checkout-newsletter-subscription-block/style.scss ***!
6
+ \*********************************************************************/
7
+ /*! no exports provided */
8
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
9
+
10
+ "use strict";
11
+ __webpack_require__.r(__webpack_exports__);
12
+ // extracted by mini-css-extract-plugin
13
+
14
+
15
+ /***/ })
16
+
17
+ }]);
18
+
19
+ /******/ (function(modules) { // webpackBootstrap
20
+ /******/ // install a JSONP callback for chunk loading
21
+ /******/ function webpackJsonpCallback(data) {
22
+ /******/ var chunkIds = data[0];
23
+ /******/ var moreModules = data[1];
24
+ /******/ var executeModules = data[2];
25
+ /******/
26
+ /******/ // add "moreModules" to the modules object,
27
+ /******/ // then flag all "chunkIds" as loaded and fire callback
28
+ /******/ var moduleId, chunkId, i = 0, resolves = [];
29
+ /******/ for(;i < chunkIds.length; i++) {
30
+ /******/ chunkId = chunkIds[i];
31
+ /******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
32
+ /******/ resolves.push(installedChunks[chunkId][0]);
33
+ /******/ }
34
+ /******/ installedChunks[chunkId] = 0;
35
+ /******/ }
36
+ /******/ for(moduleId in moreModules) {
37
+ /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
38
+ /******/ modules[moduleId] = moreModules[moduleId];
39
+ /******/ }
40
+ /******/ }
41
+ /******/ if(parentJsonpFunction) parentJsonpFunction(data);
42
+ /******/
43
+ /******/ while(resolves.length) {
44
+ /******/ resolves.shift()();
45
+ /******/ }
46
+ /******/
47
+ /******/ // add entry modules from loaded chunk to deferred list
48
+ /******/ deferredModules.push.apply(deferredModules, executeModules || []);
49
+ /******/
50
+ /******/ // run deferred modules when all chunks ready
51
+ /******/ return checkDeferredModules();
52
+ /******/ };
53
+ /******/ function checkDeferredModules() {
54
+ /******/ var result;
55
+ /******/ for(var i = 0; i < deferredModules.length; i++) {
56
+ /******/ var deferredModule = deferredModules[i];
57
+ /******/ var fulfilled = true;
58
+ /******/ for(var j = 1; j < deferredModule.length; j++) {
59
+ /******/ var depId = deferredModule[j];
60
+ /******/ if(installedChunks[depId] !== 0) fulfilled = false;
61
+ /******/ }
62
+ /******/ if(fulfilled) {
63
+ /******/ deferredModules.splice(i--, 1);
64
+ /******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
65
+ /******/ }
66
+ /******/ }
67
+ /******/
68
+ /******/ return result;
69
+ /******/ }
70
+ /******/
71
+ /******/ // The module cache
72
+ /******/ var installedModules = {};
73
+ /******/
74
+ /******/ // object to store loaded and loading chunks
75
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
76
+ /******/ // Promise = chunk loading, 0 = chunk loaded
77
+ /******/ var installedChunks = {
78
+ /******/ "newsletter-block": 0
79
+ /******/ };
80
+ /******/
81
+ /******/ var deferredModules = [];
82
+ /******/
83
+ /******/ // The require function
84
+ /******/ function __webpack_require__(moduleId) {
85
+ /******/
86
+ /******/ // Check if module is in cache
87
+ /******/ if(installedModules[moduleId]) {
88
+ /******/ return installedModules[moduleId].exports;
89
+ /******/ }
90
+ /******/ // Create a new module (and put it into the cache)
91
+ /******/ var module = installedModules[moduleId] = {
92
+ /******/ i: moduleId,
93
+ /******/ l: false,
94
+ /******/ exports: {}
95
+ /******/ };
96
+ /******/
97
+ /******/ // Execute the module function
98
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
99
+ /******/
100
+ /******/ // Flag the module as loaded
101
+ /******/ module.l = true;
102
+ /******/
103
+ /******/ // Return the exports of the module
104
+ /******/ return module.exports;
105
+ /******/ }
106
+ /******/
107
+ /******/
108
+ /******/ // expose the modules object (__webpack_modules__)
109
+ /******/ __webpack_require__.m = modules;
110
+ /******/
111
+ /******/ // expose the module cache
112
+ /******/ __webpack_require__.c = installedModules;
113
+ /******/
114
+ /******/ // define getter function for harmony exports
115
+ /******/ __webpack_require__.d = function(exports, name, getter) {
116
+ /******/ if(!__webpack_require__.o(exports, name)) {
117
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
118
+ /******/ }
119
+ /******/ };
120
+ /******/
121
+ /******/ // define __esModule on exports
122
+ /******/ __webpack_require__.r = function(exports) {
123
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
124
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
125
+ /******/ }
126
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
127
+ /******/ };
128
+ /******/
129
+ /******/ // create a fake namespace object
130
+ /******/ // mode & 1: value is a module id, require it
131
+ /******/ // mode & 2: merge all properties of value into the ns
132
+ /******/ // mode & 4: return value when already ns object
133
+ /******/ // mode & 8|1: behave like require
134
+ /******/ __webpack_require__.t = function(value, mode) {
135
+ /******/ if(mode & 1) value = __webpack_require__(value);
136
+ /******/ if(mode & 8) return value;
137
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
138
+ /******/ var ns = Object.create(null);
139
+ /******/ __webpack_require__.r(ns);
140
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
141
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
142
+ /******/ return ns;
143
+ /******/ };
144
+ /******/
145
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
146
+ /******/ __webpack_require__.n = function(module) {
147
+ /******/ var getter = module && module.__esModule ?
148
+ /******/ function getDefault() { return module['default']; } :
149
+ /******/ function getModuleExports() { return module; };
150
+ /******/ __webpack_require__.d(getter, 'a', getter);
151
+ /******/ return getter;
152
+ /******/ };
153
+ /******/
154
+ /******/ // Object.prototype.hasOwnProperty.call
155
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
156
+ /******/
157
+ /******/ // __webpack_public_path__
158
+ /******/ __webpack_require__.p = "";
159
+ /******/
160
+ /******/ var jsonpArray = window["webpackJsonp_woocommerce_mailchimp_newsletter"] = window["webpackJsonp_woocommerce_mailchimp_newsletter"] || [];
161
+ /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
162
+ /******/ jsonpArray.push = webpackJsonpCallback;
163
+ /******/ jsonpArray = jsonpArray.slice();
164
+ /******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
165
+ /******/ var parentJsonpFunction = oldJsonpFunction;
166
+ /******/
167
+ /******/
168
+ /******/ // add entry module to deferred list
169
+ /******/ deferredModules.push(["./assets/js/checkout-newsletter-subscription-block/index.js","style-newsletter-block"]);
170
+ /******/ // run deferred modules when ready
171
+ /******/ return checkDeferredModules();
172
+ /******/ })
173
+ /************************************************************************/
174
+ /******/ ({
175
+
176
+ /***/ "./assets/js/checkout-newsletter-subscription-block/attributes.js":
177
+ /*!************************************************************************!*\
178
+ !*** ./assets/js/checkout-newsletter-subscription-block/attributes.js ***!
179
+ \************************************************************************/
180
+ /*! exports provided: default */
181
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
182
+
183
+ "use strict";
184
+ __webpack_require__.r(__webpack_exports__);
185
+ /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings");
186
+ /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__);
187
+ /**
188
+ * External dependencies
189
+ */
190
+
191
+ const {
192
+ optinDefaultText,
193
+ gdprHeadline,
194
+ gdprFields
195
+ } = Object(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__["getSetting"])('mailchimp-newsletter_data', '');
196
+ /* harmony default export */ __webpack_exports__["default"] = ({
197
+ text: {
198
+ type: 'string',
199
+ default: optinDefaultText
200
+ },
201
+ gdprHeadline: {
202
+ type: 'string',
203
+ default: gdprHeadline
204
+ },
205
+ gdpr: {
206
+ type: 'array',
207
+ default: gdprFields
208
+ }
209
+ });
210
+
211
+ /***/ }),
212
+
213
+ /***/ "./assets/js/checkout-newsletter-subscription-block/block.json":
214
+ /*!*********************************************************************!*\
215
+ !*** ./assets/js/checkout-newsletter-subscription-block/block.json ***!
216
+ \*********************************************************************/
217
+ /*! exports provided: apiVersion, name, version, title, category, description, supports, parent, attributes, textdomain, editorStyle, default */
218
+ /***/ (function(module) {
219
+
220
+ module.exports = JSON.parse("{\"apiVersion\":2,\"name\":\"woocommerce/mailchimp-newsletter-subscription\",\"version\":\"1.0.0\",\"title\":\"Mailchimp Newsletter!\",\"category\":\"woocommerce\",\"description\":\"Adds a newsletter subscription checkbox to the checkout.\",\"supports\":{\"html\":true,\"align\":false,\"multiple\":false,\"reusable\":false},\"parent\":[\"woocommerce/checkout-contact-information-block\"],\"attributes\":{\"lock\":{\"type\":\"object\",\"default\":{\"remove\":true,\"move\":true}}},\"textdomain\":\"mailchimp-woocommerce\",\"editorStyle\":\"file:../../../build/style-newsletter-block.css\"}");
221
+
222
+ /***/ }),
223
+
224
+ /***/ "./assets/js/checkout-newsletter-subscription-block/edit.js":
225
+ /*!******************************************************************!*\
226
+ !*** ./assets/js/checkout-newsletter-subscription-block/edit.js ***!
227
+ \******************************************************************/
228
+ /*! exports provided: Edit, Save */
229
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
230
+
231
+ "use strict";
232
+ __webpack_require__.r(__webpack_exports__);
233
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Edit", function() { return Edit; });
234
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Save", function() { return Save; });
235
+ /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
236
+ /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
237
+ /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
238
+ /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
239
+ /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
240
+ /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__);
241
+ /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
242
+ /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);
243
+ /* harmony import */ var _woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @woocommerce/blocks-checkout */ "@woocommerce/blocks-checkout");
244
+ /* harmony import */ var _woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_4__);
245
+ /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./style.scss */ "./assets/js/checkout-newsletter-subscription-block/style.scss");
246
+
247
+
248
+ /**
249
+ * External dependencies
250
+ */
251
+
252
+
253
+
254
+
255
+ /**
256
+ * Internal dependencies
257
+ */
258
+
259
+
260
+ const Edit = ({
261
+ attributes,
262
+ setAttributes
263
+ }) => {
264
+ const {
265
+ text,
266
+ gdprHeadline,
267
+ gdpr
268
+ } = attributes;
269
+ const blockProps = Object(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["useBlockProps"])();
270
+ console.log('edit', {
271
+ text: text,
272
+ gdprHeadline: gdprHeadline,
273
+ gdpr: gdpr
274
+ });
275
+ return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", blockProps, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["InspectorControls"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["PanelBody"], {
276
+ title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Block options', 'mailchimp-for-woocommerce')
277
+ }, "Options for the block go here.")), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
278
+ style: {
279
+ display: 'flex'
280
+ }
281
+ }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_4__["CheckboxControl"], {
282
+ id: "newsletter-text",
283
+ checked: false,
284
+ disabled: true
285
+ }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["RichText"], {
286
+ value: text,
287
+ help: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Set the newsletter confirmation text.', 'mailchimp-for-woocommerce'),
288
+ onChange: value => setAttributes({
289
+ text: value
290
+ })
291
+ })), gdpr && gdpr.length && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
292
+ style: {
293
+ display: 'flex',
294
+ marginTop: '2rem'
295
+ }
296
+ }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["RichText"], {
297
+ value: gdprHeadline,
298
+ help: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Set the GDPR headline.', 'mailchimp-for-woocommerce'),
299
+ onChange: value => setAttributes({
300
+ gdprHeadline: value
301
+ })
302
+ })), gdpr.map((gdprItem, index) => {
303
+ return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
304
+ style: {
305
+ display: 'flex',
306
+ marginTop: '1rem'
307
+ }
308
+ }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_woocommerce_blocks_checkout__WEBPACK_IMPORTED_MODULE_4__["CheckboxControl"], {
309
+ id: 'gdpr_' + gdprItem.marketing_permission_id,
310
+ checked: gdpr[index].enabled,
311
+ onChange: () => {
312
+ gdpr[index].enabled = !gdpr[index].enabled;
313
+ setAttributes({
314
+ gdpr: gdpr
315
+ });
316
+ }
317
+ }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("span", {
318
+ dangerouslySetInnerHTML: {
319
+ __html: gdprItem.text
320
+ }
321
+ })));
322
+ })));
323
+ }; // not sure
324
+
325
+ const Save = () => {
326
+ return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["useBlockProps"].save());
327
+ };
328
+
329
+ /***/ }),
330
+
331
+ /***/ "./assets/js/checkout-newsletter-subscription-block/index.js":
332
+ /*!*******************************************************************!*\
333
+ !*** ./assets/js/checkout-newsletter-subscription-block/index.js ***!
334
+ \*******************************************************************/
335
+ /*! no exports provided */
336
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
337
+
338
+ "use strict";
339
+ __webpack_require__.r(__webpack_exports__);
340
+ /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
341
+ /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
342
+ /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
343
+ /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__);
344
+ /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
345
+ /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__);
346
+ /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./assets/js/checkout-newsletter-subscription-block/edit.js");
347
+ /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./assets/js/checkout-newsletter-subscription-block/block.json");
348
+ var _block_json__WEBPACK_IMPORTED_MODULE_4___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./block.json */ "./assets/js/checkout-newsletter-subscription-block/block.json", 1);
349
+ /* harmony import */ var _attributes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./attributes */ "./assets/js/checkout-newsletter-subscription-block/attributes.js");
350
+
351
+
352
+ /**
353
+ * External dependencies
354
+ */
355
+
356
+
357
+ /**
358
+ * Internal dependencies
359
+ */
360
+
361
+
362
+
363
+
364
+ console.log('index.js', {
365
+ metadata: _block_json__WEBPACK_IMPORTED_MODULE_4__,
366
+ attributes: _attributes__WEBPACK_IMPORTED_MODULE_5__["default"]
367
+ });
368
+ Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["registerBlockType"])(_block_json__WEBPACK_IMPORTED_MODULE_4__, {
369
+ icon: {
370
+ src: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
371
+ xmlns: "http://www.w3.org/2000/svg",
372
+ width: "60",
373
+ height: "60",
374
+ viewBox: "0 0 46 49",
375
+ fill: "none"
376
+ }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", {
377
+ d: "M34.5458 23.5193C34.8988 23.4778 35.2361 23.4759 35.5457 23.5193C35.7252 23.107 35.7568 22.397 35.5951 21.6239C35.3544 20.4741 35.029 19.7778 34.3584 19.8863C33.6859 19.9948 33.6622 20.8271 33.9028 21.9769C34.037 22.6238 34.2776 23.1761 34.5458 23.5193Z",
378
+ fill: "black"
379
+ }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", {
380
+ d: "M28.7763 24.4284C29.2575 24.6394 29.5534 24.7795 29.6678 24.6572C29.7427 24.5803 29.719 24.4363 29.6046 24.2489C29.368 23.8624 28.8788 23.4679 28.3621 23.249C27.303 22.7934 26.0407 22.9453 25.0664 23.6454C24.745 23.8801 24.4393 24.2075 24.4826 24.4047C24.4965 24.4698 24.5458 24.5172 24.6582 24.5329C24.9225 24.5625 25.8494 24.0951 26.9164 24.03C27.6718 23.9827 28.295 24.2174 28.7763 24.4284Z",
381
+ fill: "black"
382
+ }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", {
383
+ d: "M27.8105 24.9806C27.1852 25.0793 26.8381 25.2863 26.6172 25.4777C26.4279 25.6433 26.3115 25.8267 26.3115 25.9549C26.3115 26.0161 26.3391 26.0516 26.3589 26.0693C26.3865 26.095 26.422 26.1088 26.4614 26.1088C26.6034 26.1088 26.919 25.9826 26.919 25.9826C27.7907 25.6709 28.3647 25.7084 28.9346 25.7735C29.2502 25.809 29.3981 25.8287 29.4672 25.7202C29.4869 25.6887 29.5125 25.6216 29.4494 25.521C29.3054 25.2804 28.6723 24.8781 27.8105 24.9806Z",
384
+ fill: "black"
385
+ }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", {
386
+ d: "M32.5975 27.0061C33.0235 27.2152 33.4909 27.1324 33.6428 26.8227C33.7946 26.5131 33.5737 26.093 33.1497 25.8839C32.7237 25.6749 32.2563 25.7577 32.1044 26.0673C31.9506 26.377 32.1734 26.7971 32.5975 27.0061Z",
387
+ fill: "black"
388
+ }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", {
389
+ d: "M35.3306 24.6177C34.9854 24.6118 34.6995 24.9905 34.6916 25.4638C34.6837 25.9372 34.9578 26.3257 35.303 26.3317C35.6481 26.3376 35.9341 25.9589 35.942 25.4855C35.9499 25.0122 35.6757 24.6237 35.3306 24.6177Z",
390
+ fill: "black"
391
+ }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", {
392
+ 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",
393
+ fill: "black"
394
+ }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", {
395
+ 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",
396
+ fill: "black"
397
+ })),
398
+ foreground: '#874FB9'
399
+ },
400
+ edit: _edit__WEBPACK_IMPORTED_MODULE_3__["Edit"],
401
+ save: _edit__WEBPACK_IMPORTED_MODULE_3__["Save"],
402
+ attributes: { ..._block_json__WEBPACK_IMPORTED_MODULE_4__.attributes,
403
+ ..._attributes__WEBPACK_IMPORTED_MODULE_5__["default"]
404
+ }
405
+ });
406
+
407
+ /***/ }),
408
+
409
+ /***/ "@woocommerce/blocks-checkout":
410
+ /*!****************************************!*\
411
+ !*** external ["wc","blocksCheckout"] ***!
412
+ \****************************************/
413
+ /*! no static exports found */
414
+ /***/ (function(module, exports) {
415
+
416
+ (function() { module.exports = window["wc"]["blocksCheckout"]; }());
417
+
418
+ /***/ }),
419
+
420
+ /***/ "@woocommerce/settings":
421
+ /*!************************************!*\
422
+ !*** external ["wc","wcSettings"] ***!
423
+ \************************************/
424
+ /*! no static exports found */
425
+ /***/ (function(module, exports) {
426
+
427
+ (function() { module.exports = window["wc"]["wcSettings"]; }());
428
+
429
+ /***/ }),
430
+
431
+ /***/ "@wordpress/block-editor":
432
+ /*!*************************************!*\
433
+ !*** external ["wp","blockEditor"] ***!
434
+ \*************************************/
435
+ /*! no static exports found */
436
+ /***/ (function(module, exports) {
437
+
438
+ (function() { module.exports = window["wp"]["blockEditor"]; }());
439
+
440
+ /***/ }),
441
+
442
+ /***/ "@wordpress/blocks":
443
+ /*!********************************!*\
444
+ !*** external ["wp","blocks"] ***!
445
+ \********************************/
446
+ /*! no static exports found */
447
+ /***/ (function(module, exports) {
448
+
449
+ (function() { module.exports = window["wp"]["blocks"]; }());
450
+
451
+ /***/ }),
452
+
453
+ /***/ "@wordpress/components":
454
+ /*!************************************!*\
455
+ !*** external ["wp","components"] ***!
456
+ \************************************/
457
+ /*! no static exports found */
458
+ /***/ (function(module, exports) {
459
+
460
+ (function() { module.exports = window["wp"]["components"]; }());
461
+
462
+ /***/ }),
463
+
464
+ /***/ "@wordpress/element":
465
+ /*!*********************************!*\
466
+ !*** external ["wp","element"] ***!
467
+ \*********************************/
468
+ /*! no static exports found */
469
+ /***/ (function(module, exports) {
470
+
471
+ (function() { module.exports = window["wp"]["element"]; }());
472
+
473
+ /***/ }),
474
+
475
+ /***/ "@wordpress/i18n":
476
+ /*!******************************!*\
477
+ !*** external ["wp","i18n"] ***!
478
+ \******************************/
479
+ /*! no static exports found */
480
+ /***/ (function(module, exports) {
481
+
482
+ (function() { module.exports = window["wp"]["i18n"]; }());
483
+
484
+ /***/ })
485
+
486
+ /******/ });
487
+ //# sourceMappingURL=newsletter-block.js.map
blocks/build/newsletter-block.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/js/checkout-newsletter-subscription-block/attributes.js","webpack:///./assets/js/checkout-newsletter-subscription-block/edit.js","webpack:///./assets/js/checkout-newsletter-subscription-block/index.js","webpack:///external [\"wc\",\"blocksCheckout\"]","webpack:///external [\"wc\",\"wcSettings\"]","webpack:///external [\"wp\",\"blockEditor\"]","webpack:///external [\"wp\",\"blocks\"]","webpack:///external [\"wp\",\"components\"]","webpack:///external [\"wp\",\"element\"]","webpack:///external [\"wp\",\"i18n\"]"],"names":["optinDefaultText","gdprHeadline","gdprFields","getSetting","text","type","default","gdpr","Edit","attributes","setAttributes","blockProps","useBlockProps","console","log","__","display","value","length","marginTop","map","gdprItem","index","marketing_permission_id","enabled","__html","Save","save","metadata","registerBlockType","icon","src","foreground","edit"],"mappings":";;;;;;;;;;;;;;;;;;;QAAA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;QACA,QAAQ,oBAAoB;QAC5B;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA,iBAAiB,4BAA4B;QAC7C;QACA;QACA,kBAAkB,2BAA2B;QAC7C;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;;QAEA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;QACA;QACA;QACA,gBAAgB,uBAAuB;QACvC;;;QAGA;QACA;QACA;QACA;;;;;;;;;;;;;ACvJA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA,MAAM;AACLA,kBADK;AAELC,cAFK;AAGLC;AAHK,IAIFC,wEAAU,CAAE,2BAAF,EAA+B,EAA/B,CAJd;AAMe;AACdC,MAAI,EAAE;AACLC,QAAI,EAAE,QADD;AAELC,WAAO,EAAEN;AAFJ,GADQ;AAKdC,cAAY,EAAE;AACbI,QAAI,EAAE,QADO;AAEbC,WAAO,EAAEL;AAFI,GALA;AASdM,MAAI,EAAE;AACLF,QAAI,EAAE,OADD;AAELC,WAAO,EAAEJ;AAFJ;AATQ,CAAf,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AAKA;AACA;AAEA;AACA;AACA;;AACA;AAEO,MAAMM,IAAI,GAAG,CAAE;AAAEC,YAAF;AAAcC;AAAd,CAAF,KAAqC;AACxD,QAAM;AAAEN,QAAF;AAAQH,gBAAR;AAAsBM;AAAtB,MAA+BE,UAArC;AACA,QAAME,UAAU,GAAGC,6EAAa,EAAhC;AAEAC,SAAO,CAACC,GAAR,CAAY,MAAZ,EAAoB;AACnBV,QAAI,EAAEA,IADa;AAEnBH,gBAAY,EAAEA,YAFK;AAGnBM,QAAI,EAAEA;AAHa,GAApB;AAMA,SACC,gFAAUI,UAAV,EACC,yEAAC,yEAAD,QACC,yEAAC,+DAAD;AAAW,SAAK,EAAGI,0DAAE,CAAE,eAAF,EAAmB,2BAAnB;AAArB,sCADD,CADD,EAMC;AAAK,SAAK,EAAE;AAACC,aAAO,EAAE;AAAV;AAAZ,KACC,yEAAC,4EAAD;AACC,MAAE,EAAC,iBADJ;AAEC,WAAO,EAAG,KAFX;AAGC,YAAQ,EAAG;AAHZ,IADD,EAMC,yEAAC,gEAAD;AACC,SAAK,EAAGZ,IADT;AAEC,QAAI,EAAEW,0DAAE,CAAE,uCAAF,EAA2C,2BAA3C,CAFT;AAGC,YAAQ,EAAKE,KAAF,IAAaP,aAAa,CAAE;AAAEN,UAAI,EAAEa;AAAR,KAAF;AAHtC,IAND,CAND,EAmBEV,IAAI,IAAIA,IAAI,CAACW,MAAb,IAEC,4IACC;AAAK,SAAK,EAAE;AAACF,aAAO,EAAE,MAAV;AAAkBG,eAAS,EAAE;AAA7B;AAAZ,KACC,yEAAC,gEAAD;AACC,SAAK,EAAGlB,YADT;AAEC,QAAI,EAAEc,0DAAE,CAAE,wBAAF,EAA4B,2BAA5B,CAFT;AAGC,YAAQ,EAAKE,KAAF,IAAaP,aAAa,CAAE;AAAET,kBAAY,EAAEgB;AAAhB,KAAF;AAHtC,IADD,CADD,EAQEV,IAAI,CAACa,GAAL,CAAS,CAACC,QAAD,EAAWC,KAAX,KAAqB;AAC9B,WACC;AAAK,WAAK,EAAE;AAACN,eAAO,EAAE,MAAV;AAAkBG,iBAAS,EAAE;AAA7B;AAAZ,OACC,yEAAC,4EAAD;AACC,QAAE,EAAE,UAAQE,QAAQ,CAACE,uBADtB;AAEC,aAAO,EAAGhB,IAAI,CAACe,KAAD,CAAJ,CAAYE,OAFvB;AAGC,cAAQ,EAAG,MAAM;AAChBjB,YAAI,CAACe,KAAD,CAAJ,CAAYE,OAAZ,GAAsB,CAACjB,IAAI,CAACe,KAAD,CAAJ,CAAYE,OAAnC;AACAd,qBAAa,CAAC;AAACH,cAAI,EAAEA;AAAP,SAAD,CAAb;AACA;AANF,OAQC;AAAM,6BAAuB,EAAG;AAACkB,cAAM,EAAEJ,QAAQ,CAACjB;AAAlB;AAAhC,MARD,CADD,CADD;AAcA,GAfA,CARF,CArBH,CADD;AAmDA,CA7DM,C,CA+DP;;AACO,MAAMsB,IAAI,GAAG,MAAM;AACzB,SAAO,gFAAUd,qEAAa,CAACe,IAAd,EAAV,CAAP;AACA,CAFM,C;;;;;;;;;;;;;;;;;;;;;;;;;ACjFP;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;AACA;AACA;AACA;AAEAd,OAAO,CAACC,GAAR,CAAY,UAAZ,EAAwB;AACvBc,UAAQ,EAAEA,wCADa;AAEvBnB,YAAU,EAAEA,mDAAUA;AAFC,CAAxB;AAKAoB,2EAAiB,CAAED,wCAAF,EAAY;AAC5BE,MAAI,EAAE;AACLC,OAAG,EACF,yEAAC,yDAAD;AAAK,WAAK,EAAC,4BAAX;AAAwC,WAAK,EAAC,IAA9C;AAAmD,YAAM,EAAC,IAA1D;AAA+D,aAAO,EAAC,WAAvE;AAAmF,UAAI,EAAC;AAAxF,OACC;AACC,OAAC,EAAC,+PADH;AAEC,UAAI,EAAC;AAFN,MADD,EAIC;AACC,OAAC,EAAC,2YADH;AAEC,UAAI,EAAC;AAFN,MAJD,EAOC;AACC,OAAC,EAAC,6bADH;AAEC,UAAI,EAAC;AAFN,MAPD,EAUC;AACC,OAAC,EAAC,iNADH;AAEC,UAAI,EAAC;AAFN,MAVD,EAaC;AACC,OAAC,EAAC,iNADH;AAEC,UAAI,EAAC;AAFN,MAbD,EAgBC;AACC,OAAC,EAAC,47BADH;AAEC,UAAI,EAAC;AAFN,MAhBD,EAmBC;AACC,OAAC,EAAC,s/IADH;AAEC,UAAI,EAAC;AAFN,MAnBD,CAFI;AA0BLC,cAAU,EAAE;AA1BP,GADsB;AA6B5BC,MAAI,EAAEzB,0CA7BsB;AA8B5BmB,MAAI,EAAED,0CA9BsB;AA+B5BjB,YAAU,EAAE,EACX,GAAGmB,wCAAQ,CAACnB,UADD;AAEX,OAAGA,mDAAUA;AAFF;AA/BgB,CAAZ,CAAjB,C;;;;;;;;;;;AClBA,aAAa,iDAAiD,EAAE,I;;;;;;;;;;;ACAhE,aAAa,6CAA6C,EAAE,I;;;;;;;;;;;ACA5D,aAAa,8CAA8C,EAAE,I;;;;;;;;;;;ACA7D,aAAa,yCAAyC,EAAE,I;;;;;;;;;;;ACAxD,aAAa,6CAA6C,EAAE,I;;;;;;;;;;;ACA5D,aAAa,0CAA0C,EAAE,I;;;;;;;;;;;ACAzD,aAAa,uCAAuC,EAAE,I","file":"newsletter-block.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t\"newsletter-block\": 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \tvar jsonpArray = window[\"webpackJsonp_woocommerce_mailchimp_newsletter\"] = window[\"webpackJsonp_woocommerce_mailchimp_newsletter\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([\"./assets/js/checkout-newsletter-subscription-block/index.js\",\"style-newsletter-block\"]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","/**\n * External dependencies\n */\nimport { getSetting } from '@woocommerce/settings';\n\nconst {\n\toptinDefaultText,\n\tgdprHeadline,\n\tgdprFields,\n} = getSetting( 'mailchimp-newsletter_data', '' );\n\nexport default {\n\ttext: {\n\t\ttype: 'string',\n\t\tdefault: optinDefaultText,\n\t},\n\tgdprHeadline: {\n\t\ttype: 'string',\n\t\tdefault: gdprHeadline,\n\t},\n\tgdpr: {\n\t\ttype: 'array',\n\t\tdefault: gdprFields\n\t}\n};\n","/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tRichText,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { PanelBody } from '@wordpress/components';\nimport { CheckboxControl } from '@woocommerce/blocks-checkout';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\n\nexport const Edit = ( { attributes, setAttributes } ) => {\n\tconst { text, gdprHeadline, gdpr } = attributes;\n\tconst blockProps = useBlockProps();\n\n\tconsole.log('edit', {\n\t\ttext: text,\n\t\tgdprHeadline: gdprHeadline,\n\t\tgdpr: gdpr,\n\t});\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Block options', 'mailchimp-for-woocommerce' ) }>\n\t\t\t\t\tOptions for the block go here.\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div style={{display: 'flex'}}>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tid=\"newsletter-text\"\n\t\t\t\t\tchecked={ false }\n\t\t\t\t\tdisabled={ true }\n\t\t\t\t/>\n\t\t\t\t<RichText\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\thelp={__( 'Set the newsletter confirmation text.', 'mailchimp-for-woocommerce' )}\n\t\t\t\t\tonChange={ ( value ) => setAttributes( { text: value } ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{\n\t\t\t\tgdpr && gdpr.length &&\n\t\t\t\t(\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div style={{display: 'flex', marginTop: '2rem'}}>\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\tvalue={ gdprHeadline }\n\t\t\t\t\t\t\t\thelp={__( 'Set the GDPR headline.', 'mailchimp-for-woocommerce' )}\n\t\t\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { gdprHeadline: value } ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{gdpr.map((gdprItem, index) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<div style={{display: 'flex', marginTop: '1rem'}}>\n\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\tid={'gdpr_'+gdprItem.marketing_permission_id}\n\t\t\t\t\t\t\t\t\t\tchecked={ gdpr[index].enabled }\n\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\tgdpr[index].enabled = !gdpr[index].enabled;\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes({gdpr: gdpr});\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span dangerouslySetInnerHTML={ {__html: gdprItem.text} }/>\n\t\t\t\t\t\t\t\t\t</CheckboxControl>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t})}\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\t\t</div>\n\t);\n};\n\n// not sure\nexport const Save = () => {\n\treturn <div { ...useBlockProps.save() } />;\n};\n","/**\n * External dependencies\n */\nimport { SVG } from '@wordpress/components';\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { Edit, Save } from './edit';\nimport metadata from './block.json';\nimport attributes from './attributes';\n\nconsole.log('index.js', {\n\tmetadata: metadata,\n\tattributes: attributes,\n});\n\nregisterBlockType( metadata, {\n\ticon: {\n\t\tsrc: (\n\t\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" width=\"60\" height=\"60\" viewBox=\"0 0 46 49\" fill=\"none\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M34.5458 23.5193C34.8988 23.4778 35.2361 23.4759 35.5457 23.5193C35.7252 23.107 35.7568 22.397 35.5951 21.6239C35.3544 20.4741 35.029 19.7778 34.3584 19.8863C33.6859 19.9948 33.6622 20.8271 33.9028 21.9769C34.037 22.6238 34.2776 23.1761 34.5458 23.5193Z\"\n\t\t\t\t\tfill=\"black\"/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M28.7763 24.4284C29.2575 24.6394 29.5534 24.7795 29.6678 24.6572C29.7427 24.5803 29.719 24.4363 29.6046 24.2489C29.368 23.8624 28.8788 23.4679 28.3621 23.249C27.303 22.7934 26.0407 22.9453 25.0664 23.6454C24.745 23.8801 24.4393 24.2075 24.4826 24.4047C24.4965 24.4698 24.5458 24.5172 24.6582 24.5329C24.9225 24.5625 25.8494 24.0951 26.9164 24.03C27.6718 23.9827 28.295 24.2174 28.7763 24.4284Z\"\n\t\t\t\t\tfill=\"black\"/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M27.8105 24.9806C27.1852 25.0793 26.8381 25.2863 26.6172 25.4777C26.4279 25.6433 26.3115 25.8267 26.3115 25.9549C26.3115 26.0161 26.3391 26.0516 26.3589 26.0693C26.3865 26.095 26.422 26.1088 26.4614 26.1088C26.6034 26.1088 26.919 25.9826 26.919 25.9826C27.7907 25.6709 28.3647 25.7084 28.9346 25.7735C29.2502 25.809 29.3981 25.8287 29.4672 25.7202C29.4869 25.6887 29.5125 25.6216 29.4494 25.521C29.3054 25.2804 28.6723 24.8781 27.8105 24.9806Z\"\n\t\t\t\t\tfill=\"black\"/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M32.5975 27.0061C33.0235 27.2152 33.4909 27.1324 33.6428 26.8227C33.7946 26.5131 33.5737 26.093 33.1497 25.8839C32.7237 25.6749 32.2563 25.7577 32.1044 26.0673C31.9506 26.377 32.1734 26.7971 32.5975 27.0061Z\"\n\t\t\t\t\tfill=\"black\"/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M35.3306 24.6177C34.9854 24.6118 34.6995 24.9905 34.6916 25.4638C34.6837 25.9372 34.9578 26.3257 35.303 26.3317C35.6481 26.3376 35.9341 25.9589 35.942 25.4855C35.9499 25.0122 35.6757 24.6237 35.3306 24.6177Z\"\n\t\t\t\t\tfill=\"black\"/>\n\t\t\t\t<path\n\t\t\t\t\td=\"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\"\n\t\t\t\t\tfill=\"black\"/>\n\t\t\t\t<path\n\t\t\t\t\td=\"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\"\n\t\t\t\t\tfill=\"black\"/>\n\t\t\t</SVG>\n\t\t),\n\t\tforeground: '#874FB9',\n\t},\n\tedit: Edit,\n\tsave: Save,\n\tattributes: {\n\t\t...metadata.attributes,\n\t\t...attributes,\n\t},\n} );\n","(function() { module.exports = window[\"wc\"][\"blocksCheckout\"]; }());","(function() { module.exports = window[\"wc\"][\"wcSettings\"]; }());","(function() { module.exports = window[\"wp\"][\"blockEditor\"]; }());","(function() { module.exports = window[\"wp\"][\"blocks\"]; }());","(function() { module.exports = window[\"wp\"][\"components\"]; }());","(function() { module.exports = window[\"wp\"][\"element\"]; }());","(function() { module.exports = window[\"wp\"][\"i18n\"]; }());"],"sourceRoot":""}
blocks/build/style-newsletter-block.css ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wp-block-woocommerce-checkout-newsletter-subscription {
2
+ margin: 20px 0;
3
+ padding-top: 4px;
4
+ padding-bottom: 4px;
5
+ display: flex;
6
+ align-items: flex-start;
7
+ }
8
+ .wp-block-woocommerce-checkout-newsletter-subscription .block-editor-rich-text__editable {
9
+ vertical-align: middle;
10
+ line-height: 24px;
11
+ }
12
+ .wp-block-woocommerce-checkout-newsletter-subscription .wc-block-components-checkbox {
13
+ margin-right: 16px;
14
+ margin-top: 0;
15
+ }
16
+
17
+ /*# sourceMappingURL=style-newsletter-block.css.map*/
blocks/build/style-newsletter-block.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["webpack:///./assets/js/checkout-newsletter-subscription-block/style.scss"],"names":[],"mappings":"AAAA;EACC;EACA;EACA;EACA;EACA;AACD;AACC;EACC;EACA;AACF;AAEC;EACC;EACA;AAAF,C","file":"style-newsletter-block.css","sourcesContent":[".wp-block-woocommerce-checkout-newsletter-subscription {\n\tmargin: 20px 0;\n\tpadding-top: 4px;\n\tpadding-bottom: 4px;\n\tdisplay: flex;\n\talign-items: flex-start;\n\n\t.block-editor-rich-text__editable {\n\t\tvertical-align: middle;\n\t\tline-height: 24px;\n\t}\n\n\t.wc-block-components-checkbox {\n\t\tmargin-right: 16px;\n\t\tmargin-top: 0;\n\t}\n}"],"sourceRoot":""}
bootstrap.php CHANGED
@@ -64,7 +64,8 @@ spl_autoload_register(function($class) {
64
  'MailChimp_WooCommerce_Single_Product' => 'includes/processes/class-mailchimp-woocommerce-single-product.php',
65
  'MailChimp_WooCommerce_User_Submit' => 'includes/processes/class-mailchimp-woocommerce-user-submit.php',
66
  'MailChimp_WooCommerce_Process_Full_Sync_Manager' => 'includes/processes/class-mailchimp-woocommerce-full-sync-manager.php',
67
-
 
68
  'MailChimp_WooCommerce_Public' => 'public/class-mailchimp-woocommerce-public.php',
69
  'MailChimp_WooCommerce_Admin' => 'admin/class-mailchimp-woocommerce-admin.php',
70
  );
@@ -87,7 +88,7 @@ function mailchimp_environment_variables() {
87
  return (object) array(
88
  'repo' => 'master',
89
  'environment' => 'production', // staging or production
90
- 'version' => '2.6',
91
  'php_version' => phpversion(),
92
  'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
93
  'wc_version' => function_exists('WC') ? WC()->version : null,
@@ -217,7 +218,7 @@ function mailchimp_get_remaining_jobs_count($job_hook) {
217
  }
218
 
219
  function mailchimp_submit_subscribed_only() {
220
- return !(bool) mailchimp_get_option('mailchimp_ongoing_sync_status', '1');
221
  }
222
 
223
  /**
@@ -284,6 +285,13 @@ function mailchimp_is_configured() {
284
  return (bool) (mailchimp_get_api_key() && mailchimp_get_list_id());
285
  }
286
 
 
 
 
 
 
 
 
287
  /**
288
  * @return bool|int
289
  */
@@ -1244,7 +1252,7 @@ function mailchimp_settings_errors() {
1244
  * @throws MailChimp_WooCommerce_Error
1245
  * @throws MailChimp_WooCommerce_ServerError
1246
  */
1247
- function mailchimp_member_data_update($user_email = null, $language = null, $caller = '', $status_if_new = 'transactional', $order = null, $gdpr_fields = null) {
1248
  mailchimp_debug('debug', "mailchimp_member_data_update", array(
1249
  'user_email' => $user_email,
1250
  'user_language' => $language,
@@ -1282,10 +1290,16 @@ function mailchimp_member_data_update($user_email = null, $language = null, $cal
1282
  }
1283
  $merge_fields = $order ? apply_filters('mailchimp_get_ecommerce_merge_tags', array(), $order) : array();
1284
  if (!is_array($merge_fields)) $merge_fields = array();
1285
- mailchimp_get_api()->update($list_id, $user_email, $member['status'], $merge_fields, null, $language, $gdpr_fields_to_save);
 
 
 
 
 
1286
  // set transient to prevent too many calls to update language
1287
  mailchimp_set_transient($caller . ".member.{$hash}", true, 3600);
1288
- mailchimp_log($caller . '.member.updated', "Updated {$user_email} subscriber status to {$member['status']} and language to {$language}");
 
1289
  } catch (\Exception $e) {
1290
  if ($e->getCode() == 404) {
1291
  $merge_fields = $order ? apply_filters('mailchimp_get_ecommerce_merge_tags', array(), $order) : array();
64
  'MailChimp_WooCommerce_Single_Product' => 'includes/processes/class-mailchimp-woocommerce-single-product.php',
65
  'MailChimp_WooCommerce_User_Submit' => 'includes/processes/class-mailchimp-woocommerce-user-submit.php',
66
  'MailChimp_WooCommerce_Process_Full_Sync_Manager' => 'includes/processes/class-mailchimp-woocommerce-full-sync-manager.php',
67
+ 'MailChimp_WooCommerce_Subscriber_Sync' => 'includes/processes/class-mailchimp-woocommerce-subscriber-sync.php',
68
+
69
  'MailChimp_WooCommerce_Public' => 'public/class-mailchimp-woocommerce-public.php',
70
  'MailChimp_WooCommerce_Admin' => 'admin/class-mailchimp-woocommerce-admin.php',
71
  );
88
  return (object) array(
89
  'repo' => 'master',
90
  'environment' => 'production', // staging or production
91
+ 'version' => '2.6.2',
92
  'php_version' => phpversion(),
93
  'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
94
  'wc_version' => function_exists('WC') ? WC()->version : null,
218
  }
219
 
220
  function mailchimp_submit_subscribed_only() {
221
+ return ! (bool) mailchimp_get_option('mailchimp_ongoing_sync_status', '1');
222
  }
223
 
224
  /**
285
  return (bool) (mailchimp_get_api_key() && mailchimp_get_list_id());
286
  }
287
 
288
+ /**
289
+ * @return bool
290
+ */
291
+ function mailchimp_action_scheduler_exists() {
292
+ return ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && class_exists( 'ActionScheduler', false ) );
293
+ }
294
+
295
  /**
296
  * @return bool|int
297
  */
1252
  * @throws MailChimp_WooCommerce_Error
1253
  * @throws MailChimp_WooCommerce_ServerError
1254
  */
1255
+ function mailchimp_member_data_update($user_email = null, $language = null, $caller = '', $status_if_new = 'transactional', $order = null, $gdpr_fields = null, $update_status = false) {
1256
  mailchimp_debug('debug', "mailchimp_member_data_update", array(
1257
  'user_email' => $user_email,
1258
  'user_language' => $language,
1290
  }
1291
  $merge_fields = $order ? apply_filters('mailchimp_get_ecommerce_merge_tags', array(), $order) : array();
1292
  if (!is_array($merge_fields)) $merge_fields = array();
1293
+
1294
+ if ($update_status && in_array($member['status'], array('unsubscribed', 'cleaned'))) {
1295
+ $member['status'] = $status_if_new;
1296
+ }
1297
+
1298
+ $result = mailchimp_get_api()->update($list_id, $user_email, $member['status'], $merge_fields, null, $language, $gdpr_fields_to_save);
1299
  // set transient to prevent too many calls to update language
1300
  mailchimp_set_transient($caller . ".member.{$hash}", true, 3600);
1301
+
1302
+ mailchimp_log($caller . '.member.updated', "Updated {$user_email} subscriber status to {$result['status']} and language to {$language}");
1303
  } catch (\Exception $e) {
1304
  if ($e->getCode() == 404) {
1305
  $merge_fields = $order ? apply_filters('mailchimp_get_ecommerce_merge_tags', array(), $order) : array();
includes/api/class-mailchimp-api.php CHANGED
@@ -237,7 +237,20 @@ class MailChimp_WooCommerce_MailChimpApi
237
 
238
  mailchimp_debug('api.subscribe', "Subscribing {$email}", $data);
239
 
240
- return $this->post("lists/$list_id/members?skip_merge_validation=true", $data);
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  }
242
 
243
  /**
@@ -291,7 +304,40 @@ class MailChimp_WooCommerce_MailChimpApi
291
 
292
  mailchimp_debug('api.update_member', "Updating {$email}", $data);
293
 
294
- return $this->patch("lists/$list_id/members/$hash?skip_merge_validation=true", $data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
296
 
297
  /**
@@ -1628,6 +1674,64 @@ class MailChimp_WooCommerce_MailChimpApi
1628
  return $fields;
1629
  }
1630
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1631
  /**
1632
  * @param $url
1633
  * @param null $params
@@ -1895,7 +1999,8 @@ class MailChimp_WooCommerce_MailChimpApi
1895
  if (isset($data['http_code']) && $data['http_code'] == 403) {
1896
  throw new MailChimp_WooCommerce_RateLimitError();
1897
  }
1898
- throw new MailChimp_WooCommerce_Error($data['detail'], (int) $data['status']);
 
1899
  }
1900
 
1901
  return false;
237
 
238
  mailchimp_debug('api.subscribe', "Subscribing {$email}", $data);
239
 
240
+ try {
241
+ return $this->post("lists/$list_id/members?skip_merge_validation=true", $data);
242
+ } catch (\Exception $e) {
243
+ // If mailchimp says is already a member lets send the update by PUT
244
+ if (mailchimp_string_contains($e->getMessage(), 'is already a list member')) {
245
+ return $this->applyPutRequestOnSubscriber($list_id, $email, $data);
246
+ } elseif ($data['status'] !== 'subscribed' || !mailchimp_string_contains($e->getMessage(), 'compliance state')) {
247
+ throw $e;
248
+ }
249
+ $data['status'] = 'pending';
250
+ $result = $this->post("lists/$list_id/members?skip_merge_validation=true", $data);
251
+ mailchimp_log('api', "{$email} was in compliance state, sending the double opt in message");
252
+ return $result;
253
+ }
254
  }
255
 
256
  /**
304
 
305
  mailchimp_debug('api.update_member', "Updating {$email}", $data);
306
 
307
+ try {
308
+ return $this->patch("lists/$list_id/members/$hash?skip_merge_validation=true", $data);
309
+ } catch (\Exception $e) {
310
+ // If mailchimp says is already a member lets send the update by PUT
311
+ if (mailchimp_string_contains($e->getMessage(), 'is already a list member')) {
312
+ return $this->applyPutRequestOnSubscriber($list_id, $email, $data);
313
+ } elseif ($data['status'] !== 'subscribed' || !mailchimp_string_contains($e->getMessage(), 'compliance state')) {
314
+ throw $e;
315
+ }
316
+ $data['status'] = 'pending';
317
+ $result = $this->patch("lists/$list_id/members/$hash?skip_merge_validation=true", $data);
318
+ mailchimp_log('api', "{$email} was in compliance state, sending the double opt in message");
319
+ return $result;
320
+ }
321
+ }
322
+
323
+ /**
324
+ * @param $list_id
325
+ * @param $email
326
+ * @param $data
327
+ * @return array|bool|mixed|object|null
328
+ * @throws MailChimp_WooCommerce_Error
329
+ * @throws MailChimp_WooCommerce_ServerError
330
+ */
331
+ protected function applyPutRequestOnSubscriber($list_id, $email, $data)
332
+ {
333
+ try {
334
+ $hash = md5(strtolower(trim($email)));
335
+ mailchimp_log('api.update', "{$email} was already a list member sending the update by PUT");
336
+ $result = $this->put("lists/$list_id/members/$hash?skip_merge_validation=true", $data);
337
+ return $result;
338
+ } catch(\Exception $e) {
339
+ throw $e;
340
+ }
341
  }
342
 
343
  /**
1674
  return $fields;
1675
  }
1676
 
1677
+ /**
1678
+ * @param $list_id
1679
+ * @return array|bool
1680
+ * @throws \Throwable
1681
+ */
1682
+ public function getWebHooks($list_id)
1683
+ {
1684
+ return $this->get("lists/{$list_id}/webhooks");
1685
+ }
1686
+
1687
+ /**
1688
+ * @param $list_id
1689
+ * @param $url
1690
+ * @return array|bool
1691
+ * @throws \Throwable
1692
+ */
1693
+ public function webHookSubscribe($list_id, $url)
1694
+ {
1695
+ return $this->post("lists/{$list_id}/webhooks", [
1696
+ 'url' => $url,
1697
+ 'events' => [
1698
+ 'subscribe' => true,
1699
+ 'unsubscribe' => true,
1700
+ 'cleaned' => true,
1701
+ 'profile' => false,
1702
+ 'upemail' => false,
1703
+ 'campaign' => false,
1704
+ ],
1705
+ 'sources' => [
1706
+ 'user' => true,
1707
+ 'admin' => true,
1708
+ 'api' => true,
1709
+ ]
1710
+ ]);
1711
+ }
1712
+
1713
+ /**
1714
+ * @param $list_id
1715
+ * @param $url
1716
+ * @return int
1717
+ * @throws MailChimp_WooCommerce_Error
1718
+ * @throws MailChimp_WooCommerce_ServerError
1719
+ * @throws Throwable
1720
+ */
1721
+ public function webHookDelete($list_id, $url)
1722
+ {
1723
+ $deleted = 0;
1724
+ $hooks = $this->getWebHooks($list_id);
1725
+ foreach ($hooks['webhooks'] as $hook) {
1726
+ $href = $hook['href'] ?? $hook['url'] ?? null;
1727
+ if ($href && $href === $url) {
1728
+ $this->delete("lists/{$list_id}/webhooks/{$hook['id']}");
1729
+ $deleted++;
1730
+ }
1731
+ }
1732
+ return $deleted;
1733
+ }
1734
+
1735
  /**
1736
  * @param $url
1737
  * @param null $params
1999
  if (isset($data['http_code']) && $data['http_code'] == 403) {
2000
  throw new MailChimp_WooCommerce_RateLimitError();
2001
  }
2002
+ $error = isset($data['detail']) ? $data['detail'] : ("Error code ".$data['status']);
2003
+ throw new MailChimp_WooCommerce_Error($error, (int) $data['status']);
2004
  }
2005
 
2006
  return false;
includes/class-mailchimp-woocommerce-newsletter.php CHANGED
@@ -59,9 +59,6 @@ class MailChimp_Newsletter extends MailChimp_WooCommerce_Options
59
  if (is_user_logged_in()) {
60
  $status = get_user_meta(get_current_user_id(), 'mailchimp_woocommerce_is_subscribed', true);
61
  /// if the user is logged in - and is already subscribed - just ignore this checkbox.
62
- if ((bool) $status) {
63
- return;
64
- }
65
  if ($status === '' || $status === null) {
66
  $status = $default_checked;
67
  }
59
  if (is_user_logged_in()) {
60
  $status = get_user_meta(get_current_user_id(), 'mailchimp_woocommerce_is_subscribed', true);
61
  /// if the user is logged in - and is already subscribed - just ignore this checkbox.
 
 
 
62
  if ($status === '' || $status === null) {
63
  $status = $default_checked;
64
  }
includes/class-mailchimp-woocommerce-service.php CHANGED
@@ -639,21 +639,16 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
639
  // if we already have a cookie here, we need to skip it.
640
  if ($this->getLandingSiteCookie() != false) return $this;
641
 
642
- $http_referer = $this->getReferer();
643
-
644
- if (!empty($http_referer)) {
645
-
646
- // grab the current landing url since it's a referral.
647
- $landing_site = home_url() . wp_unslash($_SERVER['REQUEST_URI']);
648
-
649
- $compare_refer = str_replace(array('http://', 'https://'), '', $http_referer);
650
- $compare_local = str_replace(array('http://', 'https://'), '', $landing_site);
651
-
652
- if (strpos($compare_local, $compare_refer) === 0) return $this;
653
-
654
- // set the cookie
655
  mailchimp_set_cookie('mailchimp_landing_site', $landing_site, $this->getCookieDuration(), '/' );
656
-
657
  $this->setWooSession('mailchimp_landing_site', $landing_site);
658
  }
659
 
639
  // if we already have a cookie here, we need to skip it.
640
  if ($this->getLandingSiteCookie() != false) return $this;
641
 
642
+ // grab the current landing url since it's a referral.
643
+ $landing_site = home_url() . wp_unslash($_SERVER['REQUEST_URI']);
644
+
645
+ // Catch all possible file requests to avoid false positives
646
+ // We need to catch just real pages of the website
647
+ // Catching images, videos and fonts file types
648
+ preg_match("/^.*\.(ai|bmp|gif|ico|jpeg|jpg|png|ps|psd|svg|tif|tiff|fnt|fon|otf|ttf|3g2|3gp|avi|flv|h264|m4v|mkv|mov|mp4|mpg|mpeg|rm|swf|vob|wmv|aif|cda|mid|midi|mp3|mpa|ogg|wav|wma|wpl)$/i", $landing_site, $matches);
649
+
650
+ if (!empty($landing_site) && !wp_doing_ajax() && ( count($matches) == 0 ) ) {
 
 
 
 
651
  mailchimp_set_cookie('mailchimp_landing_site', $landing_site, $this->getCookieDuration(), '/' );
 
652
  $this->setWooSession('mailchimp_landing_site', $landing_site);
653
  }
654
 
includes/processes/class-mailchimp-woocommerce-cart-update.php CHANGED
@@ -238,7 +238,7 @@ class MailChimp_WooCommerce_Cart_Update extends Mailchimp_Woocommerce_Job
238
  // we need to use this instead of the main product id.
239
  if ($variant_id) {
240
  $product = wc_get_product($variant_id);
241
- if (!empty($product)) {
242
  $product_id = $product->get_parent_id();
243
  } else {
244
  $product = wc_get_product($product_id);
238
  // we need to use this instead of the main product id.
239
  if ($variant_id) {
240
  $product = wc_get_product($variant_id);
241
+ if ( is_object( $product ) && method_exists( $product, 'get_parent_id' ) ) {
242
  $product_id = $product->get_parent_id();
243
  } else {
244
  $product = wc_get_product($product_id);
includes/processes/class-mailchimp-woocommerce-single-order.php CHANGED
@@ -330,7 +330,7 @@ class MailChimp_WooCommerce_Single_Order extends Mailchimp_Woocommerce_Job
330
 
331
  if (empty($api_response)) {
332
  mailchimp_error('order_submit.failure', "$call :: #{$order->getId()} :: email: {$email} produced a blank response from MailChimp");
333
- return $api_response;
334
  }
335
 
336
  if (isset($deleted_abandoned_cart) && $deleted_abandoned_cart) {
@@ -347,7 +347,7 @@ class MailChimp_WooCommerce_Single_Order extends Mailchimp_Woocommerce_Job
347
  }
348
 
349
  // Maybe sync subscriber to set correct member.language
350
- mailchimp_member_data_update($email, $this->user_language, 'order', $status_if_new, $order, $this->gdpr_fields);
351
 
352
  mailchimp_log('order_submit.success', $log);
353
 
330
 
331
  if (empty($api_response)) {
332
  mailchimp_error('order_submit.failure', "$call :: #{$order->getId()} :: email: {$email} produced a blank response from MailChimp");
333
+ return isset($api_response) ? $api_response : false;
334
  }
335
 
336
  if (isset($deleted_abandoned_cart) && $deleted_abandoned_cart) {
347
  }
348
 
349
  // Maybe sync subscriber to set correct member.language
350
+ mailchimp_member_data_update($email, $this->user_language, 'order', $status_if_new, $order, $this->gdpr_fields, !$this->is_full_sync);
351
 
352
  mailchimp_log('order_submit.success', $log);
353
 
includes/processes/class-mailchimp-woocommerce-subscriber-sync.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class MailChimp_WooCommerce_Subscriber_Sync
5
+ */
6
+ class MailChimp_WooCommerce_Subscriber_Sync extends Mailchimp_Woocommerce_Job
7
+ {
8
+ public $data = [];
9
+
10
+ /**
11
+ * SubscriberSync constructor.
12
+ * Pass in the raw data from the webhook from Mailchimp
13
+ * @param $data
14
+ */
15
+ public function __construct($data)
16
+ {
17
+ $this->data = (array) $data;
18
+ }
19
+
20
+ /**
21
+ * @return bool|null
22
+ */
23
+ public function handle()
24
+ {
25
+ try {
26
+ // if the store is not properly connected to Mailchimp - we need to skip this.
27
+ if (!mailchimp_is_configured()) return null;
28
+ // grab the hook type, and the new data
29
+ list($hook_type, $data, $failed) = $this->parseInputData();
30
+ // extract the service ids from the data we get
31
+ list ($service_id, $email) = $this->extractServiceIDs($data);
32
+ // ignore the empty submissions or certain events or emails
33
+ if ($this->hasInvalidEvent($hook_type, $failed, $data) || $this->shouldIgnoreEmail($email)) {
34
+ return false;
35
+ }
36
+ // if hook type is 'subscribe' that means we need ot subscribe them
37
+ $subscribe = $hook_type === 'subscribe';
38
+ // if we don't have a user by email
39
+ if (!($user = get_user_by('email', $email))) {
40
+ // if the user is not found and we should create new customers
41
+ return ($subscribe && $this->shouldCreateNewCustomers()) ?
42
+ $this->createNewCustomer($email) :
43
+ false;
44
+ }
45
+ try {
46
+ $handled_key = "subscriber_sync.{$service_id}.handled";
47
+ // see if we've saved a service call in the last 30 minutes.
48
+ $handled = mailchimp_get_transient($handled_key, null);
49
+ // if we've got the subscriber sync id and it's the same as the previous submission, just skip out now.
50
+ if ($handled === $subscribe) return true;
51
+ // if they unsubscribed, we need to put a cache on this because it's causing issues in the
52
+ // shopify webhooks for some reason being re-subscribed.
53
+ if (!$subscribe) {
54
+ // update the cached status just in case this is causing trouble with the webhook.
55
+ $hashed = md5(trim(strtolower($email)));
56
+ // tell the webhooks that we've just synced this customer with a certain status.
57
+ mailchimp_set_transient("{$hashed}.subscriber_sync", array('time' => time(), 'status' => $subscribe), 90);
58
+ }
59
+ // update the user meta to show the proper value.
60
+ update_user_meta($user->ID, 'mailchimp_woocommerce_is_subscribed', $subscribe);
61
+ // cache it for 90 seconds to be used above.
62
+ mailchimp_set_transient($handled_key, $subscribe, 90);
63
+ mailchimp_log('webhook', "Subscriber Sync :: {$hook_type} :: {$email}");
64
+ } catch (\Exception $e) {
65
+ $error = $e->getMessage();
66
+ mailchimp_error('webhook', "Updating Subscriber Status :: MC service ID {$service_id} :: {$hook_type} :: {$error}");
67
+ return false;
68
+ }
69
+ } catch (\Throwable $e) {
70
+ mailchimp_error('webhook', $e->getMessage(), array('data' => $data ? json_encode($data) : null));
71
+ }
72
+ return false;
73
+ }
74
+
75
+ /**
76
+ * @param $data
77
+ * @return array
78
+ */
79
+ private function extractServiceIDs($data)
80
+ {
81
+ if (is_object($data)) {
82
+ $service_id = isset($data->web_id) ? $data->web_id : isset($data->id) ? $data->id : null;
83
+ $email = isset($data->email) ? $data->email : null;
84
+ return array($service_id, $email);
85
+ } else {
86
+ $service_id = isset($data['web_id']) ? $data['web_id'] : false;
87
+ if (!$service_id) {
88
+ $service_id = isset($data['id']) ? $data['id'] : false;
89
+ }
90
+ $email = isset($data['email']) ? $data['email'] : false;
91
+ return array($service_id, $email);
92
+ }
93
+ }
94
+
95
+ /**
96
+ * @return array
97
+ */
98
+ private function parseInputData()
99
+ {
100
+ $hook_type = isset($this->data['type']) ? $this->data['type'] : 'certainly_not';
101
+ $data = isset($this->data['data']) ? $this->data['data'] : [];
102
+ $failed = false;
103
+ $allowed_hooks = array('subscribe' => true, 'unsubscribe' => true,);
104
+ if (!is_string($hook_type) || !isset($allowed_hooks[$hook_type])) {
105
+ $failed = true;
106
+ }
107
+ return array($hook_type, $data, $failed);
108
+ }
109
+
110
+ /**
111
+ * @param $email
112
+ * @return \WP_User
113
+ * @throws MailChimp_WooCommerce_Error
114
+ * @throws MailChimp_WooCommerce_ServerError
115
+ */
116
+ private function createNewCustomer($email)
117
+ {
118
+ $member = mailchimp_get_api()->member(mailchimp_get_list_id(), $email);
119
+ $first_name = !empty($member['merge_fields']['FNAME']) ? $member['merge_fields']['FNAME'] : 'Guest';
120
+ $last_name = !empty($member['merge_fields']['LNAME']) ? $member['merge_fields']['LNAME'] : 'Customer';
121
+ if (empty($first_name)) $first_name = null;
122
+ if (empty($last_name)) $last_name = null;
123
+ // TODO maybe use the registration method and keep a record for when the user is verified later
124
+ $user = wp_create_user(strtolower($email), wp_generate_password(), strtolower($email));
125
+ // subscribe them because this function only runs for subscribers.
126
+ update_user_meta($user->ID, 'mailchimp_woocommerce_is_subscribed', true);
127
+ // if we have a first and last name from the MC account, just use that.
128
+ if ($first_name && $last_name) {
129
+ wp_update_user(array(
130
+ 'ID' => $user->ID,
131
+ 'first_name' => $first_name,
132
+ 'last_name' => $last_name
133
+ ));
134
+ }
135
+ mailchimp_log('webhook', "CREATED CUSTOMER :: {$email} :: {$first_name} {$last_name}");
136
+ return $user;
137
+ }
138
+
139
+ /**
140
+ * @return false
141
+ */
142
+ private function shouldCreateNewCustomers()
143
+ {
144
+ // maybe we add a setting for this in the UI and use this here.
145
+ return false;
146
+ }
147
+
148
+ /**
149
+ * @param $email
150
+ * @return bool
151
+ */
152
+ private function shouldIgnoreEmail($email)
153
+ {
154
+ return mailchimp_string_contains($email, array(
155
+ 'forgotten.mailchimp.com'
156
+ ));
157
+ }
158
+
159
+ /**
160
+ * @param string $error
161
+ * @return bool
162
+ */
163
+ private function isUnprocessableEntityError(string $error): bool
164
+ {
165
+ return mailchimp_string_contains($error, 'Unprocessable Entity');
166
+ }
167
+
168
+ /**
169
+ * @param $hook_type
170
+ * @param $failed
171
+ * @param $data
172
+ * @return bool
173
+ */
174
+ private function hasInvalidEvent($hook_type, $failed, $data)
175
+ {
176
+ if (empty($hook_type) || empty($data)) {
177
+ return true;
178
+ }
179
+ // if the flag is failed, or deleted, don't do anything.
180
+ if ($failed || $hook_type === 'deleted' || $hook_type === 'delete') {
181
+ return true;
182
+ }
183
+ return false;
184
+ }
185
+ }
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: Connects WooCommerce to Mailchimp to sync your store data, send targeted campaigns to your customers, and sell more stuff.
19
- * Version: 2.6.1
20
  * Author: Mailchimp
21
  * Author URI: https://mailchimp.com
22
  * License: GPL-2.0+
@@ -24,9 +24,9 @@
24
  * Text Domain: mailchimp-for-woocommerce
25
  * Domain Path: /languages
26
  * Requires at least: 4.9
27
- * Tested up to: 5.7
28
  * WC requires at least: 3.5
29
- * WC tested up to: 6.2
30
  */
31
 
32
  // If this file is called directly, abort.
@@ -36,7 +36,9 @@ if (!defined( 'WPINC')) {
36
 
37
  if (!isset($mailchimp_woocommerce_spl_autoloader) || $mailchimp_woocommerce_spl_autoloader === false) {
38
  // require Action Scheduler
39
- include_once "includes/vendor/action-scheduler/action-scheduler.php";
 
 
40
  // bootstrapper
41
  include_once "bootstrap.php";
42
  }
16
  * Plugin Name: Mailchimp for WooCommerce
17
  * Plugin URI: https://mailchimp.com/connect-your-store/
18
  * Description: Connects WooCommerce to Mailchimp to sync your store data, send targeted campaigns to your customers, and sell more stuff.
19
+ * Version: 2.6.2
20
  * Author: Mailchimp
21
  * Author URI: https://mailchimp.com
22
  * License: GPL-2.0+
24
  * Text Domain: mailchimp-for-woocommerce
25
  * Domain Path: /languages
26
  * Requires at least: 4.9
27
+ * Tested up to: 5.9
28
  * WC requires at least: 3.5
29
+ * WC tested up to: 6.3
30
  */
31
 
32
  // If this file is called directly, abort.
36
 
37
  if (!isset($mailchimp_woocommerce_spl_autoloader) || $mailchimp_woocommerce_spl_autoloader === false) {
38
  // require Action Scheduler
39
+ if( file_exists( "includes/vendor/action-scheduler/action-scheduler.php") ){
40
+ include_once "includes/vendor/action-scheduler/action-scheduler.php";
41
+ }
42
  // bootstrapper
43
  include_once "bootstrap.php";
44
  }
public/class-mailchimp-woocommerce-public.php CHANGED
@@ -59,7 +59,7 @@ class MailChimp_WooCommerce_Public {
59
  * @since 1.0.0
60
  */
61
  public function enqueue_scripts() {
62
- wp_register_script($this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/mailchimp-woocommerce-public.min.js', array(), $this->version, false);
63
  wp_localize_script($this->plugin_name, 'mailchimp_public_data', array(
64
  'site_url' => site_url(),
65
  'ajax_url' => admin_url('admin-ajax.php'),
59
  * @since 1.0.0
60
  */
61
  public function enqueue_scripts() {
62
+ wp_register_script($this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/mailchimp-woocommerce-public.min.js', array(), $this->version.'.01', false);
63
  wp_localize_script($this->plugin_name, 'mailchimp_public_data', array(
64
  'site_url' => site_url(),
65
  'ajax_url' => admin_url('admin-ajax.php'),
public/js/mailchimp-woocommerce-public.min.js CHANGED
@@ -1,231 +1 @@
1
- var mailchimp,
2
- mailchimp_cart,
3
- mailchimp_billing_email,
4
- mailchimp_username_email,
5
- mailchimp_registration_email,
6
- mailchimp_submitted_email = false,
7
- mailchimpReady = function (a) { /in/.test(document.readyState) ? setTimeout("mailchimpReady(" + a + ")", 9) : a(); };
8
-
9
- function mailchimpGetCurrentUserByHash(a) {
10
- try {
11
- if (!mailchimp_public_data.allowed_to_set_cookies) return;
12
- var b = mailchimp_public_data.ajax_url + "?action=mailchimp_get_user_by_hash&hash=" + a, c = new XMLHttpRequest;
13
- c.open("POST", b, !0), c.onload = function () {
14
- if (c.status >= 200 && c.status < 400) {
15
- var a = JSON.parse(c.responseText);
16
- if (!a) return;
17
- mailchimp_cart.valueEmail(a.email) && mailchimp_cart.setEmail(a.email);
18
- }
19
- };
20
- c.onerror = function () {
21
- console.log("mailchimp.get_email_by_hash.request.error", c.responseText)
22
- };
23
- c.setRequestHeader("Content-Type", "application/json");
24
- c.setRequestHeader("Accept", "application/json");
25
- c.send();
26
- } catch (a) {
27
- console.log("mailchimp.get_email_by_hash.error", a)
28
- }
29
- }
30
- function mailchimpHandleBillingEmail(selector) {
31
- try {
32
- if (!mailchimp_public_data.allowed_to_set_cookies) return;
33
- if (mailchimp_public_data.disable_carts) return;
34
- var subscribed = document.querySelector('#mailchimp_woocommerce_newsletter');
35
- if (!selector) selector = "#billing_email";
36
- var a = document.querySelector(selector);
37
- var b = void 0 !== a ? a.value : "";
38
- if (!mailchimp_cart.valueEmail(b) || mailchimp_submitted_email === b) { return false; }
39
- mailchimp_cart.setEmail(b);
40
- var c = mailchimp_public_data.ajax_url + "?action=mailchimp_set_user_by_email&email=" + b + "&mc_language=" + mailchimp_public_data.language + "&subscribed=" + (subscribed && subscribed.checked ? '1' : '0');
41
- var d = new XMLHttpRequest;
42
- d.open("POST", c, !0);
43
- d.onload = function () {
44
- var successful = d.status >= 200 && d.status < 400;
45
- var msg = successful ? "mailchimp.handle_billing_email.request.success" : "mailchimp.handle_billing_email.request.error";
46
- if (successful) {
47
- mailchimp_submitted_email = b;
48
- }
49
- console.log(msg, d.responseText);
50
- };
51
- d.onerror = function () {
52
- console.log("mailchimp.handle_billing_email.request.error", d.responseText)
53
- };
54
- d.setRequestHeader("Content-Type", "application/json");
55
- d.setRequestHeader("Accept", "application/json");
56
- d.send();
57
- return true;
58
- } catch (a) {
59
- console.log("mailchimp.handle_billing_email.error", a); mailchimp_submitted_email = !1
60
- }
61
- }
62
-
63
- !function () {
64
- "use strict";
65
-
66
- function mailchimpCart() {
67
-
68
- this.email_types = "input[type=email]";
69
- this.regex_email = /^([A-Za-z0-9_+\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
70
- this.current_email = null;
71
- this.previous_email = null;
72
- this.expireUser = function () {
73
- this.current_email = null;
74
- if (!mailchimp_public_data.allowed_to_set_cookies) return;
75
- mailchimp.storage.expire("mailchimp.cart.current_email");
76
- };
77
- this.expireSaved = function () {
78
- if (!mailchimp_public_data.allowed_to_set_cookies) return;
79
- mailchimp.storage.expire("mailchimp.cart.items");
80
- };
81
- this.setEmail = function (a) {
82
- if (!mailchimp_public_data.allowed_to_set_cookies) return;
83
- if (!this.valueEmail(a)) return false;
84
- this.setPreviousEmail(this.getEmail());
85
- mailchimp.storage.set("mailchimp.cart.current_email", this.current_email = a);
86
- };
87
- this.getEmail = function () {
88
- if (!mailchimp_public_data.allowed_to_set_cookies) return;
89
- if (this.current_email) return this.current_email;
90
- var a = mailchimp.storage.get("mailchimp.cart.current_email", !1);
91
- if (!a || !this.valueEmail(a)) return false;
92
- return this.current_email = a;
93
- };
94
- this.setPreviousEmail = function (a) {
95
- if (!mailchimp_public_data.allowed_to_set_cookies) return;
96
- if (!this.valueEmail(a)) return false;
97
- mailchimp.storage.set("mailchimp.cart.previous_email", this.previous_email = a);
98
- };
99
- this.valueEmail = function (a) {
100
- return this.regex_email.test(a);
101
- };
102
- return this;
103
- }
104
-
105
- var g = {
106
- extend: function (a, b) {
107
- for (var c in b || {})b.hasOwnProperty(c) && (a[c] = b[c]);
108
- return a
109
- }, getQueryStringVars: function () {
110
- var a = window.location.search || "", b = [], c = {};
111
- if (a = a.substr(1), a.length) {
112
- b = a.split("&");
113
- for (var d in b) {
114
- var e = b[d];
115
- if ("string" == typeof e) {
116
- var f = e.split("="), g = f[0], h = f[1];
117
- g.length && ("undefined" == typeof c[g] && (c[g] = []), c[g].push(h))
118
- }
119
- }
120
- }
121
- return c
122
- }, unEscape: function (a) {
123
- return decodeURIComponent(a)
124
- }, escape: function (a) {
125
- return encodeURIComponent(a)
126
- }, createDate: function (a, b) {
127
- a || (a = 0);
128
- var c = new Date, d = b ? c.getDate() - a : c.getDate() + a;
129
- return c.setDate(d), c
130
- }, arrayUnique: function (a) {
131
- for (var b = a.concat(), c = 0; c < b.length; ++c)for (var d = c + 1; d < b.length; ++d)b[c] === b[d] && b.splice(d, 1);
132
- return b
133
- }, objectCombineUnique: function (a) {
134
- for (var b = a[0], c = 1; c < a.length; c++) {
135
- var d = a[c];
136
- for (var e in d)b[e] = d[e]
137
- }
138
- return b
139
- }
140
- }, h = function (a, b) {
141
- var c = function (a, b, d) {
142
- return 1 === arguments.length ? c.get(a) : c.set(a, b, d)
143
- };
144
- return c.get = function (b, d) {
145
- return a.cookie !== c._cacheString && c._populateCache(), void 0 == c._cache[b] ? d : c._cache[b]
146
- }, c.defaults = {path: "/", secure: true, samesite: 'strict'}, c.set = function (d, e, f) {
147
- switch (f = {
148
- path: f && f.path || c.defaults.path,
149
- domain: f && f.domain || c.defaults.domain,
150
- expires: f && f.expires || c.defaults.expires,
151
- secure: f && f.secure !== b ? f.secure : c.defaults.secure,
152
- samesite: f && f.samesite || c.defaults.samesite,
153
- }, e === b && (f.expires = -1), typeof f.expires) {
154
- case"number":
155
- f.expires = new Date((new Date).getTime() + 1e3 * f.expires);
156
- break;
157
- case"string":
158
- f.expires = new Date(f.expires)
159
- }
160
- return d = encodeURIComponent(d) + "=" + (e + "").replace(/[^!#-+\--:<-\[\]-~]/g, encodeURIComponent), d += f.path ? ";path=" + f.path : "", d += f.domain ? ";domain=" + f.domain : "", d += f.expires ? ";expires=" + f.expires.toGMTString() : "", d += f.secure ? ";secure" : "", d += f.samesite ? (";samesite="+f.samesite) : '', a.cookie = d, c
161
- }, c.expire = function (a, d) {
162
- return c.set(a, b, d)
163
- }, c._populateCache = function () {
164
- c._cache = {};
165
- try {
166
- c._cacheString = a.cookie;
167
- for (var d = c._cacheString.split("; "), e = 0; e < d.length; e++) {
168
- var f = d[e].indexOf("="), g = decodeURIComponent(d[e].substr(0, f)), f = decodeURIComponent(d[e].substr(f + 1));
169
- c._cache[g] === b && (c._cache[g] = f)
170
- }
171
- } catch (a) {
172
- console.log(a)
173
- }
174
- }, c.enabled = function () {
175
- var a = "1" === c.set("cookies.js", "1").get("cookies.js");
176
- return c.expire("cookies.js"), a;
177
- }(), c
178
- }(document);
179
-
180
- mailchimp = {storage: h, utils: g};
181
- mailchimp_cart = new mailchimpCart;
182
- }();
183
-
184
- mailchimpReady(function () {
185
-
186
- // if they've told us we can't do this - we have to honor it.
187
- if (!mailchimp_public_data.allowed_to_set_cookies) return;
188
-
189
- // if we're not using carts - don't bother setting any of this.
190
- if (mailchimp_public_data.disable_carts) return;
191
-
192
- if (void 0 === a) {
193
- var a = { site_url: document.location.origin, defaulted: !0, ajax_url: document.location.origin + "/wp-admin?admin-ajax.php" };
194
- }
195
-
196
- try {
197
- var b = mailchimp.utils.getQueryStringVars();
198
- void 0 !== b.mc_cart_id && mailchimpGetCurrentUserByHash(b.mc_cart_id);
199
-
200
- var subscribed = document.querySelector('#mailchimp_woocommerce_newsletter');
201
-
202
- if (subscribed) {
203
- subscribed.onchange = function() {
204
- mailchimp_submitted_email = null;
205
- mailchimpHandleBillingEmail('#billing_email');
206
- }
207
- }
208
-
209
- mailchimp_username_email = document.querySelector("#username");
210
- mailchimp_billing_email = document.querySelector("#billing_email");
211
- mailchimp_registration_email = document.querySelector("#reg_email");
212
-
213
- if (mailchimp_billing_email) {
214
- mailchimp_billing_email.onblur = function () { mailchimpHandleBillingEmail('#billing_email'); };
215
- mailchimp_billing_email.onfocus = function () { mailchimpHandleBillingEmail('#billing_email'); }
216
- }
217
-
218
- if (mailchimp_username_email) {
219
- mailchimp_username_email.onblur = function () { mailchimpHandleBillingEmail('#username'); };
220
- mailchimp_username_email.onfocus = function () { mailchimpHandleBillingEmail('#username'); }
221
- }
222
-
223
- if (mailchimp_registration_email) {
224
- mailchimp_registration_email.onblur = function () { mailchimpHandleBillingEmail('#reg_email'); };
225
- mailchimp_registration_email.onfocus = function () { mailchimpHandleBillingEmail('#reg_email'); }
226
- }
227
-
228
- } catch (e) {
229
- console.log('mailchimp ready error', e);
230
- }
231
- });
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 mailchimpGetCurrentUserByHash(e){try{if(!mailchimp_public_data.allowed_to_set_cookies)return;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);if(!e)return;mailchimp_cart.valueEmail(e.email)&&mailchimp_cart.setEmail(e.email)}},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){try{if(!mailchimp_public_data.allowed_to_set_cookies)return;if(mailchimp_public_data.disable_carts)return;var i=document.querySelector("#mailchimp_woocommerce_newsletter");e||(e="#billing_email");var a=document.querySelector(e),t=void 0!==a?a.value:"";if(!mailchimp_cart.valueEmail(t)||mailchimp_submitted_email===t)return!1;mailchimp_cart.setEmail(t);var l=mailchimp_public_data.ajax_url+"?action=mailchimp_set_user_by_email&email="+t+"&mc_language="+mailchimp_public_data.language+"&subscribed="+(i&&i.checked?"1":"0"),m=new XMLHttpRequest;return m.open("POST",l,!0),m.onload=function(){var e=m.status>=200&&m.status<400,i=e?"mailchimp.handle_billing_email.request.success":"mailchimp.handle_billing_email.request.error";e&&(mailchimp_submitted_email=t),console.log(i,m.responseText)},m.onerror=function(){console.log("mailchimp.handle_billing_email.request.error",m.responseText)},m.setRequestHeader("Content-Type","application/json"),m.setRequestHeader("Accept","application/json"),m.send(),!0}catch(a){console.log("mailchimp.handle_billing_email.error",a),mailchimp_submitted_email=!1}}!function(){"use strict";var e,i,a,t={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)for(var t in i=e.split("&")){var l=i[t];if("string"==typeof l){var m=l.split("="),n=m[0],r=m[1];n.length&&(void 0===a[n]&&(a[n]=[]),a[n].push(r))}}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 l in t)i[l]=t[l]}return i}},l=(e=document,a=function(e,i,t){return 1===arguments.length?a.get(e):a.set(e,i,t)},a.get=function(i,t){return e.cookie!==a._cacheString&&a._populateCache(),null==a._cache[i]?t:a._cache[i]},a.defaults={path:"/",secure:!0,samesite:"strict"},a.set=function(t,l,m){switch(m={path:m&&m.path||a.defaults.path,domain:m&&m.domain||a.defaults.domain,expires:m&&m.expires||a.defaults.expires,secure:m&&m.secure!==i?m.secure:a.defaults.secure,samesite:m&&m.samesite||a.defaults.samesite},l===i&&(m.expires=-1),typeof m.expires){case"number":m.expires=new Date((new Date).getTime()+1e3*m.expires);break;case"string":m.expires=new Date(m.expires)}return t=encodeURIComponent(t)+"="+(l+"").replace(/[^!#-+\--:<-\[\]-~]/g,encodeURIComponent),t+=m.path?";path="+m.path:"",t+=m.domain?";domain="+m.domain:"",t+=m.expires?";expires="+m.expires.toGMTString():"",t+=m.secure?";secure":"",t+=m.samesite?";samesite="+m.samesite:"",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("; "),l=0;l<t.length;l++){var m=t[l].indexOf("="),n=decodeURIComponent(t[l].substr(0,m));m=decodeURIComponent(t[l].substr(m+1)),a._cache[n]===i&&(a._cache[n]=m)}}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);mailchimp={storage:l,utils:t},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_public_data.allowed_to_set_cookies&&mailchimp.storage.expire("mailchimp.cart.current_email")},this.expireSaved=function(){mailchimp_public_data.allowed_to_set_cookies&&mailchimp.storage.expire("mailchimp.cart.items")},this.setEmail=function(e){if(mailchimp_public_data.allowed_to_set_cookies){if(!this.valueEmail(e))return!1;this.setPreviousEmail(this.getEmail()),mailchimp.storage.set("mailchimp.cart.current_email",this.current_email=e)}},this.getEmail=function(){if(mailchimp_public_data.allowed_to_set_cookies){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)}},this.setPreviousEmail=function(e){if(mailchimp_public_data.allowed_to_set_cookies)return!!this.valueEmail(e)&&void mailchimp.storage.set("mailchimp.cart.previous_email",this.previous_email=e)},this.valueEmail=function(e){return this.regex_email.test(e)},this}}(),mailchimpReady((function(){if(mailchimp_public_data.allowed_to_set_cookies&&!mailchimp_public_data.disable_carts){if(void 0===e)var e={site_url:document.location.origin,defaulted:!0,ajax_url:document.location.origin+"/wp-admin?admin-ajax.php"};try{var i=mailchimp.utils.getQueryStringVars();void 0!==i.mc_cart_id&&mailchimpGetCurrentUserByHash(i.mc_cart_id);var a=document.querySelector("#mailchimp_woocommerce_newsletter");a&&(a.onchange=function(){mailchimp_submitted_email=null,mailchimpHandleBillingEmail("#billing_email")}),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")})}catch(e){console.log("mailchimp ready error",e)}}}));