From bdd23034ce4246ea63b3dd367088e75b549a2674 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:07:48 +0200 Subject: [PATCH 1/5] remove old register folder --- .../ErrorStateMatcherForFormLevelErrors.ts | 35 -- src/app/register/components/BaseForm.ts | 65 ---- src/app/register/components/BaseStep.ts | 16 - .../backend-error.component.html | 45 --- .../backend-error.component.scss | 0 .../backend-error.component.spec.ts | 48 --- .../backend-error/backend-error.component.ts | 100 ------ .../form-anti-robots.component.html | 14 - .../form-anti-robots.component.scss | 0 .../form-anti-robots.component.spec.ts | 50 --- .../form-anti-robots.component.ts | 99 ----- .../form-notifications.component.html | 35 -- .../form-notifications.component.scss | 3 - .../form-notifications.component.spec.ts | 58 --- .../form-notifications.component.ts | 51 --- .../form-password.component.html | 193 ---------- .../form-password.component.scss | 20 -- .../form-password.component.scss-theme.scss | 16 - .../form-password.component.spec.ts | 61 ---- .../form-password/form-password.component.ts | 112 ------ ...-personal-additional-emails.component.html | 103 ------ ...-personal-additional-emails.component.scss | 11 - ...rsonal-additional-emails.component.spec.ts | 29 -- ...rm-personal-additional-emails.component.ts | 92 ----- .../form-personal.component.html | 186 ---------- .../form-personal.component.scss | 4 - .../form-personal.component.spec.ts | 58 --- .../form-personal/form-personal.component.ts | 192 ---------- .../form-terms/form-terms.component.html | 66 ---- .../form-terms/form-terms.component.scss | 12 - .../form-terms/form-terms.component.spec.ts | 48 --- .../form-terms/form-terms.component.ts | 69 ---- .../form-visibility.component.html | 95 ----- .../form-visibility.component.scss | 10 - .../form-visibility.component.spec.ts | 48 --- .../form-visibility.component.ts | 68 ---- .../components/step-a/step-a.component.html | 71 ---- .../components/step-a/step-a.component.scss | 4 - .../step-a/step-a.component.spec.ts | 67 ---- .../components/step-a/step-a.component.ts | 80 ----- .../components/step-b/step-b.component.html | 53 --- .../components/step-b/step-b.component.scss | 4 - .../step-b/step-b.component.spec.ts | 85 ----- .../components/step-b/step-b.component.ts | 18 - .../components/step-c/step-c.component.html | 73 ---- .../components/step-c/step-c.component.scss | 4 - .../step-c/step-c.component.spec.ts | 121 ------- .../components/step-c/step-c.component.ts | 18 - .../top-bar-record-issues.component.html | 1 - .../top-bar-record-issues.component.scss | 0 .../top-bar-record-issues.component.spec.ts | 27 -- .../top-bar-record-issues.component.ts | 12 - .../pages/register/register.component.html | 94 ----- .../pages/register/register.component.scss | 9 - .../pages/register/register.component.spec.ts | 57 --- .../pages/register/register.component.ts | 338 ------------------ src/app/register/register-routing.module.ts | 16 - src/app/register/register.module.ts | 74 ---- 58 files changed, 3338 deletions(-) delete mode 100644 src/app/register/ErrorStateMatcherForFormLevelErrors.ts delete mode 100644 src/app/register/components/BaseForm.ts delete mode 100644 src/app/register/components/BaseStep.ts delete mode 100644 src/app/register/components/backend-error/backend-error.component.html delete mode 100644 src/app/register/components/backend-error/backend-error.component.scss delete mode 100644 src/app/register/components/backend-error/backend-error.component.spec.ts delete mode 100644 src/app/register/components/backend-error/backend-error.component.ts delete mode 100644 src/app/register/components/form-anti-robots/form-anti-robots.component.html delete mode 100644 src/app/register/components/form-anti-robots/form-anti-robots.component.scss delete mode 100644 src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts delete mode 100644 src/app/register/components/form-anti-robots/form-anti-robots.component.ts delete mode 100644 src/app/register/components/form-notifications/form-notifications.component.html delete mode 100644 src/app/register/components/form-notifications/form-notifications.component.scss delete mode 100644 src/app/register/components/form-notifications/form-notifications.component.spec.ts delete mode 100644 src/app/register/components/form-notifications/form-notifications.component.ts delete mode 100644 src/app/register/components/form-password/form-password.component.html delete mode 100644 src/app/register/components/form-password/form-password.component.scss delete mode 100644 src/app/register/components/form-password/form-password.component.scss-theme.scss delete mode 100644 src/app/register/components/form-password/form-password.component.spec.ts delete mode 100644 src/app/register/components/form-password/form-password.component.ts delete mode 100644 src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.html delete mode 100644 src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.scss delete mode 100644 src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts delete mode 100644 src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts delete mode 100644 src/app/register/components/form-personal/form-personal.component.html delete mode 100644 src/app/register/components/form-personal/form-personal.component.scss delete mode 100644 src/app/register/components/form-personal/form-personal.component.spec.ts delete mode 100644 src/app/register/components/form-personal/form-personal.component.ts delete mode 100644 src/app/register/components/form-terms/form-terms.component.html delete mode 100644 src/app/register/components/form-terms/form-terms.component.scss delete mode 100644 src/app/register/components/form-terms/form-terms.component.spec.ts delete mode 100644 src/app/register/components/form-terms/form-terms.component.ts delete mode 100644 src/app/register/components/form-visibility/form-visibility.component.html delete mode 100644 src/app/register/components/form-visibility/form-visibility.component.scss delete mode 100644 src/app/register/components/form-visibility/form-visibility.component.spec.ts delete mode 100644 src/app/register/components/form-visibility/form-visibility.component.ts delete mode 100644 src/app/register/components/step-a/step-a.component.html delete mode 100644 src/app/register/components/step-a/step-a.component.scss delete mode 100644 src/app/register/components/step-a/step-a.component.spec.ts delete mode 100644 src/app/register/components/step-a/step-a.component.ts delete mode 100644 src/app/register/components/step-b/step-b.component.html delete mode 100644 src/app/register/components/step-b/step-b.component.scss delete mode 100644 src/app/register/components/step-b/step-b.component.spec.ts delete mode 100644 src/app/register/components/step-b/step-b.component.ts delete mode 100644 src/app/register/components/step-c/step-c.component.html delete mode 100644 src/app/register/components/step-c/step-c.component.scss delete mode 100644 src/app/register/components/step-c/step-c.component.spec.ts delete mode 100644 src/app/register/components/step-c/step-c.component.ts delete mode 100644 src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.html delete mode 100644 src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.scss delete mode 100644 src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.spec.ts delete mode 100644 src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.ts delete mode 100644 src/app/register/pages/register/register.component.html delete mode 100644 src/app/register/pages/register/register.component.scss delete mode 100644 src/app/register/pages/register/register.component.spec.ts delete mode 100644 src/app/register/pages/register/register.component.ts delete mode 100644 src/app/register/register-routing.module.ts delete mode 100644 src/app/register/register.module.ts diff --git a/src/app/register/ErrorStateMatcherForFormLevelErrors.ts b/src/app/register/ErrorStateMatcherForFormLevelErrors.ts deleted file mode 100644 index 3877e5c3db..0000000000 --- a/src/app/register/ErrorStateMatcherForFormLevelErrors.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { UntypedFormControl, FormGroupDirective, NgForm } from '@angular/forms' -import { ErrorStateMatcher } from '@angular/material/core' - -export class ErrorStateMatcherForFormLevelErrors implements ErrorStateMatcher { - getControlErrorAtForm: ( - control: UntypedFormControl, - errorGroup: string - ) => string[] - errorGroup: string - constructor( - getControlErrorAtForm: ( - control: UntypedFormControl, - errorGroup: string - ) => string[], - errorGroup: string - ) { - this.getControlErrorAtForm = getControlErrorAtForm - this.errorGroup = errorGroup - } - isErrorState( - control: UntypedFormControl | null, - form: FormGroupDirective | NgForm | null - ): boolean { - const errorsAtFormLevel = this.getControlErrorAtForm( - control, - this.errorGroup - ) - const controlInteracted = control.touched || (form && form.submitted) - const validControlAtFormLevel = !( - errorsAtFormLevel && errorsAtFormLevel.length > 0 - ) - const validControl = control && !control.invalid - return !(validControlAtFormLevel && validControl) && controlInteracted - } -} diff --git a/src/app/register/components/BaseForm.ts b/src/app/register/components/BaseForm.ts deleted file mode 100644 index 67888b5de5..0000000000 --- a/src/app/register/components/BaseForm.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - AbstractControl, - AsyncValidator, - ControlValueAccessor, - UntypedFormGroup, - ValidationErrors, -} from '@angular/forms' -import { merge, Observable, timer } from 'rxjs' -import { filter, map, startWith, take } from 'rxjs/operators' - -export abstract class BaseForm implements ControlValueAccessor, AsyncValidator { - public form: UntypedFormGroup - public onTouchedFunction - constructor() {} - writeValue(val: any): void { - if (val != null && val !== undefined && val !== '') { - this.form.setValue(val, { emitEvent: true }) - // Trigger registerOnChange custom function by calling form.updateValueAndValidity - // require since most form controls extending this class - // need to call the xxxxRegisterForm functions to adapt the original angular form value for the backend format - setTimeout(() => { - this.form.updateValueAndValidity() - }) - } - } - registerOnChange(fn: any): void { - this.form.valueChanges.subscribe((value) => { - fn(value) - }) - } - registerOnTouched(fn: any): void { - this.onTouchedFunction = fn - } - setDisabledState?(isDisabled: boolean): void { - isDisabled ? this.form.disable() : this.form.enable() - } - validate(c: AbstractControl): Observable { - // temporal fix - // see related issue - // https://github.com/angular/angular/issues/14542 - // depending of fix - // https://github.com/angular/angular/pull/20806 - // - // using form.statusChanges observable only would be a better solution for this scenario (see the code before this fix) - // but if the form status starts as `pending` Angular wont report the status change because of #14542 - // and the status might now start as `pending` with the introduction of Oauth registration - - return merge(this.form.statusChanges, timer(0, 1000)).pipe( - map(() => this.form.status), - startWith(this.form.status), - filter((value) => value !== 'PENDING'), - take(1), - map(() => { - return this.form.valid - ? null - : { - invalidForm: { - valid: false, - message: 'internal form is not valid', - }, - } - }) - ) - } -} diff --git a/src/app/register/components/BaseStep.ts b/src/app/register/components/BaseStep.ts deleted file mode 100644 index fdb03d461a..0000000000 --- a/src/app/register/components/BaseStep.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { EventEmitter, Input, Output, Directive } from '@angular/core' -import { UntypedFormGroup } from '@angular/forms' - -@Directive() -export abstract class BaseStepDirective { - public _formGroup: UntypedFormGroup - @Input() - set formGroup(formGroup: UntypedFormGroup) { - this._formGroup = formGroup - this.formGroupChange.emit(this._formGroup) - } - get formGroup() { - return this._formGroup - } - @Output() formGroupChange = new EventEmitter() -} diff --git a/src/app/register/components/backend-error/backend-error.component.html b/src/app/register/components/backend-error/backend-error.component.html deleted file mode 100644 index d08320c6bb..0000000000 --- a/src/app/register/components/backend-error/backend-error.component.html +++ /dev/null @@ -1,45 +0,0 @@ - - This email already exists in our system. Would you like to - - sign in? - - - - Additional email cannot match primary email - - - - Additional emails cannot be duplicated - - - - The ORCID record exists but has not been claimed. Would you like - to - - resend the claim email? - - - - - A deactivated ORCID record is associated with this email address. - - click here to reactivate - - - {{ errorCode }} diff --git a/src/app/register/components/backend-error/backend-error.component.scss b/src/app/register/components/backend-error/backend-error.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/app/register/components/backend-error/backend-error.component.spec.ts b/src/app/register/components/backend-error/backend-error.component.spec.ts deleted file mode 100644 index 47af1a96c2..0000000000 --- a/src/app/register/components/backend-error/backend-error.component.spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { BackendErrorComponent } from './backend-error.component' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' -import { WINDOW_PROVIDERS } from '../../../cdk/window' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { Overlay } from '@angular/cdk/overlay' -import { SignInService } from '../../../core/sign-in/sign-in.service' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('BackendErrorComponent', () => { - let component: BackendErrorComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, RouterTestingModule], - declarations: [BackendErrorComponent], - providers: [ - WINDOW_PROVIDERS, - SignInService, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(BackendErrorComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/backend-error/backend-error.component.ts b/src/app/register/components/backend-error/backend-error.component.ts deleted file mode 100644 index 6e36e49331..0000000000 --- a/src/app/register/components/backend-error/backend-error.component.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { Component, Input, OnInit, Inject } from '@angular/core' -import { Router } from '@angular/router' -import { take } from 'rxjs/operators' -import { PlatformInfoService } from 'src/app/cdk/platform-info' -import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service' -import { ApplicationRoutes } from 'src/app/constants' -import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service' -import { SignInService } from 'src/app/core/sign-in/sign-in.service' -import { ERROR_REPORT } from 'src/app/errors' -import { WINDOW } from 'src/app/cdk/window' - -// When the error text is not listed on the RegisterBackendErrors enum -// the error message will be displayed as it comes from the backend -// This is because the backend might return code or a text ready for the UI -enum RegisterBackendErrors { - 'orcid.frontend.verify.duplicate_email', - 'additionalEmailCantBePrimaryEmail', - 'duplicatedAdditionalEmail', - 'orcid.frontend.verify.unclaimed_email', - 'orcid.frontend.verify.deactivated_email', -} - -@Component({ - selector: 'app-backend-error', - templateUrl: './backend-error.component.html', - styleUrls: ['./backend-error.component.scss'], - preserveWhitespaces: true, -}) -export class BackendErrorComponent implements OnInit { - recognizedError = RegisterBackendErrors - _errorCode: string - @Input() - set errorCode(errorCode: string) { - // This will change the string send by the backend into a code, to handle the error trough a code - if (errorCode.indexOf('resend-claim') >= 0) { - errorCode = RegisterBackendErrors[3] - } - this._errorCode = errorCode - } - get errorCode() { - return this._errorCode - } - @Input() value?: string - unrecognizedError = false - constructor( - private _platformInfo: PlatformInfoService, - private _router: Router, - private _snackbar: SnackbarService, - private _signIn: SignInService, - private _errorHandler: ErrorHandlerService, - @Inject(WINDOW) private window: Window - ) {} - ngOnInit() { - if (!(this.errorCode in RegisterBackendErrors)) { - this.unrecognizedError = true - } - } - - navigateToClaim(email) { - email = encodeURIComponent(email) - this.window.location.href = `/resend-claim?email=${email}` - } - - navigateToSignin(email) { - this._platformInfo - .get() - .pipe(take(1)) - .subscribe((platform) => { - return this._router.navigate([ApplicationRoutes.signin], { - // keeps all parameters to support Oauth request - // and set show login to true - queryParams: { ...platform.queryParameters, email, show_login: true }, - }) - }) - } - - reactivateEmail(email) { - const $deactivate = this._signIn.reactivation(email) - $deactivate.subscribe((data) => { - if (data.error) { - this._errorHandler - .handleError( - new Error(data.error), - ERROR_REPORT.REGISTER_REACTIVATED_EMAIL - ) - .subscribe() - } else { - this._snackbar.showSuccessMessage({ - title: $localize`:@@register.reactivating:Reactivating your account`, - // tslint:disable-next-line: max-line-length - message: $localize`:@@ngOrcid.signin.verify.reactivationSent:Thank you for reactivating your ORCID record; please complete the process by following the steps in the email we are now sending you. If you don’t receive an email from us, please`, - action: $localize`:@@shared.contactSupport:contact support.`, - actionURL: `https://support.orcid.org/`, - closable: true, - }) - this._router.navigate([ApplicationRoutes.signin]) - } - }) - } -} diff --git a/src/app/register/components/form-anti-robots/form-anti-robots.component.html b/src/app/register/components/form-anti-robots/form-anti-robots.component.html deleted file mode 100644 index 20bd4df427..0000000000 --- a/src/app/register/components/form-anti-robots/form-anti-robots.component.html +++ /dev/null @@ -1,14 +0,0 @@ - -
- - Please check the recaptcha box -
diff --git a/src/app/register/components/form-anti-robots/form-anti-robots.component.scss b/src/app/register/components/form-anti-robots/form-anti-robots.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts b/src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts deleted file mode 100644 index 7afe7795e0..0000000000 --- a/src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { FormAntiRobotsComponent } from './form-anti-robots.component' -import { WINDOW_PROVIDERS } from '../../../cdk/window' -import { RegisterService } from '../../../core/register/register.service' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' -import { Overlay } from '@angular/cdk/overlay' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { ErrorStateMatcher } from '@angular/material/core' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('FormAntiRobotsComponent', () => { - let component: FormAntiRobotsComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, RouterTestingModule], - declarations: [FormAntiRobotsComponent], - providers: [ - WINDOW_PROVIDERS, - RegisterService, - ErrorStateMatcher, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(FormAntiRobotsComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/form-anti-robots/form-anti-robots.component.ts b/src/app/register/components/form-anti-robots/form-anti-robots.component.ts deleted file mode 100644 index 959ba4876b..0000000000 --- a/src/app/register/components/form-anti-robots/form-anti-robots.component.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Component, DoCheck, forwardRef, OnInit } from '@angular/core' -import { - UntypedFormControl, - UntypedFormGroup, - NG_ASYNC_VALIDATORS, - NG_VALUE_ACCESSOR, - ValidatorFn, - Validators, -} from '@angular/forms' -import { ErrorStateMatcher } from '@angular/material/core' -import { merge, Subject } from 'rxjs' -import { RegisterService } from 'src/app/core/register/register.service' - -import { BaseForm } from '../BaseForm' - -@Component({ - selector: 'app-form-anti-robots', - templateUrl: './form-anti-robots.component.html', - styleUrls: ['./form-anti-robots.component.scss'], - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => FormAntiRobotsComponent), - multi: true, - }, - { - provide: NG_ASYNC_VALIDATORS, - useExisting: forwardRef(() => FormAntiRobotsComponent), - multi: true, - }, - ], -}) -export class FormAntiRobotsComponent - extends BaseForm - implements OnInit, DoCheck -{ - captchaFailState = false - captchaLoadedWithWidgetId: number - $widgetIdUpdated = new Subject() - errorState = false - captcha = new UntypedFormControl(null, { - validators: [this.captchaValidator()], - }) - ngOnInit(): void { - this.form = new UntypedFormGroup({ - captcha: this.captcha, - }) - } - - constructor( - private _register: RegisterService, - private _errorStateMatcher: ErrorStateMatcher - ) { - super() - } - - // Captcha must be clicked unless it was not loaded - captchaValidator(): ValidatorFn { - return (control: UntypedFormControl) => { - const hasError = Validators.required(control) - if ( - hasError && - hasError.required && - this.captchaLoadedWithWidgetId !== undefined - ) { - return { captcha: true } - } else { - return null - } - } - } - - captchaFail($event) { - this.captchaFailState = $event - } - captchaLoaded(widgetId: number) { - this.captchaLoadedWithWidgetId = widgetId - this.captcha.updateValueAndValidity() - this.$widgetIdUpdated.next() - } - - ngDoCheck(): void { - this.errorState = this._errorStateMatcher.isErrorState(this.captcha, null) - } - - // OVERWRITE - registerOnChange(fn: any) { - merge( - this.$widgetIdUpdated.asObservable(), - this.form.valueChanges - ).subscribe(() => { - const registerForm = this._register.formGroupToRecaptchaForm( - this.form, - this.captchaLoadedWithWidgetId - ) - fn(registerForm) - }) - } -} diff --git a/src/app/register/components/form-notifications/form-notifications.component.html b/src/app/register/components/form-notifications/form-notifications.component.html deleted file mode 100644 index d518331c03..0000000000 --- a/src/app/register/components/form-notifications/form-notifications.component.html +++ /dev/null @@ -1,35 +0,0 @@ -

- Notification settings -

- -

- ORCID sends email notifications about items related to your account, security, - and privacy, including requests from ORCID member organizations for permission - to update your record, and changes made to your record by those organizations. -

- -

- You can also choose to receive emails from us about new features and tips for - making the most of your ORCID record. -

- - - Please send me quarterly emails about new ORCID features and - tips. - To receive these emails, you will also need to verify your primary email - address. - - - -

- After you've registered, you can change your notification settings at any time - in the account settings section of your ORCID record. -

diff --git a/src/app/register/components/form-notifications/form-notifications.component.scss b/src/app/register/components/form-notifications/form-notifications.component.scss deleted file mode 100644 index 58207ec0a4..0000000000 --- a/src/app/register/components/form-notifications/form-notifications.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -:host { - max-width: 100%; -} diff --git a/src/app/register/components/form-notifications/form-notifications.component.spec.ts b/src/app/register/components/form-notifications/form-notifications.component.spec.ts deleted file mode 100644 index 4da45ff457..0000000000 --- a/src/app/register/components/form-notifications/form-notifications.component.spec.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { FormNotificationsComponent } from './form-notifications.component' -import { RegisterService } from '../../../core/register/register.service' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { - MatLegacyDialog as MatDialog, - MatLegacyDialogModule as MatDialogModule, -} from '@angular/material/legacy-dialog' -import { RouterTestingModule } from '@angular/router/testing' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { Overlay } from '@angular/cdk/overlay' -import { WINDOW_PROVIDERS } from '../../../cdk/window' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' -import { ReactiveFormsModule } from '@angular/forms' -import { MatLegacyCheckboxModule } from '@angular/material/legacy-checkbox' - -describe('FormNotificationsComponent', () => { - let component: FormNotificationsComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - RouterTestingModule, - ReactiveFormsModule, - MatLegacyCheckboxModule, - ], - declarations: [FormNotificationsComponent], - providers: [ - WINDOW_PROVIDERS, - RegisterService, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(FormNotificationsComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/form-notifications/form-notifications.component.ts b/src/app/register/components/form-notifications/form-notifications.component.ts deleted file mode 100644 index 11982529df..0000000000 --- a/src/app/register/components/form-notifications/form-notifications.component.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Component, forwardRef, OnInit } from '@angular/core' -import { - UntypedFormControl, - UntypedFormGroup, - NG_ASYNC_VALIDATORS, - NG_VALUE_ACCESSOR, - Validators, -} from '@angular/forms' -import { RegisterService } from 'src/app/core/register/register.service' - -import { BaseForm } from '../BaseForm' - -@Component({ - selector: 'app-form-notifications', - templateUrl: './form-notifications.component.html', - styleUrls: ['./form-notifications.component.scss'], - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => FormNotificationsComponent), - multi: true, - }, - { - provide: NG_ASYNC_VALIDATORS, - useExisting: forwardRef(() => FormNotificationsComponent), - multi: true, - }, - ], -}) -export class FormNotificationsComponent extends BaseForm implements OnInit { - constructor(private _register: RegisterService) { - super() - } - ngOnInit() { - this.form = new UntypedFormGroup({ - sendOrcidNews: new UntypedFormControl(false, { - validators: Validators.required, - }), - }) - } - - // OVERWRITE - registerOnChange(fn: any) { - this.form.valueChanges.subscribe((value) => { - const registerForm = this._register.formGroupToSendOrcidNewsForm( - this.form as UntypedFormGroup - ) - fn(registerForm) - }) - } -} diff --git a/src/app/register/components/form-password/form-password.component.html b/src/app/register/components/form-password/form-password.component.html deleted file mode 100644 index 2e033006b1..0000000000 --- a/src/app/register/components/form-password/form-password.component.html +++ /dev/null @@ -1,193 +0,0 @@ -
-
- - Password - - - Please enter a password - - - Password must not be the same as your email address - - - Password must match all pattern requirements - - - Password must be between 8 and 256 characters - - -
- -
-
-
- - -
- -
    -
  1. - -
    8 or more characters
    -
  2. -
  3. - -
    1 letter or symbol
    -
  4. -
  5. - -
    1 number
    -
  6. -
- - - Confirm password - - - Retype your password - - - Password must not be the same as your email address - - - - The password and confirmed password must match - - -
- - - check_circle - - - - check_circle - - - - -
-

- Must be between 8 and 256 characters long and contain: -

-
    -
  • at least 1 numeral: 0 - 9
  • -
  • - at least 1 of the following: - -
      -
    • - alpha character, case-sensitive a-Z -
    • -
    • - - any of the following symbols:
      - ! @ # $ % ^ * ( ) ~ ` {{ '{ }' }} [ ] | \ & _ -
    • -
    -
  • -
  • - optionally the space character, -
    - i.e ' ' and other punctuation such as . , ; -
  • -
-

- Example: sun% moon2 -

-

- - ORCID does not allow common passwords. Common passwords are insecure, - easily-guessed words or phrases such as 'qwerty123'. - - See the full list of common passwords we don't allow on ORCID -

-
-
-
diff --git a/src/app/register/components/form-password/form-password.component.scss b/src/app/register/components/form-password/form-password.component.scss deleted file mode 100644 index 5814f8f6f4..0000000000 --- a/src/app/register/components/form-password/form-password.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -:host { - display: flex; - flex-direction: column; -} - -ol { - margin-block-start: 0px; - padding-inline-start: 0px; - padding: 0; - li { - list-style-type: none; - display: flex; - img { - margin-inline-end: 4px; - } - div { - margin: 2px; - } - } -} diff --git a/src/app/register/components/form-password/form-password.component.scss-theme.scss b/src/app/register/components/form-password/form-password.component.scss-theme.scss deleted file mode 100644 index 85ff72cd1f..0000000000 --- a/src/app/register/components/form-password/form-password.component.scss-theme.scss +++ /dev/null @@ -1,16 +0,0 @@ -@use '@angular/material' as mat; -@import 'src/assets/scss/material.orcid-theme.scss'; - -@mixin form-password($theme) { - $primary: map-get($theme, primary); - $accent: map-get($theme, accent); - $warn: map-get($theme, accent); - $foreground: map-get($theme, foreground); - $background: map-get($theme, background); - - ::ng-deep .valid { - color: mat.get-color-from-palette($accent, 900); - } -} - -@include form-password($orcid-app-theme); diff --git a/src/app/register/components/form-password/form-password.component.spec.ts b/src/app/register/components/form-password/form-password.component.spec.ts deleted file mode 100644 index c2bf84634b..0000000000 --- a/src/app/register/components/form-password/form-password.component.spec.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { FormPasswordComponent } from './form-password.component' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { - MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA, - MatLegacyDialog as MatDialog, - MatLegacyDialogRef as MatDialogRef, -} from '@angular/material/legacy-dialog' -import { WINDOW_PROVIDERS } from '../../../cdk/window' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { Overlay } from '@angular/cdk/overlay' -import { RegisterService } from '../../../core/register/register.service' -import { MdePopoverModule } from '../../../cdk/popover' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' -import { ReactiveFormsModule } from '@angular/forms' - -describe('FormPasswordComponent', () => { - let component: FormPasswordComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - MdePopoverModule, - RouterTestingModule, - ReactiveFormsModule, - ], - declarations: [FormPasswordComponent], - providers: [ - { provide: MatDialogRef, useValue: {} }, - { provide: MAT_DIALOG_DATA, useValue: {} }, - WINDOW_PROVIDERS, - RegisterService, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(FormPasswordComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/form-password/form-password.component.ts b/src/app/register/components/form-password/form-password.component.ts deleted file mode 100644 index b24e5b3e56..0000000000 --- a/src/app/register/components/form-password/form-password.component.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { Component, forwardRef, Input, OnInit, ViewChild } from '@angular/core' -import { - UntypedFormControl, - UntypedFormGroup, - NG_ASYNC_VALIDATORS, - NG_VALUE_ACCESSOR, - ValidatorFn, - Validators, -} from '@angular/forms' -import { HAS_LETTER_OR_SYMBOL, HAS_NUMBER } from 'src/app/constants' -import { RegisterService } from 'src/app/core/register/register.service' -import { RegisterForm } from 'src/app/types/register.endpoint' -import { OrcidValidators } from 'src/app/validators' - -import { BaseForm } from '../BaseForm' - -@Component({ - selector: 'app-form-password', - templateUrl: './form-password.component.html', - styleUrls: [ - './form-password.component.scss-theme.scss', - './form-password.component.scss', - ], - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => FormPasswordComponent), - multi: true, - }, - { - provide: NG_ASYNC_VALIDATORS, - useExisting: forwardRef(() => FormPasswordComponent), - multi: true, - }, - ], - preserveWhitespaces: true, -}) -export class FormPasswordComponent extends BaseForm implements OnInit { - labelInfo = $localize`:@@register.ariaLabelInfoPassword:info about password` - labelClose = $localize`:@@register.ariaLabelClose:close` - @ViewChild(`#passwordPopover`) passwordPopover - @ViewChild(`#passwordPopoverTrigger`) passwordPopoverTrigger - hasNumberPattern = HAS_NUMBER - hasLetterOrSymbolPattern = HAS_LETTER_OR_SYMBOL - @Input() personalData: RegisterForm - constructor(private _register: RegisterService) { - super() - } - ngOnInit() { - this.form = new UntypedFormGroup( - { - password: new UntypedFormControl('', { - validators: [ - Validators.required, - Validators.minLength(8), - Validators.maxLength(256), - Validators.pattern(this.hasNumberPattern), - Validators.pattern(this.hasLetterOrSymbolPattern), - this.passwordDoesNotContainUserEmails(), - ], - asyncValidators: [this._register.backendValueValidate('password')], - }), - passwordConfirm: new UntypedFormControl('', Validators.required), - }, - { - validators: OrcidValidators.matchValues('password', 'passwordConfirm'), - asyncValidators: this._register.backendPasswordValidate(), - } - ) - } - - passwordDoesNotContainUserEmails(): ValidatorFn { - return (control: UntypedFormControl) => { - const password: string = control.value - let hasError = false - - if (this.personalData && password) { - Object.keys(this.personalData.emailsAdditional).forEach((key) => { - const additionalEmail = this.personalData.emailsAdditional[key].value - if (password.indexOf(additionalEmail) >= 0) { - hasError = true - } - }) - } - - if ( - this.personalData && - this.personalData.email && - password.indexOf(this.personalData.email.value) >= 0 - ) { - hasError = true - } - - if (hasError) { - return { passwordIsEqualToTheEmail: true } - } else { - return null - } - } - } - - // OVERWRITE - registerOnChange(fn: any) { - this.form.valueChanges.subscribe((value) => { - const registerForm = this._register.formGroupToPasswordRegisterForm( - this.form as UntypedFormGroup - ) - - fn(registerForm) - }) - } -} diff --git a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.html b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.html deleted file mode 100644 index b187e2fae7..0000000000 --- a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.html +++ /dev/null @@ -1,103 +0,0 @@ - -
- - - Additional email - {{ i !== 0 ? i : '' }} - (Optional) - - - - Invalid email format - - - - - - - - -
-
- - - add - Add another email - - - - - Ensure that you never lose access to your ORCID record by registering - additional email addresses on your account. - - - - diff --git a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.scss b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.scss deleted file mode 100644 index c0ebe826ac..0000000000 --- a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.scss +++ /dev/null @@ -1,11 +0,0 @@ -:host { - display: flex; - flex-direction: column; -} - -a { - display: flex; - span { - margin: 2px; - } -} diff --git a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts deleted file mode 100644 index 11b7ddb72d..0000000000 --- a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { FormPersonalAdditionalEmailsComponent } from './form-personal-additional-emails.component' -import { MdePopoverModule } from '../../../cdk/popover' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('FormPersonalAdditionalEmailsComponent', () => { - let component: FormPersonalAdditionalEmailsComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MdePopoverModule], - declarations: [FormPersonalAdditionalEmailsComponent], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(FormPersonalAdditionalEmailsComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts deleted file mode 100644 index fa08aaefe0..0000000000 --- a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - AfterViewInit, - ChangeDetectorRef, - Component, - ElementRef, - Input, - QueryList, - ViewChildren, -} from '@angular/core' -import { - AbstractControl, - UntypedFormControl, - UntypedFormGroup, -} from '@angular/forms' -import { OrcidValidators } from 'src/app/validators' - -import { ErrorStateMatcherForFormLevelErrors } from '../../ErrorStateMatcherForFormLevelErrors' - -@Component({ - selector: 'app-form-personal-additional-emails', - templateUrl: './form-personal-additional-emails.component.html', - styleUrls: ['./form-personal-additional-emails.component.scss'], -}) -export class FormPersonalAdditionalEmailsComponent implements AfterViewInit { - labelInfoAboutEmails = $localize`:@@register.ariaLabelInfoEmails:info about emails` - labelDeleteEmail = $localize`:@@register.ariaLabelDeleteEmail:delete email` - labelClose = $localize`:@@register.ariaLabelClose:close` - @ViewChildren('emailInput') inputs: QueryList - @Input() additionalEmails: UntypedFormGroup - additionalEmailsPopoverTrigger - additionalEmailsCount = 1 - - constructor( - private _ref: ChangeDetectorRef, - private _changeDetectorRef: ChangeDetectorRef - ) {} - - backendErrorsMatcher = new ErrorStateMatcherForFormLevelErrors( - this.getControlErrorAtFormLevel, - 'backendErrors' - ) - - getControlErrorAtFormLevel( - control: AbstractControl | null, - errorGroup: string - ): string[] { - return ( - control?.parent?.parent?.errors?.[errorGroup]?.['additionalEmails'][ - control.value - ] || [] - ) - } - - deleteEmailInput(id: string): void { - this.additionalEmails.removeControl(id) - this._changeDetectorRef.detectChanges() - - const input = this.inputs.filter( - (x) => this.parseInt(x.nativeElement.id) > this.parseInt(id) - )?.[0] - if (input) { - input.nativeElement.focus() - } else if (this.inputs.last) { - this.inputs.last.nativeElement.focus() - } - } - - addAdditionalEmail(): void { - const controlName = ++this.additionalEmailsCount - this.additionalEmails.addControl( - this.zeroPad(controlName, 2), - new UntypedFormControl('', { - validators: [OrcidValidators.email], - }) - ) - this._changeDetectorRef.detectChanges() - const input = this.inputs.last.nativeElement as HTMLInputElement - input.focus() - } - - parseInt(number: string) { - return parseInt(number, 10) - } - - zeroPad(num, places) { - return String(num).padStart(places, '0') - } - - public ngAfterViewInit() { - this._ref.detectChanges() - } -} diff --git a/src/app/register/components/form-personal/form-personal.component.html b/src/app/register/components/form-personal/form-personal.component.html deleted file mode 100644 index 834e6277b4..0000000000 --- a/src/app/register/components/form-personal/form-personal.component.html +++ /dev/null @@ -1,186 +0,0 @@ - -
- - First name - - - Must be less than 100 characters - - - Please enter your first/given name - - - Invalid name characters or format - - -
- -
-
-
- - -
- - Last name - (Optional) - - - Invalid name characters or format - - -
- -
-
-
- - - - Primary email - - - An email is required - - - Invalid email format - - - -
- -
-
-
- - Confirm primary email - - - Please confirm your email - - - Invalid email format - - - Email confirmation does not match - - -
- -
-
-
- - - -
-
- - - -

- First name is your given name or the name you most commonly go by. -

-

Last name is your family name.

-

- You will have a chance to add additional names after you have created your - account. -

- More information on names -
-
diff --git a/src/app/register/components/form-personal/form-personal.component.scss b/src/app/register/components/form-personal/form-personal.component.scss deleted file mode 100644 index 4cef8a0ce4..0000000000 --- a/src/app/register/components/form-personal/form-personal.component.scss +++ /dev/null @@ -1,4 +0,0 @@ -:host { - display: flex; - flex-direction: column; -} diff --git a/src/app/register/components/form-personal/form-personal.component.spec.ts b/src/app/register/components/form-personal/form-personal.component.spec.ts deleted file mode 100644 index b72245e404..0000000000 --- a/src/app/register/components/form-personal/form-personal.component.spec.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { FormPersonalComponent } from './form-personal.component' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { - MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA, - MatLegacyDialog as MatDialog, - MatLegacyDialogRef as MatDialogRef, -} from '@angular/material/legacy-dialog' -import { WINDOW_PROVIDERS } from '../../../cdk/window' -import { FormBuilder } from '@angular/forms' -import { RecordWorksService } from '../../../core/record-works/record-works.service' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { Overlay } from '@angular/cdk/overlay' -import { RegisterService } from '../../../core/register/register.service' -import { ReactivationService } from '../../../core/reactivation/reactivation.service' -import { MdePopoverModule } from '../../../cdk/popover' -import { MatLegacyAutocomplete } from '@angular/material/legacy-autocomplete' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('FormPersonalComponent', () => { - let component: FormPersonalComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, MdePopoverModule, RouterTestingModule], - declarations: [FormPersonalComponent], - providers: [ - WINDOW_PROVIDERS, - ReactivationService, - RegisterService, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(FormPersonalComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/form-personal/form-personal.component.ts b/src/app/register/components/form-personal/form-personal.component.ts deleted file mode 100644 index 3b3e0b2429..0000000000 --- a/src/app/register/components/form-personal/form-personal.component.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { - AfterViewInit, - Component, - ElementRef, - forwardRef, - Input, - OnInit, - ViewChild, -} from '@angular/core' -import { - UntypedFormControl, - UntypedFormGroup, - NG_ASYNC_VALIDATORS, - NG_VALUE_ACCESSOR, - ValidatorFn, - Validators, -} from '@angular/forms' -import { RegisterService } from 'src/app/core/register/register.service' -import { OrcidValidators } from 'src/app/validators' - -import { BaseForm } from '../BaseForm' -import { first } from 'rxjs/operators' -import { ReactivationService } from '../../../core/reactivation/reactivation.service' -import { ReactivationLocal } from '../../../types/reactivation.local' - -@Component({ - selector: 'app-form-personal', - templateUrl: './form-personal.component.html', - styleUrls: ['./form-personal.component.scss'], - preserveWhitespaces: true, - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => FormPersonalComponent), - multi: true, - }, - { - provide: NG_ASYNC_VALIDATORS, - useExisting: forwardRef(() => FormPersonalComponent), - multi: true, - }, - ], -}) -export class FormPersonalComponent - extends BaseForm - implements OnInit, AfterViewInit -{ - nameMaxLength = 99 - - @Input() reactivation: ReactivationLocal - @ViewChild('firstInput') firstInput: ElementRef - labelInfoAboutName = $localize`:@@register.ariaLabelInfo:info about names` - labelClose = $localize`:@@register.ariaLabelClose:close` - constructor( - private _register: RegisterService, - private _reactivationService: ReactivationService - ) { - super() - } - - emails: UntypedFormGroup = new UntypedFormGroup({}) - additionalEmails: UntypedFormGroup = new UntypedFormGroup({ - '0': new UntypedFormControl('', { - validators: [OrcidValidators.email], - }), - }) - - ngOnInit() { - this.emails = new UntypedFormGroup( - { - email: new UntypedFormControl('', { - validators: [Validators.required, OrcidValidators.email], - asyncValidators: this._register.backendValueValidate('email'), - }), - additionalEmails: this.additionalEmails, - }, - { - validators: [ - OrcidValidators.matchValues('email', 'confirmEmail', false), - this.allEmailsAreUnique(), - ], - asyncValidators: [ - this._register.backendAdditionalEmailsValidate( - this.reactivation?.isReactivation - ), - ], - updateOn: 'change', - } - ) - - if (!this.reactivation?.isReactivation) { - this.emails.addControl( - 'confirmEmail', - new UntypedFormControl('', { - validators: [Validators.required, OrcidValidators.email], - }) - ) - } - - this.form = new UntypedFormGroup({ - givenNames: new UntypedFormControl('', { - validators: [ - Validators.required, - OrcidValidators.illegalName, - Validators.maxLength(this.nameMaxLength), - ], - asyncValidators: this._register.backendValueValidate('givenNames'), - }), - familyNames: new UntypedFormControl('', { - validators: [OrcidValidators.illegalName], - }), - emails: this.emails, - }) - - if (this.reactivation?.isReactivation) { - this._reactivationService - .getReactivationData(this.reactivation.reactivationCode) - .pipe(first()) - .subscribe((reactivation) => { - this.emails.patchValue({ - email: reactivation.email, - }) - this.emails.controls['email'].disable() - }) - } - } - - ngAfterViewInit(): void { - // Timeout used to get focus on the first input after the first step loads - setTimeout(() => { - this.firstInput.nativeElement.focus() - }, 100) - } - - allEmailsAreUnique(): ValidatorFn { - return (formGroup: UntypedFormGroup) => { - let hasError = false - const registerForm = - this._register.formGroupToEmailRegisterForm(formGroup) - - const error = { backendErrors: { additionalEmails: {} } } - - Object.keys(registerForm.emailsAdditional).forEach((key, i) => { - const additionalEmail = registerForm.emailsAdditional[key] - if (!error.backendErrors.additionalEmails[additionalEmail.value]) { - error.backendErrors.additionalEmails[additionalEmail.value] = [] - } - const additionalEmailsErrors = error.backendErrors.additionalEmails - if ( - registerForm.email && - additionalEmail.value === registerForm.email.value - ) { - hasError = true - additionalEmailsErrors[additionalEmail.value] = [ - 'additionalEmailCantBePrimaryEmail', - ] - } else { - Object.keys(registerForm.emailsAdditional).forEach( - (elementKey, i2) => { - const element = registerForm.emailsAdditional[elementKey] - if (i !== i2 && additionalEmail.value === element.value) { - hasError = true - additionalEmailsErrors[additionalEmail.value] = [ - 'duplicatedAdditionalEmail', - ] - } - } - ) - } - }) - - if (hasError) { - return error - } else { - return null - } - } - } - - // OVERWRITE - registerOnChange(fn: any) { - this.form.valueChanges.subscribe((value) => { - const emailsForm = this._register.formGroupToEmailRegisterForm( - this.form.controls['emails'] as UntypedFormGroup - ) - const namesForm = - this._register.formGroupToNamesRegisterForm(this.form) || {} - - fn({ ...emailsForm, ...namesForm }) - }) - } -} diff --git a/src/app/register/components/form-terms/form-terms.component.html b/src/app/register/components/form-terms/form-terms.component.html deleted file mode 100644 index 5745d6534b..0000000000 --- a/src/app/register/components/form-terms/form-terms.component.html +++ /dev/null @@ -1,66 +0,0 @@ -

Terms of Use

- - - I consent to the - - privacy policy - - and - - terms of use - - and agree to my data being publicly accessible where marked as “Visible - to Everyone”. - - - - I consent to my data being processed in the United States. - - - More information on how ORCID process your data. - - - To continue creating your ORCID iD you must accept the terms of use and - consent to your data being processed in the United States. - diff --git a/src/app/register/components/form-terms/form-terms.component.scss b/src/app/register/components/form-terms/form-terms.component.scss deleted file mode 100644 index 66e0ae0b04..0000000000 --- a/src/app/register/components/form-terms/form-terms.component.scss +++ /dev/null @@ -1,12 +0,0 @@ -:host { - margin-bottom: 25px; - display: block; -} - -mat-checkbox { - margin-bottom: 16px; -} - -mat-error { - margin: 8px 0; -} diff --git a/src/app/register/components/form-terms/form-terms.component.spec.ts b/src/app/register/components/form-terms/form-terms.component.spec.ts deleted file mode 100644 index b489821ff8..0000000000 --- a/src/app/register/components/form-terms/form-terms.component.spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { FormTermsComponent } from './form-terms.component' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' -import { WINDOW_PROVIDERS } from '../../../cdk/window' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { Overlay } from '@angular/cdk/overlay' -import { RegisterService } from '../../../core/register/register.service' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('FormTermsComponent', () => { - let component: FormTermsComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, RouterTestingModule], - declarations: [FormTermsComponent], - providers: [ - WINDOW_PROVIDERS, - RegisterService, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(FormTermsComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/form-terms/form-terms.component.ts b/src/app/register/components/form-terms/form-terms.component.ts deleted file mode 100644 index f0de5ce315..0000000000 --- a/src/app/register/components/form-terms/form-terms.component.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Component, DoCheck, forwardRef, OnInit } from '@angular/core' -import { - UntypedFormControl, - UntypedFormGroup, - NG_ASYNC_VALIDATORS, - NG_VALUE_ACCESSOR, - Validators, -} from '@angular/forms' -import { ErrorStateMatcher } from '@angular/material/core' -import { RegisterService } from 'src/app/core/register/register.service' -import { environment } from 'src/environments/environment' - -import { BaseForm } from '../BaseForm' - -@Component({ - selector: 'app-form-terms', - templateUrl: './form-terms.component.html', - styleUrls: ['./form-terms.component.scss'], - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => FormTermsComponent), - multi: true, - }, - { - provide: NG_ASYNC_VALIDATORS, - useExisting: forwardRef(() => FormTermsComponent), - multi: true, - }, - ], - preserveWhitespaces: true, -}) -// tslint:disable-next-line: class-name -export class FormTermsComponent extends BaseForm implements OnInit, DoCheck { - environment = environment - constructor( - private _register: RegisterService, - private _errorStateMatcher: ErrorStateMatcher - ) { - super() - } - errorState = false - - termsOfUse = new UntypedFormControl('', Validators.requiredTrue) - dataProcessed = new UntypedFormControl('', Validators.requiredTrue) - ngOnInit() { - this.form = new UntypedFormGroup({ - termsOfUse: this.termsOfUse, - dataProcessed: this.dataProcessed, - }) - } - - // OVERWRITE - registerOnChange(fn: any) { - this.form.valueChanges.subscribe((value) => { - const registerForm = - this._register.formGroupTermsOfUseAndDataProcessedRegisterForm( - this.form as UntypedFormGroup - ) - fn(registerForm) - }) - } - - ngDoCheck(): void { - this.errorState = - this._errorStateMatcher.isErrorState(this.termsOfUse, null) || - this._errorStateMatcher.isErrorState(this.dataProcessed, null) - } -} diff --git a/src/app/register/components/form-visibility/form-visibility.component.html b/src/app/register/components/form-visibility/form-visibility.component.html deleted file mode 100644 index 0acefbf8ed..0000000000 --- a/src/app/register/components/form-visibility/form-visibility.component.html +++ /dev/null @@ -1,95 +0,0 @@ - -

- Visibility settings -

-

- - Your ORCID iD connects with your ORCID record that can contain links to - your research activities, affiliations, awards, other versions of your - name, and more. You control this content and who can see it. - -

-

- By default, what visibility should be given to new items added to your ORCID - Record? -

-

- - - -

- Everyone - - (87% of users choose this) -
- - - -
- Trusted Organizations - (5% of users choose this) -
-
- - -
- Only me - - (8% of users choose this) -
-
- - Please choose a default visibility setting. -

-

- More information on visibility settings -

-
diff --git a/src/app/register/components/form-visibility/form-visibility.component.scss b/src/app/register/components/form-visibility/form-visibility.component.scss deleted file mode 100644 index f24bbf1354..0000000000 --- a/src/app/register/components/form-visibility/form-visibility.component.scss +++ /dev/null @@ -1,10 +0,0 @@ -:host img { - height: 24px; - width: 24px; - margin-left: -4px; - margin-right: 4px; - [dir='rtl'] & { - margin-right: -4px; - margin-left: 4px; - } -} diff --git a/src/app/register/components/form-visibility/form-visibility.component.spec.ts b/src/app/register/components/form-visibility/form-visibility.component.spec.ts deleted file mode 100644 index 962b883a55..0000000000 --- a/src/app/register/components/form-visibility/form-visibility.component.spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { FormVisibilityComponent } from './form-visibility.component' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' -import { WINDOW_PROVIDERS } from '../../../cdk/window' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { Overlay } from '@angular/cdk/overlay' -import { RegisterService } from '../../../core/register/register.service' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('FormVisibilityComponent', () => { - let component: FormVisibilityComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, RouterTestingModule], - declarations: [FormVisibilityComponent], - providers: [ - WINDOW_PROVIDERS, - RegisterService, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(FormVisibilityComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/form-visibility/form-visibility.component.ts b/src/app/register/components/form-visibility/form-visibility.component.ts deleted file mode 100644 index 2dbfc8716a..0000000000 --- a/src/app/register/components/form-visibility/form-visibility.component.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { Component, DoCheck, forwardRef, OnInit } from '@angular/core' -import { - UntypedFormControl, - UntypedFormGroup, - NG_ASYNC_VALIDATORS, - NG_VALUE_ACCESSOR, - Validators, -} from '@angular/forms' -import { ErrorStateMatcher } from '@angular/material/core' -import { VISIBILITY_OPTIONS } from 'src/app/constants' -import { RegisterService } from 'src/app/core/register/register.service' - -import { BaseForm } from '../BaseForm' - -@Component({ - selector: 'app-form-visibility', - templateUrl: './form-visibility.component.html', - styleUrls: ['./form-visibility.component.scss'], - preserveWhitespaces: true, - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => FormVisibilityComponent), - multi: true, - }, - { - provide: NG_ASYNC_VALIDATORS, - useExisting: forwardRef(() => FormVisibilityComponent), - multi: true, - }, - ], -}) -export class FormVisibilityComponent - extends BaseForm - implements OnInit, DoCheck -{ - visibilityOptions = VISIBILITY_OPTIONS - errorState = false - activitiesVisibilityDefault = new UntypedFormControl('', Validators.required) - constructor( - private _register: RegisterService, - private _errorStateMatcher: ErrorStateMatcher - ) { - super() - } - ngOnInit() { - this.form = new UntypedFormGroup({ - activitiesVisibilityDefault: this.activitiesVisibilityDefault, - }) - } - - ngDoCheck(): void { - this.errorState = this._errorStateMatcher.isErrorState( - this.activitiesVisibilityDefault, - null - ) - } - - // OVERWRITE - registerOnChange(fn: any) { - this.form.valueChanges.subscribe((value) => { - const registerForm = this._register.formGroupToActivitiesVisibilityForm( - this.form as UntypedFormGroup - ) - fn(registerForm) - }) - } -} diff --git a/src/app/register/components/step-a/step-a.component.html b/src/app/register/components/step-a/step-a.component.html deleted file mode 100644 index 96363ad153..0000000000 --- a/src/app/register/components/step-a/step-a.component.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - Create your ORCID iD - - - Thank you for reactivating your ORCID iD. - - - This is step 1 of 3 - - - -

- Per ORCID's - terms of use, you may only register for an ORCID iD for yourself. Already have an - ORCID iD? - Sign In -

-
- - -
- - -
-
-
-
diff --git a/src/app/register/components/step-a/step-a.component.scss b/src/app/register/components/step-a/step-a.component.scss deleted file mode 100644 index 4cef8a0ce4..0000000000 --- a/src/app/register/components/step-a/step-a.component.scss +++ /dev/null @@ -1,4 +0,0 @@ -:host { - display: flex; - flex-direction: column; -} diff --git a/src/app/register/components/step-a/step-a.component.spec.ts b/src/app/register/components/step-a/step-a.component.spec.ts deleted file mode 100644 index 71909aec76..0000000000 --- a/src/app/register/components/step-a/step-a.component.spec.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { StepAComponent } from './step-a.component' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' -import { WINDOW_PROVIDERS } from '../../../cdk/window' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { Overlay } from '@angular/cdk/overlay' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' -import { - FormGroup, - ReactiveFormsModule, - UntypedFormControl, - UntypedFormGroup, -} from '@angular/forms' -import { BaseStepDirective } from '../BaseStep' -import { MdePopover, MdePopoverTrigger } from 'src/app/cdk/popover' -import { FormPersonalComponent } from 'src/app/register2/components/form-personal/form-personal.component' - -describe('StepAComponent', () => { - let component: StepAComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule, - RouterTestingModule, - ReactiveFormsModule, - ], - declarations: [ - StepAComponent, - FormPersonalComponent, - MdePopoverTrigger, - MdePopover, - ], - providers: [ - WINDOW_PROVIDERS, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(StepAComponent) - component = fixture.componentInstance - component.formGroup = new UntypedFormGroup({ - personal: new UntypedFormControl(''), - }) - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/step-a/step-a.component.ts b/src/app/register/components/step-a/step-a.component.ts deleted file mode 100644 index cc3c652e92..0000000000 --- a/src/app/register/components/step-a/step-a.component.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Component, Input } from '@angular/core' - -import { BaseStepDirective } from '../BaseStep' -import { PlatformInfoService } from 'src/app/cdk/platform-info' -import { first } from 'rxjs/operators' -import { Router } from '@angular/router' -import { ApplicationRoutes } from 'src/app/constants' -import { environment } from 'src/environments/environment' -import { ReactivationLocal } from '../../../types/reactivation.local' - -@Component({ - selector: 'app-step-a', - templateUrl: './step-a.component.html', - styleUrls: ['./step-a.component.scss'], - preserveWhitespaces: true, -}) -export class StepAComponent extends BaseStepDirective { - @Input() reactivation: ReactivationLocal - - constructor(private _platform: PlatformInfoService, private _router: Router) { - super() - } - infoSiteBaseUrl = environment.INFO_SITE - - goForward() { - this.formGroup.markAllAsTouched() - } - - goBack() { - this._platform - .get() - .pipe(first()) - .subscribe((platform) => { - if (platform.social) { - this._router.navigate([ApplicationRoutes.social], { - queryParams: { - ...platform.queryParameters, - }, - }) - } else if (platform.institutional) { - this._router.navigate([ApplicationRoutes.institutionalLinking], { - queryParams: { - ...platform.queryParameters, - }, - }) - } else { - this._router.navigate([ApplicationRoutes.signin], { - queryParams: { - ...platform.queryParameters, - }, - }) - } - }) - } - - signIn() { - this._platform - .get() - .pipe(first()) - .subscribe((platform) => { - const params = JSON.parse(JSON.stringify(platform.queryParameters)) - if (params['email']) { - delete params['email'] - } - if (params['orcid']) { - delete params['orcid'] - } - - if (params['show_login']) { - delete params['show_login'] - } - - this._router.navigate([ApplicationRoutes.signin], { - queryParams: { - ...params, - }, - }) - }) - } -} diff --git a/src/app/register/components/step-b/step-b.component.html b/src/app/register/components/step-b/step-b.component.html deleted file mode 100644 index e8914b88fc..0000000000 --- a/src/app/register/components/step-b/step-b.component.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Create your ORCID iD - - - Thank you for reactivating your ORCID iD. - - - This is step 2 of 3 - - - -
- - -
- - -
-
-
-
diff --git a/src/app/register/components/step-b/step-b.component.scss b/src/app/register/components/step-b/step-b.component.scss deleted file mode 100644 index 4cef8a0ce4..0000000000 --- a/src/app/register/components/step-b/step-b.component.scss +++ /dev/null @@ -1,4 +0,0 @@ -:host { - display: flex; - flex-direction: column; -} diff --git a/src/app/register/components/step-b/step-b.component.spec.ts b/src/app/register/components/step-b/step-b.component.spec.ts deleted file mode 100644 index 1c281a5aa3..0000000000 --- a/src/app/register/components/step-b/step-b.component.spec.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { StepBComponent } from './step-b.component' - -import { CUSTOM_ELEMENTS_SCHEMA, forwardRef } from '@angular/core' -import { - NG_VALUE_ACCESSOR, - ReactiveFormsModule, - UntypedFormControl, - UntypedFormGroup, -} from '@angular/forms' -import { FormPasswordComponent } from 'src/app/register2/components/form-password/form-password.component' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { WINDOW_PROVIDERS } from 'src/app/cdk/window/window.service' -import { PlatformInfoService } from 'src/app/cdk/platform-info' -import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service' -import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service' -import { Overlay } from '@angular/cdk/overlay' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' - -import { Component } from '@angular/core' -import { ControlValueAccessor } from '@angular/forms' - -@Component({ - selector: 'app-form-notifications', - template: '
', - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => MockFormNotificationsComponent), - multi: true, - }, - ], -}) -export class MockFormNotificationsComponent implements ControlValueAccessor { - writeValue(): void {} - registerOnChange(fn: () => void): void {} - registerOnTouched(fn: () => void): void {} -} - -describe('StepBComponent', () => { - let component: StepBComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - HttpClientTestingModule, - RouterTestingModule, - ], - declarations: [ - StepBComponent, - FormPasswordComponent, - MockFormNotificationsComponent, - ], - providers: [ - WINDOW_PROVIDERS, - PlatformInfoService, - ErrorHandlerService, - MatSnackBar, - MatDialog, - SnackbarService, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(StepBComponent) - component = fixture.componentInstance - component.formGroup = new UntypedFormGroup({ - password: new UntypedFormControl(''), - sendOrcidNews: new UntypedFormControl(''), - }) - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/step-b/step-b.component.ts b/src/app/register/components/step-b/step-b.component.ts deleted file mode 100644 index 15c4f33633..0000000000 --- a/src/app/register/components/step-b/step-b.component.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Component, Input } from '@angular/core' - -import { BaseStepDirective } from '../BaseStep' -import { ReactivationLocal } from '../../../types/reactivation.local' - -@Component({ - selector: 'app-step-b', - templateUrl: './step-b.component.html', - styleUrls: ['./step-b.component.scss'], -}) -export class StepBComponent extends BaseStepDirective { - @Input() personalData - @Input() reactivation: ReactivationLocal - - constructor() { - super() - } -} diff --git a/src/app/register/components/step-c/step-c.component.html b/src/app/register/components/step-c/step-c.component.html deleted file mode 100644 index 4f05a50218..0000000000 --- a/src/app/register/components/step-c/step-c.component.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - Create your ORCID iD - - - Thank you for reactivating your ORCID iD. - - - This is step 3 of 3 - - - -
- - - -
- - -
-
-
- -
diff --git a/src/app/register/components/step-c/step-c.component.scss b/src/app/register/components/step-c/step-c.component.scss deleted file mode 100644 index 4cef8a0ce4..0000000000 --- a/src/app/register/components/step-c/step-c.component.scss +++ /dev/null @@ -1,4 +0,0 @@ -:host { - display: flex; - flex-direction: column; -} diff --git a/src/app/register/components/step-c/step-c.component.spec.ts b/src/app/register/components/step-c/step-c.component.spec.ts deleted file mode 100644 index 151fc1970b..0000000000 --- a/src/app/register/components/step-c/step-c.component.spec.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { StepCComponent } from './step-c.component' - -import { Component, CUSTOM_ELEMENTS_SCHEMA, forwardRef } from '@angular/core' -import { - ControlValueAccessor, - NG_VALUE_ACCESSOR, - ReactiveFormsModule, - UntypedFormControl, - UntypedFormGroup, -} from '@angular/forms' -import { FormVisibilityComponent } from '../form-visibility/form-visibility.component' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { WINDOW_PROVIDERS } from 'src/app/cdk/window/window.service' -import { PlatformInfoService } from 'src/app/cdk/platform-info/platform-info.service' -import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service' -import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' -import { Overlay } from '@angular/cdk/overlay' -import { FormTermsComponent } from '../form-terms/form-terms.component' -import { FormAntiRobotsComponent } from '../form-anti-robots/form-anti-robots.component' - -@Component({ - selector: 'app-form-visibility', - template: '
', - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => MockFormVisibilityComponent), - multi: true, - }, - ], -}) -export class MockFormVisibilityComponent implements ControlValueAccessor { - writeValue(): void {} - registerOnChange(fn: () => void): void {} - registerOnTouched(fn: () => void): void {} -} - -@Component({ - selector: 'app-form-terms', - template: '
', - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => MockFormTermsComponent), - multi: true, - }, - ], -}) -export class MockFormTermsComponent implements ControlValueAccessor { - writeValue(): void {} - registerOnChange(fn: () => void): void {} - registerOnTouched(fn: () => void): void {} -} - -@Component({ - selector: 'app-form-anti-robots', - template: '
', - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => MockFormAntiRobotsComponent), - multi: true, - }, - ], -}) -export class MockFormAntiRobotsComponent implements ControlValueAccessor { - writeValue(): void {} - registerOnChange(fn: () => void): void {} - registerOnTouched(fn: () => void): void {} -} - -describe('StepCComponent', () => { - let component: StepCComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - HttpClientTestingModule, - RouterTestingModule, - ], - declarations: [ - StepCComponent, - MockFormVisibilityComponent, - MockFormTermsComponent, - MockFormAntiRobotsComponent, - ], - providers: [ - WINDOW_PROVIDERS, - PlatformInfoService, - ErrorHandlerService, - MatSnackBar, - MatDialog, - SnackbarService, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(StepCComponent) - component = fixture.componentInstance - component.formGroup = new UntypedFormGroup({ - activitiesVisibilityDefault: new UntypedFormControl(''), - termsOfUse: new UntypedFormControl(''), - captcha: new UntypedFormControl(''), - }) - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/step-c/step-c.component.ts b/src/app/register/components/step-c/step-c.component.ts deleted file mode 100644 index 4fa84a7c6b..0000000000 --- a/src/app/register/components/step-c/step-c.component.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Component, Input } from '@angular/core' - -import { BaseStepDirective } from '../BaseStep' -import { ReactivationLocal } from '../../../types/reactivation.local' - -@Component({ - selector: 'app-step-c', - templateUrl: './step-c.component.html', - styleUrls: ['./step-c.component.scss'], -}) -export class StepCComponent extends BaseStepDirective { - @Input() loading - @Input() reactivation: ReactivationLocal - - constructor() { - super() - } -} diff --git a/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.html b/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.html deleted file mode 100644 index 2661e57176..0000000000 --- a/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.html +++ /dev/null @@ -1 +0,0 @@ -

top-bar-record-issues works!

diff --git a/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.scss b/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.spec.ts b/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.spec.ts deleted file mode 100644 index 65faca1562..0000000000 --- a/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { TopBarRecordIssuesComponent } from './top-bar-record-issues.component' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('TopBarRecordIssuesComponent', () => { - let component: TopBarRecordIssuesComponent - let fixture: ComponentFixture - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [TopBarRecordIssuesComponent], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(TopBarRecordIssuesComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.ts b/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.ts deleted file mode 100644 index c6f3ba3de2..0000000000 --- a/src/app/register/components/top-bar-record-issues/top-bar-record-issues.component.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Component, OnInit } from '@angular/core' - -@Component({ - selector: 'app-top-bar-record-issues', - templateUrl: './top-bar-record-issues.component.html', - styleUrls: ['./top-bar-record-issues.component.scss'], -}) -export class TopBarRecordIssuesComponent implements OnInit { - constructor() {} - - ngOnInit(): void {} -} diff --git a/src/app/register/pages/register/register.component.html b/src/app/register/pages/register/register.component.html deleted file mode 100644 index 670055304a..0000000000 --- a/src/app/register/pages/register/register.component.html +++ /dev/null @@ -1,94 +0,0 @@ -
-
-
-
- - - - Personal data - - - - Security and notifications - - - - Visibility and terms - - - - - - - - Personal data - - - - Security and notifications - - - - Visibility and terms - - - -
-
-
-
diff --git a/src/app/register/pages/register/register.component.scss b/src/app/register/pages/register/register.component.scss deleted file mode 100644 index 83134365d6..0000000000 --- a/src/app/register/pages/register/register.component.scss +++ /dev/null @@ -1,9 +0,0 @@ -:host { - width: 100%; -} - -mat-vertical-stepper, -mat-horizontal-stepper { - max-width: 100%; - width: 100%; -} diff --git a/src/app/register/pages/register/register.component.spec.ts b/src/app/register/pages/register/register.component.spec.ts deleted file mode 100644 index eee68bf4a9..0000000000 --- a/src/app/register/pages/register/register.component.spec.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing' - -import { RegisterComponent } from './register.component' -import { PlatformInfoService } from '../../../cdk/platform-info' -import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { Overlay } from '@angular/cdk/overlay' -import { RouterTestingModule } from '@angular/router/testing' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { WINDOW_PROVIDERS } from '../../../cdk/window' -import { UntypedFormBuilder } from '@angular/forms' -import { - MatLegacyDialog as MatDialog, - MatLegacyDialogModule as MatDialogModule, -} from '@angular/material/legacy-dialog' -import { RegisterService } from '../../../core/register/register.service' -import { UserService } from '../../../core' -import { SearchService } from '../../../core/search/search.service' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('RegisterComponent', () => { - let component: RegisterComponent - let fixture: ComponentFixture - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, MatDialogModule, RouterTestingModule], - declarations: [RegisterComponent], - providers: [ - WINDOW_PROVIDERS, - UntypedFormBuilder, - RegisterService, - SearchService, - UserService, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents() - }) - - beforeEach(() => { - fixture = TestBed.createComponent(RegisterComponent) - component = fixture.componentInstance - fixture.detectChanges() - }) - - it('should create', () => { - expect(component).toBeTruthy() - }) -}) diff --git a/src/app/register/pages/register/register.component.ts b/src/app/register/pages/register/register.component.ts deleted file mode 100644 index 62aa6abb2f..0000000000 --- a/src/app/register/pages/register/register.component.ts +++ /dev/null @@ -1,338 +0,0 @@ -import { StepperSelectionEvent } from '@angular/cdk/stepper' -import { - AfterViewInit, - ChangeDetectorRef, - Component, - ElementRef, - Inject, - OnInit, - ViewChild, -} from '@angular/core' -import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' -import { MatStep } from '@angular/material/stepper' -import { Router } from '@angular/router' -import { Observable, combineLatest, forkJoin } from 'rxjs' -import { catchError, first, map, switchMap } from 'rxjs/operators' -import { IsThisYouComponent } from 'src/app/cdk/is-this-you' -import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info' -import { WINDOW } from 'src/app/cdk/window' -import { isRedirectToTheAuthorizationPage } from 'src/app/constants' -import { UserService } from 'src/app/core' -import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service' -import { RegisterService } from 'src/app/core/register/register.service' -import { ERROR_REPORT } from 'src/app/errors' -import { RequestInfoForm, SearchParameters, SearchResults } from 'src/app/types' -import { - RegisterConfirmResponse, - RegisterForm, -} from 'src/app/types/register.endpoint' -import { UserSession } from 'src/app/types/session.local' -import { ThirdPartyAuthData } from 'src/app/types/sign-in-data.endpoint' -import { GoogleTagManagerService } from '../../../core/google-tag-manager/google-tag-manager.service' -import { SearchService } from '../../../core/search/search.service' -import { ReactivationLocal } from '../../../types/reactivation.local' - -@Component({ - selector: 'app-register', - templateUrl: './register.component.html', - styleUrls: ['./register.component.scss'], -}) -export class RegisterComponent implements OnInit, AfterViewInit { - @ViewChild('lastStep') lastStep: MatStep - @ViewChild('stepComponentA', { read: ElementRef }) stepComponentA: ElementRef - @ViewChild('stepComponentB', { read: ElementRef }) stepComponentB: ElementRef - @ViewChild('stepComponentC', { read: ElementRef }) stepComponentC: ElementRef - platform: PlatformInfo - FormGroupStepA: UntypedFormGroup - FormGroupStepB: UntypedFormGroup - FormGroupStepC: UntypedFormGroup - isLinear = true - personalData: RegisterForm - backendForm: RegisterForm - loading = false - requestInfoForm: RequestInfoForm | null - thirdPartyAuthData: ThirdPartyAuthData - reactivation = { - isReactivation: false, - reactivationCode: '', - } as ReactivationLocal - - constructor( - private _cdref: ChangeDetectorRef, - private _platformInfo: PlatformInfoService, - private _formBuilder: UntypedFormBuilder, - private _register: RegisterService, - private _dialog: MatDialog, - @Inject(WINDOW) private window: Window, - private _googleTagManagerService: GoogleTagManagerService, - private _user: UserService, - private _router: Router, - private _errorHandler: ErrorHandlerService, - private _userInfo: UserService, - private _searchService: SearchService - ) { - _platformInfo.get().subscribe((platform) => { - this.platform = platform - this.reactivation.isReactivation = this.platform.reactivation - this.reactivation.reactivationCode = this.platform.reactivationCode - }) - } - ngOnInit() { - this._register.getRegisterForm().subscribe() - - this.FormGroupStepA = this._formBuilder.group({ - personal: [''], - }) - this.FormGroupStepB = this._formBuilder.group({ - password: [''], - sendOrcidNews: [''], - }) - this.FormGroupStepC = this._formBuilder.group({ - activitiesVisibilityDefault: [''], - termsOfUse: [''], - captcha: [''], - }) - - combineLatest([this._userInfo.getUserSession(), this._platformInfo.get()]) - .pipe( - first(), - map(([session, platform]) => { - session = session as UserSession - platform = platform as PlatformInfo - - // TODO @leomendoza123 move the handle of social/institutional sessions to the user service - - this.thirdPartyAuthData = session.thirdPartyAuthData - this.requestInfoForm = session.oauthSession - - if (this.thirdPartyAuthData || this.requestInfoForm) { - this.FormGroupStepA = this.prefillRegisterForm( - this.requestInfoForm, - this.thirdPartyAuthData - ) - } - }) - ) - .subscribe() - } - - ngAfterViewInit(): void { - this._cdref.detectChanges() - } - - register() { - this.loading = true - this.lastStep.interacted = true - if ( - this.FormGroupStepA.valid && - this.FormGroupStepB.valid && - this.FormGroupStepC.valid - ) { - this._register - .backendRegisterFormValidate( - this.FormGroupStepA, - this.FormGroupStepB, - this.FormGroupStepC - ) - .pipe( - switchMap((validator: RegisterForm) => { - if (validator.errors.length > 0) { - // At this point any backend error is unexpected - this._errorHandler.handleError( - new Error('registerUnexpectedValidateFail'), - ERROR_REPORT.REGISTER - ) - } - return this._register.register( - this.FormGroupStepA, - this.FormGroupStepB, - this.FormGroupStepC, - this.reactivation, - this.requestInfoForm, - true - ) - }) - ) - .subscribe((response) => { - this.loading = false - if (response.url) { - const analyticsReports: Observable[] = [] - - analyticsReports.push( - this._googleTagManagerService.reportEvent( - 'New-Registration', - this.requestInfoForm || 'Website' - ) - ) - forkJoin(analyticsReports) - .pipe( - catchError((err) => - this._errorHandler.handleError( - err, - ERROR_REPORT.STANDARD_NO_VERBOSE_NO_GA - ) - ) - ) - .subscribe( - () => this.afterRegisterRedirectionHandler(response), - () => this.afterRegisterRedirectionHandler(response) - ) - } else { - this._errorHandler.handleError( - new Error('registerUnexpectedConfirmation'), - ERROR_REPORT.REGISTER - ) - } - }) - } else { - this.loading = false - } - } - - afterRegisterRedirectionHandler(response: RegisterConfirmResponse) { - if (isRedirectToTheAuthorizationPage(response)) { - this.window.location.href = response.url - } else { - if ( - response.url.indexOf('orcid.org/my-orcid') > 0 && - response.url.indexOf('justRegistered') > 0 - ) { - this.window.scrollTo(0, 0) - this._router - .navigate(['/my-orcid'], { - queryParams: { justRegistered: true }, - }) - .then(() => { - this.window.scrollTo(0, 0) - }) - } else { - this.window.location.href = response.url - } - } - } - - afterStepASubmitted() { - // Update the personal data object is required after submit since is an input for StepB - - if (!this.reactivation?.isReactivation) { - if (this.FormGroupStepA.valid) { - this.personalData = this.FormGroupStepA.value.personal - const searchValue = - this.personalData.familyNames.value + - ' ' + - this.personalData.givenNames.value - const searchParams: SearchParameters = {} - searchParams.searchQuery = searchValue - - this._searchService.search(searchParams).subscribe((value) => { - if (value['num-found'] > 0) { - this.openDialog(value) - } - }) - } - } - } - - openDialog(duplicateRecordsSearchResults: SearchResults): void { - const duplicateRecords = duplicateRecordsSearchResults['expanded-result'] - const dialogParams = { - width: `1078px`, - height: `600px`, - maxWidth: `90vw`, - - data: { - duplicateRecords, - titleLabel: $localize`:@@register.titleLabel:Could this be you?`, - // tslint:disable-next-line: max-line-length - bodyLabel: $localize`:@@register.bodyLabel:We found some accounts with your name, which means you may have already created an ORCID iD using a different email address. Before creating an account, please confirm that none of these records belong to you. Not sure if any of these are you?`, - contactLabel: $localize`:@@register.contactLabel:Contact us.`, - firstNameLabel: $localize`:@@register.firstNameLabel:First Name`, - lastNameLabel: $localize`:@@register.lastNameLabel:Last Name`, - affiliationsLabel: $localize`:@@register.affiliationsLabel:Affiliations`, - dateCreatedLabel: $localize`:@@register.dateCreatedLabel:Date Created`, - viewRecordLabel: $localize`:@@register.viewRecordLabel:View Record`, - signinLabel: $localize`:@@register.signinLabel:I ALREADY HAVE AN ID, GO BACK TO SIGN IN`, - continueLabel: $localize`:@@register.continueLabel:NONE OF THESE ARE ME, CONTINUE WITH REGISTRATION`, - }, - } - - if (this.platform.tabletOrHandset) { - dialogParams['maxWidth'] = '95vw' - dialogParams['maxHeight'] = '95vh' - } - - const dialogRef = this._dialog.open(IsThisYouComponent, dialogParams) - - dialogRef.afterClosed().subscribe((confirmRegistration) => { - if (!confirmRegistration) { - this._router.navigate(['signin']) - } - }) - } - - selectionChange(event: StepperSelectionEvent) { - if (event.previouslySelectedIndex === 0) { - this.afterStepASubmitted() - } - if (this.platform.columns4 || this.platform.columns8) { - this.focusCurrentStep(event) - } - } - - // Fix to material vertical stepper not focusing current header - // related issue https://github.com/angular/components/issues/8881 - focusCurrentStep(event: StepperSelectionEvent) { - let nextStep: ElementRef - if (event.selectedIndex === 0) { - nextStep = this.stepComponentA - } else if (event.selectedIndex === 1) { - nextStep = this.stepComponentB - } else if (event.selectedIndex === 2) { - nextStep = this.stepComponentC - } - // On mobile scroll the current step component into view - if (this.platform.columns4 || this.platform.columns8) { - setTimeout(() => { - const nativeElementNextStep = nextStep.nativeElement as HTMLElement - nativeElementNextStep.scrollIntoView() - }, 200) - } - } - - /** - * Fills the register form. - * Use the data from the Oauth session send by the Orcid integrator - * or - * Use data coming from a third party institution/social entity - * or - * Use empty values - */ - private prefillRegisterForm( - oauthData: RequestInfoForm, - thirdPartyOauthData: ThirdPartyAuthData - ) { - return this._formBuilder.group({ - personal: [ - { - givenNames: - oauthData?.userGivenNames || - thirdPartyOauthData?.signinData?.firstName || - '', - familyNames: - oauthData?.userFamilyNames || - thirdPartyOauthData?.signinData?.lastName || - '', - emails: { - email: - oauthData?.userEmail || - thirdPartyOauthData?.signinData?.email || - '', - confirmEmail: '', - additionalEmails: { '0': '' }, - }, - }, - ], - }) - } -} diff --git a/src/app/register/register-routing.module.ts b/src/app/register/register-routing.module.ts deleted file mode 100644 index 9f62a335f0..0000000000 --- a/src/app/register/register-routing.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core' -import { Routes, RouterModule } from '@angular/router' -import { RegisterComponent } from './pages/register/register.component' - -const routes: Routes = [ - { - path: '', - component: RegisterComponent, - }, -] - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class RegisterRoutingModule {} diff --git a/src/app/register/register.module.ts b/src/app/register/register.module.ts deleted file mode 100644 index f7519921a0..0000000000 --- a/src/app/register/register.module.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' -import { RegisterRoutingModule } from './register-routing.module' -import { RegisterComponent } from './pages/register/register.component' -import { StepAComponent } from './components/step-a/step-a.component' -import { StepBComponent } from './components/step-b/step-b.component' -import { StepCComponent } from './components/step-c/step-c.component' -import { FormPersonalComponent } from './components/form-personal/form-personal.component' -import { FormPasswordComponent } from './components/form-password/form-password.component' -import { FormNotificationsComponent } from './components/form-notifications/form-notifications.component' -import { FormVisibilityComponent } from './components/form-visibility/form-visibility.component' -import { FormTermsComponent } from './components/form-terms/form-terms.component' -import { FormsModule, ReactiveFormsModule } from '@angular/forms' -// tslint:disable-next-line: max-line-length -import { FormPersonalAdditionalEmailsComponent } from './components/form-personal-additional-emails/form-personal-additional-emails.component' -import { IsThisYouModule } from '../cdk/is-this-you' -import { MatLegacyFormFieldModule as MatFormFieldModule } from '@angular/material/legacy-form-field' -import { MatLegacyInputModule as MatInputModule } from '@angular/material/legacy-input' -import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button' -import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox' -import { MatIconModule } from '@angular/material/icon' -import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog' -import { MatStepperModule } from '@angular/material/stepper' -import { MatLegacyRadioModule as MatRadioModule } from '@angular/material/legacy-radio' -import { MatLegacyCardModule as MatCardModule } from '@angular/material/legacy-card' -import { RecaptchaModule } from '../cdk/recaptcha/recaptcha.module' -import { FormAntiRobotsComponent } from './components/form-anti-robots/form-anti-robots.component' -import { A11yLinkModule } from '../cdk/a11y-link/a11y-link.module' -import { BackendErrorComponent } from './components/backend-error/backend-error.component' -import { MatLegacyProgressBarModule as MatProgressBarModule } from '@angular/material/legacy-progress-bar' -import { FormDirectivesModule } from '../cdk/form-directives/form-directives.module' -import { TopBarRecordIssuesComponent } from './components/top-bar-record-issues/top-bar-record-issues.component' -import { WarningMessageModule } from '../cdk/warning-message/warning-message.module' -import { MdePopoverModule } from '../cdk/popover' -@NgModule({ - declarations: [ - RegisterComponent, - StepAComponent, - StepBComponent, - StepCComponent, - FormPersonalComponent, - FormPasswordComponent, - FormNotificationsComponent, - FormVisibilityComponent, - FormTermsComponent, - FormPersonalAdditionalEmailsComponent, - FormAntiRobotsComponent, - BackendErrorComponent, - TopBarRecordIssuesComponent, - ], - imports: [ - CommonModule, - FormsModule, - ReactiveFormsModule, - RegisterRoutingModule, - MatStepperModule, - MatFormFieldModule, - MatInputModule, - MatButtonModule, - MatCheckboxModule, - MatRadioModule, - MatIconModule, - MatDialogModule, - IsThisYouModule, - MdePopoverModule, - MatCardModule, - RecaptchaModule, - A11yLinkModule, - MatProgressBarModule, - FormDirectivesModule, - WarningMessageModule, - ], -}) -export class RegisterModuleLegacy {} From 01ee21d2088a30ea86ae9f47ef58b3a593db7266 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:08:14 +0200 Subject: [PATCH 2/5] rename register2 to register --- ...ss-theme.scss => register.scss-theme.scss} | 0 ...gister2.style.scss => register.style.scss} | 0 ...component.html => register.component.html} | 0 ...component.scss => register.component.scss} | 0 ...css => register.component.scss.theme.scss} | 0 ...er2.component.ts => register.component.ts} | 24 +++++++------------ 6 files changed, 9 insertions(+), 15 deletions(-) rename src/app/register2/components/{register2.scss-theme.scss => register.scss-theme.scss} (100%) rename src/app/register2/components/{register2.style.scss => register.style.scss} (100%) rename src/app/register2/pages/register/{register2.component.html => register.component.html} (100%) rename src/app/register2/pages/register/{register2.component.scss => register.component.scss} (100%) rename src/app/register2/pages/register/{register2.component.scss.theme.scss => register.component.scss.theme.scss} (100%) rename src/app/register2/pages/register/{register2.component.ts => register.component.ts} (93%) diff --git a/src/app/register2/components/register2.scss-theme.scss b/src/app/register2/components/register.scss-theme.scss similarity index 100% rename from src/app/register2/components/register2.scss-theme.scss rename to src/app/register2/components/register.scss-theme.scss diff --git a/src/app/register2/components/register2.style.scss b/src/app/register2/components/register.style.scss similarity index 100% rename from src/app/register2/components/register2.style.scss rename to src/app/register2/components/register.style.scss diff --git a/src/app/register2/pages/register/register2.component.html b/src/app/register2/pages/register/register.component.html similarity index 100% rename from src/app/register2/pages/register/register2.component.html rename to src/app/register2/pages/register/register.component.html diff --git a/src/app/register2/pages/register/register2.component.scss b/src/app/register2/pages/register/register.component.scss similarity index 100% rename from src/app/register2/pages/register/register2.component.scss rename to src/app/register2/pages/register/register.component.scss diff --git a/src/app/register2/pages/register/register2.component.scss.theme.scss b/src/app/register2/pages/register/register.component.scss.theme.scss similarity index 100% rename from src/app/register2/pages/register/register2.component.scss.theme.scss rename to src/app/register2/pages/register/register.component.scss.theme.scss diff --git a/src/app/register2/pages/register/register2.component.ts b/src/app/register2/pages/register/register.component.ts similarity index 93% rename from src/app/register2/pages/register/register2.component.ts rename to src/app/register2/pages/register/register.component.ts index b1312b971c..b0569f80b7 100644 --- a/src/app/register2/pages/register/register2.component.ts +++ b/src/app/register2/pages/register/register.component.ts @@ -9,12 +9,10 @@ import { ViewChild, } from '@angular/core' import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' import { MatStep, MatStepper } from '@angular/material/stepper' import { Router } from '@angular/router' import { Observable, combineLatest, forkJoin } from 'rxjs' import { catchError, first, map, switchMap } from 'rxjs/operators' -import { IsThisYouComponent } from 'src/app/cdk/is-this-you' import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info' import { WINDOW } from 'src/app/cdk/window' import { isRedirectToTheAuthorizationPage } from 'src/app/constants' @@ -22,7 +20,7 @@ import { UserService } from 'src/app/core' import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service' import { Register2Service } from 'src/app/core/register2/register2.service' import { ERROR_REPORT } from 'src/app/errors' -import { RequestInfoForm, SearchResults } from 'src/app/types' +import { RequestInfoForm } from 'src/app/types' import { RegisterConfirmResponse, RegisterForm, @@ -30,25 +28,21 @@ import { import { UserSession } from 'src/app/types/session.local' import { ThirdPartyAuthData } from 'src/app/types/sign-in-data.endpoint' import { GoogleTagManagerService } from '../../../core/google-tag-manager/google-tag-manager.service' -import { SearchService } from '../../../core/search/search.service' import { ReactivationLocal } from '../../../types/reactivation.local' -import { - CustomEventService, - JourneyType, -} from 'src/app/core/observability-events/observability-events.service' +import { JourneyType } from 'src/app/core/observability-events/observability-events.service' import { RegisterObservabilityService } from '../../register-observability.service' @Component({ - selector: 'app-register-2', - templateUrl: './register2.component.html', + selector: 'app-register', + templateUrl: './register.component.html', styleUrls: [ - './register2.component.scss', - './register2.component.scss.theme.scss', - '../../components/register2.scss-theme.scss', - '../../components/register2.style.scss', + './register.component.scss', + './register.component.scss.theme.scss', + '../../components/register.scss-theme.scss', + '../../components/register.style.scss', ], }) -export class Register2Component implements OnInit, AfterViewInit { +export class RegisterComponent implements OnInit, AfterViewInit { @ViewChild('lastStep') lastStep: MatStep @ViewChild('stepComponentA', { read: ElementRef }) stepComponentA: ElementRef @ViewChild('stepComponentB', { read: ElementRef }) stepComponentB: ElementRef From 71b9b768367d7acac63c68b493eaa2f6b55417b1 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:08:40 +0200 Subject: [PATCH 3/5] rename more register2 to register --- src/app/app-routing.module.ts | 4 ++-- src/app/register2/register-routing.module.ts | 4 ++-- src/app/register2/register.module.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 95ff84550e..ae1c30bea2 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -91,7 +91,7 @@ const routes: Routes = [ path: ApplicationRoutes.register, canActivateChild: [LanguageGuard, RegisterGuard], loadChildren: () => - import('./register2/register.module').then((m) => m.Register2Module), + import('./register2/register.module').then((m) => m.RegisterModule), }, { path: ApplicationRoutes.search, @@ -151,7 +151,7 @@ const routes: Routes = [ matcher: routerReactivation, canActivateChild: [LanguageGuard, RegisterGuard], loadChildren: () => - import('./register2/register.module').then((m) => m.Register2Module), + import('./register2/register.module').then((m) => m.RegisterModule), }, { path: ApplicationRoutes.selfService, diff --git a/src/app/register2/register-routing.module.ts b/src/app/register2/register-routing.module.ts index 7dbd8286d7..cfeceb5212 100644 --- a/src/app/register2/register-routing.module.ts +++ b/src/app/register2/register-routing.module.ts @@ -1,11 +1,11 @@ import { NgModule } from '@angular/core' import { RouterModule, Routes } from '@angular/router' -import { Register2Component } from './pages/register/register2.component' +import { RegisterComponent } from './pages/register/register.component' const routes: Routes = [ { path: '', - component: Register2Component, + component: RegisterComponent, }, ] diff --git a/src/app/register2/register.module.ts b/src/app/register2/register.module.ts index da4ff75c97..219a453fb2 100644 --- a/src/app/register2/register.module.ts +++ b/src/app/register2/register.module.ts @@ -30,7 +30,7 @@ import { WarningMessageModule } from '../cdk/warning-message/warning-message.mod import { BackendErrorComponent } from './components/backend-error/backend-error.component' import { FormAntiRobotsComponent } from './components/form-anti-robots/form-anti-robots.component' import { FormPersonalAdditionalEmailsComponent } from './components/form-personal-additional-emails/form-personal-additional-emails.component' -import { Register2Component } from './pages/register/register2.component' +import { RegisterComponent } from './pages/register/register.component' import { StepCComponent } from './components/step-c/step-c.component' import { FormCurrentEmploymentComponent } from './components/form-current-employment/form-current-employment.component' import { MatLegacyAutocompleteModule as MatAutocompleteModule } from '@angular/material/legacy-autocomplete' @@ -54,7 +54,7 @@ import { AlertMessageModule } from '../cdk/alert-message/alert-message.module' FormPersonalAdditionalEmailsComponent, FormAntiRobotsComponent, BackendErrorComponent, - Register2Component, + RegisterComponent, FormCurrentEmploymentComponent, ], imports: [ @@ -84,4 +84,4 @@ import { AlertMessageModule } from '../cdk/alert-message/alert-message.module' SharedModule, ], }) -export class Register2Module {} +export class RegisterModule {} From 0cb0b1b07895ea1277660e4a48a1f400a417c979 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:09:40 +0200 Subject: [PATCH 4/5] rename register2 folder to register and update imports --- .../ErrorStateMatcherForFormLevelErrors.ts | 0 src/app/{register2 => register}/components/BaseForm.ts | 0 src/app/{register2 => register}/components/BaseStep.ts | 0 .../components/backend-error/backend-error.component.html | 0 .../components/backend-error/backend-error.component.scss | 0 .../components/backend-error/backend-error.component.spec.ts | 0 .../components/backend-error/backend-error.component.ts | 0 .../components/form-anti-robots/form-anti-robots.component.html | 0 .../components/form-anti-robots/form-anti-robots.component.scss | 0 .../form-anti-robots/form-anti-robots.component.spec.ts | 0 .../components/form-anti-robots/form-anti-robots.component.ts | 0 .../form-current-employment.component.html | 0 .../form-current-employment.component.scss | 0 .../form-current-employment.component.scss-theme.scss | 0 .../form-current-employment.component.spec.ts | 0 .../form-current-employment/form-current-employment.component.ts | 0 .../form-notifications/form-notifications.component.html | 0 .../form-notifications/form-notifications.component.scss | 0 .../form-notifications/form-notifications.component.spec.ts | 0 .../components/form-notifications/form-notifications.component.ts | 0 .../components/form-password/form-password.component.html | 0 .../components/form-password/form-password.component.scss | 0 .../form-password/form-password.component.scss-theme.scss | 0 .../components/form-password/form-password.component.spec.ts | 0 .../components/form-password/form-password.component.ts | 0 .../form-personal-additional-emails.component.html | 0 .../form-personal-additional-emails.component.scss | 0 .../form-personal-additional-emails.component.spec.ts | 0 .../form-personal-additional-emails.component.ts | 0 .../components/form-personal/form-personal.component.html | 0 .../components/form-personal/form-personal.component.scss | 0 .../components/form-personal/form-personal.component.spec.ts | 0 .../components/form-personal/form-personal.component.ts | 0 .../components/form-terms/form-terms.component.html | 0 .../components/form-terms/form-terms.component.scss | 0 .../components/form-terms/form-terms.component.spec.ts | 0 .../components/form-terms/form-terms.component.ts | 0 .../components/form-visibility/form-visibility.component.html | 0 .../components/form-visibility/form-visibility.component.scss | 0 .../components/form-visibility/form-visibility.component.spec.ts | 0 .../components/form-visibility/form-visibility.component.ts | 0 .../{register2 => register}/components/register.scss-theme.scss | 0 src/app/{register2 => register}/components/register.style.scss | 0 .../components/step-a/step-a.component.html | 0 .../components/step-a/step-a.component.scss | 0 .../components/step-a/step-a.component.spec.ts | 0 .../{register2 => register}/components/step-a/step-a.component.ts | 0 .../components/step-b/step-b.component.html | 0 .../components/step-b/step-b.component.scss | 0 .../components/step-b/step-b.component.spec.ts | 0 .../{register2 => register}/components/step-b/step-b.component.ts | 0 .../components/step-c/step-c.component.html | 0 .../components/step-c/step-c.component.scss | 0 .../{register2 => register}/components/step-c/step-c.component.ts | 0 src/app/{register2 => register}/components/step-c/step-c.spec.ts | 0 .../components/step-c2/step-c2.component.html | 0 .../components/step-c2/step-c2.component.scss | 0 .../components/step-c2/step-c2.component.ts | 0 .../{register2 => register}/components/step-c2/step-c2.spec.ts | 0 .../components/step-d/step-d.component.html | 0 .../components/step-d/step-d.component.scss | 0 .../components/step-d/step-d.component.spec.ts | 0 .../{register2 => register}/components/step-d/step-d.component.ts | 0 .../pages/register/register.component.html | 0 .../pages/register/register.component.scss | 0 .../pages/register/register.component.scss.theme.scss | 0 .../{register2 => register}/pages/register/register.component.ts | 0 src/app/{register2 => register}/register-observability.service.ts | 0 src/app/{register2 => register}/register-routing.module.ts | 0 src/app/{register2 => register}/register-state.service.spec.ts | 0 src/app/{register2 => register}/register-state.service.ts | 0 src/app/{register2 => register}/register.module.ts | 0 72 files changed, 0 insertions(+), 0 deletions(-) rename src/app/{register2 => register}/ErrorStateMatcherForFormLevelErrors.ts (100%) rename src/app/{register2 => register}/components/BaseForm.ts (100%) rename src/app/{register2 => register}/components/BaseStep.ts (100%) rename src/app/{register2 => register}/components/backend-error/backend-error.component.html (100%) rename src/app/{register2 => register}/components/backend-error/backend-error.component.scss (100%) rename src/app/{register2 => register}/components/backend-error/backend-error.component.spec.ts (100%) rename src/app/{register2 => register}/components/backend-error/backend-error.component.ts (100%) rename src/app/{register2 => register}/components/form-anti-robots/form-anti-robots.component.html (100%) rename src/app/{register2 => register}/components/form-anti-robots/form-anti-robots.component.scss (100%) rename src/app/{register2 => register}/components/form-anti-robots/form-anti-robots.component.spec.ts (100%) rename src/app/{register2 => register}/components/form-anti-robots/form-anti-robots.component.ts (100%) rename src/app/{register2 => register}/components/form-current-employment/form-current-employment.component.html (100%) rename src/app/{register2 => register}/components/form-current-employment/form-current-employment.component.scss (100%) rename src/app/{register2 => register}/components/form-current-employment/form-current-employment.component.scss-theme.scss (100%) rename src/app/{register2 => register}/components/form-current-employment/form-current-employment.component.spec.ts (100%) rename src/app/{register2 => register}/components/form-current-employment/form-current-employment.component.ts (100%) rename src/app/{register2 => register}/components/form-notifications/form-notifications.component.html (100%) rename src/app/{register2 => register}/components/form-notifications/form-notifications.component.scss (100%) rename src/app/{register2 => register}/components/form-notifications/form-notifications.component.spec.ts (100%) rename src/app/{register2 => register}/components/form-notifications/form-notifications.component.ts (100%) rename src/app/{register2 => register}/components/form-password/form-password.component.html (100%) rename src/app/{register2 => register}/components/form-password/form-password.component.scss (100%) rename src/app/{register2 => register}/components/form-password/form-password.component.scss-theme.scss (100%) rename src/app/{register2 => register}/components/form-password/form-password.component.spec.ts (100%) rename src/app/{register2 => register}/components/form-password/form-password.component.ts (100%) rename src/app/{register2 => register}/components/form-personal-additional-emails/form-personal-additional-emails.component.html (100%) rename src/app/{register2 => register}/components/form-personal-additional-emails/form-personal-additional-emails.component.scss (100%) rename src/app/{register2 => register}/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts (100%) rename src/app/{register2 => register}/components/form-personal-additional-emails/form-personal-additional-emails.component.ts (100%) rename src/app/{register2 => register}/components/form-personal/form-personal.component.html (100%) rename src/app/{register2 => register}/components/form-personal/form-personal.component.scss (100%) rename src/app/{register2 => register}/components/form-personal/form-personal.component.spec.ts (100%) rename src/app/{register2 => register}/components/form-personal/form-personal.component.ts (100%) rename src/app/{register2 => register}/components/form-terms/form-terms.component.html (100%) rename src/app/{register2 => register}/components/form-terms/form-terms.component.scss (100%) rename src/app/{register2 => register}/components/form-terms/form-terms.component.spec.ts (100%) rename src/app/{register2 => register}/components/form-terms/form-terms.component.ts (100%) rename src/app/{register2 => register}/components/form-visibility/form-visibility.component.html (100%) rename src/app/{register2 => register}/components/form-visibility/form-visibility.component.scss (100%) rename src/app/{register2 => register}/components/form-visibility/form-visibility.component.spec.ts (100%) rename src/app/{register2 => register}/components/form-visibility/form-visibility.component.ts (100%) rename src/app/{register2 => register}/components/register.scss-theme.scss (100%) rename src/app/{register2 => register}/components/register.style.scss (100%) rename src/app/{register2 => register}/components/step-a/step-a.component.html (100%) rename src/app/{register2 => register}/components/step-a/step-a.component.scss (100%) rename src/app/{register2 => register}/components/step-a/step-a.component.spec.ts (100%) rename src/app/{register2 => register}/components/step-a/step-a.component.ts (100%) rename src/app/{register2 => register}/components/step-b/step-b.component.html (100%) rename src/app/{register2 => register}/components/step-b/step-b.component.scss (100%) rename src/app/{register2 => register}/components/step-b/step-b.component.spec.ts (100%) rename src/app/{register2 => register}/components/step-b/step-b.component.ts (100%) rename src/app/{register2 => register}/components/step-c/step-c.component.html (100%) rename src/app/{register2 => register}/components/step-c/step-c.component.scss (100%) rename src/app/{register2 => register}/components/step-c/step-c.component.ts (100%) rename src/app/{register2 => register}/components/step-c/step-c.spec.ts (100%) rename src/app/{register2 => register}/components/step-c2/step-c2.component.html (100%) rename src/app/{register2 => register}/components/step-c2/step-c2.component.scss (100%) rename src/app/{register2 => register}/components/step-c2/step-c2.component.ts (100%) rename src/app/{register2 => register}/components/step-c2/step-c2.spec.ts (100%) rename src/app/{register2 => register}/components/step-d/step-d.component.html (100%) rename src/app/{register2 => register}/components/step-d/step-d.component.scss (100%) rename src/app/{register2 => register}/components/step-d/step-d.component.spec.ts (100%) rename src/app/{register2 => register}/components/step-d/step-d.component.ts (100%) rename src/app/{register2 => register}/pages/register/register.component.html (100%) rename src/app/{register2 => register}/pages/register/register.component.scss (100%) rename src/app/{register2 => register}/pages/register/register.component.scss.theme.scss (100%) rename src/app/{register2 => register}/pages/register/register.component.ts (100%) rename src/app/{register2 => register}/register-observability.service.ts (100%) rename src/app/{register2 => register}/register-routing.module.ts (100%) rename src/app/{register2 => register}/register-state.service.spec.ts (100%) rename src/app/{register2 => register}/register-state.service.ts (100%) rename src/app/{register2 => register}/register.module.ts (100%) diff --git a/src/app/register2/ErrorStateMatcherForFormLevelErrors.ts b/src/app/register/ErrorStateMatcherForFormLevelErrors.ts similarity index 100% rename from src/app/register2/ErrorStateMatcherForFormLevelErrors.ts rename to src/app/register/ErrorStateMatcherForFormLevelErrors.ts diff --git a/src/app/register2/components/BaseForm.ts b/src/app/register/components/BaseForm.ts similarity index 100% rename from src/app/register2/components/BaseForm.ts rename to src/app/register/components/BaseForm.ts diff --git a/src/app/register2/components/BaseStep.ts b/src/app/register/components/BaseStep.ts similarity index 100% rename from src/app/register2/components/BaseStep.ts rename to src/app/register/components/BaseStep.ts diff --git a/src/app/register2/components/backend-error/backend-error.component.html b/src/app/register/components/backend-error/backend-error.component.html similarity index 100% rename from src/app/register2/components/backend-error/backend-error.component.html rename to src/app/register/components/backend-error/backend-error.component.html diff --git a/src/app/register2/components/backend-error/backend-error.component.scss b/src/app/register/components/backend-error/backend-error.component.scss similarity index 100% rename from src/app/register2/components/backend-error/backend-error.component.scss rename to src/app/register/components/backend-error/backend-error.component.scss diff --git a/src/app/register2/components/backend-error/backend-error.component.spec.ts b/src/app/register/components/backend-error/backend-error.component.spec.ts similarity index 100% rename from src/app/register2/components/backend-error/backend-error.component.spec.ts rename to src/app/register/components/backend-error/backend-error.component.spec.ts diff --git a/src/app/register2/components/backend-error/backend-error.component.ts b/src/app/register/components/backend-error/backend-error.component.ts similarity index 100% rename from src/app/register2/components/backend-error/backend-error.component.ts rename to src/app/register/components/backend-error/backend-error.component.ts diff --git a/src/app/register2/components/form-anti-robots/form-anti-robots.component.html b/src/app/register/components/form-anti-robots/form-anti-robots.component.html similarity index 100% rename from src/app/register2/components/form-anti-robots/form-anti-robots.component.html rename to src/app/register/components/form-anti-robots/form-anti-robots.component.html diff --git a/src/app/register2/components/form-anti-robots/form-anti-robots.component.scss b/src/app/register/components/form-anti-robots/form-anti-robots.component.scss similarity index 100% rename from src/app/register2/components/form-anti-robots/form-anti-robots.component.scss rename to src/app/register/components/form-anti-robots/form-anti-robots.component.scss diff --git a/src/app/register2/components/form-anti-robots/form-anti-robots.component.spec.ts b/src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts similarity index 100% rename from src/app/register2/components/form-anti-robots/form-anti-robots.component.spec.ts rename to src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts diff --git a/src/app/register2/components/form-anti-robots/form-anti-robots.component.ts b/src/app/register/components/form-anti-robots/form-anti-robots.component.ts similarity index 100% rename from src/app/register2/components/form-anti-robots/form-anti-robots.component.ts rename to src/app/register/components/form-anti-robots/form-anti-robots.component.ts diff --git a/src/app/register2/components/form-current-employment/form-current-employment.component.html b/src/app/register/components/form-current-employment/form-current-employment.component.html similarity index 100% rename from src/app/register2/components/form-current-employment/form-current-employment.component.html rename to src/app/register/components/form-current-employment/form-current-employment.component.html diff --git a/src/app/register2/components/form-current-employment/form-current-employment.component.scss b/src/app/register/components/form-current-employment/form-current-employment.component.scss similarity index 100% rename from src/app/register2/components/form-current-employment/form-current-employment.component.scss rename to src/app/register/components/form-current-employment/form-current-employment.component.scss diff --git a/src/app/register2/components/form-current-employment/form-current-employment.component.scss-theme.scss b/src/app/register/components/form-current-employment/form-current-employment.component.scss-theme.scss similarity index 100% rename from src/app/register2/components/form-current-employment/form-current-employment.component.scss-theme.scss rename to src/app/register/components/form-current-employment/form-current-employment.component.scss-theme.scss diff --git a/src/app/register2/components/form-current-employment/form-current-employment.component.spec.ts b/src/app/register/components/form-current-employment/form-current-employment.component.spec.ts similarity index 100% rename from src/app/register2/components/form-current-employment/form-current-employment.component.spec.ts rename to src/app/register/components/form-current-employment/form-current-employment.component.spec.ts diff --git a/src/app/register2/components/form-current-employment/form-current-employment.component.ts b/src/app/register/components/form-current-employment/form-current-employment.component.ts similarity index 100% rename from src/app/register2/components/form-current-employment/form-current-employment.component.ts rename to src/app/register/components/form-current-employment/form-current-employment.component.ts diff --git a/src/app/register2/components/form-notifications/form-notifications.component.html b/src/app/register/components/form-notifications/form-notifications.component.html similarity index 100% rename from src/app/register2/components/form-notifications/form-notifications.component.html rename to src/app/register/components/form-notifications/form-notifications.component.html diff --git a/src/app/register2/components/form-notifications/form-notifications.component.scss b/src/app/register/components/form-notifications/form-notifications.component.scss similarity index 100% rename from src/app/register2/components/form-notifications/form-notifications.component.scss rename to src/app/register/components/form-notifications/form-notifications.component.scss diff --git a/src/app/register2/components/form-notifications/form-notifications.component.spec.ts b/src/app/register/components/form-notifications/form-notifications.component.spec.ts similarity index 100% rename from src/app/register2/components/form-notifications/form-notifications.component.spec.ts rename to src/app/register/components/form-notifications/form-notifications.component.spec.ts diff --git a/src/app/register2/components/form-notifications/form-notifications.component.ts b/src/app/register/components/form-notifications/form-notifications.component.ts similarity index 100% rename from src/app/register2/components/form-notifications/form-notifications.component.ts rename to src/app/register/components/form-notifications/form-notifications.component.ts diff --git a/src/app/register2/components/form-password/form-password.component.html b/src/app/register/components/form-password/form-password.component.html similarity index 100% rename from src/app/register2/components/form-password/form-password.component.html rename to src/app/register/components/form-password/form-password.component.html diff --git a/src/app/register2/components/form-password/form-password.component.scss b/src/app/register/components/form-password/form-password.component.scss similarity index 100% rename from src/app/register2/components/form-password/form-password.component.scss rename to src/app/register/components/form-password/form-password.component.scss diff --git a/src/app/register2/components/form-password/form-password.component.scss-theme.scss b/src/app/register/components/form-password/form-password.component.scss-theme.scss similarity index 100% rename from src/app/register2/components/form-password/form-password.component.scss-theme.scss rename to src/app/register/components/form-password/form-password.component.scss-theme.scss diff --git a/src/app/register2/components/form-password/form-password.component.spec.ts b/src/app/register/components/form-password/form-password.component.spec.ts similarity index 100% rename from src/app/register2/components/form-password/form-password.component.spec.ts rename to src/app/register/components/form-password/form-password.component.spec.ts diff --git a/src/app/register2/components/form-password/form-password.component.ts b/src/app/register/components/form-password/form-password.component.ts similarity index 100% rename from src/app/register2/components/form-password/form-password.component.ts rename to src/app/register/components/form-password/form-password.component.ts diff --git a/src/app/register2/components/form-personal-additional-emails/form-personal-additional-emails.component.html b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.html similarity index 100% rename from src/app/register2/components/form-personal-additional-emails/form-personal-additional-emails.component.html rename to src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.html diff --git a/src/app/register2/components/form-personal-additional-emails/form-personal-additional-emails.component.scss b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.scss similarity index 100% rename from src/app/register2/components/form-personal-additional-emails/form-personal-additional-emails.component.scss rename to src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.scss diff --git a/src/app/register2/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts similarity index 100% rename from src/app/register2/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts rename to src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.spec.ts diff --git a/src/app/register2/components/form-personal-additional-emails/form-personal-additional-emails.component.ts b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts similarity index 100% rename from src/app/register2/components/form-personal-additional-emails/form-personal-additional-emails.component.ts rename to src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts diff --git a/src/app/register2/components/form-personal/form-personal.component.html b/src/app/register/components/form-personal/form-personal.component.html similarity index 100% rename from src/app/register2/components/form-personal/form-personal.component.html rename to src/app/register/components/form-personal/form-personal.component.html diff --git a/src/app/register2/components/form-personal/form-personal.component.scss b/src/app/register/components/form-personal/form-personal.component.scss similarity index 100% rename from src/app/register2/components/form-personal/form-personal.component.scss rename to src/app/register/components/form-personal/form-personal.component.scss diff --git a/src/app/register2/components/form-personal/form-personal.component.spec.ts b/src/app/register/components/form-personal/form-personal.component.spec.ts similarity index 100% rename from src/app/register2/components/form-personal/form-personal.component.spec.ts rename to src/app/register/components/form-personal/form-personal.component.spec.ts diff --git a/src/app/register2/components/form-personal/form-personal.component.ts b/src/app/register/components/form-personal/form-personal.component.ts similarity index 100% rename from src/app/register2/components/form-personal/form-personal.component.ts rename to src/app/register/components/form-personal/form-personal.component.ts diff --git a/src/app/register2/components/form-terms/form-terms.component.html b/src/app/register/components/form-terms/form-terms.component.html similarity index 100% rename from src/app/register2/components/form-terms/form-terms.component.html rename to src/app/register/components/form-terms/form-terms.component.html diff --git a/src/app/register2/components/form-terms/form-terms.component.scss b/src/app/register/components/form-terms/form-terms.component.scss similarity index 100% rename from src/app/register2/components/form-terms/form-terms.component.scss rename to src/app/register/components/form-terms/form-terms.component.scss diff --git a/src/app/register2/components/form-terms/form-terms.component.spec.ts b/src/app/register/components/form-terms/form-terms.component.spec.ts similarity index 100% rename from src/app/register2/components/form-terms/form-terms.component.spec.ts rename to src/app/register/components/form-terms/form-terms.component.spec.ts diff --git a/src/app/register2/components/form-terms/form-terms.component.ts b/src/app/register/components/form-terms/form-terms.component.ts similarity index 100% rename from src/app/register2/components/form-terms/form-terms.component.ts rename to src/app/register/components/form-terms/form-terms.component.ts diff --git a/src/app/register2/components/form-visibility/form-visibility.component.html b/src/app/register/components/form-visibility/form-visibility.component.html similarity index 100% rename from src/app/register2/components/form-visibility/form-visibility.component.html rename to src/app/register/components/form-visibility/form-visibility.component.html diff --git a/src/app/register2/components/form-visibility/form-visibility.component.scss b/src/app/register/components/form-visibility/form-visibility.component.scss similarity index 100% rename from src/app/register2/components/form-visibility/form-visibility.component.scss rename to src/app/register/components/form-visibility/form-visibility.component.scss diff --git a/src/app/register2/components/form-visibility/form-visibility.component.spec.ts b/src/app/register/components/form-visibility/form-visibility.component.spec.ts similarity index 100% rename from src/app/register2/components/form-visibility/form-visibility.component.spec.ts rename to src/app/register/components/form-visibility/form-visibility.component.spec.ts diff --git a/src/app/register2/components/form-visibility/form-visibility.component.ts b/src/app/register/components/form-visibility/form-visibility.component.ts similarity index 100% rename from src/app/register2/components/form-visibility/form-visibility.component.ts rename to src/app/register/components/form-visibility/form-visibility.component.ts diff --git a/src/app/register2/components/register.scss-theme.scss b/src/app/register/components/register.scss-theme.scss similarity index 100% rename from src/app/register2/components/register.scss-theme.scss rename to src/app/register/components/register.scss-theme.scss diff --git a/src/app/register2/components/register.style.scss b/src/app/register/components/register.style.scss similarity index 100% rename from src/app/register2/components/register.style.scss rename to src/app/register/components/register.style.scss diff --git a/src/app/register2/components/step-a/step-a.component.html b/src/app/register/components/step-a/step-a.component.html similarity index 100% rename from src/app/register2/components/step-a/step-a.component.html rename to src/app/register/components/step-a/step-a.component.html diff --git a/src/app/register2/components/step-a/step-a.component.scss b/src/app/register/components/step-a/step-a.component.scss similarity index 100% rename from src/app/register2/components/step-a/step-a.component.scss rename to src/app/register/components/step-a/step-a.component.scss diff --git a/src/app/register2/components/step-a/step-a.component.spec.ts b/src/app/register/components/step-a/step-a.component.spec.ts similarity index 100% rename from src/app/register2/components/step-a/step-a.component.spec.ts rename to src/app/register/components/step-a/step-a.component.spec.ts diff --git a/src/app/register2/components/step-a/step-a.component.ts b/src/app/register/components/step-a/step-a.component.ts similarity index 100% rename from src/app/register2/components/step-a/step-a.component.ts rename to src/app/register/components/step-a/step-a.component.ts diff --git a/src/app/register2/components/step-b/step-b.component.html b/src/app/register/components/step-b/step-b.component.html similarity index 100% rename from src/app/register2/components/step-b/step-b.component.html rename to src/app/register/components/step-b/step-b.component.html diff --git a/src/app/register2/components/step-b/step-b.component.scss b/src/app/register/components/step-b/step-b.component.scss similarity index 100% rename from src/app/register2/components/step-b/step-b.component.scss rename to src/app/register/components/step-b/step-b.component.scss diff --git a/src/app/register2/components/step-b/step-b.component.spec.ts b/src/app/register/components/step-b/step-b.component.spec.ts similarity index 100% rename from src/app/register2/components/step-b/step-b.component.spec.ts rename to src/app/register/components/step-b/step-b.component.spec.ts diff --git a/src/app/register2/components/step-b/step-b.component.ts b/src/app/register/components/step-b/step-b.component.ts similarity index 100% rename from src/app/register2/components/step-b/step-b.component.ts rename to src/app/register/components/step-b/step-b.component.ts diff --git a/src/app/register2/components/step-c/step-c.component.html b/src/app/register/components/step-c/step-c.component.html similarity index 100% rename from src/app/register2/components/step-c/step-c.component.html rename to src/app/register/components/step-c/step-c.component.html diff --git a/src/app/register2/components/step-c/step-c.component.scss b/src/app/register/components/step-c/step-c.component.scss similarity index 100% rename from src/app/register2/components/step-c/step-c.component.scss rename to src/app/register/components/step-c/step-c.component.scss diff --git a/src/app/register2/components/step-c/step-c.component.ts b/src/app/register/components/step-c/step-c.component.ts similarity index 100% rename from src/app/register2/components/step-c/step-c.component.ts rename to src/app/register/components/step-c/step-c.component.ts diff --git a/src/app/register2/components/step-c/step-c.spec.ts b/src/app/register/components/step-c/step-c.spec.ts similarity index 100% rename from src/app/register2/components/step-c/step-c.spec.ts rename to src/app/register/components/step-c/step-c.spec.ts diff --git a/src/app/register2/components/step-c2/step-c2.component.html b/src/app/register/components/step-c2/step-c2.component.html similarity index 100% rename from src/app/register2/components/step-c2/step-c2.component.html rename to src/app/register/components/step-c2/step-c2.component.html diff --git a/src/app/register2/components/step-c2/step-c2.component.scss b/src/app/register/components/step-c2/step-c2.component.scss similarity index 100% rename from src/app/register2/components/step-c2/step-c2.component.scss rename to src/app/register/components/step-c2/step-c2.component.scss diff --git a/src/app/register2/components/step-c2/step-c2.component.ts b/src/app/register/components/step-c2/step-c2.component.ts similarity index 100% rename from src/app/register2/components/step-c2/step-c2.component.ts rename to src/app/register/components/step-c2/step-c2.component.ts diff --git a/src/app/register2/components/step-c2/step-c2.spec.ts b/src/app/register/components/step-c2/step-c2.spec.ts similarity index 100% rename from src/app/register2/components/step-c2/step-c2.spec.ts rename to src/app/register/components/step-c2/step-c2.spec.ts diff --git a/src/app/register2/components/step-d/step-d.component.html b/src/app/register/components/step-d/step-d.component.html similarity index 100% rename from src/app/register2/components/step-d/step-d.component.html rename to src/app/register/components/step-d/step-d.component.html diff --git a/src/app/register2/components/step-d/step-d.component.scss b/src/app/register/components/step-d/step-d.component.scss similarity index 100% rename from src/app/register2/components/step-d/step-d.component.scss rename to src/app/register/components/step-d/step-d.component.scss diff --git a/src/app/register2/components/step-d/step-d.component.spec.ts b/src/app/register/components/step-d/step-d.component.spec.ts similarity index 100% rename from src/app/register2/components/step-d/step-d.component.spec.ts rename to src/app/register/components/step-d/step-d.component.spec.ts diff --git a/src/app/register2/components/step-d/step-d.component.ts b/src/app/register/components/step-d/step-d.component.ts similarity index 100% rename from src/app/register2/components/step-d/step-d.component.ts rename to src/app/register/components/step-d/step-d.component.ts diff --git a/src/app/register2/pages/register/register.component.html b/src/app/register/pages/register/register.component.html similarity index 100% rename from src/app/register2/pages/register/register.component.html rename to src/app/register/pages/register/register.component.html diff --git a/src/app/register2/pages/register/register.component.scss b/src/app/register/pages/register/register.component.scss similarity index 100% rename from src/app/register2/pages/register/register.component.scss rename to src/app/register/pages/register/register.component.scss diff --git a/src/app/register2/pages/register/register.component.scss.theme.scss b/src/app/register/pages/register/register.component.scss.theme.scss similarity index 100% rename from src/app/register2/pages/register/register.component.scss.theme.scss rename to src/app/register/pages/register/register.component.scss.theme.scss diff --git a/src/app/register2/pages/register/register.component.ts b/src/app/register/pages/register/register.component.ts similarity index 100% rename from src/app/register2/pages/register/register.component.ts rename to src/app/register/pages/register/register.component.ts diff --git a/src/app/register2/register-observability.service.ts b/src/app/register/register-observability.service.ts similarity index 100% rename from src/app/register2/register-observability.service.ts rename to src/app/register/register-observability.service.ts diff --git a/src/app/register2/register-routing.module.ts b/src/app/register/register-routing.module.ts similarity index 100% rename from src/app/register2/register-routing.module.ts rename to src/app/register/register-routing.module.ts diff --git a/src/app/register2/register-state.service.spec.ts b/src/app/register/register-state.service.spec.ts similarity index 100% rename from src/app/register2/register-state.service.spec.ts rename to src/app/register/register-state.service.spec.ts diff --git a/src/app/register2/register-state.service.ts b/src/app/register/register-state.service.ts similarity index 100% rename from src/app/register2/register-state.service.ts rename to src/app/register/register-state.service.ts diff --git a/src/app/register2/register.module.ts b/src/app/register/register.module.ts similarity index 100% rename from src/app/register2/register.module.ts rename to src/app/register/register.module.ts From ef37af84222a7da174ee45247586549c4ea4ff51 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:16:44 +0200 Subject: [PATCH 5/5] rename register2 services to register --- src/app/app-routing.module.ts | 4 +- .../register/register.backend-validators.ts | 23 +- .../core/register/register.form-adapter.ts | 57 +++- .../core/register/register.service.spec.ts | 36 --- src/app/core/register/register.service.ts | 23 +- .../register2/register2.backend-validators.ts | 256 ------------------ .../core/register2/register2.form-adapter.ts | 177 ------------ src/app/core/register2/register2.service.ts | 192 ------------- .../form-anti-robots.component.spec.ts | 4 +- .../form-anti-robots.component.ts | 4 +- .../form-current-employment.component.spec.ts | 4 +- .../form-current-employment.component.ts | 8 +- .../form-notifications.component.spec.ts | 4 +- .../form-notifications.component.ts | 8 +- .../form-password.component.spec.ts | 4 +- .../form-password/form-password.component.ts | 8 +- ...rm-personal-additional-emails.component.ts | 4 +- .../form-personal.component.spec.ts | 4 +- .../form-personal/form-personal.component.ts | 8 +- .../form-terms/form-terms.component.spec.ts | 4 +- .../form-terms/form-terms.component.ts | 8 +- .../form-visibility.component.spec.ts | 4 +- .../form-visibility.component.ts | 8 +- .../components/step-a/step-a.component.ts | 4 +- .../components/step-b/step-b.component.ts | 4 +- .../components/step-c/step-c.component.ts | 4 +- .../components/step-c2/step-c2.component.ts | 4 +- .../components/step-d/step-d.component.ts | 4 +- .../pages/register/register.component.ts | 4 +- 29 files changed, 138 insertions(+), 738 deletions(-) delete mode 100644 src/app/core/register/register.service.spec.ts delete mode 100644 src/app/core/register2/register2.backend-validators.ts delete mode 100644 src/app/core/register2/register2.form-adapter.ts delete mode 100644 src/app/core/register2/register2.service.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index ae1c30bea2..7e257b1671 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -91,7 +91,7 @@ const routes: Routes = [ path: ApplicationRoutes.register, canActivateChild: [LanguageGuard, RegisterGuard], loadChildren: () => - import('./register2/register.module').then((m) => m.RegisterModule), + import('./register/register.module').then((m) => m.RegisterModule), }, { path: ApplicationRoutes.search, @@ -151,7 +151,7 @@ const routes: Routes = [ matcher: routerReactivation, canActivateChild: [LanguageGuard, RegisterGuard], loadChildren: () => - import('./register2/register.module').then((m) => m.RegisterModule), + import('./register/register.module').then((m) => m.RegisterModule), }, { path: ApplicationRoutes.selfService, diff --git a/src/app/core/register/register.backend-validators.ts b/src/app/core/register/register.backend-validators.ts index f3597f7535..d43340e885 100644 --- a/src/app/core/register/register.backend-validators.ts +++ b/src/app/core/register/register.backend-validators.ts @@ -1,15 +1,15 @@ +import { HttpClient } from '@angular/common/http' import { - UntypedFormGroup, - AsyncValidatorFn, AbstractControl, + AsyncValidatorFn, + UntypedFormGroup, ValidationErrors, } from '@angular/forms' -import { RegisterForm } from 'src/app/types/register.endpoint' -import { Constructor } from 'src/app/types' import { Observable, of } from 'rxjs' +import { catchError, map, retry } from 'rxjs/operators' +import { Constructor } from 'src/app/types' +import { RegisterForm } from 'src/app/types/register.endpoint' import { environment } from 'src/environments/environment' -import { retry, catchError, map } from 'rxjs/operators' -import { HttpClient } from '@angular/common/http' import { ErrorHandlerService } from '../error-handler/error-handler.service' interface HasHttpClientAndErrorHandler { @@ -23,7 +23,9 @@ interface HasFormAdapters { formGroupToFullRegistrationForm( StepA: UntypedFormGroup, StepB: UntypedFormGroup, - StepC: UntypedFormGroup + StepC: UntypedFormGroup, + StepC2: UntypedFormGroup, + StepD: UntypedFormGroup ): RegisterForm } @@ -160,12 +162,17 @@ export function RegisterBackendValidatorMixin< StepA: UntypedFormGroup, StepB: UntypedFormGroup, StepC: UntypedFormGroup, + StepC2: UntypedFormGroup, + StepD: UntypedFormGroup, + type?: 'shibboleth' ): Observable { const registerForm = this.formGroupToFullRegistrationForm( StepA, StepB, - StepC + StepC, + StepC2, + StepD ) return this._http .post(`${environment.API_WEB}register.json`, registerForm) diff --git a/src/app/core/register/register.form-adapter.ts b/src/app/core/register/register.form-adapter.ts index 8657261895..aa069cc955 100644 --- a/src/app/core/register/register.form-adapter.ts +++ b/src/app/core/register/register.form-adapter.ts @@ -1,7 +1,7 @@ import { UntypedFormGroup } from '@angular/forms' -import { RegisterForm } from 'src/app/types/register.endpoint' -import { Value, Visibility } from 'src/app/types/common.endpoint' import { Constructor } from 'src/app/types' +import { Value, Visibility } from 'src/app/types/common.endpoint' +import { RegisterForm } from 'src/app/types/register.endpoint' export function RegisterFormAdapterMixin>(base: T) { return class RegisterFormAdapter extends base { @@ -116,18 +116,61 @@ export function RegisterFormAdapterMixin>(base: T) { return value } + formGroupToAffiliationRegisterForm(formGroup: UntypedFormGroup) { + const value = formGroup.controls['organization'].value + const departmentName = formGroup.controls['departmentName'].value + const roleTitle = formGroup.controls['roleTitle'].value + const startDateGroup = formGroup.controls['startDateGroup'].value + + if (typeof value === 'string') { + return { affiliationName: { value } } + } else { + return { + affiliationName: { value: value.value }, + disambiguatedAffiliationSourceId: { + value: value.disambiguatedAffiliationIdentifier, + }, + orgDisambiguatedId: { + value: value.disambiguatedAffiliationIdentifier, + }, + departmentName: { value: departmentName }, + roleTitle: { value: roleTitle }, + affiliationType: { value: 'employment' }, + startDate: { + month: startDateGroup.startDateMonth, + year: startDateGroup.startDateYear, + }, + sourceId: { value: value.sourceId }, + city: { value: value.city }, + region: { value: value.region }, + country: { value: value.country }, + } + } + } + formGroupToFullRegistrationForm( StepA: UntypedFormGroup, StepB: UntypedFormGroup, - StepC: UntypedFormGroup + StepC: UntypedFormGroup, + StepC2: UntypedFormGroup, + StepD: UntypedFormGroup ): RegisterForm { - return { + const value = { ...StepA.value.personal, ...StepB.value.password, - ...StepB.value.sendOrcidNews, ...StepC.value.activitiesVisibilityDefault, - ...StepC.value.termsOfUse, - ...StepC.value.captcha, + ...StepD.value.sendOrcidNews, + ...StepD.value.termsOfUse, + ...StepD.value.captcha, + } + + if (StepC2.valid) { + return { + ...value, + ...StepC2.value.affiliations, + } + } else { + return value } } } diff --git a/src/app/core/register/register.service.spec.ts b/src/app/core/register/register.service.spec.ts deleted file mode 100644 index 06ed3590bd..0000000000 --- a/src/app/core/register/register.service.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { TestBed } from '@angular/core/testing' - -import { RegisterService } from './register.service' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { RouterTestingModule } from '@angular/router/testing' -import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog' -import { WINDOW_PROVIDERS } from '../../cdk/window' -import { PlatformInfoService } from '../../cdk/platform-info' -import { ErrorHandlerService } from '../error-handler/error-handler.service' -import { SnackbarService } from '../../cdk/snackbar/snackbar.service' -import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar' -import { Overlay } from '@angular/cdk/overlay' - -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' - -describe('RegisterService', () => { - beforeEach(() => - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, RouterTestingModule], - providers: [ - WINDOW_PROVIDERS, - PlatformInfoService, - ErrorHandlerService, - SnackbarService, - MatSnackBar, - MatDialog, - Overlay, - ], - }) - ) - - it('should be created', () => { - const service: RegisterService = TestBed.inject(RegisterService) - expect(service).toBeTruthy() - }) -}) diff --git a/src/app/core/register/register.service.ts b/src/app/core/register/register.service.ts index 98e7fa6758..26791a9293 100644 --- a/src/app/core/register/register.service.ts +++ b/src/app/core/register/register.service.ts @@ -1,8 +1,8 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { UntypedFormGroup } from '@angular/forms' -import { Observable } from 'rxjs' -import { catchError, first, map, retry, switchMap } from 'rxjs/operators' +import { Observable, throwError } from 'rxjs' +import { catchError, first, map, retry, switchMap, tap } from 'rxjs/operators' import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info' import { RequestInfoForm } from 'src/app/types' import { @@ -12,13 +12,14 @@ import { } from 'src/app/types/register.endpoint' import { environment } from 'src/environments/environment' +import { ERROR_REPORT } from 'src/app/errors' +import { objectToUrlParameters } from '../../constants' +import { ReactivationLocal } from '../../types/reactivation.local' import { ErrorHandlerService } from '../error-handler/error-handler.service' import { UserService } from '../user/user.service' import { RegisterBackendValidatorMixin } from './register.backend-validators' import { RegisterFormAdapterMixin } from './register.form-adapter' -import { ERROR_REPORT } from 'src/app/errors' -import { objectToUrlParameters } from '../../constants' -import { ReactivationLocal } from '../../types/reactivation.local' +import { EmailCategoryEndpoint } from 'src/app/types/register.email-category' // Mixing boiler plate @@ -74,10 +75,18 @@ export class RegisterService extends _RegisterServiceMixingBase { .pipe(map((form) => (this.backendRegistrationForm = form))) } + getEmailCategory(email: string): Observable { + return this._http.get( + `${environment.API_WEB}email-domain/find-category?domain=${email}` + ) + } + register( StepA: UntypedFormGroup, StepB: UntypedFormGroup, StepC: UntypedFormGroup, + StepC2: UntypedFormGroup, + StepD: UntypedFormGroup, reactivation: ReactivationLocal, requestInfoForm?: RequestInfoForm, updateUserService = true @@ -87,7 +96,9 @@ export class RegisterService extends _RegisterServiceMixingBase { const registerForm = this.formGroupToFullRegistrationForm( StepA, StepB, - StepC + StepC, + StepC2, + StepD ) this.addOauthContext(registerForm, requestInfoForm) return this._platform.get().pipe( diff --git a/src/app/core/register2/register2.backend-validators.ts b/src/app/core/register2/register2.backend-validators.ts deleted file mode 100644 index 5d730df0ad..0000000000 --- a/src/app/core/register2/register2.backend-validators.ts +++ /dev/null @@ -1,256 +0,0 @@ -import { HttpClient } from '@angular/common/http' -import { - AbstractControl, - AsyncValidatorFn, - UntypedFormGroup, - ValidationErrors, -} from '@angular/forms' -import { Observable, of } from 'rxjs' -import { catchError, map, retry } from 'rxjs/operators' -import { Constructor } from 'src/app/types' -import { RegisterForm } from 'src/app/types/register.endpoint' -import { environment } from 'src/environments/environment' -import { ErrorHandlerService } from '../error-handler/error-handler.service' - -interface HasHttpClientAndErrorHandler { - _http: HttpClient - _errorHandler: ErrorHandlerService -} - -interface HasFormAdapters { - formGroupToEmailRegisterForm(formGroup: UntypedFormGroup): RegisterForm - formGroupToPasswordRegisterForm(formGroup: UntypedFormGroup): RegisterForm - formGroupToFullRegistrationForm( - StepA: UntypedFormGroup, - StepB: UntypedFormGroup, - StepC: UntypedFormGroup, - StepC2: UntypedFormGroup, - StepD: UntypedFormGroup - ): RegisterForm -} - -export function Register2BackendValidatorMixin< - T extends Constructor ->(base: T) { - return class RegisterBackendValidator extends base { - constructor(...args: any[]) { - super(...args) - } - formInputs = { - givenNames: { - validationEndpoint: 'validateGivenNames', - }, - familyNames: { - validationEndpoint: 'validateFamilyNames', - }, - email: { - validationEndpoint: 'validateEmail', - }, - emailsAdditional: { - validationEndpoint: 'validateEmailsAdditional', - }, - passwordConfirm: { - validationEndpoint: 'validatePasswordConfirm', - }, - password: { - validationEndpoint: 'validatePassword', - }, - } - - validateRegisterValue( - controlName: string, - value: RegisterForm - ): Observable { - return this._http - .post( - environment.API_WEB + - `oauth/custom/register/${this.formInputs[controlName].validationEndpoint}.json`, - value - ) - .pipe( - retry(3), - catchError((error) => this._errorHandler.handleError(error)) - ) - } - - validateAdditionalEmailsReactivation( - value: RegisterForm - ): Observable { - return this._http - .post( - `${environment.API_WEB}reactivateAdditionalEmailsValidate.json`, - value - ) - .pipe( - retry(3), - catchError((error) => this._errorHandler.handleError(error)) - ) - } - - backendValueValidate( - controlName: 'givenNames' | 'familyNames' | 'email' | 'password' - ): AsyncValidatorFn { - return ( - control: AbstractControl - ): Observable => { - if (control.value === '') { - return of(null) - } - const value = {} - value[controlName] = { value: control.value } - - return this.validateRegisterValue(controlName, value).pipe( - map((res) => { - if (res[controlName].errors && res[controlName].errors.length > 0) { - const error = { - backendError: res[controlName].errors, - } - return error - } - return null - }) - ) - } - } - - backendAdditionalEmailsValidate(reactivate: boolean): AsyncValidatorFn { - return ( - formGroup: UntypedFormGroup - ): Observable => { - const value: RegisterForm = this.formGroupToEmailRegisterForm(formGroup) - if (!value.emailsAdditional || value.emailsAdditional.length === 0) { - return of(null) - } - - if (reactivate) { - return this.validateAdditionalEmailsReactivation(value).pipe( - map((response) => { - // Add errors to additional emails controls - return this.setFormGroupEmailErrors(response, 'backendErrors') - }) - ) - } - - return this.validateRegisterValue('emailsAdditional', value).pipe( - map((response) => { - // Add errors to additional emails controls - return this.setFormGroupEmailErrors(response, 'backendErrors') - }) - ) - } - } - - backendPasswordValidate(): AsyncValidatorFn { - return ( - formGroup: UntypedFormGroup - ): Observable => { - const value: RegisterForm = - this.formGroupToPasswordRegisterForm(formGroup) - if (value.password.value === '' || value.passwordConfirm.value === '') { - return of(null) - } - return this.validateRegisterValue('password', value).pipe( - map((response) => { - // Add errors to additional emails controls - return this.setFormGroupPasswordErrors(response, 'backendErrors') - }) - ) - } - } - - backendRegisterFormValidate( - StepA: UntypedFormGroup, - StepB: UntypedFormGroup, - StepC: UntypedFormGroup, - StepC2: UntypedFormGroup, - StepD: UntypedFormGroup, - - type?: 'shibboleth' - ): Observable { - const registerForm = this.formGroupToFullRegistrationForm( - StepA, - StepB, - StepC, - StepC2, - StepD - ) - return this._http - .post(`${environment.API_WEB}register.json`, registerForm) - .pipe( - retry(3), - catchError((error) => this._errorHandler.handleError(error)) - ) - } - - public setFormGroupEmailErrors( - registerForm: RegisterForm, - errorGroup: string - ) { - let hasErrors = false - const error = {} - error[errorGroup] = { - additionalEmails: {}, - email: [], - } - - registerForm.emailsAdditional.forEach((responseControl) => { - if (responseControl.errors && responseControl.errors.length > 0) { - hasErrors = true - error[errorGroup]['additionalEmails'][responseControl.value] = - responseControl.errors - } - }) - - if ( - registerForm.email && - registerForm.email.errors && - registerForm.email.errors.length > 0 - ) { - hasErrors = true - error[errorGroup]['email'].push({ - value: registerForm.email.value, - errors: registerForm.email.errors, - }) - } - - return hasErrors ? error : null - } - - public setFormGroupPasswordErrors( - registerForm: RegisterForm, - errorGroup: string - ) { - let hasErrors = false - const error = {} - error[errorGroup] = { - password: [], - passwordConfirm: [], - } - - if ( - registerForm.password && - registerForm.password.errors && - registerForm.password.errors.length > 0 - ) { - hasErrors = true - error[errorGroup]['password'].push({ - value: registerForm.email.value, - errors: registerForm.email.errors, - }) - } - if ( - registerForm.passwordConfirm && - registerForm.passwordConfirm.errors && - registerForm.passwordConfirm.errors.length > 0 - ) { - hasErrors = true - error[errorGroup]['passwordConfirm'].push({ - value: registerForm.passwordConfirm.value, - errors: registerForm.passwordConfirm.errors, - }) - } - - return hasErrors ? error : null - } - } -} diff --git a/src/app/core/register2/register2.form-adapter.ts b/src/app/core/register2/register2.form-adapter.ts deleted file mode 100644 index 1e0b4c7990..0000000000 --- a/src/app/core/register2/register2.form-adapter.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { UntypedFormGroup } from '@angular/forms' -import { Constructor } from 'src/app/types' -import { Value, Visibility } from 'src/app/types/common.endpoint' -import { RegisterForm } from 'src/app/types/register.endpoint' - -export function Register2FormAdapterMixin>(base: T) { - return class RegisterFormAdapter extends base { - formGroupToEmailRegisterForm(formGroup: UntypedFormGroup): RegisterForm { - let additionalEmailsValue: Value[] - if (formGroup.controls['additionalEmails']) { - const additionalEmailsControls = ( - formGroup.controls['additionalEmails'] as UntypedFormGroup - ).controls - additionalEmailsValue = Object.keys(additionalEmailsControls) - .filter((name) => additionalEmailsControls[name].value !== '') - .map((name) => { - if (additionalEmailsControls[name].value) { - return { value: additionalEmailsControls[name].value } - } - }) - } - let emailValue - if (formGroup.controls['email']) { - emailValue = formGroup.controls['email'].value - } - - const value: RegisterForm = {} - - if (emailValue) { - value['email'] = { value: emailValue } - } - if (additionalEmailsValue) { - value['emailsAdditional'] = additionalEmailsValue - } - return value - } - - formGroupToNamesRegisterForm(formGroup: UntypedFormGroup): RegisterForm { - return { - givenNames: { value: formGroup.controls['givenNames'].value }, - familyNames: { value: formGroup.controls['familyNames'].value }, - } - } - - formGroupToActivitiesVisibilityForm( - formGroup: UntypedFormGroup - ): RegisterForm { - let activitiesVisibilityDefault: Visibility - if ( - formGroup && - formGroup.controls && - formGroup.controls['activitiesVisibilityDefault'] - ) { - activitiesVisibilityDefault = { - visibility: formGroup.controls['activitiesVisibilityDefault'].value, - } - } - return { activitiesVisibilityDefault } - } - - formGroupToPasswordRegisterForm(formGroup: UntypedFormGroup): RegisterForm { - let password: Value - if (formGroup && formGroup.controls && formGroup.controls['password']) { - password = { value: formGroup.controls['password'].value } - } - let passwordConfirm: Value - if ( - formGroup && - formGroup.controls && - formGroup.controls['passwordConfirm'] - ) { - passwordConfirm = { value: formGroup.controls['passwordConfirm'].value } - } - return { password, passwordConfirm } - } - - formGroupTermsOfUseAndDataProcessedRegisterForm( - formGroup: UntypedFormGroup - ): RegisterForm { - let termsOfUse: Value - let dataProcessed: Value - if (formGroup && formGroup.controls) { - if (formGroup.controls['termsOfUse']) { - termsOfUse = { value: formGroup.controls['termsOfUse'].value } - } - if (formGroup.controls['dataProcessed']) { - dataProcessed = { value: formGroup.controls['dataProcessed'].value } - } - } - return { termsOfUse, dataProcessed } - } - - formGroupToSendOrcidNewsForm(formGroup: UntypedFormGroup) { - let sendOrcidNews: Value - if ( - formGroup && - formGroup.controls && - formGroup.controls['sendOrcidNews'] - ) { - sendOrcidNews = { value: formGroup.controls['sendOrcidNews'].value } - } - return { sendOrcidNews } - } - - formGroupToRecaptchaForm( - formGroup: UntypedFormGroup, - widgetId: number - ): RegisterForm { - const value: RegisterForm = {} - value.grecaptchaWidgetId = { - value: widgetId != null ? widgetId.toString() : null, - } - if (formGroup && formGroup.controls && formGroup.controls['captcha']) { - value.grecaptcha = { value: formGroup.controls['captcha'].value } - } - return value - } - - formGroupToAffiliationRegisterForm(formGroup: UntypedFormGroup) { - const value = formGroup.controls['organization'].value - const departmentName = formGroup.controls['departmentName'].value - const roleTitle = formGroup.controls['roleTitle'].value - const startDateGroup = formGroup.controls['startDateGroup'].value - - if (typeof value === 'string') { - return { affiliationName: { value } } - } else { - return { - affiliationName: { value: value.value }, - disambiguatedAffiliationSourceId: { - value: value.disambiguatedAffiliationIdentifier, - }, - orgDisambiguatedId: { - value: value.disambiguatedAffiliationIdentifier, - }, - departmentName: { value: departmentName }, - roleTitle: { value: roleTitle }, - affiliationType: { value: 'employment' }, - startDate: { - month: startDateGroup.startDateMonth, - year: startDateGroup.startDateYear, - }, - sourceId: { value: value.sourceId }, - city: { value: value.city }, - region: { value: value.region }, - country: { value: value.country }, - } - } - } - - formGroupToFullRegistrationForm( - StepA: UntypedFormGroup, - StepB: UntypedFormGroup, - StepC: UntypedFormGroup, - StepC2: UntypedFormGroup, - StepD: UntypedFormGroup - ): RegisterForm { - const value = { - ...StepA.value.personal, - ...StepB.value.password, - ...StepC.value.activitiesVisibilityDefault, - ...StepD.value.sendOrcidNews, - ...StepD.value.termsOfUse, - ...StepD.value.captcha, - } - - if (StepC2.valid) { - return { - ...value, - ...StepC2.value.affiliations, - } - } else { - return value - } - } - } -} diff --git a/src/app/core/register2/register2.service.ts b/src/app/core/register2/register2.service.ts deleted file mode 100644 index 627e8ed9bb..0000000000 --- a/src/app/core/register2/register2.service.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { HttpClient } from '@angular/common/http' -import { Injectable } from '@angular/core' -import { UntypedFormGroup } from '@angular/forms' -import { Observable, throwError } from 'rxjs' -import { catchError, first, map, retry, switchMap, tap } from 'rxjs/operators' -import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info' -import { RequestInfoForm } from 'src/app/types' -import { - DuplicatedName, - RegisterConfirmResponse, - RegisterForm, -} from 'src/app/types/register.endpoint' -import { environment } from 'src/environments/environment' - -import { ERROR_REPORT } from 'src/app/errors' -import { objectToUrlParameters } from '../../constants' -import { ReactivationLocal } from '../../types/reactivation.local' -import { ErrorHandlerService } from '../error-handler/error-handler.service' -import { UserService } from '../user/user.service' -import { Register2BackendValidatorMixin } from './register2.backend-validators' -import { Register2FormAdapterMixin } from './register2.form-adapter' -import { EmailCategoryEndpoint } from 'src/app/types/register.email-category' - -// Mixing boiler plate - -class Register2ServiceBase { - constructor( - public _http: HttpClient, - public _errorHandler: ErrorHandlerService - ) {} -} -const _RegisterServiceMixingBase = Register2BackendValidatorMixin( - Register2FormAdapterMixin(Register2ServiceBase) -) - -@Injectable({ - providedIn: 'root', -}) -export class Register2Service extends _RegisterServiceMixingBase { - backendRegistrationForm: RegisterForm - - constructor( - _http: HttpClient, - _errorHandler: ErrorHandlerService, - private _userService: UserService, - private _platform: PlatformInfoService - ) { - super(_http, _errorHandler) - } - - public checkDuplicatedResearcher(names: { - familyNames: string - givenNames: string - }) { - return this._http - .get(environment.API_WEB + `dupicateResearcher.json`, { - params: names, - withCredentials: true, - }) - .pipe( - retry(3), - catchError((error) => this._errorHandler.handleError(error)) - ) - } - - getRegisterForm(): Observable { - return this._http - .get(`${environment.API_WEB}register.json`, { - withCredentials: true, - }) - .pipe( - retry(3), - catchError((error) => this._errorHandler.handleError(error)) - ) - .pipe(map((form) => (this.backendRegistrationForm = form))) - } - - getEmailCategory(email: string): Observable { - return this._http.get( - `${environment.API_WEB}email-domain/find-category?domain=${email}` - ) - } - - register( - StepA: UntypedFormGroup, - StepB: UntypedFormGroup, - StepC: UntypedFormGroup, - StepC2: UntypedFormGroup, - StepD: UntypedFormGroup, - reactivation: ReactivationLocal, - requestInfoForm?: RequestInfoForm, - updateUserService = true - ): Observable { - this.backendRegistrationForm.valNumClient = - this.backendRegistrationForm.valNumServer / 2 - const registerForm = this.formGroupToFullRegistrationForm( - StepA, - StepB, - StepC, - StepC2, - StepD - ) - this.addOauthContext(registerForm, requestInfoForm) - return this._platform.get().pipe( - first(), - switchMap((platform) => { - let url = `${environment.API_WEB}` - if ( - platform.institutional || - platform.queryParameters.linkType === 'shibboleth' - ) { - url += `shibboleth/` - } - if (reactivation.isReactivation) { - url += `reactivationConfirm.json?${objectToUrlParameters( - platform.queryParameters - )}` - registerForm.resetParams = reactivation.reactivationCode - } else { - url += `registerConfirm.json?${objectToUrlParameters( - platform.queryParameters - )}` - } - - const registerFormWithTypeContext = this.addCreationTypeContext( - platform, - registerForm - ) - - return this._http - .post( - url, - Object.assign( - this.backendRegistrationForm, - registerFormWithTypeContext - ) - ) - .pipe( - retry(3), - catchError((error) => - this._errorHandler.handleError(error, ERROR_REPORT.REGISTER) - ), - switchMap((value) => { - return this._userService.refreshUserSession(true, true).pipe( - first(), - map((userStatus) => { - if (!userStatus.loggedIn && !value.errors) { - // sanity check the user should be logged - // sanity check the user should be logged - this._errorHandler.handleError( - new Error('registerSanityIssue'), - ERROR_REPORT.REGISTER - ) - } - return value - }) - ) - }) - ) - }) - ) - } - - addOauthContext( - registerForm: RegisterForm, - requestInfoForm?: RequestInfoForm - ): void { - if (requestInfoForm) { - registerForm.referredBy = { value: requestInfoForm.clientId } - } - } - addCreationTypeContext( - platform: PlatformInfo, - registerForm: RegisterForm - ): RegisterForm { - /// TODO @leomendoza123 depend only on the user session thirty party login data - /// avoid taking data from the the parameters. - if ( - platform.social || - platform.queryParameters.providerId === 'facebook' || - platform.queryParameters.providerId === 'google' - ) { - registerForm.linkType = 'social' - return registerForm - } else if (platform.institutional || platform.queryParameters.providerId) { - registerForm.linkType = 'shibboleth' - return registerForm - } else { - return registerForm - } - } -} diff --git a/src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts b/src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts index 5b64b57dbc..16717e0a8f 100644 --- a/src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts +++ b/src/app/register/components/form-anti-robots/form-anti-robots.component.spec.ts @@ -10,7 +10,7 @@ import { PlatformInfoService } from '../../../cdk/platform-info' import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' import { WINDOW_PROVIDERS } from '../../../cdk/window' import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { Register2Service } from '../../../core/register2/register2.service' +import { RegisterService } from '../../../core/register/register.service' import { FormAntiRobotsComponent } from './form-anti-robots.component' import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' @@ -25,7 +25,7 @@ describe('FormAntiRobotsComponent', () => { declarations: [FormAntiRobotsComponent], providers: [ WINDOW_PROVIDERS, - Register2Service, + RegisterService, ErrorStateMatcher, PlatformInfoService, ErrorHandlerService, diff --git a/src/app/register/components/form-anti-robots/form-anti-robots.component.ts b/src/app/register/components/form-anti-robots/form-anti-robots.component.ts index 7c9a67ad70..7ddd4163df 100644 --- a/src/app/register/components/form-anti-robots/form-anti-robots.component.ts +++ b/src/app/register/components/form-anti-robots/form-anti-robots.component.ts @@ -9,7 +9,7 @@ import { } from '@angular/forms' import { ErrorStateMatcher } from '@angular/material/core' import { merge, Subject } from 'rxjs' -import { Register2Service } from 'src/app/core/register2/register2.service' +import { RegisterService } from 'src/app/core/register/register.service' import { BaseForm } from '../BaseForm' import { RegisterStateService } from '../../register-state.service' @@ -50,7 +50,7 @@ export class FormAntiRobotsComponent extends BaseForm implements OnInit { } constructor( - private _register: Register2Service, + private _register: RegisterService, private _registerStateService: RegisterStateService ) { super() diff --git a/src/app/register/components/form-current-employment/form-current-employment.component.spec.ts b/src/app/register/components/form-current-employment/form-current-employment.component.spec.ts index c3ded611a2..1a81cdd8d3 100644 --- a/src/app/register/components/form-current-employment/form-current-employment.component.spec.ts +++ b/src/app/register/components/form-current-employment/form-current-employment.component.spec.ts @@ -11,7 +11,7 @@ import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' import { WINDOW_PROVIDERS } from '../../../cdk/window' import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' import { ReactivationService } from '../../../core/reactivation/reactivation.service' -import { Register2Service } from '../../../core/register2/register2.service' +import { RegisterService } from '../../../core/register/register.service' import { FormCurrentEmploymentComponent } from './form-current-employment.component' import { MatLegacyAutocomplete, @@ -38,7 +38,7 @@ describe('FormPersonalComponent', () => { providers: [ WINDOW_PROVIDERS, ReactivationService, - Register2Service, + RegisterService, PlatformInfoService, ErrorHandlerService, SnackbarService, diff --git a/src/app/register/components/form-current-employment/form-current-employment.component.ts b/src/app/register/components/form-current-employment/form-current-employment.component.ts index 67576ba86b..1074342eb0 100644 --- a/src/app/register/components/form-current-employment/form-current-employment.component.ts +++ b/src/app/register/components/form-current-employment/form-current-employment.component.ts @@ -18,7 +18,7 @@ import { ValidatorFn, Validators, } from '@angular/forms' -import { Register2Service } from 'src/app/core/register2/register2.service' +import { RegisterService } from 'src/app/core/register/register.service' import { OrcidValidators } from 'src/app/validators' import { first, switchMap, takeUntil, tap } from 'rxjs/operators' @@ -60,8 +60,8 @@ export class MyErrorStateMatcher implements ErrorStateMatcher { styleUrls: [ './form-current-employment.component.scss', './form-current-employment.component.scss-theme.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], preserveWhitespaces: true, providers: [ @@ -126,7 +126,7 @@ export class FormCurrentEmploymentComponent isMobile: boolean rorId: string = 'https://ror.org/036mest28' constructor( - private _register: Register2Service, + private _register: RegisterService, private _platform: PlatformInfoService, private _liveAnnouncer: LiveAnnouncer, private _recordAffiliationService: RecordAffiliationService, diff --git a/src/app/register/components/form-notifications/form-notifications.component.spec.ts b/src/app/register/components/form-notifications/form-notifications.component.spec.ts index 8734d9d3b7..9bfc7fd4fb 100644 --- a/src/app/register/components/form-notifications/form-notifications.component.spec.ts +++ b/src/app/register/components/form-notifications/form-notifications.component.spec.ts @@ -9,7 +9,7 @@ import { PlatformInfoService } from '../../../cdk/platform-info' import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' import { WINDOW_PROVIDERS } from '../../../cdk/window' import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { Register2Service } from '../../../core/register2/register2.service' +import { RegisterService } from '../../../core/register/register.service' import { FormNotificationsComponent } from './form-notifications.component' import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' @@ -31,7 +31,7 @@ describe('FormNotificationsComponent', () => { declarations: [FormNotificationsComponent], providers: [ WINDOW_PROVIDERS, - Register2Service, + RegisterService, PlatformInfoService, ErrorHandlerService, SnackbarService, diff --git a/src/app/register/components/form-notifications/form-notifications.component.ts b/src/app/register/components/form-notifications/form-notifications.component.ts index edbfad6e43..e14290ea65 100644 --- a/src/app/register/components/form-notifications/form-notifications.component.ts +++ b/src/app/register/components/form-notifications/form-notifications.component.ts @@ -7,7 +7,7 @@ import { Validators, } from '@angular/forms' -import { Register2Service } from 'src/app/core/register2/register2.service' +import { RegisterService } from 'src/app/core/register/register.service' import { BaseForm } from '../BaseForm' @Component({ @@ -15,8 +15,8 @@ import { BaseForm } from '../BaseForm' templateUrl: './form-notifications.component.html', styleUrls: [ './form-notifications.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], providers: [ { @@ -32,7 +32,7 @@ import { BaseForm } from '../BaseForm' ], }) export class FormNotificationsComponent extends BaseForm implements OnInit { - constructor(private _register: Register2Service) { + constructor(private _register: RegisterService) { super() } ngOnInit() { diff --git a/src/app/register/components/form-password/form-password.component.spec.ts b/src/app/register/components/form-password/form-password.component.spec.ts index b4c5282752..ac6452f154 100644 --- a/src/app/register/components/form-password/form-password.component.spec.ts +++ b/src/app/register/components/form-password/form-password.component.spec.ts @@ -14,7 +14,7 @@ import { MdePopoverModule } from '../../../cdk/popover' import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' import { WINDOW_PROVIDERS } from '../../../cdk/window' import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { Register2Service } from '../../../core/register2/register2.service' +import { RegisterService } from '../../../core/register/register.service' import { FormPasswordComponent } from './form-password.component' import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' @@ -37,7 +37,7 @@ describe('FormPasswordComponent', () => { { provide: MatDialogRef, useValue: {} }, { provide: MAT_DIALOG_DATA, useValue: {} }, WINDOW_PROVIDERS, - Register2Service, + RegisterService, PlatformInfoService, ErrorHandlerService, SnackbarService, diff --git a/src/app/register/components/form-password/form-password.component.ts b/src/app/register/components/form-password/form-password.component.ts index 2485228992..7bfe8c105c 100644 --- a/src/app/register/components/form-password/form-password.component.ts +++ b/src/app/register/components/form-password/form-password.component.ts @@ -16,7 +16,7 @@ import { Validators, } from '@angular/forms' import { HAS_LETTER_OR_SYMBOL, HAS_NUMBER } from 'src/app/constants' -import { Register2Service } from 'src/app/core/register2/register2.service' +import { RegisterService } from 'src/app/core/register/register.service' import { RegisterForm } from 'src/app/types/register.endpoint' import { OrcidValidators } from 'src/app/validators' @@ -34,8 +34,8 @@ import { takeUntil } from 'rxjs/operators' styleUrls: [ './form-password.component.scss-theme.scss', './form-password.component.scss', - '../register2.scss-theme.scss', - '../register2.style.scss', + '../register.scss-theme.scss', + '../register.style.scss', ], providers: [ { @@ -80,7 +80,7 @@ export class FormPasswordComponent _currentAccesibilityError: string destroy = new Subject() constructor( - private _register: Register2Service, + private _register: RegisterService, private _liveAnnouncer: LiveAnnouncer, private _changeDetectorRef: ChangeDetectorRef, private _registerObservability: RegisterObservabilityService, diff --git a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts index eefa8cb846..43d1a66e9f 100644 --- a/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts +++ b/src/app/register/components/form-personal-additional-emails/form-personal-additional-emails.component.ts @@ -21,8 +21,8 @@ import { ErrorStateMatcherForFormLevelErrors } from '../../ErrorStateMatcherForF templateUrl: './form-personal-additional-emails.component.html', styleUrls: [ './form-personal-additional-emails.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], }) export class FormPersonalAdditionalEmailsComponent implements AfterViewInit { diff --git a/src/app/register/components/form-personal/form-personal.component.spec.ts b/src/app/register/components/form-personal/form-personal.component.spec.ts index 8cfe5e01e3..08f601792a 100644 --- a/src/app/register/components/form-personal/form-personal.component.spec.ts +++ b/src/app/register/components/form-personal/form-personal.component.spec.ts @@ -11,7 +11,7 @@ import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' import { WINDOW_PROVIDERS } from '../../../cdk/window' import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' import { ReactivationService } from '../../../core/reactivation/reactivation.service' -import { Register2Service } from '../../../core/register2/register2.service' +import { RegisterService } from '../../../core/register/register.service' import { FormPersonalComponent } from './form-personal.component' import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' @@ -27,7 +27,7 @@ describe('FormPersonalComponent', () => { providers: [ WINDOW_PROVIDERS, ReactivationService, - Register2Service, + RegisterService, PlatformInfoService, ErrorHandlerService, SnackbarService, diff --git a/src/app/register/components/form-personal/form-personal.component.ts b/src/app/register/components/form-personal/form-personal.component.ts index c9a7b3e3fc..c77da05083 100644 --- a/src/app/register/components/form-personal/form-personal.component.ts +++ b/src/app/register/components/form-personal/form-personal.component.ts @@ -20,7 +20,7 @@ import { ValidatorFn, Validators, } from '@angular/forms' -import { Register2Service } from 'src/app/core/register2/register2.service' +import { RegisterService } from 'src/app/core/register/register.service' import { OrcidValidators } from 'src/app/validators' import { @@ -73,8 +73,8 @@ export class MyErrorStateMatcher implements ErrorStateMatcher { templateUrl: './form-personal.component.html', styleUrls: [ './form-personal.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], preserveWhitespaces: true, providers: [ @@ -114,7 +114,7 @@ export class FormPersonalComponent destroy = new Subject() constructor( - private _register: Register2Service, + private _register: RegisterService, private _reactivationService: ReactivationService, private _platform: PlatformInfoService, private _router: Router, diff --git a/src/app/register/components/form-terms/form-terms.component.spec.ts b/src/app/register/components/form-terms/form-terms.component.spec.ts index eebdb88b4d..de1d40d1eb 100644 --- a/src/app/register/components/form-terms/form-terms.component.spec.ts +++ b/src/app/register/components/form-terms/form-terms.component.spec.ts @@ -9,7 +9,7 @@ import { PlatformInfoService } from '../../../cdk/platform-info' import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' import { WINDOW_PROVIDERS } from '../../../cdk/window' import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { Register2Service } from '../../../core/register2/register2.service' +import { RegisterService } from '../../../core/register/register.service' import { FormTermsComponent } from './form-terms.component' import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' @@ -24,7 +24,7 @@ describe('FormTermsComponent', () => { declarations: [FormTermsComponent], providers: [ WINDOW_PROVIDERS, - Register2Service, + RegisterService, PlatformInfoService, ErrorHandlerService, SnackbarService, diff --git a/src/app/register/components/form-terms/form-terms.component.ts b/src/app/register/components/form-terms/form-terms.component.ts index 4dd9ed5132..c739726712 100644 --- a/src/app/register/components/form-terms/form-terms.component.ts +++ b/src/app/register/components/form-terms/form-terms.component.ts @@ -7,7 +7,7 @@ import { Validators, } from '@angular/forms' import { ErrorStateMatcher } from '@angular/material/core' -import { Register2Service } from 'src/app/core/register2/register2.service' +import { RegisterService } from 'src/app/core/register/register.service' import { environment } from 'src/environments/environment' import { BaseForm } from '../BaseForm' @@ -18,8 +18,8 @@ import { RegisterStateService } from '../../register-state.service' templateUrl: './form-terms.component.html', styleUrls: [ './form-terms.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], providers: [ { @@ -40,7 +40,7 @@ export class FormTermsComponent extends BaseForm implements OnInit, DoCheck { nextButtonWasClicked: boolean environment = environment constructor( - private _register: Register2Service, + private _register: RegisterService, private _errorStateMatcher: ErrorStateMatcher, private _registerStateService: RegisterStateService ) { diff --git a/src/app/register/components/form-visibility/form-visibility.component.spec.ts b/src/app/register/components/form-visibility/form-visibility.component.spec.ts index 22745949f6..898eea1391 100644 --- a/src/app/register/components/form-visibility/form-visibility.component.spec.ts +++ b/src/app/register/components/form-visibility/form-visibility.component.spec.ts @@ -9,7 +9,7 @@ import { PlatformInfoService } from '../../../cdk/platform-info' import { SnackbarService } from '../../../cdk/snackbar/snackbar.service' import { WINDOW_PROVIDERS } from '../../../cdk/window' import { ErrorHandlerService } from '../../../core/error-handler/error-handler.service' -import { Register2Service } from '../../../core/register2/register2.service' +import { RegisterService } from '../../../core/register/register.service' import { FormVisibilityComponent } from './form-visibility.component' import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' @@ -24,7 +24,7 @@ describe('FormVisibilityComponent', () => { declarations: [FormVisibilityComponent], providers: [ WINDOW_PROVIDERS, - Register2Service, + RegisterService, PlatformInfoService, ErrorHandlerService, SnackbarService, diff --git a/src/app/register/components/form-visibility/form-visibility.component.ts b/src/app/register/components/form-visibility/form-visibility.component.ts index c1cb29ed26..3af68bf88b 100644 --- a/src/app/register/components/form-visibility/form-visibility.component.ts +++ b/src/app/register/components/form-visibility/form-visibility.component.ts @@ -14,7 +14,7 @@ import { } from '@angular/forms' import { ErrorStateMatcher } from '@angular/material/core' import { VISIBILITY_OPTIONS } from 'src/app/constants' -import { Register2Service } from 'src/app/core/register2/register2.service' +import { RegisterService } from 'src/app/core/register/register.service' import { BaseForm } from '../BaseForm' import { RegisterStateService } from '../../register-state.service' @@ -27,8 +27,8 @@ import { takeUntil } from 'rxjs/operators' templateUrl: './form-visibility.component.html', styleUrls: [ './form-visibility.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], preserveWhitespaces: true, providers: [ @@ -54,7 +54,7 @@ export class FormVisibilityComponent activitiesVisibilityDefault = new UntypedFormControl('', Validators.required) destroy = new Subject() constructor( - private _register: Register2Service, + private _register: RegisterService, private _errorStateMatcher: ErrorStateMatcher, private _registerStateService: RegisterStateService, private _registerObservability: RegisterObservabilityService diff --git a/src/app/register/components/step-a/step-a.component.ts b/src/app/register/components/step-a/step-a.component.ts index b6a4dc9f40..67863306a4 100644 --- a/src/app/register/components/step-a/step-a.component.ts +++ b/src/app/register/components/step-a/step-a.component.ts @@ -22,8 +22,8 @@ import { RegisterObservabilityService } from '../../register-observability.servi templateUrl: './step-a.component.html', styleUrls: [ './step-a.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], preserveWhitespaces: true, }) diff --git a/src/app/register/components/step-b/step-b.component.ts b/src/app/register/components/step-b/step-b.component.ts index 03cc0971a1..94a6c894e3 100644 --- a/src/app/register/components/step-b/step-b.component.ts +++ b/src/app/register/components/step-b/step-b.component.ts @@ -10,8 +10,8 @@ import { RegisterObservabilityService } from '../../register-observability.servi templateUrl: './step-b.component.html', styleUrls: [ './step-b.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], }) export class StepBComponent extends BaseStepDirective implements OnInit { diff --git a/src/app/register/components/step-c/step-c.component.ts b/src/app/register/components/step-c/step-c.component.ts index 66abd4b3fc..0905f31c1b 100644 --- a/src/app/register/components/step-c/step-c.component.ts +++ b/src/app/register/components/step-c/step-c.component.ts @@ -10,8 +10,8 @@ import { RegisterObservabilityService } from '../../register-observability.servi templateUrl: './step-c.component.html', styleUrls: [ './step-c.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], }) export class StepCComponent extends BaseStepDirective implements OnInit { diff --git a/src/app/register/components/step-c2/step-c2.component.ts b/src/app/register/components/step-c2/step-c2.component.ts index 1e679c8310..45e37cc0a4 100644 --- a/src/app/register/components/step-c2/step-c2.component.ts +++ b/src/app/register/components/step-c2/step-c2.component.ts @@ -11,8 +11,8 @@ import { RegisterObservabilityService } from '../../register-observability.servi templateUrl: './step-c2.component.html', styleUrls: [ './step-c2.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], }) export class StepC2Component extends BaseStepDirective implements OnInit { diff --git a/src/app/register/components/step-d/step-d.component.ts b/src/app/register/components/step-d/step-d.component.ts index 5263881dda..3540cb5bf2 100644 --- a/src/app/register/components/step-d/step-d.component.ts +++ b/src/app/register/components/step-d/step-d.component.ts @@ -10,8 +10,8 @@ import { RegisterObservabilityService } from '../../register-observability.servi templateUrl: './step-d.component.html', styleUrls: [ './step-d.component.scss', - '../register2.style.scss', - '../register2.scss-theme.scss', + '../register.style.scss', + '../register.scss-theme.scss', ], }) export class StepDComponent extends BaseStepDirective { diff --git a/src/app/register/pages/register/register.component.ts b/src/app/register/pages/register/register.component.ts index b0569f80b7..3158896bba 100644 --- a/src/app/register/pages/register/register.component.ts +++ b/src/app/register/pages/register/register.component.ts @@ -18,7 +18,7 @@ import { WINDOW } from 'src/app/cdk/window' import { isRedirectToTheAuthorizationPage } from 'src/app/constants' import { UserService } from 'src/app/core' import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service' -import { Register2Service } from 'src/app/core/register2/register2.service' +import { RegisterService } from 'src/app/core/register/register.service' import { ERROR_REPORT } from 'src/app/errors' import { RequestInfoForm } from 'src/app/types' import { @@ -76,7 +76,7 @@ export class RegisterComponent implements OnInit, AfterViewInit { private _cdref: ChangeDetectorRef, private _platformInfo: PlatformInfoService, private _formBuilder: UntypedFormBuilder, - private _register: Register2Service, + private _register: RegisterService, @Inject(WINDOW) private window: Window, private _googleTagManagerService: GoogleTagManagerService, private _router: Router,