react-instantsearch-core 7.4.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +137 -160
- 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.5.0';
|
|
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.1';
|
|
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
|
/**
|
|
@@ -9768,7 +9788,7 @@
|
|
|
9768
9788
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
9769
9789
|
return arr2;
|
|
9770
9790
|
}
|
|
9771
|
-
var ALGOLIA_INSIGHTS_VERSION = '2.
|
|
9791
|
+
var ALGOLIA_INSIGHTS_VERSION = '2.13.0';
|
|
9772
9792
|
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
|
|
9773
9793
|
function createInsightsMiddleware() {
|
|
9774
9794
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -9849,7 +9869,7 @@
|
|
|
9849
9869
|
// set it later on.
|
|
9850
9870
|
//
|
|
9851
9871
|
// Otherwise, the `init` call might override it with anonymous user token.
|
|
9852
|
-
userTokenBeforeInit = userToken;
|
|
9872
|
+
userTokenBeforeInit = normalizeUserToken(userToken);
|
|
9853
9873
|
});
|
|
9854
9874
|
|
|
9855
9875
|
// Only `init` if the `insightsInitParams` option is passed or
|
|
@@ -9905,13 +9925,14 @@
|
|
|
9905
9925
|
}
|
|
9906
9926
|
var setUserTokenToSearch = function setUserTokenToSearch(userToken) {
|
|
9907
9927
|
var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
9908
|
-
|
|
9928
|
+
var normalizedUserToken = normalizeUserToken(userToken);
|
|
9929
|
+
if (!normalizedUserToken) {
|
|
9909
9930
|
return;
|
|
9910
9931
|
}
|
|
9911
9932
|
var existingToken = helper.state.userToken;
|
|
9912
9933
|
function applyToken() {
|
|
9913
9934
|
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread$b(_objectSpread$b({}, helper.state), {}, {
|
|
9914
|
-
userToken:
|
|
9935
|
+
userToken: normalizedUserToken
|
|
9915
9936
|
}));
|
|
9916
9937
|
if (existingToken && existingToken !== userToken) {
|
|
9917
9938
|
instantSearchInstance.scheduleSearch();
|
|
@@ -10007,6 +10028,17 @@
|
|
|
10007
10028
|
return v3 || v2_6 || v1_10;
|
|
10008
10029
|
}
|
|
10009
10030
|
|
|
10031
|
+
/**
|
|
10032
|
+
* While `search-insights` supports both string and number user tokens,
|
|
10033
|
+
* the Search API only accepts strings. This function normalizes the user token.
|
|
10034
|
+
*/
|
|
10035
|
+
function normalizeUserToken(userToken) {
|
|
10036
|
+
if (!userToken) {
|
|
10037
|
+
return undefined;
|
|
10038
|
+
}
|
|
10039
|
+
return typeof userToken === 'number' ? userToken.toString() : userToken;
|
|
10040
|
+
}
|
|
10041
|
+
|
|
10010
10042
|
function extractWidgetPayload(widgets, instantSearchInstance, payload) {
|
|
10011
10043
|
var initOptions = createInitArgs(instantSearchInstance, instantSearchInstance.mainIndex, instantSearchInstance._initialUiState);
|
|
10012
10044
|
widgets.forEach(function (widget) {
|
|
@@ -10989,7 +11021,8 @@
|
|
|
10989
11021
|
getLocation = _ref.getLocation,
|
|
10990
11022
|
start = _ref.start,
|
|
10991
11023
|
dispose = _ref.dispose,
|
|
10992
|
-
push = _ref.push
|
|
11024
|
+
push = _ref.push,
|
|
11025
|
+
cleanUrlOnDispose = _ref.cleanUrlOnDispose;
|
|
10993
11026
|
_classCallCheck(this, BrowserHistory);
|
|
10994
11027
|
_defineProperty$d(this, "$$type", 'ais.browser');
|
|
10995
11028
|
/**
|
|
@@ -11039,6 +11072,7 @@
|
|
|
11039
11072
|
_defineProperty$d(this, "_start", void 0);
|
|
11040
11073
|
_defineProperty$d(this, "_dispose", void 0);
|
|
11041
11074
|
_defineProperty$d(this, "_push", void 0);
|
|
11075
|
+
_defineProperty$d(this, "_cleanUrlOnDispose", void 0);
|
|
11042
11076
|
this.windowTitle = windowTitle;
|
|
11043
11077
|
this.writeTimer = undefined;
|
|
11044
11078
|
this.writeDelay = writeDelay;
|
|
@@ -11048,6 +11082,7 @@
|
|
|
11048
11082
|
this._start = start;
|
|
11049
11083
|
this._dispose = dispose;
|
|
11050
11084
|
this._push = push;
|
|
11085
|
+
this._cleanUrlOnDispose = typeof cleanUrlOnDispose === 'undefined' ? true : cleanUrlOnDispose;
|
|
11051
11086
|
safelyRunOnBrowser(function (_ref2) {
|
|
11052
11087
|
var window = _ref2.window;
|
|
11053
11088
|
var title = _this.windowTitle && _this.windowTitle(_this.read());
|
|
@@ -11166,7 +11201,9 @@
|
|
|
11166
11201
|
if (this.writeTimer) {
|
|
11167
11202
|
clearTimeout(this.writeTimer);
|
|
11168
11203
|
}
|
|
11169
|
-
this.
|
|
11204
|
+
if (this._cleanUrlOnDispose) {
|
|
11205
|
+
this.write({});
|
|
11206
|
+
}
|
|
11170
11207
|
}
|
|
11171
11208
|
}, {
|
|
11172
11209
|
key: "start",
|
|
@@ -11255,7 +11292,8 @@
|
|
|
11255
11292
|
} : _ref7$getLocation,
|
|
11256
11293
|
start = _ref7.start,
|
|
11257
11294
|
dispose = _ref7.dispose,
|
|
11258
|
-
push = _ref7.push
|
|
11295
|
+
push = _ref7.push,
|
|
11296
|
+
cleanUrlOnDispose = _ref7.cleanUrlOnDispose;
|
|
11259
11297
|
return new BrowserHistory({
|
|
11260
11298
|
createURL: createURL,
|
|
11261
11299
|
parseURL: parseURL,
|
|
@@ -11264,7 +11302,8 @@
|
|
|
11264
11302
|
getLocation: getLocation,
|
|
11265
11303
|
start: start,
|
|
11266
11304
|
dispose: dispose,
|
|
11267
|
-
push: push
|
|
11305
|
+
push: push,
|
|
11306
|
+
cleanUrlOnDispose: cleanUrlOnDispose
|
|
11268
11307
|
});
|
|
11269
11308
|
}
|
|
11270
11309
|
|
|
@@ -11622,7 +11661,7 @@
|
|
|
11622
11661
|
};
|
|
11623
11662
|
}
|
|
11624
11663
|
|
|
11625
|
-
var version$2 = '4.
|
|
11664
|
+
var version$2 = '4.63.0';
|
|
11626
11665
|
|
|
11627
11666
|
function _typeof$k(obj) {
|
|
11628
11667
|
"@babel/helpers - typeof";
|
|
@@ -11786,7 +11825,8 @@
|
|
|
11786
11825
|
* Global options for an InstantSearch instance.
|
|
11787
11826
|
*/
|
|
11788
11827
|
var INSTANTSEARCH_FUTURE_DEFAULTS = {
|
|
11789
|
-
preserveSharedStateOnUnmount: false
|
|
11828
|
+
preserveSharedStateOnUnmount: false,
|
|
11829
|
+
persistHierarchicalRootCount: false
|
|
11790
11830
|
};
|
|
11791
11831
|
|
|
11792
11832
|
/**
|
|
@@ -12106,7 +12146,9 @@
|
|
|
12106
12146
|
// DerivedHelper scoped into the `index` widgets.
|
|
12107
12147
|
// In Vue InstantSearch' hydrate, a main helper gets set before start, so
|
|
12108
12148
|
// we need to respect this helper as a way to keep all listeners correct.
|
|
12109
|
-
var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName
|
|
12149
|
+
var mainHelper = this.mainHelper || algoliasearchHelper_1(this.client, this.indexName, undefined, {
|
|
12150
|
+
persistHierarchicalRootCount: this.future.persistHierarchicalRootCount
|
|
12151
|
+
});
|
|
12110
12152
|
mainHelper.search = function () {
|
|
12111
12153
|
_this3.status = 'loading';
|
|
12112
12154
|
_this3.scheduleRender(false);
|
|
@@ -12591,34 +12633,6 @@
|
|
|
12591
12633
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
12592
12634
|
}, _typeof$l(obj);
|
|
12593
12635
|
}
|
|
12594
|
-
var _excluded$8 = ["hierarchicalMenu"];
|
|
12595
|
-
function _objectWithoutProperties$4(source, excluded) {
|
|
12596
|
-
if (source == null) return {};
|
|
12597
|
-
var target = _objectWithoutPropertiesLoose$5(source, excluded);
|
|
12598
|
-
var key, i;
|
|
12599
|
-
if (Object.getOwnPropertySymbols) {
|
|
12600
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
12601
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
12602
|
-
key = sourceSymbolKeys[i];
|
|
12603
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
12604
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
12605
|
-
target[key] = source[key];
|
|
12606
|
-
}
|
|
12607
|
-
}
|
|
12608
|
-
return target;
|
|
12609
|
-
}
|
|
12610
|
-
function _objectWithoutPropertiesLoose$5(source, excluded) {
|
|
12611
|
-
if (source == null) return {};
|
|
12612
|
-
var target = {};
|
|
12613
|
-
var sourceKeys = Object.keys(source);
|
|
12614
|
-
var key, i;
|
|
12615
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
12616
|
-
key = sourceKeys[i];
|
|
12617
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
12618
|
-
target[key] = source[key];
|
|
12619
|
-
}
|
|
12620
|
-
return target;
|
|
12621
|
-
}
|
|
12622
12636
|
function ownKeys$h(object, enumerableOnly) {
|
|
12623
12637
|
var keys = Object.keys(object);
|
|
12624
12638
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -12823,7 +12837,7 @@
|
|
|
12823
12837
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
12824
12838
|
return removeEmptyRefinementsFromUiState(_objectSpread$g(_objectSpread$g({}, uiState), {}, {
|
|
12825
12839
|
hierarchicalMenu: _objectSpread$g(_objectSpread$g({}, uiState.hierarchicalMenu), {}, _defineProperty$i({}, hierarchicalFacetName, path))
|
|
12826
|
-
}));
|
|
12840
|
+
}), hierarchicalFacetName);
|
|
12827
12841
|
},
|
|
12828
12842
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref4) {
|
|
12829
12843
|
var uiState = _ref4.uiState;
|
|
@@ -12872,18 +12886,17 @@
|
|
|
12872
12886
|
};
|
|
12873
12887
|
});
|
|
12874
12888
|
}
|
|
12875
|
-
function removeEmptyRefinementsFromUiState(indexUiState) {
|
|
12876
|
-
|
|
12877
|
-
indexUiStateBase = _objectWithoutProperties$4(indexUiState, _excluded$8);
|
|
12878
|
-
if (!hierarchicalMenu) {
|
|
12889
|
+
function removeEmptyRefinementsFromUiState(indexUiState, attribute) {
|
|
12890
|
+
if (!indexUiState.hierarchicalMenu) {
|
|
12879
12891
|
return indexUiState;
|
|
12880
12892
|
}
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
}
|
|
12884
|
-
|
|
12885
|
-
hierarchicalMenu
|
|
12886
|
-
}
|
|
12893
|
+
if (!indexUiState.hierarchicalMenu[attribute] || !indexUiState.hierarchicalMenu[attribute].length) {
|
|
12894
|
+
delete indexUiState.hierarchicalMenu[attribute];
|
|
12895
|
+
}
|
|
12896
|
+
if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
|
|
12897
|
+
delete indexUiState.hierarchicalMenu;
|
|
12898
|
+
}
|
|
12899
|
+
return indexUiState;
|
|
12887
12900
|
}
|
|
12888
12901
|
|
|
12889
12902
|
function useBreadcrumb(props, additionalWidgetProperties) {
|
|
@@ -13648,8 +13661,7 @@
|
|
|
13648
13661
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
13649
13662
|
}, _typeof$p(obj);
|
|
13650
13663
|
}
|
|
13651
|
-
var _excluded$
|
|
13652
|
-
_excluded2$1 = ["hierarchicalMenu"];
|
|
13664
|
+
var _excluded$8 = ["name", "escapedValue", "data", "path"];
|
|
13653
13665
|
function ownKeys$l(object, enumerableOnly) {
|
|
13654
13666
|
var keys = Object.keys(object);
|
|
13655
13667
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -13699,9 +13711,9 @@
|
|
|
13699
13711
|
}
|
|
13700
13712
|
return (hint === "string" ? String : Number)(input);
|
|
13701
13713
|
}
|
|
13702
|
-
function _objectWithoutProperties$
|
|
13714
|
+
function _objectWithoutProperties$4(source, excluded) {
|
|
13703
13715
|
if (source == null) return {};
|
|
13704
|
-
var target = _objectWithoutPropertiesLoose$
|
|
13716
|
+
var target = _objectWithoutPropertiesLoose$5(source, excluded);
|
|
13705
13717
|
var key, i;
|
|
13706
13718
|
if (Object.getOwnPropertySymbols) {
|
|
13707
13719
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -13714,7 +13726,7 @@
|
|
|
13714
13726
|
}
|
|
13715
13727
|
return target;
|
|
13716
13728
|
}
|
|
13717
|
-
function _objectWithoutPropertiesLoose$
|
|
13729
|
+
function _objectWithoutPropertiesLoose$5(source, excluded) {
|
|
13718
13730
|
if (source == null) return {};
|
|
13719
13731
|
var target = {};
|
|
13720
13732
|
var sourceKeys = Object.keys(source);
|
|
@@ -13853,7 +13865,7 @@
|
|
|
13853
13865
|
value = _ref2.escapedValue,
|
|
13854
13866
|
data = _ref2.data,
|
|
13855
13867
|
path = _ref2.path,
|
|
13856
|
-
subValue = _objectWithoutProperties$
|
|
13868
|
+
subValue = _objectWithoutProperties$4(_ref2, _excluded$8);
|
|
13857
13869
|
var item = _objectSpread$k(_objectSpread$k({}, subValue), {}, {
|
|
13858
13870
|
value: value,
|
|
13859
13871
|
label: label,
|
|
@@ -13962,7 +13974,7 @@
|
|
|
13962
13974
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
13963
13975
|
return removeEmptyRefinementsFromUiState$1(_objectSpread$k(_objectSpread$k({}, uiState), {}, {
|
|
13964
13976
|
hierarchicalMenu: _objectSpread$k(_objectSpread$k({}, uiState.hierarchicalMenu), {}, _defineProperty$m({}, hierarchicalFacetName, path))
|
|
13965
|
-
}));
|
|
13977
|
+
}), hierarchicalFacetName);
|
|
13966
13978
|
},
|
|
13967
13979
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
13968
13980
|
var uiState = _ref6.uiState;
|
|
@@ -13993,18 +14005,17 @@
|
|
|
13993
14005
|
};
|
|
13994
14006
|
};
|
|
13995
14007
|
};
|
|
13996
|
-
function removeEmptyRefinementsFromUiState$1(indexUiState) {
|
|
13997
|
-
|
|
13998
|
-
indexUiStateBase = _objectWithoutProperties$5(indexUiState, _excluded2$1);
|
|
13999
|
-
if (!hierarchicalMenu) {
|
|
14008
|
+
function removeEmptyRefinementsFromUiState$1(indexUiState, attribute) {
|
|
14009
|
+
if (!indexUiState.hierarchicalMenu) {
|
|
14000
14010
|
return indexUiState;
|
|
14001
14011
|
}
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
}
|
|
14005
|
-
|
|
14006
|
-
hierarchicalMenu
|
|
14007
|
-
}
|
|
14012
|
+
if (!indexUiState.hierarchicalMenu[attribute] || indexUiState.hierarchicalMenu[attribute].length === 0) {
|
|
14013
|
+
delete indexUiState.hierarchicalMenu[attribute];
|
|
14014
|
+
}
|
|
14015
|
+
if (Object.keys(indexUiState.hierarchicalMenu).length === 0) {
|
|
14016
|
+
delete indexUiState.hierarchicalMenu;
|
|
14017
|
+
}
|
|
14018
|
+
return indexUiState;
|
|
14008
14019
|
}
|
|
14009
14020
|
|
|
14010
14021
|
function useHierarchicalMenu(props, additionalWidgetProperties) {
|
|
@@ -14403,8 +14414,8 @@
|
|
|
14403
14414
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
14404
14415
|
}, _typeof$s(obj);
|
|
14405
14416
|
}
|
|
14406
|
-
var _excluded$
|
|
14407
|
-
_excluded2$
|
|
14417
|
+
var _excluded$9 = ["page"],
|
|
14418
|
+
_excluded2$1 = ["clickAnalytics", "userToken"];
|
|
14408
14419
|
function ownKeys$o(object, enumerableOnly) {
|
|
14409
14420
|
var keys = Object.keys(object);
|
|
14410
14421
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -14479,9 +14490,9 @@
|
|
|
14479
14490
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14480
14491
|
return arr2;
|
|
14481
14492
|
}
|
|
14482
|
-
function _objectWithoutProperties$
|
|
14493
|
+
function _objectWithoutProperties$5(source, excluded) {
|
|
14483
14494
|
if (source == null) return {};
|
|
14484
|
-
var target = _objectWithoutPropertiesLoose$
|
|
14495
|
+
var target = _objectWithoutPropertiesLoose$6(source, excluded);
|
|
14485
14496
|
var key, i;
|
|
14486
14497
|
if (Object.getOwnPropertySymbols) {
|
|
14487
14498
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -14494,7 +14505,7 @@
|
|
|
14494
14505
|
}
|
|
14495
14506
|
return target;
|
|
14496
14507
|
}
|
|
14497
|
-
function _objectWithoutPropertiesLoose$
|
|
14508
|
+
function _objectWithoutPropertiesLoose$6(source, excluded) {
|
|
14498
14509
|
if (source == null) return {};
|
|
14499
14510
|
var target = {};
|
|
14500
14511
|
var sourceKeys = Object.keys(source);
|
|
@@ -14513,14 +14524,14 @@
|
|
|
14513
14524
|
function getStateWithoutPage(state) {
|
|
14514
14525
|
var _ref = state || {},
|
|
14515
14526
|
page = _ref.page,
|
|
14516
|
-
rest = _objectWithoutProperties$
|
|
14527
|
+
rest = _objectWithoutProperties$5(_ref, _excluded$9);
|
|
14517
14528
|
return rest;
|
|
14518
14529
|
}
|
|
14519
14530
|
function normalizeState(state) {
|
|
14520
14531
|
var _ref2 = state || {},
|
|
14521
14532
|
clickAnalytics = _ref2.clickAnalytics,
|
|
14522
14533
|
userToken = _ref2.userToken,
|
|
14523
|
-
rest = _objectWithoutProperties$
|
|
14534
|
+
rest = _objectWithoutProperties$5(_ref2, _excluded2$1);
|
|
14524
14535
|
return rest;
|
|
14525
14536
|
}
|
|
14526
14537
|
function getInMemoryCache() {
|
|
@@ -14753,8 +14764,7 @@
|
|
|
14753
14764
|
return useConnector(connectInfiniteHits, props, additionalWidgetProperties);
|
|
14754
14765
|
}
|
|
14755
14766
|
|
|
14756
|
-
var _excluded$
|
|
14757
|
-
_excluded2$3 = ["menu"];
|
|
14767
|
+
var _excluded$a = ["name", "escapedValue", "path"];
|
|
14758
14768
|
function _typeof$t(obj) {
|
|
14759
14769
|
"@babel/helpers - typeof";
|
|
14760
14770
|
|
|
@@ -14764,9 +14774,9 @@
|
|
|
14764
14774
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
14765
14775
|
}, _typeof$t(obj);
|
|
14766
14776
|
}
|
|
14767
|
-
function _objectWithoutProperties$
|
|
14777
|
+
function _objectWithoutProperties$6(source, excluded) {
|
|
14768
14778
|
if (source == null) return {};
|
|
14769
|
-
var target = _objectWithoutPropertiesLoose$
|
|
14779
|
+
var target = _objectWithoutPropertiesLoose$7(source, excluded);
|
|
14770
14780
|
var key, i;
|
|
14771
14781
|
if (Object.getOwnPropertySymbols) {
|
|
14772
14782
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -14779,7 +14789,7 @@
|
|
|
14779
14789
|
}
|
|
14780
14790
|
return target;
|
|
14781
14791
|
}
|
|
14782
|
-
function _objectWithoutPropertiesLoose$
|
|
14792
|
+
function _objectWithoutPropertiesLoose$7(source, excluded) {
|
|
14783
14793
|
if (source == null) return {};
|
|
14784
14794
|
var target = {};
|
|
14785
14795
|
var sourceKeys = Object.keys(source);
|
|
@@ -15020,7 +15030,7 @@
|
|
|
15020
15030
|
var label = _ref3.name,
|
|
15021
15031
|
value = _ref3.escapedValue,
|
|
15022
15032
|
path = _ref3.path,
|
|
15023
|
-
item = _objectWithoutProperties$
|
|
15033
|
+
item = _objectWithoutProperties$6(_ref3, _excluded$a);
|
|
15024
15034
|
return _objectSpread$o(_objectSpread$o({}, item), {}, {
|
|
15025
15035
|
label: label,
|
|
15026
15036
|
value: value
|
|
@@ -15048,7 +15058,7 @@
|
|
|
15048
15058
|
value = _searchParameters$get2[0];
|
|
15049
15059
|
return removeEmptyRefinementsFromUiState$2(_objectSpread$o(_objectSpread$o({}, uiState), {}, {
|
|
15050
15060
|
menu: _objectSpread$o(_objectSpread$o({}, uiState.menu), {}, _defineProperty$q({}, attribute, value))
|
|
15051
|
-
}));
|
|
15061
|
+
}), attribute);
|
|
15052
15062
|
},
|
|
15053
15063
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
|
|
15054
15064
|
var uiState = _ref5.uiState;
|
|
@@ -15073,26 +15083,23 @@
|
|
|
15073
15083
|
};
|
|
15074
15084
|
};
|
|
15075
15085
|
};
|
|
15076
|
-
function removeEmptyRefinementsFromUiState$2(indexUiState) {
|
|
15077
|
-
|
|
15078
|
-
indexUiStateBase = _objectWithoutProperties$7(indexUiState, _excluded2$3);
|
|
15079
|
-
if (!menu) {
|
|
15086
|
+
function removeEmptyRefinementsFromUiState$2(indexUiState, attribute) {
|
|
15087
|
+
if (!indexUiState.menu) {
|
|
15080
15088
|
return indexUiState;
|
|
15081
15089
|
}
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
|
|
15088
|
-
|
|
15090
|
+
if (indexUiState.menu[attribute] === undefined) {
|
|
15091
|
+
delete indexUiState.menu[attribute];
|
|
15092
|
+
}
|
|
15093
|
+
if (Object.keys(indexUiState.menu).length === 0) {
|
|
15094
|
+
delete indexUiState.menu;
|
|
15095
|
+
}
|
|
15096
|
+
return indexUiState;
|
|
15089
15097
|
}
|
|
15090
15098
|
|
|
15091
15099
|
function useMenu(props, additionalWidgetProperties) {
|
|
15092
15100
|
return useConnector(connectMenu, props, additionalWidgetProperties);
|
|
15093
15101
|
}
|
|
15094
15102
|
|
|
15095
|
-
var _excluded$c = ["numericMenu"];
|
|
15096
15103
|
function _typeof$u(obj) {
|
|
15097
15104
|
"@babel/helpers - typeof";
|
|
15098
15105
|
|
|
@@ -15102,33 +15109,6 @@
|
|
|
15102
15109
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
15103
15110
|
}, _typeof$u(obj);
|
|
15104
15111
|
}
|
|
15105
|
-
function _objectWithoutProperties$8(source, excluded) {
|
|
15106
|
-
if (source == null) return {};
|
|
15107
|
-
var target = _objectWithoutPropertiesLoose$9(source, excluded);
|
|
15108
|
-
var key, i;
|
|
15109
|
-
if (Object.getOwnPropertySymbols) {
|
|
15110
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
15111
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
15112
|
-
key = sourceSymbolKeys[i];
|
|
15113
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
15114
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
15115
|
-
target[key] = source[key];
|
|
15116
|
-
}
|
|
15117
|
-
}
|
|
15118
|
-
return target;
|
|
15119
|
-
}
|
|
15120
|
-
function _objectWithoutPropertiesLoose$9(source, excluded) {
|
|
15121
|
-
if (source == null) return {};
|
|
15122
|
-
var target = {};
|
|
15123
|
-
var sourceKeys = Object.keys(source);
|
|
15124
|
-
var key, i;
|
|
15125
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
15126
|
-
key = sourceKeys[i];
|
|
15127
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
15128
|
-
target[key] = source[key];
|
|
15129
|
-
}
|
|
15130
|
-
return target;
|
|
15131
|
-
}
|
|
15132
15112
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
15133
15113
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
15134
15114
|
if (!it) {
|
|
@@ -15363,7 +15343,7 @@
|
|
|
15363
15343
|
var max = values['<='] && values['<='][0] || '';
|
|
15364
15344
|
return removeEmptyRefinementsFromUiState$3(_objectSpread$p(_objectSpread$p({}, uiState), {}, {
|
|
15365
15345
|
numericMenu: _objectSpread$p(_objectSpread$p({}, uiState.numericMenu), {}, _defineProperty$r({}, attribute, "".concat(min, ":").concat(max)))
|
|
15366
|
-
}));
|
|
15346
|
+
}), attribute);
|
|
15367
15347
|
},
|
|
15368
15348
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
15369
15349
|
var uiState = _ref6.uiState;
|
|
@@ -15525,18 +15505,17 @@
|
|
|
15525
15505
|
function hasNumericRefinement(currentRefinements, operator, value) {
|
|
15526
15506
|
return currentRefinements[operator] !== undefined && currentRefinements[operator].includes(value);
|
|
15527
15507
|
}
|
|
15528
|
-
function removeEmptyRefinementsFromUiState$3(indexUiState) {
|
|
15529
|
-
|
|
15530
|
-
indexUiStateBase = _objectWithoutProperties$8(indexUiState, _excluded$c);
|
|
15531
|
-
if (!numericMenu) {
|
|
15508
|
+
function removeEmptyRefinementsFromUiState$3(indexUiState, attribute) {
|
|
15509
|
+
if (!indexUiState.numericMenu) {
|
|
15532
15510
|
return indexUiState;
|
|
15533
15511
|
}
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
}
|
|
15537
|
-
|
|
15538
|
-
numericMenu
|
|
15539
|
-
}
|
|
15512
|
+
if (indexUiState.numericMenu[attribute] === ':') {
|
|
15513
|
+
delete indexUiState.numericMenu[attribute];
|
|
15514
|
+
}
|
|
15515
|
+
if (Object.keys(indexUiState.numericMenu).length === 0) {
|
|
15516
|
+
delete indexUiState.numericMenu;
|
|
15517
|
+
}
|
|
15518
|
+
return indexUiState;
|
|
15540
15519
|
}
|
|
15541
15520
|
|
|
15542
15521
|
function useNumericMenu(props, additionalWidgetProperties) {
|
|
@@ -16485,9 +16464,8 @@
|
|
|
16485
16464
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
16486
16465
|
}, _typeof$z(obj);
|
|
16487
16466
|
}
|
|
16488
|
-
var _excluded$
|
|
16489
|
-
_excluded2$
|
|
16490
|
-
_excluded3 = ["refinementList"];
|
|
16467
|
+
var _excluded$b = ["name", "escapedValue"],
|
|
16468
|
+
_excluded2$2 = ["escapedValue", "value"];
|
|
16491
16469
|
function ownKeys$u(object, enumerableOnly) {
|
|
16492
16470
|
var keys = Object.keys(object);
|
|
16493
16471
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -16537,9 +16515,9 @@
|
|
|
16537
16515
|
}
|
|
16538
16516
|
return (hint === "string" ? String : Number)(input);
|
|
16539
16517
|
}
|
|
16540
|
-
function _objectWithoutProperties$
|
|
16518
|
+
function _objectWithoutProperties$7(source, excluded) {
|
|
16541
16519
|
if (source == null) return {};
|
|
16542
|
-
var target = _objectWithoutPropertiesLoose$
|
|
16520
|
+
var target = _objectWithoutPropertiesLoose$8(source, excluded);
|
|
16543
16521
|
var key, i;
|
|
16544
16522
|
if (Object.getOwnPropertySymbols) {
|
|
16545
16523
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -16552,7 +16530,7 @@
|
|
|
16552
16530
|
}
|
|
16553
16531
|
return target;
|
|
16554
16532
|
}
|
|
16555
|
-
function _objectWithoutPropertiesLoose$
|
|
16533
|
+
function _objectWithoutPropertiesLoose$8(source, excluded) {
|
|
16556
16534
|
if (source == null) return {};
|
|
16557
16535
|
var target = {};
|
|
16558
16536
|
var sourceKeys = Object.keys(source);
|
|
@@ -16615,7 +16593,7 @@
|
|
|
16615
16593
|
var formatItems = function formatItems(_ref2) {
|
|
16616
16594
|
var label = _ref2.name,
|
|
16617
16595
|
value = _ref2.escapedValue,
|
|
16618
|
-
item = _objectWithoutProperties$
|
|
16596
|
+
item = _objectWithoutProperties$7(_ref2, _excluded$b);
|
|
16619
16597
|
return _objectSpread$t(_objectSpread$t({}, item), {}, {
|
|
16620
16598
|
value: value,
|
|
16621
16599
|
label: label,
|
|
@@ -16672,7 +16650,7 @@
|
|
|
16672
16650
|
var normalizedFacetValues = transformItems(facetValues.map(function (_ref3) {
|
|
16673
16651
|
var escapedValue = _ref3.escapedValue,
|
|
16674
16652
|
value = _ref3.value,
|
|
16675
|
-
item = _objectWithoutProperties$
|
|
16653
|
+
item = _objectWithoutProperties$7(_ref3, _excluded2$2);
|
|
16676
16654
|
return _objectSpread$t(_objectSpread$t({}, item), {}, {
|
|
16677
16655
|
value: escapedValue,
|
|
16678
16656
|
label: value
|
|
@@ -16800,7 +16778,7 @@
|
|
|
16800
16778
|
var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
|
|
16801
16779
|
return removeEmptyRefinementsFromUiState$4(_objectSpread$t(_objectSpread$t({}, uiState), {}, {
|
|
16802
16780
|
refinementList: _objectSpread$t(_objectSpread$t({}, uiState.refinementList), {}, _defineProperty$w({}, attribute, values))
|
|
16803
|
-
}));
|
|
16781
|
+
}), attribute);
|
|
16804
16782
|
},
|
|
16805
16783
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
16806
16784
|
var uiState = _ref6.uiState;
|
|
@@ -16828,18 +16806,17 @@
|
|
|
16828
16806
|
};
|
|
16829
16807
|
};
|
|
16830
16808
|
};
|
|
16831
|
-
function removeEmptyRefinementsFromUiState$4(indexUiState) {
|
|
16832
|
-
|
|
16833
|
-
indexUiStateBase = _objectWithoutProperties$9(indexUiState, _excluded3);
|
|
16834
|
-
if (!refinementList) {
|
|
16809
|
+
function removeEmptyRefinementsFromUiState$4(indexUiState, attribute) {
|
|
16810
|
+
if (!indexUiState.refinementList) {
|
|
16835
16811
|
return indexUiState;
|
|
16836
16812
|
}
|
|
16837
|
-
|
|
16838
|
-
|
|
16839
|
-
}
|
|
16840
|
-
|
|
16841
|
-
refinementList
|
|
16842
|
-
}
|
|
16813
|
+
if (!indexUiState.refinementList[attribute] || indexUiState.refinementList[attribute].length === 0) {
|
|
16814
|
+
delete indexUiState.refinementList[attribute];
|
|
16815
|
+
}
|
|
16816
|
+
if (Object.keys(indexUiState.refinementList).length === 0) {
|
|
16817
|
+
delete indexUiState.refinementList;
|
|
16818
|
+
}
|
|
16819
|
+
return indexUiState;
|
|
16843
16820
|
}
|
|
16844
16821
|
|
|
16845
16822
|
function useRefinementList(props, additionalWidgetProperties) {
|