Skip to content

Scheduling infrastructure for absolutely everyone.

v1.6.2 (#2926)

Omar López01631e808f03
diff --git a/.env.example b/.env.example
index cebebfa0d49..a2d142392f7 100644
--- a/.env.example
+++ b/.env.example
@@ -15,6 +15,8 @@
# - You can not repackage or sell the codebase
# - Acquire a commercial license to remove these terms by visiting: cal.com/sales
NEXT_PUBLIC_LICENSE_CONSENT=''
+# To enable enterprise-only features, fill your license key in here
+CALCOM_LICENSE_KEY=
# ***********************************************************************************************************
# - DATABASE ************************************************************************************************
@@ -25,6 +27,7 @@ NEXT_PUBLIC_LICENSE_CONSENT=''
NEXT_PUBLIC_WEBAPP_URL='http://localhost:3000'
# Change to 'http://localhost:3001' if running the website simultaneously
NEXT_PUBLIC_WEBSITE_URL='http://localhost:3000'
+NEXT_PUBLIC_CONSOLE_URL='http://localhost:3004'
NEXT_PUBLIC_EMBED_LIB_URL='http://localhost:3000/embed/embed.js'
# To enable SAML login, set both these variables
@@ -70,6 +73,10 @@ NEXT_PUBLIC_ZENDESK_KEY=
# Help Scout Config
NEXT_PUBLIC_HELPSCOUT_KEY=
+# Inbox to send user feedback
+SEND_FEEDBACK_EMAIL=
+
+
# This is used so we can bypass emails in auth flows for E2E testing
# Set it to "1" if you need to run E2E tests locally
NEXT_PUBLIC_IS_E2E=
diff --git a/.github/workflows/check-types.yml b/.github/workflows/check-types.yml
index 356efd516b8..2d206850413 100644
--- a/.github/workflows/check-types.yml
+++ b/.github/workflows/check-types.yml
@@ -16,7 +16,8 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v2
with:
- fetch-depth: 0
+ ref: ${{ github.event.pull_request.head.sha }}
+ fetch-depth: 2
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v3
diff --git a/.github/workflows/e2e-embed.yml b/.github/workflows/e2e-embed.yml
new file mode 100644
index 00000000000..327a58b448b
--- /dev/null
+++ b/.github/workflows/e2e-embed.yml
@@ -0,0 +1,110 @@
+name: E2E test - embed
+on:
+ push:
+ branches: [ tests/ci-embed ]
+ pull_request_target: # So we can test on forks
+ branches:
+ - main
+ # Embed e2e - tests verify booking flow which is applicable to non-embed case also. So, don't ignore apps/web changes.
+ paths-ignore:
+ - apps/api/**
+ - apps/console/**
+ - apps/docs/**
+ - apps/swagger/**
+ - apps/website/**
+ - apps/web/public/**
+ - tests/**
+ - playwright/**
+jobs:
+ test:
+ timeout-minutes: 20
+ name: Testing Embeds
+ strategy:
+ matrix:
+ node: ["14.x"]
+ os: [ubuntu-latest]
+ runs-on: ${{ matrix.os }}
+
+ env:
+ DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
+ NEXT_PUBLIC_WEBAPP_URL: http://localhost:3000
+ NEXT_PUBLIC_WEBSITE_URL: http://localhost:3000
+ NEXTAUTH_SECRET: secret
+ GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }}
+ GOOGLE_LOGIN_ENABLED: true
+ # CRON_API_KEY: xxx
+ CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }}
+ NEXT_PUBLIC_STRIPE_PUBLIC_KEY: ${{ secrets.CI_NEXT_PUBLIC_STRIPE_PUBLIC_KEY }}
+ STRIPE_PRIVATE_KEY: ${{ secrets.CI_STRIPE_PRIVATE_KEY }}
+ STRIPE_CLIENT_ID: ${{ secrets.CI_STRIPE_CLIENT_ID }}
+ STRIPE_WEBHOOK_SECRET: ${{ secrets.CI_STRIPE_WEBHOOK_SECRET }}
+ PAYMENT_FEE_PERCENTAGE: 0.005
+ PAYMENT_FEE_FIXED: 10
+ SAML_DATABASE_URL: postgresql://postgres:@localhost:5432/calendso
+ SAML_ADMINS: [email protected]
+ NEXTAUTH_URL: http://localhost:3000/api/auth
+ NEXT_PUBLIC_IS_E2E: 1
+ # EMAIL_FROM: [email protected]
+ # EMAIL_SERVER_HOST: ${{ secrets.CI_EMAIL_SERVER_HOST }}
+ # EMAIL_SERVER_PORT: ${{ secrets.CI_EMAIL_SERVER_PORT }}
+ # EMAIL_SERVER_USER: ${{ secrets.CI_EMAIL_SERVER_USER }}
+ # EMAIL_SERVER_PASSWORD: ${{ secrets.CI_EMAIL_SERVER_PASSWORD }}
+ # MS_GRAPH_CLIENT_ID: xxx
+ # MS_GRAPH_CLIENT_SECRET: xxx
+ # ZOOM_CLIENT_ID: xxx
+ # ZOOM_CLIENT_SECRET: xxx
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
+ services:
+ postgres:
+ image: postgres:12.1
+ env:
+ POSTGRES_USER: postgres
+ POSTGRES_DB: calendso
+ ports:
+ - 5432:5432
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v2
+ with:
+ ref: ${{ github.event.pull_request.head.sha }} # So we can test on forks
+ fetch-depth: 2
+
+ - name: Use Node ${{ matrix.node }}
+ uses: actions/setup-node@v3
+ with:
+ node-version: ${{ matrix.node }}
+ cache: "yarn"
+
+ - name: Cache playwright binaries
+ uses: actions/cache@v2
+ id: playwright-cache
+ with:
+ path: |
+ ~/Library/Caches/ms-playwright
+ ~/.cache/ms-playwright
+ ${{ github.workspace }}/node_modules/playwright
+ key: cache-playwright-${{ hashFiles('**/yarn.lock') }}
+ restore-keys: cache-playwright-
+ - run: yarn --frozen-lockfile
+ - name: Install playwright deps
+ # if: steps.playwright-cache.outputs.cache-hit != 'true'
+ run: yarn playwright install --with-deps
+ - run: yarn embed-tests-prepare
+ - run: yarn workspace @calcom/embed-core embed-tests-update-snapshots:ci
+ - run: yarn workspace @calcom/embed-react embed-tests-update-snapshots:ci
+
+ - name: Upload embed-core results
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v2
+ with:
+ name: test-results-core
+ path: packages/embeds/embed-core/playwright/results
+
+ - name: Upload embed-react results
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v2
+ with:
+ name: test-results-react
+ path: packages/embeds/embed-react/playwright/results
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 1eb2a2a8b39..b5bd736d209 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -4,7 +4,7 @@ on:
branches:
- main
paths-ignore:
- - public/static/locales/**
+ - apps/web/public/static/locales/**
jobs:
test:
timeout-minutes: 20
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 546b1617f38..1f3424f5315 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -15,7 +15,8 @@
"Website(3001)",
"Embed Core(3100)",
"Embed React(3101)",
- "Prisma Studio(5555)"
+ "Prisma Studio(5555)",
+ "Maildev(587)"
],
// Mark as the default build task so cmd/ctrl+shift+b will create them
"group": {
@@ -65,6 +66,13 @@
"command": "yarn db-studio",
"isBackground": false,
"problemMatcher": []
+ },
+ {
+ "label": "Maildev(587)",
+ "type": "shell",
+ "command": "maildev -s 587",
+ "isBackground": false,
+ "problemMatcher": []
}
]
}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f03a86e01f7..b79473e2185 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,6 +4,26 @@ Contributions are what make the open source community such an amazing place to b
- Before jumping into a PR be sure to search [existing PRs](https://github.com/calcom/cal.com/pulls) or [issues](https://github.com/calcom/cal.com/issues) for an open or closed item that relates to your submission.
+## Areas of expertise
+
+### Legend
+
+✅ = has knowledge
+
+🥇 = is their main priority
+
+⚠️ = is the only one with knowledge
+
+👀 = has no knowledge but wants to be onboarded
+
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://dynamic-svgs.vercel.app/image.svg?dark">
+ <img alt="Areas of expertise table" src="https://dynamic-svgs.vercel.app/image.svg">
+</picture>
+
+
+
+
## Developing
The development branch is `main`. This is the branch that all pull
diff --git a/README.md b/README.md
index 9dfae9e6208..d74e4b345bb 100644
--- a/README.md
+++ b/README.md
@@ -18,22 +18,26 @@
<a href="https://cal.com">Website</a>
·
<a href="https://github.com/calcom/cal.com/issues">Issues</a>
+ ·
+ <a href="https://cal.com/roadmap">Roadmap</a>
</p>
</p>
<p align="center">
<a href="https://cal.com/slack"><img src="https://img.shields.io/badge/Slack-calendso.slack.com-%234A154B" alt="Join Cal.com Slack"></a>
<a href="https://www.producthunt.com/posts/calendso"><img src="https://img.shields.io/badge/Product%20Hunt-%231%20Product%20of%20the%20Month-%23DA552E" alt="Product Hunt"></a>
- <a href="https://github.com/calcom/cal.com/stargazers"><img src="https://img.shields.io/github/stars/calcom/cal.com" alt="Github Stars"></a>
- <a href="https://news.ycombinator.com/item?id=26817795"><img src="https://img.shields.io/badge/Hacker%20News-311-%23FF6600" alt="Hacker News"></a>
- <a href="https://github.com/calcom/cal.com/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-AGPLv3-purple" alt="License"></a>
- <a href="https://github.com/calcom/cal.com/pulse"><img src="https://img.shields.io/github/commit-activity/m/calcom/cal.com" alt="Commits-per-month"></a>
- <a href="https://cal.com/pricing"><img src="https://img.shields.io/badge/Pricing-%2412%2Fmonth-brightgreen" alt="Pricing"></a>
- <a href="https://jitsu.com?utm_source=github/calcom/cal.com"><img src="https://img.shields.io/badge/Metrics_tracked_by-JITSU-AA00FF?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACKSURBVHgBrZDRCYAwDEQv6gCOoKO4hOCXI9QVnEZwiY5iF5GaVClaBNtioCSUvCR3tMJaxIfZgW4AGUoEPVwgPZoS0Dmgg3NBVDFNbMIsmYCak3J1jDk9iCQvsKJvkzr71N81Gj6vDT/LU2P6RhY63jcafk3YJEbgeZpiFyc/5HJKv8Ef273NSfABGbQfUZhnOSAAAAAASUVORK5CYII=" alt="Jitsu Tracked"></a>
- <a href="https://hub.docker.com/r/calendso/calendso"><img src="https://img.shields.io/docker/pulls/calendso/calendso"></a>
- <a href="https://twitter.com/calcom"><img src="https://img.shields.io/twitter/follow/calcom?style=social"></a>
- <a href="https://calendso.slack.com/archives/C02BY67GMMW"><img src="https://img.shields.io/badge/translations-contribute-brightgreen" /></a>
- <a href="https://www.contributor-covenant.org/version/1/4/code-of-conduct/ "><img src="https://img.shields.io/badge/Contributor%20Covenant-1.4-purple" /></a>
+ <a href="https://github.com/calcom/cal.com/stargazers"><img src="https://img.shields.io/github/stars/calcom/cal.com" alt="Github Stars"></a>
+ <a href="https://news.ycombinator.com/item?id=26817795"><img src="https://img.shields.io/badge/Hacker%20News-311-%23FF6600" alt="Hacker News"></a>
+ <a href="https://github.com/calcom/cal.com/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-AGPLv3-purple" alt="License"></a>
+ <a href="https://github.com/calcom/cal.com/pulse"><img src="https://img.shields.io/github/commit-activity/m/calcom/cal.com" alt="Commits-per-month"></a>
+ <a href="https://cal.com/pricing"><img src="https://img.shields.io/badge/Pricing-%2412%2Fmonth-brightgreen" alt="Pricing"></a>
+ <a href="https://jitsu.com?utm_source=github/calcom/cal.com"><img src="https://img.shields.io/badge/Metrics_tracked_by-JITSU-AA00FF?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACKSURBVHgBrZDRCYAwDEQv6gCOoKO4hOCXI9QVnEZwiY5iF5GaVClaBNtioCSUvCR3tMJaxIfZgW4AGUoEPVwgPZoS0Dmgg3NBVDFNbMIsmYCak3J1jDk9iCQvsKJvkzr71N81Gj6vDT/LU2P6RhY63jcafk3YJEbgeZpiFyc/5HJKv8Ef273NSfABGbQfUZhnOSAAAAAASUVORK5CYII=" alt="Jitsu Tracked"></a>
+ <img src="https://api.checklyhq.com/v1/badges/checks/5e048048-1b51-47ba-9209-60607507622e?responseTime=true" alt="Checkly Availability" />
+ <a href="https://hub.docker.com/r/calendso/calendso"><img src="https://img.shields.io/docker/pulls/calendso/calendso"></a>
+ <a href="https://twitter.com/calcom"><img src="https://img.shields.io/twitter/follow/calcom?style=flat"></a>
+ <a href="https://twitch.tv/calcomtv"><img src="https://img.shields.io/twitch/status/calcomtv?style=flat"></a>
+ <a href="https://calendso.slack.com/archives/C02BY67GMMW"><img src="https://img.shields.io/badge/translations-contribute-brightgreen" /></a>
+ <a href="https://www.contributor-covenant.org/version/1/4/code-of-conduct/ "><img src="https://img.shields.io/badge/Contributor%20Covenant-1.4-purple" /></a>
</p>
<!-- ABOUT THE PROJECT -->
diff --git a/apps/api b/apps/api
index a7889b34368..ed2f42fb019 160000
--- a/apps/api
+++ b/apps/api
@@ -1 +1 @@
-Subproject commit a7889b34368eb37981b5c78953315a6ed5fc97cd
+Subproject commit ed2f42fb0195b1afa0bf2edbab1df2126038b273
diff --git a/apps/console b/apps/console
index 67476f0e248..b6b26f47922 160000
--- a/apps/console
+++ b/apps/console
@@ -1 +1 @@
-Subproject commit 67476f0e24871730e4a7b06da99ee18d4f5179ce
+Subproject commit b6b26f47922a5404086bf34635338dc6afa9c1d3
diff --git a/apps/web/components/AppsShell.tsx b/apps/web/components/AppsShell.tsx
index 51f55c74485..23755ab80dd 100644
--- a/apps/web/components/AppsShell.tsx
+++ b/apps/web/components/AppsShell.tsx
@@ -1,23 +1,21 @@
import { useSession } from "next-auth/react";
import React from "react";
-import { useLocale } from "@calcom/lib/hooks/useLocale";
-
import NavTabs from "./NavTabs";
+const tabs = [
+ {
+ name: "app_store",
+ href: "/apps",
+ },
+ {
+ name: "installed_apps",
+ href: "/apps/installed",
+ },
+];
+
export default function AppsShell({ children }: { children: React.ReactNode }) {
- const { t } = useLocale();
const { status } = useSession();
- const tabs = [
- {
- name: t("app_store"),
- href: "/apps",
- },
- {
- name: t("installed_apps"),
- href: "/apps/installed",
- },
- ];
return (
<>
diff --git a/apps/web/components/BookingsShell.tsx b/apps/web/components/BookingsShell.tsx
index 014e379eca8..bbf5894dbbf 100644
--- a/apps/web/components/BookingsShell.tsx
+++ b/apps/web/components/BookingsShell.tsx
@@ -1,30 +1,27 @@
import React from "react";
-import { useLocale } from "@lib/hooks/useLocale";
-
import NavTabs from "./NavTabs";
-export default function BookingsShell({ children }: { children: React.ReactNode }) {
- const { t } = useLocale();
- const tabs = [
- {
- name: t("upcoming"),
- href: "/bookings/upcoming",
- },
- {
- name: t("recurring"),
- href: "/bookings/recurring",
- },
- {
- name: t("past"),
- href: "/bookings/past",
- },
- {
- name: t("cancelled"),
- href: "/bookings/cancelled",
- },
- ];
+const tabs = [
+ {
+ name: "upcoming",
+ href: "/bookings/upcoming",
+ },
+ {
+ name: "recurring",
+ href: "/bookings/recurring",
+ },
+ {
+ name: "past",
+ href: "/bookings/past",
+ },
+ {
+ name: "cancelled",
+ href: "/bookings/cancelled",
+ },
+];
+export default function BookingsShell({ children }: { children: React.ReactNode }) {
return (
<>
<NavTabs tabs={tabs} linkProps={{ shallow: true }} />
diff --git a/apps/web/components/CustomBranding.tsx b/apps/web/components/CustomBranding.tsx
index 8dd83e22351..5959a6abaa3 100644
--- a/apps/web/components/CustomBranding.tsx
+++ b/apps/web/components/CustomBranding.tsx
@@ -1,6 +1,6 @@
import { useEffect } from "react";
-import { useBrandColors } from "@calcom/embed-core";
+import { useBrandColors } from "@calcom/embed-core/embed-iframe";
const brandColor = "#292929";
const brandTextColor = "#ffffff";
diff --git a/apps/web/components/EmptyScreen.tsx b/apps/web/components/EmptyScreen.tsx
index 4118800cbe6..d8ba88fea6d 100644
--- a/apps/web/components/EmptyScreen.tsx
+++ b/apps/web/components/EmptyScreen.tsx
@@ -9,17 +9,17 @@ export default function EmptyScreen({
}: {
Icon: SVGComponent;
headline: string;
- description: string;
+ description: string | React.ReactElement;
}) {
return (
<>
<div className="min-h-80 my-6 flex flex-col items-center justify-center rounded-sm border border-dashed">
- <div className="flex h-[72px] w-[72px] items-center justify-center rounded-full bg-white">
- <Icon className="inline-block h-10 w-10 bg-white" />
+ <div className="flex h-[72px] w-[72px] items-center justify-center rounded-full bg-gray-600 dark:bg-white">
+ <Icon className="inline-block h-10 w-10 text-white dark:bg-white dark:text-gray-600" />
</div>
<div className="max-w-[420px] text-center">
- <h2 className="mt-6 mb-1 text-lg font-medium">{headline}</h2>
- <p className="text-sm leading-6 text-gray-600">{description}</p>
+ <h2 className="mt-6 mb-1 text-lg font-medium dark:text-gray-300">{headline}</h2>
+ <p className="text-sm leading-6 text-gray-600 dark:text-gray-300">{description}</p>
</div>
</div>
</>
diff --git a/apps/web/components/NavTabs.tsx b/apps/web/components/NavTabs.tsx
index bc3de08adb9..fa42293f46b 100644
--- a/apps/web/components/NavTabs.tsx
+++ b/apps/web/components/NavTabs.tsx
@@ -4,6 +4,8 @@ import Link, { LinkProps } from "next/link";
import { useRouter } from "next/router";
import { FC, Fragment, MouseEventHandler } from "react";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+
import classNames from "@lib/classNames";
import { SVGComponent } from "@lib/types/SVGComponent";
@@ -22,6 +24,7 @@ export interface NavTabProps {
const NavTabs: FC<NavTabProps> = ({ tabs, linkProps, ...props }) => {
const router = useRouter();
+ const { t } = useLocale();
return (
<>
<nav
@@ -77,7 +80,7 @@ const NavTabs: FC<NavTabProps> = ({ tabs, linkProps, ...props }) => {
aria-hidden="true"
/>
)}
- <span>{tab.name}</span>
+ <span>{t(tab.name)}</span>
</a>
</Link>
</Component>
diff --git a/apps/web/components/SettingsShell.tsx b/apps/web/components/SettingsShell.tsx
index 72ff5981204..6385dd4a4bd 100644
--- a/apps/web/components/SettingsShell.tsx
+++ b/apps/web/components/SettingsShell.tsx
@@ -1,48 +1,54 @@
import { CreditCardIcon, KeyIcon, LockClosedIcon, UserGroupIcon, UserIcon } from "@heroicons/react/solid";
-import React from "react";
+import React, { ComponentProps } from "react";
-import { useLocale } from "@calcom/lib/hooks/useLocale";
+import ErrorBoundary from "@lib/ErrorBoundary";
import NavTabs from "./NavTabs";
+import Shell from "./Shell";
-export default function SettingsShell({ children }: { children: React.ReactNode }) {
- const { t } = useLocale();
-
- const tabs = [
- {
- name: t("profile"),
- href: "/settings/profile",
- icon: UserIcon,
- },
- {
- name: t("security"),
- href: "/settings/security",
- icon: KeyIcon,
- },
- {
- name: t("teams"),
- href: "/settings/teams",
- icon: UserGroupIcon,
- },
- {
- name: t("billing"),
- href: "/settings/billing",
- icon: CreditCardIcon,
- },
- {
- name: t("admin"),
- href: "/settings/admin",
- icon: LockClosedIcon,
- adminRequired: true,
- },
- ];
+const tabs = [
+ {
+ name: "profile",
+ href: "/settings/profile",
+ icon: UserIcon,
+ },
+ {
+ name: "security",
+ href: "/settings/security",
+ icon: KeyIcon,
+ },
+ {
+ name: "teams",
+ href: "/settings/teams",
+ icon: UserGroupIcon,
+ },
+ {
+ name: "billing",
+ href: "/settings/billing",
+ icon: CreditCardIcon,
+ },
+ {
+ name: "admin",
+ href: "/settings/admin",
+ icon: LockClosedIcon,
+ adminRequired: true,
+ },
+];
+export default function SettingsShell({
+ children,
+ ...rest
+}: { children: React.ReactNode } & ComponentProps<typeof Shell>) {
return (
- <>
+ <Shell {...rest}>
<div className="sm:mx-auto">
<NavTabs tabs={tabs} />
</div>
- <main className="max-w-4xl">{children}</main>
- </>
+ <main className="max-w-4xl">
+ <>
+ <ErrorBoundary>{children}</ErrorBoundary>
+ </>
+ </main>
+ </Shell>
);
}
diff --git a/apps/web/components/Shell.tsx b/apps/web/components/Shell.tsx
index beea8ff7d6a..b62419a7d86 100644
--- a/apps/web/components/Shell.tsx
+++ b/apps/web/components/Shell.tsx
@@ -10,15 +10,16 @@ import {
MapIcon,
MoonIcon,
ViewGridIcon,
+ QuestionMarkCircleIcon,
} from "@heroicons/react/solid";
import { UserPlan } from "@prisma/client";
import { SessionContextValue, signOut, useSession } from "next-auth/react";
import Link from "next/link";
import { useRouter } from "next/router";
-import React, { Fragment, ReactNode, useEffect } from "react";
+import React, { Fragment, ReactNode, useEffect, useState } from "react";
import { Toaster } from "react-hot-toast";
-import { useIsEmbed } from "@calcom/embed-core";
+import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import Button from "@calcom/ui/Button";
import Dropdown, {
@@ -31,6 +32,7 @@ import LicenseBanner from "@ee/components/LicenseBanner";
import TrialBanner from "@ee/components/TrialBanner";
import HelpMenuItem from "@ee/components/support/HelpMenuItem";
+import ErrorBoundary from "@lib/ErrorBoundary";
import classNames from "@lib/classNames";
import { WEBAPP_URL } from "@lib/config/constants";
import { shouldShowOnboarding } from "@lib/getting-started";
@@ -348,7 +350,7 @@ const Layout = ({
"px-4 sm:px-6 md:px-8",
props.flexChildrenContainer && "flex flex-1 flex-col"
)}>
- {!props.isLoading ? props.children : props.customLoader}
+ <ErrorBoundary>{!props.isLoading ? props.children : props.customLoader}</ErrorBoundary>
</div>
{/* show bottom navigation for md and smaller (tablet and phones) */}
{status === "authenticated" && (
@@ -461,8 +463,10 @@ function UserDropdown({ small }: { small?: boolean }) {
},
});
const utils = trpc.useContext();
+ const [helpOpen, setHelpOpen] = useState(false);
+
return (
- <Dropdown>
+ <Dropdown onOpenChange={() => setHelpOpen(false)}>
<DropdownMenuTrigger asChild>
<button className="group flex w-full cursor-pointer appearance-none items-center text-left">
<span
@@ -474,7 +478,7 @@ function UserDropdown({ small }: { small?: boolean }) {
// eslint-disable-next-line @next/next/no-img-element
<img
className="rounded-full"
- src={process.env.NEXT_PUBLIC_WEBSITE_URL + "/" + user?.username + "/avatar.png"}
+ src={WEBAPP_URL + "/" + user?.username + "/avatar.png"}
alt={user?.username || "Nameless User"}
/>
}
@@ -504,96 +508,115 @@ function UserDropdown({ small }: { small?: boolean }) {
</button>
</DropdownMenuTrigger>
<DropdownMenuContent portalled={true}>
- <DropdownMenuItem>
- <a
- onClick={() => {
- mutation.mutate({ away: !user?.away });
- utils.invalidateQueries("viewer.me");
- }}
- className="flex min-w-max cursor-pointer px-4 py-2 text-sm hover:bg-gray-100 hover:text-gray-900">
- <MoonIcon
- className={classNames(
- user?.away
- ? "text-purple-500 group-hover:text-purple-700"
- : "text-gray-500 group-hover:text-gray-700",
- "h-5 w-5 flex-shrink-0 ltr:mr-3 rtl:ml-3"
- )}
- aria-hidden="true"
- />
- {user?.away ? t("set_as_free") : t("set_as_away")}
- </a>
- </DropdownMenuItem>
- <DropdownMenuSeparator className="h-px bg-gray-200" />
- {user?.username && (
- <DropdownMenuItem>
- <a
- target="_blank"
- rel="noopener noreferrer"
- href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}`}
- className="flex items-center px-4 py-2 text-sm text-gray-700">
- <ExternalLinkIcon className="h-5 w-5 text-gray-500 ltr:mr-3 rtl:ml-3" /> {t("view_public_page")}
- </a>
- </DropdownMenuItem>
+ {helpOpen ? (
+ <HelpMenuItem />
+ ) : (
+ <>
+ <DropdownMenuItem>
+ <a
+ onClick={() => {
+ mutation.mutate({ away: !user?.away });
+ utils.invalidateQueries("viewer.me");
+ }}
+ className="flex min-w-max cursor-pointer px-4 py-2 text-sm hover:bg-gray-100 hover:text-gray-900">
+ <MoonIcon
+ className={classNames(
+ user?.away
+ ? "text-purple-500 group-hover:text-purple-700"
+ : "text-gray-500 group-hover:text-gray-700",
+ "h-5 w-5 flex-shrink-0 ltr:mr-3 rtl:ml-3"
+ )}
+ aria-hidden="true"
+ />
+ {user?.away ? t("set_as_free") : t("set_as_away")}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator className="h-px bg-gray-200" />
+ {user?.username && (
+ <DropdownMenuItem>
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}`}
+ className="flex items-center px-4 py-2 text-sm text-gray-700">
+ <ExternalLinkIcon className="h-5 w-5 text-gray-500 ltr:mr-3 rtl:ml-3" />{" "}
+ {t("view_public_page")}
+ </a>
+ </DropdownMenuItem>
+ )}
+ <DropdownMenuSeparator className="h-px bg-gray-200" />
+ <DropdownMenuItem>
+ <a
+ href="https://cal.com/slack"
+ target="_blank"
+ rel="noreferrer"
+ className="flex px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900">
+ <svg
+ viewBox="0 0 2447.6 2452.5"
+ className={classNames(
+ "text-gray-500 group-hover:text-gray-700",
+ "mt-0.5 h-4 w-4 flex-shrink-0 ltr:mr-4 rtl:ml-4"
+ )}
+ xmlns="http://www.w3.org/2000/svg">
+ <g clipRule="evenodd" fillRule="evenodd">
+ <path
+ d="m897.4 0c-135.3.1-244.8 109.9-244.7 245.2-.1 135.3 109.5 245.1 244.8 245.2h244.8v-245.1c.1-135.3-109.5-245.1-244.9-245.3.1 0 .1 0 0 0m0 654h-652.6c-135.3.1-244.9 109.9-244.8 245.2-.2 135.3 109.4 245.1 244.7 245.3h652.7c135.3-.1 244.9-109.9 244.8-245.2.1-135.4-109.5-245.2-244.8-245.3z"
+ fill="currentColor"></path>
+ <path
+ d="m2447.6 899.2c.1-135.3-109.5-245.1-244.8-245.2-135.3.1-244.9 109.9-244.8 245.2v245.3h244.8c135.3-.1 244.9-109.9 244.8-245.3zm-652.7 0v-654c.1-135.2-109.4-245-244.7-245.2-135.3.1-244.9 109.9-244.8 245.2v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.3z"
+ fill="currentColor"></path>
+ <path
+ d="m1550.1 2452.5c135.3-.1 244.9-109.9 244.8-245.2.1-135.3-109.5-245.1-244.8-245.2h-244.8v245.2c-.1 135.2 109.5 245 244.8 245.2zm0-654.1h652.7c135.3-.1 244.9-109.9 244.8-245.2.2-135.3-109.4-245.1-244.7-245.3h-652.7c-135.3.1-244.9 109.9-244.8 245.2-.1 135.4 109.4 245.2 244.7 245.3z"
+ fill="currentColor"></path>
+ <path
+ d="m0 1553.2c-.1 135.3 109.5 245.1 244.8 245.2 135.3-.1 244.9-109.9 244.8-245.2v-245.2h-244.8c-135.3.1-244.9 109.9-244.8 245.2zm652.7 0v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.2v-653.9c.2-135.3-109.4-245.1-244.7-245.3-135.4 0-244.9 109.8-244.8 245.1 0 0 0 .1 0 0"
+ fill="currentColor"></path>
+ </g>
+ </svg>
+ {t("join_our_slack")}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuItem>
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href="https://cal.com/roadmap"
+ className="flex items-center px-4 py-2 text-sm text-gray-700">
+ <MapIcon className="h-5 w-5 text-gray-500 ltr:mr-3 rtl:ml-3" /> {t("visit_roadmap")}
+ </a>
+ </DropdownMenuItem>
+
+ <button
+ className="flex w-full px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-gray-100 hover:text-gray-900"
+ onClick={() => setHelpOpen(true)}>
+ <QuestionMarkCircleIcon
+ className={classNames(
+ "text-gray-500 group-hover:text-neutral-500",
+ "h-5 w-5 flex-shrink-0 ltr:mr-3"
+ )}
+ aria-hidden="true"
+ />
+
+ {t("help")}
+ </button>
+
+ <DropdownMenuSeparator className="h-px bg-gray-200" />
+ <DropdownMenuItem>
+ <a
+ onClick={() => signOut({ callbackUrl: "/auth/logout" })}
+ className="flex cursor-pointer px-4 py-2 text-sm hover:bg-gray-100 hover:text-gray-900">
+ <LogoutIcon
+ className={classNames(
+ "text-gray-500 group-hover:text-gray-700",
+ "h-5 w-5 flex-shrink-0 ltr:mr-3 rtl:ml-3"
+ )}
+ aria-hidden="true"
+ />
+ {t("sign_out")}
+ </a>
+ </DropdownMenuItem>
+ </>
)}
- <DropdownMenuSeparator className="h-px bg-gray-200" />
- <DropdownMenuItem>
- <a
- href="https://cal.com/slack"
- target="_blank"
- rel="noreferrer"
- className="flex px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900">
- <svg
- viewBox="0 0 2447.6 2452.5"
- className={classNames(
- "text-gray-500 group-hover:text-gray-700",
- "mt-0.5 h-4 w-4 flex-shrink-0 ltr:mr-4 rtl:ml-4"
- )}
- xmlns="http://www.w3.org/2000/svg">
- <g clipRule="evenodd" fillRule="evenodd">
- <path
- d="m897.4 0c-135.3.1-244.8 109.9-244.7 245.2-.1 135.3 109.5 245.1 244.8 245.2h244.8v-245.1c.1-135.3-109.5-245.1-244.9-245.3.1 0 .1 0 0 0m0 654h-652.6c-135.3.1-244.9 109.9-244.8 245.2-.2 135.3 109.4 245.1 244.7 245.3h652.7c135.3-.1 244.9-109.9 244.8-245.2.1-135.4-109.5-245.2-244.8-245.3z"
- fill="currentColor"></path>
- <path
- d="m2447.6 899.2c.1-135.3-109.5-245.1-244.8-245.2-135.3.1-244.9 109.9-244.8 245.2v245.3h244.8c135.3-.1 244.9-109.9 244.8-245.3zm-652.7 0v-654c.1-135.2-109.4-245-244.7-245.2-135.3.1-244.9 109.9-244.8 245.2v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.3z"
- fill="currentColor"></path>
- <path
- d="m1550.1 2452.5c135.3-.1 244.9-109.9 244.8-245.2.1-135.3-109.5-245.1-244.8-245.2h-244.8v245.2c-.1 135.2 109.5 245 244.8 245.2zm0-654.1h652.7c135.3-.1 244.9-109.9 244.8-245.2.2-135.3-109.4-245.1-244.7-245.3h-652.7c-135.3.1-244.9 109.9-244.8 245.2-.1 135.4 109.4 245.2 244.7 245.3z"
- fill="currentColor"></path>
- <path
- d="m0 1553.2c-.1 135.3 109.5 245.1 244.8 245.2 135.3-.1 244.9-109.9 244.8-245.2v-245.2h-244.8c-135.3.1-244.9 109.9-244.8 245.2zm652.7 0v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.2v-653.9c.2-135.3-109.4-245.1-244.7-245.3-135.4 0-244.9 109.8-244.8 245.1 0 0 0 .1 0 0"
- fill="currentColor"></path>
- </g>
- </svg>
- {t("join_our_slack")}
- </a>
- </DropdownMenuItem>
- <DropdownMenuItem>
- <a
- target="_blank"
- rel="noopener noreferrer"
- href="https://cal.com/roadmap"
- className="flex items-center px-4 py-2 text-sm text-gray-700">
- <MapIcon className="h-5 w-5 text-gray-500 ltr:mr-3 rtl:ml-3" /> {t("visit_roadmap")}
- </a>
- </DropdownMenuItem>
-
- <HelpMenuItem />
-
- <DropdownMenuSeparator className="h-px bg-gray-200" />
- <DropdownMenuItem>
- <a
- onClick={() => signOut({ callbackUrl: "/auth/logout" })}
- className="flex cursor-pointer px-4 py-2 text-sm hover:bg-gray-100 hover:text-gray-900">
- <LogoutIcon
- className={classNames(
- "text-gray-500 group-hover:text-gray-700",
- "h-5 w-5 flex-shrink-0 ltr:mr-3 rtl:ml-3"
- )}
- aria-hidden="true"
- />
- {t("sign_out")}
- </a>
- </DropdownMenuItem>
</DropdownMenuContent>
</Dropdown>
);
diff --git a/apps/web/components/availability/NewScheduleButton.tsx b/apps/web/components/availability/NewScheduleButton.tsx
index 6960d2ebbc8..d39ae7294e9 100644
--- a/apps/web/components/availability/NewScheduleButton.tsx
+++ b/apps/web/components/availability/NewScheduleButton.tsx
@@ -46,20 +46,17 @@ export function NewScheduleButton({ name = "new-schedule" }: { name?: string })
</Button>
</DialogTrigger>
<DialogContent>
- <div className="mb-4">
+ <div className="mb-8">
<h3 className="text-lg font-bold leading-6 text-gray-900" id="modal-title">
{t("add_new_schedule")}
</h3>
- <div>
- <p className="text-sm text-gray-500">{t("new_event_type_to_book_description")}</p>
- </div>
</div>
<Form
form={form}
handleSubmit={(values) => {
createMutation.mutate(values);
}}>
- <div className="mt-3 space-y-4">
+ <div className="mt-3 space-y-2">
<label htmlFor="label" className="block text-sm font-medium text-gray-700">
{t("name")}
</label>
diff --git a/apps/web/components/booking/AvailableTimes.tsx b/apps/web/components/booking/AvailableTimes.tsx
index a6c89b335cc..855e49a038d 100644
--- a/apps/web/components/booking/AvailableTimes.tsx
+++ b/apps/web/components/booking/AvailableTimes.tsx
@@ -29,6 +29,7 @@ type AvailableTimesProps = {
username: string | null;
}[];
schedulingType: SchedulingType | null;
+ seatsPerTimeSlot?: number | null;
};
const AvailableTimes: FC<AvailableTimesProps> = ({
@@ -44,6 +45,7 @@ const AvailableTimes: FC<AvailableTimesProps> = ({
schedulingType,
beforeBufferTime,
afterBufferTime,
+ seatsPerTimeSlot,
}) => {
const { t, i18n } = useLocale();
const router = useRouter();
@@ -105,18 +107,48 @@ const AvailableTimes: FC<AvailableTimesProps> = ({
bookingUrl.query.user = slot.users;
}
+ // If event already has an attendee add booking id
+ if (slot.bookingUid) {
+ bookingUrl.query.bookingUid = slot.bookingUid;
+ }
+
return (
<div key={slot.time.format()}>
- <Link href={bookingUrl}>
- <a
+ {/* Current there is no way to disable Next.js Links */}
+ {seatsPerTimeSlot && slot.attendees && slot.attendees >= seatsPerTimeSlot ? (
+ <div
className={classNames(
- "text-bookingdarker hover:bg-brand hover:text-brandcontrast dark:hover:bg-darkmodebrand dark:hover:text-darkmodebrandcontrast mb-2 block rounded-sm border bg-white py-4 font-medium hover:text-white dark:border-transparent dark:bg-gray-600 dark:text-neutral-200 dark:hover:border-black",
+ "text-primary-500 mb-2 block rounded-sm border bg-white py-4 font-medium opacity-25 dark:border-transparent dark:bg-gray-600 dark:text-neutral-200 ",
brand === "#fff" || brand === "#ffffff" ? "border-brandcontrast" : "border-brand"
- )}
- data-testid="time">
- {dayjs.tz(slot.time, timeZone()).format(timeFormat)}
- </a>
- </Link>
+ )}>
+ {slot.time.format(timeFormat)}
+ {seatsPerTimeSlot && <p className={`text-sm`}>{t("booking_full")}</p>}
+ </div>
+ ) : (
+ <Link href={bookingUrl}>
+ <a
+ className={classNames(
+ "text-primary-500 hover:bg-brand hover:text-brandcontrast dark:hover:bg-darkmodebrand dark:hover:text-darkmodebrandcontrast mb-2 block rounded-sm border bg-white py-4 font-medium hover:text-white dark:border-transparent dark:bg-gray-600 dark:text-neutral-200 dark:hover:border-black",
+ brand === "#fff" || brand === "#ffffff" ? "border-brandcontrast" : "border-brand"
+ )}
+ data-testid="time">
+ {dayjs.tz(slot.time, timeZone()).format(timeFormat)}
+ {seatsPerTimeSlot && (
+ <p
+ className={`${
+ slot.attendees && slot.attendees / seatsPerTimeSlot >= 0.8
+ ? "text-rose-600"
+ : slot.attendees && slot.attendees / seatsPerTimeSlot >= 0.33
+ ? "text-yellow-500"
+ : "text-emerald-400"
+ } text-sm`}>
+ {slot.attendees ? seatsPerTimeSlot - slot.attendees : seatsPerTimeSlot} /{" "}
+ {seatsPerTimeSlot} {t("seats_available")}
+ </p>
+ )}
+ </a>
+ </Link>
+ )}
</div>
);
})}
diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx
index 28e97d498a5..194d39ceee6 100644
--- a/apps/web/components/booking/BookingListItem.tsx
+++ b/apps/web/components/booking/BookingListItem.tsx
@@ -2,6 +2,7 @@ import {
BanIcon,
CheckIcon,
ClockIcon,
+ LocationMarkerIcon,
PaperAirplaneIcon,
PencilAltIcon,
XIcon,
@@ -16,6 +17,7 @@ import { Frequency as RRuleFrequency } from "rrule";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import showToast from "@calcom/lib/notification";
import Button from "@calcom/ui/Button";
import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog";
import { Tooltip } from "@calcom/ui/Tooltip";
@@ -23,9 +25,11 @@ import { TextArea } from "@calcom/ui/form/fields";
import { HttpError } from "@lib/core/http/error";
import useMeQuery from "@lib/hooks/useMeQuery";
+import { LocationType } from "@lib/location";
import { parseRecurringDates } from "@lib/parseDate";
import { inferQueryInput, inferQueryOutput, trpc } from "@lib/trpc";
+import { EditLocationDialog } from "@components/dialog/EditLocationDialog";
import { RescheduleDialog } from "@components/dialog/RescheduleDialog";
import TableActions, { ActionType } from "@components/ui/TableActions";
@@ -72,6 +76,7 @@ function BookingListItem(booking: BookingItemProps) {
if (!res.ok) {
throw new HttpError({ statusCode: res.status });
}
+ setRejectionDialogIsOpen(false);
},
{
async onSettled() {
@@ -89,8 +94,7 @@ function BookingListItem(booking: BookingItemProps) {
booking.listingStatus === "upcoming" && booking.recurringEventId !== null
? t("reject_all")
: t("reject"),
- onClick: (e) => {
- e.stopPropagation();
+ onClick: () => {
setRejectionDialogIsOpen(true);
},
icon: BanIcon,
@@ -102,8 +106,7 @@ function BookingListItem(booking: BookingItemProps) {
booking.listingStatus === "upcoming" && booking.recurringEventId !== null
? t("confirm_all")
: t("confirm"),
- onClick: (e) => {
- e.stopPropagation();
+ onClick: () => {
mutation.mutate(true);
},
icon: CheckIcon,
@@ -120,25 +123,33 @@ function BookingListItem(booking: BookingItemProps) {
icon: XIcon,
},
{
- id: "reschedule",
- label: t("reschedule"),
- icon: ClockIcon,
+ id: "edit_booking",
+ label: t("edit_booking"),
+ icon: PencilAltIcon,
actions: [
{
- id: "edit",
- icon: PencilAltIcon,
- label: t("edit_booking"),
+ id: "reschedule",
+ icon: ClockIcon,
+ label: t("reschedule_booking"),
href: `/reschedule/${booking.uid}`,
},
{
id: "reschedule_request",
- icon: ClockIcon,
+ icon: PaperAirplaneIcon,
+ iconClassName: "rotate-45 w-[18px] -ml-[2px]",
label: t("send_reschedule_request"),
- onClick: (e) => {
- e.stopPropagation();
+ onClick: () => {
setIsOpenRescheduleDialog(true);
},
},
+ {
+ id: "change_location",
+ label: t("edit_location"),
+ onClick: () => {
+ setIsOpenLocationDialog(true);
+ },
+ icon: LocationMarkerIcon,
+ },
],
},
];
@@ -154,6 +165,26 @@ function BookingListItem(booking: BookingItemProps) {
const startTime = dayjs(booking.startTime).format(isUpcoming ? "ddd, D MMM" : "D MMMM YYYY");
const [isOpenRescheduleDialog, setIsOpenRescheduleDialog] = useState(false);
+ const [isOpenSetLocationDialog, setIsOpenLocationDialog] = useState(false);
+ const setLocationMutation = trpc.useMutation("viewer.bookings.editLocation", {
+ onSuccess: () => {
+ showToast(t("location_updated"), "success");
+ setIsOpenLocationDialog(false);
+ utils.invalidateQueries("viewer.bookings");
+ },
+ });
+
+ const saveLocation = (newLocationType: LocationType, details: { [key: string]: string }) => {
+ let newLocation = newLocationType as string;
+ if (
+ newLocationType === LocationType.InPerson ||
+ newLocationType === LocationType.Link ||
+ newLocationType === LocationType.UserPhone
+ ) {
+ newLocation = details[Object.keys(details)[0]];
+ }
+ setLocationMutation.mutate({ bookingId: booking.id, newLocation });
+ };
// Calculate the booking date(s)
let recurringStrings: string[] = [];
@@ -168,6 +199,30 @@ function BookingListItem(booking: BookingItemProps) {
);
}
+ const onClick = () => {
+ router.push({
+ pathname: "/success",
+ query: {
+ date: booking.startTime,
+ type: booking.eventType.id,
+ eventSlug: booking.eventType.slug,
+ user: user?.username || "",
+ name: booking.attendees[0] ? booking.attendees[0].name : undefined,
+ email: booking.attendees[0] ? booking.attendees[0].email : undefined,
+ location: booking.location
+ ? booking.location.includes("integration")
+ ? (t("web_conferencing_details_to_follow") as string)
+ : booking.location
+ : "",
+ eventName: booking.eventType.eventName || "",
+ bookingId: booking.id,
+ recur: booking.recurringEventId,
+ reschedule: booking.confirmed,
+ listingStatus: booking.listingStatus,
+ status: booking.status,
+ },
+ });
+ };
return (
<>
<RescheduleDialog
@@ -175,6 +230,12 @@ function BookingListItem(booking: BookingItemProps) {
setIsOpenDialog={setIsOpenRescheduleDialog}
bookingUId={booking.uid}
/>
+ <EditLocationDialog
+ booking={booking}
+ saveLocation={saveLocation}
+ isOpenDialog={isOpenSetLocationDialog}
+ setShowLocationModal={setIsOpenLocationDialog}
+ />
{/* NOTE: Should refactor this dialog component as is being rendered multiple times */}
<Dialog open={rejectionDialogIsOpen} onOpenChange={setRejectionDialogIsOpen}>
@@ -209,114 +270,103 @@ function BookingListItem(booking: BookingItemProps) {
</DialogContent>
</Dialog>
- <tr
- className="flex cursor-pointer hover:bg-neutral-50"
- onClick={() =>
- router.push({
- pathname: "/success",
- query: {
- date: booking.startTime,
- type: booking.eventType.id,
- eventSlug: booking.eventType.slug,
- user: user?.username || "",
- name: booking.attendees[0].name,
- email: booking.attendees[0].email,
- location: booking.location
- ? booking.location.includes("integration")
- ? (t("web_conferencing_details_to_follow") as string)
- : booking.location
- : "",
- eventName: booking.eventType.eventName || "",
- bookingId: booking.id,
- recur: booking.recurringEventId,
- reschedule: booking.confirmed,
- },
- })
- }>
- <td className="hidden whitespace-nowrap py-4 align-top ltr:pl-6 rtl:pr-6 sm:table-cell sm:w-56">
- <div className="text-sm leading-6 text-gray-900">{startTime}</div>
- <div className="text-sm text-gray-500">
- {dayjs(booking.startTime).format(user && user.timeFormat === 12 ? "h:mma" : "HH:mm")} -{" "}
- {dayjs(booking.endTime).format(user && user.timeFormat === 12 ? "h:mma" : "HH:mm")}
- </div>
- <div className="text-sm text-gray-400">
- {booking.recurringCount &&
- booking.eventType?.recurringEvent?.freq &&
- booking.listingStatus === "upcoming" && (
- <div className="underline decoration-gray-400 decoration-dashed underline-offset-2">
- <div className="flex">
- <Tooltip
- content={recurringStrings.map((aDate, key) => (
- <p key={key}>{aDate}</p>
- ))}>
- <p className="text-gray-600 dark:text-white">
- <RefreshIcon className="mr-1 -mt-1 inline-block h-4 w-4 text-gray-400" />
- {`${t("every_for_freq", {
- freq: t(
+ <tr className="flex hover:bg-neutral-50">
+ <td
+ className="hidden whitespace-nowrap align-top ltr:pl-6 rtl:pr-6 sm:table-cell sm:w-56"
+ onClick={onClick}>
+ <div className="cursor-pointer py-4">
+ <div className="text-sm leading-6 text-gray-900">{startTime}</div>
+ <div className="text-sm text-gray-500">
+ {dayjs(booking.startTime).format(user && user.timeFormat === 12 ? "h:mma" : "HH:mm")} -{" "}
+ {dayjs(booking.endTime).format(user && user.timeFormat === 12 ? "h:mma" : "HH:mm")}
+ </div>
+ <div className="text-sm text-gray-400">
+ {booking.recurringCount &&
+ booking.eventType?.recurringEvent?.freq &&
+ booking.listingStatus === "upcoming" && (
+ <div className="underline decoration-gray-400 decoration-dashed underline-offset-2">
+ <div className="flex">
+ <Tooltip
+ content={recurringStrings.map((aDate, key) => (
+ <p key={key}>{aDate}</p>
+ ))}>
+ <p className="text-gray-600 dark:text-white">
+ <RefreshIcon className="mr-1 -mt-1 inline-block h-4 w-4 text-gray-400" />
+ {`${t("every_for_freq", {
+ freq: t(
+ `${RRuleFrequency[booking.eventType.recurringEvent.freq]
+ .toString()
+ .toLowerCase()}`
+ ),
+ })} ${booking.recurringCount} ${t(
`${RRuleFrequency[booking.eventType.recurringEvent.freq]
.toString()
- .toLowerCase()}`
- ),
- })} ${booking.recurringCount} ${t(
- `${RRuleFrequency[booking.eventType.recurringEvent.freq].toString().toLowerCase()}`,
- { count: booking.recurringCount }
- )}`}
- </p>
- </Tooltip>
+ .toLowerCase()}`,
+ { count: booking.recurringCount }
+ )}`}
+ </p>
+ </Tooltip>
+ </div>
</div>
- </div>
- )}
+ )}
+ </div>
</div>
</td>
- <td className={"flex-1 py-4 ltr:pl-4 rtl:pr-4" + (booking.rejected ? " line-through" : "")}>
- <div className="sm:hidden">
- {!booking.confirmed && !booking.rejected && (
- <Tag className="mb-2 ltr:mr-2 rtl:ml-2">{t("unconfirmed")}</Tag>
- )}
- {!!booking?.eventType?.price && !booking.paid && (
- <Tag className="mb-2 ltr:mr-2 rtl:ml-2">Pending payment</Tag>
- )}
- <div className="text-sm font-medium text-gray-900">
- {startTime}:{" "}
- <small className="text-sm text-gray-500">
- {dayjs(booking.startTime).format("HH:mm")} - {dayjs(booking.endTime).format("HH:mm")}
- </small>
+ <td
+ className={"flex-1 ltr:pl-4 rtl:pr-4" + (booking.rejected ? " line-through" : "")}
+ onClick={onClick}>
+ <div className="cursor-pointer py-4">
+ <div className="sm:hidden">
+ {!booking.confirmed && !booking.rejected && (
+ <Tag className="mb-2 ltr:mr-2 rtl:ml-2">{t("unconfirmed")}</Tag>
+ )}
+ {!!booking?.eventType?.price && !booking.paid && (
+ <Tag className="mb-2 ltr:mr-2 rtl:ml-2">Pending payment</Tag>
+ )}
+ <div className="text-sm font-medium text-gray-900">
+ {startTime}:{" "}
+ <small className="text-sm text-gray-500">
+ {dayjs(booking.startTime).format("HH:mm")} - {dayjs(booking.endTime).format("HH:mm")}
+ </small>
+ </div>
</div>
- </div>
- <div
- title={booking.title}
- className={classNames(
- "max-w-56 truncate text-sm font-medium leading-6 text-neutral-900 md:max-w-max",
- isCancelled ? "line-through" : ""
- )}>
- {booking.eventType?.team && <strong>{booking.eventType.team.name}: </strong>}
- {booking.title}
- {!!booking?.eventType?.price && !booking.paid && (
- <Tag className="hidden ltr:ml-2 rtl:mr-2 sm:inline-flex">Pending payment</Tag>
+ <div
+ title={booking.title}
+ className={classNames(
+ "max-w-56 truncate text-sm font-medium leading-6 text-neutral-900 md:max-w-max",
+ isCancelled ? "line-through" : ""
+ )}>
+ {booking.eventType?.team && <strong>{booking.eventType.team.name}: </strong>}
+ {booking.title}
+ {!!booking?.eventType?.price && !booking.paid && (
+ <Tag className="hidden ltr:ml-2 rtl:mr-2 sm:inline-flex">Pending payment</Tag>
+ )}
+ {!booking.confirmed && !booking.rejected && (
+ <Tag className="hidden ltr:ml-2 rtl:mr-2 sm:inline-flex">{t("unconfirmed")}</Tag>
+ )}
+ </div>
+ {booking.description && (
+ <div
+ className="max-w-52 md:max-w-96 truncate text-sm text-gray-500"
+ title={booking.description}>
+ &quot;{booking.description}&quot;
+ </div>
+ )}
+
+ {booking.attendees.length !== 0 && (
+ <a
+ className="text-sm text-gray-900 hover:text-blue-500"
+ href={"mailto:" + booking.attendees[0].email}
+ onClick={(e) => e.stopPropagation()}>
+ {booking.attendees[0].email}
+ </a>
)}
- {!booking.confirmed && !booking.rejected && (
- <Tag className="hidden ltr:ml-2 rtl:mr-2 sm:inline-flex">{t("unconfirmed")}</Tag>
+ {isCancelled && booking.rescheduled && (
+ <div className="mt-2 inline-block text-left text-sm md:hidden">
+ <RequestSentMessage />
+ </div>
)}
</div>
- {booking.description && (
- <div className="max-w-52 md:max-w-96 truncate text-sm text-gray-500" title={booking.description}>
- &quot;{booking.description}&quot;
- </div>
- )}
-
- {booking.attendees.length !== 0 && (
- <a
- className="text-sm text-gray-900 hover:text-blue-500"
- href={"mailto:" + booking.attendees[0].email}
- onClick={(e) => e.stopPropagation()}>
- {booking.attendees[0].email}
- </a>
- )}
- {isCancelled && booking.rescheduled && (
- <div className="mt-2 inline-block text-left text-sm md:hidden">
- <RequestSentMessage />
- </div>
- )}
</td>
<td className="whitespace-nowrap py-4 text-right text-sm font-medium ltr:pr-4 rtl:pl-4">
diff --git a/apps/web/components/booking/DatePicker.tsx b/apps/web/components/booking/DatePicker.tsx
index 74aceb83eda..8a3398a9df2 100644
--- a/apps/web/components/booking/DatePicker.tsx
+++ b/apps/web/components/booking/DatePicker.tsx
@@ -7,7 +7,7 @@ import utc from "dayjs/plugin/utc";
import { memoize } from "lodash";
import { useEffect, useRef, useState } from "react";
-import { useEmbedStyles } from "@calcom/embed-core";
+import { useEmbedStyles } from "@calcom/embed-core/embed-iframe";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import classNames from "@lib/classNames";
diff --git a/apps/web/components/booking/pages/AvailabilityPage.tsx b/apps/web/components/booking/pages/AvailabilityPage.tsx
index ecca5bdeb27..84eca3e9a22 100644
--- a/apps/web/components/booking/pages/AvailabilityPage.tsx
+++ b/apps/web/components/booking/pages/AvailabilityPage.tsx
@@ -8,27 +8,31 @@ import {
CreditCardIcon,
GlobeIcon,
InformationCircleIcon,
+ LocationMarkerIcon,
RefreshIcon,
+ VideoCameraIcon,
} from "@heroicons/react/solid";
import * as Collapsible from "@radix-ui/react-collapsible";
import { useContracts } from "contexts/contractsContext";
import dayjs, { Dayjs } from "dayjs";
import customParseFormat from "dayjs/plugin/customParseFormat";
import utc from "dayjs/plugin/utc";
+import { TFunction } from "next-i18next";
import { useRouter } from "next/router";
import { useCallback, useEffect, useMemo, useState } from "react";
import { FormattedNumber, IntlProvider } from "react-intl";
import { Frequency as RRuleFrequency } from "rrule";
+import { AppStoreLocationType, LocationObject, LocationType } from "@calcom/app-store/locations";
import {
useEmbedStyles,
useIsEmbed,
useIsBackgroundTransparent,
sdkActionManager,
useEmbedNonStylesConfig,
-} from "@calcom/embed-core";
+} from "@calcom/embed-core/embed-iframe";
import classNames from "@calcom/lib/classNames";
-import { WEBAPP_URL } from "@calcom/lib/constants";
+import { CAL_URL, WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { localStorage } from "@calcom/lib/webstorage";
@@ -57,6 +61,35 @@ dayjs.extend(customParseFormat);
type Props = AvailabilityTeamPageProps | AvailabilityPageProps;
+export const locationKeyToString = (location: LocationObject, t: TFunction) => {
+ switch (location.type) {
+ case LocationType.InPerson:
+ return location.address || "In Person"; // If disabled address won't exist on the object
+ case LocationType.Link:
+ return location.link || "Link"; // If disabled link won't exist on the object
+ case LocationType.Phone:
+ return t("your_number");
+ case LocationType.UserPhone:
+ return t("phone_call");
+ case LocationType.GoogleMeet:
+ return "Google Meet";
+ case LocationType.Zoom:
+ return "Zoom";
+ case LocationType.Daily:
+ return "Cal Video";
+ case LocationType.Jitsi:
+ return "Jitsi";
+ case LocationType.Huddle01:
+ return "Huddle Video";
+ case LocationType.Tandem:
+ return "Tandem";
+ case LocationType.Teams:
+ return "Microsoft Teams";
+ default:
+ return null;
+ }
+};
+
const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage, booking }: Props) => {
const router = useRouter();
const isEmbed = useIsEmbed();
@@ -203,7 +236,7 @@ const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage
.filter((user) => user.name !== profile.name)
.map((user) => ({
title: user.name,
- image: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}/avatar.png`,
+ image: `${CAL_URL}/${user.username}/avatar.png`,
alt: user.name || undefined,
})),
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
@@ -225,6 +258,25 @@ const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage
{eventType.description}
</p>
)}
+ {eventType.locations.length === 1 && (
+ <p className="text-bookinglight mb-2 dark:text-white">
+ <LocationMarkerIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
+ {locationKeyToString(eventType.locations[0], t)}
+ </p>
+ )}
+ {eventType.locations.length === 1 && (
+ <p className="text-bookinglight mb-2 dark:text-white">
+ {Object.values(AppStoreLocationType).includes(
+ eventType.locations[0].type as unknown as AppStoreLocationType
+ ) ? (
+ <VideoCameraIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
+ ) : (
+ <LocationMarkerIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
+ )}
+
+ {locationKeyToString(eventType.locations[0], t)}
+ </p>
+ )}
<p className="text-bookinglight mb-2 dark:text-white">
<ClockIcon className="mr-[10px] -mt-1 ml-[2px] inline-block h-4 w-4" />
{eventType.length} {t("minutes")}
@@ -278,7 +330,7 @@ const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage
.map((user) => ({
title: user.name,
alt: user.name,
- image: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}/avatar.png`,
+ image: `${CAL_URL}/${user.username}/avatar.png`,
})),
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
}
@@ -297,6 +349,38 @@ const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage
{eventType.description}
</p>
)}
+ {eventType.locations.length === 1 && (
+ <p className="text-bookinglight mb-2 dark:text-white">
+ {Object.values(AppStoreLocationType).includes(
+ eventType.locations[0].type as unknown as AppStoreLocationType
+ ) ? (
+ <VideoCameraIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
+ ) : (
+ <LocationMarkerIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
+ )}
+
+ {locationKeyToString(eventType.locations[0], t)}
+ </p>
+ )}
+ {eventType.locations.length > 1 && (
+ <div className="text-bookinglight flex-warp mb-2 flex dark:text-white">
+ <div className="mr-[10px] ml-[2px] -mt-1 ">
+ <LocationMarkerIcon className="inline-block h-4 w-4 text-gray-400" />
+ </div>
+ <p>
+ {eventType.locations.map((el, i, arr) => {
+ return (
+ <span key={el.type}>
+ {locationKeyToString(el, t)}{" "}
+ {arr.length - 1 !== i && (
+ <span className="font-light"> {t("or_lowercase")} </span>
+ )}
+ </span>
+ );
+ })}
+ </p>
+ </div>
+ )}
<p className="text-bookinglight mb-3 dark:text-white">
<ClockIcon className="mr-[10px] -mt-1 ml-[2px] inline-block h-4 w-4 text-gray-400" />
{eventType.length} {t("minutes")}
@@ -340,12 +424,11 @@ const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage
</IntlProvider>
</p>
)}
-
<TimezoneDropdown />
{previousPage === `${WEBAPP_URL}/${profile.slug}` && (
<div className="flex h-full flex-col justify-end">
<ArrowLeftIcon
- className="h-4 w-4 text-black transition-opacity hover:cursor-pointer dark:text-white"
+ className="h-4 w-4 text-black transition-opacity hover:cursor-pointer dark:text-white"
onClick={() => router.back()}
/>
<p className="sr-only">Go Back</p>
@@ -398,6 +481,7 @@ const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage
schedulingType={eventType.schedulingType ?? null}
beforeBufferTime={eventType.beforeEventBuffer}
afterBufferTime={eventType.afterEventBuffer}
+ seatsPerTimeSlot={eventType.seatsPerTimeSlot}
/>
)}
</div>
diff --git a/apps/web/components/booking/pages/BookingPage.tsx b/apps/web/components/booking/pages/BookingPage.tsx
index 1b1ab61d87d..458561742c8 100644
--- a/apps/web/components/booking/pages/BookingPage.tsx
+++ b/apps/web/components/booking/pages/BookingPage.tsx
@@ -24,7 +24,11 @@ import { Frequency as RRuleFrequency } from "rrule";
import { v4 as uuidv4 } from "uuid";
import { z } from "zod";
-import { useEmbedNonStylesConfig, useIsBackgroundTransparent, useIsEmbed } from "@calcom/embed-core";
+import {
+ useEmbedNonStylesConfig,
+ useIsBackgroundTransparent,
+ useIsEmbed,
+} from "@calcom/embed-core/embed-iframe";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { HttpError } from "@calcom/lib/http-error";
@@ -37,7 +41,7 @@ import { asStringOrNull } from "@lib/asStringOrNull";
import { timeZone } from "@lib/clock";
import { ensureArray } from "@lib/ensureArray";
import useTheme from "@lib/hooks/useTheme";
-import { LocationType } from "@lib/location";
+import { LocationObject, LocationType } from "@lib/location";
import createBooking from "@lib/mutations/bookings/create-booking";
import createRecurringBooking from "@lib/mutations/bookings/create-recurring-booking";
import { parseDate, parseRecurringDates } from "@lib/parseDate";
@@ -79,6 +83,7 @@ type BookingFormValues = {
customInputs?: {
[key: string]: string | boolean;
};
+ rescheduleReason?: string;
};
const BookingPage = ({
@@ -203,10 +208,9 @@ const BookingPage = ({
const eventTypeDetail = { isWeb3Active: false, ...eventType };
- type Location = { type: LocationType; address?: string; link?: string; hostPhoneNumber?: string };
// it would be nice if Prisma at some point in the future allowed for Json<Location>; as of now this is not the case.
- const locations: Location[] = useMemo(
- () => (eventType.locations as Location[]) || [],
+ const locations: LocationObject[] = useMemo(
+ () => (eventType.locations as LocationObject[]) || [],
[eventType.locations]
);
@@ -252,6 +256,7 @@ const BookingPage = ({
email: primaryAttendee.email || "",
guests: guestListEmails,
notes: booking.description || "",
+ rescheduleReason: "",
customInputs: eventType.customInputs.reduce(
(customInputs, input) => ({
...customInputs,
@@ -396,6 +401,7 @@ const BookingPage = ({
timeZone: timeZone(),
language: i18n.language,
rescheduleUid,
+ bookingUid: router.query.bookingUid as string,
user: router.query.user,
location: getLocationValue(
booking.locationType ? booking : { ...booking, locationType: selectedLocation }
@@ -469,6 +475,21 @@ const BookingPage = ({
<h1 className="text-bookingdark mb-4 text-xl font-semibold dark:text-white">
{eventType.title}
</h1>
+ {eventType.seatsPerTimeSlot && (
+ <p
+ className={`${
+ booking && booking.attendees.length / eventType.seatsPerTimeSlot >= 0.5
+ ? "text-rose-600"
+ : booking && booking.attendees.length / eventType.seatsPerTimeSlot >= 0.33
+ ? "text-yellow-500"
+ : "text-emerald-400"
+ } mb-2`}>
+ {booking
+ ? eventType.seatsPerTimeSlot - booking.attendees.length
+ : eventType.seatsPerTimeSlot}{" "}
+ / {eventType.seatsPerTimeSlot} {t("seats_available")}
+ </p>
+ )}
{eventType?.description && (
<p className="text-bookinglight mb-2 dark:text-white">
<InformationCircleIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
@@ -767,18 +788,31 @@ const BookingPage = ({
<label
htmlFor="notes"
className="mb-1 block text-sm font-medium text-gray-700 dark:text-white">
- {t("additional_notes")}
+ {rescheduleUid ? t("reschedule_optional") : t("additional_notes")}
</label>
- <textarea
- {...bookingForm.register("notes")}
- id="notes"
- name="notes"
- rows={3}
- className={inputClassName}
- placeholder={t("share_additional_notes")}
- disabled={disabledExceptForOwner}
- />
+ {rescheduleUid ? (
+ <textarea
+ {...bookingForm.register("rescheduleReason")}
+ id="rescheduleReason"
+ name="rescheduleReason"
+ rows={3}
+ className={inputClassName}
+ placeholder={t("reschedule_placeholder")}
+ disabled={disabledExceptForOwner}
+ />
+ ) : (
+ <textarea
+ {...bookingForm.register("notes")}
+ id="notes"
+ name="notes"
+ rows={3}
+ className={inputClassName}
+ placeholder={t("share_additional_notes")}
+ disabled={disabledExceptForOwner}
+ />
+ )}
</div>
+
<div className="flex items-start space-x-2 rtl:space-x-reverse">
<Button
type="submit"
diff --git a/apps/web/components/dialog/EditLocationDialog.tsx b/apps/web/components/dialog/EditLocationDialog.tsx
new file mode 100644
index 00000000000..ad90c68b16a
--- /dev/null
+++ b/apps/web/components/dialog/EditLocationDialog.tsx
@@ -0,0 +1,336 @@
+import { LocationMarkerIcon } from "@heroicons/react/solid";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { isValidPhoneNumber } from "libphonenumber-js";
+import dynamic from "next/dynamic";
+import { useEffect } from "react";
+import { Controller, useForm, useWatch } from "react-hook-form";
+import { z } from "zod";
+
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { Button } from "@calcom/ui";
+import { Dialog, DialogContent } from "@calcom/ui/Dialog";
+import { Form } from "@calcom/ui/form/fields";
+
+import { QueryCell } from "@lib/QueryCell";
+import { linkValueToString } from "@lib/linkValueToString";
+import { LocationType } from "@lib/location";
+import { LocationOptionsToString } from "@lib/locationOptions";
+import { inferQueryOutput, trpc } from "@lib/trpc";
+
+import CheckboxField from "@components/ui/form/CheckboxField";
+import type PhoneInputType from "@components/ui/form/PhoneInput";
+import Select from "@components/ui/form/Select";
+
+const PhoneInput = dynamic(
+ () => import("@components/ui/form/PhoneInput")
+) as unknown as typeof PhoneInputType;
+
+type BookingItem = inferQueryOutput<"viewer.bookings">["bookings"][number];
+
+type OptionTypeBase = {
+ label: string;
+ value: LocationType;
+ disabled?: boolean;
+};
+
+type LocationFormValues = {
+ locationType: LocationType;
+ locationAddress?: string;
+ locationLink?: string;
+ locationPhoneNumber?: string;
+ displayLocationPublicly?: boolean;
+};
+interface ISetLocationDialog {
+ saveLocation: (newLocationType: LocationType, details: { [key: string]: string }) => void;
+ selection?: OptionTypeBase;
+ booking?: BookingItem;
+ defaultValues?: {
+ type: LocationType;
+ address?: string | undefined;
+ link?: string | undefined;
+ hostPhoneNumber?: string | undefined;
+ displayLocationPublicly?: boolean | undefined;
+ }[];
+ setShowLocationModal: React.Dispatch<React.SetStateAction<boolean>>;
+ isOpenDialog: boolean;
+ setSelectedLocation?: (param: OptionTypeBase | undefined) => void;
+}
+
+export const EditLocationDialog = (props: ISetLocationDialog) => {
+ const {
+ saveLocation,
+ selection,
+ booking,
+ setShowLocationModal,
+ isOpenDialog,
+ defaultValues,
+ setSelectedLocation,
+ } = props;
+ const { t } = useLocale();
+ const locationsQuery = trpc.useQuery(["viewer.locationOptions"]);
+
+ useEffect(() => {
+ if (selection) {
+ locationFormMethods.setValue("locationType", selection?.value);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [selection]);
+
+ const locationFormSchema = z.object({
+ locationType: z.string(),
+ locationAddress: z.string().optional(),
+ locationLink: z.string().url().optional(),
+ displayLocationPublicly: z.boolean().optional(),
+ locationPhoneNumber: z
+ .string()
+ .refine((val) => isValidPhoneNumber(val))
+ .optional(),
+ });
+
+ const locationFormMethods = useForm<LocationFormValues>({
+ mode: "onSubmit",
+ resolver: zodResolver(locationFormSchema),
+ });
+
+ const selectedLocation = useWatch({
+ control: locationFormMethods.control,
+ name: "locationType",
+ });
+
+ const LocationOptions =
+ selectedLocation === LocationType.InPerson ? (
+ <>
+ <div>
+ <label htmlFor="address" className="block text-sm font-medium text-gray-700">
+ {t("set_address_place")}
+ </label>
+ <div className="mt-1">
+ <input
+ type="text"
+ {...locationFormMethods.register("locationAddress")}
+ id="address"
+ required
+ className="block w-full rounded-sm border-gray-300 text-sm"
+ defaultValue={
+ defaultValues
+ ? defaultValues.find(
+ (location: { type: LocationType }) => location.type === LocationType.InPerson
+ )?.address
+ : undefined
+ }
+ />
+ </div>
+ {!booking && (
+ <div className="mt-3">
+ <Controller
+ name="displayLocationPublicly"
+ control={locationFormMethods.control}
+ render={() => (
+ <CheckboxField
+ defaultChecked={
+ defaultValues
+ ? defaultValues.find((location) => location.type === LocationType.InPerson)
+ ?.displayLocationPublicly
+ : undefined
+ }
+ description={t("display_location_label")}
+ onChange={(e) =>
+ locationFormMethods.setValue("displayLocationPublicly", e.target.checked)
+ }
+ informationIconText={t("display_location_info_badge")}></CheckboxField>
+ )}
+ />
+ </div>
+ )}
+ </div>
+ </>
+ ) : selectedLocation === LocationType.Link ? (
+ <div>
+ <label htmlFor="link" className="block text-sm font-medium text-gray-700">
+ {t("set_link_meeting")}
+ </label>
+ <div className="mt-1">
+ <input
+ type="text"
+ {...locationFormMethods.register("locationLink")}
+ id="link"
+ required
+ className="block w-full rounded-sm border-gray-300 sm:text-sm"
+ defaultValue={
+ defaultValues
+ ? defaultValues.find(
+ (location: { type: LocationType }) => location.type === LocationType.Link
+ )?.link
+ : undefined
+ }
+ />
+ {locationFormMethods.formState.errors.locationLink && (
+ <p className="mt-1 text-sm text-red-500">{t("url_start_with_https")}</p>
+ )}
+ </div>
+ {!booking && (
+ <div className="mt-3">
+ <Controller
+ name="displayLocationPublicly"
+ control={locationFormMethods.control}
+ render={() => (
+ <CheckboxField
+ description={t("display_location_label")}
+ defaultChecked={
+ defaultValues
+ ? defaultValues.find((location) => location.type === LocationType.Link)
+ ?.displayLocationPublicly
+ : undefined
+ }
+ onChange={(e) => locationFormMethods.setValue("displayLocationPublicly", e.target.checked)}
+ informationIconText={t("display_location_info_badge")}></CheckboxField>
+ )}
+ />
+ </div>
+ )}
+ </div>
+ ) : selectedLocation === LocationType.UserPhone ? (
+ <div>
+ <label htmlFor="phonenumber" className="block text-sm font-medium text-gray-700">
+ {t("set_your_phone_number")}
+ {locationFormMethods.formState?.errors?.locationPhoneNumber?.message}
+ </label>
+ <div className="mt-1">
+ <PhoneInput<LocationFormValues>
+ control={locationFormMethods.control}
+ name="locationPhoneNumber"
+ required
+ id="locationPhoneNumber"
+ placeholder={t("host_phone_number")}
+ defaultValue={
+ defaultValues
+ ? defaultValues.find(
+ (location: { type: LocationType }) => location.type === LocationType.UserPhone
+ )?.hostPhoneNumber
+ : undefined
+ }
+ />
+ {locationFormMethods.formState.errors.locationPhoneNumber && (
+ <p className="mt-1 text-sm text-red-500">Invalid input</p>
+ )}
+ </div>
+ </div>
+ ) : (
+ <p className="text-sm">{LocationOptionsToString(selectedLocation, t)}</p>
+ );
+
+ return (
+ <Dialog open={isOpenDialog}>
+ <DialogContent asChild>
+ <div className="inline-block transform rounded-sm bg-white px-4 pt-5 pb-4 text-left align-bottom shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6 sm:align-middle">
+ <div className="mb-4 sm:flex sm:items-start">
+ <div className="bg-secondary-100 mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full sm:mx-0 sm:h-10 sm:w-10">
+ <LocationMarkerIcon className="text-primary-600 h-6 w-6" />
+ </div>
+ <div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
+ <h3 className="text-lg font-medium leading-6 text-gray-900" id="modal-title">
+ {t("edit_location")}
+ </h3>
+ {!booking && (
+ <p className="text-sm text-gray-400">{t("this_input_will_shown_booking_this_event")}</p>
+ )}
+ </div>
+ <div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"></div>
+ </div>
+ {booking && (
+ <>
+ <p className="mt-6 mb-2 ml-1 text-sm font-bold text-black">{t("current_location")}:</p>
+ <p className="mb-2 ml-1 text-sm text-black">{linkValueToString(booking.location, t)}</p>
+ </>
+ )}
+ <Form
+ form={locationFormMethods}
+ handleSubmit={async (values) => {
+ const { locationType: newLocation, displayLocationPublicly } = values;
+
+ let details = {};
+ if (newLocation === LocationType.InPerson) {
+ details = {
+ address: values.locationAddress,
+ displayLocationPublicly,
+ };
+ }
+ if (newLocation === LocationType.Link) {
+ details = { link: values.locationLink, displayLocationPublicly };
+ }
+ if (newLocation === LocationType.UserPhone) {
+ details = { hostPhoneNumber: values.locationPhoneNumber };
+ }
+
+ saveLocation(newLocation, details);
+ setShowLocationModal(false);
+ setSelectedLocation?.(undefined);
+ locationFormMethods.unregister([
+ "locationType",
+ "locationLink",
+ "locationAddress",
+ "locationPhoneNumber",
+ ]);
+ }}>
+ <QueryCell
+ query={locationsQuery}
+ success={({ data: locationOptions }) => {
+ if (!locationOptions.length) return null;
+ return (
+ <Controller
+ name="locationType"
+ control={locationFormMethods.control}
+ render={() => (
+ <Select
+ maxMenuHeight={150}
+ name="location"
+ defaultValue={selection}
+ options={
+ booking
+ ? locationOptions.filter((location) => location.value !== "phone")
+ : locationOptions
+ }
+ isSearchable={false}
+ className="my-4 block w-full min-w-0 flex-1 rounded-sm border border-gray-300 sm:text-sm"
+ onChange={(val) => {
+ if (val) {
+ locationFormMethods.setValue("locationType", val.value);
+ locationFormMethods.unregister([
+ "locationLink",
+ "locationAddress",
+ "locationPhoneNumber",
+ ]);
+ locationFormMethods.clearErrors([
+ "locationLink",
+ "locationPhoneNumber",
+ "locationAddress",
+ ]);
+ setSelectedLocation?.(val);
+ }
+ }}
+ />
+ )}
+ />
+ );
+ }}
+ />
+ {selectedLocation && LocationOptions}
+ <div className="mt-4 flex justify-end space-x-2">
+ <Button
+ onClick={() => {
+ setShowLocationModal(false);
+ setSelectedLocation?.(undefined);
+ locationFormMethods.unregister("locationType");
+ }}
+ type="button"
+ color="secondary">
+ {t("cancel")}
+ </Button>
+ <Button type="submit">{t("update")}</Button>
+ </div>
+ </Form>
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+};
diff --git a/apps/web/components/security/DisableUserImpersonation.tsx b/apps/web/components/security/DisableUserImpersonation.tsx
new file mode 100644
index 00000000000..66c978398db
--- /dev/null
+++ b/apps/web/components/security/DisableUserImpersonation.tsx
@@ -0,0 +1,55 @@
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import showToast from "@calcom/lib/notification";
+import Button from "@calcom/ui/Button";
+
+import { trpc } from "@lib/trpc";
+
+import Badge from "@components/ui/Badge";
+
+const DisableUserImpersonation = ({ disableImpersonation }: { disableImpersonation: boolean }) => {
+ const utils = trpc.useContext();
+
+ const { t } = useLocale();
+
+ const mutation = trpc.useMutation("viewer.updateProfile", {
+ onSuccess: async () => {
+ showToast(t("your_user_profile_updated_successfully"), "success");
+ await utils.invalidateQueries(["viewer.me"]);
+ },
+ async onSettled() {
+ await utils.invalidateQueries(["viewer.i18n"]);
+ },
+ });
+
+ return (
+ <>
+ <div className="flex flex-col justify-between pt-9 pl-2 sm:flex-row">
+ <div>
+ <div className="flex flex-row items-center">
+ <h2 className="font-cal text-lg font-medium leading-6 text-gray-900">
+ {t("user_impersonation_heading")}
+ </h2>
+ <Badge className="ml-2 text-xs" variant={!disableImpersonation ? "success" : "gray"}>
+ {!disableImpersonation ? t("enabled") : t("disabled")}
+ </Badge>
+ </div>
+ <p className="mt-1 text-sm text-gray-500">{t("user_impersonation_description")}</p>
+ </div>
+ <div className="mt-5 sm:mt-0 sm:self-center">
+ <Button
+ type="submit"
+ color="secondary"
+ onClick={() =>
+ !disableImpersonation
+ ? mutation.mutate({ disableImpersonation: true })
+ : mutation.mutate({ disableImpersonation: false })
+ }>
+ {!disableImpersonation ? t("disable") : t("enable")}
+ </Button>
+ </div>
+ </div>
+ </>
+ );
+};
+
+export default DisableUserImpersonation;
diff --git a/apps/web/components/team/MemberInvitationModal.tsx b/apps/web/components/team/MemberInvitationModal.tsx
index b1a6448a43c..e7175c38212 100644
--- a/apps/web/components/team/MemberInvitationModal.tsx
+++ b/apps/web/components/team/MemberInvitationModal.tsx
@@ -1,10 +1,10 @@
import { UserIcon } from "@heroicons/react/outline";
import { InformationCircleIcon } from "@heroicons/react/solid";
import { MembershipRole } from "@prisma/client";
-import React, { useState, useEffect, SyntheticEvent, useMemo } from "react";
+import React, { useState, SyntheticEvent, useMemo } from "react";
import Button from "@calcom/ui/Button";
-import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog";
+import { Dialog, DialogContent, DialogFooter } from "@calcom/ui/Dialog";
import { TextField } from "@calcom/ui/form/fields";
import { useLocale } from "@lib/hooks/useLocale";
diff --git a/apps/web/components/team/MemberListItem.tsx b/apps/web/components/team/MemberListItem.tsx
index 333319268b0..fc7de423942 100644
--- a/apps/web/components/team/MemberListItem.tsx
+++ b/apps/web/components/team/MemberListItem.tsx
@@ -4,7 +4,7 @@ import { MembershipRole } from "@prisma/client";
import Link from "next/link";
import { useState } from "react";
-import { WEBSITE_URL } from "@calcom/lib/constants";
+import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import Button from "@calcom/ui/Button";
@@ -74,7 +74,7 @@ export default function MemberListItem(props: Props) {
<div className="flex w-full flex-col justify-between sm:flex-row">
<div className="flex">
<Avatar
- imageSrc={WEBSITE_URL + "/" + props.member.username + "/avatar.png"}
+ imageSrc={WEBAPP_URL + "/" + props.member.username + "/avatar.png"}
alt={name || ""}
className="h-9 w-9 rounded-full"
/>
diff --git a/apps/web/components/team/screens/Team.tsx b/apps/web/components/team/screens/Team.tsx
index a7a26338c34..0896e2093d4 100644
--- a/apps/web/components/team/screens/Team.tsx
+++ b/apps/web/components/team/screens/Team.tsx
@@ -5,13 +5,12 @@ import Link from "next/link";
import { TeamPageProps } from "pages/team/[slug]";
import React from "react";
-import { WEBSITE_URL } from "@calcom/lib/constants";
+import { WEBAPP_URL } from "@calcom/lib/constants";
import Button from "@calcom/ui/Button";
import { useLocale } from "@lib/hooks/useLocale";
import Avatar from "@components/ui/Avatar";
-import Text from "@components/ui/Text";
type TeamType = TeamPageProps["team"];
type MembersType = TeamType["members"];
@@ -52,14 +51,14 @@ const Team = ({ team }: TeamPageProps) => {
<div>
<Avatar
alt={member.name || ""}
- imageSrc={WEBSITE_URL + "/" + member.username + "/avatar.png"}
+ imageSrc={WEBAPP_URL + "/" + member.username + "/avatar.png"}
className="-mt-4 h-12 w-12"
/>
- <section className="mt-2 w-full space-y-1">
- <Text variant="title">{member.name}</Text>
- <Text variant="subtitle" className="">
+ <section className="line-clamp-4 mt-2 w-full space-y-1">
+ <p className="font-medium text-neutral-900 dark:text-white">{member.name}</p>
+ <p className="text-sm font-normal text-neutral-500 dark:text-white">
{member.bio || t("user_from_team", { user: member.name, team: team.name })}
- </Text>
+ </p>
</section>
</div>
</div>
diff --git a/apps/web/components/ui/ModalContainer.tsx b/apps/web/components/ui/ModalContainer.tsx
index 63964207576..5fa6353350b 100644
--- a/apps/web/components/ui/ModalContainer.tsx
+++ b/apps/web/components/ui/ModalContainer.tsx
@@ -18,7 +18,7 @@ export default function ModalContainer(props: Props) {
<DialogContent>
<div
className={classNames(
- "inline-block transform bg-white text-left align-bottom transition-all sm:align-middle",
+ "inline-block w-full transform bg-white text-left align-bottom transition-all sm:align-middle",
{
"sm:w-full sm:max-w-lg ": !props.wide,
"sm:w-4xl sm:max-w-4xl": props.wide,
diff --git a/apps/web/components/ui/PoweredByCal.tsx b/apps/web/components/ui/PoweredByCal.tsx
index 9aa32166c43..348e8d4a752 100644
--- a/apps/web/components/ui/PoweredByCal.tsx
+++ b/apps/web/components/ui/PoweredByCal.tsx
@@ -1,6 +1,6 @@
import Link from "next/link";
-import { useIsEmbed } from "@calcom/embed-core";
+import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
import { useLocale } from "@lib/hooks/useLocale";
diff --git a/apps/web/components/ui/TableActions.tsx b/apps/web/components/ui/TableActions.tsx
index 4750dcd1ce7..7f6d316b58f 100644
--- a/apps/web/components/ui/TableActions.tsx
+++ b/apps/web/components/ui/TableActions.tsx
@@ -9,6 +9,7 @@ import { SVGComponent } from "@lib/types/SVGComponent";
export type ActionType = {
id: string;
icon?: SVGComponent;
+ iconClassName?: string;
label: string;
disabled?: boolean;
color?: "primary" | "secondary";
@@ -52,6 +53,7 @@ const DropdownActions = ({
className="w-full rounded-none font-normal"
href={action.href}
StartIcon={action.icon}
+ startIconClassName={action.iconClassName}
onClick={action.onClick || defaultAction}
data-testid={action.id}>
{action.label}
@@ -81,6 +83,7 @@ const TableActions: FC<Props> = ({ actions }) => {
href={action.href}
onClick={action.onClick || defaultAction}
StartIcon={action.icon}
+ startIconClassName={action.iconClassName}
{...(action?.actions ? { EndIcon: ChevronDownIcon } : null)}
disabled={action.disabled}
color={action.color || "secondary"}>
diff --git a/apps/web/components/ui/Text/Body/Body.tsx b/apps/web/components/ui/Text/Body/Body.tsx
deleted file mode 100644
index edc91c7cf74..00000000000
--- a/apps/web/components/ui/Text/Body/Body.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Body: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("text-gray-900 dark:text-white", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Body;
diff --git a/apps/web/components/ui/Text/Body/index.ts b/apps/web/components/ui/Text/Body/index.ts
deleted file mode 100644
index 3c34192400b..00000000000
--- a/apps/web/components/ui/Text/Body/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Body from "./Body";
-
-export default Body;
diff --git a/apps/web/components/ui/Text/Caption/Caption.tsx b/apps/web/components/ui/Text/Caption/Caption.tsx
deleted file mode 100644
index 7bd21801f66..00000000000
--- a/apps/web/components/ui/Text/Caption/Caption.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Caption: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("text-sm text-gray-500 dark:text-white leading-tight", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Caption;
diff --git a/apps/web/components/ui/Text/Caption/index.ts b/apps/web/components/ui/Text/Caption/index.ts
deleted file mode 100644
index 2617efad6b2..00000000000
--- a/apps/web/components/ui/Text/Caption/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Caption from "./Caption";
-
-export default Caption;
diff --git a/apps/web/components/ui/Text/Caption2/Caption2.tsx b/apps/web/components/ui/Text/Caption2/Caption2.tsx
deleted file mode 100644
index 08eae0098c2..00000000000
--- a/apps/web/components/ui/Text/Caption2/Caption2.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Caption2: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("text-xs italic text-gray-500 dark:text-white leading-tight", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Caption2;
diff --git a/apps/web/components/ui/Text/Caption2/index.ts b/apps/web/components/ui/Text/Caption2/index.ts
deleted file mode 100644
index 2e5aa15b643..00000000000
--- a/apps/web/components/ui/Text/Caption2/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Caption2 from "./Caption2";
-
-export default Caption2;
diff --git a/apps/web/components/ui/Text/Footnote/Footnote.tsx b/apps/web/components/ui/Text/Footnote/Footnote.tsx
deleted file mode 100644
index b587faa4b2b..00000000000
--- a/apps/web/components/ui/Text/Footnote/Footnote.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Footnote: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("text-xs font-medium text-gray-500 dark:text-white", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Footnote;
diff --git a/apps/web/components/ui/Text/Footnote/index.ts b/apps/web/components/ui/Text/Footnote/index.ts
deleted file mode 100644
index ba90f2adb05..00000000000
--- a/apps/web/components/ui/Text/Footnote/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Footnote from "./Footnote";
-
-export default Footnote;
diff --git a/apps/web/components/ui/Text/Headline/Headline.tsx b/apps/web/components/ui/Text/Headline/Headline.tsx
deleted file mode 100644
index 0f860c82bf8..00000000000
--- a/apps/web/components/ui/Text/Headline/Headline.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Headline: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("font-cal text-xl text-gray-900 dark:text-white", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Headline;
diff --git a/apps/web/components/ui/Text/Headline/index.ts b/apps/web/components/ui/Text/Headline/index.ts
deleted file mode 100644
index 6f05924138c..00000000000
--- a/apps/web/components/ui/Text/Headline/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Headline from "./Headline";
-
-export default Headline;
diff --git a/apps/web/components/ui/Text/Largetitle/Largetitle.tsx b/apps/web/components/ui/Text/Largetitle/Largetitle.tsx
deleted file mode 100644
index ec3416144ba..00000000000
--- a/apps/web/components/ui/Text/Largetitle/Largetitle.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Largetitle: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("font-cal tracking-wider text-3xl mb-2", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Largetitle;
diff --git a/apps/web/components/ui/Text/Largetitle/index.ts b/apps/web/components/ui/Text/Largetitle/index.ts
deleted file mode 100644
index 66a43d4b964..00000000000
--- a/apps/web/components/ui/Text/Largetitle/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Largetitle from "./Largetitle";
-
-export default Largetitle;
diff --git a/apps/web/components/ui/Text/Overline/Overline.tsx b/apps/web/components/ui/Text/Overline/Overline.tsx
deleted file mode 100644
index 55eeac358d9..00000000000
--- a/apps/web/components/ui/Text/Overline/Overline.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Overline: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames(
- "text-sm capitalize font-medium text-gray-900 dark:text-white",
- props?.className
- );
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Overline;
diff --git a/apps/web/components/ui/Text/Overline/index.ts b/apps/web/components/ui/Text/Overline/index.ts
deleted file mode 100644
index 6f3af48dec0..00000000000
--- a/apps/web/components/ui/Text/Overline/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Overline from "./Overline";
-
-export default Overline;
diff --git a/apps/web/components/ui/Text/Subheadline/Subheadline.tsx b/apps/web/components/ui/Text/Subheadline/Subheadline.tsx
deleted file mode 100644
index 1c3761d7118..00000000000
--- a/apps/web/components/ui/Text/Subheadline/Subheadline.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Subheadline: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("text-xl text-gray-500 dark:text-white leading-relaxed", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Subheadline;
diff --git a/apps/web/components/ui/Text/Subheadline/index.ts b/apps/web/components/ui/Text/Subheadline/index.ts
deleted file mode 100644
index f906e255cae..00000000000
--- a/apps/web/components/ui/Text/Subheadline/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Subheadline from "./Subheadline";
-
-export default Subheadline;
diff --git a/apps/web/components/ui/Text/Subtitle/Subtitle.tsx b/apps/web/components/ui/Text/Subtitle/Subtitle.tsx
deleted file mode 100644
index 40c6fefddf3..00000000000
--- a/apps/web/components/ui/Text/Subtitle/Subtitle.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Subtitle: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("text-sm font-normal text-neutral-500 dark:text-white", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Subtitle;
diff --git a/apps/web/components/ui/Text/Subtitle/index.ts b/apps/web/components/ui/Text/Subtitle/index.ts
deleted file mode 100644
index 34629fe9b0f..00000000000
--- a/apps/web/components/ui/Text/Subtitle/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Subtitle from "./Subtitle";
-
-export default Subtitle;
diff --git a/apps/web/components/ui/Text/Text.tsx b/apps/web/components/ui/Text/Text.tsx
deleted file mode 100644
index 07debdf719d..00000000000
--- a/apps/web/components/ui/Text/Text.tsx
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * @deprecated create new a new set of components, waiting for designs
- */
-import React from "react";
-
-import Body from "./Body";
-import Caption from "./Caption";
-import Caption2 from "./Caption2";
-import Footnote from "./Footnote";
-import Headline from "./Headline";
-import Largetitle from "./Largetitle";
-import Overline from "./Overline";
-import Subheadline from "./Subheadline";
-import Subtitle from "./Subtitle";
-import Title from "./Title";
-import Title2 from "./Title2";
-import Title3 from "./Title3";
-
-type Props = {
- variant?:
- | "overline"
- | "caption"
- | "body"
- | "caption2"
- | "footnote"
- | "headline"
- | "largetitle"
- | "subheadline"
- | "subtitle"
- | "title"
- | "title2"
- | "title3";
- children: any;
- text?: string;
- tx?: string;
- className?: string;
-};
-
-export type TextProps = {
- children: any;
- text?: string;
- tx?: string;
- className?: string;
-};
-
-/**
- * static let largeTitle: Font
- * A font with the large title text style.
- *
- * static let title: Font
- * A font with the title text style.
- *
- * static let title2: Font
- * Create a font for second level hierarchical headings.
- *
- * static let title3: Font
- * Create a font for third level hierarchical headings.
- *
- * static let headline: Font
- * A font with the headline text style.
- *
- * static let subheadline: Font
- * A font with the subheadline text style.
- *
- * static let body: Font
- * A font with the body text style.
- *
- * static let callout: Font
- * A font with the callout text style.
- *
- * static let caption: Font
- * A font with the caption text style.
- *
- * static let caption2: Font
- * Create a font with the alternate caption text style.
- *
- * static let footnote: Font
- * A font with the footnote text style.
- */
-
-const Text: React.FunctionComponent<Props> = (props: Props) => {
- switch (props?.variant) {
- case "overline":
- return (
- <Overline text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Overline>
- );
- case "body":
- return (
- <Body text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Body>
- );
- case "caption":
- return (
- <Caption text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Caption>
- );
- case "caption2":
- return (
- <Caption2 text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Caption2>
- );
- case "footnote":
- return (
- <Footnote text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Footnote>
- );
- case "headline":
- return (
- <Headline text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Headline>
- );
- case "largetitle":
- return (
- <Largetitle text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Largetitle>
- );
- case "subheadline":
- return (
- <Subheadline text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Subheadline>
- );
- case "subtitle":
- return (
- <Subtitle text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Subtitle>
- );
- case "title":
- return (
- <Title text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Title>
- );
- case "title2":
- return (
- <Title2 text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Title2>
- );
- case "title3":
- return (
- <Title3 text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Title3>
- );
- default:
- return (
- <Body text={props?.text} tx={props?.tx} className={props?.className}>
- {props.children}
- </Body>
- );
- }
-};
-
-export default Text;
diff --git a/apps/web/components/ui/Text/Title/Title.tsx b/apps/web/components/ui/Text/Title/Title.tsx
deleted file mode 100644
index 6631e30c714..00000000000
--- a/apps/web/components/ui/Text/Title/Title.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Title: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("font-medium text-neutral-900 dark:text-white", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Title;
diff --git a/apps/web/components/ui/Text/Title/index.ts b/apps/web/components/ui/Text/Title/index.ts
deleted file mode 100644
index 17d11b0c043..00000000000
--- a/apps/web/components/ui/Text/Title/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Title from "./Title";
-
-export default Title;
diff --git a/apps/web/components/ui/Text/Title2/Title2.tsx b/apps/web/components/ui/Text/Title2/Title2.tsx
deleted file mode 100644
index 70c41de8599..00000000000
--- a/apps/web/components/ui/Text/Title2/Title2.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Title2: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames("text-base font-normal text-gray-900 dark:text-white", props?.className);
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Title2;
diff --git a/apps/web/components/ui/Text/Title2/index.ts b/apps/web/components/ui/Text/Title2/index.ts
deleted file mode 100644
index 71b8b9e4904..00000000000
--- a/apps/web/components/ui/Text/Title2/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Title2 from "./Title2";
-
-export default Title2;
diff --git a/apps/web/components/ui/Text/Title3/Title3.tsx b/apps/web/components/ui/Text/Title3/Title3.tsx
deleted file mode 100644
index ffe213c5709..00000000000
--- a/apps/web/components/ui/Text/Title3/Title3.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import classnames from "classnames";
-import React from "react";
-
-import { TextProps } from "../Text";
-
-const Title3: React.FunctionComponent<TextProps> = (props: TextProps) => {
- const classes = classnames(
- "text-xs font-semibold leading-tight text-gray-900 dark:text-white",
- props?.className
- );
-
- return <p className={classes}>{props?.text || props.children}</p>;
-};
-
-export default Title3;
diff --git a/apps/web/components/ui/Text/Title3/index.ts b/apps/web/components/ui/Text/Title3/index.ts
deleted file mode 100644
index cbfc1b4d056..00000000000
--- a/apps/web/components/ui/Text/Title3/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Title3 from "./Title3";
-
-export default Title3;
diff --git a/apps/web/components/ui/Text/index.ts b/apps/web/components/ui/Text/index.ts
deleted file mode 100644
index 5c61cdf3b05..00000000000
--- a/apps/web/components/ui/Text/index.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import Body from "./Body";
-import Caption from "./Caption";
-import Caption2 from "./Caption2";
-import Footnote from "./Footnote";
-import Headline from "./Headline";
-import Largetitle from "./Largetitle";
-import Overline from "./Overline";
-import Subheadline from "./Subheadline";
-import Subtitle from "./Subtitle";
-import Text from "./Text";
-import Title from "./Title";
-import Title2 from "./Title2";
-import Title3 from "./Title3";
-
-export { Text };
-export default Text;
-
-export { Title };
-
-export { Title2 };
-
-export { Title3 };
-
-export { Largetitle };
-
-export { Subtitle };
-
-export { Headline };
-
-export { Subheadline };
-
-export { Caption };
-
-export { Caption2 };
-
-export { Footnote };
-
-export { Overline };
-
-export { Body };
diff --git a/apps/web/components/ui/form/CheckboxField.tsx b/apps/web/components/ui/form/CheckboxField.tsx
index 9b06d4a9252..867c092bb35 100644
--- a/apps/web/components/ui/form/CheckboxField.tsx
+++ b/apps/web/components/ui/form/CheckboxField.tsx
@@ -1,50 +1,60 @@
import React, { forwardRef, InputHTMLAttributes } from "react";
+import classNames from "@calcom/lib/classNames";
+
import InfoBadge from "@components/ui/InfoBadge";
type Props = InputHTMLAttributes<HTMLInputElement> & {
label?: React.ReactNode;
description: string;
descriptionAsLabel?: boolean;
- infomationIconText?: string;
+ informationIconText?: string;
};
const CheckboxField = forwardRef<HTMLInputElement, Props>(
- ({ label, description, infomationIconText, descriptionAsLabel, ...rest }, ref) => {
+ ({ label, description, informationIconText, ...rest }, ref) => {
+ const descriptionAsLabel = !label || rest.descriptionAsLabel;
return (
<div className="block items-center sm:flex">
- {label && !descriptionAsLabel && (
- <div className="min-w-48 mb-4 sm:mb-0">
- <label htmlFor={rest.id} className="flex text-sm font-medium text-neutral-700">
- {label}
- </label>
- </div>
- )}
- {label && descriptionAsLabel && (
+ {label && (
<div className="min-w-48 mb-4 sm:mb-0">
- <span className="flex text-sm font-medium text-neutral-700">{label}</span>
+ {React.createElement(
+ descriptionAsLabel ? "div" : "label",
+ {
+ className: "flex text-sm font-medium text-neutral-700",
+ ...(!descriptionAsLabel
+ ? {
+ htmlFor: rest.id,
+ }
+ : {}),
+ },
+ label
+ )}
</div>
)}
<div className="w-full">
<div className="relative flex items-start">
- <div className="flex h-5 items-center">
- <input
- {...rest}
- ref={ref}
- type="checkbox"
- className="text-primary-600 focus:ring-primary-500 h-4 w-4 rounded border-gray-300"
- />
- </div>
- <div className="text-sm ltr:ml-3 rtl:mr-3">
- {!label || descriptionAsLabel ? (
- <label htmlFor={rest.id} className="text-neutral-700">
- {description}
- </label>
- ) : (
- <p className="text-neutral-900">{description}</p>
- )}
- </div>
- {infomationIconText && <InfoBadge content={infomationIconText}></InfoBadge>}
+ {React.createElement(
+ descriptionAsLabel ? "label" : "div",
+ {
+ className: classNames(
+ "relative flex items-start",
+ descriptionAsLabel ? "text-neutral-700" : "text-neutral-900"
+ ),
+ },
+ <>
+ <div className="flex h-5 items-center">
+ <input
+ {...rest}
+ ref={ref}
+ type="checkbox"
+ className="text-primary-600 focus:ring-primary-500 h-4 w-4 rounded border-gray-300"
+ />
+ </div>
+ <span className="text-sm ltr:ml-3 rtl:mr-3">{description}</span>
+ </>
+ )}
+ {informationIconText && <InfoBadge content={informationIconText}></InfoBadge>}
</div>
</div>
</div>
diff --git a/apps/web/ee/components/LicenseRequired.tsx b/apps/web/ee/components/LicenseRequired.tsx
new file mode 100644
index 00000000000..3352a4bac2f
--- /dev/null
+++ b/apps/web/ee/components/LicenseRequired.tsx
@@ -0,0 +1,57 @@
+import { ExclamationIcon } from "@heroicons/react/solid";
+import { useSession } from "next-auth/react";
+import React, { AriaRole, ComponentType, FC, Fragment } from "react";
+
+import { CONSOLE_URL } from "@calcom/lib/constants";
+
+import EmptyScreen from "@components/EmptyScreen";
+
+type LicenseRequiredProps = {
+ as?: keyof JSX.IntrinsicElements | "";
+ className?: string;
+ role?: AriaRole | undefined;
+ children: React.ReactNode;
+};
+
+/**
+ * This component will only render it's children if the installation has a valid
+ * license.
+ */
+const LicenseRequired: FC<LicenseRequiredProps> = ({ children, as = "", ...rest }) => {
+ const session = useSession();
+ const Component = as || Fragment;
+ return (
+ <Component {...rest}>
+ {session.data?.hasValidLicense ? (
+ children
+ ) : (
+ <EmptyScreen
+ Icon={ExclamationIcon}
+ headline="This is an enterprise feature"
+ description={
+ <>
+ To enable this feature, get a deployment key at{" "}
+ <a href={CONSOLE_URL} target="_blank" rel="noopener noreferrer" className="underline">
+ Cal.com console
+ </a>
+ .
+ </>
+ }
+ />
+ )}
+ </Component>
+ );
+};
+
+export function withLicenseRequired<T>(Component: ComponentType<T>) {
+ // eslint-disable-next-line react/display-name
+ return (hocProps: T) => {
+ return (
+ <LicenseRequired>
+ <Component {...(hocProps as T)} />;
+ </LicenseRequired>
+ );
+ };
+}
+
+export default LicenseRequired;
diff --git a/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx b/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx
index 99730950cc8..783036f4648 100644
--- a/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx
+++ b/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx
@@ -15,11 +15,12 @@ import { trpc } from "@lib/trpc";
import { DatePicker } from "@components/ui/form/DatePicker";
-import { TApiKeys } from "./ApiKeyListItem";
+import LicenseRequired from "../LicenseRequired";
+import type { TApiKeys } from "./ApiKeyListItem";
export default function ApiKeyDialogForm(props: {
title: string;
- defaultValues?: Omit<TApiKeys, "userId" | "createdAt" | "lastUsedAt"> & { neverExpires: boolean };
+ defaultValues?: Omit<TApiKeys, "userId" | "createdAt" | "lastUsedAt"> & { neverExpires?: boolean };
handleClose: () => void;
}) {
const { t } = useLocale();
@@ -49,7 +50,7 @@ export default function ApiKeyDialogForm(props: {
const watchNeverExpires = form.watch("neverExpires");
return (
- <>
+ <LicenseRequired>
{successfulNewApiKeyModal ? (
<>
<div className="mb-10">
@@ -92,12 +93,12 @@ export default function ApiKeyDialogForm(props: {
</DialogFooter>
</>
) : (
- <Form<Omit<TApiKeys, "userId" | "createdAt" | "lastUsedAt"> & { neverExpires: boolean }>
+ <Form<Omit<TApiKeys, "userId" | "createdAt" | "lastUsedAt"> & { neverExpires?: boolean }>
form={form}
handleSubmit={async (event) => {
const apiKey = await utils.client.mutation("viewer.apiKeys.create", event);
setApiKey(apiKey);
- setApiKeyDetails({ ...event });
+ setApiKeyDetails({ ...event, neverExpires: !!event.neverExpires });
await utils.invalidateQueries(["viewer.apiKeys.list"]);
setSuccessfulNewApiKeyModal(true);
}}
@@ -146,6 +147,6 @@ export default function ApiKeyDialogForm(props: {
</DialogFooter>
</Form>
)}
- </>
+ </LicenseRequired>
);
}
diff --git a/apps/web/ee/components/apiKeys/ApiKeyListContainer.tsx b/apps/web/ee/components/apiKeys/ApiKeyListContainer.tsx
index 5e71b13c84a..0bc28d54d1c 100644
--- a/apps/web/ee/components/apiKeys/ApiKeyListContainer.tsx
+++ b/apps/web/ee/components/apiKeys/ApiKeyListContainer.tsx
@@ -12,66 +12,76 @@ import { trpc } from "@lib/trpc";
import { List } from "@components/List";
-export default function ApiKeyListContainer() {
+import LicenseRequired from "../LicenseRequired";
+
+function ApiKeyListContainer() {
const { t } = useLocale();
const query = trpc.useQuery(["viewer.apiKeys.list"]);
const [newApiKeyModal, setNewApiKeyModal] = useState(false);
const [editModalOpen, setEditModalOpen] = useState(false);
- const [apiKeyToEdit, setApiKeyToEdit] = useState<(TApiKeys & { neverExpires: boolean }) | null>(null);
+ const [apiKeyToEdit, setApiKeyToEdit] = useState<(TApiKeys & { neverExpires?: boolean }) | null>(null);
return (
- <QueryCell
- query={query}
- success={({ data }) => (
- <>
- <div className="flex flex-col justify-between truncate pl-2 pr-1 sm:flex-row">
- <div className="mt-9">
- <h2 className="font-cal text-lg font-medium leading-6 text-gray-900">{t("api_keys")}</h2>
- <p className="mt-1 mb-5 text-sm text-gray-500">{t("api_keys_subtitle")}</p>
- </div>
- <div className="mb-9 sm:self-center">
- <Button StartIcon={PlusIcon} color="secondary" onClick={() => setNewApiKeyModal(true)}>
- {t("generate_new_api_key")}
- </Button>
- </div>
- </div>
+ <>
+ <div className="flex flex-col justify-between truncate pl-2 pr-1 sm:flex-row">
+ <div className="mt-9">
+ <h2 className="font-cal text-lg font-medium leading-6 text-gray-900">{t("api_keys")}</h2>
+ <p className="mt-1 mb-5 text-sm text-gray-500">{t("api_keys_subtitle")}</p>
+ </div>
+ <div className="mb-9 sm:self-center">
+ <Button StartIcon={PlusIcon} color="secondary" onClick={() => setNewApiKeyModal(true)}>
+ {t("generate_new_api_key")}
+ </Button>
+ </div>
+ </div>
+ <LicenseRequired>
+ <QueryCell
+ query={query}
+ success={({ data }) => (
+ <>
+ {data.length > 0 && (
+ <List className="pb-6">
+ {data.map((item) => (
+ <ApiKeyListItem
+ key={item.id}
+ apiKey={item}
+ onEditApiKey={() => {
+ setApiKeyToEdit(item);
+ setEditModalOpen(true);
+ }}
+ />
+ ))}
+ </List>
+ )}
- {data.length > 0 && (
- <List className="pb-6">
- {data.map((item: any) => (
- <ApiKeyListItem
- key={item.id}
- apiKey={item}
- onEditApiKey={() => {
- setApiKeyToEdit(item);
- setEditModalOpen(true);
- }}
- />
- ))}
- </List>
+ {/* New api key dialog */}
+ <Dialog open={newApiKeyModal} onOpenChange={(isOpen) => !isOpen && setNewApiKeyModal(false)}>
+ <DialogContent>
+ <ApiKeyDialogForm
+ title={t("create_api_key")}
+ handleClose={() => setNewApiKeyModal(false)}
+ />
+ </DialogContent>
+ </Dialog>
+ {/* Edit api key dialog */}
+ <Dialog open={editModalOpen} onOpenChange={(isOpen) => !isOpen && setEditModalOpen(false)}>
+ <DialogContent>
+ {apiKeyToEdit && (
+ <ApiKeyDialogForm
+ title={t("edit_api_key")}
+ key={apiKeyToEdit.id}
+ handleClose={() => setEditModalOpen(false)}
+ defaultValues={apiKeyToEdit}
+ />
+ )}
+ </DialogContent>
+ </Dialog>
+ </>
)}
-
- {/* New api key dialog */}
- <Dialog open={newApiKeyModal} onOpenChange={(isOpen) => !isOpen && setNewApiKeyModal(false)}>
- <DialogContent>
- <ApiKeyDialogForm title={t("create_api_key")} handleClose={() => setNewApiKeyModal(false)} />
- </DialogContent>
- </Dialog>
- {/* Edit api key dialog */}
- <Dialog open={editModalOpen} onOpenChange={(isOpen) => !isOpen && setEditModalOpen(false)}>
- <DialogContent>
- {apiKeyToEdit && (
- <ApiKeyDialogForm
- title={t("edit_api_key")}
- key={apiKeyToEdit.id}
- handleClose={() => setEditModalOpen(false)}
- defaultValues={apiKeyToEdit}
- />
- )}
- </DialogContent>
- </Dialog>
- </>
- )}
- />
+ />
+ </LicenseRequired>
+ </>
);
}
+
+export default ApiKeyListContainer;
diff --git a/apps/web/ee/components/saml/Configuration.tsx b/apps/web/ee/components/saml/Configuration.tsx
index 4b32f7ab51f..fa4a632d7ec 100644
--- a/apps/web/ee/components/saml/Configuration.tsx
+++ b/apps/web/ee/components/saml/Configuration.tsx
@@ -1,18 +1,20 @@
-import React, { useEffect, useState, useRef } from "react";
+import React, { useEffect, useRef, useState } from "react";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import { TextArea } from "@calcom/ui/form/fields";
-import { useLocale } from "@lib/hooks/useLocale";
import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
import { trpc } from "@lib/trpc";
import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
import Badge from "@components/ui/Badge";
+import LicenseRequired from "../LicenseRequired";
+
export default function SAMLConfiguration({
teamsView,
teamId,
@@ -92,7 +94,7 @@ export default function SAMLConfiguration({
return (
<>
{isSAMLLoginEnabled ? (
- <>
+ <LicenseRequired>
<hr className="mt-8" />
<div className="mt-6">
<h2 className="font-cal text-lg font-medium leading-6 text-gray-900">
@@ -157,7 +159,7 @@ export default function SAMLConfiguration({
</div>
<hr className="mt-4" />
</form>
- </>
+ </LicenseRequired>
) : null}
</>
);
diff --git a/apps/web/ee/components/stripe/PaymentPage.tsx b/apps/web/ee/components/stripe/PaymentPage.tsx
index b68fdbbc50d..285a82c52e5 100644
--- a/apps/web/ee/components/stripe/PaymentPage.tsx
+++ b/apps/web/ee/components/stripe/PaymentPage.tsx
@@ -6,10 +6,10 @@ import timezone from "dayjs/plugin/timezone";
import toArray from "dayjs/plugin/toArray";
import utc from "dayjs/plugin/utc";
import Head from "next/head";
-import React, { FC, useEffect, useState } from "react";
+import { FC, useEffect, useState } from "react";
import { FormattedNumber, IntlProvider } from "react-intl";
-import { sdkActionManager, useIsEmbed } from "@calcom/embed-core";
+import { sdkActionManager, useIsEmbed } from "@calcom/embed-core/embed-iframe";
import getStripe from "@calcom/stripe/client";
import PaymentComponent from "@ee/components/stripe/Payment";
import { PaymentPageProps } from "@ee/pages/payment/[uid]";
diff --git a/apps/web/ee/components/support/ContactMenuItem.tsx b/apps/web/ee/components/support/ContactMenuItem.tsx
new file mode 100644
index 00000000000..15ae451c54b
--- /dev/null
+++ b/apps/web/ee/components/support/ContactMenuItem.tsx
@@ -0,0 +1,13 @@
+import HelpscoutMenuItem from "@ee/lib/helpscout/HelpscoutMenuItem";
+import IntercomMenuItem from "@ee/lib/intercom/IntercomMenuItem";
+import ZendeskMenuItem from "@ee/lib/zendesk/ZendeskMenuItem";
+
+export default function HelpMenuItem() {
+ return (
+ <>
+ <IntercomMenuItem />
+ <ZendeskMenuItem />
+ <HelpscoutMenuItem />
+ </>
+ );
+}
diff --git a/apps/web/ee/components/support/HelpMenuItem.tsx b/apps/web/ee/components/support/HelpMenuItem.tsx
index 15ae451c54b..33e80982c39 100644
--- a/apps/web/ee/components/support/HelpMenuItem.tsx
+++ b/apps/web/ee/components/support/HelpMenuItem.tsx
@@ -1,13 +1,190 @@
-import HelpscoutMenuItem from "@ee/lib/helpscout/HelpscoutMenuItem";
-import IntercomMenuItem from "@ee/lib/intercom/IntercomMenuItem";
-import ZendeskMenuItem from "@ee/lib/zendesk/ZendeskMenuItem";
+import { ExternalLinkIcon, ExclamationIcon } from "@heroicons/react/solid";
+import { useState } from "react";
+
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import showToast from "@calcom/lib/notification";
+import Button from "@calcom/ui/Button";
+
+import classNames from "@lib/classNames";
+import { trpc } from "@lib/trpc";
+
+import ContactMenuItem from "./ContactMenuItem";
export default function HelpMenuItem() {
+ const [rating, setRating] = useState<null | string>(null);
+ const [comment, setComment] = useState("");
+ const [disableSubmit, setDisableSubmit] = useState(true);
+ const { t } = useLocale();
+
+ const mutation = trpc.useMutation("viewer.submitFeedback");
+
+ const onRatingClick = (value: string) => {
+ setRating(value);
+ setDisableSubmit(false);
+ };
+
+ const sendFeedback = async (rating: string, comment: string) => {
+ mutation.mutate({ rating: rating, comment: comment });
+
+ if (mutation.isSuccess) {
+ setDisableSubmit(true);
+ showToast("Thank you, feedback submitted", "success");
+ }
+ };
+
return (
- <>
- <IntercomMenuItem />
- <ZendeskMenuItem />
- <HelpscoutMenuItem />
- </>
+ <div className="w-full border-gray-300 bg-white shadow-sm md:w-[150%]">
+ <div className=" w-full p-5">
+ <p className="mb-1 text-neutral-500">{t("resources").toUpperCase()}</p>
+ <a
+ href="https://docs.cal.com/"
+ target="_blank"
+ className="flex w-full py-2 pr-4 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900"
+ rel="noreferrer">
+ {t("support_documentation")}
+ <ExternalLinkIcon
+ className={classNames(
+ "text-neutral-400 group-hover:text-neutral-500",
+ "ml-1 h-5 w-5 flex-shrink-0 ltr:mr-3"
+ )}
+ />
+ </a>
+ <a
+ href="https://developer.cal.com/"
+ target="_blank"
+ className="flex w-full py-2 pr-4 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900"
+ rel="noreferrer">
+ {t("developer_documentation")}
+ <ExternalLinkIcon
+ className={classNames(
+ "text-neutral-400 group-hover:text-neutral-500",
+ "ml-1 h-5 w-5 flex-shrink-0 ltr:mr-3"
+ )}
+ />
+ </a>
+ <ContactMenuItem />
+ </div>
+
+ <hr className=" bg-gray-200" />
+ <div className="w-full p-5">
+ <p className="mb-1 text-neutral-500">{t("feedback").toUpperCase()}</p>
+ <p className="flex w-full py-2 text-sm font-medium text-gray-700">{t("comments")}</p>
+ <textarea
+ id="comment"
+ name="comment"
+ rows={3}
+ onChange={(event) => setComment(event.target.value)}
+ className="my-1 block w-full rounded-sm border-gray-300 py-2 pb-2 shadow-sm sm:text-sm"></textarea>
+
+ <div className="my-3 flex justify-end">
+ <button
+ className={classNames(
+ "m-1 items-center justify-center p-1.5 grayscale hover:opacity-100 hover:grayscale-0",
+ rating === "Extremely unsatisfied" ? "grayscale-0" : "opacity-50"
+ )}
+ onClick={() => onRatingClick("Extremely unsatisfied")}>
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" width="1.5em" height="1.5em">
+ <path
+ fill="#FFCC4D"
+ d="M36 18c0 9.941-8.059 18-18 18S0 27.941 0 18 8.059 0 18 0s18 8.059 18 18"
+ />
+ <path
+ fill="#664500"
+ d="M22 27c0 2.763-1.791 3-4 3-2.21 0-4-.237-4-3 0-2.761 1.79-6 4-6 2.209 0 4 3.239 4 6zm8-12c-.124 0-.25-.023-.371-.072-5.229-2.091-7.372-5.241-7.461-5.374-.307-.46-.183-1.081.277-1.387.459-.306 1.077-.184 1.385.274.019.027 1.93 2.785 6.541 4.629.513.206.763.787.558 1.3-.157.392-.533.63-.929.63zM6 15c-.397 0-.772-.238-.929-.629-.205-.513.044-1.095.557-1.3 4.612-1.844 6.523-4.602 6.542-4.629.308-.456.929-.577 1.387-.27.457.308.581.925.275 1.383-.089.133-2.232 3.283-7.46 5.374C6.25 14.977 6.124 15 6 15z"
+ />
+ <path fill="#5DADEC" d="M24 16h4v19l-4-.046V16zM8 35l4-.046V16H8v19z" />
+ <path
+ fill="#664500"
+ d="M14.999 18c-.15 0-.303-.034-.446-.105-3.512-1.756-7.07-.018-7.105 0-.495.249-1.095.046-1.342-.447-.247-.494-.047-1.095.447-1.342.182-.09 4.498-2.197 8.895 0 .494.247.694.848.447 1.342-.176.35-.529.552-.896.552zm14 0c-.15 0-.303-.034-.446-.105-3.513-1.756-7.07-.018-7.105 0-.494.248-1.094.047-1.342-.447-.247-.494-.047-1.095.447-1.342.182-.09 4.501-2.196 8.895 0 .494.247.694.848.447 1.342-.176.35-.529.552-.896.552z"
+ />
+ <ellipse fill="#5DADEC" cx="18" cy="34" rx="18" ry="2" />
+ <ellipse fill="#E75A70" cx="18" cy="27" rx="3" ry="2" />
+ </svg>
+ </button>
+ <button
+ className={classNames(
+ "m-1 items-center justify-center p-1.5 grayscale hover:opacity-100 hover:grayscale-0",
+ rating === "Unsatisfied" ? "grayscale-0" : "opacity-50"
+ )}
+ onClick={() => onRatingClick("Unsatisfied")}>
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" width="1.5em" height="1.5em">
+ <path
+ fill="#FFCC4D"
+ d="M36 18c0 9.941-8.059 18-18 18-9.94 0-18-8.059-18-18C0 8.06 8.06 0 18 0c9.941 0 18 8.06 18 18"
+ />
+ <ellipse fill="#664500" cx="11.5" cy="14.5" rx="2.5" ry="3.5" />
+ <ellipse fill="#664500" cx="24.5" cy="14.5" rx="2.5" ry="3.5" />
+ <path
+ fill="#664500"
+ d="M8.665 27.871c.178.161.444.171.635.029.039-.029 3.922-2.9 8.7-2.9 4.766 0 8.662 2.871 8.7 2.9.191.142.457.13.635-.029.177-.16.217-.424.094-.628C27.3 27.029 24.212 22 18 22s-9.301 5.028-9.429 5.243c-.123.205-.084.468.094.628z"
+ />
+ </svg>
+ </button>
+ <button
+ className={classNames(
+ "m-1 items-center justify-center p-1.5 grayscale hover:opacity-100 hover:grayscale-0",
+ rating === "Satisfied" ? "grayscale-0" : "opacity-50"
+ )}
+ onClick={() => onRatingClick("Satisfied")}>
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" width="1.5em" height="1.5em">
+ <path
+ fill="#FFCC4D"
+ d="M36 18c0 9.941-8.059 18-18 18-9.94 0-18-8.059-18-18C0 8.06 8.06 0 18 0c9.941 0 18 8.06 18 18"
+ />
+ <path
+ fill="#664500"
+ d="M28.457 17.797c-.06-.135-1.499-3.297-4.457-3.297-2.957 0-4.397 3.162-4.457 3.297-.092.207-.032.449.145.591.175.142.426.147.61.014.012-.009 1.262-.902 3.702-.902 2.426 0 3.674.881 3.702.901.088.066.194.099.298.099.11 0 .221-.037.312-.109.177-.142.238-.386.145-.594zm-12 0c-.06-.135-1.499-3.297-4.457-3.297-2.957 0-4.397 3.162-4.457 3.297-.092.207-.032.449.144.591.176.142.427.147.61.014.013-.009 1.262-.902 3.703-.902 2.426 0 3.674.881 3.702.901.088.066.194.099.298.099.11 0 .221-.037.312-.109.178-.142.237-.386.145-.594zM18 22c-3.623 0-6.027-.422-9-1-.679-.131-2 0-2 2 0 4 4.595 9 11 9 6.404 0 11-5 11-9 0-2-1.321-2.132-2-2-2.973.578-5.377 1-9 1z"
+ />
+ <path fill="#FFF" d="M9 23s3 1 9 1 9-1 9-1-2 4-9 4-9-4-9-4z" />
+ </svg>
+ </button>
+ <button
+ className={classNames(
+ "m-1 items-center justify-center p-1.5 grayscale hover:opacity-100 hover:grayscale-0",
+ rating === "Extremely satisfied" ? "grayscale-0" : "opacity-50"
+ )}
+ onClick={() => onRatingClick("Extremely satisfied")}>
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" width="1.5em" height="1.5em">
+ <path
+ fill="#FFCC4D"
+ d="M36 18c0 9.941-8.059 18-18 18S0 27.941 0 18 8.059 0 18 0s18 8.059 18 18"
+ />
+ <path
+ fill="#664500"
+ d="M18 21c-3.623 0-6.027-.422-9-1-.679-.131-2 0-2 2 0 4 4.595 9 11 9 6.404 0 11-5 11-9 0-2-1.321-2.132-2-2-2.973.578-5.377 1-9 1z"
+ />
+ <path fill="#FFF" d="M9 22s3 1 9 1 9-1 9-1-2 4-9 4-9-4-9-4z" />
+ <path
+ fill="#E95F28"
+ d="M15.682 4.413l-4.542.801L8.8.961C8.542.492 8.012.241 7.488.333c-.527.093-.937.511-1.019 1.039l-.745 4.797-4.542.801c-.535.094-.948.525-1.021 1.064s.211 1.063.703 1.297l4.07 1.932-.748 4.812c-.083.536.189 1.064.673 1.309.179.09.371.133.562.133.327 0 .65-.128.891-.372l3.512-3.561 4.518 2.145c.49.232 1.074.123 1.446-.272.372-.395.446-.984.185-1.459L13.625 9.73l3.165-3.208c.382-.387.469-.977.217-1.459-.254-.482-.793-.743-1.325-.65zm4.636 0l4.542.801L27.2.961c.258-.469.788-.72 1.312-.628.526.093.936.511 1.018 1.039l.745 4.797 4.542.801c.536.094.949.524 1.021 1.063s-.211 1.063-.703 1.297l-4.07 1.932.748 4.812c.083.536-.189 1.064-.673 1.309-.179.09-.371.133-.562.133-.327 0-.65-.128-.891-.372l-3.512-3.561-4.518 2.145c-.49.232-1.074.123-1.446-.272-.372-.395-.446-.984-.185-1.459l2.348-4.267-3.165-3.208c-.382-.387-.469-.977-.217-1.459.255-.482.794-.743 1.326-.65z"
+ />
+ </svg>
+ </button>
+ </div>
+ <div className="my-2 flex justify-end">
+ <Button
+ disabled={disableSubmit}
+ loading={mutation.isLoading}
+ onClick={async () => {
+ if (rating && comment) {
+ await sendFeedback(rating, comment);
+ }
+ }}>
+ {t("submit")}
+ </Button>
+ </div>
+ {mutation.isError && (
+ <div className="mb-4 flex bg-red-100 p-4 text-sm text-red-700">
+ <div className="flex-shrink-0">
+ <ExclamationIcon className="h-5 w-5" />
+ </div>
+ <div className="ml-3 flex-grow">
+ <p className="font-medium">{t("feedback_error")}</p>
+ <p>{t("please_try_again")}</p>
+ </div>
+ </div>
+ )}
+ </div>
+ </div>
);
}
diff --git a/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx b/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx
index 43e5640d8b0..985c307e3e3 100644
--- a/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx
+++ b/apps/web/ee/components/team/availability/TeamAvailabilityModal.tsx
@@ -2,9 +2,10 @@ import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import React, { useState, useEffect } from "react";
-import { WEBSITE_URL } from "@calcom/lib/constants";
+import { WEBAPP_URL } from "@calcom/lib/constants";
+import LicenseRequired from "@ee/components/LicenseRequired";
-import { trpc, inferQueryOutput } from "@lib/trpc";
+import { inferQueryOutput, trpc } from "@lib/trpc";
import Avatar from "@components/ui/Avatar";
import { DatePicker } from "@components/ui/form/DatePicker";
@@ -33,62 +34,66 @@ export default function TeamAvailabilityModal(props: Props) {
}, [utils, selectedTimeZone, selectedDate]);
return (
- <div className="flex max-h-[500px] min-h-[500px] flex-row space-x-8 rtl:space-x-reverse">
- <div className="min-w-64 w-64 space-y-5 p-5 pr-0">
- <div className="flex">
- <Avatar
- imageSrc={WEBSITE_URL + "/" + props.member?.username + "/avatar.png"}
- alt={props.member?.name || ""}
- className="h-14 w-14 rounded-full"
- />
- <div className="ml-3 inline-block pt-1">
- <span className="text-lg font-bold text-neutral-700">{props.member?.name}</span>
- <span className="-mt-1 block text-sm text-gray-400">{props.member?.email}</span>
+ <LicenseRequired>
+ <div className="flex max-h-[500px] min-h-[500px] flex-row space-x-8 rtl:space-x-reverse">
+ <div className="min-w-64 w-64 space-y-5 p-5 pr-0">
+ <div className="flex">
+ <Avatar
+ imageSrc={WEBAPP_URL + "/" + props.member?.username + "/avatar.png"}
+ alt={props.member?.name || ""}
+ className="h-14 w-14 rounded-full"
+ />
+ <div className="ml-3 inline-block pt-1">
+ <span className="text-lg font-bold text-neutral-700">{props.member?.name}</span>
+ <span className="-mt-1 block text-sm text-gray-400">{props.member?.email}</span>
+ </div>
+ </div>
+ <div className="flex flex-col">
+ <span className="font-bold text-gray-600">Date</span>
+ <DatePicker
+ date={selectedDate.toDate()}
+ onDatesChange={(newDate) => {
+ setSelectedDate(dayjs(newDate));
+ }}
+ />
+ </div>
+ <div>
+ <span className="font-bold text-gray-600">Timezone</span>
+ <TimezoneSelect
+ id="timeZone"
+ value={selectedTimeZone}
+ onChange={(timezone) => setSelectedTimeZone(timezone.value)}
+ classNamePrefix="react-select"
+ className="react-select-container mt-1 block w-full rounded-sm border border-gray-300 shadow-sm focus:border-neutral-800 focus:ring-neutral-800 sm:text-sm"
+ />
+ </div>
+ <div>
+ <span className="font-bold text-gray-600">Slot Length</span>
+ <Select
+ options={[
+ { value: 15, label: "15 minutes" },
+ { value: 30, label: "30 minutes" },
+ { value: 60, label: "60 minutes" },
+ ]}
+ isSearchable={false}
+ classNamePrefix="react-select"
+ className="react-select-container focus:ring-primary-500 focus:border-primary-500 block w-full min-w-0 flex-1 rounded-sm border border-gray-300 sm:text-sm"
+ value={{ value: frequency, label: `${frequency} minutes` }}
+ onChange={(newFrequency) => setFrequency(newFrequency?.value ?? 30)}
+ />
</div>
</div>
- <div className="flex flex-col">
- <span className="font-bold text-gray-600">Date</span>
- <DatePicker
- date={selectedDate.toDate()}
- onDatesChange={(newDate) => {
- setSelectedDate(dayjs(newDate));
- }}
- />
- </div>
- <div>
- <span className="font-bold text-gray-600">Timezone</span>
- <TimezoneSelect
- id="timeZone"
- value={selectedTimeZone}
- onChange={(timezone) => setSelectedTimeZone(timezone.value)}
- className="mt-1 block w-full rounded-sm border border-gray-300 shadow-sm sm:text-sm"
- />
- </div>
- <div>
- <span className="font-bold text-gray-600">Slot Length</span>
- <Select
- options={[
- { value: 15, label: "15 minutes" },
- { value: 30, label: "30 minutes" },
- { value: 60, label: "60 minutes" },
- ]}
- isSearchable={false}
- className="block w-full min-w-0 flex-1 rounded-sm border border-gray-300 sm:text-sm"
- value={{ value: frequency, label: `${frequency} minutes` }}
- onChange={(newFrequency) => setFrequency(newFrequency?.value ?? 30)}
+ {props.team && props.member && (
+ <TeamAvailabilityTimes
+ className="overflow-scroll"
+ teamId={props.team.id}
+ memberId={props.member.id}
+ frequency={frequency}
+ selectedDate={selectedDate}
+ selectedTimeZone={selectedTimeZone}
/>
- </div>
+ )}
</div>
- {props.team && props.member && (
- <TeamAvailabilityTimes
- className="overflow-auto"
- teamId={props.team.id}
- memberId={props.member.id}
- frequency={frequency}
- selectedDate={selectedDate}
- selectedTimeZone={selectedTimeZone}
- />
- )}
- </div>
+ </LicenseRequired>
);
}
diff --git a/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx b/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx
index fa5b6d61ee9..e81319719a0 100644
--- a/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx
+++ b/apps/web/ee/components/team/availability/TeamAvailabilityScreen.tsx
@@ -3,7 +3,7 @@ import React, { useState, useEffect, CSSProperties } from "react";
import AutoSizer from "react-virtualized-auto-sizer";
import { FixedSizeList as List } from "react-window";
-import { WEBSITE_URL } from "@calcom/lib/constants";
+import { CAL_URL } from "@calcom/lib/constants";
import { inferQueryOutput, trpc } from "@lib/trpc";
@@ -46,7 +46,7 @@ export default function TeamAvailabilityScreen(props: Props) {
HeaderComponent={
<div className="mb-6 flex items-center">
<Avatar
- imageSrc={WEBSITE_URL + "/" + member.username + "/avatar.png"}
+ imageSrc={CAL_URL + "/" + member.username + "/avatar.png"}
alt={member?.name || ""}
className="min-w-10 min-h-10 mt-1 h-10 w-10 rounded-full"
/>
diff --git a/apps/web/ee/components/web3/CryptoSection.tsx b/apps/web/ee/components/web3/CryptoSection.tsx
index 4d570429ee3..0056c65f85e 100644
--- a/apps/web/ee/components/web3/CryptoSection.tsx
+++ b/apps/web/ee/components/web3/CryptoSection.tsx
@@ -11,6 +11,7 @@ import { Button } from "@calcom/ui/Button";
import { useContracts } from "../../../contexts/contractsContext";
import genericAbi from "../../../web3/abis/abiWithGetBalance.json";
import verifyAccount, { AUTH_MESSAGE } from "../../../web3/utils/verifyAccount";
+import { withLicenseRequired } from "../LicenseRequired";
interface Window {
ethereum: AbstractProvider & { selectedAddress: string };
@@ -150,4 +151,4 @@ const CryptoSection = (props: CryptoSectionProps) => {
);
};
-export default CryptoSection;
+export default withLicenseRequired(CryptoSection);
diff --git a/apps/web/ee/lib/helpscout/HelpscoutMenuItem.tsx b/apps/web/ee/lib/helpscout/HelpscoutMenuItem.tsx
index 350af9ab4bf..016f884da9c 100644
--- a/apps/web/ee/lib/helpscout/HelpscoutMenuItem.tsx
+++ b/apps/web/ee/lib/helpscout/HelpscoutMenuItem.tsx
@@ -22,20 +22,12 @@ export default function HelpscoutMenuItem() {
else
return (
<>
- <DropdownMenuItem>
- <button
- onClick={handleClick}
- className="flex w-full px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-gray-100 hover:text-gray-900">
- <ChatAltIcon
- className={classNames(
- "text-neutral-400 group-hover:text-neutral-500",
- "h-5 w-5 flex-shrink-0 ltr:mr-3"
- )}
- aria-hidden="true"
- />
- {t("help")}
- </button>
- </DropdownMenuItem>
+ <button
+ onClick={handleClick}
+ className="flex w-full py-2 pr-4 text-sm font-medium text-neutral-700 hover:bg-gray-100 hover:text-gray-900">
+ {t("contact_support")}
+ </button>
+
{active && <HelpScout color="#292929" icon="message" horizontalPosition="right" zIndex="1" />}
</>
);
diff --git a/apps/web/ee/lib/impersonation/ImpersonationProvider.ts b/apps/web/ee/lib/impersonation/ImpersonationProvider.ts
index 331d5ba3c35..6d53b683f16 100644
--- a/apps/web/ee/lib/impersonation/ImpersonationProvider.ts
+++ b/apps/web/ee/lib/impersonation/ImpersonationProvider.ts
@@ -32,6 +32,10 @@ const ImpersonationProvider = CredentialsProvider({
throw new Error("This user does not exist");
}
+ if (user.disableImpersonation) {
+ throw new Error("This user has disabled Impersonation.");
+ }
+
// Log impersonations for audit purposes
await prisma.impersonations.create({
data: {
diff --git a/apps/web/ee/lib/intercom/IntercomMenuItem.tsx b/apps/web/ee/lib/intercom/IntercomMenuItem.tsx
index 65688e24886..e7e526c8619 100644
--- a/apps/web/ee/lib/intercom/IntercomMenuItem.tsx
+++ b/apps/web/ee/lib/intercom/IntercomMenuItem.tsx
@@ -13,22 +13,13 @@ export default function IntercomMenuItem() {
if (!process.env.NEXT_PUBLIC_INTERCOM_APP_ID) return null;
else
return (
- <DropdownMenuItem>
- <button
- onClick={() => {
- boot();
- show();
- }}
- className="flex w-full px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-gray-100 hover:text-gray-900">
- <ChatAltIcon
- className={classNames(
- "text-neutral-400 group-hover:text-neutral-500",
- "h-5 w-5 flex-shrink-0 ltr:mr-3"
- )}
- aria-hidden="true"
- />
- {t("help")}
- </button>
- </DropdownMenuItem>
+ <button
+ onClick={() => {
+ boot();
+ show();
+ }}
+ className="flex w-full py-2 pr-4 text-sm font-medium text-neutral-700 hover:bg-gray-100 hover:text-gray-900">
+ {t("contact_support")}
+ </button>
);
}
diff --git a/apps/web/ee/lib/zendesk/ZendeskMenuItem.tsx b/apps/web/ee/lib/zendesk/ZendeskMenuItem.tsx
index 706495f4c2b..2d7014f1480 100644
--- a/apps/web/ee/lib/zendesk/ZendeskMenuItem.tsx
+++ b/apps/web/ee/lib/zendesk/ZendeskMenuItem.tsx
@@ -17,20 +17,11 @@ export default function ZendeskMenuItem() {
else
return (
<>
- <DropdownMenuItem>
- <button
- onClick={() => setActive(true)}
- className="flex w-full px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-gray-100 hover:text-gray-900">
- <ChatAltIcon
- className={classNames(
- "text-neutral-400 group-hover:text-neutral-500",
- "h-5 w-5 flex-shrink-0 ltr:mr-3"
- )}
- aria-hidden="true"
- />
- {t("help")}
- </button>
- </DropdownMenuItem>
+ <button
+ onClick={() => setActive(true)}
+ className="flex w-full py-2 pr-4 text-sm font-medium text-neutral-700 hover:bg-gray-100 hover:text-gray-900">
+ {t("contact_support")}
+ </button>
{active && (
<Script id="ze-snippet" src={"https://static.zdassets.com/ekr/snippet.js?key=" + ZENDESK_KEY} />
)}
diff --git a/apps/web/ee/pages/settings/teams/[id]/availability.tsx b/apps/web/ee/pages/settings/teams/[id]/availability.tsx
index 49cba9598cb..d920cfb6aa1 100644
--- a/apps/web/ee/pages/settings/teams/[id]/availability.tsx
+++ b/apps/web/ee/pages/settings/teams/[id]/availability.tsx
@@ -2,6 +2,7 @@ import { useRouter } from "next/router";
import { useMemo, useState } from "react";
import { Alert } from "@calcom/ui/Alert";
+import LicenseRequired from "@ee/components/LicenseRequired";
import TeamAvailabilityScreen from "@ee/components/team/availability/TeamAvailabilityScreen";
import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";
@@ -49,17 +50,19 @@ export function TeamAvailabilityPage() {
/>
)
}>
- {!!errorMessage && <Alert className="-mt-24 border" severity="error" title={errorMessage} />}
- {isLoading && <Loader />}
- {isFreeUser ? (
- <Alert
- className="-mt-24 border"
- severity="warning"
- title="This is a pro feature. Upgrade to pro to see your team's availability."
- />
- ) : (
- TeamAvailability
- )}
+ <LicenseRequired>
+ {!!errorMessage && <Alert className="-mt-24 border" severity="error" title={errorMessage} />}
+ {isLoading && <Loader />}
+ {isFreeUser ? (
+ <Alert
+ className="-mt-24 border"
+ severity="warning"
+ title="This is a pro feature. Upgrade to pro to see your team's availability."
+ />
+ ) : (
+ TeamAvailability
+ )}
+ </LicenseRequired>
</Shell>
);
}
diff --git a/apps/web/lib/ErrorBoundary.tsx b/apps/web/lib/ErrorBoundary.tsx
new file mode 100644
index 00000000000..9fee8fa915f
--- /dev/null
+++ b/apps/web/lib/ErrorBoundary.tsx
@@ -0,0 +1,35 @@
+import React, { ErrorInfo } from "react";
+
+class ErrorBoundary extends React.Component<
+ { children: React.ReactNode },
+ { error: Error | null; errorInfo: ErrorInfo | null }
+> {
+ constructor(props: { children: React.ReactNode } | Readonly<{ children: React.ReactNode }>) {
+ super(props);
+ this.state = { error: null, errorInfo: null };
+ }
+
+ componentDidCatch?(error: Error, errorInfo: ErrorInfo) {
+ // Catch errors in any components below and re-render with error message
+ this.setState({ error, errorInfo });
+ // You can also log error messages to an error reporting service here
+ }
+
+ render() {
+ if (this.state.errorInfo) {
+ // Error path
+ return (
+ <div>
+ <h2>Something went wrong.</h2>
+ <details style={{ whiteSpace: "pre-wrap" }}>
+ {this.state.error && this.state.error.toString()}
+ </details>
+ </div>
+ );
+ }
+ // Normally, just render children
+ return this.props.children;
+ }
+}
+
+export default ErrorBoundary;
diff --git a/apps/web/lib/app-providers.tsx b/apps/web/lib/app-providers.tsx
index 6fb3f977179..d6f6bfa333f 100644
--- a/apps/web/lib/app-providers.tsx
+++ b/apps/web/lib/app-providers.tsx
@@ -16,7 +16,8 @@ const I18nextAdapter = appWithTranslation<NextJsAppProps & { children: React.Rea
));
// Workaround for https://github.com/vercel/next.js/issues/8592
-export type AppProps = NextAppProps & {
+export type AppProps = Omit<NextAppProps, "Component"> & {
+ Component: NextAppProps["Component"] & { requiresLicense?: boolean };
/** Will be defined only is there was an error */
err?: Error;
};
diff --git a/apps/web/lib/emails/email-manager.ts b/apps/web/lib/emails/email-manager.ts
index ae230c1e5f0..163e6d9f8c2 100644
--- a/apps/web/lib/emails/email-manager.ts
+++ b/apps/web/lib/emails/email-manager.ts
@@ -3,12 +3,15 @@ import type { CalendarEvent, Person, RecurringEvent } from "@calcom/types/Calend
import AttendeeAwaitingPaymentEmail from "@lib/emails/templates/attendee-awaiting-payment-email";
import AttendeeCancelledEmail from "@lib/emails/templates/attendee-cancelled-email";
import AttendeeDeclinedEmail from "@lib/emails/templates/attendee-declined-email";
+import AttendeeLocationChangeEmail from "@lib/emails/templates/attendee-location-change-email";
import AttendeeRequestEmail from "@lib/emails/templates/attendee-request-email";
import AttendeeRequestRescheduledEmail from "@lib/emails/templates/attendee-request-reschedule-email";
import AttendeeRescheduledEmail from "@lib/emails/templates/attendee-rescheduled-email";
import AttendeeScheduledEmail from "@lib/emails/templates/attendee-scheduled-email";
+import FeedbackEmail, { Feedback } from "@lib/emails/templates/feedback-email";
import ForgotPasswordEmail, { PasswordReset } from "@lib/emails/templates/forgot-password-email";
import OrganizerCancelledEmail from "@lib/emails/templates/organizer-cancelled-email";
+import OrganizerLocationChangeEmail from "@lib/emails/templates/organizer-location-change-email";
import OrganizerPaymentRefundFailedEmail from "@lib/emails/templates/organizer-payment-refund-failed-email";
import OrganizerRequestEmail from "@lib/emails/templates/organizer-request-email";
import OrganizerRequestReminderEmail from "@lib/emails/templates/organizer-request-reminder-email";
@@ -266,3 +269,46 @@ export const sendRequestRescheduleEmail = async (
await Promise.all(emailsToSend);
};
+
+export const sendLocationChangeEmails = async (
+ calEvent: CalendarEvent,
+ recurringEvent: RecurringEvent = {}
+) => {
+ const emailsToSend: Promise<unknown>[] = [];
+
+ emailsToSend.push(
+ ...calEvent.attendees.map((attendee) => {
+ return new Promise((resolve, reject) => {
+ try {
+ const scheduledEmail = new AttendeeLocationChangeEmail(calEvent, attendee, recurringEvent);
+ resolve(scheduledEmail.sendEmail());
+ } catch (e) {
+ reject(console.error("AttendeeLocationChangeEmail.sendEmail failed", e));
+ }
+ });
+ })
+ );
+
+ emailsToSend.push(
+ new Promise((resolve, reject) => {
+ try {
+ const scheduledEmail = new OrganizerLocationChangeEmail(calEvent, recurringEvent);
+ resolve(scheduledEmail.sendEmail());
+ } catch (e) {
+ reject(console.error("OrganizerLocationChangeEmail.sendEmail failed", e));
+ }
+ })
+ );
+
+ await Promise.all(emailsToSend);
+};
+export const sendFeedbackEmail = async (feedback: Feedback) => {
+ await new Promise((resolve, reject) => {
+ try {
+ const feedbackEmail = new FeedbackEmail(feedback);
+ resolve(feedbackEmail.sendEmail());
+ } catch (e) {
+ reject(console.error("FeedbackEmail.sendEmail failed", e));
+ }
+ });
+};
diff --git a/apps/web/lib/emails/templates/attendee-location-change-email.ts b/apps/web/lib/emails/templates/attendee-location-change-email.ts
new file mode 100644
index 00000000000..611ebe269d3
--- /dev/null
+++ b/apps/web/lib/emails/templates/attendee-location-change-email.ts
@@ -0,0 +1,165 @@
+import dayjs from "dayjs";
+import localizedFormat from "dayjs/plugin/localizedFormat";
+import timezone from "dayjs/plugin/timezone";
+import toArray from "dayjs/plugin/toArray";
+import utc from "dayjs/plugin/utc";
+
+import { getCancelLink } from "@calcom/lib/CalEventParser";
+
+import AttendeeScheduledEmail from "./attendee-scheduled-email";
+import {
+ emailHead,
+ emailSchedulingBodyHeader,
+ emailBodyLogo,
+ emailScheduledBodyHeaderContent,
+ emailSchedulingBodyDivider,
+} from "./common";
+
+dayjs.extend(utc);
+dayjs.extend(timezone);
+dayjs.extend(localizedFormat);
+dayjs.extend(toArray);
+
+export default class AttendeeLocationChangeEmail extends AttendeeScheduledEmail {
+ protected getNodeMailerPayload(): Record<string, unknown> {
+ return {
+ icalEvent: {
+ filename: "event.ics",
+ content: this.getiCalEventAsString(),
+ },
+ to: `${this.attendee.name} <${this.attendee.email}>`,
+ from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
+ replyTo: this.calEvent.organizer.email,
+ subject: `${this.attendee.language.translate("location_changed_event_type_subject", {
+ eventType: this.calEvent.type,
+ name: this.calEvent.team?.name || this.calEvent.organizer.name,
+ date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format(
+ "h:mma"
+ )}, ${this.attendee.language.translate(
+ this.getInviteeStart().format("dddd").toLowerCase()
+ )}, ${this.attendee.language.translate(
+ this.getInviteeStart().format("MMMM").toLowerCase()
+ )} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,
+ })}`,
+ html: this.getHtmlBody(),
+ text: this.getTextBody(),
+ };
+ }
+ protected getTextBody(): string {
+ // Only the original attendee can make changes to the event
+ // Guests cannot
+ if (this.attendee === this.calEvent.attendees[0]) {
+ return `
+ ${this.attendee.language.translate("event_location_changed")}
+ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")}
+ ${this.getWhat()}
+ ${this.getWhen()}
+ ${this.getLocation()}
+ ${this.getDescription()}
+ ${this.getAdditionalNotes()}
+ ${this.attendee.language.translate("need_to_reschedule_or_cancel")}
+ ${getCancelLink(this.calEvent)}
+ `.replace(/(<([^>]+)>)/gi, "");
+ }
+
+ return `
+${this.attendee.language.translate("event_location_changed")}
+${this.attendee.language.translate("emailed_you_and_any_other_attendees")}
+${this.getWhat()}
+${this.getWhen()}
+${this.getLocation()}
+${this.getAdditionalNotes()}
+`.replace(/(<([^>]+)>)/gi, "");
+ }
+
+ protected getHtmlBody(): string {
+ const headerContent = this.attendee.language.translate("location_changed_event_type_subject", {
+ eventType: this.calEvent.type,
+ name: this.calEvent.team?.name || this.calEvent.organizer.name,
+ date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format(
+ "h:mma"
+ )}, ${this.attendee.language.translate(
+ this.getInviteeStart().format("dddd").toLowerCase()
+ )}, ${this.attendee.language.translate(
+ this.getInviteeStart().format("MMMM").toLowerCase()
+ )} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,
+ });
+
+ return `
+ <!doctype html>
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
+ ${emailHead(headerContent)}
+ <body style="word-spacing:normal;background-color:#F5F5F5;">
+ <div style="background-color:#F5F5F5;">
+ ${emailSchedulingBodyHeader("calendarCircle")}
+ ${emailScheduledBodyHeaderContent(
+ this.attendee.language.translate("event_location_changed"),
+ this.attendee.language.translate("emailed_you_and_any_other_attendees")
+ )}
+ ${emailSchedulingBodyDivider()}
+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
+ <div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
+ <tbody>
+ <tr>
+ <td style="border-left:1px solid #E1E1E1;border-right:1px solid #E1E1E1;direction:ltr;font-size:0px;padding:0px;text-align:center;">
+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:598px;" ><![endif]-->
+ <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
+ <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
+ <tbody>
+ <tr>
+ <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
+ <div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.getWhat()}
+ ${this.getWhen()}
+ ${this.getWho()}
+ ${this.getLocation()}
+ ${this.getDescription()}
+ ${this.getAdditionalNotes()}
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ ${emailSchedulingBodyDivider()}
+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
+ <div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
+ <tbody>
+ <tr>
+ <td style="border-bottom:1px solid #E1E1E1;border-left:1px solid #E1E1E1;border-right:1px solid #E1E1E1;direction:ltr;font-size:0px;padding:0px;text-align:center;">
+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:598px;" ><![endif]-->
+ <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
+ <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
+ <tbody>
+ <tr>
+ <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
+ <div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:0px;text-align:left;color:#3E3E3E;">
+ ${this.getManageLink()}
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ ${emailBodyLogo()}
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </div>
+ </body>
+ </html>
+ `;
+ }
+}
diff --git a/apps/web/lib/emails/templates/attendee-request-reschedule-email.ts b/apps/web/lib/emails/templates/attendee-request-reschedule-email.ts
index 1a6ec58d744..58a5c9e553f 100644
--- a/apps/web/lib/emails/templates/attendee-request-reschedule-email.ts
+++ b/apps/web/lib/emails/templates/attendee-request-reschedule-email.ts
@@ -102,6 +102,7 @@ ${this.calEvent.organizer.language.translate("request_reschedule_title_attendee"
${this.calEvent.organizer.language.translate("request_reschedule_subtitle", {
organizer: this.calEvent.organizer.name,
})},
+${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getAdditionalNotes()}
@@ -151,6 +152,7 @@ ${getCancelLink(this.calEvent)}
<tr>
<td align="left" style="font-size:0px;padding:10px 40px;word-break:break-word;">
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getWho()}
diff --git a/apps/web/lib/emails/templates/attendee-rescheduled-email.ts b/apps/web/lib/emails/templates/attendee-rescheduled-email.ts
index 804b81ce3f0..1ad39fec148 100644
--- a/apps/web/lib/emails/templates/attendee-rescheduled-email.ts
+++ b/apps/web/lib/emails/templates/attendee-rescheduled-email.ts
@@ -52,6 +52,7 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
return `
${this.attendee.language.translate("event_has_been_rescheduled")}
${this.attendee.language.translate("emailed_you_and_any_other_attendees")}
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getLocation()}
@@ -112,6 +113,7 @@ ${this.getCustomInputs()}
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getWho()}
diff --git a/apps/web/lib/emails/templates/attendee-scheduled-email.ts b/apps/web/lib/emails/templates/attendee-scheduled-email.ts
index 91f4afc0817..68671b275d4 100644
--- a/apps/web/lib/emails/templates/attendee-scheduled-email.ts
+++ b/apps/web/lib/emails/templates/attendee-scheduled-email.ts
@@ -428,12 +428,13 @@ ${getRichDescription(this.calEvent)}
<p style="color: #494949; font-weight: 400; line-height: 24px;">${
providerName || this.calEvent.location
}</p>
- <p style="color: #494949; font-weight: 400; line-height: 24px;">${
- (providerName === "Zoom" || providerName === "Google") &&
- `
- ${this.calEvent.organizer.language.translate("meeting_url_provided_after_confirmed")}
- `
- }</p>
+ ${
+ providerName === "Zoom" || providerName === "Google"
+ ? `<p style="color: #494949; font-weight: 400; line-height: 24px;">
+ ${this.calEvent.organizer.language.translate("meeting_url_provided_after_confirmed")}
+ </p>`
+ : ``
+ }
</div>
`;
}
@@ -451,4 +452,12 @@ ${getRichDescription(this.calEvent)}
protected getInviteeEnd(): Dayjs {
return dayjs(this.calEvent.endTime).tz(this.getTimezone());
}
+
+ protected getReason(): string {
+ return `
+ <div style="line-height: 6px; margin-bottom: 24px;">
+ <p style="color: #494949;">${this.calEvent.attendees[0].language.translate("reschedule_reason")}</p>
+ <p style="color: #494949; font-weight: 400; line-height: 24px;">${this.calEvent.cancellationReason}</p>
+ </div>`;
+ }
}
diff --git a/apps/web/lib/emails/templates/feedback-email.ts b/apps/web/lib/emails/templates/feedback-email.ts
new file mode 100644
index 00000000000..b39a6f3ef28
--- /dev/null
+++ b/apps/web/lib/emails/templates/feedback-email.ts
@@ -0,0 +1,118 @@
+import BaseEmail from "@lib/emails/templates/_base-email";
+
+import { emailHead, emailBodyLogo } from "./common";
+
+export interface Feedback {
+ userId: number;
+ rating: string;
+ comment: string;
+}
+
+export default class FeedbackEmail extends BaseEmail {
+ feedback: Feedback;
+
+ constructor(feedback: Feedback) {
+ super();
+ this.feedback = feedback;
+ }
+
+ protected getNodeMailerPayload(): Record<string, unknown> {
+ return {
+ from: `Cal.com <${this.getMailerOptions().from}>`,
+ to: process.env.SEND_FEEDBACK_EMAIL,
+ subject: `User Feedback`,
+ html: this.getHtmlBody(),
+ text: this.getTextBody(),
+ };
+ }
+
+ protected getTextBody(): string {
+ return `
+ userId: ${this.feedback.userId}
+ rating: ${this.feedback.rating}
+ comment: ${this.feedback.comment}
+ `;
+ }
+
+ protected getHtmlBody(): string {
+ return `
+ <!doctype html>
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
+ ${emailHead("Feedback")}
+ <body style="word-spacing:normal;background-color:#F5F5F5;">
+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
+ <div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
+ <tbody>
+ <tr>
+ <td style="border-left:1px solid #E1E1E1;border-right:1px solid #E1E1E1;direction:ltr;font-size:0px;padding:0px;text-align:center;">
+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:598px;" ><![endif]-->
+ <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
+ <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
+ <tbody>
+ <tr>
+ <td align="center" style="font-size:0px;padding:10px 25px;padding-top:24px;padding-bottom:0px;word-break:break-word;">
+ <div style="font-family:Roboto, Helvetica, sans-serif;font-size:24px;font-weight:700;line-height:24px;text-align:center;color:#292929;">Feedback</div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div style="background-color:#F5F5F5;">
+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
+ <div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
+ <tbody>
+ <tr>
+ <td style="border-left:1px solid #E1E1E1;border-right:1px solid #E1E1E1;direction:ltr;font-size:0px;padding:0px;text-align:center;">
+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:598px;" ><![endif]-->
+ <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
+ <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
+ <tbody>
+ <tr>
+ <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
+ <div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ <div style="line-height: 6px;">
+ <p style="color: #494949;">Used id</p>
+ <p style="color: #494949; font-weight: 400; line-height: 24px;">${
+ this.feedback.userId
+ }</p>
+ </div>
+ <div style="line-height: 6px;">
+ <p style="color: #494949;">Rating</p>
+ <p style="color: #494949; font-weight: 400; line-height: 24px;">${
+ this.feedback.rating
+ }</p>
+ </div>
+ <div style="line-height: 6px;">
+ <p style="color: #494949;">Comment</p>
+ <p style="color: #494949; font-weight: 400; line-height: 24px;">${
+ this.feedback.comment
+ }</p>
+ </div>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ ${emailBodyLogo()}
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </div>
+ </body>
+ </html>
+ `;
+ }
+}
diff --git a/apps/web/lib/emails/templates/organizer-location-change-email.ts b/apps/web/lib/emails/templates/organizer-location-change-email.ts
new file mode 100644
index 00000000000..15bb3b6b552
--- /dev/null
+++ b/apps/web/lib/emails/templates/organizer-location-change-email.ts
@@ -0,0 +1,162 @@
+import dayjs from "dayjs";
+import localizedFormat from "dayjs/plugin/localizedFormat";
+import timezone from "dayjs/plugin/timezone";
+import toArray from "dayjs/plugin/toArray";
+import utc from "dayjs/plugin/utc";
+
+import { getCancelLink } from "@calcom/lib/CalEventParser";
+
+import {
+ emailHead,
+ emailSchedulingBodyHeader,
+ emailBodyLogo,
+ emailScheduledBodyHeaderContent,
+ emailSchedulingBodyDivider,
+} from "./common";
+import OrganizerScheduledEmail from "./organizer-scheduled-email";
+
+dayjs.extend(utc);
+dayjs.extend(timezone);
+dayjs.extend(localizedFormat);
+dayjs.extend(toArray);
+
+export default class OrganizerLocationChangeEmail extends OrganizerScheduledEmail {
+ protected getNodeMailerPayload(): Record<string, unknown> {
+ const toAddresses = [this.calEvent.organizer.email];
+ if (this.calEvent.team) {
+ this.calEvent.team.members.forEach((member) => {
+ const memberAttendee = this.calEvent.attendees.find((attendee) => attendee.name === member);
+ if (memberAttendee) {
+ toAddresses.push(memberAttendee.email);
+ }
+ });
+ }
+
+ return {
+ icalEvent: {
+ filename: "event.ics",
+ content: this.getiCalEventAsString(),
+ },
+ from: `Cal.com <${this.getMailerOptions().from}>`,
+ to: toAddresses.join(","),
+ subject: `${this.calEvent.organizer.language.translate("location_changed_event_type_subject", {
+ eventType: this.calEvent.type,
+ name: this.calEvent.attendees[0].name,
+ date: `${this.getOrganizerStart().format("h:mma")} - ${this.getOrganizerEnd().format(
+ "h:mma"
+ )}, ${this.calEvent.organizer.language.translate(
+ this.getOrganizerStart().format("dddd").toLowerCase()
+ )}, ${this.calEvent.organizer.language.translate(
+ this.getOrganizerStart().format("MMMM").toLowerCase()
+ )} ${this.getOrganizerStart().format("D")}, ${this.getOrganizerStart().format("YYYY")}`,
+ })}`,
+ html: this.getHtmlBody(),
+ text: this.getTextBody(),
+ };
+ }
+
+ protected getTextBody(): string {
+ return `
+${this.calEvent.organizer.language.translate("event_location_changed")}
+${this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendees")}
+${this.getWhat()}
+${this.getWhen()}
+${this.getLocation()}
+${this.getDescription()}
+${this.getAdditionalNotes()}
+${this.calEvent.organizer.language.translate("need_to_reschedule_or_cancel")}
+${getCancelLink(this.calEvent)}
+`.replace(/(<([^>]+)>)/gi, "");
+ }
+
+ protected getHtmlBody(): string {
+ const headerContent = this.calEvent.organizer.language.translate("location_changed_event_type_subject", {
+ eventType: this.calEvent.type,
+ name: this.calEvent.attendees[0].name,
+ date: `${this.getOrganizerStart().format("h:mma")} - ${this.getOrganizerEnd().format(
+ "h:mma"
+ )}, ${this.calEvent.organizer.language.translate(
+ this.getOrganizerStart().format("dddd").toLowerCase()
+ )}, ${this.calEvent.organizer.language.translate(
+ this.getOrganizerStart().format("MMMM").toLowerCase()
+ )} ${this.getOrganizerStart().format("D")}, ${this.getOrganizerStart().format("YYYY")}`,
+ });
+
+ return `
+ <!doctype html>
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
+ ${emailHead(headerContent)}
+ <body style="word-spacing:normal;background-color:#F5F5F5;">
+ <div style="background-color:#F5F5F5;">
+ ${emailSchedulingBodyHeader("calendarCircle")}
+ ${emailScheduledBodyHeaderContent(
+ this.calEvent.organizer.language.translate("event_location_changed"),
+ this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendees")
+ )}
+ ${emailSchedulingBodyDivider()}
+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
+ <div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
+ <tbody>
+ <tr>
+ <td style="border-left:1px solid #E1E1E1;border-right:1px solid #E1E1E1;direction:ltr;font-size:0px;padding:0px;text-align:center;">
+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:598px;" ><![endif]-->
+ <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
+ <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
+ <tbody>
+ <tr>
+ <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
+ <div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.getWhat()}
+ ${this.getWhen()}
+ ${this.getWho()}
+ ${this.getLocation()}
+ ${this.getDescription()}
+ ${this.getAdditionalNotes()}
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ ${emailSchedulingBodyDivider()}
+ <!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
+ <div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
+ <tbody>
+ <tr>
+ <td style="border-bottom:1px solid #E1E1E1;border-left:1px solid #E1E1E1;border-right:1px solid #E1E1E1;direction:ltr;font-size:0px;padding:0px;text-align:center;">
+ <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:598px;" ><![endif]-->
+ <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
+ <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
+ <tbody>
+ <tr>
+ <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
+ <div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:0px;text-align:left;color:#3E3E3E;">
+ ${this.getManageLink()}
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ ${emailBodyLogo()}
+ <!--[if mso | IE]></td></tr></table><![endif]-->
+ </div>
+ </body>
+ </html>
+ `;
+ }
+}
diff --git a/apps/web/lib/emails/templates/organizer-request-reschedule-email.ts b/apps/web/lib/emails/templates/organizer-request-reschedule-email.ts
index 76671fda18a..b6251456b24 100644
--- a/apps/web/lib/emails/templates/organizer-request-reschedule-email.ts
+++ b/apps/web/lib/emails/templates/organizer-request-reschedule-email.ts
@@ -111,6 +111,7 @@ ${this.calEvent.organizer.language.translate("request_reschedule_title_organizer
${this.calEvent.organizer.language.translate("request_reschedule_subtitle_organizer", {
attendee: this.calEvent.attendees[0].name,
})},
+${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getLocation()}
@@ -163,6 +164,7 @@ ${getCancelLink(this.calEvent)}
<tr>
<td align="left" style="font-size:0px;padding:10px 40px;word-break:break-word;">
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getWho()}
diff --git a/apps/web/lib/emails/templates/organizer-rescheduled-email.ts b/apps/web/lib/emails/templates/organizer-rescheduled-email.ts
index 6dd315225a9..6f33489d5c8 100644
--- a/apps/web/lib/emails/templates/organizer-rescheduled-email.ts
+++ b/apps/web/lib/emails/templates/organizer-rescheduled-email.ts
@@ -59,6 +59,7 @@ export default class OrganizerRescheduledEmail extends OrganizerScheduledEmail {
return `
${this.calEvent.organizer.language.translate("event_has_been_rescheduled")}
${this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendees")}
+${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getLocation()}
@@ -108,6 +109,7 @@ ${getCancelLink(this.calEvent)}
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getWho()}
diff --git a/apps/web/lib/emails/templates/organizer-scheduled-email.ts b/apps/web/lib/emails/templates/organizer-scheduled-email.ts
index 75c0254ae31..a6f251c0ee6 100644
--- a/apps/web/lib/emails/templates/organizer-scheduled-email.ts
+++ b/apps/web/lib/emails/templates/organizer-scheduled-email.ts
@@ -417,12 +417,13 @@ ${getRichDescription(this.calEvent)}
<p style="color: #494949; font-weight: 400; line-height: 24px;">${
providerName || this.calEvent.location
}</p>
- <p style="color: #494949; font-weight: 400; line-height: 24px;">${
- (providerName === "Zoom" || providerName === "Google") &&
- `
- ${this.calEvent.organizer.language.translate("meeting_url_provided_after_confirmed")}
- `
- }</p>
+ ${
+ providerName === "Zoom" || providerName === "Google"
+ ? `<p style="color: #494949; font-weight: 400; line-height: 24px;">
+ ${this.calEvent.organizer.language.translate("meeting_url_provided_after_confirmed")}
+ </p>`
+ : ``
+ }
</div>
`;
}
@@ -438,4 +439,12 @@ ${getRichDescription(this.calEvent)}
protected getOrganizerEnd(): Dayjs {
return dayjs(this.calEvent.endTime).tz(this.getTimezone());
}
+
+ protected getReason(): string {
+ return `
+ <div style="line-height: 6px; margin-bottom: 24px;">
+ <p style="color: #494949;">${this.calEvent.attendees[0].language.translate("reschedule_reason")}</p>
+ <p style="color: #494949; font-weight: 400; line-height: 24px;">${this.calEvent.cancellationReason}</p>
+ </div>`;
+ }
}
diff --git a/apps/web/lib/hooks/useSlots.ts b/apps/web/lib/hooks/useSlots.ts
index 2b1a28c21d9..d2ea3d0bc54 100644
--- a/apps/web/lib/hooks/useSlots.ts
+++ b/apps/web/lib/hooks/useSlots.ts
@@ -6,7 +6,7 @@ import { stringify } from "querystring";
import { useEffect, useState } from "react";
import getSlots from "@lib/slots";
-import { TimeRange, WorkingHours } from "@lib/types/schedule";
+import { CurrentSeats, TimeRange, WorkingHours } from "@lib/types/schedule";
dayjs.extend(isBetween);
dayjs.extend(utc);
@@ -15,11 +15,14 @@ type AvailabilityUserResponse = {
busy: TimeRange[];
timeZone: string;
workingHours: WorkingHours[];
+ currentSeats?: CurrentSeats[];
};
type Slot = {
time: Dayjs;
users?: string[];
+ bookingUid?: string;
+ attendees?: number;
};
type UseSlotsProps = {
@@ -40,10 +43,11 @@ type getFilteredTimesProps = {
eventLength: number;
beforeBufferTime: number;
afterBufferTime: number;
+ currentSeats?: CurrentSeats[];
};
export const getFilteredTimes = (props: getFilteredTimesProps) => {
- const { times, busy, eventLength, beforeBufferTime, afterBufferTime } = props;
+ const { times, busy, eventLength, beforeBufferTime, afterBufferTime, currentSeats } = props;
const finalizationTime = times[times.length - 1]?.add(eventLength, "minutes");
// Check for conflicts
for (let i = times.length - 1; i >= 0; i -= 1) {
@@ -56,6 +60,10 @@ export const getFilteredTimes = (props: getFilteredTimesProps) => {
const slotStartTime = times[i];
const slotEndTime = times[i].add(eventLength, "minutes");
const slotStartTimeWithBeforeBuffer = times[i].subtract(beforeBufferTime, "minutes");
+ // If the event has seats then see if there is already a booking (want to show full bookings as well)
+ if (currentSeats?.some((booking) => booking.startTime === slotStartTime.toISOString())) {
+ break;
+ }
busy.every((busyTime): boolean => {
const startTime = dayjs(busyTime.start);
const endTime = dayjs(busyTime.end);
@@ -124,19 +132,21 @@ export const useSlots = (props: UseSlotsProps) => {
const handleAvailableSlots = async (res: Response) => {
const responseBody: AvailabilityUserResponse = await res.json();
+ const { workingHours, busy, currentSeats } = responseBody;
const times = getSlots({
frequency: slotInterval || eventLength,
inviteeDate: date,
- workingHours: responseBody.workingHours,
+ workingHours,
minimumBookingNotice,
eventLength,
});
const filterTimeProps = {
times,
- busy: responseBody.busy,
+ busy,
eventLength,
beforeBufferTime,
afterBufferTime,
+ currentSeats,
};
const filteredTimes = getFilteredTimes(filterTimeProps);
// temporary
@@ -144,6 +154,14 @@ export const useSlots = (props: UseSlotsProps) => {
return filteredTimes.map((time) => ({
time,
users: [user],
+ // Conditionally add the attendees and booking id to slots object if there is already a booking during that time
+ ...(currentSeats?.some((booking) => booking.startTime === time.toISOString()) && {
+ attendees:
+ currentSeats[currentSeats.findIndex((booking) => booking.startTime === time.toISOString())]._count
+ .attendees,
+ bookingUid:
+ currentSeats[currentSeats.findIndex((booking) => booking.startTime === time.toISOString())].uid,
+ }),
}));
};
diff --git a/apps/web/lib/hooks/useTheme.tsx b/apps/web/lib/hooks/useTheme.tsx
index 5c93b74623a..25d6e511c13 100644
--- a/apps/web/lib/hooks/useTheme.tsx
+++ b/apps/web/lib/hooks/useTheme.tsx
@@ -1,7 +1,7 @@
import Head from "next/head";
import { useEffect, useState } from "react";
-import { useEmbedTheme } from "@calcom/embed-core";
+import { useEmbedTheme } from "@calcom/embed-core/embed-iframe";
import { Maybe } from "@trpc/server";
diff --git a/apps/web/lib/linkValueToString.ts b/apps/web/lib/linkValueToString.ts
new file mode 100644
index 00000000000..777296a4514
--- /dev/null
+++ b/apps/web/lib/linkValueToString.ts
@@ -0,0 +1,41 @@
+import { TFunction } from "next-i18next";
+
+import { LocationType } from "./location";
+
+/**
+ * Use this function to translate booking location value to a readable string
+ * @param linkValue
+ * @param translationFunction
+ * @returns
+ */
+export const linkValueToString = (
+ linkValue: string | undefined | null,
+ translationFunction: TFunction
+): string => {
+ const t = translationFunction;
+ if (!linkValue) {
+ return translationFunction("no_location");
+ }
+ switch (linkValue) {
+ case LocationType.InPerson:
+ return t("in_person_meeting");
+ case LocationType.UserPhone:
+ return t("user_phone");
+ case LocationType.GoogleMeet:
+ return `Google Meet: ${t("meeting_url_in_conformation_email")}`;
+ case LocationType.Zoom:
+ return `Zoom: ${t("meeting_url_in_conformation_email")}`;
+ case LocationType.Daily:
+ return `Cal Video: ${t("meeting_url_in_conformation_email")}`;
+ case LocationType.Jitsi:
+ return `Jitsi: ${t("meeting_url_in_conformation_email")}`;
+ case LocationType.Huddle01:
+ return `Huddle01t: ${t("meeting_url_in_conformation_email")}`;
+ case LocationType.Tandem:
+ return `Tandem: ${t("meeting_url_in_conformation_email")}`;
+ case LocationType.Teams:
+ return `Teams: ${t("meeting_url_in_conformation_email")}`;
+ default:
+ return linkValue || "";
+ }
+};
diff --git a/apps/web/lib/locationOptions.tsx b/apps/web/lib/locationOptions.tsx
index c0d3b9d0d6a..c9d96287fba 100644
--- a/apps/web/lib/locationOptions.tsx
+++ b/apps/web/lib/locationOptions.tsx
@@ -2,6 +2,12 @@ import { TFunction } from "next-i18next";
import { LocationType } from "./location";
+/**
+ * Use this function for translating event location to a readable string
+ * @param location
+ * @param t
+ * @returns string
+ */
export const LocationOptionsToString = (location: string, t: TFunction) => {
switch (location) {
case LocationType.InPerson:
diff --git a/apps/web/lib/slots.ts b/apps/web/lib/slots.ts
index f7011edf47b..fb8ac14bedc 100644
--- a/apps/web/lib/slots.ts
+++ b/apps/web/lib/slots.ts
@@ -4,7 +4,7 @@ import isToday from "dayjs/plugin/isToday";
import utc from "dayjs/plugin/utc";
import { getWorkingHours } from "./availability";
-import { WorkingHours } from "./types/schedule";
+import { WorkingHours, CurrentSeats } from "./types/schedule";
dayjs.extend(isToday);
dayjs.extend(utc);
@@ -16,6 +16,7 @@ export type GetSlots = {
workingHours: WorkingHours[];
minimumBookingNotice: number;
eventLength: number;
+ currentSeats?: CurrentSeats[];
};
export type WorkingHoursTimeFrame = { startTime: number; endTime: number };
@@ -42,7 +43,14 @@ const splitAvailableTime = (
return result;
};
-const getSlots = ({ inviteeDate, frequency, minimumBookingNotice, workingHours, eventLength }: GetSlots) => {
+const getSlots = ({
+ inviteeDate,
+ frequency,
+ minimumBookingNotice,
+ workingHours,
+ eventLength,
+ currentSeats,
+}: GetSlots) => {
// current date in invitee tz
const startDate = dayjs().add(minimumBookingNotice, "minute");
const startOfDay = dayjs.utc().startOf("day");
diff --git a/apps/web/lib/types/booking.ts b/apps/web/lib/types/booking.ts
index d4936dfdeb3..6f879767c3a 100644
--- a/apps/web/lib/types/booking.ts
+++ b/apps/web/lib/types/booking.ts
@@ -24,6 +24,7 @@ export type BookingCreateBody = {
timeZone: string;
user?: string | string[];
language: string;
+ bookingUid?: string;
customInputs: { label: string; value: string | boolean }[];
metadata: {
[key: string]: string;
diff --git a/apps/web/lib/types/event-type.ts b/apps/web/lib/types/event-type.ts
index ec8442efb41..a7186812cf4 100644
--- a/apps/web/lib/types/event-type.ts
+++ b/apps/web/lib/types/event-type.ts
@@ -24,6 +24,7 @@ export type AdvancedOptions = {
availability?: { openingHours: WorkingHours[]; dateOverrides: WorkingHours[] };
customInputs?: EventTypeCustomInput[];
timeZone?: string;
+ seatsPerTimeSlot: number;
destinationCalendar?: {
userId?: number;
eventTypeId?: number;
diff --git a/apps/web/lib/types/schedule.ts b/apps/web/lib/types/schedule.ts
index ba5e74b45e4..43537957f3f 100644
--- a/apps/web/lib/types/schedule.ts
+++ b/apps/web/lib/types/schedule.ts
@@ -16,3 +16,11 @@ export type WorkingHours = {
startTime: number;
endTime: number;
};
+
+export type CurrentSeats = {
+ uid: string;
+ startTime: string;
+ _count: {
+ attendees: number;
+ };
+};
diff --git a/apps/web/package.json b/apps/web/package.json
index 811ef7849db..aed255480f2 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -1,6 +1,6 @@
{
"name": "@calcom/web",
- "version": "1.6.1",
+ "version": "1.6.2",
"private": true,
"scripts": {
"analyze": "ANALYZE=true next build",
@@ -76,6 +76,7 @@
"jimp": "^0.16.1",
"libphonenumber-js": "^1.9.53",
"lodash": "^4.17.21",
+ "memory-cache": "^0.2.0",
"micro": "^9.3.4",
"mime-types": "^2.1.35",
"next": "^12.1.6",
@@ -125,6 +126,7 @@
"@types/glidejs__glide": "^3.4.2",
"@types/jest": "^27.5.1",
"@types/lodash": "^4.14.182",
+ "@types/memory-cache": "^0.2.2",
"@types/micro": "7.3.6",
"@types/mime-types": "^2.1.1",
"@types/module-alias": "^2.0.1",
diff --git a/apps/web/pages/[user].tsx b/apps/web/pages/[user].tsx
index 251f4a27bae..6659e88e028 100644
--- a/apps/web/pages/[user].tsx
+++ b/apps/web/pages/[user].tsx
@@ -10,7 +10,12 @@ import { useEffect, useState } from "react";
import { Toaster } from "react-hot-toast";
import { JSONObject } from "superjson/dist/types";
-import { sdkActionManager, useEmbedNonStylesConfig, useEmbedStyles, useIsEmbed } from "@calcom/embed-core";
+import {
+ sdkActionManager,
+ useEmbedNonStylesConfig,
+ useEmbedStyles,
+ useIsEmbed,
+} from "@calcom/embed-core/embed-iframe";
import defaultEvents, {
getDynamicEventDescription,
getGroupName,
@@ -337,11 +342,9 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
weekStart: "Sunday",
brandColor: "",
darkBrandColor: "",
- allowDynamicBooking: users.some((user) => {
+ allowDynamicBooking: !users.some((user) => {
return !user.allowDynamicBooking;
- })
- ? false
- : true,
+ }),
}
: {
name: user.name || user.username,
diff --git a/apps/web/pages/[user]/[type].tsx b/apps/web/pages/[user]/[type].tsx
index 30add1786db..879ee702c6b 100644
--- a/apps/web/pages/[user]/[type].tsx
+++ b/apps/web/pages/[user]/[type].tsx
@@ -3,6 +3,7 @@ import { UserPlan } from "@prisma/client";
import { GetServerSidePropsContext } from "next";
import { JSONObject } from "superjson/dist/types";
+import { locationHiddenFilter, LocationObject } from "@calcom/app-store/locations";
import { getDefaultEvent, getGroupName, getUsernameList } from "@calcom/lib/defaultEvents";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { RecurringEvent } from "@calcom/types/Calendar";
@@ -84,6 +85,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
periodEndDate: true,
periodDays: true,
periodCountCalendarDays: true,
+ locations: true,
schedulingType: true,
recurringEvent: true,
schedule: {
@@ -100,6 +102,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
timeZone: true,
metadata: true,
slotInterval: true,
+ seatsPerTimeSlot: true,
users: {
select: {
avatar: true,
@@ -253,12 +256,14 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
} as const;
}
}
+ const locations = eventType.locations ? (eventType.locations as LocationObject[]) : [];
const eventTypeObject = Object.assign({}, eventType, {
metadata: (eventType.metadata || {}) as JSONObject,
periodStartDate: eventType.periodStartDate?.toString() ?? null,
periodEndDate: eventType.periodEndDate?.toString() ?? null,
recurringEvent: (eventType.recurringEvent || {}) as RecurringEvent,
+ locations: locationHiddenFilter(locations),
});
const schedule = eventType.schedule
@@ -302,11 +307,9 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
weekStart: "Sunday",
brandColor: "",
darkBrandColor: "",
- allowDynamicBooking: users.some((user) => {
+ allowDynamicBooking: !users.some((user) => {
return !user.allowDynamicBooking;
- })
- ? false
- : true,
+ }),
}
: {
name: user.name || user.username,
diff --git a/apps/web/pages/[user]/book.tsx b/apps/web/pages/[user]/book.tsx
index 7b5aa8a7bec..c04f14c9abd 100644
--- a/apps/web/pages/[user]/book.tsx
+++ b/apps/web/pages/[user]/book.tsx
@@ -126,6 +126,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
price: true,
currency: true,
disableGuests: true,
+ seatsPerTimeSlot: true,
users: {
select: {
id: true,
@@ -176,8 +177,13 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
})[0];
let booking: GetBookingType | null = null;
- if (context.query.rescheduleUid) {
- booking = await getBooking(prisma, context.query.rescheduleUid as string);
+ if (context.query.rescheduleUid || context.query.bookingUid) {
+ booking = await getBooking(
+ prisma,
+ context.query.rescheduleUid
+ ? (context.query.rescheduleUid as string)
+ : (context.query.bookingUid as string)
+ );
}
const dynamicNames = isDynamicGroupBooking
@@ -194,11 +200,9 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
theme: null,
brandColor: "",
darkBrandColor: "",
- allowDynamicBooking: users.some((user) => {
+ allowDynamicBooking: !users.some((user) => {
return !user.allowDynamicBooking;
- })
- ? false
- : true,
+ }),
eventName: getDynamicEventName(dynamicNames, eventTypeSlug),
}
: {
diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsx
index 794102f2b95..3f1f1eae4ea 100644
--- a/apps/web/pages/_app.tsx
+++ b/apps/web/pages/_app.tsx
@@ -3,6 +3,7 @@ import Head from "next/head";
import superjson from "superjson";
import "@calcom/embed-core/src/embed-iframe";
+import LicenseRequired from "@ee/components/LicenseRequired";
import AppProviders, { AppProps } from "@lib/app-providers";
import { seoConfig } from "@lib/config/next-seo.config";
@@ -37,7 +38,13 @@ function MyApp(props: AppProps) {
<script dangerouslySetInnerHTML={{ __html: `window.CalComPageStatus = '${pageStatus}'` }}></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
</Head>
- <Component {...pageProps} err={err} />
+ {Component.requiresLicense ? (
+ <LicenseRequired>
+ <Component {...pageProps} err={err} />
+ </LicenseRequired>
+ ) : (
+ <Component {...pageProps} err={err} />
+ )}
</AppProviders>
</ContractsProvider>
);
diff --git a/apps/web/pages/api/auth/[...nextauth].tsx b/apps/web/pages/api/auth/[...nextauth].tsx
index ccd947bc00f..f63ec6d4070 100644
--- a/apps/web/pages/api/auth/[...nextauth].tsx
+++ b/apps/web/pages/api/auth/[...nextauth].tsx
@@ -10,6 +10,7 @@ import nodemailer, { TransportOptions } from "nodemailer";
import { authenticator } from "otplib";
import path from "path";
+import checkLicense from "@calcom/ee/server/checkLicense";
import { WEBSITE_URL } from "@calcom/lib/constants";
import { symmetricDecrypt } from "@calcom/lib/crypto";
import { defaultCookies } from "@calcom/lib/default-cookies";
@@ -276,8 +277,10 @@ export default NextAuth({
return token;
},
async session({ session, token }) {
+ const hasValidLicense = await checkLicense(process.env.CALCOM_LICENSE_KEY || "");
const calendsoSession: Session = {
...session,
+ hasValidLicense,
user: {
...session.user,
id: token.id as number,
diff --git a/apps/web/pages/api/availability/[user].ts b/apps/web/pages/api/availability/[user].ts
index 324e5f12cc5..e9ecc51068d 100644
--- a/apps/web/pages/api/availability/[user].ts
+++ b/apps/web/pages/api/availability/[user].ts
@@ -50,6 +50,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
prisma.eventType.findUnique({
where: { id },
select: {
+ seatsPerTimeSlot: true,
timeZone: true,
schedule: {
select: {
@@ -107,9 +108,34 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
(eventType?.availability.length ? eventType.availability : currentUser.availability)
);
+ /* Current logic is if a booking is in a time slot mark it as busy, but seats can have more than one attendee so grab
+ current bookings with a seats event type and display them on the calendar, even if they are full */
+ let currentSeats;
+ if (eventType?.seatsPerTimeSlot) {
+ currentSeats = await prisma.booking.findMany({
+ where: {
+ eventTypeId: eventTypeId,
+ startTime: {
+ gte: dateFrom.format(),
+ lte: dateTo.format(),
+ },
+ },
+ select: {
+ uid: true,
+ startTime: true,
+ _count: {
+ select: {
+ attendees: true,
+ },
+ },
+ },
+ });
+ }
+
res.status(200).json({
busy: bufferedBusyTimes,
timeZone,
workingHours,
+ currentSeats,
});
}
diff --git a/apps/web/pages/api/book/event.ts b/apps/web/pages/api/book/event.ts
index 2de43e3ab98..5b830225c25 100644
--- a/apps/web/pages/api/book/event.ts
+++ b/apps/web/pages/api/book/event.ts
@@ -188,6 +188,7 @@ const getEventTypesFromDB = async (eventTypeId: number) => {
metadata: true,
destinationCalendar: true,
hideCalendarNotes: true,
+ seatsPerTimeSlot: true,
recurringEvent: true,
},
});
@@ -200,7 +201,11 @@ const getEventTypesFromDB = async (eventTypeId: number) => {
type User = Prisma.UserGetPayload<typeof userSelect>;
-type ExtendedBookingCreateBody = BookingCreateBody & { noEmail?: boolean; recurringCount?: number };
+type ExtendedBookingCreateBody = BookingCreateBody & {
+ noEmail?: boolean;
+ recurringCount?: number;
+ rescheduleReason?: string;
+};
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { recurringCount, noEmail, ...reqBody } = req.body as ExtendedBookingCreateBody;
@@ -294,6 +299,45 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
return g;
});
+ // For seats, if the booking already exists then we want to add the new attendee to the existing booking
+ if (reqBody.bookingUid) {
+ if (!eventType.seatsPerTimeSlot)
+ return res.status(404).json({ message: "Event type does not have seats" });
+
+ const booking = await prisma.booking.findUnique({
+ where: {
+ uid: reqBody.bookingUid,
+ },
+ include: {
+ attendees: true,
+ },
+ });
+ if (!booking) return res.status(404).json({ message: "Booking not found" });
+
+ if (eventType.seatsPerTimeSlot <= booking.attendees.length)
+ return res.status(409).json({ message: "Booking seats are full" });
+
+ if (booking.attendees.some((attendee) => attendee.email === invitee[0].email))
+ return res.status(409).json({ message: "Already signed up for time slot" });
+
+ await prisma.booking.update({
+ where: {
+ uid: reqBody.bookingUid,
+ },
+ data: {
+ attendees: {
+ create: {
+ email: invitee[0].email,
+ name: invitee[0].name,
+ timeZone: invitee[0].timeZone,
+ locale: invitee[0].language.locale,
+ },
+ },
+ },
+ });
+ return res.status(201).json(booking);
+ }
+
const teamMemberPromises =
eventType.schedulingType === SchedulingType.COLLECTIVE
? users.slice(1).map(async function (user) {
@@ -637,7 +681,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
if (originalRescheduledBooking?.uid) {
// Use EventManager to conditionally use all needed integrations.
- const updateManager = await eventManager.update(evt, originalRescheduledBooking.uid, booking?.id);
+ const updateManager = await eventManager.update(
+ evt,
+ originalRescheduledBooking.uid,
+ booking?.id,
+ reqBody.rescheduleReason
+ );
// This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back
// to the default description when we are sending the emails.
evt.description = eventType.description;
@@ -671,7 +720,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
{
...evt,
additionInformation: metadata,
- additionalNotes, // Resets back to the addtionalNote input and not the overriden value
+ additionalNotes, // Resets back to the additionalNote input and not the override value
+ cancellationReason: reqBody.rescheduleReason,
},
reqBody.recurringEventId ? (eventType.recurringEvent as RecurringEvent) : {}
);
diff --git a/apps/web/pages/apps/installed.tsx b/apps/web/pages/apps/installed.tsx
index 26333c7063a..4ac885ee259 100644
--- a/apps/web/pages/apps/installed.tsx
+++ b/apps/web/pages/apps/installed.tsx
@@ -1,4 +1,3 @@
-import { ClipboardIcon } from "@heroicons/react/solid";
import Image from "next/image";
import React, { useEffect, useState } from "react";
import { JSONObject } from "superjson/dist/types";
diff --git a/apps/web/pages/d/[link]/[slug].tsx b/apps/web/pages/d/[link]/[slug].tsx
index 4e779996532..38ca1c26771 100644
--- a/apps/web/pages/d/[link]/[slug].tsx
+++ b/apps/web/pages/d/[link]/[slug].tsx
@@ -7,6 +7,7 @@ import { RecurringEvent } from "@calcom/types/Calendar";
import { asStringOrNull } from "@lib/asStringOrNull";
import { getWorkingHours } from "@lib/availability";
import { GetBookingType } from "@lib/getBooking";
+import { locationHiddenFilter, LocationObject } from "@lib/location";
import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps";
@@ -41,6 +42,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
periodCountCalendarDays: true,
recurringEvent: true,
schedulingType: true,
+ seatsPerTimeSlot: true,
userId: true,
schedule: {
select: {
@@ -53,6 +55,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
minimumBookingNotice: true,
beforeEventBuffer: true,
afterEventBuffer: true,
+ locations: true,
timeZone: true,
metadata: true,
slotInterval: true,
@@ -131,6 +134,11 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
notFound: true,
};
}
+
+ const locations = hashedLink.eventType.locations
+ ? (hashedLink.eventType.locations as LocationObject[])
+ : [];
+
const [user] = users;
const eventTypeObject = Object.assign({}, hashedLink.eventType, {
metadata: {} as JSONObject,
@@ -138,6 +146,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
periodStartDate: hashedLink.eventType.periodStartDate?.toString() ?? null,
periodEndDate: hashedLink.eventType.periodEndDate?.toString() ?? null,
slug,
+ locations: locationHiddenFilter(locations),
});
const schedule = {
diff --git a/apps/web/pages/d/[link]/book.tsx b/apps/web/pages/d/[link]/book.tsx
index ed99d6c288e..52e8af2800e 100644
--- a/apps/web/pages/d/[link]/book.tsx
+++ b/apps/web/pages/d/[link]/book.tsx
@@ -46,6 +46,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
periodEndDate: true,
metadata: true,
periodCountCalendarDays: true,
+ seatsPerTimeSlot: true,
price: true,
currency: true,
disableGuests: true,
diff --git a/apps/web/pages/event-types/[type].tsx b/apps/web/pages/event-types/[type].tsx
index ffaf0fd4426..665767a5375 100644
--- a/apps/web/pages/event-types/[type].tsx
+++ b/apps/web/pages/event-types/[type].tsx
@@ -34,6 +34,7 @@ import { z } from "zod";
import { SelectGifInput } from "@calcom/app-store/giphy/components";
import getApps, { getLocationOptions } from "@calcom/app-store/utils";
+import { CAL_URL, WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { StripeData } from "@calcom/stripe/server";
@@ -50,7 +51,7 @@ import { asStringOrThrow, asStringOrUndefined } from "@lib/asStringOrNull";
import { getSession } from "@lib/auth";
import { HttpError } from "@lib/core/http/error";
import { isSuccessRedirectAvailable } from "@lib/isSuccessRedirectAvailable";
-import { LocationType } from "@lib/location";
+import { LocationObject, LocationType } from "@lib/location";
import prisma from "@lib/prisma";
import { slugify } from "@lib/slugify";
import { trpc } from "@lib/trpc";
@@ -64,6 +65,7 @@ import Shell from "@components/Shell";
import { UpgradeToProDialog } from "@components/UpgradeToProDialog";
import { AvailabilitySelectSkeletonLoader } from "@components/availability/SkeletonLoader";
import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
+import { EditLocationDialog } from "@components/dialog/EditLocationDialog";
import RecurringEventController from "@components/eventtype/RecurringEventController";
import CustomInputTypeForm from "@components/pages/eventtypes/CustomInputTypeForm";
import Badge from "@components/ui/Badge";
@@ -72,7 +74,6 @@ import CheckboxField from "@components/ui/form/CheckboxField";
import CheckedSelect from "@components/ui/form/CheckedSelect";
import { DateRangePicker } from "@components/ui/form/DateRangePicker";
import MinutesField from "@components/ui/form/MinutesField";
-import PhoneInput from "@components/ui/form/PhoneInput";
import Select from "@components/ui/form/Select";
import * as RadioArea from "@components/ui/form/radio-area";
import WebhookListContainer from "@components/webhook/WebhookListContainer";
@@ -118,7 +119,13 @@ export type FormValues = {
hidden: boolean;
hideCalendarNotes: boolean;
hashedLink: string | undefined;
- locations: { type: LocationType; address?: string; link?: string; hostPhoneNumber?: string }[];
+ locations: {
+ type: LocationType;
+ address?: string;
+ link?: string;
+ hostPhoneNumber?: string;
+ displayLocationPublicly?: boolean;
+ }[];
customInputs: EventTypeCustomInput[];
users: string[];
schedule: number;
@@ -126,6 +133,7 @@ export type FormValues = {
periodDays: number;
periodCountCalendarDays: "1" | "0";
periodDates: { startDate: Date; endDate: Date };
+ seatsPerTimeSlot: number | null;
minimumBookingNotice: number;
beforeBufferTime: number;
afterBufferTime: number;
@@ -172,7 +180,7 @@ const SuccessRedirectEdit = <T extends UseFormReturn<FormValues>>({
}}
readOnly={proUpgradeRequired}
type="url"
- className=" block w-full rounded-sm border-gray-300 shadow-sm sm:text-sm"
+ className="block w-full rounded-sm border-gray-300 sm:text-sm"
placeholder={t("external_redirect_url")}
defaultValue={eventType.successRedirectUrl || ""}
{...formMethods.register("successRedirectUrl")}
@@ -316,6 +324,10 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
);
const [tokensList, setTokensList] = useState<Array<Token>>([]);
+ const defaultSeatsPro = 6;
+ const minSeats = 2;
+ const [enableSeats, setEnableSeats] = useState(!!eventType.seatsPerTimeSlot);
+
const periodType =
PERIOD_TYPES.find((s) => s.type === eventType.periodType) ||
PERIOD_TYPES.find((s) => s.type === "UNLIMITED");
@@ -410,109 +422,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
formMethods.getValues("locations").concat({ type: newLocationType, ...details })
);
}
- };
-
- const LocationOptions = () => {
- if (!selectedLocation) {
- return null;
- }
- switch (selectedLocation.value) {
- case LocationType.InPerson:
- return (
- <div>
- <label htmlFor="address" className="block text-sm font-medium text-gray-700">
- {t("set_address_place")}
- </label>
- <div className="mt-1">
- <input
- type="text"
- {...locationFormMethods.register("locationAddress")}
- id="address"
- required
- className=" block w-full rounded-sm border-gray-300 text-sm shadow-sm"
- defaultValue={
- formMethods
- .getValues("locations")
- .find((location) => location.type === LocationType.InPerson)?.address
- }
- />
- </div>
- </div>
- );
- case LocationType.Link:
- return (
- <div>
- <label htmlFor="address" className="block text-sm font-medium text-gray-700">
- {t("set_link_meeting")}
- </label>
- <div className="mt-1">
- <input
- type="text"
- {...locationFormMethods.register("locationLink")}
- id="address"
- required
- className=" block w-full rounded-sm border-gray-300 shadow-sm sm:text-sm"
- defaultValue={
- formMethods.getValues("locations").find((location) => location.type === LocationType.Link)
- ?.link
- }
- />
- {locationFormMethods.formState.errors.locationLink && (
- <p className="mt-1 text-red-500">
- {locationFormMethods.formState.errors.locationLink.message}
- </p>
- )}
- </div>
- </div>
- );
- case LocationType.UserPhone:
- return (
- <div>
- <label htmlFor="phonenumber" className="block text-sm font-medium text-gray-700">
- {t("set_your_phone_number")}
- </label>
- <div className="mt-1">
- <PhoneInput
- control={locationFormMethods.control}
- name="locationPhoneNumber"
- required
- id="locationPhoneNumber"
- placeholder={t("host_phone_number")}
- rules={{}}
- defaultValue={
- formMethods
- .getValues("locations")
- .find((location) => location.type === LocationType.UserPhone)?.hostPhoneNumber
- }
- />
- {locationFormMethods.formState.errors.locationPhoneNumber && (
- <p className="mt-1 text-red-500">
- {locationFormMethods.formState.errors.locationPhoneNumber.message}
- </p>
- )}
- </div>
- </div>
- );
- case LocationType.Phone:
- return <p className="text-sm">{t("cal_invitee_phone_number_scheduling")}</p>;
- /* TODO: Render this dynamically from App Store */
- case LocationType.GoogleMeet:
- return <p className="text-sm">{t("cal_provide_google_meet_location")}</p>;
- case LocationType.Zoom:
- return <p className="text-sm">{t("cal_provide_zoom_meeting_url")}</p>;
- case LocationType.Daily:
- return <p className="text-sm">{t("cal_provide_video_meeting_url")}</p>;
- case LocationType.Jitsi:
- return <p className="text-sm">{t("cal_provide_jitsi_meeting_url")}</p>;
- case LocationType.Huddle01:
- return <p className="text-sm">{t("cal_provide_huddle01_meeting_url")}</p>;
- case LocationType.Tandem:
- return <p className="text-sm">{t("cal_provide_tandem_meeting_url")}</p>;
- case LocationType.Teams:
- return <p className="text-sm">{t("cal_provide_teams_meeting_url")}</p>;
- default:
- return null;
- }
+ setShowLocationModal(false);
};
const removeCustom = (index: number) => {
@@ -543,11 +453,11 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
endDate: new Date(eventType.periodEndDate || Date.now()),
});
- const permalink = `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${
- team ? `team/${team.slug}` : eventType.users[0].username
- }/${eventType.slug}`;
+ const permalink = `${CAL_URL}/${team ? `team/${team.slug}` : eventType.users[0].username}/${
+ eventType.slug
+ }`;
- const placeholderHashedLink = `${process.env.NEXT_PUBLIC_WEBSITE_URL}/d/${hashedUrl}/${eventType.slug}`;
+ const placeholderHashedLink = `${CAL_URL}/d/${hashedUrl}/${eventType.slug}`;
const mapUserToValue = ({
id,
@@ -560,7 +470,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
}) => ({
value: `${id || ""}`,
label: `${name || ""}`,
- avatar: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${username}/avatar.png`,
+ avatar: `${WEBAPP_URL}/${username}/avatar.png`,
});
const formMethods = useForm<FormValues>({
@@ -578,6 +488,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
const locationFormSchema = z.object({
locationType: z.string(),
locationAddress: z.string().optional(),
+ displayLocationPublicly: z.boolean().optional(),
locationPhoneNumber: z
.string()
.refine((val) => isValidPhoneNumber(val))
@@ -590,6 +501,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
locationPhoneNumber?: string;
locationAddress?: string; // TODO: We should validate address or fetch the address from googles api to see if its valid?
locationLink?: string; // Currently this only accepts links that are HTTPS://
+ displayLocationPublicly?: boolean;
}>({
resolver: zodResolver(locationFormSchema),
});
@@ -602,7 +514,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<Select
options={locationOptions}
isSearchable={false}
- className=" block w-full min-w-0 flex-1 rounded-sm sm:text-sm"
+ className="block w-full min-w-0 flex-1 rounded-sm sm:text-sm"
onChange={(e) => {
if (e?.value) {
const newLocationType: LocationType = e.value;
@@ -624,15 +536,13 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
{formMethods.getValues("locations").length > 0 && (
<ul>
{formMethods.getValues("locations").map((location) => (
- <li
- key={location.type}
- className="mb-2 rounded-sm border border-neutral-300 py-1.5 px-2 shadow-sm">
+ <li key={location.type} className="mb-2 rounded-sm border border-neutral-300 py-1.5 px-2">
<div className="flex justify-between">
{location.type === LocationType.InPerson && (
<div className="flex flex-grow items-center">
<LocationMarkerIcon className="h-6 w-6" />
<span className="w-full border-0 bg-transparent text-sm ltr:ml-2 rtl:mr-2">
- {location.link}
+ {location.address}
</span>
</div>
)}
@@ -1006,6 +916,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
giphyThankYouPage,
beforeBufferTime,
afterBufferTime,
+ seatsPerTimeSlot,
recurringEvent,
locations,
...input
@@ -1021,6 +932,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
id: eventType.id,
beforeEventBuffer: beforeBufferTime,
afterEventBuffer: afterBufferTime,
+ seatsPerTimeSlot,
metadata: {
...(smartContractAddress ? { smartContractAddress } : {}),
...(giphyThankYouPage ? { giphyThankYouPage } : {}),
@@ -1040,9 +952,9 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</label>
</div>
<div className="w-full">
- <div className="flex rounded-sm shadow-sm">
+ <div className="flex rounded-sm">
<span className="inline-flex items-center rounded-l-sm border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500">
- {process.env.NEXT_PUBLIC_WEBSITE_URL?.replace(/^(https?:|)\/\//, "")}/
+ {CAL_URL?.replace(/^(https?:|)\/\//, "")}/
{team ? "team/" + team.slug : eventType.users[0].username}/
</span>
<input
@@ -1050,7 +962,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
id="slug"
aria-labelledby="slug-label"
required
- className=" block w-full min-w-0 flex-1 rounded-none rounded-r-sm border-gray-300 sm:text-sm"
+ className="block w-full min-w-0 flex-1 rounded-none rounded-r-sm border-gray-300 sm:text-sm"
defaultValue={eventType.slug}
{...formMethods.register("slug", {
setValueAs: (v) => slugify(v),
@@ -1116,7 +1028,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<div className="w-full">
<textarea
id="description"
- className=" block w-full rounded-sm border-gray-300 text-sm shadow-sm"
+ className="block w-full rounded-sm border-gray-300 text-sm "
placeholder={t("quick_video_meeting")}
{...formMethods.register("description")}
defaultValue={asStringOrUndefined(eventType.description)}></textarea>
@@ -1246,7 +1158,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</label>
</div>
<div className="w-full">
- <div className="relative mt-1 rounded-sm shadow-sm">
+ <div className="relative mt-1 rounded-sm">
<Controller
control={formMethods.control}
name="destinationCalendar"
@@ -1270,10 +1182,10 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</label>
</div>
<div className="w-full">
- <div className="relative mt-1 rounded-sm shadow-sm">
+ <div className="relative mt-1 rounded-sm">
<input
type="text"
- className=" block w-full rounded-sm border-gray-300 text-sm shadow-sm"
+ className="block w-full rounded-sm border-gray-300 text-sm "
placeholder={t("meeting_with_user")}
defaultValue={eventType.eventName || ""}
{...formMethods.register("eventName")}
@@ -1291,11 +1203,11 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</label>
</div>
<div className="w-full">
- <div className="relative mt-1 rounded-sm shadow-sm">
+ <div className="relative mt-1 rounded-sm">
{
<input
type="text"
- className=" block w-full rounded-sm border-gray-300 text-sm shadow-sm"
+ className="block w-full rounded-sm border-gray-300 text-sm "
placeholder={t("Example: 0x71c7656ec7ab88b098defb751b7401b5f6d8976f")}
defaultValue={(eventType.metadata.smartContractAddress || "") as string}
{...formMethods.register("smartContractAddress")}
@@ -1400,9 +1312,8 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<Controller
name="requiresConfirmation"
- control={formMethods.control}
defaultValue={eventType.requiresConfirmation}
- render={() => (
+ render={({ field: { value, onChange } }) => (
<CheckboxField
id="requiresConfirmation"
descriptionAsLabel
@@ -1410,9 +1321,9 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
label={t("opt_in_booking")}
description={t("opt_in_booking_description")}
defaultChecked={eventType.requiresConfirmation}
- onChange={(e) => {
- formMethods.setValue("requiresConfirmation", e?.target.checked);
- }}
+ disabled={enableSeats}
+ checked={value}
+ onChange={(e) => onChange(e?.target.checked)}
/>
)}
/>
@@ -1436,6 +1347,9 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
label={t("disable_guests")}
description={t("disable_guests_description")}
defaultChecked={eventType.disableGuests}
+ // If we have seats per booking then we need to disable guests
+ disabled={enableSeats}
+ checked={formMethods.watch("disableGuests")}
onChange={(e) => {
formMethods.setValue("disableGuests", e?.target.checked);
}}
@@ -1474,7 +1388,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
name="hashedLink"
data-testid="generated-hash-url"
type="text"
- className=" grow select-none border-gray-300 bg-gray-50 text-sm text-gray-500 ltr:rounded-l-sm rtl:rounded-r-sm"
+ className="grow select-none border-gray-300 bg-gray-50 text-sm text-gray-500 ltr:rounded-l-sm rtl:rounded-r-sm"
defaultValue={placeholderHashedLink}
/>
<Tooltip
@@ -1603,14 +1517,14 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<div className="inline-flex">
<input
type="number"
- className="block w-16 rounded-sm border-gray-300 shadow-sm [appearance:textfield] ltr:mr-2 rtl:ml-2 sm:text-sm"
+ className="block w-16 rounded-sm border-gray-300 [appearance:textfield] ltr:mr-2 rtl:ml-2 sm:text-sm"
placeholder="30"
{...formMethods.register("periodDays", { valueAsNumber: true })}
defaultValue={eventType.periodDays || 30}
/>
<select
id=""
- className=" block w-full rounded-sm border-gray-300 py-2 pl-3 pr-10 text-base focus:outline-none sm:text-sm"
+ className="block w-full rounded-sm border-gray-300 py-2 pl-3 pr-10 text-base focus:outline-none sm:text-sm"
{...formMethods.register("periodCountCalendarDays")}
defaultValue={eventType.periodCountCalendarDays ? "1" : "0"}>
<option value="1">{t("calendar_days")}</option>
@@ -1684,7 +1598,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
return (
<Select
isSearchable={false}
- className=" block w-full min-w-0 flex-1 rounded-sm sm:text-sm"
+ className="block w-full min-w-0 flex-1 rounded-sm sm:text-sm"
onChange={(val) => {
if (val) onChange(val.value);
}}
@@ -1722,7 +1636,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
return (
<Select
isSearchable={false}
- className=" block w-full min-w-0 flex-1 rounded-sm sm:text-sm"
+ className="block w-full min-w-0 flex-1 rounded-sm sm:text-sm"
onChange={(val) => {
if (val) onChange(val.value);
}}
@@ -1739,6 +1653,136 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</div>
</div>
</div>
+
+ <>
+ <hr className="border-neutral-200" />
+ <div className="block flex-col sm:flex">
+ <Controller
+ name="seatsPerTimeSlot"
+ control={formMethods.control}
+ render={() => (
+ <CheckboxField
+ id="seats"
+ name="seats"
+ descriptionAsLabel
+ label={t("offer_seats")}
+ description={t("offer_seats_description")}
+ defaultChecked={!!eventType.seatsPerTimeSlot}
+ onChange={(e) => {
+ if (e?.target.checked) {
+ setEnableSeats(true);
+ // Want to disable individuals from taking multiple seats
+ formMethods.setValue("seatsPerTimeSlot", defaultSeatsPro);
+ formMethods.setValue("disableGuests", true);
+ formMethods.setValue("requiresConfirmation", false);
+ } else {
+ setEnableSeats(false);
+ formMethods.setValue("seatsPerTimeSlot", null);
+ formMethods.setValue(
+ "requiresConfirmation",
+ eventType.requiresConfirmation
+ );
+ formMethods.setValue("disableGuests", eventType.disableGuests);
+ }
+ }}
+ />
+ )}
+ />
+
+ {enableSeats && (
+ <div className="block sm:flex">
+ <div className="mt-2 inline-flex w-full space-x-2 md:ml-48">
+ <div className="w-full">
+ <Controller
+ name="seatsPerTimeSlot"
+ control={formMethods.control}
+ render={() => {
+ const selectSeatsPerTimeSlotOptions = [
+ { value: 2, label: "2" },
+ { value: 3, label: "3" },
+ { value: 4, label: "4" },
+ { value: 5, label: "5" },
+ {
+ value: -1,
+ isDisabled: !eventType.users.some(
+ (user) => user.plan === ("PRO" || "TRIAL")
+ ),
+ label: (
+ <div className="flex flex-row justify-between">
+ <span>6+</span>
+ <Badge variant="default">PRO</Badge>
+ </div>
+ ) as unknown as string,
+ },
+ ];
+ return (
+ <>
+ <div className="block sm:flex">
+ <div className="flex-auto">
+ {eventType.users.some(
+ (user) => user.plan === ("PRO" || "TRIAL")
+ ) ? (
+ <div className="flex-auto">
+ <label
+ htmlFor="beforeBufferTime"
+ className="mb-2 flex text-sm font-medium text-neutral-700">
+ {t("enter_number_of_seats")}
+ </label>
+ <input
+ type="number"
+ className="focus:border-primary-500 focus:ring-primary-500 py- block w-20 rounded-sm border-gray-300 [appearance:textfield] ltr:mr-2 rtl:ml-2 sm:text-sm"
+ placeholder={`${defaultSeatsPro}`}
+ min={minSeats}
+ {...formMethods.register("seatsPerTimeSlot", {
+ valueAsNumber: true,
+ })}
+ defaultValue={
+ eventType.seatsPerTimeSlot || defaultSeatsPro
+ }
+ />
+ </div>
+ ) : (
+ <>
+ <label
+ htmlFor="beforeBufferTime"
+ className="mb-2 flex text-sm font-medium text-neutral-700">
+ {t("number_of_seats")}
+ </label>
+ <Select
+ isSearchable={false}
+ classNamePrefix="react-select"
+ className="react-select-container focus:border-primary-500 focus:ring-primary-500 block w-full min-w-0 flex-auto rounded-sm border border-gray-300 sm:text-sm "
+ onChange={(val) => {
+ if (!val) {
+ return;
+ }
+ if (val.value === -1) {
+ formMethods.setValue("seatsPerTimeSlot", minSeats);
+ } else {
+ formMethods.setValue("seatsPerTimeSlot", val.value);
+ }
+ }}
+ defaultValue={{
+ value: eventType.seatsPerTimeSlot || minSeats,
+ label: `${eventType.seatsPerTimeSlot || minSeats}`,
+ }}
+ options={selectSeatsPerTimeSlotOptions}
+ />
+ </>
+ )}
+ </div>
+ </div>
+ </>
+ );
+ }}
+ />
+ </div>
+ </div>
+ </div>
+ )}
+ </div>
+ </>
+
<SuccessRedirectEdit<typeof formMethods>
formMethods={formMethods}
eventType={eventType}></SuccessRedirectEdit>
@@ -1773,7 +1817,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
id="requirePayment"
name="requirePayment"
type="checkbox"
- className="text-primary-600 h-4 w-4 rounded border-gray-300"
+ className="text-primary-600 h-4 w-4 rounded border-gray-300"
defaultChecked={requirePayment}
/>
</div>
@@ -1799,7 +1843,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<div className="w-full">
<div className="block items-center sm:flex">
<div className="w-full">
- <div className="relative mt-1 rounded-sm shadow-sm">
+ <div className="relative mt-1 rounded-sm">
<Controller
defaultValue={eventType.price}
control={formMethods.control}
@@ -1811,12 +1855,12 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
min="0.5"
type="number"
required
- className=" block w-full rounded-sm border-gray-300 pl-2 pr-12 sm:text-sm"
+ className="block w-full rounded-sm border-gray-300 pl-2 pr-12 sm:text-sm"
placeholder="Price"
onChange={(e) => {
field.onChange(e.target.valueAsNumber * 100);
}}
- value={field.value > 0 ? field.value / 100 : 0}
+ value={field.value > 0 ? field.value / 100 : undefined}
/>
)}
/>
@@ -1964,76 +2008,16 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</div>
</div>
</div>
- <Dialog open={showLocationModal} onOpenChange={setShowLocationModal}>
- <DialogContent asChild>
- <div className="inline-block transform rounded-sm bg-white px-4 pt-5 pb-4 text-left align-bottom shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6 sm:align-middle">
- <div className="mb-4 sm:flex sm:items-start">
- <div className="bg-secondary-100 mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full sm:mx-0 sm:h-10 sm:w-10">
- <LocationMarkerIcon className="text-primary-600 h-6 w-6" />
- </div>
- <div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
- <h3 className="text-lg font-medium leading-6 text-gray-900" id="modal-title">
- {t("edit_location")}
- </h3>
- <div>
- <p className="text-sm text-gray-400">{t("this_input_will_shown_booking_this_event")}</p>
- </div>
- </div>
- </div>
- <Form
- form={locationFormMethods}
- handleSubmit={async (values) => {
- const newLocation = values.locationType;
-
- let details = {};
- if (newLocation === LocationType.InPerson) {
- details = { address: values.locationAddress };
- }
- if (newLocation === LocationType.Link) {
- details = { link: values.locationLink };
- }
- if (newLocation === LocationType.UserPhone) {
- details = { hostPhoneNumber: values.locationPhoneNumber };
- }
- addLocation(newLocation, details);
- setShowLocationModal(false);
- }}>
- <div>
- <Controller
- name="locationType"
- control={locationFormMethods.control}
- render={() => (
- <Select
- maxMenuHeight={100}
- name="location"
- defaultValue={selectedLocation}
- options={locationOptions}
- isSearchable={false}
- className=" my-4 block w-full min-w-0 flex-1 rounded-sm border border-gray-300 sm:text-sm"
- onChange={(val) => {
- if (val) {
- locationFormMethods.setValue("locationType", val.value);
- locationFormMethods.unregister("locationLink");
- locationFormMethods.unregister("locationAddress");
- locationFormMethods.unregister("locationPhoneNumber");
- setSelectedLocation(val);
- }
- }}
- />
- )}
- />
- </div>
- <LocationOptions />
- <div className="mt-4 flex justify-end space-x-2">
- <Button onClick={() => setShowLocationModal(false)} type="button" color="secondary">
- {t("cancel")}
- </Button>
- <Button type="submit">{t("update")}</Button>
- </div>
- </Form>
- </div>
- </DialogContent>
- </Dialog>
+ <EditLocationDialog
+ isOpenDialog={showLocationModal}
+ setShowLocationModal={setShowLocationModal}
+ saveLocation={addLocation}
+ defaultValues={formMethods.getValues("locations")}
+ selection={
+ selectedLocation ? { value: selectedLocation.value, label: selectedLocation.label } : undefined
+ }
+ setSelectedLocation={setSelectedLocation}
+ />
<Controller
name="customInputs"
control={formMethods.control}
@@ -2111,6 +2095,12 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const session = await getSession({ req });
const typeParam = parseInt(asStringOrThrow(query.type));
+ if (Number.isNaN(typeParam)) {
+ return {
+ notFound: true,
+ };
+ }
+
if (!session?.user?.id) {
return {
redirect: {
@@ -2219,15 +2209,15 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
price: true,
currency: true,
destinationCalendar: true,
+ seatsPerTimeSlot: true,
},
});
- if (!rawEventType) throw Error("Event type not found");
-
- type Location = {
- type: LocationType;
- address?: string;
- };
+ if (!rawEventType) {
+ return {
+ notFound: true,
+ };
+ }
const credentials = await prisma.credential.findMany({
where: {
@@ -2247,7 +2237,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const eventType = {
...restEventType,
recurringEvent: (restEventType.recurringEvent || {}) as RecurringEvent,
- locations: locations as unknown as Location[],
+ locations: locations as unknown as LocationObject[],
metadata: (metadata || {}) as JSONObject,
isWeb3Active:
web3Credentials && web3Credentials.key
@@ -2299,7 +2289,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const teamMembers = eventTypeObject.team
? eventTypeObject.team.members.map((member) => {
const user = member.user;
- user.avatar = `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}/avatar.png`;
+ user.avatar = `${CAL_URL}/${user.username}/avatar.png`;
return user;
})
: [];
diff --git a/apps/web/pages/event-types/index.tsx b/apps/web/pages/event-types/index.tsx
index 8dd740e114b..fff48aa0a8f 100644
--- a/apps/web/pages/event-types/index.tsx
+++ b/apps/web/pages/event-types/index.tsx
@@ -19,12 +19,12 @@ import Link from "next/link";
import { useRouter } from "next/router";
import React, { Fragment, useEffect, useState } from "react";
-import { WEBAPP_URL } from "@calcom/lib/constants";
+import { CAL_URL, WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { Button } from "@calcom/ui";
import { Alert } from "@calcom/ui/Alert";
-import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
+import { Dialog } from "@calcom/ui/Dialog";
import Dropdown, {
DropdownMenuContent,
DropdownMenuItem,
@@ -246,7 +246,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
truncateAfter={4}
items={type.users.map((organizer) => ({
alt: organizer.name || "",
- image: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${organizer.username}/avatar.png`,
+ image: `${WEBAPP_URL}/${organizer.username}/avatar.png`,
}))}
/>
)}
@@ -257,7 +257,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
)}>
<Tooltip content={t("preview") as string}>
<a
- href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`}
+ href={`${CAL_URL}/${group.profile.slug}/${type.slug}`}
target="_blank"
rel="noreferrer"
className={classNames("btn-icon appearance-none", type.$disabled && " opacity-30")}>
@@ -271,9 +271,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
<button
onClick={() => {
showToast(t("link_copied"), "success");
- navigator.clipboard.writeText(
- `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`
- );
+ navigator.clipboard.writeText(`${CAL_URL}/${group.profile.slug}/${type.slug}`);
}}
className={classNames("btn-icon", type.$disabled && " opacity-30")}>
<LinkIcon
@@ -354,8 +352,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
</DropdownMenuTrigger>
<DropdownMenuContent portalled>
<DropdownMenuItem>
- <Link
- href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`}>
+ <Link href={`${CAL_URL}/${group.profile.slug}/${type.slug}`}>
<a target="_blank">
<Button
color="minimal"
@@ -376,9 +373,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
data-testid={"event-type-duplicate-" + type.id}
StartIcon={ClipboardCopyIcon}
onClick={() => {
- navigator.clipboard.writeText(
- `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`
- );
+ navigator.clipboard.writeText(`${CAL_URL}/${group.profile.slug}/${type.slug}`);
showToast(t("link_copied"), "success");
}}>
{t("copy_link") as string}
@@ -398,7 +393,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
.share({
title: t("share"),
text: t("share_event"),
- url: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${group.profile.slug}/${type.slug}`,
+ url: `${CAL_URL}/${group.profile.slug}/${type.slug}`,
})
.then(() => showToast(t("link_shared"), "success"))
.catch(() => showToast(t("failed"), "error"));
@@ -500,11 +495,10 @@ const EventTypeListHeading = ({ profile, membershipCount }: EventTypeListHeading
</span>
)}
{profile?.slug && (
- <Link href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${profile.slug}`}>
- <a className="block text-xs text-neutral-500">{`${process.env.NEXT_PUBLIC_WEBSITE_URL?.replace(
- "https://",
- ""
- )}/${profile.slug}`}</a>
+ <Link href={`${CAL_URL}/${profile.slug}`}>
+ <a className="block text-xs text-neutral-500">{`${CAL_URL?.replace("https://", "")}/${
+ profile.slug
+ }`}</a>
</Link>
)}
</div>
diff --git a/apps/web/pages/getting-started.tsx b/apps/web/pages/getting-started.tsx
index a5acb3ae498..f6b36b101d3 100644
--- a/apps/web/pages/getting-started.tsx
+++ b/apps/web/pages/getting-started.tsx
@@ -36,7 +36,6 @@ import { ClientSuspense } from "@components/ClientSuspense";
import Loader from "@components/Loader";
import Schedule from "@components/availability/Schedule";
import { CalendarListContainer } from "@components/integrations/CalendarListContainer";
-import Text from "@components/ui/Text";
import TimezoneSelect from "@components/ui/form/TimezoneSelect";
import getEventTypes from "../lib/queries/event-types/get-event-types";
@@ -398,10 +397,10 @@ export default function Onboarding(props: inferSSRProps<typeof getServerSideProp
<label htmlFor="timeZone" className="block text-sm font-medium text-gray-700">
{t("timezone")}
</label>
- <Text variant="caption">
+ <p className="text-sm leading-tight text-gray-500 dark:text-white">
{t("current_time")}:&nbsp;
<span className="text-black">{dayjs().tz(selectedTimeZone).format("LT")}</span>
- </Text>
+ </p>
</section>
<TimezoneSelect
id="timeZone"
@@ -529,9 +528,9 @@ export default function Onboarding(props: inferSSRProps<typeof getServerSideProp
className="mt-1 block w-full rounded-sm border border-gray-300 px-3 py-2 shadow-sm focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
defaultValue={props.user.bio || undefined}
/>
- <Text variant="caption" className="mt-2">
+ <p className="mt-2 text-sm leading-tight text-gray-500 dark:text-white">
{t("few_sentences_about_yourself")}
- </Text>
+ </p>
</fieldset>
</section>
</form>
@@ -582,17 +581,13 @@ export default function Onboarding(props: inferSSRProps<typeof getServerSideProp
<article className="relative">
<section className="space-y-4 sm:mx-auto sm:w-full sm:max-w-lg">
<header>
- <Text className="text-white" variant="largetitle">
- {steps[currentStep].title}
- </Text>
- <Text className="text-white" variant="subtitle">
- {steps[currentStep].description}
- </Text>
+ <p className="font-cal mb-2 text-3xl tracking-wider text-white">{steps[currentStep].title}</p>
+ <p className="text-sm font-normal text-white">{steps[currentStep].description}</p>
</header>
<section className="space-y-2 pt-4">
- <Text variant="footnote">
+ <p className="text-xs font-medium text-gray-500 dark:text-white">
Step {currentStep + 1} of {steps.length}
- </Text>
+ </p>
{error && <Alert severity="error" message={error?.message} />}
diff --git a/apps/web/pages/settings/billing.tsx b/apps/web/pages/settings/billing.tsx
index 7a22a388e6a..96acb038225 100644
--- a/apps/web/pages/settings/billing.tsx
+++ b/apps/web/pages/settings/billing.tsx
@@ -1,14 +1,13 @@
import { ExternalLinkIcon } from "@heroicons/react/solid";
import { ReactNode } from "react";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
import Button from "@calcom/ui/Button";
import { useIntercom } from "@ee/lib/intercom/useIntercom";
-import { useLocale } from "@lib/hooks/useLocale";
import useMeQuery from "@lib/hooks/useMeQuery";
import SettingsShell from "@components/SettingsShell";
-import Shell from "@components/Shell";
type CardProps = { title: string; description: string; className?: string; children: ReactNode };
const Card = ({ title, description, className = "", children }: CardProps): JSX.Element => (
@@ -30,8 +29,8 @@ export default function Billing() {
const { boot, show } = useIntercom();
return (
- <Shell heading={t("billing")} subtitle={t("manage_your_billing_info")}>
- <SettingsShell>
+ <SettingsShell heading={t("billing")} subtitle={t("manage_your_billing_info")}>
+ <>
<div className="py-6 lg:col-span-9 lg:pb-8">
{data?.plan && ["FREE", "TRIAL"].includes(data.plan) && (
<Card
@@ -72,7 +71,7 @@ export default function Billing() {
</div>
</div>
</div>
- </SettingsShell>
- </Shell>
+ </>
+ </SettingsShell>
);
}
diff --git a/apps/web/pages/settings/profile.tsx b/apps/web/pages/settings/profile.tsx
index a7989450222..229421e441c 100644
--- a/apps/web/pages/settings/profile.tsx
+++ b/apps/web/pages/settings/profile.tsx
@@ -5,6 +5,7 @@ import { signOut } from "next-auth/react";
import { useRouter } from "next/router";
import { ComponentProps, FormEvent, RefObject, useEffect, useMemo, useRef, useState } from "react";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
@@ -15,7 +16,6 @@ import { withQuery } from "@lib/QueryCell";
import { asStringOrNull, asStringOrUndefined } from "@lib/asStringOrNull";
import { getSession } from "@lib/auth";
import { nameOfDay } from "@lib/core/i18n/weekday";
-import { useLocale } from "@lib/hooks/useLocale";
import { isBrandingHidden } from "@lib/isBrandingHidden";
import prisma from "@lib/prisma";
import { trpc } from "@lib/trpc";
@@ -23,7 +23,6 @@ import { inferSSRProps } from "@lib/types/inferSSRProps";
import ImageUploader from "@components/ImageUploader";
import SettingsShell from "@components/SettingsShell";
-import Shell from "@components/Shell";
import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent";
import Avatar from "@components/ui/Avatar";
import Badge from "@components/ui/Badge";
@@ -488,11 +487,9 @@ export default function Settings(props: Props) {
const { t } = useLocale();
return (
- <Shell heading={t("profile")} subtitle={t("edit_profile_info_description")}>
- <SettingsShell>
- <WithQuery success={({ data }) => <SettingsView {...props} localeProp={data.locale} />} />
- </SettingsShell>
- </Shell>
+ <SettingsShell heading={t("profile")} subtitle={t("edit_profile_info_description")}>
+ <WithQuery success={({ data }) => <SettingsView {...props} localeProp={data.locale} />} />
+ </SettingsShell>
);
}
diff --git a/apps/web/pages/settings/security.tsx b/apps/web/pages/settings/security.tsx
index 58e8e57ea34..a88784319a8 100644
--- a/apps/web/pages/settings/security.tsx
+++ b/apps/web/pages/settings/security.tsx
@@ -9,16 +9,16 @@ import { identityProviderNameMap } from "@lib/auth";
import { trpc } from "@lib/trpc";
import SettingsShell from "@components/SettingsShell";
-import Shell from "@components/Shell";
import ChangePasswordSection from "@components/security/ChangePasswordSection";
+import DisableUserImpersonation from "@components/security/DisableUserImpersonation";
import TwoFactorAuthSection from "@components/security/TwoFactorAuthSection";
export default function Security() {
const user = trpc.useQuery(["viewer.me"]).data;
const { t } = useLocale();
return (
- <Shell heading={t("security")} subtitle={t("manage_account_security")}>
- <SettingsShell>
+ <SettingsShell heading={t("security")} subtitle={t("manage_account_security")}>
+ <>
{user && user.identityProvider !== IdentityProvider.CAL ? (
<>
<div className="mt-6">
@@ -39,11 +39,12 @@ export default function Security() {
<ChangePasswordSection />
<ApiKeyListContainer />
<TwoFactorAuthSection twoFactorEnabled={user?.twoFactorEnabled || false} />
+ <DisableUserImpersonation disableImpersonation={user?.disableImpersonation ?? true} />
</div>
)}
<SAMLConfiguration teamsView={false} teamId={null} />
- </SettingsShell>
- </Shell>
+ </>
+ </SettingsShell>
);
}
diff --git a/apps/web/pages/settings/teams/index.tsx b/apps/web/pages/settings/teams/index.tsx
index be391687cfb..1ad9065c7b2 100644
--- a/apps/web/pages/settings/teams/index.tsx
+++ b/apps/web/pages/settings/teams/index.tsx
@@ -4,21 +4,20 @@ import { useSession } from "next-auth/react";
import { Trans } from "next-i18next";
import { useState } from "react";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
-import { useLocale } from "@lib/hooks/useLocale";
import useMeQuery from "@lib/hooks/useMeQuery";
import { trpc } from "@lib/trpc";
import EmptyScreen from "@components/EmptyScreen";
import Loader from "@components/Loader";
import SettingsShell from "@components/SettingsShell";
-import Shell from "@components/Shell";
import TeamCreateModal from "@components/team/TeamCreateModal";
import TeamList from "@components/team/TeamList";
-export default function Teams() {
+function Teams() {
const { t } = useLocale();
const { status } = useSession();
const loading = status === "loading";
@@ -40,8 +39,8 @@ export default function Teams() {
const isFreePlan = me.data?.plan === "FREE";
return (
- <Shell heading={t("teams")} subtitle={t("create_manage_teams_collaborative")}>
- <SettingsShell>
+ <SettingsShell heading={t("teams")} subtitle={t("create_manage_teams_collaborative")}>
+ <>
{!!errorMessage && <Alert severity="error" title={errorMessage} />}
{isFreePlan && (
<Alert
@@ -87,7 +86,11 @@ export default function Teams() {
/>
)}
{teams.length > 0 && <TeamList teams={teams}></TeamList>}
- </SettingsShell>
- </Shell>
+ </>
+ </SettingsShell>
);
}
+
+Teams.requiresLicense = false;
+
+export default Teams;
diff --git a/apps/web/pages/success.tsx b/apps/web/pages/success.tsx
index e7482deaa28..678166117ae 100644
--- a/apps/web/pages/success.tsx
+++ b/apps/web/pages/success.tsx
@@ -22,7 +22,7 @@ import {
useEmbedNonStylesConfig,
useIsBackgroundTransparent,
useIsEmbed,
-} from "@calcom/embed-core";
+} from "@calcom/embed-core/embed-iframe";
import { getDefaultEvent } from "@calcom/lib/defaultEvents";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { localStorage } from "@calcom/lib/webstorage";
@@ -148,7 +148,7 @@ type SuccessProps = inferSSRProps<typeof getServerSideProps>;
export default function Success(props: SuccessProps) {
const { t } = useLocale();
const router = useRouter();
- const { location: _location, name, reschedule } = router.query;
+ const { location: _location, name, reschedule, listingStatus, status } = router.query;
const location = Array.isArray(_location) ? _location[0] : _location;
const [is24h, setIs24h] = useState(isBrowserLocale24h());
const { data: session } = useSession();
@@ -176,6 +176,7 @@ export default function Success(props: SuccessProps) {
const eventName = getEventName(eventNameObject);
const needsConfirmation = eventType.requiresConfirmation && reschedule != "true";
+ const isCancelled = status === "CANCELLED" || status === "REJECTED";
const telemetry = useTelemetry();
useEffect(() => {
telemetry.withJitsu((jitsu) =>
@@ -238,6 +239,9 @@ export default function Success(props: SuccessProps) {
function getTitle(): string {
const titleSuffix = props.recurringBookings ? "_recurring" : "";
+ if (isCancelled) {
+ return t("emailed_information_about_cancelled_event");
+ }
if (needsConfirmation) {
if (props.profile.name !== null) {
return t("user_needs_to_confirm_or_reject_booking" + titleSuffix, {
@@ -298,25 +302,31 @@ export default function Success(props: SuccessProps) {
<div
className={classNames(
"mx-auto flex items-center justify-center",
- !giphyImage ? "h-12 w-12 rounded-full bg-green-100" : ""
+ !giphyImage && !isCancelled ? "h-12 w-12 rounded-full bg-green-100" : "",
+ isCancelled ? "h-12 w-12 rounded-full bg-red-100" : ""
)}>
{giphyImage && !needsConfirmation && (
// eslint-disable-next-line @next/next/no-img-element
<img src={giphyImage} alt={"Gif from Giphy"} />
)}
- {!giphyImage && !needsConfirmation && (
+ {!giphyImage && !needsConfirmation && !isCancelled && (
<CheckIcon className="h-8 w-8 text-green-600" />
)}
- {needsConfirmation && <ClockIcon className="h-8 w-8 text-green-600" />}
+ {needsConfirmation && !isCancelled && (
+ <ClockIcon className="h-8 w-8 text-green-600" />
+ )}
+ {isCancelled && <XIcon className="h-8 w-8 text-red-600" />}
</div>
<div className="mt-3 text-center sm:mt-5">
<h3
className="text-2xl font-semibold leading-6 text-neutral-900 dark:text-white"
id="modal-headline">
- {needsConfirmation
+ {needsConfirmation && !isCancelled
? props.recurringBookings
? t("submitted_recurring")
: t("submitted")
+ : isCancelled
+ ? t("event_cancelled")
: props.recurringBookings
? t("meeting_is_scheduled_recurring")
: t("meeting_is_scheduled")}
@@ -333,31 +343,36 @@ export default function Success(props: SuccessProps) {
isReschedule={reschedule === "true"}
eventType={props.eventType}
recurringBookings={props.recurringBookings}
+ listingStatus={(listingStatus as string) || "upcoming"}
date={date}
is24h={is24h}
/>
</div>
- <div className="font-medium">{t("who")}</div>
- <div className="col-span-2 mb-6">
- {bookingInfo?.user && (
- <div className="mb-3">
- <p>{bookingInfo.user.name}</p>
- <p className="text-bookinglight">{bookingInfo.user.email}</p>
- </div>
- )}
- {bookingInfo?.attendees.map((attendee, index) => (
- <div
- key={attendee.name}
- className={index === bookingInfo.attendees.length - 1 ? "" : "mb-3"}>
- <p>{attendee.name}</p>
- <p className="text-bookinglight">{attendee.email}</p>
+ {(bookingInfo?.user || bookingInfo?.attendees) && (
+ <>
+ <div className="font-medium">{t("who")}</div>
+ <div className="col-span-2 mb-6">
+ {bookingInfo?.user && (
+ <div className="mb-3">
+ <p>{bookingInfo.user.name}</p>
+ <p className="text-bookinglight">{bookingInfo.user.email}</p>
+ </div>
+ )}
+ {bookingInfo?.attendees.map((attendee, index) => (
+ <div
+ key={attendee.name}
+ className={index === bookingInfo.attendees.length - 1 ? "" : "mb-3"}>
+ <p>{attendee.name}</p>
+ <p className="text-bookinglight">{attendee.email}</p>
+ </div>
+ ))}
</div>
- ))}
- </div>
+ </>
+ )}
{location && (
<>
- <div className="mt-6 font-medium">{t("where")}</div>
- <div className="col-span-2 mt-6">
+ <div className="mt-3 font-medium">{t("where")}</div>
+ <div className="col-span-2 mt-3">
{location.startsWith("http") ? (
<a title="Meeting Link" href={location}>
{location}
@@ -400,6 +415,7 @@ export default function Success(props: SuccessProps) {
</div>
</div>
{!needsConfirmation &&
+ !isCancelled &&
(!isCancellationMode ? (
<div className="border-bookinglightest text-bookingdark mt-2 grid grid-cols-3 border-b py-4 text-left dark:border-gray-900">
<span className="flex self-center font-medium text-gray-700 ltr:mr-2 rtl:ml-2 dark:text-gray-50">
@@ -424,7 +440,7 @@ export default function Success(props: SuccessProps) {
theme={userIsOwner ? "light" : props.profile.theme}
/>
))}
- {userIsOwner && !needsConfirmation && !isCancellationMode && (
+ {userIsOwner && !needsConfirmation && !isCancellationMode && !isCancelled && (
<div className="border-bookinglightest mt-9 flex border-b pt-2 pb-4 text-center dark:border-gray-900 sm:mt-0 sm:pt-4">
<span className="flex self-center font-medium text-gray-700 ltr:mr-2 rtl:ml-2 dark:text-gray-50">
{t("add_to_calendar")}
@@ -590,6 +606,7 @@ type RecurringBookingsProps = {
recurringBookings: SuccessProps["recurringBookings"];
date: dayjs.Dayjs;
is24h: boolean;
+ listingStatus: string;
};
function RecurringBookings({
@@ -597,10 +614,11 @@ function RecurringBookings({
eventType,
recurringBookings,
date,
+ listingStatus,
}: RecurringBookingsProps) {
const [moreEventsVisible, setMoreEventsVisible] = useState(false);
const { t } = useLocale();
- return !isReschedule && recurringBookings ? (
+ return !isReschedule && recurringBookings && listingStatus === "upcoming" ? (
<>
{eventType.recurringEvent?.count &&
recurringBookings.slice(0, 4).map((dateStr, idx) => (
@@ -636,7 +654,7 @@ function RecurringBookings({
</Collapsible>
)}
</>
- ) : !eventType.recurringEvent.freq ? (
+ ) : (
<>
{date.format("MMMM DD, YYYY")}
<br />
@@ -645,7 +663,7 @@ function RecurringBookings({
({localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess()})
</span>
</>
- ) : null;
+ );
}
const getEventTypesFromDB = async (id: number) => {
diff --git a/apps/web/pages/team/[slug].tsx b/apps/web/pages/team/[slug].tsx
index 90a3ba4d6f3..2fb6d625769 100644
--- a/apps/web/pages/team/[slug].tsx
+++ b/apps/web/pages/team/[slug].tsx
@@ -5,8 +5,8 @@ import { GetServerSidePropsContext } from "next";
import Link from "next/link";
import React, { useEffect } from "react";
-import { useIsEmbed } from "@calcom/embed-core";
-import { WEBSITE_URL } from "@calcom/lib/constants";
+import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
+import { CAL_URL } from "@calcom/lib/constants";
import Button from "@calcom/ui/Button";
import { getPlaceholderAvatar } from "@lib/getPlaceholderAvatar";
@@ -23,7 +23,6 @@ import { HeadSeo } from "@components/seo/head-seo";
import Team from "@components/team/screens/Team";
import Avatar from "@components/ui/Avatar";
import AvatarGroup from "@components/ui/AvatarGroup";
-import Text from "@components/ui/Text";
export type TeamPageProps = inferSSRProps<typeof getServerSideProps>;
function TeamPage({ team }: TeamPageProps) {
@@ -68,7 +67,7 @@ function TeamPage({ team }: TeamPageProps) {
size={10}
items={type.users.map((user) => ({
alt: user.name || "",
- image: WEBSITE_URL + "/" + user.username + "/avatar.png" || "",
+ image: CAL_URL + "/" + user.username + "/avatar.png" || "",
}))}
/>
</div>
@@ -93,12 +92,8 @@ function TeamPage({ team }: TeamPageProps) {
imageSrc={getPlaceholderAvatar(team.logo, team.name)}
className="mx-auto mb-4 h-20 w-20 rounded-full"
/>
- <Text variant="largetitle" className="text-gray-900 dark:text-white">
- {teamName}
- </Text>
- <Text variant="subtitle" className="mt-2">
- {team.bio}
- </Text>
+ <p className="font-cal mb-2 text-3xl tracking-wider text-gray-900 dark:text-white">{teamName}</p>
+ <p className="mt-2 text-sm font-normal text-neutral-500 dark:text-white">{team.bio}</p>
</div>
{(showMembers.isOn || !team.eventTypes.length) && <Team team={team} />}
{!showMembers.isOn && team.eventTypes.length > 0 && (
@@ -147,7 +142,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
...type,
users: type.users.map((user) => ({
...user,
- avatar: WEBSITE_URL + "/" + user.username + "/avatar.png",
+ avatar: CAL_URL + "/" + user.username + "/avatar.png",
})),
}));
diff --git a/apps/web/pages/team/[slug]/[type].tsx b/apps/web/pages/team/[slug]/[type].tsx
index 1034f403d8d..4d7dd6a637a 100644
--- a/apps/web/pages/team/[slug]/[type].tsx
+++ b/apps/web/pages/team/[slug]/[type].tsx
@@ -7,6 +7,7 @@ import { RecurringEvent } from "@calcom/types/Calendar";
import { asStringOrNull } from "@lib/asStringOrNull";
import { getWorkingHours } from "@lib/availability";
import getBooking, { GetBookingType } from "@lib/getBooking";
+import { locationHiddenFilter, LocationObject } from "@lib/location";
import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps";
@@ -71,11 +72,13 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
beforeEventBuffer: true,
afterEventBuffer: true,
recurringEvent: true,
+ locations: true,
price: true,
currency: true,
timeZone: true,
slotInterval: true,
metadata: true,
+ seatsPerTimeSlot: true,
schedule: {
select: {
timeZone: true,
@@ -106,11 +109,14 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
eventType.schedule = null;
+ const locations = eventType.locations ? (eventType.locations as LocationObject[]) : [];
+
const eventTypeObject = Object.assign({}, eventType, {
metadata: (eventType.metadata || {}) as JSONObject,
periodStartDate: eventType.periodStartDate?.toString() ?? null,
periodEndDate: eventType.periodEndDate?.toString() ?? null,
recurringEvent: (eventType.recurringEvent || {}) as RecurringEvent,
+ locations: locationHiddenFilter(locations),
});
eventTypeObject.availability = [];
diff --git a/apps/web/pages/team/[slug]/book.tsx b/apps/web/pages/team/[slug]/book.tsx
index e3978abe1b9..b3c496eb4c2 100644
--- a/apps/web/pages/team/[slug]/book.tsx
+++ b/apps/web/pages/team/[slug]/book.tsx
@@ -50,6 +50,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
price: true,
currency: true,
metadata: true,
+ seatsPerTimeSlot: true,
team: {
select: {
slug: true,
diff --git a/apps/web/playwright/booking-pages.test.ts b/apps/web/playwright/booking-pages.test.ts
index f1bc7090c0d..700807a2c1d 100644
--- a/apps/web/playwright/booking-pages.test.ts
+++ b/apps/web/playwright/booking-pages.test.ts
@@ -94,8 +94,8 @@ test.describe("pro user", () => {
await pro.login();
await page.goto("/bookings/upcoming");
- await page.locator('[data-testid="reschedule"]').nth(0).click();
- await page.locator('[data-testid="edit"]').click();
+ await page.locator('[data-testid="edit_booking"]').nth(0).click();
+ await page.locator('[data-testid="reschedule"]').click();
await page.waitForNavigation({
url: (url) => {
const bookingId = url.searchParams.get("rescheduleUid");
diff --git a/apps/web/playwright/dynamic-booking-pages.test.ts b/apps/web/playwright/dynamic-booking-pages.test.ts
index b2990654f7d..b57b5cb3b97 100644
--- a/apps/web/playwright/dynamic-booking-pages.test.ts
+++ b/apps/web/playwright/dynamic-booking-pages.test.ts
@@ -35,8 +35,8 @@ test.describe("dynamic booking", () => {
// Logged in
await page.goto("/bookings/upcoming");
- await page.locator('[data-testid="reschedule"]').nth(0).click();
- await page.locator('[data-testid="edit"]').click();
+ await page.locator('[data-testid="edit_booking"]').nth(0).click();
+ await page.locator('[data-testid="reschedule"]').click();
await page.waitForNavigation({
url: (url) => {
const bookingId = url.searchParams.get("rescheduleUid");
diff --git a/apps/web/playwright/reschedule.test.ts b/apps/web/playwright/reschedule.test.ts
index 5bf89893ef6..15ef3838908 100644
--- a/apps/web/playwright/reschedule.test.ts
+++ b/apps/web/playwright/reschedule.test.ts
@@ -28,7 +28,7 @@ test.describe("Reschedule Tests", async () => {
await user.login();
await page.goto("/bookings/upcoming");
- await page.locator('[data-testid="reschedule"]').nth(0).click();
+ await page.locator('[data-testid="edit_booking"]').nth(0).click();
await page.locator('[data-testid="reschedule_request"]').click();
@@ -87,7 +87,7 @@ test.describe("Reschedule Tests", async () => {
await expect(page.locator('[name="name"]')).toBeDisabled();
await expect(page.locator('[name="email"]')).toBeDisabled();
- await expect(page.locator('[name="notes"]')).toBeDisabled();
+ await expect(page.locator('[name="rescheduleReason"]')).toBeDisabled();
await page.locator('[data-testid="confirm-reschedule-button"]').click();
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json
index 65a17c061c7..e816e4264a1 100644
--- a/apps/web/public/static/locales/en/common.json
+++ b/apps/web/public/static/locales/en/common.json
@@ -435,6 +435,7 @@
"in_person_meeting": "In-person meeting",
"link_meeting": "Link meeting",
"phone_call": "Phone call",
+ "your_number": "Your phone number",
"phone_number": "Phone Number",
"attendee_phone_number": "Attendee Phone Number",
"host_phone_number": "Your Phone Number",
@@ -628,7 +629,6 @@
"calendar_days": "calendar days",
"business_days": "business days",
"set_address_place": "Set an address or place",
- "set_your_phone_number": "Set a phone number for the meeting",
"set_link_meeting": "Set a link to the meeting",
"cal_invitee_phone_number_scheduling": "Cal will ask your invitee to enter a phone number before scheduling.",
"cal_provide_google_meet_location": "Cal will provide a Google Meet location.",
@@ -646,7 +646,6 @@
"into_the_future": "into the future",
"within_date_range": "Within a date range",
"indefinitely_into_future": "Indefinitely into the future",
- "this_input_will_shown_booking_this_event": "This input will be shown when booking this event",
"add_new_custom_input_field": "Add new custom input field",
"quick_chat": "Quick Chat",
"add_new_team_event_type": "Add a new team event type",
@@ -767,7 +766,13 @@
"external_redirect_url": "https://example.com/redirect-to-my-success-page",
"redirect_url_upgrade_description": "In order to use this feature, you need to upgrade to a Pro account.",
"duplicate": "Duplicate",
+ "offer_seats": "Offer seats",
+ "offer_seats_description": "Offer seats to bookings (This disables guests & opt in bookings)",
+ "seats_available": "Seats available",
+ "number_of_seats": "Number of seats per booking",
+ "enter_number_of_seats": "Enter number of seats",
"you_can_manage_your_schedules": "You can manage your schedules on the Availability page.",
+ "booking_full": "No more seats available",
"api_keys": "API Keys",
"api_key_modal_subtitle": "API keys allow you to make API calls for your own account.",
"api_keys_subtitle": "Generate API keys to use for accessing your own account.",
@@ -809,16 +814,27 @@
"former_time": "Former time",
"confirmation_page_gif": "Gif for confirmation page",
"search": "Search",
- "impersonate":"Impersonate",
- "impersonate_user_tip":"All uses of this feature is audited.",
- "impersonating_user_warning":"Impersonating username \"{{user}}\".",
+ "impersonate": "Impersonate",
+ "user_impersonation_heading":"User Impersonation",
+ "user_impersonation_description":"Allows our support team to temporarily sign in as you to help us quickly resolve any issues you report to us.",
+ "impersonate_user_tip": "All uses of this feature is audited.",
+ "impersonating_user_warning": "Impersonating username \"{{user}}\".",
"impersonating_stop_instructions": "<0>Click Here to stop</0>.",
- "email_validation_error":"That doesn't look like an email address",
+ "event_location_changed": "Updated - Your event changed the location",
+ "location_changed_event_type_subject": "Location Changed: {{eventType}} with {{name}} at {{date}}",
+ "current_location": "Current Location",
+ "user_phone": "Your phone number",
+ "new_location": "New Location",
+ "no_location": "No location defined",
+ "set_location": "Set Location",
+ "update_location": "Update Location",
+ "location_updated": "Location updated",
+ "email_validation_error": "That doesn't look like an email address",
"place_where_cal_widget_appear": "Place this code in your HTML where you want your Cal widget to appear.",
"copy_code": "Copy Code",
"code_copied": "Code copied!",
- "how_you_want_add_cal_site":"How do you want to add Cal to your site?",
- "choose_ways_put_cal_site":"Choose one of the following ways to put Cal on your site.",
+ "how_you_want_add_cal_site": "How do you want to add Cal to your site?",
+ "choose_ways_put_cal_site": "Choose one of the following ways to put Cal on your site.",
"setting_up_zapier": "Setting up your Zapier integration",
"generate_api_key": "Generate Api Key",
"your_unique_api_key": "Your unique API key",
@@ -827,11 +843,37 @@
"install_zapier_app": "Please first install the Zapier App in the app store.",
"go_to_app_store": "Go to App Store",
"calendar_error": "Something went wrong, try reconnecting your calendar with all necessary permissions",
+ "set_your_phone_number": "Set a phone number for the meeting",
"calendar_no_busy_slots": "There are no busy slots",
+ "add_gif": "Add GIF",
+ "search_giphy": "Search Giphy",
+ "add_link_from_giphy": "Add link from Giphy",
+ "add_gif_to_confirmation": "Adding a GIF to confirmation page",
+ "find_gif_spice_confirmation": "Find GIF to spice up your confirmation page",
+ "display_location_label":"Display on booking page",
+ "display_location_info_badge":"Location will be visible before the booking is confirmed",
+ "share_feedback": "Share feedback",
+ "resources": "Resources",
+ "support_documentation": "Support documentation",
+ "developer_documentation": "Developer Documentation",
+ "get_in_touch": "Get in touch",
+ "contact_support": "Contact Support",
+ "feedback": "Feedback",
+ "submitted_feedback": "Thank you for your feedback!",
+ "feedback_error": "Error sending feedback",
+ "comments": "Comments",
"booking_details": "Booking details",
"or_lowercase": "or",
"nevermind": "Nevermind",
"go_to": "Go to: ",
"zapier_invite_link": "Zapier Invite Link",
- "meeting_url_provided_after_confirmed":"A Meeting URL will be created once the event is confirmed."
+ "meeting_url_provided_after_confirmed":"A Meeting URL will be created once the event is confirmed.",
+ "reschedule_optional": "Reason for rescheduling (optional)",
+ "reschedule_placeholder": "Let others know why you need to reschedule",
+ "event_cancelled":"This event is cancelled",
+ "emailed_information_about_cancelled_event": "We emailed you and the other attendees to let them know.",
+ "this_input_will_shown_booking_this_event": "This input will be shown when booking this event",
+ "meeting_url_in_conformation_email": "Meeting url is in the confirmation email",
+ "url_start_with_https": "URL needs to start with http:// or https://",
+ "number_provided": "Phone number will be provided"
}
diff --git a/apps/web/server/createContext.ts b/apps/web/server/createContext.ts
index 6b4c6cfdc78..c57f1bbe978 100644
--- a/apps/web/server/createContext.ts
+++ b/apps/web/server/createContext.ts
@@ -44,6 +44,7 @@ async function getUserFromSession({
hideBranding: true,
avatar: true,
twoFactorEnabled: true,
+ disableImpersonation: true,
identityProvider: true,
brandColor: true,
darkBrandColor: true,
diff --git a/apps/web/server/routers/viewer.tsx b/apps/web/server/routers/viewer.tsx
index f32a5d5f1d8..9fbae933ca2 100644
--- a/apps/web/server/routers/viewer.tsx
+++ b/apps/web/server/routers/viewer.tsx
@@ -1,29 +1,34 @@
import { BookingStatus, MembershipRole, Prisma } from "@prisma/client";
+import dayjs from "dayjs";
import _ from "lodash";
import { JSONObject } from "superjson/dist/types";
import { z } from "zod";
-import getApps from "@calcom/app-store/utils";
+import getApps, { getLocationOptions } from "@calcom/app-store/utils";
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/core/CalendarManager";
import { checkPremiumUsername } from "@calcom/ee/lib/core/checkPremiumUsername";
import { bookingMinimalSelect } from "@calcom/prisma";
import { RecurringEvent } from "@calcom/types/Calendar";
import { checkRegularUsername } from "@lib/core/checkRegularUsername";
+import { sendFeedbackEmail } from "@lib/emails/email-manager";
import jackson from "@lib/jackson";
+import prisma from "@lib/prisma";
import {
+ hostedCal,
+ isSAMLAdmin,
isSAMLLoginEnabled,
- samlTenantID,
samlProductID,
- isSAMLAdmin,
- hostedCal,
- tenantPrefix,
+ samlTenantID,
samlTenantProduct,
+ tenantPrefix,
} from "@lib/saml";
import slugify from "@lib/slugify";
+import { getTranslation } from "@server/lib/i18n";
import { apiKeysRouter } from "@server/routers/viewer/apiKeys";
import { availabilityRouter } from "@server/routers/viewer/availability";
+import { bookingsRouter } from "@server/routers/viewer/bookings";
import { eventTypesRouter } from "@server/routers/viewer/eventTypes";
import { TRPCError } from "@trpc/server";
@@ -84,6 +89,7 @@ const loggedInViewerRouter = createProtectedRouter()
trialEndsAt: user.trialEndsAt,
completedOnboarding: user.completedOnboarding,
twoFactorEnabled: user.twoFactorEnabled,
+ disableImpersonation: user.disableImpersonation,
identityProvider: user.identityProvider,
brandColor: user.brandColor,
darkBrandColor: user.darkBrandColor,
@@ -679,6 +685,7 @@ const loggedInViewerRouter = createProtectedRouter()
completedOnboarding: z.boolean().optional(),
locale: z.string().optional(),
timeFormat: z.number().optional(),
+ disableImpersonation: z.boolean().optional(),
}),
async resolve({ input, ctx }) {
const { user, prisma } = ctx;
@@ -891,11 +898,62 @@ const loggedInViewerRouter = createProtectedRouter()
throw new TRPCError({ code: "BAD_REQUEST" });
}
},
+ })
+ .mutation("submitFeedback", {
+ input: z.object({
+ rating: z.string(),
+ comment: z.string(),
+ }),
+ async resolve({ input, ctx }) {
+ const { rating, comment } = input;
+
+ const feedback = {
+ userId: ctx.user.id,
+ rating: rating,
+ comment: comment,
+ };
+
+ await ctx.prisma.feedback.create({
+ data: {
+ date: dayjs().toISOString(),
+ userId: ctx.user.id,
+ rating: rating,
+ comment: comment,
+ },
+ });
+
+ if (process.env.SEND_FEEDBACK_EMAIL && comment) sendFeedbackEmail(feedback);
+ },
+ })
+ .query("locationOptions", {
+ async resolve({ ctx }) {
+ const credentials = await prisma.credential.findMany({
+ where: {
+ userId: ctx.user.id,
+ },
+ select: {
+ id: true,
+ type: true,
+ key: true,
+ userId: true,
+ appId: true,
+ },
+ });
+
+ const integrations = getApps(credentials);
+
+ const t = await getTranslation(ctx.user.locale ?? "en", "common");
+
+ const locationOptions = getLocationOptions(integrations, t);
+
+ return locationOptions;
+ },
});
export const viewerRouter = createRouter()
.merge(publicViewerRouter)
.merge(loggedInViewerRouter)
+ .merge("bookings.", bookingsRouter)
.merge("eventTypes.", eventTypesRouter)
.merge("availability.", availabilityRouter)
.merge("teams.", viewerTeamsRouter)
diff --git a/apps/web/server/routers/viewer/bookings.tsx b/apps/web/server/routers/viewer/bookings.tsx
new file mode 100644
index 00000000000..0437e04dfdc
--- /dev/null
+++ b/apps/web/server/routers/viewer/bookings.tsx
@@ -0,0 +1,154 @@
+import { SchedulingType } from "@prisma/client";
+import dayjs from "dayjs";
+import { z } from "zod";
+
+import EventManager from "@calcom/core/EventManager";
+import logger from "@calcom/lib/logger";
+import { getTranslation } from "@calcom/lib/server/i18n";
+import type { AdditionInformation, CalendarEvent } from "@calcom/types/Calendar";
+
+import { sendLocationChangeEmails } from "@lib/emails/email-manager";
+
+import { createProtectedRouter } from "@server/createRouter";
+import { TRPCError } from "@trpc/server";
+
+// Common data for all endpoints under webhook
+const commonBookingSchema = z.object({
+ bookingId: z.number(),
+});
+
+export const bookingsRouter = createProtectedRouter()
+ .middleware(async ({ ctx, rawInput, next }) => {
+ // Endpoints that just read the logged in user's data - like 'list' don't necessary have any input
+ if (!rawInput) return next({ ctx: { ...ctx, booking: null } });
+
+ const webhookIdAndEventTypeId = commonBookingSchema.safeParse(rawInput);
+ if (!webhookIdAndEventTypeId.success) throw new TRPCError({ code: "PARSE_ERROR" });
+
+ const { bookingId } = webhookIdAndEventTypeId.data;
+ const booking = await ctx.prisma.booking.findFirst({
+ where: {
+ OR: [
+ /* If user is organizer */
+ { userId: ctx.user.id, id: bookingId },
+ /* Or part of a collective booking */
+ {
+ eventType: {
+ schedulingType: SchedulingType.COLLECTIVE,
+ users: {
+ some: {
+ id: ctx.user.id,
+ },
+ },
+ },
+ },
+ ],
+ },
+ include: {
+ attendees: true,
+ eventType: true,
+ user: {
+ include: { destinationCalendar: true },
+ },
+ destinationCalendar: true,
+ },
+ });
+ return next({ ctx: { ...ctx, booking } });
+ })
+ .middleware(async ({ ctx, next }) => {
+ // So TS doesn't compain in the previous middleware.
+ // This means the user doesn't have access to this booking
+ if (!ctx.booking) throw new TRPCError({ code: "UNAUTHORIZED" });
+ // Booking here is non-nullable anymore
+ return next({ ctx: { ...ctx, booking: ctx.booking } });
+ })
+ .mutation("editLocation", {
+ input: commonBookingSchema.extend({
+ newLocation: z.string(),
+ }),
+ async resolve({ ctx, input }) {
+ const { bookingId, newLocation: location } = input;
+ const { booking } = ctx;
+
+ try {
+ await ctx.prisma.booking.update({
+ where: { id: bookingId },
+ data: { location },
+ });
+
+ const organizer = await ctx.prisma.user.findFirst({
+ where: {
+ id: booking.userId || 0,
+ },
+ select: {
+ name: true,
+ email: true,
+ timeZone: true,
+ locale: true,
+ },
+ rejectOnNotFound: true,
+ });
+
+ const tOrganizer = await getTranslation(organizer.locale ?? "en", "common");
+
+ const attendeesListPromises = booking.attendees.map(async (attendee) => {
+ return {
+ name: attendee.name,
+ email: attendee.email,
+ timeZone: attendee.timeZone,
+ language: {
+ translate: await getTranslation(attendee.locale ?? "en", "common"),
+ locale: attendee.locale ?? "en",
+ },
+ };
+ });
+
+ const attendeesList = await Promise.all(attendeesListPromises);
+
+ const evt: CalendarEvent = {
+ title: booking.title || "",
+ type: (booking.eventType?.title as string) || booking?.title || "",
+ description: booking.description || "",
+ startTime: booking.startTime ? dayjs(booking.startTime).format() : "",
+ endTime: booking.endTime ? dayjs(booking.endTime).format() : "",
+ organizer: {
+ email: organizer.email,
+ name: organizer.name ?? "Nameless",
+ timeZone: organizer.timeZone,
+ language: { translate: tOrganizer, locale: organizer.locale ?? "en" },
+ },
+ attendees: attendeesList,
+ uid: booking.uid,
+ location,
+ destinationCalendar: booking?.destinationCalendar || booking?.user?.destinationCalendar,
+ };
+
+ const eventManager = new EventManager(ctx.user);
+ const scheduleResult = await eventManager.create(evt);
+
+ const results = scheduleResult.results;
+ if (results.length > 0 && results.every((res) => !res.success)) {
+ const error = {
+ errorCode: "BookingUpdateLocationFailed",
+ message: "Updating location failed",
+ };
+ logger.error(`Booking ${ctx.user.username} failed`, error, results);
+ } else {
+ const metadata: AdditionInformation = {};
+ if (results.length) {
+ metadata.hangoutLink = results[0].createdEvent?.hangoutLink;
+ metadata.conferenceData = results[0].createdEvent?.conferenceData;
+ metadata.entryPoints = results[0].createdEvent?.entryPoints;
+ }
+ try {
+ await sendLocationChangeEmails({ ...evt, additionInformation: metadata });
+ } catch (error) {
+ console.log("Error sending LocationChangeEmails");
+ }
+ }
+ } catch {
+ throw new TRPCError({ code: "INTERNAL_SERVER_ERROR" });
+ }
+ return { message: "Location updated" };
+ },
+ });
diff --git a/apps/web/server/routers/viewer/webhook.tsx b/apps/web/server/routers/viewer/webhook.tsx
index feb0934bea9..2b0991a25f9 100644
--- a/apps/web/server/routers/viewer/webhook.tsx
+++ b/apps/web/server/routers/viewer/webhook.tsx
@@ -9,8 +9,64 @@ import sendPayload from "@lib/webhooks/sendPayload";
import { createProtectedRouter } from "@server/createRouter";
import { getTranslation } from "@server/lib/i18n";
+import { TRPCError } from "@trpc/server";
+
+// Common data for all endpoints under webhook
+const webhookIdAndEventTypeIdSchema = z.object({
+ // Webhook ID
+ id: z.string().optional(),
+ // Event type ID
+ eventTypeId: z.number().optional(),
+});
export const webhookRouter = createProtectedRouter()
+ .middleware(async ({ ctx, rawInput, next }) => {
+ // Endpoints that just read the logged in user's data - like 'list' don't necessary have any input
+ if (!rawInput) {
+ return next();
+ }
+ const webhookIdAndEventTypeId = webhookIdAndEventTypeIdSchema.safeParse(rawInput);
+ if (!webhookIdAndEventTypeId.success) {
+ throw new TRPCError({ code: "PARSE_ERROR" });
+ }
+ const { eventTypeId, id } = webhookIdAndEventTypeId.data;
+
+ // A webhook is either linked to Event Type or to a user.
+ if (eventTypeId) {
+ const team = await ctx.prisma.team.findFirst({
+ where: {
+ eventTypes: {
+ some: {
+ id: eventTypeId,
+ },
+ },
+ },
+ include: {
+ members: true,
+ },
+ });
+
+ // Team should be available and the user should be a member of the team
+ if (!team?.members.some((membership) => membership.userId === ctx.user.id)) {
+ throw new TRPCError({
+ code: "UNAUTHORIZED",
+ });
+ }
+ } else if (id) {
+ const authorizedHook = await ctx.prisma.webhook.findFirst({
+ where: {
+ id: id,
+ userId: ctx.user.id,
+ },
+ });
+ if (!authorizedHook) {
+ throw new TRPCError({
+ code: "UNAUTHORIZED",
+ });
+ }
+ }
+ return next();
+ })
.query("list", {
input: z
.object({
@@ -42,58 +98,22 @@ export const webhookRouter = createProtectedRouter()
eventTypeId: z.number().optional(),
appId: z.string().optional().nullable(),
}),
- async resolve({ ctx, input: { eventTypeId, ...input } }) {
- const webhookCreateInput: Prisma.WebhookCreateInput = {
- id: v4(),
- ...input,
- };
- const webhookPayload = { webhooks: { create: webhookCreateInput } };
- let teamId = -1;
- if (eventTypeId) {
- /* [1] If an eventType is provided, we find the team were it belongs */
- const team = await ctx.prisma.team.findFirst({
- rejectOnNotFound: true,
- where: { eventTypes: { some: { id: eventTypeId } } },
- select: { id: true },
+ async resolve({ ctx, input }) {
+ if (input.eventTypeId) {
+ return await ctx.prisma.webhook.create({
+ data: {
+ id: v4(),
+ ...input,
+ },
});
- /* [2] We save the id for later use */
- teamId = team.id;
}
- await ctx.prisma.user.update({
- where: { id: ctx.user.id },
- /**
- * [3] Right now only team eventTypes can have webhooks so we make sure the
- * user adding the webhook belongs to the team.
- */
- data: eventTypeId
- ? {
- teams: {
- update: {
- /* [3.1] Here we make sure the requesting user belongs to the team */
- where: { userId_teamId: { teamId, userId: ctx.user.id } },
- data: {
- team: {
- update: {
- eventTypes: {
- update: {
- where: { id: eventTypeId },
- data: webhookPayload,
- },
- },
- },
- },
- },
- },
- },
- }
- : /* [4] If there's no eventTypeId we create it to the current user instead. */
- webhookPayload,
- });
- const webhook = await ctx.prisma.webhook.findUnique({
- rejectOnNotFound: true,
- where: { id: webhookCreateInput.id },
+ return await ctx.prisma.webhook.create({
+ data: {
+ id: v4(),
+ userId: ctx.user.id,
+ ...input,
+ },
});
- return webhook;
},
})
.mutation("edit", {
diff --git a/apps/website b/apps/website
index 100e69ab175..22ad56ec941 160000
--- a/apps/website
+++ b/apps/website
@@ -1 +1 @@
-Subproject commit 100e69ab175b7a8c6c2bf564ce757b10ff74292e
+Subproject commit 22ad56ec9413ff5ee057fc402d999cdcbca1936a
diff --git a/package.json b/package.json
index bb0d14e7926..01c230adbb9 100644
--- a/package.json
+++ b/package.json
@@ -16,10 +16,11 @@
"db-studio": "yarn workspace @calcom/prisma db-studio",
"deploy": "turbo run deploy",
"dev": "turbo run dev --scope=\"@calcom/web\"",
- "dev:website": "yarn predev && turbo run dev --scope=\"@calcom/web\" --scope=\"@calcom/website\"",
- "dev:api": "yarn predev && turbo run dev --scope=\"@calcom/api\"",
- "dev:swagger": "yarn predev && turbo run dev --scope=\"@calcom/api\" --scope=\"@calcom/swagger\"",
+ "dev:all": "yarn predev && turbo run dev --scope=\"@calcom/web\" --scope=\"@calcom/website\" --scope=\"@calcom/console\"",
+ "dev:api": "yarn predev && turbo run dev --scope=\"@calcom/web\" --scope=\"@calcom/api\"",
"dev:console": "yarn predev && turbo run dev --scope=\"@calcom/web\" --scope=\"@calcom/console\"",
+ "dev:swagger": "yarn predev && turbo run dev --scope=\"@calcom/api\" --scope=\"@calcom/swagger\"",
+ "dev:website": "yarn predev && turbo run dev --scope=\"@calcom/web\" --scope=\"@calcom/website\"",
"docs-dev": "yarn predev && turbo run dev --scope=\"@calcom/docs\"",
"docs-build": "turbo run build --scope=\"@calcom/docs\" --include-dependencies",
"docs-start": "turbo run start --scope=\"@calcom/docs\"",
@@ -40,7 +41,8 @@
"embed-tests-quick": "turbo run embed-tests-quick",
"embed-tests": "turbo run embed-tests",
"test-e2e": "turbo run test-e2e --concurrency=1",
- "type-check": "turbo run type-check"
+ "type-check": "turbo run type-check",
+ "embed-tests-prepare": "yarn workspace @calcom/prisma db-reset && yarn build"
},
"devDependencies": {
"dotenv-checker": "^1.1.5",
diff --git a/packages/app-store/giphy/api/get.ts b/packages/app-store/giphy/api/get.ts
new file mode 100644
index 00000000000..2afd608615c
--- /dev/null
+++ b/packages/app-store/giphy/api/get.ts
@@ -0,0 +1,64 @@
+import type { NextApiRequest, NextApiResponse } from "next";
+import { z, ZodError } from "zod";
+
+import prisma from "@calcom/prisma";
+
+import { GiphyManager } from "../lib";
+
+const giphyUrlRegexp = new RegExp("^https://(.*).giphy.com/media/(.*)/giphy.gif(.*)");
+
+const getSchema = z.object({
+ url: z.string().regex(giphyUrlRegexp, "Giphy URL is invalid"),
+});
+
+/**
+ * This is an example endpoint for an app, these will run under `/api/integrations/[...args]`
+ * @param req
+ * @param res
+ */
+async function handler(req: NextApiRequest, res: NextApiResponse) {
+ const userId = req.session?.user?.id;
+ if (!userId) {
+ return res.status(401).json({ message: "You must be logged in to do this" });
+ }
+ try {
+ const { url } = req.body;
+ const parsedUrl = new URL(url.replace(/ /g, ""));
+ // remove query strings if any that could cause trouble in parsing ID from url
+ const sanitisedUrl = parsedUrl.origin + parsedUrl.pathname;
+ // Extract Giphy ID from embed url
+ const matches = giphyUrlRegexp.exec(sanitisedUrl);
+ if (!matches || matches.length < 3) {
+ return res.status(400).json({ message: "Giphy URL is invalid" });
+ }
+ const giphyId = matches[2];
+ const gifImageUrl = await GiphyManager.getGiphyById(giphyId);
+ return res.status(200).json({ image: gifImageUrl });
+ } catch (error: unknown) {
+ console.error({ error });
+ if (error instanceof Error) {
+ return res.status(500).json({ message: error.message });
+ }
+ return res.status(500);
+ }
+}
+
+function validate(handler: (req: NextApiRequest, res: NextApiResponse) => Promise<NextApiResponse | void>) {
+ return async (req: NextApiRequest, res: NextApiResponse) => {
+ if (req.method === "POST") {
+ try {
+ getSchema.parse(req.body);
+ } catch (error) {
+ if (error instanceof ZodError && error?.name === "ZodError") {
+ return res.status(400).json(error?.issues);
+ }
+ return res.status(402);
+ }
+ } else {
+ return res.status(405);
+ }
+ await handler(req, res);
+ };
+}
+
+export default validate(handler);
diff --git a/packages/app-store/giphy/api/index.ts b/packages/app-store/giphy/api/index.ts
index 8a667764735..c8140ff5bbe 100644
--- a/packages/app-store/giphy/api/index.ts
+++ b/packages/app-store/giphy/api/index.ts
@@ -1,2 +1,3 @@
export { default as add } from "./add";
export { default as search } from "./search";
+export { default as get } from "./get";
diff --git a/packages/app-store/giphy/api/search.ts b/packages/app-store/giphy/api/search.ts
index 58d3b9d82b1..f255447bc0a 100644
--- a/packages/app-store/giphy/api/search.ts
+++ b/packages/app-store/giphy/api/search.ts
@@ -32,8 +32,12 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
});
const locale = user?.locale || "en";
const { keyword, offset } = req.body;
- const gifImageUrl = await GiphyManager.searchGiphy(locale, keyword, offset);
- return res.status(200).json({ image: gifImageUrl });
+ const { gifImageUrl, total } = await GiphyManager.searchGiphy(locale, keyword, offset);
+ return res.status(200).json({
+ image: gifImageUrl,
+ // rotate results to 0 offset when no more gifs
+ nextOffset: total === offset + 1 ? 0 : offset + 1,
+ });
} catch (error: unknown) {
if (error instanceof Error) {
return res.status(500).json({ message: error.message });
diff --git a/packages/app-store/giphy/components/SearchDialog.tsx b/packages/app-store/giphy/components/SearchDialog.tsx
index 600556712e9..3105ca7b1b5 100644
--- a/packages/app-store/giphy/components/SearchDialog.tsx
+++ b/packages/app-store/giphy/components/SearchDialog.tsx
@@ -1,13 +1,12 @@
-import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/solid";
+import { SearchIcon, LinkIcon } from "@heroicons/react/outline";
import { useState } from "react";
import { Dispatch, SetStateAction } from "react";
+import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Alert } from "@calcom/ui/Alert";
import Button from "@calcom/ui/Button";
-import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog";
-import { TextField } from "@calcom/ui/form/fields";
-import Loader from "@calcom/web/components/Loader";
+import { Dialog, DialogClose, DialogContent, DialogFooter } from "@calcom/ui/Dialog";
interface ISearchDialog {
isOpenDialog: boolean;
@@ -15,14 +14,19 @@ interface ISearchDialog {
onSave: (url: string) => void;
}
+const MODE_SEARCH = "search" as const;
+const MODE_URL = "url" as const;
+type Mode = typeof MODE_SEARCH | typeof MODE_URL;
+
export const SearchDialog = (props: ISearchDialog) => {
const { t } = useLocale();
const [gifImage, setGifImage] = useState<string>("");
- const [offset, setOffset] = useState<number>(0);
+ const [nextOffset, setNextOffset] = useState<number>(0);
const [keyword, setKeyword] = useState<string>("");
const { isOpenDialog, setIsOpenDialog } = props;
const [isLoading, setIsLoading] = useState(false);
const [errorMessage, setErrorMessage] = useState("");
+ const [selectedMode, setSelectedMode] = useState<Mode>(MODE_SEARCH);
const searchGiphy = async (keyword: string, offset: number) => {
if (isLoading) {
@@ -45,7 +49,7 @@ export const SearchDialog = (props: ISearchDialog) => {
setErrorMessage(json?.message || "Something went wrong");
} else {
setGifImage(json.image || "");
- setOffset(offset);
+ setNextOffset(json.nextOffset);
if (!json.image) {
setErrorMessage("No Result found");
}
@@ -54,72 +58,134 @@ export const SearchDialog = (props: ISearchDialog) => {
return null;
};
+ const getGiphyByUrl = async (url: string) => {
+ if (isLoading) {
+ return;
+ }
+ setIsLoading(true);
+ setErrorMessage("");
+ const res = await fetch("/api/integrations/giphy/get", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ url,
+ }),
+ });
+ const json = await res.json();
+ if (!res.ok) {
+ setErrorMessage(json?.message || json?.[0]?.message || "Something went wrong");
+ } else {
+ setGifImage(json.image || "");
+ if (!json.image) {
+ setErrorMessage("No Result found");
+ }
+ }
+ setIsLoading(false);
+ return null;
+ };
+
+ const renderTab = (Icon: any, text: string, mode: Mode) => (
+ <div
+ className={classNames(
+ "flex cursor-pointer items-center border-b-2 p-2 text-sm",
+ selectedMode === mode ? "border-black" : "border-transparent text-gray-500"
+ )}
+ onClick={() => {
+ setKeyword("");
+ setGifImage("");
+ setSelectedMode(mode);
+ }}>
+ <Icon color={selectedMode === mode ? "black" : "grey"} className="mr-2 h-4 w-4" />
+ {text}
+ </div>
+ );
+
+ const handleFormSubmit = async (event: React.SyntheticEvent) => {
+ event.stopPropagation();
+ event.preventDefault();
+ if (selectedMode === MODE_SEARCH) {
+ searchGiphy(keyword, 0);
+ } else if (selectedMode === MODE_URL) {
+ getGiphyByUrl(keyword);
+ }
+ };
+
return (
<Dialog open={isOpenDialog} onOpenChange={setIsOpenDialog}>
<DialogContent>
- <DialogHeader title="Search a gif" />
-
- <div className="flex justify-center space-x-2 space-y-2">
- <TextField
- value={keyword}
- onChange={(event) => {
- setKeyword(event.target.value);
- }}
- name="search"
- type="text"
- className="mt-2"
- labelProps={{ style: { display: "none" } }}
- placeholder="Search Giphy"
- />
- <Button
- type="button"
- tabIndex={-1}
- onClick={(event) => {
- searchGiphy(keyword, 0);
- return false;
- }}
- loading={isLoading}>
+ <h3 className="leading-16 font-cal text-xl text-gray-900" id="modal-title">
+ {t("add_gif_to_confirmation")}
+ </h3>
+ <p className="mb-3 text-sm font-light text-neutral-500">{t("find_gif_spice_confirmation")}</p>
+ <div className="flex items-center border-b border-solid">
+ {renderTab(SearchIcon, t("search_giphy"), MODE_SEARCH)}
+ {renderTab(LinkIcon, t("add_link_from_giphy"), MODE_URL)}
+ </div>
+ <form className="flex w-full justify-center space-x-2 space-y-2" onSubmit={handleFormSubmit}>
+ <div className="relative block w-full pt-2">
+ <input
+ type="text"
+ className="block w-full rounded-sm border-gray-300 shadow-sm sm:text-sm"
+ placeholder={
+ selectedMode === MODE_SEARCH
+ ? t("search_giphy")
+ : "https://media.giphy.com/media/some-id/giphy.gif"
+ }
+ value={keyword}
+ onChange={(event) => {
+ setKeyword(event.target.value);
+ }}
+ />
+ </div>
+ <Button type="submit" tabIndex={-1} color="secondary" loading={isLoading}>
{t("search")}
</Button>
- </div>
+ </form>
{gifImage && (
<div className="flex flex-col items-center space-x-2 space-y-2 pt-3">
- {isLoading ? (
- <Loader />
- ) : (
- <>
- <div>
- <img src={gifImage} alt={`Gif from Giphy for ${keyword}`} />
- </div>
- <div>
- <nav>
- <ul className="inline-flex space-x-2">
- <li style={{ visibility: offset <= 0 ? "hidden" : "visible" }}>
- <button
- onClick={() => {
- searchGiphy(keyword, offset - 1);
- }}
- className="focus:shadow-outline flex h-10 w-10 items-center justify-center rounded-full text-indigo-600 transition-colors duration-150 hover:bg-indigo-100">
- <ChevronLeftIcon />
- </button>
- </li>
- <li>
- <button
- onClick={() => {
- searchGiphy(keyword, offset + 1);
- }}
- className="focus:shadow-outline flex h-10 w-10 items-center justify-center rounded-full bg-white text-indigo-600 transition-colors duration-150 hover:bg-indigo-100">
- <ChevronRightIcon />
- </button>
- </li>
- </ul>
- </nav>
+ <div className="flex w-full items-center justify-center bg-gray-100">
+ {isLoading ? (
+ <div className="flex h-[200px] w-full items-center justify-center bg-gray-400 pt-3 pb-3">
+ <svg
+ className={classNames("mx-4 h-5 w-5 animate-spin", "text-white dark:text-black")}
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24">
+ <circle
+ className="opacity-25"
+ cx="12"
+ cy="12"
+ r="10"
+ stroke="currentColor"
+ strokeWidth="4"></circle>
+ <path
+ className="opacity-75"
+ fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
+ </svg>
</div>
- </>
- )}
+ ) : (
+ <img className="h-[200px] pt-3 pb-3" src={gifImage} alt={`Gif from Giphy for ${keyword}`} />
+ )}
+ </div>
</div>
)}
{errorMessage && <Alert severity="error" title={errorMessage} className="my-4" />}
+ {gifImage && selectedMode === MODE_SEARCH && (
+ <div className="mt-4 flex items-center justify-between space-x-2">
+ <div className="text-sm font-light text-neutral-500">Not the perfect GIF?</div>
+ <Button
+ size="sm"
+ color="secondary"
+ type="button"
+ loading={isLoading}
+ onClick={() => searchGiphy(keyword, nextOffset)}>
+ Shuffle
+ </Button>
+ </div>
+ )}
<DialogFooter>
<DialogClose
onClick={() => {
@@ -133,16 +199,16 @@ export const SearchDialog = (props: ISearchDialog) => {
<Button
type="button"
- loading={isLoading}
+ disabled={!gifImage}
onClick={() => {
props.setIsOpenDialog(false);
props.onSave(gifImage);
- setOffset(0);
+ setNextOffset(0);
setGifImage("");
setKeyword("");
return false;
}}>
- {t("save")}
+ {t("add_gif")}
</Button>
</DialogFooter>
</DialogContent>
diff --git a/packages/app-store/giphy/components/SelectGifInput.tsx b/packages/app-store/giphy/components/SelectGifInput.tsx
index ffb3de11b34..739aa1f00e9 100644
--- a/packages/app-store/giphy/components/SelectGifInput.tsx
+++ b/packages/app-store/giphy/components/SelectGifInput.tsx
@@ -1,4 +1,4 @@
-import { SearchIcon, TrashIcon } from "@heroicons/react/solid";
+import { PlusIcon, PencilAltIcon, XIcon } from "@heroicons/react/solid";
import { useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -18,19 +18,26 @@ export default function SelectGifInput(props: ISelectGifInput) {
return (
<div className="flex flex-col items-start space-x-2 space-y-2">
{selectedGif && (
- <div>
+ <div className="min-h-[200px]">
<img alt={"Selected Gif Image"} src={selectedGif} />
</div>
)}
<div className="flex">
- <Button color="secondary" type="button" StartIcon={SearchIcon} onClick={() => setShowDialog(true)}>
- Search on Giphy
- </Button>
+ {selectedGif ? (
+ <Button color="minimal" type="button" StartIcon={PencilAltIcon} onClick={() => setShowDialog(true)}>
+ Change
+ </Button>
+ ) : (
+ <Button color="minimal" type="button" StartIcon={PlusIcon} onClick={() => setShowDialog(true)}>
+ Add from Giphy
+ </Button>
+ )}
+
{selectedGif && (
<Button
color="warn"
type="button"
- StartIcon={TrashIcon}
+ StartIcon={XIcon}
onClick={() => {
setSelectedGif("");
props.onChange("");
diff --git a/packages/app-store/giphy/lib/giphyManager.ts b/packages/app-store/giphy/lib/giphyManager.ts
index b14e6c5c16c..ee8778df61f 100644
--- a/packages/app-store/giphy/lib/giphyManager.ts
+++ b/packages/app-store/giphy/lib/giphyManager.ts
@@ -4,10 +4,14 @@ import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
let api_key = "";
-export const searchGiphy = async (locale: string, keyword: string, offset: number = 0) => {
+const checkGiphyApiKey = async () => {
const appKeys = await getAppKeysFromSlug("giphy");
if (typeof appKeys.api_key === "string") api_key = appKeys.api_key;
if (!api_key) throw new HttpError({ statusCode: 400, message: "Missing Giphy api_key" });
+};
+
+export const searchGiphy = async (locale: string, keyword: string, offset = 0) => {
+ await checkGiphyApiKey();
const queryParams = new URLSearchParams({
api_key,
q: keyword,
@@ -25,5 +29,24 @@ export const searchGiphy = async (locale: string, keyword: string, offset: numbe
});
const responseBody = await response.json();
const gifs = responseBody.data;
- return gifs?.[0]?.images?.fixed_height_downsampled?.url || null;
+ return {
+ gifImageUrl: gifs?.[0]?.images?.fixed_height_downsampled?.url || null,
+ total: responseBody.pagination.total_count,
+ };
+};
+
+export const getGiphyById = async (giphyId: string) => {
+ await checkGiphyApiKey();
+ const queryParams = new URLSearchParams({
+ api_key,
+ });
+ const response = await fetch(`https://api.giphy.com/v1/gifs/${giphyId}?${queryParams.toString()}`, {
+ method: "GET",
+ headers: {
+ Accept: "application/json",
+ },
+ });
+ const responseBody = await response.json();
+ const gifs = responseBody.data;
+ return gifs?.images?.fixed_height_downsampled?.url || null;
};
diff --git a/packages/app-store/locations.ts b/packages/app-store/locations.ts
index 6fb2adf0a5d..f7801d67bd5 100644
--- a/packages/app-store/locations.ts
+++ b/packages/app-store/locations.ts
@@ -16,5 +16,27 @@ export enum AppStoreLocationType {
Teams = "integrations:office365_video",
}
+export type LocationObject = {
+ type: LocationType;
+ address?: string;
+ link?: string;
+ displayLocationPublicly?: boolean;
+ hostPhoneNumber?: string;
+};
+
export const LocationType = { ...DefaultLocationType, ...AppStoreLocationType };
export type LocationType = DefaultLocationType | AppStoreLocationType;
+
+export const locationHiddenFilter = (locations: LocationObject[]) =>
+ locations.filter((el) => {
+ // Filter out locations that are not to be displayed publicly
+ const values = Object.values(AppStoreLocationType);
+ // Display if the location can be set to public - and also display all locations like google meet etc
+ if (el.displayLocationPublicly || values.includes(el["type"] as unknown as AppStoreLocationType))
+ return el;
+ else {
+ delete el.address;
+ delete el.link;
+ return el;
+ }
+ });
diff --git a/packages/app-store/utils.ts b/packages/app-store/utils.ts
index ebfb043a222..81716232575 100644
--- a/packages/app-store/utils.ts
+++ b/packages/app-store/utils.ts
@@ -113,6 +113,14 @@ export function getLocationTypes(): string[] {
export function getLocationLabels(t: TFunction) {
const defaultLocationLabels = defaultLocations.reduce((locations, location) => {
+ if(location.label === "attendee_phone_number") {
+ locations[location.value] = t("your_number")
+ return locations
+ }
+ if(location.label === "host_phone_number") {
+ locations[location.value] = `${t("phone_call")} (${t("number_provided")})`
+ return locations
+ }
locations[location.value] = t(location.label);
return locations;
}, {} as Record<LocationType, string>);
diff --git a/packages/app-store/vital/lib/templates/attendee-request-reschedule-email.ts b/packages/app-store/vital/lib/templates/attendee-request-reschedule-email.ts
index 6052ef19c42..a032a37be87 100644
--- a/packages/app-store/vital/lib/templates/attendee-request-reschedule-email.ts
+++ b/packages/app-store/vital/lib/templates/attendee-request-reschedule-email.ts
@@ -102,6 +102,7 @@ ${this.calEvent.organizer.language.translate("request_reschedule_title_attendee"
${this.calEvent.organizer.language.translate("request_reschedule_subtitle", {
organizer: this.calEvent.organizer.name,
})},
+${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getAdditionalNotes()}
@@ -150,6 +151,7 @@ ${getCancelLink(this.calEvent)}
<tr>
<td align="left" style="font-size:0px;padding:10px 40px;word-break:break-word;">
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getWho()}
diff --git a/packages/app-store/vital/lib/templates/base-template.ts b/packages/app-store/vital/lib/templates/base-template.ts
index cf0479bcf8d..3b8b1644631 100644
--- a/packages/app-store/vital/lib/templates/base-template.ts
+++ b/packages/app-store/vital/lib/templates/base-template.ts
@@ -406,4 +406,12 @@ ${getRichDescription(this.calEvent)}
protected getOrganizerEnd(): Dayjs {
return dayjs(this.calEvent.endTime).tz(this.getTimezone());
}
+
+ protected getReason(): string {
+ return `
+ <div style="line-height: 6px; margin-bottom: 24px;">
+ <p style="color: #494949;">${this.calEvent.attendees[0].language.translate("reschedule_reason")}</p>
+ <p style="color: #494949; font-weight: 400; line-height: 24px;">${this.calEvent.cancellationReason}</p>
+ </div>`;
+ }
}
diff --git a/packages/app-store/vital/lib/templates/organizer-request-reschedule-email.ts b/packages/app-store/vital/lib/templates/organizer-request-reschedule-email.ts
index 716d47d3d13..2c5a9a56e13 100644
--- a/packages/app-store/vital/lib/templates/organizer-request-reschedule-email.ts
+++ b/packages/app-store/vital/lib/templates/organizer-request-reschedule-email.ts
@@ -111,6 +111,7 @@ ${this.calEvent.organizer.language.translate("request_reschedule_title_organizer
${this.calEvent.organizer.language.translate("request_reschedule_subtitle_organizer", {
attendee: this.calEvent.attendees[0].name,
})},
+${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getLocation()}
@@ -162,6 +163,7 @@ ${getCancelLink(this.calEvent)}
<tr>
<td align="left" style="font-size:0px;padding:10px 40px;word-break:break-word;">
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getWho()}
diff --git a/packages/app-store/wipemycalother/lib/templates/attendee-request-reschedule-email.ts b/packages/app-store/wipemycalother/lib/templates/attendee-request-reschedule-email.ts
index 6052ef19c42..a032a37be87 100644
--- a/packages/app-store/wipemycalother/lib/templates/attendee-request-reschedule-email.ts
+++ b/packages/app-store/wipemycalother/lib/templates/attendee-request-reschedule-email.ts
@@ -102,6 +102,7 @@ ${this.calEvent.organizer.language.translate("request_reschedule_title_attendee"
${this.calEvent.organizer.language.translate("request_reschedule_subtitle", {
organizer: this.calEvent.organizer.name,
})},
+${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getAdditionalNotes()}
@@ -150,6 +151,7 @@ ${getCancelLink(this.calEvent)}
<tr>
<td align="left" style="font-size:0px;padding:10px 40px;word-break:break-word;">
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getWho()}
diff --git a/packages/app-store/wipemycalother/lib/templates/base-template.ts b/packages/app-store/wipemycalother/lib/templates/base-template.ts
index fe48304c729..244804b48e7 100644
--- a/packages/app-store/wipemycalother/lib/templates/base-template.ts
+++ b/packages/app-store/wipemycalother/lib/templates/base-template.ts
@@ -406,4 +406,12 @@ ${getRichDescription(this.calEvent)}
protected getOrganizerEnd(): Dayjs {
return dayjs(this.calEvent.endTime).tz(this.getTimezone());
}
+
+ protected getReason(): string {
+ return `
+ <div style="line-height: 6px; margin-bottom: 24px;">
+ <p style="color: #494949;">${this.calEvent.attendees[0].language.translate("reschedule_reason")}</p>
+ <p style="color: #494949; font-weight: 400; line-height: 24px;">${this.calEvent.cancellationReason}</p>
+ </div>`;
+ }
}
diff --git a/packages/app-store/wipemycalother/lib/templates/organizer-request-reschedule-email.ts b/packages/app-store/wipemycalother/lib/templates/organizer-request-reschedule-email.ts
index 716d47d3d13..c79f335014c 100644
--- a/packages/app-store/wipemycalother/lib/templates/organizer-request-reschedule-email.ts
+++ b/packages/app-store/wipemycalother/lib/templates/organizer-request-reschedule-email.ts
@@ -111,6 +111,7 @@ ${this.calEvent.organizer.language.translate("request_reschedule_title_organizer
${this.calEvent.organizer.language.translate("request_reschedule_subtitle_organizer", {
attendee: this.calEvent.attendees[0].name,
})},
+${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getLocation()}
@@ -162,6 +163,7 @@ ${getCancelLink(this.calEvent)}
<tr>
<td align="left" style="font-size:0px;padding:10px 40px;word-break:break-word;">
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
+ ${this.calEvent.cancellationReason && this.getReason()}
${this.getWhat()}
${this.getWhen()}
${this.getWho()}
diff --git a/packages/config/package.json b/packages/config/package.json
index 6f6d36f43e3..3adf1f6b466 100644
--- a/packages/config/package.json
+++ b/packages/config/package.json
@@ -15,6 +15,7 @@
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.1",
+ "@tailwindcss/line-clamp": "^0.4.0",
"@tailwindcss/typography": "^0.5.2",
"@trivago/prettier-plugin-sort-imports": "3.2.0",
"@typescript-eslint/eslint-plugin": "^5.25.0",
diff --git a/packages/config/tailwind-preset.js b/packages/config/tailwind-preset.js
index 9da654607ff..afd57f77405 100644
--- a/packages/config/tailwind-preset.js
+++ b/packages/config/tailwind-preset.js
@@ -143,5 +143,9 @@ module.exports = {
}),
},
},
- plugins: [require("@tailwindcss/forms"), require("@tailwindcss/typography")],
+ plugins: [
+ require("@tailwindcss/forms"),
+ require("@tailwindcss/typography"),
+ require("@tailwindcss/line-clamp"),
+ ],
};
diff --git a/packages/core/EventManager.ts b/packages/core/EventManager.ts
index 27adf6fa561..9f0c89fc7df 100644
--- a/packages/core/EventManager.ts
+++ b/packages/core/EventManager.ts
@@ -165,7 +165,8 @@ export default class EventManager {
public async update(
event: CalendarEvent,
rescheduleUid: string,
- newBookingId?: number
+ newBookingId?: number,
+ rescheduleReason?: string
): Promise<CreateUpdateResult> {
const evt = processLocation(event);
@@ -201,6 +202,16 @@ export default class EventManager {
throw new Error("booking not found");
}
+ // Add reschedule reason to new booking
+ await prisma.booking.update({
+ where: {
+ id: newBookingId,
+ },
+ data: {
+ cancellationReason: rescheduleReason,
+ },
+ });
+
const isDedicated = evt.location ? isDedicatedIntegration(evt.location) : null;
const results: Array<EventResult> = [];
// If and only if event type is a dedicated meeting, update the dedicated video meeting.
diff --git a/packages/ee/server/checkLicense.ts b/packages/ee/server/checkLicense.ts
new file mode 100644
index 00000000000..cf359912e40
--- /dev/null
+++ b/packages/ee/server/checkLicense.ts
@@ -0,0 +1,25 @@
+import cache from "memory-cache";
+
+import { CONSOLE_URL } from "@calcom/lib/constants";
+
+const CACHING_TIME = 86400000; // 24 hours in milliseconds
+
+async function checkLicense(license: string): Promise<boolean> {
+ if (!!process.env.NEXT_PUBLIC_IS_E2E) return true;
+ const url = `${CONSOLE_URL}/api/license?key=${license}`;
+ const cachedResponse = cache.get(url);
+ if (cachedResponse) {
+ return cachedResponse;
+ } else {
+ try {
+ const response = await fetch(url);
+ const data = await response.json();
+ cache.put(url, data.valid, CACHING_TIME);
+ return data.valid;
+ } catch (error) {
+ return false;
+ }
+ }
+}
+
+export default checkLicense;
diff --git a/packages/embeds/embed-core/embed-iframe.ts b/packages/embeds/embed-core/embed-iframe.ts
new file mode 100644
index 00000000000..f1811a93146
--- /dev/null
+++ b/packages/embeds/embed-core/embed-iframe.ts
@@ -0,0 +1,2 @@
+export * from "./src/embed-iframe";
+export * from "./src/sdk-event";
diff --git a/packages/embeds/embed-core/env.d.ts b/packages/embeds/embed-core/env.d.ts
index d4685a2c088..f8e62b46a53 100644
--- a/packages/embeds/embed-core/env.d.ts
+++ b/packages/embeds/embed-core/env.d.ts
@@ -1,7 +1,9 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
- readonly NEXT_PUBLIC_WEBSITE_URL: string;
+ readonly EMBED_PUBLIC_WEBAPP_URL: string;
+ readonly EMBED_PUBLIC_VERCEL_URL: string;
+ readonly EMBED_PUBLIC_EMBED_LIB_URL: string;
}
interface ImportMeta {
diff --git a/packages/embeds/embed-core/index.ts b/packages/embeds/embed-core/index.ts
index f1811a93146..b0ce1fa8303 100644
--- a/packages/embeds/embed-core/index.ts
+++ b/packages/embeds/embed-core/index.ts
@@ -1,2 +1,2 @@
-export * from "./src/embed-iframe";
export * from "./src/sdk-event";
+export * from "./src/embed";
diff --git a/packages/embeds/embed-core/package.json b/packages/embeds/embed-core/package.json
index ebd8ec7cd0d..0908082761a 100644
--- a/packages/embeds/embed-core/package.json
+++ b/packages/embeds/embed-core/package.json
@@ -1,11 +1,14 @@
{
"name": "@calcom/embed-core",
- "version": "1.0.0",
+ "version": "1.1.0",
"description": "This is the vanilla JS core script that embeds Cal Link",
- "main": "./index.ts",
+ "main": "./dist/embed/embed.js",
+ "types": "./dist/index.d.ts",
"scripts": {
- "__build": "yarn tailwind && vite build",
- "__dev": "yarn __build --mode development",
+ "embed-dev": "yarn workspace @calcom/embed-core dev",
+ "embed-web-start": "yarn workspace @calcom/web start",
+ "__build": "yarn tailwind && vite build && yarn tsc --emitDeclarationOnly --declarationDir dist && cp -r ../../../apps/web/public/embed ./dist/",
+ "__dev": "yarn tailwind && vite build --mode development",
"build": "NEXT_PUBLIC_EMBED_FINGER_PRINT=$(git rev-parse --short HEAD) yarn __build",
"build-preview": "PREVIEW_BUILD=1 yarn __build ",
"vite": "vite",
@@ -16,8 +19,13 @@
"type-check": "tsc --pretty --noEmit",
"lint": "eslint --ext .ts,.js src",
"embed-tests": "yarn playwright test --config=playwright/config/playwright.config.ts",
- "embed-tests-quick": "QUICK=true yarn embed-tests"
+ "embed-tests-quick": "QUICK=true yarn embed-tests",
+ "embed-tests-update-snapshots:ci": "yarn embed-tests-quick --update-snapshots",
+ "prepare": "NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn build"
},
+ "files": [
+ "dist"
+ ],
"postcss": {
"map": false,
"plugins": {
@@ -29,11 +37,10 @@
"autoprefixer": "^10.4.7",
"eslint": "^8.15.0",
"postcss": "^8.4.13",
- "vite": "^2.9.9"
- },
- "dependencies": {
+ "vite": "^2.9.9",
"tailwindcss": "^3.0.24",
"tsc": "^2.0.4",
"typescript": "^4.6.4"
- }
+ },
+ "dependencies": {}
}
diff --git a/packages/embeds/embed-core/playwright/config/playwright.config.ts b/packages/embeds/embed-core/playwright/config/playwright.config.ts
index 7ccb45ffc35..469dc701244 100644
--- a/packages/embeds/embed-core/playwright/config/playwright.config.ts
+++ b/packages/embeds/embed-core/playwright/config/playwright.config.ts
@@ -1,6 +1,8 @@
import { PlaywrightTestConfig, Frame, devices, expect } from "@playwright/test";
import * as path from "path";
+require("dotenv").config({ path: "../../../../../.env" });
+
const outputDir = path.join("../results");
const testDir = path.join("../tests");
const quickMode = process.env.QUICK === "true";
@@ -22,12 +24,13 @@ const config: PlaywrightTestConfig = {
expect: {
toMatchSnapshot: {
// Opacity transitions can cause small differences
- maxDiffPixels: 50,
+ // Every month the rendered month changes failing the snapshot tests. So, increase the threshold to catch major bugs only.
+ maxDiffPixelRatio: 0.1,
},
},
webServer: {
- // Start App Server manually - Can't be handled here. See https://github.com/microsoft/playwright/issues/8206
- command: "yarn workspace @calcom/embed-core dev",
+ // Run servers in parallel as Playwright doesn't support two different webserver commands at the moment See https://github.com/microsoft/playwright/issues/8206
+ command: "yarn run-p 'embed-dev' 'embed-web-start'",
port: 3100,
timeout: 60_000,
reuseExistingServer: !process.env.CI,
@@ -123,7 +126,7 @@ expect.extend({
const searchParams = u.searchParams;
const expectedSearchParams = expectedUrlDetails.searchParams || {};
- for (let [expectedKey, expectedValue] of Object.entries(expectedSearchParams)) {
+ for (const [expectedKey, expectedValue] of Object.entries(expectedSearchParams)) {
const value = searchParams.get(expectedKey);
if (value !== expectedValue) {
return {
diff --git a/packages/embeds/embed-core/playwright/lib/testUtils.ts b/packages/embeds/embed-core/playwright/lib/testUtils.ts
index 1ab43dad748..659c69cff9b 100644
--- a/packages/embeds/embed-core/playwright/lib/testUtils.ts
+++ b/packages/embeds/embed-core/playwright/lib/testUtils.ts
@@ -34,9 +34,20 @@ export const getBooking = async (bookingId: string) => {
export const getEmbedIframe = async ({ page, pathname }: { page: Page; pathname: string }) => {
// FIXME: Need to wait for the iframe to be properly added to shadow dom. There should be a no time boundation way to do it.
await new Promise((resolve) => {
- setTimeout(resolve, 2000);
+ // Keep checking
+ const interval = setInterval(() => {
+ if (page.frame("cal-embed")) {
+ resolve(true);
+ }
+ }, 1000);
+
+ // Hard Timer
+ setTimeout(() => {
+ clearInterval(interval);
+ resolve(true);
+ }, 10000);
});
- let embedIframe = page.frame("cal-embed");
+ const embedIframe = page.frame("cal-embed");
if (!embedIframe) {
return null;
}
@@ -83,7 +94,7 @@ export async function bookFirstEvent(username: string, frame: Frame, page: Page)
const responseObj = await response.json();
const bookingId = responseObj.uid;
// Make sure we're navigated to the success page
- await expect(page.locator("[data-testid=success-page]")).toBeVisible();
+ await expect(frame.locator("[data-testid=success-page]")).toBeVisible();
expect(await page.screenshot()).toMatchSnapshot("success-page.png");
return bookingId;
}
diff --git a/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/availability-page-1-chromium-darwin.png b/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/availability-page-1-chromium-darwin.png
index d269136c12c..fba6e755687 100644
Binary files a/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/availability-page-1-chromium-darwin.png and b/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/availability-page-1-chromium-darwin.png differ
diff --git a/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/booking-page-chromium-darwin.png b/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/booking-page-chromium-darwin.png
index 83f9a756f80..fd2bde81e4b 100644
Binary files a/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/booking-page-chromium-darwin.png and b/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/booking-page-chromium-darwin.png differ
diff --git a/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/event-types-list-chromium-darwin.png b/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/event-types-list-chromium-darwin.png
index 9a3009653e3..5d2f8988a43 100644
Binary files a/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/event-types-list-chromium-darwin.png and b/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/event-types-list-chromium-darwin.png differ
diff --git a/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/success-page-chromium-darwin.png b/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/success-page-chromium-darwin.png
index cce76a43e11..940b5402263 100644
Binary files a/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/success-page-chromium-darwin.png and b/packages/embeds/embed-core/playwright/tests/inline.test.ts-snapshots/success-page-chromium-darwin.png differ
diff --git a/packages/embeds/embed-core/src/FloatingButton/FloatingButton.ts b/packages/embeds/embed-core/src/FloatingButton/FloatingButton.ts
index 0c9e9e8e9f8..484fa3088b2 100644
--- a/packages/embeds/embed-core/src/FloatingButton/FloatingButton.ts
+++ b/packages/embeds/embed-core/src/FloatingButton/FloatingButton.ts
@@ -1,5 +1,4 @@
-import { CalWindow } from "@calcom/embed-snippet";
-
+import { CalWindow } from "../embed";
import getFloatingButtonHtml from "./FloatingButtonHtml";
export class FloatingButton extends HTMLElement {
diff --git a/packages/embeds/embed-core/src/Inline/inline.ts b/packages/embeds/embed-core/src/Inline/inline.ts
index 6cd74ec4a14..a1f1c260d41 100644
--- a/packages/embeds/embed-core/src/Inline/inline.ts
+++ b/packages/embeds/embed-core/src/Inline/inline.ts
@@ -1,5 +1,4 @@
-import { CalWindow } from "@calcom/embed-snippet";
-
+import { CalWindow } from "../embed";
import loaderCss from "../loader.css";
import { getErrorString } from "../utils";
import inlineHtml from "./inlineHtml";
diff --git a/packages/embeds/embed-core/src/ModalBox/ModalBox.ts b/packages/embeds/embed-core/src/ModalBox/ModalBox.ts
index eab4215a8a0..8da0e864669 100644
--- a/packages/embeds/embed-core/src/ModalBox/ModalBox.ts
+++ b/packages/embeds/embed-core/src/ModalBox/ModalBox.ts
@@ -1,5 +1,4 @@
-import { CalWindow } from "@calcom/embed-snippet";
-
+import { CalWindow } from "../embed";
import loaderCss from "../loader.css";
import { getErrorString } from "../utils";
import modalBoxHtml from "./ModalBoxHtml";
diff --git a/packages/embeds/embed-core/src/embed.ts b/packages/embeds/embed-core/src/embed.ts
index 7a2ba6371b4..709dd1221ca 100644
--- a/packages/embeds/embed-core/src/embed.ts
+++ b/packages/embeds/embed-core/src/embed.ts
@@ -1,5 +1,3 @@
-import type { CalWindow } from "@calcom/embed-snippet";
-
import { FloatingButton } from "./FloatingButton/FloatingButton";
import { Inline } from "./Inline/inline";
import { ModalBox } from "./ModalBox/ModalBox";
@@ -11,8 +9,7 @@ import allCss from "./tailwind.generated.css";
// HACK: Redefine and don't import WEBAPP_URL as it causes import statement to be present in built file.
// This is happening because we are not able to generate an App and a lib using single Vite Config.
const WEBAPP_URL =
- (import.meta.env.NEXT_PUBLIC_WEBAPP_URL_TYPO as string) ||
- `https://${import.meta.env.NEXT_PUBLIC_VERCEL_URL}`;
+ import.meta.env.EMBED_PUBLIC_WEBAPP_URL || `https://${import.meta.env.EMBED_PUBLIC_VERCEL_URL}`;
customElements.define("cal-modal-box", ModalBox);
customElements.define("cal-floating-button", FloatingButton);
@@ -33,7 +30,7 @@ if (!globalCal || !globalCal.q) {
// Store Commit Hash to know exactly what version of the code is running
// TODO: Ideally it should be the version as per package.json and then it can be renamed to version.
// But because it is built on local machine right now, it is much more reliable to have the commit hash.
-globalCal.fingerprint = import.meta.env.NEXT_PUBLIC_EMBED_FINGER_PRINT as string;
+globalCal.fingerprint = import.meta.env.EMBED_PUBLIC_EMBED_FINGER_PRINT as string;
globalCal.__css = allCss;
document.head.appendChild(document.createElement("style")).innerHTML = css;
@@ -512,6 +509,24 @@ export class Cal {
}
}
+export interface GlobalCal {
+ (methodName: string, arg?: any): void;
+ /** Marks that the embed.js is loaded. Avoids re-downloading it. */
+ loaded?: boolean;
+ /** Maintains a queue till the time embed.js isn't loaded */
+ q?: InstructionQueue;
+ /** If user registers multiple namespaces, those are available here */
+ ns?: Record<string, GlobalCal>;
+ instance?: Cal;
+ __css?: string;
+ fingerprint?: string;
+ __logQueue?: any[];
+}
+
+export interface CalWindow extends Window {
+ Cal?: GlobalCal;
+}
+
globalCal.instance = new Cal("", globalCal.q!);
for (const [ns, api] of Object.entries(globalCal.ns!)) {
diff --git a/packages/embeds/embed-core/src/preview.ts b/packages/embeds/embed-core/src/preview.ts
index b2d2763459a..6a9168aafb9 100644
--- a/packages/embeds/embed-core/src/preview.ts
+++ b/packages/embeds/embed-core/src/preview.ts
@@ -1,10 +1,10 @@
-import { CalWindow } from "@calcom/embed-snippet";
+import { CalWindow } from "./embed";
const WEBAPP_URL =
- import.meta.env.NEXT_PUBLIC_WEBAPP_URL || `https://${import.meta.env.NEXT_PUBLIC_VERCEL_URL}`;
-const EMBED_LIB_URL = import.meta.env.NEXT_PUBLIC_EMBED_LIB_URL || `${WEBAPP_URL}/embed/embed.js`;
+ import.meta.env.EMBED_PUBLIC_WEBAPP_URL || `https://${import.meta.env.EMBED_PUBLIC_VERCEL_URL}`;
+const EMBED_LIB_URL = import.meta.env.EMBED_PUBLIC_EMBED_LIB_URL || `${WEBAPP_URL}/embed/embed.js`;
-(window as any).fingerprint = import.meta.env.NEXT_PUBLIC_EMBED_FINGER_PRINT as string;
+(window as any).fingerprint = import.meta.env.EMBED_PUBLIC_EMBED_FINGER_PRINT as string;
// Install Cal Embed Code Snippet
(function (C, A, L) {
diff --git a/packages/embeds/embed-core/tsconfig.json b/packages/embeds/embed-core/tsconfig.json
index bd3b3e6f546..5e1617a4735 100644
--- a/packages/embeds/embed-core/tsconfig.json
+++ b/packages/embeds/embed-core/tsconfig.json
@@ -8,6 +8,6 @@
"moduleResolution": "Node",
"baseUrl": "."
},
- "include": ["."],
+ "include": ["src", "env.d.ts", "index.ts"],
"exclude": ["dist", "build", "node_modules"]
}
diff --git a/packages/embeds/embed-core/vite.config.js b/packages/embeds/embed-core/vite.config.js
index cfe4c9cd1ef..0f947755611 100644
--- a/packages/embeds/embed-core/vite.config.js
+++ b/packages/embeds/embed-core/vite.config.js
@@ -1,12 +1,11 @@
-require("dotenv").config({ path: "../../../.env" });
-
-process.env.NEXT_PUBLIC_VERCEL_URL = process.env.VERCEL_URL;
+import viteBaseConfig from "../vite.config";
const path = require("path");
const { defineConfig } = require("vite");
+
module.exports = defineConfig((configEnv) => {
const config = {
- envPrefix: "NEXT_PUBLIC_",
+ ...viteBaseConfig,
base: "/embed/",
build: {
minify: "terser",
diff --git a/packages/embeds/embed-react/env.d.ts b/packages/embeds/embed-react/env.d.ts
index 11f02fe2a00..f8e62b46a53 100644
--- a/packages/embeds/embed-react/env.d.ts
+++ b/packages/embeds/embed-react/env.d.ts
@@ -1 +1,11 @@
/// <reference types="vite/client" />
+
+interface ImportMetaEnv {
+ readonly EMBED_PUBLIC_WEBAPP_URL: string;
+ readonly EMBED_PUBLIC_VERCEL_URL: string;
+ readonly EMBED_PUBLIC_EMBED_LIB_URL: string;
+}
+
+interface ImportMeta {
+ readonly env: ImportMetaEnv;
+}
diff --git a/packages/embeds/embed-react/package.json b/packages/embeds/embed-react/package.json
index a8e7cfd0523..67fbd3d572f 100644
--- a/packages/embeds/embed-react/package.json
+++ b/packages/embeds/embed-react/package.json
@@ -1,23 +1,26 @@
{
"name": "@calcom/embed-react",
- "version": "1.0.5",
+ "version": "1.0.6",
"description": "Embed Cal Link as a React Component",
"scripts": {
"dev": "vite --port=3101 --open",
"tsc": "tsc",
"build": "vite build && yarn tsc --emitDeclarationOnly --declarationDir dist",
"preview": "vite preview",
- "prepare": "yarn build",
+ "prepare": "NEXT_PUBLIC_EMBED_LIB_URL='https://app.cal.com/embed/embed.js' NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn build",
"type-check": "tsc --pretty --noEmit",
"lint": "eslint --ext .ts,.js,.tsx,.jsx ./src",
"embed-tests": "yarn playwright test --config=./playwright/config/playwright.config.ts",
"embed-tests-quick": "QUICK=true yarn embed-tests",
"publish-prod": "npm version patch && npm publish --access public",
- "publish-beta": "npm version prepatch && npm publish --access public --tag beta"
+ "publish-beta": "npm version prepatch && npm publish --access public --tag beta",
+ "embed-tests-update-snapshots:ci": "yarn embed-tests-quick --update-snapshots",
+ "embed-web-start": "yarn workspace @calcom/web start",
+ "embed-dev": "yarn workspace @calcom/embed-react dev"
},
"main": "./dist/Cal.umd.js",
"module": "./dist/Cal.es.js",
- "types": "./dist/src/index.d.ts",
+ "types": "./dist/index.d.ts",
"peerDependencies": {
"react": "^18.1.0",
"react-dom": "^18.1.0"
@@ -32,14 +35,16 @@
}
},
"devDependencies": {
- "@calcom/embed-snippet": "^1.0.0",
"@types/react": "18.0.9",
"@types/react-dom": "18.0.4",
"@vitejs/plugin-react": "^1.3.2",
"eslint": "^8.15.0",
- "vite": "^2.9.9"
+ "vite": "^2.9.9",
+ "playwright": "^1.22.1",
+ "typescript": "^4.6.4"
},
"dependencies": {
- "typescript": "^4.6.4"
+ "@calcom/embed-snippet": "1.0.1",
+ "@calcom/embed-core": "1.1.0"
}
}
diff --git a/packages/embeds/embed-react/playwright/config/playwright.config.ts b/packages/embeds/embed-react/playwright/config/playwright.config.ts
index f435c800182..7fee307daac 100644
--- a/packages/embeds/embed-react/playwright/config/playwright.config.ts
+++ b/packages/embeds/embed-react/playwright/config/playwright.config.ts
@@ -19,11 +19,10 @@ const projects = baseConfig.projects?.map((project) => {
const config: PlaywrightTestConfig = {
...baseConfig,
webServer: {
- // Start App Server manually - Can't be handled here. See https://github.com/microsoft/playwright/issues/8206
- command: "yarn workspace @calcom/embed-react dev",
- port: 3101,
+ command: "yarn run-p 'embed-dev' 'embed-web-start'",
+ port: 3000,
timeout: 60_000,
- reuseExistingServer: true,
+ reuseExistingServer: !process.env.CI,
},
use: {
...baseConfig.use,
diff --git a/packages/embeds/embed-react/src/index.ts b/packages/embeds/embed-react/src/index.ts
index e5743a0af07..527dc02bcb0 100644
--- a/packages/embeds/embed-react/src/index.ts
+++ b/packages/embeds/embed-react/src/index.ts
@@ -1,4 +1,4 @@
-import { CalWindow } from "@calcom/embed-snippet";
+import { CalWindow } from "@calcom/embed-core";
import Cal from "./Cal";
diff --git a/packages/embeds/embed-react/tsconfig.json b/packages/embeds/embed-react/tsconfig.json
index 81f5a963d3b..80c59646adf 100644
--- a/packages/embeds/embed-react/tsconfig.json
+++ b/packages/embeds/embed-react/tsconfig.json
@@ -10,6 +10,6 @@
"@lib/*": ["../../../apps/web/lib/*"]
}
},
- "include": ["."],
+ "include": ["src", "env.d.ts"],
"exclude": ["dist", "build", "node_modules", "test-cal.tsx"]
}
diff --git a/packages/embeds/embed-react/vite.config.js b/packages/embeds/embed-react/vite.config.js
index 991b5f4a23f..8992bec327f 100644
--- a/packages/embeds/embed-react/vite.config.js
+++ b/packages/embeds/embed-react/vite.config.js
@@ -2,10 +2,12 @@ import react from "@vitejs/plugin-react";
import path from "path";
import { defineConfig } from "vite";
+import viteBaseConfig from "../vite.config";
+
// https://vitejs.dev/config/
export default defineConfig({
+ ...viteBaseConfig,
plugins: [react()],
- envPrefix: "NEXT_PUBLIC_",
build: {
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
diff --git a/packages/embeds/embed-snippet/package.json b/packages/embeds/embed-snippet/package.json
index dedb9f1f97c..6e169b9d080 100644
--- a/packages/embeds/embed-snippet/package.json
+++ b/packages/embeds/embed-snippet/package.json
@@ -1,14 +1,23 @@
{
"name": "@calcom/embed-snippet",
- "version": "1.0.0",
- "main": "src/index.ts",
+ "version": "1.0.1",
+ "main": "./dist/snippet.umd.js",
+ "module": "./dist/snippet.es.js",
"description": "Vanilla JS embed snippet that is responsible to fetch @calcom/embed-core and thus show Cal Link as an embed on a page.",
"scripts": {
- "build": "vite build",
+ "build": "vite build && yarn tsc --emitDeclarationOnly --declarationDir dist",
"type-check": "tsc --pretty --noEmit",
- "lint": "eslint --ext .ts,.js src"
+ "lint": "eslint --ext .ts,.js src",
+ "prepare": "NEXT_PUBLIC_EMBED_LIB_URL='https://app.cal.com/embed/embed.js' NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn build"
},
+ "files": [
+ "dist"
+ ],
+ "types": "./dist/index.d.ts",
"devDependencies": {
"eslint": "^8.15.0"
+ },
+ "dependencies": {
+ "@calcom/embed-core": "^1.1.0"
}
}
diff --git a/packages/embeds/embed-snippet/src/index.ts b/packages/embeds/embed-snippet/src/index.ts
index 9d877a90162..ab9d2a5b1d7 100644
--- a/packages/embeds/embed-snippet/src/index.ts
+++ b/packages/embeds/embed-snippet/src/index.ts
@@ -4,30 +4,12 @@
* As we want to keep control on the size of this snippet but we want some portion of it to be still readable.
* So, write the code that you need directly but keep it short.
*/
-import type { Cal as CalClass, InstructionQueue } from "@calcom/embed-core/src/embed";
+import { CalWindow } from "@calcom/embed-core";
const WEBAPP_URL =
- import.meta.env.NEXT_PUBLIC_WEBAPP_URL || `https://${import.meta.env.NEXT_PUBLIC_VERCEL_URL}`;
+ import.meta.env.EMBED_PUBLIC_WEBAPP_URL || `https://${import.meta.env.EMBED_PUBLIC_VERCEL_URL}`;
-const EMBED_LIB_URL = import.meta.env.NEXT_PUBLIC_EMBED_LIB_URL || `${WEBAPP_URL}/embed/embed.js`;
-
-export interface GlobalCal {
- (methodName: string, arg?: any): void;
- /** Marks that the embed.js is loaded. Avoids re-downloading it. */
- loaded?: boolean;
- /** Maintains a queue till the time embed.js isn't loaded */
- q?: InstructionQueue;
- /** If user registers multiple namespaces, those are available here */
- ns?: Record<string, GlobalCal>;
- instance?: CalClass;
- __css?: string;
- fingerprint?: string;
- __logQueue?: any[];
-}
-
-export interface CalWindow extends Window {
- Cal?: GlobalCal;
-}
+const EMBED_LIB_URL = import.meta.env.EMBED_PUBLIC_EMBED_LIB_URL || `${WEBAPP_URL}/embed/embed.js`;
export default function EmbedSnippet(url = EMBED_LIB_URL) {
(function (C: CalWindow, A, L) {
diff --git a/packages/embeds/embed-snippet/tsconfig.json b/packages/embeds/embed-snippet/tsconfig.json
index 42b3877672f..05d7d4266bc 100644
--- a/packages/embeds/embed-snippet/tsconfig.json
+++ b/packages/embeds/embed-snippet/tsconfig.json
@@ -2,7 +2,8 @@
"extends": "@calcom/tsconfig/base.json",
"compilerOptions": {
"baseUrl": ".",
- "module": "esnext"
+ "module": "esnext",
+ "declaration": true
},
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
diff --git a/packages/embeds/embed-snippet/vite.config.js b/packages/embeds/embed-snippet/vite.config.js
index bee01c77acf..b23b88e11d7 100644
--- a/packages/embeds/embed-snippet/vite.config.js
+++ b/packages/embeds/embed-snippet/vite.config.js
@@ -1,13 +1,11 @@
-require("dotenv").config({ path: "../../../.env" });
+import viteBaseConfig from "../vite.config";
const path = require("path");
const { defineConfig } = require("vite");
-process.env.NEXT_PUBLIC_VERCEL_URL = process.env.VERCEL_URL;
-
module.exports = defineConfig({
+ ...viteBaseConfig,
build: {
- envPrefix: "NEXT_PUBLIC_",
lib: {
entry: path.resolve(__dirname, "src", "index.ts"),
name: "snippet",
diff --git a/packages/embeds/vite.config.js b/packages/embeds/vite.config.js
new file mode 100644
index 00000000000..17bef332d0a
--- /dev/null
+++ b/packages/embeds/vite.config.js
@@ -0,0 +1,9 @@
+require("dotenv").config({ path: "../../.env" });
+process.env.EMBED_PUBLIC_VERCEL_URL = process.env.VERCEL_URL;
+process.env.EMBED_PUBLIC_WEBAPP_URL = process.env.NEXT_PUBLIC_WEBAPP_URL;
+process.env.EMBED_PUBLIC_EMBED_LIB_URL = process.env.NEXT_PUBLIC_EMBED_LIB_URL;
+
+const viteBaseConfig = {
+ envPrefix: "EMBED_PUBLIC_",
+};
+export default viteBaseConfig;
diff --git a/packages/lib/availability.ts b/packages/lib/availability.ts
index 4bb39609a98..a27932e5737 100644
--- a/packages/lib/availability.ts
+++ b/packages/lib/availability.ts
@@ -4,9 +4,10 @@ import customParseFormat from "dayjs/plugin/customParseFormat";
import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
-import { nameOfDay } from "@calcom/lib/weekday";
import type { Schedule, TimeRange, WorkingHours } from "@calcom/types/schedule";
+import { nameOfDay } from "./weekday";
+
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(customParseFormat);
diff --git a/packages/lib/constants.ts b/packages/lib/constants.ts
index 4d0fa7ad955..2f876b4fb6c 100644
--- a/packages/lib/constants.ts
+++ b/packages/lib/constants.ts
@@ -2,6 +2,12 @@ export const WEBAPP_URL = process.env.NEXT_PUBLIC_WEBAPP_URL || `https://${proce
/** @deprecated use `WEBAPP_URL` */
export const BASE_URL = WEBAPP_URL;
export const WEBSITE_URL = process.env.NEXT_PUBLIC_WEBSITE_URL || "https://cal.com";
+
+// This is the URL from which all Cal Links and their assets are served.
+// Use website URL to make links shorter(cal.com and not app.cal.com)
+// As website isn't setup for preview environments, use the webapp url instead
+export const CAL_URL = new URL(WEBAPP_URL).hostname.endsWith(".vercel.app") ? WEBAPP_URL : WEBSITE_URL;
+
export const CONSOLE_URL = WEBAPP_URL.startsWith("http://localhost")
? "http://localhost:3004"
: `https://console.cal.${process.env.VERCEL_ENV === "production" ? "com" : "dev"}`;
diff --git a/packages/lib/defaultEvents.ts b/packages/lib/defaultEvents.ts
index baa5fabe4bf..b7e3050ad3f 100644
--- a/packages/lib/defaultEvents.ts
+++ b/packages/lib/defaultEvents.ts
@@ -1,4 +1,5 @@
-import { PeriodType, SchedulingType, UserPlan, EventTypeCustomInput } from "@prisma/client";
+import type { EventTypeCustomInput } from "@prisma/client";
+import { PeriodType, SchedulingType, UserPlan } from "@prisma/client";
const availability = [
{
@@ -49,6 +50,7 @@ const commons = {
price: 0,
currency: "usd",
schedulingType: SchedulingType.COLLECTIVE,
+ seatsPerTimeSlot: null,
id: 0,
metadata: {
smartContractAddress: "",
diff --git a/packages/lib/isPrismaObj.ts b/packages/lib/isPrismaObj.ts
index 797f4be7b42..d405ab32b3a 100644
--- a/packages/lib/isPrismaObj.ts
+++ b/packages/lib/isPrismaObj.ts
@@ -1,4 +1,4 @@
-import { Prisma } from "@prisma/client";
+import type { Prisma } from "@prisma/client";
function isPrismaObj(obj: unknown): obj is Prisma.JsonObject {
return typeof obj === "object" && !Array.isArray(obj);
diff --git a/packages/lib/package.json b/packages/lib/package.json
index cd3e443f459..017004bd7e8 100644
--- a/packages/lib/package.json
+++ b/packages/lib/package.json
@@ -5,6 +5,7 @@
"types": "./index.ts",
"license": "MIT",
"dependencies": {
+ "@prisma/client": "^3.14.0",
"bcryptjs": "^2.4.3",
"dayjs": "^1.11.2",
"ical.js": "^1.4.0",
@@ -17,6 +18,7 @@
},
"devDependencies": {
"@calcom/tsconfig": "*",
+ "@calcom/types": "*",
"typescript": "^4.6.4"
}
}
diff --git a/packages/prisma/migrations/20220413173832_add_seats_to_event_type_model/migration.sql b/packages/prisma/migrations/20220413173832_add_seats_to_event_type_model/migration.sql
new file mode 100644
index 00000000000..301021d04cc
--- /dev/null
+++ b/packages/prisma/migrations/20220413173832_add_seats_to_event_type_model/migration.sql
@@ -0,0 +1,3 @@
+-- AlterTable
+ALTER TABLE "EventType" ADD COLUMN "seatsPerTimeSlot" INTEGER;
+
diff --git a/packages/prisma/migrations/20220513151152_adds_feedback_table/migration.sql b/packages/prisma/migrations/20220513151152_adds_feedback_table/migration.sql
new file mode 100644
index 00000000000..0785f5c03b1
--- /dev/null
+++ b/packages/prisma/migrations/20220513151152_adds_feedback_table/migration.sql
@@ -0,0 +1,10 @@
+-- CreateTable
+CREATE TABLE "Feedback" (
+ "id" SERIAL NOT NULL,
+ "date" TIMESTAMP(3) NOT NULL,
+ "userId" INTEGER NOT NULL,
+ "rating" TEXT NOT NULL,
+ "comment" TEXT,
+
+ CONSTRAINT "Feedback_pkey" PRIMARY KEY ("id")
+);
diff --git a/packages/prisma/migrations/20220518201335_add_user_relationship_to_feedback/migration.sql b/packages/prisma/migrations/20220518201335_add_user_relationship_to_feedback/migration.sql
new file mode 100644
index 00000000000..dd771eb71b1
--- /dev/null
+++ b/packages/prisma/migrations/20220518201335_add_user_relationship_to_feedback/migration.sql
@@ -0,0 +1,2 @@
+-- AddForeignKey
+ALTER TABLE "Feedback" ADD CONSTRAINT "Feedback_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/packages/prisma/migrations/20220525110759_add_user_impersonation_toggle/migration.sql b/packages/prisma/migrations/20220525110759_add_user_impersonation_toggle/migration.sql
new file mode 100644
index 00000000000..8872876bfa7
--- /dev/null
+++ b/packages/prisma/migrations/20220525110759_add_user_impersonation_toggle/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "users" ADD COLUMN "disableImpersonation" BOOLEAN NOT NULL DEFAULT false;
diff --git a/packages/prisma/migrations/20220526151550_cascades_impersonations_on_user_delete/migration.sql b/packages/prisma/migrations/20220526151550_cascades_impersonations_on_user_delete/migration.sql
new file mode 100644
index 00000000000..7539f3e27c6
--- /dev/null
+++ b/packages/prisma/migrations/20220526151550_cascades_impersonations_on_user_delete/migration.sql
@@ -0,0 +1,11 @@
+-- DropForeignKey
+ALTER TABLE "Impersonations" DROP CONSTRAINT "Impersonations_impersonatedById_fkey";
+
+-- DropForeignKey
+ALTER TABLE "Impersonations" DROP CONSTRAINT "Impersonations_impersonatedUserId_fkey";
+
+-- AddForeignKey
+ALTER TABLE "Impersonations" ADD CONSTRAINT "Impersonations_impersonatedUserId_fkey" FOREIGN KEY ("impersonatedUserId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "Impersonations" ADD CONSTRAINT "Impersonations_impersonatedById_fkey" FOREIGN KEY ("impersonatedById") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma
index df719788c25..ff6b0594801 100644
--- a/packages/prisma/schema.prisma
+++ b/packages/prisma/schema.prisma
@@ -66,6 +66,7 @@ model EventType {
minimumBookingNotice Int @default(120)
beforeEventBuffer Int @default(0)
afterEventBuffer Int @default(0)
+ seatsPerTimeSlot Int?
schedulingType SchedulingType?
schedule Schedule?
price Int @default(0)
@@ -118,60 +119,62 @@ enum UserPermissionRole {
}
model User {
- id Int @id @default(autoincrement())
- username String? @unique
- name String?
+ id Int @id @default(autoincrement())
+ username String? @unique
+ name String?
/// @zod.email()
- email String @unique
- emailVerified DateTime?
- password String?
- bio String?
- avatar String?
- timeZone String @default("Europe/London")
- weekStart String @default("Sunday")
+ email String @unique
+ emailVerified DateTime?
+ password String?
+ bio String?
+ avatar String?
+ timeZone String @default("Europe/London")
+ weekStart String @default("Sunday")
// DEPRECATED - TO BE REMOVED
- startTime Int @default(0)
- endTime Int @default(1440)
+ startTime Int @default(0)
+ endTime Int @default(1440)
// </DEPRECATED>
- bufferTime Int @default(0)
- hideBranding Boolean @default(false)
- theme String?
- createdDate DateTime @default(now()) @map(name: "created")
- trialEndsAt DateTime?
- eventTypes EventType[] @relation("user_eventtype")
- credentials Credential[]
- teams Membership[]
- bookings Booking[]
- schedules Schedule[]
- defaultScheduleId Int?
- selectedCalendars SelectedCalendar[]
- completedOnboarding Boolean @default(false)
- locale String?
- timeFormat Int? @default(12)
- twoFactorSecret String?
- twoFactorEnabled Boolean @default(false)
- identityProvider IdentityProvider @default(CAL)
- identityProviderId String?
- availability Availability[]
- invitedTo Int?
- plan UserPlan @default(TRIAL)
- webhooks Webhook[]
- brandColor String @default("#292929")
- darkBrandColor String @default("#fafafa")
+ bufferTime Int @default(0)
+ hideBranding Boolean @default(false)
+ theme String?
+ createdDate DateTime @default(now()) @map(name: "created")
+ trialEndsAt DateTime?
+ eventTypes EventType[] @relation("user_eventtype")
+ credentials Credential[]
+ teams Membership[]
+ bookings Booking[]
+ schedules Schedule[]
+ defaultScheduleId Int?
+ selectedCalendars SelectedCalendar[]
+ completedOnboarding Boolean @default(false)
+ locale String?
+ timeFormat Int? @default(12)
+ twoFactorSecret String?
+ twoFactorEnabled Boolean @default(false)
+ identityProvider IdentityProvider @default(CAL)
+ identityProviderId String?
+ availability Availability[]
+ invitedTo Int?
+ plan UserPlan @default(TRIAL)
+ webhooks Webhook[]
+ brandColor String @default("#292929")
+ darkBrandColor String @default("#fafafa")
// the location where the events will end up
- destinationCalendar DestinationCalendar?
- away Boolean @default(false)
+ destinationCalendar DestinationCalendar?
+ away Boolean @default(false)
// participate in dynamic group booking or not
- allowDynamicBooking Boolean? @default(true)
- metadata Json?
- verified Boolean? @default(false)
- role UserPermissionRole @default(USER)
- impersonatedUsers Impersonations[] @relation("impersonated_user")
- impersonatedBy Impersonations[] @relation("impersonated_by_user")
- apiKeys ApiKey[]
- accounts Account[]
- sessions Session[]
-
+ allowDynamicBooking Boolean? @default(true)
+ metadata Json?
+ verified Boolean? @default(false)
+ role UserPermissionRole @default(USER)
+ disableImpersonation Boolean @default(false)
+ impersonatedUsers Impersonations[] @relation("impersonated_user")
+ impersonatedBy Impersonations[] @relation("impersonated_by_user")
+ apiKeys ApiKey[]
+ accounts Account[]
+ sessions Session[]
+
+ Feedback Feedback[]
@@map(name: "users")
}
@@ -399,8 +402,8 @@ model Webhook {
model Impersonations {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
- impersonatedUser User @relation("impersonated_user", fields: [impersonatedUserId], references: [id])
- impersonatedBy User @relation("impersonated_by_user", fields: [impersonatedById], references: [id])
+ impersonatedUser User @relation("impersonated_user", fields: [impersonatedUserId], references: [id], onDelete: Cascade)
+ impersonatedBy User @relation("impersonated_by_user", fields: [impersonatedById], references: [id], onDelete: Cascade)
impersonatedUserId Int
impersonatedById Int
}
@@ -476,3 +479,12 @@ model App {
Webhook Webhook[]
ApiKey ApiKey[]
}
+
+model Feedback {
+ id Int @id @default(autoincrement())
+ date DateTime
+ userId Int
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+ rating String
+ comment String?
+}
diff --git a/packages/prisma/zod-utils.ts b/packages/prisma/zod-utils.ts
index 9148f54dbc2..d926fdecb78 100644
--- a/packages/prisma/zod-utils.ts
+++ b/packages/prisma/zod-utils.ts
@@ -9,6 +9,7 @@ export const eventTypeLocations = z.array(
type: z.nativeEnum(LocationType),
address: z.string().optional(),
link: z.string().url().optional(),
+ displayLocationPublicly: z.boolean().optional(),
hostPhoneNumber: z.string().optional(),
})
);
diff --git a/packages/types/environment.d.ts b/packages/types/environment.d.ts
index 1156cec4733..29592266df5 100644
--- a/packages/types/environment.d.ts
+++ b/packages/types/environment.d.ts
@@ -10,6 +10,8 @@ declare namespace NodeJS {
* - Acquire a commercial license to remove these terms by visiting: cal.com/sales
**/
readonly NEXT_PUBLIC_LICENSE_CONSENT: "agree" | undefined;
+ /** Needed to enable enterprise-only features */
+ readonly CALCOM_LICENSE_KEY: string | undefined;
readonly CALENDSO_ENCRYPTION_KEY: string | undefined;
readonly DATABASE_URL: string | undefined;
readonly GOOGLE_API_CREDENTIALS: string | undefined;
diff --git a/packages/types/next-auth.d.ts b/packages/types/next-auth.d.ts
index bf0227f3044..b447c8fb78d 100644
--- a/packages/types/next-auth.d.ts
+++ b/packages/types/next-auth.d.ts
@@ -13,6 +13,7 @@ declare module "next-auth" {
* Returned by `useSession`, `getSession` and received as a prop on the `Provider` React Context
*/
interface Session {
+ hasValidLicense: boolean;
user: CalendsoSessionUser;
}
}
diff --git a/packages/ui/Button.tsx b/packages/ui/Button.tsx
index b69603125cb..93a0dc864d5 100644
--- a/packages/ui/Button.tsx
+++ b/packages/ui/Button.tsx
@@ -12,6 +12,7 @@ export type ButtonBaseProps = {
disabled?: boolean;
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
StartIcon?: SVGComponent;
+ startIconClassName?: string;
EndIcon?: SVGComponent;
shallow?: boolean;
};
@@ -30,6 +31,7 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
color = "primary",
size = "base",
StartIcon,
+ startIconClassName,
EndIcon,
shallow,
// attributes propagated from `HTMLAnchorProps` or `HTMLButtonProps`
@@ -103,7 +105,8 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
<StartIcon
className={classNames(
"inline",
- size === "icon" ? "h-5 w-5 " : "-ml-1 h-5 w-5 ltr:mr-2 rtl:ml-2 rtl:-mr-1"
+ size === "icon" ? "h-5 w-5 " : "-ml-1 h-5 w-5 ltr:mr-2 rtl:ml-2 rtl:-mr-1",
+ startIconClassName || ""
)}
/>
)}
diff --git a/packages/ui/Dialog.tsx b/packages/ui/Dialog.tsx
index d2681614573..d056eafd407 100644
--- a/packages/ui/Dialog.tsx
+++ b/packages/ui/Dialog.tsx
@@ -52,7 +52,7 @@ export function Dialog(props: DialogProps) {
return (
<DialogPrimitive.Root {...dialogProps}>
- <DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-black bg-opacity-50 transition-opacity" />
+ <DialogPrimitive.Overlay className="fixed inset-0 z-40 transition-opacity bg-black bg-opacity-50 fadeIn" />
{children}
</DialogPrimitive.Root>
);
@@ -64,7 +64,7 @@ type DialogContentProps = React.ComponentProps<typeof DialogPrimitive["Content"]
export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
({ children, ...props }, forwardedRef) => (
<DialogPrimitive.Portal>
- <DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-gray-500 bg-opacity-75 transition-opacity" />
+ <DialogPrimitive.Overlay className="fixed inset-0 z-40 transition-opacity bg-gray-500 bg-opacity-75 fadeIn" />
{/*zIndex one less than Toast */}
<DialogPrimitive.Content
{...props}
@@ -75,7 +75,7 @@ export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps
: props.size == "lg"
? "p-6 sm:max-w-[70rem]"
: "p-6 sm:max-w-[35rem]",
- "max-h-[560px] overflow-auto overscroll-auto md:h-auto md:max-h-[inherit]",
+ "max-h-[560px] overflow-visible overscroll-auto md:h-auto md:max-h-[inherit]",
`${props.className || ""}`
)}
ref={forwardedRef}>
@@ -93,7 +93,7 @@ type DialogHeaderProps = {
export function DialogHeader(props: DialogHeaderProps) {
return (
<div className="mb-8">
- <h3 className="leading-16 font-cal text-xl text-gray-900" id="modal-title">
+ <h3 className="text-xl text-gray-900 leading-16 font-cal" id="modal-title">
{props.title}
</h3>
{props.subtitle && <div className="text-sm text-gray-400">{props.subtitle}</div>}
@@ -104,7 +104,7 @@ export function DialogHeader(props: DialogHeaderProps) {
export function DialogFooter(props: { children: ReactNode }) {
return (
<div>
- <div className="mt-5 flex justify-end space-x-2 rtl:space-x-reverse">{props.children}</div>
+ <div className="flex justify-end mt-5 space-x-2 rtl:space-x-reverse">{props.children}</div>
</div>
);
}
diff --git a/turbo.json b/turbo.json
index e2257f66f91..fdf20fe6e80 100644
--- a/turbo.json
+++ b/turbo.json
@@ -3,6 +3,12 @@
"baseBranch": "origin/main",
"globalDependencies": [".env", "packages/prisma/.env"],
"pipeline": {
+ "@calcom/prisma#post-install": {
+ "outputs": ["./node_modules/@prisma/client/**", "./packages/prisma/schema.prisma"]
+ },
+ "@calcom/prisma#build": {
+ "dependsOn": ["$DATABASE_URL"]
+ },
"@calcom/prisma#db-deploy": {
"cache": false,
"dependsOn": ["$DATABASE_URL"]
@@ -74,6 +80,13 @@
"@calcom/embed-core#build": {
"cache": false
},
+ "@calcom/embed-react#build": {
+ "cache": false,
+ "dependsOn": ["@calcom/embed-snippet#build", "@calcom/embed-core#build"]
+ },
+ "@calcom/embed-snippet#build": {
+ "cache": false
+ },
"@calcom/website#build": {
"dependsOn": [
"$NEXT_PUBLIC_INTERCOM_APP_ID",
@@ -92,14 +105,19 @@
"outputs": [".next/**"]
},
"build": {
- "dependsOn": ["^build"],
+ "dependsOn": [
+ "^build",
+ "@calcom/embed-core#build",
+ "@calcom/embed-react#build",
+ "@calcom/embed-react#build"
+ ],
"outputs": ["dist/**", ".next/**"]
},
"db-deploy": {},
"db-seed": {},
"deploy": {
"cache": false,
- "dependsOn": ["@calcom/web#build", "@calcom/embed-core#build"],
+ "dependsOn": ["@calcom/web#build"],
"outputs": []
},
"clean": {
@@ -119,7 +137,9 @@
"cache": false,
"outputs": ["lint-results"]
},
- "post-install": {},
+ "post-install": {
+ "cache": false
+ },
"start": {},
"embed-tests": {
"cache": false
@@ -135,6 +155,7 @@
"dependsOn": ["@calcom/prisma#db-reset", "@calcom/web#test", "@calcom/web#build"]
},
"type-check": {
+ "dependsOn": ["@calcom/embed-react#build", "@calcom/embed-core#build", "@calcom/embed-snippet#build"],
"outputs": []
}
}
diff --git a/yarn.lock b/yarn.lock
index 3a5b99f4415..6c589f618cb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1119,11 +1119,16 @@
resolved "https://registry.yarnpkg.com/@glidejs/glide/-/glide-3.5.2.tgz#7012c5920ecf202bbda44d8526fc979984b6dd54"
integrity sha512-7jGciNJ2bQ4eZLSNlSZ+VAyW63kALf420CvkEpK4lEsUfWJq9odqimci0YCiyNyMUFB+pWHwLYyNc57dijYsCg==
-"@headlessui/react@^1.4.1", "@headlessui/react@^1.5.0":
+"@headlessui/react@^1.4.1":
version "1.6.1"
resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.6.1.tgz#d822792e589aac005462491dd62f86095e0c3bef"
integrity sha512-gMd6uIs1U4Oz718Z5gFoV0o/vD43/4zvbyiJN9Dt7PK9Ubxn+TmJwTmYwyNJc5KxxU1t0CmgTNgwZX9+4NjCnQ==
+"@headlessui/react@^1.5.0":
+ version "1.6.3"
+ resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.6.3.tgz#6e52477ea3aee7d99f153b98c1b41765ed77db3d"
+ integrity sha512-WNu/ypGzl0JmJ+sD34KtdycEu2n7EZjKFx2rq6fivsszPdoEyOVZ/GYQMJ437dfAJI0/ZxoRYfrOVduZHjlokQ==
+
"@heroicons/react@^1.0.4", "@heroicons/react@^1.0.6":
version "1.0.6"
resolved "https://registry.yarnpkg.com/@heroicons/react/-/react-1.0.6.tgz#35dd26987228b39ef2316db3b1245c42eb19e324"
@@ -3052,6 +3057,11 @@
dependencies:
mini-svg-data-uri "^1.2.3"
+"@tailwindcss/line-clamp@^0.4.0":
+ version "0.4.0"
+ resolved "https://registry.yarnpkg.com/@tailwindcss/line-clamp/-/line-clamp-0.4.0.tgz#03353e31e77636b785f2336e8c978502cec1de81"
+ integrity sha512-HQZo6gfx1D0+DU3nWlNLD5iA6Ef4JAXh0LeD8lOGrJwEDBwwJNKQza6WoXhhY1uQrxOuU8ROxV7CqiQV4CoiLw==
+
"@tailwindcss/typography@^0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@tailwindcss/typography/-/typography-0.5.2.tgz#24b069dab24d7a2467d01aca0dd432cb4b29f0ee"
@@ -3454,6 +3464,11 @@
resolved "https://registry.yarnpkg.com/@types/mdx/-/mdx-2.0.1.tgz#e4c05d355d092d7b58db1abfe460e53f41102ac8"
integrity sha512-JPEv4iAl0I+o7g8yVWDwk30es8mfVrjkvh5UeVR2sYPpZCK44vrAPsbJpIS+rJAUxLgaSAMKTEH5Vn5qd9XsrQ==
+"@types/memory-cache@^0.2.2":
+ version "0.2.2"
+ resolved "https://registry.yarnpkg.com/@types/memory-cache/-/memory-cache-0.2.2.tgz#f8fb6d8aa0eb006ed44fc659bf8bfdc1a5cc57fa"
+ integrity sha512-xNnm6EkmYYhTnLiOHC2bdKgcYY5qjjrq5vl9KXD2nh0em0koZoFS500EL4Q4V/eW+A3P7NC7P7GIYzNOSQp7jQ==
+
version "7.3.6"
resolved "https://registry.yarnpkg.com/@types/micro/-/micro-7.3.6.tgz#7d68eb5a780ac4761e3b80687b4ee7328ebc3f2e"
@@ -3728,21 +3743,6 @@
resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.3.tgz#781d360c282436494b32fe7d9f7f8e64b3118aa3"
integrity sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw==
-"@typescript-eslint/eslint-plugin@^5.22.0":
- version "5.24.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.24.0.tgz#59f9ed21fc4490444b75b250e4ce81e4b7bba18f"
- integrity sha512-6bqFGk6wa9+6RrU++eLknKyDqXU1Oc8nyoLu5a1fU17PNRJd9UBr56rMF7c4DRaRtnarlkQ4jwxUbvBo8cNlpw==
- dependencies:
- "@typescript-eslint/scope-manager" "5.24.0"
- "@typescript-eslint/type-utils" "5.24.0"
- "@typescript-eslint/utils" "5.24.0"
- debug "^4.3.4"
- functional-red-black-tree "^1.0.1"
- ignore "^5.2.0"
- regexpp "^3.2.0"
- semver "^7.3.7"
- tsutils "^3.21.0"
-
"@typescript-eslint/eslint-plugin@^5.25.0":
version "5.25.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.25.0.tgz#e8ce050990e4d36cc200f2de71ca0d3eb5e77a31"
@@ -3794,15 +3794,6 @@
"@typescript-eslint/types" "5.25.0"
"@typescript-eslint/visitor-keys" "5.25.0"
-"@typescript-eslint/[email protected]":
- version "5.24.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.24.0.tgz#aad47227e89cceec9175b1a67df69ebcd79f9421"
- integrity sha512-uGi+sQiM6E5CeCZYBXiaIvIChBXru4LZ1tMoeKbh1Lze+8BO9syUG07594C4lvN2YPT4KVeIupOJkVI+9/DAmQ==
- dependencies:
- "@typescript-eslint/utils" "5.24.0"
- debug "^4.3.4"
- tsutils "^3.21.0"
-
"@typescript-eslint/[email protected]":
version "5.25.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.25.0.tgz#5750d26a5db4c4d68d511611e0ada04e56f613bc"
@@ -3848,18 +3839,6 @@
semver "^7.3.7"
tsutils "^3.21.0"
-"@typescript-eslint/[email protected]":
- version "5.24.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.24.0.tgz#7a854028040a305ddea129328e45cfb2c6406e75"
- integrity sha512-K05sbWoeCBJH8KXu6hetBJ+ukG0k2u2KlgD3bN+v+oBKm8adJqVHpSSLHNzqyuv0Lh4GVSAUgZ5lB4icmPmWLw==
- dependencies:
- "@types/json-schema" "^7.0.9"
- "@typescript-eslint/scope-manager" "5.24.0"
- "@typescript-eslint/types" "5.24.0"
- "@typescript-eslint/typescript-estree" "5.24.0"
- eslint-scope "^5.1.1"
- eslint-utils "^3.0.0"
-
"@typescript-eslint/[email protected]":
version "5.25.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.25.0.tgz#272751fd737733294b4ab95e16c7f2d4a75c2049"
@@ -4430,7 +4409,7 @@ babel-jest@^27.3.1:
graceful-fs "^4.2.9"
slash "^3.0.0"
-babel-jest@^28.0.3, babel-jest@^28.1.0:
+babel-jest@^28.1.0:
version "28.1.0"
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-28.1.0.tgz#95a67f8e2e7c0042e7b3ad3951b8af41a533b5ea"
integrity sha512-zNKk0yhDZ6QUwfxh9k07GII6siNGMJWVUU49gmFj5gfdqDKLqa2RArXOF2CODp4Dr7dLxN2cvAV+667dGJ4b4w==
@@ -5225,9 +5204,9 @@ chardet@^0.7.0:
integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==
chart.js@^3.7.1:
- version "3.7.1"
- resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-3.7.1.tgz#0516f690c6a8680c6c707e31a4c1807a6f400ada"
- integrity sha512-8knRegQLFnPQAheZV8MjxIXc5gQEfDFD897BJgv/klO/vtIyFFmgMXrNfgrXpbTr/XbTturxRgxIXx/Y+ASJBA==
+ version "3.8.0"
+ resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-3.8.0.tgz#c6c14c457b9dc3ce7f1514a59e9b262afd6f1a94"
+ integrity sha512-cr8xhrXjLIXVLOBZPkBZVF6NDeiVIrPLHcMhnON7UufudL+CNeRrD+wpYanswlm8NpudMdrt3CHoLMQMxJhHRg==
chokidar@^3.5.3:
version "3.5.3"
@@ -10022,7 +10001,7 @@ jest@^26.0.0:
import-local "^3.0.2"
jest-cli "^26.6.3"
-jest@^28.0.3:
+jest@^28.1.0:
version "28.1.0"
resolved "https://registry.yarnpkg.com/jest/-/jest-28.1.0.tgz#f420e41c8f2395b9a30445a97189ebb57593d831"
integrity sha512-TZR+tHxopPhzw3c3560IJXZWLNHgpcz1Zh0w5A65vynLGNcg/5pZ+VildAd7+XGOu6jd58XMY/HNn0IkZIXVXg==
@@ -11024,6 +11003,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.2.1.tgz#8337aa3c4335581839ec01c3d594090cebe8f00e"
integrity sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==
+memory-cache@^0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/memory-cache/-/memory-cache-0.2.0.tgz#7890b01d52c00c8ebc9d533e1f8eb17e3034871a"
+ integrity sha1-eJCwHVLADI68nVM+H46xfjA0hxo=
+
memory-pager@^1.0.2:
version "1.5.0"
resolved "https://registry.yarnpkg.com/memory-pager/-/memory-pager-1.5.0.tgz#d8751655d22d384682741c972f2c3d6dfa3e66b5"
@@ -11728,7 +11712,7 @@ nanoid@^3.1.23, nanoid@^3.3.1:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.2.tgz#c89622fafb4381cd221421c69ec58547a1eec557"
integrity sha512-CuHBogktKwpm5g2sRgv83jEy2ijFzBwMoYA60orPDR7ynsLijJDqgsi4RDGj3OJpy3Ieb+LYwiRmIOGyytgITA==
-nanoid@^3.1.30, nanoid@^3.3.3:
+nanoid@^3.1.30, nanoid@^3.3.3, nanoid@^3.3.4:
version "3.3.4"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==
@@ -12908,7 +12892,7 @@ [email protected]:
picocolors "^1.0.0"
source-map-js "^1.0.1"
-postcss@^8.3.6, postcss@^8.4.13, postcss@^8.4.8:
+postcss@^8.3.6, postcss@^8.4.13:
version "8.4.13"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.13.tgz#7c87bc268e79f7f86524235821dfdf9f73e5d575"
integrity sha512-jtL6eTBrza5MPzy8oJLFuUscHDXTV5KcLlqAWHl5q5WYRfnNRGSmOZmOZ1T6Gy7A99mOZfqungmZMpMmCVJ8ZA==
@@ -12926,6 +12910,15 @@ postcss@^8.4.12:
picocolors "^1.0.0"
source-map-js "^1.0.2"
+postcss@^8.4.8:
+ version "8.4.14"
+ resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf"
+ integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==
+ dependencies:
+ nanoid "^3.3.4"
+ picocolors "^1.0.0"
+ source-map-js "^1.0.2"
+
postgres-array@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e"
@@ -17033,7 +17026,7 @@ zod-prisma@^0.5.4:
parenthesis "^3.1.8"
ts-morph "^13.0.2"
-zod@^3.14.4, zod@^3.16.0:
+zod@^3.16.0:
version "3.16.0"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.16.0.tgz#edfdbf77fcc9a5af13a2630a44bdda5b90e759b7"
integrity sha512-szrIkryADbTM+xBt2a1KoS2CJQXec4f9xG78bj5MJeEH/XqmmHpnO+fG3IE115AKBJak+2HrbxLZkc9mhdbDKA==