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,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import AdminAppsList from "@calcom/features/apps/AdminAppsList";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
@@ -13,7 +12,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import ImpersonationView from "~/settings/admin/impersonation-view";
@@ -14,7 +13,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
return (
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import AdminOrgTable from "@calcom/features/ee/organizations/pages/settings/admin/AdminOrgPage";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
@@ -14,7 +13,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
return (
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import BillingView from "~/settings/billing/billing-view";
@@ -14,7 +13,8 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
// FIXME: Refactor me once next-auth endpoint is migrated to App Router
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,7 +1,6 @@
import { getFixedT, _generateMetadata } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import { APP_NAME } from "@calcom/lib/constants";
@@ -15,7 +14,8 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
// FIXME: Refactor me once next-auth endpoint is migrated to App Router
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,8 +1,7 @@
import type { PageProps } from "app/_types";
import { getFixedT, _generateMetadata } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import { EditWebhookView } from "@calcom/features/webhooks/pages/webhook-edit-view";
import { APP_NAME } from "@calcom/lib/constants";
@@ -15,7 +14,7 @@ export const generateMetadata = async () =>
);
const Page = async ({ params }: PageProps) => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
const id = typeof params?.id === "string" ? params.id : undefined;
@@ -1,7 +1,6 @@
import { getFixedT, _generateMetadata } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import { NewWebhookView } from "@calcom/features/webhooks/pages/webhook-new-view";
import { APP_NAME } from "@calcom/lib/constants";
@@ -13,7 +12,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import AppearancePage from "~/settings/my-account/appearance-view";
@@ -14,7 +13,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
return (
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import { Button } from "@calcom/ui";
@@ -15,7 +14,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
const AddCalendarButton = () => {
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import { Button } from "@calcom/ui";
@@ -15,7 +14,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
const AddConferencingButton = () => {
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import GeneralQueryView from "~/settings/my-account/general-view";
@@ -14,7 +13,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
return (
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import CreateNewOutOfOfficeEntryButton from "@calcom/features/settings/outOfOffice/CreateNewOutOfOfficeEntryButton";
import { OutOfOfficeEntriesList } from "@calcom/features/settings/outOfOffice/OutOfOfficeEntriesList";
@@ -14,7 +13,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import { APP_NAME } from "@calcom/lib/constants";
@@ -15,7 +14,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
return (
@@ -1,7 +1,6 @@
import { getFixedT, _generateMetadata } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import { AdminAPIView } from "@calcom/features/ee/organizations/pages/settings/admin-api";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
@@ -12,7 +11,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,7 +1,6 @@
import { _generateMetadata, getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
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 DirectorySyncTeamView from "@calcom/features/ee/dsync/page/team-dsync-view";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
@@ -12,7 +11,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
return (
@@ -1,7 +1,6 @@
import { _generateMetadata, getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
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 PrivacyView from "@calcom/features/ee/organizations/pages/settings/privacy";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
@@ -12,7 +11,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
return (
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import ProfileImpersonationViewWrapper from "~/settings/security/impersonation-view";
@@ -14,7 +13,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import PasswordViewWrapper from "~/settings/security/password-view";
@@ -14,7 +13,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SAMLSSO from "@calcom/features/ee/sso/page/user-sso-view";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
@@ -13,7 +12,7 @@ export const generateMetadata = async () =>
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");
@@ -1,8 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getFixedT } from "app/_utils";
import { getServerSession } from "next-auth";
import { AUTH_OPTIONS } from "@calcom/feature-auth/lib/next-auth-options";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import TwoFactorAuthView from "~/settings/security/two-factor-auth-view";
@@ -13,7 +12,7 @@ export const generateMetadata = async () =>
(t) => t("add_an_extra_layer_of_security")
);
const Page = async () => {
const session = await getServerSession(AUTH_OPTIONS);
const session = await getServerSessionForAppDir();
const t = await getFixedT(session?.user.locale || "en");