algolia-experiences 1.5.10 → 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)
@@ -10603,10 +10617,14 @@
10603
10617
  var insightsClientWithLocalCredentials = insightsClient;
10604
10618
  if (isModernInsightsClient(insightsClient)) {
10605
10619
  insightsClientWithLocalCredentials = function insightsClientWithLocalCredentials(method, payload) {
10620
+ var _getAppIdAndApiKey3 = getAppIdAndApiKey(instantSearchInstance.client),
10621
+ _getAppIdAndApiKey4 = _slicedToArray$4(_getAppIdAndApiKey3, 2),
10622
+ latestAppId = _getAppIdAndApiKey4[0],
10623
+ latestApiKey = _getAppIdAndApiKey4[1];
10606
10624
  var extraParams = {
10607
10625
  headers: {
10608
- 'X-Algolia-Application-Id': appId,
10609
- 'X-Algolia-API-Key': apiKey
10626
+ 'X-Algolia-Application-Id': latestAppId,
10627
+ 'X-Algolia-API-Key': latestApiKey
10610
10628
  }
10611
10629
  };
10612
10630
 
@@ -13051,7 +13069,7 @@
13051
13069
  };
13052
13070
  }
13053
13071
 
13054
- var version$1 = '4.78.2';
13072
+ var version$1 = '4.79.0';
13055
13073
 
13056
13074
  function _typeof$j(o) {
13057
13075
  "@babel/helpers - typeof";
@@ -13251,6 +13269,8 @@
13251
13269
  _defineProperty$h(_assertThisInitialized$1(_this), "_searchStalledTimer", void 0);
13252
13270
  _defineProperty$h(_assertThisInitialized$1(_this), "_initialUiState", void 0);
13253
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);
13254
13274
  _defineProperty$h(_assertThisInitialized$1(_this), "_createURL", void 0);
13255
13275
  _defineProperty$h(_assertThisInitialized$1(_this), "_searchFunction", void 0);
13256
13276
  _defineProperty$h(_assertThisInitialized$1(_this), "_mainHelperSearch", void 0);
@@ -13643,14 +13663,25 @@
13643
13663
  // because we already have the results to render. This skips the initial
13644
13664
  // network request on the browser on `start`.
13645
13665
  this.scheduleSearch = defer(noop);
13646
- // We also skip the initial network request when widgets are dynamically
13647
- // added in the first tick (that's the case in all the framework-based flavors).
13648
- // When we add a widget to `index`, it calls `scheduleSearch`. We can rely
13649
- // on our `defer` util to restore the original `scheduleSearch` value once
13650
- // widgets are added to hook back to the regular lifecycle.
13651
- defer(function () {
13652
- _this3.scheduleSearch = originalScheduleSearch;
13653
- })();
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
+ }
13654
13685
  }
13655
13686
  // We only schedule a search when widgets have been added before `start()`
13656
13687
  // because there are listeners that can use these results.
@@ -17125,9 +17156,7 @@
17125
17156
  if (!results || state.hierarchicalFacets.length === 0) {
17126
17157
  return [];
17127
17158
  }
17128
- var _state$hierarchicalFa = _slicedToArray$5(state.hierarchicalFacets, 1),
17129
- facetName = _state$hierarchicalFa[0].name;
17130
- var facetValues = results.getFacetValues(facetName, {});
17159
+ var facetValues = results.getFacetValues(hierarchicalFacetName, {});
17131
17160
  var facetItems = facetValues && !Array.isArray(facetValues) && facetValues.data ? facetValues.data : [];
17132
17161
  var items = transformItems(shiftItemsValues(prepareItems(facetItems)), {
17133
17162
  results: results
@@ -18999,6 +19028,9 @@
18999
19028
  }, {
19000
19029
  key: "refineFirstValue",
19001
19030
  value: function refineFirstValue() {
19031
+ if (this.props.searchableSelectOnSubmit === false) {
19032
+ return;
19033
+ }
19002
19034
  var firstValue = this.props.facetValues && this.props.facetValues[0];
19003
19035
  if (firstValue) {
19004
19036
  var actualValue = firstValue.value;
@@ -21105,9 +21137,11 @@
21105
21137
  state: normalizeState(state)
21106
21138
  }) || {};
21107
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];
21108
- if (!results) {
21140
+ if (!showPrevious) {
21109
21141
  showPrevious = getShowPrevious(helper);
21110
21142
  showMore = getShowMore(helper);
21143
+ }
21144
+ if (!sendEvent) {
21111
21145
  sendEvent = createSendEventForHits({
21112
21146
  instantSearchInstance: instantSearchInstance,
21113
21147
  helper: helper,
@@ -21118,6 +21152,8 @@
21118
21152
  widgetType: this.$$type,
21119
21153
  instantSearchInstance: instantSearchInstance
21120
21154
  });
21155
+ }
21156
+ if (!results) {
21121
21157
  isFirstPage = state.page === undefined || getFirstReceivedPage(state, cachedHits) === 0;
21122
21158
  } else {
21123
21159
  var _state$disjunctiveFac, _state$hierarchicalFa;
@@ -27094,7 +27130,8 @@
27094
27130
  showMore = _ref.showMore,
27095
27131
  searchable = _ref.searchable,
27096
27132
  searchablePlaceholder = _ref.searchablePlaceholder,
27097
- searchableIsAlwaysActive = _ref.searchableIsAlwaysActive;
27133
+ searchableIsAlwaysActive = _ref.searchableIsAlwaysActive,
27134
+ searchableSelectOnSubmit = _ref.searchableSelectOnSubmit;
27098
27135
  return function (_ref2, isFirstRendering) {
27099
27136
  var refine = _ref2.refine,
27100
27137
  items = _ref2.items,
@@ -27134,7 +27171,8 @@
27134
27171
  toggleShowMore: toggleShowMore,
27135
27172
  isShowingMore: isShowingMore,
27136
27173
  hasExhaustiveItems: hasExhaustiveItems,
27137
- canToggleShowMore: canToggleShowMore
27174
+ canToggleShowMore: canToggleShowMore,
27175
+ searchableSelectOnSubmit: searchableSelectOnSubmit
27138
27176
  }), containerNode);
27139
27177
  };
27140
27178
  };
@@ -27174,6 +27212,8 @@
27174
27212
  searchableEscapeFacetValues = _ref3$searchableEscap === void 0 ? true : _ref3$searchableEscap,
27175
27213
  _ref3$searchableIsAlw = _ref3.searchableIsAlwaysActive,
27176
27214
  searchableIsAlwaysActive = _ref3$searchableIsAlw === void 0 ? true : _ref3$searchableIsAlw,
27215
+ _ref3$searchableSelec = _ref3.searchableSelectOnSubmit,
27216
+ searchableSelectOnSubmit = _ref3$searchableSelec === void 0 ? true : _ref3$searchableSelec,
27177
27217
  _ref3$cssClasses = _ref3.cssClasses,
27178
27218
  userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses,
27179
27219
  _ref3$templates = _ref3.templates,
@@ -27265,6 +27305,7 @@
27265
27305
  searchable: searchable,
27266
27306
  searchablePlaceholder: searchablePlaceholder,
27267
27307
  searchableIsAlwaysActive: searchableIsAlwaysActive,
27308
+ searchableSelectOnSubmit: searchableSelectOnSubmit,
27268
27309
  showMore: showMore
27269
27310
  });
27270
27311
  var makeWidget = connectRefinementList(specializedRenderer, function () {