instantsearch.js 4.60.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.
Files changed (38) hide show
  1. package/cjs/components/SearchBox/SearchBox.js +2 -2
  2. package/cjs/connectors/breadcrumb/connectBreadcrumb.js +14 -5
  3. package/cjs/connectors/dynamic-widgets/connectDynamicWidgets.js +2 -3
  4. package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +14 -5
  5. package/cjs/connectors/menu/connectMenu.js +14 -5
  6. package/cjs/connectors/numeric-menu/connectNumericMenu.js +14 -5
  7. package/cjs/connectors/rating-menu/connectRatingMenu.js +15 -6
  8. package/cjs/connectors/refinement-list/connectRefinementList.js +14 -5
  9. package/cjs/lib/InstantSearch.js +5 -2
  10. package/cjs/lib/utils/hydrateSearchClient.js +39 -29
  11. package/cjs/lib/version.js +1 -1
  12. package/cjs/widgets/search-box/defaultTemplates.js +9 -3
  13. package/dist/instantsearch.development.d.ts +23 -3
  14. package/dist/instantsearch.development.js +167 -81
  15. package/dist/instantsearch.development.js.map +1 -1
  16. package/dist/instantsearch.production.d.ts +23 -3
  17. package/dist/instantsearch.production.min.d.ts +23 -3
  18. package/dist/instantsearch.production.min.js +2 -2
  19. package/dist/instantsearch.production.min.js.map +1 -1
  20. package/es/components/SearchBox/SearchBox.js +2 -2
  21. package/es/connectors/breadcrumb/connectBreadcrumb.js +14 -5
  22. package/es/connectors/dynamic-widgets/connectDynamicWidgets.d.ts +12 -2
  23. package/es/connectors/dynamic-widgets/connectDynamicWidgets.js +2 -3
  24. package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +14 -5
  25. package/es/connectors/menu/connectMenu.js +14 -5
  26. package/es/connectors/numeric-menu/connectNumericMenu.js +14 -5
  27. package/es/connectors/rating-menu/connectRatingMenu.d.ts +1 -1
  28. package/es/connectors/rating-menu/connectRatingMenu.js +15 -6
  29. package/es/connectors/refinement-list/connectRefinementList.js +14 -5
  30. package/es/lib/InstantSearch.d.ts +10 -0
  31. package/es/lib/InstantSearch.js +5 -2
  32. package/es/lib/utils/hydrateSearchClient.d.ts +5 -2
  33. package/es/lib/utils/hydrateSearchClient.js +39 -29
  34. package/es/lib/utils/render-args.d.ts +4 -4
  35. package/es/lib/version.d.ts +1 -1
  36. package/es/lib/version.js +1 -1
  37. package/es/widgets/search-box/defaultTemplates.js +10 -3
  38. package/package.json +6 -6
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.60.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) :
@@ -1411,8 +1411,6 @@
1411
1411
  });
1412
1412
  }
1413
1413
 
