From 18b5612c0d342f6ee3cfe6a2bd675ab59bb6c257 Mon Sep 17 00:00:00 2001 From: Somay Chauhan Date: Mon, 23 Jun 2025 22:59:44 +0530 Subject: [PATCH] feat: add apps filter and bulk update toggle to conferencing apps atom (#21973) * feat: add apps filter and bulk update toggle to conferencing apps atom * docs: clarify description of disableBulkUpdateEventTypes flag in conferencing apps docs * docs: update valid conferencing app slugs in atoms documentation --------- Co-authored-by: Rajiv Sahal --- docs/platform/atoms/conferencing-apps.mdx | 4 +- .../ConferencingAppsViewPlatformWrapper.tsx | 70 +++++++++++++------ .../hooks/useAtomGetEventTypes.ts | 4 +- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/docs/platform/atoms/conferencing-apps.mdx b/docs/platform/atoms/conferencing-apps.mdx index c294c7a920..9dcd4fad82 100644 --- a/docs/platform/atoms/conferencing-apps.mdx +++ b/docs/platform/atoms/conferencing-apps.mdx @@ -31,7 +31,9 @@ Below is a list of props that can be passed to the Conferencing Apps Atom | :------------------ | :------- | :-------------------------------------------------------------------------- | | returnTo | No | The URL of the page to redirect to after a successful installation. | | onErrorReturnTo | No | The URL of the page to redirect to in case an error occurs. | -| disableToasts | No | boolean value to disable toast notifications in the atom. | +| disableToasts | No | Boolean value to disable toast notifications in the atom. | +| apps | No | Array of conferencing app slugs to display in the dropdown. If provided, only these apps will be shown (if not already installed). Valid values are `'google-meet'`, `'zoom'`, and `'msteams'`. | +| disableBulkUpdateEventTypes | No | A Boolean flag that prevents the bulk update of event types modal from appearing when the default conferencing app is changed. Defaults to false | ## Google Meet diff --git a/packages/platform/atoms/connect/conferencing-apps/ConferencingAppsViewPlatformWrapper.tsx b/packages/platform/atoms/connect/conferencing-apps/ConferencingAppsViewPlatformWrapper.tsx index ae0337f1fe..6c1c132e0d 100644 --- a/packages/platform/atoms/connect/conferencing-apps/ConferencingAppsViewPlatformWrapper.tsx +++ b/packages/platform/atoms/connect/conferencing-apps/ConferencingAppsViewPlatformWrapper.tsx @@ -42,11 +42,15 @@ import { } from "./hooks/useGetDefaultConferencingApp"; import { useUpdateUserDefaultConferencingApp } from "./hooks/useUpdateUserDefaultConferencingApp"; +type ConferencingAppSlug = typeof GOOGLE_MEET | typeof ZOOM | typeof OFFICE_365_VIDEO; + type ConferencingAppsViewPlatformWrapperProps = { disableToasts?: boolean; returnTo?: string; onErrorReturnTo?: string; teamId?: number; + apps?: ConferencingAppSlug[]; + disableBulkUpdateEventTypes?: boolean; }; type RemoveAppParams = { callback: () => void; app?: App["slug"] }; @@ -73,6 +77,8 @@ export const ConferencingAppsViewPlatformWrapper = ({ returnTo, onErrorReturnTo, teamId, + apps, + disableBulkUpdateEventTypes = false, }: ConferencingAppsViewPlatformWrapperProps) => { const { t } = useLocale(); const queryClient = useQueryClient(); @@ -105,7 +111,10 @@ export const ConferencingAppsViewPlatformWrapper = ({ const installedIntegrationsQuery = useAtomsGetInstalledConferencingApps(teamId); const { data: defaultConferencingApp } = useGetDefaultConferencingApp(teamId); - const { data: eventTypesQuery, isFetching: isEventTypesFetching } = useAtomGetEventTypes(teamId); + const { data: eventTypesQuery, isFetching: isEventTypesFetching } = useAtomGetEventTypes( + teamId, + disableBulkUpdateEventTypes + ); const deleteCredentialMutation = useDeleteCredential({ onSuccess: () => { @@ -146,7 +155,7 @@ export const ConferencingAppsViewPlatformWrapper = ({ onSuccess: () => { showToast("Default app updated successfully", "success"); queryClient.invalidateQueries({ queryKey: [defaultConferencingAppQueryKey] }); - onSuccessCallback(); + !disableBulkUpdateEventTypes && onSuccessCallback(); }, onError: (error) => { showToast(`Error: ${error.message}`, "error"); @@ -156,6 +165,11 @@ export const ConferencingAppsViewPlatformWrapper = ({ }; const handleBulkUpdateDefaultLocation = ({ eventTypeIds, callback }: BulkUpdatParams) => { + if (disableBulkUpdateEventTypes) { + callback(); + return; + } + bulkUpdateEventTypesToDefaultLocation.mutate(eventTypeIds, { onSuccess: () => { queryClient.invalidateQueries({ queryKey: [defaultConferencingAppQueryKey] }); @@ -195,28 +209,38 @@ export const ConferencingAppsViewPlatformWrapper = ({ - {installedApps && !installedApps.find((app) => app.slug == GOOGLE_MEET) && ( - - connect(GOOGLE_MEET)}> - {t("google_meet")} - - - )} - {installedApps && !installedApps?.find((app) => app.slug == ZOOM) && ( - - connect(ZOOM)}> - {t("zoom")} - - - )} + {/* Show Google Meet if it's not installed and either no apps filter is provided or it's in the apps filter */} + {installedApps && + !installedApps.find((app) => app.slug === GOOGLE_MEET) && + (!apps || apps.includes(GOOGLE_MEET)) && ( + + connect(GOOGLE_MEET)}> + {t("google_meet")} + + + )} - {installedApps && !installedApps?.find((app) => app.slug == OFFICE_365_VIDEO) && ( - - setIsAccountModalOpen(true)}> - {t("office_365_video")} - - - )} + {/* Show Zoom if it's not installed and either no apps filter is provided or it's in the apps filter */} + {installedApps && + !installedApps.find((app) => app.slug === ZOOM) && + (!apps || apps.includes(ZOOM)) && ( + + connect(ZOOM)}> + {t("zoom")} + + + )} + + {/* Show Office 365 Video if it's not installed and either no apps filter is provided or it's in the apps filter */} + {installedApps && + !installedApps.find((app) => app.slug === OFFICE_365_VIDEO) && + (!apps || apps.includes(OFFICE_365_VIDEO)) && ( + + setIsAccountModalOpen(true)}> + {t("office_365_video")} + + + )} ); diff --git a/packages/platform/atoms/connect/conferencing-apps/hooks/useAtomGetEventTypes.ts b/packages/platform/atoms/connect/conferencing-apps/hooks/useAtomGetEventTypes.ts index fa73f6c4ee..ab06b727d9 100644 --- a/packages/platform/atoms/connect/conferencing-apps/hooks/useAtomGetEventTypes.ts +++ b/packages/platform/atoms/connect/conferencing-apps/hooks/useAtomGetEventTypes.ts @@ -10,7 +10,7 @@ export const QUERY_KEY = "use-get-event-types"; type ResponseEventType = { eventTypes: Array<{ id: number; title: string }> }; -export const useAtomGetEventTypes = (teamId?: number) => { +export const useAtomGetEventTypes = (teamId?: number, disableBulkUpdateEventTypes = false) => { const { isInit, accessToken, organizationId } = useAtomsContext(); let pathname = "/atoms/event-types"; @@ -29,6 +29,6 @@ export const useAtomGetEventTypes = (teamId?: number) => { throw new Error(res.data.error.message); }); }, - enabled: isInit && !!accessToken, + enabled: isInit && !!accessToken && !disableBulkUpdateEventTypes, }); };