@1interface/chat-core 0.17.0 → 0.19.0-dev.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,6 +17,7 @@ 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';
20
21
  import { IdpHint } from '@1interface/shared-core';
21
22
  import { InheritedAuthAdapter } from '@1interface/shared-core';
22
23
  import { LoggerContextProvider } from '@1interface/shared-core';
@@ -174,7 +175,9 @@ getProfile: QueryDefinition<void, BaseQueryFn<string | FetchArgs, unknown, Fetch
174
175
  updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
175
176
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
176
177
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
177
- }, string, "profileApi">, ThunkDispatch<any, any, UnknownAction>>)[];
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
181
 
179
182
  export declare const apiReducers: {
180
183
  chatApi: Reducer<CombinedState< {
@@ -250,6 +253,9 @@ export declare const apiReducers: {
250
253
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
251
254
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
252
255
  }, "profile", "profileApi">, UnknownAction>;
256
+ paymentApi: Reducer<CombinedState< {
257
+ getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
258
+ }, never, "paymentApi">, UnknownAction>;
253
259
  };
254
260
 
255
261
  export declare type AppDispatch = typeof store.dispatch;
@@ -363,6 +369,8 @@ export declare function buildCallbackUrl(givenId?: string | null): string;
363
369
 
364
370
  export declare function buildHostedPaymentPageThemeMessage(skin: PaymentSkin): HostedPaymentPageThemeMessage;
365
371
 
372
+ export declare function buildHostedPaymentResult(input: HostedPaymentResultInput): PaymentResult;
373
+
366
374
  export declare const CHAT_INPUT_MODES: {
367
375
  readonly NORMAL: "normal";
368
376
  readonly RECORDING: "recording";
@@ -543,6 +551,9 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
543
551
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
544
552
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
545
553
  }, "profile", "profileApi">;
554
+ paymentApi: CombinedState< {
555
+ getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
556
+ }, never, "paymentApi">;
546
557
  }, UnknownAction, Partial<{
547
558
  auth: AuthState;
548
559
  chat: {
@@ -646,6 +657,9 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
646
657
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
647
658
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
648
659
  }, "profile", "profileApi">;
660
+ paymentApi: CombinedState< {
661
+ getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
662
+ }, never, "paymentApi">;
649
663
  }>>;
650
664
 
