@1interface/chat-core 0.19.0 → 0.20.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
@@ -361,8 +361,6 @@ export declare function buildBrandSkin(styles: ChatThemeStyles, resolvedTheme: "
361
361
 
362
362
  export declare function buildCallbackUrl(givenId?: string | null): string;
363
363
 
364
- export declare function buildHostedPaymentPageThemeMessage(skin: PaymentSkin): HostedPaymentPageThemeMessage;
365
-
366
364
  export declare const CHAT_INPUT_MODES: {
367
365
  readonly NORMAL: "normal";
368
366
  readonly RECORDING: "recording";
@@ -458,6 +456,7 @@ filename: string;
458
456
  mime_type: string;
459
457
  size_bytes: number;
460
458
  }[];
459
+ modelText?: string;
461
460
  }[];
462
461
  pendingTranscriptionIds: string[];
463
462
  };
@@ -561,6 +560,7 @@ filename: string;
561
560
  mime_type: string;
562
561
  size_bytes: number;
563
562
  }[];
563
+ modelText?: string;
564
564
  }[];
565
565
  pendingTranscriptionIds: string[];
566
566
  };
@@ -700,6 +700,7 @@ filename: string;
700
700
  mime_type: string;
701
701
  size_bytes: number;
702
702
  }[];
703
+ modelText?: string;
703
704
  }[];
704
705
  pendingTranscriptionIds: string[];
705
706
  }>;
@@ -871,8 +872,15 @@ export declare function forgotPasswordApi(payload: ForgotPasswordRequest): Promi
871
872
 
872
873
  export declare function formatAmount(minorUnits: number | undefined, currency: string | undefined): string | null;
873
874
 
875
+ export declare function formatPaymentResult(result: PaymentResult): FormattedPaymentResult;
876
+
874
877
  export declare function formatResultMessage(result: PaymentResult): string;
875
878
 
879
+ export declare interface FormattedPaymentResult {
880
+ text: string;
881
+ modelText?: string;
882
+ }
883
+
876
884
  export declare const GENERIC_SERVER_ERROR_MESSAGE = "Something went wrong. Please try again.";
877
885
 
878
886
  export declare function getApiErrorMessage(err: unknown, clientFallback?: string): string;
@@ -893,54 +901,15 @@ export declare function guestLoginApi(): Promise<AuthApiResult>;
893
901
 
894
902
  export declare const hasAnyExtraData: (msg: any) => boolean;
895
903
 
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
904
  export declare function isApiServerError(err: unknown): boolean;
938
905
 
939
906
  export declare const isEmptyMessage: (v: any) => boolean;
940
907
 
941
- export declare function isHostedPaymentPageCallbackMessage(value: unknown): value is HostedPaymentPageCallbackMessage;
908
+ export declare function isHttpsUrl(value: unknown): value is string;
942
909
 
943
- export declare function isHostedPaymentPageUrl(value: unknown): value is string;
910
+ declare interface LoadConversationOptions {
911
+ quiet?: boolean;
912
+ }
944
913
 
945
914
  export declare function loginApi(email: string, password: string): Promise<AuthApiResult>;
946
915
 
@@ -1011,10 +980,13 @@ export declare const PAGINATION: {
1011
980
  readonly MESSAGE_PAGE_SIZE: 25;
1012
981
  };
1013
982
 
1014
- export declare function parseHostedPaymentPageCallback(search: string): HostedPaymentPageCallbackResult | null;
1015
-
1016
983
  export declare function parseMoyasarCallbackFromUrl(search: string): MoyasarCallbackResult | null;
1017
984
 
