@rolatech/angular-auth 20.3.1-beta.2 → 20.3.2-beta.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.
@@ -592,10 +592,11 @@ const ORGANIZATION_ADMIN_ROLES = ['ORGANIZATION_ADMIN', 'ORG_ADMIN', 'ROLE_ORGAN
592
592
  const ORGANIZATION_MEMBER_ROLES = ['ORGANIZATION_MEMBER', 'ORG_MEMBER', 'ROLE_ORGANIZATION_MEMBER', 'ROLE_ORG_MEMBER'];
593
593
  const ORGANIZATION_STAFF_ROLES = ['ORGANIZATION_STAFF', 'ORG_STAFF', 'ROLE_ORGANIZATION_STAFF', 'ROLE_ORG_STAFF'];
594
594
 
595
- class AgentAccessMenuComponent {
595
+ class AgentAccessMenu {
596
596
  applicationCode = input('primecasa', ...(ngDevMode ? [{ debugName: "applicationCode" }] : []));
597
597
  applyRouterLink = input('/agents', ...(ngDevMode ? [{ debugName: "applyRouterLink" }] : []));
598
- dashboardRouterLink = input('/organization', ...(ngDevMode ? [{ debugName: "dashboardRouterLink" }] : []));
598
+ applicationsRouterLink = input('/applications', ...(ngDevMode ? [{ debugName: "applicationsRouterLink" }] : []));
599
+ dashboardRouterLink = input(null, ...(ngDevMode ? [{ debugName: "dashboardRouterLink" }] : []));
599
600
  showApplyAction = input(true, ...(ngDevMode ? [{ debugName: "showApplyAction" }] : []));
600
601
  dashboardLabel = input('Agent dashboard', ...(ngDevMode ? [{ debugName: "dashboardLabel" }] : []));
601
602
  authStore = inject(AuthStore);
@@ -609,7 +610,7 @@ class AgentAccessMenuComponent {
609
610
  if (!loaded || !authenticated || !applicationCode) {
610
611
  return of(null);
611
612
  }
612
- return this.onboardingApplicantService.listMine(applicationCode).pipe(catchError$1(() => of([])));
613
+ return this.onboardingApplicantService.listMine().pipe(catchError$1(() => of([])));
613
614
  })), { initialValue: null });
