From 6fab730d3cfbe19df4037174dc520ee537e21639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Thu, 6 Oct 2022 19:08:18 +0100 Subject: [PATCH 1/2] feat: receive blacklist message from server --- i18n/ui/lbm-ui_en-US.po | 4 ++++ lib/brain.js | 2 +- ui/html/suspicious-address.html | 2 +- ui/js/app.js | 16 +++++++++++++++- ui/js/app.js.map | 2 +- ui/js/docker-app.js | 16 +++++++++++++++- ui/src/app.js | 12 ++++++++++++ ui/start-docker.html | 2 +- ui/start-test.html | 2 +- ui/start.html | 2 +- 10 files changed, 52 insertions(+), 8 deletions(-) diff --git a/i18n/ui/lbm-ui_en-US.po b/i18n/ui/lbm-ui_en-US.po index 3f8f5cf0e..15dc748dc 100644 --- a/i18n/ui/lbm-ui_en-US.po +++ b/i18n/ui/lbm-ui_en-US.po @@ -1054,6 +1054,10 @@ msgstr "Discount added (%s off commissions)" msgid "An error occurred, try again." msgstr "An error occurred, try again." +#: On screen: dynamic +msgid "This address may be associated with a deceptive offer or a prohibited group. Please make sure you\'re using an address from your own wallet." +msgstr "This address may be associated with a deceptive offer or a prohibited group. Please make sure you\'re using an address from your own wallet." + #: On screen: coins msgid "Bitcoin" msgstr "Bitcoin" diff --git a/lib/brain.js b/lib/brain.js index 656f924fb..c5d55d2cd 100644 --- a/lib/brain.js +++ b/lib/brain.js @@ -2799,7 +2799,7 @@ Brain.prototype._handleScan = function _handleScan (address) { if (it.blacklisted) { return setTimeout(() => { - this._timedState('suspiciousAddress') + this._timedState('suspiciousAddress', { data: { blacklistMessage: it.blacklistMessage } }) }, remaining) } diff --git a/ui/html/suspicious-address.html b/ui/html/suspicious-address.html index b41066d07..1cd96120f 100644 --- a/ui/html/suspicious-address.html +++ b/ui/html/suspicious-address.html @@ -10,7 +10,7 @@

Suspicious address

-

+

This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet.

