Scheduling infrastructure for absolutely everyone.
fix: pass from org link to all instances of event.public (#17136)
sean-brydone949a4c529dc
diff --git a/packages/features/bookings/Booker/types.ts b/packages/features/bookings/Booker/types.tsindex e34f7da5585..c10dd25c722 100644--- a/packages/features/bookings/Booker/types.ts+++ b/packages/features/bookings/Booker/types.ts@@ -25,6 +25,7 @@ export interface BookerProps {* Whether is a team or org, we gather basic info from both*/entity: {+ fromRedirectOfNonOrgLink?: boolean;considerUnpublished: boolean;isUnpublished?: boolean;orgSlug?: string | null;diff --git a/packages/features/bookings/Booker/utils/event.ts b/packages/features/bookings/Booker/utils/event.tsindex 16b483e157a..91fd8c1f216 100644--- a/packages/features/bookings/Booker/utils/event.ts+++ b/packages/features/bookings/Booker/utils/event.ts@@ -19,10 +19,11 @@ export type useScheduleForEventReturnType = ReturnType<typeof useScheduleForEven* Using this hook means you only need to use one hook, instead* of combining multiple conditional hooks.*/-export const useEvent = () => {- const [username, eventSlug] = useBookerStore((state) => [state.username, state.eventSlug], shallow);- const isTeamEvent = useBookerStore((state) => state.isTeamEvent);- const org = useBookerStore((state) => state.org);+export const useEvent = (props?: { fromRedirectOfNonOrgLink?: boolean }) => {+ const [username, eventSlug, isTeamEvent, org] = useBookerStore(+ (state) => [state.username, state.eventSlug, state.isTeamEvent, state.org],+ shallow+ );const event = trpc.viewer.public.event.useQuery({@@ -30,8 +31,12 @@ export const useEvent = () => {eventSlug: eventSlug ?? "",isTeamEvent,org: org ?? null,+ fromRedirectOfNonOrgLink: props?.fromRedirectOfNonOrgLink,},- { refetchOnWindowFocus: false, enabled: Boolean(username) && Boolean(eventSlug) }+ {+ refetchOnWindowFocus: false,+ enabled: Boolean(username) && Boolean(eventSlug),+ });return {@@ -66,6 +71,7 @@ export const useScheduleForEvent = ({selectedDate,orgSlug,teamMemberEmail,+ fromRedirectOfNonOrgLink,}: {prefetchNextMonth?: boolean;username?: string | null;@@ -78,9 +84,10 @@ export const useScheduleForEvent = ({selectedDate?: string | null;orgSlug?: string;teamMemberEmail?: string | null;+ fromRedirectOfNonOrgLink?: boolean;} = {}) => {const { timezone } = useTimePreferences();- const event = useEvent();+ const event = useEvent({ fromRedirectOfNonOrgLink });const [usernameFromStore, eventSlugFromStore, monthFromStore, durationFromStore] = useBookerStore((state) => [state.username, state.eventSlug, state.month, state.selectedDuration],shallowdiff --git a/packages/platform/atoms/booker/BookerWebWrapper.tsx b/packages/platform/atoms/booker/BookerWebWrapper.tsxindex e5948c2ff93..784e42dbb86 100644--- a/packages/platform/atoms/booker/BookerWebWrapper.tsx+++ b/packages/platform/atoms/booker/BookerWebWrapper.tsx@@ -30,7 +30,7 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {const router = useRouter();const pathname = usePathname();const searchParams = useSearchParams();- const event = useEvent();+ const event = useEvent({ fromRedirectOfNonOrgLink: props.entity.fromRedirectOfNonOrgLink });const bookerLayout = useBookerLayout(event.data);const selectedDate = searchParams?.get("date");@@ -131,6 +131,7 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {duration: props.duration,selectedDate,teamMemberEmail: props.teamMemberEmail,+ fromRedirectOfNonOrgLink: props.entity.fromRedirectOfNonOrgLink,});const bookings = useBookings({event,