cloud-ide-element 1.1.28 → 1.1.29

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.
@@ -6910,6 +6910,17 @@ const hostManagerRoutesUrl = {
6910
6910
  };
6911
6911
  Object.freeze(hostManagerRoutesUrl);
6912
6912
 
6913
+ /**
6914
+ * Notification Routes
6915
+ * Cloned from cloud-ide-lms-model to avoid dependencies
6916
+ */
6917
+ const notificationRoutesUrl = {
6918
+ module: 'notifications',
6919
+ notifications: "notifications",
6920
+ unreadCount: "unread-count",
6921
+ };
6922
+ Object.freeze(notificationRoutesUrl);
6923
+
6913
6924
  /**
6914
6925
  * Advanced Angular button component that provides a comprehensive button implementation
6915
6926
  * with loading state, styling variants, animations, tooltips, and other features.
@@ -7166,8 +7177,7 @@ class NotificationApiService {
7166
7177
  http = inject(HttpClient);
7167
7178
  apiUrl = cidePath.join([
7168
7179
  hostManagerRoutesUrl.cideSuiteHost,
7169
- 'api',
7170
- 'notifications'
7180
+ notificationRoutesUrl.module
7171
7181
  ]);
7172
7182
  /**
7173
7183
  * Get user notifications
@@ -7182,6 +7192,9 @@ class NotificationApiService {
7182
7192
  }
7183
7193
  });
7184
7194
  }
7195
+ // Debug: Log the URL being used
7196
+ console.log('[NotificationApi] Request URL:', this.apiUrl);
7197
+ console.log('[NotificationApi] Full URL with params:', `${this.apiUrl}?${httpParams.toString()}`);
7185
7198
  return this.http.get(this.apiUrl, { params: httpParams });
7186
7199
  }
7187
7200
  /**
@@ -7194,7 +7207,7 @@ class NotificationApiService {
7194
7207
  * Get unread count
7195
7208
  */
7196
7209
  getUnreadCount() {
7197
- return this.http.get(`${this.apiUrl}/unread-count`);
7210
+ return this.http.get(`${this.apiUrl}/${notificationRoutesUrl.unreadCount}`);
7198
7211
  }
