@1interface/chat-core 0.15.5 → 0.17.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 +104 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
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';
|
|
@@ -358,6 +361,8 @@ export declare function buildBrandSkin(styles: ChatThemeStyles, resolvedTheme: "
|
|
|
358
361
|
|
|
359
362
|
export declare function buildCallbackUrl(givenId?: string | null): string;
|
|
360
363
|
|
|
364
|
+
export declare function buildHostedPaymentPageThemeMessage(skin: PaymentSkin): HostedPaymentPageThemeMessage;
|
|
365
|
+
|
|
361
366
|
export declare const CHAT_INPUT_MODES: {
|
|
362
367
|
readonly NORMAL: "normal";
|
|
363
368
|
readonly RECORDING: "recording";
|
|
@@ -447,6 +452,12 @@ text: string;
|
|
|
447
452
|
queuedAt: string;
|
|
448
453
|
transcriptionIds?: string[];
|
|
449
454
|
messageType?: string[];
|
|
455
|
+
documents?: {
|
|
456
|
+
document_id: string;
|
|
457
|
+
filename: string;
|
|
458
|
+
mime_type: string;
|
|
459
|
+
size_bytes: number;
|
|
460
|
+
}[];
|
|
450
461
|
}[];
|
|
451
462
|
pendingTranscriptionIds: string[];
|
|
452
463
|
};
|
|
@@ -544,6 +555,12 @@ text: string;
|
|
|
544
555
|
queuedAt: string;
|
|
545
556
|
transcriptionIds?: string[];
|
|
546
557
|
messageType?: string[];
|
|
558
|
+
documents?: {
|
|
559
|
+
document_id: string;
|
|
560
|
+
filename: string;
|
|
561
|
+
mime_type: string;
|
|
562
|
+
size_bytes: number;
|
|
563
|
+
}[];
|
|
547
564
|
}[];
|
|
548
565
|
pendingTranscriptionIds: string[];
|
|
549
566
|
};
|
|
@@ -677,6 +694,12 @@ text: string;
|
|
|
677
694
|
queuedAt: string;
|
|
678
695
|
transcriptionIds?: string[];
|
|
679
696
|
messageType?: string[];
|
|
697
|
+
documents?: {
|
|
698
|
+
document_id: string;
|
|
699
|
+
filename: string;
|
|
700
|
+
mime_type: string;
|
|
701
|
+
size_bytes: number;
|
|
702
|
+
}[];
|
|
680
703
|
}[];
|
|
681
704
|
pendingTranscriptionIds: string[];
|
|
682
705
|
}>;
|
|
@@ -714,6 +737,7 @@ export declare interface ClientConfig {
|
|
|
714
737
|
conversations: ConversationsConfig;
|
|
715
738
|
voice_agent: VoiceAgentConfig;
|
|
716
739
|
stt: SttConfig;
|
|
740
|
+
documents: DocumentsConfig;
|
|
717
741
|
features?: string[];
|
|
718
742
|
backend_version?: string;
|
|
719
743
|
panel_switcher_enabled?: boolean;
|
|
@@ -798,6 +822,12 @@ export declare const DEFAULT_PROTOCOL: ProtocolType;
|
|
|
798
822
|
|
|
799
823
|
export declare const dequeueMessage: ActionCreatorWithoutPayload<"chat/dequeueMessage">;
|
|
800
824
|
|
|
825
|
+
export declare interface DocumentsConfig {
|
|
826
|
+
max_bytes: number;
|
|
827
|
+
max_documents: number;
|
|
828
|
+
allowed_mime_types: string[] | null;
|
|
829
|
+
}
|
|
830
|
+
|
|
801
831
|
export declare type DocumentUploadFile = File | Blob | {
|
|
802
832
|
uri: string;
|
|
803
833
|
name: string;
|
|
@@ -863,10 +893,51 @@ export declare function guestLoginApi(): Promise<AuthApiResult>;
|
|
|
863
893
|
|
|
864
894
|
export declare const hasAnyExtraData: (msg: any) => boolean;
|
|
865
895
|
|
|
896
|
+
export declare const HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS: {
|
|
897
|
+
readonly LOADED: "loaded";
|
|
898
|
+
readonly DONE: "done";
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
export declare const HOSTED_PAYMENT_PAGE_CALLBACK_MESSAGE_TYPE = "hosted-payment-page-callback";
|
|
902
|
+
|
|
903
|
+
export declare const HOSTED_PAYMENT_PAGE_CALLBACK_PATH = "/payment-callback.html";
|
|
904
|
+
|
|
905
|
+
export declare const HOSTED_PAYMENT_PAGE_STATUSES: {
|
|
906
|
+
readonly SUCCESS: "success";
|
|
907
|
+
readonly FAILED: "failed";
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
export declare const HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE = "hosted-payment-page-theme";
|
|
911
|
+
|
|
912
|
+
export declare type HostedPaymentPageCallbackAction = (typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS)[keyof typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS];
|
|
913
|
+
|
|
914
|
+
export declare interface HostedPaymentPageCallbackMessage {
|
|
915
|
+
type: typeof HOSTED_PAYMENT_PAGE_CALLBACK_MESSAGE_TYPE;
|
|
916
|
+
action: HostedPaymentPageCallbackAction;
|
|
917
|
+
search: string;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
export declare interface HostedPaymentPageCallbackResult {
|
|
921
|
+
paymentId: string;
|
|
922
|
+
paymentStatus: HostedPaymentPageStatus;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
export declare type HostedPaymentPageStatus = (typeof HOSTED_PAYMENT_PAGE_STATUSES)[keyof typeof HOSTED_PAYMENT_PAGE_STATUSES];
|
|
926
|
+
|
|
927
|
+
export declare interface HostedPaymentPageThemeMessage {
|
|
928
|
+
type: typeof HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE;
|
|
929
|
+
colorScheme: PaymentSkin["colorScheme"];
|
|
930
|
+
vars: Record<`--hpp-${string}`, string>;
|
|
931
|
+
}
|
|
932
|
+
|
|
866
933
|
export declare function isApiServerError(err: unknown): boolean;
|
|
867
934
|
|
|
868
935
|
export declare const isEmptyMessage: (v: any) => boolean;
|
|
869
936
|
|
|
937
|
+
export declare function isHostedPaymentPageCallbackMessage(value: unknown): value is HostedPaymentPageCallbackMessage;
|
|
938
|
+
|
|
939
|
+
export declare function isHostedPaymentPageUrl(value: unknown): value is string;
|
|
940
|
+
|
|
870
941
|
export declare function loginApi(email: string, password: string): Promise<AuthApiResult>;
|
|
871
942
|
|
|
872
943
|
export declare function logoutApi(payload: LogoutRequest, options?: {
|
|
@@ -914,13 +985,15 @@ export declare type NormalizedEventData = {
|
|
|
914
985
|
payment: PaymentInitPayload;
|
|
915
986
|
} | {
|
|
916
987
|
signIn: SignInInitPayload;
|
|
988
|
+
} | {
|
|
989
|
+
requestDocuments: RequestDocumentsPayload;
|
|
917
990
|
} | {
|
|
918
991
|
conversationTitle: string;
|
|
919
992
|
} | {
|
|
920
993
|
isEnd: true;
|
|
921
994
|
};
|
|
922
995
|
|
|
923
|
-
export declare type NormalizedEventType = 'text' | 'error' | 'widget' | 'status_update' | 'payment' | 'sign_in' | 'conversation_title' | 'stream_end';
|
|
996
|
+
export declare type NormalizedEventType = 'text' | 'error' | 'widget' | 'status_update' | 'payment' | 'sign_in' | 'request_documents' | 'conversation_title' | 'stream_end';
|
|
924
997
|
|
|
925
998
|
export declare const OAUTH_ERROR_TYPE: "OAUTH_ERROR";
|
|
926
999
|
|
|
@@ -932,6 +1005,8 @@ export declare const PAGINATION: {
|
|
|
932
1005
|
readonly MESSAGE_PAGE_SIZE: 25;
|
|
933
1006
|
};
|
|
934
1007
|
|
|
1008
|
+
export declare function parseHostedPaymentPageCallback(search: string): HostedPaymentPageCallbackResult | null;
|
|
1009
|
+
|
|
935
1010
|
export declare function parseMoyasarCallbackFromUrl(search: string): MoyasarCallbackResult | null;
|
|
936
1011
|
|
|
937
1012
|
export declare interface PaymentAdapter {
|
|
@@ -963,12 +1038,14 @@ export declare type PaymentResult = {
|
|
|
963
1038
|
paymentId: string;
|
|
964
1039
|
amount?: number;
|
|
965
1040
|
currency?: string;
|
|
1041
|
+
dismissed?: boolean;
|
|
966
1042
|
} | {
|
|
967
1043
|
status: "failure";
|
|
968
1044
|
provider: PaymentProviderType;
|
|
969
1045
|
code?: string;
|
|
970
1046
|
message: string;
|
|
971
1047
|
paymentId?: string;
|
|
1048
|
+
dismissed?: boolean;
|
|
972
1049
|
} | {
|
|
973
1050
|
status: "cancel";
|
|
974
1051
|
provider: PaymentProviderType;
|
|
@@ -984,6 +1061,12 @@ export declare interface PaymentSkin {
|
|
|
984
1061
|
accent: string;
|
|
985
1062
|
accentText: string;
|
|
986
1063
|
focus: string;
|
|
1064
|
+
success: string;
|
|
1065
|
+
successBg: string;
|
|
1066
|
+
warning: string;
|
|
1067
|
+
warningBg: string;
|
|
1068
|
+
danger: string;
|
|
1069
|
+
dangerBg: string;
|
|
987
1070
|
pillBg: string;
|
|
988
1071
|
pillBorder: string;
|
|
989
1072
|
pillText: string;
|
|
@@ -1041,6 +1124,7 @@ export declare interface QueuedMessage {
|
|
|
1041
1124
|
queuedAt: string;
|
|
1042
1125
|
transcriptionIds?: string[];
|
|
1043
1126
|
messageType?: string[];
|
|
1127
|
+
documents?: AttachedDocument[];
|
|
1044
1128
|
}
|
|
1045
1129
|
|
|
1046
1130
|
export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
|
|
@@ -1065,6 +1149,7 @@ declare type SendMessageFn_3 = (text?: string) => Promise<void>;
|
|
|
1065
1149
|
|
|
1066
1150
|
export declare interface SendMessageOptions {
|
|
1067
1151
|
messageType?: string[];
|
|
1152
|
+
documents?: AttachedDocument[];
|
|
1068
1153
|
}
|
|
1069
1154
|
|
|
1070
1155
|
export declare const serializableCheck: {
|
|
@@ -1098,6 +1183,7 @@ export declare enum SSEEventType {
|
|
|
1098
1183
|
CLEAR_STATUS = "clear_status",
|
|
1099
1184
|
PAYMENT = "payment",
|
|
1100
1185
|
SIGN_IN = "sign_in",
|
|
1186
|
+
REQUEST_DOCUMENTS = "request_documents",
|
|
1101
1187
|
CONVERSATION_TITLE = "conversation_title",
|
|
1102
1188
|
END = "end"
|
|
1103
1189
|
}
|
|
@@ -1142,6 +1228,12 @@ text: string;
|
|
|
1142
1228
|
queuedAt: string;
|
|
1143
1229
|
transcriptionIds?: string[];
|
|
1144
1230
|
messageType?: string[];
|
|
1231
|
+
documents?: {
|
|
1232
|
+
document_id: string;
|
|
1233
|
+
filename: string;
|
|
1234
|
+
mime_type: string;
|
|
1235
|
+
size_bytes: number;
|
|
1236
|
+
}[];
|
|
1145
1237
|
}[];
|
|
1146
1238
|
pendingTranscriptionIds: string[];
|
|
1147
1239
|
};
|
|
@@ -1240,6 +1332,12 @@ text: string;
|
|
|
1240
1332
|
queuedAt: string;
|
|
1241
1333
|
transcriptionIds?: string[];
|
|
1242
1334
|
messageType?: string[];
|
|
1335
|
+
documents?: {
|
|
1336
|
+
document_id: string;
|
|
1337
|
+
filename: string;
|
|
1338
|
+
mime_type: string;
|
|
1339
|
+
size_bytes: number;
|
|
1340
|
+
}[];
|
|
1243
1341
|
}[];
|
|
1244
1342
|
pendingTranscriptionIds: string[];
|
|
1245
1343
|
};
|
|
@@ -1351,6 +1449,7 @@ export declare interface StreamMessageParams {
|
|
|
1351
1449
|
enableTts?: boolean;
|
|
1352
1450
|
debugMode?: boolean;
|
|
1353
1451
|
transcriptionIds?: string[];
|
|
1452
|
+
modelContext?: ModelContextPart[];
|
|
1354
1453
|
body?: Record<string, unknown>;
|
|
1355
1454
|
}
|
|
1356
1455
|
|
|
@@ -1417,7 +1516,7 @@ export declare const useAuth: () => {
|
|
|
1417
1516
|
|
|
1418
1517
|
export declare const useChatCallbacks: () => ChatCallbacks;
|
|
1419
1518
|
|
|
1420
|
-
export declare const useChatConnection: ({ conversationId, messages, setMessages, enableTts, userLocation, startSession, debugMode, onPaymentInit, onSignInInit, onConversationTitle, }: UseChatConnectionParams) => UseChatConnectionReturn;
|
|
1519
|
+
export declare const useChatConnection: ({ conversationId, messages, setMessages, enableTts, userLocation, startSession, debugMode, onPaymentInit, onSignInInit, onRequestDocuments, onConversationTitle, }: UseChatConnectionParams) => UseChatConnectionReturn;
|
|
1421
1520
|
|
|
1422
1521
|
declare interface UseChatConnectionParams {
|
|
1423
1522
|
conversationId: string | null;
|
|
@@ -1429,6 +1528,7 @@ declare interface UseChatConnectionParams {
|
|
|
1429
1528
|
debugMode?: boolean;
|
|
1430
1529
|
onPaymentInit?: (init: PaymentInitPayload) => void;
|
|
1431
1530
|
onSignInInit?: (init: SignInInitPayload) => void;
|
|
1531
|
+
onRequestDocuments?: (payload: RequestDocumentsPayload) => void;
|
|
1432
1532
|
onConversationTitle?: (title: string) => void;
|
|
1433
1533
|
}
|
|
1434
1534
|
|
|
@@ -1461,11 +1561,12 @@ declare interface UseChatHistoryParams {
|
|
|
1461
1561
|
onClearChat?: () => void;
|
|
1462
1562
|
}
|
|
1463
1563
|
|
|
1464
|
-
export declare const useChatInput: ({ onSend, disabled, transcribedText, onTranscribedTextUsed, isRecording, isTranscribing, }: UseChatInputParams) => UseChatInputResult;
|
|
1564
|
+
export declare const useChatInput: ({ onSend, disabled, hasAttachments, transcribedText, onTranscribedTextUsed, isRecording, isTranscribing, }: UseChatInputParams) => UseChatInputResult;
|
|
1465
1565
|
|
|
1466
1566
|
export declare interface UseChatInputParams {
|
|
1467
1567
|
onSend: (text: string) => void;
|
|
1468
1568
|
disabled?: boolean;
|
|
1569
|
+
hasAttachments?: boolean;
|
|
1469
1570
|
transcribedText?: string | null;
|
|
1470
1571
|
onTranscribedTextUsed?: () => void;
|
|
1471
1572
|
isRecording?: boolean;
|