From 921d46c75239567d650446baca6039a99f183408 Mon Sep 17 00:00:00 2001 From: Leonardo Mendoza Date: Tue, 28 Jan 2025 13:59:21 -0600 Subject: [PATCH] 9562-implement-dynamic-environment-variable-loading-for-single-artifact-deployment --- .gitignore | 2 +- angular.json | 52 +------ documentation.json | 132 +++++++++--------- package.json | 2 +- .../runtime-environment-setter.dev-runtime.ts | 3 +- scripts/utils.ts | 11 +- ...s-duplicated-merged-confirmed.component.ts | 2 - .../dialog-actions-duplicated.component.ts | 2 - .../settings-defaults-language.component.ts | 1 - .../settings-sharing-html-code.component.ts | 1 - ...ed-individuals-your-own-email.component.ts | 1 - ...ialog-add-trusted-individuals.component.ts | 1 - ...og-revoke-trusted-individuals.component.ts | 3 - ...gs-trusted-individuals-search.component.ts | 1 - .../settings-trusted-individuals.component.ts | 1 - ...ettings-users-that-thrust-you.component.ts | 1 - src/app/app.module.ts | 3 +- .../form-authorize.component.ts | 3 +- src/app/cdk/recaptcha/recaptcha.directive.ts | 1 - .../side-bar-id/side-bar-id.component.ts | 3 +- src/app/cdk/snackbar/snackbar.service.ts | 1 - src/app/constants.ts | 1 - .../account-actions-deactivate.service.ts | 1 - .../account-actions-download.service.ts | 1 - .../account-actions-duplicated.service.ts | 1 - ...count-default-email-frequencies.service.ts | 1 - .../account-default-visibility.service.ts | 1 - ...ount-security-alternate-sign-in.service.ts | 1 - .../account-security-password.service.ts | 1 - .../account-trusted-individuals.service.ts | 1 - .../account-trusted-organizations.service.ts | 2 - src/app/core/announcer/announcer.service.ts | 1 - .../canonocal-url/canonocal-url.service.ts | 1 - .../developer-tools.service.ts | 1 - src/app/core/help-hero/help-hero.service.ts | 1 - src/app/core/inbox/inbox.service.ts | 1 - src/app/core/language/language.service.ts | 1 - src/app/core/news/news.service.ts | 1 - .../observability-events.service.ts | 1 - src/app/core/open-graph/open-graph.service.ts | 1 - .../password-recovery.service.ts | 1 - .../record-affiliations.service.ts | 1 - .../record-countries.service.ts | 1 - .../record-emails/record-emails.service.ts | 1 - .../record-fundings.service.ts | 1 - .../record-person/record-person.service.ts | 2 +- .../record-person-identifier.service.ts | 2 +- .../record-public-side-bar.service.ts | 2 +- .../core/record-works/record-works.service.ts | 2 +- src/app/core/record/record.service.ts | 1 - .../register/register.backend-validators.ts | 2 +- src/app/core/register/register.service.ts | 2 +- .../register2/register2.backend-validators.ts | 2 +- src/app/core/register2/register2.service.ts | 2 +- .../robots-meta-tags.service.ts | 2 +- src/app/core/search/search.service.ts | 2 +- src/app/core/togglz/togglz.service.ts | 2 +- .../trusted-individuals.service.ts | 2 +- .../trusted-summary.service.ts | 2 +- src/app/core/user-info/user-info.service.ts | 2 +- src/app/core/user/user.service.ts | 2 +- .../core/wordpress/wordpress.service.spec.ts | 2 +- src/app/core/wordpress/wordpress.service.ts | 2 +- .../developer-tools.component.ts | 2 +- .../environment-banner.component.ts | 3 +- src/app/guards/language.guard.ts | 2 +- .../home/components/news/news.component.ts | 2 +- src/app/home/pages/home/home.component.ts | 2 +- .../institutional/institutional.component.ts | 1 - src/app/layout/banners/banners.component.ts | 4 +- src/app/layout/language/language.component.ts | 2 +- .../layout/user-menu/user-menu.component.ts | 2 +- .../modal-peer-reviews.component.ts | 1 - .../record-header/record-header.component.ts | 4 +- .../record-info/record-info.component.ts | 2 +- .../search-link-wizard.component.ts | 1 - .../top-bar-actions.component.ts | 1 - .../top-bar-record-issues.component.ts | 2 +- .../work-contributors.component.ts | 2 +- .../pages/my-orcid/my-orcid.component.ts | 2 +- .../form-terms/form-terms.component.ts | 2 +- .../components/step-a/step-a.component.ts | 2 +- .../form-password/form-password.component.ts | 2 +- .../form-personal/form-personal.component.ts | 2 +- .../form-terms/form-terms.component.ts | 4 +- .../components/step-a/step-a.component.ts | 2 +- .../logged-in/logged-in.component.ts | 2 +- .../components/social/social.component.ts | 4 - .../two-factor-enable.component.ts | 3 +- src/environments/environment.int.ts | 2 +- ...ith-proxy.ts => environment.local.4200.ts} | 2 +- ....ts => environment.local.dev.orcid.org.ts} | 2 +- src/environments/environment.production.ts | 2 +- src/environments/environment.qa.ts | 2 +- src/environments/environment.sandbox.ts | 2 +- src/environments/environment.ts | 2 +- .../{global-environment.d.ts => index.d.ts} | 3 +- src/main.ts | 2 +- 98 files changed, 135 insertions(+), 229 deletions(-) rename src/environments/{environment.local-with-proxy.ts => environment.local.4200.ts} (95%) rename src/environments/{environment.local.ts => environment.local.dev.orcid.org.ts} (95%) rename src/environments/{global-environment.d.ts => index.d.ts} (96%) diff --git a/.gitignore b/.gitignore index f8b6f2d5e4..8588024efc 100644 --- a/.gitignore +++ b/.gitignore @@ -77,4 +77,4 @@ cypress/plugins/token.json # Packages ignore package-lock to depend only on yarn package-lock.json -src/assets/local-dev-environment.js +src/assets/runtime-environment.js diff --git a/angular.json b/angular.json index 5ef705724d..e1664f30a5 100644 --- a/angular.json +++ b/angular.json @@ -133,13 +133,7 @@ "src/styles.scss", "src/assets/scss/grid.scss" ], - "scripts": ["src/assets/local-dev-environment.js"], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.local.ts" - } - ] + "scripts": ["src/assets/runtime-environment.js"] }, "configurations": { "local": { @@ -172,12 +166,6 @@ "type": "anyComponentStyle", "maximumWarning": "6kb" } - ], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.local-with-proxy.ts" - } ] }, "local-with-proxy-localize-en": { @@ -195,40 +183,16 @@ "type": "anyComponentStyle", "maximumWarning": "6kb" } - ], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.local-with-proxy.ts" - } ] }, "local-with-proxy-localize-fr": { - "localize": ["fr"], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.local-with-proxy.ts" - } - ] + "localize": ["fr"] }, "local-with-proxy-localize-ar": { - "localize": ["ar"], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.local-with-proxy.ts" - } - ] + "localize": ["ar"] }, "local-with-proxy-localize-xx": { - "localize": ["xx"], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.local-with-proxy.ts" - } - ] + "localize": ["xx"] }, "production": { "budgets": [ @@ -236,12 +200,6 @@ "type": "anyComponentStyle", "maximumWarning": "6kb" } - ], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.production.ts" - } ] }, "en": { @@ -412,7 +370,7 @@ "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.scss" ], - "scripts": ["src/assets/local-dev-environment.js"], + "scripts": ["src/assets/runtime-environment.js"], "assets": ["src/favicon.ico", "src/assets", "src/manifest.json"], "sourceMap": true } diff --git a/documentation.json b/documentation.json index 0a17b539ad..dd7d7db15c 100644 --- a/documentation.json +++ b/documentation.json @@ -6185,7 +6185,7 @@ "deprecated": false, "deprecationMessage": "", "type": "interface", - "sourceCode": "import {\n UntypedFormGroup,\n AsyncValidatorFn,\n AbstractControl,\n ValidationErrors,\n} from '@angular/forms'\nimport { RegisterForm } from 'src/app/types/register.endpoint'\nimport { Constructor } from 'src/app/types'\nimport { Observable, of } from 'rxjs'\nimport { environment } from 'src/environments/environment'\nimport { retry, catchError, map } from 'rxjs/operators'\nimport { HttpClient } from '@angular/common/http'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\ninterface HasHttpClientAndErrorHandler {\n _http: HttpClient\n _errorHandler: ErrorHandlerService\n}\n\ninterface HasFormAdapters {\n formGroupToEmailRegisterForm(formGroup: UntypedFormGroup): RegisterForm\n formGroupToPasswordRegisterForm(formGroup: UntypedFormGroup): RegisterForm\n formGroupToFullRegistrationForm(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup\n ): RegisterForm\n}\n\nexport function RegisterBackendValidatorMixin<\n T extends Constructor\n>(base: T) {\n return class RegisterBackendValidator extends base {\n constructor(...args: any[]) {\n super(...args)\n }\n formInputs = {\n givenNames: {\n validationEndpoint: 'validateGivenNames',\n },\n familyNames: {\n validationEndpoint: 'validateFamilyNames',\n },\n email: {\n validationEndpoint: 'validateEmail',\n },\n emailsAdditional: {\n validationEndpoint: 'validateEmailsAdditional',\n },\n passwordConfirm: {\n validationEndpoint: 'validatePasswordConfirm',\n },\n password: {\n validationEndpoint: 'validatePassword',\n },\n }\n\n validateRegisterValue(\n controlName: string,\n value: RegisterForm\n ): Observable {\n return this._http\n .post(\n environment.API_WEB +\n `oauth/custom/register/${this.formInputs[controlName].validationEndpoint}.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n validateAdditionalEmailsReactivation(\n value: RegisterForm\n ): Observable {\n return this._http\n .post(\n `${environment.API_WEB}reactivateAdditionalEmailsValidate.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n backendValueValidate(\n controlName: 'givenNames' | 'familyNames' | 'email' | 'password'\n ): AsyncValidatorFn {\n return (\n control: AbstractControl\n ): Observable => {\n if (control.value === '') {\n return of(null)\n }\n const value = {}\n value[controlName] = { value: control.value }\n\n return this.validateRegisterValue(controlName, value).pipe(\n map((res) => {\n if (res[controlName].errors && res[controlName].errors.length > 0) {\n const error = {\n backendError: res[controlName].errors,\n }\n return error\n }\n return null\n })\n )\n }\n }\n\n backendAdditionalEmailsValidate(reactivate: boolean): AsyncValidatorFn {\n return (\n formGroup: UntypedFormGroup\n ): Observable => {\n const value: RegisterForm = this.formGroupToEmailRegisterForm(formGroup)\n if (!value.emailsAdditional || value.emailsAdditional.length === 0) {\n return of(null)\n }\n\n if (reactivate) {\n return this.validateAdditionalEmailsReactivation(value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupEmailErrors(response, 'backendErrors')\n })\n )\n }\n\n return this.validateRegisterValue('emailsAdditional', value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupEmailErrors(response, 'backendErrors')\n })\n )\n }\n }\n\n backendPasswordValidate(): AsyncValidatorFn {\n return (\n formGroup: UntypedFormGroup\n ): Observable => {\n const value: RegisterForm =\n this.formGroupToPasswordRegisterForm(formGroup)\n if (value.password.value === '' || value.passwordConfirm.value === '') {\n return of(null)\n }\n return this.validateRegisterValue('password', value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupPasswordErrors(response, 'backendErrors')\n })\n )\n }\n }\n\n backendRegisterFormValidate(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup,\n type?: 'shibboleth'\n ): Observable {\n const registerForm = this.formGroupToFullRegistrationForm(\n StepA,\n StepB,\n StepC\n )\n return this._http\n .post(`${environment.API_WEB}register.json`, registerForm)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n public setFormGroupEmailErrors(\n registerForm: RegisterForm,\n errorGroup: string\n ) {\n let hasErrors = false\n const error = {}\n error[errorGroup] = {\n additionalEmails: {},\n email: [],\n }\n\n registerForm.emailsAdditional.forEach((responseControl) => {\n if (responseControl.errors && responseControl.errors.length > 0) {\n hasErrors = true\n error[errorGroup]['additionalEmails'][responseControl.value] =\n responseControl.errors\n }\n })\n\n if (\n registerForm.email &&\n registerForm.email.errors &&\n registerForm.email.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['email'].push({\n value: registerForm.email.value,\n errors: registerForm.email.errors,\n })\n }\n\n return hasErrors ? error : null\n }\n\n public setFormGroupPasswordErrors(\n registerForm: RegisterForm,\n errorGroup: string\n ) {\n let hasErrors = false\n const error = {}\n error[errorGroup] = {\n password: [],\n passwordConfirm: [],\n }\n\n if (\n registerForm.password &&\n registerForm.password.errors &&\n registerForm.password.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['password'].push({\n value: registerForm.email.value,\n errors: registerForm.email.errors,\n })\n }\n if (\n registerForm.passwordConfirm &&\n registerForm.passwordConfirm.errors &&\n registerForm.passwordConfirm.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['passwordConfirm'].push({\n value: registerForm.passwordConfirm.value,\n errors: registerForm.passwordConfirm.errors,\n })\n }\n\n return hasErrors ? error : null\n }\n }\n}\n", + "sourceCode": "import {\n UntypedFormGroup,\n AsyncValidatorFn,\n AbstractControl,\n ValidationErrors,\n} from '@angular/forms'\nimport { RegisterForm } from 'src/app/types/register.endpoint'\nimport { Constructor } from 'src/app/types'\nimport { Observable, of } from 'rxjs'\n\nimport { retry, catchError, map } from 'rxjs/operators'\nimport { HttpClient } from '@angular/common/http'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\ninterface HasHttpClientAndErrorHandler {\n _http: HttpClient\n _errorHandler: ErrorHandlerService\n}\n\ninterface HasFormAdapters {\n formGroupToEmailRegisterForm(formGroup: UntypedFormGroup): RegisterForm\n formGroupToPasswordRegisterForm(formGroup: UntypedFormGroup): RegisterForm\n formGroupToFullRegistrationForm(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup\n ): RegisterForm\n}\n\nexport function RegisterBackendValidatorMixin<\n T extends Constructor\n>(base: T) {\n return class RegisterBackendValidator extends base {\n constructor(...args: any[]) {\n super(...args)\n }\n formInputs = {\n givenNames: {\n validationEndpoint: 'validateGivenNames',\n },\n familyNames: {\n validationEndpoint: 'validateFamilyNames',\n },\n email: {\n validationEndpoint: 'validateEmail',\n },\n emailsAdditional: {\n validationEndpoint: 'validateEmailsAdditional',\n },\n passwordConfirm: {\n validationEndpoint: 'validatePasswordConfirm',\n },\n password: {\n validationEndpoint: 'validatePassword',\n },\n }\n\n validateRegisterValue(\n controlName: string,\n value: RegisterForm\n ): Observable {\n return this._http\n .post(\n environment.API_WEB +\n `oauth/custom/register/${this.formInputs[controlName].validationEndpoint}.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n validateAdditionalEmailsReactivation(\n value: RegisterForm\n ): Observable {\n return this._http\n .post(\n `${environment.API_WEB}reactivateAdditionalEmailsValidate.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n backendValueValidate(\n controlName: 'givenNames' | 'familyNames' | 'email' | 'password'\n ): AsyncValidatorFn {\n return (\n control: AbstractControl\n ): Observable => {\n if (control.value === '') {\n return of(null)\n }\n const value = {}\n value[controlName] = { value: control.value }\n\n return this.validateRegisterValue(controlName, value).pipe(\n map((res) => {\n if (res[controlName].errors && res[controlName].errors.length > 0) {\n const error = {\n backendError: res[controlName].errors,\n }\n return error\n }\n return null\n })\n )\n }\n }\n\n backendAdditionalEmailsValidate(reactivate: boolean): AsyncValidatorFn {\n return (\n formGroup: UntypedFormGroup\n ): Observable => {\n const value: RegisterForm = this.formGroupToEmailRegisterForm(formGroup)\n if (!value.emailsAdditional || value.emailsAdditional.length === 0) {\n return of(null)\n }\n\n if (reactivate) {\n return this.validateAdditionalEmailsReactivation(value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupEmailErrors(response, 'backendErrors')\n })\n )\n }\n\n return this.validateRegisterValue('emailsAdditional', value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupEmailErrors(response, 'backendErrors')\n })\n )\n }\n }\n\n backendPasswordValidate(): AsyncValidatorFn {\n return (\n formGroup: UntypedFormGroup\n ): Observable => {\n const value: RegisterForm =\n this.formGroupToPasswordRegisterForm(formGroup)\n if (value.password.value === '' || value.passwordConfirm.value === '') {\n return of(null)\n }\n return this.validateRegisterValue('password', value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupPasswordErrors(response, 'backendErrors')\n })\n )\n }\n }\n\n backendRegisterFormValidate(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup,\n type?: 'shibboleth'\n ): Observable {\n const registerForm = this.formGroupToFullRegistrationForm(\n StepA,\n StepB,\n StepC\n )\n return this._http\n .post(`${environment.API_WEB}register.json`, registerForm)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n public setFormGroupEmailErrors(\n registerForm: RegisterForm,\n errorGroup: string\n ) {\n let hasErrors = false\n const error = {}\n error[errorGroup] = {\n additionalEmails: {},\n email: [],\n }\n\n registerForm.emailsAdditional.forEach((responseControl) => {\n if (responseControl.errors && responseControl.errors.length > 0) {\n hasErrors = true\n error[errorGroup]['additionalEmails'][responseControl.value] =\n responseControl.errors\n }\n })\n\n if (\n registerForm.email &&\n registerForm.email.errors &&\n registerForm.email.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['email'].push({\n value: registerForm.email.value,\n errors: registerForm.email.errors,\n })\n }\n\n return hasErrors ? error : null\n }\n\n public setFormGroupPasswordErrors(\n registerForm: RegisterForm,\n errorGroup: string\n ) {\n let hasErrors = false\n const error = {}\n error[errorGroup] = {\n password: [],\n passwordConfirm: [],\n }\n\n if (\n registerForm.password &&\n registerForm.password.errors &&\n registerForm.password.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['password'].push({\n value: registerForm.email.value,\n errors: registerForm.email.errors,\n })\n }\n if (\n registerForm.passwordConfirm &&\n registerForm.passwordConfirm.errors &&\n registerForm.passwordConfirm.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['passwordConfirm'].push({\n value: registerForm.passwordConfirm.value,\n errors: registerForm.passwordConfirm.errors,\n })\n }\n\n return hasErrors ? error : null\n }\n }\n}\n", "properties": [], "indexSignatures": [], "kind": 170, @@ -6313,7 +6313,7 @@ "deprecated": false, "deprecationMessage": "", "type": "interface", - "sourceCode": "import {\n UntypedFormGroup,\n AsyncValidatorFn,\n AbstractControl,\n ValidationErrors,\n} from '@angular/forms'\nimport { RegisterForm } from 'src/app/types/register.endpoint'\nimport { Constructor } from 'src/app/types'\nimport { Observable, of } from 'rxjs'\nimport { environment } from 'src/environments/environment'\nimport { retry, catchError, map } from 'rxjs/operators'\nimport { HttpClient } from '@angular/common/http'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\ninterface HasHttpClientAndErrorHandler {\n _http: HttpClient\n _errorHandler: ErrorHandlerService\n}\n\ninterface HasFormAdapters {\n formGroupToEmailRegisterForm(formGroup: UntypedFormGroup): RegisterForm\n formGroupToPasswordRegisterForm(formGroup: UntypedFormGroup): RegisterForm\n formGroupToFullRegistrationForm(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup\n ): RegisterForm\n}\n\nexport function RegisterBackendValidatorMixin<\n T extends Constructor\n>(base: T) {\n return class RegisterBackendValidator extends base {\n constructor(...args: any[]) {\n super(...args)\n }\n formInputs = {\n givenNames: {\n validationEndpoint: 'validateGivenNames',\n },\n familyNames: {\n validationEndpoint: 'validateFamilyNames',\n },\n email: {\n validationEndpoint: 'validateEmail',\n },\n emailsAdditional: {\n validationEndpoint: 'validateEmailsAdditional',\n },\n passwordConfirm: {\n validationEndpoint: 'validatePasswordConfirm',\n },\n password: {\n validationEndpoint: 'validatePassword',\n },\n }\n\n validateRegisterValue(\n controlName: string,\n value: RegisterForm\n ): Observable {\n return this._http\n .post(\n environment.API_WEB +\n `oauth/custom/register/${this.formInputs[controlName].validationEndpoint}.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n validateAdditionalEmailsReactivation(\n value: RegisterForm\n ): Observable {\n return this._http\n .post(\n `${environment.API_WEB}reactivateAdditionalEmailsValidate.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n backendValueValidate(\n controlName: 'givenNames' | 'familyNames' | 'email' | 'password'\n ): AsyncValidatorFn {\n return (\n control: AbstractControl\n ): Observable => {\n if (control.value === '') {\n return of(null)\n }\n const value = {}\n value[controlName] = { value: control.value }\n\n return this.validateRegisterValue(controlName, value).pipe(\n map((res) => {\n if (res[controlName].errors && res[controlName].errors.length > 0) {\n const error = {\n backendError: res[controlName].errors,\n }\n return error\n }\n return null\n })\n )\n }\n }\n\n backendAdditionalEmailsValidate(reactivate: boolean): AsyncValidatorFn {\n return (\n formGroup: UntypedFormGroup\n ): Observable => {\n const value: RegisterForm = this.formGroupToEmailRegisterForm(formGroup)\n if (!value.emailsAdditional || value.emailsAdditional.length === 0) {\n return of(null)\n }\n\n if (reactivate) {\n return this.validateAdditionalEmailsReactivation(value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupEmailErrors(response, 'backendErrors')\n })\n )\n }\n\n return this.validateRegisterValue('emailsAdditional', value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupEmailErrors(response, 'backendErrors')\n })\n )\n }\n }\n\n backendPasswordValidate(): AsyncValidatorFn {\n return (\n formGroup: UntypedFormGroup\n ): Observable => {\n const value: RegisterForm =\n this.formGroupToPasswordRegisterForm(formGroup)\n if (value.password.value === '' || value.passwordConfirm.value === '') {\n return of(null)\n }\n return this.validateRegisterValue('password', value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupPasswordErrors(response, 'backendErrors')\n })\n )\n }\n }\n\n backendRegisterFormValidate(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup,\n type?: 'shibboleth'\n ): Observable {\n const registerForm = this.formGroupToFullRegistrationForm(\n StepA,\n StepB,\n StepC\n )\n return this._http\n .post(`${environment.API_WEB}register.json`, registerForm)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n public setFormGroupEmailErrors(\n registerForm: RegisterForm,\n errorGroup: string\n ) {\n let hasErrors = false\n const error = {}\n error[errorGroup] = {\n additionalEmails: {},\n email: [],\n }\n\n registerForm.emailsAdditional.forEach((responseControl) => {\n if (responseControl.errors && responseControl.errors.length > 0) {\n hasErrors = true\n error[errorGroup]['additionalEmails'][responseControl.value] =\n responseControl.errors\n }\n })\n\n if (\n registerForm.email &&\n registerForm.email.errors &&\n registerForm.email.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['email'].push({\n value: registerForm.email.value,\n errors: registerForm.email.errors,\n })\n }\n\n return hasErrors ? error : null\n }\n\n public setFormGroupPasswordErrors(\n registerForm: RegisterForm,\n errorGroup: string\n ) {\n let hasErrors = false\n const error = {}\n error[errorGroup] = {\n password: [],\n passwordConfirm: [],\n }\n\n if (\n registerForm.password &&\n registerForm.password.errors &&\n registerForm.password.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['password'].push({\n value: registerForm.email.value,\n errors: registerForm.email.errors,\n })\n }\n if (\n registerForm.passwordConfirm &&\n registerForm.passwordConfirm.errors &&\n registerForm.passwordConfirm.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['passwordConfirm'].push({\n value: registerForm.passwordConfirm.value,\n errors: registerForm.passwordConfirm.errors,\n })\n }\n\n return hasErrors ? error : null\n }\n }\n}\n", + "sourceCode": "import {\n UntypedFormGroup,\n AsyncValidatorFn,\n AbstractControl,\n ValidationErrors,\n} from '@angular/forms'\nimport { RegisterForm } from 'src/app/types/register.endpoint'\nimport { Constructor } from 'src/app/types'\nimport { Observable, of } from 'rxjs'\n\nimport { retry, catchError, map } from 'rxjs/operators'\nimport { HttpClient } from '@angular/common/http'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\ninterface HasHttpClientAndErrorHandler {\n _http: HttpClient\n _errorHandler: ErrorHandlerService\n}\n\ninterface HasFormAdapters {\n formGroupToEmailRegisterForm(formGroup: UntypedFormGroup): RegisterForm\n formGroupToPasswordRegisterForm(formGroup: UntypedFormGroup): RegisterForm\n formGroupToFullRegistrationForm(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup\n ): RegisterForm\n}\n\nexport function RegisterBackendValidatorMixin<\n T extends Constructor\n>(base: T) {\n return class RegisterBackendValidator extends base {\n constructor(...args: any[]) {\n super(...args)\n }\n formInputs = {\n givenNames: {\n validationEndpoint: 'validateGivenNames',\n },\n familyNames: {\n validationEndpoint: 'validateFamilyNames',\n },\n email: {\n validationEndpoint: 'validateEmail',\n },\n emailsAdditional: {\n validationEndpoint: 'validateEmailsAdditional',\n },\n passwordConfirm: {\n validationEndpoint: 'validatePasswordConfirm',\n },\n password: {\n validationEndpoint: 'validatePassword',\n },\n }\n\n validateRegisterValue(\n controlName: string,\n value: RegisterForm\n ): Observable {\n return this._http\n .post(\n environment.API_WEB +\n `oauth/custom/register/${this.formInputs[controlName].validationEndpoint}.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n validateAdditionalEmailsReactivation(\n value: RegisterForm\n ): Observable {\n return this._http\n .post(\n `${environment.API_WEB}reactivateAdditionalEmailsValidate.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n backendValueValidate(\n controlName: 'givenNames' | 'familyNames' | 'email' | 'password'\n ): AsyncValidatorFn {\n return (\n control: AbstractControl\n ): Observable => {\n if (control.value === '') {\n return of(null)\n }\n const value = {}\n value[controlName] = { value: control.value }\n\n return this.validateRegisterValue(controlName, value).pipe(\n map((res) => {\n if (res[controlName].errors && res[controlName].errors.length > 0) {\n const error = {\n backendError: res[controlName].errors,\n }\n return error\n }\n return null\n })\n )\n }\n }\n\n backendAdditionalEmailsValidate(reactivate: boolean): AsyncValidatorFn {\n return (\n formGroup: UntypedFormGroup\n ): Observable => {\n const value: RegisterForm = this.formGroupToEmailRegisterForm(formGroup)\n if (!value.emailsAdditional || value.emailsAdditional.length === 0) {\n return of(null)\n }\n\n if (reactivate) {\n return this.validateAdditionalEmailsReactivation(value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupEmailErrors(response, 'backendErrors')\n })\n )\n }\n\n return this.validateRegisterValue('emailsAdditional', value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupEmailErrors(response, 'backendErrors')\n })\n )\n }\n }\n\n backendPasswordValidate(): AsyncValidatorFn {\n return (\n formGroup: UntypedFormGroup\n ): Observable => {\n const value: RegisterForm =\n this.formGroupToPasswordRegisterForm(formGroup)\n if (value.password.value === '' || value.passwordConfirm.value === '') {\n return of(null)\n }\n return this.validateRegisterValue('password', value).pipe(\n map((response) => {\n // Add errors to additional emails controls\n return this.setFormGroupPasswordErrors(response, 'backendErrors')\n })\n )\n }\n }\n\n backendRegisterFormValidate(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup,\n type?: 'shibboleth'\n ): Observable {\n const registerForm = this.formGroupToFullRegistrationForm(\n StepA,\n StepB,\n StepC\n )\n return this._http\n .post(`${environment.API_WEB}register.json`, registerForm)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n public setFormGroupEmailErrors(\n registerForm: RegisterForm,\n errorGroup: string\n ) {\n let hasErrors = false\n const error = {}\n error[errorGroup] = {\n additionalEmails: {},\n email: [],\n }\n\n registerForm.emailsAdditional.forEach((responseControl) => {\n if (responseControl.errors && responseControl.errors.length > 0) {\n hasErrors = true\n error[errorGroup]['additionalEmails'][responseControl.value] =\n responseControl.errors\n }\n })\n\n if (\n registerForm.email &&\n registerForm.email.errors &&\n registerForm.email.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['email'].push({\n value: registerForm.email.value,\n errors: registerForm.email.errors,\n })\n }\n\n return hasErrors ? error : null\n }\n\n public setFormGroupPasswordErrors(\n registerForm: RegisterForm,\n errorGroup: string\n ) {\n let hasErrors = false\n const error = {}\n error[errorGroup] = {\n password: [],\n passwordConfirm: [],\n }\n\n if (\n registerForm.password &&\n registerForm.password.errors &&\n registerForm.password.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['password'].push({\n value: registerForm.email.value,\n errors: registerForm.email.errors,\n })\n }\n if (\n registerForm.passwordConfirm &&\n registerForm.passwordConfirm.errors &&\n registerForm.passwordConfirm.errors.length > 0\n ) {\n hasErrors = true\n error[errorGroup]['passwordConfirm'].push({\n value: registerForm.passwordConfirm.value,\n errors: registerForm.passwordConfirm.errors,\n })\n }\n\n return hasErrors ? error : null\n }\n }\n}\n", "properties": [ { "name": "_errorHandler", @@ -10073,7 +10073,7 @@ "deprecated": false, "deprecationMessage": "", "type": "interface", - "sourceCode": "import {\n Directive,\n Inject,\n OnInit,\n NgZone,\n ElementRef,\n LOCALE_ID,\n Output,\n EventEmitter,\n} from '@angular/core'\nimport { WINDOW } from '../window'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\n\nexport interface ReCaptchaConfig {\n theme?: 'dark' | 'light'\n type?: 'audio' | 'image'\n size?: 'compact' | 'normal'\n tabindex?: number\n}\n\ninterface WindowWithCaptcha extends Window {\n grecaptcha: {\n render: (ElementRef, ReCaptchaConfig) => number\n }\n orcidReCaptchaOnLoad: () => void\n}\n\n@Directive({\n selector: '[appRecaptcha]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: RecaptchaDirective,\n multi: true,\n },\n ],\n})\nexport class RecaptchaDirective implements OnInit, ControlValueAccessor {\n @Output() captchaFail = new EventEmitter()\n @Output() captchaLoaded = new EventEmitter()\n private onChange: (value: string) => void\n private onTouched: (value: string) => void\n\n constructor(\n @Inject(WINDOW) private window: WindowWithCaptcha,\n @Inject(LOCALE_ID) public locale: string,\n private ngZone: NgZone,\n private element: ElementRef,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n ngOnInit() {\n this.registerReCaptchaCallback()\n this.addScript()\n }\n\n registerReCaptchaCallback() {\n this.window.orcidReCaptchaOnLoad = () => {\n const config = {\n sitekey: environment.GOOGLE_RECAPTCHA,\n callback: (response: string) => {\n this.ngZone.run(() => this.onSuccess(response))\n },\n\n 'expired-callback': (response: string) => {\n this.ngZone.run(() => this.onExpired())\n },\n 'error-callback': () => {\n this.ngZone.run(() => this.onCaptchaFail())\n },\n }\n const id = this.render(this.element.nativeElement, config)\n this.captchaLoaded.emit(id)\n }\n }\n\n onExpired() {\n this.ngZone.run(() => {\n this.onChange(null)\n this.onTouched(null)\n })\n }\n\n onSuccess(token: string) {\n this.onChange(token)\n this.onTouched(token)\n }\n\n onCaptchaFail() {\n this.captchaFail.emit(true)\n this._errorHandler.handleError(new Error('captchaFail')).subscribe()\n }\n\n private render(element: HTMLElement, config): number {\n return this.window.grecaptcha.render(element, config)\n }\n\n addScript() {\n const script = this.window.document.createElement('script')\n const lang = this.locale ? '&hl=' + this.locale : ''\n script.src = `https://www.google.com/recaptcha/api.js?onload=orcidReCaptchaOnLoad&render=explicit${lang}`\n script.async = true\n script.defer = true\n this.window.document.body.appendChild(script)\n }\n\n writeValue(obj: any): void {}\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n setDisabledState?(isDisabled: boolean): void {}\n}\n", + "sourceCode": "import {\n Directive,\n Inject,\n OnInit,\n NgZone,\n ElementRef,\n LOCALE_ID,\n Output,\n EventEmitter,\n} from '@angular/core'\nimport { WINDOW } from '../window'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\n\nexport interface ReCaptchaConfig {\n theme?: 'dark' | 'light'\n type?: 'audio' | 'image'\n size?: 'compact' | 'normal'\n tabindex?: number\n}\n\ninterface WindowWithCaptcha extends Window {\n grecaptcha: {\n render: (ElementRef, ReCaptchaConfig) => number\n }\n orcidReCaptchaOnLoad: () => void\n}\n\n@Directive({\n selector: '[appRecaptcha]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: RecaptchaDirective,\n multi: true,\n },\n ],\n})\nexport class RecaptchaDirective implements OnInit, ControlValueAccessor {\n @Output() captchaFail = new EventEmitter()\n @Output() captchaLoaded = new EventEmitter()\n private onChange: (value: string) => void\n private onTouched: (value: string) => void\n\n constructor(\n @Inject(WINDOW) private window: WindowWithCaptcha,\n @Inject(LOCALE_ID) public locale: string,\n private ngZone: NgZone,\n private element: ElementRef,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n ngOnInit() {\n this.registerReCaptchaCallback()\n this.addScript()\n }\n\n registerReCaptchaCallback() {\n this.window.orcidReCaptchaOnLoad = () => {\n const config = {\n sitekey: environment.GOOGLE_RECAPTCHA,\n callback: (response: string) => {\n this.ngZone.run(() => this.onSuccess(response))\n },\n\n 'expired-callback': (response: string) => {\n this.ngZone.run(() => this.onExpired())\n },\n 'error-callback': () => {\n this.ngZone.run(() => this.onCaptchaFail())\n },\n }\n const id = this.render(this.element.nativeElement, config)\n this.captchaLoaded.emit(id)\n }\n }\n\n onExpired() {\n this.ngZone.run(() => {\n this.onChange(null)\n this.onTouched(null)\n })\n }\n\n onSuccess(token: string) {\n this.onChange(token)\n this.onTouched(token)\n }\n\n onCaptchaFail() {\n this.captchaFail.emit(true)\n this._errorHandler.handleError(new Error('captchaFail')).subscribe()\n }\n\n private render(element: HTMLElement, config): number {\n return this.window.grecaptcha.render(element, config)\n }\n\n addScript() {\n const script = this.window.document.createElement('script')\n const lang = this.locale ? '&hl=' + this.locale : ''\n script.src = `https://www.google.com/recaptcha/api.js?onload=orcidReCaptchaOnLoad&render=explicit${lang}`\n script.async = true\n script.defer = true\n this.window.document.body.appendChild(script)\n }\n\n writeValue(obj: any): void {}\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n setDisabledState?(isDisabled: boolean): void {}\n}\n", "properties": [ { "name": "size", @@ -13977,7 +13977,7 @@ "deprecated": false, "deprecationMessage": "", "type": "interface", - "sourceCode": "import {\n Directive,\n Inject,\n OnInit,\n NgZone,\n ElementRef,\n LOCALE_ID,\n Output,\n EventEmitter,\n} from '@angular/core'\nimport { WINDOW } from '../window'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\n\nexport interface ReCaptchaConfig {\n theme?: 'dark' | 'light'\n type?: 'audio' | 'image'\n size?: 'compact' | 'normal'\n tabindex?: number\n}\n\ninterface WindowWithCaptcha extends Window {\n grecaptcha: {\n render: (ElementRef, ReCaptchaConfig) => number\n }\n orcidReCaptchaOnLoad: () => void\n}\n\n@Directive({\n selector: '[appRecaptcha]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: RecaptchaDirective,\n multi: true,\n },\n ],\n})\nexport class RecaptchaDirective implements OnInit, ControlValueAccessor {\n @Output() captchaFail = new EventEmitter()\n @Output() captchaLoaded = new EventEmitter()\n private onChange: (value: string) => void\n private onTouched: (value: string) => void\n\n constructor(\n @Inject(WINDOW) private window: WindowWithCaptcha,\n @Inject(LOCALE_ID) public locale: string,\n private ngZone: NgZone,\n private element: ElementRef,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n ngOnInit() {\n this.registerReCaptchaCallback()\n this.addScript()\n }\n\n registerReCaptchaCallback() {\n this.window.orcidReCaptchaOnLoad = () => {\n const config = {\n sitekey: environment.GOOGLE_RECAPTCHA,\n callback: (response: string) => {\n this.ngZone.run(() => this.onSuccess(response))\n },\n\n 'expired-callback': (response: string) => {\n this.ngZone.run(() => this.onExpired())\n },\n 'error-callback': () => {\n this.ngZone.run(() => this.onCaptchaFail())\n },\n }\n const id = this.render(this.element.nativeElement, config)\n this.captchaLoaded.emit(id)\n }\n }\n\n onExpired() {\n this.ngZone.run(() => {\n this.onChange(null)\n this.onTouched(null)\n })\n }\n\n onSuccess(token: string) {\n this.onChange(token)\n this.onTouched(token)\n }\n\n onCaptchaFail() {\n this.captchaFail.emit(true)\n this._errorHandler.handleError(new Error('captchaFail')).subscribe()\n }\n\n private render(element: HTMLElement, config): number {\n return this.window.grecaptcha.render(element, config)\n }\n\n addScript() {\n const script = this.window.document.createElement('script')\n const lang = this.locale ? '&hl=' + this.locale : ''\n script.src = `https://www.google.com/recaptcha/api.js?onload=orcidReCaptchaOnLoad&render=explicit${lang}`\n script.async = true\n script.defer = true\n this.window.document.body.appendChild(script)\n }\n\n writeValue(obj: any): void {}\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n setDisabledState?(isDisabled: boolean): void {}\n}\n", + "sourceCode": "import {\n Directive,\n Inject,\n OnInit,\n NgZone,\n ElementRef,\n LOCALE_ID,\n Output,\n EventEmitter,\n} from '@angular/core'\nimport { WINDOW } from '../window'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\n\nexport interface ReCaptchaConfig {\n theme?: 'dark' | 'light'\n type?: 'audio' | 'image'\n size?: 'compact' | 'normal'\n tabindex?: number\n}\n\ninterface WindowWithCaptcha extends Window {\n grecaptcha: {\n render: (ElementRef, ReCaptchaConfig) => number\n }\n orcidReCaptchaOnLoad: () => void\n}\n\n@Directive({\n selector: '[appRecaptcha]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: RecaptchaDirective,\n multi: true,\n },\n ],\n})\nexport class RecaptchaDirective implements OnInit, ControlValueAccessor {\n @Output() captchaFail = new EventEmitter()\n @Output() captchaLoaded = new EventEmitter()\n private onChange: (value: string) => void\n private onTouched: (value: string) => void\n\n constructor(\n @Inject(WINDOW) private window: WindowWithCaptcha,\n @Inject(LOCALE_ID) public locale: string,\n private ngZone: NgZone,\n private element: ElementRef,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n ngOnInit() {\n this.registerReCaptchaCallback()\n this.addScript()\n }\n\n registerReCaptchaCallback() {\n this.window.orcidReCaptchaOnLoad = () => {\n const config = {\n sitekey: environment.GOOGLE_RECAPTCHA,\n callback: (response: string) => {\n this.ngZone.run(() => this.onSuccess(response))\n },\n\n 'expired-callback': (response: string) => {\n this.ngZone.run(() => this.onExpired())\n },\n 'error-callback': () => {\n this.ngZone.run(() => this.onCaptchaFail())\n },\n }\n const id = this.render(this.element.nativeElement, config)\n this.captchaLoaded.emit(id)\n }\n }\n\n onExpired() {\n this.ngZone.run(() => {\n this.onChange(null)\n this.onTouched(null)\n })\n }\n\n onSuccess(token: string) {\n this.onChange(token)\n this.onTouched(token)\n }\n\n onCaptchaFail() {\n this.captchaFail.emit(true)\n this._errorHandler.handleError(new Error('captchaFail')).subscribe()\n }\n\n private render(element: HTMLElement, config): number {\n return this.window.grecaptcha.render(element, config)\n }\n\n addScript() {\n const script = this.window.document.createElement('script')\n const lang = this.locale ? '&hl=' + this.locale : ''\n script.src = `https://www.google.com/recaptcha/api.js?onload=orcidReCaptchaOnLoad&render=explicit${lang}`\n script.async = true\n script.defer = true\n this.window.document.body.appendChild(script)\n }\n\n writeValue(obj: any): void {}\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n setDisabledState?(isDisabled: boolean): void {}\n}\n", "properties": [ { "name": "grecaptcha", @@ -14990,7 +14990,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountActionsDeactivateService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'text/plain charset=utf-8',\n })\n options: { headers: any; responseType: 'text' }\n\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {\n this.options = { headers: this.headers, responseType: 'text' as 'text' }\n }\n\n deactivateAccount(): Observable {\n return this._http\n .get(\n environment.API_WEB + `account/send-deactivate-account.json`,\n this.options\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountActionsDeactivateService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'text/plain charset=utf-8',\n })\n options: { headers: any; responseType: 'text' }\n\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {\n this.options = { headers: this.headers, responseType: 'text' as 'text' }\n }\n\n deactivateAccount(): Observable {\n return this._http\n .get(\n environment.API_WEB + `account/send-deactivate-account.json`,\n this.options\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -15093,7 +15093,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Inject, Injectable } from '@angular/core'\nimport { catchError, retry, tap } from 'rxjs/operators'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountActionsDownloadService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient,\n @Inject(WINDOW) private _window: Window\n ) {}\n\n downloadUserData() {\n return this.downloadBlogFile({\n url: environment.API_WEB + 'get-my-data',\n dataType: 'application/octet-stream',\n })\n }\n\n private downloadBlogFile({\n url,\n dataType,\n }: {\n url: string\n dataType: string\n }) {\n return this._http\n .post(url, {}, { observe: 'response', responseType: 'blob' })\n .pipe(\n tap((response) => {\n const filename =\n response.headers.get('filename') != null\n ? response.headers.get('filename')\n : 'orcid.zip'\n const blob = new Blob([response.body], { type: dataType })\n const link = this._window.document.createElement('a')\n link.href = this._window.window.URL.createObjectURL(blob)\n link.download = filename\n this._window.document.body.appendChild(link)\n link.click()\n this._window.document.body.removeChild(link)\n }),\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Inject, Injectable } from '@angular/core'\nimport { catchError, retry, tap } from 'rxjs/operators'\nimport { WINDOW } from 'src/app/cdk/window'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountActionsDownloadService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient,\n @Inject(WINDOW) private _window: Window\n ) {}\n\n downloadUserData() {\n return this.downloadBlogFile({\n url: environment.API_WEB + 'get-my-data',\n dataType: 'application/octet-stream',\n })\n }\n\n private downloadBlogFile({\n url,\n dataType,\n }: {\n url: string\n dataType: string\n }) {\n return this._http\n .post(url, {}, { observe: 'response', responseType: 'blob' })\n .pipe(\n tap((response) => {\n const filename =\n response.headers.get('filename') != null\n ? response.headers.get('filename')\n : 'orcid.zip'\n const blob = new Blob([response.body], { type: dataType })\n const link = this._window.document.createElement('a')\n link.href = this._window.window.URL.createObjectURL(blob)\n link.download = filename\n this._window.document.body.appendChild(link)\n link.click()\n this._window.document.body.removeChild(link)\n }),\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -15230,7 +15230,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountActionsDuplicatedService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n confirmDeprecate(\n account: DuplicateRemoveEndpoint\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/confirm-deprecate-profile.json`,\n account,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n deprecate(\n account: DuplicateRemoveEndpoint\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/validate-deprecate-profile.json`,\n account,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountActionsDuplicatedService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n confirmDeprecate(\n account: DuplicateRemoveEndpoint\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/confirm-deprecate-profile.json`,\n account,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n deprecate(\n account: DuplicateRemoveEndpoint\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/validate-deprecate-profile.json`,\n account,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -15418,7 +15418,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { AccountDefaultEmailFrequenciesEndpoint } from 'src/app/types/account-default-visibility.endpoint'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountDefaultEmailFrequenciesService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n get(): Observable {\n return this._http\n .get(\n environment.API_WEB + `notifications/frequencies/view`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n updateAmendNotifications(frequency: number): Observable {\n return this._http\n .post(\n environment.API_WEB + `notifications/frequencies/update/amendUpdates`,\n frequency,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n updateAdminNotifications(frequency: string): Observable {\n return this._http\n .post(\n environment.API_WEB + `notifications/frequencies/update/adminUpdates`,\n frequency,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n updateMemberNotifications(frequency: string): Observable {\n return this._http\n .post(\n environment.API_WEB + `notifications/frequencies/update/memberUpdates`,\n frequency,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n updateMemberTipsUpdates(tips: boolean): Observable {\n return this._http\n .post(\n environment.API_WEB + `notifications/frequencies/update/tipsUpdates`,\n tips,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { AccountDefaultEmailFrequenciesEndpoint } from 'src/app/types/account-default-visibility.endpoint'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountDefaultEmailFrequenciesService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n get(): Observable {\n return this._http\n .get(\n environment.API_WEB + `notifications/frequencies/view`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n updateAmendNotifications(frequency: number): Observable {\n return this._http\n .post(\n environment.API_WEB + `notifications/frequencies/update/amendUpdates`,\n frequency,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n updateAdminNotifications(frequency: string): Observable {\n return this._http\n .post(\n environment.API_WEB + `notifications/frequencies/update/adminUpdates`,\n frequency,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n updateMemberNotifications(frequency: string): Observable {\n return this._http\n .post(\n environment.API_WEB + `notifications/frequencies/update/memberUpdates`,\n frequency,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n updateMemberTipsUpdates(tips: boolean): Observable {\n return this._http\n .post(\n environment.API_WEB + `notifications/frequencies/update/tipsUpdates`,\n tips,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -15512,7 +15512,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { VisibilityStrings } from 'src/app/types/common.endpoint'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountDefaultVisibilityService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n update(frequency: VisibilityStrings): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/default_visibility.json`,\n frequency,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { VisibilityStrings } from 'src/app/types/common.endpoint'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountDefaultVisibilityService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n update(frequency: VisibilityStrings): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/default_visibility.json`,\n frequency,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -15699,7 +15699,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, map, retry, switchMap } from 'rxjs/operators'\nimport { EMAIL_REGEXP } from 'src/app/constants'\nimport {\n SocialAccount,\n SocialAccountDeleteResponse,\n SocialAccountId,\n} from 'src/app/types/account-alternate-sign-in.endpoint'\nimport { Institutional } from 'src/app/types/institutional.endpoint'\nimport { environment } from 'src/environments/environment'\n\nimport { DiscoService } from '../disco/disco.service'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountSecurityAlternateSignInService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _discoFeed: DiscoService,\n private _http: HttpClient\n ) {}\n\n get(): Observable {\n return this._http\n .get(\n environment.API_WEB + `account/socialAccounts.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n switchMap((socialAccounts) => {\n return this._discoFeed.getDiscoFeed().pipe(\n map((feed) => {\n this.populateIdPNames({ socialAccounts, feed })\n this.populateEmails(socialAccounts)\n return socialAccounts\n })\n )\n }),\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n populateEmails(socialAccounts: SocialAccount[]) {\n socialAccounts.forEach(\n (account) => (account.email = this.getAccountDisplayEmail(account))\n )\n }\n private getAccountDisplayEmail(account: SocialAccount): string {\n if (account.email) {\n return account.email\n } else if (\n account.id?.provideruserid &&\n EMAIL_REGEXP.test(account.id?.provideruserid)\n ) {\n return account.id?.provideruserid\n } else {\n return account.displayname\n }\n }\n delete(idToManage: SocialAccountId): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/revokeSocialAccount.json`,\n { idToManage },\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n populateIdPNames({\n socialAccounts,\n feed,\n }: {\n socialAccounts: SocialAccount[]\n feed: Institutional[]\n }): void {\n socialAccounts.forEach((account) => {\n if (\n account.id.providerid === 'facebook' ||\n account.id.providerid === 'google'\n ) {\n account.idpName =\n account.id.providerid.charAt(0).toUpperCase() +\n account.id.providerid.slice(1)\n } else {\n account.idpName = this._discoFeed.getInstitutionNameBaseOnIdFromObject(\n this._discoFeed.getInstitutionBaseOnIDFromObject(\n feed,\n account.id.providerid\n )\n )\n }\n if (!account.idpName) {\n account.idpName = account.id.providerid\n }\n })\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, map, retry, switchMap } from 'rxjs/operators'\nimport { EMAIL_REGEXP } from 'src/app/constants'\nimport {\n SocialAccount,\n SocialAccountDeleteResponse,\n SocialAccountId,\n} from 'src/app/types/account-alternate-sign-in.endpoint'\nimport { Institutional } from 'src/app/types/institutional.endpoint'\n\n\nimport { DiscoService } from '../disco/disco.service'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountSecurityAlternateSignInService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _discoFeed: DiscoService,\n private _http: HttpClient\n ) {}\n\n get(): Observable {\n return this._http\n .get(\n environment.API_WEB + `account/socialAccounts.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n switchMap((socialAccounts) => {\n return this._discoFeed.getDiscoFeed().pipe(\n map((feed) => {\n this.populateIdPNames({ socialAccounts, feed })\n this.populateEmails(socialAccounts)\n return socialAccounts\n })\n )\n }),\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n populateEmails(socialAccounts: SocialAccount[]) {\n socialAccounts.forEach(\n (account) => (account.email = this.getAccountDisplayEmail(account))\n )\n }\n private getAccountDisplayEmail(account: SocialAccount): string {\n if (account.email) {\n return account.email\n } else if (\n account.id?.provideruserid &&\n EMAIL_REGEXP.test(account.id?.provideruserid)\n ) {\n return account.id?.provideruserid\n } else {\n return account.displayname\n }\n }\n delete(idToManage: SocialAccountId): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/revokeSocialAccount.json`,\n { idToManage },\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n populateIdPNames({\n socialAccounts,\n feed,\n }: {\n socialAccounts: SocialAccount[]\n feed: Institutional[]\n }): void {\n socialAccounts.forEach((account) => {\n if (\n account.id.providerid === 'facebook' ||\n account.id.providerid === 'google'\n ) {\n account.idpName =\n account.id.providerid.charAt(0).toUpperCase() +\n account.id.providerid.slice(1)\n } else {\n account.idpName = this._discoFeed.getInstitutionNameBaseOnIdFromObject(\n this._discoFeed.getInstitutionBaseOnIDFromObject(\n feed,\n account.id.providerid\n )\n )\n }\n if (!account.idpName) {\n account.idpName = account.id.providerid\n }\n })\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -15808,7 +15808,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { AccountPasswordEndpoint } from 'src/app/types/account-settings-password'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountSecurityPasswordService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n updatePassword(\n accountPassword: AccountPasswordEndpoint\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/change-password.json`,\n accountPassword,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { AccountPasswordEndpoint } from 'src/app/types/account-settings-password'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountSecurityPasswordService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n updatePassword(\n accountPassword: AccountPasswordEndpoint\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/change-password.json`,\n accountPassword,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -16090,7 +16090,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, Subject } from 'rxjs'\nimport { catchError, map, retry, tap } from 'rxjs/operators'\nimport {\n ExpandedSearchResultsContent,\n SearchResultsByEmailOrOrcid,\n} from 'src/app/types'\nimport {\n AccountTrustedIndividual,\n PersonDetails,\n} from 'src/app/types/account-trusted-individuals'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountTrustedIndividualsService {\n updateTrustedIndividualsSuccess = new Subject()\n\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n get(): Observable {\n return this._http\n .get(\n environment.API_WEB + `account/delegates.json`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n map((x) => {\n return x.map((x) => {\n x.receiverName.value =\n x.receiverName.value ||\n $localize`:@@account.nameIsPri:Name is private`\n return x\n })\n })\n )\n }\n\n delete(account: AccountTrustedIndividual): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/revokeDelegate.json`,\n { delegateToManage: account.receiverOrcid.path },\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.updateTrustedIndividualsSuccess.next())\n )\n }\n\n getPersonDetails(orcid: string) {\n return this._http\n .get(environment.API_PUB + `${orcid}/personal-details`, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n add(value: ExpandedSearchResultsContent) {\n return this._http\n .post(\n environment.API_WEB + `account/addDelegate.json`,\n { delegateToManage: value['orcid-id'] },\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.updateTrustedIndividualsSuccess.next())\n )\n }\n searchByEmail(email: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `account/search-for-delegate-by-email/${encodeURIComponent(email)}/`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n addByEmail(delegateEmail: string) {\n return this._http\n .post(\n environment.API_WEB + `account/addDelegateByEmail.json/`,\n { delegateEmail },\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.updateTrustedIndividualsSuccess.next())\n )\n }\n\n searchByOrcid(email: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `account/search-for-delegate-by-orcid/${encodeURIComponent(email)}/`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n addByOrcid(delegateToManage: string) {\n return this._http\n .post(\n environment.API_WEB + `account/addDelegateByOrcid.json`,\n { delegateToManage },\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.updateTrustedIndividualsSuccess.next())\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, Subject } from 'rxjs'\nimport { catchError, map, retry, tap } from 'rxjs/operators'\nimport {\n ExpandedSearchResultsContent,\n SearchResultsByEmailOrOrcid,\n} from 'src/app/types'\nimport {\n AccountTrustedIndividual,\n PersonDetails,\n} from 'src/app/types/account-trusted-individuals'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountTrustedIndividualsService {\n updateTrustedIndividualsSuccess = new Subject()\n\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n get(): Observable {\n return this._http\n .get(\n environment.API_WEB + `account/delegates.json`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n map((x) => {\n return x.map((x) => {\n x.receiverName.value =\n x.receiverName.value ||\n $localize`:@@account.nameIsPri:Name is private`\n return x\n })\n })\n )\n }\n\n delete(account: AccountTrustedIndividual): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/revokeDelegate.json`,\n { delegateToManage: account.receiverOrcid.path },\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.updateTrustedIndividualsSuccess.next())\n )\n }\n\n getPersonDetails(orcid: string) {\n return this._http\n .get(environment.API_PUB + `${orcid}/personal-details`, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n add(value: ExpandedSearchResultsContent) {\n return this._http\n .post(\n environment.API_WEB + `account/addDelegate.json`,\n { delegateToManage: value['orcid-id'] },\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.updateTrustedIndividualsSuccess.next())\n )\n }\n searchByEmail(email: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `account/search-for-delegate-by-email/${encodeURIComponent(email)}/`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n addByEmail(delegateEmail: string) {\n return this._http\n .post(\n environment.API_WEB + `account/addDelegateByEmail.json/`,\n { delegateEmail },\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.updateTrustedIndividualsSuccess.next())\n )\n }\n\n searchByOrcid(email: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `account/search-for-delegate-by-orcid/${encodeURIComponent(email)}/`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n addByOrcid(delegateToManage: string) {\n return this._http\n .post(\n environment.API_WEB + `account/addDelegateByOrcid.json`,\n { delegateToManage },\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.updateTrustedIndividualsSuccess.next())\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -16194,7 +16194,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { AccountTrustedOrganization } from 'src/app/types/account-trusted-organizations'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountTrustedOrganizationsService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n get(): Observable {\n return this._http\n .get(\n environment.API_WEB + `account/get-trusted-orgs.json`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n delete(\n account: AccountTrustedOrganization\n ): Observable {\n return this._http\n .post(\n environment.API_WEB +\n `account/revoke-application.json?clientId=` +\n account.clientId,\n undefined,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, retry } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { AccountTrustedOrganization } from 'src/app/types/account-trusted-organizations'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountTrustedOrganizationsService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient\n ) {}\n\n get(): Observable {\n return this._http\n .get(\n environment.API_WEB + `account/get-trusted-orgs.json`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n delete(\n account: AccountTrustedOrganization\n ): Observable {\n return this._http\n .post(\n environment.API_WEB +\n `account/revoke-application.json?clientId=` +\n account.clientId,\n undefined,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -16682,7 +16682,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { LiveAnnouncer } from '@angular/cdk/a11y'\nimport { Injectable } from '@angular/core'\nimport { PageEvent } from '@angular/material/paginator'\nimport { environment } from 'src/environments/environment'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AnnouncerService {\n constructor(private _liveAnnouncer: LiveAnnouncer) {}\n youAreOnPageLabel = $localize`:@@shared.youAreOnPage:You are on page`\n ofLabel = $localize`:@@shared.of:of`\n thereAreLabel = $localize`:@@shared.thereAre:There are`\n onEachPageLabel = $localize`:@@shared.onEachPage:on each page`\n showingLabel = $localize`:@@shared.showing:Showing`\n lastAnnouncement: string\n\n liveAnnouncePagination(paginatorLabel: PageEvent, itemType: string) {\n const announcement =\n this.youAreOnPageLabel +\n ' ' +\n (paginatorLabel.pageIndex + 1) +\n ' ' +\n this.ofLabel +\n ' ' +\n // Total pages\n Math.ceil(paginatorLabel.length / paginatorLabel.pageSize) +\n '. ' +\n this.thereAreLabel +\n ' ' +\n paginatorLabel.pageSize +\n ' ' +\n itemType +\n ' ' +\n this.onEachPageLabel +\n '. ' +\n this.showingLabel +\n ' ' +\n (paginatorLabel.pageIndex + 1 !==\n Math.ceil(paginatorLabel.length / paginatorLabel.pageSize)\n ? paginatorLabel.pageSize\n : paginatorLabel.length % paginatorLabel.pageSize) +\n ' ' +\n this.ofLabel +\n ' ' +\n paginatorLabel.length +\n ' ' +\n itemType\n\n if (this.lastAnnouncement !== announcement) {\n this.lastAnnouncement = announcement\n this.announce(announcement)\n }\n }\n\n private announce(announcement: string) {\n if (environment.debugger) {\n console.debug('📢' + announcement)\n }\n this._liveAnnouncer.announce(announcement, 'assertive')\n }\n}\n", + "sourceCode": "import { LiveAnnouncer } from '@angular/cdk/a11y'\nimport { Injectable } from '@angular/core'\nimport { PageEvent } from '@angular/material/paginator'\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AnnouncerService {\n constructor(private _liveAnnouncer: LiveAnnouncer) {}\n youAreOnPageLabel = $localize`:@@shared.youAreOnPage:You are on page`\n ofLabel = $localize`:@@shared.of:of`\n thereAreLabel = $localize`:@@shared.thereAre:There are`\n onEachPageLabel = $localize`:@@shared.onEachPage:on each page`\n showingLabel = $localize`:@@shared.showing:Showing`\n lastAnnouncement: string\n\n liveAnnouncePagination(paginatorLabel: PageEvent, itemType: string) {\n const announcement =\n this.youAreOnPageLabel +\n ' ' +\n (paginatorLabel.pageIndex + 1) +\n ' ' +\n this.ofLabel +\n ' ' +\n // Total pages\n Math.ceil(paginatorLabel.length / paginatorLabel.pageSize) +\n '. ' +\n this.thereAreLabel +\n ' ' +\n paginatorLabel.pageSize +\n ' ' +\n itemType +\n ' ' +\n this.onEachPageLabel +\n '. ' +\n this.showingLabel +\n ' ' +\n (paginatorLabel.pageIndex + 1 !==\n Math.ceil(paginatorLabel.length / paginatorLabel.pageSize)\n ? paginatorLabel.pageSize\n : paginatorLabel.length % paginatorLabel.pageSize) +\n ' ' +\n this.ofLabel +\n ' ' +\n paginatorLabel.length +\n ' ' +\n itemType\n\n if (this.lastAnnouncement !== announcement) {\n this.lastAnnouncement = announcement\n this.announce(announcement)\n }\n }\n\n private announce(announcement: string) {\n if (environment.debugger) {\n console.debug('📢' + announcement)\n }\n this._liveAnnouncer.announce(announcement, 'assertive')\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -16887,7 +16887,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { Client } from 'src/app/types/developer-tools'\nimport { Observable } from 'rxjs'\nimport { retry, catchError } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { environment } from 'src/environments/environment'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DeveloperToolsService {\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n getDeveloperToolsClient(): Observable {\n return this._http\n .get(environment.BASE_URL + 'developer-tools/get-client.json')\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n postDeveloperToolsClient(client: Client): Observable {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/create-client.json',\n client\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n updateDeveloperToolsClient(client: Client): Observable {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/update-client.json',\n client\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n postResetClientSecret(client: Client): Observable {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/reset-client-secret.json',\n client\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n enableDeveloperTools() {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/enable-developer-tools.json',\n {}\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n resetClientSecret(client: Client): Observable {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/reset-client-secret.json',\n client\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n}\n", + "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { Client } from 'src/app/types/developer-tools'\nimport { Observable } from 'rxjs'\nimport { retry, catchError } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DeveloperToolsService {\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n getDeveloperToolsClient(): Observable {\n return this._http\n .get(environment.BASE_URL + 'developer-tools/get-client.json')\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n postDeveloperToolsClient(client: Client): Observable {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/create-client.json',\n client\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n updateDeveloperToolsClient(client: Client): Observable {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/update-client.json',\n client\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n postResetClientSecret(client: Client): Observable {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/reset-client-secret.json',\n client\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n enableDeveloperTools() {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/enable-developer-tools.json',\n {}\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n resetClientSecret(client: Client): Observable {\n return this._http\n .post(\n environment.BASE_URL + 'developer-tools/reset-client-secret.json',\n client\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -17930,7 +17930,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Inject, Injectable } from '@angular/core'\nimport initHelpHero, { HelpHero } from 'helphero'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { AssertionVisibilityString } from 'src/app/types'\nimport { AffiliationUIGroup } from 'src/app/types/record-affiliation.endpoint'\nimport { NamesEndPoint } from 'src/app/types/record-name.endpoint'\nimport { WorksEndpoint } from 'src/app/types/record-works.endpoint'\nimport { UserRecord } from 'src/app/types/record.local'\nimport { UserInfo } from 'src/app/types/userInfo.endpoint'\nimport { environment } from 'src/environments/environment'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class HelpHeroService {\n hlp: HelpHero\n\n private getNumberOfValidatedEmails(emails: AssertionVisibilityString[]): {\n numberOfValidatedEmails: number\n numberOfUnvalidatedEmails: number\n } {\n return {\n numberOfValidatedEmails: emails?.filter((email) => {\n return email.verified === true\n }).length,\n numberOfUnvalidatedEmails: emails?.filter((email) => {\n return email.verified === false\n }).length,\n }\n }\n\n constructor(@Inject(WINDOW) private window: Window) {}\n initializeHelpHero(userInfo: UserInfo, userRecord: UserRecord) {\n if (\n userInfo?.EFFECTIVE_USER_ORCID &&\n userRecord?.emails?.emails &&\n userRecord?.names &&\n userRecord?.affiliations &&\n userRecord?.works &&\n !this.hlp &&\n !(this.window as any).Cypress\n ) {\n this.modifyHelpHeroScriptOnCreate()\n this.hlp = initHelpHero(environment.HELP_HERO_ID)\n const helpHeroIdentifyObject = {\n numberOfValidatedEmails: this.getNumberOfValidatedEmails(\n userRecord?.emails?.emails\n ).numberOfValidatedEmails,\n numberOfUnvalidatedEmails: this.getNumberOfValidatedEmails(\n userRecord?.emails?.emails\n ).numberOfUnvalidatedEmails,\n givenNames: userRecord.names.givenNames?.value,\n familyName: userRecord.names.familyName?.value,\n publishedName: userRecord.names.creditName?.value,\n orcid: userInfo.EFFECTIVE_USER_ORCID,\n isDelegated: userInfo.EFFECTIVE_USER_ORCID !== userInfo.REAL_USER_ORCID,\n hasAffiliations: !!this.affiliationsCount(userRecord.affiliations),\n hasWorks: !!this.worksCount(userRecord.works),\n displayName: this.getDisplayNames(userRecord.names),\n }\n this.hlp.identify(userInfo.EFFECTIVE_USER_ORCID, helpHeroIdentifyObject)\n }\n }\n private modifyHelpHeroScriptOnCreate() {\n const observer = new MutationObserver((mutations, me) => {\n const helpheroDom = document.getElementById('helphero-dom')\n if (helpheroDom) {\n this.handleHelpHeroChanges(helpheroDom)\n me.disconnect()\n return\n }\n })\n\n observer.observe(document, {\n childList: true,\n subtree: true,\n })\n }\n handleHelpHeroChanges(helpheroFrame: HTMLElement) {\n this.window.document\n .querySelector('app-root')\n .insertAdjacentElement('beforebegin', helpheroFrame)\n helpheroFrame.setAttribute('aria-hidden', 'true')\n }\n\n affiliationsCount(affiliations: AffiliationUIGroup[]): number {\n return affiliations.reduce((p, c) => (p += c.affiliationGroup.length), 0)\n }\n\n worksCount(works: WorksEndpoint): number {\n return works.totalGroups\n }\n private getDisplayNames(recordNames: NamesEndPoint) {\n let displayedName = ''\n if (recordNames?.creditName) {\n displayedName = recordNames.creditName.value\n } else if (\n recordNames?.givenNames?.value &&\n recordNames?.familyName?.value\n ) {\n displayedName = `${recordNames.givenNames.value} ${recordNames.familyName.value}`\n } else if (recordNames?.givenNames?.value) {\n displayedName = `${recordNames.givenNames.value}`\n }\n\n displayedName = displayedName.trim()\n return displayedName\n }\n}\n", + "sourceCode": "import { Inject, Injectable } from '@angular/core'\nimport initHelpHero, { HelpHero } from 'helphero'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { AssertionVisibilityString } from 'src/app/types'\nimport { AffiliationUIGroup } from 'src/app/types/record-affiliation.endpoint'\nimport { NamesEndPoint } from 'src/app/types/record-name.endpoint'\nimport { WorksEndpoint } from 'src/app/types/record-works.endpoint'\nimport { UserRecord } from 'src/app/types/record.local'\nimport { UserInfo } from 'src/app/types/userInfo.endpoint'\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class HelpHeroService {\n hlp: HelpHero\n\n private getNumberOfValidatedEmails(emails: AssertionVisibilityString[]): {\n numberOfValidatedEmails: number\n numberOfUnvalidatedEmails: number\n } {\n return {\n numberOfValidatedEmails: emails?.filter((email) => {\n return email.verified === true\n }).length,\n numberOfUnvalidatedEmails: emails?.filter((email) => {\n return email.verified === false\n }).length,\n }\n }\n\n constructor(@Inject(WINDOW) private window: Window) {}\n initializeHelpHero(userInfo: UserInfo, userRecord: UserRecord) {\n if (\n userInfo?.EFFECTIVE_USER_ORCID &&\n userRecord?.emails?.emails &&\n userRecord?.names &&\n userRecord?.affiliations &&\n userRecord?.works &&\n !this.hlp &&\n !(this.window as any).Cypress\n ) {\n this.modifyHelpHeroScriptOnCreate()\n this.hlp = initHelpHero(environment.HELP_HERO_ID)\n const helpHeroIdentifyObject = {\n numberOfValidatedEmails: this.getNumberOfValidatedEmails(\n userRecord?.emails?.emails\n ).numberOfValidatedEmails,\n numberOfUnvalidatedEmails: this.getNumberOfValidatedEmails(\n userRecord?.emails?.emails\n ).numberOfUnvalidatedEmails,\n givenNames: userRecord.names.givenNames?.value,\n familyName: userRecord.names.familyName?.value,\n publishedName: userRecord.names.creditName?.value,\n orcid: userInfo.EFFECTIVE_USER_ORCID,\n isDelegated: userInfo.EFFECTIVE_USER_ORCID !== userInfo.REAL_USER_ORCID,\n hasAffiliations: !!this.affiliationsCount(userRecord.affiliations),\n hasWorks: !!this.worksCount(userRecord.works),\n displayName: this.getDisplayNames(userRecord.names),\n }\n this.hlp.identify(userInfo.EFFECTIVE_USER_ORCID, helpHeroIdentifyObject)\n }\n }\n private modifyHelpHeroScriptOnCreate() {\n const observer = new MutationObserver((mutations, me) => {\n const helpheroDom = document.getElementById('helphero-dom')\n if (helpheroDom) {\n this.handleHelpHeroChanges(helpheroDom)\n me.disconnect()\n return\n }\n })\n\n observer.observe(document, {\n childList: true,\n subtree: true,\n })\n }\n handleHelpHeroChanges(helpheroFrame: HTMLElement) {\n this.window.document\n .querySelector('app-root')\n .insertAdjacentElement('beforebegin', helpheroFrame)\n helpheroFrame.setAttribute('aria-hidden', 'true')\n }\n\n affiliationsCount(affiliations: AffiliationUIGroup[]): number {\n return affiliations.reduce((p, c) => (p += c.affiliationGroup.length), 0)\n }\n\n worksCount(works: WorksEndpoint): number {\n return works.totalGroups\n }\n private getDisplayNames(recordNames: NamesEndPoint) {\n let displayedName = ''\n if (recordNames?.creditName) {\n displayedName = recordNames.creditName.value\n } else if (\n recordNames?.givenNames?.value &&\n recordNames?.familyName?.value\n ) {\n displayedName = `${recordNames.givenNames.value} ${recordNames.familyName.value}`\n } else if (recordNames?.givenNames?.value) {\n displayedName = `${recordNames.givenNames.value}`\n }\n\n displayedName = displayedName.trim()\n return displayedName\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -18227,7 +18227,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, ReplaySubject } from 'rxjs'\nimport { catchError, map, switchMap, tap, retry } from 'rxjs/operators'\nimport { AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL } from 'src/app/constants'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { environment } from 'src/environments/environment'\n\nimport {\n InboxNotificationAmended,\n InboxNotificationHtml,\n InboxNotificationInstitutional,\n InboxNotificationPermission,\n TotalNotificationCount,\n} from '../../types/notifications.endpoint'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class InboxService {\n private nextLoadRequireAFullBackendSyncronization = false\n private currentlyIncludingArchive: boolean\n private currentLevel = 0\n private headers: HttpHeaders\n private inboxSubject = new ReplaySubject<\n (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n >(1)\n\n lastEmittedValue: (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {\n this.headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n }\n\n get(\n getNextDepthLevel = false,\n includeArchived = false\n ): Observable<\n (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n > {\n if (this.currentlyIncludingArchive === null) {\n this.currentlyIncludingArchive = includeArchived\n } else if (this.currentlyIncludingArchive !== includeArchived) {\n this.currentlyIncludingArchive = includeArchived\n this.currentLevel = 0\n this.lastEmittedValue = null\n }\n // Only allow to get the next level if the first level was already retrieved\n if (getNextDepthLevel && this.lastEmittedValue) {\n this.currentLevel++\n }\n return this.getNotifications(this.currentLevel, includeArchived).pipe(\n tap((data) => {\n if (this.nextLoadRequireAFullBackendSyncronization) {\n this.lastEmittedValue = null\n this.nextLoadRequireAFullBackendSyncronization = false\n }\n\n if (!this.lastEmittedValue) {\n this.lastEmittedValue = data\n } else {\n this.lastEmittedValue = this.lastEmittedValue.concat(data)\n }\n this.inboxSubject.next(this.lastEmittedValue)\n }),\n switchMap(() => this.inboxSubject.asObservable())\n )\n }\n\n private getNotifications(\n depthLevel,\n includeArchived\n ): Observable<\n (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n > {\n return this._http\n .get<\n (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n >(\n !this.nextLoadRequireAFullBackendSyncronization\n ? // if a complete refresh is not required only load the the new notifications\n environment.BASE_URL +\n `inbox/notifications.json?firstResult=${\n AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL * depthLevel\n }&maxResults=${AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL}&includeArchived=${includeArchived}`\n : // if a complete refresh is required reload all the notification from index 0\n `inbox/notifications.json?firstResult=0&maxResults=${\n AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL * depthLevel +\n AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL\n }&includeArchived=${includeArchived}`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n flagAsArchive(\n code: number | string,\n emitUpdate = true\n ): Observable<\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n > {\n return this._http\n .post<\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n >(environment.BASE_URL + `inbox/${code}/archive.json`, code, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n ),\n tap((data) => {\n this.lastEmittedValue.forEach((value, index) => {\n if (value.putCode === data.putCode) {\n if (this.currentlyIncludingArchive) {\n value.archivedDate = data.archivedDate\n value.readDate = data.readDate\n } else {\n this.lastEmittedValue.splice(index, 1)\n // When one or multiple notifications are archived and deleted from the local list\n // the next load of notifications from the backend will require a complete reload\n // this is because just concatenating newly loaded items would be accurate\n this.nextLoadRequireAFullBackendSyncronization = true\n }\n }\n })\n if (emitUpdate) {\n this.emitUpdate()\n }\n })\n )\n }\n\n emitUpdate() {\n this.inboxSubject.next(this.lastEmittedValue)\n }\n\n flagAsRead(\n code: number | string\n ): Observable<\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n > {\n return this._http\n .post<\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n >(environment.BASE_URL + `inbox/${code}/read.json`, code, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap((data) => {\n this.lastEmittedValue.forEach((value) => {\n if (value.putCode === data.putCode) {\n value.readDate = data.readDate\n }\n })\n this.inboxSubject.next(this.lastEmittedValue)\n })\n )\n }\n\n retrieveUnreadCount(): any {\n return this._http.get(environment.BASE_URL + 'inbox/unreadCount.json')\n }\n\n totalNumber() {\n return this._http\n .get(\n environment.BASE_URL + `inbox/totalCount.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n map((value) => {\n value.archived = value.all - value.nonArchived\n return value\n }),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, ReplaySubject } from 'rxjs'\nimport { catchError, map, switchMap, tap, retry } from 'rxjs/operators'\nimport { AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL } from 'src/app/constants'\nimport { ERROR_REPORT } from 'src/app/errors'\n\n\nimport {\n InboxNotificationAmended,\n InboxNotificationHtml,\n InboxNotificationInstitutional,\n InboxNotificationPermission,\n TotalNotificationCount,\n} from '../../types/notifications.endpoint'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class InboxService {\n private nextLoadRequireAFullBackendSyncronization = false\n private currentlyIncludingArchive: boolean\n private currentLevel = 0\n private headers: HttpHeaders\n private inboxSubject = new ReplaySubject<\n (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n >(1)\n\n lastEmittedValue: (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {\n this.headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n }\n\n get(\n getNextDepthLevel = false,\n includeArchived = false\n ): Observable<\n (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n > {\n if (this.currentlyIncludingArchive === null) {\n this.currentlyIncludingArchive = includeArchived\n } else if (this.currentlyIncludingArchive !== includeArchived) {\n this.currentlyIncludingArchive = includeArchived\n this.currentLevel = 0\n this.lastEmittedValue = null\n }\n // Only allow to get the next level if the first level was already retrieved\n if (getNextDepthLevel && this.lastEmittedValue) {\n this.currentLevel++\n }\n return this.getNotifications(this.currentLevel, includeArchived).pipe(\n tap((data) => {\n if (this.nextLoadRequireAFullBackendSyncronization) {\n this.lastEmittedValue = null\n this.nextLoadRequireAFullBackendSyncronization = false\n }\n\n if (!this.lastEmittedValue) {\n this.lastEmittedValue = data\n } else {\n this.lastEmittedValue = this.lastEmittedValue.concat(data)\n }\n this.inboxSubject.next(this.lastEmittedValue)\n }),\n switchMap(() => this.inboxSubject.asObservable())\n )\n }\n\n private getNotifications(\n depthLevel,\n includeArchived\n ): Observable<\n (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n > {\n return this._http\n .get<\n (\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n )[]\n >(\n !this.nextLoadRequireAFullBackendSyncronization\n ? // if a complete refresh is not required only load the the new notifications\n environment.BASE_URL +\n `inbox/notifications.json?firstResult=${\n AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL * depthLevel\n }&maxResults=${AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL}&includeArchived=${includeArchived}`\n : // if a complete refresh is required reload all the notification from index 0\n `inbox/notifications.json?firstResult=0&maxResults=${\n AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL * depthLevel +\n AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL\n }&includeArchived=${includeArchived}`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n flagAsArchive(\n code: number | string,\n emitUpdate = true\n ): Observable<\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n > {\n return this._http\n .post<\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n >(environment.BASE_URL + `inbox/${code}/archive.json`, code, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n ),\n tap((data) => {\n this.lastEmittedValue.forEach((value, index) => {\n if (value.putCode === data.putCode) {\n if (this.currentlyIncludingArchive) {\n value.archivedDate = data.archivedDate\n value.readDate = data.readDate\n } else {\n this.lastEmittedValue.splice(index, 1)\n // When one or multiple notifications are archived and deleted from the local list\n // the next load of notifications from the backend will require a complete reload\n // this is because just concatenating newly loaded items would be accurate\n this.nextLoadRequireAFullBackendSyncronization = true\n }\n }\n })\n if (emitUpdate) {\n this.emitUpdate()\n }\n })\n )\n }\n\n emitUpdate() {\n this.inboxSubject.next(this.lastEmittedValue)\n }\n\n flagAsRead(\n code: number | string\n ): Observable<\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n > {\n return this._http\n .post<\n | InboxNotificationAmended\n | InboxNotificationHtml\n | InboxNotificationInstitutional\n | InboxNotificationPermission\n >(environment.BASE_URL + `inbox/${code}/read.json`, code, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap((data) => {\n this.lastEmittedValue.forEach((value) => {\n if (value.putCode === data.putCode) {\n value.readDate = data.readDate\n }\n })\n this.inboxSubject.next(this.lastEmittedValue)\n })\n )\n }\n\n retrieveUnreadCount(): any {\n return this._http.get(environment.BASE_URL + 'inbox/unreadCount.json')\n }\n\n totalNumber() {\n return this._http\n .get(\n environment.BASE_URL + `inbox/totalCount.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n map((value) => {\n value.archived = value.all - value.nonArchived\n return value\n }),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -18310,7 +18310,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Injectable } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { retry, catchError, switchMap, tap } from 'rxjs/operators'\nimport { of } from 'rxjs'\nimport { ERROR_REPORT } from 'src/app/errors'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LanguageService {\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n changeLanguage(languageCode: string) {\n languageCode = languageCode.toLocaleLowerCase().replace('-', '_')\n\n return of({}).pipe(\n // If the language is not listed on the current frontend environment it wont attempt to change it\n tap(() => {\n if (!environment.production) {\n {\n throw new Error(`change-language-require-production-mode`)\n }\n }\n if (\n !Object.keys(environment.LANGUAGE_MENU_OPTIONS).find(\n (x) => x.toLocaleLowerCase().replace('-', '_') === languageCode\n )\n ) {\n throw new Error(`invalid-language-code-${languageCode}`)\n }\n }),\n switchMap(() =>\n this._http\n .get(environment.API_WEB + 'lang.json?lang=' + languageCode)\n .pipe(retry(3))\n ),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n}\n", + "sourceCode": "import { Injectable } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { retry, catchError, switchMap, tap } from 'rxjs/operators'\nimport { of } from 'rxjs'\nimport { ERROR_REPORT } from 'src/app/errors'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LanguageService {\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n changeLanguage(languageCode: string) {\n languageCode = languageCode.toLocaleLowerCase().replace('-', '_')\n\n return of({}).pipe(\n // If the language is not listed on the current frontend environment it wont attempt to change it\n tap(() => {\n if (!environment.production) {\n {\n throw new Error(`change-language-require-production-mode`)\n }\n }\n if (\n !Object.keys(environment.LANGUAGE_MENU_OPTIONS).find(\n (x) => x.toLocaleLowerCase().replace('-', '_') === languageCode\n )\n ) {\n throw new Error(`invalid-language-code-${languageCode}`)\n }\n }),\n switchMap(() =>\n this._http\n .get(environment.API_WEB + 'lang.json?lang=' + languageCode)\n .pipe(retry(3))\n ),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -18491,7 +18491,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, flatMap, retry } from 'rxjs/operators'\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\nimport { environment } from 'src/environments/environment'\nimport { Parser } from 'xml2js'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NewsService {\n environment\n parser = new Parser()\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n getNews() {\n const url = environment.API_NEWS\n // Get the news!\n return this._http.get(url, { responseType: 'text' }).pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n flatMap(\n (data) =>\n new Observable((observer) => {\n // TODO: It might be possible to return the news response as a JSON from the backend\n // to avoid adding XML2JS in to production bundle.\n this.parser.parseString(data, (error, parsedData) => {\n if (!error) {\n if (\n parsedData &&\n parsedData.rss &&\n parsedData.rss.channel &&\n parsedData.rss.channel[0] &&\n parsedData.rss.channel[0].item\n ) {\n observer.next(\n parsedData.rss.channel[0].item.filter((item, index) => {\n return index < 6\n })\n )\n } else {\n this._errorHandler.xml2jsParser('invalid data response')\n }\n } else {\n this._errorHandler.xml2jsParser(error)\n }\n })\n })\n )\n )\n }\n}\n", + "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { catchError, flatMap, retry } from 'rxjs/operators'\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\n\nimport { Parser } from 'xml2js'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NewsService {\n environment\n parser = new Parser()\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n getNews() {\n const url = environment.API_NEWS\n // Get the news!\n return this._http.get(url, { responseType: 'text' }).pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n flatMap(\n (data) =>\n new Observable((observer) => {\n // TODO: It might be possible to return the news response as a JSON from the backend\n // to avoid adding XML2JS in to production bundle.\n this.parser.parseString(data, (error, parsedData) => {\n if (!error) {\n if (\n parsedData &&\n parsedData.rss &&\n parsedData.rss.channel &&\n parsedData.rss.channel[0] &&\n parsedData.rss.channel[0].item\n ) {\n observer.next(\n parsedData.rss.channel[0].item.filter((item, index) => {\n return index < 6\n })\n )\n } else {\n this._errorHandler.xml2jsParser('invalid data response')\n }\n } else {\n this._errorHandler.xml2jsParser(error)\n }\n })\n })\n )\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -19083,7 +19083,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Injectable } from '@angular/core'\nimport { Meta, Title } from '@angular/platform-browser'\nimport { NamesEndPoint } from 'src/app/types/record-name.endpoint'\nimport { UserRecord } from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\nimport { TitleService } from '../title-service/title.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class OpenGraphService {\n openGraphDataSet = false\n private titleMeta = 'og:title'\n private descriptionMeta = 'og:description'\n private imageMeta = 'og:image'\n private typeMeta = 'og:type'\n private urlMeta = 'og:url'\n private firstNameMeta = 'profile:first_name'\n private lastNameMeta = 'profile:last_name'\n private usernameMeta = 'profile:username'\n private siteNameMeta = 'og:site_name'\n\n constructor(private meta: Meta, private _titleService: TitleService) {}\n\n addOpenGraphData(\n record: UserRecord,\n options?: { force?: boolean }\n ): HTMLMetaElement[] {\n if (\n record.userInfo &&\n record.names !== undefined &&\n record.userInfo !== undefined &&\n !record.userInfo.RECORD_WITH_ISSUES &&\n (!this.openGraphDataSet || options.force)\n ) {\n this.removeOpenGraphData()\n this.openGraphDataSet = true\n try {\n const { displayedNameWithId, displayedName } = this.getDisplayNames(\n record.names,\n record.userInfo.EFFECTIVE_USER_ORCID\n )\n if (\n displayedNameWithId !== undefined &&\n displayedNameWithId !== 'undefined'\n ) {\n this._titleService.setDisplayName(displayedNameWithId)\n }\n return this.meta.addTags([\n { property: this.titleMeta, content: displayedNameWithId },\n {\n property: this.descriptionMeta,\n content:\n $localize`:@@record.ogDescription1:ORCID record for` +\n ` ` +\n (displayedName || displayedNameWithId) +\n `. ` +\n $localize`:@@record.ogDescription2:ORCID provides an identifier for individuals to use with their name as they engage in research, scholarship, and innovation activities.`,\n },\n\n { property: this.typeMeta, content: 'profile' },\n {\n property: this.urlMeta,\n content:\n 'https:' +\n environment.BASE_URL +\n record.userInfo.EFFECTIVE_USER_ORCID,\n },\n {\n property: this.firstNameMeta,\n content: record.names?.givenNames?.value || '',\n },\n {\n property: this.lastNameMeta,\n content: record.names?.familyName?.value || '',\n },\n {\n property: this.usernameMeta,\n content: record.userInfo.EFFECTIVE_USER_ORCID,\n },\n { property: this.siteNameMeta, content: 'ORCID' },\n {\n property: this.imageMeta,\n content:\n 'https:' + environment.BASE_URL + 'assets/img/orcid-og-image.png',\n },\n ])\n } catch (e) {\n this.openGraphDataSet = false\n }\n }\n }\n private getDisplayNames(\n recordNames: NamesEndPoint,\n effectiveID: string\n ): { displayedNameWithId: string; displayedName: string } {\n let displayedName = ''\n if (recordNames?.creditName) {\n displayedName = recordNames.creditName.value\n } else if (\n recordNames?.givenNames?.value &&\n recordNames?.familyName?.value\n ) {\n displayedName = `${recordNames.givenNames.value} ${recordNames.familyName.value}`\n } else if (recordNames?.givenNames?.value) {\n displayedName = `${recordNames.givenNames.value}`\n }\n\n displayedName = displayedName.trim()\n let displayedNameWithId = ''\n if (displayedName !== '') {\n displayedNameWithId = `${displayedName} (${effectiveID})`\n } else {\n displayedNameWithId = `${effectiveID}`\n }\n return { displayedNameWithId, displayedName }\n }\n\n removeOpenGraphData() {\n this.meta.removeTag(`property=\"${this.titleMeta}\"`)\n this.meta.removeTag(`property=\"${this.descriptionMeta}\"`)\n this.meta.removeTag(`property=\"${this.imageMeta}\"`)\n this.meta.removeTag(`property=\"${this.typeMeta}\"`)\n this.meta.removeTag(`property=\"${this.urlMeta}\"`)\n this.meta.removeTag(`property=\"${this.firstNameMeta}\"`)\n this.meta.removeTag(`property=\"${this.lastNameMeta}\"`)\n this.meta.removeTag(`property=\"${this.usernameMeta}\"`)\n this.meta.removeTag(`property=\"${this.siteNameMeta}\"`)\n this.openGraphDataSet = false\n }\n}\n", + "sourceCode": "import { Injectable } from '@angular/core'\nimport { Meta, Title } from '@angular/platform-browser'\nimport { NamesEndPoint } from 'src/app/types/record-name.endpoint'\nimport { UserRecord } from 'src/app/types/record.local'\n\nimport { TitleService } from '../title-service/title.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class OpenGraphService {\n openGraphDataSet = false\n private titleMeta = 'og:title'\n private descriptionMeta = 'og:description'\n private imageMeta = 'og:image'\n private typeMeta = 'og:type'\n private urlMeta = 'og:url'\n private firstNameMeta = 'profile:first_name'\n private lastNameMeta = 'profile:last_name'\n private usernameMeta = 'profile:username'\n private siteNameMeta = 'og:site_name'\n\n constructor(private meta: Meta, private _titleService: TitleService) {}\n\n addOpenGraphData(\n record: UserRecord,\n options?: { force?: boolean }\n ): HTMLMetaElement[] {\n if (\n record.userInfo &&\n record.names !== undefined &&\n record.userInfo !== undefined &&\n !record.userInfo.RECORD_WITH_ISSUES &&\n (!this.openGraphDataSet || options.force)\n ) {\n this.removeOpenGraphData()\n this.openGraphDataSet = true\n try {\n const { displayedNameWithId, displayedName } = this.getDisplayNames(\n record.names,\n record.userInfo.EFFECTIVE_USER_ORCID\n )\n if (\n displayedNameWithId !== undefined &&\n displayedNameWithId !== 'undefined'\n ) {\n this._titleService.setDisplayName(displayedNameWithId)\n }\n return this.meta.addTags([\n { property: this.titleMeta, content: displayedNameWithId },\n {\n property: this.descriptionMeta,\n content:\n $localize`:@@record.ogDescription1:ORCID record for` +\n ` ` +\n (displayedName || displayedNameWithId) +\n `. ` +\n $localize`:@@record.ogDescription2:ORCID provides an identifier for individuals to use with their name as they engage in research, scholarship, and innovation activities.`,\n },\n\n { property: this.typeMeta, content: 'profile' },\n {\n property: this.urlMeta,\n content:\n 'https:' +\n environment.BASE_URL +\n record.userInfo.EFFECTIVE_USER_ORCID,\n },\n {\n property: this.firstNameMeta,\n content: record.names?.givenNames?.value || '',\n },\n {\n property: this.lastNameMeta,\n content: record.names?.familyName?.value || '',\n },\n {\n property: this.usernameMeta,\n content: record.userInfo.EFFECTIVE_USER_ORCID,\n },\n { property: this.siteNameMeta, content: 'ORCID' },\n {\n property: this.imageMeta,\n content:\n 'https:' + environment.BASE_URL + 'assets/img/orcid-og-image.png',\n },\n ])\n } catch (e) {\n this.openGraphDataSet = false\n }\n }\n }\n private getDisplayNames(\n recordNames: NamesEndPoint,\n effectiveID: string\n ): { displayedNameWithId: string; displayedName: string } {\n let displayedName = ''\n if (recordNames?.creditName) {\n displayedName = recordNames.creditName.value\n } else if (\n recordNames?.givenNames?.value &&\n recordNames?.familyName?.value\n ) {\n displayedName = `${recordNames.givenNames.value} ${recordNames.familyName.value}`\n } else if (recordNames?.givenNames?.value) {\n displayedName = `${recordNames.givenNames.value}`\n }\n\n displayedName = displayedName.trim()\n let displayedNameWithId = ''\n if (displayedName !== '') {\n displayedNameWithId = `${displayedName} (${effectiveID})`\n } else {\n displayedNameWithId = `${effectiveID}`\n }\n return { displayedNameWithId, displayedName }\n }\n\n removeOpenGraphData() {\n this.meta.removeTag(`property=\"${this.titleMeta}\"`)\n this.meta.removeTag(`property=\"${this.descriptionMeta}\"`)\n this.meta.removeTag(`property=\"${this.imageMeta}\"`)\n this.meta.removeTag(`property=\"${this.typeMeta}\"`)\n this.meta.removeTag(`property=\"${this.urlMeta}\"`)\n this.meta.removeTag(`property=\"${this.firstNameMeta}\"`)\n this.meta.removeTag(`property=\"${this.lastNameMeta}\"`)\n this.meta.removeTag(`property=\"${this.usernameMeta}\"`)\n this.meta.removeTag(`property=\"${this.siteNameMeta}\"`)\n this.openGraphDataSet = false\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -19359,7 +19359,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Injectable } from '@angular/core'\nimport { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { PasswordRecovery } from 'src/app/types'\nimport { environment } from 'src/environments/environment'\nimport { retry, catchError } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport {\n ResetPasswordEmailForm,\n ResetPasswordEmailFormValidate,\n} from 'src/app/types/reset-password.endpoint'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PasswordRecoveryService {\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n resetPassword(data) {\n return this._http\n .post(\n environment.API_WEB + `reset-password.json`,\n data,\n { withCredentials: true }\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(\n error,\n ERROR_REPORT.RESET_PASSWORD_COULD_NOT_RECOVER\n )\n )\n )\n }\n\n remindOrcidId(data) {\n return this._http\n .post(environment.API_WEB + `forgot-id.json`, data, {\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(\n error,\n ERROR_REPORT.RESET_PASSWORD_COULD_NOT_RECOVER\n )\n )\n )\n }\n\n resetPasswordEmail(resetPassword: ResetPasswordEmailForm) {\n let encodedData = JSON.stringify(resetPassword)\n return this._http\n .post(\n environment.API_WEB + `reset-password-email-v2.json`,\n encodedData,\n {\n headers: this.headers,\n withCredentials: true,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n resetPasswordEmailValidateToken(\n resetPassword: ResetPasswordEmailFormValidate\n ) {\n let encodedData = JSON.stringify(resetPassword)\n return this._http\n .post(\n environment.API_WEB + `reset-password-email-validate-token.json`,\n encodedData,\n {\n headers: this.headers,\n withCredentials: true,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { Injectable } from '@angular/core'\nimport { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { PasswordRecovery } from 'src/app/types'\n\nimport { retry, catchError } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport {\n ResetPasswordEmailForm,\n ResetPasswordEmailFormValidate,\n} from 'src/app/types/reset-password.endpoint'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PasswordRecoveryService {\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n resetPassword(data) {\n return this._http\n .post(\n environment.API_WEB + `reset-password.json`,\n data,\n { withCredentials: true }\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(\n error,\n ERROR_REPORT.RESET_PASSWORD_COULD_NOT_RECOVER\n )\n )\n )\n }\n\n remindOrcidId(data) {\n return this._http\n .post(environment.API_WEB + `forgot-id.json`, data, {\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(\n error,\n ERROR_REPORT.RESET_PASSWORD_COULD_NOT_RECOVER\n )\n )\n )\n }\n\n resetPasswordEmail(resetPassword: ResetPasswordEmailForm) {\n let encodedData = JSON.stringify(resetPassword)\n return this._http\n .post(\n environment.API_WEB + `reset-password-email-v2.json`,\n encodedData,\n {\n headers: this.headers,\n withCredentials: true,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n resetPasswordEmailValidateToken(\n resetPassword: ResetPasswordEmailFormValidate\n ) {\n let encodedData = JSON.stringify(resetPassword)\n return this._http\n .post(\n environment.API_WEB + `reset-password-email-validate-token.json`,\n encodedData,\n {\n headers: this.headers,\n withCredentials: true,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -20259,7 +20259,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'\nimport { catchError, map, retry, switchMap, tap } from 'rxjs/operators'\nimport {\n AffiliationUIGroup,\n AffiliationsEndpoint,\n Affiliation,\n Organization,\n DisambiguatedOrganization,\n EmploymentsEndpoint,\n} from 'src/app/types/record-affiliation.endpoint'\nimport { environment } from 'src/environments/environment'\n\nimport { AffiliationsSortService } from '../record-affiliations-sort/record-affiliations-sort.service'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordAffiliationsGroupingService } from '../record-affiliations-affiliations-grouping/record-affiliations-grouping.service'\nimport { cloneDeep } from 'lodash'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport { VisibilityStrings } from '../../types/common.endpoint'\nimport { getAffiliationType } from '../../constants'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordAffiliationService {\n lastEmittedValue: AffiliationUIGroup[]\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n $affiliations: ReplaySubject\n private _$loading = new BehaviorSubject(true)\n public get $loading() {\n return this._$loading.asObservable()\n }\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _affiliationsGroupingService: RecordAffiliationsGroupingService,\n private _affiliationsSortService: AffiliationsSortService\n ) {}\n\n getAffiliations(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ): Observable {\n if (!this.$affiliations) {\n this.$affiliations = new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$affiliations\n }\n\n if (options.cleanCacheIfExist && this.$affiliations) {\n this.$affiliations.next(undefined)\n }\n\n this._$loading.next(true)\n this.getGroupAndSortAffiliations(options)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of([])),\n tap((value) => {\n this._$loading.next(false)\n this.lastEmittedValue = cloneDeep(value)\n this.$affiliations.next(value)\n })\n )\n .subscribe()\n\n return this.$affiliations.asObservable()\n }\n\n // Getting the \"affiliations details\" seems like a waste of network resources.\n // This will only return a url which on the first call comes as null.\n getAffiliationsDetails(\n type,\n putCode,\n options?: UserRecordOptions\n ): Observable {\n return this.getAffiliationDetails(putCode, type, options).pipe(\n tap((data) => {\n if (data && data.url && data.url.value) {\n this.lastEmittedValue.forEach((affiliations) => {\n affiliations.affiliationGroup.map((affiliationsStack) => {\n affiliationsStack.affiliations.map((affiliation) => {\n if (\n affiliation.affiliationType.value === type &&\n affiliation.putCode.value === putCode\n ) {\n affiliation.url.value = data.url.value\n }\n })\n })\n })\n }\n this.$affiliations.next(this.lastEmittedValue)\n }),\n switchMap(() => {\n return this.$affiliations.asObservable()\n })\n )\n }\n\n private getAffiliationDetails(\n putCode,\n type,\n options?: UserRecordOptions\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `${\n options?.publicRecordId\n ? options?.publicRecordId + '/'\n : 'affiliations/'\n }affiliationDetails.json?id=${putCode}&type=${type}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n private getGroupAndSortAffiliations(\n options: UserRecordOptions\n ): Observable {\n if (options.publicRecordId) {\n return this._http\n .get(\n environment.API_WEB +\n `${options.publicRecordId}/affiliationGroups.json`\n )\n .pipe(\n retry(3),\n map((data) => this._affiliationsGroupingService.transform(data)),\n map((data) => this._affiliationsSortService.transform(data)),\n catchError((error) => this._errorHandler.handleError(error))\n )\n } else {\n return this._http\n .get(\n environment.API_WEB + `affiliations/affiliationGroups.json`\n )\n .pipe(\n retry(3),\n map((data) => this._affiliationsGroupingService.transform(data)),\n map((data) => this._affiliationsSortService.transform(data)),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n }\n\n changeUserRecordContext(userRecordContext: UserRecordOptions, type: string) {\n const professionalActivities = this.lastEmittedValue.find(\n (profileAffiliation) =>\n profileAffiliation.type === 'PROFESSIONAL_ACTIVITIES'\n )\n const lastEmittedProfessional = [\n ...getAffiliationType(\n this.lastEmittedValue,\n 'INVITED_POSITION_AND_DISTINCTION'\n ).affiliationGroup,\n ...getAffiliationType(this.lastEmittedValue, 'MEMBERSHIP_AND_SERVICE')\n .affiliationGroup,\n ]\n\n if (professionalActivities) {\n professionalActivities.affiliationGroup = lastEmittedProfessional\n } else {\n this.lastEmittedValue.push({\n type: 'PROFESSIONAL_ACTIVITIES',\n affiliationGroup: lastEmittedProfessional,\n })\n }\n const value = this._affiliationsSortService.transform(\n this.lastEmittedValue,\n userRecordContext,\n type\n )\n this.lastEmittedValue = cloneDeep(value)\n this.$affiliations.next(value)\n }\n\n postAffiliation(affiliation): Observable {\n return this._http\n .post(\n environment.API_WEB + 'affiliations/affiliation.json',\n affiliation,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAffiliations({ forceReload: true }))\n )\n }\n\n getOrganization(org: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'affiliations/disambiguated/name/' +\n org +\n '?limit=100',\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getOrganizationDisambiguated(\n id: string\n ): Observable {\n return this._http\n .get(\n environment.API_WEB + 'affiliations/disambiguated/id/' + id,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n updateVisibility(\n putCode: string,\n visibility: VisibilityStrings\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'affiliations/' +\n putCode +\n '/visibility/' +\n visibility\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAffiliations({ forceReload: true }))\n )\n }\n\n delete(putCode: string): Observable {\n return this._http\n .delete(\n environment.API_WEB +\n 'affiliations/affiliation.json' +\n '?id=' +\n encodeURIComponent(putCode)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAffiliations({ forceReload: true }))\n )\n }\n\n updatePreferredSource(putCode: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'affiliations/updateToMaxDisplay.json?putCode=' +\n putCode\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAffiliations({ forceReload: true }))\n )\n }\n\n getEmployments(): Observable {\n return this._http\n .get(\n environment.API_WEB + 'affiliations/employments.json',\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'\nimport { catchError, map, retry, switchMap, tap } from 'rxjs/operators'\nimport {\n AffiliationUIGroup,\n AffiliationsEndpoint,\n Affiliation,\n Organization,\n DisambiguatedOrganization,\n EmploymentsEndpoint,\n} from 'src/app/types/record-affiliation.endpoint'\n\n\nimport { AffiliationsSortService } from '../record-affiliations-sort/record-affiliations-sort.service'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordAffiliationsGroupingService } from '../record-affiliations-affiliations-grouping/record-affiliations-grouping.service'\nimport { cloneDeep } from 'lodash'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport { VisibilityStrings } from '../../types/common.endpoint'\nimport { getAffiliationType } from '../../constants'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordAffiliationService {\n lastEmittedValue: AffiliationUIGroup[]\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n $affiliations: ReplaySubject\n private _$loading = new BehaviorSubject(true)\n public get $loading() {\n return this._$loading.asObservable()\n }\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _affiliationsGroupingService: RecordAffiliationsGroupingService,\n private _affiliationsSortService: AffiliationsSortService\n ) {}\n\n getAffiliations(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ): Observable {\n if (!this.$affiliations) {\n this.$affiliations = new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$affiliations\n }\n\n if (options.cleanCacheIfExist && this.$affiliations) {\n this.$affiliations.next(undefined)\n }\n\n this._$loading.next(true)\n this.getGroupAndSortAffiliations(options)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of([])),\n tap((value) => {\n this._$loading.next(false)\n this.lastEmittedValue = cloneDeep(value)\n this.$affiliations.next(value)\n })\n )\n .subscribe()\n\n return this.$affiliations.asObservable()\n }\n\n // Getting the \"affiliations details\" seems like a waste of network resources.\n // This will only return a url which on the first call comes as null.\n getAffiliationsDetails(\n type,\n putCode,\n options?: UserRecordOptions\n ): Observable {\n return this.getAffiliationDetails(putCode, type, options).pipe(\n tap((data) => {\n if (data && data.url && data.url.value) {\n this.lastEmittedValue.forEach((affiliations) => {\n affiliations.affiliationGroup.map((affiliationsStack) => {\n affiliationsStack.affiliations.map((affiliation) => {\n if (\n affiliation.affiliationType.value === type &&\n affiliation.putCode.value === putCode\n ) {\n affiliation.url.value = data.url.value\n }\n })\n })\n })\n }\n this.$affiliations.next(this.lastEmittedValue)\n }),\n switchMap(() => {\n return this.$affiliations.asObservable()\n })\n )\n }\n\n private getAffiliationDetails(\n putCode,\n type,\n options?: UserRecordOptions\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `${\n options?.publicRecordId\n ? options?.publicRecordId + '/'\n : 'affiliations/'\n }affiliationDetails.json?id=${putCode}&type=${type}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n private getGroupAndSortAffiliations(\n options: UserRecordOptions\n ): Observable {\n if (options.publicRecordId) {\n return this._http\n .get(\n environment.API_WEB +\n `${options.publicRecordId}/affiliationGroups.json`\n )\n .pipe(\n retry(3),\n map((data) => this._affiliationsGroupingService.transform(data)),\n map((data) => this._affiliationsSortService.transform(data)),\n catchError((error) => this._errorHandler.handleError(error))\n )\n } else {\n return this._http\n .get(\n environment.API_WEB + `affiliations/affiliationGroups.json`\n )\n .pipe(\n retry(3),\n map((data) => this._affiliationsGroupingService.transform(data)),\n map((data) => this._affiliationsSortService.transform(data)),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n }\n\n changeUserRecordContext(userRecordContext: UserRecordOptions, type: string) {\n const professionalActivities = this.lastEmittedValue.find(\n (profileAffiliation) =>\n profileAffiliation.type === 'PROFESSIONAL_ACTIVITIES'\n )\n const lastEmittedProfessional = [\n ...getAffiliationType(\n this.lastEmittedValue,\n 'INVITED_POSITION_AND_DISTINCTION'\n ).affiliationGroup,\n ...getAffiliationType(this.lastEmittedValue, 'MEMBERSHIP_AND_SERVICE')\n .affiliationGroup,\n ]\n\n if (professionalActivities) {\n professionalActivities.affiliationGroup = lastEmittedProfessional\n } else {\n this.lastEmittedValue.push({\n type: 'PROFESSIONAL_ACTIVITIES',\n affiliationGroup: lastEmittedProfessional,\n })\n }\n const value = this._affiliationsSortService.transform(\n this.lastEmittedValue,\n userRecordContext,\n type\n )\n this.lastEmittedValue = cloneDeep(value)\n this.$affiliations.next(value)\n }\n\n postAffiliation(affiliation): Observable {\n return this._http\n .post(\n environment.API_WEB + 'affiliations/affiliation.json',\n affiliation,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAffiliations({ forceReload: true }))\n )\n }\n\n getOrganization(org: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'affiliations/disambiguated/name/' +\n org +\n '?limit=100',\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getOrganizationDisambiguated(\n id: string\n ): Observable {\n return this._http\n .get(\n environment.API_WEB + 'affiliations/disambiguated/id/' + id,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n updateVisibility(\n putCode: string,\n visibility: VisibilityStrings\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'affiliations/' +\n putCode +\n '/visibility/' +\n visibility\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAffiliations({ forceReload: true }))\n )\n }\n\n delete(putCode: string): Observable {\n return this._http\n .delete(\n environment.API_WEB +\n 'affiliations/affiliation.json' +\n '?id=' +\n encodeURIComponent(putCode)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAffiliations({ forceReload: true }))\n )\n }\n\n updatePreferredSource(putCode: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'affiliations/updateToMaxDisplay.json?putCode=' +\n putCode\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAffiliations({ forceReload: true }))\n )\n }\n\n getEmployments(): Observable {\n return this._http\n .get(\n environment.API_WEB + 'affiliations/employments.json',\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -20698,7 +20698,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { forkJoin, merge, Observable, of, ReplaySubject } from 'rxjs'\nimport { retry, catchError, tap, map, take } from 'rxjs/operators'\nimport { CountriesEndpoint } from 'src/app/types/record-country.endpoint'\nimport {\n SideBarPublicUserRecord,\n UserRecordOptions,\n} from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordCountriesService {\n $addresses: ReplaySubject\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _recordPublicSidebar: RecordPublicSideBarService\n ) {}\n\n getCountryCodes(): Observable<{ key: string; value: string }[]> {\n return of([\n { key: $localize`:@@share.af:Afghanistan`, value: 'AF' },\n { key: $localize`:@@share.AL:Albania`, value: 'AL' },\n { key: $localize`:@@share.DZ:Algeria`, value: 'DZ' },\n { key: $localize`:@@share.AS:American Samoa`, value: 'AS' },\n { key: $localize`:@@share.AD:Andorra`, value: 'AD' },\n { key: $localize`:@@share.AO:Angola`, value: 'AO' },\n { key: $localize`:@@share.AI:Anguilla`, value: 'AI' },\n { key: $localize`:@@share.AQ:Antarctica`, value: 'AQ' },\n { key: $localize`:@@share.AG:Antigua and Barbuda`, value: 'AG' },\n { key: $localize`:@@share.AR:Argentina`, value: 'AR' },\n { key: $localize`:@@share.AM:Armenia`, value: 'AM' },\n { key: $localize`:@@share.AW:Aruba`, value: 'AW' },\n { key: $localize`:@@share.AU:Australia`, value: 'AU' },\n { key: $localize`:@@share.AT:Austria`, value: 'AT' },\n { key: $localize`:@@share.AZ:Azerbaijan`, value: 'AZ' },\n { key: $localize`:@@share.BS:Bahamas`, value: 'BS' },\n { key: $localize`:@@share.BH:Bahrain`, value: 'BH' },\n { key: $localize`:@@share.BD:Bangladesh`, value: 'BD' },\n { key: $localize`:@@share.BB:Barbados`, value: 'BB' },\n { key: $localize`:@@share.BY:Belarus`, value: 'BY' },\n { key: $localize`:@@share.BE:Belgium`, value: 'BE' },\n { key: $localize`:@@share.BZ:Belize`, value: 'BZ' },\n { key: $localize`:@@share.BJ:Benin`, value: 'BJ' },\n { key: $localize`:@@share.BM:Bermuda`, value: 'BM' },\n { key: $localize`:@@share.BT:Bhutan`, value: 'BT' },\n { key: $localize`:@@share.BO:Bolivia`, value: 'BO' },\n { key: $localize`:@@share.BA:Bosnia and Herzegovina`, value: 'BA' },\n { key: $localize`:@@share.BW:Botswana`, value: 'BW' },\n { key: $localize`:@@share.BV:Bouvet Island`, value: 'BV' },\n { key: $localize`:@@share.BR:Brazil`, value: 'BR' },\n { key: $localize`:@@share.BQ:British Antarctic Territory`, value: 'BQ' },\n {\n key: $localize`:@@share.IO:British Indian Ocean Territory`,\n value: 'IO',\n },\n { key: $localize`:@@share.VG:British Virgin Islands`, value: 'VG' },\n { key: $localize`:@@share.BN:Brunei`, value: 'BN' },\n { key: $localize`:@@share.BG:Bulgaria`, value: 'BG' },\n { key: $localize`:@@share.BF:Burkina Faso`, value: 'BF' },\n { key: $localize`:@@share.BI:Burundi`, value: 'BI' },\n { key: $localize`:@@share.KH:Cambodia`, value: 'KH' },\n { key: $localize`:@@share.CM:Cameroon`, value: 'CM' },\n { key: $localize`:@@share.CA:Canada`, value: 'CA' },\n { key: $localize`:@@share.CV:Cape Verde`, value: 'CV' },\n { key: $localize`:@@share.KY:Cayman Islands`, value: 'KY' },\n { key: $localize`:@@share.CF:Central African Republic`, value: 'CF' },\n { key: $localize`:@@share.TD:Chad`, value: 'TD' },\n { key: $localize`:@@share.CL:Chile`, value: 'CL' },\n { key: $localize`:@@share.CN:China`, value: 'CN' },\n { key: $localize`:@@share.CX:Christmas Island`, value: 'CX' },\n { key: $localize`:@@share.CC:Cocos [Keeling] Islands`, value: 'CC' },\n { key: $localize`:@@share.CO:Colombia`, value: 'CO' },\n { key: $localize`:@@share.KM:Comoros`, value: 'KM' },\n { key: $localize`:@@share.CG:Congo - Brazzaville`, value: 'CG' },\n { key: $localize`:@@share.CD:Congo - Kinshasa`, value: 'CD' },\n { key: $localize`:@@share.CK:Cook Islands`, value: 'CK' },\n { key: $localize`:@@share.CR:Costa Rica`, value: 'CR' },\n { key: $localize`:@@share.HR:Croatia`, value: 'HR' },\n { key: $localize`:@@share.CU:Cuba`, value: 'CU' },\n { key: $localize`:@@share.CW:Curaçao`, value: 'CW' },\n { key: $localize`:@@share.CY:Cyprus`, value: 'CY' },\n { key: $localize`:@@share.CZ:Czech Republic`, value: 'CZ' },\n { key: $localize`:@@share.CI:Côte d'Ivoire`, value: 'CI' },\n { key: $localize`:@@share.DK:Denmark`, value: 'DK' },\n { key: $localize`:@@share.DJ:Djibouti`, value: 'DJ' },\n { key: $localize`:@@share.DM:Dominica`, value: 'DM' },\n { key: $localize`:@@share.DO:Dominican Republic`, value: 'DO' },\n { key: $localize`:@@share.EC:Ecuador`, value: 'EC' },\n { key: $localize`:@@share.EG:Egypt`, value: 'EG' },\n { key: $localize`:@@share.SV:El Salvador`, value: 'SV' },\n { key: $localize`:@@share.GQ:Equatorial Guinea`, value: 'GQ' },\n { key: $localize`:@@share.ER:Eritrea`, value: 'ER' },\n { key: $localize`:@@share.EE:Estonia`, value: 'EE' },\n { key: $localize`:@@share.ET:Ethiopia`, value: 'ET' },\n { key: $localize`:@@share.FK:Falkland Islands`, value: 'FK' },\n { key: $localize`:@@share.FO:Faroe Islands`, value: 'FO' },\n { key: $localize`:@@share.FJ:Fiji`, value: 'FJ' },\n { key: $localize`:@@share.FI:Finland`, value: 'FI' },\n { key: $localize`:@@share.FR:France`, value: 'FR' },\n { key: $localize`:@@share.GF:French Guiana`, value: 'GF' },\n { key: $localize`:@@share.PF:French Polynesia`, value: 'PF' },\n { key: $localize`:@@share.TF:French Southern Territories`, value: 'TF' },\n { key: $localize`:@@share.GA:Gabon`, value: 'GA' },\n { key: $localize`:@@share.GM:Gambia`, value: 'GM' },\n { key: $localize`:@@share.GE:Georgia`, value: 'GE' },\n { key: $localize`:@@share.DE:Germany`, value: 'DE' },\n { key: $localize`:@@share.GH:Ghana`, value: 'GH' },\n { key: $localize`:@@share.GI:Gibraltar`, value: 'GI' },\n { key: $localize`:@@share.GR:Greece`, value: 'GR' },\n { key: $localize`:@@share.GL:Greenland`, value: 'GL' },\n { key: $localize`:@@share.GD:Grenada`, value: 'GD' },\n { key: $localize`:@@share.GP:Guadeloupe`, value: 'GP' },\n { key: $localize`:@@share.GU:Guam`, value: 'GU' },\n { key: $localize`:@@share.GT:Guatemala`, value: 'GT' },\n { key: $localize`:@@share.GG:Guernsey`, value: 'GG' },\n { key: $localize`:@@share.GN:Guinea`, value: 'GN' },\n { key: $localize`:@@share.GW:Guinea-Bissau`, value: 'GW' },\n { key: $localize`:@@share.GY:Guyana`, value: 'GY' },\n { key: $localize`:@@share.HT:Haiti`, value: 'HT' },\n {\n key: $localize`:@@share.HM:Heard Island and McDonald Islands`,\n value: 'HM',\n },\n { key: $localize`:@@share.HN:Honduras`, value: 'HN' },\n { key: $localize`:@@share.HK:Hong Kong SAR China`, value: 'HK' },\n { key: $localize`:@@share.HU:Hungary`, value: 'HU' },\n { key: $localize`:@@share.IS:Iceland`, value: 'IS' },\n { key: $localize`:@@share.IN:India`, value: 'IN' },\n { key: $localize`:@@share.ID:Indonesia`, value: 'ID' },\n { key: $localize`:@@share.IR:Iran`, value: 'IR' },\n { key: $localize`:@@share.IQ:Iraq`, value: 'IQ' },\n { key: $localize`:@@share.IE:Ireland`, value: 'IE' },\n { key: $localize`:@@share.IM:Isle of Man`, value: 'IM' },\n { key: $localize`:@@share.IL:Israel`, value: 'IL' },\n { key: $localize`:@@share.IT:Italy`, value: 'IT' },\n { key: $localize`:@@share.JM:Jamaica`, value: 'JM' },\n { key: $localize`:@@share.JP:Japan`, value: 'JP' },\n { key: $localize`:@@share.JE:Jersey`, value: 'JE' },\n { key: $localize`:@@share.JO:Jordan`, value: 'JO' },\n { key: $localize`:@@share.KZ:Kazakhstan`, value: 'KZ' },\n { key: $localize`:@@share.KE:Kenya`, value: 'KE' },\n { key: $localize`:@@share.KI:Kiribati`, value: 'KI' },\n { key: $localize`:@@share.XK:Kosovo`, value: 'XK' },\n { key: $localize`:@@share.KW:Kuwait`, value: 'KW' },\n { key: $localize`:@@share.KG:Kyrgyzstan`, value: 'KG' },\n { key: $localize`:@@share.LA:Laos`, value: 'LA' },\n { key: $localize`:@@share.LV:Latvia`, value: 'LV' },\n { key: $localize`:@@share.LB:Lebanon`, value: 'LB' },\n { key: $localize`:@@share.LS:Lesotho`, value: 'LS' },\n { key: $localize`:@@share.LR:Liberia`, value: 'LR' },\n { key: $localize`:@@share.LY:Libya`, value: 'LY' },\n { key: $localize`:@@share.LI:Liechtenstein`, value: 'LI' },\n { key: $localize`:@@share.LT:Lithuania`, value: 'LT' },\n { key: $localize`:@@share.LU:Luxembourg`, value: 'LU' },\n { key: $localize`:@@share.MO:Macau SAR China`, value: 'MO' },\n { key: $localize`:@@share.MG:Madagascar`, value: 'MG' },\n { key: $localize`:@@share.MW:Malawi`, value: 'MW' },\n { key: $localize`:@@share.MY:Malaysia`, value: 'MY' },\n { key: $localize`:@@share.MV:Maldives`, value: 'MV' },\n { key: $localize`:@@share.ML:Mali`, value: 'ML' },\n { key: $localize`:@@share.MT:Malta`, value: 'MT' },\n { key: $localize`:@@share.MH:Marshall Islands`, value: 'MH' },\n { key: $localize`:@@share.MQ:Martinique`, value: 'MQ' },\n { key: $localize`:@@share.MR:Mauritania`, value: 'MR' },\n { key: $localize`:@@share.MU:Mauritius`, value: 'MU' },\n { key: $localize`:@@share.YT:Mayotte`, value: 'YT' },\n { key: $localize`:@@share.MX:Mexico`, value: 'MX' },\n { key: $localize`:@@share.FM:Micronesia`, value: 'FM' },\n { key: $localize`:@@share.MD:Moldova`, value: 'MD' },\n { key: $localize`:@@share.MC:Monaco`, value: 'MC' },\n { key: $localize`:@@share.MN:Mongolia`, value: 'MN' },\n { key: $localize`:@@share.ME:Montenegro`, value: 'ME' },\n { key: $localize`:@@share.MS:Montserrat`, value: 'MS' },\n { key: $localize`:@@share.MA:Morocco`, value: 'MA' },\n { key: $localize`:@@share.MZ:Mozambique`, value: 'MZ' },\n { key: $localize`:@@share.MM:Myanmar [Burma]`, value: 'MM' },\n { key: $localize`:@@share.NA:Namibia`, value: 'NA' },\n { key: $localize`:@@share.NR:Nauru`, value: 'NR' },\n { key: $localize`:@@share.NP:Nepal`, value: 'NP' },\n { key: $localize`:@@share.NL:Netherlands`, value: 'NL' },\n { key: $localize`:@@share.NC:New Caledonia`, value: 'NC' },\n { key: $localize`:@@share.NZ:New Zealand`, value: 'NZ' },\n { key: $localize`:@@share.NI:Nicaragua`, value: 'NI' },\n { key: $localize`:@@share.NE:Niger`, value: 'NE' },\n { key: $localize`:@@share.NG:Nigeria`, value: 'NG' },\n { key: $localize`:@@share.NU:Niue`, value: 'NU' },\n { key: $localize`:@@share.NF:Norfolk Island`, value: 'NF' },\n { key: $localize`:@@share.KP:North Korea`, value: 'KP' },\n { key: $localize`:@@share.MK:North Macedonia`, value: 'MK' },\n { key: $localize`:@@share.MP:Northern Mariana Islands`, value: 'MP' },\n { key: $localize`:@@share.NO:Norway`, value: 'NO' },\n { key: $localize`:@@share.OM:Oman`, value: 'OM' },\n { key: $localize`:@@share.PK:Pakistan`, value: 'PK' },\n { key: $localize`:@@share.PW:Palau`, value: 'PW' },\n { key: $localize`:@@share.PS:Palestinian Territories`, value: 'PS' },\n { key: $localize`:@@share.PA:Panama`, value: 'PA' },\n { key: $localize`:@@share.PG:Papua New Guinea`, value: 'PG' },\n { key: $localize`:@@share.PY:Paraguay`, value: 'PY' },\n { key: $localize`:@@share.PE:Peru`, value: 'PE' },\n { key: $localize`:@@share.PH:Philippines`, value: 'PH' },\n { key: $localize`:@@share.PN:Pitcairn Islands`, value: 'PN' },\n { key: $localize`:@@share.PL:Poland`, value: 'PL' },\n { key: $localize`:@@share.PT:Portugal`, value: 'PT' },\n { key: $localize`:@@share.PR:Puerto Rico`, value: 'PR' },\n { key: $localize`:@@share.QA:Qatar`, value: 'QA' },\n { key: $localize`:@@share.RO:Romania`, value: 'RO' },\n { key: $localize`:@@share.RU:Russia`, value: 'RU' },\n { key: $localize`:@@share.RW:Rwanda`, value: 'RW' },\n { key: $localize`:@@share.RE:Réunion`, value: 'RE' },\n { key: $localize`:@@share.BL:Saint Barthélemy`, value: 'BL' },\n { key: $localize`:@@share.SH:Saint Helena`, value: 'SH' },\n { key: $localize`:@@share.KN:Saint Kitts and Nevis`, value: 'KN' },\n { key: $localize`:@@share.LC:Saint Lucia`, value: 'LC' },\n { key: $localize`:@@share.MF:Saint Martin`, value: 'MF' },\n { key: $localize`:@@share.PM:Saint Pierre and Miquelon`, value: 'PM' },\n {\n key: $localize`:@@share.VC:Saint Vincent and the Grenadines`,\n value: 'VC',\n },\n { key: $localize`:@@share.WS:Samoa`, value: 'WS' },\n { key: $localize`:@@share.SM:San Marino`, value: 'SM' },\n { key: $localize`:@@share.SA:Saudi Arabia`, value: 'SA' },\n { key: $localize`:@@share.SN:Senegal`, value: 'SN' },\n { key: $localize`:@@share.RS:Serbia`, value: 'RS' },\n { key: $localize`:@@share.SC:Seychelles`, value: 'SC' },\n { key: $localize`:@@share.SL:Sierra Leone`, value: 'SL' },\n { key: $localize`:@@share.SG:Singapore`, value: 'SG' },\n { key: $localize`:@@share.SX:Sint Maarten (Dutch Part)`, value: 'SX' },\n { key: $localize`:@@share.SK:Slovakia`, value: 'SK' },\n { key: $localize`:@@share.SI:Slovenia`, value: 'SI' },\n { key: $localize`:@@share.SB:Solomon Islands`, value: 'SB' },\n { key: $localize`:@@share.SO:Somalia`, value: 'SO' },\n { key: $localize`:@@share.ZA:South Africa`, value: 'ZA' },\n {\n key: $localize`:@@share.GS:South Georgia and the South Sandwich Islands`,\n value: 'GS',\n },\n { key: $localize`:@@share.KR:South Korea`, value: 'KR' },\n { key: $localize`:@@share.SS:South Sudan`, value: 'SS' },\n { key: $localize`:@@share.ES:Spain`, value: 'ES' },\n { key: $localize`:@@share.LK:Sri Lanka`, value: 'LK' },\n { key: $localize`:@@share.SD:Sudan`, value: 'SD' },\n { key: $localize`:@@share.SR:Suriname`, value: 'SR' },\n { key: $localize`:@@share.SJ:Svalbard and Jan Mayen`, value: 'SJ' },\n { key: $localize`:@@share.SZ:Swaziland`, value: 'SZ' },\n { key: $localize`:@@share.SE:Sweden`, value: 'SE' },\n { key: $localize`:@@share.CH:Switzerland`, value: 'CH' },\n { key: $localize`:@@share.SY:Syria`, value: 'SY' },\n { key: $localize`:@@share.ST:São Tomé and Príncipe`, value: 'ST' },\n { key: $localize`:@@share.TW:Taiwan`, value: 'TW' },\n { key: $localize`:@@share.TJ:Tajikistan`, value: 'TJ' },\n { key: $localize`:@@share.TZ:Tanzania`, value: 'TZ' },\n { key: $localize`:@@share.TH:Thailand`, value: 'TH' },\n { key: $localize`:@@share.TL:Timor-Leste`, value: 'TL' },\n { key: $localize`:@@share.TG:Togo`, value: 'TG' },\n { key: $localize`:@@share.TK:Tokelau`, value: 'TK' },\n { key: $localize`:@@share.TO:Tonga`, value: 'TO' },\n { key: $localize`:@@share.TT:Trinidad and Tobago`, value: 'TT' },\n { key: $localize`:@@share.TN:Tunisia`, value: 'TN' },\n { key: $localize`:@@share.TR:Türkiye`, value: 'TR' },\n { key: $localize`:@@share.TM:Turkmenistan`, value: 'TM' },\n { key: $localize`:@@share.TC:Turks and Caicos Islands`, value: 'TC' },\n { key: $localize`:@@share.TV:Tuvalu`, value: 'TV' },\n { key: $localize`:@@share.UM:U.S. Minor Outlying Islands`, value: 'UM' },\n { key: $localize`:@@share.VI:U.S. Virgin Islands`, value: 'VI' },\n { key: $localize`:@@share.UG:Uganda`, value: 'UG' },\n { key: $localize`:@@share.UA:Ukraine`, value: 'UA' },\n { key: $localize`:@@share.AE:United Arab Emirates`, value: 'AE' },\n { key: $localize`:@@share.GB:United Kingdom`, value: 'GB' },\n { key: $localize`:@@share.US:United States`, value: 'US' },\n { key: $localize`:@@share.UY:Uruguay`, value: 'UY' },\n { key: $localize`:@@share.UZ:Uzbekistan`, value: 'UZ' },\n { key: $localize`:@@share.VU:Vanuatu`, value: 'VU' },\n { key: $localize`:@@share.VA:Vatican City`, value: 'VA' },\n { key: $localize`:@@share.VE:Venezuela`, value: 'VE' },\n { key: $localize`:@@share.VN:Vietnam`, value: 'VN' },\n { key: $localize`:@@share.WF:Wallis and Futuna`, value: 'WF' },\n { key: $localize`:@@share.EH:Western Sahara`, value: 'EH' },\n { key: $localize`:@@share.YE:Yemen`, value: 'YE' },\n { key: $localize`:@@share.ZM:Zambia`, value: 'ZM' },\n { key: $localize`:@@share.ZW:Zimbabwe`, value: 'ZW' },\n { key: $localize`:@@share.AX:Åland Islands`, value: 'AX' },\n ])\n }\n\n getAddresses(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ): Observable {\n if (options.publicRecordId) {\n return forkJoin([\n this._recordPublicSidebar.getPublicRecordSideBar(options).pipe(take(1)),\n this.getCountryCodes().pipe(take(1)),\n ]).pipe(\n map((value) => {\n const countries = value[0].countries\n const countryCodes = value[1]\n countries?.addresses.forEach((country) => {\n //Override backend country name translations\n country.countryName =\n countryCodes.find((x) => x.value === country.iso2Country.value)\n .key || ''\n })\n return countries\n })\n )\n }\n\n if (!this.$addresses) {\n this.$addresses = new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$addresses\n }\n if (options.cleanCacheIfExist && this.$addresses) {\n this.$addresses.next(undefined)\n }\n\n forkJoin([\n this._http\n .get(\n environment.API_WEB + `account/countryForm.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(take(1)),\n this.getCountryCodes().pipe(take(1)),\n ])\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of({ addresses: [] } as CountriesEndpoint)),\n tap((value) => {\n this.reverseSort(value[0])\n }),\n tap((value) => {\n this.$addresses.next(value[0])\n }),\n map((value) => {\n const countries = value[0] as CountriesEndpoint\n const countryCodes = value[1] as { key: string; value: string }[]\n countries.addresses.forEach((country) => {\n //Override backend country name translations\n country.countryName =\n countryCodes.find((x) => x.value === country.iso2Country.value)\n .key || ''\n })\n return countries\n })\n )\n .subscribe()\n return this.$addresses\n }\n\n postAddresses(countries: CountriesEndpoint): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/countryForm.json`,\n countries,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAddresses({ forceReload: true }))\n )\n }\n\n private reverseSort(value: CountriesEndpoint) {\n value.addresses.sort((a, b) => a.displayIndex - b.displayIndex)\n value.addresses.reverse()\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { forkJoin, merge, Observable, of, ReplaySubject } from 'rxjs'\nimport { retry, catchError, tap, map, take } from 'rxjs/operators'\nimport { CountriesEndpoint } from 'src/app/types/record-country.endpoint'\nimport {\n SideBarPublicUserRecord,\n UserRecordOptions,\n} from 'src/app/types/record.local'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordCountriesService {\n $addresses: ReplaySubject\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _recordPublicSidebar: RecordPublicSideBarService\n ) {}\n\n getCountryCodes(): Observable<{ key: string; value: string }[]> {\n return of([\n { key: $localize`:@@share.af:Afghanistan`, value: 'AF' },\n { key: $localize`:@@share.AL:Albania`, value: 'AL' },\n { key: $localize`:@@share.DZ:Algeria`, value: 'DZ' },\n { key: $localize`:@@share.AS:American Samoa`, value: 'AS' },\n { key: $localize`:@@share.AD:Andorra`, value: 'AD' },\n { key: $localize`:@@share.AO:Angola`, value: 'AO' },\n { key: $localize`:@@share.AI:Anguilla`, value: 'AI' },\n { key: $localize`:@@share.AQ:Antarctica`, value: 'AQ' },\n { key: $localize`:@@share.AG:Antigua and Barbuda`, value: 'AG' },\n { key: $localize`:@@share.AR:Argentina`, value: 'AR' },\n { key: $localize`:@@share.AM:Armenia`, value: 'AM' },\n { key: $localize`:@@share.AW:Aruba`, value: 'AW' },\n { key: $localize`:@@share.AU:Australia`, value: 'AU' },\n { key: $localize`:@@share.AT:Austria`, value: 'AT' },\n { key: $localize`:@@share.AZ:Azerbaijan`, value: 'AZ' },\n { key: $localize`:@@share.BS:Bahamas`, value: 'BS' },\n { key: $localize`:@@share.BH:Bahrain`, value: 'BH' },\n { key: $localize`:@@share.BD:Bangladesh`, value: 'BD' },\n { key: $localize`:@@share.BB:Barbados`, value: 'BB' },\n { key: $localize`:@@share.BY:Belarus`, value: 'BY' },\n { key: $localize`:@@share.BE:Belgium`, value: 'BE' },\n { key: $localize`:@@share.BZ:Belize`, value: 'BZ' },\n { key: $localize`:@@share.BJ:Benin`, value: 'BJ' },\n { key: $localize`:@@share.BM:Bermuda`, value: 'BM' },\n { key: $localize`:@@share.BT:Bhutan`, value: 'BT' },\n { key: $localize`:@@share.BO:Bolivia`, value: 'BO' },\n { key: $localize`:@@share.BA:Bosnia and Herzegovina`, value: 'BA' },\n { key: $localize`:@@share.BW:Botswana`, value: 'BW' },\n { key: $localize`:@@share.BV:Bouvet Island`, value: 'BV' },\n { key: $localize`:@@share.BR:Brazil`, value: 'BR' },\n { key: $localize`:@@share.BQ:British Antarctic Territory`, value: 'BQ' },\n {\n key: $localize`:@@share.IO:British Indian Ocean Territory`,\n value: 'IO',\n },\n { key: $localize`:@@share.VG:British Virgin Islands`, value: 'VG' },\n { key: $localize`:@@share.BN:Brunei`, value: 'BN' },\n { key: $localize`:@@share.BG:Bulgaria`, value: 'BG' },\n { key: $localize`:@@share.BF:Burkina Faso`, value: 'BF' },\n { key: $localize`:@@share.BI:Burundi`, value: 'BI' },\n { key: $localize`:@@share.KH:Cambodia`, value: 'KH' },\n { key: $localize`:@@share.CM:Cameroon`, value: 'CM' },\n { key: $localize`:@@share.CA:Canada`, value: 'CA' },\n { key: $localize`:@@share.CV:Cape Verde`, value: 'CV' },\n { key: $localize`:@@share.KY:Cayman Islands`, value: 'KY' },\n { key: $localize`:@@share.CF:Central African Republic`, value: 'CF' },\n { key: $localize`:@@share.TD:Chad`, value: 'TD' },\n { key: $localize`:@@share.CL:Chile`, value: 'CL' },\n { key: $localize`:@@share.CN:China`, value: 'CN' },\n { key: $localize`:@@share.CX:Christmas Island`, value: 'CX' },\n { key: $localize`:@@share.CC:Cocos [Keeling] Islands`, value: 'CC' },\n { key: $localize`:@@share.CO:Colombia`, value: 'CO' },\n { key: $localize`:@@share.KM:Comoros`, value: 'KM' },\n { key: $localize`:@@share.CG:Congo - Brazzaville`, value: 'CG' },\n { key: $localize`:@@share.CD:Congo - Kinshasa`, value: 'CD' },\n { key: $localize`:@@share.CK:Cook Islands`, value: 'CK' },\n { key: $localize`:@@share.CR:Costa Rica`, value: 'CR' },\n { key: $localize`:@@share.HR:Croatia`, value: 'HR' },\n { key: $localize`:@@share.CU:Cuba`, value: 'CU' },\n { key: $localize`:@@share.CW:Curaçao`, value: 'CW' },\n { key: $localize`:@@share.CY:Cyprus`, value: 'CY' },\n { key: $localize`:@@share.CZ:Czech Republic`, value: 'CZ' },\n { key: $localize`:@@share.CI:Côte d'Ivoire`, value: 'CI' },\n { key: $localize`:@@share.DK:Denmark`, value: 'DK' },\n { key: $localize`:@@share.DJ:Djibouti`, value: 'DJ' },\n { key: $localize`:@@share.DM:Dominica`, value: 'DM' },\n { key: $localize`:@@share.DO:Dominican Republic`, value: 'DO' },\n { key: $localize`:@@share.EC:Ecuador`, value: 'EC' },\n { key: $localize`:@@share.EG:Egypt`, value: 'EG' },\n { key: $localize`:@@share.SV:El Salvador`, value: 'SV' },\n { key: $localize`:@@share.GQ:Equatorial Guinea`, value: 'GQ' },\n { key: $localize`:@@share.ER:Eritrea`, value: 'ER' },\n { key: $localize`:@@share.EE:Estonia`, value: 'EE' },\n { key: $localize`:@@share.ET:Ethiopia`, value: 'ET' },\n { key: $localize`:@@share.FK:Falkland Islands`, value: 'FK' },\n { key: $localize`:@@share.FO:Faroe Islands`, value: 'FO' },\n { key: $localize`:@@share.FJ:Fiji`, value: 'FJ' },\n { key: $localize`:@@share.FI:Finland`, value: 'FI' },\n { key: $localize`:@@share.FR:France`, value: 'FR' },\n { key: $localize`:@@share.GF:French Guiana`, value: 'GF' },\n { key: $localize`:@@share.PF:French Polynesia`, value: 'PF' },\n { key: $localize`:@@share.TF:French Southern Territories`, value: 'TF' },\n { key: $localize`:@@share.GA:Gabon`, value: 'GA' },\n { key: $localize`:@@share.GM:Gambia`, value: 'GM' },\n { key: $localize`:@@share.GE:Georgia`, value: 'GE' },\n { key: $localize`:@@share.DE:Germany`, value: 'DE' },\n { key: $localize`:@@share.GH:Ghana`, value: 'GH' },\n { key: $localize`:@@share.GI:Gibraltar`, value: 'GI' },\n { key: $localize`:@@share.GR:Greece`, value: 'GR' },\n { key: $localize`:@@share.GL:Greenland`, value: 'GL' },\n { key: $localize`:@@share.GD:Grenada`, value: 'GD' },\n { key: $localize`:@@share.GP:Guadeloupe`, value: 'GP' },\n { key: $localize`:@@share.GU:Guam`, value: 'GU' },\n { key: $localize`:@@share.GT:Guatemala`, value: 'GT' },\n { key: $localize`:@@share.GG:Guernsey`, value: 'GG' },\n { key: $localize`:@@share.GN:Guinea`, value: 'GN' },\n { key: $localize`:@@share.GW:Guinea-Bissau`, value: 'GW' },\n { key: $localize`:@@share.GY:Guyana`, value: 'GY' },\n { key: $localize`:@@share.HT:Haiti`, value: 'HT' },\n {\n key: $localize`:@@share.HM:Heard Island and McDonald Islands`,\n value: 'HM',\n },\n { key: $localize`:@@share.HN:Honduras`, value: 'HN' },\n { key: $localize`:@@share.HK:Hong Kong SAR China`, value: 'HK' },\n { key: $localize`:@@share.HU:Hungary`, value: 'HU' },\n { key: $localize`:@@share.IS:Iceland`, value: 'IS' },\n { key: $localize`:@@share.IN:India`, value: 'IN' },\n { key: $localize`:@@share.ID:Indonesia`, value: 'ID' },\n { key: $localize`:@@share.IR:Iran`, value: 'IR' },\n { key: $localize`:@@share.IQ:Iraq`, value: 'IQ' },\n { key: $localize`:@@share.IE:Ireland`, value: 'IE' },\n { key: $localize`:@@share.IM:Isle of Man`, value: 'IM' },\n { key: $localize`:@@share.IL:Israel`, value: 'IL' },\n { key: $localize`:@@share.IT:Italy`, value: 'IT' },\n { key: $localize`:@@share.JM:Jamaica`, value: 'JM' },\n { key: $localize`:@@share.JP:Japan`, value: 'JP' },\n { key: $localize`:@@share.JE:Jersey`, value: 'JE' },\n { key: $localize`:@@share.JO:Jordan`, value: 'JO' },\n { key: $localize`:@@share.KZ:Kazakhstan`, value: 'KZ' },\n { key: $localize`:@@share.KE:Kenya`, value: 'KE' },\n { key: $localize`:@@share.KI:Kiribati`, value: 'KI' },\n { key: $localize`:@@share.XK:Kosovo`, value: 'XK' },\n { key: $localize`:@@share.KW:Kuwait`, value: 'KW' },\n { key: $localize`:@@share.KG:Kyrgyzstan`, value: 'KG' },\n { key: $localize`:@@share.LA:Laos`, value: 'LA' },\n { key: $localize`:@@share.LV:Latvia`, value: 'LV' },\n { key: $localize`:@@share.LB:Lebanon`, value: 'LB' },\n { key: $localize`:@@share.LS:Lesotho`, value: 'LS' },\n { key: $localize`:@@share.LR:Liberia`, value: 'LR' },\n { key: $localize`:@@share.LY:Libya`, value: 'LY' },\n { key: $localize`:@@share.LI:Liechtenstein`, value: 'LI' },\n { key: $localize`:@@share.LT:Lithuania`, value: 'LT' },\n { key: $localize`:@@share.LU:Luxembourg`, value: 'LU' },\n { key: $localize`:@@share.MO:Macau SAR China`, value: 'MO' },\n { key: $localize`:@@share.MG:Madagascar`, value: 'MG' },\n { key: $localize`:@@share.MW:Malawi`, value: 'MW' },\n { key: $localize`:@@share.MY:Malaysia`, value: 'MY' },\n { key: $localize`:@@share.MV:Maldives`, value: 'MV' },\n { key: $localize`:@@share.ML:Mali`, value: 'ML' },\n { key: $localize`:@@share.MT:Malta`, value: 'MT' },\n { key: $localize`:@@share.MH:Marshall Islands`, value: 'MH' },\n { key: $localize`:@@share.MQ:Martinique`, value: 'MQ' },\n { key: $localize`:@@share.MR:Mauritania`, value: 'MR' },\n { key: $localize`:@@share.MU:Mauritius`, value: 'MU' },\n { key: $localize`:@@share.YT:Mayotte`, value: 'YT' },\n { key: $localize`:@@share.MX:Mexico`, value: 'MX' },\n { key: $localize`:@@share.FM:Micronesia`, value: 'FM' },\n { key: $localize`:@@share.MD:Moldova`, value: 'MD' },\n { key: $localize`:@@share.MC:Monaco`, value: 'MC' },\n { key: $localize`:@@share.MN:Mongolia`, value: 'MN' },\n { key: $localize`:@@share.ME:Montenegro`, value: 'ME' },\n { key: $localize`:@@share.MS:Montserrat`, value: 'MS' },\n { key: $localize`:@@share.MA:Morocco`, value: 'MA' },\n { key: $localize`:@@share.MZ:Mozambique`, value: 'MZ' },\n { key: $localize`:@@share.MM:Myanmar [Burma]`, value: 'MM' },\n { key: $localize`:@@share.NA:Namibia`, value: 'NA' },\n { key: $localize`:@@share.NR:Nauru`, value: 'NR' },\n { key: $localize`:@@share.NP:Nepal`, value: 'NP' },\n { key: $localize`:@@share.NL:Netherlands`, value: 'NL' },\n { key: $localize`:@@share.NC:New Caledonia`, value: 'NC' },\n { key: $localize`:@@share.NZ:New Zealand`, value: 'NZ' },\n { key: $localize`:@@share.NI:Nicaragua`, value: 'NI' },\n { key: $localize`:@@share.NE:Niger`, value: 'NE' },\n { key: $localize`:@@share.NG:Nigeria`, value: 'NG' },\n { key: $localize`:@@share.NU:Niue`, value: 'NU' },\n { key: $localize`:@@share.NF:Norfolk Island`, value: 'NF' },\n { key: $localize`:@@share.KP:North Korea`, value: 'KP' },\n { key: $localize`:@@share.MK:North Macedonia`, value: 'MK' },\n { key: $localize`:@@share.MP:Northern Mariana Islands`, value: 'MP' },\n { key: $localize`:@@share.NO:Norway`, value: 'NO' },\n { key: $localize`:@@share.OM:Oman`, value: 'OM' },\n { key: $localize`:@@share.PK:Pakistan`, value: 'PK' },\n { key: $localize`:@@share.PW:Palau`, value: 'PW' },\n { key: $localize`:@@share.PS:Palestinian Territories`, value: 'PS' },\n { key: $localize`:@@share.PA:Panama`, value: 'PA' },\n { key: $localize`:@@share.PG:Papua New Guinea`, value: 'PG' },\n { key: $localize`:@@share.PY:Paraguay`, value: 'PY' },\n { key: $localize`:@@share.PE:Peru`, value: 'PE' },\n { key: $localize`:@@share.PH:Philippines`, value: 'PH' },\n { key: $localize`:@@share.PN:Pitcairn Islands`, value: 'PN' },\n { key: $localize`:@@share.PL:Poland`, value: 'PL' },\n { key: $localize`:@@share.PT:Portugal`, value: 'PT' },\n { key: $localize`:@@share.PR:Puerto Rico`, value: 'PR' },\n { key: $localize`:@@share.QA:Qatar`, value: 'QA' },\n { key: $localize`:@@share.RO:Romania`, value: 'RO' },\n { key: $localize`:@@share.RU:Russia`, value: 'RU' },\n { key: $localize`:@@share.RW:Rwanda`, value: 'RW' },\n { key: $localize`:@@share.RE:Réunion`, value: 'RE' },\n { key: $localize`:@@share.BL:Saint Barthélemy`, value: 'BL' },\n { key: $localize`:@@share.SH:Saint Helena`, value: 'SH' },\n { key: $localize`:@@share.KN:Saint Kitts and Nevis`, value: 'KN' },\n { key: $localize`:@@share.LC:Saint Lucia`, value: 'LC' },\n { key: $localize`:@@share.MF:Saint Martin`, value: 'MF' },\n { key: $localize`:@@share.PM:Saint Pierre and Miquelon`, value: 'PM' },\n {\n key: $localize`:@@share.VC:Saint Vincent and the Grenadines`,\n value: 'VC',\n },\n { key: $localize`:@@share.WS:Samoa`, value: 'WS' },\n { key: $localize`:@@share.SM:San Marino`, value: 'SM' },\n { key: $localize`:@@share.SA:Saudi Arabia`, value: 'SA' },\n { key: $localize`:@@share.SN:Senegal`, value: 'SN' },\n { key: $localize`:@@share.RS:Serbia`, value: 'RS' },\n { key: $localize`:@@share.SC:Seychelles`, value: 'SC' },\n { key: $localize`:@@share.SL:Sierra Leone`, value: 'SL' },\n { key: $localize`:@@share.SG:Singapore`, value: 'SG' },\n { key: $localize`:@@share.SX:Sint Maarten (Dutch Part)`, value: 'SX' },\n { key: $localize`:@@share.SK:Slovakia`, value: 'SK' },\n { key: $localize`:@@share.SI:Slovenia`, value: 'SI' },\n { key: $localize`:@@share.SB:Solomon Islands`, value: 'SB' },\n { key: $localize`:@@share.SO:Somalia`, value: 'SO' },\n { key: $localize`:@@share.ZA:South Africa`, value: 'ZA' },\n {\n key: $localize`:@@share.GS:South Georgia and the South Sandwich Islands`,\n value: 'GS',\n },\n { key: $localize`:@@share.KR:South Korea`, value: 'KR' },\n { key: $localize`:@@share.SS:South Sudan`, value: 'SS' },\n { key: $localize`:@@share.ES:Spain`, value: 'ES' },\n { key: $localize`:@@share.LK:Sri Lanka`, value: 'LK' },\n { key: $localize`:@@share.SD:Sudan`, value: 'SD' },\n { key: $localize`:@@share.SR:Suriname`, value: 'SR' },\n { key: $localize`:@@share.SJ:Svalbard and Jan Mayen`, value: 'SJ' },\n { key: $localize`:@@share.SZ:Swaziland`, value: 'SZ' },\n { key: $localize`:@@share.SE:Sweden`, value: 'SE' },\n { key: $localize`:@@share.CH:Switzerland`, value: 'CH' },\n { key: $localize`:@@share.SY:Syria`, value: 'SY' },\n { key: $localize`:@@share.ST:São Tomé and Príncipe`, value: 'ST' },\n { key: $localize`:@@share.TW:Taiwan`, value: 'TW' },\n { key: $localize`:@@share.TJ:Tajikistan`, value: 'TJ' },\n { key: $localize`:@@share.TZ:Tanzania`, value: 'TZ' },\n { key: $localize`:@@share.TH:Thailand`, value: 'TH' },\n { key: $localize`:@@share.TL:Timor-Leste`, value: 'TL' },\n { key: $localize`:@@share.TG:Togo`, value: 'TG' },\n { key: $localize`:@@share.TK:Tokelau`, value: 'TK' },\n { key: $localize`:@@share.TO:Tonga`, value: 'TO' },\n { key: $localize`:@@share.TT:Trinidad and Tobago`, value: 'TT' },\n { key: $localize`:@@share.TN:Tunisia`, value: 'TN' },\n { key: $localize`:@@share.TR:Türkiye`, value: 'TR' },\n { key: $localize`:@@share.TM:Turkmenistan`, value: 'TM' },\n { key: $localize`:@@share.TC:Turks and Caicos Islands`, value: 'TC' },\n { key: $localize`:@@share.TV:Tuvalu`, value: 'TV' },\n { key: $localize`:@@share.UM:U.S. Minor Outlying Islands`, value: 'UM' },\n { key: $localize`:@@share.VI:U.S. Virgin Islands`, value: 'VI' },\n { key: $localize`:@@share.UG:Uganda`, value: 'UG' },\n { key: $localize`:@@share.UA:Ukraine`, value: 'UA' },\n { key: $localize`:@@share.AE:United Arab Emirates`, value: 'AE' },\n { key: $localize`:@@share.GB:United Kingdom`, value: 'GB' },\n { key: $localize`:@@share.US:United States`, value: 'US' },\n { key: $localize`:@@share.UY:Uruguay`, value: 'UY' },\n { key: $localize`:@@share.UZ:Uzbekistan`, value: 'UZ' },\n { key: $localize`:@@share.VU:Vanuatu`, value: 'VU' },\n { key: $localize`:@@share.VA:Vatican City`, value: 'VA' },\n { key: $localize`:@@share.VE:Venezuela`, value: 'VE' },\n { key: $localize`:@@share.VN:Vietnam`, value: 'VN' },\n { key: $localize`:@@share.WF:Wallis and Futuna`, value: 'WF' },\n { key: $localize`:@@share.EH:Western Sahara`, value: 'EH' },\n { key: $localize`:@@share.YE:Yemen`, value: 'YE' },\n { key: $localize`:@@share.ZM:Zambia`, value: 'ZM' },\n { key: $localize`:@@share.ZW:Zimbabwe`, value: 'ZW' },\n { key: $localize`:@@share.AX:Åland Islands`, value: 'AX' },\n ])\n }\n\n getAddresses(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ): Observable {\n if (options.publicRecordId) {\n return forkJoin([\n this._recordPublicSidebar.getPublicRecordSideBar(options).pipe(take(1)),\n this.getCountryCodes().pipe(take(1)),\n ]).pipe(\n map((value) => {\n const countries = value[0].countries\n const countryCodes = value[1]\n countries?.addresses.forEach((country) => {\n //Override backend country name translations\n country.countryName =\n countryCodes.find((x) => x.value === country.iso2Country.value)\n .key || ''\n })\n return countries\n })\n )\n }\n\n if (!this.$addresses) {\n this.$addresses = new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$addresses\n }\n if (options.cleanCacheIfExist && this.$addresses) {\n this.$addresses.next(undefined)\n }\n\n forkJoin([\n this._http\n .get(\n environment.API_WEB + `account/countryForm.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(take(1)),\n this.getCountryCodes().pipe(take(1)),\n ])\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of({ addresses: [] } as CountriesEndpoint)),\n tap((value) => {\n this.reverseSort(value[0])\n }),\n tap((value) => {\n this.$addresses.next(value[0])\n }),\n map((value) => {\n const countries = value[0] as CountriesEndpoint\n const countryCodes = value[1] as { key: string; value: string }[]\n countries.addresses.forEach((country) => {\n //Override backend country name translations\n country.countryName =\n countryCodes.find((x) => x.value === country.iso2Country.value)\n .key || ''\n })\n return countries\n })\n )\n .subscribe()\n return this.$addresses\n }\n\n postAddresses(countries: CountriesEndpoint): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/countryForm.json`,\n countries,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getAddresses({ forceReload: true }))\n )\n }\n\n private reverseSort(value: CountriesEndpoint) {\n value.addresses.sort((a, b) => a.displayIndex - b.displayIndex)\n value.addresses.reverse()\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -21133,7 +21133,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport {\n AbstractControl,\n AsyncValidatorFn,\n ValidationErrors,\n} from '@angular/forms'\nimport { EMPTY, Observable, of, ReplaySubject } from 'rxjs'\nimport { catchError, map, retry, switchMap, tap } from 'rxjs/operators'\nimport {\n Assertion,\n AssertionVisibilityString,\n EmailsEndpoint,\n ErrorsListResponse,\n} from 'src/app/types'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordEmailsService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n private $emailsSubject\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _recordPublicSidebar: RecordPublicSideBarService\n ) {}\n getEmails(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ): Observable {\n if (options.publicRecordId) {\n return this._recordPublicSidebar\n .getPublicRecordSideBar(options)\n .pipe(map((value) => value.emails))\n }\n if (!this.$emailsSubject) {\n this.$emailsSubject = new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$emailsSubject\n }\n if (options.cleanCacheIfExist) {\n this.$emailsSubject.next(EMPTY)\n }\n\n this._http\n .get(environment.API_WEB + `account/emails.json`, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError((error) => of({ emails: [] })),\n map((value: EmailsEndpoint) => {\n value.emails\n .sort(this.sortByEmailByValue)\n .sort(this.sortByEmailByVerifiedState)\n .sort(this.sortByEmailPrimaryState)\n return value\n }),\n tap((value) => {\n this.$emailsSubject.next(value)\n })\n )\n .subscribe()\n return this.$emailsSubject\n }\n\n postEmails(emails: EmailsEndpoint): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/emails.json`,\n emails,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getEmails({ forceReload: true }))\n )\n }\n\n editEmail(original: string, edited: string): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/email/edit.json`,\n { original, edited },\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getEmails({ forceReload: true }))\n )\n }\n\n verifyEmail(email: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `account/verifyEmail.json?email=${encodeURIComponent(email)}`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getEmails())\n )\n }\n\n visibility(email): Observable {\n const encoded_data = JSON.stringify(email)\n\n return this._http\n .post(environment.API_WEB + `account/email/visibility`, encoded_data, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getEmails({ forceReload: true }))\n )\n }\n\n validateRegisterValue(\n value: Assertion\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/validateEmail.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n backendEmailValidate(\n emailThatAreAlreadySaveOnTheBackend?: AssertionVisibilityString[]\n ): AsyncValidatorFn {\n return (control: AbstractControl): Observable => {\n if (control.value === '') {\n return of(null)\n }\n const value: Assertion = { value: control.value }\n\n const thisEmailIsAlreadyOnTheBackend =\n emailThatAreAlreadySaveOnTheBackend.filter(\n (email) => email.value === value.value\n )\n\n if (thisEmailIsAlreadyOnTheBackend.length) {\n return of(null)\n }\n\n return this.validateRegisterValue(value).pipe(\n map((res) => {\n if (res.errors.length > 0) {\n const error = {\n backendError: res.errors,\n }\n return error\n }\n return null\n })\n )\n }\n }\n\n sortByEmailByValue(\n a: AssertionVisibilityString,\n b: AssertionVisibilityString\n ): number {\n if (a.value < b.value) {\n return -1\n }\n if (a.value > b.value) {\n return 1\n }\n return 0\n }\n\n sortByEmailByVerifiedState(\n a: AssertionVisibilityString,\n b: AssertionVisibilityString\n ): number {\n return a.verified === b.verified ? 0 : a.verified ? -1 : 1\n }\n\n sortByEmailPrimaryState(\n a: AssertionVisibilityString,\n b: AssertionVisibilityString\n ): number {\n return a.primary === b.primary ? 0 : a.primary ? -1 : 1\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport {\n AbstractControl,\n AsyncValidatorFn,\n ValidationErrors,\n} from '@angular/forms'\nimport { EMPTY, Observable, of, ReplaySubject } from 'rxjs'\nimport { catchError, map, retry, switchMap, tap } from 'rxjs/operators'\nimport {\n Assertion,\n AssertionVisibilityString,\n EmailsEndpoint,\n ErrorsListResponse,\n} from 'src/app/types'\nimport { UserRecordOptions } from 'src/app/types/record.local'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordEmailsService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n private $emailsSubject\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _recordPublicSidebar: RecordPublicSideBarService\n ) {}\n getEmails(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ): Observable {\n if (options.publicRecordId) {\n return this._recordPublicSidebar\n .getPublicRecordSideBar(options)\n .pipe(map((value) => value.emails))\n }\n if (!this.$emailsSubject) {\n this.$emailsSubject = new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$emailsSubject\n }\n if (options.cleanCacheIfExist) {\n this.$emailsSubject.next(EMPTY)\n }\n\n this._http\n .get(environment.API_WEB + `account/emails.json`, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError((error) => of({ emails: [] })),\n map((value: EmailsEndpoint) => {\n value.emails\n .sort(this.sortByEmailByValue)\n .sort(this.sortByEmailByVerifiedState)\n .sort(this.sortByEmailPrimaryState)\n return value\n }),\n tap((value) => {\n this.$emailsSubject.next(value)\n })\n )\n .subscribe()\n return this.$emailsSubject\n }\n\n postEmails(emails: EmailsEndpoint): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/emails.json`,\n emails,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getEmails({ forceReload: true }))\n )\n }\n\n editEmail(original: string, edited: string): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/email/edit.json`,\n { original, edited },\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getEmails({ forceReload: true }))\n )\n }\n\n verifyEmail(email: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `account/verifyEmail.json?email=${encodeURIComponent(email)}`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getEmails())\n )\n }\n\n visibility(email): Observable {\n const encoded_data = JSON.stringify(email)\n\n return this._http\n .post(environment.API_WEB + `account/email/visibility`, encoded_data, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getEmails({ forceReload: true }))\n )\n }\n\n validateRegisterValue(\n value: Assertion\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/validateEmail.json`,\n value\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n backendEmailValidate(\n emailThatAreAlreadySaveOnTheBackend?: AssertionVisibilityString[]\n ): AsyncValidatorFn {\n return (control: AbstractControl): Observable => {\n if (control.value === '') {\n return of(null)\n }\n const value: Assertion = { value: control.value }\n\n const thisEmailIsAlreadyOnTheBackend =\n emailThatAreAlreadySaveOnTheBackend.filter(\n (email) => email.value === value.value\n )\n\n if (thisEmailIsAlreadyOnTheBackend.length) {\n return of(null)\n }\n\n return this.validateRegisterValue(value).pipe(\n map((res) => {\n if (res.errors.length > 0) {\n const error = {\n backendError: res.errors,\n }\n return error\n }\n return null\n })\n )\n }\n }\n\n sortByEmailByValue(\n a: AssertionVisibilityString,\n b: AssertionVisibilityString\n ): number {\n if (a.value < b.value) {\n return -1\n }\n if (a.value > b.value) {\n return 1\n }\n return 0\n }\n\n sortByEmailByVerifiedState(\n a: AssertionVisibilityString,\n b: AssertionVisibilityString\n ): number {\n return a.verified === b.verified ? 0 : a.verified ? -1 : 1\n }\n\n sortByEmailPrimaryState(\n a: AssertionVisibilityString,\n b: AssertionVisibilityString\n ): number {\n return a.primary === b.primary ? 0 : a.primary ? -1 : 1\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -21603,7 +21603,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'\nimport { catchError, retry, switchMap, tap } from 'rxjs/operators'\nimport { Funding, FundingGroup } from 'src/app/types/record-funding.endpoint'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { VisibilityStrings, Organization } from '../../types/common.endpoint'\nimport { RecordImportWizard } from '../../types/record-peer-review-import.endpoint'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordFundingsService {\n lastEmittedValue: FundingGroup[]\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n $fundings: ReplaySubject = new ReplaySubject()\n private _$loading = new BehaviorSubject(true)\n public get $loading() {\n return this._$loading.asObservable()\n }\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n getFundings(options: UserRecordOptions): Observable {\n this._$loading.next(true)\n if (options?.publicRecordId) {\n this._http\n .get(\n environment.API_WEB +\n options.publicRecordId +\n '/fundingGroups.json?' +\n '&sort=' +\n (options.sort != null ? options.sort : 'date') +\n '&sortAsc=' +\n (options.sortAsc != null ? options.sortAsc : false)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of([])),\n tap((data) => {\n this._$loading.next(false)\n this.lastEmittedValue = data\n this.$fundings.next(data)\n }),\n switchMap((data) => this.$fundings.asObservable())\n )\n .subscribe()\n } else {\n this.getAndSortFundings(options)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap((data) => {\n this._$loading.next(false)\n this.lastEmittedValue = data\n this.$fundings.next(data)\n }),\n switchMap((data) => this.$fundings.asObservable())\n )\n .subscribe()\n }\n return this.$fundings.asObservable()\n }\n\n getFundingDetails(putCode): Observable {\n return this._http\n .get(\n environment.API_WEB + `fundings/fundingDetails.json?id=${putCode}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n /* TODO: Fetch group id info */\n }\n\n getPublicFundingDetails(orcid, putCode): Observable {\n return this._http\n .get(\n environment.API_WEB + orcid + `/fundingDetails.json?id=${putCode}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n changeUserRecordContext(userRecordContext: UserRecordOptions) {\n this.getFundings(userRecordContext).subscribe()\n }\n\n private getAndSortFundings(\n options: UserRecordOptions\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `fundings/fundingGroups.json?` +\n '&sort=' +\n (options?.sort != null ? options.sort : 'date') +\n '&sortAsc=' +\n (options?.sortAsc != null ? options.sortAsc : false)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n set(value): Observable {\n throw new Error('Method not implemented.')\n }\n\n updateVisibility(\n putCode: string,\n visibility: VisibilityStrings\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'fundings/' +\n putCode +\n '/visibility/' +\n visibility\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getFundings({ forceReload: true }))\n )\n }\n\n delete(putCode: string): Observable {\n return this._http\n .delete(\n environment.API_WEB +\n 'fundings/funding.json?id=' +\n encodeURIComponent(putCode)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getFundings({ forceReload: true }))\n )\n }\n\n getFunding(): Observable {\n return this._http\n .get(environment.API_WEB + `fundings/funding.json`)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n save(funding: Funding) {\n return this._http\n .post(environment.API_WEB + `fundings/funding.json`, funding)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getFundings({ forceReload: true }))\n )\n }\n\n getOrganization(org: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'fundings/disambiguated/name/' +\n org +\n '?limit=100&funders-only=true',\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n loadFundingImportWizardList(): Observable {\n return this._http.get(\n environment.API_WEB + 'workspace/retrieve-funding-import-wizards.json'\n )\n }\n\n updatePreferredSource(putCode: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'fundings/updateToMaxDisplay.json?putCode=' +\n putCode\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getFundings({ forceReload: true }))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'\nimport { catchError, retry, switchMap, tap } from 'rxjs/operators'\nimport { Funding, FundingGroup } from 'src/app/types/record-funding.endpoint'\nimport { UserRecordOptions } from 'src/app/types/record.local'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { VisibilityStrings, Organization } from '../../types/common.endpoint'\nimport { RecordImportWizard } from '../../types/record-peer-review-import.endpoint'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordFundingsService {\n lastEmittedValue: FundingGroup[]\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n $fundings: ReplaySubject = new ReplaySubject()\n private _$loading = new BehaviorSubject(true)\n public get $loading() {\n return this._$loading.asObservable()\n }\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n getFundings(options: UserRecordOptions): Observable {\n this._$loading.next(true)\n if (options?.publicRecordId) {\n this._http\n .get(\n environment.API_WEB +\n options.publicRecordId +\n '/fundingGroups.json?' +\n '&sort=' +\n (options.sort != null ? options.sort : 'date') +\n '&sortAsc=' +\n (options.sortAsc != null ? options.sortAsc : false)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of([])),\n tap((data) => {\n this._$loading.next(false)\n this.lastEmittedValue = data\n this.$fundings.next(data)\n }),\n switchMap((data) => this.$fundings.asObservable())\n )\n .subscribe()\n } else {\n this.getAndSortFundings(options)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap((data) => {\n this._$loading.next(false)\n this.lastEmittedValue = data\n this.$fundings.next(data)\n }),\n switchMap((data) => this.$fundings.asObservable())\n )\n .subscribe()\n }\n return this.$fundings.asObservable()\n }\n\n getFundingDetails(putCode): Observable {\n return this._http\n .get(\n environment.API_WEB + `fundings/fundingDetails.json?id=${putCode}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n /* TODO: Fetch group id info */\n }\n\n getPublicFundingDetails(orcid, putCode): Observable {\n return this._http\n .get(\n environment.API_WEB + orcid + `/fundingDetails.json?id=${putCode}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n changeUserRecordContext(userRecordContext: UserRecordOptions) {\n this.getFundings(userRecordContext).subscribe()\n }\n\n private getAndSortFundings(\n options: UserRecordOptions\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `fundings/fundingGroups.json?` +\n '&sort=' +\n (options?.sort != null ? options.sort : 'date') +\n '&sortAsc=' +\n (options?.sortAsc != null ? options.sortAsc : false)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n set(value): Observable {\n throw new Error('Method not implemented.')\n }\n\n updateVisibility(\n putCode: string,\n visibility: VisibilityStrings\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'fundings/' +\n putCode +\n '/visibility/' +\n visibility\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getFundings({ forceReload: true }))\n )\n }\n\n delete(putCode: string): Observable {\n return this._http\n .delete(\n environment.API_WEB +\n 'fundings/funding.json?id=' +\n encodeURIComponent(putCode)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getFundings({ forceReload: true }))\n )\n }\n\n getFunding(): Observable {\n return this._http\n .get(environment.API_WEB + `fundings/funding.json`)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n save(funding: Funding) {\n return this._http\n .post(environment.API_WEB + `fundings/funding.json`, funding)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getFundings({ forceReload: true }))\n )\n }\n\n getOrganization(org: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'fundings/disambiguated/name/' +\n org +\n '?limit=100&funders-only=true',\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n loadFundingImportWizardList(): Observable {\n return this._http.get(\n environment.API_WEB + 'workspace/retrieve-funding-import-wizards.json'\n )\n }\n\n updatePreferredSource(putCode: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'fundings/updateToMaxDisplay.json?putCode=' +\n putCode\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getFundings({ forceReload: true }))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -22625,7 +22625,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, of, ReplaySubject } from 'rxjs'\nimport { catchError, map, retry, switchMap, tap } from 'rxjs/operators'\nimport { PersonIdentifierEndpoint } from 'src/app/types/record-person-identifier.endpoint'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordPersonService } from '../record-person/record-person.service'\nimport { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordPersonIdentifierService {\n $publicPersonIdentifier: ReplaySubject\n $privatePersonIdentifier: ReplaySubject\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _recordPerson: RecordPersonService,\n private _recordPublicSidebar: RecordPublicSideBarService\n ) {}\n\n getPersonalIdentifiers(\n options: UserRecordOptions = {}\n ): Observable {\n if (options.publicRecordId) {\n return this._recordPublicSidebar\n .getPublicRecordSideBar(options)\n .pipe(map((value) => value.externalIdentifier))\n }\n\n return this.getPrivateRecordIdentifiers(options).asObservable()\n }\n\n private getPrivateRecordIdentifiers(\n options: UserRecordOptions\n ): ReplaySubject {\n if (!this.$privatePersonIdentifier) {\n this.$privatePersonIdentifier =\n new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$privatePersonIdentifier\n }\n\n if (options.cleanCacheIfExist && this.$privatePersonIdentifier) {\n this.$privatePersonIdentifier.next(undefined)\n }\n\n this._http\n .get(\n environment.API_WEB + `my-orcid/externalIdentifiers.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() =>\n of({ externalIdentifiers: [] } as PersonIdentifierEndpoint)\n ),\n\n map((value: PersonIdentifierEndpoint) => {\n return value\n }),\n tap((value) => {\n this.$privatePersonIdentifier.next(value)\n })\n )\n .subscribe()\n return this.$privatePersonIdentifier\n }\n\n postPersonalIdentifiers(otherNames: PersonIdentifierEndpoint) {\n return this._http\n .post(\n environment.API_WEB + `my-orcid/externalIdentifiers.json`,\n otherNames,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getPersonalIdentifiers({ forceReload: true }))\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, of, ReplaySubject } from 'rxjs'\nimport { catchError, map, retry, switchMap, tap } from 'rxjs/operators'\nimport { PersonIdentifierEndpoint } from 'src/app/types/record-person-identifier.endpoint'\nimport { UserRecordOptions } from 'src/app/types/record.local'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordPersonService } from '../record-person/record-person.service'\nimport { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordPersonIdentifierService {\n $publicPersonIdentifier: ReplaySubject\n $privatePersonIdentifier: ReplaySubject\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _recordPerson: RecordPersonService,\n private _recordPublicSidebar: RecordPublicSideBarService\n ) {}\n\n getPersonalIdentifiers(\n options: UserRecordOptions = {}\n ): Observable {\n if (options.publicRecordId) {\n return this._recordPublicSidebar\n .getPublicRecordSideBar(options)\n .pipe(map((value) => value.externalIdentifier))\n }\n\n return this.getPrivateRecordIdentifiers(options).asObservable()\n }\n\n private getPrivateRecordIdentifiers(\n options: UserRecordOptions\n ): ReplaySubject {\n if (!this.$privatePersonIdentifier) {\n this.$privatePersonIdentifier =\n new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$privatePersonIdentifier\n }\n\n if (options.cleanCacheIfExist && this.$privatePersonIdentifier) {\n this.$privatePersonIdentifier.next(undefined)\n }\n\n this._http\n .get(\n environment.API_WEB + `my-orcid/externalIdentifiers.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() =>\n of({ externalIdentifiers: [] } as PersonIdentifierEndpoint)\n ),\n\n map((value: PersonIdentifierEndpoint) => {\n return value\n }),\n tap((value) => {\n this.$privatePersonIdentifier.next(value)\n })\n )\n .subscribe()\n return this.$privatePersonIdentifier\n }\n\n postPersonalIdentifiers(otherNames: PersonIdentifierEndpoint) {\n return this._http\n .post(\n environment.API_WEB + `my-orcid/externalIdentifiers.json`,\n otherNames,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n switchMap(() => this.getPersonalIdentifiers({ forceReload: true }))\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -22875,7 +22875,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, ReplaySubject } from 'rxjs'\nimport { catchError, first, map, retry, switchMap, tap } from 'rxjs/operators'\nimport { Person } from 'src/app/types'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { UserService } from '../user/user.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordPersonService {\n private $personPublicRecordSubject: ReplaySubject\n private $personPrivateRecordSubject: ReplaySubject\n\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient,\n private _user: UserService\n ) {}\n\n getPerson(options: UserRecordOptions): Observable {\n if (options?.publicRecordId) {\n return this.getPublicRecordPerson(options)\n } else {\n return this.getPrivateRecordPerson(options)\n }\n }\n\n private getPublicRecordPerson(\n options: UserRecordOptions\n ): Observable {\n if (!this.$personPublicRecordSubject || options.forceReload) {\n this.$personPublicRecordSubject = new ReplaySubject(1)\n } else {\n return this.$personPublicRecordSubject.asObservable()\n }\n\n this.getPersonHttpCall(options.publicRecordId)\n .pipe(\n tap((data) => {\n this.setupFullCountryCodes(data)\n }),\n tap((value) => {\n this.$personPublicRecordSubject.next(value)\n })\n )\n .subscribe()\n return this.$personPublicRecordSubject.asObservable()\n }\n\n public getPrivateRecordPerson(\n options: UserRecordOptions\n ): ReplaySubject {\n if (!this.$personPrivateRecordSubject) {\n this.$personPrivateRecordSubject = new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$personPrivateRecordSubject\n }\n\n this._user\n .getUserSession()\n .pipe(\n first(),\n map((userSession) => userSession.userInfo.EFFECTIVE_USER_ORCID),\n switchMap((orcid) => this.getPersonHttpCall(orcid)),\n tap((data) => {\n this.setupFullCountryCodes(data)\n }),\n tap((value) => {\n this.$personPrivateRecordSubject.next(value)\n })\n )\n .subscribe()\n return this.$personPrivateRecordSubject\n }\n\n private getPersonHttpCall(orcid: string): Observable {\n return this._http\n .get(environment.API_WEB + `${orcid}/person.json`)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n private setupFullCountryCodes(data: Person) {\n if (data.publicGroupedAddresses) {\n Object.keys(data.publicGroupedAddresses).map((key) => {\n if (data.countryNames && data.countryNames[key]) {\n data.publicGroupedAddresses[data.countryNames[key]] =\n data.publicGroupedAddresses[key]\n delete data.publicGroupedAddresses[key]\n }\n })\n }\n }\n}\n", + "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, ReplaySubject } from 'rxjs'\nimport { catchError, first, map, retry, switchMap, tap } from 'rxjs/operators'\nimport { Person } from 'src/app/types'\nimport { UserRecordOptions } from 'src/app/types/record.local'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { UserService } from '../user/user.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordPersonService {\n private $personPublicRecordSubject: ReplaySubject\n private $personPrivateRecordSubject: ReplaySubject\n\n constructor(\n private _errorHandler: ErrorHandlerService,\n private _http: HttpClient,\n private _user: UserService\n ) {}\n\n getPerson(options: UserRecordOptions): Observable {\n if (options?.publicRecordId) {\n return this.getPublicRecordPerson(options)\n } else {\n return this.getPrivateRecordPerson(options)\n }\n }\n\n private getPublicRecordPerson(\n options: UserRecordOptions\n ): Observable {\n if (!this.$personPublicRecordSubject || options.forceReload) {\n this.$personPublicRecordSubject = new ReplaySubject(1)\n } else {\n return this.$personPublicRecordSubject.asObservable()\n }\n\n this.getPersonHttpCall(options.publicRecordId)\n .pipe(\n tap((data) => {\n this.setupFullCountryCodes(data)\n }),\n tap((value) => {\n this.$personPublicRecordSubject.next(value)\n })\n )\n .subscribe()\n return this.$personPublicRecordSubject.asObservable()\n }\n\n public getPrivateRecordPerson(\n options: UserRecordOptions\n ): ReplaySubject {\n if (!this.$personPrivateRecordSubject) {\n this.$personPrivateRecordSubject = new ReplaySubject(1)\n } else if (!options.forceReload) {\n return this.$personPrivateRecordSubject\n }\n\n this._user\n .getUserSession()\n .pipe(\n first(),\n map((userSession) => userSession.userInfo.EFFECTIVE_USER_ORCID),\n switchMap((orcid) => this.getPersonHttpCall(orcid)),\n tap((data) => {\n this.setupFullCountryCodes(data)\n }),\n tap((value) => {\n this.$personPrivateRecordSubject.next(value)\n })\n )\n .subscribe()\n return this.$personPrivateRecordSubject\n }\n\n private getPersonHttpCall(orcid: string): Observable {\n return this._http\n .get(environment.API_WEB + `${orcid}/person.json`)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n private setupFullCountryCodes(data: Person) {\n if (data.publicGroupedAddresses) {\n Object.keys(data.publicGroupedAddresses).map((key) => {\n if (data.countryNames && data.countryNames[key]) {\n data.publicGroupedAddresses[data.countryNames[key]] =\n data.publicGroupedAddresses[key]\n delete data.publicGroupedAddresses[key]\n }\n })\n }\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -23003,7 +23003,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, of, ReplaySubject } from 'rxjs'\nimport { retry, catchError, tap } from 'rxjs/operators'\nimport {\n SideBarPublicUserRecord,\n UserRecord,\n UserRecordOptions,\n} from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordPublicSideBarService {\n private $SideBarPublicUserRecordSubject: ReplaySubject\n sleepForceReloads: boolean\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n getPublicRecordSideBar(\n options: UserRecordOptions\n ): Observable {\n if (options.publicRecordId) {\n if (\n !this.$SideBarPublicUserRecordSubject ||\n (options.forceReload && !this.sleepForceReloads)\n ) {\n this.sleepForceReloads = true\n this.$SideBarPublicUserRecordSubject =\n new ReplaySubject(1)\n setTimeout(() => {\n this.sleepForceReloads = false\n }, 100)\n } else {\n return this.$SideBarPublicUserRecordSubject.asObservable()\n }\n\n return this._http\n .get(\n environment.API_WEB + options.publicRecordId + `/public-record.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError((error) => of({} as SideBarPublicUserRecord)),\n tap((value) => this.$SideBarPublicUserRecordSubject.next(value))\n )\n } else {\n of({})\n }\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, of, ReplaySubject } from 'rxjs'\nimport { retry, catchError, tap } from 'rxjs/operators'\nimport {\n SideBarPublicUserRecord,\n UserRecord,\n UserRecordOptions,\n} from 'src/app/types/record.local'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordPublicSideBarService {\n private $SideBarPublicUserRecordSubject: ReplaySubject\n sleepForceReloads: boolean\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n getPublicRecordSideBar(\n options: UserRecordOptions\n ): Observable {\n if (options.publicRecordId) {\n if (\n !this.$SideBarPublicUserRecordSubject ||\n (options.forceReload && !this.sleepForceReloads)\n ) {\n this.sleepForceReloads = true\n this.$SideBarPublicUserRecordSubject =\n new ReplaySubject(1)\n setTimeout(() => {\n this.sleepForceReloads = false\n }, 100)\n } else {\n return this.$SideBarPublicUserRecordSubject.asObservable()\n }\n\n return this._http\n .get(\n environment.API_WEB + options.publicRecordId + `/public-record.json`,\n {\n headers: this.headers,\n }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError((error) => of({} as SideBarPublicUserRecord)),\n tap((value) => this.$SideBarPublicUserRecordSubject.next(value))\n )\n } else {\n of({})\n }\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -23634,7 +23634,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { combineLatest, Observable, of, ReplaySubject, Subject } from 'rxjs'\nimport {\n catchError,\n map,\n retry,\n startWith,\n takeUntil,\n tap,\n} from 'rxjs/operators'\nimport {\n EmailsEndpoint,\n ExternalIdentifier,\n Keywords,\n PersonIdentifierEndpoint,\n Preferences,\n UserInfo,\n} from 'src/app/types'\nimport { CountriesEndpoint } from 'src/app/types/record-country.endpoint'\nimport { UserRecord, UserRecordOptions } from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordCountriesService } from '../record-countries/record-countries.service'\nimport { RecordEmailsService } from '../record-emails/record-emails.service'\nimport { RecordBiographyService } from '../record-biography/record-biography.service'\nimport { RecordKeywordService } from '../record-keyword/record-keyword.service'\nimport { RecordNamesService } from '../record-names/record-names.service'\nimport { RecordOtherNamesService } from '../record-other-names/record-other-names.service'\nimport { OtherNamesEndPoint } from '../../types/record-other-names.endpoint'\nimport { KeywordEndPoint } from '../../types/record-keyword.endpoint'\nimport { NamesEndPoint } from '../../types/record-name.endpoint'\nimport { BiographyEndPoint } from '../../types/record-biography.endpoint'\nimport { RecordWebsitesService } from '../record-websites/record-websites.service'\nimport { WebsitesEndPoint } from '../../types/record-websites.endpoint'\nimport { RecordAffiliationService } from '../record-affiliations/record-affiliations.service'\nimport { AffiliationUIGroup } from 'src/app/types/record-affiliation.endpoint'\nimport { RecordPeerReviewService } from '../record-peer-review/record-peer-review.service'\nimport { RecordPersonIdentifierService } from '../record-personal-identifiers/record-person-identifier.service'\nimport { RecordFundingsService } from '../record-fundings/record-fundings.service'\nimport { FundingGroup } from 'src/app/types/record-funding.endpoint'\nimport { PeerReview } from '../../types/record-peer-review.endpoint'\nimport { RecordResearchResourceService } from '../record-research-resource/record-research-resource.service'\nimport { ResearchResourcesEndpoint } from '../../types/record-research-resources.endpoint'\nimport { RecordWorksService } from '../record-works/record-works.service'\nimport { WorksEndpoint } from 'src/app/types/record-works.endpoint'\nimport { RecordPersonService } from '../record-person/record-person.service'\nimport { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service'\nimport { UserInfoService } from '../user-info/user-info.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordService {\n recordSubject$: ReplaySubject\n private readonly $destroy = new Subject()\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _recordBiographyService: RecordBiographyService,\n private _recordKeywordService: RecordKeywordService,\n private _recordNamesService: RecordNamesService,\n private _recordOtherNamesService: RecordOtherNamesService,\n private _recordEmailsService: RecordEmailsService,\n private _recordCountryService: RecordCountriesService,\n private _recordWebsitesService: RecordWebsitesService,\n private _recordAffiliations: RecordAffiliationService,\n private _recordFundings: RecordFundingsService,\n private _recordPersonalIdentifier: RecordPersonIdentifierService,\n private _recordPeerReviewService: RecordPeerReviewService,\n private _recordResearchResourceService: RecordResearchResourceService,\n private _recordWorkService: RecordWorksService,\n private _recordPerson: RecordPersonService,\n private _recordPublicSidebar: RecordPublicSideBarService,\n private _userInfo: UserInfoService\n ) {}\n\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n subscriptionSourceCountDebugger = 0\n /**\n * @param options:\n * - use `forceReload` to force all server calls.\n * - use `publicRecordId` to load a public record or leave the `publicRecordId` undefined\n * to load the current user private record.\n *\n * Note: sending the `privateRecordId` is deprecated\n *\n * @returns And subject with all the require data from private or public orcid record\n */\n getRecord(options?: UserRecordOptions): Observable {\n if (!this.recordSubject$) {\n this.recordSubject$ = new ReplaySubject(1)\n this.attachDebugger()\n } else if (!options?.forceReload) {\n return this.recordSubject$.asObservable()\n }\n\n if (this.recordSubject$ && options?.cleanCacheIfExist) {\n this.recordSubject$.next(undefined)\n }\n const subscriptionCount = this.subscriptionSourceCountDebugger\n this.subscriptionSourceCountDebugger =\n this.subscriptionSourceCountDebugger + 1\n\n // Un-subscribe from previous combineLatest subscriptions\n this.$destroy.next()\n // Subscribe to a new combineLatest http calls subscription\n\n combineLatest([\n this._recordEmailsService\n .getEmails(options)\n .pipe(startWith(undefined)),\n this._recordOtherNamesService\n .getOtherNames(options)\n .pipe(startWith(undefined)),\n this._recordCountryService\n .getAddresses(options)\n .pipe(startWith(undefined)),\n this._recordKeywordService\n .getKeywords(options)\n .pipe(startWith(undefined)),\n this._recordWebsitesService\n .getWebsites(options)\n .pipe(startWith(undefined)),\n this._recordPersonalIdentifier\n .getPersonalIdentifiers(options)\n .pipe(startWith(undefined)),\n this._recordNamesService\n .getNames(options)\n .pipe(startWith(undefined)),\n this._recordBiographyService\n .getBiography(options)\n .pipe(startWith(undefined)),\n this._recordAffiliations\n .getAffiliations(options)\n .pipe(startWith(undefined)),\n this._recordFundings\n .getFundings(options)\n .pipe(startWith(undefined)),\n this.getPreferences(options)?.pipe(startWith(undefined)),\n this._recordPeerReviewService\n .getPeerReviewGroups(options)\n .pipe(startWith(undefined)),\n this._recordResearchResourceService\n .getResearchResourcePage(options)\n .pipe(startWith(undefined)),\n this._recordWorkService\n .getWorks(options)\n .pipe(startWith(undefined)),\n this.getLastModifiedTime(options).pipe(startWith(undefined)),\n this._userInfo.getUserInfo(options).pipe(startWith(undefined)),\n ])\n .pipe(\n tap(\n ([\n emails,\n otherNames,\n countries,\n keyword,\n website,\n externalIdentifier,\n names,\n biography,\n affiliations,\n fundings,\n preferences,\n peerReviews,\n researchResources,\n works,\n lastModifiedTime,\n userInfo,\n ]) => {\n this.recordSubject$.next({\n subscriptionCount: subscriptionCount,\n emails: emails as EmailsEndpoint,\n otherNames: otherNames as OtherNamesEndPoint,\n countries: countries as CountriesEndpoint,\n keyword: keyword as KeywordEndPoint,\n website: website as WebsitesEndPoint,\n externalIdentifier:\n externalIdentifier as PersonIdentifierEndpoint,\n names: names as NamesEndPoint,\n biography: biography as BiographyEndPoint,\n affiliations: affiliations as AffiliationUIGroup[],\n fundings: fundings as FundingGroup[],\n preferences: preferences as Preferences,\n peerReviews: peerReviews as PeerReview[],\n researchResources: researchResources as ResearchResourcesEndpoint,\n works: works as WorksEndpoint,\n lastModifiedTime: lastModifiedTime as any,\n userInfo: userInfo as UserInfo,\n })\n }\n ),\n takeUntil(this.$destroy)\n )\n\n .subscribe()\n\n return this.recordSubject$.asObservable()\n }\n attachDebugger() {\n if (environment.debugger) {\n this.recordSubject$.subscribe((value) => {\n console.debug(value)\n })\n }\n }\n\n getExternalIdentifier(): Observable {\n return this._http\n .get(\n environment.API_WEB + `my-orcid/externalIdentifiers.json`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getKeywords(): Observable {\n return this._http\n .get(environment.API_WEB + `my-orcid/keywordsForms.json`, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n // Just a place holder for posting external identifiers, since the frontend does never calls this function\n postExternalIdentifier(\n website: ExternalIdentifier\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `my-orcid/externalIdentifiers.json`,\n website,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n postKeywords(keywords: Keywords): Observable {\n return this._http\n .post(\n environment.API_WEB + `my-orcid/keywordsForms.json`,\n keywords,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getPreferences(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ): Observable {\n // TODO GET PUBLIC DATA\n if (options.publicRecordId) {\n return of(undefined)\n }\n\n return this._http\n .get(\n environment.API_WEB + `account/preferences.json`,\n\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of({} as Preferences))\n )\n }\n\n postPreferences(names: Preferences): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/preferences.json`,\n names,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getLastModifiedTime(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ) {\n if (options.publicRecordId) {\n return this._recordPublicSidebar\n .getPublicRecordSideBar(options)\n .pipe(map((value) => value.lastModifiedTime))\n }\n return of(undefined)\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { combineLatest, Observable, of, ReplaySubject, Subject } from 'rxjs'\nimport {\n catchError,\n map,\n retry,\n startWith,\n takeUntil,\n tap,\n} from 'rxjs/operators'\nimport {\n EmailsEndpoint,\n ExternalIdentifier,\n Keywords,\n PersonIdentifierEndpoint,\n Preferences,\n UserInfo,\n} from 'src/app/types'\nimport { CountriesEndpoint } from 'src/app/types/record-country.endpoint'\nimport { UserRecord, UserRecordOptions } from 'src/app/types/record.local'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { RecordCountriesService } from '../record-countries/record-countries.service'\nimport { RecordEmailsService } from '../record-emails/record-emails.service'\nimport { RecordBiographyService } from '../record-biography/record-biography.service'\nimport { RecordKeywordService } from '../record-keyword/record-keyword.service'\nimport { RecordNamesService } from '../record-names/record-names.service'\nimport { RecordOtherNamesService } from '../record-other-names/record-other-names.service'\nimport { OtherNamesEndPoint } from '../../types/record-other-names.endpoint'\nimport { KeywordEndPoint } from '../../types/record-keyword.endpoint'\nimport { NamesEndPoint } from '../../types/record-name.endpoint'\nimport { BiographyEndPoint } from '../../types/record-biography.endpoint'\nimport { RecordWebsitesService } from '../record-websites/record-websites.service'\nimport { WebsitesEndPoint } from '../../types/record-websites.endpoint'\nimport { RecordAffiliationService } from '../record-affiliations/record-affiliations.service'\nimport { AffiliationUIGroup } from 'src/app/types/record-affiliation.endpoint'\nimport { RecordPeerReviewService } from '../record-peer-review/record-peer-review.service'\nimport { RecordPersonIdentifierService } from '../record-personal-identifiers/record-person-identifier.service'\nimport { RecordFundingsService } from '../record-fundings/record-fundings.service'\nimport { FundingGroup } from 'src/app/types/record-funding.endpoint'\nimport { PeerReview } from '../../types/record-peer-review.endpoint'\nimport { RecordResearchResourceService } from '../record-research-resource/record-research-resource.service'\nimport { ResearchResourcesEndpoint } from '../../types/record-research-resources.endpoint'\nimport { RecordWorksService } from '../record-works/record-works.service'\nimport { WorksEndpoint } from 'src/app/types/record-works.endpoint'\nimport { RecordPersonService } from '../record-person/record-person.service'\nimport { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service'\nimport { UserInfoService } from '../user-info/user-info.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordService {\n recordSubject$: ReplaySubject\n private readonly $destroy = new Subject()\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _recordBiographyService: RecordBiographyService,\n private _recordKeywordService: RecordKeywordService,\n private _recordNamesService: RecordNamesService,\n private _recordOtherNamesService: RecordOtherNamesService,\n private _recordEmailsService: RecordEmailsService,\n private _recordCountryService: RecordCountriesService,\n private _recordWebsitesService: RecordWebsitesService,\n private _recordAffiliations: RecordAffiliationService,\n private _recordFundings: RecordFundingsService,\n private _recordPersonalIdentifier: RecordPersonIdentifierService,\n private _recordPeerReviewService: RecordPeerReviewService,\n private _recordResearchResourceService: RecordResearchResourceService,\n private _recordWorkService: RecordWorksService,\n private _recordPerson: RecordPersonService,\n private _recordPublicSidebar: RecordPublicSideBarService,\n private _userInfo: UserInfoService\n ) {}\n\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n subscriptionSourceCountDebugger = 0\n /**\n * @param options:\n * - use `forceReload` to force all server calls.\n * - use `publicRecordId` to load a public record or leave the `publicRecordId` undefined\n * to load the current user private record.\n *\n * Note: sending the `privateRecordId` is deprecated\n *\n * @returns And subject with all the require data from private or public orcid record\n */\n getRecord(options?: UserRecordOptions): Observable {\n if (!this.recordSubject$) {\n this.recordSubject$ = new ReplaySubject(1)\n this.attachDebugger()\n } else if (!options?.forceReload) {\n return this.recordSubject$.asObservable()\n }\n\n if (this.recordSubject$ && options?.cleanCacheIfExist) {\n this.recordSubject$.next(undefined)\n }\n const subscriptionCount = this.subscriptionSourceCountDebugger\n this.subscriptionSourceCountDebugger =\n this.subscriptionSourceCountDebugger + 1\n\n // Un-subscribe from previous combineLatest subscriptions\n this.$destroy.next()\n // Subscribe to a new combineLatest http calls subscription\n\n combineLatest([\n this._recordEmailsService\n .getEmails(options)\n .pipe(startWith(undefined)),\n this._recordOtherNamesService\n .getOtherNames(options)\n .pipe(startWith(undefined)),\n this._recordCountryService\n .getAddresses(options)\n .pipe(startWith(undefined)),\n this._recordKeywordService\n .getKeywords(options)\n .pipe(startWith(undefined)),\n this._recordWebsitesService\n .getWebsites(options)\n .pipe(startWith(undefined)),\n this._recordPersonalIdentifier\n .getPersonalIdentifiers(options)\n .pipe(startWith(undefined)),\n this._recordNamesService\n .getNames(options)\n .pipe(startWith(undefined)),\n this._recordBiographyService\n .getBiography(options)\n .pipe(startWith(undefined)),\n this._recordAffiliations\n .getAffiliations(options)\n .pipe(startWith(undefined)),\n this._recordFundings\n .getFundings(options)\n .pipe(startWith(undefined)),\n this.getPreferences(options)?.pipe(startWith(undefined)),\n this._recordPeerReviewService\n .getPeerReviewGroups(options)\n .pipe(startWith(undefined)),\n this._recordResearchResourceService\n .getResearchResourcePage(options)\n .pipe(startWith(undefined)),\n this._recordWorkService\n .getWorks(options)\n .pipe(startWith(undefined)),\n this.getLastModifiedTime(options).pipe(startWith(undefined)),\n this._userInfo.getUserInfo(options).pipe(startWith(undefined)),\n ])\n .pipe(\n tap(\n ([\n emails,\n otherNames,\n countries,\n keyword,\n website,\n externalIdentifier,\n names,\n biography,\n affiliations,\n fundings,\n preferences,\n peerReviews,\n researchResources,\n works,\n lastModifiedTime,\n userInfo,\n ]) => {\n this.recordSubject$.next({\n subscriptionCount: subscriptionCount,\n emails: emails as EmailsEndpoint,\n otherNames: otherNames as OtherNamesEndPoint,\n countries: countries as CountriesEndpoint,\n keyword: keyword as KeywordEndPoint,\n website: website as WebsitesEndPoint,\n externalIdentifier:\n externalIdentifier as PersonIdentifierEndpoint,\n names: names as NamesEndPoint,\n biography: biography as BiographyEndPoint,\n affiliations: affiliations as AffiliationUIGroup[],\n fundings: fundings as FundingGroup[],\n preferences: preferences as Preferences,\n peerReviews: peerReviews as PeerReview[],\n researchResources: researchResources as ResearchResourcesEndpoint,\n works: works as WorksEndpoint,\n lastModifiedTime: lastModifiedTime as any,\n userInfo: userInfo as UserInfo,\n })\n }\n ),\n takeUntil(this.$destroy)\n )\n\n .subscribe()\n\n return this.recordSubject$.asObservable()\n }\n attachDebugger() {\n if (environment.debugger) {\n this.recordSubject$.subscribe((value) => {\n console.debug(value)\n })\n }\n }\n\n getExternalIdentifier(): Observable {\n return this._http\n .get(\n environment.API_WEB + `my-orcid/externalIdentifiers.json`,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getKeywords(): Observable {\n return this._http\n .get(environment.API_WEB + `my-orcid/keywordsForms.json`, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n // Just a place holder for posting external identifiers, since the frontend does never calls this function\n postExternalIdentifier(\n website: ExternalIdentifier\n ): Observable {\n return this._http\n .post(\n environment.API_WEB + `my-orcid/externalIdentifiers.json`,\n website,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n postKeywords(keywords: Keywords): Observable {\n return this._http\n .post(\n environment.API_WEB + `my-orcid/keywordsForms.json`,\n keywords,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getPreferences(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ): Observable {\n // TODO GET PUBLIC DATA\n if (options.publicRecordId) {\n return of(undefined)\n }\n\n return this._http\n .get(\n environment.API_WEB + `account/preferences.json`,\n\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of({} as Preferences))\n )\n }\n\n postPreferences(names: Preferences): Observable {\n return this._http\n .post(\n environment.API_WEB + `account/preferences.json`,\n names,\n { headers: this.headers }\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getLastModifiedTime(\n options: UserRecordOptions = {\n forceReload: false,\n }\n ) {\n if (options.publicRecordId) {\n return this._recordPublicSidebar\n .getPublicRecordSideBar(options)\n .pipe(map((value) => value.lastModifiedTime))\n }\n return of(undefined)\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -25146,7 +25146,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'\nimport {\n catchError,\n first,\n map,\n retry,\n switchMap,\n take,\n tap,\n} from 'rxjs/operators'\nimport {\n Work,\n WorkGroup,\n WorksEndpoint,\n} from 'src/app/types/record-works.endpoint'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport {\n ContributionRoles,\n GroupingSuggestions,\n Role,\n WorkCombineEndpoint,\n WorkIdType,\n WorkIdTypeValidation,\n _LEGACY_ContributionRoles,\n} from 'src/app/types/works.endpoint'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { VisibilityStrings } from '../../types/common.endpoint'\nimport { DEFAULT_PAGE_SIZE, EXTERNAL_ID_TYPE_WORK } from 'src/app/constants'\nimport { RecordImportWizard } from '../../types/record-peer-review-import.endpoint'\nimport { SortOrderType } from '../../types/sort'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordWorksService {\n lastEmittedValue: WorksEndpoint = null\n groupingSuggestionsSubjectInitialized = false\n groupingSuggestionsSubject = new ReplaySubject(1)\n $workSubject = new ReplaySubject(1)\n offset = 0\n sortOrder: SortOrderType = 'date'\n sortAsc = false\n pageSize = DEFAULT_PAGE_SIZE\n contributionRoles = ContributionRoles\n\n userRecordOptions: UserRecordOptions = {}\n\n private _$loading = new BehaviorSubject(true)\n public get $loading() {\n return this._$loading.asObservable()\n }\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n /**\n * Return an observable with a list of Works\n * Arrange according to the requested parameters\n *\n * @param id user Orcid id\n */\n\n sort(\n offset = 0,\n sort = 'date',\n sortAsc = false,\n orcidId?: string\n ): Observable {\n return this.getWorksData(offset, sort, sortAsc, orcidId).pipe(\n map((data) => {\n this.lastEmittedValue = data\n this.$workSubject.next(data)\n }),\n switchMap((data) => this.$workSubject.asObservable())\n )\n }\n /**\n * Return an observable with a list of Works\n * For full work details getDetails(id, putCode) must be called\n *\n * @param options\n */\n getWorks(options: UserRecordOptions): Observable {\n if (!options) {\n options = {}\n }\n\n if (options?.cleanCacheIfExist && this.$workSubject) {\n this.$workSubject.next(undefined)\n }\n\n options.pageSize = options?.pageSize || DEFAULT_PAGE_SIZE\n options.offset = options.offset || 0\n this.pageSize = options.pageSize\n this.offset = options.offset\n this.sortOrder = options.sort\n this.sortAsc = options.sortAsc\n\n this._$loading.next(true)\n\n let url: string\n if (options.publicRecordId) {\n url = options.publicRecordId + '/worksExtendedPage.json'\n } else {\n url = 'works/worksExtendedPage.json'\n }\n\n this._http\n .get(\n environment.API_WEB +\n url +\n '?offset=' +\n options.offset +\n '&sort=' +\n (options.sort != null ? options.sort : 'date') +\n '&sortAsc=' +\n (options.sortAsc != null ? options.sortAsc : false) +\n `&pageSize=` +\n options.pageSize\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of({ groups: [] } as WorksEndpoint)),\n map((data) => {\n data.pageSize = options.pageSize\n data.pageIndex = options.offset\n ? Math.floor(options.offset / options.pageSize)\n : 0\n data.groups = this.calculateVisibilityErrors(data.groups)\n return data\n }),\n tap((data) => {\n this._$loading.next(false)\n this.lastEmittedValue = data\n this.$workSubject.next(data)\n }),\n tap(() => {\n if (!options.publicRecordId) {\n this.getWorksGroupingSuggestions({ force: true })\n }\n })\n )\n .subscribe()\n\n return this.$workSubject.asObservable()\n }\n\n private calculateVisibilityErrors(groups: WorkGroup[]): WorkGroup[] {\n return groups?.map((group) => {\n group.visibilityError = !!group.works.find(\n (x) => x.visibility.visibility !== group.activeVisibility\n )\n return group\n })\n }\n\n changeUserRecordContext(\n userRecordOptions: UserRecordOptions\n ): Observable {\n this.userRecordOptions = userRecordOptions\n return this.getWorks(userRecordOptions).pipe(take(1))\n }\n\n /**\n * Similar to get() witch to returns a list of Work objects\n * this returns the same observable list but with the details of the requested work.\n *\n * This would add the following data to the Work:\n * citation, contributors, countryCode, countryName, createdDate, dateSortString, dateSortString\n * languageCode, languageName, url, lastModified, shortDescription, subtitle, workCategory\n *\n * TODO check why the userSource attribute comes as false on this call\n *\n * @param orcidId user Orcid id\n * @param putCode code of work\n */\n\n getDetails(putCode: string, orcidId?: string): Observable {\n return this.getWorkInfo(putCode, orcidId).pipe(\n tap((workWithDetails) => {\n this.lastEmittedValue.groups.map((works) => {\n works.works = works.works.map((work) => {\n if (work.putCode.value === putCode) {\n return workWithDetails\n }\n return work\n })\n })\n this.$workSubject.next(this.lastEmittedValue)\n }),\n switchMap(() => {\n return this.$workSubject.asObservable()\n })\n )\n }\n\n getWorkInfo(putCode: string, orcidId?: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `${\n orcidId ? orcidId + '/' : 'works/'\n }getWorkInfo.json?workId=${putCode}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getWorksInfo(putCodes: string[], orcidId?: string): Observable {\n return this._http\n .get(\n environment.API_WEB + `works/worksInfo/${putCodes.join(',')}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getWorksData(\n offset,\n sort,\n sortAsc,\n orcidId?: string\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `${\n orcidId ? orcidId + '/' : 'works/'\n }worksPage.json?offset=${offset}&sort=${sort}&sortAsc=${sortAsc}&pageSize=50`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n save(\n work: Work,\n requireReload = true,\n isLastWorkElement = false\n ): Observable {\n return this._http\n .post(environment.API_WEB + `works/work.json`, work)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => {\n if (!isLastWorkElement) {\n this.getWorks({ forceReload: true })\n }\n })\n )\n }\n\n getWork(): Observable {\n return this._http.get(environment.API_WEB + `works/work.json`).pipe(\n retry(3),\n map((x) => {\n x.workExternalIdentifiers = []\n return x\n }),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n set(value: any): Observable {\n throw new Error('Method not implemented.')\n }\n\n updateVisibility(\n putCode: string,\n visibility: VisibilityStrings\n ): Observable {\n const options = {\n forceReload: true,\n offset: this.offset,\n sort: this.sortOrder,\n sortAsc: this.sortAsc,\n }\n\n return this._http\n .get(\n environment.API_WEB + 'works/' + putCode + '/visibility/' + visibility\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getWorks(options))\n )\n }\n\n updatePreferredSource(putCode: string): Observable {\n return this._http\n .get(\n environment.API_WEB + 'works/updateToMaxDisplay.json?putCode=' + putCode\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() =>\n this.getWorks({ ...this.userRecordOptions, forceReload: true })\n )\n )\n }\n\n public loadWorkIdTypes(): Observable {\n return this._http\n .get(`${environment.API_WEB}works/idTypes.json?query=`)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n public validateWorkIdTypes(\n idType: string,\n workId: string\n ): Observable {\n return this._http\n .get(\n `${environment.API_WEB}works/id/${idType}?value=${workId}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n delete(putCode: any): Observable {\n return this._http\n .delete(\n environment.API_WEB +\n 'works/' +\n (Array.isArray(putCode) ? putCode.join(',') : putCode)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getWorks({ forceReload: true }))\n )\n }\n\n combine(putCodes: string[]): Observable {\n return this.combinePutCodes(putCodes.join(','))\n }\n\n combinePutCodes(putCodes: string): Observable {\n return this._http\n .post(\n environment.API_WEB + 'works/group/' + putCodes,\n {}\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getWorks({ forceReload: true }))\n )\n }\n\n visibility(\n putCodes: string[],\n visibility: VisibilityStrings\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'works/' +\n putCodes.join(',') +\n '/visibility/' +\n visibility\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getWorks({ forceReload: true }))\n )\n }\n\n export(): Observable {\n return this._http.get(environment.API_WEB + 'works/works.bib', {\n responseType: 'text',\n })\n }\n\n exportSelected(putCodes: string[]): Observable {\n return this._http.get(\n environment.API_WEB +\n 'works/export/bibtex?workIdsStr=' +\n putCodes.join(','),\n {\n responseType: 'text',\n }\n )\n }\n\n loadWorkImportWizardList(): Observable {\n return this._http.get(\n environment.API_WEB + 'workspace/retrieve-work-import-wizards.json'\n )\n }\n\n loadExternalId(\n externalId: string,\n type: EXTERNAL_ID_TYPE_WORK\n ): Observable {\n let url = 'works/resolve/doi?value='\n if (type === EXTERNAL_ID_TYPE_WORK.pubMed) {\n const regex = new RegExp(/((.*[\\/,\\\\](pmc))|(PMC)\\/?\\d{5})/g)\n const result = regex.exec(externalId)\n url = result ? 'works/resolve/pmc/?value=' : 'works/resolve/pmid?value='\n }\n\n return this._http.get(environment.API_WEB + url + externalId)\n }\n\n worksValidate(obj): Observable {\n return this._http.post(\n environment.API_WEB + 'works/worksValidate.json',\n JSON.stringify(obj),\n {\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n },\n }\n )\n }\n\n getWorksGroupingSuggestions(\n options: { force: boolean } = { force: false }\n ): Observable {\n if (options.force || !this.groupingSuggestionsSubjectInitialized) {\n this.groupingSuggestionsSubjectInitialized = true\n this._http\n .get(\n environment.API_WEB + 'works/groupingSuggestions.json',\n {\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n },\n }\n )\n .subscribe((x) => this.groupingSuggestionsSubject.next(x))\n }\n return this.groupingSuggestionsSubject.asObservable()\n }\n\n getContributionRoleByKey(key: string): Role {\n return (\n this.contributionRoles.find((role) => role.key === key) ||\n _LEGACY_ContributionRoles.find((role) => role.key === key)\n )\n }\n}\n", + "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'\nimport {\n catchError,\n first,\n map,\n retry,\n switchMap,\n take,\n tap,\n} from 'rxjs/operators'\nimport {\n Work,\n WorkGroup,\n WorksEndpoint,\n} from 'src/app/types/record-works.endpoint'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport {\n ContributionRoles,\n GroupingSuggestions,\n Role,\n WorkCombineEndpoint,\n WorkIdType,\n WorkIdTypeValidation,\n _LEGACY_ContributionRoles,\n} from 'src/app/types/works.endpoint'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { VisibilityStrings } from '../../types/common.endpoint'\nimport { DEFAULT_PAGE_SIZE, EXTERNAL_ID_TYPE_WORK } from 'src/app/constants'\nimport { RecordImportWizard } from '../../types/record-peer-review-import.endpoint'\nimport { SortOrderType } from '../../types/sort'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordWorksService {\n lastEmittedValue: WorksEndpoint = null\n groupingSuggestionsSubjectInitialized = false\n groupingSuggestionsSubject = new ReplaySubject(1)\n $workSubject = new ReplaySubject(1)\n offset = 0\n sortOrder: SortOrderType = 'date'\n sortAsc = false\n pageSize = DEFAULT_PAGE_SIZE\n contributionRoles = ContributionRoles\n\n userRecordOptions: UserRecordOptions = {}\n\n private _$loading = new BehaviorSubject(true)\n public get $loading() {\n return this._$loading.asObservable()\n }\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n /**\n * Return an observable with a list of Works\n * Arrange according to the requested parameters\n *\n * @param id user Orcid id\n */\n\n sort(\n offset = 0,\n sort = 'date',\n sortAsc = false,\n orcidId?: string\n ): Observable {\n return this.getWorksData(offset, sort, sortAsc, orcidId).pipe(\n map((data) => {\n this.lastEmittedValue = data\n this.$workSubject.next(data)\n }),\n switchMap((data) => this.$workSubject.asObservable())\n )\n }\n /**\n * Return an observable with a list of Works\n * For full work details getDetails(id, putCode) must be called\n *\n * @param options\n */\n getWorks(options: UserRecordOptions): Observable {\n if (!options) {\n options = {}\n }\n\n if (options?.cleanCacheIfExist && this.$workSubject) {\n this.$workSubject.next(undefined)\n }\n\n options.pageSize = options?.pageSize || DEFAULT_PAGE_SIZE\n options.offset = options.offset || 0\n this.pageSize = options.pageSize\n this.offset = options.offset\n this.sortOrder = options.sort\n this.sortAsc = options.sortAsc\n\n this._$loading.next(true)\n\n let url: string\n if (options.publicRecordId) {\n url = options.publicRecordId + '/worksExtendedPage.json'\n } else {\n url = 'works/worksExtendedPage.json'\n }\n\n this._http\n .get(\n environment.API_WEB +\n url +\n '?offset=' +\n options.offset +\n '&sort=' +\n (options.sort != null ? options.sort : 'date') +\n '&sortAsc=' +\n (options.sortAsc != null ? options.sortAsc : false) +\n `&pageSize=` +\n options.pageSize\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n catchError(() => of({ groups: [] } as WorksEndpoint)),\n map((data) => {\n data.pageSize = options.pageSize\n data.pageIndex = options.offset\n ? Math.floor(options.offset / options.pageSize)\n : 0\n data.groups = this.calculateVisibilityErrors(data.groups)\n return data\n }),\n tap((data) => {\n this._$loading.next(false)\n this.lastEmittedValue = data\n this.$workSubject.next(data)\n }),\n tap(() => {\n if (!options.publicRecordId) {\n this.getWorksGroupingSuggestions({ force: true })\n }\n })\n )\n .subscribe()\n\n return this.$workSubject.asObservable()\n }\n\n private calculateVisibilityErrors(groups: WorkGroup[]): WorkGroup[] {\n return groups?.map((group) => {\n group.visibilityError = !!group.works.find(\n (x) => x.visibility.visibility !== group.activeVisibility\n )\n return group\n })\n }\n\n changeUserRecordContext(\n userRecordOptions: UserRecordOptions\n ): Observable {\n this.userRecordOptions = userRecordOptions\n return this.getWorks(userRecordOptions).pipe(take(1))\n }\n\n /**\n * Similar to get() witch to returns a list of Work objects\n * this returns the same observable list but with the details of the requested work.\n *\n * This would add the following data to the Work:\n * citation, contributors, countryCode, countryName, createdDate, dateSortString, dateSortString\n * languageCode, languageName, url, lastModified, shortDescription, subtitle, workCategory\n *\n * TODO check why the userSource attribute comes as false on this call\n *\n * @param orcidId user Orcid id\n * @param putCode code of work\n */\n\n getDetails(putCode: string, orcidId?: string): Observable {\n return this.getWorkInfo(putCode, orcidId).pipe(\n tap((workWithDetails) => {\n this.lastEmittedValue.groups.map((works) => {\n works.works = works.works.map((work) => {\n if (work.putCode.value === putCode) {\n return workWithDetails\n }\n return work\n })\n })\n this.$workSubject.next(this.lastEmittedValue)\n }),\n switchMap(() => {\n return this.$workSubject.asObservable()\n })\n )\n }\n\n getWorkInfo(putCode: string, orcidId?: string): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `${\n orcidId ? orcidId + '/' : 'works/'\n }getWorkInfo.json?workId=${putCode}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getWorksInfo(putCodes: string[], orcidId?: string): Observable {\n return this._http\n .get(\n environment.API_WEB + `works/worksInfo/${putCodes.join(',')}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getWorksData(\n offset,\n sort,\n sortAsc,\n orcidId?: string\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n `${\n orcidId ? orcidId + '/' : 'works/'\n }worksPage.json?offset=${offset}&sort=${sort}&sortAsc=${sortAsc}&pageSize=50`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n save(\n work: Work,\n requireReload = true,\n isLastWorkElement = false\n ): Observable {\n return this._http\n .post(environment.API_WEB + `works/work.json`, work)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => {\n if (!isLastWorkElement) {\n this.getWorks({ forceReload: true })\n }\n })\n )\n }\n\n getWork(): Observable {\n return this._http.get(environment.API_WEB + `works/work.json`).pipe(\n retry(3),\n map((x) => {\n x.workExternalIdentifiers = []\n return x\n }),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n set(value: any): Observable {\n throw new Error('Method not implemented.')\n }\n\n updateVisibility(\n putCode: string,\n visibility: VisibilityStrings\n ): Observable {\n const options = {\n forceReload: true,\n offset: this.offset,\n sort: this.sortOrder,\n sortAsc: this.sortAsc,\n }\n\n return this._http\n .get(\n environment.API_WEB + 'works/' + putCode + '/visibility/' + visibility\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getWorks(options))\n )\n }\n\n updatePreferredSource(putCode: string): Observable {\n return this._http\n .get(\n environment.API_WEB + 'works/updateToMaxDisplay.json?putCode=' + putCode\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() =>\n this.getWorks({ ...this.userRecordOptions, forceReload: true })\n )\n )\n }\n\n public loadWorkIdTypes(): Observable {\n return this._http\n .get(`${environment.API_WEB}works/idTypes.json?query=`)\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n public validateWorkIdTypes(\n idType: string,\n workId: string\n ): Observable {\n return this._http\n .get(\n `${environment.API_WEB}works/id/${idType}?value=${workId}`\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n delete(putCode: any): Observable {\n return this._http\n .delete(\n environment.API_WEB +\n 'works/' +\n (Array.isArray(putCode) ? putCode.join(',') : putCode)\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getWorks({ forceReload: true }))\n )\n }\n\n combine(putCodes: string[]): Observable {\n return this.combinePutCodes(putCodes.join(','))\n }\n\n combinePutCodes(putCodes: string): Observable {\n return this._http\n .post(\n environment.API_WEB + 'works/group/' + putCodes,\n {}\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getWorks({ forceReload: true }))\n )\n }\n\n visibility(\n putCodes: string[],\n visibility: VisibilityStrings\n ): Observable {\n return this._http\n .get(\n environment.API_WEB +\n 'works/' +\n putCodes.join(',') +\n '/visibility/' +\n visibility\n )\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error)),\n tap(() => this.getWorks({ forceReload: true }))\n )\n }\n\n export(): Observable {\n return this._http.get(environment.API_WEB + 'works/works.bib', {\n responseType: 'text',\n })\n }\n\n exportSelected(putCodes: string[]): Observable {\n return this._http.get(\n environment.API_WEB +\n 'works/export/bibtex?workIdsStr=' +\n putCodes.join(','),\n {\n responseType: 'text',\n }\n )\n }\n\n loadWorkImportWizardList(): Observable {\n return this._http.get(\n environment.API_WEB + 'workspace/retrieve-work-import-wizards.json'\n )\n }\n\n loadExternalId(\n externalId: string,\n type: EXTERNAL_ID_TYPE_WORK\n ): Observable {\n let url = 'works/resolve/doi?value='\n if (type === EXTERNAL_ID_TYPE_WORK.pubMed) {\n const regex = new RegExp(/((.*[\\/,\\\\](pmc))|(PMC)\\/?\\d{5})/g)\n const result = regex.exec(externalId)\n url = result ? 'works/resolve/pmc/?value=' : 'works/resolve/pmid?value='\n }\n\n return this._http.get(environment.API_WEB + url + externalId)\n }\n\n worksValidate(obj): Observable {\n return this._http.post(\n environment.API_WEB + 'works/worksValidate.json',\n JSON.stringify(obj),\n {\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n },\n }\n )\n }\n\n getWorksGroupingSuggestions(\n options: { force: boolean } = { force: false }\n ): Observable {\n if (options.force || !this.groupingSuggestionsSubjectInitialized) {\n this.groupingSuggestionsSubjectInitialized = true\n this._http\n .get(\n environment.API_WEB + 'works/groupingSuggestions.json',\n {\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n },\n }\n )\n .subscribe((x) => this.groupingSuggestionsSubject.next(x))\n }\n return this.groupingSuggestionsSubject.asObservable()\n }\n\n getContributionRoleByKey(key: string): Role {\n return (\n this.contributionRoles.find((role) => role.key === key) ||\n _LEGACY_ContributionRoles.find((role) => role.key === key)\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -25456,7 +25456,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { UntypedFormGroup } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { catchError, first, map, retry, switchMap } from 'rxjs/operators'\nimport { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { RequestInfoForm } from 'src/app/types'\nimport {\n DuplicatedName,\n RegisterConfirmResponse,\n RegisterForm,\n} from 'src/app/types/register.endpoint'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { UserService } from '../user/user.service'\nimport { RegisterBackendValidatorMixin } from './register.backend-validators'\nimport { RegisterFormAdapterMixin } from './register.form-adapter'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { objectToUrlParameters } from '../../constants'\nimport { ReactivationLocal } from '../../types/reactivation.local'\n\n// Mixing boiler plate\n\nclass RegisterServiceBase {\n constructor(\n public _http: HttpClient,\n public _errorHandler: ErrorHandlerService\n ) {}\n}\nconst _RegisterServiceMixingBase = RegisterBackendValidatorMixin(\n RegisterFormAdapterMixin(RegisterServiceBase)\n)\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RegisterService extends _RegisterServiceMixingBase {\n backendRegistrationForm: RegisterForm\n\n constructor(\n _http: HttpClient,\n _errorHandler: ErrorHandlerService,\n private _userService: UserService,\n private _platform: PlatformInfoService\n ) {\n super(_http, _errorHandler)\n }\n\n public checkDuplicatedResearcher(names: {\n familyNames: string\n givenNames: string\n }) {\n return this._http\n .get(environment.API_WEB + `dupicateResearcher.json`, {\n params: names,\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getRegisterForm(): Observable {\n return this._http\n .get(`${environment.API_WEB}register.json`, {\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n .pipe(map((form) => (this.backendRegistrationForm = form)))\n }\n\n register(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup,\n reactivation: ReactivationLocal,\n requestInfoForm?: RequestInfoForm,\n updateUserService = true\n ): Observable {\n this.backendRegistrationForm.valNumClient =\n this.backendRegistrationForm.valNumServer / 2\n const registerForm = this.formGroupToFullRegistrationForm(\n StepA,\n StepB,\n StepC\n )\n this.addOauthContext(registerForm, requestInfoForm)\n return this._platform.get().pipe(\n first(),\n switchMap((platform) => {\n let url = `${environment.API_WEB}`\n if (\n platform.institutional ||\n platform.queryParameters.linkType === 'shibboleth'\n ) {\n url += `shibboleth/`\n }\n if (reactivation.isReactivation) {\n url += `reactivationConfirm.json?${objectToUrlParameters(\n platform.queryParameters\n )}`\n registerForm.resetParams = reactivation.reactivationCode\n } else {\n url += `registerConfirm.json?${objectToUrlParameters(\n platform.queryParameters\n )}`\n }\n\n const registerFormWithTypeContext = this.addCreationTypeContext(\n platform,\n registerForm\n )\n\n return this._http\n .post(\n url,\n Object.assign(\n this.backendRegistrationForm,\n registerFormWithTypeContext\n )\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.REGISTER)\n ),\n switchMap((value) => {\n return this._userService.refreshUserSession(true, true).pipe(\n first(),\n map((userStatus) => {\n if (!userStatus.loggedIn && !value.errors) {\n // sanity check the user should be logged\n // sanity check the user should be logged\n this._errorHandler.handleError(\n new Error('registerSanityIssue'),\n ERROR_REPORT.REGISTER\n )\n }\n return value\n })\n )\n })\n )\n })\n )\n }\n\n addOauthContext(\n registerForm: RegisterForm,\n requestInfoForm?: RequestInfoForm\n ): void {\n if (requestInfoForm) {\n registerForm.referredBy = { value: requestInfoForm.clientId }\n }\n }\n addCreationTypeContext(\n platform: PlatformInfo,\n registerForm: RegisterForm\n ): RegisterForm {\n /// TODO @leomendoza123 depend only on the user session thirty party login data\n /// avoid taking data from the the parameters.\n if (\n platform.social ||\n platform.queryParameters.providerId === 'facebook' ||\n platform.queryParameters.providerId === 'google'\n ) {\n registerForm.linkType = 'social'\n return registerForm\n } else if (platform.institutional || platform.queryParameters.providerId) {\n registerForm.linkType = 'shibboleth'\n return registerForm\n } else {\n return registerForm\n }\n }\n}\n", + "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { UntypedFormGroup } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { catchError, first, map, retry, switchMap } from 'rxjs/operators'\nimport { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { RequestInfoForm } from 'src/app/types'\nimport {\n DuplicatedName,\n RegisterConfirmResponse,\n RegisterForm,\n} from 'src/app/types/register.endpoint'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { UserService } from '../user/user.service'\nimport { RegisterBackendValidatorMixin } from './register.backend-validators'\nimport { RegisterFormAdapterMixin } from './register.form-adapter'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { objectToUrlParameters } from '../../constants'\nimport { ReactivationLocal } from '../../types/reactivation.local'\n\n// Mixing boiler plate\n\nclass RegisterServiceBase {\n constructor(\n public _http: HttpClient,\n public _errorHandler: ErrorHandlerService\n ) {}\n}\nconst _RegisterServiceMixingBase = RegisterBackendValidatorMixin(\n RegisterFormAdapterMixin(RegisterServiceBase)\n)\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RegisterService extends _RegisterServiceMixingBase {\n backendRegistrationForm: RegisterForm\n\n constructor(\n _http: HttpClient,\n _errorHandler: ErrorHandlerService,\n private _userService: UserService,\n private _platform: PlatformInfoService\n ) {\n super(_http, _errorHandler)\n }\n\n public checkDuplicatedResearcher(names: {\n familyNames: string\n givenNames: string\n }) {\n return this._http\n .get(environment.API_WEB + `dupicateResearcher.json`, {\n params: names,\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getRegisterForm(): Observable {\n return this._http\n .get(`${environment.API_WEB}register.json`, {\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n .pipe(map((form) => (this.backendRegistrationForm = form)))\n }\n\n register(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup,\n reactivation: ReactivationLocal,\n requestInfoForm?: RequestInfoForm,\n updateUserService = true\n ): Observable {\n this.backendRegistrationForm.valNumClient =\n this.backendRegistrationForm.valNumServer / 2\n const registerForm = this.formGroupToFullRegistrationForm(\n StepA,\n StepB,\n StepC\n )\n this.addOauthContext(registerForm, requestInfoForm)\n return this._platform.get().pipe(\n first(),\n switchMap((platform) => {\n let url = `${environment.API_WEB}`\n if (\n platform.institutional ||\n platform.queryParameters.linkType === 'shibboleth'\n ) {\n url += `shibboleth/`\n }\n if (reactivation.isReactivation) {\n url += `reactivationConfirm.json?${objectToUrlParameters(\n platform.queryParameters\n )}`\n registerForm.resetParams = reactivation.reactivationCode\n } else {\n url += `registerConfirm.json?${objectToUrlParameters(\n platform.queryParameters\n )}`\n }\n\n const registerFormWithTypeContext = this.addCreationTypeContext(\n platform,\n registerForm\n )\n\n return this._http\n .post(\n url,\n Object.assign(\n this.backendRegistrationForm,\n registerFormWithTypeContext\n )\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.REGISTER)\n ),\n switchMap((value) => {\n return this._userService.refreshUserSession(true, true).pipe(\n first(),\n map((userStatus) => {\n if (!userStatus.loggedIn && !value.errors) {\n // sanity check the user should be logged\n // sanity check the user should be logged\n this._errorHandler.handleError(\n new Error('registerSanityIssue'),\n ERROR_REPORT.REGISTER\n )\n }\n return value\n })\n )\n })\n )\n })\n )\n }\n\n addOauthContext(\n registerForm: RegisterForm,\n requestInfoForm?: RequestInfoForm\n ): void {\n if (requestInfoForm) {\n registerForm.referredBy = { value: requestInfoForm.clientId }\n }\n }\n addCreationTypeContext(\n platform: PlatformInfo,\n registerForm: RegisterForm\n ): RegisterForm {\n /// TODO @leomendoza123 depend only on the user session thirty party login data\n /// avoid taking data from the the parameters.\n if (\n platform.social ||\n platform.queryParameters.providerId === 'facebook' ||\n platform.queryParameters.providerId === 'google'\n ) {\n registerForm.linkType = 'social'\n return registerForm\n } else if (platform.institutional || platform.queryParameters.providerId) {\n registerForm.linkType = 'shibboleth'\n return registerForm\n } else {\n return registerForm\n }\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -25596,7 +25596,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Injectable } from '@angular/core'\nimport { Meta } from '@angular/platform-browser'\nimport { environment } from 'src/environments/environment'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RobotsMetaTagsService {\n private google = 'googlebot'\n private robots = 'robots'\n private baiduSpider = 'BaiduSpider'\n\n constructor(private meta: Meta) {}\n\n disallowRobots() {\n return this.meta.updateTag({\n name: this.robots,\n content: 'noindex, nofollow',\n })\n }\n restoreEnvironmentRobotsConfig() {\n if (environment.ROBOTS) {\n this.meta.updateTag({ name: this.robots, content: environment.ROBOTS })\n } else {\n // If not defined by the environment do not allow robots\n this.meta.updateTag({\n name: this.robots,\n content: 'noindex, nofollow',\n })\n }\n }\n}\n", + "sourceCode": "import { Injectable } from '@angular/core'\nimport { Meta } from '@angular/platform-browser'\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RobotsMetaTagsService {\n private google = 'googlebot'\n private robots = 'robots'\n private baiduSpider = 'BaiduSpider'\n\n constructor(private meta: Meta) {}\n\n disallowRobots() {\n return this.meta.updateTag({\n name: this.robots,\n content: 'noindex, nofollow',\n })\n }\n restoreEnvironmentRobotsConfig() {\n if (environment.ROBOTS) {\n this.meta.updateTag({ name: this.robots, content: environment.ROBOTS })\n } else {\n // If not defined by the environment do not allow robots\n this.meta.updateTag({\n name: this.robots,\n content: 'noindex, nofollow',\n })\n }\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -25969,7 +25969,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Injectable } from '@angular/core'\nimport { environment } from 'src/environments/environment'\nimport { HttpClient } from '@angular/common/http'\nimport { Observable, of } from 'rxjs'\nimport { SearchParameters, SearchResults } from 'src/app/types'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { catchError, delay, map } from 'rxjs/operators'\nimport {\n DEFAULT_PAGE_SIZE,\n ORCID_REGEXP_CASE_INSENSITIVE,\n} from 'src/app/constants'\nimport { debug } from 'console'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SearchService {\n quickSearchEDisMax =\n // tslint:disable-next-line: max-line-length\n '{!edismax qf=\"given-and-family-names^50.0 family-name^10.0 given-names^10.0 credit-name^10.0 other-names^5.0 text^1.0\" pf=\"given-and-family-names^50.0\" bq=\"current-institution-affiliation-name:[* TO *]^100.0 past-institution-affiliation-name:[* TO *]^70\" mm=1}'\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n search(querryParam: SearchParameters): Observable {\n return this._http\n .get(\n `${environment.API_PUB}/expanded-search/${this.buildSearchUrl(\n querryParam\n )}`,\n {\n headers: { Accept: 'application/json' },\n }\n )\n .pipe(\n catchError((error) => this._errorHandler.handleError(error)),\n map((x) => {\n x['expanded-result'] = x['expanded-result']?.map((element) => {\n if (!element['given-names'] && !element['family-names']) {\n element[\n 'given-names'\n ] = $localize`:@@account.nameIsPri:Name is private`\n }\n\n return element\n })\n return x\n })\n )\n }\n\n private buildSearchUrl(querryParam: SearchParameters): string {\n const escapedParams: SearchParameters = {}\n Object.keys(querryParam).map((key) => {\n if (typeof querryParam[key] === 'string') {\n escapedParams[key] = this.escapeReservedChar(querryParam[key])\n }\n })\n\n const orcidId =\n this.extractOrcidId(escapedParams.orcid) ||\n this.extractOrcidId(escapedParams.searchQuery)\n\n if (escapedParams && orcidId) {\n // When there is an Orcid id on the `Advance search Orcid iD` or `Quick search input`: only search the orcid ID\n return this.encodeUrlWithPagination(`orcid:${orcidId}`, querryParam)\n } else if (escapedParams && escapedParams.searchQuery) {\n // When there is a `searchQuery` parameter with no Orcid iD: do a quick search\n return this.encodeUrlWithPagination(\n this.quickSearchEDisMax + escapedParams.searchQuery,\n querryParam\n )\n } else if (escapedParams) {\n // otherwise do an advanced search\n const searchParameters = []\n if (escapedParams.firstName) {\n let searchValue = `given-names:${escapedParams.firstName}`\n if (escapedParams.otherFields === 'true') {\n searchValue += ` OR other-names:${escapedParams.firstName}`\n }\n searchParameters.push(`(${searchValue})`)\n }\n if (escapedParams.lastName) {\n let searchValue = `family-name:${escapedParams.lastName}`\n if (escapedParams.otherFields === 'true') {\n searchValue += ` OR other-names:${escapedParams.lastName}`\n }\n searchParameters.push(`(${searchValue})`)\n }\n if (escapedParams.keyword) {\n searchParameters.push(`keyword:${escapedParams.keyword}`)\n }\n if (escapedParams.institution) {\n // if all chars are numbers, assume it's a ringgold id\n if (escapedParams.institution.match(/^[0-9]*$/)) {\n searchParameters.push(`ringgold-org-id:${escapedParams.institution}`)\n } else if (escapedParams.institution.startsWith('grid.')) {\n searchParameters.push(`grid-org-id:${escapedParams.institution}`)\n }\n //if starts with http, assume it's a ror id\n else if (escapedParams.institution.startsWith('http')) {\n searchParameters.push(`ror-org-id:${escapedParams.institution}`)\n } else {\n searchParameters.push(\n `affiliation-org-name:${escapedParams.institution}`\n )\n }\n }\n return this.setEdismaxAndEncodedUrlWithPagination(\n searchParameters.join(' AND '),\n querryParam\n )\n }\n }\n\n private escapeReservedChar(inputText: any) {\n // escape all reserved chars except double quotes\n // per https://lucene.apache.org/solr/guide/6_6/the-standard-query-parser.html#TheStandardQueryParser-EscapingSpecialCharacters\n const escapedText = inputText.replace(/([!^&*()+=\\[\\]\\\\/{}|:?~])/g, '\\\\$1')\n return escapedText.toLowerCase().trim()\n }\n\n private extractOrcidId(string: any) {\n const regexResult = ORCID_REGEXP_CASE_INSENSITIVE.exec(string)\n if (regexResult) {\n return regexResult[0].toUpperCase()\n }\n return null\n }\n\n // Remove empty values, trim strings and remove false parameters\n searchParametersAdapter(value: SearchParameters) {\n const trimParameters = {}\n Object.keys(value).forEach((element) => {\n if (typeof value[element] === 'string') {\n if (value[element].trim() && value[element] !== 'false') {\n trimParameters[element] = value[element].trim()\n }\n } else if (value[element]) {\n trimParameters[element] = value[element]\n }\n })\n return trimParameters\n }\n\n private setEdismaxAndEncodedUrlWithPagination(searchStream, querryParam) {\n const bq = encodeURIComponent(\n `current-institution-affiliation-name:[* TO *]^100.0 past-institution-affiliation-name:[* TO *]^70`\n )\n return (\n `?bq=` +\n bq +\n `&defType=edismax&q=${encodeURIComponent(searchStream)}` +\n this.handlePagination(querryParam)\n )\n }\n\n private encodeUrlWithPagination(searchStream, querryParam) {\n return (\n `?q=${encodeURIComponent(searchStream)}` +\n this.handlePagination(querryParam)\n )\n }\n\n private handlePagination(querryParam: SearchParameters): string {\n return `&start=${querryParam.pageIndex * querryParam.pageSize || 0}&rows=${\n querryParam.pageSize || DEFAULT_PAGE_SIZE\n }`\n }\n}\n", + "sourceCode": "import { Injectable } from '@angular/core'\n\nimport { HttpClient } from '@angular/common/http'\nimport { Observable, of } from 'rxjs'\nimport { SearchParameters, SearchResults } from 'src/app/types'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { catchError, delay, map } from 'rxjs/operators'\nimport {\n DEFAULT_PAGE_SIZE,\n ORCID_REGEXP_CASE_INSENSITIVE,\n} from 'src/app/constants'\nimport { debug } from 'console'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SearchService {\n quickSearchEDisMax =\n // tslint:disable-next-line: max-line-length\n '{!edismax qf=\"given-and-family-names^50.0 family-name^10.0 given-names^10.0 credit-name^10.0 other-names^5.0 text^1.0\" pf=\"given-and-family-names^50.0\" bq=\"current-institution-affiliation-name:[* TO *]^100.0 past-institution-affiliation-name:[* TO *]^70\" mm=1}'\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n search(querryParam: SearchParameters): Observable {\n return this._http\n .get(\n `${environment.API_PUB}/expanded-search/${this.buildSearchUrl(\n querryParam\n )}`,\n {\n headers: { Accept: 'application/json' },\n }\n )\n .pipe(\n catchError((error) => this._errorHandler.handleError(error)),\n map((x) => {\n x['expanded-result'] = x['expanded-result']?.map((element) => {\n if (!element['given-names'] && !element['family-names']) {\n element[\n 'given-names'\n ] = $localize`:@@account.nameIsPri:Name is private`\n }\n\n return element\n })\n return x\n })\n )\n }\n\n private buildSearchUrl(querryParam: SearchParameters): string {\n const escapedParams: SearchParameters = {}\n Object.keys(querryParam).map((key) => {\n if (typeof querryParam[key] === 'string') {\n escapedParams[key] = this.escapeReservedChar(querryParam[key])\n }\n })\n\n const orcidId =\n this.extractOrcidId(escapedParams.orcid) ||\n this.extractOrcidId(escapedParams.searchQuery)\n\n if (escapedParams && orcidId) {\n // When there is an Orcid id on the `Advance search Orcid iD` or `Quick search input`: only search the orcid ID\n return this.encodeUrlWithPagination(`orcid:${orcidId}`, querryParam)\n } else if (escapedParams && escapedParams.searchQuery) {\n // When there is a `searchQuery` parameter with no Orcid iD: do a quick search\n return this.encodeUrlWithPagination(\n this.quickSearchEDisMax + escapedParams.searchQuery,\n querryParam\n )\n } else if (escapedParams) {\n // otherwise do an advanced search\n const searchParameters = []\n if (escapedParams.firstName) {\n let searchValue = `given-names:${escapedParams.firstName}`\n if (escapedParams.otherFields === 'true') {\n searchValue += ` OR other-names:${escapedParams.firstName}`\n }\n searchParameters.push(`(${searchValue})`)\n }\n if (escapedParams.lastName) {\n let searchValue = `family-name:${escapedParams.lastName}`\n if (escapedParams.otherFields === 'true') {\n searchValue += ` OR other-names:${escapedParams.lastName}`\n }\n searchParameters.push(`(${searchValue})`)\n }\n if (escapedParams.keyword) {\n searchParameters.push(`keyword:${escapedParams.keyword}`)\n }\n if (escapedParams.institution) {\n // if all chars are numbers, assume it's a ringgold id\n if (escapedParams.institution.match(/^[0-9]*$/)) {\n searchParameters.push(`ringgold-org-id:${escapedParams.institution}`)\n } else if (escapedParams.institution.startsWith('grid.')) {\n searchParameters.push(`grid-org-id:${escapedParams.institution}`)\n }\n //if starts with http, assume it's a ror id\n else if (escapedParams.institution.startsWith('http')) {\n searchParameters.push(`ror-org-id:${escapedParams.institution}`)\n } else {\n searchParameters.push(\n `affiliation-org-name:${escapedParams.institution}`\n )\n }\n }\n return this.setEdismaxAndEncodedUrlWithPagination(\n searchParameters.join(' AND '),\n querryParam\n )\n }\n }\n\n private escapeReservedChar(inputText: any) {\n // escape all reserved chars except double quotes\n // per https://lucene.apache.org/solr/guide/6_6/the-standard-query-parser.html#TheStandardQueryParser-EscapingSpecialCharacters\n const escapedText = inputText.replace(/([!^&*()+=\\[\\]\\\\/{}|:?~])/g, '\\\\$1')\n return escapedText.toLowerCase().trim()\n }\n\n private extractOrcidId(string: any) {\n const regexResult = ORCID_REGEXP_CASE_INSENSITIVE.exec(string)\n if (regexResult) {\n return regexResult[0].toUpperCase()\n }\n return null\n }\n\n // Remove empty values, trim strings and remove false parameters\n searchParametersAdapter(value: SearchParameters) {\n const trimParameters = {}\n Object.keys(value).forEach((element) => {\n if (typeof value[element] === 'string') {\n if (value[element].trim() && value[element] !== 'false') {\n trimParameters[element] = value[element].trim()\n }\n } else if (value[element]) {\n trimParameters[element] = value[element]\n }\n })\n return trimParameters\n }\n\n private setEdismaxAndEncodedUrlWithPagination(searchStream, querryParam) {\n const bq = encodeURIComponent(\n `current-institution-affiliation-name:[* TO *]^100.0 past-institution-affiliation-name:[* TO *]^70`\n )\n return (\n `?bq=` +\n bq +\n `&defType=edismax&q=${encodeURIComponent(searchStream)}` +\n this.handlePagination(querryParam)\n )\n }\n\n private encodeUrlWithPagination(searchStream, querryParam) {\n return (\n `?q=${encodeURIComponent(searchStream)}` +\n this.handlePagination(querryParam)\n )\n }\n\n private handlePagination(querryParam: SearchParameters): string {\n return `&start=${querryParam.pageIndex * querryParam.pageSize || 0}&rows=${\n querryParam.pageSize || DEFAULT_PAGE_SIZE\n }`\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -26393,7 +26393,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Injectable } from '@angular/core'\nimport {\n MatSnackBar,\n MatSnackBarHorizontalPosition,\n} from '@angular/material/snack-bar'\nimport { take } from 'rxjs/operators'\nimport { DisplayMessage, ErrorReport, ScreenDirection } from 'src/app/types'\n\nimport { PlatformInfoService } from '../platform-info'\nimport { SnackbarModule } from './snackbar.module'\nimport { SnackbarComponent } from './snackbar/snackbar.component'\nimport { HttpErrorResponse } from '@angular/common/http'\nimport { environment } from 'src/environments/environment'\n\n@Injectable({\n providedIn: SnackbarModule,\n})\nexport class SnackbarService {\n horizontalPosition: MatSnackBarHorizontalPosition = 'right'\n contentDirection: ScreenDirection = 'ltr'\n constructor(private _snackBar: MatSnackBar, _platform: PlatformInfoService) {\n _platform\n .get()\n .pipe(take(1))\n .subscribe((value) => {\n if (value.rtl) {\n this.horizontalPosition = 'left'\n this.contentDirection = 'rtl'\n }\n })\n }\n\n showErrorMessage(\n error: Error | HttpErrorResponse,\n errorReport?: ErrorReport\n ) {\n let mappedDisplay: DisplayMessage\n if (\n errorReport?.display &&\n (!errorReport.display.displayOnlyOnVerboseEnvironment ||\n environment.VERBOSE_SNACKBAR_ERRORS_REPORTS)\n ) {\n mappedDisplay = {\n ...errorReport.display,\n contentDirection:\n errorReport.display.contentDirection || this.contentDirection,\n closable:\n typeof errorReport.display.closable !== 'undefined'\n ? errorReport.display.closable\n : false,\n }\n this._snackBar.openFromComponent(SnackbarComponent, {\n data: {\n displayMessage: mappedDisplay,\n caption: error.message,\n },\n horizontalPosition: this.horizontalPosition,\n verticalPosition: 'bottom',\n panelClass: 'orcid-error',\n duration: 10 * 1000,\n })\n }\n\n if (errorReport?.analytics) {\n console.error(`\n __Report error GA__\n description: ${errorReport.analytics.code}/${error.message}\\`.replace(/ /g, '')\n fatal: ${errorReport.analytics.fatal}\n `)\n }\n }\n\n showValidationError(\n message: string = $localize`:@@shared.pleaseReviewInvalidForm:Please review the form and fix the issues before saving`,\n title: string = $localize`:@@shared.invalidForm:Form validation error`\n ) {\n const mappedDisplay = {\n contentDirection: this.contentDirection,\n closable: true,\n title,\n message,\n }\n\n this._snackBar.openFromComponent(SnackbarComponent, {\n data: {\n displayMessage: mappedDisplay,\n },\n horizontalPosition: this.horizontalPosition,\n verticalPosition: 'bottom',\n panelClass: 'orcid-error',\n duration: 15 * 1000,\n })\n }\n\n showSuccessMessage(message: DisplayMessage) {\n this._snackBar.openFromComponent(SnackbarComponent, {\n data: {\n displayMessage: message,\n },\n horizontalPosition: this.horizontalPosition,\n verticalPosition: 'bottom',\n panelClass: 'orcid-success',\n duration: (!message.closable ? 15 : 90) * 1000,\n })\n }\n}\n", + "sourceCode": "import { Injectable } from '@angular/core'\nimport {\n MatSnackBar,\n MatSnackBarHorizontalPosition,\n} from '@angular/material/snack-bar'\nimport { take } from 'rxjs/operators'\nimport { DisplayMessage, ErrorReport, ScreenDirection } from 'src/app/types'\n\nimport { PlatformInfoService } from '../platform-info'\nimport { SnackbarModule } from './snackbar.module'\nimport { SnackbarComponent } from './snackbar/snackbar.component'\nimport { HttpErrorResponse } from '@angular/common/http'\n\n\n@Injectable({\n providedIn: SnackbarModule,\n})\nexport class SnackbarService {\n horizontalPosition: MatSnackBarHorizontalPosition = 'right'\n contentDirection: ScreenDirection = 'ltr'\n constructor(private _snackBar: MatSnackBar, _platform: PlatformInfoService) {\n _platform\n .get()\n .pipe(take(1))\n .subscribe((value) => {\n if (value.rtl) {\n this.horizontalPosition = 'left'\n this.contentDirection = 'rtl'\n }\n })\n }\n\n showErrorMessage(\n error: Error | HttpErrorResponse,\n errorReport?: ErrorReport\n ) {\n let mappedDisplay: DisplayMessage\n if (\n errorReport?.display &&\n (!errorReport.display.displayOnlyOnVerboseEnvironment ||\n environment.VERBOSE_SNACKBAR_ERRORS_REPORTS)\n ) {\n mappedDisplay = {\n ...errorReport.display,\n contentDirection:\n errorReport.display.contentDirection || this.contentDirection,\n closable:\n typeof errorReport.display.closable !== 'undefined'\n ? errorReport.display.closable\n : false,\n }\n this._snackBar.openFromComponent(SnackbarComponent, {\n data: {\n displayMessage: mappedDisplay,\n caption: error.message,\n },\n horizontalPosition: this.horizontalPosition,\n verticalPosition: 'bottom',\n panelClass: 'orcid-error',\n duration: 10 * 1000,\n })\n }\n\n if (errorReport?.analytics) {\n console.error(`\n __Report error GA__\n description: ${errorReport.analytics.code}/${error.message}\\`.replace(/ /g, '')\n fatal: ${errorReport.analytics.fatal}\n `)\n }\n }\n\n showValidationError(\n message: string = $localize`:@@shared.pleaseReviewInvalidForm:Please review the form and fix the issues before saving`,\n title: string = $localize`:@@shared.invalidForm:Form validation error`\n ) {\n const mappedDisplay = {\n contentDirection: this.contentDirection,\n closable: true,\n title,\n message,\n }\n\n this._snackBar.openFromComponent(SnackbarComponent, {\n data: {\n displayMessage: mappedDisplay,\n },\n horizontalPosition: this.horizontalPosition,\n verticalPosition: 'bottom',\n panelClass: 'orcid-error',\n duration: 15 * 1000,\n })\n }\n\n showSuccessMessage(message: DisplayMessage) {\n this._snackBar.openFromComponent(SnackbarComponent, {\n data: {\n displayMessage: message,\n },\n horizontalPosition: this.horizontalPosition,\n verticalPosition: 'bottom',\n panelClass: 'orcid-success',\n duration: (!message.closable ? 15 : 90) * 1000,\n })\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -26706,7 +26706,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, ReplaySubject } from 'rxjs'\nimport { map, switchMapTo } from 'rxjs/operators'\nimport { Config } from 'src/app/types/togglz.endpoint'\nimport { MaintenanceMessage } from 'src/app/types/togglz.local'\nimport { environment } from 'src/environments/environment'\n\nimport { UserService } from '..'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TogglzService {\n togglzSubject: ReplaySubject\n constructor(private _http: HttpClient, private userService: UserService) {}\n\n private getConfig() {\n return this._http.get(environment.API_WEB + 'config.json', {\n withCredentials: true,\n })\n }\n getTogglz(): Observable {\n if (!this.togglzSubject) {\n this.togglzSubject = new ReplaySubject(1)\n this.userService.$userStatusChecked\n .asObservable()\n .pipe(switchMapTo(this.getConfig()))\n .subscribe((value) => {\n this.togglzSubject.next(value)\n })\n }\n\n return this.togglzSubject.asObservable()\n }\n\n getStateOf(togglzFeatureName: string): Observable {\n return this.getTogglz().pipe(\n map((data) => data.messages[togglzFeatureName] === 'true')\n )\n }\n\n getMessageOf(togglzFeatureName: string): Observable {\n return this.getTogglz().pipe(\n map((data) => data.messages[togglzFeatureName])\n )\n }\n\n getMaintenanceMessages(): Observable {\n return this.getMessageOf('MAINTENANCE_MESSAGE').pipe(\n map((value) => {\n const plainHtml = value\n const parser = new DOMParser()\n const htmlElement = parser.parseFromString(plainHtml, 'text/html')\n const closableElements = this.nodelistToArray(\n htmlElement.querySelectorAll('div.closable')\n )\n const nonClosableElements = this.nodelistToArray(\n htmlElement.querySelectorAll('div.regular')\n )\n return { plainHtml, closableElements, nonClosableElements }\n })\n )\n }\n\n nodelistToArray(nodes: NodeListOf): Element[] {\n const list = []\n nodes.forEach((element) => {\n list.push(element)\n })\n return list\n }\n}\n", + "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { Observable, ReplaySubject } from 'rxjs'\nimport { map, switchMapTo } from 'rxjs/operators'\nimport { Config } from 'src/app/types/togglz.endpoint'\nimport { MaintenanceMessage } from 'src/app/types/togglz.local'\n\n\nimport { UserService } from '..'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TogglzService {\n togglzSubject: ReplaySubject\n constructor(private _http: HttpClient, private userService: UserService) {}\n\n private getConfig() {\n return this._http.get(environment.API_WEB + 'config.json', {\n withCredentials: true,\n })\n }\n getTogglz(): Observable {\n if (!this.togglzSubject) {\n this.togglzSubject = new ReplaySubject(1)\n this.userService.$userStatusChecked\n .asObservable()\n .pipe(switchMapTo(this.getConfig()))\n .subscribe((value) => {\n this.togglzSubject.next(value)\n })\n }\n\n return this.togglzSubject.asObservable()\n }\n\n getStateOf(togglzFeatureName: string): Observable {\n return this.getTogglz().pipe(\n map((data) => data.messages[togglzFeatureName] === 'true')\n )\n }\n\n getMessageOf(togglzFeatureName: string): Observable {\n return this.getTogglz().pipe(\n map((data) => data.messages[togglzFeatureName])\n )\n }\n\n getMaintenanceMessages(): Observable {\n return this.getMessageOf('MAINTENANCE_MESSAGE').pipe(\n map((value) => {\n const plainHtml = value\n const parser = new DOMParser()\n const htmlElement = parser.parseFromString(plainHtml, 'text/html')\n const closableElements = this.nodelistToArray(\n htmlElement.querySelectorAll('div.closable')\n )\n const nonClosableElements = this.nodelistToArray(\n htmlElement.querySelectorAll('div.regular')\n )\n return { plainHtml, closableElements, nonClosableElements }\n })\n )\n }\n\n nodelistToArray(nodes: NodeListOf): Element[] {\n const list = []\n nodes.forEach((element) => {\n list.push(element)\n })\n return list\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -26771,7 +26771,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Injectable } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { Observable } from 'rxjs'\nimport { TrustedIndividuals } from 'src/app/types/trusted-individuals.endpoint'\nimport { environment } from 'src/environments/environment'\nimport { map } from 'rxjs/operators'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TrustedIndividualsService {\n constructor(private _http: HttpClient) {}\n\n getTrustedIndividuals(): Observable {\n return this._http\n .get(\n `${environment.API_WEB}delegators/delegators-and-me.json`,\n {\n withCredentials: true,\n }\n )\n .pipe(\n map((response) => {\n if (response?.delegators?.length) {\n response.delegators.forEach((delegator) => {\n if (!delegator.giverName?.value) {\n delegator.giverName.value = $localize`:@@account.nameIsPri:Name is private`\n }\n })\n }\n return response\n })\n )\n }\n}\n", + "sourceCode": "import { Injectable } from '@angular/core'\nimport { HttpClient } from '@angular/common/http'\nimport { Observable } from 'rxjs'\nimport { TrustedIndividuals } from 'src/app/types/trusted-individuals.endpoint'\n\nimport { map } from 'rxjs/operators'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TrustedIndividualsService {\n constructor(private _http: HttpClient) {}\n\n getTrustedIndividuals(): Observable {\n return this._http\n .get(\n `${environment.API_WEB}delegators/delegators-and-me.json`,\n {\n withCredentials: true,\n }\n )\n .pipe(\n map((response) => {\n if (response?.delegators?.length) {\n response.delegators.forEach((delegator) => {\n if (!delegator.giverName?.value) {\n delegator.giverName.value = $localize`:@@account.nameIsPri:Name is private`\n }\n })\n }\n return response\n })\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -26850,7 +26850,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { Observable } from 'rxjs'\nimport { TrustedSummary } from 'src/app/types/trust-summary'\nimport { environment } from 'src/environments/environment'\nimport { catchError, retry } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TrustedSummaryService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n getSummary(orcid): Observable {\n let url = orcid + '/summary.json'\n return this._http\n .get(environment.BASE_URL + url, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { Observable } from 'rxjs'\nimport { TrustedSummary } from 'src/app/types/trust-summary'\n\nimport { catchError, retry } from 'rxjs/operators'\nimport { ERROR_REPORT } from 'src/app/errors'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TrustedSummaryService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n getSummary(orcid): Observable {\n let url = orcid + '/summary.json'\n return this._http\n .get(environment.BASE_URL + url, {\n headers: this.headers,\n })\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -27181,7 +27181,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { isEmpty } from 'lodash'\nimport { Observable } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { UserInfo } from 'src/app/types'\nimport { UserRecordOptions } from 'src/app/types/record.local'\nimport { environment } from 'src/environments/environment'\nimport { Router } from '@angular/router'\nimport { PlatformInfo, PlatformInfoService } from '../../cdk/platform-info'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class UserInfoService {\n platform: PlatformInfo\n\n constructor(\n private _http: HttpClient,\n private _router: Router,\n private _platform: PlatformInfoService\n ) {\n this._platform.get().subscribe((value) => (this.platform = value))\n }\n\n public getUserInfo(options?: UserRecordOptions): Observable {\n return this._http\n .get(\n environment.API_WEB +\n (options?.publicRecordId ? options.publicRecordId + '/' : '') +\n 'userInfo.json',\n {\n withCredentials: true,\n }\n )\n .pipe(\n map((value) => {\n value.USER_NOT_FOUND = isEmpty(value)\n value.RECORD_WITH_ISSUES = !!(\n value.IS_LOCKED === 'true' ||\n value.IS_DEACTIVATED === 'true' ||\n value.PRIMARY_RECORD\n )\n\n if (\n this.platform.queryParameters.hasOwnProperty('orcid') &&\n !this.platform.hasOauthParameters\n ) {\n this._router.navigate(['/my-orcid'], {\n queryParams: { orcid: value.EFFECTIVE_USER_ORCID },\n })\n }\n\n return value\n })\n )\n }\n}\n", + "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { isEmpty } from 'lodash'\nimport { Observable } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { UserInfo } from 'src/app/types'\nimport { UserRecordOptions } from 'src/app/types/record.local'\n\nimport { Router } from '@angular/router'\nimport { PlatformInfo, PlatformInfoService } from '../../cdk/platform-info'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class UserInfoService {\n platform: PlatformInfo\n\n constructor(\n private _http: HttpClient,\n private _router: Router,\n private _platform: PlatformInfoService\n ) {\n this._platform.get().subscribe((value) => (this.platform = value))\n }\n\n public getUserInfo(options?: UserRecordOptions): Observable {\n return this._http\n .get(\n environment.API_WEB +\n (options?.publicRecordId ? options.publicRecordId + '/' : '') +\n 'userInfo.json',\n {\n withCredentials: true,\n }\n )\n .pipe(\n map((value) => {\n value.USER_NOT_FOUND = isEmpty(value)\n value.RECORD_WITH_ISSUES = !!(\n value.IS_LOCKED === 'true' ||\n value.IS_DEACTIVATED === 'true' ||\n value.PRIMARY_RECORD\n )\n\n if (\n this.platform.queryParameters.hasOwnProperty('orcid') &&\n !this.platform.hasOauthParameters\n ) {\n this._router.navigate(['/my-orcid'], {\n queryParams: { orcid: value.EFFECTIVE_USER_ORCID },\n })\n }\n\n return value\n })\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -27894,7 +27894,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'\nimport { Inject, Injectable } from '@angular/core'\nimport {\n BehaviorSubject,\n combineLatest,\n merge,\n Observable,\n of,\n ReplaySubject,\n Subject,\n timer,\n} from 'rxjs'\nimport {\n catchError,\n delay,\n filter,\n first,\n last,\n map,\n retry,\n retryWhen,\n startWith,\n switchMap,\n take,\n takeUntil,\n tap,\n} from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport {\n NameForm,\n OauthParameters,\n RequestInfoForm,\n UserInfo,\n} from 'src/app/types'\nimport {\n UserSession,\n UserSessionUpdateParameters,\n} from 'src/app/types/session.local'\nimport { ThirdPartyAuthData } from 'src/app/types/sign-in-data.endpoint'\nimport { Delegator } from 'src/app/types/trusted-individuals.endpoint'\nimport { environment } from 'src/environments/environment'\n\nimport { UserStatus } from '../../types/userStatus.endpoint'\nimport { DiscoService } from '../disco/disco.service'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { OauthService } from '../oauth/oauth.service'\nimport { UserInfoService } from '../user-info/user-info.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class UserService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _platform: PlatformInfoService,\n private _oauth: OauthService,\n private _disco: DiscoService,\n private _userInfo: UserInfoService,\n @Inject(WINDOW) private window: Window\n ) {}\n $userStatusChecked = new ReplaySubject()\n private currentlyLoggedIn: boolean\n private loggingStateComesFromTheServer = false\n private $userSessionSubject = new ReplaySubject(1)\n sessionInitialized = false\n keepRefreshingUserSession = true\n private hiddenTab = false\n private START_IMMEDIATELY_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES = {\n start: 0,\n interval: 60 * 1000 * 25,\n }\n private START_IN_TWENTY_FIVE_MINUTES_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES = {\n start: 60 * 1000 * 25,\n interval: 60 * 1000 * 25,\n }\n private interval$: BehaviorSubject<{\n start: number\n interval: number\n }> = new BehaviorSubject<{ start: number; interval: number }>(\n this.START_IMMEDIATELY_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES\n )\n private reset$ = new Subject()\n\n _recheck = new Subject<{\n forceSessionUpdate: boolean\n postLoginUpdate: boolean\n }>()\n\n public getUserStatus(): Observable {\n return this._http\n .get(environment.API_WEB + 'userStatus.json', {\n withCredentials: true,\n })\n .pipe(map((response) => !!response.loggedIn))\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n private getNameForm(): Observable {\n return this._http.get(\n environment.API_WEB + 'account/nameForm.json',\n {\n withCredentials: true,\n }\n )\n }\n\n /**\n * At the start, every 60 seconds and when the method `refreshUserSession()` is called\n * the user login status will be check and if it has changed\n * the following actions will be taken\n * - update the backend OAuth session (if exists)\n * - retrieve user session updated data\n *\n * @returns a hot observable with the user session information\n */\n getUserSession(): Observable {\n // If an observable already exists, the same is shared between subscriptions\n // If not creates an observable\n if (this.sessionInitialized) {\n return this.$userSessionSubject\n } else {\n this.sessionInitialized = true\n // trigger every 60 seconds if tab active or every 5 minutes if tab hidden or\n // on _recheck subject event\n this.interval$.subscribe((timerVars) => {\n merge(\n timer(timerVars.start, timerVars.interval).pipe(\n takeUntil(this.reset$),\n map((timerUpdate) => {\n return { timerUpdate }\n })\n ),\n this._recheck\n )\n .pipe(\n // Check user status only when needed\n filter((value) => this.keepRefreshingUserSession),\n // Check for updates on userStatus.json\n switchMap((checkTrigger) => {\n this.$userStatusChecked.next(null)\n return this.getUserStatus().pipe(\n map((loggedIn) => {\n return { loggedIn, checkTrigger }\n })\n )\n }),\n // Filter followup calls if the user status has no change\n //\n // Also turns on the flag loggingStateComesFromTheServer\n // indicating that the current logging state is taken from the server,\n // and not the initial assumption. (more on this on the following pipe)\n filter((result: UserSessionUpdateParameters) => {\n this.loggingStateComesFromTheServer = true\n return this.userStatusHasChange(result)\n }),\n\n // When the user lands on the Orcid app:\n // Take a eager approach:\n // create a trigger that just assumes the user es logging.\n // So instead of waiting until `userStatus` responds, at the very beginning of the app initialization\n // calling userInfo.json, nameForm.json\n // (this avoid unnecessary extra waiting for logged in users)\n //\n // When the user change tabs:\n // Take a lazy approach:\n // and empty trigger will be created, to not call the any endpoint until the next `userStatus` call responds.\n\n startWith(\n !this.loggingStateComesFromTheServer\n ? { loggedIn: true, checkTrigger: { timerUpdate: -1 } }\n : {}\n ),\n // Ignore empty triggers.\n filter(\n (trigger: UserSessionUpdateParameters) =>\n trigger.checkTrigger !== undefined\n ),\n\n switchMap((updateParameters: UserSessionUpdateParameters) => {\n if (updateParameters) {\n return this.handleUserDataUpdate(updateParameters)\n }\n }),\n map((data) => this.computesUpdatedUserData(data)),\n // Debugger for the user session on development time\n tap((session) =>\n environment.debugger ? console.debug(session) : null\n ),\n tap((session) => {\n this.$userSessionSubject.next(session)\n })\n )\n .subscribe()\n })\n\n return this.$userSessionSubject.asObservable()\n }\n }\n\n private userStatusHasChange(updateParameters: UserSessionUpdateParameters) {\n if (\n !(updateParameters.loggedIn === this.currentlyLoggedIn) ||\n updateParameters.checkTrigger.forceSessionUpdate\n ) {\n return true\n } else {\n return false\n }\n }\n\n /**\n * computes loggedIn State, displayName, and orcidUrl based on the data coming from\n * userInfo and nameForm endpoints\n **/\n\n private computesUpdatedUserData(data: {\n userInfo: UserInfo\n nameForm: NameForm\n oauthSession: RequestInfoForm\n thirdPartyAuthData: ThirdPartyAuthData\n }): UserSession {\n {\n return {\n ...data,\n ...{\n loggedIn: !!data.userInfo || !!data.nameForm,\n displayName: this.getDisplayName(data.nameForm),\n orcidUrl: this.getOrcidUrl(data),\n effectiveOrcidUrl: this.getOrcidUrl(data, true),\n oauthSessionIsLoggedIn:\n !!data.oauthSession &&\n !!data.oauthSession.userOrcid &&\n !!data.oauthSession.userName,\n },\n }\n }\n }\n private getOrcidUrl(\n data: {\n userInfo: UserInfo\n nameForm: NameForm\n oauthSession: RequestInfoForm\n },\n effectiveId = false\n ): string {\n if (data && data.userInfo) {\n const orcidId = effectiveId\n ? data.userInfo.EFFECTIVE_USER_ORCID\n : data.userInfo.REAL_USER_ORCID\n if (orcidId) {\n return 'https:' + environment.BASE_URL + orcidId\n }\n }\n return undefined\n }\n\n /**\n * @param updateParameters login status and trigger information\n *\n * calls the appropriated endpoints depending on the logging state\n *\n * @returns an observable that with the last response of the calls,\n * this observable will wait for all the calls to respond before returning the first event\n */\n private handleUserDataUpdate(\n updateParameters?: UserSessionUpdateParameters\n ): Observable<{\n userInfo: UserInfo\n nameForm: NameForm\n oauthSession: RequestInfoForm\n thirdPartyAuthData: ThirdPartyAuthData\n }> {\n this.currentlyLoggedIn = updateParameters.loggedIn\n const $userInfo = this._userInfo.getUserInfo().pipe(this.handleErrors)\n const $nameForm = this.getNameForm().pipe(this.handleErrors)\n const $oauthSession = this.getOauthSession(updateParameters)\n const $thirdPartyAuthData = this.getThirdPartySignInData()\n\n return combineLatest([\n updateParameters.loggedIn ? $userInfo : of(undefined),\n updateParameters.loggedIn ? $nameForm : of(undefined),\n $oauthSession,\n !updateParameters.loggedIn ? $thirdPartyAuthData : of(undefined),\n ]).pipe(\n map(([userInfo, nameForm, oauthSession, thirdPartyAuthData]) => ({\n userInfo,\n nameForm,\n oauthSession,\n thirdPartyAuthData,\n }))\n )\n }\n /**\n * @param updateParameters login status and trigger information\n */\n private getOauthSession(\n updateParameters?: UserSessionUpdateParameters\n ): Observable {\n return this._platform.get().pipe(\n first(),\n switchMap((platform) => {\n // Declare the oauth session on the backend\n if (platform.hasOauthParameters) {\n let params = platform.queryParameters as OauthParameters\n // After a user login or register while being login remove the promp parameter\n // TODO @leomendoza123 how is this handle by signin logins?\n if (updateParameters.checkTrigger.postLoginUpdate) {\n params = { ...params, prompt: undefined }\n }\n return this._oauth.declareOauthSession(params, updateParameters).pipe(\n tap((session) => (this.keepRefreshingUserSession = !session.error)),\n tap(() =>\n environment.debugger\n ? console.debug('Oauth session declare')\n : null\n )\n )\n }\n return of(null)\n })\n )\n }\n\n private getThirdPartySignInData(): Observable {\n return this._platform.get().pipe(\n first(),\n switchMap((platform) => {\n if (platform.social) {\n return this._oauth.loadSocialSigninData().pipe(\n take(1),\n map((signinData) => {\n return {\n signinData,\n entityDisplayName: this.loadSocialSignInData(\n signinData.entityID\n ),\n }\n })\n )\n } else if (\n platform.institutional ||\n platform.currentRoute === 'register'\n ) {\n return this._oauth.loadShibbolethSignInData().pipe(\n take(1),\n switchMap((signinData) =>\n this._disco\n .getInstitutionNameBaseOnId(signinData.providerId)\n .pipe(\n map((entityDisplayName) => {\n return {\n entityDisplayName,\n signinData,\n }\n })\n )\n )\n )\n } else {\n return of(null)\n }\n })\n )\n }\n\n private loadSocialSignInData(entityDisplayName: string) {\n if (entityDisplayName === 'facebook' || entityDisplayName === 'google') {\n entityDisplayName =\n entityDisplayName.charAt(0).toUpperCase() + entityDisplayName.slice(1)\n }\n return entityDisplayName\n }\n\n /**\n * @param forceSessionUpdate=false set to true if the user session should be updated even when the user status does not change\n * @param postLoginUpdate=false set to true for the `prompt` parameter to be removed from the Oauth session\n */\n refreshUserSession(forceSessionUpdate = false, postLoginUpdate = false) {\n this._recheck.next({ forceSessionUpdate, postLoginUpdate })\n return this.getUserSession().pipe(\n // ignore the replay value, and return the latest value\n take(2),\n last()\n )\n }\n\n private getDisplayName(nameForm: NameForm): string {\n if (nameForm != null) {\n if (\n nameForm.creditName &&\n nameForm.creditName.value &&\n nameForm.creditName.value.length\n ) {\n return nameForm.creditName.value\n } else {\n return (\n ((nameForm.givenNames && nameForm.givenNames.value) || ' ') +\n ' ' +\n ((nameForm.familyName && nameForm.familyName.value) || ' ')\n )\n }\n } else {\n return undefined\n }\n }\n private handleErrors(gerUserInfo: Observable) {\n return (\n gerUserInfo\n .pipe(\n // If UserInfo.json or nameForm.json give an error it retries only if the user is currently logged in\n //\n // This is necessary because in some cases when the userStatus.json responded with { logging = true }\n // and the userInfo.json is called immediately after it responds with an error\n retryWhen((errors) => {\n return errors.pipe(delay(2000)).pipe(\n tap((x) => {\n if (\n !(\n this.currentlyLoggedIn &&\n this.loggingStateComesFromTheServer\n )\n ) {\n throw new Error('currentlyLoggedInWithErrors')\n }\n })\n )\n })\n )\n // This is necessary since the backend responds with a CORS error when a\n // user is not logged in and userInfo.json is called\n\n // TODO @angel we need to avoid sending HTTP errors back from the backend on this scenario\n // so we can better interpret real errors here\n .pipe(catchError((error) => of(null)))\n )\n }\n\n // TODO @angel review\n // since the switch account is returning a 302 witch triggers a redirect to `my-orcid`\n // and we also trigger a reload, to reload the oauth page\n // there might be some scenarios where these two different request might not work as expected.\n switchAccount(delegator: Delegator) {\n const params = new HttpParams().append(\n 'username',\n delegator.giverOrcid.path\n )\n return this._http\n .post(`${environment.API_WEB}switch-user`, '', {\n headers: this.headers,\n params: params,\n })\n .pipe(\n catchError((error) => {\n // TODO @angel @camelia review\n // The server response with a redirect to an http not secure page,\n // which equals a error status 0 to browsers\n if (error.status === 0) {\n this.refreshUserSession(true)\n return of(error)\n } else {\n return this._errorHandler.handleError(\n error,\n ERROR_REPORT.STANDARD_VERBOSE\n )\n }\n })\n )\n }\n\n setTimerAsHiddenState(hiddenTab: boolean) {\n // only reset the timer when the visibility is changed\n if (hiddenTab && !this.hiddenTab) {\n this.hiddenTab = hiddenTab\n this.reset$.next()\n this.interval$.next(\n this.START_IN_TWENTY_FIVE_MINUTES_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES\n )\n } else if (!hiddenTab && this.hiddenTab) {\n this.hiddenTab = hiddenTab\n this.reset$.next()\n this.interval$.next(\n this.START_IMMEDIATELY_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES\n )\n }\n }\n\n noRedirectLogout() {\n return this._http\n .get(`${environment.API_WEB}signout`, {\n headers: this.headers,\n observe: 'response',\n responseType: 'text',\n })\n .pipe(\n tap(\n () => {},\n () => {\n this.window.location.reload()\n }\n )\n )\n }\n}\n", + "sourceCode": "import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'\nimport { Inject, Injectable } from '@angular/core'\nimport {\n BehaviorSubject,\n combineLatest,\n merge,\n Observable,\n of,\n ReplaySubject,\n Subject,\n timer,\n} from 'rxjs'\nimport {\n catchError,\n delay,\n filter,\n first,\n last,\n map,\n retry,\n retryWhen,\n startWith,\n switchMap,\n take,\n takeUntil,\n tap,\n} from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport {\n NameForm,\n OauthParameters,\n RequestInfoForm,\n UserInfo,\n} from 'src/app/types'\nimport {\n UserSession,\n UserSessionUpdateParameters,\n} from 'src/app/types/session.local'\nimport { ThirdPartyAuthData } from 'src/app/types/sign-in-data.endpoint'\nimport { Delegator } from 'src/app/types/trusted-individuals.endpoint'\n\n\nimport { UserStatus } from '../../types/userStatus.endpoint'\nimport { DiscoService } from '../disco/disco.service'\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { OauthService } from '../oauth/oauth.service'\nimport { UserInfoService } from '../user-info/user-info.service'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class UserService {\n headers = new HttpHeaders({\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n })\n\n constructor(\n private _http: HttpClient,\n private _errorHandler: ErrorHandlerService,\n private _platform: PlatformInfoService,\n private _oauth: OauthService,\n private _disco: DiscoService,\n private _userInfo: UserInfoService,\n @Inject(WINDOW) private window: Window\n ) {}\n $userStatusChecked = new ReplaySubject()\n private currentlyLoggedIn: boolean\n private loggingStateComesFromTheServer = false\n private $userSessionSubject = new ReplaySubject(1)\n sessionInitialized = false\n keepRefreshingUserSession = true\n private hiddenTab = false\n private START_IMMEDIATELY_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES = {\n start: 0,\n interval: 60 * 1000 * 25,\n }\n private START_IN_TWENTY_FIVE_MINUTES_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES = {\n start: 60 * 1000 * 25,\n interval: 60 * 1000 * 25,\n }\n private interval$: BehaviorSubject<{\n start: number\n interval: number\n }> = new BehaviorSubject<{ start: number; interval: number }>(\n this.START_IMMEDIATELY_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES\n )\n private reset$ = new Subject()\n\n _recheck = new Subject<{\n forceSessionUpdate: boolean\n postLoginUpdate: boolean\n }>()\n\n public getUserStatus(): Observable {\n return this._http\n .get(environment.API_WEB + 'userStatus.json', {\n withCredentials: true,\n })\n .pipe(map((response) => !!response.loggedIn))\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.STANDARD_VERBOSE)\n )\n )\n }\n\n private getNameForm(): Observable {\n return this._http.get(\n environment.API_WEB + 'account/nameForm.json',\n {\n withCredentials: true,\n }\n )\n }\n\n /**\n * At the start, every 60 seconds and when the method `refreshUserSession()` is called\n * the user login status will be check and if it has changed\n * the following actions will be taken\n * - update the backend OAuth session (if exists)\n * - retrieve user session updated data\n *\n * @returns a hot observable with the user session information\n */\n getUserSession(): Observable {\n // If an observable already exists, the same is shared between subscriptions\n // If not creates an observable\n if (this.sessionInitialized) {\n return this.$userSessionSubject\n } else {\n this.sessionInitialized = true\n // trigger every 60 seconds if tab active or every 5 minutes if tab hidden or\n // on _recheck subject event\n this.interval$.subscribe((timerVars) => {\n merge(\n timer(timerVars.start, timerVars.interval).pipe(\n takeUntil(this.reset$),\n map((timerUpdate) => {\n return { timerUpdate }\n })\n ),\n this._recheck\n )\n .pipe(\n // Check user status only when needed\n filter((value) => this.keepRefreshingUserSession),\n // Check for updates on userStatus.json\n switchMap((checkTrigger) => {\n this.$userStatusChecked.next(null)\n return this.getUserStatus().pipe(\n map((loggedIn) => {\n return { loggedIn, checkTrigger }\n })\n )\n }),\n // Filter followup calls if the user status has no change\n //\n // Also turns on the flag loggingStateComesFromTheServer\n // indicating that the current logging state is taken from the server,\n // and not the initial assumption. (more on this on the following pipe)\n filter((result: UserSessionUpdateParameters) => {\n this.loggingStateComesFromTheServer = true\n return this.userStatusHasChange(result)\n }),\n\n // When the user lands on the Orcid app:\n // Take a eager approach:\n // create a trigger that just assumes the user es logging.\n // So instead of waiting until `userStatus` responds, at the very beginning of the app initialization\n // calling userInfo.json, nameForm.json\n // (this avoid unnecessary extra waiting for logged in users)\n //\n // When the user change tabs:\n // Take a lazy approach:\n // and empty trigger will be created, to not call the any endpoint until the next `userStatus` call responds.\n\n startWith(\n !this.loggingStateComesFromTheServer\n ? { loggedIn: true, checkTrigger: { timerUpdate: -1 } }\n : {}\n ),\n // Ignore empty triggers.\n filter(\n (trigger: UserSessionUpdateParameters) =>\n trigger.checkTrigger !== undefined\n ),\n\n switchMap((updateParameters: UserSessionUpdateParameters) => {\n if (updateParameters) {\n return this.handleUserDataUpdate(updateParameters)\n }\n }),\n map((data) => this.computesUpdatedUserData(data)),\n // Debugger for the user session on development time\n tap((session) =>\n environment.debugger ? console.debug(session) : null\n ),\n tap((session) => {\n this.$userSessionSubject.next(session)\n })\n )\n .subscribe()\n })\n\n return this.$userSessionSubject.asObservable()\n }\n }\n\n private userStatusHasChange(updateParameters: UserSessionUpdateParameters) {\n if (\n !(updateParameters.loggedIn === this.currentlyLoggedIn) ||\n updateParameters.checkTrigger.forceSessionUpdate\n ) {\n return true\n } else {\n return false\n }\n }\n\n /**\n * computes loggedIn State, displayName, and orcidUrl based on the data coming from\n * userInfo and nameForm endpoints\n **/\n\n private computesUpdatedUserData(data: {\n userInfo: UserInfo\n nameForm: NameForm\n oauthSession: RequestInfoForm\n thirdPartyAuthData: ThirdPartyAuthData\n }): UserSession {\n {\n return {\n ...data,\n ...{\n loggedIn: !!data.userInfo || !!data.nameForm,\n displayName: this.getDisplayName(data.nameForm),\n orcidUrl: this.getOrcidUrl(data),\n effectiveOrcidUrl: this.getOrcidUrl(data, true),\n oauthSessionIsLoggedIn:\n !!data.oauthSession &&\n !!data.oauthSession.userOrcid &&\n !!data.oauthSession.userName,\n },\n }\n }\n }\n private getOrcidUrl(\n data: {\n userInfo: UserInfo\n nameForm: NameForm\n oauthSession: RequestInfoForm\n },\n effectiveId = false\n ): string {\n if (data && data.userInfo) {\n const orcidId = effectiveId\n ? data.userInfo.EFFECTIVE_USER_ORCID\n : data.userInfo.REAL_USER_ORCID\n if (orcidId) {\n return 'https:' + environment.BASE_URL + orcidId\n }\n }\n return undefined\n }\n\n /**\n * @param updateParameters login status and trigger information\n *\n * calls the appropriated endpoints depending on the logging state\n *\n * @returns an observable that with the last response of the calls,\n * this observable will wait for all the calls to respond before returning the first event\n */\n private handleUserDataUpdate(\n updateParameters?: UserSessionUpdateParameters\n ): Observable<{\n userInfo: UserInfo\n nameForm: NameForm\n oauthSession: RequestInfoForm\n thirdPartyAuthData: ThirdPartyAuthData\n }> {\n this.currentlyLoggedIn = updateParameters.loggedIn\n const $userInfo = this._userInfo.getUserInfo().pipe(this.handleErrors)\n const $nameForm = this.getNameForm().pipe(this.handleErrors)\n const $oauthSession = this.getOauthSession(updateParameters)\n const $thirdPartyAuthData = this.getThirdPartySignInData()\n\n return combineLatest([\n updateParameters.loggedIn ? $userInfo : of(undefined),\n updateParameters.loggedIn ? $nameForm : of(undefined),\n $oauthSession,\n !updateParameters.loggedIn ? $thirdPartyAuthData : of(undefined),\n ]).pipe(\n map(([userInfo, nameForm, oauthSession, thirdPartyAuthData]) => ({\n userInfo,\n nameForm,\n oauthSession,\n thirdPartyAuthData,\n }))\n )\n }\n /**\n * @param updateParameters login status and trigger information\n */\n private getOauthSession(\n updateParameters?: UserSessionUpdateParameters\n ): Observable {\n return this._platform.get().pipe(\n first(),\n switchMap((platform) => {\n // Declare the oauth session on the backend\n if (platform.hasOauthParameters) {\n let params = platform.queryParameters as OauthParameters\n // After a user login or register while being login remove the promp parameter\n // TODO @leomendoza123 how is this handle by signin logins?\n if (updateParameters.checkTrigger.postLoginUpdate) {\n params = { ...params, prompt: undefined }\n }\n return this._oauth.declareOauthSession(params, updateParameters).pipe(\n tap((session) => (this.keepRefreshingUserSession = !session.error)),\n tap(() =>\n environment.debugger\n ? console.debug('Oauth session declare')\n : null\n )\n )\n }\n return of(null)\n })\n )\n }\n\n private getThirdPartySignInData(): Observable {\n return this._platform.get().pipe(\n first(),\n switchMap((platform) => {\n if (platform.social) {\n return this._oauth.loadSocialSigninData().pipe(\n take(1),\n map((signinData) => {\n return {\n signinData,\n entityDisplayName: this.loadSocialSignInData(\n signinData.entityID\n ),\n }\n })\n )\n } else if (\n platform.institutional ||\n platform.currentRoute === 'register'\n ) {\n return this._oauth.loadShibbolethSignInData().pipe(\n take(1),\n switchMap((signinData) =>\n this._disco\n .getInstitutionNameBaseOnId(signinData.providerId)\n .pipe(\n map((entityDisplayName) => {\n return {\n entityDisplayName,\n signinData,\n }\n })\n )\n )\n )\n } else {\n return of(null)\n }\n })\n )\n }\n\n private loadSocialSignInData(entityDisplayName: string) {\n if (entityDisplayName === 'facebook' || entityDisplayName === 'google') {\n entityDisplayName =\n entityDisplayName.charAt(0).toUpperCase() + entityDisplayName.slice(1)\n }\n return entityDisplayName\n }\n\n /**\n * @param forceSessionUpdate=false set to true if the user session should be updated even when the user status does not change\n * @param postLoginUpdate=false set to true for the `prompt` parameter to be removed from the Oauth session\n */\n refreshUserSession(forceSessionUpdate = false, postLoginUpdate = false) {\n this._recheck.next({ forceSessionUpdate, postLoginUpdate })\n return this.getUserSession().pipe(\n // ignore the replay value, and return the latest value\n take(2),\n last()\n )\n }\n\n private getDisplayName(nameForm: NameForm): string {\n if (nameForm != null) {\n if (\n nameForm.creditName &&\n nameForm.creditName.value &&\n nameForm.creditName.value.length\n ) {\n return nameForm.creditName.value\n } else {\n return (\n ((nameForm.givenNames && nameForm.givenNames.value) || ' ') +\n ' ' +\n ((nameForm.familyName && nameForm.familyName.value) || ' ')\n )\n }\n } else {\n return undefined\n }\n }\n private handleErrors(gerUserInfo: Observable) {\n return (\n gerUserInfo\n .pipe(\n // If UserInfo.json or nameForm.json give an error it retries only if the user is currently logged in\n //\n // This is necessary because in some cases when the userStatus.json responded with { logging = true }\n // and the userInfo.json is called immediately after it responds with an error\n retryWhen((errors) => {\n return errors.pipe(delay(2000)).pipe(\n tap((x) => {\n if (\n !(\n this.currentlyLoggedIn &&\n this.loggingStateComesFromTheServer\n )\n ) {\n throw new Error('currentlyLoggedInWithErrors')\n }\n })\n )\n })\n )\n // This is necessary since the backend responds with a CORS error when a\n // user is not logged in and userInfo.json is called\n\n // TODO @angel we need to avoid sending HTTP errors back from the backend on this scenario\n // so we can better interpret real errors here\n .pipe(catchError((error) => of(null)))\n )\n }\n\n // TODO @angel review\n // since the switch account is returning a 302 witch triggers a redirect to `my-orcid`\n // and we also trigger a reload, to reload the oauth page\n // there might be some scenarios where these two different request might not work as expected.\n switchAccount(delegator: Delegator) {\n const params = new HttpParams().append(\n 'username',\n delegator.giverOrcid.path\n )\n return this._http\n .post(`${environment.API_WEB}switch-user`, '', {\n headers: this.headers,\n params: params,\n })\n .pipe(\n catchError((error) => {\n // TODO @angel @camelia review\n // The server response with a redirect to an http not secure page,\n // which equals a error status 0 to browsers\n if (error.status === 0) {\n this.refreshUserSession(true)\n return of(error)\n } else {\n return this._errorHandler.handleError(\n error,\n ERROR_REPORT.STANDARD_VERBOSE\n )\n }\n })\n )\n }\n\n setTimerAsHiddenState(hiddenTab: boolean) {\n // only reset the timer when the visibility is changed\n if (hiddenTab && !this.hiddenTab) {\n this.hiddenTab = hiddenTab\n this.reset$.next()\n this.interval$.next(\n this.START_IN_TWENTY_FIVE_MINUTES_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES\n )\n } else if (!hiddenTab && this.hiddenTab) {\n this.hiddenTab = hiddenTab\n this.reset$.next()\n this.interval$.next(\n this.START_IMMEDIATELY_AND_CHECK_EVERY_TWENTY_FIVE_MINUTES\n )\n }\n }\n\n noRedirectLogout() {\n return this._http\n .get(`${environment.API_WEB}signout`, {\n headers: this.headers,\n observe: 'response',\n responseType: 'text',\n })\n .pipe(\n tap(\n () => {},\n () => {\n this.window.location.reload()\n }\n )\n )\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -29001,7 +29001,7 @@ "deprecationMessage": "", "description": "", "rawdescription": "\n", - "sourceCode": "import { Inject, Injectable, LOCALE_ID } from '@angular/core'\nimport {\n ActivatedRouteSnapshot,\n CanActivateChild,\n RouterStateSnapshot,\n} from '@angular/router'\nimport { CookieService } from 'ngx-cookie-service'\nimport { NEVER, Observable, of } from 'rxjs'\nimport { catchError, switchMap, tap } from 'rxjs/operators'\nimport { environment } from 'src/environments/environment'\n\nimport { WINDOW } from '../cdk/window'\nimport { UserService } from '../core'\nimport { ErrorHandlerService } from '../core/error-handler/error-handler.service'\nimport { LanguageService } from '../core/language/language.service'\nimport { LanguageContext } from '../types/language.locale'\n\nconst GUARD_COOKIE_CHECK = 'lang_refresh'\n@Injectable({\n providedIn: 'root',\n})\nexport class LanguageGuard implements CanActivateChild {\n constructor(\n @Inject(LOCALE_ID) public locale: string,\n private _user: UserService,\n @Inject(WINDOW) private window: Window,\n private _errorHandler: ErrorHandlerService,\n private _languageService: LanguageService,\n private _cookie: CookieService\n ) {}\n canActivateChild(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable {\n let langContext: LanguageContext\n // Wait the user session so the language cookie is declared from the backend\n return this._user.getUserSession().pipe(\n tap(() => {\n // get language context\n langContext = this.getLanguageContext(next.queryParams)\n\n if (environment.debugger) {\n console.debug('language context', langContext)\n }\n }),\n /// HANDLE LANGUAGE CHANGE BY QUERY PARAMETERS, like `https://orcid.org/signin?lang=pt`\n switchMap(() => {\n if (this.currentAppLanguageMatchTheParamLanguage(langContext)) {\n this._cookie.delete(GUARD_COOKIE_CHECK)\n return of(true)\n } else {\n // the browser needs to be reloaded to set the right cookie.\n return this._languageService.changeLanguage(langContext.param).pipe(\n switchMap(() =>\n // Redirect the user to the destiny LOCAL (without using the router)\n of((this.window.location.href = state?.url || '/')).pipe(\n switchMap(() => NEVER)\n )\n )\n )\n }\n }),\n /// HANDLE LANGUAGE COOKIE UPDATES, like when a user login into a `spanish` user from a `english` signin page.\n switchMap(() => {\n if (this.currentAppLanguageMatchCookieLanguage(langContext)) {\n this._cookie.delete(GUARD_COOKIE_CHECK)\n return of(true)\n } else {\n if (this._cookie.get(GUARD_COOKIE_CHECK) !== langContext.cookie) {\n // the browser needs to be reloaded to set the right cookie.\n this._cookie.set(GUARD_COOKIE_CHECK, langContext.cookie)\n // Redirect the user to the destiny LOCAL (without using the router)\n return of((this.window.location.href = state?.url || '/')).pipe(\n switchMap(() => NEVER)\n )\n } else {\n // Weird event where `GUARD_COOKIE_CHECK` was already set, the app was already reloaded\n // But the current app language do not match the cookie language\n return this._errorHandler.handleError(\n new Error('cacheIssueDetected/')\n )\n }\n }\n }),\n catchError(() => of(true)) // Allow to continue if the language change fails\n )\n }\n\n getLanguageContext(queryParams): LanguageContext {\n return {\n param: this.normalizeLanguageCode(\n queryParams['lang'] || queryParams['LANG']\n ),\n app: this.normalizeLanguageCode(this.locale),\n cookie: this.normalizeLanguageCode(this._cookie.get('locale_v3')),\n }\n }\n\n /**\n *\n * @param languageCode Any Language code set by the Orcid Source backend\n *\n * Transform backend codes to ISO 639-1 Code to be compatible with Angular codes\n */\n normalizeLanguageCode(languageCode: string): string {\n if (languageCode) {\n return languageCode.toLocaleLowerCase().replace('_', '-')\n }\n return languageCode\n }\n\n currentAppLanguageMatchTheParamLanguage(\n langContext: LanguageContext\n ): boolean {\n if (\n langContext.param &&\n langContext.app &&\n langContext.app.indexOf(langContext.param) === -1\n ) {\n return false\n }\n return true\n }\n\n currentAppLanguageMatchCookieLanguage(langContext: LanguageContext): boolean {\n if (\n langContext.app &&\n langContext.app.indexOf(langContext.cookie || 'en') === -1\n ) {\n return false\n }\n return true\n }\n}\n", + "sourceCode": "import { Inject, Injectable, LOCALE_ID } from '@angular/core'\nimport {\n ActivatedRouteSnapshot,\n CanActivateChild,\n RouterStateSnapshot,\n} from '@angular/router'\nimport { CookieService } from 'ngx-cookie-service'\nimport { NEVER, Observable, of } from 'rxjs'\nimport { catchError, switchMap, tap } from 'rxjs/operators'\n\n\nimport { WINDOW } from '../cdk/window'\nimport { UserService } from '../core'\nimport { ErrorHandlerService } from '../core/error-handler/error-handler.service'\nimport { LanguageService } from '../core/language/language.service'\nimport { LanguageContext } from '../types/language.locale'\n\nconst GUARD_COOKIE_CHECK = 'lang_refresh'\n@Injectable({\n providedIn: 'root',\n})\nexport class LanguageGuard implements CanActivateChild {\n constructor(\n @Inject(LOCALE_ID) public locale: string,\n private _user: UserService,\n @Inject(WINDOW) private window: Window,\n private _errorHandler: ErrorHandlerService,\n private _languageService: LanguageService,\n private _cookie: CookieService\n ) {}\n canActivateChild(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable {\n let langContext: LanguageContext\n // Wait the user session so the language cookie is declared from the backend\n return this._user.getUserSession().pipe(\n tap(() => {\n // get language context\n langContext = this.getLanguageContext(next.queryParams)\n\n if (environment.debugger) {\n console.debug('language context', langContext)\n }\n }),\n /// HANDLE LANGUAGE CHANGE BY QUERY PARAMETERS, like `https://orcid.org/signin?lang=pt`\n switchMap(() => {\n if (this.currentAppLanguageMatchTheParamLanguage(langContext)) {\n this._cookie.delete(GUARD_COOKIE_CHECK)\n return of(true)\n } else {\n // the browser needs to be reloaded to set the right cookie.\n return this._languageService.changeLanguage(langContext.param).pipe(\n switchMap(() =>\n // Redirect the user to the destiny LOCAL (without using the router)\n of((this.window.location.href = state?.url || '/')).pipe(\n switchMap(() => NEVER)\n )\n )\n )\n }\n }),\n /// HANDLE LANGUAGE COOKIE UPDATES, like when a user login into a `spanish` user from a `english` signin page.\n switchMap(() => {\n if (this.currentAppLanguageMatchCookieLanguage(langContext)) {\n this._cookie.delete(GUARD_COOKIE_CHECK)\n return of(true)\n } else {\n if (this._cookie.get(GUARD_COOKIE_CHECK) !== langContext.cookie) {\n // the browser needs to be reloaded to set the right cookie.\n this._cookie.set(GUARD_COOKIE_CHECK, langContext.cookie)\n // Redirect the user to the destiny LOCAL (without using the router)\n return of((this.window.location.href = state?.url || '/')).pipe(\n switchMap(() => NEVER)\n )\n } else {\n // Weird event where `GUARD_COOKIE_CHECK` was already set, the app was already reloaded\n // But the current app language do not match the cookie language\n return this._errorHandler.handleError(\n new Error('cacheIssueDetected/')\n )\n }\n }\n }),\n catchError(() => of(true)) // Allow to continue if the language change fails\n )\n }\n\n getLanguageContext(queryParams): LanguageContext {\n return {\n param: this.normalizeLanguageCode(\n queryParams['lang'] || queryParams['LANG']\n ),\n app: this.normalizeLanguageCode(this.locale),\n cookie: this.normalizeLanguageCode(this._cookie.get('locale_v3')),\n }\n }\n\n /**\n *\n * @param languageCode Any Language code set by the Orcid Source backend\n *\n * Transform backend codes to ISO 639-1 Code to be compatible with Angular codes\n */\n normalizeLanguageCode(languageCode: string): string {\n if (languageCode) {\n return languageCode.toLocaleLowerCase().replace('_', '-')\n }\n return languageCode\n }\n\n currentAppLanguageMatchTheParamLanguage(\n langContext: LanguageContext\n ): boolean {\n if (\n langContext.param &&\n langContext.app &&\n langContext.app.indexOf(langContext.param) === -1\n ) {\n return false\n }\n return true\n }\n\n currentAppLanguageMatchCookieLanguage(langContext: LanguageContext): boolean {\n if (\n langContext.app &&\n langContext.app.indexOf(langContext.cookie || 'en') === -1\n ) {\n return false\n }\n return true\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -30564,7 +30564,7 @@ "deprecated": false, "deprecationMessage": "", "type": "class", - "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { UntypedFormGroup } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { catchError, first, map, retry, switchMap } from 'rxjs/operators'\nimport { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { RequestInfoForm } from 'src/app/types'\nimport {\n DuplicatedName,\n RegisterConfirmResponse,\n RegisterForm,\n} from 'src/app/types/register.endpoint'\nimport { environment } from 'src/environments/environment'\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { UserService } from '../user/user.service'\nimport { RegisterBackendValidatorMixin } from './register.backend-validators'\nimport { RegisterFormAdapterMixin } from './register.form-adapter'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { objectToUrlParameters } from '../../constants'\nimport { ReactivationLocal } from '../../types/reactivation.local'\n\n// Mixing boiler plate\n\nclass RegisterServiceBase {\n constructor(\n public _http: HttpClient,\n public _errorHandler: ErrorHandlerService\n ) {}\n}\nconst _RegisterServiceMixingBase = RegisterBackendValidatorMixin(\n RegisterFormAdapterMixin(RegisterServiceBase)\n)\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RegisterService extends _RegisterServiceMixingBase {\n backendRegistrationForm: RegisterForm\n\n constructor(\n _http: HttpClient,\n _errorHandler: ErrorHandlerService,\n private _userService: UserService,\n private _platform: PlatformInfoService\n ) {\n super(_http, _errorHandler)\n }\n\n public checkDuplicatedResearcher(names: {\n familyNames: string\n givenNames: string\n }) {\n return this._http\n .get(environment.API_WEB + `dupicateResearcher.json`, {\n params: names,\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getRegisterForm(): Observable {\n return this._http\n .get(`${environment.API_WEB}register.json`, {\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n .pipe(map((form) => (this.backendRegistrationForm = form)))\n }\n\n register(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup,\n reactivation: ReactivationLocal,\n requestInfoForm?: RequestInfoForm,\n updateUserService = true\n ): Observable {\n this.backendRegistrationForm.valNumClient =\n this.backendRegistrationForm.valNumServer / 2\n const registerForm = this.formGroupToFullRegistrationForm(\n StepA,\n StepB,\n StepC\n )\n this.addOauthContext(registerForm, requestInfoForm)\n return this._platform.get().pipe(\n first(),\n switchMap((platform) => {\n let url = `${environment.API_WEB}`\n if (\n platform.institutional ||\n platform.queryParameters.linkType === 'shibboleth'\n ) {\n url += `shibboleth/`\n }\n if (reactivation.isReactivation) {\n url += `reactivationConfirm.json?${objectToUrlParameters(\n platform.queryParameters\n )}`\n registerForm.resetParams = reactivation.reactivationCode\n } else {\n url += `registerConfirm.json?${objectToUrlParameters(\n platform.queryParameters\n )}`\n }\n\n const registerFormWithTypeContext = this.addCreationTypeContext(\n platform,\n registerForm\n )\n\n return this._http\n .post(\n url,\n Object.assign(\n this.backendRegistrationForm,\n registerFormWithTypeContext\n )\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.REGISTER)\n ),\n switchMap((value) => {\n return this._userService.refreshUserSession(true, true).pipe(\n first(),\n map((userStatus) => {\n if (!userStatus.loggedIn && !value.errors) {\n // sanity check the user should be logged\n // sanity check the user should be logged\n this._errorHandler.handleError(\n new Error('registerSanityIssue'),\n ERROR_REPORT.REGISTER\n )\n }\n return value\n })\n )\n })\n )\n })\n )\n }\n\n addOauthContext(\n registerForm: RegisterForm,\n requestInfoForm?: RequestInfoForm\n ): void {\n if (requestInfoForm) {\n registerForm.referredBy = { value: requestInfoForm.clientId }\n }\n }\n addCreationTypeContext(\n platform: PlatformInfo,\n registerForm: RegisterForm\n ): RegisterForm {\n /// TODO @leomendoza123 depend only on the user session thirty party login data\n /// avoid taking data from the the parameters.\n if (\n platform.social ||\n platform.queryParameters.providerId === 'facebook' ||\n platform.queryParameters.providerId === 'google'\n ) {\n registerForm.linkType = 'social'\n return registerForm\n } else if (platform.institutional || platform.queryParameters.providerId) {\n registerForm.linkType = 'shibboleth'\n return registerForm\n } else {\n return registerForm\n }\n }\n}\n", + "sourceCode": "import { HttpClient } from '@angular/common/http'\nimport { Injectable } from '@angular/core'\nimport { UntypedFormGroup } from '@angular/forms'\nimport { Observable } from 'rxjs'\nimport { catchError, first, map, retry, switchMap } from 'rxjs/operators'\nimport { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { RequestInfoForm } from 'src/app/types'\nimport {\n DuplicatedName,\n RegisterConfirmResponse,\n RegisterForm,\n} from 'src/app/types/register.endpoint'\n\n\nimport { ErrorHandlerService } from '../error-handler/error-handler.service'\nimport { UserService } from '../user/user.service'\nimport { RegisterBackendValidatorMixin } from './register.backend-validators'\nimport { RegisterFormAdapterMixin } from './register.form-adapter'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { objectToUrlParameters } from '../../constants'\nimport { ReactivationLocal } from '../../types/reactivation.local'\n\n// Mixing boiler plate\n\nclass RegisterServiceBase {\n constructor(\n public _http: HttpClient,\n public _errorHandler: ErrorHandlerService\n ) {}\n}\nconst _RegisterServiceMixingBase = RegisterBackendValidatorMixin(\n RegisterFormAdapterMixin(RegisterServiceBase)\n)\n\n@Injectable({\n providedIn: 'root',\n})\nexport class RegisterService extends _RegisterServiceMixingBase {\n backendRegistrationForm: RegisterForm\n\n constructor(\n _http: HttpClient,\n _errorHandler: ErrorHandlerService,\n private _userService: UserService,\n private _platform: PlatformInfoService\n ) {\n super(_http, _errorHandler)\n }\n\n public checkDuplicatedResearcher(names: {\n familyNames: string\n givenNames: string\n }) {\n return this._http\n .get(environment.API_WEB + `dupicateResearcher.json`, {\n params: names,\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n }\n\n getRegisterForm(): Observable {\n return this._http\n .get(`${environment.API_WEB}register.json`, {\n withCredentials: true,\n })\n .pipe(\n retry(3),\n catchError((error) => this._errorHandler.handleError(error))\n )\n .pipe(map((form) => (this.backendRegistrationForm = form)))\n }\n\n register(\n StepA: UntypedFormGroup,\n StepB: UntypedFormGroup,\n StepC: UntypedFormGroup,\n reactivation: ReactivationLocal,\n requestInfoForm?: RequestInfoForm,\n updateUserService = true\n ): Observable {\n this.backendRegistrationForm.valNumClient =\n this.backendRegistrationForm.valNumServer / 2\n const registerForm = this.formGroupToFullRegistrationForm(\n StepA,\n StepB,\n StepC\n )\n this.addOauthContext(registerForm, requestInfoForm)\n return this._platform.get().pipe(\n first(),\n switchMap((platform) => {\n let url = `${environment.API_WEB}`\n if (\n platform.institutional ||\n platform.queryParameters.linkType === 'shibboleth'\n ) {\n url += `shibboleth/`\n }\n if (reactivation.isReactivation) {\n url += `reactivationConfirm.json?${objectToUrlParameters(\n platform.queryParameters\n )}`\n registerForm.resetParams = reactivation.reactivationCode\n } else {\n url += `registerConfirm.json?${objectToUrlParameters(\n platform.queryParameters\n )}`\n }\n\n const registerFormWithTypeContext = this.addCreationTypeContext(\n platform,\n registerForm\n )\n\n return this._http\n .post(\n url,\n Object.assign(\n this.backendRegistrationForm,\n registerFormWithTypeContext\n )\n )\n .pipe(\n retry(3),\n catchError((error) =>\n this._errorHandler.handleError(error, ERROR_REPORT.REGISTER)\n ),\n switchMap((value) => {\n return this._userService.refreshUserSession(true, true).pipe(\n first(),\n map((userStatus) => {\n if (!userStatus.loggedIn && !value.errors) {\n // sanity check the user should be logged\n // sanity check the user should be logged\n this._errorHandler.handleError(\n new Error('registerSanityIssue'),\n ERROR_REPORT.REGISTER\n )\n }\n return value\n })\n )\n })\n )\n })\n )\n }\n\n addOauthContext(\n registerForm: RegisterForm,\n requestInfoForm?: RequestInfoForm\n ): void {\n if (requestInfoForm) {\n registerForm.referredBy = { value: requestInfoForm.clientId }\n }\n }\n addCreationTypeContext(\n platform: PlatformInfo,\n registerForm: RegisterForm\n ): RegisterForm {\n /// TODO @leomendoza123 depend only on the user session thirty party login data\n /// avoid taking data from the the parameters.\n if (\n platform.social ||\n platform.queryParameters.providerId === 'facebook' ||\n platform.queryParameters.providerId === 'google'\n ) {\n registerForm.linkType = 'social'\n return registerForm\n } else if (platform.institutional || platform.queryParameters.providerId) {\n registerForm.linkType = 'shibboleth'\n return registerForm\n } else {\n return registerForm\n }\n }\n}\n", "constructorObj": { "name": "constructor", "description": "", @@ -32213,7 +32213,7 @@ "type": "directive", "description": "", "rawdescription": "\n", - "sourceCode": "import {\n Directive,\n Inject,\n OnInit,\n NgZone,\n ElementRef,\n LOCALE_ID,\n Output,\n EventEmitter,\n} from '@angular/core'\nimport { WINDOW } from '../window'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { environment } from 'src/environments/environment'\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\n\nexport interface ReCaptchaConfig {\n theme?: 'dark' | 'light'\n type?: 'audio' | 'image'\n size?: 'compact' | 'normal'\n tabindex?: number\n}\n\ninterface WindowWithCaptcha extends Window {\n grecaptcha: {\n render: (ElementRef, ReCaptchaConfig) => number\n }\n orcidReCaptchaOnLoad: () => void\n}\n\n@Directive({\n selector: '[appRecaptcha]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: RecaptchaDirective,\n multi: true,\n },\n ],\n})\nexport class RecaptchaDirective implements OnInit, ControlValueAccessor {\n @Output() captchaFail = new EventEmitter()\n @Output() captchaLoaded = new EventEmitter()\n private onChange: (value: string) => void\n private onTouched: (value: string) => void\n\n constructor(\n @Inject(WINDOW) private window: WindowWithCaptcha,\n @Inject(LOCALE_ID) public locale: string,\n private ngZone: NgZone,\n private element: ElementRef,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n ngOnInit() {\n this.registerReCaptchaCallback()\n this.addScript()\n }\n\n registerReCaptchaCallback() {\n this.window.orcidReCaptchaOnLoad = () => {\n const config = {\n sitekey: environment.GOOGLE_RECAPTCHA,\n callback: (response: string) => {\n this.ngZone.run(() => this.onSuccess(response))\n },\n\n 'expired-callback': (response: string) => {\n this.ngZone.run(() => this.onExpired())\n },\n 'error-callback': () => {\n this.ngZone.run(() => this.onCaptchaFail())\n },\n }\n const id = this.render(this.element.nativeElement, config)\n this.captchaLoaded.emit(id)\n }\n }\n\n onExpired() {\n this.ngZone.run(() => {\n this.onChange(null)\n this.onTouched(null)\n })\n }\n\n onSuccess(token: string) {\n this.onChange(token)\n this.onTouched(token)\n }\n\n onCaptchaFail() {\n this.captchaFail.emit(true)\n this._errorHandler.handleError(new Error('captchaFail')).subscribe()\n }\n\n private render(element: HTMLElement, config): number {\n return this.window.grecaptcha.render(element, config)\n }\n\n addScript() {\n const script = this.window.document.createElement('script')\n const lang = this.locale ? '&hl=' + this.locale : ''\n script.src = `https://www.google.com/recaptcha/api.js?onload=orcidReCaptchaOnLoad&render=explicit${lang}`\n script.async = true\n script.defer = true\n this.window.document.body.appendChild(script)\n }\n\n writeValue(obj: any): void {}\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n setDisabledState?(isDisabled: boolean): void {}\n}\n", + "sourceCode": "import {\n Directive,\n Inject,\n OnInit,\n NgZone,\n ElementRef,\n LOCALE_ID,\n Output,\n EventEmitter,\n} from '@angular/core'\nimport { WINDOW } from '../window'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\n\nexport interface ReCaptchaConfig {\n theme?: 'dark' | 'light'\n type?: 'audio' | 'image'\n size?: 'compact' | 'normal'\n tabindex?: number\n}\n\ninterface WindowWithCaptcha extends Window {\n grecaptcha: {\n render: (ElementRef, ReCaptchaConfig) => number\n }\n orcidReCaptchaOnLoad: () => void\n}\n\n@Directive({\n selector: '[appRecaptcha]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: RecaptchaDirective,\n multi: true,\n },\n ],\n})\nexport class RecaptchaDirective implements OnInit, ControlValueAccessor {\n @Output() captchaFail = new EventEmitter()\n @Output() captchaLoaded = new EventEmitter()\n private onChange: (value: string) => void\n private onTouched: (value: string) => void\n\n constructor(\n @Inject(WINDOW) private window: WindowWithCaptcha,\n @Inject(LOCALE_ID) public locale: string,\n private ngZone: NgZone,\n private element: ElementRef,\n private _errorHandler: ErrorHandlerService\n ) {}\n\n ngOnInit() {\n this.registerReCaptchaCallback()\n this.addScript()\n }\n\n registerReCaptchaCallback() {\n this.window.orcidReCaptchaOnLoad = () => {\n const config = {\n sitekey: environment.GOOGLE_RECAPTCHA,\n callback: (response: string) => {\n this.ngZone.run(() => this.onSuccess(response))\n },\n\n 'expired-callback': (response: string) => {\n this.ngZone.run(() => this.onExpired())\n },\n 'error-callback': () => {\n this.ngZone.run(() => this.onCaptchaFail())\n },\n }\n const id = this.render(this.element.nativeElement, config)\n this.captchaLoaded.emit(id)\n }\n }\n\n onExpired() {\n this.ngZone.run(() => {\n this.onChange(null)\n this.onTouched(null)\n })\n }\n\n onSuccess(token: string) {\n this.onChange(token)\n this.onTouched(token)\n }\n\n onCaptchaFail() {\n this.captchaFail.emit(true)\n this._errorHandler.handleError(new Error('captchaFail')).subscribe()\n }\n\n private render(element: HTMLElement, config): number {\n return this.window.grecaptcha.render(element, config)\n }\n\n addScript() {\n const script = this.window.document.createElement('script')\n const lang = this.locale ? '&hl=' + this.locale : ''\n script.src = `https://www.google.com/recaptcha/api.js?onload=orcidReCaptchaOnLoad&render=explicit${lang}`\n script.async = true\n script.defer = true\n this.window.document.body.appendChild(script)\n }\n\n writeValue(obj: any): void {}\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n setDisabledState?(isDisabled: boolean): void {}\n}\n", "selector": "[appRecaptcha]", "providers": [ { @@ -35369,7 +35369,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, HostBinding, HostListener, Inject } from '@angular/core'\nimport { NavigationEnd, NavigationStart, Router } from '@angular/router'\nimport { catchError, tap } from 'rxjs/operators'\n\nimport { PlatformInfo } from './cdk/platform-info'\nimport { PlatformInfoService } from './cdk/platform-info/platform-info.service'\nimport { WINDOW } from './cdk/window'\nimport { HeadlessOnOauthRoutes } from './constants'\nimport { UserService } from './core'\nimport { ZendeskService } from './core/zendesk/zendesk.service'\nimport { GoogleTagManagerService } from './core/google-tag-manager/google-tag-manager.service'\nimport {\n finishPerformanceMeasurement,\n reportNavigationStart,\n} from './analytics-utils'\nimport { ERROR_REPORT } from './errors'\nimport { ErrorHandlerService } from './core/error-handler/error-handler.service'\nimport { environment } from 'src/environments/environment'\nimport { TitleService } from './core/title-service/title.service'\n\n@Component({\n selector: 'app-root',\n templateUrl: './app.component.html',\n styleUrls: ['./app.component.scss'],\n})\nexport class AppComponent {\n currentlyDisplayingZendesk = true\n headlessMode = false\n currentRouteIsHeadlessOnOauthPage = true\n screenDirection\n currentRoute\n @HostBinding('class.edge') edge\n @HostBinding('class.ie') ie\n @HostBinding('class.tabletOrHandset') tabletOrHandset\n @HostBinding('class.handset') handset\n @HostBinding('class.tablet') tablet\n @HostBinding('class.desktop') desktop\n @HostBinding('class.columns-8') columns8\n @HostBinding('class.columns-12') columns12\n @HostBinding('class.columns-4') columns4\n platformInfo\n\n constructor(\n _platformInfo: PlatformInfoService,\n _router: Router,\n _googleTagManagerService: GoogleTagManagerService,\n _zendesk: ZendeskService,\n private _userService: UserService,\n private _errorHandler: ErrorHandlerService,\n @Inject(WINDOW) private _window: Window,\n _titleService: TitleService\n ) {\n _titleService.init()\n _platformInfo\n .get()\n .pipe(\n tap((platformInfo) => {\n this.platformInfo = platformInfo\n this.currentRouteIsHeadlessOnOauthPage = this.showHeadlessOnOauthPage(\n platformInfo.currentRoute\n )\n this.setPlatformClasses(platformInfo)\n this.screenDirection = platformInfo.screenDirection\n if (\n !platformInfo.hasOauthParameters &&\n !this.currentlyDisplayingZendesk\n ) {\n _zendesk.show()\n _zendesk.adaptPluginToPlatform(platformInfo)\n this.currentlyDisplayingZendesk = true\n } else if (\n platformInfo.hasOauthParameters &&\n this.currentlyDisplayingZendesk\n ) {\n _zendesk.hide()\n\n this.currentlyDisplayingZendesk = false\n }\n })\n )\n .subscribe()\n\n _router.events.subscribe((event) => {\n if (event instanceof NavigationStart) {\n reportNavigationStart(event.url)\n this.currentRoute = event.url\n }\n if (event instanceof NavigationEnd) {\n const duration = finishPerformanceMeasurement(event.url)\n _googleTagManagerService\n .addGtmToDom()\n .pipe(\n catchError((err) =>\n this._errorHandler.handleError(\n err,\n ERROR_REPORT.STANDARD_NO_VERBOSE_NO_GA\n )\n )\n )\n .subscribe((response) => {\n if (response) {\n _googleTagManagerService\n .reportNavigationEnd(event.url, duration)\n .subscribe(() => {\n _googleTagManagerService.reportPageView(\n event.urlAfterRedirects\n )\n })\n }\n })\n }\n })\n }\n showHeadlessOnOauthPage(currentRoute: string): boolean {\n if (currentRoute) {\n const value = HeadlessOnOauthRoutes.filter(\n (url) => currentRoute.indexOf('/' + url) === 0\n )\n return !!value.length\n } else {\n return true\n }\n }\n\n setPlatformClasses(platformInfo: PlatformInfo, oauthSessionFound?: boolean) {\n const isOauth =\n (platformInfo.hasOauthParameters || oauthSessionFound) &&\n this.currentRouteIsHeadlessOnOauthPage\n this.headlessMode = isOauth || platformInfo.summaryScreen\n this.ie = platformInfo.ie\n this.edge = platformInfo.edge\n this.tabletOrHandset = platformInfo.tabletOrHandset\n this.handset = platformInfo.handset\n this.tablet = platformInfo.tablet\n this.desktop = platformInfo.desktop\n this.columns8 = platformInfo.columns8\n this.columns12 = platformInfo.columns12\n this.columns4 = platformInfo.columns4\n }\n\n @HostListener('window:visibilitychange')\n onVisibilityChange(value) {\n this._userService.setTimerAsHiddenState(this._window.document.hidden)\n }\n}\n", + "sourceCode": "import { Component, HostBinding, HostListener, Inject } from '@angular/core'\nimport { NavigationEnd, NavigationStart, Router } from '@angular/router'\nimport { catchError, tap } from 'rxjs/operators'\n\nimport { PlatformInfo } from './cdk/platform-info'\nimport { PlatformInfoService } from './cdk/platform-info/platform-info.service'\nimport { WINDOW } from './cdk/window'\nimport { HeadlessOnOauthRoutes } from './constants'\nimport { UserService } from './core'\nimport { ZendeskService } from './core/zendesk/zendesk.service'\nimport { GoogleTagManagerService } from './core/google-tag-manager/google-tag-manager.service'\nimport {\n finishPerformanceMeasurement,\n reportNavigationStart,\n} from './analytics-utils'\nimport { ERROR_REPORT } from './errors'\nimport { ErrorHandlerService } from './core/error-handler/error-handler.service'\n\nimport { TitleService } from './core/title-service/title.service'\n\n@Component({\n selector: 'app-root',\n templateUrl: './app.component.html',\n styleUrls: ['./app.component.scss'],\n})\nexport class AppComponent {\n currentlyDisplayingZendesk = true\n headlessMode = false\n currentRouteIsHeadlessOnOauthPage = true\n screenDirection\n currentRoute\n @HostBinding('class.edge') edge\n @HostBinding('class.ie') ie\n @HostBinding('class.tabletOrHandset') tabletOrHandset\n @HostBinding('class.handset') handset\n @HostBinding('class.tablet') tablet\n @HostBinding('class.desktop') desktop\n @HostBinding('class.columns-8') columns8\n @HostBinding('class.columns-12') columns12\n @HostBinding('class.columns-4') columns4\n platformInfo\n\n constructor(\n _platformInfo: PlatformInfoService,\n _router: Router,\n _googleTagManagerService: GoogleTagManagerService,\n _zendesk: ZendeskService,\n private _userService: UserService,\n private _errorHandler: ErrorHandlerService,\n @Inject(WINDOW) private _window: Window,\n _titleService: TitleService\n ) {\n _titleService.init()\n _platformInfo\n .get()\n .pipe(\n tap((platformInfo) => {\n this.platformInfo = platformInfo\n this.currentRouteIsHeadlessOnOauthPage = this.showHeadlessOnOauthPage(\n platformInfo.currentRoute\n )\n this.setPlatformClasses(platformInfo)\n this.screenDirection = platformInfo.screenDirection\n if (\n !platformInfo.hasOauthParameters &&\n !this.currentlyDisplayingZendesk\n ) {\n _zendesk.show()\n _zendesk.adaptPluginToPlatform(platformInfo)\n this.currentlyDisplayingZendesk = true\n } else if (\n platformInfo.hasOauthParameters &&\n this.currentlyDisplayingZendesk\n ) {\n _zendesk.hide()\n\n this.currentlyDisplayingZendesk = false\n }\n })\n )\n .subscribe()\n\n _router.events.subscribe((event) => {\n if (event instanceof NavigationStart) {\n reportNavigationStart(event.url)\n this.currentRoute = event.url\n }\n if (event instanceof NavigationEnd) {\n const duration = finishPerformanceMeasurement(event.url)\n _googleTagManagerService\n .addGtmToDom()\n .pipe(\n catchError((err) =>\n this._errorHandler.handleError(\n err,\n ERROR_REPORT.STANDARD_NO_VERBOSE_NO_GA\n )\n )\n )\n .subscribe((response) => {\n if (response) {\n _googleTagManagerService\n .reportNavigationEnd(event.url, duration)\n .subscribe(() => {\n _googleTagManagerService.reportPageView(\n event.urlAfterRedirects\n )\n })\n }\n })\n }\n })\n }\n showHeadlessOnOauthPage(currentRoute: string): boolean {\n if (currentRoute) {\n const value = HeadlessOnOauthRoutes.filter(\n (url) => currentRoute.indexOf('/' + url) === 0\n )\n return !!value.length\n } else {\n return true\n }\n }\n\n setPlatformClasses(platformInfo: PlatformInfo, oauthSessionFound?: boolean) {\n const isOauth =\n (platformInfo.hasOauthParameters || oauthSessionFound) &&\n this.currentRouteIsHeadlessOnOauthPage\n this.headlessMode = isOauth || platformInfo.summaryScreen\n this.ie = platformInfo.ie\n this.edge = platformInfo.edge\n this.tabletOrHandset = platformInfo.tabletOrHandset\n this.handset = platformInfo.handset\n this.tablet = platformInfo.tablet\n this.desktop = platformInfo.desktop\n this.columns8 = platformInfo.columns8\n this.columns12 = platformInfo.columns12\n this.columns4 = platformInfo.columns4\n }\n\n @HostListener('window:visibilitychange')\n onVisibilityChange(value) {\n this._userService.setTimerAsHiddenState(this._window.document.hidden)\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -36177,7 +36177,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, OnInit } from '@angular/core'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { take, filter } from 'rxjs/operators'\nimport { TogglzService } from 'src/app/core/togglz/togglz.service'\nimport { MaintenanceMessage } from 'src/app/types/togglz.local'\nimport { environment } from 'src/environments/environment'\nimport { CookieService } from 'ngx-cookie-service'\n\n@Component({\n selector: 'app-banners',\n templateUrl: './banners.component.html',\n styleUrls: ['./banners.component.scss'],\n preserveWhitespaces: true,\n})\nexport class BannersComponent implements OnInit {\n environment = environment\n maintenanceMessages: MaintenanceMessage\n showUnsupportedBrowserBanner\n closableElementAtDisplay\n ariaLabelCookiesPolicy = $localize`:@@layout.ariaLabelCookies:Cookies Policy`\n\n constructor(\n _platformInfo: PlatformInfoService,\n togglz: TogglzService,\n private _cookie: CookieService\n ) {\n // All closable maintenance messages are displayed as banners\n togglz.getMaintenanceMessages().subscribe((value) => {\n this.maintenanceMessages = value\n this.updateClosableMessage()\n })\n\n // Show unsupported browser banner\n _platformInfo\n .get()\n .pipe(\n filter((platform) => platform.unsupportedBrowser),\n take(1)\n )\n .subscribe(\n (platform) =>\n (this.showUnsupportedBrowserBanner = platform.unsupportedBrowser)\n )\n }\n\n updateClosableMessage() {\n if (this.maintenanceMessages && this.maintenanceMessages.closableElements) {\n this.maintenanceMessages.closableElements.forEach((node) => {\n if (\n node &&\n node.id &&\n !this._cookie.check(node.id) &&\n !this.closableElementAtDisplay\n ) {\n this.closableElementAtDisplay = node\n }\n })\n }\n }\n\n understoodClosableMessage(element: Element) {\n this.closableElementAtDisplay = null\n this._cookie.set(element.id, 'understood', 365)\n this.updateClosableMessage()\n }\n\n ngOnInit() {}\n}\n", + "sourceCode": "import { Component, OnInit } from '@angular/core'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { take, filter } from 'rxjs/operators'\nimport { TogglzService } from 'src/app/core/togglz/togglz.service'\nimport { MaintenanceMessage } from 'src/app/types/togglz.local'\n\nimport { CookieService } from 'ngx-cookie-service'\n\n@Component({\n selector: 'app-banners',\n templateUrl: './banners.component.html',\n styleUrls: ['./banners.component.scss'],\n preserveWhitespaces: true,\n})\nexport class BannersComponent implements OnInit {\n environment = environment\n maintenanceMessages: MaintenanceMessage\n showUnsupportedBrowserBanner\n closableElementAtDisplay\n ariaLabelCookiesPolicy = $localize`:@@layout.ariaLabelCookies:Cookies Policy`\n\n constructor(\n _platformInfo: PlatformInfoService,\n togglz: TogglzService,\n private _cookie: CookieService\n ) {\n // All closable maintenance messages are displayed as banners\n togglz.getMaintenanceMessages().subscribe((value) => {\n this.maintenanceMessages = value\n this.updateClosableMessage()\n })\n\n // Show unsupported browser banner\n _platformInfo\n .get()\n .pipe(\n filter((platform) => platform.unsupportedBrowser),\n take(1)\n )\n .subscribe(\n (platform) =>\n (this.showUnsupportedBrowserBanner = platform.unsupportedBrowser)\n )\n }\n\n updateClosableMessage() {\n if (this.maintenanceMessages && this.maintenanceMessages.closableElements) {\n this.maintenanceMessages.closableElements.forEach((node) => {\n if (\n node &&\n node.id &&\n !this._cookie.check(node.id) &&\n !this.closableElementAtDisplay\n ) {\n this.closableElementAtDisplay = node\n }\n })\n }\n }\n\n understoodClosableMessage(element: Element) {\n this.closableElementAtDisplay = null\n this._cookie.set(element.id, 'understood', 365)\n this.updateClosableMessage()\n }\n\n ngOnInit() {}\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -37215,7 +37215,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import {\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n OnDestroy,\n OnInit,\n QueryList,\n ViewChild,\n ViewChildren,\n} from '@angular/core'\nimport { FormControl } from '@angular/forms'\nimport {\n FormArray,\n FormBuilder,\n FormGroup,\n ValidatorFn,\n Validators,\n} from '@angular/forms'\nimport { MatDialog } from '@angular/material/dialog'\nimport {\n MAX_LENGTH_LESS_THAN_ONE_THOUSAND,\n MAX_LENGTH_LESS_THAN_TWO_HUNDRED_FIFTY_FIVE,\n URL_REGEXP,\n} from 'src/app/constants'\nimport { URL_REGEXP_BACKEND } from 'src/app/constants'\nimport { DeveloperToolsService } from 'src/app/core/developer-tools/developer-tools.service'\nimport { UserInfoService } from 'src/app/core/user-info/user-info.service'\nimport { Client } from 'src/app/types/developer-tools'\nimport { ClientSecretModalComponent } from '../../components/client-secret-modal/client-secret-modal.component'\nimport { filter, map, switchMap, takeUntil, tap } from 'rxjs/operators'\nimport { Observable, Subject, of } from 'rxjs'\nimport { RecordService } from 'src/app/core/record/record.service'\nimport { MatInput } from '@angular/material/input'\nimport { environment } from 'src/environments/environment'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\n\n@Component({\n selector: 'app-developer-tools',\n templateUrl: './developer-tools.component.html',\n styleUrls: [\n './developer-tools.component.scss',\n './developer-tools.component.scss-theme.scss',\n ],\n preserveWhitespaces: true,\n})\nexport class DeveloperToolsComponent implements OnInit, OnDestroy {\n @ViewChildren('websiteInput') inputs: QueryList\n\n destroy$ = new Subject()\n formWasSummited = false\n ariaLabelDelete = $localize`:@@developerTools.ariaLabelWebsiteDelete:Delete redirect URI`\n labelAuthorizeRequest = $localize`:@@developerTools.labelAuthorizeRequest:Authorize request`\n labelTokenRequest = $localize`:@@developerTools.labelTokenRequest:Token request`\n labelOpenIdImplicitRequest = $localize`:@@developerTools.labelOpenIdImplicitRequest:OpenID/Implicit request`\n authRequest = true\n checked\n form: FormGroup\n developerToolsEnable: any\n triedToSaveWithoutUrls: boolean\n loading: boolean\n existingClient: Client\n sucessSave: boolean\n loadingUserDevTolsState: boolean\n baseURL: string\n isMobile: boolean\n\n @ViewChild('firstInput', { static: false }) firstInput: ElementRef\n\n constructor(\n private fb: FormBuilder,\n private userInfo: UserInfoService,\n private developerToolsService: DeveloperToolsService,\n private matDialog: MatDialog,\n private recordService: RecordService,\n private _changeDetectorRef: ChangeDetectorRef,\n @Inject(WINDOW) private window: Window,\n private _platform: PlatformInfoService\n ) {}\n ngOnDestroy(): void {\n this.destroy$.next(true)\n this.destroy$.complete()\n }\n\n ngOnInit(): void {\n this.setFocusToTheMainDiv()\n\n this._platform\n .get()\n .pipe(takeUntil(this.destroy$))\n .subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n\n if (this.window?.location) {\n this.baseURL = this.window.location.origin\n }\n this.getDeveloperToolsEnableState()\n .pipe(\n switchMap((developerToolsEnableState) => {\n if (developerToolsEnableState) {\n return this.developerToolsService.getDeveloperToolsClient()\n } else {\n return of(undefined)\n }\n })\n )\n .subscribe((currentClient) => {\n this.loading = false\n this.existingClient = currentClient\n this.form = this.fb.group({\n displayName: [\n currentClient?.displayName?.value,\n [\n Validators.required,\n Validators.maxLength(MAX_LENGTH_LESS_THAN_TWO_HUNDRED_FIFTY_FIVE),\n ],\n ],\n website: [\n currentClient?.website?.value,\n [Validators.required, Validators.pattern(URL_REGEXP_BACKEND)],\n ],\n shortDescription: [\n currentClient?.shortDescription?.value,\n [\n Validators.maxLength(MAX_LENGTH_LESS_THAN_ONE_THOUSAND),\n Validators.required,\n ],\n ],\n redirectUris: this.fb.array(\n [],\n [this.validatorAtLeastOne(), this.validatorNotDuplicate()]\n ),\n })\n\n currentClient?.redirectUris?.forEach((uri) => {\n this.redirectUris.push(\n this.fb.control(uri.value.value, [\n Validators.required,\n Validators.pattern(URL_REGEXP_BACKEND),\n ])\n )\n })\n })\n }\n\n private setFocusToTheMainDiv() {\n if (this.window?.location) {\n this.window.location.href = '/developer-tools' + '#main'\n setTimeout(() => {\n this.window.window.scrollTo(0, 0)\n this.window.history.replaceState(\n {},\n this.window.document.title,\n '/developer-tools'\n )\n })\n }\n }\n\n save() {\n this.formWasSummited = true\n\n this.triedToSaveWithoutUrls = (\n this.form.get('redirectUris').value as string[]\n ).some((uri) => !uri)\n this.form.markAllAsTouched()\n if (this.form.invalid) {\n return\n }\n const devToolsClient: Client = {\n allowAutoDeprecate: null,\n authenticationProviderId: null,\n memberId: null,\n memberName: null,\n oboEnabled: null,\n persistentTokenEnabled: null,\n scopes: null,\n type: null,\n userOBOEnabled: null,\n clientId: this.existingClient?.clientId,\n\n displayName: { value: this.form.get('displayName').value },\n redirectUris: this.form.get('redirectUris').value.map((uri) => {\n return {\n actType: null,\n errors: [],\n geoArea: null,\n scopes: [],\n status: 'OK',\n type: {\n errors: [],\n getRequiredMessage: null,\n required: true,\n value: 'sso-authentication',\n },\n value: { value: uri },\n }\n }),\n shortDescription: { value: this.form.get('shortDescription').value },\n website: { value: this.form.get('website').value },\n errors: [],\n }\n\n if (this.existingClient?.clientId?.value) {\n this.developerToolsService\n .updateDeveloperToolsClient(devToolsClient)\n .subscribe((res) => {\n this.form.markAsPristine()\n this.sucessSave = true\n })\n } else {\n this.developerToolsService\n .postDeveloperToolsClient(devToolsClient)\n .subscribe((res) => {\n this.ngOnInit()\n })\n }\n }\n validatorAtLeastOne(): ValidatorFn {\n return (control: FormArray) => {\n const forbidden = control.length === 0\n return forbidden ? { forbiddenLength: { value: control.value } } : null\n }\n }\n\n validatorNotDuplicate(): ValidatorFn {\n return (control: FormArray) => {\n if (control.length > 1) {\n // Checks if there is a duplicate in the array\n const duplicate = control.value.some((uri, index) => {\n return uri && control.value.indexOf(uri) !== index\n })\n return duplicate ? { duplicate: { value: control.value } } : null\n }\n }\n }\n\n getDeveloperToolsEnableState(): Observable {\n this.loading = true\n this.loadingUserDevTolsState = true\n return this.recordService.getRecord({ forceReload: true }).pipe(\n takeUntil(this.destroy$),\n filter((user) => !!user.userInfo),\n map((user) => {\n if (user?.userInfo) {\n this.loadingUserDevTolsState = false\n }\n this.developerToolsEnable =\n user?.userInfo?.['DEVELOPER_TOOLS_ENABLED'] === 'true'\n\n return this.developerToolsEnable\n })\n )\n }\n\n get redirectUris() {\n return this.form.get('redirectUris') as FormArray\n }\n\n addRedirectUri() {\n const fc = new FormControl('', [\n Validators.required,\n Validators.pattern(URL_REGEXP),\n ])\n this.redirectUris.push(fc)\n this._changeDetectorRef.detectChanges()\n\n const input = (this.inputs.last as any).nativeElement\n input.focus()\n }\n\n removeRedirectUri(index: number) {\n this.redirectUris.removeAt(index)\n this.redirectUris.markAsDirty()\n }\n\n onClientSecretUpdated() {\n this.matDialog\n .open(ClientSecretModalComponent, {\n maxWidth: '630px',\n data: { secretId: this.existingClient?.clientSecret?.value },\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n return this.developerToolsService\n .resetClientSecret(this.existingClient)\n .pipe(\n tap(() => {\n this.ngOnInit()\n })\n )\n } else {\n return of()\n }\n })\n )\n .subscribe()\n }\n}\n", + "sourceCode": "import {\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n OnDestroy,\n OnInit,\n QueryList,\n ViewChild,\n ViewChildren,\n} from '@angular/core'\nimport { FormControl } from '@angular/forms'\nimport {\n FormArray,\n FormBuilder,\n FormGroup,\n ValidatorFn,\n Validators,\n} from '@angular/forms'\nimport { MatDialog } from '@angular/material/dialog'\nimport {\n MAX_LENGTH_LESS_THAN_ONE_THOUSAND,\n MAX_LENGTH_LESS_THAN_TWO_HUNDRED_FIFTY_FIVE,\n URL_REGEXP,\n} from 'src/app/constants'\nimport { URL_REGEXP_BACKEND } from 'src/app/constants'\nimport { DeveloperToolsService } from 'src/app/core/developer-tools/developer-tools.service'\nimport { UserInfoService } from 'src/app/core/user-info/user-info.service'\nimport { Client } from 'src/app/types/developer-tools'\nimport { ClientSecretModalComponent } from '../../components/client-secret-modal/client-secret-modal.component'\nimport { filter, map, switchMap, takeUntil, tap } from 'rxjs/operators'\nimport { Observable, Subject, of } from 'rxjs'\nimport { RecordService } from 'src/app/core/record/record.service'\nimport { MatInput } from '@angular/material/input'\n\nimport { WINDOW } from 'src/app/cdk/window'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\n\n@Component({\n selector: 'app-developer-tools',\n templateUrl: './developer-tools.component.html',\n styleUrls: [\n './developer-tools.component.scss',\n './developer-tools.component.scss-theme.scss',\n ],\n preserveWhitespaces: true,\n})\nexport class DeveloperToolsComponent implements OnInit, OnDestroy {\n @ViewChildren('websiteInput') inputs: QueryList\n\n destroy$ = new Subject()\n formWasSummited = false\n ariaLabelDelete = $localize`:@@developerTools.ariaLabelWebsiteDelete:Delete redirect URI`\n labelAuthorizeRequest = $localize`:@@developerTools.labelAuthorizeRequest:Authorize request`\n labelTokenRequest = $localize`:@@developerTools.labelTokenRequest:Token request`\n labelOpenIdImplicitRequest = $localize`:@@developerTools.labelOpenIdImplicitRequest:OpenID/Implicit request`\n authRequest = true\n checked\n form: FormGroup\n developerToolsEnable: any\n triedToSaveWithoutUrls: boolean\n loading: boolean\n existingClient: Client\n sucessSave: boolean\n loadingUserDevTolsState: boolean\n baseURL: string\n isMobile: boolean\n\n @ViewChild('firstInput', { static: false }) firstInput: ElementRef\n\n constructor(\n private fb: FormBuilder,\n private userInfo: UserInfoService,\n private developerToolsService: DeveloperToolsService,\n private matDialog: MatDialog,\n private recordService: RecordService,\n private _changeDetectorRef: ChangeDetectorRef,\n @Inject(WINDOW) private window: Window,\n private _platform: PlatformInfoService\n ) {}\n ngOnDestroy(): void {\n this.destroy$.next(true)\n this.destroy$.complete()\n }\n\n ngOnInit(): void {\n this.setFocusToTheMainDiv()\n\n this._platform\n .get()\n .pipe(takeUntil(this.destroy$))\n .subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n\n if (this.window?.location) {\n this.baseURL = this.window.location.origin\n }\n this.getDeveloperToolsEnableState()\n .pipe(\n switchMap((developerToolsEnableState) => {\n if (developerToolsEnableState) {\n return this.developerToolsService.getDeveloperToolsClient()\n } else {\n return of(undefined)\n }\n })\n )\n .subscribe((currentClient) => {\n this.loading = false\n this.existingClient = currentClient\n this.form = this.fb.group({\n displayName: [\n currentClient?.displayName?.value,\n [\n Validators.required,\n Validators.maxLength(MAX_LENGTH_LESS_THAN_TWO_HUNDRED_FIFTY_FIVE),\n ],\n ],\n website: [\n currentClient?.website?.value,\n [Validators.required, Validators.pattern(URL_REGEXP_BACKEND)],\n ],\n shortDescription: [\n currentClient?.shortDescription?.value,\n [\n Validators.maxLength(MAX_LENGTH_LESS_THAN_ONE_THOUSAND),\n Validators.required,\n ],\n ],\n redirectUris: this.fb.array(\n [],\n [this.validatorAtLeastOne(), this.validatorNotDuplicate()]\n ),\n })\n\n currentClient?.redirectUris?.forEach((uri) => {\n this.redirectUris.push(\n this.fb.control(uri.value.value, [\n Validators.required,\n Validators.pattern(URL_REGEXP_BACKEND),\n ])\n )\n })\n })\n }\n\n private setFocusToTheMainDiv() {\n if (this.window?.location) {\n this.window.location.href = '/developer-tools' + '#main'\n setTimeout(() => {\n this.window.window.scrollTo(0, 0)\n this.window.history.replaceState(\n {},\n this.window.document.title,\n '/developer-tools'\n )\n })\n }\n }\n\n save() {\n this.formWasSummited = true\n\n this.triedToSaveWithoutUrls = (\n this.form.get('redirectUris').value as string[]\n ).some((uri) => !uri)\n this.form.markAllAsTouched()\n if (this.form.invalid) {\n return\n }\n const devToolsClient: Client = {\n allowAutoDeprecate: null,\n authenticationProviderId: null,\n memberId: null,\n memberName: null,\n oboEnabled: null,\n persistentTokenEnabled: null,\n scopes: null,\n type: null,\n userOBOEnabled: null,\n clientId: this.existingClient?.clientId,\n\n displayName: { value: this.form.get('displayName').value },\n redirectUris: this.form.get('redirectUris').value.map((uri) => {\n return {\n actType: null,\n errors: [],\n geoArea: null,\n scopes: [],\n status: 'OK',\n type: {\n errors: [],\n getRequiredMessage: null,\n required: true,\n value: 'sso-authentication',\n },\n value: { value: uri },\n }\n }),\n shortDescription: { value: this.form.get('shortDescription').value },\n website: { value: this.form.get('website').value },\n errors: [],\n }\n\n if (this.existingClient?.clientId?.value) {\n this.developerToolsService\n .updateDeveloperToolsClient(devToolsClient)\n .subscribe((res) => {\n this.form.markAsPristine()\n this.sucessSave = true\n })\n } else {\n this.developerToolsService\n .postDeveloperToolsClient(devToolsClient)\n .subscribe((res) => {\n this.ngOnInit()\n })\n }\n }\n validatorAtLeastOne(): ValidatorFn {\n return (control: FormArray) => {\n const forbidden = control.length === 0\n return forbidden ? { forbiddenLength: { value: control.value } } : null\n }\n }\n\n validatorNotDuplicate(): ValidatorFn {\n return (control: FormArray) => {\n if (control.length > 1) {\n // Checks if there is a duplicate in the array\n const duplicate = control.value.some((uri, index) => {\n return uri && control.value.indexOf(uri) !== index\n })\n return duplicate ? { duplicate: { value: control.value } } : null\n }\n }\n }\n\n getDeveloperToolsEnableState(): Observable {\n this.loading = true\n this.loadingUserDevTolsState = true\n return this.recordService.getRecord({ forceReload: true }).pipe(\n takeUntil(this.destroy$),\n filter((user) => !!user.userInfo),\n map((user) => {\n if (user?.userInfo) {\n this.loadingUserDevTolsState = false\n }\n this.developerToolsEnable =\n user?.userInfo?.['DEVELOPER_TOOLS_ENABLED'] === 'true'\n\n return this.developerToolsEnable\n })\n )\n }\n\n get redirectUris() {\n return this.form.get('redirectUris') as FormArray\n }\n\n addRedirectUri() {\n const fc = new FormControl('', [\n Validators.required,\n Validators.pattern(URL_REGEXP),\n ])\n this.redirectUris.push(fc)\n this._changeDetectorRef.detectChanges()\n\n const input = (this.inputs.last as any).nativeElement\n input.focus()\n }\n\n removeRedirectUri(index: number) {\n this.redirectUris.removeAt(index)\n this.redirectUris.markAsDirty()\n }\n\n onClientSecretUpdated() {\n this.matDialog\n .open(ClientSecretModalComponent, {\n maxWidth: '630px',\n data: { secretId: this.existingClient?.clientSecret?.value },\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n return this.developerToolsService\n .resetClientSecret(this.existingClient)\n .pipe(\n tap(() => {\n this.ngOnInit()\n })\n )\n } else {\n return of()\n }\n })\n )\n .subscribe()\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -37472,7 +37472,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-dialog-actions-duplicated',\n templateUrl: './dialog-actions-duplicated.component.html',\n styleUrls: [\n './dialog-actions-duplicated.component.scss',\n './dialog-actions-duplicated.component.scss-theme.scss',\n ],\n})\nexport class DialogActionsDuplicatedComponent implements OnInit {\n isMobile: boolean\n baseUrl = environment.BASE_URL\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: DuplicateRemoveEndpoint,\n private _platform: PlatformInfoService\n ) {}\n\n ngOnInit(): void {\n this._platform.get().subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n }\n\n ok() {\n this.matRef.close(this.data)\n }\n cancel() {\n this.matRef.close(null)\n }\n}\n", + "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated'\n\n\n@Component({\n selector: 'app-dialog-actions-duplicated',\n templateUrl: './dialog-actions-duplicated.component.html',\n styleUrls: [\n './dialog-actions-duplicated.component.scss',\n './dialog-actions-duplicated.component.scss-theme.scss',\n ],\n})\nexport class DialogActionsDuplicatedComponent implements OnInit {\n isMobile: boolean\n baseUrl = environment.BASE_URL\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: DuplicateRemoveEndpoint,\n private _platform: PlatformInfoService\n ) {}\n\n ngOnInit(): void {\n this._platform.get().subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n }\n\n ok() {\n this.matRef.close(this.data)\n }\n cancel() {\n this.matRef.close(null)\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -37624,7 +37624,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'\nimport { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-dialog-actions-duplicated-merged-confirmed',\n templateUrl: './dialog-actions-duplicated-merged-confirmed.component.html',\n styleUrls: ['./dialog-actions-duplicated-merged-confirmed.component.scss'],\n preserveWhitespaces: true,\n})\nexport class DialogActionsDuplicatedMergedConfirmedComponent implements OnInit {\n baseUrl = environment.BASE_URL\n\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: DuplicateRemoveEndpoint\n ) {}\n\n ngOnInit(): void {}\n\n ok() {\n this.matRef.close(this.data)\n }\n}\n", + "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'\nimport { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated'\n\n\n@Component({\n selector: 'app-dialog-actions-duplicated-merged-confirmed',\n templateUrl: './dialog-actions-duplicated-merged-confirmed.component.html',\n styleUrls: ['./dialog-actions-duplicated-merged-confirmed.component.scss'],\n preserveWhitespaces: true,\n})\nexport class DialogActionsDuplicatedMergedConfirmedComponent implements OnInit {\n baseUrl = environment.BASE_URL\n\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: DuplicateRemoveEndpoint\n ) {}\n\n ngOnInit(): void {}\n\n ok() {\n this.matRef.close(this.data)\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -37965,7 +37965,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { ExpandedSearchResultsContent } from 'src/app/types'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-dialog-add-trusted-individuals',\n templateUrl: './dialog-add-trusted-individuals.component.html',\n styleUrls: ['./dialog-add-trusted-individuals.component.scss'],\n})\nexport class DialogAddTrustedIndividualsComponent implements OnInit {\n isMobile: boolean\n baseUrl = environment.BASE_URL\n addByEmailOrOrcid: string\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: ExpandedSearchResultsContent | string,\n private _platform: PlatformInfoService\n ) {}\n\n ngOnInit(): void {\n this._platform.get().subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n if (typeof this.data === 'string') {\n this.addByEmailOrOrcid = this.data\n }\n }\n cancel() {\n this.matRef.close()\n }\n ok() {\n this.matRef.close(this.data)\n }\n}\n", + "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { ExpandedSearchResultsContent } from 'src/app/types'\n\n\n@Component({\n selector: 'app-dialog-add-trusted-individuals',\n templateUrl: './dialog-add-trusted-individuals.component.html',\n styleUrls: ['./dialog-add-trusted-individuals.component.scss'],\n})\nexport class DialogAddTrustedIndividualsComponent implements OnInit {\n isMobile: boolean\n baseUrl = environment.BASE_URL\n addByEmailOrOrcid: string\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: ExpandedSearchResultsContent | string,\n private _platform: PlatformInfoService\n ) {}\n\n ngOnInit(): void {\n this._platform.get().subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n if (typeof this.data === 'string') {\n this.addByEmailOrOrcid = this.data\n }\n }\n cancel() {\n this.matRef.close()\n }\n ok() {\n this.matRef.close(this.data)\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -38103,7 +38103,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { ExpandedSearchResultsContent } from 'src/app/types'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-dialog-add-trusted-individuals-your-own-email',\n templateUrl: './dialog-add-trusted-individuals-your-own-email.component.html',\n styleUrls: ['./dialog-add-trusted-individuals-your-own-email.component.scss'],\n})\nexport class DialogAddTrustedIndividualsYourOwnEmailComponent\n implements OnInit\n{\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: ExpandedSearchResultsContent | string\n ) {}\n\n ngOnInit(): void {}\n cancel() {\n this.matRef.close()\n }\n}\n", + "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { ExpandedSearchResultsContent } from 'src/app/types'\n\n\n@Component({\n selector: 'app-dialog-add-trusted-individuals-your-own-email',\n templateUrl: './dialog-add-trusted-individuals-your-own-email.component.html',\n styleUrls: ['./dialog-add-trusted-individuals-your-own-email.component.scss'],\n})\nexport class DialogAddTrustedIndividualsYourOwnEmailComponent\n implements OnInit\n{\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: ExpandedSearchResultsContent | string\n ) {}\n\n ngOnInit(): void {}\n cancel() {\n this.matRef.close()\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -38251,7 +38251,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { AccountTrustedIndividualsService } from 'src/app/core/account-trusted-individuals/account-trusted-individuals.service'\nimport { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals'\nimport { AccountTrustedOrganization } from 'src/app/types/account-trusted-organizations'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-dialog-revoke-trusted-individuals',\n templateUrl: './dialog-revoke-trusted-individuals.component.html',\n styleUrls: ['./dialog-revoke-trusted-individuals.component.scss'],\n})\nexport class DialogRevokeTrustedIndividualsComponent implements OnInit {\n isMobile: boolean\n baseUrl = environment.BASE_URL\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: AccountTrustedIndividual,\n private _platform: PlatformInfoService\n ) {}\n\n ngOnInit(): void {\n this._platform.get().subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n }\n cancel() {\n this.matRef.close()\n }\n ok() {\n this.matRef.close(this.data)\n }\n}\n", + "sourceCode": "import { Component, Inject, OnInit } from '@angular/core'\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { AccountTrustedIndividualsService } from 'src/app/core/account-trusted-individuals/account-trusted-individuals.service'\nimport { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals'\nimport { AccountTrustedOrganization } from 'src/app/types/account-trusted-organizations'\n\n\n@Component({\n selector: 'app-dialog-revoke-trusted-individuals',\n templateUrl: './dialog-revoke-trusted-individuals.component.html',\n styleUrls: ['./dialog-revoke-trusted-individuals.component.scss'],\n})\nexport class DialogRevokeTrustedIndividualsComponent implements OnInit {\n isMobile: boolean\n baseUrl = environment.BASE_URL\n constructor(\n private matRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: AccountTrustedIndividual,\n private _platform: PlatformInfoService\n ) {}\n\n ngOnInit(): void {\n this._platform.get().subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n }\n cancel() {\n this.matRef.close()\n }\n ok() {\n this.matRef.close(this.data)\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -39850,7 +39850,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Inject, OnDestroy, OnInit } from '@angular/core'\nimport { Router } from '@angular/router'\nimport { forkJoin, Observable, Subject } from 'rxjs'\nimport { catchError, map, take, takeUntil } from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { ApplicationRoutes } from 'src/app/constants'\nimport { UserService } from 'src/app/core'\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\nimport { OauthService } from 'src/app/core/oauth/oauth.service'\nimport { SignInService } from 'src/app/core/sign-in/sign-in.service'\nimport { TrustedIndividualsService } from 'src/app/core/trusted-individuals/trusted-individuals.service'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { RequestInfoForm, Scope } from 'src/app/types'\nimport { UserSession } from 'src/app/types/session.local'\nimport {\n Delegator,\n TrustedIndividuals,\n} from 'src/app/types/trusted-individuals.endpoint'\nimport { environment } from 'src/environments/environment'\nimport { GoogleTagManagerService } from '../../../core/google-tag-manager/google-tag-manager.service'\n\n@Component({\n selector: 'app-form-authorize',\n templateUrl: './form-authorize.component.html',\n styleUrls: ['./form-authorize.component.scss'],\n preserveWhitespaces: true,\n})\nexport class FormAuthorizeComponent implements OnInit, OnDestroy {\n environment = environment\n $destroy: Subject = new Subject()\n orcidUrl: string\n userName: string\n loadingUserInfo = true\n loadingTrustedIndividuals = true\n loadingAuthorizeEndpoint = false\n\n oauthRequest: RequestInfoForm\n trustedIndividuals: TrustedIndividuals\n constructor(\n @Inject(WINDOW) private window: Window,\n private _user: UserService,\n private _oauth: OauthService,\n private _googleTagManagerService: GoogleTagManagerService,\n private _signingService: SignInService,\n private _platformInfo: PlatformInfoService,\n private _router: Router,\n private _errorHandler: ErrorHandlerService,\n private _trustedIndividuals: TrustedIndividualsService\n ) {\n this._user\n .getUserSession()\n .pipe(\n takeUntil(this.$destroy),\n map((userInfo) => this.removeScopesWithSameDescription(userInfo))\n )\n .subscribe((userInfo) => {\n this.loadingUserInfo = false\n this.loadingTrustedIndividuals = false\n this.oauthRequest = userInfo.oauthSession\n if (userInfo.loggedIn) {\n this.userName = userInfo.displayName\n this.orcidUrl = userInfo.effectiveOrcidUrl\n } else {\n // if the user logouts in the middle of a oauth section on another tab\n this._platformInfo\n .get()\n .pipe(take(1))\n .subscribe((platform) =>\n this._router.navigate([ApplicationRoutes.signin], {\n queryParams: platform.queryParameters,\n })\n )\n }\n })\n\n this._trustedIndividuals.getTrustedIndividuals().subscribe((value) => {\n this.trustedIndividuals = value\n })\n }\n\n ngOnInit(): void {}\n\n navigateTo(val) {\n this.window.location.href = val\n }\n\n authorize(value = true) {\n this.loadingAuthorizeEndpoint = true\n this._oauth.authorize(value).subscribe((data) => {\n const analyticsReports: Observable[] = []\n\n if (value) {\n analyticsReports.push(\n this._googleTagManagerService.reportEvent(\n `Authorize`,\n this.oauthRequest\n )\n )\n } else {\n // Create a GA for deny access\n analyticsReports.push(\n this._googleTagManagerService.reportEvent(\n `Authorize_Deny`,\n this.oauthRequest\n )\n )\n }\n forkJoin(analyticsReports)\n .pipe(\n catchError((err) =>\n this._errorHandler.handleError(\n err,\n ERROR_REPORT.STANDARD_NO_VERBOSE_NO_GA\n )\n )\n )\n .subscribe(\n () => (this.window as any).outOfRouterNavigation(data.redirectUrl),\n () => (this.window as any).outOfRouterNavigation(data.redirectUrl)\n )\n })\n }\n\n getIconName(ScopeObject: Scope): string {\n const scope = ScopeObject.value\n if (scope === 'openid' || scope === '/authenticate') {\n return 'orcidIcon'\n }\n if (scope.indexOf('update') >= 0) {\n return 'updateIcon' // Eye material iconname\n }\n if (scope.indexOf('read') >= 0) {\n return 'viewIcon'\n }\n }\n\n getDescription(ScopeObject: Scope): string {\n const scope = ScopeObject.value\n if (scope === 'openid') {\n return $localize`:@@authorize.authenticate:Get your ORCID iD`\n }\n\n if (scope === '/authenticate') {\n return $localize`:@@authorize.authenticate:Get your ORCID iD`\n }\n\n if (scope === '/person/update') {\n return $localize`:@@authorize.personUpdate:Add/update other information about you (country, keywords, etc.)`\n }\n\n if (scope === '/activities/update') {\n return $localize`:@@authorize.activitiesUpdate:Add/update your research activities (works, affiliations, etc)`\n }\n\n if (scope === '/read-limited') {\n return $localize`:@@authorize.readLimited:Read your information with visibility set to Trusted Organizations`\n }\n\n // For any unreconized scope just use the description from the backend\n return ScopeObject.description\n }\n\n getLongDescription(ScopeObject: Scope): string {\n const scope = ScopeObject.value\n if (scope === 'openid') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.authenticateLongDescription:Allow this organization or application to get your 16-character ORCID iD and read information on your ORCID record you have marked as public.`\n }\n if (scope === '/authenticate') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.authenticateLongDescription:Allow this organization or application to get your 16-character ORCID iD and read information on your ORCID record you have marked as public.`\n }\n\n if (scope === '/person/update') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.personUpdateLongDescription:Allow this organization or application to add information about you (for example, your country, key words, other identifiers - but not your biography) that is stored in their system(s) to the lefthand section of your ORCID record. They will also be able to update this and any other information they have added, but will not be able to edit information added by you or by another trusted organization.`\n }\n\n if (scope === '/activities/update') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.activitiesUpdateLongDescription:Allow this organization or application to add information about your research activities (for example, works, affiliations) that is stored in their system(s) to your ORCID record. They will also be able to update this and any other information they have added, but will not be able to edit information added by you or by another trusted organization.`\n }\n\n if (scope === '/read-limited') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.readLimitedLongDescription:Allow this organization or application to read any information from your record you have marked as limited access. They cannot read information you have marked as private.`\n }\n // For any unreconized scope just use the description from the backend\n return ScopeObject.longDescription\n }\n\n changeAccount(delegator: Delegator) {\n this.loadingTrustedIndividuals = true\n this.loadingUserInfo = true\n\n this._user.switchAccount(delegator).subscribe(() => {\n this.window.location.reload()\n })\n }\n ngOnDestroy() {\n this.$destroy.next(true)\n this.$destroy.unsubscribe()\n }\n\n private removeScopesWithSameDescription(userInfo: UserSession) {\n let alreadyHasAuthenticateScope = false\n userInfo.oauthSession.scopes = userInfo.oauthSession.scopes.filter(\n (scope) => {\n if (\n (scope.value === '/authenticate' || scope.value === 'openid') &&\n !alreadyHasAuthenticateScope\n ) {\n alreadyHasAuthenticateScope = true\n return true\n } else if (\n (scope.value === '/authenticate' || scope.value === 'openid') &&\n alreadyHasAuthenticateScope\n ) {\n return false\n } else {\n return true\n }\n }\n )\n return userInfo\n }\n}\n", + "sourceCode": "import { Component, Inject, OnDestroy, OnInit } from '@angular/core'\nimport { Router } from '@angular/router'\nimport { forkJoin, Observable, Subject } from 'rxjs'\nimport { catchError, map, take, takeUntil } from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { ApplicationRoutes } from 'src/app/constants'\nimport { UserService } from 'src/app/core'\nimport { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'\nimport { OauthService } from 'src/app/core/oauth/oauth.service'\nimport { SignInService } from 'src/app/core/sign-in/sign-in.service'\nimport { TrustedIndividualsService } from 'src/app/core/trusted-individuals/trusted-individuals.service'\nimport { ERROR_REPORT } from 'src/app/errors'\nimport { RequestInfoForm, Scope } from 'src/app/types'\nimport { UserSession } from 'src/app/types/session.local'\nimport {\n Delegator,\n TrustedIndividuals,\n} from 'src/app/types/trusted-individuals.endpoint'\n\nimport { GoogleTagManagerService } from '../../../core/google-tag-manager/google-tag-manager.service'\n\n@Component({\n selector: 'app-form-authorize',\n templateUrl: './form-authorize.component.html',\n styleUrls: ['./form-authorize.component.scss'],\n preserveWhitespaces: true,\n})\nexport class FormAuthorizeComponent implements OnInit, OnDestroy {\n environment = environment\n $destroy: Subject = new Subject()\n orcidUrl: string\n userName: string\n loadingUserInfo = true\n loadingTrustedIndividuals = true\n loadingAuthorizeEndpoint = false\n\n oauthRequest: RequestInfoForm\n trustedIndividuals: TrustedIndividuals\n constructor(\n @Inject(WINDOW) private window: Window,\n private _user: UserService,\n private _oauth: OauthService,\n private _googleTagManagerService: GoogleTagManagerService,\n private _signingService: SignInService,\n private _platformInfo: PlatformInfoService,\n private _router: Router,\n private _errorHandler: ErrorHandlerService,\n private _trustedIndividuals: TrustedIndividualsService\n ) {\n this._user\n .getUserSession()\n .pipe(\n takeUntil(this.$destroy),\n map((userInfo) => this.removeScopesWithSameDescription(userInfo))\n )\n .subscribe((userInfo) => {\n this.loadingUserInfo = false\n this.loadingTrustedIndividuals = false\n this.oauthRequest = userInfo.oauthSession\n if (userInfo.loggedIn) {\n this.userName = userInfo.displayName\n this.orcidUrl = userInfo.effectiveOrcidUrl\n } else {\n // if the user logouts in the middle of a oauth section on another tab\n this._platformInfo\n .get()\n .pipe(take(1))\n .subscribe((platform) =>\n this._router.navigate([ApplicationRoutes.signin], {\n queryParams: platform.queryParameters,\n })\n )\n }\n })\n\n this._trustedIndividuals.getTrustedIndividuals().subscribe((value) => {\n this.trustedIndividuals = value\n })\n }\n\n ngOnInit(): void {}\n\n navigateTo(val) {\n this.window.location.href = val\n }\n\n authorize(value = true) {\n this.loadingAuthorizeEndpoint = true\n this._oauth.authorize(value).subscribe((data) => {\n const analyticsReports: Observable[] = []\n\n if (value) {\n analyticsReports.push(\n this._googleTagManagerService.reportEvent(\n `Authorize`,\n this.oauthRequest\n )\n )\n } else {\n // Create a GA for deny access\n analyticsReports.push(\n this._googleTagManagerService.reportEvent(\n `Authorize_Deny`,\n this.oauthRequest\n )\n )\n }\n forkJoin(analyticsReports)\n .pipe(\n catchError((err) =>\n this._errorHandler.handleError(\n err,\n ERROR_REPORT.STANDARD_NO_VERBOSE_NO_GA\n )\n )\n )\n .subscribe(\n () => (this.window as any).outOfRouterNavigation(data.redirectUrl),\n () => (this.window as any).outOfRouterNavigation(data.redirectUrl)\n )\n })\n }\n\n getIconName(ScopeObject: Scope): string {\n const scope = ScopeObject.value\n if (scope === 'openid' || scope === '/authenticate') {\n return 'orcidIcon'\n }\n if (scope.indexOf('update') >= 0) {\n return 'updateIcon' // Eye material iconname\n }\n if (scope.indexOf('read') >= 0) {\n return 'viewIcon'\n }\n }\n\n getDescription(ScopeObject: Scope): string {\n const scope = ScopeObject.value\n if (scope === 'openid') {\n return $localize`:@@authorize.authenticate:Get your ORCID iD`\n }\n\n if (scope === '/authenticate') {\n return $localize`:@@authorize.authenticate:Get your ORCID iD`\n }\n\n if (scope === '/person/update') {\n return $localize`:@@authorize.personUpdate:Add/update other information about you (country, keywords, etc.)`\n }\n\n if (scope === '/activities/update') {\n return $localize`:@@authorize.activitiesUpdate:Add/update your research activities (works, affiliations, etc)`\n }\n\n if (scope === '/read-limited') {\n return $localize`:@@authorize.readLimited:Read your information with visibility set to Trusted Organizations`\n }\n\n // For any unreconized scope just use the description from the backend\n return ScopeObject.description\n }\n\n getLongDescription(ScopeObject: Scope): string {\n const scope = ScopeObject.value\n if (scope === 'openid') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.authenticateLongDescription:Allow this organization or application to get your 16-character ORCID iD and read information on your ORCID record you have marked as public.`\n }\n if (scope === '/authenticate') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.authenticateLongDescription:Allow this organization or application to get your 16-character ORCID iD and read information on your ORCID record you have marked as public.`\n }\n\n if (scope === '/person/update') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.personUpdateLongDescription:Allow this organization or application to add information about you (for example, your country, key words, other identifiers - but not your biography) that is stored in their system(s) to the lefthand section of your ORCID record. They will also be able to update this and any other information they have added, but will not be able to edit information added by you or by another trusted organization.`\n }\n\n if (scope === '/activities/update') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.activitiesUpdateLongDescription:Allow this organization or application to add information about your research activities (for example, works, affiliations) that is stored in their system(s) to your ORCID record. They will also be able to update this and any other information they have added, but will not be able to edit information added by you or by another trusted organization.`\n }\n\n if (scope === '/read-limited') {\n // tslint:disable-next-line: max-line-length\n return $localize`:@@authorize.readLimitedLongDescription:Allow this organization or application to read any information from your record you have marked as limited access. They cannot read information you have marked as private.`\n }\n // For any unreconized scope just use the description from the backend\n return ScopeObject.longDescription\n }\n\n changeAccount(delegator: Delegator) {\n this.loadingTrustedIndividuals = true\n this.loadingUserInfo = true\n\n this._user.switchAccount(delegator).subscribe(() => {\n this.window.location.reload()\n })\n }\n ngOnDestroy() {\n this.$destroy.next(true)\n this.$destroy.unsubscribe()\n }\n\n private removeScopesWithSameDescription(userInfo: UserSession) {\n let alreadyHasAuthenticateScope = false\n userInfo.oauthSession.scopes = userInfo.oauthSession.scopes.filter(\n (scope) => {\n if (\n (scope.value === '/authenticate' || scope.value === 'openid') &&\n !alreadyHasAuthenticateScope\n ) {\n alreadyHasAuthenticateScope = true\n return true\n } else if (\n (scope.value === '/authenticate' || scope.value === 'openid') &&\n alreadyHasAuthenticateScope\n ) {\n return false\n } else {\n return true\n }\n }\n )\n return userInfo\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -42332,7 +42332,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, DoCheck, forwardRef, OnInit } from '@angular/core'\nimport {\n UntypedFormControl,\n UntypedFormGroup,\n NG_ASYNC_VALIDATORS,\n NG_VALUE_ACCESSOR,\n Validators,\n} from '@angular/forms'\nimport { ErrorStateMatcher } from '@angular/material/core'\nimport { RegisterService } from 'src/app/core/register/register.service'\nimport { environment } from 'src/environments/environment'\n\nimport { BaseForm } from '../BaseForm'\n\n@Component({\n selector: 'app-form-terms',\n templateUrl: './form-terms.component.html',\n styleUrls: ['./form-terms.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => FormTermsComponent),\n multi: true,\n },\n {\n provide: NG_ASYNC_VALIDATORS,\n useExisting: forwardRef(() => FormTermsComponent),\n multi: true,\n },\n ],\n preserveWhitespaces: true,\n})\n// tslint:disable-next-line: class-name\nexport class FormTermsComponent extends BaseForm implements OnInit, DoCheck {\n environment = environment\n constructor(\n private _register: RegisterService,\n private _errorStateMatcher: ErrorStateMatcher\n ) {\n super()\n }\n errorState = false\n\n termsOfUse = new UntypedFormControl('', Validators.requiredTrue)\n dataProcessed = new UntypedFormControl('', Validators.requiredTrue)\n ngOnInit() {\n this.form = new UntypedFormGroup({\n termsOfUse: this.termsOfUse,\n dataProcessed: this.dataProcessed,\n })\n }\n\n // OVERWRITE\n registerOnChange(fn: any) {\n this.form.valueChanges.subscribe((value) => {\n const registerForm =\n this._register.formGroupTermsOfUseAndDataProcessedRegisterForm(\n this.form as UntypedFormGroup\n )\n fn(registerForm)\n })\n }\n\n ngDoCheck(): void {\n this.errorState =\n this._errorStateMatcher.isErrorState(this.termsOfUse, null) ||\n this._errorStateMatcher.isErrorState(this.dataProcessed, null)\n }\n}\n", + "sourceCode": "import { Component, DoCheck, forwardRef, OnInit } from '@angular/core'\nimport {\n UntypedFormControl,\n UntypedFormGroup,\n NG_ASYNC_VALIDATORS,\n NG_VALUE_ACCESSOR,\n Validators,\n} from '@angular/forms'\nimport { ErrorStateMatcher } from '@angular/material/core'\nimport { RegisterService } from 'src/app/core/register/register.service'\n\n\nimport { BaseForm } from '../BaseForm'\n\n@Component({\n selector: 'app-form-terms',\n templateUrl: './form-terms.component.html',\n styleUrls: ['./form-terms.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => FormTermsComponent),\n multi: true,\n },\n {\n provide: NG_ASYNC_VALIDATORS,\n useExisting: forwardRef(() => FormTermsComponent),\n multi: true,\n },\n ],\n preserveWhitespaces: true,\n})\n// tslint:disable-next-line: class-name\nexport class FormTermsComponent extends BaseForm implements OnInit, DoCheck {\n environment = environment\n constructor(\n private _register: RegisterService,\n private _errorStateMatcher: ErrorStateMatcher\n ) {\n super()\n }\n errorState = false\n\n termsOfUse = new UntypedFormControl('', Validators.requiredTrue)\n dataProcessed = new UntypedFormControl('', Validators.requiredTrue)\n ngOnInit() {\n this.form = new UntypedFormGroup({\n termsOfUse: this.termsOfUse,\n dataProcessed: this.dataProcessed,\n })\n }\n\n // OVERWRITE\n registerOnChange(fn: any) {\n this.form.valueChanges.subscribe((value) => {\n const registerForm =\n this._register.formGroupTermsOfUseAndDataProcessedRegisterForm(\n this.form as UntypedFormGroup\n )\n fn(registerForm)\n })\n }\n\n ngDoCheck(): void {\n this.errorState =\n this._errorStateMatcher.isErrorState(this.termsOfUse, null) ||\n this._errorStateMatcher.isErrorState(this.dataProcessed, null)\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -44968,7 +44968,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, OnInit, Inject } from '@angular/core'\nimport { enterAnimation } from 'src/app/animations'\nimport { WINDOW } from '../../../cdk/window'\nimport { environment } from 'src/environments/environment'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\n\n@Component({\n selector: 'app-home',\n templateUrl: './home.component.html',\n styleUrls: ['./home.component.scss-theme.scss', './home.component.scss'],\n animations: [enterAnimation],\n preserveWhitespaces: true,\n})\nexport class HomeComponent implements OnInit {\n platform\n\n constructor(\n _platformInfo: PlatformInfoService,\n @Inject(WINDOW) private window: Window\n ) {\n _platformInfo.get().subscribe((platformInfo) => {\n this.platform = platformInfo\n })\n }\n\n goto(url) {\n this.window.location.href = environment.BASE_URL + url\n }\n\n ngOnInit() {}\n}\n", + "sourceCode": "import { Component, OnInit, Inject } from '@angular/core'\nimport { enterAnimation } from 'src/app/animations'\nimport { WINDOW } from '../../../cdk/window'\n\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\n\n@Component({\n selector: 'app-home',\n templateUrl: './home.component.html',\n styleUrls: ['./home.component.scss-theme.scss', './home.component.scss'],\n animations: [enterAnimation],\n preserveWhitespaces: true,\n})\nexport class HomeComponent implements OnInit {\n platform\n\n constructor(\n _platformInfo: PlatformInfoService,\n @Inject(WINDOW) private window: Window\n ) {\n _platformInfo.get().subscribe((platformInfo) => {\n this.platform = platformInfo\n })\n }\n\n goto(url) {\n this.window.location.href = environment.BASE_URL + url\n }\n\n ngOnInit() {}\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -46447,7 +46447,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, OnInit, Inject, LOCALE_ID } from '@angular/core'\nimport { environment } from 'src/environments/environment'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { LanguageService } from 'src/app/core/language/language.service'\n\n@Component({\n selector: 'app-language',\n templateUrl: './language.component.html',\n styleUrls: ['./language.component.scss'],\n})\nexport class LanguageComponent implements OnInit {\n languageMenuOptions: { [key: string]: string }\n labelLanguage = $localize`:@@layout.ariaLabelLanguage:Select your preferred language. Current language is`\n\n constructor(\n @Inject(LOCALE_ID) public locale: string,\n @Inject(WINDOW) private window: Window,\n private _language: LanguageService\n ) {\n this.languageMenuOptions = environment.LANGUAGE_MENU_OPTIONS\n // LOCAL DEV GET'S `en-US` from locale but `en` is required\n this.locale = this.locale === 'en-US' ? 'en' : this.locale\n this.labelLanguage += ` ${environment.LANGUAGE_MENU_OPTIONS[this.locale]}`\n }\n\n changeLanguage(languageKey: string) {\n this._language.changeLanguage(languageKey).subscribe(() => {\n this.window.location.reload()\n })\n }\n\n ngOnInit() {}\n}\n", + "sourceCode": "import { Component, OnInit, Inject, LOCALE_ID } from '@angular/core'\n\nimport { WINDOW } from 'src/app/cdk/window'\nimport { LanguageService } from 'src/app/core/language/language.service'\n\n@Component({\n selector: 'app-language',\n templateUrl: './language.component.html',\n styleUrls: ['./language.component.scss'],\n})\nexport class LanguageComponent implements OnInit {\n languageMenuOptions: { [key: string]: string }\n labelLanguage = $localize`:@@layout.ariaLabelLanguage:Select your preferred language. Current language is`\n\n constructor(\n @Inject(LOCALE_ID) public locale: string,\n @Inject(WINDOW) private window: Window,\n private _language: LanguageService\n ) {\n this.languageMenuOptions = environment.LANGUAGE_MENU_OPTIONS\n // LOCAL DEV GET'S `en-US` from locale but `en` is required\n this.locale = this.locale === 'en-US' ? 'en' : this.locale\n this.labelLanguage += ` ${environment.LANGUAGE_MENU_OPTIONS[this.locale]}`\n }\n\n changeLanguage(languageKey: string) {\n this._language.changeLanguage(languageKey).subscribe(() => {\n this.window.location.reload()\n })\n }\n\n ngOnInit() {}\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -46850,7 +46850,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Inject, Input, OnInit } from '@angular/core'\nimport { UserService } from 'src/app/core'\nimport { environment } from 'src/environments/environment'\nimport { WINDOW } from '../../../cdk/window'\n\n@Component({\n selector: 'app-logged-in',\n templateUrl: './logged-in.component.html',\n styleUrls: ['./logged-in.component.scss'],\n})\nexport class LoggedInComponent implements OnInit {\n @Input() realUserOrcid: string\n @Input() displayName: string\n\n constructor(\n @Inject(WINDOW) private window: Window,\n private user: UserService\n ) {}\n\n ngOnInit() {}\n\n navigateTo(val) {\n if (val === '/signout' && environment.proxyMode) {\n this.user.noRedirectLogout().subscribe()\n } else {\n this.window.location.href = val\n }\n }\n}\n", + "sourceCode": "import { Component, Inject, Input, OnInit } from '@angular/core'\nimport { UserService } from 'src/app/core'\n\nimport { WINDOW } from '../../../cdk/window'\n\n@Component({\n selector: 'app-logged-in',\n templateUrl: './logged-in.component.html',\n styleUrls: ['./logged-in.component.scss'],\n})\nexport class LoggedInComponent implements OnInit {\n @Input() realUserOrcid: string\n @Input() displayName: string\n\n constructor(\n @Inject(WINDOW) private window: Window,\n private user: UserService\n ) {}\n\n ngOnInit() {}\n\n navigateTo(val) {\n if (val === '/signout' && environment.proxyMode) {\n this.user.noRedirectLogout().subscribe()\n } else {\n this.window.location.href = val\n }\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -58577,7 +58577,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, OnInit, Inject } from '@angular/core'\nimport { listAnimation } from 'src/app/animations'\nimport { NewsService } from 'src/app/core'\nimport { environment } from 'src/environments/environment'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { WINDOW } from 'src/app/cdk/window'\n\n@Component({\n selector: 'app-news',\n templateUrl: './news.component.html',\n styleUrls: ['./news.component.scss-theme.scss', './news.component.scss'],\n animations: [listAnimation],\n})\nexport class NewsComponent implements OnInit {\n news\n platform\n labelHomeNews = $localize`:@@home.ariaLabelNews:News`\n constructor(\n private _news: NewsService,\n private _platform: PlatformInfoService,\n @Inject(WINDOW) private window: Window\n ) {\n _platform.platformSubject.subscribe((data) => {\n this.platform = data\n })\n }\n\n ngOnInit() {\n this._news.getNews().subscribe((data: any[]) => {\n this.news = data.slice(0, 3)\n })\n }\n\n navigate(url) {\n this.window.location.href = url[0]\n }\n\n moreNews() {\n this.window.location.href = environment.INFO_SITE\n }\n}\n", + "sourceCode": "import { Component, OnInit, Inject } from '@angular/core'\nimport { listAnimation } from 'src/app/animations'\nimport { NewsService } from 'src/app/core'\n\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { WINDOW } from 'src/app/cdk/window'\n\n@Component({\n selector: 'app-news',\n templateUrl: './news.component.html',\n styleUrls: ['./news.component.scss-theme.scss', './news.component.scss'],\n animations: [listAnimation],\n})\nexport class NewsComponent implements OnInit {\n news\n platform\n labelHomeNews = $localize`:@@home.ariaLabelNews:News`\n constructor(\n private _news: NewsService,\n private _platform: PlatformInfoService,\n @Inject(WINDOW) private window: Window\n ) {\n _platform.platformSubject.subscribe((data) => {\n this.platform = data\n })\n }\n\n ngOnInit() {\n this._news.getNews().subscribe((data: any[]) => {\n this.news = data.slice(0, 3)\n })\n }\n\n navigate(url) {\n this.window.location.href = url[0]\n }\n\n moreNews() {\n this.window.location.href = environment.INFO_SITE\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -70860,7 +70860,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import {\n Component,\n EventEmitter,\n Inject,\n LOCALE_ID,\n OnDestroy,\n OnInit,\n Output,\n} from '@angular/core'\nimport { UntypedFormBuilder } from '@angular/forms'\nimport { Subject } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { LanguageService } from 'src/app/core/language/language.service'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-settings-defaults-language',\n templateUrl: './settings-defaults-language.component.html',\n styleUrls: ['./settings-defaults-language.component.scss'],\n})\nexport class SettingsDefaultsLanguageComponent implements OnInit, OnDestroy {\n $destroy: Subject = new Subject()\n languageMenuOptions: { [key: string]: string }\n form: any\n @Output() loading = new EventEmitter()\n\n constructor(\n @Inject(LOCALE_ID) public locale: string,\n @Inject(WINDOW) private window: Window,\n private _language: LanguageService,\n private _fb: UntypedFormBuilder\n ) {\n this.languageMenuOptions = environment.LANGUAGE_MENU_OPTIONS\n }\n\n ngOnInit() {\n this.form = this._fb.group({\n locale:\n // LOCAL DEV GET'S `en-US` from locale but `en` is required\n this.locale === 'en-US' ? 'en' : this.locale,\n })\n this.form.controls.locale.valueChanges\n .pipe(takeUntil(this.$destroy))\n .subscribe((languageKey) => {\n this._language.changeLanguage(languageKey).subscribe(() => {\n this.window.location.reload()\n })\n })\n }\n\n ngOnDestroy() {\n this.$destroy.next(true)\n this.$destroy.unsubscribe()\n }\n}\n", + "sourceCode": "import {\n Component,\n EventEmitter,\n Inject,\n LOCALE_ID,\n OnDestroy,\n OnInit,\n Output,\n} from '@angular/core'\nimport { UntypedFormBuilder } from '@angular/forms'\nimport { Subject } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { LanguageService } from 'src/app/core/language/language.service'\n\n\n@Component({\n selector: 'app-settings-defaults-language',\n templateUrl: './settings-defaults-language.component.html',\n styleUrls: ['./settings-defaults-language.component.scss'],\n})\nexport class SettingsDefaultsLanguageComponent implements OnInit, OnDestroy {\n $destroy: Subject = new Subject()\n languageMenuOptions: { [key: string]: string }\n form: any\n @Output() loading = new EventEmitter()\n\n constructor(\n @Inject(LOCALE_ID) public locale: string,\n @Inject(WINDOW) private window: Window,\n private _language: LanguageService,\n private _fb: UntypedFormBuilder\n ) {\n this.languageMenuOptions = environment.LANGUAGE_MENU_OPTIONS\n }\n\n ngOnInit() {\n this.form = this._fb.group({\n locale:\n // LOCAL DEV GET'S `en-US` from locale but `en` is required\n this.locale === 'en-US' ? 'en' : this.locale,\n })\n this.form.controls.locale.valueChanges\n .pipe(takeUntil(this.$destroy))\n .subscribe((languageKey) => {\n this._language.changeLanguage(languageKey).subscribe(() => {\n this.window.location.reload()\n })\n })\n }\n\n ngOnDestroy() {\n this.$destroy.next(true)\n this.$destroy.unsubscribe()\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -72517,7 +72517,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, EventEmitter, OnInit, Output } from '@angular/core'\nimport { take } from 'rxjs/operators'\nimport { UserService } from 'src/app/core'\nimport { UserSession } from 'src/app/types/session.local'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-settings-sharing-html-code',\n templateUrl: './settings-sharing-html-code.component.html',\n styleUrls: ['./settings-sharing-html-code.component.scss'],\n})\nexport class SettingsSharingHtmlCodeComponent implements OnInit {\n @Output() loading = new EventEmitter()\n userSession: UserSession\n baseUrl = environment.BASE_URL\n\n constructor(private _user: UserService) {}\n\n ngOnInit(): void {\n this._user\n .getUserSession()\n .pipe(take(1))\n .subscribe((userSession) => {\n this.userSession = userSession\n })\n }\n}\n", + "sourceCode": "import { Component, EventEmitter, OnInit, Output } from '@angular/core'\nimport { take } from 'rxjs/operators'\nimport { UserService } from 'src/app/core'\nimport { UserSession } from 'src/app/types/session.local'\n\n\n@Component({\n selector: 'app-settings-sharing-html-code',\n templateUrl: './settings-sharing-html-code.component.html',\n styleUrls: ['./settings-sharing-html-code.component.scss'],\n})\nexport class SettingsSharingHtmlCodeComponent implements OnInit {\n @Output() loading = new EventEmitter()\n userSession: UserSession\n baseUrl = environment.BASE_URL\n\n constructor(private _user: UserService) {}\n\n ngOnInit(): void {\n this._user\n .getUserSession()\n .pipe(take(1))\n .subscribe((userSession) => {\n this.userSession = userSession\n })\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -72773,7 +72773,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, OnDestroy, OnInit } from '@angular/core'\nimport { MatDialog } from '@angular/material/dialog'\nimport { Observable, of, Subject } from 'rxjs'\nimport { startWith, switchMap, takeUntil, tap } from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { AccountTrustedIndividualsService } from 'src/app/core/account-trusted-individuals/account-trusted-individuals.service'\nimport { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals'\nimport { environment } from 'src/environments/environment'\n\nimport { DialogRevokeTrustedIndividualsComponent } from '../dialog-revoke-trusted-individuals/dialog-revoke-trusted-individuals.component'\n\n@Component({\n selector: 'app-settings-trusted-individuals',\n templateUrl: './settings-trusted-individuals.component.html',\n styleUrls: [\n './settings-trusted-individuals.component.scss',\n './settings-trusted-individuals.component.scss-theme.scss',\n ],\n})\nexport class SettingsTrustedIndividualsComponent implements OnInit, OnDestroy {\n $trustedIndividuals: Observable\n displayedColumns = ['trustedIndividuals', 'orcid', 'granted', 'actions']\n platformSubs = new Subject()\n isMobile: boolean\n baseUrl = environment.BASE_URL\n trustedPartiesUrl = '/trusted-parties'\n constructor(\n private _trustedIndividualsService: AccountTrustedIndividualsService,\n private dialog: MatDialog,\n private _platform: PlatformInfoService\n ) {}\n ngOnDestroy(): void {\n this.platformSubs.next()\n this.platformSubs.complete()\n }\n\n ngOnInit(): void {\n this.setupTrustedIndividualsObs()\n this._platform\n .get()\n .pipe(takeUntil(this.platformSubs))\n .subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n }\n\n private setupTrustedIndividualsObs() {\n this.$trustedIndividuals =\n this._trustedIndividualsService.updateTrustedIndividualsSuccess.pipe(\n startWith(() => undefined),\n switchMap(() => this._trustedIndividualsService.get())\n )\n }\n\n revokeAccess(accountTrustedOrganization: AccountTrustedIndividual) {\n this.dialog\n .open(DialogRevokeTrustedIndividualsComponent, {\n data: accountTrustedOrganization,\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n return this._trustedIndividualsService.delete(value)\n } else {\n of(undefined)\n }\n })\n )\n .subscribe()\n }\n}\n", + "sourceCode": "import { Component, OnDestroy, OnInit } from '@angular/core'\nimport { MatDialog } from '@angular/material/dialog'\nimport { Observable, of, Subject } from 'rxjs'\nimport { startWith, switchMap, takeUntil, tap } from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { AccountTrustedIndividualsService } from 'src/app/core/account-trusted-individuals/account-trusted-individuals.service'\nimport { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals'\n\n\nimport { DialogRevokeTrustedIndividualsComponent } from '../dialog-revoke-trusted-individuals/dialog-revoke-trusted-individuals.component'\n\n@Component({\n selector: 'app-settings-trusted-individuals',\n templateUrl: './settings-trusted-individuals.component.html',\n styleUrls: [\n './settings-trusted-individuals.component.scss',\n './settings-trusted-individuals.component.scss-theme.scss',\n ],\n})\nexport class SettingsTrustedIndividualsComponent implements OnInit, OnDestroy {\n $trustedIndividuals: Observable\n displayedColumns = ['trustedIndividuals', 'orcid', 'granted', 'actions']\n platformSubs = new Subject()\n isMobile: boolean\n baseUrl = environment.BASE_URL\n trustedPartiesUrl = '/trusted-parties'\n constructor(\n private _trustedIndividualsService: AccountTrustedIndividualsService,\n private dialog: MatDialog,\n private _platform: PlatformInfoService\n ) {}\n ngOnDestroy(): void {\n this.platformSubs.next()\n this.platformSubs.complete()\n }\n\n ngOnInit(): void {\n this.setupTrustedIndividualsObs()\n this._platform\n .get()\n .pipe(takeUntil(this.platformSubs))\n .subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n }\n\n private setupTrustedIndividualsObs() {\n this.$trustedIndividuals =\n this._trustedIndividualsService.updateTrustedIndividualsSuccess.pipe(\n startWith(() => undefined),\n switchMap(() => this._trustedIndividualsService.get())\n )\n }\n\n revokeAccess(accountTrustedOrganization: AccountTrustedIndividual) {\n this.dialog\n .open(DialogRevokeTrustedIndividualsComponent, {\n data: accountTrustedOrganization,\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n return this._trustedIndividualsService.delete(value)\n } else {\n of(undefined)\n }\n })\n )\n .subscribe()\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -73301,7 +73301,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { LiveAnnouncer } from '@angular/cdk/a11y'\nimport { Component, OnDestroy, OnInit } from '@angular/core'\nimport { MatDialog } from '@angular/material/dialog'\nimport { MatPaginatorIntl, PageEvent } from '@angular/material/paginator'\nimport { Observable, of, Subject } from 'rxjs'\nimport {\n map,\n mergeMap,\n startWith,\n switchMap,\n take,\n takeUntil,\n tap,\n} from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport {\n EMAIL_REGEXP_GENERIC,\n ORCID_REGEXP_CASE_INSENSITIVE,\n} from 'src/app/constants'\nimport { UserService } from 'src/app/core'\nimport { AccountTrustedIndividualsService } from 'src/app/core/account-trusted-individuals/account-trusted-individuals.service'\nimport { AnnouncerService } from 'src/app/core/announcer/announcer.service'\nimport { SearchService } from 'src/app/core/search/search.service'\nimport { ExpandedSearchResultsContent, SearchResults } from 'src/app/types'\nimport { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals'\nimport { UserSession } from 'src/app/types/session.local'\nimport { environment } from 'src/environments/environment'\nimport { DialogAddTrustedIndividualsYourOwnEmailComponent } from '../dialog-add-trusted-individuals-your-own-email/dialog-add-trusted-individuals-your-own-email.component'\nimport { DialogAddTrustedIndividualsComponent } from '../dialog-add-trusted-individuals/dialog-add-trusted-individuals.component'\n\n@Component({\n selector: 'app-settings-trusted-individuals-search',\n templateUrl: './settings-trusted-individuals-search.component.html',\n styleUrls: [\n './settings-trusted-individuals-search.component.scss',\n './settings-trusted-individuals-search.component.scss-theme.scss',\n ],\n})\nexport class SettingsTrustedIndividualsSearchComponent\n implements OnInit, OnDestroy\n{\n $destroy = new Subject()\n searchDone = false\n displayedColumns = ['trustedIndividuals', 'orcid', 'actions']\n isMobile: boolean\n searchValue: string\n $search: Observable\n pageIndex: number\n pageSize: number\n ariaLabelPaginator = $localize`:@@search.paginator:paginator`\n loading: boolean\n baseUrl = environment.BASE_URL\n userSession: UserSession\n searchPlaceHolder = $localize`:@@account.searchIndividualsPlaceHolder:ORCID iD, email address, or names`\n trustedIndividuals: AccountTrustedIndividual[]\n searchResultsByName: boolean\n alreadyAddedLabel = $localize`:@@account.alreadyAdded:You already added this user`\n trustedPartiesUrl = '/trusted-parties'\n paginatorLabel: any\n trustedIndividualsLabel = $localize`:@@account.trustedIndividuals:Trusted individuals`\n\n constructor(\n private _search: SearchService,\n private dialog: MatDialog,\n private _platform: PlatformInfoService,\n private account: AccountTrustedIndividualsService,\n private _user: UserService,\n private _announcer: AnnouncerService,\n private _matPaginatorIntl: MatPaginatorIntl\n ) {}\n\n search(value: string) {\n this.loading = true\n value = value.trim().toLowerCase()\n const orcidIdMatch = this.extractOrcidId(value)\n const emailMatch = EMAIL_REGEXP_GENERIC.exec(value)?.[0]\n this.searchResultsByName = !orcidIdMatch && !emailMatch\n\n if (emailMatch) {\n this.$search = this.account.searchByEmail(emailMatch).pipe(\n map((response) => {\n if (response.isSelf) {\n this.announceThisIsYourOwnRecord()\n } else if (response.found && !response.isAlreadyAdded) {\n this.addByEmail(emailMatch)\n return null\n } else {\n return { 'expanded-result': [], 'num-found': 0 }\n }\n }),\n tap(() => {\n this.loading = false\n })\n )\n } else if (orcidIdMatch) {\n this.$search = this.account\n .searchByOrcid(orcidIdMatch.toUpperCase())\n .pipe(\n map((response) => {\n if (response.isSelf) {\n this.announceThisIsYourOwnRecord()\n } else if (response.found && !response.isAlreadyAdded) {\n this.addByOrcid(orcidIdMatch.toUpperCase())\n return null\n } else {\n return { 'expanded-result': [], 'num-found': 0 }\n }\n }),\n tap(() => {\n this.loading = false\n })\n )\n } else {\n this.$search = this.account.updateTrustedIndividualsSuccess.pipe(\n startWith({}),\n switchMap(() => this.account.get()),\n switchMap((currentTrustedIndividuals) => {\n return this._search\n .search({\n searchQuery: value,\n pageIndex: this.pageIndex || 0,\n pageSize: this.pageSize || 10,\n })\n .pipe(\n map((searchResults) => {\n return {\n currentTrustedIndividuals,\n searchResults,\n }\n })\n )\n }),\n\n map((search) => {\n if (search.searchResults['expanded-result']) {\n search.searchResults['expanded-result'] = search.searchResults[\n 'expanded-result'\n ].map((searchResult) => {\n return {\n ...searchResult,\n alreadyOnRecord: this.resultIsMyOnRecordOrIsAlreadyAdded(\n searchResult,\n search.currentTrustedIndividuals\n ),\n }\n })\n }\n return search.searchResults\n }),\n tap((search) => {\n this.loading = false\n })\n )\n }\n }\n\n private resultIsMyOnRecordOrIsAlreadyAdded(\n searchResult: ExpandedSearchResultsContent,\n existingTrusteds: AccountTrustedIndividual[]\n ): boolean {\n return !!(\n searchResult['orcid-id'] ===\n this.userSession.userInfo.EFFECTIVE_USER_ORCID ||\n existingTrusteds.filter(\n (existingTrusted) =>\n existingTrusted.receiverOrcid.path.toLowerCase() ===\n searchResult['orcid-id'].toLowerCase()\n ).length\n )\n }\n\n private extractOrcidId(input: string): string {\n const regexResult = ORCID_REGEXP_CASE_INSENSITIVE.exec(input)\n if (regexResult) {\n return regexResult[0]\n }\n return null\n }\n\n add(value: ExpandedSearchResultsContent) {\n if (!value.alreadyOnRecord) {\n this.dialog\n .open(DialogAddTrustedIndividualsComponent, {\n data: value,\n width: '634px',\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n this.loading = true\n return this.account.add(value)\n }\n return of(undefined)\n })\n )\n .subscribe()\n }\n }\n\n addByEmail(value: string) {\n this.dialog\n .open(DialogAddTrustedIndividualsComponent, {\n data: value,\n width: '634px',\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n return this.account.addByEmail(value)\n }\n return of(undefined)\n })\n )\n .subscribe()\n }\n\n addByOrcid(value: string) {\n this.dialog\n .open(DialogAddTrustedIndividualsComponent, {\n data: value,\n width: '634px',\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n return this.account.addByOrcid(value)\n }\n return of(undefined)\n })\n )\n .subscribe()\n }\n\n announceThisIsYourOwnRecord() {\n this.dialog.open(DialogAddTrustedIndividualsYourOwnEmailComponent, {\n width: '634px',\n })\n }\n\n changePage(event: PageEvent) {\n this.pageIndex = event.pageIndex\n this.pageSize = event.pageSize\n this.paginatorLabel = this._matPaginatorIntl.getRangeLabel(\n event.pageIndex,\n event.pageSize,\n event.length\n )\n this._announcer.liveAnnouncePagination(event, this.trustedIndividualsLabel)\n this.search(this.searchValue)\n }\n ngOnInit(): void {\n this._platform\n .get()\n .pipe(takeUntil(this.$destroy))\n .subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n this._user\n .getUserSession()\n .pipe(take(1))\n .subscribe((userSession) => {\n this.userSession = userSession\n })\n }\n\n ngOnDestroy(): void {\n this.$destroy.next()\n this.$destroy.unsubscribe()\n }\n}\n", + "sourceCode": "import { LiveAnnouncer } from '@angular/cdk/a11y'\nimport { Component, OnDestroy, OnInit } from '@angular/core'\nimport { MatDialog } from '@angular/material/dialog'\nimport { MatPaginatorIntl, PageEvent } from '@angular/material/paginator'\nimport { Observable, of, Subject } from 'rxjs'\nimport {\n map,\n mergeMap,\n startWith,\n switchMap,\n take,\n takeUntil,\n tap,\n} from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport {\n EMAIL_REGEXP_GENERIC,\n ORCID_REGEXP_CASE_INSENSITIVE,\n} from 'src/app/constants'\nimport { UserService } from 'src/app/core'\nimport { AccountTrustedIndividualsService } from 'src/app/core/account-trusted-individuals/account-trusted-individuals.service'\nimport { AnnouncerService } from 'src/app/core/announcer/announcer.service'\nimport { SearchService } from 'src/app/core/search/search.service'\nimport { ExpandedSearchResultsContent, SearchResults } from 'src/app/types'\nimport { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals'\nimport { UserSession } from 'src/app/types/session.local'\n\nimport { DialogAddTrustedIndividualsYourOwnEmailComponent } from '../dialog-add-trusted-individuals-your-own-email/dialog-add-trusted-individuals-your-own-email.component'\nimport { DialogAddTrustedIndividualsComponent } from '../dialog-add-trusted-individuals/dialog-add-trusted-individuals.component'\n\n@Component({\n selector: 'app-settings-trusted-individuals-search',\n templateUrl: './settings-trusted-individuals-search.component.html',\n styleUrls: [\n './settings-trusted-individuals-search.component.scss',\n './settings-trusted-individuals-search.component.scss-theme.scss',\n ],\n})\nexport class SettingsTrustedIndividualsSearchComponent\n implements OnInit, OnDestroy\n{\n $destroy = new Subject()\n searchDone = false\n displayedColumns = ['trustedIndividuals', 'orcid', 'actions']\n isMobile: boolean\n searchValue: string\n $search: Observable\n pageIndex: number\n pageSize: number\n ariaLabelPaginator = $localize`:@@search.paginator:paginator`\n loading: boolean\n baseUrl = environment.BASE_URL\n userSession: UserSession\n searchPlaceHolder = $localize`:@@account.searchIndividualsPlaceHolder:ORCID iD, email address, or names`\n trustedIndividuals: AccountTrustedIndividual[]\n searchResultsByName: boolean\n alreadyAddedLabel = $localize`:@@account.alreadyAdded:You already added this user`\n trustedPartiesUrl = '/trusted-parties'\n paginatorLabel: any\n trustedIndividualsLabel = $localize`:@@account.trustedIndividuals:Trusted individuals`\n\n constructor(\n private _search: SearchService,\n private dialog: MatDialog,\n private _platform: PlatformInfoService,\n private account: AccountTrustedIndividualsService,\n private _user: UserService,\n private _announcer: AnnouncerService,\n private _matPaginatorIntl: MatPaginatorIntl\n ) {}\n\n search(value: string) {\n this.loading = true\n value = value.trim().toLowerCase()\n const orcidIdMatch = this.extractOrcidId(value)\n const emailMatch = EMAIL_REGEXP_GENERIC.exec(value)?.[0]\n this.searchResultsByName = !orcidIdMatch && !emailMatch\n\n if (emailMatch) {\n this.$search = this.account.searchByEmail(emailMatch).pipe(\n map((response) => {\n if (response.isSelf) {\n this.announceThisIsYourOwnRecord()\n } else if (response.found && !response.isAlreadyAdded) {\n this.addByEmail(emailMatch)\n return null\n } else {\n return { 'expanded-result': [], 'num-found': 0 }\n }\n }),\n tap(() => {\n this.loading = false\n })\n )\n } else if (orcidIdMatch) {\n this.$search = this.account\n .searchByOrcid(orcidIdMatch.toUpperCase())\n .pipe(\n map((response) => {\n if (response.isSelf) {\n this.announceThisIsYourOwnRecord()\n } else if (response.found && !response.isAlreadyAdded) {\n this.addByOrcid(orcidIdMatch.toUpperCase())\n return null\n } else {\n return { 'expanded-result': [], 'num-found': 0 }\n }\n }),\n tap(() => {\n this.loading = false\n })\n )\n } else {\n this.$search = this.account.updateTrustedIndividualsSuccess.pipe(\n startWith({}),\n switchMap(() => this.account.get()),\n switchMap((currentTrustedIndividuals) => {\n return this._search\n .search({\n searchQuery: value,\n pageIndex: this.pageIndex || 0,\n pageSize: this.pageSize || 10,\n })\n .pipe(\n map((searchResults) => {\n return {\n currentTrustedIndividuals,\n searchResults,\n }\n })\n )\n }),\n\n map((search) => {\n if (search.searchResults['expanded-result']) {\n search.searchResults['expanded-result'] = search.searchResults[\n 'expanded-result'\n ].map((searchResult) => {\n return {\n ...searchResult,\n alreadyOnRecord: this.resultIsMyOnRecordOrIsAlreadyAdded(\n searchResult,\n search.currentTrustedIndividuals\n ),\n }\n })\n }\n return search.searchResults\n }),\n tap((search) => {\n this.loading = false\n })\n )\n }\n }\n\n private resultIsMyOnRecordOrIsAlreadyAdded(\n searchResult: ExpandedSearchResultsContent,\n existingTrusteds: AccountTrustedIndividual[]\n ): boolean {\n return !!(\n searchResult['orcid-id'] ===\n this.userSession.userInfo.EFFECTIVE_USER_ORCID ||\n existingTrusteds.filter(\n (existingTrusted) =>\n existingTrusted.receiverOrcid.path.toLowerCase() ===\n searchResult['orcid-id'].toLowerCase()\n ).length\n )\n }\n\n private extractOrcidId(input: string): string {\n const regexResult = ORCID_REGEXP_CASE_INSENSITIVE.exec(input)\n if (regexResult) {\n return regexResult[0]\n }\n return null\n }\n\n add(value: ExpandedSearchResultsContent) {\n if (!value.alreadyOnRecord) {\n this.dialog\n .open(DialogAddTrustedIndividualsComponent, {\n data: value,\n width: '634px',\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n this.loading = true\n return this.account.add(value)\n }\n return of(undefined)\n })\n )\n .subscribe()\n }\n }\n\n addByEmail(value: string) {\n this.dialog\n .open(DialogAddTrustedIndividualsComponent, {\n data: value,\n width: '634px',\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n return this.account.addByEmail(value)\n }\n return of(undefined)\n })\n )\n .subscribe()\n }\n\n addByOrcid(value: string) {\n this.dialog\n .open(DialogAddTrustedIndividualsComponent, {\n data: value,\n width: '634px',\n })\n .afterClosed()\n .pipe(\n switchMap((value) => {\n if (value) {\n return this.account.addByOrcid(value)\n }\n return of(undefined)\n })\n )\n .subscribe()\n }\n\n announceThisIsYourOwnRecord() {\n this.dialog.open(DialogAddTrustedIndividualsYourOwnEmailComponent, {\n width: '634px',\n })\n }\n\n changePage(event: PageEvent) {\n this.pageIndex = event.pageIndex\n this.pageSize = event.pageSize\n this.paginatorLabel = this._matPaginatorIntl.getRangeLabel(\n event.pageIndex,\n event.pageSize,\n event.length\n )\n this._announcer.liveAnnouncePagination(event, this.trustedIndividualsLabel)\n this.search(this.searchValue)\n }\n ngOnInit(): void {\n this._platform\n .get()\n .pipe(takeUntil(this.$destroy))\n .subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n this._user\n .getUserSession()\n .pipe(take(1))\n .subscribe((userSession) => {\n this.userSession = userSession\n })\n }\n\n ngOnDestroy(): void {\n this.$destroy.next()\n this.$destroy.unsubscribe()\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -73743,7 +73743,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, OnDestroy, OnInit } from '@angular/core'\nimport { MatDialog } from '@angular/material/dialog'\nimport { Observable, Subject } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { TrustedIndividualsService } from 'src/app/core/trusted-individuals/trusted-individuals.service'\nimport { TrustedIndividuals } from 'src/app/types/trusted-individuals.endpoint'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-settings-users-that-thrust-you',\n templateUrl: './settings-users-that-thrust-you.component.html',\n styleUrls: [\n './settings-users-that-thrust-you.component.scss',\n './settings-users-that-thrust-you.component.scss-theme.scss',\n ],\n})\nexport class SettingsUsersThatThrustYouComponent implements OnInit {\n $usersThatThrustYou: Observable\n displayedColumns = ['trustedIndividuals', 'orcid', 'granted']\n platformSubs = new Subject()\n isMobile: boolean\n baseUrl = environment.BASE_URL\n constructor(\n private _trustedIndividualsService: TrustedIndividualsService,\n private dialog: MatDialog,\n private _platform: PlatformInfoService\n ) {}\n\n ngOnInit(): void {\n this.setupTrustedIndividualsObs()\n this._platform.get().subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n }\n\n private setupTrustedIndividualsObs() {\n this.$usersThatThrustYou =\n this._trustedIndividualsService.getTrustedIndividuals()\n }\n}\n", + "sourceCode": "import { Component, OnDestroy, OnInit } from '@angular/core'\nimport { MatDialog } from '@angular/material/dialog'\nimport { Observable, Subject } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { TrustedIndividualsService } from 'src/app/core/trusted-individuals/trusted-individuals.service'\nimport { TrustedIndividuals } from 'src/app/types/trusted-individuals.endpoint'\n\n\n@Component({\n selector: 'app-settings-users-that-thrust-you',\n templateUrl: './settings-users-that-thrust-you.component.html',\n styleUrls: [\n './settings-users-that-thrust-you.component.scss',\n './settings-users-that-thrust-you.component.scss-theme.scss',\n ],\n})\nexport class SettingsUsersThatThrustYouComponent implements OnInit {\n $usersThatThrustYou: Observable\n displayedColumns = ['trustedIndividuals', 'orcid', 'granted']\n platformSubs = new Subject()\n isMobile: boolean\n baseUrl = environment.BASE_URL\n constructor(\n private _trustedIndividualsService: TrustedIndividualsService,\n private dialog: MatDialog,\n private _platform: PlatformInfoService\n ) {}\n\n ngOnInit(): void {\n this.setupTrustedIndividualsObs()\n this._platform.get().subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n })\n }\n\n private setupTrustedIndividualsObs() {\n this.$usersThatThrustYou =\n this._trustedIndividualsService.getTrustedIndividuals()\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -75804,7 +75804,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Input } from '@angular/core'\n\nimport { BaseStepDirective } from '../BaseStep'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { first } from 'rxjs/operators'\nimport { Router } from '@angular/router'\nimport { ApplicationRoutes } from 'src/app/constants'\nimport { environment } from 'src/environments/environment'\nimport { ReactivationLocal } from '../../../types/reactivation.local'\n\n@Component({\n selector: 'app-step-a',\n templateUrl: './step-a.component.html',\n styleUrls: ['./step-a.component.scss'],\n preserveWhitespaces: true,\n})\nexport class StepAComponent extends BaseStepDirective {\n @Input() reactivation: ReactivationLocal\n\n constructor(private _platform: PlatformInfoService, private _router: Router) {\n super()\n }\n infoSiteBaseUrl = environment.INFO_SITE\n\n goBack() {\n this._platform\n .get()\n .pipe(first())\n .subscribe((platform) => {\n if (platform.social) {\n this._router.navigate([ApplicationRoutes.social], {\n queryParams: {\n ...platform.queryParameters,\n },\n })\n } else if (platform.institutional) {\n this._router.navigate([ApplicationRoutes.institutionalLinking], {\n queryParams: {\n ...platform.queryParameters,\n },\n })\n } else {\n this._router.navigate([ApplicationRoutes.signin], {\n queryParams: {\n ...platform.queryParameters,\n },\n })\n }\n })\n }\n\n signIn() {\n this._platform\n .get()\n .pipe(first())\n .subscribe((platform) => {\n const params = JSON.parse(JSON.stringify(platform.queryParameters))\n if (params['email']) {\n delete params['email']\n }\n if (params['orcid']) {\n delete params['orcid']\n }\n\n if (params['show_login']) {\n delete params['show_login']\n }\n\n this._router.navigate([ApplicationRoutes.signin], {\n queryParams: {\n ...params,\n },\n })\n })\n }\n}\n", + "sourceCode": "import { Component, Input } from '@angular/core'\n\nimport { BaseStepDirective } from '../BaseStep'\nimport { PlatformInfoService } from 'src/app/cdk/platform-info'\nimport { first } from 'rxjs/operators'\nimport { Router } from '@angular/router'\nimport { ApplicationRoutes } from 'src/app/constants'\n\nimport { ReactivationLocal } from '../../../types/reactivation.local'\n\n@Component({\n selector: 'app-step-a',\n templateUrl: './step-a.component.html',\n styleUrls: ['./step-a.component.scss'],\n preserveWhitespaces: true,\n})\nexport class StepAComponent extends BaseStepDirective {\n @Input() reactivation: ReactivationLocal\n\n constructor(private _platform: PlatformInfoService, private _router: Router) {\n super()\n }\n infoSiteBaseUrl = environment.INFO_SITE\n\n goBack() {\n this._platform\n .get()\n .pipe(first())\n .subscribe((platform) => {\n if (platform.social) {\n this._router.navigate([ApplicationRoutes.social], {\n queryParams: {\n ...platform.queryParameters,\n },\n })\n } else if (platform.institutional) {\n this._router.navigate([ApplicationRoutes.institutionalLinking], {\n queryParams: {\n ...platform.queryParameters,\n },\n })\n } else {\n this._router.navigate([ApplicationRoutes.signin], {\n queryParams: {\n ...platform.queryParameters,\n },\n })\n }\n })\n }\n\n signIn() {\n this._platform\n .get()\n .pipe(first())\n .subscribe((platform) => {\n const params = JSON.parse(JSON.stringify(platform.queryParameters))\n if (params['email']) {\n delete params['email']\n }\n if (params['orcid']) {\n delete params['orcid']\n }\n\n if (params['show_login']) {\n delete params['show_login']\n }\n\n this._router.navigate([ApplicationRoutes.signin], {\n queryParams: {\n ...params,\n },\n })\n })\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -77539,7 +77539,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, Input, OnDestroy, OnInit } from '@angular/core'\nimport { Subject } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { RecordService } from 'src/app/core/record/record.service'\nimport { UserInfo } from 'src/app/types'\nimport { environment } from 'src/environments/environment'\n\n@Component({\n selector: 'app-top-bar-record-issues',\n templateUrl: './top-bar-record-issues.component.html',\n styleUrls: ['./top-bar-record-issues.component.scss'],\n preserveWhitespaces: true,\n})\nexport class TopBarRecordIssuesComponent implements OnInit, OnDestroy {\n @Input() isPublicRecord: string\n $destroy: Subject = new Subject()\n userInfo: UserInfo\n baseUrl = environment.BASE_URL\n\n constructor(private _record: RecordService) {}\n\n ngOnInit(): void {\n this._record\n .getRecord({\n publicRecordId: this.isPublicRecord || undefined,\n })\n .pipe(takeUntil(this.$destroy))\n .subscribe((userRecord) => {\n this.userInfo = userRecord?.userInfo\n })\n }\n ngOnDestroy() {\n this.$destroy.next(true)\n this.$destroy.unsubscribe()\n }\n}\n", + "sourceCode": "import { Component, Input, OnDestroy, OnInit } from '@angular/core'\nimport { Subject } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { RecordService } from 'src/app/core/record/record.service'\nimport { UserInfo } from 'src/app/types'\n\n\n@Component({\n selector: 'app-top-bar-record-issues',\n templateUrl: './top-bar-record-issues.component.html',\n styleUrls: ['./top-bar-record-issues.component.scss'],\n preserveWhitespaces: true,\n})\nexport class TopBarRecordIssuesComponent implements OnInit, OnDestroy {\n @Input() isPublicRecord: string\n $destroy: Subject = new Subject()\n userInfo: UserInfo\n baseUrl = environment.BASE_URL\n\n constructor(private _record: RecordService) {}\n\n ngOnInit(): void {\n this._record\n .getRecord({\n publicRecordId: this.isPublicRecord || undefined,\n })\n .pipe(takeUntil(this.$destroy))\n .subscribe((userRecord) => {\n this.userInfo = userRecord?.userInfo\n })\n }\n ngOnDestroy() {\n this.$destroy.next(true)\n this.$destroy.unsubscribe()\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -79911,7 +79911,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import { Component, OnInit, Inject } from '@angular/core'\nimport { UserService } from 'src/app/core'\nimport { environment } from 'src/environments/environment'\nimport { UserInfo } from 'src/app/types'\nimport { PlatformInfoService, PlatformInfo } from 'src/app/cdk/platform-info'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { Router } from '@angular/router'\nimport { ApplicationRoutes } from 'src/app/constants'\nimport { TogglzService } from 'src/app/core/togglz/togglz.service'\nimport { InboxService } from '../../core/inbox/inbox.service'\nimport { first } from 'rxjs/operators'\n\n@Component({\n selector: 'app-user-menu',\n templateUrl: './user-menu.component.html',\n styleUrls: [\n './user-menu.component.scss-theme.scss',\n './user-menu.component.scss',\n ],\n})\nexport class UserMenuComponent implements OnInit {\n state = false\n userInfo: UserInfo\n displayName: string\n platform: PlatformInfo\n labelSigninRegister = $localize`:@@layout.ariaLabelSigninRegister:Sign in to ORCID or register for your ORCID iD`\n labelUserMenu = $localize`:@@layout.ariaLabelUserMenu:User menu`\n isAccountDelegate: boolean\n restrictedDelegators: boolean\n inboxUnread = 0\n newDeveloperTools: boolean\n\n constructor(\n private _router: Router,\n private _userInfo: UserService,\n @Inject(WINDOW) private window: Window,\n _platform: PlatformInfoService,\n private _inboxService: InboxService,\n private _togglz: TogglzService\n ) {\n _userInfo.getUserSession().subscribe((data) => {\n if (data.loggedIn) {\n this.userInfo = data.userInfo\n this.displayName = data.displayName\n this.isAccountDelegate =\n data.userInfo.REAL_USER_ORCID === data.userInfo.EFFECTIVE_USER_ORCID\n } else {\n this.userInfo = null\n this.displayName = null\n }\n })\n _platform.get().subscribe((data) => {\n this.platform = data\n })\n }\n\n ngOnInit() {\n this._togglz\n .getStateOf('NEW_DEVELOPER_TOOLS')\n .subscribe((value) => (this.newDeveloperTools = value))\n this._togglz\n .getStateOf('RESTRICTED_DELEGATORS')\n .subscribe((value) => (this.restrictedDelegators = value))\n this._inboxService\n .retrieveUnreadCount()\n .pipe(first())\n .subscribe((inboxUnread) => (this.inboxUnread = inboxUnread))\n }\n\n goto(url) {\n if (url === 'my-orcid') {\n this._router.navigate([ApplicationRoutes.myOrcid])\n } else if (url === 'signin') {\n this._router.navigate([ApplicationRoutes.signin])\n } else if (url === 'inbox') {\n this._router.navigate([ApplicationRoutes.inbox])\n } else if (url === 'account') {\n this._router.navigate([ApplicationRoutes.account])\n } else if (url === 'trusted-parties') {\n this._router.navigate([ApplicationRoutes.trustedParties])\n } else if (url === 'trusted-parties') {\n this._router.navigate([ApplicationRoutes.trustedParties])\n } else if (url === 'developer-tools' && this.newDeveloperTools) {\n this._router.navigate([ApplicationRoutes.developerTools])\n } else {\n this.window.location.href = environment.BASE_URL + url\n }\n }\n\n navigateTo(val) {\n if (val === '/signout' && environment.proxyMode) {\n this._userInfo.noRedirectLogout().subscribe()\n } else {\n this.window.location.href = val\n }\n }\n}\n", + "sourceCode": "import { Component, OnInit, Inject } from '@angular/core'\nimport { UserService } from 'src/app/core'\n\nimport { UserInfo } from 'src/app/types'\nimport { PlatformInfoService, PlatformInfo } from 'src/app/cdk/platform-info'\nimport { WINDOW } from 'src/app/cdk/window'\nimport { Router } from '@angular/router'\nimport { ApplicationRoutes } from 'src/app/constants'\nimport { TogglzService } from 'src/app/core/togglz/togglz.service'\nimport { InboxService } from '../../core/inbox/inbox.service'\nimport { first } from 'rxjs/operators'\n\n@Component({\n selector: 'app-user-menu',\n templateUrl: './user-menu.component.html',\n styleUrls: [\n './user-menu.component.scss-theme.scss',\n './user-menu.component.scss',\n ],\n})\nexport class UserMenuComponent implements OnInit {\n state = false\n userInfo: UserInfo\n displayName: string\n platform: PlatformInfo\n labelSigninRegister = $localize`:@@layout.ariaLabelSigninRegister:Sign in to ORCID or register for your ORCID iD`\n labelUserMenu = $localize`:@@layout.ariaLabelUserMenu:User menu`\n isAccountDelegate: boolean\n restrictedDelegators: boolean\n inboxUnread = 0\n newDeveloperTools: boolean\n\n constructor(\n private _router: Router,\n private _userInfo: UserService,\n @Inject(WINDOW) private window: Window,\n _platform: PlatformInfoService,\n private _inboxService: InboxService,\n private _togglz: TogglzService\n ) {\n _userInfo.getUserSession().subscribe((data) => {\n if (data.loggedIn) {\n this.userInfo = data.userInfo\n this.displayName = data.displayName\n this.isAccountDelegate =\n data.userInfo.REAL_USER_ORCID === data.userInfo.EFFECTIVE_USER_ORCID\n } else {\n this.userInfo = null\n this.displayName = null\n }\n })\n _platform.get().subscribe((data) => {\n this.platform = data\n })\n }\n\n ngOnInit() {\n this._togglz\n .getStateOf('NEW_DEVELOPER_TOOLS')\n .subscribe((value) => (this.newDeveloperTools = value))\n this._togglz\n .getStateOf('RESTRICTED_DELEGATORS')\n .subscribe((value) => (this.restrictedDelegators = value))\n this._inboxService\n .retrieveUnreadCount()\n .pipe(first())\n .subscribe((inboxUnread) => (this.inboxUnread = inboxUnread))\n }\n\n goto(url) {\n if (url === 'my-orcid') {\n this._router.navigate([ApplicationRoutes.myOrcid])\n } else if (url === 'signin') {\n this._router.navigate([ApplicationRoutes.signin])\n } else if (url === 'inbox') {\n this._router.navigate([ApplicationRoutes.inbox])\n } else if (url === 'account') {\n this._router.navigate([ApplicationRoutes.account])\n } else if (url === 'trusted-parties') {\n this._router.navigate([ApplicationRoutes.trustedParties])\n } else if (url === 'trusted-parties') {\n this._router.navigate([ApplicationRoutes.trustedParties])\n } else if (url === 'developer-tools' && this.newDeveloperTools) {\n this._router.navigate([ApplicationRoutes.developerTools])\n } else {\n this.window.location.href = environment.BASE_URL + url\n }\n }\n\n navigateTo(val) {\n if (val === '/signout' && environment.proxyMode) {\n this._userInfo.noRedirectLogout().subscribe()\n } else {\n this.window.location.href = val\n }\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -82794,7 +82794,7 @@ "description": "", "rawdescription": "\n", "type": "component", - "sourceCode": "import {\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n OnDestroy,\n OnInit,\n QueryList,\n ViewChildren,\n ViewContainerRef,\n} from '@angular/core'\nimport {\n AbstractControl,\n ControlContainer,\n FormGroupDirective,\n UntypedFormArray,\n UntypedFormBuilder,\n UntypedFormGroup,\n Validators,\n} from '@angular/forms'\nimport { UserRecord } from '../../../types/record.local'\nimport { takeUntil, tap } from 'rxjs/operators'\nimport { PlatformInfoService } from '../../../cdk/platform-info'\nimport { Subject } from 'rxjs'\nimport { Contributor } from '../../../types'\nimport { environment } from 'src/environments/environment'\nimport { RecordWorksService } from '../../../core/record-works/record-works.service'\nimport { RecordAffiliationService } from '../../../core/record-affiliations/record-affiliations.service'\nimport { EmploymentsEndpoint } from '../../../types/record-affiliation.endpoint'\nimport { unique } from '../../../shared/validators/unique/unique.validator'\nimport { ContributionRoles } from '../../../types/works.endpoint'\nimport { MAX_LENGTH_LESS_THAN_ONE_HUNDRED } from '../../../constants'\nimport { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'\nimport { WINDOW } from '../../../cdk/window'\nimport { TogglzService } from '../../../core/togglz/togglz.service'\nimport { MatSelect } from '@angular/material/select'\n\n@Component({\n selector: 'app-work-contributors',\n templateUrl: './work-contributors.component.html',\n styleUrls: [\n './work-contributors.component.scss',\n './work-contributors.component.scss-theme.scss',\n ],\n viewProviders: [\n { provide: ControlContainer, useExisting: FormGroupDirective },\n ],\n})\nexport class WorkContributorsComponent implements OnInit, OnDestroy {\n @ViewChildren('roleSelect', { read: ViewContainerRef })\n inputs: QueryList\n\n deleteLabel = $localize`:@@shared.deleteActivityAriaLabel:Delete`\n @ViewChildren('contributorNames')\n contributorNamesInputs: QueryList\n\n $destroy: Subject = new Subject()\n\n @Input() contributors: Contributor[]\n @Input() userRecord: UserRecord\n @Input() recordHolderAsContributor: boolean\n\n affiliation: string\n id: string\n isMobile: boolean\n screenDirection = 'ltr'\n roles: string\n maxNumberOfContributors = 49\n maxNumberOfContributorsSummary = 10\n privateName = 'Name is private'\n togglzAddOtherContributors: boolean\n\n contributionRoles = ContributionRoles\n recordHolderContribution: Contributor\n\n ngOrcidSelectRole = $localize`:@@works.pleaseSelectRole:Please select a role`\n ngOrcidSelectRoleAriaLabel = $localize`:@@works.pleaseSelectRoleAriaLabel:Select your contributor to this work`\n\n ngOrcidContributorName = $localize`:@@works.contributorName:Contributor name`\n\n constructor(\n _togglz: TogglzService,\n @Inject(WINDOW) private window: Window,\n private _changeDetectorRef: ChangeDetectorRef,\n private formBuilder: UntypedFormBuilder,\n private parentForm: FormGroupDirective,\n private platform: PlatformInfoService,\n private workService: RecordWorksService,\n private affiliationService: RecordAffiliationService\n ) {\n _togglz\n .getStateOf('ADD_OTHER_WORK_CONTRIBUTORS')\n .subscribe((value) => (this.togglzAddOtherContributors = value))\n }\n\n get contributorsFormArray() {\n return this.parentForm.control.controls['contributors'] as UntypedFormArray\n }\n\n get rolesRecordHolderFormArray() {\n return this.parentForm.control.controls['roles'] as UntypedFormArray\n }\n\n ngOnInit(): void {\n // EFFECTIVE_USER_ORCID keeps the ORCID id of the user you are on.\n // REAL_USER_ORCID will contain the orcid id of a delegator when on delegation mode.\n this.id = this.userRecord?.userInfo?.EFFECTIVE_USER_ORCID\n this.platform\n .get()\n .pipe(takeUntil(this.$destroy))\n .subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n this.screenDirection = platform.screenDirection\n })\n if (this.userRecord?.affiliations?.length > 0) {\n this.getEmploymentsFromAffiliations(this.userRecord?.affiliations)\n } else {\n this.affiliationService\n .getEmployments()\n .pipe(\n tap((employments) => {\n this.getEmployments(employments)\n })\n )\n .subscribe()\n }\n this.initializeFormArray()\n }\n\n addAnotherContributor(addAnotherContributorStatus: boolean): void {\n if (!addAnotherContributorStatus) {\n this.contributorsFormArray.push(this.getContributorForm())\n }\n this._changeDetectorRef.detectChanges()\n\n this.contributorNamesInputs.last.nativeElement.focus()\n }\n\n addRecordHolderAsContributor(): void {\n this.roles = ''\n this.parentForm.control.setControl(\n 'roles',\n new UntypedFormArray([\n this.getRoleForm(\n this.workService.getContributionRoleByKey('no specified role').key,\n false\n ),\n ])\n )\n this.contributorsFormArray.push(this.getRecordHolder())\n this.rolesValuesChange()\n }\n\n rolesFormArray(contributor): AbstractControl[] {\n return (contributor.get('roles') as UntypedFormArray).controls\n }\n\n addAnotherRole(contributor, contributorIndex?): void {\n ;(contributor.get('roles') as UntypedFormArray).push(\n this.getRoleForm(\n this.workService.getContributionRoleByKey('no specified role').key,\n false\n )\n )\n this._changeDetectorRef.detectChanges()\n if (contributorIndex) {\n // Find las input with id contributor and focus on it\n const contributorIndexInputs = this.inputs.toArray().filter((input) => {\n // Get input native element\n const nativeElement = ((input as any).element as ElementRef)\n .nativeElement\n\n // Check if nativeElement has class\n if (\n nativeElement.classList.contains(\n 'contributor-role-' + contributorIndex\n )\n ) {\n return input\n }\n return false\n })\n ;(\n contributorIndexInputs[contributorIndexInputs.length - 1] as any\n ).element.nativeElement.focus()\n }\n }\n\n deleteContributor(contributorIndex: number): void {\n if (\n this.contributorsFormArray\n .at(contributorIndex)\n .get(['contributorOrcid', 'path'])?.value === this.id\n ) {\n this.parentForm.control.setControl('roles', new UntypedFormArray([]))\n }\n this.contributorsFormArray.removeAt(contributorIndex)\n }\n\n deleteRole(contributor, roleIndex: number): void {\n ;(contributor.get('roles') as UntypedFormArray).removeAt(roleIndex)\n if (roleIndex === 0 && this.roles.length === 0) {\n this.addAnotherRole(contributor)\n }\n }\n\n drop(event: CdkDragDrop) {\n moveItemInArray(\n this.contributorsFormArray.controls,\n event.previousIndex,\n event.currentIndex\n )\n }\n\n private initializeFormArray(): void {\n this.recordHolderContribution = this.getRecordHolderContribution()\n this.parentForm.control.setControl('contributors', new UntypedFormArray([]))\n const contributorsFormArray = this.parentForm.control.get(\n 'contributors'\n ) as UntypedFormArray\n\n if (this.togglzAddOtherContributors && this.contributors?.length > 0) {\n if (!this.recordHolderContribution && !this.recordHolderAsContributor) {\n this.addRecordHolderAsContributor()\n }\n this.contributors.forEach((contributor) => {\n contributorsFormArray.push(\n this.getContributorForm(\n contributor?.creditName?.content,\n contributor?.contributorOrcid?.path\n ? contributor?.contributorOrcid?.path\n : null,\n contributor?.contributorOrcid?.uri\n ? contributor?.contributorOrcid?.uri\n : null,\n contributor.rolesAndSequences.map((role) => role.contributorRole),\n true\n )\n )\n })\n } else {\n if (!this.recordHolderAsContributor) {\n this.addRecordHolderAsContributor()\n }\n }\n this.roles = this.getDisabledRoles()?.join(', ')\n this.rolesValuesChange()\n this._changeDetectorRef.detectChanges()\n }\n\n private rolesValuesChange(): void {\n this.rolesRecordHolderFormArray?.valueChanges.subscribe(() => {\n this.roles = [\n ...this.getDisabledRoles(),\n ...this.getEnabledRoles(),\n ]?.join(', ')\n })\n }\n\n private getContributorForm(\n name?: string,\n orcid?: string,\n uri?: string,\n roles?: string[],\n disabled?: boolean\n ): UntypedFormGroup {\n const contributor = this.formBuilder.group({\n creditName: [\n {\n value: name ? name : '',\n disabled,\n },\n [\n Validators.required,\n Validators.maxLength(MAX_LENGTH_LESS_THAN_ONE_HUNDRED),\n ],\n ],\n contributorOrcid: this.formBuilder.group({\n path: [orcid ? orcid : null],\n uri: [\n uri ? uri : orcid ? `https:${environment.BASE_URL}${orcid}` : null,\n ],\n }),\n roles: new UntypedFormArray([]),\n })\n const rolesFormArray = contributor.controls.roles as UntypedFormArray\n if (roles?.length > 0) {\n roles.forEach((role) => {\n if (role) {\n const r = this.workService.getContributionRoleByKey(role)?.key\n rolesFormArray.push(this.getRoleForm(r ? r : role, disabled))\n }\n })\n } else {\n if (!disabled) {\n rolesFormArray.push(\n this.getRoleForm(\n this.workService.getContributionRoleByKey('no specified role').key,\n false\n )\n )\n }\n }\n return contributor\n }\n\n private getRoleForm(role?: string, disabled?: boolean): UntypedFormGroup {\n return this.formBuilder.group({\n role: [\n {\n value: role ? role.toLowerCase() : '',\n disabled,\n },\n [unique('role', 'no specified role')],\n ],\n })\n }\n\n private getDisabledRoles(): string[] {\n return this.rolesRecordHolderFormArray?.controls\n .filter((formGroup) => formGroup.disabled)\n .map((formGroup) => {\n const role = formGroup?.value?.role\n const translation =\n this.workService.getContributionRoleByKey(role)?.translation\n return translation\n ? translation\n : role.charAt(0).toUpperCase() + role.slice(1)\n })\n }\n\n private getEnabledRoles(): string[] {\n return this.rolesRecordHolderFormArray?.controls\n .filter((formGroup) => !formGroup.disabled && formGroup?.value?.role)\n .map(\n (formGroup) =>\n this.workService.getContributionRoleByKey(formGroup?.value?.role)\n .translation\n )\n }\n\n private getCreditNameFromUserRecord(): string {\n const creditName = this.userRecord?.names?.creditName?.value\n const givenNames = this.userRecord?.names?.givenNames?.value\n const familyName = this.userRecord?.names?.familyName?.value\n\n if (creditName) {\n return creditName\n } else {\n return familyName ? `${givenNames} ${familyName}` : givenNames\n }\n }\n\n private getEmployments(employments: EmploymentsEndpoint): void {\n this.affiliation = employments.employmentGroups\n ?.map((employmentGroup) =>\n employmentGroup.activities\n .filter((activity) => !activity?.endDate?.year)\n .map((activity) => activity.organization?.name)\n ?.join(', ')\n )\n .filter((affiliation) => affiliation.length > 0)\n .join(', ')\n }\n\n private getEmploymentsFromAffiliations(affiliations): void {\n this.affiliation = affiliations\n ?.map((affiliationUIGroup) =>\n affiliationUIGroup.affiliationGroup\n .filter(\n (affiliation) =>\n !affiliation.defaultAffiliation?.endDate?.year &&\n affiliation.defaultAffiliation?.affiliationType?.value ===\n 'employment'\n )\n .map(\n (affiliation) =>\n affiliation.defaultAffiliation?.affiliationName?.value\n )\n ?.join(', ')\n )\n .filter((affiliation) => affiliation.length > 0)\n .join(', ')\n }\n\n private getRecordHolderContribution(): Contributor {\n return this.contributors?.find(\n (c) => c?.contributorOrcid?.path && c?.contributorOrcid?.path === this.id\n )\n }\n\n private getRecordHolder(): UntypedFormGroup {\n const orcid = this.recordHolderContribution?.contributorOrcid?.path\n ? this.recordHolderContribution?.contributorOrcid?.path\n : this.id\n const name = this.recordHolderContribution\n ? this.recordHolderContribution?.creditName?.content\n : this.getCreditNameFromUserRecord()\n const uri = this.recordHolderContribution?.contributorOrcid?.uri\n ? this.recordHolderContribution?.contributorOrcid?.uri\n : `https:${environment.BASE_URL}${orcid}`\n // todo validate if its necessary\n if (!this.recordHolderContribution) {\n this.recordHolderContribution = {\n contributorOrcid: {\n path: this.id,\n uri: uri,\n },\n creditName: {\n content: name,\n },\n } as Contributor\n }\n\n return this.getContributorForm(name, orcid, uri, [], true)\n }\n\n ngOnDestroy() {\n this.$destroy.next(true)\n this.$destroy.unsubscribe()\n }\n\n goto(url: string) {\n this.window.open(url)\n }\n}\n", + "sourceCode": "import {\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n OnDestroy,\n OnInit,\n QueryList,\n ViewChildren,\n ViewContainerRef,\n} from '@angular/core'\nimport {\n AbstractControl,\n ControlContainer,\n FormGroupDirective,\n UntypedFormArray,\n UntypedFormBuilder,\n UntypedFormGroup,\n Validators,\n} from '@angular/forms'\nimport { UserRecord } from '../../../types/record.local'\nimport { takeUntil, tap } from 'rxjs/operators'\nimport { PlatformInfoService } from '../../../cdk/platform-info'\nimport { Subject } from 'rxjs'\nimport { Contributor } from '../../../types'\n\nimport { RecordWorksService } from '../../../core/record-works/record-works.service'\nimport { RecordAffiliationService } from '../../../core/record-affiliations/record-affiliations.service'\nimport { EmploymentsEndpoint } from '../../../types/record-affiliation.endpoint'\nimport { unique } from '../../../shared/validators/unique/unique.validator'\nimport { ContributionRoles } from '../../../types/works.endpoint'\nimport { MAX_LENGTH_LESS_THAN_ONE_HUNDRED } from '../../../constants'\nimport { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'\nimport { WINDOW } from '../../../cdk/window'\nimport { TogglzService } from '../../../core/togglz/togglz.service'\nimport { MatSelect } from '@angular/material/select'\n\n@Component({\n selector: 'app-work-contributors',\n templateUrl: './work-contributors.component.html',\n styleUrls: [\n './work-contributors.component.scss',\n './work-contributors.component.scss-theme.scss',\n ],\n viewProviders: [\n { provide: ControlContainer, useExisting: FormGroupDirective },\n ],\n})\nexport class WorkContributorsComponent implements OnInit, OnDestroy {\n @ViewChildren('roleSelect', { read: ViewContainerRef })\n inputs: QueryList\n\n deleteLabel = $localize`:@@shared.deleteActivityAriaLabel:Delete`\n @ViewChildren('contributorNames')\n contributorNamesInputs: QueryList\n\n $destroy: Subject = new Subject()\n\n @Input() contributors: Contributor[]\n @Input() userRecord: UserRecord\n @Input() recordHolderAsContributor: boolean\n\n affiliation: string\n id: string\n isMobile: boolean\n screenDirection = 'ltr'\n roles: string\n maxNumberOfContributors = 49\n maxNumberOfContributorsSummary = 10\n privateName = 'Name is private'\n togglzAddOtherContributors: boolean\n\n contributionRoles = ContributionRoles\n recordHolderContribution: Contributor\n\n ngOrcidSelectRole = $localize`:@@works.pleaseSelectRole:Please select a role`\n ngOrcidSelectRoleAriaLabel = $localize`:@@works.pleaseSelectRoleAriaLabel:Select your contributor to this work`\n\n ngOrcidContributorName = $localize`:@@works.contributorName:Contributor name`\n\n constructor(\n _togglz: TogglzService,\n @Inject(WINDOW) private window: Window,\n private _changeDetectorRef: ChangeDetectorRef,\n private formBuilder: UntypedFormBuilder,\n private parentForm: FormGroupDirective,\n private platform: PlatformInfoService,\n private workService: RecordWorksService,\n private affiliationService: RecordAffiliationService\n ) {\n _togglz\n .getStateOf('ADD_OTHER_WORK_CONTRIBUTORS')\n .subscribe((value) => (this.togglzAddOtherContributors = value))\n }\n\n get contributorsFormArray() {\n return this.parentForm.control.controls['contributors'] as UntypedFormArray\n }\n\n get rolesRecordHolderFormArray() {\n return this.parentForm.control.controls['roles'] as UntypedFormArray\n }\n\n ngOnInit(): void {\n // EFFECTIVE_USER_ORCID keeps the ORCID id of the user you are on.\n // REAL_USER_ORCID will contain the orcid id of a delegator when on delegation mode.\n this.id = this.userRecord?.userInfo?.EFFECTIVE_USER_ORCID\n this.platform\n .get()\n .pipe(takeUntil(this.$destroy))\n .subscribe((platform) => {\n this.isMobile = platform.columns4 || platform.columns8\n this.screenDirection = platform.screenDirection\n })\n if (this.userRecord?.affiliations?.length > 0) {\n this.getEmploymentsFromAffiliations(this.userRecord?.affiliations)\n } else {\n this.affiliationService\n .getEmployments()\n .pipe(\n tap((employments) => {\n this.getEmployments(employments)\n })\n )\n .subscribe()\n }\n this.initializeFormArray()\n }\n\n addAnotherContributor(addAnotherContributorStatus: boolean): void {\n if (!addAnotherContributorStatus) {\n this.contributorsFormArray.push(this.getContributorForm())\n }\n this._changeDetectorRef.detectChanges()\n\n this.contributorNamesInputs.last.nativeElement.focus()\n }\n\n addRecordHolderAsContributor(): void {\n this.roles = ''\n this.parentForm.control.setControl(\n 'roles',\n new UntypedFormArray([\n this.getRoleForm(\n this.workService.getContributionRoleByKey('no specified role').key,\n false\n ),\n ])\n )\n this.contributorsFormArray.push(this.getRecordHolder())\n this.rolesValuesChange()\n }\n\n rolesFormArray(contributor): AbstractControl[] {\n return (contributor.get('roles') as UntypedFormArray).controls\n }\n\n addAnotherRole(contributor, contributorIndex?): void {\n ;(contributor.get('roles') as UntypedFormArray).push(\n this.getRoleForm(\n this.workService.getContributionRoleByKey('no specified role').key,\n false\n )\n )\n this._changeDetectorRef.detectChanges()\n if (contributorIndex) {\n // Find las input with id contributor and focus on it\n const contributorIndexInputs = this.inputs.toArray().filter((input) => {\n // Get input native element\n const nativeElement = ((input as any).element as ElementRef)\n .nativeElement\n\n // Check if nativeElement has class\n if (\n nativeElement.classList.contains(\n 'contributor-role-' + contributorIndex\n )\n ) {\n return input\n }\n return false\n })\n ;(\n contributorIndexInputs[contributorIndexInputs.length - 1] as any\n ).element.nativeElement.focus()\n }\n }\n\n deleteContributor(contributorIndex: number): void {\n if (\n this.contributorsFormArray\n .at(contributorIndex)\n .get(['contributorOrcid', 'path'])?.value === this.id\n ) {\n this.parentForm.control.setControl('roles', new UntypedFormArray([]))\n }\n this.contributorsFormArray.removeAt(contributorIndex)\n }\n\n deleteRole(contributor, roleIndex: number): void {\n ;(contributor.get('roles') as UntypedFormArray).removeAt(roleIndex)\n if (roleIndex === 0 && this.roles.length === 0) {\n this.addAnotherRole(contributor)\n }\n }\n\n drop(event: CdkDragDrop) {\n moveItemInArray(\n this.contributorsFormArray.controls,\n event.previousIndex,\n event.currentIndex\n )\n }\n\n private initializeFormArray(): void {\n this.recordHolderContribution = this.getRecordHolderContribution()\n this.parentForm.control.setControl('contributors', new UntypedFormArray([]))\n const contributorsFormArray = this.parentForm.control.get(\n 'contributors'\n ) as UntypedFormArray\n\n if (this.togglzAddOtherContributors && this.contributors?.length > 0) {\n if (!this.recordHolderContribution && !this.recordHolderAsContributor) {\n this.addRecordHolderAsContributor()\n }\n this.contributors.forEach((contributor) => {\n contributorsFormArray.push(\n this.getContributorForm(\n contributor?.creditName?.content,\n contributor?.contributorOrcid?.path\n ? contributor?.contributorOrcid?.path\n : null,\n contributor?.contributorOrcid?.uri\n ? contributor?.contributorOrcid?.uri\n : null,\n contributor.rolesAndSequences.map((role) => role.contributorRole),\n true\n )\n )\n })\n } else {\n if (!this.recordHolderAsContributor) {\n this.addRecordHolderAsContributor()\n }\n }\n this.roles = this.getDisabledRoles()?.join(', ')\n this.rolesValuesChange()\n this._changeDetectorRef.detectChanges()\n }\n\n private rolesValuesChange(): void {\n this.rolesRecordHolderFormArray?.valueChanges.subscribe(() => {\n this.roles = [\n ...this.getDisabledRoles(),\n ...this.getEnabledRoles(),\n ]?.join(', ')\n })\n }\n\n private getContributorForm(\n name?: string,\n orcid?: string,\n uri?: string,\n roles?: string[],\n disabled?: boolean\n ): UntypedFormGroup {\n const contributor = this.formBuilder.group({\n creditName: [\n {\n value: name ? name : '',\n disabled,\n },\n [\n Validators.required,\n Validators.maxLength(MAX_LENGTH_LESS_THAN_ONE_HUNDRED),\n ],\n ],\n contributorOrcid: this.formBuilder.group({\n path: [orcid ? orcid : null],\n uri: [\n uri ? uri : orcid ? `https:${environment.BASE_URL}${orcid}` : null,\n ],\n }),\n roles: new UntypedFormArray([]),\n })\n const rolesFormArray = contributor.controls.roles as UntypedFormArray\n if (roles?.length > 0) {\n roles.forEach((role) => {\n if (role) {\n const r = this.workService.getContributionRoleByKey(role)?.key\n rolesFormArray.push(this.getRoleForm(r ? r : role, disabled))\n }\n })\n } else {\n if (!disabled) {\n rolesFormArray.push(\n this.getRoleForm(\n this.workService.getContributionRoleByKey('no specified role').key,\n false\n )\n )\n }\n }\n return contributor\n }\n\n private getRoleForm(role?: string, disabled?: boolean): UntypedFormGroup {\n return this.formBuilder.group({\n role: [\n {\n value: role ? role.toLowerCase() : '',\n disabled,\n },\n [unique('role', 'no specified role')],\n ],\n })\n }\n\n private getDisabledRoles(): string[] {\n return this.rolesRecordHolderFormArray?.controls\n .filter((formGroup) => formGroup.disabled)\n .map((formGroup) => {\n const role = formGroup?.value?.role\n const translation =\n this.workService.getContributionRoleByKey(role)?.translation\n return translation\n ? translation\n : role.charAt(0).toUpperCase() + role.slice(1)\n })\n }\n\n private getEnabledRoles(): string[] {\n return this.rolesRecordHolderFormArray?.controls\n .filter((formGroup) => !formGroup.disabled && formGroup?.value?.role)\n .map(\n (formGroup) =>\n this.workService.getContributionRoleByKey(formGroup?.value?.role)\n .translation\n )\n }\n\n private getCreditNameFromUserRecord(): string {\n const creditName = this.userRecord?.names?.creditName?.value\n const givenNames = this.userRecord?.names?.givenNames?.value\n const familyName = this.userRecord?.names?.familyName?.value\n\n if (creditName) {\n return creditName\n } else {\n return familyName ? `${givenNames} ${familyName}` : givenNames\n }\n }\n\n private getEmployments(employments: EmploymentsEndpoint): void {\n this.affiliation = employments.employmentGroups\n ?.map((employmentGroup) =>\n employmentGroup.activities\n .filter((activity) => !activity?.endDate?.year)\n .map((activity) => activity.organization?.name)\n ?.join(', ')\n )\n .filter((affiliation) => affiliation.length > 0)\n .join(', ')\n }\n\n private getEmploymentsFromAffiliations(affiliations): void {\n this.affiliation = affiliations\n ?.map((affiliationUIGroup) =>\n affiliationUIGroup.affiliationGroup\n .filter(\n (affiliation) =>\n !affiliation.defaultAffiliation?.endDate?.year &&\n affiliation.defaultAffiliation?.affiliationType?.value ===\n 'employment'\n )\n .map(\n (affiliation) =>\n affiliation.defaultAffiliation?.affiliationName?.value\n )\n ?.join(', ')\n )\n .filter((affiliation) => affiliation.length > 0)\n .join(', ')\n }\n\n private getRecordHolderContribution(): Contributor {\n return this.contributors?.find(\n (c) => c?.contributorOrcid?.path && c?.contributorOrcid?.path === this.id\n )\n }\n\n private getRecordHolder(): UntypedFormGroup {\n const orcid = this.recordHolderContribution?.contributorOrcid?.path\n ? this.recordHolderContribution?.contributorOrcid?.path\n : this.id\n const name = this.recordHolderContribution\n ? this.recordHolderContribution?.creditName?.content\n : this.getCreditNameFromUserRecord()\n const uri = this.recordHolderContribution?.contributorOrcid?.uri\n ? this.recordHolderContribution?.contributorOrcid?.uri\n : `https:${environment.BASE_URL}${orcid}`\n // todo validate if its necessary\n if (!this.recordHolderContribution) {\n this.recordHolderContribution = {\n contributorOrcid: {\n path: this.id,\n uri: uri,\n },\n creditName: {\n content: name,\n },\n } as Contributor\n }\n\n return this.getContributorForm(name, orcid, uri, [], true)\n }\n\n ngOnDestroy() {\n this.$destroy.next(true)\n this.$destroy.unsubscribe()\n }\n\n goto(url: string) {\n this.window.open(url)\n }\n}\n", "assetsDirs": [], "styleUrlsData": [ { @@ -87231,7 +87231,7 @@ "modifierKind": [121] } ], - "sourceCode": "import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations'\nimport { environment } from 'src/environments/environment'\nimport { EnvironmentBannerModule } from '../app/environment-banner/environment-banner.module'\n\nimport { AppRoutingModule } from './app-routing.module'\nimport { AppComponent } from './app.component'\nimport { CoreModule } from './core/core.module'\nimport { LayoutModule } from './layout/layout.module'\nimport { BidiModule } from '@angular/cdk/bidi'\nimport { PseudoModule } from 'src/locale/i18n.pseudo.component'\nimport { TitleService } from './core/title-service/title.service'\n\n@NgModule({\n declarations: [AppComponent],\n imports: [\n BrowserModule,\n AppRoutingModule,\n CoreModule,\n BrowserAnimationsModule,\n LayoutModule,\n BidiModule,\n PseudoModule, // Remove on angular 10 https://bit.ly/3ezbF4v\n // Environmental dependent modules\n environment.SHOW_TEST_WARNING_BANNER ? EnvironmentBannerModule : [],\n ],\n providers: [TitleService],\n bootstrap: [AppComponent],\n})\nexport class AppModule {\n constructor() {\n this.initializeApp()\n }\n\n private initializeApp() {\n environment.BASE_URL = this.getCurrentDomain()\n }\n\n getCurrentDomain() {\n const port = window.location.port ? ':' + window.location.port : ''\n return '//' + window.location.hostname + port + '/'\n }\n}\n", + "sourceCode": "import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations'\n\nimport { EnvironmentBannerModule } from '../app/environment-banner/environment-banner.module'\n\nimport { AppRoutingModule } from './app-routing.module'\nimport { AppComponent } from './app.component'\nimport { CoreModule } from './core/core.module'\nimport { LayoutModule } from './layout/layout.module'\nimport { BidiModule } from '@angular/cdk/bidi'\nimport { PseudoModule } from 'src/locale/i18n.pseudo.component'\nimport { TitleService } from './core/title-service/title.service'\n\n@NgModule({\n declarations: [AppComponent],\n imports: [\n BrowserModule,\n AppRoutingModule,\n CoreModule,\n BrowserAnimationsModule,\n LayoutModule,\n BidiModule,\n PseudoModule, // Remove on angular 10 https://bit.ly/3ezbF4v\n // Environmental dependent modules\n environment.SHOW_TEST_WARNING_BANNER ? EnvironmentBannerModule : [],\n ],\n providers: [TitleService],\n bootstrap: [AppComponent],\n})\nexport class AppModule {\n constructor() {\n this.initializeApp()\n }\n\n private initializeApp() {\n environment.BASE_URL = this.getCurrentDomain()\n }\n\n getCurrentDomain() {\n const port = window.location.port ? ':' + window.location.port : ''\n return '//' + window.location.hostname + port + '/'\n }\n}\n", "children": [ { "type": "providers", diff --git a/package.json b/package.json index 0d019d25a1..1d1695ddd8 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "build-runtime-env": "ts-node -P scripts/tsconfig.json scripts/runtime-environment-setter.dev-runtime.ts", "lint": "echo 'temporally disable Angular linter to until eslint update'", "e2e": "ng e2e", - "prebuild": "rimraf dist && yarn build:i18n && yarn build:browserslist", + "prebuild": "rimraf dist && yarn build:i18n && yarn build:browserslist && npm run build-runtime-env", "build": "ng build --configuration production --localize", "postbuild": "ts-node -P scripts/tsconfig.json scripts/postbuild.ts", "build:i18n:clone": "ts-node -P scripts/tsconfig.json scripts/properties-clone.postbuild.ts", diff --git a/scripts/runtime-environment-setter.dev-runtime.ts b/scripts/runtime-environment-setter.dev-runtime.ts index f95cb73162..1695f810eb 100644 --- a/scripts/runtime-environment-setter.dev-runtime.ts +++ b/scripts/runtime-environment-setter.dev-runtime.ts @@ -10,14 +10,13 @@ ${runtimeEnvironmentScript()}` const outputPath = path.resolve( __dirname, - '../src/assets/local-dev-environment.js' + '../src/assets/runtime-environment.js' ) fs.writeFileSync(outputPath, scriptContent, { encoding: 'utf8' }) console.log(`Generated: ${outputPath}`) } -console.log('runtime-environment-setter.dev-runtime.ts') if (require.main === module) { main() } diff --git a/scripts/utils.ts b/scripts/utils.ts index 0cb193624e..591b05a01a 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -2,8 +2,8 @@ import { writeFileSync } from 'fs' import * as environmentProduction from '../src/environments/environment.production' import * as environmentQa from '../src/environments/environment.qa' import * as environmentSandbox from '../src/environments/environment.sandbox' -import * as environment4200 from '../src/environments/environment.local-with-proxy' -import * as environmentDev from '../src/environments/environment.local' +import * as environment4200 from '../src/environments/environment.local4200' +import * as environmentDev from '../src/environments/environment.local.dev.orcid.org' export function save(data, options) { writeFileSync(options.file, data, 'utf8') @@ -89,8 +89,11 @@ export function runtimeEnvironmentScript() { } } - var domain = window.location.hostname + window.location.pathname; - var chosenEnv = environmentProduction; // default to production + var domain = + window.location.hostname + + (window.location.port ? ':' + window.location.port : '') + + window.location.pathname + var chosenEnv = environmentProduction; // default to production if (domain.includes('qa.orcid.org')) { chosenEnv = environmentQa; diff --git a/src/app/account-settings/components/dialog-actions-duplicated-merged-confirmed/dialog-actions-duplicated-merged-confirmed.component.ts b/src/app/account-settings/components/dialog-actions-duplicated-merged-confirmed/dialog-actions-duplicated-merged-confirmed.component.ts index a24e42632a..4456611221 100644 --- a/src/app/account-settings/components/dialog-actions-duplicated-merged-confirmed/dialog-actions-duplicated-merged-confirmed.component.ts +++ b/src/app/account-settings/components/dialog-actions-duplicated-merged-confirmed/dialog-actions-duplicated-merged-confirmed.component.ts @@ -4,8 +4,6 @@ import { MatLegacyDialogRef as MatDialogRef, } from '@angular/material/legacy-dialog' import { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated' -import { environment } from 'src/environments/environment' - @Component({ selector: 'app-dialog-actions-duplicated-merged-confirmed', templateUrl: './dialog-actions-duplicated-merged-confirmed.component.html', diff --git a/src/app/account-settings/components/dialog-actions-duplicated/dialog-actions-duplicated.component.ts b/src/app/account-settings/components/dialog-actions-duplicated/dialog-actions-duplicated.component.ts index 509fdcdbe0..7ff89370a7 100644 --- a/src/app/account-settings/components/dialog-actions-duplicated/dialog-actions-duplicated.component.ts +++ b/src/app/account-settings/components/dialog-actions-duplicated/dialog-actions-duplicated.component.ts @@ -5,8 +5,6 @@ import { } from '@angular/material/legacy-dialog' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated' -import { environment } from 'src/environments/environment' - @Component({ selector: 'app-dialog-actions-duplicated', templateUrl: './dialog-actions-duplicated.component.html', diff --git a/src/app/account-settings/components/settings-defaults-language/settings-defaults-language.component.ts b/src/app/account-settings/components/settings-defaults-language/settings-defaults-language.component.ts index a67a6b3af5..68fbc08dd3 100644 --- a/src/app/account-settings/components/settings-defaults-language/settings-defaults-language.component.ts +++ b/src/app/account-settings/components/settings-defaults-language/settings-defaults-language.component.ts @@ -12,7 +12,6 @@ import { Subject } from 'rxjs' import { takeUntil } from 'rxjs/operators' import { WINDOW } from 'src/app/cdk/window' import { LanguageService } from 'src/app/core/language/language.service' -import { environment } from 'src/environments/environment' @Component({ selector: 'app-settings-defaults-language', diff --git a/src/app/account-settings/components/settings-sharing-html-code/settings-sharing-html-code.component.ts b/src/app/account-settings/components/settings-sharing-html-code/settings-sharing-html-code.component.ts index 01f544433f..e3705defbf 100644 --- a/src/app/account-settings/components/settings-sharing-html-code/settings-sharing-html-code.component.ts +++ b/src/app/account-settings/components/settings-sharing-html-code/settings-sharing-html-code.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core' import { take } from 'rxjs/operators' import { UserService } from 'src/app/core' import { UserSession } from 'src/app/types/session.local' -import { environment } from 'src/environments/environment' @Component({ selector: 'app-settings-sharing-html-code', diff --git a/src/app/account-trusted-parties/components/dialog-add-trusted-individuals-your-own-email/dialog-add-trusted-individuals-your-own-email.component.ts b/src/app/account-trusted-parties/components/dialog-add-trusted-individuals-your-own-email/dialog-add-trusted-individuals-your-own-email.component.ts index 54c57fa4da..c1c7757f3b 100644 --- a/src/app/account-trusted-parties/components/dialog-add-trusted-individuals-your-own-email/dialog-add-trusted-individuals-your-own-email.component.ts +++ b/src/app/account-trusted-parties/components/dialog-add-trusted-individuals-your-own-email/dialog-add-trusted-individuals-your-own-email.component.ts @@ -5,7 +5,6 @@ import { } from '@angular/material/legacy-dialog' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { ExpandedSearchResultsContent } from 'src/app/types' -import { environment } from 'src/environments/environment' @Component({ selector: 'app-dialog-add-trusted-individuals-your-own-email', diff --git a/src/app/account-trusted-parties/components/dialog-add-trusted-individuals/dialog-add-trusted-individuals.component.ts b/src/app/account-trusted-parties/components/dialog-add-trusted-individuals/dialog-add-trusted-individuals.component.ts index 85efcdae24..2dce5d1a53 100644 --- a/src/app/account-trusted-parties/components/dialog-add-trusted-individuals/dialog-add-trusted-individuals.component.ts +++ b/src/app/account-trusted-parties/components/dialog-add-trusted-individuals/dialog-add-trusted-individuals.component.ts @@ -5,7 +5,6 @@ import { } from '@angular/material/legacy-dialog' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { ExpandedSearchResultsContent } from 'src/app/types' -import { environment } from 'src/environments/environment' @Component({ selector: 'app-dialog-add-trusted-individuals', diff --git a/src/app/account-trusted-parties/components/dialog-revoke-trusted-individuals/dialog-revoke-trusted-individuals.component.ts b/src/app/account-trusted-parties/components/dialog-revoke-trusted-individuals/dialog-revoke-trusted-individuals.component.ts index e82a8ea66c..92b60965cb 100644 --- a/src/app/account-trusted-parties/components/dialog-revoke-trusted-individuals/dialog-revoke-trusted-individuals.component.ts +++ b/src/app/account-trusted-parties/components/dialog-revoke-trusted-individuals/dialog-revoke-trusted-individuals.component.ts @@ -4,10 +4,7 @@ import { MatLegacyDialogRef as MatDialogRef, } from '@angular/material/legacy-dialog' import { PlatformInfoService } from 'src/app/cdk/platform-info' -import { AccountTrustedIndividualsService } from 'src/app/core/account-trusted-individuals/account-trusted-individuals.service' import { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals' -import { AccountTrustedOrganization } from 'src/app/types/account-trusted-organizations' -import { environment } from 'src/environments/environment' @Component({ selector: 'app-dialog-revoke-trusted-individuals', diff --git a/src/app/account-trusted-parties/components/settings-trusted-individuals-search/settings-trusted-individuals-search.component.ts b/src/app/account-trusted-parties/components/settings-trusted-individuals-search/settings-trusted-individuals-search.component.ts index caf60a2a7f..a2291eabc6 100644 --- a/src/app/account-trusted-parties/components/settings-trusted-individuals-search/settings-trusted-individuals-search.component.ts +++ b/src/app/account-trusted-parties/components/settings-trusted-individuals-search/settings-trusted-individuals-search.component.ts @@ -27,7 +27,6 @@ import { SearchService } from 'src/app/core/search/search.service' import { ExpandedSearchResultsContent, SearchResults } from 'src/app/types' import { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals' import { UserSession } from 'src/app/types/session.local' -import { environment } from 'src/environments/environment' import { DialogAddTrustedIndividualsYourOwnEmailComponent } from '../dialog-add-trusted-individuals-your-own-email/dialog-add-trusted-individuals-your-own-email.component' import { DialogAddTrustedIndividualsComponent } from '../dialog-add-trusted-individuals/dialog-add-trusted-individuals.component' diff --git a/src/app/account-trusted-parties/components/settings-trusted-individuals/settings-trusted-individuals.component.ts b/src/app/account-trusted-parties/components/settings-trusted-individuals/settings-trusted-individuals.component.ts index 569ff4f2a4..a441865249 100644 --- a/src/app/account-trusted-parties/components/settings-trusted-individuals/settings-trusted-individuals.component.ts +++ b/src/app/account-trusted-parties/components/settings-trusted-individuals/settings-trusted-individuals.component.ts @@ -5,7 +5,6 @@ import { startWith, switchMap, takeUntil, tap } from 'rxjs/operators' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { AccountTrustedIndividualsService } from 'src/app/core/account-trusted-individuals/account-trusted-individuals.service' import { AccountTrustedIndividual } from 'src/app/types/account-trusted-individuals' -import { environment } from 'src/environments/environment' import { DialogRevokeTrustedIndividualsComponent } from '../dialog-revoke-trusted-individuals/dialog-revoke-trusted-individuals.component' diff --git a/src/app/account-trusted-parties/components/settings-users-that-thrust-you/settings-users-that-thrust-you.component.ts b/src/app/account-trusted-parties/components/settings-users-that-thrust-you/settings-users-that-thrust-you.component.ts index ebb9210f0a..f175d73dbc 100644 --- a/src/app/account-trusted-parties/components/settings-users-that-thrust-you/settings-users-that-thrust-you.component.ts +++ b/src/app/account-trusted-parties/components/settings-users-that-thrust-you/settings-users-that-thrust-you.component.ts @@ -5,7 +5,6 @@ import { takeUntil } from 'rxjs/operators' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { TrustedIndividualsService } from 'src/app/core/trusted-individuals/trusted-individuals.service' import { TrustedIndividuals } from 'src/app/types/trusted-individuals.endpoint' -import { environment } from 'src/environments/environment' @Component({ selector: 'app-settings-users-that-thrust-you', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 25b5173caa..d9dab6fcc9 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core' import { BrowserModule } from '@angular/platform-browser' import { BrowserAnimationsModule } from '@angular/platform-browser/animations' -import { environment } from 'src/environments/environment' import { EnvironmentBannerModule } from '../app/environment-banner/environment-banner.module' import { AppRoutingModule } from './app-routing.module' @@ -25,7 +24,7 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http' BidiModule, PseudoModule, // Remove on angular 10 https://bit.ly/3ezbF4v // Environmental dependent modules - environment.SHOW_TEST_WARNING_BANNER ? EnvironmentBannerModule : [], + EnvironmentBannerModule, ], providers: [ TitleService, diff --git a/src/app/authorize/components/form-authorize/form-authorize.component.ts b/src/app/authorize/components/form-authorize/form-authorize.component.ts index e64cc57cdd..55d70f1054 100644 --- a/src/app/authorize/components/form-authorize/form-authorize.component.ts +++ b/src/app/authorize/components/form-authorize/form-authorize.component.ts @@ -25,7 +25,6 @@ import { Delegator, TrustedIndividuals, } from 'src/app/types/trusted-individuals.endpoint' -import { environment } from 'src/environments/environment' import { GoogleTagManagerService } from '../../../core/google-tag-manager/google-tag-manager.service' import { Title } from '@angular/platform-browser' @@ -41,7 +40,7 @@ import { Title } from '@angular/platform-browser' export class FormAuthorizeComponent implements OnInit, OnDestroy { @Output() redirectUrl = new EventEmitter() @Output() organizationName = new EventEmitter() - environment = environment + environment = runtimeEnvironment $destroy: Subject = new Subject() orcidUrl: string userName: string diff --git a/src/app/cdk/recaptcha/recaptcha.directive.ts b/src/app/cdk/recaptcha/recaptcha.directive.ts index 36188cd0d1..81760664a0 100644 --- a/src/app/cdk/recaptcha/recaptcha.directive.ts +++ b/src/app/cdk/recaptcha/recaptcha.directive.ts @@ -16,7 +16,6 @@ import { } from '@angular/core' import { WINDOW } from '../window' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service' export interface ReCaptchaConfig { diff --git a/src/app/cdk/side-bar/side-bar-id/side-bar-id.component.ts b/src/app/cdk/side-bar/side-bar-id/side-bar-id.component.ts index 48ce9b4da4..3c44ad19c4 100644 --- a/src/app/cdk/side-bar/side-bar-id/side-bar-id.component.ts +++ b/src/app/cdk/side-bar/side-bar-id/side-bar-id.component.ts @@ -2,7 +2,6 @@ import { Component, Inject, Input, OnDestroy, OnInit } from '@angular/core' import { Subject } from 'rxjs' import { takeUntil } from 'rxjs/operators' import { PlatformInfo, PlatformInfoService } from '../../platform-info' -import { environment } from '../../../../environments/environment' import { WINDOW } from '../../window' @Component({ @@ -17,7 +16,7 @@ export class SideBarIdComponent implements OnInit, OnDestroy { labelPreviewRecord = $localize`:@@record.ariaLabelPreviewPublicRecord:Preview the public version of this record (Opens in a new tab)` $destroy: Subject = new Subject() labelPreviewPublicRecord = $localize`:@@record.ariaLabelpreviewPublicRecord:Preview the public version of this record (Opens in a new tab)` - environment = environment + environment = runtimeEnvironment @Input() id: string @Input() privateView = true platform: PlatformInfo diff --git a/src/app/cdk/snackbar/snackbar.service.ts b/src/app/cdk/snackbar/snackbar.service.ts index 3194378398..80e7ad9d17 100644 --- a/src/app/cdk/snackbar/snackbar.service.ts +++ b/src/app/cdk/snackbar/snackbar.service.ts @@ -10,7 +10,6 @@ import { PlatformInfoService } from '../platform-info' import { SnackbarModule } from './snackbar.module' import { SnackbarComponent } from './snackbar/snackbar.component' import { HttpErrorResponse } from '@angular/common/http' -import { environment } from 'src/environments/environment' @Injectable({ providedIn: SnackbarModule, diff --git a/src/app/constants.ts b/src/app/constants.ts index 78f0856c38..7d323ac6f9 100644 --- a/src/app/constants.ts +++ b/src/app/constants.ts @@ -26,7 +26,6 @@ import { AffiliationUIGroup, } from './types/record-affiliation.endpoint' import { WorkBibtexModalComponent } from './record/components/work-stack-group/modals/work-bibtex-modal/work-bibtex-modal.component' -import { environment } from 'src/environments/environment' export { COUNTRY_NAMES_TO_COUNTRY_CODES } from './constants-country-codes' diff --git a/src/app/core/account-actions-deactivate/account-actions-deactivate.service.ts b/src/app/core/account-actions-deactivate/account-actions-deactivate.service.ts index 6ba7097c6d..914f466cf6 100644 --- a/src/app/core/account-actions-deactivate/account-actions-deactivate.service.ts +++ b/src/app/core/account-actions-deactivate/account-actions-deactivate.service.ts @@ -2,7 +2,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http' import { Injectable } from '@angular/core' import { Observable } from 'rxjs' import { catchError, retry } from 'rxjs/operators' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' diff --git a/src/app/core/account-actions-download/account-actions-download.service.ts b/src/app/core/account-actions-download/account-actions-download.service.ts index c9ea608f24..f9b3c79f07 100644 --- a/src/app/core/account-actions-download/account-actions-download.service.ts +++ b/src/app/core/account-actions-download/account-actions-download.service.ts @@ -2,7 +2,6 @@ import { HttpClient } from '@angular/common/http' import { Inject, Injectable } from '@angular/core' import { catchError, retry, tap } from 'rxjs/operators' import { WINDOW } from 'src/app/cdk/window' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' @Injectable({ diff --git a/src/app/core/account-actions-duplicated/account-actions-duplicated.service.ts b/src/app/core/account-actions-duplicated/account-actions-duplicated.service.ts index 177f00ca8e..545810546b 100644 --- a/src/app/core/account-actions-duplicated/account-actions-duplicated.service.ts +++ b/src/app/core/account-actions-duplicated/account-actions-duplicated.service.ts @@ -4,7 +4,6 @@ import { Observable } from 'rxjs' import { catchError, retry } from 'rxjs/operators' import { ERROR_REPORT } from 'src/app/errors' import { DuplicateRemoveEndpoint } from 'src/app/types/account-actions-duplicated' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' diff --git a/src/app/core/account-default-email-frequencies/account-default-email-frequencies.service.ts b/src/app/core/account-default-email-frequencies/account-default-email-frequencies.service.ts index 0f9ee9e0ca..bc54066434 100644 --- a/src/app/core/account-default-email-frequencies/account-default-email-frequencies.service.ts +++ b/src/app/core/account-default-email-frequencies/account-default-email-frequencies.service.ts @@ -3,7 +3,6 @@ import { Injectable } from '@angular/core' import { Observable } from 'rxjs' import { catchError, retry } from 'rxjs/operators' import { AccountDefaultEmailFrequenciesEndpoint } from 'src/app/types/account-default-visibility.endpoint' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' diff --git a/src/app/core/account-default-visibility/account-default-visibility.service.ts b/src/app/core/account-default-visibility/account-default-visibility.service.ts index e1e9411034..4099449d0b 100644 --- a/src/app/core/account-default-visibility/account-default-visibility.service.ts +++ b/src/app/core/account-default-visibility/account-default-visibility.service.ts @@ -3,7 +3,6 @@ import { Injectable } from '@angular/core' import { Observable } from 'rxjs' import { catchError, retry } from 'rxjs/operators' import { VisibilityStrings } from 'src/app/types/common.endpoint' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' @Injectable({ diff --git a/src/app/core/account-security-alternate-sign-in/account-security-alternate-sign-in.service.ts b/src/app/core/account-security-alternate-sign-in/account-security-alternate-sign-in.service.ts index ff0097c907..bd4649d280 100644 --- a/src/app/core/account-security-alternate-sign-in/account-security-alternate-sign-in.service.ts +++ b/src/app/core/account-security-alternate-sign-in/account-security-alternate-sign-in.service.ts @@ -9,7 +9,6 @@ import { SocialAccountId, } from 'src/app/types/account-alternate-sign-in.endpoint' import { Institutional } from 'src/app/types/institutional.endpoint' -import { environment } from 'src/environments/environment' import { DiscoService } from '../disco/disco.service' import { ErrorHandlerService } from '../error-handler/error-handler.service' diff --git a/src/app/core/account-security-password/account-security-password.service.ts b/src/app/core/account-security-password/account-security-password.service.ts index 6af59a6ccc..ae8660f9df 100644 --- a/src/app/core/account-security-password/account-security-password.service.ts +++ b/src/app/core/account-security-password/account-security-password.service.ts @@ -3,7 +3,6 @@ import { Injectable } from '@angular/core' import { Observable } from 'rxjs' import { catchError, retry } from 'rxjs/operators' import { AccountPasswordEndpoint } from 'src/app/types/account-settings-password' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' diff --git a/src/app/core/account-trusted-individuals/account-trusted-individuals.service.ts b/src/app/core/account-trusted-individuals/account-trusted-individuals.service.ts index ab31fac758..48e305715c 100644 --- a/src/app/core/account-trusted-individuals/account-trusted-individuals.service.ts +++ b/src/app/core/account-trusted-individuals/account-trusted-individuals.service.ts @@ -10,7 +10,6 @@ import { AccountTrustedIndividual, PersonDetails, } from 'src/app/types/account-trusted-individuals' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' diff --git a/src/app/core/account-trusted-organizations/account-trusted-organizations.service.ts b/src/app/core/account-trusted-organizations/account-trusted-organizations.service.ts index cacba5050f..e23613cce7 100644 --- a/src/app/core/account-trusted-organizations/account-trusted-organizations.service.ts +++ b/src/app/core/account-trusted-organizations/account-trusted-organizations.service.ts @@ -2,9 +2,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http' import { Injectable } from '@angular/core' import { Observable } from 'rxjs' import { catchError, retry } from 'rxjs/operators' -import { ERROR_REPORT } from 'src/app/errors' import { AccountTrustedOrganization } from 'src/app/types/account-trusted-organizations' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' @Injectable({ diff --git a/src/app/core/announcer/announcer.service.ts b/src/app/core/announcer/announcer.service.ts index 36c55f2544..4834ca64df 100644 --- a/src/app/core/announcer/announcer.service.ts +++ b/src/app/core/announcer/announcer.service.ts @@ -1,7 +1,6 @@ import { LiveAnnouncer } from '@angular/cdk/a11y' import { Injectable } from '@angular/core' import { LegacyPageEvent as PageEvent } from '@angular/material/legacy-paginator' -import { environment } from 'src/environments/environment' @Injectable({ providedIn: 'root', diff --git a/src/app/core/canonocal-url/canonocal-url.service.ts b/src/app/core/canonocal-url/canonocal-url.service.ts index 3d6a75a11a..485f1f5b18 100644 --- a/src/app/core/canonocal-url/canonocal-url.service.ts +++ b/src/app/core/canonocal-url/canonocal-url.service.ts @@ -3,7 +3,6 @@ import { Inject, Injectable } from '@angular/core' import { NavigationEnd, Router } from '@angular/router' import { filter, map } from 'rxjs/operators' import { ORCID_REGEXP } from 'src/app/constants' -import { environment } from 'src/environments/environment' @Injectable({ providedIn: 'root', diff --git a/src/app/core/developer-tools/developer-tools.service.ts b/src/app/core/developer-tools/developer-tools.service.ts index fa69d92f7e..c869753176 100644 --- a/src/app/core/developer-tools/developer-tools.service.ts +++ b/src/app/core/developer-tools/developer-tools.service.ts @@ -5,7 +5,6 @@ import { Client } from 'src/app/types/developer-tools' import { Observable } from 'rxjs' import { retry, catchError } from 'rxjs/operators' import { ERROR_REPORT } from 'src/app/errors' -import { environment } from 'src/environments/environment' @Injectable({ providedIn: 'root', diff --git a/src/app/core/help-hero/help-hero.service.ts b/src/app/core/help-hero/help-hero.service.ts index c6dd11a8ad..872cc4f12d 100644 --- a/src/app/core/help-hero/help-hero.service.ts +++ b/src/app/core/help-hero/help-hero.service.ts @@ -7,7 +7,6 @@ import { NamesEndPoint } from 'src/app/types/record-name.endpoint' import { WorksEndpoint } from 'src/app/types/record-works.endpoint' import { UserRecord } from 'src/app/types/record.local' import { UserInfo } from 'src/app/types/userInfo.endpoint' -import { environment } from 'src/environments/environment' @Injectable({ providedIn: 'root', diff --git a/src/app/core/inbox/inbox.service.ts b/src/app/core/inbox/inbox.service.ts index 0156ebcf75..2220435be3 100644 --- a/src/app/core/inbox/inbox.service.ts +++ b/src/app/core/inbox/inbox.service.ts @@ -4,7 +4,6 @@ import { Observable, ReplaySubject } from 'rxjs' import { catchError, map, switchMap, tap, retry } from 'rxjs/operators' import { AMOUNT_OF_RETRIEVE_NOTIFICATIONS_PER_CALL } from 'src/app/constants' import { ERROR_REPORT } from 'src/app/errors' -import { environment } from 'src/environments/environment' import { InboxNotificationAmended, diff --git a/src/app/core/language/language.service.ts b/src/app/core/language/language.service.ts index f8e072cae3..3430acb243 100644 --- a/src/app/core/language/language.service.ts +++ b/src/app/core/language/language.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core' import { HttpClient } from '@angular/common/http' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' import { retry, catchError, switchMap, tap } from 'rxjs/operators' import { of } from 'rxjs' diff --git a/src/app/core/news/news.service.ts b/src/app/core/news/news.service.ts index 95f5fd916c..7b8dd9a53c 100644 --- a/src/app/core/news/news.service.ts +++ b/src/app/core/news/news.service.ts @@ -3,7 +3,6 @@ import { Injectable } from '@angular/core' import { Observable } from 'rxjs' import { catchError, flatMap, retry } from 'rxjs/operators' import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service' -import { environment } from 'src/environments/environment' import { Parser } from 'xml2js' @Injectable({ diff --git a/src/app/core/observability-events/observability-events.service.ts b/src/app/core/observability-events/observability-events.service.ts index be0768e345..163b5ea363 100644 --- a/src/app/core/observability-events/observability-events.service.ts +++ b/src/app/core/observability-events/observability-events.service.ts @@ -1,6 +1,5 @@ import { Inject, Injectable } from '@angular/core' import { WINDOW } from 'src/app/cdk/window' -import { environment } from 'src/environments/environment' export type JourneyType = 'orcid_registration' | 'orcid_update_emails' @Injectable({ diff --git a/src/app/core/open-graph/open-graph.service.ts b/src/app/core/open-graph/open-graph.service.ts index 7a6e9f9669..2d879af95d 100644 --- a/src/app/core/open-graph/open-graph.service.ts +++ b/src/app/core/open-graph/open-graph.service.ts @@ -2,7 +2,6 @@ import { Injectable } from '@angular/core' import { Meta, Title } from '@angular/platform-browser' import { NamesEndPoint } from 'src/app/types/record-name.endpoint' import { UserRecord } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' import { TitleService } from '../title-service/title.service' @Injectable({ diff --git a/src/app/core/password-recovery/password-recovery.service.ts b/src/app/core/password-recovery/password-recovery.service.ts index b72138c15f..979fe1a664 100644 --- a/src/app/core/password-recovery/password-recovery.service.ts +++ b/src/app/core/password-recovery/password-recovery.service.ts @@ -2,7 +2,6 @@ import { Injectable } from '@angular/core' import { HttpClient, HttpHeaders } from '@angular/common/http' import { ErrorHandlerService } from '../error-handler/error-handler.service' import { PasswordRecovery } from 'src/app/types' -import { environment } from 'src/environments/environment' import { retry, catchError } from 'rxjs/operators' import { ERROR_REPORT } from 'src/app/errors' import { diff --git a/src/app/core/record-affiliations/record-affiliations.service.ts b/src/app/core/record-affiliations/record-affiliations.service.ts index 84401d05b8..99e037dfb1 100644 --- a/src/app/core/record-affiliations/record-affiliations.service.ts +++ b/src/app/core/record-affiliations/record-affiliations.service.ts @@ -10,7 +10,6 @@ import { DisambiguatedOrganization, EmploymentsEndpoint, } from 'src/app/types/record-affiliation.endpoint' -import { environment } from 'src/environments/environment' import { AffiliationsSortService } from '../record-affiliations-sort/record-affiliations-sort.service' import { ErrorHandlerService } from '../error-handler/error-handler.service' diff --git a/src/app/core/record-countries/record-countries.service.ts b/src/app/core/record-countries/record-countries.service.ts index 989fbeef2a..f2560723b2 100644 --- a/src/app/core/record-countries/record-countries.service.ts +++ b/src/app/core/record-countries/record-countries.service.ts @@ -7,7 +7,6 @@ import { SideBarPublicUserRecord, UserRecordOptions, } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' import { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service' diff --git a/src/app/core/record-emails/record-emails.service.ts b/src/app/core/record-emails/record-emails.service.ts index 4e3639e3c3..558c85691f 100644 --- a/src/app/core/record-emails/record-emails.service.ts +++ b/src/app/core/record-emails/record-emails.service.ts @@ -14,7 +14,6 @@ import { ErrorsListResponse, } from 'src/app/types' import { UserRecordOptions } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' import { RecordPublicSideBarService } from '../record-public-side-bar/record-public-side-bar.service' diff --git a/src/app/core/record-fundings/record-fundings.service.ts b/src/app/core/record-fundings/record-fundings.service.ts index 5a3d1cca88..72e19ec77a 100644 --- a/src/app/core/record-fundings/record-fundings.service.ts +++ b/src/app/core/record-fundings/record-fundings.service.ts @@ -4,7 +4,6 @@ import { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs' import { catchError, retry, switchMap, tap } from 'rxjs/operators' import { Funding, FundingGroup } from 'src/app/types/record-funding.endpoint' import { UserRecordOptions } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' import { VisibilityStrings, Organization } from '../../types/common.endpoint' diff --git a/src/app/core/record-person/record-person.service.ts b/src/app/core/record-person/record-person.service.ts index 8ddc444535..f27519055f 100644 --- a/src/app/core/record-person/record-person.service.ts +++ b/src/app/core/record-person/record-person.service.ts @@ -4,7 +4,7 @@ import { Observable, ReplaySubject } from 'rxjs' import { catchError, first, map, retry, switchMap, tap } from 'rxjs/operators' import { Person } from 'src/app/types' import { UserRecordOptions } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' + import { ErrorHandlerService } from '../error-handler/error-handler.service' import { UserService } from '../user/user.service' diff --git a/src/app/core/record-personal-identifiers/record-person-identifier.service.ts b/src/app/core/record-personal-identifiers/record-person-identifier.service.ts index c9114dc77d..39e0b98d44 100644 --- a/src/app/core/record-personal-identifiers/record-person-identifier.service.ts +++ b/src/app/core/record-personal-identifiers/record-person-identifier.service.ts @@ -4,7 +4,7 @@ import { Observable, of, ReplaySubject } from 'rxjs' import { catchError, map, retry, switchMap, tap } from 'rxjs/operators' import { PersonIdentifierEndpoint } from 'src/app/types/record-person-identifier.endpoint' import { UserRecordOptions } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' + import { ErrorHandlerService } from '../error-handler/error-handler.service' import { RecordPersonService } from '../record-person/record-person.service' diff --git a/src/app/core/record-public-side-bar/record-public-side-bar.service.ts b/src/app/core/record-public-side-bar/record-public-side-bar.service.ts index b2bec18451..f7c55ae3a5 100644 --- a/src/app/core/record-public-side-bar/record-public-side-bar.service.ts +++ b/src/app/core/record-public-side-bar/record-public-side-bar.service.ts @@ -7,7 +7,7 @@ import { UserRecord, UserRecordOptions, } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' + import { ErrorHandlerService } from '../error-handler/error-handler.service' import { setProfessionalEmails } from '../utils' diff --git a/src/app/core/record-works/record-works.service.ts b/src/app/core/record-works/record-works.service.ts index fa092350ee..bfd26f08bd 100644 --- a/src/app/core/record-works/record-works.service.ts +++ b/src/app/core/record-works/record-works.service.ts @@ -25,7 +25,7 @@ import { WorkIdTypeValidation, _LEGACY_ContributionRoles, } from 'src/app/types/works.endpoint' -import { environment } from 'src/environments/environment' + import { ErrorHandlerService } from '../error-handler/error-handler.service' import { VisibilityStrings } from '../../types/common.endpoint' diff --git a/src/app/core/record/record.service.ts b/src/app/core/record/record.service.ts index 68a2afc487..58ada0c709 100644 --- a/src/app/core/record/record.service.ts +++ b/src/app/core/record/record.service.ts @@ -19,7 +19,6 @@ import { } from 'src/app/types' import { CountriesEndpoint } from 'src/app/types/record-country.endpoint' import { UserRecord, UserRecordOptions } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' import { ErrorHandlerService } from '../error-handler/error-handler.service' import { RecordCountriesService } from '../record-countries/record-countries.service' diff --git a/src/app/core/register/register.backend-validators.ts b/src/app/core/register/register.backend-validators.ts index 01f069db66..462dcf958d 100644 --- a/src/app/core/register/register.backend-validators.ts +++ b/src/app/core/register/register.backend-validators.ts @@ -7,7 +7,7 @@ import { import { RegisterForm } from 'src/app/types/register.endpoint' import { Constructor } from 'src/app/types' import { Observable, of } from 'rxjs' -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' diff --git a/src/app/core/register/register.service.ts b/src/app/core/register/register.service.ts index de53608344..8cc3706f0a 100644 --- a/src/app/core/register/register.service.ts +++ b/src/app/core/register/register.service.ts @@ -10,7 +10,7 @@ import { RegisterConfirmResponse, RegisterForm, } from 'src/app/types/register.endpoint' -import { environment } from 'src/environments/environment' + import { ErrorHandlerService } from '../error-handler/error-handler.service' import { UserService } from '../user/user.service' diff --git a/src/app/core/register2/register2.backend-validators.ts b/src/app/core/register2/register2.backend-validators.ts index 870cecb18a..358e0806cc 100644 --- a/src/app/core/register2/register2.backend-validators.ts +++ b/src/app/core/register2/register2.backend-validators.ts @@ -9,7 +9,7 @@ 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 { diff --git a/src/app/core/register2/register2.service.ts b/src/app/core/register2/register2.service.ts index 77be8682e9..3a1d78de7e 100644 --- a/src/app/core/register2/register2.service.ts +++ b/src/app/core/register2/register2.service.ts @@ -10,7 +10,7 @@ import { 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' diff --git a/src/app/core/robots-meta-tags/robots-meta-tags.service.ts b/src/app/core/robots-meta-tags/robots-meta-tags.service.ts index 9e962645db..9077dd0cfb 100644 --- a/src/app/core/robots-meta-tags/robots-meta-tags.service.ts +++ b/src/app/core/robots-meta-tags/robots-meta-tags.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' import { Meta } from '@angular/platform-browser' -import { environment } from 'src/environments/environment' + @Injectable({ providedIn: 'root', diff --git a/src/app/core/search/search.service.ts b/src/app/core/search/search.service.ts index 940590a898..aa087ebbda 100644 --- a/src/app/core/search/search.service.ts +++ b/src/app/core/search/search.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core' -import { environment } from 'src/environments/environment' + import { HttpClient } from '@angular/common/http' import { Observable, of } from 'rxjs' import { SearchParameters, SearchResults } from 'src/app/types' diff --git a/src/app/core/togglz/togglz.service.ts b/src/app/core/togglz/togglz.service.ts index 6acb41336b..d9cddfc195 100644 --- a/src/app/core/togglz/togglz.service.ts +++ b/src/app/core/togglz/togglz.service.ts @@ -4,7 +4,7 @@ import { Observable, ReplaySubject } from 'rxjs' import { map, switchMapTo } from 'rxjs/operators' import { Config } from 'src/app/types/togglz.endpoint' import { MaintenanceMessage } from 'src/app/types/togglz.local' -import { environment } from 'src/environments/environment' + import { UserService } from '..' diff --git a/src/app/core/trusted-individuals/trusted-individuals.service.ts b/src/app/core/trusted-individuals/trusted-individuals.service.ts index 8104e9a1ac..cb6f8108ea 100644 --- a/src/app/core/trusted-individuals/trusted-individuals.service.ts +++ b/src/app/core/trusted-individuals/trusted-individuals.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core' import { HttpClient } from '@angular/common/http' import { Observable } from 'rxjs' import { TrustedIndividuals } from 'src/app/types/trusted-individuals.endpoint' -import { environment } from 'src/environments/environment' + import { map } from 'rxjs/operators' @Injectable({ diff --git a/src/app/core/trusted-summary/trusted-summary.service.ts b/src/app/core/trusted-summary/trusted-summary.service.ts index d80d0d4dd3..0078274c74 100644 --- a/src/app/core/trusted-summary/trusted-summary.service.ts +++ b/src/app/core/trusted-summary/trusted-summary.service.ts @@ -3,7 +3,7 @@ import { Injectable } from '@angular/core' import { ErrorHandlerService } from '../error-handler/error-handler.service' import { Observable } from 'rxjs' import { TrustedSummary } from 'src/app/types/trust-summary' -import { environment } from 'src/environments/environment' + import { catchError, retry } from 'rxjs/operators' import { ERROR_REPORT } from 'src/app/errors' diff --git a/src/app/core/user-info/user-info.service.ts b/src/app/core/user-info/user-info.service.ts index b23616bead..8a4bed7eba 100644 --- a/src/app/core/user-info/user-info.service.ts +++ b/src/app/core/user-info/user-info.service.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs' import { map } from 'rxjs/operators' import { UserInfo } from 'src/app/types' import { UserRecordOptions } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' + import { Router } from '@angular/router' import { PlatformInfo, PlatformInfoService } from '../../cdk/platform-info' diff --git a/src/app/core/user/user.service.ts b/src/app/core/user/user.service.ts index a781014cfa..0c0607ffc8 100644 --- a/src/app/core/user/user.service.ts +++ b/src/app/core/user/user.service.ts @@ -40,7 +40,7 @@ import { } from 'src/app/types/session.local' import { ThirdPartyAuthData } from 'src/app/types/sign-in-data.endpoint' import { Delegator } from 'src/app/types/trusted-individuals.endpoint' -import { environment } from 'src/environments/environment' + import { UserStatus } from '../../types/userStatus.endpoint' import { DiscoService } from '../disco/disco.service' diff --git a/src/app/core/wordpress/wordpress.service.spec.ts b/src/app/core/wordpress/wordpress.service.spec.ts index 74893470db..d834e3ecf2 100644 --- a/src/app/core/wordpress/wordpress.service.spec.ts +++ b/src/app/core/wordpress/wordpress.service.spec.ts @@ -8,7 +8,7 @@ import { RouterTestingModule } from '@angular/router/testing' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { WINDOW_PROVIDERS } from 'src/app/cdk/window' import { LOCALE_ID } from '@angular/core' -import { environment } from 'src/environments/environment' + import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core' diff --git a/src/app/core/wordpress/wordpress.service.ts b/src/app/core/wordpress/wordpress.service.ts index 8573b906d1..415bf216ec 100644 --- a/src/app/core/wordpress/wordpress.service.ts +++ b/src/app/core/wordpress/wordpress.service.ts @@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http' import { Inject, Injectable, LOCALE_ID } from '@angular/core' import { Observable, of } from 'rxjs' import { catchError, map } from 'rxjs/operators' -import { environment } from 'src/environments/environment' + @Injectable({ providedIn: 'root', diff --git a/src/app/developer-tools/pages/developer-tools/developer-tools.component.ts b/src/app/developer-tools/pages/developer-tools/developer-tools.component.ts index 9e7b49cfc2..63e81f5b38 100644 --- a/src/app/developer-tools/pages/developer-tools/developer-tools.component.ts +++ b/src/app/developer-tools/pages/developer-tools/developer-tools.component.ts @@ -32,7 +32,7 @@ import { filter, map, switchMap, takeUntil, tap } from 'rxjs/operators' import { Observable, Subject, of } from 'rxjs' import { RecordService } from 'src/app/core/record/record.service' import { MatLegacyInput as MatInput } from '@angular/material/legacy-input' -import { environment } from 'src/environments/environment' + import { WINDOW } from 'src/app/cdk/window' import { PlatformInfoService } from 'src/app/cdk/platform-info' diff --git a/src/app/environment-banner/environment-banner/environment-banner.component.ts b/src/app/environment-banner/environment-banner/environment-banner.component.ts index 261819d1ee..a33a8295c5 100644 --- a/src/app/environment-banner/environment-banner/environment-banner.component.ts +++ b/src/app/environment-banner/environment-banner/environment-banner.component.ts @@ -22,7 +22,8 @@ export class EnvironmentBannerComponent implements OnInit { this.hostUrl = window.location.host if ( (!this._cookieService.get('testWarningCookie') || !this.canDismiss) && - this.notInsideIframe + this.notInsideIframe && + runtimeEnvironment.SHOW_TEST_WARNING_BANNER ) { this.display = 'auto' } diff --git a/src/app/guards/language.guard.ts b/src/app/guards/language.guard.ts index ba0502d30f..216bf1c907 100644 --- a/src/app/guards/language.guard.ts +++ b/src/app/guards/language.guard.ts @@ -3,7 +3,7 @@ import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router' import { CookieService } from 'ngx-cookie-service' import { NEVER, Observable, of } from 'rxjs' import { catchError, switchMap, tap } from 'rxjs/operators' -import { environment } from 'src/environments/environment' + import { WINDOW } from '../cdk/window' import { UserService } from '../core' diff --git a/src/app/home/components/news/news.component.ts b/src/app/home/components/news/news.component.ts index e343f9f848..d72ec54df4 100644 --- a/src/app/home/components/news/news.component.ts +++ b/src/app/home/components/news/news.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, Inject } from '@angular/core' import { listAnimation } from 'src/app/animations' import { NewsService } from 'src/app/core' -import { environment } from 'src/environments/environment' + import { PlatformInfoService } from 'src/app/cdk/platform-info' import { WINDOW } from 'src/app/cdk/window' diff --git a/src/app/home/pages/home/home.component.ts b/src/app/home/pages/home/home.component.ts index ecb82aa63a..666f95e58c 100644 --- a/src/app/home/pages/home/home.component.ts +++ b/src/app/home/pages/home/home.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, Inject } from '@angular/core' import { enterAnimation } from 'src/app/animations' import { WINDOW } from '../../../cdk/window' -import { environment } from 'src/environments/environment' + import { PlatformInfoService } from 'src/app/cdk/platform-info' import { TogglzService } from 'src/app/core/togglz/togglz.service' import { switchMap, tap } from 'rxjs/operators' diff --git a/src/app/institutional/pages/institutional/institutional.component.ts b/src/app/institutional/pages/institutional/institutional.component.ts index b69f7fa16b..04f0dc9046 100644 --- a/src/app/institutional/pages/institutional/institutional.component.ts +++ b/src/app/institutional/pages/institutional/institutional.component.ts @@ -18,7 +18,6 @@ import { first, map, startWith, tap } from 'rxjs/operators' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { ApplicationRoutes } from 'src/app/constants' -import { environment } from '../../../../environments/environment' import { WINDOW } from '../../../cdk/window' import { DiscoService } from '../../../core/disco/disco.service' import { InstitutionValidator } from '../../../shared/validators/institution/institution.validator' diff --git a/src/app/layout/banners/banners.component.ts b/src/app/layout/banners/banners.component.ts index 18c0f9f4f1..72679fb899 100644 --- a/src/app/layout/banners/banners.component.ts +++ b/src/app/layout/banners/banners.component.ts @@ -3,7 +3,7 @@ import { PlatformInfoService } from 'src/app/cdk/platform-info' import { take, filter } from 'rxjs/operators' import { TogglzService } from 'src/app/core/togglz/togglz.service' import { MaintenanceMessage } from 'src/app/types/togglz.local' -import { environment } from 'src/environments/environment' + import { CookieService } from 'ngx-cookie-service' @Component({ @@ -13,7 +13,7 @@ import { CookieService } from 'ngx-cookie-service' preserveWhitespaces: true, }) export class BannersComponent implements OnInit { - environment = environment + environment = runtimeEnvironment maintenanceMessages: MaintenanceMessage showUnsupportedBrowserBanner closableElementAtDisplay diff --git a/src/app/layout/language/language.component.ts b/src/app/layout/language/language.component.ts index 0d66a2c41d..7c11be59de 100644 --- a/src/app/layout/language/language.component.ts +++ b/src/app/layout/language/language.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Inject, LOCALE_ID } from '@angular/core' -import { environment } from 'src/environments/environment' + import { WINDOW } from 'src/app/cdk/window' import { LanguageService } from 'src/app/core/language/language.service' diff --git a/src/app/layout/user-menu/user-menu.component.ts b/src/app/layout/user-menu/user-menu.component.ts index 72842d0d3a..ff0c38ab96 100644 --- a/src/app/layout/user-menu/user-menu.component.ts +++ b/src/app/layout/user-menu/user-menu.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, Inject } from '@angular/core' import { UserService } from 'src/app/core' -import { environment } from 'src/environments/environment' + import { UserInfo } from 'src/app/types' import { PlatformInfoService, PlatformInfo } from 'src/app/cdk/platform-info' import { WINDOW } from 'src/app/cdk/window' diff --git a/src/app/record/components/peer-review-stacks-groups/modals/modal-peer-reviews/modal-peer-reviews.component.ts b/src/app/record/components/peer-review-stacks-groups/modals/modal-peer-reviews/modal-peer-reviews.component.ts index 25ebc364c1..2280eb36dd 100644 --- a/src/app/record/components/peer-review-stacks-groups/modals/modal-peer-reviews/modal-peer-reviews.component.ts +++ b/src/app/record/components/peer-review-stacks-groups/modals/modal-peer-reviews/modal-peer-reviews.component.ts @@ -5,7 +5,6 @@ import { Subject } from 'rxjs' import { RecordPeerReviewService } from '../../../../../core/record-peer-review/record-peer-review.service' import { first } from 'rxjs/operators' import { RecordImportWizard } from '../../../../../types/record-peer-review-import.endpoint' -import { environment } from '../../../../../../environments/environment' @Component({ selector: 'app-modal-peer-reviews', diff --git a/src/app/record/components/record-header/record-header.component.ts b/src/app/record/components/record-header/record-header.component.ts index 87d6c0c4e6..7ae1b74854 100644 --- a/src/app/record/components/record-header/record-header.component.ts +++ b/src/app/record/components/record-header/record-header.component.ts @@ -16,7 +16,7 @@ import { RecordService } from 'src/app/core/record/record.service' import { RecordUtil } from 'src/app/shared/utils/record.util' import { Assertion, UserInfo } from 'src/app/types' import { UserRecord } from 'src/app/types/record.local' -import { environment } from 'src/environments/environment' + @Component({ selector: 'app-record-header', @@ -53,7 +53,7 @@ export class RecordHeaderComponent implements OnInit { recordWithIssues: boolean userRecord: UserRecord userInfo: UserInfo - environment = environment + environment = runtimeEnvironment givenNames = '' familyName = '' creditName = '' diff --git a/src/app/record/components/record-info/record-info.component.ts b/src/app/record/components/record-info/record-info.component.ts index 9c00e47abb..9b242581d4 100644 --- a/src/app/record/components/record-info/record-info.component.ts +++ b/src/app/record/components/record-info/record-info.component.ts @@ -4,7 +4,7 @@ import { takeUntil } from 'rxjs/operators' import { RecordService } from 'src/app/core/record/record.service' import { RecordUtil as RecordUtil } from 'src/app/shared/utils/record.util' import { UserInfo } from 'src/app/types' -import { environment } from 'src/environments/environment' + @Component({ selector: 'app-record-info', diff --git a/src/app/record/components/search-link-wizard/search-link-wizard.component.ts b/src/app/record/components/search-link-wizard/search-link-wizard.component.ts index b4dbb822d3..0d69f399ad 100644 --- a/src/app/record/components/search-link-wizard/search-link-wizard.component.ts +++ b/src/app/record/components/search-link-wizard/search-link-wizard.component.ts @@ -1,6 +1,5 @@ import { Component, Input, OnInit } from '@angular/core' import { RecordImportWizard } from '../../../types/record-peer-review-import.endpoint' -import { environment } from '../../../../environments/environment' @Component({ selector: 'app-search-link-wizard', diff --git a/src/app/record/components/top-bar-actions/top-bar-actions.component.ts b/src/app/record/components/top-bar-actions/top-bar-actions.component.ts index 2be5ead8ed..ce07d2b522 100644 --- a/src/app/record/components/top-bar-actions/top-bar-actions.component.ts +++ b/src/app/record/components/top-bar-actions/top-bar-actions.component.ts @@ -3,7 +3,6 @@ import { Subject } from 'rxjs' import { takeUntil } from 'rxjs/operators' import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info' import { UserRecord } from '../../../types/record.local' -import { environment } from '../../../../environments/environment' import { WINDOW } from '../../../cdk/window' import { UserStatus } from '../../../types/userStatus.endpoint' diff --git a/src/app/record/components/top-bar-record-issues/top-bar-record-issues.component.ts b/src/app/record/components/top-bar-record-issues/top-bar-record-issues.component.ts index 768bd26f4d..fa59533942 100644 --- a/src/app/record/components/top-bar-record-issues/top-bar-record-issues.component.ts +++ b/src/app/record/components/top-bar-record-issues/top-bar-record-issues.component.ts @@ -3,7 +3,7 @@ import { Subject } from 'rxjs' import { takeUntil } from 'rxjs/operators' import { RecordService } from 'src/app/core/record/record.service' import { UserInfo } from 'src/app/types' -import { environment } from 'src/environments/environment' + @Component({ selector: 'app-top-bar-record-issues', diff --git a/src/app/record/components/work-contributors/work-contributors.component.ts b/src/app/record/components/work-contributors/work-contributors.component.ts index d500d47490..4df9b5615a 100644 --- a/src/app/record/components/work-contributors/work-contributors.component.ts +++ b/src/app/record/components/work-contributors/work-contributors.component.ts @@ -24,7 +24,7 @@ import { takeUntil, tap } from 'rxjs/operators' import { PlatformInfoService } from '../../../cdk/platform-info' import { Subject } from 'rxjs' import { Contributor } from '../../../types' -import { environment } from 'src/environments/environment' + import { RecordWorksService } from '../../../core/record-works/record-works.service' import { RecordAffiliationService } from '../../../core/record-affiliations/record-affiliations.service' import { EmploymentsEndpoint } from '../../../types/record-affiliation.endpoint' diff --git a/src/app/record/pages/my-orcid/my-orcid.component.ts b/src/app/record/pages/my-orcid/my-orcid.component.ts index cdcd04d648..3bbbc01fd4 100644 --- a/src/app/record/pages/my-orcid/my-orcid.component.ts +++ b/src/app/record/pages/my-orcid/my-orcid.component.ts @@ -29,7 +29,7 @@ import { TogglzService } from 'src/app/core/togglz/togglz.service' import { HelpHeroService } from 'src/app/core/help-hero/help-hero.service' import { ScriptService } from '../../../core/crazy-egg/script.service' import { DOCUMENT, Location } from '@angular/common' -import { environment } from 'src/environments/environment' + import { filter, map } from 'rxjs/operators' import { CanonocalUrlService } from 'src/app/core/canonocal-url/canonocal-url.service' import { RecordUtil } from 'src/app/shared/utils/record.util' 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 f0de5ce315..3c34a17099 100644 --- a/src/app/register/components/form-terms/form-terms.component.ts +++ b/src/app/register/components/form-terms/form-terms.component.ts @@ -8,7 +8,7 @@ import { } 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' 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 e4836a4878..fe4d5857be 100644 --- a/src/app/register/components/step-a/step-a.component.ts +++ b/src/app/register/components/step-a/step-a.component.ts @@ -5,7 +5,7 @@ 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({ diff --git a/src/app/register2/components/form-password/form-password.component.ts b/src/app/register2/components/form-password/form-password.component.ts index 50ebbbd4c1..0e93cd8fc6 100644 --- a/src/app/register2/components/form-password/form-password.component.ts +++ b/src/app/register2/components/form-password/form-password.component.ts @@ -22,7 +22,7 @@ import { OrcidValidators } from 'src/app/validators' import { BaseForm } from '../BaseForm' import { LiveAnnouncer } from '@angular/cdk/a11y' -import { environment } from 'src/environments/environment' + import { RegisterObservabilityService } from '../../register-observability.service' import { RegisterStateService } from '../../register-state.service' import { Subject } from 'rxjs' diff --git a/src/app/register2/components/form-personal/form-personal.component.ts b/src/app/register2/components/form-personal/form-personal.component.ts index 154e0a4cee..f05b97fdc4 100644 --- a/src/app/register2/components/form-personal/form-personal.component.ts +++ b/src/app/register2/components/form-personal/form-personal.component.ts @@ -44,7 +44,7 @@ import { MAX_LENGTH_LESS_THAN_ONE_HUNDRED, } from 'src/app/constants' import { LiveAnnouncer } from '@angular/cdk/a11y' -import { environment } from 'src/environments/environment' + import { RegisterBackendErrors } from 'src/app/types/register.local' import { WINDOW } from 'src/app/cdk/window' import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service' diff --git a/src/app/register2/components/form-terms/form-terms.component.ts b/src/app/register2/components/form-terms/form-terms.component.ts index 4dd9ed5132..05c7042c32 100644 --- a/src/app/register2/components/form-terms/form-terms.component.ts +++ b/src/app/register2/components/form-terms/form-terms.component.ts @@ -8,7 +8,7 @@ import { } from '@angular/forms' import { ErrorStateMatcher } from '@angular/material/core' import { Register2Service } from 'src/app/core/register2/register2.service' -import { environment } from 'src/environments/environment' + import { BaseForm } from '../BaseForm' import { RegisterStateService } from '../../register-state.service' @@ -38,7 +38,7 @@ import { RegisterStateService } from '../../register-state.service' // tslint:disable-next-line: class-name export class FormTermsComponent extends BaseForm implements OnInit, DoCheck { nextButtonWasClicked: boolean - environment = environment + environment = runtimeEnvironment constructor( private _register: Register2Service, private _errorStateMatcher: ErrorStateMatcher, diff --git a/src/app/register2/components/step-a/step-a.component.ts b/src/app/register2/components/step-a/step-a.component.ts index 56f957b3bc..3293fdf73f 100644 --- a/src/app/register2/components/step-a/step-a.component.ts +++ b/src/app/register2/components/step-a/step-a.component.ts @@ -11,7 +11,7 @@ import { Router } from '@angular/router' import { first } from 'rxjs/operators' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { ApplicationRoutes } from 'src/app/constants' -import { environment } from 'src/environments/environment' + import { ReactivationLocal } from '../../../types/reactivation.local' import { BaseStepDirective } from '../BaseStep' import { RegisterStateService } from '../../register-state.service' diff --git a/src/app/sign-in/components/logged-in/logged-in.component.ts b/src/app/sign-in/components/logged-in/logged-in.component.ts index 74d51327c5..a99c62a06f 100644 --- a/src/app/sign-in/components/logged-in/logged-in.component.ts +++ b/src/app/sign-in/components/logged-in/logged-in.component.ts @@ -1,6 +1,6 @@ import { Component, Inject, Input, OnInit } from '@angular/core' import { UserService } from 'src/app/core' -import { environment } from 'src/environments/environment' + import { WINDOW } from '../../../cdk/window' @Component({ diff --git a/src/app/sign-in/components/social/social.component.ts b/src/app/sign-in/components/social/social.component.ts index 90942237ff..ebec4aff1e 100644 --- a/src/app/sign-in/components/social/social.component.ts +++ b/src/app/sign-in/components/social/social.component.ts @@ -3,12 +3,8 @@ import { Router } from '@angular/router' import { CookieService } from 'ngx-cookie-service' import { first } from 'rxjs/operators' -import { environment } from '../../../../environments/environment' import { PlatformInfo, PlatformInfoService } from '../../../cdk/platform-info' import { WINDOW } from '../../../cdk/window' -import { OauthService } from '../../../core/oauth/oauth.service' -import { SignInService } from '../../../core/sign-in/sign-in.service' - @Component({ selector: 'app-social', templateUrl: './social.component.html', diff --git a/src/app/two-factor-setup/components/two-factor-enable/two-factor-enable.component.ts b/src/app/two-factor-setup/components/two-factor-enable/two-factor-enable.component.ts index e613a339f0..382c3b44e3 100644 --- a/src/app/two-factor-setup/components/two-factor-enable/two-factor-enable.component.ts +++ b/src/app/two-factor-setup/components/two-factor-enable/two-factor-enable.component.ts @@ -5,7 +5,6 @@ import { UntypedFormGroup, Validators, } from '@angular/forms' -import { environment } from '../../../../environments/environment' import { MAT_LEGACY_TOOLTIP_DEFAULT_OPTIONS as MAT_TOOLTIP_DEFAULT_OPTIONS, MatLegacyTooltipDefaultOptions as MatTooltipDefaultOptions, @@ -36,7 +35,7 @@ export class TwoFactorEnableComponent implements OnInit { backupCodes?: string backupCodesClipboard?: string }>() - environment = environment + environment = runtimeEnvironment twoFactorForm: UntypedFormGroup showTextCode = false showBadVerificationCode = false diff --git a/src/environments/environment.int.ts b/src/environments/environment.int.ts index b0a1e9db8d..888b36a440 100644 --- a/src/environments/environment.int.ts +++ b/src/environments/environment.int.ts @@ -1,4 +1,4 @@ -import { EnvironmentInterface } from './global-environment' +import { EnvironmentInterface } from '.' export const environment: EnvironmentInterface = { production: true, debugger: true, diff --git a/src/environments/environment.local-with-proxy.ts b/src/environments/environment.local.4200.ts similarity index 95% rename from src/environments/environment.local-with-proxy.ts rename to src/environments/environment.local.4200.ts index 698f2e931e..c847501293 100644 --- a/src/environments/environment.local-with-proxy.ts +++ b/src/environments/environment.local.4200.ts @@ -1,4 +1,4 @@ -import { EnvironmentInterface } from './global-environment' +import { EnvironmentInterface } from '.' export const environment: EnvironmentInterface = { production: false, diff --git a/src/environments/environment.local.ts b/src/environments/environment.local.dev.orcid.org.ts similarity index 95% rename from src/environments/environment.local.ts rename to src/environments/environment.local.dev.orcid.org.ts index 60b6e05912..506b8366f7 100644 --- a/src/environments/environment.local.ts +++ b/src/environments/environment.local.dev.orcid.org.ts @@ -1,4 +1,4 @@ -import { EnvironmentInterface } from './global-environment' +import { EnvironmentInterface } from '.' export const environment: EnvironmentInterface = { production: false, diff --git a/src/environments/environment.production.ts b/src/environments/environment.production.ts index a0840fb8b6..2a917ab9f9 100644 --- a/src/environments/environment.production.ts +++ b/src/environments/environment.production.ts @@ -1,4 +1,4 @@ -import { EnvironmentInterface } from './global-environment' +import { EnvironmentInterface } from '.' export const environment: EnvironmentInterface = { production: true, diff --git a/src/environments/environment.qa.ts b/src/environments/environment.qa.ts index 7fa85f898d..e6bb3c4385 100644 --- a/src/environments/environment.qa.ts +++ b/src/environments/environment.qa.ts @@ -1,4 +1,4 @@ -import { EnvironmentInterface } from './global-environment' +import { EnvironmentInterface } from '.' export const environment: EnvironmentInterface = { production: true, diff --git a/src/environments/environment.sandbox.ts b/src/environments/environment.sandbox.ts index 2ac21b757f..7fbcf9edda 100644 --- a/src/environments/environment.sandbox.ts +++ b/src/environments/environment.sandbox.ts @@ -1,4 +1,4 @@ -import { EnvironmentInterface } from './global-environment' +import { EnvironmentInterface } from '.' export const environment: EnvironmentInterface = { production: true, diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 49549ab03b..9fe48f20cf 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1 +1 @@ -export { environment } from './environment.local' +export { environment } from './environment.local.dev.orcid.org' diff --git a/src/environments/global-environment.d.ts b/src/environments/index.d.ts similarity index 96% rename from src/environments/global-environment.d.ts rename to src/environments/index.d.ts index 49c883eee5..12e7644cf0 100644 --- a/src/environments/global-environment.d.ts +++ b/src/environments/index.d.ts @@ -24,7 +24,6 @@ export interface EnvironmentInterface { } proxyMode: boolean } - -declare global { +export declare global { const runtimeEnvironment: EnvironmentInterface } diff --git a/src/main.ts b/src/main.ts index acd5308897..9f603dbcc4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ import { enableProdMode } from '@angular/core' import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' import { AppModule } from './app/app.module' -import { environment } from './environments/environment' +import global from './environments' if (runtimeEnvironment.production) { enableProdMode()