fix: Issues in custom event name (#19405)
* fix: Issues in custom event name * Update event.ts
This commit is contained in:
+18
-14
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user