@matchain/matchid-sdk-react 0.1.28 → 0.1.30
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 +163 -29
- package/dist/index.d.mts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +414 -271
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +420 -277
- package/dist/index.mjs.map +1 -1
- package/example/src/App.tsx +20 -15
- package/example/src/components/Login/index.tsx +12 -4
- package/example/src/pages/User.tsx +5 -4
- package/package.json +1 -1
package/example/src/App.tsx
CHANGED
|
@@ -34,21 +34,26 @@ function App() {
|
|
|
34
34
|
}}
|
|
35
35
|
>
|
|
36
36
|
<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
|
-
|
|
37
|
+
<div className={`mb-2 p-2 flex gap-2 flex-col`}>
|
|
38
|
+
<div>
|
|
39
|
+
<label>Appid:</label>
|
|
40
|
+
<input value={appid} placeholder={"Appid"} className={"border-solid border"} onChange={(ele) => {
|
|
41
|
+
setAppid(ele.target.value)
|
|
42
|
+
}}/></div>
|
|
43
|
+
<div>
|
|
44
|
+
<label>AuthEndpoint:</label>
|
|
45
|
+
<input value={endpoints?.auth || ''} placeholder={"Auth Endpoint"} className={"border-solid border"}
|
|
46
|
+
onChange={(ele) => {
|
|
47
|
+
setEndpoints({...endpoints, auth: ele.target.value})
|
|
48
|
+
}}/>
|
|
49
|
+
</div>
|
|
50
|
+
<div>
|
|
51
|
+
<label>BackEndpoint:</label>
|
|
52
|
+
<input value={endpoints?.back || ''} placeholder={"Back Endpoint"} className={"border-solid border"}
|
|
53
|
+
onChange={(ele) => {
|
|
54
|
+
setEndpoints({...endpoints, back: ele.target.value})
|
|
55
|
+
}}/>
|
|
56
|
+
</div>
|
|
52
57
|
</div>
|
|
53
58
|
<nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10`}>
|
|
54
59
|
<Link to="/">Home</Link>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {Hooks,Components} from "@matchain/matchid-sdk-react";
|
|
3
3
|
import {LoginMethod} from "@/config";
|
|
4
|
+
import {LoginMethodType} from "../../../../src/types/types";
|
|
4
5
|
const { useUserInfo} = Hooks
|
|
5
6
|
const {EmailModal,LoginModal,LoginBox,LoginPanel} = Components
|
|
6
7
|
export default function Login(){
|
|
@@ -17,7 +18,7 @@ export default function Login(){
|
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
20
|
<div className={`flex flex-col gap-10`}>
|
|
20
|
-
<div className={`flex gap-5`}>
|
|
21
|
+
<div className={`flex gap-5 flex-wrap`}>
|
|
21
22
|
<button className={`bg-gray-300 p-1 rounded`}
|
|
22
23
|
onClick={() => setLoginOpen(true)}>Open Modal
|
|
23
24
|
</button>
|
|
@@ -27,7 +28,7 @@ export default function Login(){
|
|
|
27
28
|
{
|
|
28
29
|
LoginMethod.map((method) => {
|
|
29
30
|
return <button key={method} className={`bg-gray-300 p-1 capitalize rounded`}
|
|
30
|
-
onClick={() => login(method)}>{method}
|
|
31
|
+
onClick={() => login(method as LoginMethodType)}>{method}
|
|
31
32
|
</button>
|
|
32
33
|
})
|
|
33
34
|
}
|
|
@@ -37,7 +38,14 @@ export default function Login(){
|
|
|
37
38
|
}}/>
|
|
38
39
|
|
|
39
40
|
|
|
40
|
-
<LoginModal isOpen={loginOpen} onClose={() => setLoginOpen(false)}
|
|
41
|
+
<LoginModal isOpen={loginOpen} onClose={() => setLoginOpen(false)} methods={[
|
|
42
|
+
'telegram',
|
|
43
|
+
'twitter',
|
|
44
|
+
'discord',
|
|
45
|
+
'github',
|
|
46
|
+
'facebook',
|
|
47
|
+
'linkedin'
|
|
48
|
+
]}/>
|
|
41
49
|
|
|
42
50
|
</div>
|
|
43
51
|
<div className={`flex gap-5`}>
|
|
@@ -61,7 +69,7 @@ export default function Login(){
|
|
|
61
69
|
</div>
|
|
62
70
|
<div className={`font-bold text-lg`}>LoginPanel</div>
|
|
63
71
|
<div className={`bg-gray-100 p-10`}>
|
|
64
|
-
<div className={`bg-white`}><LoginPanel onClose={() => console.log('onLoginPanelClose')} methods={['discord','github','facebook','
|
|
72
|
+
<div className={`bg-white`}><LoginPanel onClose={() => console.log('onLoginPanelClose')} methods={['telegram','twitter','discord','github','facebook','linkedin']}/></div>
|
|
65
73
|
</div>
|
|
66
74
|
</div>
|
|
67
75
|
);
|
|
@@ -2,6 +2,7 @@ import {Hooks, Components, Api} from "@matchain/matchid-sdk-react"
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import RoutePrivate from "../components/RoutePrivate";
|
|
4
4
|
import {LoginMethod} from "@/config";
|
|
5
|
+
import {LoginMethodType} from "../../../src/types/types";
|
|
5
6
|
|
|
6
7
|
const {useMatchEvents, useUserInfo, useWallet} = Hooks
|
|
7
8
|
const {
|
|
@@ -26,7 +27,7 @@ function QueryDisplay(
|
|
|
26
27
|
{keys.map((key) => {
|
|
27
28
|
return <div key={key} className={`flex gap-[20px]`}>
|
|
28
29
|
<div className={"w-[200px]"}>{key}</div>
|
|
29
|
-
<div className={`flex-1`}>{
|
|
30
|
+
<div className={`flex-1 flex-wrap break-all`}>{
|
|
30
31
|
typeof query[key] === 'function' ? <Button size="sm" onClick={() => {
|
|
31
32
|
query[key]()
|
|
32
33
|
}}>Run</Button> :
|
|
@@ -95,12 +96,12 @@ function LoginContent() {
|
|
|
95
96
|
setPasswordOpen(false)
|
|
96
97
|
}}/>
|
|
97
98
|
</div>
|
|
98
|
-
<div className={`flex gap-[20px]`}>
|
|
99
|
+
<div className={`flex gap-[20px] flex-wrap`}>
|
|
99
100
|
|
|
100
101
|
{
|
|
101
102
|
LoginMethod.map((method) => {
|
|
102
103
|
return <button key={method} className={`bg-gray-300 p-1 capitalize rounded`}
|
|
103
|
-
onClick={() => bind(method)}>Bind {method}
|
|
104
|
+
onClick={() => bind(method as LoginMethodType)}>Bind {method}
|
|
104
105
|
</button>
|
|
105
106
|
})
|
|
106
107
|
}
|
|
@@ -140,7 +141,7 @@ export default function User() {
|
|
|
140
141
|
<div className={`font-bold text-lg`}>LoginButton</div>
|
|
141
142
|
|
|
142
143
|
<div className={`bg-gray-100 p-5 mt-5`}>
|
|
143
|
-
<LoginButton methods={["
|
|
144
|
+
<LoginButton methods={[ "twitter", 'facebook',"discord","github","linkedin","telegram"]} popoverPosition={"left"}/>
|
|
144
145
|
</div>
|
|
145
146
|
<RoutePrivate>
|
|
146
147
|
<LoginContent/>
|