fix: Standardize email field editable to system-but-optional (#24416)

Change email booking field's editable property from 'system' to
'system-but-optional' across all code paths. This allows email field
to be optional when phone field is required instead.

- Updated systemBeforeFieldEmail in API v2024_06_14 transformers
- Fixed explicit override in API v2024_04_15 service
- Updated test utility to match production behavior
- Ensures consistency with validation logic that requires either
  email OR phone to be visible and required

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Anik Dhabal Babu
2025-10-13 09:19:59 +00:00
committed by GitHub
co-authored by Devin AI
parent 35d140e0a7
commit b881e025f6
3 changed files with 7 additions and 3 deletions
@@ -137,7 +137,11 @@ export class EventTypesService_2024_04_15 {
!bookingFields.find((field) => field.type === "email") &&
!bookingFields.find((field) => field.type === "phone")
) {
bookingFields.push({ ...systemBeforeFieldEmail, type: BaseField.email, editable: Editable.system });
bookingFields.push({
...systemBeforeFieldEmail,
type: BaseField.email,
editable: Editable.systemButOptional,
});
}
await updateEventType({
@@ -556,7 +556,7 @@ export const systemBeforeFieldEmail: EmailSystemField = {
type: "email",
name: "email",
required: true,
editable: "system",
editable: "system-but-optional",
sources: [
{
label: "Default",
@@ -2397,7 +2397,7 @@ export const getDefaultBookingFields = ({
label: "",
hidden: false,
sources: [{ id: "default", type: "default", label: "Default" }],
editable: "system",
editable: "system-but-optional",
required: true,
placeholder: "",
defaultLabel: "email_address",