@1interface/chat-core 0.20.3 → 0.22.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 +76 -39
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { CombinedState } from '@reduxjs/toolkit/query';
|
|
|
13
13
|
import { Context } from 'react';
|
|
14
14
|
import { coreModuleName } from '@reduxjs/toolkit/query';
|
|
15
15
|
import { Dispatch } from 'react';
|
|
16
|
+
import { DocumentMetadata } from '@1interface/shared-core';
|
|
16
17
|
import { EnhancedStore } from '@reduxjs/toolkit';
|
|
17
18
|
import { FetchArgs } from '@reduxjs/toolkit/query';
|
|
18
19
|
import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
|
|
@@ -35,7 +36,6 @@ import { QueryDefinition } from '@reduxjs/toolkit/query';
|
|
|
35
36
|
import { QueryStatus } from '@reduxjs/toolkit/query';
|
|
36
37
|
import { QuerySubState } from '@reduxjs/toolkit/query';
|
|
37
38
|
import { reactHooksModuleName } from '@reduxjs/toolkit/query/react';
|
|
38
|
-
import { ReactNode } from 'react';
|
|
39
39
|
import { Reducer } from '@reduxjs/toolkit';
|
|
40
40
|
import { RefObject } from 'react';
|
|
41
41
|
import { RefreshApiResult } from '@1interface/shared-core';
|
|
@@ -136,6 +136,7 @@ file: DocumentUploadFile;
|
|
|
136
136
|
filename?: string;
|
|
137
137
|
documentType?: string;
|
|
138
138
|
conversationId?: string;
|
|
139
|
+
metadata?: DocumentMetadata;
|
|
139
140
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
140
141
|
onUploadComplete?: () => void;
|
|
141
142
|
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "chat" | "toolServers", {
|
|
@@ -209,6 +210,7 @@ export declare const apiReducers: {
|
|
|
209
210
|
filename?: string;
|
|
210
211
|
documentType?: string;
|
|
211
212
|
conversationId?: string;
|
|
213
|
+
metadata?: DocumentMetadata;
|
|
212
214
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
213
215
|
onUploadComplete?: () => void;
|
|
214
216
|
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "chat" | "toolServers", {
|
|
@@ -361,8 +363,6 @@ export declare interface BridgeRequestOptions {
|
|
|
361
363
|
|
|
362
364
|
export declare function buildBrandSkin(styles: ChatThemeStyles, resolvedTheme: "light" | "dark"): PaymentSkin;
|
|
363
365
|
|
|
364
|
-
export declare function buildCallbackUrl(givenId?: string | null): string;
|
|
365
|
-
|
|
366
366
|
export declare const CHAT_INPUT_MODES: {
|
|
367
367
|
readonly NORMAL: "normal";
|
|
368
368
|
readonly RECORDING: "recording";
|
|
@@ -400,6 +400,7 @@ file: DocumentUploadFile;
|
|
|
400
400
|
filename?: string;
|
|
401
401
|
documentType?: string;
|
|
402
402
|
conversationId?: string;
|
|
403
|
+
metadata?: DocumentMetadata;
|
|
403
404
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
404
405
|
onUploadComplete?: () => void;
|
|
405
406
|
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "chat" | "toolServers", {
|
|
@@ -502,6 +503,7 @@ file: DocumentUploadFile;
|
|
|
502
503
|
filename?: string;
|
|
503
504
|
documentType?: string;
|
|
504
505
|
conversationId?: string;
|
|
506
|
+
metadata?: DocumentMetadata;
|
|
505
507
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
506
508
|
onUploadComplete?: () => void;
|
|
507
509
|
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "chat" | "toolServers", {
|
|
@@ -607,6 +609,7 @@ file: DocumentUploadFile;
|
|
|
607
609
|
filename?: string;
|
|
608
610
|
documentType?: string;
|
|
609
611
|
conversationId?: string;
|
|
612
|
+
metadata?: DocumentMetadata;
|
|
610
613
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
611
614
|
onUploadComplete?: () => void;
|
|
612
615
|
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "chat" | "toolServers", {
|
|
@@ -821,10 +824,21 @@ export declare function createSessionRefresher(store: SessionStoreLike): () => P
|
|
|
821
824
|
|
|
822
825
|
export declare const DEFAULT_CONVERSATION_TITLE = "New Conversation";
|
|
823
826
|
|
|
824
|
-
export declare const DEFAULT_PAYMENT_PROVIDER: PaymentProviderType;
|
|
825
|
-
|
|
826
827
|
export declare const DEFAULT_PROTOCOL: ProtocolType;
|
|
827
828
|
|
|
829
|
+
export declare function defaultAgentText({ status, amount, currency, paymentId }: DefaultAgentTextInput): string;
|
|
830
|
+
|
|
831
|
+
export declare interface DefaultAgentTextInput {
|
|
832
|
+
status: PaymentOutcomeStatus;
|
|
833
|
+
amount?: number;
|
|
834
|
+
currency?: string;
|
|
835
|
+
paymentId?: string;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
export declare function defaultCancelOutcome({ modelText }?: {
|
|
839
|
+
modelText?: string;
|
|
840
|
+
}): PaymentOutcome;
|
|
841
|
+
|
|
828
842
|
export declare const dequeueMessage: ActionCreatorWithoutPayload<"chat/dequeueMessage">;
|
|
829
843
|
|
|
830
844
|
export declare interface DocumentsConfig {
|
|
@@ -876,15 +890,6 @@ export declare function forgotPasswordApi(payload: ForgotPasswordRequest): Promi
|
|
|
876
890
|
|
|
877
891
|
export declare function formatAmount(minorUnits: number | undefined, currency: string | undefined): string | null;
|
|
878
892
|
|
|
879
|
-
export declare function formatPaymentResult(result: PaymentResult): FormattedPaymentResult;
|
|
880
|
-
|
|
881
|
-
export declare function formatResultMessage(result: PaymentResult): string;
|
|
882
|
-
|
|
883
|
-
export declare interface FormattedPaymentResult {
|
|
884
|
-
text: string;
|
|
885
|
-
modelText?: string;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
893
|
export declare const GENERIC_SERVER_ERROR_MESSAGE = "Something went wrong. Please try again.";
|
|
889
894
|
|
|
890
895
|
export declare function getApiErrorMessage(err: unknown, clientFallback?: string): string;
|
|
@@ -901,6 +906,8 @@ export declare function getErrorGroup(error: unknown): string | null;
|
|
|
901
906
|
|
|
902
907
|
export declare const getLatestRequestId: () => string;
|
|
903
908
|
|
|
909
|
+
export declare function getPaymentProvider(type?: string | null): PaymentProviderEntry | undefined;
|
|
910
|
+
|
|
904
911
|
export declare function guestLoginApi(): Promise<AuthApiResult>;
|
|
905
912
|
|
|
906
913
|
export declare const hasAnyExtraData: (msg: any) => boolean;
|
|
@@ -945,13 +952,6 @@ export declare interface MessageArrival {
|
|
|
945
952
|
|
|
946
953
|
export declare const MODEL_CONTEXT_TEXT_MAX_LENGTH = 1000;
|
|
947
954
|
|
|
948
|
-
export declare const MOYASAR_CALLBACK_SENTINEL = "moyasar_cb";
|
|
949
|
-
|
|
950
|
-
export declare interface MoyasarCallbackResult {
|
|
951
|
-
result: PaymentResult;
|
|
952
|
-
conversationId: string | null;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
955
|
export declare interface NormalizedEvent {
|
|
956
956
|
type: NormalizedEventType;
|
|
957
957
|
data: NormalizedEventData;
|
|
@@ -982,6 +982,14 @@ export declare type NormalizedEventData = {
|
|
|
982
982
|
|
|
983
983
|
export declare type NormalizedEventType = 'text' | 'error' | 'widget' | 'status_update' | 'payment' | 'sign_in' | 'request_documents' | 'conversation_title' | 'stream_end';
|
|
984
984
|
|
|
985
|
+
export declare interface NormalizedPayment<Config = unknown> {
|
|
986
|
+
provider: string;
|
|
987
|
+
paymentId: string;
|
|
988
|
+
amount?: number;
|
|
989
|
+
currency?: string;
|
|
990
|
+
config: Config;
|
|
991
|
+
}
|
|
992
|
+
|
|
985
993
|
export declare const OAUTH_ERROR_TYPE: "OAUTH_ERROR";
|
|
986
994
|
|
|
987
995
|
export declare const OAUTH_SUCCESS_TYPE: "OAUTH_SUCCESS";
|
|
@@ -992,21 +1000,16 @@ export declare const PAGINATION: {
|
|
|
992
1000
|
readonly MESSAGE_PAGE_SIZE: 25;
|
|
993
1001
|
};
|
|
994
1002
|
|
|
995
|
-
export declare
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
readonly
|
|
999
|
-
readonly LOAD_FAILED: "load_failed";
|
|
1003
|
+
export declare const PAYMENT_OUTCOME_STATUSES: {
|
|
1004
|
+
readonly SUCCESS: "success";
|
|
1005
|
+
readonly FAILURE: "failure";
|
|
1006
|
+
readonly CANCEL: "cancel";
|
|
1000
1007
|
};
|
|
1001
1008
|
|
|
1002
1009
|
export declare interface PaymentAdapter {
|
|
1003
|
-
readonly type: PaymentProviderType;
|
|
1004
1010
|
readonly label: string;
|
|
1005
1011
|
readonly hideShellSubmit?: boolean;
|
|
1006
1012
|
readonly hideShellFooter?: boolean;
|
|
1007
|
-
ProviderWrapper?: React.FC<{
|
|
1008
|
-
children: ReactNode;
|
|
1009
|
-
}>;
|
|
1010
1013
|
FormComponent: React.FC<PaymentFormProps>;
|
|
1011
1014
|
}
|
|
1012
1015
|
|
|
@@ -1016,12 +1019,31 @@ export declare interface PaymentConfirmHandle {
|
|
|
1016
1019
|
}
|
|
1017
1020
|
|
|
1018
1021
|
export declare interface PaymentFormProps {
|
|
1019
|
-
amount: number;
|
|
1020
|
-
currency: string;
|
|
1021
1022
|
skin: PaymentSkin;
|
|
1022
1023
|
onReady?: () => void;
|
|
1023
1024
|
}
|
|
1024
1025
|
|
|
1026
|
+
export declare interface PaymentOutcome {
|
|
1027
|
+
status: PaymentOutcomeStatus;
|
|
1028
|
+
agentText: string;
|
|
1029
|
+
modelText?: string;
|
|
1030
|
+
userMessage?: string;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
export declare type PaymentOutcomeStatus = (typeof PAYMENT_OUTCOME_STATUSES)[keyof typeof PAYMENT_OUTCOME_STATUSES];
|
|
1034
|
+
|
|
1035
|
+
export declare type PaymentProviderEntry<Config = unknown> = PaymentProviderSpec<Config> & {
|
|
1036
|
+
loadAdapter(): Promise<{
|
|
1037
|
+
default: PaymentAdapter;
|
|
1038
|
+
}>;
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
export declare interface PaymentProviderSpec<Config = unknown> {
|
|
1042
|
+
type: PaymentProviderType;
|
|
1043
|
+
normalize(raw: PaymentInitPayload): NormalizedPayment<Config> | null;
|
|
1044
|
+
cancelOutcome?(payment: NormalizedPayment<Config>): PaymentOutcome;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1025
1047
|
export declare type PaymentResult = {
|
|
1026
1048
|
status: "success";
|
|
1027
1049
|
provider: PaymentProviderType;
|
|
@@ -1039,6 +1061,8 @@ export declare type PaymentResult = {
|
|
|
1039
1061
|
provider: PaymentProviderType;
|
|
1040
1062
|
};
|
|
1041
1063
|
|
|
1064
|
+
declare type PaymentResultInput = PaymentOutcome | PaymentResult;
|
|
1065
|
+
|
|
1042
1066
|
export declare interface PaymentSkin {
|
|
1043
1067
|
pageBg: string;
|
|
1044
1068
|
cardBg: string;
|
|
@@ -1119,6 +1143,8 @@ export declare interface QueuedMessage {
|
|
|
1119
1143
|
|
|
1120
1144
|
export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
|
|
1121
1145
|
|
|
1146
|
+
export declare function registerPaymentProvider<Config>(entry: PaymentProviderEntry<Config>): void;
|
|
1147
|
+
|
|
1122
1148
|
export declare function resendVerificationApi(payload: ResendVerificationRequest): Promise<string | undefined>;
|
|
1123
1149
|
|
|
1124
1150
|
export declare const resetAllApiState: () => ThunkAction<void, unknown, unknown, UnknownAction>;
|
|
@@ -1129,6 +1155,8 @@ export declare const resetChatState: ActionCreatorWithoutPayload<"chat/resetChat
|
|
|
1129
1155
|
|
|
1130
1156
|
export declare function resetPasswordApi(payload: ResetPasswordRequest): Promise<string | undefined>;
|
|
1131
1157
|
|
|
1158
|
+
export declare function resolvePaymentProvider(provider?: unknown): PaymentProviderEntry | undefined;
|
|
1159
|
+
|
|
1132
1160
|
export declare type RootState = ReturnType<typeof store.getState>;
|
|
1133
1161
|
|
|
1134
1162
|
export declare type SendMessageFn = (inputMsg?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
|
|
@@ -1152,6 +1180,8 @@ export declare interface SessionStoreLike {
|
|
|
1152
1180
|
|
|
1153
1181
|
export declare const setActiveConversationId: ActionCreatorWithOptionalPayload<string, "conversations/setActiveConversationId">;
|
|
1154
1182
|
|
|
1183
|
+
export declare function setDefaultPaymentProvider(type: string): void;
|
|
1184
|
+
|
|
1155
1185
|
export declare const setIsAgentWorking: ActionCreatorWithOptionalPayload<boolean, "chat/setIsAgentWorking">;
|
|
1156
1186
|
|
|
1157
1187
|
export declare const setResponseStartTime: ActionCreatorWithOptionalPayload<number, "chat/setResponseStartTime">;
|
|
@@ -1266,6 +1296,7 @@ file: DocumentUploadFile;
|
|
|
1266
1296
|
filename?: string;
|
|
1267
1297
|
documentType?: string;
|
|
1268
1298
|
conversationId?: string;
|
|
1299
|
+
metadata?: DocumentMetadata;
|
|
1269
1300
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
1270
1301
|
onUploadComplete?: () => void;
|
|
1271
1302
|
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "chat" | "toolServers", {
|
|
@@ -1372,6 +1403,7 @@ file: DocumentUploadFile;
|
|
|
1372
1403
|
filename?: string;
|
|
1373
1404
|
documentType?: string;
|
|
1374
1405
|
conversationId?: string;
|
|
1406
|
+
metadata?: DocumentMetadata;
|
|
1375
1407
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
1376
1408
|
onUploadComplete?: () => void;
|
|
1377
1409
|
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "chat" | "toolServers", {
|
|
@@ -4129,31 +4161,33 @@ declare interface UsePaymentFlowArgs {
|
|
|
4129
4161
|
|
|
4130
4162
|
declare interface UsePaymentFlowReturn {
|
|
4131
4163
|
paymentInit: PaymentInitPayload | null;
|
|
4164
|
+
payment: NormalizedPayment | null;
|
|
4132
4165
|
setPaymentInit: (next: PaymentInitPayload | null) => void;
|
|
4133
4166
|
clearPaymentInit: () => void;
|
|
4134
|
-
handlePaymentResult: (result: PaymentResult) => void;
|
|
4167
|
+
handlePaymentResult: (result: PaymentOutcome | PaymentResult) => void;
|
|
4135
4168
|
}
|
|
4136
4169
|
|
|
4137
4170
|
export declare interface UsePaymentResult {
|
|
4138
4171
|
paymentInit: PaymentInitPayload | null;
|
|
4172
|
+
payment: NormalizedPayment | null;
|
|
4139
4173
|
setPaymentInit: (next: PaymentInitPayload | null) => void;
|
|
4140
4174
|
isOpen: boolean;
|
|
4141
4175
|
onOpenChange: (open: boolean) => void;
|
|
4142
|
-
onResult: (result: PaymentResult) => void;
|
|
4176
|
+
onResult: (result: PaymentOutcome | PaymentResult) => void;
|
|
4143
4177
|
clearPaymentInit: () => void;
|
|
4144
4178
|
}
|
|
4145
4179
|
|
|
4146
|
-
export declare function usePaymentResultDedup({
|
|
4180
|
+
export declare function usePaymentResultDedup({ payment, onPaymentResult, onClearPaymentInit, }: UsePaymentResultDedupArgs): UsePaymentResultDedupReturn;
|
|
4147
4181
|
|
|
4148
4182
|
declare interface UsePaymentResultDedupArgs {
|
|
4149
|
-
|
|
4150
|
-
onPaymentResult?: (result:
|
|
4183
|
+
payment: NormalizedPayment | null;
|
|
4184
|
+
onPaymentResult?: (result: PaymentResultInput) => void;
|
|
4151
4185
|
onClearPaymentInit?: () => void;
|
|
4152
4186
|
}
|
|
4153
4187
|
|
|
4154
4188
|
declare interface UsePaymentResultDedupReturn {
|
|
4155
|
-
handlePaymentResult: (result:
|
|
4156
|
-
|
|
4189
|
+
handlePaymentResult: (result: PaymentResultInput) => void;
|
|
4190
|
+
handleSurfaceOpenChange: (next: boolean) => void;
|
|
4157
4191
|
}
|
|
4158
4192
|
|
|
4159
4193
|
export declare const useProtocol: () => ProtocolContextType;
|
|
@@ -5237,6 +5271,7 @@ export declare const useUploadDocumentMutation: <R extends Record<string, any> =
|
|
|
5237
5271
|
filename?: string;
|
|
5238
5272
|
documentType?: string;
|
|
5239
5273
|
conversationId?: string;
|
|
5274
|
+
metadata?: DocumentMetadata;
|
|
5240
5275
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
5241
5276
|
onUploadComplete?: () => void;
|
|
5242
5277
|
}) => MutationActionCreatorResult<MutationDefinition< {
|
|
@@ -5244,6 +5279,7 @@ file: DocumentUploadFile;
|
|
|
5244
5279
|
filename?: string;
|
|
5245
5280
|
documentType?: string;
|
|
5246
5281
|
conversationId?: string;
|
|
5282
|
+
metadata?: DocumentMetadata;
|
|
5247
5283
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
5248
5284
|
onUploadComplete?: () => void;
|
|
5249
5285
|
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "chat" | "toolServers", {
|
|
@@ -5261,6 +5297,7 @@ size_bytes: number;
|
|
|
5261
5297
|
filename?: string;
|
|
5262
5298
|
documentType?: string;
|
|
5263
5299
|
conversationId?: string;
|
|
5300
|
+
metadata?: DocumentMetadata;
|
|
5264
5301
|
onUploadProgress?: (loaded: number, total: number) => void;
|
|
5265
5302
|
onUploadComplete?: () => void;
|
|
5266
5303
|
};
|