Skip to content

Scheduling infrastructure for absolutely everyone.

fix: vercel subdomain version (#10790)

Leo Giovanetti20c45b5d88d3
diff --git a/apps/web/components/eventtype/EventSetupTab.tsx b/apps/web/components/eventtype/EventSetupTab.tsx
index 9607f69e0b2..82bfccede21 100644
--- a/apps/web/components/eventtype/EventSetupTab.tsx
+++ b/apps/web/components/eventtype/EventSetupTab.tsx
@@ -12,6 +12,7 @@ import { z } from "zod";
import type { EventLocationType } from "@calcom/app-store/locations";
import { getEventLocationType, MeetLocationType, LocationType } from "@calcom/app-store/locations";
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
+import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
import cx from "@calcom/lib/classNames";
import { CAL_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -116,6 +117,7 @@ export const EventSetupTab = (
const [editingLocationType, setEditingLocationType] = useState<string>("");
const [selectedLocation, setSelectedLocation] = useState<LocationOption | undefined>(undefined);
const [multipleDuration, setMultipleDuration] = useState(eventType.metadata?.multipleDuration);
+ const orgBranding = useOrgBranding();
const locationOptions = props.locationOptions.map((locationOption) => {
const options = locationOption.options.filter((option) => {
@@ -385,6 +387,9 @@ export const EventSetupTab = (
const lengthLockedProps = shouldLockDisableProps("length");
const descriptionLockedProps = shouldLockDisableProps("description");
+ const urlPrefix = orgBranding
+ ? orgBranding?.fullDomain.replace(/^(https?:|)\/\//, "")
+ : `${CAL_URL?.replace(/^(https?:|)\/\//, "")}`;
return (
<div>
@@ -413,10 +418,10 @@ export const EventSetupTab = (
defaultValue={eventType.slug}
addOnLeading={
<>
- {CAL_URL?.replace(/^(https?:|)\/\//, "")}/
+ {urlPrefix}/
{!isManagedEventType
? team
- ? "team/" + team.slug
+ ? (orgBranding ? "" : "team/") + team.slug
: eventType.users[0].username
: t("username_placeholder")}
/
diff --git a/apps/web/components/ui/UsernameAvailability/index.tsx b/apps/web/components/ui/UsernameAvailability/index.tsx
index caee14bdef1..4a66c40db43 100644
--- a/apps/web/components/ui/UsernameAvailability/index.tsx
+++ b/apps/web/components/ui/UsernameAvailability/index.tsx
@@ -65,7 +65,7 @@ export const UsernameAvailabilityField = ({
setInputUsernameValue={onChange}
onSuccessMutation={onSuccessMutation}
onErrorMutation={onErrorMutation}
- addOnLeading={usernamePrefix}
+ addOnLeading={`${usernamePrefix}/`}
/>
);
}}
diff --git a/apps/web/pages/event-types/index.tsx b/apps/web/pages/event-types/index.tsx
index b3ef0ab472d..8d1620ced63 100644
--- a/apps/web/pages/event-types/index.tsx
+++ b/apps/web/pages/event-types/index.tsx
@@ -737,7 +737,9 @@ const EventTypeListHeading = ({
</span>
)}
{profile?.slug && (
- <Link href={`${CAL_URL}/${profile.slug}`} className="text-subtle block text-xs">
+ <Link
+ href={`${orgBranding ? orgBranding.fullDomain : CAL_URL}/${profile.slug}`}
+ className="text-subtle block text-xs">
{`${bookerUrl.replace("https://", "").replace("http://", "")}/${profile.slug}`}
</Link>
)}
diff --git a/packages/features/ee/organizations/pages/components/OtherTeamListItem.tsx b/packages/features/ee/organizations/pages/components/OtherTeamListItem.tsx
index d160b385de7..7abc72fcebf 100644
--- a/packages/features/ee/organizations/pages/components/OtherTeamListItem.tsx
+++ b/packages/features/ee/organizations/pages/components/OtherTeamListItem.tsx
@@ -57,7 +57,7 @@ export default function OtherTeamListItem(props: Props) {
<span className="text-muted block text-xs">
{team.slug
? orgBranding
- ? `${orgBranding.fullDomain}${team.slug}`
+ ? `${orgBranding.fullDomain}/${team.slug}`
: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/${team.slug}`
: "Unpublished team"}
</span>
@@ -81,8 +81,8 @@ export default function OtherTeamListItem(props: Props) {
`${
orgBranding
? `${orgBranding.fullDomain}`
- : process.env.NEXT_PUBLIC_WEBSITE_URL + "/team/"
- }${team.slug}`
+ : process.env.NEXT_PUBLIC_WEBSITE_URL + "/team"
+ }/${team.slug}`
);
showToast(t("link_copied"), "success");
}}
@@ -119,8 +119,8 @@ export default function OtherTeamListItem(props: Props) {
href={`${
orgBranding
? `${orgBranding.fullDomain}`
- : `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/other/`
- }${team.slug}`}
+ : `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/other`
+ }/${team.slug}`}
StartIcon={ExternalLink}>
{t("preview_team") as string}
</DropdownItem>
diff --git a/packages/features/ee/teams/components/CreateANewTeamForm.tsx b/packages/features/ee/teams/components/CreateANewTeamForm.tsx
index 1a766c1aea5..ebe4e642b81 100644
--- a/packages/features/ee/teams/components/CreateANewTeamForm.tsx
+++ b/packages/features/ee/teams/components/CreateANewTeamForm.tsx
@@ -111,8 +111,9 @@ export const CreateANewTeamForm = () => {
placeholder="acme"
label={t("team_url")}
addOnLeading={`${
- orgBranding?.fullDomain.replace("https://", "").replace("http://", "") ??
- `${extractDomainFromWebsiteUrl}/team/`
+ orgBranding
+ ? orgBranding.fullDomain.replace("https://", "").replace("http://", "") + "/"
+ : `${extractDomainFromWebsiteUrl}/team/`
}`}
defaultValue={value}
onChange={(e) => {
diff --git a/packages/features/ee/teams/components/TeamListItem.tsx b/packages/features/ee/teams/components/TeamListItem.tsx
index 290795d69ef..ddd5c550d64 100644
--- a/packages/features/ee/teams/components/TeamListItem.tsx
+++ b/packages/features/ee/teams/components/TeamListItem.tsx
@@ -103,7 +103,7 @@ export default function TeamListItem(props: Props) {
<span className="text-muted block text-xs">
{team.slug
? orgBranding
- ? `${orgBranding.fullDomain}${team.slug}`
+ ? `${orgBranding.fullDomain}/${team.slug}`
: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/${team.slug}`
: "Unpublished team"}
</span>
@@ -238,8 +238,8 @@ export default function TeamListItem(props: Props) {
`${
orgBranding
? `${orgBranding.fullDomain}`
- : process.env.NEXT_PUBLIC_WEBSITE_URL + "/team/"
- }${team.slug}`
+ : process.env.NEXT_PUBLIC_WEBSITE_URL + "/team"
+ }/${team.slug}`
);
showToast(t("link_copied"), "success");
}}
@@ -278,8 +278,8 @@ export default function TeamListItem(props: Props) {
href={`${
orgBranding
? `${orgBranding.fullDomain}`
- : `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/`
- }${team.slug}`}
+ : `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team`
+ }/${team.slug}`}
StartIcon={ExternalLink}>
{t("preview_team") as string}
</DropdownItem>
diff --git a/packages/features/ee/teams/pages/team-profile-view.tsx b/packages/features/ee/teams/pages/team-profile-view.tsx
index f5fed28698a..e86861a96f9 100644
--- a/packages/features/ee/teams/pages/team-profile-view.tsx
+++ b/packages/features/ee/teams/pages/team-profile-view.tsx
@@ -227,7 +227,7 @@ const ProfileView = () => {
value={value}
addOnLeading={
team.parent && orgBranding
- ? getOrgFullDomain(orgBranding?.slug, { protocol: false })
+ ? getOrgFullDomain(orgBranding?.slug, { protocol: false }) + "/"
: `${WEBAPP_URL}/team/`
}
onChange={(e) => {
diff --git a/packages/trpc/server/routers/viewer/organizations/create.handler.ts b/packages/trpc/server/routers/viewer/organizations/create.handler.ts
index 33ce4d555e8..c2b9f9a5a23 100644
--- a/packages/trpc/server/routers/viewer/organizations/create.handler.ts
+++ b/packages/trpc/server/routers/viewer/organizations/create.handler.ts
@@ -29,7 +29,7 @@ type CreateOptions = {
const vercelCreateDomain = async (domain: string) => {
const response = await fetch(
- `https://api.vercel.com/v8/projects/${process.env.PROJECT_ID_VERCEL}/domains?teamId=${process.env.TEAM_ID_VERCEL}`,
+ `https://api.vercel.com/v9/projects/${process.env.PROJECT_ID_VERCEL}/domains?teamId=${process.env.TEAM_ID_VERCEL}`,
{
body: JSON.stringify({ name: `${domain}.${subdomainSuffix()}` }),
headers: {