export type Domain = { revision: number; origin: string | null; hostname: string; zoneId: string; domainId: string | null; operationId: string; status: "connecting" | "active" | "removing" | "removed" | "failed"; errorCode: string | null; action: "attach" | "remove"; }; export type DomainDetails = { ownerSubject: string; installationId: string; accountId: string; runtimeOrigin: string; domain: Domain | null; }; export type Zone = { id: string; name: string }; export function validOrigin(value: unknown) { try { if (typeof value !== "string") return false; const url = new URL(value); const local = ["localhost", "127.0.0.1"].includes(url.hostname); return ( !url.username && !url.password && url.pathname === "/" && !url.search && !url.hash && url.origin === value && (url.protocol === "https:" || (url.protocol === "http:" && local)) ); } catch { return false; } }