diff --git a/src/components/form/RenderQuestion.tsx b/src/components/form/RenderQuestion.tsx index 02d4e4cd..3061c813 100644 --- a/src/components/form/RenderQuestion.tsx +++ b/src/components/form/RenderQuestion.tsx @@ -20,16 +20,12 @@ interface IRenderQuestion { const RenderQuestion: React.FC = (props) => { const { name, questionMap, journeyId, caseId, sectionId, setValue } = props; - const caseType = useAppSelector( - (state) => - state.allCases.caseDetails[caseId]?.caseType || CaseAllocationType.ADDRESS_VERIFICATION_CASE - ); - const template = useAppSelector((state) => state.case.templateData[caseType]); - const questionHashMap = template.questions; + const template = useAppSelector((state) => state.case.templateData[CaseAllocationType.COLLECTION_CASE]); + const questionHashMap = template?.questions; return ( - {questionMap.map((question, index) => { - if (questionHashMap[question as keyof typeof questionHashMap]) { + {questionMap?.map((question, index) => { + if (questionHashMap?.[question as keyof typeof questionHashMap]) { return ( = (props) => { {sections?.[section]?.questions?.map((question: string) => { const answer = - data.widgetContext[visited].sectionContext[section].questionContext[ + data?.widgetContext?.[visited]?.sectionContext?.[section]?.questionContext?.[ question ]; return answer ? ( diff --git a/src/components/form/services/forms.service.ts b/src/components/form/services/forms.service.ts index 13a89209..a7d6d87d 100644 --- a/src/components/form/services/forms.service.ts +++ b/src/components/form/services/forms.service.ts @@ -33,7 +33,8 @@ export const getVisitedWidgetsNodeList = ( export const getNextWidget = (conditionActions: ConditionAction[], context: any): string => { let nextScreenName = ''; - for (const conditionAction of conditionActions) { + const updatedConditionActions = conditionActions || []; + for (const conditionAction of updatedConditionActions) { if ( conditionAction.isDefault || (conditionAction.condition && evaluateCondition(conditionAction.condition, context)) diff --git a/src/components/utlis/deeplinkingUtils.ts b/src/components/utlis/deeplinkingUtils.ts index 07e5187f..1e8e66f5 100644 --- a/src/components/utlis/deeplinkingUtils.ts +++ b/src/components/utlis/deeplinkingUtils.ts @@ -101,7 +101,7 @@ export const linkingConf: LinkingOptions = { return null; } const caseId = message?.notification?.data?.caseId as string; - const reduxState = store.getState(); + const reduxState = store?.getState(); const caseDetails = reduxState?.allCases?.caseDetails?.[caseId]; const notificationId = message?.notification?.data?.notificationId as string; const deepLink = message?.notification?.data?.deepLinks?.[message?.pressAction?.id] as string; diff --git a/src/hooks/useFCM/notificationHelperFunctions.ts b/src/hooks/useFCM/notificationHelperFunctions.ts index d2afb023..bbc6bb29 100644 --- a/src/hooks/useFCM/notificationHelperFunctions.ts +++ b/src/hooks/useFCM/notificationHelperFunctions.ts @@ -454,7 +454,7 @@ const FEEDBACK_FILTER_NAME = 'FEEDBACK'; const FEEDBACK_FILTER_VALUE = 'PROMISE_TO_PAY'; function getFilterSelectionForPtpFilter(filterName: string, filterValue: string) { - const selectedFilters = {...store.getState()?.filters?.selectedFilters || {}}; + const selectedFilters = {...store?.getState()?.filters?.selectedFilters || {}}; if (selectedFilters[filterName]) { selectedFilters[filterName][filterValue] = true; } else { @@ -493,7 +493,7 @@ export const handleNotificationNavigation = ( action: string ) => { const { caseId, notificationId } = data || {}; - const reduxState = store.getState(); + const reduxState = store?.getState(); const phoneNumber = (data?.phoneNumber as string) || ''; const caseDetails = reduxState?.allCases?.caseDetails?.[caseId as string]; const templateName = data?.templateName as string; diff --git a/src/screens/Profile/Navigation/constants.ts b/src/screens/Profile/Navigation/constants.ts index 1fb715e2..10cfbbfa 100644 --- a/src/screens/Profile/Navigation/constants.ts +++ b/src/screens/Profile/Navigation/constants.ts @@ -12,7 +12,7 @@ import { ProfileScreenStackEnum } from '../ProfileStack'; import CountComponent from '../CountComponent'; export const getNavigationLinks = () => { - const { isTeamLead, selectedAgent, featureFlags } = store.getState().user; + const { isTeamLead, selectedAgent, featureFlags } = store?.getState().user; return [ { name: 'Completed cases',