chore: rename DWD to DelegationCredential (#19703)

* chore: rename DWD to DelegationCredential

* fixup! chore: rename DWD to DelegationCredential

* fixup! fixup! chore: rename DWD to DelegationCredential

* fixup! Merge branch 'main' into rename-domain-wide-delegation

* fixup! fixup! Merge branch 'main' into rename-domain-wide-delegation

* fixup! fixup! fixup! Merge branch 'main' into rename-domain-wide-delegation
This commit is contained in:
Morgan authored and GitHub committed 2025-03-04 09:45:39 -03:00
1 parent a39b5e47a7
commit 7a9ddf2194
167 files changed
+4232 -2356

No files matched your search

@@ -14,11 +14,7 @@ import { getPlaceholderContent } from "../lib/getPlaceholderContent";
export type DestinationCalendarProps = {
connectedCalendars: ConnectedDestinationCalendars["connectedCalendars"];
destinationCalendar: ConnectedDestinationCalendars["destinationCalendar"];
onChange: (value: {
externalId: string;
integration: string;
domainWideDelegationCredentialId?: string;
}) => void;
onChange: (value: { externalId: string; integration: string; delegationCredentialId?: string }) => void;
isPending?: boolean;
hidePlaceholder?: boolean;
value: string | undefined;
@@ -41,7 +37,7 @@ export const DestinationCalendarSelector = ({
value: string;
label: string;
subtitle: string;
domainWideDelegationCredentialId?: string;
delegationCredentialId?: string;
} | null>(null);
useEffect(() => {
@@ -82,7 +78,7 @@ export const DestinationCalendarSelector = ({
selectedCalendar?.primary?.name
})`,
value: `${cal.integration}:${cal.externalId}`,
domainWideDelegationCredentialId: cal.domainWideDelegationCredentialId || undefined,
delegationCredentialId: cal.delegationCredentialId || undefined,
})),
})) ?? []
);
@@ -141,7 +137,7 @@ export const DestinationCalendarSelector = ({
onChange({
integration,
externalId,
domainWideDelegationCredentialId: newValue.domainWideDelegationCredentialId,
delegationCredentialId: newValue.delegationCredentialId,
});
}}
isLoading={isPending}
@@ -38,11 +38,11 @@ export const DestinationCalendarSettingsPlatformWrapper = ({
value={calendars.data.destinationCalendar.externalId}
hidePlaceholder
hideAdvancedText
onChange={async ({ externalId, integration, domainWideDelegationCredentialId }) => {
onChange={async ({ externalId, integration, delegationCredentialId }) => {
await updateDestinationCalendars({
integration,
externalId,
domainWideDelegationCredentialId,
delegationCredentialId,
});
}}
isPending={isUpdatingCalendar}
@@ -35,15 +35,15 @@ export const useAddSelectedCalendar = (
credentialId: number;
integration: string;
externalId: string;
domainWideDelegationCredentialId: string | null;
delegationCredentialId: string | null;
}
>({
mutationFn: (data) => {
const { domainWideDelegationCredentialId, ...rest } = data;
const { delegationCredentialId, ...rest } = data;
return http
.post(`/selected-calendars`, {
...rest,
...(domainWideDelegationCredentialId ? { domainWideDelegationCredentialId } : {}),
...(delegationCredentialId ? { delegationCredentialId } : {}),
})
.then((res) => {
return res.data;
@@ -35,21 +35,17 @@ export const useRemoveSelectedCalendar = (
credentialId: number;
integration: string;
externalId: string;
domainWideDelegationCredentialId: string | null;
delegationCredentialId: string | null;
}
>({
mutationFn: (data) => {
const { credentialId, externalId, integration, domainWideDelegationCredentialId } = data;
const { credentialId, externalId, integration, delegationCredentialId } = data;
return http
.delete(
`/selected-calendars?credentialId=${credentialId}&integration=${integration}&externalId=${encodeURIComponent(
externalId
)}${
domainWideDelegationCredentialId
? `&domainWideDelegationCredentialId=${domainWideDelegationCredentialId}`
: ""
}`
)}${delegationCredentialId ? `&delegationCredentialId=${delegationCredentialId}` : ""}`
)
.then((res) => {
return res.data;
@@ -30,11 +30,11 @@ export const useUpdateDestinationCalendars = (
integration: string;
externalId: string;
credentialId: number | null;
domainWideDelegationCredentialId?: string;
delegationCredentialId?: string;
};
}>,
unknown,
{ integration: string; externalId: string; domainWideDelegationCredentialId?: string }
{ integration: string; externalId: string; delegationCredentialId?: string }
>({
mutationFn: (data) => {
return http.put(`/destination-calendars`, data).then((res) => {
@@ -83,7 +83,7 @@ export const SelectedCalendarsSettingsPlatformWrapper = ({
className="border-subtle mt-4 rounded-lg border"
actions={
<div className="flex w-32 justify-end">
{allowDelete && !connectedCalendar.domainWideDelegationCredentialId && (
{allowDelete && !connectedCalendar.delegationCredentialId && (
<PlatformDisconnectIntegration
credentialId={connectedCalendar.credentialId}
trashIcon
@@ -107,9 +107,7 @@ export const SelectedCalendarsSettingsPlatformWrapper = ({
isChecked={cal.isSelected}
destination={cal.externalId === destinationCalendarId}
credentialId={cal.credentialId}
domainWideDelegationCredentialId={
connectedCalendar.domainWideDelegationCredentialId
}
delegationCredentialId={connectedCalendar.delegationCredentialId}
eventTypeId={null}
/>
);
@@ -127,7 +125,7 @@ export const SelectedCalendarsSettingsPlatformWrapper = ({
message={<span>{connectedCalendar.error?.message || t("calendar_error")}</span>}
iconClassName="h-10 w-10 ml-2 mr-1 mt-0.5"
actions={
!Boolean(connectedCalendar.domainWideDelegationCredentialId) && (
!Boolean(connectedCalendar.delegationCredentialId) && (
<div className="flex w-32 justify-end">
<PlatformDisconnectIntegration
credentialId={connectedCalendar.credentialId}
@@ -222,7 +220,7 @@ const PlatformDisconnectIntegration = (props: {
};
const PlatformCalendarSwitch = (props: ICalendarSwitchProps) => {
const { isChecked, title, credentialId, type, externalId, domainWideDelegationCredentialId } = props;
const { isChecked, title, credentialId, type, externalId, delegationCredentialId } = props;
const [checkedInternal, setCheckedInternal] = useState(isChecked);
const { toast } = useToast();
@@ -255,13 +253,13 @@ const PlatformCalendarSwitch = (props: ICalendarSwitchProps) => {
externalId: string;
}) => {
if (isOn) {
await addSelectedCalendar({ credentialId, integration, externalId, domainWideDelegationCredentialId });
await addSelectedCalendar({ credentialId, integration, externalId, delegationCredentialId });
} else {
await removeSelectedCalendar({
credentialId,
integration,
externalId,
domainWideDelegationCredentialId,
delegationCredentialId,
});
}
};
@@ -65,8 +65,8 @@ const ConnectedCalendarList = ({
description={connectedCalendar.primary?.email ?? connectedCalendar.integration.description}
className="border-subtle mt-4 rounded-lg border"
actions={
// DWD credential can't be disconnected
!connectedCalendar.domainWideDelegationCredentialId &&
// Delegation credential can't be disconnected
!connectedCalendar.delegationCredentialId &&
!disableConnectionModification && (
<div className="flex w-32 justify-end">
<DisconnectIntegration
@@ -95,9 +95,7 @@ const ConnectedCalendarList = ({
destination={cal.externalId === destinationCalendarId}
credentialId={cal.credentialId}
eventTypeId={shouldUseEventTypeScope ? eventTypeId : null}
domainWideDelegationCredentialId={
connectedCalendar.domainWideDelegationCredentialId
}
delegationCredentialId={connectedCalendar.delegationCredentialId}
/>
))}
</ul>
@@ -122,8 +120,8 @@ const ConnectedCalendarList = ({
}
iconClassName="h-10 w-10 ml-2 mr-1 mt-0.5"
actions={
// DWD credential can't be disconnected
!connectedCalendar.domainWideDelegationCredentialId && (
// Delegation credential can't be disconnected
!connectedCalendar.delegationCredentialId && (
<div className="flex w-32 justify-end">
<DisconnectIntegration
credentialId={connectedCalendar.credentialId}
+24 -24
View File
@@ -32,19 +32,19 @@ import getEnabledAppsFromCredentials from "@calcom/lib/apps/getEnabledAppsFromCr
import getAllUserBookings from "@calcom/lib/bookings/getAllUserBookings";
import { symmetricEncrypt, symmetricDecrypt } from "@calcom/lib/crypto";
import {
getFirstDwdConferencingCredentialAppLocation,
getFirstDwdConferencingCredential,
getDwdOrRegularCredential,
getDwdOrFindRegularCredential,
enrichUserWithDwdConferencingCredentialsWithoutOrgId,
enrichUserWithDwdCredentialsWithoutOrgId,
enrichHostsWithDwdCredentials,
enrichUsersWithDwdCredentials,
getFirstDelegationConferencingCredentialAppLocation,
getFirstDelegationConferencingCredential,
getDelegationCredentialOrRegularCredential,
getDelegationCredentialOrFindRegularCredential,
enrichUserWithDelegationConferencingCredentialsWithoutOrgId,
enrichUserWithDelegationCredentialsWithoutOrgId,
enrichHostsWithDelegationCredentials,
enrichUsersWithDelegationCredentials,
buildAllCredentials,
getAllDwdCredentialsForUserByAppSlug,
getAllDwdCredentialsForUserByAppType,
getAllDelegationCredentialsForUserByAppSlug,
getAllDelegationCredentialsForUserByAppType,
checkIfSuccessfullyConfiguredInWorkspace,
} from "@calcom/lib/domainWideDelegation/server";
} from "@calcom/lib/delegationCredential/server";
import getBulkEventTypes from "@calcom/lib/event-types/getBulkEventTypes";
import { getRoutedUrl } from "@calcom/lib/server/getRoutedUrl";
import { getTeamMemberEmailForResponseOrContactUsingUrlQuery } from "@calcom/lib/server/getTeamMemberEmailFromCrm";
@@ -54,7 +54,7 @@ import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/crede
import { paymentDataSelect } from "@calcom/prisma/selects/payment";
import type { TeamQuery } from "@calcom/trpc/server/routers/loggedInViewer/integrations.handler";
import { updateHandler as updateScheduleHandler } from "@calcom/trpc/server/routers/viewer/availability/schedule/update.handler";
import addDwd from "@calcom/trpc/server/routers/viewer/domainWideDelegation/add.handler";
import addDelegationCredential from "@calcom/trpc/server/routers/viewer/delegationCredential/add.handler";
import { getAvailableSlots } from "@calcom/trpc/server/routers/viewer/slots/util";
import {
createNewUsersConnectToOrgIfExists,
@@ -68,17 +68,17 @@ export { getUsersCredentials } from "@calcom/lib/server/getUsersCredentials";
export { getApps };
export {
getFirstDwdConferencingCredentialAppLocation,
getFirstDwdConferencingCredential,
getDwdOrRegularCredential,
getDwdOrFindRegularCredential,
enrichUserWithDwdConferencingCredentialsWithoutOrgId,
enrichUserWithDwdCredentialsWithoutOrgId,
enrichHostsWithDwdCredentials,
enrichUsersWithDwdCredentials,
getFirstDelegationConferencingCredentialAppLocation,
getFirstDelegationConferencingCredential,
getDelegationCredentialOrRegularCredential,
getDelegationCredentialOrFindRegularCredential,
enrichUserWithDelegationConferencingCredentialsWithoutOrgId,
enrichUserWithDelegationCredentialsWithoutOrgId,
enrichHostsWithDelegationCredentials,
enrichUsersWithDelegationCredentials,
buildAllCredentials,
getAllDwdCredentialsForUserByAppSlug,
getAllDwdCredentialsForUserByAppType,
getAllDelegationCredentialsForUserByAppSlug,
getAllDelegationCredentialsForUserByAppType,
checkIfSuccessfullyConfiguredInWorkspace,
};
@@ -276,9 +276,9 @@ export { getRoutedUrl };
export { getTeamMemberEmailForResponseOrContactUsingUrlQuery };
export { addDwd };
export { addDelegationCredential };
export { SelectedCalendarRepository } from "@calcom/lib/server/repository/selectedCalendar";
export { toggleDwdEnabled } from "@calcom/trpc/server/routers/viewer/domainWideDelegation/toggleEnabled.handler";
export { toggleDelegationCredentialEnabled } from "@calcom/trpc/server/routers/viewer/delegationCredential/toggleEnabled.handler";
export { encryptServiceAccountKey } from "@calcom/lib/server/serviceAccountKey";
export { createHandler as createApiKeyHandler } from "@calcom/trpc/server/routers/viewer/apiKeys/create.handler";