diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e0ede202f..c8fc1d7b8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -95,7 +95,7 @@ importers:
version: 6.6.3
'@testing-library/svelte':
specifier: ^5.2.4
- version: 5.2.4(svelte@4.2.19)(vite@5.4.11(@types/node@22.9.0)(sass@1.81.0))(vitest@1.6.1)
+ version: 5.2.4(svelte@4.2.19)(vite@5.4.11(@types/node@22.9.0)(sass@1.81.0))(vitest@1.6.1(@types/node@22.9.0)(@vitest/ui@1.6.0)(jsdom@22.1.0)(sass@1.81.0))
'@testing-library/user-event':
specifier: ^14.5.2
version: 14.5.2(@testing-library/dom@10.4.0)
@@ -5078,7 +5078,7 @@ snapshots:
lodash: 4.17.21
redent: 3.0.0
- '@testing-library/svelte@5.2.4(svelte@4.2.19)(vite@5.4.11(@types/node@22.9.0)(sass@1.81.0))(vitest@1.6.1)':
+ '@testing-library/svelte@5.2.4(svelte@4.2.19)(vite@5.4.11(@types/node@22.9.0)(sass@1.81.0))(vitest@1.6.1(@types/node@22.9.0)(@vitest/ui@1.6.0)(jsdom@22.1.0)(sass@1.81.0))':
dependencies:
'@testing-library/dom': 10.4.0
svelte: 4.2.19
diff --git a/src/lib/components/billing/couponInput.svelte b/src/lib/components/billing/couponInput.svelte
index 369619afe..a6c1658ec 100644
--- a/src/lib/components/billing/couponInput.svelte
+++ b/src/lib/components/billing/couponInput.svelte
@@ -17,7 +17,7 @@
async function addCoupon() {
try {
- const response = await sdk.forConsole.billing.getCoupon(coupon);
+ const response = await sdk.forConsole.billing.getCouponAccount(coupon);
couponData = response;
dispatch('validation', couponData);
coupon = null;
diff --git a/src/lib/components/billing/validateCreditModal.svelte b/src/lib/components/billing/validateCreditModal.svelte
index 961e04144..deefc106f 100644
--- a/src/lib/components/billing/validateCreditModal.svelte
+++ b/src/lib/components/billing/validateCreditModal.svelte
@@ -18,7 +18,7 @@
async function addCoupon() {
try {
- const response = await sdk.forConsole.billing.getCoupon(coupon);
+ const response = await sdk.forConsole.billing.getCouponAccount(coupon);
couponData = response;
dispatch('validation', couponData);
coupon = null;
diff --git a/src/lib/layout/wizardSecondaryContent.svelte b/src/lib/layout/wizardSecondaryContent.svelte
index 908995692..f4e9ea882 100644
--- a/src/lib/layout/wizardSecondaryContent.svelte
+++ b/src/lib/layout/wizardSecondaryContent.svelte
@@ -1,9 +1,15 @@
+
+
-
-
-
-
+ {#if !hideSidebar}
+
+
+
+
+ {/if}
diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts
index 5f2a549c2..d5d158b0b 100644
--- a/src/lib/sdk/billing.ts
+++ b/src/lib/sdk/billing.ts
@@ -891,7 +891,7 @@ export class Billing {
}
}
- async getCoupon(couponId: string): Promise {
+ async getCouponAccount(couponId: string): Promise {
const path = `/account/coupons/${couponId}`;
const params = {
couponId
@@ -907,6 +907,22 @@ export class Billing {
);
}
+ async getCoupon(couponId: string): Promise {
+ const path = `/console/coupons/${couponId}`;
+ const params = {
+ couponId
+ };
+ const uri = new URL(this.client.config.endpoint + path);
+ return await this.client.call(
+ 'GET',
+ uri,
+ {
+ 'content-type': 'application/json'
+ },
+ params
+ );
+ }
+
async setBillingAddress(
organizationId: string,
billingAddressId: string
diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts
index 636853952..83cb2d1d6 100644
--- a/src/lib/stores/billing.ts
+++ b/src/lib/stores/billing.ts
@@ -465,7 +465,7 @@ export async function checkForNewDevUpgradePro(org: Organization) {
if (isDismissed) return;
// check if coupon already applied
try {
- await sdk.forConsole.billing.getCoupon(NEW_DEV_PRO_UPGRADE_COUPON);
+ await sdk.forConsole.billing.getCouponAccount(NEW_DEV_PRO_UPGRADE_COUPON);
} catch (e) {
return;
}
diff --git a/src/routes/(console)/apply-credit/+page.svelte b/src/routes/(console)/apply-credit/+page.svelte
index 2c4137270..12380757e 100644
--- a/src/routes/(console)/apply-credit/+page.svelte
+++ b/src/routes/(console)/apply-credit/+page.svelte
@@ -13,7 +13,7 @@
import { app } from '$lib/stores/app';
import { addNotification } from '$lib/stores/notifications';
import { organizationList, type Organization } from '$lib/stores/organization';
- import { ID } from '@appwrite.io/console';
+ import { BillingPlan, ID } from '@appwrite.io/console';
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
import { CreditsApplied } from '$lib/components/billing';
@@ -59,6 +59,10 @@
$: selectedAction = selectedOrgId === newOrgId ? 'create' : 'update';
onMount(async () => {
+ if (!$organizationList?.total && couponData?.code) {
+ goto(`${base}/create-organization?coupon=${couponData.code}&plan=${BillingPlan.Tier1}`);
+ }
+
if (!$organizationList?.total || campaign?.onlyNewOrgs) {
selectedOrgId = newOrgId;
}
@@ -134,7 +138,7 @@
Apply credits
-
+