Add Jitsi Meet Integration (#1674)

* basic integration structure

* jitsi logo

* add jitsi meet description to event settings page

* add JitsiVideoApiAdapter

ref #1445

* add LocationType.Jitsi to BookingPage

ref #1445

* add LocationType.Jitsi to event-types

ref #1445

* add meet.jit.si/cal/uuid support to BookingPage

ref #1445

* add basic "cal_provide_jitsi_meeting_url" translation strings

ref #1445

* generate meeting id

ref #1445

* implement direct jitsi link in /success page

ref #1445

* cleanup location link duplicate

ref #1445

* full JitsiVideoApiAdapter implementation

ref #1445

* check integration availability in /pages/event-types/[type]

ref #1445

* add video conferencing link as calendar event location

ref #1445

* PR feedback

* Update components/booking/pages/BookingPage.tsx

don't know - wouldn't do this myself for future proofing but fine...

Co-authored-by: Omar López <[email protected]>

* Update components/booking/pages/BookingPage.tsx

🤷‍♂️

Co-authored-by: Omar López <[email protected]>

* cleanup: props.type === "jitsi_video"

ref #1445

Co-authored-by: zomars <[email protected]>
This commit is contained in:
Philipp DormannandOmar López authored and GitHub committed 2022-02-08 15:12:28 -07:00
1 parent 38b41f0adb
commit 20d2955e68
26 files changed
+171 -20

No files matched your search

+1
View File
@@ -66,6 +66,7 @@ export const getLocationRequestFromIntegration = (location: string) => {
location === LocationType.GoogleMeet.valueOf() ||
location === LocationType.Zoom.valueOf() ||
location === LocationType.Daily.valueOf() ||
location === LocationType.Jitsi.valueOf() ||
location === LocationType.Huddle01.valueOf() ||
location === LocationType.Tandem.valueOf()
) {
+2
View File
@@ -14,6 +14,8 @@ export function getIntegrationName(name: string) {
return "Apple Calendar";
case "daily_video":
return "Daily";
case "jitsi_video":
return "Jitsi Meet";
case "huddle01_video":
return "Huddle01";
case "tandem_video":
@@ -0,0 +1,34 @@
import { v4 as uuidv4 } from "uuid";
import { PartialReference } from "@lib/events/EventManager";
import { VideoApiAdapter, VideoCallData } from "@lib/videoClient";
const JitsiVideoApiAdapter = (): VideoApiAdapter => {
return {
getAvailability: () => {
return Promise.resolve([]);
},
createMeeting: async (): Promise<VideoCallData> => {
const meetingID = uuidv4();
return Promise.resolve({
type: "jitsi_video",
id: meetingID,
password: "",
url: "https://meet.jit.si/cal/" + meetingID,
});
},
deleteMeeting: async (): Promise<void> => {
Promise.resolve();
},
updateMeeting: (bookingRef: PartialReference): Promise<VideoCallData> => {
return Promise.resolve({
type: "jitsi_video",
id: bookingRef.meetingId as string,
password: bookingRef.meetingPassword as string,
url: bookingRef.meetingUrl as string,
});
},
};
};
export default JitsiVideoApiAdapter;
+14 -6
View File
@@ -1,11 +1,7 @@
import { Prisma } from "@prisma/client";
import _ from "lodash";
/**
* We can't use aliases in playwright tests (yet)
* https://github.com/microsoft/playwright/issues/7121
*/
import { validJson } from "../../lib/jsonUtils";
import { validJson } from "@lib/jsonUtils";
const credentialData = Prisma.validator<Prisma.CredentialArgs>()({
select: { id: true, type: true },
@@ -24,6 +20,7 @@ export type Integration = {
| "caldav_calendar"
| "apple_calendar"
| "stripe_payment"
| "jitsi_video"
| "huddle01_video"
| "metamask_web3";
title: string;
@@ -65,6 +62,14 @@ export const ALL_INTEGRATIONS = [
description: "Video Conferencing",
variant: "conferencing",
},
{
installed: true,
type: "jitsi_video",
title: "Jitsi Meet",
imageSrc: "integrations/jitsi.svg",
description: "Video Conferencing",
variant: "conferencing",
},
{
installed: true,
type: "huddle01_video",
@@ -146,7 +151,10 @@ export function hasIntegration(integrations: IntegrationMeta, type: string): boo
(i) =>
i.type === type &&
!!i.installed &&
(type === "daily_video" || type === "huddle01_video" || i.credentials.length > 0)
(type === "daily_video" ||
type === "jitsi_video" ||
type === "huddle01_video" ||
i.credentials.length > 0)
);
}
export function hasIntegrationInstalled(type: Integration["type"]): boolean {
+1
View File
@@ -4,6 +4,7 @@ export enum LocationType {
GoogleMeet = "integrations:google:meet",
Zoom = "integrations:zoom",
Daily = "integrations:daily",
Jitsi = "integrations:jitsi",
Huddle01 = "integrations:huddle01",
Tandem = "integrations:tandem",
}
+4
View File
@@ -6,6 +6,7 @@ import { getUid } from "@lib/CalEventParser";
import { EventResult } from "@lib/events/EventManager";
import { PartialReference } from "@lib/events/EventManager";
import Huddle01VideoApiAdapter from "@lib/integrations/Huddle01/Huddle01VideoApiAdapter";
import JitsiVideoApiAdapter from "@lib/integrations/Jitsi/JitsiVideoApiAdapter";
import logger from "@lib/logger";
import DailyVideoApiAdapter from "./integrations/Daily/DailyVideoApiAdapter";
@@ -46,6 +47,9 @@ const getVideoAdapters = (withCredentials: Credential[]): VideoApiAdapter[] =>
case "daily_video":
acc.push(DailyVideoApiAdapter(cred));
break;
case "jitsi_video":
acc.push(JitsiVideoApiAdapter());
break;
case "huddle01_video":
acc.push(Huddle01VideoApiAdapter());
break;