@1interface/chat-core 0.19.0 → 0.20.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 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,11 @@ 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;
942
-
943
- export declare function isHostedPaymentPageUrl(value: unknown): value is string;
908
+ export declare function isHttpsUrl(value: unknown): value is string;
944
909
 
945
910
  export declare function loginApi(email: string, password: string): Promise<AuthApiResult>;
946
911
 
@@ -1011,10 +976,13 @@ export declare const PAGINATION: {
1011
976
  readonly MESSAGE_PAGE_SIZE: 25;
1012
977
  };
1013
978
 
1014
- export declare function parseHostedPaymentPageCallback(search: string): HostedPaymentPageCallbackResult | null;
1015
-
1016
979
  export declare function parseMoyasarCallbackFromUrl(search: string): MoyasarCallbackResult | null;
1017
980
 
981
+ export declare const PAYMENT_FAILURE_CODES: {
982
+ readonly SESSION_INVALID: "session_invalid";
983
+ readonly LOAD_FAILED: "load_failed";
984
+ };
985
+
1018
986
  export declare interface PaymentAdapter {
1019
987
  readonly type: PaymentProviderType;
1020
988
  readonly label: string;
@@ -1044,14 +1012,12 @@ export declare type PaymentResult = {
1044
1012
  paymentId: string;
1045
1013
  amount?: number;
1046
1014
  currency?: string;
1047
- dismissed?: boolean;
1048
1015
  } | {
1049
1016
  status: "failure";
1050
1017
  provider: PaymentProviderType;
1051
1018
  code?: string;
1052
1019
  message: string;
1053
1020
  paymentId?: string;
1054
- dismissed?: boolean;
1055
1021
  } | {
1056
1022
  status: "cancel";
1057
1023
  provider: PaymentProviderType;
@@ -1131,6 +1097,7 @@ export declare interface QueuedMessage {
1131
1097
  transcriptionIds?: string[];
1132
1098
  messageType?: string[];
1133
1099
  documents?: AttachedDocument[];
1100
+ modelText?: string;
1134
1101
  }
1135
1102
 
1136
1103
  export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
@@ -1147,15 +1114,12 @@ export declare function resetPasswordApi(payload: ResetPasswordRequest): Promise
1147
1114
 
1148
1115
  export declare type RootState = ReturnType<typeof store.getState>;
1149
1116
 
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>;
1117
+ export declare type SendMessageFn = (inputMsg?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
1155
1118
 
1156
1119
  export declare interface SendMessageOptions {
1157
1120
  messageType?: string[];
1158
1121
  documents?: AttachedDocument[];
1122
+ modelText?: string;
1159
1123
  }
1160
1124
 
1161
1125
  export declare const serializableCheck: {
@@ -1241,6 +1205,7 @@ filename: string;
1241
1205
  mime_type: string;
1242
1206
  size_bytes: number;
1243
1207
  }[];
1208
+ modelText?: string;
1244
1209
  }[];
1245
1210
  pendingTranscriptionIds: string[];
1246
1211
  };
@@ -1345,6 +1310,7 @@ filename: string;
1345
1310
  mime_type: string;
1346
1311
  size_bytes: number;
1347
1312
  }[];
1313
+ modelText?: string;
1348
1314
  }[];
1349
1315
  pendingTranscriptionIds: string[];
1350
1316
  };
@@ -1480,6 +1446,8 @@ export declare const THINKING_MESSAGES: {
1480
1446
 
1481
1447
  export { TokenRefreshResult }
1482
1448
 
1449
+ export declare function toModelContext(documents?: AttachedDocument[], modelText?: string): ModelContextPart[] | undefined;
1450
+
1483
1451
  export declare interface ToolServer {
1484
1452
  id: string;
1485
1453
  name: string;
@@ -1542,7 +1510,7 @@ declare interface UseChatConnectionParams {
1542
1510
  }
1543
1511
 
1544
1512
  declare interface UseChatConnectionReturn {
1545
- sendMessage: (inputMsg?: string, transcriptionIds?: string[], options?: SendMessageOptions) => Promise<void>;
1513
+ sendMessage: SendMessageFn;
1546
1514
  startInitialStream: (conversationId: string, location?: UserLocation | null) => Promise<void>;
1547
1515
  setThinkingState: (thinking: boolean) => void;
1548
1516
  abortStream: () => void;
@@ -4122,7 +4090,7 @@ export declare function useOAuthPopup({ signInInit, sendMessageRef, clearSignInI
4122
4090
 
4123
4091
  declare interface UseOAuthPopupArgs {
4124
4092
  signInInit: SignInInitPayload | null;
4125
- sendMessageRef: RefObject<SendMessageFn_2 | null>;
4093
+ sendMessageRef: RefObject<SendMessageFn | null>;
4126
4094
  clearSignInInit: () => void;
4127
4095
  sendResumeMessage?: boolean;
4128
4096
  }
@@ -4130,7 +4098,7 @@ declare interface UseOAuthPopupArgs {
4130
4098
  export declare function usePayment({ sendMessageRef }: UsePaymentArgs): UsePaymentResult;
4131
4099
 
4132
4100
  export declare interface UsePaymentArgs {
4133
- sendMessageRef: MutableRefObject<SendMessageFn_3 | null>;
4101
+ sendMessageRef: MutableRefObject<SendMessageFn | null>;
4134
4102
  }
4135
4103
 
4136
4104
  export declare const usePaymentFlow: ({ sendMessageRef, }: UsePaymentFlowArgs) => UsePaymentFlowReturn;