fix: Allow attendee first and last name from attendee name when name … (#11287)
parent
59c0a71db7
commit
d65f0ee0e8
|
@ -48,14 +48,27 @@ const customTemplate = (
|
|||
|
||||
const currentTimeFormat = timeFormat || TimeFormat.TWELVE_HOUR;
|
||||
|
||||
const attendeeNameWords = variables.attendeeName?.trim().split(" ");
|
||||
const attendeeNameWordCount = attendeeNameWords?.length ?? 0;
|
||||
|
||||
const attendeeFirstName = variables.attendeeFirstName
|
||||
? variables.attendeeFirstName
|
||||
: attendeeNameWords?.[0] ?? "";
|
||||
|
||||
const attendeeLastName = variables.attendeeLastName
|
||||
? variables.attendeeLastName
|
||||
: attendeeNameWordCount > 1
|
||||
? attendeeNameWords![attendeeNameWordCount - 1]
|
||||
: "";
|
||||
|
||||
let dynamicText = text
|
||||
.replaceAll("{EVENT_NAME}", variables.eventName || "")
|
||||
.replaceAll("{ORGANIZER}", variables.organizerName || "")
|
||||
.replaceAll("{ATTENDEE}", variables.attendeeName || "")
|
||||
.replaceAll("{ORGANIZER_NAME}", variables.organizerName || "") //old variable names
|
||||
.replaceAll("{ATTENDEE_NAME}", variables.attendeeName || "") //old variable names
|
||||
.replaceAll("{ATTENDEE_FIRST_NAME}", variables.attendeeFirstName || "")
|
||||
.replaceAll("{ATTENDEE_LAST_NAME}", variables.attendeeLastName || "")
|
||||
.replaceAll("{ATTENDEE_FIRST_NAME}", attendeeFirstName)
|
||||
.replaceAll("{ATTENDEE_LAST_NAME}", attendeeLastName)
|
||||
.replaceAll("{EVENT_DATE}", translatedDate)
|
||||
.replaceAll("{EVENT_TIME}", variables.eventDate?.format(currentTimeFormat) || "")
|
||||
.replaceAll("{START_TIME}", variables.eventDate?.format(currentTimeFormat) || "")
|
||||
|
|
Loading…
Reference in New Issue