@1interface/chat-core 0.16.0 → 0.18.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/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { ActionCreatorWithoutPayload } from '@reduxjs/toolkit';
4
4
  import { Api } from '@reduxjs/toolkit/query';
5
5
  import { AppBrandingResponse } from '@1interface/shared-core';
6
6
  import { AppResponse } from '@1interface/shared-core';
7
+ import { AttachedDocument } from '@1interface/shared-core';
7
8
  import { AuthApiResult } from '@1interface/shared-core';
8
9
  import { AuthState } from '@1interface/shared-core';
9
10
  import { BaseQueryFn } from '@reduxjs/toolkit/query';
@@ -22,6 +23,7 @@ import { LoggerContextProvider } from '@1interface/shared-core';
22
23
  import { LogoutRequest } from '@1interface/shared-core';
23
24
  import { Message } from '@1interface/shared-core';
24
25
  import { Middleware } from '@reduxjs/toolkit';
26
+ import { ModelContextPart } from '@1interface/shared-core';
25
27
  import { MutableRefObject } from 'react';
26
28
  import { MutationActionCreatorResult } from '@reduxjs/toolkit/query';
27
29
  import { MutationDefinition } from '@reduxjs/toolkit/query';
@@ -38,6 +40,7 @@ import { Reducer } from '@reduxjs/toolkit';
38
40
  import { RefObject } from 'react';
39
41
  import { RefreshApiResult } from '@1interface/shared-core';
40
42
  import { RefreshRequest } from '@1interface/shared-core';
43
+ import { RequestDocumentsPayload } from '@1interface/shared-core';
41
44
  import { ResendVerificationRequest } from '@1interface/shared-core';
42
45
  import { ResetPasswordRequest } from '@1interface/shared-core';
43
46
  import { RootState as RootState_2 } from '@reduxjs/toolkit/query';
@@ -449,6 +452,12 @@ text: string;
449
452
  queuedAt: string;
450
453
  transcriptionIds?: string[];
451
454
  messageType?: string[];
455
+ documents?: {
456
+ document_id: string;
457
+ filename: string;
458
+ mime_type: string;
459
+ size_bytes: number;
460
+ }[];
452
461
  }[];
453
462
  pendingTranscriptionIds: string[];
454
463
  };
@@ -546,6 +555,12 @@ text: string;
546
555
  queuedAt: string;
547
556
  transcriptionIds?: string[];
548
557
  messageType?: string[];
558
+ documents?: {
559
+ document_id: string;
560
+ filename: string;
561
+ mime_type: string;
562
+ size_bytes: number;
563
+ }[];
549
564
  }[];
550
565
  pendingTranscriptionIds: string[];
551
566
  };
@@ -679,6 +694,12 @@ text: string;
679
694
  queuedAt: string;
680
695
  transcriptionIds?: string[];
681
696
  messageType?: string[];
697
+ documents?: {
698
+ document_id: string;
699
+ filename: string;
700
+ mime_type: string;
701
+ size_bytes: number;
702
+ }[];
682
703
  }[];
683
704
  pendingTranscriptionIds: string[];
684
705
  }>;
