feat: send organization_id to intercom (#14811)

* send organization_id to intercom

* send org slug instead of org id

* fix: type errors

---------

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Somay ChauhanandPeer Richelsen authored and GitHub committed 2024-04-30 21:38:18 +00:00
1 parent a18f1eb382
commit ef98105503
3 files changed
+20 -9

No files matched your search

@@ -5,6 +5,7 @@ import { ProfileRepository } from "@calcom/lib/server/repository/profile";
import { UserRepository } from "@calcom/lib/server/repository/user";
import prisma from "@calcom/prisma";
import { IdentityProvider } from "@calcom/prisma/enums";
import { userMetadata } from "@calcom/prisma/zod-utils";
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
import type { TMeInputSchema } from "./me.schema";
@@ -101,6 +102,7 @@ export const meHandler = async ({ ctx, input }: MeOptions) => {
sumOfTeamEventTypes++;
}
}
const userMetadataPrased = userMetadata.parse(user.metadata);
// Destructuring here only makes it more illegible
// pick only the part we want to expose in the API
@@ -148,6 +150,7 @@ export const meHandler = async ({ ctx, input }: MeOptions) => {
sumOfCalendars: additionalUserInfo?.selectedCalendars.length,
sumOfTeams: additionalUserInfo?.teams.length,
sumOfEventTypes: additionalUserInfo?.eventTypes.length,
isPremium: userMetadataPrased?.isPremium,
sumOfTeamEventTypes,
...(passwordAdded ? { passwordAdded } : {}),
};