shell-mirror 1.5.47 → 1.5.48
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 +1 -1
- package/public/app/dashboard.js +27 -0
- package/public/app/terminal.js +27 -0
- package/public/index.html +31 -0
package/package.json
CHANGED
package/public/app/dashboard.js
CHANGED
|
@@ -13,6 +13,23 @@ class ShellMirrorDashboard {
|
|
|
13
13
|
this.showLoading();
|
|
14
14
|
this.loadVersionInfo(); // Load version info immediately
|
|
15
15
|
|
|
16
|
+
// Debug Google Analytics setup
|
|
17
|
+
console.log('🔍 [DASHBOARD DEBUG] Checking Google Analytics setup...');
|
|
18
|
+
console.log('🔍 [DASHBOARD DEBUG] gtag function available:', typeof gtag !== 'undefined');
|
|
19
|
+
console.log('🔍 [DASHBOARD DEBUG] dataLayer exists:', typeof window.dataLayer !== 'undefined');
|
|
20
|
+
|
|
21
|
+
if (typeof gtag !== 'undefined') {
|
|
22
|
+
console.log('✅ [DASHBOARD DEBUG] Google Analytics is available');
|
|
23
|
+
// Send dashboard page view debug event
|
|
24
|
+
gtag('event', 'page_debug', {
|
|
25
|
+
event_category: 'debug',
|
|
26
|
+
event_label: 'dashboard_page_loaded'
|
|
27
|
+
});
|
|
28
|
+
console.log('📊 [DASHBOARD DEBUG] Dashboard page debug event sent');
|
|
29
|
+
} else {
|
|
30
|
+
console.warn('❌ [DASHBOARD DEBUG] Google Analytics gtag function not available');
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
try {
|
|
17
34
|
const authStatus = await this.checkAuthStatus();
|
|
18
35
|
|
|
@@ -431,13 +448,18 @@ class ShellMirrorDashboard {
|
|
|
431
448
|
console.log(`[DASHBOARD] ✅ Reconnecting to existing session: ${mostRecentSession.id}`);
|
|
432
449
|
|
|
433
450
|
// Track terminal connection in Google Analytics
|
|
451
|
+
console.log('🔍 [DASHBOARD DEBUG] Attempting to track terminal_connect (existing_session)');
|
|
434
452
|
if (typeof gtag !== 'undefined') {
|
|
453
|
+
console.log('📊 [DASHBOARD DEBUG] Sending terminal_connect event (existing_session) to Google Analytics');
|
|
435
454
|
gtag('event', 'terminal_connect', {
|
|
436
455
|
event_category: 'terminal',
|
|
437
456
|
event_label: 'existing_session',
|
|
438
457
|
agent_id: agentId,
|
|
439
458
|
session_id: mostRecentSession.id
|
|
440
459
|
});
|
|
460
|
+
console.log('✅ [DASHBOARD DEBUG] terminal_connect (existing_session) event sent successfully');
|
|
461
|
+
} else {
|
|
462
|
+
console.warn('❌ [DASHBOARD DEBUG] Cannot send terminal_connect event - gtag not available');
|
|
441
463
|
}
|
|
442
464
|
|
|
443
465
|
window.location.href = `/app/terminal.html?agent=${agentId}&session=${mostRecentSession.id}`;
|
|
@@ -446,12 +468,17 @@ class ShellMirrorDashboard {
|
|
|
446
468
|
console.log(`[DASHBOARD] 🆕 Creating new session for agent: ${agentId}`);
|
|
447
469
|
|
|
448
470
|
// Track new session creation in Google Analytics
|
|
471
|
+
console.log('🔍 [DASHBOARD DEBUG] Attempting to track terminal_connect (new_session)');
|
|
449
472
|
if (typeof gtag !== 'undefined') {
|
|
473
|
+
console.log('📊 [DASHBOARD DEBUG] Sending terminal_connect event (new_session) to Google Analytics');
|
|
450
474
|
gtag('event', 'terminal_connect', {
|
|
451
475
|
event_category: 'terminal',
|
|
452
476
|
event_label: 'new_session',
|
|
453
477
|
agent_id: agentId
|
|
454
478
|
});
|
|
479
|
+
console.log('✅ [DASHBOARD DEBUG] terminal_connect (new_session) event sent successfully');
|
|
480
|
+
} else {
|
|
481
|
+
console.warn('❌ [DASHBOARD DEBUG] Cannot send terminal_connect event - gtag not available');
|
|
455
482
|
}
|
|
456
483
|
|
|
457
484
|
window.location.href = `/app/terminal.html?agent=${agentId}`;
|
package/public/app/terminal.js
CHANGED
|
@@ -180,6 +180,23 @@ setInterval(() => {
|
|
|
180
180
|
window.addEventListener('load', () => {
|
|
181
181
|
loadVersionInfo();
|
|
182
182
|
|
|
183
|
+
// Debug Google Analytics setup
|
|
184
|
+
console.log('🔍 [TERMINAL DEBUG] Checking Google Analytics setup...');
|
|
185
|
+
console.log('🔍 [TERMINAL DEBUG] gtag function available:', typeof gtag !== 'undefined');
|
|
186
|
+
console.log('🔍 [TERMINAL DEBUG] dataLayer exists:', typeof window.dataLayer !== 'undefined');
|
|
187
|
+
|
|
188
|
+
if (typeof gtag !== 'undefined') {
|
|
189
|
+
console.log('✅ [TERMINAL DEBUG] Google Analytics is available');
|
|
190
|
+
// Send terminal page view debug event
|
|
191
|
+
gtag('event', 'page_debug', {
|
|
192
|
+
event_category: 'debug',
|
|
193
|
+
event_label: 'terminal_page_loaded'
|
|
194
|
+
});
|
|
195
|
+
console.log('📊 [TERMINAL DEBUG] Terminal page debug event sent');
|
|
196
|
+
} else {
|
|
197
|
+
console.warn('❌ [TERMINAL DEBUG] Google Analytics gtag function not available');
|
|
198
|
+
}
|
|
199
|
+
|
|
183
200
|
// Get agent ID and session ID from URL parameters
|
|
184
201
|
const urlParams = new URLSearchParams(window.location.search);
|
|
185
202
|
const agentId = urlParams.get('agent');
|
|
@@ -235,13 +252,18 @@ function startConnection() {
|
|
|
235
252
|
term.open(document.getElementById('terminal'));
|
|
236
253
|
|
|
237
254
|
// Track terminal session start in Google Analytics
|
|
255
|
+
console.log('🔍 [TERMINAL DEBUG] Attempting to track terminal_session_start');
|
|
238
256
|
if (typeof gtag !== 'undefined') {
|
|
257
|
+
console.log('📊 [TERMINAL DEBUG] Sending terminal_session_start event to Google Analytics');
|
|
239
258
|
gtag('event', 'terminal_session_start', {
|
|
240
259
|
event_category: 'terminal',
|
|
241
260
|
event_label: requestedSessionId ? 'existing_session' : 'new_session',
|
|
242
261
|
agent_id: AGENT_ID,
|
|
243
262
|
session_id: requestedSessionId || 'new'
|
|
244
263
|
});
|
|
264
|
+
console.log('✅ [TERMINAL DEBUG] terminal_session_start event sent successfully');
|
|
265
|
+
} else {
|
|
266
|
+
console.warn('❌ [TERMINAL DEBUG] Cannot send terminal_session_start event - gtag not available');
|
|
245
267
|
}
|
|
246
268
|
|
|
247
269
|
// Delay fit to ensure proper dimensions after CSS transitions
|
|
@@ -533,12 +555,17 @@ async function createPeerConnection() {
|
|
|
533
555
|
updateConnectionStatus('connected');
|
|
534
556
|
|
|
535
557
|
// Track successful connection in Google Analytics
|
|
558
|
+
console.log('🔍 [TERMINAL DEBUG] Attempting to track terminal_connection_success');
|
|
536
559
|
if (typeof gtag !== 'undefined') {
|
|
560
|
+
console.log('📊 [TERMINAL DEBUG] Sending terminal_connection_success event to Google Analytics');
|
|
537
561
|
gtag('event', 'terminal_connection_success', {
|
|
538
562
|
event_category: 'terminal',
|
|
539
563
|
event_label: 'webrtc_established',
|
|
540
564
|
agent_id: AGENT_ID
|
|
541
565
|
});
|
|
566
|
+
console.log('✅ [TERMINAL DEBUG] terminal_connection_success event sent successfully');
|
|
567
|
+
} else {
|
|
568
|
+
console.warn('❌ [TERMINAL DEBUG] Cannot send terminal_connection_success event - gtag not available');
|
|
542
569
|
}
|
|
543
570
|
|
|
544
571
|
break;
|
package/public/index.html
CHANGED
|
@@ -697,12 +697,18 @@
|
|
|
697
697
|
|
|
698
698
|
// Handle Google login - direct web OAuth
|
|
699
699
|
async function handleGoogleLogin() {
|
|
700
|
+
console.log('🔍 [DEBUG] Login button clicked');
|
|
701
|
+
|
|
700
702
|
// Track login attempt in Google Analytics
|
|
701
703
|
if (typeof gtag !== 'undefined') {
|
|
704
|
+
console.log('📊 [DEBUG] Sending login_attempt event to Google Analytics');
|
|
702
705
|
gtag('event', 'login_attempt', {
|
|
703
706
|
event_category: 'authentication',
|
|
704
707
|
event_label: 'google_oauth'
|
|
705
708
|
});
|
|
709
|
+
console.log('✅ [DEBUG] login_attempt event sent successfully');
|
|
710
|
+
} else {
|
|
711
|
+
console.warn('❌ [DEBUG] Cannot send login_attempt event - gtag not available');
|
|
706
712
|
}
|
|
707
713
|
|
|
708
714
|
// Direct OAuth flow using the web backend
|
|
@@ -711,12 +717,18 @@
|
|
|
711
717
|
|
|
712
718
|
// Handle dashboard navigation
|
|
713
719
|
async function openDashboard() {
|
|
720
|
+
console.log('🔍 [DEBUG] Dashboard button clicked');
|
|
721
|
+
|
|
714
722
|
// Track dashboard access in Google Analytics
|
|
715
723
|
if (typeof gtag !== 'undefined') {
|
|
724
|
+
console.log('📊 [DEBUG] Sending dashboard_access event to Google Analytics');
|
|
716
725
|
gtag('event', 'dashboard_access', {
|
|
717
726
|
event_category: 'navigation',
|
|
718
727
|
event_label: 'from_landing_page'
|
|
719
728
|
});
|
|
729
|
+
console.log('✅ [DEBUG] dashboard_access event sent successfully');
|
|
730
|
+
} else {
|
|
731
|
+
console.warn('❌ [DEBUG] Cannot send dashboard_access event - gtag not available');
|
|
720
732
|
}
|
|
721
733
|
|
|
722
734
|
window.location.href = '/app/dashboard.html';
|
|
@@ -747,6 +759,25 @@
|
|
|
747
759
|
|
|
748
760
|
// Initialize page on load
|
|
749
761
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
762
|
+
// Debug Google Analytics setup
|
|
763
|
+
console.log('🔍 [DEBUG] Checking Google Analytics setup...');
|
|
764
|
+
console.log('🔍 [DEBUG] gtag function available:', typeof gtag !== 'undefined');
|
|
765
|
+
console.log('🔍 [DEBUG] dataLayer exists:', typeof window.dataLayer !== 'undefined');
|
|
766
|
+
console.log('🔍 [DEBUG] dataLayer contents:', window.dataLayer);
|
|
767
|
+
|
|
768
|
+
// Test if gtag is working
|
|
769
|
+
if (typeof gtag !== 'undefined') {
|
|
770
|
+
console.log('✅ [DEBUG] Google Analytics gtag function is available');
|
|
771
|
+
// Send a test event
|
|
772
|
+
gtag('event', 'page_debug', {
|
|
773
|
+
event_category: 'debug',
|
|
774
|
+
event_label: 'landing_page_loaded'
|
|
775
|
+
});
|
|
776
|
+
console.log('📊 [DEBUG] Test event sent: page_debug');
|
|
777
|
+
} else {
|
|
778
|
+
console.warn('❌ [DEBUG] Google Analytics gtag function not available');
|
|
779
|
+
}
|
|
780
|
+
|
|
750
781
|
await updateHeaderAndCTA();
|
|
751
782
|
loadVersionInfo();
|
|
752
783
|
});
|