@flusys/ng-auth 1.1.0-beta → 2.0.0-rc.0
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 +319 -19
- package/fesm2022/flusys-ng-auth.mjs +1149 -1692
- package/fesm2022/flusys-ng-auth.mjs.map +1 -1
- package/package.json +4 -4
- package/types/flusys-ng-auth.d.ts +165 -647
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IMessageResponse, ApiResourceService, ISingleResponse,
|
|
1
|
+
import { IMessageResponse, ApiResourceService, ISingleResponse, ICompanyApiProvider, IListResponse, ICompanyBasicInfo, IAuthStateProvider, IUserPermissionProvider, IUserProvider, IUserBasicInfo, IProfileRoleInfo, IProfileActionInfo, UploadFileFn } from '@flusys/ng-shared';
|
|
2
2
|
import * as rxjs from 'rxjs';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import * as _angular_core from '@angular/core';
|
|
5
|
-
import { Signal, Provider
|
|
5
|
+
import { Signal, Provider } from '@angular/core';
|
|
6
6
|
import { HttpClient, HttpRequest, HttpHandlerFn, HttpEvent } from '@angular/common/http';
|
|
7
7
|
import { CanActivateFn, Routes } from '@angular/router';
|
|
8
8
|
import { ILayoutAuthApi, ICompanyInfo as ICompanyInfo$1, IBranchInfo as IBranchInfo$1, ILayoutAuthState, IUserInfo as IUserInfo$1 } from '@flusys/ng-layout';
|
|
@@ -10,17 +10,10 @@ import * as _angular_forms_signals from '@angular/forms/signals';
|
|
|
10
10
|
import * as _flusys_ng_auth from '@flusys/ng-auth';
|
|
11
11
|
import * as _flusys_ng_core from '@flusys/ng-core';
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* Login Request Interface
|
|
15
|
-
*/
|
|
16
13
|
interface ILoginRequest {
|
|
17
14
|
email: string;
|
|
18
15
|
password: string;
|
|
19
16
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Registration Request Interface
|
|
22
|
-
* Supports both simple registration and company-based registration
|
|
23
|
-
*/
|
|
24
17
|
interface IRegistrationRequest {
|
|
25
18
|
name: string;
|
|
26
19
|
email: string;
|
|
@@ -32,33 +25,19 @@ interface IRegistrationRequest {
|
|
|
32
25
|
newCompanyPhone?: string;
|
|
33
26
|
newCompanyAddress?: string;
|
|
34
27
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Select Company & Branch Request Interface
|
|
37
|
-
* Used after login when user needs to select company and branch
|
|
38
|
-
*/
|
|
39
28
|
interface ISelectRequest {
|
|
40
29
|
sessionId: string;
|
|
41
30
|
companyId: string;
|
|
42
31
|
branchId: string;
|
|
43
32
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Switch Company Request Interface
|
|
46
|
-
* Used to switch company/branch after login
|
|
47
|
-
*/
|
|
48
33
|
interface ISwitchCompanyRequest {
|
|
49
34
|
companyId: string;
|
|
50
35
|
branchId: string;
|
|
51
36
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Change Password Request Interface
|
|
54
|
-
*/
|
|
55
37
|
interface IChangePasswordRequest {
|
|
56
38
|
currentPassword: string;
|
|
57
39
|
newPassword: string;
|
|
58
40
|
}
|
|
59
|
-
/**
|
|
60
|
-
* User Info Interface (used in responses)
|
|
61
|
-
*/
|
|
62
41
|
interface IUserInfo {
|
|
63
42
|
id: string;
|
|
64
43
|
email: string;
|
|
@@ -70,84 +49,51 @@ interface IUserInfo {
|
|
|
70
49
|
companyLogoId?: string;
|
|
71
50
|
branchLogoId?: string;
|
|
72
51
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Company Info Interface (used in responses)
|
|
75
|
-
*/
|
|
76
52
|
interface ICompanyInfo {
|
|
77
53
|
id: string;
|
|
78
54
|
name: string;
|
|
79
55
|
slug?: string;
|
|
80
56
|
logoId?: string | null;
|
|
81
57
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Branch Info Interface (used in responses)
|
|
84
|
-
*/
|
|
85
58
|
interface IBranchInfo {
|
|
86
59
|
id: string;
|
|
87
60
|
name: string;
|
|
88
61
|
slug?: string;
|
|
89
62
|
logoId?: string | null;
|
|
90
63
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Branch Selection Info Interface (with additional fields)
|
|
93
|
-
*/
|
|
94
64
|
interface IBranchSelectionInfo {
|
|
95
65
|
id: string;
|
|
96
66
|
name: string;
|
|
97
67
|
slug: string;
|
|
98
|
-
isActive: boolean;
|
|
99
68
|
logoId?: string | null;
|
|
100
69
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Company with Branches Interface (for selection response)
|
|
103
|
-
*/
|
|
104
70
|
interface ICompanyWithBranches {
|
|
105
71
|
id: string;
|
|
106
72
|
name: string;
|
|
107
73
|
slug: string;
|
|
108
|
-
isActive: boolean;
|
|
109
74
|
logoId?: string | null;
|
|
110
75
|
branches: IBranchSelectionInfo[];
|
|
111
76
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Login Response Interface
|
|
114
|
-
* Returned on successful login with tokens
|
|
115
|
-
*/
|
|
116
77
|
interface ILoginResponse {
|
|
117
78
|
accessToken: string;
|
|
118
79
|
refreshToken: string;
|
|
119
80
|
user: IUserInfo;
|
|
120
81
|
company?: ICompanyInfo;
|
|
121
82
|
branch?: IBranchInfo;
|
|
122
|
-
companyFeatureEnabled?: boolean;
|
|
123
83
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Me Response Interface
|
|
126
|
-
* Returned by GET /auth/me endpoint
|
|
127
|
-
* Contains only user data, no tokens
|
|
128
|
-
*/
|
|
129
84
|
interface IMeResponse {
|
|
130
85
|
user: IUserInfo;
|
|
131
86
|
company?: ICompanyInfo;
|
|
132
87
|
branch?: IBranchInfo;
|
|
133
88
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Registration Response Interface
|
|
136
|
-
* Returned on successful registration
|
|
137
|
-
*/
|
|
138
89
|
interface IRegistrationResponse {
|
|
139
90
|
accessToken?: string;
|
|
140
91
|
refreshToken?: string;
|
|
141
92
|
user: IUserInfo;
|
|
142
93
|
company?: ICompanyInfo;
|
|
143
94
|
branch?: IBranchInfo;
|
|
144
|
-
companyFeatureEnabled?: boolean;
|
|
145
95
|
requiresEmailVerification?: boolean;
|
|
146
96
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Company Selection Response Interface
|
|
149
|
-
* Returned when user has multiple companies/branches to choose from
|
|
150
|
-
*/
|
|
151
97
|
interface ICompanySelectionResponse {
|
|
152
98
|
requiresSelection: true;
|
|
153
99
|
sessionId: string;
|
|
@@ -155,41 +101,20 @@ interface ICompanySelectionResponse {
|
|
|
155
101
|
user: IUserInfo;
|
|
156
102
|
companies: ICompanyWithBranches[];
|
|
157
103
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Refresh Token Response Interface
|
|
160
|
-
*/
|
|
161
104
|
interface IRefreshTokenResponse {
|
|
162
105
|
accessToken: string;
|
|
163
106
|
refreshToken?: string;
|
|
164
107
|
}
|
|
165
|
-
/**
|
|
166
|
-
* Login Response when email verification required
|
|
167
|
-
*/
|
|
168
108
|
interface ILoginRequiresEmailVerification {
|
|
169
109
|
requiresEmailVerification: true;
|
|
170
110
|
email: string;
|
|
171
111
|
message: string;
|
|
172
112
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Auth Response Type - Can be login success, company selection, or email verification required
|
|
175
|
-
*/
|
|
176
113
|
type AuthResponse = ILoginResponse | ICompanySelectionResponse | ILoginRequiresEmailVerification;
|
|
177
|
-
/**
|
|
178
|
-
* Type guard to check if response requires email verification
|
|
179
|
-
*/
|
|
180
114
|
declare function isEmailVerificationRequired(response: AuthResponse): response is ILoginRequiresEmailVerification;
|
|
181
|
-
/**
|
|
182
|
-
* Type guard to check if response requires company selection
|
|
183
|
-
*/
|
|
184
115
|
declare function isCompanySelectionResponse(response: AuthResponse): response is ICompanySelectionResponse;
|
|
185
|
-
/**
|
|
186
|
-
* Type guard to check if response is a successful login
|
|
187
|
-
*/
|
|
188
116
|
declare function isLoginResponse(response: AuthResponse): response is ILoginResponse;
|
|
189
117
|
|
|
190
|
-
/**
|
|
191
|
-
* Create Company Branch Request Interface
|
|
192
|
-
*/
|
|
193
118
|
interface ICreateBranchRequest {
|
|
194
119
|
name: string;
|
|
195
120
|
slug: string;
|
|
@@ -203,15 +128,9 @@ interface ICreateBranchRequest {
|
|
|
203
128
|
isActive?: boolean;
|
|
204
129
|
additionalFields?: Record<string, unknown>;
|
|
205
130
|
}
|
|
206
|
-
/**
|
|
207
|
-
* Update Company Branch Request Interface
|
|
208
|
-
*/
|
|
209
131
|
interface IUpdateBranchRequest extends Partial<Omit<ICreateBranchRequest, 'companyId'>> {
|
|
210
132
|
id: string;
|
|
211
133
|
}
|
|
212
|
-
/**
|
|
213
|
-
* Company Branch Response Interface
|
|
214
|
-
*/
|
|
215
134
|
interface IBranch {
|
|
216
135
|
id: string;
|
|
217
136
|
name: string;
|
|
@@ -230,9 +149,6 @@ interface IBranch {
|
|
|
230
149
|
updatedAt: Date | string;
|
|
231
150
|
}
|
|
232
151
|
|
|
233
|
-
/**
|
|
234
|
-
* Create Company Request Interface
|
|
235
|
-
*/
|
|
236
152
|
interface ICreateCompanyRequest {
|
|
237
153
|
name: string;
|
|
238
154
|
slug: string;
|
|
@@ -246,15 +162,9 @@ interface ICreateCompanyRequest {
|
|
|
246
162
|
settings?: Record<string, unknown>;
|
|
247
163
|
additionalFields?: Record<string, unknown>;
|
|
248
164
|
}
|
|
249
|
-
/**
|
|
250
|
-
* Update Company Request Interface
|
|
251
|
-
*/
|
|
252
165
|
interface IUpdateCompanyRequest extends Partial<ICreateCompanyRequest> {
|
|
253
166
|
id: string;
|
|
254
167
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Company Response Interface
|
|
257
|
-
*/
|
|
258
168
|
interface ICompany {
|
|
259
169
|
id: string;
|
|
260
170
|
name: string;
|
|
@@ -273,88 +183,48 @@ interface ICompany {
|
|
|
273
183
|
updatedAt: Date | string;
|
|
274
184
|
}
|
|
275
185
|
|
|
276
|
-
/**
|
|
277
|
-
* Permission item for batch assignment/revocation
|
|
278
|
-
*/
|
|
279
186
|
interface IPermissionItem {
|
|
280
|
-
/** Target ID (Company ID or Branch ID) */
|
|
281
187
|
targetId: string;
|
|
282
|
-
/** Action: true to add permission, false to remove permission */
|
|
283
188
|
isAdd: boolean;
|
|
284
189
|
}
|
|
285
|
-
/**
|
|
286
|
-
* Batch assign/revoke user-company permissions request
|
|
287
|
-
*/
|
|
288
190
|
interface IAssignUserCompanyRequest {
|
|
289
|
-
/** User ID to assign/revoke permissions for */
|
|
290
191
|
userId: string;
|
|
291
|
-
/** List of company permissions to add or remove */
|
|
292
192
|
items: IPermissionItem[];
|
|
293
193
|
}
|
|
294
|
-
/**
|
|
295
|
-
* Batch assign/revoke user-branch permissions request
|
|
296
|
-
*/
|
|
297
194
|
interface IAssignUserBranchRequest {
|
|
298
|
-
/** User ID to assign/revoke permissions for */
|
|
299
195
|
userId: string;
|
|
300
|
-
/** List of branch permissions to add or remove */
|
|
301
196
|
items: IPermissionItem[];
|
|
302
197
|
}
|
|
303
|
-
/**
|
|
304
|
-
* User company permission with populated company details
|
|
305
|
-
*/
|
|
306
198
|
interface IUserCompanyPermission {
|
|
307
|
-
/** Permission ID */
|
|
308
199
|
id: string;
|
|
309
|
-
/** User ID */
|
|
310
200
|
userId: string;
|
|
311
|
-
/** Company ID */
|
|
312
201
|
companyId: string;
|
|
313
|
-
/** Company name */
|
|
314
202
|
companyName: string;
|
|
315
|
-
/** Company slug */
|
|
316
203
|
companySlug: string;
|
|
317
204
|
}
|
|
318
|
-
/**
|
|
319
|
-
* User branch permission with populated branch details
|
|
320
|
-
*/
|
|
321
205
|
interface IUserBranchPermission {
|
|
322
|
-
/** Permission ID */
|
|
323
206
|
id: string;
|
|
324
|
-
/** User ID */
|
|
325
207
|
userId: string;
|
|
326
|
-
/** Branch ID */
|
|
327
208
|
branchId: string;
|
|
328
|
-
/** Branch name */
|
|
329
209
|
branchName: string;
|
|
330
|
-
/** Branch slug */
|
|
331
210
|
branchSlug: string;
|
|
332
|
-
/** Company ID this branch belongs to */
|
|
333
211
|
companyId: string;
|
|
334
212
|
}
|
|
335
|
-
/**
|
|
336
|
-
* Response for user companies
|
|
337
|
-
*/
|
|
338
213
|
interface IUserCompaniesResponse {
|
|
214
|
+
success: boolean;
|
|
215
|
+
message: string;
|
|
339
216
|
data: IUserCompanyPermission[];
|
|
340
217
|
}
|
|
341
|
-
/**
|
|
342
|
-
* Response for user branches
|
|
343
|
-
*/
|
|
344
218
|
interface IUserBranchesResponse {
|
|
219
|
+
success: boolean;
|
|
220
|
+
message: string;
|
|
345
221
|
data: IUserBranchPermission[];
|
|
346
222
|
}
|
|
347
|
-
/**
|
|
348
|
-
* Batch operation result response
|
|
349
|
-
*/
|
|
350
223
|
interface IBatchOperationResponse {
|
|
351
224
|
success: boolean;
|
|
352
225
|
message: string;
|
|
353
226
|
}
|
|
354
227
|
|
|
355
|
-
/**
|
|
356
|
-
* Create User Request Interface
|
|
357
|
-
*/
|
|
358
228
|
interface ICreateUserRequest {
|
|
359
229
|
name: string;
|
|
360
230
|
email: string;
|
|
@@ -366,14 +236,12 @@ interface ICreateUserRequest {
|
|
|
366
236
|
phoneVerified?: boolean;
|
|
367
237
|
additionalFields?: Record<string, unknown>;
|
|
368
238
|
}
|
|
369
|
-
/**
|
|
370
|
-
* Update User Request Interface
|
|
371
|
-
*/
|
|
372
239
|
interface IUpdateUserRequest {
|
|
373
240
|
id: string;
|
|
374
241
|
name?: string;
|
|
375
242
|
email?: string;
|
|
376
243
|
password?: string;
|
|
244
|
+
oldPassword?: string;
|
|
377
245
|
phone?: string;
|
|
378
246
|
profilePictureId?: string;
|
|
379
247
|
isActive?: boolean;
|
|
@@ -381,9 +249,6 @@ interface IUpdateUserRequest {
|
|
|
381
249
|
phoneVerified?: boolean;
|
|
382
250
|
additionalFields?: Record<string, unknown>;
|
|
383
251
|
}
|
|
384
|
-
/**
|
|
385
|
-
* User Response Interface
|
|
386
|
-
*/
|
|
387
252
|
interface IUser {
|
|
388
253
|
id: string;
|
|
389
254
|
name: string;
|
|
@@ -519,29 +384,54 @@ declare class AuthInitService {
|
|
|
519
384
|
declare class AuthStateService {
|
|
520
385
|
private readonly appConfig;
|
|
521
386
|
private readonly router;
|
|
522
|
-
readonly
|
|
523
|
-
readonly
|
|
524
|
-
readonly
|
|
525
|
-
readonly
|
|
526
|
-
readonly
|
|
527
|
-
readonly
|
|
528
|
-
readonly
|
|
387
|
+
private readonly platform;
|
|
388
|
+
private readonly _user;
|
|
389
|
+
private readonly _accessToken;
|
|
390
|
+
private readonly _tokenExpiresAt;
|
|
391
|
+
private readonly _company;
|
|
392
|
+
private readonly _branch;
|
|
393
|
+
readonly user: _angular_core.Signal<IUserInfo | null>;
|
|
394
|
+
readonly accessToken: _angular_core.Signal<string>;
|
|
395
|
+
readonly tokenExpiresAt: _angular_core.Signal<number | null>;
|
|
396
|
+
readonly company: _angular_core.Signal<ICompanyInfo | null>;
|
|
397
|
+
readonly branch: _angular_core.Signal<IBranchInfo | null>;
|
|
398
|
+
private readonly _selectionSessionId;
|
|
399
|
+
private readonly _availableCompanies;
|
|
400
|
+
private readonly _selectionExpiresAt;
|
|
401
|
+
readonly selectionSessionId: _angular_core.Signal<string | null>;
|
|
402
|
+
readonly availableCompanies: _angular_core.Signal<ICompanyWithBranches[]>;
|
|
529
403
|
readonly isAuthenticated: _angular_core.Signal<boolean>;
|
|
530
404
|
readonly requiresCompanySelection: _angular_core.Signal<boolean>;
|
|
531
405
|
readonly userName: _angular_core.Signal<string>;
|
|
532
406
|
readonly companyName: _angular_core.Signal<string>;
|
|
533
407
|
readonly branchName: _angular_core.Signal<string>;
|
|
408
|
+
/**
|
|
409
|
+
* Check if token is expired or will expire soon (within 30 seconds).
|
|
410
|
+
* Used to proactively refresh token before requests fail.
|
|
411
|
+
*/
|
|
412
|
+
readonly isTokenExpired: _angular_core.Signal<boolean>;
|
|
534
413
|
readonly tenantId: _angular_core.Signal<string | null>;
|
|
535
414
|
constructor();
|
|
536
415
|
setLoginState(response: ILoginResponse): void;
|
|
537
416
|
setSelectionState(response: ICompanySelectionResponse): void;
|
|
538
417
|
clearSelectionState(): void;
|
|
539
418
|
resetState(): void;
|
|
419
|
+
setUser(user: IUserInfo | null): void;
|
|
420
|
+
setAccessToken(token: string): void;
|
|
421
|
+
setCompany(company: ICompanyInfo | null): void;
|
|
422
|
+
setBranch(branch: IBranchInfo | null): void;
|
|
540
423
|
navigateToLogin(returnUrl?: string): void;
|
|
541
424
|
navigateAfterLogin(returnUrl?: string): void;
|
|
425
|
+
/** Validates a return URL to prevent open redirect attacks */
|
|
426
|
+
private isValidReturnUrl;
|
|
542
427
|
getStoredCompanyId(): string | null;
|
|
543
428
|
getStoredBranchId(): string | null;
|
|
544
429
|
private loadFromStorage;
|
|
430
|
+
/**
|
|
431
|
+
* Decode JWT expiry without verification (client-side only).
|
|
432
|
+
* Returns expiry timestamp in milliseconds.
|
|
433
|
+
*/
|
|
434
|
+
private decodeTokenExpiry;
|
|
545
435
|
private store;
|
|
546
436
|
private get;
|
|
547
437
|
private remove;
|
|
@@ -552,45 +442,11 @@ declare class AuthStateService {
|
|
|
552
442
|
/**
|
|
553
443
|
* Branch API Service
|
|
554
444
|
* Signal-based service for branch CRUD operations
|
|
555
|
-
* Branches default to current company context
|
|
556
|
-
*
|
|
557
|
-
* @example
|
|
558
|
-
* ```typescript
|
|
559
|
-
* branchService = inject(BranchApiService);
|
|
560
|
-
*
|
|
561
|
-
* // Set current company context
|
|
562
|
-
* branchService.setCurrentCompanyId('company-uuid');
|
|
563
|
-
*
|
|
564
|
-
* // Access data via signals
|
|
565
|
-
* branches = this.branchService.data;
|
|
566
|
-
* isLoading = this.branchService.isLoading;
|
|
567
|
-
*
|
|
568
|
-
* // Fetch branches (will filter by current company)
|
|
569
|
-
* this.branchService.fetchList('search');
|
|
570
|
-
*
|
|
571
|
-
* // Create branch (companyId will be auto-set if not provided)
|
|
572
|
-
* await this.branchService.insertBranch({ name: 'New Branch', slug: 'new-branch' });
|
|
573
|
-
* ```
|
|
574
445
|
*/
|
|
575
446
|
declare class BranchApiService extends ApiResourceService<ICreateBranchRequest | IUpdateBranchRequest, IBranch> {
|
|
576
|
-
|
|
577
|
-
readonly currentCompanyId: _angular_core.WritableSignal<string | null>;
|
|
578
|
-
/** Branches filtered by current company */
|
|
579
|
-
readonly companyBranches: _angular_core.Signal<IBranch[]>;
|
|
447
|
+
private readonly _currentCompanyId;
|
|
580
448
|
constructor(http: HttpClient);
|
|
581
|
-
/**
|
|
582
|
-
* Set the current company context for branch operations
|
|
583
|
-
*/
|
|
584
449
|
setCurrentCompanyId(companyId: string | null): void;
|
|
585
|
-
/**
|
|
586
|
-
* Insert a new branch, auto-setting companyId if not provided
|
|
587
|
-
*/
|
|
588
|
-
insertBranch(data: Omit<ICreateBranchRequest, 'companyId'> & {
|
|
589
|
-
companyId?: string;
|
|
590
|
-
}): Promise<ReturnType<typeof this.insertAsync>>;
|
|
591
|
-
/**
|
|
592
|
-
* Fetch branches for a specific company
|
|
593
|
-
*/
|
|
594
450
|
fetchByCompany(companyId: string, search?: string): void;
|
|
595
451
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BranchApiService, never>;
|
|
596
452
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<BranchApiService>;
|
|
@@ -599,21 +455,6 @@ declare class BranchApiService extends ApiResourceService<ICreateBranchRequest |
|
|
|
599
455
|
/**
|
|
600
456
|
* Company API Service
|
|
601
457
|
* Signal-based service for company CRUD operations
|
|
602
|
-
*
|
|
603
|
-
* @example
|
|
604
|
-
* ```typescript
|
|
605
|
-
* companyService = inject(CompanyApiService);
|
|
606
|
-
*
|
|
607
|
-
* // Access data via signals
|
|
608
|
-
* companies = this.companyService.data;
|
|
609
|
-
* isLoading = this.companyService.isLoading;
|
|
610
|
-
*
|
|
611
|
-
* // Fetch companies
|
|
612
|
-
* this.companyService.fetchList('search', { pagination: { currentPage: 0, pageSize: 10 } });
|
|
613
|
-
*
|
|
614
|
-
* // Create company
|
|
615
|
-
* await this.companyService.insertAsync({ name: 'New Company', slug: 'new-company' });
|
|
616
|
-
* ```
|
|
617
458
|
*/
|
|
618
459
|
declare class CompanyApiService extends ApiResourceService<ICreateCompanyRequest | IUpdateCompanyRequest, ICompany> {
|
|
619
460
|
constructor(http: HttpClient);
|
|
@@ -623,40 +464,16 @@ declare class CompanyApiService extends ApiResourceService<ICreateCompanyRequest
|
|
|
623
464
|
|
|
624
465
|
/**
|
|
625
466
|
* Token Refresh State Service
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
* Replaces module-level state that would be shared across requests in SSR.
|
|
629
|
-
*
|
|
630
|
-
* @example
|
|
631
|
-
* ```typescript
|
|
632
|
-
* const refreshState = inject(TokenRefreshStateService);
|
|
633
|
-
*
|
|
634
|
-
* if (refreshState.isRefreshing()) {
|
|
635
|
-
* // Queue request
|
|
636
|
-
* } else {
|
|
637
|
-
* refreshState.startRefresh();
|
|
638
|
-
* // Perform refresh
|
|
639
|
-
* }
|
|
640
|
-
* ```
|
|
467
|
+
* Manages token refresh state for SSR-safe request queuing.
|
|
468
|
+
* Uses BehaviorSubject for RxJS interop (multi-subscriber async coordination).
|
|
641
469
|
*/
|
|
642
470
|
declare class TokenRefreshStateService {
|
|
643
|
-
/** Flag to track if token refresh is in progress */
|
|
644
471
|
private readonly _isRefreshing;
|
|
645
472
|
readonly isRefreshing: _angular_core.Signal<boolean>;
|
|
646
|
-
/** Subject to queue requests while refreshing */
|
|
647
473
|
private readonly _refreshTokenSubject;
|
|
648
474
|
readonly refreshTokenSubject$: rxjs.Observable<string | null>;
|
|
649
|
-
/**
|
|
650
|
-
* Mark refresh as started
|
|
651
|
-
*/
|
|
652
475
|
startRefresh(): void;
|
|
653
|
-
/**
|
|
654
|
-
* Mark refresh as completed and broadcast new token
|
|
655
|
-
*/
|
|
656
476
|
completeRefresh(newToken: string): void;
|
|
657
|
-
/**
|
|
658
|
-
* Mark refresh as failed
|
|
659
|
-
*/
|
|
660
477
|
failRefresh(): void;
|
|
661
478
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TokenRefreshStateService, never>;
|
|
662
479
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<TokenRefreshStateService>;
|
|
@@ -665,43 +482,9 @@ declare class TokenRefreshStateService {
|
|
|
665
482
|
/**
|
|
666
483
|
* User API Service
|
|
667
484
|
* Signal-based service for user CRUD operations
|
|
668
|
-
*
|
|
669
|
-
* @example
|
|
670
|
-
* ```typescript
|
|
671
|
-
* userService = inject(UserApiService);
|
|
672
|
-
*
|
|
673
|
-
* // Access data via signals
|
|
674
|
-
* users = this.userService.data;
|
|
675
|
-
* isLoading = this.userService.isLoading;
|
|
676
|
-
*
|
|
677
|
-
* // Fetch users
|
|
678
|
-
* this.userService.fetchList('search', { pagination: { currentPage: 0, pageSize: 10 } });
|
|
679
|
-
*
|
|
680
|
-
* // Create user
|
|
681
|
-
* await this.userService.insertAsync({
|
|
682
|
-
* name: 'John Doe',
|
|
683
|
-
* email: 'john@example.com',
|
|
684
|
-
* password: 'password123'
|
|
685
|
-
* });
|
|
686
|
-
* ```
|
|
687
485
|
*/
|
|
688
486
|
declare class UserApiService extends ApiResourceService<ICreateUserRequest | IUpdateUserRequest, IUser> {
|
|
689
487
|
constructor(http: HttpClient);
|
|
690
|
-
/**
|
|
691
|
-
* Verify user's email
|
|
692
|
-
*/
|
|
693
|
-
verifyEmail(userId: string): Observable<IMessageResponse>;
|
|
694
|
-
/**
|
|
695
|
-
* Verify user's phone
|
|
696
|
-
*/
|
|
697
|
-
verifyPhone(userId: string): Observable<IMessageResponse>;
|
|
698
|
-
/**
|
|
699
|
-
* Update user status (active/inactive)
|
|
700
|
-
*/
|
|
701
|
-
updateStatus(userId: string, isActive: boolean): Observable<IMessageResponse>;
|
|
702
|
-
/**
|
|
703
|
-
* Update current user's profile
|
|
704
|
-
*/
|
|
705
488
|
updateProfile(data: IUpdateUserRequest): Observable<ISingleResponse<IUser>>;
|
|
706
489
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserApiService, never>;
|
|
707
490
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<UserApiService>;
|
|
@@ -709,167 +492,29 @@ declare class UserApiService extends ApiResourceService<ICreateUserRequest | IUp
|
|
|
709
492
|
|
|
710
493
|
/**
|
|
711
494
|
* User Permission API Service
|
|
712
|
-
*
|
|
713
495
|
* Handles user-company and user-branch permission assignments.
|
|
714
|
-
* Uses batch operations for efficient permission management.
|
|
715
|
-
*
|
|
716
|
-
* Backend Endpoints:
|
|
717
|
-
* - POST /administration/permissions/user-company/assign - Batch assign/revoke company permissions
|
|
718
|
-
* - GET /administration/permissions/user-company?userId=xxx - Get user's companies
|
|
719
|
-
* - POST /administration/permissions/user-branch/assign - Batch assign/revoke branch permissions
|
|
720
|
-
* - GET /administration/permissions/user-branch?userId=xxx - Get user's branches
|
|
721
496
|
*/
|
|
722
497
|
declare class UserPermissionApiService {
|
|
723
498
|
private readonly appConfig;
|
|
724
499
|
private readonly http;
|
|
725
500
|
private readonly baseUrl;
|
|
726
|
-
constructor();
|
|
727
|
-
/**
|
|
728
|
-
* Batch assign/revoke user-company permissions
|
|
729
|
-
*
|
|
730
|
-
* @example
|
|
731
|
-
* // Add company permissions
|
|
732
|
-
* service.assignUserCompanies({
|
|
733
|
-
* userId: 'user-id',
|
|
734
|
-
* items: [
|
|
735
|
-
* { targetId: 'company-1', isAdd: true },
|
|
736
|
-
* { targetId: 'company-2', isAdd: true }
|
|
737
|
-
* ]
|
|
738
|
-
* });
|
|
739
|
-
*
|
|
740
|
-
* @example
|
|
741
|
-
* // Remove company permissions
|
|
742
|
-
* service.assignUserCompanies({
|
|
743
|
-
* userId: 'user-id',
|
|
744
|
-
* items: [
|
|
745
|
-
* { targetId: 'company-1', isAdd: false }
|
|
746
|
-
* ]
|
|
747
|
-
* });
|
|
748
|
-
*/
|
|
749
501
|
assignUserCompanies(data: IAssignUserCompanyRequest): Observable<IBatchOperationResponse>;
|
|
750
|
-
/**
|
|
751
|
-
* Assign single company to user (convenience method)
|
|
752
|
-
*/
|
|
753
502
|
assignUserToCompany(userId: string, companyId: string): Observable<IBatchOperationResponse>;
|
|
754
|
-
/**
|
|
755
|
-
* Revoke single company from user (convenience method)
|
|
756
|
-
*/
|
|
757
503
|
revokeUserFromCompany(userId: string, companyId: string): Observable<IBatchOperationResponse>;
|
|
758
|
-
/**
|
|
759
|
-
* Get user's company permissions
|
|
760
|
-
*
|
|
761
|
-
* @param userId - User ID to get companies for
|
|
762
|
-
* @returns Observable with user's company permissions
|
|
763
|
-
*/
|
|
764
504
|
getUserCompanies(userId: string): Observable<IUserCompaniesResponse>;
|
|
765
|
-
/**
|
|
766
|
-
* Batch assign/revoke user-branch permissions
|
|
767
|
-
*
|
|
768
|
-
* @example
|
|
769
|
-
* // Add branch permissions
|
|
770
|
-
* service.assignUserBranches({
|
|
771
|
-
* userId: 'user-id',
|
|
772
|
-
* items: [
|
|
773
|
-
* { targetId: 'branch-1', isAdd: true },
|
|
774
|
-
* { targetId: 'branch-2', isAdd: true }
|
|
775
|
-
* ]
|
|
776
|
-
* });
|
|
777
|
-
*
|
|
778
|
-
* @example
|
|
779
|
-
* // Remove branch permissions
|
|
780
|
-
* service.assignUserBranches({
|
|
781
|
-
* userId: 'user-id',
|
|
782
|
-
* items: [
|
|
783
|
-
* { targetId: 'branch-1', isAdd: false }
|
|
784
|
-
* ]
|
|
785
|
-
* });
|
|
786
|
-
*/
|
|
787
505
|
assignUserBranches(data: IAssignUserBranchRequest): Observable<IBatchOperationResponse>;
|
|
788
|
-
/**
|
|
789
|
-
* Assign single branch to user (convenience method)
|
|
790
|
-
*/
|
|
791
506
|
assignUserToBranch(userId: string, branchId: string): Observable<IBatchOperationResponse>;
|
|
792
|
-
/**
|
|
793
|
-
* Revoke single branch from user (convenience method)
|
|
794
|
-
*/
|
|
795
507
|
revokeUserFromBranch(userId: string, branchId: string): Observable<IBatchOperationResponse>;
|
|
796
|
-
|
|
797
|
-
* Get user's branch permissions
|
|
798
|
-
*
|
|
799
|
-
* @param userId - User ID to get branches for
|
|
800
|
-
* @returns Observable with user's branch permissions
|
|
801
|
-
*/
|
|
802
|
-
getUserBranches(userId: string): Observable<IUserBranchesResponse>;
|
|
508
|
+
getUserBranches(userId: string, companyId?: string): Observable<IUserBranchesResponse>;
|
|
803
509
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserPermissionApiService, never>;
|
|
804
510
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<UserPermissionApiService>;
|
|
805
511
|
}
|
|
806
512
|
|
|
807
|
-
/**
|
|
808
|
-
* Auth Guard
|
|
809
|
-
* Protects routes that require authentication.
|
|
810
|
-
*
|
|
811
|
-
* Session restoration is handled by guestGuard. This guard assumes
|
|
812
|
-
* the session has already been restored if user accessed login page first.
|
|
813
|
-
*
|
|
814
|
-
* Handles company feature:
|
|
815
|
-
* - If company feature enabled and no company selected, redirects to login
|
|
816
|
-
* (login page handles company selection as step 2)
|
|
817
|
-
* - If not authenticated, redirects to login
|
|
818
|
-
*
|
|
819
|
-
* @example
|
|
820
|
-
* ```typescript
|
|
821
|
-
* // In routes configuration
|
|
822
|
-
* {
|
|
823
|
-
* path: 'dashboard',
|
|
824
|
-
* loadComponent: () => import('./dashboard.component'),
|
|
825
|
-
* canActivate: [authGuard]
|
|
826
|
-
* }
|
|
827
|
-
* ```
|
|
828
|
-
*/
|
|
513
|
+
/** Protects routes requiring authentication */
|
|
829
514
|
declare const authGuard: CanActivateFn;
|
|
830
|
-
/**
|
|
831
|
-
* Guest Guard
|
|
832
|
-
* Protects auth routes (login, register) from authenticated users.
|
|
833
|
-
* Redirects authenticated users to home page.
|
|
834
|
-
*
|
|
835
|
-
* CRITICAL: Unlike old implementation, this guard RESTORES the session first
|
|
836
|
-
* before checking authentication. This handles the case when users directly
|
|
837
|
-
* navigate to /auth/login via browser URL while having valid refresh token.
|
|
838
|
-
*
|
|
839
|
-
* Flow:
|
|
840
|
-
* 1. Restore session (if needed) via AuthInitService.initialize()
|
|
841
|
-
* 2. Check if user is authenticated
|
|
842
|
-
* 3. If authenticated -> redirect to dashboard
|
|
843
|
-
* 4. If not authenticated -> allow access to login page
|
|
844
|
-
*
|
|
845
|
-
* @example
|
|
846
|
-
* ```typescript
|
|
847
|
-
* // In routes configuration
|
|
848
|
-
* {
|
|
849
|
-
* path: 'auth/login',
|
|
850
|
-
* loadComponent: () => import('./login.component'),
|
|
851
|
-
* canActivate: [guestGuard]
|
|
852
|
-
* }
|
|
853
|
-
* ```
|
|
854
|
-
*/
|
|
515
|
+
/** Protects auth routes from authenticated users, restores session first */
|
|
855
516
|
declare const guestGuard: CanActivateFn;
|
|
856
|
-
/**
|
|
857
|
-
* Company Feature Guard
|
|
858
|
-
* Protects routes that require company feature to be enabled.
|
|
859
|
-
* Redirects to home if company feature is disabled.
|
|
860
|
-
*
|
|
861
|
-
* Use this guard on company/branch management routes.
|
|
862
|
-
*
|
|
863
|
-
* @example
|
|
864
|
-
* ```typescript
|
|
865
|
-
* // In routes configuration
|
|
866
|
-
* {
|
|
867
|
-
* path: 'administration/company',
|
|
868
|
-
* loadComponent: () => import('./company-list.component'),
|
|
869
|
-
* canActivate: [authGuard, companyFeatureGuard]
|
|
870
|
-
* }
|
|
871
|
-
* ```
|
|
872
|
-
*/
|
|
517
|
+
/** Protects routes requiring company feature to be enabled */
|
|
873
518
|
declare const companyFeatureGuard: CanActivateFn;
|
|
874
519
|
|
|
875
520
|
/**
|
|
@@ -877,26 +522,7 @@ declare const companyFeatureGuard: CanActivateFn;
|
|
|
877
522
|
*/
|
|
878
523
|
declare function authInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
|
|
879
524
|
|
|
880
|
-
/**
|
|
881
|
-
* Token Refresh Interceptor
|
|
882
|
-
* Handles 401 errors by refreshing the access token.
|
|
883
|
-
*
|
|
884
|
-
* - Intercepts 401 Unauthorized responses
|
|
885
|
-
* - Calls refresh token endpoint
|
|
886
|
-
* - Retries failed request with new token
|
|
887
|
-
* - Queues concurrent requests during refresh
|
|
888
|
-
* - Redirects to login on refresh failure
|
|
889
|
-
* - SSR-safe: Uses injectable service instead of module-level state
|
|
890
|
-
*
|
|
891
|
-
* @example
|
|
892
|
-
* ```typescript
|
|
893
|
-
* // In app.config.ts
|
|
894
|
-
* provideHttpClient(
|
|
895
|
-
* withFetch(),
|
|
896
|
-
* withInterceptors([authInterceptor, tokenRefreshInterceptor])
|
|
897
|
-
* )
|
|
898
|
-
* ```
|
|
899
|
-
*/
|
|
525
|
+
/** Token Refresh Interceptor - Proactive and reactive token refresh with request queuing */
|
|
900
526
|
declare function tokenRefreshInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
|
|
901
527
|
|
|
902
528
|
/**
|
|
@@ -919,86 +545,49 @@ declare const ADMINISTRATION_ROUTES: Routes;
|
|
|
919
545
|
declare const PROFILE_ROUTES: Routes;
|
|
920
546
|
|
|
921
547
|
/**
|
|
922
|
-
* Auth Layout
|
|
923
|
-
*
|
|
924
|
-
*
|
|
548
|
+
* Auth Layout Provider Adapters
|
|
549
|
+
*
|
|
550
|
+
* Implements provider interfaces from ng-layout using ng-auth services.
|
|
551
|
+
* Bridges auth state and API to layout components.
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* // In app.config.ts
|
|
555
|
+
* import { provideAuthLayoutIntegration } from '@flusys/ng-auth';
|
|
556
|
+
* providers: [...provideAuthLayoutIntegration()]
|
|
925
557
|
*/
|
|
926
558
|
declare class AuthLayoutStateAdapter implements ILayoutAuthState {
|
|
927
559
|
private readonly authState;
|
|
928
|
-
/**
|
|
929
|
-
* Maps company info to company info for layout.
|
|
930
|
-
* Falls back to app name from config when no company is selected.
|
|
931
|
-
*/
|
|
932
560
|
readonly currentCompanyInfo: Signal<ICompanyInfo$1 | null>;
|
|
933
|
-
/**
|
|
934
|
-
* Maps branch info to branch info for layout.
|
|
935
|
-
* Returns null when no branch is selected.
|
|
936
|
-
*/
|
|
937
561
|
readonly currentBranchInfo: Signal<IBranchInfo$1 | null>;
|
|
938
|
-
/**
|
|
939
|
-
* Maps user info from auth state to layout user info.
|
|
940
|
-
* Profile picture URL is managed separately by AuthLayoutSyncService via FileUrlService.
|
|
941
|
-
*/
|
|
942
562
|
readonly loginUserData: Signal<IUserInfo$1 | null>;
|
|
943
563
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthLayoutStateAdapter, never>;
|
|
944
564
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthLayoutStateAdapter>;
|
|
945
565
|
}
|
|
946
|
-
/**
|
|
947
|
-
* Auth Layout API Adapter
|
|
948
|
-
* Bridges AuthApiService to ILayoutAuthApi interface.
|
|
949
|
-
* Handles logout and navigation for layout components.
|
|
950
|
-
*/
|
|
951
566
|
declare class AuthLayoutApiAdapter implements ILayoutAuthApi {
|
|
952
567
|
private readonly authApi;
|
|
953
568
|
private readonly authState;
|
|
954
569
|
private readonly permissionApi;
|
|
955
570
|
private readonly router;
|
|
956
|
-
/**
|
|
957
|
-
* Logout the current user.
|
|
958
|
-
* Calls backend logout endpoint and resets local auth state.
|
|
959
|
-
* Auth state reset handles clearing all localStorage including company/branch.
|
|
960
|
-
*/
|
|
961
571
|
logOut(): Observable<any>;
|
|
962
|
-
/**
|
|
963
|
-
* Navigate to login page.
|
|
964
|
-
* Optionally preserves current URL as return URL.
|
|
965
|
-
*/
|
|
966
572
|
navigateLogin(withUrl?: boolean): void;
|
|
967
|
-
/**
|
|
968
|
-
* Switch to a different company and branch.
|
|
969
|
-
* Calls backend switch endpoint, then triggers full page reload to
|
|
970
|
-
* refresh permissions, reset component state, and re-filter all data.
|
|
971
|
-
*/
|
|
972
573
|
switchCompany(companyId: string, branchId: string): Observable<any>;
|
|
973
|
-
/**
|
|
974
|
-
* Get list of companies the logged-in user has permissions for.
|
|
975
|
-
* Uses permission API to filter by user's actual company-level permissions.
|
|
976
|
-
*/
|
|
977
574
|
getUserCompanies(): Observable<ICompanyInfo$1[]>;
|
|
978
|
-
/**
|
|
979
|
-
* Get branches for a specific company that the logged-in user has access to.
|
|
980
|
-
* Fetches all user branches and filters by companyId.
|
|
981
|
-
*/
|
|
982
575
|
getCompanyBranches(companyId: string): Observable<IBranchInfo$1[]>;
|
|
983
576
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthLayoutApiAdapter, never>;
|
|
984
577
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthLayoutApiAdapter>;
|
|
985
578
|
}
|
|
986
579
|
|
|
987
580
|
/**
|
|
988
|
-
* Auth
|
|
581
|
+
* Auth Shared Provider Adapters
|
|
989
582
|
*
|
|
990
|
-
* Implements
|
|
991
|
-
*
|
|
583
|
+
* Implements provider interfaces from ng-shared using ng-auth services.
|
|
584
|
+
* Allows IAM, Storage, and Form-Builder packages to access auth data
|
|
585
|
+
* without depending on ng-auth directly.
|
|
992
586
|
*
|
|
993
587
|
* @example
|
|
994
588
|
* // In app.config.ts
|
|
995
|
-
*
|
|
996
|
-
*
|
|
997
|
-
* ]
|
|
998
|
-
*
|
|
999
|
-
* // In IAM component
|
|
1000
|
-
* private readonly userProvider = inject(USER_PROVIDER);
|
|
1001
|
-
* this.userProvider.getUsers({ page: 0, pageSize: 50 }).subscribe(...);
|
|
589
|
+
* import { provideAuthProviders } from '@flusys/ng-auth';
|
|
590
|
+
* providers: [...provideAuthProviders()]
|
|
1002
591
|
*/
|
|
1003
592
|
declare class AuthUserProviderAdapter implements IUserProvider {
|
|
1004
593
|
private readonly userApi;
|
|
@@ -1014,19 +603,6 @@ declare class AuthUserProviderAdapter implements IUserProvider {
|
|
|
1014
603
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthUserProviderAdapter, never>;
|
|
1015
604
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthUserProviderAdapter>;
|
|
1016
605
|
}
|
|
1017
|
-
|
|
1018
|
-
/**
|
|
1019
|
-
* Auth Company API Provider Adapter
|
|
1020
|
-
*
|
|
1021
|
-
* Implements ICompanyApiProvider interface from ng-shared using CompanyApiService.
|
|
1022
|
-
* Allows IAM package to access company data without depending on ng-auth directly.
|
|
1023
|
-
*
|
|
1024
|
-
* @example
|
|
1025
|
-
* // In app.config.ts
|
|
1026
|
-
* providers: [
|
|
1027
|
-
* { provide: COMPANY_API_PROVIDER, useClass: AuthCompanyApiProviderAdapter }
|
|
1028
|
-
* ]
|
|
1029
|
-
*/
|
|
1030
606
|
declare class AuthCompanyApiProviderAdapter implements ICompanyApiProvider {
|
|
1031
607
|
private readonly companyApi;
|
|
1032
608
|
getCompanies(filter?: {
|
|
@@ -1037,64 +613,25 @@ declare class AuthCompanyApiProviderAdapter implements ICompanyApiProvider {
|
|
|
1037
613
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthCompanyApiProviderAdapter, never>;
|
|
1038
614
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthCompanyApiProviderAdapter>;
|
|
1039
615
|
}
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
* Auth User Permission Provider Adapter
|
|
1043
|
-
*
|
|
1044
|
-
* Implements IUserPermissionProvider interface from ng-shared using UserPermissionApiService.
|
|
1045
|
-
* Allows IAM package to query user permissions without depending on ng-auth directly.
|
|
1046
|
-
*
|
|
1047
|
-
* @example
|
|
1048
|
-
* // In app.config.ts
|
|
1049
|
-
* providers: [
|
|
1050
|
-
* { provide: USER_PERMISSION_PROVIDER, useClass: AuthUserPermissionProviderAdapter }
|
|
1051
|
-
* ]
|
|
1052
|
-
*/
|
|
1053
616
|
declare class AuthUserPermissionProviderAdapter implements IUserPermissionProvider {
|
|
1054
617
|
private readonly userPermissionApi;
|
|
1055
|
-
getUserBranchPermissions(userId: string): Observable<ISingleResponse<any>>;
|
|
618
|
+
getUserBranchPermissions(userId: string, companyId?: string): Observable<ISingleResponse<any>>;
|
|
1056
619
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthUserPermissionProviderAdapter, never>;
|
|
1057
620
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthUserPermissionProviderAdapter>;
|
|
1058
621
|
}
|
|
622
|
+
declare class AuthStateProviderAdapter implements IAuthStateProvider {
|
|
623
|
+
private readonly authState;
|
|
624
|
+
private readonly authInit;
|
|
625
|
+
get isAuthenticated(): Signal<boolean>;
|
|
626
|
+
initialize(): Observable<void>;
|
|
627
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthStateProviderAdapter, never>;
|
|
628
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthStateProviderAdapter>;
|
|
629
|
+
}
|
|
1059
630
|
|
|
1060
|
-
/**
|
|
1061
|
-
* Provides auth layout integration for ng-layout.
|
|
1062
|
-
* Call this in your app.config.ts to integrate ng-auth with ng-layout.
|
|
1063
|
-
*
|
|
1064
|
-
* Also registers LAYOUT_AUTH_STATE since AuthLayoutStateAdapter
|
|
1065
|
-
* implements both ILayoutAuthState and ICompanyContextProvider.
|
|
1066
|
-
*
|
|
1067
|
-
* @example
|
|
1068
|
-
* ```typescript
|
|
1069
|
-
* // In app.config.ts
|
|
1070
|
-
* export const appConfig: ApplicationConfig = {
|
|
1071
|
-
* providers: [
|
|
1072
|
-
* ...provideAuthLayoutIntegration(),
|
|
1073
|
-
* ],
|
|
1074
|
-
* };
|
|
1075
|
-
* ```
|
|
1076
|
-
*/
|
|
631
|
+
/** Provides auth integration for ng-layout */
|
|
1077
632
|
declare function provideAuthLayoutIntegration(): Provider[];
|
|
1078
633
|
|
|
1079
|
-
/**
|
|
1080
|
-
* Provide Auth Provider Adapters
|
|
1081
|
-
*
|
|
1082
|
-
* Registers auth implementations for provider interfaces from ng-shared.
|
|
1083
|
-
* This allows IAM and Storage packages to use auth services without direct dependencies.
|
|
1084
|
-
*
|
|
1085
|
-
* @example
|
|
1086
|
-
* // In app.config.ts
|
|
1087
|
-
* import { provideAuthProviders } from '@flusys/ng-auth';
|
|
1088
|
-
*
|
|
1089
|
-
* export const appConfig: ApplicationConfig = {
|
|
1090
|
-
* providers: [
|
|
1091
|
-
* provideAuthProviders(),
|
|
1092
|
-
* // ... other providers
|
|
1093
|
-
* ]
|
|
1094
|
-
* };
|
|
1095
|
-
*
|
|
1096
|
-
* @returns Array of Angular providers
|
|
1097
|
-
*/
|
|
634
|
+
/** Provides auth implementations for ng-shared provider interfaces */
|
|
1098
635
|
declare function provideAuthProviders(): Provider[];
|
|
1099
636
|
|
|
1100
637
|
/**
|
|
@@ -1102,33 +639,22 @@ declare function provideAuthProviders(): Provider[];
|
|
|
1102
639
|
*
|
|
1103
640
|
* Centralized endpoint definitions to prevent inconsistencies across interceptors
|
|
1104
641
|
* and services. All auth-related endpoints should be referenced from here.
|
|
1105
|
-
*
|
|
1106
|
-
* @example
|
|
1107
|
-
* ```typescript
|
|
1108
|
-
* if (isAuthEndpoint(req.url)) {
|
|
1109
|
-
* // Skip interceptor logic
|
|
1110
|
-
* }
|
|
1111
|
-
* ```
|
|
1112
642
|
*/
|
|
1113
643
|
declare const AUTH_ENDPOINTS: {
|
|
1114
644
|
readonly LOGIN: "/auth/login";
|
|
1115
645
|
readonly LOGOUT: "/auth/logout";
|
|
1116
646
|
readonly REFRESH: "/auth/refresh";
|
|
1117
647
|
readonly REGISTER: "/auth/register";
|
|
648
|
+
readonly ME: "/auth/me";
|
|
1118
649
|
readonly SELECT: "/auth/select";
|
|
1119
650
|
readonly SWITCH_COMPANY: "/auth/switch-company";
|
|
651
|
+
readonly CHANGE_PASSWORD: "/auth/change-password";
|
|
1120
652
|
readonly VERIFY_EMAIL: "/auth/verify-email";
|
|
1121
653
|
readonly FORGOT_PASSWORD: "/auth/forgot-password";
|
|
1122
654
|
readonly RESET_PASSWORD: "/auth/reset-password";
|
|
1123
655
|
readonly RESEND_VERIFICATION: "/auth/resend-verification";
|
|
1124
656
|
};
|
|
1125
|
-
/**
|
|
1126
|
-
* Check if a URL is an auth-related endpoint
|
|
1127
|
-
*/
|
|
1128
|
-
declare function isAuthEndpoint(url: string): boolean;
|
|
1129
|
-
/**
|
|
1130
|
-
* Check if a URL is a specific auth endpoint
|
|
1131
|
-
*/
|
|
657
|
+
/** Check if a URL matches a specific endpoint */
|
|
1132
658
|
declare function isEndpoint(url: string, endpoint: string): boolean;
|
|
1133
659
|
|
|
1134
660
|
interface ITab {
|
|
@@ -1136,6 +662,7 @@ interface ITab {
|
|
|
1136
662
|
label: string;
|
|
1137
663
|
icon: string;
|
|
1138
664
|
route: string;
|
|
665
|
+
permission: string;
|
|
1139
666
|
requiresCompanyFeature?: boolean;
|
|
1140
667
|
}
|
|
1141
668
|
/**
|
|
@@ -1147,14 +674,15 @@ interface ITab {
|
|
|
1147
674
|
*/
|
|
1148
675
|
declare class AdministrationPageComponent {
|
|
1149
676
|
private readonly appConfig;
|
|
677
|
+
private readonly permissionValidator;
|
|
1150
678
|
/** All available tabs */
|
|
1151
679
|
private readonly allTabs;
|
|
1152
680
|
/** Check if company feature is enabled */
|
|
1153
681
|
readonly companyFeatureEnabled: _angular_core.Signal<boolean>;
|
|
1154
|
-
/** Visible tabs based on config */
|
|
682
|
+
/** Visible tabs based on config and permissions */
|
|
1155
683
|
readonly visibleTabs: _angular_core.Signal<ITab[]>;
|
|
1156
|
-
/** Dynamic subtitle based on visible
|
|
1157
|
-
readonly subtitle: _angular_core.Signal<
|
|
684
|
+
/** Dynamic subtitle based on visible tabs */
|
|
685
|
+
readonly subtitle: _angular_core.Signal<string>;
|
|
1158
686
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AdministrationPageComponent, never>;
|
|
1159
687
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AdministrationPageComponent, "lib-administration-page", never, {}, {}, never, never, true, never>;
|
|
1160
688
|
}
|
|
@@ -1174,13 +702,15 @@ interface IBranchFormModel {
|
|
|
1174
702
|
* Handles creating and editing branches.
|
|
1175
703
|
* Defaults to current company context.
|
|
1176
704
|
*/
|
|
1177
|
-
declare class BranchFormComponent
|
|
705
|
+
declare class BranchFormComponent {
|
|
1178
706
|
private readonly router;
|
|
1179
707
|
private readonly route;
|
|
1180
708
|
private readonly messageService;
|
|
1181
709
|
private readonly branchService;
|
|
1182
710
|
private readonly companyService;
|
|
1183
711
|
private readonly authState;
|
|
712
|
+
private readonly routeParams;
|
|
713
|
+
private readonly queryParams;
|
|
1184
714
|
/** Loading state */
|
|
1185
715
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1186
716
|
/** Existing branch data when editing */
|
|
@@ -1195,10 +725,17 @@ declare class BranchFormComponent implements OnInit {
|
|
|
1195
725
|
readonly branchForm: _angular_forms_signals.FieldTree<IBranchFormModel, string | number>;
|
|
1196
726
|
/** Check if form is valid */
|
|
1197
727
|
readonly isFormValid: _angular_core.Signal<boolean>;
|
|
1198
|
-
|
|
728
|
+
constructor();
|
|
1199
729
|
loadBranch(id: string): Promise<void>;
|
|
730
|
+
private toFormModel;
|
|
1200
731
|
generateSlug(): void;
|
|
1201
732
|
onSubmit(): Promise<void>;
|
|
733
|
+
private updateBranch;
|
|
734
|
+
private createBranch;
|
|
735
|
+
private buildOptionalFields;
|
|
736
|
+
private onSaveSuccess;
|
|
737
|
+
private getTargetCompanyId;
|
|
738
|
+
private navigateToList;
|
|
1202
739
|
onCancel(): void;
|
|
1203
740
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BranchFormComponent, never>;
|
|
1204
741
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<BranchFormComponent, "lib-branch-form", never, {}, {}, never, never, true, never>;
|
|
@@ -1209,7 +746,13 @@ declare class BranchFormComponent implements OnInit {
|
|
|
1209
746
|
* Displays a list of branches for a company with CRUD operations.
|
|
1210
747
|
* Defaults to current company context.
|
|
1211
748
|
*/
|
|
1212
|
-
declare class BranchListComponent
|
|
749
|
+
declare class BranchListComponent {
|
|
750
|
+
readonly BRANCH_PERMISSIONS: {
|
|
751
|
+
readonly CREATE: "branch.create";
|
|
752
|
+
readonly READ: "branch.read";
|
|
753
|
+
readonly UPDATE: "branch.update";
|
|
754
|
+
readonly DELETE: "branch.delete";
|
|
755
|
+
};
|
|
1213
756
|
private readonly router;
|
|
1214
757
|
private readonly route;
|
|
1215
758
|
private readonly messageService;
|
|
@@ -1217,8 +760,10 @@ declare class BranchListComponent implements OnInit {
|
|
|
1217
760
|
private readonly branchService;
|
|
1218
761
|
private readonly companyService;
|
|
1219
762
|
private readonly authState;
|
|
1220
|
-
|
|
1221
|
-
|
|
763
|
+
private readonly queryParamMap;
|
|
764
|
+
private initialized;
|
|
765
|
+
/** Selected company ID (signal for zoneless change detection) */
|
|
766
|
+
readonly selectedCompanyId: _angular_core.WritableSignal<string | null>;
|
|
1222
767
|
/** Companies list for dropdown */
|
|
1223
768
|
readonly companies: _angular_core.Signal<_flusys_ng_auth.ICompany[]>;
|
|
1224
769
|
/** Branches from service */
|
|
@@ -1227,7 +772,7 @@ declare class BranchListComponent implements OnInit {
|
|
|
1227
772
|
readonly isLoading: _angular_core.Signal<boolean>;
|
|
1228
773
|
/** Total count from service */
|
|
1229
774
|
readonly total: _angular_core.Signal<number>;
|
|
1230
|
-
|
|
775
|
+
constructor();
|
|
1231
776
|
loadBranches(): void;
|
|
1232
777
|
onCompanyChange(): void;
|
|
1233
778
|
onLazyLoad(event: {
|
|
@@ -1255,11 +800,12 @@ interface ICompanyFormModel$1 {
|
|
|
1255
800
|
* Company Form Component
|
|
1256
801
|
* Handles creating and editing companies.
|
|
1257
802
|
*/
|
|
1258
|
-
declare class CompanyFormComponent
|
|
803
|
+
declare class CompanyFormComponent {
|
|
1259
804
|
private readonly router;
|
|
1260
805
|
private readonly route;
|
|
1261
806
|
private readonly messageService;
|
|
1262
807
|
private readonly companyService;
|
|
808
|
+
private readonly routeParams;
|
|
1263
809
|
/** Loading state */
|
|
1264
810
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1265
811
|
/** Existing company data when editing */
|
|
@@ -1272,11 +818,13 @@ declare class CompanyFormComponent implements OnInit {
|
|
|
1272
818
|
readonly companyForm: _angular_forms_signals.FieldTree<ICompanyFormModel$1, string | number>;
|
|
1273
819
|
/** Check if form is valid */
|
|
1274
820
|
readonly isFormValid: _angular_core.Signal<boolean>;
|
|
1275
|
-
|
|
1276
|
-
loadCompany
|
|
821
|
+
constructor();
|
|
822
|
+
private loadCompany;
|
|
1277
823
|
generateSlug(): void;
|
|
1278
824
|
onSubmit(): Promise<void>;
|
|
1279
825
|
onCancel(): void;
|
|
826
|
+
/** Build company data from form model */
|
|
827
|
+
private buildCompanyData;
|
|
1280
828
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CompanyFormComponent, never>;
|
|
1281
829
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CompanyFormComponent, "lib-company-form", never, {}, {}, never, never, true, never>;
|
|
1282
830
|
}
|
|
@@ -1286,7 +834,19 @@ declare class CompanyFormComponent implements OnInit {
|
|
|
1286
834
|
* Displays a list of companies with CRUD operations.
|
|
1287
835
|
* Only visible when company feature is enabled.
|
|
1288
836
|
*/
|
|
1289
|
-
declare class CompanyListComponent
|
|
837
|
+
declare class CompanyListComponent {
|
|
838
|
+
readonly COMPANY_PERMISSIONS: {
|
|
839
|
+
readonly CREATE: "company.create";
|
|
840
|
+
readonly READ: "company.read";
|
|
841
|
+
readonly UPDATE: "company.update";
|
|
842
|
+
readonly DELETE: "company.delete";
|
|
843
|
+
};
|
|
844
|
+
readonly BRANCH_PERMISSIONS: {
|
|
845
|
+
readonly CREATE: "branch.create";
|
|
846
|
+
readonly READ: "branch.read";
|
|
847
|
+
readonly UPDATE: "branch.update";
|
|
848
|
+
readonly DELETE: "branch.delete";
|
|
849
|
+
};
|
|
1290
850
|
private readonly router;
|
|
1291
851
|
private readonly messageService;
|
|
1292
852
|
private readonly confirmationService;
|
|
@@ -1297,8 +857,6 @@ declare class CompanyListComponent implements OnInit {
|
|
|
1297
857
|
readonly isLoading: _angular_core.Signal<boolean>;
|
|
1298
858
|
/** Total count from service */
|
|
1299
859
|
readonly total: _angular_core.Signal<number>;
|
|
1300
|
-
ngOnInit(): void;
|
|
1301
|
-
loadCompanies(): void;
|
|
1302
860
|
onLazyLoad(event: {
|
|
1303
861
|
first?: number | null;
|
|
1304
862
|
rows?: number | null;
|
|
@@ -1325,31 +883,24 @@ declare class ForgotPasswordPageComponent {
|
|
|
1325
883
|
readonly forgotForm: _angular_forms_signals.FieldTree<IForgotPasswordFormModel, string | number>;
|
|
1326
884
|
readonly isFormValid: _angular_core.Signal<boolean>;
|
|
1327
885
|
onSubmit(): void;
|
|
886
|
+
private showEmailSent;
|
|
1328
887
|
resetForm(): void;
|
|
1329
888
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForgotPasswordPageComponent, never>;
|
|
1330
889
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ForgotPasswordPageComponent, "lib-forgot-password-page", never, {}, {}, never, never, true, never>;
|
|
1331
890
|
}
|
|
1332
891
|
|
|
1333
|
-
/** Login form model interface */
|
|
1334
892
|
interface ILoginFormModel {
|
|
1335
893
|
email: string;
|
|
1336
894
|
password: string;
|
|
1337
895
|
rememberMe: boolean;
|
|
1338
896
|
}
|
|
1339
|
-
/** Company selection form model interface */
|
|
1340
897
|
interface ISelectionFormModel {
|
|
1341
898
|
companyId: string;
|
|
1342
899
|
branchId: string;
|
|
1343
900
|
rememberSelection: boolean;
|
|
1344
901
|
}
|
|
1345
902
|
type LoginStep = 'credentials' | 'company-selection' | 'email-verification';
|
|
1346
|
-
|
|
1347
|
-
* Login Page Component
|
|
1348
|
-
* Multi-step authentication flow:
|
|
1349
|
-
* - Step 1: Email/Password credentials
|
|
1350
|
-
* - Step 2: Company/Branch selection (when company feature enabled and user has multiple)
|
|
1351
|
-
*/
|
|
1352
|
-
declare class LoginPageComponent implements OnInit {
|
|
903
|
+
declare class LoginPageComponent {
|
|
1353
904
|
private readonly destroyRef;
|
|
1354
905
|
private readonly appConfig;
|
|
1355
906
|
private readonly messageService;
|
|
@@ -1359,31 +910,20 @@ declare class LoginPageComponent implements OnInit {
|
|
|
1359
910
|
readonly currentStep: _angular_core.WritableSignal<LoginStep>;
|
|
1360
911
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1361
912
|
readonly unverifiedEmail: _angular_core.WritableSignal<string>;
|
|
1362
|
-
/** Login form model */
|
|
1363
913
|
readonly loginFormModel: _angular_core.WritableSignal<ILoginFormModel>;
|
|
1364
|
-
/** Login form with validation schema */
|
|
1365
914
|
readonly loginForm: _angular_forms_signals.FieldTree<ILoginFormModel, string | number>;
|
|
1366
|
-
/** Check if login form is valid */
|
|
1367
915
|
readonly isLoginFormValid: _angular_core.Signal<boolean>;
|
|
1368
|
-
/** Selection form model */
|
|
1369
916
|
readonly selectionFormModel: _angular_core.WritableSignal<ISelectionFormModel>;
|
|
1370
|
-
/** Selection form with validation schema */
|
|
1371
917
|
readonly selectionForm: _angular_forms_signals.FieldTree<ISelectionFormModel, string | number>;
|
|
1372
|
-
/** Check if selection form is valid */
|
|
1373
918
|
readonly isSelectionFormValid: _angular_core.Signal<boolean>;
|
|
1374
|
-
/** Whether company feature is enabled */
|
|
1375
919
|
readonly companyFeatureEnabled: _angular_core.Signal<boolean>;
|
|
1376
|
-
/** Session ID for company selection */
|
|
1377
920
|
private sessionId;
|
|
1378
|
-
/** Available companies */
|
|
1379
921
|
readonly companies: _angular_core.WritableSignal<ICompanyWithBranches[]>;
|
|
1380
|
-
/** User's name */
|
|
1381
922
|
readonly userName: _angular_core.WritableSignal<string>;
|
|
1382
|
-
/** Branches for selected company */
|
|
1383
923
|
readonly branches: _angular_core.Signal<IBranchSelectionInfo[]>;
|
|
1384
|
-
|
|
924
|
+
constructor();
|
|
925
|
+
private restorePendingSelectionState;
|
|
1385
926
|
onSubmit(): void;
|
|
1386
|
-
/** Handle company selection change */
|
|
1387
927
|
onCompanyChange(): void;
|
|
1388
928
|
onSelectCompany(): void;
|
|
1389
929
|
goBackToCredentials(): void;
|
|
@@ -1418,7 +958,7 @@ interface IPasswordFormModel {
|
|
|
1418
958
|
* - Uses PROFILE_PERMISSION_PROVIDER (optional) for IAM functionality
|
|
1419
959
|
* - No direct imports from ng-storage or ng-iam
|
|
1420
960
|
*/
|
|
1421
|
-
declare class ProfilePageComponent
|
|
961
|
+
declare class ProfilePageComponent {
|
|
1422
962
|
private readonly destroyRef;
|
|
1423
963
|
private readonly appConfig;
|
|
1424
964
|
private readonly messageService;
|
|
@@ -1448,9 +988,11 @@ declare class ProfilePageComponent implements OnInit {
|
|
|
1448
988
|
readonly showRoles: _angular_core.Signal<boolean>;
|
|
1449
989
|
readonly showActions: _angular_core.Signal<boolean>;
|
|
1450
990
|
readonly showBottomRow: _angular_core.Signal<boolean>;
|
|
991
|
+
private readonly originalFormModel;
|
|
1451
992
|
readonly formModel: _angular_core.WritableSignal<IProfileFormModel>;
|
|
1452
993
|
readonly formTree: _angular_forms_signals.FieldTree<IProfileFormModel, string | number>;
|
|
1453
994
|
readonly isFormValid: _angular_core.Signal<boolean>;
|
|
995
|
+
readonly isFormDirty: _angular_core.Signal<boolean>;
|
|
1454
996
|
readonly passwordModel: _angular_core.WritableSignal<IPasswordFormModel>;
|
|
1455
997
|
readonly isPasswordLoading: _angular_core.WritableSignal<boolean>;
|
|
1456
998
|
readonly isPasswordFormValid: _angular_core.Signal<boolean>;
|
|
@@ -1458,7 +1000,7 @@ declare class ProfilePageComponent implements OnInit {
|
|
|
1458
1000
|
readonly uploadFileFn: UploadFileFn;
|
|
1459
1001
|
/** Map upload result to IUploadedFile format */
|
|
1460
1002
|
private mapUploadResultToUploadedFile;
|
|
1461
|
-
|
|
1003
|
+
constructor();
|
|
1462
1004
|
private loadUserData;
|
|
1463
1005
|
private loadPermissions;
|
|
1464
1006
|
onProfilePictureUploaded(file: {
|
|
@@ -1490,7 +1032,7 @@ interface ICompanyFormModel {
|
|
|
1490
1032
|
newCompanyPhone: string;
|
|
1491
1033
|
newCompanyAddress: string;
|
|
1492
1034
|
}
|
|
1493
|
-
declare class RegisterPageComponent
|
|
1035
|
+
declare class RegisterPageComponent {
|
|
1494
1036
|
private readonly destroyRef;
|
|
1495
1037
|
private readonly appConfig;
|
|
1496
1038
|
private readonly messageService;
|
|
@@ -1498,6 +1040,8 @@ declare class RegisterPageComponent implements OnInit {
|
|
|
1498
1040
|
private readonly authState;
|
|
1499
1041
|
private readonly route;
|
|
1500
1042
|
private readonly router;
|
|
1043
|
+
private readonly queryParamMap;
|
|
1044
|
+
private companySlugInitialized;
|
|
1501
1045
|
readonly returnUrl: _angular_core.InputSignal<string>;
|
|
1502
1046
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1503
1047
|
readonly companyFeatureEnabled: _angular_core.Signal<boolean>;
|
|
@@ -1507,7 +1051,7 @@ declare class RegisterPageComponent implements OnInit {
|
|
|
1507
1051
|
readonly companyForm: _angular_forms_signals.FieldTree<ICompanyFormModel, string | number>;
|
|
1508
1052
|
readonly passwordsMatch: _angular_core.Signal<boolean>;
|
|
1509
1053
|
readonly isFormValid: _angular_core.Signal<boolean>;
|
|
1510
|
-
|
|
1054
|
+
constructor();
|
|
1511
1055
|
onCreateCompanyToggle(): void;
|
|
1512
1056
|
onSubmit(): void;
|
|
1513
1057
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RegisterPageComponent, never>;
|
|
@@ -1519,11 +1063,13 @@ interface IResetPasswordFormModel {
|
|
|
1519
1063
|
confirmPassword: string;
|
|
1520
1064
|
}
|
|
1521
1065
|
type PageState$1 = 'form' | 'success' | 'invalid-token';
|
|
1522
|
-
declare class ResetPasswordPageComponent
|
|
1066
|
+
declare class ResetPasswordPageComponent {
|
|
1523
1067
|
private readonly destroyRef;
|
|
1524
1068
|
private readonly route;
|
|
1525
1069
|
private readonly messageService;
|
|
1526
1070
|
private readonly authApi;
|
|
1071
|
+
private readonly queryParams;
|
|
1072
|
+
private tokenInitialized;
|
|
1527
1073
|
private token;
|
|
1528
1074
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1529
1075
|
readonly pageState: _angular_core.WritableSignal<PageState$1>;
|
|
@@ -1531,7 +1077,7 @@ declare class ResetPasswordPageComponent implements OnInit {
|
|
|
1531
1077
|
readonly resetForm: _angular_forms_signals.FieldTree<IResetPasswordFormModel, string | number>;
|
|
1532
1078
|
readonly passwordMismatch: _angular_core.Signal<boolean>;
|
|
1533
1079
|
readonly canSubmit: _angular_core.Signal<boolean>;
|
|
1534
|
-
|
|
1080
|
+
constructor();
|
|
1535
1081
|
onSubmit(): void;
|
|
1536
1082
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ResetPasswordPageComponent, never>;
|
|
1537
1083
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ResetPasswordPageComponent, "lib-reset-password-page", never, {}, {}, never, never, true, never>;
|
|
@@ -1551,7 +1097,7 @@ interface IUserFormModel {
|
|
|
1551
1097
|
* Handles creating and editing users.
|
|
1552
1098
|
* When company feature is enabled, automatically assigns new users to current company/branch.
|
|
1553
1099
|
*/
|
|
1554
|
-
declare class UserFormComponent
|
|
1100
|
+
declare class UserFormComponent {
|
|
1555
1101
|
private readonly destroyRef;
|
|
1556
1102
|
private readonly router;
|
|
1557
1103
|
private readonly route;
|
|
@@ -1560,6 +1106,8 @@ declare class UserFormComponent implements OnInit {
|
|
|
1560
1106
|
private readonly userService;
|
|
1561
1107
|
private readonly permissionService;
|
|
1562
1108
|
private readonly authState;
|
|
1109
|
+
private readonly routeParams;
|
|
1110
|
+
private userLoadTriggered;
|
|
1563
1111
|
/** Loading state */
|
|
1564
1112
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1565
1113
|
/** Existing user data when editing */
|
|
@@ -1578,9 +1126,13 @@ declare class UserFormComponent implements OnInit {
|
|
|
1578
1126
|
readonly formTree: _angular_forms_signals.FieldTree<IUserFormModel, string | number>;
|
|
1579
1127
|
/** Check if form is valid */
|
|
1580
1128
|
readonly isFormValid: _angular_core.Signal<boolean>;
|
|
1581
|
-
|
|
1129
|
+
constructor();
|
|
1582
1130
|
loadUser(id: string): void;
|
|
1131
|
+
private toFormModel;
|
|
1583
1132
|
onSubmit(): void;
|
|
1133
|
+
private updateUser;
|
|
1134
|
+
private createUser;
|
|
1135
|
+
private onSaveSuccess;
|
|
1584
1136
|
/**
|
|
1585
1137
|
* Assign user to current company and branch
|
|
1586
1138
|
*/
|
|
@@ -1594,7 +1146,13 @@ declare class UserFormComponent implements OnInit {
|
|
|
1594
1146
|
* User List Component
|
|
1595
1147
|
* Displays a list of users with CRUD operations.
|
|
1596
1148
|
*/
|
|
1597
|
-
declare class UserListComponent
|
|
1149
|
+
declare class UserListComponent {
|
|
1150
|
+
readonly USER_PERMISSIONS: {
|
|
1151
|
+
readonly CREATE: "user.create";
|
|
1152
|
+
readonly READ: "user.read";
|
|
1153
|
+
readonly UPDATE: "user.update";
|
|
1154
|
+
readonly DELETE: "user.delete";
|
|
1155
|
+
};
|
|
1598
1156
|
private readonly router;
|
|
1599
1157
|
private readonly appConfig;
|
|
1600
1158
|
private readonly messageService;
|
|
@@ -1613,7 +1171,6 @@ declare class UserListComponent implements OnInit {
|
|
|
1613
1171
|
readonly showBranchDialog: _angular_core.WritableSignal<boolean>;
|
|
1614
1172
|
/** Selected user for permission management */
|
|
1615
1173
|
readonly selectedUser: _angular_core.WritableSignal<IUser | null>;
|
|
1616
|
-
ngOnInit(): void;
|
|
1617
1174
|
loadUsers(): void;
|
|
1618
1175
|
onLazyLoad(event: {
|
|
1619
1176
|
first?: number | null;
|
|
@@ -1623,6 +1180,7 @@ declare class UserListComponent implements OnInit {
|
|
|
1623
1180
|
onEdit(user: IUser): void;
|
|
1624
1181
|
onManageCompanyPermissions(user: IUser): void;
|
|
1625
1182
|
onManageBranchPermissions(user: IUser): void;
|
|
1183
|
+
private openPermissionDialog;
|
|
1626
1184
|
onDelete(user: IUser): void;
|
|
1627
1185
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserListComponent, never>;
|
|
1628
1186
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserListComponent, "lib-user-list", never, {}, {}, never, never, true, never>;
|
|
@@ -1632,13 +1190,15 @@ interface IResendFormModel {
|
|
|
1632
1190
|
email: string;
|
|
1633
1191
|
}
|
|
1634
1192
|
type PageState = 'verifying' | 'success' | 'invalid-token' | 'resend';
|
|
1635
|
-
declare class VerifyEmailPageComponent
|
|
1193
|
+
declare class VerifyEmailPageComponent {
|
|
1636
1194
|
private readonly platformId;
|
|
1637
1195
|
private readonly transferState;
|
|
1638
1196
|
private readonly destroyRef;
|
|
1639
1197
|
private readonly route;
|
|
1640
1198
|
private readonly messageService;
|
|
1641
1199
|
private readonly authApi;
|
|
1200
|
+
private readonly queryParams;
|
|
1201
|
+
private verificationTriggered;
|
|
1642
1202
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1643
1203
|
readonly pageState: _angular_core.WritableSignal<PageState>;
|
|
1644
1204
|
readonly resendSuccess: _angular_core.WritableSignal<boolean>;
|
|
@@ -1646,7 +1206,7 @@ declare class VerifyEmailPageComponent implements OnInit {
|
|
|
1646
1206
|
readonly resendFormModel: _angular_core.WritableSignal<IResendFormModel>;
|
|
1647
1207
|
readonly resendForm: _angular_forms_signals.FieldTree<IResendFormModel, string | number>;
|
|
1648
1208
|
readonly isResendFormValid: _angular_core.Signal<boolean>;
|
|
1649
|
-
|
|
1209
|
+
constructor();
|
|
1650
1210
|
private verifyEmail;
|
|
1651
1211
|
private handleVerificationResult;
|
|
1652
1212
|
showResendForm(): void;
|
|
@@ -1656,52 +1216,27 @@ declare class VerifyEmailPageComponent implements OnInit {
|
|
|
1656
1216
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<VerifyEmailPageComponent, "lib-verify-email-page", never, {}, {}, never, never, true, never>;
|
|
1657
1217
|
}
|
|
1658
1218
|
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
* Workflow:
|
|
1663
|
-
* 1. Dialog opens → Shows company dropdown with user's permitted companies
|
|
1664
|
-
* 2. User selects a company → Branches load for that company
|
|
1665
|
-
* 3. Branches show with checkboxes (checked = already assigned)
|
|
1666
|
-
* 4. Check to assign, uncheck to revoke
|
|
1667
|
-
*
|
|
1668
|
-
* Company dropdown only shows companies the user has company-level permissions for.
|
|
1669
|
-
* Branch permissions can only be assigned within user's permitted companies.
|
|
1670
|
-
*/
|
|
1219
|
+
interface BranchWithAssignment extends IBranch {
|
|
1220
|
+
isAssigned: boolean;
|
|
1221
|
+
}
|
|
1671
1222
|
declare class UserBranchPermissionDialogComponent {
|
|
1672
1223
|
private readonly branchApi;
|
|
1673
1224
|
private readonly permissionApi;
|
|
1674
|
-
private readonly authState;
|
|
1675
1225
|
private readonly messageService;
|
|
1676
|
-
/** Dialog visibility */
|
|
1677
1226
|
readonly visible: _angular_core.InputSignal<boolean>;
|
|
1678
|
-
/** User to manage permissions for */
|
|
1679
1227
|
readonly user: _angular_core.InputSignal<IUser | null>;
|
|
1680
|
-
/** Close event */
|
|
1681
1228
|
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
1682
|
-
/** Refresh event after changes */
|
|
1683
1229
|
readonly permissionsChanged: _angular_core.OutputEmitterRef<void>;
|
|
1684
|
-
/** Loading state */
|
|
1685
1230
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1686
|
-
/** Saving state */
|
|
1687
1231
|
readonly isSaving: _angular_core.WritableSignal<boolean>;
|
|
1688
|
-
/** Branches with assignment status */
|
|
1689
1232
|
readonly branches: _angular_core.WritableSignal<BranchWithAssignment[]>;
|
|
1690
|
-
/** Available companies (filtered by user's company permissions) */
|
|
1691
1233
|
readonly companies: _angular_core.WritableSignal<{
|
|
1692
1234
|
id: string;
|
|
1693
1235
|
name: string;
|
|
1694
1236
|
}[]>;
|
|
1695
|
-
/** Selected company ID */
|
|
1696
1237
|
selectedCompanyId: string | null;
|
|
1697
|
-
/** Current company from auth state */
|
|
1698
|
-
readonly currentCompany: _angular_core.Signal<_flusys_ng_auth.ICompanyInfo | null>;
|
|
1699
|
-
/** Currently assigned branch IDs */
|
|
1700
1238
|
private assignedBranchIds;
|
|
1701
1239
|
constructor();
|
|
1702
|
-
/**
|
|
1703
|
-
* Load user's assigned companies (does not auto-select or load branches)
|
|
1704
|
-
*/
|
|
1705
1240
|
private loadUserCompaniesAndData;
|
|
1706
1241
|
private loadData;
|
|
1707
1242
|
onCompanyChange(): void;
|
|
@@ -1710,35 +1245,21 @@ declare class UserBranchPermissionDialogComponent {
|
|
|
1710
1245
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserBranchPermissionDialogComponent, never>;
|
|
1711
1246
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserBranchPermissionDialogComponent, "lib-user-branch-permission-dialog", never, { "visible": { "alias": "visible"; "required": true; "isSignal": true; }; "user": { "alias": "user"; "required": true; "isSignal": true; }; }, { "closed": "closed"; "permissionsChanged": "permissionsChanged"; }, never, never, true, never>;
|
|
1712
1247
|
}
|
|
1713
|
-
|
|
1248
|
+
|
|
1249
|
+
interface CompanyWithAssignment extends ICompany {
|
|
1714
1250
|
isAssigned: boolean;
|
|
1715
1251
|
}
|
|
1716
|
-
|
|
1717
|
-
/**
|
|
1718
|
-
* User Company Permission Dialog
|
|
1719
|
-
* Shows all companies with checkboxes
|
|
1720
|
-
* Initially assigned companies are checked
|
|
1721
|
-
* Check to assign, uncheck to revoke
|
|
1722
|
-
*/
|
|
1723
1252
|
declare class UserCompanyPermissionDialogComponent {
|
|
1724
1253
|
private readonly companyApi;
|
|
1725
1254
|
private readonly permissionApi;
|
|
1726
1255
|
private readonly messageService;
|
|
1727
|
-
/** Dialog visibility */
|
|
1728
1256
|
readonly visible: _angular_core.InputSignal<boolean>;
|
|
1729
|
-
/** User to manage permissions for */
|
|
1730
1257
|
readonly user: _angular_core.InputSignal<IUser | null>;
|
|
1731
|
-
/** Close event */
|
|
1732
1258
|
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
1733
|
-
/** Refresh event after changes */
|
|
1734
1259
|
readonly permissionsChanged: _angular_core.OutputEmitterRef<void>;
|
|
1735
|
-
/** Loading state */
|
|
1736
1260
|
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1737
|
-
/** Saving state */
|
|
1738
1261
|
readonly isSaving: _angular_core.WritableSignal<boolean>;
|
|
1739
|
-
/** Companies with assignment status */
|
|
1740
1262
|
readonly companies: _angular_core.WritableSignal<CompanyWithAssignment[]>;
|
|
1741
|
-
/** Currently assigned company IDs */
|
|
1742
1263
|
private assignedCompanyIds;
|
|
1743
1264
|
constructor();
|
|
1744
1265
|
private loadData;
|
|
@@ -1747,9 +1268,6 @@ declare class UserCompanyPermissionDialogComponent {
|
|
|
1747
1268
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserCompanyPermissionDialogComponent, never>;
|
|
1748
1269
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserCompanyPermissionDialogComponent, "lib-user-company-permission-dialog", never, { "visible": { "alias": "visible"; "required": true; "isSignal": true; }; "user": { "alias": "user"; "required": true; "isSignal": true; }; }, { "closed": "closed"; "permissionsChanged": "permissionsChanged"; }, never, never, true, never>;
|
|
1749
1270
|
}
|
|
1750
|
-
interface CompanyWithAssignment extends ICompany {
|
|
1751
|
-
isAssigned: boolean;
|
|
1752
|
-
}
|
|
1753
1271
|
|
|
1754
|
-
export { ADMINISTRATION_ROUTES, AUTH_ENDPOINTS, AUTH_ROUTES, AdministrationPageComponent, AuthApiService, AuthCompanyApiProviderAdapter, AuthInitService, AuthLayoutApiAdapter, AuthLayoutStateAdapter, AuthStateService, AuthUserPermissionProviderAdapter, AuthUserProviderAdapter, BranchApiService, BranchFormComponent, BranchListComponent, CompanyApiService, CompanyFormComponent, CompanyListComponent, ForgotPasswordPageComponent, LoginPageComponent, PROFILE_ROUTES, ProfilePageComponent, RegisterPageComponent, ResetPasswordPageComponent, TokenRefreshStateService, UserApiService, UserBranchPermissionDialogComponent, UserCompanyPermissionDialogComponent, UserFormComponent, UserListComponent, UserPermissionApiService, VerifyEmailPageComponent, authGuard, authInterceptor, companyFeatureGuard, guestGuard,
|
|
1272
|
+
export { ADMINISTRATION_ROUTES, AUTH_ENDPOINTS, AUTH_ROUTES, AdministrationPageComponent, AuthApiService, AuthCompanyApiProviderAdapter, AuthInitService, AuthLayoutApiAdapter, AuthLayoutStateAdapter, AuthStateProviderAdapter, AuthStateService, AuthUserPermissionProviderAdapter, AuthUserProviderAdapter, BranchApiService, BranchFormComponent, BranchListComponent, CompanyApiService, CompanyFormComponent, CompanyListComponent, ForgotPasswordPageComponent, LoginPageComponent, PROFILE_ROUTES, ProfilePageComponent, RegisterPageComponent, ResetPasswordPageComponent, TokenRefreshStateService, UserApiService, UserBranchPermissionDialogComponent, UserCompanyPermissionDialogComponent, UserFormComponent, UserListComponent, UserPermissionApiService, VerifyEmailPageComponent, authGuard, authInterceptor, companyFeatureGuard, guestGuard, isCompanySelectionResponse, isEmailVerificationRequired, isEndpoint, isLoginResponse, provideAuthLayoutIntegration, provideAuthProviders, tokenRefreshInterceptor };
|
|
1755
1273
|
export type { AuthResponse, IAssignUserBranchRequest, IAssignUserCompanyRequest, IBatchOperationResponse, IBranch, IBranchInfo, IBranchSelectionInfo, IChangePasswordRequest, ICompany, ICompanyInfo, ICompanySelectionResponse, ICompanyWithBranches, ICreateBranchRequest, ICreateCompanyRequest, ICreateUserRequest, ILoginRequest, ILoginRequiresEmailVerification, ILoginResponse, IMeResponse, IPermissionItem, IRefreshTokenResponse, IRegistrationRequest, IRegistrationResponse, ISelectRequest, ISwitchCompanyRequest, IUpdateBranchRequest, IUpdateCompanyRequest, IUpdateUserRequest, IUser, IUserBranchPermission, IUserBranchesResponse, IUserCompaniesResponse, IUserCompanyPermission, IUserInfo };
|