2022-04-25 04:33:00 +00:00
|
|
|
import classNames from "classnames";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { GetServerSidePropsContext } from "next";
|
2021-09-06 13:51:15 +00:00
|
|
|
import Link from "next/link";
|
2021-12-03 10:15:20 +00:00
|
|
|
import { useRouter } from "next/router";
|
2022-02-01 21:48:40 +00:00
|
|
|
import { Toaster } from "react-hot-toast";
|
2021-09-22 19:52:38 +00:00
|
|
|
|
2022-05-27 15:37:02 +00:00
|
|
|
import {
|
|
|
|
sdkActionManager,
|
|
|
|
useEmbedNonStylesConfig,
|
|
|
|
useEmbedStyles,
|
|
|
|
useIsEmbed,
|
|
|
|
} from "@calcom/embed-core/embed-iframe";
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
import { orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
|
2022-12-22 19:06:26 +00:00
|
|
|
import { EventTypeDescriptionLazy as EventTypeDescription } from "@calcom/features/eventtypes/components";
|
2022-10-24 22:20:41 +00:00
|
|
|
import EmptyPage from "@calcom/features/eventtypes/components/EmptyPage";
|
2022-04-06 17:20:30 +00:00
|
|
|
import defaultEvents, {
|
|
|
|
getDynamicEventDescription,
|
2022-04-25 04:33:00 +00:00
|
|
|
getGroupName,
|
2022-04-06 17:20:30 +00:00
|
|
|
getUsernameList,
|
|
|
|
getUsernameSlugLink,
|
|
|
|
} from "@calcom/lib/defaultEvents";
|
2022-03-31 08:45:47 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2022-07-28 19:58:26 +00:00
|
|
|
import useTheme from "@calcom/lib/hooks/useTheme";
|
2023-03-28 09:40:13 +00:00
|
|
|
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
2023-05-15 07:44:23 +00:00
|
|
|
import { stripMarkdown } from "@calcom/lib/stripMarkdown";
|
2022-07-28 19:58:26 +00:00
|
|
|
import prisma from "@calcom/prisma";
|
|
|
|
import { baseEventTypeSelect } from "@calcom/prisma/selects";
|
2022-10-14 16:24:43 +00:00
|
|
|
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
2023-03-02 20:56:10 +00:00
|
|
|
import { Avatar, AvatarGroup, HeadSeo } from "@calcom/ui";
|
2023-05-17 12:47:44 +00:00
|
|
|
import { Verified, ArrowRight } from "@calcom/ui/components/icon";
|
2022-03-31 08:45:47 +00:00
|
|
|
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { inferSSRProps } from "@lib/types/inferSSRProps";
|
|
|
|
import type { EmbedProps } from "@lib/withEmbedSsr";
|
2021-09-22 19:52:38 +00:00
|
|
|
|
2023-04-18 18:45:32 +00:00
|
|
|
import PageWrapper from "@components/PageWrapper";
|
|
|
|
|
2021-10-20 16:00:11 +00:00
|
|
|
import { ssrInit } from "@server/lib/ssr";
|
|
|
|
|
2023-06-21 21:12:12 +00:00
|
|
|
export type UserPageProps = inferSSRProps<typeof getServerSideProps> & EmbedProps;
|
|
|
|
export function UserPage(props: UserPageProps) {
|
2023-05-15 07:44:23 +00:00
|
|
|
const {
|
|
|
|
users,
|
|
|
|
profile,
|
|
|
|
eventTypes,
|
|
|
|
isDynamicGroup,
|
|
|
|
dynamicNames,
|
|
|
|
dynamicUsernames,
|
|
|
|
isSingleUser,
|
|
|
|
markdownStrippedBio,
|
|
|
|
} = props;
|
2022-04-06 17:20:30 +00:00
|
|
|
const [user] = users; //To be used when we only have a single user, not dynamic group
|
2022-07-26 08:27:57 +00:00
|
|
|
useTheme(user.theme);
|
2021-10-12 13:11:33 +00:00
|
|
|
const { t } = useLocale();
|
2021-12-03 10:15:20 +00:00
|
|
|
const router = useRouter();
|
2022-06-15 20:54:31 +00:00
|
|
|
|
2023-01-25 01:08:10 +00:00
|
|
|
const isBioEmpty = !user.bio || !user.bio.replace("<p><br></p>", "").length;
|
|
|
|
|
2022-08-12 19:29:29 +00:00
|
|
|
const groupEventTypes = props.users.some((user) => !user.allowDynamicBooking) ? (
|
|
|
|
<div className="space-y-6" data-testid="event-types">
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="overflow-hidden rounded-sm border ">
|
|
|
|
<div className="text-muted p-8 text-center">
|
|
|
|
<h2 className="font-cal text-default mb-2 text-3xl">{" " + t("unavailable")}</h2>
|
2022-08-12 19:29:29 +00:00
|
|
|
<p className="mx-auto max-w-md">{t("user_dynamic_booking_disabled") as string}</p>
|
2022-04-06 17:20:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-12 19:29:29 +00:00
|
|
|
</div>
|
|
|
|
) : (
|
2022-08-24 20:18:42 +00:00
|
|
|
<ul>
|
2022-08-12 19:29:29 +00:00
|
|
|
{eventTypes.map((type, index) => (
|
|
|
|
<li
|
|
|
|
key={index}
|
2023-04-20 22:33:49 +00:00
|
|
|
className=" border-subtle bg-default dark:bg-muted dark:hover:bg-emphasis hover:bg-muted group relative border-b first:rounded-t-md last:rounded-b-md last:border-b-0">
|
2023-04-12 15:26:31 +00:00
|
|
|
<ArrowRight className="text-emphasis absolute right-3 top-3 h-4 w-4 opacity-0 transition-opacity group-hover:opacity-100" />
|
2023-01-06 12:13:56 +00:00
|
|
|
<Link
|
|
|
|
href={getUsernameSlugLink({ users: props.users, slug: type.slug })}
|
|
|
|
className="flex justify-between px-6 py-4"
|
|
|
|
data-testid="event-type-link">
|
|
|
|
<div className="flex-shrink">
|
2023-04-05 18:14:46 +00:00
|
|
|
<p className=" text-emphasis text-sm font-semibold">{type.title}</p>
|
2023-01-06 12:13:56 +00:00
|
|
|
<EventTypeDescription className="text-sm" eventType={type} />
|
|
|
|
</div>
|
|
|
|
<div className="mt-1 self-center">
|
|
|
|
<AvatarGroup
|
|
|
|
truncateAfter={4}
|
|
|
|
className="flex flex-shrink-0"
|
2023-01-11 15:00:46 +00:00
|
|
|
size="sm"
|
2023-01-06 12:13:56 +00:00
|
|
|
items={props.users.map((user) => ({
|
|
|
|
alt: user.name || "",
|
2023-03-09 12:17:13 +00:00
|
|
|
image: user.avatar,
|
2023-01-06 12:13:56 +00:00
|
|
|
}))}
|
|
|
|
/>
|
|
|
|
</div>
|
2022-08-12 19:29:29 +00:00
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
);
|
|
|
|
|
2022-10-19 21:25:03 +00:00
|
|
|
const isEmbed = useIsEmbed(props.isEmbed);
|
2022-03-31 08:45:47 +00:00
|
|
|
const eventTypeListItemEmbedStyles = useEmbedStyles("eventTypeListItem");
|
2022-04-25 04:33:00 +00:00
|
|
|
const shouldAlignCentrallyInEmbed = useEmbedNonStylesConfig("align") !== "left";
|
|
|
|
const shouldAlignCentrally = !isEmbed || shouldAlignCentrallyInEmbed;
|
2021-12-09 15:51:37 +00:00
|
|
|
const query = { ...router.query };
|
|
|
|
delete query.user; // So it doesn't display in the Link (and make tests fail)
|
2023-06-21 21:12:12 +00:00
|
|
|
delete query.orgSlug;
|
2021-10-20 16:00:11 +00:00
|
|
|
const nameOrUsername = user.name || user.username || "";
|
2022-04-14 02:47:34 +00:00
|
|
|
|
2023-05-24 23:35:44 +00:00
|
|
|
/*
|
2023-04-16 21:58:47 +00:00
|
|
|
const telemetry = useTelemetry();
|
|
|
|
useEffect(() => {
|
2022-06-02 16:19:01 +00:00
|
|
|
if (top !== window) {
|
|
|
|
//page_view will be collected automatically by _middleware.ts
|
|
|
|
telemetry.event(telemetryEventTypes.embedView, collectPageParameters("/[user]"));
|
|
|
|
}
|
2023-04-16 21:58:47 +00:00
|
|
|
}, [telemetry, router.asPath]); */
|
2022-10-24 22:20:41 +00:00
|
|
|
const isEventListEmpty = eventTypes.length === 0;
|
2021-07-11 19:35:56 +00:00
|
|
|
return (
|
2021-08-12 17:05:46 +00:00
|
|
|
<>
|
2021-08-27 12:35:20 +00:00
|
|
|
<HeadSeo
|
2022-04-07 10:28:52 +00:00
|
|
|
title={isDynamicGroup ? dynamicNames.join(", ") : nameOrUsername}
|
2023-05-15 07:44:23 +00:00
|
|
|
description={isDynamicGroup ? `Book events with ${dynamicUsernames.join(", ")}` : markdownStrippedBio}
|
2022-10-18 17:46:22 +00:00
|
|
|
meeting={{
|
2023-05-15 07:44:23 +00:00
|
|
|
title: isDynamicGroup ? "" : markdownStrippedBio,
|
2022-10-18 17:46:22 +00:00
|
|
|
profile: { name: `${profile.name}`, image: null },
|
|
|
|
users: isDynamicGroup
|
|
|
|
? dynamicUsernames.map((username, index) => ({ username, name: dynamicNames[index] }))
|
|
|
|
: [{ username: `${user.username}`, name: `${user.name}` }],
|
|
|
|
}}
|
2021-08-27 12:35:20 +00:00
|
|
|
/>
|
2022-04-25 04:33:00 +00:00
|
|
|
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className={classNames(shouldAlignCentrally ? "mx-auto" : "", isEmbed ? "max-w-3xl" : "")}>
|
2022-04-25 04:33:00 +00:00
|
|
|
<main
|
|
|
|
className={classNames(
|
|
|
|
shouldAlignCentrally ? "mx-auto" : "",
|
2023-04-20 22:33:49 +00:00
|
|
|
isEmbed ? "border-booker border-booker-width bg-default rounded-md border" : "",
|
2023-06-22 22:25:37 +00:00
|
|
|
"max-w-3xl px-4 py-24"
|
2022-04-25 04:33:00 +00:00
|
|
|
)}>
|
2022-04-06 17:20:30 +00:00
|
|
|
{isSingleUser && ( // When we deal with a single user, not dynamic group
|
|
|
|
<div className="mb-8 text-center">
|
2023-01-21 11:41:49 +00:00
|
|
|
<Avatar imageSrc={user.avatar} size="xl" alt={nameOrUsername} />
|
2023-04-05 18:14:46 +00:00
|
|
|
<h1 className="font-cal text-emphasis mb-1 text-3xl">
|
2022-04-06 17:20:30 +00:00
|
|
|
{nameOrUsername}
|
2023-05-17 12:47:44 +00:00
|
|
|
{user.verified && (
|
|
|
|
<Verified className=" mx-1 -mt-1 inline h-6 w-6 fill-blue-500 text-white dark:text-black" />
|
|
|
|
)}
|
2022-04-06 17:20:30 +00:00
|
|
|
</h1>
|
2023-01-25 01:08:10 +00:00
|
|
|
{!isBioEmpty && (
|
|
|
|
<>
|
|
|
|
<div
|
2023-05-15 13:18:31 +00:00
|
|
|
className=" text-subtle break-words text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
|
2023-03-28 09:40:13 +00:00
|
|
|
dangerouslySetInnerHTML={{ __html: props.safeBio }}
|
2023-01-25 01:08:10 +00:00
|
|
|
/>
|
|
|
|
</>
|
|
|
|
)}
|
2022-04-06 17:20:30 +00:00
|
|
|
</div>
|
|
|
|
)}
|
2023-04-05 18:14:46 +00:00
|
|
|
|
2022-08-24 20:18:42 +00:00
|
|
|
<div
|
2023-04-05 18:14:46 +00:00
|
|
|
className={classNames("rounded-md ", !isEventListEmpty && "border-subtle border")}
|
2022-08-24 20:18:42 +00:00
|
|
|
data-testid="event-types">
|
2022-03-10 19:21:27 +00:00
|
|
|
{user.away ? (
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="overflow-hidden rounded-sm border ">
|
|
|
|
<div className="text-muted p-8 text-center">
|
|
|
|
<h2 className="font-cal text-default mb-2 text-3xl">😴{" " + t("user_away")}</h2>
|
2022-05-20 07:06:21 +00:00
|
|
|
<p className="mx-auto max-w-md">{t("user_away_description") as string}</p>
|
2022-03-10 19:21:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-04-06 17:20:30 +00:00
|
|
|
) : isDynamicGroup ? ( //When we deal with dynamic group (users > 1)
|
|
|
|
groupEventTypes
|
2022-03-10 19:21:27 +00:00
|
|
|
) : (
|
2022-02-11 14:34:12 +00:00
|
|
|
eventTypes.map((type) => (
|
|
|
|
<div
|
|
|
|
key={type.id}
|
2022-03-31 08:45:47 +00:00
|
|
|
style={{ display: "flex", ...eventTypeListItemEmbedStyles }}
|
2023-04-22 15:47:15 +00:00
|
|
|
className="bg-default border-subtle dark:bg-muted dark:hover:bg-emphasis hover:bg-muted group relative border-b first:rounded-t-md last:rounded-b-md last:border-b-0">
|
2023-04-12 15:26:31 +00:00
|
|
|
<ArrowRight className="text-emphasis absolute right-4 top-4 h-4 w-4 opacity-0 transition-opacity group-hover:opacity-100" />
|
2022-03-05 15:28:24 +00:00
|
|
|
{/* Don't prefetch till the time we drop the amount of javascript in [user][type] page which is impacting score for [user] page */}
|
2023-03-08 15:46:23 +00:00
|
|
|
<div className="block w-full p-5">
|
|
|
|
<Link
|
|
|
|
prefetch={false}
|
|
|
|
href={{
|
|
|
|
pathname: `/${user.username}/${type.slug}`,
|
|
|
|
query,
|
|
|
|
}}
|
|
|
|
passHref
|
|
|
|
onClick={async () => {
|
|
|
|
sdkActionManager?.fire("eventTypeSelected", {
|
|
|
|
eventType: type,
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
data-testid="event-type-link">
|
|
|
|
<div className="flex flex-wrap items-center">
|
2023-04-05 18:14:46 +00:00
|
|
|
<h2 className=" text-default pr-2 text-sm font-semibold">{type.title}</h2>
|
2023-03-08 15:46:23 +00:00
|
|
|
</div>
|
2023-04-13 02:10:23 +00:00
|
|
|
<EventTypeDescription eventType={type} isPublic={true} />
|
2023-03-08 15:46:23 +00:00
|
|
|
</Link>
|
|
|
|
</div>
|
2021-08-12 17:05:46 +00:00
|
|
|
</div>
|
2022-03-10 19:21:27 +00:00
|
|
|
))
|
|
|
|
)}
|
2022-02-11 14:34:12 +00:00
|
|
|
</div>
|
2023-04-05 18:14:46 +00:00
|
|
|
|
2022-10-24 22:20:41 +00:00
|
|
|
{isEventListEmpty && <EmptyPage name={user.name ?? "User"} />}
|
2022-02-11 14:34:12 +00:00
|
|
|
</main>
|
|
|
|
<Toaster position="bottom-right" />
|
|
|
|
</div>
|
2021-08-12 17:05:46 +00:00
|
|
|
</>
|
2021-06-22 17:42:32 +00:00
|
|
|
);
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
2023-06-21 21:12:12 +00:00
|
|
|
UserPage.isBookingPage = true;
|
|
|
|
UserPage.PageWrapper = PageWrapper;
|
2023-04-17 12:16:54 +00:00
|
|
|
|
2022-10-14 16:24:43 +00:00
|
|
|
const getEventTypesWithHiddenFromDB = async (userId: number) => {
|
|
|
|
return (
|
|
|
|
await prisma.eventType.findMany({
|
|
|
|
where: {
|
|
|
|
AND: [
|
|
|
|
{
|
|
|
|
teamId: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
OR: [
|
|
|
|
{
|
|
|
|
userId,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
users: {
|
|
|
|
some: {
|
|
|
|
id: userId,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
orderBy: [
|
2021-10-08 11:43:48 +00:00
|
|
|
{
|
2022-10-14 16:24:43 +00:00
|
|
|
position: "desc",
|
2021-10-08 11:43:48 +00:00
|
|
|
},
|
|
|
|
{
|
2022-10-14 16:24:43 +00:00
|
|
|
id: "asc",
|
2021-10-08 11:43:48 +00:00
|
|
|
},
|
|
|
|
],
|
2022-10-14 16:24:43 +00:00
|
|
|
select: {
|
|
|
|
...baseEventTypeSelect,
|
|
|
|
metadata: true,
|
2021-11-15 12:25:49 +00:00
|
|
|
},
|
2022-10-14 16:24:43 +00:00
|
|
|
})
|
|
|
|
).map((eventType) => ({
|
|
|
|
...eventType,
|
|
|
|
metadata: EventTypeMetaDataSchema.parse(eventType.metadata),
|
|
|
|
}));
|
2022-04-06 17:20:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
|
|
|
|
const ssr = await ssrInit(context);
|
2022-05-17 20:43:27 +00:00
|
|
|
const crypto = await import("crypto");
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
const { currentOrgDomain, isValidOrgDomain } = orgDomainConfig(context.req.headers.host ?? "");
|
2022-04-06 17:20:30 +00:00
|
|
|
|
|
|
|
const usernameList = getUsernameList(context.query.user as string);
|
|
|
|
const dataFetchStart = Date.now();
|
2023-03-09 12:17:13 +00:00
|
|
|
const usersWithoutAvatar = await prisma.user.findMany({
|
2022-04-06 17:20:30 +00:00
|
|
|
where: {
|
|
|
|
username: {
|
|
|
|
in: usernameList,
|
|
|
|
},
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
organization: isValidOrgDomain
|
|
|
|
? {
|
|
|
|
slug: currentOrgDomain,
|
|
|
|
}
|
|
|
|
: null,
|
2022-04-06 17:20:30 +00:00
|
|
|
},
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
username: true,
|
|
|
|
email: true,
|
|
|
|
name: true,
|
|
|
|
bio: true,
|
2022-04-25 04:33:00 +00:00
|
|
|
brandColor: true,
|
|
|
|
darkBrandColor: true,
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
organizationId: true,
|
2022-04-06 17:20:30 +00:00
|
|
|
theme: true,
|
|
|
|
away: true,
|
|
|
|
verified: true,
|
|
|
|
allowDynamicBooking: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2023-03-09 12:17:13 +00:00
|
|
|
const users = usersWithoutAvatar.map((user) => ({
|
|
|
|
...user,
|
2023-07-11 14:23:07 +00:00
|
|
|
avatar: `/${user.username}/avatar.png`,
|
2023-03-09 12:17:13 +00:00
|
|
|
}));
|
|
|
|
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
if (!users.length || (!isValidOrgDomain && !users.some((user) => user.organizationId === null))) {
|
2022-04-06 17:20:30 +00:00
|
|
|
return {
|
|
|
|
notFound: true,
|
2022-10-19 21:25:03 +00:00
|
|
|
} as {
|
|
|
|
notFound: true;
|
2022-04-06 17:20:30 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
const isDynamicGroup = users.length > 1;
|
|
|
|
|
2023-02-15 15:42:49 +00:00
|
|
|
if (isDynamicGroup) {
|
|
|
|
// sort and be in the same order as usernameList so first user is the first user in the list
|
|
|
|
users.sort((a, b) => {
|
|
|
|
const aIndex = (a.username && usernameList.indexOf(a.username)) || 0;
|
|
|
|
const bIndex = (b.username && usernameList.indexOf(b.username)) || 0;
|
|
|
|
return aIndex - bIndex;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-04-25 04:33:00 +00:00
|
|
|
const dynamicNames = isDynamicGroup
|
|
|
|
? users.map((user) => {
|
|
|
|
return user.name || "";
|
|
|
|
})
|
|
|
|
: [];
|
2022-04-06 17:20:30 +00:00
|
|
|
const [user] = users; //to be used when dealing with single user, not dynamic group
|
2022-04-25 04:33:00 +00:00
|
|
|
|
|
|
|
const profile = isDynamicGroup
|
|
|
|
? {
|
|
|
|
name: getGroupName(dynamicNames),
|
|
|
|
image: null,
|
|
|
|
theme: null,
|
|
|
|
weekStart: "Sunday",
|
|
|
|
brandColor: "",
|
|
|
|
darkBrandColor: "",
|
2022-05-26 16:41:05 +00:00
|
|
|
allowDynamicBooking: !users.some((user) => {
|
2022-04-25 04:33:00 +00:00
|
|
|
return !user.allowDynamicBooking;
|
2022-05-26 16:41:05 +00:00
|
|
|
}),
|
2022-04-25 04:33:00 +00:00
|
|
|
}
|
|
|
|
: {
|
|
|
|
name: user.name || user.username,
|
|
|
|
image: user.avatar,
|
|
|
|
theme: user.theme,
|
|
|
|
brandColor: user.brandColor,
|
|
|
|
darkBrandColor: user.darkBrandColor,
|
|
|
|
};
|
2022-04-06 17:20:30 +00:00
|
|
|
|
2022-10-14 16:24:43 +00:00
|
|
|
const eventTypesWithHidden = isDynamicGroup ? [] : await getEventTypesWithHiddenFromDB(user.id);
|
2022-03-04 10:03:10 +00:00
|
|
|
const dataFetchEnd = Date.now();
|
|
|
|
if (context.query.log === "1") {
|
|
|
|
context.res.setHeader("X-Data-Fetch-Time", `${dataFetchEnd - dataFetchStart}ms`);
|
|
|
|
}
|
2022-02-01 21:48:40 +00:00
|
|
|
const eventTypesRaw = eventTypesWithHidden.filter((evt) => !evt.hidden);
|
|
|
|
|
|
|
|
const eventTypes = eventTypesRaw.map((eventType) => ({
|
|
|
|
...eventType,
|
2022-10-14 16:24:43 +00:00
|
|
|
metadata: EventTypeMetaDataSchema.parse(eventType.metadata || {}),
|
2023-03-28 09:40:13 +00:00
|
|
|
descriptionAsSafeHTML: markdownToSafeHTML(eventType.description),
|
2022-02-01 21:48:40 +00:00
|
|
|
}));
|
2021-10-08 11:43:48 +00:00
|
|
|
|
2022-06-15 20:54:31 +00:00
|
|
|
const isSingleUser = users.length === 1;
|
|
|
|
const dynamicUsernames = isDynamicGroup
|
|
|
|
? users.map((user) => {
|
|
|
|
return user.username || "";
|
|
|
|
})
|
|
|
|
: [];
|
|
|
|
|
2023-03-28 09:40:13 +00:00
|
|
|
const safeBio = markdownToSafeHTML(user.bio) || "";
|
|
|
|
|
2023-05-15 07:44:23 +00:00
|
|
|
const markdownStrippedBio = stripMarkdown(user?.bio || "");
|
2023-06-21 21:12:12 +00:00
|
|
|
|
2021-06-22 17:42:32 +00:00
|
|
|
return {
|
|
|
|
props: {
|
2022-04-06 17:20:30 +00:00
|
|
|
users,
|
2023-03-28 09:40:13 +00:00
|
|
|
safeBio,
|
2022-04-25 04:33:00 +00:00
|
|
|
profile,
|
2023-05-16 19:41:47 +00:00
|
|
|
// Dynamic group has no theme preference right now. It uses system theme.
|
|
|
|
themeBasis: isDynamicGroup ? null : user.username,
|
2022-02-11 14:34:12 +00:00
|
|
|
user: {
|
|
|
|
emailMd5: crypto.createHash("md5").update(user.email).digest("hex"),
|
|
|
|
},
|
2022-06-15 20:54:31 +00:00
|
|
|
eventTypes: isDynamicGroup
|
|
|
|
? defaultEvents.map((event) => {
|
|
|
|
event.description = getDynamicEventDescription(dynamicUsernames, event.slug);
|
|
|
|
return event;
|
|
|
|
})
|
|
|
|
: eventTypes,
|
2021-10-20 16:00:11 +00:00
|
|
|
trpcState: ssr.dehydrate(),
|
2022-06-15 20:54:31 +00:00
|
|
|
isDynamicGroup,
|
|
|
|
dynamicNames,
|
|
|
|
dynamicUsernames,
|
|
|
|
isSingleUser,
|
2023-05-15 07:44:23 +00:00
|
|
|
markdownStrippedBio,
|
2021-06-22 17:42:32 +00:00
|
|
|
},
|
|
|
|
};
|
2021-10-08 11:43:48 +00:00
|
|
|
};
|
2023-06-21 21:12:12 +00:00
|
|
|
|
|
|
|
export default UserPage;
|