Skip to content

Commit 5c65533

Browse files
authored
Merge pull request #2529 from ORCID/lmendoza/jun-2025-multiple-changes
lmendoza/jun-2025-multiple-changes
2 parents eff144c + 89577e1 commit 5c65533

12 files changed

Lines changed: 202 additions & 60 deletions

File tree

src/app/core/login-interstitials-manager/login-main-interstitials-manager.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ export class LoginMainInterstitialsManagerService {
3636
LoginDomainInterstitialManagerService: LoginDomainInterstitialManagerService,
3737
LoginAffiliationInterstitialManagerService: LoginAffiliationInterstitialManagerService
3838
) {
39+
// Delare here all the interstitial services.
40+
// This are the entry points to add new interstitials.
41+
// They should be added in the order they should be checked.
42+
// The first one that returns a component or a dialog subscription will be used.
43+
// The rest will be ignored.
3944
this.interstitialServices = [
4045
LoginDomainInterstitialManagerService,
4146
LoginAffiliationInterstitialManagerService,

src/app/core/observability-events/observability-events.service.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { Inject, Injectable } from '@angular/core'
22
import { WINDOW } from 'src/app/cdk/window'
33

4-
export type JourneyType = 'orcid_registration' | 'orcid_update_emails'
4+
export type JourneyType =
5+
| 'orcid_registration'
6+
| 'orcid_update_emails'
7+
| 'orcid_with_notifications'
8+
| 'orcid_without_notifications'
59
@Injectable({
610
providedIn: 'root',
711
})
@@ -26,7 +30,7 @@ export class CustomEventService {
2630

2731
if (runtimeEnvironment.debugger) {
2832
console.debug(
29-
`-> Journey "${journeyType}" started at ${this.journeys[journeyType].startTime}`,
33+
`[RUM][journey:${journeyType}] : start`,
3034
attributes
3135
)
3236
}
@@ -58,14 +62,14 @@ export class CustomEventService {
5862
eventName,
5963
elapsedTime,
6064
}
61-
if (typeof (this.window as any)?.addPageAction === 'function') {
65+
if (typeof (this.window as any).newrelic?.addPageAction === 'function') {
6266
;(this.window as any).newrelic.addPageAction(journeyType, eventAttributes)
6367
}
6468
// Send the custom event to New Relic
6569

6670
if (runtimeEnvironment.debugger) {
6771
console.debug(
68-
`-> Event "${eventName}" recorded for journey "${journeyType}" with elapsed time ${elapsedTime}ms`,
72+
`[RUM][journey:${journeyType}] : event ${eventName}`,
6973
eventAttributes
7074
)
7175
}
@@ -94,15 +98,18 @@ export class CustomEventService {
9498
}
9599

96100
// Send the final custom event to New Relic
97-
if (typeof (this.window as any)?.addPageAction === 'function') {
98-
;(this.window as any).addPageAction(journeyType, finalAttributes)
101+
if (typeof (this.window as any).newrelic?.addPageAction === 'function') {
102+
;(this.window as any).newrelic?.addPageAction(
103+
journeyType,
104+
finalAttributes
105+
)
99106
}
100107

101108
// Clean up the journey data
102109
delete this.journeys[journeyType]
103110

104111
console.debug(
105-
`Journey "${journeyType}" finished with elapsed time ${elapsedTime}ms`,
112+
`[RUM][journey:${journeyType}] : finished`,
106113
finalAttributes
107114
)
108115
}

src/app/layout/header/header.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,7 @@ nav {
195195
app-search {
196196
overflow: hidden;
197197
}
198+
199+
app-user-menu {
200+
display: flex;
201+
}

src/app/layout/layout.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { BannerModule } from '../cdk/banner/banner.module'
2121
import { MaintenanceMessageComponent } from './maintenance-message/maintenance-message.component'
2222
import { MatDividerModule } from '@angular/material/divider'
2323
import { A11yLinkModule } from '../cdk/a11y-link/a11y-link.module'
24+
import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip'
2425

2526
@NgModule({
2627
imports: [
@@ -37,6 +38,7 @@ import { A11yLinkModule } from '../cdk/a11y-link/a11y-link.module'
3738
BannerModule,
3839
MatDividerModule,
3940
A11yLinkModule,
41+
MatTooltipModule,
4042
],
4143
declarations: [
4244
HeaderComponent,

src/app/layout/user-menu/user-menu.component.html

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,35 @@
2929
<ng-container i18n="@@header.signin">Sign in</ng-container
3030
>&nbsp;/&nbsp;<ng-container i18n="@@header.register">Register</ng-container>
3131
</button>
32+
<button
33+
mat-stroked-button
34+
class="user-menu-button"
35+
(click)="goto('inbox', 'fromHeaderButton')"
36+
id="cy-inbox-button"
37+
*ngIf="userInfo"
38+
[matTooltip]="
39+
inboxUnread > 0 ? notificationTooltipActive : notificationTooltip
40+
"
41+
[attr.aria-label]="
42+
inboxUnread > 0 ? notificationTooltipActive : notificationTooltip
43+
"
44+
>
45+
<mat-icon
46+
matBadgeSize="small"
47+
matBadgeColor="warn"
48+
class="material-icons-outlined"
49+
><img
50+
*ngIf="inboxUnread === 0"
51+
src="./assets/vectors/notification-button.svg"
52+
alt=""
53+
/>
54+
<img
55+
*ngIf="inboxUnread > 0"
56+
src="./assets/vectors/notification-button-active.svg"
57+
alt=""
58+
/>
59+
</mat-icon>
60+
</button>
3261
</section>
3362
<mat-menu #menu="matMenu" class="user-menu" id="cy-user-menu">
3463
<button
@@ -47,8 +76,11 @@
4776
</div>
4877
</div>
4978
</button>
50-
<button mat-menu-item (click)="goto('inbox')" id="cy-inbox">
51-
<mat-icon>inbox</mat-icon>
79+
<button mat-menu-item (click)="goto('inbox', 'fromMenuButton')" id="cy-inbox">
80+
<mat-icon *ngIf="inboxUnread === 0">inbox</mat-icon>
81+
<mat-icon *ngIf="inboxUnread > 0"
82+
><img src="./assets/vectors/notification-button-active.svg"
83+
/></mat-icon>
5284
<span i18n="@@workspace.notifications">Inbox</span>
5385
({{ inboxUnread }})
5486
</button>
@@ -133,3 +165,4 @@
133165
<span i18n="@@ngOrcid.logout">Logout</span>
134166
</button>
135167
</mat-menu>
168+
<!-- Beel for Inbox-->

src/app/layout/user-menu/user-menu.component.scss

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
section {
2+
display: flex;
3+
flex-wrap: nowrap;
4+
}
5+
16
.main-button {
27
height: auto;
38
.main-button-container {
@@ -37,7 +42,6 @@
3742
:host {
3843
.user-menu-button {
3944
max-width: 100%;
40-
padding: 0 32px;
4145
.columns-4 & {
4246
padding: 0;
4347
}
@@ -69,7 +73,14 @@
6973

7074
span.name-text-container {
7175
overflow: hidden;
72-
width: calc(100% - 59px);
76+
max-width: calc(102% - 55px);
7377
display: inline-block;
7478
text-overflow: ellipsis;
79+
width: fit-content;
80+
}
81+
82+
[mat-stroked-button] {
83+
min-width: 40px;
84+
padding: 0;
85+
margin: 0 16px;
7586
}

src/app/layout/user-menu/user-menu.component.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ApplicationRoutes } from 'src/app/constants'
99
import { TogglzService } from 'src/app/core/togglz/togglz.service'
1010
import { InboxService } from '../../core/inbox/inbox.service'
1111
import { first } from 'rxjs/operators'
12+
import { CustomEventService } from 'src/app/core/observability-events/observability-events.service'
1213

1314
@Component({
1415
selector: 'app-user-menu',
@@ -25,16 +26,20 @@ export class UserMenuComponent implements OnInit {
2526
platform: PlatformInfo
2627
labelSigninRegister = $localize`:@@layout.ariaLabelSigninRegister:Sign in to ORCID or register for your ORCID iD`
2728
labelUserMenu = $localize`:@@layout.ariaLabelUserMenu:User menu`
29+
notificationTooltipActive = $localize`:@@layout.notificationTooltip:You have unread notifications`
30+
notificationTooltip = $localize`:@@layout.notificationTooltipInactive:Notifications inbox`
2831
isAccountDelegate: boolean
2932
inboxUnread = 0
33+
userJourney!: 'orcid_with_notifications' | 'orcid_without_notifications'
3034

3135
constructor(
3236
private _router: Router,
3337
private _userInfo: UserService,
3438
@Inject(WINDOW) private window: Window,
3539
_platform: PlatformInfoService,
3640
private _inboxService: InboxService,
37-
private _togglz: TogglzService
41+
private _togglz: TogglzService,
42+
private observabilityEventService: CustomEventService
3843
) {
3944
_userInfo.getUserSession().subscribe((data) => {
4045
if (data.loggedIn) {
@@ -56,15 +61,27 @@ export class UserMenuComponent implements OnInit {
5661
this._inboxService
5762
.retrieveUnreadCount()
5863
.pipe(first())
59-
.subscribe((inboxUnread) => (this.inboxUnread = inboxUnread))
64+
.subscribe((inboxUnread) => {
65+
;(this.userJourney =
66+
inboxUnread > 0
67+
? 'orcid_with_notifications'
68+
: 'orcid_without_notifications'),
69+
this.observabilityEventService.startJourney(
70+
this.userJourney,
71+
72+
{ inboxUnread }
73+
)
74+
this.inboxUnread = inboxUnread
75+
})
6076
}
6177

62-
goto(url) {
78+
goto(url, from?: string) {
6379
if (url === 'my-orcid') {
6480
this._router.navigate([ApplicationRoutes.myOrcid])
6581
} else if (url === 'signin') {
6682
this._router.navigate([ApplicationRoutes.signin])
6783
} else if (url === 'inbox') {
84+
this.observabilityEventService.recordEvent(this.userJourney, from)
6885
this._router.navigate([ApplicationRoutes.inbox])
6986
} else if (url === 'account') {
7087
this._router.navigate([ApplicationRoutes.account])
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/environments/environment.local.4200.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const environment: EnvironmentInterface = {
77
API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8',
88
API_PUB: `//<SUBDOMAIN><DOMAIN>/v3.0`,
99
API_WEB: `//<SUBDOMAIN><DOMAIN>/`,
10-
AUTH_SERVER: 'https://auth.<SUBDOMAIN><DOMAIN>/',
10+
AUTH_SERVER: '//<SUBDOMAIN><DOMAIN>/auth/',
1111
BASE_URL: '//<SUBDOMAIN><DOMAIN>/',
1212
INFO_SITE: 'https://info.orcid.org/',
1313
GOOGLE_ANALYTICS_TESTING_MODE: true,

0 commit comments

Comments
 (0)