@1interface/chat-core 0.19.0-dev.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';
@@ -17,7 +18,6 @@ import { EnhancedStore } from '@reduxjs/toolkit';
17
18
  import { FetchArgs } from '@reduxjs/toolkit/query';
18
19
  import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
19
20
  import { ForgotPasswordRequest } from '@1interface/shared-core';
20
- import { HostedPaymentPageInit } from '@1interface/shared-core';
21
21
  import { IdpHint } from '@1interface/shared-core';
22
22
  import { InheritedAuthAdapter } from '@1interface/shared-core';
23
23
  import { LoggerContextProvider } from '@1interface/shared-core';
@@ -175,9 +175,7 @@ getProfile: QueryDefinition<void, BaseQueryFn<string | FetchArgs, unknown, Fetch
175
175
  updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
176
176
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
177
177
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
178
- }, string, "profileApi">, ThunkDispatch<any, any, UnknownAction>> | Middleware< {}, RootState_2< {
179
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
180
- }, string, "paymentApi">, ThunkDispatch<any, any, UnknownAction>>)[];
178
+ }, string, "profileApi">, ThunkDispatch<any, any, UnknownAction>>)[];
181
179
 
182
180
  export declare const apiReducers: {
183
181
  chatApi: Reducer<CombinedState< {
@@ -253,13 +251,64 @@ export declare const apiReducers: {
253
251
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
254
252
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
255
253
  }, "profile", "profileApi">, UnknownAction>;
256
- paymentApi: Reducer<CombinedState< {
257
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
258
- }, never, "paymentApi">, UnknownAction>;
259
254
  };
260
255
 
261
256
  export declare type AppDispatch = typeof store.dispatch;
262
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
+
263
312
  export declare class AudioRecorder {
264
313
  private mediaRecorder;
265
314
  private audioChunks;
@@ -363,14 +412,12 @@ export declare interface BridgeRequestOptions {
363
412
  customHeaders?: Record<string, string>;
364
413
  }
365
414
 
415
+ export declare function buildAtbResult({ outcome, init, message, checkoutId, code }: AtbResultInput): PaymentResult;
416
+
366
417
  export declare function buildBrandSkin(styles: ChatThemeStyles, resolvedTheme: "light" | "dark"): PaymentSkin;
367
418
 
368
419
  export declare function buildCallbackUrl(givenId?: string | null): string;
369
420
 
370
- export declare function buildHostedPaymentPageThemeMessage(skin: PaymentSkin): HostedPaymentPageThemeMessage;
371
-
372
- export declare function buildHostedPaymentResult(input: HostedPaymentResultInput): PaymentResult;
373
-
374
421
  export declare const CHAT_INPUT_MODES: {
375
422
  readonly NORMAL: "normal";
376
423
  readonly RECORDING: "recording";
@@ -466,6 +513,7 @@ filename: string;
466
513
  mime_type: string;
467
514
  size_bytes: number;
468
515
  }[];
516
+ modelText?: string;
469
517
  }[];
470
518
  pendingTranscriptionIds: string[];
471
519
  };
@@ -551,9 +599,6 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
551
599
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
552
600
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
553
601
  }, "profile", "profileApi">;
554
- paymentApi: CombinedState< {
555
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
556
- }, never, "paymentApi">;
557
602
  }, UnknownAction, Partial<{
558
603
  auth: AuthState;
559
604
  chat: {
@@ -572,6 +617,7 @@ filename: string;
572
617
  mime_type: string;
573
618
  size_bytes: number;
574
619
  }[];
620
+ modelText?: string;
575
621
  }[];
576
622
  pendingTranscriptionIds: string[];
577
623
  };
@@ -657,9 +703,6 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
657
703
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
658
704
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
659
705
  }, "profile", "profileApi">;
660
- paymentApi: CombinedState< {
661
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
662
- }, never, "paymentApi">;
663
706
  }>>;
664
707
 
