Skip to content

Commit 502e93f

Browse files
authored
Merge pull request #376 from blocknative/develop
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
2 parents e033728 + 8609373 commit 502e93f

File tree

7 files changed

+30
-15
lines changed

7 files changed

+30
-15
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ yarn add bnc-assist
4343
#### Script Tag
4444

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

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

5353
<!-- OR... -->
5454

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

5858
### Initialize the Library
@@ -187,6 +187,7 @@ var config = {
187187
mobileBlocked: Boolean, // Defines if the Dapp works on mobile [false]
188188
minimumBalance: String, // Defines the minimum balance in Wei that a user needs to have to use the Dapp [0]
189189
headlessMode: Boolean, // Turn off Assist UI, but still retain analytics collection [false]
190+
browserCheck: Boolean, // Check if the user is on a browser that supports extension wallets during onboarding [true]
190191
messages: {
191192
// See custom transaction messages section below for more details
192193
txRequest: Function, // Transaction request has been initiated and is awaiting user approval

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-assist",
3-
"version": "0.10.1",
3+
"version": "0.10.2",
44
"description": "Blocknative Assist js library for Dapp developers",
55
"main": "lib/assist.min.js",
66
"scripts": {

src/js/helpers/utilities.js

+7
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ export function assistLog(log) {
132132
}
133133

134134
export function extractMessageFromError(message) {
135+
if (!message) {
136+
return {
137+
eventCode: 'txError',
138+
errorMsg: undefined
139+
}
140+
}
141+
135142
if (message.includes('User denied transaction signature')) {
136143
return {
137144
eventCode: 'txSendFail',

src/js/helpers/validation.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function validateConfig(config) {
2525
mobileBlocked: ow.optional.boolean,
2626
minimumBalance: ow.optional.string,
2727
headlessMode: ow.optional.boolean,
28+
browserCheck: ow.optional.boolean,
2829
messages: ow.optional.object.exactShape({
2930
txRequest: ow.optional.function,
3031
txSent: ow.optional.function,

src/js/logic/send-transaction.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ function onTxError(id, error, categoryCode) {
404404
contract: txObj.contract,
405405
inlineCustomMsgs: txObj.inlineCustomMsgs,
406406
clickHandlers: txObj.clickHandlers,
407-
reason: errorMsg,
407+
reason: errorMsg || JSON.stringify(error),
408408
wallet: {
409409
provider: state.currentProvider,
410410
address: state.accountAddress,

src/js/logic/user.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ export function prepareForTransaction(categoryCode, originalResolve) {
6969
}
7070

7171
if (getItem('_assist_newUser') === 'true') {
72-
if (!state.validBrowser && !state.mobileDevice) {
72+
if (
73+
!state.validBrowser &&
74+
!state.mobileDevice &&
75+
state.config.browserCheck !== false
76+
) {
7377
handleEvent(
7478
{
7579
eventCode: 'browserFail',

yarn.lock

+11-9
Original file line numberDiff line numberDiff line change
@@ -2485,14 +2485,16 @@ eslint-scope@^4.0.3:
24852485
estraverse "^4.1.1"
24862486

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

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

24972499
eslint@^5.1.0, eslint@^5.9.0:
24982500
version "5.16.0"
@@ -5045,9 +5047,9 @@ minizlib@^1.2.1:
50455047
minipass "^2.2.1"
50465048

50475049
mixin-deep@^1.2.0:
5048-
version "1.3.1"
5049-
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe"
5050-
integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==
5050+
version "1.3.2"
5051+
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
5052+
integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==
50515053
dependencies:
50525054
for-in "^1.0.2"
50535055
is-extendable "^1.0.1"

0 commit comments

Comments
 (0)