algolia-experiences 1.4.2 → 1.4.3

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.
@@ -10392,10 +10392,33 @@
10392
10392
  return insightsClient(method, payload, extraParams);
10393
10393
  };
10394
10394
  }
10395
+ var viewedObjectIDs = new Set();
10396
+ var lastQueryId;
10397
+ instantSearchInstance.mainHelper.derivedHelpers[0].on('result', function (_ref11) {
10398
+ var results = _ref11.results;
10399
+ if (!results.queryID || results.queryID !== lastQueryId) {
10400
+ lastQueryId = results.queryID;
10401
+ viewedObjectIDs.clear();
10402
+ }
10403
+ });
10395
10404
  instantSearchInstance.sendEventToInsights = function (event) {
10396
10405
  if (onEvent) {
10397
10406
  onEvent(event, insightsClientWithLocalCredentials);
10398
10407
  } else if (event.insightsMethod) {
10408
+ if (event.insightsMethod === 'viewedObjectIDs') {
10409
+ var _payload = event.payload;
10410
+ var difference = _payload.objectIDs.filter(function (objectID) {
10411
+ return !viewedObjectIDs.has(objectID);
10412
+ });
10413
+ if (difference.length === 0) {
10414
+ return;
10415
+ }
10416
+ difference.forEach(function (objectID) {
10417
+ return viewedObjectIDs.add(objectID);
10418
+ });
10419
+ _payload.objectIDs = difference;
10420
+ }
10421
+
10399
10422
  // Source is used to differentiate events sent by instantsearch from those sent manually.
10400
10423
  event.payload.algoliaSource = ['instantsearch'];
10401
10424
  if ($$automatic) {
@@ -12798,7 +12821,7 @@
12798
12821
  };
12799
12822
  }
12800
12823
 
12801
- var version$1 = '4.75.3';
12824
+ var version$1 = '4.75.4';
12802
12825
 
12803
12826
  function _typeof$j(obj) {
12804
12827
  "@babel/helpers - typeof";
@@ -13542,7 +13565,7 @@
13542
13565
  return experience;
13543
13566
  });
13544
13567
  }
13545
- var API_BASE = 'https://experiences-main.platform.algolia.net/1';
13568
+ var API_BASE = 'https://experiences-beta.algolia.com/1';
13546
13569
  function getExperience(_ref2) {
13547
13570
  var id = _ref2.id,
13548
13571
  appId = _ref2.appId,
@@ -13550,7 +13573,7 @@
13550
13573
  return buildRequest({
13551
13574
  appId: appId,
13552
13575
  apiKey: apiKey,
13553
- endpoint: "collections/".concat(id)
13576
+ endpoint: "experiences/".concat(id)
13554
13577
  });
13555
13578
  }
13556
13579
  function buildRequest(_ref5) {