cloud-ide-element 1.1.27 → 1.1.28

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.
@@ -6,10 +6,11 @@ import * as i2 from '@angular/forms';
6
6
  import { FormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
7
7
  import { BehaviorSubject, Subject, debounceTime, distinctUntilChanged, takeUntil, Observable, retry, catchError, finalize, throwError, map, of } from 'rxjs';
8
8
  import * as i1$1 from '@angular/common/http';
9
- import { HttpClient, HttpEventType, HttpRequest } from '@angular/common/http';
9
+ import { HttpClient, HttpEventType, HttpParams, HttpRequest } from '@angular/common/http';
10
10
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
11
- import { generateStringFromObject, coreRoutesUrl, cidePath, hostManagerRoutesUrl } from 'cloud-ide-lms-model';
11
+ import { generateStringFromObject, coreRoutesUrl, cidePath as cidePath$1, hostManagerRoutesUrl as hostManagerRoutesUrl$1 } from 'cloud-ide-lms-model';
12
12
  import * as i2$1 from '@angular/router';
13
+ import { io } from 'socket.io-client';
13
14
  import { tap, catchError as catchError$1 } from 'rxjs/operators';
14
15
  import { trigger, state, transition, style, animate } from '@angular/animations';
15
16
 
@@ -6886,6 +6887,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
6886
6887
  args: ['mousedown', ['$event']]
6887
6888
  }] } });
6888
6889
 
