@automattic/newspack-blocks 2.3.0-alpha.2 → 2.3.0-alpha.4

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 CHANGED
@@ -1,28 +1,23 @@
1
- # [2.3.0-alpha.2](https://github.com/Automattic/newspack-blocks/compare/v2.3.0-alpha.1...v2.3.0-alpha.2) (2023-12-01)
1
+ # [2.3.0-alpha.4](https://github.com/Automattic/newspack-blocks/compare/v2.3.0-alpha.3...v2.3.0-alpha.4) (2023-12-06)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * replace FILTER_SANITIZE_STRING ([6f805b0](https://github.com/Automattic/newspack-blocks/commit/6f805b0806d24f9e44d293a13ca486fdf23c73ab))
6
+ * **homepage-posts:** handle empty block when printing inline styles ([#1621](https://github.com/Automattic/newspack-blocks/issues/1621)) ([c3aa957](https://github.com/Automattic/newspack-blocks/commit/c3aa9577c2284f2139c8fa1170785db9fe4edfe9))
7
7
 
8
- # [2.3.0-alpha.1](https://github.com/Automattic/newspack-blocks/compare/v2.2.2...v2.3.0-alpha.1) (2023-11-30)
8
+ ## [2.2.4](https://github.com/Automattic/newspack-blocks/compare/v2.2.3...v2.2.4) (2023-12-06)
9
9
 
10
10
 
11
11
  ### Bug Fixes
12
12
 
13
- * modal checkout template markup ([#1608](https://github.com/Automattic/newspack-blocks/issues/1608)) ([4d593db](https://github.com/Automattic/newspack-blocks/commit/4d593db4e80b57570e13db2ed203586bab974fb6))
14
- * **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))
13
+ * **homepage-posts:** handle empty block when printing inline styles ([#1621](https://github.com/Automattic/newspack-blocks/issues/1621)) ([c3aa957](https://github.com/Automattic/newspack-blocks/commit/c3aa9577c2284f2139c8fa1170785db9fe4edfe9))
15
14
 
15
+ ## [2.2.3](https://github.com/Automattic/newspack-blocks/compare/v2.2.2...v2.2.3) (2023-12-04)
16
16
 
17
- ### Features
18
-
19
- * improve performance of modal checkout ([#1607](https://github.com/Automattic/newspack-blocks/issues/1607)) ([a48d190](https://github.com/Automattic/newspack-blocks/commit/a48d19068cc0fc22d36f6371bdee447f72177ed7))
20
- * **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))
21
17
 
18
+ ### Bug Fixes
22
19
 
23
- ### Performance Improvements
24
-
25
- * **modal-checkout:** process checkout request earlier ([#1612](https://github.com/Automattic/newspack-blocks/issues/1612)) ([5c58f5e](https://github.com/Automattic/newspack-blocks/commit/5c58f5e811bb24098afb093c3a4efbb8efa83d4a))
20
+ * 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))
26
21
 
27
22
  ## [2.2.2](https://github.com/Automattic/newspack-blocks/compare/v2.2.1...v2.2.2) (2023-11-29)
28
23
 
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-polyfill'), 'version' => 'a1607fccc45bc23b69a937110e6bc516');
1
+ <?php return array('dependencies' => array('wp-polyfill'), 'version' => 'a736f6d9cc9b56225e886b53f4ea8baf');
@@ -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")(),l=Object.prototype.toString,s=Math.max,d=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]"==l.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,l=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,l=e,a=t.apply(o,n)}function w(t){return l=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-l>=o}function g(){var t=f();if(h(t))return S(t);u=setTimeout(g,function(t){var n=e-(t-c);return y?d(n,o-(t-l)):n}(t))}function S(t){return u=void 0,_&&r?m(t):(r=i=void 0,a)}function q(){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)?s(v(n.maxWait)||0,e):o,_="trailing"in n?!!n.trailing:_),q.cancel=function(){void 0!==u&&clearTimeout(u),l=0,r=c=i=u=void 0},q.flush=function(){return void 0===u?a:S(f())},q}}},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:()=>c});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},l=function(){return a.map((function(t,e){return s*e}))},s=c(),d=l(),f=u*s;window.addEventListener("resize",(function(){a=o(),s=c(),d=l(),r.scrollTo(f,0)}));var b=Array.from(i.children),v=e()((function(){var t,e,i,o=(t=d,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*s,behavior:"smooth"})}))})),r.scrollTo(f,0)}},o=function(t){return'.wpbnbd__tiers__amount [data-frequency-slug="'.concat(t,'"]')};const a=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]"),a=t.querySelector('input[name="'.concat(e.params.frequency,'"]')),u=t.querySelector("form[data-is-init-form]");if(n&&r&&a&&u){i(t,e);var c=e.initialFrequency,l=0;n.forEach((function(i){i.addEventListener("click",(function(){var u=i.getAttribute("data-frequency-slug");u&&(c=u,a.setAttribute("value",c),r.forEach((function(t){return t.style.display="none"})),t.querySelectorAll(o(c)).forEach((function(t){return t.style.display="inline"})),n.forEach((function(t){return t.classList.toggle("wpbnbd__button--active")})),t.querySelectorAll('button[type="submit"]').forEach((function(t){if(c){t.setAttribute("name","".concat(e.params.tierPrefix).concat(c));var n=t.getAttribute("data-tier-index"),r=document.querySelector("".concat(o(c),'[data-tier-index="').concat(n,'"]'));if(r){var i=r.getAttribute("data-amount");i&&t.setAttribute("value",i)}}})))}))}));var s=t.querySelector("button.wpbnbd__tiers__back-button"),d=t.querySelectorAll(".wpbnbd__tiers__tier button"),f=t.querySelectorAll(".wpbnbd__tiers__view"),b=function(){return f.forEach((function(t){return t.classList.toggle("wpbnbd__tiers__view--hidden")}))};d.forEach((function(n){n.addEventListener("click",(function(){var r,i=parseInt(n.getAttribute("data-tier-index")||"");l=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]"),s=t.querySelector(".wpbnbd__tiers__tier-tile span[data-renews-date]");if(!isNaN(i)&&o&&a&&u&&s){var d=e.tiersBasedOptions[i],f=null===(r=t.querySelector('[data-frequency-slug="'.concat(c,'"]')))||void 0===r?void 0:r.getAttribute("data-frequency-label");o.textContent=d.heading,u.textContent=f||"",a.textContent=e.amounts[c][i],s.textContent=e.renewsAt[c],b()}}))})),e.isRenderingStripePaymentForm&&(u.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[c][l];i.setAttribute("value",a),i.setAttribute("name","".concat(e.params.tierPrefix).concat(c)),o.setAttribute("value",c),r.dispatchEvent(new Event("change"))}}})),null==s||s.addEventListener("click",b)),window.addEventListener("newspackPaymentFlowComplete-".concat(t.id),(function(){s&&(s.style.display="none")}))}}};var u,c=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.querySelectorAll(".wpbnbd--tiers-based");e.forEach(a)};"undefined"!=typeof window&&(u=function(){return c()},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",u):u()))})();var i=window;for(var o in r)i[o]=r[o];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
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})})();
@@ -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.2
10
+ * Version: 2.3.0-alpha.4
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.2' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '2.3.0-alpha.4' );
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/newspack-blocks",
3
- "version": "2.3.0-alpha.2",
3
+ "version": "2.3.0-alpha.4",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
6
  "@rushstack/eslint-patch": "^1.5.1",
