From c9fda7c36ec3745db55d57197537d094f554b90f Mon Sep 17 00:00:00 2001 From: Akiff Manji Date: Mon, 20 Nov 2023 15:10:48 -0800 Subject: [PATCH] fix: DBC feature should be available for historical companies (#587) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: CredentialsLanding component: add heading card Signed-off-by: Akiff Manji * feat: CredentialsLanding component: add supplemental cards Signed-off-by: Akiff Manji * feat: CredentialsLanding component: add image and word wrapping Signed-off-by: Akiff Manji * feat: CredentialsLanding component: link styling Signed-off-by: Akiff Manji * feat: CredentialsStepper component: deprecate routes Signed-off-by: Akiff Manji * refactor: CredentialsStepper component: function naming Signed-off-by: Akiff Manji * refactor: DigitalCredentials component: split into sub components Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add web socket component Signed-off-by: Akiff Manji * feat: DigitalCredentials component: re-add credential table Signed-off-by: Akiff Manji * refactor: DigitalCredentials component: update types and imports Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add revocation dialogs Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add replacement dialogs Signed-off-by: Akiff Manji * feat: devcontainer config Signed-off-by: Akiff Manji * chore: fix linting errors Signed-off-by: Akiff Manji * chore: bump version number Signed-off-by: Akiff Manji * chore: rename route for specificity Signed-off-by: Akiff Manji * chore: ran linter and fixed linting errors Signed-off-by: Akiff Manji * chore: make interface field optional Signed-off-by: Akiff Manji * chore: revert auto-formatting Signed-off-by: Akiff Manji * refactor: contain dialogs for DigitalCredentials component Signed-off-by: Akiff Manji * chore: fix code smells Signed-off-by: Akiff Manji * chore: address code review comments Signed-off-by: Akiff Manji * chore: revert autoformatting Signed-off-by: Akiff Manji * chore: update wording and styling to align with UX Signed-off-by: Akiff Manji * chore: fix styling Signed-off-by: Akiff Manji * feat: feature flag credentials feature with mixin Signed-off-by: Akiff Manji * feat: add TOU dialog Signed-off-by: Akiff Manji * chore: fix test failiures and code comments * chore: cleaup Signed-off-by: Akiff Manji * fix: mixin to access digital credential feature Signed-off-by: Akiff Manji * fix: entity menu styling Signed-off-by: Akiff Manji * feat: add loading indicators to digital credential route pages Signed-off-by: Akiff Manji * feat: reset dialog and functions Signed-off-by: Akiff Manji * chore: returl null if undefined Signed-off-by: Akiff Manji * chore: beef up conditional checks Signed-off-by: Akiff Manji * chore: spelling error Signed-off-by: Akiff Manji * chore: spelling error Signed-off-by: Akiff Manji * 18284: digital business card (#552) * refactor: CredentialsLanding component: add heading card Signed-off-by: Akiff Manji * feat: CredentialsLanding component: add supplemental cards Signed-off-by: Akiff Manji * feat: CredentialsLanding component: add image and word wrapping Signed-off-by: Akiff Manji * feat: CredentialsLanding component: link styling Signed-off-by: Akiff Manji * feat: CredentialsStepper component: deprecate routes Signed-off-by: Akiff Manji * refactor: CredentialsStepper component: function naming Signed-off-by: Akiff Manji * refactor: DigitalCredentials component: split into sub components Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add web socket component Signed-off-by: Akiff Manji * feat: DigitalCredentials component: re-add credential table Signed-off-by: Akiff Manji * refactor: DigitalCredentials component: update types and imports Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add revocation dialogs Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add replacement dialogs Signed-off-by: Akiff Manji * feat: devcontainer config Signed-off-by: Akiff Manji * chore: fix linting errors Signed-off-by: Akiff Manji * chore: bump version number Signed-off-by: Akiff Manji * chore: rename route for specificity Signed-off-by: Akiff Manji * chore: ran linter and fixed linting errors Signed-off-by: Akiff Manji * chore: make interface field optional Signed-off-by: Akiff Manji * chore: revert auto-formatting Signed-off-by: Akiff Manji * refactor: contain dialogs for DigitalCredentials component Signed-off-by: Akiff Manji * chore: fix code smells Signed-off-by: Akiff Manji * chore: address code review comments Signed-off-by: Akiff Manji * chore: revert autoformatting Signed-off-by: Akiff Manji * chore: update wording and styling to align with UX Signed-off-by: Akiff Manji * chore: fix styling Signed-off-by: Akiff Manji * feat: feature flag credentials feature with mixin Signed-off-by: Akiff Manji * feat: add TOU dialog Signed-off-by: Akiff Manji * chore: fix test failiures and code comments * chore: cleaup Signed-off-by: Akiff Manji * fix: mixin to access digital credential feature Signed-off-by: Akiff Manji * fix: entity menu styling Signed-off-by: Akiff Manji * feat: add loading indicators to digital credential route pages Signed-off-by: Akiff Manji * feat: reset dialog and functions Signed-off-by: Akiff Manji * chore: returl null if undefined Signed-off-by: Akiff Manji * chore: beef up conditional checks Signed-off-by: Akiff Manji * chore: spelling error Signed-off-by: Akiff Manji * chore: spelling error Signed-off-by: Akiff Manji --------- Signed-off-by: Akiff Manji * chore: cleanup spelling and handle edge cases Signed-off-by: Akiff Manji * fix: failing tests Signed-off-by: Akiff Manji * fix: entity menu logic Signed-off-by: Akiff Manji * 18284 Updated CSP (#561) - added wss://*.gov.bc.ca to connect-src * refactor: remove websocket support in favour of interval polling Signed-off-by: Akiff Manji * chore: remove console log Signed-off-by: Akiff Manji * chore: address PR comments Signed-off-by: Akiff Manji * chore: remove unused import Signed-off-by: Akiff Manji * fix: build and test failures Signed-off-by: Akiff Manji * feat: digital business card (#562) * refactor: CredentialsLanding component: add heading card Signed-off-by: Akiff Manji * feat: CredentialsLanding component: add supplemental cards Signed-off-by: Akiff Manji * feat: CredentialsLanding component: add image and word wrapping Signed-off-by: Akiff Manji * feat: CredentialsLanding component: link styling Signed-off-by: Akiff Manji * feat: CredentialsStepper component: deprecate routes Signed-off-by: Akiff Manji * refactor: CredentialsStepper component: function naming Signed-off-by: Akiff Manji * refactor: DigitalCredentials component: split into sub components Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add web socket component Signed-off-by: Akiff Manji * feat: DigitalCredentials component: re-add credential table Signed-off-by: Akiff Manji * refactor: DigitalCredentials component: update types and imports Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add revocation dialogs Signed-off-by: Akiff Manji * feat: DigitalCredentials component: add replacement dialogs Signed-off-by: Akiff Manji * feat: devcontainer config Signed-off-by: Akiff Manji * chore: fix linting errors Signed-off-by: Akiff Manji * chore: bump version number Signed-off-by: Akiff Manji * chore: rename route for specificity Signed-off-by: Akiff Manji * chore: ran linter and fixed linting errors Signed-off-by: Akiff Manji * chore: make interface field optional Signed-off-by: Akiff Manji * chore: revert auto-formatting Signed-off-by: Akiff Manji * refactor: contain dialogs for DigitalCredentials component Signed-off-by: Akiff Manji * chore: fix code smells Signed-off-by: Akiff Manji * chore: address code review comments Signed-off-by: Akiff Manji * chore: revert autoformatting Signed-off-by: Akiff Manji * chore: update wording and styling to align with UX Signed-off-by: Akiff Manji * chore: fix styling Signed-off-by: Akiff Manji * feat: feature flag credentials feature with mixin Signed-off-by: Akiff Manji * feat: add TOU dialog Signed-off-by: Akiff Manji * chore: fix test failiures and code comments * chore: cleaup Signed-off-by: Akiff Manji * fix: mixin to access digital credential feature Signed-off-by: Akiff Manji * fix: entity menu styling Signed-off-by: Akiff Manji * feat: add loading indicators to digital credential route pages Signed-off-by: Akiff Manji * feat: reset dialog and functions Signed-off-by: Akiff Manji * chore: returl null if undefined Signed-off-by: Akiff Manji * chore: beef up conditional checks Signed-off-by: Akiff Manji * chore: spelling error Signed-off-by: Akiff Manji * chore: spelling error Signed-off-by: Akiff Manji * chore: cleanup spelling and handle edge cases Signed-off-by: Akiff Manji * fix: failing tests Signed-off-by: Akiff Manji * fix: entity menu logic Signed-off-by: Akiff Manji * refactor: remove websocket support in favour of interval polling Signed-off-by: Akiff Manji * chore: remove console log Signed-off-by: Akiff Manji * chore: address PR comments Signed-off-by: Akiff Manji * chore: remove unused import Signed-off-by: Akiff Manji * fix: build and test failures Signed-off-by: Akiff Manji --------- Signed-off-by: Akiff Manji * Update EntityMenu.spec.ts * chore: remove web socket references Signed-off-by: Akiff Manji * chore: fix spacing Signed-off-by: Akiff Manji * chore: some cleanup Signed-off-by: Akiff Manji * feat: credential detailed instructions Signed-off-by: Akiff Manji * chore: add tags to components Signed-off-by: Akiff Manji * chore: minor content updates Signed-off-by: Akiff Manji * chore: update package version Signed-off-by: Akiff Manji * fix: DBC feature should be available for historical organization Signed-off-by: Akiff Manji * refactor: move logic into getter Signed-off-by: Akiff Manji * fix: DBC feature should only be available to BCSC user Signed-off-by: Akiff Manji * chore: update package version Signed-off-by: Akiff Manji * chore: update package lock file Signed-off-by: Akiff Manji --------- Signed-off-by: Akiff Manji Co-authored-by: Séverin Beauvais --- package-lock.json | 4 +- package.json | 2 +- .../DigitalCredentials/CredentialsMenu.vue | 2 +- src/components/EntityInfo/EntityMenu.vue | 175 +++++++++--------- src/mixins/allowable-actions-mixin.ts | 10 +- tests/unit/EntityMenu.spec.ts | 14 +- 6 files changed, 118 insertions(+), 89 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5064dc7ff..9979d1bd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-filings-ui", - "version": "7.0.15", + "version": "7.0.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-filings-ui", - "version": "7.0.15", + "version": "7.0.16", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/base-address": "2.0.9", diff --git a/package.json b/package.json index 8f50aafed..d975c82c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-filings-ui", - "version": "7.0.15", + "version": "7.0.16", "private": true, "appName": "Filings UI", "sbcName": "SBC Common Components", diff --git a/src/components/DigitalCredentials/CredentialsMenu.vue b/src/components/DigitalCredentials/CredentialsMenu.vue index 7ccbdd722..ef722ca39 100644 --- a/src/components/DigitalCredentials/CredentialsMenu.vue +++ b/src/components/DigitalCredentials/CredentialsMenu.vue @@ -40,7 +40,7 @@ diff --git a/src/components/EntityInfo/EntityMenu.vue b/src/components/EntityInfo/EntityMenu.vue index 8cf3c8ed5..1f9234ed5 100644 --- a/src/components/EntityInfo/EntityMenu.vue +++ b/src/components/EntityInfo/EntityMenu.vue @@ -70,7 +70,7 @@ - + - - - - Dissolving the business will make this business historical - and it will be struck from the corporate registry. - - - - - - Submit a Consent to Continue Out of the province of B.C. - - - - - - {{ agmExtensionToolTipText }} - - - - - + {{ agmExtensionToolTipText }} + + + + + + {{ agmLocationChgToolTipText }} + + @@ -247,6 +249,13 @@ export default class EntityMenu extends Mixins(AllowableActionsMixin) { return !!this.businessId } + /** + * More actions should only display if an entity is not historical or if the Digital Credentials + * feature is available, otherwise an empty menu will display for historical entities. */ + get areMoreActionsAvailable (): boolean { + return !this.isHistorical || this.isAllowed(AllowableActions.DIGITAL_CREDENTIALS) + } + get enableAgmExtension (): boolean { return !!GetFeatureFlag('supported-agm-extension-entities').includes(this.getLegalType) } diff --git a/src/mixins/allowable-actions-mixin.ts b/src/mixins/allowable-actions-mixin.ts index a11917fd5..13d2d2eaa 100644 --- a/src/mixins/allowable-actions-mixin.ts +++ b/src/mixins/allowable-actions-mixin.ts @@ -4,6 +4,7 @@ import { GetFeatureFlag } from '@/utils' import { AllowableActions, CorpTypeCd, FilingSubTypes, FilingTypes } from '@/enums' import { AllowedActionsIF } from '@/interfaces' import { useBusinessStore, useRootStore } from '@/stores' +import { LoginSource } from 'sbc-common-components/src/util/constants' @Component({}) export default class AllowableActionsMixin extends Vue { @@ -14,6 +15,7 @@ export default class AllowableActionsMixin extends Vue { @Getter(useBusinessStore) isSoleProp!: boolean @Getter(useBusinessStore) isGoodStanding!: boolean @Getter(useRootStore) isRoleStaff!: boolean + @Getter(useRootStore) getUserInfo!: any /** * Returns True if the specified action is allowed, else False. @@ -89,10 +91,16 @@ export default class AllowableActionsMixin extends Vue { return (isBusiness && this.isRoleStaff) } + /** + * DBC feature is only available to self-registered owners of an SP + * who are logged in via BCSC. + */ case AllowableActions.DIGITAL_CREDENTIALS: { // NB: this feature is targeted via LaunchDarkly const ff = !!GetFeatureFlag('enable-digital-credentials') - return (ff && this.isSoleProp && !this.isRoleStaff) + const { loginSource } = this.getUserInfo + const isLoginSourceBCSC = loginSource === LoginSource.BCSC + return (ff && isLoginSourceBCSC && this.isSoleProp && !this.isRoleStaff) } case AllowableActions.DIRECTOR_CHANGE: { diff --git a/tests/unit/EntityMenu.spec.ts b/tests/unit/EntityMenu.spec.ts index 23cf35fee..4e8818343 100644 --- a/tests/unit/EntityMenu.spec.ts +++ b/tests/unit/EntityMenu.spec.ts @@ -410,7 +410,6 @@ describe('Entity Menu - Digital Business Cards click tests', () => { await wrapper.find('.menu-btn').trigger('click') const button = wrapper.find('#view-add-digital-credentials-button') - console.log(button) expect(button.exists()).toBe(true) expect(button.text()).toBe('Digital Business Cards') @@ -478,6 +477,19 @@ describe('Entity Menu - More actions click tests', () => { }) }) +it('renders More actions if historical and digital credential feature is allowed', async () => { + businessStore.setState(EntityState.HISTORICAL) + + const wrapper = mount(EntityMenu, { + vuetify, + mixins: [{ methods: { isAllowed: () => true } }], + propsData: { businessId: 'BC1234567' } + }) + + expect(wrapper.find('.menu-btn').exists()).toBe(true) + wrapper.destroy() +}) + describe('Entity Menu - Consent to Continuation click tests', () => { const router = mockRouter.mock()