react-instantsearch-core 7.15.3 → 7.15.5

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.3';
7
+ var _default = exports.default = '7.15.5';
@@ -1,2 +1,2 @@
1
- declare const _default: "7.15.3";
1
+ declare const _default: "7.15.5";
2
2
  export default _default;
@@ -1 +1 @@
1
- export default '7.15.3';
1
+ export default '7.15.5';
@@ -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.5';
11
11
 
12
12
  function _iterableToArrayLimit(r, l) {
13
13
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
@@ -939,7 +939,16 @@
939
939
  var facets = state.facets
940
940
  .concat(
941
941
  state.disjunctiveFacets.map(function (value) {
942
- return 'disjunctive(' + value + ')';
942
+ if (
943
+ state.disjunctiveFacetsRefinements &&
944
+ state.disjunctiveFacetsRefinements[value] &&
945
+ state.disjunctiveFacetsRefinements[value].length > 0
946
+ ) {
947
+ // only tag a disjunctiveFacet as disjunctive if it has a value selected
948
+ // this helps avoid hitting the limit of 20 disjunctive facets in the Composition API
949
+ return 'disjunctive(' + value + ')';
950
+ }
951
+ return value;
943
952
  })
944
953
  )
945
954
  .concat(requestBuilder._getHitsHierarchicalFacetsAttributes(state))
@@ -4758,7 +4767,7 @@
4758
4767
 
4759
4768
  var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
4760
4769
 
4761
- var version$1 = '3.24.1';
4770
+ var version$1 = '3.24.3';
4762
4771
 
4763
4772
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4764
4773
 
@@ -7444,6 +7453,7 @@
7444
7453
  instantSearchInstance.sendEventToInsights(args[0]);
7445
7454
  } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
