From 4ff6cf5a059da85d049276bc1f63feb2b79b8c41 Mon Sep 17 00:00:00 2001
From: andrej romanov <50377758+auumgn@users.noreply.github.com>
Date: Tue, 12 Nov 2024 18:53:29 +0200
Subject: [PATCH 1/3] add alert message to developer tools window
---
.../terms-of-use/terms-of-use.component.html | 19 +++++++++++++++++++
.../terms-of-use/terms-of-use.component.scss | 11 +++++++++++
.../terms-of-use/terms-of-use.component.ts | 18 ++++++++++++++++++
.../developer-tools/developer-tools.module.ts | 2 ++
.../developer-tools.en.properties | 3 +++
5 files changed, 53 insertions(+)
diff --git a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.html b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.html
index cd639f1d43..660934505b 100644
--- a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.html
+++ b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.html
@@ -132,6 +132,25 @@
+
+ No verified email addresses found
+
+
+ You must have at least one verified email address in your ORCID account
+ to register for your Public API credentials. Manage your email addresses
+ in the
+ Emails and domains section of your ORCID record.
+
+
+
warning
diff --git a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.scss b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.scss
index 119a7b1144..0746ee38e1 100644
--- a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.scss
+++ b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.scss
@@ -45,3 +45,14 @@ h2 {
.mat-button-wrap-text {
margin-bottom: 32px;
}
+
+app-alert-message {
+ line-height: 21px;
+ margin-top: 16px;
+ a {
+ text-decoration: underline;
+ }
+ p {
+ margin-bottom: 0;
+ }
+}
diff --git a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.ts b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.ts
index e0f049baa3..0d14e464bc 100644
--- a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.ts
+++ b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.ts
@@ -9,9 +9,11 @@ import {
ViewChild,
} from '@angular/core'
import { MatLegacyCheckbox as MatCheckbox } from '@angular/material/legacy-checkbox'
+import { MatLegacyDialog } from '@angular/material/legacy-dialog'
import { Subject } from 'rxjs'
import { takeUntil } from 'rxjs/operators'
import { PlatformInfoService } from 'src/app/cdk/platform-info'
+import { ModalEmailComponent } from 'src/app/cdk/side-bar/modals/modal-email/modal-email.component'
import { DeveloperToolsService } from 'src/app/core/developer-tools/developer-tools.service'
import { RecordService } from 'src/app/core/record/record.service'
@@ -31,10 +33,12 @@ export class TermsOfUseComponent implements OnInit, OnDestroy {
@Output() developerToolsEnable = new EventEmitter
()
$destroy = new Subject()
emailAlreadyVerified: boolean
+ hasVerifiedEmailAddress: boolean
constructor(
private developerToolsService: DeveloperToolsService,
private _record: RecordService,
+ private _dialog: MatLegacyDialog,
private _changeDetectorRef: ChangeDetectorRef
) {}
ngOnDestroy(): void {
@@ -50,6 +54,9 @@ export class TermsOfUseComponent implements OnInit, OnDestroy {
const primaryEmail = userRecord?.emails?.emails?.filter(
(email) => email.primary
)[0]
+ this.hasVerifiedEmailAddress = userRecord.emails.emails.some(
+ (email) => email.verified
+ )
if (primaryEmail?.verified) {
this.emailAlreadyVerified = true
this._changeDetectorRef.detectChanges()
@@ -57,6 +64,17 @@ export class TermsOfUseComponent implements OnInit, OnDestroy {
})
}
+ openEmailModal() {
+ return this._dialog
+ .open(ModalEmailComponent, {
+ width: '850px',
+ maxWidth: '99%',
+ // data: this.userRecord,
+ // ariaLabel: getAriaLabel(this.editModalComponent, this.type),
+ })
+ .afterClosed()
+ }
+
registerForPublicApi() {
this.dirty = true
if (!this.checked) {
diff --git a/src/app/developer-tools/developer-tools.module.ts b/src/app/developer-tools/developer-tools.module.ts
index b4d50e3a08..81061d8d35 100644
--- a/src/app/developer-tools/developer-tools.module.ts
+++ b/src/app/developer-tools/developer-tools.module.ts
@@ -22,6 +22,7 @@ import { ModalModule } from '../cdk/modal/modal.module'
import { A11yLinkModule } from '../cdk/a11y-link/a11y-link.module'
import { TopBarVerificationEmailModule } from '../cdk/top-bar-verification-email/top-bar-verification-email.module'
import { DeveloperToolsComponent } from './pages/developer-tools/developer-tools.component'
+import { AlertMessageModule } from '../cdk/alert-message/alert-message.module'
@NgModule({
declarations: [
@@ -49,6 +50,7 @@ import { DeveloperToolsComponent } from './pages/developer-tools/developer-tools
ModalModule,
A11yLinkModule,
TopBarVerificationEmailModule,
+ AlertMessageModule,
],
})
export class DeveloperToolsModule {}
diff --git a/src/locale/properties/developer-tools/developer-tools.en.properties b/src/locale/properties/developer-tools/developer-tools.en.properties
index 11594b966e..c5a51af0db 100644
--- a/src/locale/properties/developer-tools/developer-tools.en.properties
+++ b/src/locale/properties/developer-tools/developer-tools.en.properties
@@ -82,3 +82,6 @@ developerTools.publicClientApplicationsAreGranted2=If you need access to an ORCI
developerTools.memberApi=Member API
developerTools.mayBeMoreAppropriate=is available to ORCID member organizations.
developerTools.byRegisteringForPublicApi=By “non-commercial” we mean that you may not charge any re-use fees for the Public API, and you may not make use of the Public API in connection with any revenue-generating product or service.
+developerTools.noVerifiedEmailAddresses=No verified email addresses found
+developerTools.youMustHaveAtLeastOneVerifiedEmail=You must have at least one verified email address in your ORCID account to register for your Public API credentials. Manage your email addresses in the
+developerTools.emailsAndDomainsSection=Emails and domains section of your ORCID record
From 73cce7602542a1ab31f2c4ce6758a834b22c421c Mon Sep 17 00:00:00 2001
From: andrej romanov <50377758+auumgn@users.noreply.github.com>
Date: Tue, 12 Nov 2024 18:54:22 +0200
Subject: [PATCH 2/3] add conditional statement
---
.../components/terms-of-use/terms-of-use.component.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.html b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.html
index 660934505b..15b5120029 100644
--- a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.html
+++ b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.html
@@ -132,7 +132,7 @@
-
+
No verified email addresses found
From 1fca7c6623d059630f374a9e70947e85e723fd5c Mon Sep 17 00:00:00 2001
From: andrej romanov <50377758+auumgn@users.noreply.github.com>
Date: Tue, 12 Nov 2024 19:08:32 +0200
Subject: [PATCH 3/3] fix test
---
.../components/terms-of-use/terms-of-use.component.spec.ts | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.spec.ts b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.spec.ts
index d89be99986..5830ed280e 100644
--- a/src/app/developer-tools/components/terms-of-use/terms-of-use.component.spec.ts
+++ b/src/app/developer-tools/components/terms-of-use/terms-of-use.component.spec.ts
@@ -7,6 +7,8 @@ import { RecordService } from 'src/app/core/record/record.service'
import { of } from 'rxjs'
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
+import { MatLegacyDialog } from '@angular/material/legacy-dialog'
+import { useAnimation } from '@angular/animations'
describe('TermsOfUseComponent', () => {
let component: TermsOfUseComponent
@@ -19,6 +21,7 @@ describe('TermsOfUseComponent', () => {
{ provide: DeveloperToolsService, useValue: {} },
{ provide: PlatformInfoService, useValue: {} },
{ provide: RecordService, useValue: { getRecord: () => of() } },
+ { provide: MatLegacyDialog, useValue: {} },
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
}).compileComponents()