@flusys/ng-auth 1.1.0-beta → 1.1.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.
@@ -1,26 +1,19 @@
1
- import { IMessageResponse, ApiResourceService, ISingleResponse, IUserProvider, IListResponse, IUserBasicInfo, ICompanyApiProvider, ICompanyBasicInfo, IUserPermissionProvider, IProfileRoleInfo, IProfileActionInfo, UploadFileFn } from '@flusys/ng-shared';
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, OnInit } from '@angular/core';
6
- import { HttpClient, HttpRequest, HttpHandlerFn, HttpEvent } from '@angular/common/http';
5
+ import { Signal, Provider } from '@angular/core';
7
6
  import { CanActivateFn, Routes } from '@angular/router';
7
+ import { HttpRequest, HttpHandlerFn, HttpEvent } from '@angular/common/http';
8
8
  import { ILayoutAuthApi, ICompanyInfo as ICompanyInfo$1, IBranchInfo as IBranchInfo$1, ILayoutAuthState, IUserInfo as IUserInfo$1 } from '@flusys/ng-layout';
9
9
  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 user: _angular_core.WritableSignal<IUserInfo | null>;
523
- readonly accessToken: _angular_core.WritableSignal<string>;
524
- readonly company: _angular_core.WritableSignal<ICompanyInfo | null>;
525
- readonly branch: _angular_core.WritableSignal<IBranchInfo | null>;
526
- readonly selectionSessionId: _angular_core.WritableSignal<string | null>;
527
- readonly availableCompanies: _angular_core.WritableSignal<ICompanyWithBranches[]>;
528
- readonly selectionExpiresAt: _angular_core.WritableSignal<Date | null>;
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
- /** Current company context for branch operations */
577
- readonly currentCompanyId: _angular_core.WritableSignal<string | null>;
578
- /** Branches filtered by current company */
579
- readonly companyBranches: _angular_core.Signal<IBranch[]>;
580
- constructor(http: HttpClient);
581
- /**
582
- * Set the current company context for branch operations
583
- */
447
+ private readonly _currentCompanyId;
448
+ constructor();
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,64 +455,25 @@ 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
- constructor(http: HttpClient);
460
+ constructor();
620
461
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CompanyApiService, never>;
621
462
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<CompanyApiService>;
622
463
  }
623
464
 
624
465
  /**
625
466
  * Token Refresh State Service
626
- *
627
- * Manages token refresh state in a request-safe manner for SSR environments.
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
- 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
- */
487
+ constructor();
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,194 +492,42 @@ 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
496
+ * Endpoint: POST /administration/permissions/*
721
497
  */
722
498
  declare class UserPermissionApiService {
723
499
  private readonly appConfig;
724
500
  private readonly http;
725
501
  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
502
  assignUserCompanies(data: IAssignUserCompanyRequest): Observable<IBatchOperationResponse>;
750
- /**
751
- * Assign single company to user (convenience method)
752
- */
753
503
  assignUserToCompany(userId: string, companyId: string): Observable<IBatchOperationResponse>;
754
- /**
755
- * Revoke single company from user (convenience method)
756
- */
757
504
  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
505
  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
506
  assignUserBranches(data: IAssignUserBranchRequest): Observable<IBatchOperationResponse>;
788
- /**
789
- * Assign single branch to user (convenience method)
790
- */
791
507
  assignUserToBranch(userId: string, branchId: string): Observable<IBatchOperationResponse>;
792
- /**
793
- * Revoke single branch from user (convenience method)
794
- */
795
508
  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>;
509
+ getUserBranches(userId: string, companyId?: string): Observable<IUserBranchesResponse>;
803
510
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserPermissionApiService, never>;
804
511
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<UserPermissionApiService>;
805
512
  }
806
513
 
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
- */
514
+ /** Protects routes requiring authentication */
829
515
  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
- */
516
+ /** Protects auth routes from authenticated users, restores session first */
855
517
  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
- */
518
+ /** Protects routes requiring company feature to be enabled */
873
519
  declare const companyFeatureGuard: CanActivateFn;
520
+ /** Protects routes requiring email feature to be enabled */
521
+ declare const emailFeatureGuard: CanActivateFn;
522
+ /** Protects routes requiring sign-up feature to be enabled */
523
+ declare const signUpFeatureGuard: CanActivateFn;
874
524
 
875
525
  /**
876
526
  * Auth Interceptor - Adds auth headers and cookie credentials to requests
877
527
  */
878
528
  declare function authInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
879
529
 
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
- */
530
+ /** Token Refresh Interceptor - Proactive and reactive token refresh with request queuing */
900
531
  declare function tokenRefreshInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
