@automattic/newspack-blocks 4.9.0 → 4.9.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
+ ## [4.9.1](https://github.com/Automattic/newspack-blocks/compare/v4.9.0...v4.9.1) (2025-04-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **donate-block:** handle decimals in custom amount input, fixed ([8090da1](https://github.com/Automattic/newspack-blocks/commit/8090da1d99da9b1e576c7ca0057bb4fbd93e00e8))
7
+
1
8
  # [4.9.0](https://github.com/Automattic/newspack-blocks/compare/v4.8.1...v4.9.0) (2025-03-31)
2
9
 
3
10
 
@@ -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.9.0
10
+ * Version: 4.9.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', '4.9.0' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '4.9.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": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
6
  "@rushstack/eslint-patch": "^1.11.0",
@@ -140,6 +140,18 @@ class Newspack_Blocks_Donate_Renderer_Frequency_Based extends Newspack_Blocks_Do
140
140
 
141
141
  $configuration = self::get_configuration( $attributes );
142
142
 
143
+ // Calculate the value for the "step" property of the custom amount donation value `input` element.
144
+ $input_element_step_attribute = '1';
145
+ $thousand_separator = get_option( 'woocommerce_price_thousand_sep', false );
146
+ $decimals = get_option( 'woocommerce_price_num_decimals', 2 );
147
+ if ( $thousand_separator !== '.' && $decimals > 0 ) {
148
+ // According to the HTML spec, a float can only use a dot (https://html.spec.whatwg.org/dev/common-microsyntaxes.html#valid-floating-point-number).
149
+ // Therefore, an `input[type="number"]` with a `,` decimal separator is invalid HTML.
150
+ // To support separators other than a dot would mean using a standard `input[type="text"]` element,
151
+ // with JS handling the validation and input filtering. This might be revisited in the future.
152
+ $input_element_step_attribute = '0.' . str_repeat( '0', $decimals - 1 ) . '1';
153
+ }
154
+
143
155
  ob_start();
144
156
 
145
157
  /**
@@ -200,6 +212,7 @@ class Newspack_Blocks_Donate_Renderer_Frequency_Based extends Newspack_Blocks_Do
200
212
  name='donation_value_<?php echo esc_attr( $frequency_slug ); ?>_untiered'
201
213
  value='<?php echo esc_attr( $amount ); ?>'
202
214
  id='newspack-<?php echo esc_attr( $frequency_slug . '-' . $uid ); ?>-untiered-input'
215
+ step='<?php echo esc_attr( $input_element_step_attribute ); ?>'
203
216
  />
204
217
  </div>
205
218
  <?php else : ?>
@@ -305,6 +318,7 @@ class Newspack_Blocks_Donate_Renderer_Frequency_Based extends Newspack_Blocks_Do
305
318
  min='<?php echo esc_attr( $configuration['minimumDonation'] ); ?>'
306
319
  name='donation_value_<?php echo esc_attr( $frequency_slug ); ?>_other'
307
320
  id='newspack-tier-<?php echo esc_attr( $frequency_slug . '-' . $uid ); ?>-other-input'
321
+ step='<?php echo esc_attr( $input_element_step_attribute ); ?>'
308
322
  />
309
323
  </div>
310
324
  <?php
@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
22
22
 
23
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
24
 
25
- return ComposerAutoloaderInit074578a2a4bf2e9ded9cf075ff493a97::getLoader();
25
+ return ComposerAutoloaderInitb0d9edd8849fedd7b5cd47883fc7dd6b::getLoader();
@@ -2,7 +2,7 @@
2
2
 
3
3
  // autoload_real.php @generated by Composer
4
4
 
5
- class ComposerAutoloaderInit074578a2a4bf2e9ded9cf075ff493a97
5
+ class ComposerAutoloaderInitb0d9edd8849fedd7b5cd47883fc7dd6b
6
6
  {
7
7
  private static $loader;
8
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit074578a2a4bf2e9ded9cf075ff493a97
22
22
  return self::$loader;
23
23
  }
24
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit074578a2a4bf2e9ded9cf075ff493a97', 'loadClassLoader'), true, true);
25
+ spl_autoload_register(array('ComposerAutoloaderInitb0d9edd8849fedd7b5cd47883fc7dd6b', 'loadClassLoader'), true, true);
26
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit074578a2a4bf2e9ded9cf075ff493a97', 'loadClassLoader'));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitb0d9edd8849fedd7b5cd47883fc7dd6b', 'loadClassLoader'));
28
28
 
29
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit074578a2a4bf2e9ded9cf075ff493a97::getInitializer($loader));
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitb0d9edd8849fedd7b5cd47883fc7dd6b::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 ComposerStaticInit074578a2a4bf2e9ded9cf075ff493a97
7
+ class ComposerStaticInitb0d9edd8849fedd7b5cd47883fc7dd6b
8
8
  {
9
9
  public static $classMap = array (
10
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -13,7 +13,7 @@ class ComposerStaticInit074578a2a4bf2e9ded9cf075ff493a97
13
13
  public static function getInitializer(ClassLoader $loader)
14
14
  {
15
15
  return \Closure::bind(function () use ($loader) {
16
- $loader->classMap = ComposerStaticInit074578a2a4bf2e9ded9cf075ff493a97::$classMap;
16
+ $loader->classMap = ComposerStaticInitb0d9edd8849fedd7b5cd47883fc7dd6b::$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' => '4be679ebaf3aa6b7d0cf4917f52bcae1a8a71a5f',
6
+ 'reference' => '8090da1d99da9b1e576c7ca0057bb4fbd93e00e8',
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' => '4be679ebaf3aa6b7d0cf4917f52bcae1a8a71a5f',
16
+ 'reference' => '8090da1d99da9b1e576c7ca0057bb4fbd93e00e8',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),