TP-29770 | Duplicate Feedback on 1 interactionId (#430)
This commit is contained in:
committed by
GitHub Enterprise
parent
42987636fa
commit
6c15345de6
@@ -9,6 +9,8 @@ import { CaseAllocationType } from '../../screens/allCases/interface';
|
||||
import { CLICKSTREAM_EVENT_NAMES } from '../../common/Constants';
|
||||
import { CaptureGeolocation } from './services/geoLocation.service';
|
||||
import { toast } from '../../../RN-UI-LIB/src/components/toast';
|
||||
import { getVisitedWidgetsNodeList } from './services/forms.service';
|
||||
import { CollectionCaseWidgetId } from '../../types/template.types';
|
||||
|
||||
interface ISubmit {
|
||||
caseId: string;
|
||||
@@ -30,6 +32,12 @@ const Submit: React.FC<ISubmit> = (props) => {
|
||||
const sections = templateData.sections;
|
||||
const questions = templateData.questions;
|
||||
|
||||
const verifiedVisitedWidgets = getVisitedWidgetsNodeList(
|
||||
templateData,
|
||||
data,
|
||||
CollectionCaseWidgetId.START
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.AV_FORM_SUMMARY_PAGE_LOADED, {
|
||||
journeyId: journey,
|
||||
@@ -45,7 +53,7 @@ const Submit: React.FC<ISubmit> = (props) => {
|
||||
<View
|
||||
style={[GenericStyles.p16, GenericStyles.whiteBackground, getShadowStyle(5), styles.br8]}
|
||||
>
|
||||
{data?.visitedWidgets?.map((visited) => {
|
||||
{verifiedVisitedWidgets?.map((visited) => {
|
||||
const sectionsArray = templateData.widget[visited].sections;
|
||||
|
||||
return (
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
getTransformedCollectionCaseItem,
|
||||
} from '../../services/casePayload.transformer';
|
||||
import { addClickstreamEvent } from '../../services/clickstreamEventService';
|
||||
import { FormTemplateV1 } from '../../types/template.types';
|
||||
import { CommonCaseWidgetId, FormTemplateV1 } from '../../types/template.types';
|
||||
import {
|
||||
getTemplateRoute,
|
||||
getWidgetNameFromRoute,
|
||||
@@ -180,6 +180,7 @@ const Widget: React.FC<IWidget> = (props) => {
|
||||
answer: data,
|
||||
coords,
|
||||
templateId: templateData.templateId,
|
||||
templateData,
|
||||
});
|
||||
if (isOnline) {
|
||||
setIsSubmitting(true);
|
||||
@@ -354,10 +355,10 @@ const Widget: React.FC<IWidget> = (props) => {
|
||||
contentContainerStyle={[
|
||||
GenericStyles.p16,
|
||||
GenericStyles.whiteBackground,
|
||||
name === 'SUBMIT' && GenericStyles.fill,
|
||||
name === CommonCaseWidgetId.END && GenericStyles.fill,
|
||||
]}
|
||||
>
|
||||
{name === 'SUBMIT' ? (
|
||||
{name === CommonCaseWidgetId.END ? (
|
||||
<Submit caseId={caseId} journey={journey} />
|
||||
) : (
|
||||
<>
|
||||
|
||||
@@ -1,5 +1,35 @@
|
||||
import { evaluateCondition } from './conditionEvaluation.service';
|
||||
import { Action, ActionType, ConditionAction } from '../../../types/template.types';
|
||||
import {
|
||||
Action,
|
||||
ActionType,
|
||||
CollectionCaseWidgetId,
|
||||
CommonCaseWidgetId,
|
||||
ConditionAction,
|
||||
FormTemplateV1,
|
||||
} from '../../../types/template.types';
|
||||
|
||||
export const getVisitedWidgetsNodeList = (
|
||||
templateData: FormTemplateV1,
|
||||
formWidgetContext: any,
|
||||
startingWidgetName: CommonCaseWidgetId | CollectionCaseWidgetId
|
||||
) => {
|
||||
let visitedWidgetsNodeList: string[] = [startingWidgetName];
|
||||
|
||||
let nextScreenName = '';
|
||||
const MAX_WIDGET_SIZE = Object.keys(templateData.widget).length;
|
||||
|
||||
let iteration = 0;
|
||||
while (nextScreenName !== CommonCaseWidgetId.END && iteration++ <= MAX_WIDGET_SIZE) {
|
||||
const currentScreenName = visitedWidgetsNodeList[visitedWidgetsNodeList.length - 1];
|
||||
nextScreenName = getNextWidget(
|
||||
templateData.widget[currentScreenName].conditionActions,
|
||||
formWidgetContext
|
||||
);
|
||||
visitedWidgetsNodeList.push(nextScreenName);
|
||||
}
|
||||
|
||||
return visitedWidgetsNodeList;
|
||||
};
|
||||
|
||||
export const getNextWidget = (conditionActions: ConditionAction[], context: any): string => {
|
||||
let nextScreenName = '';
|
||||
|
||||
@@ -15,6 +15,8 @@ import {
|
||||
import { CaseDetail, CONTEXT_TASK_STATUSES } from '../screens/caseDetails/interface';
|
||||
import { addClickstreamEvent } from '../services/clickstreamEventService';
|
||||
import { getLoanAccountNumber } from '../components/utlis/commonFunctions';
|
||||
import { getVisitedWidgetsNodeList } from '../components/form/services/forms.service';
|
||||
import { CollectionCaseWidgetId, CommonCaseWidgetId } from '../types/template.types';
|
||||
|
||||
export type ICasesMap = { [key: string]: ICaseItem };
|
||||
|
||||
@@ -81,16 +83,30 @@ const getCaseListComponents = (casesList: ICaseItem[], caseDetails: Record<strin
|
||||
return { pendingList, completedList, pinnedList };
|
||||
};
|
||||
|
||||
export const getUpdatedCollectionCaseDetail = ({ caseData, answer, coords, templateId }: any) => {
|
||||
export const getUpdatedCollectionCaseDetail = ({
|
||||
caseData,
|
||||
answer,
|
||||
coords,
|
||||
templateId,
|
||||
templateData,
|
||||
}: any) => {
|
||||
const updatedValue = { ...caseData };
|
||||
updatedValue.isSynced = false;
|
||||
updatedValue.isApiCalled = false;
|
||||
updatedValue.taskStatus = 'completed';
|
||||
// @deprecating
|
||||
const visitedWidgets = answer.visitedWidgets;
|
||||
const allWidget = answer.widgetContext;
|
||||
const widgetContext = {};
|
||||
_map(visitedWidgets, (widget) => {
|
||||
if (widget === 'SUBMIT') return;
|
||||
|
||||
const verifiedVisitedWidgets = getVisitedWidgetsNodeList(
|
||||
templateData,
|
||||
answer,
|
||||
CollectionCaseWidgetId.START
|
||||
);
|
||||
|
||||
_map(verifiedVisitedWidgets, (widget) => {
|
||||
if (widget === CommonCaseWidgetId.END) return;
|
||||
widgetContext[widget] = allWidget[widget];
|
||||
});
|
||||
const newAnswer = {
|
||||
@@ -118,7 +134,7 @@ export const getUpdatedAVCaseDetail = ({
|
||||
const allWidget = answer.widgetContext;
|
||||
const widgetContext = {};
|
||||
_map(visitedWidgets, (widget) => {
|
||||
if (widget === 'SUBMIT') return;
|
||||
if (widget === CommonCaseWidgetId.END) return;
|
||||
widgetContext[widget] = allWidget[widget];
|
||||
});
|
||||
const newAnswer = {
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
||||
import { CaseAllocationType, ICaseItem } from '../screens/allCases/interface';
|
||||
import { FormTemplateV1 } from '../types/template.types';
|
||||
import { FormTemplateV1, IVisitedWidgetContext } from '../types/template.types';
|
||||
|
||||
interface ICaseReducer {
|
||||
value: number;
|
||||
caseForm: {
|
||||
[caseId: string]: {
|
||||
[journeyId: string]: {
|
||||
visitedWidgets: Array<string>;
|
||||
widgetContext: {
|
||||
[widgetId: string]: {
|
||||
sectionContext: {
|
||||
[sectionId: string]: {
|
||||
questionContext: {
|
||||
[questionId: string]: { answer: string; type: string };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
[journeyId: string]: IVisitedWidgetContext;
|
||||
};
|
||||
};
|
||||
toBeSynced: any;
|
||||
|
||||
@@ -40,6 +40,7 @@ import { CLICKSTREAM_EVENT_NAMES } from '../../common/Constants';
|
||||
import { addClickstreamEvent } from '../../services/clickstreamEventService';
|
||||
import { getLoanAccountNumber } from '../../components/utlis/commonFunctions';
|
||||
import EmiBreakupBottomSheet from '../emiSchedule/EmiBreakupBottomSheet';
|
||||
import { CollectionCaseWidgetId } from '../../types/template.types';
|
||||
|
||||
interface ICaseDetails {
|
||||
route: {
|
||||
@@ -172,10 +173,13 @@ const CollectionCaseDetails: React.FC<ICaseDetails> = (props) => {
|
||||
);
|
||||
return;
|
||||
}
|
||||
navigateToScreen(getTemplateRoute('cc-w1', CaseAllocationType.COLLECTION_CASE), {
|
||||
caseId: caseId,
|
||||
journey: 'COLLECTION_FEEDBACK',
|
||||
});
|
||||
navigateToScreen(
|
||||
getTemplateRoute(CollectionCaseWidgetId.START, CaseAllocationType.COLLECTION_CASE),
|
||||
{
|
||||
caseId: caseId,
|
||||
journey: 'COLLECTION_FEEDBACK',
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const opacityAnimation = useRef(new Animated.Value(0.8)).current;
|
||||
|
||||
@@ -92,3 +92,26 @@ export interface ValidationRule {
|
||||
rule: string;
|
||||
params: any[];
|
||||
}
|
||||
|
||||
export interface IVisitedWidgetContext {
|
||||
visitedWidgets: Array<string>;
|
||||
widgetContext: {
|
||||
[widgetId: string]: {
|
||||
sectionContext: {
|
||||
[sectionId: string]: {
|
||||
questionContext: {
|
||||
[questionId: string]: { answer: string; type: string };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export enum CommonCaseWidgetId {
|
||||
END = 'SUBMIT',
|
||||
}
|
||||
|
||||
export enum CollectionCaseWidgetId {
|
||||
START = 'cc-w1',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user