@shopify/hydrogen 1.6.5 → 1.6.6

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.
@@ -35,14 +35,19 @@ function publish(eventname, guardDup = false, payload = {}) {
35
35
  const namedspacedEventname = getNamedspacedEventname(eventname);
36
36
  // De-dup events due to re-renders
37
37
  if (guardDup) {
38
- const eventGuardTimeout = guardDupEvents[namedspacedEventname];
38
+ const guardName = namedspacedEventname + ':' + pageAnalyticsData.url;
39
+ const eventGuardTimeout = guardDupEvents[guardName];
39
40
  if (eventGuardTimeout) {
40
- clearTimeout(eventGuardTimeout);
41
+ clearTimeout(eventGuardTimeout.timeout);
41
42
  }
42
43
  const namespacedTimeout = setTimeout(() => {
43
- publishEvent(namedspacedEventname, mergeDeep(pageAnalyticsData, payload));
44
- }, 100);
45
- guardDupEvents[namedspacedEventname] = namespacedTimeout;
44
+ publishEvent(namedspacedEventname, guardDupEvents[guardName].data);
45
+ delete guardDupEvents[guardName];
46
+ }, 2000);
47
+ guardDupEvents[guardName] = {
48
+ timeout: namespacedTimeout,
49
+ data: mergeDeep(pageAnalyticsData, payload),
50
+ };
46
51
  }
47
52
  else {
48
53
  publishEvent(namedspacedEventname, mergeDeep(pageAnalyticsData, payload));
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "1.6.5";
1
+ export declare const LIB_VERSION = "1.6.6";
@@ -1 +1 @@
1
- export const LIB_VERSION = '1.6.5';
1
+ export const LIB_VERSION = '1.6.6';
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "engines": {
8
8
  "node": ">=14"
9
9
  },
10
- "version": "1.6.5",
10
+ "version": "1.6.6",
11
11
  "description": "Modern custom Shopify storefronts",
12
12
  "license": "MIT",
13
13
  "main": "dist/esnext/index.js",