From 3952c37d691eb1c05d723734e1932759145d8afc Mon Sep 17 00:00:00 2001 From: Aloisio Bastian Date: Wed, 5 Feb 2025 15:39:14 -0300 Subject: [PATCH] =?UTF-8?q?Revert=20"[UXE-6007]=20fix:=20Billing/Payment?= =?UTF-8?q?=20-=20add=20message=20to=20alert=20user=20to=20comple=E2=80=A6?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 568ed4a7a2d755f8a09e90fcfb086351f801d2bc. --- src/helpers/account-data.js | 36 ------------------- src/router/hooks/guards/accountGuard.js | 34 ++++++++++++++++-- src/router/hooks/guards/billingGuard.js | 4 --- .../add-payment-method-block/index.vue | 26 -------------- .../AccountSettings/AccountSettingsView.vue | 31 ++-------------- .../Billing/Drawer/DrawerPaymentMethod.vue | 4 +-- 6 files changed, 36 insertions(+), 99 deletions(-) delete mode 100644 src/helpers/account-data.js diff --git a/src/helpers/account-data.js b/src/helpers/account-data.js deleted file mode 100644 index dd49376be..000000000 --- a/src/helpers/account-data.js +++ /dev/null @@ -1,36 +0,0 @@ -import { getAccountInfoService, getUserInfoService } from '@/services/account-services' -import { loadAccountJobRoleService } from '@/services/account-settings-services' -import { loadContractServicePlan } from '@/services/contract-services' -import { useAccountStore } from '@/stores/account' - -export const loadUserAndAccountInfo = async () => { - const accountStore = useAccountStore() - const [accountInfo, userInfo, accountJobRole] = await Promise.all([ - getAccountInfoService(), - getUserInfoService(), - loadAccountJobRoleService() - ]) - - accountInfo.is_account_owner = userInfo.results.is_account_owner - accountInfo.client_id = userInfo.results.client_id - accountInfo.timezone = userInfo.results.timezone - accountInfo.utc_offset = userInfo.results.utc_offset - accountInfo.first_name = userInfo.results.first_name - accountInfo.last_name = userInfo.results.last_name - accountInfo.permissions = userInfo.results.permissions - accountInfo.email = userInfo.results.email - accountInfo.user_id = userInfo.results.id - accountInfo.colorTheme = accountStore.theme - accountInfo.jobRole = accountJobRole.jobRole - accountInfo.isDeveloperSupportPlan = true - - if (accountInfo.client_id) { - const { isDeveloperSupportPlan, yourServicePlan } = await loadContractServicePlan({ - clientId: accountInfo.client_id - }) - accountInfo.isDeveloperSupportPlan = isDeveloperSupportPlan - accountInfo.yourServicePlan = yourServicePlan - } - - accountStore.setAccountData(accountInfo) -} diff --git a/src/router/hooks/guards/accountGuard.js b/src/router/hooks/guards/accountGuard.js index 3d53d51a2..3d17dc7db 100644 --- a/src/router/hooks/guards/accountGuard.js +++ b/src/router/hooks/guards/accountGuard.js @@ -1,14 +1,42 @@ +import { getAccountInfoService, getUserInfoService } from '@/services/account-services' +import { loadAccountJobRoleService } from '@/services/account-settings-services' import { setRedirectRoute } from '@/helpers' -import { loadUserAndAccountInfo } from '@/helpers/account-data' /** @type {import('vue-router').NavigationGuardWithThis} */ -export async function accountGuard({ to, accountStore, tracker }) { +export async function accountGuard({ to, accountStore, tracker, loadContractServicePlan }) { const isPrivateRoute = !to.meta.isPublic const userNotIsLoggedIn = !accountStore.hasActiveUserId if (userNotIsLoggedIn) { try { - await loadUserAndAccountInfo() + const [accountInfo, userInfo, accountJobRole] = await Promise.all([ + getAccountInfoService(), + getUserInfoService(), + loadAccountJobRoleService() + ]) + + accountInfo.is_account_owner = userInfo.results.is_account_owner + accountInfo.client_id = userInfo.results.client_id + accountInfo.timezone = userInfo.results.timezone + accountInfo.utc_offset = userInfo.results.utc_offset + accountInfo.first_name = userInfo.results.first_name + accountInfo.last_name = userInfo.results.last_name + accountInfo.permissions = userInfo.results.permissions + accountInfo.email = userInfo.results.email + accountInfo.user_id = userInfo.results.id + accountInfo.colorTheme = accountStore.theme + accountInfo.jobRole = accountJobRole.jobRole + accountInfo.isDeveloperSupportPlan = true + + if (accountInfo.client_id) { + const { isDeveloperSupportPlan, yourServicePlan } = await loadContractServicePlan({ + clientId: accountInfo.client_id + }) + accountInfo.isDeveloperSupportPlan = isDeveloperSupportPlan + accountInfo.yourServicePlan = yourServicePlan + } + + accountStore.setAccountData(accountInfo) if (!isPrivateRoute) { return '/' diff --git a/src/router/hooks/guards/billingGuard.js b/src/router/hooks/guards/billingGuard.js index 915a89c8b..76981b276 100644 --- a/src/router/hooks/guards/billingGuard.js +++ b/src/router/hooks/guards/billingGuard.js @@ -21,10 +21,6 @@ export async function billingGuard({ to, accountStore }) { if (to.name === 'billing-tabs') { return true } - - if (to.name === 'account-settings') { - return true - } } else if (paymentReviewPending) { return BILLING_REDIRECT_OPTIONS } diff --git a/src/templates/add-payment-method-block/index.vue b/src/templates/add-payment-method-block/index.vue index af0efbdec..eecff7444 100644 --- a/src/templates/add-payment-method-block/index.vue +++ b/src/templates/add-payment-method-block/index.vue @@ -1,6 +1,5 @@