smartcomply-web-sdk 1.0.89 → 1.0.90
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/dist/client/Smartcomply.d.ts +13 -1
- package/dist/client/Smartcomply.d.ts.map +1 -1
- package/dist/client/Smartcomply.js +14 -1
- package/dist/client/Smartcomply.js.map +1 -1
- package/dist/esm/client/Smartcomply.d.ts +13 -1
- package/dist/esm/client/Smartcomply.d.ts.map +1 -1
- package/dist/esm/client/Smartcomply.js +14 -1
- package/dist/esm/client/Smartcomply.js.map +1 -1
- package/dist/esm/flow/SmartComplyFlow.d.ts +14 -9
- package/dist/esm/flow/SmartComplyFlow.d.ts.map +1 -1
- package/dist/esm/flow/SmartComplyFlow.js +67 -1
- package/dist/esm/flow/SmartComplyFlow.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/liveness.d.ts +15 -0
- package/dist/esm/types/liveness.d.ts.map +1 -1
- package/dist/flow/SmartComplyFlow.d.ts +14 -9
- package/dist/flow/SmartComplyFlow.d.ts.map +1 -1
- package/dist/flow/SmartComplyFlow.js +67 -1
- package/dist/flow/SmartComplyFlow.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/smartcomply.browser.js +68 -2
- package/dist/smartcomply.browser.js.map +3 -3
- package/dist/types/liveness.d.ts +15 -0
- package/dist/types/liveness.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5808,6 +5808,22 @@ var SmartComplySDK = (() => {
|
|
|
5808
5808
|
this._sdkConfig = config;
|
|
5809
5809
|
return config;
|
|
5810
5810
|
}
|
|
5811
|
+
/**
|
|
5812
|
+
* Resolve a resume_token to the entry/step it's resuming, without
|
|
5813
|
+
* consuming the single-use resume binding (unlike create/, which does).
|
|
5814
|
+
* Only meaningful after resumeSession() — a normal createSession()
|
|
5815
|
+
* session was never issued for a resume, so this returns a 404
|
|
5816
|
+
* (NOT_A_RESUME_TOKEN) for it, same as the backend.
|
|
5817
|
+
*
|
|
5818
|
+
* GET /v1/sdk/liveness/resume-info/
|
|
5819
|
+
* Auth: x-access-token: <sessionToken>
|
|
5820
|
+
*/
|
|
5821
|
+
async getResumeInfo() {
|
|
5822
|
+
return this.http.sessionRequest(
|
|
5823
|
+
"GET",
|
|
5824
|
+
"/v1/sdk/liveness/resume-info/"
|
|
5825
|
+
);
|
|
5826
|
+
}
|
|
5811
5827
|
};
|
|
5812
5828
|
/**
|
|
5813
5829
|
* Package version, hardcoded to match package.json — bump this alongside
|
|
@@ -5818,7 +5834,7 @@ var SmartComplySDK = (() => {
|
|
|
5818
5834
|
* CDN tag they installed with (e.g. @1, which floats to the latest
|
|
5819
5835
|
* matching release) actually resolved to the version they expect.
|
|
5820
5836
|
*/
|
|
5821
|
-
_SmartComply.VERSION = "1.0.
|
|
5837
|
+
_SmartComply.VERSION = "1.0.90";
|
|
5822
5838
|
var SmartComply = _SmartComply;
|
|
5823
5839
|
|
|
5824
5840
|
// src/flow/theme.ts
|
|
@@ -7819,11 +7835,61 @@ var SmartComplySDK = (() => {
|
|
|
7819
7835
|
this.brandLogoImg.style.display = "block";
|
|
7820
7836
|
}
|
|
7821
7837
|
if (this.isDestroyed) return;
|
|
7822
|
-
this.showStep("welcome");
|
|
7838
|
+
this.showStep(this.options.resumeToken ? await this._resolveResumeStep() : "welcome");
|
|
7823
7839
|
} catch (err) {
|
|
7824
7840
|
this.showErrorStep(err.message || "Failed to initialize. Please try again.");
|
|
7825
7841
|
}
|
|
7826
7842
|
}
|
|
7843
|
+
// Resolves a resume_token to the step the customer should land on,
|
|
7844
|
+
// pre-selecting the same country/ID type the original attempt used (the
|
|
7845
|
+
// same state renderCountrySelect/renderIdTypeSelect's own click handlers
|
|
7846
|
+
// set) so document_capture/liveness render correctly instead of assuming
|
|
7847
|
+
// state that was never set. Falls back to "welcome" on anything that
|
|
7848
|
+
// doesn't resolve cleanly — this is a UX improvement, not a requirement:
|
|
7849
|
+
// the backend's own resume-match at create/ time still works correctly
|
|
7850
|
+
// even if the widget can't figure out which screen to pre-select.
|
|
7851
|
+
async _resolveResumeStep() {
|
|
7852
|
+
try {
|
|
7853
|
+
const info = await this.sdk.getResumeInfo();
|
|
7854
|
+
if (info.verification_type === "liveness_only" || info.failure_stage === "liveness" || // data_match is always a selfie-vs-identity-photo mismatch (see the
|
|
7855
|
+
// backend's own comment in _process_identity_face_match) — fixed by
|
|
7856
|
+
// redoing the selfie/video, same as a "liveness" failure. There is
|
|
7857
|
+
// no document step in data verification at all, so this can never
|
|
7858
|
+
// legitimately need document_capture.
|
|
7859
|
+
info.failure_stage === "data_match") {
|
|
7860
|
+
this.selectedCountry = info.country || this.selectedCountry || "global";
|
|
7861
|
+
return "liveness";
|
|
7862
|
+
}
|
|
7863
|
+
if (info.failure_stage === "document" && info.country && info.identifier_type) {
|
|
7864
|
+
const channels = this.sdkConfig?.channels || {};
|
|
7865
|
+
const idTypes = channels[info.country] || [];
|
|
7866
|
+
const match = idTypes.find((idType) => {
|
|
7867
|
+
const code = typeof idType === "string" ? idType : idType.code || idType.name;
|
|
7868
|
+
return code === info.identifier_type;
|
|
7869
|
+
});
|
|
7870
|
+
if (match) {
|
|
7871
|
+
const typeName = typeof match === "string" ? match : match.name;
|
|
7872
|
+
const typeCode = typeof match === "string" ? match : match.code || match.name;
|
|
7873
|
+
const channelFields = typeof match !== "string" ? match.fields || [] : [];
|
|
7874
|
+
const isDocFlow = channelFields.some((f2) => isUploadFieldType(f2.type)) || this.isDocumentFlow();
|
|
7875
|
+
const info2 = resolveIdTypeInfo(typeName, isDocFlow);
|
|
7876
|
+
const requiresBackFromBackend = typeof match !== "string" ? match.requires_back_side : void 0;
|
|
7877
|
+
this.selectedCountry = info.country;
|
|
7878
|
+
this.selectedIdType = typeCode;
|
|
7879
|
+
this.selectedIdTypeName = typeName;
|
|
7880
|
+
this.selectedRequiresBack = requiresBackFromBackend ?? info2.requiresBack;
|
|
7881
|
+
if (typeof match !== "string") {
|
|
7882
|
+
this.selectedChannelId = match.id;
|
|
7883
|
+
this.selectedChannelFields = match.fields || [];
|
|
7884
|
+
}
|
|
7885
|
+
return "document_capture";
|
|
7886
|
+
}
|
|
7887
|
+
}
|
|
7888
|
+
return "welcome";
|
|
7889
|
+
} catch {
|
|
7890
|
+
return "welcome";
|
|
7891
|
+
}
|
|
7892
|
+
}
|
|
7827
7893
|
// Defers the expiry warning while the user is on a camera-active step
|
|
7828
7894
|
// (document_capture/liveness) — showing it there would blow away a live
|
|
7829
7895
|
// video element and in-progress MediaRecorder mid-scan.
|