# MsalUriComponent

**Kind:** Class

**Source:** `Frontend/src/app/msal/msal-uri/msal-uri.component.ts` (line 31)

**Part of:** [Frontend](subsystem-frontend-src-app)

`MsalUriComponent` handles the MSAL redirect or popup callback flow in the Angular application. It listens for window messages, exchanges data with opened tabs or popup windows, updates login display state, and cleans up listeners when the component is destroyed.

**Implements:** `OnInit`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `windowMessageListner` | `windowMessageListner($event: any)` | `void` |
| `ngOnInit` | `ngOnInit()` | `void` |
| `ngOnDestroy` | `ngOnDestroy()` | `void` |
| `receiveMessage` | `receiveMessage(event: any)` | `void` |
| `getOpenedTabs` | `getOpenedTabs()` | `void` |
| `fetchDataFromAnotherWindow` | `fetchDataFromAnotherWindow(params: any)` | `void` |
| `closeWindowPopup` | `closeWindowPopup()` | `void` |
| `isMeDeveloper` | `isMeDeveloper()` | `boolean` |
| `setLoginDisplay` | `setLoginDisplay()` | `void` |
| `fetshMicrosoftData` | `fetshMicrosoftData()` | `void` |
| `login` | `login()` | `void` |
| `logout` | `logout()` | `void` |
| `getData` | `getData()` | `void` |
| `getContacts` | `getContacts()` | `void` |
| `isPamsLogin` | `isPamsLogin()` | `boolean` |
| `sendMail` | `sendMail()` | `void` |
| `sendInquiry` | `sendInquiry(Inquiry: SalesPotentials)` | `void` |

## Properties

| Property | Type |
|---|---|
| `isIframe` | `boolean` |
| `loginDisplay` | `any` |
| `subscription` | `Subscription` |
| `NewMail` | `Activities` |
| `contentDataURL` | `any[]` |
| `TargetInquiry` | `any` |
| `MailsList` | `any` |
| `CCMailsList` | `any` |
| `BCCMailsList` | `any` |
| `recipient` | `Recipients` |
| `msalAccount` | `AccountInfo` |
| `msalUsername` | `string` |
| `msalUserMail` | `string` |
| `dataToAttach` | `DataToAttach` |
| `token` | `any` |
| `emailMessage` | `EmailMessage` |

## Diagram

```mermaid
graph LR
    A[MSAL redirect or popup] --> B[MsalUriComponent]
    B --> C[ngOnInit]
    C --> D[windowMessageListner]
    D --> E[receiveMessage]
    E --> F[getOpenedTabs]
    E --> G[fetchDataFromAnotherWindow]
    G --> H[fetshMicrosoftData]
    H --> I[setLoginDisplay]
    I --> J[closeWindowPopup]
    B --> K[ngOnDestroy]
```

## Usage

```typescript
import { Routes } from '@angular/router';
import { MsalUriComponent } from './msal/msal-uri/msal-uri.component';

export const routes: Routes = [
  {
    path: 'msal-uri',
    component: MsalUriComponent
  }
];
```

```typescript
// Configure the MSAL redirect URI to point to the Angular route:
// http://localhost:4200/msal-uri
```

## AI Coding Instructions

- Keep `windowMessageListner()` setup paired with cleanup in `ngOnDestroy()` to prevent duplicate message handlers.
- Validate the source and origin of messages handled by `receiveMessage()` before reading authentication or user data.
- Preserve the popup and tab communication flow between `getOpenedTabs()`, `fetchDataFromAnotherWindow()`, and `closeWindowPopup()`.
- Update UI authentication state through `setLoginDisplay()` after Microsoft data is fetched by `fetshMicrosoftData()`.
- Retain the existing `fetshMicrosoftData()` method name unless all callers are updated together.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (2)

- `AppRoutingModule` — `Frontend/src/app/app-routing.module.ts`:1
- `TranslateHandler` — `Frontend/src/app/app.module.ts`:1
