From 5a51d1aefcee87613c0e67d98ee236207f926971 Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 13 Feb 2025 11:17:25 +0530 Subject: [PATCH 1/6] update: manage redirection after coupon validation. --- .../(console)/apply-credit/+page.svelte | 234 ++++-------------- .../change-plan/+page.svelte | 20 +- 2 files changed, 54 insertions(+), 200 deletions(-) diff --git a/src/routes/(console)/apply-credit/+page.svelte b/src/routes/(console)/apply-credit/+page.svelte index 95af6175f..f2ffe86db 100644 --- a/src/routes/(console)/apply-credit/+page.svelte +++ b/src/routes/(console)/apply-credit/+page.svelte @@ -1,22 +1,14 @@ @@ -214,44 +119,10 @@ placeholder="Select organization" id="organization" /> {/if} - {#if selectedOrgId && (selectedOrg?.billingPlan !== BillingPlan.PRO || !selectedOrg?.paymentMethodId)} - {#if selectedOrgId === newOrgId} - - {/if} - - - {/if} - - -
- - {#if !data?.couponData?.code && selectedOrgId} - - - - {/if}
+ + {#if campaign?.template === 'card'}
{/if} - {#if selectedOrg?.$id && selectedOrg?.billingPlan !== BillingPlan.FREE && selectedOrg?.billingPlan !== BillingPlan.GITHUB_EDUCATION} -
- {#if couponData?.code && couponData?.status === 'active'} - -

+ +

+ {#if couponData?.code && couponData?.status === 'active'} + {@const dateAvailable = selectedOrg?.billingNextInvoiceDate} + +

+ {#if !dateAvailable} + Credits will automatically be applied to your next invoice. + {:else} Credits will automatically be applied to your next invoice on {toLocaleDate(selectedOrg?.billingNextInvoiceDate)}. -

- {:else} -

Add a coupon code to apply credits to your organization.

- {/if} -
- {:else if selectedOrgId} -
- - {#if campaign?.template === 'review' && (campaign?.cta || campaign?.claimed || campaign?.unclaimed)} -
-

{campaign?.cta}

-

- {#if couponData?.code && couponData?.status === 'active' && campaign?.claimed} - {campaign?.claimed} - {:else if campaign?.unclaimed} - {campaign?.unclaimed} - {/if} -

-
+ >{toLocaleDate(selectedOrg?.billingNextInvoiceDate)}. {/if} -
-
- {/if} +

+ {:else} +

Add a coupon code to apply credits to your organization.

+ {/if} +
@@ -319,11 +173,11 @@