From bb1fdfb2c90f19e09a83a664ff135527efb43596 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 10 Oct 2024 15:24:19 +0200 Subject: [PATCH] feat: new sdk --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- src/lib/components/billing/couponInput.svelte | 2 +- src/lib/components/billing/validateCreditModal.svelte | 2 +- src/lib/components/roles/upgrade.svelte | 8 ++++---- src/lib/stores/billing.ts | 4 ++-- .../(console)/account/organizations/+page.svelte | 2 +- src/routes/(console)/apply-credit/+page.svelte | 2 +- src/routes/(console)/apply-credit/+page.ts | 2 +- src/routes/(console)/create-organization/+page.svelte | 2 +- .../billing/replaceAddress.svelte | 2 +- .../billing/wizard/addCredit.svelte | 2 +- .../change-plan/+page.svelte | 2 +- src/routes/(public)/(guest)/login/+page.ts | 2 +- src/routes/(public)/(guest)/register/+page.ts | 2 +- src/routes/+layout.svelte | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 6efe34451..beb42a69f 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "e2e:ui": "playwright test tests/e2e --ui" }, "dependencies": { - "@appwrite.io/console": "^1.3.2", + "@appwrite.io/console": "^1.4.0", "@appwrite.io/pink": "0.25.0", "@appwrite.io/pink-icons": "0.25.0", "@popperjs/core": "^2.11.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6911738d..10a5907f5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@appwrite.io/console': - specifier: ^1.3.2 - version: 1.3.2 + specifier: ^1.4.0 + version: 1.4.0 '@appwrite.io/pink': specifier: 0.25.0 version: 0.25.0 @@ -193,8 +193,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@1.3.2': - resolution: {integrity: sha512-3OKKlhXbEqgWPZxdJjmzVZkOoBbJBkOiTqqQWP9ZnuBNEXwIkaXsneMjkPYS3IEBLkJ9zNMON7rH8kkEgMnEgw==} + '@appwrite.io/console@1.4.0': + resolution: {integrity: sha512-hN4UWdXff/9Xmy53hhglTFBe7TUC7BEJXqjoiewupLWIpcMq90dY4f00t0VncVZW3amUsQUYHbCgUuAHatLA/Q==} '@appwrite.io/pink-icons@0.25.0': resolution: {integrity: sha512-0O3i2oEuh5mWvjO80i+X6rbzrWLJ1m5wmv2/M3a1p2PyBJsFxN8xQMTEmTn3Wl/D26SsM7SpzbdW6gmfgoVU9Q==} @@ -3723,7 +3723,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@1.3.2': {} + '@appwrite.io/console@1.4.0': {} '@appwrite.io/pink-icons@0.25.0': {} diff --git a/src/lib/components/billing/couponInput.svelte b/src/lib/components/billing/couponInput.svelte index 0f610046b..2375bb575 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.console.getCopon(coupon); + const response = await sdk.forConsole.console.getCoupon(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 f444e247e..a540506db 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.console.getCopon(coupon); + const response = await sdk.forConsole.console.getCoupon(coupon); couponData = response; dispatch('validation', couponData); coupon = null; diff --git a/src/lib/components/roles/upgrade.svelte b/src/lib/components/roles/upgrade.svelte index 9e5487476..ab0d51967 100644 --- a/src/lib/components/roles/upgrade.svelte +++ b/src/lib/components/roles/upgrade.svelte @@ -3,17 +3,17 @@ import { upgradeURL } from '$lib/stores/billing'; import { isCloud } from '$lib/system'; import { organization } from '$lib/stores/organization'; - import { BillingPlan } from '$lib/constants'; + import { BillingPlan } from '@appwrite.io/console'; import Button from '$lib/elements/forms/button.svelte'; {#if isCloud} - {#if $organization?.billingPlan !== BillingPlan.FREE} + {#if $organization?.billingPlan !== BillingPlan.Tier0}

Roles - {#if $organization?.billingPlan === BillingPlan.FREE} + {#if $organization?.billingPlan === BillingPlan.Tier0} Pro plan {/if}

@@ -27,7 +27,7 @@

Roles - {#if $organization?.billingPlan === BillingPlan.FREE} + {#if $organization?.billingPlan === BillingPlan.Tier0} Pro plan {/if}

diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 8cdcec3c4..236e5703e 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -416,8 +416,8 @@ export async function checkForMissingPaymentMethod() { Query.isNull('paymentMethodId'), Query.isNull('backupPaymentMethodId') ]); - if (orgs?.total) { - orgMissingPaymentMethod.set(orgs.teams[0] as Organization); + if (orgs?.teams.length > 0) { + orgMissingPaymentMethod.set(orgs.teams[0] as unknown as Organization); headerAlert.add({ id: 'missingPaymentMethod', component: MissingPaymentMethod, diff --git a/src/routes/(console)/account/organizations/+page.svelte b/src/routes/(console)/account/organizations/+page.svelte index be9897158..553047232 100644 --- a/src/routes/(console)/account/organizations/+page.svelte +++ b/src/routes/(console)/account/organizations/+page.svelte @@ -81,7 +81,7 @@ FREE
{/if} - {#if organization?.billingTrialStartDate && $daysLeftInTrial > 0 && organization.billingPlan !== BillingPlan.Tier0 && $plansInfo.get(organization.billingPlan)?.trialDays} + {#if organization?.billingTrialStartDate && $daysLeftInTrial > 0 && organization.billingPlan !== BillingPlan.Tier0 && $plansInfo.get(organization.billingPlan)?.trial}
{ let couponData: Coupon; const code = url.searchParams.get('code'); try { - couponData = await sdk.forConsole.console.getCopon(code); + couponData = await sdk.forConsole.console.getCoupon(code); } catch (e) { redirect(303, base); } diff --git a/src/routes/(console)/create-organization/+page.svelte b/src/routes/(console)/create-organization/+page.svelte index 1f965a2c4..463f35ab2 100644 --- a/src/routes/(console)/create-organization/+page.svelte +++ b/src/routes/(console)/create-organization/+page.svelte @@ -60,7 +60,7 @@ if ($page.url.searchParams.has('coupon')) { const coupon = $page.url.searchParams.get('coupon'); try { - const response = await sdk.forConsole.console.getCopon(coupon); + const response = await sdk.forConsole.console.getCoupon(coupon); couponData = response; } catch (e) { couponData = { diff --git a/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte b/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte index 632ffcdf7..085a7c322 100644 --- a/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte +++ b/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte @@ -12,7 +12,7 @@ import type { Models } from '@appwrite.io/console'; export let show = false; - let addresses: Models.BillingAddress; + let addresses: Models.BillingAddressList; let selectedAddress: string; let error: string; let country: string; diff --git a/src/routes/(console)/organization-[organization]/billing/wizard/addCredit.svelte b/src/routes/(console)/organization-[organization]/billing/wizard/addCredit.svelte index 58622b3e4..069dbff0e 100644 --- a/src/routes/(console)/organization-[organization]/billing/wizard/addCredit.svelte +++ b/src/routes/(console)/organization-[organization]/billing/wizard/addCredit.svelte @@ -17,7 +17,7 @@ async function validateCoupon() { if (couponData?.status === 'active') return; try { - const response = await sdk.forConsole.console.getCopon(coupon); + const response = await sdk.forConsole.console.getCoupon(coupon); couponData = response; $addCreditWizardStore.coupon = coupon; coupon = null; diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte index a570a0b94..6fdd571dd 100644 --- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte +++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte @@ -79,7 +79,7 @@ if ($page.url.searchParams.has('code')) { const coupon = $page.url.searchParams.get('code'); try { - const response = await sdk.forConsole.console.getCopon(coupon); + const response = await sdk.forConsole.console.getCoupon(coupon); couponData = response; } catch (e) { couponData = { diff --git a/src/routes/(public)/(guest)/login/+page.ts b/src/routes/(public)/(guest)/login/+page.ts index 361bfed5b..4cc48fa8e 100644 --- a/src/routes/(public)/(guest)/login/+page.ts +++ b/src/routes/(public)/(guest)/login/+page.ts @@ -8,7 +8,7 @@ export const load: PageLoad = async ({ url }) => { if (url.searchParams.has('code')) { const code = url.searchParams.get('code'); try { - const couponData = await sdk.forConsole.console.getCopon(code); + const couponData = await sdk.forConsole.console.getCoupon(code); if (couponData?.campaign && campaigns.has(couponData.campaign)) { return { couponData diff --git a/src/routes/(public)/(guest)/register/+page.ts b/src/routes/(public)/(guest)/register/+page.ts index df7a08b3b..b1f7d2037 100644 --- a/src/routes/(public)/(guest)/register/+page.ts +++ b/src/routes/(public)/(guest)/register/+page.ts @@ -8,7 +8,7 @@ export const load: PageLoad = async ({ url }) => { if (url.searchParams.has('code')) { const code = url.searchParams.get('code'); try { - const couponData = await sdk.forConsole.console.getCopon(code); + const couponData = await sdk.forConsole.console.getCoupon(code); if (couponData?.campaign && campaigns.has(couponData.campaign)) { return { couponData diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 099a341ec..d6e9f4084 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -42,7 +42,7 @@ if ($page.url.searchParams.has('code')) { const code = $page.url.searchParams.get('code'); - const coupon = await sdk.forConsole.console.getCopon(code).catch(() => null); + const coupon = await sdk.forConsole.console.getCoupon(code).catch(() => null); if (coupon?.campaign && campaigns.has(coupon.campaign)) { if ($user) { goto(`${base}/apply-credit?code=${code}`);