From bbd3efaeed31e7336e8390fc1417d278d25c3557 Mon Sep 17 00:00:00 2001 From: Vitalii Shpital Date: Thu, 1 Jul 2021 22:47:41 +0300 Subject: [PATCH] web/satellite: Paid Tier add payment modal implemented Added new PaidTier-related modal where user can add CC or STORJ Tokens. Becomes visible on CTA click on Paid Tier banner at the top. Change-Id: I51015e95d396e21d5c1a1728b8f753798626c09e --- .../billing/freeCredits/AddCouponCode.vue | 1 - .../paidTier/AddPaymentMethodModal.vue | 576 ++++++++++++++++++ .../account/billing/paidTier/PaidTierBar.vue | 7 +- .../billing/paymentMethods/AddStorjForm.vue | 17 +- .../billing/paymentMethods/PaymentMethods.vue | 2 +- .../paymentMethods/TokenDepositSelection.vue | 82 +-- .../components/project/ProjectDashboard.vue | 15 +- web/satellite/src/router/index.ts | 11 + web/satellite/src/store/modules/payments.ts | 6 + web/satellite/src/views/DashboardArea.vue | 21 +- .../images/common/greenRoundCheckmark.svg | 5 + .../images/common/greenRoundCheckmarkBig.svg | 5 + .../__snapshots__/AddStorjForm.spec.ts.snap | 2 +- .../__snapshots__/DashboardArea.spec.ts.snap | 2 + 14 files changed, 672 insertions(+), 80 deletions(-) create mode 100644 web/satellite/src/components/account/billing/paidTier/AddPaymentMethodModal.vue create mode 100644 web/satellite/static/images/common/greenRoundCheckmark.svg create mode 100644 web/satellite/static/images/common/greenRoundCheckmarkBig.svg diff --git a/web/satellite/src/components/account/billing/freeCredits/AddCouponCode.vue b/web/satellite/src/components/account/billing/freeCredits/AddCouponCode.vue index 18ba44848..aec2af38e 100644 --- a/web/satellite/src/components/account/billing/freeCredits/AddCouponCode.vue +++ b/web/satellite/src/components/account/billing/freeCredits/AddCouponCode.vue @@ -23,7 +23,6 @@ import { Component, Prop, Vue } from 'vue-property-decorator'; import AddCouponCodeInput from '@/components/common/AddCouponCodeInput.vue'; import HeaderlessInput from '@/components/common/HeaderlessInput.vue'; -import ValidationMessage from '@/components/common/ValidationMessage.vue'; import CloseIcon from '@/../static/images/common/closeCross.svg'; import CheckIcon from '@/../static/images/common/success-check.svg'; diff --git a/web/satellite/src/components/account/billing/paidTier/AddPaymentMethodModal.vue b/web/satellite/src/components/account/billing/paidTier/AddPaymentMethodModal.vue new file mode 100644 index 000000000..8bffdc854 --- /dev/null +++ b/web/satellite/src/components/account/billing/paidTier/AddPaymentMethodModal.vue @@ -0,0 +1,576 @@ +// Copyright (C) 2021 Storj Labs, Inc. +// See LICENSE for copying information. + + + + + + diff --git a/web/satellite/src/components/account/billing/paidTier/PaidTierBar.vue b/web/satellite/src/components/account/billing/paidTier/PaidTierBar.vue index 90a5f49ea..b4b95c746 100644 --- a/web/satellite/src/components/account/billing/paidTier/PaidTierBar.vue +++ b/web/satellite/src/components/account/billing/paidTier/PaidTierBar.vue @@ -19,13 +19,13 @@

Upload up to 75TB. - Upgrade now. + Upgrade now.

