@automattic/newspack-blocks 1.57.0 → 1.58.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.
Files changed (97) hide show
  1. package/.cache/babel/00255e6096be9e31ec354db849dfefaa.json.gz +0 -0
  2. package/.cache/babel/03ee6a9b413adafb1d24ee7efe4e0de7.json.gz +0 -0
  3. package/.cache/babel/0c12c4398bbbf2d771b13dd1d0e64097.json.gz +0 -0
  4. package/.cache/babel/{6b91a44d9cf1f1637760f08ca7007f6c.json.gz → 0d4960812610f2f863b7c53527ae85ac.json.gz} +0 -0
  5. package/.cache/babel/11204cbbf0ea2c37c74c52ef24eee1cf.json.gz +0 -0
  6. package/.cache/babel/17a433ab631a32d0712f3f75cf85ea99.json.gz +0 -0
  7. package/.cache/babel/2143ceff6d186bc13bc902e0f1f33dbf.json.gz +0 -0
  8. package/.cache/babel/281ca171ce8947f87f574df11059e00b.json.gz +0 -0
  9. package/.cache/babel/2da6786ede3ddda4c86eeac524a6a796.json.gz +0 -0
  10. package/.cache/babel/{71371fcf9db60a3a1e024991cb3b4bf3.json.gz → 3266d1d76445fa1073cfe2cee8994f03.json.gz} +0 -0
  11. package/.cache/babel/38b1f9b72e3b22262c5b0fd0a3ea002a.json.gz +0 -0
  12. package/.cache/babel/{135b54a95dc2dbf2a490d2082c47927b.json.gz → 3975ca3d8d9ca3c68d7ea3f58fb76b47.json.gz} +0 -0
  13. package/.cache/babel/{16e3bf3539f6599603cd50264ed387cd.json.gz → 3b2c440027c793c8f7978d7622cbfca0.json.gz} +0 -0
  14. package/.cache/babel/3fa1dbae1ebf6204aa04a8081e410f2e.json.gz +0 -0
  15. package/.cache/babel/{982d5c0203e2985c886fcae84400c10f.json.gz → 427a6423ebde76bcb488747127e47351.json.gz} +0 -0
  16. package/.cache/babel/480d26447b7ee019a37e4e18422403e9.json.gz +0 -0
  17. package/.cache/babel/{360ba23978d689820fc00bdcdc20f25b.json.gz → 573a6a858ebefcfc8d03bcc121ded073.json.gz} +0 -0
  18. package/.cache/babel/6333c664d69f13036f42bcf575c8e65d.json.gz +0 -0
  19. package/.cache/babel/{45352fcfd93e7066291df99d4a1adc48.json.gz → 63e7b9aa8a81ea06587cc196172bf2ad.json.gz} +0 -0
  20. package/.cache/babel/{716d63bab53dda7512875ba9f9cd2809.json.gz → 648cffdd5ec4a2446f8935a17b98080b.json.gz} +0 -0
  21. package/.cache/babel/{f50f27ba4b367318e30e91dbe003e5c8.json.gz → 6d07c1a0b2768b0433b8f1b9d16eae11.json.gz} +0 -0
  22. package/.cache/babel/6ef313cb6d3a59f73a6b78e1a729fb13.json.gz +0 -0
  23. package/.cache/babel/72321dde68f0bb9c334d90d6f4584be8.json.gz +0 -0
  24. package/.cache/babel/{3dfc7ef8cd5b05a687aec86c55d987a1.json.gz → 7e21e4c521dc1687d10e47ca1cba5ccd.json.gz} +0 -0
  25. package/.cache/babel/{347417d83405bac53ff3126377775cff.json.gz → 81fcb17d42a554573a91ef0b1cfe2f82.json.gz} +0 -0
  26. package/.cache/babel/{222c0ebeba5b6d47620d460ce4dddb2f.json.gz → 8959ab8fcfa783cb56e9418b99c0951c.json.gz} +0 -0
  27. package/.cache/babel/{7d19881ff4e24afd3a6b3ecb16b6f137.json.gz → 8ca686b1603d30fd05ff210182b49660.json.gz} +0 -0
  28. package/.cache/babel/{43e8a184b2c88b76ab5d3f74e7da5c9b.json.gz → 8de5c373bbc4b6fbeec373d582935887.json.gz} +0 -0
  29. package/.cache/babel/{bfa345e2a31bc09a8533c28e0d3897a2.json.gz → 8e35fb010830b9aec84e125915cf4afd.json.gz} +0 -0
  30. package/.cache/babel/8e4356bb363ec8feca62c892193583e8.json.gz +0 -0
  31. package/.cache/babel/8f24517cff634d2e91c19e51be8816cc.json.gz +0 -0
  32. package/.cache/babel/{bcbfa796f1ebd36be6dfa1c04603eb85.json.gz → 963b1e44be998c4dcc6845745c377369.json.gz} +0 -0
  33. package/.cache/babel/{c1c66b5df03ee927b03731d1ffc9b12e.json.gz → 975dfea566db37a1a09322effcd7e124.json.gz} +0 -0
  34. package/.cache/babel/{6e2e98bfc24542fc076ffaeccac35aef.json.gz → 9ec25be8a78e2838aa277d1211297f45.json.gz} +0 -0
  35. package/.cache/babel/{89de12a7b3c31be7b9670d3d5bf6992b.json.gz → a5405f86b8d1485e62a125275507e60f.json.gz} +0 -0
  36. package/.cache/babel/{0be72f2c4dcf90e53a21c17a61b813a5.json.gz → a8a6812e1c7b65cc6d0bdebe2a35c8ca.json.gz} +0 -0
  37. package/.cache/babel/abfad2632df08f961d60b11fc146d38f.json.gz +0 -0
  38. package/.cache/babel/b3a335ab950f502914013810b43b0ad5.json.gz +0 -0
  39. package/.cache/babel/{2ef414e63685642b486b71a962a5cc09.json.gz → b6f74d8551c5af82f277e67bc9978c5e.json.gz} +0 -0
  40. package/.cache/babel/{77329d55fddfede9bf39d3cea09f124c.json.gz → ba711530bd319618a0510d8361bebb45.json.gz} +0 -0
  41. package/.cache/babel/{c5ef6d77f32bff979468a18e339d0df3.json.gz → ba99f69b07bc475d53d1121387396514.json.gz} +0 -0
  42. package/.cache/babel/bb9a2c39b3e8555b578d242cd4477180.json.gz +0 -0
  43. package/.cache/babel/c1763075e83157fa2cb2c98bb58a134e.json.gz +0 -0
  44. package/.cache/babel/c8b10cf6f706fb669d6dd7564385768d.json.gz +0 -0
  45. package/.cache/babel/d1c60b4b717e103f2dddf0dbeb274e89.json.gz +0 -0
  46. package/.cache/babel/db5215643b0737dc5245972a5c25f736.json.gz +0 -0
  47. package/.cache/babel/{428696c483a193dae4fd10ca50507f13.json.gz → e6ce03a9908c9c4dc2c723531f1073f6.json.gz} +0 -0
  48. package/.cache/babel/{e54ab6f751b764475a5e98500354c854.json.gz → eb854e03c810bdb969497b2a36119bfa.json.gz} +0 -0
  49. package/.cache/babel/ec25bb53826070b7f301e64f02355b8c.json.gz +0 -0
  50. package/.cache/babel/fb05a8c9fe507b5b3ec88c5e5bb5bb15.json.gz +0 -0
  51. package/.cache/babel/fca370866bdd67aa150a2e218952090b.json.gz +0 -0
  52. package/CHANGELOG.md +26 -0
  53. package/README.md +5 -1
  54. package/composer.json +9 -1
  55. package/composer.lock +1872 -177
  56. package/dist/carousel/view.asset.php +1 -1
  57. package/dist/carousel/view.js +1 -1
  58. package/dist/donateStreamlined.asset.php +1 -1
  59. package/dist/donateStreamlined.js +1 -1
  60. package/dist/editor.asset.php +1 -1
  61. package/dist/editor.js +5 -5
  62. package/newspack-blocks.php +2 -2
  63. package/package.json +7 -7
  64. package/src/blocks/donate/class-wp-rest-newspack-donate-controller.php +12 -8
  65. package/src/blocks/donate/streamlined/index.ts +8 -0
  66. package/src/blocks/donate/streamlined/utils.ts +6 -1
  67. package/src/blocks/donate/view.php +1 -1
  68. package/vendor/autoload.php +1 -1
  69. package/vendor/composer/autoload_real.php +4 -4
  70. package/vendor/composer/autoload_static.php +2 -2
  71. package/vendor/composer/installed.php +2 -2
  72. package/.cache/babel/1e7b99d3f4417381523ebcf71ad9e022.json.gz +0 -0
  73. package/.cache/babel/288e99252b9199a1901ad8ff034bcc0f.json.gz +0 -0
  74. package/.cache/babel/2ccf55a034174d61b60710dced2ec4fc.json.gz +0 -0
  75. package/.cache/babel/2de76e1f605aa116a3c683124fc6b427.json.gz +0 -0
  76. package/.cache/babel/35e5128bd317a0e2dd21b79c86af6aea.json.gz +0 -0
  77. package/.cache/babel/3975901bce3f47a2a682d190007d7ac0.json.gz +0 -0
  78. package/.cache/babel/571255733c4c403fc96c2a6e8d6c07d4.json.gz +0 -0
  79. package/.cache/babel/5b6c81be9c2f78728c02e68d7c551b98.json.gz +0 -0
  80. package/.cache/babel/5c72ea72414db575ad09b6c47a89caaf.json.gz +0 -0
  81. package/.cache/babel/63f2adb2a7ce4cbd6162c9669aa1402c.json.gz +0 -0
  82. package/.cache/babel/6937dc2a29257b2530470046d91dc67f.json.gz +0 -0
  83. package/.cache/babel/6ace59a2e7815ffc030edeb72f5eddb7.json.gz +0 -0
  84. package/.cache/babel/6f3d4b24121944865c8dfec81f4632d8.json.gz +0 -0
  85. package/.cache/babel/725e695c6992a4d01573b83867255ea9.json.gz +0 -0
  86. package/.cache/babel/7557a4c53a70a37c63225204d4c0861e.json.gz +0 -0
  87. package/.cache/babel/876e42a53b2af16090e8d9d5eb51736d.json.gz +0 -0
  88. package/.cache/babel/8966cff6915a38b79627cf406cbad473.json.gz +0 -0
  89. package/.cache/babel/993e16c7a6d6e525d80b9fbf4cfb4d8a.json.gz +0 -0
  90. package/.cache/babel/99c5500f66a78b4638ccb09b75f47131.json.gz +0 -0
  91. package/.cache/babel/aeccd7f0e81234276558a2ca75c9d096.json.gz +0 -0
  92. package/.cache/babel/bcb5d46de2f506661ce92afe876493b4.json.gz +0 -0
  93. package/.cache/babel/ccb609d68e60c9bab58109dc547aebfa.json.gz +0 -0
  94. package/.cache/babel/e467ac5c55ed9169a8b8e32ede515ccb.json.gz +0 -0
  95. package/.cache/babel/ed58d8ad423f2d071771ec9862c023bb.json.gz +0 -0
  96. package/.cache/babel/f97d3db2ff21560c4938e072bdcadaa6.json.gz +0 -0
  97. package/.cache/babel/fc5388fde6874a49aaf4764a60f50d49.json.gz +0 -0
