react-instantsearch 7.15.2 → 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.2';
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.0';
4626
+ var version$1 = '3.24.2';
4627
4627
 
4628
4628
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4629
4629
 
@@ -6466,8 +6466,11 @@
6466
6466
  if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');
6467
6467
 
6468
6468
  var results = content.results.slice();
6469
- var rawContent = Object.create(content);
6470
- delete rawContent.results;
6469
+ var rawContent = Object.keys(content).reduce(function (value, key) {
6470
+ if (key !== 'results') value[key] = content[key];
6471
+ return value;
6472
+ }, {});
6473
+
6471
6474
  if (Object.keys(rawContent).length <= 0) {
6472
6475
  rawContent = undefined;
6473
6476
  }
@@ -6491,12 +6494,11 @@
6491
6494
  specificResults,
6492
6495
  self._searchResultsOptions
6493
6496
  );
6494
- helper.lastResults._rawContent = rawContent;
6497
+ if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;
6495
6498
 
6496
6499
  helper.emit('result', {
6497
6500
  results: helper.lastResults,
6498
6501
  state: state,
6499
- _rawContent: rawContent,
6500
6502
  });
6501
6503
  });
6502
6504
  };
@@ -7519,6 +7521,7 @@
7519
7521
  instantSearchInstance.sendEventToInsights(args[0]);
7520
7522
  } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
