@matchain/matchid-sdk-react 0.1.29 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +16 -6
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +570 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +570 -68
- package/dist/index.mjs.map +1 -1
- package/example/src/App.tsx +33 -18
- package/example/src/components/Login/index.tsx +1 -1
- package/example/src/config/index.ts +3 -0
- package/example/src/pages/User.tsx +2 -2
- package/package.json +2 -1
- package/readme.md +29 -3
package/example/src/App.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {useState} from "react";
|
|
1
|
+
import React, {useEffect, useState} from "react";
|
|
2
2
|
import {MatchProvider} from "@matchain/matchid-sdk-react";
|
|
3
3
|
import {BrowserRouter as Router, Routes, Route, Link} from 'react-router-dom';
|
|
4
4
|
import Home from "./pages/Home";
|
|
5
5
|
import './app.css'
|
|
6
6
|
import User from "./pages/User";
|
|
7
7
|
import "@matchain/matchid-sdk-react/index.css"
|
|
8
|
-
import RoutePrivate from "./components/RoutePrivate";
|
|
9
8
|
import Wallet from "@/pages/Wallet";
|
|
9
|
+
import {LocaleList} from "@/config";
|
|
10
10
|
|
|
11
11
|
const getState = () => {
|
|
12
12
|
if (window.localStorage.getItem('match-local')) {
|
|
@@ -19,12 +19,16 @@ const getState = () => {
|
|
|
19
19
|
function App() {
|
|
20
20
|
const state = getState()
|
|
21
21
|
const [appid, setAppid] = useState(state?.appid || '')
|
|
22
|
+
const [locale,setLocale] = useState(window.localStorage.getItem('locale')||'en')
|
|
23
|
+
useEffect(()=>{
|
|
24
|
+
window.localStorage.setItem('locale',locale)
|
|
25
|
+
},[locale])
|
|
22
26
|
const [endpoints, setEndpoints] = useState<{
|
|
23
27
|
auth: string,
|
|
24
28
|
back: string
|
|
25
29
|
}>(state?.endpoints)
|
|
26
30
|
|
|
27
|
-
return <MatchProvider appid={appid} endpoints={endpoints} events={{
|
|
31
|
+
return <MatchProvider appid={appid} endpoints={endpoints} locale={locale} events={{
|
|
28
32
|
onLogin: (data) => {
|
|
29
33
|
console.log('events.onLogin', data)
|
|
30
34
|
},
|
|
@@ -34,21 +38,32 @@ function App() {
|
|
|
34
38
|
}}
|
|
35
39
|
>
|
|
36
40
|
<Router>
|
|
37
|
-
<div className={`mb-2 p-2 flex gap-2`}>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
<div className={`mb-2 p-2 flex gap-2 flex-col`}>
|
|
42
|
+
<div>
|
|
43
|
+
<label>Appid:</label>
|
|
44
|
+
<input value={appid} placeholder={"Appid"} className={"border-solid border"} onChange={(ele) => {
|
|
45
|
+
setAppid(ele.target.value)
|
|
46
|
+
}}/></div>
|
|
47
|
+
<div>
|
|
48
|
+
<label>AuthEndpoint:</label>
|
|
49
|
+
<input value={endpoints?.auth || ''} placeholder={"Auth Endpoint"} className={"border-solid border"}
|
|
50
|
+
onChange={(ele) => {
|
|
51
|
+
setEndpoints({...endpoints, auth: ele.target.value})
|
|
52
|
+
}}/>
|
|
53
|
+
</div>
|
|
54
|
+
<div>
|
|
55
|
+
<label>BackEndpoint:</label>
|
|
56
|
+
<input value={endpoints?.back || ''} placeholder={"Back Endpoint"} className={"border-solid border"}
|
|
57
|
+
onChange={(ele) => {
|
|
58
|
+
setEndpoints({...endpoints, back: ele.target.value})
|
|
59
|
+
}}/>
|
|
60
|
+
</div>
|
|
61
|
+
<div>
|
|
62
|
+
<label>Locale:</label>
|
|
63
|
+
<select onChange={(ele) => {setLocale(ele.target.value)}} value={locale}>
|
|
64
|
+
{LocaleList.map((item)=><option key={item} value={item}>{item}</option>)}
|
|
65
|
+
</select>
|
|
66
|
+
</div>
|
|
52
67
|
</div>
|
|
53
68
|
<nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10`}>
|
|
54
69
|
<Link to="/">Home</Link>
|
|
@@ -18,7 +18,7 @@ export default function Login(){
|
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
20
|
<div className={`flex flex-col gap-10`}>
|
|
21
|
-
<div className={`flex gap-5`}>
|
|
21
|
+
<div className={`flex gap-5 flex-wrap`}>
|
|
22
22
|
<button className={`bg-gray-300 p-1 rounded`}
|
|
23
23
|
onClick={() => setLoginOpen(true)}>Open Modal
|
|
24
24
|
</button>
|
|
@@ -27,7 +27,7 @@ function QueryDisplay(
|
|
|
27
27
|
{keys.map((key) => {
|
|
28
28
|
return <div key={key} className={`flex gap-[20px]`}>
|
|
29
29
|
<div className={"w-[200px]"}>{key}</div>
|
|
30
|
-
<div className={`flex-1`}>{
|
|
30
|
+
<div className={`flex-1 flex-wrap break-all`}>{
|
|
31
31
|
typeof query[key] === 'function' ? <Button size="sm" onClick={() => {
|
|
32
32
|
query[key]()
|
|
33
33
|
}}>Run</Button> :
|
|
@@ -96,7 +96,7 @@ function LoginContent() {
|
|
|
96
96
|
setPasswordOpen(false)
|
|
97
97
|
}}/>
|
|
98
98
|
</div>
|
|
99
|
-
<div className={`flex gap-[20px]`}>
|
|
99
|
+
<div className={`flex gap-[20px] flex-wrap`}>
|
|
100
100
|
|
|
101
101
|
{
|
|
102
102
|
LoginMethod.map((method) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matchain/matchid-sdk-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"axios": "^1.7.0",
|
|
43
43
|
"copy-to-clipboard": "^3.3.3",
|
|
44
44
|
"ethers": "^5.7.2",
|
|
45
|
+
"react-intl": "^7.1.0",
|
|
45
46
|
"react-router-dom": "^6.0.0",
|
|
46
47
|
"siwe": "^2.3.2",
|
|
47
48
|
"styled-components": "^6.1.13",
|
package/readme.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
# @matchain/matchid-sdk-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A React SDK for integrating MatchID, a versatile identity solution that bridges Web2 and Web3. With MatchID, you can connect multiple wallets across different blockchain networks, as well as link Web2 identities like Email, Twitter, Facebook, Google, TikTok, and many others.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Multi-Chain Support**: Seamlessly connect wallets from various blockchain networks.
|
|
10
|
+
- **Web2 Identity Integration**: Link Web2 IDs including Email, Twitter, Facebook, Google, TikTok, and more.
|
|
11
|
+
- **React-Ready**: Designed specifically for React applications for smooth integration.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @matchain/matchid-sdk-react
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or, using Yarn:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @matchain/matchid-sdk-react
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
For detailed usage instructions, please refer to the [Usage Documentation](https://docs.matchid.ai).
|