@1interface/chat-core 0.19.0-dev.1 → 0.19.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 +59 -85
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ 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 { AtbPaymentInit } from '@1interface/shared-core';
|
|
8
7
|
import { AttachedDocument } from '@1interface/shared-core';
|
|
9
8
|
import { AuthApiResult } from '@1interface/shared-core';
|
|
10
9
|
import { AuthState } from '@1interface/shared-core';
|
|
@@ -255,60 +254,6 @@ export declare const apiReducers: {
|
|
|
255
254
|
|
|
256
255
|
export declare type AppDispatch = typeof store.dispatch;
|
|
257
256
|
|
|
258
|
-
export declare const ATB_FAILURE_CODES: {
|
|
259
|
-
readonly SESSION_INVALID: "session_invalid";
|
|
260
|
-
readonly LOAD_FAILED: "load_failed";
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
export declare const ATB_FAILURE_MESSAGES: {
|
|
264
|
-
readonly NOT_COMPLETED: "The payment was not completed.";
|
|
265
|
-
readonly SESSION_INVALID: "This payment session has expired or is no longer valid. Please start a new payment.";
|
|
266
|
-
readonly LOAD_FAILED: "The payment page failed to load.";
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
export declare const ATB_MESSAGE_SOURCE = "atb-pga";
|
|
270
|
-
|
|
271
|
-
export declare const ATB_MESSAGE_TYPES: {
|
|
272
|
-
readonly READY: "ready";
|
|
273
|
-
readonly COMPLETED: "completed";
|
|
274
|
-
readonly ERROR: "error";
|
|
275
|
-
readonly REDIRECT: "redirect";
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export declare const ATB_OUTCOMES: {
|
|
279
|
-
readonly SUCCEEDED: "succeeded";
|
|
280
|
-
readonly FAILED: "failed";
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
export declare const ATB_PAYMENT_STATUSES: {
|
|
284
|
-
readonly DEPOSITED: "payment_deposited";
|
|
285
|
-
readonly DECLINED: "payment_declined";
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
export declare interface AtbCompletion {
|
|
289
|
-
status?: string;
|
|
290
|
-
checkoutId?: string;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
declare interface AtbMessage {
|
|
294
|
-
source: typeof ATB_MESSAGE_SOURCE;
|
|
295
|
-
v: number;
|
|
296
|
-
type: AtbMessageType;
|
|
297
|
-
data?: Record<string, unknown>;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
declare type AtbMessageType = (typeof ATB_MESSAGE_TYPES)[keyof typeof ATB_MESSAGE_TYPES];
|
|
301
|
-
|
|
302
|
-
export declare type AtbOutcome = (typeof ATB_OUTCOMES)[keyof typeof ATB_OUTCOMES];
|
|
303
|
-
|
|
304
|
-
export declare interface AtbResultInput {
|
|
305
|
-
outcome: AtbOutcome;
|
|
306
|
-
init: AtbPaymentInit;
|
|
307
|
-
message?: string;
|
|
308
|
-
checkoutId?: string;
|
|
309
|
-
code?: string;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
257
|
export declare class AudioRecorder {
|
|
313
258
|
private mediaRecorder;
|
|
314
259
|
private audioChunks;
|
|
@@ -412,12 +357,12 @@ export declare interface BridgeRequestOptions {
|
|
|
412
357
|
customHeaders?: Record<string, string>;
|
|
413
358
|
}
|
|
414
359
|
|
|
415
|
-
export declare function buildAtbResult({ outcome, init, message, checkoutId, code }: AtbResultInput): PaymentResult;
|
|
416
|
-
|
|
417
360
|
export declare function buildBrandSkin(styles: ChatThemeStyles, resolvedTheme: "light" | "dark"): PaymentSkin;
|
|
418
361
|
|
|
419
362
|
export declare function buildCallbackUrl(givenId?: string | null): string;
|
|
420
363
|
|
|
364
|
+
export declare function buildHostedPaymentPageThemeMessage(skin: PaymentSkin): HostedPaymentPageThemeMessage;
|
|
365
|
+
|
|
421
366
|
export declare const CHAT_INPUT_MODES: {
|
|
422
367
|
readonly NORMAL: "normal";
|
|
423
368
|
readonly RECORDING: "recording";
|
|
@@ -513,7 +458,6 @@ filename: string;
|
|
|
513
458
|
mime_type: string;
|
|
514
459
|
size_bytes: number;
|
|
515
460
|
}[];
|
|
516
|
-
modelText?: string;
|
|
517
461
|
}[];
|
|
518
462
|
pendingTranscriptionIds: string[];
|
|
519
463
|
};
|
|
@@ -617,7 +561,6 @@ filename: string;
|
|
|
617
561
|
mime_type: string;
|
|
618
562
|
size_bytes: number;
|
|
619
563
|
}[];
|
|
620
|
-
modelText?: string;
|
|
621
564
|
}[];
|
|
622
565
|
pendingTranscriptionIds: string[];
|
|
623
566
|
};
|
|
@@ -757,7 +700,6 @@ filename: string;
|
|
|
757
700
|
mime_type: string;
|
|
758
701
|
size_bytes: number;
|
|
759
702
|
}[];
|
|
760
|
-
modelText?: string;
|
|
761
703
|
}[];
|
|
762
704
|
pendingTranscriptionIds: string[];
|
|
763
705
|
}>;
|
|
@@ -931,8 +873,6 @@ export declare function formatAmount(minorUnits: number | undefined, currency: s
|
|
|
931
873
|
|
|
932
874
|
export declare function formatResultMessage(result: PaymentResult): string;
|
|
933
875
|
|
|
934
|
-
export declare function formatResultModelContext(result: PaymentResult): string | undefined;
|
|
935
|
-
|
|
936
876
|
export declare const GENERIC_SERVER_ERROR_MESSAGE = "Something went wrong. Please try again.";
|
|
937
877
|
|
|
938
878
|
export declare function getApiErrorMessage(err: unknown, clientFallback?: string): string;
|
|
@@ -953,14 +893,55 @@ export declare function guestLoginApi(): Promise<AuthApiResult>;
|
|
|
953
893
|
|
|
954
894
|
export declare const hasAnyExtraData: (msg: any) => boolean;
|
|
955
895
|
|
|
956
|
-
export declare
|
|
896
|
+
export declare const HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS: {
|
|
897
|
+
readonly LOADED: "loaded";
|
|
898
|
+
readonly DONE: "done";
|
|
899
|
+
};
|
|
957
900
|
|
|
958
|
-
export declare
|
|
901
|
+
export declare const HOSTED_PAYMENT_PAGE_CALLBACK_MESSAGE_TYPE = "hosted-payment-page-callback";
|
|
959
902
|
|
|
960
|
-
export declare
|
|
903
|
+
export declare const HOSTED_PAYMENT_PAGE_CALLBACK_PATH = "/payment-callback.html";
|
|
904
|
+
|
|
905
|
+
export declare const HOSTED_PAYMENT_PAGE_STATUSES: {
|
|
906
|
+
readonly SUCCEEDED: "succeeded";
|
|
907
|
+
readonly FAILED: "failed";
|
|
908
|
+
readonly CANCELED: "canceled";
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
export declare const HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE = "hosted-payment-page-theme";
|
|
912
|
+
|
|
913
|
+
export declare type HostedPaymentPageCallbackAction = (typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS)[keyof typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS];
|
|
914
|
+
|
|
915
|
+
export declare interface HostedPaymentPageCallbackMessage {
|
|
916
|
+
type: typeof HOSTED_PAYMENT_PAGE_CALLBACK_MESSAGE_TYPE;
|
|
917
|
+
action: HostedPaymentPageCallbackAction;
|
|
918
|
+
search: string;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
export declare interface HostedPaymentPageCallbackResult {
|
|
922
|
+
paymentId: string;
|
|
923
|
+
paymentStatus: HostedPaymentPageStatus;
|
|
924
|
+
amount?: number;
|
|
925
|
+
currency?: string;
|
|
926
|
+
message?: string;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export declare type HostedPaymentPageStatus = (typeof HOSTED_PAYMENT_PAGE_STATUSES)[keyof typeof HOSTED_PAYMENT_PAGE_STATUSES];
|
|
930
|
+
|
|
931
|
+
export declare interface HostedPaymentPageThemeMessage {
|
|
932
|
+
type: typeof HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE;
|
|
933
|
+
colorScheme: PaymentSkin["colorScheme"];
|
|
934
|
+
vars: Record<`--hpp-${string}`, string>;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
export declare function isApiServerError(err: unknown): boolean;
|
|
961
938
|
|
|
962
939
|
export declare const isEmptyMessage: (v: any) => boolean;
|
|
963
940
|
|
|
941
|
+
export declare function isHostedPaymentPageCallbackMessage(value: unknown): value is HostedPaymentPageCallbackMessage;
|
|
942
|
+
|
|
943
|
+
export declare function isHostedPaymentPageUrl(value: unknown): value is string;
|
|
944
|
+
|
|
964
945
|
export declare function loginApi(email: string, password: string): Promise<AuthApiResult>;
|
|
965
946
|
|
|
966
947
|
export declare function logoutApi(payload: LogoutRequest, options?: {
|
|
@@ -981,6 +962,8 @@ export declare interface MessageArrival {
|
|
|
981
962
|
lastUserMessageIndex: number;
|
|
982
963
|
}
|
|
983
964
|
|
|
965
|
+
export declare const MODEL_CONTEXT_TEXT_MAX_LENGTH = 1000;
|
|
966
|
+
|
|
984
967
|
export declare const MOYASAR_CALLBACK_SENTINEL = "moyasar_cb";
|
|
985
968
|
|
|
986
969
|
export declare interface MoyasarCallbackResult {
|
|
@@ -1028,6 +1011,8 @@ export declare const PAGINATION: {
|
|
|
1028
1011
|
readonly MESSAGE_PAGE_SIZE: 25;
|
|
1029
1012
|
};
|
|
1030
1013
|
|
|
1014
|
+
export declare function parseHostedPaymentPageCallback(search: string): HostedPaymentPageCallbackResult | null;
|
|
1015
|
+
|
|
1031
1016
|
export declare function parseMoyasarCallbackFromUrl(search: string): MoyasarCallbackResult | null;
|
|
1032
1017
|
|
|
1033
1018
|
export declare interface PaymentAdapter {
|
|
@@ -1059,14 +1044,14 @@ export declare type PaymentResult = {
|
|
|
1059
1044
|
paymentId: string;
|
|
1060
1045
|
amount?: number;
|
|
1061
1046
|
currency?: string;
|
|
1062
|
-
|
|
1047
|
+
dismissed?: boolean;
|
|
1063
1048
|
} | {
|
|
1064
1049
|
status: "failure";
|
|
1065
1050
|
provider: PaymentProviderType;
|
|
1066
1051
|
code?: string;
|
|
1067
1052
|
message: string;
|
|
1068
1053
|
paymentId?: string;
|
|
1069
|
-
|
|
1054
|
+
dismissed?: boolean;
|
|
1070
1055
|
} | {
|
|
1071
1056
|
status: "cancel";
|
|
1072
1057
|
provider: PaymentProviderType;
|
|
@@ -1146,15 +1131,8 @@ export declare interface QueuedMessage {
|
|
|
1146
1131
|
transcriptionIds?: string[];
|
|
1147
1132
|
messageType?: string[];
|
|
1148
1133
|
documents?: AttachedDocument[];
|
|
1149
|
-
modelText?: string;
|
|
1150
1134
|
}
|
|
1151
1135
|
|
|
1152
|
-
export declare function readAtbCompletion(data: unknown): AtbCompletion;
|
|
1153
|
-
|
|
1154
|
-
export declare function readAtbOutcome(status: string | undefined): AtbOutcome;
|
|
1155
|
-
|
|
1156
|
-
export declare function readAtbRedirect(data: unknown): string | null;
|
|
1157
|
-
|
|
1158
1136
|
export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
|
|
1159
1137
|
|
|
1160
1138
|
export declare function resendVerificationApi(payload: ResendVerificationRequest): Promise<string | undefined>;
|
|
@@ -1167,20 +1145,17 @@ export declare const resetChatState: ActionCreatorWithoutPayload<"chat/resetChat
|
|
|
1167
1145
|
|
|
1168
1146
|
export declare function resetPasswordApi(payload: ResetPasswordRequest): Promise<string | undefined>;
|
|
1169
1147
|
|
|
1170
|
-
export declare function resolveAtbOrigin(url: string): string | null;
|
|
1171
|
-
|
|
1172
1148
|
export declare type RootState = ReturnType<typeof store.getState>;
|
|
1173
1149
|
|
|
1174
|
-
declare type SendMessageFn = (text?: string
|
|
1150
|
+
declare type SendMessageFn = (text?: string) => Promise<void>;
|
|
1175
1151
|
|
|
1176
1152
|
declare type SendMessageFn_2 = (text?: string) => Promise<void>;
|
|
1177
1153
|
|
|
1178
|
-
declare type SendMessageFn_3 = (text?: string
|
|
1154
|
+
declare type SendMessageFn_3 = (text?: string) => Promise<void>;
|
|
1179
1155
|
|
|
1180
1156
|
export declare interface SendMessageOptions {
|
|
1181
1157
|
messageType?: string[];
|
|
1182
1158
|
documents?: AttachedDocument[];
|
|
1183
|
-
modelText?: string;
|
|
1184
1159
|
}
|
|
1185
1160
|
|
|
1186
1161
|
export declare const serializableCheck: {
|
|
@@ -1240,6 +1215,7 @@ export declare interface StandardApiError {
|
|
|
1240
1215
|
|
|
1241
1216
|
export declare interface StartConversationBody {
|
|
1242
1217
|
client_metadata?: StartConversationMetadata;
|
|
1218
|
+
locale?: string;
|
|
1243
1219
|
}
|
|
1244
1220
|
|
|
1245
1221
|
export declare interface StartConversationMetadata {
|
|
@@ -1265,7 +1241,6 @@ filename: string;
|
|
|
1265
1241
|
mime_type: string;
|
|
1266
1242
|
size_bytes: number;
|
|
1267
1243
|
}[];
|
|
1268
|
-
modelText?: string;
|
|
1269
1244
|
}[];
|
|
1270
1245
|
pendingTranscriptionIds: string[];
|
|
1271
1246
|
};
|
|
@@ -1370,7 +1345,6 @@ filename: string;
|
|
|
1370
1345
|
mime_type: string;
|
|
1371
1346
|
size_bytes: number;
|
|
1372
1347
|
}[];
|
|
1373
|
-
modelText?: string;
|
|
1374
1348
|
}[];
|
|
1375
1349
|
pendingTranscriptionIds: string[];
|
|
1376
1350
|
};
|
|
@@ -1506,8 +1480,6 @@ export declare const THINKING_MESSAGES: {
|
|
|
1506
1480
|
|
|
1507
1481
|
export { TokenRefreshResult }
|
|
1508
1482
|
|
|
1509
|
-
export declare function toModelContext(documents?: AttachedDocument[], modelText?: string): ModelContextPart[] | undefined;
|
|
1510
|
-
|
|
1511
1483
|
export declare interface ToolServer {
|
|
1512
1484
|
id: string;
|
|
1513
1485
|
name: string;
|
|
@@ -1551,11 +1523,11 @@ export declare const useAuth: () => {
|
|
|
1551
1523
|
|
|
1552
1524
|
export declare const useChatCallbacks: () => ChatCallbacks;
|
|
1553
1525
|
|
|
1554
|
-
export declare const useChatConnection: ({ conversationId,
|
|
1526
|
+
export declare const useChatConnection: ({ conversationId, setMessages, enableTts, userLocation, startSession, debugMode, onPaymentInit, onSignInInit, onRequestDocuments, onConversationTitle, initialMessage, locale, }: UseChatConnectionParams) => UseChatConnectionReturn;
|
|
1555
1527
|
|
|
1556
1528
|
declare interface UseChatConnectionParams {
|
|
1557
1529
|
conversationId: string | null;
|
|
1558
|
-
messages
|
|
1530
|
+
messages?: Message[];
|
|
1559
1531
|
setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
|
|
1560
1532
|
enableTts?: boolean;
|
|
1561
1533
|
userLocation?: UserLocation | null;
|
|
@@ -1565,6 +1537,8 @@ declare interface UseChatConnectionParams {
|
|
|
1565
1537
|
onSignInInit?: (init: SignInInitPayload) => void;
|
|
1566
1538
|
onRequestDocuments?: (payload: RequestDocumentsPayload) => void;
|
|
1567
1539
|
onConversationTitle?: (title: string) => void;
|
|
1540
|
+
initialMessage?: string | null;
|
|
1541
|
+
locale?: string | null;
|
|
1568
1542
|
}
|
|
1569
1543
|
|
|
1570
1544
|
declare interface UseChatConnectionReturn {
|