react-instantsearch-core 7.4.0 → 7.4.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.
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '7.4.0';
7
+ var _default = '7.4.1';
8
8
  exports.default = _default;
@@ -1,2 +1,2 @@
1
- declare const _default: "7.4.0";
1
+ declare const _default: "7.4.1";
2
2
  export default _default;
@@ -1 +1 @@
1
- export default '7.4.0';
1
+ export default '7.4.1';
@@ -7,7 +7,7 @@
7
7
 
8
8
  var React__default = 'default' in React ? React['default'] : React;
9
9
 
10
- var version = '7.4.0';
10
+ var version = '7.4.1';
11
11
 
12
12
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -3280,7 +3280,6 @@
3280
3280
  );
3281
3281
  }
3282
3282
 
3283
- // eslint-disable-next-line valid-jsdoc
3284
3283
  /**
3285
3284
  * Constructor for SearchResults
3286
3285
  * @class
@@ -3288,6 +3287,7 @@
3288
3287
  * {@link AlgoliaSearchHelper}.
3289
3288
  * @param {SearchParameters} state state that led to the response
3290
3289
  * @param {array.<object>} results the results from algolia client
3290
+ * @param {object} options options to control results content
3291
3291
  * @example <caption>SearchResults of the first query in
3292
3292
  * <a href="http://demos.algolia.com/instant-search-demo">the instant search demo</a></caption>
3293
3293
  {
@@ -3425,8 +3425,14 @@
3425
3425
  });
3426
3426
 
3427
3427
  // Make every key of the result options reachable from the instance
3428
- Object.keys(options || {}).forEach(function (key) {
3429
- self[key] = options[key];
3428
+ var opts = merge_1(
3429
+ {
3430
+ persistHierarchicalRootCount: false,
3431
+ },
3432
+ options
3433
+ );
3434
+ Object.keys(opts).forEach(function (key) {
3435
+ self[key] = opts[key];
3430
3436
  });
3431
3437
 
3432
3438
  /**
@@ -3776,9 +3782,13 @@
3776
3782
  // We want
3777
3783
  // | beers (5)
3778
3784
  // > IPA (5)
3785
+ // @MAJOR: remove this legacy behaviour in next major version
3779
3786
  var defaultData = {};
3780
3787
 
3781
- if (currentRefinement.length > 0) {
3788
+ if (
3789
+ currentRefinement.length > 0 &&
3790
+ !self.persistHierarchicalRootCount
3791
+ ) {
3782
3792
  var root = currentRefinement[0].split(separator)[0];
3783
3793
  defaultData[root] =
3784
3794
  self.hierarchicalFacets[position][attributeIndex].data[root];
@@ -4327,7 +4337,7 @@
4327
4337
 
4328
4338
  var SearchResults_1 = SearchResults;
4329
4339
 
4330
- var version$1 = '3.15.0';
4340
+ var version$1 = '3.16.0';
4331
4341
 
4332
4342
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4333
4343
 
@@ -4441,8 +4451,9 @@
4441
4451
  * @param {SearchParameters | object} options an object defining the initial
4442
4452
  * config of the search. It doesn't have to be a {SearchParameters},
4443
4453
  * just an object containing the properties you need from it.
4454
+ * @param {SearchResultsOptions|object} searchResultsOptions an object defining the options to use when creating the search results.
4444
4455
  */