901
532
 
902
533
  /**
@@ -919,86 +550,49 @@ declare const ADMINISTRATION_ROUTES: Routes;
919
550
  declare const PROFILE_ROUTES: Routes;
920
551
 
921
552
  /**
922
- * Auth Layout State Adapter
923
- * Bridges AuthStateService signals to ILayoutAuthState interface.
924
- * Provides ready-to-use integration between ng-auth, ng-layout, and ng-shared provider tokens.
553
+ * Auth Layout Provider Adapters
554
+ *
555
+ * Implements provider interfaces from ng-layout using ng-auth services.
556
+ * Bridges auth state and API to layout components.
557
+ *
558
+ * @example
559
+ * // In app.config.ts
560
+ * import { provideAuthLayoutIntegration } from '@flusys/ng-auth';
561
+ * providers: [...provideAuthLayoutIntegration()]
925
562
  */
926
563
  declare class AuthLayoutStateAdapter implements ILayoutAuthState {
927
564
  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
565
  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
566
  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
567
  readonly loginUserData: Signal<IUserInfo$1 | null>;
943
568
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthLayoutStateAdapter, never>;
944
569
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthLayoutStateAdapter>;
945
570
  }
946
- /**
947
- * Auth Layout API Adapter
948
- * Bridges AuthApiService to ILayoutAuthApi interface.
949
- * Handles logout and navigation for layout components.
950
- */
951
571
  declare class AuthLayoutApiAdapter implements ILayoutAuthApi {
952
572
  private readonly authApi;
953
573
  private readonly authState;
954
574
  private readonly permissionApi;
955
575
  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
576
  logOut(): Observable<any>;
962
- /**
963
- * Navigate to login page.
964
- * Optionally preserves current URL as return URL.
965
- */
966
577
  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
578
  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
579
  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
580
  getCompanyBranches(companyId: string): Observable<IBranchInfo$1[]>;
983
581
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthLayoutApiAdapter, never>;
984
582
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthLayoutApiAdapter>;
985
583
  }
986
584
 
987
585
  /**
988
- * Auth User Provider Adapter
586
+ * Auth Shared Provider Adapters
989
587
  *
990
- * Implements IUserProvider interface from ng-shared using UserApiService from ng-auth.
991
- * This allows IAM and other packages to access user data without depending on ng-auth directly.
588
+ * Implements provider interfaces from ng-shared using ng-auth services.
589
+ * Allows IAM, Storage, and Form-Builder packages to access auth data
590
+ * without depending on ng-auth directly.
992
591
  *
993
592
  * @example
994
593
  * // In app.config.ts
995
- * providers: [
996
- * { provide: USER_PROVIDER, useClass: AuthUserProviderAdapter }
997
- * ]
998
- *
999
- * // In IAM component
1000
- * private readonly userProvider = inject(USER_PROVIDER);
1001
- * this.userProvider.getUsers({ page: 0, pageSize: 50 }).subscribe(...);
594
+ * import { provideAuthProviders } from '@flusys/ng-auth';
595
+ * providers: [...provideAuthProviders()]
1002
596
  */
