fix: Booker atom default booking fields (#18275)

* refactor: rename transformBookingFieldsApiToInternal to transformBookingFieldsApiRequestToInternal

* refactor: default booking fields can required or not required

* fix: render system fields in booker

* fix: hidden property of booking fields

* fix: default field labels and placeholders

* chore: bump platform libraries

* fix: tests

* fix: e2e tests
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2024-12-19 16:30:14 +00:00
1 parent 0b2f09ab7d
commit f0d7a757d4
16 files changed
+6944 -215

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@
"@axiomhq/winston": "^1.2.0",
"@calcom/platform-constants": "*",
"@calcom/platform-enums": "*",
"@calcom/platform-libraries": "npm:@calcom/[email protected]3",
"@calcom/platform-libraries": "npm:@calcom/[email protected]7",
"@calcom/platform-libraries-0.0.2": "npm:@calcom/[email protected]",
"@calcom/platform-types": "*",
"@calcom/platform-utils": "*",
@@ -291,6 +291,7 @@ describe("Event types Endpoints", () => {
placeholder: "select language",
options: ["javascript", "python", "cobol"],
disableOnPrefill: true,
hidden: false,
},
],
scheduleId: firstSchedule.id,
@@ -381,10 +382,24 @@ describe("Event types Endpoints", () => {
const requestBookingFields = body.bookingFields || [];
const expectedBookingFields = [
{ isDefault: true, required: true, slug: "name", ...nameBookingField },
{ isDefault: true, required: true, slug: "email", type: "email" },
{ isDefault: true, required: true, slug: "email", type: "email", disableOnPrefill: false },
// note(Lauris): location booking field is added if multiple locations are passed
{ isDefault: true, required: false, slug: "location", type: "radioInput" },
{ isDefault: true, required: false, slug: "rescheduleReason", type: "textarea" },
{
isDefault: true,
required: false,
slug: "location",
type: "radioInput",
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
required: false,
slug: "rescheduleReason",
type: "textarea",
disableOnPrefill: false,
hidden: false,
},
...requestBookingFields
.filter((field) => field.type !== "name" && field.type !== "email")
.map((field) => ({ isDefault: false, ...field })),
@@ -787,6 +802,7 @@ describe("Event types Endpoints", () => {
placeholder: "select language",
options: ["javascript", "python", "cobol"],
disableOnPrefill: false,
hidden: false,
},
],
bookingLimitsCount: {
@@ -853,8 +869,15 @@ describe("Event types Endpoints", () => {
const requestBookingFields = body.bookingFields || [];
const expectedBookingFields = [
{ isDefault: true, required: true, slug: "name", ...nameBookingField },
{ isDefault: true, required: true, slug: "email", type: "email" },
{ isDefault: true, required: false, slug: "rescheduleReason", type: "textarea" },
{ isDefault: true, required: true, slug: "email", type: "email", disableOnPrefill: false },
{
isDefault: true,
required: false,
slug: "rescheduleReason",
type: "textarea",
disableOnPrefill: false,
hidden: false,
},
...requestBookingFields
.filter((field) => field.type !== "name" && field.type !== "email")
.map((field) => ({ isDefault: false, ...field })),
@@ -1055,14 +1078,44 @@ describe("Event types Endpoints", () => {
let legacyEventTypeId2: number;
const expectedReturnSystemFields = [
{ isDefault: true, required: true, slug: "name", type: "name" },
{ isDefault: true, required: true, slug: "email", type: "email" },
{ isDefault: true, type: "radioInput", slug: "location", required: false },
{ isDefault: true, required: true, slug: "title", type: "text" },
{ isDefault: true, required: false, slug: "notes", type: "textarea" },
{ isDefault: true, required: false, slug: "guests", type: "multiemail" },
{ isDefault: true, required: false, slug: "rescheduleReason", type: "textarea" },
{ isDefault: true, type: "phone", slug: "attendeePhoneNumber", required: false },
{ isDefault: true, required: true, slug: "name", type: "name", disableOnPrefill: false },
{ isDefault: true, required: true, slug: "email", type: "email", disableOnPrefill: false },
{
isDefault: true,
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
label: "",
placeholder: "",
},
{ isDefault: true, required: true, slug: "title", type: "text", disableOnPrefill: false, hidden: true },
{
isDefault: true,
required: false,
slug: "notes",
type: "textarea",
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
required: false,
slug: "guests",
type: "multiemail",
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
required: false,
slug: "rescheduleReason",
type: "textarea",
disableOnPrefill: false,
hidden: false,
},
{ isDefault: true, type: "phone", slug: "attendeePhoneNumber", required: false, hidden: true },
];
beforeAll(async () => {
@@ -1382,6 +1435,8 @@ describe("Event types Endpoints", () => {
label: userDefinedBookingField.label,
required: userDefinedBookingField.required,
placeholder: userDefinedBookingField.placeholder,
disableOnPrefill: false,
hidden: false,
},
]);
});
@@ -1461,42 +1516,54 @@ describe("Event types Endpoints", () => {
type: "name",
slug: "name",
required: true,
disableOnPrefill: false,
},
{
isDefault: true,
type: "email",
slug: "email",
required: true,
disableOnPrefill: false,
},
{
isDefault: true,
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "text",
slug: "title",
required: true,
disableOnPrefill: false,
hidden: true,
},
{
isDefault: true,
type: "textarea",
slug: "notes",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "multiemail",
slug: "guests",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "textarea",
slug: "rescheduleReason",
required: false,
disableOnPrefill: false,
hidden: false,
},
]);
});
@@ -5,7 +5,7 @@ import { UserWithProfile } from "@/modules/users/users.repository";
import { Injectable, BadRequestException } from "@nestjs/common";
import {
transformBookingFieldsApiToInternal,
transformBookingFieldsApiRequestToInternal,
transformLocationsApiToInternal,
transformIntervalLimitsApiToInternal,
transformFutureBookingLimitsApiToInternal,
@@ -218,7 +218,7 @@ export class InputEventTypesService_2024_06_14 {
hasMultipleLocations: boolean
) {
const customFields: (SystemField | CustomField)[] = inputBookingFields
? transformBookingFieldsApiToInternal(inputBookingFields)
? transformBookingFieldsApiRequestToInternal(inputBookingFields)
: [];
const customFieldsWithoutNameEmail = customFields.filter(
(field) => field.type !== "name" && field.type !== "email"
@@ -682,48 +682,61 @@ describe("Organizations Event Types Endpoints", () => {
type: "name",
slug: "name",
required: true,
disableOnPrefill: false,
},
{
isDefault: true,
type: "email",
slug: "email",
required: true,
disableOnPrefill: false,
},
{
isDefault: true,
required: false,
slug: "attendeePhoneNumber",
type: "phone",
slug: "attendeePhoneNumber",
required: false,
hidden: true,
},
{
isDefault: true,
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "text",
slug: "title",
required: true,
disableOnPrefill: false,
hidden: true,
},
{
isDefault: true,
type: "textarea",
slug: "notes",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "multiemail",
slug: "guests",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "textarea",
slug: "rescheduleReason",
required: false,
disableOnPrefill: false,
hidden: false,
},
]);
});
+195 -16
View File
@@ -6998,6 +6998,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `phone` and the URL contains query parameter `&phone=1234567890`, the phone field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7005,7 +7009,8 @@
"slug",
"label",
"required",
"placeholder"
"placeholder",
"hidden"
]
},
"AddressFieldInput_2024_06_14": {
@@ -7035,6 +7040,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `address` and the URL contains query parameter `&address=1234 Main St, London`, the address field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7042,7 +7051,8 @@
"slug",
"label",
"required",
"placeholder"
"placeholder",
"hidden"
]
},
"TextFieldInput_2024_06_14": {
@@ -7072,6 +7082,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `who-referred-you` and the URL contains query parameter `&who-referred-you=bob`, the text field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7079,7 +7093,8 @@
"slug",
"label",
"required",
"placeholder"
"placeholder",
"hidden"
]
},
"NumberFieldInput_2024_06_14": {
@@ -7109,6 +7124,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `calories-per-day` and the URL contains query parameter `&calories-per-day=3000`, the number field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7116,7 +7135,8 @@
"slug",
"label",
"required",
"placeholder"
"placeholder",
"hidden"
]
},
"TextAreaFieldInput_2024_06_14": {
@@ -7146,6 +7166,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `dear-diary` and the URL contains query parameter `&dear-diary=Today I shipped a feature`, the text area will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7153,7 +7177,8 @@
"slug",
"label",
"required",
"placeholder"
"placeholder",
"hidden"
]
},
"SelectFieldInput_2024_06_14": {
@@ -7193,6 +7218,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `language` and options of this select field are ['english', 'italian'] and the URL contains query parameter `&language=italian`, the 'italian' will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7201,7 +7230,8 @@
"label",
"required",
"placeholder",
"options"
"options",
"hidden"
]
},
"MultiSelectFieldInput_2024_06_14": {
@@ -7237,6 +7267,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `consultants` and the URL contains query parameter `&consultants=en&language=it`, the 'en' and 'it' will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7244,7 +7278,8 @@
"slug",
"label",
"required",
"options"
"options",
"hidden"
]
},
"MultiEmailFieldInput_2024_06_14": {
@@ -7274,6 +7309,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `consultants` and the URL contains query parameter `&[email protected]&[email protected]`, the these emails will be added and none more can be added."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7281,7 +7320,8 @@
"slug",
"label",
"required",
"placeholder"
"placeholder",
"hidden"
]
},
"CheckboxGroupFieldInput_2024_06_14": {
@@ -7317,6 +7357,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `notify-me` and the URL contains query parameter `&notify-me=true`, the checkbox will be selected and the checkbox field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7324,7 +7368,8 @@
"slug",
"label",
"required",
"options"
"options",
"hidden"
]
},
"RadioGroupFieldInput_2024_06_14": {
@@ -7360,6 +7405,10 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `language` and options of this select field are ['english', 'italian'] and the URL contains query parameter `&language=italian`, the 'italian' radio buttom will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
@@ -7367,7 +7416,8 @@
"slug",
"label",
"required",
"options"
"options",
"hidden"
]
},
"BooleanFieldInput_2024_06_14": {
@@ -7392,13 +7442,18 @@
},
"disableOnPrefill": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
"type",
"slug",
"label",
"required"
"required",
"hidden"
]
},
"BusinessDaysWindow_2024_06_14": {
@@ -8403,13 +8458,18 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": [
"isDefault",
"slug",
"type",
"required"
"required",
"hidden"
]
},
"RescheduleReasonDefaultFieldOutput_2024_06_14": {
@@ -8431,13 +8491,29 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&rescheduleReason=busy`, the reschedule reason field will be prefilled with this value and disabled."
}
},
"required": [
"isDefault",
"slug",
"type",
"required"
"required",
"hidden",
"disableOnPrefill"
]
},
"TitleDefaultFieldOutput_2024_06_14": {
@@ -8459,13 +8535,29 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&title=masterclass`, the title field will be prefilled with this value and disabled."
}
},
"required": [
"isDefault",
"slug",
"type",
"required"
"required",
"hidden",
"disableOnPrefill"
]
},
"NotesDefaultFieldOutput_2024_06_14": {
@@ -8487,13 +8579,29 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&notes=hello`, the notes field will be prefilled with this value and disabled."
}
},
"required": [
"isDefault",
"slug",
"type",
"required"
"required",
"hidden",
"disableOnPrefill"
]
},
"GuestsDefaultFieldOutput_2024_06_14": {
@@ -8515,13 +8623,29 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&[email protected]`, the guests field will be prefilled with this value and disabled."
}
},
"required": [
"isDefault",
"slug",
"type",
"required"
"required",
"hidden",
"disableOnPrefill"
]
},
"AddressFieldOutput_2024_06_14": {
@@ -8567,6 +8691,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `address` and the URL contains query parameter `&address=1234 Main St, London`, the address field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8579,6 +8707,7 @@
"slug",
"label",
"required",
"hidden",
"isDefault"
]
},
@@ -8620,6 +8749,10 @@
"disableOnPrefill": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8632,6 +8765,7 @@
"slug",
"label",
"required",
"hidden",
"isDefault"
]
},
@@ -8684,6 +8818,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `notify-me` and the URL contains query parameter `&notify-me=true`, the checkbox will be selected and the checkbox field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8697,6 +8835,7 @@
"label",
"required",
"options",
"hidden",
"isDefault"
]
},
@@ -8743,6 +8882,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `consultants` and the URL contains query parameter `&[email protected]&[email protected]`, the these emails will be added and none more can be added."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8755,6 +8898,7 @@
"slug",
"label",
"required",
"hidden",
"isDefault"
]
},
@@ -8807,6 +8951,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `consultants` and the URL contains query parameter `&consultants=en&language=it`, the 'en' and 'it' will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8820,6 +8968,7 @@
"label",
"required",
"options",
"hidden",
"isDefault"
]
},
@@ -8866,6 +9015,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `calories-per-day` and the URL contains query parameter `&calories-per-day=3000`, the number field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8878,6 +9031,7 @@
"slug",
"label",
"required",
"hidden",
"isDefault"
]
},
@@ -8922,6 +9076,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `phone` and the URL contains query parameter `&phone=1234567890`, the phone field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8934,6 +9092,7 @@
"slug",
"label",
"required",
"hidden",
"isDefault"
]
},
@@ -8986,6 +9145,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `language` and options of this select field are ['english', 'italian'] and the URL contains query parameter `&language=italian`, the 'italian' radio buttom will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8999,6 +9162,7 @@
"label",
"required",
"options",
"hidden",
"isDefault"
]
},
@@ -9055,6 +9219,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `language` and options of this select field are ['english', 'italian'] and the URL contains query parameter `&language=italian`, the 'italian' will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -9068,6 +9236,7 @@
"label",
"required",
"options",
"hidden",
"isDefault"
]
},
@@ -9114,6 +9283,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `dear-diary` and the URL contains query parameter `&dear-diary=Today I shipped a feature`, the text area will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -9126,6 +9299,7 @@
"slug",
"label",
"required",
"hidden",
"isDefault"
]
},
@@ -9172,6 +9346,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `who-referred-you` and the URL contains query parameter `&who-referred-you=bob`, the text field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -9184,6 +9362,7 @@
"slug",
"label",
"required",
"hidden",
"isDefault"
]
},
+175 -27
View File
@@ -6568,9 +6568,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `phone` and the URL contains query parameter `&phone=1234567890`, the phone field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "placeholder"]
"required": ["type", "slug", "label", "required", "placeholder", "hidden"]
},
"AddressFieldInput_2024_06_14": {
"type": "object",
@@ -6599,9 +6603,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `address` and the URL contains query parameter `&address=1234 Main St, London`, the address field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "placeholder"]
"required": ["type", "slug", "label", "required", "placeholder", "hidden"]
},
"TextFieldInput_2024_06_14": {
"type": "object",
@@ -6630,9 +6638,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `who-referred-you` and the URL contains query parameter `&who-referred-you=bob`, the text field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "placeholder"]
"required": ["type", "slug", "label", "required", "placeholder", "hidden"]
},
"NumberFieldInput_2024_06_14": {
"type": "object",
@@ -6661,9 +6673,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `calories-per-day` and the URL contains query parameter `&calories-per-day=3000`, the number field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "placeholder"]
"required": ["type", "slug", "label", "required", "placeholder", "hidden"]
},
"TextAreaFieldInput_2024_06_14": {
"type": "object",
@@ -6692,9 +6708,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `dear-diary` and the URL contains query parameter `&dear-diary=Today I shipped a feature`, the text area will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "placeholder"]
"required": ["type", "slug", "label", "required", "placeholder", "hidden"]
},
"SelectFieldInput_2024_06_14": {
"type": "object",
@@ -6730,9 +6750,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `language` and options of this select field are ['english', 'italian'] and the URL contains query parameter `&language=italian`, the 'italian' will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "placeholder", "options"]
"required": ["type", "slug", "label", "required", "placeholder", "options", "hidden"]
},
"MultiSelectFieldInput_2024_06_14": {
"type": "object",
@@ -6764,9 +6788,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `consultants` and the URL contains query parameter `&consultants=en&language=it`, the 'en' and 'it' will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "options"]
"required": ["type", "slug", "label", "required", "options", "hidden"]
},
"MultiEmailFieldInput_2024_06_14": {
"type": "object",
@@ -6795,9 +6823,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `consultants` and the URL contains query parameter `&[email protected]&[email protected]`, the these emails will be added and none more can be added."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "placeholder"]
"required": ["type", "slug", "label", "required", "placeholder", "hidden"]
},
"CheckboxGroupFieldInput_2024_06_14": {
"type": "object",
@@ -6829,9 +6861,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `notify-me` and the URL contains query parameter `&notify-me=true`, the checkbox will be selected and the checkbox field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "options"]
"required": ["type", "slug", "label", "required", "options", "hidden"]
},
"RadioGroupFieldInput_2024_06_14": {
"type": "object",
@@ -6863,9 +6899,13 @@
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `language` and options of this select field are ['english', 'italian'] and the URL contains query parameter `&language=italian`, the 'italian' radio buttom will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required", "options"]
"required": ["type", "slug", "label", "required", "options", "hidden"]
},
"BooleanFieldInput_2024_06_14": {
"type": "object",
@@ -6889,9 +6929,13 @@
},
"disableOnPrefill": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["type", "slug", "label", "required"]
"required": ["type", "slug", "label", "required", "hidden"]
},
"BusinessDaysWindow_2024_06_14": {
"type": "object",
@@ -7782,9 +7826,13 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
}
},
"required": ["isDefault", "slug", "type", "required"]
"required": ["isDefault", "slug", "type", "required", "hidden"]
},
"RescheduleReasonDefaultFieldOutput_2024_06_14": {
"type": "object",
@@ -7805,9 +7853,23 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&rescheduleReason=busy`, the reschedule reason field will be prefilled with this value and disabled."
}
},
"required": ["isDefault", "slug", "type", "required"]
"required": ["isDefault", "slug", "type", "required", "hidden", "disableOnPrefill"]
},
"TitleDefaultFieldOutput_2024_06_14": {
"type": "object",
@@ -7828,9 +7890,23 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&title=masterclass`, the title field will be prefilled with this value and disabled."
}
},
"required": ["isDefault", "slug", "type", "required"]
"required": ["isDefault", "slug", "type", "required", "hidden", "disableOnPrefill"]
},
"NotesDefaultFieldOutput_2024_06_14": {
"type": "object",
@@ -7851,9 +7927,23 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&notes=hello`, the notes field will be prefilled with this value and disabled."
}
},
"required": ["isDefault", "slug", "type", "required"]
"required": ["isDefault", "slug", "type", "required", "hidden", "disableOnPrefill"]
},
"GuestsDefaultFieldOutput_2024_06_14": {
"type": "object",
@@ -7874,9 +7964,23 @@
},
"required": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&[email protected]`, the guests field will be prefilled with this value and disabled."
}
},
"required": ["isDefault", "slug", "type", "required"]
"required": ["isDefault", "slug", "type", "required", "hidden", "disableOnPrefill"]
},
"AddressFieldOutput_2024_06_14": {
"type": "object",
@@ -7921,6 +8025,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `address` and the URL contains query parameter `&address=1234 Main St, London`, the address field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -7928,7 +8036,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "isDefault"]
"required": ["type", "slug", "label", "required", "hidden", "isDefault"]
},
"BooleanFieldOutput_2024_06_14": {
"type": "object",
@@ -7968,6 +8076,10 @@
"disableOnPrefill": {
"type": "boolean"
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -7975,7 +8087,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "isDefault"]
"required": ["type", "slug", "label", "required", "hidden", "isDefault"]
},
"CheckboxGroupFieldOutput_2024_06_14": {
"type": "object",
@@ -8023,6 +8135,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `notify-me` and the URL contains query parameter `&notify-me=true`, the checkbox will be selected and the checkbox field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8030,7 +8146,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "options", "isDefault"]
"required": ["type", "slug", "label", "required", "options", "hidden", "isDefault"]
},
"MultiEmailFieldOutput_2024_06_14": {
"type": "object",
@@ -8075,6 +8191,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `consultants` and the URL contains query parameter `&[email protected]&[email protected]`, the these emails will be added and none more can be added."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8082,7 +8202,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "isDefault"]
"required": ["type", "slug", "label", "required", "hidden", "isDefault"]
},
"MultiSelectFieldOutput_2024_06_14": {
"type": "object",
@@ -8130,6 +8250,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `consultants` and the URL contains query parameter `&consultants=en&language=it`, the 'en' and 'it' will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8137,7 +8261,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "options", "isDefault"]
"required": ["type", "slug", "label", "required", "options", "hidden", "isDefault"]
},
"NumberFieldOutput_2024_06_14": {
"type": "object",
@@ -8182,6 +8306,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `calories-per-day` and the URL contains query parameter `&calories-per-day=3000`, the number field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8189,7 +8317,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "isDefault"]
"required": ["type", "slug", "label", "required", "hidden", "isDefault"]
},
"PhoneFieldOutput_2024_06_14": {
"type": "object",
@@ -8232,6 +8360,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `phone` and the URL contains query parameter `&phone=1234567890`, the phone field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8239,7 +8371,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "isDefault"]
"required": ["type", "slug", "label", "required", "hidden", "isDefault"]
},
"RadioGroupFieldOutput_2024_06_14": {
"type": "object",
@@ -8287,6 +8419,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `language` and options of this select field are ['english', 'italian'] and the URL contains query parameter `&language=italian`, the 'italian' radio buttom will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8294,7 +8430,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "options", "isDefault"]
"required": ["type", "slug", "label", "required", "options", "hidden", "isDefault"]
},
"SelectFieldOutput_2024_06_14": {
"type": "object",
@@ -8346,6 +8482,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `language` and options of this select field are ['english', 'italian'] and the URL contains query parameter `&language=italian`, the 'italian' will be selected and the select field will be disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8353,7 +8493,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "options", "isDefault"]
"required": ["type", "slug", "label", "required", "options", "hidden", "isDefault"]
},
"TextAreaFieldOutput_2024_06_14": {
"type": "object",
@@ -8398,6 +8538,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `dear-diary` and the URL contains query parameter `&dear-diary=Today I shipped a feature`, the text area will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8405,7 +8549,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "isDefault"]
"required": ["type", "slug", "label", "required", "hidden", "isDefault"]
},
"TextFieldOutput_2024_06_14": {
"type": "object",
@@ -8450,6 +8594,10 @@
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if the slug is `who-referred-you` and the URL contains query parameter `&who-referred-you=bob`, the text field will be prefilled with this value and disabled."
},
"hidden": {
"type": "boolean",
"description": "If true show under event type settings but don't show this booking field in the Booker. If false show in both."
},
"isDefault": {
"type": "object",
"default": false,
@@ -8457,7 +8605,7 @@
"example": false
}
},
"required": ["type", "slug", "label", "required", "isDefault"]
"required": ["type", "slug", "label", "required", "hidden", "isDefault"]
},
"EventTypeOutput_2024_06_14": {
"type": "object",
@@ -32,7 +32,7 @@ import {
} from "../internal-to-api/booking-fields";
import {
transformLocationsApiToInternal,
transformBookingFieldsApiToInternal,
transformBookingFieldsApiRequestToInternal,
transformSelectOptionsApiToInternal,
transformIntervalLimitsApiToInternal,
transformFutureBookingLimitsApiToInternal,
@@ -151,7 +151,7 @@ describe("transformLocationsApiToInternal", () => {
});
});
describe("transformBookingFieldsApiToInternal", () => {
describe("transformBookingFieldsApiRequestToInternal", () => {
it("should transform name field", () => {
const bookingField: InputBookingField_2024_06_14 = {
type: "name",
@@ -176,7 +176,7 @@ describe("transformBookingFieldsApiToInternal", () => {
const expectedOutput: SystemField[] = [expectedField];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -200,7 +200,7 @@ describe("transformBookingFieldsApiToInternal", () => {
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -232,10 +232,12 @@ describe("transformBookingFieldsApiToInternal", () => {
editable: "user",
required: bookingField.required,
placeholder: bookingField.placeholder,
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -267,10 +269,12 @@ describe("transformBookingFieldsApiToInternal", () => {
editable: "user",
required: bookingField.required,
placeholder: bookingField.placeholder,
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -302,10 +306,12 @@ describe("transformBookingFieldsApiToInternal", () => {
editable: "user",
required: bookingField.required,
placeholder: bookingField.placeholder,
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -337,10 +343,12 @@ describe("transformBookingFieldsApiToInternal", () => {
editable: "user",
required: bookingField.required,
placeholder: bookingField.placeholder,
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -372,10 +380,12 @@ describe("transformBookingFieldsApiToInternal", () => {
editable: "user",
required: bookingField.required,
placeholder: bookingField.placeholder,
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -409,10 +419,12 @@ describe("transformBookingFieldsApiToInternal", () => {
required: bookingField.required,
placeholder: bookingField.placeholder,
options: transformSelectOptionsApiToInternal(bookingField.options),
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -445,10 +457,12 @@ describe("transformBookingFieldsApiToInternal", () => {
required: bookingField.required,
placeholder: "",
options: transformSelectOptionsApiToInternal(bookingField.options),
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -480,10 +494,12 @@ describe("transformBookingFieldsApiToInternal", () => {
editable: "user",
required: bookingField.required,
placeholder: bookingField.placeholder,
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -516,10 +532,12 @@ describe("transformBookingFieldsApiToInternal", () => {
required: bookingField.required,
placeholder: "",
options: transformSelectOptionsApiToInternal(bookingField.options),
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -552,10 +570,12 @@ describe("transformBookingFieldsApiToInternal", () => {
required: bookingField.required,
placeholder: "",
options: transformSelectOptionsApiToInternal(bookingField.options),
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -586,10 +606,12 @@ describe("transformBookingFieldsApiToInternal", () => {
],
editable: "user",
required: bookingField.required,
disableOnPrefill: false,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -626,10 +648,11 @@ describe("transformBookingFieldsApiToInternal", () => {
placeholder: "",
options: transformSelectOptionsApiToInternal(bookingField.options),
disableOnPrefill,
hidden: false,
},
];
const result = transformBookingFieldsApiToInternal(input);
const result = transformBookingFieldsApiRequestToInternal(input);
expect(result).toEqual(expectedOutput);
});
@@ -1,17 +1,23 @@
import type { InputBookingField_2024_06_14 } from "@calcom/platform-types";
import type { InputBookingField_2024_06_14, OutputBookingField_2024_06_14 } from "@calcom/platform-types";
import {
systemBeforeFieldEmail,
systemBeforeFieldName,
systemBeforeFieldLocation,
systemBeforeFieldPhone,
systemAfterFieldTitle,
systemAfterFieldNotes,
systemAfterFieldGuests,
systemAfterFieldRescheduleReason,
type CustomField,
type SystemField,
} from "../internal-to-api";
export function transformBookingFieldsApiToInternal(
export function transformBookingFieldsApiRequestToInternal(
inputBookingFields: InputBookingField_2024_06_14[]
): (SystemField | CustomField)[] {
const customBookingFields = inputBookingFields.map((field) => {
const baseProperties = getBaseProperties(field);
const baseProperties = getBasePropertiesRequest(field);
const options =
"options" in field && field.options ? transformSelectOptionsApiToInternal(field.options) : undefined;
@@ -29,7 +35,7 @@ export function transformBookingFieldsApiToInternal(
return customBookingFields;
}
function getBaseProperties(field: InputBookingField_2024_06_14): SystemField | CustomField {
function getBasePropertiesRequest(field: InputBookingField_2024_06_14): SystemField | CustomField {
if (field.type === "name") {
const systemName = { ...systemBeforeFieldName };
if (systemName.variantsConfig?.variants?.fullName?.fields?.[0]) {
@@ -46,7 +52,7 @@ function getBaseProperties(field: InputBookingField_2024_06_14): SystemField | C
return {
...systemName,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
};
}
@@ -55,7 +61,7 @@ function getBaseProperties(field: InputBookingField_2024_06_14): SystemField | C
...systemBeforeFieldEmail,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
};
}
@@ -75,7 +81,8 @@ function getBaseProperties(field: InputBookingField_2024_06_14): SystemField | C
],
editable: "user",
required: field.required,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
}
@@ -94,7 +101,8 @@ function getBaseProperties(field: InputBookingField_2024_06_14): SystemField | C
editable: "user",
required: field.required,
placeholder: "placeholder" in field && field.placeholder ? field.placeholder : "",
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
}
@@ -104,3 +112,153 @@ export function transformSelectOptionsApiToInternal(options: string[]) {
value: option,
}));
}
export function transformBookingFieldsApiResponseToInternal(bookingFields: OutputBookingField_2024_06_14[]) {
const customBookingFields = bookingFields.map((field) => {
const baseProperties = getBasePropertiesResponse(field);
const options =
"options" in field && field.options ? transformSelectOptionsApiToInternal(field.options) : undefined;
if (!options) {
return baseProperties;
}
return {
...baseProperties,
options,
};
});
return customBookingFields;
}
function getBasePropertiesResponse(field: OutputBookingField_2024_06_14) {
if (field.type === "name") {
const systemName = { ...systemBeforeFieldName };
if (systemName.variantsConfig?.variants?.fullName?.fields?.[0]) {
systemName.variantsConfig.variants.fullName.fields[0].label = field.label;
}
if (systemName.variantsConfig?.variants?.fullName?.fields?.[0]) {
systemName.variantsConfig.variants.fullName.fields[0].placeholder = field.placeholder;
}
// note(Lauris): we attach top level label and placeholder for easier access when converting database event type
// to v2 response event type even though form builder uses label and placeholder from variantsConfig.
systemName.label = field.label;
systemName.placeholder = field.placeholder;
return {
...systemName,
disableOnPrefill: !!field.disableOnPrefill,
};
}
if (field.type === "email") {
return {
...systemBeforeFieldEmail,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: !!field.disableOnPrefill,
};
}
if (field.slug === "location") {
return {
...systemBeforeFieldLocation,
required: field.required,
hidden: field.hidden,
};
}
if (field.slug === "attendeePhoneNumber") {
return {
...systemBeforeFieldPhone,
required: field.required,
};
}
if (field.slug === "rescheduleReason") {
return {
...systemAfterFieldRescheduleReason,
required: field.required,
hidden: field.hidden,
label: field.label,
placeholder: "placeholder" in field ? field.placeholder : "",
disableOnPrefill: !!field.disableOnPrefill,
};
}
if (field.slug === "title") {
return {
...systemAfterFieldTitle,
required: field.required,
hidden: field.hidden,
label: field.label,
placeholder: "placeholder" in field ? field.placeholder : "",
disableOnPrefill: !!field.disableOnPrefill,
};
}
if (field.slug === "notes") {
return {
...systemAfterFieldNotes,
required: field.required,
hidden: field.hidden,
label: field.label,
placeholder: "placeholder" in field ? field.placeholder : "",
disableOnPrefill: !!field.disableOnPrefill,
};
}
if (field.slug === "guests") {
return {
...systemAfterFieldGuests,
required: field.required,
hidden: field.hidden,
label: field.label,
placeholder: "placeholder" in field ? field.placeholder : "",
disableOnPrefill: !!field.disableOnPrefill,
};
}
if (field.type === "boolean") {
return {
name: field.slug,
type: field.type,
label: field.label,
labelAsSafeHtml: `<p>${field.label}</p>\n`,
sources: [
{
id: "user",
type: "user",
label: "User",
fieldRequired: true,
},
],
editable: "user",
required: field.required,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
}
return {
name: field.slug,
type: field.type,
label: "label" in field ? field.label : "",
sources: [
{
id: "user",
type: "user",
label: "User",
fieldRequired: true,
},
],
editable: "user",
required: "required" in field ? field.required : false,
placeholder: "placeholder" in field && field.placeholder ? field.placeholder : "",
disableOnPrefill: "disableOnPrefill" in field ? !!field.disableOnPrefill : false,
hidden: "hidden" in field ? field.hidden : undefined,
};
}
@@ -29,7 +29,7 @@ export function transformBookingFieldsInternalToApi(
required: field.required,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
};
case "email":
return {
@@ -39,7 +39,7 @@ export function transformBookingFieldsInternalToApi(
required: field.required,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
};
case "location":
return {
@@ -47,6 +47,10 @@ export function transformBookingFieldsInternalToApi(
type: field.type,
slug: field.name,
required: field.required,
hidden: !!field.hidden,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: !!field.disableOnPrefill,
};
case "rescheduleReason":
return {
@@ -54,6 +58,10 @@ export function transformBookingFieldsInternalToApi(
type: field.type,
slug: field.name,
required: field.required,
hidden: !!field.hidden,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: !!field.disableOnPrefill,
};
case "title":
return {
@@ -61,6 +69,10 @@ export function transformBookingFieldsInternalToApi(
type: field.type,
slug: field.name,
required: field.required,
hidden: !!field.hidden,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: !!field.disableOnPrefill,
};
case "notes":
return {
@@ -68,6 +80,10 @@ export function transformBookingFieldsInternalToApi(
type: field.type,
slug: field.name,
required: field.required,
hidden: !!field.hidden,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: !!field.disableOnPrefill,
};
case "guests":
return {
@@ -75,6 +91,10 @@ export function transformBookingFieldsInternalToApi(
type: field.type,
slug: field.name,
required: field.required,
hidden: !!field.hidden,
label: field.label,
placeholder: field.placeholder,
disableOnPrefill: !!field.disableOnPrefill,
};
case "attendeePhoneNumber":
return {
@@ -82,6 +102,7 @@ export function transformBookingFieldsInternalToApi(
type: field.type,
slug: field.name,
required: field.required,
hidden: !!field.hidden,
};
default:
return {
@@ -103,7 +124,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "address":
return {
@@ -113,7 +135,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "text":
return {
@@ -123,7 +146,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "number":
return {
@@ -133,7 +157,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "textarea":
return {
@@ -143,7 +168,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "multiemail":
return {
@@ -153,7 +179,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
placeholder: field.placeholder,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "boolean":
return {
@@ -162,7 +189,8 @@ export function transformBookingFieldsInternalToApi(
slug: field.name,
label: field.label,
required: field.required,
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "select":
return {
@@ -173,7 +201,8 @@ export function transformBookingFieldsInternalToApi(
required: field.required,
placeholder: field.placeholder,
options: field.options ? field.options.map((option) => option.value) : [],
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "multiselect":
return {
@@ -183,7 +212,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
options: field.options ? field.options?.map((option) => option.value) : [],
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "checkbox":
return {
@@ -193,7 +223,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
options: field.options ? field.options?.map((option) => option.value) : [],
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
case "radio":
return {
@@ -203,7 +234,8 @@ export function transformBookingFieldsInternalToApi(
label: field.label,
required: field.required,
options: field.options ? field.options?.map((option) => option.value) : [],
disableOnPrefill: field.disableOnPrefill,
disableOnPrefill: !!field.disableOnPrefill,
hidden: !!field.hidden,
};
default:
return {
@@ -237,6 +269,7 @@ const CustomFieldsSchema = z.object({
type: CustomFieldTypeEnum,
label: z.string(),
labelAsSafeHtml: z.string().optional(),
hidden: z.boolean().optional(),
sources: z.array(
z.object({
id: z.literal("user"),
@@ -341,37 +374,37 @@ const PhoneSystemFieldSchema = SystemFieldSchema.extend({
const EmailSystemFieldSchema = SystemFieldSchema.extend({
name: z.literal("email"),
type: z.literal("email"),
required: z.literal(true),
required: z.boolean(),
});
const RescheduleReasonSystemFieldSchema = SystemFieldSchema.extend({
name: z.literal("rescheduleReason"),
type: z.literal("textarea"),
required: z.literal(false),
required: z.boolean(),
});
const LocationReasonSystemFieldSchema = SystemFieldSchema.extend({
name: z.literal("location"),
type: z.literal("radioInput"),
required: z.literal(false),
required: z.boolean(),
});
const TitleSystemFieldSchema = SystemFieldSchema.extend({
name: z.literal("title"),
type: z.literal("text"),
required: z.literal(true),
required: z.boolean(),
});
const NotesSystemFieldSchema = SystemFieldSchema.extend({
name: z.literal("notes"),
type: z.literal("textarea"),
required: z.literal(false),
required: z.boolean(),
});
const GuestsSystemFieldSchema = SystemFieldSchema.extend({
name: z.literal("guests"),
type: z.literal("multiemail"),
required: z.literal(false),
required: z.boolean(),
});
export type NameSystemField = z.infer<typeof NameSystemFieldSchema>;
@@ -453,6 +486,22 @@ export const systemBeforeFieldEmail: EmailSystemField = {
],
};
export const systemBeforeFieldPhone: PhoneSystemField = {
defaultLabel: "phone_number",
type: "phone",
name: "attendeePhoneNumber",
required: false,
hidden: true,
editable: "system-but-optional",
sources: [
{
label: "Default",
id: "default",
type: "default",
},
],
};
export const systemBeforeFieldLocation: LocationReasonSystemField = {
defaultLabel: "location",
type: "radioInput",
@@ -487,6 +536,56 @@ export const systemBeforeFieldLocation: LocationReasonSystemField = {
],
};
export const systemAfterFieldTitle: TitleSystemField = {
defaultLabel: "what_is_this_meeting_about",
type: "text",
name: "title",
editable: "system-but-optional",
required: true,
hidden: false,
defaultPlaceholder: "",
sources: [
{
label: "Default",
id: "default",
type: "default",
},
],
};
export const systemAfterFieldNotes: NotesSystemField = {
defaultLabel: "additional_notes",
type: "textarea",
name: "notes",
editable: "system-but-optional",
required: false,
defaultPlaceholder: "share_additional_notes",
sources: [
{
label: "Default",
id: "default",
type: "default",
},
],
};
export const systemAfterFieldGuests: GuestsSystemField = {
defaultLabel: "additional_guests",
type: "multiemail",
editable: "system-but-optional",
name: "guests",
defaultPlaceholder: "email",
required: false,
hidden: false,
sources: [
{
label: "Default",
id: "default",
type: "default",
},
],
};
export const systemAfterFieldRescheduleReason: RescheduleReasonSystemField = {
defaultLabel: "reason_for_reschedule",
type: "textarea",
@@ -275,6 +275,9 @@ describe("transformBookingFieldsInternalToApi", () => {
slug: "name",
isDefault: true,
required: true,
disableOnPrefill: false,
label: undefined,
placeholder: undefined,
},
];
@@ -334,6 +337,9 @@ describe("transformBookingFieldsInternalToApi", () => {
slug: "email",
isDefault: true,
required: true,
disableOnPrefill: false,
label: undefined,
placeholder: undefined,
},
];
@@ -397,6 +403,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your phone number",
required: true,
placeholder: "123456789",
hidden: false,
disableOnPrefill: false,
},
];
@@ -433,6 +441,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your address",
required: true,
placeholder: "1234 Main St",
hidden: false,
disableOnPrefill: false,
},
];
@@ -469,6 +479,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your text",
required: true,
placeholder: "Enter your text",
hidden: false,
disableOnPrefill: false,
},
];
@@ -505,6 +517,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your number",
required: true,
placeholder: "100",
hidden: false,
disableOnPrefill: false,
},
];
@@ -530,6 +544,8 @@ describe("transformBookingFieldsInternalToApi", () => {
editable: "user",
required: true,
placeholder: "Detailed description here...",
hidden: false,
disableOnPrefill: false,
},
];
@@ -541,6 +557,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your detailed information",
required: true,
placeholder: "Detailed description here...",
hidden: false,
disableOnPrefill: false,
},
];
@@ -582,6 +600,8 @@ describe("transformBookingFieldsInternalToApi", () => {
required: true,
placeholder: "Select...",
options: ["Option 1", "Option 2"],
hidden: false,
disableOnPrefill: false,
},
];
@@ -621,6 +641,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your multiple selections",
required: true,
options: ["Option 1", "Option 2"],
hidden: false,
disableOnPrefill: false,
},
];
@@ -646,6 +668,8 @@ describe("transformBookingFieldsInternalToApi", () => {
editable: "user",
required: true,
placeholder: "[email protected]",
hidden: false,
disableOnPrefill: false,
},
];
@@ -657,6 +681,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your multiple emails",
required: true,
placeholder: "[email protected]",
hidden: false,
disableOnPrefill: false,
},
];
@@ -696,6 +722,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your checkboxes",
required: true,
options: ["Checkbox 1", "Checkbox 2"],
hidden: false,
disableOnPrefill: false,
},
];
@@ -735,6 +763,8 @@ describe("transformBookingFieldsInternalToApi", () => {
label: "Your radio buttons",
required: true,
options: ["Radio 1", "Radio 2"],
hidden: false,
disableOnPrefill: false,
},
];
@@ -769,6 +799,8 @@ describe("transformBookingFieldsInternalToApi", () => {
slug: "agree-to-terms",
label: "Agree to terms?",
required: true,
hidden: false,
disableOnPrefill: false,
},
];
@@ -802,6 +834,7 @@ describe("transformBookingFieldsInternalToApi", () => {
type: "phone",
slug: "attendeePhoneNumber",
required: false,
hidden: true,
},
];
@@ -1,8 +1,8 @@
import { defaultEvents } from "@calcom/lib/defaultEvents";
import type { CustomField, SystemField } from "@calcom/lib/event-types/transformers";
import type { SystemField } from "@calcom/lib/event-types/transformers";
import {
transformLocationsApiToInternal,
transformBookingFieldsApiToInternal,
transformBookingFieldsApiResponseToInternal,
systemBeforeFieldName,
systemBeforeFieldEmail,
systemBeforeFieldLocation,
@@ -329,35 +329,29 @@ function getBookingFields(
bookingFields: EventTypeOutput_2024_06_14["bookingFields"],
defaultFormValues: BookerPlatformWrapperAtomProps["defaultFormValues"] | undefined
) {
// note(Lauris): the peculiar thing about returning atom booking fields using v2 event type is that v2 event type has more possible
// booking field outputs than inputs due to default system fields that cant be passed as inputs, which is why we take v2 from response
// only the custom fields and default editable fields aka fields that can be passed as inputs for event type booking fields.
const customFields: (SystemField | CustomField)[] = bookingFields
? transformBookingFieldsApiToInternal(
bookingFields.filter((field) => isCustomField(field) || isDefaultEditableField(field))
)
: [];
const transformedBookingFields = transformBookingFieldsApiResponseToInternal(bookingFields);
const customFieldsWithoutNameEmail = customFields.filter(
(field) => field.type !== "name" && field.type !== "email"
const hasNameField = transformedBookingFields.some((field) => field.name === "name");
const hasEmailField = transformedBookingFields.some((field) => field.name === "email");
const hasLocationField = transformedBookingFields.some((field) => field.name === "location");
const hasRescheduleReasonField = transformedBookingFields.some(
(field) => field.name === "rescheduleReason"
);
const customNameField = customFields?.find((field) => field.type === "name");
const customEmailField = customFields?.find((field) => field.type === "email");
const systemBeforeFields: SystemField[] = [
customNameField || systemBeforeFieldName,
customEmailField || systemBeforeFieldEmail,
systemBeforeFieldLocation,
];
const systemAfterFields: SystemField[] = [systemAfterFieldRescheduleReason];
const transformedBookingFields: (SystemField | CustomField)[] = [
...systemBeforeFields,
...customFieldsWithoutNameEmail,
...systemAfterFields,
];
const systemBeforeFields: SystemField[] = [];
if (!hasNameField) {
systemBeforeFields.push(systemBeforeFieldName);
}
if (!hasEmailField) {
systemBeforeFields.push(systemBeforeFieldEmail);
}
if (!hasLocationField) {
systemBeforeFields.push(systemBeforeFieldLocation);
}
const systemAfterFields: SystemField[] = [];
if (!hasRescheduleReasonField) {
systemAfterFields.push(systemAfterFieldRescheduleReason);
}
// note(Lauris): in web app booking form values can be passed as url query params, but booker atom does not accept booking field values via url,
// so defaultFormValues act as a way to prefill booking form fields, and if the field in database has disableOnPrefill=true and value passed then its read only.
const defaultFormValuesKeys = defaultFormValues ? Object.keys(defaultFormValues) : [];
+1 -1
View File
@@ -126,7 +126,7 @@ export { EventTypeMetaDataSchema, userMetadata, bookingMetadataSchema } from "@c
export {
// note(Lauris): Api to internal
transformBookingFieldsApiToInternal,
transformBookingFieldsApiRequestToInternal,
transformLocationsApiToInternal,
transformIntervalLimitsApiToInternal,
transformFutureBookingLimitsApiToInternal,
@@ -110,6 +110,14 @@ export class PhoneFieldInput_2024_06_14 {
the phone field will be prefilled with this value and disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class AddressFieldInput_2024_06_14 {
@@ -149,6 +157,14 @@ export class AddressFieldInput_2024_06_14 {
the address field will be prefilled with this value and disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class TextFieldInput_2024_06_14 {
@@ -188,6 +204,14 @@ export class TextFieldInput_2024_06_14 {
the text field will be prefilled with this value and disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class NumberFieldInput_2024_06_14 {
@@ -227,6 +251,14 @@ export class NumberFieldInput_2024_06_14 {
the number field will be prefilled with this value and disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class TextAreaFieldInput_2024_06_14 {
@@ -266,6 +298,14 @@ export class TextAreaFieldInput_2024_06_14 {
the text area will be prefilled with this value and disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class SelectFieldInput_2024_06_14 {
@@ -309,6 +349,14 @@ export class SelectFieldInput_2024_06_14 {
the 'italian' will be selected and the select field will be disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class MultiSelectFieldInput_2024_06_14 {
@@ -346,6 +394,14 @@ export class MultiSelectFieldInput_2024_06_14 {
the 'en' and 'it' will be selected and the select field will be disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class MultiEmailFieldInput_2024_06_14 {
@@ -385,6 +441,14 @@ export class MultiEmailFieldInput_2024_06_14 {
the these emails will be added and none more can be added.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class CheckboxGroupFieldInput_2024_06_14 {
@@ -422,6 +486,14 @@ export class CheckboxGroupFieldInput_2024_06_14 {
the checkbox will be selected and the checkbox field will be disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class RadioGroupFieldInput_2024_06_14 {
@@ -459,6 +531,14 @@ export class RadioGroupFieldInput_2024_06_14 {
the 'italian' radio buttom will be selected and the select field will be disabled.",
})
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export class BooleanFieldInput_2024_06_14 {
@@ -486,6 +566,14 @@ export class BooleanFieldInput_2024_06_14 {
@IsOptional()
@DocsPropertyOptional({ type: Boolean })
disableOnPrefill?: boolean;
@IsBoolean()
@IsOptional()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden?: boolean;
}
export type InputBookingField_2024_06_14 =
@@ -1,7 +1,7 @@
import { BadRequestException } from "@nestjs/common";
import { ApiProperty as DocsProperty } from "@nestjs/swagger";
import { ApiProperty, ApiProperty as DocsProperty } from "@nestjs/swagger";
import { plainToInstance } from "class-transformer";
import { IsBoolean, IsString } from "class-validator";
import { IsBoolean, IsOptional, IsString } from "class-validator";
import type { ValidationOptions, ValidatorConstraintInterface } from "class-validator";
import { registerDecorator, validate, ValidatorConstraint } from "class-validator";
@@ -44,7 +44,7 @@ export class NameDefaultFieldOutput_2024_06_14 extends NameFieldInput_2024_06_14
@IsBoolean()
@DocsProperty()
required!: true;
required!: boolean;
}
export class EmailDefaultFieldOutput_2024_06_14 extends EmailFieldInput_2024_06_14 {
@@ -70,7 +70,7 @@ export class EmailDefaultFieldOutput_2024_06_14 extends EmailFieldInput_2024_06_
@IsBoolean()
@DocsProperty()
required!: true;
required!: boolean;
}
export class LocationDefaultFieldOutput_2024_06_14 {
@@ -98,7 +98,14 @@ export class LocationDefaultFieldOutput_2024_06_14 {
@IsBoolean()
@DocsProperty()
required!: false;
required!: boolean;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class RescheduleReasonDefaultFieldOutput_2024_06_14 {
@@ -124,7 +131,34 @@ export class RescheduleReasonDefaultFieldOutput_2024_06_14 {
@IsBoolean()
@DocsProperty()
required!: false;
required!: boolean;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
@IsString()
@IsOptional()
@DocsProperty()
label?: string;
@IsString()
@IsOptional()
@DocsProperty()
placeholder?: string;
@IsBoolean()
@ApiProperty({
type: Boolean,
description:
"Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value.\
For example, if URL contains query parameter `&rescheduleReason=busy`,\
the reschedule reason field will be prefilled with this value and disabled.",
})
disableOnPrefill!: boolean;
}
export class TitleDefaultFieldOutput_2024_06_14 {
@@ -150,7 +184,34 @@ export class TitleDefaultFieldOutput_2024_06_14 {
@IsBoolean()
@DocsProperty()
required!: true;
required!: boolean;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
@IsString()
@IsOptional()
@DocsProperty()
label?: string;
@IsString()
@IsOptional()
@DocsProperty()
placeholder?: string;
@IsBoolean()
@ApiProperty({
type: Boolean,
description:
"Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value.\
For example, if URL contains query parameter `&title=masterclass`,\
the title field will be prefilled with this value and disabled.",
})
disableOnPrefill!: boolean;
}
export class NotesDefaultFieldOutput_2024_06_14 {
@@ -176,7 +237,34 @@ export class NotesDefaultFieldOutput_2024_06_14 {
@IsBoolean()
@DocsProperty()
required!: false;
required!: boolean;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
@IsString()
@IsOptional()
@DocsProperty()
label?: string;
@IsString()
@IsOptional()
@DocsProperty()
placeholder?: string;
@IsBoolean()
@ApiProperty({
type: Boolean,
description:
"Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value.\
For example, if URL contains query parameter `&notes=hello`,\
the notes field will be prefilled with this value and disabled.",
})
disableOnPrefill!: boolean;
}
export class GuestsDefaultFieldOutput_2024_06_14 {
@@ -202,7 +290,34 @@ export class GuestsDefaultFieldOutput_2024_06_14 {
@IsBoolean()
@DocsProperty()
required!: false;
required!: boolean;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
@IsString()
@IsOptional()
@DocsProperty()
label?: string;
@IsString()
@IsOptional()
@DocsProperty()
placeholder?: string;
@IsBoolean()
@ApiProperty({
type: Boolean,
description:
"Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value.\
For example, if URL contains query parameter `&[email protected]`,\
the guests field will be prefilled with this value and disabled.",
})
disableOnPrefill!: boolean;
}
export class PhoneDefaultFieldOutput_2024_06_14 {
@@ -239,6 +354,13 @@ export class PhoneFieldOutput_2024_06_14 extends PhoneFieldInput_2024_06_14 {
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class AddressFieldOutput_2024_06_14 extends AddressFieldInput_2024_06_14 {
@@ -249,6 +371,13 @@ export class AddressFieldOutput_2024_06_14 extends AddressFieldInput_2024_06_14
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class TextFieldOutput_2024_06_14 extends TextFieldInput_2024_06_14 {
@@ -259,6 +388,13 @@ export class TextFieldOutput_2024_06_14 extends TextFieldInput_2024_06_14 {
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class NumberFieldOutput_2024_06_14 extends NumberFieldInput_2024_06_14 {
@@ -269,6 +405,13 @@ export class NumberFieldOutput_2024_06_14 extends NumberFieldInput_2024_06_14 {
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class TextAreaFieldOutput_2024_06_14 extends TextAreaFieldInput_2024_06_14 {
@@ -279,6 +422,13 @@ export class TextAreaFieldOutput_2024_06_14 extends TextAreaFieldInput_2024_06_1
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class SelectFieldOutput_2024_06_14 extends SelectFieldInput_2024_06_14 {
@@ -289,6 +439,13 @@ export class SelectFieldOutput_2024_06_14 extends SelectFieldInput_2024_06_14 {
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class MultiSelectFieldOutput_2024_06_14 extends MultiSelectFieldInput_2024_06_14 {
@@ -299,6 +456,13 @@ export class MultiSelectFieldOutput_2024_06_14 extends MultiSelectFieldInput_202
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class MultiEmailFieldOutput_2024_06_14 extends MultiEmailFieldInput_2024_06_14 {
@@ -309,6 +473,13 @@ export class MultiEmailFieldOutput_2024_06_14 extends MultiEmailFieldInput_2024_
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class CheckboxGroupFieldOutput_2024_06_14 extends CheckboxGroupFieldInput_2024_06_14 {
@@ -319,6 +490,13 @@ export class CheckboxGroupFieldOutput_2024_06_14 extends CheckboxGroupFieldInput
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class RadioGroupFieldOutput_2024_06_14 extends RadioGroupFieldInput_2024_06_14 {
@@ -329,6 +507,13 @@ export class RadioGroupFieldOutput_2024_06_14 extends RadioGroupFieldInput_2024_
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class BooleanFieldOutput_2024_06_14 extends BooleanFieldInput_2024_06_14 {
@@ -339,6 +524,13 @@ export class BooleanFieldOutput_2024_06_14 extends BooleanFieldInput_2024_06_14
default: false,
})
isDefault = false;
@IsBoolean()
@DocsProperty({
description:
"If true show under event type settings but don't show this booking field in the Booker. If false show in both.",
})
hidden!: boolean;
}
export class OutputUnknownBookingField_2024_06_14 {
@@ -6,7 +6,7 @@ import type {
transformIntervalLimitsApiToInternal,
transformRecurrenceApiToInternal,
transformSeatsApiToInternal,
transformBookingFieldsApiToInternal,
transformBookingFieldsApiRequestToInternal,
InternalLocationsSchema,
} from "@calcom/lib/event-types/transformers";
@@ -33,7 +33,7 @@ export type InputEventTransformed_2024_06_14 = Omit<
eventName?: string;
bookingLimits?: ReturnType<typeof transformIntervalLimitsApiToInternal>;
locations?: z.infer<typeof InternalLocationsSchema>;
bookingFields?: ReturnType<typeof transformBookingFieldsApiToInternal>;
bookingFields?: ReturnType<typeof transformBookingFieldsApiRequestToInternal>;
durationLimits?: ReturnType<typeof transformIntervalLimitsApiToInternal>;
recurringEvent?: ReturnType<typeof transformRecurrenceApiToInternal>;
eventTypeColor?: ReturnType<typeof transformEventColorsApiToInternal>;
+5806 -71
View File
File diff suppressed because it is too large. Load diff