From 86ec87db1c6136827f4863cd01e0f9735c5d4f6b Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 24 Nov 2025 05:36:20 +0000 Subject: [PATCH 1/2] Feat: feedback --- package.json | 2 +- pnpm-lock.yaml | 10 +++--- src/lib/stores/sdk.ts | 6 ++-- .../change-plan/+page.svelte | 32 +++++-------------- 4 files changed, 18 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index c66472af6f..e40ae97ed5 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@ai-sdk/svelte": "^1.1.24", - "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@315d6c5", + "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@acef319", "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@6916470", "@appwrite.io/pink-legacy": "^1.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 35008b89c1..1724be8386 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^1.1.24 version: 1.1.24(svelte@5.25.3)(zod@3.24.3) '@appwrite.io/console': - specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@315d6c5 - version: https://pkg.vc/-/@appwrite/@appwrite.io/console@315d6c5 + specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@acef319 + version: https://pkg.vc/-/@appwrite/@appwrite.io/console@acef319 '@appwrite.io/pink-icons': specifier: 0.25.0 version: 0.25.0 @@ -260,8 +260,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@315d6c5': - resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@315d6c5} + '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@acef319': + resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@acef319} version: 1.10.0 '@appwrite.io/pink-icons-svelte@2.0.0-RC.1': @@ -3703,7 +3703,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@315d6c5': {} + '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@acef319': {} '@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.25.3)': dependencies: diff --git a/src/lib/stores/sdk.ts b/src/lib/stores/sdk.ts index daeb7ffba8..05f9f54db6 100644 --- a/src/lib/stores/sdk.ts +++ b/src/lib/stores/sdk.ts @@ -22,7 +22,8 @@ import { Tokens, TablesDB, Domains, - Realtime + Realtime, + Organizations } from '@appwrite.io/console'; import { Billing } from '../sdk/billing'; import { Backups } from '../sdk/backups'; @@ -95,7 +96,8 @@ function createConsoleSdk(client: Client) { sites: new Sites(client), domains: new Domains(client), storage: new Storage(client), - realtime: new Realtime(client) + realtime: new Realtime(client), + organizations: new Organizations(client) }; } diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte index cc38a62528..21dd54b3a9 100644 --- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte +++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte @@ -140,30 +140,14 @@ } async function trackDowngradeFeedback() { - const paidInvoices = await sdk.forConsole.billing.listInvoices(data.organization.$id, [ - Query.equal('status', 'succeeded'), - Query.greaterThan('grossAmount', 0) - ]); - - await fetch(`${VARS.GROWTH_ENDPOINT}/feedback/billing`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - from: tierToPlan(data.organization.billingPlan).name, - to: tierToPlan(selectedPlan).name, - email: data.account.email, - reason: feedbackDowngradeOptions.find( - (option) => option.value === feedbackDowngradeReason - )?.label, - orgId: data.organization.$id, - userId: data.account.$id, - orgAge: data.organization.$createdAt, - userAge: data.account.$createdAt, - paidInvoices: paidInvoices.total, - message: feedbackMessage ?? '' - }) + await sdk.forConsole.organizations.createDowngradeFeedback({ + organizationId: data.organization.$id, + reason: feedbackDowngradeOptions.find( + (option) => option.value === feedbackDowngradeReason + )?.label, + message: feedbackMessage ?? '', + fromPlanId: data.organization.billingPlan, + toPlanId: selectedPlan }); } From b352dcb7335b168d4adea32f2171845c14c4706d Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 24 Nov 2025 05:51:44 +0000 Subject: [PATCH 2/2] remove unused var --- .../organization-[organization]/change-plan/+page.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte index 21dd54b3a9..ac5d47b755 100644 --- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte +++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte @@ -16,7 +16,6 @@ import { sdk } from '$lib/stores/sdk'; import { confirmPayment } from '$lib/stores/stripe'; import { user } from '$lib/stores/user'; - import { VARS } from '$lib/system'; import { IconPlus } from '@appwrite.io/pink-icons-svelte'; import { Alert,