react-instantsearch 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.
package/README.md CHANGED
@@ -51,7 +51,7 @@ Using React InstantSearch is as simple as adding these components to your app:
51
51
  ```javascript
52
52
  import React from 'react';
53
53
  import ReactDOM from 'react-dom';
54
- import algoliasearch from 'algoliasearch/lite';
54
+ import { liteClient as algoliasearch } from 'algoliasearch/lite';
55
55
  import { InstantSearch, SearchBox, Hits } from 'react-instantsearch';
56
56
 
57
57
  const searchClient = algoliasearch(
@@ -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
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -804,7 +804,16 @@
804
804
  var facets = state.facets
805
805
  .concat(
806
806
  state.disjunctiveFacets.map(function (value) {
807
- return 'disjunctive(' + value + ')';
807
+ if (
808
+ state.disjunctiveFacetsRefinements &&
809
+ state.disjunctiveFacetsRefinements[value] &&
810
+ state.disjunctiveFacetsRefinements[value].length > 0
811
+ ) {
812
+ // only tag a disjunctiveFacet as disjunctive if it has a value selected
813
+ // this helps avoid hitting the limit of 20 disjunctive facets in the Composition API
814
+ return 'disjunctive(' + value + ')';
815
+ }
816
+ return value;
808
817
  })
809
818
  )
810
819
  .concat(requestBuilder._getHitsHierarchicalFacetsAttributes(state))
@@ -4623,7 +4632,7 @@
4623
4632
 
4624
4633
  var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
4625
4634
 
4626
- var version$1 = '3.24.1';
4635
+ var version$1 = '3.24.3';
4627
4636
 
4628
4637
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4629
4638
 
@@ -7521,6 +7530,7 @@
7521
7530
  instantSearchInstance.sendEventToInsights(args[0]);
7522
7531
  } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
7523
7532
  if (!isFacetRefined(helper, attribute, facetValue)) {
7533
+ var _helper$lastResults;
7524
7534
  // send event only when the facet is being checked "ON"
7525
7535
  instantSearchInstance.sendEventToInsights({
7526
7536
  insightsMethod: 'clickedFilters',
@@ -7529,7 +7539,7 @@
7529
7539
  eventModifier: eventModifier,
7530
7540
  payload: _objectSpread$1({
7531
7541
  eventName: eventName,
7532
- index: helper.getIndex(),
7542
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7533
7543
  filters: ["".concat(attribute, ":").concat(facetValue)]
7534
7544
  }, additionalData),
7535
7545
  attribute: attribute
@@ -7660,7 +7670,7 @@
7660
7670
  return chunks;
7661
7671
  }
7662
7672
  function _buildEventPayloadsForHits(_ref) {
7663
- var getIndex = _ref.getIndex,
7673
+ var helper = _ref.helper,
7664
7674
  widgetType = _ref.widgetType,
7665
7675
  methodName = _ref.methodName,
7666
7676
  args = _ref.args,
@@ -7707,13 +7717,14 @@
7707
7717
  return [];
7708
7718
  }
7709
7719
  return hitsChunks.map(function (batch, i) {
7720
+ var _helper$lastResults;
7710
7721
  return {
7711
7722
  insightsMethod: 'viewedObjectIDs',
7712
7723
  widgetType: widgetType,
7713
7724
  eventType: eventType,
7714
7725
  payload: _objectSpread$2({
7715
7726
  eventName: eventName || 'Hits Viewed',
7716
- index: getIndex(),
7727
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
7717
7728
  objectIDs: objectIDsByChunk[i]
7718
7729
  }, additionalData),
7719
7730
  hits: batch,
@@ -7722,13 +7733,14 @@
7722
7733
  });
7723
7734
  } else if (eventType === 'click') {
7724
7735
  return hitsChunks.map(function (batch, i) {
7736
+ var _helper$lastResults2;
7725
7737
  return {
7726
7738
  insightsMethod: 'clickedObjectIDsAfterSearch',
7727
7739
  widgetType: widgetType,
7728
7740
  eventType: eventType,
7729
7741
  payload: _objectSpread$2({
7730
7742
  eventName: eventName || 'Hit Clicked',
7731
- index: getIndex(),
7743
+ index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
7732
7744
  queryID: queryID,
7733
7745
  objectIDs: objectIDsByChunk[i],
7734
7746
  positions: positionsByChunk[i]
@@ -7739,13 +7751,14 @@
7739
7751
  });
7740
7752
  } else if (eventType === 'conversion') {
7741
7753
  return hitsChunks.map(function (batch, i) {
7754
+ var _helper$lastResults3;
7742
7755
  return {
7743
7756
  insightsMethod: 'convertedObjectIDsAfterSearch',
7744
7757
  widgetType: widgetType,
7745
7758
  eventType: eventType,
7746
7759
  payload: _objectSpread$2({
7747
7760
  eventName: eventName || 'Hit Converted',
7748
- index: getIndex(),
7761
+ index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
7749
7762
  queryID: queryID,
7750
7763
  objectIDs: objectIDsByChunk[i]
7751
7764
  }, additionalData),
@@ -7759,7 +7772,7 @@
7759
7772
  }
7760
7773
  function createSendEventForHits(_ref2) {
7761
7774
  var instantSearchInstance = _ref2.instantSearchInstance,
7762
- getIndex = _ref2.getIndex,
7775
+ helper = _ref2.helper,
7763
7776
  widgetType = _ref2.widgetType;
7764
7777
  var sentEvents = {};
7765
7778
  var timer = undefined;
@@ -7769,7 +7782,7 @@
7769
7782
  }
7770
7783
  var payloads = _buildEventPayloadsForHits({
7771
7784
  widgetType: widgetType,
7772
- getIndex: getIndex,
7785
+ helper: helper,
7773
7786
  methodName: 'sendEvent',
7774
7787
  args: args,
7775
7788
  instantSearchInstance: instantSearchInstance
@@ -7789,7 +7802,7 @@
7789
7802
  return sendEventForHits;
7790
7803
  }
7791
7804
  function createBindEventForHits(_ref3) {
7792
- var getIndex = _ref3.getIndex,
7805
+ var helper = _ref3.helper,
7793
7806
  widgetType = _ref3.widgetType,
7794
7807
  instantSearchInstance = _ref3.instantSearchInstance;
7795
7808
  var bindEventForHits = function bindEventForHits() {
@@ -7798,7 +7811,7 @@
7798
7811
  }
7799
7812
  var payloads = _buildEventPayloadsForHits({
7800
7813
  widgetType: widgetType,
7801
- getIndex: getIndex,
7814
+ helper: helper,
7802
7815
  methodName: 'bindEvent',
7803
7816
  args: args,
7804
7817
  instantSearchInstance: instantSearchInstance
@@ -13417,7 +13430,7 @@
13417
13430
  };
13418
13431
  }
13419
13432
 
13420
- var version$3 = '4.77.3';
13433
+ var version$3 = '4.78.1';
13421
13434
 
13422
13435
  function _typeof$q(o) {
13423
13436
  "@babel/helpers - typeof";
@@ -15454,9 +15467,7 @@
15454
15467
  if (!sendEvent) {
15455
15468
  sendEvent = createSendEventForHits({
15456
15469
  instantSearchInstance: instantSearchInstance,
15457
- getIndex: function getIndex() {
15458
- return helper.getIndex();
15459
- },
15470
+ helper: helper,
15460
15471
  widgetType: this.$$type
15461
15472
  });
15462
15473
  }
@@ -15708,9 +15719,7 @@
15708
15719
  if (!sendEvent) {
15709
15720
  sendEvent = createSendEventForHits({
15710
15721
  instantSearchInstance: instantSearchInstance,
15711
- getIndex: function getIndex() {
15712
- return helper.getIndex();
15713
- },
15722
+ helper: helper,
15714
15723
  widgetType: $$type
15715
15724
  });
15716
15725
  }
@@ -16242,17 +16251,13 @@
16242
16251
  if (!sendEvent) {
16243
16252
  sendEvent = createSendEventForHits({
16244
16253
  instantSearchInstance: instantSearchInstance,
16245
- getIndex: function getIndex() {
16246
- return helper.getIndex();
16247
- },
16254
+ helper: helper,
16248
16255
  widgetType: this.$$type
16249
16256
  });
16250
16257
  }
16251
16258
  if (!bindEvent) {
16252
16259
  bindEvent = createBindEventForHits({
16253
- getIndex: function getIndex() {
16254
- return helper.getIndex();
16255
- },
16260
+ helper: helper,
16256
16261
  widgetType: this.$$type,
16257
16262
  instantSearchInstance: instantSearchInstance
16258
16263
  });
@@ -16788,15 +16793,11 @@
16788
16793
  showMore = getShowMore(helper);
16789
16794
  sendEvent = createSendEventForHits({
16790
16795
  instantSearchInstance: instantSearchInstance,
16791
- getIndex: function getIndex() {
16792
- return helper.getIndex();
16793
- },
16796
+ helper: helper,
16794
16797
  widgetType: this.$$type
16795
16798
  });
16796
16799
  bindEvent = createBindEventForHits({
16797
- getIndex: function getIndex() {
16798
- return helper.getIndex();
16799
- },
16800
+ helper: helper,
16800
16801
  widgetType: this.$$type,
16801
16802
  instantSearchInstance: instantSearchInstance
16802
16803
  });
@@ -19066,9 +19067,7 @@
19066
19067
  if (!sendEvent) {
19067
19068
  sendEvent = createSendEventForHits({
19068
19069
  instantSearchInstance: instantSearchInstance,
19069
- getIndex: function getIndex() {
19070
- return helper.getIndex();
19071
- },
19070
+ helper: helper,
19072
19071
  widgetType: this.$$type
19073
19072
  });
19074
19073
  }
@@ -19703,6 +19702,7 @@
19703
19702
  // only send an event when the refinement gets applied,
19704
19703
  // not when it gets removed
19705
19704
  if (!isRefined) {
19705
+ var _helper$lastResults;
19706
19706
  instantSearchInstance.sendEventToInsights({
19707
19707
  insightsMethod: 'clickedFilters',
19708
19708
  widgetType: $$type$3,
@@ -19710,7 +19710,7 @@
19710
19710
  eventModifier: eventModifier,
19711
19711
  payload: {
19712
19712
  eventName: eventName,
19713
- index: helper.getIndex(),
19713
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
19714
19714
  filters: on.map(function (value) {
19715
19715
  return "".concat(attribute, ":").concat(value);
19716
19716
  })
@@ -20077,9 +20077,7 @@
20077
20077
  if (!sendEvent) {
20078
20078
  sendEvent = createSendEventForHits({
20079
20079
  instantSearchInstance: instantSearchInstance,
20080
- getIndex: function getIndex() {
20081
- return helper.getIndex();
20082
- },
20080
+ helper: helper,
20083
20081
  widgetType: this.$$type
20084
20082
  });
20085
20083
  }
@@ -20234,9 +20232,7 @@
20234
20232
  if (!sendEvent) {
20235
20233
  sendEvent = createSendEventForHits({
20236
20234
  instantSearchInstance: instantSearchInstance,
20237
- getIndex: function getIndex() {
20238
- return helper.getIndex();
20239
- },
20235
+ helper: helper,
20240
20236
  widgetType: this.$$type
20241
20237
  });
20242
20238
  }