The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
disable account merging if countries are different
Steven Tey61ea20e87e2c
diff --git a/apps/web/lib/actions/partners/merge-partner-accounts.ts b/apps/web/lib/actions/partners/merge-partner-accounts.tsindex 42f8e98368..9284db5d74 100644--- a/apps/web/lib/actions/partners/merge-partner-accounts.ts+++ b/apps/web/lib/actions/partners/merge-partner-accounts.ts@@ -105,6 +105,7 @@ const sendTokens = async ({select: {id: true,email: true,+ country: true,payoutsEnabledAt: true,},});@@ -137,7 +138,17 @@ const sendTokens = async ({if (sourceAccount.payoutsEnabledAt) {throw new Error(- "Account merging is not available if payouts are enabled on the source account. Please contact our support for assistance.",+ "Account merging is not available if payouts are enabled on the source account. Please contact support for assistance.",+ );+ }++ // if source acocunt country is set and is different from target account country, throw an error+ if (+ sourceAccount.country &&+ sourceAccount.country !== targetAccount.country+ ) {+ throw new Error(+ "You cannot merge partner accounts that are in different countries. Please contact support for assistance.",);}diff --git a/apps/web/ui/partners/merge-accounts/send-verification-code-form.tsx b/apps/web/ui/partners/merge-accounts/send-verification-code-form.tsxindex 9403ac7ae7..1ca03f0e83 100644--- a/apps/web/ui/partners/merge-accounts/send-verification-code-form.tsx+++ b/apps/web/ui/partners/merge-accounts/send-verification-code-form.tsx@@ -97,8 +97,9 @@ export function SendVerificationCodeForm({<inputtype="email"required+ disabledplaceholder="Enter target account email"- className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"+ className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-500 sm:text-sm"{...register("targetEmail")}/></div>