@rolatech/angular-auth 20.3.0-beta.3 → 20.3.0-beta.4

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,19 +1,24 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, signal, computed, Injectable, inject, output, model, PLATFORM_ID, InjectionToken, APP_INITIALIZER, makeEnvironmentProviders } from '@angular/core';
2
+ import { Component, signal, computed, Injectable, input, inject, ChangeDetectionStrategy, output, model, PLATFORM_ID, InjectionToken, APP_INITIALIZER, makeEnvironmentProviders } from '@angular/core';
3
+ import { toSignal, toObservable } from '@angular/core/rxjs-interop';
4
+ import * as i2 from '@angular/material/icon';
5
+ import { MatIconModule } from '@angular/material/icon';
6
+ import * as i1 from '@angular/material/menu';
7
+ import { MatMenuModule } from '@angular/material/menu';
8
+ import { RouterLink, Router, provideRouter, ROUTES } from '@angular/router';
9
+ import { OnboardingApplicantService, SnackBarService } from '@rolatech/angular-services';
10
+ import { switchMap, of, catchError, forkJoin, throwError, map as map$1, BehaviorSubject, NEVER, firstValueFrom } from 'rxjs';
3
11
  import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angular/material/dialog';
4
12
  import { APP_CONFIG, AngularCommonModule } from '@rolatech/angular-common';
5
- import { SnackBarService } from '@rolatech/angular-services';
6
13
  import QRCode from 'qrcode';
7
14
  import { MatButtonModule } from '@angular/material/button';
8
15
  import { HttpClient, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
9
- import { of, forkJoin, throwError, map as map$1, BehaviorSubject, catchError as catchError$1, NEVER, firstValueFrom } from 'rxjs';
10
- import { switchMap, catchError, map, finalize, shareReplay, tap, filter } from 'rxjs/operators';
16
+ import { switchMap as switchMap$1, catchError as catchError$1, map, finalize, shareReplay, tap, filter } from 'rxjs/operators';
11
17
  import { SpinnerComponent, AngularComponentsModule } from '@rolatech/angular-components';
12
- import * as i1 from '@angular/forms';
13
- import * as i2 from '@angular/material/form-field';
18
+ import * as i1$1 from '@angular/forms';
19
+ import * as i2$1 from '@angular/material/form-field';
14
20
  import * as i3 from '@angular/material/input';
15
21
  import { isPlatformBrowser, CommonModule } from '@angular/common';
16
- import { Router, provideRouter, ROUTES } from '@angular/router';
17
22
  import { MatSnackBar } from '@angular/material/snack-bar';
18
23
 
19
24
  class ForbiddenComponent {
@@ -34,6 +39,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
34
39
  args: [{ selector: 'rolatech-unauthorized', template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>401.</b>\n <p>Unauthorized page.</p>\n </div>\n</div>\n" }]
35
40
  }] });
36
41
 
42
+ class AuthContextStore {
43
+ state = signal({
44
+ appId: null,
45
+ orgId: null,
46
+ }, ...(ngDevMode ? [{ debugName: "state" }] : []));
47
+ appId = computed(() => this.state().appId, ...(ngDevMode ? [{ debugName: "appId" }] : []));
48
+ orgId = computed(() => this.state().orgId, ...(ngDevMode ? [{ debugName: "orgId" }] : []));
49
+ setContext(appId, orgId) {
50
+ this.state.set({ appId, orgId });
51
+ }
52
+ setAppId(appId) {
53
+ this.state.update((state) => ({ ...state, appId }));
54
+ }
55
+ setOrgId(orgId) {
56
+ this.state.update((state) => ({ ...state, orgId }));
57
+ }
58
+ clear() {
59
+ this.state.set({ appId: null, orgId: null });
60
+ }
61
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AuthContextStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
62
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AuthContextStore, providedIn: 'root' });
63
+ }
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AuthContextStore, decorators: [{
65
+ type: Injectable,
66
+ args: [{ providedIn: 'root' }]
67
+ }] });
68
+
37
69
  class AuthStore {
38
70
  _state = signal({
39
71
  userId: '',
@@ -188,32 +220,128 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
188
220
  args: [{ providedIn: 'root' }]
189
221
  }] });
