@automattic/newspack-blocks 2.6.0 → 2.6.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.6.1](https://github.com/Automattic/newspack-blocks/compare/v2.6.0...v2.6.1) (2024-01-31)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **modal-checkout:** treat express checkouts as modal checkouts ([#1654](https://github.com/Automattic/newspack-blocks/issues/1654)) ([a352511](https://github.com/Automattic/newspack-blocks/commit/a3525115aab8f0c6de8038de6e94c1705c7afe9e))
7
+
1
8
  # [2.6.0](https://github.com/Automattic/newspack-blocks/compare/v2.5.0...v2.6.0) (2024-01-25)
2
9
 
3
10
 
@@ -965,6 +965,21 @@ final class Modal_Checkout {
965
965
  if ( ! $is_modal_checkout && isset( $_REQUEST['post_data'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
966
966
  $is_modal_checkout = strpos( $_REQUEST['post_data'], 'modal_checkout=1' ) !== false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
967
967
  }
968
+
969
+ // Express checkout payment requests are separate requests, so they won't have the modal checkout flag. We'll have to check the HTTP_REFERER insteaad.
970
+ $payment_request_type = filter_input( INPUT_POST, 'payment_request_type', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
971
+ $is_express_checkout = ! empty( $payment_request_type ) && in_array( $payment_request_type, [ 'apple_pay', 'google_pay', 'payment_request_api' ], true ); // Validate payment request types: https://github.com/woocommerce/woocommerce-gateway-stripe/blob/develop/includes/payment-methods/class-wc-stripe-payment-request.php#L529-L548.
972
+ if ( $is_express_checkout ) {
973
+ $referrer = isset( $_SERVER['HTTP_REFERER'] ) ? \esc_url_raw( \wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
974
+ if ( $referrer ) {
975
+ $referrer_query = \wp_parse_url( $referrer, PHP_URL_QUERY );
976
+ \wp_parse_str( $referrer_query, $referrer_query_params );
977
+ if ( isset( $referrer_query_params['modal_checkout'] ) && $referrer_query_params['modal_checkout'] ) {
978
+ $is_modal_checkout = true;
979
+ }
980
+ }
981
+ }
982
+
968
983
  return $is_modal_checkout;
969
984
  }
970
985
 
@@ -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.6.0
10
+ * Version: 2.6.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.6.0' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '2.6.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/newspack-blocks",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
6
  "@rushstack/eslint-patch": "^1.5.1",
@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
22
22
 
23
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
24
 
25
- return ComposerAutoloaderInit41f0d87ca16800f448aaf1e29adfd07d::getLoader();
25
+ return ComposerAutoloaderInit7ef41f9eb95af44578d9e3aa646cd364::getLoader();
@@ -2,7 +2,7 @@
2
2
 
3
3
  // autoload_real.php @generated by Composer
4
4
 
5
- class ComposerAutoloaderInit41f0d87ca16800f448aaf1e29adfd07d
5
+ class ComposerAutoloaderInit7ef41f9eb95af44578d9e3aa646cd364
6
6
  {
7
7
  private static $loader;
8
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit41f0d87ca16800f448aaf1e29adfd07d
22
22
  return self::$loader;
23
23
  }
24
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit41f0d87ca16800f448aaf1e29adfd07d', 'loadClassLoader'), true, true);
25
+ spl_autoload_register(array('ComposerAutoloaderInit7ef41f9eb95af44578d9e3aa646cd364', 'loadClassLoader'), true, true);
26
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit41f0d87ca16800f448aaf1e29adfd07d', 'loadClassLoader'));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit7ef41f9eb95af44578d9e3aa646cd364', 'loadClassLoader'));
28
28
 
29
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit41f0d87ca16800f448aaf1e29adfd07d::getInitializer($loader));
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit7ef41f9eb95af44578d9e3aa646cd364::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 ComposerStaticInit41f0d87ca16800f448aaf1e29adfd07d
7
+ class ComposerStaticInit7ef41f9eb95af44578d9e3aa646cd364
8
8
  {
9
9
  public static $classMap = array (
10
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -13,7 +13,7 @@ class ComposerStaticInit41f0d87ca16800f448aaf1e29adfd07d
13
13
  public static function getInitializer(ClassLoader $loader)
14
14
  {
15
15
  return \Closure::bind(function () use ($loader) {
16
- $loader->classMap = ComposerStaticInit41f0d87ca16800f448aaf1e29adfd07d::$classMap;
16
+ $loader->classMap = ComposerStaticInit7ef41f9eb95af44578d9e3aa646cd364::$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' => '43be7d96bfc75c62175bee790275b7b9bf76c215',
6
+ 'reference' => 'a3525115aab8f0c6de8038de6e94c1705c7afe9e',
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' => '43be7d96bfc75c62175bee790275b7b9bf76c215',
16
+ 'reference' => 'a3525115aab8f0c6de8038de6e94c1705c7afe9e',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),