@corti/embedded-web 0.1.0-alpha.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -41
- package/dist/CortiEmbedded.d.ts +9 -5
- package/dist/CortiEmbedded.js +30 -40
- package/dist/CortiEmbedded.js.map +1 -1
- package/dist/bundle.js +7 -7
- package/dist/index.d.ts +2 -3
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/react/CortiEmbeddedReact.d.ts +38 -15
- package/dist/react/CortiEmbeddedReact.js +95 -15
- package/dist/react/CortiEmbeddedReact.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/api.d.ts +152 -0
- package/dist/types/api.js +3 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/config.d.ts +26 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/events.d.ts +28 -0
- package/dist/types/events.js +2 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/generated/interview-details.d.ts +159 -0
- package/dist/types/generated/interview-details.js +4 -0
- package/dist/types/generated/interview-details.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +14 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/payloads.d.ts +61 -0
- package/dist/types/payloads.js +2 -0
- package/dist/types/payloads.js.map +1 -0
- package/dist/types/protocol.d.ts +111 -0
- package/dist/types/protocol.js +3 -0
- package/dist/types/protocol.js.map +1 -0
- package/dist/types/responses.d.ts +48 -0
- package/dist/types/responses.js +3 -0
- package/dist/types/responses.js.map +1 -0
- package/dist/utils/PostMessageHandler.d.ts +11 -17
- package/dist/utils/PostMessageHandler.js +29 -40
- package/dist/utils/PostMessageHandler.js.map +1 -1
- package/dist/web-bundle.js +4 -4
- package/dist/web-index.d.ts +1 -1
- package/dist/web-index.js +2 -0
- package/dist/web-index.js.map +1 -1
- package/package.json +4 -3
- package/dist/internal-types.d.ts +0 -231
- package/dist/internal-types.js +0 -2
- package/dist/internal-types.js.map +0 -1
- package/dist/public-types.d.ts +0 -238
- package/dist/public-types.js +0 -2
- package/dist/public-types.js.map +0 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { ConfigureAppPayload } from "./config.js";
|
|
2
|
+
import type { AuthChangedEventPayload, DocumentEventPayload, ErrorEventPayload, InteractionCreatedEventPayload, NavigationChangedEventPayload, UsageEventPayload } from "./events.js";
|
|
3
|
+
import type { AddFactsPayload, AuthPayload, ConfigureSessionPayload, CreateInteractionPayload, Fact, KeycloakTokenResponse, NavigatePayload, SetCredentialsPayload } from "./payloads.js";
|
|
4
|
+
import type { DefaultMode } from "./protocol.js";
|
|
5
|
+
import type { AuthResponse, ConfigureAppResponse, CreateInteractionResponse, GetStatusResponse, GetTemplatesResponse } from "./responses.js";
|
|
6
|
+
export type { ConfigureAppPayload } from "./config.js";
|
|
7
|
+
export type { UserInfo } from "./responses.js";
|
|
8
|
+
/**
|
|
9
|
+
* Authentication credentials for Assistant
|
|
10
|
+
*/
|
|
11
|
+
export type AuthCredentials = AuthPayload;
|
|
12
|
+
/**
|
|
13
|
+
* User information returned from authentication
|
|
14
|
+
*/
|
|
15
|
+
export interface User {
|
|
16
|
+
id: string;
|
|
17
|
+
email: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Details of a created interaction
|
|
21
|
+
*/
|
|
22
|
+
export interface InteractionDetails {
|
|
23
|
+
id: string;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Session configuration options
|
|
28
|
+
*/
|
|
29
|
+
export interface SessionConfig {
|
|
30
|
+
defaultLanguage?: string;
|
|
31
|
+
defaultOutputLanguage?: string;
|
|
32
|
+
defaultTemplateKey?: string;
|
|
33
|
+
defaultMode?: DefaultMode;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Event data types for component events
|
|
37
|
+
*/
|
|
38
|
+
export interface EmbeddedEventData {
|
|
39
|
+
ready: undefined;
|
|
40
|
+
"auth-changed": AuthChangedEventPayload;
|
|
41
|
+
"interaction-created": InteractionCreatedEventPayload;
|
|
42
|
+
"recording-started": undefined;
|
|
43
|
+
"recording-stopped": undefined;
|
|
44
|
+
"document-generated": DocumentEventPayload;
|
|
45
|
+
"document-updated": DocumentEventPayload;
|
|
46
|
+
"document-synced": DocumentEventPayload;
|
|
47
|
+
"navigation-changed": NavigationChangedEventPayload;
|
|
48
|
+
usage: UsageEventPayload;
|
|
49
|
+
error: ErrorEventPayload;
|
|
50
|
+
}
|
|
51
|
+
export interface CortiEmbeddedV1API {
|
|
52
|
+
auth(payload: KeycloakTokenResponse): Promise<AuthResponse>;
|
|
53
|
+
createInteraction(payload: CreateInteractionPayload): Promise<CreateInteractionResponse>;
|
|
54
|
+
addFacts(payload: AddFactsPayload): Promise<void>;
|
|
55
|
+
configureSession(payload: ConfigureSessionPayload): Promise<void>;
|
|
56
|
+
configure(payload: ConfigureAppPayload): Promise<ConfigureAppResponse>;
|
|
57
|
+
navigate(payload: NavigatePayload): Promise<void>;
|
|
58
|
+
startRecording(): Promise<void>;
|
|
59
|
+
stopRecording(): Promise<void>;
|
|
60
|
+
setCredentials(payload: SetCredentialsPayload): Promise<void>;
|
|
61
|
+
getStatus(): Promise<GetStatusResponse>;
|
|
62
|
+
getTemplates(): Promise<GetTemplatesResponse>;
|
|
63
|
+
}
|
|
64
|
+
export interface CortiEmbeddedWindowAPI {
|
|
65
|
+
v1: CortiEmbeddedV1API;
|
|
66
|
+
}
|
|
67
|
+
declare global {
|
|
68
|
+
interface Window {
|
|
69
|
+
CortiEmbedded?: CortiEmbeddedWindowAPI;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Event listener function type
|
|
74
|
+
*/
|
|
75
|
+
export type EventListener<T = unknown> = (data: T) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Public API interface for the Corti Embedded component
|
|
78
|
+
*/
|
|
79
|
+
export interface CortiEmbeddedAPI {
|
|
80
|
+
/**
|
|
81
|
+
* Authenticate with the Corti system
|
|
82
|
+
* @param credentials Authentication credentials
|
|
83
|
+
* @returns Promise resolving to user information
|
|
84
|
+
*/
|
|
85
|
+
auth(credentials: AuthCredentials): Promise<User>;
|
|
86
|
+
/**
|
|
87
|
+
* Create a new interaction
|
|
88
|
+
* @param encounter Encounter request data
|
|
89
|
+
* @returns Promise resolving to interaction details
|
|
90
|
+
*/
|
|
91
|
+
createInteraction(encounter: CreateInteractionPayload): Promise<InteractionDetails>;
|
|
92
|
+
/**
|
|
93
|
+
* Configure the current session
|
|
94
|
+
* @param config Session configuration
|
|
95
|
+
* @returns Promise that resolves when configuration is complete
|
|
96
|
+
*/
|
|
97
|
+
configureSession(config: SessionConfig): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Add facts to the current session
|
|
100
|
+
* @param facts Array of facts to add
|
|
101
|
+
* @returns Promise that resolves when facts are added
|
|
102
|
+
*/
|
|
103
|
+
addFacts(facts: Fact[]): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Navigate to a specific path within the embedded UI
|
|
106
|
+
* @param path Path to navigate to
|
|
107
|
+
* @returns Promise that resolves when navigation is complete
|
|
108
|
+
*/
|
|
109
|
+
navigate(path: string): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Start recording
|
|
112
|
+
* @returns Promise that resolves when recording starts
|
|
113
|
+
*/
|
|
114
|
+
startRecording(): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Stop recording
|
|
117
|
+
* @returns Promise that resolves when recording stops
|
|
118
|
+
*/
|
|
119
|
+
stopRecording(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Get current component status
|
|
122
|
+
* @returns Promise resolving to current status
|
|
123
|
+
*/
|
|
124
|
+
getStatus(): Promise<GetStatusResponse>;
|
|
125
|
+
/**
|
|
126
|
+
* Get all templates available to the current user
|
|
127
|
+
* @returns Promise resolving to list of templates
|
|
128
|
+
*/
|
|
129
|
+
getTemplates(): Promise<GetTemplatesResponse>;
|
|
130
|
+
/**
|
|
131
|
+
* Configure the application
|
|
132
|
+
* @param config Application configuration
|
|
133
|
+
* @returns Promise that resolves when configuration is applied
|
|
134
|
+
*/
|
|
135
|
+
configure(config: ConfigureAppPayload): Promise<ConfigureAppResponse>;
|
|
136
|
+
/**
|
|
137
|
+
* Set authentication credentials without triggering auth flow
|
|
138
|
+
* @param credentials Authentication credentials to store
|
|
139
|
+
* @returns Promise that resolves when credentials are set
|
|
140
|
+
*/
|
|
141
|
+
setCredentials(credentials: {
|
|
142
|
+
password: string;
|
|
143
|
+
}): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Show the embedded UI
|
|
146
|
+
*/
|
|
147
|
+
show(): void;
|
|
148
|
+
/**
|
|
149
|
+
* Hide the embedded UI
|
|
150
|
+
*/
|
|
151
|
+
hide(): void;
|
|
152
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA,qCAAqC","sourcesContent":["// Public API types for SDK consumers\n\nimport type { ConfigureAppPayload } from \"./config.js\";\nimport type {\n AuthChangedEventPayload,\n DocumentEventPayload,\n ErrorEventPayload,\n InteractionCreatedEventPayload,\n NavigationChangedEventPayload,\n UsageEventPayload,\n} from \"./events.js\";\nimport type {\n AddFactsPayload,\n AuthPayload,\n ConfigureSessionPayload,\n CreateInteractionPayload,\n Fact,\n KeycloakTokenResponse,\n NavigatePayload,\n SetCredentialsPayload,\n} from \"./payloads.js\";\nimport type { DefaultMode } from \"./protocol.js\";\nimport type {\n AuthResponse,\n ConfigureAppResponse,\n CreateInteractionResponse,\n GetStatusResponse,\n GetTemplatesResponse,\n UserInfo,\n} from \"./responses.js\";\n\nexport type { ConfigureAppPayload } from \"./config.js\";\n// Re-export common types for public API\nexport type { UserInfo } from \"./responses.js\";\n\n/**\n * Authentication credentials for Assistant\n */\nexport type AuthCredentials = AuthPayload;\n\n/**\n * User information returned from authentication\n */\nexport interface User {\n id: string;\n email: string;\n}\n\n/**\n * Details of a created interaction\n */\nexport interface InteractionDetails {\n id: string;\n createdAt: string;\n}\n\n/**\n * Session configuration options\n */\nexport interface SessionConfig {\n defaultLanguage?: string;\n defaultOutputLanguage?: string;\n defaultTemplateKey?: string;\n defaultMode?: DefaultMode;\n}\n\n/**\n * Event data types for component events\n */\nexport interface EmbeddedEventData {\n ready: undefined;\n \"auth-changed\": AuthChangedEventPayload;\n \"interaction-created\": InteractionCreatedEventPayload;\n \"recording-started\": undefined;\n \"recording-stopped\": undefined;\n \"document-generated\": DocumentEventPayload;\n \"document-updated\": DocumentEventPayload;\n \"document-synced\": DocumentEventPayload;\n \"navigation-changed\": NavigationChangedEventPayload;\n usage: UsageEventPayload;\n error: ErrorEventPayload;\n}\n\n// Window API Types\nexport interface CortiEmbeddedV1API {\n auth(payload: KeycloakTokenResponse): Promise<AuthResponse>;\n createInteraction(payload: CreateInteractionPayload): Promise<CreateInteractionResponse>;\n addFacts(payload: AddFactsPayload): Promise<void>;\n configureSession(payload: ConfigureSessionPayload): Promise<void>;\n configure(payload: ConfigureAppPayload): Promise<ConfigureAppResponse>;\n navigate(payload: NavigatePayload): Promise<void>;\n startRecording(): Promise<void>;\n stopRecording(): Promise<void>;\n setCredentials(payload: SetCredentialsPayload): Promise<void>;\n getStatus(): Promise<GetStatusResponse>;\n getTemplates(): Promise<GetTemplatesResponse>;\n}\nexport interface CortiEmbeddedWindowAPI {\n v1: CortiEmbeddedV1API;\n}\n\n// Extend Window interface\ndeclare global {\n interface Window {\n CortiEmbedded?: CortiEmbeddedWindowAPI;\n }\n}\n\n/**\n * Event listener function type\n */\nexport type EventListener<T = unknown> = (data: T) => void;\n\n/**\n * Public API interface for the Corti Embedded component\n */\nexport interface CortiEmbeddedAPI {\n /**\n * Authenticate with the Corti system\n * @param credentials Authentication credentials\n * @returns Promise resolving to user information\n */\n auth(credentials: AuthCredentials): Promise<User>;\n\n /**\n * Create a new interaction\n * @param encounter Encounter request data\n * @returns Promise resolving to interaction details\n */\n createInteraction(encounter: CreateInteractionPayload): Promise<InteractionDetails>;\n\n /**\n * Configure the current session\n * @param config Session configuration\n * @returns Promise that resolves when configuration is complete\n */\n configureSession(config: SessionConfig): Promise<void>;\n\n /**\n * Add facts to the current session\n * @param facts Array of facts to add\n * @returns Promise that resolves when facts are added\n */\n addFacts(facts: Fact[]): Promise<void>;\n\n /**\n * Navigate to a specific path within the embedded UI\n * @param path Path to navigate to\n * @returns Promise that resolves when navigation is complete\n */\n navigate(path: string): Promise<void>;\n\n /**\n * Start recording\n * @returns Promise that resolves when recording starts\n */\n startRecording(): Promise<void>;\n\n /**\n * Stop recording\n * @returns Promise that resolves when recording stops\n */\n stopRecording(): Promise<void>;\n\n /**\n * Get current component status\n * @returns Promise resolving to current status\n */\n getStatus(): Promise<GetStatusResponse>;\n\n /**\n * Get all templates available to the current user\n * @returns Promise resolving to list of templates\n */\n getTemplates(): Promise<GetTemplatesResponse>;\n\n /**\n * Configure the application\n * @param config Application configuration\n * @returns Promise that resolves when configuration is applied\n */\n configure(config: ConfigureAppPayload): Promise<ConfigureAppResponse>;\n\n /**\n * Set authentication credentials without triggering auth flow\n * @param credentials Authentication credentials to store\n * @returns Promise that resolves when credentials are set\n */\n setCredentials(credentials: { password: string }): Promise<void>;\n\n /**\n * Show the embedded UI\n */\n show(): void;\n\n /**\n * Hide the embedded UI\n */\n hide(): void;\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface AppearanceConfig {
|
|
2
|
+
primaryColor: string | null;
|
|
3
|
+
}
|
|
4
|
+
export interface FeaturesConfig {
|
|
5
|
+
interactionTitle: boolean;
|
|
6
|
+
aiChat: boolean;
|
|
7
|
+
documentFeedback: boolean;
|
|
8
|
+
navigation: boolean;
|
|
9
|
+
virtualMode: boolean;
|
|
10
|
+
syncDocumentAction: boolean;
|
|
11
|
+
templateEditor: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface LocaleConfig {
|
|
14
|
+
interfaceLanguage: string;
|
|
15
|
+
dictationLanguage?: string | null;
|
|
16
|
+
overrides?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export interface NetworkConfig {
|
|
19
|
+
websocketBaseUrl?: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface ConfigureAppPayload {
|
|
22
|
+
appearance?: Partial<AppearanceConfig>;
|
|
23
|
+
features?: Partial<FeaturesConfig>;
|
|
24
|
+
locale?: Partial<LocaleConfig>;
|
|
25
|
+
network?: Partial<NetworkConfig>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,iDAAiD","sourcesContent":["// Configuration types for the embedded component\n\nexport interface AppearanceConfig {\n primaryColor: string | null;\n}\n\nexport interface FeaturesConfig {\n interactionTitle: boolean;\n aiChat: boolean;\n documentFeedback: boolean;\n navigation: boolean;\n virtualMode: boolean;\n syncDocumentAction: boolean;\n templateEditor: boolean;\n}\n\nexport interface LocaleConfig {\n interfaceLanguage: string;\n dictationLanguage?: string | null;\n overrides?: Record<string, string>;\n}\n\nexport interface NetworkConfig {\n websocketBaseUrl?: string | null;\n}\n\nexport interface ConfigureAppPayload {\n appearance?: Partial<AppearanceConfig>;\n features?: Partial<FeaturesConfig>;\n locale?: Partial<LocaleConfig>;\n network?: Partial<NetworkConfig>;\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Corti } from "@corti/sdk";
|
|
2
|
+
import type { UserInfo } from "./responses.js";
|
|
3
|
+
export interface NavigateEventPayload {
|
|
4
|
+
interactionId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DocumentEventPayload {
|
|
7
|
+
document: Corti.DocumentsGetResponse;
|
|
8
|
+
}
|
|
9
|
+
export interface AuthChangedEventPayload {
|
|
10
|
+
user: UserInfo;
|
|
11
|
+
}
|
|
12
|
+
export interface InteractionCreatedEventPayload {
|
|
13
|
+
interaction: {
|
|
14
|
+
id: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface NavigationChangedEventPayload {
|
|
19
|
+
path: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ErrorEventPayload {
|
|
22
|
+
message: string;
|
|
23
|
+
code?: string;
|
|
24
|
+
details?: unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface UsageEventPayload {
|
|
27
|
+
creditsConsumed: number;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"","sourcesContent":["// Event payload types for embedded component events\nimport type { Corti } from \"@corti/sdk\";\n\nimport type { UserInfo } from \"./responses.js\";\n\nexport interface NavigateEventPayload {\n interactionId: string;\n}\n\nexport interface DocumentEventPayload {\n document: Corti.DocumentsGetResponse;\n}\n\nexport interface AuthChangedEventPayload {\n user: UserInfo;\n}\n\nexport interface InteractionCreatedEventPayload {\n interaction: {\n id: string;\n createdAt: string;\n };\n}\n\nexport interface NavigationChangedEventPayload {\n path: string;\n}\n\nexport interface ErrorEventPayload {\n message: string;\n code?: string;\n details?: unknown;\n}\n\nexport interface UsageEventPayload {\n creditsConsumed: number;\n}\n"]}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export type EmbeddedInterviewDetails = {
|
|
2
|
+
/** Unique interview identifier */
|
|
3
|
+
id: string;
|
|
4
|
+
/** Interview title */
|
|
5
|
+
title: string | null;
|
|
6
|
+
/** Current state of the interaction */
|
|
7
|
+
state: "planned" | "ongoing" | "paused" | "disconnected" | "ending" | "parsing" | "ended";
|
|
8
|
+
/** ISO 8601 timestamp when interview started */
|
|
9
|
+
startedAt: string;
|
|
10
|
+
/** ISO 8601 timestamp when interview ended */
|
|
11
|
+
endedAt: string | null;
|
|
12
|
+
/** ISO 8601 timestamp when interview is scheduled to end */
|
|
13
|
+
endsAt: string | null;
|
|
14
|
+
/** Maximum duration in minutes */
|
|
15
|
+
maxDurationInMinutes?: (number | null) | undefined;
|
|
16
|
+
transcripts: {
|
|
17
|
+
utterances: {
|
|
18
|
+
/** Unique utterance identifier */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Start time in seconds */
|
|
21
|
+
start: number;
|
|
22
|
+
/** Duration in seconds */
|
|
23
|
+
duration: number;
|
|
24
|
+
/** Utterance text content */
|
|
25
|
+
text: string;
|
|
26
|
+
/** Whether the utterance is finalized */
|
|
27
|
+
isFinal: boolean;
|
|
28
|
+
/** ID of the participant who spoke */
|
|
29
|
+
participantId?: string | undefined;
|
|
30
|
+
}[];
|
|
31
|
+
participants: {
|
|
32
|
+
/** Unique participant identifier */
|
|
33
|
+
id?: string | undefined;
|
|
34
|
+
/** Audio channel number for the participant */
|
|
35
|
+
channel: number;
|
|
36
|
+
/** Role of the participant in the interaction */
|
|
37
|
+
role: "agent" | "patient" | "other" | "multiple";
|
|
38
|
+
}[];
|
|
39
|
+
isMultiChannel: boolean;
|
|
40
|
+
}[];
|
|
41
|
+
documents: ({
|
|
42
|
+
/** Unique document identifier */
|
|
43
|
+
id: string;
|
|
44
|
+
/** Document name */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Language code for document output */
|
|
47
|
+
outputLanguage: string;
|
|
48
|
+
/** Whether document is streamed */
|
|
49
|
+
isStream: boolean;
|
|
50
|
+
/** Document sections */
|
|
51
|
+
sections: {
|
|
52
|
+
/** Unique identifier for the section */
|
|
53
|
+
key: string;
|
|
54
|
+
/** Display name of the section */
|
|
55
|
+
name: string;
|
|
56
|
+
/** Section content text */
|
|
57
|
+
text: string;
|
|
58
|
+
/** Sort order for displaying sections */
|
|
59
|
+
sort: number;
|
|
60
|
+
/** ISO 8601 timestamp when section was created */
|
|
61
|
+
createdAt: string;
|
|
62
|
+
/** ISO 8601 timestamp when section was last updated */
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
/** Markdown formatted content */
|
|
65
|
+
markdown?: (string | null) | undefined;
|
|
66
|
+
/** HTML formatted content */
|
|
67
|
+
htmlText?: string | undefined;
|
|
68
|
+
/** Plain text content */
|
|
69
|
+
plainText?: string | undefined;
|
|
70
|
+
}[];
|
|
71
|
+
/** Usage information */
|
|
72
|
+
usageInfo?: {
|
|
73
|
+
creditsConsumed: number;
|
|
74
|
+
} | undefined;
|
|
75
|
+
/** Reference to the template used */
|
|
76
|
+
templateRef: string;
|
|
77
|
+
/** Type of template used */
|
|
78
|
+
templateType: "built-in";
|
|
79
|
+
/** Not applicable for built-in templates */
|
|
80
|
+
customTemplateId: null;
|
|
81
|
+
state: "generated" | "pending" | "error" | "stale" | "missing_template";
|
|
82
|
+
} | {
|
|
83
|
+
/** Unique document identifier */
|
|
84
|
+
id: string;
|
|
85
|
+
/** Document name */
|
|
86
|
+
name: string;
|
|
87
|
+
/** Language code for document output */
|
|
88
|
+
outputLanguage: string;
|
|
89
|
+
/** Whether document is streamed */
|
|
90
|
+
isStream: boolean;
|
|
91
|
+
/** Document sections */
|
|
92
|
+
sections: {
|
|
93
|
+
/** Unique identifier for the section */
|
|
94
|
+
key: string;
|
|
95
|
+
/** Display name of the section */
|
|
96
|
+
name: string;
|
|
97
|
+
/** Section content text */
|
|
98
|
+
text: string;
|
|
99
|
+
/** Sort order for displaying sections */
|
|
100
|
+
sort: number;
|
|
101
|
+
/** ISO 8601 timestamp when section was created */
|
|
102
|
+
createdAt: string;
|
|
103
|
+
/** ISO 8601 timestamp when section was last updated */
|
|
104
|
+
updatedAt: string;
|
|
105
|
+
/** Markdown formatted content */
|
|
106
|
+
markdown?: (string | null) | undefined;
|
|
107
|
+
/** HTML formatted content */
|
|
108
|
+
htmlText?: string | undefined;
|
|
109
|
+
/** Plain text content */
|
|
110
|
+
plainText?: string | undefined;
|
|
111
|
+
}[];
|
|
112
|
+
/** Usage information */
|
|
113
|
+
usageInfo?: {
|
|
114
|
+
creditsConsumed: number;
|
|
115
|
+
} | undefined;
|
|
116
|
+
/** Type of template used */
|
|
117
|
+
templateType: "custom";
|
|
118
|
+
/** Not applicable for custom templates */
|
|
119
|
+
templateRef: null;
|
|
120
|
+
/** ID of the custom template */
|
|
121
|
+
customTemplateId: string;
|
|
122
|
+
state: "generated" | "pending" | "error" | "stale" | "missing_template";
|
|
123
|
+
})[];
|
|
124
|
+
factGroups: {
|
|
125
|
+
/** DEPRECATED: Legacy identifier, use 'key' instead */
|
|
126
|
+
id?: string | undefined;
|
|
127
|
+
/** Unique fact group key */
|
|
128
|
+
key: string;
|
|
129
|
+
translations: {
|
|
130
|
+
/** Translation identifier */
|
|
131
|
+
id: number;
|
|
132
|
+
/** Language identifier */
|
|
133
|
+
languages_id: string;
|
|
134
|
+
/** Translated group name */
|
|
135
|
+
name: string;
|
|
136
|
+
}[];
|
|
137
|
+
}[] | null;
|
|
138
|
+
facts: {
|
|
139
|
+
/** Unique fact identifier */
|
|
140
|
+
id: string;
|
|
141
|
+
/** The fact content */
|
|
142
|
+
text: string;
|
|
143
|
+
/** Category group key for organizing facts */
|
|
144
|
+
group: string;
|
|
145
|
+
/** DEPRECATED: Legacy group identifier, use 'group' instead */
|
|
146
|
+
groupId?: (string | null) | undefined;
|
|
147
|
+
/** Whether the fact has been discarded */
|
|
148
|
+
isDiscarded: boolean;
|
|
149
|
+
/** Origin of the fact: core (built-in), system (auto-generated), or user (manual) */
|
|
150
|
+
source: "core" | "system" | "user";
|
|
151
|
+
/** ISO 8601 timestamp when fact was created */
|
|
152
|
+
createdAt?: string | undefined;
|
|
153
|
+
/** ISO 8601 timestamp when fact was last updated */
|
|
154
|
+
updatedAt: string;
|
|
155
|
+
/** Whether this is a newly added fact */
|
|
156
|
+
isNew?: boolean | undefined;
|
|
157
|
+
}[] | null;
|
|
158
|
+
websocketUrl: string;
|
|
159
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interview-details.js","sourceRoot":"","sources":["../../../src/types/generated/interview-details.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,uBAAuB","sourcesContent":["// This file is auto-generated by scripts/generate-embedded-interview-details.ts\n// Do not edit by hand.\n\nexport type EmbeddedInterviewDetails = {\n /** Unique interview identifier */\n id: string;\n /** Interview title */\n title: string | null;\n /** Current state of the interaction */\n state: \"planned\" | \"ongoing\" | \"paused\" | \"disconnected\" | \"ending\" | \"parsing\" | \"ended\";\n /** ISO 8601 timestamp when interview started */\n startedAt: string;\n /** ISO 8601 timestamp when interview ended */\n endedAt: string | null;\n /** ISO 8601 timestamp when interview is scheduled to end */\n endsAt: string | null;\n /** Maximum duration in minutes */\n maxDurationInMinutes?: (number | null) | undefined;\n transcripts: {\n utterances: {\n /** Unique utterance identifier */\n id: string;\n /** Start time in seconds */\n start: number;\n /** Duration in seconds */\n duration: number;\n /** Utterance text content */\n text: string;\n /** Whether the utterance is finalized */\n isFinal: boolean;\n /** ID of the participant who spoke */\n participantId?: string | undefined;\n }[];\n participants: {\n /** Unique participant identifier */\n id?: string | undefined;\n /** Audio channel number for the participant */\n channel: number;\n /** Role of the participant in the interaction */\n role: \"agent\" | \"patient\" | \"other\" | \"multiple\";\n }[];\n isMultiChannel: boolean;\n }[];\n documents: (\n | {\n /** Unique document identifier */\n id: string;\n /** Document name */\n name: string;\n /** Language code for document output */\n outputLanguage: string;\n /** Whether document is streamed */\n isStream: boolean;\n /** Document sections */\n sections: {\n /** Unique identifier for the section */\n key: string;\n /** Display name of the section */\n name: string;\n /** Section content text */\n text: string;\n /** Sort order for displaying sections */\n sort: number;\n /** ISO 8601 timestamp when section was created */\n createdAt: string;\n /** ISO 8601 timestamp when section was last updated */\n updatedAt: string;\n /** Markdown formatted content */\n markdown?: (string | null) | undefined;\n /** HTML formatted content */\n htmlText?: string | undefined;\n /** Plain text content */\n plainText?: string | undefined;\n }[];\n /** Usage information */\n usageInfo?:\n | {\n creditsConsumed: number;\n }\n | undefined;\n /** Reference to the template used */\n templateRef: string;\n /** Type of template used */\n templateType: \"built-in\";\n /** Not applicable for built-in templates */\n customTemplateId: null;\n state: \"generated\" | \"pending\" | \"error\" | \"stale\" | \"missing_template\";\n }\n | {\n /** Unique document identifier */\n id: string;\n /** Document name */\n name: string;\n /** Language code for document output */\n outputLanguage: string;\n /** Whether document is streamed */\n isStream: boolean;\n /** Document sections */\n sections: {\n /** Unique identifier for the section */\n key: string;\n /** Display name of the section */\n name: string;\n /** Section content text */\n text: string;\n /** Sort order for displaying sections */\n sort: number;\n /** ISO 8601 timestamp when section was created */\n createdAt: string;\n /** ISO 8601 timestamp when section was last updated */\n updatedAt: string;\n /** Markdown formatted content */\n markdown?: (string | null) | undefined;\n /** HTML formatted content */\n htmlText?: string | undefined;\n /** Plain text content */\n plainText?: string | undefined;\n }[];\n /** Usage information */\n usageInfo?:\n | {\n creditsConsumed: number;\n }\n | undefined;\n /** Type of template used */\n templateType: \"custom\";\n /** Not applicable for custom templates */\n templateRef: null;\n /** ID of the custom template */\n customTemplateId: string;\n state: \"generated\" | \"pending\" | \"error\" | \"stale\" | \"missing_template\";\n }\n )[];\n factGroups:\n | {\n /** DEPRECATED: Legacy identifier, use 'key' instead */\n id?: string | undefined;\n /** Unique fact group key */\n key: string;\n translations: {\n /** Translation identifier */\n id: number;\n /** Language identifier */\n languages_id: string;\n /** Translated group name */\n name: string;\n }[];\n }[]\n | null;\n facts:\n | {\n /** Unique fact identifier */\n id: string;\n /** The fact content */\n text: string;\n /** Category group key for organizing facts */\n group: string;\n /** DEPRECATED: Legacy group identifier, use 'group' instead */\n groupId?: (string | null) | undefined;\n /** Whether the fact has been discarded */\n isDiscarded: boolean;\n /** Origin of the fact: core (built-in), system (auto-generated), or user (manual) */\n source: \"core\" | \"system\" | \"user\";\n /** ISO 8601 timestamp when fact was created */\n createdAt?: string | undefined;\n /** ISO 8601 timestamp when fact was last updated */\n updatedAt: string;\n /** Whether this is a newly added fact */\n isNew?: boolean | undefined;\n }[]\n | null;\n websocketUrl: string;\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Main exports for @corti/embedded-types
|
|
2
|
+
// Public API types
|
|
3
|
+
export * from "./api.js";
|
|
4
|
+
// Config types
|
|
5
|
+
export * from "./config.js";
|
|
6
|
+
// Event types
|
|
7
|
+
export * from "./events.js";
|
|
8
|
+
// Payload types
|
|
9
|
+
export * from "./payloads.js";
|
|
10
|
+
// Response types
|
|
11
|
+
export * from "./responses.js";
|
|
12
|
+
// Protocol types
|
|
13
|
+
export * from "./protocol.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,mBAAmB;AACnB,cAAc,UAAU,CAAC;AACzB,eAAe;AACf,cAAc,aAAa,CAAC;AAC5B,cAAc;AACd,cAAc,aAAa,CAAC;AAC5B,gBAAgB;AAChB,cAAc,eAAe,CAAC;AAC9B,iBAAiB;AACjB,cAAc,gBAAgB,CAAC;AAC/B,iBAAiB;AACjB,cAAc,eAAe,CAAC","sourcesContent":["// Main exports for @corti/embedded-types\n\n// Public API types\nexport * from \"./api.js\";\n// Config types\nexport * from \"./config.js\";\n// Event types\nexport * from \"./events.js\";\n// Payload types\nexport * from \"./payloads.js\";\n// Response types\nexport * from \"./responses.js\";\n// Protocol types\nexport * from \"./protocol.js\";\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Corti } from "@corti/sdk";
|
|
2
|
+
import type { AuthMode, DefaultMode } from "./protocol.js";
|
|
3
|
+
export interface KeycloakTokenResponse {
|
|
4
|
+
access_token: string;
|
|
5
|
+
token_type: string;
|
|
6
|
+
expires_at?: number | null;
|
|
7
|
+
expires_in?: number | null;
|
|
8
|
+
refresh_expires_in?: number | null;
|
|
9
|
+
refresh_token?: string;
|
|
10
|
+
id_token?: string;
|
|
11
|
+
"not-before-policy"?: number | null;
|
|
12
|
+
session_state?: string;
|
|
13
|
+
scope?: string;
|
|
14
|
+
profile?: {
|
|
15
|
+
name: string;
|
|
16
|
+
email: string;
|
|
17
|
+
sub: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface AuthPayload extends KeycloakTokenResponse {
|
|
21
|
+
mode: AuthMode;
|
|
22
|
+
}
|
|
23
|
+
export interface Fact {
|
|
24
|
+
text: Corti.FactsCreateInput["text"];
|
|
25
|
+
group: string;
|
|
26
|
+
source?: Corti.FactsCreateInput["source"];
|
|
27
|
+
}
|
|
28
|
+
export interface CreateInteractionPayload {
|
|
29
|
+
assignedUserId?: Corti.InteractionsCreateRequest["assignedUserId"] | null;
|
|
30
|
+
encounter: {
|
|
31
|
+
identifier: Corti.InteractionsCreateRequest["encounter"]["identifier"];
|
|
32
|
+
status: Corti.InteractionsCreateRequest["encounter"]["status"];
|
|
33
|
+
type: Corti.InteractionsCreateRequest["encounter"]["type"];
|
|
34
|
+
period: {
|
|
35
|
+
startedAt: string;
|
|
36
|
+
endedAt?: string;
|
|
37
|
+
};
|
|
38
|
+
title?: string;
|
|
39
|
+
};
|
|
40
|
+
patient?: {
|
|
41
|
+
identifier?: Corti.InteractionsPatient["identifier"];
|
|
42
|
+
name?: string;
|
|
43
|
+
birthDate?: string | null;
|
|
44
|
+
gender?: Corti.InteractionsPatient["gender"];
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface AddFactsPayload {
|
|
48
|
+
facts: Fact[];
|
|
49
|
+
}
|
|
50
|
+
export interface ConfigureSessionPayload {
|
|
51
|
+
defaultLanguage?: string;
|
|
52
|
+
defaultOutputLanguage?: string;
|
|
53
|
+
defaultTemplateKey?: string;
|
|
54
|
+
defaultMode?: DefaultMode;
|
|
55
|
+
}
|
|
56
|
+
export interface NavigatePayload {
|
|
57
|
+
path: string;
|
|
58
|
+
}
|
|
59
|
+
export interface SetCredentialsPayload {
|
|
60
|
+
password: string;
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payloads.js","sourceRoot":"","sources":["../../src/types/payloads.ts"],"names":[],"mappings":"","sourcesContent":["// Payload types for embedded API requests and responses\nimport type { Corti } from \"@corti/sdk\";\n\nimport type { AuthMode, DefaultMode } from \"./protocol.js\";\n\n// Keycloak token structure\nexport interface KeycloakTokenResponse {\n access_token: string;\n token_type: string;\n expires_at?: number | null;\n expires_in?: number | null;\n refresh_expires_in?: number | null;\n refresh_token?: string;\n id_token?: string;\n \"not-before-policy\"?: number | null;\n session_state?: string;\n scope?: string;\n profile?: {\n name: string;\n email: string;\n sub: string;\n };\n}\n\n// Authentication payload\nexport interface AuthPayload extends KeycloakTokenResponse {\n mode: AuthMode;\n}\n\n// Fact structure\nexport interface Fact {\n text: Corti.FactsCreateInput[\"text\"];\n group: string;\n source?: Corti.FactsCreateInput[\"source\"];\n}\n\n// Create interaction payload\nexport interface CreateInteractionPayload {\n assignedUserId?: Corti.InteractionsCreateRequest[\"assignedUserId\"] | null;\n encounter: {\n identifier: Corti.InteractionsCreateRequest[\"encounter\"][\"identifier\"];\n status: Corti.InteractionsCreateRequest[\"encounter\"][\"status\"];\n type: Corti.InteractionsCreateRequest[\"encounter\"][\"type\"];\n period: {\n startedAt: string;\n endedAt?: string;\n };\n title?: string;\n };\n patient?: {\n identifier?: Corti.InteractionsPatient[\"identifier\"];\n name?: string;\n birthDate?: string | null;\n gender?: Corti.InteractionsPatient[\"gender\"];\n };\n}\n\n// Add facts payload\nexport interface AddFactsPayload {\n facts: Fact[];\n}\n\n// Configure session payload\nexport interface ConfigureSessionPayload {\n defaultLanguage?: string;\n defaultOutputLanguage?: string;\n defaultTemplateKey?: string;\n defaultMode?: DefaultMode;\n}\n\n// Navigate payload\nexport interface NavigatePayload {\n path: string;\n}\n\n// Set credentials payload\nexport interface SetCredentialsPayload {\n password: string;\n}\n"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export type APIVersion = "v1";
|
|
2
|
+
export type MessageType = "CORTI_EMBEDDED" | "CORTI_EMBEDDED_RESPONSE" | "CORTI_EMBEDDED_EVENT";
|
|
3
|
+
export type AuthMode = "stateless" | "stateful";
|
|
4
|
+
export type DefaultMode = "virtual" | "in-person";
|
|
5
|
+
export type EmbeddedAction = "auth" | "createInteraction" | "addFacts" | "configureSession" | "navigate" | "startRecording" | "stopRecording" | "getStatus" | "getTemplates" | "configure" | "setCredentials";
|
|
6
|
+
export type DeprecatedEmbeddedEvent = "ready" | "loaded" | "recordingStarted" | "recordingStopped" | "documentGenerated" | "documentUpdated" | "documentSynced" | "authChanged" | "interactionCreated" | "navigationChanged" | "usage";
|
|
7
|
+
export interface BaseMessage {
|
|
8
|
+
type: MessageType;
|
|
9
|
+
version: APIVersion;
|
|
10
|
+
}
|
|
11
|
+
export interface EmbeddedRequest extends BaseMessage {
|
|
12
|
+
type: "CORTI_EMBEDDED";
|
|
13
|
+
action: EmbeddedAction;
|
|
14
|
+
requestId: string;
|
|
15
|
+
payload?: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface EmbeddedResponse extends BaseMessage {
|
|
18
|
+
type: "CORTI_EMBEDDED_RESPONSE";
|
|
19
|
+
action: EmbeddedAction;
|
|
20
|
+
requestId: string;
|
|
21
|
+
success: boolean;
|
|
22
|
+
payload?: unknown;
|
|
23
|
+
error?: string;
|
|
24
|
+
errorCode?: string;
|
|
25
|
+
errorDetails?: unknown;
|
|
26
|
+
}
|
|
27
|
+
interface BaseEventMessage extends BaseMessage {
|
|
28
|
+
type: "CORTI_EMBEDDED_EVENT";
|
|
29
|
+
event: string | DeprecatedEmbeddedEvent;
|
|
30
|
+
payload?: unknown;
|
|
31
|
+
}
|
|
32
|
+
export interface DeprecatedEmbeddedEventMessage extends BaseEventMessage {
|
|
33
|
+
event: DeprecatedEmbeddedEvent;
|
|
34
|
+
deprecated: true;
|
|
35
|
+
}
|
|
36
|
+
export interface EmbeddedEventMessage extends BaseEventMessage {
|
|
37
|
+
payload: null | Record<string, unknown>;
|
|
38
|
+
confidential: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface AuthRequest extends EmbeddedRequest {
|
|
41
|
+
action: "auth";
|
|
42
|
+
}
|
|
43
|
+
export interface CreateInteractionRequest extends EmbeddedRequest {
|
|
44
|
+
action: "createInteraction";
|
|
45
|
+
}
|
|
46
|
+
export interface AddFactsRequest extends EmbeddedRequest {
|
|
47
|
+
action: "addFacts";
|
|
48
|
+
}
|
|
49
|
+
export interface ConfigureSessionRequest extends EmbeddedRequest {
|
|
50
|
+
action: "configureSession";
|
|
51
|
+
}
|
|
52
|
+
export interface NavigateRequest extends EmbeddedRequest {
|
|
53
|
+
action: "navigate";
|
|
54
|
+
}
|
|
55
|
+
export interface StartRecordingRequest extends EmbeddedRequest {
|
|
56
|
+
action: "startRecording";
|
|
57
|
+
}
|
|
58
|
+
export interface StopRecordingRequest extends EmbeddedRequest {
|
|
59
|
+
action: "stopRecording";
|
|
60
|
+
}
|
|
61
|
+
export interface GetStatusRequest extends EmbeddedRequest {
|
|
62
|
+
action: "getStatus";
|
|
63
|
+
}
|
|
64
|
+
export interface GetTemplatesRequest extends EmbeddedRequest {
|
|
65
|
+
action: "getTemplates";
|
|
66
|
+
}
|
|
67
|
+
export interface ConfigureRequest extends EmbeddedRequest {
|
|
68
|
+
action: "configure";
|
|
69
|
+
}
|
|
70
|
+
export interface SetCredentialsRequest extends EmbeddedRequest {
|
|
71
|
+
action: "setCredentials";
|
|
72
|
+
}
|
|
73
|
+
export interface ReadyEvent extends DeprecatedEmbeddedEventMessage {
|
|
74
|
+
event: "ready";
|
|
75
|
+
}
|
|
76
|
+
export interface LoadedEvent extends DeprecatedEmbeddedEventMessage {
|
|
77
|
+
event: "loaded";
|
|
78
|
+
}
|
|
79
|
+
export interface RecordingStartedEvent extends DeprecatedEmbeddedEventMessage {
|
|
80
|
+
event: "recordingStarted";
|
|
81
|
+
}
|
|
82
|
+
export interface RecordingStoppedEvent extends DeprecatedEmbeddedEventMessage {
|
|
83
|
+
event: "recordingStopped";
|
|
84
|
+
}
|
|
85
|
+
export interface DocumentGeneratedEvent extends DeprecatedEmbeddedEventMessage {
|
|
86
|
+
event: "documentGenerated";
|
|
87
|
+
}
|
|
88
|
+
export interface DocumentUpdatedEvent extends DeprecatedEmbeddedEventMessage {
|
|
89
|
+
event: "documentUpdated";
|
|
90
|
+
}
|
|
91
|
+
export interface DocumentSyncedEvent extends DeprecatedEmbeddedEventMessage {
|
|
92
|
+
event: "documentSynced";
|
|
93
|
+
}
|
|
94
|
+
export interface AuthChangedEvent extends DeprecatedEmbeddedEventMessage {
|
|
95
|
+
event: "authChanged";
|
|
96
|
+
}
|
|
97
|
+
export interface InteractionCreatedEvent extends DeprecatedEmbeddedEventMessage {
|
|
98
|
+
event: "interactionCreated";
|
|
99
|
+
}
|
|
100
|
+
export interface NavigationChangedEvent extends DeprecatedEmbeddedEventMessage {
|
|
101
|
+
event: "navigationChanged";
|
|
102
|
+
}
|
|
103
|
+
export interface UsageEvent extends DeprecatedEmbeddedEventMessage {
|
|
104
|
+
event: "usage";
|
|
105
|
+
}
|
|
106
|
+
export type AnyEmbeddedRequest = AuthRequest | CreateInteractionRequest | AddFactsRequest | ConfigureSessionRequest | GetTemplatesRequest | NavigateRequest | StartRecordingRequest | StopRecordingRequest | GetStatusRequest | ConfigureRequest | SetCredentialsRequest;
|
|
107
|
+
export type AnyEmbeddedResponse = EmbeddedResponse;
|
|
108
|
+
export type AnyDeprecatedEmbeddedEvent = ReadyEvent | LoadedEvent | RecordingStartedEvent | RecordingStoppedEvent | DocumentGeneratedEvent | DocumentUpdatedEvent | DocumentSyncedEvent | AuthChangedEvent | InteractionCreatedEvent | NavigationChangedEvent | UsageEvent;
|
|
109
|
+
export type AnyEvent = EmbeddedEventMessage | AnyDeprecatedEmbeddedEvent;
|
|
110
|
+
export type AnyEmbeddedMessage = AnyEmbeddedRequest | AnyEmbeddedResponse | AnyDeprecatedEmbeddedEvent;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/types/protocol.ts"],"names":[],"mappings":"AAAA,4FAA4F","sourcesContent":["// Protocol types for communication between parent applications and embedded Corti Assistant\n\nexport type APIVersion = \"v1\";\n\nexport type MessageType = \"CORTI_EMBEDDED\" | \"CORTI_EMBEDDED_RESPONSE\" | \"CORTI_EMBEDDED_EVENT\";\n\nexport type AuthMode = \"stateless\" | \"stateful\";\n\nexport type DefaultMode = \"virtual\" | \"in-person\";\n\nexport type EmbeddedAction =\n | \"auth\"\n | \"createInteraction\"\n | \"addFacts\"\n | \"configureSession\"\n | \"navigate\"\n | \"startRecording\"\n | \"stopRecording\"\n | \"getStatus\"\n | \"getTemplates\"\n | \"configure\"\n | \"setCredentials\";\n\nexport type DeprecatedEmbeddedEvent =\n | \"ready\"\n | \"loaded\"\n | \"recordingStarted\"\n | \"recordingStopped\"\n | \"documentGenerated\"\n | \"documentUpdated\"\n | \"documentSynced\"\n | \"authChanged\"\n | \"interactionCreated\"\n | \"navigationChanged\"\n | \"usage\";\n\n// Base Message Types\nexport interface BaseMessage {\n type: MessageType;\n version: APIVersion;\n}\n\nexport interface EmbeddedRequest extends BaseMessage {\n type: \"CORTI_EMBEDDED\";\n action: EmbeddedAction;\n requestId: string;\n payload?: unknown;\n}\n\nexport interface EmbeddedResponse extends BaseMessage {\n type: \"CORTI_EMBEDDED_RESPONSE\";\n action: EmbeddedAction;\n requestId: string;\n success: boolean;\n payload?: unknown;\n error?: string;\n errorCode?: string;\n errorDetails?: unknown;\n}\n\ninterface BaseEventMessage extends BaseMessage {\n type: \"CORTI_EMBEDDED_EVENT\";\n event: string | DeprecatedEmbeddedEvent;\n payload?: unknown;\n}\n\nexport interface DeprecatedEmbeddedEventMessage extends BaseEventMessage {\n event: DeprecatedEmbeddedEvent;\n deprecated: true;\n}\n\nexport interface EmbeddedEventMessage extends BaseEventMessage {\n payload: null | Record<string, unknown>;\n confidential: boolean;\n}\n\n// Specific Request Types\nexport interface AuthRequest extends EmbeddedRequest {\n action: \"auth\";\n}\n\nexport interface CreateInteractionRequest extends EmbeddedRequest {\n action: \"createInteraction\";\n}\n\nexport interface AddFactsRequest extends EmbeddedRequest {\n action: \"addFacts\";\n}\n\nexport interface ConfigureSessionRequest extends EmbeddedRequest {\n action: \"configureSession\";\n}\n\nexport interface NavigateRequest extends EmbeddedRequest {\n action: \"navigate\";\n}\n\nexport interface StartRecordingRequest extends EmbeddedRequest {\n action: \"startRecording\";\n}\n\nexport interface StopRecordingRequest extends EmbeddedRequest {\n action: \"stopRecording\";\n}\n\nexport interface GetStatusRequest extends EmbeddedRequest {\n action: \"getStatus\";\n}\n\nexport interface GetTemplatesRequest extends EmbeddedRequest {\n action: \"getTemplates\";\n}\n\nexport interface ConfigureRequest extends EmbeddedRequest {\n action: \"configure\";\n}\n\nexport interface SetCredentialsRequest extends EmbeddedRequest {\n action: \"setCredentials\";\n}\n\n// Event Types\nexport interface ReadyEvent extends DeprecatedEmbeddedEventMessage {\n event: \"ready\";\n}\n\nexport interface LoadedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"loaded\";\n}\n\nexport interface RecordingStartedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"recordingStarted\";\n}\n\nexport interface RecordingStoppedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"recordingStopped\";\n}\n\nexport interface DocumentGeneratedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"documentGenerated\";\n}\n\nexport interface DocumentUpdatedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"documentUpdated\";\n}\n\nexport interface DocumentSyncedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"documentSynced\";\n}\n\nexport interface AuthChangedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"authChanged\";\n}\n\nexport interface InteractionCreatedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"interactionCreated\";\n}\n\nexport interface NavigationChangedEvent extends DeprecatedEmbeddedEventMessage {\n event: \"navigationChanged\";\n}\n\nexport interface UsageEvent extends DeprecatedEmbeddedEventMessage {\n event: \"usage\";\n}\n\n// Request/Response/Event type unions\nexport type AnyEmbeddedRequest =\n | AuthRequest\n | CreateInteractionRequest\n | AddFactsRequest\n | ConfigureSessionRequest\n | GetTemplatesRequest\n | NavigateRequest\n | StartRecordingRequest\n | StopRecordingRequest\n | GetStatusRequest\n | ConfigureRequest\n | SetCredentialsRequest;\n\nexport type AnyEmbeddedResponse = EmbeddedResponse;\n\nexport type AnyDeprecatedEmbeddedEvent =\n | ReadyEvent\n | LoadedEvent\n | RecordingStartedEvent\n | RecordingStoppedEvent\n | DocumentGeneratedEvent\n | DocumentUpdatedEvent\n | DocumentSyncedEvent\n | AuthChangedEvent\n | InteractionCreatedEvent\n | NavigationChangedEvent\n | UsageEvent;\n\nexport type AnyEvent = EmbeddedEventMessage | AnyDeprecatedEmbeddedEvent;\n\nexport type AnyEmbeddedMessage =\n | AnyEmbeddedRequest\n | AnyEmbeddedResponse\n | AnyDeprecatedEmbeddedEvent;\n"]}
|