diff --git a/apps/web/server/lib/[user]/getServerSideProps.ts b/apps/web/server/lib/[user]/getServerSideProps.ts index 9b39ecdf69..4b1a8b8c5a 100644 --- a/apps/web/server/lib/[user]/getServerSideProps.ts +++ b/apps/web/server/lib/[user]/getServerSideProps.ts @@ -59,6 +59,7 @@ type UserPageProps = { | "length" | "hidden" | "lockTimeZoneToggleOnBookingPage" + | "lockedTimeZone" | "requiresConfirmation" | "canSendCalVideoTranscriptionEmails" | "requiresBookerEmailVerification" diff --git a/apps/web/test/lib/handleChildrenEventTypes.test.ts b/apps/web/test/lib/handleChildrenEventTypes.test.ts index 281a37d8db..82021c88ad 100644 --- a/apps/web/test/lib/handleChildrenEventTypes.test.ts +++ b/apps/web/test/lib/handleChildrenEventTypes.test.ts @@ -111,6 +111,7 @@ describe("handleChildrenEventTypes", () => { timeZone, requiresBookerEmailVerification, lockTimeZoneToggleOnBookingPage, + lockedTimeZone, useEventTypeDestinationCalendarEmail, secondaryEmailId, autoTranslateDescriptionEnabled, @@ -136,6 +137,7 @@ describe("handleChildrenEventTypes", () => { parentId: 1, users: { connect: [{ id: 4 }] }, lockTimeZoneToggleOnBookingPage: false, + lockedTimeZone: "Europe/London", requiresBookerEmailVerification: false, instantMeetingScheduleId: undefined, bookingLimits: undefined, @@ -168,6 +170,7 @@ describe("handleChildrenEventTypes", () => { scheduleId, requiresBookerEmailVerification, lockTimeZoneToggleOnBookingPage, + lockedTimeZone, useEventTypeDestinationCalendarEmail, secondaryEmailId, ...evType @@ -198,6 +201,7 @@ describe("handleChildrenEventTypes", () => { locations: [], scheduleId: null, lockTimeZoneToggleOnBookingPage: false, + lockedTimeZone: "Europe/London", requiresBookerEmailVerification: false, hashedLink: { deleteMany: {}, @@ -272,6 +276,7 @@ describe("handleChildrenEventTypes", () => { timeZone, requiresBookerEmailVerification, lockTimeZoneToggleOnBookingPage, + lockedTimeZone, useEventTypeDestinationCalendarEmail, secondaryEmailId, autoTranslateDescriptionEnabled, @@ -304,6 +309,7 @@ describe("handleChildrenEventTypes", () => { customReplyToEmail: null, instantMeetingScheduleId: undefined, lockTimeZoneToggleOnBookingPage: false, + lockedTimeZone: "Europe/London", requiresBookerEmailVerification: false, userId: 4, workflows: undefined, @@ -330,6 +336,7 @@ describe("handleChildrenEventTypes", () => { userId, requiresBookerEmailVerification, lockTimeZoneToggleOnBookingPage, + lockedTimeZone, useEventTypeDestinationCalendarEmail, secondaryEmailId, ...evType @@ -363,6 +370,7 @@ describe("handleChildrenEventTypes", () => { deleteMany: {}, }, lockTimeZoneToggleOnBookingPage: false, + lockedTimeZone: "Europe/London", requiresBookerEmailVerification: false, instantMeetingScheduleId: undefined, }, @@ -393,6 +401,7 @@ describe("handleChildrenEventTypes", () => { // eslint-disable-next-line @typescript-eslint/no-unused-vars requiresBookerEmailVerification, lockTimeZoneToggleOnBookingPage, + lockedTimeZone, useEventTypeDestinationCalendarEmail, secondaryEmailId, autoTranslateDescriptionEnabled, @@ -418,6 +427,7 @@ describe("handleChildrenEventTypes", () => { schedulingType: SchedulingType.MANAGED, requiresBookerEmailVerification: false, lockTimeZoneToggleOnBookingPage: false, + lockedTimeZone: "Europe/London", useEventTypeDestinationCalendarEmail: false, workflows: [], parentId: 1, @@ -452,6 +462,7 @@ describe("handleChildrenEventTypes", () => { instantMeetingScheduleId: undefined, locations: [], lockTimeZoneToggleOnBookingPage: false, + lockedTimeZone: "Europe/London", requiresBookerEmailVerification: false, parentId: 1, userId: 5, @@ -478,6 +489,7 @@ describe("handleChildrenEventTypes", () => { customReplyToEmail: null, rrSegmentQueryValue: undefined, lockTimeZoneToggleOnBookingPage: false, + lockedTimeZone: "Europe/London", requiresBookerEmailVerification: false, hashedLink: { deleteMany: {}, diff --git a/docs/platform/guides/teams-setup.mdx b/docs/platform/guides/teams-setup.mdx index 877396dcd7..2fb88f6836 100644 --- a/docs/platform/guides/teams-setup.mdx +++ b/docs/platform/guides/teams-setup.mdx @@ -245,4 +245,4 @@ export default function TeamEvent(){ - \ No newline at end of file + diff --git a/packages/features/bookings/Booker/components/EventMeta.tsx b/packages/features/bookings/Booker/components/EventMeta.tsx index c4e2c4d9dd..31e7e82d7f 100644 --- a/packages/features/bookings/Booker/components/EventMeta.tsx +++ b/packages/features/bookings/Booker/components/EventMeta.tsx @@ -13,7 +13,6 @@ import { useTimePreferences } from "@calcom/features/bookings/lib"; import type { BookerEvent } from "@calcom/features/bookings/types"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { markdownToSafeHTMLClient } from "@calcom/lib/markdownToSafeHTMLClient"; -import { CURRENT_TIMEZONE } from "@calcom/lib/timezoneConstants"; import type { EventTypeTranslation } from "@calcom/prisma/client"; import { EventTypeAutoTranslatedField } from "@calcom/prisma/enums"; @@ -57,6 +56,7 @@ export const EventMeta = ({ event?: Pick< BookerEvent, | "lockTimeZoneToggleOnBookingPage" + | "lockedTimeZone" | "schedule" | "seatsPerTimeSlot" | "subsetOfUsers" @@ -109,9 +109,9 @@ export const EventMeta = ({ ); useEffect(() => { - //In case the event has lockTimeZone enabled ,set the timezone to event's attached availability timezone - if (event && event?.lockTimeZoneToggleOnBookingPage && event?.schedule?.timeZone) { - setTimezone(event.schedule?.timeZone); + //In case the event has lockTimeZone enabled ,set the timezone to event's locked timezone + if (event && event?.lockTimeZoneToggleOnBookingPage && event?.lockedTimeZone) { + setTimezone(event?.lockedTimeZone); } }, [event, setTimezone]); @@ -225,7 +225,7 @@ export const EventMeta = ({ indicatorsContainer: () => "ml-auto", container: () => "max-w-full", }} - value={event.lockTimeZoneToggleOnBookingPage ? CURRENT_TIMEZONE : timezone} + value={event.lockTimeZoneToggleOnBookingPage ? event.lockedTimeZone : timezone} onChange={({ value }) => { setTimezone(value); setBookerStoreTimezone(value); diff --git a/packages/features/bookings/lib/handleNewBooking/getEventTypesFromDB.ts b/packages/features/bookings/lib/handleNewBooking/getEventTypesFromDB.ts index 277fc2451f..4f33094694 100644 --- a/packages/features/bookings/lib/handleNewBooking/getEventTypesFromDB.ts +++ b/packages/features/bookings/lib/handleNewBooking/getEventTypesFromDB.ts @@ -58,6 +58,7 @@ export const getEventTypesFromDB = async (eventTypeId: number) => { periodDays: true, periodCountCalendarDays: true, lockTimeZoneToggleOnBookingPage: true, + lockedTimeZone: true, requiresConfirmation: true, requiresConfirmationForFreeEmail: true, requiresBookerEmailVerification: true, diff --git a/packages/features/bookings/types.ts b/packages/features/bookings/types.ts index 464b454582..2490b6c8f9 100644 --- a/packages/features/bookings/types.ts +++ b/packages/features/bookings/types.ts @@ -46,6 +46,7 @@ export type BookerEvent = Pick< | "price" | "currency" | "lockTimeZoneToggleOnBookingPage" + | "lockedTimeZone" | "schedule" | "seatsPerTimeSlot" | "title" diff --git a/packages/features/eventtypes/components/tabs/advanced/EventAdvancedTab.tsx b/packages/features/eventtypes/components/tabs/advanced/EventAdvancedTab.tsx index be706ca4a0..86dd902570 100644 --- a/packages/features/eventtypes/components/tabs/advanced/EventAdvancedTab.tsx +++ b/packages/features/eventtypes/components/tabs/advanced/EventAdvancedTab.tsx @@ -12,6 +12,7 @@ import { } from "@calcom/atoms/selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper"; import getLocationsOptionsForSelect from "@calcom/features/bookings/lib/getLocationOptionsForSelect"; import DestinationCalendarSelector from "@calcom/features/calendars/DestinationCalendarSelector"; +import { TimezoneSelect } from "@calcom/features/components/timezone-select"; import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager"; import { allowDisablingAttendeeConfirmationEmails, @@ -1002,7 +1003,8 @@ export const EventAdvancedTab = ({ toggleSwitchAtTheEnd={true} switchContainerClassName={classNames( "border-subtle rounded-lg border py-6 px-4 sm:px-6", - customClassNames?.timezoneLock?.container + customClassNames?.timezoneLock?.container, + formMethods.getValues("lockTimeZoneToggleOnBookingPage") && "rounded-b-none" )} title={t("lock_timezone_toggle_on_booking_page")} {...lockTimeZoneToggleOnBookingPageLocked} @@ -1010,7 +1012,31 @@ export const EventAdvancedTab = ({ checked={value} onCheckedChange={(e) => onChange(e)} data-testid="lock-timezone-toggle" - /> + childrenClassName="lg:ml-0"> +