feat: add redirect option for non-routed visits to event types (#27468)

* feat: add redirect option for non-routing form bookings

Add a new event type option that redirects to a custom URL when the booking
was not made through a routing form (no cal.routingFormResponseId or
cal.queuedFormResponseId query parameters).

Changes:
- Add redirectUrlOnNoRoutingFormResponse field to EventType schema
- Add UI toggle in Advanced tab to configure the redirect URL
- Implement redirect logic in bookingSuccessRedirect hook
- Add translations for new UI strings

Co-Authored-By: [email protected] <[email protected]>

* fix: add redirectUrlOnNoRoutingFormResponse to test builder

Co-Authored-By: [email protected] <[email protected]>

* fix: add redirectUrlOnNoRoutingFormResponse to BookerEvent type

Co-Authored-By: [email protected] <[email protected]>

* fix: add redirectUrlOnNoRoutingFormResponse to getPublicEventSelect

Co-Authored-By: [email protected] <[email protected]>

* fix: add redirect logic to getServerSideProps for non-routing form bookings

Co-Authored-By: [email protected] <[email protected]>

* fix: remove redirectUrlOnNoRoutingFormResponse from booking success flow

Co-Authored-By: [email protected] <[email protected]>

* fix: use 'in' operator for type narrowing on redirectUrlOnNoRoutingFormResponse

Co-Authored-By: [email protected] <[email protected]>

* fix: exclude redirectUrlOnNoRoutingFormResponse from test assertions

Co-Authored-By: [email protected] <[email protected]>

* fix: include redirectUrlOnNoRoutingFormResponse in test assertions and update description

Co-Authored-By: [email protected] <[email protected]>

* fix: add redirectUrlOnNoRoutingFormResponse to mockUpdatedEventType

Co-Authored-By: [email protected] <[email protected]>

* fix: remove redirect logic from instant meetings

Co-Authored-By: [email protected] <[email protected]>

* fix: add redirectUrlOnNoRoutingFormResponse to EventTypeRepository select

Co-Authored-By: [email protected] <[email protected]>

* fix: add redirectUrlOnNoRoutingFormResponse to form default values

Co-Authored-By: [email protected] <[email protected]>

* Reword string

* fix: bust tRPC cache for redirectUrlOnNoRoutingFormResponse

Co-Authored-By: [email protected] <[email protected]>

* fix: guard redirect when rescheduleUid or bookingUid is present

Co-Authored-By: [email protected] <[email protected]>

* fix: add redirectUrlOnNoRoutingFormResponse to dynamicEvent defaults

Co-Authored-By: [email protected] <[email protected]>

* fix: add bookingUid guard to team getServerSideProps redirect

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-02-02 15:48:23 -03:00
1 parent 7062887632
commit c0f6a1b088
17 files changed
+159 -36

No files matched your search

@@ -445,6 +445,9 @@ export const EventAdvancedTab = ({
setInterfaceLanguageVisible(watchedInterfaceLanguage !== null && watchedInterfaceLanguage !== undefined);
}, [watchedInterfaceLanguage]);
const [redirectUrlVisible, setRedirectUrlVisible] = useState(!!formMethods.getValues("successRedirectUrl"));
const [noRoutingFormRedirectUrlVisible, setNoRoutingFormRedirectUrlVisible] = useState(
!!formMethods.getValues("redirectUrlOnNoRoutingFormResponse")
);
const bookingFields: Prisma.JsonObject = {};
const workflows = eventType.workflows.map((workflowOnEventType) => workflowOnEventType.workflow);
@@ -949,6 +952,51 @@ export const EventAdvancedTab = ({
</>
)}
/>
<Controller
name="redirectUrlOnNoRoutingFormResponse"
render={({ field: { value, onChange } }) => (
<>
<SettingsToggle
labelClassName={classNames("text-sm", customClassNames?.bookingRedirect?.label)}
toggleSwitchAtTheEnd={true}
switchContainerClassName={classNames(
"border-subtle rounded-lg border py-6 px-4 sm:px-6",
noRoutingFormRedirectUrlVisible && "rounded-b-none",
customClassNames?.bookingRedirect?.container
)}
childrenClassName={classNames("lg:ml-0", customClassNames?.bookingRedirect?.children)}
descriptionClassName={customClassNames?.bookingRedirect?.description}
title={t("redirect_on_no_routing_form")}
data-testid="redirect-on-no-routing-form"
{...successRedirectUrlLocked}
description={t("redirect_on_no_routing_form_description")}
checked={noRoutingFormRedirectUrlVisible}
onCheckedChange={(e) => {
setNoRoutingFormRedirectUrlVisible(e);
onChange(e ? value : "");
}}>
<div
className={classNames(
"border-subtle rounded-b-lg border border-t-0 p-6",
customClassNames?.bookingRedirect?.redirectUrlInput?.container
)}>
<TextField
className={classNames("w-full", customClassNames?.bookingRedirect?.redirectUrlInput?.input)}
label={t("redirect_on_no_routing_form")}
labelClassName={customClassNames?.bookingRedirect?.redirectUrlInput?.label}
labelSrOnly
disabled={successRedirectUrlLocked.disabled}
placeholder={t("external_redirect_url")}
data-testid="no-routing-form-redirect-url"
required={noRoutingFormRedirectUrlVisible}
type="text"
{...formMethods.register("redirectUrlOnNoRoutingFormResponse")}
/>
</div>
</SettingsToggle>
</>
)}
/>
{!isPlatform && (
<Controller
name="multiplePrivateLinks"