instantsearch.js 4.61.0 → 4.62.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.
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.61.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
1
+ /*! InstantSearch.js 4.62.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
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) :
@@ -2389,8 +2389,7 @@
2389
2389
  return refinement.name;
2390
2390
  }
2391
2391
 
2392
- var _excluded$1 = ["name", "escapedValue", "data", "path"],
2393
- _excluded2 = ["hierarchicalMenu"];
2392
+ var _excluded$1 = ["name", "escapedValue", "data", "path"];
2394
2393
  var withUsage$4 = createDocumentationMessageGenerator({
2395
2394
  name: 'hierarchical-menu',
2396
2395
  connector: true
@@ -2578,7 +2577,7 @@
2578
2577
  var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
2579
2578
  return removeEmptyRefinementsFromUiState(_objectSpread2(_objectSpread2({}, uiState), {}, {
2580
2579
  hierarchicalMenu: _objectSpread2(_objectSpread2({}, uiState.hierarchicalMenu), {}, _defineProperty({}, hierarchicalFacetName, path))
2581
- }));
2580
+ }), hierarchicalFacetName);
2582
2581
  },
2583
2582
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
2584
2583
  var uiState = _ref6.uiState;
@@ -2611,18 +2610,17 @@
2611
2610
  };
2612
2611
  };
2613
2612
  };
2614
- function removeEmptyRefinementsFromUiState(indexUiState) {
2615
- var hierarchicalMenu = indexUiState.hierarchicalMenu,
2616
- indexUiStateBase = _objectWithoutProperties(indexUiState, _excluded2);
2617
- if (!hierarchicalMenu) {
2613
+ function removeEmptyRefinementsFromUiState(indexUiState, attribute) {
2614
+ if (!indexUiState.hierarchicalMenu) {
2618
2615
  return indexUiState;
2619
2616
  }
2620
- var connectorUiState = Object.keys(hierarchicalMenu).reduce(function (acc, key) {
2621
- return _objectSpread2(_objectSpread2({}, acc), hierarchicalMenu[key].length > 0 ? _defineProperty({}, key, hierarchicalMenu[key]) : {});
2622
- }, {});
2623
- return _objectSpread2(_objectSpread2({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
2624
- hierarchicalMenu: connectorUiState
2625
- } : {});
2617
+ if (!indexUiState.hierarchicalMenu[attribute] || indexUiState.hierarchicalMenu[attribute].length === 0) {
2618
+ delete indexUiState.hierarchicalMenu[attribute];
2619
+ }
2620
+ if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
2621
+ delete indexUiState.hierarchicalMenu;
2622
+ }
2623
+ return indexUiState;
2626
2624
  }
2627
2625
 
2628
2626
  var withUsage$5 = createDocumentationMessageGenerator({
@@ -3070,7 +3068,7 @@
3070
3068
  };
3071
3069
 
3072
3070
  var _excluded$2 = ["page"],
3073
- _excluded2$1 = ["clickAnalytics", "userToken"];
3071
+ _excluded2 = ["clickAnalytics", "userToken"];
3074
3072
  var withUsage$7 = createDocumentationMessageGenerator({
3075
3073
  name: 'infinite-hits',
3076
3074
  connector: true
@@ -3085,7 +3083,7 @@
3085
3083
  var _ref2 = state || {},
3086
3084
  clickAnalytics = _ref2.clickAnalytics,
3087
3085
  userToken = _ref2.userToken,
3088
- rest = _objectWithoutProperties(_ref2, _excluded2$1);
3086
+ rest = _objectWithoutProperties(_ref2, _excluded2);
3089
3087
  return rest;
3090
3088
  }
3091
3089
  function getInMemoryCache() {
@@ -3321,8 +3319,7 @@
3321
3319
  */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3322
3320
  var connectInfiniteHitsWithInsights = withInsights(connectInfiniteHits);
3323
3321
 
3324
- var _excluded$3 = ["name", "escapedValue", "path"],
3325
- _excluded2$2 = ["menu"];
3322
+ var _excluded$3 = ["name", "escapedValue", "path"];
3326
3323
  var withUsage$8 = createDocumentationMessageGenerator({
3327
3324
  name: 'menu',
3328
3325
  connector: true
@@ -3482,7 +3479,7 @@
3482
3479
  value = _searchParameters$get2[0];
3483
3480
  return removeEmptyRefinementsFromUiState$1(_objectSpread2(_objectSpread2({}, uiState), {}, {
3484
3481
  menu: _objectSpread2(_objectSpread2({}, uiState.menu), {}, _defineProperty({}, attribute, value))
3485
- }));
3482
+ }), attribute);
3486
3483
  },
3487
3484
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
3488
3485
  var uiState = _ref5.uiState;
@@ -3508,22 +3505,19 @@
3508
3505
  };
3509
3506
  };
3510
3507
  };
