Type fixes

This commit is contained in:
zomars 2022-05-17 14:43:27 -06:00
parent fbbda20792
commit 0153bc583a
43 changed files with 191 additions and 187 deletions

View File

@ -1,18 +1,18 @@
import { CodeIcon, EyeIcon, SunIcon, ChevronRightIcon, ArrowLeftIcon } from "@heroicons/react/solid"; import { ArrowLeftIcon, ChevronRightIcon, CodeIcon, EyeIcon, SunIcon } from "@heroicons/react/solid";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/react-collapsible"; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/react-collapsible";
import classNames from "classnames"; import classNames from "classnames";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useRef, useState } from "react"; import { useRef, useState } from "react";
import { components, ControlProps, SingleValue } from "react-select"; import { components, ControlProps } from "react-select";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification"; import showToast from "@calcom/lib/notification";
import { EventType } from "@calcom/prisma/client"; import { EventType } from "@calcom/prisma/client";
import { Button, Switch } from "@calcom/ui"; import { Button, Switch } from "@calcom/ui";
import { Dialog, DialogContent, DialogClose } from "@calcom/ui/Dialog"; import { Dialog, DialogClose, DialogContent } from "@calcom/ui/Dialog";
import { InputLeading, Label, TextArea, TextField } from "@calcom/ui/form/fields"; import { InputLeading, Label, TextArea, TextField } from "@calcom/ui/form/fields";
import { WEBAPP_URL, EMBED_LIB_URL } from "@lib/config/constants"; import { EMBED_LIB_URL, WEBAPP_URL } from "@lib/config/constants";
import { trpc } from "@lib/trpc"; import { trpc } from "@lib/trpc";
import NavTabs from "@components/NavTabs"; import NavTabs from "@components/NavTabs";
@ -241,7 +241,10 @@ const EmbedNavBar = () => {
return <NavTabs data-testid="embed-tabs" tabs={tabs} linkProps={{ shallow: true }} />; return <NavTabs data-testid="embed-tabs" tabs={tabs} linkProps={{ shallow: true }} />;
}; };
const ThemeSelectControl = ({ children, ...props }: ControlProps<any, false>) => { const ThemeSelectControl = ({
children,
...props
}: ControlProps<{ value: string; label: string }, false>) => {
return ( return (
<components.Control {...props}> <components.Control {...props}>
<SunIcon className="h-[32px] w-[32px] text-gray-500" /> <SunIcon className="h-[32px] w-[32px] text-gray-500" />
@ -381,7 +384,7 @@ Cal("inline", {
}); });
${getEmbedUIInstructionString().trim()}`; ${getEmbedUIInstructionString().trim()}`;
} else if (embedType === "floating-popup") { } else if (embedType === "floating-popup") {
let floatingButtonArg = { const floatingButtonArg = {
calLink, calLink,
...previewState.floatingPopup, ...previewState.floatingPopup,
}; };
@ -418,7 +421,7 @@ ${getEmbedUIInstructionString().trim()}`;
}); });
}; };
const previewInstruction = (instruction: { name: string; arg: any }) => { const previewInstruction = (instruction: { name: string; arg: unknown }) => {
iframeRef.current?.contentWindow?.postMessage( iframeRef.current?.contentWindow?.postMessage(
{ {
mode: "cal:preview", mode: "cal:preview",
@ -544,7 +547,7 @@ ${getEmbedUIInstructionString().trim()}`;
value={previewState.inline.width} value={previewState.inline.width}
onChange={(e) => { onChange={(e) => {
setPreviewState((previewState) => { setPreviewState((previewState) => {
let width = e.target.value || "100%"; const width = e.target.value || "100%";
return { return {
...previewState, ...previewState,
@ -759,11 +762,11 @@ ${getEmbedUIInstructionString().trim()}`;
<ColorPicker <ColorPicker
defaultValue="#000000" defaultValue="#000000"
onChange={(color) => { onChange={(color) => {
//@ts-ignore - How to support dynamic palette names?
addToPalette({ addToPalette({
[palette.name]: color, [palette.name as keyof typeof previewState["palette"]]: color,
}); });
}}></ColorPicker> }}
/>
</div> </div>
</Label> </Label>
))} ))}

View File

@ -1,4 +1,5 @@
import { AdminRequired } from "components/ui/AdminRequired"; import { AdminRequired } from "components/ui/AdminRequired";
import noop from "lodash/noop";
import Link, { LinkProps } from "next/link"; import Link, { LinkProps } from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { FC, Fragment, MouseEventHandler } from "react"; import { FC, Fragment, MouseEventHandler } from "react";
@ -28,11 +29,11 @@ const NavTabs: FC<NavTabProps> = ({ tabs, linkProps, ...props }) => {
aria-label="Tabs" aria-label="Tabs"
{...props}> {...props}>
{tabs.map((tab) => { {tabs.map((tab) => {
let href: string;
let isCurrent;
if ((tab.tabName && tab.href) || (!tab.tabName && !tab.href)) { if ((tab.tabName && tab.href) || (!tab.tabName && !tab.href)) {
throw new Error("Use either tabName or href"); throw new Error("Use either tabName or href");
} }
let href = "";
let isCurrent;
if (tab.href) { if (tab.href) {
href = tab.href; href = tab.href;
isCurrent = router.asPath === tab.href; isCurrent = router.asPath === tab.href;
@ -40,6 +41,7 @@ const NavTabs: FC<NavTabProps> = ({ tabs, linkProps, ...props }) => {
href = ""; href = "";
isCurrent = router.query.tabName === tab.tabName; isCurrent = router.query.tabName === tab.tabName;
} }
const onClick: MouseEventHandler = tab.tabName const onClick: MouseEventHandler = tab.tabName
? (e) => { ? (e) => {
e.preventDefault(); e.preventDefault();
@ -50,12 +52,14 @@ const NavTabs: FC<NavTabProps> = ({ tabs, linkProps, ...props }) => {
}, },
}); });
} }
: () => {}; : noop;
const Component = tab.adminRequired ? AdminRequired : Fragment; const Component = tab.adminRequired ? AdminRequired : Fragment;
if (!href) return null;
return ( return (
<Component key={tab.name}> <Component key={tab.name}>
<Link key={tab.name} href={href!} {...linkProps}> <Link key={tab.name} href={href} {...linkProps}>
<a <a
onClick={onClick} onClick={onClick}
className={classNames( className={classNames(

View File

@ -3,7 +3,7 @@ import React from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
import NavTabs, { NavTabProps } from "./NavTabs"; import NavTabs from "./NavTabs";
export default function SettingsShell({ children }: { children: React.ReactNode }) { export default function SettingsShell({ children }: { children: React.ReactNode }) {
const { t } = useLocale(); const { t } = useLocale();

View File

@ -1,4 +1,3 @@
import { StarIcon } from "@heroicons/react/solid";
import Link from "next/link"; import Link from "next/link";
import Button from "@calcom/ui/Button"; import Button from "@calcom/ui/Button";

View File

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { SkeletonAvatar, SkeletonText } from "@calcom/ui"; import { SkeletonText } from "@calcom/ui";
import { ShellSubHeading } from "@components/Shell"; import { ShellSubHeading } from "@components/Shell";

View File

@ -4,7 +4,7 @@ import "@glidejs/glide/dist/css/glide.theme.min.css";
import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/solid"; import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/solid";
import { useEffect, useRef } from "react"; import { useEffect, useRef } from "react";
const Slider = <T extends unknown>({ const Slider = <T extends string | unknown>({
title = "", title = "",
className = "", className = "",
items, items,

View File

@ -6,7 +6,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import showToast from "@calcom/lib/notification"; import showToast from "@calcom/lib/notification";
import { Button } from "@calcom/ui"; import { Button } from "@calcom/ui";
import { Dialog, DialogClose, DialogContent, DialogTrigger } from "@calcom/ui/Dialog"; import { Dialog, DialogClose, DialogContent, DialogTrigger } from "@calcom/ui/Dialog";
import { Form, TextField } from "@calcom/ui/form/fields"; import { Form } from "@calcom/ui/form/fields";
import { HttpError } from "@lib/core/http/error"; import { HttpError } from "@lib/core/http/error";
import { trpc } from "@lib/trpc"; import { trpc } from "@lib/trpc";

View File

@ -6,7 +6,7 @@ import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc"; import utc from "dayjs/plugin/utc";
import React, { useCallback, useEffect, useMemo, useState } from "react"; import React, { useCallback, useEffect, useMemo, useState } from "react";
import { Controller, useFieldArray, useFormContext } from "react-hook-form"; import { Controller, useFieldArray, useFormContext } from "react-hook-form";
import { GroupBase, Props, SingleValue } from "react-select"; import { GroupBase, Props } from "react-select";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
import Button from "@calcom/ui/Button"; import Button from "@calcom/ui/Button";

View File

@ -16,7 +16,7 @@ export function ScheduleListItem({
isDeleting = false, isDeleting = false,
}: { }: {
schedule: inferQueryOutput<"viewer.availability.list">["schedules"][number]; schedule: inferQueryOutput<"viewer.availability.list">["schedules"][number];
deleteFunction: Function; deleteFunction: ({ scheduleId }: { scheduleId: number }) => void;
isDeleting: boolean; isDeleting: boolean;
}) { }) {
const { t, i18n } = useLocale(); const { t, i18n } = useLocale();

View File

@ -51,12 +51,13 @@ function isOutOfBounds(
> >
) { ) {
const date = dayjs(time); const date = dayjs(time);
if (!periodDays) throw Error("periodDays is undefined");
switch (periodType) { switch (periodType) {
case PeriodType.ROLLING: { case PeriodType.ROLLING: {
const periodRollingEndDay = periodCountCalendarDays const periodRollingEndDay = periodCountCalendarDays
? dayjs().utcOffset(date.utcOffset()).add(periodDays!, "days").endOf("day") ? dayjs().utcOffset(date.utcOffset()).add(periodDays, "days").endOf("day")
: dayjs().utcOffset(date.utcOffset()).businessDaysAdd(periodDays!).endOf("day"); : dayjs().utcOffset(date.utcOffset()).businessDaysAdd(periodDays).endOf("day");
return date.endOf("day").isAfter(periodRollingEndDay); return date.endOf("day").isAfter(periodRollingEndDay);
} }
@ -94,7 +95,7 @@ function DatePicker({
const [isFirstMonth, setIsFirstMonth] = useState<boolean>(false); const [isFirstMonth, setIsFirstMonth] = useState<boolean>(false);
const [daysFromState, setDays] = useState< const [daysFromState, setDays] = useState<
| { | {
disabled: Boolean; disabled: boolean;
date: number; date: number;
}[] }[]
| null | null
@ -191,7 +192,7 @@ function DatePicker({
name: "DatePicker", name: "DatePicker",
length: daysInMonth, length: daysInMonth,
callback: (i: number) => { callback: (i: number) => {
let day = i + 1; const day = i + 1;
days[daysInitialOffset + i] = { days[daysInitialOffset + i] = {
disabled: isDisabledMemoized(day, { disabled: isDisabledMemoized(day, {
browsingDate, browsingDate,

View File

@ -25,7 +25,6 @@ import {
useIsEmbed, useIsEmbed,
useIsBackgroundTransparent, useIsBackgroundTransparent,
sdkActionManager, sdkActionManager,
useEmbedType,
useEmbedNonStylesConfig, useEmbedNonStylesConfig,
} from "@calcom/embed-core"; } from "@calcom/embed-core";
import classNames from "@calcom/lib/classNames"; import classNames from "@calcom/lib/classNames";
@ -68,7 +67,7 @@ const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage
const availabilityDatePickerEmbedStyles = useEmbedStyles("availabilityDatePicker"); const availabilityDatePickerEmbedStyles = useEmbedStyles("availabilityDatePicker");
const shouldAlignCentrallyInEmbed = useEmbedNonStylesConfig("align") !== "left"; const shouldAlignCentrallyInEmbed = useEmbedNonStylesConfig("align") !== "left";
const shouldAlignCentrally = !isEmbed || shouldAlignCentrallyInEmbed; const shouldAlignCentrally = !isEmbed || shouldAlignCentrallyInEmbed;
let isBackgroundTransparent = useIsBackgroundTransparent(); const isBackgroundTransparent = useIsBackgroundTransparent();
useExposePlanGlobally(plan); useExposePlanGlobally(plan);
useEffect(() => { useEffect(() => {
if (eventType.metadata.smartContractAddress) { if (eventType.metadata.smartContractAddress) {

View File

@ -52,6 +52,15 @@ import { BookPageProps } from "../../../pages/[user]/book";
import { HashLinkPageProps } from "../../../pages/d/[link]/book"; import { HashLinkPageProps } from "../../../pages/d/[link]/book";
import { TeamBookingPageProps } from "../../../pages/team/[slug]/book"; import { TeamBookingPageProps } from "../../../pages/team/[slug]/book";
declare global {
// eslint-disable-next-line no-var
var web3: {
currentProvider: {
selectedAddress: string;
};
};
}
/** These are like 40kb that not every user needs */ /** These are like 40kb that not every user needs */
const PhoneInput = dynamic( const PhoneInput = dynamic(
() => import("@components/ui/form/PhoneInput") () => import("@components/ui/form/PhoneInput")
@ -107,7 +116,6 @@ const BookingPage = ({
const eventOwner = eventType.users[0]; const eventOwner = eventType.users[0];
if (!contracts[(eventType.metadata.smartContractAddress || null) as number]) if (!contracts[(eventType.metadata.smartContractAddress || null) as number])
/* @ts-ignore */
router.replace(`/${eventOwner.username}`); router.replace(`/${eventOwner.username}`);
} }
}, [contracts, eventType.metadata.smartContractAddress, eventType.users, router]); }, [contracts, eventType.metadata.smartContractAddress, eventType.users, router]);
@ -331,7 +339,6 @@ const BookingPage = ({
let web3Details: Record<"userWallet" | "userSignature", string> | undefined; let web3Details: Record<"userWallet" | "userSignature", string> | undefined;
if (eventTypeDetail.metadata.smartContractAddress) { if (eventTypeDetail.metadata.smartContractAddress) {
web3Details = { web3Details = {
// @ts-ignore
userWallet: window.web3.currentProvider.selectedAddress, userWallet: window.web3.currentProvider.selectedAddress,
userSignature: contracts[(eventTypeDetail.metadata.smartContractAddress || null) as number], userSignature: contracts[(eventTypeDetail.metadata.smartContractAddress || null) as number],
}; };
@ -359,8 +366,8 @@ const BookingPage = ({
), ),
metadata, metadata,
customInputs: Object.keys(booking.customInputs || {}).map((inputId) => ({ customInputs: Object.keys(booking.customInputs || {}).map((inputId) => ({
label: eventType.customInputs.find((input) => input.id === parseInt(inputId))!.label, label: eventType.customInputs.find((input) => input.id === parseInt(inputId))?.label || "",
value: booking.customInputs![inputId], value: booking.customInputs && inputId in booking.customInputs ? booking.customInputs[inputId] : "",
})), })),
hasHashedBookingLink, hasHashedBookingLink,
hashedLink, hashedLink,
@ -383,8 +390,8 @@ const BookingPage = ({
), ),
metadata, metadata,
customInputs: Object.keys(booking.customInputs || {}).map((inputId) => ({ customInputs: Object.keys(booking.customInputs || {}).map((inputId) => ({
label: eventType.customInputs.find((input) => input.id === parseInt(inputId))!.label, label: eventType.customInputs.find((input) => input.id === parseInt(inputId))?.label || "",
value: booking.customInputs![inputId], value: booking.customInputs && inputId in booking.customInputs ? booking.customInputs[inputId] : "",
})), })),
hasHashedBookingLink, hasHashedBookingLink,
hashedLink, hashedLink,

View File

@ -1,15 +1,13 @@
import { ExclamationIcon } from "@heroicons/react/outline"; import { ExclamationIcon } from "@heroicons/react/outline";
import { CheckIcon } from "@heroicons/react/solid"; import { CheckIcon } from "@heroicons/react/solid";
import * as DialogPrimitive from "@radix-ui/react-dialog"; import * as DialogPrimitive from "@radix-ui/react-dialog";
import React, { PropsWithChildren, ReactNode } from "react"; import React, { PropsWithChildren } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Button } from "@calcom/ui/Button"; import { Button } from "@calcom/ui/Button";
import { DialogClose, DialogContent } from "@calcom/ui/Dialog"; import { DialogClose, DialogContent } from "@calcom/ui/Dialog";
import { useLocale } from "@lib/hooks/useLocale";
export type DeleteStripeDialogContentProps = { export type DeleteStripeDialogContentProps = {
confirmBtn?: ReactNode;
cancelAllBookingsBtnText?: string; cancelAllBookingsBtnText?: string;
removeBtnText?: string; removeBtnText?: string;
cancelBtnText?: string; cancelBtnText?: string;
@ -24,7 +22,6 @@ export default function DeleteStripeDialogContent(props: PropsWithChildren<Delet
const { const {
title, title,
variety, variety,
confirmBtn = null,
cancelAllBookingsBtnText, cancelAllBookingsBtnText,
removeBtnText, removeBtnText,
cancelBtnText = t("cancel"), cancelBtnText = t("cancel"),

View File

@ -1,4 +1,4 @@
import { ClockIcon, XIcon } from "@heroicons/react/outline"; import { ClockIcon } from "@heroicons/react/outline";
import { RescheduleResponse } from "pages/api/book/request-reschedule"; import { RescheduleResponse } from "pages/api/book/request-reschedule";
import React, { useState, Dispatch, SetStateAction } from "react"; import React, { useState, Dispatch, SetStateAction } from "react";
import { useMutation } from "react-query"; import { useMutation } from "react-query";

View File

@ -1,4 +1,5 @@
import { Collapsible, CollapsibleContent } from "@radix-ui/react-collapsible"; import { Collapsible, CollapsibleContent } from "@radix-ui/react-collapsible";
import type { FormValues } from "pages/event-types/[type]";
import { useState } from "react"; import { useState } from "react";
import { UseFormReturn } from "react-hook-form"; import { UseFormReturn } from "react-hook-form";
import { Frequency as RRuleFrequency } from "rrule"; import { Frequency as RRuleFrequency } from "rrule";
@ -11,9 +12,9 @@ import Select from "@components/ui/form/Select";
type RecurringEventControllerProps = { type RecurringEventControllerProps = {
recurringEvent: RecurringEvent; recurringEvent: RecurringEvent;
formMethods: UseFormReturn<any, any>; formMethods: UseFormReturn<FormValues>;
paymentEnabled: boolean; paymentEnabled: boolean;
onRecurringEventDefined: Function; onRecurringEventDefined: (value: boolean) => void;
}; };
export default function RecurringEventController({ export default function RecurringEventController({

View File

@ -4,9 +4,7 @@ import { Trans } from "next-i18next";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Alert } from "@calcom/ui/Alert"; import { Alert } from "@calcom/ui/Alert";
type Props = {}; function ImpersonatingBanner() {
function ImpersonatingBanner({}: Props) {
const { t } = useLocale(); const { t } = useLocale();
const { data } = useSession(); const { data } = useSession();

View File

@ -1,7 +1,7 @@
import classNames from "classnames"; import classNames from "classnames";
import React from "react"; import React from "react";
import { Dialog, DialogContent, DialogFooter } from "@calcom/ui/Dialog"; import { Dialog, DialogContent } from "@calcom/ui/Dialog";
interface Props extends React.PropsWithChildren<any> { interface Props extends React.PropsWithChildren<any> {
wide?: boolean; wide?: boolean;

View File

@ -1,4 +1,5 @@
import { Account, IdentityProvider, Prisma, PrismaClient, User, VerificationToken } from "@prisma/client"; import { Account, IdentityProvider, Prisma, PrismaClient, User, VerificationToken } from "@prisma/client";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { identityProviderNameMap } from "@lib/auth"; import { identityProviderNameMap } from "@lib/auth";
@ -45,6 +46,7 @@ export default function CalComAdapter(prismaClient: PrismaClient) {
prismaClient.user.update({ where: { id }, data }), prismaClient.user.update({ where: { id }, data }),
deleteUser: (id: User["id"]) => prismaClient.user.delete({ where: { id } }), deleteUser: (id: User["id"]) => prismaClient.user.delete({ where: { id } }),
async createVerificationToken(data: VerificationToken) { async createVerificationToken(data: VerificationToken) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { id: _, ...verificationToken } = await prismaClient.verificationToken.create({ const { id: _, ...verificationToken } = await prismaClient.verificationToken.create({
data, data,
}); });
@ -52,6 +54,7 @@ export default function CalComAdapter(prismaClient: PrismaClient) {
}, },
async useVerificationToken(identifier_token: Prisma.VerificationTokenIdentifierTokenCompoundUniqueInput) { async useVerificationToken(identifier_token: Prisma.VerificationTokenIdentifierTokenCompoundUniqueInput) {
try { try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { id: _, ...verificationToken } = await prismaClient.verificationToken.delete({ const { id: _, ...verificationToken } = await prismaClient.verificationToken.delete({
where: { identifier_token }, where: { identifier_token },
}); });
@ -59,8 +62,9 @@ export default function CalComAdapter(prismaClient: PrismaClient) {
} catch (error) { } catch (error) {
// If token already used/deleted, just return null // If token already used/deleted, just return null
// https://www.prisma.io/docs/reference/api-reference/error-reference#p2025 // https://www.prisma.io/docs/reference/api-reference/error-reference#p2025
// @ts-ignore if (error instanceof PrismaClientKnownRequestError) {
if (error.code === "P2025") return null; if (error.code === "P2025") return null;
}
throw error; throw error;
} }
}, },

View File

@ -1,3 +1,5 @@
import noop from "lodash/noop";
const data: Record<string, number> = {}; const data: Record<string, number> = {};
/** /**
* Starts an iteration from `0` to `length - 1` with batch size `batch` * Starts an iteration from `0` to `length - 1` with batch size `batch`
@ -20,9 +22,9 @@ export const doWorkAsync = ({
}: { }: {
name: string; name: string;
length: number; length: number;
callback: Function; callback: (i: number, b?: boolean) => void;
done?: Function; done?: () => void;
batchDone?: Function; batchDone?: () => void;
batch: number; batch: number;
offsetStart?: number; offsetStart?: number;
__pending?: boolean; __pending?: boolean;
@ -32,8 +34,8 @@ export const doWorkAsync = ({
const lastIndex = length - 1; const lastIndex = length - 1;
const offsetEndExclusive = offsetStart + stepLength; const offsetEndExclusive = offsetStart + stepLength;
batchDone = batchDone || (() => {}); batchDone = batchDone || noop;
done = done || (() => {}); done = done || noop;
if (!__pending && data[name]) { if (!__pending && data[name]) {
cancelAnimationFrame(data[name]); cancelAnimationFrame(data[name]);

View File

@ -1,4 +1,3 @@
import { recurringEvent } from "@calcom/prisma/zod-utils";
import type { CalendarEvent, Person, RecurringEvent } from "@calcom/types/Calendar"; import type { CalendarEvent, Person, RecurringEvent } from "@calcom/types/Calendar";
import AttendeeAwaitingPaymentEmail from "@lib/emails/templates/attendee-awaiting-payment-email"; import AttendeeAwaitingPaymentEmail from "@lib/emails/templates/attendee-awaiting-payment-email";

View File

@ -4,7 +4,7 @@ import { getErrorFromUnknown } from "@calcom/lib/errors";
import { serverConfig } from "@calcom/lib/serverConfig"; import { serverConfig } from "@calcom/lib/serverConfig";
export default class BaseEmail { export default class BaseEmail {
name: string = ""; name = "";
protected getNodeMailerPayload(): Record<string, unknown> { protected getNodeMailerPayload(): Record<string, unknown> {
return {}; return {};

View File

@ -1,5 +1,4 @@
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useEmbedTheme } from "@calcom/embed-core"; import { useEmbedTheme } from "@calcom/embed-core";

View File

@ -2,7 +2,6 @@ import dayjs, { Dayjs } from "dayjs";
import { I18n } from "next-i18next"; import { I18n } from "next-i18next";
import { RRule } from "rrule"; import { RRule } from "rrule";
import { recurringEvent } from "@calcom/prisma/zod-utils";
import { RecurringEvent } from "@calcom/types/Calendar"; import { RecurringEvent } from "@calcom/types/Calendar";
import { detectBrowserTimeFormat } from "@lib/timeFormat"; import { detectBrowserTimeFormat } from "@lib/timeFormat";
@ -29,6 +28,7 @@ export const parseRecurringDates = (
}: { startDate: string | null | Dayjs; recurringEvent: RecurringEvent; recurringCount: number }, }: { startDate: string | null | Dayjs; recurringEvent: RecurringEvent; recurringCount: number },
i18n: I18n i18n: I18n
): [string[], Date[]] => { ): [string[], Date[]] => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { count, ...restRecurringEvent } = recurringEvent; const { count, ...restRecurringEvent } = recurringEvent;
const rule = new RRule({ const rule = new RRule({
...restRecurringEvent, ...restRecurringEvent,

View File

@ -89,7 +89,7 @@ const getSlots = ({ inviteeDate, frequency, minimumBookingNotice, workingHours,
computedLocalWorkingHours.push(tempComputeTimeFrame); computedLocalWorkingHours.push(tempComputeTimeFrame);
} }
}); });
computedLocalWorkingHours.forEach((item, index) => { computedLocalWorkingHours.forEach((item) => {
slotsTimeFrameAvailable.push(...splitAvailableTime(item.startTime, item.endTime, frequency, eventLength)); slotsTimeFrameAvailable.push(...splitAvailableTime(item.startTime, item.endTime, frequency, eventLength));
}); });

View File

@ -1,6 +1,11 @@
import { jitsuClient, JitsuClient } from "@jitsu/sdk-js"; import { jitsuClient, JitsuClient } from "@jitsu/sdk-js";
import React, { useContext } from "react"; import React, { useContext } from "react";
declare global {
// eslint-disable-next-line no-var
var jitsu: JitsuClient | undefined;
}
/** /**
* Enumeration of all event types that are being sent * Enumeration of all event types that are being sent
* to telemetry collection. * to telemetry collection.
@ -49,7 +54,10 @@ function isLocalhost(host: string) {
* Collects page parameters and makes sure no sensitive data made it to telemetry * Collects page parameters and makes sure no sensitive data made it to telemetry
* @param route current next.js route * @param route current next.js route
*/ */
export function collectPageParameters(route?: string, extraData: Record<string, any> = {}): any { export function collectPageParameters(
route?: string,
extraData: Record<string, unknown> = {}
): Record<string, unknown> {
const host = document.location.hostname; const host = document.location.hostname;
const maskedHost = isLocalhost(host) ? "localhost" : "masked"; const maskedHost = isLocalhost(host) ? "localhost" : "masked";
//starts with '' //starts with ''
@ -78,13 +86,7 @@ function createTelemetryClient(): TelemetryClient {
if (!window) { if (!window) {
console.warn("Jitsu has been called during SSR, this scenario isn't supported yet"); console.warn("Jitsu has been called during SSR, this scenario isn't supported yet");
return; return;
} else if ( } else if (!window["jitsu"]) {
// FIXME
// @ts-ignore
!window["jitsu"]
) {
// FIXME
// @ts-ignore
window["jitsu"] = jitsuClient({ window["jitsu"] = jitsuClient({
log_level: "ERROR", log_level: "ERROR",
tracking_host: "https://t.calendso.com", tracking_host: "https://t.calendso.com",
@ -93,8 +95,6 @@ function createTelemetryClient(): TelemetryClient {
capture_3rd_party_cookies: false, capture_3rd_party_cookies: false,
}); });
} }
// FIXME
// @ts-ignore
const res = callback(window["jitsu"]); const res = callback(window["jitsu"]);
if (res && typeof res["catch"] === "function") { if (res && typeof res["catch"] === "function") {
res.catch((e) => { res.catch((e) => {

View File

@ -6,7 +6,7 @@ import { GetServerSidePropsContext } from "next";
import dynamic from "next/dynamic"; import dynamic from "next/dynamic";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import React, { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Toaster } from "react-hot-toast"; import { Toaster } from "react-hot-toast";
import { JSONObject } from "superjson/dist/types"; import { JSONObject } from "superjson/dist/types";
@ -18,7 +18,6 @@ import defaultEvents, {
getUsernameSlugLink, getUsernameSlugLink,
} from "@calcom/lib/defaultEvents"; } from "@calcom/lib/defaultEvents";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
import { RecurringEvent } from "@calcom/types/Calendar";
import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally"; import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally";
import useTheme from "@lib/hooks/useTheme"; import useTheme from "@lib/hooks/useTheme";
@ -287,7 +286,7 @@ const getEventTypesWithHiddenFromDB = async (userId: number, plan: UserPlan) =>
export const getServerSideProps = async (context: GetServerSidePropsContext) => { export const getServerSideProps = async (context: GetServerSidePropsContext) => {
const ssr = await ssrInit(context); const ssr = await ssrInit(context);
const crypto = require("crypto"); const crypto = await import("crypto");
const usernameList = getUsernameList(context.query.user as string); const usernameList = getUsernameList(context.query.user as string);
const dataFetchStart = Date.now(); const dataFetchStart = Date.now();

View File

@ -1,7 +1,5 @@
import { DefaultSeo } from "next-seo"; import { DefaultSeo } from "next-seo";
import Head from "next/head"; import Head from "next/head";
import { useEffect } from "react";
// import { ReactQueryDevtools } from "react-query/devtools";
import superjson from "superjson"; import superjson from "superjson";
import "@calcom/embed-core/src/embed-iframe"; import "@calcom/embed-core/src/embed-iframe";

View File

@ -34,7 +34,7 @@ const CustomError: NextPage<CustomErrorProps> = (props) => {
// getInitialProps is not called in case of // getInitialProps is not called in case of
// https://github.com/vercel/next.js/issues/8592. As a workaround, we pass // https://github.com/vercel/next.js/issues/8592. As a workaround, we pass
// err via _app.tsx so it can be captured // err via _app.tsx so it can be captured
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const e = getErrorFromUnknown(err); const e = getErrorFromUnknown(err);
// can be captured here // can be captured here
// e.g. Sentry.captureException(e); // e.g. Sentry.captureException(e);

View File

@ -1,4 +1,3 @@
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import { IdentityProvider, UserPermissionRole } from "@prisma/client"; import { IdentityProvider, UserPermissionRole } from "@prisma/client";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import Handlebars from "handlebars"; import Handlebars from "handlebars";
@ -185,6 +184,7 @@ if (true) {
} }
const calcomAdapter = CalComAdapter(prisma); const calcomAdapter = CalComAdapter(prisma);
export default NextAuth({ export default NextAuth({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
adapter: calcomAdapter, adapter: calcomAdapter,
session: { session: {
@ -203,6 +203,7 @@ export default NextAuth({
const autoMergeIdentities = async () => { const autoMergeIdentities = async () => {
if (!hostedCal) { if (!hostedCal) {
const existingUser = await prisma.user.findFirst({ const existingUser = await prisma.user.findFirst({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
where: { email: token.email! }, where: { email: token.email! },
}); });

View File

@ -1,6 +1,8 @@
import { OAuthReqBody } from "@boxyhq/saml-jackson"; import { OAuthReqBody } from "@boxyhq/saml-jackson";
import { NextApiRequest, NextApiResponse } from "next"; import { NextApiRequest, NextApiResponse } from "next";
import { HttpError } from "@calcom/lib/http-error";
import jackson from "@lib/jackson"; import jackson from "@lib/jackson";
export default async function handler(req: NextApiRequest, res: NextApiResponse) { export default async function handler(req: NextApiRequest, res: NextApiResponse) {
@ -12,10 +14,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const { oauthController } = await jackson(); const { oauthController } = await jackson();
const { redirect_url } = await oauthController.authorize(req.query as unknown as OAuthReqBody); const { redirect_url } = await oauthController.authorize(req.query as unknown as OAuthReqBody);
res.redirect(302, redirect_url); res.redirect(302, redirect_url);
} catch (err: any) { } catch (err: unknown) {
console.error("authorize error:", err); if (err instanceof HttpError) {
const { message, statusCode = 500 } = err; console.error("authorize error:", err);
const { message, statusCode = 500 } = err;
res.status(statusCode).send(message); return res.status(statusCode).send(message);
}
return res.status(500).send("Unknown error");
} }
} }

View File

@ -1,5 +1,7 @@
import { NextApiRequest, NextApiResponse } from "next"; import { NextApiRequest, NextApiResponse } from "next";
import { HttpError } from "@calcom/lib/http-error";
import jackson from "@lib/jackson"; import jackson from "@lib/jackson";
export default async function handler(req: NextApiRequest, res: NextApiResponse) { export default async function handler(req: NextApiRequest, res: NextApiResponse) {
@ -12,10 +14,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const { redirect_url } = await oauthController.samlResponse(req.body); const { redirect_url } = await oauthController.samlResponse(req.body);
res.redirect(302, redirect_url); res.redirect(302, redirect_url);
} catch (err: any) { } catch (err: unknown) {
console.error("callback error:", err); if (err instanceof HttpError) {
const { message, statusCode = 500 } = err; console.error("callback error:", err);
const { message, statusCode = 500 } = err;
res.status(statusCode).send(message); return res.status(statusCode).send(message);
}
return res.status(500).send("Unknown error");
} }
} }

View File

@ -1,6 +1,5 @@
import { Prisma, User, Booking, SchedulingType, BookingStatus } from "@prisma/client"; import { Prisma, User, Booking, SchedulingType, BookingStatus } from "@prisma/client";
import type { NextApiRequest, NextApiResponse } from "next"; import type { NextApiRequest, NextApiResponse } from "next";
import rrule from "rrule";
import EventManager from "@calcom/core/EventManager"; import EventManager from "@calcom/core/EventManager";
import logger from "@calcom/lib/logger"; import logger from "@calcom/lib/logger";

View File

@ -25,7 +25,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
if (typeof handler !== "function") if (typeof handler !== "function")
throw new HttpError({ statusCode: 404, message: `API handler not found` }); throw new HttpError({ statusCode: 404, message: `API handler not found` });
const response = await handler(req, res); await handler(req, res);
return res.status(200); return res.status(200);
} catch (error) { } catch (error) {

View File

@ -1,4 +1,3 @@
import { Prisma } from "@prisma/client";
import type { NextApiRequest, NextApiResponse } from "next"; import type { NextApiRequest, NextApiResponse } from "next";
import { getStripeCustomerId } from "@calcom/stripe/customer"; import { getStripeCustomerId } from "@calcom/stripe/customer";

View File

@ -2,8 +2,9 @@ import dayjs, { Dayjs } from "dayjs";
import utc from "dayjs/plugin/utc"; import utc from "dayjs/plugin/utc";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { QueryCell } from "@lib/QueryCell"; import { QueryCell } from "@lib/QueryCell";
import { useLocale } from "@lib/hooks/useLocale";
import { inferQueryOutput, trpc } from "@lib/trpc"; import { inferQueryOutput, trpc } from "@lib/trpc";
import Loader from "@components/Loader"; import Loader from "@components/Loader";
@ -20,10 +21,10 @@ const AvailabilityView = ({ user }: { user: User }) => {
const [selectedDate, setSelectedDate] = useState(dayjs()); const [selectedDate, setSelectedDate] = useState(dayjs());
function convertMinsToHrsMins(mins: number) { function convertMinsToHrsMins(mins: number) {
let h = Math.floor(mins / 60); const h = Math.floor(mins / 60);
let m = mins % 60; const m = mins % 60;
let hs = h < 10 ? "0" + h : h; const hs = h < 10 ? "0" + h : h;
let ms = m < 10 ? "0" + m : m; const ms = m < 10 ? "0" + m : m;
return `${hs}:${ms}`; return `${hs}:${ms}`;
} }

View File

@ -157,7 +157,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
eventTypeObject.schedule = null; eventTypeObject.schedule = null;
eventTypeObject.availability = []; eventTypeObject.availability = [];
let booking: GetBookingType | null = null; const booking: GetBookingType | null = null;
const profile = { const profile = {
name: user.name || user.username, name: user.name || user.username,

View File

@ -30,7 +30,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
const ssr = await ssrInit(context); const ssr = await ssrInit(context);
const link = asStringOrThrow(context.query.link as string); const link = asStringOrThrow(context.query.link as string);
const recurringEventCountQuery = asStringOrNull(context.query.count); const recurringEventCountQuery = asStringOrNull(context.query.count);
const slug = context.query.slug as string;
const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({ const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
id: true, id: true,

View File

@ -21,13 +21,13 @@ import classNames from "classnames";
import dayjs from "dayjs"; import dayjs from "dayjs";
import timezone from "dayjs/plugin/timezone"; import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc"; import utc from "dayjs/plugin/utc";
import { isValidPhoneNumber, parsePhoneNumber } from "libphonenumber-js"; import { isValidPhoneNumber } from "libphonenumber-js";
import { GetServerSidePropsContext } from "next"; import { GetServerSidePropsContext } from "next";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { Controller, Noop, useForm, UseFormReturn } from "react-hook-form"; import { Controller, Noop, useForm, UseFormReturn } from "react-hook-form";
import { FormattedNumber, IntlProvider } from "react-intl"; import { FormattedNumber, IntlProvider } from "react-intl";
import short, { generate } from "short-uuid"; import short from "short-uuid";
import { JSONObject } from "superjson/dist/types"; import { JSONObject } from "superjson/dist/types";
import { v5 as uuidv5 } from "uuid"; import { v5 as uuidv5 } from "uuid";
import { z } from "zod"; import { z } from "zod";
@ -101,7 +101,44 @@ type OptionTypeBase = {
disabled?: boolean; disabled?: boolean;
}; };
const SuccessRedirectEdit = <T extends UseFormReturn<any, any>>({ export type FormValues = {
title: string;
eventTitle: string;
smartContractAddress: string;
eventName: string;
slug: string;
length: number;
description: string;
disableGuests: boolean;
requiresConfirmation: boolean;
recurringEvent: RecurringEvent;
schedulingType: SchedulingType | null;
price: number;
currency: string;
hidden: boolean;
hideCalendarNotes: boolean;
hashedLink: string | undefined;
locations: { type: LocationType; address?: string; link?: string; hostPhoneNumber?: string }[];
customInputs: EventTypeCustomInput[];
users: string[];
schedule: number;
periodType: PeriodType;
periodDays: number;
periodCountCalendarDays: "1" | "0";
periodDates: { startDate: Date; endDate: Date };
minimumBookingNotice: number;
beforeBufferTime: number;
afterBufferTime: number;
slotInterval: number | null;
destinationCalendar: {
integration: string;
externalId: string;
};
successRedirectUrl: string;
giphyThankYouPage: string;
};
const SuccessRedirectEdit = <T extends UseFormReturn<FormValues>>({
eventType, eventType,
formMethods, formMethods,
}: { }: {
@ -524,42 +561,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
avatar: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${username}/avatar.png`, avatar: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${username}/avatar.png`,
}); });
const formMethods = useForm<{ const formMethods = useForm<FormValues>({
title: string;
eventTitle: string;
smartContractAddress: string;
eventName: string;
slug: string;
length: number;
description: string;
disableGuests: boolean;
requiresConfirmation: boolean;
recurringEvent: RecurringEvent;
schedulingType: SchedulingType | null;
price: number;
currency: string;
hidden: boolean;
hideCalendarNotes: boolean;
hashedLink: string | undefined;
locations: { type: LocationType; address?: string; link?: string; hostPhoneNumber?: string }[];
customInputs: EventTypeCustomInput[];
users: string[];
schedule: number;
periodType: PeriodType;
periodDays: number;
periodCountCalendarDays: "1" | "0";
periodDates: { startDate: Date; endDate: Date };
minimumBookingNotice: number;
beforeBufferTime: number;
afterBufferTime: number;
slotInterval: number | null;
destinationCalendar: {
integration: string;
externalId: string;
};
successRedirectUrl: string;
giphyThankYouPage: string;
}>({
defaultValues: { defaultValues: {
locations: eventType.locations || [], locations: eventType.locations || [],
recurringEvent: eventType.recurringEvent || {}, recurringEvent: eventType.recurringEvent || {},

View File

@ -2,22 +2,22 @@ import { CalendarIcon } from "@heroicons/react/outline";
import { import {
ArrowDownIcon, ArrowDownIcon,
ArrowUpIcon, ArrowUpIcon,
DotsHorizontalIcon,
ExternalLinkIcon,
DuplicateIcon,
LinkIcon,
UploadIcon,
ClipboardCopyIcon, ClipboardCopyIcon,
TrashIcon, DotsHorizontalIcon,
DuplicateIcon,
ExternalLinkIcon,
LinkIcon,
PencilIcon, PencilIcon,
CodeIcon, TrashIcon,
UploadIcon,
UsersIcon,
} from "@heroicons/react/solid"; } from "@heroicons/react/solid";
import { UsersIcon } from "@heroicons/react/solid"; import { UserPlan } from "@prisma/client";
import { Trans } from "next-i18next"; import { Trans } from "next-i18next";
import Head from "next/head"; import Head from "next/head";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import React, { Fragment, useEffect, useRef, useState } from "react"; import React, { Fragment, useEffect, useState } from "react";
import { WEBAPP_URL } from "@calcom/lib/constants"; import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
@ -26,10 +26,10 @@ import { Button } from "@calcom/ui";
import { Alert } from "@calcom/ui/Alert"; import { Alert } from "@calcom/ui/Alert";
import { Dialog, DialogTrigger } from "@calcom/ui/Dialog"; import { Dialog, DialogTrigger } from "@calcom/ui/Dialog";
import Dropdown, { import Dropdown, {
DropdownMenuTrigger,
DropdownMenuContent, DropdownMenuContent,
DropdownMenuItem, DropdownMenuItem,
DropdownMenuSeparator, DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@calcom/ui/Dropdown"; } from "@calcom/ui/Dropdown";
import { Tooltip } from "@calcom/ui/Tooltip"; import { Tooltip } from "@calcom/ui/Tooltip";
@ -49,13 +49,6 @@ import Avatar from "@components/ui/Avatar";
import AvatarGroup from "@components/ui/AvatarGroup"; import AvatarGroup from "@components/ui/AvatarGroup";
import Badge from "@components/ui/Badge"; import Badge from "@components/ui/Badge";
type Profiles = inferQueryOutput<"viewer.eventTypes">["profiles"];
interface CreateEventTypeProps {
canAddEvents: boolean;
profiles: Profiles;
}
type EventTypeGroups = inferQueryOutput<"viewer.eventTypes">["eventTypeGroups"]; type EventTypeGroups = inferQueryOutput<"viewer.eventTypes">["eventTypeGroups"];
type EventTypeGroupProfile = EventTypeGroups[number]["profile"]; type EventTypeGroupProfile = EventTypeGroups[number]["profile"];
interface EventTypeListHeadingProps { interface EventTypeListHeadingProps {
@ -72,7 +65,7 @@ interface EventTypeListProps {
types: EventType[]; types: EventType[];
} }
const Item = ({ type, group, readOnly }: any) => { const Item = ({ type, group, readOnly }: { type: EventType; group: EventTypeGroup; readOnly: boolean }) => {
const { t } = useLocale(); const { t } = useLocale();
return ( return (
@ -135,17 +128,19 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
} }
utils.cancelQuery(["viewer.eventTypes"]); utils.cancelQuery(["viewer.eventTypes"]);
utils.setQueryData(["viewer.eventTypes"], (data) => utils.setQueryData(["viewer.eventTypes"], (data) => {
Object.assign(data, { // tRPC is very strict with the return signature...
if (!data)
return { eventTypeGroups: [], profiles: [], viewer: { canAddEvents: false, plan: UserPlan.FREE } };
return {
...data,
eventTypesGroups: [ eventTypesGroups: [
data?.eventTypeGroups.slice(0, groupIndex), ...data.eventTypeGroups.slice(0, groupIndex),
Object.assign(group, { { ...group, eventTypes: newList },
eventTypes: newList, ...data.eventTypeGroups.slice(groupIndex + 1),
}),
data?.eventTypeGroups.slice(groupIndex + 1),
], ],
}) };
); });
mutation.mutate({ mutation.mutate({
ids: newList.map((type) => type.id), ids: newList.map((type) => type.id),
@ -528,7 +523,7 @@ const EventTypeListHeading = ({ profile, membershipCount }: EventTypeListHeading
); );
}; };
const CreateFirstEventTypeView = ({ canAddEvents, profiles }: CreateEventTypeProps) => { const CreateFirstEventTypeView = () => {
const { t } = useLocale(); const { t } = useLocale();
return ( return (
@ -603,10 +598,8 @@ const EventTypesPage = () => {
</Fragment> </Fragment>
))} ))}
{data.eventTypeGroups.length === 0 && ( {data.eventTypeGroups.length === 0 && <CreateFirstEventTypeView />}
<CreateFirstEventTypeView profiles={data.profiles} canAddEvents={data.viewer.canAddEvents} /> <EmbedDialog />
)}
<EmbedDialog></EmbedDialog>
</> </>
)} )}
/> />

View File

@ -145,7 +145,6 @@ export default function Onboarding(props: inferSSRProps<typeof getServerSideProp
/** Name */ /** Name */
const nameRef = useRef<HTMLInputElement>(null); const nameRef = useRef<HTMLInputElement>(null);
const usernameRef = useRef<HTMLInputElement>(null);
const bioRef = useRef<HTMLInputElement>(null); const bioRef = useRef<HTMLInputElement>(null);
/** End Name */ /** End Name */
/** TimeZone */ /** TimeZone */

View File

@ -63,8 +63,9 @@ function RedirectionToast({ url }: { url: string }) {
const parsedSuccessUrl = new URL(document.URL); const parsedSuccessUrl = new URL(document.URL);
const parsedExternalUrl = new URL(url); const parsedExternalUrl = new URL(url);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-ignore */ //https://stackoverflow.com/questions/49218765/typescript-and-iterator-type-iterableiteratort-is-not-an-array-type /* @ts-ignore */ //https://stackoverflow.com/questions/49218765/typescript-and-iterator-type-iterableiteratort-is-not-an-array-type
for (let [name, value] of parsedExternalUrl.searchParams.entries()) { for (const [name, value] of parsedExternalUrl.searchParams.entries()) {
parsedSuccessUrl.searchParams.set(name, value); parsedSuccessUrl.searchParams.set(name, value);
} }
@ -185,8 +186,9 @@ export default function Success(props: SuccessProps) {
useEffect(() => { useEffect(() => {
const users = eventType.users; const users = eventType.users;
if (!sdkActionManager) return;
// TODO: We should probably make it consistent with Webhook payload. Some data is not available here, as and when requirement comes we can add // TODO: We should probably make it consistent with Webhook payload. Some data is not available here, as and when requirement comes we can add
sdkActionManager!.fire("bookingSuccessful", { sdkActionManager.fire("bookingSuccessful", {
eventType, eventType,
date: date.toString(), date: date.toString(),
duration: eventType.length, duration: eventType.length,
@ -476,7 +478,10 @@ export default function Success(props: SuccessProps) {
<form <form
onSubmit={(e) => { onSubmit={(e) => {
e.preventDefault(); e.preventDefault();
router.push(`https://cal.com/signup?email=` + (e as any).target.email.value); const target = e.target as typeof e.target & {
email: { value: string };
};
router.push(`https://cal.com/signup?email=${target.email.value}`);
}} }}
className="mt-4 flex"> className="mt-4 flex">
<EmailInput <EmailInput
@ -543,7 +548,6 @@ function RecurringBookings({
eventType, eventType,
recurringBookings, recurringBookings,
date, date,
is24h,
}: RecurringBookingsProps) { }: RecurringBookingsProps) {
const [moreEventsVisible, setMoreEventsVisible] = useState(false); const [moreEventsVisible, setMoreEventsVisible] = useState(false);
const { t } = useLocale(); const { t } = useLocale();
@ -649,14 +653,13 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
}; };
} }
let eventTypeRaw = !typeId ? getDefaultEvent(typeSlug) : await getEventTypesFromDB(typeId); const eventTypeRaw = !typeId ? getDefaultEvent(typeSlug) : await getEventTypesFromDB(typeId);
if (!eventTypeRaw) { if (!eventTypeRaw) {
return { return {
notFound: true, notFound: true,
}; };
} }
let spaceBookingAvailable = false;
let userHasSpaceBooking = false; let userHasSpaceBooking = false;
if (eventTypeRaw.users[0] && eventTypeRaw.users[0].id) { if (eventTypeRaw.users[0] && eventTypeRaw.users[0].id) {
@ -690,7 +693,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
}, },
}); });
if (user) { if (user) {
eventTypeRaw.users.push(user as any); eventTypeRaw.users.push(user);
} }
} }

