src/ssr-personalization-types.tsTypeScript
@@ -0,0 +1,29 @@
1+
export interface RenderRequest {2+
path: string;3+
locale: string;4+
sessionCookie?: string;5+
}6+
7+
export interface Viewer {8+
id: string;9+
displayName: string;10+
}11+
12+
export interface Recommendation {13+
id: string;14+
title: string;15+
}16+
17+
export interface PersonalizationDependencies {18+
authenticate(sessionCookie: string | undefined): Promise<Viewer | null>;19+
flags(viewerId: string | null): Promise<Readonly<Record<string, boolean>>>;20+
recommendations(viewerId: string): Promise<readonly Recommendation[]>;21+
renderTemplate(input: {22+
shell: string;23+
locale: string;24+
viewer: Viewer | null;25+
flags: Readonly<Record<string, boolean>>;26+
recommendations: readonly Recommendation[];27+
}): Promise<string>;28+
renderPublicShell(path: string): Promise<string>;29+
}