Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

disable country combobox

Steven Tey90a08db271d4
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx
index 4140a53dc4..964584b6a0 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx
@@ -310,13 +310,7 @@ function BasicInfoForm({
value={field.value || ""}
onChange={field.onChange}
error={errors.country ? true : false}
- disabledTooltip={
- disabled
- ? "You don't have permission to update this field"
- : completedPayoutsCount > 0
- ? "Since you've already received payouts on Dub, you cannot change your country. If you need to update your country, please contact support."
- : undefined
- }
+ disabledTooltip="Your country cannot be changed once set. If you need to update your country, please contact support."
/>
)}
/>
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
index 399bf942dd..3249dde402 100644
--- a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
@@ -178,12 +178,12 @@ export function OnboardingForm({
render={({ field }) => (
<CountryCombobox
{...field}
+ error={errors.country ? true : false}
disabledTooltip={
- partner?.payoutsEnabledAt
- ? "Since you've already received payouts, you cannot change your country. Contact support if you need to update your country."
+ partner?.country
+ ? "Your country cannot be changed once set. If you need to update your country, please contact support."
: undefined
}
- error={errors.country ? true : false}
/>
)}
/>
diff --git a/apps/web/lib/actions/partners/update-partner-profile.ts b/apps/web/lib/actions/partners/update-partner-profile.ts
index 694bdeb72a..d81d789bfd 100644
--- a/apps/web/lib/actions/partners/update-partner-profile.ts
+++ b/apps/web/lib/actions/partners/update-partner-profile.ts
@@ -68,6 +68,12 @@ export const updatePartnerProfileAction = authPartnerActionClient
discoverable,
} = parsedInput;
+ if (country !== undefined && country !== partner.country) {
+ throw new Error(
+ "Your country cannot be changed once set. If you need to update your country, please contact support.",
+ );
+ }
+
if (
profileType === "company" &&
(companyName === undefined ? !partner.companyName : !companyName)
@@ -257,10 +263,6 @@ const deleteStripeAccountIfRequired = async ({
partner: Partner;
input: z.infer<typeof updatePartnerProfileSchema>;
}) => {
- const countryChanged =
- input.country !== undefined &&
- partner.country?.toLowerCase() !== input.country?.toLowerCase();
-
const profileTypeChanged =
input.profileType !== undefined &&
partner.profileType.toLowerCase() !== input.profileType.toLowerCase();
@@ -270,14 +272,13 @@ const deleteStripeAccountIfRequired = async ({
partner.companyName?.toLowerCase() !== input.companyName?.toLowerCase();
const deleteExpressAccount =
- (countryChanged || profileTypeChanged || companyNameChanged) &&
- partner.stripeConnectId;
+ (profileTypeChanged || companyNameChanged) && partner.stripeConnectId;
if (!deleteExpressAccount) {
return;
}
- // Partner is not able to update their country, profile type, or company name
+ // Partner is not able to update their profile type or company name
// if they have already have a Stripe Express account + any sent / completed payouts
const completedPayoutsCount = await prisma.payout.count({
where: {
@@ -290,7 +291,7 @@ const deleteStripeAccountIfRequired = async ({
if (completedPayoutsCount > 0) {
throw new Error(
- "Since you've already received payouts on Dub, you cannot change your country or profile type. Please contact support to update those fields.",
+ "Since you've already received payouts on Dub, you cannot change your profile type. Please contact support to update your profile type.",
);
}