985
+ export declare const PAYMENT_FAILURE_CODES: {
986
+ readonly SESSION_INVALID: "session_invalid";
987
+ readonly LOAD_FAILED: "load_failed";
988
+ };
989
+
1018
990
  export declare interface PaymentAdapter {
1019
991
  readonly type: PaymentProviderType;
1020
992
  readonly label: string;
@@ -1044,14 +1016,12 @@ export declare type PaymentResult = {
1044
1016
  paymentId: string;
1045
1017
  amount?: number;
1046
1018
  currency?: string;
1047
- dismissed?: boolean;
1048
1019
  } | {
1049
1020
  status: "failure";
1050
1021
  provider: PaymentProviderType;
1051
1022
  code?: string;
1052
1023
  message: string;
1053
1024
  paymentId?: string;
1054
- dismissed?: boolean;
1055
1025
  } | {
1056
1026
  status: "cancel";
1057
1027
  provider: PaymentProviderType;
@@ -1131,6 +1101,7 @@ export declare interface QueuedMessage {
1131
1101
  transcriptionIds?: string[];
1132
1102
  messageType?: string[];
1133
1103
  documents?: AttachedDocument[];
1104
+ modelText?: string;
1134
1105
  }
1135
1106
 
1136
1107
  export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
@@ -1147,15 +1118,12 @@ export declare function resetPasswordApi(payload: ResetPasswordRequest): Promise
1147
1118
 
1148
1119
  export declare type RootState = ReturnType<typeof store.getState>;
1149
1120
 
1150
- declare type SendMessageFn = (text?: string) => Promise<void>;
1151
-
1152
- declare type SendMessageFn_2 = (text?: string) => Promise<void>;
1153
-
1154
- declare type SendMessageFn_3 = (text?: string) => Promise<void>;
1121
+ export declare type SendMessageFn = (inputMsg?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
1155
1122
 
1156
1123
  export declare interface SendMessageOptions {
1157
1124
  messageType?: string[];
1158
1125
  documents?: AttachedDocument[];
1126
+ modelText?: string;
1159
1127
  }
1160
1128
 
1161
1129
  export declare const serializableCheck: {
@@ -1241,6 +1209,7 @@ filename: string;
1241
1209
  mime_type: string;
1242
1210
  size_bytes: number;
1243
1211
  }[];
1212
+ modelText?: string;
1244
1213
  }[];
1245
1214
  pendingTranscriptionIds: string[];
1246
1215
  };
@@ -1345,6 +1314,7 @@ filename: string;
1345
1314
  mime_type: string;
1346
1315
  size_bytes: number;
1347
1316
  }[];
1317
+ modelText?: string;
1348
1318
  }[];
1349
1319
  pendingTranscriptionIds: string[];
1350
1320
  };
@@ -1480,6 +1450,8 @@ export declare const THINKING_MESSAGES: {
1480
1450
 
1481
1451
  export { TokenRefreshResult }
1482
1452
 
1453
+ export declare function toModelContext(documents?: AttachedDocument[], modelText?: string): ModelContextPart[] | undefined;
1454
+
1483
1455
  export declare interface ToolServer {
1484
1456
  id: string;
1485
1457
  name: string;
@@ -1542,7 +1514,7 @@ declare interface UseChatConnectionParams {
1542
1514
  }
1543
1515
 
1544
1516
  declare interface UseChatConnectionReturn {
1545
- sendMessage: (inputMsg?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
1517
+ sendMessage: SendMessageFn;
1546
1518
  startInitialStream: (conversationId: string, location?: UserLocation | null) => Promise<void>;
1547
1519
  setThinkingState: (thinking: boolean) => void;
1548
1520
  abortStream: () => void;
@@ -1622,7 +1594,7 @@ declare interface UseConversationReturn {
1622
1594
  hasMoreMessages: boolean;
1623
1595
  isLoadingMoreMessages: boolean;
1624
1596
  startSession: () => Promise<string | null>;
1625
- loadConversation: (conversationId: string, titleHint?: string | null) => Promise<boolean>;
1597
+ loadConversation: (conversationId: string, titleHint?: string | null, options?: LoadConversationOptions) => Promise<boolean>;
1626
1598
  loadConversationTitle: (conversationId?: string | null) => Promise<string | null>;
1627
1599
  loadMoreMessages: () => Promise<void>;
1628
1600
  resetConversation: () => void;
@@ -4122,7 +4094,7 @@ export declare function useOAuthPopup({ signInInit, sendMessageRef, clearSignInI
4122
4094
 
4123
4095
  declare interface UseOAuthPopupArgs {
4124
4096
  signInInit: SignInInitPayload | null;
4125
- sendMessageRef: RefObject<SendMessageFn_2 | null>;
4097
+ sendMessageRef: RefObject<SendMessageFn | null>;
4126
4098
  clearSignInInit: () => void;
4127
4099
  sendResumeMessage?: boolean;
4128
4100
  }
@@ -4130,7 +4102,7 @@ declare interface UseOAuthPopupArgs {
4130
4102
  export declare function usePayment({ sendMessageRef }: UsePaymentArgs): UsePaymentResult;
4131
4103
 
4132
4104
  export declare interface UsePaymentArgs {
4133
- sendMessageRef: MutableRefObject<SendMessageFn_3 | null>;
4105
+ sendMessageRef: MutableRefObject<SendMessageFn | null>;
4134
4106
  }
4135
4107
 
4136
4108
  export declare const usePaymentFlow: ({ sendMessageRef, }: UsePaymentFlowArgs) => UsePaymentFlowReturn;