TP-91069 | LHS api migration (#1027)

This commit is contained in:
Aishwarya Srivastava
2024-12-09 20:10:37 +05:30
committed by GitHub
parent b5fade4c2e
commit 8f7576f02f
8 changed files with 61 additions and 20 deletions

View File

@@ -29,10 +29,15 @@ const redirectionHandlerOnCallFailed = (caseId: string) => {
export const makeACallToCustomer =
(payload: IMakeACallToCustomerPayload, details: IMakeACallToCustomerDetails) =>
(dispatch: AppDispatch) => {
const url = getApiUrl(ApiKeys.CALL_CUSTOMER, {
telephoneReferenceId: payload?.referenceId,
loanAccountNumber: payload?.loanAccountNumber,
});
const url = getApiUrl(
ApiKeys.CALL_CUSTOMER,
{},
{
caseReferenceId: details?.caseId,
caseBusinessVertical: details?.caseBusinessVertical,
telephoneReferenceId: payload?.referenceId,
}
);
dispatch(setIsCallCreationLoading(true));
dispatch(setConnectingToCustomerBottomSheet(true));
axiosInstance

View File

@@ -1,5 +1,5 @@
import axiosInstance, { ApiKeys, getApiUrl } from '../components/utlis/apiHelper';
import { AppDispatch } from '../store/store';
import store, { AppDispatch } from '../store/store';
import { logError } from '../components/utlis/errorUtils';
import {
ITelephoneNumbers,
@@ -36,7 +36,15 @@ export const fetchTelephoneNumber =
export const fetchCallHistory =
({ caseId, loanAccountNumber, setLoading }: FetchTelephoneNumbersParams) =>
(dispatch: AppDispatch) => {
const url = getApiUrl(ApiKeys.GET_CALL_HISTORY, { loanAccountNumber });
const caseDetail = store?.getState()?.allCases?.caseDetails?.[caseId] || {};
const url = getApiUrl(
ApiKeys.GET_CALL_HISTORY,
{},
{
caseReferenceId: caseDetail?.caseReferenceId,
caseBusinessVertical: caseDetail?.businessVertical,
}
);
const isSetLoadingFunction = isFunction(setLoading);
if (isSetLoadingFunction) setLoading(true);
axiosInstance

View File

@@ -196,10 +196,9 @@ API_URLS[ApiKeys.DUE_AMOUNT_SUMMARY] = '/collection-cases/{loanAccountNumber}/am
API_URLS[ApiKeys.FEE_WAIVER_HISTORY] = '/collection-cases/{loanAccountNumber}/waiver-history';
API_URLS[ApiKeys.FEE_WAIVER_V2] = '/loan/request/{loanAccountNumber}/adjust-component/v2';
API_URLS[ApiKeys.GET_PIN_CODES_DETAILS] = '/api/v1/pincodes/{pinCode}';
API_URLS[ApiKeys.CALL_CUSTOMER] =
'/call-recording/call-request/{loanAccountNumber}/{telephoneReferenceId}';
API_URLS[ApiKeys.CALL_CUSTOMER] = '/call-recording/v2/call-request';
API_URLS[ApiKeys.SYNC_ACTIVE_CALL_DETAILS] = '/call-recording/call-status';
API_URLS[ApiKeys.GET_CALL_HISTORY] = '/call-recording/call-history/{loanAccountNumber}';
API_URLS[ApiKeys.GET_CALL_HISTORY] = '/call-recording/v2/call-history';
API_URLS[ApiKeys.SYNC_CALL_FEEDBACK_NUDGE_DETAILS] =
'/call-recording/acknowledge-feedback-nudge/{callId}';
API_URLS[ApiKeys.FETCH_CUSTOMER_DOCUMENTS] = '/documents/{loanAccountNumber}';

View File

@@ -65,20 +65,20 @@ const FeedbackStatus = (props: IFeedbackStatus) => {
};
const styles = StyleSheet.create({
dashedBorder: {
borderColor: COLORS.BORDER.PRIMARY,
borderStyle: 'dashed',
borderTopWidth: 1,
},
feedbackStatus: {
lineHeight: 18,
marginTop: 4,
color: COLORS.TEXT.BLACK,
fontWeight: '500',
lineHeight: 18,
marginTop: 4,
},
rightAlign: {
textAlign: 'right',
},
dashedBorder: {
borderTopWidth: 1,
borderColor: COLORS.BORDER.PRIMARY,
borderStyle: 'dashed',
},
});
export default FeedbackStatus;

View File

@@ -32,6 +32,9 @@ const CallHistoryItem = (props: ICallHistoryItem) => {
const customerName = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.customerName
);
const caseBusinessVertical = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical
);
const isCallCreationLoading = useAppSelector((state) => state?.activeCall?.isCallCreationLoading);
const isCallActive = useAppSelector((state) => state?.activeCall?.activeCallDetails?.callActive);
@@ -53,7 +56,13 @@ const CallHistoryItem = (props: ICallHistoryItem) => {
dispatch(
makeACallToCustomer(
{ referenceId: telephoneReferenceId, loanAccountNumber },
{ caseId, customerName, isCallHistory: true }
{
caseId,
customerName,
isCallHistory: true,
caseBusinessVertical,
telephoneReferenceId,
}
)
);
} else {

View File

@@ -93,6 +93,8 @@ export interface IMakeACallToCustomerPayload {
export interface IMakeACallToCustomerDetails {
caseId: string;
customerName: string;
caseBusinessVertical: string;
telephoneReferenceId: string;
isCallHistory?: boolean;
}

View File

@@ -325,6 +325,7 @@ export interface CaseDetail {
lastMonthCaseInteractionStatus?:FeedbackStatusObj;
escalationData ?: EscalationData;
daysTillDeallocation: number;
businessVertical: string;
}
export interface recentEscalationDetails {

View File

@@ -11,7 +11,11 @@ import CallIcon from './CallIcon';
import { useAppDispatch, useAppSelector } from '@hooks';
import { RootState } from '@store';
import PhoneStateModule from '@components/utlis/PhoneState';
import { setActiveCallData, setCallCannotInitiateBottomSheet, setCallingFeedbackNudgeBottomSheet } from '@reducers/activeCallSlice';
import {
setActiveCallData,
setCallCannotInitiateBottomSheet,
setCallingFeedbackNudgeBottomSheet,
} from '@reducers/activeCallSlice';
import { logError } from '@components/utlis/errorUtils';
import { makeACallToCustomer } from '@actions/callRecordingActions';
import { CallVia, IRenderIcons, IconType, PhoneStateType } from '../CallingFlow/interfaces';
@@ -58,6 +62,9 @@ const RenderIcons: React.FC<IRenderIcons> = ({
);
const isCallCreationLoading = useAppSelector((state) => state?.activeCall?.isCallCreationLoading);
const isCallActive = useAppSelector((state) => state?.activeCall?.activeCallDetails?.callActive);
const caseBusinessVertical = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical
);
const totalGenuineCallsRequired =
useAppSelector(
(state: RootState) =>
@@ -73,7 +80,14 @@ const RenderIcons: React.FC<IRenderIcons> = ({
});
if (!isCallRecordingCosmosExotelEnabled) {
Linking.openURL(`tel:${mobileNumber}`);
dispatch(setActiveCallData({ caseId, customerName, telephoneNo: mobileNumber, telephoneReferenceId: referenceId }));
dispatch(
setActiveCallData({
caseId,
customerName,
telephoneNo: mobileNumber,
telephoneReferenceId: referenceId,
})
);
dispatch(setCallingFeedbackNudgeBottomSheet(true));
return;
}
@@ -85,7 +99,10 @@ const RenderIcons: React.FC<IRenderIcons> = ({
) {
dispatch(setCallAttemptedOn(mobileNumber));
dispatch(
makeACallToCustomer({ referenceId, loanAccountNumber }, { caseId, customerName })
makeACallToCustomer(
{ referenceId, loanAccountNumber },
{ caseId, customerName, caseBusinessVertical, telephoneReferenceId: referenceId }
)
);
} else {
dispatch(setCallCannotInitiateBottomSheet(true));