feat: Implement Dub.co for conversion tracking (#16165)

* FEAT: Implement Dub.co for conversion tracking

* add link creation, @vercel/functions

* use refer.cal.com/:username instead of go.cal.com/r/:username

* sale conversion tracking

* add copy referral link

* limit to IS_CALCOM only

* Update yarn.lock

* fix DubAnalytics

* use workaround for isNewUser

* pass req to getOptions

* Update next-auth-options.ts

* fix ts errors

* only show DubAnalytics outside EU

* add Dub Analytics to /signup

* use WEBSITE_URL instead

* on-demand generate links

* add migration

* add check for existing link + change fetch method to poast

* remove refer.cal.com from PoweredByCal

* limit DubAnalytics to /signup only

* simplify generate-referral-link

* restore yarn.lock

* add yarn with dub sdk in

* add yarn with dub sdk in

* yarn

* Update yarn.lock

---------

Co-authored-by: sean <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-09-12 12:33:10 -07:00
1 parent f4bc7d2ea4
commit cf16cd3ed2
49 files changed
+1548 -120

No files matched your search

@@ -1,10 +1,9 @@
import type { PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { getServerSession } from "next-auth";
import { notFound } from "next/navigation";
import { AUTH_OPTIONS } from "@calcom/features/auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import { ScheduleRepository } from "@calcom/lib/server/repository/schedule";
import { TravelScheduleRepository } from "@calcom/lib/server/repository/travelSchedule";
import { UserRepository } from "@calcom/lib/server/repository/user";
@@ -34,7 +33,7 @@ const Page = async ({ params }: PageProps) => {
}
const scheduleId = Number(params.schedule);
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const userId = session?.user?.id;
if (!userId) {
notFound();
+2 -3
View File
@@ -1,9 +1,8 @@
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { getServerSession } from "next-auth";
import { notFound } from "next/navigation";
import { AUTH_OPTIONS } from "@calcom/features/auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
import AvailabilityPage from "~/availability/availability-view";
@@ -16,7 +15,7 @@ export const generateMetadata = async () => {
};
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const userId = session?.user?.id;
const orgId = session?.user?.org?.id;
if (!userId || !orgId) {