feat: booking with phone number (#14461)

Co-authored-by: Omar López <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-09-11 17:56:04 -07:00
1 parent 74a9f3c19e
commit 4a59841b02
85 files changed
+2078 -274

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import type Stripe from "stripe";
import stripe from "@calcom/app-store/stripepayment/lib/server";
import EventManager from "@calcom/core/EventManager";
import { sendAttendeeRequestEmail, sendOrganizerRequestEmail } from "@calcom/emails";
import { sendAttendeeRequestEmailAndSMS, sendOrganizerRequestEmail } from "@calcom/emails";
import { doesBookingRequireConfirmation } from "@calcom/features/bookings/lib/doesBookingRequireConfirmation";
import { handleConfirmation } from "@calcom/features/bookings/lib/handleConfirmation";
import { IS_PRODUCTION } from "@calcom/lib/constants";
@@ -108,7 +108,7 @@ const handleSetupSuccess = async (event: Stripe.Event) => {
});
} else {
await sendOrganizerRequestEmail({ ...evt }, eventType.metadata);
await sendAttendeeRequestEmail({ ...evt }, evt.attendees[0], eventType.metadata);
await sendAttendeeRequestEmailAndSMS({ ...evt }, evt.attendees[0], eventType.metadata);
}
};
@@ -5,7 +5,7 @@ import { OrganizerDefaultConferencingAppType, getLocationValueForDB } from "@cal
import EventManager from "@calcom/core/EventManager";
import { getEventName } from "@calcom/core/event";
import dayjs from "@calcom/dayjs";
import { sendRoundRobinCancelledEmails, sendRoundRobinScheduledEmails } from "@calcom/emails";
import { sendRoundRobinCancelledEmailsAndSMS, sendRoundRobinScheduledEmailsAndSMS } from "@calcom/emails";
import getBookingResponsesSchema from "@calcom/features/bookings/lib/getBookingResponsesSchema";
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
import { ensureAvailableUsers } from "@calcom/features/bookings/lib/handleNewBooking/ensureAvailableUsers";
@@ -202,6 +202,7 @@ export const roundRobinReassignment = async ({ bookingId }: { bookingId: number
name: attendee.name,
timeZone: attendee.timeZone,
language: { translate: tAttendee, locale: attendee.locale ?? "en" },
phoneNumber: attendee.phoneNumber || undefined,
}))
);
}
@@ -369,7 +370,7 @@ export const roundRobinReassignment = async ({ bookingId }: { bookingId: number
});
// Send to new RR host
await sendRoundRobinScheduledEmails(evt, [
await sendRoundRobinScheduledEmailsAndSMS(evt, [
{
...reassignedRRHost,
name: reassignedRRHost.name || "",
@@ -410,7 +411,7 @@ export const roundRobinReassignment = async ({ bookingId }: { bookingId: number
});
}
await sendRoundRobinCancelledEmails(
await sendRoundRobinCancelledEmailsAndSMS(
cancelledRRHostEvt,
[
{
@@ -38,6 +38,8 @@ export const sendSMS = async (
teamId?: number | null,
whatsapp = false
) => {
log.silly("sendSMS", JSON.stringify({ phoneNumber, body, sender, userId, teamId }));
const isSMSSendingLocked = await isLockedForSMSSending(userId, teamId);
if (isSMSSendingLocked) {
@@ -29,6 +29,7 @@ export type AttendeeInBookingInfo = {
firstName?: string;
lastName?: string;
email: string;
phoneNumber?: string | null;
timeZone: string;
language: { locale: string };
};