chore: reformat code

This commit is contained in:
Rafael Taranto 2025-05-12 14:49:39 +01:00
parent 3d930aa73b
commit aedabcbdee
509 changed files with 6030 additions and 4266 deletions

View file

@ -1,6 +1,11 @@
import { ApolloClient, ApolloProvider, InMemoryCache, ApolloLink } from "@apollo/client";
import { onError } from "@apollo/client/link/error"
import createUploadLink from "apollo-upload-client/createUploadLink.mjs";
import {
ApolloClient,
ApolloProvider,
InMemoryCache,
ApolloLink,
} from '@apollo/client'
import { onError } from '@apollo/client/link/error'
import createUploadLink from 'apollo-upload-client/createUploadLink.mjs'
import React, { useContext } from 'react'
import { useHistory, useLocation } from 'react-router-dom'
@ -8,7 +13,7 @@ import AppContext from 'src/AppContext'
const uploadLink = createUploadLink({
credentials: 'include',
uri: `/graphql`
uri: `/graphql`,
})
const getClient = (history, location, getUserData, setUserData, setRole) =>
@ -22,7 +27,7 @@ const getClient = (history, location, getUserData, setUserData, setRole) =>
if (location.pathname !== '/login') history.push('/login')
}
console.log(
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`,
)
})
if (networkError) console.log(`[Network error]: ${networkError}`)
@ -31,7 +36,7 @@ const getClient = (history, location, getUserData, setUserData, setRole) =>
return forward(operation).map(response => {
const context = operation.getContext()
const {
response: { headers }
response: { headers },
} = context
if (headers) {
@ -42,22 +47,22 @@ const getClient = (history, location, getUserData, setUserData, setRole) =>
return response
})
}),
uploadLink
uploadLink,
]),
cache: new InMemoryCache(),
defaultOptions: {
watchQuery: {
fetchPolicy: 'no-cache',
errorPolicy: 'ignore'
errorPolicy: 'ignore',
},
query: {
fetchPolicy: 'no-cache',
errorPolicy: 'all'
errorPolicy: 'all',
},
mutate: {
errorPolicy: 'all'
}
}
errorPolicy: 'all',
},
},
})
const Provider = ({ children }) => {
@ -69,7 +74,7 @@ const Provider = ({ children }) => {
location,
() => userData,
setUserData,
setRole
setRole,
)
return <ApolloProvider client={client}>{children}</ApolloProvider>

View file

@ -9,9 +9,9 @@ export default {
100: [0xa5, 0x91],
200: [0xa7, 0x93],
500: [0xa9, 0x95],
1000: [0xad, 0x99]
1000: [0xad, 0x99],
},
polymer: false
polymer: false,
},
ANG: {
thickness: 0x0c,
@ -19,9 +19,9 @@ export default {
10: [0x98, 0x8e],
25: [0x98, 0x8e],
50: [0x98, 0x8e],
100: [0x98, 0x8e]
100: [0x98, 0x8e],
},
polymer: false
polymer: false,
},
AUD: {
thickness: 0x0d,
@ -30,9 +30,9 @@ export default {
10: [0x93, 0x7f],
20: [0x9a, 0x86],
50: [0xa1, 0x8d],
100: [0xa8, 0x94]
100: [0xa8, 0x94],
},
polymer: true
polymer: true,
},
BGN: {
thickness: 0x0d,
@ -43,9 +43,9 @@ export default {
10: [0x83, 0x79],
20: [0x88, 0x7e],
50: [0x8d, 0x83],
100: [0x92, 0x88]
100: [0x92, 0x88],
},
polymer: false
polymer: false,
},
CAD: {
thickness: 0x0d,
@ -54,9 +54,9 @@ export default {
10: [0xa2, 0x8e],
20: [0xa2, 0x8e],
50: [0xa2, 0x8e],
100: [0xa2, 0x8e]
100: [0xa2, 0x8e],
},
polymer: true
polymer: true,
},
CHF: {
thickness: 0x0d,
@ -66,9 +66,9 @@ export default {
50: [0x93, 0x7f],
100: [0x9a, 0x86],
200: [0xa1, 0x8d],
1000: [0xa8, 0x94]
1000: [0xa8, 0x94],
},
polymer: false
polymer: false,
},
CNY: {
thickness: 0x0d,
@ -78,9 +78,9 @@ export default {
10: [0x96, 0x82],
20: [0x9b, 0x87],
50: [0xa0, 0x8c],
100: [0x91, 0xa5]
100: [0x91, 0xa5],
},
polymer: false
polymer: false,
},
COP: {
thickness: 0x0d,
@ -90,9 +90,9 @@ export default {
10000: [0x94, 0x80],
20000: [0x99, 0x85],
50000: [0x9e, 0x8a],
100000: [0xa3, 0x8f]
100000: [0xa3, 0x8f],
},
polymer: false
polymer: false,
},
CRC: {
thickness: 0x0d,
@ -102,9 +102,9 @@ export default {
5000: [0x90, 0x86],
10000: [0x97, 0x8d],
20000: [0x9e, 0x94],
50000: [0xaa, 0x96]
50000: [0xaa, 0x96],
},
polymer: true
polymer: true,
},
CZK: {
thickness: 0x0c,
@ -114,9 +114,9 @@ export default {
500: [0xa2, 0x8e],
1000: [0xa8, 0x94],
2000: [0xae, 0x9a],
5000: [0xb4, 0xa0]
5000: [0xb4, 0xa0],
},
polymer: false
polymer: false,
},
EUR: {
thickness: 0x0c,
@ -127,9 +127,9 @@ export default {
50: [0x96, 0x82],
100: [0x9d, 0x89],
200: [0xa3, 0x8f],
500: [0xaa, 0x96]
500: [0xaa, 0x96],
},
polymer: false
polymer: false,
},
GBP: {
thickness: 0x0d,
@ -137,9 +137,9 @@ export default {
5: [0x91, 0x7d],
10: [0x98, 0x84],
20: [0x95, 0x81],
50: [0xa6, 0x92]
50: [0xa6, 0x92],
},
polymer: true
polymer: true,
},
GHS: {
thickness: 0x0c,
@ -149,9 +149,9 @@ export default {
5: [0x97, 0x83],
10: [0x9b, 0x87],
20: [0x9f, 0x8b],
50: [0xa3, 0x8f]
50: [0xa3, 0x8f],
},
polymer: false
polymer: false,
},
GIP: {
thickness: 0x0c,
@ -160,9 +160,9 @@ export default {
10: [0x92, 0x88],
20: [0x9b, 0x91],
50: [0xa2, 0x98],
100: [0xa9, 0x9f]
100: [0xa9, 0x9f],
},
polymer: false
polymer: false,
},
GTQ: {
thickness: 0x0c,
@ -172,9 +172,9 @@ export default {
20: [0xa3, 0x99],
50: [0xa1, 0x97],
100: [0xa1, 0x97],
200: [0xa1, 0x97]
200: [0xa1, 0x97],
},
polymer: false
polymer: false,
},
HKD: {
thickness: 0x0d,
@ -184,9 +184,9 @@ export default {
50: [0x9e, 0x8a],
100: [0xa3, 0x8f],
500: [0xa8, 0x94],
1000: [0xae, 0x9a]
1000: [0xae, 0x9a],
},
polymer: false
polymer: false,
},
HNL: {
thickness: 0x0c,
@ -199,9 +199,9 @@ export default {
50: [0xa6, 0x92],
100: [0xa6, 0x92],
200: [0xa6, 0x92],
500: [0xa6, 0x92]
500: [0xa6, 0x92],
},
polymer: false
polymer: false,
},
HRK: {
thickness: 0x0c,
@ -213,9 +213,9 @@ export default {
100: [0x8f, 0x85],
200: [0x93, 0x89],
500: [0x97, 0x8d],
1000: [0x9b, 0x91]
1000: [0x9b, 0x91],
},
polymer: false
polymer: false,
},
ILS: {
thickness: 0x0d,
@ -223,9 +223,9 @@ export default {
20: [0x8b, 0x77],
50: [0x92, 0x7e],
100: [0x99, 0x85],
200: [0xa0, 0x8c]
200: [0xa0, 0x8c],
},
polymer: false
polymer: false,
},
JPY: {
thickness: 0x0d,
@ -233,9 +233,9 @@ export default {
1000: [0x99, 0x93],
2000: [0x9c, 0x98],
5000: [0x9d, 0x9a],
10000: [0xa3, 0x9e]
10000: [0xa3, 0x9e],
},
polymer: false
polymer: false,
},
KRW: {
thickness: 0x0d,
@ -244,9 +244,9 @@ export default {
2000: [0x96, 0x82],
5000: [0x98, 0x84],
10000: [0x9e, 0x8a],
50000: [0xa4, 0x90]
50000: [0xa4, 0x90],
},
polymer: false
polymer: false,
},
MDL: {
thickness: 0x0c,
@ -259,9 +259,9 @@ export default {
100: [0x83, 0x6f],
200: [0x8f, 0x7b],
500: [0x8f, 0x7b],
1000: [0x8f, 0x7b]
1000: [0x8f, 0x7b],
},
polymer: false
polymer: false,
},
MKD: {
thickness: 0x0c,
@ -273,9 +273,9 @@ export default {
500: [0x9a, 0x90],
1000: [0x9d, 0x93],
2000: [0x9d, 0x93],
5000: [0xa0, 0x96]
5000: [0xa0, 0x96],
},
polymer: true
polymer: true,
},
MXN: {
thickness: 0x0c,
@ -285,9 +285,9 @@ export default {
100: [0x89, 0x7f],
200: [0x90, 0x86],
500: [0x97, 0x8d],
1000: [0x9e, 0x94]
1000: [0x9e, 0x94],
},
polymer: true
polymer: true,
},
MYR: {
thickness: 0x0c,
@ -297,9 +297,9 @@ export default {
10: [0x96, 0x82],
20: [0x9b, 0x87],
50: [0x9b, 0x87],
100: [0xa0, 0x8c]
100: [0xa0, 0x8c],
},
polymer: false
polymer: false,
},
NAD: {
thickness: 0x0c,
@ -308,9 +308,9 @@ export default {
20: [0x8b, 0x81],
50: [0x91, 0x87],
100: [0x97, 0x8d],
200: [0x9d, 0x93]
200: [0x9d, 0x93],
},
polymer: false
polymer: false,
},
NZD: {
thickness: 0x0c,
@ -319,9 +319,9 @@ export default {
10: [0x91, 0x87],
20: [0x96, 0x8c],
50: [0x9b, 0x91],
100: [0xa0, 0x96]
100: [0xa0, 0x96],
},
polymer: true
polymer: true,
},
PHP: {
thickness: 0x0c,
@ -330,9 +330,9 @@ export default {
100: [0xaa, 0x96],
200: [0xaa, 0x96],
500: [0xaa, 0x96],
1000: [0xaa, 0x96]
1000: [0xaa, 0x96],
},
polymer: false
polymer: false,
},
PLN: {
thickness: 0x0c,
@ -342,9 +342,9 @@ export default {
50: [0x89, 0x7f],
100: [0x8f, 0x85],
200: [0x95, 0x8b],
500: [0x9b, 0x91]
500: [0x9b, 0x91],
},
polymer: false
polymer: false,
},
RON: {
thickness: 0x0c,
@ -355,9 +355,9 @@ export default {
50: [0x96, 0x82],
100: [0x9d, 0x89],
200: [0xa0, 0x8c],
500: [0xa3, 0x8f]
500: [0xa3, 0x8f],
},
polymer: true
polymer: true,
},
SGD: {
thickness: 0x0c,
@ -367,9 +367,9 @@ export default {
10: [0x97, 0x83],
50: [0xa6, 0x92],
100: [0xac, 0x98],
1000: [0xb4, 0xa0]
1000: [0xb4, 0xa0],
},
polymer: false
polymer: false,
},
TWD: {
thickness: 0x0d,
@ -378,9 +378,9 @@ export default {
200: [0xa0, 0x8c],
500: [0xa5, 0x91],
1000: [0xaa, 0x96],
2000: [0xaf, 0x9b]
2000: [0xaf, 0x9b],
},
polymer: false
polymer: false,
},
USD: {
thickness: 0x0d,
@ -391,9 +391,9 @@ export default {
10: [0xa6, 0x92],
20: [0xa6, 0x92],
50: [0xa6, 0x92],
100: [0xa6, 0x92]
100: [0xa6, 0x92],
},
polymer: false
polymer: false,
},
UYU: {
thickness: 0x0d,
@ -404,9 +404,9 @@ export default {
200: [0xa4, 0x9a],
500: [0xa4, 0x9a],
1000: [0xa4, 0x9a],
2000: [0xa4, 0x9a]
2000: [0xa4, 0x9a],
},
polymer: false
polymer: false,
},
XCD: {
thickness: 0x0c,
@ -415,9 +415,9 @@ export default {
10: [0x9b, 0x87],
20: [0x9b, 0x87],
50: [0x9b, 0x87],
100: [0x9b, 0x87]
100: [0x9b, 0x87],
},
polymer: true
polymer: true,
},
ZAR: {
thickness: 0x0c,
@ -426,8 +426,8 @@ export default {
20: [0x90, 0x7c],
50: [0x96, 0x82],
100: [0x9c, 0x88],
200: [0xa2, 0x8e]
200: [0xa2, 0x8e],
},
polymer: false
}
polymer: false,
},
}

View file

@ -5,7 +5,7 @@ const getBillOptions = R.curry((locale, denomiations) => {
return R.compose(
R.map(code => ({ code: parseInt(code), display: code })),
R.keys,
R.path([currency, 'lengths'])
R.path([currency, 'lengths']),
)(denomiations)
})

View file

@ -13,30 +13,30 @@ const namespaces = {
COIN_ATM_RADAR: 'coinAtmRadar',
TERMS_CONDITIONS: 'termsConditions',
TRIGGERS: 'triggersConfig',
MACHINE_SCREENS: 'machineScreens'
MACHINE_SCREENS: 'machineScreens',
}
const mapKeys = R.curry((fn, obj) =>
R.fromPairs(R.map(R.adjust(0, fn), R.toPairs(obj)))
R.fromPairs(R.map(R.adjust(0, fn), R.toPairs(obj))),
)
const filterByKey = R.curry((fn, obj) =>
R.fromPairs(R.filter(it => fn(it[0]), R.toPairs(obj)))
R.fromPairs(R.filter(it => fn(it[0]), R.toPairs(obj))),
)
const stripl = R.curry((q, str) =>
R.startsWith(q, str) ? str.slice(q.length) : str
R.startsWith(q, str) ? str.slice(q.length) : str,
)
const filtered = key => filterByKey(R.startsWith(`${key}_`))
const stripped = key => mapKeys(stripl(`${key}_`))
const fromNamespace = R.curry((key, config) =>
R.compose(stripped(key), filtered(key))(config)
R.compose(stripped(key), filtered(key))(config),
)
const toNamespace = R.curry((key, config) =>
mapKeys(it => `${key}_${it}`)(config)
mapKeys(it => `${key}_${it}`)(config),
)
export { fromNamespace, toNamespace, namespaces }

View file

@ -19,5 +19,5 @@ export {
MANUAL,
WALLET_SCORING_DEFAULT_THRESHOLD,
IP_CHECK_REGEX,
SWEEPABLE_CRYPTOS
SWEEPABLE_CRYPTOS,
}

View file

@ -8,7 +8,7 @@ const formatFullName = R.pipe(
R.values,
R.reject(R.allPass([R.isNil, R.isEmpty])),
R.map(onlyFirstToUpper),
R.join(' ')
R.join(' '),
)
const formatName = idCardData => {
@ -29,7 +29,7 @@ const displayName = ({
customerName,
customerIdCardData,
customerPhone,
customerEmail
customerEmail,
}) =>
isAnonymous
? 'Anonymous'

View file

@ -4,44 +4,44 @@ const modelPrettifier = {
gaia: 'Gaia',
tejo: 'Tejo',
aveiro: 'Aveiro',
grandola: 'Grândola'
grandola: 'Grândola',
}
const cashUnitCapacity = {
default: {
cashbox: 600,
cassette: 500
cassette: 500,
},
douro: {
cashbox: 600,
cassette: 500
cassette: 500,
},
grandola: {
cashbox: 2500,
recycler: 2800
recycler: 2800,
},
aveiro: {
cashbox: 1500,
recycler: 60,
escrow: 20,
cassette: 500
cassette: 500,
},
tejo: {
// TODO: add support for the different cashbox configuration in Tejo
cashbox: 1000,
cassette: 500
cassette: 500,
},
gaia: {
cashbox: 600
cashbox: 600,
},
sintra: {
cashbox: 1000,
cassette: 500
cassette: 500,
},
gmuk1: {
cashbox: 2200,
cassette: 2000
}
cassette: 2000,
},
}
const getCashUnitCapacity = (model, device) => {

View file

@ -17,5 +17,5 @@ export {
defaultToZero,
transformNumber,
numberToFiatAmount,
numberToCryptoAmount
numberToCryptoAmount,
}

View file

@ -5,7 +5,7 @@ const formatLong = value => {
return `${value.slice(0, 8)}(...)${value.slice(
value.length - 8,
value.length
value.length,
)}`
}
@ -18,7 +18,7 @@ const onlyFirstToUpper = R.compose(toFirstUpper, R.toLower)
const splitOnUpper = R.compose(
R.split(' '),
R.replace(/([A-Z])/g, ' $1'),
toFirstLower
toFirstLower,
)
const startCase = R.compose(R.join(' '), R.map(onlyFirstToUpper), splitOnUpper)
@ -32,5 +32,5 @@ export {
onlyFirstToUpper,
formatLong,
singularOrPlural,
sentenceCase
sentenceCase,
}

View file

@ -14,7 +14,7 @@ const timezones = {
'America/Regina': { short: 'CST', long: 'Saskatchewan' },
'America/Mexico_City': {
short: 'CST',
long: 'Guadalajara, Mexico City, Monterrey'
long: 'Guadalajara, Mexico City, Monterrey',
},
'America/Belize': { short: 'CST', long: 'Central America' },
'America/Detroit': { short: 'EST', long: 'Eastern Time' },
@ -27,7 +27,7 @@ const timezones = {
'America/Montevideo': { short: 'UYT', long: 'Montevideo' },
'America/Argentina/Buenos_Aires': {
short: null,
long: 'Buenos Aires, Georgetown'
long: 'Buenos Aires, Georgetown',
},
'America/Godthab': { short: null, long: 'Greenland' },
'America/Los_Angeles': { short: 'PST', long: 'Pacific Time' },
@ -41,23 +41,23 @@ const timezones = {
'Atlantic/Canary': { short: 'WET', long: 'Canary Islands' },
'Europe/Belgrade': {
short: 'CET',
long: 'Belgrade, Bratislava, Budapest, Ljubljana, Prague'
long: 'Belgrade, Bratislava, Budapest, Ljubljana, Prague',
},
'Europe/Sarajevo': { short: 'CET', long: 'Sarajevo, Skopje, Warsaw, Zagreb' },
'Europe/Brussels': {
short: 'CET',
long: 'Brussels, Copenhagen, Madrid, Paris'
long: 'Brussels, Copenhagen, Madrid, Paris',
},
'Europe/Amsterdam': {
short: 'CET',
long: 'Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna'
long: 'Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna',
},
'Africa/Algiers': { short: 'CET', long: 'West Central Africa' },
'Europe/Bucharest': { short: 'EET', long: 'Bucharest' },
'Africa/Cairo': { short: 'EET', long: 'Cairo' },
'Europe/Helsinki': {
short: 'EET',
long: 'Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius'
long: 'Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius',
},
'Europe/Athens': { short: 'EET', long: 'Athens, Istanbul, Minsk' },
'Asia/Jerusalem': { short: 'IST', long: 'Jerusalem' },
@ -82,7 +82,7 @@ const timezones = {
'Asia/Krasnoyarsk': { short: 'KRAT', long: 'Krasnoyarsk' },
'Asia/Shanghai': {
short: 'CST',
long: 'Beijing, Chongqing, Hong Kong SAR, Urumqi'
long: 'Beijing, Chongqing, Hong Kong SAR, Urumqi',
},
'Asia/Kuala_Lumpur': { short: 'MYT', long: 'Kuala Lumpur, Singapore' },
'Asia/Taipei': { short: 'CST', long: 'Taipei' },
@ -100,12 +100,12 @@ const timezones = {
'Pacific/Guam': { short: 'ChST', long: 'Guam, Port Moresby' },
'Asia/Magadan': {
short: 'MAGT',
long: 'Magadan, Solomon Islands, New Caledonia'
long: 'Magadan, Solomon Islands, New Caledonia',
},
'Asia/Kamchatka': { short: 'PETT', long: 'Kamchatka, Marshall Islands' },
'Pacific/Fiji': { short: 'FJT', long: 'Fiji Islands' },
'Pacific/Auckland': { short: 'NZDT', long: 'Auckland, Wellington' },
'Pacific/Tongatapu': { short: null, long: "Nuku'alofa" }
'Pacific/Tongatapu': { short: null, long: "Nuku'alofa" },
}
const buildTzLabels = timezoneList => {
@ -115,29 +115,29 @@ const buildTzLabels = timezoneList => {
const isNegative = getTimezoneOffset(value[0]) < 0
const duration = intervalToDuration({
start: 0,
end: Math.abs(getTimezoneOffset(value[0]))
end: Math.abs(getTimezoneOffset(value[0])),
})
const hours = duration.hours.toLocaleString('en-US', {
minimumIntegerDigits: 2,
useGrouping: false
useGrouping: false,
})
const minutes = duration.minutes.toLocaleString('en-US', {
minimumIntegerDigits: 2,
useGrouping: false
useGrouping: false,
})
const prefix = `(GMT${isNegative ? `-` : `+`}${hours}:${minutes})`
acc.push({
label: `${prefix} - ${value[1].long}`,
code: value[0]
code: value[0],
})
return acc
},
[],
pairs
pairs,
)
}

View file

@ -15,7 +15,7 @@ const formatDate = (date, timezone, pattern) => {
const browserTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone
const newDate = utcToZonedTime(
timezone,
zonedTimeToUtc(browserTimezone, date)
zonedTimeToUtc(browserTimezone, date),
)
return format(pattern, newDate)
}

View file

@ -1,9 +0,0 @@
const url = `https://${
process.env.NODE_ENV === 'development'
? window.location.host
: window.location.hostname
}`
const urlResolver = content => `${url}${content}`
export { urlResolver }