Skip to content

Commit b59f55e

Browse files
committed
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:blocknative/onboard into v2-web3-onboard-develop
2 parents 6a78d75 + 93d91f4 commit b59f55e

File tree

24 files changed

+94
-68
lines changed

24 files changed

+94
-68
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web3-onboard-monorepo",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"private": true,
55
"workspaces": [
66
"./packages/*"

packages/coinbase/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/coinbase",
3-
"version": "2.0.7-alpha.1",
3+
"version": "2.0.7",
44
"description": "Coinbase Wallet module for web3-onboard",
55
"repository": "blocknative/web3-onboard",
66
"module": "dist/index.js",
@@ -22,6 +22,6 @@
2222
},
2323
"dependencies": {
2424
"@coinbase/wallet-sdk": "^3.0.5",
25-
"@web3-onboard/common": "^2.1.4-alpha.1"
25+
"@web3-onboard/common": "^2.1.4"
2626
}
2727
}

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/common",
3-
"version": "2.1.4-alpha.1",
3+
"version": "2.1.4",
44
"repository": "blocknative/web3-onboard",
55
"scripts": {
66
"build": "rollup -c",

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.3.2-alpha.4",
3+
"version": "2.3.2",
44
"repository": "blocknative/web3-onboard",
55
"scripts": {
66
"build": "rollup -c",
@@ -42,7 +42,7 @@
4242
"typescript": "^4.5.5"
4343
},
4444
"dependencies": {
45-
"@web3-onboard/common": "^2.1.4-alpha.1",
45+
"@web3-onboard/common": "^2.1.4",
4646
"bignumber.js": "^9.0.0",
4747
"bnc-sdk": "^4.4.1",
4848
"bowser": "^2.11.0",

packages/core/src/index.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import disconnectWallet from './disconnect'
44
import setChain from './chain'
55
import { state } from './store'
66
import { reset$ } from './streams'
7-
import { validateInitOptions, validateNotify, validateNotifyOptions } from './validation'
7+
import {
8+
validateInitOptions,
9+
validateNotify,
10+
validateNotifyOptions
11+
} from './validation'
812
import initI18N from './i18n'
913
import App from './views/Index.svelte'
1014
import type { InitOptions, OnboardAPI, Notify } from './types'
@@ -106,11 +110,11 @@ function init(options: InitOptions): OnboardAPI {
106110
if (typeof notify !== 'undefined') {
107111
if ('desktop' in notify || 'mobile' in notify) {
108112
const error = validateNotifyOptions(notify)
109-
113+
110114
if (error) {
111115
throw error
112116
}
113-
117+
114118
if (
115119
(!notify.desktop || (notify.desktop && !notify.desktop.position)) &&
116120
accountCenter &&
@@ -128,6 +132,7 @@ function init(options: InitOptions): OnboardAPI {
128132
notify.mobile.position = accountCenter.mobile.position
129133
}
130134
let notifyUpdate: Partial<Notify>
135+
131136
if (device.type === 'mobile' && notify.mobile) {
132137
notifyUpdate = {
133138
...APP_INITIAL_STATE.notify,
@@ -139,15 +144,34 @@ function init(options: InitOptions): OnboardAPI {
139144
...notify.desktop
140145
}
141146
}
147+
if (!apiKey || !notifyUpdate.enabled) {
148+
notifyUpdate.enabled = false
149+
}
142150
updateNotify(notifyUpdate)
143151
} else {
144152
const error = validateNotify(notify as Notify)
145-
153+
146154
if (error) {
147155
throw error
148156
}
149-
updateNotify(notify as Notify)
157+
const notifyUpdate: Partial<Notify> = {
158+
...APP_INITIAL_STATE.notify,
159+
...notify
160+
}
161+
162+
if (!apiKey || !notifyUpdate.enabled) {
163+
notifyUpdate.enabled = false
164+
}
165+
console.log(notifyUpdate)
166+
updateNotify(notifyUpdate)
167+
}
168+
} else {
169+
const notifyUpdate: Partial<Notify> = APP_INITIAL_STATE.notify
170+
171+
if (!apiKey) {
172+
notifyUpdate.enabled = false
150173
}
174+
updateNotify(notifyUpdate)
151175
}
152176

153177
if (svelteInstance) {

packages/core/src/views/Index.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import AccountCenter from './account-center/Index.svelte'
99
import Notify from './notify/Index.svelte'
1010
import { configuration } from '../configuration'
11+
import type { Observable } from 'rxjs'
12+
import type { Notification } from '../types'
1113
1214
const { device } = configuration
1315
const accountCenter$ = state
@@ -18,9 +20,9 @@
1820
.select('notify')
1921
.pipe(startWith(state.get().notify), shareReplay(1))
2022
21-
const notifications$ = $notify$.enabled
22-
? state.select('notifications').pipe(startWith(state.get().notifications))
23-
: null
23+
const notifications$: Observable<Notification[]> = state
24+
.select('notifications')
25+
.pipe(startWith(state.get().notifications))
2426
2527
const positioningDefaults = {
2628
topLeft: 'top: 0; left: 0;',
@@ -34,7 +36,7 @@
3436
$notify$.enabled &&
3537
$notify$.position === $accountCenter$.position
3638
37-
$: samePositionMobile =
39+
$: samePositionOrMobile =
3840
device.type === 'mobile' || $accountCenter$.position === $notify$.position
3941
4042
$: sharedMobileContainerCheck =
@@ -339,7 +341,7 @@
339341
? 'padding-top:0;'
340342
: ''} "
341343
>
342-
{#if $notify$.position.includes('bottom') && $accountCenter$.position.includes('bottom') && samePositionMobile}
344+
{#if $notify$.position.includes('bottom') && $accountCenter$.position.includes('bottom') && samePositionOrMobile}
343345
<Notify
344346
notifications={$notifications$}
345347
position={$notify$.position}
@@ -359,7 +361,7 @@
359361
>
360362
<AccountCenter settings={$accountCenter$} />
361363
</div>
362-
{#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionMobile}
364+
{#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionOrMobile}
363365
<Notify
364366
notifications={$notifications$}
365367
position={$notify$.position}

packages/dcent/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/dcent",
3-
"version": "2.0.4-alpha.1",
3+
"version": "2.0.4",
44
"description": "D'CENT module for web3-onboard",
55
"repository": "blocknative/web3-onboard",
66
"module": "dist/index.js",
@@ -19,7 +19,7 @@
1919
"typescript": "^4.5.5"
2020
},
2121
"dependencies": {
22-
"@web3-onboard/common": "^2.1.4-alpha.1",
22+
"@web3-onboard/common": "^2.1.4",
2323
"@ethereumjs/common": "^2.6.1",
2424
"@ethereumjs/tx": "^3.4.0",
2525
"@ethersproject/providers": "^5.5.0",

packages/demo/package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222
"webpack-dev-server": "4.7.4"
2323
},
2424
"dependencies": {
25-
"@web3-onboard/coinbase": "^2.0.6",
26-
"@web3-onboard/core": "^2.3.2-alpha.2",
27-
"@web3-onboard/dcent": "^2.0.3",
28-
"@web3-onboard/fortmatic": "^2.0.5",
29-
"@web3-onboard/gnosis": "^2.0.4",
30-
"@web3-onboard/injected-wallets": "^2.0.11",
31-
"@web3-onboard/keepkey": "^2.1.3",
32-
"@web3-onboard/keystone": "^2.1.4",
33-
"@web3-onboard/ledger": "^2.1.3",
34-
"@web3-onboard/magic": "^2.0.6",
35-
"@web3-onboard/portis": "^2.0.3",
36-
"@web3-onboard/torus": "^2.0.4",
37-
"@web3-onboard/trezor": "^2.1.3",
38-
"@web3-onboard/walletconnect": "^2.0.4",
39-
"@web3-onboard/web3auth": "^2.0.2",
25+
"@web3-onboard/coinbase": "^2.0.7",
26+
"@web3-onboard/core": "^2.3.2",
27+
"@web3-onboard/dcent": "^2.0.6",
28+
"@web3-onboard/fortmatic": "^2.0.6",
29+
"@web3-onboard/gnosis": "^2.0.5",
30+
"@web3-onboard/injected-wallets": "^2.0.12",
31+
"@web3-onboard/keepkey": "^2.1.4",
32+
"@web3-onboard/keystone": "^2.1.5",
33+
"@web3-onboard/ledger": "^2.1.4",
34+
"@web3-onboard/magic": "^2.0.7",
35+
"@web3-onboard/portis": "^2.0.4",
36+
"@web3-onboard/torus": "^2.0.5",
37+
"@web3-onboard/trezor": "^2.1.4",
38+
"@web3-onboard/walletconnect": "^2.0.5",
39+
"@web3-onboard/web3auth": "^2.0.3",
4040
"vconsole": "^3.9.5"
4141
},
4242
"license": "MIT",

packages/fortmatic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/fortmatic",
3-
"version": "2.0.6-alpha.1",
3+
"version": "2.0.6",
44
"description": "Fortmatic module for web3-onboard",
55
"repository": "blocknative/web3-onboard",
66
"module": "dist/index.js",
@@ -21,7 +21,7 @@
2121
"typescript": "^4.5.5"
2222
},
2323
"dependencies": {
24-
"@web3-onboard/common": "^2.1.4-alpha.1",
24+
"@web3-onboard/common": "^2.1.4",
2525
"fortmatic": "^2.2.1"
2626
}
2727
}

packages/gnosis/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/gnosis",
3-
"version": "2.0.5-alpha.1",
3+
"version": "2.0.5",
44
"description": "Gnosis module for web3-onboard",
55
"repository": "blocknative/web3-onboard",
66
"module": "dist/index.js",
@@ -24,6 +24,6 @@
2424
"dependencies": {
2525
"@gnosis.pm/safe-apps-provider": "^0.9.2",
2626
"@gnosis.pm/safe-apps-sdk": "^6.1.1",
27-
"@web3-onboard/common": "^2.1.4-alpha.1"
27+
"@web3-onboard/common": "^2.1.4"
2828
}
2929
}

0 commit comments

Comments
 (0)