diff --git a/.env.example b/.env.example index 700fe6c7..346d5cf5 100644 --- a/.env.example +++ b/.env.example @@ -1,22 +1,22 @@ # Base Path Openshift: /businesses/edit Firebase: / VUE_APP_PATH="/" -#vaults Shared +# vaults Shared VUE_APP_ADDRESS_COMPLETE_KEY= -#vaults web-url +# vaults web-url 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_DASHBOARD_URL="https://dev.business.bcregistry.gov.bc.ca/" +VUE_APP_DASHBOARD_URL="https://business-filings-le-dev.web.app/" VUE_APP_SITEMINDER_LOGOUT_URL="https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi" -#vaults API +# vaults API VUE_APP_AUTH_API_URL="https://auth-api-dev.apps.silver.devops.gov.bc.ca" VUE_APP_AUTH_API_VERSION="/api/v1" -VUE_APP_LEGAL_API_URL="https://legal-api-dev.apps.silver.devops.gov.bc.ca" +VUE_APP_LEGAL_API_URL="https://business-api-dev-dy4loprnwa-nn.a.run.app" VUE_APP_LEGAL_API_VERSION_2="/api/v2" -VUE_APP_NAICS_API_URL="https://legal-api-dev.apps.silver.devops.gov.bc.ca" +VUE_APP_NAICS_API_URL="https://business-api-dev-dy4loprnwa-nn.a.run.app" VUE_APP_NAICS_API_VERSION_2="/api/v2" VUE_APP_STATUS_API_URL="https://status-api-dev.apps.silver.devops.gov.bc.ca" VUE_APP_STATUS_API_VERSION="/api/v1" @@ -26,16 +26,16 @@ VUE_APP_REGISTRIES_SEARCH_API_URL="https://bcregistry-dev.apigee.net/registry-se VUE_APP_REGISTRIES_SEARCH_API_VERSION="/api/v1" VUE_APP_REGISTRIES_SEARCH_API_KEY= -#vaults launchdarkly +# vaults launchdarkly VUE_APP_BUSINESS_EDIT_LD_CLIENT_ID="642af8daefad6f134479c602" -#vaults keycloak +# vaults keycloak VUE_APP_KEYCLOAK_AUTH_URL="https://dev.loginproxy.gov.bc.ca/auth" VUE_APP_KEYCLOAK_REALM="bcregistry" VUE_APP_KEYCLOAK_CLIENTID="entity-web" -#vaults sentry +# vaults sentry VUE_APP_SENTRY_DSN= -#vaults hotjar +# vaults hotjar VUE_APP_HOTJAR_ID= diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6a69a3e4..356400b5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,9 +1,9 @@ -name: BUSINESS EDIT UI CD +name: BUSINESS EDIT UI CD - legal name on: push: branches: - - main + - feature-legal-name workflow_dispatch: inputs: environment: @@ -27,6 +27,6 @@ jobs: environment: ${{ inputs.environment }} tagname: ${{ inputs.tagname }} secrets: - APP_NAME: "business-edit" + APP_NAME: "business-edit-le" OP_CONNECT_URL: ${{ secrets.OP_CONNECT_URL }} OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }} diff --git a/devops/vaults.env b/devops/vaults.env index 4f8c4533..7d678238 100644 --- a/devops/vaults.env +++ b/devops/vaults.env @@ -1,23 +1,23 @@ # Base Path Openshift: /businesses/edit Firebase: / VUE_APP_PATH="/" -#vaults Shared +# vaults Shared VUE_APP_ADDRESS_COMPLETE_KEY="op://canadapost/$APP_ENV/address-key/ADDRESS_COMPLETE_KEY" -#vaults web-url +# vaults web-url 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_DASHBOARD_URL="op://web-url/$APP_ENV/business/DASHBOARD_URL" +VUE_APP_DASHBOARD_URL="op://web-url/$APP_ENV/business-le/DASHBOARD_URL" VUE_APP_SITEMINDER_LOGOUT_URL="op://web-url/$APP_ENV/siteminder/SITEMINDER_LOGOUT_URL" -#vaults API +# vaults API VUE_APP_AUTH_API_URL="op://API/$APP_ENV/auth-api/AUTH_API_URL" VUE_APP_AUTH_API_VERSION="op://API/$APP_ENV/auth-api/AUTH_API_VERSION" -VUE_APP_LEGAL_API_URL="op://API/$APP_ENV/legal-api/LEGAL_API_URL" -VUE_APP_LEGAL_API_VERSION_2="op://API/$APP_ENV/legal-api/LEGAL_API_VERSION_2" -VUE_APP_NAICS_API_URL="op://API/$APP_ENV/naics-api/NAICS_API_URL" -VUE_APP_NAICS_API_VERSION_2="op://API/$APP_ENV/naics-api/NAICS_API_VERSION" +VUE_APP_LEGAL_API_URL="op://API/$APP_ENV/legal-api-le/LEGAL_API_URL" +VUE_APP_LEGAL_API_VERSION_2="op://API/$APP_ENV/legal-api-le/LEGAL_API_VERSION_2" +VUE_APP_NAICS_API_URL="op://API/$APP_ENV/naics-api-le/NAICS_API_URL" +VUE_APP_NAICS_API_VERSION_2="op://API/$APP_ENV/naics-api-le/NAICS_API_VERSION" VUE_APP_STATUS_API_URL="op://API/$APP_ENV/status-api/STATUS_API_URL" VUE_APP_STATUS_API_VERSION="op://API/$APP_ENV/status-api/STATUS_API_VERSION" VUE_APP_PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL" @@ -26,16 +26,16 @@ VUE_APP_REGISTRIES_SEARCH_API_URL="op://API/$APP_ENV/registries-search-api/REGIS VUE_APP_REGISTRIES_SEARCH_API_VERSION="op://API/$APP_ENV/registries-search-api/REGISTRIES_SEARCH_API_VERSION" VUE_APP_REGISTRIES_SEARCH_API_KEY="op://API/$APP_ENV/registries-search-api/REGISTRIES_SEARCH_API_KEY" -#vaults launchdarkly +# vaults launchdarkly VUE_APP_BUSINESS_EDIT_LD_CLIENT_ID="op://launchdarkly/$APP_ENV/business-edit/BUSINESS_EDIT_LD_CLIENT_ID" -#vaults keycloak +# vaults keycloak VUE_APP_KEYCLOAK_AUTH_URL="op://keycloak/$APP_ENV/base/KEYCLOAK_AUTH_BASE_URL" VUE_APP_KEYCLOAK_REALM="op://keycloak/$APP_ENV/base/KEYCLOAK_REALMNAME" VUE_APP_KEYCLOAK_CLIENTID="op://keycloak/$APP_ENV/entity-web/UI_KEYCLOAK_RESOURCE_NAME" -#vaults sentry +# vaults sentry VUE_APP_SENTRY_DSN="op://sentry/$APP_ENV/entity/SENTRY_DSN" -#vaults hotjar (hotjar id - ready to use) +# vaults hotjar (hotjar id - ready to use) VUE_APP_HOTJAR_ID= \ No newline at end of file diff --git a/firebase.json b/firebase.json index 07668cb2..13581a26 100644 --- a/firebase.json +++ b/firebase.json @@ -20,7 +20,7 @@ { "key" : "X-XSS-Protection", "value" : "1; mode=block" }, { "key": "Content-Security-Policy", - "value": "default-src 'self'; frame-src 'self' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; style-src 'self' 'unsafe-inline' *.cloudflare.com *.googleapis.com; font-src 'self' *.gov.bc.ca *.hotjar.com *.cloudflare.com *.googleapis.com *.gstatic.com *.jsdelivr.net; img-src 'self' *.postescanada-canadapost.ca https://*.cac1.pure.cloud data: *.hotjar.com https://*.cac1.pure.cloud; connect-src 'self' *.gov.bc.ca *.launchdarkly.com *.hotjar.com *.postescanada-canadapost.ca *.sentry.io *.apigee.net wss://*.hotjar.com *.hotjar.io https://*.nr-data.net https://shyrka-prod-cac1.s3.ca-central-1.amazonaws.com https://*.newrelic.com https://*.cac1.pure.cloud wss://*.cac1.pure.cloud; manifest-src 'self'; media-src 'self' https://*.cac1.pure.cloud; object-src 'self' https://*.cac1.pure.cloud; child-src 'self' https://*.cac1.pure.cloud;" + "value": "default-src 'self'; frame-src 'self' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; style-src 'self' 'unsafe-inline' *.cloudflare.com *.googleapis.com; font-src 'self' *.gov.bc.ca *.hotjar.com *.cloudflare.com *.googleapis.com *.gstatic.com *.jsdelivr.net; img-src 'self' *.postescanada-canadapost.ca https://*.cac1.pure.cloud data: *.hotjar.com https://*.cac1.pure.cloud; connect-src 'self' *.gov.bc.ca https://*.run.app *.launchdarkly.com *.hotjar.com *.postescanada-canadapost.ca *.sentry.io *.apigee.net wss://*.hotjar.com *.hotjar.io https://*.nr-data.net https://shyrka-prod-cac1.s3.ca-central-1.amazonaws.com https://*.newrelic.com https://*.cac1.pure.cloud wss://*.cac1.pure.cloud; manifest-src 'self'; media-src 'self' https://*.cac1.pure.cloud; object-src 'self' https://*.cac1.pure.cloud; child-src 'self' https://*.cac1.pure.cloud;" }, { "key": "Cache-Control", "value": "no-cache, no-store, must-revalidate"}, { "key": "Pragma", "value": "no-cache"}, diff --git a/package-lock.json b/package-lock.json index 420c8fc4..a2568ee2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-edit-ui", - "version": "4.7.16", + "version": "5.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-edit-ui", - "version": "4.7.16", + "version": "5.0.2", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/action-chip": "1.1.5", @@ -22,7 +22,7 @@ "@bcrs-shared-components/court-order-poa": "2.1.3", "@bcrs-shared-components/date-picker": "1.2.5", "@bcrs-shared-components/detail-comment": "1.1.3", - "@bcrs-shared-components/enums": "1.0.46", + "@bcrs-shared-components/enums": "1.1.9", "@bcrs-shared-components/fee-summary": "1.2.5", "@bcrs-shared-components/folio-number": "1.1.1", "@bcrs-shared-components/help-business-number": "1.1.1", @@ -354,17 +354,17 @@ } }, "node_modules/@bcrs-shared-components/enums": { - "version": "1.0.46", - "resolved": "https://registry.npmjs.org/@bcrs-shared-components/enums/-/enums-1.0.46.tgz", - "integrity": "sha512-lrZjTvyDHwZ97Ujsro0pvdemi6n1xSDNeo1OzSGHgf/mokTSfFiVJ0EzuiPxlgBj8VtaPA9PZmGahdrodkPEMg==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@bcrs-shared-components/enums/-/enums-1.1.9.tgz", + "integrity": "sha512-rYmRG0QH9hMWXRJNrxzNQhM3tT/b6mubfLBREx2ICzUtSIDc9UvQ0VqmyX/q84xQdzAOYqh0Nth9vXYm7Ypdxg==", "dependencies": { - "@bcrs-shared-components/corp-type-module": "^1.0.13" + "@bcrs-shared-components/corp-type-module": "^1.0.15" } }, "node_modules/@bcrs-shared-components/enums/node_modules/@bcrs-shared-components/corp-type-module": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/@bcrs-shared-components/corp-type-module/-/corp-type-module-1.0.13.tgz", - "integrity": "sha512-Wa8H/bxo8GAlcG7YdiP4zl1wzqxewiCO0TC+pBaYUc4+eufuInlS3yYFa9MFg8+vIL/pDfamRtXqdg1I6C6QYA==" + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/@bcrs-shared-components/corp-type-module/-/corp-type-module-1.0.15.tgz", + "integrity": "sha512-g/TcNSR7zJsG2lBjn/NnM+/+k7dJzhAiy5PiPj0ObN56bUV1PrUWVVlg5lz4/JZUEAZetWhwnyAzPVGsn7kr1w==" }, "node_modules/@bcrs-shared-components/fee-summary": { "version": "1.2.5", diff --git a/package.json b/package.json index 007a17c8..ed5caebb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-edit-ui", - "version": "4.7.16", + "version": "5.0.2", "private": true, "appName": "Edit UI", "sbcName": "SBC Common Components", @@ -27,7 +27,7 @@ "@bcrs-shared-components/court-order-poa": "2.1.3", "@bcrs-shared-components/date-picker": "1.2.5", "@bcrs-shared-components/detail-comment": "1.1.3", - "@bcrs-shared-components/enums": "1.0.46", + "@bcrs-shared-components/enums": "1.1.9", "@bcrs-shared-components/fee-summary": "1.2.5", "@bcrs-shared-components/folio-number": "1.1.1", "@bcrs-shared-components/help-business-number": "1.1.1", diff --git a/src/App.vue b/src/App.vue index 7b740e83..f3267f62 100644 --- a/src/App.vue +++ b/src/App.vue @@ -226,7 +226,7 @@ export default class App extends Mixins(CommonMixin, FilingTemplateMixin) { haveData = false /** The Update Current JS Date timer id. */ - private updateCurrentJsDateId = null // may be number or NodeJS.Timeout + private updateCurrentJsDateId = null as any // NodeJS.Timeout /** The route breadcrumbs list. */ get breadcrumbs (): Array { diff --git a/src/components/Alteration/summary/BusinessType.vue b/src/components/Alteration/summary/BusinessType.vue index 6af4f28d..395c956f 100644 --- a/src/components/Alteration/summary/BusinessType.vue +++ b/src/components/Alteration/summary/BusinessType.vue @@ -9,7 +9,7 @@ - Changing from a {{ GetCorpFullDescription(originalLegalType) }} to a + Changing from a {{ GetCorpFullDescription(getOriginalLegalType) }} to a {{ GetCorpFullDescription(getEntityType) }} @@ -38,17 +38,13 @@ diff --git a/src/components/common/ShareStructure/ShareStructures.vue b/src/components/common/ShareStructure/ShareStructures.vue index f42bb9eb..8bd13ddc 100644 --- a/src/components/common/ShareStructure/ShareStructures.vue +++ b/src/components/common/ShareStructure/ShareStructures.vue @@ -69,8 +69,8 @@ export default class ShareStructures extends Mixins(CommonMixin) { @Action(useStore) setValidComponent!: (x: ActionKvIF) => void // Local propertiues - protected isEditing = false - protected showResolutionDateDialog = false + isEditing = false + showResolutionDateDialog = false /** Whether share section is invalid, only when prompted by app. */ get invalidShareSection (): boolean { diff --git a/src/components/common/YourCompany/AssociationType.vue b/src/components/common/YourCompany/AssociationType.vue index 2e89e155..87358400 100644 --- a/src/components/common/YourCompany/AssociationType.vue +++ b/src/components/common/YourCompany/AssociationType.vue @@ -167,7 +167,7 @@ import { Component, Mixins, Watch } from 'vue-property-decorator' import { Action, Getter } from 'pinia-class' import { CoopTypes } from '@/enums' import { CommonMixin } from '@/mixins' -import { ActionKvIF, BusinessInformationIF, EntitySnapshotIF } from '@/interfaces' +import { ActionKvIF, BusinessInformationIF, EmptyBusinessInfo } from '@/interfaces' import { VuetifyRuleFunction } from '@/types' import { CoopTypeToDescription } from '@/utils' import { useStore } from '@/store/store' @@ -180,7 +180,7 @@ export default class AssociationType extends Mixins(CommonMixin) { @Getter(useStore) getComponentValidate!: boolean @Getter(useStore) getEditLabel!: string @Getter(useStore) getEditedLabel!: string - @Getter(useStore) getEntitySnapshot!: EntitySnapshotIF + @Getter(useStore) getOriginalBusinessInfo!: BusinessInformationIF @Getter(useStore) hasAssociationTypeChanged!: boolean /** Global actions */ @@ -235,7 +235,7 @@ export default class AssociationType extends Mixins(CommonMixin) { /** Reset association type value to original */ resetAssociationType () { - this.setBusinessInformation(this.getEntitySnapshot.businessInfo) + this.setBusinessInformation(this.getOriginalBusinessInfo || { ...EmptyBusinessInfo }) this.onComponentValidateChanged() this.isEditingAssociationType = false } diff --git a/src/components/common/YourCompany/BusinessContactInfo.vue b/src/components/common/YourCompany/BusinessContactInfo.vue index d4b35cba..512a9b1d 100644 --- a/src/components/common/YourCompany/BusinessContactInfo.vue +++ b/src/components/common/YourCompany/BusinessContactInfo.vue @@ -54,7 +54,7 @@ export default class BusinessContactInfo extends Mixins(CommonMixin) { @Action(useStore) setValidComponent!: (x: ActionKvIF) => void // Local variable - protected isEditingContact = false + isEditingContact = false /** The section validity state (when prompted by app). */ get invalidSection (): boolean { @@ -77,7 +77,7 @@ export default class BusinessContactInfo extends Mixins(CommonMixin) { } /** On Contact Info Change event, updates auth db and store. */ - protected async onContactInfoChange (contactInfo: ContactPointIF): Promise { + async onContactInfoChange (contactInfo: ContactPointIF): Promise { // do nothing if contact info was not changed if (isEqual(contactInfo, this.getBusinessContact)) return @@ -90,7 +90,7 @@ export default class BusinessContactInfo extends Mixins(CommonMixin) { // reset business contact to previous value const prev = this.getBusinessContact // toggle for reactivity - this.setBusinessContact({}) + this.setBusinessContact({} as ContactPointIF) this.$nextTick(() => this.setBusinessContact(prev)) } } diff --git a/src/components/common/YourCompany/ChangeBusinessType.vue b/src/components/common/YourCompany/ChangeBusinessType.vue index fe994163..b3926047 100644 --- a/src/components/common/YourCompany/ChangeBusinessType.vue +++ b/src/components/common/YourCompany/ChangeBusinessType.vue @@ -284,7 +284,7 @@ import BcRegEntityDetails from '@/components/Alteration/BcRegEntityDetails.vue' import { BcRegContacts } from '@/components/common/' import { CommonMixin } from '@/mixins/' import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/' -import { EntitySnapshotIF, EntityTypeOption, NameRequestIF, ResourceIF } from '@/interfaces/' +import { EntityTypeOption, NameRequestIF, ResourceIF } from '@/interfaces/' import { GetFeatureFlag, ResourceUtilities } from '@/utils' import { useStore } from '@/store/store' @@ -301,18 +301,20 @@ export default class ChangeBusinessType extends Mixins(CommonMixin) { @Prop({ default: false }) readonly invalidSection!: boolean // Global getters - @Getter(useStore) getNameRequestLegalName!: string @Getter(useStore) getEditLabel!: string @Getter(useStore) getEditedLabel!: string - @Getter(useStore) getEntitySnapshot!: EntitySnapshotIF @Getter(useStore) getEntityType!: CorpTypeCd + @Getter(useStore) getNameRequestLegalName!: string @Getter(useStore) getNumberOfDirectors!: number + @Getter(useStore) getOriginalLegalName!: string + @Getter(useStore) getOriginalLegalType!: CorpTypeCd + @Getter(useStore) getOriginalNrNumber!: string @Getter(useStore) getResource!: ResourceIF @Getter(useStore) hasBusinessNameChanged!: boolean @Getter(useStore) hasBusinessTypeChanged!: boolean @Getter(useStore) isBcCompany!: boolean - @Getter(useStore) isBenefitCompany!: boolean @Getter(useStore) isBcUlcCompany!: boolean + @Getter(useStore) isBenefitCompany!: boolean @Getter(useStore) isConflictingLegalType!: boolean @Getter(useStore) isEntityTypeChangedByName!: boolean @Getter(useStore) isNameChangedByType!: boolean @@ -355,7 +357,7 @@ export default class ChangeBusinessType extends Mixins(CommonMixin) { /** Verify New Business name. */ get isNewName (): boolean { return this.getNameRequestLegalName && - (this.getNameRequestLegalName !== this.getEntitySnapshot?.businessInfo?.legalName) + (this.getNameRequestLegalName !== this.getOriginalLegalName) } /** Type change helper information */ @@ -373,10 +375,10 @@ export default class ChangeBusinessType extends Mixins(CommonMixin) { get enableEditButton (): boolean { // Exclude CCC - Originally: isBcCompany || isBcUlcCompany || isBenefitCompany - if (this.getEntitySnapshot?.businessInfo?.legalType === CorpTypeCd.BC_CCC) { + if (this.getOriginalLegalType === CorpTypeCd.BC_CCC) { return false } - return this.supportedEntityTypes?.includes(this.getEntitySnapshot?.businessInfo?.legalType) + return this.supportedEntityTypes?.includes(this.getOriginalLegalType) } get nameRequestRequiredError (): boolean { @@ -387,9 +389,9 @@ export default class ChangeBusinessType extends Mixins(CommonMixin) { if (this.isCommunityContribution || this.isUnlimitedLiability) { return true } - // Named ULC to BC Limited or BC Benefit require a name request. - if (this.getEntitySnapshot?.businessInfo?.legalType === CorpTypeCd.BC_ULC_COMPANY && - (this.isBcLimited || this.isBenefitCompany)) { + // Named ULC to BC Limited require a name request. + if (this.getOriginalLegalType === CorpTypeCd.BC_ULC_COMPANY && + (this.isBcLimited || this.isBenefitCompany)) { return true } return false @@ -401,12 +403,12 @@ export default class ChangeBusinessType extends Mixins(CommonMixin) { /** Reset company type values to original. */ resetType () { - this.setEntityType(this.getEntitySnapshot?.businessInfo?.legalType) + this.setEntityType(this.getOriginalLegalType || null) // reset name request this.setNameRequest({ - legalType: this.getEntitySnapshot?.businessInfo?.legalType, - legalName: this.getEntitySnapshot?.businessInfo?.legalName, - nrNumber: this.getEntitySnapshot?.businessInfo?.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber }) this.setNameChangedByType(false) this.isEditingType = false @@ -419,14 +421,14 @@ export default class ChangeBusinessType extends Mixins(CommonMixin) { this.isEditingType = false if (this.shouldUpdateName()) { - const originalName = this.getEntitySnapshot?.businessInfo.legalName + const originalName = this.getOriginalLegalName const updatedName = this.getUpdatedName(originalName) if (originalName !== updatedName) { const nameRequest = { legalType: this.selectedEntityType, legalName: updatedName, - nrNumber: this.getEntitySnapshot?.businessInfo?.nrNumber + nrNumber: this.getOriginalNrNumber } this.setNameRequest(nameRequest) diff --git a/src/components/common/YourCompany/EntityName.vue b/src/components/common/YourCompany/EntityName.vue index 6f8c870f..42862d6f 100644 --- a/src/components/common/YourCompany/EntityName.vue +++ b/src/components/common/YourCompany/EntityName.vue @@ -251,8 +251,7 @@ import { Component, Mixins, Watch } from 'vue-property-decorator' import { Action, Getter } from 'pinia-class' import { CoopTypes, CorrectNameOptions } from '@/enums/' -import { ActionKvIF, BusinessInformationIF, EntitySnapshotIF, NameRequestApplicantIF, NameRequestIF } - from '@/interfaces/' +import { ActionKvIF, BusinessInformationIF, NameRequestApplicantIF, NameRequestIF } from '@/interfaces/' import CorrectName from '@/components/common/YourCompany/CorrectName/CorrectName.vue' import { NameRequestMixin } from '@/mixins' import DateUtilities from '@/services/date-utilities' @@ -275,11 +274,14 @@ export default class EntityName extends Mixins(NameRequestMixin) { @Getter(useStore) getComponentValidate!: boolean @Getter(useStore) getEditLabel!: string @Getter(useStore) getEditedLabel!: string - @Getter(useStore) getEntitySnapshot!: EntitySnapshotIF @Getter(useStore) getEntityType!: CorpTypeCd @Getter(useStore) getNameRequest!: NameRequestIF @Getter(useStore) getNameRequestLegalName!: string @Getter(useStore) getNameRequestNumber!: string + @Getter(useStore) getOriginalBusinessInfo!: BusinessInformationIF + @Getter(useStore) getOriginalLegalName!: string + @Getter(useStore) getOriginalLegalType!: CorpTypeCd + @Getter(useStore) getOriginalNrNumber!: string @Getter(useStore) hasBusinessNameChanged!: boolean @Getter(useStore) isAlterationFiling!: boolean @Getter(useStore) isConflictingLegalType!: boolean @@ -343,7 +345,7 @@ export default class EntityName extends Mixins(NameRequestMixin) { /** Whether a new business legal name was entered.. */ get isNewName () { const originalName = this.getNameRequestLegalName - const currentName = this.getEntitySnapshot?.businessInfo.legalName + const currentName = this.getOriginalLegalName return (originalName !== currentName) } @@ -399,19 +401,19 @@ export default class EntityName extends Mixins(NameRequestMixin) { /** Reset company name values to original. */ resetName () { - // reset business information, except for association type. - const businessInfo = { ...this.getEntitySnapshot.businessInfo, associationType: this.getAssociationType } + // reset business information, except for association type + const businessInfo = { ...this.getOriginalBusinessInfo, associationType: this.getAssociationType } this.setBusinessInformation(businessInfo) // reset name request this.setNameRequest({ - legalType: this.getEntitySnapshot.businessInfo.legalType, - legalName: this.getEntitySnapshot.businessInfo.legalName, - nrNumber: this.getEntitySnapshot.businessInfo.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber }) if (this.isEntityTypeChangedByName) { - this.setEntityType(this.getEntitySnapshot.businessInfo.legalType) + this.setEntityType(this.getOriginalLegalType || null) this.setEntityTypeChangedByName(false) } diff --git a/src/components/common/YourCompany/FolioInformation.vue b/src/components/common/YourCompany/FolioInformation.vue index 21adf39b..feeb2190 100644 --- a/src/components/common/YourCompany/FolioInformation.vue +++ b/src/components/common/YourCompany/FolioInformation.vue @@ -54,7 +54,7 @@ export default class FolioInformation extends Mixins(CommonMixin) { @Action(useStore) setValidComponent!: (x: ActionKvIF) => void // local properties - protected isEditingFolioNumber = false + isEditingFolioNumber = false /** The section validity state (when prompted by app). */ get invalidSection (): boolean { @@ -84,7 +84,7 @@ export default class FolioInformation extends Mixins(CommonMixin) { } /** On New Folio Number event, updates auth db and store. */ - protected async onNewFolioNumber (folioNumber: string): Promise { + async onNewFolioNumber (folioNumber: string): Promise { // do nothing if folio number was not changed if (folioNumber === this.getFolioNumber) return diff --git a/src/components/common/YourCompany/NatureOfBusiness.vue b/src/components/common/YourCompany/NatureOfBusiness.vue index 99bcd209..e7607d43 100644 --- a/src/components/common/YourCompany/NatureOfBusiness.vue +++ b/src/components/common/YourCompany/NatureOfBusiness.vue @@ -52,7 +52,7 @@ export default class NatureOfBusiness extends Mixins(CommonMixin) { return (this.getComponentValidate && !this.getFlagsCompanyInfo.isValidNatureOfBusiness) } - protected onValidChanged (valid: boolean): void { + onValidChanged (valid: boolean): void { this.setValidComponent({ key: 'isValidNatureOfBusiness', value: valid }) } } diff --git a/src/components/common/YourCompany/OfficeAddresses.vue b/src/components/common/YourCompany/OfficeAddresses.vue index 37a98101..10030cff 100644 --- a/src/components/common/YourCompany/OfficeAddresses.vue +++ b/src/components/common/YourCompany/OfficeAddresses.vue @@ -999,7 +999,7 @@ export default class OfficeAddresses extends Mixins(CommonMixin) { // reset store value // NB: this will cause setLocalProperties() to be called to reset local properties // NB: this will cause updateAddresses() to be called to update state - this.setOfficeAddresses(this.getOriginalOfficeAddresses) + this.setOfficeAddresses(this.getOriginalOfficeAddresses || null) } /** diff --git a/src/enums/index.ts b/src/enums/index.ts index e1cdfd2a..e103b7d0 100644 --- a/src/enums/index.ts +++ b/src/enums/index.ts @@ -18,4 +18,4 @@ export * from './routeNames' // external enum export { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' export { ActionTypes, ApprovalTypes, CorrectNameOptions, EntityStates, FilingCodes, FilingNames, FilingTypes, - RestorationTypes, RelationshipTypes } from '@bcrs-shared-components/enums' + NameTypes, RestorationTypes, RelationshipTypes } from '@bcrs-shared-components/enums' diff --git a/src/enums/nameRequestStates.ts b/src/enums/nameRequestStates.ts index a541cac8..6deceb15 100644 --- a/src/enums/nameRequestStates.ts +++ b/src/enums/nameRequestStates.ts @@ -12,13 +12,13 @@ export enum NameRequestStates { INPROGRESS = 'INPROGRESS', REJECTED = 'REJECTED', NRO_UPDATING = 'NRO_UPDATING', - NO_CONTACT = 'NO_CONTACT', - INCORRECT_CONTACT = 'INCORRECT_CONTACT', // ADDITIONAL UI STATES FOR ERROR HANDLING - NOT_APPROVED = 'NOT_APPROVED', CONSUMED = 'CONSUMED', - NOT_FOUND = 'NOT_FOUND', - NEED_CONSENT = 'NEED_CONSENT', + INCORRECT_CONTACT = 'INCORRECT_CONTACT', INVALID = 'INVALID', + NEED_CONSENT = 'NEED_CONSENT', + NO_CONTACT = 'NO_CONTACT', + NOT_APPROVED = 'NOT_APPROVED', + NOT_FOUND = 'NOT_FOUND', } diff --git a/src/interfaces/correction-interfaces/correct-name-interface.ts b/src/interfaces/correction-interfaces/correct-name-interface.ts index fb4247bb..3c472e0e 100644 --- a/src/interfaces/correction-interfaces/correct-name-interface.ts +++ b/src/interfaces/correction-interfaces/correct-name-interface.ts @@ -11,13 +11,13 @@ export interface CorrectNameOptionIF { } export interface NrCorrectionIF { + applicant: NameRequestApplicantIF + expiry: string, + legalName: string, legalType: CorpTypeCd, nrNumber: string, - legalName: string, - expiry: string, - requestType: string, + requestType: NrRequestActionCodes, status: NameRequestStates, - applicant: NameRequestApplicantIF } export interface NrActionIF { diff --git a/src/interfaces/store-interfaces/state-interfaces/business-information-interface.ts b/src/interfaces/store-interfaces/state-interfaces/business-information-interface.ts index 8743be0c..c3ffc652 100644 --- a/src/interfaces/store-interfaces/state-interfaces/business-information-interface.ts +++ b/src/interfaces/store-interfaces/state-interfaces/business-information-interface.ts @@ -1,5 +1,16 @@ -import { CoopTypes } from '@/enums' +import { CoopTypes, NameTypes } from '@/enums' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' +import { IsoDatePacific, ApiDateTimeUtc } from '@bcrs-shared-components/interfaces' + +/** The Alternate Name object. */ +export interface AlternateNameIF { + entityType: CorpTypeCd + identifier: string + name: string + nameRegisteredDate: ApiDateTimeUtc + nameStartDate: IsoDatePacific + nameType: NameTypes +} /** * Interface for business information object in store @@ -7,6 +18,7 @@ import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' * Ref: https://github.com/bcgov/business-schemas/blob/main/src/registry_schemas/schemas/business.json */ export interface BusinessInformationIF { + alternateNames?: Array foundingDate: string // actually date-time (API format) hasRestrictions?: boolean identifier: string @@ -25,3 +37,11 @@ export interface BusinessInformationIF { naicsDescription?: string naicsKey?: string // from API } + +export const EmptyBusinessInfo: BusinessInformationIF = { + associationType: null, + foundingDate: null, + identifier: '', + legalName: null, + legalType: null +} diff --git a/src/interfaces/store-interfaces/state-model-interface.ts b/src/interfaces/store-interfaces/state-model-interface.ts index 362aaaf1..727a89e2 100644 --- a/src/interfaces/store-interfaces/state-model-interface.ts +++ b/src/interfaces/store-interfaces/state-model-interface.ts @@ -7,6 +7,18 @@ import { AccountInformationIF, AddressesIF, BusinessInformationIF, CertifyIF, import { CompletingPartyIF, ContactPointIF, SpecialResolutionIF, StaffPaymentIF } from '@bcrs-shared-components/interfaces/' +export interface EditingFlagsIF { + companyName: boolean + associationType: boolean + nameTranslations: boolean + officeAddresses: boolean + peopleAndRoles: boolean + shareStructure: boolean + rules: boolean + memorandum: boolean + specialResolution: boolean +} + /** Data object used internally only (not to/from API). */ export interface StateModelIF { currentJsDate: Date @@ -31,17 +43,7 @@ export interface StateModelIF { detailComment: string rules: RulesMemorandumIF memorandum: RulesMemorandumIF - editingFlags: { - companyName: boolean - associationType: boolean - nameTranslations: boolean - officeAddresses: boolean - peopleAndRoles: boolean - shareStructure: boolean - rules: boolean - memorandum: boolean - specialResolution: boolean - } + editingFlags: EditingFlagsIF validationFlags: ValidationFlagsIF summaryMode: boolean, currentFees: FeesIF[], diff --git a/src/main.ts b/src/main.ts index 878bd154..d24f3027 100644 --- a/src/main.ts +++ b/src/main.ts @@ -44,7 +44,6 @@ Vue.use(Vue2Filters) // Default options - https://github.com/apostrophecms/sanitize-html (under Default options) Vue.use(VueSanitize) - const vuetify = new Vuetify({ iconfont: 'mdi', theme: { diff --git a/src/mixins/filing-template-mixin.ts b/src/mixins/filing-template-mixin.ts index a8d956f7..411cc0e4 100644 --- a/src/mixins/filing-template-mixin.ts +++ b/src/mixins/filing-template-mixin.ts @@ -2,12 +2,13 @@ import { Component } from 'vue-property-decorator' import { Action, Getter } from 'pinia-class' import { cloneDeep } from 'lodash' import { DateMixin } from '@/mixins/' -import { AddressesIF, AlterationFilingIF, BusinessInformationIF, CertifyIF, CoopAlterationIF, CorrectionInformationIF, - CorrectionFilingIF, CourtOrderIF, EffectiveDateTimeIF, EntitySnapshotIF, ChgRegistrationFilingIF, ConversionFilingIF, - NameRequestIF, NameTranslationIF, OrgPersonIF, RestorationFilingIF, RestorationStateIF, - SpecialResolutionFilingIF, StateFilingRestorationIF, RulesMemorandumIF } from '@/interfaces/' -import { CompletingPartyIF, ContactPointIF, NaicsIF, ShareClassIF, SpecialResolutionIF, - StaffPaymentIF } from '@bcrs-shared-components/interfaces/' +import { AddressesIF, AlterationFilingIF, BusinessInformationIF, CertifyIF, ChgRegistrationFilingIF, + ConversionFilingIF, CoopAlterationIF, CorrectionFilingIF, CorrectionInformationIF, CourtOrderIF, + EffectiveDateTimeIF, EmptyBusinessInfo, EntitySnapshotIF, NameRequestIF, NameTranslationIF, OrgPersonIF, + RestorationFilingIF, RestorationStateIF, RulesMemorandumIF, SpecialResolutionFilingIF, StateFilingRestorationIF +} from '@/interfaces/' +import { CompletingPartyIF, ContactPointIF, NaicsIF, ShareClassIF, SpecialResolutionIF, StaffPaymentIF } + from '@bcrs-shared-components/interfaces/' import { ActionTypes, ApprovalTypes, CoopTypes, CorrectionErrorTypes, EffectOfOrders, FilingTypes, PartyTypes, RelationshipTypes, RestorationTypes, RoleTypes } from '@/enums/' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' @@ -24,94 +25,99 @@ export default class FilingTemplateMixin extends DateMixin { // Ref: https://pinia.vuejs.org/cookbook/options-api.html#giving-access-to-the-whole-store // Global getters - @Getter(useStore) getEntityType!: CorpTypeCd - @Getter(useStore) getNameRequestNumber!: string - @Getter(useStore) getNameRequestLegalName!: string + @Getter(useStore) areProvisionsRemoved!: boolean + @Getter(useStore) getAssociationType!: CoopTypes + @Getter(useStore) getBusinessContact!: ContactPointIF @Getter(useStore) getBusinessId!: string + @Getter(useStore) getCertifyState!: CertifyIF + @Getter(useStore) getCompletingParty!: CompletingPartyIF @Getter(useStore) getCurrentDate!: string + @Getter(useStore) getCurrentNaics!: NaicsIF @Getter(useStore) getCorrectedFilingDate!: string @Getter(useStore) getCorrectedFilingId!: number @Getter(useStore) getCorrectedFilingType!: FilingTypes @Getter(useStore) getCorrectionErrorType!: CorrectionErrorTypes @Getter(useStore) getCorrectionStartDate!: string - @Getter(useStore) getEffectiveDateTime!: EffectiveDateTimeIF - @Getter(useStore) getDocumentOptionalEmail: string - @Getter(useStore) hasBusinessNameChanged!: boolean - @Getter(useStore) hasBusinessTypeChanged!: boolean - @Getter(useStore) hasNaicsChanged!: boolean - @Getter(useStore) haveNameTranslationsChanged!: boolean - @Getter(useStore) hasShareStructureChanged!: boolean - @Getter(useStore) getOrgPeople!: OrgPersonIF[] - @Getter(useStore) getShareClasses!: ShareClassIF[] - @Getter(useStore) getFolioNumber!: string - @Getter(useStore) getTransactionalFolioNumber!: string - @Getter(useStore) getStaffPayment!: StaffPaymentIF @Getter(useStore) getDetailComment!: string - @Getter(useStore) getCurrentNaics!: NaicsIF - @Getter(useStore) getNameTranslations!: NameTranslationIF[] - @Getter(useStore) getNameRequest!: NameRequestIF - @Getter(useStore) getCertifyState!: CertifyIF - @Getter(useStore) getOfficeAddresses!: AddressesIF - @Getter(useStore) getBusinessContact!: ContactPointIF + @Getter(useStore) getDocumentOptionalEmail: string + @Getter(useStore) getEffectiveDateTime!: EffectiveDateTimeIF @Getter(useStore) getEntitySnapshot!: EntitySnapshotIF - @Getter(useStore) getNewResolutionDates!: string[] - @Getter(useStore) areProvisionsRemoved!: boolean + @Getter(useStore) getEntityType!: CorpTypeCd @Getter(useStore) getFileNumber!: string + @Getter(useStore) getFolioNumber!: string @Getter(useStore) getHasPlanOfArrangement!: boolean - @Getter(useStore) haveOfficeAddressesChanged!: boolean - @Getter(useStore) getCompletingParty!: CompletingPartyIF - @Getter(useStore) isBenBcCccUlcCorrectionFiling!: boolean - @Getter(useStore) isFirmCorrectionFiling!: boolean - @Getter(useStore) isClientErrorCorrection!: boolean - @Getter(useStore) getAssociationType!: CoopTypes - @Getter(useStore) hasAssociationTypeChanged!: boolean - @Getter(useStore) getSpecialResolution!: SpecialResolutionIF - @Getter(useStore) hasBusinessStartDateChanged!: boolean + @Getter(useStore) getLatestResolutionForBusiness!: SpecialResolutionIF + @Getter(useStore) getNameRequest!: NameRequestIF + @Getter(useStore) getNameRequestLegalName!: string + @Getter(useStore) getNameRequestNumber!: string + @Getter(useStore) getNameTranslations!: NameTranslationIF[] + @Getter(useStore) getNewResolutionDates!: string[] + @Getter(useStore) getOfficeAddresses!: AddressesIF + @Getter(useStore) getOrgPeople!: OrgPersonIF[] + @Getter(useStore) getOriginalBusinessInfo!: BusinessInformationIF + @Getter(useStore) getOriginalLegalName!: string + @Getter(useStore) getOriginalLegalType!: CorpTypeCd + @Getter(useStore) getOriginalNrNumber!: string @Getter(useStore) getRestoration!: RestorationStateIF + @Getter(useStore) getShareClasses!: ShareClassIF[] + @Getter(useStore) getSnapshotNaics!: NaicsIF + @Getter(useStore) getSpecialResolution!: SpecialResolutionIF + @Getter(useStore) getSpecialResolutionMemorandum!: RulesMemorandumIF + @Getter(useStore) getSpecialResolutionRules!: RulesMemorandumIF + @Getter(useStore) getStaffPayment!: StaffPaymentIF @Getter(useStore) getStateFilingRestoration!: StateFilingRestorationIF - @Getter(useStore) isLimitedRestorationToFull!: boolean - @Getter(useStore) isEntityTypeFirm!: boolean + @Getter(useStore) getTransactionalFolioNumber!: string + @Getter(useStore) hasAssociationTypeChanged!: boolean + @Getter(useStore) hasBusinessNameChanged!: boolean + @Getter(useStore) hasBusinessStartDateChanged!: boolean + @Getter(useStore) hasBusinessTypeChanged!: boolean + @Getter(useStore) hasNaicsChanged!: boolean + @Getter(useStore) hasShareStructureChanged!: boolean @Getter(useStore) hasSpecialResolutionMemorandumChanged!: boolean + @Getter(useStore) hasSpecialResolutionResolutionChanged!: boolean @Getter(useStore) hasSpecialResolutionRulesChanged!: boolean - @Getter(useStore) getSpecialResolutionMemorandum!: RulesMemorandumIF - @Getter(useStore) getSpecialResolutionRules!: RulesMemorandumIF + @Getter(useStore) haveNameTranslationsChanged!: boolean + @Getter(useStore) haveOfficeAddressesChanged!: boolean + @Getter(useStore) isBenBcCccUlcCorrectionFiling!: boolean + @Getter(useStore) isClientErrorCorrection!: boolean @Getter(useStore) isCoopCorrectionFiling!: boolean - @Getter(useStore) getLatestResolutionForBusiness!: SpecialResolutionIF - @Getter(useStore) hasSpecialResolutionResolutionChanged!: boolean + @Getter(useStore) isEntityTypeFirm!: boolean + @Getter(useStore) isFirmCorrectionFiling!: boolean + @Getter(useStore) isLimitedRestorationToFull!: boolean // Global actions @Action(useStore) setBusinessContact!: (x: ContactPointIF) => void @Action(useStore) setBusinessInformation!: (x: BusinessInformationIF) => void @Action(useStore) setCertifyState!: (x: CertifyIF) => void @Action(useStore) setCorrectionInformation!: (x: CorrectionInformationIF) => void - @Action(useStore) setEntityType!: (x: CorpTypeCd) => void - @Action(useStore) setOfficeAddresses!: (x: AddressesIF) => void - @Action(useStore) setNaics!: (x: NaicsIF) => void - @Action(useStore) setNameTranslations!: (x: NameTranslationIF[]) => void - @Action(useStore) setNameRequest!: (x: NameRequestIF) => void - @Action(useStore) setPeopleAndRoles!: (x: OrgPersonIF[]) => void - @Action(useStore) setShareClasses!: (x: ShareClassIF[]) => void + @Action(useStore) setCorrectionStartDate!: (x: string) => void + @Action(useStore) setDocumentOptionalEmail!: (x: string) => void @Action(useStore) setEffectiveDateTimeString!: (x: string) => void - @Action(useStore) setIsFutureEffective!: (x: boolean) => void - @Action(useStore) setFolioNumber!: (x: string) => void - @Action(useStore) setTransactionalFolioNumber!: (x: string) => void - @Action(useStore) setStaffPayment!: (x: StaffPaymentIF) => void @Action(useStore) setDetailComment!: (x: string) => void @Action(useStore) setEntitySnapshot!: (x: EntitySnapshotIF) => void - @Action(useStore) setDocumentOptionalEmail!: (x: string) => void - @Action(useStore) setProvisionsRemoved!: (x: boolean) => void - @Action(useStore) setNewResolutionDates!: (x: string[]) => void + @Action(useStore) setEntityType!: (x: CorpTypeCd) => void @Action(useStore) setFileNumber!: (x: string) => void + @Action(useStore) setFolioNumber!: (x: string) => void @Action(useStore) setHasPlanOfArrangement!: (x: boolean) => void - @Action(useStore) setSpecialResolution!: (x: SpecialResolutionIF) => void - @Action(useStore) setCorrectionStartDate!: (x: string) => void + @Action(useStore) setIsFutureEffective!: (x: boolean) => void + @Action(useStore) setNaics!: (x: NaicsIF) => void + @Action(useStore) setNameRequest!: (x: NameRequestIF) => void + @Action(useStore) setNameTranslations!: (x: NameTranslationIF[]) => void + @Action(useStore) setNewResolutionDates!: (x: string[]) => void + @Action(useStore) setOfficeAddresses!: (x: AddressesIF) => void + @Action(useStore) setPeopleAndRoles!: (x: OrgPersonIF[]) => void + @Action(useStore) setProvisionsRemoved!: (x: boolean) => void @Action(useStore) setRestorationApprovalType!: (x: ApprovalTypes) => void @Action(useStore) setRestorationCourtOrder!: (x: CourtOrderIF) => void @Action(useStore) setRestorationExpiryDate!: (x: string) => void - @Action(useStore) setRestorationType!: (x: RestorationTypes) => void @Action(useStore) setRestorationRelationships!: (x: RelationshipTypes[]) => void + @Action(useStore) setRestorationType!: (x: RestorationTypes) => void + @Action(useStore) setShareClasses!: (x: ShareClassIF[]) => void + @Action(useStore) setSpecialResolution!: (x: SpecialResolutionIF) => void @Action(useStore) setSpecialResolutionMemorandum!: (x: RulesMemorandumIF) => void @Action(useStore) setSpecialResolutionRules!: (x: RulesMemorandumIF) => void + @Action(useStore) setStaffPayment!: (x: StaffPaymentIF) => void + @Action(useStore) setTransactionalFolioNumber!: (x: string) => void /** The default (hard-coded first line) correction detail comment. */ public get defaultCorrectionDetailComment (): string { @@ -138,10 +144,11 @@ export default class FilingTemplateMixin extends DateMixin { folioNumber: this.getFolioNumber // folio number, unless overridden below }, business: { - foundingDate: this.getEntitySnapshot.businessInfo.foundingDate, - identifier: this.getEntitySnapshot.businessInfo.identifier, - legalName: this.getEntitySnapshot.businessInfo.legalName, - legalType: this.getEntitySnapshot.businessInfo.legalType + // use original properties (not specific getters) + foundingDate: this.getOriginalBusinessInfo?.foundingDate, + identifier: this.getOriginalBusinessInfo?.identifier, + legalName: this.getOriginalBusinessInfo?.legalName, + legalType: this.getOriginalBusinessInfo?.legalType }, correction: { legalType: this.getEntityType, @@ -277,10 +284,11 @@ export default class FilingTemplateMixin extends DateMixin { folioNumber: this.getFolioNumber // business folio number, unless overridden below }, business: { - foundingDate: this.getEntitySnapshot.businessInfo.foundingDate, - identifier: this.getEntitySnapshot.businessInfo.identifier, - legalName: this.getEntitySnapshot.businessInfo.legalName, - legalType: this.getEntitySnapshot.businessInfo.legalType + // use original properties (not specific getters) + foundingDate: this.getOriginalBusinessInfo?.foundingDate, + identifier: this.getOriginalBusinessInfo?.identifier, + legalName: this.getOriginalBusinessInfo?.legalName, + legalType: this.getOriginalBusinessInfo?.legalType }, alteration: { business: { @@ -363,10 +371,11 @@ export default class FilingTemplateMixin extends DateMixin { folioNumber: this.getFolioNumber // business folio number, unless overridden below }, business: { - foundingDate: this.getEntitySnapshot.businessInfo.foundingDate, - identifier: this.getEntitySnapshot.businessInfo.identifier, - legalName: this.getEntitySnapshot.businessInfo.legalName, - legalType: this.getEntitySnapshot.businessInfo.legalType + // use original properties (not specific getters) + foundingDate: this.getOriginalBusinessInfo?.foundingDate, + identifier: this.getOriginalBusinessInfo?.identifier, + legalName: this.getOriginalBusinessInfo?.legalName, + legalType: this.getOriginalBusinessInfo?.legalType }, restoration: { approvalType: this.getRestoration.approvalType, @@ -399,8 +408,8 @@ export default class FilingTemplateMixin extends DateMixin { } else { // Otherwise save default data filing.restoration.nameRequest = { - legalName: this.getEntitySnapshot.businessInfo.legalName, - legalType: this.getEntitySnapshot.businessInfo.legalType + legalName: this.getOriginalLegalName, + legalType: this.getOriginalLegalType } } } @@ -453,11 +462,12 @@ export default class FilingTemplateMixin extends DateMixin { folioNumber: this.getFolioNumber // business folio number, unless overridden below }, business: { - foundingDate: this.getEntitySnapshot.businessInfo.foundingDate, - identifier: this.getEntitySnapshot.businessInfo.identifier, - legalName: this.getEntitySnapshot.businessInfo.legalName, - legalType: this.getEntitySnapshot.businessInfo.legalType, - nrNumber: this.getEntitySnapshot.businessInfo.nrNumber + // use original properties (not specific getters) + foundingDate: this.getOriginalBusinessInfo?.foundingDate, + identifier: this.getOriginalBusinessInfo?.identifier, + legalName: this.getOriginalBusinessInfo?.legalName, + legalType: this.getOriginalBusinessInfo?.legalType, + nrNumber: this.getOriginalBusinessInfo?.nrNumber }, specialResolution: { ...this.getSpecialResolution @@ -545,10 +555,11 @@ export default class FilingTemplateMixin extends DateMixin { folioNumber: this.getFolioNumber // business folio number, unless overridden below }, business: { - foundingDate: this.getEntitySnapshot.businessInfo.foundingDate, - identifier: this.getEntitySnapshot.businessInfo.identifier, - legalName: this.getEntitySnapshot.businessInfo.legalName, - legalType: this.getEntitySnapshot.businessInfo.legalType + // use original properties (not specific getters) + foundingDate: this.getOriginalBusinessInfo?.foundingDate, + identifier: this.getOriginalBusinessInfo?.identifier, + legalName: this.getOriginalBusinessInfo?.legalName, + legalType: this.getOriginalBusinessInfo?.legalType }, changeOfRegistration: { business: { @@ -644,10 +655,11 @@ export default class FilingTemplateMixin extends DateMixin { folioNumber: '' // not applicable to SP/GP }, business: { - foundingDate: this.getEntitySnapshot.businessInfo.foundingDate, - identifier: this.getEntitySnapshot.businessInfo.identifier, - legalName: this.getEntitySnapshot.businessInfo.legalName, - legalType: this.getEntitySnapshot.businessInfo.legalType + // use original properties (not specific getters) + foundingDate: this.getOriginalBusinessInfo?.foundingDate, + identifier: this.getOriginalBusinessInfo?.identifier, + legalName: this.getOriginalBusinessInfo?.legalName, + legalType: this.getOriginalBusinessInfo?.legalType }, conversion: { business: { @@ -733,7 +745,7 @@ export default class FilingTemplateMixin extends DateMixin { // store Business Information for BEN/BC/CCC/ULC corrections if (this.isBenBcCccUlcCorrectionFiling) { this.setBusinessInformation({ - ...entitySnapshot.businessInfo, + ...entitySnapshot?.businessInfo, ...filing.business, ...filing.correction.business }) @@ -741,17 +753,19 @@ export default class FilingTemplateMixin extends DateMixin { if (this.isCoopCorrectionFiling) { this.setBusinessInformation({ - ...entitySnapshot.businessInfo, + ...entitySnapshot?.businessInfo, ...filing.business, ...filing.correction.business, - associationType: filing.correction.cooperativeAssociationType || entitySnapshot.businessInfo.associationType + associationType: ( + filing.correction.cooperativeAssociationType || entitySnapshot?.businessInfo?.associationType || null + ) }) } // store Business Information for firm corrections if (this.isFirmCorrectionFiling) { this.setBusinessInformation({ - ...entitySnapshot.businessInfo, + ...entitySnapshot?.businessInfo, ...filing.business, ...filing.correction.business }) @@ -763,10 +777,7 @@ export default class FilingTemplateMixin extends DateMixin { if (filing.correction.business?.naics) { this.setNaics({ ...filing.correction.business.naics }) } else { - this.setNaics({ - naicsCode: entitySnapshot.businessInfo.naicsCode, - naicsDescription: entitySnapshot.businessInfo.naicsDescription - }) + this.setNaics(this.getSnapshotNaics) } } @@ -774,9 +785,9 @@ export default class FilingTemplateMixin extends DateMixin { this.setNameRequest(cloneDeep( filing.correction.nameRequest || { - legalType: entitySnapshot.businessInfo.legalType, - legalName: entitySnapshot.businessInfo.legalName, - nrNumber: entitySnapshot.businessInfo.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber } )) @@ -800,7 +811,7 @@ export default class FilingTemplateMixin extends DateMixin { if (this.isBenBcCccUlcCorrectionFiling) { this.setNameTranslations(cloneDeep( this.mapNameTranslations(filing.correction.nameTranslations) || - this.mapNameTranslations(entitySnapshot.nameTranslations) || + this.mapNameTranslations(entitySnapshot?.nameTranslations) || [] )) } @@ -808,14 +819,15 @@ export default class FilingTemplateMixin extends DateMixin { // store Office Addresses this.setOfficeAddresses(cloneDeep( filing.correction.offices || - entitySnapshot.addresses + entitySnapshot?.addresses || + null )) // store current Business Contact - this.setBusinessContact({ ...entitySnapshot.authInfo.contact }) + this.setBusinessContact({ ...entitySnapshot?.authInfo?.contact || null }) // store People And Roles - let orgPersons = filing.correction.parties || entitySnapshot.orgPersons + let orgPersons = filing.correction.parties || entitySnapshot?.orgPersons || [] // exclude Completing Party // (it is managed separately and added to the filing in buildCorrectionFiling()) orgPersons = orgPersons.filter(op => !(op?.roles.some(role => role.roleType === RoleTypes.COMPLETING_PARTY))) @@ -825,7 +837,8 @@ export default class FilingTemplateMixin extends DateMixin { if (this.isBenBcCccUlcCorrectionFiling) { this.setShareClasses(cloneDeep( filing.correction.shareStructure?.shareClasses || - entitySnapshot.shareStructure.shareClasses + entitySnapshot?.shareStructure?.shareClasses || + [] )) this.setNewResolutionDates(cloneDeep( filing.correction.shareStructure?.resolutionDates || [] @@ -848,7 +861,7 @@ export default class FilingTemplateMixin extends DateMixin { // store Folio Number // FUTURE: should we store correction.folioNumber instead? - this.setFolioNumber(entitySnapshot.authInfo.folioNumber || '') + this.setFolioNumber(entitySnapshot?.authInfo?.folioNumber || '') // store Effective Date const effectiveDate = this.apiToIso(filing.header.effectiveDate) @@ -873,11 +886,13 @@ export default class FilingTemplateMixin extends DateMixin { this.setEntitySnapshot(entitySnapshot) // store Entity Type - this.setEntityType(filing.alteration.business?.legalType || entitySnapshot.businessInfo.legalType) + this.setEntityType( + filing.alteration.business?.legalType || entitySnapshot?.businessInfo?.legalType || null + ) // store Business Information this.setBusinessInformation({ - ...entitySnapshot.businessInfo, + ...entitySnapshot?.businessInfo, ...filing.business, ...filing.alteration.business }) @@ -886,16 +901,16 @@ export default class FilingTemplateMixin extends DateMixin { this.setNameRequest(cloneDeep( filing.alteration.nameRequest || { - legalType: entitySnapshot.businessInfo.legalType, - legalName: entitySnapshot.businessInfo.legalName, - nrNumber: entitySnapshot.businessInfo.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber } )) // store Name Translations this.setNameTranslations(cloneDeep( this.mapNameTranslations(filing.alteration.nameTranslations) || - this.mapNameTranslations(entitySnapshot.nameTranslations) || + this.mapNameTranslations(entitySnapshot?.nameTranslations) || [] )) @@ -903,18 +918,19 @@ export default class FilingTemplateMixin extends DateMixin { if (filing.alteration.provisionsRemoved) this.setProvisionsRemoved(true) // store Office Addresses **from snapshot** (because we don't change office addresses in an alteration) - this.setOfficeAddresses(cloneDeep(entitySnapshot.addresses)) + this.setOfficeAddresses(cloneDeep(entitySnapshot?.addresses || null)) // store People And Roles **from snapshot** (because we don't change people and roles in an alteration) - this.setPeopleAndRoles(cloneDeep(entitySnapshot.orgPersons)) + this.setPeopleAndRoles(cloneDeep(entitySnapshot?.orgPersons || [])) // store current Business Contact - this.setBusinessContact({ ...entitySnapshot.authInfo.contact }) + this.setBusinessContact({ ...entitySnapshot?.authInfo?.contact || null }) // store Share Classes and Resolution Dates this.setShareClasses(cloneDeep( filing.alteration.shareStructure?.shareClasses || - entitySnapshot.shareStructure?.shareClasses + entitySnapshot?.shareStructure?.shareClasses || + [] )) this.setNewResolutionDates(cloneDeep( filing.alteration.shareStructure?.resolutionDates || [] @@ -928,7 +944,7 @@ export default class FilingTemplateMixin extends DateMixin { // store Folio Number // FUTURE: should we store correction.folioNumber instead? - this.setFolioNumber(entitySnapshot.authInfo.folioNumber || '') + this.setFolioNumber(entitySnapshot?.authInfo?.folioNumber || '') // if Transactional Folio Number was saved then store it if (filing.header.isTransactionalFolioNumber) { @@ -956,15 +972,17 @@ export default class FilingTemplateMixin extends DateMixin { * @param filing the restoration filing */ parseRestorationFiling (filing: RestorationFilingIF): void { - // Get the Entity Snapshot from store - const entitySnapshot = this.getEntitySnapshot + // get the Entity Snapshot from store + const entitySnapshot = this.getEntitySnapshot // may be null // store Entity Type - this.setEntityType(filing.restoration.business?.legalType || entitySnapshot.businessInfo.legalType) + this.setEntityType( + filing.restoration.business?.legalType || this.getOriginalLegalType || null + ) // store Business Information this.setBusinessInformation({ - ...entitySnapshot.businessInfo, + ...entitySnapshot?.businessInfo, ...filing.business, ...filing.restoration.business }) @@ -991,9 +1009,9 @@ export default class FilingTemplateMixin extends DateMixin { this.setNameRequest(cloneDeep( filing.restoration.nameRequest || { - legalType: entitySnapshot.businessInfo.legalType, - legalName: entitySnapshot.businessInfo.legalName, - nrNumber: entitySnapshot.businessInfo.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber } )) @@ -1005,24 +1023,26 @@ export default class FilingTemplateMixin extends DateMixin { // store Name Translations this.setNameTranslations(cloneDeep( this.mapNameTranslations(filing.restoration.nameTranslations) || - this.mapNameTranslations(entitySnapshot.nameTranslations) || + this.mapNameTranslations(entitySnapshot?.nameTranslations) || [] )) // store Office Addresses this.setOfficeAddresses(cloneDeep( filing.restoration.offices || - entitySnapshot.addresses + entitySnapshot?.addresses || + null )) // store People And Roles this.setPeopleAndRoles(cloneDeep( filing.restoration.parties || - entitySnapshot.orgPersons + entitySnapshot?.orgPersons || + [] )) // store current Business Contact - this.setBusinessContact({ ...entitySnapshot.authInfo.contact }) + this.setBusinessContact({ ...entitySnapshot?.authInfo?.contact }) // store Certify State this.setCertifyState({ @@ -1032,7 +1052,7 @@ export default class FilingTemplateMixin extends DateMixin { // store Folio Number // FUTURE: should we store correction.folioNumber instead? - this.setFolioNumber(entitySnapshot.authInfo.folioNumber || '') + this.setFolioNumber(entitySnapshot?.authInfo?.folioNumber || '') // if Transactional Folio Number was saved then store it if (filing.header.isTransactionalFolioNumber) { @@ -1062,23 +1082,27 @@ export default class FilingTemplateMixin extends DateMixin { // NB: filing.alteration object may not be present // store Entity Type - this.setEntityType(filing.alteration?.business?.legalType || entitySnapshot.businessInfo.legalType) + this.setEntityType( + filing.alteration?.business?.legalType || entitySnapshot?.businessInfo?.legalType || null + ) // store Business Information this.setBusinessInformation({ - ...entitySnapshot.businessInfo, + ...entitySnapshot?.businessInfo, ...filing.business, ...filing.alteration?.business, - associationType: filing.alteration?.cooperativeAssociationType || entitySnapshot.businessInfo.associationType + associationType: ( + filing.alteration?.cooperativeAssociationType || entitySnapshot?.businessInfo?.associationType || null + ) }) // store Name Request data this.setNameRequest(cloneDeep( filing.changeOfName?.nameRequest || { - legalType: entitySnapshot.businessInfo.legalType, - legalName: entitySnapshot.businessInfo.legalName, - nrNumber: entitySnapshot.businessInfo.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber } )) @@ -1087,13 +1111,13 @@ export default class FilingTemplateMixin extends DateMixin { this.setSpecialResolution(cloneDeep(filing.specialResolution)) // store Office Addresses **from snapshot** (because we don't change office addresses in an special resolution) - this.setOfficeAddresses(cloneDeep(entitySnapshot.addresses)) + this.setOfficeAddresses(cloneDeep(entitySnapshot?.addresses || null)) // store People And Roles **from snapshot** (because we don't change people and roles in an special resolution) - this.setPeopleAndRoles(cloneDeep(entitySnapshot.orgPersons)) + this.setPeopleAndRoles(cloneDeep(entitySnapshot?.orgPersons || [])) // store current Business Contact - this.setBusinessContact({ ...entitySnapshot.authInfo.contact }) + this.setBusinessContact({ ...entitySnapshot?.authInfo?.contact || null }) // store Certify State this.setCertifyState({ @@ -1103,7 +1127,7 @@ export default class FilingTemplateMixin extends DateMixin { // store Folio Number // FUTURE: should we store correction.folioNumber instead? - this.setFolioNumber(entitySnapshot.authInfo.folioNumber || '') + this.setFolioNumber(entitySnapshot?.authInfo?.folioNumber || '') // if Transactional Folio Number was saved then store it if (filing.header.isTransactionalFolioNumber) { @@ -1127,11 +1151,13 @@ export default class FilingTemplateMixin extends DateMixin { this.setEntitySnapshot(entitySnapshot) // store Entity Type - this.setEntityType(filing.business?.legalType || entitySnapshot.businessInfo.legalType) + this.setEntityType( + filing.business?.legalType || entitySnapshot?.businessInfo?.legalType || null + ) // store Business Information this.setBusinessInformation({ - ...entitySnapshot.businessInfo, + ...entitySnapshot?.businessInfo, ...filing.business }) @@ -1145,9 +1171,9 @@ export default class FilingTemplateMixin extends DateMixin { this.setNameRequest(cloneDeep( filing.changeOfRegistration.nameRequest || { - legalType: entitySnapshot.businessInfo.legalType, - legalName: entitySnapshot.businessInfo.legalName, - nrNumber: entitySnapshot.businessInfo.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber } )) @@ -1158,18 +1184,19 @@ export default class FilingTemplateMixin extends DateMixin { } this.setOfficeAddresses(cloneDeep( addresses || - entitySnapshot.addresses + entitySnapshot?.addresses || + null )) // store People And Roles - let orgPersons = filing.changeOfRegistration.parties || entitySnapshot.orgPersons + let orgPersons = filing.changeOfRegistration.parties || entitySnapshot?.orgPersons || [] // exclude Completing Party // (it is managed separately and added to the filing in buildChangeRegFiling()) orgPersons = orgPersons.filter(op => !(op?.roles.some(role => role.roleType === RoleTypes.COMPLETING_PARTY))) this.setPeopleAndRoles(cloneDeep(orgPersons)) // store current Business Contact - this.setBusinessContact({ ...entitySnapshot.authInfo.contact }) + this.setBusinessContact({ ...entitySnapshot?.authInfo?.contact || null }) // store Certify State this.setCertifyState({ @@ -1179,7 +1206,7 @@ export default class FilingTemplateMixin extends DateMixin { // store Folio Number // FUTURE: should we store correction.folioNumber instead? - this.setFolioNumber(entitySnapshot.authInfo.folioNumber || '') + this.setFolioNumber(entitySnapshot?.authInfo?.folioNumber || '') // if Transactional Folio Number was saved then store it if (filing.header.isTransactionalFolioNumber) { @@ -1194,7 +1221,7 @@ export default class FilingTemplateMixin extends DateMixin { this.setHasPlanOfArrangement(filing.changeOfRegistration.courtOrder?.hasPlanOfArrangement) // store Business Start Date - this.setCorrectionStartDate(filing.changeOfRegistration.startDate || null) + this.setCorrectionStartDate(filing.changeOfRegistration.startDate || '') // store Staff Payment this.storeStaffPayment(filing) @@ -1207,15 +1234,14 @@ export default class FilingTemplateMixin extends DateMixin { */ parseFirmConversionFiling (filing: ConversionFilingIF, entitySnapshot: EntitySnapshotIF): void { // store Entity Snapshot - // make a copy so snapshot objects are different from objects below this.setEntitySnapshot(entitySnapshot) // store Entity Type - this.setEntityType(filing.business?.legalType || entitySnapshot.businessInfo.legalType) + this.setEntityType(filing.business?.legalType || entitySnapshot?.businessInfo?.legalType || null) // store Business Information this.setBusinessInformation({ - ...entitySnapshot.businessInfo, + ...entitySnapshot?.businessInfo, ...filing.business }) @@ -1229,9 +1255,9 @@ export default class FilingTemplateMixin extends DateMixin { this.setNameRequest(cloneDeep( filing.conversion.nameRequest || { - legalType: entitySnapshot.businessInfo.legalType, - legalName: entitySnapshot.businessInfo.legalName, - nrNumber: entitySnapshot.businessInfo.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber } )) @@ -1242,18 +1268,19 @@ export default class FilingTemplateMixin extends DateMixin { } this.setOfficeAddresses(cloneDeep( addresses || - entitySnapshot.addresses + entitySnapshot?.addresses || + null )) // store People And Roles - let orgPersons = filing.conversion.parties || entitySnapshot.orgPersons + let orgPersons = filing.conversion.parties || entitySnapshot?.orgPersons || [] // exclude Completing Party // (it is managed separately and added to the filing in buildConversionFiling()) orgPersons = orgPersons.filter(op => !(op?.roles.some(role => role.roleType === RoleTypes.COMPLETING_PARTY))) this.setPeopleAndRoles(cloneDeep(orgPersons)) // store Business Start Date - this.setCorrectionStartDate(filing.conversion.startDate || null) + this.setCorrectionStartDate(filing.conversion.startDate || '') // store Certify State this.setCertifyState({ @@ -1266,7 +1293,7 @@ export default class FilingTemplateMixin extends DateMixin { } /** - * Parses an entity snapshot into the store. + * Parses an entity snapshot into the store. Used when there isn't a draft. * @param entitySnapshot the latest entity snapshot */ parseEntitySnapshot (entitySnapshot = this.getEntitySnapshot): void { @@ -1274,47 +1301,45 @@ export default class FilingTemplateMixin extends DateMixin { this.setEntitySnapshot(entitySnapshot) // store Folio Number - this.setFolioNumber(entitySnapshot.authInfo.folioNumber || '') + this.setFolioNumber(entitySnapshot?.authInfo?.folioNumber || '') // store Entity Type - this.setEntityType(entitySnapshot.businessInfo.legalType) + this.setEntityType(entitySnapshot?.businessInfo?.legalType || null) // store Business Information - this.setBusinessInformation({ ...entitySnapshot.businessInfo }) + this.setBusinessInformation({ ...entitySnapshot?.businessInfo } || { ...EmptyBusinessInfo }) // store Name Request data this.setNameRequest({ - legalType: entitySnapshot.businessInfo.legalType, - legalName: entitySnapshot.businessInfo.legalName, - nrNumber: entitySnapshot.businessInfo.nrNumber + legalType: this.getOriginalLegalType, + legalName: this.getOriginalLegalName, + nrNumber: this.getOriginalNrNumber }) // store People and Roles - this.setPeopleAndRoles(cloneDeep(entitySnapshot.orgPersons)) + this.setPeopleAndRoles(cloneDeep(entitySnapshot?.orgPersons || [])) // store current Business Contact - this.setBusinessContact({ ...entitySnapshot.authInfo.contact }) + this.setBusinessContact({ ...entitySnapshot?.authInfo?.contact || null }) // store Office Addresses - this.setOfficeAddresses(cloneDeep(entitySnapshot.addresses)) + this.setOfficeAddresses(cloneDeep(entitySnapshot?.addresses || null)) // handle entity-specific values - switch (entitySnapshot.businessInfo.legalType) { + switch (entitySnapshot?.businessInfo?.legalType) { case CorpTypeCd.BENEFIT_COMPANY: case CorpTypeCd.BC_COMPANY: case CorpTypeCd.BC_CCC: case CorpTypeCd.BC_ULC_COMPANY: { // store Name Translations - if (entitySnapshot.nameTranslations) { - // don't need cloneDeep because mapNameTranslations already returns new array - this.setNameTranslations(this.mapNameTranslations(entitySnapshot.nameTranslations) || []) - } + // don't need cloneDeep because mapNameTranslations already returns new array + this.setNameTranslations(this.mapNameTranslations(entitySnapshot?.nameTranslations || [])) // clear Provisions Removed this.setProvisionsRemoved(null) // store Share Classes and clear New Resolution Dates - this.setShareClasses(cloneDeep(entitySnapshot.shareStructure.shareClasses)) + this.setShareClasses(cloneDeep(entitySnapshot?.shareStructure?.shareClasses || [])) this.setNewResolutionDates([]) break @@ -1327,12 +1352,12 @@ export default class FilingTemplateMixin extends DateMixin { } case CorpTypeCd.COOP: { // Note: it's possible for the COOP to have a paper resolution or memorandum, documentsInfo would be empty. - const documentsInfo = entitySnapshot.businessDocuments?.documentsInfo + const documentsInfo = entitySnapshot?.businessDocuments?.documentsInfo this.setSpecialResolutionRules( { name: documentsInfo?.certifiedRules?.name, key: documentsInfo?.certifiedRules?.key || null, - url: entitySnapshot.businessDocuments?.documents?.certifiedRules, + url: entitySnapshot?.businessDocuments?.documents?.certifiedRules, previouslyInResolution: documentsInfo?.certifiedRules?.includedInResolution, uploaded: documentsInfo?.certifiedRules?.uploaded }) @@ -1341,7 +1366,7 @@ export default class FilingTemplateMixin extends DateMixin { { name: documentsInfo?.certifiedMemorandum?.name, key: documentsInfo?.certifiedMemorandum?.key, - url: entitySnapshot.businessDocuments?.documents?.certifiedMemorandum, + url: entitySnapshot?.businessDocuments?.documents?.certifiedMemorandum, previouslyInResolution: documentsInfo?.certifiedMemorandum?.includedInResolution, uploaded: documentsInfo?.certifiedMemorandum?.uploaded }) @@ -1606,10 +1631,12 @@ export default class FilingTemplateMixin extends DateMixin { * @param filingInformation the filing information to parse. * @param entitySnapshot the entity snapshot. */ - storeSpecialResolutionRulesAndMemorandum (filingInformation: CoopAlterationIF | CorrectionInformationIF, - entitySnapshot: EntitySnapshotIF) :void { + storeSpecialResolutionRulesAndMemorandum ( + filingInformation: CoopAlterationIF | CorrectionInformationIF, + entitySnapshot: EntitySnapshotIF + ): void { // Documents Info can possibly be undefined, if the co-op was created via paper. - const documentsInfo = entitySnapshot.businessDocuments?.documentsInfo + const documentsInfo = entitySnapshot?.businessDocuments?.documentsInfo if (filingInformation?.rulesFileKey) { // Scenario 1 - From draft, rules are uploaded in the draft. this.setSpecialResolutionRules( @@ -1627,7 +1654,7 @@ export default class FilingTemplateMixin extends DateMixin { { name: documentsInfo?.certifiedRules?.name, key: documentsInfo?.certifiedRules?.key || null, - url: entitySnapshot.businessDocuments.documents?.certifiedRules, + url: entitySnapshot?.businessDocuments?.documents?.certifiedRules, includedInResolution: true, previouslyInResolution: documentsInfo?.certifiedRules?.includedInResolution, uploaded: documentsInfo?.certifiedRules?.uploaded @@ -1638,7 +1665,7 @@ export default class FilingTemplateMixin extends DateMixin { { name: documentsInfo?.certifiedRules?.name, key: documentsInfo?.certifiedRules?.key || null, - url: entitySnapshot.businessDocuments.documents?.certifiedRules, + url: entitySnapshot?.businessDocuments?.documents?.certifiedRules, includedInResolution: false, previouslyInResolution: documentsInfo?.certifiedRules?.includedInResolution, uploaded: documentsInfo?.certifiedRules?.uploaded @@ -1662,7 +1689,7 @@ export default class FilingTemplateMixin extends DateMixin { { name: documentsInfo?.certifiedMemorandum?.name, key: documentsInfo?.certifiedMemorandum?.key || null, - url: entitySnapshot.businessDocuments.documents?.certifiedMemorandum, + url: entitySnapshot?.businessDocuments?.documents?.certifiedMemorandum, includedInResolution: true, previouslyInResolution: documentsInfo?.certifiedMemorandum?.includedInResolution, uploaded: documentsInfo?.certifiedMemorandum?.uploaded @@ -1673,7 +1700,7 @@ export default class FilingTemplateMixin extends DateMixin { { name: documentsInfo?.certifiedMemorandum?.name, key: documentsInfo?.certifiedMemorandum?.key || null, - url: entitySnapshot.businessDocuments.documents?.certifiedMemorandum, + url: entitySnapshot?.businessDocuments?.documents?.certifiedMemorandum, includedInResolution: false, previouslyInResolution: documentsInfo?.certifiedMemorandum?.includedInResolution, uploaded: documentsInfo?.certifiedMemorandum?.uploaded diff --git a/src/resources/BreadCrumbResources.ts b/src/resources/BreadCrumbResources.ts index 643bd690..a611fd82 100644 --- a/src/resources/BreadCrumbResources.ts +++ b/src/resources/BreadCrumbResources.ts @@ -7,7 +7,7 @@ const store = useStore() /** Returns URL param string with Account ID if present, else empty string. */ function getParams (): string { - const accountId = JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id as string + const accountId = store.getAccountId || 0 return accountId ? `?accountid=${accountId}` : '' } diff --git a/src/store/state/state-model.ts b/src/store/state/state-model.ts index ed79aff9..f5197061 100644 --- a/src/store/state/state-model.ts +++ b/src/store/state/state-model.ts @@ -1,4 +1,4 @@ -import { EmptyFees, EmptyNameRequest, StateModelIF } from '@/interfaces/' +import { EmptyBusinessInfo, EmptyFees, EmptyNameRequest, StateModelIF } from '@/interfaces/' import { StaffPaymentOptions } from '@bcrs-shared-components/enums/' import { EmptyContactPoint } from '@bcrs-shared-components/interfaces/' import { cloneDeep } from 'lodash' @@ -79,13 +79,7 @@ export const stateModel: StateModelIF = { type: '' }, businessContact: { ...EmptyContactPoint }, - businessInformation: { - associationType: null, - foundingDate: null, - identifier: '', - legalName: null, - legalType: null - }, + businessInformation: { ...EmptyBusinessInfo }, correctionInformation: { comment: '', correctedFilingDate: null, diff --git a/src/store/store.ts b/src/store/store.ts index 208b7a2d..e9589794 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -36,7 +36,8 @@ import { ShareClassIF, StateIF, StateFilingRestorationIF, - ValidationFlagsIF } from '@/interfaces/' + ValidationFlagsIF +} from '@/interfaces/' import { CompletingPartyIF, ContactPointIF, @@ -150,26 +151,36 @@ export const useStore = defineStore('store', { return (this.getCorrectedFilingType === FilingTypes.CHANGE_OF_REGISTRATION) }, - /** The original entity type, this is for entity type alteration */ - getOriginLegalType (): CorpTypeCd { - return this.getEntitySnapshot?.businessInfo?.legalType + /** The original business info. NB: may be null. */ + getOriginalBusinessInfo (): BusinessInformationIF { + return this.getEntitySnapshot?.businessInfo || null + }, + + /** The original legal type. */ + getOriginalLegalType (): CorpTypeCd { + return this.getOriginalBusinessInfo?.legalType || null + }, + + /** The original NR number. */ + getOriginalNrNumber (): string { + return this.getOriginalBusinessInfo?.nrNumber || '' }, // Original entity type getters isOriginBcCompany (): boolean { - return (this.getOriginLegalType === CorpTypeCd.BC_COMPANY) + return (this.getOriginalLegalType === CorpTypeCd.BC_COMPANY) }, isOriginBenefitCompany (): boolean { - return (this.getOriginLegalType === CorpTypeCd.BENEFIT_COMPANY) + return (this.getOriginalLegalType === CorpTypeCd.BENEFIT_COMPANY) }, isOriginBcUlcCompany (): boolean { - return (this.getOriginLegalType === CorpTypeCd.BC_ULC_COMPANY) + return (this.getOriginalLegalType === CorpTypeCd.BC_ULC_COMPANY) }, isOriginBcCcc (): boolean { - return (this.getOriginLegalType === CorpTypeCd.BC_CCC) + return (this.getOriginalLegalType === CorpTypeCd.BC_CCC) }, /** The entity type. */ @@ -234,10 +245,10 @@ export const useStore = defineStore('store', { /** Whether the current account is a premium account. */ isPremiumAccount (): boolean { - return (this.stateModel.accountInformation.accountType === AccountTypes.PREMIUM) + return (this.stateModel.accountInformation?.accountType === AccountTypes.PREMIUM) }, - /** The filing's effective date-time object. */ + /** The effective date-time object. */ getEffectiveDateTime (): EffectiveDateTimeIF { return this.stateModel.effectiveDateTime }, @@ -254,7 +265,7 @@ export const useStore = defineStore('store', { /** The current account id. */ getAccountId (): number { - return this.stateModel.accountInformation.id + return this.stateModel.accountInformation?.id || null }, /** The current date in format (YYYY-MM-DD), which is refreshed every time the app inits. */ @@ -307,9 +318,15 @@ export const useStore = defineStore('store', { return this.stateModel.tombstone.businessId }, - /** The original legal name. */ + /** The original legal name (or alternate name if this is a firm). */ getOriginalLegalName (): string { - return this.getEntitySnapshot?.businessInfo?.legalName + if (this.isFirm) { + // return the alternate name, if it exists + const alternateNames = this.getOriginalBusinessInfo?.alternateNames || [] + const alternateName = alternateNames.find(x => x.identifier === this.getBusinessId) + return alternateName?.name || 'Unknown' + } + return this.getOriginalBusinessInfo?.legalName || '' }, /** The appropriate edit label for corrections, alterations, change or conversion filings. */ @@ -362,14 +379,14 @@ export const useStore = defineStore('store', { return 'Edits Saved' // should never happen }, - /** The original entity snapshot. */ + /** The entity snapshot (ie, original data). NB: may be null. */ getEntitySnapshot (): EntitySnapshotIF { return this.stateModel.entitySnapshot }, /** The original entity snapshot state filing's URL. */ getStateFilingUrl (): string { - return this.stateModel.entitySnapshot?.businessInfo?.stateFiling + return this.getOriginalBusinessInfo?.stateFiling || '' }, /** The business number. */ @@ -443,8 +460,8 @@ export const useStore = defineStore('store', { /** The snapshot NAICS object. */ getSnapshotNaics (): NaicsIF { return { - naicsCode: this.getEntitySnapshot?.businessInfo?.naicsCode, - naicsDescription: this.getEntitySnapshot?.businessInfo?.naicsDescription + naicsCode: this.getOriginalBusinessInfo?.naicsCode, + naicsDescription: this.getOriginalBusinessInfo?.naicsDescription } }, @@ -483,7 +500,7 @@ export const useStore = defineStore('store', { return this.stateModel.officeAddresses }, - /** The org-people list. */ + /** The org-people (aka parties) list. */ getOrgPeople (): Array { return this.stateModel.peopleAndRoles.orgPeople }, @@ -775,7 +792,7 @@ export const useStore = defineStore('store', { ) }, - /** The validation flags. */ + /** The validation flags object. */ getValidationFlags (): ValidationFlagsIF { return this.stateModel.validationFlags }, @@ -833,7 +850,7 @@ export const useStore = defineStore('store', { /** Check for conflicting legal types between current type and altered type. */ isConflictingLegalType (): boolean { - return (this.getEntityType !== this.stateModel.nameRequest.legalType) + return (this.getEntityType !== this.getNameRequest.legalType) }, /** The Summary Mode state. */ @@ -844,7 +861,7 @@ export const useStore = defineStore('store', { /** Whether business name has changed. */ hasBusinessNameChanged (): boolean { const currentLegalName = this.getNameRequestLegalName // may be empty - const originalLegalName = this.getOriginalLegalName + const originalLegalName = this.getOriginalLegalName // from original business record return (currentLegalName !== originalLegalName) }, @@ -862,7 +879,7 @@ export const useStore = defineStore('store', { /** Whether business type has changed. */ hasBusinessTypeChanged (): boolean { const currentEntityType = this.getEntityType - const originalLegalType = this.getEntitySnapshot?.businessInfo?.legalType + const originalLegalType = this.getOriginalLegalType return (currentEntityType !== originalLegalType) }, @@ -875,7 +892,7 @@ export const useStore = defineStore('store', { /** Whether association type has changed. */ hasAssociationTypeChanged (): boolean { const currentAssociationType = this.getAssociationType - const originalAssociationType = this.getEntitySnapshot?.businessInfo?.associationType + const originalAssociationType = this.getOriginalBusinessInfo?.associationType return (currentAssociationType !== originalAssociationType) }, @@ -913,9 +930,9 @@ export const useStore = defineStore('store', { return false }, - /** The office addresses from the original filing. NB: may be {} */ + /** The office addresses from the original filing. NB: may be null. */ getOriginalOfficeAddresses (): AddressesIF { - return this.getEntitySnapshot?.addresses + return this.getEntitySnapshot?.addresses || null }, /** Check if the original filing includes resolutions. */ @@ -1065,7 +1082,7 @@ export const useStore = defineStore('store', { /** Whether NAICS data has changed. */ hasNaicsChanged (): boolean { const currentNaicsCode = this.getBusinessInformation.naicsCode - const originalNaicsCode = this.getEntitySnapshot?.businessInfo?.naicsCode + const originalNaicsCode = this.getOriginalBusinessInfo?.naicsCode // first try to compare codes if (currentNaicsCode || originalNaicsCode) { @@ -1073,7 +1090,7 @@ export const useStore = defineStore('store', { } const currentNaicsDescription = this.getBusinessInformation.naicsDescription - const originalNaicsDescription = this.getEntitySnapshot?.businessInfo?.naicsDescription + const originalNaicsDescription = this.getOriginalBusinessInfo?.naicsDescription // then try to compare descriptions if (currentNaicsDescription || originalNaicsDescription) { @@ -1088,9 +1105,9 @@ export const useStore = defineStore('store', { return (this.stateModel.newAlteration.provisionsRemoved === true) }, - /** The original resolution dates. */ + /** The original resolution dates. NB: may be []. */ getOriginalResolutions (): ResolutionsIF[] { - return this.getEntitySnapshot?.resolutions + return this.getEntitySnapshot?.resolutions || [] }, /** The new resolution dates. */ @@ -1118,7 +1135,7 @@ export const useStore = defineStore('store', { }, /** True if the share structure contains any special rights of restrictions. */ - getHasRightsOrRestrictions (): any { + getHasRightsOrRestrictions (): boolean { const shareClasses = this.stateModel.shareStructureStep.shareClasses // Search and return on the first match @@ -1127,8 +1144,8 @@ export const useStore = defineStore('store', { }, /** True if the share structure contains any special rights of restrictions. */ - getHasOriginalRightsOrRestrictions (): any { - const shareClasses = this.getEntitySnapshot?.shareStructure?.shareClasses + getHasOriginalRightsOrRestrictions (): boolean { + const shareClasses = this.getEntitySnapshot?.shareStructure?.shareClasses || [] // Search and return on the first match // Don't need to search Series, as they can't exist on a parent without rights or restrictions @@ -1215,19 +1232,19 @@ export const useStore = defineStore('store', { return this.stateModel.restoration }, - /** The restoration object. */ + /** The state filing restoration object. */ getStateFilingRestoration (): StateFilingRestorationIF { return this.stateModel.stateFilingRestoration }, /** The approval type validity. */ getApprovalTypeValid (): boolean { - return this.stateModel.validationFlags.flagsCompanyInfo.isValidApprovalType + return this.getValidationFlags.flagsCompanyInfo.isValidApprovalType }, /** The expiry date validity. */ getExpiryValid (): boolean { - return this.stateModel.validationFlags.flagsCompanyInfo.isValidExtensionTime + return this.getValidationFlags.flagsCompanyInfo.isValidExtensionTime }, /** Returns false when users can change the sole proprietor (SP). @@ -1247,7 +1264,7 @@ export const useStore = defineStore('store', { * Only applicable to limited restoration extension filing. */ getRestorationExpiryDate (): string { - return this.stateModel.restoration?.expiry + return this.getRestoration.expiry }, /** The restoration expiry text. */ @@ -1265,15 +1282,15 @@ export const useStore = defineStore('store', { /** The court order draft file number. */ getCourtOrderNumberText (): string { - return this.stateModel.restoration.courtOrder?.fileNumber || '' + return this.getRestoration.courtOrder?.fileNumber || '' }, getRelationships (): RelationshipTypes[] { - return this.stateModel.restoration.relationships + return this.getRestoration.relationships }, getIsRestorationTypeCourtOrder (): boolean { - return !!this.stateModel.restoration.courtOrder?.fileNumber + return !!this.getRestoration.courtOrder?.fileNumber }, /** The special resolution object. */ @@ -1318,7 +1335,7 @@ export const useStore = defineStore('store', { return {} } // Obtain latest resolution ID. Assumes that the latest resolution is the one to be corrected. - const latestResolution = this.getEntitySnapshot.resolutions + const latestResolution = this.getOriginalResolutions .reduce((prev, current) => (prev.id > current.id) ? prev : current) return { ...latestResolution, @@ -1387,15 +1404,15 @@ export const useStore = defineStore('store', { this.stateModel.currentJsDate = date }, setIsFutureEffective (isFutureEffective: boolean) { - this.stateModel.effectiveDateTime.isFutureEffective = isFutureEffective + this.getEffectiveDateTime.isFutureEffective = isFutureEffective if (!this.stateModel.tombstone.ignoreChanges) this.stateModel.tombstone.haveUnsavedChanges = true }, setEffectiveDateTimeString (dateTime: string) { - this.stateModel.effectiveDateTime.dateTimeString = dateTime + this.getEffectiveDateTime.dateTimeString = dateTime if (!this.stateModel.tombstone.ignoreChanges) this.stateModel.tombstone.haveUnsavedChanges = true }, setEffectiveDateValid (valid: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidEffectiveDate = valid + this.getValidationFlags.flagsReviewCertify.isValidEffectiveDate = valid }, setResource (resource: ResourceIF) { this.resourceModel = resource @@ -1405,28 +1422,28 @@ export const useStore = defineStore('store', { if (!this.stateModel.tombstone.ignoreChanges) this.stateModel.tombstone.haveUnsavedChanges = true }, setCertifyStateValidity (validity: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidCertify = validity + this.getValidationFlags.flagsReviewCertify.isValidCertify = validity }, setDocumentOptionalEmail (documentOptionalEmail: string) { this.stateModel.documentDelivery.documentOptionalEmail = documentOptionalEmail if (!this.stateModel.tombstone.ignoreChanges) this.stateModel.tombstone.haveUnsavedChanges = true }, setDocumentOptionalEmailValidity (validity: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidDocumentOptionalEmail = validity + this.getValidationFlags.flagsReviewCertify.isValidDocumentOptionalEmail = validity }, setCompletingParty (cp: CompletingPartyIF) { this.stateModel.completingParty = cp if (!this.stateModel.tombstone.ignoreChanges) this.stateModel.tombstone.haveUnsavedChanges = true }, setCompletingPartyValidity (validity: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidCompletingParty = validity + this.getValidationFlags.flagsReviewCertify.isValidCompletingParty = validity }, setTransactionalFolioNumber (folioNumber: string) { this.stateModel.tombstone.transactionalFolioNumber = folioNumber if (!this.stateModel.tombstone.ignoreChanges) this.stateModel.tombstone.haveUnsavedChanges = true }, setTransactionalFolioNumberValidity (validity: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidTransactionalFolioNumber = validity + this.getValidationFlags.flagsReviewCertify.isValidTransactionalFolioNumber = validity }, setBusinessContact (businessContact: ContactPointIF) { this.stateModel.businessContact = businessContact @@ -1474,7 +1491,7 @@ export const useStore = defineStore('store', { this.stateModel.peopleAndRoles.changed = changed }, setPeopleAndRolesValidity (validity: boolean) { - this.stateModel.validationFlags.flagsCompanyInfo.isValidOrgPersons = validity + this.getValidationFlags.flagsCompanyInfo.isValidOrgPersons = validity }, setShareClasses (shareClasses: ShareClassIF[]) { this.stateModel.shareStructureStep.shareClasses = shareClasses @@ -1484,7 +1501,7 @@ export const useStore = defineStore('store', { this.stateModel.shareStructureStep.changed = changed }, setCreateShareStructureStepValidity (validity: boolean) { - this.stateModel.validationFlags.flagsCompanyInfo.isValidShareStructure = validity + this.getValidationFlags.flagsCompanyInfo.isValidShareStructure = validity }, setIgnoreChanges (ignoreChanges: boolean) { this.stateModel.tombstone.ignoreChanges = ignoreChanges @@ -1500,7 +1517,7 @@ export const useStore = defineStore('store', { if (!this.stateModel.tombstone.ignoreChanges) this.stateModel.tombstone.haveUnsavedChanges = true }, setStaffPaymentValidity (validity: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidStaffPayment = validity + this.getValidationFlags.flagsReviewCertify.isValidStaffPayment = validity }, setFilingData (filingData: FilingDataIF[]) { this.stateModel.filingData = filingData @@ -1509,7 +1526,7 @@ export const useStore = defineStore('store', { this.stateModel.detailComment = comment }, setDetailValidity (validity: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidDetailComment = validity + this.getValidationFlags.flagsReviewCertify.isValidDetailComment = validity }, setEditingCompanyName (editing: boolean) { this.stateModel.editingFlags.companyName = editing @@ -1558,13 +1575,13 @@ export const useStore = defineStore('store', { this.stateModel.newAlteration.courtOrder.hasPlanOfArrangement = hasPoa }, setAppValidate (validate: boolean) { - this.stateModel.validationFlags.appValidate = validate + this.getValidationFlags.appValidate = validate }, setComponentValidate (validate: boolean) { - this.stateModel.validationFlags.componentValidate = validate + this.getValidationFlags.componentValidate = validate }, setValidCourtOrder (isValid: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidCourtOrder = isValid + this.getValidationFlags.flagsReviewCertify.isValidCourtOrder = isValid }, setCurrentFees (fees: FeesIF[]) { this.stateModel.currentFees = fees @@ -1573,27 +1590,27 @@ export const useStore = defineStore('store', { this.stateModel.feePrices = feePrices }, setValidComponent (kv: ActionKvIF) { - this.stateModel.validationFlags.flagsCompanyInfo[kv.key] = kv.value + this.getValidationFlags.flagsCompanyInfo[kv.key] = kv.value }, setNaics (naics: NaicsIF) { - this.stateModel.businessInformation.naicsCode = naics.naicsCode - this.stateModel.businessInformation.naicsDescription = naics.naicsDescription + this.getBusinessInformation.naicsCode = naics?.naicsCode || null + this.getBusinessInformation.naicsDescription = naics?.naicsDescription || null if (!this.stateModel.tombstone.ignoreChanges) this.stateModel.tombstone.haveUnsavedChanges = true }, setSpecialResolution (specialResolution: SpecialResolutionIF) { this.stateModel.specialResolution = specialResolution }, setSpecialResolutionConfirmStateValidity (validity: boolean) { - this.stateModel.validationFlags.flagsReviewCertify.isValidSpecialResolutionConfirm = validity + this.getValidationFlags.flagsReviewCertify.isValidSpecialResolutionConfirm = validity }, setRestorationType (type: RestorationTypes) { - this.stateModel.restoration.type = type + this.getRestoration.type = type }, setRestorationExpiryDate (expiry: string) { - this.stateModel.restoration.expiry = expiry + this.getRestoration.expiry = expiry }, setRestorationApprovalType (approvalType: ApprovalTypes) { - this.stateModel.restoration.approvalType = approvalType + this.getRestoration.approvalType = approvalType }, setStateFilingRestoration (): Promise { return new Promise((resolve, reject) => { @@ -1613,28 +1630,28 @@ export const useStore = defineStore('store', { }) }, setRestorationCourtOrder (courtOrder: CourtOrderIF) { - this.stateModel.restoration.courtOrder = courtOrder + this.getRestoration.courtOrder = courtOrder }, setApprovalTypeValid (valid: boolean) { - this.stateModel.validationFlags.flagsCompanyInfo.isValidApprovalType = valid + this.getValidationFlags.flagsCompanyInfo.isValidApprovalType = valid }, setExpiryValid (valid: boolean) { - this.stateModel.validationFlags.flagsCompanyInfo.isValidExtensionTime = valid + this.getValidationFlags.flagsCompanyInfo.isValidExtensionTime = valid }, setRestorationRelationships (relationships: RelationshipTypes[]) { - this.stateModel.restoration.relationships = relationships + this.getRestoration.relationships = relationships }, setSpecialResolutionValid (valid: boolean) { - this.stateModel.validationFlags.flagsCompanyInfo.isValidSpecialResolution = valid + this.getValidationFlags.flagsCompanyInfo.isValidSpecialResolution = valid }, setSpecialResolutionSignatureValid (valid: boolean) { - this.stateModel.validationFlags.flagsCompanyInfo.isValidSpecialResolutionSignature = valid + this.getValidationFlags.flagsCompanyInfo.isValidSpecialResolutionSignature = valid }, setSpecialResolutionRulesValid (valid: boolean) { - this.stateModel.validationFlags.flagsCompanyInfo.isValidRules = valid + this.getValidationFlags.flagsCompanyInfo.isValidRules = valid }, setSpecialResolutionMemorandumValid (valid: boolean) { - this.stateModel.validationFlags.flagsCompanyInfo.isValidMemorandum = valid + this.getValidationFlags.flagsCompanyInfo.isValidMemorandum = valid }, setSpecialResolutionRules (rule: RulesMemorandumIF) { this.stateModel.rules = rule diff --git a/src/views/Alteration.vue b/src/views/Alteration.vue index a2f72edc..f520e75e 100644 --- a/src/views/Alteration.vue +++ b/src/views/Alteration.vue @@ -134,7 +134,8 @@ import { BusinessContactInfo, BusinessType, CertifySection, CourtOrderPoa, Curre import { NameTranslation } from '@/components/common/YourCompany/NameTranslations/' import { AuthServices, LegalServices } from '@/services/' import { CommonMixin, FeeMixin, FilingTemplateMixin } from '@/mixins/' -import { EntitySnapshotIF, FilingDataIF, ResourceIF } from '@/interfaces/' +import { EntitySnapshotIF, ResourceIF } from '@/interfaces/' +import { FilingDataIF } from '@bcrs-shared-components/interfaces/' import { FilingStatus } from '@/enums/' import { SessionStorageKeys } from 'sbc-common-components/src/util/constants' import { BcAlterationResource, BenAlterationResource, CccAlterationResource, UlcAlterationResource } @@ -218,19 +219,21 @@ export default class Alteration extends Mixins(CommonMixin, FeeMixin, FilingTemp onBusinessTypeChanged () { const filingData = this.getFilingData // When we are converting from BC to ULC, it's $1000 not $100. - if (this.getEntitySnapshot?.businessInfo?.legalType === CorpTypeCd.BC_COMPANY && - this.getEntityType === CorpTypeCd.BC_ULC_COMPANY) { + if ( + this.getOriginalLegalType === CorpTypeCd.BC_COMPANY && + this.getEntityType === CorpTypeCd.BC_ULC_COMPANY + ) { this.setFilingData([{ filingTypeCode: BcAlterationResource.additionalFilingData.filingTypeCode, - entityType: BcAlterationResource.additionalFilingData.entityType, + entityType: BcAlterationResource.additionalFilingData.entityType as any, priority: filingData[0].priority, futureEffective: filingData[0].futureEffective }]) } else { - const resourceFilingData = this.alterationResource.filingData as FilingDataIF + const resourceFilingData = this.alterationResource.filingData as unknown as FilingDataIF this.setFilingData([{ filingTypeCode: resourceFilingData.filingTypeCode, - entityType: resourceFilingData.entityType, + entityType: resourceFilingData.entityType as any, priority: filingData[0].priority, futureEffective: filingData[0].futureEffective }]) @@ -293,7 +296,7 @@ export default class Alteration extends Mixins(CommonMixin, FeeMixin, FilingTemp this.setResource(this.alterationResource) // initialize Fee Summary data - const filingData = [this.alterationResource.filingData] + const filingData = [this.alterationResource.filingData as unknown as FilingDataIF] filingData.forEach(fd => { (fd as FilingDataIF).futureEffective = this.getEffectiveDateTime.isFutureEffective }) diff --git a/src/views/Change.vue b/src/views/Change.vue index 8ca4bb2d..0b845794 100644 --- a/src/views/Change.vue +++ b/src/views/Change.vue @@ -234,7 +234,7 @@ export default class Change extends Mixins(CommonMixin, FeeMixin, FilingTemplate this.setResource(this.firmChangeResource) // initialize Fee Summary data - this.setFilingData([this.firmChangeResource.filingData]) + this.setFilingData([this.firmChangeResource.filingData as any]) // update the current fees for this filing await this.setCurrentFeesFromFilingData() diff --git a/src/views/Correction.vue b/src/views/Correction.vue index afd55381..652c6bdd 100644 --- a/src/views/Correction.vue +++ b/src/views/Correction.vue @@ -117,7 +117,7 @@ export default class Correction extends Mixins(CommonMixin) { // set entity type for misc functionality to work // do not proceed if this isn't a BC/Firm/Coop correction - this.setEntityType(filing.business?.legalType) + this.setEntityType(filing.business?.legalType || null) if (!this.isBenBcCccUlc && !this.isFirm && !this.isCoop) { throw new Error('Invalid correction type') } diff --git a/src/views/Correction/FirmCorrection.vue b/src/views/Correction/FirmCorrection.vue index 7297d537..7e8a454c 100644 --- a/src/views/Correction/FirmCorrection.vue +++ b/src/views/Correction/FirmCorrection.vue @@ -122,10 +122,10 @@ export default class FirmCorrection extends Mixins(CommonMixin, FeeMixin, Filing this.setResource(this.correctionResource) // initialize Fee Summary data - this.setFilingData([this.correctionResource.filingData]) + this.setFilingData([this.correctionResource.filingData as any]) // pre-select No Fee option - this.setStaffPayment({ option: StaffPaymentOptions.NO_FEE }) + this.setStaffPayment({ option: StaffPaymentOptions.NO_FEE } as any) // tell App that we're finished loading this.emitHaveData() diff --git a/src/views/LimitedRestorationExtension.vue b/src/views/LimitedRestorationExtension.vue index 99e0fa31..c24762d5 100644 --- a/src/views/LimitedRestorationExtension.vue +++ b/src/views/LimitedRestorationExtension.vue @@ -176,7 +176,7 @@ export default class LimitedRestorationExtension extends Mixins( @Action(useStore) setFilingId!: (x: number) => void @Action(useStore) setHaveUnsavedChanges!: (x: boolean) => void @Action(useStore) setResource!: (x: ResourceIF) => void - @Action(useStore) setStateFilingRestoration!: (x: Promise) => void + @Action(useStore) setStateFilingRestoration!: () => void /** Whether App is ready. */ @Prop({ default: false }) readonly appReady!: boolean @@ -249,7 +249,7 @@ export default class LimitedRestorationExtension extends Mixins( // fetch entity snapshot const entitySnapshot = await this.fetchEntitySnapshot() - const stateFiling = entitySnapshot.businessInfo.stateFiling + const stateFiling = entitySnapshot?.businessInfo?.stateFiling || null const filing = stateFiling && await LegalServices.fetchFiling(stateFiling) if (!filing) { @@ -285,7 +285,7 @@ export default class LimitedRestorationExtension extends Mixins( this.setResource(this.restorationResource) // initialize Fee Summary data - this.setFilingData([this.restorationResource.filingData]) + this.setFilingData([this.restorationResource.filingData as any]) // update the current fees for this filing await this.setCurrentFeesFromFilingData() diff --git a/src/views/LimitedRestorationToFull.vue b/src/views/LimitedRestorationToFull.vue index f1075d47..c470c21e 100644 --- a/src/views/LimitedRestorationToFull.vue +++ b/src/views/LimitedRestorationToFull.vue @@ -210,7 +210,7 @@ export default class LimitedRestorationToFull extends Mixins( @Action(useStore) setFilingId!: (x: number) => void @Action(useStore) setHaveUnsavedChanges!: (x: boolean) => void @Action(useStore) setResource!: (x: ResourceIF) => void - @Action(useStore) setStateFilingRestoration!: (x: Promise) => void + @Action(useStore) setStateFilingRestoration!: () => void @Action(useStore) setValidComponent!: (x: ActionKvIF) => void /** Whether App is ready. */ @@ -284,7 +284,7 @@ export default class LimitedRestorationToFull extends Mixins( // fetch entity snapshot const entitySnapshot = await this.fetchEntitySnapshot() - const stateFiling = entitySnapshot.businessInfo.stateFiling + const stateFiling = entitySnapshot?.businessInfo?.stateFiling || null const filing = stateFiling && await LegalServices.fetchFiling(stateFiling) if (!filing) { @@ -312,7 +312,7 @@ export default class LimitedRestorationToFull extends Mixins( this.setResource(this.restorationResource) // initialize Fee Summary data - this.setFilingData([this.restorationResource.filingData]) + this.setFilingData([this.restorationResource.filingData as any]) // update the current fees for this filing await this.setCurrentFeesFromFilingData() diff --git a/tests/unit/EntityInfo.spec.ts b/tests/unit/EntityInfo.spec.ts index 78776227..12bc946e 100644 --- a/tests/unit/EntityInfo.spec.ts +++ b/tests/unit/EntityInfo.spec.ts @@ -1,10 +1,12 @@ import Vuetify from 'vuetify' import { createLocalVue, mount } from '@vue/test-utils' +import { shallowWrapperFactory } from '../vitest-wrapper-factory' import EntityInfo from '@/components/common/EntityInfo.vue' import mockRouter from './MockRouter' import VueRouter from 'vue-router' import { createPinia, setActivePinia } from 'pinia' import { useStore } from '@/store/store' +import { CorpTypeCd, FilingTypes } from '@bcrs-shared-components/enums' const vuetify = new Vuetify({}) @@ -14,7 +16,7 @@ const store = useStore() // Prevent the warning "[Vuetify] Unable to locate target [data-app]" document.body.setAttribute('data-app', 'true') -describe('Entity Info component in a Correction as a named company', () => { +describe('Entity Info component in a Correction as a named Benefit Company', () => { let wrapper: any const mockFiling = { @@ -88,7 +90,7 @@ describe('Entity Info component in a Correction as a named company', () => { }) }) -describe('Entity Info component in a Correction as a numbered company', () => { +describe('Entity Info component in a Correction as a numbered Benefit Company', () => { let wrapper: any const mockFiling = { @@ -157,3 +159,31 @@ describe('Entity Info component in a Correction as a numbered company', () => { expect(wrapper.find('#entity-business-phone').text()).toBe('321-456-7890') }) }) + +describe('Entity Info component for a firm', () => { + it('displays alternate name correctly for a SP Change filing', () => { + const wrapper = shallowWrapperFactory( + EntityInfo, + null, + { + entitySnapshot: { + businessInfo: { + alternateNames: [ + { identifier: 'FM1234567', name: 'My Alternate Name' } + ], + legalName: 'My Legal Name' + } + }, + tombstone: { + businessId: 'FM1234567', + entityType: CorpTypeCd.SOLE_PROP, + filingType: FilingTypes.CHANGE_OF_COMPANY_INFO + } + } + ) + + expect(wrapper.find('#entity-legal-name').text()).toBe('My Alternate Name') + + wrapper.destroy() + }) +}) diff --git a/tests/unit/filing-template-mixin.spec.ts b/tests/unit/filing-template-mixin.spec.ts index fe87a677..22177e8d 100644 --- a/tests/unit/filing-template-mixin.spec.ts +++ b/tests/unit/filing-template-mixin.spec.ts @@ -147,7 +147,7 @@ describe('Change of Registration Filing', () => { }) it('correctly builds a change of registration filing', () => { - store.stateModel.tombstone.businessId = 'BC1234567' + store.stateModel.tombstone.businessId = 'FM1234567' store.stateModel.tombstone.filingType = FilingTypes.CHANGE_OF_REGISTRATION store.stateModel.tombstone.entityType = CorpTypeCd.SOLE_PROP store.stateModel.completingParty = { @@ -162,15 +162,21 @@ describe('Change of Registration Filing', () => { addressCountry: 'CA' } } - store.stateModel.nameRequest.legalName = 'SomeMockBusiness' + store.stateModel.nameRequest.legalName = 'My Alternate Name' store.stateModel.entitySnapshot = { businessInfo: { foundingDate: 'Jan 01, 2000', legalType: CorpTypeCd.SOLE_PROP, - identifier: 'BC1234567', + identifier: 'FM1234567', legalName: 'SomeMockBusiness', naicsCode: '', - naicsDescription: '' + naicsDescription: '', + alternateNames: [ + { + identifier: 'FM1234567', + name: 'My Alternate Name' + } + ] }, addresses: { businessOffice: { @@ -227,13 +233,13 @@ describe('Change of Registration Filing', () => { expect.objectContaining({ business: { foundingDate: 'Jan 01, 2000', - identifier: 'BC1234567', + identifier: 'FM1234567', legalName: 'SomeMockBusiness', legalType: 'SP' }, changeOfRegistration: { business: { - identifier: 'BC1234567', + identifier: 'FM1234567', naics: { naicsCode: '123456', naicsDescription: 'Mock Description' @@ -241,6 +247,7 @@ describe('Change of Registration Filing', () => { }, contactPoint: { email: '', + extension: undefined, phone: '' }, offices: { diff --git a/tests/unit/state-getters.spec.ts b/tests/unit/state-getters.spec.ts index fe0e2a65..fb25756d 100644 --- a/tests/unit/state-getters.spec.ts +++ b/tests/unit/state-getters.spec.ts @@ -424,21 +424,21 @@ describe('SP/GP correction getters', () => { // initialize store store.stateModel.tombstone.entityType = CorpTypeCd.SOLE_PROP store.stateModel.tombstone.filingType = FilingTypes.CORRECTION - store.stateModel.nameRequest = { - legalName: 'MyLegalName', - business: { - legalName: 'MyLegalName', - legalType: CorpTypeCd.BENEFIT_COMPANY - }, - incorporationApplication: {}, - registration: {} - } as any + store.stateModel.tombstone.businessId = 'FM1234567' + store.stateModel.nameRequest.legalName = 'My Alternate Name' store.stateModel.entitySnapshot = { businessInfo: { + identifier: 'FM1234567', legalName: 'MyLegalName', legalType: CorpTypeCd.SOLE_PROP, naicsCode: '100000', - naicsDescription: 'NAICS description' + naicsDescription: 'NAICS description', + alternateNames: [ + { + identifier: 'FM1234567', + name: 'My Alternate Name' + } + ] }, shareStructure: { shareClasses: [] @@ -468,7 +468,7 @@ describe('SP/GP correction getters', () => { // verify that business name changes are detected store.stateModel.nameRequest.legalName = 'MyLegalName2' expect(vm.hasBusinessNameChanged).toBe(true) - store.stateModel.nameRequest.legalName = 'MyLegalName' + store.stateModel.nameRequest.legalName = 'My Alternate Name' expect(vm.hasBusinessNameChanged).toBe(false) // verify that business type changes are detected diff --git a/tests/vitest-wrapper-factory.ts b/tests/vitest-wrapper-factory.ts new file mode 100644 index 00000000..b28f513c --- /dev/null +++ b/tests/vitest-wrapper-factory.ts @@ -0,0 +1,72 @@ +import Vue from 'vue' +import Vuelidate from 'vuelidate' +import Vuetify from 'vuetify' +import VueRouter from 'vue-router' +import mockRouter from './unit/MockRouter' +import { createPinia, setActivePinia } from 'pinia' +import { useStore } from '@/store/store' +import { createLocalVue, mount, shallowMount } from '@vue/test-utils' + +const vuetify = new Vuetify({}) +const localVue = createLocalVue() +const router = mockRouter.mock() + +Vue.use(Vuetify) +Vue.use(Vuelidate) +localVue.use(VueRouter) + +export const shallowWrapperFactory = ( + component, + propsData = null, + stateValues = null, + routeName = null, + resource = null +) => { + setActivePinia(createPinia()) + const store = useStore() + if (routeName) router.push({ name: routeName }).catch(() => {}) + if (stateValues) applyStoreValues(store, stateValues, resource) + return shallowMount(component, { + propsData: { + ...propsData + }, + localVue, + router, + vuetify + }) +} + +export const wrapperFactory = ( + component, + propsData = null, + stateValues = null, + routeName = null, + resource = null, + computed = null +) => { + setActivePinia(createPinia()) + const store = useStore() + if (routeName) router.push({ name: routeName }).catch(() => {}) + if (stateValues) applyStoreValues(store, stateValues, resource) + return mount(component, { + propsData: { + ...propsData + }, + localVue, + router, + vuetify, + computed + }) +} + +const applyStoreValues = (store, stateValues, resource) => { + // Set Company Resources + if (resource) store.resourceModel = resource + + // Set individual state properties + const stateKeys = Object.keys(stateValues) + stateKeys.forEach((key) => { + console.log('*** setting key-val =', key, stateValues[key]) + store.stateModel[key] = stateValues[key] + }) +}