diff --git a/new-lamassu-admin/src/pages/Cashout/Wizard.js b/new-lamassu-admin/src/pages/Cashout/Wizard.js index 6c83b090..fb8f1d39 100644 --- a/new-lamassu-admin/src/pages/Cashout/Wizard.js +++ b/new-lamassu-admin/src/pages/Cashout/Wizard.js @@ -11,7 +11,7 @@ import WizardSplash from './WizardSplash' import WizardStep from './WizardStep' import { DenominationsSchema } from './helper' -const LAST_STEP = 3 +const LAST_STEP = 4 const MODAL_WIDTH = 554 const MODAL_HEIGHT = 520 @@ -60,6 +60,13 @@ const Wizard = ({ machine, locale, onClose, save, error }) => { type: 'bottom', display: 'Cassette 2', component: Autocomplete + }, + { + type: 'zeroConfLimit', + display: '0-conf Limit', + schema: Yup.object().shape({ + zeroConfLimit: Yup.number().required() + }) } ] diff --git a/new-lamassu-admin/src/pages/Cashout/WizardStep.js b/new-lamassu-admin/src/pages/Cashout/WizardStep.js index f730e2ba..820c3e76 100644 --- a/new-lamassu-admin/src/pages/Cashout/WizardStep.js +++ b/new-lamassu-admin/src/pages/Cashout/WizardStep.js @@ -39,10 +39,10 @@ const WizardStep = ({
{name} - +
- {!lastStep && ( + {step <= 2 && ( )} + {step === 3 && ( + +
+
+
+

Edit 0-conf Limit

+ + Choose a limit +
+ + + {fiatCurrency} + +
+
+
+ + +
+
+ )} + {lastStep && (
Cashout Bill Count diff --git a/new-lamassu-admin/src/pages/Cashout/WizardStep.styles.js b/new-lamassu-admin/src/pages/Cashout/WizardStep.styles.js index fd74d4aa..0ea2079e 100644 --- a/new-lamassu-admin/src/pages/Cashout/WizardStep.styles.js +++ b/new-lamassu-admin/src/pages/Cashout/WizardStep.styles.js @@ -41,7 +41,11 @@ export default { }, header: { display: 'flex', - paddingBottom: 96 + paddingBottom: 95 + }, + thirdStepHeader: { + display: 'flex', + paddingBottom: 188 }, step: { flex: 1 diff --git a/new-lamassu-admin/src/pages/Commissions/helper.js b/new-lamassu-admin/src/pages/Commissions/helper.js index 74c6d1aa..85d17d36 100644 --- a/new-lamassu-admin/src/pages/Commissions/helper.js +++ b/new-lamassu-admin/src/pages/Commissions/helper.js @@ -52,6 +52,7 @@ const getOverridesFields = (getData, currency, auxElements) => { ) const suggestionFilter = (it, cryptoData) => { + console.log(it) if (!it?.machine) return cryptoData return R.differenceWith( diff --git a/new-lamassu-admin/src/pages/MachineLogs.js b/new-lamassu-admin/src/pages/MachineLogs.js index 322a8a43..10565c2c 100644 --- a/new-lamassu-admin/src/pages/MachineLogs.js +++ b/new-lamassu-admin/src/pages/MachineLogs.js @@ -34,7 +34,7 @@ const GET_MACHINES = gql` } ` -const NUM_LOG_RESULTS = 1000 +const NUM_LOG_RESULTS = 500 const GET_MACHINE_LOGS = gql` query MachineLogs($deviceId: ID!, $limit: Int, $from: Date, $until: Date) { @@ -72,11 +72,7 @@ const Logs = () => { const deviceId = selected?.deviceId - const { data: machineResponse } = useQuery(GET_MACHINES, { - variables: { - limit: NUM_LOG_RESULTS - } - }) + const { data: machineResponse } = useQuery(GET_MACHINES) const [sendSnapshot, { loading }] = useMutation(SUPPORT_LOGS, { variables: { deviceId }, @@ -85,7 +81,7 @@ const Logs = () => { }) const { data: logsResponse } = useQuery(GET_MACHINE_LOGS, { - variables: { deviceId }, + variables: { deviceId, limit: NUM_LOG_RESULTS }, skip: !selected, onCompleted: () => setSaveMessage('') }) diff --git a/new-lamassu-admin/src/pages/OperatorInfo/CoinATMRadar/CoinATMRadar.js b/new-lamassu-admin/src/pages/OperatorInfo/CoinATMRadar/CoinATMRadar.js index 2a57f33a..4bdf6d4e 100644 --- a/new-lamassu-admin/src/pages/OperatorInfo/CoinATMRadar/CoinATMRadar.js +++ b/new-lamassu-admin/src/pages/OperatorInfo/CoinATMRadar/CoinATMRadar.js @@ -1,8 +1,7 @@ import { useQuery, useMutation } from '@apollo/react-hooks' import { makeStyles } from '@material-ui/core/styles' import gql from 'graphql-tag' -import * as R from 'ramda' -import React, { useState, memo } from 'react' +import React, { memo } from 'react' import Tooltip from 'src/components/Tooltip' import { Switch } from 'src/components/inputs' @@ -13,14 +12,8 @@ import { mainStyles } from './CoinATMRadar.styles' const useStyles = makeStyles(mainStyles) -const initialValues = { - active: false, - commissions: false, - limitsAndVerification: false -} - const GET_CONFIG = gql` - { + query getData { config } ` @@ -50,29 +43,12 @@ const Row = memo(({ title, disabled = false, checked, save, label }) => { }) const CoinATMRadar = memo(() => { - const [coinAtmRadarConfig, setCoinAtmRadarConfig] = useState(null) - const classes = useStyles() - const { refetch: getCoinAtmRadarConfig } = useQuery(GET_CONFIG, { - onCompleted: configResponse => { - const response = fromNamespace( - namespaces.COIN_ATM_RADAR, - configResponse.config - ) - const values = R.merge(initialValues, response) - setCoinAtmRadarConfig(values) - } - }) + const { data } = useQuery(GET_CONFIG) const [saveConfig] = useMutation(SAVE_CONFIG, { - onCompleted: configResponse => { - setCoinAtmRadarConfig( - fromNamespace(namespaces.COIN_ATM_RADAR, configResponse.saveConfig) - ) - - getCoinAtmRadarConfig() - } + refetchQueries: ['getData'] }) const save = it => @@ -80,6 +56,8 @@ const CoinATMRadar = memo(() => { variables: { config: toNamespace(namespaces.COIN_ATM_RADAR, it) } }) + const coinAtmRadarConfig = + data?.config && fromNamespace(namespaces.COIN_ATM_RADAR, data.config) if (!coinAtmRadarConfig) return null return ( diff --git a/new-lamassu-admin/src/pages/OperatorInfo/ContactInfo.js b/new-lamassu-admin/src/pages/OperatorInfo/ContactInfo.js index fc0c54f5..541a55d1 100644 --- a/new-lamassu-admin/src/pages/OperatorInfo/ContactInfo.js +++ b/new-lamassu-admin/src/pages/OperatorInfo/ContactInfo.js @@ -88,7 +88,7 @@ const Field = ({ editing, field, displayValue, ...props }) => { } const GET_CONFIG = gql` - { + query getData { config } ` @@ -104,24 +104,18 @@ const styles = R.merge(globalStyles, contactInfoStyles) const contactUseStyles = makeStyles(styles) const ContactInfo = () => { + const classes = contactUseStyles() + const [editing, setEditing] = useState(false) - const [info, setInfo] = useState(null) - const [locale, setLocale] = useState(null) const [error, setError] = useState(null) + const [saveConfig] = useMutation(SAVE_CONFIG, { - onCompleted: data => { - setInfo(fromNamespace(namespaces.OPERATOR_INFO, data.saveConfig)) - setEditing(false) - }, + onCompleted: () => setEditing(false), + refetchQueries: () => ['getData'], onError: e => setError(e) }) - useQuery(GET_CONFIG, { - onCompleted: data => { - setInfo(fromNamespace(namespaces.OPERATOR_INFO, data.config)) - setLocale(fromNamespace(namespaces.LOCALE, data.config)) - } - }) + const { data } = useQuery(GET_CONFIG) const save = it => { return saveConfig({ @@ -129,7 +123,9 @@ const ContactInfo = () => { }) } - const classes = contactUseStyles() + const info = + data?.config && fromNamespace(namespaces.OPERATOR_INFO, data.config) + const locale = data?.config && fromNamespace(namespaces.LOCALE, data.config) if (!info) return null diff --git a/new-lamassu-admin/src/pages/OperatorInfo/ReceiptPrinting/ReceiptPrinting.js b/new-lamassu-admin/src/pages/OperatorInfo/ReceiptPrinting/ReceiptPrinting.js index 0dd89260..b48a2787 100644 --- a/new-lamassu-admin/src/pages/OperatorInfo/ReceiptPrinting/ReceiptPrinting.js +++ b/new-lamassu-admin/src/pages/OperatorInfo/ReceiptPrinting/ReceiptPrinting.js @@ -2,7 +2,7 @@ import { useQuery, useMutation } from '@apollo/react-hooks' import { makeStyles } from '@material-ui/core/styles' import gql from 'graphql-tag' import * as R from 'ramda' -import React, { useState, memo } from 'react' +import React, { memo } from 'react' import { BooleanPropertiesTable } from 'src/components/booleanPropertiesTable' import { Switch } from 'src/components/inputs' @@ -13,20 +13,8 @@ import { mainStyles } from './ReceiptPrinting.styles' const useStyles = makeStyles(mainStyles) -const initialValues = { - active: 'off', - operatorWebsite: false, - operatorEmail: false, - operatorPhone: false, - companyNumber: false, - machineLocation: false, - customerNameOrPhoneNumber: false, - exchangeRate: false, - addressQRCode: false -} - const GET_CONFIG = gql` - { + query getData { config } ` @@ -38,26 +26,12 @@ const SAVE_CONFIG = gql` ` const ReceiptPrinting = memo(() => { - const [receiptPrintingConfig, setReceiptPrintingConfig] = useState(null) - const classes = useStyles() - const { refetch: getReceiptPrintingConfig } = useQuery(GET_CONFIG, { - onCompleted: configResponse => { - const response = fromNamespace(namespaces.RECEIPT, configResponse.config) - const values = R.merge(initialValues, response) - setReceiptPrintingConfig(values) - } - }) + const { data } = useQuery(GET_CONFIG) const [saveConfig] = useMutation(SAVE_CONFIG, { - onCompleted: configResponse => { - setReceiptPrintingConfig( - fromNamespace(namespaces.RECEIPT, configResponse.saveConfig) - ) - - getReceiptPrintingConfig() - } + refetchQueries: () => ['getData'] }) const save = it => @@ -65,6 +39,8 @@ const ReceiptPrinting = memo(() => { variables: { config: toNamespace(namespaces.RECEIPT, it) } }) + const receiptPrintingConfig = + data?.config && fromNamespace(namespaces.RECEIPT, data.config) if (!receiptPrintingConfig) return null return ( diff --git a/new-lamassu-admin/src/pages/OperatorInfo/TermsConditions.js b/new-lamassu-admin/src/pages/OperatorInfo/TermsConditions.js index 57dea39c..e44593ba 100644 --- a/new-lamassu-admin/src/pages/OperatorInfo/TermsConditions.js +++ b/new-lamassu-admin/src/pages/OperatorInfo/TermsConditions.js @@ -74,7 +74,7 @@ const Field = ({ } const GET_CONFIG = gql` - { + query getData { config } ` @@ -90,36 +90,25 @@ const styles = R.merge(globalStyles, termsConditionsStyles) const useTermsConditionsStyles = makeStyles(styles) const TermsConditions = () => { - const [showOnScreen, setShowOnScreen] = useState(false) - const [formData, setFormData] = useState(null) const [error, setError] = useState(null) const [editing, setEditing] = useState(false) const [saveConfig] = useMutation(SAVE_CONFIG, { - onCompleted: data => { - const termsAndConditions = fromNamespace( - namespaces.TERMS_CONDITIONS, - data.saveConfig - ) - setFormData(termsAndConditions) - setShowOnScreen(termsAndConditions.active) + onCompleted: () => { setError(null) setEditing(false) }, + refetchQueries: () => ['getData'], onError: e => setError(e) }) const classes = useTermsConditionsStyles() - useQuery(GET_CONFIG, { - onCompleted: data => { - const termsAndConditions = fromNamespace( - namespaces.TERMS_CONDITIONS, - data.config - ) - setFormData(termsAndConditions ?? {}) - setShowOnScreen(termsAndConditions?.active ?? false) - } - }) + const { data } = useQuery(GET_CONFIG) + + const termsAndConditions = + data?.config && fromNamespace(namespaces.TERMS_CONDITIONS, data.config) + const formData = termsAndConditions ?? {} + const showOnScreen = termsAndConditions?.active ?? false const save = it => { setError(null) diff --git a/new-lamassu-admin/src/pages/ServerLogs.js b/new-lamassu-admin/src/pages/ServerLogs.js index b3466c75..fcfbed6e 100644 --- a/new-lamassu-admin/src/pages/ServerLogs.js +++ b/new-lamassu-admin/src/pages/ServerLogs.js @@ -60,7 +60,7 @@ const formatDate = date => { return moment(date).format('YYYY-MM-DD HH:mm') } -const NUM_LOG_RESULTS = 1000 +const NUM_LOG_RESULTS = 500 const GET_DATA = gql` query ServerData($limit: Int) { diff --git a/new-lamassu-admin/src/pages/Triggers/Triggers.js b/new-lamassu-admin/src/pages/Triggers/Triggers.js index 95461e66..018401c8 100644 --- a/new-lamassu-admin/src/pages/Triggers/Triggers.js +++ b/new-lamassu-admin/src/pages/Triggers/Triggers.js @@ -13,11 +13,11 @@ import TitleSection from 'src/components/layout/TitleSection' import { P, Label2 } from 'src/components/typography' import { fromNamespace, toNamespace, namespaces } from 'src/utils/config' -import { mainStyles } from './Triggers.styles' +import styles from './Triggers.styles' import Wizard from './Wizard' import { Schema, getElements, sortBy, fromServer, toServer } from './helper' -const useStyles = makeStyles(mainStyles) +const useStyles = makeStyles(styles) const SAVE_CONFIG = gql` mutation Save($config: JSONObject) { diff --git a/new-lamassu-admin/src/pages/Triggers/Triggers.styles.js b/new-lamassu-admin/src/pages/Triggers/Triggers.styles.js index 3cc5fed7..e532b514 100644 --- a/new-lamassu-admin/src/pages/Triggers/Triggers.styles.js +++ b/new-lamassu-admin/src/pages/Triggers/Triggers.styles.js @@ -1,25 +1,7 @@ -import { booleanPropertiesTableStyles } from 'src/components/booleanPropertiesTable/BooleanPropertiesTable.styles' -import baseStyles from 'src/pages/Logs.styles' - -const { titleWrapper, titleAndButtonsContainer, buttonsWrapper } = baseStyles -const { rowWrapper, radioButtons } = booleanPropertiesTableStyles - -const mainStyles = { - titleWrapper, - titleAndButtonsContainer, - buttonsWrapper, - rowWrapper, - radioButtons, - radioGroup: { - flexDirection: 'row' - }, - radioLabel: { - width: 150, - height: 40 - }, - radio: { - padding: 4, - margin: 4 +export default { + switchLabel: { + margin: 6, + width: 24 }, tableRadioGroup: { flexDirection: 'row', @@ -27,82 +9,5 @@ const mainStyles = { }, tableRadioLabel: { marginRight: 0 - }, - closeButton: { - position: 'absolute', - width: 16, - height: 16, - top: 20, - right: 0 - }, - stepOneRadioButtons: { - '& > *': { - marginRight: 48 - } - }, - stepTwoRadioButtons: { - '& > *': { - minWidth: 174, - marginRight: 72 - } - }, - stepThreeRadioButtons: { - '& > *': { - minWidth: 160, - marginRight: 12 - } - }, - wizardHeaderText: { - display: 'flex', - margin: [[24, 0]] - }, - paper: { - padding: [[5, 20, 32, 24]], - position: 'relative', - display: 'flex', - flexDirection: 'column', - width: 520, - height: 480, - overflow: 'hidden', - '& > button': { - position: 'absolute', - top: 16, - right: 16, - border: 'none', - backgroundColor: 'transparent', - cursor: 'pointer', - '& svg': { - width: 18 - } - }, - '& form': { - display: 'flex', - flexDirection: 'column', - flexGrow: 2 - } - }, - transparentButton: { - '& > *': { - margin: 'auto 12px' - }, - '& button': { - border: 'none', - backgroundColor: 'transparent', - cursor: 'pointer' - } - }, - popoverContent: { - width: 272, - padding: [[10, 15]] - }, - radioGroupWrapper: { - marginBottom: 46 - }, - textInput: { - width: 96, - height: 40, - marginRight: 8 } } - -export { mainStyles } diff --git a/new-lamassu-admin/src/pages/Triggers/Wizard.js b/new-lamassu-admin/src/pages/Triggers/Wizard.js index 61f452e6..c56d0677 100644 --- a/new-lamassu-admin/src/pages/Triggers/Wizard.js +++ b/new-lamassu-admin/src/pages/Triggers/Wizard.js @@ -117,6 +117,8 @@ const getRequirementText = config => { return 'asked to scan a ID' case 'facephoto': return 'asked to have a photo taken' + case 'us-ssn': + return 'asked to input his social security number' case 'sanctions': return 'matched against the OFAC sanctions list' case 'superuser': diff --git a/new-lamassu-admin/src/pages/Triggers/helper.js b/new-lamassu-admin/src/pages/Triggers/helper.js index fe2a77bf..aee6a675 100644 --- a/new-lamassu-admin/src/pages/Triggers/helper.js +++ b/new-lamassu-admin/src/pages/Triggers/helper.js @@ -261,6 +261,7 @@ const requirementOptions = [ { display: 'ID data', code: 'idCardData' }, { display: 'Customer camera', code: 'facephoto' }, { display: 'Sanctions', code: 'sanctions' }, + { display: 'US SSN', code: 'us-ssn' }, // { display: 'Super user', code: 'superuser' }, { display: 'Suspend', code: 'suspend' }, { display: 'Block', code: 'block' }