@momentumcms/plugins-analytics 0.3.0 → 0.4.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.
package/index.cjs CHANGED
@@ -36,6 +36,10 @@ __export(block_tracker_exports, {
36
36
  attachBlockTracking: () => attachBlockTracking
37
37
  });
38
38
  function attachBlockTracking(tracker, container) {
39
+ if (typeof document === "undefined" || !document.body) {
40
+ return () => {
41
+ };
42
+ }
39
43
  const root = container ?? document.body;
40
44
  const impressionsSeen = /* @__PURE__ */ new Set();
41
45
  const hoverCooldowns = /* @__PURE__ */ new Map();
@@ -2086,11 +2090,11 @@ function analyticsPlugin(config) {
2086
2090
  // Browser-safe import paths for the admin config generator
2087
2091
  browserImports: {
2088
2092
  adminRoutes: {
2089
- path: "@momentumcms/plugins/analytics/admin-routes",
2093
+ path: "@momentumcms/plugins-analytics/admin-routes",
2090
2094
  exportName: "analyticsAdminRoutes"
2091
2095
  },
2092
2096
  modifyCollections: {
2093
- path: "@momentumcms/plugins/analytics/block-fields",
2097
+ path: "@momentumcms/plugins-analytics/block-fields",
2094
2098
  exportName: "injectBlockAnalyticsFields"
2095
2099
  }
2096
2100
  },
package/index.js CHANGED
@@ -14,6 +14,10 @@ __export(block_tracker_exports, {
14
14
  attachBlockTracking: () => attachBlockTracking
15
15
  });
16
16
  function attachBlockTracking(tracker, container) {
17
+ if (typeof document === "undefined" || !document.body) {
18
+ return () => {
19
+ };
20
+ }
17
21
  const root = container ?? document.body;
18
22
  const impressionsSeen = /* @__PURE__ */ new Set();
19
23
  const hoverCooldowns = /* @__PURE__ */ new Map();
@@ -2054,11 +2058,11 @@ function analyticsPlugin(config) {
2054
2058
  // Browser-safe import paths for the admin config generator
2055
2059
  browserImports: {
2056
2060
  adminRoutes: {
2057
- path: "@momentumcms/plugins/analytics/admin-routes",
2061
+ path: "@momentumcms/plugins-analytics/admin-routes",
2058
2062
  exportName: "analyticsAdminRoutes"
2059
2063
  },
2060
2064
  modifyCollections: {
2061
- path: "@momentumcms/plugins/analytics/block-fields",
2065
+ path: "@momentumcms/plugins-analytics/block-fields",
2062
2066
  exportName: "injectBlockAnalyticsFields"
2063
2067
  }
2064
2068
  },