@pega/dx-component-builder-sdk
Version:
Utility for building custom UI components
41 lines (34 loc) • 1.47 kB
text/typescript
import { Component, OnInit, Input, forwardRef } from '@angular/core';
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
interface PulseProps {
// If any, enter additional props that only exist on this component
children?: any[];
}
export class PulseComponent implements OnInit {
pConn$: typeof PConnect;
configProps$: PulseProps;
currentUser$: string | undefined;
currentUserInitials$: string | undefined = '--';
ngOnInit() {
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
// this.currentUser$ = this.configProps$.currentUser;
this.currentUser$ = PCore.getEnvironmentInfo().getOperatorName();
if (this.currentUser$ != '') {
this.currentUserInitials$ = this.currentUser$?.charAt(0);
if (this.currentUser$ && this.currentUser$.lastIndexOf(' ') > 0) {
const lastName = this.currentUser$?.substring(this.currentUser$.lastIndexOf(' ') + 1);
this.currentUserInitials$ += lastName.charAt(0);
} else if (this.currentUser$ && this.currentUser$.lastIndexOf('.') > 0) {
const lastName = this.currentUser$?.substring(this.currentUser$.lastIndexOf('.') + 1);
this.currentUserInitials$ += lastName.charAt(0);
}
}
}
}