1414
- // @ts-nocheck (types to be fixed during actual implementation)
1415
-
1416
1414
  function hydrateSearchClient(client, results) {
1417
1415
  if (!results) {
1418
1416
  return;
@@ -1422,9 +1420,22 @@
1422
1420
  // - Algoliasearch API Client < v4 with cache disabled
1423
1421
  // - Third party clients (detected by the `addAlgoliaAgent` function missing)
1424
1422
 
1425
- if ((!client.transporter || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== 'function')) {
1423
+ if ((!('transporter' in client) || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== 'function')) {
1426
1424
  return;
1427
1425
  }
1426
+ var cachedRequest = Object.keys(results).map(function (key) {
1427
+ return results[key].results.map(function (result) {
1428
+ return {
1429
+ indexName: result.index,
1430
+ // We normalize the params received from the server as they can
1431
+ // be serialized differently depending on the engine.
1432
+ params: serializeQueryParameters(deserializeQueryParameters(result.params))
1433
+ };
1434
+ });
1435
+ });
1436
+ var cachedResults = Object.keys(results).reduce(function (acc, key) {
1437
+ return acc.concat(results[key].results);
1438
+ }, []);
1428
1439
 
1429
1440
  // Algoliasearch API Client >= v4
1430
1441
  // To hydrate the client we need to populate the cache with the data from
@@ -1433,9 +1444,10 @@
1433
1444
  // for us to compute the key the same way as `algoliasearch-client` we need
1434
1445
  // to populate it on a custom key and override the `search` method to
1435
1446
  // search on it first.
1436
- if (client.transporter && !client._cacheHydrated) {
1447
+ if ('transporter' in client && !client._cacheHydrated) {
1437
1448
  client._cacheHydrated = true;
1438
1449
  var baseMethod = client.search;
1450
+ // @ts-ignore wanting type checks for v3 on this would make this too complex
1439
1451
  client.search = function (requests) {
1440
1452
  for (var _len = arguments.length, methodArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1441
1453
  methodArgs[_key - 1] = arguments[_key];
@@ -1452,22 +1464,11 @@
1452
1464
  return baseMethod.apply(void 0, [requests].concat(methodArgs));
1453
1465
  });
1454
1466
  };
1455
-
1456
- // Populate the cache with the data from the server
1457
1467
  client.transporter.responsesCache.set({
1458
1468
  method: 'search',
1459
- args: [Object.keys(results).reduce(function (acc, key) {
1460
- return acc.concat(results[key].results.map(function (request) {
1461
- return {
1462
- indexName: request.index,
1463
- params: request.params
1464
- };
1465
- }));
1466
- }, [])]
1469
+ args: cachedRequest
1467
1470
  }, {
1468
- results: Object.keys(results).reduce(function (acc, key) {
1469
- return acc.concat(results[key].results);
1470
- }, [])
1471
+ results: cachedResults
1471
1472
  });
1472
1473
  }
1473
1474
 
@@ -1477,24 +1478,27 @@
1477
1478
  // a single-index result. You can find more information about the
1478
1479
  // computation of the key inside the client (see link below).
1479
1480
  // https://github.com/algolia/algoliasearch-client-javascript/blob/c27e89ff92b2a854ae6f40dc524bffe0f0cbc169/src/AlgoliaSearchCore.js#L232-L240
1480
- if (!client.transporter) {
1481
+ if (!('transporter' in client)) {
1481
1482
  var cacheKey = "/1/indexes/*/queries_body_".concat(JSON.stringify({
1482
- requests: Object.keys(results).reduce(function (acc, key) {
1483
- return acc.concat(results[key].rawResults.map(function (request) {
1484
- return {
1485
- indexName: request.index,
1486
- params: request.params
1487
- };
1488
- }));
1489
- }, [])
1483
+ requests: cachedRequest
1490
1484
  }));
1491
1485
  client.cache = _objectSpread2(_objectSpread2({}, client.cache), {}, _defineProperty({}, cacheKey, JSON.stringify({
1492
- results: Object.keys(results).reduce(function (acc, key) {
1493
- return acc.concat(results[key].rawResults);
1494
- }, [])
1486
+ results: Object.keys(results).map(function (key) {
1487
+ return results[key].results;
1488
+ })
1495
1489
  })));
1496
1490
  }
1497
1491
  }
1492
+ function deserializeQueryParameters(parameters) {
1493
+ return parameters.split('&').reduce(function (acc, parameter) {
1494
+ var _parameter$split = parameter.split('='),
1495
+ _parameter$split2 = _slicedToArray(_parameter$split, 2),
1496
+ key = _parameter$split2[0],
1497
+ value = _parameter$split2[1];
1498
+ acc[key] = value ? decodeURIComponent(value) : '';
1499
+ return acc;
1500
+ }, {});
1501
+ }
1498
1502
 
1499
1503
  // This function is copied from the algoliasearch v4 API Client. If modified,
1500
1504
  // consider updating it also in `serializeQueryParameters` from `@algolia/transporter`.
@@ -1950,8 +1954,8 @@
1950
1954
  }))) {
1951
1955
  throw new Error(withUsage$1('The `widgets` option expects an array of widgets.'));
1952
1956
  }
