diff --git a/src/lib/components/billing/estimatedTotalBox.svelte b/src/lib/components/billing/estimatedTotalBox.svelte index 932700919..cee98e16c 100644 --- a/src/lib/components/billing/estimatedTotalBox.svelte +++ b/src/lib/components/billing/estimatedTotalBox.svelte @@ -10,6 +10,7 @@ export let collaborators: string[]; export let couponData: Partial; export let billingBudget: number; + export let fixedCoupon = false; // If true, the coupon cannot be removed const today = new Date(); const billingPayDate = new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000); @@ -30,7 +31,10 @@ ); -
+

{currentPlan.name} plan

{formatCurrency(currentPlan.price)}

@@ -46,29 +50,32 @@

- + {#if !fixedCoupon} + + {/if}
- {#if couponData.credits > 100} + {#if couponData.credits >= 100}

Credits applied

diff --git a/src/lib/components/billing/selectPaymentMethod.svelte b/src/lib/components/billing/selectPaymentMethod.svelte index 0412870a6..a35f81b6a 100644 --- a/src/lib/components/billing/selectPaymentMethod.svelte +++ b/src/lib/components/billing/selectPaymentMethod.svelte @@ -43,6 +43,7 @@ {/if}
-

- - No saved payment methods +

+ + A payment method is required

diff --git a/src/lib/layout/wizardSecondaryContainer.svelte b/src/lib/layout/wizardSecondaryContainer.svelte index 976e849e8..0b9976f79 100644 --- a/src/lib/layout/wizardSecondaryContainer.svelte +++ b/src/lib/layout/wizardSecondaryContainer.svelte @@ -1,9 +1,33 @@ + +
+{#if showExitModal} + { + trackEvent('wizard_exit', { + from: 'prompt' + }); + }}> + + Are you sure you want to exit from this process? All data will be deleted. This action + is irreversible. + + +{/if} + diff --git a/src/routes/console/apply-credit/+page.ts b/src/routes/console/apply-credit/+page.ts new file mode 100644 index 000000000..a5e9c5792 --- /dev/null +++ b/src/routes/console/apply-credit/+page.ts @@ -0,0 +1,25 @@ +import { base } from '$app/paths'; +import type { Coupon } from '$lib/sdk/billing.js'; +import { campaigns } from '$lib/stores/campaigns.js'; +import { sdk } from '$lib/stores/sdk.js'; +import { redirect } from '@sveltejs/kit'; + +export const load = async ({ url }) => { + let couponData: Coupon; + if (url.searchParams.has('code')) { + const code = url.searchParams.get('code'); + try { + couponData = await sdk.forConsole.billing.getCoupon(code); + } catch (e) { + redirect(303, `${base}/console`); + } + } + if (!couponData?.campaign || !campaigns.has(couponData.campaign)) { + redirect(303, `${base}/console`); + } + + return { + couponData, + campaign: campaigns.get(couponData.campaign) + }; +}; diff --git a/src/routes/console/create-organization/+page.svelte b/src/routes/console/create-organization/+page.svelte index 900d213f1..181ad9012 100644 --- a/src/routes/console/create-organization/+page.svelte +++ b/src/routes/console/create-organization/+page.svelte @@ -33,6 +33,7 @@ ); const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/i; let previousPage: string = `${base}/console`; + let showExitModal = false; afterNavigate(({ from }) => { previousPage = from?.url?.pathname || previousPage; @@ -185,8 +186,8 @@ Create organization - Appwrite - - + + (showExitModal = true)}> Create organization @@ -194,8 +195,8 @@ @@ -287,7 +288,7 @@ - + +