react-instantsearch-core 7.3.0 → 7.4.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.
@@ -7,7 +7,7 @@
7
7
 
8
8
  var React__default = 'default' in React ? React['default'] : React;
9
9
 
10
- var version = '7.3.0';
10
+ var version = '7.4.0';
11
11
 
12
12
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -7294,6 +7294,55 @@
7294
7294
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
7295
7295
  }, _typeof$6(obj);
7296
7296
  }
7297
+ function _slicedToArray$3(arr, i) {
7298
+ return _arrayWithHoles$3(arr) || _iterableToArrayLimit$3(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$3();
7299
+ }
7300
+ function _nonIterableRest$3() {
7301
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7302
+ }
7303
+ function _unsupportedIterableToArray$3(o, minLen) {
7304
+ if (!o) return;
7305
+ if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
7306
+ var n = Object.prototype.toString.call(o).slice(8, -1);
7307
+ if (n === "Object" && o.constructor) n = o.constructor.name;
7308
+ if (n === "Map" || n === "Set") return Array.from(o);
7309
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
7310
+ }
7311
+ function _arrayLikeToArray$3(arr, len) {
7312
+ if (len == null || len > arr.length) len = arr.length;
7313
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
7314
+ return arr2;
7315
+ }
7316
+ function _iterableToArrayLimit$3(arr, i) {
7317
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
7318
+ if (null != _i) {
7319
+ var _s,
7320
+ _e,
7321
+ _x,
7322
+ _r,
7323
+ _arr = [],
7324
+ _n = !0,
7325
+ _d = !1;
7326
+ try {
7327
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
7328
+ if (Object(_i) !== _i) return;
7329
+ _n = !1;
7330
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
7331
+ } catch (err) {
7332
+ _d = !0, _e = err;
7333
+ } finally {
7334
+ try {
7335
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
7336
+ } finally {
7337
+ if (_d) throw _e;
7338
+ }
7339
+ }
7340
+ return _arr;
7341
+ }
7342
+ }
7343
+ function _arrayWithHoles$3(arr) {
7344
+ if (Array.isArray(arr)) return arr;
7345
+ }
7297
7346
  function ownKeys$5(object, enumerableOnly) {
7298
7347
  var keys = Object.keys(object);
7299
7348
  if (Object.getOwnPropertySymbols) {
@@ -7343,8 +7392,6 @@
7343
7392
  }
7344
7393
  return (hint === "string" ? String : Number)(input);
7345
7394
  }
7346
- // @ts-nocheck (types to be fixed during actual implementation)
7347
-
7348
7395
  function hydrateSearchClient(client, results) {
7349
7396
  if (!results) {
7350
7397
  return;
@@ -7354,9 +7401,22 @@
7354
7401
  // - Algoliasearch API Client < v4 with cache disabled
7355
7402
  // - Third party clients (detected by the `addAlgoliaAgent` function missing)
7356
7403
 
7357
- if ((!client.transporter || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== 'function')) {
7404
+ if ((!('transporter' in client) || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== 'function')) {
7358
7405
  return;
7359
7406
  }
7407
+ var cachedRequest = Object.keys(results).map(function (key) {
7408
+ return results[key].results.map(function (result) {
7409
+ return {
7410
+ indexName: result.index,
7411
+ // We normalize the params received from the server as they can
7412
+ // be serialized differently depending on the engine.
7413
+ params: serializeQueryParameters(deserializeQueryParameters(result.params))
7414
+ };
7415
+ });
7416
+ });
7417
+ var cachedResults = Object.keys(results).reduce(function (acc, key) {
7418
+ return acc.concat(results[key].results);
7419
+ }, []);
7360
7420
 
7361
7421
  // Algoliasearch API Client >= v4
7362
7422
  // To hydrate the client we need to populate the cache with the data from
@@ -7365,9 +7425,10 @@
7365
7425
  // for us to compute the key the same way as `algoliasearch-client` we need
7366
7426
  // to populate it on a custom key and override the `search` method to
7367
7427
  // search on it first.
7368
- if (client.transporter && !client._cacheHydrated) {
7428
+ if ('transporter' in client && !client._cacheHydrated) {
7369
7429
  client._cacheHydrated = true;
7370
7430
  var baseMethod = client.search;
7431
+ // @ts-ignore wanting type checks for v3 on this would make this too complex
7371
7432
  client.search = function (requests) {
7372
7433
  for (var _len = arguments.length, methodArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
7373
7434
  methodArgs[_key - 1] = arguments[_key];
@@ -7384,22 +7445,11 @@
7384
7445
  return baseMethod.apply(void 0, [requests].concat(methodArgs));
7385
7446
  });
7386
7447
  };
7387
-
7388
- // Populate the cache with the data from the server
7389
7448
  client.transporter.responsesCache.set({
7390
7449
  method: 'search',
7391
- args: [Object.keys(results).reduce(function (acc, key) {
7392
- return acc.concat(results[key].results.map(function (request) {
7393
- return {
7394
- indexName: request.index,
7395
- params: request.params
7396
- };
7397
- }));
7398
- }, [])]
7450
+ args: cachedRequest
7399
7451
  }, {
7400
- results: Object.keys(results).reduce(function (acc, key) {
7401
- return acc.concat(results[key].results);
7402
- }, [])
7452
+ results: cachedResults
7403
7453
  });
7404
7454
  }
7405
7455
 
@@ -7409,24 +7459,27 @@
7409
7459
  // a single-index result. You can find more information about the
7410
7460
  // computation of the key inside the client (see link below).
7411
7461
  // https://github.com/algolia/algoliasearch-client-javascript/blob/c27e89ff92b2a854ae6f40dc524bffe0f0cbc169/src/AlgoliaSearchCore.js#L232-L240
7412
- if (!client.transporter) {
7462
+ if (!('transporter' in client)) {
7413
7463
  var cacheKey = "/1/indexes/*/queries_body_".concat(JSON.stringify({
7414
- requests: Object.keys(results).reduce(function (acc, key) {
7415
- return acc.concat(results[key].rawResults.map(function (request) {
7416
- return {
7417
- indexName: request.index,
7418
- params: request.params
7419
- };
7420
- }));
7421
- }, [])
7464
+ requests: cachedRequest
7422
7465
  }));
7423
7466
  client.cache = _objectSpread$5(_objectSpread$5({}, client.cache), {}, _defineProperty$5({}, cacheKey, JSON.stringify({
7424
- results: Object.keys(results).reduce(function (acc, key) {
7425
- return acc.concat(results[key].rawResults);
7426
- }, [])
7467
+ results: Object.keys(results).map(function (key) {
7468
+ return results[key].results;
7469
+ })
7427
7470
  })));
7428
7471
  }
7429
7472
  }
7473
+ function deserializeQueryParameters(parameters) {
7474
+ return parameters.split('&').reduce(function (acc, parameter) {
7475
+ var _parameter$split = parameter.split('='),
7476
+ _parameter$split2 = _slicedToArray$3(_parameter$split, 2),
7477
+ key = _parameter$split2[0],
7478
+ value = _parameter$split2[1];
7479
+ acc[key] = value ? decodeURIComponent(value) : '';
7480
+ return acc;
7481
+ }, {});
7482
+ }
7430
7483
 
7431
7484
  // This function is copied from the algoliasearch v4 API Client. If modified,
7432
7485
  // consider updating it also in `serializeQueryParameters` from `@algolia/transporter`.
@@ -7690,26 +7743,26 @@
7690
7743
  };
7691
7744
 
7692
7745
  function _toConsumableArray(arr) {
7693
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$3(arr) || _nonIterableSpread();
7746
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$4(arr) || _nonIterableSpread();
7694
7747
  }
7695
7748
  function _nonIterableSpread() {
7696
7749
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7697
7750
  }
7698
- function _unsupportedIterableToArray$3(o, minLen) {
7751
+ function _unsupportedIterableToArray$4(o, minLen) {
7699
7752
  if (!o) return;
7700
- if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
7753
+ if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
7701
7754
  var n = Object.prototype.toString.call(o).slice(8, -1);
7702
7755
  if (n === "Object" && o.constructor) n = o.constructor.name;
7703
7756
  if (n === "Map" || n === "Set") return Array.from(o);
7704
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
7757
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
7705
7758
  }
7706
7759
  function _iterableToArray(iter) {
7707
7760
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
7708
7761
  }
7709
7762
  function _arrayWithoutHoles(arr) {
7710
- if (Array.isArray(arr)) return _arrayLikeToArray$3(arr);
7763
+ if (Array.isArray(arr)) return _arrayLikeToArray$4(arr);
7711
7764
  }
7712
- function _arrayLikeToArray$3(arr, len) {
7765
+ function _arrayLikeToArray$4(arr, len) {
7713
7766
  if (len == null || len > arr.length) len = arr.length;
7714
7767
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
7715
7768
  return arr2;
@@ -8035,7 +8088,7 @@
8035
8088
  };
8036
8089
  };
8037
8090
 
8038
- function _iterableToArrayLimit$3(arr, i) {
8091
+ function _iterableToArrayLimit$4(arr, i) {
8039
8092
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
8040
8093
  if (null != _i) {
8041
8094
  var _s,
@@ -8133,26 +8186,26 @@
8133
8186
  }
8134
8187
  return target;
8135
8188
  }
8136
- function _slicedToArray$3(arr, i) {
8137
- return _arrayWithHoles$3(arr) || _iterableToArrayLimit$3(arr, i) || _unsupportedIterableToArray$4(arr, i) || _nonIterableRest$3();
8189
+ function _slicedToArray$4(arr, i) {
8190
+ return _arrayWithHoles$4(arr) || _iterableToArrayLimit$4(arr, i) || _unsupportedIterableToArray$5(arr, i) || _nonIterableRest$4();
8138
8191
  }
8139
- function _arrayWithHoles$3(arr) {
8192
+ function _arrayWithHoles$4(arr) {
8140
8193
  if (Array.isArray(arr)) return arr;
8141
8194
  }
8142
- function _unsupportedIterableToArray$4(o, minLen) {
8195
+ function _unsupportedIterableToArray$5(o, minLen) {
8143
8196
  if (!o) return;
8144
- if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
8197
+ if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
8145
8198
  var n = Object.prototype.toString.call(o).slice(8, -1);
8146
8199
  if (n === "Object" && o.constructor) n = o.constructor.name;
8147
8200
  if (n === "Map" || n === "Set") return Array.from(o);
8148
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
8201
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
8149
8202
  }
8150
- function _arrayLikeToArray$4(arr, len) {
8203
+ function _arrayLikeToArray$5(arr, len) {
8151
8204
  if (len == null || len > arr.length) len = arr.length;
8152
8205
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
8153
8206
  return arr2;
8154
8207
  }
8155
- function _nonIterableRest$3() {
8208
+ function _nonIterableRest$4() {
8156
8209
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8157
8210
  }
8158
8211
  function _toPrimitive$9(input, hint) {
@@ -8300,7 +8353,7 @@
8300
8353
  var _useState = React.useState(function () {
8301
8354
  return value;
8302
8355
  }),
8303
- _useState2 = _slicedToArray$3(_useState, 2),
8356
+ _useState2 = _slicedToArray$4(_useState, 2),
8304
8357
  stableValue = _useState2[0],
8305
8358
  setStableValue = _useState2[1];
8306
8359
  if (!dequal(stableValue, value)) {
@@ -8506,7 +8559,7 @@
8506
8559
  }
8507
8560
  return {};
8508
8561
  }),
8509
- _useState2 = _slicedToArray$3(_useState, 2),
8562
+ _useState2 = _slicedToArray$4(_useState, 2),
8510
8563
  state = _useState2[0],
8511
8564
  setState = _useState2[1];
8512
8565
  useWidget({
@@ -8612,8 +8665,8 @@
8612
8665
  }))) {
8613
8666
  throw new Error(withUsage$1('The `widgets` option expects an array of widgets.'));
8614
8667
  }
8615
- if (!(Array.isArray(facets) && facets.length <= 1 && (facets[0] === '*' || facets[0] === undefined))) {
8616
- throw new Error(withUsage$1("The `facets` option only accepts [] or [\"*\"], you passed ".concat(JSON.stringify(facets))));
8668
+ if (!Array.isArray(facets)) {
8669
+ throw new Error(withUsage$1("The `facets` option only accepts an array of facets, you passed ".concat(JSON.stringify(facets))));
8617
8670
  }
8618
8671
  var localWidgets = new Map();
8619
8672
  return {
@@ -8691,7 +8744,6 @@
8691
8744
  unmountFn();
8692
8745
  },
8693
8746
  getWidgetSearchParameters: function getWidgetSearchParameters(state) {
8694
- // broadening the scope of facets to avoid conflict between never and *
8695
8747
  return facets.reduce(function (acc, curr) {
8696
8748
  return acc.addFacet(curr);
8697
8749
  }, state.setQueryParameters({
@@ -8844,26 +8896,26 @@
8844
8896
  return (hint === "string" ? String : Number)(input);
8845
8897
  }
8846
8898
  function _toConsumableArray$1(arr) {
8847
- return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$5(arr) || _nonIterableSpread$1();
8899
+ return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread$1();
8848
8900
  }
8849
8901
  function _nonIterableSpread$1() {
8850
8902
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8851
8903
  }
8852
- function _unsupportedIterableToArray$5(o, minLen) {
8904
+ function _unsupportedIterableToArray$6(o, minLen) {
8853
8905
  if (!o) return;
8854
- if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
8906
+ if (typeof o === "string") return _arrayLikeToArray$6(o, minLen);
8855
8907
  var n = Object.prototype.toString.call(o).slice(8, -1);
8856
8908
  if (n === "Object" && o.constructor) n = o.constructor.name;
8857
8909
  if (n === "Map" || n === "Set") return Array.from(o);
8858
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
8910
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
8859
8911
  }
8860
8912
  function _iterableToArray$1(iter) {
8861
8913
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
8862
8914
  }
8863
8915
  function _arrayWithoutHoles$1(arr) {
8864
- if (Array.isArray(arr)) return _arrayLikeToArray$5(arr);
8916
+ if (Array.isArray(arr)) return _arrayLikeToArray$6(arr);
8865
8917
  }
8866
- function _arrayLikeToArray$5(arr, len) {
8918
+ function _arrayLikeToArray$6(arr, len) {
8867
8919
  if (len == null || len > arr.length) len = arr.length;
8868
8920
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
8869
8921
  return arr2;
@@ -9373,7 +9425,7 @@
9373
9425
  var _useReducer = React.useReducer(function (x) {
9374
9426
  return x + 1;
9375
9427
  }, 0),
9376
- _useReducer2 = _slicedToArray$3(_useReducer, 2),
9428
+ _useReducer2 = _slicedToArray$4(_useReducer, 2),
9377
9429
  forceUpdate = _useReducer2[1];
9378
9430
  return forceUpdate;
9379
9431
  }
@@ -9655,13 +9707,13 @@
9655
9707
  }
9656
9708
  return (hint === "string" ? String : Number)(input);
9657
9709
  }
9658
- function _slicedToArray$4(arr, i) {
9659
- return _arrayWithHoles$4(arr) || _iterableToArrayLimit$4(arr, i) || _unsupportedIterableToArray$6(arr, i) || _nonIterableRest$4();
9710
+ function _slicedToArray$5(arr, i) {
9711
+ return _arrayWithHoles$5(arr) || _iterableToArrayLimit$5(arr, i) || _unsupportedIterableToArray$7(arr, i) || _nonIterableRest$5();
9660
9712
  }
9661
- function _nonIterableRest$4() {
9713
+ function _nonIterableRest$5() {
9662
9714
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9663
9715
  }
9664
- function _iterableToArrayLimit$4(arr, i) {
9716
+ function _iterableToArrayLimit$5(arr, i) {
9665
9717
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
9666
9718
  if (null != _i) {
9667
9719
  var _s,
@@ -9688,30 +9740,30 @@
9688
9740
  return _arr;
9689
9741
  }
9690
9742
  }
9691
- function _arrayWithHoles$4(arr) {
9743
+ function _arrayWithHoles$5(arr) {
9692
9744
  if (Array.isArray(arr)) return arr;
9693
9745
  }
9694
9746
  function _toConsumableArray$2(arr) {
9695
- return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread$2();
9747
+ return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread$2();
9696
9748
  }
9697
9749
  function _nonIterableSpread$2() {
9698
9750
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9699
9751
  }
9700
- function _unsupportedIterableToArray$6(o, minLen) {
9752
+ function _unsupportedIterableToArray$7(o, minLen) {
9701
9753
  if (!o) return;
9702
- if (typeof o === "string") return _arrayLikeToArray$6(o, minLen);
9754
+ if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
9703
9755
  var n = Object.prototype.toString.call(o).slice(8, -1);
9704
9756
  if (n === "Object" && o.constructor) n = o.constructor.name;
9705
9757
  if (n === "Map" || n === "Set") return Array.from(o);
9706
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
9758
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
9707
9759
  }
9708
9760
  function _iterableToArray$2(iter) {
9709
9761
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9710
9762
  }
9711
9763
  function _arrayWithoutHoles$2(arr) {
9712
- if (Array.isArray(arr)) return _arrayLikeToArray$6(arr);
9764
+ if (Array.isArray(arr)) return _arrayLikeToArray$7(arr);
9713
9765
  }
9714
- function _arrayLikeToArray$6(arr, len) {
9766
+ function _arrayLikeToArray$7(arr, len) {
9715
9767
  if (len == null || len > arr.length) len = arr.length;
9716
9768
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
9717
9769
  return arr2;
@@ -9767,7 +9819,7 @@
9767
9819
  });
9768
9820
  instantSearchInstance.unuse.apply(instantSearchInstance, _toConsumableArray$2(existingInsightsMiddlewares));
9769
9821
  var _getAppIdAndApiKey = getAppIdAndApiKey(instantSearchInstance.client),
9770
- _getAppIdAndApiKey2 = _slicedToArray$4(_getAppIdAndApiKey, 2),
9822
+ _getAppIdAndApiKey2 = _slicedToArray$5(_getAppIdAndApiKey, 2),
9771
9823
  appId = _getAppIdAndApiKey2[0],
9772
9824
  apiKey = _getAppIdAndApiKey2[1];
9773
9825
  var queuedUserToken = undefined;
@@ -9784,11 +9836,11 @@
9784
9836
  // we still want to read the token from the queue.
9785
9837
  // Otherwise, the first search call will be fired without the token.
9786
9838
  var _ref3 = find$1(insightsClient.queue.slice().reverse(), function (_ref5) {
9787
- var _ref6 = _slicedToArray$4(_ref5, 1),
9839
+ var _ref6 = _slicedToArray$5(_ref5, 1),
9788
9840
  method = _ref6[0];
9789
9841
  return method === 'setUserToken';
9790
9842
  }) || [];
9791
- var _ref4 = _slicedToArray$4(_ref3, 2);
9843
+ var _ref4 = _slicedToArray$5(_ref3, 2);
9792
9844
  queuedUserToken = _ref4[1];
9793
9845
  }
9794
9846
  insightsClient('getUserToken', null, function (_error, userToken) {
@@ -9942,7 +9994,7 @@
9942
9994
  */
9943
9995
  function isModernInsightsClient(client) {
9944
9996
  var _split$map = (client.version || '').split('.').map(Number),
9945
- _split$map2 = _slicedToArray$4(_split$map, 2),
9997
+ _split$map2 = _slicedToArray$5(_split$map, 2),
9946
9998
  major = _split$map2[0],
9947
9999
  minor = _split$map2[1];
9948
10000
 
@@ -11570,7 +11622,7 @@
11570
11622
  };
11571
11623
  }
11572
11624
 
11573
- var version$2 = '4.60.0';
11625
+ var version$2 = '4.61.0';
11574
11626
 
11575
11627
  function _typeof$k(obj) {
11576
11628
  "@babel/helpers - typeof";
@@ -12539,6 +12591,34 @@
12539
12591
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
12540
12592
  }, _typeof$l(obj);
12541
12593
  }
12594
+ var _excluded$8 = ["hierarchicalMenu"];
12595
+ function _objectWithoutProperties$4(source, excluded) {
12596
+ if (source == null) return {};
12597
+ var target = _objectWithoutPropertiesLoose$5(source, excluded);
12598
+ var key, i;
12599
+ if (Object.getOwnPropertySymbols) {
12600
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
12601
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
12602
+ key = sourceSymbolKeys[i];
12603
+ if (excluded.indexOf(key) >= 0) continue;
12604
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
12605
+ target[key] = source[key];
12606
+ }
12607
+ }
12608
+ return target;
12609
+ }
12610
+ function _objectWithoutPropertiesLoose$5(source, excluded) {
12611
+ if (source == null) return {};
12612
+ var target = {};
12613
+ var sourceKeys = Object.keys(source);
12614
+ var key, i;
12615
+ for (i = 0; i < sourceKeys.length; i++) {
12616
+ key = sourceKeys[i];
12617
+ if (excluded.indexOf(key) >= 0) continue;
12618
+ target[key] = source[key];
12619
+ }
12620
+ return target;
12621
+ }
12542
12622
  function ownKeys$h(object, enumerableOnly) {
12543
12623
  var keys = Object.keys(object);
12544
12624
  if (Object.getOwnPropertySymbols) {
@@ -12588,26 +12668,26 @@
12588
12668
  }
12589
12669
  return (hint === "string" ? String : Number)(input);
12590
12670
  }
12591
- function _slicedToArray$5(arr, i) {
12592
- return _arrayWithHoles$5(arr) || _iterableToArrayLimit$5(arr, i) || _unsupportedIterableToArray$7(arr, i) || _nonIterableRest$5();
12671
+ function _slicedToArray$6(arr, i) {
12672
+ return _arrayWithHoles$6(arr) || _iterableToArrayLimit$6(arr, i) || _unsupportedIterableToArray$8(arr, i) || _nonIterableRest$6();
12593
12673
  }
12594
- function _nonIterableRest$5() {
12674
+ function _nonIterableRest$6() {
12595
12675
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
12596
12676
  }
12597
- function _unsupportedIterableToArray$7(o, minLen) {
12677
+ function _unsupportedIterableToArray$8(o, minLen) {
12598
12678
  if (!o) return;
12599
- if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
12679
+ if (typeof o === "string") return _arrayLikeToArray$8(o, minLen);
12600
12680
  var n = Object.prototype.toString.call(o).slice(8, -1);
12601
12681
  if (n === "Object" && o.constructor) n = o.constructor.name;
12602
12682
  if (n === "Map" || n === "Set") return Array.from(o);
12603
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
12683
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen);
12604
12684
  }
12605
- function _arrayLikeToArray$7(arr, len) {
12685
+ function _arrayLikeToArray$8(arr, len) {
12606
12686
  if (len == null || len > arr.length) len = arr.length;
12607
12687
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
12608
12688
  return arr2;
12609
12689
  }
12610
- function _iterableToArrayLimit$5(arr, i) {
12690
+ function _iterableToArrayLimit$6(arr, i) {
12611
12691
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
12612
12692
  if (null != _i) {
12613
12693
  var _s,
@@ -12634,7 +12714,7 @@
12634
12714
  return _arr;
12635
12715
  }
12636
12716
  }
12637
- function _arrayWithHoles$5(arr) {
12717
+ function _arrayWithHoles$6(arr) {
12638
12718
  if (Array.isArray(arr)) return arr;
12639
12719
  }
12640
12720
  var withUsage$4 = createDocumentationMessageGenerator({
@@ -12659,7 +12739,7 @@
12659
12739
  if (!attributes || !Array.isArray(attributes) || attributes.length === 0) {
12660
12740
  throw new Error(withUsage$4('The `attributes` option expects an array of strings.'));
12661
12741
  }
12662
- var _attributes = _slicedToArray$5(attributes, 1),
12742
+ var _attributes = _slicedToArray$6(attributes, 1),
12663
12743
  hierarchicalFacetName = _attributes[0];
12664
12744
  function getRefinedState(state, facetValue) {
12665
12745
  if (!facetValue) {
@@ -12705,7 +12785,7 @@
12705
12785
  if (!results || state.hierarchicalFacets.length === 0) {
12706
12786
  return [];
12707
12787
  }
12708
- var _state$hierarchicalFa = _slicedToArray$5(state.hierarchicalFacets, 1),
12788
+ var _state$hierarchicalFa = _slicedToArray$6(state.hierarchicalFacets, 1),
12709
12789
  facetName = _state$hierarchicalFa[0].name;
12710
12790
  var facetValues = results.getFacetValues(facetName, {});
12711
12791
  var facetItems = facetValues && !Array.isArray(facetValues) && facetValues.data ? facetValues.data : [];
@@ -12741,12 +12821,9 @@
12741
12821
  getWidgetUiState: function getWidgetUiState(uiState, _ref3) {
12742
12822
  var searchParameters = _ref3.searchParameters;
12743
12823
  var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
12744
- if (!path.length) {
12745
- return uiState;
12746
- }
12747
- return _objectSpread$g(_objectSpread$g({}, uiState), {}, {
12824
+ return removeEmptyRefinementsFromUiState(_objectSpread$g(_objectSpread$g({}, uiState), {}, {
12748
12825
  hierarchicalMenu: _objectSpread$g(_objectSpread$g({}, uiState.hierarchicalMenu), {}, _defineProperty$i({}, hierarchicalFacetName, path))
12749
- });
12826
+ }));
12750
12827
  },
12751
12828
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref4) {
12752
12829
  var uiState = _ref4.uiState;
@@ -12795,6 +12872,19 @@
12795
12872
  };
12796
12873
  });
12797
12874
  }
12875
+ function removeEmptyRefinementsFromUiState(indexUiState) {
12876
+ var hierarchicalMenu = indexUiState.hierarchicalMenu,
12877
+ indexUiStateBase = _objectWithoutProperties$4(indexUiState, _excluded$8);
12878
+ if (!hierarchicalMenu) {
12879
+ return indexUiState;
12880
+ }
12881
+ var connectorUiState = Object.keys(hierarchicalMenu).reduce(function (acc, key) {
12882
+ return _objectSpread$g(_objectSpread$g({}, acc), hierarchicalMenu[key].length > 0 ? _defineProperty$i({}, key, hierarchicalMenu[key]) : {});
12883
+ }, {});
12884
+ return _objectSpread$g(_objectSpread$g({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
12885
+ hierarchicalMenu: connectorUiState
12886
+ } : {});
12887
+ }
12798
12888
 
12799
12889
  function useBreadcrumb(props, additionalWidgetProperties) {
12800
12890
  return useConnector(connectBreadcrumb, props, additionalWidgetProperties);
@@ -12810,26 +12900,26 @@
12810
12900
  }, _typeof$m(obj);
12811
12901
  }
12812
12902
  function _toConsumableArray$3(arr) {
12813
- return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$8(arr) || _nonIterableSpread$3();
12903
+ return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$9(arr) || _nonIterableSpread$3();
12814
12904
  }
12815
12905
  function _nonIterableSpread$3() {
12816
12906
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
12817
12907
  }
12818
- function _unsupportedIterableToArray$8(o, minLen) {
12908
+ function _unsupportedIterableToArray$9(o, minLen) {
12819
12909
  if (!o) return;
12820
- if (typeof o === "string") return _arrayLikeToArray$8(o, minLen);
12910
+ if (typeof o === "string") return _arrayLikeToArray$9(o, minLen);
12821
12911
  var n = Object.prototype.toString.call(o).slice(8, -1);
12822
12912
  if (n === "Object" && o.constructor) n = o.constructor.name;
12823
12913
  if (n === "Map" || n === "Set") return Array.from(o);
12824
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen);
12914
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$9(o, minLen);
12825
12915
  }
12826
12916
  function _iterableToArray$3(iter) {
12827
12917
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
12828
12918
  }
12829
12919
  function _arrayWithoutHoles$3(arr) {
12830
- if (Array.isArray(arr)) return _arrayLikeToArray$8(arr);
12920
+ if (Array.isArray(arr)) return _arrayLikeToArray$9(arr);
12831
12921
  }
12832
- function _arrayLikeToArray$8(arr, len) {
12922
+ function _arrayLikeToArray$9(arr, len) {
12833
12923
  if (len == null || len > arr.length) len = arr.length;
12834
12924
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
12835
12925
  return arr2;
@@ -13030,26 +13120,26 @@
13030
13120
  }, _typeof$n(obj);
13031
13121
  }
13032
13122
  function _toConsumableArray$4(arr) {
13033
- return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$9(arr) || _nonIterableSpread$4();
13123
+ return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$a(arr) || _nonIterableSpread$4();
13034
13124
  }
13035
13125
  function _nonIterableSpread$4() {
13036
13126
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13037
13127
  }
13038
- function _unsupportedIterableToArray$9(o, minLen) {
13128
+ function _unsupportedIterableToArray$a(o, minLen) {
13039
13129
  if (!o) return;
13040
- if (typeof o === "string") return _arrayLikeToArray$9(o, minLen);
13130
+ if (typeof o === "string") return _arrayLikeToArray$a(o, minLen);
13041
13131
  var n = Object.prototype.toString.call(o).slice(8, -1);
13042
13132
  if (n === "Object" && o.constructor) n = o.constructor.name;
13043
13133
  if (n === "Map" || n === "Set") return Array.from(o);
13044
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$9(o, minLen);
13134
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$a(o, minLen);
13045
13135
  }
13046
13136
  function _iterableToArray$4(iter) {
13047
13137
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
13048
13138
  }
13049
13139
  function _arrayWithoutHoles$4(arr) {
13050
- if (Array.isArray(arr)) return _arrayLikeToArray$9(arr);
13140
+ if (Array.isArray(arr)) return _arrayLikeToArray$a(arr);
13051
13141
  }
13052
- function _arrayLikeToArray$9(arr, len) {
13142
+ function _arrayLikeToArray$a(arr, len) {
13053
13143
  if (len == null || len > arr.length) len = arr.length;
13054
13144
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
13055
13145
  return arr2;
@@ -13558,7 +13648,8 @@
13558
13648
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
13559
13649
  }, _typeof$p(obj);
13560
13650
  }
13561
- var _excluded$8 = ["name", "escapedValue", "data", "path"];
13651
+ var _excluded$9 = ["name", "escapedValue", "data", "path"],
13652
+ _excluded2$1 = ["hierarchicalMenu"];
13562
13653
  function ownKeys$l(object, enumerableOnly) {
13563
13654
  var keys = Object.keys(object);
13564
13655
  if (Object.getOwnPropertySymbols) {
@@ -13608,9 +13699,9 @@
13608
13699
  }
13609
13700
  return (hint === "string" ? String : Number)(input);
13610
13701
  }
13611
- function _objectWithoutProperties$4(source, excluded) {
13702
+ function _objectWithoutProperties$5(source, excluded) {
13612
13703
  if (source == null) return {};
13613
- var target = _objectWithoutPropertiesLoose$5(source, excluded);
13704
+ var target = _objectWithoutPropertiesLoose$6(source, excluded);
13614
13705
  var key, i;
13615
13706
  if (Object.getOwnPropertySymbols) {
13616
13707
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -13623,7 +13714,7 @@
13623
13714
  }
13624
13715
  return target;
13625
13716
  }
13626
- function _objectWithoutPropertiesLoose$5(source, excluded) {
13717
+ function _objectWithoutPropertiesLoose$6(source, excluded) {
13627
13718
  if (source == null) return {};
13628
13719
  var target = {};
13629
13720
  var sourceKeys = Object.keys(source);
@@ -13635,26 +13726,26 @@
13635
13726
  }
13636
13727
  return target;
13637
13728
  }
13638
- function _slicedToArray$6(arr, i) {
13639
- return _arrayWithHoles$6(arr) || _iterableToArrayLimit$6(arr, i) || _unsupportedIterableToArray$a(arr, i) || _nonIterableRest$6();
13729
+ function _slicedToArray$7(arr, i) {
13730
+ return _arrayWithHoles$7(arr) || _iterableToArrayLimit$7(arr, i) || _unsupportedIterableToArray$b(arr, i) || _nonIterableRest$7();
13640
13731
  }
13641
- function _nonIterableRest$6() {
13732
+ function _nonIterableRest$7() {
13642
13733
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13643
13734
  }
13644
- function _unsupportedIterableToArray$a(o, minLen) {
13735
+ function _unsupportedIterableToArray$b(o, minLen) {
13645
13736
  if (!o) return;
13646
- if (typeof o === "string") return _arrayLikeToArray$a(o, minLen);
13737
+ if (typeof o === "string") return _arrayLikeToArray$b(o, minLen);
13647
13738
  var n = Object.prototype.toString.call(o).slice(8, -1);
13648
13739
  if (n === "Object" && o.constructor) n = o.constructor.name;
13649
13740
  if (n === "Map" || n === "Set") return Array.from(o);
13650
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$a(o, minLen);
13741
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$b(o, minLen);
13651
13742
  }
13652
- function _arrayLikeToArray$a(arr, len) {
13743
+ function _arrayLikeToArray$b(arr, len) {
13653
13744
  if (len == null || len > arr.length) len = arr.length;
13654
13745
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
13655
13746
  return arr2;
13656
13747
  }
13657
- function _iterableToArrayLimit$6(arr, i) {
13748
+ function _iterableToArrayLimit$7(arr, i) {
13658
13749
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
13659
13750
  if (null != _i) {
13660
13751
  var _s,
@@ -13681,7 +13772,7 @@
13681
13772
  return _arr;
13682
13773
  }
13683
13774
  }
13684
- function _arrayWithHoles$6(arr) {
13775
+ function _arrayWithHoles$7(arr) {
13685
13776
  if (Array.isArray(arr)) return arr;
13686
13777
  }
13687
13778
  var withUsage$8 = createDocumentationMessageGenerator({
@@ -13735,7 +13826,7 @@
13735
13826
  // we need to provide a hierarchicalFacet name for the search state
13736
13827
  // so that we can always map $hierarchicalFacetName => real attributes
13737
13828
  // we use the first attribute name
13738
- var _attributes = _slicedToArray$6(attributes, 1),
13829
+ var _attributes = _slicedToArray$7(attributes, 1),
13739
13830
  hierarchicalFacetName = _attributes[0];
13740
13831
  var sendEvent;
13741
13832
 
@@ -13762,7 +13853,7 @@
13762
13853
  value = _ref2.escapedValue,
13763
13854
  data = _ref2.data,
13764
13855
  path = _ref2.path,
13765
- subValue = _objectWithoutProperties$4(_ref2, _excluded$8);
13856
+ subValue = _objectWithoutProperties$5(_ref2, _excluded$9);
13766
13857
  var item = _objectSpread$k(_objectSpread$k({}, subValue), {}, {
13767
13858
  value: value,
13768
13859
  label: label,
@@ -13869,12 +13960,9 @@
13869
13960
  getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
13870
13961
  var searchParameters = _ref5.searchParameters;
13871
13962
  var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
13872
- if (!path.length) {
13873
- return uiState;
13874
- }
13875
- return _objectSpread$k(_objectSpread$k({}, uiState), {}, {
13963
+ return removeEmptyRefinementsFromUiState$1(_objectSpread$k(_objectSpread$k({}, uiState), {}, {
13876
13964
  hierarchicalMenu: _objectSpread$k(_objectSpread$k({}, uiState.hierarchicalMenu), {}, _defineProperty$m({}, hierarchicalFacetName, path))
13877
- });
13965
+ }));
13878
13966
  },
13879
13967
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
13880
13968
  var uiState = _ref6.uiState;
@@ -13905,6 +13993,19 @@
13905
13993
  };
13906
13994
  };
13907
13995
  };
13996
+ function removeEmptyRefinementsFromUiState$1(indexUiState) {
13997
+ var hierarchicalMenu = indexUiState.hierarchicalMenu,
13998
+ indexUiStateBase = _objectWithoutProperties$5(indexUiState, _excluded2$1);
13999
+ if (!hierarchicalMenu) {
14000
+ return indexUiState;
14001
+ }
14002
+ var connectorUiState = Object.keys(hierarchicalMenu).reduce(function (acc, key) {
14003
+ return _objectSpread$k(_objectSpread$k({}, acc), hierarchicalMenu[key].length > 0 ? _defineProperty$m({}, key, hierarchicalMenu[key]) : {});
14004
+ }, {});
14005
+ return _objectSpread$k(_objectSpread$k({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
14006
+ hierarchicalMenu: connectorUiState
14007
+ } : {});
14008
+ }
13908
14009
 
13909
14010
  function useHierarchicalMenu(props, additionalWidgetProperties) {
13910
14011
  return useConnector(connectHierarchicalMenu, props, additionalWidgetProperties);
@@ -14081,26 +14182,26 @@
14081
14182
  }, _typeof$r(obj);
14082
14183
  }
14083
14184
  function _toConsumableArray$5(arr) {
14084
- return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$b(arr) || _nonIterableSpread$5();
14185
+ return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$c(arr) || _nonIterableSpread$5();
14085
14186
  }
14086
14187
  function _nonIterableSpread$5() {
14087
14188
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14088
14189
  }
14089
- function _unsupportedIterableToArray$b(o, minLen) {
14190
+ function _unsupportedIterableToArray$c(o, minLen) {
14090
14191
  if (!o) return;
14091
- if (typeof o === "string") return _arrayLikeToArray$b(o, minLen);
14192
+ if (typeof o === "string") return _arrayLikeToArray$c(o, minLen);
14092
14193
  var n = Object.prototype.toString.call(o).slice(8, -1);
14093
14194
  if (n === "Object" && o.constructor) n = o.constructor.name;
14094
14195
  if (n === "Map" || n === "Set") return Array.from(o);
14095
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$b(o, minLen);
14196
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$c(o, minLen);
14096
14197
  }
14097
14198
  function _iterableToArray$5(iter) {
14098
14199
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14099
14200
  }
14100
14201
  function _arrayWithoutHoles$5(arr) {
14101
- if (Array.isArray(arr)) return _arrayLikeToArray$b(arr);
14202
+ if (Array.isArray(arr)) return _arrayLikeToArray$c(arr);
14102
14203
  }
14103
- function _arrayLikeToArray$b(arr, len) {
14204
+ function _arrayLikeToArray$c(arr, len) {
14104
14205
  if (len == null || len > arr.length) len = arr.length;
14105
14206
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
14106
14207
  return arr2;
@@ -14302,8 +14403,8 @@
14302
14403
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14303
14404
  }, _typeof$s(obj);
14304
14405
  }
14305
- var _excluded$9 = ["page"],
14306
- _excluded2$1 = ["clickAnalytics", "userToken"];
14406
+ var _excluded$a = ["page"],
14407
+ _excluded2$2 = ["clickAnalytics", "userToken"];
14307
14408
  function ownKeys$o(object, enumerableOnly) {
14308
14409
  var keys = Object.keys(object);
14309
14410
  if (Object.getOwnPropertySymbols) {
@@ -14354,33 +14455,33 @@
14354
14455
  return (hint === "string" ? String : Number)(input);
14355
14456
  }
14356
14457
  function _toConsumableArray$6(arr) {
14357
- return _arrayWithoutHoles$6(arr) || _iterableToArray$6(arr) || _unsupportedIterableToArray$c(arr) || _nonIterableSpread$6();
14458
+ return _arrayWithoutHoles$6(arr) || _iterableToArray$6(arr) || _unsupportedIterableToArray$d(arr) || _nonIterableSpread$6();
14358
14459
  }
14359
14460
  function _nonIterableSpread$6() {
14360
14461
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14361
14462
  }
14362
- function _unsupportedIterableToArray$c(o, minLen) {
14463
+ function _unsupportedIterableToArray$d(o, minLen) {
14363
14464
  if (!o) return;
14364
- if (typeof o === "string") return _arrayLikeToArray$c(o, minLen);
14465
+ if (typeof o === "string") return _arrayLikeToArray$d(o, minLen);
14365
14466
  var n = Object.prototype.toString.call(o).slice(8, -1);
14366
14467
  if (n === "Object" && o.constructor) n = o.constructor.name;
14367
14468
  if (n === "Map" || n === "Set") return Array.from(o);
14368
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$c(o, minLen);
14469
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$d(o, minLen);
14369
14470
  }
14370
14471
  function _iterableToArray$6(iter) {
14371
14472
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14372
14473
  }
14373
14474
  function _arrayWithoutHoles$6(arr) {
14374
- if (Array.isArray(arr)) return _arrayLikeToArray$c(arr);
14475
+ if (Array.isArray(arr)) return _arrayLikeToArray$d(arr);
14375
14476
  }
14376
- function _arrayLikeToArray$c(arr, len) {
14477
+ function _arrayLikeToArray$d(arr, len) {
14377
14478
  if (len == null || len > arr.length) len = arr.length;
14378
14479
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
14379
14480
  return arr2;
14380
14481
  }
14381
- function _objectWithoutProperties$5(source, excluded) {
14482
+ function _objectWithoutProperties$6(source, excluded) {
14382
14483
  if (source == null) return {};
14383
- var target = _objectWithoutPropertiesLoose$6(source, excluded);
14484
+ var target = _objectWithoutPropertiesLoose$7(source, excluded);
14384
14485
  var key, i;
14385
14486
  if (Object.getOwnPropertySymbols) {
14386
14487
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -14393,7 +14494,7 @@
14393
14494
  }
14394
14495
  return target;
14395
14496
  }
14396
- function _objectWithoutPropertiesLoose$6(source, excluded) {
14497
+ function _objectWithoutPropertiesLoose$7(source, excluded) {
14397
14498
  if (source == null) return {};
14398
14499
  var target = {};
14399
14500
  var sourceKeys = Object.keys(source);
@@ -14412,14 +14513,14 @@
14412
14513
  function getStateWithoutPage(state) {
14413
14514
  var _ref = state || {},
14414
14515
  page = _ref.page,
14415
- rest = _objectWithoutProperties$5(_ref, _excluded$9);
14516
+ rest = _objectWithoutProperties$6(_ref, _excluded$a);
14416
14517
  return rest;
14417
14518
  }
14418
14519
  function normalizeState(state) {
14419
14520
  var _ref2 = state || {},
14420
14521
  clickAnalytics = _ref2.clickAnalytics,
14421
14522
  userToken = _ref2.userToken,
14422
- rest = _objectWithoutProperties$5(_ref2, _excluded2$1);
14523
+ rest = _objectWithoutProperties$6(_ref2, _excluded2$2);
14423
14524
  return rest;
14424
14525
  }
14425
14526
  function getInMemoryCache() {
@@ -14652,7 +14753,8 @@
14652
14753
  return useConnector(connectInfiniteHits, props, additionalWidgetProperties);
14653
14754
  }
14654
14755
 
14655
- var _excluded$a = ["name", "escapedValue", "path"];
14756
+ var _excluded$b = ["name", "escapedValue", "path"],
14757
+ _excluded2$3 = ["menu"];
14656
14758
  function _typeof$t(obj) {
14657
14759
  "@babel/helpers - typeof";
14658
14760
 
@@ -14662,9 +14764,9 @@
14662
14764
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14663
14765
  }, _typeof$t(obj);
14664
14766
  }
14665
- function _objectWithoutProperties$6(source, excluded) {
14767
+ function _objectWithoutProperties$7(source, excluded) {
14666
14768
  if (source == null) return {};
14667
- var target = _objectWithoutPropertiesLoose$7(source, excluded);
14769
+ var target = _objectWithoutPropertiesLoose$8(source, excluded);
14668
14770
  var key, i;
14669
14771
  if (Object.getOwnPropertySymbols) {
14670
14772
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -14677,7 +14779,7 @@
14677
14779
  }
14678
14780
  return target;
14679
14781
  }
14680
- function _objectWithoutPropertiesLoose$7(source, excluded) {
14782
+ function _objectWithoutPropertiesLoose$8(source, excluded) {
14681
14783
  if (source == null) return {};
14682
14784
  var target = {};
14683
14785
  var sourceKeys = Object.keys(source);
@@ -14689,26 +14791,26 @@
14689
14791
  }
14690
14792
  return target;
14691
14793
  }
14692
- function _slicedToArray$7(arr, i) {
14693
- return _arrayWithHoles$7(arr) || _iterableToArrayLimit$7(arr, i) || _unsupportedIterableToArray$d(arr, i) || _nonIterableRest$7();
14794
+ function _slicedToArray$8(arr, i) {
14795
+ return _arrayWithHoles$8(arr) || _iterableToArrayLimit$8(arr, i) || _unsupportedIterableToArray$e(arr, i) || _nonIterableRest$8();
14694
14796
  }
14695
- function _nonIterableRest$7() {
14797
+ function _nonIterableRest$8() {
14696
14798
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14697
14799
  }
14698
- function _unsupportedIterableToArray$d(o, minLen) {
14800
+ function _unsupportedIterableToArray$e(o, minLen) {
14699
14801
  if (!o) return;
14700
- if (typeof o === "string") return _arrayLikeToArray$d(o, minLen);
14802
+ if (typeof o === "string") return _arrayLikeToArray$e(o, minLen);
14701
14803
  var n = Object.prototype.toString.call(o).slice(8, -1);
14702
14804
  if (n === "Object" && o.constructor) n = o.constructor.name;
14703
14805
  if (n === "Map" || n === "Set") return Array.from(o);
14704
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$d(o, minLen);
14806
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$e(o, minLen);
14705
14807
  }
14706
- function _arrayLikeToArray$d(arr, len) {
14808
+ function _arrayLikeToArray$e(arr, len) {
14707
14809
  if (len == null || len > arr.length) len = arr.length;
14708
14810
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
14709
14811
  return arr2;
14710
14812
  }
14711
- function _iterableToArrayLimit$7(arr, i) {
14813
+ function _iterableToArrayLimit$8(arr, i) {
14712
14814
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
14713
14815
  if (null != _i) {
14714
14816
  var _s,
@@ -14735,7 +14837,7 @@
14735
14837
  return _arr;
14736
14838
  }
14737
14839
  }
14738
- function _arrayWithHoles$7(arr) {
14840
+ function _arrayWithHoles$8(arr) {
14739
14841
  if (Array.isArray(arr)) return arr;
14740
14842
  }
14741
14843
  function ownKeys$p(object, enumerableOnly) {
@@ -14898,7 +15000,7 @@
14898
15000
  if (!_refine) {
14899
15001
  _refine = function _refine(facetValue) {
14900
15002
  var _helper$getHierarchic = helper.getHierarchicalFacetBreadcrumb(attribute),
14901
- _helper$getHierarchic2 = _slicedToArray$7(_helper$getHierarchic, 1),
15003
+ _helper$getHierarchic2 = _slicedToArray$8(_helper$getHierarchic, 1),
14902
15004
  refinedItem = _helper$getHierarchic2[0];
14903
15005
  sendEvent('click:internal', facetValue ? facetValue : refinedItem);
14904
15006
  helper.toggleFacetRefinement(attribute, facetValue ? facetValue : refinedItem).search();
@@ -14918,7 +15020,7 @@
14918
15020
  var label = _ref3.name,
14919
15021
  value = _ref3.escapedValue,
14920
15022
  path = _ref3.path,
14921
- item = _objectWithoutProperties$6(_ref3, _excluded$a);
15023
+ item = _objectWithoutProperties$7(_ref3, _excluded$b);
14922
15024
  return _objectSpread$o(_objectSpread$o({}, item), {}, {
14923
15025
  label: label,
14924
15026
  value: value
@@ -14942,14 +15044,11 @@
14942
15044
  getWidgetUiState: function getWidgetUiState(uiState, _ref4) {
14943
15045
  var searchParameters = _ref4.searchParameters;
14944
15046
  var _searchParameters$get = searchParameters.getHierarchicalFacetBreadcrumb(attribute),
14945
- _searchParameters$get2 = _slicedToArray$7(_searchParameters$get, 1),
15047
+ _searchParameters$get2 = _slicedToArray$8(_searchParameters$get, 1),
14946
15048
  value = _searchParameters$get2[0];
14947
- if (!value) {
14948
- return uiState;
14949
- }
14950
- return _objectSpread$o(_objectSpread$o({}, uiState), {}, {
15049
+ return removeEmptyRefinementsFromUiState$2(_objectSpread$o(_objectSpread$o({}, uiState), {}, {
14951
15050
  menu: _objectSpread$o(_objectSpread$o({}, uiState.menu), {}, _defineProperty$q({}, attribute, value))
14952
- });
15051
+ }));
14953
15052
  },
14954
15053
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
14955
15054
  var uiState = _ref5.uiState;
@@ -14974,11 +15073,26 @@
14974
15073
  };
14975
15074
  };
14976
15075
  };
15076
+ function removeEmptyRefinementsFromUiState$2(indexUiState) {
15077
+ var menu = indexUiState.menu,
15078
+ indexUiStateBase = _objectWithoutProperties$7(indexUiState, _excluded2$3);
15079
+ if (!menu) {
15080
+ return indexUiState;
15081
+ }
15082
+ var connectorUiState = Object.keys(menu).reduce(function (acc, key) {
15083
+ var _menu$key;
15084
+ return _objectSpread$o(_objectSpread$o({}, acc), ((_menu$key = menu[key]) === null || _menu$key === void 0 ? void 0 : _menu$key.length) > 0 ? _defineProperty$q({}, key, menu[key]) : {});
15085
+ }, {});
15086
+ return _objectSpread$o(_objectSpread$o({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
15087
+ menu: connectorUiState
15088
+ } : {});
15089
+ }
14977
15090
 
14978
15091
  function useMenu(props, additionalWidgetProperties) {
14979
15092
  return useConnector(connectMenu, props, additionalWidgetProperties);
14980
15093
  }
14981
15094
 
15095
+ var _excluded$c = ["numericMenu"];
14982
15096
  function _typeof$u(obj) {
14983
15097
  "@babel/helpers - typeof";
14984
15098
 
@@ -14988,10 +15102,37 @@
14988
15102
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14989
15103
  }, _typeof$u(obj);
14990
15104
  }
15105
+ function _objectWithoutProperties$8(source, excluded) {
15106
+ if (source == null) return {};
15107
+ var target = _objectWithoutPropertiesLoose$9(source, excluded);
15108
+ var key, i;
15109
+ if (Object.getOwnPropertySymbols) {
15110
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
15111
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
15112
+ key = sourceSymbolKeys[i];
15113
+ if (excluded.indexOf(key) >= 0) continue;
15114
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
15115
+ target[key] = source[key];
15116
+ }
15117
+ }
15118
+ return target;
15119
+ }
15120
+ function _objectWithoutPropertiesLoose$9(source, excluded) {
15121
+ if (source == null) return {};
15122
+ var target = {};
15123
+ var sourceKeys = Object.keys(source);
15124
+ var key, i;
15125
+ for (i = 0; i < sourceKeys.length; i++) {
15126
+ key = sourceKeys[i];
15127
+ if (excluded.indexOf(key) >= 0) continue;
15128
+ target[key] = source[key];
15129
+ }
15130
+ return target;
15131
+ }
14991
15132
  function _createForOfIteratorHelper(o, allowArrayLike) {
14992
15133
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
14993
15134
  if (!it) {
14994
- if (Array.isArray(o) || (it = _unsupportedIterableToArray$e(o)) || allowArrayLike && o && typeof o.length === "number") {
15135
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray$f(o)) || allowArrayLike && o && typeof o.length === "number") {
14995
15136
  if (it) o = it;
14996
15137
  var i = 0;
14997
15138
  var F = function F() {};
@@ -15039,26 +15180,26 @@
15039
15180
  }
15040
15181
  };
15041
15182
  }
15042
- function _slicedToArray$8(arr, i) {
15043
- return _arrayWithHoles$8(arr) || _iterableToArrayLimit$8(arr, i) || _unsupportedIterableToArray$e(arr, i) || _nonIterableRest$8();
15183
+ function _slicedToArray$9(arr, i) {
15184
+ return _arrayWithHoles$9(arr) || _iterableToArrayLimit$9(arr, i) || _unsupportedIterableToArray$f(arr, i) || _nonIterableRest$9();
15044
15185
  }
15045
- function _nonIterableRest$8() {
15186
+ function _nonIterableRest$9() {
15046
15187
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
15047
15188
  }
15048
- function _unsupportedIterableToArray$e(o, minLen) {
15189
+ function _unsupportedIterableToArray$f(o, minLen) {
15049
15190
  if (!o) return;
15050
- if (typeof o === "string") return _arrayLikeToArray$e(o, minLen);
15191
+ if (typeof o === "string") return _arrayLikeToArray$f(o, minLen);
15051
15192
  var n = Object.prototype.toString.call(o).slice(8, -1);
15052
15193
  if (n === "Object" && o.constructor) n = o.constructor.name;
15053
15194
  if (n === "Map" || n === "Set") return Array.from(o);
15054
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$e(o, minLen);
15195
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$f(o, minLen);
15055
15196
  }
15056
- function _arrayLikeToArray$e(arr, len) {
15197
+ function _arrayLikeToArray$f(arr, len) {
15057
15198
  if (len == null || len > arr.length) len = arr.length;
15058
15199
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
15059
15200
  return arr2;
15060
15201
  }
15061
- function _iterableToArrayLimit$8(arr, i) {
15202
+ function _iterableToArrayLimit$9(arr, i) {
15062
15203
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
15063
15204
  if (null != _i) {
15064
15205
  var _s,
@@ -15085,7 +15226,7 @@
15085
15226
  return _arr;
15086
15227
  }
15087
15228
  }
15088
- function _arrayWithHoles$8(arr) {
15229
+ function _arrayWithHoles$9(arr) {
15089
15230
  if (Array.isArray(arr)) return arr;
15090
15231
  }
15091
15232
  function ownKeys$q(object, enumerableOnly) {
@@ -15220,12 +15361,9 @@
15220
15361
  }
15221
15362
  var min = values['>='] && values['>='][0] || '';
15222
15363
  var max = values['<='] && values['<='][0] || '';
15223
- if (min === '' && max === '') {
15224
- return uiState;
15225
- }
15226
- return _objectSpread$p(_objectSpread$p({}, uiState), {}, {
15364
+ return removeEmptyRefinementsFromUiState$3(_objectSpread$p(_objectSpread$p({}, uiState), {}, {
15227
15365
  numericMenu: _objectSpread$p(_objectSpread$p({}, uiState.numericMenu), {}, _defineProperty$r({}, attribute, "".concat(min, ":").concat(max)))
15228
- });
15366
+ }));
15229
15367
  },
15230
15368
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
15231
15369
  var uiState = _ref6.uiState;
@@ -15241,7 +15379,7 @@
15241
15379
  return withoutRefinements.addNumericRefinement(attribute, '=', Number(value));
15242
15380
  }
15243
15381
  var _value$split$map = value.split(':').map(parseFloat),
15244
- _value$split$map2 = _slicedToArray$8(_value$split$map, 2),
15382
+ _value$split$map2 = _slicedToArray$9(_value$split$map, 2),
15245
15383
  min = _value$split$map2[0],
15246
15384
  max = _value$split$map2[1];
15247
15385
  var withMinRefinement = isFiniteNumber(min) ? withoutRefinements.addNumericRefinement(attribute, '>=', min) : withoutRefinements;
@@ -15387,6 +15525,19 @@
15387
15525
  function hasNumericRefinement(currentRefinements, operator, value) {
15388
15526
  return currentRefinements[operator] !== undefined && currentRefinements[operator].includes(value);
15389
15527
  }
15528
+ function removeEmptyRefinementsFromUiState$3(indexUiState) {
15529
+ var numericMenu = indexUiState.numericMenu,
15530
+ indexUiStateBase = _objectWithoutProperties$8(indexUiState, _excluded$c);
15531
+ if (!numericMenu) {
15532
+ return indexUiState;
15533
+ }
15534
+ var connectorUiState = Object.keys(numericMenu).reduce(function (acc, key) {
15535
+ return _objectSpread$p(_objectSpread$p({}, acc), numericMenu[key] !== ':' ? _defineProperty$r({}, key, numericMenu[key]) : {});
15536
+ }, {});
15537
+ return _objectSpread$p(_objectSpread$p({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
15538
+ numericMenu: connectorUiState
15539
+ } : {});
15540
+ }
15390
15541
 
15391
15542
  function useNumericMenu(props, additionalWidgetProperties) {
15392
15543
  return useConnector(connectNumericMenu, props, additionalWidgetProperties);
@@ -15760,26 +15911,26 @@
15760
15911
  return (hint === "string" ? String : Number)(input);
15761
15912
  }
15762
15913
  function _toConsumableArray$7(arr) {
15763
- return _arrayWithoutHoles$7(arr) || _iterableToArray$7(arr) || _unsupportedIterableToArray$f(arr) || _nonIterableSpread$7();
15914
+ return _arrayWithoutHoles$7(arr) || _iterableToArray$7(arr) || _unsupportedIterableToArray$g(arr) || _nonIterableSpread$7();
15764
15915
  }
15765
15916
  function _nonIterableSpread$7() {
15766
15917
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
15767
15918
  }
15768
- function _unsupportedIterableToArray$f(o, minLen) {
15919
+ function _unsupportedIterableToArray$g(o, minLen) {
15769
15920
  if (!o) return;
15770
- if (typeof o === "string") return _arrayLikeToArray$f(o, minLen);
15921
+ if (typeof o === "string") return _arrayLikeToArray$g(o, minLen);
15771
15922
  var n = Object.prototype.toString.call(o).slice(8, -1);
15772
15923
  if (n === "Object" && o.constructor) n = o.constructor.name;
15773
15924
  if (n === "Map" || n === "Set") return Array.from(o);
15774
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$f(o, minLen);
15925
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$g(o, minLen);
15775
15926
  }
15776
15927
  function _iterableToArray$7(iter) {
15777
15928
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
15778
15929
  }
15779
15930
  function _arrayWithoutHoles$7(arr) {
15780
- if (Array.isArray(arr)) return _arrayLikeToArray$f(arr);
15931
+ if (Array.isArray(arr)) return _arrayLikeToArray$g(arr);
15781
15932
  }
15782
- function _arrayLikeToArray$f(arr, len) {
15933
+ function _arrayLikeToArray$g(arr, len) {
15783
15934
  if (len == null || len > arr.length) len = arr.length;
15784
15935
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
15785
15936
  return arr2;
@@ -15997,26 +16148,26 @@
15997
16148
  }
15998
16149
  return (hint === "string" ? String : Number)(input);
15999
16150
  }
16000
- function _slicedToArray$9(arr, i) {
16001
- return _arrayWithHoles$9(arr) || _iterableToArrayLimit$9(arr, i) || _unsupportedIterableToArray$g(arr, i) || _nonIterableRest$9();
16151
+ function _slicedToArray$a(arr, i) {
16152
+ return _arrayWithHoles$a(arr) || _iterableToArrayLimit$a(arr, i) || _unsupportedIterableToArray$h(arr, i) || _nonIterableRest$a();
16002
16153
  }
16003
- function _nonIterableRest$9() {
16154
+ function _nonIterableRest$a() {
16004
16155
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16005
16156
  }
16006
- function _unsupportedIterableToArray$g(o, minLen) {
16157
+ function _unsupportedIterableToArray$h(o, minLen) {
16007
16158
  if (!o) return;
16008
- if (typeof o === "string") return _arrayLikeToArray$g(o, minLen);
16159
+ if (typeof o === "string") return _arrayLikeToArray$h(o, minLen);
16009
16160
  var n = Object.prototype.toString.call(o).slice(8, -1);
16010
16161
  if (n === "Object" && o.constructor) n = o.constructor.name;
16011
16162
  if (n === "Map" || n === "Set") return Array.from(o);
16012
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$g(o, minLen);
16163
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$h(o, minLen);
16013
16164
  }
16014
- function _arrayLikeToArray$g(arr, len) {
16165
+ function _arrayLikeToArray$h(arr, len) {
16015
16166
  if (len == null || len > arr.length) len = arr.length;
16016
16167
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
16017
16168
  return arr2;
16018
16169
  }
16019
- function _iterableToArrayLimit$9(arr, i) {
16170
+ function _iterableToArrayLimit$a(arr, i) {
16020
16171
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
16021
16172
  if (null != _i) {
16022
16173
  var _s,
@@ -16043,7 +16194,7 @@
16043
16194
  return _arr;
16044
16195
  }
16045
16196
  }
16046
- function _arrayWithHoles$9(arr) {
16197
+ function _arrayWithHoles$a(arr) {
16047
16198
  if (Array.isArray(arr)) return arr;
16048
16199
  }
16049
16200
  var withUsage$g = createDocumentationMessageGenerator({
@@ -16110,10 +16261,10 @@
16110
16261
  var currentRangeMin = currentRange.min,
16111
16262
  currentRangeMax = currentRange.max;
16112
16263
  var _ref3 = resolvedState.getNumericRefinement(attribute, '>=') || [],
16113
- _ref4 = _slicedToArray$9(_ref3, 1),
16264
+ _ref4 = _slicedToArray$a(_ref3, 1),
16114
16265
  min = _ref4[0];
16115
16266
  var _ref5 = resolvedState.getNumericRefinement(attribute, '<=') || [],
16116
- _ref6 = _slicedToArray$9(_ref5, 1),
16267
+ _ref6 = _slicedToArray$a(_ref5, 1),
16117
16268
  max = _ref6[0];
16118
16269
  var isResetMin = nextMin === undefined || nextMin === '';
16119
16270
  var isResetMax = nextMax === undefined || nextMax === '';
@@ -16193,10 +16344,10 @@
16193
16344
  }
16194
16345
  function _getCurrentRefinement(helper) {
16195
16346
  var _ref7 = helper.getNumericRefinement(attribute, '>=') || [],
16196
- _ref8 = _slicedToArray$9(_ref7, 1),
16347
+ _ref8 = _slicedToArray$a(_ref7, 1),
16197
16348
  minValue = _ref8[0];
16198
16349
  var _ref9 = helper.getNumericRefinement(attribute, '<=') || [],
16199
- _ref10 = _slicedToArray$9(_ref9, 1),
16350
+ _ref10 = _slicedToArray$a(_ref9, 1),
16200
16351
  maxValue = _ref10[0];
16201
16352
  var min = isFiniteNumber(minValue) ? minValue : -Infinity;
16202
16353
  var max = isFiniteNumber(maxValue) ? maxValue : Infinity;
@@ -16205,7 +16356,7 @@
16205
16356
  function _refine(helper, currentRange) {
16206
16357
  return function () {
16207
16358
  var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [undefined, undefined],
16208
- _ref12 = _slicedToArray$9(_ref11, 2),
16359
+ _ref12 = _slicedToArray$a(_ref11, 2),
16209
16360
  nextMin = _ref12[0],
16210
16361
  nextMax = _ref12[1];
16211
16362
  var refinedState = getRefinedState(helper, currentRange, nextMin, nextMax);
@@ -16304,7 +16455,7 @@
16304
16455
  return widgetSearchParameters;
16305
16456
  }
16306
16457
  var _value$split$map = value.split(':').map(parseFloat),
16307
- _value$split$map2 = _slicedToArray$9(_value$split$map, 2),
16458
+ _value$split$map2 = _slicedToArray$a(_value$split$map, 2),
16308
16459
  lowerBound = _value$split$map2[0],
16309
16460
  upperBound = _value$split$map2[1];
16310
16461
  if (isFiniteNumber(lowerBound) && (!isFiniteNumber(minBound) || minBound < lowerBound)) {
@@ -16334,8 +16485,9 @@
16334
16485
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16335
16486
  }, _typeof$z(obj);
16336
16487
  }
16337
- var _excluded$b = ["name", "escapedValue"],
16338
- _excluded2$2 = ["escapedValue", "value"];
16488
+ var _excluded$d = ["name", "escapedValue"],
16489
+ _excluded2$4 = ["escapedValue", "value"],
16490
+ _excluded3 = ["refinementList"];
16339
16491
  function ownKeys$u(object, enumerableOnly) {
16340
16492
  var keys = Object.keys(object);
16341
16493
  if (Object.getOwnPropertySymbols) {
@@ -16385,9 +16537,9 @@
16385
16537
  }
16386
16538
  return (hint === "string" ? String : Number)(input);
16387
16539
  }
16388
- function _objectWithoutProperties$7(source, excluded) {
16540
+ function _objectWithoutProperties$9(source, excluded) {
16389
16541
  if (source == null) return {};
16390
- var target = _objectWithoutPropertiesLoose$8(source, excluded);
16542
+ var target = _objectWithoutPropertiesLoose$a(source, excluded);
16391
16543
  var key, i;
16392
16544
  if (Object.getOwnPropertySymbols) {
16393
16545
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -16400,7 +16552,7 @@
16400
16552
  }
16401
16553
  return target;
16402
16554
  }
16403
- function _objectWithoutPropertiesLoose$8(source, excluded) {
16555
+ function _objectWithoutPropertiesLoose$a(source, excluded) {
16404
16556
  if (source == null) return {};
16405
16557
  var target = {};
16406
16558
  var sourceKeys = Object.keys(source);
@@ -16463,7 +16615,7 @@
16463
16615
  var formatItems = function formatItems(_ref2) {
16464
16616
  var label = _ref2.name,
16465
16617
  value = _ref2.escapedValue,
16466
- item = _objectWithoutProperties$7(_ref2, _excluded$b);
16618
+ item = _objectWithoutProperties$9(_ref2, _excluded$d);
16467
16619
  return _objectSpread$t(_objectSpread$t({}, item), {}, {
16468
16620
  value: value,
16469
16621
  label: label,
@@ -16520,7 +16672,7 @@
16520
16672
  var normalizedFacetValues = transformItems(facetValues.map(function (_ref3) {
16521
16673
  var escapedValue = _ref3.escapedValue,
16522
16674
  value = _ref3.value,
16523
- item = _objectWithoutProperties$7(_ref3, _excluded2$2);
16675
+ item = _objectWithoutProperties$9(_ref3, _excluded2$4);
16524
16676
  return _objectSpread$t(_objectSpread$t({}, item), {}, {
16525
16677
  value: escapedValue,
16526
16678
  label: value
@@ -16646,12 +16798,9 @@
16646
16798
  getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
16647
16799
  var searchParameters = _ref5.searchParameters;
16648
16800
  var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
16649
- if (!values.length) {
16650
- return uiState;
16651
- }
16652
- return _objectSpread$t(_objectSpread$t({}, uiState), {}, {
16801
+ return removeEmptyRefinementsFromUiState$4(_objectSpread$t(_objectSpread$t({}, uiState), {}, {
16653
16802
  refinementList: _objectSpread$t(_objectSpread$t({}, uiState.refinementList), {}, _defineProperty$w({}, attribute, values))
16654
- });
16803
+ }));
16655
16804
  },
16656
16805
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
16657
16806
  var uiState = _ref6.uiState;
@@ -16679,6 +16828,19 @@
16679
16828
  };
16680
16829
  };
16681
16830
  };
16831
+ function removeEmptyRefinementsFromUiState$4(indexUiState) {
16832
+ var refinementList = indexUiState.refinementList,
16833
+ indexUiStateBase = _objectWithoutProperties$9(indexUiState, _excluded3);
16834
+ if (!refinementList) {
16835
+ return indexUiState;
16836
+ }
16837
+ var connectorUiState = Object.keys(refinementList).reduce(function (acc, key) {
16838
+ return _objectSpread$t(_objectSpread$t({}, acc), refinementList[key].length > 0 ? _defineProperty$w({}, key, refinementList[key]) : {});
16839
+ }, {});
16840
+ return _objectSpread$t(_objectSpread$t({}, indexUiStateBase), Object.keys(connectorUiState).length > 0 ? {
16841
+ refinementList: connectorUiState
16842
+ } : {});
16843
+ }
16682
16844
 
16683
16845
  function useRefinementList(props, additionalWidgetProperties) {
16684
16846
  return useConnector(connectRefinementList, props, additionalWidgetProperties);
@@ -17187,26 +17349,26 @@
17187
17349
  }
17188
17350
  return (hint === "string" ? String : Number)(input);
17189
17351
  }
17190
- function _slicedToArray$a(arr, i) {
17191
- return _arrayWithHoles$a(arr) || _iterableToArrayLimit$a(arr, i) || _unsupportedIterableToArray$h(arr, i) || _nonIterableRest$a();
17352
+ function _slicedToArray$b(arr, i) {
17353
+ return _arrayWithHoles$b(arr) || _iterableToArrayLimit$b(arr, i) || _unsupportedIterableToArray$i(arr, i) || _nonIterableRest$b();
17192
17354
  }
17193
- function _nonIterableRest$a() {
17355
+ function _nonIterableRest$b() {
17194
17356
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
17195
17357
  }
17196
- function _unsupportedIterableToArray$h(o, minLen) {
17358
+ function _unsupportedIterableToArray$i(o, minLen) {
17197
17359
  if (!o) return;
17198
- if (typeof o === "string") return _arrayLikeToArray$h(o, minLen);
17360
+ if (typeof o === "string") return _arrayLikeToArray$i(o, minLen);
17199
17361
  var n = Object.prototype.toString.call(o).slice(8, -1);
17200
17362
  if (n === "Object" && o.constructor) n = o.constructor.name;
17201
17363
  if (n === "Map" || n === "Set") return Array.from(o);
17202
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$h(o, minLen);
17364
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$i(o, minLen);
17203
17365
  }
17204
- function _arrayLikeToArray$h(arr, len) {
17366
+ function _arrayLikeToArray$i(arr, len) {
17205
17367
  if (len == null || len > arr.length) len = arr.length;
17206
17368
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
17207
17369
  return arr2;
17208
17370
  }
17209
- function _iterableToArrayLimit$a(arr, i) {
17371
+ function _iterableToArrayLimit$b(arr, i) {
17210
17372
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
17211
17373
  if (null != _i) {
17212
17374
  var _s,
@@ -17233,7 +17395,7 @@
17233
17395
  return _arr;
17234
17396
  }
17235
17397
  }
17236
- function _arrayWithHoles$a(arr) {
17398
+ function _arrayWithHoles$b(arr) {
17237
17399
  if (Array.isArray(arr)) return arr;
17238
17400
  }
17239
17401
  var withUsage$l = createDocumentationMessageGenerator({
@@ -17258,7 +17420,7 @@
17258
17420
  _args$ = args[2],
17259
17421
  eventName = _args$ === void 0 ? 'Filter Applied' : _args$;
17260
17422
  var _args$0$split = args[0].split(':'),
17261
- _args$0$split2 = _slicedToArray$a(_args$0$split, 2),
17423
+ _args$0$split2 = _slicedToArray$b(_args$0$split, 2),
17262
17424
  eventType = _args$0$split2[0],
17263
17425
  eventModifier = _args$0$split2[1];
17264
17426
  if (eventType !== 'click' || on === undefined) {
@@ -17541,7 +17703,7 @@
17541
17703
  var _useState = React.useState(function () {
17542
17704
  return getIndexSearchResults(searchIndex);
17543
17705
  }),
17544
- _useState2 = _slicedToArray$3(_useState, 2),
17706
+ _useState2 = _slicedToArray$4(_useState, 2),
17545
17707
  searchResults = _useState2[0],
17546
17708
  setSearchResults = _useState2[1];
17547
17709
  React.useEffect(function () {
@@ -17573,14 +17735,14 @@
17573
17735
  var _useState = React.useState(function () {
17574
17736
  return search.getUiState();
17575
17737
  }),
17576
- _useState2 = _slicedToArray$3(_useState, 2),
17738
+ _useState2 = _slicedToArray$4(_useState, 2),
17577
17739
  uiState = _useState2[0],
17578
17740
  setLocalUiState = _useState2[1];
17579
17741
  var indexUiState = uiState[indexId];
17580
17742
  var _useState3 = React.useState(function () {
17581
17743
  return search.renderState;
17582
17744
  }),
17583
- _useState4 = _slicedToArray$3(_useState3, 2),
17745
+ _useState4 = _slicedToArray$4(_useState3, 2),
17584
17746
  renderState = _useState4[0],
17585
17747
  setRenderState = _useState4[1];
17586
17748
  var indexRenderState = renderState[indexId] || {};