@@ -716,6 +737,7 @@ export declare interface ClientConfig {
716
737
  conversations: ConversationsConfig;
717
738
  voice_agent: VoiceAgentConfig;
718
739
  stt: SttConfig;
740
+ documents: DocumentsConfig;
719
741
  features?: string[];
720
742
  backend_version?: string;
721
743
  panel_switcher_enabled?: boolean;
@@ -800,6 +822,12 @@ export declare const DEFAULT_PROTOCOL: ProtocolType;
800
822
 
801
823
  export declare const dequeueMessage: ActionCreatorWithoutPayload<"chat/dequeueMessage">;
802
824
 
825
+ export declare interface DocumentsConfig {
826
+ max_bytes: number;
827
+ max_documents: number;
828
+ allowed_mime_types: string[] | null;
829
+ }
830
+
803
831
  export declare type DocumentUploadFile = File | Blob | {
804
832
  uri: string;
805
833
  name: string;
@@ -875,8 +903,9 @@ export declare const HOSTED_PAYMENT_PAGE_CALLBACK_MESSAGE_TYPE = "hosted-payment
875
903
  export declare const HOSTED_PAYMENT_PAGE_CALLBACK_PATH = "/payment-callback.html";
876
904
 
877
905
  export declare const HOSTED_PAYMENT_PAGE_STATUSES: {
878
- readonly SUCCESS: "success";
906
+ readonly SUCCEEDED: "succeeded";
879
907
  readonly FAILED: "failed";
908
+ readonly CANCELED: "canceled";
880
909
  };
881
910
 
882
911
  export declare const HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE = "hosted-payment-page-theme";
@@ -892,6 +921,9 @@ export declare interface HostedPaymentPageCallbackMessage {
892
921
  export declare interface HostedPaymentPageCallbackResult {
893
922
  paymentId: string;
894
923
  paymentStatus: HostedPaymentPageStatus;
924
+ amount?: number;
925
+ currency?: string;
926
+ message?: string;
895
927
  }
896
928
 
897
929
  export declare type HostedPaymentPageStatus = (typeof HOSTED_PAYMENT_PAGE_STATUSES)[keyof typeof HOSTED_PAYMENT_PAGE_STATUSES];
@@ -957,13 +989,15 @@ export declare type NormalizedEventData = {
957
989
  payment: PaymentInitPayload;
958
990
  } | {
959
991
  signIn: SignInInitPayload;
992
+ } | {
993
+ requestDocuments: RequestDocumentsPayload;
960
994
  } | {
961
995
  conversationTitle: string;
962
996
  } | {
963
997
  isEnd: true;
964
998
  };
965
999
 
966
- export declare type NormalizedEventType = 'text' | 'error' | 'widget' | 'status_update' | 'payment' | 'sign_in' | 'conversation_title' | 'stream_end';
1000
+ export declare type NormalizedEventType = 'text' | 'error' | 'widget' | 'status_update' | 'payment' | 'sign_in' | 'request_documents' | 'conversation_title' | 'stream_end';
967
1001
 
968
1002
  export declare const OAUTH_ERROR_TYPE: "OAUTH_ERROR";
969
1003
 
@@ -1094,6 +1128,7 @@ export declare interface QueuedMessage {
1094
1128
  queuedAt: string;
1095
1129
  transcriptionIds?: string[];
1096
1130
  messageType?: string[];
1131
+ documents?: AttachedDocument[];
1097
1132
  }
1098
1133
 
1099
1134
  export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
@@ -1118,6 +1153,7 @@ declare type SendMessageFn_3 = (text?: string) => Promise<void>;
1118
1153
 
1119
1154
  export declare interface SendMessageOptions {
1120
1155
  messageType?: string[];
1156
+ documents?: AttachedDocument[];
1121
1157
  }
1122
1158
 
1123
1159
  export declare const serializableCheck: {
@@ -1151,6 +1187,7 @@ export declare enum SSEEventType {
1151
1187
  CLEAR_STATUS = "clear_status",
1152
1188
  PAYMENT = "payment",
1153
1189
  SIGN_IN = "sign_in",
1190
+ REQUEST_DOCUMENTS = "request_documents",
1154
1191
  CONVERSATION_TITLE = "conversation_title",
1155
1192
  END = "end"
1156
1193
  }
@@ -1195,6 +1232,12 @@ text: string;
1195
1232
  queuedAt: string;
1196
1233
  transcriptionIds?: string[];
1197
1234
  messageType?: string[];
1235
+ documents?: {
1236
+ document_id: string;
1237
+ filename: string;
1238
+ mime_type: string;
1239
+ size_bytes: number;
1240
+ }[];
1198
1241
  }[];
1199
1242
  pendingTranscriptionIds: string[];
1200
1243
  };
@@ -1293,6 +1336,12 @@ text: string;
1293
1336
  queuedAt: string;
1294
1337
  transcriptionIds?: string[];
1295
1338
  messageType?: string[];
1339
+ documents?: {
1340
+ document_id: string;
1341
+ filename: string;
1342
+ mime_type: string;
1343
+ size_bytes: number;
1344
+ }[];
1296
1345
  }[];
1297
1346
  pendingTranscriptionIds: string[];
1298
1347
  };
@@ -1404,6 +1453,7 @@ export declare interface StreamMessageParams {
1404
1453
  enableTts?: boolean;
1405
1454
  debugMode?: boolean;
1406
1455
  transcriptionIds?: string[];
1456
+ modelContext?: ModelContextPart[];
1407
1457
  body?: Record<string, unknown>;
1408
1458
  }
1409
1459
 
@@ -1470,7 +1520,7 @@ export declare const useAuth: () => {
1470
1520
 
1471
1521
  export declare const useChatCallbacks: () => ChatCallbacks;
1472
1522
 
1473
- export declare const useChatConnection: ({ conversationId, messages, setMessages, enableTts, userLocation, startSession, debugMode, onPaymentInit, onSignInInit, onConversationTitle, }: UseChatConnectionParams) => UseChatConnectionReturn;
1523
+ export declare const useChatConnection: ({ conversationId, messages, setMessages, enableTts, userLocation, startSession, debugMode, onPaymentInit, onSignInInit, onRequestDocuments, onConversationTitle, }: UseChatConnectionParams) => UseChatConnectionReturn;
1474
1524
 
1475
1525
  declare interface UseChatConnectionParams {
1476
1526
  conversationId: string | null;
@@ -1482,6 +1532,7 @@ declare interface UseChatConnectionParams {
1482
1532
  debugMode?: boolean;
1483
1533
  onPaymentInit?: (init: PaymentInitPayload) => void;
1484
1534
  onSignInInit?: (init: SignInInitPayload) => void;
1535
+ onRequestDocuments?: (payload: RequestDocumentsPayload) => void;
1485
1536
  onConversationTitle?: (title: string) => void;
1486
1537
  }
1487
1538
 
@@ -1514,11 +1565,12 @@ declare interface UseChatHistoryParams {
1514
1565
  onClearChat?: () => void;
1515
1566
  }
1516
1567
 
1517
- export declare const useChatInput: ({ onSend, disabled, transcribedText, onTranscribedTextUsed, isRecording, isTranscribing, }: UseChatInputParams) => UseChatInputResult;
1568
+ export declare const useChatInput: ({ onSend, disabled, hasAttachments, transcribedText, onTranscribedTextUsed, isRecording, isTranscribing, }: UseChatInputParams) => UseChatInputResult;
1518
1569
 
1519
1570
  export declare interface UseChatInputParams {
1520
1571
  onSend: (text: string) => void;
1521
1572
  disabled?: boolean;
1573
+ hasAttachments?: boolean;
1522
1574
  transcribedText?: string | null;
1523
1575
  onTranscribedTextUsed?: () => void;
1524
1576
  isRecording?: boolean;