4445
- function AlgoliaSearchHelper(client, index, options) {
4456
+ function AlgoliaSearchHelper(client, index, options, searchResultsOptions) {
4446
4457
  if (typeof client.addAlgoliaAgent === 'function') {
4447
4458
  client.addAlgoliaAgent('JS Helper (' + version$1 + ')');
4448
4459
  }
@@ -4456,6 +4467,7 @@
4456
4467
  this._lastQueryIdReceived = -1;
4457
4468
  this.derivedHelpers = [];
4458
4469
  this._currentNbQueries = 0;
4470
+ this._searchResultsOptions = searchResultsOptions;
4459
4471
  }
4460
4472
 
4461
4473
  inherits_1(AlgoliaSearchHelper, events);
@@ -5728,6 +5740,9 @@
5728
5740
  queryId,
5729
5741
  content
5730
5742
  ) {
5743
+ // eslint-disable-next-line consistent-this
5744
+ var self = this;
5745
+
5731
5746
  // @TODO remove the number of outdated queries discarded instead of just one
5732
5747
 
5733
5748
  if (queryId < this._lastQueryIdReceived) {
@@ -5756,7 +5771,11 @@
5756
5771
  return;
5757
5772
  }
5758
5773
 
5759
- helper.lastResults = new SearchResults_1(state, specificResults);
5774
+ helper.lastResults = new SearchResults_1(
5775
+ state,
5776
+ specificResults,
5777
+ self._searchResultsOptions
5778
+ );
5760
5779
 
5761
5780
  helper.emit('result', {
5762
5781
  results: helper.lastResults,
@@ -5954,10 +5973,11 @@
5954
5973
  * @param {AlgoliaSearch} client an AlgoliaSearch client
5955
5974
  * @param {string} index the name of the index to query
5956
5975
  * @param {SearchParameters|object} opts an object defining the initial config of the search. It doesn't have to be a {SearchParameters}, just an object containing the properties you need from it.
5976
+ * @param {SearchResultsOptions|object} searchResultsOptions an object defining the options to use when creating the search results.
5957
5977
  * @return {AlgoliaSearchHelper} The helper instance
5958
5978
  */
5959
- function algoliasearchHelper(client, index, opts) {
5960
- return new algoliasearch_helper(client, index, opts);
5979
+ function algoliasearchHelper(client, index, opts, searchResultsOptions) {
5980
+ return new algoliasearch_helper(client, index, opts, searchResultsOptions);
5961
5981
  }
5962
5982
 
5963
5983
  /**
@@ -11622,7 +11642,7 @@
11622
11642
  };
11623
11643
  }
11624
11644
 
11625
- var version$2 = '4.61.0';
11645
+ var version$2 = '4.62.0';
11626
11646
 
11627
11647
  function _typeof$k(obj) {
11628
11648
  "@babel/helpers - typeof";
@@ -11786,7 +11806,8 @@
11786
11806
  * Global options for an InstantSearch instance.
11787
11807
  */
11788
11808
  var INSTANTSEARCH_FUTURE_DEFAULTS = {
11789
- preserveSharedStateOnUnmount: false
11809
+ preserveSharedStateOnUnmount: false,
11810
+ persistHierarchicalRootCount: false
11790
11811
  };
11791
11812
 
11792
11813
  /**
@@ -12106,7 +12127,9 @@
12106
12127
  // DerivedHelper scoped into the `index` widgets.
12107
12128
  // In Vue InstantSearch' hydrate, a main helper gets set before start, so
12108
12129
  // we need to respect this helper as a way to keep all listeners correct.
12109
- var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName);
12130
+ var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName, undefined, {
12131
+ persistHierarchicalRootCount: this.future.persistHierarchicalRootCount
12132
+ });
12110
12133
  mainHelper.search = function () {
12111
12134
  _this3.status = 'loading';
12112
12135
  _this3.scheduleRender(false);
@@ -12591,34 +12614,6 @@
12591
12614
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
12592
12615
  }, _typeof$l(obj);
12593
12616
  }
12594
- var _excluded$8 = ["hierarchicalMenu"];
12595
- function _objectWithoutProperties$4(source, excluded) {
12596
- if (source == null) return {};
12597
- var target = _objectWithoutPropertiesLoose$5(source, excluded);
12598
- var key, i;
12599
- if (Object.getOwnPropertySymbols) {
12600
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
12601
- for (i = 0; i < sourceSymbolKeys.length; i++) {
12602
- key = sourceSymbolKeys[i];
12603
- if (excluded.indexOf(key) >= 0) continue;
12604
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
12605
- target[key] = source[key];
12606
- }
12607
- }
12608
- return target;
12609
- }
12610
- function _objectWithoutPropertiesLoose$5(source, excluded) {
12611
- if (source == null) return {};
12612
- var target = {};
12613
- var sourceKeys = Object.keys(source);
12614
- var key, i;
12615
- for (i = 0; i < sourceKeys.length; i++) {
12616
- key = sourceKeys[i];
12617
- if (excluded.indexOf(key) >= 0) continue;
12618
- target[key] = source[key];
12619
- }
12620
- return target;
12621
- }
12622
12617
  function ownKeys$h(object, enumerableOnly) {
12623
12618
  var keys = Object.keys(object);
12624
12619
  if (Object.getOwnPropertySymbols) {
@@ -12823,7 +12818,7 @@
12823
12818
  var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
12824
12819
  return removeEmptyRefinementsFromUiState(_objectSpread$g(_objectSpread$g({}, uiState), {}, {
12825
12820
  hierarchicalMenu: _objectSpread$g(_objectSpread$g({}, uiState.hierarchicalMenu), {}, _defineProperty$i({}, hierarchicalFacetName, path))
12826
- }));
12821
+ }), hierarchicalFacetName);
12827
12822
  },
12828
12823
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref4) {
12829
12824
  var uiState = _ref4.uiState;
@@ -12872,18 +12867,17 @@
12872
12867
  };
12873
12868
  });
12874
12869
  }
12875
- function removeEmptyRefinementsFromUiState(indexUiState) {
12876
- var hierarchicalMenu = indexUiState.hierarchicalMenu,
12877
- indexUiStateBase = _objectWithoutProperties$4(indexUiState, _excluded$8);
12878
- if (!hierarchicalMenu) {
12870
+ function removeEmptyRefinementsFromUiState(indexUiState, attribute) {
12871
+ if (!indexUiState.hierarchicalMenu) {
12879
12872
  return indexUiState;
12880
12873
  }
12881
- var connectorUiState = Object.keys(hierarchicalMenu).reduce(function (acc, key) {
12882
- return _objectSpread$g(_objectSpread$g({}, acc), hierarchicalMenu[key].length > 0 ? _defineProperty$i({}, key, hierarchicalMenu[key]) : {});
12883
- }, {});
12884
- return _objectSpread$g(_objectSpread$g({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
12885
- hierarchicalMenu: connectorUiState
12886
- } : {});
12874
+ if (!indexUiState.hierarchicalMenu[attribute] || !indexUiState.hierarchicalMenu[attribute].length) {
12875
+ delete indexUiState.hierarchicalMenu[attribute];
12876
+ }
12877
+ if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
12878
+ delete indexUiState.hierarchicalMenu;
12879
+ }
12880
+ return indexUiState;
12887
12881
  }
12888
12882
 
12889
12883
  function useBreadcrumb(props, additionalWidgetProperties) {
@@ -13648,8 +13642,7 @@
13648
13642
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
13649
13643
  }, _typeof$p(obj);
13650
13644
  }
13651
- var _excluded$9 = ["name", "escapedValue", "data", "path"],
13652
- _excluded2$1 = ["hierarchicalMenu"];
13645
+ var _excluded$8 = ["name", "escapedValue", "data", "path"];
13653
13646
  function ownKeys$l(object, enumerableOnly) {
13654
13647
  var keys = Object.keys(object);
13655
13648
  if (Object.getOwnPropertySymbols) {
@@ -13699,9 +13692,9 @@
13699
13692
  }
13700
13693
  return (hint === "string" ? String : Number)(input);
13701
13694
  }
13702
- function _objectWithoutProperties$5(source, excluded) {
13695
+ function _objectWithoutProperties$4(source, excluded) {
13703
13696
  if (source == null) return {};
13704
- var target = _objectWithoutPropertiesLoose$6(source, excluded);
13697
+ var target = _objectWithoutPropertiesLoose$5(source, excluded);
13705
13698
  var key, i;
13706
13699
  if (Object.getOwnPropertySymbols) {
13707
13700
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -13714,7 +13707,7 @@
13714
13707
  }
13715
13708
  return target;
13716
13709
  }
13717
- function _objectWithoutPropertiesLoose$6(source, excluded) {
13710
+ function _objectWithoutPropertiesLoose$5(source, excluded) {
13718
13711
  if (source == null) return {};
13719
13712
  var target = {};
13720
13713
  var sourceKeys = Object.keys(source);
@@ -13853,7 +13846,7 @@
13853
13846
  value = _ref2.escapedValue,
13854
13847
  data = _ref2.data,
13855
13848
  path = _ref2.path,
13856
- subValue = _objectWithoutProperties$5(_ref2, _excluded$9);
13849
+ subValue = _objectWithoutProperties$4(_ref2, _excluded$8);
13857
13850
  var item = _objectSpread$k(_objectSpread$k({}, subValue), {}, {
13858
13851
  value: value,
13859
13852
  label: label,
@@ -13962,7 +13955,7 @@
13962
13955
  var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
13963
13956
  return removeEmptyRefinementsFromUiState$1(_objectSpread$k(_objectSpread$k({}, uiState), {}, {
13964
13957
  hierarchicalMenu: _objectSpread$k(_objectSpread$k({}, uiState.hierarchicalMenu), {}, _defineProperty$m({}, hierarchicalFacetName, path))
13965
- }));
13958
+ }), hierarchicalFacetName);
13966
13959
  },
13967
13960
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
13968
13961
  var uiState = _ref6.uiState;
@@ -13993,18 +13986,17 @@
13993
13986
  };
13994
13987
  };
13995
13988
  };
13996
- function removeEmptyRefinementsFromUiState$1(indexUiState) {
13997
- var hierarchicalMenu = indexUiState.hierarchicalMenu,
13998
- indexUiStateBase = _objectWithoutProperties$5(indexUiState, _excluded2$1);
13999
- if (!hierarchicalMenu) {
13989
+ function removeEmptyRefinementsFromUiState$1(indexUiState, attribute) {
13990
+ if (!indexUiState.hierarchicalMenu) {
14000
13991
  return indexUiState;
14001
13992
  }
14002
- var connectorUiState = Object.keys(hierarchicalMenu).reduce(function (acc, key) {
14003
- return _objectSpread$k(_objectSpread$k({}, acc), hierarchicalMenu[key].length > 0 ? _defineProperty$m({}, key, hierarchicalMenu[key]) : {});
14004
- }, {});
14005
- return _objectSpread$k(_objectSpread$k({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
14006
- hierarchicalMenu: connectorUiState
14007
- } : {});
13993
+ if (!indexUiState.hierarchicalMenu[attribute] || indexUiState.hierarchicalMenu[attribute].length === 0) {
13994
+ delete indexUiState.hierarchicalMenu[attribute];
13995
+ }
13996
+ if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
13997
+ delete indexUiState.hierarchicalMenu;
13998
+ }
13999
+ return indexUiState;
14008
14000
  }
14009
14001
 
14010
14002
  function useHierarchicalMenu(props, additionalWidgetProperties) {
@@ -14403,8 +14395,8 @@
14403
14395
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14404
14396
  }, _typeof$s(obj);
14405
14397
  }
14406
- var _excluded$a = ["page"],
14407
- _excluded2$2 = ["clickAnalytics", "userToken"];
14398
+ var _excluded$9 = ["page"],
14399
+ _excluded2$1 = ["clickAnalytics", "userToken"];
14408
14400
  function ownKeys$o(object, enumerableOnly) {
14409
14401
  var keys = Object.keys(object);
14410
14402
  if (Object.getOwnPropertySymbols) {
@@ -14479,9 +14471,9 @@
14479
14471
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
14480
14472
  return arr2;
14481
14473
  }
14482
- function _objectWithoutProperties$6(source, excluded) {
14474
+ function _objectWithoutProperties$5(source, excluded) {
14483
14475
  if (source == null) return {};
14484
- var target = _objectWithoutPropertiesLoose$7(source, excluded);
14476
+ var target = _objectWithoutPropertiesLoose$6(source, excluded);
14485
14477
  var key, i;
14486
14478
  if (Object.getOwnPropertySymbols) {
14487
14479
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -14494,7 +14486,7 @@
14494
14486
  }
14495
14487
  return target;
14496
14488
  }
14497
- function _objectWithoutPropertiesLoose$7(source, excluded) {
14489
+ function _objectWithoutPropertiesLoose$6(source, excluded) {
14498
14490
  if (source == null) return {};
14499
14491
  var target = {};
14500
14492
  var sourceKeys = Object.keys(source);
@@ -14513,14 +14505,14 @@
14513
14505
  function getStateWithoutPage(state) {
14514
14506
  var _ref = state || {},
14515
14507
  page = _ref.page,
14516
- rest = _objectWithoutProperties$6(_ref, _excluded$a);
14508
+ rest = _objectWithoutProperties$5(_ref, _excluded$9);
14517
14509
  return rest;
14518
14510
  }
14519
14511
  function normalizeState(state) {
14520
14512
  var _ref2 = state || {},
14521
14513
  clickAnalytics = _ref2.clickAnalytics,
14522
14514
  userToken = _ref2.userToken,
14523
- rest = _objectWithoutProperties$6(_ref2, _excluded2$2);
14515
+ rest = _objectWithoutProperties$5(_ref2, _excluded2$1);
14524
14516
  return rest;
14525
14517
  }
14526
14518
  function getInMemoryCache() {
@@ -14753,8 +14745,7 @@
14753
14745
  return useConnector(connectInfiniteHits, props, additionalWidgetProperties);
14754
14746
  }
14755
14747
 
14756
- var _excluded$b = ["name", "escapedValue", "path"],
14757
- _excluded2$3 = ["menu"];
14748
+ var _excluded$a = ["name", "escapedValue", "path"];
14758
14749
  function _typeof$t(obj) {
14759
14750
  "@babel/helpers - typeof";
14760
14751
 
@@ -14764,9 +14755,9 @@
14764
14755
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14765
14756
  }, _typeof$t(obj);
14766
14757
  }
14767
- function _objectWithoutProperties$7(source, excluded) {
14758
+ function _objectWithoutProperties$6(source, excluded) {
14768
14759
  if (source == null) return {};
14769
- var target = _objectWithoutPropertiesLoose$8(source, excluded);
14760
+ var target = _objectWithoutPropertiesLoose$7(source, excluded);
14770
14761
  var key, i;
14771
14762
  if (Object.getOwnPropertySymbols) {
14772
14763
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -14779,7 +14770,7 @@
14779
14770
  }
14780
14771
  return target;
14781
14772
  }
14782
- function _objectWithoutPropertiesLoose$8(source, excluded) {
14773
+ function _objectWithoutPropertiesLoose$7(source, excluded) {
14783
14774
  if (source == null) return {};
14784
14775
  var target = {};
14785
14776
  var sourceKeys = Object.keys(source);
@@ -15020,7 +15011,7 @@
15020
15011
  var label = _ref3.name,
15021
15012
  value = _ref3.escapedValue,
15022
15013
  path = _ref3.path,
15023
- item = _objectWithoutProperties$7(_ref3, _excluded$b);
15014
+ item = _objectWithoutProperties$6(_ref3, _excluded$a);
15024
15015
  return _objectSpread$o(_objectSpread$o({}, item), {}, {
15025
15016
  label: label,
15026
15017
  value: value
@@ -15048,7 +15039,7 @@
15048
15039
  value = _searchParameters$get2[0];
15049
15040
  return removeEmptyRefinementsFromUiState$2(_objectSpread$o(_objectSpread$o({}, uiState), {}, {
15050
15041
  menu: _objectSpread$o(_objectSpread$o({}, uiState.menu), {}, _defineProperty$q({}, attribute, value))
15051
- }));
15042
+ }), attribute);
15052
15043
  },
15053
15044
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
15054
15045
  var uiState = _ref5.uiState;
@@ -15073,26 +15064,23 @@
15073
15064
  };
15074
15065
  };
15075
15066
  };
15076
- function removeEmptyRefinementsFromUiState$2(indexUiState) {
15077
- var menu = indexUiState.menu,
15078
- indexUiStateBase = _objectWithoutProperties$7(indexUiState, _excluded2$3);
15079
- if (!menu) {
15067
+ function removeEmptyRefinementsFromUiState$2(indexUiState, attribute) {
15068
+ if (!indexUiState.menu) {
15080
15069
  return indexUiState;
15081
15070
  }
15082
- var connectorUiState = Object.keys(menu).reduce(function (acc, key) {
15083
- var _menu$key;
15084
- return _objectSpread$o(_objectSpread$o({}, acc), ((_menu$key = menu[key]) === null || _menu$key === void 0 ? void 0 : _menu$key.length) > 0 ? _defineProperty$q({}, key, menu[key]) : {});
15085
- }, {});
15086
- return _objectSpread$o(_objectSpread$o({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
15087
- menu: connectorUiState
15088
- } : {});
15071
+ if (indexUiState.menu[attribute] === undefined) {
15072
+ delete indexUiState.menu[attribute];
15073
+ }
15074
+ if (Object.keys(indexUiState.menu).length === 0) {
15075
+ delete indexUiState.menu;
15076
+ }
15077
+ return indexUiState;
15089
15078
  }
15090
15079
 
15091
15080
  function useMenu(props, additionalWidgetProperties) {
15092
15081
  return useConnector(connectMenu, props, additionalWidgetProperties);
15093
15082
  }
15094
15083
 
15095
- var _excluded$c = ["numericMenu"];
15096
15084
  function _typeof$u(obj) {
15097
15085
  "@babel/helpers - typeof";
15098
15086
 
@@ -15102,33 +15090,6 @@
15102
15090
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15103
15091
  }, _typeof$u(obj);
15104
15092
  }
15105
- function _objectWithoutProperties$8(source, excluded) {
15106
- if (source == null) return {};
15107
- var target = _objectWithoutPropertiesLoose$9(source, excluded);
15108
- var key, i;
15109
- if (Object.getOwnPropertySymbols) {
15110
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
15111
- for (i = 0; i < sourceSymbolKeys.length; i++) {
15112
- key = sourceSymbolKeys[i];
15113
- if (excluded.indexOf(key) >= 0) continue;
15114
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
15115
- target[key] = source[key];
15116
- }
15117
- }
15118
- return target;
15119
- }
15120
- function _objectWithoutPropertiesLoose$9(source, excluded) {
15121
- if (source == null) return {};
15122
- var target = {};
15123
- var sourceKeys = Object.keys(source);
15124
- var key, i;
15125
- for (i = 0; i < sourceKeys.length; i++) {
15126
- key = sourceKeys[i];
15127
- if (excluded.indexOf(key) >= 0) continue;
15128
- target[key] = source[key];
15129
- }
15130
- return target;
15131
- }
15132
15093
  function _createForOfIteratorHelper(o, allowArrayLike) {
15133
15094
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
15134
15095
  if (!it) {
@@ -15363,7 +15324,7 @@
15363
15324
  var max = values['<='] && values['<='][0] || '';
15364
15325
  return removeEmptyRefinementsFromUiState$3(_objectSpread$p(_objectSpread$p({}, uiState), {}, {
15365
15326
  numericMenu: _objectSpread$p(_objectSpread$p({}, uiState.numericMenu), {}, _defineProperty$r({}, attribute, "".concat(min, ":").concat(max)))
15366
- }));
15327
+ }), attribute);
15367
15328
  },
15368
15329
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
15369
15330
  var uiState = _ref6.uiState;
@@ -15525,18 +15486,17 @@
15525
15486
  function hasNumericRefinement(currentRefinements, operator, value) {
15526
15487
  return currentRefinements[operator] !== undefined && currentRefinements[operator].includes(value);
15527
15488
  }
15528
- function removeEmptyRefinementsFromUiState$3(indexUiState) {
15529
- var numericMenu = indexUiState.numericMenu,
15530
- indexUiStateBase = _objectWithoutProperties$8(indexUiState, _excluded$c);
15531
- if (!numericMenu) {
15489
+ function removeEmptyRefinementsFromUiState$3(indexUiState, attribute) {
15490
+ if (!indexUiState.numericMenu) {
15532
15491
  return indexUiState;
15533
15492
  }
15534
- var connectorUiState = Object.keys(numericMenu).reduce(function (acc, key) {
15535
- return _objectSpread$p(_objectSpread$p({}, acc), numericMenu[key] !== ':' ? _defineProperty$r({}, key, numericMenu[key]) : {});
15536
- }, {});
15537
- return _objectSpread$p(_objectSpread$p({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
15538
- numericMenu: connectorUiState
15539
- } : {});
15493
+ if (indexUiState.numericMenu[attribute] === ':') {
15494
+ delete indexUiState.numericMenu[attribute];
15495
+ }
15496
+ if (Object.keys(indexUiState.numericMenu).length === 0) {
15497
+ delete indexUiState.numericMenu;
15498
+ }
15499
+ return indexUiState;
15540
15500
  }
15541
15501
 
15542
15502
  function useNumericMenu(props, additionalWidgetProperties) {
@@ -16485,9 +16445,8 @@
16485
16445
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16486
16446
  }, _typeof$z(obj);
16487
16447
  }
16488
- var _excluded$d = ["name", "escapedValue"],
16489
- _excluded2$4 = ["escapedValue", "value"],
16490
- _excluded3 = ["refinementList"];
16448
+ var _excluded$b = ["name", "escapedValue"],
16449
+ _excluded2$2 = ["escapedValue", "value"];
16491
16450
  function ownKeys$u(object, enumerableOnly) {
16492
16451
  var keys = Object.keys(object);
16493
16452
  if (Object.getOwnPropertySymbols) {
@@ -16537,9 +16496,9 @@
16537
16496
  }
16538
16497
  return (hint === "string" ? String : Number)(input);
16539
16498
  }
16540
- function _objectWithoutProperties$9(source, excluded) {
16499
+ function _objectWithoutProperties$7(source, excluded) {
16541
16500
  if (source == null) return {};
16542
- var target = _objectWithoutPropertiesLoose$a(source, excluded);
16501
+ var target = _objectWithoutPropertiesLoose$8(source, excluded);
16543
16502
  var key, i;
16544
16503
  if (Object.getOwnPropertySymbols) {
16545
16504
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -16552,7 +16511,7 @@
16552
16511
  }
16553
16512
  return target;
16554
16513
  }
16555
- function _objectWithoutPropertiesLoose$a(source, excluded) {
16514
+ function _objectWithoutPropertiesLoose$8(source, excluded) {
16556
16515
  if (source == null) return {};
16557
16516
  var target = {};
16558
16517
  var sourceKeys = Object.keys(source);
@@ -16615,7 +16574,7 @@
16615
16574
  var formatItems = function formatItems(_ref2) {
16616
16575
  var label = _ref2.name,
16617
16576
  value = _ref2.escapedValue,
16618
- item = _objectWithoutProperties$9(_ref2, _excluded$d);
16577
+ item = _objectWithoutProperties$7(_ref2, _excluded$b);
16619
16578
  return _objectSpread$t(_objectSpread$t({}, item), {}, {
16620
16579
  value: value,
16621
16580
  label: label,
@@ -16672,7 +16631,7 @@
16672
16631
  var normalizedFacetValues = transformItems(facetValues.map(function (_ref3) {
16673
16632
  var escapedValue = _ref3.escapedValue,
16674
16633
  value = _ref3.value,
16675
- item = _objectWithoutProperties$9(_ref3, _excluded2$4);
16634
+ item = _objectWithoutProperties$7(_ref3, _excluded2$2);
16676
16635
  return _objectSpread$t(_objectSpread$t({}, item), {}, {
16677
16636
  value: escapedValue,
16678
16637
  label: value
@@ -16800,7 +16759,7 @@
16800
16759
  var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
16801
16760
  return removeEmptyRefinementsFromUiState$4(_objectSpread$t(_objectSpread$t({}, uiState), {}, {
16802
16761
  refinementList: _objectSpread$t(_objectSpread$t({}, uiState.refinementList), {}, _defineProperty$w({}, attribute, values))
16803
- }));
16762
+ }), attribute);
16804
16763
  },
16805
16764
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
16806
16765
  var uiState = _ref6.uiState;
@@ -16828,18 +16787,17 @@
16828
16787
  };
16829
16788
  };
16830
16789
  };
16831
- function removeEmptyRefinementsFromUiState$4(indexUiState) {
16832
- var refinementList = indexUiState.refinementList,
16833
- indexUiStateBase = _objectWithoutProperties$9(indexUiState, _excluded3);
16834
- if (!refinementList) {
16790
+ function removeEmptyRefinementsFromUiState$4(indexUiState, attribute) {
16791
+ if (!indexUiState.refinementList) {
16835
16792
  return indexUiState;
16836
16793
  }
16837
- var connectorUiState = Object.keys(refinementList).reduce(function (acc, key) {
16838
- return _objectSpread$t(_objectSpread$t({}, acc), refinementList[key].length > 0 ? _defineProperty$w({}, key, refinementList[key]) : {});
16839
- }, {});
16840
- return _objectSpread$t(_objectSpread$t({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
16841
- refinementList: connectorUiState
16842
- } : {});
16794
+ if (!indexUiState.refinementList[attribute] || indexUiState.refinementList[attribute].length === 0) {
16795
+ delete indexUiState.refinementList[attribute];
16796
+ }
16797
+ if (Object.keys(indexUiState.refinementList).length === 0) {
16798
+ delete indexUiState.refinementList;
16799
+ }
16800
+ return indexUiState;
16843
16801
  }
16844
16802
 
16845
16803
  function useRefinementList(props, additionalWidgetProperties) {