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.

allow updating partner profile email

Steven Tey162295fcd25d
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx
index 39316386de..2d33abb9dc 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx
@@ -141,7 +141,7 @@ function Controls({ formRef }: { formRef: RefObject<HTMLFormElement> }) {
} = useConfirmModal({
title: "Confirm profile update",
description:
- "Updating your email, country, or profile type will reset your Stripe account, which will require you to restart the payout connection process. Are you sure you want to continue?",
+ "Updating your country or profile type will reset your Stripe account, which will require you to restart the payout connection process. Are you sure you want to continue?",
confirmText: "Continue",
onConfirm: () => {
formRef.current?.requestSubmit();
@@ -166,8 +166,7 @@ function Controls({ formRef }: { formRef: RefObject<HTMLFormElement> }) {
onClick={() => {
if (
partner?.stripeConnectId &&
- (dirtyFields.email ||
- dirtyFields.country ||
+ (dirtyFields.country ||
dirtyFields.profileType ||
dirtyFields.companyName)
) {
@@ -311,33 +310,19 @@ function ProfileForm({
</label>
<label className="flex flex-col gap-1.5">
<span className="text-sm font-medium text-neutral-800">Email</span>
- <DynamicTooltipWrapper
- tooltipProps={
- completedPayoutsCount > 0
- ? {
- content:
- "Since you've already received payouts on Dub, you cannot change your email. If you need to update your email, please contact support.",
- }
- : undefined
- }
- >
- <input
- type="email"
- className={cn(
- "block w-full rounded-md focus:outline-none sm:text-sm",
- errors.email
- ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"
- : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",
- completedPayoutsCount > 0 &&
- "cursor-not-allowed bg-neutral-100 text-neutral-400",
- )}
- placeholder="[email protected]"
- disabled={completedPayoutsCount > 0}
- {...register("email", {
- required: true,
- })}
- />
- </DynamicTooltipWrapper>
+ <input
+ type="email"
+ className={cn(
+ "block w-full rounded-md focus:outline-none sm:text-sm",
+ errors.email
+ ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"
+ : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",
+ )}
+ placeholder="[email protected]"
+ {...register("email", {
+ required: true,
+ })}
+ />
</label>
<label className="flex flex-col">
<span className="text-sm font-medium text-neutral-800">
diff --git a/apps/web/app/app.dub.co/(auth)/auth/confirm-email-change/[token]/page.tsx b/apps/web/app/app.dub.co/(auth)/auth/confirm-email-change/[token]/page.tsx
index c6b276a306..d27cbf12b7 100644
--- a/apps/web/app/app.dub.co/(auth)/auth/confirm-email-change/[token]/page.tsx
+++ b/apps/web/app/app.dub.co/(auth)/auth/confirm-email-change/[token]/page.tsx
@@ -156,6 +156,7 @@ const VerifyEmailChange = async ({
react: EmailUpdated({
oldEmail: data.email,
newEmail: data.newEmail,
+ isPartnerProfile: !!data.isPartnerProfile,
}),
}),
]),
diff --git a/apps/web/lib/actions/partners/update-partner-profile.ts b/apps/web/lib/actions/partners/update-partner-profile.ts
index d9d7f3e483..a55641c123 100644
--- a/apps/web/lib/actions/partners/update-partner-profile.ts
+++ b/apps/web/lib/actions/partners/update-partner-profile.ts
@@ -161,8 +161,6 @@ const deleteStripeAccountIfRequired = async ({
partner: Partner;
input: z.infer<typeof updatePartnerProfileSchema>;
}) => {
- const emailChanged = partner.email !== input.email;
-
const countryChanged =
partner.country?.toLowerCase() !== input.country?.toLowerCase();
@@ -174,10 +172,7 @@ const deleteStripeAccountIfRequired = async ({
partner.companyName?.toLowerCase() !== input.companyName?.toLowerCase();
const deleteExpressAccount =
- (emailChanged ||
- countryChanged ||
- profileTypeChanged ||
- companyNameChanged) &&
+ (countryChanged || profileTypeChanged || companyNameChanged) &&
partner.stripeConnectId;
if (!deleteExpressAccount) {
diff --git a/packages/email/src/templates/email-updated.tsx b/packages/email/src/templates/email-updated.tsx
index b519bbda02..79e2df9842 100644
--- a/packages/email/src/templates/email-updated.tsx
+++ b/packages/email/src/templates/email-updated.tsx
@@ -17,9 +17,11 @@ import { Footer } from "../components/footer";
export default function EmailUpdated({
oldEmail = "[email protected]",
newEmail = "[email protected]",
+ isPartnerProfile = false,
}: {
oldEmail: string;
newEmail: string;
+ isPartnerProfile?: boolean;
}) {
return (
<Html>
@@ -35,8 +37,10 @@ export default function EmailUpdated({
Your email address has been changed
</Heading>
<Text className="mx-auto text-sm leading-6">
- The e-mail address for your Dub account has been changed from{" "}
- <strong>{oldEmail}</strong> to <strong>{newEmail}</strong>.
+ The e-mail address for your Dub{" "}
+ {isPartnerProfile ? "partner profile" : "account"} has been
+ changed from <strong>{oldEmail}</strong> to{" "}
+ <strong>{newEmail}</strong>.
</Text>
<Text className="text-sm leading-6 text-black">
If you did not make this change, please contact our support team