@acontplus/ng-auth 1.1.0 → 1.1.2

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/index.d.ts CHANGED
@@ -1,44 +1,15 @@
1
1
  import { ITokenProvider, BaseUseCase } from '@acontplus/ng-infrastructure';
2
2
  export { ITokenProvider, TOKEN_PROVIDER } from '@acontplus/ng-infrastructure';
3
3
  import { CanActivateFn } from '@angular/router';
4
- import { AuthTokens, BaseEntity, UserData } from '@acontplus/core';
5
4
  import * as i0 from '@angular/core';
6
5
  import { OnDestroy, OnInit, TemplateRef, Provider } from '@angular/core';
6
+ import { AuthTokens, UserData } from '@acontplus/core';
7
7
  import { HttpInterceptorFn } from '@angular/common/http';
8
8
  import { Observable } from 'rxjs';
9
9
  import { AbstractControl, FormGroup } from '@angular/forms';
10
10
 
11
11
  declare const authGuard: CanActivateFn;
12
12
 
13
- declare class TokenRepository {
14
- private environment;
15
- private platformId;
16
- saveTokens(tokens: AuthTokens, rememberMe?: boolean): void;
17
- getAccessToken(): string | null;
18
- getRefreshToken(): string | null;
19
- setToken(token: string, rememberMe?: boolean): void;
20
- setRefreshToken(refreshToken: string, rememberMe?: boolean): void;
21
- clearTokens(): void;
22
- isAuthenticated(): boolean;
23
- needsRefresh(): boolean;
24
- getTokenPayload(): any;
25
- /**
26
- * Determines if tokens are stored persistently (localStorage) vs session (sessionStorage)
27
- */
28
- isRememberMeEnabled(): boolean;
29
- static ɵfac: i0.ɵɵFactoryDeclaration<TokenRepository, never>;
30
- static ɵprov: i0.ɵɵInjectableDeclaration<TokenRepository>;
31
- }
32
-
33
- declare class AuthTokenService implements ITokenProvider {
34
- private tokenRepository;
35
- constructor(tokenRepository: TokenRepository);
36
- getToken(): string | null;
37
- isAuthenticated(): boolean;
38
- static ɵfac: i0.ɵɵFactoryDeclaration<AuthTokenService, never>;
39
- static ɵprov: i0.ɵɵInjectableDeclaration<AuthTokenService>;
40
- }
41
-
42
13
  /**
43
14
  * Service to manage URL redirection after authentication
44
15
  * Stores the intended URL when session is lost and redirects to it after successful login
@@ -94,6 +65,26 @@ declare class UrlRedirectService {
94
65
  static ɵprov: i0.ɵɵInjectableDeclaration<UrlRedirectService>;
95
66
  }
96
67
 
68
+ declare class TokenRepository implements ITokenProvider {
69
+ private environment;
70
+ private platformId;
71
+ saveTokens(tokens: AuthTokens, rememberMe?: boolean): void;
72
+ getToken(): string | null;
73
+ getRefreshToken(): string | null;
74
+ setToken(token: string, rememberMe?: boolean): void;
75
+ setRefreshToken(refreshToken: string, rememberMe?: boolean): void;
76
+ clearTokens(): void;
77
+ isAuthenticated(): boolean;
78
+ needsRefresh(): boolean;
79
+ getTokenPayload(): unknown;
80
+ /**
81
+ * Determines if tokens are stored persistently (localStorage) vs session (sessionStorage)
82
+ */
83
+ isRememberMeEnabled(): boolean;
84
+ static ɵfac: i0.ɵɵFactoryDeclaration<TokenRepository, never>;
85
+ static ɵprov: i0.ɵɵInjectableDeclaration<TokenRepository>;
86
+ }
87
+
97
88
  /**
98
89
  * Interceptor that handles authentication errors and manages URL redirection
99
90
  * Captures the current URL when a 401 error occurs and redirects to login
@@ -114,21 +105,6 @@ interface RefreshTokenRequest {
114
105
  email: string;
115
106
  refreshToken: string;
116
107
  }
117
- interface RegisterResponse {
118
- token: string;
119
- refreshToken: string;
120
- }
121
- declare class User implements BaseEntity {
122
- readonly id: number;
123
- readonly email: string;
124
- readonly displayName: string;
125
- private _refreshToken?;
126
- constructor(id: number, email: string, displayName: string, _refreshToken?: string | undefined);
127
- get refreshToken(): string | undefined;
128
- updateRefreshToken(token: string): void;
129
- clearRefreshToken(): void;
130
- static create(email: string, displayName: string, _password: string): User;
131
- }
132
108
 
133
109
  declare abstract class AuthRepository {
134
110
  abstract login(request: LoginRequest): Observable<AuthTokens>;
@@ -194,6 +170,7 @@ declare class AuthStore implements OnDestroy {
194
170
  private readonly tokenRepository;
195
171
  private readonly userRepository;
196
172
  private readonly router;
173
+ private readonly ngZone;
197
174
  private readonly _isAuthenticated;
198
175
  private readonly _isLoading;
199
176
  private readonly _user;
@@ -253,13 +230,15 @@ declare class LoginComponent implements OnInit {
253
230
  showRememberMe: i0.InputSignal<boolean>;
254
231
  additionalSigninControls: i0.InputSignal<Record<string, AbstractControl<any, any, any>>>;
255
232
  additionalSignupControls: i0.InputSignal<Record<string, AbstractControl<any, any, any>>>;
256
- additionalSigninFields: i0.InputSignal<TemplateRef<any> | null>;
257
- additionalSignupFields: i0.InputSignal<TemplateRef<any> | null>;
258
- footerContent: i0.InputSignal<TemplateRef<any> | null>;
233
+ additionalSigninFields: i0.InputSignal<TemplateRef<unknown> | null>;
234
+ additionalSignupFields: i0.InputSignal<TemplateRef<unknown> | null>;
235
+ footerContent: i0.InputSignal<TemplateRef<unknown> | null>;
259
236
  hasFooterContent: i0.Signal<boolean>;
260
237
  private readonly fb;
238
+ private readonly authStore;
261
239
  private readonly loginUseCase;
262
240
  private readonly registerUseCase;
241
+ private readonly loggingService;
263
242
  isLoginMode: i0.WritableSignal<boolean>;
264
243
  isLoading: i0.WritableSignal<boolean>;
265
244
  errorMessage: i0.WritableSignal<string | null>;
@@ -276,5 +255,5 @@ declare class LoginComponent implements OnInit {
276
255
 
277
256
  declare const authProviders: Provider[];
278
257
 
279
- export { AuthHttpRepository, AuthRepository, AuthStore, AuthTokenService, LoginComponent, LoginUseCase, LogoutUseCase, RefreshTokenUseCase, RegisterUseCase, TokenRepository, UrlRedirectService, User, authGuard, authProviders, authRedirectInterceptor };
280
- export type { LoginRequest, RefreshTokenRequest, RegisterRequest, RegisterResponse };
258
+ export { AuthHttpRepository, AuthRepository, AuthStore, LoginComponent, LoginUseCase, LogoutUseCase, RefreshTokenUseCase, RegisterUseCase, TokenRepository, UrlRedirectService, authGuard, authProviders, authRedirectInterceptor };
259
+ export type { LoginRequest, RefreshTokenRequest, RegisterRequest };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@acontplus/ng-auth",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Acontplus Angular Authentication Module",
5
5
  "dependencies": {
6
- "@acontplus/ng-infrastructure": "^1.0.1",
7
- "@acontplus/ng-config": "^1.0.1",
6
+ "@acontplus/ng-infrastructure": "^1.0.4",
7
+ "@acontplus/ng-config": "^1.0.3",
8
8
  "jwt-decode": "^4.0.0",
9
9
  "rxjs": "^7.8.1",
10
10
  "tslib": "^2.3.0"