The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
useConfirmModal + remove payoutsEnabledAt check
Steven Tey542d15b70801
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.tsxindex f6e5765477..a5e5fadfcb 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@@ -6,6 +6,7 @@ import usePartnerProfile from "@/lib/swr/use-partner-profile";import { PartnerProps, PayoutsCount } from "@/lib/types";import { PageContent } from "@/ui/layout/page-content";import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";+import { useConfirmModal } from "@/ui/modals/confirm-modal";import { CountryCombobox } from "@/ui/partners/country-combobox";import { useMergePartnerAccountsModal } from "@/ui/partners/merge-accounts/merge-partner-accounts-modal";import {@@ -127,9 +128,23 @@ function Controls({ formRef }: { formRef: RefObject<HTMLFormElement> }) {formState: { isSubmitting },} = useFormContext();+ const {+ setShowConfirmModal: setShowStripeConfirmModal,+ confirmModal: stripeConfirmModal,+ } = 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?",+ confirmText: "Continue",+ onConfirm: () => {+ formRef.current?.requestSubmit();+ },+ });+return (<><MergePartnerAccountsModal />+ {stripeConfirmModal}<Buttontext="Merge accounts"variant="secondary"@@ -142,16 +157,10 @@ function Controls({ formRef }: { formRef: RefObject<HTMLFormElement> }) {loading={isSubmitting}onClick={() => {if (partner?.stripeConnectId) {- const confirmed = window.confirm(- "Updating your email, country, or profile type will reset your Stripe account, which will require you to restart the payouts connection process. Are you sure you want to continue?",- );-- if (!confirmed) {- return;- }+ setShowStripeConfirmModal(true);+ } else {+ formRef.current?.requestSubmit();}-- formRef.current?.requestSubmit();}}/></>diff --git a/apps/web/lib/actions/partners/update-partner-profile.ts b/apps/web/lib/actions/partners/update-partner-profile.tsindex 8f6b736ce5..4f4c87a9fa 100644--- a/apps/web/lib/actions/partners/update-partner-profile.ts+++ b/apps/web/lib/actions/partners/update-partner-profile.ts@@ -75,11 +75,10 @@ export const updatePartnerProfileAction = authPartnerActionClientcountryChanged ||profileTypeChanged ||companyNameChanged) &&- partner.stripeConnectId &&- partner.payoutsEnabledAt+ partner.stripeConnectId) {// Partner is not able to update their country, profile type, or company name- // if they have a verified Stripe Express account + any completed payouts+ // if they have already have a Stripe Express account + any completed payoutsconst completedPayoutsCount = await prisma.payout.count({where: {partnerId: partner.id,