Skip to content
3 changes: 2 additions & 1 deletion app/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ VUE_APP_REGISTRY_HOME_URL="https://dev.bcregistry.gov.bc.ca/"
VUE_APP_AUTH_WEB_URL="https://dev.account.bcregistry.gov.bc.ca/"
VUE_APP_BUSINESSES_URL="https://dev.account.bcregistry.gov.bc.ca/"
VUE_APP_CORPORATE_ONLINE_URL="https://www.corporateonline.gov.bc.ca"
VUE_APP_DASHBOARD_URL="https://dev.business.bcregistry.gov.bc.ca/"
VUE_APP_BUSINESS_DASH_URL="https://dev.business-dashboard.bcregistry.gov.bc.ca/"
VUE_APP_BUSINESS_REGISTRY_URL="https://dev.business-registry-dashboard.bcregistry.gov.bc.ca/"
VUE_APP_ENTITY_SELECTOR_URL="https://entity-selection-dev.apps.silver.devops.gov.bc.ca/"
VUE_APP_PAYMENT_PORTAL_URL="https://dev.account.bcregistry.gov.bc.ca/makepayment/"
VUE_APP_SITEMINDER_LOGOUT_URL="https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi"
Expand Down
3 changes: 2 additions & 1 deletion app/devops/vaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ VUE_APP_REGISTRY_HOME_URL="op://web-url/$APP_ENV/registry/REGISTRY_HOME_URL"
VUE_APP_AUTH_WEB_URL="op://web-url/$APP_ENV/auth-web/AUTH_WEB_URL"
VUE_APP_BUSINESSES_URL="op://web-url/$APP_ENV/business/BUSINESSES_URL"
VUE_APP_CORPORATE_ONLINE_URL="op://web-url/$APP_ENV/bcregistry/COLIN_URL"
VUE_APP_DASHBOARD_URL="op://web-url/$APP_ENV/business-dash/BUSINESS_DASH_URL"
VUE_APP_BUSINESS_DASH_URL="op://web-url/$APP_ENV/business-dash/BUSINESS_DASH_URL"
VUE_APP_BUSINESS_REGISTRY_URL="op://web-url/$APP_ENV/business-registry-ui/BUSINESS_REGISTRY_URL"
VUE_APP_ENTITY_SELECTOR_URL="op://web-url/$APP_ENV/entity-selector/ENTITY_SELECTOR_URL"
VUE_APP_PAYMENT_PORTAL_URL="op://web-url/$APP_ENV/pay/PAYMENT_PORTAL_URL"
VUE_APP_SITEMINDER_LOGOUT_URL="op://web-url/$APP_ENV/siteminder/SITEMINDER_LOGOUT_URL"
Expand Down
23 changes: 13 additions & 10 deletions app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
// libraries, etc
import { Component, Mixins } from 'vue-property-decorator'
import { Action, Getter } from 'vuex-class'
import { GetFeatureFlag } from '@/plugins'
import { GetFeatureFlag, Navigate } from '@/plugins'
import { DateMixin, LoadKeycloakRolesMixin, NrAffiliationMixin, UpdateUserMixin } from '@/mixins'
import { Routes } from '@/enums'
import { BreadcrumbIF } from '@/interfaces'
Expand Down Expand Up @@ -262,14 +262,6 @@ export default class App extends Mixins(
this.loadKeycloakRoles()
await this.updateUser()

// if there is stored NR data to process then affiliate it now
const nr = JSON.parse(sessionStorage.getItem('NR_DATA'))
if (nr) {
await this.createAffiliation(nr)
// clear NR data for next time
sessionStorage.removeItem('NR_DATA')
}

// if there is stored legal type and request action cd, try to continue
const legaltype = sessionStorage.getItem('LEGAL_TYPE')
const requestActionCd = sessionStorage.getItem('REQUEST_ACTION_CD')
Expand All @@ -291,7 +283,7 @@ export default class App extends Mixins(
} else if (this.isContinuationIn) {
this.setContinuationInErrorStatus(true)
}
console.error(error)
console.error(error) // eslint-disable-line no-console
}
}

Expand All @@ -310,6 +302,17 @@ export default class App extends Mixins(
this.fetchAuthorizedActions()
}

Comment thread
severinbeauvais marked this conversation as resolved.
mounted (): void {
// if there is stored NR data to process then affiliate it now
const nr = JSON.parse(sessionStorage.getItem('NR_DATA'))
if (nr) {
// Use the new "magic link routes" in the BRD to perform the affiliations and draft creations.
Navigate(this.magicLink(nr))
// clear NR data for next time
sessionStorage.removeItem('NR_DATA')
}
}
Comment thread
severinbeauvais marked this conversation as resolved.

