fix: display all responses (#13999)

* fix: display all responses

* fix: type err

* chore: rename variable
This commit is contained in:
Udit Takkar authored and GitHub committed 2024-03-12 15:30:02 +00:00
1 parent 4585199b5e
commit 8402dfa3a2
5 files changed
+24 -4

No files matched your search

@@ -1,13 +1,20 @@
import type z from "zod";
import { TITLE_FIELD } from "@calcom/features/bookings/lib/SystemField";
import type { bookingResponse } from "@calcom/features/bookings/lib/getBookingResponsesSchema";
import type { CalendarEvent } from "@calcom/types/Calendar";
export default function getLabelValueMapFromResponses(calEvent: CalendarEvent) {
const { customInputs, userFieldsResponses } = calEvent;
const { customInputs, userFieldsResponses, responses, eventTypeId } = calEvent;
const isDynamicEvent = !eventTypeId;
let labelValueMap: Record<string, z.infer<typeof bookingResponse>> = {};
if (userFieldsResponses) {
if (!!responses?.[TITLE_FIELD] && !isDynamicEvent) {
userFieldsResponses[TITLE_FIELD] = responses[TITLE_FIELD];
}
for (const [, value] of Object.entries(userFieldsResponses)) {
if (!value.label) {
continue;