mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #2636 from appwrite/feat-feedback
Feat: downgrade feedback
This commit is contained in:
+1
-1
@@ -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",
|
||||
|
||||
Generated
+5
-5
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
@@ -140,30 +139,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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user