From 23db51997b2ef278be4e6aea4628d21e45c15225 Mon Sep 17 00:00:00 2001 From: gnezim Date: Tue, 14 Apr 2026 22:03:14 +0300 Subject: [PATCH] =?UTF-8?q?Add=20HostContract=20interface=20per=20design?= =?UTF-8?q?=20spec=20=C2=A72.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/host-contract.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/host-contract.ts diff --git a/src/host-contract.ts b/src/host-contract.ts new file mode 100644 index 00000000..c863dfdd --- /dev/null +++ b/src/host-contract.ts @@ -0,0 +1,20 @@ +import type { Logger } from "@/observability/logger/types"; + +/** + * Contract a host application must implement to embed this component + * as an MF 2.0 remote. Both standalone SSR and remote modes satisfy + * this interface; features depend only on HostContract and never on + * the hosting mode. + */ +export interface HostContract { + /** Resolved locale, e.g. "ru", "en". */ + locale: string; + /** Canonical origin for SEO (e.g. "https://flights.aeroflot.ru"). */ + canonicalOrigin: string; + /** Optional deep-link navigation override from the host router. */ + navigate?: (path: string) => void; + /** Optional consent flags; absent == assumed true. */ + consent?: { analytics: boolean; telemetry: boolean }; + /** Optional host logger for log stream merging. */ + logger?: Logger; +}