algolia-experiences 1.5.6 → 1.5.8

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.
@@ -5833,7 +5833,7 @@
5833
5833
 
5834
5834
  var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
5835
5835
 
5836
- var version = '3.24.0';
5836
+ var version = '3.24.2';
5837
5837
 
5838
5838
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
5839
5839
 
@@ -7676,8 +7676,11 @@
7676
7676
  if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');
7677
7677
 
7678
7678
  var results = content.results.slice();
7679
- var rawContent = Object.create(content);
7680
- delete rawContent.results;
7679
+ var rawContent = Object.keys(content).reduce(function (value, key) {
7680
+ if (key !== 'results') value[key] = content[key];
7681
+ return value;
7682
+ }, {});
7683
+
7681
7684
  if (Object.keys(rawContent).length <= 0) {
7682
7685
  rawContent = undefined;
7683
7686
  }
@@ -7701,12 +7704,11 @@
7701
7704
  specificResults,
7702
7705
  self._searchResultsOptions
7703
7706
  );
7704
- helper.lastResults._rawContent = rawContent;
7707
+ if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;
7705
7708
 
7706
7709
  helper.emit('result', {
7707
7710
  results: helper.lastResults,
7708
7711
  state: state,
7709
- _rawContent: rawContent,
7710
7712
  });
7711
7713
  });
7712
7714
  };
@@ -8516,6 +8518,7 @@
8516
8518
  instantSearchInstance.sendEventToInsights(args[0]);
8517
8519
  } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
