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.

businessType → profileType

Steven Tey380eb99798cc
diff --git a/apps/web/app/partners.dub.co/(dashboard)/settings/page-client.tsx b/apps/web/app/partners.dub.co/(dashboard)/settings/page-client.tsx
index f8f5764672..58b2412583 100644
--- a/apps/web/app/partners.dub.co/(dashboard)/settings/page-client.tsx
+++ b/apps/web/app/partners.dub.co/(dashboard)/settings/page-client.tsx
@@ -234,7 +234,7 @@ function ProfileForm({ partner }: { partner: PartnerProps }) {
</label>
</FormRow>
- {partner.businessType === "company" && (
+ {partner.profileType === "company" && (
<FormRow>
<label className="contents">
<span className="text-sm font-medium text-neutral-800">
diff --git a/apps/web/app/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx b/apps/web/app/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
index f4a23f0d04..4b85c60b6d 100644
--- a/apps/web/app/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
+++ b/apps/web/app/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
@@ -37,7 +37,7 @@ export function OnboardingForm({
| "description"
| "country"
| "image"
- | "businessType"
+ | "profileType"
| "companyName"
>
> | null;
@@ -61,12 +61,12 @@ export function OnboardingForm({
description: partner?.description ?? undefined,
country: partner?.country ?? undefined,
image: partner?.image ?? undefined,
- businessType: partner?.businessType ?? "individual",
+ profileType: partner?.profileType ?? "individual",
companyName: partner?.companyName ?? undefined,
},
});
- const { name, image, businessType } = watch();
+ const { name, image, profileType } = watch();
useEffect(() => {
if (session?.user) {
@@ -212,19 +212,19 @@ export function OnboardingForm({
label: "Company",
},
]}
- selected={businessType}
+ selected={profileType}
selectAction={(option: "individual" | "company") => {
- if (!partner?.businessType) {
- setValue("businessType", option);
+ if (!partner?.profileType) {
+ setValue("profileType", option);
}
}}
className={cn(
"flex w-full items-center gap-0.5 rounded-lg border-neutral-300 bg-neutral-100 p-0.5",
- partner?.businessType && "cursor-not-allowed opacity-70",
+ partner?.profileType && "cursor-not-allowed opacity-70",
)}
optionClassName={cn(
"h-9 flex items-center justify-center rounded-lg flex-1",
- partner?.businessType && "pointer-events-none",
+ partner?.profileType && "pointer-events-none",
)}
indicatorClassName="bg-white"
/>
@@ -232,7 +232,7 @@ export function OnboardingForm({
</div>
<AnimatePresence mode="popLayout">
- {businessType === "company" && (
+ {profileType === "company" && (
<motion.div
layout
initial={{ opacity: 0, height: 0 }}
@@ -260,7 +260,7 @@ export function OnboardingForm({
)}
readOnly={!!partner?.companyName || !!errors.companyName}
{...register("companyName", {
- required: businessType === "company",
+ required: profileType === "company",
})}
/>
<p className="mt-1.5 text-xs text-neutral-500">
diff --git a/apps/web/app/partners.dub.co/(onboarding)/onboarding/page.tsx b/apps/web/app/partners.dub.co/(onboarding)/onboarding/page.tsx
index 4095122ec5..c9d18883bb 100644
--- a/apps/web/app/partners.dub.co/(onboarding)/onboarding/page.tsx
+++ b/apps/web/app/partners.dub.co/(onboarding)/onboarding/page.tsx
@@ -35,7 +35,7 @@ async function OnboardingFormRSC() {
description: true,
country: true,
image: true,
- businessType: true,
+ profileType: true,
companyName: true,
},
});
diff --git a/apps/web/lib/actions/partners/create-account-link.ts b/apps/web/lib/actions/partners/create-account-link.ts
index ce673b74f9..c196e4f1a1 100644
--- a/apps/web/lib/actions/partners/create-account-link.ts
+++ b/apps/web/lib/actions/partners/create-account-link.ts
@@ -35,7 +35,7 @@ export const createAccountLinkAction = authPartnerActionClient.action(
name: partner.name,
email: partner.email,
country: partner.country,
- businessType: partner.businessType,
+ profileType: partner.profileType,
companyName: partner.companyName,
});
diff --git a/apps/web/lib/actions/partners/onboard-partner.ts b/apps/web/lib/actions/partners/onboard-partner.ts
index 3a51599a05..67feb74c05 100644
--- a/apps/web/lib/actions/partners/onboard-partner.ts
+++ b/apps/web/lib/actions/partners/onboard-partner.ts
@@ -18,7 +18,7 @@ export const onboardPartnerAction = authUserActionClient
.schema(onboardPartnerSchema)
.action(async ({ ctx, parsedInput }) => {
const { user } = ctx;
- const { name, image, country, description, businessType, companyName } =
+ const { name, image, country, description, profileType, companyName } =
parsedInput;
const existingPartner = await prisma.partner.findUnique({
@@ -36,7 +36,7 @@ export const onboardPartnerAction = authUserActionClient
name,
email: user.email,
country,
- businessType,
+ profileType,
companyName,
})
: null;
@@ -49,12 +49,12 @@ export const onboardPartnerAction = authUserActionClient
.upload(`partners/${partnerId}/image_${nanoid(7)}`, image)
.then(({ url }) => url);
- // country, businessType, and companyName cannot be changed once set
+ // country, profileType, and companyName cannot be changed once set
const payload: Prisma.PartnerCreateInput = {
name,
email: user.email,
country: existingPartner?.country || country,
- businessType: existingPartner?.businessType || businessType,
+ profileType: existingPartner?.profileType || profileType,
companyName: existingPartner?.companyName || companyName,
...(description && { description }),
image: imageUrl,
diff --git a/apps/web/lib/stripe/create-connected-account.ts b/apps/web/lib/stripe/create-connected-account.ts
index 8ce4d36bd7..0999116793 100644
--- a/apps/web/lib/stripe/create-connected-account.ts
+++ b/apps/web/lib/stripe/create-connected-account.ts
@@ -6,11 +6,11 @@ export const createConnectedAccount = async ({
name,
email,
country,
- businessType,
+ profileType,
companyName,
}: Pick<
z.infer<typeof onboardPartnerSchema>,
- "name" | "country" | "businessType" | "companyName"
+ "name" | "country" | "profileType" | "companyName"
> & {
email: string;
}) => {
@@ -19,10 +19,10 @@ export const createConnectedAccount = async ({
try {
return await stripe.accounts.create({
type: "express",
- business_type: businessType,
+ business_type: profileType,
email,
country,
- ...(businessType === "company"
+ ...(profileType === "company"
? {
business_profile: {
name: companyName!,
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index 8e78953f7c..ca9a21862a 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -1,5 +1,5 @@
import {
- PartnerBusinessType,
+ PartnerProfileType,
PartnerStatus,
ProgramEnrollmentStatus,
} from "@dub/prisma/client";
@@ -97,7 +97,7 @@ export const PartnerSchema = z.object({
id: z.string(),
name: z.string(),
companyName: z.string().nullable(),
- businessType: z.nativeEnum(PartnerBusinessType),
+ profileType: z.nativeEnum(PartnerProfileType),
email: z.string().nullable(),
image: z.string().nullable(),
description: z.string().nullish(),
@@ -256,13 +256,13 @@ export const onboardPartnerSchema = createPartnerSchema
z.object({
image: z.string(),
country: z.enum(COUNTRY_CODES),
- businessType: z.enum(["individual", "company"]).default("individual"),
+ profileType: z.enum(["individual", "company"]).default("individual"),
companyName: z.string().nullish(),
}),
)
.refine(
(data) => {
- if (data.businessType === "company") {
+ if (data.profileType === "company") {
return !!data.companyName;
}
@@ -275,7 +275,7 @@ export const onboardPartnerSchema = createPartnerSchema
)
.transform((data) => ({
...data,
- companyName: data.businessType === "individual" ? null : data.companyName,
+ companyName: data.profileType === "individual" ? null : data.companyName,
}));
export const createPartnerLinkSchema = z
diff --git a/packages/prisma/schema/partner.prisma b/packages/prisma/schema/partner.prisma
index 30df4e9433..54b44b9a88 100644
--- a/packages/prisma/schema/partner.prisma
+++ b/packages/prisma/schema/partner.prisma
@@ -9,7 +9,7 @@ enum PartnerRole {
member
}
-enum PartnerBusinessType {
+enum PartnerProfileType {
individual
company
}
@@ -18,7 +18,7 @@ model Partner {
id String @id @default(cuid())
name String
companyName String?
- businessType PartnerBusinessType @default(individual)
+ profileType PartnerProfileType @default(individual)
email String? @unique
image String?
bio String? @db.LongText