11import type React from "react" ;
22import type { z } from "zod" ;
33
4- import type { EventTypeFormMetadataSchema } from "@calcom/prisma/zod-utils" ;
5- import type { RouterOutputs } from "@calcom/trpc/react" ;
4+ import type { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils" ;
65import type { ButtonProps } from "@calcom/ui/components/button" ;
76
7+ import type { GetAppData , SetAppData } from "./EventTypeAppContext" ;
8+
89export type IntegrationOAuthCallbackState = {
910 returnTo ?: string ;
1011 onErrorReturnTo : string ;
@@ -22,10 +23,16 @@ export type CredentialOwner = {
2223 readOnly ?: boolean ;
2324} ;
2425
25- export type EventTypeAppCardApp = RouterOutputs [ "viewer" ] [ "apps" ] [ "integrations" ] [ "items" ] [ number ] & {
26- credentialOwner ?: CredentialOwner ;
27- credentialIds ?: number [ ] ;
28- } ;
26+ /**
27+ * Domain-specific app type derived from the actual business logic return type
28+ * This ensures we have all the properties that the backend actually returns
29+ */
30+ export type AppCardApp = ConnectedApps [ number ] ;
31+
32+ /**
33+ * For event type app cards, we use the same type since it includes all necessary properties
34+ */
35+ export type EventTypeAppCardApp = AppCardApp ;
2936
3037type AppScript = { attrs ?: Record < string , string > } & { src ?: string ; content ?: string } ;
3138
@@ -45,36 +52,37 @@ export interface InstallAppButtonProps {
4552 onChanged ?: ( ) => unknown ;
4653 disableInstall ?: boolean ;
4754}
55+ /**
56+ * Domain-specific EventType interface for apps - independent of Prisma models
57+ */
58+ export type AppEventType = {
59+ id : number ;
60+ title : string ;
61+ description ?: string ;
62+ teamId ?: number ;
63+ length : number ;
64+ recurringEvent ?: any ; // Keep as any since this is JSON
65+ seatsPerTimeSlot ?: number ;
66+ team ?: {
67+ id : number ;
68+ name ?: string ;
69+ } ;
70+ schedulingType ?: string ;
71+ URL : string ;
72+ } ;
73+
4874export type EventTypeAppCardComponentProps = {
4975 // Limit what data should be accessible to apps
50- eventType : Pick <
51- z . infer < typeof EventTypeModel > ,
52- | "id"
53- | "title"
54- | "description"
55- | "teamId"
56- | "length"
57- | "recurringEvent"
58- | "seatsPerTimeSlot"
59- | "team"
60- | "schedulingType"
61- > & {
62- URL : string ;
63- } ;
76+ eventType : AppEventType ;
6477 app : EventTypeAppCardApp ;
6578 disabled ?: boolean ;
6679 LockedIcon ?: JSX . Element | false ;
67- eventTypeFormMetadata ?: z . infer < typeof EventTypeFormMetadataSchema > ;
80+ eventTypeFormMetadata ?: z . infer < typeof EventTypeMetaDataSchema > ;
6881} ;
6982
7083export type EventTypeAppSettingsComponentProps = {
71- // Limit what data should be accessible to apps\
72- eventType : Pick <
73- z . infer < typeof EventTypeModel > ,
74- "id" | "title" | "description" | "teamId" | "length" | "recurringEvent" | "seatsPerTimeSlot" | "team"
75- > & {
76- URL : string ;
77- } ;
84+ // Limit what data should be accessible to apps
85+ eventType : AppEventType ;
7886 getAppData : GetAppData ;
7987 setAppData : SetAppData ;
8088 disabled ?: boolean ;
@@ -84,5 +92,3 @@ export type EventTypeAppSettingsComponentProps = {
8492export type EventTypeAppCardComponent = React . FC < EventTypeAppCardComponentProps > ;
8593
8694export type EventTypeAppSettingsComponent = React . FC < EventTypeAppSettingsComponentProps > ;
87-
88- export type EventTypeModel = z . infer < typeof EventTypeModel > ;
0 commit comments