prettier fixed brackets
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
arrowParens: 'avoid',
|
||||
bracketSameLine: true,
|
||||
bracketSpacing: false,
|
||||
bracketSpacing: true,
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
tabWidth: 4,
|
||||
|
||||
Submodule RN-UI-LIB updated: 5dd77309f5...7bb6e0edb3
@@ -1,5 +1,8 @@
|
||||
import {IUser, setAuthData} from '../reducer/userSlice';
|
||||
import axiosInstance, {ApiKeys, getApiUrl} from '../components/utlis/apiHelper';
|
||||
import { IUser, setAuthData } from '../reducer/userSlice';
|
||||
import axiosInstance, {
|
||||
ApiKeys,
|
||||
getApiUrl,
|
||||
} from '../components/utlis/apiHelper';
|
||||
import {
|
||||
resetLoginForm,
|
||||
setFormLoading,
|
||||
@@ -8,11 +11,11 @@ import {
|
||||
setVerifyOTPError,
|
||||
setVerifyOTPSuccess,
|
||||
} from '../reducer/loginSlice';
|
||||
import {Dispatch} from '@reduxjs/toolkit';
|
||||
import {navigateToScreen} from '../components/utlis/navigationUtlis';
|
||||
import {AxiosResponse} from 'axios';
|
||||
import {AppDispatch} from '../store/store';
|
||||
import {setGlobalUserData} from '../constants/Global';
|
||||
import { Dispatch } from '@reduxjs/toolkit';
|
||||
import { navigateToScreen } from '../components/utlis/navigationUtlis';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { AppDispatch } from '../store/store';
|
||||
import { setGlobalUserData } from '../constants/Global';
|
||||
import { setCasesListData } from '../reducer/allCasesSlice';
|
||||
import { getAllCaseDetails } from './dataActions';
|
||||
|
||||
@@ -26,12 +29,12 @@ export interface VerifyOTPPayload {
|
||||
}
|
||||
|
||||
export const generateOTP =
|
||||
({phoneNumber}: GenerateOTPPayload, isResendOTP?: boolean) =>
|
||||
({ phoneNumber }: GenerateOTPPayload, isResendOTP?: boolean) =>
|
||||
(dispatch: Dispatch) => {
|
||||
const url = getApiUrl(ApiKeys.GENERATE_OTP);
|
||||
dispatch(setFormLoading(true));
|
||||
axiosInstance
|
||||
.post(url, {phoneNumber: Number(phoneNumber)})
|
||||
.post(url, { phoneNumber: Number(phoneNumber) })
|
||||
.then(response => {
|
||||
if (response.status === 200) {
|
||||
if (response?.data?.data?.otpToken) {
|
||||
@@ -56,18 +59,20 @@ export const generateOTP =
|
||||
};
|
||||
|
||||
export const verifyOTP =
|
||||
({otp, otpToken}: VerifyOTPPayload) =>
|
||||
({ otp, otpToken }: VerifyOTPPayload) =>
|
||||
(dispatch: AppDispatch) => {
|
||||
const url = getApiUrl(ApiKeys.VERIFY_OTP);
|
||||
|
||||
dispatch(setFormLoading(true));
|
||||
axiosInstance
|
||||
.post(url, {otp, otpToken}, {headers: {donotHandleError: true}})
|
||||
.post(
|
||||
url,
|
||||
{ otp, otpToken },
|
||||
{ headers: { donotHandleError: true } },
|
||||
)
|
||||
.then((response: AxiosResponse<IUser>) => {
|
||||
const {sessionDetails, user, cases} = response.data;
|
||||
dispatch(
|
||||
setCasesListData({allCases: cases}),
|
||||
);
|
||||
const { sessionDetails, user, cases } = response.data;
|
||||
dispatch(setCasesListData({ allCases: cases }));
|
||||
dispatch(getAllCaseDetails(cases));
|
||||
dispatch(
|
||||
setAuthData({
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import axiosInstance, {ApiKeys, getApiUrl} from '../components/utlis/apiHelper';
|
||||
import {navigateToScreen} from '../components/utlis/navigationUtlis';
|
||||
import axiosInstance, {
|
||||
ApiKeys,
|
||||
getApiUrl
|
||||
} from '../components/utlis/apiHelper';
|
||||
import { navigateToScreen } from '../components/utlis/navigationUtlis';
|
||||
import {
|
||||
resetTodoList,
|
||||
setCasesDetailsData,
|
||||
@@ -7,18 +10,16 @@ import {
|
||||
setFilters,
|
||||
setLoading,
|
||||
setTodoListOffline,
|
||||
updateSingleCase,
|
||||
updateSingleCase
|
||||
} from '../reducer/allCasesSlice';
|
||||
import {ICaseItem} from '../screens/allCases/interface';
|
||||
import {AppDispatch} from '../store/store';
|
||||
import { ICaseItem } from '../screens/allCases/interface';
|
||||
import { AppDispatch } from '../store/store';
|
||||
|
||||
export const getAllCases = () => (dispatch: AppDispatch) => {
|
||||
const url = getApiUrl(ApiKeys.ALL_CASES);
|
||||
dispatch(setLoading(true));
|
||||
axiosInstance.get(url).then(response => {
|
||||
dispatch(
|
||||
setCasesListData({allCases: response.data}),
|
||||
);
|
||||
dispatch(setCasesListData({ allCases: response.data }));
|
||||
dispatch(getAllCaseDetails(response.data));
|
||||
// dispatch(getFilters());
|
||||
});
|
||||
@@ -26,17 +27,15 @@ export const getAllCases = () => (dispatch: AppDispatch) => {
|
||||
|
||||
export const getAllCaseDetails =
|
||||
(data: Array<ICaseItem>) => (dispatch: AppDispatch) => {
|
||||
console.log("***************", data)
|
||||
console.log('***************', data);
|
||||
const caseList = data.map(caseItem => caseItem?.caseReferenceId);
|
||||
const url = getApiUrl(ApiKeys.CASE_DETAIL);
|
||||
axiosInstance
|
||||
.get(url, {
|
||||
params: {caseIds: caseList.join(',')},
|
||||
params: { caseIds: caseList.join(',') },
|
||||
})
|
||||
.then(response => {
|
||||
dispatch(
|
||||
setCasesDetailsData({details: response.data}),
|
||||
);
|
||||
dispatch(setCasesDetailsData({ details: response.data }));
|
||||
dispatch(resetTodoList());
|
||||
})
|
||||
.catch(err => console.log(err));
|
||||
@@ -47,11 +46,14 @@ export const getSingleCaseDetail =
|
||||
const url = getApiUrl(ApiKeys.CASE_DETAIL);
|
||||
axiosInstance
|
||||
.get(url, {
|
||||
params: {caseIds: data.join(',')},
|
||||
params: { caseIds: data.join(',') },
|
||||
})
|
||||
.then(response => {
|
||||
dispatch(
|
||||
setCasesListData({allCases: data, details: response.data}),
|
||||
setCasesListData({
|
||||
allCases: data,
|
||||
details: response.data,
|
||||
}),
|
||||
);
|
||||
dispatch(resetTodoList());
|
||||
})
|
||||
@@ -63,7 +65,7 @@ export const postPinnedList =
|
||||
(dispatch: AppDispatch) => {
|
||||
dispatch(setTodoListOffline(updatedCaseList));
|
||||
navigateToScreen('Home');
|
||||
console.log(pinnedCases)
|
||||
console.log(pinnedCases);
|
||||
const payload = pinnedCases
|
||||
.map(caseItem => caseItem.caseReferenceId)
|
||||
.join('&pins=');
|
||||
@@ -86,7 +88,7 @@ export const syncCaseDetail = (data: any) => (dispatch: AppDispatch) => {
|
||||
...data,
|
||||
})
|
||||
.then(res => {
|
||||
dispatch(updateSingleCase({data: res.data, id: data.id}))
|
||||
dispatch(updateSingleCase({ data: res.data, id: data.id }));
|
||||
})
|
||||
.catch(err => console.log(err, 'error'));
|
||||
};
|
||||
@@ -95,7 +97,7 @@ export const getFilters = () => (dispatch: AppDispatch) => {
|
||||
const url = getApiUrl(ApiKeys.FILTERS);
|
||||
dispatch(setLoading(true));
|
||||
axiosInstance.get(url).then(response => {
|
||||
console.log("filters" , JSON.stringify(response.data));
|
||||
console.log('filters', JSON.stringify(response.data));
|
||||
dispatch(setFilters(response.data));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -22,5 +22,5 @@ export interface Option {
|
||||
export enum FirestoreUpdateTypes {
|
||||
ADDED = 'added',
|
||||
MODIFIED = 'modified',
|
||||
REMOVED = 'removed'
|
||||
REMOVED = 'removed',
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@ export interface IEvaluateLeaf {
|
||||
}
|
||||
|
||||
export enum Operator {
|
||||
AND = "AND",
|
||||
OR = "OR",
|
||||
MATCHES = "MATCHES"
|
||||
AND = 'AND',
|
||||
OR = 'OR',
|
||||
MATCHES = 'MATCHES',
|
||||
}
|
||||
|
||||
export enum ConditionType {
|
||||
COMPOSITE = "COMPOSITE",
|
||||
LEAF_NODE = "LEAF_NODE"
|
||||
COMPOSITE = 'COMPOSITE',
|
||||
LEAF_NODE = 'LEAF_NODE',
|
||||
}
|
||||
|
||||
export interface IDecision {
|
||||
@@ -51,12 +51,11 @@ export interface ILeaf {
|
||||
widgetId: string;
|
||||
}
|
||||
|
||||
|
||||
export enum AnswerType {
|
||||
text = 'text',
|
||||
option = 'option',
|
||||
number = 'number',
|
||||
array = 'array'
|
||||
array = 'array',
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import axios from 'axios';
|
||||
import {Dispatch} from '@reduxjs/toolkit';
|
||||
import {setAuthData} from '../../reducer/userSlice';
|
||||
import {toast} from '../../../RN-UI-LIB/src/components/toast';
|
||||
import {navigateToScreen} from './navigationUtlis';
|
||||
import {GLOBAL} from '../../constants/Global';
|
||||
import {_map} from '../../../RN-UI-LIB/src/utlis/common';
|
||||
import {BASE_AV_APP_URL} from '../../constants/config';
|
||||
import { Dispatch } from '@reduxjs/toolkit';
|
||||
import { setAuthData } from '../../reducer/userSlice';
|
||||
import { toast } from '../../../RN-UI-LIB/src/components/toast';
|
||||
import { navigateToScreen } from './navigationUtlis';
|
||||
import { GLOBAL } from '../../constants/Global';
|
||||
import { _map } from '../../../RN-UI-LIB/src/utlis/common';
|
||||
import { BASE_AV_APP_URL } from '../../constants/config';
|
||||
|
||||
const MOCK_DIR = '__mocks__';
|
||||
|
||||
@@ -21,7 +21,7 @@ export enum ApiKeys {
|
||||
PINNED_CASES,
|
||||
LOGOUT,
|
||||
FEEDBACK,
|
||||
FILTERS
|
||||
FILTERS,
|
||||
}
|
||||
|
||||
const API_URLS: Record<ApiKeys, string> = {} as Record<ApiKeys, string>;
|
||||
@@ -114,7 +114,7 @@ axiosInstance.interceptors.response.use(
|
||||
return response;
|
||||
},
|
||||
error => {
|
||||
const {config, response} = error;
|
||||
const { config, response } = error;
|
||||
if (
|
||||
!config ||
|
||||
config.retry <= 1 ||
|
||||
@@ -122,7 +122,7 @@ axiosInstance.interceptors.response.use(
|
||||
) {
|
||||
const errorString = getErrorMessage(error);
|
||||
if (!config.headers.donotHandleError) {
|
||||
toast({type: 'error', text1: JSON.stringify(errorString)});
|
||||
toast({ type: 'error', text1: JSON.stringify(errorString) });
|
||||
}
|
||||
|
||||
if (response.status === 401) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export const decideLoadingState = (textData: string):boolean => {
|
||||
if(!textData){
|
||||
export const decideLoadingState = (textData: string): boolean => {
|
||||
if (!textData) {
|
||||
return true;
|
||||
}
|
||||
if(textData.includes('NaN') || textData.includes('undefined')){
|
||||
return true
|
||||
if (textData.includes('NaN') || textData.includes('undefined')) {
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -5,24 +5,24 @@ export const navigationRef: RefObject<any> = React.createRef();
|
||||
|
||||
// if screen already exists then navigate to it otherwise push screen
|
||||
export const navigateToScreen = (name: string, params: object = {}) => {
|
||||
if(navigationRef.current?.getCurrentRoute()?.name === name) {
|
||||
if (navigationRef.current?.getCurrentRoute()?.name === name) {
|
||||
return;
|
||||
}
|
||||
navigationRef.current?.navigate(name, params);
|
||||
}
|
||||
};
|
||||
|
||||
// push a new screen on top of stack
|
||||
export const pushToScreen = (name: string, params: object = {}) => {
|
||||
navigationRef.current?.dispatch(StackActions.push(name, params));
|
||||
}
|
||||
};
|
||||
|
||||
export const popToScreen = (count: number) => {
|
||||
navigationRef.current?.dispatch(StackActions.pop(count));
|
||||
}
|
||||
};
|
||||
|
||||
export const goBack = () => {
|
||||
navigationRef.current?.goBack();
|
||||
}
|
||||
};
|
||||
|
||||
export const resetNavigation = (params: {
|
||||
routes: Array<{
|
||||
@@ -31,4 +31,4 @@ export const resetNavigation = (params: {
|
||||
index: number | undefined;
|
||||
}) => {
|
||||
navigationRef.current?.reset(params);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
export const getObjectValueFromKeys: (obj: Record<string, any> , keysArray: Array<string>) => any = (obj , keysArray) => {
|
||||
|
||||
if (keysArray.length && obj[keysArray[0]]){
|
||||
export const getObjectValueFromKeys: (
|
||||
obj: Record<string, any>,
|
||||
keysArray: Array<string>,
|
||||
) => any = (obj, keysArray) => {
|
||||
if (keysArray.length && obj[keysArray[0]]) {
|
||||
return getObjectValueFromKeys(obj[keysArray[0]], keysArray.slice(1));
|
||||
}else if (obj){
|
||||
} else if (obj) {
|
||||
console.log(obj);
|
||||
return obj
|
||||
return obj;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {TypedUseSelectorHook, useDispatch, useSelector} from 'react-redux';
|
||||
import type {RootState, AppDispatch} from '../store/store';
|
||||
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
|
||||
import type { RootState, AppDispatch } from '../store/store';
|
||||
|
||||
// Use throughout your app instead of plain `useDispatch` and `useSelector`
|
||||
export const useAppDispatch: () => AppDispatch = useDispatch;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import React, {useEffect} from 'react';
|
||||
import {FirebaseFirestoreTypes} from '@react-native-firebase/firestore';
|
||||
import {RootState} from '../store/store';
|
||||
import React, { useEffect } from 'react';
|
||||
import { FirebaseFirestoreTypes } from '@react-native-firebase/firestore';
|
||||
import { RootState } from '../store/store';
|
||||
import firestore from '@react-native-firebase/firestore';
|
||||
import {useAppDispatch, useAppSelector} from '.';
|
||||
import {updateCaseDetailsFirestore} from '../reducer/allCasesSlice';
|
||||
import {CaseDetail} from '../screens/caseDetails/interface';
|
||||
import {FirestoreUpdateTypes} from '../common/Constants';
|
||||
import {toast} from '../../RN-UI-LIB/src/components/toast';
|
||||
import { useAppDispatch, useAppSelector } from '.';
|
||||
import { updateCaseDetailsFirestore } from '../reducer/allCasesSlice';
|
||||
import { CaseDetail } from '../screens/caseDetails/interface';
|
||||
import { FirestoreUpdateTypes } from '../common/Constants';
|
||||
import { toast } from '../../RN-UI-LIB/src/components/toast';
|
||||
|
||||
export interface CaseUpdates {
|
||||
updateType: string;
|
||||
@@ -16,7 +16,7 @@ export interface CaseUpdates {
|
||||
const useFirestoreUpdates = () => {
|
||||
const reduxStoreData = useAppSelector((state: RootState) => state);
|
||||
const {
|
||||
user: {user, isLoggedIn},
|
||||
user: { user, isLoggedIn },
|
||||
} = reduxStoreData;
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
@@ -41,7 +41,7 @@ const useFirestoreUpdates = () => {
|
||||
if (updateType === FirestoreUpdateTypes.ADDED) {
|
||||
newlyAddedCases++;
|
||||
}
|
||||
caseUpdates.push({updateType, updatedCaseDetail});
|
||||
caseUpdates.push({ updateType, updatedCaseDetail });
|
||||
},
|
||||
);
|
||||
// dispatch(updateCaseDetailsFirestore({}));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {createSlice} from '@reduxjs/toolkit';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { _map } from '../../RN-UI-LIB/src/utlis/common';
|
||||
import {ApiKeys} from '../components/utlis/apiHelper'
|
||||
import { ApiKeys } from '../components/utlis/apiHelper';
|
||||
|
||||
enum Api {
|
||||
FEEDBACK = ApiKeys.FEEDBACK
|
||||
FEEDBACK = ApiKeys.FEEDBACK,
|
||||
}
|
||||
|
||||
interface IQueue {
|
||||
@@ -12,11 +12,11 @@ interface IQueue {
|
||||
version: Api;
|
||||
api: string;
|
||||
data: any;
|
||||
}>
|
||||
}>;
|
||||
}
|
||||
|
||||
const initialState = {
|
||||
data: []
|
||||
data: [],
|
||||
} as IQueue;
|
||||
|
||||
const QueueSlice = createSlice({
|
||||
@@ -24,14 +24,12 @@ const QueueSlice = createSlice({
|
||||
initialState,
|
||||
reducers: {
|
||||
addToQueue: (state, action) => {
|
||||
const {version, api, data, id} = action.payload;
|
||||
state.data.push({version, api, data, id})
|
||||
const { version, api, data, id } = action.payload;
|
||||
state.data.push({ version, api, data, id });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {
|
||||
|
||||
} = QueueSlice.actions;
|
||||
export const {} = QueueSlice.actions;
|
||||
|
||||
export default QueueSlice.reducer;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import {Search} from '../../RN-UI-LIB/src/utlis/search';
|
||||
import {createSlice} from '@reduxjs/toolkit';
|
||||
import {navigateToScreen} from '../components/utlis/navigationUtlis';
|
||||
import {CurrentTask, ICaseItem, IFilter} from '../screens/allCases/interface';
|
||||
import { Search } from '../../RN-UI-LIB/src/utlis/search';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { navigateToScreen } from '../components/utlis/navigationUtlis';
|
||||
import { CurrentTask, ICaseItem, IFilter } from '../screens/allCases/interface';
|
||||
import {
|
||||
CONDITIONAL_OPERATORS,
|
||||
FILTER_TYPES,
|
||||
FirestoreUpdateTypes,
|
||||
SELECTION_TYPES,
|
||||
} from '../common/Constants';
|
||||
import {CaseDetail} from '../screens/caseDetails/interface';
|
||||
import {toast} from '../../RN-UI-LIB/src/components/toast';
|
||||
import {CaseUpdates} from '../hooks/useFirestoreUpdates';
|
||||
import { CaseDetail } from '../screens/caseDetails/interface';
|
||||
import { toast } from '../../RN-UI-LIB/src/components/toast';
|
||||
import { CaseUpdates } from '../hooks/useFirestoreUpdates';
|
||||
|
||||
export type ICasesMap = {[key: string]: ICaseItem};
|
||||
export type ICasesMap = { [key: string]: ICaseItem };
|
||||
|
||||
interface IAllCasesSlice {
|
||||
casesList: ICaseItem[];
|
||||
@@ -138,7 +138,7 @@ const getPinnedListDetails = (casesList: ICaseItem[]) => {
|
||||
let maxPinnedRank = 0;
|
||||
const pinnedList: ICaseItem[] = [];
|
||||
casesList.forEach(caseItem => {
|
||||
const {pinRank} = caseItem;
|
||||
const { pinRank } = caseItem;
|
||||
if (pinRank === null || pinRank === undefined) {
|
||||
return;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ const getPinnedListDetails = (casesList: ICaseItem[]) => {
|
||||
maxPinnedRank = pinRank;
|
||||
}
|
||||
});
|
||||
return {pinnedList, maxPinnedRank};
|
||||
return { pinnedList, maxPinnedRank };
|
||||
};
|
||||
|
||||
const allCasesSlice = createSlice({
|
||||
@@ -158,16 +158,16 @@ const allCasesSlice = createSlice({
|
||||
state.loading = action.payload;
|
||||
},
|
||||
setCasesListData: (state, action) => {
|
||||
const {allCases} = action.payload;
|
||||
const { allCases } = action.payload;
|
||||
// TODO add type
|
||||
const listData: Array<any> = [];
|
||||
if (allCases?.length) {
|
||||
const initialValue = {...state.caseDetails};
|
||||
const initialValue = { ...state.caseDetails };
|
||||
const detailsData = allCases.reduce((prev: any, item: any) => {
|
||||
listData.push({
|
||||
caseReferenceId: item.caseReferenceId,
|
||||
pinRank: item.pinRank
|
||||
})
|
||||
pinRank: item.pinRank,
|
||||
});
|
||||
prev[item.caseReferenceId] = {
|
||||
...item,
|
||||
isSynced: true,
|
||||
@@ -177,32 +177,38 @@ const allCasesSlice = createSlice({
|
||||
state.caseDetails = detailsData;
|
||||
state.casesList = listData;
|
||||
}
|
||||
const {pinnedList, maxPinnedRank} = getPinnedListDetails(allCases);
|
||||
const { pinnedList, maxPinnedRank } =
|
||||
getPinnedListDetails(allCases);
|
||||
state.pinnedList = pinnedList;
|
||||
state.pinnedRankCount = maxPinnedRank;
|
||||
state.loading = false;
|
||||
},
|
||||
setCasesDetailsData: (state, action) => {
|
||||
const {details} = action.payload;
|
||||
const { details } = action.payload;
|
||||
if (details?.length) {
|
||||
details.forEach((caseDetail: CaseDetail) => {
|
||||
const {id} = caseDetail;
|
||||
const currentTask = caseDetail.tasks.find(task => task.taskType === caseDetail.currentTask as string)|| {} as CurrentTask;
|
||||
const { id } = caseDetail;
|
||||
const currentTask =
|
||||
caseDetail.tasks.find(
|
||||
task =>
|
||||
task.taskType ===
|
||||
(caseDetail.currentTask as string),
|
||||
) || ({} as CurrentTask);
|
||||
state.caseDetails[id] = {
|
||||
...state.caseDetails[id],
|
||||
...caseDetail,
|
||||
isSynced: true,
|
||||
currentTask
|
||||
currentTask,
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
updateCaseDetailsFirestore: (state, action) => {
|
||||
const {caseUpdates} = action.payload as {
|
||||
const { caseUpdates } = action.payload as {
|
||||
caseUpdates: CaseUpdates[];
|
||||
};
|
||||
console.table('firestore case updates', caseUpdates);
|
||||
caseUpdates.forEach(({updateType, updatedCaseDetail}) => {
|
||||
caseUpdates.forEach(({ updateType, updatedCaseDetail }) => {
|
||||
const {
|
||||
updatedAt,
|
||||
allocatedAt,
|
||||
@@ -242,7 +248,7 @@ const allCasesSlice = createSlice({
|
||||
};
|
||||
state.casesList.push(caseListItem);
|
||||
state.caseDetails[id] = updatedCaseDetail;
|
||||
toast({type: 'success', text1: ''});
|
||||
toast({ type: 'success', text1: '' });
|
||||
break;
|
||||
}
|
||||
case FirestoreUpdateTypes.REMOVED: {
|
||||
@@ -261,13 +267,15 @@ const allCasesSlice = createSlice({
|
||||
});
|
||||
},
|
||||
updateCaseDetail: (state, action) => {
|
||||
const {caseId, journeyId, answer, caseData, nextActions} =
|
||||
const { caseId, journeyId, answer, caseData, nextActions } =
|
||||
action.payload;
|
||||
console.log(action.payload, caseData, 'payload');
|
||||
const updatedValue = {...caseData};
|
||||
const updatedValue = { ...caseData };
|
||||
updatedValue.isSynced = false;
|
||||
if (!updatedValue.context || updatedValue.context === null) {
|
||||
updatedValue.currentTask = updatedValue.tasks.find(task => task.taskType === nextActions.nextJourney);
|
||||
updatedValue.currentTask = updatedValue.tasks.find(
|
||||
task => task.taskType === nextActions.nextJourney,
|
||||
);
|
||||
updatedValue.context = {
|
||||
currentTask: nextActions.nextJourney,
|
||||
taskContext: {
|
||||
@@ -280,7 +288,9 @@ const allCasesSlice = createSlice({
|
||||
},
|
||||
};
|
||||
} else if (updatedValue.context.taskContext?.[journeyId]) {
|
||||
updatedValue.currentTask = updatedValue.tasks.find(task => task.taskType === nextActions.nextJourney);;
|
||||
updatedValue.currentTask = updatedValue.tasks.find(
|
||||
task => task.taskType === nextActions.nextJourney,
|
||||
);
|
||||
const journey = [
|
||||
...updatedValue.context.taskContext?.[journeyId],
|
||||
{
|
||||
@@ -295,9 +305,11 @@ const allCasesSlice = createSlice({
|
||||
},
|
||||
};
|
||||
} else {
|
||||
const context = {...updatedValue.context};
|
||||
const taskContext = {...context.taskContext};
|
||||
updatedValue.currentTask = updatedValue.tasks.find(task => task.taskType === nextActions.nextJourney);
|
||||
const context = { ...updatedValue.context };
|
||||
const taskContext = { ...context.taskContext };
|
||||
updatedValue.currentTask = updatedValue.tasks.find(
|
||||
task => task.taskType === nextActions.nextJourney,
|
||||
);
|
||||
(taskContext[journeyId] = [
|
||||
{
|
||||
taskStatus: nextActions.status,
|
||||
@@ -324,7 +336,7 @@ const allCasesSlice = createSlice({
|
||||
} else {
|
||||
state.pinnedRankCount++;
|
||||
state.newlyPinnedCases++;
|
||||
const selectedCase = {...action.payload};
|
||||
const selectedCase = { ...action.payload };
|
||||
selectedCase.pinRank = state.pinnedRankCount;
|
||||
state.intermediateTodoListMap[caseId] = selectedCase;
|
||||
}
|
||||
@@ -336,7 +348,7 @@ const allCasesSlice = createSlice({
|
||||
navigateToScreen('TodoList');
|
||||
},
|
||||
deleteIntermediateTodoListItem: (state, action) => {
|
||||
const {caseReferenceId} = action.payload;
|
||||
const { caseReferenceId } = action.payload;
|
||||
if (!caseReferenceId) {
|
||||
return;
|
||||
}
|
||||
@@ -350,7 +362,9 @@ const allCasesSlice = createSlice({
|
||||
console.log(action.payload, state.casesList);
|
||||
|
||||
console.log(
|
||||
Search(action.payload, state.casesList, {key: ['caseVerdict']}),
|
||||
Search(action.payload, state.casesList, {
|
||||
key: ['caseVerdict'],
|
||||
}),
|
||||
);
|
||||
},
|
||||
resetTodoList: state => {
|
||||
@@ -372,7 +386,7 @@ const allCasesSlice = createSlice({
|
||||
state.selectedTodoListCount--;
|
||||
} else {
|
||||
state.selectedTodoListCount++;
|
||||
const selectedCase = {...action.payload};
|
||||
const selectedCase = { ...action.payload };
|
||||
state.selectedTodoListMap[caseId] = selectedCase;
|
||||
}
|
||||
},
|
||||
@@ -381,14 +395,16 @@ const allCasesSlice = createSlice({
|
||||
state.selectedTodoListMap = {};
|
||||
},
|
||||
updateSingleCase: (state, action) => {
|
||||
const {data, id} = action.payload;
|
||||
const { data, id } = action.payload;
|
||||
console.log(data);
|
||||
|
||||
if (data) {
|
||||
console.log('is side data found');
|
||||
state.caseDetails[id] = {
|
||||
...data,
|
||||
currentTask : data.tasks.find(task => task.taskType === data.currentTask),
|
||||
currentTask: data.tasks.find(
|
||||
task => task.taskType === data.currentTask,
|
||||
),
|
||||
isSynced: true,
|
||||
};
|
||||
} else {
|
||||
@@ -397,7 +413,7 @@ const allCasesSlice = createSlice({
|
||||
}
|
||||
},
|
||||
setFilters: (state, action) => {
|
||||
state.filters = {...state.filters, ...action.payload};
|
||||
state.filters = { ...state.filters, ...action.payload };
|
||||
},
|
||||
setSelectedFilters: (state, action) => {
|
||||
state.selectedFilters = {
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
import {createSlice} from '@reduxjs/toolkit';
|
||||
import {Data} from '../screens/allCases/interface';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { Data } from '../screens/allCases/interface';
|
||||
|
||||
interface ICaseReducer {
|
||||
|
||||
value: number;
|
||||
caseForm: {
|
||||
[caseId: string]: {
|
||||
[journeyId: string]: {
|
||||
"widgetContext":{
|
||||
widgetContext: {
|
||||
[widgetId: string]: {
|
||||
"sectionContext":{
|
||||
sectionContext: {
|
||||
[sectionId: string]: {
|
||||
"questionContext":{
|
||||
questionContext: {
|
||||
[questionId: string]: string;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -138,14 +137,12 @@ const initialState = {
|
||||
taskSequence: ['COMMUNICATION', 'PERMANENT', 'GEOLOCATION'],
|
||||
currentTask: 'GEOLOCATION',
|
||||
tasks: {
|
||||
COMMUNICATION: [
|
||||
],
|
||||
PERMANENT: [
|
||||
],
|
||||
COMMUNICATION: [],
|
||||
PERMANENT: [],
|
||||
GEOLOCATION: [],
|
||||
},
|
||||
},
|
||||
templateData: {}
|
||||
templateData: {},
|
||||
} as ICaseReducer;
|
||||
|
||||
export const caseSlice = createSlice({
|
||||
@@ -159,7 +156,7 @@ export const caseSlice = createSlice({
|
||||
state.value--;
|
||||
},
|
||||
updateInteraction: (state, action) => {
|
||||
const {caseId, journeyId, widgetId, answer} = action.payload;
|
||||
const { caseId, journeyId, widgetId, answer } = action.payload;
|
||||
const data = state.caseForm || {};
|
||||
if (!data[caseId]) {
|
||||
data[caseId] = {};
|
||||
@@ -173,15 +170,15 @@ export const caseSlice = createSlice({
|
||||
state.caseForm = data;
|
||||
},
|
||||
deleteInteraction: (state, action) => {
|
||||
const {caseId, journeyId, widgetId, answer} = action.payload;
|
||||
console.log({caseId, journeyId, widgetId, answer})
|
||||
const { caseId, journeyId, widgetId, answer } = action.payload;
|
||||
console.log({ caseId, journeyId, widgetId, answer });
|
||||
const data = state.caseForm;
|
||||
delete data[caseId][journeyId].widgetContext[widgetId];
|
||||
state.caseForm = data;
|
||||
},
|
||||
deleteJourney: (state, action) => {
|
||||
const {caseId, journeyId, widgetId, answer} = action.payload;
|
||||
console.log({caseId, journeyId, widgetId, answer})
|
||||
const { caseId, journeyId, widgetId, answer } = action.payload;
|
||||
console.log({ caseId, journeyId, widgetId, answer });
|
||||
const data = state.caseForm;
|
||||
delete data[caseId][journeyId];
|
||||
state.caseForm = data;
|
||||
@@ -193,13 +190,20 @@ export const caseSlice = createSlice({
|
||||
state.allCases = action.payload;
|
||||
},
|
||||
updateDate: (state, action) => {
|
||||
const {date} = action.payload;
|
||||
const { date } = action.payload;
|
||||
state.loanInfo.allocationDate = date;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {increaseByOne, decreaseByOne, updateInteraction, setAllCases, deleteInteraction, updateTemplateData, deleteJourney} =
|
||||
caseSlice.actions;
|
||||
export const {
|
||||
increaseByOne,
|
||||
decreaseByOne,
|
||||
updateInteraction,
|
||||
setAllCases,
|
||||
deleteInteraction,
|
||||
updateTemplateData,
|
||||
deleteJourney,
|
||||
} = caseSlice.actions;
|
||||
|
||||
export default caseSlice.reducer;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {createSlice} from '@reduxjs/toolkit';
|
||||
import {GLOBAL, setGlobalUserData} from '../constants/Global';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { GLOBAL, setGlobalUserData } from '../constants/Global';
|
||||
|
||||
export interface User {
|
||||
isLoggedIn: boolean;
|
||||
@@ -25,7 +25,7 @@ export const commonSlice = createSlice({
|
||||
reducers: {
|
||||
setAuthData: (state, action) => {
|
||||
if (action.payload) {
|
||||
state.userData = {...state.userData, ...action.payload};
|
||||
state.userData = { ...state.userData, ...action.payload };
|
||||
setGlobalUserData(
|
||||
state.userData.sessionToken,
|
||||
state.userData.deviceId,
|
||||
@@ -35,6 +35,6 @@ export const commonSlice = createSlice({
|
||||
},
|
||||
});
|
||||
|
||||
export const {setAuthData} = commonSlice.actions;
|
||||
export const { setAuthData } = commonSlice.actions;
|
||||
|
||||
export default commonSlice.reducer;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {createSlice} from '@reduxjs/toolkit';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
export const formReducer = createSlice({
|
||||
name: 'formData',
|
||||
@@ -12,6 +12,6 @@ export const formReducer = createSlice({
|
||||
},
|
||||
});
|
||||
|
||||
export const {decreaseByOne} = formReducer.actions;
|
||||
export const { decreaseByOne } = formReducer.actions;
|
||||
|
||||
export default formReducer.reducer;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {combineReducers} from 'redux';
|
||||
import { combineReducers } from 'redux';
|
||||
import loginSlice from './loginSlice';
|
||||
import caseReducer from './caseReducre';
|
||||
import formReducer from './formData';
|
||||
@@ -8,7 +8,7 @@ const rootReducer = combineReducers({
|
||||
caseDetail: caseReducer,
|
||||
formData: formReducer,
|
||||
loginInfo: loginSlice,
|
||||
queue: QueueSlice
|
||||
queue: QueueSlice,
|
||||
});
|
||||
|
||||
export default rootReducer;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {createSlice} from '@reduxjs/toolkit';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = {
|
||||
phoneNumber: '',
|
||||
@@ -14,7 +14,7 @@ const loginSlice = createSlice({
|
||||
initialState,
|
||||
reducers: {
|
||||
setShowOTPScreen: (state, action) => {
|
||||
const {phoneNumber, otpToken} = action.payload;
|
||||
const { phoneNumber, otpToken } = action.payload;
|
||||
state.phoneNumber = phoneNumber || state.phoneNumber;
|
||||
state.otpToken = otpToken;
|
||||
state.isLoading = false;
|
||||
@@ -38,7 +38,7 @@ const loginSlice = createSlice({
|
||||
state.isLoading = action.payload;
|
||||
},
|
||||
resetLoginForm: state => {
|
||||
state = {...initialState}
|
||||
state = { ...initialState };
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -49,7 +49,7 @@ export const {
|
||||
setVerifyOTPSuccess,
|
||||
setShowOTPScreen,
|
||||
setFormLoading,
|
||||
resetLoginForm
|
||||
resetLoginForm,
|
||||
} = loginSlice.actions;
|
||||
|
||||
export default loginSlice.reducer;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {createSlice} from '@reduxjs/toolkit';
|
||||
import {setGlobalUserData} from '../constants/Global';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { setGlobalUserData } from '../constants/Global';
|
||||
|
||||
interface ISessionDetails {
|
||||
sessionToken: string;
|
||||
@@ -40,7 +40,7 @@ export const userSlice = createSlice({
|
||||
initialState,
|
||||
reducers: {
|
||||
setAuthData: (state, action) => {
|
||||
const {user, sessionDetails, isLoggedIn} = action.payload;
|
||||
const { user, sessionDetails, isLoggedIn } = action.payload;
|
||||
state.user = user;
|
||||
state.sessionDetails = sessionDetails;
|
||||
state.isLoggedIn = isLoggedIn;
|
||||
@@ -53,6 +53,6 @@ export const userSlice = createSlice({
|
||||
},
|
||||
});
|
||||
|
||||
export const {setAuthData, setDeviceId} = userSlice.actions;
|
||||
export const { setAuthData, setDeviceId } = userSlice.actions;
|
||||
|
||||
export default userSlice.reducer;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {CaseTypes} from './interface';
|
||||
import { CaseTypes } from './interface';
|
||||
|
||||
export const COMPLETED_STATUSES = ['CLOSED', 'EXPIRED', 'FORCED_CLOSE'];
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import {COLORS} from '../../../RN-UI-LIB/src/styles/colors';
|
||||
import {CONDITIONAL_OPERATORS, FILTER_TYPES, Option, SELECTION_TYPES} from "../../common/Constants";
|
||||
import { COLORS } from '../../../RN-UI-LIB/src/styles/colors';
|
||||
import {
|
||||
CONDITIONAL_OPERATORS,
|
||||
FILTER_TYPES,
|
||||
Option,
|
||||
SELECTION_TYPES,
|
||||
} from '../../common/Constants';
|
||||
import { CustomerInfo } from '../caseDetails/interface';
|
||||
|
||||
export enum CaseTypes {
|
||||
@@ -7,27 +12,27 @@ export enum CaseTypes {
|
||||
CASES_HEADER,
|
||||
FILTER,
|
||||
TODO,
|
||||
CASE
|
||||
CASE,
|
||||
}
|
||||
|
||||
export enum caseVerdict {
|
||||
NOT_VERIFIED = "NOT_VERIFIED",
|
||||
VERIFIED = "VERIFIED",
|
||||
NAFS = "NAFS",
|
||||
NAFNS = "NAFNS",
|
||||
NORMAL = "NORMAL",
|
||||
ON_HOLD = "ON_HOLD",
|
||||
EXHAUSTED = "EXHAUSTED"
|
||||
NOT_VERIFIED = 'NOT_VERIFIED',
|
||||
VERIFIED = 'VERIFIED',
|
||||
NAFS = 'NAFS',
|
||||
NAFNS = 'NAFNS',
|
||||
NORMAL = 'NORMAL',
|
||||
ON_HOLD = 'ON_HOLD',
|
||||
EXHAUSTED = 'EXHAUSTED',
|
||||
}
|
||||
|
||||
export enum caseVerdictUIMappings {
|
||||
NOT_VERIFIED = "not verified",
|
||||
VERIFIED = "verified",
|
||||
NAFS = "New address found",
|
||||
NAFNS = "New address found non serviceable",
|
||||
NORMAL = "normal",
|
||||
ON_HOLD = "On hold",
|
||||
EXHAUSTED = "Exhausted"
|
||||
NOT_VERIFIED = 'not verified',
|
||||
VERIFIED = 'verified',
|
||||
NAFS = 'New address found',
|
||||
NAFNS = 'New address found non serviceable',
|
||||
NORMAL = 'normal',
|
||||
ON_HOLD = 'On hold',
|
||||
EXHAUSTED = 'Exhausted',
|
||||
}
|
||||
|
||||
export enum taskStatus {
|
||||
@@ -48,7 +53,6 @@ export enum CaseStatuses {
|
||||
EXPIRED = 'EXPIRED',
|
||||
}
|
||||
|
||||
|
||||
export enum CaseStatusUIMapping {
|
||||
NEW = 'New',
|
||||
UNASSIGNED = 'Unassigned',
|
||||
@@ -90,7 +94,6 @@ export interface ICaseItem {
|
||||
currentTask: CurrentTask;
|
||||
}
|
||||
|
||||
|
||||
// export interface CustomerInfo {
|
||||
// name: string;
|
||||
// imageURL: string;
|
||||
@@ -130,11 +133,11 @@ export interface CurrentTask {
|
||||
}
|
||||
|
||||
export enum TaskTitleUIMapping {
|
||||
COMMUNICATION_ADDRESS_VERIFICATION_TASK = "Communication Address",
|
||||
PERMANENT_ADDRESS_VERIFICATION_TASK = "Permanent Address",
|
||||
GEO_LOCATION_VERIFICATION_TASK = "Geolocation",
|
||||
CALLING_TASK = "Calling",
|
||||
NEW_ADDRESS_VERIFICATION_TASK = "New Address"
|
||||
COMMUNICATION_ADDRESS_VERIFICATION_TASK = 'Communication Address',
|
||||
PERMANENT_ADDRESS_VERIFICATION_TASK = 'Permanent Address',
|
||||
GEO_LOCATION_VERIFICATION_TASK = 'Geolocation',
|
||||
CALLING_TASK = 'Calling',
|
||||
NEW_ADDRESS_VERIFICATION_TASK = 'New Address',
|
||||
}
|
||||
|
||||
export enum TaskTitle {
|
||||
@@ -142,20 +145,20 @@ export enum TaskTitle {
|
||||
PERMANENT_ADDRESS_VERIFICATION_TASK = 'PERMANENT_ADDRESS_VERIFICATION_TASK',
|
||||
GEO_LOCATION_VERIFICATION_TASK = 'GEO_LOCATION_VERIFICATION_TASK',
|
||||
CALLING_TASK = 'CALLING_TASK',
|
||||
NEW_ADDRESS_VERIFICATION_TASK = 'NEW_ADDRESS_VERIFICATION_TASK'
|
||||
NEW_ADDRESS_VERIFICATION_TASK = 'NEW_ADDRESS_VERIFICATION_TASK',
|
||||
}
|
||||
|
||||
export enum ClassType {
|
||||
'.AddressEntityMetadata',
|
||||
'.GeoLocationEntityMetadata',
|
||||
'.CallingEntityMetadata'
|
||||
'.CallingEntityMetadata',
|
||||
}
|
||||
|
||||
export interface IFilter {
|
||||
filterType: FILTER_TYPES,
|
||||
displayText: string,
|
||||
selectionType: SELECTION_TYPES,
|
||||
fieldToCompare: string,
|
||||
operator: CONDITIONAL_OPERATORS,
|
||||
options?: Option[],
|
||||
filterType: FILTER_TYPES;
|
||||
displayText: string;
|
||||
selectionType: SELECTION_TYPES;
|
||||
fieldToCompare: string;
|
||||
operator: CONDITIONAL_OPERATORS;
|
||||
options?: Option[];
|
||||
}
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
import {CaseStatusUIMapping, CurrentTask, TaskTitle} from "../allCases/interface";
|
||||
import {
|
||||
CaseStatusUIMapping,
|
||||
CurrentTask,
|
||||
TaskTitle,
|
||||
} from '../allCases/interface';
|
||||
|
||||
export enum LoanType {
|
||||
PERSONAL_LOAN = "PERSONAL_LOAN",
|
||||
HOUSE_LOAN = "HOUSE_LOAN"
|
||||
PERSONAL_LOAN = 'PERSONAL_LOAN',
|
||||
HOUSE_LOAN = 'HOUSE_LOAN',
|
||||
}
|
||||
|
||||
export enum LoanAccountStatus {
|
||||
ACTIVE = "ACTIVE",
|
||||
CLOSE = "CLOSE"
|
||||
ACTIVE = 'ACTIVE',
|
||||
CLOSE = 'CLOSE',
|
||||
}
|
||||
|
||||
export enum LoanAccountStatusUIMapping {
|
||||
ACTIVE = "Active",
|
||||
CLOSE = "Close"
|
||||
ACTIVE = 'Active',
|
||||
CLOSE = 'Close',
|
||||
}
|
||||
|
||||
export enum LoanTypeUIMapping {
|
||||
PERSONAL_LOAN = 'Personal loan',
|
||||
HOUSE_LOAN = 'House loan'
|
||||
HOUSE_LOAN = 'House loan',
|
||||
}
|
||||
|
||||
export enum CONTEXT_TASK_STATUSES {
|
||||
@@ -49,7 +53,7 @@ export interface CustomerInfo {
|
||||
primaryPhoneNumber: string;
|
||||
imageURL: string;
|
||||
geoLocation: string;
|
||||
name:string
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Address {
|
||||
@@ -114,7 +118,7 @@ export interface COMMUNICATIONADDRESSVERIFICATIONTASK {
|
||||
}
|
||||
|
||||
export interface TaskContext {
|
||||
[id: string] :any
|
||||
[id: string]: any;
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
@@ -136,4 +140,3 @@ export interface CaseDetail {
|
||||
isSynced: boolean;
|
||||
currentTask: CurrentTask;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {configureStore, getDefaultMiddleware} from '@reduxjs/toolkit';
|
||||
import {combineReducers} from 'redux';
|
||||
import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
|
||||
import { combineReducers } from 'redux';
|
||||
import {
|
||||
FLUSH,
|
||||
PAUSE,
|
||||
@@ -23,7 +23,7 @@ const rootReducer = combineReducers({
|
||||
loginInfo: loginSlice,
|
||||
allCases: allCasesSlice,
|
||||
user: userSlice,
|
||||
queue: QueueSlice
|
||||
queue: QueueSlice,
|
||||
});
|
||||
|
||||
const persistConfig = {
|
||||
|
||||
Reference in New Issue
Block a user