hunk.code_window:     metadata: EventTypeMetaDataSchema.parse(eventType.metadata),
     };
   }
   export async function getDynamicEventType(input: TGetScheduleInputSchema) {
     // For dynamic booking, we need to get and update user credentials, schedule and availability in the eventTypeObject as they're required in the new availability logic
     if (!input.eventTypeSlug) {
       throw new TRPCError({
         message: "eventTypeSlug is required for dynamic booking",
  
hunk.labels: keep keep keep keep replace keep keep keep keep
hunk.after_edit: export async function getDynamicEventType(
     input: TGetScheduleInputSchema,
     organizationDetails: { currentOrgDomain: string | null; isValidOrgDomain: boolean }
   ) {
     const { currentOrgDomain, isValidOrgDomain } = organizationDetails;
  
hunk.file_path: packages/trpc/server/routers/viewer/slots/util.ts
hunk.type: replace
file: const getDefaultSubdomain = (url) => {
    if (!url.startsWith("http:") && !url.startsWith("https:")) {
      // Make it a valid URL. Mabe we can simply return null and opt-out from orgs support till the use a URL scheme.
      url = `https://${url}`;
    }
    const _url = new URL(url);
    const regex = new RegExp(/^([a-z]+\:\/{2})?((?<subdomain>[\w-.]+)\.[\w-]+\.\w+)$/);
    //console.log(_url.hostname, _url.hostname.match(regex));
    return _url.hostname.match(regex)?.groups?.subdomain || null;
  };
  exports.getSubdomainRegExp = (url) => {
    const defaultSubdomain = getDefaultSubdomain(url);
    const subdomain = defaultSubdomain ? `(?!${defaultSubdomain})[^.]+` : "[^.]+";
    return subdomain;
  };
  