@@ -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 => el.classList.toggle( BUTTON_ACTIVE_CLASSNAME ) );
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"]' );
@@ -227,6 +227,10 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
227
227
  }
228
228
 
229
229
  $block_name = apply_filters( 'newspack_blocks_block_name', 'newspack-blocks/homepage-articles' );
230
+ $article_query = new WP_Query( Newspack_Blocks::build_articles_query( $attributes, $block_name ) );
231
+ if ( ! $article_query->have_posts() ) {
232
+ return;
233
+ }
230
234
 
231
235
  // Gather all Homepage Articles blocks on the page and output only the needed CSS.
232
236
  // This CSS will be printed along with the first found block markup.
@@ -249,8 +253,6 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
249
253
  // This will let the FSE plugin know we need CSS/JS now.
250
254
  do_action( 'newspack_blocks_render_homepage_articles' );
251
255
 
252
- $article_query = new WP_Query( Newspack_Blocks::build_articles_query( $attributes, $block_name ) );
253
-
254
256
  $classes = Newspack_Blocks::block_classes( 'homepage-articles', $attributes, [ 'wpnbha' ] );
255
257
 
256
258
  if ( isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) {
@@ -352,55 +354,53 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
352
354
 
353
355
  ob_start();
354
356
 
355
- if ( $article_query->have_posts() ) :
356
- ?>
357
- <div
358
- class="<?php echo esc_attr( $classes ); ?>"
359
- style="<?php echo esc_attr( $styles ); ?>"
360
- >
361
- <?php echo $inline_style_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
362
- <div data-posts data-current-post-id="<?php the_ID(); ?>">
363
- <?php if ( '' !== $attributes['sectionHeader'] ) : ?>
364
- <h2 class="article-section-title">
365
- <span><?php echo wp_kses_post( $attributes['sectionHeader'] ); ?></span>
366
- </h2>
367
- <?php endif; ?>
368
- <?php
369
- echo Newspack_Blocks::template_inc( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
370
- __DIR__ . '/templates/articles-list.php',
371
- [
372
- 'articles_rest_url' => $articles_rest_url, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
373
- 'article_query' => $article_query, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
374
- 'attributes' => $attributes, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
375
- ]
376
- );
377
- ?>
378
- </div>
379
- <?php
380
-
381
- if ( $has_more_button ) :
382
- ?>
383
- <button type="button" class="wp-block-button__link" data-next="<?php echo esc_url( $articles_rest_url ); ?>">
384
- <?php
385
- if ( ! empty( $attributes['moreButtonText'] ) ) {
386
- echo esc_html( $attributes['moreButtonText'] );
387
- } else {
388
- esc_html_e( 'Load more posts', 'newspack-blocks' );
389
- }
390
- ?>
391
- </button>
392
- <p class="loading">
393
- <?php esc_html_e( 'Loading...', 'newspack-blocks' ); ?>
394
- </p>
395
- <p class="error">
396
- <?php esc_html_e( 'Something went wrong. Please refresh the page and/or try again.', 'newspack-blocks' ); ?>
397
- </p>
398
-
357
+ ?>
358
+ <div
359
+ class="<?php echo esc_attr( $classes ); ?>"
360
+ style="<?php echo esc_attr( $styles ); ?>"
361
+ >
362
+ <?php echo $inline_style_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
363
+ <div data-posts data-current-post-id="<?php the_ID(); ?>">
364
+ <?php if ( '' !== $attributes['sectionHeader'] ) : ?>
365
+ <h2 class="article-section-title">
366
+ <span><?php echo wp_kses_post( $attributes['sectionHeader'] ); ?></span>
367
+ </h2>
399
368
  <?php endif; ?>
400
-
369
+ <?php
370
+ echo Newspack_Blocks::template_inc( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
371
+ __DIR__ . '/templates/articles-list.php',
372
+ [
373
+ 'articles_rest_url' => $articles_rest_url, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
374
+ 'article_query' => $article_query, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
375
+ 'attributes' => $attributes, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
376
+ ]
377
+ );
378
+ ?>
401
379
  </div>
402
380
  <?php
403
- endif;
381
+
382
+ if ( $has_more_button ) :
383
+ ?>
384
+ <button type="button" class="wp-block-button__link" data-next="<?php echo esc_url( $articles_rest_url ); ?>">
385
+ <?php
386
+ if ( ! empty( $attributes['moreButtonText'] ) ) {
387
+ echo esc_html( $attributes['moreButtonText'] );
388
+ } else {
389
+ esc_html_e( 'Load more posts', 'newspack-blocks' );
390
+ }
391
+ ?>
392
+ </button>
393
+ <p class="loading">
394
+ <?php esc_html_e( 'Loading...', 'newspack-blocks' ); ?>
395
+ </p>
396
+ <p class="error">
397
+ <?php esc_html_e( 'Something went wrong. Please refresh the page and/or try again.', 'newspack-blocks' ); ?>
398
+ </p>
399
+
400
+ <?php endif; ?>
401
+
402
+ </div>
403
+ <?php
404
404
 
405
405
  $content = ob_get_clean();
406
406
  Newspack_Blocks::enqueue_view_assets( 'homepage-articles' );
@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
22
22
 
23
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
24
 
25
- return ComposerAutoloaderInit72b26105572f1741b2b4b9a12cd5b2c7::getLoader();
25
+ return ComposerAutoloaderInitc4d43837b94072ba16fbe4f7df49c2fa::getLoader();
@@ -2,7 +2,7 @@
2
2
 
3
3
  // autoload_real.php @generated by Composer
4
4
 
5
- class ComposerAutoloaderInit72b26105572f1741b2b4b9a12cd5b2c7
5
+ class ComposerAutoloaderInitc4d43837b94072ba16fbe4f7df49c2fa
6
6
  {
7
7
  private static $loader;
8
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit72b26105572f1741b2b4b9a12cd5b2c7
22
22
  return self::$loader;
23
23
  }
24
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit72b26105572f1741b2b4b9a12cd5b2c7', 'loadClassLoader'), true, true);
25
+ spl_autoload_register(array('ComposerAutoloaderInitc4d43837b94072ba16fbe4f7df49c2fa', 'loadClassLoader'), true, true);
26
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit72b26105572f1741b2b4b9a12cd5b2c7', 'loadClassLoader'));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitc4d43837b94072ba16fbe4f7df49c2fa', 'loadClassLoader'));
28
28
 
29
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit72b26105572f1741b2b4b9a12cd5b2c7::getInitializer($loader));
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitc4d43837b94072ba16fbe4f7df49c2fa::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 ComposerStaticInit72b26105572f1741b2b4b9a12cd5b2c7
7
+ class ComposerStaticInitc4d43837b94072ba16fbe4f7df49c2fa
8
8
  {
9
9
  public static $classMap = array (
10
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -13,7 +13,7 @@ class ComposerStaticInit72b26105572f1741b2b4b9a12cd5b2c7
13
13
  public static function getInitializer(ClassLoader $loader)
14
14
  {
15
15
  return \Closure::bind(function () use ($loader) {
16
- $loader->classMap = ComposerStaticInit72b26105572f1741b2b4b9a12cd5b2c7::$classMap;
16
+ $loader->classMap = ComposerStaticInitc4d43837b94072ba16fbe4f7df49c2fa::$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' => '6f805b0806d24f9e44d293a13ca486fdf23c73ab',
6
+ 'reference' => 'aa2771d4163a11c79e163d2028e2156a66a62911',
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' => '6f805b0806d24f9e44d293a13ca486fdf23c73ab',
16
+ 'reference' => 'aa2771d4163a11c79e163d2028e2156a66a62911',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),