react-instantsearch-core 7.7.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.
@@ -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 (!shouldAddWidgetEarly) {
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, shouldAddWidgetEarly, search, props]);
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
  }
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '7.7.0';
7
+ var _default = '7.7.1';
8
8
  exports.default = _default;
@@ -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 (!shouldAddWidgetEarly) {
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, shouldAddWidgetEarly, search, props]);
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
  }
@@ -1,2 +1,2 @@
1
- declare const _default: "7.7.0";
1
+ declare const _default: "7.7.1";
2
2
  export default _default;
@@ -1 +1 @@
1
- export default '7.7.0';
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.7.0';
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()
@@ -4344,7 +4380,7 @@
4344
4380
 
4345
4381
  var SearchResults_1 = SearchResults;
4346
4382
 
4347
- var version$1 = '3.16.3';
4383
+ var version$1 = '3.17.0';
4348
4384
 
4349
4385
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4350
4386
 
@@ -4356,6 +4392,7 @@
4356
4392
 
4357
4393
 
4358
4394
 
4395
+
4359
4396
  /**
4360
4397
  * Event triggered when a parameter is set or updated
4361
4398
  * @event AlgoliaSearchHelper#event:change
@@ -4469,6 +4506,9 @@
4469
4506
  var opts = options || {};
4470
4507
  opts.index = index;
4471
4508
  this.state = SearchParameters_1.make(opts);
4509
+ this.recommendState = new RecommendParameters_1({
4510
+ params: opts.recommendState,
4511
+ });
4472
4512
  this.lastResults = null;
4473
4513
  this._queryId = 0;
4474
4514
  this._lastQueryIdReceived = -1;
@@ -5852,6 +5892,17 @@
5852
5892
  }
5853
5893
  };
5854
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
+
5855
5906
  /**
5856
5907
  * Clears the cache of the underlying Algolia client.
5857
5908
  * @return {AlgoliaSearchHelper} Method is chainable, it returns itself
@@ -8438,7 +8489,7 @@
8438
8489
 
8439
8490
  // Scenario 1: the widget is added for the first time.
8440
8491
  if (!cleanupTimerRef.current) {
8441
- if (!shouldAddWidgetEarly) {
8492
+ if (!shouldSsr) {
8442
8493
  parentIndex.addWidgets([widget]);
8443
8494
  }
8444
8495
  }
@@ -8475,7 +8526,7 @@
8475
8526
  });
8476
8527
  });
8477
8528
  };
8478
- }, [parentIndex, widget, shouldAddWidgetEarly, search, props]);
8529
+ }, [parentIndex, widget, shouldSsr, search, props]);
8479
8530
  if (shouldAddWidgetEarly || (waitingForResultsRef === null || waitingForResultsRef === void 0 ? void 0 : (_waitingForResultsRef = waitingForResultsRef.current) === null || _waitingForResultsRef === void 0 ? void 0 : _waitingForResultsRef.status) === 'pending') {
8480
8531
  parentIndex.addWidgets([widget]);
8481
8532
  }
@@ -11707,7 +11758,7 @@
11707
11758
  };
11708
11759
  }
11709
11760
 
11710
- var version$2 = '4.66.0';
11761
+ var version$2 = '4.66.1';
11711
11762
 
11712
11763
  function _typeof$k(obj) {
11713
11764
  "@babel/helpers - typeof";
@@ -14221,6 +14272,8 @@
14221
14272
  if (!escapeHTML) {
14222
14273
  return state;
14223
14274
  }
14275
+
14276
+ // @MAJOR: set this globally, not in the Hits widget to allow Hits to be conditionally used
14224
14277
  return state.setQueryParameters(TAG_PLACEHOLDER);
14225
14278
  }
14226
14279
  };
@@ -14800,6 +14853,7 @@
14800
14853
  var uiState = _ref10.uiState;
14801
14854
  var widgetSearchParameters = searchParameters;
14802
14855
  if (escapeHTML) {
14856
+ // @MAJOR: set this globally, not in the InfiniteHits widget to allow InfiniteHits to be conditionally used
14803
14857
  widgetSearchParameters = searchParameters.setQueryParameters(TAG_PLACEHOLDER);
14804
14858
  }
14805
14859