From cafbfe65b2690d3639b2b8bfb12c476e74529039 Mon Sep 17 00:00:00 2001 From: filipweilid <4582583+filipweilid@users.noreply.github.com> Date: Thu, 26 Mar 2026 08:19:50 +0000 Subject: [PATCH] refactor(types): sync embedded types --- src/types/api.ts | 17 ++++++++++------- src/types/index.ts | 2 +- src/types/protocol.ts | 5 +---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/types/api.ts b/src/types/api.ts index 19ab9aa..a578690 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -77,9 +77,7 @@ export interface EmbeddedEventData { // Window API Types export interface CortiEmbeddedV1API { auth(payload: KeycloakTokenResponse): Promise; - createInteraction( - payload: CreateInteractionPayload, - ): Promise; + createInteraction(payload: CreateInteractionPayload): Promise; addFacts(payload: AddFactsPayload): Promise; configureSession(payload: ConfigureSessionPayload): Promise; configure(payload: ConfigureAppPayload): Promise; @@ -94,6 +92,13 @@ export interface CortiEmbeddedWindowAPI { v1: CortiEmbeddedV1API; } +// Extend Window interface +declare global { + interface Window { + CortiEmbedded?: CortiEmbeddedWindowAPI; + } +} + /** * Event listener function type */ @@ -115,9 +120,7 @@ export interface CortiEmbeddedAPI { * @param encounter Encounter request data * @returns Promise resolving to interaction details */ - createInteraction( - encounter: CreateInteractionPayload, - ): Promise; + createInteraction(encounter: CreateInteractionPayload): Promise; /** * Configure the current session @@ -176,7 +179,7 @@ export interface CortiEmbeddedAPI { * @param credentials Authentication credentials to store * @returns Promise that resolves when credentials are set */ - setCredentials(credentials: SetCredentialsPayload): Promise; + setCredentials(credentials: { password: string }): Promise; /** * Show the embedded UI diff --git a/src/types/index.ts b/src/types/index.ts index 60e9b9d..cda89dd 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,4 +1,4 @@ -// Main exports for @corti/embedded-types +// Main exports for @assistant/embedded-types // Public API types export * from "./api.js"; diff --git a/src/types/protocol.ts b/src/types/protocol.ts index b5dc625..8e88228 100644 --- a/src/types/protocol.ts +++ b/src/types/protocol.ts @@ -2,10 +2,7 @@ export type APIVersion = "v1"; -export type MessageType = - | "CORTI_EMBEDDED" - | "CORTI_EMBEDDED_RESPONSE" - | "CORTI_EMBEDDED_EVENT"; +export type MessageType = "CORTI_EMBEDDED" | "CORTI_EMBEDDED_RESPONSE" | "CORTI_EMBEDDED_EVENT"; export type DefaultMode = "virtual" | "in-person";