@flusys/ng-auth 1.0.0-rc → 1.0.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,4 +1,4 @@
1
- import { IMessageResponse, ApiResourceService, ISingleResponse, IUserProvider, IListResponse, IUserBasicInfo, ICompanyApiProvider, ICompanyBasicInfo, IUserPermissionProvider, IAuthStateProvider, 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';
@@ -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,6 +384,7 @@ declare class AuthInitService {
519
384
  declare class AuthStateService {
520
385
  private readonly appConfig;
521
386
  private readonly router;
387
+ private readonly platform;
522
388
  private readonly _user;
523
389
  private readonly _accessToken;
524
390
  private readonly _tokenExpiresAt;
@@ -534,7 +400,6 @@ declare class AuthStateService {
534
400
  private readonly _selectionExpiresAt;
535
401
  readonly selectionSessionId: _angular_core.Signal<string | null>;
536
402
  readonly availableCompanies: _angular_core.Signal<ICompanyWithBranches[]>;
537
- readonly selectionExpiresAt: _angular_core.Signal<Date | null>;
538
403
  readonly isAuthenticated: _angular_core.Signal<boolean>;
539
404
  readonly requiresCompanySelection: _angular_core.Signal<boolean>;
540
405
  readonly userName: _angular_core.Signal<string>;
@@ -545,10 +410,6 @@ declare class AuthStateService {
545
410
  * Used to proactively refresh token before requests fail.
546
411
  */
547
412
  readonly isTokenExpired: _angular_core.Signal<boolean>;
548
- /**
549
- * Check if we need to refresh on app load (token expired but refresh cookie may exist)
550
- */
551
- readonly needsRefreshOnLoad: _angular_core.Signal<boolean>;
552
413
  readonly tenantId: _angular_core.Signal<string | null>;
553
414
  constructor();
554
415
  setLoginState(response: ILoginResponse): void;
@@ -581,45 +442,11 @@ declare class AuthStateService {
581
442
  /**
582
443
  * Branch API Service
583
444
  * Signal-based service for branch CRUD operations
584
- * Branches default to current company context
585
- *
586
- * @example
587
- * ```typescript
588
- * branchService = inject(BranchApiService);
589
- *
590
- * // Set current company context
591
- * branchService.setCurrentCompanyId('company-uuid');
592
- *
593
- * // Access data via signals
594
- * branches = this.branchService.data;
595
- * isLoading = this.branchService.isLoading;
596
- *
597
- * // Fetch branches (will filter by current company)
598
- * this.branchService.fetchList('search');
599
- *
600
- * // Create branch (companyId will be auto-set if not provided)
601
- * await this.branchService.insertBranch({ name: 'New Branch', slug: 'new-branch' });
602
- * ```
603
445
  */
604
446
  declare class BranchApiService extends ApiResourceService<ICreateBranchRequest | IUpdateBranchRequest, IBranch> {
605
- /** Current company context for branch operations */
606
- readonly currentCompanyId: _angular_core.WritableSignal<string | null>;
607
- /** Branches filtered by current company */
608
- readonly companyBranches: _angular_core.Signal<IBranch[]>;
447
+ private readonly _currentCompanyId;
609
448
  constructor(http: HttpClient);
610
- /**
611
- * Set the current company context for branch operations
612
- */
613
449
  setCurrentCompanyId(companyId: string | null): void;
614
- /**
615
- * Insert a new branch, auto-setting companyId if not provided
616
- */
617
- insertBranch(data: Omit<ICreateBranchRequest, 'companyId'> & {
618
- companyId?: string;
619
- }): Promise<ReturnType<typeof this.insertAsync>>;
620
- /**
621
- * Fetch branches for a specific company
622
- */
623
450
  fetchByCompany(companyId: string, search?: string): void;
624
451
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BranchApiService, never>;
625
452
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<BranchApiService>;
@@ -628,21 +455,6 @@ declare class BranchApiService extends ApiResourceService<ICreateBranchRequest |
628
455
  /**
629
456
  * Company API Service
630
457
  * Signal-based service for company CRUD operations
631
- *
632
- * @example
633
- * ```typescript
634
- * companyService = inject(CompanyApiService);
635
- *
636
- * // Access data via signals
637
- * companies = this.companyService.data;
638
- * isLoading = this.companyService.isLoading;
639
- *
640
- * // Fetch companies
641
- * this.companyService.fetchList('search', { pagination: { currentPage: 0, pageSize: 10 } });
642
- *
643
- * // Create company
644
- * await this.companyService.insertAsync({ name: 'New Company', slug: 'new-company' });
645
- * ```
646
458
  */
647
459
  declare class CompanyApiService extends ApiResourceService<ICreateCompanyRequest | IUpdateCompanyRequest, ICompany> {
648
460
  constructor(http: HttpClient);
@@ -652,46 +464,16 @@ declare class CompanyApiService extends ApiResourceService<ICreateCompanyRequest
652
464
 
653
465
  /**
654
466
  * Token Refresh State Service
655
- *
656
- * Manages token refresh state in a request-safe manner for SSR environments.
657
- * Replaces module-level state that would be shared across requests in SSR.
658
- *
659
- * NOTE: Uses BehaviorSubject intentionally for RxJS interoperability.
660
- * The HTTP interceptor needs to queue concurrent requests and have them
661
- * wait for the new token via Observable subscription. This is a valid
662
- * pattern that signals cannot replicate directly (no multi-subscriber
663
- * async coordination). Signal is used for the boolean flag only.
664
- *
665
- * @example
666
- * ```typescript
667
- * const refreshState = inject(TokenRefreshStateService);
668
- *
669
- * if (refreshState.isRefreshing()) {
670
- * // Queue request via refreshTokenSubject$
671
- * } else {
672
- * refreshState.startRefresh();
673
- * // Perform refresh
674
- * }
675
- * ```
467
+ * Manages token refresh state for SSR-safe request queuing.
468
+ * Uses BehaviorSubject for RxJS interop (multi-subscriber async coordination).
676
469
  */
677
470
  declare class TokenRefreshStateService {
678
- /** Flag to track if token refresh is in progress */
679
471
  private readonly _isRefreshing;
680
472
  readonly isRefreshing: _angular_core.Signal<boolean>;
681
- /** Subject to queue requests while refreshing */
682
473
  private readonly _refreshTokenSubject;
683
474
  readonly refreshTokenSubject$: rxjs.Observable<string | null>;
684
- /**
685
- * Mark refresh as started
686
- */
687
475
  startRefresh(): void;
688
- /**
689
- * Mark refresh as completed and broadcast new token
690
- */
691
476
  completeRefresh(newToken: string): void;
692
- /**
693
- * Mark refresh as failed
694
- */
695
477
  failRefresh(): void;
696
478
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TokenRefreshStateService, never>;
697
479
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<TokenRefreshStateService>;
@@ -700,43 +482,9 @@ declare class TokenRefreshStateService {
700
482
  /**
701
483
  * User API Service
702
484
  * Signal-based service for user CRUD operations
703
- *
704
- * @example
705
- * ```typescript
706
- * userService = inject(UserApiService);
707
- *
708
- * // Access data via signals
709
- * users = this.userService.data;
710
- * isLoading = this.userService.isLoading;
711
- *
712
- * // Fetch users
713
- * this.userService.fetchList('search', { pagination: { currentPage: 0, pageSize: 10 } });
714
- *
715
- * // Create user
716
- * await this.userService.insertAsync({
717
- * name: 'John Doe',
718
- * email: 'john@example.com',
719
- * password: 'password123'
720
- * });
721
- * ```
722
485
  */
723
486
  declare class UserApiService extends ApiResourceService<ICreateUserRequest | IUpdateUserRequest, IUser> {
724
487
  constructor(http: HttpClient);
725
- /**
726
- * Verify user's email
727
- */
728
- verifyEmail(userId: string): Observable<IMessageResponse>;
729
- /**
730
- * Verify user's phone
731
- */
732
- verifyPhone(userId: string): Observable<IMessageResponse>;
733
- /**
734
- * Update user status (active/inactive)
735
- */
736
- updateStatus(userId: string, isActive: boolean): Observable<IMessageResponse>;
737
- /**
738
- * Update current user's profile
739
- */
740
488
  updateProfile(data: IUpdateUserRequest): Observable<ISingleResponse<IUser>>;
741
489
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserApiService, never>;
742
490
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<UserApiService>;
@@ -744,167 +492,29 @@ declare class UserApiService extends ApiResourceService<ICreateUserRequest | IUp
744
492
 
745
493
  /**
746
494
  * User Permission API Service
747
- *
748
495
  * Handles user-company and user-branch permission assignments.
749
- * Uses batch operations for efficient permission management.
750
- *
751
- * Backend Endpoints (POST-only RPC):
752
- * - POST /administration/permissions/user-company/assign - Batch assign/revoke company permissions
753
- * - POST /administration/permissions/get-user-company - Get user's companies
754
- * - POST /administration/permissions/user-branch/assign - Batch assign/revoke branch permissions
755
- * - POST /administration/permissions/get-user-branch - Get user's branches
756
496
  */
757
497
  declare class UserPermissionApiService {
758
498
  private readonly appConfig;
759
499
  private readonly http;
760
500
  private readonly baseUrl;
761
- constructor();
762
- /**
763
- * Batch assign/revoke user-company permissions
764
- *
765
- * @example
766
- * // Add company permissions
767
- * service.assignUserCompanies({
768
- * userId: 'user-id',
769
- * items: [
770
- * { targetId: 'company-1', isAdd: true },
771
- * { targetId: 'company-2', isAdd: true }
772
- * ]
773
- * });
774
- *
775
- * @example
776
- * // Remove company permissions
777
- * service.assignUserCompanies({
778
- * userId: 'user-id',
779
- * items: [
780
- * { targetId: 'company-1', isAdd: false }
781
- * ]
782
- * });
783
- */
784
501
  assignUserCompanies(data: IAssignUserCompanyRequest): Observable<IBatchOperationResponse>;
785
- /**
786
- * Assign single company to user (convenience method)
787
- */
788
502
  assignUserToCompany(userId: string, companyId: string): Observable<IBatchOperationResponse>;
789
- /**
790
- * Revoke single company from user (convenience method)
791
- */
792
503
  revokeUserFromCompany(userId: string, companyId: string): Observable<IBatchOperationResponse>;
793
- /**
794
- * Get user's company permissions
795
- *
796
- * @param userId - User ID to get companies for
797
- * @returns Observable with user's company permissions
798
- */
799
504
  getUserCompanies(userId: string): Observable<IUserCompaniesResponse>;
800
- /**
801
- * Batch assign/revoke user-branch permissions
802
- *
803
- * @example
804
- * // Add branch permissions
805
- * service.assignUserBranches({
806
- * userId: 'user-id',
807
- * items: [
808
- * { targetId: 'branch-1', isAdd: true },
809
- * { targetId: 'branch-2', isAdd: true }
810
- * ]
811
- * });
812
- *
813
- * @example
814
- * // Remove branch permissions
815
- * service.assignUserBranches({
816
- * userId: 'user-id',
817
- * items: [
818
- * { targetId: 'branch-1', isAdd: false }
819
- * ]
820
- * });
821
- */
822
505
  assignUserBranches(data: IAssignUserBranchRequest): Observable<IBatchOperationResponse>;
823
- /**
824
- * Assign single branch to user (convenience method)
825
- */
826
506
  assignUserToBranch(userId: string, branchId: string): Observable<IBatchOperationResponse>;
827
- /**
828
- * Revoke single branch from user (convenience method)
829
- */
830
507
  revokeUserFromBranch(userId: string, branchId: string): Observable<IBatchOperationResponse>;
831
- /**
832
- * Get user's branch permissions
833
- *
834
- * @param userId - User ID to get branches for
835
- * @returns Observable with user's branch permissions
836
- */
837
- getUserBranches(userId: string): Observable<IUserBranchesResponse>;
508
+ getUserBranches(userId: string, companyId?: string): Observable<IUserBranchesResponse>;
838
509
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserPermissionApiService, never>;
839
510
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<UserPermissionApiService>;
840
511
  }
841
512
 
842
- /**
843
- * Auth Guard
844
- * Protects routes that require authentication.
845
- *
846
- * Session restoration is handled by guestGuard. This guard assumes
847
- * the session has already been restored if user accessed login page first.
848
- *
849
- * Handles company feature:
850
- * - If company feature enabled and no company selected, redirects to login
851
- * (login page handles company selection as step 2)
852
- * - If not authenticated, redirects to login
853
- *
854
- * @example
855
- * ```typescript
856
- * // In routes configuration
857
- * {
858
- * path: 'dashboard',
859
- * loadComponent: () => import('./dashboard.component'),
860
- * canActivate: [authGuard]
861
- * }
862
- * ```
863
- */
513
+ /** Protects routes requiring authentication */
864
514
  declare const authGuard: CanActivateFn;
865
- /**
866
- * Guest Guard
867
- * Protects auth routes (login, register) from authenticated users.
868
- * Redirects authenticated users to home page.
869
- *
870
- * CRITICAL: Unlike old implementation, this guard RESTORES the session first
871
- * before checking authentication. This handles the case when users directly
872
- * navigate to /auth/login via browser URL while having valid refresh token.
873
- *
874
- * Flow:
875
- * 1. Restore session (if needed) via AuthInitService.initialize()
876
- * 2. Check if user is authenticated
877
- * 3. If authenticated -> redirect to dashboard
878
- * 4. If not authenticated -> allow access to login page
879
- *
880
- * @example
881
- * ```typescript
882
- * // In routes configuration
883
- * {
884
- * path: 'auth/login',
885
- * loadComponent: () => import('./login.component'),
886
- * canActivate: [guestGuard]
887
- * }
888
- * ```
889
- */
515
+ /** Protects auth routes from authenticated users, restores session first */
890
516
  declare const guestGuard: CanActivateFn;
891
- /**
892
- * Company Feature Guard
893
- * Protects routes that require company feature to be enabled.
894
- * Redirects to home if company feature is disabled.
895
- *
896
- * Use this guard on company/branch management routes.
897
- *
898
- * @example
899
- * ```typescript
900
- * // In routes configuration
901
- * {
902
- * path: 'administration/company',
903
- * loadComponent: () => import('./company-list.component'),
904
- * canActivate: [authGuard, companyFeatureGuard]
905
- * }
906
- * ```
907
- */
517
+ /** Protects routes requiring company feature to be enabled */
908
518
  declare const companyFeatureGuard: CanActivateFn;
909
519
 
910
520
  /**
@@ -912,34 +522,7 @@ declare const companyFeatureGuard: CanActivateFn;
912
522
  */
913
523
  declare function authInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
914
524
 
915
- /**
916
- * Token Refresh Interceptor
917
- * Handles token refresh both proactively and reactively.
918
- *
919
- * PROACTIVE REFRESH:
920
- * - Checks token expiry BEFORE making requests
921
- * - Refreshes token if expired or expiring soon (within 30 seconds)
922
- * - Prevents unnecessary 401 failures
923
- *
924
- * REACTIVE REFRESH:
925
- * - Still handles 401 errors as fallback
926
- * - Queues concurrent requests during refresh
927
- * - Redirects to login on refresh failure
928
- *
929
- * SECURITY:
930
- * - Token kept in memory only (not localStorage)
931
- * - Uses HTTP-only refresh token cookie
932
- * - SSR-safe: Uses injectable service
933
- *
934
- * @example
935
- * ```typescript
936
- * // In app.config.ts
937
- * provideHttpClient(
938
- * withFetch(),
939
- * withInterceptors([authInterceptor, tokenRefreshInterceptor])
940
- * )
941
- * ```
942
- */
525
+ /** Token Refresh Interceptor - Proactive and reactive token refresh with request queuing */
943
526
  declare function tokenRefreshInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
944
527
 
945
528
  /**
@@ -962,86 +545,49 @@ declare const ADMINISTRATION_ROUTES: Routes;
962
545
  declare const PROFILE_ROUTES: Routes;
963
546
 
964
547
  /**
965
- * Auth Layout State Adapter
966
- * Bridges AuthStateService signals to ILayoutAuthState interface.
967
- * Provides ready-to-use integration between ng-auth, ng-layout, and ng-shared provider tokens.
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()]
968
557
  */
969
558
  declare class AuthLayoutStateAdapter implements ILayoutAuthState {
970
559
  private readonly authState;
971
- /**
972
- * Maps company info to company info for layout.
973
- * Falls back to app name from config when no company is selected.
974
- */
975
560
  readonly currentCompanyInfo: Signal<ICompanyInfo$1 | null>;
976
- /**
977
- * Maps branch info to branch info for layout.
978
- * Returns null when no branch is selected.
979
- */
980
561
  readonly currentBranchInfo: Signal<IBranchInfo$1 | null>;
981
- /**
982
- * Maps user info from auth state to layout user info.
983
- * Profile picture URL is managed separately by AuthLayoutSyncService via FileUrlService.
984
- */
985
562
  readonly loginUserData: Signal<IUserInfo$1 | null>;
986
563
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthLayoutStateAdapter, never>;
987
564
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthLayoutStateAdapter>;
988
565
  }
989
- /**
990
- * Auth Layout API Adapter
991
- * Bridges AuthApiService to ILayoutAuthApi interface.
992
- * Handles logout and navigation for layout components.
993
- */
994
566
  declare class AuthLayoutApiAdapter implements ILayoutAuthApi {
995
567
  private readonly authApi;
996
568
  private readonly authState;
997
569
  private readonly permissionApi;
998
570
  private readonly router;
999
- /**
1000
- * Logout the current user.
1001
- * Calls backend logout endpoint and resets local auth state.
1002
- * Auth state reset handles clearing all localStorage including company/branch.
1003
- */
1004
571
  logOut(): Observable<any>;
1005
- /**
1006
- * Navigate to login page.
1007
- * Optionally preserves current URL as return URL.
1008
- */
1009
572
  navigateLogin(withUrl?: boolean): void;
1010
- /**
1011
- * Switch to a different company and branch.
1012
- * Calls backend switch endpoint, then triggers full page reload to
1013
- * refresh permissions, reset component state, and re-filter all data.
1014
- */
1015
573
  switchCompany(companyId: string, branchId: string): Observable<any>;
1016
- /**
1017
- * Get list of companies the logged-in user has permissions for.
1018
- * Uses permission API to filter by user's actual company-level permissions.
1019
- */
1020
574
  getUserCompanies(): Observable<ICompanyInfo$1[]>;
1021
- /**
1022
- * Get branches for a specific company that the logged-in user has access to.
1023
- * Fetches all user branches and filters by companyId.
1024
- */
1025
575
  getCompanyBranches(companyId: string): Observable<IBranchInfo$1[]>;
1026
576
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthLayoutApiAdapter, never>;
1027
577
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthLayoutApiAdapter>;
1028
578
  }
1029
579
 
1030
580
  /**
1031
- * Auth User Provider Adapter
581
+ * Auth Shared Provider Adapters
1032
582
  *
1033
- * Implements IUserProvider interface from ng-shared using UserApiService from ng-auth.
1034
- * This allows IAM and other packages to access user data without depending on ng-auth directly.
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.
1035
586
  *
1036
587
  * @example
1037
588
  * // In app.config.ts
1038
- * providers: [
1039
- * { provide: USER_PROVIDER, useClass: AuthUserProviderAdapter }
1040
- * ]
1041
- *
1042
- * // In IAM component
1043
- * private readonly userProvider = inject(USER_PROVIDER);
1044
- * this.userProvider.getUsers({ page: 0, pageSize: 50 }).subscribe(...);
589
+ * import { provideAuthProviders } from '@flusys/ng-auth';
590
+ * providers: [...provideAuthProviders()]
1045
591
  */
1046
592
  declare class AuthUserProviderAdapter implements IUserProvider {
1047
593
  private readonly userApi;
@@ -1057,19 +603,6 @@ declare class AuthUserProviderAdapter implements IUserProvider {
1057
603
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthUserProviderAdapter, never>;
1058
604
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthUserProviderAdapter>;
1059
605
  }
1060
-
1061
- /**
1062
- * Auth Company API Provider Adapter
1063
- *
1064
- * Implements ICompanyApiProvider interface from ng-shared using CompanyApiService.
1065
- * Allows IAM package to access company data without depending on ng-auth directly.
1066
- *
1067
- * @example
1068
- * // In app.config.ts
1069
- * providers: [
1070
- * { provide: COMPANY_API_PROVIDER, useClass: AuthCompanyApiProviderAdapter }
1071
- * ]
1072
- */
1073
606
  declare class AuthCompanyApiProviderAdapter implements ICompanyApiProvider {
1074
607
  private readonly companyApi;
1075
608
  getCompanies(filter?: {
@@ -1080,97 +613,25 @@ declare class AuthCompanyApiProviderAdapter implements ICompanyApiProvider {
1080
613
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthCompanyApiProviderAdapter, never>;
1081
614
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthCompanyApiProviderAdapter>;
1082
615
  }
1083
-
1084
- /**
1085
- * Auth User Permission Provider Adapter
1086
- *
1087
- * Implements IUserPermissionProvider interface from ng-shared using UserPermissionApiService.
1088
- * Allows IAM package to query user permissions without depending on ng-auth directly.
1089
- *
1090
- * @example
1091
- * // In app.config.ts
1092
- * providers: [
1093
- * { provide: USER_PERMISSION_PROVIDER, useClass: AuthUserPermissionProviderAdapter }
1094
- * ]
1095
- */
1096
616
  declare class AuthUserPermissionProviderAdapter implements IUserPermissionProvider {
1097
617
  private readonly userPermissionApi;
1098
- getUserBranchPermissions(userId: string): Observable<ISingleResponse<any>>;
618
+ getUserBranchPermissions(userId: string, companyId?: string): Observable<ISingleResponse<any>>;
1099
619
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthUserPermissionProviderAdapter, never>;
1100
620
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthUserPermissionProviderAdapter>;
1101
621
  }
1102
-
1103
- /**
1104
- * Auth State Provider Adapter
1105
- *
1106
- * Implements IAuthStateProvider interface from ng-shared using auth services from ng-auth.
1107
- * This allows feature packages (form-builder, etc.) to check auth state without
1108
- * depending on ng-auth directly.
1109
- *
1110
- * @example
1111
- * // In app.config.ts
1112
- * providers: [
1113
- * { provide: AUTH_STATE_PROVIDER, useClass: AuthStateProviderAdapter }
1114
- * ]
1115
- *
1116
- * // In form-builder component
1117
- * private readonly authStateProvider = inject(AUTH_STATE_PROVIDER);
1118
- * const isLoggedIn = this.authStateProvider.isAuthenticated();
1119
- */
1120
622
  declare class AuthStateProviderAdapter implements IAuthStateProvider {
1121
623
  private readonly authState;
1122
624
  private readonly authInit;
1123
- /**
1124
- * Signal indicating if user is currently authenticated
1125
- */
1126
625
  get isAuthenticated(): Signal<boolean>;
1127
- /**
1128
- * Initialize auth state (restore session from cookies/storage)
1129
- * Returns Observable<void> that completes when initialization is done
1130
- */
1131
626
  initialize(): Observable<void>;
1132
627
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthStateProviderAdapter, never>;
1133
628
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthStateProviderAdapter>;
1134
629
  }
1135
630
 
1136
- /**
1137
- * Provides auth layout integration for ng-layout.
1138
- * Call this in your app.config.ts to integrate ng-auth with ng-layout.
1139
- *
1140
- * Also registers LAYOUT_AUTH_STATE since AuthLayoutStateAdapter
1141
- * implements both ILayoutAuthState and ICompanyContextProvider.
1142
- *
1143
- * @example
1144
- * ```typescript
1145
- * // In app.config.ts
1146
- * export const appConfig: ApplicationConfig = {
1147
- * providers: [
1148
- * ...provideAuthLayoutIntegration(),
1149
- * ],
1150
- * };
1151
- * ```
1152
- */
631
+ /** Provides auth integration for ng-layout */
1153
632
  declare function provideAuthLayoutIntegration(): Provider[];
1154
633
 
1155
- /**
1156
- * Provide Auth Provider Adapters
1157
- *
1158
- * Registers auth implementations for provider interfaces from ng-shared.
1159
- * This allows IAM and Storage packages to use auth services without direct dependencies.
1160
- *
1161
- * @example
1162
- * // In app.config.ts
1163
- * import { provideAuthProviders } from '@flusys/ng-auth';
1164
- *
1165
- * export const appConfig: ApplicationConfig = {
1166
- * providers: [
1167
- * provideAuthProviders(),
1168
- * // ... other providers
1169
- * ]
1170
- * };
1171
- *
1172
- * @returns Array of Angular providers
1173
- */
634
+ /** Provides auth implementations for ng-shared provider interfaces */
1174
635
  declare function provideAuthProviders(): Provider[];
1175
636
 
1176
637
  /**
@@ -1178,33 +639,22 @@ declare function provideAuthProviders(): Provider[];
1178
639
  *
1179
640
  * Centralized endpoint definitions to prevent inconsistencies across interceptors
1180
641
  * and services. All auth-related endpoints should be referenced from here.
1181
- *
1182
- * @example
1183
- * ```typescript
1184
- * if (isAuthEndpoint(req.url)) {
1185
- * // Skip interceptor logic
1186
- * }
1187
- * ```
1188
642
  */
1189
643
  declare const AUTH_ENDPOINTS: {
1190
644
  readonly LOGIN: "/auth/login";
1191
645
  readonly LOGOUT: "/auth/logout";
1192
646
  readonly REFRESH: "/auth/refresh";
1193
647
  readonly REGISTER: "/auth/register";
648
+ readonly ME: "/auth/me";
1194
649
  readonly SELECT: "/auth/select";
1195
650
  readonly SWITCH_COMPANY: "/auth/switch-company";
651
+ readonly CHANGE_PASSWORD: "/auth/change-password";
1196
652
  readonly VERIFY_EMAIL: "/auth/verify-email";
1197
653
  readonly FORGOT_PASSWORD: "/auth/forgot-password";
1198
654
  readonly RESET_PASSWORD: "/auth/reset-password";
1199
655
  readonly RESEND_VERIFICATION: "/auth/resend-verification";
1200
656
  };
1201
- /**
1202
- * Check if a URL is an auth-related endpoint
1203
- */
1204
- declare function isAuthEndpoint(url: string): boolean;
1205
- /**
1206
- * Check if a URL is a specific auth endpoint
1207
- */
657
+ /** Check if a URL matches a specific endpoint */
1208
658
  declare function isEndpoint(url: string, endpoint: string): boolean;
1209
659
 
1210
660
  interface ITab {
@@ -1212,6 +662,7 @@ interface ITab {
1212
662
  label: string;
1213
663
  icon: string;
1214
664
  route: string;
665
+ permission: string;
1215
666
  requiresCompanyFeature?: boolean;
1216
667
  }
1217
668
  /**
@@ -1223,14 +674,15 @@ interface ITab {
1223
674
  */
1224
675
  declare class AdministrationPageComponent {
1225
676
  private readonly appConfig;
677
+ private readonly permissionValidator;
1226
678
  /** All available tabs */
1227
679
  private readonly allTabs;
1228
680
  /** Check if company feature is enabled */
1229
681
  readonly companyFeatureEnabled: _angular_core.Signal<boolean>;
1230
- /** Visible tabs based on config */
682
+ /** Visible tabs based on config and permissions */
1231
683
  readonly visibleTabs: _angular_core.Signal<ITab[]>;
1232
- /** Dynamic subtitle based on visible features */
1233
- readonly subtitle: _angular_core.Signal<"Manage users, companies, and branches" | "Manage users">;
684
+ /** Dynamic subtitle based on visible tabs */
685
+ readonly subtitle: _angular_core.Signal<string>;
1234
686
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AdministrationPageComponent, never>;
1235
687
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AdministrationPageComponent, "lib-administration-page", never, {}, {}, never, never, true, never>;
1236
688
  }
@@ -1275,8 +727,15 @@ declare class BranchFormComponent {
1275
727
  readonly isFormValid: _angular_core.Signal<boolean>;
1276
728
  constructor();
1277
729
  loadBranch(id: string): Promise<void>;
730
+ private toFormModel;
1278
731
  generateSlug(): void;
1279
732
  onSubmit(): Promise<void>;
733
+ private updateBranch;
734
+ private createBranch;
735
+ private buildOptionalFields;
736
+ private onSaveSuccess;
737
+ private getTargetCompanyId;
738
+ private navigateToList;
1280
739
  onCancel(): void;
1281
740
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BranchFormComponent, never>;
1282
741
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<BranchFormComponent, "lib-branch-form", never, {}, {}, never, never, true, never>;
@@ -1360,10 +819,12 @@ declare class CompanyFormComponent {
1360
819
  /** Check if form is valid */
1361
820
  readonly isFormValid: _angular_core.Signal<boolean>;
1362
821
  constructor();
1363
- loadCompany(id: string): Promise<void>;
822
+ private loadCompany;
1364
823
  generateSlug(): void;
1365
824
  onSubmit(): Promise<void>;
1366
825
  onCancel(): void;
826
+ /** Build company data from form model */
827
+ private buildCompanyData;
1367
828
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CompanyFormComponent, never>;
1368
829
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CompanyFormComponent, "lib-company-form", never, {}, {}, never, never, true, never>;
1369
830
  }
@@ -1396,7 +857,6 @@ declare class CompanyListComponent {
1396
857
  readonly isLoading: _angular_core.Signal<boolean>;
1397
858
  /** Total count from service */
1398
859
  readonly total: _angular_core.Signal<number>;
1399
- loadCompanies(): void;
1400
860
  onLazyLoad(event: {
1401
861
  first?: number | null;
1402
862
  rows?: number | null;
@@ -1423,30 +883,23 @@ declare class ForgotPasswordPageComponent {
1423
883
  readonly forgotForm: _angular_forms_signals.FieldTree<IForgotPasswordFormModel, string | number>;
1424
884
  readonly isFormValid: _angular_core.Signal<boolean>;
1425
885
  onSubmit(): void;
886
+ private showEmailSent;
1426
887
  resetForm(): void;
1427
888
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForgotPasswordPageComponent, never>;
1428
889
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ForgotPasswordPageComponent, "lib-forgot-password-page", never, {}, {}, never, never, true, never>;
1429
890
  }
1430
891
 
1431
- /** Login form model interface */
1432
892
  interface ILoginFormModel {
1433
893
  email: string;
1434
894
  password: string;
1435
895
  rememberMe: boolean;
1436
896
  }
1437
- /** Company selection form model interface */
1438
897
  interface ISelectionFormModel {
1439
898
  companyId: string;
1440
899
  branchId: string;
1441
900
  rememberSelection: boolean;
1442
901
  }
1443
902
  type LoginStep = 'credentials' | 'company-selection' | 'email-verification';
1444
- /**
1445
- * Login Page Component
1446
- * Multi-step authentication flow:
1447
- * - Step 1: Email/Password credentials
1448
- * - Step 2: Company/Branch selection (when company feature enabled and user has multiple)
1449
- */
1450
903
  declare class LoginPageComponent {
1451
904
  private readonly destroyRef;
1452
905
  private readonly appConfig;
@@ -1457,36 +910,20 @@ declare class LoginPageComponent {
1457
910
  readonly currentStep: _angular_core.WritableSignal<LoginStep>;
1458
911
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1459
912
  readonly unverifiedEmail: _angular_core.WritableSignal<string>;
1460
- /** Login form model */
1461
913
  readonly loginFormModel: _angular_core.WritableSignal<ILoginFormModel>;
1462
- /** Login form with validation schema */
1463
914
  readonly loginForm: _angular_forms_signals.FieldTree<ILoginFormModel, string | number>;
1464
- /** Check if login form is valid */
1465
915
  readonly isLoginFormValid: _angular_core.Signal<boolean>;
1466
- /** Selection form model */
1467
916
  readonly selectionFormModel: _angular_core.WritableSignal<ISelectionFormModel>;
1468
- /** Selection form with validation schema */
1469
917
  readonly selectionForm: _angular_forms_signals.FieldTree<ISelectionFormModel, string | number>;
1470
- /** Check if selection form is valid */
1471
918
  readonly isSelectionFormValid: _angular_core.Signal<boolean>;
1472
- /** Whether company feature is enabled */
1473
919
  readonly companyFeatureEnabled: _angular_core.Signal<boolean>;
1474
- /** Session ID for company selection */
1475
920
  private sessionId;
1476
- /** Available companies */
1477
921
  readonly companies: _angular_core.WritableSignal<ICompanyWithBranches[]>;
1478
- /** User's name */
1479
922
  readonly userName: _angular_core.WritableSignal<string>;
1480
- /** Branches for selected company */
1481
923
  readonly branches: _angular_core.Signal<IBranchSelectionInfo[]>;
1482
924
  constructor();
1483
- /**
1484
- * Restores pending company selection state from auth service.
1485
- * Called when user refreshes page during Step 2 of login flow.
1486
- */
1487
925
  private restorePendingSelectionState;
1488
926
  onSubmit(): void;
1489
- /** Handle company selection change */
1490
927
  onCompanyChange(): void;
1491
928
  onSelectCompany(): void;
1492
929
  goBackToCredentials(): void;
@@ -1551,9 +988,11 @@ declare class ProfilePageComponent {
1551
988
  readonly showRoles: _angular_core.Signal<boolean>;
1552
989
  readonly showActions: _angular_core.Signal<boolean>;
1553
990
  readonly showBottomRow: _angular_core.Signal<boolean>;
991
+ private readonly originalFormModel;
1554
992
  readonly formModel: _angular_core.WritableSignal<IProfileFormModel>;
1555
993
  readonly formTree: _angular_forms_signals.FieldTree<IProfileFormModel, string | number>;
1556
994
  readonly isFormValid: _angular_core.Signal<boolean>;
995
+ readonly isFormDirty: _angular_core.Signal<boolean>;
1557
996
  readonly passwordModel: _angular_core.WritableSignal<IPasswordFormModel>;
1558
997
  readonly isPasswordLoading: _angular_core.WritableSignal<boolean>;
1559
998
  readonly isPasswordFormValid: _angular_core.Signal<boolean>;
@@ -1689,7 +1128,11 @@ declare class UserFormComponent {
1689
1128
  readonly isFormValid: _angular_core.Signal<boolean>;
1690
1129
  constructor();
1691
1130
  loadUser(id: string): void;
1131
+ private toFormModel;
1692
1132
  onSubmit(): void;
1133
+ private updateUser;
1134
+ private createUser;
1135
+ private onSaveSuccess;
1693
1136
  /**
1694
1137
  * Assign user to current company and branch
1695
1138
  */
@@ -1737,6 +1180,7 @@ declare class UserListComponent {
1737
1180
  onEdit(user: IUser): void;
1738
1181
  onManageCompanyPermissions(user: IUser): void;
1739
1182
  onManageBranchPermissions(user: IUser): void;
1183
+ private openPermissionDialog;
1740
1184
  onDelete(user: IUser): void;
1741
1185
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserListComponent, never>;
1742
1186
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserListComponent, "lib-user-list", never, {}, {}, never, never, true, never>;
@@ -1772,52 +1216,27 @@ declare class VerifyEmailPageComponent {
1772
1216
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<VerifyEmailPageComponent, "lib-verify-email-page", never, {}, {}, never, never, true, never>;
1773
1217
  }
1774
1218
 
1775
- /**
1776
- * User Branch Permission Dialog
1777
- *
1778
- * Workflow:
1779
- * 1. Dialog opens → Shows company dropdown with user's permitted companies
1780
- * 2. User selects a company → Branches load for that company
1781
- * 3. Branches show with checkboxes (checked = already assigned)
1782
- * 4. Check to assign, uncheck to revoke
1783
- *
1784
- * Company dropdown only shows companies the user has company-level permissions for.
1785
- * Branch permissions can only be assigned within user's permitted companies.
1786
- */
1219
+ interface BranchWithAssignment extends IBranch {
1220
+ isAssigned: boolean;
1221
+ }
1787
1222
  declare class UserBranchPermissionDialogComponent {
1788
1223
  private readonly branchApi;
1789
1224
  private readonly permissionApi;
1790
- private readonly authState;
1791
1225
  private readonly messageService;
1792
- /** Dialog visibility */
1793
1226
  readonly visible: _angular_core.InputSignal<boolean>;
1794
- /** User to manage permissions for */
1795
1227
  readonly user: _angular_core.InputSignal<IUser | null>;
1796
- /** Close event */
1797
1228
  readonly closed: _angular_core.OutputEmitterRef<void>;
1798
- /** Refresh event after changes */
1799
1229
  readonly permissionsChanged: _angular_core.OutputEmitterRef<void>;
1800
- /** Loading state */
1801
1230
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1802
- /** Saving state */
1803
1231
  readonly isSaving: _angular_core.WritableSignal<boolean>;
1804
- /** Branches with assignment status */
1805
1232
  readonly branches: _angular_core.WritableSignal<BranchWithAssignment[]>;
1806
- /** Available companies (filtered by user's company permissions) */
1807
1233
  readonly companies: _angular_core.WritableSignal<{
1808
1234
  id: string;
1809
1235
  name: string;
1810
1236
  }[]>;
1811
- /** Selected company ID */
1812
1237
  selectedCompanyId: string | null;
1813
- /** Current company from auth state */
1814
- readonly currentCompany: _angular_core.Signal<_flusys_ng_auth.ICompanyInfo | null>;
1815
- /** Currently assigned branch IDs */
1816
1238
  private assignedBranchIds;
1817
1239
  constructor();
1818
- /**
1819
- * Load user's assigned companies (does not auto-select or load branches)
1820
- */
1821
1240
  private loadUserCompaniesAndData;
1822
1241
  private loadData;
1823
1242
  onCompanyChange(): void;
@@ -1826,35 +1245,21 @@ declare class UserBranchPermissionDialogComponent {
1826
1245
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserBranchPermissionDialogComponent, never>;
1827
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>;
1828
1247
  }
1829
- interface BranchWithAssignment extends IBranch {
1248
+
1249
+ interface CompanyWithAssignment extends ICompany {
1830
1250
  isAssigned: boolean;
1831
1251
  }
1832
-
1833
- /**
1834
- * User Company Permission Dialog
1835
- * Shows all companies with checkboxes
1836
- * Initially assigned companies are checked
1837
- * Check to assign, uncheck to revoke
1838
- */
1839
1252
  declare class UserCompanyPermissionDialogComponent {
1840
1253
  private readonly companyApi;
1841
1254
  private readonly permissionApi;
1842
1255
  private readonly messageService;
1843
- /** Dialog visibility */
1844
1256
  readonly visible: _angular_core.InputSignal<boolean>;
1845
- /** User to manage permissions for */
1846
1257
  readonly user: _angular_core.InputSignal<IUser | null>;
1847
- /** Close event */
1848
1258
  readonly closed: _angular_core.OutputEmitterRef<void>;
1849
- /** Refresh event after changes */
1850
1259
  readonly permissionsChanged: _angular_core.OutputEmitterRef<void>;
1851
- /** Loading state */
1852
1260
  readonly isLoading: _angular_core.WritableSignal<boolean>;
1853
- /** Saving state */
1854
1261
  readonly isSaving: _angular_core.WritableSignal<boolean>;
1855
- /** Companies with assignment status */
1856
1262
  readonly companies: _angular_core.WritableSignal<CompanyWithAssignment[]>;
1857
- /** Currently assigned company IDs */
1858
1263
  private assignedCompanyIds;
1859
1264
  constructor();
1860
1265
  private loadData;
@@ -1863,9 +1268,6 @@ declare class UserCompanyPermissionDialogComponent {
1863
1268
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserCompanyPermissionDialogComponent, never>;
1864
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>;
1865
1270
  }
1866
- interface CompanyWithAssignment extends ICompany {
1867
- isAssigned: boolean;
1868
- }
1869
1271
 
1870
- 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, isAuthEndpoint, isCompanySelectionResponse, isEmailVerificationRequired, isEndpoint, isLoginResponse, provideAuthLayoutIntegration, provideAuthProviders, tokenRefreshInterceptor };
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 };
1871
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 };