vesant-sdk 1.7.2 → 1.8.0-dev.00f6233
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/README.md +3 -3
- package/dist/{client-B3DCAHlg.d.ts → client-BPALLldd.d.ts} +2 -2
- package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
- package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
- package/dist/{client-D23KhWeh.d.mts → client-_OhkfnyJ.d.mts} +2 -2
- package/dist/compliance/index.d.mts +3 -3
- package/dist/compliance/index.d.ts +3 -3
- package/dist/compliance/index.js +66 -11
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +66 -11
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +8 -7
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +8 -7
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +2 -2
- package/dist/geolocation/index.d.ts +2 -2
- package/dist/geolocation/index.js +47 -8
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +47 -8
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/{index-DSDgS09k.d.ts → index-BosFSGan.d.ts} +57 -2
- package/dist/{index-C3zUKydT.d.mts → index-C49a7fg2.d.mts} +57 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +104 -169
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -170
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +2 -2
- package/dist/kyc/core.d.ts +2 -2
- package/dist/kyc/core.js +39 -165
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +38 -166
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +219 -218
- package/dist/kyc/index.d.ts +219 -218
- package/dist/kyc/index.js +39 -165
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +38 -166
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +24 -115
- package/dist/react.d.ts +24 -115
- package/dist/react.js +23 -196
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +24 -194
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +16 -6
- package/dist/risk-profile/index.d.ts +16 -6
- package/dist/risk-profile/index.js +26 -9
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +26 -10
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +8 -7
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +8 -7
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +1 -1
- package/dist/tax/index.d.ts +1 -1
- package/dist/tax/index.js +8 -7
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +8 -7
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-BOFaMQxI.d.mts → types-DbvVph_0.d.mts} +45 -2
- package/dist/{types-UGyDl1fd.d.ts → types-qXamJr2q.d.ts} +45 -2
- package/dist/webhooks/index.d.mts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js +6 -0
- package/dist/webhooks/index.js.map +1 -1
- package/dist/webhooks/index.mjs +6 -1
- package/dist/webhooks/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
4
4
|
// src/geolocation/hooks.ts
|
|
5
5
|
|
|
6
6
|
// src/core/version.ts
|
|
7
|
-
var SDK_VERSION = "1.
|
|
7
|
+
var SDK_VERSION = "1.8.0";
|
|
8
8
|
|
|
9
9
|
// src/core/errors.ts
|
|
10
10
|
var VesantError = class _VesantError extends Error {
|
|
@@ -423,14 +423,11 @@ function useCipherText(client) {
|
|
|
423
423
|
const [configLoading, setConfigLoading] = useState(!!client);
|
|
424
424
|
const [configError, setConfigError] = useState(null);
|
|
425
425
|
const configRef = useRef(void 0);
|
|
426
|
-
const configPromiseRef = useRef(null);
|
|
427
426
|
useEffect(() => {
|
|
428
427
|
if (!client) return;
|
|
429
428
|
let cancelled = false;
|
|
430
429
|
setConfigLoading(true);
|
|
431
|
-
|
|
432
|
-
configPromiseRef.current = promise;
|
|
433
|
-
promise.then((cfg) => {
|
|
430
|
+
client.getGPSConfig().then((cfg) => {
|
|
434
431
|
if (!cancelled) {
|
|
435
432
|
configRef.current = cfg;
|
|
436
433
|
setConfigLoading(false);
|
|
@@ -445,13 +442,21 @@ function useCipherText(client) {
|
|
|
445
442
|
cancelled = true;
|
|
446
443
|
};
|
|
447
444
|
}, [client]);
|
|
445
|
+
const refreshConfig = useCallback(async () => {
|
|
446
|
+
if (!client) return;
|
|
447
|
+
try {
|
|
448
|
+
configRef.current = await client.refreshGPSConfig();
|
|
449
|
+
setConfigError(null);
|
|
450
|
+
} catch (error) {
|
|
451
|
+
setConfigError(error instanceof Error ? error : new Error("Failed to refresh GPS config"));
|
|
452
|
+
}
|
|
453
|
+
}, [client]);
|
|
448
454
|
const generate = useCallback(
|
|
449
455
|
async (options) => {
|
|
450
456
|
try {
|
|
451
|
-
if (
|
|
457
|
+
if (client) {
|
|
452
458
|
try {
|
|
453
|
-
|
|
454
|
-
configRef.current = cfg;
|
|
459
|
+
configRef.current = await client.getGPSConfig();
|
|
455
460
|
} catch {
|
|
456
461
|
}
|
|
457
462
|
}
|
|
@@ -461,9 +466,9 @@ function useCipherText(client) {
|
|
|
461
466
|
return null;
|
|
462
467
|
}
|
|
463
468
|
},
|
|
464
|
-
[]
|
|
469
|
+
[client]
|
|
465
470
|
);
|
|
466
|
-
return { generate, configLoading, configError };
|
|
471
|
+
return { generate, refreshConfig, configLoading, configError };
|
|
467
472
|
}
|
|
468
473
|
function useLocationRequests(client, options = {}) {
|
|
469
474
|
const [requests, setRequests] = useState([]);
|
|
@@ -860,6 +865,13 @@ function useTransactionVerification(client, options = {}) {
|
|
|
860
865
|
verifyTransaction
|
|
861
866
|
};
|
|
862
867
|
}
|
|
868
|
+
|
|
869
|
+
// src/risk-profile/types.ts
|
|
870
|
+
function isProfileUpdateHeld(result) {
|
|
871
|
+
return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
// src/risk-profile/hooks.ts
|
|
863
875
|
function useCustomerProfile(client, customerId, options = {}) {
|
|
864
876
|
const [profile, setProfile] = useState(null);
|
|
865
877
|
const [loading, setLoading] = useState(false);
|
|
@@ -888,7 +900,7 @@ function useCustomerProfile(client, customerId, options = {}) {
|
|
|
888
900
|
setError(null);
|
|
889
901
|
try {
|
|
890
902
|
const updated = await client.updateProfile(profileRef.current.id, updates);
|
|
891
|
-
setProfile(updated);
|
|
903
|
+
setProfile(isProfileUpdateHeld(updated) ? updated.profile : updated);
|
|
892
904
|
return updated;
|
|
893
905
|
} catch (err) {
|
|
894
906
|
const error2 = err instanceof Error ? err : new Error("Failed to update profile");
|
|
@@ -2088,81 +2100,6 @@ function useKycSubmission(client, options = {}) {
|
|
|
2088
2100
|
reset
|
|
2089
2101
|
};
|
|
2090
2102
|
}
|
|
2091
|
-
function useKycRequests(client, options = {}) {
|
|
2092
|
-
const [requests, setRequests] = useState([]);
|
|
2093
|
-
const [pagination, setPagination] = useState(null);
|
|
2094
|
-
const [loading, setLoading] = useState(false);
|
|
2095
|
-
const [error, setError] = useState(null);
|
|
2096
|
-
const fetchRequests = useCallback(
|
|
2097
|
-
async (filters, paginationParams) => {
|
|
2098
|
-
setLoading(true);
|
|
2099
|
-
setError(null);
|
|
2100
|
-
try {
|
|
2101
|
-
const result = await client.listKycRequests(
|
|
2102
|
-
filters || options.filters,
|
|
2103
|
-
paginationParams || options.pagination
|
|
2104
|
-
);
|
|
2105
|
-
setRequests(result.data);
|
|
2106
|
-
setPagination(result.pagination);
|
|
2107
|
-
} catch (err) {
|
|
2108
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC requests");
|
|
2109
|
-
setError(error2);
|
|
2110
|
-
throw error2;
|
|
2111
|
-
} finally {
|
|
2112
|
-
setLoading(false);
|
|
2113
|
-
}
|
|
2114
|
-
},
|
|
2115
|
-
[client, options.filters, options.pagination]
|
|
2116
|
-
);
|
|
2117
|
-
const getRequest = useCallback(
|
|
2118
|
-
async (id) => {
|
|
2119
|
-
try {
|
|
2120
|
-
return await client.getKycRequest(id);
|
|
2121
|
-
} catch (err) {
|
|
2122
|
-
const error2 = err instanceof Error ? err : new Error("Failed to get KYC request");
|
|
2123
|
-
setError(error2);
|
|
2124
|
-
throw error2;
|
|
2125
|
-
}
|
|
2126
|
-
},
|
|
2127
|
-
[client]
|
|
2128
|
-
);
|
|
2129
|
-
const updateStatus = useCallback(
|
|
2130
|
-
async (reference, status, reason) => {
|
|
2131
|
-
try {
|
|
2132
|
-
await client.updateKycStatus({ reference, status, reason });
|
|
2133
|
-
setRequests(
|
|
2134
|
-
(prev) => prev.map(
|
|
2135
|
-
(req) => req.reference === reference ? {
|
|
2136
|
-
...req,
|
|
2137
|
-
status,
|
|
2138
|
-
...status === "accepted" ? { accepted_reason: reason } : { declined_reason: reason }
|
|
2139
|
-
} : req
|
|
2140
|
-
)
|
|
2141
|
-
);
|
|
2142
|
-
} catch (err) {
|
|
2143
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC status");
|
|
2144
|
-
setError(error2);
|
|
2145
|
-
throw error2;
|
|
2146
|
-
}
|
|
2147
|
-
},
|
|
2148
|
-
[client]
|
|
2149
|
-
);
|
|
2150
|
-
const refresh = useCallback(async () => {
|
|
2151
|
-
await fetchRequests();
|
|
2152
|
-
}, [fetchRequests]);
|
|
2153
|
-
useAutoFetch(options.autoFetch, fetchRequests);
|
|
2154
|
-
usePolling(options.pollInterval, fetchRequests);
|
|
2155
|
-
return {
|
|
2156
|
-
requests,
|
|
2157
|
-
pagination,
|
|
2158
|
-
loading,
|
|
2159
|
-
error,
|
|
2160
|
-
fetchRequests,
|
|
2161
|
-
getRequest,
|
|
2162
|
-
updateStatus,
|
|
2163
|
-
refresh
|
|
2164
|
-
};
|
|
2165
|
-
}
|
|
2166
2103
|
function useKycAlerts(client, options = {}) {
|
|
2167
2104
|
const [alerts, setAlerts] = useState([]);
|
|
2168
2105
|
const [pagination, setPagination] = useState(null);
|
|
@@ -2189,35 +2126,6 @@ function useKycAlerts(client, options = {}) {
|
|
|
2189
2126
|
},
|
|
2190
2127
|
[client, options.filters, options.pagination]
|
|
2191
2128
|
);
|
|
2192
|
-
const getAlert = useCallback(
|
|
2193
|
-
async (id) => {
|
|
2194
|
-
try {
|
|
2195
|
-
return await client.getAlert(id);
|
|
2196
|
-
} catch (err) {
|
|
2197
|
-
const error2 = err instanceof Error ? err : new Error("Failed to get KYC alert");
|
|
2198
|
-
setError(error2);
|
|
2199
|
-
throw error2;
|
|
2200
|
-
}
|
|
2201
|
-
},
|
|
2202
|
-
[client]
|
|
2203
|
-
);
|
|
2204
|
-
const updateAlert = useCallback(
|
|
2205
|
-
async (id, update) => {
|
|
2206
|
-
try {
|
|
2207
|
-
await client.updateAlert(id, update);
|
|
2208
|
-
setAlerts(
|
|
2209
|
-
(prev) => prev.map(
|
|
2210
|
-
(alert) => alert.id === id ? { ...alert, ...update } : alert
|
|
2211
|
-
)
|
|
2212
|
-
);
|
|
2213
|
-
} catch (err) {
|
|
2214
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC alert");
|
|
2215
|
-
setError(error2);
|
|
2216
|
-
throw error2;
|
|
2217
|
-
}
|
|
2218
|
-
},
|
|
2219
|
-
[client]
|
|
2220
|
-
);
|
|
2221
2129
|
const refresh = useCallback(async () => {
|
|
2222
2130
|
await fetchAlerts();
|
|
2223
2131
|
}, [fetchAlerts]);
|
|
@@ -2229,87 +2137,9 @@ function useKycAlerts(client, options = {}) {
|
|
|
2229
2137
|
loading,
|
|
2230
2138
|
error,
|
|
2231
2139
|
fetchAlerts,
|
|
2232
|
-
getAlert,
|
|
2233
|
-
updateAlert,
|
|
2234
2140
|
refresh
|
|
2235
2141
|
};
|
|
2236
2142
|
}
|
|
2237
|
-
function useKycOverview(client, options = {}) {
|
|
2238
|
-
const [overview, setOverview] = useState(null);
|
|
2239
|
-
const [loading, setLoading] = useState(false);
|
|
2240
|
-
const [error, setError] = useState(null);
|
|
2241
|
-
const fetchOverview = useCallback(
|
|
2242
|
-
async (fromDate, toDate) => {
|
|
2243
|
-
setLoading(true);
|
|
2244
|
-
setError(null);
|
|
2245
|
-
try {
|
|
2246
|
-
const result = await client.getOverview(
|
|
2247
|
-
fromDate || options.fromDate,
|
|
2248
|
-
toDate || options.toDate
|
|
2249
|
-
);
|
|
2250
|
-
setOverview(result);
|
|
2251
|
-
} catch (err) {
|
|
2252
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC overview");
|
|
2253
|
-
setError(error2);
|
|
2254
|
-
throw error2;
|
|
2255
|
-
} finally {
|
|
2256
|
-
setLoading(false);
|
|
2257
|
-
}
|
|
2258
|
-
},
|
|
2259
|
-
[client, options.fromDate, options.toDate]
|
|
2260
|
-
);
|
|
2261
|
-
useAutoFetch(options.autoFetch, fetchOverview);
|
|
2262
|
-
return {
|
|
2263
|
-
overview,
|
|
2264
|
-
loading,
|
|
2265
|
-
error,
|
|
2266
|
-
refresh: fetchOverview
|
|
2267
|
-
};
|
|
2268
|
-
}
|
|
2269
|
-
function useKycPreferences(client, autoFetch = true) {
|
|
2270
|
-
const [preferences, setPreferences] = useState(null);
|
|
2271
|
-
const [loading, setLoading] = useState(false);
|
|
2272
|
-
const [error, setError] = useState(null);
|
|
2273
|
-
const fetchPreferences = useCallback(async () => {
|
|
2274
|
-
setLoading(true);
|
|
2275
|
-
setError(null);
|
|
2276
|
-
try {
|
|
2277
|
-
const result = await client.getPreferences();
|
|
2278
|
-
setPreferences(result);
|
|
2279
|
-
} catch (err) {
|
|
2280
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC preferences");
|
|
2281
|
-
setError(error2);
|
|
2282
|
-
throw error2;
|
|
2283
|
-
} finally {
|
|
2284
|
-
setLoading(false);
|
|
2285
|
-
}
|
|
2286
|
-
}, [client]);
|
|
2287
|
-
const updatePreferences = useCallback(
|
|
2288
|
-
async (update) => {
|
|
2289
|
-
setLoading(true);
|
|
2290
|
-
setError(null);
|
|
2291
|
-
try {
|
|
2292
|
-
const result = await client.updatePreferences(update);
|
|
2293
|
-
setPreferences(result);
|
|
2294
|
-
} catch (err) {
|
|
2295
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC preferences");
|
|
2296
|
-
setError(error2);
|
|
2297
|
-
throw error2;
|
|
2298
|
-
} finally {
|
|
2299
|
-
setLoading(false);
|
|
2300
|
-
}
|
|
2301
|
-
},
|
|
2302
|
-
[client]
|
|
2303
|
-
);
|
|
2304
|
-
useAutoFetch(autoFetch, fetchPreferences);
|
|
2305
|
-
return {
|
|
2306
|
-
preferences,
|
|
2307
|
-
loading,
|
|
2308
|
-
error,
|
|
2309
|
-
updatePreferences,
|
|
2310
|
-
refresh: fetchPreferences
|
|
2311
|
-
};
|
|
2312
|
-
}
|
|
2313
2143
|
function fileToBase64(file) {
|
|
2314
2144
|
return new Promise((resolve, reject) => {
|
|
2315
2145
|
const reader = new FileReader();
|
|
@@ -2423,6 +2253,6 @@ function useEventBasedFaceVerificationSubmission(client) {
|
|
|
2423
2253
|
return { startSession, verifyFace, runFlow };
|
|
2424
2254
|
}
|
|
2425
2255
|
|
|
2426
|
-
export { FaceCaptureModal_default as FaceCaptureModal, buildEventBasedFaceVerificationQrPayload, createDeviceFingerprint, fileToBase64, formatKycStatus, getBrowserInfo, getRiskColor, getStatusColor, isMobileDevice, isValidFileSize, isValidFileType, useCipherText, useCustomerProfile, useEventBasedFaceVerificationSubmission, useGeolocation, useKycAlerts,
|
|
2256
|
+
export { FaceCaptureModal_default as FaceCaptureModal, buildEventBasedFaceVerificationQrPayload, createDeviceFingerprint, fileToBase64, formatKycStatus, getBrowserInfo, getRiskColor, getStatusColor, isMobileDevice, isValidFileSize, isValidFileType, useCipherText, useCustomerProfile, useEventBasedFaceVerificationSubmission, useGeolocation, useKycAlerts, useKycSubmission, useLocationCapture, useLocationRequests, useLoginVerification, useRegistration, useTransactionVerification };
|
|
2427
2257
|
//# sourceMappingURL=react.mjs.map
|
|
2428
2258
|
//# sourceMappingURL=react.mjs.map
|