react-instantsearch 7.3.0 → 7.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ui/SearchBox.js +6 -2
- package/dist/cjs/ui/SortBy.js +2 -1
- package/dist/cjs/widgets/Stats.js +29 -1
- package/dist/es/ui/SearchBox.js +6 -2
- package/dist/es/ui/SortBy.js +2 -1
- package/dist/es/widgets/Stats.js +29 -1
- package/dist/umd/ReactInstantSearch.js +417 -264
- package/dist/umd/ReactInstantSearch.js.map +1 -1
- package/dist/umd/ReactInstantSearch.min.js +1 -1
- package/dist/umd/ReactInstantSearch.min.js.map +1 -1
- package/package.json +4 -4
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
var React__default = 'default' in React ? React['default'] : React;
|
|
9
9
|
|
|
10
|
-
var version = '7.
|
|
10
|
+
var version = '7.4.1';
|
|
11
11
|
|
|
12
12
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
13
13
|
//
|
|
@@ -3280,7 +3280,6 @@
|
|
|
3280
3280
|
);
|
|
3281
3281
|
}
|
|
3282
3282
|
|
|
3283
|
-
// eslint-disable-next-line valid-jsdoc
|
|
3284
3283
|
/**
|
|
3285
3284
|
* Constructor for SearchResults
|
|
3286
3285
|
* @class
|
|
@@ -3288,6 +3287,7 @@
|
|
|
3288
3287
|
* {@link AlgoliaSearchHelper}.
|
|
3289
3288
|
* @param {SearchParameters} state state that led to the response
|
|
3290
3289
|
* @param {array.<object>} results the results from algolia client
|
|
3290
|
+
* @param {object} options options to control results content
|
|
3291
3291
|
* @example <caption>SearchResults of the first query in
|
|
3292
3292
|
* <a href="http://demos.algolia.com/instant-search-demo">the instant search demo</a></caption>
|
|
3293
3293
|
{
|
|
@@ -3425,8 +3425,14 @@
|
|
|
3425
3425
|
});
|
|
3426
3426
|
|
|
3427
3427
|
// Make every key of the result options reachable from the instance
|
|
3428
|
-
|
|
3429
|
-
|
|
3428
|
+
var opts = merge_1(
|
|
3429
|
+
{
|
|
3430
|
+
persistHierarchicalRootCount: false,
|
|
3431
|
+
},
|
|
3432
|
+
options
|
|
3433
|
+
);
|
|
3434
|
+
Object.keys(opts).forEach(function (key) {
|
|
3435
|
+
self[key] = opts[key];
|
|
3430
3436
|
});
|
|
3431
3437
|
|
|
3432
3438
|
/**
|
|
@@ -3776,9 +3782,13 @@
|
|
|
3776
3782
|
// We want
|
|
3777
3783
|
// | beers (5)
|
|
3778
3784
|
// > IPA (5)
|
|
3785
|
+
// @MAJOR: remove this legacy behaviour in next major version
|
|
3779
3786
|
var defaultData = {};
|
|
3780
3787
|
|
|
3781
|
-
if (
|
|
3788
|
+
if (
|
|
3789
|
+
currentRefinement.length > 0 &&
|
|
3790
|
+
!self.persistHierarchicalRootCount
|
|
3791
|
+
) {
|
|
3782
3792
|
var root = currentRefinement[0].split(separator)[0];
|
|
3783
3793
|
defaultData[root] =
|
|
3784
3794
|
self.hierarchicalFacets[position][attributeIndex].data[root];
|
|
@@ -4327,7 +4337,7 @@
|
|
|
4327
4337
|
|
|
4328
4338
|
var SearchResults_1 = SearchResults;
|
|
4329
4339
|
|
|
4330
|
-
var version$1 = '3.
|
|
4340
|
+
var version$1 = '3.16.0';
|
|
4331
4341
|
|
|
4332
4342
|
var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
|
|
4333
4343
|
|
|
@@ -4441,8 +4451,9 @@
|
|
|
4441
4451
|
* @param {SearchParameters | object} options an object defining the initial
|
|
4442
4452
|
* config of the search. It doesn't have to be a {SearchParameters},
|
|
4443
4453
|
* just an object containing the properties you need from it.
|
|
4454
|
+
* @param {SearchResultsOptions|object} searchResultsOptions an object defining the options to use when creating the search results.
|
|
4444
4455
|
*/
|
|
4445
|
-
function AlgoliaSearchHelper(client, index, options) {
|
|
4456
|
+
function AlgoliaSearchHelper(client, index, options, searchResultsOptions) {
|
|
4446
4457
|
if (typeof client.addAlgoliaAgent === 'function') {
|
|
4447
4458
|
client.addAlgoliaAgent('JS Helper (' + version$1 + ')');
|
|
4448
4459
|
}
|
|
@@ -4456,6 +4467,7 @@
|
|
|
4456
4467
|
this._lastQueryIdReceived = -1;
|
|
4457
4468
|
this.derivedHelpers = [];
|
|
4458
4469
|
this._currentNbQueries = 0;
|
|
4470
|
+
this._searchResultsOptions = searchResultsOptions;
|
|
4459
4471
|
}
|
|
4460
4472
|
|
|
4461
4473
|
inherits_1(AlgoliaSearchHelper, events);
|
|
@@ -5728,6 +5740,9 @@
|
|
|
5728
5740
|
queryId,
|
|
5729
5741
|
content
|
|
5730
5742
|
) {
|
|
5743
|
+
// eslint-disable-next-line consistent-this
|
|
5744
|
+
var self = this;
|
|
5745
|
+
|
|
5731
5746
|
// @TODO remove the number of outdated queries discarded instead of just one
|
|
5732
5747
|
|
|
5733
5748
|
if (queryId < this._lastQueryIdReceived) {
|
|
@@ -5756,7 +5771,11 @@
|
|
|
5756
5771
|
return;
|
|
5757
5772
|
}
|
|
5758
5773
|
|
|
5759
|
-
helper.lastResults = new SearchResults_1(
|
|
5774
|
+
helper.lastResults = new SearchResults_1(
|
|
5775
|
+
state,
|
|
5776
|
+
specificResults,
|
|
5777
|
+
self._searchResultsOptions
|
|
5778
|
+
);
|
|
5760
5779
|
|
|
5761
5780
|
helper.emit('result', {
|
|
5762
5781
|
results: helper.lastResults,
|
|
@@ -5954,10 +5973,11 @@
|
|
|
5954
5973
|
* @param {AlgoliaSearch} client an AlgoliaSearch client
|
|
5955
5974
|
* @param {string} index the name of the index to query
|
|
5956
5975
|
* @param {SearchParameters|object} opts an object defining the initial config of the search. It doesn't have to be a {SearchParameters}, just an object containing the properties you need from it.
|
|
5976
|
+
* @param {SearchResultsOptions|object} searchResultsOptions an object defining the options to use when creating the search results.
|
|
5957
5977
|
* @return {AlgoliaSearchHelper} The helper instance
|
|
5958
5978
|
*/
|
|
5959
|
-
function algoliasearchHelper(client, index, opts) {
|
|
5960
|
-
return new algoliasearch_helper(client, index, opts);
|
|
5979
|
+
function algoliasearchHelper(client, index, opts, searchResultsOptions) {
|
|
5980
|
+
return new algoliasearch_helper(client, index, opts, searchResultsOptions);
|
|
5961
5981
|
}
|
|
5962
5982
|
|
|
5963
5983
|
/**
|
|
@@ -7506,6 +7526,55 @@
|
|
|
7506
7526
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
7507
7527
|
}, _typeof$6(obj);
|
|
7508
7528
|
}
|
|
7529
|
+
function _slicedToArray$3(arr, i) {
|
|
7530
|
+
return _arrayWithHoles$3(arr) || _iterableToArrayLimit$3(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$3();
|
|
7531
|
+
}
|
|
7532
|
+
function _nonIterableRest$3() {
|
|
7533
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7534
|
+
}
|
|
7535
|
+
function _unsupportedIterableToArray$3(o, minLen) {
|
|
7536
|
+
if (!o) return;
|
|
7537
|
+
if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
|
|
7538
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7539
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7540
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
7541
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
|
|
7542
|
+
}
|
|
7543
|
+
function _arrayLikeToArray$3(arr, len) {
|
|
7544
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7545
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
7546
|
+
return arr2;
|
|
7547
|
+
}
|
|
7548
|
+
function _iterableToArrayLimit$3(arr, i) {
|
|
7549
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
7550
|
+
if (null != _i) {
|
|
7551
|
+
var _s,
|
|
7552
|
+
_e,
|
|
7553
|
+
_x,
|
|
7554
|
+
_r,
|
|
7555
|
+
_arr = [],
|
|
7556
|
+
_n = !0,
|
|
7557
|
+
_d = !1;
|
|
7558
|
+
try {
|
|
7559
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
7560
|
+
if (Object(_i) !== _i) return;
|
|
7561
|
+
_n = !1;
|
|
7562
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
7563
|
+
} catch (err) {
|
|
7564
|
+
_d = !0, _e = err;
|
|
7565
|
+
} finally {
|
|
7566
|
+
try {
|
|
7567
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
7568
|
+
} finally {
|
|
7569
|
+
if (_d) throw _e;
|
|
7570
|
+
}
|
|
7571
|
+
}
|
|
7572
|
+
return _arr;
|
|
7573
|
+
}
|
|
7574
|
+
}
|
|
7575
|
+
function _arrayWithHoles$3(arr) {
|
|
7576
|
+
if (Array.isArray(arr)) return arr;
|
|
7577
|
+
}
|
|
7509
7578
|
function ownKeys$5(object, enumerableOnly) {
|
|
7510
7579
|
var keys = Object.keys(object);
|
|
7511
7580
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -7555,8 +7624,6 @@
|
|
|
7555
7624
|
}
|
|
7556
7625
|
return (hint === "string" ? String : Number)(input);
|
|
7557
7626
|
}
|
|
7558
|
-
// @ts-nocheck (types to be fixed during actual implementation)
|
|
7559
|
-
|
|
7560
7627
|
function hydrateSearchClient(client, results) {
|
|
7561
7628
|
if (!results) {
|
|
7562
7629
|
return;
|
|
@@ -7566,9 +7633,22 @@
|
|
|
7566
7633
|
// - Algoliasearch API Client < v4 with cache disabled
|
|
7567
7634
|
// - Third party clients (detected by the `addAlgoliaAgent` function missing)
|
|
7568
7635
|
|
|
7569
|
-
if ((!
|
|
7636
|
+
if ((!('transporter' in client) || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== 'function')) {
|
|
7570
7637
|
return;
|
|
7571
7638
|
}
|
|
7639
|
+
var cachedRequest = Object.keys(results).map(function (key) {
|
|
7640
|
+
return results[key].results.map(function (result) {
|
|
7641
|
+
return {
|
|
7642
|
+
indexName: result.index,
|
|
7643
|
+
// We normalize the params received from the server as they can
|
|
7644
|
+
// be serialized differently depending on the engine.
|
|
7645
|
+
params: serializeQueryParameters(deserializeQueryParameters(result.params))
|
|
7646
|
+
};
|
|
7647
|
+
});
|
|
7648
|
+
});
|
|
7649
|
+
var cachedResults = Object.keys(results).reduce(function (acc, key) {
|
|
7650
|
+
return acc.concat(results[key].results);
|
|
7651
|
+
}, []);
|
|
7572
7652
|
|
|
7573
7653
|
// Algoliasearch API Client >= v4
|
|
7574
7654
|
// To hydrate the client we need to populate the cache with the data from
|
|
@@ -7577,9 +7657,10 @@
|
|
|
7577
7657
|
// for us to compute the key the same way as `algoliasearch-client` we need
|
|
7578
7658
|
// to populate it on a custom key and override the `search` method to
|
|
7579
7659
|
// search on it first.
|
|
7580
|
-
if (
|
|
7660
|
+
if ('transporter' in client && !client._cacheHydrated) {
|
|
7581
7661
|
client._cacheHydrated = true;
|
|
7582
7662
|
var baseMethod = client.search;
|
|
7663
|
+
// @ts-ignore wanting type checks for v3 on this would make this too complex
|
|
7583
7664
|
client.search = function (requests) {
|
|
7584
7665
|
for (var _len = arguments.length, methodArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
7585
7666
|
methodArgs[_key - 1] = arguments[_key];
|
|
@@ -7596,22 +7677,11 @@
|
|
|
7596
7677
|
return baseMethod.apply(void 0, [requests].concat(methodArgs));
|
|
7597
7678
|
});
|
|
7598
7679
|
};
|
|
7599
|
-
|
|
7600
|
-
// Populate the cache with the data from the server
|
|
7601
7680
|
client.transporter.responsesCache.set({
|
|
7602
7681
|
method: 'search',
|
|
7603
|
-
args:
|
|
7604
|
-
return acc.concat(results[key].results.map(function (request) {
|
|
7605
|
-
return {
|
|
7606
|
-
indexName: request.index,
|
|
7607
|
-
params: request.params
|
|
7608
|
-
};
|
|
7609
|
-
}));
|
|
7610
|
-
}, [])]
|
|
7682
|
+
args: cachedRequest
|
|
7611
7683
|
}, {
|
|
7612
|
-
results:
|
|
7613
|
-
return acc.concat(results[key].results);
|
|
7614
|
-
}, [])
|
|
7684
|
+
results: cachedResults
|
|
7615
7685
|
});
|
|
7616
7686
|
}
|
|
7617
7687
|
|
|
@@ -7621,24 +7691,27 @@
|
|
|
7621
7691
|
// a single-index result. You can find more information about the
|
|
7622
7692
|
// computation of the key inside the client (see link below).
|
|
7623
7693
|
// https://github.com/algolia/algoliasearch-client-javascript/blob/c27e89ff92b2a854ae6f40dc524bffe0f0cbc169/src/AlgoliaSearchCore.js#L232-L240
|
|
7624
|
-
if (!client
|
|
7694
|
+
if (!('transporter' in client)) {
|
|
7625
7695
|
var cacheKey = "/1/indexes/*/queries_body_".concat(JSON.stringify({
|
|
7626
|
-
requests:
|
|
7627
|
-
return acc.concat(results[key].rawResults.map(function (request) {
|
|
7628
|
-
return {
|
|
7629
|
-
indexName: request.index,
|
|
7630
|
-
params: request.params
|
|
7631
|
-
};
|
|
7632
|
-
}));
|
|
7633
|
-
}, [])
|
|
7696
|
+
requests: cachedRequest
|
|
7634
7697
|
}));
|
|
7635
7698
|
client.cache = _objectSpread$5(_objectSpread$5({}, client.cache), {}, _defineProperty$5({}, cacheKey, JSON.stringify({
|
|
7636
|
-
results: Object.keys(results).
|
|
7637
|
-
return
|
|
7638
|
-
}
|
|
7699
|
+
results: Object.keys(results).map(function (key) {
|
|
7700
|
+
return results[key].results;
|
|
7701
|
+
})
|
|
7639
7702
|
})));
|
|
7640
7703
|
}
|
|
7641
7704
|
}
|
|
7705
|
+
function deserializeQueryParameters(parameters) {
|
|
7706
|
+
return parameters.split('&').reduce(function (acc, parameter) {
|
|
7707
|
+
var _parameter$split = parameter.split('='),
|
|
7708
|
+
_parameter$split2 = _slicedToArray$3(_parameter$split, 2),
|
|
7709
|
+
key = _parameter$split2[0],
|
|
7710
|
+
value = _parameter$split2[1];
|
|
7711
|
+
acc[key] = value ? decodeURIComponent(value) : '';
|
|
7712
|
+
return acc;
|
|
7713
|
+
}, {});
|
|
7714
|
+
}
|
|
7642
7715
|
|
|
7643
7716
|
// This function is copied from the algoliasearch v4 API Client. If modified,
|
|
7644
7717
|
// consider updating it also in `serializeQueryParameters` from `@algolia/transporter`.
|
|
@@ -7902,26 +7975,26 @@
|
|
|
7902
7975
|
};
|
|
7903
7976
|
|
|
7904
7977
|
function _toConsumableArray(arr) {
|
|
7905
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$
|
|
7978
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$4(arr) || _nonIterableSpread();
|
|
7906
7979
|
}
|
|
7907
7980
|
function _nonIterableSpread() {
|
|
7908
7981
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7909
7982
|
}
|
|
7910
|
-
function _unsupportedIterableToArray$
|
|
7983
|
+
function _unsupportedIterableToArray$4(o, minLen) {
|
|
7911
7984
|
if (!o) return;
|
|
7912
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
7985
|
+
if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
|
|
7913
7986
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7914
7987
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7915
7988
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
7916
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
7989
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
|
|
7917
7990
|
}
|
|
7918
7991
|
function _iterableToArray(iter) {
|
|
7919
7992
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7920
7993
|
}
|
|
7921
7994
|
function _arrayWithoutHoles(arr) {
|
|
7922
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
7995
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$4(arr);
|
|
7923
7996
|
}
|
|
7924
|
-
function _arrayLikeToArray$
|
|
7997
|
+
function _arrayLikeToArray$4(arr, len) {
|
|
7925
7998
|
if (len == null || len > arr.length) len = arr.length;
|
|
7926
7999
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
7927
8000
|
return arr2;
|
|
@@ -8440,26 +8513,26 @@
|
|
|
8440
8513
|
return React.useContext(InstantSearchServerContext);
|
|
8441
8514
|
}
|
|
8442
8515
|
|
|
8443
|
-
function _slicedToArray$
|
|
8444
|
-
return _arrayWithHoles$
|
|
8516
|
+
function _slicedToArray$4(arr, i) {
|
|
8517
|
+
return _arrayWithHoles$4(arr) || _iterableToArrayLimit$4(arr, i) || _unsupportedIterableToArray$5(arr, i) || _nonIterableRest$4();
|
|
8445
8518
|
}
|
|
8446
|
-
function _nonIterableRest$
|
|
8519
|
+
function _nonIterableRest$4() {
|
|
8447
8520
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8448
8521
|
}
|
|
8449
|
-
function _unsupportedIterableToArray$
|
|
8522
|
+
function _unsupportedIterableToArray$5(o, minLen) {
|
|
8450
8523
|
if (!o) return;
|
|
8451
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
8524
|
+
if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
|
|
8452
8525
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8453
8526
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8454
8527
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
8455
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
8528
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
|
|
8456
8529
|
}
|
|
8457
|
-
function _arrayLikeToArray$
|
|
8530
|
+
function _arrayLikeToArray$5(arr, len) {
|
|
8458
8531
|
if (len == null || len > arr.length) len = arr.length;
|
|
8459
8532
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
8460
8533
|
return arr2;
|
|
8461
8534
|
}
|
|
8462
|
-
function _iterableToArrayLimit$
|
|
8535
|
+
function _iterableToArrayLimit$4(arr, i) {
|
|
8463
8536
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
8464
8537
|
if (null != _i) {
|
|
8465
8538
|
var _s,
|
|
@@ -8486,14 +8559,14 @@
|
|
|
8486
8559
|
return _arr;
|
|
8487
8560
|
}
|
|
8488
8561
|
}
|
|
8489
|
-
function _arrayWithHoles$
|
|
8562
|
+
function _arrayWithHoles$4(arr) {
|
|
8490
8563
|
if (Array.isArray(arr)) return arr;
|
|
8491
8564
|
}
|
|
8492
8565
|
function useStableValue(value) {
|
|
8493
8566
|
var _useState = React.useState(function () {
|
|
8494
8567
|
return value;
|
|
8495
8568
|
}),
|
|
8496
|
-
_useState2 = _slicedToArray$
|
|
8569
|
+
_useState2 = _slicedToArray$4(_useState, 2),
|
|
8497
8570
|
stableValue = _useState2[0],
|
|
8498
8571
|
setStableValue = _useState2[1];
|
|
8499
8572
|
if (!dequal(stableValue, value)) {
|
|
@@ -8613,26 +8686,26 @@
|
|
|
8613
8686
|
}
|
|
8614
8687
|
var _excluded$1 = ["instantSearchInstance", "widgetParams"],
|
|
8615
8688
|
_excluded2 = ["widgetParams"];
|
|
8616
|
-
function _slicedToArray$
|
|
8617
|
-
return _arrayWithHoles$
|
|
8689
|
+
function _slicedToArray$5(arr, i) {
|
|
8690
|
+
return _arrayWithHoles$5(arr) || _iterableToArrayLimit$5(arr, i) || _unsupportedIterableToArray$6(arr, i) || _nonIterableRest$5();
|
|
8618
8691
|
}
|
|
8619
|
-
function _nonIterableRest$
|
|
8692
|
+
function _nonIterableRest$5() {
|
|
8620
8693
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8621
8694
|
}
|
|
8622
|
-
function _unsupportedIterableToArray$
|
|
8695
|
+
function _unsupportedIterableToArray$6(o, minLen) {
|
|
8623
8696
|
if (!o) return;
|
|
8624
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
8697
|
+
if (typeof o === "string") return _arrayLikeToArray$6(o, minLen);
|
|
8625
8698
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8626
8699
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8627
8700
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
8628
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
8701
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
|
|
8629
8702
|
}
|
|
8630
|
-
function _arrayLikeToArray$
|
|
8703
|
+
function _arrayLikeToArray$6(arr, len) {
|
|
8631
8704
|
if (len == null || len > arr.length) len = arr.length;
|
|
8632
8705
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
8633
8706
|
return arr2;
|
|
8634
8707
|
}
|
|
8635
|
-
function _iterableToArrayLimit$
|
|
8708
|
+
function _iterableToArrayLimit$5(arr, i) {
|
|
8636
8709
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
8637
8710
|
if (null != _i) {
|
|
8638
8711
|
var _s,
|
|
@@ -8659,7 +8732,7 @@
|
|
|
8659
8732
|
return _arr;
|
|
8660
8733
|
}
|
|
8661
8734
|
}
|
|
8662
|
-
function _arrayWithHoles$
|
|
8735
|
+
function _arrayWithHoles$5(arr) {
|
|
8663
8736
|
if (Array.isArray(arr)) return arr;
|
|
8664
8737
|
}
|
|
8665
8738
|
function ownKeys$a(object, enumerableOnly) {
|
|
@@ -8833,7 +8906,7 @@
|
|
|
8833
8906
|
}
|
|
8834
8907
|
return {};
|
|
8835
8908
|
}),
|
|
8836
|
-
_useState2 = _slicedToArray$
|
|
8909
|
+
_useState2 = _slicedToArray$5(_useState, 2),
|
|
8837
8910
|
state = _useState2[0],
|
|
8838
8911
|
setState = _useState2[1];
|
|
8839
8912
|
useWidget({
|
|
@@ -8939,8 +9012,8 @@
|
|
|
8939
9012
|
}))) {
|
|
8940
9013
|
throw new Error(withUsage$1('The `widgets` option expects an array of widgets.'));
|
|
8941
9014
|
}
|
|
8942
|
-
if (!
|
|
8943
|
-
throw new Error(withUsage$1("The `facets` option only accepts
|
|
9015
|
+
if (!Array.isArray(facets)) {
|
|
9016
|
+
throw new Error(withUsage$1("The `facets` option only accepts an array of facets, you passed ".concat(JSON.stringify(facets))));
|
|
8944
9017
|
}
|
|
8945
9018
|
var localWidgets = new Map();
|
|
8946
9019
|
return {
|
|
@@ -9018,7 +9091,6 @@
|
|
|
9018
9091
|
unmountFn();
|
|
9019
9092
|
},
|
|
9020
9093
|
getWidgetSearchParameters: function getWidgetSearchParameters(state) {
|
|
9021
|
-
// broadening the scope of facets to avoid conflict between never and *
|
|
9022
9094
|
return facets.reduce(function (acc, curr) {
|
|
9023
9095
|
return acc.addFacet(curr);
|
|
9024
9096
|
}, state.setQueryParameters({
|
|
@@ -9265,26 +9337,26 @@
|
|
|
9265
9337
|
return (hint === "string" ? String : Number)(input);
|
|
9266
9338
|
}
|
|
9267
9339
|
function _toConsumableArray$1(arr) {
|
|
9268
|
-
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$
|
|
9340
|
+
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread$1();
|
|
9269
9341
|
}
|
|
9270
9342
|
function _nonIterableSpread$1() {
|
|
9271
9343
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9272
9344
|
}
|
|
9273
|
-
function _unsupportedIterableToArray$
|
|
9345
|
+
function _unsupportedIterableToArray$7(o, minLen) {
|
|
9274
9346
|
if (!o) return;
|
|
9275
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
9347
|
+
if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
|
|
9276
9348
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9277
9349
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9278
9350
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
9279
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
9351
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
|
|
9280
9352
|
}
|
|
9281
9353
|
function _iterableToArray$1(iter) {
|
|
9282
9354
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9283
9355
|
}
|
|
9284
9356
|
function _arrayWithoutHoles$1(arr) {
|
|
9285
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
9357
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$7(arr);
|
|
9286
9358
|
}
|
|
9287
|
-
function _arrayLikeToArray$
|
|
9359
|
+
function _arrayLikeToArray$7(arr, len) {
|
|
9288
9360
|
if (len == null || len > arr.length) len = arr.length;
|
|
9289
9361
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
9290
9362
|
return arr2;
|
|
@@ -9786,26 +9858,26 @@
|
|
|
9786
9858
|
instantSearchInstance.renderState = _objectSpread$d(_objectSpread$d({}, instantSearchInstance.renderState), {}, _defineProperty$d({}, parentIndexName, _objectSpread$d(_objectSpread$d({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
|
|
9787
9859
|
}
|
|
9788
9860
|
|
|
9789
|
-
function _slicedToArray$
|
|
9790
|
-
return _arrayWithHoles$
|
|
9861
|
+
function _slicedToArray$6(arr, i) {
|
|
9862
|
+
return _arrayWithHoles$6(arr) || _iterableToArrayLimit$6(arr, i) || _unsupportedIterableToArray$8(arr, i) || _nonIterableRest$6();
|
|
9791
9863
|
}
|
|
9792
|
-
function _nonIterableRest$
|
|
9864
|
+
function _nonIterableRest$6() {
|
|
9793
9865
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9794
9866
|
}
|
|
9795
|
-
function _unsupportedIterableToArray$
|
|
9867
|
+
function _unsupportedIterableToArray$8(o, minLen) {
|
|
9796
9868
|
if (!o) return;
|
|
9797
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
9869
|
+
if (typeof o === "string") return _arrayLikeToArray$8(o, minLen);
|
|
9798
9870
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9799
9871
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9800
9872
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
9801
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
9873
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen);
|
|
9802
9874
|
}
|
|
9803
|
-
function _arrayLikeToArray$
|
|
9875
|
+
function _arrayLikeToArray$8(arr, len) {
|
|
9804
9876
|
if (len == null || len > arr.length) len = arr.length;
|
|
9805
9877
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
9806
9878
|
return arr2;
|
|
9807
9879
|
}
|
|
9808
|
-
function _iterableToArrayLimit$
|
|
9880
|
+
function _iterableToArrayLimit$6(arr, i) {
|
|
9809
9881
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
9810
9882
|
if (null != _i) {
|
|
9811
9883
|
var _s,
|
|
@@ -9832,7 +9904,7 @@
|
|
|
9832
9904
|
return _arr;
|
|
9833
9905
|
}
|
|
9834
9906
|
}
|
|
9835
|
-
function _arrayWithHoles$
|
|
9907
|
+
function _arrayWithHoles$6(arr) {
|
|
9836
9908
|
if (Array.isArray(arr)) return arr;
|
|
9837
9909
|
}
|
|
9838
9910
|
|
|
@@ -9844,7 +9916,7 @@
|
|
|
9844
9916
|
var _useReducer = React.useReducer(function (x) {
|
|
9845
9917
|
return x + 1;
|
|
9846
9918
|
}, 0),
|
|
9847
|
-
_useReducer2 = _slicedToArray$
|
|
9919
|
+
_useReducer2 = _slicedToArray$6(_useReducer, 2),
|
|
9848
9920
|
forceUpdate = _useReducer2[1];
|
|
9849
9921
|
return forceUpdate;
|
|
9850
9922
|
}
|
|
@@ -10153,13 +10225,13 @@
|
|
|
10153
10225
|
}
|
|
10154
10226
|
return (hint === "string" ? String : Number)(input);
|
|
10155
10227
|
}
|
|
10156
|
-
function _slicedToArray$
|
|
10157
|
-
return _arrayWithHoles$
|
|
10228
|
+
function _slicedToArray$7(arr, i) {
|
|
10229
|
+
return _arrayWithHoles$7(arr) || _iterableToArrayLimit$7(arr, i) || _unsupportedIterableToArray$9(arr, i) || _nonIterableRest$7();
|
|
10158
10230
|
}
|
|
10159
|
-
function _nonIterableRest$
|
|
10231
|
+
function _nonIterableRest$7() {
|
|
10160
10232
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10161
10233
|
}
|
|
10162
|
-
function _iterableToArrayLimit$
|
|
10234
|
+
function _iterableToArrayLimit$7(arr, i) {
|
|
10163
10235
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
10164
10236
|
if (null != _i) {
|
|
10165
10237
|
var _s,
|
|
@@ -10186,30 +10258,30 @@
|
|
|
10186
10258
|
return _arr;
|
|
10187
10259
|
}
|
|
10188
10260
|
}
|
|
10189
|
-
function _arrayWithHoles$
|
|
10261
|
+
function _arrayWithHoles$7(arr) {
|
|
10190
10262
|
if (Array.isArray(arr)) return arr;
|
|
10191
10263
|
}
|
|
10192
10264
|
function _toConsumableArray$2(arr) {
|
|
10193
|
-
return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$
|
|
10265
|
+
return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$9(arr) || _nonIterableSpread$2();
|
|
10194
10266
|
}
|
|
10195
10267
|
function _nonIterableSpread$2() {
|
|
10196
10268
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10197
10269
|
}
|
|
10198
|
-
function _unsupportedIterableToArray$
|
|
10270
|
+
function _unsupportedIterableToArray$9(o, minLen) {
|
|
10199
10271
|
if (!o) return;
|
|
10200
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
10272
|
+
if (typeof o === "string") return _arrayLikeToArray$9(o, minLen);
|
|
10201
10273
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
10202
10274
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
10203
10275
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
10204
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
10276
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$9(o, minLen);
|
|
10205
10277
|
}
|
|
10206
10278
|
function _iterableToArray$2(iter) {
|
|
10207
10279
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
10208
10280
|
}
|
|
10209
10281
|
function _arrayWithoutHoles$2(arr) {
|
|
10210
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
10282
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$9(arr);
|
|
10211
10283
|
}
|
|
10212
|
-
function _arrayLikeToArray$
|
|
10284
|
+
function _arrayLikeToArray$9(arr, len) {
|
|
10213
10285
|
if (len == null || len > arr.length) len = arr.length;
|
|
10214
10286
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
10215
10287
|
return arr2;
|
|
@@ -10265,7 +10337,7 @@
|
|
|
10265
10337
|
});
|
|
10266
10338
|
instantSearchInstance.unuse.apply(instantSearchInstance, _toConsumableArray$2(existingInsightsMiddlewares));
|
|
10267
10339
|
var _getAppIdAndApiKey = getAppIdAndApiKey(instantSearchInstance.client),
|
|
10268
|
-
_getAppIdAndApiKey2 = _slicedToArray$
|
|
10340
|
+
_getAppIdAndApiKey2 = _slicedToArray$7(_getAppIdAndApiKey, 2),
|
|
10269
10341
|
appId = _getAppIdAndApiKey2[0],
|
|
10270
10342
|
apiKey = _getAppIdAndApiKey2[1];
|
|
10271
10343
|
var queuedUserToken = undefined;
|
|
@@ -10282,11 +10354,11 @@
|
|
|
10282
10354
|
// we still want to read the token from the queue.
|
|
10283
10355
|
// Otherwise, the first search call will be fired without the token.
|
|
10284
10356
|
var _ref3 = find$1(insightsClient.queue.slice().reverse(), function (_ref5) {
|
|
10285
|
-
var _ref6 = _slicedToArray$
|
|
10357
|
+
var _ref6 = _slicedToArray$7(_ref5, 1),
|
|
10286
10358
|
method = _ref6[0];
|
|
10287
10359
|
return method === 'setUserToken';
|
|
10288
10360
|
}) || [];
|
|
10289
|
-
var _ref4 = _slicedToArray$
|
|
10361
|
+
var _ref4 = _slicedToArray$7(_ref3, 2);
|
|
10290
10362
|
queuedUserToken = _ref4[1];
|
|
10291
10363
|
}
|
|
10292
10364
|
insightsClient('getUserToken', null, function (_error, userToken) {
|
|
@@ -10440,7 +10512,7 @@
|
|
|
10440
10512
|
*/
|
|
10441
10513
|
function isModernInsightsClient(client) {
|
|
10442
10514
|
var _split$map = (client.version || '').split('.').map(Number),
|
|
10443
|
-
_split$map2 = _slicedToArray$
|
|
10515
|
+
_split$map2 = _slicedToArray$7(_split$map, 2),
|
|
10444
10516
|
major = _split$map2[0],
|
|
10445
10517
|
minor = _split$map2[1];
|
|
10446
10518
|
|
|
@@ -12068,7 +12140,7 @@
|
|
|
12068
12140
|
};
|
|
12069
12141
|
}
|
|
12070
12142
|
|
|
12071
|
-
var version$3 = '4.
|
|
12143
|
+
var version$3 = '4.62.0';
|
|
12072
12144
|
|
|
12073
12145
|
function _typeof$o(obj) {
|
|
12074
12146
|
"@babel/helpers - typeof";
|
|
@@ -12232,7 +12304,8 @@
|
|
|
12232
12304
|
* Global options for an InstantSearch instance.
|
|
12233
12305
|
*/
|
|
12234
12306
|
var INSTANTSEARCH_FUTURE_DEFAULTS = {
|
|
12235
|
-
preserveSharedStateOnUnmount: false
|
|
12307
|
+
preserveSharedStateOnUnmount: false,
|
|
12308
|
+
persistHierarchicalRootCount: false
|
|
12236
12309
|
};
|
|
12237
12310
|
|
|
12238
12311
|
/**
|
|
@@ -12552,7 +12625,9 @@
|
|
|
12552
12625
|
// DerivedHelper scoped into the `index` widgets.
|
|
12553
12626
|
// In Vue InstantSearch' hydrate, a main helper gets set before start, so
|
|
12554
12627
|
// we need to respect this helper as a way to keep all listeners correct.
|
|
12555
|
-
var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName
|
|
12628
|
+
var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName, undefined, {
|
|
12629
|
+
persistHierarchicalRootCount: this.future.persistHierarchicalRootCount
|
|
12630
|
+
});
|
|
12556
12631
|
mainHelper.search = function () {
|
|
12557
12632
|
_this3.status = 'loading';
|
|
12558
12633
|
_this3.scheduleRender(false);
|
|
@@ -13256,26 +13331,26 @@
|
|
|
13256
13331
|
}
|
|
13257
13332
|
return (hint === "string" ? String : Number)(input);
|
|
13258
13333
|
}
|
|
13259
|
-
function _slicedToArray$
|
|
13260
|
-
return _arrayWithHoles$
|
|
13334
|
+
function _slicedToArray$8(arr, i) {
|
|
13335
|
+
return _arrayWithHoles$8(arr) || _iterableToArrayLimit$8(arr, i) || _unsupportedIterableToArray$a(arr, i) || _nonIterableRest$8();
|
|
13261
13336
|
}
|
|
13262
|
-
function _nonIterableRest$
|
|
13337
|
+
function _nonIterableRest$8() {
|
|
13263
13338
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13264
13339
|
}
|
|
13265
|
-
function _unsupportedIterableToArray$
|
|
13340
|
+
function _unsupportedIterableToArray$a(o, minLen) {
|
|
13266
13341
|
if (!o) return;
|
|
13267
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
13342
|
+
if (typeof o === "string") return _arrayLikeToArray$a(o, minLen);
|
|
13268
13343
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
13269
13344
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
13270
13345
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
13271
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
13346
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$a(o, minLen);
|
|
13272
13347
|
}
|
|
13273
|
-
function _arrayLikeToArray$
|
|
13348
|
+
function _arrayLikeToArray$a(arr, len) {
|
|
13274
13349
|
if (len == null || len > arr.length) len = arr.length;
|
|
13275
13350
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
13276
13351
|
return arr2;
|
|
13277
13352
|
}
|
|
13278
|
-
function _iterableToArrayLimit$
|
|
13353
|
+
function _iterableToArrayLimit$8(arr, i) {
|
|
13279
13354
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
13280
13355
|
if (null != _i) {
|
|
13281
13356
|
var _s,
|
|
@@ -13302,7 +13377,7 @@
|
|
|
13302
13377
|
return _arr;
|
|
13303
13378
|
}
|
|
13304
13379
|
}
|
|
13305
|
-
function _arrayWithHoles$
|
|
13380
|
+
function _arrayWithHoles$8(arr) {
|
|
13306
13381
|
if (Array.isArray(arr)) return arr;
|
|
13307
13382
|
}
|
|
13308
13383
|
var withUsage$4 = createDocumentationMessageGenerator({
|
|
@@ -13327,7 +13402,7 @@
|
|
|
13327
13402
|
if (!attributes || !Array.isArray(attributes) || attributes.length === 0) {
|
|
13328
13403
|
throw new Error(withUsage$4('The `attributes` option expects an array of strings.'));
|
|
13329
13404
|
}
|
|
13330
|
-
var _attributes = _slicedToArray$
|
|
13405
|
+
var _attributes = _slicedToArray$8(attributes, 1),
|
|
13331
13406
|
hierarchicalFacetName = _attributes[0];
|
|
13332
13407
|
function getRefinedState(state, facetValue) {
|
|
13333
13408
|
if (!facetValue) {
|
|
@@ -13373,7 +13448,7 @@
|
|
|
13373
13448
|
if (!results || state.hierarchicalFacets.length === 0) {
|
|
13374
13449
|
return [];
|
|
13375
13450
|
}
|
|
13376
|
-
var _state$hierarchicalFa = _slicedToArray$
|
|
13451
|
+
var _state$hierarchicalFa = _slicedToArray$8(state.hierarchicalFacets, 1),
|
|
13377
13452
|
facetName = _state$hierarchicalFa[0].name;
|
|
13378
13453
|
var facetValues = results.getFacetValues(facetName, {});
|
|
13379
13454
|
var facetItems = facetValues && !Array.isArray(facetValues) && facetValues.data ? facetValues.data : [];
|
|
@@ -13409,12 +13484,9 @@
|
|
|
13409
13484
|
getWidgetUiState: function getWidgetUiState(uiState, _ref3) {
|
|
13410
13485
|
var searchParameters = _ref3.searchParameters;
|
|
13411
13486
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
13412
|
-
|
|
13413
|
-
return uiState;
|
|
13414
|
-
}
|
|
13415
|
-
return _objectSpread$l(_objectSpread$l({}, uiState), {}, {
|
|
13487
|
+
return removeEmptyRefinementsFromUiState(_objectSpread$l(_objectSpread$l({}, uiState), {}, {
|
|
13416
13488
|
hierarchicalMenu: _objectSpread$l(_objectSpread$l({}, uiState.hierarchicalMenu), {}, _defineProperty$m({}, hierarchicalFacetName, path))
|
|
13417
|
-
});
|
|
13489
|
+
}), hierarchicalFacetName);
|
|
13418
13490
|
},
|
|
13419
13491
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref4) {
|
|
13420
13492
|
var uiState = _ref4.uiState;
|
|
@@ -13463,6 +13535,18 @@
|
|
|
13463
13535
|
};
|
|
13464
13536
|
});
|
|
13465
13537
|
}
|
|
13538
|
+
function removeEmptyRefinementsFromUiState(indexUiState, attribute) {
|
|
13539
|
+
if (!indexUiState.hierarchicalMenu) {
|
|
13540
|
+
return indexUiState;
|
|
13541
|
+
}
|
|
13542
|
+
if (!indexUiState.hierarchicalMenu[attribute] || !indexUiState.hierarchicalMenu[attribute].length) {
|
|
13543
|
+
delete indexUiState.hierarchicalMenu[attribute];
|
|
13544
|
+
}
|
|
13545
|
+
if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
|
|
13546
|
+
delete indexUiState.hierarchicalMenu;
|
|
13547
|
+
}
|
|
13548
|
+
return indexUiState;
|
|
13549
|
+
}
|
|
13466
13550
|
|
|
13467
13551
|
function useBreadcrumb(props, additionalWidgetProperties) {
|
|
13468
13552
|
return useConnector(connectBreadcrumb, props, additionalWidgetProperties);
|
|
@@ -13478,26 +13562,26 @@
|
|
|
13478
13562
|
}, _typeof$s(obj);
|
|
13479
13563
|
}
|
|
13480
13564
|
function _toConsumableArray$3(arr) {
|
|
13481
|
-
return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$
|
|
13565
|
+
return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$b(arr) || _nonIterableSpread$3();
|
|
13482
13566
|
}
|
|
13483
13567
|
function _nonIterableSpread$3() {
|
|
13484
13568
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13485
13569
|
}
|
|
13486
|
-
function _unsupportedIterableToArray$
|
|
13570
|
+
function _unsupportedIterableToArray$b(o, minLen) {
|
|
13487
13571
|
if (!o) return;
|
|
13488
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
13572
|
+
if (typeof o === "string") return _arrayLikeToArray$b(o, minLen);
|
|
13489
13573
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
13490
13574
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
13491
13575
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
13492
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
13576
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$b(o, minLen);
|
|
13493
13577
|
}
|
|
13494
13578
|
function _iterableToArray$3(iter) {
|
|
13495
13579
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
13496
13580
|
}
|
|
13497
13581
|
function _arrayWithoutHoles$3(arr) {
|
|
13498
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
13582
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$b(arr);
|
|
13499
13583
|
}
|
|
13500
|
-
function _arrayLikeToArray$
|
|
13584
|
+
function _arrayLikeToArray$b(arr, len) {
|
|
13501
13585
|
if (len == null || len > arr.length) len = arr.length;
|
|
13502
13586
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
13503
13587
|
return arr2;
|
|
@@ -13698,26 +13782,26 @@
|
|
|
13698
13782
|
}, _typeof$t(obj);
|
|
13699
13783
|
}
|
|
13700
13784
|
function _toConsumableArray$4(arr) {
|
|
13701
|
-
return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$
|
|
13785
|
+
return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$c(arr) || _nonIterableSpread$4();
|
|
13702
13786
|
}
|
|
13703
13787
|
function _nonIterableSpread$4() {
|
|
13704
13788
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13705
13789
|
}
|
|
13706
|
-
function _unsupportedIterableToArray$
|
|
13790
|
+
function _unsupportedIterableToArray$c(o, minLen) {
|
|
13707
13791
|
if (!o) return;
|
|
13708
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
13792
|
+
if (typeof o === "string") return _arrayLikeToArray$c(o, minLen);
|
|
13709
13793
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
13710
13794
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
13711
13795
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
13712
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
13796
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$c(o, minLen);
|
|
13713
13797
|
}
|
|
13714
13798
|
function _iterableToArray$4(iter) {
|
|
13715
13799
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
13716
13800
|
}
|
|
13717
13801
|
function _arrayWithoutHoles$4(arr) {
|
|
13718
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
13802
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$c(arr);
|
|
13719
13803
|
}
|
|
13720
|
-
function _arrayLikeToArray$
|
|
13804
|
+
function _arrayLikeToArray$c(arr, len) {
|
|
13721
13805
|
if (len == null || len > arr.length) len = arr.length;
|
|
13722
13806
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
13723
13807
|
return arr2;
|
|
@@ -14303,26 +14387,26 @@
|
|
|
14303
14387
|
}
|
|
14304
14388
|
return target;
|
|
14305
14389
|
}
|
|
14306
|
-
function _slicedToArray$
|
|
14307
|
-
return _arrayWithHoles$
|
|
14390
|
+
function _slicedToArray$9(arr, i) {
|
|
14391
|
+
return _arrayWithHoles$9(arr) || _iterableToArrayLimit$9(arr, i) || _unsupportedIterableToArray$d(arr, i) || _nonIterableRest$9();
|
|
14308
14392
|
}
|
|
14309
|
-
function _nonIterableRest$
|
|
14393
|
+
function _nonIterableRest$9() {
|
|
14310
14394
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14311
14395
|
}
|
|
14312
|
-
function _unsupportedIterableToArray$
|
|
14396
|
+
function _unsupportedIterableToArray$d(o, minLen) {
|
|
14313
14397
|
if (!o) return;
|
|
14314
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
14398
|
+
if (typeof o === "string") return _arrayLikeToArray$d(o, minLen);
|
|
14315
14399
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
14316
14400
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
14317
14401
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
14318
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
14402
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$d(o, minLen);
|
|
14319
14403
|
}
|
|
14320
|
-
function _arrayLikeToArray$
|
|
14404
|
+
function _arrayLikeToArray$d(arr, len) {
|
|
14321
14405
|
if (len == null || len > arr.length) len = arr.length;
|
|
14322
14406
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14323
14407
|
return arr2;
|
|
14324
14408
|
}
|
|
14325
|
-
function _iterableToArrayLimit$
|
|
14409
|
+
function _iterableToArrayLimit$9(arr, i) {
|
|
14326
14410
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
14327
14411
|
if (null != _i) {
|
|
14328
14412
|
var _s,
|
|
@@ -14349,7 +14433,7 @@
|
|
|
14349
14433
|
return _arr;
|
|
14350
14434
|
}
|
|
14351
14435
|
}
|
|
14352
|
-
function _arrayWithHoles$
|
|
14436
|
+
function _arrayWithHoles$9(arr) {
|
|
14353
14437
|
if (Array.isArray(arr)) return arr;
|
|
14354
14438
|
}
|
|
14355
14439
|
var withUsage$8 = createDocumentationMessageGenerator({
|
|
@@ -14403,7 +14487,7 @@
|
|
|
14403
14487
|
// we need to provide a hierarchicalFacet name for the search state
|
|
14404
14488
|
// so that we can always map $hierarchicalFacetName => real attributes
|
|
14405
14489
|
// we use the first attribute name
|
|
14406
|
-
var _attributes = _slicedToArray$
|
|
14490
|
+
var _attributes = _slicedToArray$9(attributes, 1),
|
|
14407
14491
|
hierarchicalFacetName = _attributes[0];
|
|
14408
14492
|
var sendEvent;
|
|
14409
14493
|
|
|
@@ -14537,12 +14621,9 @@
|
|
|
14537
14621
|
getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
|
|
14538
14622
|
var searchParameters = _ref5.searchParameters;
|
|
14539
14623
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
14540
|
-
|
|
14541
|
-
return uiState;
|
|
14542
|
-
}
|
|
14543
|
-
return _objectSpread$p(_objectSpread$p({}, uiState), {}, {
|
|
14624
|
+
return removeEmptyRefinementsFromUiState$1(_objectSpread$p(_objectSpread$p({}, uiState), {}, {
|
|
14544
14625
|
hierarchicalMenu: _objectSpread$p(_objectSpread$p({}, uiState.hierarchicalMenu), {}, _defineProperty$q({}, hierarchicalFacetName, path))
|
|
14545
|
-
});
|
|
14626
|
+
}), hierarchicalFacetName);
|
|
14546
14627
|
},
|
|
14547
14628
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
14548
14629
|
var uiState = _ref6.uiState;
|
|
@@ -14573,6 +14654,18 @@
|
|
|
14573
14654
|
};
|
|
14574
14655
|
};
|
|
14575
14656
|
};
|
|
14657
|
+
function removeEmptyRefinementsFromUiState$1(indexUiState, attribute) {
|
|
14658
|
+
if (!indexUiState.hierarchicalMenu) {
|
|
14659
|
+
return indexUiState;
|
|
14660
|
+
}
|
|
14661
|
+
if (!indexUiState.hierarchicalMenu[attribute] || indexUiState.hierarchicalMenu[attribute].length === 0) {
|
|
14662
|
+
delete indexUiState.hierarchicalMenu[attribute];
|
|
14663
|
+
}
|
|
14664
|
+
if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
|
|
14665
|
+
delete indexUiState.hierarchicalMenu;
|
|
14666
|
+
}
|
|
14667
|
+
return indexUiState;
|
|
14668
|
+
}
|
|
14576
14669
|
|
|
14577
14670
|
function useHierarchicalMenu(props, additionalWidgetProperties) {
|
|
14578
14671
|
return useConnector(connectHierarchicalMenu, props, additionalWidgetProperties);
|
|
@@ -14749,26 +14842,26 @@
|
|
|
14749
14842
|
}, _typeof$x(obj);
|
|
14750
14843
|
}
|
|
14751
14844
|
function _toConsumableArray$5(arr) {
|
|
14752
|
-
return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$
|
|
14845
|
+
return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$e(arr) || _nonIterableSpread$5();
|
|
14753
14846
|
}
|
|
14754
14847
|
function _nonIterableSpread$5() {
|
|
14755
14848
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14756
14849
|
}
|
|
14757
|
-
function _unsupportedIterableToArray$
|
|
14850
|
+
function _unsupportedIterableToArray$e(o, minLen) {
|
|
14758
14851
|
if (!o) return;
|
|
14759
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
14852
|
+
if (typeof o === "string") return _arrayLikeToArray$e(o, minLen);
|
|
14760
14853
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
14761
14854
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
14762
14855
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
14763
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
14856
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$e(o, minLen);
|
|
14764
14857
|
}
|
|
14765
14858
|
function _iterableToArray$5(iter) {
|
|
14766
14859
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
14767
14860
|
}
|
|
14768
14861
|
function _arrayWithoutHoles$5(arr) {
|
|
14769
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
14862
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$e(arr);
|
|
14770
14863
|
}
|
|
14771
|
-
function _arrayLikeToArray$
|
|
14864
|
+
function _arrayLikeToArray$e(arr, len) {
|
|
14772
14865
|
if (len == null || len > arr.length) len = arr.length;
|
|
14773
14866
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14774
14867
|
return arr2;
|
|
@@ -15022,26 +15115,26 @@
|
|
|
15022
15115
|
return (hint === "string" ? String : Number)(input);
|
|
15023
15116
|
}
|
|
15024
15117
|
function _toConsumableArray$6(arr) {
|
|
15025
|
-
return _arrayWithoutHoles$6(arr) || _iterableToArray$6(arr) || _unsupportedIterableToArray$
|
|
15118
|
+
return _arrayWithoutHoles$6(arr) || _iterableToArray$6(arr) || _unsupportedIterableToArray$f(arr) || _nonIterableSpread$6();
|
|
15026
15119
|
}
|
|
15027
15120
|
function _nonIterableSpread$6() {
|
|
15028
15121
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
15029
15122
|
}
|
|
15030
|
-
function _unsupportedIterableToArray$
|
|
15123
|
+
function _unsupportedIterableToArray$f(o, minLen) {
|
|
15031
15124
|
if (!o) return;
|
|
15032
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
15125
|
+
if (typeof o === "string") return _arrayLikeToArray$f(o, minLen);
|
|
15033
15126
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
15034
15127
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
15035
15128
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
15036
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
15129
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$f(o, minLen);
|
|
15037
15130
|
}
|
|
15038
15131
|
function _iterableToArray$6(iter) {
|
|
15039
15132
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
15040
15133
|
}
|
|
15041
15134
|
function _arrayWithoutHoles$6(arr) {
|
|
15042
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
15135
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$f(arr);
|
|
15043
15136
|
}
|
|
15044
|
-
function _arrayLikeToArray$
|
|
15137
|
+
function _arrayLikeToArray$f(arr, len) {
|
|
15045
15138
|
if (len == null || len > arr.length) len = arr.length;
|
|
15046
15139
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
15047
15140
|
return arr2;
|
|
@@ -15357,26 +15450,26 @@
|
|
|
15357
15450
|
}
|
|
15358
15451
|
return target;
|
|
15359
15452
|
}
|
|
15360
|
-
function _slicedToArray$
|
|
15361
|
-
return _arrayWithHoles$
|
|
15453
|
+
function _slicedToArray$a(arr, i) {
|
|
15454
|
+
return _arrayWithHoles$a(arr) || _iterableToArrayLimit$a(arr, i) || _unsupportedIterableToArray$g(arr, i) || _nonIterableRest$a();
|
|
15362
15455
|
}
|
|
15363
|
-
function _nonIterableRest$
|
|
15456
|
+
function _nonIterableRest$a() {
|
|
15364
15457
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
15365
15458
|
}
|
|
15366
|
-
function _unsupportedIterableToArray$
|
|
15459
|
+
function _unsupportedIterableToArray$g(o, minLen) {
|
|
15367
15460
|
if (!o) return;
|
|
15368
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
15461
|
+
if (typeof o === "string") return _arrayLikeToArray$g(o, minLen);
|
|
15369
15462
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
15370
15463
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
15371
15464
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
15372
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
15465
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$g(o, minLen);
|
|
15373
15466
|
}
|
|
15374
|
-
function _arrayLikeToArray$
|
|
15467
|
+
function _arrayLikeToArray$g(arr, len) {
|
|
15375
15468
|
if (len == null || len > arr.length) len = arr.length;
|
|
15376
15469
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
15377
15470
|
return arr2;
|
|
15378
15471
|
}
|
|
15379
|
-
function _iterableToArrayLimit$
|
|
15472
|
+
function _iterableToArrayLimit$a(arr, i) {
|
|
15380
15473
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
15381
15474
|
if (null != _i) {
|
|
15382
15475
|
var _s,
|
|
@@ -15403,7 +15496,7 @@
|
|
|
15403
15496
|
return _arr;
|
|
15404
15497
|
}
|
|
15405
15498
|
}
|
|
15406
|
-
function _arrayWithHoles$
|
|
15499
|
+
function _arrayWithHoles$a(arr) {
|
|
15407
15500
|
if (Array.isArray(arr)) return arr;
|
|
15408
15501
|
}
|
|
15409
15502
|
function ownKeys$t(object, enumerableOnly) {
|
|
@@ -15566,7 +15659,7 @@
|
|
|
15566
15659
|
if (!_refine) {
|
|
15567
15660
|
_refine = function _refine(facetValue) {
|
|
15568
15661
|
var _helper$getHierarchic = helper.getHierarchicalFacetBreadcrumb(attribute),
|
|
15569
|
-
_helper$getHierarchic2 = _slicedToArray$
|
|
15662
|
+
_helper$getHierarchic2 = _slicedToArray$a(_helper$getHierarchic, 1),
|
|
15570
15663
|
refinedItem = _helper$getHierarchic2[0];
|
|
15571
15664
|
sendEvent('click:internal', facetValue ? facetValue : refinedItem);
|
|
15572
15665
|
helper.toggleFacetRefinement(attribute, facetValue ? facetValue : refinedItem).search();
|
|
@@ -15610,14 +15703,11 @@
|
|
|
15610
15703
|
getWidgetUiState: function getWidgetUiState(uiState, _ref4) {
|
|
15611
15704
|
var searchParameters = _ref4.searchParameters;
|
|
15612
15705
|
var _searchParameters$get = searchParameters.getHierarchicalFacetBreadcrumb(attribute),
|
|
15613
|
-
_searchParameters$get2 = _slicedToArray$
|
|
15706
|
+
_searchParameters$get2 = _slicedToArray$a(_searchParameters$get, 1),
|
|
15614
15707
|
value = _searchParameters$get2[0];
|
|
15615
|
-
|
|
15616
|
-
return uiState;
|
|
15617
|
-
}
|
|
15618
|
-
return _objectSpread$t(_objectSpread$t({}, uiState), {}, {
|
|
15708
|
+
return removeEmptyRefinementsFromUiState$2(_objectSpread$t(_objectSpread$t({}, uiState), {}, {
|
|
15619
15709
|
menu: _objectSpread$t(_objectSpread$t({}, uiState.menu), {}, _defineProperty$u({}, attribute, value))
|
|
15620
|
-
});
|
|
15710
|
+
}), attribute);
|
|
15621
15711
|
},
|
|
15622
15712
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
|
|
15623
15713
|
var uiState = _ref5.uiState;
|
|
@@ -15642,6 +15732,18 @@
|
|
|
15642
15732
|
};
|
|
15643
15733
|
};
|
|
15644
15734
|
};
|
|
15735
|
+
function removeEmptyRefinementsFromUiState$2(indexUiState, attribute) {
|
|
15736
|
+
if (!indexUiState.menu) {
|
|
15737
|
+
return indexUiState;
|
|
15738
|
+
}
|
|
15739
|
+
if (indexUiState.menu[attribute] === undefined) {
|
|
15740
|
+
delete indexUiState.menu[attribute];
|
|
15741
|
+
}
|
|
15742
|
+
if (Object.keys(indexUiState.menu).length === 0) {
|
|
15743
|
+
delete indexUiState.menu;
|
|
15744
|
+
}
|
|
15745
|
+
return indexUiState;
|
|
15746
|
+
}
|
|
15645
15747
|
|
|
15646
15748
|
function useMenu(props, additionalWidgetProperties) {
|
|
15647
15749
|
return useConnector(connectMenu, props, additionalWidgetProperties);
|
|
@@ -15659,7 +15761,7 @@
|
|
|
15659
15761
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
15660
15762
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
15661
15763
|
if (!it) {
|
|
15662
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray$
|
|
15764
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$h(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
15663
15765
|
if (it) o = it;
|
|
15664
15766
|
var i = 0;
|
|
15665
15767
|
var F = function F() {};
|
|
@@ -15707,26 +15809,26 @@
|
|
|
15707
15809
|
}
|
|
15708
15810
|
};
|
|
15709
15811
|
}
|
|
15710
|
-
function _slicedToArray$
|
|
15711
|
-
return _arrayWithHoles$
|
|
15812
|
+
function _slicedToArray$b(arr, i) {
|
|
15813
|
+
return _arrayWithHoles$b(arr) || _iterableToArrayLimit$b(arr, i) || _unsupportedIterableToArray$h(arr, i) || _nonIterableRest$b();
|
|
15712
15814
|
}
|
|
15713
|
-
function _nonIterableRest$
|
|
15815
|
+
function _nonIterableRest$b() {
|
|
15714
15816
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
15715
15817
|
}
|
|
15716
|
-
function _unsupportedIterableToArray$
|
|
15818
|
+
function _unsupportedIterableToArray$h(o, minLen) {
|
|
15717
15819
|
if (!o) return;
|
|
15718
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
15820
|
+
if (typeof o === "string") return _arrayLikeToArray$h(o, minLen);
|
|
15719
15821
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
15720
15822
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
15721
15823
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
15722
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
15824
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$h(o, minLen);
|
|
15723
15825
|
}
|
|
15724
|
-
function _arrayLikeToArray$
|
|
15826
|
+
function _arrayLikeToArray$h(arr, len) {
|
|
15725
15827
|
if (len == null || len > arr.length) len = arr.length;
|
|
15726
15828
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
15727
15829
|
return arr2;
|
|
15728
15830
|
}
|
|
15729
|
-
function _iterableToArrayLimit$
|
|
15831
|
+
function _iterableToArrayLimit$b(arr, i) {
|
|
15730
15832
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
15731
15833
|
if (null != _i) {
|
|
15732
15834
|
var _s,
|
|
@@ -15753,7 +15855,7 @@
|
|
|
15753
15855
|
return _arr;
|
|
15754
15856
|
}
|
|
15755
15857
|
}
|
|
15756
|
-
function _arrayWithHoles$
|
|
15858
|
+
function _arrayWithHoles$b(arr) {
|
|
15757
15859
|
if (Array.isArray(arr)) return arr;
|
|
15758
15860
|
}
|
|
15759
15861
|
function ownKeys$u(object, enumerableOnly) {
|
|
@@ -15888,12 +15990,9 @@
|
|
|
15888
15990
|
}
|
|
15889
15991
|
var min = values['>='] && values['>='][0] || '';
|
|
15890
15992
|
var max = values['<='] && values['<='][0] || '';
|
|
15891
|
-
|
|
15892
|
-
return uiState;
|
|
15893
|
-
}
|
|
15894
|
-
return _objectSpread$u(_objectSpread$u({}, uiState), {}, {
|
|
15993
|
+
return removeEmptyRefinementsFromUiState$3(_objectSpread$u(_objectSpread$u({}, uiState), {}, {
|
|
15895
15994
|
numericMenu: _objectSpread$u(_objectSpread$u({}, uiState.numericMenu), {}, _defineProperty$v({}, attribute, "".concat(min, ":").concat(max)))
|
|
15896
|
-
});
|
|
15995
|
+
}), attribute);
|
|
15897
15996
|
},
|
|
15898
15997
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
15899
15998
|
var uiState = _ref6.uiState;
|
|
@@ -15909,7 +16008,7 @@
|
|
|
15909
16008
|
return withoutRefinements.addNumericRefinement(attribute, '=', Number(value));
|
|
15910
16009
|
}
|
|
15911
16010
|
var _value$split$map = value.split(':').map(parseFloat),
|
|
15912
|
-
_value$split$map2 = _slicedToArray$
|
|
16011
|
+
_value$split$map2 = _slicedToArray$b(_value$split$map, 2),
|
|
15913
16012
|
min = _value$split$map2[0],
|
|
15914
16013
|
max = _value$split$map2[1];
|
|
15915
16014
|
var withMinRefinement = isFiniteNumber(min) ? withoutRefinements.addNumericRefinement(attribute, '>=', min) : withoutRefinements;
|
|
@@ -16055,6 +16154,18 @@
|
|
|
16055
16154
|
function hasNumericRefinement(currentRefinements, operator, value) {
|
|
16056
16155
|
return currentRefinements[operator] !== undefined && currentRefinements[operator].includes(value);
|
|
16057
16156
|
}
|
|
16157
|
+
function removeEmptyRefinementsFromUiState$3(indexUiState, attribute) {
|
|
16158
|
+
if (!indexUiState.numericMenu) {
|
|
16159
|
+
return indexUiState;
|
|
16160
|
+
}
|
|
16161
|
+
if (indexUiState.numericMenu[attribute] === ':') {
|
|
16162
|
+
delete indexUiState.numericMenu[attribute];
|
|
16163
|
+
}
|
|
16164
|
+
if (Object.keys(indexUiState.numericMenu).length === 0) {
|
|
16165
|
+
delete indexUiState.numericMenu;
|
|
16166
|
+
}
|
|
16167
|
+
return indexUiState;
|
|
16168
|
+
}
|
|
16058
16169
|
|
|
16059
16170
|
function useNumericMenu(props, additionalWidgetProperties) {
|
|
16060
16171
|
return useConnector(connectNumericMenu, props, additionalWidgetProperties);
|
|
@@ -16428,26 +16539,26 @@
|
|
|
16428
16539
|
return (hint === "string" ? String : Number)(input);
|
|
16429
16540
|
}
|
|
16430
16541
|
function _toConsumableArray$7(arr) {
|
|
16431
|
-
return _arrayWithoutHoles$7(arr) || _iterableToArray$7(arr) || _unsupportedIterableToArray$
|
|
16542
|
+
return _arrayWithoutHoles$7(arr) || _iterableToArray$7(arr) || _unsupportedIterableToArray$i(arr) || _nonIterableSpread$7();
|
|
16432
16543
|
}
|
|
16433
16544
|
function _nonIterableSpread$7() {
|
|
16434
16545
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
16435
16546
|
}
|
|
16436
|
-
function _unsupportedIterableToArray$
|
|
16547
|
+
function _unsupportedIterableToArray$i(o, minLen) {
|
|
16437
16548
|
if (!o) return;
|
|
16438
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
16549
|
+
if (typeof o === "string") return _arrayLikeToArray$i(o, minLen);
|
|
16439
16550
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
16440
16551
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
16441
16552
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
16442
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
16553
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$i(o, minLen);
|
|
16443
16554
|
}
|
|
16444
16555
|
function _iterableToArray$7(iter) {
|
|
16445
16556
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
16446
16557
|
}
|
|
16447
16558
|
function _arrayWithoutHoles$7(arr) {
|
|
16448
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
16559
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$i(arr);
|
|
16449
16560
|
}
|
|
16450
|
-
function _arrayLikeToArray$
|
|
16561
|
+
function _arrayLikeToArray$i(arr, len) {
|
|
16451
16562
|
if (len == null || len > arr.length) len = arr.length;
|
|
16452
16563
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
16453
16564
|
return arr2;
|
|
@@ -16665,26 +16776,26 @@
|
|
|
16665
16776
|
}
|
|
16666
16777
|
return (hint === "string" ? String : Number)(input);
|
|
16667
16778
|
}
|
|
16668
|
-
function _slicedToArray$
|
|
16669
|
-
return _arrayWithHoles$
|
|
16779
|
+
function _slicedToArray$c(arr, i) {
|
|
16780
|
+
return _arrayWithHoles$c(arr) || _iterableToArrayLimit$c(arr, i) || _unsupportedIterableToArray$j(arr, i) || _nonIterableRest$c();
|
|
16670
16781
|
}
|
|
16671
|
-
function _nonIterableRest$
|
|
16782
|
+
function _nonIterableRest$c() {
|
|
16672
16783
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
16673
16784
|
}
|
|
16674
|
-
function _unsupportedIterableToArray$
|
|
16785
|
+
function _unsupportedIterableToArray$j(o, minLen) {
|
|
16675
16786
|
if (!o) return;
|
|
16676
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
16787
|
+
if (typeof o === "string") return _arrayLikeToArray$j(o, minLen);
|
|
16677
16788
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
16678
16789
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
16679
16790
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
16680
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
16791
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$j(o, minLen);
|
|
16681
16792
|
}
|
|
16682
|
-
function _arrayLikeToArray$
|
|
16793
|
+
function _arrayLikeToArray$j(arr, len) {
|
|
16683
16794
|
if (len == null || len > arr.length) len = arr.length;
|
|
16684
16795
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
16685
16796
|
return arr2;
|
|
16686
16797
|
}
|
|
16687
|
-
function _iterableToArrayLimit$
|
|
16798
|
+
function _iterableToArrayLimit$c(arr, i) {
|
|
16688
16799
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
16689
16800
|
if (null != _i) {
|
|
16690
16801
|
var _s,
|
|
@@ -16711,7 +16822,7 @@
|
|
|
16711
16822
|
return _arr;
|
|
16712
16823
|
}
|
|
16713
16824
|
}
|
|
16714
|
-
function _arrayWithHoles$
|
|
16825
|
+
function _arrayWithHoles$c(arr) {
|
|
16715
16826
|
if (Array.isArray(arr)) return arr;
|
|
16716
16827
|
}
|
|
16717
16828
|
var withUsage$g = createDocumentationMessageGenerator({
|
|
@@ -16778,10 +16889,10 @@
|
|
|
16778
16889
|
var currentRangeMin = currentRange.min,
|
|
16779
16890
|
currentRangeMax = currentRange.max;
|
|
16780
16891
|
var _ref3 = resolvedState.getNumericRefinement(attribute, '>=') || [],
|
|
16781
|
-
_ref4 = _slicedToArray$
|
|
16892
|
+
_ref4 = _slicedToArray$c(_ref3, 1),
|
|
16782
16893
|
min = _ref4[0];
|
|
16783
16894
|
var _ref5 = resolvedState.getNumericRefinement(attribute, '<=') || [],
|
|
16784
|
-
_ref6 = _slicedToArray$
|
|
16895
|
+
_ref6 = _slicedToArray$c(_ref5, 1),
|
|
16785
16896
|
max = _ref6[0];
|
|
16786
16897
|
var isResetMin = nextMin === undefined || nextMin === '';
|
|
16787
16898
|
var isResetMax = nextMax === undefined || nextMax === '';
|
|
@@ -16861,10 +16972,10 @@
|
|
|
16861
16972
|
}
|
|
16862
16973
|
function _getCurrentRefinement(helper) {
|
|
16863
16974
|
var _ref7 = helper.getNumericRefinement(attribute, '>=') || [],
|
|
16864
|
-
_ref8 = _slicedToArray$
|
|
16975
|
+
_ref8 = _slicedToArray$c(_ref7, 1),
|
|
16865
16976
|
minValue = _ref8[0];
|
|
16866
16977
|
var _ref9 = helper.getNumericRefinement(attribute, '<=') || [],
|
|
16867
|
-
_ref10 = _slicedToArray$
|
|
16978
|
+
_ref10 = _slicedToArray$c(_ref9, 1),
|
|
16868
16979
|
maxValue = _ref10[0];
|
|
16869
16980
|
var min = isFiniteNumber(minValue) ? minValue : -Infinity;
|
|
16870
16981
|
var max = isFiniteNumber(maxValue) ? maxValue : Infinity;
|
|
@@ -16873,7 +16984,7 @@
|
|
|
16873
16984
|
function _refine(helper, currentRange) {
|
|
16874
16985
|
return function () {
|
|
16875
16986
|
var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [undefined, undefined],
|
|
16876
|
-
_ref12 = _slicedToArray$
|
|
16987
|
+
_ref12 = _slicedToArray$c(_ref11, 2),
|
|
16877
16988
|
nextMin = _ref12[0],
|
|
16878
16989
|
nextMax = _ref12[1];
|
|
16879
16990
|
var refinedState = getRefinedState(helper, currentRange, nextMin, nextMax);
|
|
@@ -16972,7 +17083,7 @@
|
|
|
16972
17083
|
return widgetSearchParameters;
|
|
16973
17084
|
}
|
|
16974
17085
|
var _value$split$map = value.split(':').map(parseFloat),
|
|
16975
|
-
_value$split$map2 = _slicedToArray$
|
|
17086
|
+
_value$split$map2 = _slicedToArray$c(_value$split$map, 2),
|
|
16976
17087
|
lowerBound = _value$split$map2[0],
|
|
16977
17088
|
upperBound = _value$split$map2[1];
|
|
16978
17089
|
if (isFiniteNumber(lowerBound) && (!isFiniteNumber(minBound) || minBound < lowerBound)) {
|
|
@@ -17314,12 +17425,9 @@
|
|
|
17314
17425
|
getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
|
|
17315
17426
|
var searchParameters = _ref5.searchParameters;
|
|
17316
17427
|
var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
|
|
17317
|
-
|
|
17318
|
-
return uiState;
|
|
17319
|
-
}
|
|
17320
|
-
return _objectSpread$y(_objectSpread$y({}, uiState), {}, {
|
|
17428
|
+
return removeEmptyRefinementsFromUiState$4(_objectSpread$y(_objectSpread$y({}, uiState), {}, {
|
|
17321
17429
|
refinementList: _objectSpread$y(_objectSpread$y({}, uiState.refinementList), {}, _defineProperty$A({}, attribute, values))
|
|
17322
|
-
});
|
|
17430
|
+
}), attribute);
|
|
17323
17431
|
},
|
|
17324
17432
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
17325
17433
|
var uiState = _ref6.uiState;
|
|
@@ -17347,6 +17455,18 @@
|
|
|
17347
17455
|
};
|
|
17348
17456
|
};
|
|
17349
17457
|
};
|
|
17458
|
+
function removeEmptyRefinementsFromUiState$4(indexUiState, attribute) {
|
|
17459
|
+
if (!indexUiState.refinementList) {
|
|
17460
|
+
return indexUiState;
|
|
17461
|
+
}
|
|
17462
|
+
if (!indexUiState.refinementList[attribute] || indexUiState.refinementList[attribute].length === 0) {
|
|
17463
|
+
delete indexUiState.refinementList[attribute];
|
|
17464
|
+
}
|
|
17465
|
+
if (Object.keys(indexUiState.refinementList).length === 0) {
|
|
17466
|
+
delete indexUiState.refinementList;
|
|
17467
|
+
}
|
|
17468
|
+
return indexUiState;
|
|
17469
|
+
}
|
|
17350
17470
|
|
|
17351
17471
|
function useRefinementList(props, additionalWidgetProperties) {
|
|
17352
17472
|
return useConnector(connectRefinementList, props, additionalWidgetProperties);
|
|
@@ -17855,26 +17975,26 @@
|
|
|
17855
17975
|
}
|
|
17856
17976
|
return (hint === "string" ? String : Number)(input);
|
|
17857
17977
|
}
|
|
17858
|
-
function _slicedToArray$
|
|
17859
|
-
return _arrayWithHoles$
|
|
17978
|
+
function _slicedToArray$d(arr, i) {
|
|
17979
|
+
return _arrayWithHoles$d(arr) || _iterableToArrayLimit$d(arr, i) || _unsupportedIterableToArray$k(arr, i) || _nonIterableRest$d();
|
|
17860
17980
|
}
|
|
17861
|
-
function _nonIterableRest$
|
|
17981
|
+
function _nonIterableRest$d() {
|
|
17862
17982
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
17863
17983
|
}
|
|
17864
|
-
function _unsupportedIterableToArray$
|
|
17984
|
+
function _unsupportedIterableToArray$k(o, minLen) {
|
|
17865
17985
|
if (!o) return;
|
|
17866
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
17986
|
+
if (typeof o === "string") return _arrayLikeToArray$k(o, minLen);
|
|
17867
17987
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
17868
17988
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
17869
17989
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
17870
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
17990
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$k(o, minLen);
|
|
17871
17991
|
}
|
|
17872
|
-
function _arrayLikeToArray$
|
|
17992
|
+
function _arrayLikeToArray$k(arr, len) {
|
|
17873
17993
|
if (len == null || len > arr.length) len = arr.length;
|
|
17874
17994
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
17875
17995
|
return arr2;
|
|
17876
17996
|
}
|
|
17877
|
-
function _iterableToArrayLimit$
|
|
17997
|
+
function _iterableToArrayLimit$d(arr, i) {
|
|
17878
17998
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
17879
17999
|
if (null != _i) {
|
|
17880
18000
|
var _s,
|
|
@@ -17901,7 +18021,7 @@
|
|
|
17901
18021
|
return _arr;
|
|
17902
18022
|
}
|
|
17903
18023
|
}
|
|
17904
|
-
function _arrayWithHoles$
|
|
18024
|
+
function _arrayWithHoles$d(arr) {
|
|
17905
18025
|
if (Array.isArray(arr)) return arr;
|
|
17906
18026
|
}
|
|
17907
18027
|
var withUsage$l = createDocumentationMessageGenerator({
|
|
@@ -17926,7 +18046,7 @@
|
|
|
17926
18046
|
_args$ = args[2],
|
|
17927
18047
|
eventName = _args$ === void 0 ? 'Filter Applied' : _args$;
|
|
17928
18048
|
var _args$0$split = args[0].split(':'),
|
|
17929
|
-
_args$0$split2 = _slicedToArray$
|
|
18049
|
+
_args$0$split2 = _slicedToArray$d(_args$0$split, 2),
|
|
17930
18050
|
eventType = _args$0$split2[0],
|
|
17931
18051
|
eventModifier = _args$0$split2[1];
|
|
17932
18052
|
if (eventType !== 'click' || on === undefined) {
|
|
@@ -18203,26 +18323,26 @@
|
|
|
18203
18323
|
return useConnector(connectToggleRefinement, props, additionalWidgetProperties);
|
|
18204
18324
|
}
|
|
18205
18325
|
|
|
18206
|
-
function _slicedToArray$
|
|
18207
|
-
return _arrayWithHoles$
|
|
18326
|
+
function _slicedToArray$e(arr, i) {
|
|
18327
|
+
return _arrayWithHoles$e(arr) || _iterableToArrayLimit$e(arr, i) || _unsupportedIterableToArray$l(arr, i) || _nonIterableRest$e();
|
|
18208
18328
|
}
|
|
18209
|
-
function _nonIterableRest$
|
|
18329
|
+
function _nonIterableRest$e() {
|
|
18210
18330
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
18211
18331
|
}
|
|
18212
|
-
function _unsupportedIterableToArray$
|
|
18332
|
+
function _unsupportedIterableToArray$l(o, minLen) {
|
|
18213
18333
|
if (!o) return;
|
|
18214
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
18334
|
+
if (typeof o === "string") return _arrayLikeToArray$l(o, minLen);
|
|
18215
18335
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
18216
18336
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
18217
18337
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
18218
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
18338
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$l(o, minLen);
|
|
18219
18339
|
}
|
|
18220
|
-
function _arrayLikeToArray$
|
|
18340
|
+
function _arrayLikeToArray$l(arr, len) {
|
|
18221
18341
|
if (len == null || len > arr.length) len = arr.length;
|
|
18222
18342
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
18223
18343
|
return arr2;
|
|
18224
18344
|
}
|
|
18225
|
-
function _iterableToArrayLimit$
|
|
18345
|
+
function _iterableToArrayLimit$e(arr, i) {
|
|
18226
18346
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
18227
18347
|
if (null != _i) {
|
|
18228
18348
|
var _s,
|
|
@@ -18249,7 +18369,7 @@
|
|
|
18249
18369
|
return _arr;
|
|
18250
18370
|
}
|
|
18251
18371
|
}
|
|
18252
|
-
function _arrayWithHoles$
|
|
18372
|
+
function _arrayWithHoles$e(arr) {
|
|
18253
18373
|
if (Array.isArray(arr)) return arr;
|
|
18254
18374
|
}
|
|
18255
18375
|
function useSearchResults() {
|
|
@@ -18258,7 +18378,7 @@
|
|
|
18258
18378
|
var _useState = React.useState(function () {
|
|
18259
18379
|
return getIndexSearchResults(searchIndex);
|
|
18260
18380
|
}),
|
|
18261
|
-
_useState2 = _slicedToArray$
|
|
18381
|
+
_useState2 = _slicedToArray$e(_useState, 2),
|
|
18262
18382
|
searchResults = _useState2[0],
|
|
18263
18383
|
setSearchResults = _useState2[1];
|
|
18264
18384
|
React.useEffect(function () {
|
|
@@ -18283,26 +18403,26 @@
|
|
|
18283
18403
|
return searchResults;
|
|
18284
18404
|
}
|
|
18285
18405
|
|
|
18286
|
-
function _slicedToArray$
|
|
18287
|
-
return _arrayWithHoles$
|
|
18406
|
+
function _slicedToArray$f(arr, i) {
|
|
18407
|
+
return _arrayWithHoles$f(arr) || _iterableToArrayLimit$f(arr, i) || _unsupportedIterableToArray$m(arr, i) || _nonIterableRest$f();
|
|
18288
18408
|
}
|
|
18289
|
-
function _nonIterableRest$
|
|
18409
|
+
function _nonIterableRest$f() {
|
|
18290
18410
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
18291
18411
|
}
|
|
18292
|
-
function _unsupportedIterableToArray$
|
|
18412
|
+
function _unsupportedIterableToArray$m(o, minLen) {
|
|
18293
18413
|
if (!o) return;
|
|
18294
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
18414
|
+
if (typeof o === "string") return _arrayLikeToArray$m(o, minLen);
|
|
18295
18415
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
18296
18416
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
18297
18417
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
18298
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
18418
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$m(o, minLen);
|
|
18299
18419
|
}
|
|
18300
|
-
function _arrayLikeToArray$
|
|
18420
|
+
function _arrayLikeToArray$m(arr, len) {
|
|
18301
18421
|
if (len == null || len > arr.length) len = arr.length;
|
|
18302
18422
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
18303
18423
|
return arr2;
|
|
18304
18424
|
}
|
|
18305
|
-
function _iterableToArrayLimit$
|
|
18425
|
+
function _iterableToArrayLimit$f(arr, i) {
|
|
18306
18426
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
18307
18427
|
if (null != _i) {
|
|
18308
18428
|
var _s,
|
|
@@ -18329,7 +18449,7 @@
|
|
|
18329
18449
|
return _arr;
|
|
18330
18450
|
}
|
|
18331
18451
|
}
|
|
18332
|
-
function _arrayWithHoles$
|
|
18452
|
+
function _arrayWithHoles$f(arr) {
|
|
18333
18453
|
if (Array.isArray(arr)) return arr;
|
|
18334
18454
|
}
|
|
18335
18455
|
function useSearchState() {
|
|
@@ -18339,14 +18459,14 @@
|
|
|
18339
18459
|
var _useState = React.useState(function () {
|
|
18340
18460
|
return search.getUiState();
|
|
18341
18461
|
}),
|
|
18342
|
-
_useState2 = _slicedToArray$
|
|
18462
|
+
_useState2 = _slicedToArray$f(_useState, 2),
|
|
18343
18463
|
uiState = _useState2[0],
|
|
18344
18464
|
setLocalUiState = _useState2[1];
|
|
18345
18465
|
var indexUiState = uiState[indexId];
|
|
18346
18466
|
var _useState3 = React.useState(function () {
|
|
18347
18467
|
return search.renderState;
|
|
18348
18468
|
}),
|
|
18349
|
-
_useState4 = _slicedToArray$
|
|
18469
|
+
_useState4 = _slicedToArray$f(_useState3, 2),
|
|
18350
18470
|
renderState = _useState4[0],
|
|
18351
18471
|
setRenderState = _useState4[1];
|
|
18352
18472
|
var indexRenderState = renderState[indexId] || {};
|
|
@@ -18648,7 +18768,7 @@
|
|
|
18648
18768
|
});
|
|
18649
18769
|
}
|
|
18650
18770
|
|
|
18651
|
-
function _iterableToArrayLimit$
|
|
18771
|
+
function _iterableToArrayLimit$g(arr, i) {
|
|
18652
18772
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
18653
18773
|
if (null != _i) {
|
|
18654
18774
|
var _s,
|
|
@@ -18751,26 +18871,26 @@
|
|
|
18751
18871
|
}
|
|
18752
18872
|
return target;
|
|
18753
18873
|
}
|
|
18754
|
-
function _slicedToArray$
|
|
18755
|
-
return _arrayWithHoles$
|
|
18874
|
+
function _slicedToArray$g(arr, i) {
|
|
18875
|
+
return _arrayWithHoles$g(arr) || _iterableToArrayLimit$g(arr, i) || _unsupportedIterableToArray$n(arr, i) || _nonIterableRest$g();
|
|
18756
18876
|
}
|
|
18757
|
-
function _arrayWithHoles$
|
|
18877
|
+
function _arrayWithHoles$g(arr) {
|
|
18758
18878
|
if (Array.isArray(arr)) return arr;
|
|
18759
18879
|
}
|
|
18760
|
-
function _unsupportedIterableToArray$
|
|
18880
|
+
function _unsupportedIterableToArray$n(o, minLen) {
|
|
18761
18881
|
if (!o) return;
|
|
18762
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
18882
|
+
if (typeof o === "string") return _arrayLikeToArray$n(o, minLen);
|
|
18763
18883
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
18764
18884
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
18765
18885
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
18766
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$
|
|
18886
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$n(o, minLen);
|
|
18767
18887
|
}
|
|
18768
|
-
function _arrayLikeToArray$
|
|
18888
|
+
function _arrayLikeToArray$n(arr, len) {
|
|
18769
18889
|
if (len == null || len > arr.length) len = arr.length;
|
|
18770
18890
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
18771
18891
|
return arr2;
|
|
18772
18892
|
}
|
|
18773
|
-
function _nonIterableRest$
|
|
18893
|
+
function _nonIterableRest$g() {
|
|
18774
18894
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
18775
18895
|
}
|
|
18776
18896
|
function _toPrimitive$G(input, hint) {
|
|
@@ -19715,7 +19835,7 @@
|
|
|
19715
19835
|
_ref$range = _ref.range,
|
|
19716
19836
|
min = _ref$range.min,
|
|
19717
19837
|
max = _ref$range.max,
|
|
19718
|
-
_ref$start = _slicedToArray$
|
|
19838
|
+
_ref$start = _slicedToArray$g(_ref.start, 2),
|
|
19719
19839
|
minValue = _ref$start[0],
|
|
19720
19840
|
maxValue = _ref$start[1],
|
|
19721
19841
|
_ref$step = _ref.step,
|
|
@@ -19729,14 +19849,14 @@
|
|
|
19729
19849
|
max: maxValue !== Infinity && maxValue !== max ? maxValue : unsetNumberInputValue
|
|
19730
19850
|
};
|
|
19731
19851
|
var _useState = React.useState(values),
|
|
19732
|
-
_useState2 = _slicedToArray$
|
|
19852
|
+
_useState2 = _slicedToArray$g(_useState, 2),
|
|
19733
19853
|
prevValues = _useState2[0],
|
|
19734
19854
|
setPrevValues = _useState2[1];
|
|
19735
19855
|
var _useState3 = React.useState({
|
|
19736
19856
|
from: (_values$min = values.min) === null || _values$min === void 0 ? void 0 : _values$min.toString(),
|
|
19737
19857
|
to: (_values$max = values.max) === null || _values$max === void 0 ? void 0 : _values$max.toString()
|
|
19738
19858
|
}),
|
|
19739
|
-
_useState4 = _slicedToArray$
|
|
19859
|
+
_useState4 = _slicedToArray$g(_useState3, 2),
|
|
19740
19860
|
_useState4$ = _useState4[0],
|
|
19741
19861
|
from = _useState4$.from,
|
|
19742
19862
|
to = _useState4$.to,
|
|
@@ -19944,6 +20064,7 @@
|
|
|
19944
20064
|
function DefaultLoadingIcon(_ref5) {
|
|
19945
20065
|
var classNames = _ref5.classNames;
|
|
19946
20066
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
20067
|
+
"aria-label": "Results are loading",
|
|
19947
20068
|
width: "16",
|
|
19948
20069
|
height: "16",
|
|
19949
20070
|
viewBox: "0 0 38 38",
|
|
@@ -19959,7 +20080,8 @@
|
|
|
19959
20080
|
onChange = _ref7.onChange,
|
|
19960
20081
|
onReset = _ref7.onReset,
|
|
19961
20082
|
onSubmit = _ref7.onSubmit,
|
|
19962
|
-
placeholder = _ref7.placeholder,
|
|
20083
|
+
_ref7$placeholder = _ref7.placeholder,
|
|
20084
|
+
placeholder = _ref7$placeholder === void 0 ? '' : _ref7$placeholder,
|
|
19963
20085
|
value = _ref7.value,
|
|
19964
20086
|
autoFocus = _ref7.autoFocus,
|
|
19965
20087
|
_ref7$resetIconCompon = _ref7.resetIconComponent,
|
|
@@ -19998,10 +20120,12 @@
|
|
|
19998
20120
|
className: cx('ais-SearchBox-form', classNames.form),
|
|
19999
20121
|
noValidate: true,
|
|
20000
20122
|
onSubmit: handleSubmit,
|
|
20001
|
-
onReset: handleReset
|
|
20123
|
+
onReset: handleReset,
|
|
20124
|
+
role: "search"
|
|
20002
20125
|
}, /*#__PURE__*/React__default.createElement("input", {
|
|
20003
20126
|
ref: inputRef,
|
|
20004
20127
|
className: cx('ais-SearchBox-input', classNames.input),
|
|
20128
|
+
"aria-label": "Search",
|
|
20005
20129
|
autoComplete: "off",
|
|
20006
20130
|
autoCorrect: "off",
|
|
20007
20131
|
autoCapitalize: "off",
|
|
@@ -20070,7 +20194,7 @@
|
|
|
20070
20194
|
searchForItems = _useRefinementList.searchForItems,
|
|
20071
20195
|
toggleShowMore = _useRefinementList.toggleShowMore;
|
|
20072
20196
|
var _useState = React.useState(''),
|
|
20073
|
-
_useState2 = _slicedToArray$
|
|
20197
|
+
_useState2 = _slicedToArray$g(_useState, 2),
|
|
20074
20198
|
inputValue = _useState2[0],
|
|
20075
20199
|
setInputValue = _useState2[1];
|
|
20076
20200
|
var inputRef = React.useRef(null);
|
|
@@ -20149,7 +20273,7 @@
|
|
|
20149
20273
|
refine = _useSearchBox.refine,
|
|
20150
20274
|
isSearchStalled = _useSearchBox.isSearchStalled;
|
|
20151
20275
|
var _useState = React.useState(query),
|
|
20152
|
-
_useState2 = _slicedToArray$
|
|
20276
|
+
_useState2 = _slicedToArray$g(_useState, 2),
|
|
20153
20277
|
inputValue = _useState2[0],
|
|
20154
20278
|
setInputValue = _useState2[1];
|
|
20155
20279
|
var inputRef = React.useRef(null);
|
|
@@ -20251,7 +20375,8 @@
|
|
|
20251
20375
|
onChange: function onChange(event) {
|
|
20252
20376
|
return _onChange(event.target.value);
|
|
20253
20377
|
},
|
|
20254
|
-
value: value
|
|
20378
|
+
value: value,
|
|
20379
|
+
"aria-label": "Sort results by"
|
|
20255
20380
|
}, items.map(function (item) {
|
|
20256
20381
|
return /*#__PURE__*/React__default.createElement("option", {
|
|
20257
20382
|
className: cx('ais-SortBy-option', classNames.option),
|
|
@@ -20324,12 +20449,40 @@
|
|
|
20324
20449
|
areHitsSorted: areHitsSorted,
|
|
20325
20450
|
translations: _objectSpread2({
|
|
20326
20451
|
rootElementText: function rootElementText(options) {
|
|
20327
|
-
return
|
|
20452
|
+
return "".concat(options.areHitsSorted ? getSortedResultsSentence(options) : getResultsSentence(options), " found in ").concat(options.processingTimeMS.toLocaleString(), "ms");
|
|
20328
20453
|
}
|
|
20329
20454
|
}, translations)
|
|
20330
20455
|
};
|
|
20331
20456
|
return /*#__PURE__*/React__default.createElement(Stats, _extends$1({}, props, uiProps));
|
|
20332
20457
|
}
|
|
20458
|
+
function getSortedResultsSentence(_ref2) {
|
|
20459
|
+
var nbHits = _ref2.nbHits,
|
|
20460
|
+
nbSortedHits = _ref2.nbSortedHits;
|
|
20461
|
+
var suffix = "sorted out of ".concat(nbHits.toLocaleString());
|
|
20462
|
+
if (nbSortedHits === 0) {
|
|
20463
|
+
return "No relevant results ".concat(suffix);
|
|
20464
|
+
}
|
|
20465
|
+
if (nbSortedHits === 1) {
|
|
20466
|
+
return "1 relevant result ".concat(suffix);
|
|
20467
|
+
}
|
|
20468
|
+
if (nbSortedHits > 1) {
|
|
20469
|
+
return "".concat((nbSortedHits || 0).toLocaleString(), " relevant results ").concat(suffix);
|
|
20470
|
+
}
|
|
20471
|
+
return '';
|
|
20472
|
+
}
|
|
20473
|
+
function getResultsSentence(_ref3) {
|
|
20474
|
+
var nbHits = _ref3.nbHits;
|
|
20475
|
+
if (nbHits === 0) {
|
|
20476
|
+
return 'No results';
|
|
20477
|
+
}
|
|
20478
|
+
if (nbHits === 1) {
|
|
20479
|
+
return '1 result';
|
|
20480
|
+
}
|
|
20481
|
+
if (nbHits > 1) {
|
|
20482
|
+
return "".concat(nbHits.toLocaleString(), " results");
|
|
20483
|
+
}
|
|
20484
|
+
return '';
|
|
20485
|
+
}
|
|
20333
20486
|
|
|
20334
20487
|
var _excluded$L = ["classNames", "checked", "onChange", "label"];
|
|
20335
20488
|
function ToggleRefinement(_ref) {
|