1003
597
  declare class AuthUserProviderAdapter implements IUserProvider {
1004
598
  private readonly userApi;
@@ -1014,19 +608,6 @@ declare class AuthUserProviderAdapter implements IUserProvider {
1014
608
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthUserProviderAdapter, never>;
1015
609
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthUserProviderAdapter>;
1016
610
  }
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
611
  declare class AuthCompanyApiProviderAdapter implements ICompanyApiProvider {
1031
612
  private readonly companyApi;
1032
613
  getCompanies(filter?: {
@@ -1037,64 +618,25 @@ declare class AuthCompanyApiProviderAdapter implements ICompanyApiProvider {
1037
618
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthCompanyApiProviderAdapter, never>;
1038
619
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthCompanyApiProviderAdapter>;
1039
620
  }
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
621
  declare class AuthUserPermissionProviderAdapter implements IUserPermissionProvider {
1054
622
  private readonly userPermissionApi;
1055
- getUserBranchPermissions(userId: string): Observable<ISingleResponse<any>>;
623
+ getUserBranchPermissions(userId: string, companyId?: string): Observable<ISingleResponse<any>>;
1056
624
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthUserPermissionProviderAdapter, never>;
1057
625
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthUserPermissionProviderAdapter>;
1058
626
  }
627
+ declare class AuthStateProviderAdapter implements IAuthStateProvider {
628
+ private readonly authState;
629
+ private readonly authInit;
630
+ get isAuthenticated(): Signal<boolean>;
631
+ initialize(): Observable<void>;
632
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthStateProviderAdapter, never>;
633
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthStateProviderAdapter>;
634
+ }
1059
635
 
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
- */
636
+ /** Provides auth integration for ng-layout */
1077
637
  declare function provideAuthLayoutIntegration(): Provider[];
1078
638
 
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
- */
639
+ /** Provides auth implementations for ng-shared provider interfaces */
1098
640
  declare function provideAuthProviders(): Provider[];
1099
641
 
1100
642
  /**
@@ -1102,33 +644,22 @@ declare function provideAuthProviders(): Provider[];
1102
644
  *
1103
645
  * Centralized endpoint definitions to prevent inconsistencies across interceptors
1104
646
  * 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
647
  */
1113
648
  declare const AUTH_ENDPOINTS: {
1114
649
  readonly LOGIN: "/auth/login";
1115
650
  readonly LOGOUT: "/auth/logout";
1116
651
  readonly REFRESH: "/auth/refresh";
1117
652
  readonly REGISTER: "/auth/register";
653
+ readonly ME: "/auth/me";
1118
654
  readonly SELECT: "/auth/select";
1119
655
  readonly SWITCH_COMPANY: "/auth/switch-company";
656
+ readonly CHANGE_PASSWORD: "/auth/change-password";
1120
657
  readonly VERIFY_EMAIL: "/auth/verify-email";
1121
658
  readonly FORGOT_PASSWORD: "/auth/forgot-password";
1122
659
  readonly RESET_PASSWORD: "/auth/reset-password";
1123
660
  readonly RESEND_VERIFICATION: "/auth/resend-verification";
1124
661
  };
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
- */
662
+ /** Check if a URL matches a specific endpoint */
1132
663
  declare function isEndpoint(url: string, endpoint: string): boolean;
1133
664
 
1134
665
  interface ITab {
@@ -1136,6 +667,7 @@ interface ITab {
1136
667
  label: string;
1137
668
  icon: string;
1138
669
  route: string;
670
+ permission: string;
1139
671
  requiresCompanyFeature?: boolean;
1140
672
  }
1141
673
  /**
@@ -1147,14 +679,15 @@ interface ITab {
1147
679
  */
1148
680
  declare class AdministrationPageComponent {
1149
681
  private readonly appConfig;
682
+ private readonly permissionValidator;
1150
683
  /** All available tabs */
1151
684
  private readonly allTabs;
1152
685
  /** Check if company feature is enabled */
1153
686
  readonly companyFeatureEnabled: _angular_core.Signal<boolean>;
1154
- /** Visible tabs based on config */
687
+ /** Visible tabs based on config and permissions */
1155
688
  readonly visibleTabs: _angular_core.Signal<ITab[]>;
1156
- /** Dynamic subtitle based on visible features */
1157
- readonly subtitle: _angular_core.Signal<"Manage users, companies, and branches" | "Manage users">;
689
+ /** Dynamic subtitle based on visible tabs */
690
+ readonly subtitle: _angular_core.Signal<string>;
1158
691
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AdministrationPageComponent, never>;
1159
692
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AdministrationPageComponent, "lib-administration-page", never, {}, {}, never, never, true, never>;
1160
693
  }
@@ -1174,13 +707,15 @@ interface IBranchFormModel {
1174
707
  * Handles creating and editing branches.
1175
708
  * Defaults to current company context.
1176
709
  */
1177
- declare class BranchFormComponent implements OnInit {
710
+ declare class BranchFormComponent {
1178
711
  private readonly router;
1179
712
  private readonly route;
1180
713
  private readonly messageService;
1181
714
  private readonly branchService;
1182
715
  private readonly companyService;
1183
716
  private readonly authState;
717
+ private readonly routeParams;
718
+ private readonly queryParams;
1184
719
  /** Loading state */
1185
720
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1186
721
  /** Existing branch data when editing */
@@ -1195,10 +730,17 @@ declare class BranchFormComponent implements OnInit {
1195
730
  readonly branchForm: _angular_forms_signals.FieldTree<IBranchFormModel, string | number>;
1196
731
  /** Check if form is valid */
1197
732
  readonly isFormValid: _angular_core.Signal<boolean>;
1198
- ngOnInit(): void;
733
+ constructor();
1199
734
  loadBranch(id: string): Promise<void>;
735
+ private toFormModel;
1200
736
  generateSlug(): void;
1201
737
  onSubmit(): Promise<void>;
738
+ private updateBranch;
739
+ private createBranch;
740
+ private buildOptionalFields;
741
+ private onSaveSuccess;
742
+ private getTargetCompanyId;
743
+ private navigateToList;
1202
744
  onCancel(): void;
1203
745
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BranchFormComponent, never>;
1204
746
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<BranchFormComponent, "lib-branch-form", never, {}, {}, never, never, true, never>;
@@ -1209,7 +751,13 @@ declare class BranchFormComponent implements OnInit {
1209
751
  * Displays a list of branches for a company with CRUD operations.
1210
752
  * Defaults to current company context.
1211
753
  */
1212
- declare class BranchListComponent implements OnInit {
754
+ declare class BranchListComponent {
755
+ readonly BRANCH_PERMISSIONS: {
756
+ readonly CREATE: "branch.create";
757
+ readonly READ: "branch.read";
758
+ readonly UPDATE: "branch.update";
759
+ readonly DELETE: "branch.delete";
760
+ };
1213
761
  private readonly router;
1214
762
  private readonly route;
1215
763
  private readonly messageService;
@@ -1217,8 +765,10 @@ declare class BranchListComponent implements OnInit {
1217
765
  private readonly branchService;
1218
766
  private readonly companyService;
1219
767
  private readonly authState;
1220
- /** Selected company ID */
1221
- selectedCompanyId: string | null;
768
+ private readonly queryParamMap;
769
+ private initialized;
770
+ /** Selected company ID (signal for zoneless change detection) */
771
+ readonly selectedCompanyId: _angular_core.WritableSignal<string | null>;
1222
772
  /** Companies list for dropdown */
1223
773
  readonly companies: _angular_core.Signal<_flusys_ng_auth.ICompany[]>;
1224
774
  /** Branches from service */
@@ -1227,7 +777,7 @@ declare class BranchListComponent implements OnInit {
1227
777
  readonly isLoading: _angular_core.Signal<boolean>;
1228
778
  /** Total count from service */
1229
779
  readonly total: _angular_core.Signal<number>;
1230
- ngOnInit(): void;
780
+ constructor();
1231
781
  loadBranches(): void;
1232
782
  onCompanyChange(): void;
1233
783
  onLazyLoad(event: {
@@ -1255,11 +805,12 @@ interface ICompanyFormModel$1 {
1255
805
  * Company Form Component
1256
806
  * Handles creating and editing companies.
1257
807
  */
1258
- declare class CompanyFormComponent implements OnInit {
808
+ declare class CompanyFormComponent {
1259
809
  private readonly router;
1260
810
  private readonly route;
1261
811
  private readonly messageService;
1262
812
  private readonly companyService;
813
+ private readonly routeParams;
1263
814
  /** Loading state */
1264
815
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1265
816
  /** Existing company data when editing */
@@ -1272,11 +823,13 @@ declare class CompanyFormComponent implements OnInit {
1272
823
  readonly companyForm: _angular_forms_signals.FieldTree<ICompanyFormModel$1, string | number>;
1273
824
  /** Check if form is valid */
1274
825
  readonly isFormValid: _angular_core.Signal<boolean>;
1275
- ngOnInit(): void;
1276
- loadCompany(id: string): Promise<void>;
826
+ constructor();
827
+ private loadCompany;
1277
828
  generateSlug(): void;
1278
829
  onSubmit(): Promise<void>;
1279
830
  onCancel(): void;
831
+ /** Build company data from form model */
832
+ private buildCompanyData;
1280
833
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CompanyFormComponent, never>;
1281
834
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CompanyFormComponent, "lib-company-form", never, {}, {}, never, never, true, never>;
1282
835
  }
@@ -1286,7 +839,19 @@ declare class CompanyFormComponent implements OnInit {
1286
839
  * Displays a list of companies with CRUD operations.
1287
840
  * Only visible when company feature is enabled.
1288
841
  */
1289
- declare class CompanyListComponent implements OnInit {
842
+ declare class CompanyListComponent {
843
+ readonly COMPANY_PERMISSIONS: {
844
+ readonly CREATE: "company.create";
845
+ readonly READ: "company.read";
846
+ readonly UPDATE: "company.update";
847
+ readonly DELETE: "company.delete";
848
+ };
849
+ readonly BRANCH_PERMISSIONS: {
850
+ readonly CREATE: "branch.create";
851
+ readonly READ: "branch.read";
852
+ readonly UPDATE: "branch.update";
853
+ readonly DELETE: "branch.delete";
854
+ };
1290
855
  private readonly router;
1291
856
  private readonly messageService;
1292
857
  private readonly confirmationService;
@@ -1297,8 +862,6 @@ declare class CompanyListComponent implements OnInit {
1297
862
  readonly isLoading: _angular_core.Signal<boolean>;
1298
863
  /** Total count from service */
1299
864
  readonly total: _angular_core.Signal<number>;
1300
- ngOnInit(): void;
1301
- loadCompanies(): void;
1302
865
  onLazyLoad(event: {
1303
866
  first?: number | null;
1304
867
  rows?: number | null;
@@ -1325,31 +888,24 @@ declare class ForgotPasswordPageComponent {
1325
888
  readonly forgotForm: _angular_forms_signals.FieldTree<IForgotPasswordFormModel, string | number>;
1326
889
  readonly isFormValid: _angular_core.Signal<boolean>;
1327
890
  onSubmit(): void;
891
+ private showEmailSent;
1328
892
  resetForm(): void;
1329
893
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForgotPasswordPageComponent, never>;
1330
894
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ForgotPasswordPageComponent, "lib-forgot-password-page", never, {}, {}, never, never, true, never>;
1331
895
  }
1332
896
 
1333
- /** Login form model interface */
1334
897
  interface ILoginFormModel {
1335
898
  email: string;
1336
899
  password: string;
1337
900
  rememberMe: boolean;
1338
901
  }
1339
- /** Company selection form model interface */
1340
902
  interface ISelectionFormModel {
1341
903
  companyId: string;
1342
904
  branchId: string;
1343
905
  rememberSelection: boolean;
1344
906
  }
1345
907
  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 {
908
+ declare class LoginPageComponent {
1353
909
  private readonly destroyRef;
1354
910
  private readonly appConfig;
1355
911
  private readonly messageService;
@@ -1359,31 +915,22 @@ declare class LoginPageComponent implements OnInit {
1359
915
  readonly currentStep: _angular_core.WritableSignal<LoginStep>;
1360
916
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1361
917
  readonly unverifiedEmail: _angular_core.WritableSignal<string>;
1362
- /** Login form model */
1363
918
  readonly loginFormModel: _angular_core.WritableSignal<ILoginFormModel>;
1364
- /** Login form with validation schema */
1365
919
  readonly loginForm: _angular_forms_signals.FieldTree<ILoginFormModel, string | number>;
1366
- /** Check if login form is valid */
1367
920
  readonly isLoginFormValid: _angular_core.Signal<boolean>;
1368
- /** Selection form model */
1369
921
  readonly selectionFormModel: _angular_core.WritableSignal<ISelectionFormModel>;
1370
- /** Selection form with validation schema */
1371
922
  readonly selectionForm: _angular_forms_signals.FieldTree<ISelectionFormModel, string | number>;
1372
- /** Check if selection form is valid */
1373
923
  readonly isSelectionFormValid: _angular_core.Signal<boolean>;
1374
- /** Whether company feature is enabled */
1375
924
  readonly companyFeatureEnabled: _angular_core.Signal<boolean>;
1376
- /** Session ID for company selection */
925
+ readonly emailFeatureEnabled: _angular_core.Signal<boolean>;
926
+ readonly signUpEnabled: _angular_core.Signal<boolean>;
1377
927
  private sessionId;
1378
- /** Available companies */
1379
928
  readonly companies: _angular_core.WritableSignal<ICompanyWithBranches[]>;
1380
- /** User's name */
1381
929
  readonly userName: _angular_core.WritableSignal<string>;
1382
- /** Branches for selected company */
1383
930
  readonly branches: _angular_core.Signal<IBranchSelectionInfo[]>;
1384
- ngOnInit(): void;
931
+ constructor();
932
+ private restorePendingSelectionState;
1385
933
  onSubmit(): void;
1386
- /** Handle company selection change */
1387
934
  onCompanyChange(): void;
1388
935
  onSelectCompany(): void;
1389
936
  goBackToCredentials(): void;
@@ -1418,7 +965,7 @@ interface IPasswordFormModel {
1418
965
  * - Uses PROFILE_PERMISSION_PROVIDER (optional) for IAM functionality
1419
966
  * - No direct imports from ng-storage or ng-iam
1420
967
  */
1421
- declare class ProfilePageComponent implements OnInit {
968
+ declare class ProfilePageComponent {
1422
969
  private readonly destroyRef;
1423
970
  private readonly appConfig;
1424
971
  private readonly messageService;
@@ -1448,9 +995,11 @@ declare class ProfilePageComponent implements OnInit {
1448
995
  readonly showRoles: _angular_core.Signal<boolean>;
1449
996
  readonly showActions: _angular_core.Signal<boolean>;
1450
997
  readonly showBottomRow: _angular_core.Signal<boolean>;
998
+ private readonly originalFormModel;
1451
999
  readonly formModel: _angular_core.WritableSignal<IProfileFormModel>;
1452
1000
  readonly formTree: _angular_forms_signals.FieldTree<IProfileFormModel, string | number>;
1453
1001
  readonly isFormValid: _angular_core.Signal<boolean>;
1002
+ readonly isFormDirty: _angular_core.Signal<boolean>;
1454
1003
  readonly passwordModel: _angular_core.WritableSignal<IPasswordFormModel>;
1455
1004
  readonly isPasswordLoading: _angular_core.WritableSignal<boolean>;
1456
1005
  readonly isPasswordFormValid: _angular_core.Signal<boolean>;
@@ -1458,7 +1007,7 @@ declare class ProfilePageComponent implements OnInit {
1458
1007
  readonly uploadFileFn: UploadFileFn;
1459
1008
  /** Map upload result to IUploadedFile format */
1460
1009
  private mapUploadResultToUploadedFile;
1461
- ngOnInit(): void;
1010
+ constructor();
1462
1011
  private loadUserData;
1463
1012
  private loadPermissions;
1464
1013
  onProfilePictureUploaded(file: {
@@ -1490,7 +1039,7 @@ interface ICompanyFormModel {
1490
1039
  newCompanyPhone: string;
1491
1040
  newCompanyAddress: string;
1492
1041
  }
1493
- declare class RegisterPageComponent implements OnInit {
1042
+ declare class RegisterPageComponent {
1494
1043
  private readonly destroyRef;
1495
1044
  private readonly appConfig;
1496
1045
  private readonly messageService;
@@ -1498,16 +1047,22 @@ declare class RegisterPageComponent implements OnInit {
1498
1047
  private readonly authState;
1499
1048
  private readonly route;
1500
1049
  private readonly router;
1050
+ private readonly queryParamMap;
1051
+ private companySlugInitialized;
1501
1052
  readonly returnUrl: _angular_core.InputSignal<string>;
1502
1053
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1503
1054
  readonly companyFeatureEnabled: _angular_core.Signal<boolean>;
1055
+ readonly defaultCompanySlug: _angular_core.Signal<string | undefined>;
1056
+ readonly defaultBranchSlug: _angular_core.Signal<string | undefined>;
1057
+ readonly hasDefaultCompany: _angular_core.Signal<boolean>;
1058
+ readonly hasDefaultBranch: _angular_core.Signal<boolean>;
1504
1059
  readonly userFormModel: _angular_core.WritableSignal<IUserFormModel$1>;
1505
1060
  readonly userForm: _angular_forms_signals.FieldTree<IUserFormModel$1, string | number>;
1506
1061
  readonly companyFormModel: _angular_core.WritableSignal<ICompanyFormModel>;
1507
1062
  readonly companyForm: _angular_forms_signals.FieldTree<ICompanyFormModel, string | number>;
1508
1063
  readonly passwordsMatch: _angular_core.Signal<boolean>;
1509
1064
  readonly isFormValid: _angular_core.Signal<boolean>;
1510
- ngOnInit(): void;
1065
+ constructor();
1511
1066
  onCreateCompanyToggle(): void;
1512
1067
  onSubmit(): void;
1513
1068
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RegisterPageComponent, never>;
@@ -1519,11 +1074,13 @@ interface IResetPasswordFormModel {
1519
1074
  confirmPassword: string;
1520
1075
  }
1521
1076
  type PageState$1 = 'form' | 'success' | 'invalid-token';
1522
- declare class ResetPasswordPageComponent implements OnInit {
1077
+ declare class ResetPasswordPageComponent {
1523
1078
  private readonly destroyRef;
1524
1079
  private readonly route;
1525
1080
  private readonly messageService;
1526
1081
  private readonly authApi;
1082
+ private readonly queryParams;
1083
+ private tokenInitialized;
1527
1084
  private token;
1528
1085
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1529
1086
  readonly pageState: _angular_core.WritableSignal<PageState$1>;
@@ -1531,7 +1088,7 @@ declare class ResetPasswordPageComponent implements OnInit {
1531
1088
  readonly resetForm: _angular_forms_signals.FieldTree<IResetPasswordFormModel, string | number>;
1532
1089
  readonly passwordMismatch: _angular_core.Signal<boolean>;
1533
1090
  readonly canSubmit: _angular_core.Signal<boolean>;
1534
- ngOnInit(): void;
1091
+ constructor();
1535
1092
  onSubmit(): void;
1536
1093
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ResetPasswordPageComponent, never>;
1537
1094
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ResetPasswordPageComponent, "lib-reset-password-page", never, {}, {}, never, never, true, never>;
@@ -1551,7 +1108,7 @@ interface IUserFormModel {
1551
1108
  * Handles creating and editing users.
1552
1109
  * When company feature is enabled, automatically assigns new users to current company/branch.
1553
1110
  */
1554
- declare class UserFormComponent implements OnInit {
1111
+ declare class UserFormComponent {
1555
1112
  private readonly destroyRef;
1556
1113
  private readonly router;
1557
1114
  private readonly route;
@@ -1560,6 +1117,8 @@ declare class UserFormComponent implements OnInit {
1560
1117
  private readonly userService;
1561
1118
  private readonly permissionService;
1562
1119
  private readonly authState;
1120
+ private readonly routeParams;
1121
+ private userLoadTriggered;
1563
1122
  /** Loading state */
1564
1123
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1565
1124
  /** Existing user data when editing */
@@ -1578,9 +1137,13 @@ declare class UserFormComponent implements OnInit {
1578
1137
  readonly formTree: _angular_forms_signals.FieldTree<IUserFormModel, string | number>;
1579
1138
  /** Check if form is valid */
1580
1139
  readonly isFormValid: _angular_core.Signal<boolean>;
1581
- ngOnInit(): void;
1140
+ constructor();
1582
1141
  loadUser(id: string): void;
1142
+ private toFormModel;
1583
1143
  onSubmit(): void;
1144
+ private updateUser;
1145
+ private createUser;
1146
+ private onSaveSuccess;
1584
1147
  /**
1585
1148
  * Assign user to current company and branch
1586
1149
  */
@@ -1594,7 +1157,13 @@ declare class UserFormComponent implements OnInit {
1594
1157
  * User List Component
1595
1158
  * Displays a list of users with CRUD operations.
1596
1159
  */
1597
- declare class UserListComponent implements OnInit {
1160
+ declare class UserListComponent {
1161
+ readonly USER_PERMISSIONS: {
1162
+ readonly CREATE: "user.create";
1163
+ readonly READ: "user.read";
1164
+ readonly UPDATE: "user.update";
1165
+ readonly DELETE: "user.delete";
1166
+ };
1598
1167
  private readonly router;
1599
1168
  private readonly appConfig;
1600
1169
  private readonly messageService;
@@ -1613,7 +1182,6 @@ declare class UserListComponent implements OnInit {
1613
1182
  readonly showBranchDialog: _angular_core.WritableSignal<boolean>;
1614
1183
  /** Selected user for permission management */
1615
1184
  readonly selectedUser: _angular_core.WritableSignal<IUser | null>;
1616
- ngOnInit(): void;
1617
1185
  loadUsers(): void;
1618
1186
  onLazyLoad(event: {
1619
1187
  first?: number | null;
@@ -1623,6 +1191,7 @@ declare class UserListComponent implements OnInit {
1623
1191
  onEdit(user: IUser): void;
1624
1192
  onManageCompanyPermissions(user: IUser): void;
1625
1193
  onManageBranchPermissions(user: IUser): void;
1194
+ private openPermissionDialog;
1626
1195
  onDelete(user: IUser): void;
1627
1196
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserListComponent, never>;
1628
1197
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserListComponent, "lib-user-list", never, {}, {}, never, never, true, never>;
@@ -1632,13 +1201,15 @@ interface IResendFormModel {
1632
1201
  email: string;
1633
1202
  }
1634
1203
  type PageState = 'verifying' | 'success' | 'invalid-token' | 'resend';
1635
- declare class VerifyEmailPageComponent implements OnInit {
1204
+ declare class VerifyEmailPageComponent {
1636
1205
  private readonly platformId;
1637
1206
  private readonly transferState;
1638
1207
  private readonly destroyRef;
1639
1208
  private readonly route;
1640
1209
  private readonly messageService;
1641
1210
  private readonly authApi;
1211
+ private readonly queryParams;
1212
+ private verificationTriggered;
1642
1213
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1643
1214
  readonly pageState: _angular_core.WritableSignal<PageState>;
1644
1215
  readonly resendSuccess: _angular_core.WritableSignal<boolean>;
@@ -1646,7 +1217,7 @@ declare class VerifyEmailPageComponent implements OnInit {
1646
1217
  readonly resendFormModel: _angular_core.WritableSignal<IResendFormModel>;
1647
1218
  readonly resendForm: _angular_forms_signals.FieldTree<IResendFormModel, string | number>;
1648
1219
  readonly isResendFormValid: _angular_core.Signal<boolean>;
1649
- ngOnInit(): void;
1220
+ constructor();
1650
1221
  private verifyEmail;
1651
1222
  private handleVerificationResult;
1652
1223
  showResendForm(): void;
@@ -1656,52 +1227,27 @@ declare class VerifyEmailPageComponent implements OnInit {
1656
1227
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<VerifyEmailPageComponent, "lib-verify-email-page", never, {}, {}, never, never, true, never>;
1657
1228
  }
1658
1229
 
1659
- /**
1660
- * User Branch Permission Dialog
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
- */
1230
+ interface BranchWithAssignment extends IBranch {
1231
+ isAssigned: boolean;
1232
+ }
1671
1233
  declare class UserBranchPermissionDialogComponent {
1672
1234
  private readonly branchApi;
1673
1235
  private readonly permissionApi;
1674
- private readonly authState;
1675
1236
  private readonly messageService;
1676
- /** Dialog visibility */
1677
1237
  readonly visible: _angular_core.InputSignal<boolean>;
1678
- /** User to manage permissions for */
1679
1238
  readonly user: _angular_core.InputSignal<IUser | null>;
1680
- /** Close event */
1681
1239
  readonly closed: _angular_core.OutputEmitterRef<void>;
1682
- /** Refresh event after changes */
1683
1240
  readonly permissionsChanged: _angular_core.OutputEmitterRef<void>;
1684
- /** Loading state */
1685
1241
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1686
- /** Saving state */
1687
1242
  readonly isSaving: _angular_core.WritableSignal<boolean>;
1688
- /** Branches with assignment status */
1689
1243
  readonly branches: _angular_core.WritableSignal<BranchWithAssignment[]>;
1690
- /** Available companies (filtered by user's company permissions) */
1691
1244
  readonly companies: _angular_core.WritableSignal<{
1692
1245
  id: string;
1693
1246
  name: string;
1694
1247
  }[]>;
1695
- /** Selected company ID */
1696
1248
  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
1249
  private assignedBranchIds;
1701
1250
  constructor();
1702
- /**
1703
- * Load user's assigned companies (does not auto-select or load branches)
1704
- */
1705
1251
  private loadUserCompaniesAndData;
1706
1252
  private loadData;
1707
1253
  onCompanyChange(): void;
@@ -1710,35 +1256,21 @@ declare class UserBranchPermissionDialogComponent {
1710
1256
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserBranchPermissionDialogComponent, never>;
1711
1257
  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
1258
  }
1713
- interface BranchWithAssignment extends IBranch {
1259
+
1260
+ interface CompanyWithAssignment extends ICompany {
1714
1261
  isAssigned: boolean;
1715
1262
  }
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
1263
  declare class UserCompanyPermissionDialogComponent {
1724
1264
  private readonly companyApi;
1725
1265
  private readonly permissionApi;
1726
1266
  private readonly messageService;
1727
- /** Dialog visibility */
1728
1267
  readonly visible: _angular_core.InputSignal<boolean>;
1729
- /** User to manage permissions for */
1730
1268
  readonly user: _angular_core.InputSignal<IUser | null>;
1731
- /** Close event */
1732
1269
  readonly closed: _angular_core.OutputEmitterRef<void>;
1733
- /** Refresh event after changes */
1734
1270
  readonly permissionsChanged: _angular_core.OutputEmitterRef<void>;
1735
- /** Loading state */
1736
1271
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1737
- /** Saving state */
1738
1272
  readonly isSaving: _angular_core.WritableSignal<boolean>;
1739
- /** Companies with assignment status */
1740
1273
  readonly companies: _angular_core.WritableSignal<CompanyWithAssignment[]>;
1741
- /** Currently assigned company IDs */
1742
1274
  private assignedCompanyIds;
1743
1275
  constructor();
1744
1276
  private loadData;
@@ -1747,9 +1279,6 @@ declare class UserCompanyPermissionDialogComponent {
1747
1279
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserCompanyPermissionDialogComponent, never>;
1748
1280
  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
1281
  }
1750
- interface CompanyWithAssignment extends ICompany {
1751
- isAssigned: boolean;
1752
- }
1753
1282
 
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, isAuthEndpoint, isCompanySelectionResponse, isEmailVerificationRequired, isEndpoint, isLoginResponse, provideAuthLayoutIntegration, provideAuthProviders, tokenRefreshInterceptor };
1283
+ 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, emailFeatureGuard, guestGuard, isCompanySelectionResponse, isEmailVerificationRequired, isEndpoint, isLoginResponse, provideAuthLayoutIntegration, provideAuthProviders, signUpFeatureGuard, tokenRefreshInterceptor };
1755
1284
  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 };