diff --git a/ui/js/app.js b/ui/js/app.js index a6f19a170..145c5e905 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -112,7 +112,9 @@ function processData(data) { if (data.cassettes) buildCassetteButtons(data.cassettes, NUMBER_OF_BUTTONS); if (data.readingBills) readingBills(data.readingBills); if (data.cryptoCode) translateCoin(data.cryptoCode); - if (data.tx && data.tx.cashInFee) setFixedFee(data.tx.cashInFee); + if (data.tx) { + if (data.tx.cashInFee) setFixedFee(data.tx.cashInFee);else if (data.tx.cashOutFee) setFixedFee(data.tx.cashOutFee); + } if (data.terms) setTermsScreen(data.terms); if (data.dispenseBatch) dispenseBatch(data.dispenseBatch); if (data.direction) setDirection(data.direction); @@ -298,6 +300,10 @@ function processData(data) { clearTimeout(complianceTimeout); externalCompliance(data.externalComplianceUrl); break; + case 'suspiciousAddress': + suspiciousAddress(data.blacklistMessage); + setState('suspicious_address'); + break; default: if (data.action) setState(window.snakecase(data.action)); } @@ -2036,4 +2042,12 @@ function externalCompliance(url) { qrize(url, $('#qr-code-external-validation'), cashDirection === 'cashIn' ? CASH_IN_QR_COLOR : CASH_OUT_QR_COLOR); return setScreen('external_compliance'); } + +function suspiciousAddress(blacklistMessage) { + if (blacklistMessage) { + $('#suspicious-address-message').html(blacklistMessage); + } else { + $('#suspicious-address-message').html(translate("This address may be associated with a deceptive offer or a prohibited group. Please make sure you\'re using an address from your own wallet.")); + } +} //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/ui/js/app.js.map b/ui/js/app.js.map index 735ebd7b7..9b81d64a3 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","DEBUG_MODE","get","CASH_OUT_QR_COLOR","CASH_IN_QR_COLOR","NUMBER_OF_BUTTONS","scrollSize","textHeightQuantity","currentPage","totalPages","aspectRatio","isTwoWay","isRTL","cryptomatModel","termsConditionsTimeout","termsConditionsAcceptanceInterval","T_C_TIMEOUT","complianceTimeout","cashDirection","fiatCode","locale","defaultLocale","loadI18n","localeCode","jsLocaleCode","_primaryLocales","lastRates","coins","currentState","websocket","promoKeyboard","usSsnKeypad","phoneKeypad","securityKeypad","previousState","buttonActive","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","sendOnly","reason","fiatCredit","depositInfo","setDepositAddress","version","setVersion","cassettes","buildCassetteButtons","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","text","setComplianceTimeout","setConstraint","disableRecyclerBillButtons","enableRecyclerBillButtons","highBill","highestBill","minimumTx","lowestBill","isCashInOnlyCoin","chooseFiat","deposit","fiatReceipt","fiatComplete","chooseCoin","twoWayMode","smsVerification","emailVerification","idVerification","facephotoPermission","usSsnPermission","externalPermission","blockedCustomer","customInfoRequestPermission","customInfoRequest","invalidAddress","lnInvoiceTypeError","clearTimeout","externalCompliance","externalComplianceUrl","snakecase","translate","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","sendCoinsButton","getElementById","sendCoinsButton2","touchEvent","setupButton","blockedCustomerOk","insertBillCancelButton","touchImmediateEvent","insertBillCancelRecyclerButton","setupImmediateButton","promoCodeCancelButton","bind","submitCodeButton","code","submitEmailButton","submitTextRequirementButton","nextFieldTextRequirementButton","previousFieldTextRequirementButton","val","setInputBox","cryptoButtons","target","is","closest","wantedCoin","areYouSureCancel","areYouSureContinue","coinRedeem","otherLocale","cashInBox","cashOutBox","languageOverlay","cryptoOverlay","languageButtons","languageButtonJ","newLocale","attr","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","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","Math","ceil","textContent","scrollDown","buttonDown","buttonUp","setCountry","setPrimaryLocales","primaryLocales","primaryLocale","otherLanguageName","lang","lookupLocaleNames","nativeName","split","isArabic","isHebrew","translatePage","ex","elem","img","areArraysEqual","arr1","arr2","i","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","reasonText","t","bill","errorMessages","transactionLimit","validatorError","lowBalance","str","_cryptoCode","cryptoCodeDisplay","base","messages","locales","Jed","reachFiatLimit","rec","msg","isEmpty","txLimitReached","displayCrypto","decimalPlaces","unitScale","BN","s","activeDenominations","fiatDisplay","cryptoDisplay","eq","activeMap","toAddress","depositUrl","of","current","createElement","innerHTML","getElementsByTagName","appendChild","height","gcd","w","h","r","aspectRatioPt1","aspectRatioPt2","background","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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P,CAAiB,+BAAjB,EAAkDE,KAAlD,EAA3B;AACA5G,cAAMif,SAAN,sBAAkClX,QAAlC,CAA2C,MAA3C;AACA/H,cAAMif,SAAN,uBAAmCzV,IAAnC,CAAwC6V,WAAxC;AACArf,cAAMif,SAAN,uBAAmCnX,WAAnC,CAA+C,MAA/C;AACA9H,cAAMif,SAAN,uBAAmClX,QAAnC,CAA4C,MAA5C;AACA/H,cAAMif,SAAN,wBAAoCzV,IAApC,CAAyC6V,WAAzC;AACArf,cAAMif,SAAN,wBAAoCnX,WAApC,CAAgD,MAAhD;AACA9H,cAAMif,SAAN,2BAAuClX,QAAvC,CAAgD,MAAhD;AACA/H,cAAMif,SAAN,4BAAwCzV,IAAxC,CAA6C6V,WAA7C;AACArf,cAAMif,SAAN,4BAAwCnX,WAAxC,CAAoD,MAApD;AACA;AApDJ;AAsDD;;AAED,SAASvB,kBAAT,CAA6B+Y,GAA7B,EAAkC;AAChC3F,QAAM2F,GAAN,EAAWtf,EAAE,8BAAF,CAAX,EAA8CnC,kBAAkB,QAAlB,GAA6Bd,gBAA7B,GAAgDD,iBAA9F;AACA,SAAOiK,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 DEBUG_MODE = 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 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 websocket = null\nvar promoKeyboard = null\nvar usSsnKeypad = null\nvar phoneKeypad = null\nvar securityKeypad = null\nvar previousState = null\nvar buttonActive = true\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 promoKeyboard.deactivate()\n emailKeyboard.deactivate()\n customRequirementTextKeyboard.deactivate()\n buttonActive = false\n setTimeout(function () {\n buttonActive = true\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.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.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 '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 case 'rejectedBill':\n // still need to prevent screen change\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()\n break\n case 'emailVerification':\n emailVerification();\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 () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('sms_verification')\n}\n\nfunction emailVerification() {\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\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 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 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('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('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\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 if (DEBUG_MODE === 'dev') 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('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 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 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 buttonUp.disabled = currentPage === 0;\n buttonDown.disabled = currentPage * scrollSize + scrollSize > textHeightQuantity && currentPage !== 0;\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\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 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(localeCode, {\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 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 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 return formatCrypto(cryptoAmount)\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 $('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\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 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 const status = receiptStatus ? receiptStatus : 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","DEBUG_MODE","get","CASH_OUT_QR_COLOR","CASH_IN_QR_COLOR","NUMBER_OF_BUTTONS","scrollSize","textHeightQuantity","currentPage","totalPages","aspectRatio","isTwoWay","isRTL","cryptomatModel","termsConditionsTimeout","termsConditionsAcceptanceInterval","T_C_TIMEOUT","complianceTimeout","cashDirection","fiatCode","locale","defaultLocale","loadI18n","localeCode","jsLocaleCode","_primaryLocales","lastRates","coins","currentState","websocket","promoKeyboard","usSsnKeypad","phoneKeypad","securityKeypad","previousState","buttonActive","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","sendOnly","reason","fiatCredit","depositInfo","setDepositAddress","version","setVersion","cassettes","buildCassetteButtons","readingBills","cryptoCode","translateCoin","cashInFee","setFixedFee","cashOutFee","terms","setTermsScreen","dispenseBatch","direction","setDirection","operatorInfo","setOperatorInfo","hardLimit","setHardLimit","setCryptomatModel","areThereAvailablePromoCodes","undefined","setAvailablePromoCodes","discount","setCurrentDiscount","receiptStatus","setReceiptPrint","smsReceiptStatus","context","hide","show","isRecycler","billValidator","setState","text","setComplianceTimeout","setConstraint","disableRecyclerBillButtons","enableRecyclerBillButtons","highBill","highestBill","minimumTx","lowestBill","isCashInOnlyCoin","chooseFiat","deposit","fiatReceipt","fiatComplete","chooseCoin","twoWayMode","smsVerification","emailVerification","idVerification","facephotoPermission","usSsnPermission","externalPermission","blockedCustomer","customInfoRequestPermission","customInfoRequest","invalidAddress","lnInvoiceTypeError","clearTimeout","externalCompliance","externalComplianceUrl","suspiciousAddress","blacklistMessage","snakecase","translate","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","sendCoinsButton","getElementById","sendCoinsButton2","touchEvent","setupButton","blockedCustomerOk","insertBillCancelButton","touchImmediateEvent","insertBillCancelRecyclerButton","setupImmediateButton","promoCodeCancelButton","bind","submitCodeButton","code","submitEmailButton","submitTextRequirementButton","nextFieldTextRequirementButton","previousFieldTextRequirementButton","val","setInputBox","cryptoButtons","target","is","closest","wantedCoin","areYouSureCancel","areYouSureContinue","coinRedeem","otherLocale","cashInBox","cashOutBox","languageOverlay","cryptoOverlay","languageButtons","languageButtonJ","newLocale","attr","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","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","Math","ceil","textContent","scrollDown","buttonDown","buttonUp","setCountry","setPrimaryLocales","primaryLocales","primaryLocale","otherLanguageName","lang","lookupLocaleNames","nativeName","split","isArabic","isHebrew","translatePage","ex","elem","img","areArraysEqual","arr1","arr2","i","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","reasonText","t","bill","errorMessages","transactionLimit","validatorError","lowBalance","str","_cryptoCode","cryptoCodeDisplay","base","messages","locales","Jed","reachFiatLimit","rec","msg","isEmpty","txLimitReached","displayCrypto","decimalPlaces","unitScale","BN","s","activeDenominations","fiatDisplay","cryptoDisplay","eq","activeMap","toAddress","depositUrl","of","current","createElement","innerHTML","getElementsByTagName","appendChild","height","gcd","w","h","r","aspectRatioPt1","aspectRatioPt2","background","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,aAAaH,OAAOI,GAAP,CAAW,OAAX,CAAnB;AACA,IAAMC,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,iBAAiB,IAArB;AACA,IAAIC,yBAAyB,IAA7B;AACA,IAAIC,oCAAoC,IAAxC;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,IAAhB;AACA,IAAIC,gBAAgB,IAApB;AACA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A8CnC,kBAAkB,QAAlB,GAA6Bd,gBAA7B,GAAgDD,iBAA9F;AACA,SAAOoK,UAAU,qBAAV,CAAP;AACD;;AAED,SAASR,iBAAT,CAA4BC,gBAA5B,EAA8C;AAC5C,MAAIA,gBAAJ,EAAsB;AACpB3G,qCAAiC2J,IAAjC,CAAsChD,gBAAtC;AACD,GAFD,MAEO;AACL3G,qCAAiC2J,IAAjC,CAAsC9C,UAAU,8IAAV,CAAtC;AACD;AACF","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 DEBUG_MODE = 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 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 websocket = null\nvar promoKeyboard = null\nvar usSsnKeypad = null\nvar phoneKeypad = null\nvar securityKeypad = null\nvar previousState = null\nvar buttonActive = true\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 promoKeyboard.deactivate()\n emailKeyboard.deactivate()\n customRequirementTextKeyboard.deactivate()\n buttonActive = false\n setTimeout(function () {\n buttonActive = true\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.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.readingBills) readingBills(data.readingBills)\n if (data.cryptoCode) translateCoin(data.cryptoCode)\n if (data.tx) {\n if (data.tx.cashInFee) setFixedFee(data.tx.cashInFee)\n else if (data.tx.cashOutFee) setFixedFee(data.tx.cashOutFee)\n }\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 '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 case 'rejectedBill':\n // still need to prevent screen change\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()\n break\n case 'emailVerification':\n emailVerification();\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 case 'suspiciousAddress':\n suspiciousAddress(data.blacklistMessage)\n setState('suspicious_address')\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 () {\n setComplianceTimeout(null, 'finishBeforeSms')\n setScreen('sms_verification')\n}\n\nfunction emailVerification() {\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\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 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 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('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('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\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 if (DEBUG_MODE === 'dev') 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('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 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 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 buttonUp.disabled = currentPage === 0;\n buttonDown.disabled = currentPage * scrollSize + scrollSize > textHeightQuantity && currentPage !== 0;\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\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 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(localeCode, {\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 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 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 return formatCrypto(cryptoAmount)\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 $('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\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 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 const status = receiptStatus ? receiptStatus : 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\nfunction suspiciousAddress (blacklistMessage) {\n if (blacklistMessage) {\n $(`#suspicious-address-message`).html(blacklistMessage)\n } else {\n $(`#suspicious-address-message`).html(translate(\"This address may be associated with a deceptive offer or a prohibited group. Please make sure you\\'re using an address from your own wallet.\"))\n }\n}\n"]} \ No newline at end of file diff --git a/ui/js/docker-app.js b/ui/js/docker-app.js index ab5ea8474..618b10a4e 100644 --- a/ui/js/docker-app.js +++ b/ui/js/docker-app.js @@ -112,7 +112,9 @@ function processData(data) { if (data.cassettes) buildCassetteButtons(data.cassettes, NUMBER_OF_BUTTONS); if (data.readingBills) readingBills(data.readingBills); if (data.cryptoCode) translateCoin(data.cryptoCode); - if (data.tx && data.tx.cashInFee) setFixedFee(data.tx.cashInFee); + if (data.tx) { + if (data.tx.cashInFee) setFixedFee(data.tx.cashInFee);else if (data.tx.cashOutFee) setFixedFee(data.tx.cashOutFee); + } if (data.terms) setTermsScreen(data.terms); if (data.dispenseBatch) dispenseBatch(data.dispenseBatch); if (data.direction) setDirection(data.direction); @@ -298,6 +300,10 @@ function processData(data) { clearTimeout(complianceTimeout); externalCompliance(data.externalComplianceUrl); break; + case 'suspiciousAddress': + suspiciousAddress(data.blacklistMessage); + setState('suspicious_address'); + break; default: if (data.action) setState(window.snakecase(data.action)); } @@ -2036,4 +2042,12 @@ function externalCompliance(url) { qrize(url, $('#qr-code-external-validation'), cashDirection === 'cashIn' ? CASH_IN_QR_COLOR : CASH_OUT_QR_COLOR); return setScreen('external_compliance'); } + +function suspiciousAddress(blacklistMessage) { + if (blacklistMessage) { + $('#suspicious-address-message').html(blacklistMessage); + } else { + $('#suspicious-address-message').html(translate("This address may be associated with a deceptive offer or a prohibited group. Please make sure you\'re using an address from your own wallet.")); + } +} //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/ui/src/app.js b/ui/src/app.js index d519cd63c..ef9fe6786 100644 --- a/ui/src/app.js +++ b/ui/src/app.js @@ -298,6 +298,10 @@ function processData (data) { clearTimeout(complianceTimeout) externalCompliance(data.externalComplianceUrl) break + case 'suspiciousAddress': + suspiciousAddress(data.blacklistMessage) + setState('suspicious_address') + break default: if (data.action) setState(window.snakecase(data.action)) } @@ -2088,3 +2092,11 @@ function externalCompliance (url) { qrize(url, $('#qr-code-external-validation'), cashDirection === 'cashIn' ? CASH_IN_QR_COLOR : CASH_OUT_QR_COLOR) return setScreen('external_compliance') } + +function suspiciousAddress (blacklistMessage) { + if (blacklistMessage) { + $(`#suspicious-address-message`).html(blacklistMessage) + } else { + $(`#suspicious-address-message`).html(translate("This address may be associated with a deceptive offer or a prohibited group. Please make sure you\'re using an address from your own wallet.")) + } +} diff --git a/ui/start-docker.html b/ui/start-docker.html index b419e8072..a7bf5cab7 100644 --- a/ui/start-docker.html +++ b/ui/start-docker.html @@ -2475,7 +2475,7 @@

Verify phone to continue

Suspicious address

-

+

This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet.

diff --git a/ui/start-test.html b/ui/start-test.html index 2447164f1..7e8d1ac5e 100644 --- a/ui/start-test.html +++ b/ui/start-test.html @@ -2475,7 +2475,7 @@

Verify phone to continue

Suspicious address

-

+

This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet.

diff --git a/ui/start.html b/ui/start.html index 38a6bd5f8..afd5a6fa2 100644 --- a/ui/start.html +++ b/ui/start.html @@ -2475,7 +2475,7 @@

Verify phone to continue

Suspicious address

-

+

This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet.

From a5b984af012ae9890ae67648ed3f2e755d2ffc7c Mon Sep 17 00:00:00 2001 From: siiky Date: Mon, 19 Dec 2022 15:08:39 +0000 Subject: [PATCH 2/2] refactor: remove unnecessary text --- i18n/ui/lbm-ui_en-US.po | 4 ---- ui/html/suspicious-address.html | 3 +-- ui/start-docker.html | 3 +-- ui/start-test.html | 3 +-- ui/start.html | 3 +-- 5 files changed, 4 insertions(+), 12 deletions(-) diff --git a/i18n/ui/lbm-ui_en-US.po b/i18n/ui/lbm-ui_en-US.po index 15dc748dc..d9296cbe8 100644 --- a/i18n/ui/lbm-ui_en-US.po +++ b/i18n/ui/lbm-ui_en-US.po @@ -682,10 +682,6 @@ msgstr "Yes, verify phone" msgid "Suspicious address" msgstr "Suspicious address" -#: On screen: suspicious-address -msgid "This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet." -msgstr "This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet." - #: On screen: booting msgid "Booting up..." msgstr "Booting up..." diff --git a/ui/html/suspicious-address.html b/ui/html/suspicious-address.html index 1cd96120f..e36f5c23b 100644 --- a/ui/html/suspicious-address.html +++ b/ui/html/suspicious-address.html @@ -10,8 +10,7 @@

Suspicious address

-

- This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet. +

diff --git a/ui/start-docker.html b/ui/start-docker.html index a7bf5cab7..ff93fbcce 100644 --- a/ui/start-docker.html +++ b/ui/start-docker.html @@ -2475,8 +2475,7 @@

Verify phone to continue

Suspicious address

-

- This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet. +

diff --git a/ui/start-test.html b/ui/start-test.html index 7e8d1ac5e..631a900c5 100644 --- a/ui/start-test.html +++ b/ui/start-test.html @@ -2475,8 +2475,7 @@

Verify phone to continue

Suspicious address

-

- This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet. +

diff --git a/ui/start.html b/ui/start.html index afd5a6fa2..6564dbbbf 100644 --- a/ui/start.html +++ b/ui/start.html @@ -2475,8 +2475,7 @@

Verify phone to continue

Suspicious address

-

- This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet. +