feat: Ability to Hyperlink text in Checkbox on Additional Questions (#15194)

* feat: Ability to Hyperlink text in Checkbox on Additional Questions

* update

* fix and update

* fix type error

* fix and update

* dpdate

* fix type error

* fix unit test

* Update

* fix tests

* revert test

* remove yarn.lock

* remove schema.prisma

* update

* remove log

* revert

---------

Co-authored-by: Keith Williams <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Amit Sharma <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-09-05 09:05:45 +00:00
1 parent 633697a812
commit fabcf2055b
9 files changed
+118 -38

No files matched your search

@@ -6,6 +6,7 @@ import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import getBookingInfo from "@calcom/features/bookings/lib/getBookingInfo";
import { parseRecurringEvent } from "@calcom/lib";
import { getDefaultEvent } from "@calcom/lib/defaultEvents";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import { maybeGetBookingUidFromSeat } from "@calcom/lib/server/maybeGetBookingUidFromSeat";
import { BookingRepository } from "@calcom/lib/server/repository/booking";
import prisma from "@calcom/prisma";
@@ -120,6 +121,13 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
metadata: EventTypeMetaDataSchema.parse(eventTypeRaw.metadata),
recurringEvent: parseRecurringEvent(eventTypeRaw.recurringEvent),
customInputs: customInputSchema.array().parse(eventTypeRaw.customInputs),
bookingFields: eventTypeRaw.bookingFields.map((field) => {
return {
...field,
label: markdownToSafeHTML(field.label || ""),
defaultLabel: markdownToSafeHTML(field.defaultLabel || ""),
};
}),
};
const profile = {
@@ -643,11 +643,16 @@ export default function Success(props: PageProps) {
)
return null;
const label = field.label || t(field.defaultLabel || "");
const label = field.label || t(field.defaultLabel);
return (
<>
<div className="text-emphasis mt-4 font-medium">{label}</div>
<div
className="text-emphasis mt-4 font-medium"
dangerouslySetInnerHTML={{
__html: label,
}}
/>
<p
className="text-default break-words"
data-testid="field-response"
@@ -4,6 +4,7 @@ import type { createUsersFixture } from "playwright/fixtures/users";
import { uuid } from "short-uuid";
import { fieldTypesConfigMap } from "@calcom/features/form-builder/fieldTypes";
import { md } from "@calcom/lib/markdownIt";
import prisma from "@calcom/prisma";
import { WebhookTriggerEvents } from "@calcom/prisma/enums";
import type { CalendarEvent } from "@calcom/types/Calendar";
@@ -549,7 +550,12 @@ async function addQuestionAndSave({
}
if (question.label !== undefined) {
await page.fill('[name="label"]', question.label);
if (question.type === "Checkbox") {
const editorInput = page.locator('[data-testid="editor-input"]');
await editorInput.fill(md.render(question.label));
} else {
await page.fill('[name="label"]', question.label);
}
}
if (question.placeholder !== undefined) {