feat: cal.ai enterprise phone calls (#14100)

* added empty layout

* init

* yarn lock due to package changes

* added retell ai to .env

* removed ton of glue code

* nit

* Discard changes to package.json

* Upgrades lucide-react

* minor UI fixes

* nit

* nit

* feat: save progress

* feat: v1

* fix: type error

* feat: change schema

* fix: type error and testr

* chore: update agent

* chore: change default prompt

* feat: feedback and improvements

* fix: type error

* fix: type error

* hidden for now while in trial

* added i18n and removed some comments

* feat: add cal api key

* fix: type error

---------

Co-authored-by: Omar López <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-03-28 13:59:01 +00:00
1 parent eec76ecfe2
commit 1025238eee
42 files changed
+724 -59

No files matched your search

@@ -6,6 +6,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { Alert, Button, Dialog, DialogClose, DialogContent, DialogFooter, Input } from "@calcom/ui";
import { Link, Search } from "@calcom/ui/components/icon";
import type { LucideIcon } from "@calcom/ui/components/icon";
interface ISearchDialog {
isOpenDialog: boolean;
@@ -85,7 +86,7 @@ export const SearchDialog = (props: ISearchDialog) => {
return null;
};
const renderTab = (Icon: SVGComponent, text: string, mode: Mode) => (
const renderTab = (Icon: SVGComponent | LucideIcon, text: string, mode: Mode) => (
<div
className={classNames(
"flex cursor-pointer items-center border-b-2 p-2 text-sm ",
@@ -6,6 +6,7 @@ import classNames from "@calcom/lib/classNames";
import getPaymentAppData from "@calcom/lib/getPaymentAppData";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Clock, CheckSquare, RefreshCcw } from "@calcom/ui/components/icon";
import type { LucideIcon } from "@calcom/ui/components/icon";
import type { PublicEvent } from "../../types";
import { EventDetailBlocks } from "../../types";
@@ -34,7 +35,7 @@ type EventDetailCustomBlock = {
type EventDetailsProps = EventDetailsPropsBase & (EventDetailDefaultBlock | EventDetailCustomBlock);
interface EventMetaProps {
icon?: React.FC<{ className: string }> | string;
icon?: React.FC<{ className: string }> | string | LucideIcon;
children: React.ReactNode;
// Emphasises the text in the block. For now only
// applying in dark mode.
@@ -1,5 +1,7 @@
import { CreditCard, Zap } from "lucide-react";
export function getPayIcon(currency: string): React.FC<{ className: string }> | string {
import type { LucideIcon } from "@calcom/ui/components/icon";
export function getPayIcon(currency: string): React.FC<{ className: string }> | string | LucideIcon {
return currency !== "BTC" ? CreditCard : Zap;
}
@@ -1,7 +1,8 @@
import { CreditCard } from "lucide-react";
import type { LucideIcon } from "@calcom/ui/components/icon";
import { SatSymbol } from "@calcom/ui/components/icon/SatSymbol";
export function getPriceIcon(currency: string): React.FC<{ className: string }> | string {
export function getPriceIcon(currency: string): React.FC<{ className: string }> | string | LucideIcon {
return currency !== "BTC" ? CreditCard : (SatSymbol as React.FC<{ className: string }>);
}
@@ -6,9 +6,10 @@ import { trpc } from "@calcom/trpc/react";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { CreateButtonWithTeamsList, EmptyScreen as ClassicEmptyScreen, showToast } from "@calcom/ui";
import { Mail, Smartphone, Zap } from "@calcom/ui/components/icon";
import type { LucideIcon } from "@calcom/ui/components/icon";
type WorkflowExampleType = {
Icon: SVGComponent;
Icon: SVGComponent | LucideIcon;
text: string;
};
@@ -54,6 +54,7 @@ const publicEventSelect = Prisma.validator<Prisma.EventTypeSelect>()({
eventName: true,
slug: true,
isInstantEvent: true,
aiPhoneCallConfig: true,
schedulingType: true,
length: true,
locations: true,
@@ -302,6 +303,7 @@ export const getPublicEvent = async (
},
isDynamic: false,
isInstantEvent: eventWithUserProfiles.isInstantEvent,
aiPhoneCallConfig: eventWithUserProfiles.aiPhoneCallConfig,
assignAllTeamMembers: event.assignAllTeamMembers,
};
};
@@ -58,6 +58,14 @@ export type FormValues = {
credentialId?: number;
teamName?: string;
}[];
aiPhoneCallConfig: {
generalPrompt: string;
enabled: boolean;
beginMessage: string;
yourPhoneNumber: string;
numberToCall: string;
guestName: string;
};
customInputs: CustomInputParsed[];
schedule: number | null;
periodType: PeriodType;
@@ -8,11 +8,12 @@ import {
DropdownMenuTrigger,
Tooltip,
} from "@calcom/ui";
import type { LucideIcon } from "@calcom/ui/components/icon";
import { Plus, Link, User, Check } from "@calcom/ui/components/icon";
import { useFilterContext } from "../context/provider";
type Option = { value: "event-type" | "user"; label: string; StartIcon?: SVGComponent };
type Option = { value: "event-type" | "user"; label: string; StartIcon?: SVGComponent | LucideIcon };
export const FilterType = () => {
const { t } = useLocale();
+15 -6
View File
@@ -79,6 +79,7 @@ import {
Tooltip,
useCalcomTheme,
} from "@calcom/ui";
import type { LucideIcon } from "@calcom/ui/components/icon";
import {
ArrowLeft,
ArrowRight,
@@ -100,6 +101,7 @@ import {
Settings,
User as UserIcon,
Users,
Sparkles,
Zap,
Check,
} from "@calcom/ui/components/icon";
@@ -504,7 +506,7 @@ function UserDropdown({ small }: UserDropdownProps) {
<DropdownMenuItem>
<DropdownItem
type="button"
StartIcon={(props) => (
StartIcon={(props: { className?: string }) => (
<UserIcon className={classNames("text-default", props.className)} aria-hidden="true" />
)}
href="/settings/my-account/profile">
@@ -514,7 +516,7 @@ function UserDropdown({ small }: UserDropdownProps) {
<DropdownMenuItem>
<DropdownItem
type="button"
StartIcon={(props) => (
StartIcon={(props: { className?: string }) => (
<Settings className={classNames("text-default", props.className)} aria-hidden="true" />
)}
href="/settings/my-account/general">
@@ -524,7 +526,7 @@ function UserDropdown({ small }: UserDropdownProps) {
<DropdownMenuItem>
<DropdownItem
type="button"
StartIcon={(props) => (
StartIcon={(props: { className?: string }) => (
<Moon className={classNames("text-default", props.className)} aria-hidden="true" />
)}
href="/settings/my-account/out-of-office">
@@ -549,7 +551,9 @@ function UserDropdown({ small }: UserDropdownProps) {
<DropdownMenuItem>
<DropdownItem
type="button"
StartIcon={(props) => <HelpCircle aria-hidden="true" {...props} />}
StartIcon={(props: { className?: string }) => (
<HelpCircle aria-hidden="true" {...props} />
)}
onClick={() => setHelpOpen(true)}>
{t("help")}
</DropdownItem>
@@ -565,7 +569,7 @@ function UserDropdown({ small }: UserDropdownProps) {
<DropdownMenuItem>
<DropdownItem
type="button"
StartIcon={(props) => <LogOut aria-hidden="true" {...props} />}
StartIcon={(props: { className?: string }) => <LogOut aria-hidden="true" {...props} />}
onClick={() => signOut({ callbackUrl: "/auth/logout" })}>
{t("sign_out")}
</DropdownItem>
@@ -585,7 +589,7 @@ export type NavigationItemType = {
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
target?: HTMLAnchorElement["target"];
badge?: React.ReactNode;
icon?: SVGComponent;
icon?: SVGComponent | LucideIcon;
child?: NavigationItemType[];
pro?: true;
onlyMobile?: boolean;
@@ -670,6 +674,11 @@ const navigation: NavigationItemType[] = [
icon: FileText,
isCurrent: ({ pathname }) => pathname?.startsWith("/apps/routing-forms/") ?? false,
},
{
name: "Cal.ai",
href: "/ai",
icon: Sparkles,
},
{
name: "workflows",
href: "/workflows",
@@ -84,6 +84,7 @@ export const getEventTypeById = async ({
description: true,
length: true,
isInstantEvent: true,
aiPhoneCallConfig: true,
offsetStart: true,
hidden: true,
locations: true,
+1
View File
@@ -40,6 +40,7 @@ export const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
slotInterval: true,
successRedirectUrl: true,
isInstantEvent: true,
aiPhoneCallConfig: true,
assignAllTeamMembers: true,
recurringEvent: true,
});
+1 -1
View File
@@ -47,7 +47,7 @@
"@tanstack/react-query": "^5.17.15",
"class-variance-authority": "^0.4.0",
"clsx": "^2.0.0",
"lucide-react": "^0.171.0",
"lucide-react": "^0.363.0",
"react-use": "^17.4.2",
"tailwind-merge": "^1.13.2",
"tailwindcss": "^3.3.3",
@@ -45,6 +45,15 @@ export type Event = {
eventName: string;
slug: string;
isInstantEvent: boolean;
aiPhoneCallConfig: {
eventTypeId: number;
enabled: boolean;
generalPrompt: string;
beginMessage: string | null;
yourPhoneNumber: string;
numberToCall: string;
guestName: string;
};
schedulingType: string;
length: number;
locations: string[]; // Define more specifically if possible
@@ -0,0 +1,23 @@
-- CreateTable
CREATE TABLE "AIPhoneCallConfiguration" (
"id" SERIAL NOT NULL,
"eventTypeId" INTEGER NOT NULL,
"generalPrompt" TEXT NOT NULL,
"yourPhoneNumber" TEXT NOT NULL,
"numberToCall" TEXT NOT NULL,
"guestName" TEXT NOT NULL,
"enabled" BOOLEAN NOT NULL DEFAULT false,
"beginMessage" TEXT,
"llmId" TEXT,
CONSTRAINT "AIPhoneCallConfiguration_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "AIPhoneCallConfiguration_eventTypeId_idx" ON "AIPhoneCallConfiguration"("eventTypeId");
-- CreateIndex
CREATE UNIQUE INDEX "AIPhoneCallConfiguration_eventTypeId_key" ON "AIPhoneCallConfiguration"("eventTypeId");
-- AddForeignKey
ALTER TABLE "AIPhoneCallConfiguration" ADD CONSTRAINT "AIPhoneCallConfiguration_eventTypeId_fkey" FOREIGN KEY ("eventTypeId") REFERENCES "EventType"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+38 -21
View File
@@ -76,7 +76,7 @@ model EventType {
profileId Int?
profile Profile? @relation(fields: [profileId], references: [id], onDelete: Cascade)
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
teamId Int?
hashedLink HashedLink?
bookings Booking[]
@@ -86,40 +86,40 @@ model EventType {
eventName String?
customInputs EventTypeCustomInput[]
parentId Int?
parent EventType? @relation("managed_eventtype", fields: [parentId], references: [id], onDelete: Cascade)
children EventType[] @relation("managed_eventtype")
parent EventType? @relation("managed_eventtype", fields: [parentId], references: [id], onDelete: Cascade)
children EventType[] @relation("managed_eventtype")
/// @zod.custom(imports.eventTypeBookingFields)
bookingFields Json?
timeZone String?
periodType PeriodType @default(UNLIMITED)
periodType PeriodType @default(UNLIMITED)
/// @zod.custom(imports.coerceToDate)
periodStartDate DateTime?
/// @zod.custom(imports.coerceToDate)
periodEndDate DateTime?
periodDays Int?
periodCountCalendarDays Boolean?
lockTimeZoneToggleOnBookingPage Boolean @default(false)
requiresConfirmation Boolean @default(false)
requiresBookerEmailVerification Boolean @default(false)
lockTimeZoneToggleOnBookingPage Boolean @default(false)
requiresConfirmation Boolean @default(false)
requiresBookerEmailVerification Boolean @default(false)
/// @zod.custom(imports.recurringEventType)
recurringEvent Json?
disableGuests Boolean @default(false)
hideCalendarNotes Boolean @default(false)
disableGuests Boolean @default(false)
hideCalendarNotes Boolean @default(false)
/// @zod.min(0)
minimumBookingNotice Int @default(120)
beforeEventBuffer Int @default(0)
afterEventBuffer Int @default(0)
minimumBookingNotice Int @default(120)
beforeEventBuffer Int @default(0)
afterEventBuffer Int @default(0)
seatsPerTimeSlot Int?
onlyShowFirstAvailableSlot Boolean @default(false)
seatsShowAttendees Boolean? @default(false)
seatsShowAvailabilityCount Boolean? @default(true)
onlyShowFirstAvailableSlot Boolean @default(false)
seatsShowAttendees Boolean? @default(false)
seatsShowAvailabilityCount Boolean? @default(true)
schedulingType SchedulingType?
schedule Schedule? @relation(fields: [scheduleId], references: [id])
schedule Schedule? @relation(fields: [scheduleId], references: [id])
scheduleId Int?
// price is deprecated. It has now moved to metadata.apps.stripe.price. Plan to drop this column.
price Int @default(0)
price Int @default(0)
// currency is deprecated. It has now moved to metadata.apps.stripe.currency. Plan to drop this column.
currency String @default("usd")
currency String @default("usd")
slotInterval Int?
/// @zod.custom(imports.EventTypeMetaDataSchema)
metadata Json?
@@ -130,9 +130,10 @@ model EventType {
bookingLimits Json?
/// @zod.custom(imports.intervalLimitsType)
durationLimits Json?
isInstantEvent Boolean @default(false)
assignAllTeamMembers Boolean @default(false)
useEventTypeDestinationCalendarEmail Boolean @default(false)
isInstantEvent Boolean @default(false)
assignAllTeamMembers Boolean @default(false)
useEventTypeDestinationCalendarEmail Boolean @default(false)
aiPhoneCallConfig AIPhoneCallConfiguration?
secondaryEmailId Int?
secondaryEmail SecondaryEmail? @relation(fields: [secondaryEmailId], references: [id], onDelete: Cascade)
@@ -906,6 +907,22 @@ model Workflow {
@@index([teamId])
}
model AIPhoneCallConfiguration {
id Int @id @default(autoincrement())
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
eventTypeId Int
generalPrompt String
yourPhoneNumber String
numberToCall String
guestName String
enabled Boolean @default(false)
beginMessage String?
llmId String?
@@unique([eventTypeId])
@@index([eventTypeId])
}
model WorkflowsOnEventTypes {
id Int @id @default(autoincrement())
workflow Workflow @relation(fields: [workflowId], references: [id], onDelete: Cascade)
+18
View File
@@ -1,5 +1,6 @@
import type { Prisma } from "@prisma/client";
import type { UnitTypeLongPlural } from "dayjs";
import { isValidPhoneNumber } from "libphonenumber-js";
import type { TFunction } from "next-i18next";
import z, { ZodNullable, ZodObject, ZodOptional } from "zod";
import type {
@@ -591,6 +592,7 @@ export const allManagedEventTypeProps: { [k in keyof Omit<Prisma.EventTypeSelect
title: true,
description: true,
isInstantEvent: true,
aiPhoneCallConfig: true,
currency: true,
periodDays: true,
position: true,
@@ -688,3 +690,19 @@ export const bookingSeatDataSchema = z.object({
description: z.string().optional(),
responses: bookingResponses,
});
export const AIPhoneSettingSchema = z.object({
yourPhoneNumber: z.string().refine((val) => isValidPhoneNumber(val)),
numberToCall: z.string().refine((val) => isValidPhoneNumber(val)),
guestName: z.string().trim().min(1, {
message: "Please enter Guest Name",
}),
generalPrompt: z.string().trim().min(1, {
message: "Please enter prompt",
}),
beginMessage: z.string().nullable(),
eventTypeId: z.number(),
calApiKey: z.string().trim().min(1, {
message: "Please enter CAL API Key",
}),
});
@@ -8,6 +8,17 @@ export const EventTypeUpdateInput = _EventTypeModel
/** Optional fields */
.extend({
isInstantEvent: z.boolean().optional(),
aiPhoneCallConfig: z
.object({
generalPrompt: z.string(),
enabled: z.boolean(),
beginMessage: z.string().nullable(),
yourPhoneNumber: z.string().default(""),
numberToCall: z.string().default(""),
guestName: z.string().default(""),
})
.optional(),
calAiPhoneScript: z.string().optional(),
customInputs: z.array(customInputSchema).optional(),
destinationCalendar: _DestinationCalendarModel
.pick({
@@ -49,12 +49,21 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
bookingFields,
offsetStart,
secondaryEmailId,
aiPhoneCallConfig,
...rest
} = input;
const eventType = await ctx.prisma.eventType.findUniqueOrThrow({
where: { id },
select: {
aiPhoneCallConfig: {
select: {
generalPrompt: true,
beginMessage: true,
enabled: true,
llmId: true,
},
},
children: {
select: {
userId: true,
@@ -345,6 +354,27 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
}
}
if (aiPhoneCallConfig) {
if (aiPhoneCallConfig.enabled) {
await ctx.prisma.aIPhoneCallConfiguration.upsert({
where: {
eventTypeId: id,
},
update: aiPhoneCallConfig,
create: {
...aiPhoneCallConfig,
eventTypeId: id,
},
});
} else if (!aiPhoneCallConfig.enabled && eventType.aiPhoneCallConfig) {
await ctx.prisma.aIPhoneCallConfiguration.delete({
where: {
eventTypeId: id,
},
});
}
}
const updatedEventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
slug: true,
schedulingType: true,
@@ -1,4 +1,5 @@
import { ZVerifyCodeInputSchema } from "@calcom/prisma/zod-utils";
import { AIPhoneSettingSchema } from "@calcom/prisma/zod-utils";
import authedProcedure, {
authedAdminProcedure,
@@ -141,4 +142,11 @@ export const viewerOrganizationsRouter = router({
const handler = await importHandler(namespaced("adminDelete"), () => import("./adminDelete.handler"));
return handler(opts);
}),
createPhoneCall: authedProcedure.input(AIPhoneSettingSchema).mutation(async (opts) => {
const handler = await importHandler(
namespaced("createPhoneCall"),
() => import("./createPhoneCall.handler")
);
return handler(opts);
}),
});
@@ -0,0 +1,180 @@
import { z } from "zod";
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
import { handleErrorsJson } from "@calcom/lib/errors";
import logger from "@calcom/lib/logger";
import type { PrismaClient } from "@calcom/prisma";
import type { AIPhoneSettingSchema } from "@calcom/prisma/zod-utils";
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
type CreatePhoneCallProps = {
ctx: {
user: NonNullable<TrpcSessionUser>;
prisma: PrismaClient;
};
input: z.infer<typeof AIPhoneSettingSchema>;
};
const createRetellLLMSchema = z
.object({
llm_id: z.string(),
llm_websocket_url: z.string(),
})
.passthrough();
const getRetellLLMSchema = z
.object({
general_prompt: z.string(),
begin_message: z.string().nullable(),
})
.passthrough();
const createPhoneSchema = z
.object({
call_id: z.string(),
agent_id: z.string(),
})
.passthrough();
const getPhoneNumberSchema = z
.object({
agent_id: z.string(),
})
.passthrough();
export const fetcher = async (endpoint: string, init?: RequestInit | undefined) => {
return fetch(`https://api.retellai.com${endpoint}`, {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.RETELL_AI_KEY}`,
"Content-Type": "application/json",
...init?.headers,
},
...init,
}).then(handleErrorsJson);
};
const createPhoneCallHandler = async ({ input, ctx }: CreatePhoneCallProps) => {
await checkRateLimitAndThrowError({
rateLimitingType: "core",
identifier: `createPhoneCall:${ctx.user.id}`,
});
const { yourPhoneNumber, numberToCall, guestName, eventTypeId, beginMessage, generalPrompt, calApiKey } =
input;
const aiPhoneCallConfig = await ctx.prisma.aIPhoneCallConfiguration.upsert({
where: {
eventTypeId,
},
update: {
beginMessage,
generalPrompt,
enabled: true,
guestName,
numberToCall,
yourPhoneNumber,
},
create: {
eventTypeId,
beginMessage,
generalPrompt,
enabled: true,
guestName,
numberToCall,
yourPhoneNumber,
},
});
let llmWebSocketUrlToBeUpdated = null;
if (!aiPhoneCallConfig.llmId) {
const createdRetellLLM = await fetcher("/create-retell-llm", {
method: "POST",
body: JSON.stringify({
general_prompt: generalPrompt,
begin_message: beginMessage,
general_tools: [
{
type: "end_call",
name: "end_call",
description: "Hang up the call, triggered only after appointment successfully scheduled.",
},
{
type: "check_availability_cal",
name: "check_availability",
cal_api_key: calApiKey,
event_type_id: eventTypeId,
timezone: ctx.user.timeZone,
},
{
type: "book_appointment_cal",
name: "book_appointment",
cal_api_key: calApiKey,
event_type_id: eventTypeId,
timezone: ctx.user.timeZone,
},
],
}),
}).then(createRetellLLMSchema.parse);
await ctx.prisma.aIPhoneCallConfiguration.update({
where: {
eventTypeId,
},
data: {
llmId: createdRetellLLM.llm_id,
},
});
llmWebSocketUrlToBeUpdated = createdRetellLLM.llm_websocket_url;
} else {
const retellLLM = await fetcher(`/get-retell-llm/${aiPhoneCallConfig.llmId}`).then(
getRetellLLMSchema.parse
);
if (retellLLM.general_prompt !== generalPrompt || retellLLM.begin_message !== beginMessage) {
const updatedRetellLLM = await fetcher(`/update-retell-llm/${aiPhoneCallConfig.llmId}`, {
method: "PATCH",
body: JSON.stringify({
general_prompt: generalPrompt,
}),
}).then(getRetellLLMSchema.parse);
logger.debug("updated Retell LLM", updatedRetellLLM);
llmWebSocketUrlToBeUpdated = updatedRetellLLM.llm_websocket_url;
}
}
if (llmWebSocketUrlToBeUpdated) {
const getPhoneNumberDetails = await fetcher(`/get-phone-number/${yourPhoneNumber}`).then(
getPhoneNumberSchema.parse
);
const updated = await fetcher(`/update-agent/${getPhoneNumberDetails.agent_id}`, {
method: "PATCH",
body: JSON.stringify({
llm_websocket_url: llmWebSocketUrlToBeUpdated,
}),
});
logger.debug("updated Retell Agent", updated);
}
// Create Phone Call
const createPhoneCallRes = await fetcher("/create-phone-call", {
method: "POST",
body: JSON.stringify({
from_number: yourPhoneNumber,
to_number: numberToCall,
retell_llm_dynamic_variables: { name: guestName },
}),
}).then(createPhoneSchema.parse);
logger.debug("Create Call Response", createPhoneCallRes);
return createPhoneCallRes;
};
export default createPhoneCallHandler;
+2 -1
View File
@@ -3,6 +3,7 @@ import type { ReactNode } from "react";
import { forwardRef } from "react";
import type { IconType } from "react-icons";
import type { LucideIcon } from "@calcom/ui/components/icon";
import { CheckCircle2, Info, XCircle, AlertTriangle } from "@calcom/ui/components/icon";
export interface AlertProps {
@@ -15,7 +16,7 @@ export interface AlertProps {
iconClassName?: string;
// @TODO: Success and info shouldn't exist as per design?
severity: "success" | "warning" | "error" | "info" | "neutral" | "green";
CustomIcon?: IconType;
CustomIcon?: IconType | LucideIcon;
customIconColor?: string;
}
export const Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {
+1 -1
View File
@@ -273,7 +273,7 @@ const InstallAppButtonChild = ({
type="button"
disabled={isInstalledTeamOrUser}
key={team.id}
StartIcon={(props) => (
StartIcon={(props: { className?: string }) => (
<Avatar
alt={team.logo || ""}
imageSrc={team.logo || `${WEBAPP_URL}/${team.logo}/avatar.png`} // if no image, use default avatar
+2 -1
View File
@@ -5,6 +5,7 @@ import { GoPrimitiveDot } from "react-icons/go";
import classNames from "@calcom/lib/classNames";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import type { LucideIcon } from "@calcom/ui/components/icon";
export const badgeStyles = cva("font-medium inline-flex items-center justify-center rounded gap-x-1", {
variants: {
@@ -36,7 +37,7 @@ type InferredBadgeStyles = VariantProps<typeof badgeStyles>;
type IconOrDot =
| {
startIcon?: SVGComponent;
startIcon?: SVGComponent | LucideIcon;
withDot?: unknown;
}
| { startIcon?: unknown; withDot?: boolean };
+3 -2
View File
@@ -6,6 +6,7 @@ import React, { forwardRef } from "react";
import classNames from "@calcom/lib/classNames";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import type { LucideIcon } from "@calcom/ui/components/icon";
import { Plus } from "../icon";
import { Tooltip } from "../tooltip";
@@ -17,9 +18,9 @@ export type ButtonBaseProps = {
/** Action that happens when the button is clicked */
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
/**Left aligned icon*/
StartIcon?: SVGComponent | React.ElementType;
StartIcon?: SVGComponent | React.ElementType | LucideIcon;
/**Right aligned icon */
EndIcon?: SVGComponent;
EndIcon?: SVGComponent | LucideIcon;
shallow?: boolean;
/**Tool tip used when icon size is set to small */
tooltip?: string;
@@ -1,9 +1,10 @@
import React from "react";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import type { LucideIcon } from "@calcom/ui/components/icon";
interface LinkIconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
Icon: SVGComponent;
Icon: SVGComponent | LucideIcon;
}
export default function LinkIconButton(props: LinkIconButtonProps) {
@@ -113,7 +113,7 @@ export function CreateButton(props: CreateBtnProps) {
<DropdownItem
type="button"
data-testid={`option${option.teamId ? "-team" : ""}-${idx}`}
StartIcon={(props) => (
StartIcon={(props: { className?: string }) => (
<Avatar alt={option.label || ""} imageSrc={option.image} size="sm" {...props} />
)}
onClick={() =>
+2 -1
View File
@@ -9,6 +9,7 @@ import classNames from "@calcom/lib/classNames";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import type { LucideIcon } from "@calcom/ui/components/icon";
import type { ButtonProps } from "../../components/button";
import { Button } from "../../components/button";
@@ -85,7 +86,7 @@ type DialogContentProps = React.ComponentProps<(typeof DialogPrimitive)["Content
description?: string | JSX.Element | null;
closeText?: string;
actionDisabled?: boolean;
Icon?: SVGComponent;
Icon?: SVGComponent | LucideIcon;
enableOverflow?: boolean;
};
@@ -6,6 +6,7 @@ import { forwardRef } from "react";
import { classNames } from "@calcom/lib";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { CheckCircle } from "@calcom/ui/components/icon";
import type { LucideIcon } from "@calcom/ui/components/icon";
import type { ButtonColor } from "../../button/Button";
@@ -105,8 +106,8 @@ DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";
type DropdownItemProps = {
children: React.ReactNode;
color?: ButtonColor;
StartIcon?: SVGComponent;
EndIcon?: SVGComponent;
StartIcon?: SVGComponent | LucideIcon;
EndIcon?: SVGComponent | LucideIcon;
href?: string;
disabled?: boolean;
childrenClassName?: string;
@@ -4,6 +4,7 @@ import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useUrlMatchesCurrentUrl } from "@calcom/lib/hooks/useUrlMatchesCurrentUrl";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import type { LucideIcon } from "@calcom/ui/components/icon";
import { Avatar } from "../../avatar";
import { SkeletonText } from "../../skeleton";
@@ -16,7 +17,7 @@ export type HorizontalTabItemProps = {
href: string;
linkShallow?: boolean;
linkScroll?: boolean;
icon?: SVGComponent;
icon?: SVGComponent | LucideIcon;
avatar?: string;
};
@@ -5,6 +5,7 @@ import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useUrlMatchesCurrentUrl } from "@calcom/lib/hooks/useUrlMatchesCurrentUrl";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import type { LucideIcon } from "@calcom/ui/components/icon";
import { ChevronRight, ExternalLink } from "../../icon";
import { Skeleton } from "../../skeleton";
@@ -12,7 +13,7 @@ import { Skeleton } from "../../skeleton";
export type VerticalTabItemProps = {
name: string;
info?: string;
icon?: SVGComponent;
icon?: SVGComponent | LucideIcon;
disabled?: boolean;
children?: VerticalTabItemProps[];
textClassNames?: string;
+1 -1
View File
@@ -42,7 +42,7 @@
"cmdk": "^0.2.0",
"cmk": "^0.1.1",
"downshift": "^6.1.9",
"lucide-react": "^0.171.0",
"lucide-react": "^0.363.0",
"next": "^13.5.4",
"next-seo": "^6.0.0",
"react": "^18.2.0",