1- import short , { uuid } from "short-uuid" ;
2- import { v5 as uuidv5 } from "uuid" ;
3- import { getAuditActionSource } from "../handleNewBooking/getAuditActionSource" ;
4- import {
5- buildBookingCreatedAuditData ,
6- buildBookingRescheduledAuditData ,
7- } from "../handleNewBooking/buildBookingEventAuditData" ;
8- import type { ActionSource } from "@calcom/features/booking-audit/lib/types/actionSource" ;
1+ import process from "node:process" ;
92import processExternalId from "@calcom/app-store/_utils/calendars/processExternalId" ;
103import { getPaymentAppData } from "@calcom/app-store/_utils/payments/getPaymentAppData" ;
114import {
@@ -20,58 +13,59 @@ import {
2013} from "@calcom/app-store/locations" ;
2114import { getAppFromSlug } from "@calcom/app-store/utils" ;
2215import {
23- eventTypeMetaDataSchemaWithTypedApps ,
2416 eventTypeAppMetadataOptionalSchema ,
17+ eventTypeMetaDataSchemaWithTypedApps ,
2518} from "@calcom/app-store/zod-utils" ;
2619import dayjs from "@calcom/dayjs" ;
2720import { scheduleMandatoryReminder } from "@calcom/ee/workflows/lib/reminders/scheduleMandatoryReminder" ;
2821import getICalUID from "@calcom/emails/lib/getICalUID" ;
29- import { CalendarEventBuilder } from "@calcom/features/CalendarEventBuilder" ;
3022import { verifyCodeUnAuthenticated } from "@calcom/features/auth/lib/verifyCodeUnAuthenticated" ;
31- import { getAssignmentReasonCategory } from "@calcom/features/bookings/lib/getAssignmentReasonCategory" ;
32- import EventManager , { placeholderCreatedEvent } from "@calcom/features/bookings/lib/EventManager" ;
33- import type { BookingDataSchemaGetter } from "@calcom/features/bookings/lib/dto/types" ;
23+ import type { ActionSource } from "@calcom/features/booking-audit/lib/types/actionSource" ;
3424import type {
35- CreateRegularBookingData ,
36- CreateBookingMeta ,
25+ BookingDataSchemaGetter ,
3726 BookingHandlerInput ,
27+ CreateBookingMeta ,
28+ CreateRegularBookingData ,
3829} from "@calcom/features/bookings/lib/dto/types" ;
30+ import EventManager , { placeholderCreatedEvent } from "@calcom/features/bookings/lib/EventManager" ;
31+ import { getAssignmentReasonCategory } from "@calcom/features/bookings/lib/getAssignmentReasonCategory" ;
3932import type { CheckBookingAndDurationLimitsService } from "@calcom/features/bookings/lib/handleNewBooking/checkBookingAndDurationLimits" ;
4033import { handlePayment } from "@calcom/features/bookings/lib/handlePayment" ;
4134import { handleWebhookTrigger } from "@calcom/features/bookings/lib/handleWebhookTrigger" ;
4235import { isEventTypeLoggingEnabled } from "@calcom/features/bookings/lib/isEventTypeLoggingEnabled" ;
43- import { BookingEventHandlerService } from "@calcom/features/bookings/lib/onBookingEvents/BookingEventHandlerService" ;
36+ import type { BookingEventHandlerService } from "@calcom/features/bookings/lib/onBookingEvents/BookingEventHandlerService" ;
4437import type { BookingRescheduledPayload } from "@calcom/features/bookings/lib/onBookingEvents/types.d" ;
45- import { BookingEmailAndSmsTasker } from "@calcom/features/bookings/lib/tasker/BookingEmailAndSmsTasker" ;
38+ import type { BookingEmailAndSmsTasker } from "@calcom/features/bookings/lib/tasker/BookingEmailAndSmsTasker" ;
39+ import { CalendarEventBuilder } from "@calcom/features/CalendarEventBuilder" ;
4640import { getSpamCheckService } from "@calcom/features/di/watchlist/containers/SpamCheckService.container" ;
4741import { CreditService } from "@calcom/features/ee/billing/credit-service" ;
4842import { getBookerBaseUrl } from "@calcom/features/ee/organizations/lib/getBookerUrlServer" ;
49- import { getRoutingTraceService } from "@calcom/features/routing-trace/di/RoutingTraceService.container" ;
5043import AssignmentReasonRecorder from "@calcom/features/ee/round-robin/assignmentReason/AssignmentReasonRecorder" ;
5144import { BookingLocationService } from "@calcom/features/ee/round-robin/lib/bookingLocationService" ;
5245import { getAllWorkflowsFromEventType } from "@calcom/features/ee/workflows/lib/getAllWorkflowsFromEventType" ;
5346import { WorkflowService } from "@calcom/features/ee/workflows/lib/service/WorkflowService" ;
5447import { WorkflowRepository } from "@calcom/features/ee/workflows/repositories/WorkflowRepository" ;
5548import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents" ;
5649import { getEventName , updateHostInEventName } from "@calcom/features/eventtypes/lib/eventNaming" ;
57- import { FeaturesRepository } from "@calcom/features/flags/features.repository" ;
50+ import type { FeaturesRepository } from "@calcom/features/flags/features.repository" ;
5851import { getFullName } from "@calcom/features/form-builder/utils" ;
5952import type { HashedLinkService } from "@calcom/features/hashedLink/lib/service/HashedLinkService" ;
6053import { ProfileRepository } from "@calcom/features/profile/repositories/ProfileRepository" ;
54+ import { getRoutingTraceService } from "@calcom/features/routing-trace/di/RoutingTraceService.container" ;
6155import { handleAnalyticsEvents } from "@calcom/features/tasker/tasks/analytics/handleAnalyticsEvents" ;
6256import type { UserRepository } from "@calcom/features/users/repositories/UserRepository" ;
6357import { UsersRepository } from "@calcom/features/users/users.repository" ;
6458import type { GetSubscriberOptions } from "@calcom/features/webhooks/lib/getWebhooks" ;
6559import getWebhooks from "@calcom/features/webhooks/lib/getWebhooks" ;
6660import {
67- deleteWebhookScheduledTriggers ,
6861 cancelNoShowTasksForBooking ,
62+ deleteWebhookScheduledTriggers ,
6963 scheduleTrigger ,
7064} from "@calcom/features/webhooks/lib/scheduleTrigger" ;
7165import type { EventPayloadType , EventTypeInfo } from "@calcom/features/webhooks/lib/sendPayload" ;
72- import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser" ;
7366import { groupHostsByGroupId } from "@calcom/lib/bookings/hostGroupUtils" ;
7467import { shouldIgnoreContactOwner } from "@calcom/lib/bookings/routing/utils" ;
68+ import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser" ;
7569import { DEFAULT_GROUP_ID , ENABLE_ASYNC_TASKER } from "@calcom/lib/constants" ;
7670import { ErrorCode } from "@calcom/lib/errorCodes" ;
7771import { ErrorWithCode } from "@calcom/lib/errors" ;
@@ -87,36 +81,43 @@ import { getTranslation } from "@calcom/lib/server/i18n";
8781import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat" ;
8882import { distributedTracing } from "@calcom/lib/tracing/factory" ;
8983import type { PrismaClient } from "@calcom/prisma" ;
90- import type { DestinationCalendar , Prisma , User , AssignmentReasonEnum } from "@calcom/prisma/client" ;
84+ import type { AssignmentReasonEnum , DestinationCalendar , Prisma , User } from "@calcom/prisma/client" ;
9185import {
9286 BookingStatus ,
87+ CreationSource ,
9388 SchedulingType ,
9489 WebhookTriggerEvents ,
9590 WorkflowTriggerEvents ,
96- CreationSource ,
9791} from "@calcom/prisma/enums" ;
9892import { userMetadata as userMetadataSchema } from "@calcom/prisma/zod-utils" ;
9993import type {
10094 AdditionalInformation ,
10195 AppsStatus ,
102- CalendarEvent ,
10396 CalEventResponses ,
97+ CalendarEvent ,
10498} from "@calcom/types/Calendar" ;
10599import type { CredentialForCalendarService } from "@calcom/types/Credential" ;
106100import type { EventResult , PartialReference } from "@calcom/types/EventManager" ;
107-
101+ import short , { uuid } from "short-uuid" ;
102+ import { v5 as uuidv5 } from "uuid" ;
108103import type { BookingRepository } from "../../repositories/BookingRepository" ;
109- import { BookingActionMap , BookingEmailSmsHandler , type BookingActionType } from "../BookingEmailSmsHandler" ;
104+ import { BookingActionMap , type BookingActionType , BookingEmailSmsHandler } from "../BookingEmailSmsHandler" ;
110105import { getAllCredentialsIncludeServiceAccountKey } from "../getAllCredentialsForUsersOnEvent/getAllCredentials" ;
111106import { refreshCredentials } from "../getAllCredentialsForUsersOnEvent/refreshCredentials" ;
112107import getBookingDataSchema from "../getBookingDataSchema" ;
113- import { LuckyUserService } from "../getLuckyUser" ;
108+ import type { LuckyUserService } from "../getLuckyUser" ;
114109import { addVideoCallDataToEvent } from "../handleNewBooking/addVideoCallDataToEvent" ;
110+ import {
111+ buildBookingCreatedAuditData ,
112+ buildBookingRescheduledAuditData ,
113+ } from "../handleNewBooking/buildBookingEventAuditData" ;
115114import { checkActiveBookingsLimitForBooker } from "../handleNewBooking/checkActiveBookingsLimitForBooker" ;
116115import { checkIfBookerEmailIsBlocked } from "../handleNewBooking/checkIfBookerEmailIsBlocked" ;
117- import { createBooking } from "../handleNewBooking/createBooking" ;
118116import type { Booking } from "../handleNewBooking/createBooking" ;
117+ import { createBooking } from "../handleNewBooking/createBooking" ;
119118import { ensureAvailableUsers } from "../handleNewBooking/ensureAvailableUsers" ;
119+ import { getAuditActionSource } from "../handleNewBooking/getAuditActionSource" ;
120+ import { getBookingAuditActorForNewBooking } from "../handleNewBooking/getBookingAuditActorForNewBooking" ;
120121import { getBookingData } from "../handleNewBooking/getBookingData" ;
121122import { getCustomInputsResponses } from "../handleNewBooking/getCustomInputsResponses" ;
122123import { getEventType } from "../handleNewBooking/getEventType" ;
@@ -127,15 +128,14 @@ import { getSeatedBooking } from "../handleNewBooking/getSeatedBooking";
127128import { getVideoCallDetails } from "../handleNewBooking/getVideoCallDetails" ;
128129import { handleAppsStatus } from "../handleNewBooking/handleAppsStatus" ;
129130import { loadAndValidateUsers } from "../handleNewBooking/loadAndValidateUsers" ;
130- import { getOriginalRescheduledBooking } from "../handleNewBooking/originalRescheduledBookingUtils" ;
131131import type { BookingType } from "../handleNewBooking/originalRescheduledBookingUtils" ;
132+ import { getOriginalRescheduledBooking } from "../handleNewBooking/originalRescheduledBookingUtils" ;
132133import { scheduleNoShowTriggers } from "../handleNewBooking/scheduleNoShowTriggers" ;
133134import type { IEventTypePaymentCredentialType , Invitee , IsFixedAwareUser } from "../handleNewBooking/types" ;
134135import { validateBookingTimeIsNotOutOfBounds } from "../handleNewBooking/validateBookingTimeIsNotOutOfBounds" ;
135136import { validateEventLength } from "../handleNewBooking/validateEventLength" ;
136137import handleSeats from "../handleSeats/handleSeats" ;
137138import type { IBookingService } from "../interfaces/IBookingService" ;
138- import { getBookingAuditActorForNewBooking } from "../handleNewBooking/getBookingAuditActorForNewBooking" ;
139139import { isWithinMinimumRescheduleNotice } from "../reschedule/isWithinMinimumRescheduleNotice" ;
140140
141141const translator = short ( ) ;
@@ -1305,7 +1305,7 @@ async function handler(
13051305 const isManagedEventType = ! ! eventType . parentId ;
13061306
13071307 // Track credential ID for per-host locations
1308- let perHostCredentialId : number | undefined = undefined ;
1308+ let perHostCredentialId : number | undefined ;
13091309
13101310 // Handle per-host custom locations for round-robin events
13111311 if (
@@ -2498,8 +2498,9 @@ async function handler(
24982498
24992499 const webhookLocation = metadata ?. videoCallUrl || evt . location ;
25002500
2501+ const { assignmentReason : _emailAssignmentReason , ...evtWithoutAssignmentReason } = evt ;
25012502 const webhookData : EventPayloadType = {
2502- ...evt ,
2503+ ...evtWithoutAssignmentReason ,
25032504 ...eventTypeInfo ,
25042505 bookingId : booking ?. id ,
25052506 rescheduleId : originalRescheduledBooking ?. id || undefined ,
0 commit comments