react-instantsearch-core 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/version.js +1 -1
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +330 -210
- package/dist/umd/ReactInstantSearchCore.js.map +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js +1 -1
- package/dist/umd/ReactInstantSearchCore.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
|
/**
|
|
@@ -7294,6 +7314,55 @@
|
|
|
7294
7314
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
7295
7315
|
}, _typeof$6(obj);
|
|
7296
7316
|
}
|
|
7317
|
+
function _slicedToArray$3(arr, i) {
|
|
7318
|
+
return _arrayWithHoles$3(arr) || _iterableToArrayLimit$3(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$3();
|
|
7319
|
+
}
|
|
7320
|
+
function _nonIterableRest$3() {
|
|
7321
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7322
|
+
}
|
|
7323
|
+
function _unsupportedIterableToArray$3(o, minLen) {
|
|
7324
|
+
if (!o) return;
|
|
7325
|
+
if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
|
|
7326
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7327
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7328
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
7329
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
|
|
7330
|
+
}
|
|
7331
|
+
function _arrayLikeToArray$3(arr, len) {
|
|
7332
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7333
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
7334
|
+
return arr2;
|
|
7335
|
+
}
|
|
7336
|
+
function _iterableToArrayLimit$3(arr, i) {
|
|
7337
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
7338
|
+
if (null != _i) {
|
|
7339
|
+
var _s,
|
|
7340
|
+
_e,
|
|
7341
|
+
_x,
|
|
7342
|
+
_r,
|
|
7343
|
+
_arr = [],
|
|
7344
|
+
_n = !0,
|
|
7345
|
+
_d = !1;
|
|
7346
|
+
try {
|
|
7347
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
7348
|
+
if (Object(_i) !== _i) return;
|
|
7349
|
+
_n = !1;
|
|
7350
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
7351
|
+
} catch (err) {
|
|
7352
|
+
_d = !0, _e = err;
|
|
7353
|
+
} finally {
|
|
7354
|
+
try {
|
|
7355
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
7356
|
+
} finally {
|
|
7357
|
+
if (_d) throw _e;
|
|
7358
|
+
}
|
|
7359
|
+
}
|
|
7360
|
+
return _arr;
|
|
7361
|
+
}
|
|
7362
|
+
}
|
|
7363
|
+
function _arrayWithHoles$3(arr) {
|
|
7364
|
+
if (Array.isArray(arr)) return arr;
|
|
7365
|
+
}
|
|
7297
7366
|
function ownKeys$5(object, enumerableOnly) {
|
|
7298
7367
|
var keys = Object.keys(object);
|
|
7299
7368
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -7343,8 +7412,6 @@
|
|
|
7343
7412
|
}
|
|
7344
7413
|
return (hint === "string" ? String : Number)(input);
|
|
7345
7414
|
}
|
|
7346
|
-
// @ts-nocheck (types to be fixed during actual implementation)
|
|
7347
|
-
|
|
7348
7415
|
function hydrateSearchClient(client, results) {
|
|
7349
7416
|
if (!results) {
|
|
7350
7417
|
return;
|
|
@@ -7354,9 +7421,22 @@
|
|
|
7354
7421
|
// - Algoliasearch API Client < v4 with cache disabled
|
|
7355
7422
|
// - Third party clients (detected by the `addAlgoliaAgent` function missing)
|
|
7356
7423
|
|
|
7357
|
-
if ((!
|
|
7424
|
+
if ((!('transporter' in client) || client._cacheHydrated) && (!client._useCache || typeof client.addAlgoliaAgent !== 'function')) {
|
|
7358
7425
|
return;
|
|
7359
7426
|
}
|
|
7427
|
+
var cachedRequest = Object.keys(results).map(function (key) {
|
|
7428
|
+
return results[key].results.map(function (result) {
|
|
7429
|
+
return {
|
|
7430
|
+
indexName: result.index,
|
|
7431
|
+
// We normalize the params received from the server as they can
|
|
7432
|
+
// be serialized differently depending on the engine.
|
|
7433
|
+
params: serializeQueryParameters(deserializeQueryParameters(result.params))
|
|
7434
|
+
};
|
|
7435
|
+
});
|
|
7436
|
+
});
|
|
7437
|
+
var cachedResults = Object.keys(results).reduce(function (acc, key) {
|
|
7438
|
+
return acc.concat(results[key].results);
|
|
7439
|
+
}, []);
|
|
7360
7440
|
|
|
7361
7441
|
// Algoliasearch API Client >= v4
|
|
7362
7442
|
// To hydrate the client we need to populate the cache with the data from
|
|
@@ -7365,9 +7445,10 @@
|
|
|
7365
7445
|
// for us to compute the key the same way as `algoliasearch-client` we need
|
|
7366
7446
|
// to populate it on a custom key and override the `search` method to
|
|
7367
7447
|
// search on it first.
|
|
7368
|
-
if (
|
|
7448
|
+
if ('transporter' in client && !client._cacheHydrated) {
|
|
7369
7449
|
client._cacheHydrated = true;
|
|
7370
7450
|
var baseMethod = client.search;
|
|
7451
|
+
// @ts-ignore wanting type checks for v3 on this would make this too complex
|
|
7371
7452
|
client.search = function (requests) {
|
|
7372
7453
|
for (var _len = arguments.length, methodArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
7373
7454
|
methodArgs[_key - 1] = arguments[_key];
|
|
@@ -7384,22 +7465,11 @@
|
|
|
7384
7465
|
return baseMethod.apply(void 0, [requests].concat(methodArgs));
|
|
7385
7466
|
});
|
|
7386
7467
|
};
|
|
7387
|
-
|
|
7388
|
-
// Populate the cache with the data from the server
|
|
7389
7468
|
client.transporter.responsesCache.set({
|
|
7390
7469
|
method: 'search',
|
|
7391
|
-
args:
|
|
7392
|
-
return acc.concat(results[key].results.map(function (request) {
|
|
7393
|
-
return {
|
|
7394
|
-
indexName: request.index,
|
|
7395
|
-
params: request.params
|
|
7396
|
-
};
|
|
7397
|
-
}));
|
|
7398
|
-
}, [])]
|
|
7470
|
+
args: cachedRequest
|
|
7399
7471
|
}, {
|
|
7400
|
-
results:
|
|
7401
|
-
return acc.concat(results[key].results);
|
|
7402
|
-
}, [])
|
|
7472
|
+
results: cachedResults
|
|
7403
7473
|
});
|
|
7404
7474
|
}
|
|
7405
7475
|
|
|
@@ -7409,24 +7479,27 @@
|
|
|
7409
7479
|
// a single-index result. You can find more information about the
|
|
7410
7480
|
// computation of the key inside the client (see link below).
|
|
7411
7481
|
// https://github.com/algolia/algoliasearch-client-javascript/blob/c27e89ff92b2a854ae6f40dc524bffe0f0cbc169/src/AlgoliaSearchCore.js#L232-L240
|
|
7412
|
-
if (!client
|
|
7482
|
+
if (!('transporter' in client)) {
|
|
7413
7483
|
var cacheKey = "/1/indexes/*/queries_body_".concat(JSON.stringify({
|
|
7414
|
-
requests:
|
|
7415
|
-
return acc.concat(results[key].rawResults.map(function (request) {
|
|
7416
|
-
return {
|
|
7417
|
-
indexName: request.index,
|
|
7418
|
-
params: request.params
|
|
7419
|
-
};
|
|
7420
|
-
}));
|
|
7421
|
-
}, [])
|
|
7484
|
+
requests: cachedRequest
|
|
7422
7485
|
}));
|
|
7423
7486
|
client.cache = _objectSpread$5(_objectSpread$5({}, client.cache), {}, _defineProperty$5({}, cacheKey, JSON.stringify({
|
|
7424
|
-
results: Object.keys(results).
|
|
7425
|
-
return
|
|
7426
|
-
}
|
|
7487
|
+
results: Object.keys(results).map(function (key) {
|
|
7488
|
+
return results[key].results;
|
|
7489
|
+
})
|
|
7427
7490
|
})));
|
|
7428
7491
|
}
|
|
7429
7492
|
}
|
|
7493
|
+
function deserializeQueryParameters(parameters) {
|
|
7494
|
+
return parameters.split('&').reduce(function (acc, parameter) {
|
|
7495
|
+
var _parameter$split = parameter.split('='),
|
|
7496
|
+
_parameter$split2 = _slicedToArray$3(_parameter$split, 2),
|
|
7497
|
+
key = _parameter$split2[0],
|
|
7498
|
+
value = _parameter$split2[1];
|
|
7499
|
+
acc[key] = value ? decodeURIComponent(value) : '';
|
|
7500
|
+
return acc;
|
|
7501
|
+
}, {});
|
|
7502
|
+
}
|
|
7430
7503
|
|
|
7431
7504
|
// This function is copied from the algoliasearch v4 API Client. If modified,
|
|
7432
7505
|
// consider updating it also in `serializeQueryParameters` from `@algolia/transporter`.
|
|
@@ -7690,26 +7763,26 @@
|
|
|
7690
7763
|
};
|
|
7691
7764
|
|
|
7692
7765
|
function _toConsumableArray(arr) {
|
|
7693
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$
|
|
7766
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$4(arr) || _nonIterableSpread();
|
|
7694
7767
|
}
|
|
7695
7768
|
function _nonIterableSpread() {
|
|
7696
7769
|
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
7770
|
}
|
|
7698
|
-
function _unsupportedIterableToArray$
|
|
7771
|
+
function _unsupportedIterableToArray$4(o, minLen) {
|
|
7699
7772
|
if (!o) return;
|
|
7700
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
7773
|
+
if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
|
|
7701
7774
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7702
7775
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7703
7776
|
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$
|
|
7777
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
|
|
7705
7778
|
}
|
|
7706
7779
|
function _iterableToArray(iter) {
|
|
7707
7780
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7708
7781
|
}
|
|
7709
7782
|
function _arrayWithoutHoles(arr) {
|
|
7710
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
7783
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$4(arr);
|
|
7711
7784
|
}
|
|
7712
|
-
function _arrayLikeToArray$
|
|
7785
|
+
function _arrayLikeToArray$4(arr, len) {
|
|
7713
7786
|
if (len == null || len > arr.length) len = arr.length;
|
|
7714
7787
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
7715
7788
|
return arr2;
|
|
@@ -8035,7 +8108,7 @@
|
|
|
8035
8108
|
};
|
|
8036
8109
|
};
|
|
8037
8110
|
|
|
8038
|
-
function _iterableToArrayLimit$
|
|
8111
|
+
function _iterableToArrayLimit$4(arr, i) {
|
|
8039
8112
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
8040
8113
|
if (null != _i) {
|
|
8041
8114
|
var _s,
|
|
@@ -8133,26 +8206,26 @@
|
|
|
8133
8206
|
}
|
|
8134
8207
|
return target;
|
|
8135
8208
|
}
|
|
8136
|
-
function _slicedToArray$
|
|
8137
|
-
return _arrayWithHoles$
|
|
8209
|
+
function _slicedToArray$4(arr, i) {
|
|
8210
|
+
return _arrayWithHoles$4(arr) || _iterableToArrayLimit$4(arr, i) || _unsupportedIterableToArray$5(arr, i) || _nonIterableRest$4();
|
|
8138
8211
|
}
|
|
8139
|
-
function _arrayWithHoles$
|
|
8212
|
+
function _arrayWithHoles$4(arr) {
|
|
8140
8213
|
if (Array.isArray(arr)) return arr;
|
|
8141
8214
|
}
|
|
8142
|
-
function _unsupportedIterableToArray$
|
|
8215
|
+
function _unsupportedIterableToArray$5(o, minLen) {
|
|
8143
8216
|
if (!o) return;
|
|
8144
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
8217
|
+
if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
|
|
8145
8218
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8146
8219
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8147
8220
|
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$
|
|
8221
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
|
|
8149
8222
|
}
|
|
8150
|
-
function _arrayLikeToArray$
|
|
8223
|
+
function _arrayLikeToArray$5(arr, len) {
|
|
8151
8224
|
if (len == null || len > arr.length) len = arr.length;
|
|
8152
8225
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
8153
8226
|
return arr2;
|
|
8154
8227
|
}
|
|
8155
|
-
function _nonIterableRest$
|
|
8228
|
+
function _nonIterableRest$4() {
|
|
8156
8229
|
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
8230
|
}
|
|
8158
8231
|
function _toPrimitive$9(input, hint) {
|
|
@@ -8300,7 +8373,7 @@
|
|
|
8300
8373
|
var _useState = React.useState(function () {
|
|
8301
8374
|
return value;
|
|
8302
8375
|
}),
|
|
8303
|
-
_useState2 = _slicedToArray$
|
|
8376
|
+
_useState2 = _slicedToArray$4(_useState, 2),
|
|
8304
8377
|
stableValue = _useState2[0],
|
|
8305
8378
|
setStableValue = _useState2[1];
|
|
8306
8379
|
if (!dequal(stableValue, value)) {
|
|
@@ -8506,7 +8579,7 @@
|
|
|
8506
8579
|
}
|
|
8507
8580
|
return {};
|
|
8508
8581
|
}),
|
|
8509
|
-
_useState2 = _slicedToArray$
|
|
8582
|
+
_useState2 = _slicedToArray$4(_useState, 2),
|
|
8510
8583
|
state = _useState2[0],
|
|
8511
8584
|
setState = _useState2[1];
|
|
8512
8585
|
useWidget({
|
|
@@ -8612,8 +8685,8 @@
|
|
|
8612
8685
|
}))) {
|
|
8613
8686
|
throw new Error(withUsage$1('The `widgets` option expects an array of widgets.'));
|
|
8614
8687
|
}
|
|
8615
|
-
if (!
|
|
8616
|
-
throw new Error(withUsage$1("The `facets` option only accepts
|
|
8688
|
+
if (!Array.isArray(facets)) {
|
|
8689
|
+
throw new Error(withUsage$1("The `facets` option only accepts an array of facets, you passed ".concat(JSON.stringify(facets))));
|
|
8617
8690
|
}
|
|
8618
8691
|
var localWidgets = new Map();
|
|
8619
8692
|
return {
|
|
@@ -8691,7 +8764,6 @@
|
|
|
8691
8764
|
unmountFn();
|
|
8692
8765
|
},
|
|
8693
8766
|
getWidgetSearchParameters: function getWidgetSearchParameters(state) {
|
|
8694
|
-
// broadening the scope of facets to avoid conflict between never and *
|
|
8695
8767
|
return facets.reduce(function (acc, curr) {
|
|
8696
8768
|
return acc.addFacet(curr);
|
|
8697
8769
|
}, state.setQueryParameters({
|
|
@@ -8844,26 +8916,26 @@
|
|
|
8844
8916
|
return (hint === "string" ? String : Number)(input);
|
|
8845
8917
|
}
|
|
8846
8918
|
function _toConsumableArray$1(arr) {
|
|
8847
|
-
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$
|
|
8919
|
+
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread$1();
|
|
8848
8920
|
}
|
|
8849
8921
|
function _nonIterableSpread$1() {
|
|
8850
8922
|
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
8923
|
}
|
|
8852
|
-
function _unsupportedIterableToArray$
|
|
8924
|
+
function _unsupportedIterableToArray$6(o, minLen) {
|
|
8853
8925
|
if (!o) return;
|
|
8854
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
8926
|
+
if (typeof o === "string") return _arrayLikeToArray$6(o, minLen);
|
|
8855
8927
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8856
8928
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8857
8929
|
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$
|
|
8930
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
|
|
8859
8931
|
}
|
|
8860
8932
|
function _iterableToArray$1(iter) {
|
|
8861
8933
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8862
8934
|
}
|
|
8863
8935
|
function _arrayWithoutHoles$1(arr) {
|
|
8864
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
8936
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$6(arr);
|
|
8865
8937
|
}
|
|
8866
|
-
function _arrayLikeToArray$
|
|
8938
|
+
function _arrayLikeToArray$6(arr, len) {
|
|
8867
8939
|
if (len == null || len > arr.length) len = arr.length;
|
|
8868
8940
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
8869
8941
|
return arr2;
|
|
@@ -9373,7 +9445,7 @@
|
|
|
9373
9445
|
var _useReducer = React.useReducer(function (x) {
|
|
9374
9446
|
return x + 1;
|
|
9375
9447
|
}, 0),
|
|
9376
|
-
_useReducer2 = _slicedToArray$
|
|
9448
|
+
_useReducer2 = _slicedToArray$4(_useReducer, 2),
|
|
9377
9449
|
forceUpdate = _useReducer2[1];
|
|
9378
9450
|
return forceUpdate;
|
|
9379
9451
|
}
|
|
@@ -9655,13 +9727,13 @@
|
|
|
9655
9727
|
}
|
|
9656
9728
|
return (hint === "string" ? String : Number)(input);
|
|
9657
9729
|
}
|
|
9658
|
-
function _slicedToArray$
|
|
9659
|
-
return _arrayWithHoles$
|
|
9730
|
+
function _slicedToArray$5(arr, i) {
|
|
9731
|
+
return _arrayWithHoles$5(arr) || _iterableToArrayLimit$5(arr, i) || _unsupportedIterableToArray$7(arr, i) || _nonIterableRest$5();
|
|
9660
9732
|
}
|
|
9661
|
-
function _nonIterableRest$
|
|
9733
|
+
function _nonIterableRest$5() {
|
|
9662
9734
|
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
9735
|
}
|
|
9664
|
-
function _iterableToArrayLimit$
|
|
9736
|
+
function _iterableToArrayLimit$5(arr, i) {
|
|
9665
9737
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
9666
9738
|
if (null != _i) {
|
|
9667
9739
|
var _s,
|
|
@@ -9688,30 +9760,30 @@
|
|
|
9688
9760
|
return _arr;
|
|
9689
9761
|
}
|
|
9690
9762
|
}
|
|
9691
|
-
function _arrayWithHoles$
|
|
9763
|
+
function _arrayWithHoles$5(arr) {
|
|
9692
9764
|
if (Array.isArray(arr)) return arr;
|
|
9693
9765
|
}
|
|
9694
9766
|
function _toConsumableArray$2(arr) {
|
|
9695
|
-
return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$
|
|
9767
|
+
return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread$2();
|
|
9696
9768
|
}
|
|
9697
9769
|
function _nonIterableSpread$2() {
|
|
9698
9770
|
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
9771
|
}
|
|
9700
|
-
function _unsupportedIterableToArray$
|
|
9772
|
+
function _unsupportedIterableToArray$7(o, minLen) {
|
|
9701
9773
|
if (!o) return;
|
|
9702
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
9774
|
+
if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
|
|
9703
9775
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9704
9776
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9705
9777
|
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$
|
|
9778
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
|
|
9707
9779
|
}
|
|
9708
9780
|
function _iterableToArray$2(iter) {
|
|
9709
9781
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9710
9782
|
}
|
|
9711
9783
|
function _arrayWithoutHoles$2(arr) {
|
|
9712
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
9784
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$7(arr);
|
|
9713
9785
|
}
|
|
9714
|
-
function _arrayLikeToArray$
|
|
9786
|
+
function _arrayLikeToArray$7(arr, len) {
|
|
9715
9787
|
if (len == null || len > arr.length) len = arr.length;
|
|
9716
9788
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
9717
9789
|
return arr2;
|
|
@@ -9767,7 +9839,7 @@
|
|
|
9767
9839
|
});
|
|
9768
9840
|
instantSearchInstance.unuse.apply(instantSearchInstance, _toConsumableArray$2(existingInsightsMiddlewares));
|
|
9769
9841
|
var _getAppIdAndApiKey = getAppIdAndApiKey(instantSearchInstance.client),
|
|
9770
|
-
_getAppIdAndApiKey2 = _slicedToArray$
|
|
9842
|
+
_getAppIdAndApiKey2 = _slicedToArray$5(_getAppIdAndApiKey, 2),
|
|
9771
9843
|
appId = _getAppIdAndApiKey2[0],
|
|
9772
9844
|
apiKey = _getAppIdAndApiKey2[1];
|
|
9773
9845
|
var queuedUserToken = undefined;
|
|
@@ -9784,11 +9856,11 @@
|
|
|
9784
9856
|
// we still want to read the token from the queue.
|
|
9785
9857
|
// Otherwise, the first search call will be fired without the token.
|
|
9786
9858
|
var _ref3 = find$1(insightsClient.queue.slice().reverse(), function (_ref5) {
|
|
9787
|
-
var _ref6 = _slicedToArray$
|
|
9859
|
+
var _ref6 = _slicedToArray$5(_ref5, 1),
|
|
9788
9860
|
method = _ref6[0];
|
|
9789
9861
|
return method === 'setUserToken';
|
|
9790
9862
|
}) || [];
|
|
9791
|
-
var _ref4 = _slicedToArray$
|
|
9863
|
+
var _ref4 = _slicedToArray$5(_ref3, 2);
|
|
9792
9864
|
queuedUserToken = _ref4[1];
|
|
9793
9865
|
}
|
|
9794
9866
|
insightsClient('getUserToken', null, function (_error, userToken) {
|
|
@@ -9942,7 +10014,7 @@
|
|
|
9942
10014
|
*/
|
|
9943
10015
|
function isModernInsightsClient(client) {
|
|
9944
10016
|
var _split$map = (client.version || '').split('.').map(Number),
|
|
9945
|
-
_split$map2 = _slicedToArray$
|
|
10017
|
+
_split$map2 = _slicedToArray$5(_split$map, 2),
|
|
9946
10018
|
major = _split$map2[0],
|
|
9947
10019
|
minor = _split$map2[1];
|
|
9948
10020
|
|
|
@@ -11570,7 +11642,7 @@
|
|
|
11570
11642
|
};
|
|
11571
11643
|
}
|
|
11572
11644
|
|
|
11573
|
-
var version$2 = '4.
|
|
11645
|
+
var version$2 = '4.62.0';
|
|
11574
11646
|
|
|
11575
11647
|
function _typeof$k(obj) {
|
|
11576
11648
|
"@babel/helpers - typeof";
|
|
@@ -11734,7 +11806,8 @@
|
|
|
11734
11806
|
* Global options for an InstantSearch instance.
|
|
11735
11807
|
*/
|
|
11736
11808
|
var INSTANTSEARCH_FUTURE_DEFAULTS = {
|
|
11737
|
-
preserveSharedStateOnUnmount: false
|
|
11809
|
+
preserveSharedStateOnUnmount: false,
|
|
11810
|
+
persistHierarchicalRootCount: false
|
|
11738
11811
|
};
|
|
11739
11812
|
|
|
11740
11813
|
/**
|
|
@@ -12054,7 +12127,9 @@
|
|
|
12054
12127
|
// DerivedHelper scoped into the `index` widgets.
|
|
12055
12128
|
// In Vue InstantSearch' hydrate, a main helper gets set before start, so
|
|
12056
12129
|
// we need to respect this helper as a way to keep all listeners correct.
|
|
12057
|
-
var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName
|
|
12130
|
+
var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName, undefined, {
|
|
12131
|
+
persistHierarchicalRootCount: this.future.persistHierarchicalRootCount
|
|
12132
|
+
});
|
|
12058
12133
|
mainHelper.search = function () {
|
|
12059
12134
|
_this3.status = 'loading';
|
|
12060
12135
|
_this3.scheduleRender(false);
|
|
@@ -12588,26 +12663,26 @@
|
|
|
12588
12663
|
}
|
|
12589
12664
|
return (hint === "string" ? String : Number)(input);
|
|
12590
12665
|
}
|
|
12591
|
-
function _slicedToArray$
|
|
12592
|
-
return _arrayWithHoles$
|
|
12666
|
+
function _slicedToArray$6(arr, i) {
|
|
12667
|
+
return _arrayWithHoles$6(arr) || _iterableToArrayLimit$6(arr, i) || _unsupportedIterableToArray$8(arr, i) || _nonIterableRest$6();
|
|
12593
12668
|
}
|
|
12594
|
-
function _nonIterableRest$
|
|
12669
|
+
function _nonIterableRest$6() {
|
|
12595
12670
|
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
12671
|
}
|
|
12597
|
-
function _unsupportedIterableToArray$
|
|
12672
|
+
function _unsupportedIterableToArray$8(o, minLen) {
|
|
12598
12673
|
if (!o) return;
|
|
12599
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
12674
|
+
if (typeof o === "string") return _arrayLikeToArray$8(o, minLen);
|
|
12600
12675
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
12601
12676
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
12602
12677
|
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$
|
|
12678
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen);
|
|
12604
12679
|
}
|
|
12605
|
-
function _arrayLikeToArray$
|
|
12680
|
+
function _arrayLikeToArray$8(arr, len) {
|
|
12606
12681
|
if (len == null || len > arr.length) len = arr.length;
|
|
12607
12682
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
12608
12683
|
return arr2;
|
|
12609
12684
|
}
|
|
12610
|
-
function _iterableToArrayLimit$
|
|
12685
|
+
function _iterableToArrayLimit$6(arr, i) {
|
|
12611
12686
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
12612
12687
|
if (null != _i) {
|
|
12613
12688
|
var _s,
|
|
@@ -12634,7 +12709,7 @@
|
|
|
12634
12709
|
return _arr;
|
|
12635
12710
|
}
|
|
12636
12711
|
}
|
|
12637
|
-
function _arrayWithHoles$
|
|
12712
|
+
function _arrayWithHoles$6(arr) {
|
|
12638
12713
|
if (Array.isArray(arr)) return arr;
|
|
12639
12714
|
}
|
|
12640
12715
|
var withUsage$4 = createDocumentationMessageGenerator({
|
|
@@ -12659,7 +12734,7 @@
|
|
|
12659
12734
|
if (!attributes || !Array.isArray(attributes) || attributes.length === 0) {
|
|
12660
12735
|
throw new Error(withUsage$4('The `attributes` option expects an array of strings.'));
|
|
12661
12736
|
}
|
|
12662
|
-
var _attributes = _slicedToArray$
|
|
12737
|
+
var _attributes = _slicedToArray$6(attributes, 1),
|
|
12663
12738
|
hierarchicalFacetName = _attributes[0];
|
|
12664
12739
|
function getRefinedState(state, facetValue) {
|
|
12665
12740
|
if (!facetValue) {
|
|
@@ -12705,7 +12780,7 @@
|
|
|
12705
12780
|
if (!results || state.hierarchicalFacets.length === 0) {
|
|
12706
12781
|
return [];
|
|
12707
12782
|
}
|
|
12708
|
-
var _state$hierarchicalFa = _slicedToArray$
|
|
12783
|
+
var _state$hierarchicalFa = _slicedToArray$6(state.hierarchicalFacets, 1),
|
|
12709
12784
|
facetName = _state$hierarchicalFa[0].name;
|
|
12710
12785
|
var facetValues = results.getFacetValues(facetName, {});
|
|
12711
12786
|
var facetItems = facetValues && !Array.isArray(facetValues) && facetValues.data ? facetValues.data : [];
|
|
@@ -12741,12 +12816,9 @@
|
|
|
12741
12816
|
getWidgetUiState: function getWidgetUiState(uiState, _ref3) {
|
|
12742
12817
|
var searchParameters = _ref3.searchParameters;
|
|
12743
12818
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
12744
|
-
|
|
12745
|
-
return uiState;
|
|
12746
|
-
}
|
|
12747
|
-
return _objectSpread$g(_objectSpread$g({}, uiState), {}, {
|
|
12819
|
+
return removeEmptyRefinementsFromUiState(_objectSpread$g(_objectSpread$g({}, uiState), {}, {
|
|
12748
12820
|
hierarchicalMenu: _objectSpread$g(_objectSpread$g({}, uiState.hierarchicalMenu), {}, _defineProperty$i({}, hierarchicalFacetName, path))
|
|
12749
|
-
});
|
|
12821
|
+
}), hierarchicalFacetName);
|
|
12750
12822
|
},
|
|
12751
12823
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref4) {
|
|
12752
12824
|
var uiState = _ref4.uiState;
|
|
@@ -12795,6 +12867,18 @@
|
|
|
12795
12867
|
};
|
|
12796
12868
|
});
|
|
12797
12869
|
}
|
|
12870
|
+
function removeEmptyRefinementsFromUiState(indexUiState, attribute) {
|
|
12871
|
+
if (!indexUiState.hierarchicalMenu) {
|
|
12872
|
+
return indexUiState;
|
|
12873
|
+
}
|
|
12874
|
+
if (!indexUiState.hierarchicalMenu[attribute] || !indexUiState.hierarchicalMenu[attribute].length) {
|
|
12875
|
+
delete indexUiState.hierarchicalMenu[attribute];
|
|
12876
|
+
}
|
|
12877
|
+
if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
|
|
12878
|
+
delete indexUiState.hierarchicalMenu;
|
|
12879
|
+
}
|
|
12880
|
+
return indexUiState;
|
|
12881
|
+
}
|
|
12798
12882
|
|
|
12799
12883
|
function useBreadcrumb(props, additionalWidgetProperties) {
|
|
12800
12884
|
return useConnector(connectBreadcrumb, props, additionalWidgetProperties);
|
|
@@ -12810,26 +12894,26 @@
|
|
|
12810
12894
|
}, _typeof$m(obj);
|
|
12811
12895
|
}
|
|
12812
12896
|
function _toConsumableArray$3(arr) {
|
|
12813
|
-
return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$
|
|
12897
|
+
return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$9(arr) || _nonIterableSpread$3();
|
|
12814
12898
|
}
|
|
12815
12899
|
function _nonIterableSpread$3() {
|
|
12816
12900
|
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
12901
|
}
|
|
12818
|
-
function _unsupportedIterableToArray$
|
|
12902
|
+
function _unsupportedIterableToArray$9(o, minLen) {
|
|
12819
12903
|
if (!o) return;
|
|
12820
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
12904
|
+
if (typeof o === "string") return _arrayLikeToArray$9(o, minLen);
|
|
12821
12905
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
12822
12906
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
12823
12907
|
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$
|
|
12908
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$9(o, minLen);
|
|
12825
12909
|
}
|
|
12826
12910
|
function _iterableToArray$3(iter) {
|
|
12827
12911
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
12828
12912
|
}
|
|
12829
12913
|
function _arrayWithoutHoles$3(arr) {
|
|
12830
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
12914
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$9(arr);
|
|
12831
12915
|
}
|
|
12832
|
-
function _arrayLikeToArray$
|
|
12916
|
+
function _arrayLikeToArray$9(arr, len) {
|
|
12833
12917
|
if (len == null || len > arr.length) len = arr.length;
|
|
12834
12918
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
12835
12919
|
return arr2;
|
|
@@ -13030,26 +13114,26 @@
|
|
|
13030
13114
|
}, _typeof$n(obj);
|
|
13031
13115
|
}
|
|
13032
13116
|
function _toConsumableArray$4(arr) {
|
|
13033
|
-
return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$
|
|
13117
|
+
return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$a(arr) || _nonIterableSpread$4();
|
|
13034
13118
|
}
|
|
13035
13119
|
function _nonIterableSpread$4() {
|
|
13036
13120
|
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
13121
|
}
|
|
13038
|
-
function _unsupportedIterableToArray$
|
|
13122
|
+
function _unsupportedIterableToArray$a(o, minLen) {
|
|
13039
13123
|
if (!o) return;
|
|
13040
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
13124
|
+
if (typeof o === "string") return _arrayLikeToArray$a(o, minLen);
|
|
13041
13125
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
13042
13126
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
13043
13127
|
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$
|
|
13128
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$a(o, minLen);
|
|
13045
13129
|
}
|
|
13046
13130
|
function _iterableToArray$4(iter) {
|
|
13047
13131
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
13048
13132
|
}
|
|
13049
13133
|
function _arrayWithoutHoles$4(arr) {
|
|
13050
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
13134
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$a(arr);
|
|
13051
13135
|
}
|
|
13052
|
-
function _arrayLikeToArray$
|
|
13136
|
+
function _arrayLikeToArray$a(arr, len) {
|
|
13053
13137
|
if (len == null || len > arr.length) len = arr.length;
|
|
13054
13138
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
13055
13139
|
return arr2;
|
|
@@ -13635,26 +13719,26 @@
|
|
|
13635
13719
|
}
|
|
13636
13720
|
return target;
|
|
13637
13721
|
}
|
|
13638
|
-
function _slicedToArray$
|
|
13639
|
-
return _arrayWithHoles$
|
|
13722
|
+
function _slicedToArray$7(arr, i) {
|
|
13723
|
+
return _arrayWithHoles$7(arr) || _iterableToArrayLimit$7(arr, i) || _unsupportedIterableToArray$b(arr, i) || _nonIterableRest$7();
|
|
13640
13724
|
}
|
|
13641
|
-
function _nonIterableRest$
|
|
13725
|
+
function _nonIterableRest$7() {
|
|
13642
13726
|
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
13727
|
}
|
|
13644
|
-
function _unsupportedIterableToArray$
|
|
13728
|
+
function _unsupportedIterableToArray$b(o, minLen) {
|
|
13645
13729
|
if (!o) return;
|
|
13646
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
13730
|
+
if (typeof o === "string") return _arrayLikeToArray$b(o, minLen);
|
|
13647
13731
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
13648
13732
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
13649
13733
|
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$
|
|
13734
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$b(o, minLen);
|
|
13651
13735
|
}
|
|
13652
|
-
function _arrayLikeToArray$
|
|
13736
|
+
function _arrayLikeToArray$b(arr, len) {
|
|
13653
13737
|
if (len == null || len > arr.length) len = arr.length;
|
|
13654
13738
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
13655
13739
|
return arr2;
|
|
13656
13740
|
}
|
|
13657
|
-
function _iterableToArrayLimit$
|
|
13741
|
+
function _iterableToArrayLimit$7(arr, i) {
|
|
13658
13742
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
13659
13743
|
if (null != _i) {
|
|
13660
13744
|
var _s,
|
|
@@ -13681,7 +13765,7 @@
|
|
|
13681
13765
|
return _arr;
|
|
13682
13766
|
}
|
|
13683
13767
|
}
|
|
13684
|
-
function _arrayWithHoles$
|
|
13768
|
+
function _arrayWithHoles$7(arr) {
|
|
13685
13769
|
if (Array.isArray(arr)) return arr;
|
|
13686
13770
|
}
|
|
13687
13771
|
var withUsage$8 = createDocumentationMessageGenerator({
|
|
@@ -13735,7 +13819,7 @@
|
|
|
13735
13819
|
// we need to provide a hierarchicalFacet name for the search state
|
|
13736
13820
|
// so that we can always map $hierarchicalFacetName => real attributes
|
|
13737
13821
|
// we use the first attribute name
|
|
13738
|
-
var _attributes = _slicedToArray$
|
|
13822
|
+
var _attributes = _slicedToArray$7(attributes, 1),
|
|
13739
13823
|
hierarchicalFacetName = _attributes[0];
|
|
13740
13824
|
var sendEvent;
|
|
13741
13825
|
|
|
@@ -13869,12 +13953,9 @@
|
|
|
13869
13953
|
getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
|
|
13870
13954
|
var searchParameters = _ref5.searchParameters;
|
|
13871
13955
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
13872
|
-
|
|
13873
|
-
return uiState;
|
|
13874
|
-
}
|
|
13875
|
-
return _objectSpread$k(_objectSpread$k({}, uiState), {}, {
|
|
13956
|
+
return removeEmptyRefinementsFromUiState$1(_objectSpread$k(_objectSpread$k({}, uiState), {}, {
|
|
13876
13957
|
hierarchicalMenu: _objectSpread$k(_objectSpread$k({}, uiState.hierarchicalMenu), {}, _defineProperty$m({}, hierarchicalFacetName, path))
|
|
13877
|
-
});
|
|
13958
|
+
}), hierarchicalFacetName);
|
|
13878
13959
|
},
|
|
13879
13960
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
13880
13961
|
var uiState = _ref6.uiState;
|
|
@@ -13905,6 +13986,18 @@
|
|
|
13905
13986
|
};
|
|
13906
13987
|
};
|
|
13907
13988
|
};
|
|
13989
|
+
function removeEmptyRefinementsFromUiState$1(indexUiState, attribute) {
|
|
13990
|
+
if (!indexUiState.hierarchicalMenu) {
|
|
13991
|
+
return indexUiState;
|
|
13992
|
+
}
|
|
13993
|
+
if (!indexUiState.hierarchicalMenu[attribute] || indexUiState.hierarchicalMenu[attribute].length === 0) {
|
|
13994
|
+
delete indexUiState.hierarchicalMenu[attribute];
|
|
13995
|
+
}
|
|
13996
|
+
if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
|
|
13997
|
+
delete indexUiState.hierarchicalMenu;
|
|
13998
|
+
}
|
|
13999
|
+
return indexUiState;
|
|
14000
|
+
}
|
|
13908
14001
|
|
|
13909
14002
|
function useHierarchicalMenu(props, additionalWidgetProperties) {
|
|
13910
14003
|
return useConnector(connectHierarchicalMenu, props, additionalWidgetProperties);
|
|
@@ -14081,26 +14174,26 @@
|
|
|
14081
14174
|
}, _typeof$r(obj);
|
|
14082
14175
|
}
|
|
14083
14176
|
function _toConsumableArray$5(arr) {
|
|
14084
|
-
return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$
|
|
14177
|
+
return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$c(arr) || _nonIterableSpread$5();
|
|
14085
14178
|
}
|
|
14086
14179
|
function _nonIterableSpread$5() {
|
|
14087
14180
|
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
14181
|
}
|
|
14089
|
-
function _unsupportedIterableToArray$
|
|
14182
|
+
function _unsupportedIterableToArray$c(o, minLen) {
|
|
14090
14183
|
if (!o) return;
|
|
14091
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
14184
|
+
if (typeof o === "string") return _arrayLikeToArray$c(o, minLen);
|
|
14092
14185
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
14093
14186
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
14094
14187
|
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$
|
|
14188
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$c(o, minLen);
|
|
14096
14189
|
}
|
|
14097
14190
|
function _iterableToArray$5(iter) {
|
|
14098
14191
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
14099
14192
|
}
|
|
14100
14193
|
function _arrayWithoutHoles$5(arr) {
|
|
14101
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
14194
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$c(arr);
|
|
14102
14195
|
}
|
|
14103
|
-
function _arrayLikeToArray$
|
|
14196
|
+
function _arrayLikeToArray$c(arr, len) {
|
|
14104
14197
|
if (len == null || len > arr.length) len = arr.length;
|
|
14105
14198
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14106
14199
|
return arr2;
|
|
@@ -14354,26 +14447,26 @@
|
|
|
14354
14447
|
return (hint === "string" ? String : Number)(input);
|
|
14355
14448
|
}
|
|
14356
14449
|
function _toConsumableArray$6(arr) {
|
|
14357
|
-
return _arrayWithoutHoles$6(arr) || _iterableToArray$6(arr) || _unsupportedIterableToArray$
|
|
14450
|
+
return _arrayWithoutHoles$6(arr) || _iterableToArray$6(arr) || _unsupportedIterableToArray$d(arr) || _nonIterableSpread$6();
|
|
14358
14451
|
}
|
|
14359
14452
|
function _nonIterableSpread$6() {
|
|
14360
14453
|
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
14454
|
}
|
|
14362
|
-
function _unsupportedIterableToArray$
|
|
14455
|
+
function _unsupportedIterableToArray$d(o, minLen) {
|
|
14363
14456
|
if (!o) return;
|
|
14364
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
14457
|
+
if (typeof o === "string") return _arrayLikeToArray$d(o, minLen);
|
|
14365
14458
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
14366
14459
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
14367
14460
|
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$
|
|
14461
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$d(o, minLen);
|
|
14369
14462
|
}
|
|
14370
14463
|
function _iterableToArray$6(iter) {
|
|
14371
14464
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
14372
14465
|
}
|
|
14373
14466
|
function _arrayWithoutHoles$6(arr) {
|
|
14374
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
14467
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$d(arr);
|
|
14375
14468
|
}
|
|
14376
|
-
function _arrayLikeToArray$
|
|
14469
|
+
function _arrayLikeToArray$d(arr, len) {
|
|
14377
14470
|
if (len == null || len > arr.length) len = arr.length;
|
|
14378
14471
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14379
14472
|
return arr2;
|
|
@@ -14689,26 +14782,26 @@
|
|
|
14689
14782
|
}
|
|
14690
14783
|
return target;
|
|
14691
14784
|
}
|
|
14692
|
-
function _slicedToArray$
|
|
14693
|
-
return _arrayWithHoles$
|
|
14785
|
+
function _slicedToArray$8(arr, i) {
|
|
14786
|
+
return _arrayWithHoles$8(arr) || _iterableToArrayLimit$8(arr, i) || _unsupportedIterableToArray$e(arr, i) || _nonIterableRest$8();
|
|
14694
14787
|
}
|
|
14695
|
-
function _nonIterableRest$
|
|
14788
|
+
function _nonIterableRest$8() {
|
|
14696
14789
|
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
14790
|
}
|
|
14698
|
-
function _unsupportedIterableToArray$
|
|
14791
|
+
function _unsupportedIterableToArray$e(o, minLen) {
|
|
14699
14792
|
if (!o) return;
|
|
14700
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
14793
|
+
if (typeof o === "string") return _arrayLikeToArray$e(o, minLen);
|
|
14701
14794
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
14702
14795
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
14703
14796
|
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$
|
|
14797
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$e(o, minLen);
|
|
14705
14798
|
}
|
|
14706
|
-
function _arrayLikeToArray$
|
|
14799
|
+
function _arrayLikeToArray$e(arr, len) {
|
|
14707
14800
|
if (len == null || len > arr.length) len = arr.length;
|
|
14708
14801
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14709
14802
|
return arr2;
|
|
14710
14803
|
}
|
|
14711
|
-
function _iterableToArrayLimit$
|
|
14804
|
+
function _iterableToArrayLimit$8(arr, i) {
|
|
14712
14805
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
14713
14806
|
if (null != _i) {
|
|
14714
14807
|
var _s,
|
|
@@ -14735,7 +14828,7 @@
|
|
|
14735
14828
|
return _arr;
|
|
14736
14829
|
}
|
|
14737
14830
|
}
|
|
14738
|
-
function _arrayWithHoles$
|
|
14831
|
+
function _arrayWithHoles$8(arr) {
|
|
14739
14832
|
if (Array.isArray(arr)) return arr;
|
|
14740
14833
|
}
|
|
14741
14834
|
function ownKeys$p(object, enumerableOnly) {
|
|
@@ -14898,7 +14991,7 @@
|
|
|
14898
14991
|
if (!_refine) {
|
|
14899
14992
|
_refine = function _refine(facetValue) {
|
|
14900
14993
|
var _helper$getHierarchic = helper.getHierarchicalFacetBreadcrumb(attribute),
|
|
14901
|
-
_helper$getHierarchic2 = _slicedToArray$
|
|
14994
|
+
_helper$getHierarchic2 = _slicedToArray$8(_helper$getHierarchic, 1),
|
|
14902
14995
|
refinedItem = _helper$getHierarchic2[0];
|
|
14903
14996
|
sendEvent('click:internal', facetValue ? facetValue : refinedItem);
|
|
14904
14997
|
helper.toggleFacetRefinement(attribute, facetValue ? facetValue : refinedItem).search();
|
|
@@ -14942,14 +15035,11 @@
|
|
|
14942
15035
|
getWidgetUiState: function getWidgetUiState(uiState, _ref4) {
|
|
14943
15036
|
var searchParameters = _ref4.searchParameters;
|
|
14944
15037
|
var _searchParameters$get = searchParameters.getHierarchicalFacetBreadcrumb(attribute),
|
|
14945
|
-
_searchParameters$get2 = _slicedToArray$
|
|
15038
|
+
_searchParameters$get2 = _slicedToArray$8(_searchParameters$get, 1),
|
|
14946
15039
|
value = _searchParameters$get2[0];
|
|
14947
|
-
|
|
14948
|
-
return uiState;
|
|
14949
|
-
}
|
|
14950
|
-
return _objectSpread$o(_objectSpread$o({}, uiState), {}, {
|
|
15040
|
+
return removeEmptyRefinementsFromUiState$2(_objectSpread$o(_objectSpread$o({}, uiState), {}, {
|
|
14951
15041
|
menu: _objectSpread$o(_objectSpread$o({}, uiState.menu), {}, _defineProperty$q({}, attribute, value))
|
|
14952
|
-
});
|
|
15042
|
+
}), attribute);
|
|
14953
15043
|
},
|
|
14954
15044
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
|
|
14955
15045
|
var uiState = _ref5.uiState;
|
|
@@ -14974,6 +15064,18 @@
|
|
|
14974
15064
|
};
|
|
14975
15065
|
};
|
|
14976
15066
|
};
|
|
15067
|
+
function removeEmptyRefinementsFromUiState$2(indexUiState, attribute) {
|
|
15068
|
+
if (!indexUiState.menu) {
|
|
15069
|
+
return indexUiState;
|
|
15070
|
+
}
|
|
15071
|
+
if (indexUiState.menu[attribute] === undefined) {
|
|
15072
|
+
delete indexUiState.menu[attribute];
|
|
15073
|
+
}
|
|
15074
|
+
if (Object.keys(indexUiState.menu).length === 0) {
|
|
15075
|
+
delete indexUiState.menu;
|
|
15076
|
+
}
|
|
15077
|
+
return indexUiState;
|
|
15078
|
+
}
|
|
14977
15079
|
|
|
14978
15080
|
function useMenu(props, additionalWidgetProperties) {
|
|
14979
15081
|
return useConnector(connectMenu, props, additionalWidgetProperties);
|
|
@@ -14991,7 +15093,7 @@
|
|
|
14991
15093
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
14992
15094
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
14993
15095
|
if (!it) {
|
|
14994
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray$
|
|
15096
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$f(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
14995
15097
|
if (it) o = it;
|
|
14996
15098
|
var i = 0;
|
|
14997
15099
|
var F = function F() {};
|
|
@@ -15039,26 +15141,26 @@
|
|
|
15039
15141
|
}
|
|
15040
15142
|
};
|
|
15041
15143
|
}
|
|
15042
|
-
function _slicedToArray$
|
|
15043
|
-
return _arrayWithHoles$
|
|
15144
|
+
function _slicedToArray$9(arr, i) {
|
|
15145
|
+
return _arrayWithHoles$9(arr) || _iterableToArrayLimit$9(arr, i) || _unsupportedIterableToArray$f(arr, i) || _nonIterableRest$9();
|
|
15044
15146
|
}
|
|
15045
|
-
function _nonIterableRest$
|
|
15147
|
+
function _nonIterableRest$9() {
|
|
15046
15148
|
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
15149
|
}
|
|
15048
|
-
function _unsupportedIterableToArray$
|
|
15150
|
+
function _unsupportedIterableToArray$f(o, minLen) {
|
|
15049
15151
|
if (!o) return;
|
|
15050
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
15152
|
+
if (typeof o === "string") return _arrayLikeToArray$f(o, minLen);
|
|
15051
15153
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
15052
15154
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
15053
15155
|
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$
|
|
15156
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$f(o, minLen);
|
|
15055
15157
|
}
|
|
15056
|
-
function _arrayLikeToArray$
|
|
15158
|
+
function _arrayLikeToArray$f(arr, len) {
|
|
15057
15159
|
if (len == null || len > arr.length) len = arr.length;
|
|
15058
15160
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
15059
15161
|
return arr2;
|
|
15060
15162
|
}
|
|
15061
|
-
function _iterableToArrayLimit$
|
|
15163
|
+
function _iterableToArrayLimit$9(arr, i) {
|
|
15062
15164
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
15063
15165
|
if (null != _i) {
|
|
15064
15166
|
var _s,
|
|
@@ -15085,7 +15187,7 @@
|
|
|
15085
15187
|
return _arr;
|
|
15086
15188
|
}
|
|
15087
15189
|
}
|
|
15088
|
-
function _arrayWithHoles$
|
|
15190
|
+
function _arrayWithHoles$9(arr) {
|
|
15089
15191
|
if (Array.isArray(arr)) return arr;
|
|
15090
15192
|
}
|
|
15091
15193
|
function ownKeys$q(object, enumerableOnly) {
|
|
@@ -15220,12 +15322,9 @@
|
|
|
15220
15322
|
}
|
|
15221
15323
|
var min = values['>='] && values['>='][0] || '';
|
|
15222
15324
|
var max = values['<='] && values['<='][0] || '';
|
|
15223
|
-
|
|
15224
|
-
return uiState;
|
|
15225
|
-
}
|
|
15226
|
-
return _objectSpread$p(_objectSpread$p({}, uiState), {}, {
|
|
15325
|
+
return removeEmptyRefinementsFromUiState$3(_objectSpread$p(_objectSpread$p({}, uiState), {}, {
|
|
15227
15326
|
numericMenu: _objectSpread$p(_objectSpread$p({}, uiState.numericMenu), {}, _defineProperty$r({}, attribute, "".concat(min, ":").concat(max)))
|
|
15228
|
-
});
|
|
15327
|
+
}), attribute);
|
|
15229
15328
|
},
|
|
15230
15329
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
15231
15330
|
var uiState = _ref6.uiState;
|
|
@@ -15241,7 +15340,7 @@
|
|
|
15241
15340
|
return withoutRefinements.addNumericRefinement(attribute, '=', Number(value));
|
|
15242
15341
|
}
|
|
15243
15342
|
var _value$split$map = value.split(':').map(parseFloat),
|
|
15244
|
-
_value$split$map2 = _slicedToArray$
|
|
15343
|
+
_value$split$map2 = _slicedToArray$9(_value$split$map, 2),
|
|
15245
15344
|
min = _value$split$map2[0],
|
|
15246
15345
|
max = _value$split$map2[1];
|
|
15247
15346
|
var withMinRefinement = isFiniteNumber(min) ? withoutRefinements.addNumericRefinement(attribute, '>=', min) : withoutRefinements;
|
|
@@ -15387,6 +15486,18 @@
|
|
|
15387
15486
|
function hasNumericRefinement(currentRefinements, operator, value) {
|
|
15388
15487
|
return currentRefinements[operator] !== undefined && currentRefinements[operator].includes(value);
|
|
15389
15488
|
}
|
|
15489
|
+
function removeEmptyRefinementsFromUiState$3(indexUiState, attribute) {
|
|
15490
|
+
if (!indexUiState.numericMenu) {
|
|
15491
|
+
return indexUiState;
|
|
15492
|
+
}
|
|
15493
|
+
if (indexUiState.numericMenu[attribute] === ':') {
|
|
15494
|
+
delete indexUiState.numericMenu[attribute];
|
|
15495
|
+
}
|
|
15496
|
+
if (Object.keys(indexUiState.numericMenu).length === 0) {
|
|
15497
|
+
delete indexUiState.numericMenu;
|
|
15498
|
+
}
|
|
15499
|
+
return indexUiState;
|
|
15500
|
+
}
|
|
15390
15501
|
|
|
15391
15502
|
function useNumericMenu(props, additionalWidgetProperties) {
|
|
15392
15503
|
return useConnector(connectNumericMenu, props, additionalWidgetProperties);
|
|
@@ -15760,26 +15871,26 @@
|
|
|
15760
15871
|
return (hint === "string" ? String : Number)(input);
|
|
15761
15872
|
}
|
|
15762
15873
|
function _toConsumableArray$7(arr) {
|
|
15763
|
-
return _arrayWithoutHoles$7(arr) || _iterableToArray$7(arr) || _unsupportedIterableToArray$
|
|
15874
|
+
return _arrayWithoutHoles$7(arr) || _iterableToArray$7(arr) || _unsupportedIterableToArray$g(arr) || _nonIterableSpread$7();
|
|
15764
15875
|
}
|
|
15765
15876
|
function _nonIterableSpread$7() {
|
|
15766
15877
|
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
15878
|
}
|
|
15768
|
-
function _unsupportedIterableToArray$
|
|
15879
|
+
function _unsupportedIterableToArray$g(o, minLen) {
|
|
15769
15880
|
if (!o) return;
|
|
15770
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
15881
|
+
if (typeof o === "string") return _arrayLikeToArray$g(o, minLen);
|
|
15771
15882
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
15772
15883
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
15773
15884
|
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$
|
|
15885
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$g(o, minLen);
|
|
15775
15886
|
}
|
|
15776
15887
|
function _iterableToArray$7(iter) {
|
|
15777
15888
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
15778
15889
|
}
|
|
15779
15890
|
function _arrayWithoutHoles$7(arr) {
|
|
15780
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$
|
|
15891
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$g(arr);
|
|
15781
15892
|
}
|
|
15782
|
-
function _arrayLikeToArray$
|
|
15893
|
+
function _arrayLikeToArray$g(arr, len) {
|
|
15783
15894
|
if (len == null || len > arr.length) len = arr.length;
|
|
15784
15895
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
15785
15896
|
return arr2;
|
|
@@ -15997,26 +16108,26 @@
|
|
|
15997
16108
|
}
|
|
15998
16109
|
return (hint === "string" ? String : Number)(input);
|
|
15999
16110
|
}
|
|
16000
|
-
function _slicedToArray$
|
|
16001
|
-
return _arrayWithHoles$
|
|
16111
|
+
function _slicedToArray$a(arr, i) {
|
|
16112
|
+
return _arrayWithHoles$a(arr) || _iterableToArrayLimit$a(arr, i) || _unsupportedIterableToArray$h(arr, i) || _nonIterableRest$a();
|
|
16002
16113
|
}
|
|
16003
|
-
function _nonIterableRest$
|
|
16114
|
+
function _nonIterableRest$a() {
|
|
16004
16115
|
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
16116
|
}
|
|
16006
|
-
function _unsupportedIterableToArray$
|
|
16117
|
+
function _unsupportedIterableToArray$h(o, minLen) {
|
|
16007
16118
|
if (!o) return;
|
|
16008
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
16119
|
+
if (typeof o === "string") return _arrayLikeToArray$h(o, minLen);
|
|
16009
16120
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
16010
16121
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
16011
16122
|
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$
|
|
16123
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$h(o, minLen);
|
|
16013
16124
|
}
|
|
16014
|
-
function _arrayLikeToArray$
|
|
16125
|
+
function _arrayLikeToArray$h(arr, len) {
|
|
16015
16126
|
if (len == null || len > arr.length) len = arr.length;
|
|
16016
16127
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
16017
16128
|
return arr2;
|
|
16018
16129
|
}
|
|
16019
|
-
function _iterableToArrayLimit$
|
|
16130
|
+
function _iterableToArrayLimit$a(arr, i) {
|
|
16020
16131
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
16021
16132
|
if (null != _i) {
|
|
16022
16133
|
var _s,
|
|
@@ -16043,7 +16154,7 @@
|
|
|
16043
16154
|
return _arr;
|
|
16044
16155
|
}
|
|
16045
16156
|
}
|
|
16046
|
-
function _arrayWithHoles$
|
|
16157
|
+
function _arrayWithHoles$a(arr) {
|
|
16047
16158
|
if (Array.isArray(arr)) return arr;
|
|
16048
16159
|
}
|
|
16049
16160
|
var withUsage$g = createDocumentationMessageGenerator({
|
|
@@ -16110,10 +16221,10 @@
|
|
|
16110
16221
|
var currentRangeMin = currentRange.min,
|
|
16111
16222
|
currentRangeMax = currentRange.max;
|
|
16112
16223
|
var _ref3 = resolvedState.getNumericRefinement(attribute, '>=') || [],
|
|
16113
|
-
_ref4 = _slicedToArray$
|
|
16224
|
+
_ref4 = _slicedToArray$a(_ref3, 1),
|
|
16114
16225
|
min = _ref4[0];
|
|
16115
16226
|
var _ref5 = resolvedState.getNumericRefinement(attribute, '<=') || [],
|
|
16116
|
-
_ref6 = _slicedToArray$
|
|
16227
|
+
_ref6 = _slicedToArray$a(_ref5, 1),
|
|
16117
16228
|
max = _ref6[0];
|
|
16118
16229
|
var isResetMin = nextMin === undefined || nextMin === '';
|
|
16119
16230
|
var isResetMax = nextMax === undefined || nextMax === '';
|
|
@@ -16193,10 +16304,10 @@
|
|
|
16193
16304
|
}
|
|
16194
16305
|
function _getCurrentRefinement(helper) {
|
|
16195
16306
|
var _ref7 = helper.getNumericRefinement(attribute, '>=') || [],
|
|
16196
|
-
_ref8 = _slicedToArray$
|
|
16307
|
+
_ref8 = _slicedToArray$a(_ref7, 1),
|
|
16197
16308
|
minValue = _ref8[0];
|
|
16198
16309
|
var _ref9 = helper.getNumericRefinement(attribute, '<=') || [],
|
|
16199
|
-
_ref10 = _slicedToArray$
|
|
16310
|
+
_ref10 = _slicedToArray$a(_ref9, 1),
|
|
16200
16311
|
maxValue = _ref10[0];
|
|
16201
16312
|
var min = isFiniteNumber(minValue) ? minValue : -Infinity;
|
|
16202
16313
|
var max = isFiniteNumber(maxValue) ? maxValue : Infinity;
|
|
@@ -16205,7 +16316,7 @@
|
|
|
16205
16316
|
function _refine(helper, currentRange) {
|
|
16206
16317
|
return function () {
|
|
16207
16318
|
var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [undefined, undefined],
|
|
16208
|
-
_ref12 = _slicedToArray$
|
|
16319
|
+
_ref12 = _slicedToArray$a(_ref11, 2),
|
|
16209
16320
|
nextMin = _ref12[0],
|
|
16210
16321
|
nextMax = _ref12[1];
|
|
16211
16322
|
var refinedState = getRefinedState(helper, currentRange, nextMin, nextMax);
|
|
@@ -16304,7 +16415,7 @@
|
|
|
16304
16415
|
return widgetSearchParameters;
|
|
16305
16416
|
}
|
|
16306
16417
|
var _value$split$map = value.split(':').map(parseFloat),
|
|
16307
|
-
_value$split$map2 = _slicedToArray$
|
|
16418
|
+
_value$split$map2 = _slicedToArray$a(_value$split$map, 2),
|
|
16308
16419
|
lowerBound = _value$split$map2[0],
|
|
16309
16420
|
upperBound = _value$split$map2[1];
|
|
16310
16421
|
if (isFiniteNumber(lowerBound) && (!isFiniteNumber(minBound) || minBound < lowerBound)) {
|
|
@@ -16646,12 +16757,9 @@
|
|
|
16646
16757
|
getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
|
|
16647
16758
|
var searchParameters = _ref5.searchParameters;
|
|
16648
16759
|
var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
|
|
16649
|
-
|
|
16650
|
-
return uiState;
|
|
16651
|
-
}
|
|
16652
|
-
return _objectSpread$t(_objectSpread$t({}, uiState), {}, {
|
|
16760
|
+
return removeEmptyRefinementsFromUiState$4(_objectSpread$t(_objectSpread$t({}, uiState), {}, {
|
|
16653
16761
|
refinementList: _objectSpread$t(_objectSpread$t({}, uiState.refinementList), {}, _defineProperty$w({}, attribute, values))
|
|
16654
|
-
});
|
|
16762
|
+
}), attribute);
|
|
16655
16763
|
},
|
|
16656
16764
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
16657
16765
|
var uiState = _ref6.uiState;
|
|
@@ -16679,6 +16787,18 @@
|
|
|
16679
16787
|
};
|
|
16680
16788
|
};
|
|
16681
16789
|
};
|
|
16790
|
+
function removeEmptyRefinementsFromUiState$4(indexUiState, attribute) {
|
|
16791
|
+
if (!indexUiState.refinementList) {
|
|
16792
|
+
return indexUiState;
|
|
16793
|
+
}
|
|
16794
|
+
if (!indexUiState.refinementList[attribute] || indexUiState.refinementList[attribute].length === 0) {
|
|
16795
|
+
delete indexUiState.refinementList[attribute];
|
|
16796
|
+
}
|
|
16797
|
+
if (Object.keys(indexUiState.refinementList).length === 0) {
|
|
16798
|
+
delete indexUiState.refinementList;
|
|
16799
|
+
}
|
|
16800
|
+
return indexUiState;
|
|
16801
|
+
}
|
|
16682
16802
|
|
|
16683
16803
|
function useRefinementList(props, additionalWidgetProperties) {
|
|
16684
16804
|
return useConnector(connectRefinementList, props, additionalWidgetProperties);
|
|
@@ -17187,26 +17307,26 @@
|
|
|
17187
17307
|
}
|
|
17188
17308
|
return (hint === "string" ? String : Number)(input);
|
|
17189
17309
|
}
|
|
17190
|
-
function _slicedToArray$
|
|
17191
|
-
return _arrayWithHoles$
|
|
17310
|
+
function _slicedToArray$b(arr, i) {
|
|
17311
|
+
return _arrayWithHoles$b(arr) || _iterableToArrayLimit$b(arr, i) || _unsupportedIterableToArray$i(arr, i) || _nonIterableRest$b();
|
|
17192
17312
|
}
|
|
17193
|
-
function _nonIterableRest$
|
|
17313
|
+
function _nonIterableRest$b() {
|
|
17194
17314
|
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
17315
|
}
|
|
17196
|
-
function _unsupportedIterableToArray$
|
|
17316
|
+
function _unsupportedIterableToArray$i(o, minLen) {
|
|
17197
17317
|
if (!o) return;
|
|
17198
|
-
if (typeof o === "string") return _arrayLikeToArray$
|
|
17318
|
+
if (typeof o === "string") return _arrayLikeToArray$i(o, minLen);
|
|
17199
17319
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
17200
17320
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
17201
17321
|
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$
|
|
17322
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$i(o, minLen);
|
|
17203
17323
|
}
|
|
17204
|
-
function _arrayLikeToArray$
|
|
17324
|
+
function _arrayLikeToArray$i(arr, len) {
|
|
17205
17325
|
if (len == null || len > arr.length) len = arr.length;
|
|
17206
17326
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
17207
17327
|
return arr2;
|
|
17208
17328
|
}
|
|
17209
|
-
function _iterableToArrayLimit$
|
|
17329
|
+
function _iterableToArrayLimit$b(arr, i) {
|
|
17210
17330
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
17211
17331
|
if (null != _i) {
|
|
17212
17332
|
var _s,
|
|
@@ -17233,7 +17353,7 @@
|
|
|
17233
17353
|
return _arr;
|
|
17234
17354
|
}
|
|
17235
17355
|
}
|
|
17236
|
-
function _arrayWithHoles$
|
|
17356
|
+
function _arrayWithHoles$b(arr) {
|
|
17237
17357
|
if (Array.isArray(arr)) return arr;
|
|
17238
17358
|
}
|
|
17239
17359
|
var withUsage$l = createDocumentationMessageGenerator({
|
|
@@ -17258,7 +17378,7 @@
|
|
|
17258
17378
|
_args$ = args[2],
|
|
17259
17379
|
eventName = _args$ === void 0 ? 'Filter Applied' : _args$;
|
|
17260
17380
|
var _args$0$split = args[0].split(':'),
|
|
17261
|
-
_args$0$split2 = _slicedToArray$
|
|
17381
|
+
_args$0$split2 = _slicedToArray$b(_args$0$split, 2),
|
|
17262
17382
|
eventType = _args$0$split2[0],
|
|
17263
17383
|
eventModifier = _args$0$split2[1];
|
|
17264
17384
|
if (eventType !== 'click' || on === undefined) {
|
|
@@ -17541,7 +17661,7 @@
|
|
|
17541
17661
|
var _useState = React.useState(function () {
|
|
17542
17662
|
return getIndexSearchResults(searchIndex);
|
|
17543
17663
|
}),
|
|
17544
|
-
_useState2 = _slicedToArray$
|
|
17664
|
+
_useState2 = _slicedToArray$4(_useState, 2),
|
|
17545
17665
|
searchResults = _useState2[0],
|
|
17546
17666
|
setSearchResults = _useState2[1];
|
|
17547
17667
|
React.useEffect(function () {
|
|
@@ -17573,14 +17693,14 @@
|
|
|
17573
17693
|
var _useState = React.useState(function () {
|
|
17574
17694
|
return search.getUiState();
|
|
17575
17695
|
}),
|
|
17576
|
-
_useState2 = _slicedToArray$
|
|
17696
|
+
_useState2 = _slicedToArray$4(_useState, 2),
|
|
17577
17697
|
uiState = _useState2[0],
|
|
17578
17698
|
setLocalUiState = _useState2[1];
|
|
17579
17699
|
var indexUiState = uiState[indexId];
|
|
17580
17700
|
var _useState3 = React.useState(function () {
|
|
17581
17701
|
return search.renderState;
|
|
17582
17702
|
}),
|
|
17583
|
-
_useState4 = _slicedToArray$
|
|
17703
|
+
_useState4 = _slicedToArray$4(_useState3, 2),
|
|
17584
17704
|
renderState = _useState4[0],
|
|
17585
17705
|
setRenderState = _useState4[1];
|
|
17586
17706
|
var indexRenderState = renderState[indexId] || {};
|