Skip to content

Commit

Permalink
Merge pull request #376 from blocknative/develop
Browse files Browse the repository at this point in the history
Release 0.10.2

- Updates dependencies to resolve vulnerabilities
- Fixes error that occurred when parsing a undefined error message
- Adds ability to opt out of browser check when on-boarding via a config option
  • Loading branch information
lnbc1QWFyb24 authored Aug 30, 2019
2 parents e033728 + 8609373 commit 502e93f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 15 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ yarn add bnc-assist
#### Script Tag

The library uses [semantic versioning](https://semver.org/spec/v2.0.0.html).
The current version is 0.10.1.
The current version is 0.10.2.
There are minified and non-minified versions.
Put this script at the top of your `<head>`

```html
<script src="https://assist.blocknative.com/0-10-1/assist.js"></script>
<script src="https://assist.blocknative.com/0-10-2/assist.js"></script>

<!-- OR... -->

<script src="https://assist.blocknative.com/0-10-1/assist.min.js"></script>
<script src="https://assist.blocknative.com/0-10-2/assist.min.js"></script>
```

### Initialize the Library
Expand Down Expand Up @@ -187,6 +187,7 @@ var config = {
mobileBlocked: Boolean, // Defines if the Dapp works on mobile [false]
minimumBalance: String, // Defines the minimum balance in Wei that a user needs to have to use the Dapp [0]
headlessMode: Boolean, // Turn off Assist UI, but still retain analytics collection [false]
browserCheck: Boolean, // Check if the user is on a browser that supports extension wallets during onboarding [true]
messages: {
// See custom transaction messages section below for more details
txRequest: Function, // Transaction request has been initiated and is awaiting user approval
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bnc-assist",
"version": "0.10.1",
"version": "0.10.2",
"description": "Blocknative Assist js library for Dapp developers",
"main": "lib/assist.min.js",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions src/js/helpers/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ export function assistLog(log) {
}

export function extractMessageFromError(message) {
if (!message) {
return {
eventCode: 'txError',
errorMsg: undefined
}
}

if (message.includes('User denied transaction signature')) {
return {
eventCode: 'txSendFail',
Expand Down
1 change: 1 addition & 0 deletions src/js/helpers/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function validateConfig(config) {
mobileBlocked: ow.optional.boolean,
minimumBalance: ow.optional.string,
headlessMode: ow.optional.boolean,
browserCheck: ow.optional.boolean,
messages: ow.optional.object.exactShape({
txRequest: ow.optional.function,
txSent: ow.optional.function,
Expand Down
2 changes: 1 addition & 1 deletion src/js/logic/send-transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ function onTxError(id, error, categoryCode) {
contract: txObj.contract,
inlineCustomMsgs: txObj.inlineCustomMsgs,
clickHandlers: txObj.clickHandlers,
reason: errorMsg,
reason: errorMsg || JSON.stringify(error),
wallet: {
provider: state.currentProvider,
address: state.accountAddress,
Expand Down
6 changes: 5 additions & 1 deletion src/js/logic/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export function prepareForTransaction(categoryCode, originalResolve) {
}

if (getItem('_assist_newUser') === 'true') {
if (!state.validBrowser && !state.mobileDevice) {
if (
!state.validBrowser &&
!state.mobileDevice &&
state.config.browserCheck !== false
) {
handleEvent(
{
eventCode: 'browserFail',
Expand Down
20 changes: 11 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2485,14 +2485,16 @@ eslint-scope@^4.0.3:
estraverse "^4.1.1"

eslint-utils@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512"
integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==
version "1.4.2"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab"
integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==
dependencies:
eslint-visitor-keys "^1.0.0"

eslint-visitor-keys@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==
version "1.1.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2"
integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==

eslint@^5.1.0, eslint@^5.9.0:
version "5.16.0"
Expand Down Expand Up @@ -5045,9 +5047,9 @@ minizlib@^1.2.1:
minipass "^2.2.1"

mixin-deep@^1.2.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe"
integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==
version "1.3.2"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==
dependencies:
for-in "^1.0.2"
is-extendable "^1.0.1"
Expand Down

0 comments on commit 502e93f

Please sign in to comment.