instantsearch.js 4.66.0 → 4.66.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.
@@ -108,6 +108,8 @@ var connectHits = function connectHits(renderFn) {
108
108
  if (!escapeHTML) {
109
109
  return state;
110
110
  }
111
+
112
+ // @MAJOR: set this globally, not in the Hits widget to allow Hits to be conditionally used
111
113
  return state.setQueryParameters(_utils.TAG_PLACEHOLDER);
112
114
  }
113
115
  };
@@ -256,6 +256,7 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
256
256
  var uiState = _ref10.uiState;
257
257
  var widgetSearchParameters = searchParameters;
258
258
  if (escapeHTML) {
259
+ // @MAJOR: set this globally, not in the InfiniteHits widget to allow InfiniteHits to be conditionally used
259
260
  widgetSearchParameters = searchParameters.setQueryParameters(_utils.TAG_PLACEHOLDER);
260
261
  }
261
262
 
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.66.0';
7
+ var _default = '4.66.1';
8
8
  exports.default = _default;
@@ -4243,6 +4243,8 @@ declare type RefinementListRenderState = {
4243
4243
  isFromSearch: boolean;
4244
4244
  /**
4245
4245
  * `true` if a refinement can be applied.
4246
+ * @MAJOR: reconsider how `canRefine` is computed so it both accounts for the
4247
+ * items returned in the main search and in SFFV.
4246
4248
  */
4247
4249
  canRefine: boolean;
4248
4250
  /**
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.66.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
1
+ /*! InstantSearch.js 4.66.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -2726,6 +2726,8 @@
2726
2726
  if (!escapeHTML) {
2727
2727
  return state;
2728
2728
  }
2729
+
2730
+ // @MAJOR: set this globally, not in the Hits widget to allow Hits to be conditionally used
2729
2731
  return state.setQueryParameters(TAG_PLACEHOLDER);
2730
2732
  }
2731
2733
  };
@@ -3314,6 +3316,7 @@
3314
3316
  var uiState = _ref10.uiState;
3315
3317
  var widgetSearchParameters = searchParameters;
3316
3318
  if (escapeHTML) {
3319
+ // @MAJOR: set this globally, not in the InfiniteHits widget to allow InfiniteHits to be conditionally used
3317
3320
  widgetSearchParameters = searchParameters.setQueryParameters(TAG_PLACEHOLDER);
3318
3321
  }
3319
3322
 
@@ -6260,6 +6263,42 @@
6260
6263
 
6261
6264
  var omit$1 = _objectWithoutPropertiesLoose$1;
6262
6265
 
6266
+ /**
6267
+ * RecommendParameters is the data structure that contains all the information
6268
+ * usable for getting recommendations from the Algolia API. It doesn't do the
6269
+ * search itself, nor does it contains logic about the parameters.
6270
+ * It is an immutable object, therefore it has been created in a way that each
6271
+ * changes does not change the object itself but returns a copy with the
6272
+ * modification.
6273
+ * This object should probably not be instantiated outside of the helper. It
6274
+ * will be provided when needed.
6275
+ * @constructor
6276
+ * @classdesc contains all the parameters for recommendations
6277
+ * @param {RecommendParametersOptions} opts the options to create the object
6278
+ */
6279
+ function RecommendParameters(opts) {
6280
+ opts = opts || {};
6281
+ this.params = opts.params || [];
6282
+ }
6283
+
6284
+ RecommendParameters.prototype = {
6285
+ constructor: RecommendParameters,
6286
+
6287
+ addParams: function (params) {
6288
+ return new RecommendParameters({ params: this.params.concat(params) });
6289
+ },
6290
+
6291
+ removeParams: function (id) {
6292
+ return new RecommendParameters({
6293
+ params: this.params.filter(function (param) {
6294
+ return param.$$id !== id;
6295
+ }),
6296
+ });
6297
+ },
6298
+ };
6299
+
6300
+ var RecommendParameters_1 = RecommendParameters;
6301
+
6263
6302
  function sortObject(obj) {
6264
6303
  return Object.keys(obj)
6265
6304
  .sort()
@@ -10107,7 +10146,7 @@
10107
10146
 
10108
10147
  var SearchResults_1 = SearchResults;
10109
10148
 
10110
- var version = '3.16.3';
10149
+ var version = '3.17.0';
10111
10150
 
10112
10151
  var escapeFacetValue$4 = escapeFacetValue_1.escapeFacetValue;
10113
10152
 
@@ -10119,6 +10158,7 @@
10119
10158
 
10120
10159
 
10121
10160
 
10161
+
10122
10162
  /**
10123
10163
  * Event triggered when a parameter is set or updated
10124
10164
  * @event AlgoliaSearchHelper#event:change
@@ -10232,6 +10272,9 @@
10232
10272
  var opts = options || {};
10233
10273
  opts.index = index;
10234
10274
  this.state = SearchParameters_1.make(opts);
10275
+ this.recommendState = new RecommendParameters_1({
10276
+ params: opts.recommendState,
10277
+ });
10235
10278
  this.lastResults = null;
10236
10279
  this._queryId = 0;
10237
10280
  this._lastQueryIdReceived = -1;
@@ -11615,6 +11658,17 @@
11615
11658
  }
11616
11659
  };
11617
11660
 
11661
+ AlgoliaSearchHelper.prototype._recommendChange = function (event) {
11662
+ var state = event.state;
11663
+
11664
+ if (state !== this.recommendState) {
11665
+ this.recommendState = state;
11666
+
11667
+ // eslint-disable-next-line no-warning-comments
11668
+ // TODO: emit "change" event when events for Recommend are implemented
11669
+ }
11670
+ };
11671
+
11618
11672
  /**
11619
11673
  * Clears the cache of the underlying Algolia client.
11620
11674
  * @return {AlgoliaSearchHelper} Method is chainable, it returns itself
@@ -14906,7 +14960,7 @@
14906
14960
  };
14907
14961
  }
14908
14962
 
14909
- var version$1 = '4.66.0';
14963
+ var version$1 = '4.66.1';
14910
14964
 
14911
14965
  var withUsage$r = createDocumentationMessageGenerator({
14912
14966
  name: 'instantsearch'