react-instantsearch-core 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.
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = exports.default = '7.15.2';
7
+ var _default = exports.default = '7.15.4';
@@ -1,2 +1,2 @@
1
- declare const _default: "7.15.2";
1
+ declare const _default: "7.15.4";
2
2
  export default _default;
@@ -1 +1 @@
1
- export default '7.15.2';
1
+ export default '7.15.4';
@@ -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
  function _iterableToArrayLimit(r, l) {
13
13
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
@@ -4758,7 +4758,7 @@
4758
4758
 
4759
4759
  var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
4760
4760
 
4761
- var version$1 = '3.24.0';
4761
+ var version$1 = '3.24.2';
4762
4762
 
4763
4763
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4764
4764
 
@@ -6601,8 +6601,11 @@
6601
6601
  if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');
6602
6602
 
6603
6603
  var results = content.results.slice();
6604
- var rawContent = Object.create(content);
6605
- delete rawContent.results;
6604
+ var rawContent = Object.keys(content).reduce(function (value, key) {
6605
+ if (key !== 'results') value[key] = content[key];
6606
+ return value;
6607
+ }, {});
6608
+
6606
6609
  if (Object.keys(rawContent).length <= 0) {
6607
6610
  rawContent = undefined;
6608
6611
  }
@@ -6626,12 +6629,11 @@
6626
6629
  specificResults,
6627
6630
  self._searchResultsOptions
6628
6631
  );
6629
- helper.lastResults._rawContent = rawContent;
6632
+ if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;
6630
6633
 
6631
6634
  helper.emit('result', {
6632
6635
  results: helper.lastResults,
6633
6636
  state: state,
6634
- _rawContent: rawContent,
6635
6637
  });
6636
6638
  });
6637
6639
  };
@@ -7442,6 +7444,7 @@
7442
7444
  instantSearchInstance.sendEventToInsights(args[0]);
7443
7445
  } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
