From b909e19305a4162dd0f56196799d75e03cb6affe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Beauvais?= Date: Fri, 12 Apr 2024 12:49:04 -0700 Subject: [PATCH] 20818 Fixed draft amalgamation initial values (#647) - app version = 7.1.11 - created better getAccountId store getter and used it in place of old code - don't save empty legalName in draft regular amalgamation - don't save null correctNameOption in draft regular amalgamation - improved email/phone logic Co-authored-by: Severin Beauvais --- package-lock.json | 4 +-- package.json | 2 +- src/components/Dashboard/TodoList.vue | 10 +++---- .../TodoList/PaymentPendingOnlineBanking.vue | 4 +-- src/stores/authenticationStore.ts | 12 ++++++++ src/utils/navigate.ts | 8 +++++- src/views/AmalgamationSelection.vue | 28 +++++++++++++------ 7 files changed, 48 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index f8e61e91f..0261a6ed2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-filings-ui", - "version": "7.1.10", + "version": "7.1.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-filings-ui", - "version": "7.1.10", + "version": "7.1.11", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/base-address": "2.0.9", diff --git a/package.json b/package.json index c5a3d0123..f7cc3034f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-filings-ui", - "version": "7.1.10", + "version": "7.1.11", "private": true, "appName": "Filings UI", "sbcName": "SBC Common Components", diff --git a/src/components/Dashboard/TodoList.vue b/src/components/Dashboard/TodoList.vue index 3322f0a5c..ae5f7f78d 100644 --- a/src/components/Dashboard/TodoList.vue +++ b/src/components/Dashboard/TodoList.vue @@ -550,7 +550,7 @@ v-if="EnumUtilities.isPayMethodOnlineBanking(item)" :filing="item" :payApiUrl="getPayApiUrl" - :accountId="accountId" + :accountId="getAccountId" class="mb-6" /> @@ -627,7 +627,8 @@ import { TodoListResourceIF } from '@/interfaces' import { GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module' -import { useBusinessStore, useConfigurationStore, useFilingHistoryListStore, useRootStore } from '@/stores' +import { useAuthenticationStore, useBusinessStore, useConfigurationStore, useFilingHistoryListStore, + useRootStore } from '@/stores' @Component({ components: { @@ -669,10 +670,10 @@ export default class TodoList extends Mixins(AllowableActionsMixin, DateMixin, E inProcessFiling: number = null fetchAffiliationInvitationsErrorDialog = false authorizeAffiliationInvitationErrorDialog = false - accountId: number = null @Prop({ default: null }) readonly highlightId!: number + @Getter(useAuthenticationStore) getAccountId!: string @Getter(useConfigurationStore) getAuthWebUrl!: string @Getter(useConfigurationStore) getBusinessesUrl!: string @Getter(useConfigurationStore) getAuthApiUrl!: string @@ -996,9 +997,8 @@ export default class TodoList extends Mixins(AllowableActionsMixin, DateMixin, E } // load all the invitations here and push them into todo items - this.accountId = JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id const response = - await AuthServices.fetchAffiliationInvitations(this.getAuthApiUrl, this.getIdentifier, this.accountId) + await AuthServices.fetchAffiliationInvitations(this.getAuthApiUrl, this.getIdentifier, +this.getAccountId) .catch((err) => { console.log('Error fetching affiliation invitations for todo', err) // eslint-disable-line no-console this.fetchAffiliationInvitationsErrorDialog = true diff --git a/src/components/Dashboard/TodoList/PaymentPendingOnlineBanking.vue b/src/components/Dashboard/TodoList/PaymentPendingOnlineBanking.vue index 1099cfa7d..981ed8937 100644 --- a/src/components/Dashboard/TodoList/PaymentPendingOnlineBanking.vue +++ b/src/components/Dashboard/TodoList/PaymentPendingOnlineBanking.vue @@ -43,7 +43,7 @@ export default class PaymentPendingOnlineBanking extends Vue { /** The subject filing. */ @Prop({ required: true }) readonly filing!: any @Prop({ required: true }) readonly payApiUrl!: string - @Prop({ required: true }) readonly accountId!: any + @Prop({ required: true }) readonly accountId!: string cfsAccountId: string = null; @@ -53,7 +53,7 @@ export default class PaymentPendingOnlineBanking extends Vue { } async mounted () { - this.cfsAccountId = await PayServices.fetchCfsAccountId(this.payApiUrl, this.accountId) + this.cfsAccountId = await PayServices.fetchCfsAccountId(this.payApiUrl, +this.accountId) } } diff --git a/src/stores/authenticationStore.ts b/src/stores/authenticationStore.ts index 500708b4f..aa1ee4f34 100644 --- a/src/stores/authenticationStore.ts +++ b/src/stores/authenticationStore.ts @@ -5,6 +5,18 @@ import { defineStore } from 'pinia' export const useAuthenticationStore = defineStore('authentication', { getters: { + /** The Account ID, from session storage. */ + getAccountId (): string { + // if we can't get account id from ACCOUNT_ID + // then try to get it from CURRENT_ACCOUNT + let accountId = sessionStorage.getItem('ACCOUNT_ID') + if (!accountId) { + const currentAccount = sessionStorage.getItem('CURRENT_ACCOUNT') + accountId = JSON.parse(currentAccount)?.id + } + return accountId + }, + /** * The (Keycloak) current account object. * @remarks This isn't set right away - may need to wait 200ms or more after login. diff --git a/src/utils/navigate.ts b/src/utils/navigate.ts index 89968239a..f8504ac63 100644 --- a/src/utils/navigate.ts +++ b/src/utils/navigate.ts @@ -1,3 +1,9 @@ +import { createPinia, setActivePinia } from 'pinia' +import { useAuthenticationStore } from '@/stores' + +setActivePinia(createPinia()) +const authenticationStore = useAuthenticationStore() + /** * Navigates to the specified URL, including Account ID param if available. * This function may or may not return. The caller should account for this! @@ -7,7 +13,7 @@ export function navigate (url: string): boolean { if (!url) throw new Error('empty URL') // get account id and set in params - const accountId = JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id + const accountId = authenticationStore.getAccountId if (accountId) { if (url.includes('?')) { url += `&accountid=${accountId}` diff --git a/src/views/AmalgamationSelection.vue b/src/views/AmalgamationSelection.vue index 8514a6e08..1a13420c3 100644 --- a/src/views/AmalgamationSelection.vue +++ b/src/views/AmalgamationSelection.vue @@ -144,7 +144,7 @@