3511
- function removeEmptyRefinementsFromUiState$1(indexUiState) {
3512
- var menu = indexUiState.menu,
3513
- indexUiStateBase = _objectWithoutProperties(indexUiState, _excluded2$2);
3514
- if (!menu) {
3508
+ function removeEmptyRefinementsFromUiState$1(indexUiState, attribute) {
3509
+ if (!indexUiState.menu) {
3515
3510
  return indexUiState;
3516
3511
  }
3517
- var connectorUiState = Object.keys(menu).reduce(function (acc, key) {
3518
- var _menu$key;
3519
- return _objectSpread2(_objectSpread2({}, acc), ((_menu$key = menu[key]) === null || _menu$key === void 0 ? void 0 : _menu$key.length) > 0 ? _defineProperty({}, key, menu[key]) : {});
3520
- }, {});
3521
- return _objectSpread2(_objectSpread2({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
3522
- menu: connectorUiState
3523
- } : {});
3512
+ if (indexUiState.menu[attribute] === undefined) {
3513
+ delete indexUiState.menu[attribute];
3514
+ }
3515
+ if (Object.keys(indexUiState.menu).length === 0) {
3516
+ delete indexUiState.menu;
3517
+ }
3518
+ return indexUiState;
3524
3519
  }
3525
3520
 
3526
- var _excluded$4 = ["numericMenu"];
3527
3521
  var withUsage$9 = createDocumentationMessageGenerator({
3528
3522
  name: 'numeric-menu',
3529
3523
  connector: true
@@ -3609,7 +3603,7 @@
3609
3603
  var max = values['<='] && values['<='][0] || '';
3610
3604
  return removeEmptyRefinementsFromUiState$2(_objectSpread2(_objectSpread2({}, uiState), {}, {
3611
3605
  numericMenu: _objectSpread2(_objectSpread2({}, uiState.numericMenu), {}, _defineProperty({}, attribute, "".concat(min, ":").concat(max)))
3612
- }));
3606
+ }), attribute);
3613
3607
  },
3614
3608
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
3615
3609
  var uiState = _ref6.uiState;
@@ -3771,18 +3765,17 @@
3771
3765
  function hasNumericRefinement(currentRefinements, operator, value) {
3772
3766
  return currentRefinements[operator] !== undefined && currentRefinements[operator].includes(value);
3773
3767
  }
3774
- function removeEmptyRefinementsFromUiState$2(indexUiState) {
3775
- var numericMenu = indexUiState.numericMenu,
3776
- indexUiStateBase = _objectWithoutProperties(indexUiState, _excluded$4);
3777
- if (!numericMenu) {
3768
+ function removeEmptyRefinementsFromUiState$2(indexUiState, attribute) {
3769
+ if (!indexUiState.numericMenu) {
3778
3770
  return indexUiState;
3779
3771
  }
3780
- var connectorUiState = Object.keys(numericMenu).reduce(function (acc, key) {
3781
- return _objectSpread2(_objectSpread2({}, acc), numericMenu[key] !== ':' ? _defineProperty({}, key, numericMenu[key]) : {});
3782
- }, {});
3783
- return _objectSpread2(_objectSpread2({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
3784
- numericMenu: connectorUiState
3785
- } : {});
3772
+ if (indexUiState.numericMenu[attribute] === ':') {
3773
+ delete indexUiState.numericMenu[attribute];
3774
+ }
3775
+ if (Object.keys(indexUiState.numericMenu).length === 0) {
3776
+ delete indexUiState.numericMenu;
3777
+ }
3778
+ return indexUiState;
3786
3779
  }
3787
3780
 
3788
3781
  var Paginator = /*#__PURE__*/function () {
@@ -4233,9 +4226,8 @@
4233
4226
  };
4234
4227
  };
4235
4228
 
4236
- var _excluded$5 = ["name", "escapedValue"],
4237
- _excluded2$3 = ["escapedValue", "value"],
4238
- _excluded3 = ["refinementList"];
4229
+ var _excluded$4 = ["name", "escapedValue"],
4230
+ _excluded2$1 = ["escapedValue", "value"];
4239
4231
  var withUsage$c = createDocumentationMessageGenerator({
4240
4232
  name: 'refinement-list',
4241
4233
  connector: true
@@ -4287,7 +4279,7 @@
4287
4279
  var formatItems = function formatItems(_ref2) {
4288
4280
  var label = _ref2.name,
4289
4281
  value = _ref2.escapedValue,
4290
- item = _objectWithoutProperties(_ref2, _excluded$5);
4282
+ item = _objectWithoutProperties(_ref2, _excluded$4);
4291
4283
  return _objectSpread2(_objectSpread2({}, item), {}, {
4292
4284
  value: value,
4293
4285
  label: label,
@@ -4344,7 +4336,7 @@
4344
4336
  var normalizedFacetValues = transformItems(facetValues.map(function (_ref3) {
4345
4337
  var escapedValue = _ref3.escapedValue,
4346
4338
  value = _ref3.value,
4347
- item = _objectWithoutProperties(_ref3, _excluded2$3);
4339
+ item = _objectWithoutProperties(_ref3, _excluded2$1);
4348
4340
  return _objectSpread2(_objectSpread2({}, item), {}, {
4349
4341
  value: escapedValue,
4350
4342
  label: value
@@ -4472,7 +4464,7 @@
4472
4464
  var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
4473
4465
  return removeEmptyRefinementsFromUiState$3(_objectSpread2(_objectSpread2({}, uiState), {}, {
4474
4466
  refinementList: _objectSpread2(_objectSpread2({}, uiState.refinementList), {}, _defineProperty({}, attribute, values))
4475
- }));
4467
+ }), attribute);
4476
4468
  },
4477
4469
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
4478
4470
  var uiState = _ref6.uiState;
@@ -4502,18 +4494,17 @@
4502
4494
  };
4503
4495
  };
4504
4496
  };
4505
- function removeEmptyRefinementsFromUiState$3(indexUiState) {
4506
- var refinementList = indexUiState.refinementList,
4507
- indexUiStateBase = _objectWithoutProperties(indexUiState, _excluded3);
4508
- if (!refinementList) {
4497
+ function removeEmptyRefinementsFromUiState$3(indexUiState, attribute) {
4498
+ if (!indexUiState.refinementList) {
4509
4499
  return indexUiState;
4510
4500
  }
4511
- var connectorUiState = Object.keys(refinementList).reduce(function (acc, key) {
4512
- return _objectSpread2(_objectSpread2({}, acc), refinementList[key].length > 0 ? _defineProperty({}, key, refinementList[key]) : {});
4513
- }, {});
4514
- return _objectSpread2(_objectSpread2({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
4515
- refinementList: connectorUiState
4516
- } : {});
4501
+ if (!indexUiState.refinementList[attribute] || indexUiState.refinementList[attribute].length === 0) {
4502
+ delete indexUiState.refinementList[attribute];
4503
+ }
4504
+ if (Object.keys(indexUiState.refinementList).length === 0) {
4505
+ delete indexUiState.refinementList;
4506
+ }
4507
+ return indexUiState;
4517
4508
  }
4518
4509
 
4519
4510
  var withUsage$d = createDocumentationMessageGenerator({
@@ -4708,7 +4699,6 @@
4708
4699
  };
4709
4700
  };
4710
4701
 
4711
- var _excluded$6 = ["ratingMenu"];
4712
4702
  var withUsage$f = createDocumentationMessageGenerator({
4713
4703
  name: 'rating-menu',
4714
4704
  connector: true
@@ -4952,7 +4942,7 @@
4952
4942
  var value = _getRefinedStar(searchParameters);
4953
4943
  return removeEmptyRefinementsFromUiState$4(_objectSpread2(_objectSpread2({}, uiState), {}, {
4954
4944
  ratingMenu: _objectSpread2(_objectSpread2({}, uiState.ratingMenu), {}, _defineProperty({}, attribute, typeof value === 'number' ? value : undefined))
4955
- }));
4945
+ }), attribute);
4956
4946
  },
4957
4947
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref8) {
4958
4948
  var uiState = _ref8.uiState;
@@ -4969,18 +4959,17 @@
4969
4959
  };
4970
4960
  };
4971
4961
  };
4972
- function removeEmptyRefinementsFromUiState$4(indexUiState) {
4973
- var ratingMenu = indexUiState.ratingMenu,
4974
- indexUiStateBase = _objectWithoutProperties(indexUiState, _excluded$6);
4975
- if (!ratingMenu) {
4962
+ function removeEmptyRefinementsFromUiState$4(indexUiState, attribute) {
4963
+ if (!indexUiState.ratingMenu) {
4976
4964
  return indexUiState;
4977
4965
  }
4978
- var connectorUiState = Object.keys(ratingMenu).reduce(function (acc, key) {
4979
- return _objectSpread2(_objectSpread2({}, acc), typeof ratingMenu[key] === 'number' ? _defineProperty({}, key, ratingMenu[key]) : {});
4980
- }, {});
4981
- return _objectSpread2(_objectSpread2({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
4982
- ratingMenu: connectorUiState
4983
- } : {});
4966
+ if (typeof indexUiState.ratingMenu[attribute] !== 'number') {
4967
+ delete indexUiState.ratingMenu[attribute];
4968
+ }
4969
+ if (Object.keys(indexUiState.ratingMenu).length === 0) {
4970
+ delete indexUiState.ratingMenu;
4971
+ }
4972
+ return indexUiState;
4984
4973
  }
4985
4974
 
4986
4975
  var withUsage$g = createDocumentationMessageGenerator({
@@ -5347,7 +5336,6 @@
5347
5336
  };
5348
5337
  };
5349
5338
 
5350
- var _excluded$7 = ["hierarchicalMenu"];
5351
5339
  var withUsage$i = createDocumentationMessageGenerator({
5352
5340
  name: 'breadcrumb',
5353
5341
  connector: true
@@ -5454,7 +5442,7 @@
5454
5442
  var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
5455
5443
  return removeEmptyRefinementsFromUiState$5(_objectSpread2(_objectSpread2({}, uiState), {}, {
5456
5444
  hierarchicalMenu: _objectSpread2(_objectSpread2({}, uiState.hierarchicalMenu), {}, _defineProperty({}, hierarchicalFacetName, path))
5457
- }));
5445
+ }), hierarchicalFacetName);
5458
5446
  },
5459
5447
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref4) {
5460
5448
  var uiState = _ref4.uiState;
@@ -5505,18 +5493,17 @@
5505
5493
  };
5506
5494
  });
5507
5495
  }
5508
- function removeEmptyRefinementsFromUiState$5(indexUiState) {
5509
- var hierarchicalMenu = indexUiState.hierarchicalMenu,
5510
- indexUiStateBase = _objectWithoutProperties(indexUiState, _excluded$7);
5511
- if (!hierarchicalMenu) {
5496
+ function removeEmptyRefinementsFromUiState$5(indexUiState, attribute) {
5497
+ if (!indexUiState.hierarchicalMenu) {
5512
5498
  return indexUiState;
5513
5499
  }
5514
- var connectorUiState = Object.keys(hierarchicalMenu).reduce(function (acc, key) {
5515
- return _objectSpread2(_objectSpread2({}, acc), hierarchicalMenu[key].length > 0 ? _defineProperty({}, key, hierarchicalMenu[key]) : {});
5516
- }, {});
5517
- return _objectSpread2(_objectSpread2({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
5518
- hierarchicalMenu: connectorUiState
5519
- } : {});
5500
+ if (!indexUiState.hierarchicalMenu[attribute] || !indexUiState.hierarchicalMenu[attribute].length) {
5501
+ delete indexUiState.hierarchicalMenu[attribute];
5502
+ }
5503
+ if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
5504
+ delete indexUiState.hierarchicalMenu;
5505
+ }
5506
+ return indexUiState;
5520
5507
  }
5521
5508
 
5522
5509
  var withUsage$j = createDocumentationMessageGenerator({
@@ -9042,7 +9029,6 @@
9042
9029
  );
9043
9030
  }
9044
9031
 
9045
- // eslint-disable-next-line valid-jsdoc
9046
9032
  /**
9047
9033
  * Constructor for SearchResults
9048
9034
  * @class
@@ -9050,6 +9036,7 @@
9050
9036
  * {@link AlgoliaSearchHelper}.
9051
9037
  * @param {SearchParameters} state state that led to the response
9052
9038
  * @param {array.<object>} results the results from algolia client
9039
+ * @param {object} options options to control results content
9053
9040
  * @example <caption>SearchResults of the first query in
9054
9041
  * <a href="http://demos.algolia.com/instant-search-demo">the instant search demo</a></caption>
9055
9042
  {
@@ -9187,8 +9174,14 @@
9187
9174
  });
9188
9175
 
9189
9176
  // Make every key of the result options reachable from the instance
9190
- Object.keys(options || {}).forEach(function (key) {
9191
- self[key] = options[key];
9177
+ var opts = merge_1(
9178
+ {
9179
+ persistHierarchicalRootCount: false,
9180
+ },
9181
+ options
9182
+ );
9183
+ Object.keys(opts).forEach(function (key) {
9184
+ self[key] = opts[key];
9192
9185
  });
9193
9186
 
9194
9187
  /**
@@ -9538,9 +9531,13 @@
9538
9531
  // We want
9539
9532
  // | beers (5)
9540
9533
  // > IPA (5)
9534
+ // @MAJOR: remove this legacy behaviour in next major version
9541
9535
  var defaultData = {};
9542
9536
 
9543
- if (currentRefinement.length > 0) {
9537
+ if (
9538
+ currentRefinement.length > 0 &&
9539
+ !self.persistHierarchicalRootCount
9540
+ ) {
9544
9541
  var root = currentRefinement[0].split(separator)[0];
9545
9542
  defaultData[root] =
9546
9543
  self.hierarchicalFacets[position][attributeIndex].data[root];
@@ -10089,7 +10086,7 @@
10089
10086
 
10090
10087
  var SearchResults_1 = SearchResults;
10091
10088
 
10092
- var version = '3.15.0';
10089
+ var version = '3.16.0';
10093
10090
 
10094
10091
  var escapeFacetValue$4 = escapeFacetValue_1.escapeFacetValue;
10095
10092
 
@@ -10203,8 +10200,9 @@
10203
10200
  * @param {SearchParameters | object} options an object defining the initial
10204
10201
  * config of the search. It doesn't have to be a {SearchParameters},
10205
10202
  * just an object containing the properties you need from it.
10203
+ * @param {SearchResultsOptions|object} searchResultsOptions an object defining the options to use when creating the search results.
10206
10204
  */
10207
- function AlgoliaSearchHelper(client, index, options) {
10205
+ function AlgoliaSearchHelper(client, index, options, searchResultsOptions) {
10208
10206
  if (typeof client.addAlgoliaAgent === 'function') {
10209
10207
  client.addAlgoliaAgent('JS Helper (' + version + ')');
10210
10208
  }
@@ -10218,6 +10216,7 @@
10218
10216
  this._lastQueryIdReceived = -1;
10219
10217
  this.derivedHelpers = [];
10220
10218
  this._currentNbQueries = 0;
10219
+ this._searchResultsOptions = searchResultsOptions;
10221
10220
  }
10222
10221
 
10223
10222
  inherits_1(AlgoliaSearchHelper, events);
@@ -11490,6 +11489,9 @@
11490
11489
  queryId,
11491
11490
  content
11492
11491
  ) {
11492
+ // eslint-disable-next-line consistent-this
11493
+ var self = this;
11494
+
11493
11495
  // @TODO remove the number of outdated queries discarded instead of just one
11494
11496
 
11495
11497
  if (queryId < this._lastQueryIdReceived) {
@@ -11518,7 +11520,11 @@
11518
11520
  return;
11519
11521
  }
11520
11522
 
11521
- helper.lastResults = new SearchResults_1(state, specificResults);
11523
+ helper.lastResults = new SearchResults_1(
11524
+ state,
11525
+ specificResults,
11526
+ self._searchResultsOptions
11527
+ );
11522
11528
 
11523
11529
  helper.emit('result', {
11524
11530
  results: helper.lastResults,
@@ -11716,10 +11722,11 @@
11716
11722
  * @param {AlgoliaSearch} client an AlgoliaSearch client
11717
11723
  * @param {string} index the name of the index to query
11718
11724
  * @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.
11725
+ * @param {SearchResultsOptions|object} searchResultsOptions an object defining the options to use when creating the search results.
11719
11726
  * @return {AlgoliaSearchHelper} The helper instance
11720
11727
  */
11721
- function algoliasearchHelper(client, index, opts) {
11722
- return new algoliasearch_helper(client, index, opts);
11728
+ function algoliasearchHelper(client, index, opts, searchResultsOptions) {
11729
+ return new algoliasearch_helper(client, index, opts, searchResultsOptions);
11723
11730
  }
11724
11731
 
11725
11732
  /**
@@ -12667,11 +12674,11 @@
12667
12674
  return getCookie(ANONYMOUS_TOKEN_COOKIE_KEY);
12668
12675
  }
12669
12676
 
12670
- var _excluded$8 = ["page"];
12677
+ var _excluded$5 = ["page"];
12671
12678
  function getStateWithoutPage$1(state) {
12672
12679
  var _ref = state || {},
12673
12680
  page = _ref.page,
12674
- rest = _objectWithoutProperties(_ref, _excluded$8);
12681
+ rest = _objectWithoutProperties(_ref, _excluded$5);
12675
12682
  return rest;
12676
12683
  }
12677
12684
  var KEY = 'ais.infiniteHits';
@@ -14180,10 +14187,10 @@
14180
14187
  });
14181
14188
  }
14182
14189
 
14183
- var _excluded$9 = ["configure"];
14190
+ var _excluded$6 = ["configure"];
14184
14191
  function getIndexStateWithoutConfigure(uiState) {
14185
14192
  var configure = uiState.configure,
14186
- trackedUiState = _objectWithoutProperties(uiState, _excluded$9);
14193
+ trackedUiState = _objectWithoutProperties(uiState, _excluded$6);
14187
14194
  return trackedUiState;
14188
14195
  }
14189
14196
 
@@ -14268,7 +14275,7 @@
14268
14275
  };
14269
14276
  };
14270
14277
 
14271
- var _excluded$a = ["initialSearchParameters"];
14278
+ var _excluded$7 = ["initialSearchParameters"];
14272
14279
  var withUsage$q = createDocumentationMessageGenerator({
14273
14280
  name: 'index-widget'
14274
14281
  });
@@ -14308,7 +14315,7 @@
14308
14315
  }
14309
14316
  function getLocalWidgetsSearchParameters(widgets, widgetSearchParametersOptions) {
14310
14317
  var initialSearchParameters = widgetSearchParametersOptions.initialSearchParameters,
14311
- rest = _objectWithoutProperties(widgetSearchParametersOptions, _excluded$a);
14318
+ rest = _objectWithoutProperties(widgetSearchParametersOptions, _excluded$7);
14312
14319
  return widgets.filter(function (widget) {
14313
14320
  return !isIndexWidget(widget);
14314
14321
  }).reduce(function (state, widget) {
@@ -14815,7 +14822,7 @@
14815
14822
  };
14816
14823
  }
14817
14824
 
14818
- var version$1 = '4.61.0';
14825
+ var version$1 = '4.62.0';
14819
14826
 
14820
14827
  var withUsage$r = createDocumentationMessageGenerator({
14821
14828
  name: 'instantsearch'
@@ -14831,7 +14838,8 @@
14831
14838
  * Global options for an InstantSearch instance.
14832
14839
  */
14833
14840
  var INSTANTSEARCH_FUTURE_DEFAULTS = {
14834
- preserveSharedStateOnUnmount: false
14841
+ preserveSharedStateOnUnmount: false,
14842
+ persistHierarchicalRootCount: false
14835
14843
  };
14836
14844
 
14837
14845
  /**
@@ -15167,7 +15175,9 @@
15167
15175
  // DerivedHelper scoped into the `index` widgets.
15168
15176
  // In Vue InstantSearch' hydrate, a main helper gets set before start, so
15169
15177
  // we need to respect this helper as a way to keep all listeners correct.
15170
- var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName);
15178
+ var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName, undefined, {
15179
+ persistHierarchicalRootCount: this.future.persistHierarchicalRootCount
15180
+ });
15171
15181
  mainHelper.search = function () {
15172
15182
  _this3.status = 'loading';
15173
15183
  _this3.scheduleRender(false);
@@ -15415,10 +15425,10 @@
15415
15425
  history: historyRouter
15416
15426
  });
15417
15427
 
15418
- var _excluded$b = ["configure"];
15428
+ var _excluded$8 = ["configure"];
15419
15429
  function getIndexStateWithoutConfigure$1(uiState) {
15420
15430
  var configure = uiState.configure,
15421
- trackedUiState = _objectWithoutProperties(uiState, _excluded$b);
15431
+ trackedUiState = _objectWithoutProperties(uiState, _excluded$8);
15422
15432
  return trackedUiState;
15423
15433
  }
15424
15434
  function singleIndexStateMapping(indexName) {
@@ -16344,7 +16354,7 @@
16344
16354
 
16345
16355
  var _objectWithoutProperties$1 = unwrapExports(objectWithoutProperties);
16346
16356
 
16347
- var _excluded$c = ["parts", "highlightedTagName", "nonHighlightedTagName", "separator", "className", "classNames"];
16357
+ var _excluded$9 = ["parts", "highlightedTagName", "nonHighlightedTagName", "separator", "className", "classNames"];
16348
16358
 
16349
16359
  function createHighlightPartComponent(_ref) {
16350
16360
  var createElement = _ref.createElement;
@@ -16381,7 +16391,7 @@
16381
16391
  className = userProps.className,
16382
16392
  _userProps$classNames = userProps.classNames,
16383
16393
  classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
16384
- props = _objectWithoutProperties$1(userProps, _excluded$c);
16394
+ props = _objectWithoutProperties$1(userProps, _excluded$9);
16385
16395
 
16386
16396
  return createElement("span", _extends$1({}, props, {
16387
16397
  className: cx(classNames.root, className)
@@ -16409,11 +16419,11 @@
16409
16419
  Fragment: p
16410
16420
  });
16411
16421
 
16412
- var _excluded$d = ["classNames"];
16422
+ var _excluded$a = ["classNames"];
16413
16423
  function Highlight(_ref) {
16414
16424
  var _ref$classNames = _ref.classNames,
16415
16425
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
16416
- props = _objectWithoutProperties(_ref, _excluded$d);
16426
+ props = _objectWithoutProperties(_ref, _excluded$a);
16417
16427
  return h(InternalHighlight, _extends({
16418
16428
  classNames: {
16419
16429
  root: cx('ais-Highlight', classNames.root),
@@ -16424,12 +16434,12 @@
16424
16434
  }, props));
16425
16435
  }
16426
16436
 
16427
- var _excluded$e = ["hit", "attribute", "cssClasses"];
16437
+ var _excluded$b = ["hit", "attribute", "cssClasses"];
16428
16438
  function Highlight$1(_ref) {
16429
16439
  var hit = _ref.hit,
16430
16440
  attribute = _ref.attribute,
16431
16441
  cssClasses = _ref.cssClasses,
16432
- props = _objectWithoutProperties(_ref, _excluded$e);
16442
+ props = _objectWithoutProperties(_ref, _excluded$b);
16433
16443
  var property = getPropertyByPath(hit._highlightResult, attribute) || [];
16434
16444
  var properties = toArray(property);
16435
16445
  _warning(Boolean(properties.length), "Could not enable highlight for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) ;
@@ -16443,11 +16453,11 @@
16443
16453
  }));
16444
16454
  }
16445
16455
 
16446
- var _excluded$f = ["classNames"];
16456
+ var _excluded$c = ["classNames"];
16447
16457
  function ReverseHighlight(_ref) {
16448
16458
  var _ref$classNames = _ref.classNames,
16449
16459
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
16450
- props = _objectWithoutProperties(_ref, _excluded$f);
16460
+ props = _objectWithoutProperties(_ref, _excluded$c);
16451
16461
  return h(InternalHighlight, _extends({
16452
16462
  classNames: {
16453
16463
  root: cx('ais-ReverseHighlight', classNames.root),
@@ -16458,13 +16468,13 @@
16458
16468
  }, props));
16459
16469
  }
16460
16470
 
16461
- var _excluded$g = ["hit", "attribute", "cssClasses"],
16462
- _excluded2$4 = ["isHighlighted"];
16471
+ var _excluded$d = ["hit", "attribute", "cssClasses"],
16472
+ _excluded2$2 = ["isHighlighted"];
16463
16473
  function ReverseHighlight$1(_ref) {
16464
16474
  var hit = _ref.hit,
16465
16475
  attribute = _ref.attribute,
16466
16476
  cssClasses = _ref.cssClasses,
16467
- props = _objectWithoutProperties(_ref, _excluded$g);
16477
+ props = _objectWithoutProperties(_ref, _excluded$d);
16468
16478
  var property = getPropertyByPath(hit._highlightResult, attribute) || [];
16469
16479
  var properties = toArray(property);
16470
16480
  _warning(Boolean(properties.length), "Could not enable highlight for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) ;
@@ -16472,7 +16482,7 @@
16472
16482
  var value = _ref2.value;
16473
16483
  return getHighlightedParts(unescape$1(value || '')).map(function (_ref3) {
16474
16484
  var isHighlighted = _ref3.isHighlighted,
16475
- rest = _objectWithoutProperties(_ref3, _excluded2$4);
16485
+ rest = _objectWithoutProperties(_ref3, _excluded2$2);
16476
16486
  return _objectSpread2(_objectSpread2({}, rest), {}, {
16477
16487
  isHighlighted: !isHighlighted
16478
16488
  });
@@ -16484,11 +16494,11 @@
16484
16494
  }));
16485
16495
  }
16486
16496
 
16487
- var _excluded$h = ["classNames"];
16497
+ var _excluded$e = ["classNames"];
16488
16498
  function ReverseSnippet(_ref) {
16489
16499
  var _ref$classNames = _ref.classNames,
16490
16500
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
16491
- props = _objectWithoutProperties(_ref, _excluded$h);
16501
+ props = _objectWithoutProperties(_ref, _excluded$e);
16492
16502
  return h(InternalHighlight, _extends({
16493
16503
  classNames: {
16494
16504
  root: cx('ais-ReverseSnippet', classNames.root),
@@ -16499,13 +16509,13 @@
16499
16509
  }, props));
16500
16510
  }
16501
16511
 
16502
- var _excluded$i = ["hit", "attribute", "cssClasses"],
16503
- _excluded2$5 = ["isHighlighted"];
16512
+ var _excluded$f = ["hit", "attribute", "cssClasses"],
16513
+ _excluded2$3 = ["isHighlighted"];
16504
16514
  function ReverseSnippet$1(_ref) {
16505
16515
  var hit = _ref.hit,
16506
16516
  attribute = _ref.attribute,
16507
16517
  cssClasses = _ref.cssClasses,
16508
- props = _objectWithoutProperties(_ref, _excluded$i);
16518
+ props = _objectWithoutProperties(_ref, _excluded$f);
16509
16519
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
16510
16520
  var properties = toArray(property);
16511
16521
  _warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) ;
@@ -16513,7 +16523,7 @@
16513
16523
  var value = _ref2.value;
16514
16524
  return getHighlightedParts(unescape$1(value || '')).map(function (_ref3) {
16515
16525
  var isHighlighted = _ref3.isHighlighted,
16516
- rest = _objectWithoutProperties(_ref3, _excluded2$5);
16526
+ rest = _objectWithoutProperties(_ref3, _excluded2$3);
16517
16527
  return _objectSpread2(_objectSpread2({}, rest), {}, {
16518
16528
  isHighlighted: !isHighlighted
16519
16529
  });
@@ -16525,11 +16535,11 @@
16525
16535
  }));
16526
16536
  }
16527
16537
 
16528
- var _excluded$j = ["classNames"];
16538
+ var _excluded$g = ["classNames"];
16529
16539
  function Snippet(_ref) {
16530
16540
  var _ref$classNames = _ref.classNames,
16531
16541
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
16532
- props = _objectWithoutProperties(_ref, _excluded$j);
16542
+ props = _objectWithoutProperties(_ref, _excluded$g);
16533
16543
  return h(InternalHighlight, _extends({
16534
16544
  classNames: {
16535
16545
  root: cx('ais-Snippet', classNames.root),
@@ -16540,12 +16550,12 @@
16540
16550
  }, props));
16541
16551
  }
16542
16552
 
16543
- var _excluded$k = ["hit", "attribute", "cssClasses"];
16553
+ var _excluded$h = ["hit", "attribute", "cssClasses"];
16544
16554
  function Snippet$1(_ref) {
16545
16555
  var hit = _ref.hit,
16546
16556
  attribute = _ref.attribute,
16547
16557
  cssClasses = _ref.cssClasses,
16548
- props = _objectWithoutProperties(_ref, _excluded$k);
16558
+ props = _objectWithoutProperties(_ref, _excluded$h);
16549
16559
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
16550
16560
  var properties = toArray(property);
16551
16561
  _warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) ;
@@ -16816,7 +16826,7 @@
16816
16826
  });
16817
16827
  };
16818
16828
 
16819
- var _excluded$l = ["container", "widgets", "fallbackWidget"];
16829
+ var _excluded$i = ["container", "widgets", "fallbackWidget"];
16820
16830
  var withUsage$t = createDocumentationMessageGenerator({
16821
16831
  name: 'dynamic-widgets'
16822
16832
  });
@@ -16834,7 +16844,7 @@
16834
16844
  containerSelector = _ref.container,
16835
16845
  widgets = _ref.widgets,
16836
16846
  fallbackWidget = _ref.fallbackWidget,
16837
- otherWidgetParams = _objectWithoutProperties(_ref, _excluded$l);
16847
+ otherWidgetParams = _objectWithoutProperties(_ref, _excluded$i);
16838
16848
  if (!containerSelector) {
16839
16849
  throw new Error(withUsage$t('The `container` option is required.'));
16840
16850
  }
@@ -17808,9 +17818,9 @@
17808
17818
  }), container.querySelector(".".concat(cssClasses.tree)));
17809
17819
  };
17810
17820
 
17811
- var _excluded$m = ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"],
17812
- _excluded2$6 = ["item"],
17813
- _excluded3$1 = ["item"];
17821
+ var _excluded$j = ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"],
17822
+ _excluded2$4 = ["item"],
17823
+ _excluded3 = ["item"];
17814
17824
  var withUsage$y = createDocumentationMessageGenerator({
17815
17825
  name: 'geo-search'
17816
17826
  });
@@ -17852,7 +17862,7 @@
17852
17862
  enableRefineControl = _ref$enableRefineCont === void 0 ? true : _ref$enableRefineCont,
17853
17863
  container = _ref.container,
17854
17864
  googleReference = _ref.googleReference,
17855
- otherWidgetParams = _objectWithoutProperties(_ref, _excluded$m);
17865
+ otherWidgetParams = _objectWithoutProperties(_ref, _excluded$j);
17856
17866
  var defaultBuiltInMarker = {
17857
17867
  createOptions: function createOptions() {
17858
17868
  return {};
@@ -17911,7 +17921,7 @@
17911
17921
  var customHTMLMarker = isCustomHTMLMarker && _objectSpread2(_objectSpread2({}, defaultCustomHTMLMarker), userCustomHTMLMarker);
17912
17922
  var createBuiltInMarker = function createBuiltInMarker(_ref2) {
17913
17923
  var item = _ref2.item,
17914
- rest = _objectWithoutProperties(_ref2, _excluded2$6);
17924
+ rest = _objectWithoutProperties(_ref2, _excluded2$4);
17915
17925
  return new googleReference.maps.Marker(_objectSpread2(_objectSpread2(_objectSpread2({}, builtInMarker.createOptions(item)), rest), {}, {
17916
17926
  // @ts-expect-error @types/googlemaps doesn't document this
17917
17927
  __id: item.objectID,
@@ -17921,7 +17931,7 @@
17921
17931
  var HTMLMarker = createHTMLMarker(googleReference);
17922
17932
  var createCustomHTMLMarker = function createCustomHTMLMarker(_ref3) {
17923
17933
  var item = _ref3.item,
17924
- rest = _objectWithoutProperties(_ref3, _excluded3$1);
17934
+ rest = _objectWithoutProperties(_ref3, _excluded3);
17925
17935
  return new HTMLMarker(_objectSpread2(_objectSpread2(_objectSpread2({}, customHTMLMarker.createOptions(item)), rest), {}, {
17926
17936
  __id: item.objectID,
17927
17937
  position: item._geoloc,
@@ -18182,7 +18192,7 @@
18182
18192
  })), subItems);
18183
18193
  }
18184
18194
 
18185
- var _excluded$n = ["root"];
18195
+ var _excluded$k = ["root"];
18186
18196
 
18187
18197
  // CSS types
18188
18198
 
@@ -18209,7 +18219,7 @@
18209
18219
  if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
18210
18220
  var _this$props$cssClasse = _this.props.cssClasses,
18211
18221
  root = _this$props$cssClasse.root,
18212
- cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$n);
18222
+ cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$k);
18213
18223
  subItems = h(RefinementList, _extends({}, _this.props, {
18214
18224
  // We want to keep `root` required for external usage but not for the
18215
18225
  // sub items.
@@ -19865,8 +19875,8 @@
19865
19875
  };
19866
19876
  };
19867
19877
 
19868
- var _excluded$o = ["placesReference", "defaultPosition"],
19869
- _excluded2$7 = ["places"];
19878
+ var _excluded$l = ["placesReference", "defaultPosition"],
19879
+ _excluded2$5 = ["places"];
19870
19880
  /* Places.js is an optional dependency, no error should be reported if the package is missing */
19871
19881
  /** @ts-ignore */
19872
19882
  // using the type like this requires only one ts-ignore
@@ -19879,7 +19889,7 @@
19879
19889
  placesReference = _ref.placesReference,
19880
19890
  _ref$defaultPosition = _ref.defaultPosition,
19881
19891
  defaultPosition = _ref$defaultPosition === void 0 ? [] : _ref$defaultPosition,
19882
- placesOptions = _objectWithoutProperties(_ref, _excluded$o);
19892
+ placesOptions = _objectWithoutProperties(_ref, _excluded$l);
19883
19893
  if (typeof placesReference !== 'function') {
19884
19894
  throw new Error('The `placesReference` option requires a valid Places.js reference.');
19885
19895
  }
@@ -19920,7 +19930,7 @@
19920
19930
  var hasPositionSet = position !== defaultPosition.join(',');
19921
19931
  if (!hasPositionSet && !state.query) {
19922
19932
  var places = uiState.places,
19923
- uiStateWithoutPlaces = _objectWithoutProperties(uiState, _excluded2$7);
19933
+ uiStateWithoutPlaces = _objectWithoutProperties(uiState, _excluded2$5);
19924
19934
  return uiStateWithoutPlaces;
19925
19935
  }
19926
19936
  return _objectSpread2(_objectSpread2({}, uiState), {}, {
@@ -21917,13 +21927,13 @@
21917
21927
  });
21918
21928
  };
21919
21929
 
21920
- var _excluded$p = ["nbHits", "nbSortedHits", "cssClasses", "templateProps"];
21930
+ var _excluded$m = ["nbHits", "nbSortedHits", "cssClasses", "templateProps"];
21921
21931
  var Stats = function Stats(_ref) {
21922
21932
  var nbHits = _ref.nbHits,
21923
21933
  nbSortedHits = _ref.nbSortedHits,
21924
21934
  cssClasses = _ref.cssClasses,
21925
21935
  templateProps = _ref.templateProps,
21926
- rest = _objectWithoutProperties(_ref, _excluded$p);
21936
+ rest = _objectWithoutProperties(_ref, _excluded$m);
21927
21937
  return h("div", {
21928
21938
  className: cx(cssClasses.root)
21929
21939
  }, h(Template, _extends({}, templateProps, {