From edcfa1af3d4af49f5806ade13f523725fa160cff Mon Sep 17 00:00:00 2001 From: Leonardo Mendoza Fernadez Date: Sun, 24 Nov 2024 22:33:18 -0600 Subject: [PATCH] Revert "9499-email-domains-interstitial-registry-sign-in" This reverts commit 70a1495ba35d08b5f60a29c313ffbf8a50084b6b. --- src/app/authorize/authorize.module.ts | 3 +- .../info-panel/info-panel.component.scss | 1 - .../cdk/interstitials/interstitials.module.ts | 8 +- ...share-emails-domains-dialog.component.scss | 12 --- .../share-emails-domains-dialog.component.ts | 52 ------------ .../share-emails-domains.component.ts | 31 ++----- .../cdk/platform-info/browserlist.regexp.ts | 3 +- .../warning-message.component.html | 42 ++++------ .../warning-message.component.scss | 10 +-- .../warning-message.component.scss-theme.scss | 25 ++---- .../warning-message.component.ts | 12 +-- .../login-interstitials.service.spec.ts | 29 ------- .../login-interstitials.service.ts | 80 ------------------- .../components/top-bar/top-bar.component.html | 58 -------------- .../top-bar/top-bar.component.scss-theme.scss | 4 - .../components/top-bar/top-bar.component.ts | 16 +--- .../pages/my-orcid/my-orcid.component.html | 1 - .../pages/my-orcid/my-orcid.component.ts | 22 +---- src/app/record/record.module.ts | 5 +- .../properties/top-bar/top-bar.en.properties | 7 -- 20 files changed, 42 insertions(+), 379 deletions(-) delete mode 100644 src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component.scss delete mode 100644 src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component.ts delete mode 100644 src/app/core/login-interstitials/login-interstitials.service.spec.ts delete mode 100644 src/app/core/login-interstitials/login-interstitials.service.ts diff --git a/src/app/authorize/authorize.module.ts b/src/app/authorize/authorize.module.ts index 518cf9d81a..4dbdc64f2b 100644 --- a/src/app/authorize/authorize.module.ts +++ b/src/app/authorize/authorize.module.ts @@ -15,8 +15,8 @@ import { AuthorizeRoutingModule } from './authorize-routing.module' import { OauthErrorComponent } from './components/oauth-error/oauth-error.component' import { AuthorizeComponent } from './pages/authorize/authorize.component' import { FormAuthorizeComponent } from './components/form-authorize/form-authorize.component' +import { ShareEmailsDomainsComponent } from '../cdk/interstitials/share-emails-domains/share-emails-domains.component' import { InterstitialsModule } from '../cdk/interstitials/interstitials.module' -import { MatLegacyDialogModule } from '@angular/material/legacy-dialog' @NgModule({ declarations: [ @@ -38,7 +38,6 @@ import { MatLegacyDialogModule } from '@angular/material/legacy-dialog' InfoDropDownModule, MatProgressBarModule, InterstitialsModule, - MatLegacyDialogModule, ], }) export class AuthorizeModule {} diff --git a/src/app/cdk/info-panel/info-panel/info-panel.component.scss b/src/app/cdk/info-panel/info-panel/info-panel.component.scss index 102cc04346..a846418b5e 100644 --- a/src/app/cdk/info-panel/info-panel/info-panel.component.scss +++ b/src/app/cdk/info-panel/info-panel/info-panel.component.scss @@ -5,7 +5,6 @@ border: solid 2px; border-radius: 4px; display: flex; - gap: 16px; p { margin: 0; diff --git a/src/app/cdk/interstitials/interstitials.module.ts b/src/app/cdk/interstitials/interstitials.module.ts index ab806a190f..969ef55aec 100644 --- a/src/app/cdk/interstitials/interstitials.module.ts +++ b/src/app/cdk/interstitials/interstitials.module.ts @@ -12,13 +12,9 @@ import { MatLegacyCheckboxModule } from '@angular/material/legacy-checkbox' import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button' import { InfoPanelModule } from '../info-panel/info-panel.module' import { A11yLinkModule } from '../a11y-link/a11y-link.module' -import { ShareEmailsDomainsDialogComponent } from './share-emails-domains/share-emails-domains-dialog.component' @NgModule({ - declarations: [ - ShareEmailsDomainsComponent, - ShareEmailsDomainsDialogComponent, - ], + declarations: [ShareEmailsDomainsComponent], imports: [ CommonModule, MatLegacyCardModule, @@ -33,6 +29,6 @@ import { ShareEmailsDomainsDialogComponent } from './share-emails-domains/share- InfoPanelModule, A11yLinkModule, ], - exports: [ShareEmailsDomainsComponent, ShareEmailsDomainsDialogComponent], + exports: [ShareEmailsDomainsComponent], }) export class InterstitialsModule {} diff --git a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component.scss b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component.scss deleted file mode 100644 index d4fd26a48d..0000000000 --- a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component.scss +++ /dev/null @@ -1,12 +0,0 @@ -mat-card-header.authorize-header { - mat-card-title { - margin: 0 0 32px 0 !important; - display: flex; - flex-direction: column; - align-items: center; - } -} -:host { - padding: 48px; - display: block; -} diff --git a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component.ts b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component.ts deleted file mode 100644 index 78c131f08d..0000000000 --- a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Component, EventEmitter, Inject, Input, Output } from '@angular/core' -import { PlatformInfoService } from '../../platform-info' -import { AssertionVisibilityString, EmailsEndpoint } from 'src/app/types' -import { FormBuilder, FormControl, FormGroup } from '@angular/forms' -import { RecordEmailsService } from 'src/app/core/record-emails/record-emails.service' -import { error } from 'console' -import { WINDOW } from '../../window' -import { - MAT_LEGACY_DIALOG_DATA, - MatLegacyDialogRef, - MatLegacyDialogState, -} from '@angular/material/legacy-dialog' -import { ShareEmailsDomainsComponent } from './share-emails-domains.component' - -export type ShareEmailsDomainsComponentDialogInput = { - userEmailsJson: EmailsEndpoint - organizationName?: string -} - -@Component({ - templateUrl: './share-emails-domains.component.html', - styleUrls: [ - './share-emails-domains.component.scss', - './share-emails-domains.component.scss-theme.scss', - './share-emails-domains-dialog.component.scss', - ], -}) -export class ShareEmailsDomainsDialogComponent extends ShareEmailsDomainsComponent { - constructor( - platformInfo: PlatformInfoService, - fb: FormBuilder, - recordEmailsService: RecordEmailsService, - @Inject(WINDOW) window: Window, - @Inject(MAT_LEGACY_DIALOG_DATA) - public data: ShareEmailsDomainsComponentDialogInput, - public dialogRef: MatLegacyDialogRef - ) { - super(platformInfo, fb, recordEmailsService, window) - if (this.data) { - this.userEmailsJson = this.data.userEmailsJson - this.organizationName = this.data.organizationName - this.dialogMode = true - } - } - - override finishIntertsitial(emails?: string[]) { - this.finish.emit() - if (this.dialogRef.getState() === MatLegacyDialogState.OPEN) { - this.dialogRef.close(emails) - } - } -} diff --git a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts index 1114e2ea35..be75d51a8b 100644 --- a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts +++ b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts @@ -5,16 +5,6 @@ import { FormBuilder, FormControl, FormGroup } from '@angular/forms' import { RecordEmailsService } from 'src/app/core/record-emails/record-emails.service' import { error } from 'console' import { WINDOW } from '../../window' -import { - MAT_LEGACY_DIALOG_DATA, - MatLegacyDialogRef, - MatLegacyDialogState, -} from '@angular/material/legacy-dialog' - -export type ShareEmailsDomainsComponentDialogInput = { - userEmailsJson: EmailsEndpoint - organizationName?: string -} @Component({ selector: 'app-share-emails-domains', @@ -31,7 +21,6 @@ export class ShareEmailsDomainsComponent { @Input() userEmailsJson: EmailsEndpoint @Input() organizationName: string form: any - dialogMode: boolean constructor( public platformInfo: PlatformInfoService, private fb: FormBuilder, @@ -89,22 +78,16 @@ export class ShareEmailsDomainsComponent { this.recordEmailsService.postEmails(this.userEmailsJson).subscribe( (response) => { - if (!this.dialogMode) { - this.afterSummit = true - this.beforeSummit = false - } else { - this.finishIntertsitial(this.domainToMakePublic) - } - setTimeout(() => {}, 10000) + this.afterSummit = true + this.beforeSummit = false + setTimeout(() => { + this.finish.emit() + }, 10000) }, - (error) => this.finishIntertsitial() + (error) => this.finish.emit() ) } else { - this.finishIntertsitial() + this.finish.emit() } } - - finishIntertsitial(emails?: string[]) { - this.finish.emit() - } } diff --git a/src/app/cdk/platform-info/browserlist.regexp.ts b/src/app/cdk/platform-info/browserlist.regexp.ts index bf8c4aa5cf..545a90290e 100644 --- a/src/app/cdk/platform-info/browserlist.regexp.ts +++ b/src/app/cdk/platform-info/browserlist.regexp.ts @@ -1,2 +1,3 @@ // tslint:disable-next-line: max-line-length -export const BROWSERLIST_REGEXP = /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+|17[_.]0|17[_.]([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+|17\.0|17\.([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/ +export const BROWSERLIST_REGEXP = + /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+|17[_.]0|17[_.]([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+|17\.0|17\.([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/ diff --git a/src/app/cdk/warning-message/warning-message/warning-message.component.html b/src/app/cdk/warning-message/warning-message/warning-message.component.html index c62892e1da..bc8c53f23f 100644 --- a/src/app/cdk/warning-message/warning-message/warning-message.component.html +++ b/src/app/cdk/warning-message/warning-message/warning-message.component.html @@ -1,33 +1,19 @@
-
-
- - {{ icon }} -
-
- - - -

- -

-
+
+ {{ icon }} +
+
+ + + +

+ +

diff --git a/src/app/cdk/warning-message/warning-message/warning-message.component.scss b/src/app/cdk/warning-message/warning-message/warning-message.component.scss index 946dc5dac8..854c6a3fd6 100644 --- a/src/app/cdk/warning-message/warning-message/warning-message.component.scss +++ b/src/app/cdk/warning-message/warning-message/warning-message.component.scss @@ -10,12 +10,8 @@ } } } -.wrapper { - border: 2px solid; - padding: 14px; -} - :host { - display: block; + border: 1px solid; + padding: 14px; width: 100%; -} \ No newline at end of file +} diff --git a/src/app/cdk/warning-message/warning-message/warning-message.component.scss-theme.scss b/src/app/cdk/warning-message/warning-message/warning-message.component.scss-theme.scss index 95353602ee..692fdc1308 100644 --- a/src/app/cdk/warning-message/warning-message/warning-message.component.scss-theme.scss +++ b/src/app/cdk/warning-message/warning-message/warning-message.component.scss-theme.scss @@ -7,29 +7,18 @@ $warn: map-get($theme, accent); $foreground: map-get($theme, foreground); $background: map-get($theme, background); - - .wrapper.warning-message { + :host { border-color: mat.get-color-from-palette( $foreground, 'state-notice-dark' ) !important; - .container-text-and-icon { - mat-icon { - color: mat.get-color-from-palette( - $foreground, - 'state-notice-dark' - ) !important; - } - } } - - .wrapper.success-message { - border-color: $brand-primary-dark; - - .container-text-and-icon { - mat-icon { - color: $brand-primary-dark; - } + .container-text-and-icon { + mat-icon { + color: mat.get-color-from-palette( + $foreground, + 'state-notice-dark' + ) !important; } } } diff --git a/src/app/cdk/warning-message/warning-message/warning-message.component.ts b/src/app/cdk/warning-message/warning-message/warning-message.component.ts index 0e085754d1..08e432ac02 100644 --- a/src/app/cdk/warning-message/warning-message/warning-message.component.ts +++ b/src/app/cdk/warning-message/warning-message/warning-message.component.ts @@ -13,17 +13,7 @@ import { PlatformInfoService } from '../../platform-info' preserveWhitespaces: false, }) export class WarningMessageComponent implements OnInit, OnDestroy { - private _type: 'warning' | 'success' | 'info' = 'warning' - icon = 'info' - - @Input() set type(value: 'warning' | 'success' | 'info') { - this._type = value - this.icon = value === 'warning' ? 'info' : value === 'success' ? 'thumb_up' : 'info' - } - get type(): 'warning' | 'success' | 'info' { - return this._type - } - + @Input() icon = 'info' isMobile: boolean $destroy: Subject = new Subject() diff --git a/src/app/core/login-interstitials/login-interstitials.service.spec.ts b/src/app/core/login-interstitials/login-interstitials.service.spec.ts deleted file mode 100644 index a1c58e95be..0000000000 --- a/src/app/core/login-interstitials/login-interstitials.service.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { TestBed } from '@angular/core/testing' - -import { LoginInterstitialsService } from './login-interstitials.service' -import { MatLegacyDialog } from '@angular/material/legacy-dialog' -import { InterstitialsService } from 'src/app/cdk/interstitials/interstitials.service' -import { TogglzService } from '../togglz/togglz.service' -import { NEVER } from 'rxjs' - -describe('LoginInterstitialsService', () => { - let service: LoginInterstitialsService - - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [ - { provide: MatLegacyDialog, useValue: {} }, - { - provide: InterstitialsService, - useValue: { getInterstitialsViewed: () => NEVER }, - }, - { provide: TogglzService, useValue: { getStateOf: () => NEVER } }, - ], - }) - service = TestBed.inject(LoginInterstitialsService) - }) - - it('should be created', () => { - expect(service).toBeTruthy() - }) -}) diff --git a/src/app/core/login-interstitials/login-interstitials.service.ts b/src/app/core/login-interstitials/login-interstitials.service.ts deleted file mode 100644 index 11e9ed9462..0000000000 --- a/src/app/core/login-interstitials/login-interstitials.service.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Injectable } from '@angular/core' -import { - MatLegacyDialog as MatDialog, - MatLegacyDialogState, -} from '@angular/material/legacy-dialog' -import { ShareEmailsDomainsComponent } from 'src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component' -import { EmailsEndpoint } from 'src/app/types' -import { UserRecord } from 'src/app/types/record.local' -import { ShareEmailsDomainsComponentDialogInput } from 'src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component' -import { InterstitialsService } from 'src/app/cdk/interstitials/interstitials.service' -import { Observable } from 'rxjs' -import { ShareEmailsDomainsDialogComponent } from 'src/app/cdk/interstitials/share-emails-domains/share-emails-domains-dialog.component' -import { TogglzService } from '../togglz/togglz.service' - -@Injectable({ - providedIn: 'root', -}) -export class LoginInterstitialsService { - alreadySawSignDomainInterstitial: boolean - loginDomainsInterstitialEnabled: boolean - constructor( - private _matDialog: MatDialog, - private interstitialService: InterstitialsService, - private toggleService: TogglzService - ) { - this.interstitialService - .getInterstitialsViewed('SIGN_IN_DOMAIN_INTERSTITIAL') - .subscribe((viewed) => { - this.alreadySawSignDomainInterstitial = viewed - }) - this.toggleService - .getStateOf('LOGIN_DOMAINS_INTERSTITIAL') - .subscribe((state) => { - this.loginDomainsInterstitialEnabled = state - }) - } - - checkLoginInterstitials(userRecord: UserRecord): Observable | void { - let isNotImpersonating - if (userRecord.userInfo) { - isNotImpersonating = - userRecord.userInfo.REAL_USER_ORCID === - userRecord.userInfo.EFFECTIVE_USER_ORCID - } - if ( - isNotImpersonating && - userRecord.emails && - userRecord.emails.emailDomains && - !this.userHasPublicDomains(userRecord.emails) && - this.userHasPrivateDomains(userRecord.emails) && - this.loginDomainsInterstitialEnabled && - !this.alreadySawSignDomainInterstitial - ) { - this.alreadySawSignDomainInterstitial = true - this.interstitialService - .setInterstitialsViewed('SIGN_IN_DOMAIN_INTERSTITIAL') - .subscribe() - const data: ShareEmailsDomainsComponentDialogInput = { - userEmailsJson: userRecord.emails, - } - - const dialog = this._matDialog.open(ShareEmailsDomainsDialogComponent, { - data, - width: '580px', - disableClose: true, - autoFocus: false, - restoreFocus: false, - }) - return dialog.afterClosed() - } - } - - userHasPublicDomains(value: EmailsEndpoint): any { - return !!value.emailDomains.find((domain) => domain.visibility === 'PUBLIC') - } - - userHasPrivateDomains(value: EmailsEndpoint): boolean { - return !!value.emailDomains.find((domain) => domain.visibility !== 'PUBLIC') - } -} diff --git a/src/app/record/components/top-bar/top-bar.component.html b/src/app/record/components/top-bar/top-bar.component.html index 7c7ab37756..a2bd997aca 100644 --- a/src/app/record/components/top-bar/top-bar.component.html +++ b/src/app/record/components/top-bar/top-bar.component.html @@ -33,64 +33,6 @@ - - Email domains shared - The email domains - The email domain - - - {{ email }}, - - - - and - - {{ email }} - - - are now visible on your public ORCID record. Manage your email addresses - and domains in the - - - is now visible on your public ORCID record. Manage your email addresses - and domains in the - - - Emails & domains section. - - -