1953
- if (!(Array.isArray(facets) && facets.length <= 1 && (facets[0] === '*' || facets[0] === undefined))) {
1954
- throw new Error(withUsage$1("The `facets` option only accepts [] or [\"*\"], you passed ".concat(JSON.stringify(facets))));
1957
+ if (!Array.isArray(facets)) {
1958
+ throw new Error(withUsage$1("The `facets` option only accepts an array of facets, you passed ".concat(JSON.stringify(facets))));
1955
1959
  }
1956
1960
  var localWidgets = new Map();
1957
1961
  return {
@@ -2029,7 +2033,6 @@
2029
2033
  unmountFn();
2030
2034
  },
2031
2035
  getWidgetSearchParameters: function getWidgetSearchParameters(state) {
2032
- // broadening the scope of facets to avoid conflict between never and *
2033
2036
  return facets.reduce(function (acc, curr) {
2034
2037
  return acc.addFacet(curr);
2035
2038
  }, state.setQueryParameters({
@@ -2572,12 +2575,9 @@
2572
2575
  getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
2573
2576
  var searchParameters = _ref5.searchParameters;
2574
2577
  var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
2575
- if (!path.length) {
2576
- return uiState;
2577
- }
2578
- return _objectSpread2(_objectSpread2({}, uiState), {}, {
2578
+ return removeEmptyRefinementsFromUiState(_objectSpread2(_objectSpread2({}, uiState), {}, {
2579
2579
  hierarchicalMenu: _objectSpread2(_objectSpread2({}, uiState.hierarchicalMenu), {}, _defineProperty({}, hierarchicalFacetName, path))
2580
- });
2580
+ }), hierarchicalFacetName);
2581
2581
  },
2582
2582
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
2583
2583
  var uiState = _ref6.uiState;
@@ -2610,6 +2610,18 @@
2610
2610
  };
2611
2611
  };
2612
2612
  };
2613
+ function removeEmptyRefinementsFromUiState(indexUiState, attribute) {
2614
+ if (!indexUiState.hierarchicalMenu) {
2615
+ return indexUiState;
2616
+ }
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;
2624
+ }
2613
2625
 
2614
2626
  var withUsage$5 = createDocumentationMessageGenerator({
2615
2627
  name: 'hits',
@@ -3465,12 +3477,9 @@
3465
3477
  var _searchParameters$get = searchParameters.getHierarchicalFacetBreadcrumb(attribute),
3466
3478
  _searchParameters$get2 = _slicedToArray(_searchParameters$get, 1),
3467
3479
  value = _searchParameters$get2[0];
3468
- if (!value) {
3469
- return uiState;
3470
- }
3471
- return _objectSpread2(_objectSpread2({}, uiState), {}, {
3480
+ return removeEmptyRefinementsFromUiState$1(_objectSpread2(_objectSpread2({}, uiState), {}, {
3472
3481
  menu: _objectSpread2(_objectSpread2({}, uiState.menu), {}, _defineProperty({}, attribute, value))
3473
- });
3482
+ }), attribute);
3474
3483
  },
3475
3484
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
3476
3485
  var uiState = _ref5.uiState;
@@ -3496,6 +3505,18 @@
3496
3505
  };
3497
3506
  };
3498
3507
  };
3508
+ function removeEmptyRefinementsFromUiState$1(indexUiState, attribute) {
3509
+ if (!indexUiState.menu) {
3510
+ return indexUiState;
3511
+ }
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;
3519
+ }
3499
3520
 
3500
3521
  var withUsage$9 = createDocumentationMessageGenerator({
3501
3522
  name: 'numeric-menu',
@@ -3580,12 +3601,9 @@
3580
3601
  }
3581
3602
  var min = values['>='] && values['>='][0] || '';
3582
3603
  var max = values['<='] && values['<='][0] || '';
3583
- if (min === '' && max === '') {
3584
- return uiState;
3585
- }
3586
- return _objectSpread2(_objectSpread2({}, uiState), {}, {
3604
+ return removeEmptyRefinementsFromUiState$2(_objectSpread2(_objectSpread2({}, uiState), {}, {
3587
3605
  numericMenu: _objectSpread2(_objectSpread2({}, uiState.numericMenu), {}, _defineProperty({}, attribute, "".concat(min, ":").concat(max)))
3588
- });
3606
+ }), attribute);
3589
3607
  },
3590
3608
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
3591
3609
  var uiState = _ref6.uiState;
@@ -3747,6 +3765,18 @@
3747
3765
  function hasNumericRefinement(currentRefinements, operator, value) {
3748
3766
  return currentRefinements[operator] !== undefined && currentRefinements[operator].includes(value);
3749
3767
  }
