@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.
Files changed (50) hide show
  1. package/README.md +69 -41
  2. package/dist/CortiEmbedded.d.ts +9 -5
  3. package/dist/CortiEmbedded.js +30 -40
  4. package/dist/CortiEmbedded.js.map +1 -1
  5. package/dist/bundle.js +7 -7
  6. package/dist/index.d.ts +2 -3
  7. package/dist/index.js +3 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/react/CortiEmbeddedReact.d.ts +38 -15
  10. package/dist/react/CortiEmbeddedReact.js +95 -15
  11. package/dist/react/CortiEmbeddedReact.js.map +1 -1
  12. package/dist/tsconfig.tsbuildinfo +1 -1
  13. package/dist/types/api.d.ts +152 -0
  14. package/dist/types/api.js +3 -0
  15. package/dist/types/api.js.map +1 -0
  16. package/dist/types/config.d.ts +26 -0
  17. package/dist/types/config.js +3 -0
  18. package/dist/types/config.js.map +1 -0
  19. package/dist/types/events.d.ts +28 -0
  20. package/dist/types/events.js +2 -0
  21. package/dist/types/events.js.map +1 -0
  22. package/dist/types/generated/interview-details.d.ts +159 -0
  23. package/dist/types/generated/interview-details.js +4 -0
  24. package/dist/types/generated/interview-details.js.map +1 -0
  25. package/dist/types/index.d.ts +6 -0
  26. package/dist/types/index.js +14 -0
  27. package/dist/types/index.js.map +1 -0
  28. package/dist/types/payloads.d.ts +61 -0
  29. package/dist/types/payloads.js +2 -0
  30. package/dist/types/payloads.js.map +1 -0
  31. package/dist/types/protocol.d.ts +111 -0
  32. package/dist/types/protocol.js +3 -0
  33. package/dist/types/protocol.js.map +1 -0
  34. package/dist/types/responses.d.ts +48 -0
  35. package/dist/types/responses.js +3 -0
  36. package/dist/types/responses.js.map +1 -0
  37. package/dist/utils/PostMessageHandler.d.ts +11 -17
  38. package/dist/utils/PostMessageHandler.js +29 -40
  39. package/dist/utils/PostMessageHandler.js.map +1 -1
  40. package/dist/web-bundle.js +4 -4
  41. package/dist/web-index.d.ts +1 -1
  42. package/dist/web-index.js +2 -0
  43. package/dist/web-index.js.map +1 -1
  44. package/package.json +4 -3
  45. package/dist/internal-types.d.ts +0 -231
  46. package/dist/internal-types.js +0 -2
  47. package/dist/internal-types.js.map +0 -1
  48. package/dist/public-types.d.ts +0 -238
  49. package/dist/public-types.js +0 -2
  50. package/dist/public-types.js.map +0 -1
