react-instantsearch 7.15.3 → 7.15.4

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.
@@ -7,7 +7,7 @@
7
7
 
8
8
  var React__default = 'default' in React ? React['default'] : React;
9
9
 
10
- var version = '7.15.3';
10
+ var version = '7.15.4';
11
11
 
12
12
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -4623,7 +4623,7 @@
4623
4623
 
4624
4624
  var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
4625
4625
 
4626
- var version$1 = '3.24.1';
4626
+ var version$1 = '3.24.2';
4627
4627
 
4628
4628
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4629
4629
 
@@ -7521,6 +7521,7 @@
7521
7521
  instantSearchInstance.sendEventToInsights(args[0]);
7522
7522
  } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
7523
7523
  if (!isFacetRefined(helper, attribute, facetValue)) {
7524
+ var _helper$lastResults;
7524
7525
  // send event only when the facet is being checked "ON"
7525
7526
  instantSearchInstance.sendEventToInsights({
7526
7527
  insightsMethod: 'clickedFilters',
@@ -7529,7 +7530,7 @@
7529
7530
  eventModifier: eventModifier,
7530
7531
  payload: _objectSpread$1({
7531
7532
  eventName: eventName,
7532
- index: helper.getIndex(),
7533
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7533
7534
  filters: ["".concat(attribute, ":").concat(facetValue)]
7534
7535
  }, additionalData),
7535
7536
  attribute: attribute
@@ -7660,7 +7661,7 @@
7660
7661
  return chunks;
7661
7662
  }
7662
7663
  function _buildEventPayloadsForHits(_ref) {
7663
- var getIndex = _ref.getIndex,
7664
+ var helper = _ref.helper,
7664
7665
  widgetType = _ref.widgetType,
7665
7666
  methodName = _ref.methodName,
7666
7667
  args = _ref.args,
@@ -7707,13 +7708,14 @@
7707
7708
  return [];
7708
7709
  }
7709
7710
  return hitsChunks.map(function (batch, i) {
7711
+ var _helper$lastResults;
7710
7712
  return {
7711
7713
  insightsMethod: 'viewedObjectIDs',
7712
7714
  widgetType: widgetType,
7713
7715
  eventType: eventType,
7714
7716
  payload: _objectSpread$2({
7715
7717
  eventName: eventName || 'Hits Viewed',
7716
- index: getIndex(),
7718
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7717
7719
  objectIDs: objectIDsByChunk[i]
7718
7720
  }, additionalData),
7719
7721
  hits: batch,
@@ -7722,13 +7724,14 @@
7722
7724
  });
7723
7725
  } else if (eventType === 'click') {
7724
7726
  return hitsChunks.map(function (batch, i) {
7727
+ var _helper$lastResults2;
7725
7728
  return {
7726
7729
  insightsMethod: 'clickedObjectIDsAfterSearch',
7727
7730
  widgetType: widgetType,
7728
7731
  eventType: eventType,
7729
7732
  payload: _objectSpread$2({
7730
7733
  eventName: eventName || 'Hit Clicked',
7731
- index: getIndex(),
7734
+ index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
7732
7735
  queryID: queryID,
7733
7736
  objectIDs: objectIDsByChunk[i],
7734
7737
  positions: positionsByChunk[i]
@@ -7739,13 +7742,14 @@
7739
7742
  });
7740
7743
  } else if (eventType === 'conversion') {
7741
7744
  return hitsChunks.map(function (batch, i) {
7745
+ var _helper$lastResults3;
7742
7746
  return {
7743
7747
  insightsMethod: 'convertedObjectIDsAfterSearch',
7744
7748
  widgetType: widgetType,
7745
7749
  eventType: eventType,
7746
7750
  payload: _objectSpread$2({
7747
7751
  eventName: eventName || 'Hit Converted',
7748
- index: getIndex(),
7752
+ index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
7749
7753
  queryID: queryID,
7750
7754
  objectIDs: objectIDsByChunk[i]
7751
7755
  }, additionalData),
@@ -7759,7 +7763,7 @@
7759
7763
  }
7760
7764
  function createSendEventForHits(_ref2) {
7761
7765
  var instantSearchInstance = _ref2.instantSearchInstance,
7762
- getIndex = _ref2.getIndex,
7766
+ helper = _ref2.helper,
7763
7767
  widgetType = _ref2.widgetType;
7764
7768
  var sentEvents = {};
7765
7769
  var timer = undefined;
@@ -7769,7 +7773,7 @@
7769
7773
  }
7770
7774
  var payloads = _buildEventPayloadsForHits({
7771
7775
  widgetType: widgetType,
7772
- getIndex: getIndex,
7776
+ helper: helper,
7773
7777
  methodName: 'sendEvent',
7774
7778
  args: args,
7775
7779
  instantSearchInstance: instantSearchInstance
@@ -7789,7 +7793,7 @@
7789
7793
  return sendEventForHits;
7790
7794
  }
7791
7795
  function createBindEventForHits(_ref3) {
7792
- var getIndex = _ref3.getIndex,
7796
+ var helper = _ref3.helper,
7793
7797
  widgetType = _ref3.widgetType,
7794
7798
  instantSearchInstance = _ref3.instantSearchInstance;
7795
7799
  var bindEventForHits = function bindEventForHits() {
@@ -7798,7 +7802,7 @@
7798
7802
  }
7799
7803
  var payloads = _buildEventPayloadsForHits({
7800
7804
  widgetType: widgetType,
7801
- getIndex: getIndex,
7805
+ helper: helper,
7802
7806
  methodName: 'bindEvent',
7803
7807
  args: args,
7804
7808
  instantSearchInstance: instantSearchInstance
@@ -13417,7 +13421,7 @@
13417
13421
  };
13418
13422
  }
13419
13423
 
13420
- var version$3 = '4.77.3';
13424
+ var version$3 = '4.78.0';
13421
13425
 
13422
13426
  function _typeof$q(o) {
13423
13427
  "@babel/helpers - typeof";
@@ -15454,9 +15458,7 @@
15454
15458
  if (!sendEvent) {
15455
15459
  sendEvent = createSendEventForHits({
15456
15460
  instantSearchInstance: instantSearchInstance,
15457
- getIndex: function getIndex() {
15458
- return helper.getIndex();
15459
- },
15461
+ helper: helper,
15460
15462
  widgetType: this.$$type
15461
15463
  });
15462
15464
  }
@@ -15708,9 +15710,7 @@
15708
15710
  if (!sendEvent) {
15709
15711
  sendEvent = createSendEventForHits({
15710
15712
  instantSearchInstance: instantSearchInstance,
15711
- getIndex: function getIndex() {
15712
- return helper.getIndex();
15713
- },
15713
+ helper: helper,
15714
15714
  widgetType: $$type
15715
15715
  });
15716
15716
  }
@@ -16242,17 +16242,13 @@
16242
16242
  if (!sendEvent) {
16243
16243
  sendEvent = createSendEventForHits({
16244
16244
  instantSearchInstance: instantSearchInstance,
16245
- getIndex: function getIndex() {
16246
- return helper.getIndex();
16247
- },
16245
+ helper: helper,
16248
16246
  widgetType: this.$$type
16249
16247
  });
16250
16248
  }
16251
16249
  if (!bindEvent) {
16252
16250
  bindEvent = createBindEventForHits({
16253
- getIndex: function getIndex() {
16254
- return helper.getIndex();
16255
- },
16251
+ helper: helper,
16256
16252
  widgetType: this.$$type,
16257
16253
  instantSearchInstance: instantSearchInstance
16258
16254
  });
@@ -16788,15 +16784,11 @@
16788
16784
  showMore = getShowMore(helper);
16789
16785
  sendEvent = createSendEventForHits({
16790
16786
  instantSearchInstance: instantSearchInstance,
16791
- getIndex: function getIndex() {
16792
- return helper.getIndex();
16793
- },
16787
+ helper: helper,
16794
16788
  widgetType: this.$$type
16795
16789
  });
16796
16790
  bindEvent = createBindEventForHits({
16797
- getIndex: function getIndex() {
16798
- return helper.getIndex();
16799
- },
16791
+ helper: helper,
16800
16792
  widgetType: this.$$type,
16801
16793
  instantSearchInstance: instantSearchInstance
16802
16794
  });
@@ -19066,9 +19058,7 @@
19066
19058
  if (!sendEvent) {
19067
19059
  sendEvent = createSendEventForHits({
19068
19060
  instantSearchInstance: instantSearchInstance,
19069
- getIndex: function getIndex() {
19070
- return helper.getIndex();
19071
- },
19061
+ helper: helper,
19072
19062
  widgetType: this.$$type
19073
19063
  });
19074
19064
  }
@@ -19703,6 +19693,7 @@
19703
19693
  // only send an event when the refinement gets applied,
19704
19694
  // not when it gets removed
19705
19695
  if (!isRefined) {
19696
+ var _helper$lastResults;
19706
19697
  instantSearchInstance.sendEventToInsights({
19707
19698
  insightsMethod: 'clickedFilters',
19708
19699
  widgetType: $$type$3,
@@ -19710,7 +19701,7 @@
19710
19701
  eventModifier: eventModifier,
19711
19702
  payload: {
19712
19703
  eventName: eventName,
19713
- index: helper.getIndex(),
19704
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
19714
19705
  filters: on.map(function (value) {
19715
19706
  return "".concat(attribute, ":").concat(value);
19716
19707
  })
@@ -20077,9 +20068,7 @@
20077
20068
  if (!sendEvent) {
20078
20069
  sendEvent = createSendEventForHits({
20079
20070
  instantSearchInstance: instantSearchInstance,
20080
- getIndex: function getIndex() {
20081
- return helper.getIndex();
20082
- },
20071
+ helper: helper,
20083
20072
  widgetType: this.$$type
20084
20073
  });
20085
20074
  }
@@ -20234,9 +20223,7 @@
20234
20223
  if (!sendEvent) {
20235
20224
  sendEvent = createSendEventForHits({
20236
20225
  instantSearchInstance: instantSearchInstance,
20237
- getIndex: function getIndex() {
20238
- return helper.getIndex();
20239
- },
20226
+ helper: helper,
20240
20227
  widgetType: this.$$type
20241
20228
  });
20242
20229
  }