@1interface/chat-core 0.19.0-dev.0 → 0.19.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
@@ -17,7 +17,6 @@ import { EnhancedStore } from '@reduxjs/toolkit';
17
17
  import { FetchArgs } from '@reduxjs/toolkit/query';
18
18
  import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
19
19
  import { ForgotPasswordRequest } from '@1interface/shared-core';
20
- import { HostedPaymentPageInit } from '@1interface/shared-core';
21
20
  import { IdpHint } from '@1interface/shared-core';
22
21
  import { InheritedAuthAdapter } from '@1interface/shared-core';
23
22
  import { LoggerContextProvider } from '@1interface/shared-core';
@@ -175,9 +174,7 @@ getProfile: QueryDefinition<void, BaseQueryFn<string | FetchArgs, unknown, Fetch
175
174
  updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
176
175
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
177
176
  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>>)[];
177
+ }, string, "profileApi">, ThunkDispatch<any, any, UnknownAction>>)[];
181
178
 
182
179
  export declare const apiReducers: {
183
180
  chatApi: Reducer<CombinedState< {
@@ -253,9 +250,6 @@ export declare const apiReducers: {
253
250
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
254
251
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
255
252
  }, "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
253
  };
260
254
 
261
255
  export declare type AppDispatch = typeof store.dispatch;
@@ -369,8 +363,6 @@ export declare function buildCallbackUrl(givenId?: string | null): string;
369
363
 
370
364
  export declare function buildHostedPaymentPageThemeMessage(skin: PaymentSkin): HostedPaymentPageThemeMessage;
371
365
 
372
- export declare function buildHostedPaymentResult(input: HostedPaymentResultInput): PaymentResult;
373
-
374
366
  export declare const CHAT_INPUT_MODES: {
375
367
  readonly NORMAL: "normal";
376
368
  readonly RECORDING: "recording";
@@ -551,9 +543,6 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
551
543
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
552
544
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
553
545
  }, "profile", "profileApi">;
554
- paymentApi: CombinedState< {
555
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
556
- }, never, "paymentApi">;
557
546
  }, UnknownAction, Partial<{
558
547
  auth: AuthState;
559
548
  chat: {
@@ -657,9 +646,6 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
657
646
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
658
647
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
659
648
  }, "profile", "profileApi">;
660
- paymentApi: CombinedState< {
661
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
662
- }, never, "paymentApi">;
663
649
  }>>;
664
650
 