7199
7212
  /**
7200
7213
  * Create notification
@@ -7258,8 +7271,65 @@ class WebSocketNotificationService {
7258
7271
  console.log('Socket already connected');
7259
7272
  return;
7260
7273
  }
7261
- // Get API URL from host manager (same pattern as other services)
7262
- const apiUrl = hostManagerRoutesUrl.cideSuiteHost || 'http://localhost:3000';
7274
+ // Resolve actual API URL from placeholder
7275
+ // The placeholder is replaced by host interceptor for HTTP, but WebSocket needs direct resolution
7276
+ // Based on host-manager.json: "__cloud_ide_suite_layout__" -> "http://localhost:3001"
7277
+ const placeholder = hostManagerRoutesUrl.cideSuiteHost;
7278
+ let apiUrl = 'http://localhost:3001'; // Default from host-manager.json
7279
+ // Try to resolve from host-manager.json via fetch (same as HTTP interceptor)
7280
+ if (typeof window !== 'undefined') {
7281
+ // Try to fetch host-manager.json to get the actual URL
7282
+ fetch('/routes/host-manager.json')
7283
+ .then(res => res.json())
7284
+ .then((hostManagerRoutes) => {
7285
+ const hostManagerRoutesEntry = hostManagerRoutes?.hosts?.find((hostRoute) => placeholder?.includes(hostRoute?.url));
7286
+ if (hostManagerRoutesEntry?.replace) {
7287
+ apiUrl = hostManagerRoutesEntry.replace;
7288
+ }
7289
+ // Remove /api suffix if present (Socket.IO connects to base server)
7290
+ apiUrl = apiUrl.replace(/\/api\/?$/, '');
7291
+ this.connectWithUrl(apiUrl, token, userId);
7292
+ })
7293
+ .catch(() => {
7294
+ // Fallback if fetch fails - use default or try localStorage
7295
+ this.resolveUrlFallback(token, userId);
7296
+ });
7297
+ }
7298
+ else {
7299
+ // Server-side or fallback
7300
+ this.resolveUrlFallback(token, userId);
7301
+ }
7302
+ }
7303
+ /**
7304
+ * Fallback URL resolution
7305
+ */
7306
+ resolveUrlFallback(token, userId) {
7307
+ let apiUrl = 'http://localhost:3001'; // Default from host-manager.json
7308
+ // Try to get from current window location
7309
+ if (typeof window !== 'undefined') {
7310
+ const currentOrigin = window.location.origin;
7311
+ // Check if we're on localhost (development)
7312
+ if (currentOrigin.includes('localhost') || currentOrigin.includes('127.0.0.1')) {
7313
+ // Use localhost:3001 for development (from host-manager.json)
7314
+ apiUrl = 'http://localhost:3001';
7315
+ }
7316
+ else {
7317
+ // In production, use the same origin (assuming API is on same domain)
7318
+ apiUrl = currentOrigin || 'http://localhost:3001';
7319
+ }
7320
+ // Try to get from localStorage (if set by app initialization)
7321
+ const storedApiUrl = localStorage.getItem('api_base_url');
7322
+ if (storedApiUrl) {
7323
+ apiUrl = storedApiUrl.replace(/\/api\/?$/, '');
7324
+ }
7325
+ }
7326
+ this.connectWithUrl(apiUrl, token, userId);
7327
+ }
7328
+ /**
7329
+ * Connect with resolved URL
7330
+ */
7331
+ connectWithUrl(apiUrl, token, userId) {
7332
+ console.log('[WebSocket] Connecting to:', apiUrl);
7263
7333
  this.socket = io(apiUrl, {
7264
7334
  path: '/notifications-socket',
7265
7335
  transports: ['websocket', 'polling'],
@@ -13383,5 +13453,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
13383
13453
  * Generated bundle index. Do not edit.
13384
13454
  */
13385
13455
 
13386
- export { CapitalizePipe, CideCoreFileManagerService, CideEleBreadcrumbComponent, CideEleButtonComponent, CideEleConfirmationModalComponent, CideEleDataGridComponent, CideEleDropdownComponent, CideEleFileImageDirective, CideEleFileInputComponent, CideEleFileManagerService, CideEleFloatingContainerComponent, CideEleFloatingContainerDynamicDirective, CideEleFloatingContainerManagerComponent, CideEleFloatingContainerService, CideEleFloatingFeaturesService, CideEleFloatingFileUploaderComponent, CideEleFloatingFileUploaderService, CideEleGlobalNotificationsComponent, CideEleJsonEditorComponent, CideEleResizerDirective, CideEleSkeletonLoaderComponent, CideEleTabComponent, CideEleToastNotificationComponent, CideElementsService, CideFormFieldErrorComponent, CideIconComponent, CideInputComponent, CideSelectComponent, CideSelectOptionComponent, CideSpinnerComponent, CideTextareaComponent, ConfirmationService, CoreFileManagerInsertUpdatePayload, DEFAULT_GRID_CONFIG, DropdownManagerService, ExportService, ICoreCyfmSave, KeyboardShortcutService, MFileManager, NotificationApiService, NotificationService, PortalService, TooltipDirective, WebSocketNotificationService, cidePath, hostManagerRoutesUrl };
13456
+ export { CapitalizePipe, CideCoreFileManagerService, CideEleBreadcrumbComponent, CideEleButtonComponent, CideEleConfirmationModalComponent, CideEleDataGridComponent, CideEleDropdownComponent, CideEleFileImageDirective, CideEleFileInputComponent, CideEleFileManagerService, CideEleFloatingContainerComponent, CideEleFloatingContainerDynamicDirective, CideEleFloatingContainerManagerComponent, CideEleFloatingContainerService, CideEleFloatingFeaturesService, CideEleFloatingFileUploaderComponent, CideEleFloatingFileUploaderService, CideEleGlobalNotificationsComponent, CideEleJsonEditorComponent, CideEleResizerDirective, CideEleSkeletonLoaderComponent, CideEleTabComponent, CideEleToastNotificationComponent, CideElementsService, CideFormFieldErrorComponent, CideIconComponent, CideInputComponent, CideSelectComponent, CideSelectOptionComponent, CideSpinnerComponent, CideTextareaComponent, ConfirmationService, CoreFileManagerInsertUpdatePayload, DEFAULT_GRID_CONFIG, DropdownManagerService, ExportService, ICoreCyfmSave, KeyboardShortcutService, MFileManager, NotificationApiService, NotificationService, PortalService, TooltipDirective, WebSocketNotificationService, cidePath, hostManagerRoutesUrl, notificationRoutesUrl };
13387
13457
  //# sourceMappingURL=cloud-ide-element.mjs.map