instantsearch.js 4.77.2 → 4.78.0

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.
Files changed (33) hide show
  1. package/cjs/connectors/autocomplete/connectAutocomplete.js +4 -7
  2. package/cjs/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.js +1 -3
  3. package/cjs/connectors/geo-search/connectGeoSearch.js +1 -3
  4. package/cjs/connectors/hits/connectHits.js +2 -6
  5. package/cjs/connectors/infinite-hits/connectInfiniteHits.js +2 -6
  6. package/cjs/connectors/looking-similar/connectLookingSimilar.js +1 -3
  7. package/cjs/connectors/rating-menu/connectRatingMenu.js +2 -1
  8. package/cjs/connectors/related-products/connectRelatedProducts.js +1 -3
  9. package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +2 -1
  10. package/cjs/connectors/trending-items/connectTrendingItems.js +1 -3
  11. package/cjs/lib/utils/createSendEventForFacet.js +2 -1
  12. package/cjs/lib/utils/createSendEventForHits.js +11 -8
  13. package/cjs/lib/version.js +1 -1
  14. package/dist/instantsearch.development.js +39 -52
  15. package/dist/instantsearch.development.js.map +1 -1
  16. package/dist/instantsearch.production.min.js +2 -2
  17. package/dist/instantsearch.production.min.js.map +1 -1
  18. package/es/connectors/autocomplete/connectAutocomplete.js +4 -7
  19. package/es/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.js +1 -3
  20. package/es/connectors/geo-search/connectGeoSearch.js +1 -3
  21. package/es/connectors/hits/connectHits.js +2 -6
  22. package/es/connectors/infinite-hits/connectInfiniteHits.js +2 -6
  23. package/es/connectors/looking-similar/connectLookingSimilar.js +1 -3
  24. package/es/connectors/rating-menu/connectRatingMenu.js +2 -1
  25. package/es/connectors/related-products/connectRelatedProducts.js +1 -3
  26. package/es/connectors/toggle-refinement/connectToggleRefinement.js +2 -1
  27. package/es/connectors/trending-items/connectTrendingItems.js +1 -3
  28. package/es/lib/utils/createSendEventForFacet.js +2 -1
  29. package/es/lib/utils/createSendEventForHits.d.ts +7 -6
  30. package/es/lib/utils/createSendEventForHits.js +11 -8
  31. package/es/lib/version.d.ts +1 -1
  32. package/es/lib/version.js +1 -1
  33. package/package.json +6 -6
@@ -64,7 +64,7 @@ var connectAutocomplete = function connectAutocomplete(renderFn) {
64
64
  };
65
65
  }
