Merge pull request #1780 from appwrite/feat-feedback-fields

feat: update feedback to include additional data
This commit is contained in:
Darshan
2025-04-06 13:36:12 +05:30
committed by GitHub
4 changed files with 49 additions and 15 deletions
+6 -2
View File
@@ -10,6 +10,7 @@
import { organization } from '$lib/stores/organization';
import { addNotification } from '$lib/stores/notifications';
import { page } from '$app/stores';
import { project } from '$routes/(console)/project-[project]/store';
$: $selectedFeedback = feedbackOptions.find((option) => option.type === $feedback.type);
@@ -21,8 +22,11 @@
$page.url.href,
$user.name,
$user.email,
$organization.billingPlan,
$feedbackData.value
$organization?.billingPlan,
$feedbackData.value,
$organization?.$id,
$project?.$id,
$user.$id
);
addNotification({
type: 'success',
+22 -9
View File
@@ -115,12 +115,26 @@ function createFeedbackStore() {
currentPage: string,
name?: string,
email?: string,
// eslint-disable-next-line
// @ts-expect-error
billingPlan?: string,
value?: number
value?: number,
orgId?: string,
projectId?: string,
userId?: string
) => {
if (!VARS.GROWTH_ENDPOINT) return;
const customFields: Array<{ id: string; value: string | number }> = [
{ id: '47364', value: currentPage }
];
if (value) {
customFields.push({ id: '40655', value });
}
if (billingPlan) {
customFields.push({ id: '56109', value: billingPlan });
}
const response = await fetch(`${VARS.GROWTH_ENDPOINT}/feedback`, {
method: 'POST',
headers: {
@@ -130,14 +144,13 @@ function createFeedbackStore() {
subject,
message,
email,
// billingPlan,
customFields,
firstname: name || 'Unknown',
customFields: [
{ id: '47364', value: currentPage },
...(value ? [{ id: '40655', value }] : [])
],
metaFields: {
source: get(feedback).source
source: get(feedback).source,
orgId,
projectId,
userId
}
})
});
@@ -3,8 +3,10 @@
import { Alert, Box, Modal } from '$lib/components';
import { Button, FormList, InputText, InputTextarea } from '$lib/elements/forms';
import { getFormData } from '$lib/helpers/form';
import { feedback } from '$lib/stores/feedback';
import { feedback, feedbackData } from '$lib/stores/feedback';
import { organization } from '$lib/stores/organization';
import { sdk } from '$lib/stores/sdk';
import { user } from '$lib/stores/user';
import { project } from '../../store';
export let show = false;
@@ -53,7 +55,18 @@
const { endpoint, feedback: message } = formData;
try {
await feedback.submitFeedback(`feedback-${$feedback.type}`, message, $page.url.href);
await feedback.submitFeedback(
`feedback-${$feedback.type}`,
message,
$page.url.href,
$user.name,
$user.email,
$organization?.billingPlan,
$feedbackData.value,
$organization?.$id,
$project?.$id,
$user.$id
);
} catch (error) {
console.error(
'Feedback could not be submitted, but we continue to redirect to do export.'
@@ -10,6 +10,7 @@
import { organization } from '$lib/stores/organization';
import { addNotification } from '$lib/stores/notifications';
import { page } from '$app/stores';
import { project } from '$routes/(console)/project-[project]/store';
$: $selectedFeedback = feedbackOptions.find((option) => option.type === $feedback.type);
@@ -21,8 +22,11 @@
$page.url.href,
$user.name,
$user.email,
$organization.billingPlan,
$feedbackData.value
$organization?.billingPlan,
$feedbackData.value,
$organization?.$id,
$project?.$id,
$user.$id
);
addNotification({
type: 'success',