mesauth-angular 0.1.10 → 0.1.12

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 (37) hide show
  1. package/dist/README.md +265 -0
  2. package/dist/esm2020/index.mjs +9 -0
  3. package/dist/esm2020/ma-user.component.mjs +26 -0
  4. package/dist/esm2020/mes-auth.interceptor.mjs +29 -0
  5. package/dist/esm2020/mes-auth.module.mjs +23 -0
  6. package/dist/esm2020/mes-auth.service.mjs +103 -0
  7. package/dist/esm2020/mesauth-angular.mjs +5 -0
  8. package/dist/esm2020/notification-badge.component.mjs +57 -0
  9. package/dist/esm2020/notification-panel.component.mjs +196 -0
  10. package/dist/esm2020/toast-container.component.mjs +60 -0
  11. package/dist/esm2020/toast.service.mjs +41 -0
  12. package/dist/esm2020/user-profile.component.mjs +197 -0
  13. package/dist/fesm2015/mesauth-angular.mjs +701 -0
  14. package/dist/fesm2015/mesauth-angular.mjs.map +1 -0
  15. package/dist/fesm2020/mesauth-angular.mjs +700 -0
  16. package/dist/fesm2020/mesauth-angular.mjs.map +1 -0
  17. package/dist/ma-user.component.d.ts +3 -0
  18. package/dist/mes-auth.interceptor.d.ts +3 -0
  19. package/dist/mes-auth.module.d.ts +4 -0
  20. package/dist/mes-auth.service.d.ts +5 -1
  21. package/dist/notification-badge.component.d.ts +3 -0
  22. package/dist/notification-panel.component.d.ts +3 -0
  23. package/dist/package.json +52 -0
  24. package/dist/toast-container.component.d.ts +3 -0
  25. package/dist/toast.service.d.ts +3 -0
  26. package/dist/user-profile.component.d.ts +3 -0
  27. package/package.json +17 -11
  28. package/dist/index.js +0 -8
  29. package/dist/ma-user.component.js +0 -33
  30. package/dist/mes-auth.interceptor.js +0 -36
  31. package/dist/mes-auth.module.js +0 -33
  32. package/dist/mes-auth.service.js +0 -107
  33. package/dist/notification-badge.component.js +0 -100
  34. package/dist/notification-panel.component.js +0 -327
  35. package/dist/toast-container.component.js +0 -185
  36. package/dist/toast.service.js +0 -43
  37. package/dist/user-profile.component.js +0 -363
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesauth-angular.mjs","sources":["../../src/mes-auth.service.ts","../../src/mes-auth.interceptor.ts","../../src/mes-auth.module.ts","../../src/user-profile.component.ts","../../src/toast.service.ts","../../src/toast-container.component.ts","../../src/notification-panel.component.ts","../../src/ma-user.component.ts","../../src/notification-badge.component.ts","../../src/mesauth-angular.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { HubConnection, HubConnectionBuilder, LogLevel } from '@microsoft/signalr';\r\nimport { BehaviorSubject, Subject, Observable } from 'rxjs';\r\n\r\nexport interface MesAuthConfig { \r\n apiBaseUrl: string;\r\n withCredentials?: boolean;\r\n avatarUrl?: string;\r\n userBaseUrl?: string;\r\n}\r\n\r\nexport interface IUser {\r\n userId?: string;\r\n userName?: string;\r\n fullName?: string;\r\n gender?: string;\r\n email?: string;\r\n phoneNumber?: string;\r\n department?: string;\r\n position?: string;\r\n tokenVersion?: string;\r\n permEndpoint?: string;\r\n perms?: Set<string>;\r\n employeeCode?: string;\r\n hrFullNameVn?: string;\r\n hrFullNameEn?: string;\r\n hrPosition?: string;\r\n hrJobTitle?: string;\r\n hrGender?: string;\r\n hrMobile?: string;\r\n hrEmail?: string;\r\n hrJoinDate?: string;\r\n hrBirthDate?: string;\r\n hrWorkStatus?: string;\r\n hrDoiTuong?: string;\r\n hrTeamCode?: string;\r\n hrLineCode?: string;\r\n}\r\n\r\nexport enum NotificationType {\r\n Info = 'Info',\r\n Warning = 'Warning',\r\n Error = 'Error',\r\n Success = 'Success'\r\n}\r\n\r\nexport interface NotificationDto {\r\n id: string;\r\n title: string;\r\n message: string;\r\n messageHtml?: string;\r\n url?: string;\r\n type: NotificationType;\r\n isRead: boolean;\r\n createdAt: string;\r\n sourceAppName: string;\r\n sourceAppIconUrl?: string;\r\n}\r\n\r\nexport interface PagedList<T> {\r\n items: T[];\r\n totalCount: number;\r\n page: number;\r\n pageSize: number;\r\n totalPages: number;\r\n hasNext: boolean;\r\n hasPrevious: boolean;\r\n}\r\n\r\nexport interface RealTimeNotificationDto {\r\n id: string;\r\n title: string;\r\n message: string;\r\n messageHtml?: string;\r\n url?: string;\r\n type: NotificationType;\r\n createdAt: string;\r\n sourceAppName: string;\r\n sourceAppIconUrl?: string;\r\n}\r\n\r\n@Injectable()\r\nexport class MesAuthService {\r\n private hubConnection: HubConnection | null = null;\r\n private _currentUser = new BehaviorSubject<IUser | null>(null);\r\n public currentUser$: Observable<IUser | null> = this._currentUser.asObservable();\r\n private _notifications = new Subject<any>();\r\n public notifications$: Observable<any> = this._notifications.asObservable();\r\n\r\n private apiBase = '';\r\n private config: MesAuthConfig | null = null;\r\n\r\n constructor(private http: HttpClient) {}\r\n\r\n init(config: MesAuthConfig) {\r\n this.config = config;\r\n this.apiBase = config.apiBaseUrl.replace(/\\/$/, '');\r\n this.fetchCurrentUser();\r\n this.fetchInitialNotifications();\r\n this.startConnection(config);\r\n }\r\n\r\n getConfig(): MesAuthConfig | null {\r\n return this.config;\r\n }\r\n\r\n private fetchCurrentUser() {\r\n if (!this.apiBase) return;\r\n this.http.get(`${this.apiBase}/auth/me`).subscribe({\r\n next: (u) => this._currentUser.next(u),\r\n error: (err) => console.error('fetchCurrentUser error', err)\r\n });\r\n }\r\n\r\n private fetchInitialNotifications() {\r\n if (!this.apiBase) return;\r\n this.http.get(`${this.apiBase}/notif/me`).subscribe({\r\n next: (notifications: any) => {\r\n if (Array.isArray(notifications?.items)) {\r\n notifications.items.forEach((n: any) => this._notifications.next(n));\r\n }\r\n },\r\n error: (err) => console.error('fetchInitialNotifications error', err)\r\n });\r\n }\r\n\r\n public getUnreadCount(): Observable<any> {\r\n return this.http.get(`${this.apiBase}/notif/me/unread-count`);\r\n }\r\n\r\n public getNotifications(page: number = 1, pageSize: number = 20, includeRead: boolean = false, type?: string): Observable<any> {\r\n let url = `${this.apiBase}/notif/me?page=${page}&pageSize=${pageSize}&includeRead=${includeRead}`;\r\n if (type) {\r\n url += `&type=${type}`;\r\n }\r\n return this.http.get(url);\r\n }\r\n\r\n public markAsRead(notificationId: string): Observable<any> {\r\n return this.http.patch(`${this.apiBase}/notif/${notificationId}/read`, {});\r\n }\r\n\r\n public markAllAsRead(): Observable<any> {\r\n return this.http.patch(`${this.apiBase}/notif/me/read-all`, {});\r\n }\r\n\r\n public deleteNotification(notificationId: string): Observable<any> {\r\n return this.http.delete(`${this.apiBase}/notif/${notificationId}`);\r\n }\r\n\r\n private startConnection(config: MesAuthConfig) {\r\n if (this.hubConnection) return;\r\n const signalrUrl = config.apiBaseUrl.replace(/\\/$/, '') + '/hub/notification';\r\n const builder = new HubConnectionBuilder()\r\n .withUrl(signalrUrl, { withCredentials: config.withCredentials ?? true })\r\n .withAutomaticReconnect()\r\n .configureLogging(LogLevel.Warning);\r\n\r\n this.hubConnection = builder.build();\r\n\r\n this.hubConnection.on('ReceiveNotification', (n: any) => this._notifications.next(n));\r\n\r\n this.hubConnection.start().catch((err) => console.error('SignalR start error', err));\r\n }\r\n\r\n public stop() {\r\n if (!this.hubConnection) return;\r\n this.hubConnection.stop().catch(() => {});\r\n this.hubConnection = null;\r\n }\r\n\r\n public logout(): Observable<any> {\r\n return this.http.post(`${this.apiBase}/auth/logout`, {});\r\n }\r\n\r\n public refreshUser() {\r\n this.fetchCurrentUser();\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http';\r\nimport { Observable, throwError } from 'rxjs';\r\nimport { catchError } from 'rxjs/operators';\r\nimport { Router } from '@angular/router';\r\nimport { MesAuthService } from './mes-auth.service';\r\n\r\n@Injectable()\r\nexport class MesAuthInterceptor implements HttpInterceptor {\r\n constructor(private authService: MesAuthService, private router: Router) {}\r\n\r\n intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\r\n return next.handle(req).pipe(\r\n catchError((error: HttpErrorResponse) => {\r\n if (error.status === 403) {\r\n const config = this.authService.getConfig();\r\n const baseUrl = config?.userBaseUrl || '';\r\n const returnUrl = encodeURIComponent(window.location.href);\r\n window.location.href = `${baseUrl}/403?returnUrl=${returnUrl}`;\r\n }\r\n return throwError(error);\r\n })\r\n );\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { HTTP_INTERCEPTORS } from '@angular/common/http';\r\nimport { MesAuthService } from './mes-auth.service';\r\nimport { MesAuthInterceptor } from './mes-auth.interceptor';\r\n\r\n@NgModule({\r\n providers: [\r\n MesAuthService,\r\n { provide: HTTP_INTERCEPTORS, useClass: MesAuthInterceptor, multi: true }\r\n ]\r\n})\r\nexport class MesAuthModule {}\r\n","import { Component, OnInit, OnDestroy, Output, EventEmitter } from '@angular/core';\r\nimport { NgIf } from '@angular/common';\r\nimport { Router } from '@angular/router';\r\nimport { MesAuthService, IUser } from './mes-auth.service';\r\nimport { Subject } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'ma-user-profile',\r\n standalone: true,\r\n imports: [NgIf],\r\n template: `\r\n <div class=\"user-profile-container\">\r\n <!-- Not logged in -->\r\n <ng-container *ngIf=\"!currentUser\">\r\n <button class=\"login-btn\" (click)=\"onLogin()\">\r\n Login\r\n </button>\r\n </ng-container>\r\n\r\n <!-- Logged in -->\r\n <ng-container *ngIf=\"currentUser\">\r\n <div class=\"user-header\">\r\n <button class=\"notification-btn\" (click)=\"onNotificationClick()\" title=\"Notifications\">\r\n <span class=\"icon\">🔔</span>\r\n <span class=\"badge\" *ngIf=\"unreadCount > 0\">{{ unreadCount }}</span>\r\n </button>\r\n\r\n <div class=\"user-menu-wrapper\">\r\n <button class=\"user-menu-btn\" (click)=\"toggleDropdown()\">\r\n <img \r\n *ngIf=\"currentUser.fullName || currentUser.userName\"\r\n [src]=\"getAvatarUrl(currentUser)\" \r\n [alt]=\"currentUser.fullName || currentUser.userName\"\r\n class=\"avatar\"\r\n />\r\n <span *ngIf=\"!(currentUser.fullName || currentUser.userName)\" class=\"avatar-initial\">\r\n {{ getLastNameInitial(currentUser) }}\r\n </span>\r\n </button>\r\n\r\n <div class=\"dropdown-menu\" *ngIf=\"dropdownOpen\">\r\n <div class=\"dropdown-header\">\r\n {{ currentUser.fullName || currentUser.userName }}\r\n </div>\r\n <button class=\"dropdown-item profile-link\" (click)=\"onViewProfile()\">\r\n View Profile\r\n </button>\r\n <button class=\"dropdown-item logout-item\" (click)=\"onLogout()\">\r\n Logout\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n `,\r\n styles: [`\r\n .user-profile-container {\r\n display: flex;\r\n align-items: center;\r\n gap: 16px;\r\n padding: 0 16px;\r\n }\r\n\r\n .login-btn {\r\n padding: 8px 16px;\r\n background-color: #1976d2;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n cursor: pointer;\r\n font-weight: 500;\r\n transition: background-color 0.3s;\r\n }\r\n\r\n .login-btn:hover {\r\n background-color: #1565c0;\r\n }\r\n\r\n .user-header {\r\n display: flex;\r\n align-items: center;\r\n gap: 16px;\r\n }\r\n\r\n .notification-btn {\r\n position: relative;\r\n background: none;\r\n border: none;\r\n font-size: 24px;\r\n cursor: pointer;\r\n padding: 8px;\r\n transition: opacity 0.2s;\r\n }\r\n\r\n .notification-btn:hover {\r\n opacity: 0.7;\r\n }\r\n\r\n .icon {\r\n display: inline-block;\r\n }\r\n\r\n .badge {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n background-color: #f44336;\r\n color: white;\r\n border-radius: 50%;\r\n width: 20px;\r\n height: 20px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n font-size: 12px;\r\n font-weight: bold;\r\n }\r\n\r\n .user-menu-wrapper {\r\n position: relative;\r\n }\r\n\r\n .user-menu-btn {\r\n background: none;\r\n border: none;\r\n cursor: pointer;\r\n padding: 4px;\r\n border-radius: 50%;\r\n transition: background-color 0.2s;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n\r\n .user-menu-btn:hover {\r\n background-color: rgba(25, 118, 210, 0.1);\r\n }\r\n\r\n .avatar {\r\n width: 40px;\r\n height: 40px;\r\n border-radius: 50%;\r\n object-fit: cover;\r\n background-color: #e0e0e0;\r\n }\r\n\r\n .avatar-initial {\r\n width: 40px;\r\n height: 40px;\r\n border-radius: 50%;\r\n background-color: #1976d2;\r\n color: white;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n font-weight: bold;\r\n font-size: 16px;\r\n }\r\n\r\n .dropdown-menu {\r\n position: absolute;\r\n top: calc(100% + 8px);\r\n right: 0;\r\n background: white;\r\n border: 1px solid #e0e0e0;\r\n border-radius: 4px;\r\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\r\n min-width: 200px;\r\n z-index: 1000;\r\n overflow: hidden;\r\n }\r\n\r\n .dropdown-header {\r\n padding: 12px 16px;\r\n border-bottom: 1px solid #f0f0f0;\r\n font-weight: 600;\r\n color: #333;\r\n font-size: 14px;\r\n }\r\n\r\n .dropdown-item {\r\n display: block;\r\n width: 100%;\r\n padding: 12px 16px;\r\n border: none;\r\n background: none;\r\n text-align: left;\r\n cursor: pointer;\r\n font-size: 14px;\r\n color: #333;\r\n text-decoration: none;\r\n transition: background-color 0.2s;\r\n }\r\n\r\n .dropdown-item:hover {\r\n background-color: #f5f5f5;\r\n }\r\n\r\n .profile-link {\r\n color: #1976d2;\r\n }\r\n\r\n .logout-item {\r\n border-top: 1px solid #f0f0f0;\r\n color: #f44336;\r\n }\r\n\r\n .logout-item:hover {\r\n background-color: #ffebee;\r\n }\r\n\r\n .user-info {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 2px;\r\n }\r\n\r\n .user-name {\r\n font-weight: 500;\r\n font-size: 14px;\r\n color: #333;\r\n }\r\n\r\n .user-position {\r\n font-size: 12px;\r\n color: #666;\r\n }\r\n\r\n .logout-btn {\r\n background: none;\r\n border: none;\r\n font-size: 20px;\r\n cursor: pointer;\r\n color: #666;\r\n padding: 4px 8px;\r\n transition: color 0.2s;\r\n }\r\n\r\n .logout-btn:hover {\r\n color: #1976d2;\r\n }\r\n\r\n @media (max-width: 768px) {\r\n .user-info {\r\n display: none;\r\n }\r\n\r\n .avatar {\r\n width: 32px;\r\n height: 32px;\r\n }\r\n }\r\n `]\r\n})\r\nexport class UserProfileComponent implements OnInit, OnDestroy {\r\n @Output() notificationClick = new EventEmitter<void>();\r\n\r\n currentUser: IUser | null = null;\r\n unreadCount = 0;\r\n dropdownOpen = false;\r\n private destroy$ = new Subject<void>();\r\n\r\n constructor(private authService: MesAuthService, private router: Router) {}\r\n\r\n ngOnInit() {\r\n console.log('UserProfileComponent: Service injected?', !!this.authService);\r\n this.authService.currentUser$\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(user => {\r\n console.log('UserProfileComponent: currentUser', user);\r\n this.currentUser = user;\r\n });\r\n\r\n this.loadUnreadCount();\r\n\r\n // Listen for new notifications\r\n this.authService.notifications$\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(() => {\r\n this.loadUnreadCount();\r\n });\r\n }\r\n\r\n ngOnDestroy() {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n\r\n private loadUnreadCount() {\r\n this.authService.getUnreadCount().subscribe({\r\n next: (response: any) => {\r\n this.unreadCount = response.unreadCount || 0;\r\n },\r\n error: (err) => console.error('Error loading unread count:', err)\r\n });\r\n }\r\n\r\n getAvatarUrl(user: IUser): string {\r\n const config = this.authService.getConfig();\r\n const baseUrl = config?.avatarUrl || 'https://ui-avatars.com/api/';\r\n \r\n // Use userName first, fallback to userId, final fallback to 'User'\r\n const displayName = user.userName || user.userId || 'User';\r\n \r\n return `${baseUrl}?name=${encodeURIComponent(displayName)}&background=1976d2&color=fff`;\r\n }\r\n\r\n getLastNameInitial(user: IUser): string {\r\n const fullName = user.fullName || user.userName || 'U';\r\n const parts = fullName.split(' ');\r\n const lastPart = parts[parts.length - 1];\r\n return lastPart.charAt(0).toUpperCase();\r\n }\r\n\r\n toggleDropdown() {\r\n this.dropdownOpen = !this.dropdownOpen;\r\n }\r\n\r\n onLogin() {\r\n const config = this.authService.getConfig();\r\n const baseUrl = config?.userBaseUrl || '';\r\n const returnUrl = encodeURIComponent(this.router.url);\r\n window.location.href = `${baseUrl}/login?returnUrl=${returnUrl}`;\r\n }\r\n\r\n onViewProfile() {\r\n const config = this.authService.getConfig();\r\n const baseUrl = config?.userBaseUrl || '';\r\n window.location.href = `${baseUrl}/profile`;\r\n this.dropdownOpen = false;\r\n }\r\n\r\n onLogout() {\r\n this.authService.logout().subscribe({\r\n next: () => {\r\n // Clear current user after successful logout\r\n this.currentUser = null;\r\n this.dropdownOpen = false;\r\n \r\n // Navigate to login with return URL\r\n const config = this.authService.getConfig();\r\n const baseUrl = config?.userBaseUrl || '';\r\n const returnUrl = encodeURIComponent(window.location.href);\r\n window.location.href = `${baseUrl}/login?returnUrl=${returnUrl}`;\r\n },\r\n error: (err) => {\r\n console.error('Logout error:', err);\r\n // Still navigate to login even if logout fails\r\n const config = this.authService.getConfig();\r\n const baseUrl = config?.userBaseUrl || '';\r\n window.location.href = `${baseUrl}/login`;\r\n }\r\n });\r\n }\r\n\r\n onNotificationClick() {\r\n this.notificationClick.emit();\r\n }\r\n}\r\n\r\n","import { Injectable } from '@angular/core';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\n\r\nexport interface Toast {\r\n id: string;\r\n message: string;\r\n title?: string;\r\n type: 'info' | 'success' | 'warning' | 'error';\r\n duration?: number;\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ToastService {\r\n private toasts$ = new BehaviorSubject<Toast[]>([]);\r\n public toasts: Observable<Toast[]> = this.toasts$.asObservable();\r\n\r\n show(message: string, title?: string, type: 'info' | 'success' | 'warning' | 'error' = 'info', duration: number = 5000) {\r\n const id = Math.random().toString(36).substr(2, 9);\r\n const toast: Toast = {\r\n id,\r\n message,\r\n title,\r\n type,\r\n duration\r\n };\r\n\r\n const currentToasts = this.toasts$.value;\r\n this.toasts$.next([...currentToasts, toast]);\r\n\r\n if (duration > 0) {\r\n setTimeout(() => {\r\n this.remove(id);\r\n }, duration);\r\n }\r\n\r\n return id;\r\n }\r\n\r\n remove(id: string) {\r\n const currentToasts = this.toasts$.value;\r\n this.toasts$.next(currentToasts.filter(t => t.id !== id));\r\n }\r\n\r\n clear() {\r\n this.toasts$.next([]);\r\n }\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ToastService, Toast } from './toast.service';\r\n\r\n@Component({\r\n selector: 'ma-toast-container',\r\n standalone: true,\r\n imports: [CommonModule],\r\n template: `\r\n <div class=\"toast-container\">\r\n <div \r\n *ngFor=\"let toast of toasts\"\r\n class=\"toast\"\r\n [class]=\"'toast-' + toast.type\"\r\n [@slideIn]\r\n >\r\n <div class=\"toast-content\">\r\n <div *ngIf=\"toast.title\" class=\"toast-title\">{{ toast.title }}</div>\r\n <div class=\"toast-message\">{{ toast.message }}</div>\r\n </div>\r\n <button class=\"toast-close\" (click)=\"close(toast.id)\" aria-label=\"Close\">\r\n ✕\r\n </button>\r\n </div>\r\n </div>\r\n `,\r\n styles: [`\r\n .toast-container {\r\n position: fixed;\r\n top: 20px;\r\n right: 20px;\r\n z-index: 9999;\r\n pointer-events: none;\r\n }\r\n\r\n .toast {\r\n display: flex;\r\n align-items: flex-start;\r\n gap: 12px;\r\n padding: 12px 16px;\r\n margin-bottom: 12px;\r\n border-radius: 4px;\r\n background-color: white;\r\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\r\n pointer-events: auto;\r\n min-width: 300px;\r\n max-width: 500px;\r\n animation: slideIn 0.3s ease-out;\r\n }\r\n\r\n .toast-content {\r\n flex: 1;\r\n }\r\n\r\n .toast-title {\r\n font-weight: 600;\r\n font-size: 14px;\r\n margin-bottom: 4px;\r\n }\r\n\r\n .toast-message {\r\n font-size: 13px;\r\n line-height: 1.4;\r\n }\r\n\r\n .toast-close {\r\n background: none;\r\n border: none;\r\n cursor: pointer;\r\n font-size: 18px;\r\n color: #999;\r\n padding: 0;\r\n width: 24px;\r\n height: 24px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex-shrink: 0;\r\n transition: color 0.2s;\r\n }\r\n\r\n .toast-close:hover {\r\n color: #333;\r\n }\r\n\r\n /* Toast types */\r\n .toast-info {\r\n border-left: 4px solid #2196f3;\r\n }\r\n\r\n .toast-info .toast-title {\r\n color: #2196f3;\r\n }\r\n\r\n .toast-info .toast-message {\r\n color: #333;\r\n }\r\n\r\n .toast-success {\r\n border-left: 4px solid #4caf50;\r\n }\r\n\r\n .toast-success .toast-title {\r\n color: #4caf50;\r\n }\r\n\r\n .toast-success .toast-message {\r\n color: #333;\r\n }\r\n\r\n .toast-warning {\r\n border-left: 4px solid #ff9800;\r\n }\r\n\r\n .toast-warning .toast-title {\r\n color: #ff9800;\r\n }\r\n\r\n .toast-warning .toast-message {\r\n color: #333;\r\n }\r\n\r\n .toast-error {\r\n border-left: 4px solid #f44336;\r\n }\r\n\r\n .toast-error .toast-title {\r\n color: #f44336;\r\n }\r\n\r\n .toast-error .toast-message {\r\n color: #333;\r\n }\r\n\r\n @keyframes slideIn {\r\n from {\r\n transform: translateX(400px);\r\n opacity: 0;\r\n }\r\n to {\r\n transform: translateX(0);\r\n opacity: 1;\r\n }\r\n }\r\n\r\n @media (max-width: 600px) {\r\n .toast-container {\r\n top: 10px;\r\n right: 10px;\r\n left: 10px;\r\n }\r\n\r\n .toast {\r\n min-width: auto;\r\n max-width: 100%;\r\n }\r\n }\r\n `]\r\n})\r\nexport class ToastContainerComponent implements OnInit {\r\n toasts: Toast[] = [];\r\n\r\n constructor(private toastService: ToastService) {}\r\n\r\n ngOnInit() {\r\n this.toastService.toasts.subscribe(toasts => {\r\n this.toasts = toasts;\r\n });\r\n }\r\n\r\n close(id: string) {\r\n this.toastService.remove(id);\r\n }\r\n}\r\n","import { Component, OnInit, OnDestroy } from '@angular/core';\r\nimport { NgIf, NgFor } from '@angular/common';\r\nimport { MesAuthService, NotificationDto, PagedList, RealTimeNotificationDto } from './mes-auth.service';\r\nimport { ToastService } from './toast.service';\r\nimport { Subject } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'ma-notification-panel',\r\n standalone: true,\r\n imports: [NgIf, NgFor],\r\n template: `\r\n <div class=\"notification-panel\" [class.open]=\"isOpen\">\r\n <!-- Header -->\r\n <div class=\"panel-header\">\r\n <h3>Notifications</h3>\r\n <button class=\"close-btn\" (click)=\"close()\" title=\"Close\">✕</button>\r\n </div>\r\n\r\n <!-- Notifications List -->\r\n <div class=\"notifications-list\">\r\n <ng-container *ngIf=\"notifications.length > 0\">\r\n <div \r\n *ngFor=\"let notification of notifications\"\r\n class=\"notification-item\"\r\n [class.unread]=\"!notification.isRead\"\r\n (click)=\"markAsRead(notification.id)\"\r\n >\r\n <div class=\"notification-content\">\r\n <div class=\"notification-title\">{{ notification.title }}</div>\r\n <div class=\"notification-message\">{{ notification.message }}</div>\r\n <div class=\"notification-meta\">\r\n <span class=\"app-name\">{{ notification.sourceAppName }}</span>\r\n <span class=\"time\">{{ formatDate(notification.createdAt) }}</span>\r\n </div>\r\n </div>\r\n <button \r\n class=\"delete-btn\" \r\n (click)=\"delete(notification.id, $event)\"\r\n title=\"Delete\"\r\n >\r\n ✕\r\n </button>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"notifications.length === 0\">\r\n <div class=\"empty-state\">\r\n No notifications\r\n </div>\r\n </ng-container>\r\n </div>\r\n\r\n <!-- Footer Actions -->\r\n <div class=\"panel-footer\" *ngIf=\"notifications.length > 0\">\r\n <button class=\"action-btn\" (click)=\"markAllAsRead()\">\r\n Mark all as read\r\n </button>\r\n </div>\r\n </div>\r\n `,\r\n styles: [`\r\n .notification-panel {\r\n position: fixed;\r\n top: 0;\r\n right: -350px;\r\n width: 350px;\r\n height: 100vh;\r\n background: white;\r\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\r\n display: flex;\r\n flex-direction: column;\r\n z-index: 1000;\r\n transition: right 0.3s ease;\r\n }\r\n\r\n .notification-panel.open {\r\n right: 0;\r\n }\r\n\r\n .panel-header {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n padding: 16px;\r\n border-bottom: 1px solid #e0e0e0;\r\n background-color: #f5f5f5;\r\n }\r\n\r\n .panel-header h3 {\r\n margin: 0;\r\n font-size: 18px;\r\n color: #333;\r\n }\r\n\r\n .close-btn {\r\n background: none;\r\n border: none;\r\n font-size: 20px;\r\n cursor: pointer;\r\n color: #666;\r\n padding: 0;\r\n width: 32px;\r\n height: 32px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n transition: color 0.2s;\r\n }\r\n\r\n .close-btn:hover {\r\n color: #333;\r\n }\r\n\r\n .notifications-list {\r\n flex: 1;\r\n overflow-y: auto;\r\n }\r\n\r\n .notification-item {\r\n display: flex;\r\n gap: 12px;\r\n padding: 12px 16px;\r\n border-bottom: 1px solid #f0f0f0;\r\n cursor: pointer;\r\n background-color: #fafafa;\r\n transition: background-color 0.2s;\r\n }\r\n\r\n .notification-item:hover {\r\n background-color: #f5f5f5;\r\n }\r\n\r\n .notification-item.unread {\r\n background-color: #e3f2fd;\r\n }\r\n\r\n .notification-content {\r\n flex: 1;\r\n min-width: 0;\r\n }\r\n\r\n .notification-title {\r\n font-weight: 600;\r\n color: #333;\r\n font-size: 14px;\r\n margin-bottom: 4px;\r\n }\r\n\r\n .notification-message {\r\n color: #666;\r\n font-size: 13px;\r\n line-height: 1.4;\r\n margin-bottom: 6px;\r\n display: -webkit-box;\r\n -webkit-line-clamp: 2;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n }\r\n\r\n .notification-meta {\r\n display: flex;\r\n justify-content: space-between;\r\n font-size: 12px;\r\n color: #999;\r\n }\r\n\r\n .app-name {\r\n font-weight: 500;\r\n color: #1976d2;\r\n }\r\n\r\n .delete-btn {\r\n background: none;\r\n border: none;\r\n color: #999;\r\n cursor: pointer;\r\n font-size: 14px;\r\n padding: 0;\r\n width: 24px;\r\n height: 24px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex-shrink: 0;\r\n transition: color 0.2s;\r\n }\r\n\r\n .delete-btn:hover {\r\n color: #f44336;\r\n }\r\n\r\n .empty-state {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n height: 100%;\r\n color: #999;\r\n font-size: 14px;\r\n }\r\n\r\n .panel-footer {\r\n padding: 12px 16px;\r\n border-top: 1px solid #e0e0e0;\r\n background-color: #f5f5f5;\r\n }\r\n\r\n .action-btn {\r\n width: 100%;\r\n padding: 8px;\r\n background-color: #1976d2;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n cursor: pointer;\r\n font-weight: 500;\r\n transition: background-color 0.2s;\r\n }\r\n\r\n .action-btn:hover {\r\n background-color: #1565c0;\r\n }\r\n\r\n @media (max-width: 600px) {\r\n .notification-panel {\r\n width: 100%;\r\n right: -100%;\r\n }\r\n }\r\n `]\r\n})\r\nexport class NotificationPanelComponent implements OnInit, OnDestroy {\r\n isOpen = false;\r\n notifications: NotificationDto[] = [];\r\n private destroy$ = new Subject<void>();\r\n\r\n constructor(private authService: MesAuthService, private toastService: ToastService) {}\r\n\r\n ngOnInit() {\r\n this.loadNotifications();\r\n\r\n // Listen for new real-time notifications\r\n this.authService.notifications$\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe((notification: RealTimeNotificationDto) => {\r\n // Show toast for new notification\r\n this.toastService.show(\r\n notification.message,\r\n notification.title,\r\n 'info',\r\n 5000\r\n );\r\n // Reload notifications list\r\n this.loadNotifications();\r\n });\r\n }\r\n\r\n ngOnDestroy() {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n\r\n private loadNotifications() {\r\n this.authService.getNotifications(1, 50, false).subscribe({\r\n next: (response: PagedList<NotificationDto>) => {\r\n this.notifications = response.items || [];\r\n },\r\n error: (err) => console.error('Error loading notifications:', err)\r\n });\r\n }\r\n\r\n open() {\r\n this.isOpen = true;\r\n }\r\n\r\n close() {\r\n this.isOpen = false;\r\n }\r\n\r\n markAsRead(notificationId: string) {\r\n this.authService.markAsRead(notificationId).subscribe({\r\n next: () => {\r\n const notification = this.notifications.find(n => n.id === notificationId);\r\n if (notification) {\r\n notification.isRead = true;\r\n }\r\n },\r\n error: (err) => console.error('Error marking as read:', err)\r\n });\r\n }\r\n\r\n markAllAsRead() {\r\n this.authService.markAllAsRead().subscribe({\r\n next: () => {\r\n this.notifications.forEach(n => n.isRead = true);\r\n },\r\n error: (err) => console.error('Error marking all as read:', err)\r\n });\r\n }\r\n\r\n delete(notificationId: string, event: Event) {\r\n event.stopPropagation();\r\n this.authService.deleteNotification(notificationId).subscribe({\r\n next: () => {\r\n this.notifications = this.notifications.filter(n => n.id !== notificationId);\r\n },\r\n error: (err) => console.error('Error deleting notification:', err)\r\n });\r\n }\r\n\r\n formatDate(dateString: string): string {\r\n const date = new Date(dateString);\r\n const now = new Date();\r\n const diffMs = now.getTime() - date.getTime();\r\n const diffMins = Math.floor(diffMs / 60000);\r\n const diffHours = Math.floor(diffMs / 3600000);\r\n const diffDays = Math.floor(diffMs / 86400000);\r\n\r\n if (diffMins < 1) return 'Now';\r\n if (diffMins < 60) return `${diffMins}m ago`;\r\n if (diffHours < 24) return `${diffHours}h ago`;\r\n if (diffDays < 7) return `${diffDays}d ago`;\r\n \r\n return date.toLocaleDateString();\r\n }\r\n}\r\n","import { Component } from '@angular/core';\r\nimport { ToastContainerComponent } from './toast-container.component';\r\nimport { UserProfileComponent } from './user-profile.component';\r\nimport { NotificationPanelComponent } from './notification-panel.component';\r\n\r\n@Component({\r\n selector: 'ma-user',\r\n standalone: true,\r\n imports: [ToastContainerComponent, UserProfileComponent, NotificationPanelComponent],\r\n template: `\r\n <ma-toast-container></ma-toast-container>\r\n <div class=\"user-header\">\r\n <ma-user-profile (notificationClick)=\"notificationPanel.open()\"></ma-user-profile>\r\n </div>\r\n <ma-notification-panel #notificationPanel></ma-notification-panel>\r\n `,\r\n styles: [`\r\n .user-header {\r\n display: flex;\r\n justify-content: flex-end;\r\n }\r\n `]\r\n})\r\nexport class MaUserComponent {}\r\n","import { Component, OnInit, OnDestroy, Output, EventEmitter } from '@angular/core';\r\nimport { NgIf } from '@angular/common';\r\nimport { MesAuthService } from './mes-auth.service';\r\nimport { Subject } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'ma-notification-badge',\r\n standalone: true,\r\n imports: [NgIf],\r\n template: `\r\n <button class=\"notification-btn\" (click)=\"onNotificationClick()\" title=\"Notifications\">\r\n <span class=\"icon\">🔔</span>\r\n <span class=\"badge\" *ngIf=\"unreadCount > 0\">{{ unreadCount }}</span>\r\n </button>\r\n `,\r\n styles: [`\r\n .notification-btn {\r\n position: relative;\r\n background: none;\r\n border: none;\r\n font-size: 24px;\r\n cursor: pointer;\r\n padding: 8px;\r\n transition: opacity 0.2s;\r\n }\r\n\r\n .notification-btn:hover {\r\n opacity: 0.7;\r\n }\r\n\r\n .icon {\r\n display: inline-block;\r\n }\r\n\r\n .badge {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n background-color: #f44336;\r\n color: white;\r\n border-radius: 50%;\r\n width: 20px;\r\n height: 20px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n font-size: 12px;\r\n font-weight: bold;\r\n }\r\n `]\r\n})\r\nexport class NotificationBadgeComponent implements OnInit, OnDestroy {\r\n @Output() notificationClick = new EventEmitter<void>();\r\n \r\n unreadCount = 0;\r\n private destroy$ = new Subject<void>();\r\n\r\n constructor(private authService: MesAuthService) {}\r\n\r\n ngOnInit() {\r\n this.loadUnreadCount();\r\n \r\n // Listen for new notifications\r\n this.authService.notifications$\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(() => {\r\n this.loadUnreadCount();\r\n });\r\n }\r\n\r\n ngOnDestroy() {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n\r\n private loadUnreadCount() {\r\n this.authService.getUnreadCount().subscribe({\r\n next: (response: any) => {\r\n this.unreadCount = response.unreadCount || 0;\r\n },\r\n error: (err) => console.error('Error loading unread count:', err)\r\n });\r\n }\r\n\r\n onNotificationClick() {\r\n this.notificationClick.emit();\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.MesAuthService","i1.ToastService","i2","i2.ToastService"],"mappings":";;;;;;;;;;;IAwCY,iBAKX;AALD,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,gBAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,GAK3B,EAAA,CAAA,CAAA,CAAA;MAsCY,cAAc,CAAA;AAUzB,IAAA,WAAA,CAAoB,IAAgB,EAAA;QAAhB,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;QAT5B,IAAa,CAAA,aAAA,GAAyB,IAAI,CAAC;AAC3C,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,eAAe,CAAe,IAAI,CAAC,CAAC;AACxD,QAAA,IAAA,CAAA,YAAY,GAA6B,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;AACzE,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,OAAO,EAAO,CAAC;AACrC,QAAA,IAAA,CAAA,cAAc,GAAoB,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;QAEpE,IAAO,CAAA,OAAA,GAAG,EAAE,CAAC;QACb,IAAM,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EAAA,CAAA;;;;;AAKT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,6YAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EANS,IAAI,EAAA,QAAA,EAAA,QAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,UAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;2FA2CH,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBA9CtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,uBAAuB,cACrB,IAAI,EAAA,OAAA,EACP,CAAC,IAAI,CAAC,EACL,QAAA,EAAA,CAAA;;;;;AAKT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,6YAAA,CAAA,EAAA,CAAA;kGAsCS,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;;;ACrDT;;AAEG;;;;"}
@@ -1,2 +1,5 @@
1
+ import * as i0 from "@angular/core";
1
2
  export declare class MaUserComponent {
3
+ static ɵfac: i0.ɵɵFactoryDeclaration<MaUserComponent, never>;
4
+ static ɵcmp: i0.ɵɵComponentDeclaration<MaUserComponent, "ma-user", never, {}, {}, never, never, true>;
2
5
  }
@@ -2,9 +2,12 @@ import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/c
2
2
  import { Observable } from 'rxjs';
3
3
  import { Router } from '@angular/router';
4
4
  import { MesAuthService } from './mes-auth.service';
5
+ import * as i0 from "@angular/core";
5
6
  export declare class MesAuthInterceptor implements HttpInterceptor {
6
7
  private authService;
7
8
  private router;
8
9
  constructor(authService: MesAuthService, router: Router);
9
10
  intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<MesAuthInterceptor, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<MesAuthInterceptor>;
10
13
  }
@@ -1,2 +1,6 @@
1
+ import * as i0 from "@angular/core";
1
2
  export declare class MesAuthModule {
3
+ static ɵfac: i0.ɵɵFactoryDeclaration<MesAuthModule, never>;
4
+ static ɵmod: i0.ɵɵNgModuleDeclaration<MesAuthModule, never, never, never>;
5
+ static ɵinj: i0.ɵɵInjectorDeclaration<MesAuthModule>;
2
6
  }
@@ -1,5 +1,6 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
3
4
  export interface MesAuthConfig {
4
5
  apiBaseUrl: string;
5
6
  withCredentials?: boolean;
@@ -72,6 +73,7 @@ export interface RealTimeNotificationDto {
72
73
  sourceAppIconUrl?: string;
73
74
  }
74
75
  export declare class MesAuthService {
76
+ private http;
75
77
  private hubConnection;
76
78
  private _currentUser;
77
79
  currentUser$: Observable<IUser | null>;
@@ -79,7 +81,7 @@ export declare class MesAuthService {
79
81
  notifications$: Observable<any>;
80
82
  private apiBase;
81
83
  private config;
82
- readonly http: HttpClient;
84
+ constructor(http: HttpClient);
83
85
  init(config: MesAuthConfig): void;
84
86
  getConfig(): MesAuthConfig | null;
85
87
  private fetchCurrentUser;
@@ -93,4 +95,6 @@ export declare class MesAuthService {
93
95
  stop(): void;
94
96
  logout(): Observable<any>;
95
97
  refreshUser(): void;
98
+ static ɵfac: i0.ɵɵFactoryDeclaration<MesAuthService, never>;
99
+ static ɵprov: i0.ɵɵInjectableDeclaration<MesAuthService>;
96
100
  }
@@ -1,5 +1,6 @@
1
1
  import { OnInit, OnDestroy, EventEmitter } from '@angular/core';
2
2
  import { MesAuthService } from './mes-auth.service';
3
+ import * as i0 from "@angular/core";
3
4
  export declare class NotificationBadgeComponent implements OnInit, OnDestroy {
4
5
  private authService;
5
6
  notificationClick: EventEmitter<void>;
@@ -10,4 +11,6 @@ export declare class NotificationBadgeComponent implements OnInit, OnDestroy {
10
11
  ngOnDestroy(): void;
11
12
  private loadUnreadCount;
12
13
  onNotificationClick(): void;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<NotificationBadgeComponent, never>;
15
+ static ɵcmp: i0.ɵɵComponentDeclaration<NotificationBadgeComponent, "ma-notification-badge", never, {}, { "notificationClick": "notificationClick"; }, never, never, true>;
13
16
  }
@@ -1,6 +1,7 @@
1
1
  import { OnInit, OnDestroy } from '@angular/core';
2
2
  import { MesAuthService, NotificationDto } from './mes-auth.service';
3
3
  import { ToastService } from './toast.service';
4
+ import * as i0 from "@angular/core";
4
5
  export declare class NotificationPanelComponent implements OnInit, OnDestroy {
5
6
  private authService;
6
7
  private toastService;
@@ -17,4 +18,6 @@ export declare class NotificationPanelComponent implements OnInit, OnDestroy {
17
18
  markAllAsRead(): void;
18
19
  delete(notificationId: string, event: Event): void;
19
20
  formatDate(dateString: string): string;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<NotificationPanelComponent, never>;
22
+ static ɵcmp: i0.ɵɵComponentDeclaration<NotificationPanelComponent, "ma-notification-panel", never, {}, {}, never, never, true>;
20
23
  }
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "mesauth-angular",
3
+ "version": "0.1.12",
4
+ "description": "Angular helper library to connect to a backend API and SignalR hub to surface the current logged-in user and incoming notifications",
5
+ "main": "fesm2015/mesauth-angular.mjs",
6
+ "types": "index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "keywords": [
11
+ "angular",
12
+ "signalr",
13
+ "notifications",
14
+ "auth",
15
+ "mes"
16
+ ],
17
+ "license": "MIT",
18
+ "peerDependencies": {
19
+ "@angular/core": "^14.0.0",
20
+ "@angular/common": "^14.0.0",
21
+ "@angular/router": "^14.0.0",
22
+ "rxjs": "^7"
23
+ },
24
+ "dependencies": {
25
+ "@microsoft/signalr": "^7.0.0",
26
+ "rxjs": "^7.5.0",
27
+ "tslib": "^2.3.0"
28
+ },
29
+ "angularCompilerOptions": {
30
+ "enableIvy": true
31
+ },
32
+ "module": "fesm2015/mesauth-angular.mjs",
33
+ "es2020": "fesm2020/mesauth-angular.mjs",
34
+ "esm2020": "esm2020/mesauth-angular.mjs",
35
+ "fesm2020": "fesm2020/mesauth-angular.mjs",
36
+ "fesm2015": "fesm2015/mesauth-angular.mjs",
37
+ "typings": "index.d.ts",
38
+ "exports": {
39
+ "./package.json": {
40
+ "default": "./package.json"
41
+ },
42
+ ".": {
43
+ "types": "./index.d.ts",
44
+ "esm2020": "./esm2020/mesauth-angular.mjs",
45
+ "es2020": "./fesm2020/mesauth-angular.mjs",
46
+ "es2015": "./fesm2015/mesauth-angular.mjs",
47
+ "node": "./fesm2015/mesauth-angular.mjs",
48
+ "default": "./fesm2020/mesauth-angular.mjs"
49
+ }
50
+ },
51
+ "sideEffects": false
52
+ }
@@ -1,9 +1,12 @@
1
1
  import { OnInit } from '@angular/core';
2
2
  import { ToastService, Toast } from './toast.service';
3
+ import * as i0 from "@angular/core";
3
4
  export declare class ToastContainerComponent implements OnInit {
4
5
  private toastService;
5
6
  toasts: Toast[];
6
7
  constructor(toastService: ToastService);
7
8
  ngOnInit(): void;
8
9
  close(id: string): void;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToastContainerComponent, never>;
11
+ static ɵcmp: i0.ɵɵComponentDeclaration<ToastContainerComponent, "ma-toast-container", never, {}, {}, never, never, true>;
9
12
  }
@@ -1,4 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
+ import * as i0 from "@angular/core";
2
3
  export interface Toast {
3
4
  id: string;
4
5
  message: string;
@@ -12,4 +13,6 @@ export declare class ToastService {
12
13
  show(message: string, title?: string, type?: 'info' | 'success' | 'warning' | 'error', duration?: number): string;
13
14
  remove(id: string): void;
14
15
  clear(): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToastService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<ToastService>;
15
18
  }
@@ -1,6 +1,7 @@
1
1
  import { OnInit, OnDestroy, EventEmitter } from '@angular/core';
2
2
  import { Router } from '@angular/router';
3
3
  import { MesAuthService, IUser } from './mes-auth.service';
4
+ import * as i0 from "@angular/core";
4
5
  export declare class UserProfileComponent implements OnInit, OnDestroy {
5
6
  private authService;
6
7
  private router;
@@ -20,4 +21,6 @@ export declare class UserProfileComponent implements OnInit, OnDestroy {
20
21
  onViewProfile(): void;
21
22
  onLogout(): void;
22
23
  onNotificationClick(): void;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserProfileComponent, never>;
25
+ static ɵcmp: i0.ɵɵComponentDeclaration<UserProfileComponent, "ma-user-profile", never, {}, { "notificationClick": "notificationClick"; }, never, never, true>;
23
26
  }
package/package.json CHANGED
@@ -1,30 +1,36 @@
1
1
  {
2
2
  "name": "mesauth-angular",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Angular helper library to connect to a backend API and SignalR hub to surface the current logged-in user and incoming notifications",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "fesm2015/mesauth-angular.mjs",
6
+ "types": "index.d.ts",
7
7
  "files": ["dist"],
8
8
  "scripts": {
9
- "build": "tsc -p tsconfig.json",
9
+ "build": "ng-packagr -p ng-package.json",
10
10
  "prepare": "npm run build",
11
11
  "publish": "npm publish"
12
12
  },
13
13
  "keywords": ["angular","signalr","notifications","auth","mes"],
14
14
  "license": "MIT",
15
15
  "peerDependencies": {
16
- "@angular/core": "^9",
17
- "@angular/common": "^9",
18
- "@angular/router": "^9",
19
- "rxjs": "^6"
16
+ "@angular/core": "^14.0.0",
17
+ "@angular/common": "^14.0.0",
18
+ "@angular/router": "^14.0.0",
19
+ "rxjs": "^7"
20
20
  },
21
21
  "dependencies": {
22
22
  "@microsoft/signalr": "^7.0.0",
23
- "rxjs": "^6.6.0"
23
+ "rxjs": "^7.5.0"
24
24
  },
25
25
  "devDependencies": {
26
- "typescript": "~4.9.5",
27
- "tslib": "^2.0.0"
26
+ "@angular/compiler-cli": "^14.0.0",
27
+ "@angular/compiler": "^14.0.0",
28
+ "@angular/core": "^14.0.0",
29
+ "@angular/common": "^14.0.0",
30
+ "@angular/router": "^14.0.0",
31
+ "typescript": "~4.7.0",
32
+ "tslib": "^2.0.0",
33
+ "ng-packagr": "^14.0.0"
28
34
  },
29
35
  "angularCompilerOptions": {
30
36
  "enableIvy": true
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
- export * from './mes-auth.service';
2
- export * from './mes-auth.interceptor';
3
- export * from './mes-auth.module';
4
- export * from './user-profile.component';
5
- export * from './ma-user.component';
6
- export * from './notification-badge.component';
7
- export * from './notification-panel.component';
8
- export * from './toast-container.component';
@@ -1,33 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component } from '@angular/core';
8
- import { ToastContainerComponent } from './toast-container.component';
9
- import { UserProfileComponent } from './user-profile.component';
10
- import { NotificationPanelComponent } from './notification-panel.component';
11
- let MaUserComponent = class MaUserComponent {
12
- };
13
- MaUserComponent = __decorate([
14
- Component({
15
- selector: 'ma-user',
16
- standalone: true,
17
- imports: [ToastContainerComponent, UserProfileComponent, NotificationPanelComponent],
18
- template: `
19
- <ma-toast-container></ma-toast-container>
20
- <div class="user-header">
21
- <ma-user-profile (notificationClick)="notificationPanel.open()"></ma-user-profile>
22
- </div>
23
- <ma-notification-panel #notificationPanel></ma-notification-panel>
24
- `,
25
- styles: [`
26
- .user-header {
27
- display: flex;
28
- justify-content: flex-end;
29
- }
30
- `]
31
- })
32
- ], MaUserComponent);
33
- export { MaUserComponent };
@@ -1,36 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { Injectable } from '@angular/core';
11
- import { throwError } from 'rxjs';
12
- import { catchError } from 'rxjs/operators';
13
- import { Router } from '@angular/router';
14
- import { MesAuthService } from './mes-auth.service';
15
- let MesAuthInterceptor = class MesAuthInterceptor {
16
- constructor(authService, router) {
17
- this.authService = authService;
18
- this.router = router;
19
- }
20
- intercept(req, next) {
21
- return next.handle(req).pipe(catchError((error) => {
22
- if (error.status === 403) {
23
- const config = this.authService.getConfig();
24
- const baseUrl = config?.userBaseUrl || '';
25
- const returnUrl = encodeURIComponent(window.location.href);
26
- window.location.href = `${baseUrl}/403?returnUrl=${returnUrl}`;
27
- }
28
- return throwError(error);
29
- }));
30
- }
31
- };
32
- MesAuthInterceptor = __decorate([
33
- Injectable(),
34
- __metadata("design:paramtypes", [MesAuthService, Router])
35
- ], MesAuthInterceptor);
36
- export { MesAuthInterceptor };
@@ -1,33 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { NgModule } from '@angular/core';
8
- import { HTTP_INTERCEPTORS } from '@angular/common/http';
9
- import { MesAuthService } from './mes-auth.service';
10
- import { MesAuthInterceptor } from './mes-auth.interceptor';
11
- import { UserProfileComponent } from './user-profile.component';
12
- import { MaUserComponent } from './ma-user.component';
13
- import { NotificationBadgeComponent } from './notification-badge.component';
14
- import { NotificationPanelComponent } from './notification-panel.component';
15
- import { ToastContainerComponent } from './toast-container.component';
16
- let MesAuthModule = class MesAuthModule {
17
- };
18
- MesAuthModule = __decorate([
19
- NgModule({
20
- providers: [
21
- MesAuthService,
22
- { provide: HTTP_INTERCEPTORS, useClass: MesAuthInterceptor, multi: true }
23
- ],
24
- exports: [
25
- UserProfileComponent,
26
- MaUserComponent,
27
- NotificationBadgeComponent,
28
- NotificationPanelComponent,
29
- ToastContainerComponent
30
- ]
31
- })
32
- ], MesAuthModule);
33
- export { MesAuthModule };
@@ -1,107 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { inject, Injectable } from '@angular/core';
8
- import { HttpClient } from '@angular/common/http';
9
- import { HubConnectionBuilder, LogLevel } from '@microsoft/signalr';
10
- import { BehaviorSubject, Subject } from 'rxjs';
11
- export var NotificationType;
12
- (function (NotificationType) {
13
- NotificationType["Info"] = "Info";
14
- NotificationType["Warning"] = "Warning";
15
- NotificationType["Error"] = "Error";
16
- NotificationType["Success"] = "Success";
17
- })(NotificationType || (NotificationType = {}));
18
- let MesAuthService = class MesAuthService {
19
- constructor() {
20
- this.hubConnection = null;
21
- this._currentUser = new BehaviorSubject(null);
22
- this.currentUser$ = this._currentUser.asObservable();
23
- this._notifications = new Subject();
24
- this.notifications$ = this._notifications.asObservable();
25
- this.apiBase = '';
26
- this.config = null;
27
- //constructor(private http: HttpClient) {}
28
- this.http = inject(HttpClient);
29
- }
30
- init(config) {
31
- this.config = config;
32
- this.apiBase = config.apiBaseUrl.replace(/\/$/, '');
33
- this.fetchCurrentUser();
34
- this.fetchInitialNotifications();
35
- this.startConnection(config);
36
- }
37
- getConfig() {
38
- return this.config;
39
- }
40
- fetchCurrentUser() {
41
- if (!this.apiBase)
42
- return;
43
- this.http.get(`${this.apiBase}/auth/me`).subscribe({
44
- next: (u) => this._currentUser.next(u),
45
- error: (err) => console.error('fetchCurrentUser error', err)
46
- });
47
- }
48
- fetchInitialNotifications() {
49
- if (!this.apiBase)
50
- return;
51
- this.http.get(`${this.apiBase}/notif/me`).subscribe({
52
- next: (notifications) => {
53
- if (Array.isArray(notifications?.items)) {
54
- notifications.items.forEach((n) => this._notifications.next(n));
55
- }
56
- },
57
- error: (err) => console.error('fetchInitialNotifications error', err)
58
- });
59
- }
60
- getUnreadCount() {
61
- return this.http.get(`${this.apiBase}/notif/me/unread-count`);
62
- }
63
- getNotifications(page = 1, pageSize = 20, includeRead = false, type) {
64
- let url = `${this.apiBase}/notif/me?page=${page}&pageSize=${pageSize}&includeRead=${includeRead}`;
65
- if (type) {
66
- url += `&type=${type}`;
67
- }
68
- return this.http.get(url);
69
- }
70
- markAsRead(notificationId) {
71
- return this.http.patch(`${this.apiBase}/notif/${notificationId}/read`, {});
72
- }
73
- markAllAsRead() {
74
- return this.http.patch(`${this.apiBase}/notif/me/read-all`, {});
75
- }
76
- deleteNotification(notificationId) {
77
- return this.http.delete(`${this.apiBase}/notif/${notificationId}`);
78
- }
79
- startConnection(config) {
80
- if (this.hubConnection)
81
- return;
82
- const signalrUrl = config.apiBaseUrl.replace(/\/$/, '') + '/hub/notification';
83
- const builder = new HubConnectionBuilder()
84
- .withUrl(signalrUrl, { withCredentials: config.withCredentials ?? true })
85
- .withAutomaticReconnect()
86
- .configureLogging(LogLevel.Warning);
87
- this.hubConnection = builder.build();
88
- this.hubConnection.on('ReceiveNotification', (n) => this._notifications.next(n));
89
- this.hubConnection.start().catch((err) => console.error('SignalR start error', err));
90
- }
91
- stop() {
92
- if (!this.hubConnection)
93
- return;
94
- this.hubConnection.stop().catch(() => { });
95
- this.hubConnection = null;
96
- }
97
- logout() {
98
- return this.http.post(`${this.apiBase}/auth/logout`, {});
99
- }
100
- refreshUser() {
101
- this.fetchCurrentUser();
102
- }
103
- };
104
- MesAuthService = __decorate([
105
- Injectable()
106
- ], MesAuthService);
107
- export { MesAuthService };