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.js
CHANGED
|
@@ -10,7 +10,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
10
10
|
// src/geolocation/hooks.ts
|
|
11
11
|
|
|
12
12
|
// src/core/version.ts
|
|
13
|
-
var SDK_VERSION = "1.
|
|
13
|
+
var SDK_VERSION = "1.8.0";
|
|
14
14
|
|
|
15
15
|
// src/core/errors.ts
|
|
16
16
|
var VesantError = class _VesantError extends Error {
|
|
@@ -429,14 +429,11 @@ function useCipherText(client) {
|
|
|
429
429
|
const [configLoading, setConfigLoading] = React.useState(!!client);
|
|
430
430
|
const [configError, setConfigError] = React.useState(null);
|
|
431
431
|
const configRef = React.useRef(void 0);
|
|
432
|
-
const configPromiseRef = React.useRef(null);
|
|
433
432
|
React.useEffect(() => {
|
|
434
433
|
if (!client) return;
|
|
435
434
|
let cancelled = false;
|
|
436
435
|
setConfigLoading(true);
|
|
437
|
-
|
|
438
|
-
configPromiseRef.current = promise;
|
|
439
|
-
promise.then((cfg) => {
|
|
436
|
+
client.getGPSConfig().then((cfg) => {
|
|
440
437
|
if (!cancelled) {
|
|
441
438
|
configRef.current = cfg;
|
|
442
439
|
setConfigLoading(false);
|
|
@@ -451,13 +448,21 @@ function useCipherText(client) {
|
|
|
451
448
|
cancelled = true;
|
|
452
449
|
};
|
|
453
450
|
}, [client]);
|
|
451
|
+
const refreshConfig = React.useCallback(async () => {
|
|
452
|
+
if (!client) return;
|
|
453
|
+
try {
|
|
454
|
+
configRef.current = await client.refreshGPSConfig();
|
|
455
|
+
setConfigError(null);
|
|
456
|
+
} catch (error) {
|
|
457
|
+
setConfigError(error instanceof Error ? error : new Error("Failed to refresh GPS config"));
|
|
458
|
+
}
|
|
459
|
+
}, [client]);
|
|
454
460
|
const generate = React.useCallback(
|
|
455
461
|
async (options) => {
|
|
456
462
|
try {
|
|
457
|
-
if (
|
|
463
|
+
if (client) {
|
|
458
464
|
try {
|
|
459
|
-
|
|
460
|
-
configRef.current = cfg;
|
|
465
|
+
configRef.current = await client.getGPSConfig();
|
|
461
466
|
} catch {
|
|
462
467
|
}
|
|
463
468
|
}
|
|
@@ -467,9 +472,9 @@ function useCipherText(client) {
|
|
|
467
472
|
return null;
|
|
468
473
|
}
|
|
469
474
|
},
|
|
470
|
-
[]
|
|
475
|
+
[client]
|
|
471
476
|
);
|
|
472
|
-
return { generate, configLoading, configError };
|
|
477
|
+
return { generate, refreshConfig, configLoading, configError };
|
|
473
478
|
}
|
|
474
479
|
function useLocationRequests(client, options = {}) {
|
|
475
480
|
const [requests, setRequests] = React.useState([]);
|
|
@@ -866,6 +871,13 @@ function useTransactionVerification(client, options = {}) {
|
|
|
866
871
|
verifyTransaction
|
|
867
872
|
};
|
|
868
873
|
}
|
|
874
|
+
|
|
875
|
+
// src/risk-profile/types.ts
|
|
876
|
+
function isProfileUpdateHeld(result) {
|
|
877
|
+
return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// src/risk-profile/hooks.ts
|
|
869
881
|
function useCustomerProfile(client, customerId, options = {}) {
|
|
870
882
|
const [profile, setProfile] = React.useState(null);
|
|
871
883
|
const [loading, setLoading] = React.useState(false);
|
|
@@ -894,7 +906,7 @@ function useCustomerProfile(client, customerId, options = {}) {
|
|
|
894
906
|
setError(null);
|
|
895
907
|
try {
|
|
896
908
|
const updated = await client.updateProfile(profileRef.current.id, updates);
|
|
897
|
-
setProfile(updated);
|
|
909
|
+
setProfile(isProfileUpdateHeld(updated) ? updated.profile : updated);
|
|
898
910
|
return updated;
|
|
899
911
|
} catch (err) {
|
|
900
912
|
const error2 = err instanceof Error ? err : new Error("Failed to update profile");
|
|
@@ -2094,81 +2106,6 @@ function useKycSubmission(client, options = {}) {
|
|
|
2094
2106
|
reset
|
|
2095
2107
|
};
|
|
2096
2108
|
}
|
|
2097
|
-
function useKycRequests(client, options = {}) {
|
|
2098
|
-
const [requests, setRequests] = React.useState([]);
|
|
2099
|
-
const [pagination, setPagination] = React.useState(null);
|
|
2100
|
-
const [loading, setLoading] = React.useState(false);
|
|
2101
|
-
const [error, setError] = React.useState(null);
|
|
2102
|
-
const fetchRequests = React.useCallback(
|
|
2103
|
-
async (filters, paginationParams) => {
|
|
2104
|
-
setLoading(true);
|
|
2105
|
-
setError(null);
|
|
2106
|
-
try {
|
|
2107
|
-
const result = await client.listKycRequests(
|
|
2108
|
-
filters || options.filters,
|
|
2109
|
-
paginationParams || options.pagination
|
|
2110
|
-
);
|
|
2111
|
-
setRequests(result.data);
|
|
2112
|
-
setPagination(result.pagination);
|
|
2113
|
-
} catch (err) {
|
|
2114
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC requests");
|
|
2115
|
-
setError(error2);
|
|
2116
|
-
throw error2;
|
|
2117
|
-
} finally {
|
|
2118
|
-
setLoading(false);
|
|
2119
|
-
}
|
|
2120
|
-
},
|
|
2121
|
-
[client, options.filters, options.pagination]
|
|
2122
|
-
);
|
|
2123
|
-
const getRequest = React.useCallback(
|
|
2124
|
-
async (id) => {
|
|
2125
|
-
try {
|
|
2126
|
-
return await client.getKycRequest(id);
|
|
2127
|
-
} catch (err) {
|
|
2128
|
-
const error2 = err instanceof Error ? err : new Error("Failed to get KYC request");
|
|
2129
|
-
setError(error2);
|
|
2130
|
-
throw error2;
|
|
2131
|
-
}
|
|
2132
|
-
},
|
|
2133
|
-
[client]
|
|
2134
|
-
);
|
|
2135
|
-
const updateStatus = React.useCallback(
|
|
2136
|
-
async (reference, status, reason) => {
|
|
2137
|
-
try {
|
|
2138
|
-
await client.updateKycStatus({ reference, status, reason });
|
|
2139
|
-
setRequests(
|
|
2140
|
-
(prev) => prev.map(
|
|
2141
|
-
(req) => req.reference === reference ? {
|
|
2142
|
-
...req,
|
|
2143
|
-
status,
|
|
2144
|
-
...status === "accepted" ? { accepted_reason: reason } : { declined_reason: reason }
|
|
2145
|
-
} : req
|
|
2146
|
-
)
|
|
2147
|
-
);
|
|
2148
|
-
} catch (err) {
|
|
2149
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC status");
|
|
2150
|
-
setError(error2);
|
|
2151
|
-
throw error2;
|
|
2152
|
-
}
|
|
2153
|
-
},
|
|
2154
|
-
[client]
|
|
2155
|
-
);
|
|
2156
|
-
const refresh = React.useCallback(async () => {
|
|
2157
|
-
await fetchRequests();
|
|
2158
|
-
}, [fetchRequests]);
|
|
2159
|
-
useAutoFetch(options.autoFetch, fetchRequests);
|
|
2160
|
-
usePolling(options.pollInterval, fetchRequests);
|
|
2161
|
-
return {
|
|
2162
|
-
requests,
|
|
2163
|
-
pagination,
|
|
2164
|
-
loading,
|
|
2165
|
-
error,
|
|
2166
|
-
fetchRequests,
|
|
2167
|
-
getRequest,
|
|
2168
|
-
updateStatus,
|
|
2169
|
-
refresh
|
|
2170
|
-
};
|
|
2171
|
-
}
|
|
2172
2109
|
function useKycAlerts(client, options = {}) {
|
|
2173
2110
|
const [alerts, setAlerts] = React.useState([]);
|
|
2174
2111
|
const [pagination, setPagination] = React.useState(null);
|
|
@@ -2195,35 +2132,6 @@ function useKycAlerts(client, options = {}) {
|
|
|
2195
2132
|
},
|
|
2196
2133
|
[client, options.filters, options.pagination]
|
|
2197
2134
|
);
|
|
2198
|
-
const getAlert = React.useCallback(
|
|
2199
|
-
async (id) => {
|
|
2200
|
-
try {
|
|
2201
|
-
return await client.getAlert(id);
|
|
2202
|
-
} catch (err) {
|
|
2203
|
-
const error2 = err instanceof Error ? err : new Error("Failed to get KYC alert");
|
|
2204
|
-
setError(error2);
|
|
2205
|
-
throw error2;
|
|
2206
|
-
}
|
|
2207
|
-
},
|
|
2208
|
-
[client]
|
|
2209
|
-
);
|
|
2210
|
-
const updateAlert = React.useCallback(
|
|
2211
|
-
async (id, update) => {
|
|
2212
|
-
try {
|
|
2213
|
-
await client.updateAlert(id, update);
|
|
2214
|
-
setAlerts(
|
|
2215
|
-
(prev) => prev.map(
|
|
2216
|
-
(alert) => alert.id === id ? { ...alert, ...update } : alert
|
|
2217
|
-
)
|
|
2218
|
-
);
|
|
2219
|
-
} catch (err) {
|
|
2220
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC alert");
|
|
2221
|
-
setError(error2);
|
|
2222
|
-
throw error2;
|
|
2223
|
-
}
|
|
2224
|
-
},
|
|
2225
|
-
[client]
|
|
2226
|
-
);
|
|
2227
2135
|
const refresh = React.useCallback(async () => {
|
|
2228
2136
|
await fetchAlerts();
|
|
2229
2137
|
}, [fetchAlerts]);
|
|
@@ -2235,87 +2143,9 @@ function useKycAlerts(client, options = {}) {
|
|
|
2235
2143
|
loading,
|
|
2236
2144
|
error,
|
|
2237
2145
|
fetchAlerts,
|
|
2238
|
-
getAlert,
|
|
2239
|
-
updateAlert,
|
|
2240
2146
|
refresh
|
|
2241
2147
|
};
|
|
2242
2148
|
}
|
|
2243
|
-
function useKycOverview(client, options = {}) {
|
|
2244
|
-
const [overview, setOverview] = React.useState(null);
|
|
2245
|
-
const [loading, setLoading] = React.useState(false);
|
|
2246
|
-
const [error, setError] = React.useState(null);
|
|
2247
|
-
const fetchOverview = React.useCallback(
|
|
2248
|
-
async (fromDate, toDate) => {
|
|
2249
|
-
setLoading(true);
|
|
2250
|
-
setError(null);
|
|
2251
|
-
try {
|
|
2252
|
-
const result = await client.getOverview(
|
|
2253
|
-
fromDate || options.fromDate,
|
|
2254
|
-
toDate || options.toDate
|
|
2255
|
-
);
|
|
2256
|
-
setOverview(result);
|
|
2257
|
-
} catch (err) {
|
|
2258
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC overview");
|
|
2259
|
-
setError(error2);
|
|
2260
|
-
throw error2;
|
|
2261
|
-
} finally {
|
|
2262
|
-
setLoading(false);
|
|
2263
|
-
}
|
|
2264
|
-
},
|
|
2265
|
-
[client, options.fromDate, options.toDate]
|
|
2266
|
-
);
|
|
2267
|
-
useAutoFetch(options.autoFetch, fetchOverview);
|
|
2268
|
-
return {
|
|
2269
|
-
overview,
|
|
2270
|
-
loading,
|
|
2271
|
-
error,
|
|
2272
|
-
refresh: fetchOverview
|
|
2273
|
-
};
|
|
2274
|
-
}
|
|
2275
|
-
function useKycPreferences(client, autoFetch = true) {
|
|
2276
|
-
const [preferences, setPreferences] = React.useState(null);
|
|
2277
|
-
const [loading, setLoading] = React.useState(false);
|
|
2278
|
-
const [error, setError] = React.useState(null);
|
|
2279
|
-
const fetchPreferences = React.useCallback(async () => {
|
|
2280
|
-
setLoading(true);
|
|
2281
|
-
setError(null);
|
|
2282
|
-
try {
|
|
2283
|
-
const result = await client.getPreferences();
|
|
2284
|
-
setPreferences(result);
|
|
2285
|
-
} catch (err) {
|
|
2286
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC preferences");
|
|
2287
|
-
setError(error2);
|
|
2288
|
-
throw error2;
|
|
2289
|
-
} finally {
|
|
2290
|
-
setLoading(false);
|
|
2291
|
-
}
|
|
2292
|
-
}, [client]);
|
|
2293
|
-
const updatePreferences = React.useCallback(
|
|
2294
|
-
async (update) => {
|
|
2295
|
-
setLoading(true);
|
|
2296
|
-
setError(null);
|
|
2297
|
-
try {
|
|
2298
|
-
const result = await client.updatePreferences(update);
|
|
2299
|
-
setPreferences(result);
|
|
2300
|
-
} catch (err) {
|
|
2301
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC preferences");
|
|
2302
|
-
setError(error2);
|
|
2303
|
-
throw error2;
|
|
2304
|
-
} finally {
|
|
2305
|
-
setLoading(false);
|
|
2306
|
-
}
|
|
2307
|
-
},
|
|
2308
|
-
[client]
|
|
2309
|
-
);
|
|
2310
|
-
useAutoFetch(autoFetch, fetchPreferences);
|
|
2311
|
-
return {
|
|
2312
|
-
preferences,
|
|
2313
|
-
loading,
|
|
2314
|
-
error,
|
|
2315
|
-
updatePreferences,
|
|
2316
|
-
refresh: fetchPreferences
|
|
2317
|
-
};
|
|
2318
|
-
}
|
|
2319
2149
|
function fileToBase64(file) {
|
|
2320
2150
|
return new Promise((resolve, reject) => {
|
|
2321
2151
|
const reader = new FileReader();
|
|
@@ -2445,9 +2275,6 @@ exports.useCustomerProfile = useCustomerProfile;
|
|
|
2445
2275
|
exports.useEventBasedFaceVerificationSubmission = useEventBasedFaceVerificationSubmission;
|
|
2446
2276
|
exports.useGeolocation = useGeolocation;
|
|
2447
2277
|
exports.useKycAlerts = useKycAlerts;
|
|
2448
|
-
exports.useKycOverview = useKycOverview;
|
|
2449
|
-
exports.useKycPreferences = useKycPreferences;
|
|
2450
|
-
exports.useKycRequests = useKycRequests;
|
|
2451
2278
|
exports.useKycSubmission = useKycSubmission;
|
|
2452
2279
|
exports.useLocationCapture = useLocationCapture;
|
|
2453
2280
|
exports.useLocationRequests = useLocationRequests;
|