feat: add utm tracking on booking (#19965)
* add tracking to booking + pass to handleNewBooking * save tracking to booking * return undefined if no utm params * add test for handleNewBooking * fix type error in test * refactor code * code clean up * code clean up * add missing import * fix type import * add utm params to insights (#20063) * add utm params to insights * remove duplicates * remove duplicate columns --------- Co-authored-by: CarinaWolli <[email protected]> --------- Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Omar López <[email protected]>
This commit is contained in:
16 files changed
+354
-4
No files matched your search
@@ -10,6 +10,7 @@ import { expect, vi } from "vitest";
|
||||
import "vitest-fetch-mock";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import type { Tracking } from "@calcom/features/bookings/lib/handleNewBooking/types";
|
||||
import { WEBSITE_URL } from "@calcom/lib/constants";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
@@ -428,6 +429,18 @@ export async function expectBookingToBeInDatabase(
|
||||
);
|
||||
}
|
||||
|
||||
export async function expectBookingTrackingToBeInDatabase(tracking: Tracking, uid?: string) {
|
||||
const actualBooking = await prismaMock.booking.findUnique({
|
||||
where: {
|
||||
uid,
|
||||
},
|
||||
select: {
|
||||
tracking: true,
|
||||
},
|
||||
});
|
||||
expect(actualBooking?.tracking).toEqual(expect.objectContaining(tracking));
|
||||
}
|
||||
|
||||
export function expectSMSToBeTriggered({ sms, toNumber }: { sms: Fixtures["sms"]; toNumber: string }) {
|
||||
expect(sms.get()).toEqual(
|
||||
expect.arrayContaining([
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getDate } from "@calcom/web/test/utils/bookingScenario/bookingScenario";
|
||||
|
||||
import type { Tracking } from "@calcom/features/bookings/lib/handleNewBooking/types";
|
||||
import type { SchedulingType } from "@calcom/prisma/client";
|
||||
import type { CreationSource } from "@calcom/prisma/enums";
|
||||
|
||||
@@ -42,6 +43,7 @@ export function getMockRequestDataForBooking({
|
||||
eventTypeId: number;
|
||||
user?: string;
|
||||
creationSource?: CreationSource;
|
||||
tracking?: Tracking;
|
||||
} & CommonPropsMockRequestData;
|
||||
}) {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user