@automattic/newspack-blocks 4.18.0-alpha.2 → 4.18.0

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,4 +1,4 @@
1
- # [4.18.0-alpha.2](https://github.com/Automattic/newspack-blocks/compare/v4.18.0-alpha.1...v4.18.0-alpha.2) (2025-11-17)
1
+ # [4.18.0](https://github.com/Automattic/newspack-blocks/compare/v4.17.6...v4.18.0) (2025-11-24)
2
2
 
3
3
 
4
4
  ### Bug Fixes
@@ -8,7 +8,28 @@
8
8
 
9
9
  ### Features
10
10
 
11
+ * **content-loop:** setting labels more generic ([#2246](https://github.com/Automattic/newspack-blocks/issues/2246)) ([9a635e9](https://github.com/Automattic/newspack-blocks/commit/9a635e9ffd86fd558365df1fec08d7943e08941c))
11
12
  * **donate-block:** default frequency for tiered layout ([#2248](https://github.com/Automattic/newspack-blocks/issues/2248)) ([2d07c11](https://github.com/Automattic/newspack-blocks/commit/2d07c111cd678138ad09cec2b768fc7c98e1d35b))
13
+ * **modal-checkout:** processing payment screen ([#2247](https://github.com/Automattic/newspack-blocks/issues/2247)) ([8beea1e](https://github.com/Automattic/newspack-blocks/commit/8beea1e4fc67b150fc06b5a3b46c827a7d908f1c))
14
+
15
+
16
+ ### Reverts
17
+
18
+ * Revert "fix: render modal checkout with filtered supported gateways ([#2240](https://github.com/Automattic/newspack-blocks/issues/2240))" ([#2243](https://github.com/Automattic/newspack-blocks/issues/2243)) ([200412b](https://github.com/Automattic/newspack-blocks/commit/200412bf969fc825090ffbe9b567886827e8eac4))
19
+
20
+ ## [4.17.6](https://github.com/Automattic/newspack-blocks/compare/v4.17.5...v4.17.6) (2025-11-19)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * 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))
26
+
27
+ ## [4.17.5](https://github.com/Automattic/newspack-blocks/compare/v4.17.4...v4.17.5) (2025-11-18)
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * **modal-checkout:** check product type to get recurrence data ([#2259](https://github.com/Automattic/newspack-blocks/issues/2259)) ([0c2ed81](https://github.com/Automattic/newspack-blocks/commit/0c2ed81a0ec2f68ae1aff3eb98633ed52def3218))
12
33
 
13
34
  ## [4.17.4](https://github.com/Automattic/newspack-blocks/compare/v4.17.3...v4.17.4) (2025-11-13)
14
35
 
@@ -1830,7 +1830,7 @@ final class Modal_Checkout {
1830
1830
  *
1831
1831
  * @return false|int User ID if found by email address, false otherwise.
1832
1832
  */
1833
- private static function get_user_id_from_email() {
1833
+ public static function get_user_id_from_email() {
1834
1834
  $billing_email = filter_input( INPUT_POST, 'billing_email', FILTER_SANITIZE_EMAIL );
1835
1835
  if ( $billing_email ) {
1836
1836
  $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;
@@ -81,13 +82,21 @@ final class Checkout_Data {
81
82
  * Returns whether a product is a one time purchase, or recurring and when.
82
83
  *
83
84
  * @param string $product_id Product's ID.
85
+ *
86
+ * @return string The purchase recurrence.
84
87
  */
85
88
  public static function get_purchase_recurrence( $product_id ) {
86
- $recurrence = get_post_meta( $product_id, '_subscription_period', true );
87
- if ( empty( $recurrence ) ) {
88
- $recurrence = 'once';
89
+ if ( ! function_exists( 'wc_get_product' ) ) {
90
+ return 'once';
91
+ }
92
+ $product = \wc_get_product( $product_id );
93
+ if ( $product && ( $product->is_type( 'subscription' ) || $product->is_type( 'subscription_variation' ) ) ) {
94
+ $recurrence = get_post_meta( $product_id, '_subscription_period', true );
95
+ if ( ! empty( $recurrence ) ) {
96
+ return $recurrence;
97
+ }
89
98
  }
90
- return $recurrence;
99
+ return 'once';
91
100
  }
92
101
 
93
102
  /**
@@ -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.18.0-alpha.2
10
+ * Version: 4.18.0
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.18.0-alpha.2' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '4.18.0' );
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.18.0-alpha.2",
3
+ "version": "4.18.0",
4
4
  "author": "Automattic",
5
5
  "description": "=== Newspack Blocks === Contributors: (this should be a list of wordpress.org userid's) Donate link: https://example.com/ Tags: comments, spam Requires at least: 4.5 Tested up to: 5.1.1 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html",
6
6
  "repository": {
@@ -3,7 +3,7 @@
3
3
  'name' => 'automattic/newspack-blocks',
4
4
  'pretty_version' => 'dev-trunk',
5
5
  'version' => 'dev-trunk',
6
- 'reference' => '2d07c111cd678138ad09cec2b768fc7c98e1d35b',
6
+ 'reference' => 'fb8de312e707cf47e24d1c3d7b075988fc885be3',
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' => '2d07c111cd678138ad09cec2b768fc7c98e1d35b',
16
+ 'reference' => 'fb8de312e707cf47e24d1c3d7b075988fc885be3',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),