From 32997fffd36d0c70683ca535e96ee570d2a0db3c Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 8 Oct 2024 10:16:06 +0100 Subject: [PATCH 1/6] fix: timeout on external compliance screen --- ui/js/app.js | 3 +-- ui/js/app.js.map | 2 +- ui/js/docker-app.js | 3 +-- ui/src/app.js | 1 + 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/js/app.js b/ui/js/app.js index e6e4f4359..9b131cb53 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -22,7 +22,6 @@ var two = null; var cryptomatModel = null; var termsConditionsTimeout = null; var termsConditionsAcceptanceInterval = null; -var termsConditionsAcceptanceTimeout = null; var T_C_TIMEOUT = 30000; var complianceTimeout = null; var cashDirection = null; @@ -326,6 +325,7 @@ function processData(data) { invalidAddress(data.lnInvoiceTypeError); break; case 'externalCompliance': + clearTimeout(complianceTimeout); externalCompliance(data.externalComplianceUrl); break; default: @@ -1348,7 +1348,6 @@ function setTermsConditionsAcceptanceDelay(screen, data) { function clearTermsConditionsAcceptanceDelay() { clearInterval(termsConditionsAcceptanceInterval); - clearTimeout(termsConditionsAcceptanceTimeout); } function resetTermsConditionsTimeout() { diff --git a/ui/js/app.js.map b/ui/js/app.js.map index 0fc70fb80..3d1caf213 100644 --- a/ui/js/app.js.map +++ b/ui/js/app.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/app.js"],"names":["queryString","window","location","search","params","URLSearchParams","substring","SCREEN","get","DEBUG_MODE","CASH_OUT_QR_COLOR","CASH_IN_QR_COLOR","NUMBER_OF_BUTTONS","scrollSize","textHeightQuantity","currentPage","totalPages","aspectRatio","isTwoWay","isRTL","two","cryptomatModel","termsConditionsTimeout","termsConditionsAcceptanceInterval","termsConditionsAcceptanceTimeout","T_C_TIMEOUT","complianceTimeout","cashDirection","fiatCode","locale","defaultLocale","loadI18n","localeCode","jsLocaleCode","_primaryLocales","lastRates","coins","currentState","accepting","websocket","wifiKeyboard","promoKeyboard","usSsnKeypad","phoneKeypad","securityKeypad","previousState","buttonActive","cassettes","currentCryptoCode","currentCoin","currentCoins","emailKeyboard","customRequirementNumericalKeypad","customRequirementTextKeyboard","customRequirementChoiceList","MUSEO","connect","console","log","HOST","PORT","WebSocket","onmessage","event","data","$","parseJSON","processData","onerror","err","verifyConnection","readyState","CLOSED","buttonPressed","button","deactivate","setTimeout","activate","res","send","JSON","stringify","displayLN","displayBTC","LN","BTC","localeInfo","setLocaleInfo","setLocale","supportedCoins","setCoins","setFiatCode","rates","setExchangeRate","buyerAddress","setBuyerAddress","credit","lastBill","action","setCredit","tx","setTx","wifiList","setWifiList","wifiSsid","setWifiSsid","sendOnly","reason","fiatCredit","depositInfo","setDepositAddress","version","setVersion","buildCassetteButtons","sent","total","setPartialSend","readingBills","cryptoCode","translateCoin","cashInFee","setFixedFee","terms","setTermsScreen","dispenseBatch","direction","setDirection","operatorInfo","setOperatorInfo","hardLimit","setHardLimit","setCryptomatModel","areThereAvailablePromoCodes","undefined","setAvailablePromoCodes","discount","setCurrentDiscount","receiptStatus","setReceiptPrint","smsReceiptStatus","context","hide","show","isRecycler","billValidator","setState","t","translate","text","setComplianceTimeout","setConstraint","disableRecyclerBillButtons","enableRecyclerBillButtons","setAccepting","highBill","highestBill","minimumTx","lowestBill","isCashInOnlyCoin","chooseFiat","deposit","fiatReceipt","fiatComplete","chooseCoin","twoWayMode","smsVerification","threshold","emailVerification","idVerification","facephotoPermission","usSsnPermission","externalPermission","blockedCustomer","customInfoRequestPermission","customInfoRequest","invalidAddress","lnInvoiceTypeError","externalCompliance","externalComplianceUrl","snakecase","fetchArgs","fetch","error","e","setScreen","screen1","title","interval","complianceButton","clearTimeout","input","type","screen2","setOpts","constraint","constraintType","maxLength","numDigits","label1","label2","removeClass","addClass","replaceChoices","choiceList","setChooseCoinColors","defaultCoin","slice","setCryptoBuy","setCryptoSell","setupCoinsButtons","openLanguageDropdown","closeLanguageDropdown","openCoinDropdown","closeCoinDropdown","empty","dropdownCoins","length","showMoreButton","forEach","coin","activeClass","el","toLowerCase","display","append","each","html","trim","cashIn","translatedCoin","buyStr","cashOut","sellStr","getCryptoCurrency","cryptoCurrency","find","c","Error","switchCoin","selectedIndex","indexOf","it","splice","document","ready","attachFastClick","Origami","fastclick","body","addEventListener","calculateAspectRatio","onclick","oncontextmenu","onmousedown","onmousemove","onmouseup","BigNumber","config","ROUNDING_MODE","ROUND_HALF_EVEN","Keyboard","id","inputBox","init","Keypad","result","country","submitButtonWrapper","ChoiceList","setInterval","initTranslatePage","wifiNetworkButtons","getElementById","touchEvent","target","attr","moreNetworks","networkButton","closest","ssidEl","ssid","displaySsid","rawSsid","wifiConnectButton","wifiConnectButtonJ","pass","sendCoinsButton","sendCoinsButton2","setupButton","blockedCustomerOk","insertBillCancelButton","touchImmediateEvent","insertBillCancelRecyclerButton","setupImmediateButton","promoCodeCancelButton","bind","submitCodeButton","code","submitEmailButton","submitTextRequirementButton","nextFieldTextRequirementButton","previousFieldTextRequirementButton","val","setInputBox","cryptoButtons","is","wantedCoin","areYouSureCancel","areYouSureContinue","coinRedeem","otherLocale","cashInBox","cashOutBox","languageOverlay","cryptoOverlay","languageButtons","languageButtonJ","newLocale","buildCassetteButtonEvents","initDebug","targetButton","element","classList","special","contains","parentNode","callback","handler","add","remove","stopPropagation","preventDefault","shouldEnableTouch","buttonClass","buttonAction","actionData","newScreen","oldScreen","css","top","left","newView","state","delay","clearTermsConditionsTimeout","clearTermsConditionsAcceptanceDelay","reset","revertScreen","recs","requestedPage","networks","page","offset","remainingCount","len","Math","min","i","rec","bars","floor","strength","moreTxt","setUpDirectionElement","operator","active","name","email","phone","limits","component","hardLimitWeeks","hardLimitDays","hardLimitHours","model","versions","startsWith","continueButton","finishButton","disabled","states","$screen","startPage","acceptDisabled","cancel","accept","setTermsConditionsTimeout","setAcceptButtonDisabled","setTermsConditionsAcceptanceDelay","screen","acceptButton","prop","Boolean","delayTimer","isNaN","seconds","tmpbtn","clone","appendTo","width","outerWidth","clearInterval","resetTermsConditionsTimeout","scrollUp","div","updateButtonStyles","updatePageCounter","scrollTo","acceptedTerms","offsetHeight","style","ceil","textContent","scrollDown","buttonDown","buttonUp","setCountry","setPrimaryLocales","primaryLocales","primaryLocale","otherLanguageName","lang","lookupLocaleNames","nativeName","split","isArabic","isHebrew","translatePage","ex","elem","img","areArraysEqual","arr1","arr2","langMap","languageMappingList","language","localeNames","languages","sortedPrimaryLocales","filter","sort","a","b","langA","langB","englishName","localeCompare","l","toggleClass","_fee","fee","parseFloat","fixedFee","formatFiat","fiat","cryptoAtoms","scale","pow","displayScale","cryptoAmount","toNumber","cryptoDisplayCode","displayCode","updateCrypto","inserted","formatDenomination","denom","toLocaleString","useGrouping","maximumFractionDigits","minimumFractionDigits","_cassettes","numberOfButtons","activeCassettes","count","inactiveCassettes","allCassettes","concat","selectedCassettes","sortedCassettes","denomination","updateCassetteButtons","activeDenoms","children","fiatButtons","lastTouch","now","Date","cashButtonJ","hasClass","selector","formatCrypto","lookupDecimalChar","num","localized","splitNumber","localize","decimalChar","join","formatNumber","amount","fractionDigits","_rates","cryptoToFiat","rateStr","round","cashOutCryptoToFiat","qrize","color","lightning","size","image","_size","clientHeight","opts","crisp","fill","render","rounded","quiet","mPosX","mPosY","mSize","mode","kjua","txId","isPaperWallet","hasBills","bills","promoCodeApplied","formatAddressNoBreakLines","address","firstPart","replace","secondPart","formatAddress","toBr","currentAccepting","transition","x","y","reasonText","bill","errorMessages","transactionLimit","validatorError","lowBalance","str","_cryptoCode","cryptoCodeDisplay","base","messages","locales","Jed","reachFiatLimit","msg","isEmpty","txLimitReached","displayCrypto","decimalPlaces","unitScale","cryptoDisplay","BN","s","activeDenominations","fiatDisplay","eq","activeMap","toAddress","depositUrl","of","current","createElement","innerHTML","getElementsByTagName","appendChild","height","gcd","w","h","r","aspectRatioPt1","aspectRatioPt2","background","doTransition","cb","toShow","toShowOver","start","tl","TimelineMax","set","opacity","zIndex","to","onStart","pause","setupAnimation","isAr800","firstChild","removeChild","Two","fullscreen","Types","svg","autostart","elementId","interpret","ua","navigator","userAgent","match","chromiumVersion","chromeVersion","chromiumPlus73","chromePlus73","currentDiscount","successMessage","status","className","printing","success","message","failMessage","url"],"mappings":"AAAA;AACA;;;;AAEA,IAAMA,cAAcC,OAAOC,QAAP,CAAgBC,MAApC;AACA,IAAMC,SAAS,IAAIC,eAAJ,CAAoBL,YAAYM,SAAZ,CAAsB,CAAtB,CAApB,CAAf;AACA,IAAMC,SAASH,OAAOI,GAAP,CAAW,QAAX,CAAf;AACA,IAAMC,aAAaF,SAAS,MAAT,GAAkBH,OAAOI,GAAP,CAAW,OAAX,CAArC;AACA,IAAME,oBAAoB,SAA1B;AACA,IAAMC,mBAAmB,SAAzB;AACA,IAAMC,oBAAoB,CAA1B;;AAEA,IAAIC,aAAa,CAAjB;AACA,IAAIC,qBAAqB,CAAzB;AACA,IAAIC,cAAc,CAAlB;AACA,IAAIC,aAAa,CAAjB;AACA,IAAIC,cAAc,OAAlB;AACA,IAAIC,WAAW,IAAf;AACA,IAAIC,QAAQ,KAAZ;AACA,IAAIC,MAAM,IAAV;AACA,IAAIC,iBAAiB,IAArB;AACA,IAAIC,yBAAyB,IAA7B;AACA,IAAIC,oCAAoC,IAAxC;AACA,IAAIC,mCAAmC,IAAvC;AACA,IAAIC,cAAc,KAAlB;AACA,IAAIC,oBAAoB,IAAxB;AACA,IAAIC,gBAAgB,IAApB;;AAEA,IAAIC,WAAW,IAAf;AACA,IAAIC,SAAS,IAAb;AACA,IAAIC,gBAAgBC,SAAS,OAAT,KAAqB,IAAzC;AACA,IAAIC,aAAa,IAAjB;AACA,IAAIC,eAAe,IAAnB,C,CAAwB;AACxB,IAAIC,kBAAkB,EAAtB;AACA,IAAIC,YAAY,IAAhB;AACA,IAAIC,KAAJ;;AAEA,IAAIC,YAAJ;;AAEA,IAAIC,YAAY,KAAhB;AACA,IAAIC,YAAY,IAAhB;AACA,IAAIC,eAAe,IAAnB;AACA,IAAIC,gBAAgB,IAApB;AACA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,WAAxC,CAAoD,MAApD;AACA;AACF,SAAK,QAAL;AACE,UAAMwa,cAAc,OAAOnlB,OAAOsH,SAAP,CAAiB,+BAAjB,EAAkDkC,KAAlD,EAA3B;AACApH,cAAM2iB,SAAN,sBAAkCna,QAAlC,CAA2C,MAA3C;AACAxI,cAAM2iB,SAAN,uBAAmC1Y,IAAnC,CAAwC8Y,WAAxC;AACA/iB,cAAM2iB,SAAN,uBAAmCpa,WAAnC,CAA+C,MAA/C;AACAvI,cAAM2iB,SAAN,uBAAmCna,QAAnC,CAA4C,MAA5C;AACAxI,cAAM2iB,SAAN,wBAAoC1Y,IAApC,CAAyC8Y,WAAzC;AACA/iB,cAAM2iB,SAAN,wBAAoCpa,WAApC,CAAgD,MAAhD;AACAvI,cAAM2iB,SAAN,2BAAuCna,QAAvC,CAAgD,MAAhD;AACAxI,cAAM2iB,SAAN,4BAAwC1Y,IAAxC,CAA6C8Y,WAA7C;AACA/iB,cAAM2iB,SAAN,4BAAwCpa,WAAxC,CAAoD,MAApD;AACA;AApDJ;AAsDD;;AAED,SAASvB,kBAAT,CAA6Bgc,GAA7B,EAAkC;AAChCrH,QAAMqH,GAAN,EAAWhjB,EAAE,8BAAF,CAAX,EAA8CtC,kBAAkB,QAAlB,GAA6BhB,gBAA7B,GAAgDD,iBAA9F;AACA,SAAO8K,UAAU,qBAAV,CAAP;AACD","file":"app.js","sourcesContent":["/* globals $, URLSearchParams, WebSocket, locales, Keyboard, Keypad, Jed, BigNumber, HOST, PORT, Origami, kjua, TimelineMax, Two */\n'use strict'\n\nconst queryString = window.location.search\nconst params = new URLSearchParams(queryString.substring(1))\nconst SCREEN = params.get('screen')\nconst DEBUG_MODE = SCREEN ? 'demo' : params.get('debug')\nconst CASH_OUT_QR_COLOR = '#403c51'\nconst CASH_IN_QR_COLOR = '#0e4160'\nconst NUMBER_OF_BUTTONS = 3\n\nvar scrollSize = 0\nvar textHeightQuantity = 0\nvar currentPage = 0\nvar totalPages = 0\nvar aspectRatio = '16:10'\nvar isTwoWay = null\nvar isRTL = false\nvar two = null\nvar cryptomatModel = null\nvar termsConditionsTimeout = null\nvar termsConditionsAcceptanceInterval = null\nvar termsConditionsAcceptanceTimeout = null\nvar T_C_TIMEOUT = 30000\nvar complianceTimeout = null;\nvar cashDirection = null;\n\nvar fiatCode = null\nvar locale = null\nvar defaultLocale = loadI18n('en-US') || null\nvar localeCode = null\nvar jsLocaleCode = null // Sometimes slightly different than localeCode\nvar _primaryLocales = []\nvar lastRates = null\nvar coins\n\nvar currentState\n\nvar accepting = false\nvar websocket = null\nvar wifiKeyboard = null\nvar promoKeyboard = null\nvar usSsnKeypad = null\nvar phoneKeypad = null\nvar securityKeypad = null\nvar previousState = null\nvar buttonActive = true\nvar cassettes = null\nlet currentCryptoCode = null\nlet currentCoin = null\nlet currentCoins = []\nlet emailKeyboard = null\nlet customRequirementNumericalKeypad = null\nlet customRequirementTextKeyboard = null\nlet customRequirementChoiceList = null\n\nvar MUSEO = ['ca', 'cs', 'da', 'de', 'en', 'es', 'et', 'fi', 'fr', 'hr',\n 'hu', 'it', 'lt', 'nb', 'nl', 'pl', 'pt', 'ro', 'sl', 'sv', 'tr']\n\nfunction connect () {\n console.log(`ws://${HOST}:${PORT}/`)\n websocket = new WebSocket(`ws://${HOST}:${PORT}/`)\n websocket.onmessage = function (event) {\n var data = $.parseJSON(event.data)\n processData(data)\n }\n websocket.onerror = err => console.log(err)\n}\n\nfunction verifyConnection () {\n if (websocket.readyState === websocket.CLOSED) {\n connect()\n }\n}\n\nfunction buttonPressed (button, data) {\n if (!buttonActive) return\n wifiKeyboard.deactivate()\n promoKeyboard.deactivate()\n emailKeyboard.deactivate()\n customRequirementTextKeyboard.deactivate()\n buttonActive = false\n setTimeout(function () {\n buttonActive = true\n wifiKeyboard.activate()\n promoKeyboard.activate()\n emailKeyboard.activate()\n customRequirementTextKeyboard.activate()\n }, 300)\n var res = { button: button }\n if (data || data === null) res.data = data\n if (websocket) websocket.send(JSON.stringify(res))\n}\n\nconst displayLN = 'Lightning Network'\nconst displayBTC = 'Bitcoin
(LN)'\nconst LN = 'LN'\nconst BTC = 'BTC'\n\nfunction processData (data) {\n if (data.localeInfo) setLocaleInfo(data.localeInfo)\n if (data.locale) setLocale(data.locale)\n if (data.supportedCoins) setCoins(data.supportedCoins)\n if (!locale) return\n if (data.fiatCode) setFiatCode(data.fiatCode)\n if (data.rates) setExchangeRate(data.rates)\n if (data.buyerAddress) setBuyerAddress(data.buyerAddress)\n if (data.credit) {\n var lastBill = data.action === 'rejectedBill' ? null : data.credit.lastBill\n setCredit(data.credit, lastBill)\n }\n if (data.tx) setTx(data.tx)\n if (data.wifiList) setWifiList(data.wifiList)\n if (data.wifiSsid) setWifiSsid(data.wifiSsid)\n if (data.sendOnly) sendOnly(data.reason)\n if (data.fiatCredit) fiatCredit(data.fiatCredit)\n if (data.depositInfo) setDepositAddress(data.depositInfo)\n if (data.version) setVersion(data.version)\n if (data.cassettes) buildCassetteButtons(data.cassettes, NUMBER_OF_BUTTONS)\n if (data.sent && data.total) setPartialSend(data.sent, data.total)\n if (data.readingBills) readingBills(data.readingBills)\n if (data.cryptoCode) translateCoin(data.cryptoCode)\n if (data.tx && data.tx.cashInFee) setFixedFee(data.tx.cashInFee)\n if (data.terms) setTermsScreen(data.terms)\n if (data.dispenseBatch) dispenseBatch(data.dispenseBatch)\n if (data.direction) setDirection(data.direction)\n if (data.operatorInfo) setOperatorInfo(data.operatorInfo)\n if (data.hardLimit) setHardLimit(data.hardLimit)\n if (data.cryptomatModel) setCryptomatModel(data.cryptomatModel)\n if (data.areThereAvailablePromoCodes !== undefined) setAvailablePromoCodes(data.areThereAvailablePromoCodes)\n\n if (data.tx && data.tx.discount) setCurrentDiscount(data.tx.discount)\n if (data.receiptStatus) setReceiptPrint(data.receiptStatus, null)\n if (data.smsReceiptStatus) setReceiptPrint(null, data.smsReceiptStatus)\n\n if (data.context) {\n $('.js-context').hide()\n $('.js-context-' + data.context).show()\n }\n\n const isRecycler = billValidator => {\n return billValidator === 'HCM2'\n }\n\n switch (data.action) {\n case 'wifiList':\n if (cryptomatModel === 'douro1') {\n setState('wifi')\n } else {\n setState('connect_ethernet')\n }\n break\n case 'wifiPass':\n setState('wifi_password')\n break\n case 'wifiConnecting':\n t('wifi-connecting', translate('This could take a few moments.'))\n setState('wifi_connecting')\n break\n case 'wifiConnected':\n t('wifi-connecting', translate('Connected. Waiting for ticker.'))\n setState('wifi_connecting') // in case we didn't go through wifi-connecting\n break\n case 'pairing':\n setState('pairing')\n break\n case 'pairingError':\n $('.js-pairing-error').text(data.err)\n // Give it some time to update text in background\n setTimeout(function () { setState('pairing_error') }, 500)\n break\n case 'booting':\n if (currentState !== 'maintenance') setState('booting')\n break\n case 'idle':\n case 'fakeIdle':\n setState('idle')\n break\n case 'dualIdle':\n case 'fakeDualIdle':\n setState('dual_idle')\n break\n case 'registerUsSsn':\n usSsnKeypad.activate()\n setState('register_us_ssn')\n setComplianceTimeout(null, 'finishBeforeSms')\n break\n case 'registerPhone':\n phoneKeypad.activate()\n setState('register_phone')\n break\n case 'registerEmail':\n emailKeyboard.setConstraint('email', ['#submit-email'])\n setState('register_email')\n break\n case 'securityCode':\n securityKeypad.activate()\n setState('security_code')\n break\n case 'scanned':\n isRecycler(data.billValidator)\n ? setState('insert_first_bills_recycler')\n : setState('insert_bills')\n break\n case 'acceptingFirstBill':\n $('.js-send-crypto-enable').show()\n setState('insert_bills')\n break\n case 'acceptingBills':\n $('.blocked-customer-top').hide()\n setState('insert_more_bills')\n break\n case 'acceptingFirstRecyclerBills':\n $('.js-continue-crypto-enable').show()\n $('.js-send-crypto-enable').show()\n setState('insert_first_bills_recycler')\n break\n case 'recyclerContinue':\n disableRecyclerBillButtons()\n break;\n case 'acceptingRecyclerBills':\n enableRecyclerBillButtons()\n $('.blocked-customer-top').hide()\n setState('insert_bills_recycler')\n break\n case 'acceptingBill':\n setAccepting(true)\n break\n case 'rejectedBill':\n setAccepting(false)\n break\n case 'cryptoTransferPending':\n setState('sending_coins')\n break\n case 'cryptoTransferComplete':\n setState('completed')\n break\n case 'networkDown':\n setState('trouble')\n break\n case 'balanceLow':\n setState('limit_reached')\n break\n case 'insufficientFunds':\n setState('out_of_coins')\n break\n case 'highBill':\n highBill(data.highestBill, data.reason)\n break\n case 'minimumTx':\n minimumTx(data.lowestBill)\n break\n case 'chooseFiat':\n if (data.isCashInOnlyCoin) {\n setState('cash_in_only_coin')\n break\n }\n chooseFiat(data.chooseFiat)\n break\n case 'deposit':\n setState('deposit')\n deposit(data.tx)\n break\n case 'rejectedDeposit':\n setState('deposit_timeout')\n break\n case 'fiatReceipt':\n fiatReceipt(data.tx)\n break\n case 'fiatComplete':\n fiatComplete(data.tx)\n break\n case 'restart':\n setState('restart')\n break\n case 'chooseCoin':\n chooseCoin(data.coins, data.twoWayMode)\n break\n case 'smsVerification':\n smsVerification(data.threshold)\n break\n case 'emailVerification':\n emailVerification(data.threshold);\n break;\n case 'permission_id':\n idVerification()\n break\n case 'permission_face_photo':\n facephotoPermission()\n break\n case 'usSsnPermission':\n usSsnPermission()\n break\n case 'externalPermission':\n externalPermission()\n break\n case 'blockedCustomer':\n blockedCustomer()\n break\n case 'insertPromoCode':\n promoKeyboard.activate()\n setState('insert_promo_code')\n break\n case 'invalidPromoCode':\n setState('promo_code_not_found')\n break\n case 'customInfoRequestPermission':\n customInfoRequestPermission(data.customInfoRequest)\n break\n case 'inputCustomInfoRequest':\n customInfoRequest(data.customInfoRequest)\n break\n case 'actionRequiredMaintenance':\n setState('action_required_maintenance')\n break\n case 'cashSlotRemoveBills':\n setState('cash_slot_remove_bills')\n break\n case 'leftoverBillsInCashSlot':\n setState('leftover_bills_in_cash_slot')\n break\n case 'invalidAddress':\n invalidAddress(data.lnInvoiceTypeError)\n break\n case 'externalCompliance':\n externalCompliance(data.externalComplianceUrl)\n break\n default:\n if (data.action) setState(window.snakecase(data.action))\n }\n}\n\nfunction translate (data, fetchArgs) {\n if (data === \"\")\n return data\n\n try {\n return fetchArgs\n ? locale.translate(data).fetch(...fetchArgs)\n : locale.translate(data).fetch()\n } catch (error) {\n if (!defaultLocale) console.error('Error while translating: ', error)\n else {\n try {\n return fetchArgs\n ? defaultLocale.translate(data).fetch(...fetchArgs)\n : defaultLocale.translate(data).fetch()\n } catch (e) {\n console.error('Error while translating: ', e)\n return data\n }\n }\n }\n}\n\nfunction facephotoPermission () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('permission_face_photo')\n}\n\nfunction usSsnPermission () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('us_ssn_permission')\n}\n\nfunction externalPermission () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('external_permission')\n}\n\nfunction customInfoRequestPermission (customInfoRequest) {\n $('#custom-screen1-title').text(customInfoRequest.screen1.title)\n $('#custom-screen1-text').text(customInfoRequest.screen1.text)\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('custom_permission')\n}\n\nfunction setComplianceTimeout (interval, complianceButton) {\n clearTimeout(complianceTimeout)\n\n if (interval === 0) {\n return\n }\n\n complianceTimeout = setTimeout(function () {\n buttonPressed(complianceButton)\n }, interval == null ? 60000 : interval)\n}\n\nfunction invalidAddress (lnInvoiceTypeError) {\n if (lnInvoiceTypeError) {\n $('#invalid-address').hide()\n $('#invalid-invoice').show()\n } else {\n $('#invalid-invoice').hide()\n $('#invalid-address').show()\n }\n setState('invalid_address')\n}\n\nfunction customInfoRequest (customInfoRequest) {\n switch (customInfoRequest.input.type) {\n case 'numerical':\n $('#custom-screen2-numerical-title').text(customInfoRequest.screen2.title)\n $('#custom-screen2-numerical-text').text(customInfoRequest.screen2.text)\n customRequirementNumericalKeypad.setOpts({\n type: 'custom',\n constraint: customInfoRequest.input.constraintType,\n maxLength: customInfoRequest.input.numDigits\n })\n customRequirementNumericalKeypad.activate()\n setState('custom_permission_screen2_numerical')\n setScreen('custom_permission_screen2_numerical')\n setComplianceTimeout(null, 'cancelCustomInfoRequest')\n break\n case 'text':\n $('#custom-requirement-text-label1').text(customInfoRequest.input.label1)\n $('#custom-requirement-text-label2').text(customInfoRequest.input.label2)\n $('#previous-text-requirement').hide()\n $('#submit-text-requirement').hide()\n $('#next-text-requirement').hide()\n $('#optional-text-field-2').hide()\n $('.key.backspace.standard-backspace-key').removeClass('backspace-margin-left-override')\n $('.custom-info-request-space-key').show()\n // set type of constraint and buttons where that constraint should apply to disable/ enable\n customRequirementTextKeyboard.setConstraint(customInfoRequest.input.constraintType, ['#submit-text-requirement'])\n if (customInfoRequest.input.constraintType === 'spaceSeparation') {\n $('#optional-text-field-2').show()\n $('.key.backspace.standard-backspace-key').addClass('backspace-margin-left-override')\n $('.custom-info-request-space-key').hide()\n customRequirementTextKeyboard.setConstraint(customInfoRequest.input.constraintType, ['#next-text-requirement'])\n }\n setState('custom_permission_screen2_text')\n setScreen('custom_permission_screen2_text')\n setComplianceTimeout(null, 'cancelCustomInfoRequest')\n break\n case 'choiceList':\n $('#custom-screen2-choiceList-title').text(customInfoRequest.screen2.title)\n $('#custom-screen2-choiceList-text').text(customInfoRequest.screen2.text)\n customRequirementChoiceList.replaceChoices(customInfoRequest.input.choiceList, customInfoRequest.input.constraintType)\n setState('custom_permission_screen2_choiceList')\n setScreen('custom_permission_screen2_choiceList')\n setComplianceTimeout(null, 'cancelCustomInfoRequest')\n break\n default:\n return blockedCustomer()\n }\n}\n\nfunction idVerification () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('permission_id')\n}\n\nfunction smsVerification (threshold) {\n console.log('sms threshold to be displayed', threshold)\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('sms_verification')\n}\n\nfunction emailVerification(threshold) {\n setComplianceTimeout(null, 'finishBeforeSms');\n setScreen('email_verification');\n}\n\nfunction blockedCustomer () {\n return setScreen('blocked_customer')\n}\n\nfunction chooseCoin (coins, twoWayMode) {\n if (twoWayMode) {\n $('.choose_coin_state').removeClass('choose-coin-cash-in').addClass('choose-coin-two-way')\n } else {\n $('.choose_coin_state').removeClass('choose-coin-two-way').addClass('choose-coin-cash-in')\n }\n\n isTwoWay = twoWayMode\n setChooseCoinColors()\n // setupAnimation(twoWayMode, aspectRatio800)\n\n const defaultCoin = coins[0]\n\n currentCryptoCode = defaultCoin.cryptoCode\n currentCoin = defaultCoin\n currentCoins = coins.slice(0)\n\n setCryptoBuy(defaultCoin)\n setCryptoSell(defaultCoin)\n\n setupCoinsButtons(coins, currentCryptoCode)\n\n setState('choose_coin')\n}\n\nfunction openLanguageDropdown () {\n $('#language-dropdown-toggle').addClass('hide')\n $('#languages').removeClass('hide')\n $('#language-overlay').removeClass('hide')\n}\n\nfunction closeLanguageDropdown () {\n $('#language-dropdown-toggle').removeClass('hide')\n $('#languages').addClass('hide')\n $('#language-overlay').addClass('hide')\n}\n\nfunction openCoinDropdown () {\n $('#crypto-dropdown-toggle').addClass('hide')\n $('#crypto-overlay').removeClass('hide')\n $('#cryptos').removeClass('hide')\n}\n\nfunction closeCoinDropdown () {\n $('#crypto-dropdown-toggle').removeClass('hide')\n $('#crypto-overlay').addClass('hide')\n $('#cryptos').addClass('hide')\n}\n\nfunction setupCoinsButtons () {\n $('.crypto-buttons').empty()\n closeCoinDropdown()\n\n let coins = currentCoins.slice()\n let dropdownCoins = []\n\n if (coins.length === 1) return\n\n const showMoreButton = coins.length > 4\n if (showMoreButton) {\n $('crypto-dropdown-toggle').removeClass('hide')\n dropdownCoins = coins.slice(3)\n coins = coins.slice(0, 3)\n } else {\n $('crypto-dropdown-toggle').addClass('hide')\n }\n\n coins.forEach(function (coin) {\n const activeClass = coin.cryptoCode === currentCryptoCode ? 'choose-coin-button-active' : ''\n const el = `
\n ${coin.display}\n \n \n \n \n \n
`\n $('.crypto-buttons').append(el)\n })\n if (showMoreButton) {\n $('.crypto-buttons').append(`\n
\n
\n ${translate('More')}\n \n \n \n \n \n
\n
\n
\n `)\n dropdownCoins.forEach(coin => {\n const el = ``\n $('#cryptos').append(el)\n })\n const el = ``\n $('#cryptos').append(el)\n // As we add buttons 'more' and 'less' after initTranslate\n // they don't have baseTranslation translation data attached to them.\n $('.crypto-buttons .js-i18n').each(function () {\n var el = $(this)\n el.data('baseTranslation', el.html().trim())\n })\n }\n}\n\nfunction setCryptoBuy (coin) {\n const cashIn = $('.cash-in')\n const translatedCoin = translate(coin.display === displayLN ? displayBTC : coin.display)\n const buyStr = translate('Buy
%s', [translatedCoin])\n\n cashIn.html(buyStr)\n}\n\nfunction setCryptoSell (coin) {\n const cashOut = $('.cash-out')\n const translatedCoin = translate(coin.display === displayLN ? displayBTC : coin.display)\n const sellStr = translate('Sell
%s', [translatedCoin])\n\n cashOut.html(sellStr)\n}\n\nfunction setCoins (supportedCoins) {\n coins = supportedCoins\n}\n\nfunction getCryptoCurrency (cryptoCode) {\n const cryptoCurrency = coins.find(c => c.cryptoCode === cryptoCode)\n if (!cryptoCurrency) throw new Error(`Unsupported crypto: ${cryptoCode}`)\n return cryptoCurrency\n}\n\nfunction switchCoin (coin) {\n const cashIn = $('.cash-in')\n const cashOut = $('.cash-out')\n const cryptoCode = coin.cryptoCode\n\n if (currentCryptoCode === cryptoCode) return\n\n $(`.coin-${currentCryptoCode.toLowerCase()}`).removeClass('choose-coin-button-active')\n $(`.coin-${cryptoCode.toLowerCase()}`).addClass('choose-coin-button-active')\n currentCryptoCode = cryptoCode\n currentCoin = coin\n\n cashIn.addClass('crypto-switch')\n setTimeout(() => setCryptoBuy(coin), 100)\n setTimeout(() => cashIn.removeClass('crypto-switch'), 1000)\n\n setTimeout(() => {\n cashOut.addClass('crypto-switch')\n setTimeout(() => setCryptoSell(coin), 100)\n setTimeout(() => cashOut.removeClass('crypto-switch'), 1000)\n }, 80)\n\n const selectedIndex = currentCoins.indexOf(currentCoins.find(it => it.cryptoCode === cryptoCode))\n if (currentCoins.length > 4 && selectedIndex > 2) {\n currentCoins.splice(2, 0, currentCoins.splice(selectedIndex, 1)[0])\n }\n\n setupCoinsButtons()\n}\n\n$(document).ready(function () {\n const attachFastClick = Origami.fastclick\n attachFastClick(document.body)\n\n window.addEventListener('resize', () => {\n calculateAspectRatio()\n setChooseCoinColors()\n })\n\n // Matt's anti-drag hack\n window.onclick =\n window.oncontextmenu =\n window.onmousedown =\n window.onmousemove =\n window.onmouseup =\n function () { return false }\n\n BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_HALF_EVEN })\n\n wifiKeyboard = new Keyboard({\n id: 'wifi-keyboard',\n inputBox: '#input-passphrase'\n }).init()\n\n promoKeyboard = new Keyboard({\n id: 'promo-keyboard',\n inputBox: '.promo-code-input'\n }).init(function () {\n if (currentState !== 'insert_promo_code') return\n buttonPressed('cancelPromoCode')\n })\n\n usSsnKeypad = new Keypad('us-ssn-keypad', { type: 'usSsn' }, function (result) {\n if (currentState !== 'register_us_ssn') return\n buttonPressed('usSsn', result)\n })\n\n phoneKeypad = new Keypad('phone-keypad', { type: 'phoneNumber', country: 'US' }, function (result) {\n if (currentState !== 'register_phone') return\n buttonPressed('phoneNumber', result)\n })\n\n securityKeypad = new Keypad('security-keypad', { type: 'code' }, function (result) {\n if (currentState !== 'security_code') return\n buttonPressed('securityCode', result)\n })\n\n customRequirementNumericalKeypad = new Keypad('custom-requirement-numeric-keypad', {\n type: 'custom'\n }, function (result) {\n if (currentState !== 'custom_permission_screen2_numerical') return\n buttonPressed('customInfoRequestSubmit', result)\n })\n\n emailKeyboard = new Keyboard({\n id: 'email-keyboard',\n inputBox: '#email-input',\n submitButtonWrapper: '#submit-email-wrapper',\n setComplianceTimeout: setComplianceTimeout\n }).init(function (result) {\n if (currentState !== 'register_email') return\n buttonPressed('email', result)\n })\n\n customRequirementTextKeyboard = new Keyboard({\n id: 'custom-requirement-text-keyboard',\n inputBox: '.text-input-field-1',\n submitButtonWrapper: '.submit-text-requirement-button-wrapper',\n setComplianceTimeout: setComplianceTimeout\n }).init(function () {\n if (currentState !== 'custom_permission_screen2_text') return\n buttonPressed('customInfoRequestSubmit')\n })\n\n customRequirementChoiceList = new ChoiceList({\n id: 'custom-requirement-choicelist-wrapper',\n setComplianceTimeout: setComplianceTimeout\n }).init(function (result) {\n if (currentState !== 'custom_permission_screen2_choiceList') return\n buttonPressed('customInfoRequestSubmit', result)\n })\n\n if (DEBUG_MODE !== 'demo') {\n connect()\n setInterval(verifyConnection, 1000)\n }\n\n initTranslatePage()\n\n var wifiNetworkButtons = document.getElementById('networks')\n touchEvent(wifiNetworkButtons, function (e) {\n var target = $(e.target)\n if (target.attr('id') === 'more-networks') {\n moreNetworks()\n } else {\n var networkButton = target.closest('.wifi-network-button')\n $('#networks > .active').removeClass('active')\n networkButton.addClass('active')\n window.setTimeout(function () { networkButton.removeClass('active') }, 1000)\n var ssidEl = networkButton.find('.ssid')\n var ssid = ssidEl.data('ssid')\n if (ssid) {\n var displaySsid = ssidEl.text()\n var rawSsid = ssidEl.data('raw-ssid')\n buttonPressed('wifiSelect',\n { ssid: ssid, rawSsid: rawSsid, displaySsid: displaySsid })\n }\n }\n })\n\n var wifiConnectButton = document.getElementById('wifiConnect')\n touchEvent(wifiConnectButton, function () {\n var wifiConnectButtonJ = $(wifiConnectButton)\n wifiConnectButtonJ.addClass('active')\n window.setTimeout(function () { wifiConnectButtonJ.removeClass('active') }, 500)\n var pass = $('#wifi-keyboard input.passphrase').data('content')\n var ssid = $('#js-i18n-wifi-for-ssid').data('ssid')\n var rawSsid = $('#js-i18n-wifi-for-ssid').data('raw-ssid')\n buttonPressed('wifiConnect', { pass: pass, ssid: ssid, rawSsid: rawSsid })\n })\n\n var sendCoinsButton = document.getElementById('send-coins')\n var sendCoinsButton2 = document.getElementById('send-only-send-coins')\n touchEvent(sendCoinsButton, function () {\n setState('sending_coins')\n buttonPressed('sendCoins')\n })\n\n touchEvent(sendCoinsButton2, function () {\n setState('sending_coins')\n buttonPressed('sendCoins')\n })\n\n setupButton('recycler-continue-start', 'recyclerContinue')\n setupButton('recycler-continue', 'recyclerContinue')\n setupButton('recycler-finish', 'sendCoins')\n setupButton('cash-slot-bills-removed', 'cashSlotBillsRemoved')\n setupButton('leftover-bills-removed', 'leftoverBillsRemoved')\n\n const blockedCustomerOk = document.getElementById('blocked-customer-ok')\n touchEvent(blockedCustomerOk, function () {\n buttonPressed('blockedCustomerOk')\n })\n var insertBillCancelButton = document.getElementById('insertBillCancel')\n touchImmediateEvent(insertBillCancelButton, function () {\n setBuyerAddress(null)\n buttonPressed('cancelInsertBill')\n })\n\n var insertBillCancelRecyclerButton = document.getElementById('insertBillCancelRecycler')\n touchImmediateEvent(insertBillCancelRecyclerButton, function () {\n setBuyerAddress(null)\n buttonPressed('cancelInsertBill')\n })\n\n setupImmediateButton('wifiPassCancel', 'cancelWifiPass')\n setupImmediateButton('scanCancel', 'cancelScan')\n setupImmediateButton('completed_viewport', 'completed')\n setupImmediateButton('withdraw_failure_viewport', 'completed')\n setupImmediateButton('out_of_coins_viewport', 'completed')\n setupImmediateButton('fiat_receipt_viewport', 'completed')\n setupImmediateButton('fiat_complete_viewport', 'completed')\n setupImmediateButton('chooseFiatCancel', 'chooseFiatCancel')\n setupImmediateButton('depositCancel', 'depositCancel')\n setupImmediateButton('printer-scan-cancel', 'cancelScan')\n\n setupButton('printer-back-to-home', 'idle')\n setupButton('printer-print-again', 'printAgain')\n setupButton('printer-print-again2', 'printAgain')\n setupButton('printer-scan-again', 'printerScanAgain')\n\n setupButton('insert-first-bill-promo-button', 'insertPromoCode')\n setupButton('insert-first-recycler-bills-promo-button', 'insertPromoCode')\n setupButton('choose-fiat-promo-button', 'insertPromoCode')\n\n var promoCodeCancelButton = document.getElementById('promo-code-cancel')\n touchImmediateEvent(promoCodeCancelButton, function () {\n promoKeyboard.deactivate.bind(promoKeyboard)\n buttonPressed('cancelPromoCode')\n })\n\n var submitCodeButton = document.getElementById('submit-promo-code')\n touchEvent(submitCodeButton, function () {\n promoKeyboard.deactivate.bind(promoKeyboard)\n var code = $('.promo-code-input').data('content')\n buttonPressed('submitPromoCode', { input: code })\n })\n\n const submitEmailButton = document.getElementById('submit-email')\n const submitTextRequirementButton = document.getElementById('submit-text-requirement')\n const nextFieldTextRequirementButton = document.getElementById('next-text-requirement')\n const previousFieldTextRequirementButton = document.getElementById('previous-text-requirement')\n touchEvent(submitEmailButton, function () {\n emailKeyboard.deactivate.bind(emailKeyboard)\n var text = $('#email-input').data('content')\n buttonPressed('email', text)\n $('#email-input').data('content', '').val('')\n emailKeyboard.setInputBox('#email-input')\n })\n touchEvent(submitTextRequirementButton, function () {\n customRequirementTextKeyboard.deactivate.bind(customRequirementTextKeyboard)\n var text = `${$('.text-input-field-1').data('content')} ${$('.text-input-field-2').data('content') || ''}`\n buttonPressed('customInfoRequestSubmit', text)\n $('.text-input-field-1').removeClass('faded').data('content', '').val('')\n $('.text-input-field-2').addClass('faded').data('content', '').val('')\n customRequirementTextKeyboard.setInputBox('.text-input-field-1')\n })\n touchEvent(nextFieldTextRequirementButton, function() {\n $('.text-input-field-1').addClass('faded')\n $('.text-input-field-2').removeClass('faded')\n $('#next-text-requirement').hide()\n $('#previous-text-requirement').show()\n $('#submit-text-requirement').show()\n // changing input box changes buttons where validation works on\n customRequirementTextKeyboard.setInputBox('.text-input-field-2', ['#submit-text-requirement'])\n })\n touchEvent(previousFieldTextRequirementButton, function() {\n $('.text-input-field-1').removeClass('faded')\n $('.text-input-field-2').addClass('faded')\n $('#next-text-requirement').show()\n $('#previous-text-requirement').hide()\n $('#submit-text-requirement').hide()\n customRequirementTextKeyboard.setInputBox('.text-input-field-1', ['#next-text-requirement'])\n })\n\n setupButton('submit-promo-code', 'submitPromoCode', {\n input: $('.promo-code-input').data('content')\n })\n setupButton('promo-code-try-again', 'insertPromoCode')\n setupButton('promo-code-continue', 'cancelPromoCode')\n\n setupButton('initialize', 'initialize')\n setupButton('pairing-scan', 'pairingScan')\n setupImmediateButton('pairing-scan-cancel', 'pairingScanCancel')\n setupButton('pairing-error-ok', 'pairingErrorOk')\n setupButton('cash-out-button', 'cashOut')\n\n setupImmediateButton('scan-id-cancel', 'idDataActionCancel')\n setupImmediateButton('scan-photo-cancel', 'idPhotoActionCancel')\n setupImmediateButton('scan-photo-manual-cancel', 'idPhotoActionCancel')\n setupImmediateButton('us-ssn-cancel', 'cancelUsSsn',\n usSsnKeypad.deactivate.bind(usSsnKeypad))\n setupImmediateButton('phone-number-cancel', 'cancelPhoneNumber',\n phoneKeypad.deactivate.bind(phoneKeypad))\n setupImmediateButton('security-code-cancel', 'cancelSecurityCode',\n securityKeypad.deactivate.bind(securityKeypad))\n setupButton('id-verification-failed-ok', 'idVerificationFailedOk')\n setupButton('id-scan-failed-try-again', 'idCodeFailedRetry')\n setupButton('id-scan-failed-cancel', 'idVerificationFailedOk')\n setupButton('id-code-failed-retry', 'idCodeFailedRetry')\n setupButton('id-code-failed-cancel', 'bye')\n setupButton('id-verification-error-ok', 'idVerificationErrorOk')\n setupButton('photo-scan-failed-retry', 'retryPhotoScan')\n setupButton('photo-scan-failed-cancel', 'photoScanVerificationCancel')\n setupButton('photo-verification-failed-ok', 'cancelIdScan')\n setupButton('invalid-address-try-again', 'invalidAddressTryAgain')\n setupButton('address-reuse-start-over', 'idle')\n setupButton('suspicious-address-start-over', 'idle')\n\n setupButton('sanctions-failure-ok', 'idle')\n setupButton('limit-reached-ok', 'idle')\n setupButton('hard-limit-reached-ok', 'idle')\n setupButton('deposit-timeout-sent-yes', 'depositTimeout')\n setupButton('deposit-timeout-sent-no', 'depositTimeoutNotSent')\n setupButton('out-of-cash-ok', 'idle')\n setupButton('cash-in-disabled-ok', 'idle')\n setupButton('cash-in-only-ok', 'idle')\n\n setupButton('bad-phone-number-ok', 'badPhoneNumberOk')\n setupButton('bad-security-code-ok', 'badSecurityCodeOk')\n setupButton('max-phone-retries-ok', 'maxPhoneRetriesOk')\n //setupButton('max-email-retries-ok', 'maxEmailRetriesOk')\n setupButton('redeem-later-ok', 'idle')\n setupButton('pre-receipt-ok', 'fiatReceipt')\n setupButton('fiat-error-ok', 'idle')\n setupButton('network-down-ok', 'idle')\n setupButton('fiat-transaction-error-ok', 'fiatReceipt')\n\n setupButton('unknown-phone-number-ok', 'idle')\n setupButton('unknown-email-ok', 'idle')\n setupButton('unconfirmed-deposit-ok', 'idle')\n setupButton('tx-not-seen-ok', 'idle')\n setupButton('wrong-dispenser-currency-ok', 'idle')\n\n setupButton('print-receipt-cash-in-button', 'printReceipt')\n setupButton('print-receipt-cash-out-button', 'printReceipt')\n setupButton('print-receipt-cash-in-fail-button', 'printReceipt')\n\n setupButton('send-sms-receipt-cash-in-button', 'sendSmsReceipt')\n setupButton('send-sms-receipt-cash-out-button', 'sendSmsReceipt')\n setupButton('send-sms-receipt-cash-in-fail-button', 'sendSmsReceipt')\n\n setupButton('terms-ok', 'termsAccepted')\n setupButton('terms-ko', 'idle')\n\n setupButton('maintenance_restart', 'maintenanceRestart')\n\n calculateAspectRatio()\n\n const cryptoButtons = document.getElementById('crypto-buttons')\n touchEvent(cryptoButtons, event => {\n let el = $(event.target)\n if (el.is('path') || el.is('svg') || el.is('span')) {\n el = el.closest('div')\n }\n\n if (el.data('more')) {\n openCoinDropdown()\n return\n }\n\n if (el.data('less')) {\n closeCoinDropdown()\n return\n }\n\n const cryptoCode = el.data('cryptoCode')\n if (!cryptoCode) return\n\n const wantedCoin = currentCoins.find(it => it.cryptoCode === cryptoCode)\n if (!wantedCoin) return\n\n const coin = { cryptoCode, display: wantedCoin.display === displayLN ? displayBTC : wantedCoin.display }\n switchCoin(coin)\n })\n\n var areYouSureCancel = document.getElementById('are-you-sure-cancel-transaction')\n touchEvent(areYouSureCancel, () => buttonPressed('cancelTransaction', previousState))\n\n var areYouSureContinue = document.getElementById('are-you-sure-continue-transaction')\n touchEvent(areYouSureContinue, () => buttonPressed('continueTransaction', previousState))\n\n var coinRedeem = document.getElementById('coin-redeem-button')\n touchEvent(coinRedeem, () => {\n setDirection('cashOut')\n buttonPressed('redeem')\n })\n\n setupButton('facephoto-scan-failed-retry', 'retryFacephoto')\n setupButton('id-start-verification', 'permissionIdCompliance')\n setupButton('sms-start-verification', 'permissionSmsCompliance')\n setupButton('email-start-verification', 'permissionEmailCompliance');\n setupButton('ready-to-scan-id-card-photo', 'scanIdCardPhoto')\n setupButton('facephoto-permission-yes', 'permissionPhotoCompliance')\n setupButton('us-ssn-permission-yes', 'permissionUsSsnCompliance')\n setupButton('external-permission-yes', 'permissionExternalCompliance')\n\n setupButton('send-coins-id', 'finishBeforeSms')\n setupButton('send-coins-id-2', 'finishBeforeSms')\n setupButton('send-coins-sms', 'finishBeforeSms')\n setupButton('send-coins-sms-2', 'finishBeforeSms')\n setupButton('send-coins-email', 'finishBeforeSms');\n setupButton('send-coins-email-2', 'finishBeforeSms');\n\n setupButton('facephoto-permission-no', 'finishBeforeSms')\n setupButton('us-ssn-permission-send-coins', 'finishBeforeSms')\n setupButton('us-ssn-permission-cancel', 'finishBeforeSms')\n setupButton('us-ssn-cancel', 'finishBeforeSms')\n setupButton('external-permission-send-coins', 'finishBeforeSms')\n setupButton('facephoto-scan-failed-cancel', 'finishBeforeSms')\n setupButton('facephoto-scan-failed-cancel2', 'finishBeforeSms')\n\n setupButton('custom-permission-yes', 'permissionCustomInfoRequest')\n setupButton('custom-permission-no', 'finishBeforeSms')\n setupImmediateButton('custom-permission-cancel-numerical', 'cancelCustomInfoRequest', () => {\n customRequirementNumericalKeypad.deactivate.bind(customRequirementNumericalKeypad)\n })\n setupImmediateButton('email-cancel', 'cancelEmail', () => {\n emailKeyboard.deactivate.bind(emailKeyboard)\n $('#email-input').data('content', '').val('')\n emailKeyboard.setInputBox('#email-input')\n })\n setupImmediateButton('custom-permission-cancel-text', 'cancelCustomInfoRequest', () => {\n customRequirementTextKeyboard.deactivate.bind(customRequirementTextKeyboard)\n $('.text-input-field-1').removeClass('faded').data('content', '').val('')\n $('.text-input-field-2').addClass('faded').data('content', '').val('')\n customRequirementTextKeyboard.setInputBox('.text-input-field-1')\n })\n setupImmediateButton('custom-permission-cancel-choiceList', 'cancelCustomInfoRequest', () => {\n })\n\n setupButton('custom-permission-yes', 'permissionCustomInfoRequest')\n setupButton('custom-permission-no', 'finishBeforeSms')\n setupImmediateButton('custom-permission-cancel-numerical', 'cancelCustomInfoRequest', () => {\n customRequirementNumericalKeypad.deactivate.bind(customRequirementNumericalKeypad)\n })\n setupImmediateButton('custom-permission-cancel-text', 'cancelCustomInfoRequest', () => {\n customRequirementTextKeyboard.deactivate.bind(customRequirementTextKeyboard)\n $('.text-input-field-1').removeClass('faded').data('content', '').val('')\n $('.text-input-field-2').addClass('faded').data('content', '').val('')\n customRequirementTextKeyboard.setInputBox('.text-input-field-1')\n })\n\n setupButton('external-validation-ok', 'finishBeforeSms')\n\n touchEvent(document.getElementById('change-language-section'), () => {\n if (_primaryLocales.length === 2) {\n setLocale(otherLocale())\n setCryptoBuy(currentCoin)\n setCryptoSell(currentCoin)\n return\n }\n openLanguageDropdown()\n })\n\n const cashInBox = document.getElementById('cash-in-box')\n touchEvent(cashInBox, () => {\n buttonPressed('start', { cryptoCode: currentCryptoCode, direction: 'cashIn' })\n })\n\n const cashOutBox = document.getElementById('cash-out-box')\n touchEvent(cashOutBox, () => {\n buttonPressed('start', { cryptoCode: currentCryptoCode, direction: 'cashOut' })\n })\n\n var languageOverlay = document.getElementById('language-overlay')\n touchEvent(languageOverlay, function (e) {\n closeLanguageDropdown()\n })\n\n var cryptoOverlay = document.getElementById('crypto-overlay')\n touchEvent(cryptoOverlay, function (e) {\n closeCoinDropdown()\n })\n\n var languageButtons = document.getElementById('languages')\n touchEvent(languageButtons, function (e) {\n var languageButtonJ = $(e.target).closest('button')\n if (languageButtonJ.length === 0) return\n var newLocale = languageButtonJ.attr('data-locale')\n\n if (!newLocale) {\n closeLanguageDropdown()\n return\n }\n\n setLocale(newLocale)\n setCryptoBuy(currentCoin)\n setCryptoSell(currentCoin)\n closeLanguageDropdown()\n })\n\n buildCassetteButtonEvents()\n initDebug()\n})\n\nfunction targetButton (element) {\n var classList = element.classList || []\n var special = classList.contains('button') ||\n classList.contains('circle-button') ||\n classList.contains('wifi-network-button') ||\n classList.contains('square-button')\n if (special) { return element }\n return targetButton(element.parentNode)\n}\n\nfunction touchEvent (element, callback) {\n function handler (e) {\n var target = targetButton(e.target)\n\n target.classList.add('active')\n\n // Wait for transition to finish\n setTimeout(function () {\n target.classList.remove('active')\n }, 300)\n\n setTimeout(function () {\n callback(e)\n }, 200)\n\n e.stopPropagation()\n e.preventDefault()\n }\n\n if (shouldEnableTouch()) {\n element.addEventListener('touchstart', handler)\n }\n element.addEventListener('mousedown', handler)\n}\n\nfunction touchImmediateEvent (element, callback) {\n function handler (e) {\n callback(e)\n e.stopPropagation()\n e.preventDefault()\n }\n if (shouldEnableTouch()) {\n element.addEventListener('touchstart', handler)\n }\n element.addEventListener('mousedown', handler)\n}\n\nfunction setupImmediateButton (buttonClass, buttonAction, callback) {\n var button = document.getElementById(buttonClass)\n touchImmediateEvent(button, function () {\n if (callback) callback()\n buttonPressed(buttonAction)\n })\n}\n\nfunction setupButton (buttonClass, buttonAction, actionData) {\n var button = document.getElementById(buttonClass)\n touchEvent(button, function () {\n buttonPressed(buttonAction, actionData)\n })\n}\n\nfunction setScreen (newScreen, oldScreen) {\n if (newScreen === oldScreen) return\n\n if (newScreen === 'insert_bills') {\n $('.js-processing-bill').html(translate('Lamassu Cryptomat'))\n $('.bill img').css({'-webkit-transform': 'none', top: 0, left: 0})\n }\n\n var newView = $('.' + newScreen + '_state')\n if (newView.length !== 1) console.log('FATAL: ' + newView.length + ' screens found of class ' + newScreen + '_state')\n\n $('.viewport').removeClass('viewport-active')\n newView.addClass('viewport-active')\n}\n\nfunction setState (state, delay) {\n if (state === currentState) return\n\n if (currentState === 'terms_screen') {\n clearTermsConditionsTimeout()\n clearTermsConditionsAcceptanceDelay()\n }\n\n setComplianceTimeout(0)\n\n previousState = currentState\n currentState = state\n\n wifiKeyboard.reset()\n promoKeyboard.reset()\n emailKeyboard.reset()\n customRequirementTextKeyboard.reset()\n\n if (state === 'idle') {\n $('.qr-code').empty()\n $('.qr-code-deposit').empty()\n }\n\n if (delay) {\n window.setTimeout(function () {\n setScreen(currentState, previousState)\n }, delay)\n } else setScreen(currentState, previousState)\n}\n\nfunction revertScreen () { setScreen(currentState) }\n\nfunction setWifiList (recs, requestedPage) {\n var networks = $('#networks')\n if (!recs) recs = networks.data('recs')\n var page = requestedPage || networks.data('page') || 0\n var offset = page * 4\n if (offset > recs.length - 1) {\n offset = 0\n page = 0\n }\n $('#more-networks').css({ 'display': 'none' })\n networks.empty()\n networks.data('page', page)\n networks.data('recs', recs)\n var remainingCount = recs.length - offset\n var len = Math.min(remainingCount, 4)\n for (var i = 0; i < len; i++) {\n var rec = recs[i + offset]\n var bars = Math.floor(rec.strength * 4) + 1\n var html = '
' +\n '' + rec.displaySsid +\n '' + '
'\n networks.append(html)\n }\n\n var moreTxt = translate('MORE')\n var button = '' + moreTxt + ''\n if (recs.length > 4) {\n networks.append(button)\n }\n}\n\nfunction setUpDirectionElement (element, direction) {\n if (direction === 'cashOut') {\n element.removeClass('cash-in-color')\n element.addClass('cash-out-color')\n } else {\n element.addClass('cash-in-color')\n element.removeClass('cash-out-color')\n }\n}\n\nfunction setOperatorInfo (operator) {\n if (!operator || !operator.active) {\n $('.contacts, .contacts-compact').addClass('hide')\n } else {\n $('.contacts, .contacts-compact').removeClass('hide')\n $('.operator-name').text(operator.name)\n $('.operator-email').text(operator.email)\n $('.operator-phone').text(operator.phone)\n }\n}\n\nfunction setHardLimit (limits) {\n const component = $('#hard-limit-hours')\n if (limits.hardLimitWeeks >= 1) {\n return component.text(translate('Please come back in %s weeks', [limits.hardLimitWeeks]))\n }\n\n if (limits.hardLimitDays >= 1) {\n return component.text(translate('Please come back in %s days and %s hours', [limits.hardLimitDays, limits.hardLimitHours]))\n }\n\n component.text(translate('Please come back in %s hours', [limits.hardLimitHours]))\n}\n\nfunction setCryptomatModel (model) {\n cryptomatModel = model\n const versions = ['sintra', 'douro', 'gaia', 'tejo', 'grandola', 'aveiro', 'coincloud', 'gmuk1', 'batm7in']\n const body = $('body')\n\n versions.forEach(it => body.removeClass(it))\n $('body').addClass(model.startsWith('douro') ? 'douro' : model)\n}\n\nfunction enableRecyclerBillButtons() {\n var continueButton = document.getElementById('recycler-continue');\n var finishButton = document.getElementById('recycler-finish');\n continueButton.disabled = false;\n finishButton.disabled = false;\n}\n\nfunction disableRecyclerBillButtons() {\n var continueButton = document.getElementById('recycler-continue');\n var finishButton = document.getElementById('recycler-finish');\n continueButton.disabled = true;\n finishButton.disabled = true;\n}\n\nfunction setDirection (direction) {\n let states = [\n $('.scan_id_photo_state'),\n $('.scan_manual_id_photo_state'),\n $('.scan_id_data_state'),\n $('.security_code_state'),\n $('.register_us_ssn_state'),\n $('.us_ssn_permission_state'),\n $('.register_phone_state'),\n $('.register_email_state'),\n $('.terms_screen_state'),\n $('.verifying_id_photo_state'),\n $('.verifying_face_photo_state'),\n $('.verifying_id_data_state'),\n $('.permission_id_state'),\n $('.sms_verification_state'),\n $('.email_verification_state'),\n $('.bad_phone_number_state'),\n $('.bad_security_code_state'),\n $('.max_phone_retries_state'),\n $('.max_email_retries_state'),\n $('.failed_permission_id_state'),\n $('.failed_verifying_id_photo_state'),\n $('.blocked_customer_state'),\n $('.fiat_error_state'),\n $('.fiat_transaction_error_state'),\n $('.failed_scan_id_data_state'),\n $('.sanctions_failure_state'),\n $('.error_permission_id_state'),\n $('.scan_face_photo_state'),\n $('.retry_scan_face_photo_state'),\n $('.permission_face_photo_state'),\n $('.failed_scan_face_photo_state'),\n $('.hard_limit_reached_state'),\n $('.failed_scan_id_photo_state'),\n $('.retry_permission_id_state'),\n $('.waiting_state'),\n $('.insert_promo_code_state'),\n $('.promo_code_not_found_state'),\n $('.custom_permission_state'),\n $('.external_permission_state'),\n $('.custom_permission_screen2_numerical_state'),\n $('.custom_permission_screen2_text_state'),\n $('.custom_permission_screen2_choiceList_state'),\n $('.external_compliance_state')\n ]\n cashDirection = direction\n states.forEach(it => {\n setUpDirectionElement(it, direction)\n })\n}\n\n/**\n *\n * @param {Object} data\n * @param {boolean} data.active\n * @param {String} data.title\n * @param {String} data.text\n * @param {String} data.accept\n * @param {String} data.cancel\n */\nfunction setTermsScreen (data) {\n const $screen = $('.terms_screen_state')\n $screen.find('.js-terms-title').html(data.title)\n startPage(data.text, data.acceptDisabled)\n $screen.find('.js-terms-cancel-button').html(data.cancel)\n $screen.find('.js-terms-accept-button').html(data.accept)\n setTermsConditionsTimeout()\n setAcceptButtonDisabled($screen, data)\n setTermsConditionsAcceptanceDelay($screen, data)\n}\n\nfunction setAcceptButtonDisabled (screen, data) {\n var acceptButton = screen.find('.js-terms-accept-button');\n acceptButton.prop('disabled', Boolean(data.acceptDisabled));\n}\n\nfunction clearTermsConditionsTimeout () {\n clearTimeout(termsConditionsTimeout)\n}\n\nfunction setTermsConditionsTimeout () {\n termsConditionsTimeout = setTimeout(function () {\n if (currentState === 'terms_screen') {\n buttonPressed('idle')\n }\n }, T_C_TIMEOUT)\n}\n\nfunction setTermsConditionsAcceptanceDelay (screen, data) {\n let acceptButton = screen.find('.js-terms-accept-button')\n acceptButton.css({ 'min-width': 0 })\n\n if (!data.delay) return\n\n const delayTimer = isNaN(data.delayTimer) ? 0 : data.delayTimer\n let seconds = delayTimer / 1000\n acceptButton.prop('disabled', true)\n acceptButton.html(seconds > 0 ? `${data.accept} (${seconds})` : `${data.accept}`)\n\n var tmpbtn = acceptButton.clone().appendTo('body').css({ 'display': 'block', 'visibility': 'hidden' })\n var width = tmpbtn.outerWidth()\n tmpbtn.remove()\n acceptButton.css({ 'min-width': `${width}px` })\n termsConditionsAcceptanceInterval = setInterval(function () {\n seconds--\n if (currentState === 'terms_screen' && seconds > 0) {\n acceptButton.html(`${data.accept} (${seconds})`)\n }\n if (currentState === 'terms_screen' && seconds <= 0) {\n acceptButton.prop('disabled', false)\n acceptButton.html(`${data.accept}`)\n }\n if (seconds <= 0) {\n clearInterval(termsConditionsAcceptanceInterval)\n }\n }, 1000)\n}\n\nfunction clearTermsConditionsAcceptanceDelay () {\n clearInterval(termsConditionsAcceptanceInterval)\n clearTimeout(termsConditionsAcceptanceTimeout)\n}\n\nfunction resetTermsConditionsTimeout () {\n clearTermsConditionsTimeout()\n setTermsConditionsTimeout()\n}\n\n// click page up button\nfunction scrollUp () {\n resetTermsConditionsTimeout()\n const div = document.getElementById('js-terms-text-div')\n if (currentPage !== 0) {\n currentPage -= 1\n updateButtonStyles()\n updatePageCounter()\n div.scrollTo(0, currentPage * scrollSize)\n }\n}\n\n// start page\nfunction startPage (text, acceptedTerms) {\n const $screen = $('.terms_screen_state')\n $screen.find('.js-terms-text').html(text)\n if (!acceptedTerms) currentPage = 0\n totalPages = 0\n setTimeout(function () {\n const div = document.getElementById('js-terms-text-div')\n textHeightQuantity = document.getElementById('js-terms-text').offsetHeight\n scrollSize = div.offsetHeight - 40\n updateButtonStyles()\n if (text.length <= 1000 && textHeightQuantity <= div.offsetHeight) {\n document.getElementById('actions-scroll').style.display = 'none'\n } else {\n document.getElementById('actions-scroll').style.display = ''\n if (!acceptedTerms) div.scrollTo(0, 0)\n totalPages = Math.ceil(textHeightQuantity / scrollSize)\n updatePageCounter()\n }\n }, 100)\n}\n\nfunction updatePageCounter () {\n document.getElementById('terms-page-counter').textContent = `${currentPage + 1}/${totalPages}`\n}\n\n// click page up button\nfunction scrollDown () {\n resetTermsConditionsTimeout()\n const div = document.getElementById('js-terms-text-div')\n if (!(currentPage * scrollSize + scrollSize > textHeightQuantity && currentPage !== 0)) {\n currentPage += 1\n updateButtonStyles()\n updatePageCounter()\n div.scrollTo(0, currentPage * scrollSize)\n }\n}\n\nfunction updateButtonStyles () {\n textHeightQuantity = document.getElementById('js-terms-text').offsetHeight\n const buttonDown = document.getElementById('scroll-down')\n const buttonUp = document.getElementById('scroll-up')\n if (currentPage === 0) {\n buttonUp.disabled = true\n } else {\n buttonUp.disabled = false\n }\n\n if (currentPage * scrollSize + scrollSize > textHeightQuantity && currentPage !== 0) {\n buttonDown.disabled = true\n } else {\n buttonDown.disabled = false\n }\n}\n\nfunction moreNetworks () {\n var networks = $('#networks')\n var page = networks.data('page')\n setWifiList(null, page + 1)\n}\n\nfunction setWifiSsid (data) {\n $('#js-i18n-wifi-for-ssid').data('ssid', data.ssid)\n $('#js-i18n-wifi-for-ssid').data('raw-ssid', data.rawSsid)\n t('wifi-for-ssid', translate('for %s', ['' + data.ssid + '']))\n t('wifi-connect', translate(\"You're connecting to the WiFi network %s\", ['' + data.ssid + '']))\n}\n\nfunction setLocaleInfo (data) {\n phoneKeypad.setCountry(data.country)\n setPrimaryLocales(data.primaryLocales)\n setLocale(data.primaryLocale)\n}\n\nfunction otherLanguageName () {\n const lang = lookupLocaleNames(otherLocale())\n return lang && lang.nativeName\n}\n\nfunction otherLocale () {\n return _primaryLocales.find(c => c !== localeCode)\n}\n\nfunction setLocale (data) {\n if (!data || data === localeCode) return\n localeCode = data\n jsLocaleCode = data\n var lang = localeCode.split('-')[0]\n\n if (jsLocaleCode === 'fr-QC') jsLocaleCode = 'fr-CA'\n\n var isArabic = jsLocaleCode.indexOf('ar-') === 0\n var isHebrew = jsLocaleCode.indexOf('he-') === 0\n isRTL = isArabic || isHebrew\n\n setChooseCoinColors()\n // setupAnimation(isTwoWay, aspectRatio800)\n\n if (isRTL) {\n $('body').addClass('i18n-rtl')\n } else {\n $('body').removeClass('i18n-rtl')\n }\n\n if (isArabic) {\n $('body').addClass('i18n-ar')\n } else {\n $('body').removeClass('i18n-ar')\n }\n\n if (isHebrew) {\n $('body').addClass('i18n-he')\n } else {\n $('body').removeClass('i18n-he')\n }\n\n if (MUSEO.indexOf(lang) !== -1) $('body').addClass('museo')\n else $('body').removeClass('museo')\n\n locale = loadI18n(localeCode)\n try { translatePage() } catch (ex) {}\n\n $('.js-two-language').html(otherLanguageName())\n\n if (lastRates) setExchangeRate(lastRates)\n}\n\nfunction setChooseCoinColors () {\n var elem = $('#bg-to-show > img')\n let img = `images/background/${isTwoWay ? '2way' : '1way'}-${aspectRatio}${isRTL ? '-rtl' : ''}.svg`\n if (img !== elem.attr('src')) {\n elem.attr('src', img)\n }\n\n if (isTwoWay) {\n $('.choose_coin_state .change-language').removeClass('cash-in-color').addClass('cash-out-color')\n } else {\n $('.choose_coin_state .change-language').removeClass('cash-out-color').addClass('cash-in-color')\n }\n}\n\nfunction areArraysEqual (arr1, arr2) {\n if (arr1.length !== arr2.length) return false\n for (var i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) return false\n }\n return true\n}\n\nfunction lookupLocaleNames (locale) {\n if (!locale) return\n var langMap = window.languageMappingList\n var language = locale.split('-')[0]\n var localeNames = langMap[language]\n return localeNames || langMap[locale]\n}\n\nfunction setPrimaryLocales (primaryLocales) {\n if (areArraysEqual(primaryLocales, _primaryLocales)) return\n _primaryLocales = primaryLocales\n\n var languages = $('#languages')\n closeLanguageDropdown()\n languages.empty()\n var sortedPrimaryLocales = primaryLocales.filter(lookupLocaleNames).sort(function (a, b) {\n var langA = lookupLocaleNames(a)\n var langB = lookupLocaleNames(b)\n return langA.englishName.localeCompare(langB.englishName)\n })\n\n languages.append(``)\n for (var i = 0; i < sortedPrimaryLocales.length; i++) {\n var l = sortedPrimaryLocales[i]\n var lang = lookupLocaleNames(l)\n var name = lang.nativeName || lang.englishName\n var div = ``\n languages.append(div)\n }\n\n $('.js-two-language').html(otherLanguageName())\n\n $('.js-menu-language').toggleClass('hide', sortedPrimaryLocales.length <= 1)\n $('.js-multi-language').toggleClass('hide', sortedPrimaryLocales.length === 2)\n $('.js-two-language').toggleClass('hide', sortedPrimaryLocales.length > 2)\n}\n\nfunction setFiatCode (data) {\n fiatCode = data\n $('.js-currency').text(fiatCode)\n}\n\nfunction setFixedFee (_fee) {\n const fee = parseFloat(_fee)\n if (fee > 0) {\n const fixedFee = translate('Transaction Fee: %s', [formatFiat(fee, 2)])\n $('.js-i18n-fixed-fee').html(fixedFee)\n } else {\n $('.js-i18n-fixed-fee').html('')\n }\n}\n\nfunction setCredit (credit, lastBill) {\n const { fiat, cryptoAtoms, cryptoCode } = credit\n var coin = getCryptoCurrency(cryptoCode)\n\n var scale = new BigNumber(10).pow(coin.displayScale)\n var cryptoAmount = new BigNumber(cryptoAtoms).div(scale).toNumber()\n var cryptoDisplayCode = coin.displayCode\n updateCrypto('.total-crypto-rec', cryptoAmount, cryptoDisplayCode)\n $('.amount-deposited').html(translate('You deposited %s', [`${fiat} ${fiatCode}`]))\n $('.fiat .js-amount').html(fiat)\n\n var inserted = lastBill\n ? translate('You inserted a %s bill', [formatFiat(lastBill)])\n : translate('Lamassu Cryptomat')\n\n $('.js-processing-bill').html(inserted)\n\n $('.js-continue-crypto-enable').show()\n $('.js-send-crypto-enable').show()\n}\n\nfunction formatDenomination (denom) {\n return denom.toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: 0,\n minimumFractionDigits: 0\n })\n}\n\nfunction buildCassetteButtons (_cassettes, numberOfButtons) {\n cassettes = _cassettes\n var activeCassettes = _cassettes.filter(it => it.count === null || it.count > 0)\n var inactiveCassettes = _cassettes.filter(it => it.count === 0)\n\n var allCassettes = activeCassettes.concat(inactiveCassettes)\n var selectedCassettes = allCassettes.slice(0, numberOfButtons)\n var sortedCassettes = selectedCassettes.sort((a, b) => a.denomination - b.denomination)\n\n for (var i = 0; i < sortedCassettes.length; i++) {\n var denomination = formatDenomination(sortedCassettes[i].denomination || 0)\n $('.cash-button[data-denomination-index=' + i + '] .js-denomination').text(denomination)\n }\n}\n\nfunction updateCassetteButtons (activeDenoms, numberOfButtons) {\n for(var i = 0; i < numberOfButtons; i++) {\n var button = $('.choose_fiat_state .cash-button[data-denomination-index=' + i + ']')\n var denomination = button.children('.js-denomination').text()\n button.prop('disabled', !Boolean(activeDenoms[denomination]))\n }\n}\n\nfunction buildCassetteButtonEvents () {\n var fiatButtons = document.getElementById('js-fiat-buttons')\n var lastTouch = null\n\n touchImmediateEvent(fiatButtons, function (e) {\n var now = Date.now()\n if (lastTouch && now - lastTouch < 100) return\n lastTouch = now\n var cashButtonJ = $(e.target).closest('.cash-button')\n if (cashButtonJ.length === 0) return\n if (cashButtonJ.hasClass('disabled')) return\n if (cashButtonJ.hasClass('clear')) return buttonPressed('clearFiat')\n buttonPressed('fiatButton', { denomination: cashButtonJ.children('.js-denomination').text() })\n })\n}\n\nfunction updateCrypto (selector, cryptoAmount, cryptoDisplayCode) {\n $(selector).find('.crypto-amount').html(formatCrypto(cryptoAmount))\n $(selector).find('.crypto-units').html(cryptoDisplayCode)\n}\n\nfunction lookupDecimalChar (localeCode) {\n var num = 1.1\n var localized = num.toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: 1,\n minimumFractionDigits: 1\n })\n\n return localized[1]\n}\n\nfunction splitNumber (localize, localeCode) {\n var decimalChar = lookupDecimalChar(localeCode)\n var split = localize.split(decimalChar)\n\n if (split.length === 1) {\n return ['', split[0], ''].join('')\n }\n\n return [\n '', split[0], '',\n decimalChar, '', split[1], ''\n ].join('')\n}\n\nfunction formatNumber (num) {\n var localized = num.toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: 6,\n minimumFractionDigits: 3\n })\n\n return splitNumber(localized, jsLocaleCode)\n}\n\nfunction formatCrypto (amount) {\n return formatNumber(amount)\n}\n\nfunction formatFiat (amount, fractionDigits) {\n if (!fractionDigits) fractionDigits = 0\n\n const localized = amount.toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: fractionDigits,\n minimumFractionDigits: fractionDigits\n })\n return splitNumber(localized, jsLocaleCode) + ' ' + fiatCode\n}\n\nfunction setExchangeRate (_rates) {\n lastRates = _rates\n var cryptoCode = _rates.cryptoCode\n var rates = _rates.rates\n\n var coin = getCryptoCurrency(cryptoCode)\n var displayCode = coin.displayCode\n\n if (rates.cashIn) {\n var cryptoToFiat = new BigNumber(rates.cashIn)\n var rateStr = formatFiat(cryptoToFiat.round(2).toNumber(), 2)\n\n $('.crypto-rate-cash-in').html(`1 ${cryptoCode === LN ? BTC : cryptoCode} = ${rateStr}`)\n }\n\n if (rates.cashOut) {\n var cashOut = new BigNumber(rates.cashOut)\n var cashOutCryptoToFiat = cashOut && formatFiat(cashOut.round(2).toNumber(), 2)\n\n $('.crypto-rate-cash-out').html(`1 ${cryptoCode === LN ? BTC : cryptoCode} = ${cashOutCryptoToFiat}`)\n }\n\n $('.js-crypto-display-units').text(displayCode)\n}\n\nfunction qrize (text, target, color, lightning, size = 'normal') {\n const image = document.getElementById('bolt-img')\n // Hack for surf browser\n const _size = size === 'normal'\n ? document.body.clientHeight * 0.36\n : document.body.clientHeight * 0.25\n\n const opts = {\n crisp: true,\n fill: color || 'black',\n text,\n size: _size,\n render: 'canvas',\n rounded: 50,\n quiet: 2,\n mPosX: 50,\n mPosY: 50,\n mSize: 30,\n image\n }\n\n if (lightning) {\n opts.mode = 'image'\n }\n\n const el = kjua(opts)\n\n target.empty().append(el)\n}\n\nfunction setTx (tx) {\n const txId = tx.id\n const isPaperWallet = tx.isPaperWallet\n const hasBills = tx.bills && tx.bills.length > 0\n\n if (hasBills) {\n $('.js-inserted-notes').show()\n $('.js-no-inserted-notes').hide()\n } else {\n $('.js-inserted-notes').hide()\n $('.js-no-inserted-notes').show()\n }\n\n $('.js-paper-wallet').toggleClass('hide', !isPaperWallet)\n\n setCurrentDiscount(tx.discount, tx.promoCodeApplied)\n\n setTimeout(() => {\n qrize(txId, $('#cash-in-qr-code'), CASH_IN_QR_COLOR)\n qrize(txId, $('#cash-in-fail-qr-code'), CASH_IN_QR_COLOR)\n qrize(txId, $('#cash-in-no-funds-qr-code'), CASH_IN_QR_COLOR, null, 'small')\n qrize(txId, $('#qr-code-fiat-receipt'), CASH_OUT_QR_COLOR)\n qrize(txId, $('#qr-code-fiat-complete'), CASH_OUT_QR_COLOR)\n }, 1000)\n}\n\nfunction formatAddressNoBreakLines (address) {\n if (!address) return\n if (address.length > 60) {\n const firstPart = address.substring(0, 40).replace(/(.{4})/g, '$1 ')\n const secondPart = address.substring(address.length-16, address.length).replace(/(.{4})/g, '$1 ')\n return firstPart.concat('... ').concat(secondPart)\n }\n return address.replace(/(.{4})/g, '$1 ')\n}\n\nfunction formatAddress (address) {\n let toBr = formatAddressNoBreakLines(address)\n if (!toBr) return\n\n return toBr.replace(/((.{4} ){5})/g, '$1
')\n}\n\nfunction setBuyerAddress (address) {\n $('.crypto-address-no-br').html(formatAddressNoBreakLines(address))\n $('.crypto-address').html(formatAddress(address))\n}\n\nfunction setAccepting (currentAccepting) {\n accepting = currentAccepting\n if (accepting) {\n $('.bill img').transition({ x: 0, y: -303 }, 1000, 'ease-in')\n } else {\n $('.bill img').transition({ x: 0, y: 0 }, 1000, 'ease-out')\n }\n}\n\nfunction highBill (highestBill, reason) {\n var reasonText = reason === 'transactionLimit'\n ? translate('Transaction limit reached.')\n : translate(\"We're a little low on crypto.\")\n\n t('high-bill-header', reasonText)\n t('highest-bill', translate('Please insert %s or less.', [formatFiat(highestBill)]))\n\n setScreen('high_bill')\n window.setTimeout(revertScreen, 3000)\n}\n\nfunction minimumTx (lowestBill) {\n t('lowest-bill', translate('Minimum first bill is %s.', [formatFiat(lowestBill)]))\n\n setScreen('minimum_tx')\n window.setTimeout(revertScreen, 3000)\n}\n\nfunction readingBills (bill) {\n $('.js-processing-bill').html(translate('Processing %s ...', [formatFiat(bill)]))\n $('.js-continue-crypto-enable').hide()\n $('.js-send-crypto-enable').hide()\n}\n\nfunction sendOnly (reason) {\n // TODO: sendOnly should be made into its own state on brain.js\n if (currentState === 'send_only') return\n\n const errorMessages = {\n transactionLimit: translate('Transaction limit reached'),\n validatorError: translate('Error in validation'),\n lowBalance: translate(\"We're out of coins!\"),\n blockedCustomer: translate('Transaction limit reached')\n }\n\n // If no reason provided defaults to lowBalance\n const reasonText = errorMessages[reason] || errorMessages.lowBalance\n $('#send-only-title').text(reasonText)\n\n if (reason === 'blockedCustomer') {\n $('.js-send-only-text').text(translate(\"Due to local regulations, you've reached your transaction limit. Please contact us if you'd like to raise your limit.\"))\n } else {\n $('.js-send-only-text').text('')\n }\n\n setState('send_only')\n}\n\nfunction setPartialSend (sent, total) {\n $('#already-sent').text(formatFiat(sent.fiat))\n $('#pending-sent').text(formatFiat(total.fiat - sent.fiat))\n}\n\nfunction t (id, str) {\n $('#js-i18n-' + id).html(str)\n}\n\nfunction translateCoin (_cryptoCode) {\n const coin = getCryptoCurrency(_cryptoCode)\n const cryptoCode = coin.cryptoCodeDisplay || _cryptoCode\n $('.js-i18n-scan-your-address').html(translate('Scan your
%s address', [cryptoCode]))\n $('.js-i18n-please-scan').html(translate('Please scan the QR code
to send us your %s.', [cryptoCode]))\n $('.js-i18n-did-send-coins').html(translate('Have you sent the %s yet?', [cryptoCode]))\n $('.js-i18n-scan-address').html(translate('Scan your %s address', [cryptoCode]))\n $('.js-i18n-invalid-address').html(translate('Invalid %s address', [cryptoCode]))\n}\n\nfunction initTranslatePage () {\n $('.js-i18n').each(function () {\n var el = $(this)\n el.data('baseTranslation', el.html().trim())\n })\n $('input[placeholder]').each(function () {\n var el = $(this)\n el.data('baseTranslation', el.attr('placeholder'))\n })\n}\n\nfunction translatePage () {\n $('.js-i18n').each(function () {\n var el = $(this)\n var base = el.data('baseTranslation')\n el.html(translate(base))\n })\n $('input[placeholder]').each(function () {\n var el = $(this)\n var base = el.data('baseTranslation')\n el.attr('placeholder', translate(base))\n })\n\n // Adjust send coins button\n var length = $('#send-coins span').text().length\n if (length > 17) $('body').addClass('i18n-long-send-coins')\n else $('body').removeClass('i18n-long-send-coins')\n}\n\nfunction loadI18n (localeCode) {\n var messages = locales[localeCode] || locales['en-US']\n\n return new Jed({\n 'missing_key_callback': function () {},\n 'locale_data': {\n 'messages': messages\n }\n })\n}\n\nfunction reachFiatLimit (rec) {\n var msg = null\n if (rec.isEmpty) msg = translate(`We're a little low, please cash out`)\n else if (rec.txLimitReached) msg = translate('Transaction limit reached, please cash out')\n\n var el = $('.choose_fiat_state .limit')\n if (msg) el.html(msg).show()\n else el.hide()\n}\n\nfunction chooseFiat (data) {\n fiatCredit(data)\n setState('choose_fiat')\n}\n\nfunction displayCrypto (cryptoAtoms, cryptoCode) {\n var coin = getCryptoCurrency(cryptoCode)\n var scale = new BigNumber(10).pow(coin.displayScale)\n // number of decimal places vary based on displayScale value\n var decimalPlaces = (coin.displayScale - coin.unitScale) + 6\n var cryptoAmount = new BigNumber(cryptoAtoms).div(scale).round(decimalPlaces).toNumber()\n var cryptoDisplay = formatCrypto(cryptoAmount)\n\n return cryptoDisplay\n}\n\nfunction BN (s) { return new BigNumber(s) }\n\nfunction fiatCredit (data) {\n var tx = data.tx\n var cryptoCode = tx.cryptoCode\n var activeDenominations = data.activeDenominations\n var coin = getCryptoCurrency(cryptoCode)\n const fiat = BN(tx.fiat)\n\n var fiatDisplay = BN(tx.fiat).toNumber().toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: 0,\n minimumFractionDigits: 0\n })\n\n var cryptoAtoms = BN(tx.cryptoAtoms)\n var cryptoDisplay = displayCrypto(cryptoAtoms, cryptoCode)\n\n var cryptoDisplayCode = coin.displayCode\n\n setCurrentDiscount(tx.discount, tx.promoCodeApplied)\n\n if (cryptoAtoms.eq(0) || cryptoAtoms.isNaN()) $('#js-i18n-choose-digital-amount').hide()\n else $('#js-i18n-choose-digital-amount').show()\n\n if (fiat.eq(0)) $('#cash-out-button').prop('disabled', true)\n else $('#cash-out-button').prop('disabled', false)\n\n updateCassetteButtons(activeDenominations.activeMap, NUMBER_OF_BUTTONS)\n $('.choose_fiat_state .fiat-amount').text(fiatDisplay)\n t('choose-digital-amount',\n translate(\"You'll be sending %s %s\", [cryptoDisplay, cryptoDisplayCode]))\n\n reachFiatLimit(activeDenominations)\n}\n\nfunction setDepositAddress (depositInfo) {\n $('.deposit_state .loading').hide()\n $('.deposit_state .send-notice .crypto-address').html(formatAddress(depositInfo.toAddress))\n $('.deposit_state .send-notice').show()\n\n qrize(depositInfo.depositUrl, $('#qr-code-deposit'), CASH_OUT_QR_COLOR)\n}\n\nfunction setVersion (version) {\n $('.version-number').html(`Version: ${version}`)\n}\n\nfunction deposit (tx) {\n var cryptoCode = tx.cryptoCode\n var display = displayCrypto(tx.cryptoAtoms, cryptoCode)\n\n $('.js-wallet-address').show()\n\n $('.deposit_state .digital .js-amount').html(display)\n $('.deposit_state .fiat .js-amount').text(tx.fiat)\n $('.deposit_state .send-notice').hide()\n $('#qr-code-deposit').empty()\n $('.deposit_state .loading').show()\n $('#qr-code-deposit').show()\n $('#lightning-enabled').hide()\n if (tx.cryptoCode === 'LN') $('#lightning-enabled').show()\n\n setState('deposit')\n}\n\nfunction fiatReceipt (tx) {\n var cryptoCode = tx.cryptoCode\n var display = displayCrypto(tx.cryptoAtoms, cryptoCode)\n\n $('.fiat_receipt_state .digital .js-amount').html(display)\n $('.fiat_receipt_state .fiat .js-amount').text(tx.fiat)\n $('.fiat_receipt_state .sent-coins .crypto-address').html(formatAddress(tx.toAddress))\n\n setState('fiat_receipt')\n}\n\nfunction fiatComplete (tx) {\n var cryptoCode = tx.cryptoCode\n var display = displayCrypto(tx.cryptoAtoms, cryptoCode)\n\n $('.fiat_complete_state .digital .js-amount').html(display)\n $('.fiat_complete_state .fiat .js-amount').text(tx.fiat)\n $('.fiat_complete_state .sent-coins .crypto-address').html(formatAddress(tx.toAddress))\n\n setState('fiat_complete')\n}\n\nfunction dispenseBatch (data) {\n $('.batch').css('visibility', data.of === 1 ? 'hidden' : 'visible')\n $('.batch').text(`${data.current}/${data.of}`)\n}\n\nfunction initDebug () {\n if (DEBUG_MODE === 'dev') {\n $('body').css('cursor', 'default')\n var style = document.createElement('style')\n style.type = 'text/css'\n style.innerHTML = 'button { cursor: default !important; }'\n document.getElementsByTagName('head')[0].appendChild(style)\n\n return\n }\n\n if (DEBUG_MODE === 'demo') {\n setPrimaryLocales(['en-US'])\n setLocale('en-US')\n $('body').css('cursor', 'default')\n var style = document.createElement('style')\n style.type = 'text/css'\n style.innerHTML = 'button { cursor: default !important; }'\n document.getElementsByTagName('head')[0].appendChild(style)\n\n if (!SCREEN) {\n return chooseCoin([\n { display: 'Bitcoin', cryptoCode: 'BTC' },\n { display: 'Ethereum', cryptoCode: 'ETH' },\n { display: 'ZCash', cryptoCode: 'ZEC' }\n ], true)\n }\n\n setState(SCREEN)\n }\n}\n\nfunction calculateAspectRatio () {\n const width = $('body').width()\n const height = $('body').height()\n\n function gcd (a, b) {\n return (b === 0) ? a : gcd(b, a % b)\n }\n\n const w = width\n const h = height\n const r = gcd(w, h)\n const aspectRatioPt1 = w / r\n const aspectRatioPt2 = h / r\n\n if (aspectRatioPt1 < aspectRatioPt2) {\n aspectRatio = '9:16'\n } else if (aspectRatioPt1 === 8 && aspectRatioPt2 === 5) {\n aspectRatio = '16:10'\n } else if (aspectRatioPt1 === 16 && aspectRatioPt2 === 9) {\n aspectRatio = '16:9'\n } else {\n aspectRatio = w < 1420 ? '16:10' : '16:9'\n }\n}\n\nlet background = null\n\nfunction doTransition (cb) {\n // TODO Disable animations for V1\n let toShow = null\n let toShowOver = null\n\n if (isTwoWay) {\n toShow = ['#bg-to-show']\n toShowOver = ['.crypto-buttons', '.cash-in-box-wrapper']\n } else {\n toShow = ['#bg-to-show']\n toShowOver = ['header', 'main']\n }\n\n two.start()\n var tl = new TimelineMax()\n tl.set('.fade-in-delay', { opacity: 0, y: +30 })\n .set('.fade-in', { opacity: 0, y: +30 })\n .set(toShow, { zIndex: 1 })\n .set(toShowOver, { zIndex: 2 })\n .to(background, 0.5, { scale: isTwoWay ? 3 : 2 })\n .to('.fade-in', 0.4, {\n opacity: 1,\n onStart: cb,\n y: 0\n }, '=-0.2')\n .to('.fade-in-delay', 0.4, { opacity: 1, y: 0 }, '=-0.2')\n .set(background, { scale: 1 })\n .set(toShow, { zIndex: -1 })\n .set(toShowOver, { zIndex: 0 })\n two.pause()\n}\n\nfunction setupAnimation (isTwoWay, isAr800) {\n var elem = document.getElementById('bg-to-show')\n while (elem.firstChild) {\n elem.removeChild(elem.firstChild)\n }\n two = new Two({ fullscreen: true, type: Two.Types.svg, autostart: true }).appendTo(elem)\n\n let elementId = `${isTwoWay ? 'two-way' : 'one-way'}-${isAr800 ? '800' : '1080'}${isRTL ? '-rtl' : ''}`\n background = two.interpret(document.getElementById(elementId))\n background.scale = 1\n}\n\nfunction shouldEnableTouch () {\n const ua = navigator.userAgent\n if (ua.match(/surf/ig)) return false\n\n // ACP has chromium 34 and upboard 73\n const chromiumVersion = ua.match(/chromium\\/(\\d+)/i)\n const chromeVersion = ua.match(/chrome\\/(\\d+)/i)\n const chromiumPlus73 = chromiumVersion && chromiumVersion[1] >= 73\n const chromePlus73 = chromeVersion && chromeVersion[1] >= 73\n\n return chromiumPlus73 || chromePlus73\n}\n\nfunction setAvailablePromoCodes (areThereAvailablePromoCodes) {\n if (areThereAvailablePromoCodes) {\n $('#insert-first-bill-promo-button').show()\n $('#insert-first-recycler-bills-promo-button').show()\n $('#choose-fiat-promo-button').show()\n } else {\n $('#insert-first-bill-promo-button').hide()\n $('#insert-first-recycler-bills-promo-button').hide()\n $('#choose-fiat-promo-button').hide()\n }\n}\n\nfunction setCurrentDiscount (currentDiscount, promoCodeApplied) {\n if (promoCodeApplied) {\n $('#insert-first-bill-promo-button').hide()\n $('#insert-first-recycler-bills-promo-button').hide()\n $('#choose-fiat-promo-button').hide()\n }\n\n if (!currentDiscount) {\n $('#insert-first-bill-code-added').hide()\n $('#insert-first-recycler-bills-code-added').hide()\n $('#choose-fiat-code-added').hide()\n } else if (currentDiscount > 0) {\n const successMessage = '✔ ' + translate('Discount added (%s off commissions)', [`${currentDiscount}%`])\n $('#insert-first-bill-code-added').html(successMessage)\n $('#insert-first-recycler-bills-code-added').html(successMessage)\n $('#choose-fiat-code-added').html(successMessage)\n $('#insert-first-bill-code-added').show()\n $('#insert-first-recycler-bills-code-added').show()\n $('#choose-fiat-code-added').show()\n\n } else {\n $('#insert-first-bill-promo-button').show()\n $('#insert-first-recycler-bills-promo-button').show()\n $('#choose-fiat-promo-button').show()\n $('#insert-first-bill-code-added').hide()\n $('#insert-first-recycler-bills-code-added').hide()\n $('#choose-fiat-code-added').hide()\n }\n}\n\nfunction setReceiptPrint (receiptStatus, smsReceiptStatus) {\n let status = null\n if (receiptStatus) status = receiptStatus\n else status = smsReceiptStatus\n\n const className = receiptStatus ? 'print-receipt' : 'send-sms-receipt'\n const printing = receiptStatus ? 'Printing receipt...' : 'Sending receipt...'\n const success = receiptStatus ? 'Receipt printed successfully!' : 'Receipt sent successfully!'\n\n switch (status) {\n case 'disabled':\n $(`#${className}-cash-in-message`).addClass('hide')\n $(`#${className}-cash-in-button`).addClass('hide')\n $(`#${className}-cash-out-message`).addClass('hide')\n $(`#${className}-cash-out-button`).addClass('hide')\n $(`#${className}-cash-in-fail-message`).addClass('hide')\n $(`#${className}-cash-in-fail-button`).addClass('hide')\n break\n case 'available':\n $(`#${className}-cash-in-message`).addClass('hide')\n $(`#${className}-cash-in-button`).removeClass('hide')\n $(`#${className}-cash-out-message`).addClass('hide')\n $(`#${className}-cash-out-button`).removeClass('hide')\n $(`#${className}-cash-in-fail-message`).addClass('hide')\n $(`#${className}-cash-in-fail-button`).removeClass('hide')\n break\n case 'printing':\n const message = locale.translate(printing).fetch()\n $(`#${className}-cash-in-button`).addClass('hide')\n $(`#${className}-cash-in-message`).html(message)\n $(`#${className}-cash-in-message`).removeClass('hide')\n $(`#${className}-cash-out-button`).addClass('hide')\n $(`#${className}-cash-out-message`).html(message)\n $(`#${className}-cash-out-message`).removeClass('hide')\n $(`#${className}-cash-in-fail-button`).addClass('hide')\n $(`#${className}-cash-in-fail-message`).html(message)\n $(`#${className}-cash-in-fail-message`).removeClass('hide')\n break\n case 'success':\n const successMessage = '✔ ' + locale.translate(success).fetch()\n $(`#${className}-cash-in-button`).addClass('hide')\n $(`#${className}-cash-in-message`).html(successMessage)\n $(`#${className}-cash-in-message`).removeClass('hide')\n $(`#${className}-cash-out-button`).addClass('hide')\n $(`#${className}-cash-out-message`).html(successMessage)\n $(`#${className}-cash-out-message`).removeClass('hide')\n $(`#${className}-cash-in-fail-button`).addClass('hide')\n $(`#${className}-cash-in-fail-message`).html(successMessage)\n $(`#${className}-cash-in-fail-message`).removeClass('hide')\n break\n case 'failed':\n const failMessage = '✖ ' + locale.translate('An error occurred, try again.').fetch()\n $(`#${className}-cash-in-button`).addClass('hide')\n $(`#${className}-cash-in-message`).html(failMessage)\n $(`#${className}-cash-in-message`).removeClass('hide')\n $(`#${className}-cash-out-button`).addClass('hide')\n $(`#${className}-cash-out-message`).html(failMessage)\n $(`#${className}-cash-out-message`).removeClass('hide')\n $(`#${className}-cash-in-fail-button`).addClass('hide')\n $(`#${className}-cash-in-fail-message`).html(failMessage)\n $(`#${className}-cash-in-fail-message`).removeClass('hide')\n break\n }\n}\n\nfunction externalCompliance (url) {\n qrize(url, $('#qr-code-external-validation'), cashDirection === 'cashIn' ? CASH_IN_QR_COLOR : CASH_OUT_QR_COLOR)\n return setScreen('external_compliance')\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../src/app.js"],"names":["queryString","window","location","search","params","URLSearchParams","substring","SCREEN","get","DEBUG_MODE","CASH_OUT_QR_COLOR","CASH_IN_QR_COLOR","NUMBER_OF_BUTTONS","scrollSize","textHeightQuantity","currentPage","totalPages","aspectRatio","isTwoWay","isRTL","two","cryptomatModel","termsConditionsTimeout","termsConditionsAcceptanceInterval","T_C_TIMEOUT","complianceTimeout","cashDirection","fiatCode","locale","defaultLocale","loadI18n","localeCode","jsLocaleCode","_primaryLocales","lastRates","coins","currentState","accepting","websocket","wifiKeyboard","promoKeyboard","usSsnKeypad","phoneKeypad","securityKeypad","previousState","buttonActive","cassettes","currentCryptoCode","currentCoin","currentCoins","emailKeyboard","customRequirementNumericalKeypad","customRequirementTextKeyboard","customRequirementChoiceList","MUSEO","connect","console","log","HOST","PORT","WebSocket","onmessage","event","data","$","parseJSON","processData","onerror","err","verifyConnection","readyState","CLOSED","buttonPressed","button","deactivate","setTimeout","activate","res","send","JSON","stringify","displayLN","displayBTC","LN","BTC","localeInfo","setLocaleInfo","setLocale","supportedCoins","setCoins","setFiatCode","rates","setExchangeRate","buyerAddress","setBuyerAddress","credit","lastBill","action","setCredit","tx","setTx","wifiList","setWifiList","wifiSsid","setWifiSsid","sendOnly","reason","fiatCredit","depositInfo","setDepositAddress","version","setVersion","buildCassetteButtons","sent","total","setPartialSend","readingBills","cryptoCode","translateCoin","cashInFee","setFixedFee","terms","setTermsScreen","dispenseBatch","direction","setDirection","operatorInfo","setOperatorInfo","hardLimit","setHardLimit","setCryptomatModel","areThereAvailablePromoCodes","undefined","setAvailablePromoCodes","discount","setCurrentDiscount","receiptStatus","setReceiptPrint","smsReceiptStatus","context","hide","show","isRecycler","billValidator","setState","t","translate","text","setComplianceTimeout","setConstraint","disableRecyclerBillButtons","enableRecyclerBillButtons","setAccepting","highBill","highestBill","minimumTx","lowestBill","isCashInOnlyCoin","chooseFiat","deposit","fiatReceipt","fiatComplete","chooseCoin","twoWayMode","smsVerification","threshold","emailVerification","idVerification","facephotoPermission","usSsnPermission","externalPermission","blockedCustomer","customInfoRequestPermission","customInfoRequest","invalidAddress","lnInvoiceTypeError","clearTimeout","externalCompliance","externalComplianceUrl","snakecase","fetchArgs","fetch","error","e","setScreen","screen1","title","interval","complianceButton","input","type","screen2","setOpts","constraint","constraintType","maxLength","numDigits","label1","label2","removeClass","addClass","replaceChoices","choiceList","setChooseCoinColors","defaultCoin","slice","setCryptoBuy","setCryptoSell","setupCoinsButtons","openLanguageDropdown","closeLanguageDropdown","openCoinDropdown","closeCoinDropdown","empty","dropdownCoins","length","showMoreButton","forEach","coin","activeClass","el","toLowerCase","display","append","each","html","trim","cashIn","translatedCoin","buyStr","cashOut","sellStr","getCryptoCurrency","cryptoCurrency","find","c","Error","switchCoin","selectedIndex","indexOf","it","splice","document","ready","attachFastClick","Origami","fastclick","body","addEventListener","calculateAspectRatio","onclick","oncontextmenu","onmousedown","onmousemove","onmouseup","BigNumber","config","ROUNDING_MODE","ROUND_HALF_EVEN","Keyboard","id","inputBox","init","Keypad","result","country","submitButtonWrapper","ChoiceList","setInterval","initTranslatePage","wifiNetworkButtons","getElementById","touchEvent","target","attr","moreNetworks","networkButton","closest","ssidEl","ssid","displaySsid","rawSsid","wifiConnectButton","wifiConnectButtonJ","pass","sendCoinsButton","sendCoinsButton2","setupButton","blockedCustomerOk","insertBillCancelButton","touchImmediateEvent","insertBillCancelRecyclerButton","setupImmediateButton","promoCodeCancelButton","bind","submitCodeButton","code","submitEmailButton","submitTextRequirementButton","nextFieldTextRequirementButton","previousFieldTextRequirementButton","val","setInputBox","cryptoButtons","is","wantedCoin","areYouSureCancel","areYouSureContinue","coinRedeem","otherLocale","cashInBox","cashOutBox","languageOverlay","cryptoOverlay","languageButtons","languageButtonJ","newLocale","buildCassetteButtonEvents","initDebug","targetButton","element","classList","special","contains","parentNode","callback","handler","add","remove","stopPropagation","preventDefault","shouldEnableTouch","buttonClass","buttonAction","actionData","newScreen","oldScreen","css","top","left","newView","state","delay","clearTermsConditionsTimeout","clearTermsConditionsAcceptanceDelay","reset","revertScreen","recs","requestedPage","networks","page","offset","remainingCount","len","Math","min","i","rec","bars","floor","strength","moreTxt","setUpDirectionElement","operator","active","name","email","phone","limits","component","hardLimitWeeks","hardLimitDays","hardLimitHours","model","versions","startsWith","continueButton","finishButton","disabled","states","$screen","startPage","acceptDisabled","cancel","accept","setTermsConditionsTimeout","setAcceptButtonDisabled","setTermsConditionsAcceptanceDelay","screen","acceptButton","prop","Boolean","delayTimer","isNaN","seconds","tmpbtn","clone","appendTo","width","outerWidth","clearInterval","resetTermsConditionsTimeout","scrollUp","div","updateButtonStyles","updatePageCounter","scrollTo","acceptedTerms","offsetHeight","style","ceil","textContent","scrollDown","buttonDown","buttonUp","setCountry","setPrimaryLocales","primaryLocales","primaryLocale","otherLanguageName","lang","lookupLocaleNames","nativeName","split","isArabic","isHebrew","translatePage","ex","elem","img","areArraysEqual","arr1","arr2","langMap","languageMappingList","language","localeNames","languages","sortedPrimaryLocales","filter","sort","a","b","langA","langB","englishName","localeCompare","l","toggleClass","_fee","fee","parseFloat","fixedFee","formatFiat","fiat","cryptoAtoms","scale","pow","displayScale","cryptoAmount","toNumber","cryptoDisplayCode","displayCode","updateCrypto","inserted","formatDenomination","denom","toLocaleString","useGrouping","maximumFractionDigits","minimumFractionDigits","_cassettes","numberOfButtons","activeCassettes","count","inactiveCassettes","allCassettes","concat","selectedCassettes","sortedCassettes","denomination","updateCassetteButtons","activeDenoms","children","fiatButtons","lastTouch","now","Date","cashButtonJ","hasClass","selector","formatCrypto","lookupDecimalChar","num","localized","splitNumber","localize","decimalChar","join","formatNumber","amount","fractionDigits","_rates","cryptoToFiat","rateStr","round","cashOutCryptoToFiat","qrize","color","lightning","size","image","_size","clientHeight","opts","crisp","fill","render","rounded","quiet","mPosX","mPosY","mSize","mode","kjua","txId","isPaperWallet","hasBills","bills","promoCodeApplied","formatAddressNoBreakLines","address","firstPart","replace","secondPart","formatAddress","toBr","currentAccepting","transition","x","y","reasonText","bill","errorMessages","transactionLimit","validatorError","lowBalance","str","_cryptoCode","cryptoCodeDisplay","base","messages","locales","Jed","reachFiatLimit","msg","isEmpty","txLimitReached","displayCrypto","decimalPlaces","unitScale","cryptoDisplay","BN","s","activeDenominations","fiatDisplay","eq","activeMap","toAddress","depositUrl","of","current","createElement","innerHTML","getElementsByTagName","appendChild","height","gcd","w","h","r","aspectRatioPt1","aspectRatioPt2","background","doTransition","cb","toShow","toShowOver","start","tl","TimelineMax","set","opacity","zIndex","to","onStart","pause","setupAnimation","isAr800","firstChild","removeChild","Two","fullscreen","Types","svg","autostart","elementId","interpret","ua","navigator","userAgent","match","chromiumVersion","chromeVersion","chromiumPlus73","chromePlus73","currentDiscount","successMessage","status","className","printing","success","message","failMessage","url"],"mappings":"AAAA;AACA;;;;AAEA,IAAMA,cAAcC,OAAOC,QAAP,CAAgBC,MAApC;AACA,IAAMC,SAAS,IAAIC,eAAJ,CAAoBL,YAAYM,SAAZ,CAAsB,CAAtB,CAApB,CAAf;AACA,IAAMC,SAASH,OAAOI,GAAP,CAAW,QAAX,C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xI,cAAM2iB,SAAN,wBAAoC1Y,IAApC,CAAyC8Y,WAAzC;AACA/iB,cAAM2iB,SAAN,wBAAoCpa,WAApC,CAAgD,MAAhD;AACAvI,cAAM2iB,SAAN,2BAAuCna,QAAvC,CAAgD,MAAhD;AACAxI,cAAM2iB,SAAN,4BAAwC1Y,IAAxC,CAA6C8Y,WAA7C;AACA/iB,cAAM2iB,SAAN,4BAAwCpa,WAAxC,CAAoD,MAApD;AACA;AApDJ;AAsDD;;AAED,SAAStB,kBAAT,CAA6B+b,GAA7B,EAAkC;AAChCrH,QAAMqH,GAAN,EAAWhjB,EAAE,8BAAF,CAAX,EAA8CtC,kBAAkB,QAAlB,GAA6Bf,gBAA7B,GAAgDD,iBAA9F;AACA,SAAO8K,UAAU,qBAAV,CAAP;AACD","file":"app.js","sourcesContent":["/* globals $, URLSearchParams, WebSocket, locales, Keyboard, Keypad, Jed, BigNumber, HOST, PORT, Origami, kjua, TimelineMax, Two */\n'use strict'\n\nconst queryString = window.location.search\nconst params = new URLSearchParams(queryString.substring(1))\nconst SCREEN = params.get('screen')\nconst DEBUG_MODE = SCREEN ? 'demo' : params.get('debug')\nconst CASH_OUT_QR_COLOR = '#403c51'\nconst CASH_IN_QR_COLOR = '#0e4160'\nconst NUMBER_OF_BUTTONS = 3\n\nvar scrollSize = 0\nvar textHeightQuantity = 0\nvar currentPage = 0\nvar totalPages = 0\nvar aspectRatio = '16:10'\nvar isTwoWay = null\nvar isRTL = false\nvar two = null\nvar cryptomatModel = null\nvar termsConditionsTimeout = null\nvar termsConditionsAcceptanceInterval = null\nvar T_C_TIMEOUT = 30000\nvar complianceTimeout = null;\nvar cashDirection = null;\n\nvar fiatCode = null\nvar locale = null\nvar defaultLocale = loadI18n('en-US') || null\nvar localeCode = null\nvar jsLocaleCode = null // Sometimes slightly different than localeCode\nvar _primaryLocales = []\nvar lastRates = null\nvar coins\n\nvar currentState\n\nvar accepting = false\nvar websocket = null\nvar wifiKeyboard = null\nvar promoKeyboard = null\nvar usSsnKeypad = null\nvar phoneKeypad = null\nvar securityKeypad = null\nvar previousState = null\nvar buttonActive = true\nvar cassettes = null\nlet currentCryptoCode = null\nlet currentCoin = null\nlet currentCoins = []\nlet emailKeyboard = null\nlet customRequirementNumericalKeypad = null\nlet customRequirementTextKeyboard = null\nlet customRequirementChoiceList = null\n\nvar MUSEO = ['ca', 'cs', 'da', 'de', 'en', 'es', 'et', 'fi', 'fr', 'hr',\n 'hu', 'it', 'lt', 'nb', 'nl', 'pl', 'pt', 'ro', 'sl', 'sv', 'tr']\n\nfunction connect () {\n console.log(`ws://${HOST}:${PORT}/`)\n websocket = new WebSocket(`ws://${HOST}:${PORT}/`)\n websocket.onmessage = function (event) {\n var data = $.parseJSON(event.data)\n processData(data)\n }\n websocket.onerror = err => console.log(err)\n}\n\nfunction verifyConnection () {\n if (websocket.readyState === websocket.CLOSED) {\n connect()\n }\n}\n\nfunction buttonPressed (button, data) {\n if (!buttonActive) return\n wifiKeyboard.deactivate()\n promoKeyboard.deactivate()\n emailKeyboard.deactivate()\n customRequirementTextKeyboard.deactivate()\n buttonActive = false\n setTimeout(function () {\n buttonActive = true\n wifiKeyboard.activate()\n promoKeyboard.activate()\n emailKeyboard.activate()\n customRequirementTextKeyboard.activate()\n }, 300)\n var res = { button: button }\n if (data || data === null) res.data = data\n if (websocket) websocket.send(JSON.stringify(res))\n}\n\nconst displayLN = 'Lightning Network'\nconst displayBTC = 'Bitcoin
(LN)'\nconst LN = 'LN'\nconst BTC = 'BTC'\n\nfunction processData (data) {\n if (data.localeInfo) setLocaleInfo(data.localeInfo)\n if (data.locale) setLocale(data.locale)\n if (data.supportedCoins) setCoins(data.supportedCoins)\n if (!locale) return\n if (data.fiatCode) setFiatCode(data.fiatCode)\n if (data.rates) setExchangeRate(data.rates)\n if (data.buyerAddress) setBuyerAddress(data.buyerAddress)\n if (data.credit) {\n var lastBill = data.action === 'rejectedBill' ? null : data.credit.lastBill\n setCredit(data.credit, lastBill)\n }\n if (data.tx) setTx(data.tx)\n if (data.wifiList) setWifiList(data.wifiList)\n if (data.wifiSsid) setWifiSsid(data.wifiSsid)\n if (data.sendOnly) sendOnly(data.reason)\n if (data.fiatCredit) fiatCredit(data.fiatCredit)\n if (data.depositInfo) setDepositAddress(data.depositInfo)\n if (data.version) setVersion(data.version)\n if (data.cassettes) buildCassetteButtons(data.cassettes, NUMBER_OF_BUTTONS)\n if (data.sent && data.total) setPartialSend(data.sent, data.total)\n if (data.readingBills) readingBills(data.readingBills)\n if (data.cryptoCode) translateCoin(data.cryptoCode)\n if (data.tx && data.tx.cashInFee) setFixedFee(data.tx.cashInFee)\n if (data.terms) setTermsScreen(data.terms)\n if (data.dispenseBatch) dispenseBatch(data.dispenseBatch)\n if (data.direction) setDirection(data.direction)\n if (data.operatorInfo) setOperatorInfo(data.operatorInfo)\n if (data.hardLimit) setHardLimit(data.hardLimit)\n if (data.cryptomatModel) setCryptomatModel(data.cryptomatModel)\n if (data.areThereAvailablePromoCodes !== undefined) setAvailablePromoCodes(data.areThereAvailablePromoCodes)\n\n if (data.tx && data.tx.discount) setCurrentDiscount(data.tx.discount)\n if (data.receiptStatus) setReceiptPrint(data.receiptStatus, null)\n if (data.smsReceiptStatus) setReceiptPrint(null, data.smsReceiptStatus)\n\n if (data.context) {\n $('.js-context').hide()\n $('.js-context-' + data.context).show()\n }\n\n const isRecycler = billValidator => {\n return billValidator === 'HCM2'\n }\n\n switch (data.action) {\n case 'wifiList':\n if (cryptomatModel === 'douro1') {\n setState('wifi')\n } else {\n setState('connect_ethernet')\n }\n break\n case 'wifiPass':\n setState('wifi_password')\n break\n case 'wifiConnecting':\n t('wifi-connecting', translate('This could take a few moments.'))\n setState('wifi_connecting')\n break\n case 'wifiConnected':\n t('wifi-connecting', translate('Connected. Waiting for ticker.'))\n setState('wifi_connecting') // in case we didn't go through wifi-connecting\n break\n case 'pairing':\n setState('pairing')\n break\n case 'pairingError':\n $('.js-pairing-error').text(data.err)\n // Give it some time to update text in background\n setTimeout(function () { setState('pairing_error') }, 500)\n break\n case 'booting':\n if (currentState !== 'maintenance') setState('booting')\n break\n case 'idle':\n case 'fakeIdle':\n setState('idle')\n break\n case 'dualIdle':\n case 'fakeDualIdle':\n setState('dual_idle')\n break\n case 'registerUsSsn':\n usSsnKeypad.activate()\n setState('register_us_ssn')\n setComplianceTimeout(null, 'finishBeforeSms')\n break\n case 'registerPhone':\n phoneKeypad.activate()\n setState('register_phone')\n break\n case 'registerEmail':\n emailKeyboard.setConstraint('email', ['#submit-email'])\n setState('register_email')\n break\n case 'securityCode':\n securityKeypad.activate()\n setState('security_code')\n break\n case 'scanned':\n isRecycler(data.billValidator)\n ? setState('insert_first_bills_recycler')\n : setState('insert_bills')\n break\n case 'acceptingFirstBill':\n $('.js-send-crypto-enable').show()\n setState('insert_bills')\n break\n case 'acceptingBills':\n $('.blocked-customer-top').hide()\n setState('insert_more_bills')\n break\n case 'acceptingFirstRecyclerBills':\n $('.js-continue-crypto-enable').show()\n $('.js-send-crypto-enable').show()\n setState('insert_first_bills_recycler')\n break\n case 'recyclerContinue':\n disableRecyclerBillButtons()\n break;\n case 'acceptingRecyclerBills':\n enableRecyclerBillButtons()\n $('.blocked-customer-top').hide()\n setState('insert_bills_recycler')\n break\n case 'acceptingBill':\n setAccepting(true)\n break\n case 'rejectedBill':\n setAccepting(false)\n break\n case 'cryptoTransferPending':\n setState('sending_coins')\n break\n case 'cryptoTransferComplete':\n setState('completed')\n break\n case 'networkDown':\n setState('trouble')\n break\n case 'balanceLow':\n setState('limit_reached')\n break\n case 'insufficientFunds':\n setState('out_of_coins')\n break\n case 'highBill':\n highBill(data.highestBill, data.reason)\n break\n case 'minimumTx':\n minimumTx(data.lowestBill)\n break\n case 'chooseFiat':\n if (data.isCashInOnlyCoin) {\n setState('cash_in_only_coin')\n break\n }\n chooseFiat(data.chooseFiat)\n break\n case 'deposit':\n setState('deposit')\n deposit(data.tx)\n break\n case 'rejectedDeposit':\n setState('deposit_timeout')\n break\n case 'fiatReceipt':\n fiatReceipt(data.tx)\n break\n case 'fiatComplete':\n fiatComplete(data.tx)\n break\n case 'restart':\n setState('restart')\n break\n case 'chooseCoin':\n chooseCoin(data.coins, data.twoWayMode)\n break\n case 'smsVerification':\n smsVerification(data.threshold)\n break\n case 'emailVerification':\n emailVerification(data.threshold);\n break;\n case 'permission_id':\n idVerification()\n break\n case 'permission_face_photo':\n facephotoPermission()\n break\n case 'usSsnPermission':\n usSsnPermission()\n break\n case 'externalPermission':\n externalPermission()\n break\n case 'blockedCustomer':\n blockedCustomer()\n break\n case 'insertPromoCode':\n promoKeyboard.activate()\n setState('insert_promo_code')\n break\n case 'invalidPromoCode':\n setState('promo_code_not_found')\n break\n case 'customInfoRequestPermission':\n customInfoRequestPermission(data.customInfoRequest)\n break\n case 'inputCustomInfoRequest':\n customInfoRequest(data.customInfoRequest)\n break\n case 'actionRequiredMaintenance':\n setState('action_required_maintenance')\n break\n case 'cashSlotRemoveBills':\n setState('cash_slot_remove_bills')\n break\n case 'leftoverBillsInCashSlot':\n setState('leftover_bills_in_cash_slot')\n break\n case 'invalidAddress':\n invalidAddress(data.lnInvoiceTypeError)\n break\n case 'externalCompliance':\n clearTimeout(complianceTimeout)\n externalCompliance(data.externalComplianceUrl)\n break\n default:\n if (data.action) setState(window.snakecase(data.action))\n }\n}\n\nfunction translate (data, fetchArgs) {\n if (data === \"\")\n return data\n\n try {\n return fetchArgs\n ? locale.translate(data).fetch(...fetchArgs)\n : locale.translate(data).fetch()\n } catch (error) {\n if (!defaultLocale) console.error('Error while translating: ', error)\n else {\n try {\n return fetchArgs\n ? defaultLocale.translate(data).fetch(...fetchArgs)\n : defaultLocale.translate(data).fetch()\n } catch (e) {\n console.error('Error while translating: ', e)\n return data\n }\n }\n }\n}\n\nfunction facephotoPermission () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('permission_face_photo')\n}\n\nfunction usSsnPermission () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('us_ssn_permission')\n}\n\nfunction externalPermission () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('external_permission')\n}\n\nfunction customInfoRequestPermission (customInfoRequest) {\n $('#custom-screen1-title').text(customInfoRequest.screen1.title)\n $('#custom-screen1-text').text(customInfoRequest.screen1.text)\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('custom_permission')\n}\n\nfunction setComplianceTimeout (interval, complianceButton) {\n clearTimeout(complianceTimeout)\n\n if (interval === 0) {\n return\n }\n\n complianceTimeout = setTimeout(function () {\n buttonPressed(complianceButton)\n }, interval == null ? 60000 : interval)\n}\n\nfunction invalidAddress (lnInvoiceTypeError) {\n if (lnInvoiceTypeError) {\n $('#invalid-address').hide()\n $('#invalid-invoice').show()\n } else {\n $('#invalid-invoice').hide()\n $('#invalid-address').show()\n }\n setState('invalid_address')\n}\n\nfunction customInfoRequest (customInfoRequest) {\n switch (customInfoRequest.input.type) {\n case 'numerical':\n $('#custom-screen2-numerical-title').text(customInfoRequest.screen2.title)\n $('#custom-screen2-numerical-text').text(customInfoRequest.screen2.text)\n customRequirementNumericalKeypad.setOpts({\n type: 'custom',\n constraint: customInfoRequest.input.constraintType,\n maxLength: customInfoRequest.input.numDigits\n })\n customRequirementNumericalKeypad.activate()\n setState('custom_permission_screen2_numerical')\n setScreen('custom_permission_screen2_numerical')\n setComplianceTimeout(null, 'cancelCustomInfoRequest')\n break\n case 'text':\n $('#custom-requirement-text-label1').text(customInfoRequest.input.label1)\n $('#custom-requirement-text-label2').text(customInfoRequest.input.label2)\n $('#previous-text-requirement').hide()\n $('#submit-text-requirement').hide()\n $('#next-text-requirement').hide()\n $('#optional-text-field-2').hide()\n $('.key.backspace.standard-backspace-key').removeClass('backspace-margin-left-override')\n $('.custom-info-request-space-key').show()\n // set type of constraint and buttons where that constraint should apply to disable/ enable\n customRequirementTextKeyboard.setConstraint(customInfoRequest.input.constraintType, ['#submit-text-requirement'])\n if (customInfoRequest.input.constraintType === 'spaceSeparation') {\n $('#optional-text-field-2').show()\n $('.key.backspace.standard-backspace-key').addClass('backspace-margin-left-override')\n $('.custom-info-request-space-key').hide()\n customRequirementTextKeyboard.setConstraint(customInfoRequest.input.constraintType, ['#next-text-requirement'])\n }\n setState('custom_permission_screen2_text')\n setScreen('custom_permission_screen2_text')\n setComplianceTimeout(null, 'cancelCustomInfoRequest')\n break\n case 'choiceList':\n $('#custom-screen2-choiceList-title').text(customInfoRequest.screen2.title)\n $('#custom-screen2-choiceList-text').text(customInfoRequest.screen2.text)\n customRequirementChoiceList.replaceChoices(customInfoRequest.input.choiceList, customInfoRequest.input.constraintType)\n setState('custom_permission_screen2_choiceList')\n setScreen('custom_permission_screen2_choiceList')\n setComplianceTimeout(null, 'cancelCustomInfoRequest')\n break\n default:\n return blockedCustomer()\n }\n}\n\nfunction idVerification () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('permission_id')\n}\n\nfunction smsVerification (threshold) {\n console.log('sms threshold to be displayed', threshold)\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('sms_verification')\n}\n\nfunction emailVerification(threshold) {\n setComplianceTimeout(null, 'finishBeforeSms');\n setScreen('email_verification');\n}\n\nfunction blockedCustomer () {\n return setScreen('blocked_customer')\n}\n\nfunction chooseCoin (coins, twoWayMode) {\n if (twoWayMode) {\n $('.choose_coin_state').removeClass('choose-coin-cash-in').addClass('choose-coin-two-way')\n } else {\n $('.choose_coin_state').removeClass('choose-coin-two-way').addClass('choose-coin-cash-in')\n }\n\n isTwoWay = twoWayMode\n setChooseCoinColors()\n // setupAnimation(twoWayMode, aspectRatio800)\n\n const defaultCoin = coins[0]\n\n currentCryptoCode = defaultCoin.cryptoCode\n currentCoin = defaultCoin\n currentCoins = coins.slice(0)\n\n setCryptoBuy(defaultCoin)\n setCryptoSell(defaultCoin)\n\n setupCoinsButtons(coins, currentCryptoCode)\n\n setState('choose_coin')\n}\n\nfunction openLanguageDropdown () {\n $('#language-dropdown-toggle').addClass('hide')\n $('#languages').removeClass('hide')\n $('#language-overlay').removeClass('hide')\n}\n\nfunction closeLanguageDropdown () {\n $('#language-dropdown-toggle').removeClass('hide')\n $('#languages').addClass('hide')\n $('#language-overlay').addClass('hide')\n}\n\nfunction openCoinDropdown () {\n $('#crypto-dropdown-toggle').addClass('hide')\n $('#crypto-overlay').removeClass('hide')\n $('#cryptos').removeClass('hide')\n}\n\nfunction closeCoinDropdown () {\n $('#crypto-dropdown-toggle').removeClass('hide')\n $('#crypto-overlay').addClass('hide')\n $('#cryptos').addClass('hide')\n}\n\nfunction setupCoinsButtons () {\n $('.crypto-buttons').empty()\n closeCoinDropdown()\n\n let coins = currentCoins.slice()\n let dropdownCoins = []\n\n if (coins.length === 1) return\n\n const showMoreButton = coins.length > 4\n if (showMoreButton) {\n $('crypto-dropdown-toggle').removeClass('hide')\n dropdownCoins = coins.slice(3)\n coins = coins.slice(0, 3)\n } else {\n $('crypto-dropdown-toggle').addClass('hide')\n }\n\n coins.forEach(function (coin) {\n const activeClass = coin.cryptoCode === currentCryptoCode ? 'choose-coin-button-active' : ''\n const el = `
\n ${coin.display}\n \n \n \n \n \n
`\n $('.crypto-buttons').append(el)\n })\n if (showMoreButton) {\n $('.crypto-buttons').append(`\n
\n
\n ${translate('More')}\n \n \n \n \n \n
\n
\n
\n `)\n dropdownCoins.forEach(coin => {\n const el = ``\n $('#cryptos').append(el)\n })\n const el = ``\n $('#cryptos').append(el)\n // As we add buttons 'more' and 'less' after initTranslate\n // they don't have baseTranslation translation data attached to them.\n $('.crypto-buttons .js-i18n').each(function () {\n var el = $(this)\n el.data('baseTranslation', el.html().trim())\n })\n }\n}\n\nfunction setCryptoBuy (coin) {\n const cashIn = $('.cash-in')\n const translatedCoin = translate(coin.display === displayLN ? displayBTC : coin.display)\n const buyStr = translate('Buy
%s', [translatedCoin])\n\n cashIn.html(buyStr)\n}\n\nfunction setCryptoSell (coin) {\n const cashOut = $('.cash-out')\n const translatedCoin = translate(coin.display === displayLN ? displayBTC : coin.display)\n const sellStr = translate('Sell
%s', [translatedCoin])\n\n cashOut.html(sellStr)\n}\n\nfunction setCoins (supportedCoins) {\n coins = supportedCoins\n}\n\nfunction getCryptoCurrency (cryptoCode) {\n const cryptoCurrency = coins.find(c => c.cryptoCode === cryptoCode)\n if (!cryptoCurrency) throw new Error(`Unsupported crypto: ${cryptoCode}`)\n return cryptoCurrency\n}\n\nfunction switchCoin (coin) {\n const cashIn = $('.cash-in')\n const cashOut = $('.cash-out')\n const cryptoCode = coin.cryptoCode\n\n if (currentCryptoCode === cryptoCode) return\n\n $(`.coin-${currentCryptoCode.toLowerCase()}`).removeClass('choose-coin-button-active')\n $(`.coin-${cryptoCode.toLowerCase()}`).addClass('choose-coin-button-active')\n currentCryptoCode = cryptoCode\n currentCoin = coin\n\n cashIn.addClass('crypto-switch')\n setTimeout(() => setCryptoBuy(coin), 100)\n setTimeout(() => cashIn.removeClass('crypto-switch'), 1000)\n\n setTimeout(() => {\n cashOut.addClass('crypto-switch')\n setTimeout(() => setCryptoSell(coin), 100)\n setTimeout(() => cashOut.removeClass('crypto-switch'), 1000)\n }, 80)\n\n const selectedIndex = currentCoins.indexOf(currentCoins.find(it => it.cryptoCode === cryptoCode))\n if (currentCoins.length > 4 && selectedIndex > 2) {\n currentCoins.splice(2, 0, currentCoins.splice(selectedIndex, 1)[0])\n }\n\n setupCoinsButtons()\n}\n\n$(document).ready(function () {\n const attachFastClick = Origami.fastclick\n attachFastClick(document.body)\n\n window.addEventListener('resize', () => {\n calculateAspectRatio()\n setChooseCoinColors()\n })\n\n // Matt's anti-drag hack\n window.onclick =\n window.oncontextmenu =\n window.onmousedown =\n window.onmousemove =\n window.onmouseup =\n function () { return false }\n\n BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_HALF_EVEN })\n\n wifiKeyboard = new Keyboard({\n id: 'wifi-keyboard',\n inputBox: '#input-passphrase'\n }).init()\n\n promoKeyboard = new Keyboard({\n id: 'promo-keyboard',\n inputBox: '.promo-code-input'\n }).init(function () {\n if (currentState !== 'insert_promo_code') return\n buttonPressed('cancelPromoCode')\n })\n\n usSsnKeypad = new Keypad('us-ssn-keypad', { type: 'usSsn' }, function (result) {\n if (currentState !== 'register_us_ssn') return\n buttonPressed('usSsn', result)\n })\n\n phoneKeypad = new Keypad('phone-keypad', { type: 'phoneNumber', country: 'US' }, function (result) {\n if (currentState !== 'register_phone') return\n buttonPressed('phoneNumber', result)\n })\n\n securityKeypad = new Keypad('security-keypad', { type: 'code' }, function (result) {\n if (currentState !== 'security_code') return\n buttonPressed('securityCode', result)\n })\n\n customRequirementNumericalKeypad = new Keypad('custom-requirement-numeric-keypad', {\n type: 'custom'\n }, function (result) {\n if (currentState !== 'custom_permission_screen2_numerical') return\n buttonPressed('customInfoRequestSubmit', result)\n })\n\n emailKeyboard = new Keyboard({\n id: 'email-keyboard',\n inputBox: '#email-input',\n submitButtonWrapper: '#submit-email-wrapper',\n setComplianceTimeout: setComplianceTimeout\n }).init(function (result) {\n if (currentState !== 'register_email') return\n buttonPressed('email', result)\n })\n\n customRequirementTextKeyboard = new Keyboard({\n id: 'custom-requirement-text-keyboard',\n inputBox: '.text-input-field-1',\n submitButtonWrapper: '.submit-text-requirement-button-wrapper',\n setComplianceTimeout: setComplianceTimeout\n }).init(function () {\n if (currentState !== 'custom_permission_screen2_text') return\n buttonPressed('customInfoRequestSubmit')\n })\n\n customRequirementChoiceList = new ChoiceList({\n id: 'custom-requirement-choicelist-wrapper',\n setComplianceTimeout: setComplianceTimeout\n }).init(function (result) {\n if (currentState !== 'custom_permission_screen2_choiceList') return\n buttonPressed('customInfoRequestSubmit', result)\n })\n\n if (DEBUG_MODE !== 'demo') {\n connect()\n setInterval(verifyConnection, 1000)\n }\n\n initTranslatePage()\n\n var wifiNetworkButtons = document.getElementById('networks')\n touchEvent(wifiNetworkButtons, function (e) {\n var target = $(e.target)\n if (target.attr('id') === 'more-networks') {\n moreNetworks()\n } else {\n var networkButton = target.closest('.wifi-network-button')\n $('#networks > .active').removeClass('active')\n networkButton.addClass('active')\n window.setTimeout(function () { networkButton.removeClass('active') }, 1000)\n var ssidEl = networkButton.find('.ssid')\n var ssid = ssidEl.data('ssid')\n if (ssid) {\n var displaySsid = ssidEl.text()\n var rawSsid = ssidEl.data('raw-ssid')\n buttonPressed('wifiSelect',\n { ssid: ssid, rawSsid: rawSsid, displaySsid: displaySsid })\n }\n }\n })\n\n var wifiConnectButton = document.getElementById('wifiConnect')\n touchEvent(wifiConnectButton, function () {\n var wifiConnectButtonJ = $(wifiConnectButton)\n wifiConnectButtonJ.addClass('active')\n window.setTimeout(function () { wifiConnectButtonJ.removeClass('active') }, 500)\n var pass = $('#wifi-keyboard input.passphrase').data('content')\n var ssid = $('#js-i18n-wifi-for-ssid').data('ssid')\n var rawSsid = $('#js-i18n-wifi-for-ssid').data('raw-ssid')\n buttonPressed('wifiConnect', { pass: pass, ssid: ssid, rawSsid: rawSsid })\n })\n\n var sendCoinsButton = document.getElementById('send-coins')\n var sendCoinsButton2 = document.getElementById('send-only-send-coins')\n touchEvent(sendCoinsButton, function () {\n setState('sending_coins')\n buttonPressed('sendCoins')\n })\n\n touchEvent(sendCoinsButton2, function () {\n setState('sending_coins')\n buttonPressed('sendCoins')\n })\n\n setupButton('recycler-continue-start', 'recyclerContinue')\n setupButton('recycler-continue', 'recyclerContinue')\n setupButton('recycler-finish', 'sendCoins')\n setupButton('cash-slot-bills-removed', 'cashSlotBillsRemoved')\n setupButton('leftover-bills-removed', 'leftoverBillsRemoved')\n\n const blockedCustomerOk = document.getElementById('blocked-customer-ok')\n touchEvent(blockedCustomerOk, function () {\n buttonPressed('blockedCustomerOk')\n })\n var insertBillCancelButton = document.getElementById('insertBillCancel')\n touchImmediateEvent(insertBillCancelButton, function () {\n setBuyerAddress(null)\n buttonPressed('cancelInsertBill')\n })\n\n var insertBillCancelRecyclerButton = document.getElementById('insertBillCancelRecycler')\n touchImmediateEvent(insertBillCancelRecyclerButton, function () {\n setBuyerAddress(null)\n buttonPressed('cancelInsertBill')\n })\n\n setupImmediateButton('wifiPassCancel', 'cancelWifiPass')\n setupImmediateButton('scanCancel', 'cancelScan')\n setupImmediateButton('completed_viewport', 'completed')\n setupImmediateButton('withdraw_failure_viewport', 'completed')\n setupImmediateButton('out_of_coins_viewport', 'completed')\n setupImmediateButton('fiat_receipt_viewport', 'completed')\n setupImmediateButton('fiat_complete_viewport', 'completed')\n setupImmediateButton('chooseFiatCancel', 'chooseFiatCancel')\n setupImmediateButton('depositCancel', 'depositCancel')\n setupImmediateButton('printer-scan-cancel', 'cancelScan')\n\n setupButton('printer-back-to-home', 'idle')\n setupButton('printer-print-again', 'printAgain')\n setupButton('printer-print-again2', 'printAgain')\n setupButton('printer-scan-again', 'printerScanAgain')\n\n setupButton('insert-first-bill-promo-button', 'insertPromoCode')\n setupButton('insert-first-recycler-bills-promo-button', 'insertPromoCode')\n setupButton('choose-fiat-promo-button', 'insertPromoCode')\n\n var promoCodeCancelButton = document.getElementById('promo-code-cancel')\n touchImmediateEvent(promoCodeCancelButton, function () {\n promoKeyboard.deactivate.bind(promoKeyboard)\n buttonPressed('cancelPromoCode')\n })\n\n var submitCodeButton = document.getElementById('submit-promo-code')\n touchEvent(submitCodeButton, function () {\n promoKeyboard.deactivate.bind(promoKeyboard)\n var code = $('.promo-code-input').data('content')\n buttonPressed('submitPromoCode', { input: code })\n })\n\n const submitEmailButton = document.getElementById('submit-email')\n const submitTextRequirementButton = document.getElementById('submit-text-requirement')\n const nextFieldTextRequirementButton = document.getElementById('next-text-requirement')\n const previousFieldTextRequirementButton = document.getElementById('previous-text-requirement')\n touchEvent(submitEmailButton, function () {\n emailKeyboard.deactivate.bind(emailKeyboard)\n var text = $('#email-input').data('content')\n buttonPressed('email', text)\n $('#email-input').data('content', '').val('')\n emailKeyboard.setInputBox('#email-input')\n })\n touchEvent(submitTextRequirementButton, function () {\n customRequirementTextKeyboard.deactivate.bind(customRequirementTextKeyboard)\n var text = `${$('.text-input-field-1').data('content')} ${$('.text-input-field-2').data('content') || ''}`\n buttonPressed('customInfoRequestSubmit', text)\n $('.text-input-field-1').removeClass('faded').data('content', '').val('')\n $('.text-input-field-2').addClass('faded').data('content', '').val('')\n customRequirementTextKeyboard.setInputBox('.text-input-field-1')\n })\n touchEvent(nextFieldTextRequirementButton, function() {\n $('.text-input-field-1').addClass('faded')\n $('.text-input-field-2').removeClass('faded')\n $('#next-text-requirement').hide()\n $('#previous-text-requirement').show()\n $('#submit-text-requirement').show()\n // changing input box changes buttons where validation works on\n customRequirementTextKeyboard.setInputBox('.text-input-field-2', ['#submit-text-requirement'])\n })\n touchEvent(previousFieldTextRequirementButton, function() {\n $('.text-input-field-1').removeClass('faded')\n $('.text-input-field-2').addClass('faded')\n $('#next-text-requirement').show()\n $('#previous-text-requirement').hide()\n $('#submit-text-requirement').hide()\n customRequirementTextKeyboard.setInputBox('.text-input-field-1', ['#next-text-requirement'])\n })\n\n setupButton('submit-promo-code', 'submitPromoCode', {\n input: $('.promo-code-input').data('content')\n })\n setupButton('promo-code-try-again', 'insertPromoCode')\n setupButton('promo-code-continue', 'cancelPromoCode')\n\n setupButton('initialize', 'initialize')\n setupButton('pairing-scan', 'pairingScan')\n setupImmediateButton('pairing-scan-cancel', 'pairingScanCancel')\n setupButton('pairing-error-ok', 'pairingErrorOk')\n setupButton('cash-out-button', 'cashOut')\n\n setupImmediateButton('scan-id-cancel', 'idDataActionCancel')\n setupImmediateButton('scan-photo-cancel', 'idPhotoActionCancel')\n setupImmediateButton('scan-photo-manual-cancel', 'idPhotoActionCancel')\n setupImmediateButton('us-ssn-cancel', 'cancelUsSsn',\n usSsnKeypad.deactivate.bind(usSsnKeypad))\n setupImmediateButton('phone-number-cancel', 'cancelPhoneNumber',\n phoneKeypad.deactivate.bind(phoneKeypad))\n setupImmediateButton('security-code-cancel', 'cancelSecurityCode',\n securityKeypad.deactivate.bind(securityKeypad))\n setupButton('id-verification-failed-ok', 'idVerificationFailedOk')\n setupButton('id-scan-failed-try-again', 'idCodeFailedRetry')\n setupButton('id-scan-failed-cancel', 'idVerificationFailedOk')\n setupButton('id-code-failed-retry', 'idCodeFailedRetry')\n setupButton('id-code-failed-cancel', 'bye')\n setupButton('id-verification-error-ok', 'idVerificationErrorOk')\n setupButton('photo-scan-failed-retry', 'retryPhotoScan')\n setupButton('photo-scan-failed-cancel', 'photoScanVerificationCancel')\n setupButton('photo-verification-failed-ok', 'cancelIdScan')\n setupButton('invalid-address-try-again', 'invalidAddressTryAgain')\n setupButton('address-reuse-start-over', 'idle')\n setupButton('suspicious-address-start-over', 'idle')\n\n setupButton('sanctions-failure-ok', 'idle')\n setupButton('limit-reached-ok', 'idle')\n setupButton('hard-limit-reached-ok', 'idle')\n setupButton('deposit-timeout-sent-yes', 'depositTimeout')\n setupButton('deposit-timeout-sent-no', 'depositTimeoutNotSent')\n setupButton('out-of-cash-ok', 'idle')\n setupButton('cash-in-disabled-ok', 'idle')\n setupButton('cash-in-only-ok', 'idle')\n\n setupButton('bad-phone-number-ok', 'badPhoneNumberOk')\n setupButton('bad-security-code-ok', 'badSecurityCodeOk')\n setupButton('max-phone-retries-ok', 'maxPhoneRetriesOk')\n //setupButton('max-email-retries-ok', 'maxEmailRetriesOk')\n setupButton('redeem-later-ok', 'idle')\n setupButton('pre-receipt-ok', 'fiatReceipt')\n setupButton('fiat-error-ok', 'idle')\n setupButton('network-down-ok', 'idle')\n setupButton('fiat-transaction-error-ok', 'fiatReceipt')\n\n setupButton('unknown-phone-number-ok', 'idle')\n setupButton('unknown-email-ok', 'idle')\n setupButton('unconfirmed-deposit-ok', 'idle')\n setupButton('tx-not-seen-ok', 'idle')\n setupButton('wrong-dispenser-currency-ok', 'idle')\n\n setupButton('print-receipt-cash-in-button', 'printReceipt')\n setupButton('print-receipt-cash-out-button', 'printReceipt')\n setupButton('print-receipt-cash-in-fail-button', 'printReceipt')\n\n setupButton('send-sms-receipt-cash-in-button', 'sendSmsReceipt')\n setupButton('send-sms-receipt-cash-out-button', 'sendSmsReceipt')\n setupButton('send-sms-receipt-cash-in-fail-button', 'sendSmsReceipt')\n\n setupButton('terms-ok', 'termsAccepted')\n setupButton('terms-ko', 'idle')\n\n setupButton('maintenance_restart', 'maintenanceRestart')\n\n calculateAspectRatio()\n\n const cryptoButtons = document.getElementById('crypto-buttons')\n touchEvent(cryptoButtons, event => {\n let el = $(event.target)\n if (el.is('path') || el.is('svg') || el.is('span')) {\n el = el.closest('div')\n }\n\n if (el.data('more')) {\n openCoinDropdown()\n return\n }\n\n if (el.data('less')) {\n closeCoinDropdown()\n return\n }\n\n const cryptoCode = el.data('cryptoCode')\n if (!cryptoCode) return\n\n const wantedCoin = currentCoins.find(it => it.cryptoCode === cryptoCode)\n if (!wantedCoin) return\n\n const coin = { cryptoCode, display: wantedCoin.display === displayLN ? displayBTC : wantedCoin.display }\n switchCoin(coin)\n })\n\n var areYouSureCancel = document.getElementById('are-you-sure-cancel-transaction')\n touchEvent(areYouSureCancel, () => buttonPressed('cancelTransaction', previousState))\n\n var areYouSureContinue = document.getElementById('are-you-sure-continue-transaction')\n touchEvent(areYouSureContinue, () => buttonPressed('continueTransaction', previousState))\n\n var coinRedeem = document.getElementById('coin-redeem-button')\n touchEvent(coinRedeem, () => {\n setDirection('cashOut')\n buttonPressed('redeem')\n })\n\n setupButton('facephoto-scan-failed-retry', 'retryFacephoto')\n setupButton('id-start-verification', 'permissionIdCompliance')\n setupButton('sms-start-verification', 'permissionSmsCompliance')\n setupButton('email-start-verification', 'permissionEmailCompliance');\n setupButton('ready-to-scan-id-card-photo', 'scanIdCardPhoto')\n setupButton('facephoto-permission-yes', 'permissionPhotoCompliance')\n setupButton('us-ssn-permission-yes', 'permissionUsSsnCompliance')\n setupButton('external-permission-yes', 'permissionExternalCompliance')\n\n setupButton('send-coins-id', 'finishBeforeSms')\n setupButton('send-coins-id-2', 'finishBeforeSms')\n setupButton('send-coins-sms', 'finishBeforeSms')\n setupButton('send-coins-sms-2', 'finishBeforeSms')\n setupButton('send-coins-email', 'finishBeforeSms');\n setupButton('send-coins-email-2', 'finishBeforeSms');\n\n setupButton('facephoto-permission-no', 'finishBeforeSms')\n setupButton('us-ssn-permission-send-coins', 'finishBeforeSms')\n setupButton('us-ssn-permission-cancel', 'finishBeforeSms')\n setupButton('us-ssn-cancel', 'finishBeforeSms')\n setupButton('external-permission-send-coins', 'finishBeforeSms')\n setupButton('facephoto-scan-failed-cancel', 'finishBeforeSms')\n setupButton('facephoto-scan-failed-cancel2', 'finishBeforeSms')\n\n setupButton('custom-permission-yes', 'permissionCustomInfoRequest')\n setupButton('custom-permission-no', 'finishBeforeSms')\n setupImmediateButton('custom-permission-cancel-numerical', 'cancelCustomInfoRequest', () => {\n customRequirementNumericalKeypad.deactivate.bind(customRequirementNumericalKeypad)\n })\n setupImmediateButton('email-cancel', 'cancelEmail', () => {\n emailKeyboard.deactivate.bind(emailKeyboard)\n $('#email-input').data('content', '').val('')\n emailKeyboard.setInputBox('#email-input')\n })\n setupImmediateButton('custom-permission-cancel-text', 'cancelCustomInfoRequest', () => {\n customRequirementTextKeyboard.deactivate.bind(customRequirementTextKeyboard)\n $('.text-input-field-1').removeClass('faded').data('content', '').val('')\n $('.text-input-field-2').addClass('faded').data('content', '').val('')\n customRequirementTextKeyboard.setInputBox('.text-input-field-1')\n })\n setupImmediateButton('custom-permission-cancel-choiceList', 'cancelCustomInfoRequest', () => {\n })\n\n setupButton('custom-permission-yes', 'permissionCustomInfoRequest')\n setupButton('custom-permission-no', 'finishBeforeSms')\n setupImmediateButton('custom-permission-cancel-numerical', 'cancelCustomInfoRequest', () => {\n customRequirementNumericalKeypad.deactivate.bind(customRequirementNumericalKeypad)\n })\n setupImmediateButton('custom-permission-cancel-text', 'cancelCustomInfoRequest', () => {\n customRequirementTextKeyboard.deactivate.bind(customRequirementTextKeyboard)\n $('.text-input-field-1').removeClass('faded').data('content', '').val('')\n $('.text-input-field-2').addClass('faded').data('content', '').val('')\n customRequirementTextKeyboard.setInputBox('.text-input-field-1')\n })\n\n setupButton('external-validation-ok', 'finishBeforeSms')\n\n touchEvent(document.getElementById('change-language-section'), () => {\n if (_primaryLocales.length === 2) {\n setLocale(otherLocale())\n setCryptoBuy(currentCoin)\n setCryptoSell(currentCoin)\n return\n }\n openLanguageDropdown()\n })\n\n const cashInBox = document.getElementById('cash-in-box')\n touchEvent(cashInBox, () => {\n buttonPressed('start', { cryptoCode: currentCryptoCode, direction: 'cashIn' })\n })\n\n const cashOutBox = document.getElementById('cash-out-box')\n touchEvent(cashOutBox, () => {\n buttonPressed('start', { cryptoCode: currentCryptoCode, direction: 'cashOut' })\n })\n\n var languageOverlay = document.getElementById('language-overlay')\n touchEvent(languageOverlay, function (e) {\n closeLanguageDropdown()\n })\n\n var cryptoOverlay = document.getElementById('crypto-overlay')\n touchEvent(cryptoOverlay, function (e) {\n closeCoinDropdown()\n })\n\n var languageButtons = document.getElementById('languages')\n touchEvent(languageButtons, function (e) {\n var languageButtonJ = $(e.target).closest('button')\n if (languageButtonJ.length === 0) return\n var newLocale = languageButtonJ.attr('data-locale')\n\n if (!newLocale) {\n closeLanguageDropdown()\n return\n }\n\n setLocale(newLocale)\n setCryptoBuy(currentCoin)\n setCryptoSell(currentCoin)\n closeLanguageDropdown()\n })\n\n buildCassetteButtonEvents()\n initDebug()\n})\n\nfunction targetButton (element) {\n var classList = element.classList || []\n var special = classList.contains('button') ||\n classList.contains('circle-button') ||\n classList.contains('wifi-network-button') ||\n classList.contains('square-button')\n if (special) { return element }\n return targetButton(element.parentNode)\n}\n\nfunction touchEvent (element, callback) {\n function handler (e) {\n var target = targetButton(e.target)\n\n target.classList.add('active')\n\n // Wait for transition to finish\n setTimeout(function () {\n target.classList.remove('active')\n }, 300)\n\n setTimeout(function () {\n callback(e)\n }, 200)\n\n e.stopPropagation()\n e.preventDefault()\n }\n\n if (shouldEnableTouch()) {\n element.addEventListener('touchstart', handler)\n }\n element.addEventListener('mousedown', handler)\n}\n\nfunction touchImmediateEvent (element, callback) {\n function handler (e) {\n callback(e)\n e.stopPropagation()\n e.preventDefault()\n }\n if (shouldEnableTouch()) {\n element.addEventListener('touchstart', handler)\n }\n element.addEventListener('mousedown', handler)\n}\n\nfunction setupImmediateButton (buttonClass, buttonAction, callback) {\n var button = document.getElementById(buttonClass)\n touchImmediateEvent(button, function () {\n if (callback) callback()\n buttonPressed(buttonAction)\n })\n}\n\nfunction setupButton (buttonClass, buttonAction, actionData) {\n var button = document.getElementById(buttonClass)\n touchEvent(button, function () {\n buttonPressed(buttonAction, actionData)\n })\n}\n\nfunction setScreen (newScreen, oldScreen) {\n if (newScreen === oldScreen) return\n\n if (newScreen === 'insert_bills') {\n $('.js-processing-bill').html(translate('Lamassu Cryptomat'))\n $('.bill img').css({'-webkit-transform': 'none', top: 0, left: 0})\n }\n\n var newView = $('.' + newScreen + '_state')\n if (newView.length !== 1) console.log('FATAL: ' + newView.length + ' screens found of class ' + newScreen + '_state')\n\n $('.viewport').removeClass('viewport-active')\n newView.addClass('viewport-active')\n}\n\nfunction setState (state, delay) {\n if (state === currentState) return\n\n if (currentState === 'terms_screen') {\n clearTermsConditionsTimeout()\n clearTermsConditionsAcceptanceDelay()\n }\n\n setComplianceTimeout(0)\n\n previousState = currentState\n currentState = state\n\n wifiKeyboard.reset()\n promoKeyboard.reset()\n emailKeyboard.reset()\n customRequirementTextKeyboard.reset()\n\n if (state === 'idle') {\n $('.qr-code').empty()\n $('.qr-code-deposit').empty()\n }\n\n if (delay) {\n window.setTimeout(function () {\n setScreen(currentState, previousState)\n }, delay)\n } else setScreen(currentState, previousState)\n}\n\nfunction revertScreen () { setScreen(currentState) }\n\nfunction setWifiList (recs, requestedPage) {\n var networks = $('#networks')\n if (!recs) recs = networks.data('recs')\n var page = requestedPage || networks.data('page') || 0\n var offset = page * 4\n if (offset > recs.length - 1) {\n offset = 0\n page = 0\n }\n $('#more-networks').css({ 'display': 'none' })\n networks.empty()\n networks.data('page', page)\n networks.data('recs', recs)\n var remainingCount = recs.length - offset\n var len = Math.min(remainingCount, 4)\n for (var i = 0; i < len; i++) {\n var rec = recs[i + offset]\n var bars = Math.floor(rec.strength * 4) + 1\n var html = '
' +\n '' + rec.displaySsid +\n '' + '
'\n networks.append(html)\n }\n\n var moreTxt = translate('MORE')\n var button = '' + moreTxt + ''\n if (recs.length > 4) {\n networks.append(button)\n }\n}\n\nfunction setUpDirectionElement (element, direction) {\n if (direction === 'cashOut') {\n element.removeClass('cash-in-color')\n element.addClass('cash-out-color')\n } else {\n element.addClass('cash-in-color')\n element.removeClass('cash-out-color')\n }\n}\n\nfunction setOperatorInfo (operator) {\n if (!operator || !operator.active) {\n $('.contacts, .contacts-compact').addClass('hide')\n } else {\n $('.contacts, .contacts-compact').removeClass('hide')\n $('.operator-name').text(operator.name)\n $('.operator-email').text(operator.email)\n $('.operator-phone').text(operator.phone)\n }\n}\n\nfunction setHardLimit (limits) {\n const component = $('#hard-limit-hours')\n if (limits.hardLimitWeeks >= 1) {\n return component.text(translate('Please come back in %s weeks', [limits.hardLimitWeeks]))\n }\n\n if (limits.hardLimitDays >= 1) {\n return component.text(translate('Please come back in %s days and %s hours', [limits.hardLimitDays, limits.hardLimitHours]))\n }\n\n component.text(translate('Please come back in %s hours', [limits.hardLimitHours]))\n}\n\nfunction setCryptomatModel (model) {\n cryptomatModel = model\n const versions = ['sintra', 'douro', 'gaia', 'tejo', 'grandola', 'aveiro', 'coincloud', 'gmuk1', 'batm7in']\n const body = $('body')\n\n versions.forEach(it => body.removeClass(it))\n $('body').addClass(model.startsWith('douro') ? 'douro' : model)\n}\n\nfunction enableRecyclerBillButtons() {\n var continueButton = document.getElementById('recycler-continue');\n var finishButton = document.getElementById('recycler-finish');\n continueButton.disabled = false;\n finishButton.disabled = false;\n}\n\nfunction disableRecyclerBillButtons() {\n var continueButton = document.getElementById('recycler-continue');\n var finishButton = document.getElementById('recycler-finish');\n continueButton.disabled = true;\n finishButton.disabled = true;\n}\n\nfunction setDirection (direction) {\n let states = [\n $('.scan_id_photo_state'),\n $('.scan_manual_id_photo_state'),\n $('.scan_id_data_state'),\n $('.security_code_state'),\n $('.register_us_ssn_state'),\n $('.us_ssn_permission_state'),\n $('.register_phone_state'),\n $('.register_email_state'),\n $('.terms_screen_state'),\n $('.verifying_id_photo_state'),\n $('.verifying_face_photo_state'),\n $('.verifying_id_data_state'),\n $('.permission_id_state'),\n $('.sms_verification_state'),\n $('.email_verification_state'),\n $('.bad_phone_number_state'),\n $('.bad_security_code_state'),\n $('.max_phone_retries_state'),\n $('.max_email_retries_state'),\n $('.failed_permission_id_state'),\n $('.failed_verifying_id_photo_state'),\n $('.blocked_customer_state'),\n $('.fiat_error_state'),\n $('.fiat_transaction_error_state'),\n $('.failed_scan_id_data_state'),\n $('.sanctions_failure_state'),\n $('.error_permission_id_state'),\n $('.scan_face_photo_state'),\n $('.retry_scan_face_photo_state'),\n $('.permission_face_photo_state'),\n $('.failed_scan_face_photo_state'),\n $('.hard_limit_reached_state'),\n $('.failed_scan_id_photo_state'),\n $('.retry_permission_id_state'),\n $('.waiting_state'),\n $('.insert_promo_code_state'),\n $('.promo_code_not_found_state'),\n $('.custom_permission_state'),\n $('.external_permission_state'),\n $('.custom_permission_screen2_numerical_state'),\n $('.custom_permission_screen2_text_state'),\n $('.custom_permission_screen2_choiceList_state'),\n $('.external_compliance_state')\n ]\n cashDirection = direction\n states.forEach(it => {\n setUpDirectionElement(it, direction)\n })\n}\n\n/**\n *\n * @param {Object} data\n * @param {boolean} data.active\n * @param {String} data.title\n * @param {String} data.text\n * @param {String} data.accept\n * @param {String} data.cancel\n */\nfunction setTermsScreen (data) {\n const $screen = $('.terms_screen_state')\n $screen.find('.js-terms-title').html(data.title)\n startPage(data.text, data.acceptDisabled)\n $screen.find('.js-terms-cancel-button').html(data.cancel)\n $screen.find('.js-terms-accept-button').html(data.accept)\n setTermsConditionsTimeout()\n setAcceptButtonDisabled($screen, data)\n setTermsConditionsAcceptanceDelay($screen, data)\n}\n\nfunction setAcceptButtonDisabled (screen, data) {\n var acceptButton = screen.find('.js-terms-accept-button');\n acceptButton.prop('disabled', Boolean(data.acceptDisabled));\n}\n\nfunction clearTermsConditionsTimeout () {\n clearTimeout(termsConditionsTimeout)\n}\n\nfunction setTermsConditionsTimeout () {\n termsConditionsTimeout = setTimeout(function () {\n if (currentState === 'terms_screen') {\n buttonPressed('idle')\n }\n }, T_C_TIMEOUT)\n}\n\nfunction setTermsConditionsAcceptanceDelay (screen, data) {\n let acceptButton = screen.find('.js-terms-accept-button')\n acceptButton.css({ 'min-width': 0 })\n\n if (!data.delay) return\n\n const delayTimer = isNaN(data.delayTimer) ? 0 : data.delayTimer\n let seconds = delayTimer / 1000\n acceptButton.prop('disabled', true)\n acceptButton.html(seconds > 0 ? `${data.accept} (${seconds})` : `${data.accept}`)\n\n var tmpbtn = acceptButton.clone().appendTo('body').css({ 'display': 'block', 'visibility': 'hidden' })\n var width = tmpbtn.outerWidth()\n tmpbtn.remove()\n acceptButton.css({ 'min-width': `${width}px` })\n termsConditionsAcceptanceInterval = setInterval(function () {\n seconds--\n if (currentState === 'terms_screen' && seconds > 0) {\n acceptButton.html(`${data.accept} (${seconds})`)\n }\n if (currentState === 'terms_screen' && seconds <= 0) {\n acceptButton.prop('disabled', false)\n acceptButton.html(`${data.accept}`)\n }\n if (seconds <= 0) {\n clearInterval(termsConditionsAcceptanceInterval)\n }\n }, 1000)\n}\n\nfunction clearTermsConditionsAcceptanceDelay () {\n clearInterval(termsConditionsAcceptanceInterval)\n}\n\nfunction resetTermsConditionsTimeout () {\n clearTermsConditionsTimeout()\n setTermsConditionsTimeout()\n}\n\n// click page up button\nfunction scrollUp () {\n resetTermsConditionsTimeout()\n const div = document.getElementById('js-terms-text-div')\n if (currentPage !== 0) {\n currentPage -= 1\n updateButtonStyles()\n updatePageCounter()\n div.scrollTo(0, currentPage * scrollSize)\n }\n}\n\n// start page\nfunction startPage (text, acceptedTerms) {\n const $screen = $('.terms_screen_state')\n $screen.find('.js-terms-text').html(text)\n if (!acceptedTerms) currentPage = 0\n totalPages = 0\n setTimeout(function () {\n const div = document.getElementById('js-terms-text-div')\n textHeightQuantity = document.getElementById('js-terms-text').offsetHeight\n scrollSize = div.offsetHeight - 40\n updateButtonStyles()\n if (text.length <= 1000 && textHeightQuantity <= div.offsetHeight) {\n document.getElementById('actions-scroll').style.display = 'none'\n } else {\n document.getElementById('actions-scroll').style.display = ''\n if (!acceptedTerms) div.scrollTo(0, 0)\n totalPages = Math.ceil(textHeightQuantity / scrollSize)\n updatePageCounter()\n }\n }, 100)\n}\n\nfunction updatePageCounter () {\n document.getElementById('terms-page-counter').textContent = `${currentPage + 1}/${totalPages}`\n}\n\n// click page up button\nfunction scrollDown () {\n resetTermsConditionsTimeout()\n const div = document.getElementById('js-terms-text-div')\n if (!(currentPage * scrollSize + scrollSize > textHeightQuantity && currentPage !== 0)) {\n currentPage += 1\n updateButtonStyles()\n updatePageCounter()\n div.scrollTo(0, currentPage * scrollSize)\n }\n}\n\nfunction updateButtonStyles () {\n textHeightQuantity = document.getElementById('js-terms-text').offsetHeight\n const buttonDown = document.getElementById('scroll-down')\n const buttonUp = document.getElementById('scroll-up')\n if (currentPage === 0) {\n buttonUp.disabled = true\n } else {\n buttonUp.disabled = false\n }\n\n if (currentPage * scrollSize + scrollSize > textHeightQuantity && currentPage !== 0) {\n buttonDown.disabled = true\n } else {\n buttonDown.disabled = false\n }\n}\n\nfunction moreNetworks () {\n var networks = $('#networks')\n var page = networks.data('page')\n setWifiList(null, page + 1)\n}\n\nfunction setWifiSsid (data) {\n $('#js-i18n-wifi-for-ssid').data('ssid', data.ssid)\n $('#js-i18n-wifi-for-ssid').data('raw-ssid', data.rawSsid)\n t('wifi-for-ssid', translate('for %s', ['' + data.ssid + '']))\n t('wifi-connect', translate(\"You're connecting to the WiFi network %s\", ['' + data.ssid + '']))\n}\n\nfunction setLocaleInfo (data) {\n phoneKeypad.setCountry(data.country)\n setPrimaryLocales(data.primaryLocales)\n setLocale(data.primaryLocale)\n}\n\nfunction otherLanguageName () {\n const lang = lookupLocaleNames(otherLocale())\n return lang && lang.nativeName\n}\n\nfunction otherLocale () {\n return _primaryLocales.find(c => c !== localeCode)\n}\n\nfunction setLocale (data) {\n if (!data || data === localeCode) return\n localeCode = data\n jsLocaleCode = data\n var lang = localeCode.split('-')[0]\n\n if (jsLocaleCode === 'fr-QC') jsLocaleCode = 'fr-CA'\n\n var isArabic = jsLocaleCode.indexOf('ar-') === 0\n var isHebrew = jsLocaleCode.indexOf('he-') === 0\n isRTL = isArabic || isHebrew\n\n setChooseCoinColors()\n // setupAnimation(isTwoWay, aspectRatio800)\n\n if (isRTL) {\n $('body').addClass('i18n-rtl')\n } else {\n $('body').removeClass('i18n-rtl')\n }\n\n if (isArabic) {\n $('body').addClass('i18n-ar')\n } else {\n $('body').removeClass('i18n-ar')\n }\n\n if (isHebrew) {\n $('body').addClass('i18n-he')\n } else {\n $('body').removeClass('i18n-he')\n }\n\n if (MUSEO.indexOf(lang) !== -1) $('body').addClass('museo')\n else $('body').removeClass('museo')\n\n locale = loadI18n(localeCode)\n try { translatePage() } catch (ex) {}\n\n $('.js-two-language').html(otherLanguageName())\n\n if (lastRates) setExchangeRate(lastRates)\n}\n\nfunction setChooseCoinColors () {\n var elem = $('#bg-to-show > img')\n let img = `images/background/${isTwoWay ? '2way' : '1way'}-${aspectRatio}${isRTL ? '-rtl' : ''}.svg`\n if (img !== elem.attr('src')) {\n elem.attr('src', img)\n }\n\n if (isTwoWay) {\n $('.choose_coin_state .change-language').removeClass('cash-in-color').addClass('cash-out-color')\n } else {\n $('.choose_coin_state .change-language').removeClass('cash-out-color').addClass('cash-in-color')\n }\n}\n\nfunction areArraysEqual (arr1, arr2) {\n if (arr1.length !== arr2.length) return false\n for (var i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) return false\n }\n return true\n}\n\nfunction lookupLocaleNames (locale) {\n if (!locale) return\n var langMap = window.languageMappingList\n var language = locale.split('-')[0]\n var localeNames = langMap[language]\n return localeNames || langMap[locale]\n}\n\nfunction setPrimaryLocales (primaryLocales) {\n if (areArraysEqual(primaryLocales, _primaryLocales)) return\n _primaryLocales = primaryLocales\n\n var languages = $('#languages')\n closeLanguageDropdown()\n languages.empty()\n var sortedPrimaryLocales = primaryLocales.filter(lookupLocaleNames).sort(function (a, b) {\n var langA = lookupLocaleNames(a)\n var langB = lookupLocaleNames(b)\n return langA.englishName.localeCompare(langB.englishName)\n })\n\n languages.append(``)\n for (var i = 0; i < sortedPrimaryLocales.length; i++) {\n var l = sortedPrimaryLocales[i]\n var lang = lookupLocaleNames(l)\n var name = lang.nativeName || lang.englishName\n var div = ``\n languages.append(div)\n }\n\n $('.js-two-language').html(otherLanguageName())\n\n $('.js-menu-language').toggleClass('hide', sortedPrimaryLocales.length <= 1)\n $('.js-multi-language').toggleClass('hide', sortedPrimaryLocales.length === 2)\n $('.js-two-language').toggleClass('hide', sortedPrimaryLocales.length > 2)\n}\n\nfunction setFiatCode (data) {\n fiatCode = data\n $('.js-currency').text(fiatCode)\n}\n\nfunction setFixedFee (_fee) {\n const fee = parseFloat(_fee)\n if (fee > 0) {\n const fixedFee = translate('Transaction Fee: %s', [formatFiat(fee, 2)])\n $('.js-i18n-fixed-fee').html(fixedFee)\n } else {\n $('.js-i18n-fixed-fee').html('')\n }\n}\n\nfunction setCredit (credit, lastBill) {\n const { fiat, cryptoAtoms, cryptoCode } = credit\n var coin = getCryptoCurrency(cryptoCode)\n\n var scale = new BigNumber(10).pow(coin.displayScale)\n var cryptoAmount = new BigNumber(cryptoAtoms).div(scale).toNumber()\n var cryptoDisplayCode = coin.displayCode\n updateCrypto('.total-crypto-rec', cryptoAmount, cryptoDisplayCode)\n $('.amount-deposited').html(translate('You deposited %s', [`${fiat} ${fiatCode}`]))\n $('.fiat .js-amount').html(fiat)\n\n var inserted = lastBill\n ? translate('You inserted a %s bill', [formatFiat(lastBill)])\n : translate('Lamassu Cryptomat')\n\n $('.js-processing-bill').html(inserted)\n\n $('.js-continue-crypto-enable').show()\n $('.js-send-crypto-enable').show()\n}\n\nfunction formatDenomination (denom) {\n return denom.toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: 0,\n minimumFractionDigits: 0\n })\n}\n\nfunction buildCassetteButtons (_cassettes, numberOfButtons) {\n cassettes = _cassettes\n var activeCassettes = _cassettes.filter(it => it.count === null || it.count > 0)\n var inactiveCassettes = _cassettes.filter(it => it.count === 0)\n\n var allCassettes = activeCassettes.concat(inactiveCassettes)\n var selectedCassettes = allCassettes.slice(0, numberOfButtons)\n var sortedCassettes = selectedCassettes.sort((a, b) => a.denomination - b.denomination)\n\n for (var i = 0; i < sortedCassettes.length; i++) {\n var denomination = formatDenomination(sortedCassettes[i].denomination || 0)\n $('.cash-button[data-denomination-index=' + i + '] .js-denomination').text(denomination)\n }\n}\n\nfunction updateCassetteButtons (activeDenoms, numberOfButtons) {\n for(var i = 0; i < numberOfButtons; i++) {\n var button = $('.choose_fiat_state .cash-button[data-denomination-index=' + i + ']')\n var denomination = button.children('.js-denomination').text()\n button.prop('disabled', !Boolean(activeDenoms[denomination]))\n }\n}\n\nfunction buildCassetteButtonEvents () {\n var fiatButtons = document.getElementById('js-fiat-buttons')\n var lastTouch = null\n\n touchImmediateEvent(fiatButtons, function (e) {\n var now = Date.now()\n if (lastTouch && now - lastTouch < 100) return\n lastTouch = now\n var cashButtonJ = $(e.target).closest('.cash-button')\n if (cashButtonJ.length === 0) return\n if (cashButtonJ.hasClass('disabled')) return\n if (cashButtonJ.hasClass('clear')) return buttonPressed('clearFiat')\n buttonPressed('fiatButton', { denomination: cashButtonJ.children('.js-denomination').text() })\n })\n}\n\nfunction updateCrypto (selector, cryptoAmount, cryptoDisplayCode) {\n $(selector).find('.crypto-amount').html(formatCrypto(cryptoAmount))\n $(selector).find('.crypto-units').html(cryptoDisplayCode)\n}\n\nfunction lookupDecimalChar (localeCode) {\n var num = 1.1\n var localized = num.toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: 1,\n minimumFractionDigits: 1\n })\n\n return localized[1]\n}\n\nfunction splitNumber (localize, localeCode) {\n var decimalChar = lookupDecimalChar(localeCode)\n var split = localize.split(decimalChar)\n\n if (split.length === 1) {\n return ['', split[0], ''].join('')\n }\n\n return [\n '', split[0], '',\n decimalChar, '', split[1], ''\n ].join('')\n}\n\nfunction formatNumber (num) {\n var localized = num.toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: 6,\n minimumFractionDigits: 3\n })\n\n return splitNumber(localized, jsLocaleCode)\n}\n\nfunction formatCrypto (amount) {\n return formatNumber(amount)\n}\n\nfunction formatFiat (amount, fractionDigits) {\n if (!fractionDigits) fractionDigits = 0\n\n const localized = amount.toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: fractionDigits,\n minimumFractionDigits: fractionDigits\n })\n return splitNumber(localized, jsLocaleCode) + ' ' + fiatCode\n}\n\nfunction setExchangeRate (_rates) {\n lastRates = _rates\n var cryptoCode = _rates.cryptoCode\n var rates = _rates.rates\n\n var coin = getCryptoCurrency(cryptoCode)\n var displayCode = coin.displayCode\n\n if (rates.cashIn) {\n var cryptoToFiat = new BigNumber(rates.cashIn)\n var rateStr = formatFiat(cryptoToFiat.round(2).toNumber(), 2)\n\n $('.crypto-rate-cash-in').html(`1 ${cryptoCode === LN ? BTC : cryptoCode} = ${rateStr}`)\n }\n\n if (rates.cashOut) {\n var cashOut = new BigNumber(rates.cashOut)\n var cashOutCryptoToFiat = cashOut && formatFiat(cashOut.round(2).toNumber(), 2)\n\n $('.crypto-rate-cash-out').html(`1 ${cryptoCode === LN ? BTC : cryptoCode} = ${cashOutCryptoToFiat}`)\n }\n\n $('.js-crypto-display-units').text(displayCode)\n}\n\nfunction qrize (text, target, color, lightning, size = 'normal') {\n const image = document.getElementById('bolt-img')\n // Hack for surf browser\n const _size = size === 'normal'\n ? document.body.clientHeight * 0.36\n : document.body.clientHeight * 0.25\n\n const opts = {\n crisp: true,\n fill: color || 'black',\n text,\n size: _size,\n render: 'canvas',\n rounded: 50,\n quiet: 2,\n mPosX: 50,\n mPosY: 50,\n mSize: 30,\n image\n }\n\n if (lightning) {\n opts.mode = 'image'\n }\n\n const el = kjua(opts)\n\n target.empty().append(el)\n}\n\nfunction setTx (tx) {\n const txId = tx.id\n const isPaperWallet = tx.isPaperWallet\n const hasBills = tx.bills && tx.bills.length > 0\n\n if (hasBills) {\n $('.js-inserted-notes').show()\n $('.js-no-inserted-notes').hide()\n } else {\n $('.js-inserted-notes').hide()\n $('.js-no-inserted-notes').show()\n }\n\n $('.js-paper-wallet').toggleClass('hide', !isPaperWallet)\n\n setCurrentDiscount(tx.discount, tx.promoCodeApplied)\n\n setTimeout(() => {\n qrize(txId, $('#cash-in-qr-code'), CASH_IN_QR_COLOR)\n qrize(txId, $('#cash-in-fail-qr-code'), CASH_IN_QR_COLOR)\n qrize(txId, $('#cash-in-no-funds-qr-code'), CASH_IN_QR_COLOR, null, 'small')\n qrize(txId, $('#qr-code-fiat-receipt'), CASH_OUT_QR_COLOR)\n qrize(txId, $('#qr-code-fiat-complete'), CASH_OUT_QR_COLOR)\n }, 1000)\n}\n\nfunction formatAddressNoBreakLines (address) {\n if (!address) return\n if (address.length > 60) {\n const firstPart = address.substring(0, 40).replace(/(.{4})/g, '$1 ')\n const secondPart = address.substring(address.length-16, address.length).replace(/(.{4})/g, '$1 ')\n return firstPart.concat('... ').concat(secondPart)\n }\n return address.replace(/(.{4})/g, '$1 ')\n}\n\nfunction formatAddress (address) {\n let toBr = formatAddressNoBreakLines(address)\n if (!toBr) return\n\n return toBr.replace(/((.{4} ){5})/g, '$1
')\n}\n\nfunction setBuyerAddress (address) {\n $('.crypto-address-no-br').html(formatAddressNoBreakLines(address))\n $('.crypto-address').html(formatAddress(address))\n}\n\nfunction setAccepting (currentAccepting) {\n accepting = currentAccepting\n if (accepting) {\n $('.bill img').transition({ x: 0, y: -303 }, 1000, 'ease-in')\n } else {\n $('.bill img').transition({ x: 0, y: 0 }, 1000, 'ease-out')\n }\n}\n\nfunction highBill (highestBill, reason) {\n var reasonText = reason === 'transactionLimit'\n ? translate('Transaction limit reached.')\n : translate(\"We're a little low on crypto.\")\n\n t('high-bill-header', reasonText)\n t('highest-bill', translate('Please insert %s or less.', [formatFiat(highestBill)]))\n\n setScreen('high_bill')\n window.setTimeout(revertScreen, 3000)\n}\n\nfunction minimumTx (lowestBill) {\n t('lowest-bill', translate('Minimum first bill is %s.', [formatFiat(lowestBill)]))\n\n setScreen('minimum_tx')\n window.setTimeout(revertScreen, 3000)\n}\n\nfunction readingBills (bill) {\n $('.js-processing-bill').html(translate('Processing %s ...', [formatFiat(bill)]))\n $('.js-continue-crypto-enable').hide()\n $('.js-send-crypto-enable').hide()\n}\n\nfunction sendOnly (reason) {\n // TODO: sendOnly should be made into its own state on brain.js\n if (currentState === 'send_only') return\n\n const errorMessages = {\n transactionLimit: translate('Transaction limit reached'),\n validatorError: translate('Error in validation'),\n lowBalance: translate(\"We're out of coins!\"),\n blockedCustomer: translate('Transaction limit reached')\n }\n\n // If no reason provided defaults to lowBalance\n const reasonText = errorMessages[reason] || errorMessages.lowBalance\n $('#send-only-title').text(reasonText)\n\n if (reason === 'blockedCustomer') {\n $('.js-send-only-text').text(translate(\"Due to local regulations, you've reached your transaction limit. Please contact us if you'd like to raise your limit.\"))\n } else {\n $('.js-send-only-text').text('')\n }\n\n setState('send_only')\n}\n\nfunction setPartialSend (sent, total) {\n $('#already-sent').text(formatFiat(sent.fiat))\n $('#pending-sent').text(formatFiat(total.fiat - sent.fiat))\n}\n\nfunction t (id, str) {\n $('#js-i18n-' + id).html(str)\n}\n\nfunction translateCoin (_cryptoCode) {\n const coin = getCryptoCurrency(_cryptoCode)\n const cryptoCode = coin.cryptoCodeDisplay || _cryptoCode\n $('.js-i18n-scan-your-address').html(translate('Scan your
%s address', [cryptoCode]))\n $('.js-i18n-please-scan').html(translate('Please scan the QR code
to send us your %s.', [cryptoCode]))\n $('.js-i18n-did-send-coins').html(translate('Have you sent the %s yet?', [cryptoCode]))\n $('.js-i18n-scan-address').html(translate('Scan your %s address', [cryptoCode]))\n $('.js-i18n-invalid-address').html(translate('Invalid %s address', [cryptoCode]))\n}\n\nfunction initTranslatePage () {\n $('.js-i18n').each(function () {\n var el = $(this)\n el.data('baseTranslation', el.html().trim())\n })\n $('input[placeholder]').each(function () {\n var el = $(this)\n el.data('baseTranslation', el.attr('placeholder'))\n })\n}\n\nfunction translatePage () {\n $('.js-i18n').each(function () {\n var el = $(this)\n var base = el.data('baseTranslation')\n el.html(translate(base))\n })\n $('input[placeholder]').each(function () {\n var el = $(this)\n var base = el.data('baseTranslation')\n el.attr('placeholder', translate(base))\n })\n\n // Adjust send coins button\n var length = $('#send-coins span').text().length\n if (length > 17) $('body').addClass('i18n-long-send-coins')\n else $('body').removeClass('i18n-long-send-coins')\n}\n\nfunction loadI18n (localeCode) {\n var messages = locales[localeCode] || locales['en-US']\n\n return new Jed({\n 'missing_key_callback': function () {},\n 'locale_data': {\n 'messages': messages\n }\n })\n}\n\nfunction reachFiatLimit (rec) {\n var msg = null\n if (rec.isEmpty) msg = translate(`We're a little low, please cash out`)\n else if (rec.txLimitReached) msg = translate('Transaction limit reached, please cash out')\n\n var el = $('.choose_fiat_state .limit')\n if (msg) el.html(msg).show()\n else el.hide()\n}\n\nfunction chooseFiat (data) {\n fiatCredit(data)\n setState('choose_fiat')\n}\n\nfunction displayCrypto (cryptoAtoms, cryptoCode) {\n var coin = getCryptoCurrency(cryptoCode)\n var scale = new BigNumber(10).pow(coin.displayScale)\n // number of decimal places vary based on displayScale value\n var decimalPlaces = (coin.displayScale - coin.unitScale) + 6\n var cryptoAmount = new BigNumber(cryptoAtoms).div(scale).round(decimalPlaces).toNumber()\n var cryptoDisplay = formatCrypto(cryptoAmount)\n\n return cryptoDisplay\n}\n\nfunction BN (s) { return new BigNumber(s) }\n\nfunction fiatCredit (data) {\n var tx = data.tx\n var cryptoCode = tx.cryptoCode\n var activeDenominations = data.activeDenominations\n var coin = getCryptoCurrency(cryptoCode)\n const fiat = BN(tx.fiat)\n\n var fiatDisplay = BN(tx.fiat).toNumber().toLocaleString(jsLocaleCode, {\n useGrouping: true,\n maximumFractionDigits: 0,\n minimumFractionDigits: 0\n })\n\n var cryptoAtoms = BN(tx.cryptoAtoms)\n var cryptoDisplay = displayCrypto(cryptoAtoms, cryptoCode)\n\n var cryptoDisplayCode = coin.displayCode\n\n setCurrentDiscount(tx.discount, tx.promoCodeApplied)\n\n if (cryptoAtoms.eq(0) || cryptoAtoms.isNaN()) $('#js-i18n-choose-digital-amount').hide()\n else $('#js-i18n-choose-digital-amount').show()\n\n if (fiat.eq(0)) $('#cash-out-button').prop('disabled', true)\n else $('#cash-out-button').prop('disabled', false)\n\n updateCassetteButtons(activeDenominations.activeMap, NUMBER_OF_BUTTONS)\n $('.choose_fiat_state .fiat-amount').text(fiatDisplay)\n t('choose-digital-amount',\n translate(\"You'll be sending %s %s\", [cryptoDisplay, cryptoDisplayCode]))\n\n reachFiatLimit(activeDenominations)\n}\n\nfunction setDepositAddress (depositInfo) {\n $('.deposit_state .loading').hide()\n $('.deposit_state .send-notice .crypto-address').html(formatAddress(depositInfo.toAddress))\n $('.deposit_state .send-notice').show()\n\n qrize(depositInfo.depositUrl, $('#qr-code-deposit'), CASH_OUT_QR_COLOR)\n}\n\nfunction setVersion (version) {\n $('.version-number').html(`Version: ${version}`)\n}\n\nfunction deposit (tx) {\n var cryptoCode = tx.cryptoCode\n var display = displayCrypto(tx.cryptoAtoms, cryptoCode)\n\n $('.js-wallet-address').show()\n\n $('.deposit_state .digital .js-amount').html(display)\n $('.deposit_state .fiat .js-amount').text(tx.fiat)\n $('.deposit_state .send-notice').hide()\n $('#qr-code-deposit').empty()\n $('.deposit_state .loading').show()\n $('#qr-code-deposit').show()\n $('#lightning-enabled').hide()\n if (tx.cryptoCode === 'LN') $('#lightning-enabled').show()\n\n setState('deposit')\n}\n\nfunction fiatReceipt (tx) {\n var cryptoCode = tx.cryptoCode\n var display = displayCrypto(tx.cryptoAtoms, cryptoCode)\n\n $('.fiat_receipt_state .digital .js-amount').html(display)\n $('.fiat_receipt_state .fiat .js-amount').text(tx.fiat)\n $('.fiat_receipt_state .sent-coins .crypto-address').html(formatAddress(tx.toAddress))\n\n setState('fiat_receipt')\n}\n\nfunction fiatComplete (tx) {\n var cryptoCode = tx.cryptoCode\n var display = displayCrypto(tx.cryptoAtoms, cryptoCode)\n\n $('.fiat_complete_state .digital .js-amount').html(display)\n $('.fiat_complete_state .fiat .js-amount').text(tx.fiat)\n $('.fiat_complete_state .sent-coins .crypto-address').html(formatAddress(tx.toAddress))\n\n setState('fiat_complete')\n}\n\nfunction dispenseBatch (data) {\n $('.batch').css('visibility', data.of === 1 ? 'hidden' : 'visible')\n $('.batch').text(`${data.current}/${data.of}`)\n}\n\nfunction initDebug () {\n if (DEBUG_MODE === 'dev') {\n $('body').css('cursor', 'default')\n var style = document.createElement('style')\n style.type = 'text/css'\n style.innerHTML = 'button { cursor: default !important; }'\n document.getElementsByTagName('head')[0].appendChild(style)\n\n return\n }\n\n if (DEBUG_MODE === 'demo') {\n setPrimaryLocales(['en-US'])\n setLocale('en-US')\n $('body').css('cursor', 'default')\n var style = document.createElement('style')\n style.type = 'text/css'\n style.innerHTML = 'button { cursor: default !important; }'\n document.getElementsByTagName('head')[0].appendChild(style)\n\n if (!SCREEN) {\n return chooseCoin([\n { display: 'Bitcoin', cryptoCode: 'BTC' },\n { display: 'Ethereum', cryptoCode: 'ETH' },\n { display: 'ZCash', cryptoCode: 'ZEC' }\n ], true)\n }\n\n setState(SCREEN)\n }\n}\n\nfunction calculateAspectRatio () {\n const width = $('body').width()\n const height = $('body').height()\n\n function gcd (a, b) {\n return (b === 0) ? a : gcd(b, a % b)\n }\n\n const w = width\n const h = height\n const r = gcd(w, h)\n const aspectRatioPt1 = w / r\n const aspectRatioPt2 = h / r\n\n if (aspectRatioPt1 < aspectRatioPt2) {\n aspectRatio = '9:16'\n } else if (aspectRatioPt1 === 8 && aspectRatioPt2 === 5) {\n aspectRatio = '16:10'\n } else if (aspectRatioPt1 === 16 && aspectRatioPt2 === 9) {\n aspectRatio = '16:9'\n } else {\n aspectRatio = w < 1420 ? '16:10' : '16:9'\n }\n}\n\nlet background = null\n\nfunction doTransition (cb) {\n // TODO Disable animations for V1\n let toShow = null\n let toShowOver = null\n\n if (isTwoWay) {\n toShow = ['#bg-to-show']\n toShowOver = ['.crypto-buttons', '.cash-in-box-wrapper']\n } else {\n toShow = ['#bg-to-show']\n toShowOver = ['header', 'main']\n }\n\n two.start()\n var tl = new TimelineMax()\n tl.set('.fade-in-delay', { opacity: 0, y: +30 })\n .set('.fade-in', { opacity: 0, y: +30 })\n .set(toShow, { zIndex: 1 })\n .set(toShowOver, { zIndex: 2 })\n .to(background, 0.5, { scale: isTwoWay ? 3 : 2 })\n .to('.fade-in', 0.4, {\n opacity: 1,\n onStart: cb,\n y: 0\n }, '=-0.2')\n .to('.fade-in-delay', 0.4, { opacity: 1, y: 0 }, '=-0.2')\n .set(background, { scale: 1 })\n .set(toShow, { zIndex: -1 })\n .set(toShowOver, { zIndex: 0 })\n two.pause()\n}\n\nfunction setupAnimation (isTwoWay, isAr800) {\n var elem = document.getElementById('bg-to-show')\n while (elem.firstChild) {\n elem.removeChild(elem.firstChild)\n }\n two = new Two({ fullscreen: true, type: Two.Types.svg, autostart: true }).appendTo(elem)\n\n let elementId = `${isTwoWay ? 'two-way' : 'one-way'}-${isAr800 ? '800' : '1080'}${isRTL ? '-rtl' : ''}`\n background = two.interpret(document.getElementById(elementId))\n background.scale = 1\n}\n\nfunction shouldEnableTouch () {\n const ua = navigator.userAgent\n if (ua.match(/surf/ig)) return false\n\n // ACP has chromium 34 and upboard 73\n const chromiumVersion = ua.match(/chromium\\/(\\d+)/i)\n const chromeVersion = ua.match(/chrome\\/(\\d+)/i)\n const chromiumPlus73 = chromiumVersion && chromiumVersion[1] >= 73\n const chromePlus73 = chromeVersion && chromeVersion[1] >= 73\n\n return chromiumPlus73 || chromePlus73\n}\n\nfunction setAvailablePromoCodes (areThereAvailablePromoCodes) {\n if (areThereAvailablePromoCodes) {\n $('#insert-first-bill-promo-button').show()\n $('#insert-first-recycler-bills-promo-button').show()\n $('#choose-fiat-promo-button').show()\n } else {\n $('#insert-first-bill-promo-button').hide()\n $('#insert-first-recycler-bills-promo-button').hide()\n $('#choose-fiat-promo-button').hide()\n }\n}\n\nfunction setCurrentDiscount (currentDiscount, promoCodeApplied) {\n if (promoCodeApplied) {\n $('#insert-first-bill-promo-button').hide()\n $('#insert-first-recycler-bills-promo-button').hide()\n $('#choose-fiat-promo-button').hide()\n }\n\n if (!currentDiscount) {\n $('#insert-first-bill-code-added').hide()\n $('#insert-first-recycler-bills-code-added').hide()\n $('#choose-fiat-code-added').hide()\n } else if (currentDiscount > 0) {\n const successMessage = '✔ ' + translate('Discount added (%s off commissions)', [`${currentDiscount}%`])\n $('#insert-first-bill-code-added').html(successMessage)\n $('#insert-first-recycler-bills-code-added').html(successMessage)\n $('#choose-fiat-code-added').html(successMessage)\n $('#insert-first-bill-code-added').show()\n $('#insert-first-recycler-bills-code-added').show()\n $('#choose-fiat-code-added').show()\n\n } else {\n $('#insert-first-bill-promo-button').show()\n $('#insert-first-recycler-bills-promo-button').show()\n $('#choose-fiat-promo-button').show()\n $('#insert-first-bill-code-added').hide()\n $('#insert-first-recycler-bills-code-added').hide()\n $('#choose-fiat-code-added').hide()\n }\n}\n\nfunction setReceiptPrint (receiptStatus, smsReceiptStatus) {\n let status = null\n if (receiptStatus) status = receiptStatus\n else status = smsReceiptStatus\n\n const className = receiptStatus ? 'print-receipt' : 'send-sms-receipt'\n const printing = receiptStatus ? 'Printing receipt...' : 'Sending receipt...'\n const success = receiptStatus ? 'Receipt printed successfully!' : 'Receipt sent successfully!'\n\n switch (status) {\n case 'disabled':\n $(`#${className}-cash-in-message`).addClass('hide')\n $(`#${className}-cash-in-button`).addClass('hide')\n $(`#${className}-cash-out-message`).addClass('hide')\n $(`#${className}-cash-out-button`).addClass('hide')\n $(`#${className}-cash-in-fail-message`).addClass('hide')\n $(`#${className}-cash-in-fail-button`).addClass('hide')\n break\n case 'available':\n $(`#${className}-cash-in-message`).addClass('hide')\n $(`#${className}-cash-in-button`).removeClass('hide')\n $(`#${className}-cash-out-message`).addClass('hide')\n $(`#${className}-cash-out-button`).removeClass('hide')\n $(`#${className}-cash-in-fail-message`).addClass('hide')\n $(`#${className}-cash-in-fail-button`).removeClass('hide')\n break\n case 'printing':\n const message = locale.translate(printing).fetch()\n $(`#${className}-cash-in-button`).addClass('hide')\n $(`#${className}-cash-in-message`).html(message)\n $(`#${className}-cash-in-message`).removeClass('hide')\n $(`#${className}-cash-out-button`).addClass('hide')\n $(`#${className}-cash-out-message`).html(message)\n $(`#${className}-cash-out-message`).removeClass('hide')\n $(`#${className}-cash-in-fail-button`).addClass('hide')\n $(`#${className}-cash-in-fail-message`).html(message)\n $(`#${className}-cash-in-fail-message`).removeClass('hide')\n break\n case 'success':\n const successMessage = '✔ ' + locale.translate(success).fetch()\n $(`#${className}-cash-in-button`).addClass('hide')\n $(`#${className}-cash-in-message`).html(successMessage)\n $(`#${className}-cash-in-message`).removeClass('hide')\n $(`#${className}-cash-out-button`).addClass('hide')\n $(`#${className}-cash-out-message`).html(successMessage)\n $(`#${className}-cash-out-message`).removeClass('hide')\n $(`#${className}-cash-in-fail-button`).addClass('hide')\n $(`#${className}-cash-in-fail-message`).html(successMessage)\n $(`#${className}-cash-in-fail-message`).removeClass('hide')\n break\n case 'failed':\n const failMessage = '✖ ' + locale.translate('An error occurred, try again.').fetch()\n $(`#${className}-cash-in-button`).addClass('hide')\n $(`#${className}-cash-in-message`).html(failMessage)\n $(`#${className}-cash-in-message`).removeClass('hide')\n $(`#${className}-cash-out-button`).addClass('hide')\n $(`#${className}-cash-out-message`).html(failMessage)\n $(`#${className}-cash-out-message`).removeClass('hide')\n $(`#${className}-cash-in-fail-button`).addClass('hide')\n $(`#${className}-cash-in-fail-message`).html(failMessage)\n $(`#${className}-cash-in-fail-message`).removeClass('hide')\n break\n }\n}\n\nfunction externalCompliance (url) {\n qrize(url, $('#qr-code-external-validation'), cashDirection === 'cashIn' ? CASH_IN_QR_COLOR : CASH_OUT_QR_COLOR)\n return setScreen('external_compliance')\n}\n"]} \ No newline at end of file diff --git a/ui/js/docker-app.js b/ui/js/docker-app.js index d97514735..32bb64490 100644 --- a/ui/js/docker-app.js +++ b/ui/js/docker-app.js @@ -22,7 +22,6 @@ var two = null; var cryptomatModel = null; var termsConditionsTimeout = null; var termsConditionsAcceptanceInterval = null; -var termsConditionsAcceptanceTimeout = null; var T_C_TIMEOUT = 30000; var complianceTimeout = null; var cashDirection = null; @@ -326,6 +325,7 @@ function processData(data) { invalidAddress(data.lnInvoiceTypeError); break; case 'externalCompliance': + clearTimeout(complianceTimeout); externalCompliance(data.externalComplianceUrl); break; default: @@ -1348,7 +1348,6 @@ function setTermsConditionsAcceptanceDelay(screen, data) { function clearTermsConditionsAcceptanceDelay() { clearInterval(termsConditionsAcceptanceInterval); - clearTimeout(termsConditionsAcceptanceTimeout); } function resetTermsConditionsTimeout() { diff --git a/ui/src/app.js b/ui/src/app.js index 41b893e44..56b6188e2 100644 --- a/ui/src/app.js +++ b/ui/src/app.js @@ -322,6 +322,7 @@ function processData (data) { invalidAddress(data.lnInvoiceTypeError) break case 'externalCompliance': + clearTimeout(complianceTimeout) externalCompliance(data.externalComplianceUrl) break default: From 7793f8368d74ce8bc13d36893688b3a316f25516 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Mon, 7 Oct 2024 09:05:05 +0100 Subject: [PATCH 2/6] chore: language on external compliance screens --- ui/html/external-compliance.html | 10 +++++----- ui/start.html | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ui/html/external-compliance.html b/ui/html/external-compliance.html index 9deeb2690..83445fe95 100644 --- a/ui/html/external-compliance.html +++ b/ui/html/external-compliance.html @@ -5,9 +5,9 @@ >
-

External compliance required

+

Customer verification required

- To proceed, we are required to ask you to go through an external compliance system. + To proceed, we are required to verify your identify using a service on your phone. The process is quick and you’ll need an ID card to complete it.

Continue? @@ -26,13 +26,13 @@

External compliance required

data-screentype="info-contact-tp" >
-

External compliance validation

+

Customer verification

- In order to process your transaction, we will need to process your information through an external compliance system. This transaction will now be finished. + In order to transact further, we will need to verify your identity through an external service. In the meantime, your current transaction will be completed and your funds sent.

- Scan the following QR code and follow further instructions to proceed. + To proceed, scan the QR code below and follow the instructions on the website it takes you to. After a quick verification, you may purchase more at this machine.

diff --git a/ui/start.html b/ui/start.html index 019e5d821..e5280a754 100644 --- a/ui/start.html +++ b/ui/start.html @@ -949,9 +949,9 @@

Verify email to continue

>
-

External compliance required

+

Customer verification required

- To proceed, we are required to ask you to go through an external compliance system. + To proceed, we are required to verify your identify using a service on your phone. The process is quick and you’ll need an ID card to complete it.

Continue? @@ -970,13 +970,13 @@

External compliance required

data-screentype="info-contact-tp" >
-

External compliance validation

+

Customer verification

- In order to process your transaction, we will need to process your information through an external compliance system. This transaction will now be finished. + In order to transact further, we will need to verify your identity through an external service. In the meantime, your current transaction will be completed and your funds sent.

- Scan the following QR code and follow further instructions to proceed. + To proceed, scan the QR code below and follow the instructions on the website it takes you to. After a quick verification, you may purchase more at this machine.

From 38afbc10d06adc76861af643ac2e442812e7f31b Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 8 Oct 2024 11:03:43 +0100 Subject: [PATCH 3/6] fix: transaction limit reached displayed mid flow --- lib/brain.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/brain.js b/lib/brain.js index 23f6a7e61..2ddb90526 100644 --- a/lib/brain.js +++ b/lib/brain.js @@ -1939,19 +1939,17 @@ Brain.prototype.showExternalCompliance = function showExternalCompliance (url) { const insertedBills = this.tx.fiat.gt(0) if (!insertedBills) { - this._transitionState('externalCompliance', { insertedBills, externalComplianceUrl: url }) + this._transitionState('externalCompliance', { externalComplianceUrl: url }) return this._screenTimeout(() => this.finishBeforeSms(), EXTERNAL_VALIDTION_TIMEOUT) } - this.updateBillsScreen(true) - .then(() => { - this._transitionState('externalCompliance', { - sendOnly: true, - cryptoCode: this.tx.cryptoCode, - externalComplianceUrl: url - }) - return this._screenTimeout(() => this.finishBeforeSms(), EXTERNAL_VALIDTION_TIMEOUT) - }) + this._transitionState('externalCompliance', { + tx: this.tx, + sendOnly: true, + cryptoCode: this.tx.cryptoCode, + externalComplianceUrl: url + }) + return this._screenTimeout(() => this.finishBeforeSms(), EXTERNAL_VALIDTION_TIMEOUT) } Brain.prototype.authCompliance = function authCompliance (opts = {}) { From e9314b62734194490bd34b36d6b4fd860431e0ca Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 8 Oct 2024 11:06:24 +0100 Subject: [PATCH 4/6] chore: line break and built files --- i18n/ui/lbm-ui_en-US.po | 24 ++++++++++++++---------- ui/html/external-compliance.html | 7 +++++-- ui/start-docker.html | 15 +++++++++------ ui/start-test.html | 15 +++++++++------ ui/start.html | 7 +++++-- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/i18n/ui/lbm-ui_en-US.po b/i18n/ui/lbm-ui_en-US.po index 3c975ebbe..894373fac 100644 --- a/i18n/ui/lbm-ui_en-US.po +++ b/i18n/ui/lbm-ui_en-US.po @@ -251,12 +251,16 @@ msgid "No, cancel" msgstr "No, cancel" #: On screen: external-validation -msgid "External compliance required" -msgstr "External compliance required" +msgid "Customer verification required" +msgstr "Customer verification required" #: On screen: external-validation -msgid "To proceed, we are required to ask you to go through an external compliance system." -msgstr "To proceed, we are required to ask you to go through an external compliance system." +msgid "To proceed, we are required to verify your identify using a service on your phone." +msgstr "To proceed, we are required to verify your identify using a service on your phone." + +#: On screen: external-validation +msgid "The process is quick and you’ll need an ID card to complete it." +msgstr "The process is quick and you’ll need an ID card to complete it." #: On screen: external-validation msgid "Continue?" @@ -267,16 +271,16 @@ msgid "Yes, continue" msgstr "Yes, continue" #: On screen: external-validation -msgid "External compliance validation" -msgstr "External compliance validation" +msgid "Customer verification" +msgstr "Customer verification" #: On screen: external-validation -msgid "In order to process your transaction, we will need to process your information through an external compliance system. This transaction will now be finished." -msgstr "In order to process your transaction, we will need to process your information through an external compliance system. This transaction will now be finished." +msgid "In order to transact further, we will need to verify your identity through an external service. In the meantime, your current transaction will be completed and your funds sent." +msgstr "In order to transact further, we will need to verify your identity through an external service. In the meantime, your current transaction will be completed and your funds sent." #: On screen: external-validation -msgid "Scan the following QR code and follow further instructions to proceed." -msgstr "Scan the following QR code and follow further instructions to proceed." +msgid "To proceed, scan the QR code below and follow the instructions on the website it takes you to. After a quick verification, you may purchase more at this machine." +msgstr "To proceed, scan the QR code below and follow the instructions on the website it takes you to. After a quick verification, you may purchase more at this machine." #: On screen: external-validation msgid "OK" diff --git a/ui/html/external-compliance.html b/ui/html/external-compliance.html index 83445fe95..44034f674 100644 --- a/ui/html/external-compliance.html +++ b/ui/html/external-compliance.html @@ -6,8 +6,11 @@

Customer verification required

-

- To proceed, we are required to verify your identify using a service on your phone. The process is quick and you’ll need an ID card to complete it. +

+ To proceed, we are required to verify your identify using a service on your phone. +

+

+ The process is quick and you’ll need an ID card to complete it.

Continue? diff --git a/ui/start-docker.html b/ui/start-docker.html index 4c742c758..b2049ca7c 100644 --- a/ui/start-docker.html +++ b/ui/start-docker.html @@ -949,9 +949,12 @@

Verify email to continue

>
-

External compliance required

-

- To proceed, we are required to ask you to go through an external compliance system. +

Customer verification required

+

+ To proceed, we are required to verify your identify using a service on your phone. +

+

+ The process is quick and you’ll need an ID card to complete it.

Continue? @@ -970,13 +973,13 @@

External compliance required

data-screentype="info-contact-tp" >
-

External compliance validation

+

Customer verification

- In order to process your transaction, we will need to process your information through an external compliance system. This transaction will now be finished. + In order to transact further, we will need to verify your identity through an external service. In the meantime, your current transaction will be completed and your funds sent.

- Scan the following QR code and follow further instructions to proceed. + To proceed, scan the QR code below and follow the instructions on the website it takes you to. After a quick verification, you may purchase more at this machine.

diff --git a/ui/start-test.html b/ui/start-test.html index c9842b911..4f281c941 100644 --- a/ui/start-test.html +++ b/ui/start-test.html @@ -949,9 +949,12 @@

Verify email to continue

>
-

External compliance required

-

- To proceed, we are required to ask you to go through an external compliance system. +

Customer verification required

+

+ To proceed, we are required to verify your identify using a service on your phone. +

+

+ The process is quick and you’ll need an ID card to complete it.

Continue? @@ -970,13 +973,13 @@

External compliance required

data-screentype="info-contact-tp" >
-

External compliance validation

+

Customer verification

- In order to process your transaction, we will need to process your information through an external compliance system. This transaction will now be finished. + In order to transact further, we will need to verify your identity through an external service. In the meantime, your current transaction will be completed and your funds sent.

- Scan the following QR code and follow further instructions to proceed. + To proceed, scan the QR code below and follow the instructions on the website it takes you to. After a quick verification, you may purchase more at this machine.

diff --git a/ui/start.html b/ui/start.html index e5280a754..184987e86 100644 --- a/ui/start.html +++ b/ui/start.html @@ -950,8 +950,11 @@

Verify email to continue

Customer verification required

-

- To proceed, we are required to verify your identify using a service on your phone. The process is quick and you’ll need an ID card to complete it. +

+ To proceed, we are required to verify your identify using a service on your phone. +

+

+ The process is quick and you’ll need an ID card to complete it.

Continue? From ba530466bbab92f0f632181386fc1549e1b97339 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 8 Oct 2024 12:01:17 +0100 Subject: [PATCH 5/6] fix: requirements order --- lib/brain.js | 4 +++- lib/compliance/triggers/consts.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/brain.js b/lib/brain.js index 2ddb90526..034ad4a63 100644 --- a/lib/brain.js +++ b/lib/brain.js @@ -2556,7 +2556,9 @@ Brain.prototype.requiredTiers = function requiredTiers (triggers, history, trigg // Custom trigger is identified by its uuid and should be pushed to last const orderedWithRequired = [].concat(requiredAuth, ORDERED_REQUIREMENTS) - const requiredTiers = _.sortBy(name => uuid4Validate(name) ? Infinity : _.indexOf(name, orderedWithRequired))(unorderedTiers) + const requiredTiers = _.sortBy(name => { + return _.indexOf(uuid4Validate(name) ? REQUIREMENTS.CUSTOM : name, orderedWithRequired) + })(unorderedTiers) this.requirementAmountTriggered = getLowestAmountPerRequirement(triggeredFormatted) return requiredTiers diff --git a/lib/compliance/triggers/consts.js b/lib/compliance/triggers/consts.js index 30e672564..234305409 100644 --- a/lib/compliance/triggers/consts.js +++ b/lib/compliance/triggers/consts.js @@ -35,6 +35,7 @@ const ORDERED_REQUIREMENTS = [ REQUIREMENTS.SUSPEND, REQUIREMENTS.BLOCK, REQUIREMENTS.US_SSN, + REQUIREMENTS.CUSTOM, REQUIREMENTS.EXTERNAL ] From dfd53fe5470ad6859217174218e6a91a62a0bf2a Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 8 Oct 2024 12:09:52 +0100 Subject: [PATCH 6/6] fix: button position on portrait screens --- ui/css/main.scss | 8 +++--- ui/css/portrait.scss | 9 ++++++ ui/main.css | 65 ++++++++++++++++++++++++-------------------- 3 files changed, 49 insertions(+), 33 deletions(-) diff --git a/ui/css/main.scss b/ui/css/main.scss index 98bbfd40a..4ab9e4e7b 100644 --- a/ui/css/main.scss +++ b/ui/css/main.scss @@ -1903,10 +1903,6 @@ button[disabled] { pointer-events: none; } -@media (orientation: portrait) { - @import "./portrait.scss"; -} - .external_compliance_state { footer: { margin-top: 15px; @@ -1929,3 +1925,7 @@ button[disabled] { margin-right: 0px; }; } + +@media (orientation: portrait) { + @import "./portrait.scss"; +} diff --git a/ui/css/portrait.scss b/ui/css/portrait.scss index e88147044..8e5cfd5df 100644 --- a/ui/css/portrait.scss +++ b/ui/css/portrait.scss @@ -468,6 +468,15 @@ main { } } +.external_compliance_state { + main { + margin-bottom: 4vh; + } + footer { + margin-top: 0; + } +} + .maintenance_state, .locked_state { header { diff --git a/ui/main.css b/ui/main.css index 830ae8785..9136d232f 100644 --- a/ui/main.css +++ b/ui/main.css @@ -3445,6 +3445,36 @@ button[disabled] { pointer-events: none; } +.external_compliance_state { + footer-margin-top: 15px; +} + +.external_compliance_state footer { + margin-top: 5vh; +} + +.external-validation-info { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; +} +.external-validation-info div { + margin-right: 15px; +} +.external-validation-info div:last-child { + margin-right: 0px; +} + @media (orientation: portrait) { header { padding: 2vh; @@ -3947,6 +3977,12 @@ button[disabled] { .info-no-image main { margin-bottom: 10vh; } + .external_compliance_state main { + margin-bottom: 4vh; + } + .external_compliance_state footer { + margin-top: 0; + } .maintenance_state header, .locked_state header { height: 36vh; @@ -4284,32 +4320,3 @@ button[disabled] { gap: 1vh; } } -.external_compliance_state { - footer-margin-top: 15px; -} - -.external_compliance_state footer { - margin-top: 5vh; -} - -.external-validation-info { - display: -webkit-box; - display: -webkit-flex; - display: flex; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -webkit-flex-direction: row; - flex-direction: row; - -webkit-box-align: center; - -webkit-align-items: center; - align-items: center; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - justify-content: space-between; -} -.external-validation-info div { - margin-right: 15px; -} -.external-validation-info div:last-child { - margin-right: 0px; -}