diff --git a/angular.json b/angular.json index edbf79bee..16e03f453 100644 --- a/angular.json +++ b/angular.json @@ -333,12 +333,11 @@ "local": { "browserTarget": "ng-orcid:build:local" }, - "local-tomcat": { - }, + "local-tomcat": {}, "production": { "browserTarget": "ng-orcid:build:production" }, - + "en": { "browserTarget": "ng-orcid:build:en" }, diff --git a/scripts/runtime-environment-setter.postbuild.ts b/scripts/runtime-environment-setter.postbuild.ts index c7f559d34..4934cb588 100644 --- a/scripts/runtime-environment-setter.postbuild.ts +++ b/scripts/runtime-environment-setter.postbuild.ts @@ -1,4 +1,4 @@ -import { runtimeEnvironmentScript } from "./utils"; +import { runtimeEnvironmentScript } from './utils' /** * Receives an HTML string, replaces the [ENVIRONMENT_VARAIBLES_PLACEHOLDER] @@ -8,15 +8,15 @@ import { runtimeEnvironmentScript } from "./utils"; export function replaceEnvPlaceholder(htmlContent: string): string { // 1. Build the script that runs in the browser - // 2. Wrap the content in a `; + const scriptTag = `` // 3. Replace the placeholder in the HTML - const placeholderBlockRegex = /([\s\S]*?)/; + const placeholderBlockRegex = + /([\s\S]*?)/ - const updatedHtml = htmlContent.replace(placeholderBlockRegex, scriptTag); + const updatedHtml = htmlContent.replace(placeholderBlockRegex, scriptTag) // 4. Return the updated HTML - return updatedHtml; -} \ No newline at end of file + return updatedHtml +} diff --git a/scripts/utils.ts b/scripts/utils.ts index e94bdae45..f3f8d02e6 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -46,9 +46,13 @@ export function runtimeEnvironmentScript() { return ` (function() { // The raw environment objects - var environmentProduction = ${JSON.stringify(environmentProduction.environment)}; + var environmentProduction = ${JSON.stringify( + environmentProduction.environment + )}; var environmentQa = ${JSON.stringify(environmentQa.environment)}; - var environmentSandbox = ${JSON.stringify(environmentSandbox.environment)}; + var environmentSandbox = ${JSON.stringify( + environmentSandbox.environment + )}; var environment4200 = ${JSON.stringify(environment4200.environment)}; var environmentDev = ${JSON.stringify(environmentDev.environment)}; @@ -102,5 +106,5 @@ export function runtimeEnvironmentScript() { window.runtimeEnvironment = chosenEnv; })(); - `; -} \ No newline at end of file + ` +} diff --git a/src/app/cdk/platform-info/browserlist.regexp.ts b/src/app/cdk/platform-info/browserlist.regexp.ts index bf8c4aa5c..545a90290 100644 --- a/src/app/cdk/platform-info/browserlist.regexp.ts +++ b/src/app/cdk/platform-info/browserlist.regexp.ts @@ -1,2 +1,3 @@ // tslint:disable-next-line: max-line-length -export const BROWSERLIST_REGEXP = /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+|17[_.]0|17[_.]([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+|17\.0|17\.([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/ +export const BROWSERLIST_REGEXP = + /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+|17[_.]0|17[_.]([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+|17\.0|17\.([1-9]|\d{2,})|(1[8-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/ diff --git a/src/app/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 691dbbe77..0f9ee9e0c 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 @@ -34,7 +34,8 @@ export class AccountDefaultEmailFrequenciesService { updateAmendNotifications(frequency: number): Observable { return this._http .post( - runtimeEnvironment.API_WEB + `notifications/frequencies/update/amendUpdates`, + runtimeEnvironment.API_WEB + + `notifications/frequencies/update/amendUpdates`, frequency, { headers: this.headers } ) @@ -46,7 +47,8 @@ export class AccountDefaultEmailFrequenciesService { updateAdminNotifications(frequency: string): Observable { return this._http .post( - runtimeEnvironment.API_WEB + `notifications/frequencies/update/adminUpdates`, + runtimeEnvironment.API_WEB + + `notifications/frequencies/update/adminUpdates`, frequency, { headers: this.headers } ) @@ -58,7 +60,8 @@ export class AccountDefaultEmailFrequenciesService { updateMemberNotifications(frequency: string): Observable { return this._http .post( - runtimeEnvironment.API_WEB + `notifications/frequencies/update/memberUpdates`, + runtimeEnvironment.API_WEB + + `notifications/frequencies/update/memberUpdates`, frequency, { headers: this.headers } ) @@ -71,7 +74,8 @@ export class AccountDefaultEmailFrequenciesService { updateMemberTipsUpdates(tips: boolean): Observable { return this._http .post( - runtimeEnvironment.API_WEB + `notifications/frequencies/update/tipsUpdates`, + runtimeEnvironment.API_WEB + + `notifications/frequencies/update/tipsUpdates`, tips, { headers: this.headers } ) 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 0aa8f412a..ab31fac75 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 @@ -64,9 +64,12 @@ export class AccountTrustedIndividualsService { getPersonDetails(orcid: string) { return this._http - .get(runtimeEnvironment.API_PUB + `${orcid}/personal-details`, { - headers: this.headers, - }) + .get( + runtimeEnvironment.API_PUB + `${orcid}/personal-details`, + { + headers: this.headers, + } + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)) diff --git a/src/app/core/canonocal-url/canonocal-url.service.ts b/src/app/core/canonocal-url/canonocal-url.service.ts index 5a0062dbc..3d6a75a11 100644 --- a/src/app/core/canonocal-url/canonocal-url.service.ts +++ b/src/app/core/canonocal-url/canonocal-url.service.ts @@ -36,7 +36,9 @@ export class CanonocalUrlService { let canonicalUrl = 'https:' + runtimeEnvironment.BASE_URL + - (runtimeEnvironment.BASE_URL.endsWith('/') ? publicOrcid : '/' + publicOrcid) + (runtimeEnvironment.BASE_URL.endsWith('/') + ? publicOrcid + : '/' + publicOrcid) let link: HTMLLinkElement = this.doc.createElement('link') link.setAttribute('rel', 'canonical') diff --git a/src/app/core/developer-tools/developer-tools.service.ts b/src/app/core/developer-tools/developer-tools.service.ts index 38336a9d9..fa69d92f7 100644 --- a/src/app/core/developer-tools/developer-tools.service.ts +++ b/src/app/core/developer-tools/developer-tools.service.ts @@ -18,7 +18,9 @@ export class DeveloperToolsService { getDeveloperToolsClient(): Observable { return this._http - .get(runtimeEnvironment.BASE_URL + 'developer-tools/get-client.json') + .get( + runtimeEnvironment.BASE_URL + 'developer-tools/get-client.json' + ) .pipe( retry(3), catchError((error) => @@ -58,7 +60,8 @@ export class DeveloperToolsService { postResetClientSecret(client: Client): Observable { return this._http .post( - runtimeEnvironment.BASE_URL + 'developer-tools/reset-client-secret.json', + runtimeEnvironment.BASE_URL + + 'developer-tools/reset-client-secret.json', client ) .pipe( @@ -72,7 +75,8 @@ export class DeveloperToolsService { enableDeveloperTools() { return this._http .post( - runtimeEnvironment.BASE_URL + 'developer-tools/enable-developer-tools.json', + runtimeEnvironment.BASE_URL + + 'developer-tools/enable-developer-tools.json', {} ) .pipe( @@ -86,7 +90,8 @@ export class DeveloperToolsService { resetClientSecret(client: Client): Observable { return this._http .post( - runtimeEnvironment.BASE_URL + 'developer-tools/reset-client-secret.json', + runtimeEnvironment.BASE_URL + + 'developer-tools/reset-client-secret.json', client ) .pipe( diff --git a/src/app/core/disco/disco.service.ts b/src/app/core/disco/disco.service.ts index 853de357a..3f020d446 100644 --- a/src/app/core/disco/disco.service.ts +++ b/src/app/core/disco/disco.service.ts @@ -86,7 +86,9 @@ export class DiscoService { if (!this.discoFeedSubject) { this.discoFeedSubject = new ReplaySubject(1) return this._http - .get(runtimeEnvironment.BASE_URL + 'Shibboleth.sso/DiscoFeed') + .get( + runtimeEnvironment.BASE_URL + 'Shibboleth.sso/DiscoFeed' + ) .pipe( tap((feed) => { this.discoFeedSubject.next(feed) diff --git a/src/app/core/inbox/inbox.service.ts b/src/app/core/inbox/inbox.service.ts index 2d5c675c6..0156ebcf7 100644 --- a/src/app/core/inbox/inbox.service.ts +++ b/src/app/core/inbox/inbox.service.ts @@ -220,7 +220,9 @@ export class InboxService { } retrieveUnreadCount(): any { - return this._http.get(runtimeEnvironment.BASE_URL + 'inbox/unreadCount.json') + return this._http.get( + runtimeEnvironment.BASE_URL + 'inbox/unreadCount.json' + ) } totalNumber() { diff --git a/src/app/core/oauth/oauth.service.ts b/src/app/core/oauth/oauth.service.ts index 12aba899a..fe10796ad 100644 --- a/src/app/core/oauth/oauth.service.ts +++ b/src/app/core/oauth/oauth.service.ts @@ -18,7 +18,6 @@ import { OauthParameters, RequestInfoForm } from 'src/app/types' import { OauthAuthorize } from 'src/app/types/authorize.endpoint' import { UserSessionUpdateParameters } from 'src/app/types/session.local' - import { SignInData } from '../../types/sign-in-data.endpoint' import { TwoFactor } from '../../types/two-factor.endpoint' import { ErrorHandlerService } from '../error-handler/error-handler.service' @@ -193,9 +192,12 @@ export class OauthService { loadShibbolethSignInData(): Observable { return this._http - .get(runtimeEnvironment.BASE_URL + 'shibboleth/signinData.json', { - headers: this.headers, - }) + .get( + runtimeEnvironment.BASE_URL + 'shibboleth/signinData.json', + { + headers: this.headers, + } + ) .pipe( retry(3), catchError((error) => diff --git a/src/app/core/open-graph/open-graph.service.ts b/src/app/core/open-graph/open-graph.service.ts index 84d0283af..7a6e9f966 100644 --- a/src/app/core/open-graph/open-graph.service.ts +++ b/src/app/core/open-graph/open-graph.service.ts @@ -82,7 +82,9 @@ export class OpenGraphService { { property: this.imageMeta, content: - 'https:' + runtimeEnvironment.BASE_URL + 'assets/img/orcid-og-image.png', + 'https:' + + runtimeEnvironment.BASE_URL + + 'assets/img/orcid-og-image.png', }, ]) } catch (e) { diff --git a/src/app/core/organizations/organizations.service.ts b/src/app/core/organizations/organizations.service.ts index 82e94fe43..76e82e88e 100644 --- a/src/app/core/organizations/organizations.service.ts +++ b/src/app/core/organizations/organizations.service.ts @@ -5,7 +5,6 @@ import { catchError, retry } from 'rxjs/operators' import { WHITE_SPACE_REGEXP } from 'src/app/constants' import { OrgDisambiguated } from 'src/app/types' - import { ErrorHandlerService } from '../error-handler/error-handler.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 d1ba0dfa2..b72138c15 100644 --- a/src/app/core/password-recovery/password-recovery.service.ts +++ b/src/app/core/password-recovery/password-recovery.service.ts @@ -42,9 +42,13 @@ export class PasswordRecoveryService { remindOrcidId(data) { return this._http - .post(runtimeEnvironment.API_WEB + `forgot-id.json`, data, { - withCredentials: true, - }) + .post( + runtimeEnvironment.API_WEB + `forgot-id.json`, + data, + { + withCredentials: true, + } + ) .pipe( retry(3), catchError((error) => diff --git a/src/app/core/record-emails/record-emails.service.ts b/src/app/core/record-emails/record-emails.service.ts index 3801a64e6..4e3639e3c 100644 --- a/src/app/core/record-emails/record-emails.service.ts +++ b/src/app/core/record-emails/record-emails.service.ts @@ -126,9 +126,13 @@ export class RecordEmailsService { const encoded_data = JSON.stringify(email) return this._http - .post(runtimeEnvironment.API_WEB + `account/email/visibility`, encoded_data, { - headers: this.headers, - }) + .post( + runtimeEnvironment.API_WEB + `account/email/visibility`, + encoded_data, + { + headers: this.headers, + } + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)), diff --git a/src/app/core/record-fundings/record-fundings.service.ts b/src/app/core/record-fundings/record-fundings.service.ts index 230895fc3..5a3d1cca8 100644 --- a/src/app/core/record-fundings/record-fundings.service.ts +++ b/src/app/core/record-fundings/record-fundings.service.ts @@ -75,7 +75,8 @@ export class RecordFundingsService { getFundingDetails(putCode): Observable { return this._http .get( - runtimeEnvironment.API_WEB + `fundings/fundingDetails.json?id=${putCode}` + runtimeEnvironment.API_WEB + + `fundings/fundingDetails.json?id=${putCode}` ) .pipe( retry(3), @@ -87,7 +88,9 @@ export class RecordFundingsService { getPublicFundingDetails(orcid, putCode): Observable { return this._http .get( - runtimeEnvironment.API_WEB + orcid + `/fundingDetails.json?id=${putCode}` + runtimeEnvironment.API_WEB + + orcid + + `/fundingDetails.json?id=${putCode}` ) .pipe( retry(3), @@ -165,7 +168,10 @@ export class RecordFundingsService { save(funding: Funding) { return this._http - .post(runtimeEnvironment.API_WEB + `fundings/funding.json`, funding) + .post( + runtimeEnvironment.API_WEB + `fundings/funding.json`, + funding + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)), @@ -196,7 +202,8 @@ export class RecordFundingsService { loadFundingImportWizardList(): Observable { return this._http.get( - runtimeEnvironment.API_WEB + 'workspace/retrieve-funding-import-wizards.json' + runtimeEnvironment.API_WEB + + 'workspace/retrieve-funding-import-wizards.json' ) } diff --git a/src/app/core/record-names/record-names.service.ts b/src/app/core/record-names/record-names.service.ts index cf1ede787..201392dca 100644 --- a/src/app/core/record-names/record-names.service.ts +++ b/src/app/core/record-names/record-names.service.ts @@ -43,9 +43,12 @@ export class RecordNamesService { } this._http - .get(runtimeEnvironment.API_WEB + `account/nameForm.json`, { - headers: this.headers, - }) + .get( + runtimeEnvironment.API_WEB + `account/nameForm.json`, + { + headers: this.headers, + } + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)), diff --git a/src/app/core/record-peer-review/record-peer-review.service.ts b/src/app/core/record-peer-review/record-peer-review.service.ts index 102c47674..99461265c 100644 --- a/src/app/core/record-peer-review/record-peer-review.service.ts +++ b/src/app/core/record-peer-review/record-peer-review.service.ts @@ -100,19 +100,25 @@ export class RecordPeerReviewService { getPeerReviewById(putCode: number): Observable { return this._http.get( - runtimeEnvironment.API_WEB + 'peer-reviews/peer-review.json?putCode=' + putCode + runtimeEnvironment.API_WEB + + 'peer-reviews/peer-review.json?putCode=' + + putCode ) } getPeerReviewImportWizardList(): Observable { return this._http.get( - runtimeEnvironment.API_WEB + 'workspace/retrieve-peer-review-import-wizards.json' + runtimeEnvironment.API_WEB + + 'workspace/retrieve-peer-review-import-wizards.json' ) } getPublicPeerReviewById(orcid: string, putCode: number): Observable { return this._http.get( - runtimeEnvironment.API_WEB + orcid + '/peer-review.json?putCode=' + putCode + runtimeEnvironment.API_WEB + + orcid + + '/peer-review.json?putCode=' + + putCode ) } 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 64079a6c6..b2bec1845 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 @@ -47,7 +47,9 @@ export class RecordPublicSideBarService { return this._http .get( - runtimeEnvironment.API_WEB + options.publicRecordId + `/public-record.json`, + runtimeEnvironment.API_WEB + + options.publicRecordId + + `/public-record.json`, { headers: this.headers, } diff --git a/src/app/core/record-research-resource/record-research-resource.service.ts b/src/app/core/record-research-resource/record-research-resource.service.ts index 703748ec0..45a7e76e7 100644 --- a/src/app/core/record-research-resource/record-research-resource.service.ts +++ b/src/app/core/record-research-resource/record-research-resource.service.ts @@ -4,7 +4,6 @@ import { Observable, of, ReplaySubject } from 'rxjs' import { catchError, map, retry, tap } from 'rxjs/operators' import { UserRecordOptions } from 'src/app/types/record.local' - import { ResearchResource, ResearchResourcesEndpoint, @@ -97,7 +96,10 @@ export class RecordResearchResourceService { getPublicResearchResourceById(orcid, putCode): Observable { return this._http.get( - runtimeEnvironment.API_WEB + orcid + '/researchResource.json?id=' + putCode + runtimeEnvironment.API_WEB + + orcid + + '/researchResource.json?id=' + + putCode ) } diff --git a/src/app/core/record-works/record-works.service.ts b/src/app/core/record-works/record-works.service.ts index 68aeac1b1..fa092350e 100644 --- a/src/app/core/record-works/record-works.service.ts +++ b/src/app/core/record-works/record-works.service.ts @@ -264,14 +264,16 @@ export class RecordWorksService { } getWork(): Observable { - return this._http.get(runtimeEnvironment.API_WEB + `works/work.json`).pipe( - retry(3), - map((x) => { - x.workExternalIdentifiers = [] - return x - }), - catchError((error) => this._errorHandler.handleError(error)) - ) + return this._http + .get(runtimeEnvironment.API_WEB + `works/work.json`) + .pipe( + retry(3), + map((x) => { + x.workExternalIdentifiers = [] + return x + }), + catchError((error) => this._errorHandler.handleError(error)) + ) } set(value: any): Observable { @@ -291,7 +293,11 @@ export class RecordWorksService { return this._http .get( - runtimeEnvironment.API_WEB + 'works/' + putCode + '/visibility/' + visibility + runtimeEnvironment.API_WEB + + 'works/' + + putCode + + '/visibility/' + + visibility ) .pipe( retry(3), @@ -303,7 +309,9 @@ export class RecordWorksService { updatePreferredSource(putCode: string): Observable { return this._http .get( - runtimeEnvironment.API_WEB + 'works/updateToMaxDisplay.json?putCode=' + putCode + runtimeEnvironment.API_WEB + + 'works/updateToMaxDisplay.json?putCode=' + + putCode ) .pipe( retry(3), @@ -316,7 +324,9 @@ export class RecordWorksService { public loadWorkIdTypes(): Observable { return this._http - .get(`${runtimeEnvironment.API_WEB}works/idTypes.json?query=`) + .get( + `${runtimeEnvironment.API_WEB}works/idTypes.json?query=` + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)) diff --git a/src/app/core/record/record.service.ts b/src/app/core/record/record.service.ts index a8027b8a5..68a2afc48 100644 --- a/src/app/core/record/record.service.ts +++ b/src/app/core/record/record.service.ts @@ -226,9 +226,12 @@ export class RecordService { getKeywords(): Observable { return this._http - .get(runtimeEnvironment.API_WEB + `my-orcid/keywordsForms.json`, { - headers: this.headers, - }) + .get( + runtimeEnvironment.API_WEB + `my-orcid/keywordsForms.json`, + { + headers: this.headers, + } + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)) diff --git a/src/app/core/register/register.backend-validators.ts b/src/app/core/register/register.backend-validators.ts index e2c49cc0c..01f069db6 100644 --- a/src/app/core/register/register.backend-validators.ts +++ b/src/app/core/register/register.backend-validators.ts @@ -168,7 +168,10 @@ export function RegisterBackendValidatorMixin< StepC ) return this._http - .post(`${runtimeEnvironment.API_WEB}register.json`, registerForm) + .post( + `${runtimeEnvironment.API_WEB}register.json`, + registerForm + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)) diff --git a/src/app/core/register/register.service.ts b/src/app/core/register/register.service.ts index 3e7c6070a..de5360834 100644 --- a/src/app/core/register/register.service.ts +++ b/src/app/core/register/register.service.ts @@ -52,10 +52,13 @@ export class RegisterService extends _RegisterServiceMixingBase { givenNames: string }) { return this._http - .get(runtimeEnvironment.API_WEB + `dupicateResearcher.json`, { - params: names, - withCredentials: true, - }) + .get( + runtimeEnvironment.API_WEB + `dupicateResearcher.json`, + { + params: names, + withCredentials: true, + } + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)) diff --git a/src/app/core/register2/register2.backend-validators.ts b/src/app/core/register2/register2.backend-validators.ts index 66dddf5cf..d30431978 100644 --- a/src/app/core/register2/register2.backend-validators.ts +++ b/src/app/core/register2/register2.backend-validators.ts @@ -175,7 +175,10 @@ export function Register2BackendValidatorMixin< StepD ) return this._http - .post(`${runtimeEnvironment.API_WEB}register.json`, registerForm) + .post( + `${runtimeEnvironment.API_WEB}register.json`, + registerForm + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)) diff --git a/src/app/core/register2/register2.service.ts b/src/app/core/register2/register2.service.ts index 3859631cf..77be8682e 100644 --- a/src/app/core/register2/register2.service.ts +++ b/src/app/core/register2/register2.service.ts @@ -53,10 +53,13 @@ export class Register2Service extends _RegisterServiceMixingBase { givenNames: string }) { return this._http - .get(runtimeEnvironment.API_WEB + `dupicateResearcher.json`, { - params: names, - withCredentials: true, - }) + .get( + runtimeEnvironment.API_WEB + `dupicateResearcher.json`, + { + params: names, + withCredentials: true, + } + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)) 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 67a74d8a5..9e962645d 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 @@ -20,7 +20,10 @@ export class RobotsMetaTagsService { } restoreEnvironmentRobotsConfig() { if (runtimeEnvironment.ROBOTS) { - this.meta.updateTag({ name: this.robots, content: runtimeEnvironment.ROBOTS }) + this.meta.updateTag({ + name: this.robots, + content: runtimeEnvironment.ROBOTS, + }) } else { // If not defined by the environment do not allow robots this.meta.updateTag({ diff --git a/src/app/core/sign-in/sign-in.service.ts b/src/app/core/sign-in/sign-in.service.ts index 00b8e13c0..15d014fea 100644 --- a/src/app/core/sign-in/sign-in.service.ts +++ b/src/app/core/sign-in/sign-in.service.ts @@ -2,7 +2,6 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { catchError, map, retry, switchMap, first } from 'rxjs/operators' - import { getOrcidNumber, isValidOrcidFormat } from '../../constants' import { Claim } from '../../types/claim.endpoint' import { Reactivation } from '../../types/reactivation.endpoint' @@ -77,9 +76,13 @@ export class SignInService { let body = new HttpParams({ encoder: new CustomEncoder() }) body = body.set(isValidOrcidFormat(username) ? 'orcid' : 'email', username) return this._http - .post(runtimeEnvironment.API_WEB + `sendReactivation.json`, body, { - withCredentials: true, - }) + .post( + runtimeEnvironment.API_WEB + `sendReactivation.json`, + body, + { + withCredentials: true, + } + ) .pipe( retry(3), catchError((error) => @@ -121,9 +124,12 @@ export class SignInService { singOut() { this._titleService.setTitle('ORCID') return this._http - .get(runtimeEnvironment.API_WEB + 'userStatus.json?logUserOut=true', { - withCredentials: true, - }) + .get( + runtimeEnvironment.API_WEB + 'userStatus.json?logUserOut=true', + { + withCredentials: true, + } + ) .pipe( retry(3), catchError((error) => this._errorHandler.handleError(error)), diff --git a/src/app/core/two-factor-authentication/two-factor-authentication.service.ts b/src/app/core/two-factor-authentication/two-factor-authentication.service.ts index 363c39461..6d110d664 100644 --- a/src/app/core/two-factor-authentication/two-factor-authentication.service.ts +++ b/src/app/core/two-factor-authentication/two-factor-authentication.service.ts @@ -26,7 +26,9 @@ export class TwoFactorAuthenticationService { ) {} checkState(): Observable { - return this._http.get(runtimeEnvironment.BASE_URL + '2FA/status.json') + return this._http.get( + runtimeEnvironment.BASE_URL + '2FA/status.json' + ) } disable(): Observable { @@ -44,7 +46,9 @@ export class TwoFactorAuthenticationService { } startSetup(): Observable { - return this._http.get(runtimeEnvironment.BASE_URL + '2FA/QRCode.json') + return this._http.get( + runtimeEnvironment.BASE_URL + '2FA/QRCode.json' + ) } register(obj): Observable { @@ -82,9 +86,13 @@ export class TwoFactorAuthenticationService { submitCodeForAnotherAccount(code: TwoFactor) { return this._http - .post(runtimeEnvironment.BASE_URL + `2FA/submitCode.json`, code, { - headers: this.headers, - }) + .post( + runtimeEnvironment.BASE_URL + `2FA/submitCode.json`, + code, + { + headers: this.headers, + } + ) .pipe( retry(3), catchError((error) => diff --git a/src/app/core/wordpress/wordpress.service.spec.ts b/src/app/core/wordpress/wordpress.service.spec.ts index b65a37365..74893470d 100644 --- a/src/app/core/wordpress/wordpress.service.spec.ts +++ b/src/app/core/wordpress/wordpress.service.spec.ts @@ -43,7 +43,9 @@ describe('WordpressService', () => { expect(html).toContain(mockHtml) }) - const req = httpMock.expectOne(`${runtimeEnvironment.WORDPRESS_S3}/index.html`) + const req = httpMock.expectOne( + `${runtimeEnvironment.WORDPRESS_S3}/index.html` + ) expect(req.request.method).toBe('GET') req.flush(mockHtml) }) @@ -137,7 +139,9 @@ describe('WordpressService', () => { expect(html).toBe(expectedHtml) }) - const req = httpMock.expectOne(`${runtimeEnvironment.WORDPRESS_S3}/index.html`) + const req = httpMock.expectOne( + `${runtimeEnvironment.WORDPRESS_S3}/index.html` + ) expect(req.request.method).toBe('GET') req.flush(mockHtml) }) 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 f737a821c..261819d1e 100644 --- a/src/app/environment-banner/environment-banner/environment-banner.component.ts +++ b/src/app/environment-banner/environment-banner/environment-banner.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit, Inject, HostBinding } from '@angular/core' import { CookieService } from 'ngx-cookie-service' import { WINDOW } from 'src/app/cdk/window' - @Component({ selector: 'app-environment-banner', templateUrl: './environment-banner.component.html', diff --git a/src/app/layout/header/header.component.ts b/src/app/layout/header/header.component.ts index 1298117b4..0af0cf789 100644 --- a/src/app/layout/header/header.component.ts +++ b/src/app/layout/header/header.component.ts @@ -13,7 +13,6 @@ import { } from 'src/app/types/menu.local' import { Config } from 'src/app/types/togglz.endpoint' - import { ApplicationRoutes, ORCID_REGEXP } from '../../constants' import { menu } from './menu' @@ -272,7 +271,9 @@ export class HeaderComponent implements OnInit { } this.window.location.href = route } else { - ;(this.window as any).outOfRouterNavigation(runtimeEnvironment.INFO_SITE + route) + ;(this.window as any).outOfRouterNavigation( + runtimeEnvironment.INFO_SITE + route + ) } } } diff --git a/src/app/layout/language/language.component.ts b/src/app/layout/language/language.component.ts index 9532da686..0d66a2c41 100644 --- a/src/app/layout/language/language.component.ts +++ b/src/app/layout/language/language.component.ts @@ -20,7 +20,9 @@ export class LanguageComponent implements OnInit { this.languageMenuOptions = runtimeEnvironment.LANGUAGE_MENU_OPTIONS // LOCAL DEV GET'S `en-US` from locale but `en` is required this.locale = this.locale === 'en-US' ? 'en' : this.locale - this.labelLanguage += ` ${runtimeEnvironment.LANGUAGE_MENU_OPTIONS[this.locale]}` + this.labelLanguage += ` ${ + runtimeEnvironment.LANGUAGE_MENU_OPTIONS[this.locale] + }` } changeLanguage(languageKey: string) { 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 ee161173d..d500d4749 100644 --- a/src/app/record/components/work-contributors/work-contributors.component.ts +++ b/src/app/record/components/work-contributors/work-contributors.component.ts @@ -274,7 +274,11 @@ export class WorkContributorsComponent implements OnInit, OnDestroy { contributorOrcid: this.formBuilder.group({ path: [orcid ? orcid : null], uri: [ - uri ? uri : orcid ? `https:${runtimeEnvironment.BASE_URL}${orcid}` : null, + uri + ? uri + : orcid + ? `https:${runtimeEnvironment.BASE_URL}${orcid}` + : null, ], }), roles: new UntypedFormArray([]), diff --git a/src/assets/local-dev-environment.js b/src/assets/local-dev-environment.js index 95397e981..4409ddbc8 100644 --- a/src/assets/local-dev-environment.js +++ b/src/assets/local-dev-environment.js @@ -1,62 +1,277 @@ -//DO NOT MODIFY THIS environment file directly, to updat this file. -//To update environments please update the files under "/Users/l.mendoza/code/orcid-angular/src/environments" - - (function() { - // The raw environment objects - var environmentProduction = {"production":true,"debugger":false,"ROBOTS":"all","API_NEWS":"https://info.orcid.org/feed/","API_PUB":"//pub./v3.0","API_WEB":"///","BASE_URL":"///","INFO_SITE":"https://info.orcid.org/","SHOW_TEST_WARNING_BANNER":false,"GOOGLE_ANALYTICS_TESTING_MODE":false,"GOOGLE_TAG_MANAGER":"GTM-WDKLQXL","GOOGLE_RECAPTCHA":"6Lfj4AoTAAAAAAjr0x3Gu2RcVpA1-0LJAhV-GRQj","ZENDESK":"b8313acd-6439-4894-b431-8c5a2ae9e7cb","HELP_HERO_ID":"oYFQMrzFHA","INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT":20,"VERBOSE_SNACKBAR_ERRORS_REPORTS":false,"WORDPRESS_S3":"https://homepage-prod.orcid.org","WORDPRESS_S3_FALLBACK":"https://homepage-fallback.orcid.org","NEW_RELIC_APP":"772335825","LANGUAGE_MENU_OPTIONS":{"ar":"العربية","cs":"Čeština","de":"Deutsch","en":"English","es":"Español","fr":"Français","it":"Italiano","ja":"日本語","ko":"한국어","pl":"Polski","pt":"Português","ru":"Русский","tr":"Türkçe","zh-CN":"简体中文","zh-TW":"繁體中文"},"proxyMode":null,"CAN_DISABLE_TEST_WARNING_BANNER":null}; - var environmentQa = {"production":true,"debugger":true,"ROBOTS":"noindex, nofollow","API_NEWS":"https://info.qa.orcid.org/feed/","API_PUB":"//pub./v3.0","API_WEB":"///","BASE_URL":"///","INFO_SITE":"https://info.qa.orcid.org/","GOOGLE_ANALYTICS_TESTING_MODE":true,"GOOGLE_TAG_MANAGER":"GTM-TRLHLRZ","GOOGLE_RECAPTCHA":"6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI","ZENDESK":"b8313acd-6439-4894-b431-8c5a2ae9e7cb","HELP_HERO_ID":"oYFQMrzFHA","SHOW_TEST_WARNING_BANNER":true,"CAN_DISABLE_TEST_WARNING_BANNER":true,"INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT":20,"VERBOSE_SNACKBAR_ERRORS_REPORTS":true,"WORDPRESS_S3":"https://homepage-qa.orcid.org","WORDPRESS_S3_FALLBACK":"https://homepage-fallback.orcid.org","NEW_RELIC_APP":"772335827","LANGUAGE_MENU_OPTIONS":{"ar":"العربية","cs":"Čeština","de":"Deutsch","en":"English","es":"Español","fr":"Français","it":"Italiano","ja":"日本語","ko":"한국어","pl":"Polski","pt":"Português","ru":"Русский","tr":"Türkçe","zh-CN":"简体中文","zh-TW":"繁體中文","xx":"** xx","src":"** source","lr":"** lr","rl":"** rl","uk":"** Ukrainian","ca":"** Catalan"},"proxyMode":false}; - var environmentSandbox = {"production":true,"debugger":false,"ROBOTS":"noindex, nofollow","API_NEWS":"https://info.qa.orcid.org/feed/","API_PUB":"//pub./v3.0","API_WEB":"///","BASE_URL":"///","INFO_SITE":"https://info.qa.orcid.org/","GOOGLE_ANALYTICS_TESTING_MODE":false,"GOOGLE_TAG_MANAGER":"GTM-M9Z7DHS","GOOGLE_RECAPTCHA":"6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI","HELP_HERO_ID":"oYFQMrzFHA","ZENDESK":null,"SHOW_TEST_WARNING_BANNER":true,"CAN_DISABLE_TEST_WARNING_BANNER":false,"INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT":20,"VERBOSE_SNACKBAR_ERRORS_REPORTS":false,"WORDPRESS_S3":"https://homepage-prod.orcid.org","WORDPRESS_S3_FALLBACK":"https://homepage-fallback.orcid.org","NEW_RELIC_APP":"772335828","LANGUAGE_MENU_OPTIONS":{"ar":"العربية","cs":"Čeština","de":"Deutsch","en":"English","es":"Español","fr":"Français","it":"Italiano","ja":"日本語","ko":"한국어","pl":"Polski","pt":"Português","ru":"Русский","tr":"Türkçe","zh-CN":"简体中文","zh-TW":"繁體中文"},"proxyMode":false}; - var environment4200 = {"production":false,"debugger":true,"ROBOTS":"all","API_NEWS":"https://www.mocky.io/v2/5dced45b3000007300931ce8","API_PUB":"///v3.0","API_WEB":"///","BASE_URL":"///","INFO_SITE":"https://info.orcid.org/","GOOGLE_ANALYTICS_TESTING_MODE":true,"GOOGLE_TAG_MANAGER":"GTM-0000000","GOOGLE_RECAPTCHA":"6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI","HELP_HERO_ID":"oYFQMrzFHA","ZENDESK":null,"SHOW_TEST_WARNING_BANNER":true,"CAN_DISABLE_TEST_WARNING_BANNER":true,"INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT":50,"VERBOSE_SNACKBAR_ERRORS_REPORTS":true,"WORDPRESS_S3":"https://homepage-qa.orcid.org","WORDPRESS_S3_FALLBACK":"https://homepage-fallback.orcid.org","NEW_RELIC_APP":"772335827","LANGUAGE_MENU_OPTIONS":{"ar":"العربية","cs":"Čeština","de":"Deutsch","en":"English","es":"Español","fr":"Français","it":"Italiano","ja":"日本語","ko":"한국어","pl":"Polski","pt":"Português","ru":"Русский","tr":"Türkçe","zh-CN":"简体中文","zh-TW":"繁體中文","xx":"** xx","src":"** source","lr":"** lr","rl":"** rl","uk":"** Ukrainian","ca":"** Catalan"},"proxyMode":true}; - var environmentDev = {"production":false,"debugger":true,"ROBOTS":"all","API_NEWS":"https://www.mocky.io/v2/5dced45b3000007300931ce8","API_PUB":"//pub./v3.0","API_WEB":"///","BASE_URL":"///","INFO_SITE":"https://info.orcid.org/","GOOGLE_ANALYTICS_TESTING_MODE":true,"GOOGLE_TAG_MANAGER":"GTM-0000000","GOOGLE_RECAPTCHA":"6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI","HELP_HERO_ID":"oYFQMrzFHA","ZENDESK":null,"SHOW_TEST_WARNING_BANNER":true,"CAN_DISABLE_TEST_WARNING_BANNER":true,"INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT":50,"VERBOSE_SNACKBAR_ERRORS_REPORTS":true,"WORDPRESS_S3":"https://homepage-qa.orcid.org","WORDPRESS_S3_FALLBACK":"https://homepage-fallback.orcid.org","NEW_RELIC_APP":"772335827","LANGUAGE_MENU_OPTIONS":{"ar":"العربية","cs":"Čeština","de":"Deutsch","en":"English","es":"Español","fr":"Français","it":"Italiano","ja":"日本語","ko":"한국어","pl":"Polski","pt":"Português","ru":"Русский","tr":"Türkçe","zh-CN":"简体中文","zh-TW":"繁體中文","xx":"** xx","src":"** source","lr":"** lr","rl":"** rl","uk":"** Ukrainian","ca":"** Catalan"},"proxyMode":false}; - - function getCurrentLeanDomain() { - var port = window.location.port ? ':' + window.location.port : ''; - // e.g. "qa.myorg.com" -> ["qa", "myorg", "com"] - // .slice(-2) -> ["myorg", "com"] - return window.location.hostname.split('.').slice(-2).join('.') + port; - } - - function getSubDomain() { - // e.g. "qa.myorg.com" -> ["qa", "myorg", "com"] - // .slice(0, -2) -> ["qa"] - var subdomain = window.location.hostname.split('.').slice(0, -2).join('.'); - return subdomain ? subdomain + '.' : ''; - } - - function replaceEnvironmentVars(env) { - if (!env) return; - if (env.API_WEB) { - env.API_WEB = env.API_WEB - .replace('', getSubDomain()) - .replace('', getCurrentLeanDomain()); - } - if (env.BASE_URL) { - env.BASE_URL = env.BASE_URL - .replace('', getSubDomain()) - .replace('', getCurrentLeanDomain()); - } - if (env.API_PUB) { - env.API_PUB = env.API_PUB - .replace('', getSubDomain()) - .replace('', getCurrentLeanDomain()); - } - } - - var domain = window.location.hostname + window.location.pathname; - var chosenEnv = environmentProduction; // default to production - - if (domain.includes('qa.orcid.org')) { - chosenEnv = environmentQa; - } else if (domain.includes('sandbox.orcid.org')) { - chosenEnv = environmentSandbox; - } else if (domain.includes('localhost:4200')) { - chosenEnv = environment4200; - } else if (domain.includes('dev.orcid.org')) { - chosenEnv = environmentDev; - } - - replaceEnvironmentVars(chosenEnv); - - window.runtimeEnvironment = chosenEnv; - })(); - \ No newline at end of file +//DO NOT MODIFY THIS environment file directly, to updat this file. +//To update environments please update the files under "/Users/l.mendoza/code/orcid-angular/src/environments" + +;(function () { + // The raw environment objects + var environmentProduction = { + production: true, + debugger: false, + ROBOTS: 'all', + API_NEWS: 'https://info.orcid.org/feed/', + API_PUB: '//pub./v3.0', + API_WEB: '///', + BASE_URL: '///', + INFO_SITE: 'https://info.orcid.org/', + SHOW_TEST_WARNING_BANNER: false, + GOOGLE_ANALYTICS_TESTING_MODE: false, + GOOGLE_TAG_MANAGER: 'GTM-WDKLQXL', + GOOGLE_RECAPTCHA: '6Lfj4AoTAAAAAAjr0x3Gu2RcVpA1-0LJAhV-GRQj', + ZENDESK: 'b8313acd-6439-4894-b431-8c5a2ae9e7cb', + HELP_HERO_ID: 'oYFQMrzFHA', + INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT: 20, + VERBOSE_SNACKBAR_ERRORS_REPORTS: false, + WORDPRESS_S3: 'https://homepage-prod.orcid.org', + WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org', + NEW_RELIC_APP: '772335825', + LANGUAGE_MENU_OPTIONS: { + ar: 'العربية', + cs: 'Čeština', + de: 'Deutsch', + en: 'English', + es: 'Español', + fr: 'Français', + it: 'Italiano', + ja: '日本語', + ko: '한국어', + pl: 'Polski', + pt: 'Português', + ru: 'Русский', + tr: 'Türkçe', + 'zh-CN': '简体中文', + 'zh-TW': '繁體中文', + }, + proxyMode: null, + CAN_DISABLE_TEST_WARNING_BANNER: null, + } + var environmentQa = { + production: true, + debugger: true, + ROBOTS: 'noindex, nofollow', + API_NEWS: 'https://info.qa.orcid.org/feed/', + API_PUB: '//pub./v3.0', + API_WEB: '///', + BASE_URL: '///', + INFO_SITE: 'https://info.qa.orcid.org/', + GOOGLE_ANALYTICS_TESTING_MODE: true, + GOOGLE_TAG_MANAGER: 'GTM-TRLHLRZ', + GOOGLE_RECAPTCHA: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', + ZENDESK: 'b8313acd-6439-4894-b431-8c5a2ae9e7cb', + HELP_HERO_ID: 'oYFQMrzFHA', + SHOW_TEST_WARNING_BANNER: true, + CAN_DISABLE_TEST_WARNING_BANNER: true, + INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT: 20, + VERBOSE_SNACKBAR_ERRORS_REPORTS: true, + WORDPRESS_S3: 'https://homepage-qa.orcid.org', + WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org', + NEW_RELIC_APP: '772335827', + LANGUAGE_MENU_OPTIONS: { + ar: 'العربية', + cs: 'Čeština', + de: 'Deutsch', + en: 'English', + es: 'Español', + fr: 'Français', + it: 'Italiano', + ja: '日本語', + ko: '한국어', + pl: 'Polski', + pt: 'Português', + ru: 'Русский', + tr: 'Türkçe', + 'zh-CN': '简体中文', + 'zh-TW': '繁體中文', + xx: '** xx', + src: '** source', + lr: '** lr', + rl: '** rl', + uk: '** Ukrainian', + ca: '** Catalan', + }, + proxyMode: false, + } + var environmentSandbox = { + production: true, + debugger: false, + ROBOTS: 'noindex, nofollow', + API_NEWS: 'https://info.qa.orcid.org/feed/', + API_PUB: '//pub./v3.0', + API_WEB: '///', + BASE_URL: '///', + INFO_SITE: 'https://info.qa.orcid.org/', + GOOGLE_ANALYTICS_TESTING_MODE: false, + GOOGLE_TAG_MANAGER: 'GTM-M9Z7DHS', + GOOGLE_RECAPTCHA: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', + HELP_HERO_ID: 'oYFQMrzFHA', + ZENDESK: null, + SHOW_TEST_WARNING_BANNER: true, + CAN_DISABLE_TEST_WARNING_BANNER: false, + INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT: 20, + VERBOSE_SNACKBAR_ERRORS_REPORTS: false, + WORDPRESS_S3: 'https://homepage-prod.orcid.org', + WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org', + NEW_RELIC_APP: '772335828', + LANGUAGE_MENU_OPTIONS: { + ar: 'العربية', + cs: 'Čeština', + de: 'Deutsch', + en: 'English', + es: 'Español', + fr: 'Français', + it: 'Italiano', + ja: '日本語', + ko: '한국어', + pl: 'Polski', + pt: 'Português', + ru: 'Русский', + tr: 'Türkçe', + 'zh-CN': '简体中文', + 'zh-TW': '繁體中文', + }, + proxyMode: false, + } + var environment4200 = { + production: false, + debugger: true, + ROBOTS: 'all', + API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8', + API_PUB: '///v3.0', + API_WEB: '///', + BASE_URL: '///', + INFO_SITE: 'https://info.orcid.org/', + GOOGLE_ANALYTICS_TESTING_MODE: true, + GOOGLE_TAG_MANAGER: 'GTM-0000000', + GOOGLE_RECAPTCHA: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', + HELP_HERO_ID: 'oYFQMrzFHA', + ZENDESK: null, + SHOW_TEST_WARNING_BANNER: true, + CAN_DISABLE_TEST_WARNING_BANNER: true, + INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT: 50, + VERBOSE_SNACKBAR_ERRORS_REPORTS: true, + WORDPRESS_S3: 'https://homepage-qa.orcid.org', + WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org', + NEW_RELIC_APP: '772335827', + LANGUAGE_MENU_OPTIONS: { + ar: 'العربية', + cs: 'Čeština', + de: 'Deutsch', + en: 'English', + es: 'Español', + fr: 'Français', + it: 'Italiano', + ja: '日本語', + ko: '한국어', + pl: 'Polski', + pt: 'Português', + ru: 'Русский', + tr: 'Türkçe', + 'zh-CN': '简体中文', + 'zh-TW': '繁體中文', + xx: '** xx', + src: '** source', + lr: '** lr', + rl: '** rl', + uk: '** Ukrainian', + ca: '** Catalan', + }, + proxyMode: true, + } + var environmentDev = { + production: false, + debugger: true, + ROBOTS: 'all', + API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8', + API_PUB: '//pub./v3.0', + API_WEB: '///', + BASE_URL: '///', + INFO_SITE: 'https://info.orcid.org/', + GOOGLE_ANALYTICS_TESTING_MODE: true, + GOOGLE_TAG_MANAGER: 'GTM-0000000', + GOOGLE_RECAPTCHA: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', + HELP_HERO_ID: 'oYFQMrzFHA', + ZENDESK: null, + SHOW_TEST_WARNING_BANNER: true, + CAN_DISABLE_TEST_WARNING_BANNER: true, + INSTITUTIONAL_AUTOCOMPLETE_DISPLAY_AMOUNT: 50, + VERBOSE_SNACKBAR_ERRORS_REPORTS: true, + WORDPRESS_S3: 'https://homepage-qa.orcid.org', + WORDPRESS_S3_FALLBACK: 'https://homepage-fallback.orcid.org', + NEW_RELIC_APP: '772335827', + LANGUAGE_MENU_OPTIONS: { + ar: 'العربية', + cs: 'Čeština', + de: 'Deutsch', + en: 'English', + es: 'Español', + fr: 'Français', + it: 'Italiano', + ja: '日本語', + ko: '한국어', + pl: 'Polski', + pt: 'Português', + ru: 'Русский', + tr: 'Türkçe', + 'zh-CN': '简体中文', + 'zh-TW': '繁體中文', + xx: '** xx', + src: '** source', + lr: '** lr', + rl: '** rl', + uk: '** Ukrainian', + ca: '** Catalan', + }, + proxyMode: false, + } + + function getCurrentLeanDomain() { + var port = window.location.port ? ':' + window.location.port : '' + // e.g. "qa.myorg.com" -> ["qa", "myorg", "com"] + // .slice(-2) -> ["myorg", "com"] + return window.location.hostname.split('.').slice(-2).join('.') + port + } + + function getSubDomain() { + // e.g. "qa.myorg.com" -> ["qa", "myorg", "com"] + // .slice(0, -2) -> ["qa"] + var subdomain = window.location.hostname.split('.').slice(0, -2).join('.') + return subdomain ? subdomain + '.' : '' + } + + function replaceEnvironmentVars(env) { + if (!env) return + if (env.API_WEB) { + env.API_WEB = env.API_WEB.replace('', getSubDomain()).replace( + '', + getCurrentLeanDomain() + ) + } + if (env.BASE_URL) { + env.BASE_URL = env.BASE_URL.replace( + '', + getSubDomain() + ).replace('', getCurrentLeanDomain()) + } + if (env.API_PUB) { + env.API_PUB = env.API_PUB.replace('', getSubDomain()).replace( + '', + getCurrentLeanDomain() + ) + } + } + + var domain = window.location.hostname + window.location.pathname + var chosenEnv = environmentProduction // default to production + + if (domain.includes('qa.orcid.org')) { + chosenEnv = environmentQa + } else if (domain.includes('sandbox.orcid.org')) { + chosenEnv = environmentSandbox + } else if (domain.includes('localhost:4200')) { + chosenEnv = environment4200 + } else if (domain.includes('dev.orcid.org')) { + chosenEnv = environmentDev + } + + replaceEnvironmentVars(chosenEnv) + + window.runtimeEnvironment = chosenEnv +})() diff --git a/src/environments/environment.local-with-proxy.ts b/src/environments/environment.local-with-proxy.ts index ca8818aef..698f2e931 100644 --- a/src/environments/environment.local-with-proxy.ts +++ b/src/environments/environment.local-with-proxy.ts @@ -1,6 +1,7 @@ import { EnvironmentInterface } from './global-environment' -export const environment: EnvironmentInterface = { production: false, +export const environment: EnvironmentInterface = { + production: false, debugger: true, ROBOTS: 'all', API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8', diff --git a/src/environments/environment.local.ts b/src/environments/environment.local.ts index 189827e7d..60b6e0591 100644 --- a/src/environments/environment.local.ts +++ b/src/environments/environment.local.ts @@ -1,6 +1,7 @@ import { EnvironmentInterface } from './global-environment' -export const environment: EnvironmentInterface = { production: false, +export const environment: EnvironmentInterface = { + production: false, debugger: true, ROBOTS: 'all', API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8',