3768
+ function removeEmptyRefinementsFromUiState$2(indexUiState, attribute) {
3769
+ if (!indexUiState.numericMenu) {
3770
+ return indexUiState;
3771
+ }
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;
3779
+ }
3750
3780
 
3751
3781
  var Paginator = /*#__PURE__*/function () {
3752
3782
  function Paginator(params) {
@@ -4432,12 +4462,9 @@
4432
4462
  getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
4433
4463
  var searchParameters = _ref5.searchParameters;
4434
4464
  var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
4435
- if (!values.length) {
4436
- return uiState;
4437
- }
4438
- return _objectSpread2(_objectSpread2({}, uiState), {}, {
4465
+ return removeEmptyRefinementsFromUiState$3(_objectSpread2(_objectSpread2({}, uiState), {}, {
4439
4466
  refinementList: _objectSpread2(_objectSpread2({}, uiState.refinementList), {}, _defineProperty({}, attribute, values))
4440
- });
4467
+ }), attribute);
4441
4468
  },
4442
4469
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
4443
4470
  var uiState = _ref6.uiState;
@@ -4467,6 +4494,18 @@
4467
4494
  };
4468
4495
  };
4469
4496
  };
4497
+ function removeEmptyRefinementsFromUiState$3(indexUiState, attribute) {
4498
+ if (!indexUiState.refinementList) {
4499
+ return indexUiState;
4500
+ }
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;
4508
+ }
4470
4509
 
4471
4510
  var withUsage$d = createDocumentationMessageGenerator({
4472
4511
  name: 'search-box',
@@ -4901,12 +4940,9 @@
4901
4940
  getWidgetUiState: function getWidgetUiState(uiState, _ref7) {
4902
4941
  var searchParameters = _ref7.searchParameters;
4903
4942
  var value = _getRefinedStar(searchParameters);
4904
- if (typeof value !== 'number') {
4905
- return uiState;
4906
- }
4907
- return _objectSpread2(_objectSpread2({}, uiState), {}, {
4908
- ratingMenu: _objectSpread2(_objectSpread2({}, uiState.ratingMenu), {}, _defineProperty({}, attribute, value))
4909
- });
4943
+ return removeEmptyRefinementsFromUiState$4(_objectSpread2(_objectSpread2({}, uiState), {}, {
4944
+ ratingMenu: _objectSpread2(_objectSpread2({}, uiState.ratingMenu), {}, _defineProperty({}, attribute, typeof value === 'number' ? value : undefined))
4945
+ }), attribute);
4910
4946
  },
4911
4947
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref8) {
4912
4948
  var uiState = _ref8.uiState;
@@ -4923,6 +4959,18 @@
4923
4959
  };
4924
4960
  };
4925
4961
  };
4962
+ function removeEmptyRefinementsFromUiState$4(indexUiState, attribute) {
4963
+ if (!indexUiState.ratingMenu) {
4964
+ return indexUiState;
4965
+ }
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;
4973
+ }
4926
4974
 
4927
4975
  var withUsage$g = createDocumentationMessageGenerator({
4928
4976
  name: 'stats',
@@ -5392,12 +5440,9 @@
5392
5440
  getWidgetUiState: function getWidgetUiState(uiState, _ref3) {
5393
5441
  var searchParameters = _ref3.searchParameters;
5394
5442
  var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
5395
- if (!path.length) {
5396
- return uiState;
5397
- }
5398
- return _objectSpread2(_objectSpread2({}, uiState), {}, {
5443
+ return removeEmptyRefinementsFromUiState$5(_objectSpread2(_objectSpread2({}, uiState), {}, {
5399
5444
  hierarchicalMenu: _objectSpread2(_objectSpread2({}, uiState.hierarchicalMenu), {}, _defineProperty({}, hierarchicalFacetName, path))
5400
- });
5445
+ }), hierarchicalFacetName);
5401
5446
  },
5402
5447
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref4) {
5403
5448
  var uiState = _ref4.uiState;
@@ -5448,6 +5493,18 @@
5448
5493
  };
5449
5494
  });
5450
5495
  }
