astra-sdk-web 1.1.28 → 1.1.29
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/astra-sdk.cjs.js +36 -16
- package/dist/astra-sdk.cjs.js.map +1 -1
- package/dist/astra-sdk.es.js +36 -16
- package/dist/astra-sdk.es.js.map +1 -1
- package/dist/components.cjs.js +36 -16
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +36 -16
- package/dist/components.es.js.map +1 -1
- package/package.json +1 -1
- package/src/pages/MobileRoute.tsx +36 -19
- package/src/pages/QRCodePage.tsx +11 -3
package/dist/astra-sdk.cjs.js
CHANGED
|
@@ -1975,25 +1975,39 @@ function MobileRoute({ onClose, onNavigate } = {}) {
|
|
|
1975
1975
|
const searchParams = new URLSearchParams(window.location.search);
|
|
1976
1976
|
const sessionId = searchParams.get("sessionId");
|
|
1977
1977
|
if (sessionId) {
|
|
1978
|
-
|
|
1979
|
-
|
|
1978
|
+
let apiBaseUrl = "";
|
|
1979
|
+
let serverKey = "";
|
|
1980
|
+
const encodedConfig = searchParams.get("config");
|
|
1981
|
+
if (encodedConfig) {
|
|
1982
|
+
try {
|
|
1983
|
+
const decodedConfig = JSON.parse(atob(encodedConfig));
|
|
1984
|
+
if (decodedConfig.apiBaseUrl && decodedConfig.serverKey) {
|
|
1985
|
+
apiBaseUrl = decodedConfig.apiBaseUrl;
|
|
1986
|
+
serverKey = decodedConfig.serverKey;
|
|
1987
|
+
}
|
|
1988
|
+
} catch (error) {
|
|
1989
|
+
console.error("Failed to decode config from URL:", error);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
if (!apiBaseUrl || !serverKey) {
|
|
1993
|
+
const storedConfig = getKycConfig(sessionId);
|
|
1994
|
+
if (storedConfig) {
|
|
1995
|
+
apiBaseUrl = storedConfig.apiBaseUrl;
|
|
1996
|
+
serverKey = storedConfig.serverKey;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
if (!apiBaseUrl || !serverKey) {
|
|
2000
|
+
apiBaseUrl = searchParams.get("apiBaseUrl") || searchParams.get("apiUrl") || "";
|
|
2001
|
+
serverKey = searchParams.get("serverKey") || "";
|
|
2002
|
+
}
|
|
2003
|
+
if (apiBaseUrl && serverKey) {
|
|
1980
2004
|
setConfig({
|
|
1981
|
-
apiBaseUrl
|
|
2005
|
+
apiBaseUrl,
|
|
1982
2006
|
sessionId,
|
|
1983
|
-
serverKey
|
|
2007
|
+
serverKey
|
|
1984
2008
|
});
|
|
1985
2009
|
} else {
|
|
1986
|
-
|
|
1987
|
-
const serverKey = searchParams.get("serverKey") || "";
|
|
1988
|
-
if (apiBaseUrl && serverKey) {
|
|
1989
|
-
setConfig({
|
|
1990
|
-
apiBaseUrl,
|
|
1991
|
-
sessionId,
|
|
1992
|
-
serverKey
|
|
1993
|
-
});
|
|
1994
|
-
} else {
|
|
1995
|
-
console.error("Missing required parameters: apiBaseUrl and serverKey not found in localStorage or URL");
|
|
1996
|
-
}
|
|
2010
|
+
console.error("Missing required parameters: apiBaseUrl and serverKey not found in URL config, localStorage, or URL params");
|
|
1997
2011
|
}
|
|
1998
2012
|
} else {
|
|
1999
2013
|
console.error("Missing required parameter: sessionId must be in URL");
|
|
@@ -2038,7 +2052,13 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk.astraprotocol.co
|
|
|
2038
2052
|
if (sessionId && apiBaseUrl && serverKey) {
|
|
2039
2053
|
storeKycConfig(sessionId, apiBaseUrl, serverKey);
|
|
2040
2054
|
}
|
|
2041
|
-
if (sessionId) {
|
|
2055
|
+
if (sessionId && apiBaseUrl && serverKey) {
|
|
2056
|
+
const mobileRoute = "/mobileroute";
|
|
2057
|
+
const config = JSON.stringify({ apiBaseUrl, serverKey });
|
|
2058
|
+
const encodedConfig = btoa(config);
|
|
2059
|
+
const fullUrl = `${mobileBaseUrl}${mobileRoute}?sessionId=${sessionId}&config=${encodedConfig}`;
|
|
2060
|
+
setQrUrl(fullUrl);
|
|
2061
|
+
} else if (sessionId) {
|
|
2042
2062
|
const mobileRoute = "/mobileroute";
|
|
2043
2063
|
const fullUrl = `${mobileBaseUrl}${mobileRoute}?sessionId=${sessionId}`;
|
|
2044
2064
|
setQrUrl(fullUrl);
|