react-instantsearch 7.5.2 → 7.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
var React__default = 'default' in React ? React['default'] : React;
|
|
9
9
|
|
|
10
|
-
var version = '7.5.
|
|
10
|
+
var version = '7.5.3';
|
|
11
11
|
|
|
12
12
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
13
13
|
//
|
|
@@ -772,9 +772,12 @@
|
|
|
772
772
|
.sort()
|
|
773
773
|
.forEach(function (facetName) {
|
|
774
774
|
var facetValues = facetsRefinements[facetName] || [];
|
|
775
|
-
facetValues
|
|
776
|
-
|
|
777
|
-
|
|
775
|
+
facetValues
|
|
776
|
+
.slice()
|
|
777
|
+
.sort()
|
|
778
|
+
.forEach(function (facetValue) {
|
|
779
|
+
facetFilters.push(facetName + ':' + facetValue);
|
|
780
|
+
});
|
|
778
781
|
});
|
|
779
782
|
|
|
780
783
|
var facetsExcludes = state.facetsExcludes || {};
|
|
@@ -797,9 +800,12 @@
|
|
|
797
800
|
}
|
|
798
801
|
var orFilters = [];
|
|
799
802
|
|
|
800
|
-
facetValues
|
|
801
|
-
|
|
802
|
-
|
|
803
|
+
facetValues
|
|
804
|
+
.slice()
|
|
805
|
+
.sort()
|
|
806
|
+
.forEach(function (facetValue) {
|
|
807
|
+
orFilters.push(facetName + ':' + facetValue);
|
|
808
|
+
});
|
|
803
809
|
|
|
804
810
|
facetFilters.push(orFilters);
|
|
805
811
|
});
|
|
@@ -1465,7 +1471,7 @@
|
|
|
1465
1471
|
numbers.numericRefinements = numericRefinements;
|
|
1466
1472
|
}
|
|
1467
1473
|
|
|
1468
|
-
return merge_1(
|
|
1474
|
+
return merge_1(partialState, numbers);
|
|
1469
1475
|
};
|
|
1470
1476
|
|
|
1471
1477
|
/**
|
|
@@ -4337,7 +4343,7 @@
|
|
|
4337
4343
|
|
|
4338
4344
|
var SearchResults_1 = SearchResults;
|
|
4339
4345
|
|
|
4340
|
-
var version$1 = '3.16.
|
|
4346
|
+
var version$1 = '3.16.2';
|
|
4341
4347
|
|
|
4342
4348
|
var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
|
|
4343
4349
|
|
|
@@ -7637,13 +7643,16 @@
|
|
|
7637
7643
|
return;
|
|
7638
7644
|
}
|
|
7639
7645
|
var cachedRequest = Object.keys(results).map(function (key) {
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7646
|
+
var _results$key = results[key],
|
|
7647
|
+
state = _results$key.state,
|
|
7648
|
+
requestParams = _results$key.requestParams,
|
|
7649
|
+
serverResults = _results$key.results;
|
|
7650
|
+
return serverResults.map(function (result) {
|
|
7651
|
+
return _objectSpread$5({
|
|
7652
|
+
indexName: state.index || result.index
|
|
7653
|
+
}, requestParams || result.params ? {
|
|
7654
|
+
params: serializeQueryParameters(requestParams || deserializeQueryParameters(result.params))
|
|
7655
|
+
} : {});
|
|
7647
7656
|
});
|
|
7648
7657
|
});
|
|
7649
7658
|
var cachedResults = Object.keys(results).reduce(function (acc, key) {
|
|
@@ -12195,7 +12204,7 @@
|
|
|
12195
12204
|
};
|
|
12196
12205
|
}
|
|
12197
12206
|
|
|
12198
|
-
var version$3 = '4.64.
|
|
12207
|
+
var version$3 = '4.64.1';
|
|
12199
12208
|
|
|
12200
12209
|
function _typeof$o(obj) {
|
|
12201
12210
|
"@babel/helpers - typeof";
|
|
@@ -12663,9 +12672,7 @@
|
|
|
12663
12672
|
|
|
12664
12673
|
/**
|
|
12665
12674
|
* Ends the initialization of InstantSearch.js and triggers the
|
|
12666
|
-
* first search.
|
|
12667
|
-
* to the instance of InstantSearch.js. InstantSearch.js also supports adding and removing
|
|
12668
|
-
* widgets after the start as an **EXPERIMENTAL** feature.
|
|
12675
|
+
* first search.
|
|
12669
12676
|
*/
|
|
12670
12677
|
}, {
|
|
12671
12678
|
key: "start",
|
|
@@ -12816,9 +12823,7 @@
|
|
|
12816
12823
|
}
|
|
12817
12824
|
|
|
12818
12825
|
/**
|
|
12819
|
-
* Removes all widgets without triggering a search afterwards.
|
|
12820
|
-
* if you find an issue with it, please
|
|
12821
|
-
* [open an issue](https://github.com/algolia/instantsearch/issues/new?title=Problem%20with%20dispose).
|
|
12826
|
+
* Removes all widgets without triggering a search afterwards.
|
|
12822
12827
|
* @return {undefined} This method does not return anything
|
|
12823
12828
|
*/
|
|
12824
12829
|
}, {
|
|
@@ -16032,7 +16037,7 @@
|
|
|
16032
16037
|
dispose: function dispose(_ref4) {
|
|
16033
16038
|
var state = _ref4.state;
|
|
16034
16039
|
unmountFn();
|
|
16035
|
-
return state.
|
|
16040
|
+
return state.removeNumericRefinement(attribute);
|
|
16036
16041
|
},
|
|
16037
16042
|
getWidgetUiState: function getWidgetUiState(uiState, _ref5) {
|
|
16038
16043
|
var searchParameters = _ref5.searchParameters;
|
|
@@ -16052,11 +16057,11 @@
|
|
|
16052
16057
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
|
|
16053
16058
|
var uiState = _ref6.uiState;
|
|
16054
16059
|
var value = uiState.numericMenu && uiState.numericMenu[attribute];
|
|
16055
|
-
var withoutRefinements = searchParameters.
|
|
16060
|
+
var withoutRefinements = searchParameters.setQueryParameters({
|
|
16061
|
+
numericRefinements: _objectSpread$u(_objectSpread$u({}, searchParameters.numericRefinements), {}, _defineProperty$v({}, attribute, {}))
|
|
16062
|
+
});
|
|
16056
16063
|
if (!value) {
|
|
16057
|
-
return withoutRefinements
|
|
16058
|
-
numericRefinements: _objectSpread$u(_objectSpread$u({}, withoutRefinements.numericRefinements), {}, _defineProperty$v({}, attribute, {}))
|
|
16059
|
-
});
|
|
16064
|
+
return withoutRefinements;
|
|
16060
16065
|
}
|
|
16061
16066
|
var isExact = value.indexOf(':') === -1;
|
|
16062
16067
|
if (isExact) {
|
|
@@ -17494,8 +17499,7 @@
|
|
|
17494
17499
|
return searchParameters;
|
|
17495
17500
|
}
|
|
17496
17501
|
var values = uiState.refinementList && uiState.refinementList[attribute];
|
|
17497
|
-
var
|
|
17498
|
-
var withFacetConfiguration = isDisjunctive ? withoutRefinements.addDisjunctiveFacet(attribute) : withoutRefinements.addFacet(attribute);
|
|
17502
|
+
var withFacetConfiguration = isDisjunctive ? searchParameters.addDisjunctiveFacet(attribute).removeDisjunctiveFacetRefinement(attribute) : searchParameters.addFacet(attribute).removeFacetRefinement(attribute);
|
|
17499
17503
|
var currentMaxValuesPerFacet = withFacetConfiguration.maxValuesPerFacet || 0;
|
|
17500
17504
|
var nextMaxValuesPerFacet = Math.max(currentMaxValuesPerFacet, showMore ? showMoreLimit : limit);
|
|
17501
17505
|
var withMaxValuesPerFacet = withFacetConfiguration.setQueryParameter('maxValuesPerFacet', nextMaxValuesPerFacet);
|
|
@@ -18344,7 +18348,7 @@
|
|
|
18344
18348
|
if (searchParameters.isHierarchicalFacet(attribute) || searchParameters.isConjunctiveFacet(attribute)) {
|
|
18345
18349
|
return searchParameters;
|
|
18346
18350
|
}
|
|
18347
|
-
var withFacetConfiguration = searchParameters.
|
|
18351
|
+
var withFacetConfiguration = searchParameters.addDisjunctiveFacet(attribute).removeDisjunctiveFacetRefinement(attribute);
|
|
18348
18352
|
var isRefined = Boolean(uiState.toggle && uiState.toggle[attribute]);
|
|
18349
18353
|
if (isRefined) {
|
|
18350
18354
|
if (on) {
|
|
@@ -18694,12 +18698,26 @@
|
|
|
18694
18698
|
*/
|
|
18695
18699
|
function waitForResults(search) {
|
|
18696
18700
|
var helper = search.mainHelper;
|
|
18701
|
+
|
|
18702
|
+
// Extract search parameters from the search client to use them
|
|
18703
|
+
// later during hydration.
|
|
18704
|
+
var requestParamsList;
|
|
18705
|
+
var client = helper.getClient();
|
|
18706
|
+
helper.setClient({
|
|
18707
|
+
search: function search(queries) {
|
|
18708
|
+
requestParamsList = queries.map(function (_ref) {
|
|
18709
|
+
var params = _ref.params;
|
|
18710
|
+
return params;
|
|
18711
|
+
});
|
|
18712
|
+
return client.search(queries);
|
|
18713
|
+
}
|
|
18714
|
+
});
|
|
18697
18715
|
helper.searchOnlyWithDerivedHelpers();
|
|
18698
18716
|
return new Promise(function (resolve, reject) {
|
|
18699
18717
|
// All derived helpers resolve in the same tick so we're safe only relying
|
|
18700
18718
|
// on the first one.
|
|
18701
18719
|
helper.derivedHelpers[0].on('result', function () {
|
|
18702
|
-
resolve();
|
|
18720
|
+
resolve(requestParamsList);
|
|
18703
18721
|
});
|
|
18704
18722
|
|
|
18705
18723
|
// However, we listen to errors that can happen on any derived helper because
|
|
@@ -18721,17 +18739,26 @@
|
|
|
18721
18739
|
/**
|
|
18722
18740
|
* Walks the InstantSearch root index to construct the initial results.
|
|
18723
18741
|
*/
|
|
18724
|
-
function getInitialResults(rootIndex
|
|
18742
|
+
function getInitialResults(rootIndex,
|
|
18743
|
+
/**
|
|
18744
|
+
* Search parameters sent to the search client,
|
|
18745
|
+
* returned by `waitForResults()`.
|
|
18746
|
+
*/
|
|
18747
|
+
requestParamsList) {
|
|
18725
18748
|
var initialResults = {};
|
|
18749
|
+
var requestParamsIndex = 0;
|
|
18726
18750
|
walkIndex(rootIndex, function (widget) {
|
|
18727
18751
|
var searchResults = widget.getResults();
|
|
18728
18752
|
if (searchResults) {
|
|
18729
|
-
|
|
18753
|
+
var requestParams = requestParamsList === null || requestParamsList === void 0 ? void 0 : requestParamsList[requestParamsIndex++];
|
|
18754
|
+
initialResults[widget.getIndexId()] = _objectSpread$D({
|
|
18730
18755
|
// We convert the Helper state to a plain object to pass parsable data
|
|
18731
18756
|
// structures from server to client.
|
|
18732
18757
|
state: _objectSpread$D({}, searchResults._state),
|
|
18733
18758
|
results: searchResults._rawResults
|
|
18734
|
-
}
|
|
18759
|
+
}, requestParams && {
|
|
18760
|
+
requestParams: requestParams
|
|
18761
|
+
});
|
|
18735
18762
|
}
|
|
18736
18763
|
});
|
|
18737
18764
|
if (Object.keys(initialResults).length === 0) {
|
|
@@ -18816,9 +18843,9 @@
|
|
|
18816
18843
|
throw new Error("Unable to retrieve InstantSearch's server state in `getServerState()`. Did you mount the <InstantSearch> component?");
|
|
18817
18844
|
}
|
|
18818
18845
|
return waitForResults(searchRef.current);
|
|
18819
|
-
}).then(function () {
|
|
18846
|
+
}).then(function (requestParamsList) {
|
|
18820
18847
|
return {
|
|
18821
|
-
initialResults: getInitialResults(searchRef.current.mainIndex)
|
|
18848
|
+
initialResults: getInitialResults(searchRef.current.mainIndex, requestParamsList)
|
|
18822
18849
|
};
|
|
18823
18850
|
});
|
|
18824
18851
|
}
|