TP-79857 | Nudge Redirection

This commit is contained in:
yashmantri
2024-08-30 18:32:11 +05:30
parent 533aa516e8
commit fef25bab4f
3 changed files with 23 additions and 10 deletions

View File

@@ -42,6 +42,8 @@ import { CaseDetailStackEnum } from '@screens/caseDetails/CaseDetailStack';
import { useNavigation, useRoute } from '@react-navigation/native';
import { NUDGE_BOTTOM_SHEET_DEFAULT_STATE } from './constants';
import {useBackHandler} from "@hooks/useBackHandler";
import { CALLING_NUDGE } from '@screens/caseDetails/CallingFlow/constants';
import { isFunction } from '@components/utlis/commonFunctions';
interface IWidget {
route: {
@@ -50,6 +52,7 @@ interface IWidget {
caseId: string;
journey: string;
handleCloseRouting: GenericFunctionArgs;
from?: string;
};
};
}
@@ -66,7 +69,7 @@ const Widget: React.FC<IWidget> = (props) => {
const isOnline = useIsOnline();
const [isSubmitting, setIsSubmitting] = useState(false);
const { params } = props.route;
const { caseId, journey, handleCloseRouting } = params;
const { caseId, journey, handleCloseRouting, from } = params;
const caseKey = useRef<string>('');
const disableFormInteractionUpdate = useRef(false);
@@ -192,6 +195,7 @@ const Widget: React.FC<IWidget> = (props) => {
journey: journey,
caseId,
handleCloseRouting,
from
});
};
@@ -211,10 +215,15 @@ const Widget: React.FC<IWidget> = (props) => {
const onSuccessfulSubmit = (data: any, interactionId: string, nextActions?: any) => {
setIsSubmitting(false);
setNudgeBottomSheetDetails(NUDGE_BOTTOM_SHEET_DEFAULT_STATE);
navigateToScreen(CaseDetailStackEnum.COLLECTION_CASE_DETAIL, {
journey: journey,
caseId,
});
if (from === CALLING_NUDGE && isFunction(handleCloseRouting)) {
handleCloseRouting();
} else {
navigateToScreen(CaseDetailStackEnum.COLLECTION_CASE_DETAIL, {
journey: journey,
caseId,
});
}
dispatch(
deleteJourney({
caseId,
@@ -247,12 +256,12 @@ const Widget: React.FC<IWidget> = (props) => {
}
);
fetchLocation().then((location) => {
if (location) {
return handleSubmitJourney(data, location);
}
if (location) {
return handleSubmitJourney(data, location);
}
}).catch((err) => {
setIsSubmitting(false);
});
setIsSubmitting(false);
});
};
const onErrorSubmit = (errObj: GenericType, data?: GenericType, interactionId?: string) => {

View File

@@ -23,6 +23,7 @@ import { PageRouteEnum } from '@screens/auth/ProtectedRouter';
import { updatePreDefinedCaseFormJourney } from '@reducers/caseReducer';
import { syncFeedbackNudgeDetails } from '@actions/callRecordingActions';
import useMobileNumbers from '@hooks/useMobileNumbers';
import { CALLING_NUDGE } from '../constants';
const CallingFeedbackNudgeBottomSheet = () => {
const showCallingFeedbackNudgeBottomSheet =
@@ -92,6 +93,7 @@ const CallingFeedbackNudgeBottomSheet = () => {
caseId,
journey: TaskTitleUIMapping.COLLECTION_FEEDBACK,
handleCloseRouting: () => navigateToScreen(currentScreenName, params),
from: CALLING_NUDGE
},
});
}

View File

@@ -10,3 +10,5 @@ export const CALL_CUSTOMER_TABS = [
label: 'Call history',
},
];
export const CALLING_NUDGE = 'CALLING_NUDGE';