Add Huddle01 integration (#1675)

* Add Huddle01 integration

* updated huddle01 locale strings

Co-authored-by: deepso <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
authored and GitHub committed 2022-02-03 11:59:02 +00:00
1 parent acf8b83b1a
commit 64db8d1cd4
24 files changed
+142 -6

No files matched your search

@@ -0,0 +1,48 @@
import { Credential } from "@prisma/client";
import { handleErrorsJson } from "@lib/errors";
import { PartialReference } from "@lib/events/EventManager";
import { randomString } from "@lib/random";
import { VideoApiAdapter, VideoCallData } from "@lib/videoClient";
export const FAKE_HUDDLE_CREDENTIAL: Credential = {
id: +new Date().getTime(),
type: "huddle01_video",
key: { apikey: randomString(12) },
userId: +new Date().getTime(),
};
const Huddle01VideoApiAdapter = (): VideoApiAdapter => {
return {
getAvailability: () => {
return Promise.resolve([]);
},
createMeeting: async (): Promise<VideoCallData> => {
const res = await fetch(
"https://wpss2zlpb9.execute-api.us-east-1.amazonaws.com/new-meeting?utmCampaign=cal.com&utmSource=partner&utmMedium=calendar"
);
const { url } = await handleErrorsJson(res);
return Promise.resolve({
type: "huddle01_video",
id: randomString(21),
password: "",
url,
});
},
deleteMeeting: async (): Promise<void> => {
Promise.resolve();
},
updateMeeting: (bookingRef: PartialReference): Promise<VideoCallData> => {
return Promise.resolve({
type: "huddle01_video",
id: bookingRef.meetingId as string,
password: bookingRef.meetingPassword as string,
url: bookingRef.meetingUrl as string,
});
},
};
};
export default Huddle01VideoApiAdapter;
+13 -1
View File
@@ -23,6 +23,7 @@ export type Integration = {
| "caldav_calendar"
| "apple_calendar"
| "stripe_payment"
| "huddle01_video"
| "metamask_web3";
title: string;
imageSrc: string;
@@ -63,6 +64,14 @@ export const ALL_INTEGRATIONS = [
description: "Video Conferencing",
variant: "conferencing",
},
{
installed: true,
type: "huddle01_video",
title: "Huddle01",
imageSrc: "integrations/huddle.svg",
description: "Video Conferencing",
variant: "conferencing",
},
{
installed: true,
type: "caldav_calendar",
@@ -125,7 +134,10 @@ export type IntegrationMeta = ReturnType<typeof getIntegrations>;
export function hasIntegration(integrations: IntegrationMeta, type: string): boolean {
return !!integrations.find(
(i) => i.type === type && !!i.installed && (type === "daily_video" || i.credentials.length > 0)
(i) =>
i.type === type &&
!!i.installed &&
(type === "daily_video" || type === "huddle01_video" || i.credentials.length > 0)
);
}
export function hasIntegrationInstalled(type: Integration["type"]): boolean {