fix: multiple duration getSchedule calls [CAL-2336] (#10709)
Co-authored-by: Omar López <[email protected]>
This commit is contained in:
1 parent
a6daf17909
commit
64e6e1a19a
6 files changed
+64
-9
No files matched your search
@@ -40,6 +40,7 @@ const BookerComponent = ({
|
||||
hideBranding = false,
|
||||
isTeamEvent,
|
||||
entity,
|
||||
duration,
|
||||
}: BookerProps) => {
|
||||
/**
|
||||
* Prioritize dateSchedule load
|
||||
@@ -50,7 +51,7 @@ const BookerComponent = ({
|
||||
username,
|
||||
eventSlug,
|
||||
month,
|
||||
duration: undefined,
|
||||
duration,
|
||||
});
|
||||
const isMobile = useMediaQuery("(max-width: 768px)");
|
||||
const isTablet = useMediaQuery("(max-width: 1024px)");
|
||||
|
||||
@@ -58,6 +58,12 @@ export interface BookerProps {
|
||||
* that will always result in the user event being returned.
|
||||
*/
|
||||
isTeamEvent?: boolean;
|
||||
/**
|
||||
* Refers to a multiple-duration event-type
|
||||
* It will correspond to selected time from duration query param if exists and if it is allowed as an option,
|
||||
* otherwise, the default value is selected
|
||||
*/
|
||||
duration?: number | null;
|
||||
}
|
||||
|
||||
export type BookerState = "loading" | "selecting_date" | "selecting_time" | "booking";
|
||||
|
||||
@@ -224,3 +224,13 @@ export const getBookingForSeatedEvent = async (uid: string) => {
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
export const getMultipleDurationValue = (
|
||||
multipleDurationConfig: number[] | undefined,
|
||||
queryDuration: string | string[] | undefined,
|
||||
defaultValue: number
|
||||
) => {
|
||||
if (!multipleDurationConfig) return null;
|
||||
if (multipleDurationConfig.includes(Number(queryDuration))) return Number(queryDuration);
|
||||
return defaultValue;
|
||||
};
|
||||
Reference in new issue
Block a user