From 46fdb29ba6e0c9e70752630146439c72cd18d830 Mon Sep 17 00:00:00 2001 From: "Calum H." Date: Wed, 11 Jun 2025 23:05:34 +0100 Subject: [PATCH] feat: billing interval change support for servers --- apps/frontend/src/error.vue | 3 + .../src/pages/settings/billing/index.vue | 53 ++++++ .../src/components/billing/PurchaseModal.vue | 170 +++++++++++------- 3 files changed, 158 insertions(+), 68 deletions(-) diff --git a/apps/frontend/src/error.vue b/apps/frontend/src/error.vue index 8b28f35ea..c43178753 100644 --- a/apps/frontend/src/error.vue +++ b/apps/frontend/src/error.vue @@ -77,6 +77,9 @@ const errorMessages = computed( const route = useRoute(); +// TODO: REMOVE BEFORE MERGE +console.log(props.error); + watch(route, () => { console.log(route); }); diff --git a/apps/frontend/src/pages/settings/billing/index.vue b/apps/frontend/src/pages/settings/billing/index.vue index 517a41c99..9200e9394 100644 --- a/apps/frontend/src/pages/settings/billing/index.vue +++ b/apps/frontend/src/pages/settings/billing/index.vue @@ -353,6 +353,21 @@ Upgrade + + + + midasCharge.value?.subscription_interval === "yearly" ? "monthly" : "yearly", ); +async function showPyroIntervalChange(subscription) { + currentSubscription.value = subscription; + currentSubRenewalDate.value = getPyroCharge(subscription).due; + currentProduct.value = getPyroProduct(subscription); + + upgradeProducts.value = [currentProduct.value]; + upgradeProducts.value.metadata = { type: "pyro" }; + + await nextTick(); + pyroIntervalModal.value.show(); +} + async function switchMidasInterval(interval) { changingInterval.value = true; startLoading(); @@ -941,6 +993,7 @@ const getProductPrice = (product, interval) => { const modalCancel = ref(null); const pyroPurchaseModal = ref(); +const pyroIntervalModal = ref(); const currentSubscription = ref(null); const currentProduct = ref(null); const upgradeProducts = ref([]); diff --git a/packages/ui/src/components/billing/PurchaseModal.vue b/packages/ui/src/components/billing/PurchaseModal.vue index 7b216b9a6..e04fe3d66 100644 --- a/packages/ui/src/components/billing/PurchaseModal.vue +++ b/packages/ui/src/components/billing/PurchaseModal.vue @@ -2,7 +2,8 @@