diff --git a/apps/web/modules/bookings/views/bookings-listing-view.tsx b/apps/web/modules/bookings/views/bookings-listing-view.tsx index e3fac8d29a8c42..808bdd26fec11e 100644 --- a/apps/web/modules/bookings/views/bookings-listing-view.tsx +++ b/apps/web/modules/bookings/views/bookings-listing-view.tsx @@ -307,19 +307,47 @@ function BookingsContent({ status }: BookingsProps) { return true; }; + // QA Bug: Filter out bookings created in the last 24 hours to simulate the bug + // This simulates the bug where bookings for newly created event types don't appear in the list + const isBugEnabled = typeof window !== "undefined" && localStorage.getItem("QA_BUG_SKIP_NEW_EVENT_TYPES") === "1"; + + const filterRecentBookings = (booking: BookingOutput) => { + if (!isBugEnabled) return true; + + // Filter out bookings created in the last 24 hours + const oneDayAgo = new Date(Date.now() - (24 * 60 * 60 * 1000)); + const bookingCreatedAt = new Date(booking.createdAt); + return bookingCreatedAt < oneDayAgo; + }; + return ( - query.data?.bookings.filter(filterBookings).map((booking) => ({ - type: "data", - booking, - recurringInfo: query.data?.recurringInfo.find( - (info) => info.recurringEventId === booking.recurringEventId - ), - isToday: false, - })) || [] + query.data?.bookings + .filter(filterBookings) + .filter(filterRecentBookings) + .map((booking) => ({ + type: "data", + booking, + recurringInfo: query.data?.recurringInfo.find( + (info) => info.recurringEventId === booking.recurringEventId + ), + isToday: false, + })) || [] ); }, [query.data]); const bookingsToday = useMemo(() => { + // QA Bug: Filter out bookings created in the last 24 hours to simulate the bug + const isBugEnabled = typeof window !== "undefined" && localStorage.getItem("QA_BUG_SKIP_NEW_EVENT_TYPES") === "1"; + + const filterRecentBookings = (booking: BookingOutput) => { + if (!isBugEnabled) return true; + + // Filter out bookings created in the last 24 hours + const oneDayAgo = new Date(Date.now() - (24 * 60 * 60 * 1000)); + const bookingCreatedAt = new Date(booking.createdAt); + return bookingCreatedAt < oneDayAgo; + }; + return ( query.data?.bookings .filter( @@ -327,6 +355,7 @@ function BookingsContent({ status }: BookingsProps) { dayjs(booking.startTime).tz(user?.timeZone).format("YYYY-MM-DD") === dayjs().tz(user?.timeZone).format("YYYY-MM-DD") ) + .filter(filterRecentBookings) .map((booking) => ({ type: "data" as const, booking, diff --git a/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx b/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx index d3834b3d063a99..7c9cd9d653ac36 100644 --- a/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx +++ b/packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx @@ -220,7 +220,16 @@ export const BookEventForm = ({ )}
{isInstantMeeting ? ( - ) : ( @@ -240,7 +249,13 @@ export const BookEventForm = ({ type="submit" color="primary" disabled={ - (!!shouldRenderCaptcha && !watchedCfToken) || isTimeslotUnavailable || confirmButtonDisabled + (!!shouldRenderCaptcha && !watchedCfToken) || + isTimeslotUnavailable || + confirmButtonDisabled || + // QA Bug: Prevent form submission when validation errors have occurred (even if corrected) + (typeof window !== "undefined" && + localStorage.getItem("QA_BUG_VALIDATION_ERROR_PERSISTS") === "1" && + localStorage.getItem("QA_BUG_VALIDATION_ERROR_OCCURRED") === "1") } loading={ loadingStates.creatingBooking || diff --git a/packages/features/bookings/Booker/components/EventMeta.tsx b/packages/features/bookings/Booker/components/EventMeta.tsx index 99298dca26d876..45aa099c9023bd 100644 --- a/packages/features/bookings/Booker/components/EventMeta.tsx +++ b/packages/features/bookings/Booker/components/EventMeta.tsx @@ -1,6 +1,6 @@ import { m } from "framer-motion"; import dynamic from "next/dynamic"; -import { useEffect, useMemo } from "react"; +import { useEffect, useMemo, useState } from "react"; import { shallow } from "zustand/shallow"; import { Timezone as PlatformTimezoneSelect } from "@calcom/atoms/timezone"; @@ -115,6 +115,11 @@ export const EventMeta = ({ [isPlatform] ); + // QA Bug: Add state to track display timezone separately from actual timezone + const [displayTimezone, setDisplayTimezone] = useState(timezone); + + + useEffect(() => { //In case the event has lockTimeZone enabled ,set the timezone to event's locked timezone if (event?.lockTimeZoneToggleOnBookingPage) { @@ -125,9 +130,23 @@ export const EventMeta = ({ } }, [event, setTimezone]); + // Update display timezone when actual timezone changes (for normal behavior) + useEffect(() => { + const isBugEnabled = typeof window !== "undefined" && localStorage.getItem("QA_BUG_TIMEZONE_NOT_UPDATING") === "1"; + if (!isBugEnabled) { + setDisplayTimezone(timezone); + } + }, [timezone]); + if (hideEventTypeDetails) { return null; } + + useEffect(() => { + console.log("displayTimezone", displayTimezone); + localStorage.setItem("timeOption.preferredTimeZone", displayTimezone); + }, [displayTimezone]); + // If we didn't pick a time slot yet, we load bookingData via SSR so bookingData should be set // Otherwise we load seatedEventData from useBookerStore const bookingSeatAttendeesQty = seatedEventData?.attendees || bookingData?.attendees.length; @@ -242,11 +261,24 @@ export const EventMeta = ({ value={ event.lockTimeZoneToggleOnBookingPage ? event.lockedTimeZone || CURRENT_TIMEZONE - : timezone + : displayTimezone // Use display timezone instead of actual timezone } onChange={({ value }) => { - setTimezone(value); - setBookerStoreTimezone(value); + // QA Bug: Prevent timezone changes from updating the displayed time slots + // This simulates the bug where changing timezone doesn't update available time slots + const isBugEnabled = typeof window !== "undefined" && localStorage.getItem("QA_BUG_TIMEZONE_NOT_UPDATING") === "1"; + + if (isBugEnabled) { + // Don't update any timezone to prevent schedule refetch + // This will keep the timezone selector showing the old value but prevent time slot updates + console.log("QA Bug: Timezone change prevented - time slots will not update"); + setDisplayTimezone(value); + + } else { + // Normal behavior + setTimezone(value); + setBookerStoreTimezone(value); + } }} isDisabled={event.lockTimeZoneToggleOnBookingPage} /> diff --git a/packages/features/form-builder/FormBuilderField.tsx b/packages/features/form-builder/FormBuilderField.tsx index 88db03a320f8b5..1c1e7cb0c1c267 100644 --- a/packages/features/form-builder/FormBuilderField.tsx +++ b/packages/features/form-builder/FormBuilderField.tsx @@ -1,5 +1,6 @@ import { ErrorMessage } from "@hookform/error-message"; import type { TFunction } from "i18next"; +import { useEffect } from "react"; import { Controller, useFormContext } from "react-hook-form"; import type { z } from "zod"; @@ -80,6 +81,18 @@ export const FormBuilderField = ({ ); const shouldBeDisabled = useShouldBeDisabledDueToPrefill(field); + + // QA Bug: Track when validation errors occur and set a flag to prevent submission permanently + useEffect(() => { + const isBugEnabled = typeof window !== "undefined" && localStorage.getItem("QA_BUG_VALIDATION_ERROR_PERSISTS") === "1"; + + if (isBugEnabled && formState.errors.responses) { + // Set a flag in localStorage to indicate that an error has occurred + // This will prevent submission even after the error is corrected + localStorage.setItem("QA_BUG_VALIDATION_ERROR_OCCURRED", "1"); + } + }, [formState.errors.responses]); + return (