View File

@ -1,11 +1,10 @@
import { Prisma } from "@prisma/client";
import { GetServerSidePropsContext } from "next"; import { GetServerSidePropsContext } from "next";
import { JSONObject } from "superjson/dist/types"; import { JSONObject } from "superjson/dist/types";
import { getLocationLabels } from "@calcom/app-store/utils"; import { getLocationLabels } from "@calcom/app-store/utils";
import { RecurringEvent } from "@calcom/types/Calendar"; import { RecurringEvent } from "@calcom/types/Calendar";
import { asStringOrThrow, asStringOrNull } from "@lib/asStringOrNull"; import { asStringOrNull, asStringOrThrow } from "@lib/asStringOrNull";
import getBooking, { GetBookingType } from "@lib/getBooking"; import getBooking, { GetBookingType } from "@lib/getBooking";
import prisma from "@lib/prisma"; import prisma from "@lib/prisma";
import { inferSSRProps } from "@lib/types/inferSSRProps"; import { inferSSRProps } from "@lib/types/inferSSRProps";
@ -61,6 +60,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
users: { users: {
select: { select: {
id: true, id: true,
username: true,
avatar: true, avatar: true,
name: true, name: true,
}, },

View File

@ -3489,21 +3489,11 @@
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197"
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==
"@types/node@*", "@types/node@14.17.6", "@types/node@>=12.0.0", "@types/node@>=8.1.0": "@types/node@*", "@types/node@14.17.6", "@types/node@16.9.1", "@types/node@>=12.0.0", "@types/node@>=8.1.0", "@types/node@^12.12.6":
version "14.17.6" version "14.17.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.6.tgz#cc61c8361c89e70c468cda464d1fa3dd7e5ebd62" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.6.tgz#cc61c8361c89e70c468cda464d1fa3dd7e5ebd62"
integrity sha512-iBxsxU7eswQDGhlr3AiamBxOssaYxbM+NKXVil8jg9yFXvrfEFbDumLD/2dMTB+zYyg7w+Xjt8yuxfdbUHAtcQ== integrity sha512-iBxsxU7eswQDGhlr3AiamBxOssaYxbM+NKXVil8jg9yFXvrfEFbDumLD/2dMTB+zYyg7w+Xjt8yuxfdbUHAtcQ==
"@types/node@16.9.1":
version "16.9.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708"
integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==
"@types/node@^12.12.6":
version "12.20.52"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.52.tgz#2fd2dc6bfa185601b15457398d4ba1ef27f81251"
integrity sha512-cfkwWw72849SNYp3Zx0IcIs25vABmFh73xicxhCkTcvtZQeIez15PpwQN8fY3RD7gv1Wrxlc9MEtfMORZDEsGw==
"@types/nodemailer@^6.4.4": "@types/nodemailer@^6.4.4":
version "6.4.4" version "6.4.4"
resolved "https://registry.yarnpkg.com/@types/nodemailer/-/nodemailer-6.4.4.tgz#c265f7e7a51df587597b3a49a023acaf0c741f4b" resolved "https://registry.yarnpkg.com/@types/nodemailer/-/nodemailer-6.4.4.tgz#c265f7e7a51df587597b3a49a023acaf0c741f4b"