Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.9.1",
"version": "5.10.0",
"private": true,
"engines": {
"node": ">=24"
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/new-request/business-lookup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
id="business-lookup"
>
<v-autocomplete
v-model:search-input="searchField"

Check warning on line 8 in app/src/components/new-request/business-lookup.vue

View workflow job for this annotation

GitHub Actions / namerequest-ci / linting-pnpm (24, 9)

'v-model' directives require no argument
filled
no-filter
:hide-no-data="state != States.NO_RESULTS"
:items="searchResults"
:loading="state === States.SEARCHING"
:name="Math.random()"
:search-input.sync="searchField"
append-icon="mdi-magnify"
autocomplete="chrome-off"
autofocus
Expand All @@ -22,7 +22,7 @@
return-object
:label="lookupLabel"
@input="onItemSelected($event)"
@keydown.enter.native.prevent

Check warning on line 25 in app/src/components/new-request/business-lookup.vue

View workflow job for this annotation

GitHub Actions / namerequest-ci / linting-pnpm (24, 9)

'.native' modifier on 'v-on' directive is deprecated
>
<template #append>
<v-progress-circular
Expand Down
2 changes: 1 addition & 1 deletion app/src/list-data/designations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export function checkInvalidDesignation (entityTypeCd: string | EntityTypes, nam

// Check if any invalid designation appears at the end of the name
const foundWord = invalidDesignationList.find((word: string) => {
const escapedWord = word.replace(/\./g, '\\.')
const escapedWord = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const regex = new RegExp(`\\b${escapedWord.toUpperCase()}$`, 'i')
return regex.test(trimmedName.toUpperCase())
})
Expand Down
39 changes: 30 additions & 9 deletions app/src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<ConflictListItemI>
): Promise<Array<ConflictListItemI>> => {
const synonymResp = await NamexServices.axios.get(
Expand All @@ -803,11 +805,30 @@ export const getMatchesSimilar = async (
return synonymResp?.data ? parseSynonymNames(synonymResp.data) : []
}

const getMatchesSimilar = async (
token: string,
cleanedName: string
): Promise<{ names: Array<any>, exactNames: Array<any> }> => {
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<ParsedRestrictedResponseIF> => {
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)
Expand Down Expand Up @@ -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)
Expand All @@ -937,7 +957,7 @@ export const getQuickSearch = async (

return {
exactNames: exactNames,
synonymNames: synonymNames,
synonymNames: names,
restrictedWords: parsedRestrictedResp.restrictedWords,
conditionalWords: parsedRestrictedResp.conditionalWords,
conditionalInstructions: parsedRestrictedResp.conditionalInstructions
Expand Down Expand Up @@ -1022,6 +1042,7 @@ export const parseRestrictedWords = (resp: RestrictedResponseIF): ParsedRestrict
return parsedResp
}

// todo: verify is used #31690
export const parseSynonymNames = (
json: { names: Array<string>, exactNames: Array<ConflictListItemI> }
): Array<ConflictListItemI> => {
Expand Down
16 changes: 8 additions & 8 deletions app/src/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1333,20 +1333,20 @@ export const getRegularWaitTime = (state: StateIF): string | number => {
return '-'
}

function formatDate(statVal: number): string {
const today = new Date();
const result = new Date(today);
function formatDate (statVal: number): string {
const today = new Date()
const result = new Date(today)

result.setDate(today.getDate() + statVal);
result.setDate(today.getDate() + statVal)
const formatted = result.toLocaleDateString('en-CA', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
})
if (statVal > 1) {
return formatted + " (" + statVal + " days)"
return formatted + ' (' + statVal + ' days)'
} else {
return formatted + " (" + statVal + " day)"
return formatted + ' (' + statVal + ' day)'
}
}

Expand All @@ -1358,4 +1358,4 @@ export const getRegularEstimateReviewDate = (state: StateIF): string => {
const statVal = getStats(state)?.regular_wait_time
if (statVal > 0) return formatDate(statVal)
return '-'
}
}
3 changes: 2 additions & 1 deletion app/src/store/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Loading