614
615
  latestApplication = computed(() => {
615
616
  const applications = this.mine();
@@ -620,38 +621,32 @@ class AgentAccessMenuComponent {
620
621
  }, ...(ngDevMode ? [{ debugName: "latestApplication" }] : []));
621
622
  hasDashboardAccess = computed(() => {
622
623
  this.authStore.loaded();
623
- const appId = this.authContextStore.appId() ?? this.authStore.primaryApplication()?.appId ?? this.authStore.primaryOrganization()?.appId ?? null;
624
+ const appId = this.authContextStore.appId() ??
625
+ this.authStore.primaryApplication()?.appId ??
626
+ this.authStore.primaryOrganization()?.appId ??
627
+ null;
624
628
  return this.authStore.hasOrganizationRole(appId, null, ...ORGANIZATION_OWNER_ROLES, ...ORGANIZATION_ADMIN_ROLES, ...ORGANIZATION_MEMBER_ROLES);
625
629
  }, ...(ngDevMode ? [{ debugName: "hasDashboardAccess" }] : []));
626
630
  entry = computed(() => {
627
- if (this.hasDashboardAccess()) {
628
- return {
629
- icon: 'storefront',
630
- label: this.dashboardLabel(),
631
- routerLink: this.dashboardRouterLink(),
632
- };
633
- }
634
631
  const application = this.latestApplication();
632
+ if (application?.status === 'APPROVED') {
633
+ return this.toEntry(this.dashboardLabel(), this.dashboardEntryRouterLink(application));
634
+ }
635
635
  if (application) {
636
- return {
637
- icon: 'assignment',
638
- label: this.applicationLabel(application.status),
639
- routerLink: this.applicationRouterLink(application),
640
- };
636
+ return this.toEntry(this.applicationLabel(application.status), this.applicationRouterLink(application));
637
+ }
638
+ if (this.hasDashboardAccess()) {
639
+ return this.toEntry(this.dashboardLabel(), this.dashboardEntryRouterLink(null));
641
640
  }
642
641
  if (!this.showApplyAction()) {
643
642
  return null;
644
643
  }
645
- return {
646
- icon: 'badge',
647
- label: 'Apply as agent',
648
- routerLink: this.applyRouterLink(),
649
- };
644
+ return this.toEntry('Apply as agent', this.applyRouterLink());
650
645
  }, ...(ngDevMode ? [{ debugName: "entry" }] : []));
651
646
  applicationLabel(status) {
652
647
  switch (status) {
653
648
  case 'APPROVED':
654
- return 'Agent application approved';
649
+ return this.dashboardLabel();
655
650
  case 'FAILED':
656
651
  return 'Agent application result';
657
652
  case 'NEED_MORE_INFO':
@@ -664,48 +659,96 @@ class AgentAccessMenuComponent {
664
659
  }
665
660
  }
666
661
  applicationRouterLink(application) {
667
- const route = this.canOpenReview(application) ? 'review' : 'form';
668
- return ['/agents', application.id, route];
662
+ return this.composeRouterLink(this.applicationsRouterLink(), application.id);
669
663
  }
670
- canOpenReview(application) {
671
- const progress = application.progress;
672
- if (progress && !this.isFormComplete(progress)) {
673
- return false;
664
+ dashboardEntryRouterLink(application) {
665
+ const dashboardRouterLink = this.dashboardRouterLink();
666
+ if (dashboardRouterLink) {
667
+ return dashboardRouterLink;
668
+ }
669
+ if (application) {
670
+ return this.applicationRouterLink(application);
671
+ }
672
+ return this.applicationsRouterLink();
673
+ }
674
+ toEntry(label, link) {
675
+ if (this.isExternalLink(link)) {
676
+ return {
677
+ label,
678
+ href: link,
679
+ };
674
680
  }
675
- return application.status !== 'DRAFT' || this.isFormComplete(progress);
681
+ return {
682
+ label,
683
+ routerLink: link,
684
+ };
676
685
  }
677
- isFormComplete(progress) {
678
- return Boolean(progress?.profileCompleted && progress.qualificationCompleted && progress.financialCompleted && progress.bankingCompleted);
686
+ isExternalLink(link) {
687
+ return typeof link === 'string' && /^(https?:)?\/\//.test(link);
679
688
  }
680
689
  toTimestamp(application) {
681
690
  return Date.parse(application.updatedAt ?? application.createdAt ?? '') || 0;
682
691
  }
683
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AgentAccessMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
684
- 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: `
692
+ composeRouterLink(base, ...segments) {
693
+ const prefix = Array.isArray(base) ? [...base] : [base];
694
+ return [...prefix, ...segments];
695
+ }
696
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AgentAccessMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
697
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: AgentAccessMenu, 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 }, applicationsRouterLink: { classPropertyName: "applicationsRouterLink", publicName: "applicationsRouterLink", 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: `
685
698
  @if (entry(); as item) {
686
- <a mat-menu-item [routerLink]="item.routerLink" class="px-6 flex items-center cursor-pointer">
687
- <mat-icon>{{ item.icon }}</mat-icon>
688
- <span class="flex items-center pl-1">{{ item.label }}</span>
689
- </a>
699
+ @if (item.href) {
700
+ <a mat-menu-item [href]="item.href" class="px-6 flex items-center cursor-pointer">
701
+ @if (item.icon) {
702
+ <mat-icon> {{ item.icon }} </mat-icon>
703
+ }
704
+ <span class="flex items-center pl-2">
705
+ <span> {{ item.label }} </span>
706
+ </span>
707
+ </a>
708
+ } @else {
709
+ <a mat-menu-item [routerLink]="item.routerLink" class="px-6 flex items-center cursor-pointer">
710
+ @if (item.icon) {
711
+ <mat-icon> {{ item.icon }} </mat-icon>
712
+ }
713
+ <span class="flex items-center pl-2">
714
+ <span> {{ item.label }} </span>
715
+ </span>
716
+ </a>
717
+ }
690
718
  }
691
719
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i1$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.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 });
692
720
  }
693
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AgentAccessMenuComponent, decorators: [{
721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AgentAccessMenu, decorators: [{
694
722
  type: Component,
695
723
  args: [{
696
724
  selector: 'rolatech-agent-access-menu',
697
725
  imports: [MatMenuModule, MatIconModule, RouterLink],
698
726
  template: `
699
727
  @if (entry(); as item) {
700
- <a mat-menu-item [routerLink]="item.routerLink" class="px-6 flex items-center cursor-pointer">
701
- <mat-icon>{{ item.icon }}</mat-icon>
702
- <span class="flex items-center pl-1">{{ item.label }}</span>
703
- </a>
728
+ @if (item.href) {
729
+ <a mat-menu-item [href]="item.href" class="px-6 flex items-center cursor-pointer">
730
+ @if (item.icon) {
731
+ <mat-icon> {{ item.icon }} </mat-icon>
732
+ }
733
+ <span class="flex items-center pl-2">
734
+ <span> {{ item.label }} </span>
735
+ </span>
736
+ </a>
737
+ } @else {
738
+ <a mat-menu-item [routerLink]="item.routerLink" class="px-6 flex items-center cursor-pointer">
739
+ @if (item.icon) {
740
+ <mat-icon> {{ item.icon }} </mat-icon>
741
+ }
742
+ <span class="flex items-center pl-2">
743
+ <span> {{ item.label }} </span>
744
+ </span>
745
+ </a>
746
+ }
704
747
  }
705
748
  `,
706
749
  changeDetection: ChangeDetectionStrategy.OnPush,
707
750
  }]
708
- }], 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 }] }] } });
751
+ }], propDecorators: { applicationCode: [{ type: i0.Input, args: [{ isSignal: true, alias: "applicationCode", required: false }] }], applyRouterLink: [{ type: i0.Input, args: [{ isSignal: true, alias: "applyRouterLink", required: false }] }], applicationsRouterLink: [{ type: i0.Input, args: [{ isSignal: true, alias: "applicationsRouterLink", 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 }] }] } });
709
752
 
