@automattic/newspack-blocks 3.0.0 → 3.0.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/.cache/babel/b61bb07a232499e185fd13ddcd9ce4ff.json.gz +0 -0
- package/.cache/babel/d9e74ec24a15371e21e2d1de3f1976c8.json.gz +0 -0
- package/CHANGELOG.md +8 -0
- package/dist/editor.asset.php +1 -1
- package/dist/editor.js +1 -1
- package/includes/class-newspack-blocks.php +3 -0
- package/newspack-blocks.php +2 -2
- package/package.json +4 -4
- package/src/blocks/homepage-articles/utils.ts +9 -6
- package/src/components/autocomplete-tokenfield.js +6 -2
- package/vendor/autoload.php +1 -1
- package/vendor/composer/autoload_real.php +4 -4
- package/vendor/composer/autoload_static.php +2 -2
- package/vendor/composer/installed.php +2 -2
- package/.cache/babel/58e4535574062eb2d8fa56d002e7190d.json.gz +0 -0
- package/.cache/babel/c8d4b9ae4be3002e8507d71f1136ebc6.json.gz +0 -0
|
@@ -1550,6 +1550,9 @@ class Newspack_Blocks {
|
|
|
1550
1550
|
* @return string
|
|
1551
1551
|
*/
|
|
1552
1552
|
public static function get_formatted_amount( $amount = 0, $frequency = 'day', $hide_once_label = false ) {
|
|
1553
|
+
if ( ! function_exists( 'wc_price' ) ) {
|
|
1554
|
+
return $amount;
|
|
1555
|
+
}
|
|
1553
1556
|
if ( ! function_exists( 'wcs_price_string' ) ) {
|
|
1554
1557
|
return \wc_price( $amount );
|
|
1555
1558
|
}
|
package/newspack-blocks.php
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Author URI: https://newspack.com/
|
|
8
8
|
* Text Domain: newspack-blocks
|
|
9
9
|
* Domain Path: /languages
|
|
10
|
-
* Version: 3.0.
|
|
10
|
+
* Version: 3.0.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', '3.0.
|
|
18
|
+
define( 'NEWSPACK_BLOCKS__VERSION', '3.0.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,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/newspack-blocks",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"author": "Automattic",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@rushstack/eslint-patch": "^1.
|
|
7
|
-
"@testing-library/dom": "^9.3.
|
|
8
|
-
"@testing-library/user-event": "^14.5.
|
|
6
|
+
"@rushstack/eslint-patch": "^1.7.2",
|
|
7
|
+
"@testing-library/dom": "^9.3.4",
|
|
8
|
+
"@testing-library/user-event": "^14.5.2",
|
|
9
9
|
"@types/lodash": "^4.14.202",
|
|
10
10
|
"@types/lodash.debounce": "^4.0.9",
|
|
11
11
|
"eslint": "^7.32.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { times, isEqual, isUndefined, pick, pickBy } from 'lodash';
|
|
4
|
+
import { times, isEqual, isNull, isUndefined, pick, pickBy } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -117,12 +117,12 @@ export const queryCriteriaFromAttributes = ( attributes: Block[ 'attributes' ] )
|
|
|
117
117
|
}
|
|
118
118
|
: {
|
|
119
119
|
postsToShow,
|
|
120
|
-
categories,
|
|
120
|
+
categories: validateAttributeCollection( categories ),
|
|
121
121
|
includeSubcategories,
|
|
122
|
-
authors,
|
|
123
|
-
tags,
|
|
124
|
-
tagExclusions,
|
|
125
|
-
categoryExclusions,
|
|
122
|
+
authors: validateAttributeCollection( authors ),
|
|
123
|
+
tags: validateAttributeCollection( tags ),
|
|
124
|
+
tagExclusions: validateAttributeCollection( tagExclusions ),
|
|
125
|
+
categoryExclusions: validateAttributeCollection( categoryExclusions ),
|
|
126
126
|
customTaxonomyExclusions,
|
|
127
127
|
customTaxonomies,
|
|
128
128
|
postType,
|
|
@@ -138,6 +138,9 @@ export const queryCriteriaFromAttributes = ( attributes: Block[ 'attributes' ] )
|
|
|
138
138
|
export const sanitizePostList = ( postList: HomepageArticlesAttributes[ 'specificPosts' ] ) =>
|
|
139
139
|
postList.map( id => parseInt( id ) ).filter( id => id > 0 );
|
|
140
140
|
|
|
141
|
+
export const validateAttributeCollection = ( attr: Array< number > ) =>
|
|
142
|
+
pickBy( attr, ( value: unknown ) => ! isUndefined( value ) && ! isNull( value ) );
|
|
143
|
+
|
|
141
144
|
/**
|
|
142
145
|
* Each eligible block's attributes can be used to create a posts query.
|
|
143
146
|
* This function is recursively traversing an array of blocks and creating an aray
|
|
@@ -88,8 +88,12 @@ class AutocompleteTokenField extends Component {
|
|
|
88
88
|
*/
|
|
89
89
|
getValuesForLabels( labels ) {
|
|
90
90
|
const { validValues } = this.state;
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
labels
|
|
94
|
+
.map( label => Object.keys( validValues ).find( key => validValues[ key ] === label ) )
|
|
95
|
+
// It's possible the submitted label doesn't have a corresponding value, so we filter out any undefined values.
|
|
96
|
+
.filter( value => !! value )
|
|
93
97
|
);
|
|
94
98
|
}
|
|
95
99
|
|
package/vendor/autoload.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// autoload_real.php @generated by Composer
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ComposerAutoloaderInit4ba4b62e2920461868dda110937b637d
|
|
6
6
|
{
|
|
7
7
|
private static $loader;
|
|
8
8
|
|
|
@@ -22,12 +22,12 @@ class ComposerAutoloaderInitdc7748537d8a65e4e90543d7093ea289
|
|
|
22
22
|
return self::$loader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spl_autoload_register(array('
|
|
25
|
+
spl_autoload_register(array('ComposerAutoloaderInit4ba4b62e2920461868dda110937b637d', 'loadClassLoader'), true, true);
|
|
26
26
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
|
27
|
-
spl_autoload_unregister(array('
|
|
27
|
+
spl_autoload_unregister(array('ComposerAutoloaderInit4ba4b62e2920461868dda110937b637d', 'loadClassLoader'));
|
|
28
28
|
|
|
29
29
|
require __DIR__ . '/autoload_static.php';
|
|
30
|
-
call_user_func(\Composer\Autoload\
|
|
30
|
+
call_user_func(\Composer\Autoload\ComposerStaticInit4ba4b62e2920461868dda110937b637d::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
|
|
7
|
+
class ComposerStaticInit4ba4b62e2920461868dda110937b637d
|
|
8
8
|
{
|
|
9
9
|
public static $classMap = array (
|
|
10
10
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
@@ -13,7 +13,7 @@ class ComposerStaticInitdc7748537d8a65e4e90543d7093ea289
|
|
|
13
13
|
public static function getInitializer(ClassLoader $loader)
|
|
14
14
|
{
|
|
15
15
|
return \Closure::bind(function () use ($loader) {
|
|
16
|
-
$loader->classMap =
|
|
16
|
+
$loader->classMap = ComposerStaticInit4ba4b62e2920461868dda110937b637d::$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' => '
|
|
6
|
+
'reference' => 'c3c19777300e21ab346333bdd1031615c2f6fabe',
|
|
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' => '
|
|
16
|
+
'reference' => 'c3c19777300e21ab346333bdd1031615c2f6fabe',
|
|
17
17
|
'type' => 'wordpress-plugin',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|
|
Binary file
|
|
Binary file
|