From 1f57b21c89eab2e3abe7fbdbb0a999847e2246d1 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 27 May 2025 15:07:08 +0200 Subject: [PATCH] fix: create organization payment methods not updating --- .../billing/selectPaymentMethod.svelte | 1 + src/lib/constants.ts | 1 + .../create-organization/+page.svelte | 37 ++++++++++++------- .../(console)/create-organization/+page.ts | 5 ++- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/lib/components/billing/selectPaymentMethod.svelte b/src/lib/components/billing/selectPaymentMethod.svelte index dac287731f..7dfe14a2ed 100644 --- a/src/lib/components/billing/selectPaymentMethod.svelte +++ b/src/lib/components/billing/selectPaymentMethod.svelte @@ -21,6 +21,7 @@ async function cardSaved(event: CustomEvent) { value = event.detail.$id; invalidate(Dependencies.UPGRADE_PLAN); + invalidate(Dependencies.CREATE_ORGANIZATION); } onMount(() => { diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 58ae2e443b..067b354dd9 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -18,6 +18,7 @@ export enum Dependencies { INVOICES = 'dependency:invoices', ADDRESS = 'dependency:address', UPGRADE_PLAN = 'dependency:upgrade_plan', + CREATE_ORGANIZATION = 'dependency:create_organization', PAYMENT_METHODS = 'dependency:paymentMethods', ORGANIZATION = 'dependency:organization', MEMBERS = 'dependency:members', diff --git a/src/routes/(console)/create-organization/+page.svelte b/src/routes/(console)/create-organization/+page.svelte index 5599131ceb..77049390e7 100644 --- a/src/routes/(console)/create-organization/+page.svelte +++ b/src/routes/(console)/create-organization/+page.svelte @@ -213,20 +213,29 @@ {#if selectedPlan !== BillingPlan.FREE}
- - - {#if !selectedCoupon?.code} - - - {/if} - - + + + + {#if !selectedCoupon?.code && paymentMethodId} + + + {/if} + + + + {#if !selectedCoupon?.code && !paymentMethodId} + + {/if} +
{ +export const load: PageLoad = async ({ url, parent, depends }) => { + depends(Dependencies.CREATE_ORGANIZATION); const { organizations } = await parent(); const [coupon, paymentMethods] = await Promise.all([ getCoupon(url),