@@ -1,231 +0,0 @@
1
- import type { Corti } from '@corti/sdk';
2
- import type { User } from './public-types.js';
3
- export type APIVersion = 'v1';
4
- export type MessageType = 'CORTI_EMBEDDED' | 'CORTI_EMBEDDED_RESPONSE' | 'CORTI_EMBEDDED_EVENT';
5
- export type AuthMode = 'stateless' | 'stateful';
6
- export type DefaultMode = 'virtual' | 'in-person';
7
- export type EmbeddedAction = 'auth' | 'createInteraction' | 'addFacts' | 'configureSession' | 'navigate' | 'startRecording' | 'stopRecording' | 'getStatus' | 'configure' | 'setCredentials';
8
- export type EmbeddedEvent = 'ready' | 'loaded' | 'recordingStarted' | 'recordingStopped' | 'documentGenerated' | 'documentUpdated' | 'documentSynced' | 'authChanged' | 'interactionCreated' | 'navigationChanged';
9
- export interface KeycloakTokenResponse {
10
- access_token: string;
11
- token_type: string;
12
- expires_at?: number | null;
13
- expires_in?: number | null;
14
- refresh_expires_in?: number | null;
15
- refresh_token?: string;
16
- id_token?: string;
17
- 'not-before-policy'?: number | null;
18
- session_state?: string;
19
- scope?: string;
20
- profile?: {
21
- name: string;
22
- email: string;
23
- sub: string;
24
- };
25
- }
26
- export interface AuthPayload extends KeycloakTokenResponse {
27
- mode: AuthMode;
28
- }
29
- export interface AuthResponse {
30
- user: {
31
- id: string;
32
- email: string;
33
- name?: string;
34
- [key: string]: unknown;
35
- };
36
- }
37
- export interface CreateInteractionResponse {
38
- id: string;
39
- createdAt: string;
40
- status?: string;
41
- }
42
- export interface AddFactsPayload {
43
- facts: Corti.FactsCreateInput[];
44
- }
45
- export interface ConfigureSessionPayload {
46
- defaultLanguage?: string;
47
- defaultOutputLanguage?: string;
48
- defaultTemplateKey?: string;
49
- defaultMode?: DefaultMode;
50
- }
51
- export interface NavigatePayload {
52
- path: string;
53
- }
54
- interface AppearanceConfig {
55
- primaryColor: string | null;
56
- }
57
- interface FeaturesConfig {
58
- interactionTitle: boolean;
59
- aiChat: boolean;
60
- documentFeedback: boolean;
61
- navigation: boolean;
62
- virtualMode: boolean;
63
- }
64
- interface LocaleConfig {
65
- interfaceLanguage: string;
66
- }
67
- export interface ConfigureAppPayload {
68
- appearance?: Partial<AppearanceConfig>;
69
- features?: Partial<FeaturesConfig>;
70
- locale?: Partial<LocaleConfig>;
71
- }
72
- export interface ConfigureAppResponsePayload {
73
- appearance: AppearanceConfig;
74
- features: FeaturesConfig;
75
- locale: LocaleConfig;
76
- }
77
- export interface GetStatusResponse {
78
- ready: boolean;
79
- auth: {
80
- authenticated: boolean;
81
- user?: User;
82
- };
83
- currentUrl?: string;
84
- interaction?: {
85
- encounter: Corti.InteractionsEncounterResponse;
86
- documents: Corti.DocumentsListResponse['data'];
87
- facts: Corti.FactsListResponse['facts'];
88
- };
89
- }
90
- export interface SetCredentialsPayload {
91
- password: string;
92
- }
93
- export interface NavigateEventPayload {
94
- interactionId: string;
95
- }
96
- export interface DocumentEventPayload {
97
- document: Corti.DocumentsGetResponse;
98
- }
99
- export interface AuthChangedEventPayload {
100
- user: {
101
- id: string;
102
- email: string;
103
- name?: string;
104
- [key: string]: unknown;
105
- };
106
- }
107
- export interface InteractionCreatedEventPayload {
108
- interaction: {
109
- id: string;
110
- createdAt: string;
111
- };
112
- }
113
- export interface NavigationChangedEventPayload {
114
- path: string;
115
- }
116
- export interface BaseMessage {
117
- type: MessageType;
118
- version: APIVersion;
119
- }
120
- export interface EmbeddedRequest extends BaseMessage {
121
- type: 'CORTI_EMBEDDED';
122
- action: EmbeddedAction;
123
- requestId: string;
124
- payload?: unknown;
125
- }
126
- export interface EmbeddedResponse extends BaseMessage {
127
- type: 'CORTI_EMBEDDED_RESPONSE';
128
- action: EmbeddedAction;
129
- requestId: string;
130
- success: boolean;
131
- payload?: unknown;
132
- error?: string;
133
- errorCode?: string;
134
- errorDetails?: unknown;
135
- }
136
- export interface EmbeddedEventMessage extends BaseMessage {
137
- type: 'CORTI_EMBEDDED_EVENT';
138
- event: EmbeddedEvent;
139
- payload?: unknown;
140
- }
141
- export interface AuthRequest extends EmbeddedRequest {
142
- action: 'auth';
143
- payload: AuthPayload;
144
- }
145
- export interface AuthResponseMessage extends EmbeddedResponse {
146
- action: 'auth';
147
- payload?: AuthResponse;
148
- }
149
- export interface CreateInteractionRequest extends EmbeddedRequest {
150
- action: 'createInteraction';
151
- payload: Corti.InteractionsEncounterCreateRequest;
152
- }
153
- export interface CreateInteractionResponseMessage extends EmbeddedResponse {
154
- action: 'createInteraction';
155
- payload: CreateInteractionResponse;
156
- }
157
- export interface AddFactsRequest extends EmbeddedRequest {
158
- action: 'addFacts';
159
- payload: AddFactsPayload;
160
- }
161
- export interface ConfigureSessionRequest extends EmbeddedRequest {
162
- action: 'configureSession';
163
- payload: ConfigureSessionPayload;
164
- }
165
- export interface NavigateRequest extends EmbeddedRequest {
166
- action: 'navigate';
167
- payload: NavigatePayload;
168
- }
169
- export interface StartRecordingRequest extends EmbeddedRequest {
170
- action: 'startRecording';
171
- }
172
- export interface StopRecordingRequest extends EmbeddedRequest {
173
- action: 'stopRecording';
174
- }
175
- export interface GetStatusRequest extends EmbeddedRequest {
176
- action: 'getStatus';
177
- }
178
- export interface GetStatusResponseMessage extends EmbeddedResponse {
179
- action: 'getStatus';
180
- payload: GetStatusResponse;
181
- }
182
- export interface ConfigureRequest extends EmbeddedRequest {
183
- action: 'configure';
184
- payload: ConfigureAppPayload;
185
- }
186
- export interface SetCredentialsRequest extends EmbeddedRequest {
187
- action: 'setCredentials';
188
- payload: SetCredentialsPayload;
189
- }
190
- export interface ReadyEvent extends EmbeddedEventMessage {
191
- event: 'ready';
192
- }
193
- export interface LoadedEvent extends EmbeddedEventMessage {
194
- event: 'loaded';
195
- payload: NavigateEventPayload;
196
- }
197
- export interface RecordingStartedEvent extends EmbeddedEventMessage {
198
- event: 'recordingStarted';
199
- }
200
- export interface RecordingStoppedEvent extends EmbeddedEventMessage {
201
- event: 'recordingStopped';
202
- }
203
- export interface DocumentGeneratedEvent extends EmbeddedEventMessage {
204
- event: 'documentGenerated';
205
- payload: DocumentEventPayload;
206
- }
207
- export interface DocumentUpdatedEvent extends EmbeddedEventMessage {
208
- event: 'documentUpdated';
209
- payload: DocumentEventPayload;
210
- }
211
- export interface DocumentSyncedEvent extends EmbeddedEventMessage {
212
- event: 'documentSynced';
213
- payload: DocumentEventPayload;
214
- }
215
- export interface AuthChangedEvent extends EmbeddedEventMessage {
216
- event: 'authChanged';
217
- payload: AuthChangedEventPayload;
218
- }
219
- export interface InteractionCreatedEvent extends EmbeddedEventMessage {
220
- event: 'interactionCreated';
221
- payload: InteractionCreatedEventPayload;
222
- }
223
- export interface NavigationChangedEvent extends EmbeddedEventMessage {
224
- event: 'navigationChanged';
225
- payload: NavigationChangedEventPayload;
226
- }
227
- export type AnyEmbeddedRequest = AuthRequest | CreateInteractionRequest | AddFactsRequest | ConfigureSessionRequest | NavigateRequest | StartRecordingRequest | StopRecordingRequest | GetStatusRequest | ConfigureRequest | SetCredentialsRequest;
228
- export type AnyEmbeddedResponse = AuthResponseMessage | CreateInteractionResponseMessage | GetStatusResponseMessage | EmbeddedResponse;
229
- export type AnyEmbeddedEvent = ReadyEvent | LoadedEvent | RecordingStartedEvent | RecordingStoppedEvent | DocumentGeneratedEvent | DocumentUpdatedEvent | DocumentSyncedEvent | AuthChangedEvent | InteractionCreatedEvent | NavigationChangedEvent;
230
- export type AnyEmbeddedMessage = AnyEmbeddedRequest | AnyEmbeddedResponse | AnyEmbeddedEvent;
231
- export {};
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=internal-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-types.js","sourceRoot":"","sources":["../src/internal-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Corti } from '@corti/sdk';\nimport type { User } from './public-types.js';\n\nexport type APIVersion = 'v1';\n\nexport type MessageType =\n | 'CORTI_EMBEDDED'\n | 'CORTI_EMBEDDED_RESPONSE'\n | '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 | 'configure'\n | 'setCredentials';\n\nexport type EmbeddedEvent =\n | 'ready'\n | 'loaded'\n | 'recordingStarted'\n | 'recordingStopped'\n | 'documentGenerated'\n | 'documentUpdated'\n | 'documentSynced'\n | 'authChanged'\n | 'interactionCreated'\n | 'navigationChanged';\n\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 Schema\nexport interface AuthPayload extends KeycloakTokenResponse {\n mode: AuthMode;\n}\n\nexport interface AuthResponse {\n user: {\n id: string;\n email: string;\n name?: string;\n [key: string]: unknown;\n };\n}\n\nexport interface CreateInteractionResponse {\n id: string;\n createdAt: string;\n status?: string;\n}\n\n// Add Facts Schema\nexport interface AddFactsPayload {\n facts: Corti.FactsCreateInput[];\n}\n\n// Configure Session Schema\nexport interface ConfigureSessionPayload {\n defaultLanguage?: string;\n defaultOutputLanguage?: string;\n defaultTemplateKey?: string;\n defaultMode?: DefaultMode;\n}\n\n// Navigate Schema\nexport interface NavigatePayload {\n path: string;\n}\n\n// App configuration schema\ninterface AppearanceConfig {\n primaryColor: string | null;\n}\n\ninterface FeaturesConfig {\n interactionTitle: boolean;\n aiChat: boolean;\n documentFeedback: boolean;\n navigation: boolean;\n virtualMode: boolean;\n}\n\ninterface LocaleConfig {\n interfaceLanguage: string;\n}\n\nexport interface ConfigureAppPayload {\n appearance?: Partial<AppearanceConfig>;\n features?: Partial<FeaturesConfig>;\n locale?: Partial<LocaleConfig>;\n}\n\nexport interface ConfigureAppResponsePayload {\n appearance: AppearanceConfig;\n features: FeaturesConfig;\n locale: LocaleConfig;\n}\n\n// Get status schema\nexport interface GetStatusResponse {\n ready: boolean;\n auth: {\n authenticated: boolean;\n user?: User;\n };\n currentUrl?: string;\n interaction?: {\n encounter: Corti.InteractionsEncounterResponse;\n documents: Corti.DocumentsListResponse['data'];\n facts: Corti.FactsListResponse['facts'];\n };\n}\n\n// Set credentials schema\nexport interface SetCredentialsPayload {\n password: string;\n}\n\nexport interface NavigateEventPayload {\n interactionId: string;\n}\n\nexport interface DocumentEventPayload {\n document: Corti.DocumentsGetResponse;\n}\n\nexport interface AuthChangedEventPayload {\n user: {\n id: string;\n email: string;\n name?: string;\n [key: string]: unknown;\n };\n}\n\nexport interface InteractionCreatedEventPayload {\n interaction: {\n id: string;\n createdAt: string;\n };\n}\n\nexport interface NavigationChangedEventPayload {\n path: string;\n}\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\nexport interface EmbeddedEventMessage extends BaseMessage {\n type: 'CORTI_EMBEDDED_EVENT';\n event: EmbeddedEvent;\n payload?: unknown;\n}\n\n// Specific Request/Response Types\nexport interface AuthRequest extends EmbeddedRequest {\n action: 'auth';\n payload: AuthPayload;\n}\n\nexport interface AuthResponseMessage extends EmbeddedResponse {\n action: 'auth';\n payload?: AuthResponse;\n}\n\nexport interface CreateInteractionRequest extends EmbeddedRequest {\n action: 'createInteraction';\n payload: Corti.InteractionsEncounterCreateRequest;\n}\n\nexport interface CreateInteractionResponseMessage extends EmbeddedResponse {\n action: 'createInteraction';\n payload: CreateInteractionResponse;\n}\n\nexport interface AddFactsRequest extends EmbeddedRequest {\n action: 'addFacts';\n payload: AddFactsPayload;\n}\n\nexport interface ConfigureSessionRequest extends EmbeddedRequest {\n action: 'configureSession';\n payload: ConfigureSessionPayload;\n}\n\nexport interface NavigateRequest extends EmbeddedRequest {\n action: 'navigate';\n payload: NavigatePayload;\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 GetStatusResponseMessage extends EmbeddedResponse {\n action: 'getStatus';\n payload: GetStatusResponse;\n}\n\nexport interface ConfigureRequest extends EmbeddedRequest {\n action: 'configure';\n payload: ConfigureAppPayload;\n}\n\nexport interface SetCredentialsRequest extends EmbeddedRequest {\n action: 'setCredentials';\n payload: SetCredentialsPayload;\n}\n\n// Event Types\nexport interface ReadyEvent extends EmbeddedEventMessage {\n event: 'ready';\n}\n\nexport interface LoadedEvent extends EmbeddedEventMessage {\n event: 'loaded';\n payload: NavigateEventPayload;\n}\n\nexport interface RecordingStartedEvent extends EmbeddedEventMessage {\n event: 'recordingStarted';\n}\n\nexport interface RecordingStoppedEvent extends EmbeddedEventMessage {\n event: 'recordingStopped';\n}\n\nexport interface DocumentGeneratedEvent extends EmbeddedEventMessage {\n event: 'documentGenerated';\n payload: DocumentEventPayload;\n}\n\nexport interface DocumentUpdatedEvent extends EmbeddedEventMessage {\n event: 'documentUpdated';\n payload: DocumentEventPayload;\n}\n\nexport interface DocumentSyncedEvent extends EmbeddedEventMessage {\n event: 'documentSynced';\n payload: DocumentEventPayload;\n}\n\nexport interface AuthChangedEvent extends EmbeddedEventMessage {\n event: 'authChanged';\n payload: AuthChangedEventPayload;\n}\n\nexport interface InteractionCreatedEvent extends EmbeddedEventMessage {\n event: 'interactionCreated';\n payload: InteractionCreatedEventPayload;\n}\n\nexport interface NavigationChangedEvent extends EmbeddedEventMessage {\n event: 'navigationChanged';\n payload: NavigationChangedEventPayload;\n}\n\n// Request/Response/Event types\nexport type AnyEmbeddedRequest =\n | AuthRequest\n | CreateInteractionRequest\n | AddFactsRequest\n | ConfigureSessionRequest\n | NavigateRequest\n | StartRecordingRequest\n | StopRecordingRequest\n | GetStatusRequest\n | ConfigureRequest\n | SetCredentialsRequest;\n\nexport type AnyEmbeddedResponse =\n | AuthResponseMessage\n | CreateInteractionResponseMessage\n | GetStatusResponseMessage\n | EmbeddedResponse;\n\nexport type AnyEmbeddedEvent =\n | ReadyEvent\n | LoadedEvent\n | RecordingStartedEvent\n | RecordingStoppedEvent\n | DocumentGeneratedEvent\n | DocumentUpdatedEvent\n | DocumentSyncedEvent\n | AuthChangedEvent\n | InteractionCreatedEvent\n | NavigationChangedEvent;\n\nexport type AnyEmbeddedMessage =\n | AnyEmbeddedRequest\n | AnyEmbeddedResponse\n | AnyEmbeddedEvent;\n"]}
@@ -1,238 +0,0 @@
1
- import type { Corti } from '@corti/sdk';
2
- /**
3
- * Authentication credentials for Assistant
4
- */
5
- export interface AuthCredentials {
6
- access_token: string;
7
- token_type: string;
8
- expires_at?: number | null;
9
- expires_in?: number | null;
10
- refresh_expires_in?: number | null;
11
- refresh_token?: string;
12
- id_token?: string;
13
- 'not-before-policy'?: number | null;
14
- session_state?: string;
15
- scope?: string;
16
- profile?: {
17
- name: string;
18
- email: string;
19
- sub: string;
20
- };
21
- mode: 'stateless' | 'stateful';
22
- }
23
- /**
24
- * User information returned from authentication
25
- */
26
- export interface User {
27
- id: string;
28
- email: string;
29
- }
30
- /**
31
- * Details of a created interaction
32
- */
33
- export interface InteractionDetails {
34
- id: string;
35
- createdAt: string;
36
- }
37
- /**
38
- * Interaction payload
39
- */
40
- export interface InteractionPayload {
41
- assignedUserId: Corti.InteractionsCreateRequest['assignedUserId'];
42
- encounter: {
43
- identifier: Corti.InteractionsCreateRequest['encounter']['identifier'];
44
- status: Corti.InteractionsCreateRequest['encounter']['status'];
45
- type: Corti.InteractionsCreateRequest['encounter']['type'];
46
- period: Corti.InteractionsCreateRequest['encounter']['period'];
47
- title?: string;
48
- };
49
- patient: Corti.InteractionsCreateRequest['patient'];
50
- }
51
- /**
52
- * Fact used to provide additional information for the interaction context
53
- */
54
- export interface Fact {
55
- text: Corti.FactsCreateInput['text'];
56
- group: Corti.FactsCreateInput['group'];
57
- source?: Corti.FactsCreateInput['source'];
58
- }
59
- /**
60
- * Session configuration options
61
- */
62
- export interface SessionConfig {
63
- defaultLanguage?: string;
64
- defaultOutputLanguage?: string;
65
- defaultTemplateKey?: string;
66
- defaultMode?: 'virtual' | 'in-person';
67
- }
68
- /**
69
- * Status information about the embedded component
70
- */
71
- export interface ComponentStatus {
72
- ready: boolean;
73
- auth: {
74
- authenticated: boolean;
75
- user?: User;
76
- };
77
- currentUrl?: string;
78
- interaction?: {
79
- encounter: Corti.InteractionsEncounterResponse;
80
- documents: Corti.DocumentsListResponse['data'];
81
- facts: Corti.FactsListResponse['facts'];
82
- };
83
- }
84
- interface AppearanceConfig {
85
- primaryColor: string | null;
86
- }
87
- interface FeaturesConfig {
88
- interactionTitle: boolean;
89
- aiChat: boolean;
90
- documentFeedback: boolean;
91
- navigation: boolean;
92
- virtualMode: boolean;
93
- }
94
- interface LocaleConfig {
95
- interfaceLanguage: string;
96
- }
97
- /**
98
- * Configuration options for the embedded component
99
- */
100
- export interface ConfigureAppPayload {
101
- appearance?: Partial<AppearanceConfig>;
102
- features?: Partial<FeaturesConfig>;
103
- locale?: Partial<LocaleConfig>;
104
- }
105
- export interface ConfigureAppResponsePayload {
106
- appearance: AppearanceConfig;
107
- features: FeaturesConfig;
108
- locale: LocaleConfig;
109
- }
110
- /**
111
- * Event data types for component events
112
- */
113
- export interface EmbeddedEventData {
114
- ready: undefined;
115
- /**
116
- * Limited access - NOT IMPLEMENTED
117
- */
118
- 'auth-changed': {
119
- user: User;
120
- };
121
- /**
122
- * Limited access - NOT IMPLEMENTED
123
- */
124
- 'interaction-created': {
125
- interaction: InteractionDetails;
126
- };
127
- 'recording-started': undefined;
128
- 'recording-stopped': undefined;
129
- 'document-generated': {
130
- document: Corti.DocumentsGetResponse;
131
- };
132
- /**
133
- * Emitted after manual updates and changes made through dictation as well as re-generating the document
134
- */
135
- 'document-updated': {
136
- document: Corti.DocumentsGetResponse;
137
- };
138
- /**
139
- * Emitted when a document is "pushed" to the host EHR system from the Assistant interface
140
- */
141
- 'document-synced': {
142
- document: Corti.DocumentsGetResponse;
143
- };
144
- /**
145
- * Limited access - NOT IMPLEMENTED
146
- */
147
- 'navigation-changed': {
148
- path: string;
149
- };
150
- /**
151
- * Emitted when usage data is returned following a request that consumed credits
152
- */
153
- usage: {
154
- creditsConsumed: number;
155
- };
156
- error: {
157
- message: string;
158
- code?: string;
159
- details?: unknown;
160
- };
161
- }
162
- /**
163
- * Event listener function type
164
- */
165
- export type EventListener<T = unknown> = (data: T) => void;
166
- /**
167
- * Public API interface for the Corti Embedded component
168
- */
169
- export interface CortiEmbeddedAPI {
170
- /**
171
- * Authenticate with the Corti system
172
- * @param credentials Authentication credentials
173
- * @returns Promise resolving to user information
174
- */
175
- auth(credentials: AuthCredentials): Promise<User>;
176
- /**
177
- * Create a new interaction
178
- * @param encounter Encounter request data
179
- * @returns Promise resolving to interaction details
180
- */
181
- createInteraction(encounter: InteractionPayload): Promise<InteractionDetails>;
182
- /**
183
- * Configure the current session
184
- * @param config Session configuration
185
- * @returns Promise that resolves when configuration is complete
186
- */
187
- configureSession(config: SessionConfig): Promise<void>;
188
- /**
189
- * Add facts to the current session
190
- * @param facts Array of facts to add
191
- * @returns Promise that resolves when facts are added
192
- */
193
- addFacts(facts: Fact[]): Promise<void>;
194
- /**
195
- * Navigate to a specific path within the embedded UI
196
- * @param path Path to navigate to
197
- * @returns Promise that resolves when navigation is complete
198
- */
199
- navigate(path: string): Promise<void>;
200
- /**
201
- * Start recording
202
- * @returns Promise that resolves when recording starts
203
- */
204
- startRecording(): Promise<void>;
205
- /**
206
- * Stop recording
207
- * @returns Promise that resolves when recording stops
208
- */
209
- stopRecording(): Promise<void>;
210
- /**
211
- * Get current component status
212
- * @returns Promise resolving to current status
213
- */
214
- getStatus(): Promise<ComponentStatus>;
215
- /**
216
- * Configure the application
217
- * @param config Application configuration
218
- * @returns Promise that resolves when configuration is applied
219
- */
220
- configure(config: ConfigureAppPayload): Promise<ConfigureAppResponsePayload>;
221
- /**
222
- * Set authentication credentials without triggering auth flow
223
- * @param credentials Authentication credentials to store
224
- * @returns Promise that resolves when credentials are set
225
- */
226
- setCredentials(credentials: {
227
- password: string;
228
- }): Promise<void>;
229
- /**
230
- * Show the embedded UI
231
- */
232
- show(): void;
233
- /**
234
- * Hide the embedded UI
235
- */
236
- hide(): void;
237
- }
238
- export {};
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=public-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"public-types.js","sourceRoot":"","sources":["../src/public-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Corti } from '@corti/sdk';\n\n/**\n * Authentication credentials for Assistant\n */\nexport interface AuthCredentials {\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 mode: 'stateless' | 'stateful';\n}\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 * Interaction payload\n */\nexport interface InteractionPayload {\n assignedUserId: Corti.InteractionsCreateRequest['assignedUserId'];\n encounter: {\n identifier: Corti.InteractionsCreateRequest['encounter']['identifier'];\n status: Corti.InteractionsCreateRequest['encounter']['status'];\n type: Corti.InteractionsCreateRequest['encounter']['type'];\n period: Corti.InteractionsCreateRequest['encounter']['period'];\n title?: string;\n };\n patient: Corti.InteractionsCreateRequest['patient'];\n}\n\n/**\n * Fact used to provide additional information for the interaction context\n */\nexport interface Fact {\n text: Corti.FactsCreateInput['text'];\n group: Corti.FactsCreateInput['group'];\n source?: Corti.FactsCreateInput['source'];\n}\n\n/**\n * Session configuration options\n */\nexport interface SessionConfig {\n defaultLanguage?: string;\n defaultOutputLanguage?: string;\n defaultTemplateKey?: string;\n defaultMode?: 'virtual' | 'in-person';\n}\n\n/**\n * Status information about the embedded component\n */\nexport interface ComponentStatus {\n ready: boolean;\n auth: {\n authenticated: boolean;\n user?: User;\n };\n currentUrl?: string;\n interaction?: {\n encounter: Corti.InteractionsEncounterResponse;\n documents: Corti.DocumentsListResponse['data'];\n facts: Corti.FactsListResponse['facts'];\n };\n}\n\ninterface AppearanceConfig {\n primaryColor: string | null;\n}\n\ninterface FeaturesConfig {\n interactionTitle: boolean;\n aiChat: boolean;\n documentFeedback: boolean;\n navigation: boolean;\n virtualMode: boolean;\n}\n\ninterface LocaleConfig {\n interfaceLanguage: string;\n}\n\n/**\n * Configuration options for the embedded component\n */\nexport interface ConfigureAppPayload {\n appearance?: Partial<AppearanceConfig>;\n features?: Partial<FeaturesConfig>;\n locale?: Partial<LocaleConfig>;\n}\n\nexport interface ConfigureAppResponsePayload {\n appearance: AppearanceConfig;\n features: FeaturesConfig;\n locale: LocaleConfig;\n}\n\n/**\n * Event data types for component events\n */\nexport interface EmbeddedEventData {\n ready: undefined;\n /**\n * Limited access - NOT IMPLEMENTED\n */\n 'auth-changed': {\n user: User;\n };\n /**\n * Limited access - NOT IMPLEMENTED\n */\n 'interaction-created': {\n interaction: InteractionDetails;\n };\n 'recording-started': undefined;\n 'recording-stopped': undefined;\n 'document-generated': {\n document: Corti.DocumentsGetResponse;\n };\n /**\n * Emitted after manual updates and changes made through dictation as well as re-generating the document\n */\n 'document-updated': {\n document: Corti.DocumentsGetResponse;\n };\n /**\n * Emitted when a document is \"pushed\" to the host EHR system from the Assistant interface\n */\n 'document-synced': {\n document: Corti.DocumentsGetResponse;\n };\n /**\n * Limited access - NOT IMPLEMENTED\n */\n 'navigation-changed': {\n // TODO: Implement navigation change event in CA\n path: string;\n };\n /**\n * Emitted when usage data is returned following a request that consumed credits\n */\n usage: {\n creditsConsumed: number;\n };\n error: {\n message: string;\n code?: string; // TODO: ensure that code is a valid error code and we have a mapping to error messages\n details?: unknown;\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: InteractionPayload): 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<ComponentStatus>;\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<ConfigureAppResponsePayload>;\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"]}