@shellui/sdk 0.0.1 → 0.0.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.
Files changed (2) hide show
  1. package/package.json +2 -5
  2. package/src/index.js +15 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shellui/sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "ShellUI SDK - JavaScript SDK for ShellUI integration",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -22,11 +22,8 @@
22
22
  ],
23
23
  "author": "ShellUI",
24
24
  "license": "MIT",
25
- "dependencies": {
26
- "@shellui/core": "*"
27
- },
25
+ "dependencies": {},
28
26
  "publishConfig": {
29
27
  "access": "public"
30
28
  }
31
29
  }
32
-
package/src/index.js CHANGED
@@ -6,7 +6,10 @@
6
6
  class ShellUISDK {
7
7
  constructor() {
8
8
  this.initialized = false;
9
- this.currentPath = window.location.pathname + window.location.search + window.location.hash;
9
+ // Don't access window in constructor - it may not exist during SSR
10
+ this.currentPath = typeof window !== 'undefined'
11
+ ? window.location.pathname + window.location.search + window.location.hash
12
+ : '';
10
13
  this.version = '0.0.1';
11
14
  }
12
15
 
@@ -31,6 +34,11 @@ class ShellUISDK {
31
34
  * Sets up listeners for various URL change events
32
35
  */
33
36
  setupUrlMonitoring() {
37
+ // Guard against SSR - window and document may not exist
38
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
39
+ return;
40
+ }
41
+
34
42
  // Listen for popstate (back/forward buttons)
35
43
  window.addEventListener('popstate', () => this.handleUrlChange());
36
44
 
@@ -63,6 +71,9 @@ class ShellUISDK {
63
71
  }
64
72
 
65
73
  handleUrlChange() {
74
+ if (typeof window === 'undefined') {
75
+ return;
76
+ }
66
77
  const newPath = window.location.pathname + window.location.search + window.location.hash;
67
78
  if (newPath !== this.currentPath) {
68
79
  this.currentPath = newPath;
@@ -74,6 +85,9 @@ class ShellUISDK {
74
85
  * Sends a message to the parent frame with the current path information
75
86
  */
76
87
  notifyParent() {
88
+ if (typeof window === 'undefined') {
89
+ return;
90
+ }
77
91
  const message = {
78
92
  type: 'SHELLUI_URL_CHANGED',
79
93
  payload: {