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:
17 files changed
+159
-36
No files matched your search
@@ -168,6 +168,19 @@ async function getDynamicGroupPageProps(context: GetServerSidePropsContext) {
|
||||
} as const;
|
||||
}
|
||||
|
||||
// Redirect if no routing form response and redirect URL is configured
|
||||
// Don't redirect if this is a reschedule or seated booking flow
|
||||
const hasRoutingFormResponse =
|
||||
context.query["cal.routingFormResponseId"] || context.query["cal.queuedFormResponseId"];
|
||||
if (!hasRoutingFormResponse && !rescheduleUid && !bookingUid && "redirectUrlOnNoRoutingFormResponse" in eventData && eventData.redirectUrlOnNoRoutingFormResponse) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: eventData.redirectUrlOnNoRoutingFormResponse,
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const props: Props = {
|
||||
eventData: {
|
||||
...eventData,
|
||||
@@ -254,13 +267,26 @@ async function getUserPageProps(context: GetServerSidePropsContext) {
|
||||
session?.user?.id
|
||||
);
|
||||
|
||||
if (!eventData) {
|
||||
return {
|
||||
notFound: true,
|
||||
} as const;
|
||||
}
|
||||
if (!eventData) {
|
||||
return {
|
||||
notFound: true,
|
||||
} as const;
|
||||
}
|
||||
|
||||
const allowSEOIndexing = org
|
||||
// Redirect if no routing form response and redirect URL is configured
|
||||
// Don't redirect if this is a reschedule or seated booking flow
|
||||
const hasRoutingFormResponse =
|
||||
context.query["cal.routingFormResponseId"] || context.query["cal.queuedFormResponseId"];
|
||||
if (!hasRoutingFormResponse && !rescheduleUid && !bookingUid && "redirectUrlOnNoRoutingFormResponse" in eventData && eventData.redirectUrlOnNoRoutingFormResponse) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: eventData.redirectUrlOnNoRoutingFormResponse,
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const allowSEOIndexing= org
|
||||
? user?.profile?.organization?.organizationSettings?.allowSEOIndexing
|
||||
? user?.allowSEOIndexing
|
||||
: false
|
||||
|
||||
Reference in new issue
Block a user