instantsearch.js 4.41.1 → 4.41.2
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 +9 -0
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.js +70 -48
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [4.41.2](https://github.com/algolia/instantsearch.js/compare/v4.41.1...v4.41.2) (2022-06-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **hierarchicalMenu:** show full hierarchical parent values ([#5063](https://github.com/algolia/instantsearch.js/issues/5063)) ([cd1db34](https://github.com/algolia/instantsearch.js/commit/cd1db34815f92acb3d2d0cec6c1ae7865d14fb13))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## [4.41.1](https://github.com/algolia/instantsearch.js/compare/v4.41.0...v4.41.1) (2022-06-14)
|
|
2
11
|
|
|
3
12
|
|
package/cjs/lib/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.41.
|
|
1
|
+
/*! InstantSearch.js 4.41.2 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -2989,7 +2989,7 @@
|
|
|
2989
2989
|
nextDisjunctiveResult++;
|
|
2990
2990
|
});
|
|
2991
2991
|
|
|
2992
|
-
// if we have some
|
|
2992
|
+
// if we have some parent level values for hierarchical facets, merge them
|
|
2993
2993
|
state.getRefinedHierarchicalFacets().forEach(function(refinedFacet) {
|
|
2994
2994
|
var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);
|
|
2995
2995
|
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
|
|
@@ -3001,47 +3001,49 @@
|
|
|
3001
3001
|
return;
|
|
3002
3002
|
}
|
|
3003
3003
|
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
Object.keys(facets).forEach(function(dfacet) {
|
|
3009
|
-
var facetResults = facets[dfacet];
|
|
3010
|
-
var position = findIndex(state.hierarchicalFacets, function(f) {
|
|
3011
|
-
return f.name === hierarchicalFacet.name;
|
|
3012
|
-
});
|
|
3013
|
-
var attributeIndex = findIndex(self.hierarchicalFacets[position], function(f) {
|
|
3014
|
-
return f.attribute === dfacet;
|
|
3015
|
-
});
|
|
3004
|
+
results.slice(nextDisjunctiveResult).forEach(function(result) {
|
|
3005
|
+
var facets = result && result.facets
|
|
3006
|
+
? result.facets
|
|
3007
|
+
: {};
|
|
3016
3008
|
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3009
|
+
Object.keys(facets).forEach(function(dfacet) {
|
|
3010
|
+
var facetResults = facets[dfacet];
|
|
3011
|
+
var position = findIndex(state.hierarchicalFacets, function(f) {
|
|
3012
|
+
return f.name === hierarchicalFacet.name;
|
|
3013
|
+
});
|
|
3014
|
+
var attributeIndex = findIndex(self.hierarchicalFacets[position], function(f) {
|
|
3015
|
+
return f.attribute === dfacet;
|
|
3016
|
+
});
|
|
3021
3017
|
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
// > IPA (5)
|
|
3027
|
-
// We want
|
|
3028
|
-
// | beers (5)
|
|
3029
|
-
// > IPA (5)
|
|
3030
|
-
var defaultData = {};
|
|
3031
|
-
|
|
3032
|
-
if (currentRefinement.length > 0) {
|
|
3033
|
-
var root = currentRefinement[0].split(separator)[0];
|
|
3034
|
-
defaultData[root] = self.hierarchicalFacets[position][attributeIndex].data[root];
|
|
3035
|
-
}
|
|
3018
|
+
// previous refinements and no results so not able to find it
|
|
3019
|
+
if (attributeIndex === -1) {
|
|
3020
|
+
return;
|
|
3021
|
+
}
|
|
3036
3022
|
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3023
|
+
// when we always get root levels, if the hits refinement is `beers > IPA` (count: 5),
|
|
3024
|
+
// then the disjunctive values will be `beers` (count: 100),
|
|
3025
|
+
// but we do not want to display
|
|
3026
|
+
// | beers (100)
|
|
3027
|
+
// > IPA (5)
|
|
3028
|
+
// We want
|
|
3029
|
+
// | beers (5)
|
|
3030
|
+
// > IPA (5)
|
|
3031
|
+
var defaultData = {};
|
|
3032
|
+
|
|
3033
|
+
if (currentRefinement.length > 0) {
|
|
3034
|
+
var root = currentRefinement[0].split(separator)[0];
|
|
3035
|
+
defaultData[root] = self.hierarchicalFacets[position][attributeIndex].data[root];
|
|
3036
|
+
}
|
|
3043
3037
|
|
|
3044
|
-
|
|
3038
|
+
self.hierarchicalFacets[position][attributeIndex].data = defaultsPure(
|
|
3039
|
+
defaultData,
|
|
3040
|
+
facetResults,
|
|
3041
|
+
self.hierarchicalFacets[position][attributeIndex].data
|
|
3042
|
+
);
|
|
3043
|
+
});
|
|
3044
|
+
|
|
3045
|
+
nextDisjunctiveResult++;
|
|
3046
|
+
});
|
|
3045
3047
|
});
|
|
3046
3048
|
|
|
3047
3049
|
// add the excludes
|
|
@@ -3869,18 +3871,38 @@
|
|
|
3869
3871
|
});
|
|
3870
3872
|
});
|
|
3871
3873
|
|
|
3872
|
-
//
|
|
3874
|
+
// More to get the parent levels of the hierarchical facets when refined
|
|
3873
3875
|
state.getRefinedHierarchicalFacets().forEach(function(refinedFacet) {
|
|
3874
3876
|
var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);
|
|
3875
|
-
|
|
3876
3877
|
var currentRefinement = state.getHierarchicalRefinement(refinedFacet);
|
|
3877
|
-
// if we are deeper than level 0 (starting from `beer > IPA`)
|
|
3878
|
-
// we want to get the root values
|
|
3879
3878
|
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
|
|
3879
|
+
|
|
3880
|
+
// If we are deeper than level 0 (starting from `beer > IPA`)
|
|
3881
|
+
// we want to get all parent values
|
|
3880
3882
|
if (currentRefinement.length > 0 && currentRefinement[0].split(separator).length > 1) {
|
|
3881
|
-
queries
|
|
3882
|
-
|
|
3883
|
-
|
|
3883
|
+
// We generate a map of the filters we will use for our facet values queries
|
|
3884
|
+
var filtersMap = currentRefinement[0].split(separator).slice(0, -1).reduce(
|
|
3885
|
+
function createFiltersMap(map, segment, level) {
|
|
3886
|
+
return map.concat({
|
|
3887
|
+
attribute: hierarchicalFacet.attributes[level],
|
|
3888
|
+
value: level === 0
|
|
3889
|
+
? segment
|
|
3890
|
+
: [map[map.length - 1].value, segment].join(separator)
|
|
3891
|
+
});
|
|
3892
|
+
}
|
|
3893
|
+
, []);
|
|
3894
|
+
|
|
3895
|
+
filtersMap.forEach(function(filter, level) {
|
|
3896
|
+
var params = requestBuilder._getDisjunctiveFacetSearchParams(
|
|
3897
|
+
state,
|
|
3898
|
+
filter.attribute,
|
|
3899
|
+
level === 0
|
|
3900
|
+
);
|
|
3901
|
+
|
|
3902
|
+
var parent = filtersMap[level - 1];
|
|
3903
|
+
params.facetFilters = level > 0 ? [parent.attribute + ':' + parent.value] : undefined;
|
|
3904
|
+
|
|
3905
|
+
queries.push({indexName: index, params: params});
|
|
3884
3906
|
});
|
|
3885
3907
|
}
|
|
3886
3908
|
});
|
|
@@ -4163,7 +4185,7 @@
|
|
|
4163
4185
|
|
|
4164
4186
|
var requestBuilder_1 = requestBuilder;
|
|
4165
4187
|
|
|
4166
|
-
var version = '3.8.
|
|
4188
|
+
var version = '3.8.3';
|
|
4167
4189
|
|
|
4168
4190
|
var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
|
|
4169
4191
|
|
|
@@ -8543,7 +8565,7 @@
|
|
|
8543
8565
|
instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
|
|
8544
8566
|
}
|
|
8545
8567
|
|
|
8546
|
-
var version$1 = '4.41.
|
|
8568
|
+
var version$1 = '4.41.2';
|
|
8547
8569
|
|
|
8548
8570
|
var NAMESPACE = 'ais';
|
|
8549
8571
|
var component = function component(componentName) {
|