@matchain/matchid-sdk-react 0.1.41 → 0.1.42-alpha.0
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/{chunk-RYZFW6P6.mjs → chunk-OVZZIJZP.mjs} +44 -3
- package/dist/chunk-OVZZIJZP.mjs.map +1 -0
- package/dist/{chunk-B2HVAJPQ.mjs → chunk-ZP4OU66T.mjs} +2 -2
- package/dist/components/index.js +43 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/api/index.js +43 -2
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +2 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +43 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/{index-DoF5jRoi.d.ts → index-Blx4Nrwm.d.ts} +18 -0
- package/dist/{index-fl6SNIZC.d.mts → index-C1uG-2K1.d.mts} +18 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +43 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/example/src/config/index.ts +19 -1
- package/example/src/pages/User.tsx +27 -3
- package/package.json +1 -1
- package/dist/chunk-RYZFW6P6.mjs.map +0 -1
- /package/dist/{chunk-B2HVAJPQ.mjs.map → chunk-ZP4OU66T.mjs.map} +0 -0
|
@@ -3873,7 +3873,8 @@ function useUserInfo() {
|
|
|
3873
3873
|
setOverview,
|
|
3874
3874
|
overview,
|
|
3875
3875
|
address,
|
|
3876
|
-
endpoints
|
|
3876
|
+
endpoints,
|
|
3877
|
+
locale
|
|
3877
3878
|
} = useLocalStore_default();
|
|
3878
3879
|
const { events, login } = useMatch();
|
|
3879
3880
|
const { open: SOLOpen } = useSOLModalStore();
|
|
@@ -4047,6 +4048,45 @@ function useUserInfo() {
|
|
|
4047
4048
|
const bindCex = (type) => {
|
|
4048
4049
|
return CEXBindOpen(type);
|
|
4049
4050
|
};
|
|
4051
|
+
const getAuthInfo = async (method) => {
|
|
4052
|
+
const element_id = "auth_iframe";
|
|
4053
|
+
if (document.getElementById(element_id)) {
|
|
4054
|
+
document.getElementById(element_id).remove();
|
|
4055
|
+
}
|
|
4056
|
+
const iframe = document.createElement("iframe");
|
|
4057
|
+
iframe.id = element_id;
|
|
4058
|
+
iframe.src = `${endpoints.auth}auth?appid=${appid}&method=${method}&locale=${locale}&token=${encodeURIComponent(encodeBase64(token))}`;
|
|
4059
|
+
iframe.style.width = "100vw";
|
|
4060
|
+
iframe.style.height = "100vh";
|
|
4061
|
+
iframe.style.position = "fixed";
|
|
4062
|
+
iframe.style.top = "0";
|
|
4063
|
+
iframe.style.left = "0";
|
|
4064
|
+
iframe.style.zIndex = "9999";
|
|
4065
|
+
iframe.style.border = "none";
|
|
4066
|
+
iframe.allowTransparency = "true";
|
|
4067
|
+
document.body.appendChild(iframe);
|
|
4068
|
+
return new Promise((resolve, reject) => {
|
|
4069
|
+
const authMessageHandle = (event) => {
|
|
4070
|
+
if (endpoints.auth.includes(event.origin)) {
|
|
4071
|
+
const res = event.data;
|
|
4072
|
+
if (res.source == "match-auth") {
|
|
4073
|
+
window.removeEventListener("message", authMessageHandle);
|
|
4074
|
+
if (res.status == "success") {
|
|
4075
|
+
resolve({
|
|
4076
|
+
...res.data,
|
|
4077
|
+
method: res.method,
|
|
4078
|
+
appid: res.appid
|
|
4079
|
+
});
|
|
4080
|
+
} else {
|
|
4081
|
+
reject(new Error(res.message));
|
|
4082
|
+
}
|
|
4083
|
+
iframe.remove();
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
};
|
|
4087
|
+
window.addEventListener("message", authMessageHandle);
|
|
4088
|
+
});
|
|
4089
|
+
};
|
|
4050
4090
|
return {
|
|
4051
4091
|
loginByMethod,
|
|
4052
4092
|
loginByTelegram,
|
|
@@ -4069,7 +4109,8 @@ function useUserInfo() {
|
|
|
4069
4109
|
username: overview?.username || "",
|
|
4070
4110
|
auth,
|
|
4071
4111
|
login: loginMethod,
|
|
4072
|
-
bind
|
|
4112
|
+
bind,
|
|
4113
|
+
getAuthInfo
|
|
4073
4114
|
};
|
|
4074
4115
|
}
|
|
4075
4116
|
|
|
@@ -4152,4 +4193,4 @@ export {
|
|
|
4152
4193
|
MatchProvider,
|
|
4153
4194
|
useMatch
|
|
4154
4195
|
};
|
|
4155
|
-
//# sourceMappingURL=chunk-
|
|
4196
|
+
//# sourceMappingURL=chunk-OVZZIJZP.mjs.map
|