@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
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
unBindWalletApi,
|
|
10
10
|
useUserInfo,
|
|
11
11
|
verifyPohApi
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OVZZIJZP.mjs";
|
|
13
13
|
import {
|
|
14
14
|
__export
|
|
15
15
|
} from "./chunk-J5LGTIGS.mjs";
|
|
@@ -90,4 +90,4 @@ export {
|
|
|
90
90
|
user_exports,
|
|
91
91
|
api_exports
|
|
92
92
|
};
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-ZP4OU66T.mjs.map
|
package/dist/components/index.js
CHANGED
|
@@ -1973,7 +1973,8 @@ function useUserInfo() {
|
|
|
1973
1973
|
setOverview,
|
|
1974
1974
|
overview,
|
|
1975
1975
|
address,
|
|
1976
|
-
endpoints
|
|
1976
|
+
endpoints,
|
|
1977
|
+
locale
|
|
1977
1978
|
} = useLocalStore_default();
|
|
1978
1979
|
const { events, login } = useMatch();
|
|
1979
1980
|
const { open: SOLOpen } = useSOLModalStore();
|
|
@@ -2147,6 +2148,45 @@ function useUserInfo() {
|
|
|
2147
2148
|
const bindCex = (type) => {
|
|
2148
2149
|
return CEXBindOpen(type);
|
|
2149
2150
|
};
|
|
2151
|
+
const getAuthInfo = async (method) => {
|
|
2152
|
+
const element_id = "auth_iframe";
|
|
2153
|
+
if (document.getElementById(element_id)) {
|
|
2154
|
+
document.getElementById(element_id).remove();
|
|
2155
|
+
}
|
|
2156
|
+
const iframe = document.createElement("iframe");
|
|
2157
|
+
iframe.id = element_id;
|
|
2158
|
+
iframe.src = `${endpoints.auth}auth?appid=${appid}&method=${method}&locale=${locale}&token=${encodeURIComponent(encodeBase64(token))}`;
|
|
2159
|
+
iframe.style.width = "100vw";
|
|
2160
|
+
iframe.style.height = "100vh";
|
|
2161
|
+
iframe.style.position = "fixed";
|
|
2162
|
+
iframe.style.top = "0";
|
|
2163
|
+
iframe.style.left = "0";
|
|
2164
|
+
iframe.style.zIndex = "9999";
|
|
2165
|
+
iframe.style.border = "none";
|
|
2166
|
+
iframe.allowTransparency = "true";
|
|
2167
|
+
document.body.appendChild(iframe);
|
|
2168
|
+
return new Promise((resolve, reject) => {
|
|
2169
|
+
const authMessageHandle = (event) => {
|
|
2170
|
+
if (endpoints.auth.includes(event.origin)) {
|
|
2171
|
+
const res = event.data;
|
|
2172
|
+
if (res.source == "match-auth") {
|
|
2173
|
+
window.removeEventListener("message", authMessageHandle);
|
|
2174
|
+
if (res.status == "success") {
|
|
2175
|
+
resolve({
|
|
2176
|
+
...res.data,
|
|
2177
|
+
method: res.method,
|
|
2178
|
+
appid: res.appid
|
|
2179
|
+
});
|
|
2180
|
+
} else {
|
|
2181
|
+
reject(new Error(res.message));
|
|
2182
|
+
}
|
|
2183
|
+
iframe.remove();
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
};
|
|
2187
|
+
window.addEventListener("message", authMessageHandle);
|
|
2188
|
+
});
|
|
2189
|
+
};
|
|
2150
2190
|
return {
|
|
2151
2191
|
loginByMethod,
|
|
2152
2192
|
loginByTelegram,
|
|
@@ -2169,7 +2209,8 @@ function useUserInfo() {
|
|
|
2169
2209
|
username: overview?.username || "",
|
|
2170
2210
|
auth,
|
|
2171
2211
|
login: loginMethod,
|
|
2172
|
-
bind
|
|
2212
|
+
bind,
|
|
2213
|
+
getAuthInfo
|
|
2173
2214
|
};
|
|
2174
2215
|
}
|
|
2175
2216
|
|