vesant-sdk 1.8.0-dev.2b9e28d → 1.8.0-dev.2d679f1
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 +2 -2
- package/dist/{client-DUHC-68_.d.ts → client-BPALLldd.d.ts} +1 -1
- package/dist/{client-5q4whhGu.d.mts → client-_OhkfnyJ.d.mts} +1 -1
- package/dist/compliance/index.d.mts +2 -2
- package/dist/compliance/index.d.ts +2 -2
- package/dist/compliance/index.js +26 -9
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +26 -9
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +7 -6
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +7 -6
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.js +7 -6
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +7 -6
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +57 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -168
- 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 +37 -164
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +36 -165
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +218 -218
- package/dist/kyc/index.d.ts +218 -218
- package/dist/kyc/index.js +37 -164
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +36 -165
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +16 -114
- package/dist/react.d.ts +16 -114
- package/dist/react.js +8 -186
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +9 -184
- 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 +25 -8
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +25 -9
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +7 -6
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +7 -6
- 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 +7 -6
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +7 -6
- 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/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -865,6 +865,13 @@ function useTransactionVerification(client, options = {}) {
|
|
|
865
865
|
verifyTransaction
|
|
866
866
|
};
|
|
867
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
|
|
868
875
|
function useCustomerProfile(client, customerId, options = {}) {
|
|
869
876
|
const [profile, setProfile] = useState(null);
|
|
870
877
|
const [loading, setLoading] = useState(false);
|
|
@@ -893,7 +900,7 @@ function useCustomerProfile(client, customerId, options = {}) {
|
|
|
893
900
|
setError(null);
|
|
894
901
|
try {
|
|
895
902
|
const updated = await client.updateProfile(profileRef.current.id, updates);
|
|
896
|
-
setProfile(updated);
|
|
903
|
+
setProfile(isProfileUpdateHeld(updated) ? updated.profile : updated);
|
|
897
904
|
return updated;
|
|
898
905
|
} catch (err) {
|
|
899
906
|
const error2 = err instanceof Error ? err : new Error("Failed to update profile");
|
|
@@ -2093,81 +2100,6 @@ function useKycSubmission(client, options = {}) {
|
|
|
2093
2100
|
reset
|
|
2094
2101
|
};
|
|
2095
2102
|
}
|
|
2096
|
-
function useKycRequests(client, options = {}) {
|
|
2097
|
-
const [requests, setRequests] = useState([]);
|
|
2098
|
-
const [pagination, setPagination] = useState(null);
|
|
2099
|
-
const [loading, setLoading] = useState(false);
|
|
2100
|
-
const [error, setError] = useState(null);
|
|
2101
|
-
const fetchRequests = useCallback(
|
|
2102
|
-
async (filters, paginationParams) => {
|
|
2103
|
-
setLoading(true);
|
|
2104
|
-
setError(null);
|
|
2105
|
-
try {
|
|
2106
|
-
const result = await client.listKycRequests(
|
|
2107
|
-
filters || options.filters,
|
|
2108
|
-
paginationParams || options.pagination
|
|
2109
|
-
);
|
|
2110
|
-
setRequests(result.data);
|
|
2111
|
-
setPagination(result.pagination);
|
|
2112
|
-
} catch (err) {
|
|
2113
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC requests");
|
|
2114
|
-
setError(error2);
|
|
2115
|
-
throw error2;
|
|
2116
|
-
} finally {
|
|
2117
|
-
setLoading(false);
|
|
2118
|
-
}
|
|
2119
|
-
},
|
|
2120
|
-
[client, options.filters, options.pagination]
|
|
2121
|
-
);
|
|
2122
|
-
const getRequest = useCallback(
|
|
2123
|
-
async (id) => {
|
|
2124
|
-
try {
|
|
2125
|
-
return await client.getKycRequest(id);
|
|
2126
|
-
} catch (err) {
|
|
2127
|
-
const error2 = err instanceof Error ? err : new Error("Failed to get KYC request");
|
|
2128
|
-
setError(error2);
|
|
2129
|
-
throw error2;
|
|
2130
|
-
}
|
|
2131
|
-
},
|
|
2132
|
-
[client]
|
|
2133
|
-
);
|
|
2134
|
-
const updateStatus = useCallback(
|
|
2135
|
-
async (reference, status, reason) => {
|
|
2136
|
-
try {
|
|
2137
|
-
await client.updateKycStatus({ reference, status, reason });
|
|
2138
|
-
setRequests(
|
|
2139
|
-
(prev) => prev.map(
|
|
2140
|
-
(req) => req.reference === reference ? {
|
|
2141
|
-
...req,
|
|
2142
|
-
status,
|
|
2143
|
-
...status === "accepted" ? { accepted_reason: reason } : { declined_reason: reason }
|
|
2144
|
-
} : req
|
|
2145
|
-
)
|
|
2146
|
-
);
|
|
2147
|
-
} catch (err) {
|
|
2148
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC status");
|
|
2149
|
-
setError(error2);
|
|
2150
|
-
throw error2;
|
|
2151
|
-
}
|
|
2152
|
-
},
|
|
2153
|
-
[client]
|
|
2154
|
-
);
|
|
2155
|
-
const refresh = useCallback(async () => {
|
|
2156
|
-
await fetchRequests();
|
|
2157
|
-
}, [fetchRequests]);
|
|
2158
|
-
useAutoFetch(options.autoFetch, fetchRequests);
|
|
2159
|
-
usePolling(options.pollInterval, fetchRequests);
|
|
2160
|
-
return {
|
|
2161
|
-
requests,
|
|
2162
|
-
pagination,
|
|
2163
|
-
loading,
|
|
2164
|
-
error,
|
|
2165
|
-
fetchRequests,
|
|
2166
|
-
getRequest,
|
|
2167
|
-
updateStatus,
|
|
2168
|
-
refresh
|
|
2169
|
-
};
|
|
2170
|
-
}
|
|
2171
2103
|
function useKycAlerts(client, options = {}) {
|
|
2172
2104
|
const [alerts, setAlerts] = useState([]);
|
|
2173
2105
|
const [pagination, setPagination] = useState(null);
|
|
@@ -2194,35 +2126,6 @@ function useKycAlerts(client, options = {}) {
|
|
|
2194
2126
|
},
|
|
2195
2127
|
[client, options.filters, options.pagination]
|
|
2196
2128
|
);
|
|
2197
|
-
const getAlert = useCallback(
|
|
2198
|
-
async (id) => {
|
|
2199
|
-
try {
|
|
2200
|
-
return await client.getAlert(id);
|
|
2201
|
-
} catch (err) {
|
|
2202
|
-
const error2 = err instanceof Error ? err : new Error("Failed to get KYC alert");
|
|
2203
|
-
setError(error2);
|
|
2204
|
-
throw error2;
|
|
2205
|
-
}
|
|
2206
|
-
},
|
|
2207
|
-
[client]
|
|
2208
|
-
);
|
|
2209
|
-
const updateAlert = useCallback(
|
|
2210
|
-
async (id, update) => {
|
|
2211
|
-
try {
|
|
2212
|
-
await client.updateAlert(id, update);
|
|
2213
|
-
setAlerts(
|
|
2214
|
-
(prev) => prev.map(
|
|
2215
|
-
(alert) => alert.id === id ? { ...alert, ...update } : alert
|
|
2216
|
-
)
|
|
2217
|
-
);
|
|
2218
|
-
} catch (err) {
|
|
2219
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC alert");
|
|
2220
|
-
setError(error2);
|
|
2221
|
-
throw error2;
|
|
2222
|
-
}
|
|
2223
|
-
},
|
|
2224
|
-
[client]
|
|
2225
|
-
);
|
|
2226
2129
|
const refresh = useCallback(async () => {
|
|
2227
2130
|
await fetchAlerts();
|
|
2228
2131
|
}, [fetchAlerts]);
|
|
@@ -2234,87 +2137,9 @@ function useKycAlerts(client, options = {}) {
|
|
|
2234
2137
|
loading,
|
|
2235
2138
|
error,
|
|
2236
2139
|
fetchAlerts,
|
|
2237
|
-
getAlert,
|
|
2238
|
-
updateAlert,
|
|
2239
2140
|
refresh
|
|
2240
2141
|
};
|
|
2241
2142
|
}
|
|
2242
|
-
function useKycOverview(client, options = {}) {
|
|
2243
|
-
const [overview, setOverview] = useState(null);
|
|
2244
|
-
const [loading, setLoading] = useState(false);
|
|
2245
|
-
const [error, setError] = useState(null);
|
|
2246
|
-
const fetchOverview = useCallback(
|
|
2247
|
-
async (fromDate, toDate) => {
|
|
2248
|
-
setLoading(true);
|
|
2249
|
-
setError(null);
|
|
2250
|
-
try {
|
|
2251
|
-
const result = await client.getOverview(
|
|
2252
|
-
fromDate || options.fromDate,
|
|
2253
|
-
toDate || options.toDate
|
|
2254
|
-
);
|
|
2255
|
-
setOverview(result);
|
|
2256
|
-
} catch (err) {
|
|
2257
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC overview");
|
|
2258
|
-
setError(error2);
|
|
2259
|
-
throw error2;
|
|
2260
|
-
} finally {
|
|
2261
|
-
setLoading(false);
|
|
2262
|
-
}
|
|
2263
|
-
},
|
|
2264
|
-
[client, options.fromDate, options.toDate]
|
|
2265
|
-
);
|
|
2266
|
-
useAutoFetch(options.autoFetch, fetchOverview);
|
|
2267
|
-
return {
|
|
2268
|
-
overview,
|
|
2269
|
-
loading,
|
|
2270
|
-
error,
|
|
2271
|
-
refresh: fetchOverview
|
|
2272
|
-
};
|
|
2273
|
-
}
|
|
2274
|
-
function useKycPreferences(client, autoFetch = true) {
|
|
2275
|
-
const [preferences, setPreferences] = useState(null);
|
|
2276
|
-
const [loading, setLoading] = useState(false);
|
|
2277
|
-
const [error, setError] = useState(null);
|
|
2278
|
-
const fetchPreferences = useCallback(async () => {
|
|
2279
|
-
setLoading(true);
|
|
2280
|
-
setError(null);
|
|
2281
|
-
try {
|
|
2282
|
-
const result = await client.getPreferences();
|
|
2283
|
-
setPreferences(result);
|
|
2284
|
-
} catch (err) {
|
|
2285
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC preferences");
|
|
2286
|
-
setError(error2);
|
|
2287
|
-
throw error2;
|
|
2288
|
-
} finally {
|
|
2289
|
-
setLoading(false);
|
|
2290
|
-
}
|
|
2291
|
-
}, [client]);
|
|
2292
|
-
const updatePreferences = useCallback(
|
|
2293
|
-
async (update) => {
|
|
2294
|
-
setLoading(true);
|
|
2295
|
-
setError(null);
|
|
2296
|
-
try {
|
|
2297
|
-
const result = await client.updatePreferences(update);
|
|
2298
|
-
setPreferences(result);
|
|
2299
|
-
} catch (err) {
|
|
2300
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC preferences");
|
|
2301
|
-
setError(error2);
|
|
2302
|
-
throw error2;
|
|
2303
|
-
} finally {
|
|
2304
|
-
setLoading(false);
|
|
2305
|
-
}
|
|
2306
|
-
},
|
|
2307
|
-
[client]
|
|
2308
|
-
);
|
|
2309
|
-
useAutoFetch(autoFetch, fetchPreferences);
|
|
2310
|
-
return {
|
|
2311
|
-
preferences,
|
|
2312
|
-
loading,
|
|
2313
|
-
error,
|
|
2314
|
-
updatePreferences,
|
|
2315
|
-
refresh: fetchPreferences
|
|
2316
|
-
};
|
|
2317
|
-
}
|
|
2318
2143
|
function fileToBase64(file) {
|
|
2319
2144
|
return new Promise((resolve, reject) => {
|
|
2320
2145
|
const reader = new FileReader();
|
|
@@ -2428,6 +2253,6 @@ function useEventBasedFaceVerificationSubmission(client) {
|
|
|
2428
2253
|
return { startSession, verifyFace, runFlow };
|
|
2429
2254
|
}
|
|
2430
2255
|
|
|
2431
|
-
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 };
|
|
2432
2257
|
//# sourceMappingURL=react.mjs.map
|
|
2433
2258
|
//# sourceMappingURL=react.mjs.map
|