Skip to content

Commit

Permalink
20779 Implemented Easy Legal Name Fix (bcgov#675)
Browse files Browse the repository at this point in the history
* 20779 Implemented Easy Legal Name Fix

* Fixed lots of unit tests

* fixed typos in tests

* minor upgrade to package.json

* moved the spyon function

* Fixed in response to Sev's comment

* Fixed in response to Sev's comment + fixed/updated unit tests

* Imported alternate name from shared interfaces
  • Loading branch information
JazzarKarim authored Apr 18, 2024
1 parent 1950ccf commit 9a4c290
Show file tree
Hide file tree
Showing 17 changed files with 353 additions and 73 deletions.
60 changes: 12 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-create-ui",
"version": "5.9.12",
"version": "5.10.0",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down Expand Up @@ -28,11 +28,11 @@
"@bcrs-shared-components/date-picker": "1.2.15",
"@bcrs-shared-components/document-delivery": "1.2.0",
"@bcrs-shared-components/effective-date-time": "1.1.15",
"@bcrs-shared-components/enums": "1.1.7",
"@bcrs-shared-components/enums": "1.1.9",
"@bcrs-shared-components/expandable-help": "1.0.1",
"@bcrs-shared-components/genesys-web-message": "1.0.0",
"@bcrs-shared-components/help-business-number": "1.1.1",
"@bcrs-shared-components/interfaces": "1.1.5",
"@bcrs-shared-components/interfaces": "1.1.11",
"@bcrs-shared-components/jurisdiction": "1.0.1",
"@bcrs-shared-components/limited-restoration-panel": "1.0.5",
"@bcrs-shared-components/mixins": "1.1.39",
Expand Down
6 changes: 6 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
@Action(useStore) setAccountInformation!: (x: AccountInformationIF) => void
@Action(useStore) setAdminFreeze!: (x: boolean) => void
@Action(useStore) setAlternateName!: (x: string) => void
@Action(useStore) setBusinessId!: (x: string) => void
@Action(useStore) setBusinessNumber!: (x: string) => void
@Action(useStore) setCompletingParty!: (x: CompletingPartyIF) => void
Expand Down Expand Up @@ -1267,6 +1268,11 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
// FUTURE: change this to a single setter/object?
this.setAdminFreeze(business.adminFreeze)
{
// store alternate name if it exists (only used for firms atm)
const alternateName = business.alternateNames?.find(x => x.identifier === business.identifier)
if (alternateName) this.setAlternateName(alternateName.name)
}
this.setLegalName(business.legalName)
this.setEntityState(business.state)
this.setBusinessNumber(business.taxId || null) // may be empty
Expand Down
17 changes: 11 additions & 6 deletions src/components/Dissolution/AssociationDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sm="3"
class="pr-4"
>
<label>{{ entityLabel }}</label>
<label id="entity-label">{{ entityLabel }}</label>
</v-col>

<v-col
Expand All @@ -17,10 +17,15 @@
class="mt-n1"
>
<label id="company-name">{{ entityName }}</label>
<div class="my-1">
<div
id="entity-description"
class="my-1"
>
{{ entityDescription }}
</div>
<div>{{ getBusinessId }}</div>
<div id="business-id">
{{ getBusinessId }}
</div>
</v-col>
</v-row>
</article>
Expand All @@ -35,7 +40,7 @@
sm="3"
class="pr-4"
>
<label>{{ addressLabel }}</label>
<label id="address-label">{{ addressLabel }}</label>
</v-col>

<v-col
Expand Down Expand Up @@ -194,12 +199,12 @@ export default class AssociationDetails extends Mixins(CommonMixin, DateMixin) {
/** The entity name. */
get entityName (): string {
return this.getBusinessLegalName || GetCorpNumberedDescription(this.getEntityType)
return this.getBusinessLegalName || GetCorpNumberedDescription(this.getEntityType as any)
}
/** The entity description. */
get entityDescription (): string {
return GetCorpFullDescription(this.getEntityType)
return GetCorpFullDescription(this.getEntityType as any)
}
/** The business start date. */
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dissolution/CompleteAffidavit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export default class CompleteAffidavit extends Mixins(CommonMixin, DocumentMixin
/** The entity name. */
get entityName (): string {
return this.getBusinessLegalName || GetCorpNumberedDescription(this.getEntityType)
return this.getBusinessLegalName || GetCorpNumberedDescription(this.getEntityType as any)
}
get entityTitle (): string {
Expand Down Expand Up @@ -373,7 +373,7 @@ export default class CompleteAffidavit extends Mixins(CommonMixin, DocumentMixin
name: this.uploadAffidavitDoc.name,
lastModified: this.uploadAffidavitDoc.lastModified,
size: this.uploadAffidavitDoc.size
}
} as File
this.setAffidavit({
...this.getAffidavitStep,
affidavitFile,
Expand Down
6 changes: 3 additions & 3 deletions src/components/common/EntityInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class EntityInfo extends Mixins(DateMixin) {
/** The entity legal name (old name, new name, or numbered description). */
get entityLegalName (): string {
const numberedDescription = GetCorpNumberedDescription(this.getEntityType)
const numberedDescription = GetCorpNumberedDescription(this.getEntityType as any)
// name comes from different places depending on filing type
switch (this.getFilingType) {
Expand All @@ -146,9 +146,9 @@ export default class EntityInfo extends Mixins(DateMixin) {
return '' // should never happen
}
/** The entity description. */
/** The entity description. */
get entityDescription (): string {
const corpTypeDescription = GetCorpFullDescription(this.getEntityType)
const corpTypeDescription = GetCorpFullDescription(this.getEntityType as any)
if (this.isTypeSoleProp && this.getTempId) {
return `${corpTypeDescription} / Doing Business As (DBA)`
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/store-interfaces/state-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface StateModelIF {
dissolution: DissolutionStateIF
nameRequest: NameRequestIF
nameRequestApprovedName: string
alternateName: string
correctNameOption: CorrectNameOptions
nameTranslations: NameTranslationIF[]
nameTranslationsValid: boolean
Expand Down Expand Up @@ -81,6 +82,7 @@ export interface StateModelIF {
staffPaymentStep: StaffPaymentStepIF
courtOrderStep: CourtOrderStepIF

// to calculate if this is a mobile screen
windowWidth: number
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntityStates } from '@/enums'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { IsoDatePacific, ApiDateTimeUtc } from '@bcrs-shared-components/interfaces'
import { AlternateNameIF, ApiDateTimeUtc, IsoDatePacific } from '@bcrs-shared-components/interfaces'
import { ContactPointIF, OfficeAddressIF } from '@/interfaces'

/** The Business Warning object. */
Expand All @@ -14,12 +14,12 @@ export interface BusinessWarningIF {
/** The Business object from the API. */
export interface BusinessIF {
adminFreeze: boolean
alternateNames?: Array<AlternateNameIF>
arMaxDate: IsoDatePacific // not used
arMinDate: IsoDatePacific // not used
businessContact: ContactPointIF
businessId: string
dissolutionDate: ApiDateTimeUtc // not used
warnings?: Array<BusinessWarningIF>
fiscalYearEndDate: IsoDatePacific // not used
foundingDate: ApiDateTimeUtc | string
goodStanding: boolean
Expand All @@ -35,9 +35,10 @@ export interface BusinessIF {
legalType: CorpTypeCd
officeAddress: OfficeAddressIF
nextAnnualReport: ApiDateTimeUtc // used for BCOMP only
taxId?: string // aka Business Number // may be undefined
startDate: ApiDateTimeUtc
state: EntityStates
stateFiling?: string
startDate: ApiDateTimeUtc
submitter: string // not used
taxId?: string // aka Business Number // may be undefined
warnings?: Array<BusinessWarningIF>
}
3 changes: 2 additions & 1 deletion src/mixins/document-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default class DocumentMixin extends Vue {

pdfjsLib: any

async created () {
// use beforeCreate() instead of created() to avoid type conflict with components that use this mixin
async beforeCreate (): Promise<void> {
// NB: we load the lib and worker this way to avoid a memory leak (esp in unit tests)
// NB: must use legacy build for unit tests not running in Node 18+
this.pdfjsLib = pdfjs
Expand Down
1 change: 1 addition & 0 deletions src/store/state/state-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const stateModel: StateModelIF = {
orgInformation: null,
nameRequest: cloneDeep(EmptyNameRequest),
nameRequestApprovedName: null,
alternateName: null,
correctNameOption: null,
nameTranslations: [],
nameTranslationsValid: true,
Expand Down
10 changes: 9 additions & 1 deletion src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
UploadAffidavitIF,
ValidationDetailIF
} from '@/interfaces'
import { GetFeatureFlag } from '@/utils/feature-flag-utils'

// It's possible to move getters / actions into seperate files:
// https://github.com/vuejs/pinia/issues/802#issuecomment-1018780409
Expand Down Expand Up @@ -331,8 +332,12 @@ export const useStore = defineStore('store', {
}
},

/** The Business Legal Name. */
/** The Business Legal Name (or Alternate Name if this is a firm). */
getBusinessLegalName (): string {
if (!GetFeatureFlag('enable-legal-name-fix')) {
return this.stateModel.business.legalName
}
if (this.isTypeFirm) return this.stateModel.alternateName || 'Unknown'
return this.stateModel.business.legalName
},

Expand Down Expand Up @@ -1037,6 +1042,9 @@ export const useStore = defineStore('store', {
setFoundingDate (foundingDate: string) {
this.stateModel.business.foundingDate = foundingDate
},
setAlternateName (name: string) {
this.stateModel.alternateName = name
},
setFilingType (filingType: FilingTypes) {
this.stateModel.tombstone.filingType = filingType
},
Expand Down
1 change: 1 addition & 0 deletions src/utils/feature-flag-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare const window: any
*/
const defaultFlagSet: LDFlagSet = {
'supported-filings': [],
'enable-legal-name-fix': false, // by default, the easy legal name changes are disabled
'enable-web-chat': false, // by default, old webchat is disabled
'enable-genesys-web-message': false, // by default, genesys web message is disabled
'sentry-enable': false, // by default, no sentry logs
Expand Down
4 changes: 2 additions & 2 deletions src/views/Dissolution/DissolutionDefineDissolution.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ export default class DissolutionDefineDissolution extends Mixins(CommonMixin) {
@Action(useStore) setCustodianValidity!: (x: boolean) => void
get corpDescription (): string {
return GetCorpFullDescription(this.getEntityType)
return GetCorpFullDescription(this.getEntityType as any)
}
/** The entity name. */
get entityName (): string {
return this.getBusinessLegalName || GetCorpNumberedDescription(this.getEntityType)
return this.getBusinessLegalName || GetCorpNumberedDescription(this.getEntityType as any)
}
/** The entity designation. */
Expand Down
2 changes: 1 addition & 1 deletion src/views/DissolutionFirm/DissolutionFirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ export default class DissolutionFirm extends Mixins(DateMixin) {
/** The entity description. */
corpTypeDescription (): string {
return GetCorpFullDescription(this.getEntityType)
return GetCorpFullDescription(this.getEntityType as any)
}
onUpdate (cp: CompletingPartyIF): void {
Expand Down
Loading

0 comments on commit 9a4c290

Please sign in to comment.