7444
7446
  if (!isFacetRefined(helper, attribute, facetValue)) {
7447
+ var _helper$lastResults;
7445
7448
  // send event only when the facet is being checked "ON"
7446
7449
  instantSearchInstance.sendEventToInsights({
7447
7450
  insightsMethod: 'clickedFilters',
@@ -7450,7 +7453,7 @@
7450
7453
  eventModifier: eventModifier,
7451
7454
  payload: _objectSpread$1({
7452
7455
  eventName: eventName,
7453
- index: helper.getIndex(),
7456
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7454
7457
  filters: ["".concat(attribute, ":").concat(facetValue)]
7455
7458
  }, additionalData),
7456
7459
  attribute: attribute
@@ -7581,7 +7584,7 @@
7581
7584
  return chunks;
7582
7585
  }
7583
7586
  function _buildEventPayloadsForHits(_ref) {
7584
- var getIndex = _ref.getIndex,
7587
+ var helper = _ref.helper,
7585
7588
  widgetType = _ref.widgetType,
7586
7589
  methodName = _ref.methodName,
7587
7590
  args = _ref.args,
@@ -7628,13 +7631,14 @@
7628
7631
  return [];
7629
7632
  }
7630
7633
  return hitsChunks.map(function (batch, i) {
7634
+ var _helper$lastResults;
7631
7635
  return {
7632
7636
  insightsMethod: 'viewedObjectIDs',
7633
7637
  widgetType: widgetType,
7634
7638
  eventType: eventType,
7635
7639
  payload: _objectSpread$2({
7636
7640
  eventName: eventName || 'Hits Viewed',
7637
- index: getIndex(),
7641
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7638
7642
  objectIDs: objectIDsByChunk[i]
7639
7643
  }, additionalData),
7640
7644
  hits: batch,
@@ -7643,13 +7647,14 @@
7643
7647
  });
7644
7648
  } else if (eventType === 'click') {
7645
7649
  return hitsChunks.map(function (batch, i) {
7650
+ var _helper$lastResults2;
7646
7651
  return {
7647
7652
  insightsMethod: 'clickedObjectIDsAfterSearch',
7648
7653
  widgetType: widgetType,
7649
7654
  eventType: eventType,
7650
7655
  payload: _objectSpread$2({
7651
7656
  eventName: eventName || 'Hit Clicked',
7652
- index: getIndex(),
7657
+ index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
7653
7658
  queryID: queryID,
7654
7659
  objectIDs: objectIDsByChunk[i],
7655
7660
  positions: positionsByChunk[i]
@@ -7660,13 +7665,14 @@
7660
7665
  });
7661
7666
  } else if (eventType === 'conversion') {
7662
7667
  return hitsChunks.map(function (batch, i) {
7668
+ var _helper$lastResults3;
7663
7669
  return {
7664
7670
  insightsMethod: 'convertedObjectIDsAfterSearch',
7665
7671
  widgetType: widgetType,
7666
7672
  eventType: eventType,
7667
7673
  payload: _objectSpread$2({
7668
7674
  eventName: eventName || 'Hit Converted',
7669
- index: getIndex(),
7675
+ index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
7670
7676
  queryID: queryID,
7671
7677
  objectIDs: objectIDsByChunk[i]
7672
7678
  }, additionalData),
@@ -7680,7 +7686,7 @@
7680
7686
  }
7681
7687
  function createSendEventForHits(_ref2) {
7682
7688
  var instantSearchInstance = _ref2.instantSearchInstance,
7683
- getIndex = _ref2.getIndex,
7689
+ helper = _ref2.helper,
7684
7690
  widgetType = _ref2.widgetType;
7685
7691
  var sentEvents = {};
7686
7692
  var timer = undefined;
@@ -7690,7 +7696,7 @@
7690
7696
  }
7691
7697
  var payloads = _buildEventPayloadsForHits({
7692
7698
  widgetType: widgetType,
7693
- getIndex: getIndex,
7699
+ helper: helper,
7694
7700
  methodName: 'sendEvent',
7695
7701
  args: args,
7696
7702
  instantSearchInstance: instantSearchInstance
@@ -7710,7 +7716,7 @@
7710
7716
  return sendEventForHits;
7711
7717
  }
7712
7718
  function createBindEventForHits(_ref3) {
7713
- var getIndex = _ref3.getIndex,
7719
+ var helper = _ref3.helper,
7714
7720
  widgetType = _ref3.widgetType,
7715
7721
  instantSearchInstance = _ref3.instantSearchInstance;
7716
7722
  var bindEventForHits = function bindEventForHits() {
@@ -7719,7 +7725,7 @@
7719
7725
  }
7720
7726
  var payloads = _buildEventPayloadsForHits({
7721
7727
  widgetType: widgetType,
7722
- getIndex: getIndex,
7728
+ helper: helper,
7723
7729
  methodName: 'bindEvent',
7724
7730
  args: args,
7725
7731
  instantSearchInstance: instantSearchInstance
@@ -12859,7 +12865,7 @@
12859
12865
  };
12860
12866
  }
12861
12867
 
12862
- var version$2 = '4.77.2';
12868
+ var version$2 = '4.78.0';
12863
12869
 
12864
12870
  function _typeof$l(o) {
12865
12871
  "@babel/helpers - typeof";
@@ -14722,9 +14728,7 @@
14722
14728
  if (!sendEvent) {
14723
14729
  sendEvent = createSendEventForHits({
14724
14730
  instantSearchInstance: instantSearchInstance,
14725
- getIndex: function getIndex() {
14726
- return helper.getIndex();
14727
- },
14731
+ helper: helper,
14728
14732
  widgetType: this.$$type
14729
14733
  });
14730
14734
  }
@@ -14976,9 +14980,7 @@
14976
14980
  if (!sendEvent) {
14977
14981
  sendEvent = createSendEventForHits({
14978
14982
  instantSearchInstance: instantSearchInstance,
14979
- getIndex: function getIndex() {
14980
- return helper.getIndex();
14981
- },
14983
+ helper: helper,
14982
14984
  widgetType: $$type
14983
14985
  });
14984
14986
  }
@@ -15510,17 +15512,13 @@
15510
15512
  if (!sendEvent) {
15511
15513
  sendEvent = createSendEventForHits({
15512
15514
  instantSearchInstance: instantSearchInstance,
15513
- getIndex: function getIndex() {
15514
- return helper.getIndex();
15515
- },
15515
+ helper: helper,
15516
15516
  widgetType: this.$$type
15517
15517
  });
15518
15518
  }
15519
15519
  if (!bindEvent) {
15520
15520
  bindEvent = createBindEventForHits({
15521
- getIndex: function getIndex() {
15522
- return helper.getIndex();
15523
- },
15521
+ helper: helper,
15524
15522
  widgetType: this.$$type,
15525
15523
  instantSearchInstance: instantSearchInstance
15526
15524
  });
@@ -16056,15 +16054,11 @@
16056
16054
  showMore = getShowMore(helper);
16057
16055
  sendEvent = createSendEventForHits({
16058
16056
  instantSearchInstance: instantSearchInstance,
16059
- getIndex: function getIndex() {
16060
- return helper.getIndex();
16061
- },
16057
+ helper: helper,
16062
16058
  widgetType: this.$$type
16063
16059
  });
16064
16060
  bindEvent = createBindEventForHits({
16065
- getIndex: function getIndex() {
16066
- return helper.getIndex();
16067
- },
16061
+ helper: helper,
16068
16062
  widgetType: this.$$type,
16069
16063
  instantSearchInstance: instantSearchInstance
16070
16064
  });
@@ -18334,9 +18328,7 @@
18334
18328
  if (!sendEvent) {
18335
18329
  sendEvent = createSendEventForHits({
18336
18330
  instantSearchInstance: instantSearchInstance,
18337
- getIndex: function getIndex() {
18338
- return helper.getIndex();
18339
- },
18331
+ helper: helper,
18340
18332
  widgetType: this.$$type
18341
18333
  });
18342
18334
  }
@@ -18971,6 +18963,7 @@
18971
18963
  // only send an event when the refinement gets applied,
18972
18964
  // not when it gets removed
18973
18965
  if (!isRefined) {
18966
+ var _helper$lastResults;
18974
18967
  instantSearchInstance.sendEventToInsights({
18975
18968
  insightsMethod: 'clickedFilters',
18976
18969
  widgetType: $$type$3,
@@ -18978,7 +18971,7 @@
18978
18971
  eventModifier: eventModifier,
18979
18972
  payload: {
18980
18973
  eventName: eventName,
18981
- index: helper.getIndex(),
18974
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
18982
18975
  filters: on.map(function (value) {
18983
18976
  return "".concat(attribute, ":").concat(value);
18984
18977
  })
@@ -19345,9 +19338,7 @@
19345
19338
  if (!sendEvent) {
19346
19339
  sendEvent = createSendEventForHits({
19347
19340
  instantSearchInstance: instantSearchInstance,
19348
- getIndex: function getIndex() {
19349
- return helper.getIndex();
19350
- },
19341
+ helper: helper,
19351
19342
  widgetType: this.$$type
19352
19343
  });
19353
19344
  }
@@ -19502,9 +19493,7 @@
19502
19493
  if (!sendEvent) {
19503
19494
  sendEvent = createSendEventForHits({
19504
19495
  instantSearchInstance: instantSearchInstance,
19505
- getIndex: function getIndex() {
19506
- return helper.getIndex();
19507
- },
19496
+ helper: helper,
19508
19497
  widgetType: this.$$type
19509
19498
  });
19510
19499
  }