651
665
  export declare interface ChatIndicator {
@@ -893,6 +907,8 @@ export declare function guestLoginApi(): Promise<AuthApiResult>;
893
907
 
894
908
  export declare const hasAnyExtraData: (msg: any) => boolean;
895
909
 
910
+ export declare const HOSTED_PAYMENT_DEFAULT_FAILURE_MESSAGE = "The payment was not completed.";
911
+
896
912
  export declare const HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS: {
897
913
  readonly LOADED: "loaded";
898
914
  readonly DONE: "done";
@@ -903,12 +919,25 @@ export declare const HOSTED_PAYMENT_PAGE_CALLBACK_MESSAGE_TYPE = "hosted-payment
903
919
  export declare const HOSTED_PAYMENT_PAGE_CALLBACK_PATH = "/payment-callback.html";
904
920
 
905
921
  export declare const HOSTED_PAYMENT_PAGE_STATUSES: {
906
- readonly SUCCESS: "success";
922
+ readonly SUCCEEDED: "succeeded";
907
923
  readonly FAILED: "failed";
924
+ readonly CANCELED: "canceled";
908
925
  };
909
926
 
910
927
  export declare const HOSTED_PAYMENT_PAGE_THEME_MESSAGE_TYPE = "hosted-payment-page-theme";
911
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
+
912
941
  export declare type HostedPaymentPageCallbackAction = (typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS)[keyof typeof HOSTED_PAYMENT_PAGE_CALLBACK_ACTIONS];
913
942
 
914
943
  export declare interface HostedPaymentPageCallbackMessage {
@@ -920,6 +949,9 @@ export declare interface HostedPaymentPageCallbackMessage {
920
949
  export declare interface HostedPaymentPageCallbackResult {
921
950
  paymentId: string;
922
951
  paymentStatus: HostedPaymentPageStatus;
952
+ amount?: number;
953
+ currency?: string;
954
+ message?: string;
923
955
  }
924
956
 
925
957
  export declare type HostedPaymentPageStatus = (typeof HOSTED_PAYMENT_PAGE_STATUSES)[keyof typeof HOSTED_PAYMENT_PAGE_STATUSES];
@@ -930,6 +962,20 @@ export declare interface HostedPaymentPageThemeMessage {
930
962
  vars: Record<`--hpp-${string}`, string>;
931
963
  }
932
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
+
933
979
  export declare function isApiServerError(err: unknown): boolean;
934
980
 
935
981
  export declare const isEmptyMessage: (v: any) => boolean;
@@ -1127,6 +1173,8 @@ export declare interface QueuedMessage {
1127
1173
  documents?: AttachedDocument[];
1128
1174
  }
1129
1175
 
1176
+ export declare function readHostedPaymentStatus(value: unknown): HostedPaymentPageStatus | null;
1177
+
1130
1178
  export declare function refreshTokenApi(payload: RefreshRequest): Promise<RefreshApiResult>;
1131
1179
 
1132
1180
  export declare function resendVerificationApi(payload: ResendVerificationRequest): Promise<string | undefined>;
@@ -1139,6 +1187,8 @@ export declare const resetChatState: ActionCreatorWithoutPayload<"chat/resetChat
1139
1187
 
1140
1188
  export declare function resetPasswordApi(payload: ResetPasswordRequest): Promise<string | undefined>;
1141
1189
 
1190
+ export declare function resolveHostedPaymentCharge(reported: HostedPaymentCharge | null | undefined, init: HostedPaymentPageInit): HostedPaymentCharge;
1191
+
1142
1192
  export declare type RootState = ReturnType<typeof store.getState>;
1143
1193
 
1144
1194
  declare type SendMessageFn = (text?: string) => Promise<void>;
@@ -1173,6 +1223,8 @@ export declare const setStatusText: ActionCreatorWithOptionalPayload<string, "ch
1173
1223
 
1174
1224
  export declare function shouldDisableMessage(message: Message, allMessages: Message[], disableOldWidgets: boolean): boolean;
1175
1225
 
1226
+ export declare function shouldPollForSettlement(init: HostedPaymentPageInit): boolean;
1227
+
1176
1228
  export declare function signupApi(payload: SignupRequest): Promise<SignupApiResult>;
1177
1229
 
1178
1230
  export declare enum SSEEventType {
@@ -1319,6 +1371,9 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
1319
1371
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
1320
1372
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
1321
1373
  }, "profile", "profileApi">;
1374
+ paymentApi: CombinedState< {
1375
+ getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
1376
+ }, never, "paymentApi">;
1322
1377
  }, UnknownAction, Tuple<[StoreEnhancer< {
1323
1378
  dispatch: ((action: Action<"listenerMiddleware/add">) => UnsubscribeListener) & ThunkDispatch< {
1324
1379
  auth: AuthState;
@@ -1423,6 +1478,9 @@ updateProfile: MutationDefinition<UpdateProfilePayload, BaseQueryFn<string | Fet
1423
1478
  deleteAccount: MutationDefinition<void, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", void, "profileApi", unknown>;
1424
1479
  updatePassword: MutationDefinition<UpdatePasswordPayload, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, "profile", string, "profileApi", unknown>;
1425
1480
  }, "profile", "profileApi">;
1481
+ paymentApi: CombinedState< {
1482
+ getHostedPaymentStatus: QueryDefinition<HostedPaymentStatusArgs, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError>, never, HostedPaymentSettlementStatus, "paymentApi", unknown>;
1483
+ }, never, "paymentApi">;
1426
1484
  }, undefined, UnknownAction>;
1427
1485
  }>, StoreEnhancer]>>;
1428
1486
 
@@ -3797,6 +3855,19 @@ export declare function useGuestLogin(): {
3797
3855
  isLoading: boolean;
3798
3856
  };
3799
3857
 
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
+
3800
3871
  export declare function useInfiniteScroll({ hasMore, isLoadingRef, scrollAreaRef, onLoadMore, itemCount, }: {
3801
3872
  hasMore: boolean;
3802
3873
  isLoadingRef: MutableRefObject<boolean>;
@@ -3820,6 +3891,8 @@ export declare interface UseInheritedAuthBootResult {
3820
3891
 
3821
3892
  export declare const useIsDesktop: () => boolean;
3822
3893
 
3894
+ export declare function useLatestRef<T>(value: T): MutableRefObject<T>;
3895
+
3823
3896
  export declare const useLazyGetConversationByIdQuery: <R extends Record<string, any> = TSHelpersId<(Omit<{
3824
3897
  status: QueryStatus.uninitialized;
3825
3898
  originalArgs?: undefined;