Skip to content

Commit 73bbc9e

Browse files
authored
Merge pull request #1780 from appwrite/feat-feedback-fields
feat: update feedback to include additional data
2 parents a872327 + e8478c4 commit 73bbc9e

File tree

4 files changed

+49
-15
lines changed

4 files changed

+49
-15
lines changed

src/lib/components/feedback/feedback.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import { organization } from '$lib/stores/organization';
1111
import { addNotification } from '$lib/stores/notifications';
1212
import { page } from '$app/stores';
13+
import { project } from '$routes/(console)/project-[project]/store';
1314
1415
$: $selectedFeedback = feedbackOptions.find((option) => option.type === $feedback.type);
1516
@@ -21,8 +22,11 @@
2122
$page.url.href,
2223
$user.name,
2324
$user.email,
24-
$organization.billingPlan,
25-
$feedbackData.value
25+
$organization?.billingPlan,
26+
$feedbackData.value,
27+
$organization?.$id,
28+
$project?.$id,
29+
$user.$id
2630
);
2731
addNotification({
2832
type: 'success',

src/lib/stores/feedback.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,26 @@ function createFeedbackStore() {
115115
currentPage: string,
116116
name?: string,
117117
email?: string,
118-
// eslint-disable-next-line
119-
// @ts-expect-error
120118
billingPlan?: string,
121-
value?: number
119+
value?: number,
120+
orgId?: string,
121+
projectId?: string,
122+
userId?: string
122123
) => {
123124
if (!VARS.GROWTH_ENDPOINT) return;
125+
126+
const customFields: Array<{ id: string; value: string | number }> = [
127+
{ id: '47364', value: currentPage }
128+
];
129+
130+
if (value) {
131+
customFields.push({ id: '40655', value });
132+
}
133+
134+
if (billingPlan) {
135+
customFields.push({ id: '56109', value: billingPlan });
136+
}
137+
124138
const response = await fetch(`${VARS.GROWTH_ENDPOINT}/feedback`, {
125139
method: 'POST',
126140
headers: {
@@ -130,14 +144,13 @@ function createFeedbackStore() {
130144
subject,
131145
message,
132146
email,
133-
// billingPlan,
147+
customFields,
134148
firstname: name || 'Unknown',
135-
customFields: [
136-
{ id: '47364', value: currentPage },
137-
...(value ? [{ id: '40655', value }] : [])
138-
],
139149
metaFields: {
140-
source: get(feedback).source
150+
source: get(feedback).source,
151+
orgId,
152+
projectId,
153+
userId
141154
}
142155
})
143156
});

src/routes/(console)/project-[project]/settings/migrations/exportModal.svelte

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import { Alert, Box, Modal } from '$lib/components';
44
import { Button, FormList, InputText, InputTextarea } from '$lib/elements/forms';
55
import { getFormData } from '$lib/helpers/form';
6-
import { feedback } from '$lib/stores/feedback';
6+
import { feedback, feedbackData } from '$lib/stores/feedback';
7+
import { organization } from '$lib/stores/organization';
78
import { sdk } from '$lib/stores/sdk';
9+
import { user } from '$lib/stores/user';
810
import { project } from '../../store';
911
1012
export let show = false;
@@ -53,7 +55,18 @@
5355
const { endpoint, feedback: message } = formData;
5456
5557
try {
56-
await feedback.submitFeedback(`feedback-${$feedback.type}`, message, $page.url.href);
58+
await feedback.submitFeedback(
59+
`feedback-${$feedback.type}`,
60+
message,
61+
$page.url.href,
62+
$user.name,
63+
$user.email,
64+
$organization?.billingPlan,
65+
$feedbackData.value,
66+
$organization?.$id,
67+
$project?.$id,
68+
$user.$id
69+
);
5770
} catch (error) {
5871
console.error(
5972
'Feedback could not be submitted, but we continue to redirect to do export.'

src/routes/(console)/wizard/feedback/step1.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import { organization } from '$lib/stores/organization';
1111
import { addNotification } from '$lib/stores/notifications';
1212
import { page } from '$app/stores';
13+
import { project } from '$routes/(console)/project-[project]/store';
1314
1415
$: $selectedFeedback = feedbackOptions.find((option) => option.type === $feedback.type);
1516
@@ -21,8 +22,11 @@
2122
$page.url.href,
2223
$user.name,
2324
$user.email,
24-
$organization.billingPlan,
25-
$feedbackData.value
25+
$organization?.billingPlan,
26+
$feedbackData.value,
27+
$organization?.$id,
28+
$project?.$id,
29+
$user.$id
2630
);
2731
addNotification({
2832
type: 'success',

0 commit comments

Comments
 (0)