7521
7523
  if (!isFacetRefined(helper, attribute, facetValue)) {
7524
+ var _helper$lastResults;
7522
7525
  // send event only when the facet is being checked "ON"
7523
7526
  instantSearchInstance.sendEventToInsights({
7524
7527
  insightsMethod: 'clickedFilters',
@@ -7527,7 +7530,7 @@
7527
7530
  eventModifier: eventModifier,
7528
7531
  payload: _objectSpread$1({
7529
7532
  eventName: eventName,
7530
- index: helper.getIndex(),
7533
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7531
7534
  filters: ["".concat(attribute, ":").concat(facetValue)]
7532
7535
  }, additionalData),
7533
7536
  attribute: attribute
@@ -7658,7 +7661,7 @@
7658
7661
  return chunks;
7659
7662
  }
7660
7663
  function _buildEventPayloadsForHits(_ref) {
7661
- var getIndex = _ref.getIndex,
7664
+ var helper = _ref.helper,
7662
7665
  widgetType = _ref.widgetType,
7663
7666
  methodName = _ref.methodName,
7664
7667
  args = _ref.args,
@@ -7705,13 +7708,14 @@
7705
7708
  return [];
7706
7709
  }
7707
7710
  return hitsChunks.map(function (batch, i) {
7711
+ var _helper$lastResults;
7708
7712
  return {
7709
7713
  insightsMethod: 'viewedObjectIDs',
7710
7714
  widgetType: widgetType,
7711
7715
  eventType: eventType,
7712
7716
  payload: _objectSpread$2({
7713
7717
  eventName: eventName || 'Hits Viewed',
7714
- index: getIndex(),
7718
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7715
7719
  objectIDs: objectIDsByChunk[i]
7716
7720
  }, additionalData),
7717
7721
  hits: batch,
@@ -7720,13 +7724,14 @@
7720
7724
  });
7721
7725
  } else if (eventType === 'click') {
7722
7726
  return hitsChunks.map(function (batch, i) {
7727
+ var _helper$lastResults2;
7723
7728
  return {
7724
7729
  insightsMethod: 'clickedObjectIDsAfterSearch',
7725
7730
  widgetType: widgetType,
7726
7731
  eventType: eventType,
7727
7732
  payload: _objectSpread$2({
7728
7733
  eventName: eventName || 'Hit Clicked',
7729
- index: getIndex(),
7734
+ index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
7730
7735
  queryID: queryID,
7731
7736
  objectIDs: objectIDsByChunk[i],
7732
7737
  positions: positionsByChunk[i]
@@ -7737,13 +7742,14 @@
7737
7742
  });
7738
7743
  } else if (eventType === 'conversion') {
7739
7744
  return hitsChunks.map(function (batch, i) {
7745
+ var _helper$lastResults3;
7740
7746
  return {
7741
7747
  insightsMethod: 'convertedObjectIDsAfterSearch',
7742
7748
  widgetType: widgetType,
7743
7749
  eventType: eventType,
7744
7750
  payload: _objectSpread$2({
7745
7751
  eventName: eventName || 'Hit Converted',
7746
- index: getIndex(),
7752
+ index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
7747
7753
  queryID: queryID,
7748
7754
  objectIDs: objectIDsByChunk[i]
7749
7755
  }, additionalData),
@@ -7757,7 +7763,7 @@
7757
7763
  }
7758
7764
  function createSendEventForHits(_ref2) {
7759
7765
  var instantSearchInstance = _ref2.instantSearchInstance,
7760
- getIndex = _ref2.getIndex,
7766
+ helper = _ref2.helper,
7761
7767
  widgetType = _ref2.widgetType;
7762
7768
  var sentEvents = {};
7763
7769
  var timer = undefined;
@@ -7767,7 +7773,7 @@
7767
7773
  }
7768
7774
  var payloads = _buildEventPayloadsForHits({
7769
7775
  widgetType: widgetType,
7770
- getIndex: getIndex,
7776
+ helper: helper,
7771
7777
  methodName: 'sendEvent',
7772
7778
  args: args,
7773
7779
  instantSearchInstance: instantSearchInstance
@@ -7787,7 +7793,7 @@
7787
7793
  return sendEventForHits;
7788
7794
  }
7789
7795
  function createBindEventForHits(_ref3) {
7790
- var getIndex = _ref3.getIndex,
7796
+ var helper = _ref3.helper,
7791
7797
  widgetType = _ref3.widgetType,
7792
7798
  instantSearchInstance = _ref3.instantSearchInstance;
7793
7799
  var bindEventForHits = function bindEventForHits() {
@@ -7796,7 +7802,7 @@
7796
7802
  }
7797
7803
  var payloads = _buildEventPayloadsForHits({
7798
7804
  widgetType: widgetType,
7799
- getIndex: getIndex,
7805
+ helper: helper,
7800
7806
  methodName: 'bindEvent',
7801
7807
  args: args,
7802
7808
  instantSearchInstance: instantSearchInstance
@@ -13415,7 +13421,7 @@
13415
13421
  };
13416
13422
  }
13417
13423
 
13418
- var version$3 = '4.77.2';
13424
+ var version$3 = '4.78.0';
13419
13425
 
13420
13426
  function _typeof$q(o) {
13421
13427
  "@babel/helpers - typeof";
@@ -15452,9 +15458,7 @@
15452
15458
  if (!sendEvent) {
15453
15459
  sendEvent = createSendEventForHits({
15454
15460
  instantSearchInstance: instantSearchInstance,
15455
- getIndex: function getIndex() {
15456
- return helper.getIndex();
15457
- },
15461
+ helper: helper,
15458
15462
  widgetType: this.$$type
15459
15463
  });
15460
15464
  }
@@ -15706,9 +15710,7 @@
15706
15710
  if (!sendEvent) {
15707
15711
  sendEvent = createSendEventForHits({
15708
15712
  instantSearchInstance: instantSearchInstance,
15709
- getIndex: function getIndex() {
15710
- return helper.getIndex();
15711
- },
15713
+ helper: helper,
15712
15714
  widgetType: $$type
15713
15715
  });
15714
15716
  }
@@ -16240,17 +16242,13 @@
16240
16242
  if (!sendEvent) {
16241
16243
  sendEvent = createSendEventForHits({
16242
16244
  instantSearchInstance: instantSearchInstance,
16243
- getIndex: function getIndex() {
16244
- return helper.getIndex();
16245
- },
16245
+ helper: helper,
16246
16246
  widgetType: this.$$type
16247
16247
  });
16248
16248
  }
16249
16249
  if (!bindEvent) {
16250
16250
  bindEvent = createBindEventForHits({
16251
- getIndex: function getIndex() {
16252
- return helper.getIndex();
16253
- },
16251
+ helper: helper,
16254
16252
  widgetType: this.$$type,
16255
16253
  instantSearchInstance: instantSearchInstance
16256
16254
  });
@@ -16786,15 +16784,11 @@
16786
16784
  showMore = getShowMore(helper);
16787
16785
  sendEvent = createSendEventForHits({
16788
16786
  instantSearchInstance: instantSearchInstance,
16789
- getIndex: function getIndex() {
16790
- return helper.getIndex();
16791
- },
16787
+ helper: helper,
16792
16788
  widgetType: this.$$type
16793
16789
  });
16794
16790
  bindEvent = createBindEventForHits({
16795
- getIndex: function getIndex() {
16796
- return helper.getIndex();
16797
- },
16791
+ helper: helper,
16798
16792
  widgetType: this.$$type,
16799
16793
  instantSearchInstance: instantSearchInstance
16800
16794
  });
@@ -19064,9 +19058,7 @@
19064
19058
  if (!sendEvent) {
19065
19059
  sendEvent = createSendEventForHits({
19066
19060
  instantSearchInstance: instantSearchInstance,
19067
- getIndex: function getIndex() {
19068
- return helper.getIndex();
19069
- },
19061
+ helper: helper,
19070
19062
  widgetType: this.$$type
19071
19063
  });
19072
19064
  }
@@ -19701,6 +19693,7 @@
19701
19693
  // only send an event when the refinement gets applied,
19702
19694
  // not when it gets removed
19703
19695
  if (!isRefined) {
19696
+ var _helper$lastResults;
19704
19697
  instantSearchInstance.sendEventToInsights({
19705
19698
  insightsMethod: 'clickedFilters',
19706
19699
  widgetType: $$type$3,
@@ -19708,7 +19701,7 @@
19708
19701
  eventModifier: eventModifier,
19709
19702
  payload: {
19710
19703
  eventName: eventName,
19711
- index: helper.getIndex(),
19704
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
19712
19705
  filters: on.map(function (value) {
19713
19706
  return "".concat(attribute, ":").concat(value);
19714
19707
  })
@@ -20075,9 +20068,7 @@
20075
20068
  if (!sendEvent) {
20076
20069
  sendEvent = createSendEventForHits({
20077
20070
  instantSearchInstance: instantSearchInstance,
20078
- getIndex: function getIndex() {
20079
- return helper.getIndex();
20080
- },
20071
+ helper: helper,
20081
20072
  widgetType: this.$$type
20082
20073
  });
20083
20074
  }
@@ -20232,9 +20223,7 @@
20232
20223
  if (!sendEvent) {
20233
20224
  sendEvent = createSendEventForHits({
20234
20225
  instantSearchInstance: instantSearchInstance,
20235
- getIndex: function getIndex() {
20236
- return helper.getIndex();
20237
- },
20226
+ helper: helper,
20238
20227
  widgetType: this.$$type
20239
20228
  });
20240
20229
  }