feat: Use V2 API's in Console (#9312)

# Which Problems Are Solved
Solves #8976

# Additional Changes
I have done some intensive refactorings and we are using the new
@zitadel/client package for GRPC access.

# Additional Context
- Closes #8976

---------

Co-authored-by: Max Peintner <[email protected]>
This commit is contained in:
Ramon
2025-02-17 19:25:46 +01:00
committed by GitHub
co-authored by Max Peintner
parent ad225836d5
commit 3042bbb993
90 changed files with 3679 additions and 2315 deletions
@@ -1,10 +1,10 @@
<div class="contact-method-col" *ngIf="human">
<div class="contact-method-col">
<div class="contact-method-row">
<div class="left">
<span class="label cnsl-secondary-text">{{ 'USER.EMAIL' | translate }}</span>
<span class="name">{{ human.email?.email }}</span>
<span *ngIf="human.email?.isEmailVerified" class="contact-state verified">{{ 'USER.EMAILVERIFIED' | translate }}</span>
<div *ngIf="!human.email?.isEmailVerified" class="block">
<span *ngIf="isEmailVerified" class="contact-state verified">{{ 'USER.EMAILVERIFIED' | translate }}</span>
<div *ngIf="!isEmailVerified" class="block">
<span class="contact-state notverified">{{ 'USER.NOTVERIFIED' | translate }}</span>
<ng-container *ngIf="human.email">
@@ -37,8 +37,8 @@
<div class="left">
<span class="label cnsl-secondary-text">{{ 'USER.PHONE' | translate }}</span>
<cnsl-phone-detail [phone]="human.phone?.phone"></cnsl-phone-detail>
<span *ngIf="human.phone?.isPhoneVerified" class="contact-state verified">{{ 'USER.PHONEVERIFIED' | translate }}</span>
<div *ngIf="human.phone?.phone && !human.phone?.isPhoneVerified" class="block">
<span *ngIf="isPhoneVerified" class="contact-state verified">{{ 'USER.PHONEVERIFIED' | translate }}</span>
<div *ngIf="human.phone?.phone && !isPhoneVerified" class="block">
<span class="contact-state notverified">{{ 'USER.NOTVERIFIED' | translate }}</span>
<ng-container *ngIf="human.phone?.phone">
@@ -1,11 +1,12 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
import { Human, UserState } from 'src/app/proto/generated/zitadel/user_pb';
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { CodeDialogComponent } from '../auth-user-detail/code-dialog/code-dialog.component';
import { EditDialogType } from '../auth-user-detail/edit-dialog/edit-dialog.component';
import { HumanUser, UserState } from '@zitadel/proto/zitadel/user/v2/user_pb';
import { Human } from '@zitadel/proto/zitadel/user_pb';
@Component({
selector: 'cnsl-contact',
@@ -15,15 +16,14 @@ import { EditDialogType } from '../auth-user-detail/edit-dialog/edit-dialog.comp
export class ContactComponent {
@Input() disablePhoneCode: boolean = false;
@Input() canWrite: boolean | null = false;
@Input() human?: Human.AsObject;
@Input({ required: true }) human!: HumanUser | Human;
@Input() username: string = '';
@Input() state!: UserState;
@Output() editType: EventEmitter<EditDialogType> = new EventEmitter<EditDialogType>();
@Output() resendEmailVerification: EventEmitter<void> = new EventEmitter<void>();
@Output() resendPhoneVerification: EventEmitter<void> = new EventEmitter<void>();
@Output() enteredPhoneCode: EventEmitter<string> = new EventEmitter<string>();
@Output() deletedPhone: EventEmitter<void> = new EventEmitter<void>();
public UserState: any = UserState;
public UserState = UserState;
public EditDialogType: any = EditDialogType;
constructor(
@@ -81,4 +81,18 @@ export class ContactComponent {
public openEditDialog(type: EditDialogType): void {
this.editType.emit(type);
}
protected get isPhoneVerified() {
if (this.human.$typeName === 'zitadel.user.v2.HumanUser') {
return !!this.human.phone?.isVerified;
}
return this.human.phone?.isPhoneVerified;
}
protected get isEmailVerified() {
if (this.human.$typeName === 'zitadel.user.v2.HumanUser') {
return !!this.human.email?.isVerified;
}
return this.human.email?.isEmailVerified;
}
}