@@ -7,7 +7,7 @@
7
7
  * Author URI: https://newspack.blog/
8
8
  * Text Domain: newspack-blocks
9
9
  * Domain Path: /languages
10
- * Version: 1.57.0
10
+ * Version: 1.58.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', '1.57.0' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '1.58.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,10 +1,10 @@
1
1
  {
2
2
  "name": "@automattic/newspack-blocks",
3
- "version": "1.57.0",
3
+ "version": "1.58.0",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
- "@rushstack/eslint-patch": "^1.1.4",
7
- "@testing-library/dom": "^8.17.1",
6
+ "@rushstack/eslint-patch": "^1.2.0",
7
+ "@testing-library/dom": "^8.18.1",
8
8
  "@testing-library/user-event": "^14.4.3",
9
9
  "eslint": "^7.32.0",
10
10
  "fetch-mock-jest": "^1.5.1",
@@ -12,21 +12,21 @@
12
12
  "identity-obj-proxy": "^3.0.0",
13
13
  "lint-staged": "^13.0.3",
14
14
  "newspack-scripts": "^4.3.0",
15
- "postcss-scss": "^4.0.4",
15
+ "postcss-scss": "^4.0.5",
16
16
  "prettier": "npm:wp-prettier@^2.6.2-beta-1",
17
17
  "stylelint": "^14.9.1"
18
18
  },
