@automattic/newspack-blocks 4.14.1 → 4.14.2

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,3 +1,10 @@
1
+ ## [4.14.2](https://github.com/Automattic/newspack-blocks/compare/v4.14.1...v4.14.2) (2025-07-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * revert payment gateway check changes from [#2135](https://github.com/Automattic/newspack-blocks/issues/2135) ([#2160](https://github.com/Automattic/newspack-blocks/issues/2160)) ([0bb9977](https://github.com/Automattic/newspack-blocks/commit/0bb9977a3b1328013b16f59f030faacb64fed9c8))
7
+
1
8
  ## [4.14.1](https://github.com/Automattic/newspack-blocks/compare/v4.14.0...v4.14.1) (2025-07-02)
2
9
 
3
10
 
@@ -125,13 +125,6 @@ final class Modal_Checkout {
125
125
  'woocommerce_payments',
126
126
  ];
127
127
 
128
- /**
129
- * Cached result of payment gateway check.
130
- *
131
- * @var bool|null
132
- */
133
- private static $payment_gateway_check_result = null;
134
-
135
128
  /**
136
129
  * Initialize hooks.
137
130
  */
@@ -143,9 +136,6 @@ final class Modal_Checkout {
143
136
  add_action( 'wp_ajax_abandon_modal_checkout', [ __CLASS__, 'process_abandon_checkout' ] );
144
137
  add_action( 'wp_ajax_nopriv_abandon_modal_checkout', [ __CLASS__, 'process_abandon_checkout' ] );
145
138
 
146
- // Perform payment gateway check after WooCommerce is fully initialized.
147
- add_action( 'woocommerce_init', [ __CLASS__, 'has_unsupported_payment_gateway' ] );
148
-
149
139
  add_filter( 'wp_redirect', [ __CLASS__, 'pass_url_param_on_redirect' ] );
150
140
  add_filter( 'woocommerce_cart_product_cannot_be_purchased_message', [ __CLASS__, 'woocommerce_cart_product_cannot_be_purchased_message' ], 10, 2 );
151
141
  add_filter( 'woocommerce_add_error', [ __CLASS__, 'hide_expiry_message_shop_link' ] );
@@ -279,38 +269,16 @@ final class Modal_Checkout {
279
269
  * @return boolean
280
270
  */
281
271
  public static function has_unsupported_payment_gateway() {
282
- // Return saved result if available.
283
- if ( null !== self::$payment_gateway_check_result ) {
284
- return self::$payment_gateway_check_result;
285
- }
286
-
287
- // Only perform check if WooCommerce is fully initialized.
288
- if ( ! function_exists( 'WC' ) || ! WC() || ! WC()->payment_gateways ) {
289
- return false;
290
- }
291
-
292
- $supported_gateways = self::get_supported_payment_gateways();
293
- $available_gateways = WC()->payment_gateways->get_available_payment_gateways();
294
-
295
- // If no gateways are available yet, assume that they are not supported.
296
- if ( empty( $available_gateways ) ) {
297
- return true;
298
- }
299
-
300
- $unsupported_gateways = [];
272
+ $supported_gateways = self::get_supported_payment_gateways();
273
+ $available_gateways = function_exists( 'WC' ) ? \WC()->payment_gateways->get_available_payment_gateways() : [];
274
+ $unsupported_payment_gateway = false;
301
275
  foreach ( $available_gateways as $id => $gateway ) {
302
276
  if ( ! in_array( $id, $supported_gateways, true ) ) {
303
- $unsupported_gateways[] = $id;
277
+ $unsupported_payment_gateway = true;
278
+ break;
304
279
  }
305
280
  }
306
-
307
- if ( ! empty( $unsupported_gateways ) ) {
308
- self::$payment_gateway_check_result = true;
309
- return true;
310
- }
311
-
312
- self::$payment_gateway_check_result = false;
313
- return false;
281
+ return $unsupported_payment_gateway;
314
282
  }
315
283
 
316
284
  /**
@@ -7,7 +7,7 @@
7
7
  * Author URI: https://newspack.com/
8
8
  * Text Domain: newspack-blocks
9
9
  * Domain Path: /languages
10
- * Version: 4.14.1
10
+ * Version: 4.14.2
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', '4.14.1' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '4.14.2' );
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": "4.14.1",
3
+ "version": "4.14.2",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
6
  "@rushstack/eslint-patch": "^1.11.0",
@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
22
22
 
23
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
24
 
25
- return ComposerAutoloaderInit7395ea5d9613c557e99a3d5567d4cb9d::getLoader();
25
+ return ComposerAutoloaderInit2b63400251b15bcc8ee08c0906b4067e::getLoader();
@@ -2,7 +2,7 @@
2
2
 
3
3
  // autoload_real.php @generated by Composer
4
4
 
5
- class ComposerAutoloaderInit7395ea5d9613c557e99a3d5567d4cb9d
5
+ class ComposerAutoloaderInit2b63400251b15bcc8ee08c0906b4067e
6
6
  {
7
7
  private static $loader;
8
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit7395ea5d9613c557e99a3d5567d4cb9d
22
22
  return self::$loader;
23
23
  }
24
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit7395ea5d9613c557e99a3d5567d4cb9d', 'loadClassLoader'), true, true);
25
+ spl_autoload_register(array('ComposerAutoloaderInit2b63400251b15bcc8ee08c0906b4067e', 'loadClassLoader'), true, true);
26
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit7395ea5d9613c557e99a3d5567d4cb9d', 'loadClassLoader'));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit2b63400251b15bcc8ee08c0906b4067e', 'loadClassLoader'));
28
28
 
29
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit7395ea5d9613c557e99a3d5567d4cb9d::getInitializer($loader));
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit2b63400251b15bcc8ee08c0906b4067e::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 ComposerStaticInit7395ea5d9613c557e99a3d5567d4cb9d
7
+ class ComposerStaticInit2b63400251b15bcc8ee08c0906b4067e
8
8
  {
9
9
  public static $classMap = array (
10
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -13,7 +13,7 @@ class ComposerStaticInit7395ea5d9613c557e99a3d5567d4cb9d
13
13
  public static function getInitializer(ClassLoader $loader)
14
14
  {
15
15
  return \Closure::bind(function () use ($loader) {
16
- $loader->classMap = ComposerStaticInit7395ea5d9613c557e99a3d5567d4cb9d::$classMap;
16
+ $loader->classMap = ComposerStaticInit2b63400251b15bcc8ee08c0906b4067e::$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-trunk',
5
5
  'version' => 'dev-trunk',
6
- 'reference' => 'bca370e64ecf0003e4e83213e393a9389518fef4',
6
+ 'reference' => '0bb9977a3b1328013b16f59f030faacb64fed9c8',
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-trunk',
15
15
  'version' => 'dev-trunk',
16
- 'reference' => 'bca370e64ecf0003e4e83213e393a9389518fef4',
16
+ 'reference' => '0bb9977a3b1328013b16f59f030faacb64fed9c8',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),