6890
+ /**
6891
+ * Path Helper Utility
6892
+ * Cloned from cloud-ide-lms-model to avoid dependencies
6893
+ */
6894
+ const cidePath = {
6895
+ join: (path) => {
6896
+ return path.join("/");
6897
+ }
6898
+ };
6899
+
6900
+ /**
6901
+ * Host Manager Routes
6902
+ * Cloned from cloud-ide-lms-model to avoid dependencies
6903
+ *
6904
+ * Base path for host name to interceptor and replace with actual URL
6905
+ * for more details refer https://docs.google.com/document/d/1CwB4evLsQuatG4jI0U1faRtmqtNmIfZOE4fDWiz9-sQ/edit?pli=1#bookmark=id.j3vzaryhajl1
6906
+ * __version__ need to add in future
6907
+ */
6908
+ const hostManagerRoutesUrl = {
6909
+ cideSuiteHost: "__cloud_ide_suite_layout__"
6910
+ };
6911
+ Object.freeze(hostManagerRoutesUrl);
6912
+
6889
6913
  /**
6890
6914
  * Advanced Angular button component that provides a comprehensive button implementation
6891
6915
  * with loading state, styling variants, animations, tooltips, and other features.
@@ -7134,6 +7158,243 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
7134
7158
  args: ['click', ['$event']]
7135
7159
  }] } });
7136
7160
 
7161
+ /**
7162
+ * Notification API Service
7163
+ * HTTP client for notification API endpoints
7164
+ */
7165
+ class NotificationApiService {
7166
+ http = inject(HttpClient);
7167
+ apiUrl = cidePath.join([
7168
+ hostManagerRoutesUrl.cideSuiteHost,
7169
+ 'api',
7170
+ 'notifications'
7171
+ ]);
7172
+ /**
7173
+ * Get user notifications
7174
+ */
7175
+ getNotifications(params) {
7176
+ let httpParams = new HttpParams();
7177
+ if (params) {
7178
+ Object.keys(params).forEach(key => {
7179
+ const value = params[key];
7180
+ if (value !== undefined && value !== null) {
7181
+ httpParams = httpParams.set(key, value.toString());
7182
+ }
7183
+ });
7184
+ }
7185
+ return this.http.get(this.apiUrl, { params: httpParams });
7186
+ }
7187
+ /**
7188
+ * Get notification by ID
7189
+ */
7190
+ getNotificationById(id) {
7191
+ return this.http.get(`${this.apiUrl}/${id}`);
7192
+ }
7193
+ /**
7194
+ * Get unread count
7195
+ */
7196
+ getUnreadCount() {
7197
+ return this.http.get(`${this.apiUrl}/unread-count`);
7198
+ }
7199
+ /**
7200
+ * Create notification
7201
+ */
7202
+ createNotification(payload) {
7203
+ return this.http.post(this.apiUrl, payload);
7204
+ }
7205
+ /**
7206
+ * Mark notification as read
7207
+ */
7208
+ markAsRead(id) {
7209
+ return this.http.put(`${this.apiUrl}/${id}/read`, {});
7210
+ }
7211
+ /**
7212
+ * Mark all notifications as read
7213
+ */
7214
+ markAllAsRead() {
7215
+ return this.http.put(`${this.apiUrl}/read-all`, {});
7216
+ }
7217
+ /**
7218
+ * Archive notification
7219
+ */
7220
+ archiveNotification(id) {
7221
+ return this.http.put(`${this.apiUrl}/${id}/archive`, {});
7222
+ }
7223
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: NotificationApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
7224
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: NotificationApiService, providedIn: 'root' });
7225
+ }
7226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: NotificationApiService, decorators: [{
7227
+ type: Injectable,
7228
+ args: [{
7229
+ providedIn: 'root'
7230
+ }]
7231
+ }] });
7232
+
7233
+ /**
7234
+ * WebSocket Notification Service
7235
+ * Socket.IO client for real-time notifications
7236
+ */
7237
+ class WebSocketNotificationService {
7238
+ socket = null;
7239
+ notificationSubject = new Subject();
7240
+ connectionStatusSubject = new BehaviorSubject({
7241
+ connected: false
7242
+ });
7243
+ // Signals for reactive state
7244
+ notifications = signal([], ...(ngDevMode ? [{ debugName: "notifications" }] : []));
7245
+ unreadNotifications = signal([], ...(ngDevMode ? [{ debugName: "unreadNotifications" }] : []));
7246
+ // Public observables
7247
+ notification$ = this.notificationSubject.asObservable();
7248
+ connectionStatus$ = this.connectionStatusSubject.asObservable();
7249
+ // Computed signals
7250
+ allNotifications = computed(() => this.notifications(), ...(ngDevMode ? [{ debugName: "allNotifications" }] : []));
7251
+ unreadNotificationsCount = computed(() => this.unreadNotifications().length, ...(ngDevMode ? [{ debugName: "unreadNotificationsCount" }] : []));
7252
+ isConnected = computed(() => this.connectionStatusSubject.value.connected, ...(ngDevMode ? [{ debugName: "isConnected" }] : []));
7253
+ /**
7254
+ * Connect to Socket.IO server
7255
+ */
7256
+ connect(token, userId) {
7257
+ if (this.socket?.connected) {
7258
+ console.log('Socket already connected');
7259
+ return;
7260
+ }
7261
+ // Get API URL from host manager (same pattern as other services)
7262
+ const apiUrl = hostManagerRoutesUrl.cideSuiteHost || 'http://localhost:3000';
7263
+ this.socket = io(apiUrl, {
7264
+ path: '/notifications-socket',
7265
+ transports: ['websocket', 'polling'],
7266
+ auth: {
7267
+ token: token
7268
+ },
7269
+ reconnection: true,
7270
+ reconnectionDelay: 1000,
7271
+ reconnectionAttempts: 5,
7272
+ reconnectionDelayMax: 5000
7273
+ });
7274
+ this.setupEventHandlers(userId);
7275
+ }
7276
+ /**
7277
+ * Setup Socket.IO event handlers
7278
+ */
7279
+ setupEventHandlers(userId) {
7280
+ if (!this.socket)
7281
+ return;
7282
+ // Connection established
7283
+ this.socket.on('connect', () => {
7284
+ console.log('Socket.IO connected:', this.socket?.id);
7285
+ this.connectionStatusSubject.next({
7286
+ connected: true,
7287
+ socketId: this.socket?.id,
7288
+ userId: userId,
7289
+ timestamp: new Date()
7290
+ });
7291
+ });
7292
+ // Connection confirmation
7293
+ this.socket.on('connected', (data) => {
7294
+ console.log('Notification service connected:', data);
7295
+ this.connectionStatusSubject.next({
7296
+ connected: true,
7297
+ socketId: data.socketId,
7298
+ userId: data.userId,
7299
+ timestamp: data.timestamp
7300
+ });
7301
+ });
7302
+ // Receive notification
7303
+ this.socket.on('notification', (notification) => {
7304
+ console.log('Received notification:', notification);
7305
+ // Add to notifications list
7306
+ this.notifications.update(notifications => [notification, ...notifications]);
7307
+ // Add to unread list
7308
+ this.unreadNotifications.update(unread => [notification, ...unread]);
7309
+ // Emit to subscribers
7310
+ this.notificationSubject.next(notification);
7311
+ // Acknowledge receipt
7312
+ this.acknowledgeNotification(notification.id);
7313
+ });
7314
+ // Disconnect
7315
+ this.socket.on('disconnect', (reason) => {
7316
+ console.log('Socket.IO disconnected:', reason);
7317
+ this.connectionStatusSubject.next({
7318
+ connected: false,
7319
+ timestamp: new Date()
7320
+ });
7321
+ });
7322
+ // Connection error
7323
+ this.socket.on('connect_error', (error) => {
7324
+ console.error('Socket.IO connection error:', error);
7325
+ this.connectionStatusSubject.next({
7326
+ connected: false,
7327
+ timestamp: new Date()
7328
+ });
7329
+ });
7330
+ }
7331
+ /**
7332
+ * Acknowledge notification receipt
7333
+ */
7334
+ acknowledgeNotification(notificationId) {
7335
+ if (this.socket?.connected) {
7336
+ this.socket.emit('notification:ack', { notificationId });
7337
+ }
7338
+ }
7339
+ /**
7340
+ * Mark notification as read
7341
+ */
7342
+ markAsRead(notificationId) {
7343
+ if (this.socket?.connected) {
7344
+ this.socket.emit('notification:read', { notificationId });
7345
+ // Remove from unread list
7346
+ this.unreadNotifications.update(unread => unread.filter(n => n.id !== notificationId));
7347
+ }
7348
+ }
7349
+ /**
7350
+ * Mark all as read
7351
+ */
7352
+ markAllAsRead() {
7353
+ const unreadIds = this.unreadNotifications().map(n => n.id);
7354
+ unreadIds.forEach(id => this.markAsRead(id));
7355
+ }
7356
+ /**
7357
+ * Disconnect from server
7358
+ */
7359
+ disconnect() {
7360
+ if (this.socket) {
7361
+ this.socket.disconnect();
7362
+ this.socket = null;
7363
+ this.connectionStatusSubject.next({
7364
+ connected: false,
7365
+ timestamp: new Date()
7366
+ });
7367
+ }
7368
+ }
7369
+ /**
7370
+ * Clear all notifications
7371
+ */
7372
+ clearNotifications() {
7373
+ this.notifications.set([]);
7374
+ this.unreadNotifications.set([]);
7375
+ }
7376
+ /**
7377
+ * Remove notification from list
7378
+ */
7379
+ removeNotification(notificationId) {
7380
+ this.notifications.update(notifications => notifications.filter(n => n.id !== notificationId));
7381
+ this.unreadNotifications.update(unread => unread.filter(n => n.id !== notificationId));
7382
+ }
7383
+ ngOnDestroy() {
7384
+ this.disconnect();
7385
+ this.notificationSubject.complete();
7386
+ this.connectionStatusSubject.complete();
7387
+ }
7388
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: WebSocketNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
7389
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: WebSocketNotificationService, providedIn: 'root' });
7390
+ }
7391
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: WebSocketNotificationService, decorators: [{
7392
+ type: Injectable,
7393
+ args: [{
7394
+ providedIn: 'root'
7395
+ }]
7396
+ }] });
7397
+
7137
7398
  class CideCoreFileManagerService {
7138
7399
  http;
7139
7400
  apiUrl = `${coreRoutesUrl?.fileManager}`;
@@ -7148,7 +7409,7 @@ class CideCoreFileManagerService {
7148
7409
  */
7149
7410
  getFileList(body) {
7150
7411
  const query = generateStringFromObject(body);
7151
- return this.http?.get(cidePath?.join([hostManagerRoutesUrl?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, query]))
7412
+ return this.http?.get(cidePath$1?.join([hostManagerRoutesUrl$1?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, query]))
7152
7413
  .pipe(tap((response) => {
7153
7414
  if (response?.success) {
7154
7415
  this.fileListSubject.next(response?.data || []);
@@ -7181,7 +7442,7 @@ class CideCoreFileManagerService {
7181
7442
  formData.append('tags', JSON.stringify(request.tags || []));
7182
7443
  formData.append('permissions', JSON.stringify(request.permissions || []));
7183
7444
  formData.append('userId', request.userId || '');
7184
- const url = cidePath?.join([hostManagerRoutesUrl?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, 'upload']);
7445
+ const url = cidePath$1?.join([hostManagerRoutesUrl$1?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, 'upload']);
7185
7446
  const req = new HttpRequest('POST', url, formData, {
7186
7447
  reportProgress: true
7187
7448
  });
@@ -7199,7 +7460,7 @@ class CideCoreFileManagerService {
7199
7460
  */
7200
7461
  updateFile(request) {
7201
7462
  console.log('Updating file:', request);
7202
- const url = cidePath?.join([hostManagerRoutesUrl?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager]);
7463
+ const url = cidePath$1?.join([hostManagerRoutesUrl$1?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager]);
7203
7464
  return this.http.post(url, request)
7204
7465
  .pipe(tap((response) => {
7205
7466
  if (response.success) {
@@ -7213,7 +7474,7 @@ class CideCoreFileManagerService {
7213
7474
  deleteFile(id) {
7214
7475
  const payload = { cyfm_id: id };
7215
7476
  const query = generateStringFromObject(payload);
7216
- const url = cidePath?.join([hostManagerRoutesUrl?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, query]);
7477
+ const url = cidePath$1?.join([hostManagerRoutesUrl$1?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, query]);
7217
7478
  return this.http.delete(url)
7218
7479
  .pipe(tap((response) => {
7219
7480
  if (response.success) {
@@ -7228,7 +7489,7 @@ class CideCoreFileManagerService {
7228
7489
  console.log('Deleting multiple files:', ids);
7229
7490
  const payload = { ids };
7230
7491
  const query = generateStringFromObject(payload);
7231
- const url = cidePath?.join([hostManagerRoutesUrl?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, query]);
7492
+ const url = cidePath$1?.join([hostManagerRoutesUrl$1?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, query]);
7232
7493
  return this.http.delete(url)
7233
7494
  .pipe(tap((response) => {
7234
7495
  if (response.success) {
@@ -7243,7 +7504,7 @@ class CideCoreFileManagerService {
7243
7504
  console.log('Toggling file status:', id);
7244
7505
  const payload = { id };
7245
7506
  const query = generateStringFromObject(payload);
7246
- const url = cidePath?.join([hostManagerRoutesUrl?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, query]);
7507
+ const url = cidePath$1?.join([hostManagerRoutesUrl$1?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, query]);
7247
7508
  return this.http.put(url, {})
7248
7509
  .pipe(tap((response) => {
7249
7510
  if (response.success) {
@@ -7258,7 +7519,7 @@ class CideCoreFileManagerService {
7258
7519
  console.log('Getting file by ID:', id);
7259
7520
  const payload = { cyfm_id: id };
7260
7521
  const query = generateStringFromObject(payload);
7261
- const url = cidePath?.join([hostManagerRoutesUrl?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, 'byId', query]);
7522
+ const url = cidePath$1?.join([hostManagerRoutesUrl$1?.cideSuiteHost, coreRoutesUrl?.module, coreRoutesUrl?.fileManager, 'byId', query]);
7262
7523
  return this.http.get(url)
7263
7524
  .pipe(catchError$1(this.handleError));
7264
7525
  }
@@ -13122,5 +13383,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
13122
13383
  * Generated bundle index. Do not edit.
13123
13384
  */
13124
13385
 
13125
- 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, NotificationService, PortalService, TooltipDirective };
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 };
13126
13387
  //# sourceMappingURL=cloud-ide-element.mjs.map