@decocms/blocks 7.85.0 → 7.85.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/blocks",
3
- "version": "7.85.0",
3
+ "version": "7.85.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"
@@ -91,16 +91,16 @@ export const DEFAULT_ORIGIN = "https://analytics.decocdn.com";
91
91
  /**
92
92
  * On unless "false", and independent of `ONEDOLLAR_ENABLED` so both can run at once.
93
93
  */
94
- const DECO_ANALYTICS_ENABLED = process.env.DECO_ANALYTICS_ENABLED !== "false";
95
- const DECO_ANALYTICS_FIRST_PARTY = process.env.DECO_ANALYTICS_FIRST_PARTY === "true";
96
- const DECO_ANALYTICS_ORIGIN = process.env.DECO_ANALYTICS_ORIGIN;
97
- const DECO_ANALYTICS_SITE_KEY = process.env.DECO_ANALYTICS_SITE_KEY;
98
-
99
94
  function Stats({ origin, siteKey, defer, dev, debug }: Props) {
100
- if (!DECO_ANALYTICS_ENABLED) return null;
95
+ // Read at render, not at import: the `@decocms/blocks/hooks` barrel reaches client bundles, and
96
+ // `process` does not exist in a browser unless the bundler provides it.
97
+ if (process.env.DECO_ANALYTICS_ENABLED === "false") return null;
101
98
 
102
- const base = origin ?? DECO_ANALYTICS_ORIGIN ?? (DECO_ANALYTICS_FIRST_PARTY ? "" : DEFAULT_ORIGIN);
103
- const key = siteKey ?? DECO_ANALYTICS_SITE_KEY;
99
+ const base =
100
+ origin ??
101
+ process.env.DECO_ANALYTICS_ORIGIN ??
102
+ (process.env.DECO_ANALYTICS_FIRST_PARTY === "true" ? "" : DEFAULT_ORIGIN);
103
+ const key = siteKey ?? process.env.DECO_ANALYTICS_SITE_KEY;
104
104
  if (base === DEFAULT_ORIGIN && !key) return null;
105
105
 
106
106
  return (