Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Issues in custom event name (#19405)

Anik Dhabal Babuad2361359946
diff --git a/packages/core/event.ts b/packages/core/event.ts
index aea32029ccb..9bc17065b0b 100644
--- a/packages/core/event.ts
+++ b/packages/core/event.ts
@@ -81,21 +81,25 @@ export function getEventName(eventNameObj: EventNameObjectType, forAttendeeView
});
customInputvariables?.forEach((variable) => {
- if (eventNameObj.bookingFields) {
- Object.keys(eventNameObj.bookingFields).forEach((bookingField) => {
- if (variable === bookingField) {
- let fieldValue;
- if (eventNameObj.bookingFields) {
- const field = eventNameObj.bookingFields[bookingField as keyof typeof eventNameObj.bookingFields];
- if (field && typeof field === "object" && "value" in field) {
- fieldValue = field?.value?.toString();
- } else {
- fieldValue = field?.toString();
- }
- }
- dynamicEventName = dynamicEventName.replace(`{${variable}}`, fieldValue || "");
+ if (!eventNameObj.bookingFields) return;
+
+ const bookingFieldValue = eventNameObj.bookingFields[variable as keyof typeof eventNameObj.bookingFields];
+
+ if (bookingFieldValue) {
+ let fieldValue;
+
+ if (typeof bookingFieldValue === "object") {
+ if ("value" in bookingFieldValue) {
+ fieldValue = bookingFieldValue.value?.toString();
+ } else if (variable === "name" && "firstName" in bookingFieldValue) {
+ const lastName = "lastName" in bookingFieldValue ? bookingFieldValue.lastName : "";
+ fieldValue = `${bookingFieldValue.firstName} ${lastName}`.trim();
}
- });
+ } else {
+ fieldValue = bookingFieldValue.toString();
+ }
+
+ dynamicEventName = dynamicEventName.replace(`{${variable}}`, fieldValue || "");
}
});
diff --git a/packages/features/eventtypes/components/tabs/advanced/CustomEventTypeModal.tsx b/packages/features/eventtypes/components/tabs/advanced/CustomEventTypeModal.tsx
index e569fa65876..6f43feefbb6 100644
--- a/packages/features/eventtypes/components/tabs/advanced/CustomEventTypeModal.tsx
+++ b/packages/features/eventtypes/components/tabs/advanced/CustomEventTypeModal.tsx
@@ -152,6 +152,128 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
{t("event_duration_info")}
</p>
</div>
+ <div
+ className={classNames(
+ "mb-2.5 flex font-normal",
+ customClassNames?.availableVariables?.variableItem?.container
+ )}>
+ <p
+ className={classNames(
+ "text-subtle ml-1 mr-5 w-32",
+ customClassNames?.availableVariables?.variableItem?.variableName
+ )}>
+ {`{Organiser}`}
+ </p>
+ <p
+ className={classNames(
+ "text-emphasis",
+ customClassNames?.availableVariables?.variableItem?.variableDescription
+ )}>
+ {t("your_full_name")}
+ </p>
+ </div>
+ <div
+ className={classNames(
+ "mb-2.5 flex font-normal",
+ customClassNames?.availableVariables?.variableItem?.container
+ )}>
+ <p
+ className={classNames(
+ "text-subtle ml-1 mr-5 w-32",
+ customClassNames?.availableVariables?.variableItem?.variableName
+ )}>
+ {`{Organiser first name}`}
+ </p>
+ <p
+ className={classNames(
+ "text-emphasis",
+ customClassNames?.availableVariables?.variableItem?.variableDescription
+ )}>
+ {t("organizer_first_name")}
+ </p>
+ </div>
+ <div
+ className={classNames(
+ "mb-2.5 flex font-normal",
+ customClassNames?.availableVariables?.variableItem?.container
+ )}>
+ <p
+ className={classNames(
+ "text-subtle ml-1 mr-5 w-32",
+ customClassNames?.availableVariables?.variableItem?.variableName
+ )}>
+ {`{Scheduler}`}
+ </p>
+ <p
+ className={classNames(
+ "text-emphasis",
+ customClassNames?.availableVariables?.variableItem?.variableDescription
+ )}>
+ {t("scheduler_full_name")}
+ </p>
+ </div>
+ <div
+ className={classNames(
+ "mb-2.5 flex font-normal",
+ customClassNames?.availableVariables?.variableItem?.container
+ )}>
+ <p
+ className={classNames(
+ "text-subtle ml-1 mr-5 w-32",
+ customClassNames?.availableVariables?.variableItem?.variableName
+ )}>
+ {`{Scheduler first name}`}
+ </p>
+ <p
+ className={classNames(
+ "text-emphasis",
+ customClassNames?.availableVariables?.variableItem?.variableDescription
+ )}>
+ {t("scheduler_first_name")}
+ </p>
+ </div>
+ {isNameFieldSplit && (
+ <div
+ className={classNames(
+ "mb-2.5 flex font-normal",
+ customClassNames?.availableVariables?.variableItem?.container
+ )}>
+ <p
+ className={classNames(
+ "text-subtle ml-1 mr-5 w-32",
+ customClassNames?.availableVariables?.variableItem?.variableName
+ )}>
+ {`{Scheduler last name}`}
+ </p>
+ <p
+ className={classNames(
+ "text-emphasis",
+ customClassNames?.availableVariables?.variableItem?.variableDescription
+ )}>
+ {t("scheduler_last_name")}
+ </p>
+ </div>
+ )}
+ <div
+ className={classNames(
+ "mb-2.5 flex font-normal",
+ customClassNames?.availableVariables?.variableItem?.container
+ )}>
+ <p
+ className={classNames(
+ "text-subtle ml-1 mr-5 w-32",
+ customClassNames?.availableVariables?.variableItem?.variableName
+ )}>
+ {`{Location}`}
+ </p>
+ <p
+ className={classNames(
+ "text-emphasis",
+ customClassNames?.availableVariables?.variableItem?.variableDescription
+ )}>
+ {t("location_info")}
+ </p>
+ </div>
{/* Additional variable items here */}
{event.bookingFields && (
<p