@automattic/newspack-blocks 4.17.5 → 4.17.6

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.17.6](https://github.com/Automattic/newspack-blocks/compare/v4.17.5...v4.17.6) (2025-11-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * don’t show trial info in modal checkout if not applicable ([#2245](https://github.com/Automattic/newspack-blocks/issues/2245)) ([26de0b9](https://github.com/Automattic/newspack-blocks/commit/26de0b9cf223dd3e5c5d4ee56ba6a8a915554baf))
7
+
1
8
  ## [4.17.5](https://github.com/Automattic/newspack-blocks/compare/v4.17.4...v4.17.5) (2025-11-18)
2
9
 
3
10
 
@@ -1838,7 +1838,7 @@ final class Modal_Checkout {
1838
1838
  *
1839
1839
  * @return false|int User ID if found by email address, false otherwise.
1840
1840
  */
1841
- private static function get_user_id_from_email() {
1841
+ public static function get_user_id_from_email() {
1842
1842
  $billing_email = filter_input( INPUT_POST, 'billing_email', FILTER_SANITIZE_EMAIL );
1843
1843
  if ( $billing_email ) {
1844
1844
  $customer = \get_user_by( 'email', $billing_email );
@@ -26,7 +26,7 @@ final class Checkout_Data {
26
26
  $price = '0';
27
27
  }
28
28
 
29
- if ( function_exists( 'wcs_price_string' ) && function_exists( 'wc_price' ) ) {
29
+ if ( function_exists( 'wcs_price_string' ) && function_exists( 'wc_price' ) && function_exists( 'wc_get_product' ) && class_exists( 'WC_Subscriptions_Product' ) ) {
30
30
  if ( $frequency && $frequency !== 'once' ) {
31
31
  // Get additional subscription details if product_id is provided.
32
32
  $subscription_interval = 1;
@@ -35,10 +35,11 @@ final class Checkout_Data {
35
35
  $initial_amount = 0;
36
36
 
37
37
  if ( $product_id ) {
38
- $subscription_interval = get_post_meta( $product_id, '_subscription_period_interval', true );
39
- $trial_length = get_post_meta( $product_id, '_subscription_trial_length', true );
40
- $trial_period = get_post_meta( $product_id, '_subscription_trial_period', true );
41
- $initial_amount = get_post_meta( $product_id, '_subscription_sign_up_fee', true );
38
+ $product = wc_get_product( $product_id );
39
+ $subscription_interval = \WC_Subscriptions_Product::get_interval( $product );
40
+ $trial_length = \WC_Subscriptions_Product::get_trial_length( $product );
41
+ $trial_period = \WC_Subscriptions_Product::get_trial_period( $product );
42
+ $initial_amount = \WC_Subscriptions_Product::get_sign_up_fee( $product );
42
43
 
43
44
  if ( empty( $subscription_interval ) ) {
44
45
  $subscription_interval = 1;
@@ -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.17.5
10
+ * Version: 4.17.6
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.17.5' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '4.17.6' );
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.17.5",
3
+ "version": "4.17.6",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
6
  "@rushstack/eslint-patch": "^1.12.0",
@@ -3,7 +3,7 @@
3
3
  'name' => 'automattic/newspack-blocks',
4
4
  'pretty_version' => 'dev-trunk',
5
5
  'version' => 'dev-trunk',
6
- 'reference' => '0c2ed81a0ec2f68ae1aff3eb98633ed52def3218',
6
+ 'reference' => '26de0b9cf223dd3e5c5d4ee56ba6a8a915554baf',
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' => '0c2ed81a0ec2f68ae1aff3eb98633ed52def3218',
16
+ 'reference' => '26de0b9cf223dd3e5c5d4ee56ba6a8a915554baf',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),