perf: Remove circular dependencies - wip (#24586)

* wip

* refactor(emails): remove circular dependencies from packages/emails

- Extract renderEmail imports to use direct path (../src/renderEmail) instead of index
- Create utility files for shared types and functions:
  - lib/utils/team-invite-utils.ts: TeamInvite type and utility functions
  - lib/utils/booking-redirect-types.ts: IBookingRedirect type
  - lib/utils/email-types.ts: OrganizationCreation and EmailVerifyCode types
  - lib/utils/date-formatting.ts: getFormattedDate utility function
- Update all template files to import renderEmail directly from ../src/renderEmail
- Update React template components to import from utility files instead of class templates
- This eliminates all circular dependencies within packages/emails (reduced from 234 to 0 internal circular deps)

Co-Authored-By: Volnei Munhoz <[email protected]>

* refactor(trpc): remove circular dependency in routing-forms

- Extract ZFormByResponseIdInputSchema to separate schema file
- Create getResponseWithFormFields.schema.ts to break circular dependency
- Update imports in _router.ts and getResponseWithFormFields.handler.ts
- Fix eslint warnings by updating deprecated rule names
- This eliminates the circular dependency within packages/trpc (reduced from 1 to 0 internal circular deps)

Co-Authored-By: Volnei Munhoz <[email protected]>

* fix(emails): correct TeamInvite type definition

- Make isExistingUserMovedToOrg required (not optional)
- Make prevLink and newLink non-optional (string | null)
- Add back JSDoc comment for isAutoJoin field
- This fixes type check errors in CI

Co-Authored-By: Volnei Munhoz <[email protected]>

* wip

* Fixes types folder

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Volnei MunhozandDevin AI authored and GitHub committed 2025-10-21 12:24:47 +00:00
1 parent 6aa21aceb8
commit d82f87aa2a
56 files changed
+190 -155

No files matched your search

@@ -1,8 +1,8 @@
import AttendeeScheduledEmailClass from "../../templates/attendee-rescheduled-email";
import { getFormattedDate } from "../../lib/utils/date-formatting";
import { AttendeeScheduledEmail } from "./AttendeeScheduledEmail";
export const AttendeeRequestEmail = (props: React.ComponentProps<typeof AttendeeScheduledEmail>) => {
const date = new AttendeeScheduledEmailClass(props.calEvent, props.attendee).getFormattedDate();
const date = getFormattedDate(props.calEvent, props.attendee);
return (
<AttendeeScheduledEmail
@@ -1,4 +1,4 @@
import type { IBookingRedirect } from "../../templates/booking-redirect-notification";
import type { IBookingRedirect } from "../../lib/types/booking-redirect-types";
import { BaseEmailHtml } from "../components";
export const BookingRedirectEmailNotification = (
@@ -1,7 +1,7 @@
import ServerTrans from "@calcom/lib/components/ServerTrans";
import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants";
import type { OrganizationCreation } from "../../templates/organization-creation-email";
import type { OrganizationCreation } from "../../lib/types/email-types";
import { V2BaseEmailHtml } from "../components";
export const OrganizationCreationEmail = (
@@ -3,7 +3,7 @@ import type { TFunction } from "i18next";
import ServerTrans from "@calcom/lib/components/ServerTrans";
import { APP_NAME, WEBAPP_URL, IS_PRODUCTION } from "@calcom/lib/constants";
import { getSubject, getTypeOfInvite } from "../../templates/team-invite-email";
import { getSubject, getTypeOfInvite } from "../../lib/utils/team-invite-utils";
import { V2BaseEmailHtml, CallToAction } from "../components";
type TeamInvite = {
@@ -1,6 +1,6 @@
import { APP_NAME, SENDER_NAME, SUPPORT_MAIL_ADDRESS } from "@calcom/lib/constants";
import type { EmailVerifyCode } from "../../templates/attendee-verify-email";
import type { EmailVerifyCode } from "../../lib/types/email-types";
import { BaseEmailHtml } from "../components";
export const VerifyEmailByCode = (