algoliasearch-helper 3.11.1 → 3.11.3

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 CHANGED
@@ -1,3 +1,13 @@
1
+ 3.11.3 - 2023-01-23
2
+ * chore(tests): remove remaining lodash usage (#927) https://github.com/algolia/algoliasearch-helper-js/commit/e234837aaa10e6458d06085ff9938c741ee74d4b
3
+ * fix(getFacetValues): reflect the value of _state in hierarchicalFacetValues (#925) https://github.com/algolia/algoliasearch-helper-js/commit/4d093b464e62dc6963dc6676aee19ff78145f48a
4
+ * test(integration): refactor to speed up (#926) https://github.com/algolia/algoliasearch-helper-js/commit/2c9ffeb23d68a09ac78a29d2a53024d9f724d525
5
+
6
+ 3.11.2 - 2023-01-09
7
+ * feat: update Algolia logo (#918) https://github.com/algolia/algoliasearch-helper-js/commit/58e0e588195dde8f411383ad248bd112a9c01eb5
8
+ * fix: prevent prototype pollution in rare error-cases (#923) https://github.com/algolia/algoliasearch-helper-js/commit/7ae16eaa3f5732b96f1fa40973778c5494e77b89, closes https://github.com/algolia/algoliasearch-helper-js/issues/922
9
+ * fix(answers): deprecate findAnswers (#919) https://github.com/algolia/algoliasearch-helper-js/commit/07118610d3da07d04390d7b79e857122e98a3db5
10
+
1
11
  3.11.1 - 2022-09-12
2
12
  * fix(facetValues): use existing facet filters in multi queries for hierarchical facet values (#915) https://github.com/algolia/algoliasearch-helper-js/commit/bae388c7143653e74628dbd3c72979a51be6ab7f
3
13
 
@@ -2953,7 +2953,33 @@ function extractNormalizedFacetValues(results, attribute) {
2953
2953
  };
2954
2954
  });
2955
2955
  } else if (results._state.isHierarchicalFacet(attribute)) {
2956
- return find(results.hierarchicalFacets, predicate);
2956
+ var hierarchicalFacetValues = find(results.hierarchicalFacets, predicate);
2957
+ if (!hierarchicalFacetValues) return hierarchicalFacetValues;
2958
+
2959
+ var hierarchicalFacet = results._state.getHierarchicalFacetByName(attribute);
2960
+ var currentRefinementSplit = unescapeFacetValue(
2961
+ results._state.getHierarchicalRefinement(attribute)[0] || ''
2962
+ ).split(results._state._getHierarchicalFacetSeparator(hierarchicalFacet));
2963
+ currentRefinementSplit.unshift(attribute);
2964
+
2965
+ setIsRefined(hierarchicalFacetValues, currentRefinementSplit, 0);
2966
+
2967
+ return hierarchicalFacetValues;
2968
+ }
2969
+ }
2970
+
2971
+ /**
2972
+ * Set the isRefined of a hierarchical facet result based on the current state.
2973
+ * @param {SearchResults.HierarchicalFacet} item Hierarchical facet to fix
2974
+ * @param {string[]} currentRefinementSplit array of parts of the current hierarchical refinement
2975
+ * @param {number} depth recursion depth in the currentRefinement
2976
+ */
2977
+ function setIsRefined(item, currentRefinement, depth) {
2978
+ item.isRefined = item.name === currentRefinement[depth];
2979
+ if (item.data) {
2980
+ item.data.forEach(function(child) {
2981
+ setIsRefined(child, currentRefinement, depth + 1);
2982
+ });
2957
2983
  }
2958
2984
  }
2959
2985
 
@@ -3577,8 +3603,10 @@ AlgoliaSearchHelper.prototype.searchOnce = function(options, cb) {
3577
3603
  * @param {number} options.nbHits - Maximum number of answers to retrieve from the Answers Engine. Cannot be greater than 1000.
3578
3604
  *
3579
3605
  * @return {promise} the answer results
3606
+ * @deprecated answers is deprecated and will be replaced with new initiatives
3580
3607
  */
3581
3608
  AlgoliaSearchHelper.prototype.findAnswers = function(options) {
3609
+ console.warn('[algoliasearch-helper] answers is no longer supported');
3582
3610
  var state = this.state;
3583
3611
  var derivedHelper = this.derivedHelpers[0];
3584
3612
  if (!derivedHelper) {
@@ -5007,7 +5035,8 @@ function _merge(target, source) {
5007
5035
  for (var key in source) {
5008
5036
  if (
5009
5037
  !Object.prototype.hasOwnProperty.call(source, key) ||
5010
- key === '__proto__'
5038
+ key === '__proto__' ||
5039
+ key === 'constructor'
5011
5040
  ) {
5012
5041
  continue;
5013
5042
  }
@@ -5587,7 +5616,7 @@ module.exports = function isValidUserToken(userToken) {
5587
5616
  },{}],24:[function(require,module,exports){
5588
5617
  'use strict';
5589
5618
 
5590
- module.exports = '3.11.1';
5619
+ module.exports = '3.11.3';
5591
5620
 
5592
5621
  },{}]},{},[1])(1)
5593
5622
  });