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