From a59b46665c8f6a788c99cc72a4435ebbcc06bdfb Mon Sep 17 00:00:00 2001 From: Chirag Chhatrala <60499540+chiragchhatrala@users.noreply.github.com> Date: Wed, 5 Mar 2025 16:46:33 +0530 Subject: [PATCH] Billing flow redirect (#713) * Billing flow redirect * fix checkout url * Refactor checkout and subscription flow - Improve checkout URL generation with ref unwrapping - Enhance user data handling in subscription modal - Remove deprecated CheckoutDetailsModal component - Update form field and register form styling - Add more robust user data update mechanism * Refactor checkout and subscription flow - Improve checkout URL generation with ref unwrapping - Enhance user data handling in subscription modal - Remove deprecated CheckoutDetailsModal component - Update form field and register form styling - Add more robust user data update mechanism * Fix accessibility and checkout URL generation - Add proper label for terms and conditions checkbox in RegisterForm - Refactor checkout URL generation in SubscriptionModal using computed refs - Improve form input handling and reactivity --------- Co-authored-by: Julien Nahum --- .../open/forms/fields/FormFieldEdit.vue | 5 +- .../pages/auth/components/RegisterForm.vue | 4 +- .../pages/pricing/CheckoutDetailsModal.vue | 130 ------------------ .../components/pages/pricing/PricingTable.vue | 14 +- .../pages/pricing/SubscriptionModal.vue | 114 +++++++-------- client/composables/useCheckoutUrl.js | 42 ++++++ client/pages/redirect/billing-portal.vue | 29 ++++ client/pages/redirect/checkout.vue | 62 +++++++++ client/pages/settings/billing.vue | 14 +- 9 files changed, 193 insertions(+), 221 deletions(-) delete mode 100644 client/components/pages/pricing/CheckoutDetailsModal.vue create mode 100644 client/composables/useCheckoutUrl.js create mode 100644 client/pages/redirect/billing-portal.vue create mode 100644 client/pages/redirect/checkout.vue diff --git a/client/components/open/forms/fields/FormFieldEdit.vue b/client/components/open/forms/fields/FormFieldEdit.vue index 156f7b5a..3f47d17f 100644 --- a/client/components/open/forms/fields/FormFieldEdit.vue +++ b/client/components/open/forms/fields/FormFieldEdit.vue @@ -24,7 +24,10 @@ :type="field.type" /> -

+

{{ blocksTypes[field.type].title }}

diff --git a/client/components/pages/auth/components/RegisterForm.vue b/client/components/pages/auth/components/RegisterForm.vue index a5334ab5..c77290bb 100644 --- a/client/components/pages/auth/components/RegisterForm.vue +++ b/client/components/pages/auth/components/RegisterForm.vue @@ -69,10 +69,11 @@ diff --git a/client/components/pages/pricing/CheckoutDetailsModal.vue b/client/components/pages/pricing/CheckoutDetailsModal.vue deleted file mode 100644 index 9627fa39..00000000 --- a/client/components/pages/pricing/CheckoutDetailsModal.vue +++ /dev/null @@ -1,130 +0,0 @@ - - - diff --git a/client/components/pages/pricing/PricingTable.vue b/client/components/pages/pricing/PricingTable.vue index 05c0c9db..cf2e3e55 100644 --- a/client/components/pages/pricing/PricingTable.vue +++ b/client/components/pages/pricing/PricingTable.vue @@ -141,7 +141,8 @@ v-else-if="authenticated && user.is_subscribed" class="mr-1" :arrow="true" - @click.prevent="openBilling" + :to="{ name: 'redirect-billing-portal' }" + target="_blank" > View Billing @@ -222,15 +223,6 @@ export default { computed: {}, - methods: { - openBilling() { - this.billingLoading = true - opnFetch("/subscription/billing-portal").then((data) => { - this.billingLoading = false - const url = data.portal_url - window.location = url - }) - }, - }, + methods: {}, } diff --git a/client/components/pages/pricing/SubscriptionModal.vue b/client/components/pages/pricing/SubscriptionModal.vue index fcd2480e..f537bc6b 100644 --- a/client/components/pages/pricing/SubscriptionModal.vue +++ b/client/components/pages/pricing/SubscriptionModal.vue @@ -92,9 +92,9 @@ Manage Plan @@ -301,7 +301,9 @@ size="md" class="w-auto flex-grow" :loading="form.busy || loading" - @click="saveDetails" + :disabled="form.busy || loading" + :to="checkoutUrl" + target="_blank" >