@zkyc/evg 1.2.0 → 1.4.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.
Files changed (2) hide show
  1. package/index.js +6 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12,17 +12,17 @@
12
12
  * @param {Object} config - Configuration object containing API key and redirect URLs
13
13
  * @param {string} config.apiKey - Your zKYC API key (with test_ or prod_ prefix)
14
14
  * @param {string} config.userId - EVG users userId
15
- * @param {string} config.callback - URL to redirect if KYC verification fails
15
+ * @param {string} config.callbackUrl - URL to redirect if KYC verification fails
16
16
  * @param {string} [config.platformApiUrl] - Optional: Your platform API URL (defaults to production)
17
17
  * @returns {Promise<void>}
18
18
  * @throws {Error} if API key, failurePage, or pendingPage is missing
19
19
  * @throws {Error} if token generation fails
20
20
  */
21
21
  async function ZKYCProcess(config) {
22
- const { apiKey, callback, userId } = config;
22
+ const { apiKey, callbackUrl, userId } = config;
23
23
 
24
24
  // Validate required parameters
25
- if (!apiKey || !callback || !userId) {
25
+ if (!apiKey || !callbackUrl || !userId) {
26
26
  throw new Error("apiKey, callback, and userId are required");
27
27
  }
28
28
 
@@ -54,13 +54,13 @@ async function ZKYCProcess(config) {
54
54
 
55
55
  // Build SDK URL with token
56
56
  const sdkUrl = new URL("https://evg.zkyc.tech/");
57
- sdkUrl.searchParams.set("apikey", token); // SDK will detect it's a token
58
- sdkUrl.searchParams.set("callback", callback);
57
+ sdkUrl.searchParams.set("apiKey", token); // SDK will detect it's a token
59
58
  sdkUrl.searchParams.set("userId", userId);
59
+ sdkUrl.searchParams.set("callbackUrl", callbackUrl);
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
64
  openZKYCPopup(sdkUrl.toString())
65
65
  } else {
66
66
  throw new Error("ZKYCProcess can only be used in browser environment");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkyc/evg",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "zKYC SDK wrapper to generate tokens and redirect to KYC",
5
5
  "main": "index.js",
6
6
  "module": "index.js",