+4


![depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>](/assets/img/avatar_default.png)






Carina Wollendorfer
GitHub
CarinaWolli
Alex van Andel
Bailey Pumfleet
zomars
depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
sean-brydon
Hariom Balhara
Joe Au-Yeung
iamkun
Agusti Fernandez Pardo
Agusti Fernandez Pardo
kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
4b6c701c48
* move custom inputs from description to own json object * show custom inputs on success page * fix type error * add custom inputs to email and webhook * add custom inputs to all emails * add values for custom inputs when rescheduling * add custom input everywhere description is shown * fix bug with boolean value * fix issues with null values * disable custom inputs and add notes for organizer * don't show custom input with empty string * don't show custom inputs with empty string in calender event and email * add link to booking details page * redirect to success page to see booking details * add functionality to cancel and reschedule booking * fix bookings that require confirmation * clean code * fix infinite lopp in useEffect of success page * show web conference details message when integration as location * improve design of cancelling event * clean code * disable darkmode for organizer on booking details page * fix dark mode for cancelling booking * fix build error * Fixes infinite loop * Fixes infinite loop * Fixes infinite loop * Update all Yarn dependencies (2022-05-16) (#2769) * Update all Yarn dependencies (2022-05-16) * Upgrade dependencies * Removes deprecated packages * Upgrades deps * Updates submodules * Update yarn.lock * Linting * Linting * Update website * Build fixes * TODO: fix this * Module resolving * Type fixes * Intercom fixes on SSG * Fixes infinite loop * Upgrades to React 18 * Type fixes * Locks node version to 14 * Upgrades daily-js * Readds missing types * Upgrades playwright * Noop when intercom is not installed * Update website * Removed yarn.lock in favor of monorepo Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com> * Create ci.yml * Update ci.yml * Reintroduces typescript-eslint Buckle up! * Type fixes * Update ci.yml * Update api * Update admin * Reusable inferSSRProps * Linting * Linting * Prisma fixes * Update ci.yml * Cache testing * Update e2e.yml * Update DatePicker.tsx * Update e2e.yml * Revert "Linting" This reverts commitadf817766e. * Revert "Linting" This reverts commit1b59dacd64. * Linting * Update e2e.yml * Ci updates * Add team Id to hash url (#2803) * Fix missing tabs - Embed (#2804) * Fix missing tabs * Fix Eslint error * Fix Eslint errors * Add import statement (#2812) * Add import statement * Update apps/docs/next.config.js Co-authored-by: Omar López <zomars@me.com> * Show success page if booking was deleted on calendar (#2808) * Add exception to 410 * Fix type error * Add GoogelCalError type * only show invite link for app.cal.dev (#2807) Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Omar López <zomars@me.com> * fix: update eslint config to test .ts and .js separately (#2805) * fix: update eslint config * fix: update ts ignore * fix: update eslint config * Update TeamAvailabilityScreen.tsx * Type fixes * Update useIntercom.ts Co-authored-by: Omar López <zomars@me.com> * fix: sync api to latest commit (#2810) Co-authored-by: Agusti Fernandez Pardo <git@agusti.me> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * Embed React improvements (#2782) * Add off support. Add getApi export. * Add publish command * Add embed-snippet in prod deps * Update README * Update package.json Co-authored-by: Bailey Pumfleet <pumfleet@hey.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * Consolidates test-results * Type fixes * Abstracts minimal booking select * Type fixes * Update listBookings.ts * Update common.json * Update bookingReminder.ts * Consolidates isOutOfBounds * Update webhookResponse-chromium.txt * Update TableActions.tsx * Type fixes * Update BookingPage.tsx * Update webhookResponse-chromium.txt Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Bailey Pumfleet <pumfleet@hey.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: iamkun <kunhello@outlook.com> Co-authored-by: Agusti Fernandez Pardo <me@agusti.me> Co-authored-by: Agusti Fernandez Pardo <git@agusti.me> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
148 lines
3.7 KiB
TypeScript
148 lines
3.7 KiB
TypeScript
import { Person } from "ics";
|
|
import short from "short-uuid";
|
|
import { v5 as uuidv5 } from "uuid";
|
|
|
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
|
|
|
import { WEBAPP_URL } from "./constants";
|
|
|
|
const translator = short();
|
|
|
|
// The odd indentation in this file is necessary because otherwise the leading tabs will be applied into the event description.
|
|
|
|
export const getWhat = (calEvent: CalendarEvent) => {
|
|
return `
|
|
${calEvent.organizer.language.translate("what")}:
|
|
${calEvent.type}
|
|
`;
|
|
};
|
|
|
|
export const getWhen = (calEvent: CalendarEvent) => {
|
|
return `
|
|
${calEvent.organizer.language.translate("invitee_timezone")}:
|
|
${calEvent.attendees[0].timeZone}
|
|
`;
|
|
};
|
|
|
|
export const getWho = (calEvent: CalendarEvent) => {
|
|
const attendees = calEvent.attendees
|
|
.map((attendee) => {
|
|
return `
|
|
${attendee?.name || calEvent.organizer.language.translate("guest")}
|
|
${attendee.email}
|
|
`;
|
|
})
|
|
.join("");
|
|
|
|
const organizer = `
|
|
${calEvent.organizer.name} - ${calEvent.organizer.language.translate("organizer")}
|
|
${calEvent.organizer.email}
|
|
`;
|
|
|
|
return `
|
|
${calEvent.organizer.language.translate("who")}:
|
|
${organizer + attendees}
|
|
`;
|
|
};
|
|
|
|
export const getAdditionalNotes = (calEvent: CalendarEvent) => {
|
|
if (!calEvent.additionalNotes) {
|
|
return "";
|
|
}
|
|
return `
|
|
${calEvent.organizer.language.translate("additional_notes")}:
|
|
${calEvent.additionalNotes}
|
|
`;
|
|
};
|
|
|
|
export const getCustomInputs = (calEvent: CalendarEvent) => {
|
|
if (!calEvent.customInputs) {
|
|
return "";
|
|
}
|
|
const customInputsString = Object.keys(calEvent.customInputs)
|
|
.map((key) => {
|
|
if (!calEvent.customInputs) return "";
|
|
if (calEvent.customInputs[key] !== "") {
|
|
return `
|
|
${key}:
|
|
${calEvent.customInputs[key]}
|
|
`;
|
|
}
|
|
})
|
|
.join("");
|
|
|
|
return customInputsString;
|
|
};
|
|
|
|
export const getDescription = (calEvent: CalendarEvent) => {
|
|
if (!calEvent.description) {
|
|
return "";
|
|
}
|
|
return `\n${calEvent.attendees[0].language.translate("description")}
|
|
${calEvent.description}
|
|
`;
|
|
};
|
|
export const getLocation = (calEvent: CalendarEvent) => {
|
|
let providerName = "";
|
|
|
|
if (calEvent.location && calEvent.location.includes("integrations:")) {
|
|
const location = calEvent.location.split(":")[1];
|
|
providerName = location[0].toUpperCase() + location.slice(1);
|
|
}
|
|
|
|
if (calEvent.videoCallData) {
|
|
return calEvent.videoCallData.url;
|
|
}
|
|
|
|
if (calEvent.additionInformation?.hangoutLink) {
|
|
return calEvent.additionInformation.hangoutLink;
|
|
}
|
|
|
|
return providerName || calEvent.location || "";
|
|
};
|
|
|
|
export const getManageLink = (calEvent: CalendarEvent) => {
|
|
return `
|
|
${calEvent.organizer.language.translate("need_to_reschedule_or_cancel")}
|
|
${getCancelLink(calEvent)}
|
|
`;
|
|
};
|
|
|
|
export const getUid = (calEvent: CalendarEvent): string => {
|
|
return calEvent.uid ?? translator.fromUUID(uuidv5(JSON.stringify(calEvent), uuidv5.URL));
|
|
};
|
|
|
|
export const getCancelLink = (calEvent: CalendarEvent): string => {
|
|
return WEBAPP_URL + "/cancel/" + getUid(calEvent);
|
|
};
|
|
|
|
export const getRichDescription = (calEvent: CalendarEvent, attendee?: Person) => {
|
|
// Only the original attendee can make changes to the event
|
|
// Guests cannot
|
|
|
|
if (attendee && attendee === calEvent.attendees[0]) {
|
|
return `
|
|
${getWhat(calEvent)}
|
|
${getWhen(calEvent)}
|
|
${getWho(calEvent)}
|
|
${calEvent.organizer.language.translate("where")}:
|
|
${getLocation(calEvent)}
|
|
${getDescription(calEvent)}
|
|
${getAdditionalNotes(calEvent)}
|
|
${getCustomInputs(calEvent)}
|
|
`.trim();
|
|
}
|
|
|
|
return `
|
|
${getWhat(calEvent)}
|
|
${getWhen(calEvent)}
|
|
${getWho(calEvent)}
|
|
${calEvent.organizer.language.translate("where")}:
|
|
${getLocation(calEvent)}
|
|
${getDescription(calEvent)}
|
|
${getAdditionalNotes(calEvent)}
|
|
${getCustomInputs(calEvent)}
|
|
${getManageLink(calEvent)}
|
|
`.trim();
|
|
};
|