@matchain/matchid-sdk-react 0.1.41 → 0.1.42-alpha.1
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-SBOIXOAW.mjs} +45 -3
- package/dist/chunk-SBOIXOAW.mjs.map +1 -0
- package/dist/{chunk-B2HVAJPQ.mjs → chunk-U5KWO2YJ.mjs} +2 -2
- package/dist/components/index.js +44 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/api/index.js +44 -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 +44 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/{index-DoF5jRoi.d.ts → index-BrdP6eg5.d.ts} +18 -0
- package/dist/{index-fl6SNIZC.d.mts → index-D7bNSBwl.d.mts} +18 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +44 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- 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-U5KWO2YJ.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,46 @@ 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
|
+
did
|
|
4080
|
+
});
|
|
4081
|
+
} else {
|
|
4082
|
+
reject(new Error(res.message));
|
|
4083
|
+
}
|
|
4084
|
+
iframe.remove();
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
};
|
|
4088
|
+
window.addEventListener("message", authMessageHandle);
|
|
4089
|
+
});
|
|
4090
|
+
};
|
|
4050
4091
|
return {
|
|
4051
4092
|
loginByMethod,
|
|
4052
4093
|
loginByTelegram,
|
|
@@ -4069,7 +4110,8 @@ function useUserInfo() {
|
|
|
4069
4110
|
username: overview?.username || "",
|
|
4070
4111
|
auth,
|
|
4071
4112
|
login: loginMethod,
|
|
4072
|
-
bind
|
|
4113
|
+
bind,
|
|
4114
|
+
getAuthInfo
|
|
4073
4115
|
};
|
|
4074
4116
|
}
|
|
4075
4117
|
|
|
@@ -4152,4 +4194,4 @@ export {
|
|
|
4152
4194
|
MatchProvider,
|
|
4153
4195
|
useMatch
|
|
4154
4196
|
};
|
|
4155
|
-
//# sourceMappingURL=chunk-
|
|
4197
|
+
//# sourceMappingURL=chunk-SBOIXOAW.mjs.map
|