66
66
  var indices = scopedResults.map(function (scopedResult) {
67
- var _scopedResult$results2, _scopedResult$results3;
67
+ var _scopedResult$results, _scopedResult$results2;
68
68
  // We need to escape the hits because highlighting
69
69
  // exposes HTML tags to the end-user.
70
70
  if (scopedResult.results) {
@@ -72,16 +72,13 @@ var connectAutocomplete = function connectAutocomplete(renderFn) {
72
72
  }
73
73
  var sendEvent = (0, _utils.createSendEventForHits)({
74
74
  instantSearchInstance: instantSearchInstance,
75
- getIndex: function getIndex() {
76
- var _scopedResult$results;
77
- return ((_scopedResult$results = scopedResult.results) === null || _scopedResult$results === void 0 ? void 0 : _scopedResult$results.index) || '';
78
- },
75
+ helper: scopedResult.helper,
79
76
  widgetType: _this.$$type
80
77
  });
81
78
  return {
82
79
  indexId: scopedResult.indexId,
83
- indexName: ((_scopedResult$results2 = scopedResult.results) === null || _scopedResult$results2 === void 0 ? void 0 : _scopedResult$results2.index) || '',
84
- hits: ((_scopedResult$results3 = scopedResult.results) === null || _scopedResult$results3 === void 0 ? void 0 : _scopedResult$results3.hits) || [],
80
+ indexName: ((_scopedResult$results = scopedResult.results) === null || _scopedResult$results === void 0 ? void 0 : _scopedResult$results.index) || '',
81
+ hits: ((_scopedResult$results2 = scopedResult.results) === null || _scopedResult$results2 === void 0 ? void 0 : _scopedResult$results2.hits) || [],
85
82
  results: scopedResult.results || {},
86
83
  sendEvent: sendEvent
87
84
  };
@@ -58,9 +58,7 @@ var connectFrequentlyBoughtTogether = exports.default = function connectFrequent
58
58
  if (!sendEvent) {
59
59
  sendEvent = (0, _utils.createSendEventForHits)({
60
60
  instantSearchInstance: instantSearchInstance,
61
- getIndex: function getIndex() {
62
- return helper.getIndex();
63
- },
61
+ helper: helper,
64
62
  widgetType: this.$$type
65
63
  });
66
64
  }
@@ -155,9 +155,7 @@ var connectGeoSearch = exports.default = function connectGeoSearch(renderFn) {
155
155
  if (!sendEvent) {
156
156
  sendEvent = (0, _utils.createSendEventForHits)({
157
157
  instantSearchInstance: instantSearchInstance,
158
- getIndex: function getIndex() {
159
- return helper.getIndex();
160
- },
158
+ helper: helper,
161
159
  widgetType: $$type
162
160
  });
163
161
  }
@@ -57,17 +57,13 @@ var connectHits = exports.default = function connectHits(renderFn) {
57
57
  if (!sendEvent) {
58
58
  sendEvent = (0, _utils.createSendEventForHits)({
59
59
  instantSearchInstance: instantSearchInstance,
60
- getIndex: function getIndex() {
61
- return helper.getIndex();
62
- },
60
+ helper: helper,
63
61
  widgetType: this.$$type
64
62
  });
65
63
  }
66
64
  if (!bindEvent) {
67
65
  bindEvent = (0, _utils.createBindEventForHits)({
68
- getIndex: function getIndex() {
69
- return helper.getIndex();
70
- },
66
+ helper: helper,
71
67
  widgetType: this.$$type,
72
68
  instantSearchInstance: instantSearchInstance
73
69
  });
@@ -162,15 +162,11 @@ var connectInfiniteHits = exports.default = function connectInfiniteHits(renderF
162
162
  showMore = getShowMore(helper);
163
163
  sendEvent = (0, _utils.createSendEventForHits)({
164
164
  instantSearchInstance: instantSearchInstance,
165
- getIndex: function getIndex() {
166
- return helper.getIndex();
167
- },
165
+ helper: helper,
168
166
  widgetType: this.$$type
169
167
  });
170
168
  bindEvent = (0, _utils.createBindEventForHits)({
171
- getIndex: function getIndex() {
172
- return helper.getIndex();
173
- },
169
+ helper: helper,
174
170
  widgetType: this.$$type,
175
171
  instantSearchInstance: instantSearchInstance
176
172
  });
@@ -59,9 +59,7 @@ var connectLookingSimilar = exports.default = function connectLookingSimilar(ren
59
59
  if (!sendEvent) {
60
60
  sendEvent = (0, _utils.createSendEventForHits)({
61
61
  instantSearchInstance: instantSearchInstance,
62
- getIndex: function getIndex() {
63
- return helper.getIndex();
64
- },
62
+ helper: helper,
65
63
  widgetType: this.$$type
66
64
  });
67
65
  }
@@ -53,6 +53,7 @@ var createSendEvent = function createSendEvent(_ref) {
53
53
  }
54
54
  var isRefined = getRefinedStar() === Number(facetValue);
55
55
  if (!isRefined) {
56
+ var _helper$lastResults;
56
57
  instantSearchInstance.sendEventToInsights({
57
58
  insightsMethod: 'clickedFilters',
58
59
  widgetType: $$type,
@@ -60,7 +61,7 @@ var createSendEvent = function createSendEvent(_ref) {
60
61
  eventModifier: eventModifier,
61
62
  payload: {
62
63
  eventName: eventName,
63
- index: helper.getIndex(),
64
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
64
65
  filters: ["".concat(attribute, ">=").concat(facetValue)]
65
66
  },
66
67
  attribute: attribute
@@ -59,9 +59,7 @@ var connectRelatedProducts = exports.default = function connectRelatedProducts(r
59
59
  if (!sendEvent) {
60
60
  sendEvent = (0, _utils.createSendEventForHits)({
61
61
  instantSearchInstance: instantSearchInstance,
62
- getIndex: function getIndex() {
63
- return helper.getIndex();
64
- },
62
+ helper: helper,
65
63
  widgetType: this.$$type
66
64
  });
67
65
  }
@@ -49,6 +49,7 @@ var createSendEvent = function createSendEvent(_ref) {
49
49
  // only send an event when the refinement gets applied,
50
50
  // not when it gets removed
51
51
  if (!isRefined) {
52
+ var _helper$lastResults;
52
53
  instantSearchInstance.sendEventToInsights({
53
54
  insightsMethod: 'clickedFilters',
54
55
  widgetType: $$type,
@@ -56,7 +57,7 @@ var createSendEvent = function createSendEvent(_ref) {
56
57
  eventModifier: eventModifier,
57
58
  payload: {
58
59
  eventName: eventName,
59
- index: helper.getIndex(),
60
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
60
61
  filters: on.map(function (value) {
61
62
  return "".concat(attribute, ":").concat(value);
62
63
  })
@@ -60,9 +60,7 @@ var connectTrendingItems = exports.default = function connectTrendingItems(rende
60
60
  if (!sendEvent) {
61
61
  sendEvent = (0, _utils.createSendEventForHits)({
62
62
  instantSearchInstance: instantSearchInstance,
63
- getIndex: function getIndex() {
64
- return helper.getIndex();
65
- },
63
+ helper: helper,
66
64
  widgetType: this.$$type
67
65
  });
68
66
  }
@@ -40,6 +40,7 @@ function createSendEventForFacet(_ref) {
40
40
  instantSearchInstance.sendEventToInsights(args[0]);
41
41
  } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
42
42
  if (!(0, _isFacetRefined.isFacetRefined)(helper, attribute, facetValue)) {
43
+ var _helper$lastResults;
43
44
  // send event only when the facet is being checked "ON"
44
45
  instantSearchInstance.sendEventToInsights({
45
46
  insightsMethod: 'clickedFilters',
@@ -48,7 +49,7 @@ function createSendEventForFacet(_ref) {
48
49
  eventModifier: eventModifier,
49
50
  payload: _objectSpread({
50
51
  eventName: eventName,
51
- index: helper.getIndex(),
52
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
52
53
  filters: ["".concat(attribute, ":").concat(facetValue)]
53
54
  }, additionalData),
54
55
  attribute: attribute
@@ -28,7 +28,7 @@ function chunk(arr) {
28
28
  return chunks;
29
29
  }
30
30
  function _buildEventPayloadsForHits(_ref) {
31
- var getIndex = _ref.getIndex,
31
+ var helper = _ref.helper,
32
32
  widgetType = _ref.widgetType,
33
33
  methodName = _ref.methodName,
34
34
  args = _ref.args,
@@ -79,13 +79,14 @@ function _buildEventPayloadsForHits(_ref) {
79
79
  return [];
80
80
  }
81
81
  return hitsChunks.map(function (batch, i) {
82
+ var _helper$lastResults;
82
83
  return {
83
84
  insightsMethod: 'viewedObjectIDs',
84
85
  widgetType: widgetType,
85
86
  eventType: eventType,
86
87
  payload: _objectSpread({
87
88
  eventName: eventName || 'Hits Viewed',
88
- index: getIndex(),
89
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
89
90
  objectIDs: objectIDsByChunk[i]
90
91
  }, additionalData),
91
92
  hits: batch,
@@ -94,13 +95,14 @@ function _buildEventPayloadsForHits(_ref) {
94
95
  });
95
96
  } else if (eventType === 'click') {
96
97
  return hitsChunks.map(function (batch, i) {
98
+ var _helper$lastResults2;
97
99
  return {
98
100
  insightsMethod: 'clickedObjectIDsAfterSearch',
99
101
  widgetType: widgetType,
100
102
  eventType: eventType,
101
103
  payload: _objectSpread({
102
104
  eventName: eventName || 'Hit Clicked',
103
- index: getIndex(),
105
+ index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
104
106
  queryID: queryID,
105
107
  objectIDs: objectIDsByChunk[i],
106
108
  positions: positionsByChunk[i]
@@ -111,13 +113,14 @@ function _buildEventPayloadsForHits(_ref) {
111
113
  });
112
114
  } else if (eventType === 'conversion') {
113
115
  return hitsChunks.map(function (batch, i) {
116
+ var _helper$lastResults3;
114
117
  return {
115
118
  insightsMethod: 'convertedObjectIDsAfterSearch',
116
119
  widgetType: widgetType,
117
120
  eventType: eventType,
118
121
  payload: _objectSpread({
119
122
  eventName: eventName || 'Hit Converted',
120
- index: getIndex(),
123
+ index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
121
124
  queryID: queryID,
122
125
  objectIDs: objectIDsByChunk[i]
123
126
  }, additionalData),
@@ -133,7 +136,7 @@ function _buildEventPayloadsForHits(_ref) {
133
136
  }
134
137
  function createSendEventForHits(_ref2) {
135
138
  var instantSearchInstance = _ref2.instantSearchInstance,
136
- getIndex = _ref2.getIndex,
139
+ helper = _ref2.helper,
137
140
  widgetType = _ref2.widgetType;
138
141
  var sentEvents = {};
139
142
  var timer = undefined;
@@ -143,7 +146,7 @@ function createSendEventForHits(_ref2) {
143
146
  }
144
147
  var payloads = _buildEventPayloadsForHits({
145
148
  widgetType: widgetType,
146
- getIndex: getIndex,
149
+ helper: helper,
147
150
  methodName: 'sendEvent',
148
151
  args: args,
149
152
  instantSearchInstance: instantSearchInstance
@@ -163,7 +166,7 @@ function createSendEventForHits(_ref2) {
163
166
  return sendEventForHits;
164
167
  }
165
168
  function createBindEventForHits(_ref3) {
166
- var getIndex = _ref3.getIndex,
169
+ var helper = _ref3.helper,
167
170
  widgetType = _ref3.widgetType,
168
171
  instantSearchInstance = _ref3.instantSearchInstance;
169
172
  var bindEventForHits = function bindEventForHits() {
@@ -172,7 +175,7 @@ function createBindEventForHits(_ref3) {
172
175
  }
173
176
  var payloads = _buildEventPayloadsForHits({
174
177
  widgetType: widgetType,
175
- getIndex: getIndex,
178
+ helper: helper,
176
179
  methodName: 'bindEvent',
177
180
  args: args,
178
181
  instantSearchInstance: instantSearchInstance
@@ -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 = '4.77.2';
7
+ var _default = exports.default = '4.78.0';
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.77.2 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
1
+ /*! InstantSearch.js 4.78.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -772,6 +772,7 @@
772
772
  instantSearchInstance.sendEventToInsights(args[0]);
773
773
  } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
774
774
  if (!isFacetRefined(helper, attribute, facetValue)) {
775
+ var _helper$lastResults;
775
776
  // send event only when the facet is being checked "ON"
776
777
  instantSearchInstance.sendEventToInsights({
777
778
  insightsMethod: 'clickedFilters',
@@ -780,7 +781,7 @@
780
781
  eventModifier: eventModifier,
781
782
  payload: _objectSpread2({
782
783
  eventName: eventName,
783
- index: helper.getIndex(),
784
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
784
785
  filters: ["".concat(attribute, ":").concat(facetValue)]
785
786
  }, additionalData),
786
787
  attribute: attribute
@@ -809,7 +810,7 @@
809
810
  return chunks;
810
811
  }
811
812
  function _buildEventPayloadsForHits(_ref) {
812
- var getIndex = _ref.getIndex,
813
+ var helper = _ref.helper,
813
814
  widgetType = _ref.widgetType,
814
815
  methodName = _ref.methodName,
815
816
  args = _ref.args,
@@ -856,13 +857,14 @@
856
857
  return [];
857
858
  }
858
859
  return hitsChunks.map(function (batch, i) {
860
+ var _helper$lastResults;
859
861
  return {
860
862
  insightsMethod: 'viewedObjectIDs',
861
863
  widgetType: widgetType,
862
864
  eventType: eventType,
863
865
  payload: _objectSpread2({
864
866
  eventName: eventName || 'Hits Viewed',
865
- index: getIndex(),
867
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
866
868
  objectIDs: objectIDsByChunk[i]
867
869
  }, additionalData),
868
870
  hits: batch,
@@ -871,13 +873,14 @@
871
873
  });
872
874
  } else if (eventType === 'click') {
873
875
  return hitsChunks.map(function (batch, i) {
876
+ var _helper$lastResults2;
874
877
  return {
875
878
  insightsMethod: 'clickedObjectIDsAfterSearch',
876
879
  widgetType: widgetType,
877
880
  eventType: eventType,
878
881
  payload: _objectSpread2({
879
882
  eventName: eventName || 'Hit Clicked',
880
- index: getIndex(),
883
+ index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
881
884
  queryID: queryID,
882
885
  objectIDs: objectIDsByChunk[i],
883
886
  positions: positionsByChunk[i]
@@ -888,13 +891,14 @@
888
891
  });
889
892
  } else if (eventType === 'conversion') {
890
893
  return hitsChunks.map(function (batch, i) {
894
+ var _helper$lastResults3;
891
895
  return {
892
896
  insightsMethod: 'convertedObjectIDsAfterSearch',
893
897
  widgetType: widgetType,
894
898
  eventType: eventType,
895
899
  payload: _objectSpread2({
896
900
  eventName: eventName || 'Hit Converted',
897
- index: getIndex(),
901
+ index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
898
902
  queryID: queryID,
899
903
  objectIDs: objectIDsByChunk[i]
900
904
  }, additionalData),
@@ -908,7 +912,7 @@
908
912
  }
909
913
  function createSendEventForHits(_ref2) {
910
914
  var instantSearchInstance = _ref2.instantSearchInstance,
911
- getIndex = _ref2.getIndex,
915
+ helper = _ref2.helper,
912
916
  widgetType = _ref2.widgetType;
913
917
  var sentEvents = {};
914
918
  var timer = undefined;
@@ -918,7 +922,7 @@
918
922
  }
919
923
  var payloads = _buildEventPayloadsForHits({
920
924
  widgetType: widgetType,
921
- getIndex: getIndex,
925
+ helper: helper,
922
926
  methodName: 'sendEvent',
923
927
  args: args,
924
928
  instantSearchInstance: instantSearchInstance
@@ -938,7 +942,7 @@
938
942
  return sendEventForHits;
939
943
  }
940
944
  function createBindEventForHits(_ref3) {
941
- var getIndex = _ref3.getIndex,
945
+ var helper = _ref3.helper,
942
946
  widgetType = _ref3.widgetType,
943
947
  instantSearchInstance = _ref3.instantSearchInstance;
944
948
  var bindEventForHits = function bindEventForHits() {
@@ -947,7 +951,7 @@
947
951
  }
948
952
  var payloads = _buildEventPayloadsForHits({
949
953
  widgetType: widgetType,
950
- getIndex: getIndex,
954
+ helper: helper,
951
955
  methodName: 'bindEvent',
952
956
  args: args,
953
957
  instantSearchInstance: instantSearchInstance
@@ -6583,7 +6587,7 @@
6583
6587
 
6584
6588
  var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
6585
6589
 
6586
- var version = '3.24.0';
6590
+ var version = '3.24.2';
6587
6591
 
6588
6592
  var escapeFacetValue$4 = escapeFacetValue_1.escapeFacetValue;
6589
6593
 
@@ -8426,8 +8430,11 @@
8426
8430
  if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');
8427
8431
 
8428
8432
  var results = content.results.slice();
8429
- var rawContent = Object.create(content);
8430
- delete rawContent.results;
8433
+ var rawContent = Object.keys(content).reduce(function (value, key) {
8434
+ if (key !== 'results') value[key] = content[key];
8435
+ return value;
8436
+ }, {});
8437
+
8431
8438
  if (Object.keys(rawContent).length <= 0) {
8432
8439
  rawContent = undefined;
8433
8440
  }
@@ -8451,12 +8458,11 @@
8451
8458
  specificResults,
8452
8459
  self._searchResultsOptions
8453
8460
  );
8454
- helper.lastResults._rawContent = rawContent;
8461
+ if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;
8455
8462
 
8456
8463
  helper.emit('result', {
8457
8464
  results: helper.lastResults,
8458
8465
  state: state,
8459
- _rawContent: rawContent,
8460
8466
  });
8461
8467
  });
8462
8468
  };
@@ -9714,17 +9720,13 @@
9714
9720
  if (!sendEvent) {
9715
9721
  sendEvent = createSendEventForHits({
9716
9722
  instantSearchInstance: instantSearchInstance,
9717
- getIndex: function getIndex() {
9718
- return helper.getIndex();
9719
- },
9723
+ helper: helper,
9720
9724
  widgetType: this.$$type
9721
9725
  });
9722
9726
  }
9723
9727
  if (!bindEvent) {
9724
9728
  bindEvent = createBindEventForHits({
9725
- getIndex: function getIndex() {
9726
- return helper.getIndex();
9727
- },
9729
+ helper: helper,
9728
9730
  widgetType: this.$$type,
9729
9731
  instantSearchInstance: instantSearchInstance
9730
9732
  });
@@ -10271,15 +10273,11 @@
10271
10273
  showMore = getShowMore(helper);
10272
10274
  sendEvent = createSendEventForHits({
10273
10275
  instantSearchInstance: instantSearchInstance,
10274
- getIndex: function getIndex() {
10275
- return helper.getIndex();
10276
- },
10276
+ helper: helper,
10277
10277
  widgetType: this.$$type
10278
10278
  });
10279
10279
  bindEvent = createBindEventForHits({
10280
- getIndex: function getIndex() {
10281
- return helper.getIndex();
10282
- },
10280
+ helper: helper,
10283
10281
  widgetType: this.$$type,
10284
10282
  instantSearchInstance: instantSearchInstance
10285
10283
  });
@@ -11625,9 +11623,7 @@
11625
11623
  if (!sendEvent) {
11626
11624
  sendEvent = createSendEventForHits({
11627
11625
  instantSearchInstance: instantSearchInstance,
11628
- getIndex: function getIndex() {
11629
- return helper.getIndex();
11630
- },
11626
+ helper: helper,
11631
11627
  widgetType: this.$$type
11632
11628
  });
11633
11629
  }
@@ -11898,6 +11894,7 @@
11898
11894
  }
11899
11895
  var isRefined = getRefinedStar() === Number(facetValue);
11900
11896
  if (!isRefined) {
11897
+ var _helper$lastResults;
11901
11898
  instantSearchInstance.sendEventToInsights({
11902
11899
  insightsMethod: 'clickedFilters',
11903
11900
  widgetType: $$type$2,
@@ -11905,7 +11902,7 @@
11905
11902
  eventModifier: eventModifier,
11906
11903
  payload: {
11907
11904
  eventName: eventName,
11908
- index: helper.getIndex(),
11905
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
11909
11906
  filters: ["".concat(attribute, ">=").concat(facetValue)]
11910
11907
  },
11911
11908
  attribute: attribute
@@ -12238,6 +12235,7 @@
12238
12235
  // only send an event when the refinement gets applied,
12239
12236
  // not when it gets removed
12240
12237
  if (!isRefined) {
12238
+ var _helper$lastResults;
12241
12239
  instantSearchInstance.sendEventToInsights({
12242
12240
  insightsMethod: 'clickedFilters',
12243
12241
  widgetType: $$type$3,
@@ -12245,7 +12243,7 @@
12245
12243
  eventModifier: eventModifier,
12246
12244
  payload: {
12247
12245
  eventName: eventName,
12248
- index: helper.getIndex(),
12246
+ index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
12249
12247
  filters: on.map(function (value) {
12250
12248
  return "".concat(attribute, ":").concat(value);
12251
12249
  })
@@ -12551,9 +12549,7 @@
12551
12549
  if (!sendEvent) {
12552
12550
  sendEvent = createSendEventForHits({
12553
12551
  instantSearchInstance: instantSearchInstance,
12554
- getIndex: function getIndex() {
12555
- return helper.getIndex();
12556
- },
12552
+ helper: helper,
12557
12553
  widgetType: this.$$type
12558
12554
  });
12559
12555
  }
@@ -12912,9 +12908,7 @@
12912
12908
  if (!sendEvent) {
12913
12909
  sendEvent = createSendEventForHits({
12914
12910
  instantSearchInstance: instantSearchInstance,
12915
- getIndex: function getIndex() {
12916
- return helper.getIndex();
12917
- },
12911
+ helper: helper,
12918
12912
  widgetType: $$type$4
12919
12913
  });
12920
12914
  }
@@ -13077,7 +13071,7 @@
13077
13071
  };
13078
13072
  }
13079
13073
  var indices = scopedResults.map(function (scopedResult) {
13080
- var _scopedResult$results2, _scopedResult$results3;
13074
+ var _scopedResult$results, _scopedResult$results2;
13081
13075
  // We need to escape the hits because highlighting
13082
13076
  // exposes HTML tags to the end-user.
13083
13077
  if (scopedResult.results) {
@@ -13085,16 +13079,13 @@
13085
13079
  }
13086
13080
  var sendEvent = createSendEventForHits({
13087
13081
  instantSearchInstance: instantSearchInstance,
13088
- getIndex: function getIndex() {
13089
- var _scopedResult$results;
13090
- return ((_scopedResult$results = scopedResult.results) === null || _scopedResult$results === void 0 ? void 0 : _scopedResult$results.index) || '';
13091
- },
13082
+ helper: scopedResult.helper,
13092
13083
  widgetType: _this.$$type
13093
13084
  });
13094
13085
  return {
13095
13086
  indexId: scopedResult.indexId,
13096
- indexName: ((_scopedResult$results2 = scopedResult.results) === null || _scopedResult$results2 === void 0 ? void 0 : _scopedResult$results2.index) || '',
13097
- hits: ((_scopedResult$results3 = scopedResult.results) === null || _scopedResult$results3 === void 0 ? void 0 : _scopedResult$results3.hits) || [],
13087
+ indexName: ((_scopedResult$results = scopedResult.results) === null || _scopedResult$results === void 0 ? void 0 : _scopedResult$results.index) || '',
13088
+ hits: ((_scopedResult$results2 = scopedResult.results) === null || _scopedResult$results2 === void 0 ? void 0 : _scopedResult$results2.hits) || [],
13098
13089
  results: scopedResult.results || {},
13099
13090
  sendEvent: sendEvent
13100
13091
  };
@@ -13653,9 +13644,7 @@
13653
13644
  if (!sendEvent) {
13654
13645
  sendEvent = createSendEventForHits({
13655
13646
  instantSearchInstance: instantSearchInstance,
13656
- getIndex: function getIndex() {
13657
- return helper.getIndex();
13658
- },
13647
+ helper: helper,
13659
13648
  widgetType: this.$$type
13660
13649
  });
13661
13650
  }
@@ -13749,9 +13738,7 @@
13749
13738
  if (!sendEvent) {
13750
13739
  sendEvent = createSendEventForHits({
13751
13740
  instantSearchInstance: instantSearchInstance,
13752
- getIndex: function getIndex() {
13753
- return helper.getIndex();
13754
- },
13741
+ helper: helper,
13755
13742
  widgetType: this.$$type
13756
13743
  });
13757
13744
  }
@@ -16415,7 +16402,7 @@
16415
16402
  };
16416
16403
  }
16417
16404
 
16418
- var version$1 = '4.77.2';
16405
+ var version$1 = '4.78.0';
16419
16406
 
16420
16407
  var withUsage$v = createDocumentationMessageGenerator({
16421
16408
  name: 'instantsearch'