/** Fetches and stores the current JS date. */
private async updateCurrentJsDate (): Promise<void> {
// don't run in Jest tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ export default class ExistingRequestDisplay extends Mixins(
/** Affiliates the current NR if authenticated, or prompts login if unauthenticated. */
private async affiliateOrLogin (): Promise<any> {
if (this.isAuthenticated) {
await this.createAffiliation(this.nr)
// Use the new "magic link routes" in the BRD to perform the affiliations and draft creations.
Navigate(this.magicLink(this.nr))
} else {
// persist NR in session for affiliation upon authentication via Signin component
sessionStorage.setItem('NR_DATA', JSON.stringify(this.nr))
Expand Down
30 changes: 30 additions & 0 deletions app/src/mixins/common-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,34 @@ export class CommonMixin extends Vue {
scrollTo (id: string): void {
return document.getElementById(id)?.scrollIntoView()
}

/** Get a magic link. */
magicLink (nr: any): string {
const businessRegistryUrl = sessionStorage.getItem('BUSINESS_REGISTRY_URL')
const accountId = +JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id || 0
const phone = nr.applicants?.phoneNumber || ''
let magic_link_route = ''
switch (nr.request_action_cd) {
case NrRequestActionCodes.NEW_BUSINESS:
magic_link_route = [EntityTypes.SP, EntityTypes.GP].includes(nr.entity_type_cd)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please test with a SP and a GP.

I just want to be certain that the correct types are being used here (since Namrequest/Namex use their own, partly overlapping and partly conflicting, enum), even though it looks like you're using the right code from the processed NR.

? 'registerNow'
Comment thread
JazzarKarim marked this conversation as resolved.
: 'incorporateNow'
break
case NrRequestActionCodes.AMALGAMATE:
magic_link_route = 'amalgamateNow'
break
case NrRequestActionCodes.MOVE:
magic_link_route = 'continueInNow'
break
default:
throw new Error(`No route defined for action code '${nr.request_action_cd}' for the magic link.`)
}
Comment thread
severinbeauvais marked this conversation as resolved.

return (
`${businessRegistryUrl}${magic_link_route}` +
`?nr=${encodeURIComponent(nr.nrNum)}` +
`&phone=${encodeURIComponent(phone)}` +
`&accountid=${encodeURIComponent(accountId)}`
)
}
}
6 changes: 3 additions & 3 deletions app/src/mixins/nr-affiliation-mixin.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we now redirect to a magic link to create a business from a NR, can a bunch of code be deleted from this mixin ?

Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ export class NrAffiliationMixin extends Mixins(CommonMixin) {
return businessRequest
}

/** Navigates to entity dashboard (Filings UI). */
/** Navigates to entity dashboard (BUSINESS_DASHBOARD UI). */
goToEntityDashboard (businessId: string): void {
if (businessId) {
const dashboardUrl = sessionStorage.getItem('DASHBOARD_URL')
Navigate(`${dashboardUrl}${businessId}`)
const businessDashUrl = sessionStorage.getItem('BUSINESS_DASH_URL')
Navigate(`${businessDashUrl}${businessId}`)
Comment thread
severinbeauvais marked this conversation as resolved.
}
}

Expand Down
7 changes: 5 additions & 2 deletions app/src/plugins/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ export async function getConfig (): Promise<EnvConfigI> {
const corporateOnlineUrl: string = process.env.VUE_APP_CORPORATE_ONLINE_URL
sessionStorage.setItem('CORPORATE_ONLINE_URL', corporateOnlineUrl)

const dashboardUrl: string = process.env.VUE_APP_DASHBOARD_URL
sessionStorage.setItem('DASHBOARD_URL', dashboardUrl)
const businessDashUrl: string = process.env.VUE_APP_BUSINESS_DASH_URL
sessionStorage.setItem('BUSINESS_DASH_URL', businessDashUrl)

const businessRegistryUrl: string = process.env.VUE_APP_BUSINESS_REGISTRY_URL
sessionStorage.setItem('BUSINESS_REGISTRY_URL', businessRegistryUrl)
Comment thread
severinbeauvais marked this conversation as resolved.

const legalApiUrl: string = process.env.VUE_APP_LEGAL_API_URL + process.env.VUE_APP_LEGAL_API_VERSION_2
sessionStorage.setItem('LEGAL_API_URL', legalApiUrl)
Expand Down
7 changes: 4 additions & 3 deletions app/src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,10 @@ const getMatchesRestricted = async (
token: string,
cleanedName: string
): Promise<ParsedRestrictedResponseIF> => {
const restrictedResp = await NamexServices.axios.get(`${appBaseURL}/documents:restricted_words?content=${cleanedName}`, {
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }
}).catch(() => {
const restrictedResp = await NamexServices.axios.get(
`${appBaseURL}/documents:restricted_words?content=${cleanedName}`,
{ headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' } }
).catch(() => {
commit('mutateNameCheckErrorAdd', NameCheckErrorType.ERROR_RESTRICTED)
return null
})
Expand Down
8 changes: 0 additions & 8 deletions app/src/views/auth/Signin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ export default class Signin extends Mixins(LoadKeycloakRolesMixin, NrAffiliation
this.loadKeycloakRoles()
await this.updateUser()

// if there is stored NR data to process then affiliate it now
const nr = JSON.parse(sessionStorage.getItem('NR_DATA'))
if (nr) {
await this.createAffiliation(nr)
// clear NR data for next time
sessionStorage.removeItem('NR_DATA')
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please test this by:

  1. make sure you are not logged in
  2. create a NR
  3. in a different window (as staff), examine and approve the NR
  4. in the original window, reload the NR (see example below)
  5. click Register Your Business
  6. log in
  7. when you are returned to Namerequest UI, is the Nr handled automatically? (it might be this signin code, or it might be the created/mounted code)
image image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried this (in Dev) and it failed, but the task trace shows that it came through created (not signin), so this may be OK.

Can you think of any other path that would hit signin before (or instead of) created?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, the long-standing bug where the current account is not fetched (because it needs to be awaited) still exists. Note that the account/org id is 0 in this failed call:

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find an existing ticket for the account id bug so I created this one:
https://app.zenhub.com/workspaces/names-team-board-new-655554cbddd49510027dad2e/issues/gh/bcgov/entity/29636

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like Bobby to test this but I think it's resolved. Let me know what you find.

// go to main app page
await this.$router.push('/')
}
Expand Down
9 changes: 5 additions & 4 deletions app/tests/unit/analyze-results.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import AnalyzeResults from '@/components/new-request/analyze-results.vue'
import testData from './api/get-name-analysis'
import { createLocalVue, mount } from '@vue/test-utils'
// import AnalyzeResults from '@/components/new-request/analyze-results.vue'
// import testData from './api/get-name-analysis'
import { createLocalVue } from '@vue/test-utils'
// import { mount } from '@vue/test-utils'
// import newReqModule from '@/store/new-request-module'
import Vuetify from 'vuetify'

document['getSelection'] = jest.fn()

const localVue = createLocalVue()
localVue.use(Vuetify)
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I would ask for unused code to be deleted instead of commented out...

However, this is Namerequest UI, and I know the test suites are incomplete, so it's possible the unused code will one day be used. Hence, I'm OK with the commented-out code in this special case.


// function setState (data) {
// newReqModule.mutateEntityType('CR')
Expand Down
7 changes: 4 additions & 3 deletions app/tests/unit/applicant-info-1.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import ApplicantInfo1 from '@/components/common/applicant-info-1.vue'
import { createLocalVue, shallowMount, mount } from '@vue/test-utils'
// import ApplicantInfo1 from '@/components/common/applicant-info-1.vue'
import { createLocalVue } from '@vue/test-utils'
// import { shallowMount, mount } from '@vue/test-utils'
import Vuetify from 'vuetify'

// Prevent the warning "[Vuetify] Unable to locate target [data-app]"
document.body.setAttribute('data-app', 'true')

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

Expand Down
9 changes: 5 additions & 4 deletions app/tests/unit/applicant-info-2.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import ApplicantInfo2 from '@/components/common/applicant-info-2.vue'
import { createLocalVue, shallowMount, mount } from '@vue/test-utils'
// import ApplicantInfo2 from '@/components/common/applicant-info-2.vue'
import { createLocalVue } from '@vue/test-utils'
// import { shallowMount, mount } from '@vue/test-utils'
// import module from '@/store/new-request-module'
import Vuetify from 'vuetify'
import Vuex from 'vuex'
// import Vuex from 'vuex'

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()
localVue.use(Vuetify)

describe('ApplicantInfo2 component', () => {
Expand Down
7 changes: 4 additions & 3 deletions app/tests/unit/dialogs/nr-not-required.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { createLocalVue, mount } from '@vue/test-utils'
import { createLocalVue } from '@vue/test-utils'
// import { mount } from '@vue/test-utils'
import Vuetify from 'vuetify'
import { NrNotRequiredDialog } from '@/components/dialogs'
// import { NrNotRequiredDialog } from '@/components/dialogs'

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

Expand Down
8 changes: 5 additions & 3 deletions app/tests/unit/dialogs/pick-entity-or-conversion.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { mount, createLocalVue } from '@vue/test-utils'
import { createLocalVue } from '@vue/test-utils'
// import { mount } from '@vue/test-utils'

import Vuetify from 'vuetify'
import { PickEntityOrConversionDialog } from '@/components/dialogs'
// import { PickEntityOrConversionDialog } from '@/components/dialogs'
// import newReqModule from '@/store/new-request-module'

// Prevent the warning "[Vuetify] Unable to locate target [data-app]"
document.body.setAttribute('data-app', 'true')

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

Expand Down
25 changes: 13 additions & 12 deletions app/tests/unit/landing.spec.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import Vuetify from 'vuetify'
import { Landing } from '@/views'
import AnalyzeResults from './mocks/analyze-results.vue'
import { mount, createLocalVue } from '@vue/test-utils'
// import { Landing } from '@/views'
// import AnalyzeResults from './mocks/analyze-results.vue'
import { createLocalVue } from '@vue/test-utils'
// import { mount } from '@vue/test-utils'
// import newReqModule from '@/store/new-request-module'
import LowerContainer from '@/components/lower-info-area/lower-container.vue'
// import LowerContainer from '@/components/lower-info-area/lower-container.vue'

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

const stubs = {
AnalyzeCharacters: true,
AnalyzeResults,
LowerContainer,
Stats: true,
quillEditor: true
}
// const stubs = {
// AnalyzeCharacters: true,
// AnalyzeResults,
// LowerContainer,
// Stats: true,
// quillEditor: true
// }

describe('Landing view', () => {
it('is an empty test', () => {})
Expand Down
9 changes: 5 additions & 4 deletions app/tests/unit/link-row.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Vue from 'vue'
import { createLocalVue, mount } from '@vue/test-utils'
import LinkRow from '@/components/common/link-row.vue'
// import Vue from 'vue'
import { createLocalVue } from '@vue/test-utils'
// import { mount } from '@vue/test-utils'
// import LinkRow from '@/components/common/link-row.vue'
// import newReqModule from '@/store/new-request-module'
import Vuetify from 'vuetify'

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

Expand Down
13 changes: 7 additions & 6 deletions app/tests/unit/name-build-info.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Vue from 'vue'
import { createLocalVue, mount } from '@vue/test-utils'
// import Vue from 'vue'
import { createLocalVue } from '@vue/test-utils'
// import { mount } from '@vue/test-utils'
import Vuetify from 'vuetify'
import NameBuildInfo from '@/components/lower-info-area/name-build-info.vue'
import { BusinessDesignation, ConsentWords, ExampleName, UnavailableWords, UniqueNames, UnknownWords }
from '@/components/lower-info-area/name-build-sub-components'
// import NameBuildInfo from '@/components/lower-info-area/name-build-info.vue'
// import { BusinessDesignation, ConsentWords, ExampleName, UnavailableWords, UniqueNames, UnknownWords }
// from '@/components/lower-info-area/name-build-sub-components'

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

Expand Down
7 changes: 4 additions & 3 deletions app/tests/unit/name-input.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { createLocalVue, mount, shallowMount } from '@vue/test-utils'
import NameInput from '@/components/new-request/name-input.vue'
import { createLocalVue } from '@vue/test-utils'
// import { mount, shallowMount } from '@vue/test-utils'
// import NameInput from '@/components/new-request/name-input.vue'
// import newReqModule from '@/store/new-request-module'
import Vuetify from 'vuetify'

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

Expand Down
7 changes: 4 additions & 3 deletions app/tests/unit/names-capture.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import NamesCapture from '@/components/common/names-capture.vue'
import { createLocalVue, shallowMount, mount } from '@vue/test-utils'
// import NamesCapture from '@/components/common/names-capture.vue'
import { createLocalVue } from '@vue/test-utils'
// import { shallowMount, mount } from '@vue/test-utils'
// import store from '@/store/new-request-module'
import Vuetify from 'vuetify'

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

Expand Down
7 changes: 4 additions & 3 deletions app/tests/unit/new-search.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { createLocalVue, mount, shallowMount } from '@vue/test-utils'
import NewSearch from '@/components/new-request/search.vue'
import { createLocalVue } from '@vue/test-utils'
// import { mount, shallowMount } from '@vue/test-utils'
// import NewSearch from '@/components/new-request/search.vue'
// import newReqModule from '@/store/new-request-module'
import Vuetify from 'vuetify'

const localVue = createLocalVue()
const vuetify = new Vuetify()
// const vuetify = new Vuetify()

localVue.use(Vuetify)

Expand Down
Loading
Loading