@@ -357,9 +308,4 @@ export default class TokenDepositSelection extends Vue { top: 0; left: 0; } - - .top-expand { - top: -290px; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.25); - } diff --git a/web/satellite/src/components/project/ProjectDashboard.vue b/web/satellite/src/components/project/ProjectDashboard.vue index e88f5a0d2..564ae91b7 100644 --- a/web/satellite/src/components/project/ProjectDashboard.vue +++ b/web/satellite/src/components/project/ProjectDashboard.vue @@ -61,9 +61,11 @@ export default class ProjectDashboard extends Vue { const FIRST_PAGE = 1; try { - await this.$store.commit(PAYMENTS_MUTATIONS.TOGGLE_PAID_TIER_BANNER_TO_LOADING); - await this.$store.dispatch(PROJECTS_ACTIONS.GET_TOTAL_LIMITS); - await this.$store.commit(PAYMENTS_MUTATIONS.TOGGLE_PAID_TIER_BANNER_TO_LOADED); + if (!this.isPaidTierStatus) { + await this.$store.commit(PAYMENTS_MUTATIONS.TOGGLE_PAID_TIER_BANNER_TO_LOADING); + await this.$store.dispatch(PROJECTS_ACTIONS.GET_TOTAL_LIMITS); + await this.$store.commit(PAYMENTS_MUTATIONS.TOGGLE_PAID_TIER_BANNER_TO_LOADED); + } await this.$store.dispatch(BUCKET_ACTIONS.FETCH, FIRST_PAGE); @@ -92,6 +94,13 @@ export default class ProjectDashboard extends Vue { public get projectLimitsIncreaseRequestURL(): string { return MetaUtils.getMetaContent('project-limits-increase-request-url'); } + + /** + * Returns user's paid tier status from store. + */ + private get isPaidTierStatus(): boolean { + return this.$store.state.usersModule.paidTier; + } } diff --git a/web/satellite/src/router/index.ts b/web/satellite/src/router/index.ts index 7e83c32b7..9ef30f382 100644 --- a/web/satellite/src/router/index.ts +++ b/web/satellite/src/router/index.ts @@ -137,6 +137,11 @@ export const router = new Router({ }, component: DashboardArea, children: [ + { + path: RouteConfig.Root.path, + name: 'default', + component: ProjectDashboard, + }, { path: RouteConfig.Account.path, name: RouteConfig.Account.name, @@ -396,6 +401,12 @@ router.beforeEach(async (to, from, next) => { return; } + if (to.name === 'default') { + next(RouteConfig.ProjectDashboard.path); + + return; + } + next(); }); diff --git a/web/satellite/src/store/modules/payments.ts b/web/satellite/src/store/modules/payments.ts index cf6294adc..d92c7625a 100644 --- a/web/satellite/src/store/modules/payments.ts +++ b/web/satellite/src/store/modules/payments.ts @@ -29,6 +29,7 @@ export const PAYMENTS_MUTATIONS = { SET_PRICE_SUMMARY_FOR_SELECTED_PROJECT: 'SET_PRICE_SUMMARY_FOR_SELECTED_PROJECT', TOGGLE_PAID_TIER_BANNER_TO_LOADING: 'TOGGLE_PAID_TIER_BANNER_TO_LOADING', TOGGLE_PAID_TIER_BANNER_TO_LOADED: 'TOGGLE_PAID_TIER_BANNER_TO_LOADED', + TOGGLE_IS_ADD_PM_MODAL_SHOWN: 'TOGGLE_IS_ADD_PM_MODAL_SHOWN', }; export const PAYMENTS_ACTIONS = { @@ -61,6 +62,7 @@ const { SET_PRICE_SUMMARY_FOR_SELECTED_PROJECT, TOGGLE_PAID_TIER_BANNER_TO_LOADING, TOGGLE_PAID_TIER_BANNER_TO_LOADED, + TOGGLE_IS_ADD_PM_MODAL_SHOWN, } = PAYMENTS_MUTATIONS; const { @@ -92,6 +94,7 @@ export class PaymentsState { public startDate: Date = new Date(); public endDate: Date = new Date(); public isPaidTierBarLoading: boolean = true; + public isAddPMModalShown: boolean = false; } /** @@ -176,6 +179,9 @@ export function makePaymentsModule(api: PaymentsApi): StoreModule [TOGGLE_PAID_TIER_BANNER_TO_LOADED](state: PaymentsState): void { state.isPaidTierBarLoading = false; }, + [TOGGLE_IS_ADD_PM_MODAL_SHOWN](state: PaymentsState): void { + state.isAddPMModalShown = !state.isAddPMModalShown; + }, [CLEAR](state: PaymentsState) { state.balance = new AccountBalance(); state.paymentsHistory = []; diff --git a/web/satellite/src/views/DashboardArea.vue b/web/satellite/src/views/DashboardArea.vue index fdc6efc71..fe686d995 100644 --- a/web/satellite/src/views/DashboardArea.vue +++ b/web/satellite/src/views/DashboardArea.vue @@ -15,7 +15,7 @@

- +
@@ -24,12 +24,14 @@
+