Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Send exit surveys to new endpoint

Long Hoang1efa30c43f20
diff --git a/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.tsx b/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.tsx
index 8a132af57f2..c1838f7c233 100644
--- a/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.tsx
+++ b/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.tsx
@@ -8,7 +8,6 @@ import { useStore } from 'hooks'
import { post, patch } from 'lib/common/fetch'
import { API_URL, PROJECT_STATUS } from 'lib/constants'
import { CANCELLATION_REASONS } from '../Billing.constants'
-import { generateFeedbackMessage } from './ExitSurvey.utils'
import { UpdateSuccess } from '../'
import { SubscriptionPreview } from '../Billing.types'
import { StripeSubscription } from 'components/interfaces/Billing'
@@ -138,14 +137,11 @@ const ExitSurvey: FC<Props> = ({ freeTier, subscription, onSelectBack }) => {
setIsSuccessful(true)
}
}
-
- // Submit exit survey to Hubspot
- const feedbackRes = await post(`${API_URL}/feedback/send`, {
+ const feedbackRes = await post(`${API_URL}/feedback/downgrade`, {
projectRef,
- subject: 'Subscription cancellation - Exit survey [Downgrade]',
- tags: ['dashboard-exitsurvey'],
- category: 'Billing',
- message: generateFeedbackMessage(selectedReasons, downgradeMessage),
+ reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
+ additionalFeedback: downgradeMessage,
+ exitAction: 'downgrade',
})
if (feedbackRes.error) throw feedbackRes.error
} catch (error: any) {
diff --git a/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.utils.ts b/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.utils.ts
deleted file mode 100644
index c98250007a3..00000000000
--- a/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.utils.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export const generateFeedbackMessage = (reasons: string[], message: string) => {
- return `
-Exit survey \n
-
-Reasons for leaving:
-${reasons.reduce((a, b) => `${a}- ${b}\n`, '')}
-
-Additional feedback:
-${message}
- `
-}
diff --git a/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectButton.tsx b/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectButton.tsx
index 9ca011ac664..21873e761a1 100644
--- a/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectButton.tsx
+++ b/studio/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectButton.tsx
@@ -85,12 +85,11 @@ const DeleteProjectButton: FC<Props> = ({ type = 'danger' }) => {
// Submit exit survey to Hubspot for paid projects
if (!isFree) {
- const feedbackRes = await post(`${API_URL}/feedback/send`, {
+ const feedbackRes = await post(`${API_URL}/feedback/downgrade`, {
projectRef,
- subject: 'Subscription cancellation - Exit survey [Delete]',
- tags: ['dashboard-exitsurvey'],
- category: 'Billing',
- message: generateFeedbackMessage(selectedReasons, cancellationMessage),
+ reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''),
+ additionalFeedback: cancellationMessage,
+ exitAction: 'delete',
})
if (feedbackRes.error) throw feedbackRes.error
}