5496
+ function removeEmptyRefinementsFromUiState$5(indexUiState, attribute) {
5497
+ if (!indexUiState.hierarchicalMenu) {
5498
+ return indexUiState;
5499
+ }
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;
5507
+ }
5451
5508
 
5452
5509
  var withUsage$j = createDocumentationMessageGenerator({
5453
5510
  name: 'geo-search',
@@ -8972,7 +9029,6 @@
8972
9029
  );
8973
9030
  }
8974
9031
 
8975
- // eslint-disable-next-line valid-jsdoc
8976
9032
  /**
8977
9033
  * Constructor for SearchResults
8978
9034
  * @class
@@ -8980,6 +9036,7 @@
8980
9036
  * {@link AlgoliaSearchHelper}.
8981
9037
  * @param {SearchParameters} state state that led to the response
8982
9038
  * @param {array.<object>} results the results from algolia client
9039
+ * @param {object} options options to control results content
8983
9040
  * @example <caption>SearchResults of the first query in
8984
9041
  * <a href="http://demos.algolia.com/instant-search-demo">the instant search demo</a></caption>
8985
9042
  {
@@ -9117,8 +9174,14 @@
9117
9174
  });
9118
9175
 
9119
9176
  // Make every key of the result options reachable from the instance
9120
- Object.keys(options || {}).forEach(function (key) {
9121
- 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];
9122
9185
  });
9123
9186
 
9124
9187
  /**
@@ -9468,9 +9531,13 @@
9468
9531
  // We want
9469
9532
  // | beers (5)
9470
9533
  // > IPA (5)
9534
+ // @MAJOR: remove this legacy behaviour in next major version
9471
9535
  var defaultData = {};
9472
9536
 
9473
- if (currentRefinement.length > 0) {
9537
+ if (
9538
+ currentRefinement.length > 0 &&
9539
+ !self.persistHierarchicalRootCount
9540
+ ) {
9474
9541
  var root = currentRefinement[0].split(separator)[0];
9475
9542
  defaultData[root] =
9476
9543
  self.hierarchicalFacets[position][attributeIndex].data[root];
@@ -10019,7 +10086,7 @@
10019
10086
 
10020
10087
  var SearchResults_1 = SearchResults;
10021
10088
 
10022
- var version = '3.15.0';
10089
+ var version = '3.16.0';
10023
10090
 
10024
10091
  var escapeFacetValue$4 = escapeFacetValue_1.escapeFacetValue;
10025
10092
 
@@ -10133,8 +10200,9 @@
10133
10200
  * @param {SearchParameters | object} options an object defining the initial
10134
10201
  * config of the search. It doesn't have to be a {SearchParameters},
10135
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.
10136
10204
  */
