@faskai/ui-commons 0.0.0-alpha.4 → 0.0.0-alpha.5

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.
@@ -8,7 +8,13 @@ exports.trackLinkedInLead = trackLinkedInLead;
8
8
  const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const react_1 = require("react");
10
10
  function GTMProvider({ gtmId, children, environment = 'production' }) {
11
+ const [isClient, setIsClient] = (0, react_1.useState)(false);
11
12
  (0, react_1.useEffect)(() => {
13
+ setIsClient(true);
14
+ }, []);
15
+ (0, react_1.useEffect)(() => {
16
+ if (!isClient || typeof window === 'undefined')
17
+ return;
12
18
  // Initialize dataLayer
13
19
  window.dataLayer = window.dataLayer || [];
14
20
  // Load GTM script
@@ -40,7 +46,7 @@ function GTMProvider({ gtmId, children, environment = 'production' }) {
40
46
  noscript.parentNode.removeChild(noscript);
41
47
  }
42
48
  };
43
- }, [gtmId]);
49
+ }, [gtmId, isClient]);
44
50
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
45
51
  }
46
52
  // Helper function to track custom events
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@faskai/ui-commons",
3
3
  "author": "Fask AI <arko@fask.ai>",
4
- "version": "0.0.0-alpha.04",
4
+ "version": "0.0.0-alpha.5",
5
5
  "description": "Common UI components and utilities for Fask applications",
6
6
  "private": false,
7
7
  "main": "dist/index.js",
@@ -22,12 +22,12 @@
22
22
  "react-dom": "^18.0.0"
23
23
  },
24
24
  "devDependencies": {
25
+ "@types/node": "^20.0.0",
25
26
  "@types/react": "^18.0.0",
26
27
  "@types/react-dom": "^18.0.0",
27
- "@types/node": "^20.0.0",
28
- "typescript": "^5.0.0",
29
28
  "react": "^18.0.0",
30
- "react-dom": "^18.0.0"
29
+ "react-dom": "^18.0.0",
30
+ "typescript": "^5.0.0"
31
31
  },
32
32
  "packageManager": "yarn@1.22.22"
33
- }
33
+ }