Scheduling infrastructure for absolutely everyone.
Add disable success page config[Platform Only] (#6225)
Hariom Balhara15123c1aa527
diff --git a/apps/web/components/eventtype/EventAdvancedTab.tsx b/apps/web/components/eventtype/EventAdvancedTab.tsxindex b35bcfa7211..df4f1c81731 100644--- a/apps/web/components/eventtype/EventAdvancedTab.tsx+++ b/apps/web/components/eventtype/EventAdvancedTab.tsx@@ -7,10 +7,11 @@ import { v5 as uuidv5 } from "uuid";import DestinationCalendarSelector from "@calcom/features/calendars/DestinationCalendarSelector";import CustomInputItem from "@calcom/features/eventtypes/components/CustomInputItem";-import { APP_NAME, CAL_URL } from "@calcom/lib/constants";+import { APP_NAME, CAL_URL, IS_SELF_HOSTED } from "@calcom/lib/constants";import { useLocale } from "@calcom/lib/hooks/useLocale";import { trpc } from "@calcom/trpc/react";import {+ Badge,Button,Checkbox,Dialog,@@ -256,13 +257,30 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,defaultValue={eventType.successRedirectUrl || ""}{...formMethods.register("successRedirectUrl")}/>+ <div className="mt-2 flex">+ <Checkbox+ description={t("disable_success_page")}+ // Disable if it's not Self Hosted or if the redirect url is not set+ disabled={!IS_SELF_HOSTED || !formMethods.watch("successRedirectUrl")}+ {...formMethods.register("metadata.disableSuccessPage")}+ />+ {/*TODO: Extract it out into a component when used more than once*/}+ {!IS_SELF_HOSTED && (+ <Link href="https://cal.com/pricing">+ <a target="_blank">+ <Badge variant="orange" className="ml-2">+ Platform Only+ </Badge>+ </a>+ </Link>+ )}+ </div></div></SettingsToggle></>)}/><hr />-<SettingsToggledata-testid="hashedLinkCheck"title={t("private_link")}diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsxindex 6a39a2db207..a876619bcfa 100644--- a/apps/web/pages/booking/[uid].tsx+++ b/apps/web/pages/booking/[uid].tsx@@ -174,7 +174,6 @@ const querySchema = z.object({export default function Success(props: SuccessProps) {const { t } = useLocale();const router = useRouter();-const {allRemainingBookings,isSuccessBookingPage,@@ -1051,6 +1050,15 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {customInputs: customInputSchema.array().parse(eventTypeRaw.customInputs),};+ if (eventType.metadata?.disableSuccessPage && eventType.successRedirectUrl) {+ return {+ redirect: {+ destination: eventType.successRedirectUrl,+ permanent: false,+ },+ };+ }+const profile = {name: eventType.team?.name || eventType.users[0]?.name || null,email: eventType.team ? null : eventType.users[0].email || null,diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex aa7185d81ad..734480e084d 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1482,6 +1482,7 @@"number_verified": "Number Verified","create_your_first_team_webhook_description": "Create your first webhook for this team event type","create_webhook_team_event_type": "Create a webhook for this team event type",+ "disable_success_page":"Disable Success Page (only works if you have a redirect URL)","invalid_admin_password": "You are set as an admin but you do not have a password length of at least 15 characters","change_password_admin": "Change Password to gain admin access"}diff --git a/packages/prisma/zod-utils.ts b/packages/prisma/zod-utils.tsindex b32708e1551..bc6c3141f48 100644--- a/packages/prisma/zod-utils.ts+++ b/packages/prisma/zod-utils.ts@@ -37,6 +37,7 @@ export const EventTypeMetaDataSchema = zgiphyThankYouPage: z.string().optional(),apps: z.object(appDataSchemas).partial().optional(),additionalNotesRequired: z.boolean().optional(),+ disableSuccessPage: z.boolean().optional(),requiresConfirmationThreshold: z.object({time: z.number(),diff --git a/packages/ui/components/form/checkbox/Checkbox.tsx b/packages/ui/components/form/checkbox/Checkbox.tsxindex 368331c9888..45647ada62b 100644--- a/packages/ui/components/form/checkbox/Checkbox.tsx+++ b/packages/ui/components/form/checkbox/Checkbox.tsx@@ -49,6 +49,7 @@ const CheckboxField = forwardRef<HTMLInputElement, Props>({...rest}ref={ref}type="checkbox"+ disabled={disabled}className={classNames("text-primary-600 focus:ring-primary-500 mr-2 h-4 w-4 rounded border-gray-300 ",!error && disabled@@ -59,7 +60,7 @@ const CheckboxField = forwardRef<HTMLInputElement, Props>()}/></div>- <span className="text-sm ltr:ml-3 rtl:mr-3">{description}</span>+ <span className="text-sm">{description}</span></>)}{/* {informationIconText && <InfoBadge content={informationIconText}></InfoBadge>} */}