react-instantsearch-core 7.6.0 → 7.7.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/lib/useWidget.js +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/es/lib/useWidget.js +2 -2
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +61 -6
- 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 +8 -7
|
@@ -38,7 +38,7 @@ function useWidget(_ref) {
|
|
|
38
38
|
|
|
39
39
|
// Scenario 1: the widget is added for the first time.
|
|
40
40
|
if (!cleanupTimerRef.current) {
|
|
41
|
-
if (!
|
|
41
|
+
if (!shouldSsr) {
|
|
42
42
|
parentIndex.addWidgets([widget]);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -75,7 +75,7 @@ function useWidget(_ref) {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
|
-
}, [parentIndex, widget,
|
|
78
|
+
}, [parentIndex, widget, shouldSsr, search, props]);
|
|
79
79
|
if (shouldAddWidgetEarly || (waitingForResultsRef === null || waitingForResultsRef === void 0 ? void 0 : (_waitingForResultsRef = waitingForResultsRef.current) === null || _waitingForResultsRef === void 0 ? void 0 : _waitingForResultsRef.status) === 'pending') {
|
|
80
80
|
parentIndex.addWidgets([widget]);
|
|
81
81
|
}
|
package/dist/cjs/version.js
CHANGED
package/dist/es/lib/useWidget.js
CHANGED
|
@@ -32,7 +32,7 @@ export function useWidget(_ref) {
|
|
|
32
32
|
|
|
33
33
|
// Scenario 1: the widget is added for the first time.
|
|
34
34
|
if (!cleanupTimerRef.current) {
|
|
35
|
-
if (!
|
|
35
|
+
if (!shouldSsr) {
|
|
36
36
|
parentIndex.addWidgets([widget]);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -69,7 +69,7 @@ export function useWidget(_ref) {
|
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
};
|
|
72
|
-
}, [parentIndex, widget,
|
|
72
|
+
}, [parentIndex, widget, shouldSsr, search, props]);
|
|
73
73
|
if (shouldAddWidgetEarly || (waitingForResultsRef === null || waitingForResultsRef === void 0 ? void 0 : (_waitingForResultsRef = waitingForResultsRef.current) === null || _waitingForResultsRef === void 0 ? void 0 : _waitingForResultsRef.status) === 'pending') {
|
|
74
74
|
parentIndex.addWidgets([widget]);
|
|
75
75
|
}
|
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.
|
|
1
|
+
declare const _default: "7.7.1";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '7.
|
|
1
|
+
export default '7.7.1';
|
|
@@ -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.7.1';
|
|
11
11
|
|
|
12
12
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
13
13
|
//
|
|
@@ -497,6 +497,42 @@
|
|
|
497
497
|
|
|
498
498
|
var omit = _objectWithoutPropertiesLoose;
|
|
499
499
|
|
|
500
|
+
/**
|
|
501
|
+
* RecommendParameters is the data structure that contains all the information
|
|
502
|
+
* usable for getting recommendations from the Algolia API. It doesn't do the
|
|
503
|
+
* search itself, nor does it contains logic about the parameters.
|
|
504
|
+
* It is an immutable object, therefore it has been created in a way that each
|
|
505
|
+
* changes does not change the object itself but returns a copy with the
|
|
506
|
+
* modification.
|
|
507
|
+
* This object should probably not be instantiated outside of the helper. It
|
|
508
|
+
* will be provided when needed.
|
|
509
|
+
* @constructor
|
|
510
|
+
* @classdesc contains all the parameters for recommendations
|
|
511
|
+
* @param {RecommendParametersOptions} opts the options to create the object
|
|
512
|
+
*/
|
|
513
|
+
function RecommendParameters(opts) {
|
|
514
|
+
opts = opts || {};
|
|
515
|
+
this.params = opts.params || [];
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
RecommendParameters.prototype = {
|
|
519
|
+
constructor: RecommendParameters,
|
|
520
|
+
|
|
521
|
+
addParams: function (params) {
|
|
522
|
+
return new RecommendParameters({ params: this.params.concat(params) });
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
removeParams: function (id) {
|
|
526
|
+
return new RecommendParameters({
|
|
527
|
+
params: this.params.filter(function (param) {
|
|
528
|
+
return param.$$id !== id;
|
|
529
|
+
}),
|
|
530
|
+
});
|
|
531
|
+
},
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
var RecommendParameters_1 = RecommendParameters;
|
|
535
|
+
|
|
500
536
|
function sortObject(obj) {
|
|
501
537
|
return Object.keys(obj)
|
|
502
538
|
.sort()
|
|
@@ -3942,7 +3978,8 @@
|
|
|
3942
3978
|
* @return {undefined} function mutates the item
|
|
3943
3979
|
*/
|
|
3944
3980
|
function setIsRefined(item, currentRefinement, depth) {
|
|
3945
|
-
item.isRefined =
|
|
3981
|
+
item.isRefined =
|
|
3982
|
+
item.name === (currentRefinement[depth] && currentRefinement[depth].trim());
|
|
3946
3983
|
if (item.data) {
|
|
3947
3984
|
item.data.forEach(function (child) {
|
|
3948
3985
|
setIsRefined(child, currentRefinement, depth + 1);
|
|
@@ -4343,7 +4380,7 @@
|
|
|
4343
4380
|
|
|
4344
4381
|
var SearchResults_1 = SearchResults;
|
|
4345
4382
|
|
|
4346
|
-
var version$1 = '3.
|
|
4383
|
+
var version$1 = '3.17.0';
|
|
4347
4384
|
|
|
4348
4385
|
var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
|
|
4349
4386
|
|
|
@@ -4355,6 +4392,7 @@
|
|
|
4355
4392
|
|
|
4356
4393
|
|
|
4357
4394
|
|
|
4395
|
+
|
|
4358
4396
|
/**
|
|
4359
4397
|
* Event triggered when a parameter is set or updated
|
|
4360
4398
|
* @event AlgoliaSearchHelper#event:change
|
|
@@ -4468,6 +4506,9 @@
|
|
|
4468
4506
|
var opts = options || {};
|
|
4469
4507
|
opts.index = index;
|
|
4470
4508
|
this.state = SearchParameters_1.make(opts);
|
|
4509
|
+
this.recommendState = new RecommendParameters_1({
|
|
4510
|
+
params: opts.recommendState,
|
|
4511
|
+
});
|
|
4471
4512
|
this.lastResults = null;
|
|
4472
4513
|
this._queryId = 0;
|
|
4473
4514
|
this._lastQueryIdReceived = -1;
|
|
@@ -5851,6 +5892,17 @@
|
|
|
5851
5892
|
}
|
|
5852
5893
|
};
|
|
5853
5894
|
|
|
5895
|
+
AlgoliaSearchHelper.prototype._recommendChange = function (event) {
|
|
5896
|
+
var state = event.state;
|
|
5897
|
+
|
|
5898
|
+
if (state !== this.recommendState) {
|
|
5899
|
+
this.recommendState = state;
|
|
5900
|
+
|
|
5901
|
+
// eslint-disable-next-line no-warning-comments
|
|
5902
|
+
// TODO: emit "change" event when events for Recommend are implemented
|
|
5903
|
+
}
|
|
5904
|
+
};
|
|
5905
|
+
|
|
5854
5906
|
/**
|
|
5855
5907
|
* Clears the cache of the underlying Algolia client.
|
|
5856
5908
|
* @return {AlgoliaSearchHelper} Method is chainable, it returns itself
|
|
@@ -8437,7 +8489,7 @@
|
|
|
8437
8489
|
|
|
8438
8490
|
// Scenario 1: the widget is added for the first time.
|
|
8439
8491
|
if (!cleanupTimerRef.current) {
|
|
8440
|
-
if (!
|
|
8492
|
+
if (!shouldSsr) {
|
|
8441
8493
|
parentIndex.addWidgets([widget]);
|
|
8442
8494
|
}
|
|
8443
8495
|
}
|
|
@@ -8474,7 +8526,7 @@
|
|
|
8474
8526
|
});
|
|
8475
8527
|
});
|
|
8476
8528
|
};
|
|
8477
|
-
}, [parentIndex, widget,
|
|
8529
|
+
}, [parentIndex, widget, shouldSsr, search, props]);
|
|
8478
8530
|
if (shouldAddWidgetEarly || (waitingForResultsRef === null || waitingForResultsRef === void 0 ? void 0 : (_waitingForResultsRef = waitingForResultsRef.current) === null || _waitingForResultsRef === void 0 ? void 0 : _waitingForResultsRef.status) === 'pending') {
|
|
8479
8531
|
parentIndex.addWidgets([widget]);
|
|
8480
8532
|
}
|
|
@@ -11706,7 +11758,7 @@
|
|
|
11706
11758
|
};
|
|
11707
11759
|
}
|
|
11708
11760
|
|
|
11709
|
-
var version$2 = '4.
|
|
11761
|
+
var version$2 = '4.66.1';
|
|
11710
11762
|
|
|
11711
11763
|
function _typeof$k(obj) {
|
|
11712
11764
|
"@babel/helpers - typeof";
|
|
@@ -14220,6 +14272,8 @@
|
|
|
14220
14272
|
if (!escapeHTML) {
|
|
14221
14273
|
return state;
|
|
14222
14274
|
}
|
|
14275
|
+
|
|
14276
|
+
// @MAJOR: set this globally, not in the Hits widget to allow Hits to be conditionally used
|
|
14223
14277
|
return state.setQueryParameters(TAG_PLACEHOLDER);
|
|
14224
14278
|
}
|
|
14225
14279
|
};
|
|
@@ -14799,6 +14853,7 @@
|
|
|
14799
14853
|
var uiState = _ref10.uiState;
|
|
14800
14854
|
var widgetSearchParameters = searchParameters;
|
|
14801
14855
|
if (escapeHTML) {
|
|
14856
|
+
// @MAJOR: set this globally, not in the InfiniteHits widget to allow InfiniteHits to be conditionally used
|
|
14802
14857
|
widgetSearchParameters = searchParameters.setQueryParameters(TAG_PLACEHOLDER);
|
|
14803
14858
|
}
|
|
14804
14859
|
|