@informedai/react 0.2.5 → 0.2.6
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/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +3 -0
- package/dist/index.mjs +3 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -78,6 +78,8 @@ interface InformedAssistantConfig {
|
|
|
78
78
|
apiUrl?: string;
|
|
79
79
|
/** Optional: Existing session ID to resume */
|
|
80
80
|
sessionId?: string;
|
|
81
|
+
/** Callback when widget is ready with document type schema */
|
|
82
|
+
onReady?: (context: WidgetReadyContext) => void;
|
|
81
83
|
/** Callback when a field value is applied */
|
|
82
84
|
onFieldApply?: (fieldName: string, value: unknown) => void;
|
|
83
85
|
/** Callback when session state changes */
|
|
@@ -91,6 +93,11 @@ interface InformedAssistantConfig {
|
|
|
91
93
|
/** Initial collapsed state */
|
|
92
94
|
defaultCollapsed?: boolean;
|
|
93
95
|
}
|
|
96
|
+
interface WidgetReadyContext {
|
|
97
|
+
session: Session;
|
|
98
|
+
document: Document;
|
|
99
|
+
documentType: DocumentType;
|
|
100
|
+
}
|
|
94
101
|
interface WidgetTheme {
|
|
95
102
|
/** Primary accent color */
|
|
96
103
|
primaryColor: string;
|
|
@@ -234,4 +241,4 @@ declare class InformedAIClient {
|
|
|
234
241
|
private processSSEStream;
|
|
235
242
|
}
|
|
236
243
|
|
|
237
|
-
export { type ChatMessage, type Document, type DocumentType, type DocumentTypeSchema, type FieldDefinition, InformedAIClient, InformedAIProvider, InformedAssistant, type InformedAssistantConfig, type QuickAction, type SSEEvent, type Session, type TaskConfig, type TaskState, type UseSessionReturn, type WidgetMessage, type WidgetTheme, useInformedAI, useSession };
|
|
244
|
+
export { type ChatMessage, type Document, type DocumentType, type DocumentTypeSchema, type FieldDefinition, InformedAIClient, InformedAIProvider, InformedAssistant, type InformedAssistantConfig, type QuickAction, type SSEEvent, type Session, type TaskConfig, type TaskState, type UseSessionReturn, type WidgetMessage, type WidgetReadyContext, type WidgetTheme, useInformedAI, useSession };
|
package/dist/index.d.ts
CHANGED
|
@@ -78,6 +78,8 @@ interface InformedAssistantConfig {
|
|
|
78
78
|
apiUrl?: string;
|
|
79
79
|
/** Optional: Existing session ID to resume */
|
|
80
80
|
sessionId?: string;
|
|
81
|
+
/** Callback when widget is ready with document type schema */
|
|
82
|
+
onReady?: (context: WidgetReadyContext) => void;
|
|
81
83
|
/** Callback when a field value is applied */
|
|
82
84
|
onFieldApply?: (fieldName: string, value: unknown) => void;
|
|
83
85
|
/** Callback when session state changes */
|
|
@@ -91,6 +93,11 @@ interface InformedAssistantConfig {
|
|
|
91
93
|
/** Initial collapsed state */
|
|
92
94
|
defaultCollapsed?: boolean;
|
|
93
95
|
}
|
|
96
|
+
interface WidgetReadyContext {
|
|
97
|
+
session: Session;
|
|
98
|
+
document: Document;
|
|
99
|
+
documentType: DocumentType;
|
|
100
|
+
}
|
|
94
101
|
interface WidgetTheme {
|
|
95
102
|
/** Primary accent color */
|
|
96
103
|
primaryColor: string;
|
|
@@ -234,4 +241,4 @@ declare class InformedAIClient {
|
|
|
234
241
|
private processSSEStream;
|
|
235
242
|
}
|
|
236
243
|
|
|
237
|
-
export { type ChatMessage, type Document, type DocumentType, type DocumentTypeSchema, type FieldDefinition, InformedAIClient, InformedAIProvider, InformedAssistant, type InformedAssistantConfig, type QuickAction, type SSEEvent, type Session, type TaskConfig, type TaskState, type UseSessionReturn, type WidgetMessage, type WidgetTheme, useInformedAI, useSession };
|
|
244
|
+
export { type ChatMessage, type Document, type DocumentType, type DocumentTypeSchema, type FieldDefinition, InformedAIClient, InformedAIProvider, InformedAssistant, type InformedAssistantConfig, type QuickAction, type SSEEvent, type Session, type TaskConfig, type TaskState, type UseSessionReturn, type WidgetMessage, type WidgetReadyContext, type WidgetTheme, useInformedAI, useSession };
|
package/dist/index.js
CHANGED
|
@@ -236,6 +236,9 @@ function InformedAIProvider({ config, children }) {
|
|
|
236
236
|
if (doc) setDocument(doc);
|
|
237
237
|
if (dt) setDocumentType(dt);
|
|
238
238
|
config.onSessionChange?.(sess);
|
|
239
|
+
if (doc && dt) {
|
|
240
|
+
config.onReady?.({ session: sess, document: doc, documentType: dt });
|
|
241
|
+
}
|
|
239
242
|
} catch (err) {
|
|
240
243
|
const error2 = err instanceof Error ? err : new Error("Initialization failed");
|
|
241
244
|
setError(error2);
|
package/dist/index.mjs
CHANGED
|
@@ -206,6 +206,9 @@ function InformedAIProvider({ config, children }) {
|
|
|
206
206
|
if (doc) setDocument(doc);
|
|
207
207
|
if (dt) setDocumentType(dt);
|
|
208
208
|
config.onSessionChange?.(sess);
|
|
209
|
+
if (doc && dt) {
|
|
210
|
+
config.onReady?.({ session: sess, document: doc, documentType: dt });
|
|
211
|
+
}
|
|
209
212
|
} catch (err) {
|
|
210
213
|
const error2 = err instanceof Error ? err : new Error("Initialization failed");
|
|
211
214
|
setError(error2);
|