Feature/ Manage Booking Questions (#6560)
* WIP * Create Booking Questions builder * Renaming things * wip * wip * Implement Add Guests and other fixes * Fixes after testing * Fix wrong status code 404 * Fixes * Lint fixes * Self review comments addressed * More self review comments addressed * Feedback from zomars * BugFixes after testing * More fixes discovered during review * Update packages/lib/hooks/useHasPaidPlan.ts Co-authored-by: Omar López <[email protected]> * More fixes discovered during review * Update packages/ui/components/form/inputs/Input.tsx Co-authored-by: Omar López <[email protected]> * More fixes discovered during review * Update packages/features/bookings/lib/getBookingFields.ts Co-authored-by: sean-brydon <[email protected]> * More PR review fixes * Hide label using labelSrOnly * Fix Carinas feedback and implement 2 workflows thingy * Misc fixes * Fixes from Loom comments and PR * Fix a lint errr * Fix cancellation reason * Fix regression in edit due to name conflict check * Update packages/features/form-builder/FormBuilder.tsx Co-authored-by: Carina Wollendorfer <[email protected]> * Fix options not set when default value is used * Restoring reqBody to avoid uneeded conflicts with main * Type fix * Update apps/web/components/booking/pages/BookingPage.tsx Co-authored-by: Omar López <[email protected]> * Update packages/features/form-builder/FormBuilder.tsx Co-authored-by: Omar López <[email protected]> * Update apps/web/components/booking/pages/BookingPage.tsx Co-authored-by: Omar López <[email protected]> * Apply suggestions from code review Co-authored-by: Omar López <[email protected]> * Show fields but mark them disabled * Apply suggestions from code review Co-authored-by: Omar López <[email protected]> * More comments * Fix booking success page crash when a booking doesnt have newly added required fields response * Dark theme asterisk not visible * Make location required in zodSchema as was there in production * Linting * Remove _metadata.ts files for apps that have config.json * Revert "Remove _metadata.ts files for apps that have config.json" This reverts commit d79bdd336cf312a30a8943af94c059947bd91ccd. * Fix lint error * Fix missing condition for samlSPConfig * Delete unexpectedly added file * yarn.lock change not required * fix types * Make checkboxes rounded * Fix defaultLabel being stored as label due to SSR rendering * Shaved 16kb from booking page * Explicit types for profile * Show payment value only if price is greater than 0 * Fix type error * Add back inferred types as they are failing * Fix duplicate label on number --------- Co-authored-by: zomars <[email protected]> Co-authored-by: sean-brydon <[email protected]> Co-authored-by: Carina Wollendorfer <[email protected]> Co-authored-by: Efraín Rochín <[email protected]>
This commit is contained in:
58 files changed
+2921
-1463
No files matched your search
@@ -71,23 +71,24 @@ ${calEvent.additionalNotes}
|
||||
`;
|
||||
};
|
||||
|
||||
export const getCustomInputs = (calEvent: CalendarEvent) => {
|
||||
if (!calEvent.customInputs) {
|
||||
export const getUserFieldsResponses = (calEvent: CalendarEvent) => {
|
||||
const responses = calEvent.userFieldsResponses || calEvent.customInputs;
|
||||
if (!responses) {
|
||||
return "";
|
||||
}
|
||||
const customInputsString = Object.keys(calEvent.customInputs)
|
||||
const responsesString = Object.keys(responses)
|
||||
.map((key) => {
|
||||
if (!calEvent.customInputs) return "";
|
||||
if (calEvent.customInputs[key] !== "") {
|
||||
if (!responses) return "";
|
||||
if (responses[key] !== "") {
|
||||
return `
|
||||
${key}:
|
||||
${calEvent.customInputs[key]}
|
||||
${responses[key]}
|
||||
`;
|
||||
}
|
||||
})
|
||||
.join("");
|
||||
|
||||
return customInputsString;
|
||||
return responsesString;
|
||||
};
|
||||
|
||||
export const getAppsStatus = (calEvent: CalendarEvent) => {
|
||||
@@ -171,7 +172,7 @@ ${calEvent.organizer.language.translate("where")}:
|
||||
${getLocation(calEvent)}
|
||||
${getDescription(calEvent)}
|
||||
${getAdditionalNotes(calEvent)}
|
||||
${getCustomInputs(calEvent)}
|
||||
${getUserFieldsResponses(calEvent)}
|
||||
${getAppsStatus(calEvent)}
|
||||
${
|
||||
// TODO: Only the original attendee can make changes to the event
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Prisma } from "@prisma/client";
|
||||
import { PeriodType, SchedulingType } from "@prisma/client";
|
||||
|
||||
import { DailyLocationType } from "@calcom/app-store/locations";
|
||||
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
|
||||
import type { userSelect } from "@calcom/prisma/selects";
|
||||
import type { CustomInputSchema } from "@calcom/prisma/zod-utils";
|
||||
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||
@@ -89,6 +90,14 @@ const commons = {
|
||||
users: [user],
|
||||
hosts: [],
|
||||
metadata: EventTypeMetaDataSchema.parse({}),
|
||||
bookingFields: getBookingFieldsWithSystemFields({
|
||||
bookingFields: [],
|
||||
customInputs: [],
|
||||
// Default value of disableGuests from DB.
|
||||
disableGuests: false,
|
||||
metadata: {},
|
||||
workflows: [],
|
||||
}),
|
||||
};
|
||||
|
||||
const min15Event = {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Prisma } from "@prisma/client";
|
||||
import type { StripeData } from "@calcom/app-store/stripepayment/lib/server";
|
||||
import { getEventTypeAppData, getLocationGroupedOptions } from "@calcom/app-store/utils";
|
||||
import type { LocationObject } from "@calcom/core/location";
|
||||
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
|
||||
import { parseBookingLimit, parseRecurringEvent } from "@calcom/lib";
|
||||
import getEnabledApps from "@calcom/lib/apps/getEnabledApps";
|
||||
import { CAL_URL } from "@calcom/lib/constants";
|
||||
@@ -100,6 +101,7 @@ export default async function getEventTypeById({
|
||||
bookingLimits: true,
|
||||
successRedirectUrl: true,
|
||||
currency: true,
|
||||
bookingFields: true,
|
||||
team: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -182,7 +184,7 @@ export default async function getEventTypeById({
|
||||
if (isTrpcCall) {
|
||||
throw new TRPCError({ code: "NOT_FOUND" });
|
||||
} else {
|
||||
throw new Error("Event type noy found");
|
||||
throw new Error("Event type not found");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,6 +267,7 @@ export default async function getEventTypeById({
|
||||
const eventTypeObject = Object.assign({}, eventType, {
|
||||
periodStartDate: eventType.periodStartDate?.toString() ?? null,
|
||||
periodEndDate: eventType.periodEndDate?.toString() ?? null,
|
||||
bookingFields: getBookingFieldsWithSystemFields(eventType),
|
||||
});
|
||||
|
||||
const teamMembers = eventTypeObject.team
|
||||
|
||||
@@ -56,6 +56,7 @@ export const buildBooking = (booking?: Partial<Booking>): Booking => {
|
||||
smsReminderNumber: null,
|
||||
scheduledJobs: [],
|
||||
metadata: null,
|
||||
responses: null,
|
||||
...booking,
|
||||
};
|
||||
};
|
||||
@@ -96,6 +97,7 @@ export const buildEventType = (eventType?: Partial<EventType>): EventType => {
|
||||
slotInterval: null,
|
||||
metadata: null,
|
||||
successRedirectUrl: null,
|
||||
bookingFields: null,
|
||||
...eventType,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user