10137
- function AlgoliaSearchHelper(client, index, options) {
10205
+ function AlgoliaSearchHelper(client, index, options, searchResultsOptions) {
10138
10206
  if (typeof client.addAlgoliaAgent === 'function') {
10139
10207
  client.addAlgoliaAgent('JS Helper (' + version + ')');
10140
10208
  }
@@ -10148,6 +10216,7 @@
10148
10216
  this._lastQueryIdReceived = -1;
10149
10217
  this.derivedHelpers = [];
10150
10218
  this._currentNbQueries = 0;
10219
+ this._searchResultsOptions = searchResultsOptions;
10151
10220
  }
10152
10221
 
10153
10222
  inherits_1(AlgoliaSearchHelper, events);
@@ -11420,6 +11489,9 @@
11420
11489
  queryId,
11421
11490
  content
11422
11491
  ) {
11492
+ // eslint-disable-next-line consistent-this
11493
+ var self = this;
11494
+
11423
11495
  // @TODO remove the number of outdated queries discarded instead of just one
11424
11496
 
11425
11497
  if (queryId < this._lastQueryIdReceived) {
@@ -11448,7 +11520,11 @@
11448
11520
  return;
11449
11521
  }
11450
11522
 
11451
- helper.lastResults = new SearchResults_1(state, specificResults);
11523
+ helper.lastResults = new SearchResults_1(
11524
+ state,
11525
+ specificResults,
11526
+ self._searchResultsOptions
11527
+ );
11452
11528
 
11453
11529
  helper.emit('result', {
11454
11530
  results: helper.lastResults,
@@ -11646,10 +11722,11 @@
11646
11722
  * @param {AlgoliaSearch} client an AlgoliaSearch client
11647
11723
  * @param {string} index the name of the index to query
11648
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.
11649
11726
  * @return {AlgoliaSearchHelper} The helper instance
11650
11727
  */
11651
- function algoliasearchHelper(client, index, opts) {
11652
- return new algoliasearch_helper(client, index, opts);
11728
+ function algoliasearchHelper(client, index, opts, searchResultsOptions) {
11729
+ return new algoliasearch_helper(client, index, opts, searchResultsOptions);
11653
11730
  }
11654
11731
 
11655
11732
  /**
@@ -14745,7 +14822,7 @@
14745
14822
  };
14746
14823
  }
14747
14824
 
14748
- var version$1 = '4.60.0';
14825
+ var version$1 = '4.62.0';
14749
14826
 
14750
14827
  var withUsage$r = createDocumentationMessageGenerator({
14751
14828
  name: 'instantsearch'
@@ -14761,7 +14838,8 @@
14761
14838
  * Global options for an InstantSearch instance.
14762
14839
  */
14763
14840
  var INSTANTSEARCH_FUTURE_DEFAULTS = {
14764
- preserveSharedStateOnUnmount: false
14841
+ preserveSharedStateOnUnmount: false,
14842
+ persistHierarchicalRootCount: false
14765
14843
  };
14766
14844
 
14767
14845
  /**
@@ -15097,7 +15175,9 @@
15097
15175
  // DerivedHelper scoped into the `index` widgets.
15098
15176
  // In Vue InstantSearch' hydrate, a main helper gets set before start, so
15099
15177
  // we need to respect this helper as a way to keep all listeners correct.
15100
- 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
+ });
15101
15181
  mainHelper.search = function () {
15102
15182
  _this3.status = 'loading';
15103
15183
  _this3.scheduleRender(false);
@@ -18050,7 +18130,7 @@
18050
18130
  rootProps: {
18051
18131
  className: cssClasses.submit,
18052
18132
  type: 'submit',
18053
- title: 'Submit the search query.',
18133
+ title: 'Submit the search query',
18054
18134
  hidden: !showSubmit
18055
18135
  },
18056
18136
  templates: templates,
@@ -18063,7 +18143,7 @@
18063
18143
  rootProps: {
18064
18144
  className: cssClasses.reset,
18065
18145
  type: 'reset',
18066
- title: 'Clear the search query.',
18146
+ title: 'Clear the search query',
18067
18147
  hidden: !(showReset && this.state.query.trim() && !isSearchStalled)
18068
18148
  },
18069
18149
  templates: templates,
@@ -21267,12 +21347,12 @@
21267
21347
  });
21268
21348
  var _ref6$1 = h("g", {
21269
21349
  fill: "none",
21270
- fillRule: "evenodd"
21350
+ "fill-rule": "evenodd"
21271
21351
  }, h("g", {
21272
21352
  transform: "translate(1 1)",
21273
- strokeWidth: "2"
21353
+ "stroke-width": "2"
21274
21354
  }, h("circle", {
21275
- strokeOpacity: ".5",
21355
+ "stroke-opacity": ".5",
21276
21356
  cx: "18",
21277
21357
  cy: "18",
21278
21358
  r: "18"
@@ -21309,7 +21389,12 @@
21309
21389
  },
21310
21390
  loadingIndicator: function loadingIndicator(_ref5) {
21311
21391
  var cssClasses = _ref5.cssClasses;
21392
+ /* eslint-disable react/no-unknown-property */
21393
+ // Preact supports kebab case attributes, and using camel case would
21394
+ // require using `preact/compat`.
21395
+ // @TODO: reconsider using the `react` ESLint preset
21312
21396
  return h("svg", {
21397
+ "aria-label": "Results are loading",
21313
21398
  className: cssClasses.loadingIcon,
21314
21399
  width: "16",
21315
21400
  height: "16",
@@ -21317,6 +21402,7 @@
21317
21402
  stroke: "#444",
21318
21403
  "aria-hidden": "true"
21319
21404
  }, _ref6$1);
21405
+ /* eslint-enable react/no-unknown-property */
21320
21406
  }
21321
21407
  };
21322
21408