astra-sdk-web 1.1.4 → 1.1.5
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 +70 -4
- package/dist/astra-sdk.cjs.js.map +1 -1
- package/dist/astra-sdk.css +18 -0
- package/dist/astra-sdk.css.map +1 -1
- package/dist/astra-sdk.es.js +70 -4
- package/dist/astra-sdk.es.js.map +1 -1
- package/dist/components.cjs.js +70 -4
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.css +18 -0
- package/dist/components.css.map +1 -1
- package/dist/components.es.js +70 -4
- package/dist/components.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/KycFlow.tsx +2 -0
- package/src/pages/FaceScanModal.tsx +30 -0
- package/src/pages/MobileRoute.tsx +64 -2
- package/src/pages/QRCodePage.tsx +11 -3
package/dist/components.cjs.js
CHANGED
|
@@ -1223,6 +1223,29 @@ function FaceScanModal({ onComplete }) {
|
|
|
1223
1223
|
React.useEffect(() => {
|
|
1224
1224
|
setState((prev) => ({ ...prev, cameraReady }));
|
|
1225
1225
|
}, [cameraReady, setState]);
|
|
1226
|
+
React.useEffect(() => {
|
|
1227
|
+
if (cameraReady && apiService) {
|
|
1228
|
+
const config = apiService.getConfig();
|
|
1229
|
+
if (config) {
|
|
1230
|
+
console.log("=== Camera Opened ===");
|
|
1231
|
+
console.log("Session ID:", config.sessionId);
|
|
1232
|
+
console.log("Server Key:", config.serverKey);
|
|
1233
|
+
console.log("API Base URL:", config.apiBaseUrl);
|
|
1234
|
+
console.log("Device Type:", config.deviceType || "auto-detected");
|
|
1235
|
+
apiService.getSessionStatus().then((statusResponse) => {
|
|
1236
|
+
console.log("=== Session Status API Response ===");
|
|
1237
|
+
console.log("Full Response:", statusResponse);
|
|
1238
|
+
console.log("Session Status:", statusResponse.data?.status);
|
|
1239
|
+
console.log("Session ID:", statusResponse.data?.session_id);
|
|
1240
|
+
console.log("Completed Steps:", statusResponse.data?.completed_steps);
|
|
1241
|
+
console.log("Next Step:", statusResponse.data?.next_step);
|
|
1242
|
+
}).catch((error) => {
|
|
1243
|
+
console.error("=== Session Status API Error ===");
|
|
1244
|
+
console.error("Error fetching session status:", error);
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}, [cameraReady, apiService]);
|
|
1226
1249
|
const handleRetry = () => {
|
|
1227
1250
|
stopCamera();
|
|
1228
1251
|
setState({
|
|
@@ -1325,12 +1348,29 @@ function FaceScanModal({ onComplete }) {
|
|
|
1325
1348
|
] }) });
|
|
1326
1349
|
}
|
|
1327
1350
|
var FaceScanModal_default = FaceScanModal;
|
|
1351
|
+
function MobileRouteContent({ onClose, onComplete }) {
|
|
1352
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FaceScanModal_default, { onClose, onComplete });
|
|
1353
|
+
}
|
|
1328
1354
|
function MobileRoute({ onClose, onNavigate } = {}) {
|
|
1355
|
+
const [config, setConfig] = React.useState(null);
|
|
1329
1356
|
React.useEffect(() => {
|
|
1330
1357
|
if (!isMobileDevice() && onNavigate) {
|
|
1331
1358
|
onNavigate("qr");
|
|
1332
1359
|
return;
|
|
1333
1360
|
}
|
|
1361
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
1362
|
+
const sessionId = searchParams.get("sessionId");
|
|
1363
|
+
const apiBaseUrl = searchParams.get("apiBaseUrl") || searchParams.get("apiUrl") || "";
|
|
1364
|
+
const serverKey = searchParams.get("serverKey") || "";
|
|
1365
|
+
if (sessionId && apiBaseUrl && serverKey) {
|
|
1366
|
+
setConfig({
|
|
1367
|
+
apiBaseUrl,
|
|
1368
|
+
sessionId,
|
|
1369
|
+
serverKey
|
|
1370
|
+
});
|
|
1371
|
+
} else if (sessionId) {
|
|
1372
|
+
console.error("Missing required parameters: apiBaseUrl and serverKey must be in URL");
|
|
1373
|
+
}
|
|
1334
1374
|
}, [onNavigate]);
|
|
1335
1375
|
const handleClose = () => {
|
|
1336
1376
|
if (onClose) {
|
|
@@ -1343,10 +1383,28 @@ function MobileRoute({ onClose, onNavigate } = {}) {
|
|
|
1343
1383
|
if (!isMobileDevice()) {
|
|
1344
1384
|
return null;
|
|
1345
1385
|
}
|
|
1346
|
-
|
|
1386
|
+
if (config) {
|
|
1387
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1388
|
+
KycProvider,
|
|
1389
|
+
{
|
|
1390
|
+
apiBaseUrl: config.apiBaseUrl,
|
|
1391
|
+
sessionId: config.sessionId,
|
|
1392
|
+
serverKey: config.serverKey,
|
|
1393
|
+
deviceType: "mobile",
|
|
1394
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MobileRouteContent, { onClose: handleClose, onComplete: handleComplete })
|
|
1395
|
+
}
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1398
|
+
if (onNavigate) {
|
|
1399
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MobileRouteContent, { onClose: handleClose, onComplete: handleComplete });
|
|
1400
|
+
}
|
|
1401
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed inset-0 flex items-center justify-center bg-black/50 z-[1000]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white p-6 rounded-lg text-center max-w-md mx-4", children: [
|
|
1402
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-red-600 mb-2", children: "Missing Configuration" }),
|
|
1403
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-600", children: "Please ensure the URL includes sessionId, apiBaseUrl, and serverKey parameters." })
|
|
1404
|
+
] }) });
|
|
1347
1405
|
}
|
|
1348
1406
|
var MobileRoute_default = MobileRoute;
|
|
1349
|
-
function QRCodePage({ onClose, onNavigate, mobileBaseUrl = "https://astra-sdk-rebuild.vercel.app", sessionId } = {}) {
|
|
1407
|
+
function QRCodePage({ onClose, onNavigate, mobileBaseUrl = "https://astra-sdk-rebuild.vercel.app", sessionId, apiBaseUrl, serverKey } = {}) {
|
|
1350
1408
|
const [qrUrl, setQrUrl] = React.useState("");
|
|
1351
1409
|
const [copied, setCopied] = React.useState(false);
|
|
1352
1410
|
React.useEffect(() => {
|
|
@@ -1354,11 +1412,17 @@ function QRCodePage({ onClose, onNavigate, mobileBaseUrl = "https://astra-sdk-re
|
|
|
1354
1412
|
if (sessionId) {
|
|
1355
1413
|
searchParams.set("sessionId", sessionId);
|
|
1356
1414
|
}
|
|
1415
|
+
if (apiBaseUrl) {
|
|
1416
|
+
searchParams.set("apiBaseUrl", apiBaseUrl);
|
|
1417
|
+
}
|
|
1418
|
+
if (serverKey) {
|
|
1419
|
+
searchParams.set("serverKey", serverKey);
|
|
1420
|
+
}
|
|
1357
1421
|
const mobileRoute = "/mobileroute";
|
|
1358
1422
|
const queryString = searchParams.toString();
|
|
1359
1423
|
const fullUrl = `${mobileBaseUrl}${mobileRoute}${queryString ? `?${queryString}` : ""}`;
|
|
1360
1424
|
setQrUrl(fullUrl);
|
|
1361
|
-
}, [mobileBaseUrl, sessionId]);
|
|
1425
|
+
}, [mobileBaseUrl, sessionId, apiBaseUrl, serverKey]);
|
|
1362
1426
|
const handleCopyUrl = async () => {
|
|
1363
1427
|
if (qrUrl) {
|
|
1364
1428
|
try {
|
|
@@ -1473,7 +1537,9 @@ var KycFlow = ({
|
|
|
1473
1537
|
onClose: handleClose,
|
|
1474
1538
|
onNavigate: handleNavigate,
|
|
1475
1539
|
mobileBaseUrl,
|
|
1476
|
-
sessionId
|
|
1540
|
+
sessionId,
|
|
1541
|
+
apiBaseUrl,
|
|
1542
|
+
serverKey
|
|
1477
1543
|
}
|
|
1478
1544
|
) : /* @__PURE__ */ jsxRuntime.jsx(MobileRoute_default, { onClose: handleClose, onNavigate: handleNavigate })
|
|
1479
1545
|
}
|