The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Hide domain type options in onboarding
Tim Wilson7cf35a44b4f6
diff --git a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/domain/custom/form.tsx b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/domain/custom/form.tsxindex c4fb612e8e..6803987834 100644--- a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/domain/custom/form.tsx+++ b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/domain/custom/form.tsx@@ -13,6 +13,7 @@ export function Form() {continueTo("invite");}}showAdvancedOptions={false}+ showDomainTypeOptions={false}/><buttontype="button"diff --git a/apps/web/ui/domains/add-edit-domain-form.tsx b/apps/web/ui/domains/add-edit-domain-form.tsxindex c4e368dd13..8aa708b61e 100644--- a/apps/web/ui/domains/add-edit-domain-form.tsx+++ b/apps/web/ui/domains/add-edit-domain-form.tsx@@ -22,11 +22,13 @@ export function AddEditDomainForm({props,onSuccess,showAdvancedOptions = true,+ showDomainTypeOptions = true,className,}: {props?: DomainProps;onSuccess?: (data: DomainProps) => void;showAdvancedOptions?: boolean;+ showDomainTypeOptions?: boolean;className?: string;}) {const { id: workspaceId } = useWorkspace();@@ -81,7 +83,7 @@ export function AddEditDomainForm({successMessage: "Successfully added domain!",};}- }, [props]);+ }, [props, workspaceId]);const [showDefaultExpirationUrl, setShowDefaultExpirationUrl] = useState(!!data.expiredUrl,@@ -101,43 +103,47 @@ export function AddEditDomainForm({"Content-Type": "application/json",},body: JSON.stringify(data),- }).then(async (res) => {- if (res.ok) {- await Promise.all([- mutate(- (key) =>- typeof key === "string" &&- key.startsWith(`/api/domains?workspaceId=${workspaceId}`),- ),- mutate(- (key) =>- typeof key === "string" && key.startsWith("/api/links"),- undefined,- { revalidate: true },- ),- ]);- const data = await res.json();- posthog.capture(props ? "domain_updated" : "domain_created", data);- toast.success(endpoint.successMessage);- onSuccess?.(data);- } else {- const { error } = await res.json();- if (res.status === 422) {- setDomainError(error.message);- }- if (error.message.includes("Upgrade to Pro")) {- toast.custom(() => (- <UpgradeRequiredToast- title="You've discovered a Pro feature!"- message={error.message}- />- ));+ })+ .then(async (res) => {+ if (res.ok) {+ await Promise.all([+ mutate(+ (key) =>+ typeof key === "string" &&+ key.startsWith(`/api/domains?workspaceId=${workspaceId}`),+ ),+ mutate(+ (key) =>+ typeof key === "string" && key.startsWith("/api/links"),+ undefined,+ { revalidate: true },+ ),+ ]);+ const data = await res.json();+ posthog.capture(+ props ? "domain_updated" : "domain_created",+ data,+ );+ toast.success(endpoint.successMessage);+ onSuccess?.(data);} else {- toast.error(error.message);+ const { error } = await res.json();+ if (res.status === 422) {+ setDomainError(error.message);+ }+ if (error.message.includes("Upgrade to Pro")) {+ toast.custom(() => (+ <UpgradeRequiredToast+ title="You've discovered a Pro feature!"+ message={error.message}+ />+ ));+ } else {+ toast.error(error.message);+ }}- }- setSaving(false);- });+ })+ .finally(() => setSaving(false));}}className={cn("flex flex-col gap-y-6 text-left", className)}>@@ -181,6 +187,7 @@ export function AddEditDomainForm({setData={setData}domainError={domainError}setDomainError={setDomainError}+ showDomainTypeOptions={showDomainTypeOptions}/>)}</div>diff --git a/apps/web/ui/domains/domain-input.tsx b/apps/web/ui/domains/domain-input.tsxindex 055e62e429..7e6cf800a8 100644--- a/apps/web/ui/domains/domain-input.tsx+++ b/apps/web/ui/domains/domain-input.tsx@@ -18,6 +18,7 @@ export default function DomainInput({setData,domainError,setDomainError,+ showDomainTypeOptions = true,}) {const domain = data[identifier];const originalDomain = useMemo(() => domain, []);@@ -137,7 +138,7 @@ export default function DomainInput({{domainError}</p>))}- {domain && !domainError && (+ {domain && !domainError && showDomainTypeOptions && (<motion.div {...FADE_IN_ANIMATION_SETTINGS}><RadioGroupclassName="mt-2"