* experiment: cold start perf * fix: update failing test * chore: add database indexes * chore: use json protocol and add query batching back * Update [status].tsx * Update [trpc].ts * Delete getSlimSession.ts * Update createContext.ts * remove trpc caller * correctly import Prisma * lazy ethRouter * replace crypto with md5 * import fixes * public event endpoint refactor * Update yarn.lock * Update yarn.lock * Using yarn.lock from main --------- Co-authored-by: Omar López <zomars@me.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Efraín Rochín <roae.85@gmail.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { getWorkflowActionOptions } from "@calcom/features/ee/workflows/lib/getOptions";
|
|
import { IS_SELF_HOSTED } from "@calcom/lib/constants";
|
|
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
|
|
import { getTranslation } from "@calcom/lib/server/i18n";
|
|
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
|
|
|
|
import { hasTeamPlanHandler } from "../teams/hasTeamPlan.handler";
|
|
|
|
type GetWorkflowActionOptionsOptions = {
|
|
ctx: {
|
|
user: NonNullable<TrpcSessionUser> & {
|
|
locale: string;
|
|
};
|
|
};
|
|
};
|
|
|
|
export const getWorkflowActionOptionsHandler = async ({ ctx }: GetWorkflowActionOptionsOptions) => {
|
|
const { user } = ctx;
|
|
|
|
const isCurrentUsernamePremium = user && user.metadata && hasKeyInMetadata(user, "isPremium");
|
|
|
|
let isTeamsPlan = false;
|
|
if (!isCurrentUsernamePremium) {
|
|
const { hasTeamPlan } = await hasTeamPlanHandler({ ctx });
|
|
isTeamsPlan = !!hasTeamPlan;
|
|
}
|
|
const t = await getTranslation(ctx.user.locale, "common");
|
|
return getWorkflowActionOptions(t, IS_SELF_HOSTED || isCurrentUsernamePremium || isTeamsPlan);
|
|
};
|