@corti/embedded-web 0.1.1 → 0.3.1
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 +92 -50
- package/dist/CortiEmbedded.d.ts +34 -7
- package/dist/CortiEmbedded.js +274 -106
- package/dist/CortiEmbedded.js.map +1 -1
- package/dist/bundle.js +1699 -20
- package/dist/corti-embedded.d.ts +17 -1
- package/dist/corti-embedded.js +4 -3
- package/dist/corti-embedded.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/public-types.d.ts +185 -0
- package/dist/public-types.js +2 -0
- package/dist/public-types.js.map +1 -0
- package/dist/react/CortiEmbeddedReact.d.ts +32 -23
- package/dist/react/CortiEmbeddedReact.js +69 -21
- package/dist/react/CortiEmbeddedReact.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/styles/base.js +1 -1
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/container-styles.js +2 -2
- package/dist/styles/container-styles.js.map +1 -1
- package/dist/styles/theme.js +2 -2
- package/dist/styles/theme.js.map +1 -1
- package/dist/types/api.d.ts +36 -22
- package/dist/types/api.js.map +1 -1
- package/dist/types/config.d.ts +16 -2
- package/dist/types/config.js.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/payloads.d.ts +36 -4
- package/dist/types/payloads.js.map +1 -1
- package/dist/types/protocol.d.ts +9 -4
- package/dist/types/protocol.js.map +1 -1
- package/dist/types/responses.d.ts +10 -2
- package/dist/types/responses.js.map +1 -1
- package/dist/utils/PostMessageHandler.d.ts +19 -70
- package/dist/utils/PostMessageHandler.js +98 -201
- package/dist/utils/PostMessageHandler.js.map +1 -1
- package/dist/utils/baseUrl.js +8 -8
- package/dist/utils/baseUrl.js.map +1 -1
- package/dist/utils/embedUrl.js +3 -3
- package/dist/utils/embedUrl.js.map +1 -1
- package/dist/utils/errorFormatter.js +44 -20
- package/dist/utils/errorFormatter.js.map +1 -1
- package/dist/web-bundle.js +1555 -13
- package/dist/web-index.d.ts +3 -3
- package/dist/web-index.js +4 -4
- package/dist/web-index.js.map +1 -1
- package/package.json +20 -20
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-styles.js","sourceRoot":"","sources":["../../src/styles/container-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,sDAAsD;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BjC,CAAC","sourcesContent":["import { css } from
|
|
1
|
+
{"version":3,"file":"container-styles.js","sourceRoot":"","sources":["../../src/styles/container-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,sDAAsD;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BjC,CAAC","sourcesContent":["import { css } from \"lit\";\n\n// Main container styles for the Corti Agent component\nexport const containerStyles = css`\n :host {\n /* Make the component fill its container completely */\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n\n margin: 0;\n padding: 0;\n background-color: transparent;\n overflow: hidden;\n }\n\n /* Handle visibility state */\n :host([visibility=\"hidden\"]) {\n display: none;\n }\n\n /* Ensure iframe fills the entire component */\n iframe {\n width: 100% !important;\n height: 100% !important;\n border: none !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n`;\n"]}
|
package/dist/styles/theme.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { css } from
|
|
1
|
+
import { css } from "lit";
|
|
2
2
|
const ThemeStyles = css `
|
|
3
3
|
:host {
|
|
4
4
|
color-scheme: light dark;
|
|
5
5
|
/* Component Defaults */
|
|
6
|
-
--component-font-family:
|
|
6
|
+
--component-font-family: "Segoe UI", Roboto, sans-serif;
|
|
7
7
|
|
|
8
8
|
/* Plain (Default) Colors */
|
|
9
9
|
--plain-bg-color: light-dark(#f5f5f5, #3a3a3a);
|
package/dist/styles/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiGtB,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { css } from
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiGtB,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { css } from \"lit\";\n\nconst ThemeStyles = css`\n :host {\n color-scheme: light dark;\n /* Component Defaults */\n --component-font-family: \"Segoe UI\", Roboto, sans-serif;\n\n /* Plain (Default) Colors */\n --plain-bg-color: light-dark(#f5f5f5, #3a3a3a);\n --plain-border-color: light-dark(\n rgba(0, 0, 0, 0.08),\n rgba(255, 255, 255, 0.1)\n );\n --plain-active-color: light-dark(#f0f0f0, #393939);\n --plain-text-color: light-dark(#333, #eee);\n\n /* Accent Colors */\n --accent-bg-color: light-dark(#232323, #ffffff);\n --accent-border-color: light-dark(#1a1a1a, #f5f5f5);\n --accent-active-color: light-dark(#3a3a3a, #f5f5f5);\n --accent-text-color: light-dark(#fff, #333);\n\n /* User Colors (Same as Plain) */\n --msg-user-bg-color: var(--plain-bg-color);\n --msg-user-border-color: var(--plain-border-color);\n --msg-user-active-color: var(--plain-active-color);\n --msg-user-text-color: var(--plain-text-color);\n\n /* Response Colors */\n --msg-agent-bg-color: transparent;\n --msg-agent-border-color: light-dark(\n rgba(0, 0, 0, 0.05),\n rgba(255, 255, 255, 0.08)\n );\n --msg-agent-active-color: light-dark(\n rgba(0, 0, 0, 0.02),\n rgba(255, 255, 255, 0.05)\n );\n --msg-agent-text-color: var(--plain-text-color);\n\n /* Success Colors */\n --success-bg-color: light-dark(\n rgba(34, 197, 94, 0.1),\n rgba(34, 197, 94, 0.2)\n );\n --success-border-color: light-dark(\n rgba(34, 197, 94, 0.2),\n rgba(34, 197, 94, 0.3)\n );\n --success-active-color: light-dark(\n rgba(34, 197, 94, 0.15),\n rgba(34, 197, 94, 0.25)\n );\n --success-text-color: light-dark(#22c55e, #4ade80);\n\n /* Info Colors */\n --info-bg-color: light-dark(\n rgba(59, 130, 246, 0.1),\n rgba(59, 130, 246, 0.2)\n );\n --info-border-color: light-dark(\n rgba(59, 130, 246, 0.2),\n rgba(59, 130, 246, 0.3)\n );\n --info-active-color: light-dark(\n rgba(59, 130, 246, 0.15),\n rgba(59, 130, 246, 0.25)\n );\n --info-text-color: light-dark(#3b82f6, #60a5fa);\n\n /* Error Colors */\n --error-bg-color: light-dark(\n rgba(239, 68, 68, 0.1),\n rgba(239, 68, 68, 0.2)\n );\n --error-border-color: light-dark(\n rgba(239, 68, 68, 0.2),\n rgba(239, 68, 68, 0.3)\n );\n --error-active-color: light-dark(\n rgba(239, 68, 68, 0.15),\n rgba(239, 68, 68, 0.25)\n );\n --error-text-color: light-dark(#ef4444, #f87171);\n\n /* Layout defaults */\n --base-background: light-dark(#fff, #222);\n --card-padding: 8px;\n --card-border-radius: 12px;\n --card-inner-border-radius: 8px;\n --card-box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);\n }\n\n :host {\n /* Apply base font and color directly to the host */\n font-family: var(--component-font-family);\n color: var(--plain-text-color);\n }\n`;\n\nexport default ThemeStyles;\n"]}
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import type { ConfigureAppPayload } from
|
|
2
|
-
import type { AuthChangedEventPayload, DocumentEventPayload, ErrorEventPayload, InteractionCreatedEventPayload, NavigationChangedEventPayload, UsageEventPayload } from
|
|
3
|
-
import type { AddFactsPayload,
|
|
4
|
-
import type { DefaultMode } from
|
|
5
|
-
import type { AuthResponse, ConfigureAppResponse, CreateInteractionResponse, GetStatusResponse, GetTemplatesResponse } from
|
|
6
|
-
export type { ConfigureAppPayload } from
|
|
7
|
-
export type { UserInfo } from
|
|
8
|
-
/**
|
|
9
|
-
* Authentication credentials for Assistant
|
|
10
|
-
*/
|
|
11
|
-
export type AuthCredentials = AuthPayload;
|
|
1
|
+
import type { ConfigureAppPayload, ConfigurePayload } from "./config.js";
|
|
2
|
+
import type { AuthChangedEventPayload, DocumentEventPayload, ErrorEventPayload, InteractionCreatedEventPayload, NavigationChangedEventPayload, UsageEventPayload } from "./events.js";
|
|
3
|
+
import type { AddFactsPayload, ConfigureSessionPayload, CreateInteractionPayload, Fact, KeycloakTokenResponse, NavigatePayload, SetInteractionOptionsPayload, SetCredentialsPayload } from "./payloads.js";
|
|
4
|
+
import type { DefaultMode } from "./protocol.js";
|
|
5
|
+
import type { AuthResponse, ConfigureAppResponse, ConfigureResponse, CreateInteractionResponse, GetStatusResponse, GetTemplatesResponse } from "./responses.js";
|
|
6
|
+
export type { ConfigureAppPayload, ConfigurePayload } from "./config.js";
|
|
7
|
+
export type { UserInfo } from "./responses.js";
|
|
12
8
|
/**
|
|
13
9
|
* User information returned from authentication
|
|
14
10
|
*/
|
|
@@ -37,14 +33,14 @@ export interface SessionConfig {
|
|
|
37
33
|
*/
|
|
38
34
|
export interface EmbeddedEventData {
|
|
39
35
|
ready: undefined;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
"auth-changed": AuthChangedEventPayload;
|
|
37
|
+
"interaction-created": InteractionCreatedEventPayload;
|
|
38
|
+
"recording-started": undefined;
|
|
39
|
+
"recording-stopped": undefined;
|
|
40
|
+
"document-generated": DocumentEventPayload;
|
|
41
|
+
"document-updated": DocumentEventPayload;
|
|
42
|
+
"document-synced": DocumentEventPayload;
|
|
43
|
+
"navigation-changed": NavigationChangedEventPayload;
|
|
48
44
|
usage: UsageEventPayload;
|
|
49
45
|
error: ErrorEventPayload;
|
|
50
46
|
}
|
|
@@ -52,8 +48,10 @@ export interface CortiEmbeddedV1API {
|
|
|
52
48
|
auth(payload: KeycloakTokenResponse): Promise<AuthResponse>;
|
|
53
49
|
createInteraction(payload: CreateInteractionPayload): Promise<CreateInteractionResponse>;
|
|
54
50
|
addFacts(payload: AddFactsPayload): Promise<void>;
|
|
51
|
+
configureApp(payload: ConfigureAppPayload): Promise<ConfigureAppResponse>;
|
|
55
52
|
configureSession(payload: ConfigureSessionPayload): Promise<void>;
|
|
56
|
-
|
|
53
|
+
setInteractionOptions(payload: SetInteractionOptionsPayload): Promise<void>;
|
|
54
|
+
configure(payload: ConfigurePayload): Promise<ConfigureResponse>;
|
|
57
55
|
navigate(payload: NavigatePayload): Promise<void>;
|
|
58
56
|
startRecording(): Promise<void>;
|
|
59
57
|
stopRecording(): Promise<void>;
|
|
@@ -82,7 +80,7 @@ export interface CortiEmbeddedAPI {
|
|
|
82
80
|
* @param credentials Authentication credentials
|
|
83
81
|
* @returns Promise resolving to user information
|
|
84
82
|
*/
|
|
85
|
-
auth(credentials:
|
|
83
|
+
auth(credentials: KeycloakTokenResponse): Promise<User>;
|
|
86
84
|
/**
|
|
87
85
|
* Create a new interaction
|
|
88
86
|
* @param encounter Encounter request data
|
|
@@ -127,12 +125,28 @@ export interface CortiEmbeddedAPI {
|
|
|
127
125
|
* @returns Promise resolving to list of templates
|
|
128
126
|
*/
|
|
129
127
|
getTemplates(): Promise<GetTemplatesResponse>;
|
|
128
|
+
/**
|
|
129
|
+
* Configure the embedded application
|
|
130
|
+
* @param config Application-level configuration
|
|
131
|
+
* @returns Promise that resolves when configuration is applied
|
|
132
|
+
*/
|
|
133
|
+
configureApp(config: ConfigureAppPayload): Promise<ConfigureAppResponse>;
|
|
130
134
|
/**
|
|
131
135
|
* Configure the application
|
|
132
136
|
* @param config Application configuration
|
|
133
137
|
* @returns Promise that resolves when configuration is applied
|
|
134
138
|
*/
|
|
135
|
-
configure(config:
|
|
139
|
+
configure(config: ConfigurePayload): Promise<ConfigureResponse>;
|
|
140
|
+
/**
|
|
141
|
+
* Set one-shot interaction options for the embedded instance.
|
|
142
|
+
*
|
|
143
|
+
* Each call patches the provided interaction-options branches onto the current
|
|
144
|
+
* snapshot for the embedded instance. Omitted branches preserve their existing
|
|
145
|
+
* values from previous calls.
|
|
146
|
+
* @param config Interaction/session-level options
|
|
147
|
+
* @returns Promise that resolves when options are applied
|
|
148
|
+
*/
|
|
149
|
+
setInteractionOptions(config: SetInteractionOptionsPayload): Promise<void>;
|
|
136
150
|
/**
|
|
137
151
|
* Set authentication credentials without triggering auth flow
|
|
138
152
|
* @param credentials Authentication credentials to store
|
package/dist/types/api.js.map
CHANGED
|
@@ -1 +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
|
|
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, ConfigurePayload } 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 ConfigureSessionPayload,\n CreateInteractionPayload,\n Fact,\n KeycloakTokenResponse,\n NavigatePayload,\n SetInteractionOptionsPayload,\n SetCredentialsPayload,\n} from \"./payloads.js\";\nimport type { DefaultMode } from \"./protocol.js\";\nimport type {\n AuthResponse,\n ConfigureAppResponse,\n ConfigureResponse,\n CreateInteractionResponse,\n GetStatusResponse,\n GetTemplatesResponse,\n} from \"./responses.js\";\n\nexport type { ConfigureAppPayload, ConfigurePayload } from \"./config.js\";\n// Re-export common types for public API\nexport type { UserInfo } from \"./responses.js\";\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 configureApp(payload: ConfigureAppPayload): Promise<ConfigureAppResponse>;\n configureSession(payload: ConfigureSessionPayload): Promise<void>;\n setInteractionOptions(payload: SetInteractionOptionsPayload): Promise<void>;\n configure(payload: ConfigurePayload): Promise<ConfigureResponse>;\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: KeycloakTokenResponse): 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 embedded application\n * @param config Application-level configuration\n * @returns Promise that resolves when configuration is applied\n */\n configureApp(config: ConfigureAppPayload): Promise<ConfigureAppResponse>;\n\n /**\n * Configure the application\n * @param config Application configuration\n * @returns Promise that resolves when configuration is applied\n */\n configure(config: ConfigurePayload): Promise<ConfigureResponse>;\n\n /**\n * Set one-shot interaction options for the embedded instance.\n *\n * Each call patches the provided interaction-options branches onto the current\n * snapshot for the embedded instance. Omitted branches preserve their existing\n * values from previous calls.\n * @param config Interaction/session-level options\n * @returns Promise that resolves when options are applied\n */\n setInteractionOptions(config: SetInteractionOptionsPayload): Promise<void>;\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"]}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export interface AppearanceConfig {
|
|
2
2
|
primaryColor: string | null;
|
|
3
3
|
}
|
|
4
|
-
export interface
|
|
4
|
+
export interface UIConfig {
|
|
5
|
+
interactionTitle: boolean;
|
|
6
|
+
aiChat: boolean;
|
|
7
|
+
documentFeedback: boolean;
|
|
8
|
+
navigation: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ConfigureFeaturesConfig {
|
|
5
11
|
interactionTitle: boolean;
|
|
6
12
|
aiChat: boolean;
|
|
7
13
|
documentFeedback: boolean;
|
|
@@ -18,9 +24,17 @@ export interface LocaleConfig {
|
|
|
18
24
|
export interface NetworkConfig {
|
|
19
25
|
websocketBaseUrl?: string | null;
|
|
20
26
|
}
|
|
27
|
+
export interface ConfigurePayload {
|
|
28
|
+
debug?: boolean;
|
|
29
|
+
appearance?: Partial<AppearanceConfig>;
|
|
30
|
+
features?: Partial<ConfigureFeaturesConfig>;
|
|
31
|
+
locale?: Partial<LocaleConfig>;
|
|
32
|
+
network?: Partial<NetworkConfig>;
|
|
33
|
+
}
|
|
21
34
|
export interface ConfigureAppPayload {
|
|
35
|
+
debug?: boolean;
|
|
36
|
+
ui?: Partial<UIConfig>;
|
|
22
37
|
appearance?: Partial<AppearanceConfig>;
|
|
23
|
-
features?: Partial<FeaturesConfig>;
|
|
24
38
|
locale?: Partial<LocaleConfig>;
|
|
25
39
|
network?: Partial<NetworkConfig>;
|
|
26
40
|
}
|
package/dist/types/config.js.map
CHANGED
|
@@ -1 +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
|
|
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 UIConfig {\n interactionTitle: boolean;\n aiChat: boolean;\n documentFeedback: boolean;\n navigation: boolean;\n}\n\nexport interface ConfigureFeaturesConfig {\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 ConfigurePayload {\n debug?: boolean;\n appearance?: Partial<AppearanceConfig>;\n features?: Partial<ConfigureFeaturesConfig>;\n locale?: Partial<LocaleConfig>;\n network?: Partial<NetworkConfig>;\n}\n\nexport interface ConfigureAppPayload {\n debug?: boolean;\n ui?: Partial<UIConfig>;\n appearance?: Partial<AppearanceConfig>;\n locale?: Partial<LocaleConfig>;\n network?: Partial<NetworkConfig>;\n}\n"]}
|
package/dist/types/index.js
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,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 @assistant/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"]}
|
package/dist/types/payloads.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Corti } from "@corti/sdk";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DefaultMode } from "./protocol.js";
|
|
3
3
|
export interface KeycloakTokenResponse {
|
|
4
4
|
access_token: string;
|
|
5
5
|
token_type: string;
|
|
@@ -17,9 +17,6 @@ export interface KeycloakTokenResponse {
|
|
|
17
17
|
sub: string;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
export interface AuthPayload extends KeycloakTokenResponse {
|
|
21
|
-
mode: AuthMode;
|
|
22
|
-
}
|
|
23
20
|
export interface Fact {
|
|
24
21
|
text: Corti.FactsCreateInput["text"];
|
|
25
22
|
group: string;
|
|
@@ -53,6 +50,41 @@ export interface ConfigureSessionPayload {
|
|
|
53
50
|
defaultTemplateKey?: string;
|
|
54
51
|
defaultMode?: DefaultMode;
|
|
55
52
|
}
|
|
53
|
+
export interface InteractionModeOptions {
|
|
54
|
+
fallback: DefaultMode;
|
|
55
|
+
options: DefaultMode[];
|
|
56
|
+
}
|
|
57
|
+
export interface SpokenLanguageOptions {
|
|
58
|
+
fallback: string;
|
|
59
|
+
}
|
|
60
|
+
export interface InteractionTemplateReference {
|
|
61
|
+
source: "standard";
|
|
62
|
+
id: string;
|
|
63
|
+
}
|
|
64
|
+
export interface DefaultInteractionTemplateOptions {
|
|
65
|
+
behaviour: "fallback";
|
|
66
|
+
template: InteractionTemplateReference;
|
|
67
|
+
}
|
|
68
|
+
export interface InteractionTemplateSources {
|
|
69
|
+
personal?: {
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface InteractionTemplateOptions {
|
|
74
|
+
sources?: InteractionTemplateSources;
|
|
75
|
+
defaultTemplate?: DefaultInteractionTemplateOptions;
|
|
76
|
+
}
|
|
77
|
+
export interface InteractionDocumentOptions {
|
|
78
|
+
actions?: {
|
|
79
|
+
sync?: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface SetInteractionOptionsPayload {
|
|
83
|
+
mode?: InteractionModeOptions;
|
|
84
|
+
spokenLanguage?: SpokenLanguageOptions;
|
|
85
|
+
templates?: InteractionTemplateOptions;
|
|
86
|
+
documents?: InteractionDocumentOptions;
|
|
87
|
+
}
|
|
56
88
|
export interface NavigatePayload {
|
|
57
89
|
path: string;
|
|
58
90
|
}
|
|
@@ -1 +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 {
|
|
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 { 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// 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\nexport interface InteractionModeOptions {\n fallback: DefaultMode;\n options: DefaultMode[];\n}\n\nexport interface SpokenLanguageOptions {\n fallback: string;\n}\n\nexport interface InteractionTemplateReference {\n source: \"standard\";\n id: string;\n}\n\nexport interface DefaultInteractionTemplateOptions {\n behaviour: \"fallback\";\n template: InteractionTemplateReference;\n}\n\nexport interface InteractionTemplateSources {\n personal?: {\n enabled: boolean;\n };\n}\n\nexport interface InteractionTemplateOptions {\n sources?: InteractionTemplateSources;\n defaultTemplate?: DefaultInteractionTemplateOptions;\n}\n\nexport interface InteractionDocumentOptions {\n actions?: {\n sync?: boolean;\n };\n}\n\nexport interface SetInteractionOptionsPayload {\n mode?: InteractionModeOptions;\n spokenLanguage?: SpokenLanguageOptions;\n templates?: InteractionTemplateOptions;\n documents?: InteractionDocumentOptions;\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"]}
|
package/dist/types/protocol.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export type APIVersion = "v1";
|
|
2
2
|
export type MessageType = "CORTI_EMBEDDED" | "CORTI_EMBEDDED_RESPONSE" | "CORTI_EMBEDDED_EVENT";
|
|
3
|
-
export type AuthMode = "stateless" | "stateful";
|
|
4
3
|
export type DefaultMode = "virtual" | "in-person";
|
|
5
|
-
export type EmbeddedAction = "auth" | "createInteraction" | "addFacts" | "configureSession" | "navigate" | "startRecording" | "stopRecording" | "getStatus" | "getTemplates" | "configure" | "setCredentials";
|
|
4
|
+
export type EmbeddedAction = "auth" | "createInteraction" | "addFacts" | "configureApp" | "configureSession" | "setInteractionOptions" | "navigate" | "startRecording" | "stopRecording" | "getStatus" | "getTemplates" | "configure" | "setCredentials";
|
|
6
5
|
export type DeprecatedEmbeddedEvent = "ready" | "loaded" | "recordingStarted" | "recordingStopped" | "documentGenerated" | "documentUpdated" | "documentSynced" | "authChanged" | "interactionCreated" | "navigationChanged" | "usage";
|
|
7
6
|
export interface BaseMessage {
|
|
8
7
|
type: MessageType;
|
|
@@ -49,6 +48,12 @@ export interface AddFactsRequest extends EmbeddedRequest {
|
|
|
49
48
|
export interface ConfigureSessionRequest extends EmbeddedRequest {
|
|
50
49
|
action: "configureSession";
|
|
51
50
|
}
|
|
51
|
+
export interface ConfigureAppRequest extends EmbeddedRequest {
|
|
52
|
+
action: "configureApp";
|
|
53
|
+
}
|
|
54
|
+
export interface SetInteractionOptionsRequest extends EmbeddedRequest {
|
|
55
|
+
action: "setInteractionOptions";
|
|
56
|
+
}
|
|
52
57
|
export interface NavigateRequest extends EmbeddedRequest {
|
|
53
58
|
action: "navigate";
|
|
54
59
|
}
|
|
@@ -103,9 +108,9 @@ export interface NavigationChangedEvent extends DeprecatedEmbeddedEventMessage {
|
|
|
103
108
|
export interface UsageEvent extends DeprecatedEmbeddedEventMessage {
|
|
104
109
|
event: "usage";
|
|
105
110
|
}
|
|
106
|
-
export type AnyEmbeddedRequest = AuthRequest | CreateInteractionRequest | AddFactsRequest | ConfigureSessionRequest | GetTemplatesRequest | NavigateRequest | StartRecordingRequest | StopRecordingRequest | GetStatusRequest | ConfigureRequest | SetCredentialsRequest;
|
|
111
|
+
export type AnyEmbeddedRequest = AuthRequest | CreateInteractionRequest | AddFactsRequest | ConfigureAppRequest | ConfigureSessionRequest | GetTemplatesRequest | NavigateRequest | SetInteractionOptionsRequest | StartRecordingRequest | StopRecordingRequest | GetStatusRequest | ConfigureRequest | SetCredentialsRequest;
|
|
107
112
|
export type AnyEmbeddedResponse = EmbeddedResponse;
|
|
108
113
|
export type AnyDeprecatedEmbeddedEvent = ReadyEvent | LoadedEvent | RecordingStartedEvent | RecordingStoppedEvent | DocumentGeneratedEvent | DocumentUpdatedEvent | DocumentSyncedEvent | AuthChangedEvent | InteractionCreatedEvent | NavigationChangedEvent | UsageEvent;
|
|
109
114
|
export type AnyEvent = EmbeddedEventMessage | AnyDeprecatedEmbeddedEvent;
|
|
110
|
-
export type AnyEmbeddedMessage = AnyEmbeddedRequest | AnyEmbeddedResponse |
|
|
115
|
+
export type AnyEmbeddedMessage = AnyEmbeddedRequest | AnyEmbeddedResponse | AnyEvent;
|
|
111
116
|
export {};
|
|
@@ -1 +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
|
|
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 DefaultMode = \"virtual\" | \"in-person\";\n\nexport type EmbeddedAction =\n | \"auth\"\n | \"createInteraction\"\n | \"addFacts\"\n | \"configureApp\"\n | \"configureSession\"\n | \"setInteractionOptions\"\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 ConfigureAppRequest extends EmbeddedRequest {\n action: \"configureApp\";\n}\n\nexport interface SetInteractionOptionsRequest extends EmbeddedRequest {\n action: \"setInteractionOptions\";\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 | ConfigureAppRequest\n | ConfigureSessionRequest\n | GetTemplatesRequest\n | NavigateRequest\n | SetInteractionOptionsRequest\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 = AnyEmbeddedRequest | AnyEmbeddedResponse | AnyEvent;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppearanceConfig,
|
|
1
|
+
import type { AppearanceConfig, ConfigureFeaturesConfig, LocaleConfig, NetworkConfig, UIConfig } from "./config.js";
|
|
2
2
|
import type { EmbeddedInterviewDetails } from "./generated/interview-details.js";
|
|
3
3
|
export interface UserInfo {
|
|
4
4
|
id: string;
|
|
@@ -40,9 +40,17 @@ export interface GetStatusResponse {
|
|
|
40
40
|
export interface GetTemplatesResponse {
|
|
41
41
|
templates: EmbeddedTemplate[];
|
|
42
42
|
}
|
|
43
|
+
export interface ConfigureResponse {
|
|
44
|
+
debug?: boolean;
|
|
45
|
+
appearance: AppearanceConfig;
|
|
46
|
+
features: ConfigureFeaturesConfig;
|
|
47
|
+
locale: LocaleConfig;
|
|
48
|
+
network: NetworkConfig;
|
|
49
|
+
}
|
|
43
50
|
export interface ConfigureAppResponse {
|
|
51
|
+
debug?: boolean;
|
|
44
52
|
appearance: AppearanceConfig;
|
|
45
|
-
|
|
53
|
+
ui: UIConfig;
|
|
46
54
|
locale: LocaleConfig;
|
|
47
55
|
network: NetworkConfig;
|
|
48
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/types/responses.ts"],"names":[],"mappings":"AAAA,kCAAkC","sourcesContent":["// Response types for embedded API\n\nimport type {
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/types/responses.ts"],"names":[],"mappings":"AAAA,kCAAkC","sourcesContent":["// Response types for embedded API\n\nimport type {\n AppearanceConfig,\n ConfigureFeaturesConfig,\n LocaleConfig,\n NetworkConfig,\n UIConfig,\n} from \"./config.js\";\nimport type { EmbeddedInterviewDetails } from \"./generated/interview-details.js\";\n\nexport interface UserInfo {\n id: string;\n email: string;\n name?: string;\n [key: string]: unknown;\n}\n\nexport interface AuthResponse {\n user: UserInfo;\n}\n\nexport interface CreateInteractionResponse {\n id: string;\n createdAt: string;\n status?: string;\n}\n\nexport interface EmbeddedTemplate {\n id: string;\n name: string;\n description?: string;\n language: {\n code: string;\n name: string;\n locale?: string;\n };\n sections: Array<{\n id: string;\n title: string;\n }>;\n isCustom: boolean;\n}\n\nexport interface GetStatusResponse {\n auth: {\n isAuthenticated: boolean;\n user?: UserInfo;\n };\n currentUrl: string;\n interaction: EmbeddedInterviewDetails | null;\n}\n\nexport interface GetTemplatesResponse {\n templates: EmbeddedTemplate[];\n}\n\nexport interface ConfigureResponse {\n debug?: boolean;\n appearance: AppearanceConfig;\n features: ConfigureFeaturesConfig;\n locale: LocaleConfig;\n network: NetworkConfig;\n}\n\nexport interface ConfigureAppResponse {\n debug?: boolean;\n appearance: AppearanceConfig;\n ui: UIConfig;\n locale: LocaleConfig;\n network: NetworkConfig;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EmbeddedRequest, EmbeddedResponse } from "../types";
|
|
2
2
|
export interface PostMessageHandlerCallbacks {
|
|
3
3
|
onEvent?: (event: {
|
|
4
4
|
name: string;
|
|
@@ -9,12 +9,20 @@ export interface PostMessageHandlerCallbacks {
|
|
|
9
9
|
code?: string;
|
|
10
10
|
details?: unknown;
|
|
11
11
|
}) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Default timeout in milliseconds for postMessage requests.
|
|
14
|
+
* @default 10000
|
|
15
|
+
*/
|
|
16
|
+
requestTimeout?: number;
|
|
12
17
|
}
|
|
13
18
|
export declare class PostMessageHandler {
|
|
14
19
|
private pendingRequests;
|
|
15
20
|
private messageListener;
|
|
16
21
|
private iframe;
|
|
17
22
|
private isReady;
|
|
23
|
+
private _protocolVersion;
|
|
24
|
+
private static readonly SUPPORTED_PROTOCOL_VERSION;
|
|
25
|
+
private readonly requestTimeout;
|
|
18
26
|
private callbacks;
|
|
19
27
|
constructor(iframe: HTMLIFrameElement, callbacks?: PostMessageHandlerCallbacks);
|
|
20
28
|
private setupMessageListener;
|
|
@@ -26,84 +34,25 @@ export declare class PostMessageHandler {
|
|
|
26
34
|
*/
|
|
27
35
|
updateCallbacks(callbacks: PostMessageHandlerCallbacks): void;
|
|
28
36
|
/**
|
|
29
|
-
*
|
|
37
|
+
* Whether the iframe has signaled it is ready to receive postMessages
|
|
30
38
|
*/
|
|
31
39
|
get ready(): boolean;
|
|
32
40
|
/**
|
|
33
|
-
*
|
|
41
|
+
* The protocol version reported by the iframe in its 'embedded.ready' event,
|
|
42
|
+
* or null if the version was not included in the ready payload.
|
|
43
|
+
*/
|
|
44
|
+
get protocolVersion(): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Wait for the iframe to signal readiness via the 'embedded.ready' event.
|
|
34
47
|
* @param timeout - Optional timeout in milliseconds (default: 30000ms)
|
|
35
|
-
* @returns Promise that resolves when ready
|
|
36
48
|
*/
|
|
37
49
|
waitForReady(timeout?: number): Promise<void>;
|
|
38
50
|
/**
|
|
39
|
-
* Sends a postMessage to the iframe and returns a Promise that resolves with the response
|
|
51
|
+
* Sends a postMessage to the iframe and returns a Promise that resolves with the response.
|
|
40
52
|
* @param message - The message to send
|
|
41
|
-
* @param timeout - Optional timeout in milliseconds
|
|
42
|
-
* @returns Promise that resolves with the response
|
|
43
|
-
*/
|
|
44
|
-
postMessage(message: Omit<EmbeddedRequest, 'requestId'>, timeout?: number): Promise<EmbeddedResponse>;
|
|
45
|
-
/**
|
|
46
|
-
* Helper method to send an auth message and return clean user data
|
|
47
|
-
* @param payload - Auth payload
|
|
48
|
-
* @returns Promise that resolves with user data
|
|
49
|
-
*/
|
|
50
|
-
auth(payload: AuthPayload): Promise<AuthResponse['user']>;
|
|
51
|
-
/**
|
|
52
|
-
* Helper method to configure a session
|
|
53
|
-
* @param payload - Session configuration payload
|
|
54
|
-
* @returns Promise that resolves when configuration is complete
|
|
55
|
-
*/
|
|
56
|
-
configureSession(payload: ConfigureSessionPayload): Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Helper method to navigate to a specific path
|
|
59
|
-
* @param payload - Navigation payload
|
|
60
|
-
* @returns Promise that resolves when navigation is complete
|
|
61
|
-
*/
|
|
62
|
-
navigate(payload: NavigatePayload): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Helper method to add facts to the session
|
|
65
|
-
* @param payload - Facts payload
|
|
66
|
-
* @returns Promise that resolves when facts are added
|
|
67
|
-
*/
|
|
68
|
-
addFacts(payload: AddFactsPayload): Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* Helper method to create a new interaction and return clean interaction data
|
|
71
|
-
* @param payload - Interaction creation payload
|
|
72
|
-
* @returns Promise that resolves with interaction details
|
|
73
|
-
*/
|
|
74
|
-
createInteraction(payload: CreateInteractionPayload): Promise<CreateInteractionResponse>;
|
|
75
|
-
/**
|
|
76
|
-
* Helper method to start recording
|
|
77
|
-
* @returns Promise that resolves when recording starts
|
|
78
|
-
*/
|
|
79
|
-
startRecording(): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* Helper method to stop recording
|
|
82
|
-
* @returns Promise that resolves when recording stops
|
|
83
|
-
*/
|
|
84
|
-
stopRecording(): Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Helper method to get current status
|
|
87
|
-
* @returns Promise that resolves with current status
|
|
88
|
-
*/
|
|
89
|
-
getStatus(): Promise<GetStatusResponse>;
|
|
90
|
-
/**
|
|
91
|
-
* Helper method to configure the component
|
|
92
|
-
* @param payload - Component configuration payload
|
|
93
|
-
* @returns Promise that resolves when configuration is applied
|
|
94
|
-
*/
|
|
95
|
-
configure(payload: ConfigureAppPayload): Promise<ConfigureAppResponse>;
|
|
96
|
-
/**
|
|
97
|
-
* Helper method to set credentials without triggering auth flow
|
|
98
|
-
* @param payload - Credentials payload
|
|
99
|
-
* @returns Promise that resolves when credentials are set
|
|
100
|
-
*/
|
|
101
|
-
setCredentials(payload: SetCredentialsPayload): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Helper method to get templates
|
|
104
|
-
* @returns Promise that resolves with a list of templates
|
|
53
|
+
* @param timeout - Optional timeout in milliseconds. Defaults to the requestTimeout set at construction.
|
|
105
54
|
*/
|
|
106
|
-
|
|
55
|
+
postMessage(message: Omit<EmbeddedRequest, "requestId">, timeout?: number): Promise<EmbeddedResponse>;
|
|
107
56
|
private static generateRequestId;
|
|
108
57
|
/**
|
|
109
58
|
* Derive the trusted origin from the iframe src (constructed from baseURL).
|