fix: Issues in custom event name (#19405)

* fix: Issues in custom event name

* Update event.ts
This commit is contained in:
Anik Dhabal Babu
2025-02-21 15:25:48 +00:00
committed by GitHub
parent 71598a4389
commit ad23613599
2 changed files with 140 additions and 14 deletions
+18 -14
View File
@@ -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 || "");
}
});
@@ -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