From 617e665004e316b7fa66b5652fdcc1e95ac6590a Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Date: Tue, 1 Aug 2023 23:54:28 -0400 Subject: [PATCH] feat: Enable Conferencing Apps for Team Events [CAL-1925] (#10383) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Omar López Co-authored-by: Hariom Balhara --- apps/web/components/AppListCard.tsx | 3 +- apps/web/components/apps/App.tsx | 12 +- .../components/booking/BookingListItem.tsx | 3 +- .../components/dialog/EditLocationDialog.tsx | 19 ++- .../components/eventtype/EventSetupTab.tsx | 4 +- .../web/components/ui/form/LocationSelect.tsx | 2 + apps/web/pages/apps/[slug]/index.tsx | 1 + apps/web/pages/apps/installed/[category].tsx | 2 +- apps/web/pages/event-types/[type]/index.tsx | 1 + packages/app-store/huddle01video/_metadata.ts | 1 + packages/app-store/huddle01video/api/add.ts | 10 +- packages/app-store/jitsivideo/_metadata.ts | 1 + packages/app-store/jitsivideo/api/add.ts | 10 +- packages/app-store/locations.ts | 4 +- packages/app-store/office365video/config.json | 3 +- packages/app-store/server.ts | 144 ++++++++++++++++++ packages/app-store/utils.ts | 98 ++++-------- packages/app-store/webex/config.json | 3 +- packages/core/EventManager.ts | 16 +- .../features/bookings/lib/handleNewBooking.ts | 8 +- packages/lib/apps/getEnabledApps.ts | 7 +- packages/lib/getEventTypeById.ts | 24 ++- packages/prisma/zod-utils.ts | 1 + .../loggedInViewer/locationOptions.handler.ts | 29 +--- .../viewer/bookings/editLocation.handler.ts | 22 ++- .../viewer/bookings/editLocation.schema.ts | 1 + .../routers/viewer/bookings/get.handler.ts | 1 + packages/types/App.d.ts | 2 + packages/types/Calendar.d.ts | 1 + packages/ui/components/apps/AppCard.tsx | 17 ++- 30 files changed, 310 insertions(+), 140 deletions(-) create mode 100644 packages/app-store/server.ts diff --git a/apps/web/components/AppListCard.tsx b/apps/web/components/AppListCard.tsx index 51cc21592d..ddc2075fbb 100644 --- a/apps/web/components/AppListCard.tsx +++ b/apps/web/components/AppListCard.tsx @@ -4,6 +4,7 @@ import { useEffect, useRef, useState } from "react"; import { z } from "zod"; import type { CredentialOwner } from "@calcom/app-store/types"; +import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useTypedQuery } from "@calcom/lib/hooks/useTypedQuery"; import { Badge, ListItemText, Avatar } from "@calcom/ui"; @@ -96,7 +97,7 @@ export default function AppListCard(props: AppListCardProps) { className="mr-2" alt={credentialOwner.name || "Nameless"} size="xs" - imageSrc={credentialOwner.avatar} + imageSrc={getPlaceholderAvatar(credentialOwner.avatar, credentialOwner?.name as string)} /> {credentialOwner.name} diff --git a/apps/web/components/apps/App.tsx b/apps/web/components/apps/App.tsx index 2c8224a83b..b756af691b 100644 --- a/apps/web/components/apps/App.tsx +++ b/apps/web/components/apps/App.tsx @@ -4,6 +4,7 @@ import React, { useState } from "react"; import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation"; import { InstallAppButton, AppDependencyComponent } from "@calcom/app-store/components"; +import { doesAppSupportTeamInstall } from "@calcom/app-store/utils"; import DisconnectIntegration from "@calcom/features/apps/components/DisconnectIntegration"; import { Spinner } from "@calcom/features/calendars/weeklyview/components/spinner/Spinner"; import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired"; @@ -53,6 +54,7 @@ const Component = ({ descriptionItems, isTemplate, dependencies, + concurrentMeetings, }: Parameters[0]) => { const { t, i18n } = useLocale(); const hasDescriptionItems = descriptionItems && descriptionItems.length > 0; @@ -189,6 +191,7 @@ const Component = ({ appCategories={categories} userAdminTeams={appDbQuery.data?.userAdminTeams} addAppMutationInput={{ type, variant, slug }} + concurrentMeetings={concurrentMeetings} multiInstall {...props} /> @@ -227,6 +230,7 @@ const Component = ({ userAdminTeams={appDbQuery.data?.userAdminTeams} addAppMutationInput={{ type, variant, slug }} credentials={appDbQuery.data?.credentials} + concurrentMeetings={concurrentMeetings} {...props} /> ); @@ -381,6 +385,7 @@ export default function App(props: { isTemplate?: boolean; disableInstall?: boolean; dependencies?: string[]; + concurrentMeetings?: boolean; }) { return ( } backPath="/apps" withoutSeo> @@ -406,6 +411,7 @@ const InstallAppButtonChild = ({ appCategories, multiInstall, credentials, + concurrentMeetings, ...props }: { userAdminTeams?: UserAdminTeams; @@ -413,6 +419,7 @@ const InstallAppButtonChild = ({ appCategories: string[]; multiInstall?: boolean; credentials?: RouterOutputs["viewer"]["appCredentialsByType"]["credentials"]; + concurrentMeetings?: boolean; } & ButtonProps) => { const { t } = useLocale(); @@ -426,10 +433,7 @@ const InstallAppButtonChild = ({ }, }); - if ( - !userAdminTeams?.length || - appCategories.some((category) => ["calendar", "conferencing"].includes(category)) - ) { + if (!userAdminTeams?.length || !doesAppSupportTeamInstall(appCategories, concurrentMeetings)) { return (