algolia-experiences 1.5.11 → 1.5.12

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.
@@ -5844,7 +5844,7 @@
5844
5844
 
5845
5845
  var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
5846
5846
 
5847
- var version = '3.25.0';
5847
+ var version = '3.26.0';
5848
5848
 
5849
5849
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
5850
5850
 
@@ -6280,6 +6280,16 @@
6280
6280
  query: query,
6281
6281
  });
6282
6282
 
6283
+ var hide =
6284
+ (this.lastResults &&
6285
+ this.lastResults.index === state.index &&
6286
+ this.lastResults.renderingContent &&
6287
+ this.lastResults.renderingContent.facetOrdering &&
6288
+ this.lastResults.renderingContent.facetOrdering.values &&
6289
+ this.lastResults.renderingContent.facetOrdering.values[facet] &&
6290
+ this.lastResults.renderingContent.facetOrdering.values[facet].hide) ||
6291
+ [];
6292
+
6283
6293
  return searchForFacetValuesPromise.then(
6284
6294
  function addIsRefined(content) {
6285
6295
  self._currentNbQueries--;
@@ -6287,7 +6297,11 @@
6287
6297
 
6288
6298
  content = Array.isArray(content) ? content[0] : content;
6289
6299
 
6290
- content.facetHits.forEach(function (f) {
6300
+ content.facetHits.forEach(function (f, i) {
6301
+ if (hide.indexOf(f.value) > -1) {
6302
+ content.facetHits.splice(i, 1);
6303
+ return;
6304
+ }
6291
6305
  f.escapedValue = escapeFacetValue$3(f.value);
6292
6306
  f.isRefined = isDisjunctive
6293
6307
  ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)
@@ -13055,7 +13069,7 @@
13055
13069
  };
13056
13070
  }
13057
13071
 
13058
- var version$1 = '4.78.3';
13072
+ var version$1 = '4.79.0';
13059
13073
 
13060
13074
  function _typeof$j(o) {
13061
13075
  "@babel/helpers - typeof";
@@ -13255,6 +13269,8 @@
13255
13269
  _defineProperty$h(_assertThisInitialized$1(_this), "_searchStalledTimer", void 0);
13256
13270
  _defineProperty$h(_assertThisInitialized$1(_this), "_initialUiState", void 0);
13257
13271
  _defineProperty$h(_assertThisInitialized$1(_this), "_initialResults", void 0);
13272
+ _defineProperty$h(_assertThisInitialized$1(_this), "_manuallyResetScheduleSearch", false);
13273
+ _defineProperty$h(_assertThisInitialized$1(_this), "_resetScheduleSearch", void 0);
13258
13274
  _defineProperty$h(_assertThisInitialized$1(_this), "_createURL", void 0);
13259
13275
  _defineProperty$h(_assertThisInitialized$1(_this), "_searchFunction", void 0);
13260
13276
  _defineProperty$h(_assertThisInitialized$1(_this), "_mainHelperSearch", void 0);
@@ -13647,14 +13663,25 @@
13647
13663
  // because we already have the results to render. This skips the initial
13648
13664
  // network request on the browser on `start`.
13649
13665
  this.scheduleSearch = defer(noop);
13650
- // We also skip the initial network request when widgets are dynamically
13651
- // added in the first tick (that's the case in all the framework-based flavors).
13652
- // When we add a widget to `index`, it calls `scheduleSearch`. We can rely
13653
- // on our `defer` util to restore the original `scheduleSearch` value once
13654
- // widgets are added to hook back to the regular lifecycle.
13655
- defer(function () {
13656
- _this3.scheduleSearch = originalScheduleSearch;
13657
- })();
13666
+ if (this._manuallyResetScheduleSearch) {
13667
+ // If `_manuallyResetScheduleSearch` is passed, it means that we don't
13668
+ // want to rely on a single `defer` to reset the `scheduleSearch`.
13669
+ // Instead, the consumer will call `_resetScheduleSearch` to restore
13670
+ // the original `scheduleSearch` function.
13671
+ // This happens in the React flavour after rendering.
13672
+ this._resetScheduleSearch = function () {
13673
+ _this3.scheduleSearch = originalScheduleSearch;
13674
+ };
13675
+ } else {
13676
+ // We also skip the initial network request when widgets are dynamically
13677
+ // added in the first tick (that's the case in all the framework-based flavors).
13678
+ // When we add a widget to `index`, it calls `scheduleSearch`. We can rely
13679
+ // on our `defer` util to restore the original `scheduleSearch` value once
13680
+ // widgets are added to hook back to the regular lifecycle.
13681
+ defer(function () {
13682
+ _this3.scheduleSearch = originalScheduleSearch;
13683
+ })();
13684
+ }
13658
13685
  }
13659
13686
  // We only schedule a search when widgets have been added before `start()`
13660
13687
  // because there are listeners that can use these results.
@@ -17129,9 +17156,7 @@
17129
17156
  if (!results || state.hierarchicalFacets.length === 0) {
17130
17157
  return [];
17131
17158
  }
17132
- var _state$hierarchicalFa = _slicedToArray$5(state.hierarchicalFacets, 1),
17133
- facetName = _state$hierarchicalFa[0].name;
17134
- var facetValues = results.getFacetValues(facetName, {});
17159
+ var facetValues = results.getFacetValues(hierarchicalFacetName, {});
17135
17160
  var facetItems = facetValues && !Array.isArray(facetValues) && facetValues.data ? facetValues.data : [];
17136
17161
  var items = transformItems(shiftItemsValues(prepareItems(facetItems)), {
17137
17162
  results: results
@@ -19003,6 +19028,9 @@
19003
19028
  }, {
19004
19029
  key: "refineFirstValue",
19005
19030
  value: function refineFirstValue() {
19031
+ if (this.props.searchableSelectOnSubmit === false) {
19032
+ return;
19033
+ }
19006
19034
  var firstValue = this.props.facetValues && this.props.facetValues[0];
19007
19035
  if (firstValue) {
19008
19036
  var actualValue = firstValue.value;
@@ -21109,9 +21137,11 @@
21109
21137
  state: normalizeState(state)
21110
21138
  }) || {};
21111
21139
  var banner = results === null || results === void 0 ? void 0 : (_results$renderingCon = results.renderingContent) === null || _results$renderingCon === void 0 ? void 0 : (_results$renderingCon2 = _results$renderingCon.widgets) === null || _results$renderingCon2 === void 0 ? void 0 : (_results$renderingCon3 = _results$renderingCon2.banners) === null || _results$renderingCon3 === void 0 ? void 0 : _results$renderingCon3[0];
21112
- if (!results) {
21140
+ if (!showPrevious) {
21113
21141
  showPrevious = getShowPrevious(helper);
21114
21142
  showMore = getShowMore(helper);
21143
+ }
21144
+ if (!sendEvent) {
21115
21145
  sendEvent = createSendEventForHits({
21116
21146
  instantSearchInstance: instantSearchInstance,
21117
21147
  helper: helper,
@@ -21122,6 +21152,8 @@
21122
21152
  widgetType: this.$$type,
21123
21153
  instantSearchInstance: instantSearchInstance
21124
21154
  });
21155
+ }
21156
+ if (!results) {
21125
21157
  isFirstPage = state.page === undefined || getFirstReceivedPage(state, cachedHits) === 0;
21126
21158
  } else {
21127
21159
  var _state$disjunctiveFac, _state$hierarchicalFa;
@@ -27098,7 +27130,8 @@
27098
27130
  showMore = _ref.showMore,
27099
27131
  searchable = _ref.searchable,
27100
27132
  searchablePlaceholder = _ref.searchablePlaceholder,
27101
- searchableIsAlwaysActive = _ref.searchableIsAlwaysActive;
27133
+ searchableIsAlwaysActive = _ref.searchableIsAlwaysActive,
27134
+ searchableSelectOnSubmit = _ref.searchableSelectOnSubmit;
27102
27135
  return function (_ref2, isFirstRendering) {
27103
27136
  var refine = _ref2.refine,
27104
27137
  items = _ref2.items,
@@ -27138,7 +27171,8 @@
27138
27171
  toggleShowMore: toggleShowMore,
27139
27172
  isShowingMore: isShowingMore,
27140
27173
  hasExhaustiveItems: hasExhaustiveItems,
27141
- canToggleShowMore: canToggleShowMore
27174
+ canToggleShowMore: canToggleShowMore,
27175
+ searchableSelectOnSubmit: searchableSelectOnSubmit
27142
27176
  }), containerNode);
27143
27177
  };
27144
27178
  };
@@ -27178,6 +27212,8 @@
27178
27212
  searchableEscapeFacetValues = _ref3$searchableEscap === void 0 ? true : _ref3$searchableEscap,
27179
27213
  _ref3$searchableIsAlw = _ref3.searchableIsAlwaysActive,
27180
27214
  searchableIsAlwaysActive = _ref3$searchableIsAlw === void 0 ? true : _ref3$searchableIsAlw,
27215
+ _ref3$searchableSelec = _ref3.searchableSelectOnSubmit,
27216
+ searchableSelectOnSubmit = _ref3$searchableSelec === void 0 ? true : _ref3$searchableSelec,
27181
27217
  _ref3$cssClasses = _ref3.cssClasses,
27182
27218
  userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses,
27183
27219
  _ref3$templates = _ref3.templates,
@@ -27269,6 +27305,7 @@
27269
27305
  searchable: searchable,
27270
27306
  searchablePlaceholder: searchablePlaceholder,
27271
27307
  searchableIsAlwaysActive: searchableIsAlwaysActive,
27308
+ searchableSelectOnSubmit: searchableSelectOnSubmit,
27272
27309
  showMore: showMore
27273
27310
  });
27274
27311
  var makeWidget = connectRefinementList(specializedRenderer, function () {