diff --git a/dmp-frontend/src/app/core/services/configuration/configuration.service.ts b/dmp-frontend/src/app/core/services/configuration/configuration.service.ts index 0182501a7..d1dc26236 100644 --- a/dmp-frontend/src/app/core/services/configuration/configuration.service.ts +++ b/dmp-frontend/src/app/core/services/configuration/configuration.service.ts @@ -166,6 +166,11 @@ export class ConfigurationService extends BaseComponent { get sidebar(): Sidebar { return this._sidebar; } + + private _mergeAccountDelayInSeconds: number; + get mergeAccountDelayInSeconds(): number { + return this._mergeAccountDelayInSeconds; + } private _researcherId: any; get researcherId(): boolean { @@ -266,6 +271,7 @@ export class ConfigurationService extends BaseComponent { this._authProviders = AuthProviders.parseValue(config.authProviders); this._analyticsProviders = AnalyticsProviders.parseValue(config.analytics); this._sidebar = Sidebar.parseValue(config.sidebar); + this._mergeAccountDelayInSeconds = config.mergeAccountDelayInSeconds; this._researcherId = config.referenceTypes.researcherId; this._grantId = config.referenceTypes.grantId; this._organizationId = config.referenceTypes.organizationId; diff --git a/dmp-frontend/src/app/ui/auth/login/login.module.ts b/dmp-frontend/src/app/ui/auth/login/login.module.ts index 55537ef31..3c261d883 100644 --- a/dmp-frontend/src/app/ui/auth/login/login.module.ts +++ b/dmp-frontend/src/app/ui/auth/login/login.module.ts @@ -7,6 +7,7 @@ import { CommonUiModule } from '@common/ui/common-ui.module'; import { MergeEmailConfirmation } from './merge-email-confirmation/merge-email-confirmation.component'; import { UnlinkEmailConfirmation } from './unlink-email-confirmation/unlink-email-confirmation.component'; import { UserInviteConfirmation } from './user-invite-confirmation/user-invite-confirmation.component'; +import { MergeEmailLoaderDialogComponent } from './merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component'; @NgModule({ imports: [ @@ -18,7 +19,8 @@ import { UserInviteConfirmation } from './user-invite-confirmation/user-invite-c LoginComponent, MergeEmailConfirmation, UnlinkEmailConfirmation, - UserInviteConfirmation + UserInviteConfirmation, + MergeEmailLoaderDialogComponent, ], exports: [ LoginComponent diff --git a/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-confirmation.component.ts b/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-confirmation.component.ts index f5fcc3ab0..5b32c1d38 100644 --- a/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-confirmation.component.ts +++ b/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-confirmation.component.ts @@ -1,7 +1,8 @@ import { HttpErrorResponse } from "@angular/common/http"; import { Component, OnInit } from "@angular/core"; +import { MatDialog } from "@angular/material/dialog"; import { ActivatedRoute, Router } from "@angular/router"; -import { SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service'; +import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { RouterUtilsService } from "@app/core/services/router/router-utils.service"; import { UserService } from "@app/core/services/user/user.service"; import { BaseComponent } from '@common/base/base.component'; @@ -9,6 +10,7 @@ import { HttpError, HttpErrorHandlingService } from "@common/modules/errors/erro import { Guid } from "@common/types/guid"; import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from "rxjs/operators"; +import { MergeEmailLoaderDialogComponent } from "./merge-email-loader-dialog/merge-email-loader-dialog.component"; @Component({ selector: 'app-email-confirmation-component', @@ -31,7 +33,9 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit { private router: Router, private language: TranslateService, private httpErrorHandlingService: HttpErrorHandlingService, - private routerUtils: RouterUtilsService + private routerUtils: RouterUtilsService, + private dialog: MatDialog, + private uiNotificationService: UiNotificationService, ) { super(); } ngOnInit() { @@ -55,13 +59,24 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit { onConfirm(): void { if (this.showForm === false) return; - this.userService.confirmMergeAccount(this.token) - .subscribe(result => { - if (result) { - this.onCallbackEmailConfirmationSuccess(); - } - }, - error => this.onCallbackError(error)); + let confirmMergeAccountObservable = this.userService.confirmMergeAccount(this.token); + + const dialogRef = this.dialog.open(MergeEmailLoaderDialogComponent, { + maxWidth: '600px', + disableClose: true, + data: { + confirmMergeAccountObservable: confirmMergeAccountObservable, + } + }); + + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result.result) { + this.onCallbackEmailConfirmationSuccess(); + } else { + if (result.error) this.onCallbackError(result.error); + else this.onCallbackError(); + } + }); } onCallbackEmailConfirmationSuccess() { @@ -73,10 +88,17 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit { }); } - onCallbackError(errorResponse: HttpErrorResponse) { + onCallbackError(errorResponse?: HttpErrorResponse) { + + if (!errorResponse) { + this.uiNotificationService.snackBarNotification('GENERAL.SNACK-BAR.GENERIC-ERROR', SnackBarNotificationLevel.Error); + return; + } + const errorOverrides = new Map(); errorOverrides.set(302, this.language.instant('EMAIL-CONFIRMATION.EMAIL-FOUND')); errorOverrides.set(403, this.language.instant('EMAIL-CONFIRMATION.EXPIRED-EMAIL')); + this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides, SnackBarNotificationLevel.Error) const error: HttpError = this.httpErrorHandlingService.getError(errorResponse); diff --git a/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.html b/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.html new file mode 100644 index 000000000..7eb4be42e --- /dev/null +++ b/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.html @@ -0,0 +1,20 @@ + +
+
+
+ +
+
+ {{ 'MERGE-ACCOUNT.MERGE-DIALOG.TITLE' | translate }} +
+
+
+ +
+
+

+ {{ 'MERGE-ACCOUNT.MERGE-DIALOG.MESSAGE' | translate: { s: mergeAccountDelayInSeconds } }} +

+
+
+
\ No newline at end of file diff --git a/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.scss b/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.scss new file mode 100644 index 000000000..b7366f8bb --- /dev/null +++ b/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.scss @@ -0,0 +1,5 @@ +.message { + font-weight: lighter; + font-size: 1.25rem; + line-height: 1.9rem; +} diff --git a/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.ts b/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.ts new file mode 100644 index 000000000..2701629b9 --- /dev/null +++ b/dmp-frontend/src/app/ui/auth/login/merge-email-confirmation/merge-email-loader-dialog/merge-email-loader-dialog.component.ts @@ -0,0 +1,47 @@ +import { Component, Inject, OnDestroy, OnInit } from "@angular/core"; +import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog"; +import { ConfigurationService } from "@app/core/services/configuration/configuration.service"; +import { Subscription, takeUntil } from "rxjs"; + +@Component({ + selector: 'merge-email-loader', + templateUrl: './merge-email-loader-dialog.component.html', + styleUrls: ['./merge-email-loader-dialog.component.scss'], +}) +export class MergeEmailLoaderDialogComponent implements OnInit, OnDestroy { + + confirmMergeAccountSubscription: Subscription; + mergeAccountDelay: number = 60000; + get mergeAccountDelayInSeconds(): number { + return this.mergeAccountDelay/1000; + } + + constructor( + private dialogRef: MatDialogRef, + private configurationService: ConfigurationService, + @Inject(MAT_DIALOG_DATA) public data: any, + ) {} + + + ngOnInit(): void { + if (this.configurationService.mergeAccountDelayInSeconds) this.mergeAccountDelay = this.configurationService.mergeAccountDelayInSeconds*1000; + + if (this.data.confirmMergeAccountObservable) { + this.confirmMergeAccountSubscription = this.data.confirmMergeAccountObservable.subscribe(result => { + if (result) { + setTimeout( _ => this.onClose(true), this.mergeAccountDelay) + } + }, + error => this.onClose(false, error)); + } + } + + onClose(success: boolean, error: any = null) { + this.dialogRef.close({ result: success, error: error}); + } + + ngOnDestroy(): void { + this.confirmMergeAccountSubscription?.unsubscribe(); + } + +} \ No newline at end of file diff --git a/dmp-frontend/src/assets/config/config.json b/dmp-frontend/src/assets/config/config.json index cee52e543..80b02a114 100644 --- a/dmp-frontend/src/assets/config/config.json +++ b/dmp-frontend/src/assets/config/config.json @@ -109,12 +109,32 @@ ], "footerItems": [ { - "routerPath": "/feedback", - "title": "SIDE-BAR.FEEDBACK", + "routerPath": "/about", + "title": "FOOTER.ABOUT", "icon": "feedback", - "externalUrl": "https://docs.google.com/forms/d/12RSCrUjdSDp2LZLpjDKOi44cN1fLDD2q1-F66SqZIis/viewform?edit_requested=true", - "accessLevel": true + "accessLevel": "public" + }, + { + "routerPath": "/terms-and-conditions", + "title": "FOOTER.TERMS-OF-SERVICE", + "accessLevel": "public" + }, + { + "routerPath": "/glossary", + "title": "FOOTER.GLOSSARY", + "accessLevel": "public" + }, + { + "routerPath": "/user-guide", + "title": "FOOTER.GUIDE", + "accessLevel": "public" + }, + { + "routerPath": "/contact-support", + "title": "FOOTER.CONTACT-SUPPORT", + "accessLevel": "authenticated" } ] - } + }, + "mergeAccountDelayInSeconds": 30 } diff --git a/dmp-frontend/src/assets/i18n/baq.json b/dmp-frontend/src/assets/i18n/baq.json index 199f966d9..29dd8d5c8 100644 --- a/dmp-frontend/src/assets/i18n/baq.json +++ b/dmp-frontend/src/assets/i18n/baq.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/de.json b/dmp-frontend/src/assets/i18n/de.json index b296f1f19..d224dae26 100644 --- a/dmp-frontend/src/assets/i18n/de.json +++ b/dmp-frontend/src/assets/i18n/de.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index e51e503d0..e987669aa 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json index d038e6561..bd9c37d51 100644 --- a/dmp-frontend/src/assets/i18n/es.json +++ b/dmp-frontend/src/assets/i18n/es.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json index 2b73018fa..ce0ed1bc9 100644 --- a/dmp-frontend/src/assets/i18n/gr.json +++ b/dmp-frontend/src/assets/i18n/gr.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/hr.json b/dmp-frontend/src/assets/i18n/hr.json index c53b95212..75c16837e 100644 --- a/dmp-frontend/src/assets/i18n/hr.json +++ b/dmp-frontend/src/assets/i18n/hr.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/pl.json b/dmp-frontend/src/assets/i18n/pl.json index e3add285c..ca640986c 100644 --- a/dmp-frontend/src/assets/i18n/pl.json +++ b/dmp-frontend/src/assets/i18n/pl.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/pt.json b/dmp-frontend/src/assets/i18n/pt.json index 9e3a61f5d..a24eda3b9 100644 --- a/dmp-frontend/src/assets/i18n/pt.json +++ b/dmp-frontend/src/assets/i18n/pt.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/sk.json b/dmp-frontend/src/assets/i18n/sk.json index dd69f98f6..5891eae25 100644 --- a/dmp-frontend/src/assets/i18n/sk.json +++ b/dmp-frontend/src/assets/i18n/sk.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/sr.json b/dmp-frontend/src/assets/i18n/sr.json index d205dc8be..d192ff08e 100644 --- a/dmp-frontend/src/assets/i18n/sr.json +++ b/dmp-frontend/src/assets/i18n/sr.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": { diff --git a/dmp-frontend/src/assets/i18n/tr.json b/dmp-frontend/src/assets/i18n/tr.json index 26f97edae..6383250b9 100644 --- a/dmp-frontend/src/assets/i18n/tr.json +++ b/dmp-frontend/src/assets/i18n/tr.json @@ -2274,6 +2274,10 @@ }, "ACTIONS": { "CONFIRM": "Confirm" + }, + "MERGE-DIALOG": { + "TITLE": "Please wait while we are merging your account.", + "MESSAGE": "Please keep this tab open and allow {{ s }} seconds while we are setting things up for you. Be sure to close any other opened tab." } }, "UNLINK-ACCOUNT": {