7446
7455
  if (!isFacetRefined(helper, attribute, facetValue)) {
7456
+ var _helper$lastResults;
7447
7457
  // send event only when the facet is being checked "ON"
7448
7458
  instantSearchInstance.sendEventToInsights({
7449
7459
  insightsMethod: 'clickedFilters',
@@ -7452,7 +7462,7 @@
7452
7462
  eventModifier: eventModifier,
7453
7463
  payload: _objectSpread$1({
7454
7464
  eventName: eventName,
7455
- index: helper.getIndex(),
7465
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7456
7466
  filters: ["".concat(attribute, ":").concat(facetValue)]
7457
7467
  }, additionalData),
7458
7468
  attribute: attribute
@@ -7583,7 +7593,7 @@
7583
7593
  return chunks;
7584
7594
  }
7585
7595
  function _buildEventPayloadsForHits(_ref) {
7586
- var getIndex = _ref.getIndex,
7596
+ var helper = _ref.helper,
7587
7597
  widgetType = _ref.widgetType,
7588
7598
  methodName = _ref.methodName,
7589
7599
  args = _ref.args,
@@ -7630,13 +7640,14 @@
7630
7640
  return [];
7631
7641
  }
7632
7642
  return hitsChunks.map(function (batch, i) {
7643
+ var _helper$lastResults;
7633
7644
  return {
7634
7645
  insightsMethod: 'viewedObjectIDs',
7635
7646
  widgetType: widgetType,
7636
7647
  eventType: eventType,
7637
7648
  payload: _objectSpread$2({
7638
7649
  eventName: eventName || 'Hits Viewed',
7639
- index: getIndex(),
7650
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7640
7651
  objectIDs: objectIDsByChunk[i]
7641
7652
  }, additionalData),
7642
7653
  hits: batch,
@@ -7645,13 +7656,14 @@
7645
7656
  });
7646
7657
  } else if (eventType === 'click') {
7647
7658
  return hitsChunks.map(function (batch, i) {
7659
+ var _helper$lastResults2;
7648
7660
  return {
7649
7661
  insightsMethod: 'clickedObjectIDsAfterSearch',
7650
7662
  widgetType: widgetType,
7651
7663
  eventType: eventType,
7652
7664
  payload: _objectSpread$2({
7653
7665
  eventName: eventName || 'Hit Clicked',
7654
- index: getIndex(),
7666
+ index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
7655
7667
  queryID: queryID,
7656
7668
  objectIDs: objectIDsByChunk[i],
7657
7669
  positions: positionsByChunk[i]
@@ -7662,13 +7674,14 @@
7662
7674
  });
7663
7675
  } else if (eventType === 'conversion') {
7664
7676
  return hitsChunks.map(function (batch, i) {
7677
+ var _helper$lastResults3;
7665
7678
  return {
7666
7679
  insightsMethod: 'convertedObjectIDsAfterSearch',
7667
7680
  widgetType: widgetType,
7668
7681
  eventType: eventType,
7669
7682
  payload: _objectSpread$2({
7670
7683
  eventName: eventName || 'Hit Converted',
7671
- index: getIndex(),
7684
+ index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
7672
7685
  queryID: queryID,
7673
7686
  objectIDs: objectIDsByChunk[i]
7674
7687
  }, additionalData),
@@ -7682,7 +7695,7 @@
7682
7695
  }
7683
7696
  function createSendEventForHits(_ref2) {
7684
7697
  var instantSearchInstance = _ref2.instantSearchInstance,
7685
- getIndex = _ref2.getIndex,
7698
+ helper = _ref2.helper,
7686
7699
  widgetType = _ref2.widgetType;
7687
7700
  var sentEvents = {};
7688
7701
  var timer = undefined;
@@ -7692,7 +7705,7 @@
7692
7705
  }
7693
7706
  var payloads = _buildEventPayloadsForHits({
7694
7707
  widgetType: widgetType,
7695
- getIndex: getIndex,
7708
+ helper: helper,
7696
7709
  methodName: 'sendEvent',
7697
7710
  args: args,
7698
7711
  instantSearchInstance: instantSearchInstance
@@ -7712,7 +7725,7 @@
7712
7725
  return sendEventForHits;
7713
7726
  }
7714
7727
  function createBindEventForHits(_ref3) {
7715
- var getIndex = _ref3.getIndex,
7728
+ var helper = _ref3.helper,
7716
7729
  widgetType = _ref3.widgetType,
7717
7730
  instantSearchInstance = _ref3.instantSearchInstance;
7718
7731
  var bindEventForHits = function bindEventForHits() {
@@ -7721,7 +7734,7 @@
7721
7734
  }
7722
7735
  var payloads = _buildEventPayloadsForHits({
7723
7736
  widgetType: widgetType,
7724
- getIndex: getIndex,
7737
+ helper: helper,
7725
7738
  methodName: 'bindEvent',
7726
7739
  args: args,
7727
7740
  instantSearchInstance: instantSearchInstance
@@ -12861,7 +12874,7 @@
12861
12874
  };
12862
12875
  }
12863
12876
 
12864
- var version$2 = '4.77.3';
12877
+ var version$2 = '4.78.1';
12865
12878
 
12866
12879
  function _typeof$l(o) {
12867
12880
  "@babel/helpers - typeof";
@@ -14724,9 +14737,7 @@
14724
14737
  if (!sendEvent) {
14725
14738
  sendEvent = createSendEventForHits({
14726
14739
  instantSearchInstance: instantSearchInstance,
14727
- getIndex: function getIndex() {
14728
- return helper.getIndex();
14729
- },
14740
+ helper: helper,
14730
14741
  widgetType: this.$$type
14731
14742
  });
14732
14743
  }
@@ -14978,9 +14989,7 @@
14978
14989
  if (!sendEvent) {
14979
14990
  sendEvent = createSendEventForHits({
14980
14991
  instantSearchInstance: instantSearchInstance,
14981
- getIndex: function getIndex() {
14982
- return helper.getIndex();
14983
- },
14992
+ helper: helper,
14984
14993
  widgetType: $$type
14985
14994
  });
14986
14995
  }
@@ -15512,17 +15521,13 @@
15512
15521
  if (!sendEvent) {
15513
15522
  sendEvent = createSendEventForHits({
15514
15523
  instantSearchInstance: instantSearchInstance,
15515
- getIndex: function getIndex() {
15516
- return helper.getIndex();
15517
- },
15524
+ helper: helper,
15518
15525
  widgetType: this.$$type
15519
15526
  });
15520
15527
  }
15521
15528
  if (!bindEvent) {
15522
15529
  bindEvent = createBindEventForHits({
15523
- getIndex: function getIndex() {
15524
- return helper.getIndex();
15525
- },
15530
+ helper: helper,
15526
15531
  widgetType: this.$$type,
15527
15532
  instantSearchInstance: instantSearchInstance
15528
15533
  });
@@ -16058,15 +16063,11 @@
16058
16063
  showMore = getShowMore(helper);
16059
16064
  sendEvent = createSendEventForHits({
16060
16065
  instantSearchInstance: instantSearchInstance,
16061
- getIndex: function getIndex() {
16062
- return helper.getIndex();
16063
- },
16066
+ helper: helper,
16064
16067
  widgetType: this.$$type
16065
16068
  });
16066
16069
  bindEvent = createBindEventForHits({
16067
- getIndex: function getIndex() {
16068
- return helper.getIndex();
16069
- },
16070
+ helper: helper,
16070
16071
  widgetType: this.$$type,
16071
16072
  instantSearchInstance: instantSearchInstance
16072
16073
  });
@@ -18336,9 +18337,7 @@
18336
18337
  if (!sendEvent) {
18337
18338
  sendEvent = createSendEventForHits({
18338
18339
  instantSearchInstance: instantSearchInstance,
18339
- getIndex: function getIndex() {
18340
- return helper.getIndex();
18341
- },
18340
+ helper: helper,
18342
18341
  widgetType: this.$$type
18343
18342
  });
18344
18343
  }
@@ -18973,6 +18972,7 @@
18973
18972
  // only send an event when the refinement gets applied,
18974
18973
  // not when it gets removed
18975
18974
  if (!isRefined) {
18975
+ var _helper$lastResults;
18976
18976
  instantSearchInstance.sendEventToInsights({
18977
18977
  insightsMethod: 'clickedFilters',
18978
18978
  widgetType: $$type$3,
@@ -18980,7 +18980,7 @@
18980
18980
  eventModifier: eventModifier,
18981
18981
  payload: {
18982
18982
  eventName: eventName,
18983
- index: helper.getIndex(),
18983
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
18984
18984
  filters: on.map(function (value) {
18985
18985
  return "".concat(attribute, ":").concat(value);
18986
18986
  })
@@ -19347,9 +19347,7 @@
19347
19347
  if (!sendEvent) {
19348
19348
  sendEvent = createSendEventForHits({
19349
19349
  instantSearchInstance: instantSearchInstance,
19350
- getIndex: function getIndex() {
19351
- return helper.getIndex();
19352
- },
19350
+ helper: helper,
19353
19351
  widgetType: this.$$type
19354
19352
  });
19355
19353
  }
@@ -19504,9 +19502,7 @@
19504
19502
  if (!sendEvent) {
19505
19503
  sendEvent = createSendEventForHits({
19506
19504
  instantSearchInstance: instantSearchInstance,
19507
- getIndex: function getIndex() {
19508
- return helper.getIndex();
19509
- },
19505
+ helper: helper,
19510
19506
  widgetType: this.$$type
19511
19507
  });
19512
19508
  }