diff --git a/web/satellite/src/components/account/billing/BillingArea.vue b/web/satellite/src/components/account/billing/BillingArea.vue index 8768aeb26..9c53c0459 100644 --- a/web/satellite/src/components/account/billing/BillingArea.vue +++ b/web/satellite/src/components/account/billing/BillingArea.vue @@ -144,11 +144,14 @@ function routeToCoupons(): void { /** * Mounted lifecycle hook after initial render. - * Fetches account balance. + * Fetches account balance and credit cards. */ onMounted(async (): Promise => { try { - await billingStore.getBalance(); + await Promise.all([ + billingStore.getBalance(), + billingStore.getCreditCards(), + ]); } catch (error) { notify.notifyError(error, AnalyticsErrorEventSource.BILLING_AREA); } diff --git a/web/satellite/src/store/modules/billingStore.ts b/web/satellite/src/store/modules/billingStore.ts index bf7d841d5..86a7c711b 100644 --- a/web/satellite/src/store/modules/billingStore.ts +++ b/web/satellite/src/store/modules/billingStore.ts @@ -201,18 +201,8 @@ export const useBillingStore = defineStore('billing', () => { state.wallet = new Wallet(); } - const canUserCreateFirstProject = computed((): boolean => { - return state.balance.sum > 0 || state.creditCards.length > 0; - }); - - const isBalancePositive = computed((): boolean => { - return state.balance.sum > 0; - }); - return { state, - canUserCreateFirstProject, - isBalancePositive, getBalance, getWallet, claimWallet, diff --git a/web/satellite/src/types/payments.ts b/web/satellite/src/types/payments.ts index a9eb63035..a6807de6e 100644 --- a/web/satellite/src/types/payments.ts +++ b/web/satellite/src/types/payments.ts @@ -158,6 +158,10 @@ export class AccountBalance { return parseFloat(this._coins); } + public get credits(): number { + return parseFloat(this._credits); + } + public get formattedCredits(): string { return formatPrice(decimalShift(this._credits, 2)); } @@ -167,7 +171,7 @@ export class AccountBalance { } public get sum(): number { - return this.freeCredits + this.coins; + return this.credits + this.coins; } public hasCredits(): boolean { diff --git a/web/satellite/src/views/all-dashboard/AllDashboardArea.vue b/web/satellite/src/views/all-dashboard/AllDashboardArea.vue index ec2074db7..2406f0646 100644 --- a/web/satellite/src/views/all-dashboard/AllDashboardArea.vue +++ b/web/satellite/src/views/all-dashboard/AllDashboardArea.vue @@ -161,13 +161,6 @@ onMounted(async () => { notify.notifyError(error, AnalyticsErrorEventSource.ALL_PROJECT_DASHBOARD); } - try { - await billingStore.getCreditCards(); - } catch (error) { - error.message = `Unable to get credit cards. ${error.message}`; - notify.notifyError(error, AnalyticsErrorEventSource.ALL_PROJECT_DASHBOARD); - } - try { await projectsStore.getUserInvitations(); } catch (error) { diff --git a/web/satellite/src/views/all-dashboard/components/AllProjectsDashboardBanners.vue b/web/satellite/src/views/all-dashboard/components/AllProjectsDashboardBanners.vue index 05e42a78d..2184bfd43 100644 --- a/web/satellite/src/views/all-dashboard/components/AllProjectsDashboardBanners.vue +++ b/web/satellite/src/views/all-dashboard/components/AllProjectsDashboardBanners.vue @@ -30,11 +30,20 @@ :dashboard-ref="parentRef" :on-link-click="redirectToBillingPage" /> + +