@matchain/matchid-sdk-react 0.1.56-alpha.12 → 0.1.56-alpha.14
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/api.d.mts +2 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.js +83 -44
- package/dist/api.js.map +1 -1
- package/dist/api.mjs +2 -2
- package/dist/{chunk-DUSDBXBT.mjs → chunk-EMSBFHPM.mjs} +174 -124
- package/dist/chunk-EMSBFHPM.mjs.map +1 -0
- package/dist/{chunk-44JQQ34F.mjs → chunk-SEACJPL6.mjs} +2 -2
- package/dist/components.d.mts +3 -3
- package/dist/components.d.ts +3 -3
- package/dist/components.js +161 -122
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +1 -1
- package/dist/hooks.d.mts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +39 -0
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/icon.d.mts +2 -2
- package/dist/icon.d.ts +2 -2
- package/dist/{index-DxHhOW24.d.mts → index-BLjGmf9p.d.mts} +2 -2
- package/dist/{index-BNqdFiOo.d.ts → index-BXhXRggh.d.ts} +1 -1
- package/dist/{index-uB9jBjgs.d.mts → index-Bjb30oE3.d.mts} +35 -31
- package/dist/{index-hz9v-CNJ.d.ts → index-CPnKc6o4.d.ts} +35 -31
- package/dist/{index-CcVHENNv.d.ts → index-CpJtux-G.d.ts} +1 -1
- package/dist/{index-DVlulZhE.d.mts → index-CqHlL6ue.d.mts} +3 -3
- package/dist/{index-DkijpM5Q.d.mts → index-CzCkxwOm.d.mts} +1 -1
- package/dist/{index-84CqVi2I.d.mts → index-DCyE39bg.d.mts} +1 -1
- package/dist/{index-BctnHnJp.d.ts → index-DGsB7f2H.d.ts} +1 -1
- package/dist/{index-Cqdz_5bE.d.ts → index-DQYg6bEA.d.ts} +2 -2
- package/dist/{index-qmC4zt6V.d.ts → index-DZpXCByF.d.ts} +3 -3
- package/dist/{index-Car1jFyN.d.mts → index-De8efmdb.d.mts} +1 -1
- package/dist/{index-BqI0PEIi.d.mts → index-DuCefmJ0.d.mts} +1 -1
- package/dist/{index-CvzpMw3N.d.ts → index-m2bn_W3Y.d.ts} +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +173 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{types-BrVeC0c8.d.mts → types-C8FLH1yn.d.mts} +1 -0
- package/dist/{types-BrVeC0c8.d.ts → types-C8FLH1yn.d.ts} +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui.d.mts +3 -3
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +6 -0
- package/dist/ui.js.map +1 -1
- package/dist/ui.mjs +1 -1
- package/example/src/App.tsx +61 -61
- package/example/src/config/index.ts +8 -6
- package/example/src/pages/Home.tsx +15 -15
- package/example/src/store/useLocalStore.ts +19 -19
- package/example/yarn.lock +1384 -0
- package/package.json +1 -1
- package/dist/chunk-DUSDBXBT.mjs.map +0 -1
- /package/dist/{chunk-44JQQ34F.mjs.map → chunk-SEACJPL6.mjs.map} +0 -0
package/dist/ui.mjs
CHANGED
package/example/src/App.tsx
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import React, {useEffect, useMemo, useState} from "react";
|
|
2
|
-
import {MatchProvider, wagmiConfig} from "@matchain/matchid-sdk-react";
|
|
3
|
-
import {BrowserRouter as Router, Routes, Route, Link, useLocation} from 'react-router-dom';
|
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { MatchProvider, wagmiConfig } from "@matchain/matchid-sdk-react";
|
|
3
|
+
import { BrowserRouter as Router, Routes, Route, Link, useLocation } 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
8
|
import Wallet from "@/pages/Wallet";
|
|
9
|
-
import {LocaleList} from "@/config";
|
|
10
|
-
import {LocaleType} from "@matchain/matchid-sdk-react/types";
|
|
11
|
-
import {useUserInfo} from "@matchain/matchid-sdk-react/hooks";
|
|
9
|
+
import { LocaleList } from "@/config";
|
|
10
|
+
import { LocaleType } from "@matchain/matchid-sdk-react/types";
|
|
11
|
+
import { useUserInfo } from "@matchain/matchid-sdk-react/hooks";
|
|
12
12
|
import RoutePrivate from "@/components/RoutePrivate";
|
|
13
13
|
import useLocalStore from "@/store/useLocalStore";
|
|
14
|
-
import {LoginButton} from "@matchain/matchid-sdk-react/components";
|
|
14
|
+
import { LoginButton } from "@matchain/matchid-sdk-react/components";
|
|
15
15
|
import UI from "@/pages/UI";
|
|
16
16
|
import TgApp from "@/pages/TgApp";
|
|
17
|
-
import {WagmiProvider} from "wagmi";
|
|
17
|
+
import { WagmiProvider } from "wagmi";
|
|
18
18
|
import useStore from "@/store/useStore";
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
function Nav() {
|
|
22
|
-
const {isLogin} = useUserInfo()
|
|
22
|
+
const { isLogin } = useUserInfo()
|
|
23
23
|
const location = useLocation()
|
|
24
24
|
const menus = useMemo(() => {
|
|
25
25
|
const list: {
|
|
@@ -28,43 +28,43 @@ function Nav() {
|
|
|
28
28
|
onActive: boolean
|
|
29
29
|
hidden?: boolean
|
|
30
30
|
}[] = [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
31
|
+
{
|
|
32
|
+
name: 'Home',
|
|
33
|
+
url: '/',
|
|
34
|
+
onActive: location.pathname === '/'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'UI',
|
|
38
|
+
url: '/ui',
|
|
39
|
+
onActive: location.pathname === '/ui'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'TgApp',
|
|
43
|
+
url: '/tgapp',
|
|
44
|
+
onActive: location.pathname === '/tgapp'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'User',
|
|
48
|
+
url: '/user',
|
|
49
|
+
onActive: location.pathname === '/user'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Wallet',
|
|
53
|
+
url: '/wallet',
|
|
54
|
+
onActive: location.pathname === '/wallet',
|
|
55
|
+
hidden: !isLogin
|
|
56
|
+
},
|
|
57
|
+
]
|
|
58
58
|
return list
|
|
59
59
|
}, [location.pathname, isLogin])
|
|
60
60
|
return <>
|
|
61
61
|
<nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10 flex-wrap`}>
|
|
62
62
|
{menus.map((menu) => {
|
|
63
63
|
return <Link key={menu.url} to={menu.url}
|
|
64
|
-
|
|
64
|
+
className={`text-2xl ${menu.onActive ? 'text-red-600' : 'text-gray-400'} ${menu.hidden ? 'hidden' : ''}`}>{menu.name}</Link>
|
|
65
65
|
})}
|
|
66
66
|
|
|
67
|
-
<LoginButton/>
|
|
67
|
+
<LoginButton recommendMethods={['wallet', 'github', 'discord']} walletMethods={['evm']} />
|
|
68
68
|
</nav>
|
|
69
69
|
|
|
70
70
|
</>
|
|
@@ -85,44 +85,44 @@ function RouterApp() {
|
|
|
85
85
|
color,
|
|
86
86
|
setColor
|
|
87
87
|
} = useLocalStore()
|
|
88
|
-
const {appSecret,setAppSecret} = useStore()
|
|
88
|
+
const { appSecret, setAppSecret } = useStore()
|
|
89
89
|
|
|
90
90
|
return <Router>
|
|
91
91
|
<div className={`mb-2 p-2 flex gap-2 flex-col`}>
|
|
92
92
|
<div>
|
|
93
93
|
<label>BackgroundColor:</label>
|
|
94
94
|
<input value={backgroundColor} placeholder={"BackgroundColor"} className={"border-solid border"}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
onChange={(ele) => {
|
|
96
|
+
setBackgroundColor(ele.target.value)
|
|
97
|
+
}} /></div>
|
|
98
98
|
<div>
|
|
99
99
|
<label>Color:</label>
|
|
100
100
|
<input value={color} placeholder={"Color"} className={"border-solid border"} onChange={(ele) => {
|
|
101
101
|
setColor(ele.target.value)
|
|
102
|
-
}}/></div>
|
|
102
|
+
}} /></div>
|
|
103
103
|
<div>
|
|
104
104
|
<label>Appid:</label>
|
|
105
105
|
<input value={appid} placeholder={"Appid"} className={"border-solid border"} onChange={(ele) => {
|
|
106
106
|
setAppid(ele.target.value)
|
|
107
|
-
}}/></div>
|
|
107
|
+
}} /></div>
|
|
108
108
|
<div>
|
|
109
109
|
<label>AppSecret:</label>
|
|
110
110
|
<input value={appSecret} placeholder={"AppSecret"} className={"border-solid border"} onChange={(ele) => {
|
|
111
111
|
setAppSecret(ele.target.value)
|
|
112
|
-
}}/></div>
|
|
112
|
+
}} /></div>
|
|
113
113
|
<div>
|
|
114
114
|
<label>AuthEndpoint:</label>
|
|
115
115
|
<input value={endpoints?.auth || ''} placeholder={"Auth Endpoint"} className={"border-solid border"}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
onChange={(ele) => {
|
|
117
|
+
setEndpoints({ ...endpoints, auth: ele.target.value })
|
|
118
|
+
}} />
|
|
119
119
|
</div>
|
|
120
120
|
<div>
|
|
121
121
|
<label>BackEndpoint:</label>
|
|
122
122
|
<input value={endpoints?.back || ''} placeholder={"Back Endpoint"} className={"border-solid border"}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
onChange={(ele) => {
|
|
124
|
+
setEndpoints({ ...endpoints, back: ele.target.value })
|
|
125
|
+
}} />
|
|
126
126
|
</div>
|
|
127
127
|
<div>
|
|
128
128
|
<label>Locale:</label>
|
|
@@ -141,15 +141,15 @@ function RouterApp() {
|
|
|
141
141
|
</select>
|
|
142
142
|
</div>
|
|
143
143
|
</div>
|
|
144
|
-
<Nav/>
|
|
144
|
+
<Nav />
|
|
145
145
|
<div className={`p-4`}>
|
|
146
146
|
<Routes>
|
|
147
|
-
<Route path="/" element={<Home/>}/>
|
|
148
|
-
<Route path="/ui" element={<UI/>}/>
|
|
149
|
-
<Route path="/tgapp" element={<TgApp/>}/>
|
|
150
|
-
<Route element={<RoutePrivate/>}>
|
|
151
|
-
<Route path="/user" element={<User/>}/>
|
|
152
|
-
<Route path="/wallet" element={<Wallet/>}/>
|
|
147
|
+
<Route path="/" element={<Home />} />
|
|
148
|
+
<Route path="/ui" element={<UI />} />
|
|
149
|
+
<Route path="/tgapp" element={<TgApp />} />
|
|
150
|
+
<Route element={<RoutePrivate />}>
|
|
151
|
+
<Route path="/user" element={<User />} />
|
|
152
|
+
<Route path="/wallet" element={<Wallet />} />
|
|
153
153
|
</Route>
|
|
154
154
|
</Routes>
|
|
155
155
|
</div>
|
|
@@ -157,7 +157,7 @@ function RouterApp() {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
function App() {
|
|
160
|
-
const {appid, locale, endpoints, walletType, backgroundColor, color} = useLocalStore()
|
|
160
|
+
const { appid, locale, endpoints, walletType, backgroundColor, color } = useLocalStore()
|
|
161
161
|
|
|
162
162
|
return <div style={{
|
|
163
163
|
backgroundColor: backgroundColor,
|
|
@@ -165,7 +165,7 @@ function App() {
|
|
|
165
165
|
}}>
|
|
166
166
|
<WagmiProvider config={wagmiConfig}>
|
|
167
167
|
<MatchProvider
|
|
168
|
-
appid=
|
|
168
|
+
appid="MID-E53wKKWTqNzK7ccC"
|
|
169
169
|
endpoints={endpoints}
|
|
170
170
|
locale={locale}
|
|
171
171
|
events={{
|
|
@@ -180,7 +180,7 @@ function App() {
|
|
|
180
180
|
type: walletType
|
|
181
181
|
}}
|
|
182
182
|
>
|
|
183
|
-
<RouterApp/>
|
|
183
|
+
<RouterApp />
|
|
184
184
|
</MatchProvider>
|
|
185
185
|
</WagmiProvider>
|
|
186
186
|
</div>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {LoginMethodType, WalletType,RecommendLoginMethodType,OtherLoginMethodType} from "@matchain/matchid-sdk-react/types";
|
|
1
|
+
import { LoginMethodType, WalletType, RecommendLoginMethodType, OtherLoginMethodType } from "@matchain/matchid-sdk-react/types";
|
|
2
2
|
|
|
3
3
|
export const LoginMethod = [
|
|
4
4
|
"wallet",
|
|
@@ -10,11 +10,13 @@ export const LoginMethod = [
|
|
|
10
10
|
'twitter',
|
|
11
11
|
'google',
|
|
12
12
|
'telegram',
|
|
13
|
+
'email',
|
|
13
14
|
'github',
|
|
14
15
|
'discord',
|
|
15
16
|
'linkedin',
|
|
16
17
|
'facebook',
|
|
17
|
-
"youtube"
|
|
18
|
+
"youtube",
|
|
19
|
+
"kakao"
|
|
18
20
|
]
|
|
19
21
|
export const LocaleList = [
|
|
20
22
|
"en", "zh", "tw", "fr", "ja", "ko", "vi", "es", "pt"
|
|
@@ -23,12 +25,12 @@ export const LocaleList = [
|
|
|
23
25
|
export const CEXList = [
|
|
24
26
|
"Gate", "Coinbase", "Kucoin", 'Bitget', 'OKX', 'Bybit', 'Binance']
|
|
25
27
|
|
|
26
|
-
export const WalletList:WalletType[] = [
|
|
27
|
-
'btc', 'sol', 'evm', 'tron',"ton"
|
|
28
|
+
export const WalletList: WalletType[] = [
|
|
29
|
+
'btc', 'sol', 'evm', 'tron', "ton"
|
|
28
30
|
]
|
|
29
|
-
export const LoginMethodList
|
|
31
|
+
export const LoginMethodList: OtherLoginMethodType[] = ['twitter', 'discord', 'github', 'telegram', 'linkedin', 'facebook', 'youtube']
|
|
30
32
|
|
|
31
|
-
export const RecommendLoginMethodList:RecommendLoginMethodType[] = ["wallet","email","google"]
|
|
33
|
+
export const RecommendLoginMethodList: RecommendLoginMethodType[] = ["wallet", "email", "google"]
|
|
32
34
|
|
|
33
35
|
export const LOGIN_METHOD_MAP = {
|
|
34
36
|
email: 'Email',
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import {useMatch} from "@matchain/matchid-sdk-react";
|
|
2
|
-
import {useMemo} from "react";
|
|
1
|
+
import { useMatch } from "@matchain/matchid-sdk-react";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
3
|
function DisplayConfig({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
label:string,
|
|
8
|
-
value:any
|
|
9
|
-
}){
|
|
10
|
-
const RenderValue = useMemo(()=>{
|
|
4
|
+
label,
|
|
5
|
+
value
|
|
6
|
+
}: {
|
|
7
|
+
label: string,
|
|
8
|
+
value: any
|
|
9
|
+
}) {
|
|
10
|
+
const RenderValue = useMemo(() => {
|
|
11
11
|
const type = typeof value;
|
|
12
|
-
if(type === "object"){
|
|
12
|
+
if (type === "object") {
|
|
13
13
|
return JSON.stringify(value);
|
|
14
14
|
}
|
|
15
|
-
if(type==='function'){
|
|
15
|
+
if (type === 'function') {
|
|
16
16
|
return <span className={`text-green-500`}>function</span>
|
|
17
17
|
}
|
|
18
18
|
return value;
|
|
19
|
-
},[value])
|
|
19
|
+
}, [value])
|
|
20
20
|
|
|
21
21
|
return <div className={`grid grid-cols-12 gap-4`}>
|
|
22
22
|
<div className={`col-span-4 px-2`}>{label}</div>
|
|
23
23
|
<div className={`col-span-8 px-2 text-ellipsis`}>{RenderValue}</div>
|
|
24
24
|
</div>
|
|
25
25
|
}
|
|
26
|
-
export default function Home(){
|
|
26
|
+
export default function Home() {
|
|
27
27
|
const config = useMatch();
|
|
28
28
|
const keyList = Object.keys(config) as Array<keyof typeof config>;
|
|
29
29
|
return <div className={``}>
|
|
30
30
|
{
|
|
31
|
-
keyList.map((key)=>{
|
|
32
|
-
return <DisplayConfig key={key} label={key} value={config[key]}/>
|
|
31
|
+
keyList.map((key) => {
|
|
32
|
+
return <DisplayConfig key={key} label={key} value={config[key]} />
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {create} from 'zustand';
|
|
2
|
-
import {devtools, persist} from 'zustand/middleware';
|
|
3
|
-
import {LocaleType} from "@matchain/matchid-sdk-react/types";
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { devtools, persist } from 'zustand/middleware';
|
|
3
|
+
import { LocaleType } from "@matchain/matchid-sdk-react/types";
|
|
4
4
|
|
|
5
5
|
interface StoreState {
|
|
6
6
|
appid: string
|
|
@@ -9,10 +9,10 @@ interface StoreState {
|
|
|
9
9
|
auth: string;
|
|
10
10
|
}
|
|
11
11
|
locale: LocaleType;
|
|
12
|
-
walletType:"Base" | "UserPasscode";
|
|
12
|
+
walletType: "Base" | "UserPasscode";
|
|
13
13
|
setWalletType: (walletType: "Base" | "UserPasscode") => void;
|
|
14
|
-
color:string,
|
|
15
|
-
backgroundColor:string,
|
|
14
|
+
color: string,
|
|
15
|
+
backgroundColor: string,
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
setAppid: (appid: string) => void;
|
|
@@ -32,29 +32,29 @@ interface StoreState {
|
|
|
32
32
|
|
|
33
33
|
const persistedState = persist<StoreState>(
|
|
34
34
|
set => ({
|
|
35
|
-
appid: '',
|
|
35
|
+
appid: 'MID-E53wKKWTqNzK7ccC',
|
|
36
36
|
endpoints: {
|
|
37
|
-
back: "https://api.matchid.ai/",
|
|
38
|
-
auth: "https://
|
|
37
|
+
back: "https://api-test.matchid.ai/",
|
|
38
|
+
auth: "https://mid-sso-test.vercel.app/"
|
|
39
39
|
},
|
|
40
40
|
locale: 'en',
|
|
41
|
-
setAppid: (appid: string) => set({appid: appid}),
|
|
42
|
-
setEndpoints: (endpoints: StoreState['endpoints']) => set({endpoints}),
|
|
43
|
-
setLocale: (locale: LocaleType) => set({locale}),
|
|
41
|
+
setAppid: (appid: string) => set({ appid: appid }),
|
|
42
|
+
setEndpoints: (endpoints: StoreState['endpoints']) => set({ endpoints }),
|
|
43
|
+
setLocale: (locale: LocaleType) => set({ locale }),
|
|
44
44
|
walletType: "UserPasscode",
|
|
45
|
-
setWalletType: (walletType: "Base" | "UserPasscode") => set({walletType}),
|
|
45
|
+
setWalletType: (walletType: "Base" | "UserPasscode") => set({ walletType }),
|
|
46
46
|
color: '#000000',
|
|
47
|
-
setColor: (color: string) => set({color}),
|
|
47
|
+
setColor: (color: string) => set({ color }),
|
|
48
48
|
backgroundColor: '#ffffff',
|
|
49
|
-
setBackgroundColor: (backgroundColor: string) => set({backgroundColor}),
|
|
49
|
+
setBackgroundColor: (backgroundColor: string) => set({ backgroundColor }),
|
|
50
50
|
|
|
51
|
-
initChainId:1,
|
|
52
|
-
setInitChainId: (initChainId: number) => set({initChainId}),
|
|
51
|
+
initChainId: 1,
|
|
52
|
+
setInitChainId: (initChainId: number) => set({ initChainId }),
|
|
53
53
|
|
|
54
54
|
erc20Address: '',
|
|
55
|
-
setErc20Address: (erc20Address: string) => set({erc20Address})
|
|
55
|
+
setErc20Address: (erc20Address: string) => set({ erc20Address })
|
|
56
56
|
}),
|
|
57
|
-
{name: 'match-example-local'}
|
|
57
|
+
{ name: 'match-example-local' }
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
const useLocalStore = create(devtools(persistedState));
|