@matchain/matchid-sdk-react 0.1.30 → 0.1.32
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.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +596 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +596 -67
- package/dist/index.mjs.map +1 -1
- package/example/src/App.tsx +13 -3
- package/example/src/components/Login/index.tsx +2 -2
- package/example/src/config/index.ts +5 -1
- package/example/src/pages/User.tsx +1 -1
- 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
|
},
|
|
@@ -54,6 +58,12 @@ function App() {
|
|
|
54
58
|
setEndpoints({...endpoints, back: ele.target.value})
|
|
55
59
|
}}/>
|
|
56
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>
|
|
57
67
|
</div>
|
|
58
68
|
<nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10`}>
|
|
59
69
|
<Link to="/">Home</Link>
|
|
@@ -44,7 +44,7 @@ export default function Login(){
|
|
|
44
44
|
'discord',
|
|
45
45
|
'github',
|
|
46
46
|
'facebook',
|
|
47
|
-
'
|
|
47
|
+
'youtube'
|
|
48
48
|
]}/>
|
|
49
49
|
|
|
50
50
|
</div>
|
|
@@ -69,7 +69,7 @@ export default function Login(){
|
|
|
69
69
|
</div>
|
|
70
70
|
<div className={`font-bold text-lg`}>LoginPanel</div>
|
|
71
71
|
<div className={`bg-gray-100 p-10`}>
|
|
72
|
-
<div className={`bg-white`}><LoginPanel onClose={() => console.log('onLoginPanelClose')} methods={['telegram','twitter','discord','github','facebook','
|
|
72
|
+
<div className={`bg-white`}><LoginPanel onClose={() => console.log('onLoginPanelClose')} methods={['telegram','twitter','discord','github','facebook','youtube']}/></div>
|
|
73
73
|
</div>
|
|
74
74
|
</div>
|
|
75
75
|
);
|
|
@@ -141,7 +141,7 @@ export default function User() {
|
|
|
141
141
|
<div className={`font-bold text-lg`}>LoginButton</div>
|
|
142
142
|
|
|
143
143
|
<div className={`bg-gray-100 p-5 mt-5`}>
|
|
144
|
-
<LoginButton methods={[ "twitter", 'facebook',"discord","github","
|
|
144
|
+
<LoginButton methods={[ "twitter", 'facebook',"discord","github","youtube","telegram"]} popoverPosition={"left"}/>
|
|
145
145
|
</div>
|
|
146
146
|
<RoutePrivate>
|
|
147
147
|
<LoginContent/>
|
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.32",
|
|
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).
|