@automattic/newspack-blocks 2.3.0-alpha.1 → 2.3.0-alpha.3
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/.cache/babel/29d960d2fc51492a4bea1f4f165810fb.json.gz +0 -0
- package/CHANGELOG.md +5 -10
- package/dist/tiersBased.asset.php +1 -1
- package/dist/tiersBased.js +1 -1
- package/includes/class-modal-checkout.php +3 -3
- package/newspack-blocks.php +2 -2
- package/package.json +1 -1
- package/src/blocks/donate/tiers-based/view.ts +7 -1
- package/src/modal-checkout/templates/checkout-form.php +3 -3
- 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/.cache/babel/5a10c5e355a20dbaa488dedf5247e5cf.json.gz +0 -0
|
Binary file
|
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
# [2.3.0-alpha.
|
|
1
|
+
# [2.3.0-alpha.3](https://github.com/Automattic/newspack-blocks/compare/v2.3.0-alpha.2...v2.3.0-alpha.3) (2023-12-04)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
* **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))
|
|
6
|
+
* update selected tier behavior for donate block ([#1617](https://github.com/Automattic/newspack-blocks/issues/1617)) ([8a9a76f](https://github.com/Automattic/newspack-blocks/commit/8a9a76fb970ffac6f00f67f83a17a931a169c103))
|
|
8
7
|
|
|
8
|
+
## [2.2.3](https://github.com/Automattic/newspack-blocks/compare/v2.2.2...v2.2.3) (2023-12-04)
|
|
9
9
|
|
|
10
|
-
### Features
|
|
11
|
-
|
|
12
|
-
* improve performance of modal checkout ([#1607](https://github.com/Automattic/newspack-blocks/issues/1607)) ([a48d190](https://github.com/Automattic/newspack-blocks/commit/a48d19068cc0fc22d36f6371bdee447f72177ed7))
|
|
13
|
-
* **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))
|
|
14
10
|
|
|
11
|
+
### Bug Fixes
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* **modal-checkout:** process checkout request earlier ([#1612](https://github.com/Automattic/newspack-blocks/issues/1612)) ([5c58f5e](https://github.com/Automattic/newspack-blocks/commit/5c58f5e811bb24098afb093c3a4efbb8efa83d4a))
|
|
13
|
+
* update selected tier behavior for donate block ([#1617](https://github.com/Automattic/newspack-blocks/issues/1617)) ([8a9a76f](https://github.com/Automattic/newspack-blocks/commit/8a9a76fb970ffac6f00f67f83a17a931a169c103))
|
|
19
14
|
|
|
20
15
|
## [2.2.2](https://github.com/Automattic/newspack-blocks/compare/v2.2.1...v2.2.2) (2023-11-29)
|
|
21
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '
|
|
1
|
+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'a736f6d9cc9b56225e886b53f4ea8baf');
|
package/dist/tiersBased.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var t={7954:t=>{var e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,i=/^0o[0-7]+$/i,o=parseInt,a="object"==typeof window&&window&&window.Object===Object&&window,u="object"==typeof self&&self&&self.Object===Object&&self,c=a||u||Function("return this")(),
|
|
1
|
+
(()=>{var t={7954:t=>{var e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,i=/^0o[0-7]+$/i,o=parseInt,a="object"==typeof window&&window&&window.Object===Object&&window,u="object"==typeof self&&self&&self.Object===Object&&self,c=a||u||Function("return this")(),s=Object.prototype.toString,d=Math.max,l=Math.min,f=function(){return c.Date.now()};function b(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function v(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==s.call(t)}(t))return NaN;if(b(t)){var a="function"==typeof t.valueOf?t.valueOf():t;t=b(a)?a+"":a}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(e,"");var u=r.test(t);return u||i.test(t)?o(t.slice(2),u?2:8):n.test(t)?NaN:+t}t.exports=function(t,e,n){var r,i,o,a,u,c,s=0,p=!1,y=!1,_=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){var n=r,o=i;return r=i=void 0,s=e,a=t.apply(o,n)}function w(t){return s=t,u=setTimeout(g,e),p?m(t):a}function h(t){var n=t-c;return void 0===c||n>=e||n<0||y&&t-s>=o}function g(){var t=f();if(h(t))return q(t);u=setTimeout(g,function(t){var n=e-(t-c);return y?l(n,o-(t-s)):n}(t))}function q(t){return u=void 0,_&&r?m(t):(r=i=void 0,a)}function S(){var t=f(),n=h(t);if(r=arguments,i=this,c=t,n){if(void 0===u)return w(c);if(y)return u=setTimeout(g,e),m(c)}return void 0===u&&(u=setTimeout(g,e)),a}return e=v(e)||0,b(n)&&(p=!!n.leading,o=(y="maxWait"in n)?d(v(n.maxWait)||0,e):o,_="trailing"in n?!!n.trailing:_),S.cancel=function(){void 0!==u&&clearTimeout(u),s=0,r=c=i=u=void 0},S.flush=function(){return void 0===u?a:q(f())},S}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{processTiersBasedElements:()=>s});var t=n(7954),e=n.n(t),i=function(t,n){var r=t.querySelector(".wpbnbd__tiers__options"),i=t.querySelector(".wpbnbd__tiers__options__dots");if(r&&i&&n){var o=function(){return Array.from(r.children).map((function(t){return{el:t,width:t.clientWidth}}))},a=o(),u=Math.round(a.length/2)-1,c=function(){return a[u].width},s=function(){return a.map((function(t,e){return d*e}))},d=c(),l=s(),f=u*d;window.addEventListener("resize",(function(){a=o(),d=c(),l=s(),r.scrollTo(f,0)}));var b=Array.from(i.children),v=e()((function(){var t,e,i,o=(t=l,e=r.scrollLeft,i=t.reduce((function(t,n){return Math.abs(n-e)<Math.abs(t)?n-e:t}),1/0)+e,t.indexOf(i));b.forEach((function(t,e){t.style.backgroundColor=e===o?n.buttonColor:""}))}),100);r.addEventListener("scroll",v),b.forEach((function(t,e){t.addEventListener("click",(function(){r.scrollTo({left:e*d,behavior:"smooth"})}))})),r.scrollTo(f,0)}},o="wpbnbd__button--active",a=function(t){return'.wpbnbd__tiers__amount [data-frequency-slug="'.concat(t,'"]')};const u=function(t){var e=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{var e=JSON.parse(t);return{params:{frequency:e[0],tierPrefix:e[1]},initialFrequency:e[2],tiersBasedOptions:e[3],amounts:e[4],renewsAt:{month:e[5],year:e[6]},isRenderingStripePaymentForm:e[7],buttonColor:e[8]}}catch(n){return!1}}(t.getAttribute("data-tiers-based-config")||"");if(e){var n=t.querySelectorAll(".wpbnbd__tiers__selection button"),r=t.querySelectorAll(".wpbnbd__tiers__amount [data-frequency-slug]"),u=t.querySelector('input[name="'.concat(e.params.frequency,'"]')),c=t.querySelector("form[data-is-init-form]");if(n&&r&&u&&c){i(t,e);var s=e.initialFrequency,d=0;n.forEach((function(i){i.addEventListener("click",(function(){var c=i.getAttribute("data-frequency-slug");c&&(s=c,u.setAttribute("value",s),r.forEach((function(t){return t.style.display="none"})),t.querySelectorAll(a(s)).forEach((function(t){return t.style.display="inline"})),n.forEach((function(t){s===t.getAttribute("data-frequency-slug")?t.classList.add(o):t.classList.remove(o)})),t.querySelectorAll('button[type="submit"]').forEach((function(t){if(s){t.setAttribute("name","".concat(e.params.tierPrefix).concat(s));var n=t.getAttribute("data-tier-index"),r=document.querySelector("".concat(a(s),'[data-tier-index="').concat(n,'"]'));if(r){var i=r.getAttribute("data-amount");i&&t.setAttribute("value",i)}}})))}))}));var l=t.querySelector("button.wpbnbd__tiers__back-button"),f=t.querySelectorAll(".wpbnbd__tiers__tier button"),b=t.querySelectorAll(".wpbnbd__tiers__view"),v=function(){return b.forEach((function(t){return t.classList.toggle("wpbnbd__tiers__view--hidden")}))};f.forEach((function(n){n.addEventListener("click",(function(){var r,i=parseInt(n.getAttribute("data-tier-index")||"");d=i;var o=t.querySelector(".wpbnbd__tiers__tier-tile h2"),a=t.querySelector(".wpbnbd__tiers__tier-tile span[data-amount]"),u=t.querySelector(".wpbnbd__tiers__tier-tile span[data-frequency]"),c=t.querySelector(".wpbnbd__tiers__tier-tile span[data-renews-date]");if(!isNaN(i)&&o&&a&&u&&c){var l=e.tiersBasedOptions[i],f=null===(r=t.querySelector('[data-frequency-slug="'.concat(s,'"]')))||void 0===r?void 0:r.getAttribute("data-frequency-label");o.textContent=l.heading,u.textContent=f||"",a.textContent=e.amounts[s][i],c.textContent=e.renewsAt[s],v()}}))})),e.isRenderingStripePaymentForm&&(c.addEventListener("submit",(function(n){n.preventDefault();var r=t.querySelector("form[data-is-streamlined-form]");if(r){var i=r.querySelector("input[data-is-streamlined-input-amount]"),o=r.querySelector('input[name="'.concat(e.params.frequency,'"]'));if(i&&o){var a=e.amounts[s][d];i.setAttribute("value",a),i.setAttribute("name","".concat(e.params.tierPrefix).concat(s)),o.setAttribute("value",s),r.dispatchEvent(new Event("change"))}}})),null==l||l.addEventListener("click",v)),window.addEventListener("newspackPaymentFlowComplete-".concat(t.id),(function(){l&&(l.style.display="none")}))}}};var c,s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.querySelectorAll(".wpbnbd--tiers-based");e.forEach(u)};"undefined"!=typeof window&&(c=function(){return s()},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",c):c()))})();var i=window;for(var o in r)i[o]=r[o];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
|
|
@@ -155,9 +155,9 @@ final class Modal_Checkout {
|
|
|
155
155
|
$is_newspack_checkout = filter_input( INPUT_GET, 'newspack_checkout', FILTER_SANITIZE_NUMBER_INT );
|
|
156
156
|
$product_id = filter_input( INPUT_GET, 'product_id', FILTER_SANITIZE_NUMBER_INT );
|
|
157
157
|
$variation_id = filter_input( INPUT_GET, 'variation_id', FILTER_SANITIZE_NUMBER_INT );
|
|
158
|
-
$after_success_behavior = filter_input( INPUT_GET, 'after_success_behavior',
|
|
159
|
-
$after_success_url = filter_input( INPUT_GET, 'after_success_url',
|
|
160
|
-
$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 );
|
|
161
161
|
|
|
162
162
|
if ( ! $is_newspack_checkout || ! $product_id ) {
|
|
163
163
|
return;
|
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.3.0-alpha.
|
|
10
|
+
* Version: 2.3.0-alpha.3
|
|
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.3.0-alpha.
|
|
18
|
+
define( 'NEWSPACK_BLOCKS__VERSION', '2.3.0-alpha.3' );
|
|
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
|
@@ -51,7 +51,13 @@ export default ( parentEl: HTMLElement ) => {
|
|
|
51
51
|
selectedAmountEls.forEach( el => ( el.style.display = 'inline' ) );
|
|
52
52
|
|
|
53
53
|
// Toggle the frequency buttons' active states.
|
|
54
|
-
frequencyButtonsEls.forEach( el =>
|
|
54
|
+
frequencyButtonsEls.forEach( el => {
|
|
55
|
+
if ( selectedFrequency === el.getAttribute( 'data-frequency-slug' ) ) {
|
|
56
|
+
el.classList.add( BUTTON_ACTIVE_CLASSNAME );
|
|
57
|
+
} else {
|
|
58
|
+
el.classList.remove( BUTTON_ACTIVE_CLASSNAME );
|
|
59
|
+
}
|
|
60
|
+
} );
|
|
55
61
|
|
|
56
62
|
// Update the value attributes in the form's submit buttons.
|
|
57
63
|
const submitButtonsEls = parentEl.querySelectorAll( 'button[type="submit"]' );
|
|
@@ -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';
|
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 ComposerAutoloaderInit41f247baa9e3dfb7a32ee26fd2d06db2
|
|
6
6
|
{
|
|
7
7
|
private static $loader;
|
|
8
8
|
|
|
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit144e15bc433bc7e56131781af991c07e
|
|
|
22
22
|
return self::$loader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spl_autoload_register(array('
|
|
25
|
+
spl_autoload_register(array('ComposerAutoloaderInit41f247baa9e3dfb7a32ee26fd2d06db2', 'loadClassLoader'), true, true);
|
|
26
26
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
|
27
|
-
spl_autoload_unregister(array('
|
|
27
|
+
spl_autoload_unregister(array('ComposerAutoloaderInit41f247baa9e3dfb7a32ee26fd2d06db2', 'loadClassLoader'));
|
|
28
28
|
|
|
29
29
|
require __DIR__ . '/autoload_static.php';
|
|
30
|
-
call_user_func(\Composer\Autoload\
|
|
30
|
+
call_user_func(\Composer\Autoload\ComposerStaticInit41f247baa9e3dfb7a32ee26fd2d06db2::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 ComposerStaticInit41f247baa9e3dfb7a32ee26fd2d06db2
|
|
8
8
|
{
|
|
9
9
|
public static $classMap = array (
|
|
10
10
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
@@ -13,7 +13,7 @@ class ComposerStaticInit144e15bc433bc7e56131781af991c07e
|
|
|
13
13
|
public static function getInitializer(ClassLoader $loader)
|
|
14
14
|
{
|
|
15
15
|
return \Closure::bind(function () use ($loader) {
|
|
16
|
-
$loader->classMap =
|
|
16
|
+
$loader->classMap = ComposerStaticInit41f247baa9e3dfb7a32ee26fd2d06db2::$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' => '6c6671dc2033e7f050eb6daf876e3a42dfdd14a9',
|
|
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' => '6c6671dc2033e7f050eb6daf876e3a42dfdd14a9',
|
|
17
17
|
'type' => 'wordpress-plugin',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|
|
Binary file
|