react-instantsearch 7.13.6 → 7.13.8

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.13.6';
10
+ var version = '7.13.8';
11
11
 
12
12
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -11194,7 +11194,7 @@
11194
11194
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
11195
11195
  return arr2;
11196
11196
  }
11197
- var ALGOLIA_INSIGHTS_VERSION = '2.15.0';
11197
+ var ALGOLIA_INSIGHTS_VERSION = '2.17.2';
11198
11198
  var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
11199
11199
  function createInsightsMiddleware() {
11200
11200
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -11491,10 +11491,33 @@
11491
11491
  return insightsClient(method, payload, extraParams);
11492
11492
  };
11493
11493
  }
11494
+ var viewedObjectIDs = new Set();
11495
+ var lastQueryId;
11496
+ instantSearchInstance.mainHelper.derivedHelpers[0].on('result', function (_ref11) {
11497
+ var results = _ref11.results;
11498
+ if (!results.queryID || results.queryID !== lastQueryId) {
11499
+ lastQueryId = results.queryID;
11500
+ viewedObjectIDs.clear();
11501
+ }
11502
+ });
11494
11503
  instantSearchInstance.sendEventToInsights = function (event) {
11495
11504
  if (onEvent) {
11496
11505
  onEvent(event, insightsClientWithLocalCredentials);
11497
11506
  } else if (event.insightsMethod) {
11507
+ if (event.insightsMethod === 'viewedObjectIDs') {
11508
+ var _payload = event.payload;
11509
+ var difference = _payload.objectIDs.filter(function (objectID) {
11510
+ return !viewedObjectIDs.has(objectID);
11511
+ });
11512
+ if (difference.length === 0) {
11513
+ return;
11514
+ }
11515
+ difference.forEach(function (objectID) {
11516
+ return viewedObjectIDs.add(objectID);
11517
+ });
11518
+ _payload.objectIDs = difference;
11519
+ }
11520
+
11498
11521
  // Source is used to differentiate events sent by instantsearch from those sent manually.
11499
11522
  event.payload.algoliaSource = ['instantsearch'];
11500
11523
  if ($$automatic) {
@@ -13184,7 +13207,7 @@
13184
13207
  };
13185
13208
  }
13186
13209
 
13187
- var version$3 = '4.75.3';
13210
+ var version$3 = '4.75.5';
13188
13211
 
13189
13212
  function _typeof$q(obj) {
13190
13213
  "@babel/helpers - typeof";