@flusys/ng-auth 6.1.0 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import { APP_CONFIG, getServiceUrl, isCompanyFeatureEnabled, isServiceEnabled, i
5
5
  import { of, timeout, switchMap, map, tap, catchError, shareReplay, finalize, BehaviorSubject, throwError, filter, take, from, forkJoin, firstValueFrom } from 'rxjs';
6
6
  import * as i2 from '@angular/router';
7
7
  import { Router, RouterOutlet, ActivatedRoute } from '@angular/router';
8
- import { PlatformService, TranslateService, ApiResourceService, CookieService, resolveTranslationModule, SHARED_MESSAGES, permissionGuard, USER_PERMISSIONS, COMPANY_PERMISSIONS, BRANCH_PERMISSIONS, USER_PROVIDER, COMPANY_API_PROVIDER, USER_PERMISSION_PROVIDER, AUTH_STATE_PROVIDER, PermissionValidatorService, RouterTabsComponent, TranslatePipe, AngularModule, HasPermissionDirective, BaseFormComponent, BaseListComponent, BaseListTemplateDirective, FileUrlService, FILE_PROVIDER, PROFILE_PERMISSION_PROVIDER, FileUploaderComponent } from '@flusys/ng-shared';
8
+ import { PlatformService, TranslateService, ApiResourceService, CookieService, PermissionValidatorService, USER_PERMISSIONS, COMPANY_PERMISSIONS, BRANCH_PERMISSIONS, resolveTranslationModule, SHARED_MESSAGES, permissionGuard, USER_PROVIDER, COMPANY_API_PROVIDER, USER_PERMISSION_PROVIDER, AUTH_STATE_PROVIDER, RouterTabsComponent, TranslatePipe, AngularModule, HasPermissionDirective, BaseFormComponent, BaseListComponent, BaseListTemplateDirective, FileUrlService, FILE_PROVIDER, PROFILE_PERMISSION_PROVIDER, FileUploaderComponent } from '@flusys/ng-shared';
9
9
  import { map as map$1, catchError as catchError$1, tap as tap$1 } from 'rxjs/operators';
10
10
  import * as i2$1 from '@angular/common';
11
11
  import { isPlatformBrowser } from '@angular/common';
@@ -986,6 +986,28 @@ const AUTH_MESSAGES = {
986
986
  'administrative.user.delete.title': 'Delete User',
987
987
  };
988
988
 
989
+ /**
990
+ * Resolves which administration tab the current user should land on when
991
+ * navigating to the bare `/administration` route. Mirrors the tab
992
+ * visibility order in AdministrationPageComponent.visibleTabs so the
993
+ * redirect never points at a tab the user can't actually see.
994
+ */
995
+ function resolveAdministrationDefaultTab() {
996
+ const permissionValidator = inject(PermissionValidatorService);
997
+ const companyFeatureEnabled = isCompanyFeatureEnabled(inject(APP_CONFIG));
998
+ if (permissionValidator.hasPermission(USER_PERMISSIONS.READ)) {
999
+ return 'users';
1000
+ }
1001
+ if (companyFeatureEnabled &&
1002
+ permissionValidator.hasPermission(COMPANY_PERMISSIONS.READ)) {
1003
+ return 'company';
1004
+ }
1005
+ if (companyFeatureEnabled &&
1006
+ permissionValidator.hasPermission(BRANCH_PERMISSIONS.READ)) {
1007
+ return 'branch';
1008
+ }
1009
+ return 'users';
1010
+ }
989
1011
  /**
990
1012
  * Auth Routes Configuration
991
1013
  * Public routes for authentication (login, register, etc.)
@@ -1115,10 +1137,10 @@ const ADMINISTRATION_ROUTES = [
1115
1137
  },
1116
1138
  ],
1117
1139
  },
1118
- // Default redirect to users
1140
+ // Default redirect to the first tab the user has permission to see
1119
1141
  {
1120
1142
  path: '',
1121
- redirectTo: 'users',
1143
+ redirectTo: () => resolveAdministrationDefaultTab(),
1122
1144
  pathMatch: 'full',
1123
1145
  },
1124
1146
  ],
@@ -3314,11 +3336,12 @@ class LoginPageComponent {
3314
3336
  currentStep() === 'credentials'
3315
3337
  "
3316
3338
  [class.bg-surface-200]="currentStep() !== 'credentials'"
3339
+ [class.dark:bg-surface-700]="currentStep() !== 'credentials'"
3317
3340
  [class.text-muted-color]="currentStep() !== 'credentials'"
3318
3341
  >
3319
3342
  1
3320
3343
  </div>
3321
- <div class="w-12 h-0.5 bg-surface-200"></div>
3344
+ <div class="w-12 h-0.5 bg-surface-200 dark:bg-surface-700"></div>
3322
3345
  <div
3323
3346
  class="flex items-center justify-center w-8 h-8 rounded-full text-sm font-semibold transition-colors"
3324
3347
  [class.bg-primary]="currentStep() === 'company-selection'"
@@ -3326,6 +3349,7 @@ class LoginPageComponent {
3326
3349
  currentStep() === 'company-selection'
3327
3350
  "
3328
3351
  [class.bg-surface-200]="currentStep() !== 'company-selection'"
3352
+ [class.dark:bg-surface-700]="currentStep() !== 'company-selection'"
3329
3353
  [class.text-muted-color]="
3330
3354
  currentStep() !== 'company-selection'
3331
3355
  "
@@ -3586,11 +3610,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
3586
3610
  currentStep() === 'credentials'
3587
3611
  "
3588
3612
  [class.bg-surface-200]="currentStep() !== 'credentials'"
3613
+ [class.dark:bg-surface-700]="currentStep() !== 'credentials'"
3589
3614
  [class.text-muted-color]="currentStep() !== 'credentials'"
3590
3615
  >
3591
3616
  1
3592
3617
  </div>
3593
- <div class="w-12 h-0.5 bg-surface-200"></div>
3618
+ <div class="w-12 h-0.5 bg-surface-200 dark:bg-surface-700"></div>
3594
3619
  <div
3595
3620
  class="flex items-center justify-center w-8 h-8 rounded-full text-sm font-semibold transition-colors"
3596
3621
  [class.bg-primary]="currentStep() === 'company-selection'"
@@ -3598,6 +3623,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
3598
3623
  currentStep() === 'company-selection'
3599
3624
  "
3600
3625
  [class.bg-surface-200]="currentStep() !== 'company-selection'"
3626
+ [class.dark:bg-surface-700]="currentStep() !== 'company-selection'"
3601
3627
  [class.text-muted-color]="
3602
3628
  currentStep() !== 'company-selection'
3603
3629
  "
@@ -4266,7 +4292,7 @@ class ProfilePageComponent {
4266
4292
  <div class="card mb-2 md:mb-4">
4267
4293
  <div class="flex flex-col md:flex-row gap-4 md:gap-6">
4268
4294
  <div
4269
- class="flex flex-col items-center gap-4 md:w-72 lg:w-80 md:border-r md:border-surface-200 md:pr-6"
4295
+ class="flex flex-col items-center gap-4 md:w-72 lg:w-80 md:border-r md:border-surface md:pr-6"
4270
4296
  >
4271
4297
  @if (profilePictureUrl()) {
4272
4298
  <f-avatar
@@ -4298,7 +4324,7 @@ class ProfilePageComponent {
4298
4324
  class="w-full"
4299
4325
  />
4300
4326
  } @else {
4301
- <div class="w-full p-3 bg-surface-100 rounded-lg text-center">
4327
+ <div class="w-full p-3 bg-emphasis rounded-lg text-center">
4302
4328
  <ui-icon
4303
4329
  name="info-circle"
4304
4330
  class="text-muted-color mr-2"
@@ -4320,7 +4346,7 @@ class ProfilePageComponent {
4320
4346
  fInputText
4321
4347
  [value]="userEmail()"
4322
4348
  disabled
4323
- class="bg-surface-50"
4349
+ class="bg-(--f-form-field-filled-background)"
4324
4350
  [placeholder]="'auth.email.placeholder' | translate"
4325
4351
  />
4326
4352
  </div>
@@ -4869,7 +4895,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
4869
4895
  <div class="card mb-2 md:mb-4">
4870
4896
  <div class="flex flex-col md:flex-row gap-4 md:gap-6">
4871
4897
  <div
4872
- class="flex flex-col items-center gap-4 md:w-72 lg:w-80 md:border-r md:border-surface-200 md:pr-6"
4898
+ class="flex flex-col items-center gap-4 md:w-72 lg:w-80 md:border-r md:border-surface md:pr-6"
4873
4899
  >
4874
4900
  @if (profilePictureUrl()) {
4875
4901
  <f-avatar
@@ -4901,7 +4927,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
4901
4927
  class="w-full"
4902
4928
  />
4903
4929
  } @else {
4904
- <div class="w-full p-3 bg-surface-100 rounded-lg text-center">
4930
+ <div class="w-full p-3 bg-emphasis rounded-lg text-center">
4905
4931
  <ui-icon
4906
4932
  name="info-circle"
4907
4933
  class="text-muted-color mr-2"
@@ -4923,7 +4949,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
4923
4949
  fInputText
4924
4950
  [value]="userEmail()"
4925
4951
  disabled
4926
- class="bg-surface-50"
4952
+ class="bg-(--f-form-field-filled-background)"
4927
4953
  [placeholder]="'auth.email.placeholder' | translate"
4928
4954
  />
4929
4955
  </div>
@@ -6082,7 +6108,7 @@ class RegisterPageComponent {
6082
6108
  fInputText
6083
6109
  id="companySlug"
6084
6110
  [value]="defaultCompanySlug()"
6085
- class="w-full bg-surface-100"
6111
+ class="w-full bg-(--f-form-field-filled-background)"
6086
6112
  readonly
6087
6113
  />
6088
6114
  <small class="text-muted-color">{{
@@ -6116,7 +6142,7 @@ class RegisterPageComponent {
6116
6142
  fInputText
6117
6143
  id="branchSlug"
6118
6144
  [value]="defaultBranchSlug()"
6119
- class="w-full bg-surface-100"
6145
+ class="w-full bg-(--f-form-field-filled-background)"
6120
6146
  readonly
6121
6147
  />
6122
6148
  <small class="text-muted-color">{{
@@ -6546,7 +6572,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
6546
6572
  fInputText
6547
6573
  id="companySlug"
6548
6574
  [value]="defaultCompanySlug()"
6549
- class="w-full bg-surface-100"
6575
+ class="w-full bg-(--f-form-field-filled-background)"
6550
6576
  readonly
6551
6577
  />
6552
6578
  <small class="text-muted-color">{{
@@ -6580,7 +6606,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
6580
6606
  fInputText
6581
6607
  id="branchSlug"
6582
6608
  [value]="defaultBranchSlug()"
6583
- class="w-full bg-surface-100"
6609
+ class="w-full bg-(--f-form-field-filled-background)"
6584
6610
  readonly
6585
6611
  />
6586
6612
  <small class="text-muted-color">{{