bnc-assist
Advanced tools
Comparing version 0.7.4 to 0.7.5
{ | ||
"name": "bnc-assist", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "Blocknative Assist js library for Dapp developers", | ||
@@ -5,0 +5,0 @@ "main": "lib/assist.min.js", |
@@ -46,3 +46,3 @@ # Assist.js | ||
The library uses [semantic versioning](https://semver.org/spec/v2.0.0.html). | ||
The current version is 0.7.4. | ||
The current version is 0.7.5. | ||
There are minified and non-minified versions. | ||
@@ -52,7 +52,7 @@ Put this script at the top of your `<head>` | ||
```html | ||
<script src="https://assist.blocknative.com/0-7-4/assist.js"></script> | ||
<script src="https://assist.blocknative.com/0-7-5/assist.js"></script> | ||
<!-- OR... --> | ||
<script src="https://assist.blocknative.com/0-7-4/assist.min.js"></script> | ||
<script src="https://assist.blocknative.com/0-7-5/assist.min.js"></script> | ||
``` | ||
@@ -59,0 +59,0 @@ |
@@ -134,3 +134,3 @@ import { promisify } from 'bluebird' | ||
export function checkForWallet() { | ||
if (window.ethereum && window.web3.version) { | ||
if (window.ethereum) { | ||
updateState({ | ||
@@ -137,0 +137,0 @@ currentProvider: getCurrentProvider(), |
@@ -144,3 +144,3 @@ import '@babel/polyfill' | ||
supportedNetwork, | ||
config: { headlessMode } | ||
config: { headlessMode, mobileBlocked } | ||
} = state | ||
@@ -160,8 +160,29 @@ | ||
if (headlessMode) { | ||
if (headlessMode || mobileDevice) { | ||
// If user is on mobile and it is blocked, warn that it isn't supported | ||
if (mobileBlocked) { | ||
return new Promise((resolve, reject) => { | ||
handleEvent( | ||
{ eventCode: 'mobileBlocked', categoryCode: 'onboard' }, | ||
{ | ||
onClose: () => { | ||
const errorObj = new Error('User is on a mobile device') | ||
errorObj.eventCode = 'mobileBlocked' | ||
reject(errorObj) | ||
} | ||
} | ||
) | ||
updateState({ validBrowser: false }) | ||
}) | ||
} | ||
return new Promise(async (resolve, reject) => { | ||
await checkUserEnvironment().catch(reject) | ||
if (mobileDevice && window.ethereum) { | ||
await window.ethereum.enable().catch() | ||
} | ||
await checkUserEnvironment().catch() | ||
const { | ||
mobileDevice, | ||
validBrowser, | ||
@@ -189,20 +210,2 @@ web3Wallet, | ||
// If user is on mobile, warn that it isn't supported | ||
if (mobileDevice) { | ||
return new Promise((resolve, reject) => { | ||
handleEvent( | ||
{ eventCode: 'mobileBlocked', categoryCode: 'onboard' }, | ||
{ | ||
onClose: () => { | ||
const errorObj = new Error('User is on a mobile device') | ||
errorObj.eventCode = 'mobileBlocked' | ||
reject(errorObj) | ||
} | ||
} | ||
) | ||
updateState({ validBrowser: false }) | ||
}) | ||
} | ||
return new Promise(async (resolve, reject) => { | ||
@@ -209,0 +212,0 @@ storeItem('onboarding', 'true') |
Sorry, the diff of this file is too big to display
2294301
10313