8518
8520
  if (!isFacetRefined(helper, attribute, facetValue)) {
8521
+ var _helper$lastResults;
8519
8522
  // send event only when the facet is being checked "ON"
8520
8523
  instantSearchInstance.sendEventToInsights({
8521
8524
  insightsMethod: 'clickedFilters',
@@ -8524,7 +8527,7 @@
8524
8527
  eventModifier: eventModifier,
8525
8528
  payload: _objectSpread$1({
8526
8529
  eventName: eventName,
8527
- index: helper.getIndex(),
8530
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
8528
8531
  filters: ["".concat(attribute, ":").concat(facetValue)]
8529
8532
  }, additionalData),
8530
8533
  attribute: attribute
@@ -8658,7 +8661,7 @@
8658
8661
  return chunks;
8659
8662
  }
8660
8663
  function _buildEventPayloadsForHits(_ref) {
8661
- var getIndex = _ref.getIndex,
8664
+ var helper = _ref.helper,
8662
8665
  widgetType = _ref.widgetType,
8663
8666
  methodName = _ref.methodName,
8664
8667
  args = _ref.args,
@@ -8705,13 +8708,14 @@
8705
8708
  return [];
8706
8709
  }
8707
8710
  return hitsChunks.map(function (batch, i) {
8711
+ var _helper$lastResults;
8708
8712
  return {
8709
8713
  insightsMethod: 'viewedObjectIDs',
8710
8714
  widgetType: widgetType,
8711
8715
  eventType: eventType,
8712
8716
  payload: _objectSpread$2({
8713
8717
  eventName: eventName || 'Hits Viewed',
8714
- index: getIndex(),
8718
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
8715
8719
  objectIDs: objectIDsByChunk[i]
8716
8720
  }, additionalData),
8717
8721
  hits: batch,
@@ -8720,13 +8724,14 @@
8720
8724
  });
8721
8725
  } else if (eventType === 'click') {
8722
8726
  return hitsChunks.map(function (batch, i) {
8727
+ var _helper$lastResults2;
8723
8728
  return {
8724
8729
  insightsMethod: 'clickedObjectIDsAfterSearch',
8725
8730
  widgetType: widgetType,
8726
8731
  eventType: eventType,
8727
8732
  payload: _objectSpread$2({
8728
8733
  eventName: eventName || 'Hit Clicked',
8729
- index: getIndex(),
8734
+ index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
8730
8735
  queryID: queryID,
8731
8736
  objectIDs: objectIDsByChunk[i],
8732
8737
  positions: positionsByChunk[i]
@@ -8737,13 +8742,14 @@
8737
8742
  });
8738
8743
  } else if (eventType === 'conversion') {
8739
8744
  return hitsChunks.map(function (batch, i) {
8745
+ var _helper$lastResults3;
8740
8746
  return {
8741
8747
  insightsMethod: 'convertedObjectIDsAfterSearch',
8742
8748
  widgetType: widgetType,
8743
8749
  eventType: eventType,
8744
8750
  payload: _objectSpread$2({
8745
8751
  eventName: eventName || 'Hit Converted',
8746
- index: getIndex(),
8752
+ index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
8747
8753
  queryID: queryID,
8748
8754
  objectIDs: objectIDsByChunk[i]
8749
8755
  }, additionalData),
@@ -8757,7 +8763,7 @@
8757
8763
  }
8758
8764
  function createSendEventForHits(_ref2) {
8759
8765
  var instantSearchInstance = _ref2.instantSearchInstance,
8760
- getIndex = _ref2.getIndex,
8766
+ helper = _ref2.helper,
8761
8767
  widgetType = _ref2.widgetType;
8762
8768
  var sentEvents = {};
8763
8769
  var timer = undefined;
@@ -8767,7 +8773,7 @@
8767
8773
  }
8768
8774
  var payloads = _buildEventPayloadsForHits({
8769
8775
  widgetType: widgetType,
8770
- getIndex: getIndex,
8776
+ helper: helper,
8771
8777
  methodName: 'sendEvent',
8772
8778
  args: args,
8773
8779
  instantSearchInstance: instantSearchInstance
@@ -8787,7 +8793,7 @@
8787
8793
  return sendEventForHits;
8788
8794
  }
8789
8795
  function createBindEventForHits(_ref3) {
8790
- var getIndex = _ref3.getIndex,
8796
+ var helper = _ref3.helper,
8791
8797
  widgetType = _ref3.widgetType,
8792
8798
  instantSearchInstance = _ref3.instantSearchInstance;
8793
8799
  var bindEventForHits = function bindEventForHits() {
@@ -8796,7 +8802,7 @@
8796
8802
  }
8797
8803
  var payloads = _buildEventPayloadsForHits({
8798
8804
  widgetType: widgetType,
8799
- getIndex: getIndex,
8805
+ helper: helper,
8800
8806
  methodName: 'bindEvent',
8801
8807
  args: args,
8802
8808
  instantSearchInstance: instantSearchInstance
@@ -13033,7 +13039,7 @@
13033
13039
  };
13034
13040
  }
13035
13041
 
13036
- var version$1 = '4.77.2';
13042
+ var version$1 = '4.78.0';
13037
13043
 
13038
13044
  function _typeof$j(o) {
13039
13045
  "@babel/helpers - typeof";
@@ -19781,17 +19787,13 @@
19781
19787
  if (!sendEvent) {
19782
19788
  sendEvent = createSendEventForHits({
19783
19789
  instantSearchInstance: instantSearchInstance,
19784
- getIndex: function getIndex() {
19785
- return helper.getIndex();
19786
- },
19790
+ helper: helper,
19787
19791
  widgetType: this.$$type
19788
19792
  });
19789
19793
  }
19790
19794
  if (!bindEvent) {
19791
19795
  bindEvent = createBindEventForHits({
19792
- getIndex: function getIndex() {
19793
- return helper.getIndex();
19794
- },
19796
+ helper: helper,
19795
19797
  widgetType: this.$$type,
19796
19798
  instantSearchInstance: instantSearchInstance
19797
19799
  });
@@ -21096,15 +21098,11 @@
21096
21098
  showMore = getShowMore(helper);
21097
21099
  sendEvent = createSendEventForHits({
21098
21100
  instantSearchInstance: instantSearchInstance,
21099
- getIndex: function getIndex() {
21100
- return helper.getIndex();
21101
- },
21101
+ helper: helper,
21102
21102
  widgetType: this.$$type
21103
21103
  });
21104
21104
  bindEvent = createBindEventForHits({
21105
- getIndex: function getIndex() {
21106
- return helper.getIndex();
21107
- },
21105
+ helper: helper,
21108
21106
  widgetType: this.$$type,
21109
21107
  instantSearchInstance: instantSearchInstance
21110
21108
  });
@@ -23547,9 +23545,7 @@
23547
23545
  if (!sendEvent) {
23548
23546
  sendEvent = createSendEventForHits({
23549
23547
  instantSearchInstance: instantSearchInstance,
23550
- getIndex: function getIndex() {
23551
- return helper.getIndex();
23552
- },
23548
+ helper: helper,
23553
23549
  widgetType: this.$$type
23554
23550
  });
23555
23551
  }
@@ -26077,6 +26073,7 @@
26077
26073
  }
26078
26074
  var isRefined = getRefinedStar() === Number(facetValue);
26079
26075
  if (!isRefined) {
26076
+ var _helper$lastResults;
26080
26077
  instantSearchInstance.sendEventToInsights({
26081
26078
  insightsMethod: 'clickedFilters',
26082
26079
  widgetType: $$type$2,
@@ -26084,7 +26081,7 @@
26084
26081
  eventModifier: eventModifier,
26085
26082
  payload: {
26086
26083
  eventName: eventName,
26087
- index: helper.getIndex(),
26084
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
26088
26085
  filters: ["".concat(attribute, ">=").concat(facetValue)]
26089
26086
  },
26090
26087
  attribute: attribute
@@ -28496,6 +28493,7 @@
28496
28493
  // only send an event when the refinement gets applied,
28497
28494
  // not when it gets removed
28498
28495
  if (!isRefined) {
28496
+ var _helper$lastResults;
28499
28497
  instantSearchInstance.sendEventToInsights({
28500
28498
  insightsMethod: 'clickedFilters',
28501
28499
  widgetType: $$type$3,
@@ -28503,7 +28501,7 @@
28503
28501
  eventModifier: eventModifier,
28504
28502
  payload: {
28505
28503
  eventName: eventName,
28506
- index: helper.getIndex(),
28504
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
28507
28505
  filters: on.map(function (value) {
28508
28506
  return "".concat(attribute, ":").concat(value);
28509
28507
  })
@@ -29017,9 +29015,7 @@
29017
29015
  if (!sendEvent) {
29018
29016
  sendEvent = createSendEventForHits({
29019
29017
  instantSearchInstance: instantSearchInstance,
29020
- getIndex: function getIndex() {
29021
- return helper.getIndex();
29022
- },
29018
+ helper: helper,
29023
29019
  widgetType: this.$$type
29024
29020
  });
29025
29021
  }
@@ -29405,9 +29401,7 @@
29405
29401
  if (!sendEvent) {
29406
29402
  sendEvent = createSendEventForHits({
29407
29403
  instantSearchInstance: instantSearchInstance,
29408
- getIndex: function getIndex() {
29409
- return helper.getIndex();
29410
- },
29404
+ helper: helper,
29411
29405
  widgetType: this.$$type
29412
29406
  });
29413
29407
  }
@@ -29789,9 +29783,7 @@
29789
29783
  if (!sendEvent) {
29790
29784
  sendEvent = createSendEventForHits({
29791
29785
  instantSearchInstance: instantSearchInstance,
29792
- getIndex: function getIndex() {
29793
- return helper.getIndex();
29794
- },
29786
+ helper: helper,
29795
29787
  widgetType: this.$$type
29796
29788
  });
29797
29789
  }