instantsearch.js 4.61.0 → 4.63.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.
Files changed (33) hide show
  1. package/cjs/components/SearchBox/SearchBox.js +13 -7
  2. package/cjs/connectors/breadcrumb/connectBreadcrumb.js +10 -14
  3. package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +11 -13
  4. package/cjs/connectors/menu/connectMenu.js +11 -14
  5. package/cjs/connectors/numeric-menu/connectNumericMenu.js +10 -14
  6. package/cjs/connectors/rating-menu/connectRatingMenu.js +10 -14
  7. package/cjs/connectors/refinement-list/connectRefinementList.js +11 -13
  8. package/cjs/lib/InstantSearch.js +5 -2
  9. package/cjs/lib/routers/history.js +17 -4
  10. package/cjs/lib/version.js +1 -1
  11. package/cjs/middlewares/createInsightsMiddleware.js +16 -4
  12. package/dist/instantsearch.development.d.ts +20 -2
  13. package/dist/instantsearch.development.js +196 -155
  14. package/dist/instantsearch.development.js.map +1 -1
  15. package/dist/instantsearch.production.d.ts +20 -2
  16. package/dist/instantsearch.production.min.d.ts +20 -2
  17. package/dist/instantsearch.production.min.js +2 -2
  18. package/dist/instantsearch.production.min.js.map +1 -1
  19. package/es/components/SearchBox/SearchBox.js +13 -7
  20. package/es/connectors/breadcrumb/connectBreadcrumb.js +10 -14
  21. package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +11 -13
  22. package/es/connectors/menu/connectMenu.js +11 -14
  23. package/es/connectors/numeric-menu/connectNumericMenu.js +10 -14
  24. package/es/connectors/rating-menu/connectRatingMenu.js +10 -14
  25. package/es/connectors/refinement-list/connectRefinementList.js +11 -13
  26. package/es/lib/InstantSearch.d.ts +10 -0
  27. package/es/lib/InstantSearch.js +5 -2
  28. package/es/lib/routers/history.d.ts +10 -2
  29. package/es/lib/routers/history.js +18 -5
  30. package/es/lib/version.d.ts +1 -1
  31. package/es/lib/version.js +1 -1
  32. package/es/middlewares/createInsightsMiddleware.js +16 -4
  33. package/package.json +10 -10
@@ -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.63.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.1';
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';
@@ -12724,7 +12731,7 @@
12724
12731
  };
12725
12732
  }
12726
12733
 
12727
- var ALGOLIA_INSIGHTS_VERSION = '2.6.0';
12734
+ var ALGOLIA_INSIGHTS_VERSION = '2.13.0';
12728
12735
  var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
12729
12736
  function createInsightsMiddleware() {
12730
12737
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -12808,7 +12815,7 @@
12808
12815
  // set it later on.
12809
12816
  //
12810
12817
  // Otherwise, the `init` call might override it with anonymous user token.
12811
- userTokenBeforeInit = userToken;
12818
+ userTokenBeforeInit = normalizeUserToken(userToken);
12812
12819
  });
12813
12820
 
12814
12821
  // Only `init` if the `insightsInitParams` option is passed or
@@ -12864,13 +12871,14 @@
12864
12871
  }