665
708
  export declare interface ChatIndicator {
@@ -714,6 +757,7 @@ filename: string;
714
757
  mime_type: string;
715
758
  size_bytes: number;
716
759
  }[];
760
+ modelText?: string;
717
761
  }[];
718
762
  pendingTranscriptionIds: string[];
719
763
  }>;
@@ -887,6 +931,8 @@ export declare function formatAmount(minorUnits: number | undefined, currency: s
887
931
 
888
932
  export declare function formatResultMessage(result: PaymentResult): string;
889
933
 
934
+ export declare function formatResultModelContext(result: PaymentResult): string | undefined;
935
+
890
936
  export declare const GENERIC_SERVER_ERROR_MESSAGE = "Something went wrong. Please try again.";
891
937
 
892
938
  export declare function getApiErrorMessage(err: unknown, clientFallback?: string): string;
@@ -907,82 +953,13 @@ export declare function guestLoginApi(): Promise<AuthApiResult>;
907
953
 
908
954
  export declare const hasAnyExtraData: (msg: any) => boolean;
909
955
 
910
- export declare const HOSTED_PAYMENT_DEFAULT_FAILURE_MESSAGE = "The payment was not completed.";
911
-
912
- export declare const HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS: {
913
- readonly LOADED: "loaded";
914
- readonly DONE: "done";
915
- };
916
-
917
- export declare const HOSTED_PAYMENT_PAGE_CALLBACK_MESSAGE_TYPE = "hosted-payment-page-callback";
918
-
919
- export declare const HOSTED_PAYMENT_PAGE_CALLBACK_PATH = "/payment-callback.html";
920
-
921
- export declare const HOSTED_PAYMENT_PAGE_STATUSES: {
922
- readonly SUCCEEDED: "succeeded";
923
- readonly FAILED: "failed";
924
- readonly CANCELED: "canceled";
925
- };
926
-
927
- export declare const HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE = "hosted-payment-page-theme";
928
-
929
- export declare const HOSTED_PAYMENT_SETTLEMENT_STATUSES: {
930
- readonly SUCCEEDED: "succeeded";
931
- readonly FAILED: "failed";
932
- readonly CANCELED: "canceled";
933
- readonly PENDING: "pending";
934
- };
935
-
936
- export declare interface HostedPaymentCharge {
937
- amount?: number;
938
- currency?: string;
939
- }
940
-
941
- export declare type HostedPaymentPageCallbackAction = (typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS)[keyof typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS];
942
-
943
- export declare interface HostedPaymentPageCallbackMessage {
944
- type: typeof HOSTED_PAYMENT_PAGE_CALLBACK_MESSAGE_TYPE;
945
- action: HostedPaymentPageCallbackAction;
946
- search: string;
947
- }
948
-
949
- export declare interface HostedPaymentPageCallbackResult {
950
- paymentId: string;
951
- paymentStatus: HostedPaymentPageStatus;
952
- amount?: number;
953
- currency?: string;
954
- message?: string;
955
- }
956
-
957
- export declare type HostedPaymentPageStatus = (typeof HOSTED_PAYMENT_PAGE_STATUSES)[keyof typeof HOSTED_PAYMENT_PAGE_STATUSES];
958
-
959
- export declare interface HostedPaymentPageThemeMessage {
960
- type: typeof HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE;
961
- colorScheme: PaymentSkin["colorScheme"];
962
- vars: Record<`--hpp-${string}`, string>;
963
- }
964
-
965
- export declare interface HostedPaymentResultInput {
966
- status: HostedPaymentPageStatus;
967
- paymentId: string;
968
- charge?: HostedPaymentCharge;
969
- message?: string;
970
- dismissed?: boolean;
971
- }
972
-
973
- export declare type HostedPaymentSettlementStatus = HostedPaymentPageStatus | "pending";
974
-
975
- export declare interface HostedPaymentStatusArgs {
976
- referenceId: string;
977
- }
978
-
979
956
  export declare function isApiServerError(err: unknown): boolean;
980
957
 
981
- export declare const isEmptyMessage: (v: any) => boolean;
958
+ export declare function isAtbCheckoutUrl(value: unknown): value is string;
982
959
 
983
- export declare function isHostedPaymentPageCallbackMessage(value: unknown): value is HostedPaymentPageCallbackMessage;
960
+ export declare function isAtbMessage(value: unknown): value is AtbMessage;
984
961
 
985
- export declare function isHostedPaymentPageUrl(value: unknown): value is string;
962
+ export declare const isEmptyMessage: (v: any) => boolean;
986
963
 
987
964
  export declare function loginApi(email: string, password: string): Promise<AuthApiResult>;
988
965
 
@@ -1051,8 +1028,6 @@ export declare const PAGINATION: {
1051
1028
  readonly MESSAGE_PAGE_SIZE: 25;
1052
1029
  };
1053
1030
 
1054
- export declare function parseHostedPaymentPageCallback(search: string): HostedPaymentPageCallbackResult | null;
1055
-
1056
1031
  export declare function parseMoyasarCallbackFromUrl(search: string): MoyasarCallbackResult | null;
1057
1032
 
1058
1033
  export declare interface PaymentAdapter {
@@ -1084,14 +1059,14 @@ export declare type PaymentResult = {
1084
1059
  paymentId: string;
1085
1060
  amount?: number;
1086
1061
  currency?: string;
1087
- dismissed?: boolean;
1062
+ checkoutId?: string;
1088
1063
  } | {
1089
1064
  status: "failure";
1090
1065
  provider: PaymentProviderType;
1091
1066
  code?: string;
1092
1067
  message: string;
1093
1068
  paymentId?: string;
1094
- dismissed?: boolean;
1069
+ checkoutId?: string;
1095
1070
  } | {
1096
1071
  status: "cancel";
1097
1072
  provider: PaymentProviderType;
@@ -1171,9 +1146,14 @@ export declare interface QueuedMessage {
1171
1146
  transcriptionIds?: string[];
1172
1147
  messageType?: string[];
1173
1148
  documents?: AttachedDocument[];
1149
+ modelText?: string;
1174
1150
  }
1175
1151
 
1176
- export declare function readHostedPaymentStatus(value: unknown): HostedPaymentPageStatus | null;
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;
1177
1157
 
1178
1158
  export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
1179
1159
 
@@ -1187,19 +1167,20 @@ export declare const resetChatState: ActionCreatorWithoutPayload<"chat/resetChat
1187
1167
 
1188
1168
  export declare function resetPasswordApi(payload: ResetPasswordRequest): Promise<string | undefined>;
1189
1169
 
1190
- export declare function resolveHostedPaymentCharge(reported: HostedPaymentCharge | null | undefined, init: HostedPaymentPageInit): HostedPaymentCharge;
1170
+ export declare function resolveAtbOrigin(url: string): string | null;
1191
1171
 
1192
1172
  export declare type RootState = ReturnType<typeof store.getState>;
1193
1173
 
1194
- declare type SendMessageFn = (text?: string) => Promise<void>;
1174
+ declare type SendMessageFn = (text?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
1195
1175
 
1196
1176
  declare type SendMessageFn_2 = (text?: string) => Promise<void>;
1197
1177
 
1198
- declare type SendMessageFn_3 = (text?: string) => Promise<void>;
1178
+ declare type SendMessageFn_3 = (text?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
1199
1179
 
1200
1180
  export declare interface SendMessageOptions {
1201
1181
  messageType?: string[];
1202
1182
  documents?: AttachedDocument[];
1183
+ modelText?: string;
1203
1184
  }
1204
1185
 
1205
1186
  export declare const serializableCheck: {
@@ -1223,8 +1204,6 @@ export declare const setStatusText: ActionCreatorWithOptionalPayload<string, "ch
1223
1204
 
1224
1205
  export declare function shouldDisableMessage(message: Message, allMessages: Message[], disableOldWidgets: boolean): boolean;
1225
1206
 
1226
- export declare function shouldPollForSettlement(init: HostedPaymentPageInit): boolean;
1227
-
1228
1207
  export declare function signupApi(payload: SignupRequest): Promise<SignupApiResult>;
1229
1208
 
1230
1209
  export declare enum SSEEventType {
@@ -1286,6 +1265,7 @@ filename: string;
1286
1265
  mime_type: string;
1287
1266
  size_bytes: number;
1288
1267
  }[];
1268
+ modelText?: string;
1289
1269
  }[];
1290
1270
  pendingTranscriptionIds: string[];
1291
1271
  };
@@ -1371,9 +1351,6 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
1371
1351
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
1372
1352
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
1373
1353
  }, "profile", "profileApi">;
1374
- paymentApi: CombinedState< {
1375
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
1376
- }, never, "paymentApi">;
1377
1354
  }, UnknownAction, Tuple<[StoreEnhancer< {
1378
1355
  dispatch: ((action: Action<"listenerMiddleware/add">) => UnsubscribeListener) & ThunkDispatch< {
1379
1356
  auth: AuthState;
@@ -1393,6 +1370,7 @@ filename: string;
1393
1370
  mime_type: string;
1394
1371
  size_bytes: number;
1395
1372
  }[];
1373
+ modelText?: string;
1396
1374
  }[];
1397
1375
  pendingTranscriptionIds: string[];
1398
1376
  };
@@ -1478,9 +1456,6 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
1478
1456
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
1479
1457
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
1480
1458
  }, "profile", "profileApi">;
1481
- paymentApi: CombinedState< {
1482
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
1483
- }, never, "paymentApi">;
1484
1459
  }, undefined, UnknownAction>;
