@zkyc/evg 1.1.0 → 1.3.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/index.js +26 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -60,7 +60,8 @@ async function ZKYCProcess(config) {
|
|
|
60
60
|
|
|
61
61
|
// Redirect to SDK
|
|
62
62
|
if (typeof window !== "undefined") {
|
|
63
|
-
window.location.assign(sdkUrl.toString());
|
|
63
|
+
// window.location.assign(sdkUrl.toString());
|
|
64
|
+
openZKYCPopup(sdkUrl.toString())
|
|
64
65
|
} else {
|
|
65
66
|
throw new Error("ZKYCProcess can only be used in browser environment");
|
|
66
67
|
}
|
|
@@ -71,6 +72,30 @@ async function ZKYCProcess(config) {
|
|
|
71
72
|
throw new Error("ZKYC Process failed: Unknown error");
|
|
72
73
|
}
|
|
73
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Opens centered popup like "Continue with Google"
|
|
77
|
+
*/
|
|
78
|
+
function openZKYCPopup(url) {
|
|
79
|
+
const width = 500;
|
|
80
|
+
const height = 650;
|
|
81
|
+
|
|
82
|
+
const left = window.screenX + (window.outerWidth - width) / 2;
|
|
83
|
+
const top = window.screenY + (window.outerHeight - height) / 2;
|
|
84
|
+
|
|
85
|
+
const popup = window.open(
|
|
86
|
+
url,
|
|
87
|
+
"ZKYC_Popup",
|
|
88
|
+
`width=${width},height=${height},left=${left},top=${top},
|
|
89
|
+
resizable=yes,scrollbars=yes,toolbar=no,menubar=no,status=no`
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
if (!popup) {
|
|
93
|
+
throw new Error("Popup blocked. Please allow popups.");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
popup.focus();
|
|
97
|
+
}
|
|
98
|
+
|
|
74
99
|
|
|
75
100
|
// ES Module exports (for modern bundlers and browsers)
|
|
76
101
|
export default ZKYCProcess;
|