12865
12872
  var setUserTokenToSearch = function setUserTokenToSearch(userToken) {
12866
12873
  var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12867
- if (!userToken) {
12874
+ var normalizedUserToken = normalizeUserToken(userToken);
12875
+ if (!normalizedUserToken) {
12868
12876
  return;
12869
12877
  }
12870
12878
  var existingToken = helper.state.userToken;
12871
12879
  function applyToken() {
12872
12880
  helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread2(_objectSpread2({}, helper.state), {}, {
12873
- userToken: userToken
12881
+ userToken: normalizedUserToken
12874
12882
  }));
12875
12883
  if (existingToken && existingToken !== userToken) {
12876
12884
  instantSearchInstance.scheduleSearch();
@@ -12969,6 +12977,17 @@
12969
12977
  return v3 || v2_6 || v1_10;
12970
12978
  }
12971
12979
 
12980
+ /**
12981
+ * While `search-insights` supports both string and number user tokens,
12982
+ * the Search API only accepts strings. This function normalizes the user token.
12983
+ */
12984
+ function normalizeUserToken(userToken) {
12985
+ if (!userToken) {
12986
+ return undefined;
12987
+ }
12988
+ return typeof userToken === 'number' ? userToken.toString() : userToken;
12989
+ }
12990
+
12972
12991
  function extractWidgetPayload(widgets, instantSearchInstance, payload) {
12973
12992
  var initOptions = createInitArgs(instantSearchInstance, instantSearchInstance.mainIndex, instantSearchInstance._initialUiState);
12974
12993
  widgets.forEach(function (widget) {
@@ -13892,7 +13911,8 @@
13892
13911
  getLocation = _ref.getLocation,
13893
13912
  start = _ref.start,
13894
13913
  dispose = _ref.dispose,
13895
- push = _ref.push;
13914
+ push = _ref.push,
13915
+ cleanUrlOnDispose = _ref.cleanUrlOnDispose;
13896
13916
  _classCallCheck(this, BrowserHistory);
13897
13917
  _defineProperty(this, "$$type", 'ais.browser');
13898
13918
  /**
@@ -13942,6 +13962,7 @@
13942
13962
  _defineProperty(this, "_start", void 0);
13943
13963
  _defineProperty(this, "_dispose", void 0);
13944
13964
  _defineProperty(this, "_push", void 0);
13965
+ _defineProperty(this, "_cleanUrlOnDispose", void 0);
13945
13966
  this.windowTitle = windowTitle;
13946
13967
  this.writeTimer = undefined;
13947
13968
  this.writeDelay = writeDelay;
@@ -13951,6 +13972,13 @@
13951
13972
  this._start = start;
13952
13973
  this._dispose = dispose;
13953
13974
  this._push = push;
13975
+ this._cleanUrlOnDispose = typeof cleanUrlOnDispose === 'undefined' ? true : cleanUrlOnDispose;
13976
+ if ( typeof cleanUrlOnDispose === 'undefined') {
13977
+ // eslint-disable-next-line no-console
13978
+ console.info("Starting from the next major version, InstantSearch will not clean up the URL from active refinements when it is disposed.\n\nWe recommend setting `cleanUrlOnDispose` to false to adopt this change today.\nTo stay with the current behaviour and remove this warning, set the option to true.\n\nSee documentation: ".concat(createDocumentationLink({
13979
+ name: 'history-router'
13980
+ }), "#widget-param-cleanurlondispose"));
13981
+ }
13954
13982
  safelyRunOnBrowser(function (_ref2) {
13955
13983
  var window = _ref2.window;
13956
13984
  var title = _this.windowTitle && _this.windowTitle(_this.read());
@@ -14078,7 +14106,9 @@
14078
14106
  if (this.writeTimer) {
14079
14107
  clearTimeout(this.writeTimer);
14080
14108
  }
14081
- this.write({});
14109
+ if (this._cleanUrlOnDispose) {
14110
+ this.write({});
14111
+ }
14082
14112
  }
14083
14113
  }, {
14084
14114
  key: "start",
@@ -14167,7 +14197,8 @@
14167
14197
  } : _ref7$getLocation,
14168
14198
  start = _ref7.start,
14169
14199
  dispose = _ref7.dispose,
14170
- push = _ref7.push;
14200
+ push = _ref7.push,
14201
+ cleanUrlOnDispose = _ref7.cleanUrlOnDispose;
14171
14202
  return new BrowserHistory({
14172
14203
  createURL: createURL,
14173
14204
  parseURL: parseURL,
@@ -14176,14 +14207,15 @@
14176
14207
  getLocation: getLocation,
14177
14208
  start: start,
14178
14209
  dispose: dispose,
14179
- push: push
14210
+ push: push,
14211
+ cleanUrlOnDispose: cleanUrlOnDispose
14180
14212
  });
14181
14213
  }
14182
14214
 
14183
- var _excluded$9 = ["configure"];
14215
+ var _excluded$6 = ["configure"];
14184
14216
  function getIndexStateWithoutConfigure(uiState) {
14185
14217
  var configure = uiState.configure,
14186
- trackedUiState = _objectWithoutProperties(uiState, _excluded$9);
14218
+ trackedUiState = _objectWithoutProperties(uiState, _excluded$6);
14187
14219
  return trackedUiState;
14188
14220
  }
14189
14221
 
@@ -14268,7 +14300,7 @@
14268
14300
  };
14269
14301
  };
14270
14302
 
14271
- var _excluded$a = ["initialSearchParameters"];
14303
+ var _excluded$7 = ["initialSearchParameters"];
14272
14304
  var withUsage$q = createDocumentationMessageGenerator({
14273
14305
  name: 'index-widget'
14274
14306
  });
@@ -14308,7 +14340,7 @@
14308
14340
  }
14309
14341
  function getLocalWidgetsSearchParameters(widgets, widgetSearchParametersOptions) {
14310
14342
  var initialSearchParameters = widgetSearchParametersOptions.initialSearchParameters,
14311
- rest = _objectWithoutProperties(widgetSearchParametersOptions, _excluded$a);
14343
+ rest = _objectWithoutProperties(widgetSearchParametersOptions, _excluded$7);
14312
14344
  return widgets.filter(function (widget) {
14313
14345
  return !isIndexWidget(widget);
14314
14346
  }).reduce(function (state, widget) {
@@ -14815,7 +14847,7 @@
14815
14847
  };
14816
14848
  }
14817
14849
 
14818
- var version$1 = '4.61.0';
14850
+ var version$1 = '4.63.0';
14819
14851
 
14820
14852
  var withUsage$r = createDocumentationMessageGenerator({
14821
14853
  name: 'instantsearch'
@@ -14831,7 +14863,8 @@
14831
14863
  * Global options for an InstantSearch instance.
14832
14864
  */
14833
14865
  var INSTANTSEARCH_FUTURE_DEFAULTS = {
14834
- preserveSharedStateOnUnmount: false
14866
+ preserveSharedStateOnUnmount: false,
14867
+ persistHierarchicalRootCount: false
14835
14868
  };
14836
14869
 
14837
14870
  /**
@@ -15167,7 +15200,9 @@
15167
15200
  // DerivedHelper scoped into the `index` widgets.
15168
15201
  // In Vue InstantSearch' hydrate, a main helper gets set before start, so
15169
15202
  // 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);
15203
+ var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName, undefined, {
15204
+ persistHierarchicalRootCount: this.future.persistHierarchicalRootCount
15205
+ });
15171
15206
  mainHelper.search = function () {
15172
15207
  _this3.status = 'loading';
15173
15208
  _this3.scheduleRender(false);
@@ -15415,10 +15450,10 @@
15415
15450
  history: historyRouter
15416
15451
  });
15417
15452
 
15418
- var _excluded$b = ["configure"];
15453
+ var _excluded$8 = ["configure"];
15419
15454
  function getIndexStateWithoutConfigure$1(uiState) {
15420
15455
  var configure = uiState.configure,
15421
- trackedUiState = _objectWithoutProperties(uiState, _excluded$b);
15456
+ trackedUiState = _objectWithoutProperties(uiState, _excluded$8);
15422
15457
  return trackedUiState;
15423
15458
  }
15424
15459
  function singleIndexStateMapping(indexName) {
@@ -16344,7 +16379,7 @@
16344
16379
 
16345
16380
  var _objectWithoutProperties$1 = unwrapExports(objectWithoutProperties);
16346
16381
 
16347
- var _excluded$c = ["parts", "highlightedTagName", "nonHighlightedTagName", "separator", "className", "classNames"];
16382
+ var _excluded$9 = ["parts", "highlightedTagName", "nonHighlightedTagName", "separator", "className", "classNames"];
16348
16383
 
16349
16384
  function createHighlightPartComponent(_ref) {
16350
16385
  var createElement = _ref.createElement;
@@ -16381,7 +16416,7 @@
16381
16416
  className = userProps.className,
16382
16417
  _userProps$classNames = userProps.classNames,
16383
16418
  classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
16384
- props = _objectWithoutProperties$1(userProps, _excluded$c);
16419
+ props = _objectWithoutProperties$1(userProps, _excluded$9);
16385
16420
 
16386
16421
  return createElement("span", _extends$1({}, props, {
16387
16422
  className: cx(classNames.root, className)
@@ -16409,11 +16444,11 @@
16409
16444
  Fragment: p
16410
16445
  });
16411
16446
 
16412
- var _excluded$d = ["classNames"];
16447
+ var _excluded$a = ["classNames"];
16413
16448
  function Highlight(_ref) {
16414
16449
  var _ref$classNames = _ref.classNames,
16415
16450
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
16416
- props = _objectWithoutProperties(_ref, _excluded$d);
16451
+ props = _objectWithoutProperties(_ref, _excluded$a);
16417
16452
  return h(InternalHighlight, _extends({
16418
16453
  classNames: {
16419
16454
  root: cx('ais-Highlight', classNames.root),
@@ -16424,12 +16459,12 @@
16424
16459
  }, props));
16425
16460
  }
16426
16461
 
16427
- var _excluded$e = ["hit", "attribute", "cssClasses"];
16462
+ var _excluded$b = ["hit", "attribute", "cssClasses"];
16428
16463
  function Highlight$1(_ref) {
16429
16464
  var hit = _ref.hit,
16430
16465
  attribute = _ref.attribute,
16431
16466
  cssClasses = _ref.cssClasses,
16432
- props = _objectWithoutProperties(_ref, _excluded$e);
16467
+ props = _objectWithoutProperties(_ref, _excluded$b);
16433
16468
  var property = getPropertyByPath(hit._highlightResult, attribute) || [];
16434
16469
  var properties = toArray(property);
16435
16470
  _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 +16478,11 @@
16443
16478
  }));
16444
16479
  }
16445
16480
 
16446
- var _excluded$f = ["classNames"];
16481
+ var _excluded$c = ["classNames"];
16447
16482
  function ReverseHighlight(_ref) {
16448
16483
  var _ref$classNames = _ref.classNames,
16449
16484
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
16450
- props = _objectWithoutProperties(_ref, _excluded$f);
16485
+ props = _objectWithoutProperties(_ref, _excluded$c);
16451
16486
  return h(InternalHighlight, _extends({
16452
16487
  classNames: {
16453
16488
  root: cx('ais-ReverseHighlight', classNames.root),
@@ -16458,13 +16493,13 @@
16458
16493
  }, props));
16459
16494
  }
16460
16495
 
16461
- var _excluded$g = ["hit", "attribute", "cssClasses"],
16462
- _excluded2$4 = ["isHighlighted"];
16496
+ var _excluded$d = ["hit", "attribute", "cssClasses"],
16497
+ _excluded2$2 = ["isHighlighted"];
16463
16498
  function ReverseHighlight$1(_ref) {
16464
16499
  var hit = _ref.hit,
16465
16500
  attribute = _ref.attribute,
16466
16501
  cssClasses = _ref.cssClasses,
16467
- props = _objectWithoutProperties(_ref, _excluded$g);
16502
+ props = _objectWithoutProperties(_ref, _excluded$d);
16468
16503
  var property = getPropertyByPath(hit._highlightResult, attribute) || [];
16469
16504
  var properties = toArray(property);
16470
16505
  _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 +16507,7 @@
16472
16507
  var value = _ref2.value;
16473
16508
  return getHighlightedParts(unescape$1(value || '')).map(function (_ref3) {
16474
16509
  var isHighlighted = _ref3.isHighlighted,
16475
- rest = _objectWithoutProperties(_ref3, _excluded2$4);
16510
+ rest = _objectWithoutProperties(_ref3, _excluded2$2);
16476
16511
  return _objectSpread2(_objectSpread2({}, rest), {}, {
16477
16512
  isHighlighted: !isHighlighted
16478
16513
  });
@@ -16484,11 +16519,11 @@
16484
16519
  }));
16485
16520
  }
16486
16521
 
16487
- var _excluded$h = ["classNames"];
16522
+ var _excluded$e = ["classNames"];
16488
16523
  function ReverseSnippet(_ref) {
16489
16524
  var _ref$classNames = _ref.classNames,
16490
16525
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
16491
- props = _objectWithoutProperties(_ref, _excluded$h);
16526
+ props = _objectWithoutProperties(_ref, _excluded$e);
16492
16527
  return h(InternalHighlight, _extends({
16493
16528
  classNames: {
16494
16529
  root: cx('ais-ReverseSnippet', classNames.root),
@@ -16499,13 +16534,13 @@
16499
16534
  }, props));
16500
16535
  }
16501
16536
 
16502
- var _excluded$i = ["hit", "attribute", "cssClasses"],
16503
- _excluded2$5 = ["isHighlighted"];
16537
+ var _excluded$f = ["hit", "attribute", "cssClasses"],
16538
+ _excluded2$3 = ["isHighlighted"];
16504
16539
  function ReverseSnippet$1(_ref) {
16505
16540
  var hit = _ref.hit,
16506
16541
  attribute = _ref.attribute,
16507
16542
  cssClasses = _ref.cssClasses,
16508
- props = _objectWithoutProperties(_ref, _excluded$i);
16543
+ props = _objectWithoutProperties(_ref, _excluded$f);
16509
16544
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
16510
16545
  var properties = toArray(property);
16511
16546
  _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 +16548,7 @@
16513
16548
  var value = _ref2.value;
16514
16549
  return getHighlightedParts(unescape$1(value || '')).map(function (_ref3) {
16515
16550
  var isHighlighted = _ref3.isHighlighted,
16516
- rest = _objectWithoutProperties(_ref3, _excluded2$5);
16551
+ rest = _objectWithoutProperties(_ref3, _excluded2$3);
16517
16552
  return _objectSpread2(_objectSpread2({}, rest), {}, {
16518
16553
  isHighlighted: !isHighlighted
16519
16554
  });
@@ -16525,11 +16560,11 @@
16525
16560
  }));
16526
16561
  }
16527
16562
 
16528
- var _excluded$j = ["classNames"];
16563
+ var _excluded$g = ["classNames"];
16529
16564
  function Snippet(_ref) {
16530
16565
  var _ref$classNames = _ref.classNames,
16531
16566
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
16532
- props = _objectWithoutProperties(_ref, _excluded$j);
16567
+ props = _objectWithoutProperties(_ref, _excluded$g);
16533
16568
  return h(InternalHighlight, _extends({
16534
16569
  classNames: {
16535
16570
  root: cx('ais-Snippet', classNames.root),
@@ -16540,12 +16575,12 @@
16540
16575
  }, props));
16541
16576
  }
16542
16577
 
16543
- var _excluded$k = ["hit", "attribute", "cssClasses"];
16578
+ var _excluded$h = ["hit", "attribute", "cssClasses"];
16544
16579
  function Snippet$1(_ref) {
16545
16580
  var hit = _ref.hit,
16546
16581
  attribute = _ref.attribute,
16547
16582
  cssClasses = _ref.cssClasses,
16548
- props = _objectWithoutProperties(_ref, _excluded$k);
16583
+ props = _objectWithoutProperties(_ref, _excluded$h);
16549
16584
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
16550
16585
  var properties = toArray(property);
16551
16586
  _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 +16851,7 @@
16816
16851
  });
16817
16852
  };
16818
16853
 
16819
- var _excluded$l = ["container", "widgets", "fallbackWidget"];
16854
+ var _excluded$i = ["container", "widgets", "fallbackWidget"];
16820
16855
  var withUsage$t = createDocumentationMessageGenerator({
16821
16856
  name: 'dynamic-widgets'
16822
16857
  });
@@ -16834,7 +16869,7 @@
16834
16869
  containerSelector = _ref.container,
16835
16870
  widgets = _ref.widgets,
16836
16871
  fallbackWidget = _ref.fallbackWidget,
16837
- otherWidgetParams = _objectWithoutProperties(_ref, _excluded$l);
16872
+ otherWidgetParams = _objectWithoutProperties(_ref, _excluded$i);
16838
16873
  if (!containerSelector) {
16839
16874
  throw new Error(withUsage$t('The `container` option is required.'));
16840
16875
  }
@@ -17808,9 +17843,9 @@
17808
17843
  }), container.querySelector(".".concat(cssClasses.tree)));
17809
17844
  };
17810
17845
 
17811
- var _excluded$m = ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"],
17812
- _excluded2$6 = ["item"],
17813
- _excluded3$1 = ["item"];
17846
+ var _excluded$j = ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"],
17847
+ _excluded2$4 = ["item"],
17848
+ _excluded3 = ["item"];
17814
17849
  var withUsage$y = createDocumentationMessageGenerator({
17815
17850
  name: 'geo-search'
17816
17851
  });
@@ -17852,7 +17887,7 @@
17852
17887
  enableRefineControl = _ref$enableRefineCont === void 0 ? true : _ref$enableRefineCont,
17853
17888
  container = _ref.container,
17854
17889
  googleReference = _ref.googleReference,
17855
- otherWidgetParams = _objectWithoutProperties(_ref, _excluded$m);
17890
+ otherWidgetParams = _objectWithoutProperties(_ref, _excluded$j);
17856
17891
  var defaultBuiltInMarker = {
17857
17892
  createOptions: function createOptions() {
17858
17893
  return {};
@@ -17911,7 +17946,7 @@
17911
17946
  var customHTMLMarker = isCustomHTMLMarker && _objectSpread2(_objectSpread2({}, defaultCustomHTMLMarker), userCustomHTMLMarker);
17912
17947
  var createBuiltInMarker = function createBuiltInMarker(_ref2) {
17913
17948
  var item = _ref2.item,
17914
- rest = _objectWithoutProperties(_ref2, _excluded2$6);
17949
+ rest = _objectWithoutProperties(_ref2, _excluded2$4);
17915
17950
  return new googleReference.maps.Marker(_objectSpread2(_objectSpread2(_objectSpread2({}, builtInMarker.createOptions(item)), rest), {}, {
17916
17951
  // @ts-expect-error @types/googlemaps doesn't document this
17917
17952
  __id: item.objectID,
@@ -17921,7 +17956,7 @@
17921
17956
  var HTMLMarker = createHTMLMarker(googleReference);
17922
17957
  var createCustomHTMLMarker = function createCustomHTMLMarker(_ref3) {
17923
17958
  var item = _ref3.item,
17924
- rest = _objectWithoutProperties(_ref3, _excluded3$1);
17959
+ rest = _objectWithoutProperties(_ref3, _excluded3);
17925
17960
  return new HTMLMarker(_objectSpread2(_objectSpread2(_objectSpread2({}, customHTMLMarker.createOptions(item)), rest), {}, {
17926
17961
  __id: item.objectID,
17927
17962
  position: item._geoloc,
@@ -17994,13 +18029,15 @@
17994
18029
  refine = _this$props.refine,
17995
18030
  onChange = _this$props.onChange;
17996
18031
  var query = event.target.value;
17997
- if (searchAsYouType) {
17998
- refine(query);
18032
+ if (event.type === 'compositionend' || !event.isComposing) {
18033
+ if (searchAsYouType) {
18034
+ refine(query);
18035
+ }
18036
+ _this.setState({
18037
+ query: query
18038
+ });
18039
+ onChange(event);
17999
18040
  }
18000
- _this.setState({
18001
- query: query
18002
- });
18003
- onChange(event);
18004
18041
  });
18005
18042
  _defineProperty(_assertThisInitialized(_this), "onSubmit", function (event) {
18006
18043
  var _this$props2 = _this.props,
@@ -18110,7 +18147,11 @@
18110
18147
  ,
18111
18148
  spellCheck: "false",
18112
18149
  maxLength: 512,
18113
- onInput: this.onInput,
18150
+ onInput: this.onInput
18151
+ // see: https://github.com/preactjs/preact/issues/1978
18152
+ // eslint-disable-next-line react/no-unknown-property
18153
+ ,
18154
+ oncompositionend: this.onInput,
18114
18155
  onBlur: this.onBlur,
18115
18156
  onFocus: this.onFocus,
18116
18157
  "aria-label": ariaLabel
@@ -18182,7 +18223,7 @@
18182
18223
  })), subItems);
18183
18224
  }
18184
18225
 
18185
- var _excluded$n = ["root"];
18226
+ var _excluded$k = ["root"];
18186
18227
 
18187
18228
  // CSS types
18188
18229
 
@@ -18209,7 +18250,7 @@
18209
18250
  if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
18210
18251
  var _this$props$cssClasse = _this.props.cssClasses,
18211
18252
  root = _this$props$cssClasse.root,
18212
- cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$n);
18253
+ cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$k);
18213
18254
  subItems = h(RefinementList, _extends({}, _this.props, {
18214
18255
  // We want to keep `root` required for external usage but not for the
18215
18256
  // sub items.
@@ -19865,8 +19906,8 @@
19865
19906
  };
19866
19907
  };
19867
19908
 
19868
- var _excluded$o = ["placesReference", "defaultPosition"],
19869
- _excluded2$7 = ["places"];
19909
+ var _excluded$l = ["placesReference", "defaultPosition"],
19910
+ _excluded2$5 = ["places"];
19870
19911
  /* Places.js is an optional dependency, no error should be reported if the package is missing */
19871
19912
  /** @ts-ignore */
19872
19913
  // using the type like this requires only one ts-ignore
@@ -19879,7 +19920,7 @@
19879
19920
  placesReference = _ref.placesReference,
19880
19921
  _ref$defaultPosition = _ref.defaultPosition,
19881
19922
  defaultPosition = _ref$defaultPosition === void 0 ? [] : _ref$defaultPosition,
19882
- placesOptions = _objectWithoutProperties(_ref, _excluded$o);
19923
+ placesOptions = _objectWithoutProperties(_ref, _excluded$l);
19883
19924
  if (typeof placesReference !== 'function') {
19884
19925
  throw new Error('The `placesReference` option requires a valid Places.js reference.');
19885
19926
  }
@@ -19920,7 +19961,7 @@
19920
19961
  var hasPositionSet = position !== defaultPosition.join(',');
19921
19962
  if (!hasPositionSet && !state.query) {
19922
19963
  var places = uiState.places,
19923
- uiStateWithoutPlaces = _objectWithoutProperties(uiState, _excluded2$7);
19964
+ uiStateWithoutPlaces = _objectWithoutProperties(uiState, _excluded2$5);
19924
19965
  return uiStateWithoutPlaces;
19925
19966
  }
19926
19967
  return _objectSpread2(_objectSpread2({}, uiState), {}, {
@@ -21917,13 +21958,13 @@
21917
21958
  });
21918
21959
  };
21919
21960
 
21920
- var _excluded$p = ["nbHits", "nbSortedHits", "cssClasses", "templateProps"];
21961
+ var _excluded$m = ["nbHits", "nbSortedHits", "cssClasses", "templateProps"];
21921
21962
  var Stats = function Stats(_ref) {
21922
21963
  var nbHits = _ref.nbHits,
21923
21964
  nbSortedHits = _ref.nbSortedHits,
21924
21965
  cssClasses = _ref.cssClasses,
21925
21966
  templateProps = _ref.templateProps,
21926
- rest = _objectWithoutProperties(_ref, _excluded$p);
21967
+ rest = _objectWithoutProperties(_ref, _excluded$m);
21927
21968
  return h("div", {
21928
21969
  className: cx(cssClasses.root)
21929
21970
  }, h(Template, _extends({}, templateProps, {