2023-08-14 12:02:29 -03:00
import type { AppCategories , Prisma } from "@prisma/client" ;
2022-04-05 15:03:22 -03:00
2023-03-09 06:07:23 -03:00
import type { Tag } from "@calcom/app-store/types" ;
2023-01-18 19:30:25 -03:00
2022-08-25 21:48:50 -03:00
type CommonProperties = {
default ? : false ;
type : string ;
label : string ;
messageForOrganizer? : string ;
iconUrl? : string ;
variable ? : "locationLink" ;
defaultValueVariable ? : "link" ;
attendeeInputType? : null ;
attendeeInputPlaceholder? : null ;
} ;
type StaticLinkBasedEventLocation = {
linkType : "static" ;
urlRegExp : string ;
organizerInputPlaceholder? : string ;
organizerInputType ? : "text" | "phone" ;
} & CommonProperties ;
type DynamicLinkBasedEventLocation = {
linkType : "dynamic" ;
urlRegExp? : null ;
organizerInputType? : null ;
organizerInputPlaceholder? : null ;
} & CommonProperties ;
export type EventLocationTypeFromAppMeta = StaticLinkBasedEventLocation | DynamicLinkBasedEventLocation ;
2023-11-15 09:29:41 -03:00
type PaidAppData = {
priceInUsd : number ;
priceId : string ;
trial? : number ;
mode ? : "subscription" | "one_time" ;
} ;
2023-01-18 19:30:25 -03:00
type AppData = {
2023-08-14 12:02:29 -03:00
/ * *
* TODO : We must assert that if ` location ` is set in App config . json , then it must have atleast Messaging or Conferencing as a category .
* This is because we fetch only those credentials ( as an optimization ) which match that category .
* /
2023-01-18 19:30:25 -03:00
location? : EventLocationTypeFromAppMeta ;
tag? : Tag ;
} | null ;
2022-03-23 19:00:30 -03:00
/ * *
* This is the definition for an app store ' s app metadata .
* This is used to display App info , categorize or hide certain apps in the app store .
* /
export interface App {
/ * *
2022-05-02 20:13:34 -03:00
* @deprecated
2023-01-18 19:30:25 -03:00
* Whether if the app is installed or not . Usually we check for api keys in env
2022-03-23 19:00:30 -03:00
* variables to determine if this is true or not .
* * /
2022-05-02 20:13:34 -03:00
installed? : boolean ;
2022-03-23 19:00:30 -03:00
/** The app type */
2022-04-06 09:37:06 -03:00
type :
| ` ${ string } _calendar `
| ` ${ string } _messaging `
| ` ${ string } _payment `
| ` ${ string } _video `
2022-04-15 23:23:38 -03:00
| ` ${ string } _other `
2022-09-15 05:16:56 -03:00
| ` ${ string } _automation `
2022-10-14 13:24:43 -03:00
| ` ${ string } _analytics `
2022-04-15 23:23:38 -03:00
| ` ${ string } _other_calendar ` ;
2022-09-14 05:46:42 -03:00
/ * *
* @deprecated
*
* Use name instead . Remove this property after ensuring name has the required value everywhere
* * /
2022-08-13 08:04:57 -03:00
title? : string ;
2022-03-23 19:00:30 -03:00
/** The display name for the app */
name : string ;
/** A brief description, usually found in the app's package.json */
description : string ;
/** TODO determine if we should use this instead of category */
2023-11-29 08:57:50 -03:00
variant : "calendar" | "payment" | "conferencing" | "video" | "other" | "other_calendar" | "automation" ;
2022-03-23 19:00:30 -03:00
/** The slug for the app store public page inside `/apps/[slug] */
slug : string ;
2022-08-25 21:48:50 -03:00
2023-08-14 12:02:29 -03:00
/** The category to which this app belongs. Remove all usages of category and then remove the prop */
2022-08-25 21:48:50 -03:00
/ *
* @deprecated Use categories
* /
2022-12-20 19:15:06 -03:00
category? : string ;
2022-08-25 21:48:50 -03:00
2023-08-14 12:02:29 -03:00
/** The category to which this app belongs. */
/ * *
* Messaging and Conferencing ( Earlier called Video ) are considered location apps and are fetched when configuring an event - type location .
* /
categories : AppCategories [ ] ;
2022-10-14 13:24:43 -03:00
/ * *
* ` User ` is the broadest category . ` EventType ` is when you want to add features to EventTypes .
* See https : //app.gitbook.com/o/6snd8PyPYMhg0wUw6CeQ/s/VXRprBTuMlihk37NQgUU/~/changes/6xkqZ4qvJ3Xh9k8UaWaZ/engineering/product-specs/app-store#user-apps for more details
* /
extendsFeature ? : "EventType" | "User" ;
2022-06-13 18:06:12 -03:00
/** An absolute url to the app logo */
2022-03-23 19:00:30 -03:00
logo : string ;
/** Company or individual publishing this app */
publisher : string ;
/** App's website */
url : string ;
/** Optional documentation website URL */
docsUrl? : string ;
/** Wether if the app is verified by Cal.com or not */
2023-01-18 19:30:25 -03:00
verified? : boolean ;
2022-03-23 19:00:30 -03:00
/** Wether the app should appear in the trending section of the app store */
2023-01-18 19:30:25 -03:00
trending? : boolean ;
2022-03-23 19:00:30 -03:00
/** Rating from 0 to 5, harcoded for now. Should be fetched later on. */
2023-01-18 19:30:25 -03:00
rating? : number ;
2022-03-23 19:00:30 -03:00
/** Number of reviews, harcoded for now. Should be fetched later on. */
2023-01-18 19:30:25 -03:00
reviews? : number ;
2022-03-23 19:00:30 -03:00
/ * *
2023-08-01 08:10:52 -03:00
* Whether if the app is installed globally or needs user intervention .
2022-03-23 19:00:30 -03:00
* Used to show Connect / Disconnect buttons in App Store
* * /
isGlobal? : boolean ;
2023-07-26 13:44:19 -03:00
/ * *
* For apps that are accessible on an alternate URL ( which is simpler and shorter ) , this can be set .
* e . g . Routing Forms App is available as / routing - forms in addition to regular / apps / routing - forms .
* /
simplePath? : string ;
2022-03-23 19:00:30 -03:00
/** A contact email, mainly to ask for support */
email : string ;
/** Needed API Keys (usually for global apps) */
key? : Prisma.JsonValue ;
/** If not free, what kind of fees does the app have */
feeType ? : "monthly" | "usage-based" | "one-time" | "free" ;
/** 0 = free. if type="usage-based" it's the price per booking */
price? : number ;
/** only required for "usage-based" billing. % of commission for paid bookings */
commission? : number ;
2022-07-14 09:40:53 -03:00
licenseRequired? : boolean ;
2023-05-19 06:52:17 -03:00
teamsPlanRequired ? : {
upgradeUrl : string ;
} ;
2023-01-18 19:30:25 -03:00
appData? : AppData ;
2023-11-15 09:29:41 -03:00
/** Represents paid app data, such as price, trials, etc */
paid? : PaidAppData ;
2023-04-11 22:56:43 -03:00
/ * *
* @deprecated
* Used only by legacy apps which had slug different from their directory name .
* /
2022-12-07 18:47:02 -03:00
dirName? : string ;
2023-01-18 19:30:25 -03:00
isTemplate? : boolean ;
__template? : string ;
2023-03-09 06:07:23 -03:00
/** Slug of an app needed to be installed before the current app can be added */
dependencies? : string [ ] ;
2023-08-02 00:54:28 -03:00
/** Enables video apps to be used for team events. Non Video/Conferencing apps don't honor this as they support team installation always. */
concurrentMeetings? : boolean ;
2023-09-04 07:30:21 -03:00
createdAt? : string ;
2022-03-23 19:00:30 -03:00
}
2022-08-25 21:48:50 -03:00
2022-12-20 19:15:06 -03:00
export type AppFrontendPayload = Omit < App , " key " > & {
/** We should type error if keys are leaked to the frontend */
2023-02-17 06:11:03 -03:00
isDefault? : boolean ;
2022-12-20 19:15:06 -03:00
key? : never ;
2023-03-09 06:07:23 -03:00
dependencyData ? : {
name? : string ;
installed? : boolean ;
} [ ] ;
2023-05-30 15:36:48 -03:00
/** Number of users who currently have this App installed */
installCount? : number ;
2022-12-20 19:15:06 -03:00
} ;
2023-04-25 11:04:40 -03:00
export type AppMeta = App ;