fix: ensure isBookingDryRun prop works for booking creation (#22182)
* fix: ensure isBookingDryRun prop works for booking creation - Add isBookingDryRun prop to useHandleBookEvent hook - Pass prop through BookerPlatformWrapper and useBookings - Override _isDryRun flag when prop is provided - Fixes issue where dry run banner showed but booking creation ignored prop Co-Authored-By: [email protected] <[email protected]> * fixup * if dry run prop is pass we use that, otherwise we use params * add changesets for PR * replace minor with patch changeset --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Ryukemeister <[email protected]> Co-authored-by: Rajiv Sahal <[email protected]> Co-authored-by: Morgan <[email protected]>
This commit is contained in:
5 files changed
+23
-3
No files matched your search
@@ -53,6 +53,7 @@ export interface IUseBookings {
|
||||
bookingForm: UseBookingFormReturnType["bookingForm"];
|
||||
metadata: Record<string, string>;
|
||||
teamMemberEmail?: string | null;
|
||||
isBookingDryRun?: boolean;
|
||||
}
|
||||
|
||||
const getBookingSuccessfulEventPayload = (booking: {
|
||||
@@ -107,7 +108,14 @@ const storeInLocalStorage = ({
|
||||
localStorage.setItem(STORAGE_KEY, value);
|
||||
};
|
||||
|
||||
export const useBookings = ({ event, hashedLink, bookingForm, metadata, teamMemberEmail }: IUseBookings) => {
|
||||
export const useBookings = ({
|
||||
event,
|
||||
hashedLink,
|
||||
bookingForm,
|
||||
metadata,
|
||||
teamMemberEmail,
|
||||
isBookingDryRun,
|
||||
}: IUseBookings) => {
|
||||
const router = useRouter();
|
||||
const eventSlug = useBookerStore((state) => state.eventSlug);
|
||||
const eventTypeId = useBookerStore((state) => state.eventId);
|
||||
@@ -399,6 +407,7 @@ export const useBookings = ({ event, hashedLink, bookingForm, metadata, teamMemb
|
||||
handleInstantBooking: createInstantBookingMutation.mutate,
|
||||
handleRecBooking: createRecurringBookingMutation.mutate,
|
||||
handleBooking: createBookingMutation.mutate,
|
||||
isBookingDryRun,
|
||||
});
|
||||
|
||||
const errors = {
|
||||
|
||||
@@ -29,6 +29,7 @@ export type BookingOptions = {
|
||||
crmAppSlug?: string | null;
|
||||
orgSlug?: string;
|
||||
routingFormSearchParams?: RoutingFormSearchParams;
|
||||
isDryRunProp?: boolean;
|
||||
};
|
||||
|
||||
export const mapBookingToMutationInput = ({
|
||||
@@ -50,6 +51,7 @@ export const mapBookingToMutationInput = ({
|
||||
crmAppSlug,
|
||||
orgSlug,
|
||||
routingFormSearchParams,
|
||||
isDryRunProp,
|
||||
}: BookingOptions): BookingCreateBody => {
|
||||
const searchParams = new URLSearchParams(routingFormSearchParams ?? window.location.search);
|
||||
const routedTeamMemberIds = getRoutedTeamMemberIdsFromSearchParams(searchParams);
|
||||
@@ -57,7 +59,7 @@ export const mapBookingToMutationInput = ({
|
||||
const routingFormResponseId = routingFormResponseIdParam ? Number(routingFormResponseIdParam) : undefined;
|
||||
const skipContactOwner = searchParams.get("cal.skipContactOwner") === "true";
|
||||
const reroutingFormResponses = searchParams.get("cal.reroutingFormResponses");
|
||||
const _isDryRun = isBookingDryRun(searchParams);
|
||||
const _isDryRun = isDryRunProp !== undefined ? isDryRunProp : isBookingDryRun(searchParams);
|
||||
const _cacheParam = searchParams?.get("cal.cache");
|
||||
const _shouldServeCache = _cacheParam ? _cacheParam === "true" : undefined;
|
||||
const dub_id = searchParams?.get("dub_id");
|
||||
|
||||
Reference in new issue
Block a user