710
753
  class FaceidDetectDialogComponent {
711
754
  dialogRef = inject(MatDialogRef);
@@ -1065,15 +1108,15 @@ class AuthUserService {
1065
1108
  }
1066
1109
  verifyEmailByToken(token) {
1067
1110
  return this.http
1068
- .post(`${this.environment.baseUrl}/auth/users/verification/email`, {}, {
1111
+ .get(`${this.environment.baseUrl}/auth/users/verification/email`, {
1069
1112
  params: { token },
1070
1113
  withCredentials: true,
1071
1114
  })
1072
1115
  .pipe(map$1((response) => {
1073
- if (typeof response === 'boolean') {
1074
- return response;
1116
+ if (response && typeof response === 'object' && 'data' in response) {
1117
+ return response.data;
1075
1118
  }
1076
- return Boolean(response.data);
1119
+ return response;
1077
1120
  }));
1078
1121
  }
1079
1122
  findByUsername(username) {
@@ -1547,5 +1590,5 @@ function provideRoleAwareConsoleShell(config, ...features) {
1547
1590
  * Generated bundle index. Do not edit.
1548
1591
  */
1549
1592
 
1550
- 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 };
1593
+ export { APPLICATION_ADMIN_ROLES, APPLICATION_OWNER_ROLES, AUTH_METHODS, AddressComponent, AddressType, AgentAccessMenu, 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 };
1551
1594
  //# sourceMappingURL=rolatech-angular-auth.mjs.map