1485
1460
  }>, StoreEnhancer]>>;
1486
1461
 
@@ -1531,6 +1506,8 @@ export declare const THINKING_MESSAGES: {
1531
1506
 
1532
1507
  export { TokenRefreshResult }
1533
1508
 
1509
+ export declare function toModelContext(documents?: AttachedDocument[], modelText?: string): ModelContextPart[] | undefined;
1510
+
1534
1511
  export declare interface ToolServer {
1535
1512
  id: string;
1536
1513
  name: string;
@@ -3855,19 +3832,6 @@ export declare function useGuestLogin(): {
3855
3832
  isLoading: boolean;
3856
3833
  };
3857
3834
 
3858
- export declare const useHostedPaymentSettlement: ({ init, enabled, }: UseHostedPaymentSettlementArgs) => UseHostedPaymentSettlementResult;
3859
-
3860
- export declare interface UseHostedPaymentSettlementArgs {
3861
- init: HostedPaymentPageInit;
3862
- enabled: boolean;
3863
- }
3864
-
3865
- export declare interface UseHostedPaymentSettlementResult {
3866
- polling: boolean;
3867
- status: Exclude<HostedPaymentSettlementStatus, "pending"> | null;
3868
- timedOut: boolean;
3869
- }
3870
-
3871
3835
  export declare function useInfiniteScroll({ hasMore, isLoadingRef, scrollAreaRef, onLoadMore, itemCount, }: {
3872
3836
  hasMore: boolean;
3873
3837
  isLoadingRef: MutableRefObject<boolean>;
@@ -3891,8 +3855,6 @@ export declare interface UseInheritedAuthBootResult {
3891
3855
 
3892
3856
  export declare const useIsDesktop: () => boolean;
3893
3857
 
3894
- export declare function useLatestRef<T>(value: T): MutableRefObject<T>;
3895
-
3896
3858
  export declare const useLazyGetConversationByIdQuery: <R extends Record<string, any> = TSHelpersId<(Omit<{
3897
3859
  status: QueryStatus.uninitialized;
3898
3860
  originalArgs?: undefined;