190
222
 
191
- class AuthContextStore {
192
- state = signal({
193
- appId: null,
194
- orgId: null,
195
- }, ...(ngDevMode ? [{ debugName: "state" }] : []));
196
- appId = computed(() => this.state().appId, ...(ngDevMode ? [{ debugName: "appId" }] : []));
197
- orgId = computed(() => this.state().orgId, ...(ngDevMode ? [{ debugName: "orgId" }] : []));
198
- setContext(appId, orgId) {
199
- this.state.set({ appId, orgId });
223
+ const PLATFORM_ADMIN_ROLES = ['PLATFORM_ADMIN', 'ROLE_PLATFORM_ADMIN'];
224
+ const APPLICATION_OWNER_ROLES = ['APPLICATION_OWNER', 'APP_OWNER', 'ROLE_APPLICATION_OWNER', 'ROLE_APP_OWNER'];
225
+ const APPLICATION_ADMIN_ROLES = ['APPLICATION_ADMIN', 'APP_ADMIN', 'ROLE_APPLICATION_ADMIN', 'ROLE_APP_ADMIN'];
226
+ const ORGANIZATION_OWNER_ROLES = ['ORGANIZATION_OWNER', 'ORG_OWNER', 'ROLE_ORGANIZATION_OWNER', 'ROLE_ORG_OWNER'];
227
+ const ORGANIZATION_ADMIN_ROLES = ['ORGANIZATION_ADMIN', 'ORG_ADMIN', 'ROLE_ORGANIZATION_ADMIN', 'ROLE_ORG_ADMIN'];
228
+ const ORGANIZATION_MEMBER_ROLES = ['ORGANIZATION_MEMBER', 'ORG_MEMBER', 'ROLE_ORGANIZATION_MEMBER', 'ROLE_ORG_MEMBER'];
229
+ const ORGANIZATION_STAFF_ROLES = ['ORGANIZATION_STAFF', 'ORG_STAFF', 'ROLE_ORGANIZATION_STAFF', 'ROLE_ORG_STAFF'];
230
+
231
+ class AgentAccessMenuComponent {
232
+ applicationCode = input('primecasa', ...(ngDevMode ? [{ debugName: "applicationCode" }] : []));
233
+ applyRouterLink = input('/agents', ...(ngDevMode ? [{ debugName: "applyRouterLink" }] : []));
234
+ dashboardRouterLink = input('/organization', ...(ngDevMode ? [{ debugName: "dashboardRouterLink" }] : []));
235
+ showApplyAction = input(true, ...(ngDevMode ? [{ debugName: "showApplyAction" }] : []));
236
+ dashboardLabel = input('Agent dashboard', ...(ngDevMode ? [{ debugName: "dashboardLabel" }] : []));
237
+ authStore = inject(AuthStore);
238
+ authContextStore = inject(AuthContextStore);
239
+ onboardingApplicantService = inject(OnboardingApplicantService);
240
+ mine = toSignal(toObservable(computed(() => ({
241
+ authenticated: this.authStore.authenticated(),
242
+ loaded: this.authStore.loaded(),
243
+ applicationCode: this.applicationCode(),
244
+ }))).pipe(switchMap(({ authenticated, loaded, applicationCode }) => {
245
+ if (!loaded || !authenticated || !applicationCode) {
246
+ return of(null);
247
+ }
248
+ return this.onboardingApplicantService.listMine(applicationCode).pipe(catchError(() => of([])));
249
+ })), { initialValue: null });
250
+ latestApplication = computed(() => {
251
+ const applications = this.mine();
252
+ if (!applications?.length) {
253
+ return null;
254
+ }
255
+ return [...applications].sort((left, right) => this.toTimestamp(right) - this.toTimestamp(left))[0] ?? null;
256
+ }, ...(ngDevMode ? [{ debugName: "latestApplication" }] : []));
257
+ hasDashboardAccess = computed(() => {
258
+ this.authStore.loaded();
259
+ const appId = this.authContextStore.appId() ?? this.authStore.primaryApplication()?.appId ?? this.authStore.primaryOrganization()?.appId ?? null;
260
+ return this.authStore.hasOrganizationRole(appId, null, ...ORGANIZATION_OWNER_ROLES, ...ORGANIZATION_ADMIN_ROLES, ...ORGANIZATION_MEMBER_ROLES);
261
+ }, ...(ngDevMode ? [{ debugName: "hasDashboardAccess" }] : []));
262
+ entry = computed(() => {
263
+ if (this.hasDashboardAccess()) {
264
+ return {
265
+ icon: 'storefront',
266
+ label: this.dashboardLabel(),
267
+ routerLink: this.dashboardRouterLink(),
268
+ };
269
+ }
270
+ const application = this.latestApplication();
271
+ if (application) {
272
+ return {
273
+ icon: 'assignment',
274
+ label: this.applicationLabel(application.status),
275
+ routerLink: this.applicationRouterLink(application),
276
+ };
277
+ }
278
+ if (!this.showApplyAction()) {
279
+ return null;
280
+ }
281
+ return {
282
+ icon: 'badge',
283
+ label: 'Apply as agent',
284
+ routerLink: this.applyRouterLink(),
285
+ };
286
+ }, ...(ngDevMode ? [{ debugName: "entry" }] : []));
287
+ applicationLabel(status) {
288
+ switch (status) {
289
+ case 'APPROVED':
290
+ return 'Agent application approved';
291
+ case 'FAILED':
292
+ return 'Agent application result';
293
+ case 'NEED_MORE_INFO':
294
+ return 'Agent application updates';
295
+ case 'SUBMITTED':
296
+ case 'IN_REVIEW':
297
+ return 'Agent application review';
298
+ default:
299
+ return 'Continue agent application';
300
+ }
200
301
  }
201
- setAppId(appId) {
202
- this.state.update((state) => ({ ...state, appId }));
302
+ applicationRouterLink(application) {
303
+ const route = this.canOpenReview(application) ? 'review' : 'form';
304
+ return ['/agents', application.id, route];
203
305
  }
204
- setOrgId(orgId) {
205
- this.state.update((state) => ({ ...state, orgId }));
306
+ canOpenReview(application) {
307
+ const progress = application.progress;
308
+ if (progress && !this.isFormComplete(progress)) {
309
+ return false;
310
+ }
311
+ return application.status !== 'DRAFT' || this.isFormComplete(progress);
206
312
  }
207
- clear() {
208
- this.state.set({ appId: null, orgId: null });
313
+ isFormComplete(progress) {
314
+ return Boolean(progress?.profileCompleted && progress.qualificationCompleted && progress.financialCompleted && progress.bankingCompleted);
209
315
  }
210
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AuthContextStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
211
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AuthContextStore, providedIn: 'root' });
316
+ toTimestamp(application) {
317
+ return Date.parse(application.updatedAt ?? application.createdAt ?? '') || 0;
318
+ }
319
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AgentAccessMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
320
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: AgentAccessMenuComponent, isStandalone: true, selector: "rolatech-agent-access-menu", inputs: { applicationCode: { classPropertyName: "applicationCode", publicName: "applicationCode", isSignal: true, isRequired: false, transformFunction: null }, applyRouterLink: { classPropertyName: "applyRouterLink", publicName: "applyRouterLink", isSignal: true, isRequired: false, transformFunction: null }, dashboardRouterLink: { classPropertyName: "dashboardRouterLink", publicName: "dashboardRouterLink", isSignal: true, isRequired: false, transformFunction: null }, showApplyAction: { classPropertyName: "showApplyAction", publicName: "showApplyAction", isSignal: true, isRequired: false, transformFunction: null }, dashboardLabel: { classPropertyName: "dashboardLabel", publicName: "dashboardLabel", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
321
+ @if (entry(); as item) {
322
+ <a mat-menu-item [routerLink]="item.routerLink" class="px-6 flex items-center cursor-pointer">
323
+ <mat-icon>{{ item.icon }}</mat-icon>
324
+ <span class="flex items-center pl-1">{{ item.label }}</span>
325
+ </a>
326
+ }
327
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
212
328
  }
213
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AuthContextStore, decorators: [{
214
- type: Injectable,
215
- args: [{ providedIn: 'root' }]
216
- }] });
329
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AgentAccessMenuComponent, decorators: [{
330
+ type: Component,
331
+ args: [{
332
+ selector: 'rolatech-agent-access-menu',
333
+ imports: [MatMenuModule, MatIconModule, RouterLink],
334
+ template: `
335
+ @if (entry(); as item) {
336
+ <a mat-menu-item [routerLink]="item.routerLink" class="px-6 flex items-center cursor-pointer">
337
+ <mat-icon>{{ item.icon }}</mat-icon>
338
+ <span class="flex items-center pl-1">{{ item.label }}</span>
339
+ </a>
340
+ }
341
+ `,
342
+ changeDetection: ChangeDetectionStrategy.OnPush,
343
+ }]
344
+ }], propDecorators: { applicationCode: [{ type: i0.Input, args: [{ isSignal: true, alias: "applicationCode", required: false }] }], applyRouterLink: [{ type: i0.Input, args: [{ isSignal: true, alias: "applyRouterLink", required: false }] }], dashboardRouterLink: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashboardRouterLink", required: false }] }], showApplyAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "showApplyAction", required: false }] }], dashboardLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashboardLabel", required: false }] }] } });
217
345
 
