chore: bump uuid version on UI side
fix: add custom info requests to customer list status check
This commit is contained in:
parent
81d74eb40b
commit
2a3e954484
5 changed files with 60 additions and 25 deletions
6
new-lamassu-admin/package-lock.json
generated
6
new-lamassu-admin/package-lock.json
generated
|
|
@ -27467,9 +27467,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
|
||||
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg=="
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.2.0",
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
"react-virtualized": "^9.21.2",
|
||||
"sanctuary": "^2.0.1",
|
||||
"ua-parser-js": "^1.0.2",
|
||||
"uuid": "^7.0.2",
|
||||
"uuid": "^8.3.2",
|
||||
"yup": "0.32.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -57,6 +57,22 @@ const GET_CUSTOMERS = gql`
|
|||
sanctionsOverride
|
||||
daysSuspended
|
||||
isSuspended
|
||||
customInfoRequests {
|
||||
customerId
|
||||
infoRequestId
|
||||
override
|
||||
overrideAt
|
||||
overrideBy
|
||||
customerData
|
||||
customInfoRequest {
|
||||
id
|
||||
enabled
|
||||
customRequest
|
||||
}
|
||||
}
|
||||
}
|
||||
customInfoRequests {
|
||||
id
|
||||
}
|
||||
}
|
||||
`
|
||||
|
|
@ -110,6 +126,8 @@ const Customers = () => {
|
|||
})
|
||||
|
||||
const configData = R.path(['config'])(customersResponse) ?? []
|
||||
const customRequirementsData =
|
||||
R.path(['customInfoRequests'], customersResponse) ?? []
|
||||
const locale = configData && fromNamespace(namespaces.LOCALE, configData)
|
||||
const triggers = configData && fromNamespace(namespaces.TRIGGERS, configData)
|
||||
const customersData = R.sortWith([
|
||||
|
|
@ -207,6 +225,7 @@ const Customers = () => {
|
|||
onClick={handleCustomerClicked}
|
||||
loading={customerLoading}
|
||||
triggers={triggers}
|
||||
customRequests={customRequirementsData}
|
||||
/>
|
||||
<CreateCustomerModal
|
||||
showModal={showCreationModal}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,14 @@ import { getAuthorizedStatus, getFormattedPhone, getName } from './helper'
|
|||
|
||||
const useStyles = makeStyles(styles)
|
||||
|
||||
const CustomersList = ({ data, locale, onClick, loading, triggers }) => {
|
||||
const CustomersList = ({
|
||||
data,
|
||||
locale,
|
||||
onClick,
|
||||
loading,
|
||||
triggers,
|
||||
customRequests
|
||||
}) => {
|
||||
const classes = useStyles()
|
||||
|
||||
const elements = [
|
||||
|
|
@ -66,7 +73,11 @@ const CustomersList = ({ data, locale, onClick, loading, triggers }) => {
|
|||
{
|
||||
header: 'Status',
|
||||
width: 191,
|
||||
view: it => <MainStatus statuses={[getAuthorizedStatus(it, triggers)]} />
|
||||
view: it => (
|
||||
<MainStatus
|
||||
statuses={[getAuthorizedStatus(it, triggers, customRequests)]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { parse, isValid, format } from 'date-fns/fp'
|
|||
import { Field, useFormikContext } from 'formik'
|
||||
import { parsePhoneNumberFromString } from 'libphonenumber-js'
|
||||
import * as R from 'ramda'
|
||||
import * as uuid from 'uuid'
|
||||
import * as Yup from 'yup'
|
||||
|
||||
import {
|
||||
|
|
@ -56,14 +57,11 @@ const CUSTOM = 'custom'
|
|||
const REQUIREMENT = 'requirement'
|
||||
const ID_CARD_DATA = 'idCardData'
|
||||
|
||||
const getAuthorizedStatus = (it, triggers) => {
|
||||
const fields = [
|
||||
'frontCamera',
|
||||
'idCardData',
|
||||
'idCardPhoto',
|
||||
'usSsn',
|
||||
'sanctions'
|
||||
]
|
||||
const getAuthorizedStatus = (it, triggers, customRequests) => {
|
||||
const fields = R.concat(
|
||||
['frontCamera', 'idCardData', 'idCardPhoto', 'usSsn', 'sanctions'],
|
||||
R.map(ite => ite.id, customRequests)
|
||||
)
|
||||
const fieldsWithPathSuffix = ['frontCamera', 'idCardPhoto']
|
||||
|
||||
const isManualField = fieldName => {
|
||||
|
|
@ -83,17 +81,24 @@ const getAuthorizedStatus = (it, triggers) => {
|
|||
)
|
||||
}
|
||||
|
||||
const pendingFieldStatus = R.map(
|
||||
ite =>
|
||||
!R.isNil(
|
||||
R.includes(ite, fieldsWithPathSuffix) ? it[`${ite}Path`] : it[`${ite}`]
|
||||
)
|
||||
? isManualField(ite)
|
||||
? R.equals(it[`${ite}Override`], 'automatic')
|
||||
: false
|
||||
: false,
|
||||
fields
|
||||
const pendingFieldStatus = R.map(ite => {
|
||||
if (isManualField(ite)) {
|
||||
if (uuid.validate(ite)) {
|
||||
const request = R.find(
|
||||
iter => iter.infoRequestId === ite,
|
||||
it.customInfoRequests
|
||||
)
|
||||
return !R.isNil(request) && R.equals(request.override, 'automatic')
|
||||
}
|
||||
|
||||
const regularFieldValue = R.includes(ite, fieldsWithPathSuffix)
|
||||
? it[`${ite}Path`]
|
||||
: it[`${ite}`]
|
||||
if (R.isNil(regularFieldValue)) return false
|
||||
return R.equals(it[`${ite}Override`], 'automatic')
|
||||
}
|
||||
return false
|
||||
}, fields)
|
||||
|
||||
if (it.authorizedOverride === CUSTOMER_BLOCKED)
|
||||
return { label: 'Blocked', type: 'error' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue