Skip to main content

User context service

A service to manage the users' context per session, providing access to core information about the User.

Usage

in your component.ts file, add the following

import {UserContextService} from "@investec-online/platform-services";

constructor(private _userContext: UserContextService) {}

Setting context for platform instance

    this._userContext.setMenuPreference('personalBanking')

this._userContext.setCurrentUserTypeContext('personalBanking');

this._userContext.setAuthResponseContext();

this._userContext.setUserFeatures();

this._userContext.setUserSettingsContext().then(res => this.userSettings = res);

this._userContext.setAvailableUserSettingsContext();

this._userContext.setTitleToCurrentPageContext().then(res => this.currentPageName = res);

this._userContext.setDynatraceUserId()

Reset auth response from API

    this._userContext.setMenuPreference.getLoginStateAndUpdateAuthContext()

navigate to default home

    this._userContext.setMenuPreference.navigateToDefaultHome()

How to access the stored data in the store

Getting the auth response

this.authRes = this._store.selectSnapshot(AuthResponseState.getAuthResponse)

export interface AuthResponse {
Client?: {
FirstName?: string,
Surname?: string,
Title?: string,
EmailAddress?: string,
MobileNumber?: string,
Types?: {
PrivateClient?: boolean,
Intermediary?: boolean,
Corporate?: boolean,
DefaultType?: string,
Youth?: boolean
}
},
ProfileList?: Array<InvestecService>
WealthAndInvestmentCI?: boolean,
WealthAndInvestmentUK?: boolean,
WealthAndInvestmentGU?: boolean,
WealthAndInvestmentZA?: boolean,
WealthAndInvestmentClick?: boolean,
WealthAndInvestment?: boolean,
CanTrade?: boolean,
ShareSchemes?: boolean,
ResetPinRequired?: boolean,
PrivateBank?: boolean,
PrivateBankCI?: boolean,
PrivateBankUK?: boolean,
PrivateBankAU?: boolean,
PrivateBankZA?: boolean,
PrivateBankMU?: boolean,
PersonalBanking?: boolean,
Pfm?: boolean,
PfmTargetMarket?: boolean,
WealthManagement?: boolean,
CanMasquerade?: boolean,
IsMasqueradedAsClient?: boolean,
ShowSSOLoginProfilePref?: boolean,
AssetManagementUTZA?: boolean,
AssetManagementIMSZA?: boolean,
CanApply?: boolean,
Briefcase?: boolean,
BriefcaseTargetMarket?: boolean,
BusinessBankingZa?: boolean,
UserType?: string,
DeviceRegistered?: boolean,
IntermediaryAppActivated?: boolean,
PrivateClientAppActivated?: boolean,
UkAppActivated?: boolean,
YouthAppActivated?: boolean,
MaxSession?: string,
SecondFactorPreference?: Array<string>,
MyLegacy?: boolean,
MyLegacyTargetMarket?: boolean,
QuickLinksDisabled?: boolean,
LifeTargetMarket?: boolean,
Life?: boolean,
Chat?: boolean,
Misc?: {Zeta?}
LastLogin?: string,
HIPI?: string,
ProfileMaxSession?: string,
PasswordResetJourneyAllowed?: boolean,
HasQa?: boolean,
RedirectExternalUrl?: string,
RedirectInternalUrl?: string,
HasQuickPass?: boolean,
SecurityDetailsRequired?: boolean
Securities?: boolean
IsNewUser?: boolean
ShowQuickPass?: boolean
ShowWelcomeScreen?: boolean,
IntermediaryBanking?: boolean,
CorporateAndInvestmentBankingUK?: boolean,
CibUkIntermediaryBanking?: boolean,
HasCapabilities?: boolean
}

Getting the user settings

this.userSettings = this._store.selectSnapshot(UserSettingsState.getUserSettings)

export interface UserSetting {
KeyId: number,
RootKeyId: number,
KeyName: string,
Value: string,
Value2: any,
DisplayName: string,
Sequence: number
}

export interface UserSettings extends Array<UserSetting>{}

Getting the available user settings

this.availableUserSettings = this._store.selectSnapshot(AvailableUserSettingsState.getAvailableUserSettings)

export interface UserSettings extends Array<UserSetting>{}

Getting the user features

this.userFeatures = this._store.selectSnapshot(FeaturesState.getFeatures)

export interface Features {
alwaysTrue: boolean
}

Getting the user type

this.userType = this._store.selectSnapshot(UserTypeState.getUserType)

export interface UserType {
defaultUserType: string,
currentUserType: string
}

Getting the Investec Services

this.investecServices = this._store.selectSnapshot(InvestecServicesState.getInvestecServices)

export interface InvestecService {
KeyName: string
ProfileName: string
IsActive: boolean
IsDefault: boolean
ActiveUrl: string
ApiPortfolioUrl: string
NotActiveUrl: string
NoRightsUrl: string
MinSessionType: string
LoginPrefEnabled: string
ExcludeFromProfileList: boolean
ExludeFromProfileListIntermediary: boolean
ExternalRedirect: boolean
InternalRedirect: boolean
IsBusinessProfile: boolean
IsIntermediaryProfile: boolean
}

These are the user profiles that we expose on to allow users to navigate to other systems (usually outside of Investec Online)