From e3b7097467f795f5db07ea6008e3646dcdaa3028 Mon Sep 17 00:00:00 2001 From: Hrvoje Fekete Date: Tue, 26 Nov 2024 16:17:28 -0800 Subject: [PATCH] Revert "24389, 22238 - allowable actions logic; some other updates to allowed actions (#79)" (#82) This reverts commit 7e9159bfa8a5b1c35bb706697ad2e13111dad9e4. --- .gitignore | 3 +- .../allowable-actions/bc-historical.json | 7 - .../allowable-actions/ben-active.json | 64 ----- .../allowable-actions/ben-historical.json | 7 - .../fixtures/allowable-actions/cc-active.json | 64 ----- .../fixtures/allowable-actions/cp-active.json | 33 --- .../fixtures/allowable-actions/gp-active.json | 21 -- .../allowable-actions/gp-historical.json | 7 - .../fixtures/allowable-actions/sp-active.json | 21 -- .../allowable-actions/staff/bc-active.json | 107 -------- .../staff/bc-historical.json | 34 --- .../allowable-actions/staff/ben-active.json | 107 -------- .../staff/gp-historical.json | 24 -- .../allowable-actions/staff/sp-active.json | 50 ---- .../staff/sp-historical.json | 24 -- cypress/support/commands.ts | 17 -- cypress/support/index.ts | 2 - .../bcros/businessDetails/LinkActions.vue | 29 +-- .../bcros/filing/addStaffFiling/Index.vue | 41 +-- src/stores/business.ts | 34 +++ src/stores/dashboardActions.ts | 243 ------------------ 21 files changed, 64 insertions(+), 875 deletions(-) delete mode 100644 cypress/fixtures/allowable-actions/bc-historical.json delete mode 100644 cypress/fixtures/allowable-actions/ben-active.json delete mode 100644 cypress/fixtures/allowable-actions/ben-historical.json delete mode 100644 cypress/fixtures/allowable-actions/cc-active.json delete mode 100644 cypress/fixtures/allowable-actions/cp-active.json delete mode 100644 cypress/fixtures/allowable-actions/gp-active.json delete mode 100644 cypress/fixtures/allowable-actions/gp-historical.json delete mode 100644 cypress/fixtures/allowable-actions/sp-active.json delete mode 100644 cypress/fixtures/allowable-actions/staff/bc-active.json delete mode 100644 cypress/fixtures/allowable-actions/staff/bc-historical.json delete mode 100644 cypress/fixtures/allowable-actions/staff/ben-active.json delete mode 100644 cypress/fixtures/allowable-actions/staff/gp-historical.json delete mode 100644 cypress/fixtures/allowable-actions/staff/sp-active.json delete mode 100644 cypress/fixtures/allowable-actions/staff/sp-historical.json delete mode 100644 src/stores/dashboardActions.ts diff --git a/.gitignore b/.gitignore index 1d9c141f..7bd1804d 100644 --- a/.gitignore +++ b/.gitignore @@ -31,5 +31,4 @@ logs .vscode #Cypress screenshots -cypress/screenshots -cypress/downloads +cypress/screenshots \ No newline at end of file diff --git a/cypress/fixtures/allowable-actions/bc-historical.json b/cypress/fixtures/allowable-actions/bc-historical.json deleted file mode 100644 index 84795206..00000000 --- a/cypress/fixtures/allowable-actions/bc-historical.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [] - } - } -} diff --git a/cypress/fixtures/allowable-actions/ben-active.json b/cypress/fixtures/allowable-actions/ben-active.json deleted file mode 100644 index 0eb091f0..00000000 --- a/cypress/fixtures/allowable-actions/ben-active.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Request for AGM Extension", - "name": "agmExtension" - }, - { - "displayName": "AGM Location Change", - "name": "agmLocationChange" - }, - { - "displayName": "Alteration", - "name": "alteration" - }, - { - "displayName": "Amalgamation Application (Regular)", - "name": "amalgamationApplication", - "type": "regular" - }, - { - "displayName": "Amalgamation Application Short-form (Vertical)", - "name": "amalgamationApplication", - "type": "vertical" - }, - { - "displayName": "Amalgamation Application Short-form (Horizontal)", - "name": "amalgamationApplication", - "type": "horizontal" - }, - { - "displayName": "Annual Report", - "name": "annualReport" - }, - { - "displayName": "Address Change", - "name": "changeOfAddress" - }, - { - "displayName": "Director Change", - "name": "changeOfDirectors" - }, - { - "displayName": "6-Month Consent to Continue Out", - "name": "consentContinuationOut" - }, - { - "displayName": "Voluntary Dissolution", - "name": "dissolution", - "type": "voluntary" - }, - { - "displayName": "BC Benefit Company Incorporation Application", - "name": "incorporationApplication" - }, - { - "displayName": "Transition Application", - "name": "transition" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/ben-historical.json b/cypress/fixtures/allowable-actions/ben-historical.json deleted file mode 100644 index 84795206..00000000 --- a/cypress/fixtures/allowable-actions/ben-historical.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [] - } - } -} diff --git a/cypress/fixtures/allowable-actions/cc-active.json b/cypress/fixtures/allowable-actions/cc-active.json deleted file mode 100644 index 2975df56..00000000 --- a/cypress/fixtures/allowable-actions/cc-active.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Request for AGM Extension", - "name": "agmExtension" - }, - { - "displayName": "AGM Location Change", - "name": "agmLocationChange" - }, - { - "displayName": "Alteration", - "name": "alteration" - }, - { - "displayName": "Amalgamation Application (Regular)", - "name": "amalgamationApplication", - "type": "regular" - }, - { - "displayName": "Amalgamation Application Short-form (Vertical)", - "name": "amalgamationApplication", - "type": "vertical" - }, - { - "displayName": "Amalgamation Application Short-form (Horizontal)", - "name": "amalgamationApplication", - "type": "horizontal" - }, - { - "displayName": "Annual Report", - "name": "annualReport" - }, - { - "displayName": "Address Change", - "name": "changeOfAddress" - }, - { - "displayName": "Director Change", - "name": "changeOfDirectors" - }, - { - "displayName": "6-Month Consent to Continue Out", - "name": "consentContinuationOut" - }, - { - "displayName": "Voluntary Dissolution", - "name": "dissolution", - "type": "voluntary" - }, - { - "displayName": "BC Community Contribution Company Incorporation Application", - "name": "incorporationApplication" - }, - { - "displayName": "Transition Application", - "name": "transition" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/cp-active.json b/cypress/fixtures/allowable-actions/cp-active.json deleted file mode 100644 index 4d85e3f9..00000000 --- a/cypress/fixtures/allowable-actions/cp-active.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Annual Report", - "name": "annualReport" - }, - { - "displayName": "Address Change", - "name": "changeOfAddress" - }, - { - "displayName": "Director Change", - "name": "changeOfDirectors" - }, - { - "displayName": "Voluntary Dissolution", - "name": "dissolution", - "type": "voluntary" - }, - { - "displayName": "Incorporation Application", - "name": "incorporationApplication" - }, - { - "displayName": "Special Resolution", - "name": "specialResolution" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/gp-active.json b/cypress/fixtures/allowable-actions/gp-active.json deleted file mode 100644 index 4af7805b..00000000 --- a/cypress/fixtures/allowable-actions/gp-active.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Change of Registration Application", - "name": "changeOfRegistration" - }, - { - "displayName": "Statement of Dissolution", - "name": "dissolution", - "type": "voluntary" - }, - { - "displayName": "BC General Partnership Registration", - "name": "registration" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/gp-historical.json b/cypress/fixtures/allowable-actions/gp-historical.json deleted file mode 100644 index 84795206..00000000 --- a/cypress/fixtures/allowable-actions/gp-historical.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [] - } - } -} diff --git a/cypress/fixtures/allowable-actions/sp-active.json b/cypress/fixtures/allowable-actions/sp-active.json deleted file mode 100644 index 0ae98c7c..00000000 --- a/cypress/fixtures/allowable-actions/sp-active.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Change of Registration Application", - "name": "changeOfRegistration" - }, - { - "displayName": "Statement of Dissolution", - "name": "dissolution", - "type": "voluntary" - }, - { - "displayName": "BC Sole Proprietorship Registration", - "name": "registration" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/staff/bc-active.json b/cypress/fixtures/allowable-actions/staff/bc-active.json deleted file mode 100644 index a9e99814..00000000 --- a/cypress/fixtures/allowable-actions/staff/bc-active.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Admin Freeze", - "name": "adminFreeze" - }, - { - "displayName": "Request for AGM Extension", - "name": "agmExtension" - }, - { - "displayName": "AGM Location Change", - "name": "agmLocationChange" - }, - { - "displayName": "Alteration", - "name": "alteration" - }, - { - "displayName": "Amalgamation Application (Regular)", - "name": "amalgamationApplication", - "type": "regular" - }, - { - "displayName": "Amalgamation Application Short-form (Vertical)", - "name": "amalgamationApplication", - "type": "vertical" - }, - { - "displayName": "Amalgamation Application Short-form (Horizontal)", - "name": "amalgamationApplication", - "type": "horizontal" - }, - { - "displayName": "Annual Report", - "name": "annualReport" - }, - { - "displayName": "Address Change", - "name": "changeOfAddress" - }, - { - "displayName": "Director Change", - "name": "changeOfDirectors" - }, - { - "displayName": "6-Month Consent to Continue Out", - "name": "consentContinuationOut" - }, - { - "displayName": "Continuation Out", - "name": "continuationOut" - }, - { - "displayName": "Register Correction Application", - "name": "correction" - }, - { - "displayName": "Court Order", - "name": "courtOrder" - }, - { - "displayName": "Voluntary Dissolution", - "name": "dissolution", - "type": "voluntary" - }, - { - "displayName": "Administrative Dissolution", - "name": "dissolution", - "type": "administrative" - }, - { - "displayName": "BC Limited Company Incorporation Application", - "name": "incorporationApplication" - }, - { - "displayName": "Registrar's Notation", - "name": "registrarsNotation" - }, - { - "displayName": "Registrar's Order", - "name": "registrarsOrder" - }, - { - "displayName": "Transition Application", - "name": "transition" - }, - { - "displayName": "Limited Restoration Extension Application", - "name": "restoration", - "type": "limitedRestorationExtension" - }, - { - "displayName": "Conversion to Full Restoration Application", - "name": "restoration", - "type": "limitedRestorationToFull" - }, - { - "displayName": "Notice of Withdrawal", - "name": "noticeOfWithdrawal" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/staff/bc-historical.json b/cypress/fixtures/allowable-actions/staff/bc-historical.json deleted file mode 100644 index b38953b7..00000000 --- a/cypress/fixtures/allowable-actions/staff/bc-historical.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Court Order", - "name": "courtOrder" - }, - { - "displayName": "Correction - Put Back On", - "name": "putBackOn" - }, - { - "displayName": "Registrar's Notation", - "name": "registrarsNotation" - }, - { - "displayName": "Registrar's Order", - "name": "registrarsOrder" - }, - { - "displayName": "Full Restoration Application", - "name": "restoration", - "type": "fullRestoration" - }, - { - "displayName": "Limited Restoration Application", - "name": "restoration", - "type": "limitedRestoration" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/staff/ben-active.json b/cypress/fixtures/allowable-actions/staff/ben-active.json deleted file mode 100644 index 4b72a3ef..00000000 --- a/cypress/fixtures/allowable-actions/staff/ben-active.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Admin Freeze", - "name": "adminFreeze" - }, - { - "displayName": "Request for AGM Extension", - "name": "agmExtension" - }, - { - "displayName": "AGM Location Change", - "name": "agmLocationChange" - }, - { - "displayName": "Alteration", - "name": "alteration" - }, - { - "displayName": "Amalgamation Application (Regular)", - "name": "amalgamationApplication", - "type": "regular" - }, - { - "displayName": "Amalgamation Application Short-form (Vertical)", - "name": "amalgamationApplication", - "type": "vertical" - }, - { - "displayName": "Amalgamation Application Short-form (Horizontal)", - "name": "amalgamationApplication", - "type": "horizontal" - }, - { - "displayName": "Annual Report", - "name": "annualReport" - }, - { - "displayName": "Address Change", - "name": "changeOfAddress" - }, - { - "displayName": "Director Change", - "name": "changeOfDirectors" - }, - { - "displayName": "6-Month Consent to Continue Out", - "name": "consentContinuationOut" - }, - { - "displayName": "Continuation Out", - "name": "continuationOut" - }, - { - "displayName": "Register Correction Application", - "name": "correction" - }, - { - "displayName": "Court Order", - "name": "courtOrder" - }, - { - "displayName": "Voluntary Dissolution", - "name": "dissolution", - "type": "voluntary" - }, - { - "displayName": "Administrative Dissolution", - "name": "dissolution", - "type": "administrative" - }, - { - "displayName": "BC Benefit Company Incorporation Application", - "name": "incorporationApplication" - }, - { - "displayName": "Registrar's Notation", - "name": "registrarsNotation" - }, - { - "displayName": "Registrar's Order", - "name": "registrarsOrder" - }, - { - "displayName": "Transition Application", - "name": "transition" - }, - { - "displayName": "Limited Restoration Extension Application", - "name": "restoration", - "type": "limitedRestorationExtension" - }, - { - "displayName": "Conversion to Full Restoration Application", - "name": "restoration", - "type": "limitedRestorationToFull" - }, - { - "displayName": "Notice of Withdrawal", - "name": "noticeOfWithdrawal" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/staff/gp-historical.json b/cypress/fixtures/allowable-actions/staff/gp-historical.json deleted file mode 100644 index 7c8e6e4d..00000000 --- a/cypress/fixtures/allowable-actions/staff/gp-historical.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Court Order", - "name": "courtOrder" - }, - { - "displayName": "Correction - Put Back On", - "name": "putBackOn" - }, - { - "displayName": "Registrar's Notation", - "name": "registrarsNotation" - }, - { - "displayName": "Registrar's Order", - "name": "registrarsOrder" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/staff/sp-active.json b/cypress/fixtures/allowable-actions/staff/sp-active.json deleted file mode 100644 index fa99ecfb..00000000 --- a/cypress/fixtures/allowable-actions/staff/sp-active.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Admin Freeze", - "name": "adminFreeze" - }, - { - "displayName": "Change of Registration Application", - "name": "changeOfRegistration" - }, - { - "displayName": "Record Conversion", - "name": "conversion" - }, - { - "displayName": "Register Correction Application", - "name": "correction" - }, - { - "displayName": "Court Order", - "name": "courtOrder" - }, - { - "displayName": "Statement of Dissolution", - "name": "dissolution", - "type": "voluntary" - }, - { - "displayName": "Statement of Dissolution", - "name": "dissolution", - "type": "administrative" - }, - { - "displayName": "Registrar's Notation", - "name": "registrarsNotation" - }, - { - "displayName": "Registrar's Order", - "name": "registrarsOrder" - }, - { - "displayName": "BC Sole Proprietorship Registration", - "name": "registration" - } - ] - } - } -} diff --git a/cypress/fixtures/allowable-actions/staff/sp-historical.json b/cypress/fixtures/allowable-actions/staff/sp-historical.json deleted file mode 100644 index 7c8e6e4d..00000000 --- a/cypress/fixtures/allowable-actions/staff/sp-historical.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "couldFile": { - "filing": { - "filingTypes": [ - { - "displayName": "Court Order", - "name": "courtOrder" - }, - { - "displayName": "Correction - Put Back On", - "name": "putBackOn" - }, - { - "displayName": "Registrar's Notation", - "name": "registrarsNotation" - }, - { - "displayName": "Registrar's Order", - "name": "registrarsOrder" - } - ] - } - } -} diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 6b5a1361..e1cf665f 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -136,21 +136,6 @@ Cypress.Commands.add('interceptAuthorizations', (businessIdentifier: string) => ) }) -Cypress.Commands.add('interceptAllowableActions', (isStaff, legalType = 'BC', state = 'ACTIVE') => { - let fixtureName = `${legalType.toLowerCase()}-${state.toLowerCase()}` - if (isStaff) { - fixtureName = 'staff/' + fixtureName - } - - cy.fixture(`allowable-actions/${fixtureName}`).then((response) => { - cy.intercept( - 'GET', - `**/api/v2/businesses/allowable/**`, - response - ) - }) -}) - Cypress.Commands.add('visitBusinessDash', ( identifier = 'BC0871427', @@ -163,7 +148,6 @@ Cypress.Commands.add('visitBusinessDash', cy.wait(500) // https://github.com/cypress-io/cypress/issues/27648 sessionStorage.setItem('FAKE_CYPRESS_LOGIN', 'true') cy.interceptAuthorizations(identifier).as('authorizations') - cy.interceptAllowableActions(false, legalType, isHistorical ? 'HISTORICAL' : 'ACTIVE') cy.intercept('GET', '**/api/v1/users/**/settings', { fixture: 'settings.json' }).as('getSettings') cy.intercept( 'REPORT', @@ -233,7 +217,6 @@ Cypress.Commands.add('visitBusinessDashFor', // load interceptors cy.interceptAuthorizations(business.identifier).as('authorizations') - cy.interceptAllowableActions(asStaff, business.legalType, business.state) cy.interceptBusinessInfoFor(business).as('getBusinessInfo') cy.interceptBusinessContact(business.identifier, 'BEN').as('getBusinessContact') cy.interceptAddresses(business.legalType).as('getAddresses') diff --git a/cypress/support/index.ts b/cypress/support/index.ts index 2ab5e504..8db4faf4 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -26,8 +26,6 @@ declare global { interceptAuthorizations (businessIdentifier: string): Chainable, - interceptAllowableActions (isStaff: boolean, legalType?: string, state?: string): Chainable, - visitBusinessDash ( identifier?: string, legalType?: string, diff --git a/src/components/bcros/businessDetails/LinkActions.vue b/src/components/bcros/businessDetails/LinkActions.vue index dc70eeb7..401815c3 100644 --- a/src/components/bcros/businessDetails/LinkActions.vue +++ b/src/components/bcros/businessDetails/LinkActions.vue @@ -3,13 +3,11 @@ import type { ComputedRef } from 'vue' import type { DropdownItem } from '#ui/types' import { FilingTypes } from '@bcrs-shared-components/enums' import { FilingSubTypeE } from '~/enums/filing-sub-type-e' -import { useBcrosDashboardActions } from '~/stores/dashboardActions' const { currentBusiness } = storeToRefs(useBcrosBusiness()) const { goToDigitalCredentialsPage, goToBusinessDashboard } = useBcrosNavigate() const { isAllowedToFile } = useBcrosBusiness() -const { isButtonForActionVisible } = useBcrosDashboardActions() const { getStoredFlag } = useBcrosLaunchdarkly() const t = useNuxtApp().$i18n.t @@ -37,9 +35,9 @@ const allActions: ComputedRef> = computed(() => { name: 'digitalCredentials' }, { // - showButton: isButtonForActionVisible(FilingTypes.DISSOLUTION, FilingSubTypeE.DISSOLUTION_VOLUNTARY), + showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL, disabled: - !getStoredFlag('supported-dissolution-entities')?.includes(currentBusiness.value.legalType) || + !getStoredFlag('supported-dissolution-entities')?.includes(currentBusiness.value.legalType) && !isAllowedToFile(FilingTypes.DISSOLUTION, FilingSubTypeE.DISSOLUTION_VOLUNTARY), label: t('button.tombstone.menuAction.dissolveBusiness'), click: () => { @@ -50,9 +48,7 @@ const allActions: ComputedRef> = computed(() => { name: 'dissolveBusiness' }, { // - showButton: - getStoredFlag('supported-consent-amalgamation-out-entities')?.includes(currentBusiness.value.legalType) && - isButtonForActionVisible(FilingTypes.CONSENT_AMALGAMATION_OUT), + showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL, disabled: !isAllowedToFile(FilingTypes.CONSENT_AMALGAMATION_OUT), label: t('button.tombstone.menuAction.consentToAmalgamateOut'), click: () => { @@ -62,10 +58,7 @@ const allActions: ComputedRef> = computed(() => { name: 'consentToAmalgamateOut' }, { // - - showButton: - getStoredFlag('supported-consent-continuation-out-entities')?.includes(currentBusiness.value.legalType) && - isButtonForActionVisible(FilingTypes.CONSENT_CONTINUATION_OUT), + showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL, disabled: !isAllowedToFile(FilingTypes.CONSENT_CONTINUATION_OUT), label: t('button.tombstone.menuAction.consentToContinueOut'), click: () => { @@ -75,9 +68,7 @@ const allActions: ComputedRef> = computed(() => { name: 'consentToContinueOut' }, { // - showButton: - getStoredFlag('supported-agm-extension-entities')?.includes(currentBusiness.value.legalType) && - isButtonForActionVisible(FilingTypes.AGM_EXTENSION), + showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL, disabled: !isAllowedToFile(FilingTypes.AGM_EXTENSION), label: t('button.tombstone.menuAction.requestAgmExtension'), click: () => { @@ -90,9 +81,7 @@ const allActions: ComputedRef> = computed(() => { name: 'requestAgmExtension' }, { // - showButton: - getStoredFlag('supported-agm-location-chg-entities')?.includes(currentBusiness.value.legalType) && - isButtonForActionVisible(FilingTypes.AGM_LOCATION_CHANGE), + showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL, disabled: !isAllowedToFile(FilingTypes.AGM_LOCATION_CHANGE), label: t('button.tombstone.menuAction.requestAgmLocationChange'), click: () => { @@ -105,10 +94,8 @@ const allActions: ComputedRef> = computed(() => { name: 'requestAgmLocationChange' }, { // - showButton: - getStoredFlag('supported-amalgamation-entities')?.includes(currentBusiness.value.legalType) && - isButtonForActionVisible(FilingTypes.AMALGAMATION_APPLICATION), - disabled: !isAllowedToFile(FilingTypes.AMALGAMATION_APPLICATION), + showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL, + disabled: !isAllowedToFile(FilingTypes.AGM_LOCATION_CHANGE), label: t('button.tombstone.menuAction.amalgamate'), click: () => { goToBusinessDashboard(`/${currentBusiness.value.identifier}/amalgamation-selection`) diff --git a/src/components/bcros/filing/addStaffFiling/Index.vue b/src/components/bcros/filing/addStaffFiling/Index.vue index d77a425d..edb3c363 100644 --- a/src/components/bcros/filing/addStaffFiling/Index.vue +++ b/src/components/bcros/filing/addStaffFiling/Index.vue @@ -10,8 +10,9 @@ interface MenuActionItem extends DropdownItem { const filings = useBcrosFilings() const business = useBcrosBusiness() -const { isActionVisible } = useBcrosDashboardActions() -const { currentBusiness } = storeToRefs(business) +const { + currentBusiness, showAmalgamateOut, showConsentAmalgamationOut, showConsentContinueOut, showContinueOut, isHistorical +} = storeToRefs(business) const { goToBusinessDashboard, goToEditPage, goToCreatePage } = useBcrosNavigate() const openFreezeUnfreezeModal = ref(false) @@ -53,28 +54,28 @@ const restoreCompany = async (restorationType: FilingSubTypeE = null) => { const allActions: ComputedRef> = computed(() => { return [ { // - showButton: isActionVisible(AllowableActionE.REGISTRARS_NOTATION), + showButton: true, disabled: !business.isAllowed(AllowableActionE.REGISTRARS_NOTATION), datacy: 'registrar-notation', label: t('label.filing.staffFilingOptions.registrarsNotation'), click: () => { openRegistrarNotationModal.value = true } }, { // - showButton: isActionVisible(AllowableActionE.REGISTRARS_ORDER), + showButton: true, disabled: !business.isAllowed(AllowableActionE.REGISTRARS_ORDER), datacy: 'registrar-order', label: t('label.filing.staffFilingOptions.registrarsOrder'), click: () => { openRegistrarOrderModal.value = true } }, { // - showButton: isActionVisible(AllowableActionE.COURT_ORDER), + showButton: true, disabled: !business.isAllowed(AllowableActionE.COURT_ORDER), datacy: 'court-order', label: t('label.filing.staffFilingOptions.courtOrder'), click: () => { openCourtOrderModal.value = true } }, { // - showButton: isActionVisible(AllowableActionE.RECORD_CONVERSION), + showButton: business.isEntityFirm(), disabled: !business.isAllowed(AllowableActionE.RECORD_CONVERSION), datacy: 'record-conversion', label: t('label.filing.staffFilingOptions.recordConversion'), @@ -83,29 +84,29 @@ const allActions: ComputedRef> = computed(() => { } }, { // - showButton: isActionVisible(AllowableActionE.ADMINISTRATIVE_DISSOLUTION), + showButton: !isHistorical.value, disabled: !business.isAllowed(AllowableActionE.ADMINISTRATIVE_DISSOLUTION), datacy: 'dissolution', label: t('label.filing.staffFilingOptions.dissolution'), click: () => { openDissolutionModal.value = true } }, { // - showButton: isActionVisible(AllowableActionE.RESTORATION), + showButton: isHistorical.value, disabled: !business.isAllowed(AllowableActionE.RESTORATION), datacy: 'restore', label: t('label.filing.staffFilingOptions.restoreCompany'), click: () => { restoreCompany() } }, { // - showButton: isActionVisible(AllowableActionE.PUT_BACK_ON), - disabled: !business.isAllowed(AllowableActionE.PUT_BACK_ON), + showButton: business.isAllowed(AllowableActionE.PUT_BACK_ON), + disabled: false, datacy: 'put-back-on', label: t('label.filing.staffFilingOptions.putBackOn'), click: () => { openPutBackOnModal.value = true } }, { // - showButton: isActionVisible(AllowableActionE.FREEZE_UNFREEZE), - disabled: !business.isAllowed(AllowableActionE.FREEZE_UNFREEZE), + showButton: business.isAllowed(AllowableActionE.FREEZE_UNFREEZE), + disabled: false, datacy: 'admin-freeze', label: !currentBusiness?.value?.adminFreeze ? t('label.filing.staffFilingOptions.adminFreeze') @@ -113,7 +114,7 @@ const allActions: ComputedRef> = computed(() => { click: () => { openFreezeUnfreezeModal.value = true } }, { // - showButton: isActionVisible(AllowableActionE.CONSENT_AMALGAMATION_OUT), + showButton: !isHistorical.value && showConsentAmalgamationOut.value, disabled: !business.isAllowed(AllowableActionE.CONSENT_AMALGAMATION_OUT), datacy: 'consent-to-amalgamate-out', label: t('label.filing.staffFilingOptions.consentToAmalgamateOut'), @@ -122,7 +123,7 @@ const allActions: ComputedRef> = computed(() => { } }, { // - showButton: isActionVisible(AllowableActionE.AMALGAMATION_OUT), + showButton: !isHistorical.value && showAmalgamateOut.value, disabled: !business.isAllowed(AllowableActionE.AMALGAMATION_OUT), datacy: 'amalgamate-out', label: t('label.filing.staffFilingOptions.amalgamateOut'), @@ -131,7 +132,7 @@ const allActions: ComputedRef> = computed(() => { } }, { // - showButton: isActionVisible(AllowableActionE.CONSENT_CONTINUATION_OUT), + showButton: !isHistorical.value && showConsentContinueOut.value, disabled: !business.isAllowed(AllowableActionE.CONSENT_CONTINUATION_OUT), datacy: 'consent-to-continue-out', label: t('label.filing.staffFilingOptions.consentToContinueOut'), @@ -140,7 +141,7 @@ const allActions: ComputedRef> = computed(() => { } }, { // - showButton: isActionVisible(AllowableActionE.CONTINUATION_OUT), + showButton: !isHistorical.value && showContinueOut.value, disabled: !business.isAllowed(AllowableActionE.CONTINUATION_OUT), datacy: 'continue-out', label: t('label.filing.staffFilingOptions.continueOut'), @@ -149,15 +150,15 @@ const allActions: ComputedRef> = computed(() => { } }, { // - showButton: isActionVisible(AllowableActionE.LIMITED_RESTORATION_EXTENSION), - disabled: !business.isAllowed(AllowableActionE.LIMITED_RESTORATION_EXTENSION), + showButton: business.isAllowed(AllowableActionE.LIMITED_RESTORATION_EXTENSION), + disabled: false, datacy: 'extend-limited-restore', label: t('label.filing.staffFilingOptions.extendLimitedRestoration'), click: () => { restoreCompany(FilingSubTypeE.LIMITED_RESTORATION_EXTENSION) } }, { // - showButton: isActionVisible(AllowableActionE.LIMITED_RESTORATION_TO_FULL), - disabled: !business.isAllowed(AllowableActionE.LIMITED_RESTORATION_TO_FULL), + showButton: business.isAllowed(AllowableActionE.LIMITED_RESTORATION_TO_FULL), + disabled: false, datacy: 'convert-full-restore', label: t('label.filing.staffFilingOptions.fullRestoration'), click: () => { restoreCompany(FilingSubTypeE.LIMITED_RESTORATION_TO_FULL) } diff --git a/src/stores/business.ts b/src/stores/business.ts index 516be7ca..5464d424 100644 --- a/src/stores/business.ts +++ b/src/stores/business.ts @@ -238,6 +238,36 @@ export const useBcrosBusiness = defineStore('bcros/business', () => { return isTypeRestorationLimited.value || isTypeRestorationLimitedExtension.value }) + // computed variables for staff filing options + const showConsentAmalgamationOut = computed(() => { + return ( + (isBaseCompany() || isEntityCoop()) && + !!launchdarklyStore.getFeatureFlag('supported-consent-amalgamation-out-entities')?.includes( + currentBusiness.value.legalType) + ) + }) + const showAmalgamateOut = computed(() => { + return ( + (isBaseCompany() || isEntityCoop()) && + !!launchdarklyStore.getFeatureFlag('supported-amalgamation-out-entities')?.includes( + currentBusiness.value.legalType) + ) + }) + const showConsentContinueOut = computed(() => { + return ( + isBaseCompany() && + !!launchdarklyStore.getFeatureFlag('supported-consent-continuation-out-entities')?.includes( + currentBusiness.value.legalType) + ) + }) + const showContinueOut = computed(() => { + return ( + isBaseCompany() && + !!launchdarklyStore.getFeatureFlag('supported-continuation-out-entities')?.includes( + currentBusiness.value.legalType) + ) + }) + const isAllowedToFile = (filingType: FilingTypes, filingSubType?: FilingSubTypeE) => { if (!filingType || !currentBusiness.value?.allowedActions?.filing) { return false @@ -530,6 +560,10 @@ export const useBcrosBusiness = defineStore('bcros/business', () => { isTypeRestorationLimited, isTypeRestorationFull, isFirm, + showAmalgamateOut, + showConsentAmalgamationOut, + showContinueOut, + showConsentContinueOut, isAllowedToFile, isAllowed, createCommentBusiness, diff --git a/src/stores/dashboardActions.ts b/src/stores/dashboardActions.ts deleted file mode 100644 index 734ae683..00000000 --- a/src/stores/dashboardActions.ts +++ /dev/null @@ -1,243 +0,0 @@ -import { CorpTypeCd, FilingTypes } from '@bcrs-shared-components/enums' -import { FilingSubTypeE } from '~/enums/filing-sub-type-e' - -/** Manages bcros account data */ -export const useBcrosDashboardActions = defineStore('bcros/dashboardActions', () => { - const visibleActions: Ref = ref([]) - const _legalApiURL = useRuntimeConfig().public.legalApiURL - const businessStore = useBcrosBusiness() - const currentTypeAndStatus = computed((): string => { - if (!businessStore.currentBusiness) { - return '' - } - return businessStore.currentBusiness.legalType.toUpperCase() + - '|' + - businessStore.currentBusiness.state.toUpperCase() - }) - - async function fetchVisibleActions (businessType: string, businessStatus: string) { - interface CouldFileI { - couldFile: { - filing: { - filingTypes: FilingTypeI[] - } - } - } - - return await useBcrosFetch(`${_legalApiURL}/businesses/allowable/${businessType}/${businessStatus}`, {}) - .then(({ data, error }) => { - if (error.value || !data.value) { - console.warn('Error fetching visible actions for', businessType, businessStatus) - return undefined - } - return data?.value?.couldFile?.filing?.filingTypes - }) - } - - // fetch new set of visible actions each time the requirement changes (either legal type or business state) - watch(currentTypeAndStatus, (value, oldValue) => { - if (value && value !== oldValue) { - fetchVisibleActions(value.split('|')[0], value.split('|')[1]).then((data) => { - if (data) { - visibleActions.value = data - } - }) - } - }, { immediate: true }) - - const isAllowedToFile = (filingType: FilingTypes, filingSubType?: FilingSubTypeE) => { - if (!filingType || !(visibleActions.value?.length > 0)) { - return false - } - - const requestedFiling = visibleActions.value - .find(ft => ft.name === filingType && (filingSubType === undefined || ft.type === filingSubType)) - return !!requestedFiling - } - - // NB: this is intentionally kept the same as the isAllowedActions for now to keep monitoring requirements more easily - // we can move the other function in the future here, in this store, and then easily replace call to isAllowToFile - // with generic function that checks scenario depending on the need and injects appropriate function - const isActionVisible = (action: AllowableActionE) => { - if (!businessStore.currentBusiness) { - return false - } - const currentBusiness = businessStore.currentBusiness - - const isEntityFirm = businessStore.isEntityFirm - const isLegalType = businessStore.isLegalType - const isBusiness = !!currentBusiness.value?.identifier - - const { isStaffAccount } = useBcrosAccount() - const { getFeatureFlag } = useBcrosLaunchdarkly() - const legalType = currentBusiness.legalType - - switch (action) { - case AllowableActionE.ADDRESS_CHANGE: { - if (isEntityFirm()) { - return isAllowedToFile(FilingTypes.CHANGE_OF_REGISTRATION) - } - return isAllowedToFile(FilingTypes.CHANGE_OF_ADDRESS) - } - - case AllowableActionE.ADMINISTRATIVE_DISSOLUTION: { - // NB: specific entities are targeted via LaunchDarkly - const ff = !!getFeatureFlag('supported-dissolution-entities')?.includes(legalType) - return (ff && isAllowedToFile(FilingTypes.DISSOLUTION, FilingSubTypeE.DISSOLUTION_ADMINISTRATIVE)) - } - - case AllowableActionE.AGM_EXTENSION: { - return isAllowedToFile(FilingTypes.AGM_EXTENSION) - } - - case AllowableActionE.AGM_LOCATION_CHANGE: { - return isAllowedToFile(FilingTypes.AGM_LOCATION_CHANGE) - } - - case AllowableActionE.AMALGAMATION: { - return isAllowedToFile(FilingTypes.AMALGAMATION_APPLICATION) - } - - case AllowableActionE.AMALGAMATION_OUT: { - return isAllowedToFile(FilingTypes.AMALGAMATION_OUT) - } - - case AllowableActionE.ANNUAL_REPORT: { - return isAllowedToFile(FilingTypes.ANNUAL_REPORT) - } - - case AllowableActionE.BUSINESS_INFORMATION: { - if (isLegalType([CorpTypeCd.COOP])) { - // NB: this feature is targeted via LaunchDarkly - const ff = !!getFeatureFlag('special-resolution-ui-enabled') - return (ff && isAllowedToFile(FilingTypes.SPECIAL_RESOLUTION)) - } - if (isEntityFirm()) { - return isAllowedToFile(FilingTypes.CHANGE_OF_REGISTRATION) - } - return isAllowedToFile(FilingTypes.ALTERATION) - } - - case AllowableActionE.BUSINESS_SUMMARY: { - // NB: specific entities are targeted via LaunchDarkly - const ff = !!getFeatureFlag('supported-business-summary-entities')?.includes(legalType) - return (ff && isBusiness) - } - - case AllowableActionE.CONSENT_AMALGAMATION_OUT: { - return isAllowedToFile(FilingTypes.CONSENT_AMALGAMATION_OUT) - } - - case AllowableActionE.CONSENT_CONTINUATION_OUT: { - return isAllowedToFile(FilingTypes.CONSENT_CONTINUATION_OUT) - } - - case AllowableActionE.CONTINUATION_OUT: { - return isAllowedToFile(FilingTypes.CONTINUATION_OUT) - } - - case AllowableActionE.CORRECTION: { - // NB: specific entities are targeted via LaunchDarkly - const ff = !!getFeatureFlag('supported-correction-entities')?.includes(legalType) - return (ff && isAllowedToFile(FilingTypes.CORRECTION)) - } - - case AllowableActionE.COURT_ORDER: { - return isAllowedToFile(FilingTypes.COURT_ORDER) - } - - case AllowableActionE.DETAIL_COMMENT: { - return (isBusiness && isStaffAccount) - } - - /** - * DBC feature is only available to self-registered owners of an SP - * who are logged in via BCSC. - */ - case AllowableActionE.DIGITAL_CREDENTIALS: { - // NB: this feature is targeted via LaunchDarkly - const ff = !!getFeatureFlag('enable-digital-credentials') - const isDigitalBusinessCardAllowed = currentBusiness.value.allowedActions.digitalBusinessCard - return (ff && isDigitalBusinessCardAllowed) - } - - case AllowableActionE.DIRECTOR_CHANGE: { - if (isEntityFirm()) { - return isAllowedToFile(FilingTypes.CHANGE_OF_REGISTRATION) - } - return isAllowedToFile(FilingTypes.CHANGE_OF_DIRECTORS) - } - - case AllowableActionE.FREEZE_UNFREEZE: { - // this covers both Freeze and Unfreeze - return isAllowedToFile(FilingTypes.ADMIN_FREEZE) - } - - case AllowableActionE.LIMITED_RESTORATION_EXTENSION: { - // NB: specific entities are targeted via LaunchDarkly - const ff = !!getFeatureFlag('supported-restoration-entities')?.includes(legalType) - return (ff && isAllowedToFile(FilingTypes.RESTORATION, FilingSubTypeE.LIMITED_RESTORATION_EXTENSION)) - } - - case AllowableActionE.LIMITED_RESTORATION_TO_FULL: { - // NB: specific entities are targeted via LaunchDarkly - const ff = !!getFeatureFlag('supported-restoration-entities')?.includes(legalType) - return (ff && isAllowedToFile(FilingTypes.RESTORATION, FilingSubTypeE.LIMITED_RESTORATION_TO_FULL)) - } - - case AllowableActionE.PUT_BACK_ON: { - // NB: specific entities are targeted via LaunchDarkly - const ff = !!getFeatureFlag('supported-put-back-on-entities')?.includes(legalType) - return (ff && isAllowedToFile(FilingTypes.PUT_BACK_ON)) - } - - case AllowableActionE.RECORD_CONVERSION: { - return isAllowedToFile(FilingTypes.CONVERSION) - } - - case AllowableActionE.REGISTRARS_NOTATION: { - return isAllowedToFile(FilingTypes.REGISTRARS_NOTATION) - } - - case AllowableActionE.REGISTRARS_ORDER: { - return isAllowedToFile(FilingTypes.REGISTRARS_ORDER) - } - - case AllowableActionE.RESTORATION: { - // NB: specific entities are targeted via LaunchDarkly - // NB: this applies to full restoration or limited restoration - // but not limited restoration extension or limited restoration to full - const ff = !!getFeatureFlag('supported-restoration-entities')?.includes(legalType) - return ( - ff && - ( - isAllowedToFile(FilingTypes.RESTORATION, FilingSubTypeE.FULL_RESTORATION) || - isAllowedToFile(FilingTypes.RESTORATION, FilingSubTypeE.LIMITED_RESTORATION) - ) - ) - } - - case AllowableActionE.STAFF_COMMENT: { - return (isBusiness && isStaffAccount) - } - - case AllowableActionE.TRANSITION: { - return isAllowedToFile(FilingTypes.TRANSITION) - } - - case AllowableActionE.VOLUNTARY_DISSOLUTION: { - // NB: specific entities are targeted via LaunchDarkly - const ff = !!getFeatureFlag('supported-dissolution-entities')?.includes(legalType) - return (ff && isAllowedToFile(FilingTypes.DISSOLUTION, FilingSubTypeE.DISSOLUTION_VOLUNTARY)) - } - - default: - return false // should never happen - } - } - - return { - isButtonForActionVisible: isAllowedToFile, - isActionVisible - } -})