19
19
  "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",
20
20
  "dependencies": {
21
- "@stripe/stripe-js": "^1.35.0",
22
- "classnames": "^2.3.1",
21
+ "@stripe/stripe-js": "^1.36.0",
22
+ "classnames": "^2.3.2",
23
23
  "lodash": "^4.17.21",
24
24
  "newspack-components": "^2.1.0",
25
25
  "react": "^17.0.2",
26
26
  "redux": "^4.2.0",
27
27
  "redux-saga": "^1.2.1",
28
28
  "regenerator-runtime": "^0.13.9",
29
- "swiper": "8.3.2"
29
+ "swiper": "8.4.2"
30
30
  },
31
31
  "scripts": {
32
32
  "cm": "newspack-scripts commit",
@@ -130,6 +130,13 @@ class WP_REST_Newspack_Donate_Controller extends WP_REST_Controller {
130
130
 
131
131
  $user_id = self::$current_user_id;
132
132
 
133
+ $client_metadata = [
134
+ 'clientId' => $request->get_param( 'clientId' ),
135
+ 'newsletterOptIn' => $request->get_param( 'newsletter_opt_in' ),
136
+ 'current_page_url' => \wp_get_referer(),
137
+ 'origin' => $origin,
138
+ ];
139
+
133
140
  if ( 0 === $user_id ) {
134
141
  $email_address = $request->get_param( 'email' );
135
142
 
@@ -138,7 +145,8 @@ class WP_REST_Newspack_Donate_Controller extends WP_REST_Controller {
138
145
  $user_id = \Newspack\WooCommerce_Connection::set_up_membership(
139
146
  $email_address,
140
147
  $full_name,
141
- $frequency
148
+ $frequency,
149
+ $client_metadata
142
150
  );
143
151
  if ( \is_wp_error( $user_id ) ) {
144
152
  return [ 'error' => \esc_html( $user_id->get_error_message() ) ];
@@ -148,6 +156,8 @@ class WP_REST_Newspack_Donate_Controller extends WP_REST_Controller {
148
156
  $email_address = \get_userdata( $user_id )->user_email;
149
157
  }
150
158
 
159
+ $client_metadata['userId'] = $user_id;
160
+
151
161
  $response = \Newspack\Stripe_Connection::handle_donation(
152
162
  [
153
163
  'frequency' => $frequency,
@@ -155,13 +165,7 @@ class WP_REST_Newspack_Donate_Controller extends WP_REST_Controller {
155
165
  'email_address' => $email_address,
156
166
  'full_name' => $full_name,
157
167
  'amount' => $request->get_param( 'amount' ),
158
- 'client_metadata' => [
159
- 'clientId' => $request->get_param( 'clientId' ),
160
- 'newsletterOptIn' => $request->get_param( 'newsletter_opt_in' ),
161
- 'userId' => $user_id,
162
- 'current_page_url' => \wp_get_referer(),
163
- 'origin' => $origin,
164
- ],
168
+ 'client_metadata' => $client_metadata,
165
169
  'payment_metadata' => $payment_metadata,
166
170
  'payment_method_id' => $request->get_param( 'payment_method_id' ),
167
171
  ]
@@ -281,6 +281,14 @@ export const processStreamlinedElements = ( parentElement = document ) =>
281
281
  if ( feesAmountEl ) {
282
282
  const formValues = Object.fromEntries( new FormData( formElement ) );
283
283
  const feeAmount = utils.getFeeAmount( formElement );
284
+ if ( feeAmount === 0 ) {
285
+ const feesAmountContainerEl: HTMLElement | null = el.querySelector(
286
+ '#stripe-fees-amount-container'
287
+ );
288
+ if ( feesAmountContainerEl ) {
289
+ feesAmountContainerEl.style.display = 'none';
290
+ }
291
+ }
284
292
  if ( typeof formValues.donation_frequency === 'string' ) {
285
293
  feesAmountEl.innerHTML = `(${ settings.currencySymbol }${ feeAmount.toFixed(
286
294
  2
@@ -175,7 +175,12 @@ export const computeFeeAmount = ( amount: number, feeMultiplier: number, feeStat
175
175
  */
176
176
  export const getFeeAmount = ( formElement: HTMLFormElement ) => {
177
177
  const { feeMultiplier, feeStatic } = getSettings( formElement );
178
- if ( ! feeMultiplier || ! feeStatic ) {
178
+ if (
179
+ undefined === feeMultiplier ||
180
+ undefined === feeStatic ||
181
+ isNaN( feeMultiplier ) ||
182
+ isNaN( feeStatic )
183
+ ) {
179
184
  return 0;
180
185
  }
181
186
  const { amount } = getDonationFormValues( formElement );
@@ -112,7 +112,7 @@ function newspack_blocks_render_block_donate_footer( $attributes ) {
112
112
  </div>
113
113
  </div>
114
114
  <?php if ( $is_rendering_fee_checkbox ) : ?>
115
- <div class="stripe-payment__row stripe-payment__row--small">
115
+ <div class="stripe-payment__row stripe-payment__row--small" id="stripe-fees-amount-container">
116
116
  <label class="stripe-payment__checkbox">
117
117
  <input type="checkbox" name="agree_to_pay_fees" checked value="true"><?php echo esc_html__( 'Agree to pay fees?', 'newspack-blocks' ); ?>
118
118
  <span id="stripe-fees-amount">($0)</span>
@@ -4,4 +4,4 @@
4
4
 
5
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
6
 
7
- return ComposerAutoloaderInitdafc7b562537ced688bb573bc3588de3::getLoader();
7
+ return ComposerAutoloaderInited31aaab4ad399c15f9f84cc5fecbd40::getLoader();
@@ -2,7 +2,7 @@
2
2
 
3
3
  // autoload_real.php @generated by Composer
4
4
 
5
- class ComposerAutoloaderInitdafc7b562537ced688bb573bc3588de3
5
+ class ComposerAutoloaderInited31aaab4ad399c15f9f84cc5fecbd40
6
6
  {
7
7
  private static $loader;
8
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitdafc7b562537ced688bb573bc3588de3
22
22
  return self::$loader;
23
23
  }
24
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitdafc7b562537ced688bb573bc3588de3', 'loadClassLoader'), true, true);
25
+ spl_autoload_register(array('ComposerAutoloaderInited31aaab4ad399c15f9f84cc5fecbd40', 'loadClassLoader'), true, true);
26
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
- spl_autoload_unregister(array('ComposerAutoloaderInitdafc7b562537ced688bb573bc3588de3', 'loadClassLoader'));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInited31aaab4ad399c15f9f84cc5fecbd40', 'loadClassLoader'));
28
28
 
29
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
30
  if ($useStaticLoader) {
31
31
  require __DIR__ . '/autoload_static.php';
32
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitdafc7b562537ced688bb573bc3588de3::getInitializer($loader));
33
+ call_user_func(\Composer\Autoload\ComposerStaticInited31aaab4ad399c15f9f84cc5fecbd40::getInitializer($loader));
34
34
  } else {
35
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
36
  foreach ($map as $namespace => $path) {
@@ -4,7 +4,7 @@
4
4
 
5
5
  namespace Composer\Autoload;
6
6
 
7
- class ComposerStaticInitdafc7b562537ced688bb573bc3588de3
7
+ class ComposerStaticInited31aaab4ad399c15f9f84cc5fecbd40
8
8
  {
9
9
  public static $classMap = array (
10
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -13,7 +13,7 @@ class ComposerStaticInitdafc7b562537ced688bb573bc3588de3
13
13
  public static function getInitializer(ClassLoader $loader)
14
14
  {
15
15
  return \Closure::bind(function () use ($loader) {
16
- $loader->classMap = ComposerStaticInitdafc7b562537ced688bb573bc3588de3::$classMap;
16
+ $loader->classMap = ComposerStaticInited31aaab4ad399c15f9f84cc5fecbd40::$classMap;
17
17
 
18
18
  }, null, ClassLoader::class);
19
19
  }
@@ -5,7 +5,7 @@
5
5
  'type' => 'wordpress-plugin',
6
6
  'install_path' => __DIR__ . '/../../',
7
7
  'aliases' => array(),
8
- 'reference' => 'be057d5165dd9e7ef8292cfc027112678b253706',
8
+ 'reference' => 'b661cbcc08369bcaf96e7b0073487070973bf76b',
9
9
  'name' => 'automattic/newspack-blocks',
10
10
  'dev' => false,
11
11
  ),
@@ -16,7 +16,7 @@
16
16
  'type' => 'wordpress-plugin',
17
17
  'install_path' => __DIR__ . '/../../',
18
18
  'aliases' => array(),
19
- 'reference' => 'be057d5165dd9e7ef8292cfc027112678b253706',
19
+ 'reference' => 'b661cbcc08369bcaf96e7b0073487070973bf76b',
20
20
  'dev_requirement' => false,
21
21
  ),
22
22
  ),