The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix hcaptcha for upgrading instance
Joshen Lim4b765fd12503
diff --git a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx b/studio/components/interfaces/Billing/EnterpriseUpdate.tsxindex 078cd190f42..697060a6340 100644--- a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx+++ b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx@@ -137,6 +137,24 @@ const EnterpriseUpdate: FC<Props> = ({captchaRef.current?.resetCaptcha()}+ const beforeConfirmPayment = async (): Promise<boolean> => {+ setIsSubmitting(true)+ let token = captchaToken++ try {+ if (!token) {+ const captchaResponse = await captchaRef.current?.execute({ async: true })+ token = captchaResponse?.response ?? null+ setCaptchaToken(token)+ }+ } catch (error) {+ setIsSubmitting(false)+ return false+ }++ return true+ }+// Last todo to support enterprise billing on dashboard + E2E testconst onConfirmPayment = async () => {setIsSubmitting(true)@@ -296,6 +314,7 @@ const EnterpriseUpdate: FC<Props> = ({onSelectAddNewPaymentMethod={() => {setShowAddPaymentMethodModal(true)}}+ beforeConfirmPayment={beforeConfirmPayment}onConfirmPayment={onConfirmPayment}captcha={<HCaptchadiff --git a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsxindex 8f648296f80..8deab10c609 100644--- a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx+++ b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx@@ -42,7 +42,7 @@ interface Props {isLoadingPaymentMethods: booleanonSelectPaymentMethod: (method: any) => voidonSelectAddNewPaymentMethod: () => void- beforeConfirmPayment?: () => Promise<void>+ beforeConfirmPayment: () => Promise<boolean>onConfirmPayment: () => voidisSubmitting: boolean@@ -134,11 +134,16 @@ const PaymentSummaryPanel: FC<Props> = ({message: error,})} else {- await beforeConfirmPayment?.()-- isChangingComputeSize || (isChangingPITRDuration && selectedPITRDays === 0)- ? setShowConfirmModal(true)- : onConfirmPayment()+ // [Joshen] We're validating captcha before subsequent actions as there's an issue+ // with the hcaptcha overlay and the modal component, such that clicking on the hcaptcha closes+ // both the hcaptcha overlay and the modal. Need to figure that out first, then we can validate+ // the hcaptcha within onConfirmPayment()+ const hasValidCaptcha = await beforeConfirmPayment()+ if (hasValidCaptcha) {+ isChangingComputeSize || (isChangingPITRDuration && selectedPITRDays === 0)+ ? setShowConfirmModal(true)+ : onConfirmPayment()+ }}}diff --git a/studio/components/interfaces/Billing/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade.tsxindex 9f3ef740bcc..58434629eb8 100644--- a/studio/components/interfaces/Billing/ProUpgrade.tsx+++ b/studio/components/interfaces/Billing/ProUpgrade.tsx@@ -158,7 +158,7 @@ const ProUpgrade: FC<Props> = ({captchaRef.current?.resetCaptcha()}- const beforeConfirmPayment = async () => {+ const beforeConfirmPayment = async (): Promise<boolean> => {setIsSubmitting(true)let token = captchaToken@@ -170,8 +170,10 @@ const ProUpgrade: FC<Props> = ({}} catch (error) {setIsSubmitting(false)- return+ return false}++ return true}const onConfirmPayment = async () => {