@automattic/newspack-blocks 2.3.0 → 2.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/composer.lock +13 -13
- package/dist/donateStreamlined.asset.php +1 -1
- package/dist/donateStreamlined.js +1 -1
- package/dist/modalCheckout.asset.php +1 -1
- package/dist/modalCheckout.css +1 -1
- package/dist/modalCheckout.rtl.css +1 -1
- package/includes/class-modal-checkout.php +89 -12
- package/newspack-blocks.php +2 -2
- package/package.json +4 -4
- package/src/modal-checkout/checkout.scss +9 -0
- package/src/modal-checkout/templates/checkout-form.php +3 -3
- package/src/modal-checkout/templates/empty-order-details.php +16 -0
- package/vendor/autoload.php +1 -1
- package/vendor/composer/autoload_real.php +4 -4
- package/vendor/composer/autoload_static.php +2 -2
- package/vendor/composer/installed.php +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [2.4.0-alpha.1](https://github.com/Automattic/newspack-blocks/compare/v2.3.0...v2.4.0-alpha.1) (2023-12-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* modal checkout template markup ([#1608](https://github.com/Automattic/newspack-blocks/issues/1608)) ([4d593db](https://github.com/Automattic/newspack-blocks/commit/4d593db4e80b57570e13db2ed203586bab974fb6))
|
|
7
|
+
* **modal-checkout:** align Stripe's "save payment" checkbox ([#1623](https://github.com/Automattic/newspack-blocks/issues/1623)) ([69e0e42](https://github.com/Automattic/newspack-blocks/commit/69e0e42b3d6f6ab8b1a918346e0d2f8e90eeabcb))
|
|
8
|
+
* **modal-checkout:** prevent initial render of details table ([#1601](https://github.com/Automattic/newspack-blocks/issues/1601)) ([06d4ccd](https://github.com/Automattic/newspack-blocks/commit/06d4ccdc799cb4233a1a85efdbd1264399d85291))
|
|
9
|
+
* replace FILTER_SANITIZE_STRING ([6f805b0](https://github.com/Automattic/newspack-blocks/commit/6f805b0806d24f9e44d293a13ca486fdf23c73ab))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* improve performance of modal checkout ([#1607](https://github.com/Automattic/newspack-blocks/issues/1607)) ([a48d190](https://github.com/Automattic/newspack-blocks/commit/a48d19068cc0fc22d36f6371bdee447f72177ed7))
|
|
15
|
+
* **modal-checkout:** add filter to cart item data ([#1590](https://github.com/Automattic/newspack-blocks/issues/1590)) ([1e83dc1](https://github.com/Automattic/newspack-blocks/commit/1e83dc119aac531db18dbdcc7aaa4c781aa8576e))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Performance Improvements
|
|
19
|
+
|
|
20
|
+
* **modal-checkout:** process checkout request earlier ([#1612](https://github.com/Automattic/newspack-blocks/issues/1612)) ([5c58f5e](https://github.com/Automattic/newspack-blocks/commit/5c58f5e811bb24098afb093c3a4efbb8efa83d4a))
|
|
21
|
+
|
|
1
22
|
# [2.3.0](https://github.com/Automattic/newspack-blocks/compare/v2.2.4...v2.3.0) (2023-12-07)
|
|
2
23
|
|
|
3
24
|
|
package/composer.lock
CHANGED
|
@@ -1284,16 +1284,16 @@
|
|
|
1284
1284
|
},
|
|
1285
1285
|
{
|
|
1286
1286
|
"name": "phpunit/phpunit",
|
|
1287
|
-
"version": "9.6.
|
|
1287
|
+
"version": "9.6.15",
|
|
1288
1288
|
"source": {
|
|
1289
1289
|
"type": "git",
|
|
1290
1290
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
|
1291
|
-
"reference": "
|
|
1291
|
+
"reference": "05017b80304e0eb3f31d90194a563fd53a6021f1"
|
|
1292
1292
|
},
|
|
1293
1293
|
"dist": {
|
|
1294
1294
|
"type": "zip",
|
|
1295
|
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/
|
|
1296
|
-
"reference": "
|
|
1295
|
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1",
|
|
1296
|
+
"reference": "05017b80304e0eb3f31d90194a563fd53a6021f1",
|
|
1297
1297
|
"shasum": ""
|
|
1298
1298
|
},
|
|
1299
1299
|
"require": {
|
|
@@ -1367,7 +1367,7 @@
|
|
|
1367
1367
|
"support": {
|
|
1368
1368
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
|
1369
1369
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
|
1370
|
-
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.
|
|
1370
|
+
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15"
|
|
1371
1371
|
},
|
|
1372
1372
|
"funding": [
|
|
1373
1373
|
{
|
|
@@ -1383,7 +1383,7 @@
|
|
|
1383
1383
|
"type": "tidelift"
|
|
1384
1384
|
}
|
|
1385
1385
|
],
|
|
1386
|
-
"time": "2023-
|
|
1386
|
+
"time": "2023-12-01T16:55:19+00:00"
|
|
1387
1387
|
},
|
|
1388
1388
|
{
|
|
1389
1389
|
"name": "psr/container",
|
|
@@ -3341,16 +3341,16 @@
|
|
|
3341
3341
|
},
|
|
3342
3342
|
{
|
|
3343
3343
|
"name": "theseer/tokenizer",
|
|
3344
|
-
"version": "1.2.
|
|
3344
|
+
"version": "1.2.2",
|
|
3345
3345
|
"source": {
|
|
3346
3346
|
"type": "git",
|
|
3347
3347
|
"url": "https://github.com/theseer/tokenizer.git",
|
|
3348
|
-
"reference": "
|
|
3348
|
+
"reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96"
|
|
3349
3349
|
},
|
|
3350
3350
|
"dist": {
|
|
3351
3351
|
"type": "zip",
|
|
3352
|
-
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/
|
|
3353
|
-
"reference": "
|
|
3352
|
+
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
|
|
3353
|
+
"reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
|
|
3354
3354
|
"shasum": ""
|
|
3355
3355
|
},
|
|
3356
3356
|
"require": {
|
|
@@ -3379,7 +3379,7 @@
|
|
|
3379
3379
|
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
|
|
3380
3380
|
"support": {
|
|
3381
3381
|
"issues": "https://github.com/theseer/tokenizer/issues",
|
|
3382
|
-
"source": "https://github.com/theseer/tokenizer/tree/1.2.
|
|
3382
|
+
"source": "https://github.com/theseer/tokenizer/tree/1.2.2"
|
|
3383
3383
|
},
|
|
3384
3384
|
"funding": [
|
|
3385
3385
|
{
|
|
@@ -3387,7 +3387,7 @@
|
|
|
3387
3387
|
"type": "github"
|
|
3388
3388
|
}
|
|
3389
3389
|
],
|
|
3390
|
-
"time": "
|
|
3390
|
+
"time": "2023-11-20T00:12:19+00:00"
|
|
3391
3391
|
},
|
|
3392
3392
|
{
|
|
3393
3393
|
"name": "wp-coding-standards/wpcs",
|
|
@@ -3526,5 +3526,5 @@
|
|
|
3526
3526
|
"platform-overrides": {
|
|
3527
3527
|
"php": "7.4"
|
|
3528
3528
|
},
|
|
3529
|
-
"plugin-api-version": "2.
|
|
3529
|
+
"plugin-api-version": "2.6.0"
|
|
3530
3530
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<?php return array('dependencies' => array('wp-i18n', 'wp-polyfill'), 'version' => '
|
|
1
|
+
<?php return array('dependencies' => array('wp-i18n', 'wp-polyfill'), 'version' => '48123c750d4b2094421f3b12a9ced4e3');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={7597:(e,t)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var n,o="https://js.stripe.com/v3",a=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",u=null,c=function(e){return null!==u||(u=new Promise((function(t,r){if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(i),window.Stripe)t(window.Stripe);else try{var n=function(){for(var e=document.querySelectorAll('script[src^="'.concat(o,'"]')),t=0;t<e.length;t++){var r=e[t];if(a.test(r.src))return r}return null}();n&&e?console.warn(i):n||(n=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(o).concat(t);var n=document.head||document.body;if(!n)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r}(e)),n.addEventListener("load",(function(){window.Stripe?t(window.Stripe):r(new Error("Stripe.js not available"))})),n.addEventListener("error",(function(){r(new Error("Failed to load Stripe.js"))}))}catch(u){return void r(u)}else t(null)}))),u},s=function(e,t,r){if(null===e)return null;var n=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"2.1.11",startTime:t})}(n,r),n},l=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==r(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)},f=!1,p=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];f=!0;var o=Date.now();return c(n).then((function(e){return s(e,t,o)}))};p.setLoadParameters=function(e){if(f&&n){var t=l(e);if(Object.keys(t).reduce((function(t,r){var o;return t&&e[r]===(null===(o=n)||void 0===o?void 0:o[r])}),!0))return}if(f)throw new Error("You cannot change load parameters after calling loadStripe");n=l(e)},t.loadStripe=p},7894:(e,t,r)=>{e.exports=r(7597)},5666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(R){s=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof h?t:h,i=Object.create(a.prototype),u=new P(n||[]);return o(i,"_invoke",{value:E(e,r,u)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(R){return{type:"throw",arg:R}}}e.wrap=l;var p="suspendedStart",d="executing",m="completed",y={};function h(){}function v(){}function b(){}var w={};s(w,i,(function(){return this}));var g=Object.getPrototypeOf,x=g&&g(g(q([])));x&&x!==r&&n.call(x,i)&&(w=x);var _=b.prototype=h.prototype=Object.create(w);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(o,a,i,u){var c=f(e[o],e,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,u)}),(function(e){r("throw",e,i,u)})):t.resolve(l).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function E(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=j(u,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:"suspendedYield",s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function q(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return v.prototype=b,o(_,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:v,configurable:!0}),v.displayName=s(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,c,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},k(S.prototype),s(S.prototype,u,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new S(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(_),s(_,c,"Generator"),s(_,i,(function(){return this})),s(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=q,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:q(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(r){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function a(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(s){return void r(s)}u.done?t(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){a(i,n,o,u,c,"next",e)}function c(e){a(i,n,o,u,c,"throw",e)}u(void 0)}))}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function s(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}r.r(n),r.d(n,{processStreamlinedElements:()=>S});const l=window.wp.i18n;var f=r(7894);r(5666);function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],_n=!0,i=!1;try{for(r=r.call(e);!(_n=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);_n=!0);}catch(u){i=!0,o=u}finally{try{_n||null==r.return||r.return()}finally{if(i)throw o}}return a}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var __=l.__,d=function(e,t){var r,n={};r=e.email,/\S+@\S+/.test(r)||(n.email=__("Email address is invalid.","newspack-blocks"));var o=t.minimumDonation;return o&&parseFloat(e.amount)<o&&(n.amount=(0,l.sprintf)(__("Amount must be at least %d.","newspack-blocks"),o)),0===e.full_name.length&&(n.amount=__("Full name should be provided.","newspack-blocks")),n},m=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"error";t.innerHTML="",e.forEach((function(e){if(e){var n=document.createElement("div");n.classList.add("type-".concat(r)),n.innerHTML=e,t.appendChild(n)}})),"success"===r&&t.parentElement&&t.parentElement.replaceWith(t)},y=function(e){var t=e.closest("[data-streamlined-config]"),r=null==t?void 0:t.getAttribute("data-streamlined-config");if(!r)return{};var n=p(JSON.parse(r),12),o=n[0],a=n[1],i=n[2],u=n[3],c=n[4],s=n[5],l=n[6],f=n[7],d=n[8],m=n[9],y=n[10],h=n[11];return{currency:o.toLowerCase(),currencySymbol:a,siteName:i,isCurrencyZeroDecimal:u,countryCode:c,frequencies:s,feeMultiplier:parseFloat(l),feeStatic:parseFloat(f),stripePublishableKey:d,paymentRequestType:m,captchaSiteKey:y,minimumDonation:parseFloat(h)}},h=function(e){var t=Object.fromEntries(new FormData(e)),r="donation_value_".concat(t.donation_frequency);return t.amount=t[r],"other"===t.amount&&(t.amount=t["".concat(r,"_other")]),t.amount||(t.amount=t["".concat(r,"_untiered")]),t.cid&&"string"==typeof t.cid&&0===t.cid.indexOf("CLIENT_ID")&&(t.cid=document.cookie.split("; ").reduce((function(e,t){var r=t.split("=");return e[r[0]]=r[1],e}),{})["newspack-cid"]),t},v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{convertToSubunit:!1},r=t.convertToSubunit,n=y(e),o=h(e),a=o.amount,i=void 0===a?"0":a,u=o.agree_to_pay_fees,c=function(e){return r?e*(n.isCurrencyZeroDecimal?1:100):e},s=0;return u&&(s=c(w(e)||0)),c(parseFloat(i))+s},b=function(e){var t=y(e),r=h(e).donation_frequency,n=t.frequencies[r];return{label:"".concat(t.siteName," (").concat(n,")"),amount:v(e,{convertToSubunit:!0})}},w=function(e){var t=y(e),r=t.feeMultiplier,n=t.feeStatic;if(void 0===r||void 0===n||isNaN(r)||isNaN(n))return 0;var o=h(e).amount;return function(e,t,r){return parseFloat(((e+r)/(100-t)*100-e).toFixed(2))}(parseFloat(o),r,n)},g=function(){var e=i(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:"POST",e.abrupt("return",fetch("/wp-json/newspack-blocks/v1".concat(t),{method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}).then(function(){var e=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.json();case 2:if(r=e.sent,!t.ok){e.next=5;break}return e.abrupt("return",r);case 5:return e.abrupt("return",{error:r});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),x=function(e,t){var r=(0,l.sprintf)(__("Your payment has been processed. Thank you for your contribution! You will receive a confirmation email at %s.","newspack-blocks"),e);m([r],t,"success")},_=l.__,k=function(e){return s(e.querySelectorAll("input[data-is-additional-field]")).map((function(e){return{name:e.name,value:e.value}}))},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return s(e.querySelectorAll(".stripe-payment")).forEach(function(){var e=i(regeneratorRuntime.mark((function e(t){var r,n,a,u,c,s,l,p,S,E,j,O,L,P,q,R,T,F;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=!1,s=t.closest("form"),l=t.querySelector(".stripe-payment__messages"),s&&l){e.next=5;break}return e.abrupt("return");case 5:p=t.closest(".wpbnbd"),S="newspackPaymentFlowComplete-".concat((null==p?void 0:p.id)||""),E=y(s),j=function(){return t.classList.add("stripe-payment--disabled")},(O=function(){return t.classList.remove("stripe-payment--disabled")})(),L=function(){if(!c){var e=t.querySelector(".stripe-payment__inputs.stripe-payment--hidden");e&&(e.classList.remove("stripe-payment--hidden"),c=!0)}},P=function(){var e=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){var n=window.grecaptcha;if(!n)return e("");null!=n&&n.ready&&t||r(_("Error loading the reCaptcha library.","newspack-blocks")),n.ready(i(regeneratorRuntime.mark((function o(){var a;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,n.execute(t,{action:"submit"});case 3:return a=o.sent,o.abrupt("return",e(a));case 7:o.prev=7,o.t0=o.catch(0),r(o.t0);case 10:case"end":return o.stop()}}),o,null,[[0,7]])}))))})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),q=function(){var e=i(regeneratorRuntime.mark((function e(t){var n,a,i,u,c,f,p,d,y,b,w,j,L,q,R,T=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=T.length>1&&void 0!==T[1]?T[1]:void 0,u=T.length>2&&void 0!==T[2]?T[2]:{},r){e.next=4;break}return e.abrupt("return");case 4:if(!(c=null==E?void 0:E.captchaSiteKey)){e.next=17;break}return e.prev=6,e.next=9,P(c);case 9:f=e.sent,e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(6),p=e.t0 instanceof Error?e.t0.message:_("Error processing captcha request.","newspack-blocks"),m([p],l),e.abrupt("return",{error:!0});case 17:return d=h(s),y=k(s),b=o({captchaToken:f,stripe_tokenization_method:i?null===(n=i.card)||void 0===n?void 0:n.tokenization_method:"card",stripe_source_id:t.id,amount:v(s),email:d.email,full_name:d.full_name,frequency:d.donation_frequency,newsletter_opt_in:Boolean(d.newsletter_opt_in),newspack_popup_id:d.newspack_popup_id,_wp_http_referer:d._wp_http_referer,clientId:d.cid,additional_fields:y},u),e.next=22,g("/donate",b);case 22:if(w=e.sent,200===(null===(a=w.data)||void 0===a?void 0:a.status)||!w.message){e.next=26;break}return m([w.message],l),e.abrupt("return",{error:!0});case 26:if(!w.error){e.next=29;break}return m([w.error],l),e.abrupt("return",{error:!0});case 29:if(j=function(e){return m([e],l),O(),window.dispatchEvent(new Event(S)),{error:!0}},!w.client_secret){e.next=53;break}return e.next=33,r.confirmCardPayment(w.client_secret);case 33:if(!(L=e.sent).error){e.next=38;break}return e.abrupt("return",j(L.error.message));case 38:if("succeeded"!==L.paymentIntent.status){e.next=42;break}x(b.email,l),e.next=53;break;case 42:if("requires_action"!==L.paymentIntent.status){e.next=52;break}return e.next=45,r.confirmCardPayment(w.client_secret);case 45:if(q=e.sent,!(R=q.error)){e.next=49;break}return e.abrupt("return",j(R.message));case 49:x(b.email,l),e.next=53;break;case 52:return e.abrupt("return",j(_("Something went wrong with the payment. Please try again later.","newspack-blocks")));case 53:return"success"===w.status&&x(b.email,l),window.dispatchEvent(new Event(S)),e.abrupt("return",{});case 56:case"end":return e.stop()}}),e,null,[[6,12]])})));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=i(regeneratorRuntime.mark((function e(){var o,c,l,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,f.loadStripe)(E.stripePublishableKey);case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return");case 5:if(o=t.querySelector(".stripe-payment__card")){e.next=8;break}return e.abrupt("return");case 8:return c=r.elements(),(n=c.create("card")).mount(o),a=r.paymentRequest({country:E.countryCode,currency:E.currency,total:b(s),requestPayerName:!0,requestPayerEmail:!0}),e.next=14,a.canMakePayment();case 14:if(!e.sent){e.next=28;break}if(a.on("source",function(){var e=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,q(t.source,u,{email:t.payerEmail,full_name:t.payerName});case 2:r=e.sent,t.complete(null!=r&&r.error?"fail":"success");case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),a.on("token",function(){var e=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=t.token;case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),s.addEventListener("change",(function(){a.update({total:b(s)})})),l=c.create("paymentRequestButton",{paymentRequest:a,style:{paymentRequestButton:{type:E.paymentRequestType,height:"46px"}}}),p=t.querySelector(".stripe-payment__request-button")){e.next=23;break}return e.abrupt("return");case 23:l.mount(p),p.classList.remove("stripe-payment--hidden"),setTimeout((function(){p.classList.remove("stripe-payment__request-button--invisible")}),0),e.next=29;break;case 28:L();case 29:t.classList.remove("stripe-payment--invisible");case 30:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),new IntersectionObserver((function(e){e[0].isIntersecting&&R()})).observe(t),(T=t.querySelector('button[type="submit"]'))&&(T.onclick=function(e){c||(e.preventDefault(),L())}),(F=function(){var e=t.querySelector("#stripe-fees-amount");if(e){var r=Object.fromEntries(new FormData(s)),n=w(s);if(0===n){var o=t.querySelector("#stripe-fees-amount-container");o&&(o.style.display="none")}"string"==typeof r.donation_frequency&&(e.innerHTML="(".concat(E.currencySymbol).concat(n.toFixed(2)," ").concat(E.frequencies[r.donation_frequency].toLowerCase(),")"))}})(),s.addEventListener("change",F),s.addEventListener("submit",function(){var e=i(regeneratorRuntime.mark((function e(t){var o,a,i,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return");case 2:if(t.preventDefault(),j(),m([_("Processing payment…","newspack-blocks")],l,"info"),a=h(s),!((i=Object.values(d(a,E))).length>0)){e.next=11;break}return m(i,l),O(),e.abrupt("return");case 11:return u=function(e){e.message&&i.push(e.message),m(i,l),O()},e.next=14,r.createSource(n,{type:"card",owner:{name:a.full_name,email:a.email}});case 14:if(!(c=e.sent).error){e.next=18;break}return u(c.error),e.abrupt("return");case 18:return e.next=20,q(c.source);case 20:null!==(o=window.newspackReaderActivation)&&void 0!==o&&o.refreshAuthentication&&window.newspackReaderActivation.refreshAuthentication();case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 23:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}())};S()})();var o=window;for(var a in n)o[a]=n[a];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
1
|
+
(()=>{var e={7597:(e,t)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var n,o="https://js.stripe.com/v3",a=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",u=null,c=function(e){return null!==u||(u=new Promise((function(t,r){if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(i),window.Stripe)t(window.Stripe);else try{var n=function(){for(var e=document.querySelectorAll('script[src^="'.concat(o,'"]')),t=0;t<e.length;t++){var r=e[t];if(a.test(r.src))return r}return null}();n&&e?console.warn(i):n||(n=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(o).concat(t);var n=document.head||document.body;if(!n)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r}(e)),n.addEventListener("load",(function(){window.Stripe?t(window.Stripe):r(new Error("Stripe.js not available"))})),n.addEventListener("error",(function(){r(new Error("Failed to load Stripe.js"))}))}catch(u){return void r(u)}else t(null)}))),u},s=function(e,t,r){if(null===e)return null;var n=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"2.2.0",startTime:t})}(n,r),n},l=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==r(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)},f=!1,p=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];f=!0;var o=Date.now();return c(n).then((function(e){return s(e,t,o)}))};p.setLoadParameters=function(e){if(f&&n){var t=l(e);if(Object.keys(t).reduce((function(t,r){var o;return t&&e[r]===(null===(o=n)||void 0===o?void 0:o[r])}),!0))return}if(f)throw new Error("You cannot change load parameters after calling loadStripe");n=l(e)},t.loadStripe=p},7894:(e,t,r)=>{e.exports=r(7597)},5666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(R){s=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof h?t:h,i=Object.create(a.prototype),u=new P(n||[]);return o(i,"_invoke",{value:E(e,r,u)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(R){return{type:"throw",arg:R}}}e.wrap=l;var p="suspendedStart",d="executing",m="completed",y={};function h(){}function v(){}function b(){}var w={};s(w,i,(function(){return this}));var g=Object.getPrototypeOf,x=g&&g(g(q([])));x&&x!==r&&n.call(x,i)&&(w=x);var _=b.prototype=h.prototype=Object.create(w);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(o,a,i,u){var c=f(e[o],e,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,u)}),(function(e){r("throw",e,i,u)})):t.resolve(l).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function E(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=j(u,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?m:"suspendedYield",s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function q(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return v.prototype=b,o(_,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:v,configurable:!0}),v.displayName=s(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,c,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},k(S.prototype),s(S.prototype,u,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new S(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(_),s(_,c,"Generator"),s(_,i,(function(){return this})),s(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=q,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:q(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(r){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function a(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(s){return void r(s)}u.done?t(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){a(i,n,o,u,c,"next",e)}function c(e){a(i,n,o,u,c,"throw",e)}u(void 0)}))}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function s(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}r.r(n),r.d(n,{processStreamlinedElements:()=>S});const l=window.wp.i18n;var f=r(7894);r(5666);function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],_n=!0,i=!1;try{for(r=r.call(e);!(_n=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);_n=!0);}catch(u){i=!0,o=u}finally{try{_n||null==r.return||r.return()}finally{if(i)throw o}}return a}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var __=l.__,d=function(e,t){var r,n={};r=e.email,/\S+@\S+/.test(r)||(n.email=__("Email address is invalid.","newspack-blocks"));var o=t.minimumDonation;return o&&parseFloat(e.amount)<o&&(n.amount=(0,l.sprintf)(__("Amount must be at least %d.","newspack-blocks"),o)),0===e.full_name.length&&(n.amount=__("Full name should be provided.","newspack-blocks")),n},m=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"error";t.innerHTML="",e.forEach((function(e){if(e){var n=document.createElement("div");n.classList.add("type-".concat(r)),n.innerHTML=e,t.appendChild(n)}})),"success"===r&&t.parentElement&&t.parentElement.replaceWith(t)},y=function(e){var t=e.closest("[data-streamlined-config]"),r=null==t?void 0:t.getAttribute("data-streamlined-config");if(!r)return{};var n=p(JSON.parse(r),12),o=n[0],a=n[1],i=n[2],u=n[3],c=n[4],s=n[5],l=n[6],f=n[7],d=n[8],m=n[9],y=n[10],h=n[11];return{currency:o.toLowerCase(),currencySymbol:a,siteName:i,isCurrencyZeroDecimal:u,countryCode:c,frequencies:s,feeMultiplier:parseFloat(l),feeStatic:parseFloat(f),stripePublishableKey:d,paymentRequestType:m,captchaSiteKey:y,minimumDonation:parseFloat(h)}},h=function(e){var t=Object.fromEntries(new FormData(e)),r="donation_value_".concat(t.donation_frequency);return t.amount=t[r],"other"===t.amount&&(t.amount=t["".concat(r,"_other")]),t.amount||(t.amount=t["".concat(r,"_untiered")]),t.cid&&"string"==typeof t.cid&&0===t.cid.indexOf("CLIENT_ID")&&(t.cid=document.cookie.split("; ").reduce((function(e,t){var r=t.split("=");return e[r[0]]=r[1],e}),{})["newspack-cid"]),t},v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{convertToSubunit:!1},r=t.convertToSubunit,n=y(e),o=h(e),a=o.amount,i=void 0===a?"0":a,u=o.agree_to_pay_fees,c=function(e){return r?e*(n.isCurrencyZeroDecimal?1:100):e},s=0;return u&&(s=c(w(e)||0)),c(parseFloat(i))+s},b=function(e){var t=y(e),r=h(e).donation_frequency,n=t.frequencies[r];return{label:"".concat(t.siteName," (").concat(n,")"),amount:v(e,{convertToSubunit:!0})}},w=function(e){var t=y(e),r=t.feeMultiplier,n=t.feeStatic;if(void 0===r||void 0===n||isNaN(r)||isNaN(n))return 0;var o=h(e).amount;return function(e,t,r){return parseFloat(((e+r)/(100-t)*100-e).toFixed(2))}(parseFloat(o),r,n)},g=function(){var e=i(regeneratorRuntime.mark((function e(t,r){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:"POST",e.abrupt("return",fetch("/wp-json/newspack-blocks/v1".concat(t),{method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}).then(function(){var e=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.json();case 2:if(r=e.sent,!t.ok){e.next=5;break}return e.abrupt("return",r);case 5:return e.abrupt("return",{error:r});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),x=function(e,t){var r=(0,l.sprintf)(__("Your payment has been processed. Thank you for your contribution! You will receive a confirmation email at %s.","newspack-blocks"),e);m([r],t,"success")},_=l.__,k=function(e){return s(e.querySelectorAll("input[data-is-additional-field]")).map((function(e){return{name:e.name,value:e.value}}))},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return s(e.querySelectorAll(".stripe-payment")).forEach(function(){var e=i(regeneratorRuntime.mark((function e(t){var r,n,a,u,c,s,l,p,S,E,j,O,L,P,q,R,T,F;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=!1,s=t.closest("form"),l=t.querySelector(".stripe-payment__messages"),s&&l){e.next=5;break}return e.abrupt("return");case 5:p=t.closest(".wpbnbd"),S="newspackPaymentFlowComplete-".concat((null==p?void 0:p.id)||""),E=y(s),j=function(){return t.classList.add("stripe-payment--disabled")},(O=function(){return t.classList.remove("stripe-payment--disabled")})(),L=function(){if(!c){var e=t.querySelector(".stripe-payment__inputs.stripe-payment--hidden");e&&(e.classList.remove("stripe-payment--hidden"),c=!0)}},P=function(){var e=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){var n=window.grecaptcha;if(!n)return e("");null!=n&&n.ready&&t||r(_("Error loading the reCaptcha library.","newspack-blocks")),n.ready(i(regeneratorRuntime.mark((function o(){var a;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,n.execute(t,{action:"submit"});case 3:return a=o.sent,o.abrupt("return",e(a));case 7:o.prev=7,o.t0=o.catch(0),r(o.t0);case 10:case"end":return o.stop()}}),o,null,[[0,7]])}))))})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),q=function(){var e=i(regeneratorRuntime.mark((function e(t){var n,a,i,u,c,f,p,d,y,b,w,j,L,q,R,T=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=T.length>1&&void 0!==T[1]?T[1]:void 0,u=T.length>2&&void 0!==T[2]?T[2]:{},r){e.next=4;break}return e.abrupt("return");case 4:if(!(c=null==E?void 0:E.captchaSiteKey)){e.next=17;break}return e.prev=6,e.next=9,P(c);case 9:f=e.sent,e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(6),p=e.t0 instanceof Error?e.t0.message:_("Error processing captcha request.","newspack-blocks"),m([p],l),e.abrupt("return",{error:!0});case 17:return d=h(s),y=k(s),b=o({captchaToken:f,stripe_tokenization_method:i?null===(n=i.card)||void 0===n?void 0:n.tokenization_method:"card",stripe_source_id:t.id,amount:v(s),email:d.email,full_name:d.full_name,frequency:d.donation_frequency,newsletter_opt_in:Boolean(d.newsletter_opt_in),newspack_popup_id:d.newspack_popup_id,_wp_http_referer:d._wp_http_referer,clientId:d.cid,additional_fields:y},u),e.next=22,g("/donate",b);case 22:if(w=e.sent,200===(null===(a=w.data)||void 0===a?void 0:a.status)||!w.message){e.next=26;break}return m([w.message],l),e.abrupt("return",{error:!0});case 26:if(!w.error){e.next=29;break}return m([w.error],l),e.abrupt("return",{error:!0});case 29:if(j=function(e){return m([e],l),O(),window.dispatchEvent(new Event(S)),{error:!0}},!w.client_secret){e.next=53;break}return e.next=33,r.confirmCardPayment(w.client_secret);case 33:if(!(L=e.sent).error){e.next=38;break}return e.abrupt("return",j(L.error.message));case 38:if("succeeded"!==L.paymentIntent.status){e.next=42;break}x(b.email,l),e.next=53;break;case 42:if("requires_action"!==L.paymentIntent.status){e.next=52;break}return e.next=45,r.confirmCardPayment(w.client_secret);case 45:if(q=e.sent,!(R=q.error)){e.next=49;break}return e.abrupt("return",j(R.message));case 49:x(b.email,l),e.next=53;break;case 52:return e.abrupt("return",j(_("Something went wrong with the payment. Please try again later.","newspack-blocks")));case 53:return"success"===w.status&&x(b.email,l),window.dispatchEvent(new Event(S)),e.abrupt("return",{});case 56:case"end":return e.stop()}}),e,null,[[6,12]])})));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=i(regeneratorRuntime.mark((function e(){var o,c,l,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,f.loadStripe)(E.stripePublishableKey);case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return");case 5:if(o=t.querySelector(".stripe-payment__card")){e.next=8;break}return e.abrupt("return");case 8:return c=r.elements(),(n=c.create("card")).mount(o),a=r.paymentRequest({country:E.countryCode,currency:E.currency,total:b(s),requestPayerName:!0,requestPayerEmail:!0}),e.next=14,a.canMakePayment();case 14:if(!e.sent){e.next=28;break}if(a.on("source",function(){var e=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,q(t.source,u,{email:t.payerEmail,full_name:t.payerName});case 2:r=e.sent,t.complete(null!=r&&r.error?"fail":"success");case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),a.on("token",function(){var e=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=t.token;case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),s.addEventListener("change",(function(){a.update({total:b(s)})})),l=c.create("paymentRequestButton",{paymentRequest:a,style:{paymentRequestButton:{type:E.paymentRequestType,height:"46px"}}}),p=t.querySelector(".stripe-payment__request-button")){e.next=23;break}return e.abrupt("return");case 23:l.mount(p),p.classList.remove("stripe-payment--hidden"),setTimeout((function(){p.classList.remove("stripe-payment__request-button--invisible")}),0),e.next=29;break;case 28:L();case 29:t.classList.remove("stripe-payment--invisible");case 30:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),new IntersectionObserver((function(e){e[0].isIntersecting&&R()})).observe(t),(T=t.querySelector('button[type="submit"]'))&&(T.onclick=function(e){c||(e.preventDefault(),L())}),(F=function(){var e=t.querySelector("#stripe-fees-amount");if(e){var r=Object.fromEntries(new FormData(s)),n=w(s);if(0===n){var o=t.querySelector("#stripe-fees-amount-container");o&&(o.style.display="none")}"string"==typeof r.donation_frequency&&(e.innerHTML="(".concat(E.currencySymbol).concat(n.toFixed(2)," ").concat(E.frequencies[r.donation_frequency].toLowerCase(),")"))}})(),s.addEventListener("change",F),s.addEventListener("submit",function(){var e=i(regeneratorRuntime.mark((function e(t){var o,a,i,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return");case 2:if(t.preventDefault(),j(),m([_("Processing payment…","newspack-blocks")],l,"info"),a=h(s),!((i=Object.values(d(a,E))).length>0)){e.next=11;break}return m(i,l),O(),e.abrupt("return");case 11:return u=function(e){e.message&&i.push(e.message),m(i,l),O()},e.next=14,r.createSource(n,{type:"card",owner:{name:a.full_name,email:a.email}});case 14:if(!(c=e.sent).error){e.next=18;break}return u(c.error),e.abrupt("return");case 18:return e.next=20,q(c.source);case 20:null!==(o=window.newspackReaderActivation)&&void 0!==o&&o.refreshAuthentication&&window.newspackReaderActivation.refreshAuthentication();case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 23:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}())};S()})();var o=window;for(var a in n)o[a]=n[a];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '
|
|
1
|
+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '0c9d014b6edf6301df9128d834e82604');
|
package/dist/modalCheckout.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#newspack_modal_checkout{padding:32px;font-size:1rem}#newspack_modal_checkout .order-details-summary{border:2px solid;border-radius:3px;padding:16px}#newspack_modal_checkout .order-details-summary h4{font-size:1rem;margin:0}#newspack_modal_checkout .order-details-summary h4>span{color:inherit;font-size:clamp(1.75rem,1.75rem + (1vw - .48rem)*.962,2.25rem);font-weight:700;line-height:1.434}#newspack_modal_checkout .order-details-summary h4 .subscription-details{font-size:1rem;font-weight:400}#newspack_modal_checkout #order-details-wrapper.hidden{display:none}#newspack_modal_checkout .woocommerce-checkout-review-order-table,#newspack_modal_checkout .woocommerce-NoticeGroup{margin-top:16px}#newspack_modal_checkout .woocommerce-checkout-review-order-table td,#newspack_modal_checkout .woocommerce-checkout-review-order-table th{font-size:.8rem}#newspack_modal_checkout .woocommerce-checkout-review-order-table.empty{display:none;margin:0;padding:0}#newspack_modal_checkout .woocommerce-billing-fields{margin-bottom:16px}#newspack_modal_checkout .checkout-billing-summary{border-bottom:1px solid #ccc;padding-bottom:32px}#newspack_modal_checkout .checkout-billing-summary__grid{align-items:baseline;display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between}#newspack_modal_checkout .checkout-billing-summary p{font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);margin:16px 0 0}#newspack_modal_checkout .checkout-billing-summary .edit-billing-link{color:#767676;font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);display:inline-block;text-decoration:underline}#newspack_modal_checkout .checkout-billing-summary .edit-billing-link:focus,#newspack_modal_checkout .checkout-billing-summary .edit-billing-link:hover{color:inherit}#newspack_modal_checkout .woocommerce-account-fields .create-account{border-bottom:1px solid #ccc;padding-bottom:32px}#newspack_modal_checkout .woocommerce-account-fields .create-account .woocommerce-password-hint,#newspack_modal_checkout .woocommerce-account-fields .create-account .woocommerce-password-strength{color:#cc1818;margin-top:16px}#newspack_modal_checkout form,#newspack_modal_checkout form #wc-stripe-payment-request-button-separator{margin:0}#newspack_modal_checkout form .woocommerce-terms-and-conditions-wrapper{margin:16px 0}#newspack_modal_checkout form h3{font-size:1.37rem;margin:32px 0 0}#newspack_modal_checkout form p{margin:16px 0}#newspack_modal_checkout form .select2-container .select2-selection--single{margin:0}#newspack_modal_checkout form #payment button#place_order{margin-bottom:0}#newspack_modal_checkout form .checkout-billing button[type=submit],#newspack_modal_checkout form button.modal-continue,#newspack_modal_checkout form button[name=woocommerce_checkout_place_order]{display:block;width:100%}#newspack_modal_checkout .form-row-first,#newspack_modal_checkout .form-row-last{width:calc(50% - 8px)}#newspack_modal_checkout .form-row-last+.form-row-first,#newspack_modal_checkout .form-row-wide+.form-row-first,#newspack_modal_checkout .form-row-wide+.form-row-first+.form-row-last{margin-top:0}#newspack_modal_checkout .select2-container--default .select2-selection--single{border-color:#ccc;border-radius:0;height:44px}#newspack_modal_checkout .select2-container--default .select2-selection--single .select2-selection__rendered{color:inherit;line-height:44px}#newspack_modal_checkout .select2-container--default .select2-selection--single .select2-selection__arrow{height:42px}#newspack_modal_checkout .wc_payment_method .payment_box{background:#f0f0f0;border-radius:3px;padding:16px}#newspack_modal_checkout .wc_payment_method .payment_box p{margin-top:0}#newspack_modal_checkout .wc-saved-payment-methods{padding:0}#newspack_modal_checkout .woocommerce-error{border-radius:3px;margin:0}#newspack_modal_checkout .woocommerce-notices-wrapper:not(:empty){margin-bottom:32px}#newspack_modal_checkout .woocommerce-privacy-policy-text{color:#767676}#newspack_modal_checkout .woocommerce-privacy-policy-text p{font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);margin:0}#newspack_modal_checkout .woocommerce-thankyou-order-received{align-items:center;border-bottom:1px solid #ccc;display:flex;flex-direction:column;justify-content:center;margin:0 0 32px;padding:0 0 32px}#newspack_modal_checkout .woocommerce-thankyou-order-received:before{-webkit-animation:bounce .25s ease-in;animation:bounce .25s ease-in;-webkit-animation-delay:1s;animation-delay:1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;background-color:#4ab866;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z' fill='%23fff'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;background-size:24px;border-radius:50%;content:"";display:block;height:40px;margin-bottom:16px;padding:8px;transform:scale(0);width:40px}#newspack_modal_checkout .woocommerce-form-login-toggle,#newspack_modal_checkout .woocommerce-thankyou-order-received+.woocommerce-info{display:none}#newspack_modal_checkout .woocommerce-order-overview{color:#767676;list-style:none;margin:16px 0 0;padding:0}#newspack_modal_checkout .blockOverlay{align-items:center;display:flex;inset:0;justify-content:center;position:fixed!important}#newspack_modal_checkout .blockOverlay:after{-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:2px solid #fff;border-top-color:#767676;border-radius:50%;content:"";display:block;height:25px;width:25px}.newspack-modal-newsletters{margin-top:20px;padding-top:22px;border-top:1px solid #ccc}.newspack-modal-newsletters__info{margin-bottom:35px}.newspack-modal-newsletters__info span{color:#767676}.newspack-modal-newsletters__list-item{display:flex;margin-bottom:18px;border:1px solid #ccc;border-radius:6px}.newspack-modal-newsletters__list-item b{display:block;margin-bottom:2px}.newspack-modal-newsletters label{flex:1;padding:12px;cursor:pointer}.newspack-modal-newsletters input[type=checkbox]{padding:10px;margin-top:18px;margin-right:19px;margin-left:20px;border-radius:5px}.newspack-modal-newsletters__button,.newspack-modal-newsletters input[type=submit]{margin-top:25px;width:100%;padding:22px!important;font-size:1em!important}@-webkit-keyframes bounce{0%{transform:scale(0)}90%{transform:scale(1.4)}to{transform:scale(1)}}@keyframes bounce{0%{transform:scale(0)}90%{transform:scale(1.4)}to{transform:scale(1)}}
|
|
1
|
+
#newspack_modal_checkout{padding:32px;font-size:1rem}#newspack_modal_checkout .order-details-summary{border:2px solid;border-radius:3px;padding:16px}#newspack_modal_checkout .order-details-summary h4{font-size:1rem;margin:0}#newspack_modal_checkout .order-details-summary h4>span{color:inherit;font-size:clamp(1.75rem,1.75rem + (1vw - .48rem)*.962,2.25rem);font-weight:700;line-height:1.434}#newspack_modal_checkout .order-details-summary h4 .subscription-details{font-size:1rem;font-weight:400}#newspack_modal_checkout #order-details-wrapper.hidden{display:none}#newspack_modal_checkout .woocommerce-checkout-review-order-table,#newspack_modal_checkout .woocommerce-NoticeGroup{margin-top:16px}#newspack_modal_checkout .woocommerce-checkout-review-order-table td,#newspack_modal_checkout .woocommerce-checkout-review-order-table th{font-size:.8rem}#newspack_modal_checkout .woocommerce-checkout-review-order-table.empty{display:none;margin:0;padding:0}#newspack_modal_checkout .woocommerce-billing-fields{margin-bottom:16px}#newspack_modal_checkout .checkout-billing-summary{border-bottom:1px solid #ccc;padding-bottom:32px}#newspack_modal_checkout .checkout-billing-summary__grid{align-items:baseline;display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between}#newspack_modal_checkout .checkout-billing-summary p{font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);margin:16px 0 0}#newspack_modal_checkout .checkout-billing-summary .edit-billing-link{color:#767676;font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);display:inline-block;text-decoration:underline}#newspack_modal_checkout .checkout-billing-summary .edit-billing-link:focus,#newspack_modal_checkout .checkout-billing-summary .edit-billing-link:hover{color:inherit}#newspack_modal_checkout .woocommerce-account-fields .create-account{border-bottom:1px solid #ccc;padding-bottom:32px}#newspack_modal_checkout .woocommerce-account-fields .create-account .woocommerce-password-hint,#newspack_modal_checkout .woocommerce-account-fields .create-account .woocommerce-password-strength{color:#cc1818;margin-top:16px}#newspack_modal_checkout form,#newspack_modal_checkout form #wc-stripe-payment-request-button-separator{margin:0}#newspack_modal_checkout form .woocommerce-terms-and-conditions-wrapper{margin:16px 0}#newspack_modal_checkout form h3{font-size:1.37rem;margin:32px 0 0}#newspack_modal_checkout form p{margin:16px 0}#newspack_modal_checkout form .select2-container .select2-selection--single{margin:0}#newspack_modal_checkout form #payment button#place_order{margin-bottom:0}#newspack_modal_checkout form .checkout-billing button[type=submit],#newspack_modal_checkout form button.modal-continue,#newspack_modal_checkout form button[name=woocommerce_checkout_place_order]{display:block;width:100%}#newspack_modal_checkout .form-row-first,#newspack_modal_checkout .form-row-last{width:calc(50% - 8px)}#newspack_modal_checkout .form-row-last+.form-row-first,#newspack_modal_checkout .form-row-wide+.form-row-first,#newspack_modal_checkout .form-row-wide+.form-row-first+.form-row-last{margin-top:0}#newspack_modal_checkout .select2-container--default .select2-selection--single{border-color:#ccc;border-radius:0;height:44px}#newspack_modal_checkout .select2-container--default .select2-selection--single .select2-selection__rendered{color:inherit;line-height:44px}#newspack_modal_checkout .select2-container--default .select2-selection--single .select2-selection__arrow{height:42px}#newspack_modal_checkout .wc_payment_method .payment_box{background:#f0f0f0;border-radius:3px;padding:16px}#newspack_modal_checkout .wc_payment_method .payment_box p{margin-top:0}#newspack_modal_checkout .wc_payment_method .payment_box p.newspack-cover-fees,#newspack_modal_checkout .wc_payment_method .payment_box p.woocommerce-SavedPaymentMethods-saveNew{display:flex;margin:8px 0;align-items:flex-start}#newspack_modal_checkout .wc_payment_method .payment_box p.newspack-cover-fees input[type=checkbox],#newspack_modal_checkout .wc_payment_method .payment_box p.woocommerce-SavedPaymentMethods-saveNew input[type=checkbox]{margin-right:8px}#newspack_modal_checkout .wc-saved-payment-methods{padding:0}#newspack_modal_checkout .woocommerce-error{border-radius:3px;margin:0}#newspack_modal_checkout .woocommerce-notices-wrapper:not(:empty){margin-bottom:32px}#newspack_modal_checkout .woocommerce-privacy-policy-text{color:#767676}#newspack_modal_checkout .woocommerce-privacy-policy-text p{font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);margin:0}#newspack_modal_checkout .woocommerce-thankyou-order-received{align-items:center;border-bottom:1px solid #ccc;display:flex;flex-direction:column;justify-content:center;margin:0 0 32px;padding:0 0 32px}#newspack_modal_checkout .woocommerce-thankyou-order-received:before{-webkit-animation:bounce .25s ease-in;animation:bounce .25s ease-in;-webkit-animation-delay:1s;animation-delay:1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;background-color:#4ab866;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z' fill='%23fff'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;background-size:24px;border-radius:50%;content:"";display:block;height:40px;margin-bottom:16px;padding:8px;transform:scale(0);width:40px}#newspack_modal_checkout .woocommerce-form-login-toggle,#newspack_modal_checkout .woocommerce-thankyou-order-received+.woocommerce-info{display:none}#newspack_modal_checkout .woocommerce-order-overview{color:#767676;list-style:none;margin:16px 0 0;padding:0}#newspack_modal_checkout .blockOverlay{align-items:center;display:flex;inset:0;justify-content:center;position:fixed!important}#newspack_modal_checkout .blockOverlay:after{-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:2px solid #fff;border-top-color:#767676;border-radius:50%;content:"";display:block;height:25px;width:25px}.newspack-modal-newsletters{margin-top:20px;padding-top:22px;border-top:1px solid #ccc}.newspack-modal-newsletters__info{margin-bottom:35px}.newspack-modal-newsletters__info span{color:#767676}.newspack-modal-newsletters__list-item{display:flex;margin-bottom:18px;border:1px solid #ccc;border-radius:6px}.newspack-modal-newsletters__list-item b{display:block;margin-bottom:2px}.newspack-modal-newsletters label{flex:1;padding:12px;cursor:pointer}.newspack-modal-newsletters input[type=checkbox]{padding:10px;margin-top:18px;margin-right:19px;margin-left:20px;border-radius:5px}.newspack-modal-newsletters__button,.newspack-modal-newsletters input[type=submit]{margin-top:25px;width:100%;padding:22px!important;font-size:1em!important}@-webkit-keyframes bounce{0%{transform:scale(0)}90%{transform:scale(1.4)}to{transform:scale(1)}}@keyframes bounce{0%{transform:scale(0)}90%{transform:scale(1.4)}to{transform:scale(1)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
#newspack_modal_checkout{padding:32px;font-size:1rem}#newspack_modal_checkout .order-details-summary{border:2px solid;border-radius:3px;padding:16px}#newspack_modal_checkout .order-details-summary h4{font-size:1rem;margin:0}#newspack_modal_checkout .order-details-summary h4>span{color:inherit;font-size:clamp(1.75rem,1.75rem + (1vw - .48rem)*.962,2.25rem);font-weight:700;line-height:1.434}#newspack_modal_checkout .order-details-summary h4 .subscription-details{font-size:1rem;font-weight:400}#newspack_modal_checkout #order-details-wrapper.hidden{display:none}#newspack_modal_checkout .woocommerce-checkout-review-order-table,#newspack_modal_checkout .woocommerce-NoticeGroup{margin-top:16px}#newspack_modal_checkout .woocommerce-checkout-review-order-table td,#newspack_modal_checkout .woocommerce-checkout-review-order-table th{font-size:.8rem}#newspack_modal_checkout .woocommerce-checkout-review-order-table.empty{display:none;margin:0;padding:0}#newspack_modal_checkout .woocommerce-billing-fields{margin-bottom:16px}#newspack_modal_checkout .checkout-billing-summary{border-bottom:1px solid #ccc;padding-bottom:32px}#newspack_modal_checkout .checkout-billing-summary__grid{align-items:baseline;display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between}#newspack_modal_checkout .checkout-billing-summary p{font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);margin:16px 0 0}#newspack_modal_checkout .checkout-billing-summary .edit-billing-link{color:#767676;font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);display:inline-block;text-decoration:underline}#newspack_modal_checkout .checkout-billing-summary .edit-billing-link:focus,#newspack_modal_checkout .checkout-billing-summary .edit-billing-link:hover{color:inherit}#newspack_modal_checkout .woocommerce-account-fields .create-account{border-bottom:1px solid #ccc;padding-bottom:32px}#newspack_modal_checkout .woocommerce-account-fields .create-account .woocommerce-password-hint,#newspack_modal_checkout .woocommerce-account-fields .create-account .woocommerce-password-strength{color:#cc1818;margin-top:16px}#newspack_modal_checkout form,#newspack_modal_checkout form #wc-stripe-payment-request-button-separator{margin:0}#newspack_modal_checkout form .woocommerce-terms-and-conditions-wrapper{margin:16px 0}#newspack_modal_checkout form h3{font-size:1.37rem;margin:32px 0 0}#newspack_modal_checkout form p{margin:16px 0}#newspack_modal_checkout form .select2-container .select2-selection--single{margin:0}#newspack_modal_checkout form #payment button#place_order{margin-bottom:0}#newspack_modal_checkout form .checkout-billing button[type=submit],#newspack_modal_checkout form button.modal-continue,#newspack_modal_checkout form button[name=woocommerce_checkout_place_order]{display:block;width:100%}#newspack_modal_checkout .form-row-first,#newspack_modal_checkout .form-row-last{width:calc(50% - 8px)}#newspack_modal_checkout .form-row-last+.form-row-first,#newspack_modal_checkout .form-row-wide+.form-row-first,#newspack_modal_checkout .form-row-wide+.form-row-first+.form-row-last{margin-top:0}#newspack_modal_checkout .select2-container--default .select2-selection--single{border-color:#ccc;border-radius:0;height:44px}#newspack_modal_checkout .select2-container--default .select2-selection--single .select2-selection__rendered{color:inherit;line-height:44px}#newspack_modal_checkout .select2-container--default .select2-selection--single .select2-selection__arrow{height:42px}#newspack_modal_checkout .wc_payment_method .payment_box{background:#f0f0f0;border-radius:3px;padding:16px}#newspack_modal_checkout .wc_payment_method .payment_box p{margin-top:0}#newspack_modal_checkout .wc-saved-payment-methods{padding:0}#newspack_modal_checkout .woocommerce-error{border-radius:3px;margin:0}#newspack_modal_checkout .woocommerce-notices-wrapper:not(:empty){margin-bottom:32px}#newspack_modal_checkout .woocommerce-privacy-policy-text{color:#767676}#newspack_modal_checkout .woocommerce-privacy-policy-text p{font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);margin:0}#newspack_modal_checkout .woocommerce-thankyou-order-received{align-items:center;border-bottom:1px solid #ccc;display:flex;flex-direction:column;justify-content:center;margin:0 0 32px;padding:0 0 32px}#newspack_modal_checkout .woocommerce-thankyou-order-received:before{-webkit-animation:bounce .25s ease-in;animation:bounce .25s ease-in;-webkit-animation-delay:1s;animation-delay:1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;background-color:#4ab866;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z' fill='%23fff'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;background-size:24px;border-radius:50%;content:"";display:block;height:40px;margin-bottom:16px;padding:8px;transform:scale(0);width:40px}#newspack_modal_checkout .woocommerce-form-login-toggle,#newspack_modal_checkout .woocommerce-thankyou-order-received+.woocommerce-info{display:none}#newspack_modal_checkout .woocommerce-order-overview{color:#767676;list-style:none;margin:16px 0 0;padding:0}#newspack_modal_checkout .blockOverlay{align-items:center;display:flex;inset:0;justify-content:center;position:fixed!important}#newspack_modal_checkout .blockOverlay:after{-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:2px solid #fff;border-top-color:#767676;border-radius:50%;content:"";display:block;height:25px;width:25px}.newspack-modal-newsletters{margin-top:20px;padding-top:22px;border-top:1px solid #ccc}.newspack-modal-newsletters__info{margin-bottom:35px}.newspack-modal-newsletters__info span{color:#767676}.newspack-modal-newsletters__list-item{display:flex;margin-bottom:18px;border:1px solid #ccc;border-radius:6px}.newspack-modal-newsletters__list-item b{display:block;margin-bottom:2px}.newspack-modal-newsletters label{flex:1;padding:12px;cursor:pointer}.newspack-modal-newsletters input[type=checkbox]{padding:10px;margin-top:18px;margin-left:19px;margin-right:20px;border-radius:5px}.newspack-modal-newsletters__button,.newspack-modal-newsletters input[type=submit]{margin-top:25px;width:100%;padding:22px!important;font-size:1em!important}@-webkit-keyframes bounce{0%{transform:scale(0)}90%{transform:scale(1.4)}to{transform:scale(1)}}@keyframes bounce{0%{transform:scale(0)}90%{transform:scale(1.4)}to{transform:scale(1)}}
|
|
1
|
+
#newspack_modal_checkout{padding:32px;font-size:1rem}#newspack_modal_checkout .order-details-summary{border:2px solid;border-radius:3px;padding:16px}#newspack_modal_checkout .order-details-summary h4{font-size:1rem;margin:0}#newspack_modal_checkout .order-details-summary h4>span{color:inherit;font-size:clamp(1.75rem,1.75rem + (1vw - .48rem)*.962,2.25rem);font-weight:700;line-height:1.434}#newspack_modal_checkout .order-details-summary h4 .subscription-details{font-size:1rem;font-weight:400}#newspack_modal_checkout #order-details-wrapper.hidden{display:none}#newspack_modal_checkout .woocommerce-checkout-review-order-table,#newspack_modal_checkout .woocommerce-NoticeGroup{margin-top:16px}#newspack_modal_checkout .woocommerce-checkout-review-order-table td,#newspack_modal_checkout .woocommerce-checkout-review-order-table th{font-size:.8rem}#newspack_modal_checkout .woocommerce-checkout-review-order-table.empty{display:none;margin:0;padding:0}#newspack_modal_checkout .woocommerce-billing-fields{margin-bottom:16px}#newspack_modal_checkout .checkout-billing-summary{border-bottom:1px solid #ccc;padding-bottom:32px}#newspack_modal_checkout .checkout-billing-summary__grid{align-items:baseline;display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between}#newspack_modal_checkout .checkout-billing-summary p{font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);margin:16px 0 0}#newspack_modal_checkout .checkout-billing-summary .edit-billing-link{color:#767676;font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);display:inline-block;text-decoration:underline}#newspack_modal_checkout .checkout-billing-summary .edit-billing-link:focus,#newspack_modal_checkout .checkout-billing-summary .edit-billing-link:hover{color:inherit}#newspack_modal_checkout .woocommerce-account-fields .create-account{border-bottom:1px solid #ccc;padding-bottom:32px}#newspack_modal_checkout .woocommerce-account-fields .create-account .woocommerce-password-hint,#newspack_modal_checkout .woocommerce-account-fields .create-account .woocommerce-password-strength{color:#cc1818;margin-top:16px}#newspack_modal_checkout form,#newspack_modal_checkout form #wc-stripe-payment-request-button-separator{margin:0}#newspack_modal_checkout form .woocommerce-terms-and-conditions-wrapper{margin:16px 0}#newspack_modal_checkout form h3{font-size:1.37rem;margin:32px 0 0}#newspack_modal_checkout form p{margin:16px 0}#newspack_modal_checkout form .select2-container .select2-selection--single{margin:0}#newspack_modal_checkout form #payment button#place_order{margin-bottom:0}#newspack_modal_checkout form .checkout-billing button[type=submit],#newspack_modal_checkout form button.modal-continue,#newspack_modal_checkout form button[name=woocommerce_checkout_place_order]{display:block;width:100%}#newspack_modal_checkout .form-row-first,#newspack_modal_checkout .form-row-last{width:calc(50% - 8px)}#newspack_modal_checkout .form-row-last+.form-row-first,#newspack_modal_checkout .form-row-wide+.form-row-first,#newspack_modal_checkout .form-row-wide+.form-row-first+.form-row-last{margin-top:0}#newspack_modal_checkout .select2-container--default .select2-selection--single{border-color:#ccc;border-radius:0;height:44px}#newspack_modal_checkout .select2-container--default .select2-selection--single .select2-selection__rendered{color:inherit;line-height:44px}#newspack_modal_checkout .select2-container--default .select2-selection--single .select2-selection__arrow{height:42px}#newspack_modal_checkout .wc_payment_method .payment_box{background:#f0f0f0;border-radius:3px;padding:16px}#newspack_modal_checkout .wc_payment_method .payment_box p{margin-top:0}#newspack_modal_checkout .wc_payment_method .payment_box p.newspack-cover-fees,#newspack_modal_checkout .wc_payment_method .payment_box p.woocommerce-SavedPaymentMethods-saveNew{display:flex;margin:8px 0;align-items:flex-start}#newspack_modal_checkout .wc_payment_method .payment_box p.newspack-cover-fees input[type=checkbox],#newspack_modal_checkout .wc_payment_method .payment_box p.woocommerce-SavedPaymentMethods-saveNew input[type=checkbox]{margin-left:8px}#newspack_modal_checkout .wc-saved-payment-methods{padding:0}#newspack_modal_checkout .woocommerce-error{border-radius:3px;margin:0}#newspack_modal_checkout .woocommerce-notices-wrapper:not(:empty){margin-bottom:32px}#newspack_modal_checkout .woocommerce-privacy-policy-text{color:#767676}#newspack_modal_checkout .woocommerce-privacy-policy-text p{font-size:clamp(.75rem,.75rem + (1vw - .48rem)*.481,1rem);margin:0}#newspack_modal_checkout .woocommerce-thankyou-order-received{align-items:center;border-bottom:1px solid #ccc;display:flex;flex-direction:column;justify-content:center;margin:0 0 32px;padding:0 0 32px}#newspack_modal_checkout .woocommerce-thankyou-order-received:before{-webkit-animation:bounce .25s ease-in;animation:bounce .25s ease-in;-webkit-animation-delay:1s;animation-delay:1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;background-color:#4ab866;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z' fill='%23fff'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;background-size:24px;border-radius:50%;content:"";display:block;height:40px;margin-bottom:16px;padding:8px;transform:scale(0);width:40px}#newspack_modal_checkout .woocommerce-form-login-toggle,#newspack_modal_checkout .woocommerce-thankyou-order-received+.woocommerce-info{display:none}#newspack_modal_checkout .woocommerce-order-overview{color:#767676;list-style:none;margin:16px 0 0;padding:0}#newspack_modal_checkout .blockOverlay{align-items:center;display:flex;inset:0;justify-content:center;position:fixed!important}#newspack_modal_checkout .blockOverlay:after{-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:2px solid #fff;border-top-color:#767676;border-radius:50%;content:"";display:block;height:25px;width:25px}.newspack-modal-newsletters{margin-top:20px;padding-top:22px;border-top:1px solid #ccc}.newspack-modal-newsletters__info{margin-bottom:35px}.newspack-modal-newsletters__info span{color:#767676}.newspack-modal-newsletters__list-item{display:flex;margin-bottom:18px;border:1px solid #ccc;border-radius:6px}.newspack-modal-newsletters__list-item b{display:block;margin-bottom:2px}.newspack-modal-newsletters label{flex:1;padding:12px;cursor:pointer}.newspack-modal-newsletters input[type=checkbox]{padding:10px;margin-top:18px;margin-left:19px;margin-right:20px;border-radius:5px}.newspack-modal-newsletters__button,.newspack-modal-newsletters input[type=submit]{margin-top:25px;width:100%;padding:22px!important;font-size:1em!important}@-webkit-keyframes bounce{0%{transform:scale(0)}90%{transform:scale(1.4)}to{transform:scale(1)}}@keyframes bounce{0%{transform:scale(0)}90%{transform:scale(1.4)}to{transform:scale(1)}}
|
|
@@ -31,7 +31,7 @@ final class Modal_Checkout {
|
|
|
31
31
|
* Initialize hooks.
|
|
32
32
|
*/
|
|
33
33
|
public static function init() {
|
|
34
|
-
add_action( '
|
|
34
|
+
add_action( 'wp_loaded', [ __CLASS__, 'process_checkout_request' ], 5 );
|
|
35
35
|
add_action( 'wp_footer', [ __CLASS__, 'render_modal_markup' ], 100 );
|
|
36
36
|
add_action( 'wp_footer', [ __CLASS__, 'render_variation_selection' ], 100 );
|
|
37
37
|
add_action( 'wp_enqueue_scripts', [ __CLASS__, 'enqueue_scripts' ] );
|
|
@@ -51,6 +51,21 @@ final class Modal_Checkout {
|
|
|
51
51
|
add_filter( 'wcs_place_subscription_order_text', [ __CLASS__, 'order_button_text' ], 1 );
|
|
52
52
|
add_filter( 'woocommerce_order_button_text', [ __CLASS__, 'order_button_text' ] );
|
|
53
53
|
add_filter( 'option_woocommerce_subscriptions_order_button_text', [ __CLASS__, 'order_button_text' ] );
|
|
54
|
+
|
|
55
|
+
// Remove some stuff from the modal checkout page. It's displayed in an iframe, so it should not be treated as a separate page.
|
|
56
|
+
add_action( 'wp_enqueue_scripts', [ __CLASS__, 'dequeue_scripts' ], 11 );
|
|
57
|
+
add_filter( 'newspack_reader_activation_should_render_auth', [ __CLASS__, 'is_not_modal_checkout_filter' ] );
|
|
58
|
+
add_filter( 'newspack_enqueue_reader_activation_block', [ __CLASS__, 'is_not_modal_checkout_filter' ] );
|
|
59
|
+
add_filter( 'newspack_enqueue_memberships_block_patterns', [ __CLASS__, 'is_not_modal_checkout_filter' ] );
|
|
60
|
+
add_filter( 'newspack_ads_should_show_ads', [ __CLASS__, 'is_not_modal_checkout_filter' ] );
|
|
61
|
+
add_filter( 'newspack_theme_enqueue_js', [ __CLASS__, 'is_not_modal_checkout_filter' ] );
|
|
62
|
+
add_filter( 'newspack_theme_enqueue_print_styles', [ __CLASS__, 'is_not_modal_checkout_filter' ] );
|
|
63
|
+
add_filter( 'cmplz_site_needs_cookiewarning', [ __CLASS__, 'is_not_modal_checkout_filter' ] );
|
|
64
|
+
add_filter( 'googlesitekit_analytics_tag_blocked', [ __CLASS__, 'is_modal_checkout' ] );
|
|
65
|
+
add_filter( 'googlesitekit_analytics-4_tag_blocked', [ __CLASS__, 'is_modal_checkout' ] );
|
|
66
|
+
add_filter( 'googlesitekit_adsense_tag_blocked', [ __CLASS__, 'is_modal_checkout' ] );
|
|
67
|
+
add_filter( 'googlesitekit_tagmanager_tag_blocked', [ __CLASS__, 'is_modal_checkout' ] );
|
|
68
|
+
add_filter( 'jetpack_active_modules', [ __CLASS__, 'jetpack_active_modules' ] );
|
|
54
69
|
}
|
|
55
70
|
|
|
56
71
|
/**
|
|
@@ -133,12 +148,16 @@ final class Modal_Checkout {
|
|
|
133
148
|
* Process checkout request for modal.
|
|
134
149
|
*/
|
|
135
150
|
public static function process_checkout_request() {
|
|
151
|
+
if ( is_admin() ) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
136
155
|
$is_newspack_checkout = filter_input( INPUT_GET, 'newspack_checkout', FILTER_SANITIZE_NUMBER_INT );
|
|
137
156
|
$product_id = filter_input( INPUT_GET, 'product_id', FILTER_SANITIZE_NUMBER_INT );
|
|
138
157
|
$variation_id = filter_input( INPUT_GET, 'variation_id', FILTER_SANITIZE_NUMBER_INT );
|
|
139
|
-
$after_success_behavior = filter_input( INPUT_GET, 'after_success_behavior',
|
|
140
|
-
$after_success_url = filter_input( INPUT_GET, 'after_success_url',
|
|
141
|
-
$after_success_button_label = filter_input( INPUT_GET, 'after_success_button_label',
|
|
158
|
+
$after_success_behavior = filter_input( INPUT_GET, 'after_success_behavior', FILTER_SANITIZE_SPECIAL_CHARS );
|
|
159
|
+
$after_success_url = filter_input( INPUT_GET, 'after_success_url', FILTER_SANITIZE_SPECIAL_CHARS );
|
|
160
|
+
$after_success_button_label = filter_input( INPUT_GET, 'after_success_button_label', FILTER_SANITIZE_SPECIAL_CHARS );
|
|
142
161
|
|
|
143
162
|
if ( ! $is_newspack_checkout || ! $product_id ) {
|
|
144
163
|
return;
|
|
@@ -212,6 +231,13 @@ final class Modal_Checkout {
|
|
|
212
231
|
}
|
|
213
232
|
}
|
|
214
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Filters the cart item data for the modal checkout.
|
|
236
|
+
*
|
|
237
|
+
* @param array $cart_item_data Cart item data.
|
|
238
|
+
*/
|
|
239
|
+
$cart_item_data = apply_filters( 'newspack_blocks_modal_checkout_cart_item_data', $cart_item_data );
|
|
240
|
+
|
|
215
241
|
\WC()->cart->add_to_cart( $product_id, 1, 0, [], $cart_item_data );
|
|
216
242
|
|
|
217
243
|
$query_args = [];
|
|
@@ -343,6 +369,18 @@ final class Modal_Checkout {
|
|
|
343
369
|
);
|
|
344
370
|
}
|
|
345
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Dequeue scripts not needed in the modal checkout.
|
|
374
|
+
*/
|
|
375
|
+
public static function dequeue_scripts() {
|
|
376
|
+
if ( ! self::is_modal_checkout() ) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
wp_dequeue_style( 'cmplz-general' );
|
|
380
|
+
wp_deregister_script( 'wp-mediaelement' );
|
|
381
|
+
wp_deregister_style( 'wp-mediaelement' );
|
|
382
|
+
}
|
|
383
|
+
|
|
346
384
|
/**
|
|
347
385
|
* Enqueue script for triggering modal checkout.
|
|
348
386
|
*
|
|
@@ -386,14 +424,23 @@ final class Modal_Checkout {
|
|
|
386
424
|
return $template;
|
|
387
425
|
}
|
|
388
426
|
ob_start();
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
427
|
+
?>
|
|
428
|
+
<!doctype html>
|
|
429
|
+
<html <?php language_attributes(); ?>>
|
|
430
|
+
<head>
|
|
431
|
+
<meta charset="<?php bloginfo( 'charset' ); ?>" />
|
|
432
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
433
|
+
<link rel="profile" href="https://gmpg.org/xfn/11" />
|
|
434
|
+
<?php wp_head(); ?>
|
|
435
|
+
</head>
|
|
436
|
+
<body id="newspack_modal_checkout">
|
|
437
|
+
<?php
|
|
438
|
+
echo do_shortcode( '[woocommerce_checkout]' );
|
|
439
|
+
wp_footer();
|
|
440
|
+
?>
|
|
441
|
+
</body>
|
|
442
|
+
</html>
|
|
443
|
+
<?php
|
|
397
444
|
ob_end_flush();
|
|
398
445
|
}
|
|
399
446
|
|
|
@@ -482,6 +529,12 @@ final class Modal_Checkout {
|
|
|
482
529
|
}
|
|
483
530
|
}
|
|
484
531
|
|
|
532
|
+
// This is for the initial display – the markup will be refetched on cart updates (e.g. applying a coupon).
|
|
533
|
+
// Then it'd be handled by the `woocommerce_update_order_review_fragments` filter.
|
|
534
|
+
if ( 'checkout/review-order.php' === $template_name && ! self::should_show_order_details() ) {
|
|
535
|
+
$located = NEWSPACK_BLOCKS__PLUGIN_DIR . 'src/modal-checkout/templates/empty-order-details.php';
|
|
536
|
+
}
|
|
537
|
+
|
|
485
538
|
return $located;
|
|
486
539
|
}
|
|
487
540
|
|
|
@@ -919,5 +972,29 @@ final class Modal_Checkout {
|
|
|
919
972
|
}
|
|
920
973
|
return $text;
|
|
921
974
|
}
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Filter the a value dependent on the page not being modal checkout.
|
|
978
|
+
*
|
|
979
|
+
* @param bool $value The value.
|
|
980
|
+
*/
|
|
981
|
+
public static function is_not_modal_checkout_filter( $value ) {
|
|
982
|
+
if ( self::is_modal_checkout() ) {
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
985
|
+
return $value;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Deactivate all Jetpack modules on the modal checkout.
|
|
990
|
+
*
|
|
991
|
+
* @param bool $modules JP modules.
|
|
992
|
+
*/
|
|
993
|
+
public static function jetpack_active_modules( $modules ) {
|
|
994
|
+
if ( self::is_modal_checkout() ) {
|
|
995
|
+
return [];
|
|
996
|
+
}
|
|
997
|
+
return $modules;
|
|
998
|
+
}
|
|
922
999
|
}
|
|
923
1000
|
Modal_Checkout::init();
|
package/newspack-blocks.php
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Author URI: https://newspack.com/
|
|
8
8
|
* Text Domain: newspack-blocks
|
|
9
9
|
* Domain Path: /languages
|
|
10
|
-
* Version: 2.
|
|
10
|
+
* Version: 2.4.0-alpha.1
|
|
11
11
|
*
|
|
12
12
|
* @package Newspack_Blocks
|
|
13
13
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
define( 'NEWSPACK_BLOCKS__PLUGIN_FILE', __FILE__ );
|
|
16
16
|
define( 'NEWSPACK_BLOCKS__BLOCKS_DIRECTORY', 'dist/' );
|
|
17
17
|
define( 'NEWSPACK_BLOCKS__PLUGIN_DIR', plugin_dir_path( NEWSPACK_BLOCKS__PLUGIN_FILE ) );
|
|
18
|
-
define( 'NEWSPACK_BLOCKS__VERSION', '2.
|
|
18
|
+
define( 'NEWSPACK_BLOCKS__VERSION', '2.4.0-alpha.1' );
|
|
19
19
|
|
|
20
20
|
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks.php';
|
|
21
21
|
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks-api.php';
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/newspack-blocks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-alpha.1",
|
|
4
4
|
"author": "Automattic",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@rushstack/eslint-patch": "^1.5.1",
|
|
7
7
|
"@testing-library/dom": "^9.3.3",
|
|
8
8
|
"@testing-library/user-event": "^14.5.1",
|
|
9
|
-
"@types/lodash": "^4.14.
|
|
10
|
-
"@types/lodash.debounce": "^4.0.
|
|
9
|
+
"@types/lodash": "^4.14.202",
|
|
10
|
+
"@types/lodash.debounce": "^4.0.9",
|
|
11
11
|
"eslint": "^7.32.0",
|
|
12
12
|
"fetch-mock-jest": "^1.5.1",
|
|
13
13
|
"html-entities": "^2.4.0",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"description": "=== Newspack Blocks === Contributors: (this should be a list of wordpress.org userid's) Donate link: https://example.com/ Tags: comments, spam Requires at least: 4.5 Tested up to: 5.1.1 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@stripe/stripe-js": "^2.
|
|
23
|
+
"@stripe/stripe-js": "^2.2.0",
|
|
24
24
|
"classnames": "^2.3.2",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
26
|
"newspack-components": "^2.1.0",
|
|
@@ -137,6 +137,15 @@
|
|
|
137
137
|
p {
|
|
138
138
|
margin-top: 0;
|
|
139
139
|
}
|
|
140
|
+
p.woocommerce-SavedPaymentMethods-saveNew,
|
|
141
|
+
p.newspack-cover-fees {
|
|
142
|
+
display: flex;
|
|
143
|
+
margin: 8px 0;
|
|
144
|
+
align-items: flex-start;
|
|
145
|
+
input[type='checkbox'] {
|
|
146
|
+
margin-right: 8px;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
140
149
|
}
|
|
141
150
|
.wc-saved-payment-methods {
|
|
142
151
|
padding: 0;
|
|
@@ -24,9 +24,9 @@ $form_class = 'checkout woocommerce-checkout';
|
|
|
24
24
|
$form_method = $edit_billing ? 'get' : 'post';
|
|
25
25
|
$form_billing_fields = \Newspack_Blocks\Modal_Checkout::get_prefilled_fields();
|
|
26
26
|
|
|
27
|
-
$after_success_behavior = filter_input( INPUT_GET, 'after_success_behavior',
|
|
28
|
-
$after_success_url = filter_input( INPUT_GET, 'after_success_url',
|
|
29
|
-
$after_success_button_label = filter_input( INPUT_GET, 'after_success_button_label',
|
|
27
|
+
$after_success_behavior = filter_input( INPUT_GET, 'after_success_behavior', FILTER_SANITIZE_SPECIAL_CHARS );
|
|
28
|
+
$after_success_url = filter_input( INPUT_GET, 'after_success_url', FILTER_SANITIZE_SPECIAL_CHARS );
|
|
29
|
+
$after_success_button_label = filter_input( INPUT_GET, 'after_success_button_label', FILTER_SANITIZE_SPECIAL_CHARS );
|
|
30
30
|
|
|
31
31
|
if ( $edit_billing ) {
|
|
32
32
|
$form_class .= ' edit-billing';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Empty order details.
|
|
4
|
+
*
|
|
5
|
+
* @see https://docs.woocommerce.com/document/template-structure/
|
|
6
|
+
* @package WooCommerce\Templates
|
|
7
|
+
* @version 8.1.0
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
if ( ! defined( 'ABSPATH' ) ) {
|
|
11
|
+
exit;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
?>
|
|
15
|
+
<table class="shop_table woocommerce-checkout-review-order-table empty"></table>
|
|
16
|
+
<?php
|
package/vendor/autoload.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// autoload_real.php @generated by Composer
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ComposerAutoloaderInite42d624f43ff4cbf8159698e9b5bba0f
|
|
6
6
|
{
|
|
7
7
|
private static $loader;
|
|
8
8
|
|
|
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit926f2f9a72fc0d16d060cf717f2d1f83
|
|
|
22
22
|
return self::$loader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spl_autoload_register(array('
|
|
25
|
+
spl_autoload_register(array('ComposerAutoloaderInite42d624f43ff4cbf8159698e9b5bba0f', 'loadClassLoader'), true, true);
|
|
26
26
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
|
27
|
-
spl_autoload_unregister(array('
|
|
27
|
+
spl_autoload_unregister(array('ComposerAutoloaderInite42d624f43ff4cbf8159698e9b5bba0f', 'loadClassLoader'));
|
|
28
28
|
|
|
29
29
|
require __DIR__ . '/autoload_static.php';
|
|
30
|
-
call_user_func(\Composer\Autoload\
|
|
30
|
+
call_user_func(\Composer\Autoload\ComposerStaticInite42d624f43ff4cbf8159698e9b5bba0f::getInitializer($loader));
|
|
31
31
|
|
|
32
32
|
$loader->register(true);
|
|
33
33
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
namespace Composer\Autoload;
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class ComposerStaticInite42d624f43ff4cbf8159698e9b5bba0f
|
|
8
8
|
{
|
|
9
9
|
public static $classMap = array (
|
|
10
10
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
@@ -13,7 +13,7 @@ class ComposerStaticInit926f2f9a72fc0d16d060cf717f2d1f83
|
|
|
13
13
|
public static function getInitializer(ClassLoader $loader)
|
|
14
14
|
{
|
|
15
15
|
return \Closure::bind(function () use ($loader) {
|
|
16
|
-
$loader->classMap =
|
|
16
|
+
$loader->classMap = ComposerStaticInite42d624f43ff4cbf8159698e9b5bba0f::$classMap;
|
|
17
17
|
|
|
18
18
|
}, null, ClassLoader::class);
|
|
19
19
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'name' => 'automattic/newspack-blocks',
|
|
4
4
|
'pretty_version' => 'dev-master',
|
|
5
5
|
'version' => 'dev-master',
|
|
6
|
-
'reference' => '
|
|
6
|
+
'reference' => 'c022c75c02fe3446888868617f504cc4494ba885',
|
|
7
7
|
'type' => 'wordpress-plugin',
|
|
8
8
|
'install_path' => __DIR__ . '/../../',
|
|
9
9
|
'aliases' => array(),
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
'automattic/newspack-blocks' => array(
|
|
14
14
|
'pretty_version' => 'dev-master',
|
|
15
15
|
'version' => 'dev-master',
|
|
16
|
-
'reference' => '
|
|
16
|
+
'reference' => 'c022c75c02fe3446888868617f504cc4494ba885',
|
|
17
17
|
'type' => 'wordpress-plugin',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|