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