mesauth-angular 0.1.3 → 0.1.5
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/README.md
CHANGED
|
@@ -160,6 +160,7 @@ A reusable Angular component for displaying the current user's profile informati
|
|
|
160
160
|
If you encounter an error like "The injectable 'MesAuthService' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available," this typically occurs because:
|
|
161
161
|
- The package is being imported directly from source code (e.g., during development) without building it first.
|
|
162
162
|
- The client app is running in AOT (Ahead-of-Time) compilation mode, which requires pre-compiled libraries.
|
|
163
|
+
- **Why JIT is required:** Originally, `MesAuthService` used `@Injectable({ providedIn: 'root' })`, making it a library-provided service. Angular libraries must be built with tools like ng-packagr to generate AOT-compatible code. If not, or if imported from source, the service requires JIT compilation in the client's app. This change (removing `providedIn: 'root'` and requiring manual provision) allows the service to be compiled in your app's context, supporting both JIT and AOT modes.
|
|
163
164
|
|
|
164
165
|
**Solutions:**
|
|
165
166
|
1. **Build the package for production/AOT compatibility:**
|
|
@@ -5,7 +5,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Component } from '@angular/core';
|
|
8
|
-
import { CommonModule } from '@angular/common';
|
|
9
8
|
import { ToastContainerComponent } from './toast-container.component';
|
|
10
9
|
import { UserProfileComponent } from './user-profile.component';
|
|
11
10
|
import { NotificationPanelComponent } from './notification-panel.component';
|
|
@@ -15,7 +14,7 @@ MaUserComponent = __decorate([
|
|
|
15
14
|
Component({
|
|
16
15
|
selector: 'ma-user',
|
|
17
16
|
standalone: true,
|
|
18
|
-
imports: [
|
|
17
|
+
imports: [ToastContainerComponent, UserProfileComponent, NotificationPanelComponent],
|
|
19
18
|
template: `
|
|
20
19
|
<ma-toast-container></ma-toast-container>
|
|
21
20
|
<div class="user-header">
|
|
@@ -72,7 +72,6 @@ export interface RealTimeNotificationDto {
|
|
|
72
72
|
sourceAppIconUrl?: string;
|
|
73
73
|
}
|
|
74
74
|
export declare class MesAuthService {
|
|
75
|
-
private http;
|
|
76
75
|
private hubConnection;
|
|
77
76
|
private _currentUser;
|
|
78
77
|
currentUser$: Observable<IUser | null>;
|
|
@@ -80,7 +79,7 @@ export declare class MesAuthService {
|
|
|
80
79
|
notifications$: Observable<any>;
|
|
81
80
|
private apiBase;
|
|
82
81
|
private config;
|
|
83
|
-
|
|
82
|
+
readonly http: HttpClient;
|
|
84
83
|
init(config: MesAuthConfig): void;
|
|
85
84
|
getConfig(): MesAuthConfig | null;
|
|
86
85
|
private fetchCurrentUser;
|
package/dist/mes-auth.service.js
CHANGED
|
@@ -4,10 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { Injectable } from '@angular/core';
|
|
7
|
+
import { inject, Injectable } from '@angular/core';
|
|
11
8
|
import { HttpClient } from '@angular/common/http';
|
|
12
9
|
import { HubConnectionBuilder, LogLevel } from '@microsoft/signalr';
|
|
13
10
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
@@ -19,8 +16,7 @@ export var NotificationType;
|
|
|
19
16
|
NotificationType["Success"] = "Success";
|
|
20
17
|
})(NotificationType || (NotificationType = {}));
|
|
21
18
|
let MesAuthService = class MesAuthService {
|
|
22
|
-
constructor(
|
|
23
|
-
this.http = http;
|
|
19
|
+
constructor() {
|
|
24
20
|
this.hubConnection = null;
|
|
25
21
|
this._currentUser = new BehaviorSubject(null);
|
|
26
22
|
this.currentUser$ = this._currentUser.asObservable();
|
|
@@ -28,6 +24,8 @@ let MesAuthService = class MesAuthService {
|
|
|
28
24
|
this.notifications$ = this._notifications.asObservable();
|
|
29
25
|
this.apiBase = '';
|
|
30
26
|
this.config = null;
|
|
27
|
+
//constructor(private http: HttpClient) {}
|
|
28
|
+
this.http = inject(HttpClient);
|
|
31
29
|
}
|
|
32
30
|
init(config) {
|
|
33
31
|
this.config = config;
|
|
@@ -105,7 +103,6 @@ let MesAuthService = class MesAuthService {
|
|
|
105
103
|
}
|
|
106
104
|
};
|
|
107
105
|
MesAuthService = __decorate([
|
|
108
|
-
Injectable()
|
|
109
|
-
__metadata("design:paramtypes", [HttpClient])
|
|
106
|
+
Injectable()
|
|
110
107
|
], MesAuthService);
|
|
111
108
|
export { MesAuthService };
|
|
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { Component, Output, EventEmitter } from '@angular/core';
|
|
11
|
-
import {
|
|
11
|
+
import { NgIf } from '@angular/common';
|
|
12
12
|
import { MesAuthService } from './mes-auth.service';
|
|
13
13
|
import { Subject } from 'rxjs';
|
|
14
14
|
import { takeUntil } from 'rxjs/operators';
|
|
@@ -52,7 +52,7 @@ NotificationBadgeComponent = __decorate([
|
|
|
52
52
|
Component({
|
|
53
53
|
selector: 'ma-notification-badge',
|
|
54
54
|
standalone: true,
|
|
55
|
-
imports: [
|
|
55
|
+
imports: [NgIf],
|
|
56
56
|
template: `
|
|
57
57
|
<button class="notification-btn" (click)="onNotificationClick()" title="Notifications">
|
|
58
58
|
<span class="icon">🔔</span>
|
|
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { Component, Output, EventEmitter } from '@angular/core';
|
|
11
|
-
import {
|
|
11
|
+
import { NgIf } from '@angular/common';
|
|
12
12
|
import { Router } from '@angular/router';
|
|
13
13
|
import { MesAuthService } from './mes-auth.service';
|
|
14
14
|
import { Subject } from 'rxjs';
|
|
@@ -110,7 +110,7 @@ UserProfileComponent = __decorate([
|
|
|
110
110
|
Component({
|
|
111
111
|
selector: 'ma-user-profile',
|
|
112
112
|
standalone: true,
|
|
113
|
-
imports: [
|
|
113
|
+
imports: [NgIf],
|
|
114
114
|
template: `
|
|
115
115
|
<div class="user-profile-container">
|
|
116
116
|
<!-- Not logged in -->
|