Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ export interface EmbeddedEventData {
// Window API Types
export interface CortiEmbeddedV1API {
auth(payload: KeycloakTokenResponse): Promise<AuthResponse>;
createInteraction(
payload: CreateInteractionPayload,
): Promise<CreateInteractionResponse>;
createInteraction(payload: CreateInteractionPayload): Promise<CreateInteractionResponse>;
addFacts(payload: AddFactsPayload): Promise<void>;
configureSession(payload: ConfigureSessionPayload): Promise<void>;
configure(payload: ConfigureAppPayload): Promise<ConfigureAppResponse>;
Expand All @@ -94,6 +92,13 @@ export interface CortiEmbeddedWindowAPI {
v1: CortiEmbeddedV1API;
}

// Extend Window interface
declare global {
interface Window {
CortiEmbedded?: CortiEmbeddedWindowAPI;
}
}

/**
* Event listener function type
*/
Expand All @@ -115,9 +120,7 @@ export interface CortiEmbeddedAPI {
* @param encounter Encounter request data
* @returns Promise resolving to interaction details
*/
createInteraction(
encounter: CreateInteractionPayload,
): Promise<InteractionDetails>;
createInteraction(encounter: CreateInteractionPayload): Promise<InteractionDetails>;

/**
* Configure the current session
Expand Down Expand Up @@ -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<void>;
setCredentials(credentials: { password: string }): Promise<void>;

/**
* Show the embedded UI
Expand Down
1 change: 1 addition & 0 deletions src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface NetworkConfig {
}

export interface ConfigureAppPayload {
debug?: boolean;
appearance?: Partial<AppearanceConfig>;
features?: Partial<FeaturesConfig>;
locale?: Partial<LocaleConfig>;
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Main exports for @corti/embedded-types
// Main exports for @assistant/embedded-types

// Public API types
export * from "./api.js";
Expand Down
10 changes: 2 additions & 8 deletions src/types/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -196,7 +193,4 @@ export type AnyDeprecatedEmbeddedEvent =

export type AnyEvent = EmbeddedEventMessage | AnyDeprecatedEmbeddedEvent;

export type AnyEmbeddedMessage =
| AnyEmbeddedRequest
| AnyEmbeddedResponse
| AnyDeprecatedEmbeddedEvent;
export type AnyEmbeddedMessage = AnyEmbeddedRequest | AnyEmbeddedResponse | AnyEvent;
1 change: 1 addition & 0 deletions src/types/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface GetTemplatesResponse {
}

export interface ConfigureAppResponse {
debug?: boolean;
appearance: AppearanceConfig;
features: FeaturesConfig;
locale: LocaleConfig;
Expand Down
Loading