refactor: platform default event types (#19225)
* feat: add areDefaultEventTypesEnabled to PlatformOAuthClient * feat: specify areDefaultEventTypesEnabled when creating OAuth client * feat: specify areDefaultEventTypesEnabled when updating OAuth client * feat: display areDefaultEventTypesEnabled in OAuth clients list * refactor: set areDefaultEventTypesEnabled by default to false on API level * feat: v2 API CREATE managed user toggle default event types * refactor: centralize OAuth inputs and outputs in platform/types * fix: correct response types for OAuth hooks * refactor: web/lib/hooks/settings/platform/oauth-clients/useOAuthClients.ts * refactor: web/lib/hooks/settings/platform/oauth-clients/useOAuthClients.ts * refactor: split web OAuth hooks into separate files * refactor: split web OAuth hooks into separate files * docs: v2 OAuth client inputs and outputs * refactor: update and create oauth client inputs
This commit is contained in:
1 parent
07789ba697
commit
e437dfa000
35 files changed
+519
-138
No files matched your search
@@ -46,6 +46,7 @@ export const OAuthClientsList = ({ oauthClients, isDeleting, handleDelete }: OAu
|
||||
isLoading={isDeleting}
|
||||
onDelete={handleDelete}
|
||||
areEmailsEnabled={client.areEmailsEnabled}
|
||||
areDefaultEventTypesEnabled={client.areDefaultEventTypesEnabled}
|
||||
organizationId={client.organizationId}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useCheckTeamBilling } from "@calcom/web/lib/hooks/settings/platform/oauth-clients/usePersistOAuthClient";
|
||||
import { useCheckTeamBilling } from "@calcom/web/lib/hooks/settings/platform/billing/useCheckTeamBilling";
|
||||
|
||||
import { usePlatformMe } from "./usePlatformMe";
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ type OAuthClientCardProps = {
|
||||
bookingCancelRedirectUri: string | null | undefined;
|
||||
bookingRescheduleRedirectUri: string | null | undefined;
|
||||
areEmailsEnabled: boolean | undefined;
|
||||
areDefaultEventTypesEnabled: boolean;
|
||||
permissions: Array<keyof typeof PERMISSION_MAP>;
|
||||
lastItem: boolean;
|
||||
id: string;
|
||||
@@ -38,6 +39,7 @@ export const OAuthClientCard = ({
|
||||
onDelete,
|
||||
isLoading,
|
||||
areEmailsEnabled,
|
||||
areDefaultEventTypesEnabled,
|
||||
organizationId,
|
||||
}: OAuthClientCardProps) => {
|
||||
const router = useRouter();
|
||||
@@ -165,6 +167,10 @@ export const OAuthClientCard = ({
|
||||
<div className="flex gap-1 text-sm">
|
||||
<span className="text-sm font-semibold">Emails enabled:</span> {areEmailsEnabled ? "Yes" : "No"}
|
||||
</div>
|
||||
<div className="flex gap-1 text-sm">
|
||||
<span className="text-sm font-semibold">Default event types enabled:</span>{" "}
|
||||
{areDefaultEventTypesEnabled ? "Yes" : "No"}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-start gap-4">
|
||||
<Button
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useForm, useFieldArray } from "react-hook-form";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { PERMISSIONS_GROUPED_MAP } from "@calcom/platform-constants/permissions";
|
||||
import { TextField, Tooltip, Button, Label } from "@calcom/ui";
|
||||
import { TextField, Tooltip, Button, Label, Icon } from "@calcom/ui";
|
||||
|
||||
type OAuthClientFormProps = {
|
||||
defaultValues?: Partial<FormValues>;
|
||||
@@ -33,6 +33,7 @@ export type FormValues = {
|
||||
bookingCancelRedirectUri?: string;
|
||||
bookingRescheduleRedirectUri?: string;
|
||||
areEmailsEnabled?: boolean;
|
||||
areDefaultEventTypesEnabled?: boolean;
|
||||
};
|
||||
|
||||
export const OAuthClientForm = ({
|
||||
@@ -232,6 +233,29 @@ export const OAuthClientForm = ({
|
||||
Enable emails
|
||||
</label>
|
||||
</div>
|
||||
<div className="mt-6">
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
{...register("areDefaultEventTypesEnabled")}
|
||||
id="areDefaultEventTypesEnabled"
|
||||
className="bg-default border-default h-4 w-4 shrink-0 cursor-pointer rounded-[4px] border ring-offset-2 transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed"
|
||||
type="checkbox"
|
||||
disabled={isFormDisabled}
|
||||
/>
|
||||
<label
|
||||
htmlFor="areDefaultEventTypesEnabled"
|
||||
className="cursor-pointer px-2 text-base font-semibold">
|
||||
Enable managed user default event types
|
||||
</label>
|
||||
<Tooltip
|
||||
className="max-w-[400px] whitespace-normal"
|
||||
content="If enabled, when creating a managed user the managed user will have 4 default event types: 30 and 60 minutes without Cal video, 30 and 60 minutes with Cal video. Leave this disabled if you want to create a managed user and then manually create event types for the user.">
|
||||
<div className="ml-1">
|
||||
<Icon name="info" className="h-4 w-4 text-gray-500" aria-hidden="true" />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-6">
|
||||
<div className="flex justify-between">
|
||||
<h1 className="text-base font-semibold underline">Permissions</h1>
|
||||
|
||||
@@ -5,10 +5,8 @@ import type { ReactNode } from "react";
|
||||
import { ErrorCode } from "@calcom/lib/errorCodes";
|
||||
import { showToast } from "@calcom/ui";
|
||||
|
||||
import {
|
||||
useSubscribeTeamToStripe,
|
||||
useUpgradeTeamSubscriptionInStripe,
|
||||
} from "@lib/hooks/settings/platform/oauth-clients/usePersistOAuthClient";
|
||||
import { useSubscribeTeamToStripe } from "@lib/hooks/settings/platform/billing/useSubscribeTeamToStripe";
|
||||
import { useUpgradeTeamSubscriptionInStripe } from "@lib/hooks/settings/platform/billing/useUpgradeTeamSubscriptionInStripe";
|
||||
|
||||
import { platformPlans } from "@components/settings/platform/platformUtils";
|
||||
import { PlatformBillingCard } from "@components/settings/platform/pricing/billing-card";
|
||||
|
||||
Reference in new issue
Block a user