@1interface/chat-core 0.18.0 → 0.19.0-dev.1

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 { AtbPaymentInit } from '@1interface/shared-core';
7
8
  import { AttachedDocument } from '@1interface/shared-core';
8
9
  import { AuthApiResult } from '@1interface/shared-core';
9
10
  import { AuthState } from '@1interface/shared-core';
@@ -254,6 +255,60 @@ export declare const apiReducers: {
254
255
 
255
256
  export declare type AppDispatch = typeof store.dispatch;
256
257
 
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
+
257
312
  export declare class AudioRecorder {
258
313
  private mediaRecorder;
259
314
  private audioChunks;
@@ -357,12 +412,12 @@ export declare interface BridgeRequestOptions {
357
412
  customHeaders?: Record<string, string>;
358
413
  }
359
414
 
415
+ export declare function buildAtbResult({ outcome, init, message, checkoutId, code }: AtbResultInput): PaymentResult;
416
+
360
417
  export declare function buildBrandSkin(styles: ChatThemeStyles, resolvedTheme: "light" | "dark"): PaymentSkin;
361
418
 
362
419
  export declare function buildCallbackUrl(givenId?: string | null): string;
363
420
 
364
- export declare function buildHostedPaymentPageThemeMessage(skin: PaymentSkin): HostedPaymentPageThemeMessage;
365
-
366
421
  export declare const CHAT_INPUT_MODES: {
367
422
  readonly NORMAL: "normal";
368
423
  readonly RECORDING: "recording";
@@ -458,6 +513,7 @@ filename: string;
458
513
  mime_type: string;
459
514
  size_bytes: number;
460
515
  }[];
516
+ modelText?: string;
461
517
  }[];
462
518
  pendingTranscriptionIds: string[];
463
519
  };
@@ -561,6 +617,7 @@ filename: string;
561
617
  mime_type: string;
562
618
  size_bytes: number;
563
619
  }[];
620
+ modelText?: string;
564
621
  }[];
565
622
  pendingTranscriptionIds: string[];
566
623
  };
@@ -700,6 +757,7 @@ filename: string;
700
757
  mime_type: string;
701
758
  size_bytes: number;
702
759
  }[];
760
+ modelText?: string;
703
761
  }[];
704
762
  pendingTranscriptionIds: string[];
705
763
  }>;
@@ -873,6 +931,8 @@ export declare function formatAmount(minorUnits: number | undefined, currency: s
873
931
 
874
932
  export declare function formatResultMessage(result: PaymentResult): string;
875
933
 
934
+ export declare function formatResultModelContext(result: PaymentResult): string | undefined;
935
+
876
936
  export declare const GENERIC_SERVER_ERROR_MESSAGE = "Something went wrong. Please try again.";
877
937
 
878
938
  export declare function getApiErrorMessage(err: unknown, clientFallback?: string): string;
@@ -893,54 +953,13 @@ export declare function guestLoginApi(): Promise<AuthApiResult>;
893
953
 
894
954
  export declare const hasAnyExtraData: (msg: any) => boolean;
895
955
 
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 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
956
  export declare function isApiServerError(err: unknown): boolean;
938
957
 
939
- export declare const isEmptyMessage: (v: any) => boolean;
958
+ export declare function isAtbCheckoutUrl(value: unknown): value is string;
940
959
 
941
- export declare function isHostedPaymentPageCallbackMessage(value: unknown): value is HostedPaymentPageCallbackMessage;
960
+ export declare function isAtbMessage(value: unknown): value is AtbMessage;
942
961
 
943
- export declare function isHostedPaymentPageUrl(value: unknown): value is string;
962
+ export declare const isEmptyMessage: (v: any) => boolean;
944
963
 
945
964
  export declare function loginApi(email: string, password: string): Promise<AuthApiResult>;
946
965
 
@@ -1009,8 +1028,6 @@ export declare const PAGINATION: {
1009
1028
  readonly MESSAGE_PAGE_SIZE: 25;
1010
1029
  };
1011
1030
 
1012
- export declare function parseHostedPaymentPageCallback(search: string): HostedPaymentPageCallbackResult | null;
1013
-
1014
1031
  export declare function parseMoyasarCallbackFromUrl(search: string): MoyasarCallbackResult | null;
1015
1032
 
1016
1033
  export declare interface PaymentAdapter {
@@ -1042,14 +1059,14 @@ export declare type PaymentResult = {
1042
1059
  paymentId: string;
1043
1060
  amount?: number;
1044
1061
  currency?: string;
1045
- dismissed?: boolean;
1062
+ checkoutId?: string;
1046
1063
  } | {
1047
1064
  status: "failure";
1048
1065
  provider: PaymentProviderType;
1049
1066
  code?: string;
1050
1067
  message: string;
1051
1068
  paymentId?: string;
1052
- dismissed?: boolean;
1069
+ checkoutId?: string;
1053
1070
  } | {
1054
1071
  status: "cancel";
1055
1072
  provider: PaymentProviderType;
@@ -1129,8 +1146,15 @@ export declare interface QueuedMessage {
1129
1146
  transcriptionIds?: string[];
1130
1147
  messageType?: string[];
1131
1148
  documents?: AttachedDocument[];
1149
+ modelText?: string;
1132
1150
  }
1133
1151
 
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
+
1134
1158
  export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
1135
1159
 
1136
1160
  export declare function resendVerificationApi(payload: ResendVerificationRequest): Promise<string | undefined>;
@@ -1143,17 +1167,20 @@ export declare const resetChatState: ActionCreatorWithoutPayload<"chat/resetChat
1143
1167
 
1144
1168
  export declare function resetPasswordApi(payload: ResetPasswordRequest): Promise<string | undefined>;
1145
1169
 
1170
+ export declare function resolveAtbOrigin(url: string): string | null;
1171
+
1146
1172
  export declare type RootState = ReturnType<typeof store.getState>;
1147
1173
 
1148
- declare type SendMessageFn = (text?: string) => Promise<void>;
1174
+ declare type SendMessageFn = (text?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
1149
1175
 
1150
1176
  declare type SendMessageFn_2 = (text?: string) => Promise<void>;
1151
1177
 
1152
- declare type SendMessageFn_3 = (text?: string) => Promise<void>;
1178
+ declare type SendMessageFn_3 = (text?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
1153
1179
 
1154
1180
  export declare interface SendMessageOptions {
1155
1181
  messageType?: string[];
1156
1182
  documents?: AttachedDocument[];
1183
+ modelText?: string;
1157
1184
  }
1158
1185
 
1159
1186
  export declare const serializableCheck: {
@@ -1238,6 +1265,7 @@ filename: string;
1238
1265
  mime_type: string;
1239
1266
  size_bytes: number;
1240
1267
  }[];
1268
+ modelText?: string;
1241
1269
  }[];
1242
1270
  pendingTranscriptionIds: string[];
1243
1271
  };
@@ -1342,6 +1370,7 @@ filename: string;
1342
1370
  mime_type: string;
1343
1371
  size_bytes: number;
1344
1372
  }[];
1373
+ modelText?: string;
1345
1374
  }[];
1346
1375
  pendingTranscriptionIds: string[];
1347
1376
  };
@@ -1477,6 +1506,8 @@ export declare const THINKING_MESSAGES: {
1477
1506
 
1478
1507
  export { TokenRefreshResult }
1479
1508
 
1509
+ export declare function toModelContext(documents?: AttachedDocument[], modelText?: string): ModelContextPart[] | undefined;
1510
+
1480
1511
  export declare interface ToolServer {
1481
1512
  id: string;
1482
1513
  name: string;