diff --git a/app/package.json b/app/package.json index d6740cad3..9caffdbf4 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "name-request", - "version": "5.9.1", + "version": "5.10.0", "private": true, "engines": { "node": ">=24" diff --git a/app/src/components/new-request/business-lookup.vue b/app/src/components/new-request/business-lookup.vue index d40eb613c..b325cfca7 100644 --- a/app/src/components/new-request/business-lookup.vue +++ b/app/src/components/new-request/business-lookup.vue @@ -5,13 +5,13 @@ id="business-lookup" > { - const escapedWord = word.replace(/\./g, '\\.') + const escapedWord = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') const regex = new RegExp(`\\b${escapedWord.toUpperCase()}$`, 'i') return regex.test(trimmedName.toUpperCase()) }) diff --git a/app/src/store/actions.ts b/app/src/store/actions.ts index dda083a21..977b54670 100644 --- a/app/src/store/actions.ts +++ b/app/src/store/actions.ts @@ -632,7 +632,8 @@ export const setExistingRequestSearch = (existingRequest: { key: string, value: // if nr changes set session email/phone to whatever is in store (prevents previous values from interfering) if (existingRequest.value.includes('NR')) { sessionStorage.setItem(prefix + 'emailAddress', Getters.getExistingRequestSearch(state).emailAddress) - sessionStorage.setItem(prefix + 'phoneNumber', Getters.getExistingRequestSearch(state).phoneNumber) + // Do not persist phone data (even masked) in clear text. + sessionStorage.removeItem(prefix + 'phoneNumber') } if (existingRequest.value.includes('NR L')) { sessionStorage.setItem(prefix + 'nrl', existingRequest.value) @@ -789,7 +790,8 @@ export const getMatchesExact = async (token: string, cleanedName: string): Promi return exactResp?.data ? parseExactNames(exactResp.data) : [] } -export const getMatchesSimilar = async ( +// todo: look into differences #31690 +export const getMatchesSimilar_main_branch = async ( token: string, cleanedName: string, exactNames: Array ): Promise> => { const synonymResp = await NamexServices.axios.get( @@ -803,11 +805,30 @@ export const getMatchesSimilar = async ( return synonymResp?.data ? parseSynonymNames(synonymResp.data) : [] } +const getMatchesSimilar = async ( + token: string, + cleanedName: string +): Promise<{ names: Array, exactNames: Array }> => { + const synonymResp = await NamexServices.axios.get( + `${namexApiUrl}/requests/possible-conflicts/${cleanedName}`, + { + headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' } + }).catch(() => { + Mutations.mutateNameCheckErrorAdd(state, NameCheckErrorType.ERROR_SIMILAR) + return null + }) + + return { + names: synonymResp.data.names || [], + exactNames: synonymResp.data.exactNames || [] + } +} + export const getMatchesRestricted = async ( token: string, cleanedName: string ): Promise => { const restrictedResp = await NamexServices.axios.get( - `${namexApiUrl}/documents:restricted_words?content=${cleanedName}`, + `${namexApiUrl}/documents/restricted-words?content=${cleanedName}`, { headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' } } ).catch(() => { Mutations.mutateNameCheckErrorAdd(state, NameCheckErrorType.ERROR_RESTRICTED) @@ -922,13 +943,12 @@ export const getQuickSearch = async ( headers: { Authorization: `Basic ${encodedAuth}`, 'content-type': 'application/x-www-form-urlencoded' } }) const token = tokenResp.data.access_token - const exactNames = checks.exact ? await getMatchesExact(token, cleanedName.exactMatch) : [] - // pass in exactNames so that we can check for duplicates - const synonymNames = ( + const { names, exactNames } = ( checks.similar - ? await getMatchesSimilar(token, cleanedName.synonymMatch, exactNames) - : [] + ? await getMatchesSimilar(token, cleanedName.synonymMatch) + : { names: [], exactNames: [] } ) + const parsedRestrictedResp: ParsedRestrictedResponseIF = ( checks.restricted ? await getMatchesRestricted(token, cleanedName.restrictedMatch) @@ -937,7 +957,7 @@ export const getQuickSearch = async ( return { exactNames: exactNames, - synonymNames: synonymNames, + synonymNames: names, restrictedWords: parsedRestrictedResp.restrictedWords, conditionalWords: parsedRestrictedResp.conditionalWords, conditionalInstructions: parsedRestrictedResp.conditionalInstructions @@ -1022,6 +1042,7 @@ export const parseRestrictedWords = (resp: RestrictedResponseIF): ParsedRestrict return parsedResp } +// todo: verify is used #31690 export const parseSynonymNames = ( json: { names: Array, exactNames: Array } ): Array => { diff --git a/app/src/store/getters.ts b/app/src/store/getters.ts index d04548f19..601c60cb5 100644 --- a/app/src/store/getters.ts +++ b/app/src/store/getters.ts @@ -1333,6 +1333,26 @@ export const getRegularWaitTime = (state: StateIF): string | number => { return '-' } +export const getPriorityWaitTime = (state: StateIF): string | number => { + const flagVal = GetFeatureFlag('hardcoded_priority_wait_time') + if (flagVal > 0) return flagVal + if (flagVal < 0) return '-' + + const statVal = getStats(state)?.priority_wait_time + if (statVal > 0) return statVal + return '-' +} + +export const getRegularWaitTime = (state: StateIF): string | number => { + const flagVal = GetFeatureFlag('hardcoded_regular_wait_time') + if (flagVal > 0) return flagVal + if (flagVal < 0) return '-' + + const statVal = getStats(state)?.regular_wait_time + if (statVal > 0) return statVal + return '-' +} + function formatDate(statVal: number): string { const today = new Date(); const result = new Date(today); diff --git a/app/src/store/mutations.ts b/app/src/store/mutations.ts index 37849b620..c5175299d 100644 --- a/app/src/store/mutations.ts +++ b/app/src/store/mutations.ts @@ -340,7 +340,8 @@ export const populateApplicantData = (state: StateIF) => { } // FUTURE: have 1 mutation for nr / applicant info and put these there sessionStorage.setItem('BCREG-emailAddress', state.newRequestModel.applicant?.emailAddress) - sessionStorage.setItem('BCREG-phoneNumber', state.newRequestModel.applicant?.phoneNumber) + // Do not persist phone number in browser storage (sensitive PII). + sessionStorage.removeItem('BCREG-phoneNumber') } export const populateNrData = (state: StateIF) => {