665
651
  export declare interface ChatIndicator {
@@ -907,8 +893,6 @@ export declare function guestLoginApi(): Promise<AuthApiResult>;
907
893
 
908
894
  export declare const hasAnyExtraData: (msg: any) => boolean;
909
895
 
910
- export declare const HOSTED_PAYMENT_DEFAULT_FAILURE_MESSAGE = "The payment was not completed.";
911
-
912
896
  export declare const HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS: {
913
897
  readonly LOADED: "loaded";
914
898
  readonly DONE: "done";
@@ -926,18 +910,6 @@ export declare const HOSTED_PAYMENT_PAGE_STATUSES: {
926
910
 
927
911
  export declare const HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE = "hosted-payment-page-theme";
928
912
 
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
913
  export declare type HostedPaymentPageCallbackAction = (typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS)[keyof typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS];
942
914
 
943
915
  export declare interface HostedPaymentPageCallbackMessage {
@@ -962,20 +934,6 @@ export declare interface HostedPaymentPageThemeMessage {
962
934
  vars: Record<`--hpp-${string}`, string>;
963
935
  }
964
936
 
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
937
  export declare function isApiServerError(err: unknown): boolean;
980
938
 
981
939
  export declare const isEmptyMessage: (v: any) => boolean;
@@ -1004,6 +962,8 @@ export declare interface MessageArrival {
1004
962
  lastUserMessageIndex: number;
1005
963
  }
1006
964
 
965
+ export declare const MODEL_CONTEXT_TEXT_MAX_LENGTH = 1000;
966
+
1007
967
  export declare const MOYASAR_CALLBACK_SENTINEL = "moyasar_cb";
1008
968
 
1009
969
  export declare interface MoyasarCallbackResult {
@@ -1173,8 +1133,6 @@ export declare interface QueuedMessage {
1173
1133
  documents?: AttachedDocument[];
1174
1134
  }
1175
1135
 
1176
- export declare function readHostedPaymentStatus(value: unknown): HostedPaymentPageStatus | null;
1177
-
1178
1136
  export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
1179
1137
 
1180
1138
  export declare function resendVerificationApi(payload: ResendVerificationRequest): Promise<string | undefined>;
@@ -1187,8 +1145,6 @@ export declare const resetChatState: ActionCreatorWithoutPayload<"chat/resetChat
1187
1145
 
1188
1146
  export declare function resetPasswordApi(payload: ResetPasswordRequest): Promise<string | undefined>;
1189
1147
 
1190
- export declare function resolveHostedPaymentCharge(reported: HostedPaymentCharge | null | undefined, init: HostedPaymentPageInit): HostedPaymentCharge;
1191
-
1192
1148
  export declare type RootState = ReturnType<typeof store.getState>;
1193
1149
 
1194
1150
  declare type SendMessageFn = (text?: string) => Promise<void>;
@@ -1223,8 +1179,6 @@ export declare const setStatusText: ActionCreatorWithOptionalPayload<string, "ch
1223
1179
 
1224
1180
  export declare function shouldDisableMessage(message: Message, allMessages: Message[], disableOldWidgets: boolean): boolean;
1225
1181
 
1226
- export declare function shouldPollForSettlement(init: HostedPaymentPageInit): boolean;
1227
-
1228
1182
  export declare function signupApi(payload: SignupRequest): Promise<SignupApiResult>;
1229
1183
 
1230
1184
  export declare enum SSEEventType {
@@ -1261,6 +1215,7 @@ export declare interface StandardApiError {
1261
1215
 
1262
1216
  export declare interface StartConversationBody {
1263
1217
  client_metadata?: StartConversationMetadata;
1218
+ locale?: string;
1264
1219
  }
1265
1220
 
1266
1221
  export declare interface StartConversationMetadata {
@@ -1371,9 +1326,6 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
1371
1326
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
1372
1327
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
1373
1328
  }, "profile", "profileApi">;
1374
- paymentApi: CombinedState< {
1375
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
1376
- }, never, "paymentApi">;
1377
1329
  }, UnknownAction, Tuple<[StoreEnhancer< {
1378
1330
  dispatch: ((action: Action<"listenerMiddleware/add">) => UnsubscribeListener) & ThunkDispatch< {
1379
1331
  auth: AuthState;
@@ -1478,9 +1430,6 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
1478
1430
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
1479
1431
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
1480
1432
  }, "profile", "profileApi">;
1481
- paymentApi: CombinedState< {
1482
- getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
1483
- }, never, "paymentApi">;
1484
1433
  }, undefined, UnknownAction>;
1485
1434
  }>, StoreEnhancer]>>;
1486
1435
 
@@ -1574,11 +1523,11 @@ export declare const useAuth: () => {
1574
1523
 
1575
1524
  export declare const useChatCallbacks: () => ChatCallbacks;
1576
1525
 
1577
- export declare const useChatConnection: ({ conversationId, messages, setMessages, enableTts, userLocation, startSession, debugMode, onPaymentInit, onSignInInit, onRequestDocuments, onConversationTitle, }: UseChatConnectionParams) => UseChatConnectionReturn;
1526
+ export declare const useChatConnection: ({ conversationId, setMessages, enableTts, userLocation, startSession, debugMode, onPaymentInit, onSignInInit, onRequestDocuments, onConversationTitle, initialMessage, locale, }: UseChatConnectionParams) => UseChatConnectionReturn;
1578
1527
 
1579
1528
  declare interface UseChatConnectionParams {
1580
1529
  conversationId: string | null;
1581
- messages: Message[];
1530
+ messages?: Message[];
1582
1531
  setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
1583
1532
  enableTts?: boolean;
1584
1533
  userLocation?: UserLocation | null;
@@ -1588,6 +1537,8 @@ declare interface UseChatConnectionParams {
1588
1537
  onSignInInit?: (init: SignInInitPayload) => void;
1589
1538
  onRequestDocuments?: (payload: RequestDocumentsPayload) => void;
1590
1539
  onConversationTitle?: (title: string) => void;
1540
+ initialMessage?: string | null;
1541
+ locale?: string | null;
1591
1542
  }
1592
1543
 
1593
1544
  declare interface UseChatConnectionReturn {
@@ -3855,19 +3806,6 @@ export declare function useGuestLogin(): {
3855
3806
  isLoading: boolean;
3856
3807
  };
3857
3808
 
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
3809
  export declare function useInfiniteScroll({ hasMore, isLoadingRef, scrollAreaRef, onLoadMore, itemCount, }: {
3872
3810
  hasMore: boolean;
3873
3811
  isLoadingRef: MutableRefObject<boolean>;
@@ -3891,8 +3829,6 @@ export declare interface UseInheritedAuthBootResult {
3891
3829
 
3892
3830
  export declare const useIsDesktop: () => boolean;
3893
3831
 
3894
- export declare function useLatestRef<T>(value: T): MutableRefObject<T>;
3895
-
3896
3832
  export declare const useLazyGetConversationByIdQuery: <R extends Record<string, any> = TSHelpersId<(Omit<{
3897
3833
  status: QueryStatus.uninitialized;
3898
3834
  originalArgs?: undefined;