218
346
  class AuthService {
219
347
  environment = inject(APP_CONFIG);
@@ -242,15 +370,15 @@ class AuthService {
242
370
  .get(`${this.environment.baseUrl}/auth/introspect`, {
243
371
  withCredentials: true,
244
372
  })
245
- .pipe(switchMap((res) => {
373
+ .pipe(switchMap$1((res) => {
246
374
  if (!res.authenticated) {
247
375
  this.authStore.clear();
248
376
  this.authContextStore.clear();
249
377
  return of(res);
250
378
  }
251
379
  return forkJoin({
252
- user: this.me().pipe(catchError(() => of(null))),
253
- context: this.getMeContext().pipe(catchError(() => of(this.emptyContext(res)))),
380
+ user: this.me().pipe(catchError$1(() => of(null))),
381
+ context: this.getMeContext().pipe(catchError$1(() => of(this.emptyContext(res)))),
254
382
  }).pipe(map(({ user, context }) => {
255
383
  this.authStore.update({
256
384
  authenticated: true,
@@ -267,7 +395,7 @@ class AuthService {
267
395
  this.syncContext(context);
268
396
  return res;
269
397
  }));
270
- }), catchError((error) => {
398
+ }), catchError$1((error) => {
271
399
  this.authStore.clear();
272
400
  this.authContextStore.clear();
273
401
  return throwError(() => error);
@@ -543,7 +671,7 @@ class AddressComponent {
543
671
  this.output.emit(this.address());
544
672
  }
545
673
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AddressComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
546
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: AddressComponent, isStandalone: true, selector: "rolatech-address", inputs: { address: { classPropertyName: "address", publicName: "address", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { address: "addressChange", output: "output" }, ngImport: i0, template: "<div>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Name </mat-label>\n <input matInput [(ngModel)]=\"address().name\" />\n </mat-form-field>\n @if (address().type === addressType.BILLING) {\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Email </mat-label>\n <input matInput [(ngModel)]=\"address().email\" />\n </mat-form-field>\n }\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Phone </mat-label>\n <input matInput [(ngModel)]=\"address().phone\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> province </mat-label>\n <input matInput [(ngModel)]=\"address().province\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> City </mat-label>\n <input matInput [(ngModel)]=\"address().city\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> District </mat-label>\n <input matInput [(ngModel)]=\"address().district\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Street </mat-label>\n <input matInput [(ngModel)]=\"address().street\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Detail </mat-label>\n <input matInput [(ngModel)]=\"address().detail\" />\n </mat-form-field>\n</div>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: AngularCommonModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AngularComponentsModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }] });
674
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: AddressComponent, isStandalone: true, selector: "rolatech-address", inputs: { address: { classPropertyName: "address", publicName: "address", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { address: "addressChange", output: "output" }, ngImport: i0, template: "<div>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Name </mat-label>\n <input matInput [(ngModel)]=\"address().name\" />\n </mat-form-field>\n @if (address().type === addressType.BILLING) {\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Email </mat-label>\n <input matInput [(ngModel)]=\"address().email\" />\n </mat-form-field>\n }\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Phone </mat-label>\n <input matInput [(ngModel)]=\"address().phone\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> province </mat-label>\n <input matInput [(ngModel)]=\"address().province\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> City </mat-label>\n <input matInput [(ngModel)]=\"address().city\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> District </mat-label>\n <input matInput [(ngModel)]=\"address().district\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Street </mat-label>\n <input matInput [(ngModel)]=\"address().street\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label i18n> Detail </mat-label>\n <input matInput [(ngModel)]=\"address().detail\" />\n </mat-form-field>\n</div>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: AngularCommonModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AngularComponentsModule }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }] });
547
675
  }
548
676
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AddressComponent, decorators: [{
549
677
  type: Component,
@@ -689,14 +817,6 @@ function accessMatchGuard(policy, fallbackUrl = '/forbidden') {
689
817
  };
690
818
  }
691
819
 
692
- const PLATFORM_ADMIN_ROLES = ['PLATFORM_ADMIN', 'ROLE_PLATFORM_ADMIN'];
693
- const APPLICATION_OWNER_ROLES = ['APPLICATION_OWNER', 'APP_OWNER', 'ROLE_APPLICATION_OWNER', 'ROLE_APP_OWNER'];
694
- const APPLICATION_ADMIN_ROLES = ['APPLICATION_ADMIN', 'APP_ADMIN', 'ROLE_APPLICATION_ADMIN', 'ROLE_APP_ADMIN'];
695
- const ORGANIZATION_OWNER_ROLES = ['ORGANIZATION_OWNER', 'ORG_OWNER', 'ROLE_ORGANIZATION_OWNER', 'ROLE_ORG_OWNER'];
696
- const ORGANIZATION_ADMIN_ROLES = ['ORGANIZATION_ADMIN', 'ORG_ADMIN', 'ROLE_ORGANIZATION_ADMIN', 'ROLE_ORG_ADMIN'];
697
- const ORGANIZATION_MEMBER_ROLES = ['ORGANIZATION_MEMBER', 'ORG_MEMBER', 'ROLE_ORGANIZATION_MEMBER', 'ROLE_ORG_MEMBER'];
698
- const ORGANIZATION_STAFF_ROLES = ['ORGANIZATION_STAFF', 'ORG_STAFF', 'ROLE_ORGANIZATION_STAFF', 'ROLE_ORG_STAFF'];
699
-
700
820
  function landingRedirectGuard(targets = {}) {
701
821
  const resolvedTargets = {
702
822
  platform: targets.platform ?? '/platform',
@@ -1030,7 +1150,7 @@ class ErrorInterceptor {
1030
1150
  isRefreshingToken = false;
1031
1151
  authService = inject(AuthService);
1032
1152
  intercept(request, next) {
1033
- return next.handle(request).pipe(catchError$1((error) => {
1153
+ return next.handle(request).pipe(catchError((error) => {
1034
1154
  if (error instanceof HttpErrorResponse) {
1035
1155
  switch (error.status) {
1036
1156
  case 400:
@@ -1096,7 +1216,7 @@ class AuthInterceptor {
1096
1216
  // // window.location.href = res.headers.get('Location') as string;
1097
1217
  // }
1098
1218
  return res;
1099
- }), catchError((error) => {
1219
+ }), catchError$1((error) => {
1100
1220
  if (isPlatformBrowser(this.platformId)) {
1101
1221
  if (error.url?.includes('auth/introspect')) {
1102
1222
  // if (window.location.origin !== `${this.environment.accountsUrl}`) {
@@ -1164,7 +1284,7 @@ function provideAngularAuth(config) {
1164
1284
  if (config?.autoLoadSession === false || !isPlatformBrowser(platformId)) {
1165
1285
  return Promise.resolve();
1166
1286
  }
1167
- return firstValueFrom(authService.ensureLoaded().pipe(catchError(() => of(null))));
1287
+ return firstValueFrom(authService.ensureLoaded().pipe(catchError$1(() => of(null))));
1168
1288
  };
1169
1289
  },
1170
1290
  },
@@ -1279,20 +1399,23 @@ function provideRoleAwareShellRouter(config, ...features) {
1279
1399
  ];
1280
1400
  return makeEnvironmentProviders(providers);
1281
1401
  }
1282
- function provideRoleAwareConsoleShell(config, ...features) {
1402
+ function provideRoleAwareShell(config, ...features) {
1283
1403
  return makeEnvironmentProviders([
1284
- provideRoleAwareShellRouter({
1285
- ...config,
1286
- shellCanActivate: config.shellCanActivate ?? [AuthGuard],
1287
- shellCanActivateChild: config.shellCanActivateChild ?? [AuthGuard],
1288
- }, ...features),
1404
+ provideRoleAwareShellRouter(config, ...features),
1289
1405
  ...(config.navigation?.length ? [provideRoleNavigation(config.navigation)] : []),
1290
1406
  ]);
1291
1407
  }
1408
+ function provideRoleAwareConsoleShell(config, ...features) {
1409
+ return provideRoleAwareShell({
1410
+ ...config,
1411
+ shellCanActivate: config.shellCanActivate ?? [AuthGuard],
1412
+ shellCanActivateChild: config.shellCanActivateChild ?? [AuthGuard],
1413
+ }, ...features);
1414
+ }
1292
1415
 
1293
1416
  /**
1294
1417
  * Generated bundle index. Do not edit.
1295
1418
  */
1296
1419
 
1297
- export { APPLICATION_ADMIN_ROLES, APPLICATION_OWNER_ROLES, AUTH_METHODS, AddressComponent, AddressType, AppNavigationService, AuthAgentService, AuthContextStore, AuthDialogGuard, AuthGuard, AuthInterceptor, AuthMethod, AuthService, AuthStore, AuthUserService, ErrorInterceptor, FaceidDetectDialogComponent, ForbiddenComponent, LocalStorageService, ORGANIZATION_ADMIN_ROLES, ORGANIZATION_MEMBER_ROLES, ORGANIZATION_OWNER_ROLES, ORGANIZATION_STAFF_ROLES, PLATFORM_ADMIN_ROLES, PermissionGuard, ROLE_NAVIGATION_LINKS, ROLE_SHELL_CHILD_ROUTES, RoleGuard, UnauthorizedComponent, UserStatus, accessGuard, accessMatchGuard, authRoutes, landingRedirectGuard, provideAngularAuth, provideRoleAwareConsoleShell, provideRoleAwareFeature, provideRoleAwareShellRouter, provideRoleNavigation, provideRoleShellRoutes };
1420
+ export { APPLICATION_ADMIN_ROLES, APPLICATION_OWNER_ROLES, AUTH_METHODS, AddressComponent, AddressType, AgentAccessMenuComponent, AppNavigationService, AuthAgentService, AuthContextStore, AuthDialogGuard, AuthGuard, AuthInterceptor, AuthMethod, AuthService, AuthStore, AuthUserService, ErrorInterceptor, FaceidDetectDialogComponent, ForbiddenComponent, LocalStorageService, ORGANIZATION_ADMIN_ROLES, ORGANIZATION_MEMBER_ROLES, ORGANIZATION_OWNER_ROLES, ORGANIZATION_STAFF_ROLES, PLATFORM_ADMIN_ROLES, PermissionGuard, ROLE_NAVIGATION_LINKS, ROLE_SHELL_CHILD_ROUTES, RoleGuard, UnauthorizedComponent, UserStatus, accessGuard, accessMatchGuard, authRoutes, landingRedirectGuard, provideAngularAuth, provideRoleAwareConsoleShell, provideRoleAwareFeature, provideRoleAwareShell, provideRoleAwareShellRouter, provideRoleNavigation, provideRoleShellRoutes };
1298
1421
  //# sourceMappingURL=rolatech-angular-auth.mjs.map