Files
fad5497363 feat: allow conferencing apps to be installed on teams (#19784)
* feat: added zoom, office365-video as valid event-type locations

* added docs

* Update stripe.service.ts

* enable conferencing apps for teams initial commit

* fix: make conferencing atom work with teams

* update team events in bulk update default location

* feat: Separate endpoints for team conferencing apps instead of query params

* Display all team events in 'Bulk update existing event types' modal when conferencing atom is enabled for Teams

* fix: bulk update default location for team events

* removed the organizations endpoints

* Refactor: Separate functions for team events to follow SRP

* undo extra changes

* undo extra changes

* fix: platform libraries build breaking

* feat: only allow integrations which are installed in create/update team/user event-type endpoints

* fix: merge conflicts

* remove redundant imports

* Update ConferencingAppsViewPlatformWrapper.tsx

* Update useBanners.ts

* fix: axios error response interceptor

* feat: update :app param docs in `organizations-conferencing.controller`

* Revert "fix: axios error response interceptor"

This reverts commit 729eac3eee9f81c19b5368bbae4b1666884221fd.

* Update useAtomsGetInstalledConferencingApps.ts

* upgrade platform libraries

* Update apps.ts

---------

Co-authored-by: Morgan <[email protected]>
Co-authored-by: Morgan Vernay <[email protected]>
2025-04-02 11:32:11 -04:00

44 lines
1.2 KiB
TypeScript

import { useMutation } from "@tanstack/react-query";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
import type { App } from "@calcom/types/App";
import { useAtomsContext } from "../../../hooks/useAtomsContext";
import http from "../../../lib/http";
export const QUERY_KEY = "use-update-user-default-conferencing-app";
export type UseUpdateUserDefaultConferencingAppProps = {
onSuccess?: () => void;
onError?: (err: Error) => void;
onSettled?: () => void;
teamId?: number;
};
export const useUpdateUserDefaultConferencingApp = ({
onSuccess,
onError,
onSettled,
teamId,
}: UseUpdateUserDefaultConferencingAppProps) => {
const { organizationId } = useAtomsContext();
return useMutation({
onSuccess,
onError,
onSettled,
mutationFn: (app: App["slug"]) => {
if (!app) throw new Error("app is required");
let pathname = `/conferencing/${app}/default`;
if (teamId) {
pathname = `/organizations/${organizationId}/teams/${teamId}/conferencing/${app}/default`;
}
return http?.post(pathname).then((res) => {
if (res.data.status === SUCCESS_STATUS) {
return;
}
throw new Error(res.data.error.message);
});
},
});
};