fix: Dynamic duration was always overwritten with the default (30) (#12444)

Co-authored-by: Omar López <[email protected]>
Co-authored-by: Morgan <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-12-11 16:07:21 -07:00
1 parent 098d41fc62
commit 565e21bc50
4 files changed
+53 -33

No files matched your search

+2 -1
View File
@@ -43,6 +43,7 @@ const BookerComponent = ({
hideBranding = false,
isTeamEvent,
entity,
durationConfig,
duration,
hashedLink,
}: BookerProps) => {
@@ -147,7 +148,7 @@ const BookerComponent = ({
layout: defaultLayout,
isTeamEvent,
org: entity.orgSlug,
durationConfig: event?.data?.metadata?.multipleDuration,
durationConfig,
});
useEffect(() => {
+6 -8
View File
@@ -256,14 +256,12 @@ export const useBookerStore = create<BookerStore>((set, get) => ({
(["week_view", "column_view"].includes(layout) ? dayjs().format("YYYY-MM-DD") : null),
});
if (eventId) {
if (durationConfig?.includes(Number(getQueryParam("duration")))) {
set({
selectedDuration: Number(getQueryParam("duration")),
});
} else {
removeQueryParam("duration");
}
if (durationConfig?.includes(Number(getQueryParam("duration")))) {
set({
selectedDuration: Number(getQueryParam("duration")),
});
} else {
removeQueryParam("duration");
}
// Unset selected timeslot if user is rescheduling. This could happen
@@ -64,6 +64,10 @@ export interface BookerProps {
* otherwise, the default value is selected
*/
duration?: number | null;
/**
* Configures the selectable options for a multiDuration event type.
*/
durationConfig?: number[];
/**
* Refers to the private link from event types page.
*/