Skip to content

Commit d68360b

Browse files
authored
[core-v2.3.0-alpha.2, react-v2.2.0-alpha.2, vue-v2.1.0-alpha.2] : Fix - Validation to handle onclick and links properly (#1083)
* Update validation to handle onclick and links properly * Update react package version * Update onClick for notifications to be camel case
1 parent 3b5c25b commit d68360b

File tree

7 files changed

+18
-12
lines changed

7 files changed

+18
-12
lines changed

packages/core/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/core",
3-
"version": "2.3.0-alpha.1",
3+
"version": "2.3.0-alpha.2",
44
"scripts": {
55
"build": "rollup -c",
66
"dev": "rollup -c -w",

packages/core/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export type Notification = {
180180
message: string
181181
autoDismiss: number
182182
link?: string
183-
onclick?: (event: Event) => void
183+
onClick?: (event: Event) => void
184184
}
185185

186186
export type TransactionHandlerReturn = CustomNotification | boolean | void

packages/core/src/validation.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ const customNotificationUpdate = Joi.object({
189189
eventCode: Joi.string(),
190190
message: Joi.string().required(),
191191
id: Joi.string().required(),
192-
autoDismiss: Joi.number()
192+
autoDismiss: Joi.number(),
193+
onClick: Joi.function(),
194+
link: Joi.string()
193195
})
194196

195197
const customNotification = Joi.object({
@@ -198,7 +200,9 @@ const customNotification = Joi.object({
198200
eventCode: Joi.string(),
199201
message: Joi.string(),
200202
id: Joi.string(),
201-
autoDismiss: Joi.number()
203+
autoDismiss: Joi.number(),
204+
onClick: Joi.function(),
205+
link: Joi.string()
202206
})
203207

204208
const notification = Joi.object({
@@ -209,7 +213,9 @@ const notification = Joi.object({
209213
message: Joi.string().required(),
210214
autoDismiss: Joi.number().required(),
211215
network: Joi.string().required(),
212-
startTime: Joi.number()
216+
startTime: Joi.number(),
217+
onClick: Joi.function(),
218+
link: Joi.string()
213219
})
214220

215221
const transactionHandlerReturn = Joi.any().allow(

packages/core/src/views/notify/Notification.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
</style>
104104

105105
<div
106-
class:bn-notify-clickable={notification.onclick}
107-
on:click={e => notification.onclick && notification.onclick(e)}
106+
class:bn-notify-clickable={notification.onClick}
107+
on:click={e => notification.onClick && notification.onClick(e)}
108108
class="bn-notify-notification bn-notify-notification-{notification.type}}"
109109
>
110110
<StatusIconBadge

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"dependencies": {
2525
"@web3-onboard/coinbase": "^2.0.5-alpha.1",
26-
"@web3-onboard/core": "^2.3.0-alpha.1",
26+
"@web3-onboard/core": "^2.3.0-alpha.2",
2727
"@web3-onboard/dcent": "^2.0.2-alpha.1",
2828
"@web3-onboard/fortmatic": "^2.0.4-alpha.1",
2929
"@web3-onboard/gnosis": "^2.0.3-alpha.1",

packages/react/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/react",
3-
"version": "2.2.0-alpha.2",
3+
"version": "2.2.0-alpha.3",
44
"description": "Collection of React Hooks for web3-onboard",
55
"module": "dist/index.js",
66
"browser": "dist/index.js",
@@ -23,7 +23,7 @@
2323
"typescript": "^4.5.5"
2424
},
2525
"dependencies": {
26-
"@web3-onboard/core": "^2.3.0-alpha.1",
26+
"@web3-onboard/core": "^2.3.0-alpha.2",
2727
"@web3-onboard/common": "^2.1.2-alpha.2",
2828
"use-sync-external-store": "1.0.0"
2929
},

packages/vue/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/vue",
3-
"version": "2.1.0-alpha.1",
3+
"version": "2.1.0-alpha.2",
44
"description": "Vue Composable for web3-onboard",
55
"module": "dist/index.js",
66
"browser": "dist/index.js",
@@ -24,7 +24,7 @@
2424
"@vueuse/core": "^8.4.2",
2525
"@vueuse/rxjs": "^8.2.0",
2626
"@web3-onboard/common": "^2.1.2-alpha.2",
27-
"@web3-onboard/core": "^2.3.0-alpha.1",
27+
"@web3-onboard/core": "^2.3.0-alpha.2",
2828
"vue-demi": "^0.12.4"
2929
},
3030
"peerDependencies": {

0 commit comments

Comments
 (0)