Files
calendar/packages/features/settings/appDir/SettingsLayoutAppDir.tsx
T
cf16cd3ed2 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 <sean@brydon.io>
Co-authored-by: Peer Richelsen <peer@cal.com>
2024-09-12 12:33:10 -07:00

37 lines
1.2 KiB
TypeScript

import dynamic from "next/dynamic";
import React from "react";
import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
import type { SettingsLayoutProps } from "./SettingsLayoutAppDirClient";
const SettingsLayoutAppDirClient = dynamic(() => import("./SettingsLayoutAppDirClient"), {
ssr: false,
});
type SettingsLayoutAppDir = Omit<SettingsLayoutProps, "currentOrg" | "otherTeams">;
export default async function SettingsLayoutAppDir(props: SettingsLayoutAppDir) {
const session = await getServerSessionForAppDir();
const userId = session?.user?.id ?? -1;
const orgId = session?.user?.org?.id ?? -1;
let currentOrg = null;
let otherTeams = null;
try {
currentOrg = await OrganizationRepository.findCurrentOrg({ userId, orgId });
} catch (err) {}
try {
otherTeams = await OrganizationRepository.findTeamsInOrgIamNotPartOf({
userId,
parentId: orgId,
});
} catch (err) {}
return <SettingsLayoutAppDirClient {...props} currentOrg={currentOrg} otherTeams={otherTeams} />;
}
export const getLayout = async (page: React.ReactElement) => await SettingsLayoutAppDir({ children: page });