smartcomply-web-sdk 1.0.88 → 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.
@@ -2,6 +2,7 @@ import { SDKConfig } from "./Config";
2
2
  import { OnboardingModule } from "../modules/onboarding/onboarding";
3
3
  import { LivenessModule } from "../modules/liveness/liveness";
4
4
  import { SessionResponse, SDKInitConfig } from "../types/onboarding";
5
+ import { LivenessResumeInfoResponse } from "../types/liveness";
5
6
  /**
6
7
  * SmartComply SDK — main entry point.
7
8
  *
@@ -21,7 +22,7 @@ export declare class SmartComply {
21
22
  * CDN tag they installed with (e.g. @1, which floats to the latest
22
23
  * matching release) actually resolved to the version they expect.
23
24
  */
24
- static readonly VERSION = "1.0.88";
25
+ static readonly VERSION = "1.0.90";
25
26
  private http;
26
27
  private clientId;
27
28
  private _sessionToken;
@@ -46,9 +47,32 @@ export declare class SmartComply {
46
47
  * Returns: { token: "...", expires_at: "..." }
47
48
  */
48
49
  createSession(): Promise<SessionResponse>;
50
+ /**
51
+ * Resume an existing session from a resume_token (client-initiated
52
+ * resubmit — see the "Resubmit" action in the Adhere dashboard). Unlike
53
+ * createSession(), this makes no network call: a resume_token IS already
54
+ * a valid SessionToken row on the backend (SDKSessionTokenAuthentication
55
+ * checks it against SessionToken.active the same way as any session
56
+ * token), so there is nothing to create — only to start using directly.
57
+ *
58
+ * Must be used INSTEAD OF createSession(), not alongside it. Calling
59
+ * createSession() after this would mint a second, unrelated session and
60
+ * silently abandon the resume — the backend's resume-match in
61
+ * LivenessCreateAPIView only fires for the session actually presented on
62
+ * the request, so the resume_token has to be the one in use throughout.
63
+ *
64
+ * No expires_at is set here — the resume_token's own issuance response
65
+ * only carries resume_expires_at (a 72h invite-link window), not the
66
+ * session's own runtime expiry the way createSession() returns one. The
67
+ * backend still enforces the real expiry server-side regardless; this
68
+ * only means the client-side "session about to expire" warning timer
69
+ * (see SmartComplyFlow.initialize()) has nothing to schedule against and
70
+ * is skipped for a resumed session.
71
+ */
72
+ resumeSession(resumeToken: string): void;
49
73
  /**
50
74
  * Fetch SDK configuration from the backend.
51
- * Must be called after createSession().
75
+ * Must be called after createSession() or resumeSession().
52
76
  *
53
77
  * GET /v1/initialize/
54
78
  * Auth: x-access-token: <sessionToken>
@@ -56,5 +80,16 @@ export declare class SmartComply {
56
80
  * Returns: { brand_name, theme, verification_type, channels, redirect_url, ... }
57
81
  */
58
82
  initializeConfig(): Promise<SDKInitConfig>;
83
+ /**
84
+ * Resolve a resume_token to the entry/step it's resuming, without
85
+ * consuming the single-use resume binding (unlike create/, which does).
86
+ * Only meaningful after resumeSession() — a normal createSession()
87
+ * session was never issued for a resume, so this returns a 404
88
+ * (NOT_A_RESUME_TOKEN) for it, same as the backend.
89
+ *
90
+ * GET /v1/sdk/liveness/resume-info/
91
+ * Auth: x-access-token: <sessionToken>
92
+ */
93
+ getResumeInfo(): Promise<LivenessResumeInfoResponse>;
59
94
  }
60
95
  //# sourceMappingURL=Smartcomply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Smartcomply.d.ts","sourceRoot":"","sources":["../../src/client/Smartcomply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EACL,eAAe,EACf,aAAa,EACd,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AACH,qBAAa,WAAW;IACtB;;;;;;;;OAQG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,YAAY;IAEnC,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,UAAU,CAA8B;IAEzC,UAAU,EAAE,gBAAgB,CAAC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F;IAChF,IAAI,SAAS,IAAI,aAAa,GAAG,IAAI,CAEpC;IAED;;;;;;;;OAQG;IACG,aAAa,IAAI,OAAO,CAAC,eAAe,CAAC;IAgB/C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAMxC;;;;;;;;OAQG;IACG,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC;IAUhD;;;;;;;;;OASG;IACG,aAAa,IAAI,OAAO,CAAC,0BAA0B,CAAC;CAM3D"}
@@ -60,9 +60,36 @@ class SmartComply {
60
60
  this.http.setSessionToken(response.token);
61
61
  return response;
62
62
  }
63
+ /**
64
+ * Resume an existing session from a resume_token (client-initiated
65
+ * resubmit — see the "Resubmit" action in the Adhere dashboard). Unlike
66
+ * createSession(), this makes no network call: a resume_token IS already
67
+ * a valid SessionToken row on the backend (SDKSessionTokenAuthentication
68
+ * checks it against SessionToken.active the same way as any session
69
+ * token), so there is nothing to create — only to start using directly.
70
+ *
71
+ * Must be used INSTEAD OF createSession(), not alongside it. Calling
72
+ * createSession() after this would mint a second, unrelated session and
73
+ * silently abandon the resume — the backend's resume-match in
74
+ * LivenessCreateAPIView only fires for the session actually presented on
75
+ * the request, so the resume_token has to be the one in use throughout.
76
+ *
77
+ * No expires_at is set here — the resume_token's own issuance response
78
+ * only carries resume_expires_at (a 72h invite-link window), not the
79
+ * session's own runtime expiry the way createSession() returns one. The
80
+ * backend still enforces the real expiry server-side regardless; this
81
+ * only means the client-side "session about to expire" warning timer
82
+ * (see SmartComplyFlow.initialize()) has nothing to schedule against and
83
+ * is skipped for a resumed session.
84
+ */
85
+ resumeSession(resumeToken) {
86
+ this._sessionToken = resumeToken;
87
+ this._sessionExpiresAt = null;
88
+ this.http.setSessionToken(resumeToken);
89
+ }
63
90
  /**
64
91
  * Fetch SDK configuration from the backend.
65
- * Must be called after createSession().
92
+ * Must be called after createSession() or resumeSession().
66
93
  *
67
94
  * GET /v1/initialize/
68
95
  * Auth: x-access-token: <sessionToken>
@@ -74,6 +101,19 @@ class SmartComply {
74
101
  this._sdkConfig = config;
75
102
  return config;
76
103
  }
104
+ /**
105
+ * Resolve a resume_token to the entry/step it's resuming, without
106
+ * consuming the single-use resume binding (unlike create/, which does).
107
+ * Only meaningful after resumeSession() — a normal createSession()
108
+ * session was never issued for a resume, so this returns a 404
109
+ * (NOT_A_RESUME_TOKEN) for it, same as the backend.
110
+ *
111
+ * GET /v1/sdk/liveness/resume-info/
112
+ * Auth: x-access-token: <sessionToken>
113
+ */
114
+ async getResumeInfo() {
115
+ return this.http.sessionRequest("GET", "/v1/sdk/liveness/resume-info/");
116
+ }
77
117
  }
78
118
  exports.SmartComply = SmartComply;
79
119
  /**
@@ -85,5 +125,5 @@ exports.SmartComply = SmartComply;
85
125
  * CDN tag they installed with (e.g. @1, which floats to the latest
86
126
  * matching release) actually resolved to the version they expect.
87
127
  */
88
- SmartComply.VERSION = "1.0.88";
128
+ SmartComply.VERSION = "1.0.90";
89
129
  //# sourceMappingURL=Smartcomply.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Smartcomply.js","sourceRoot":"","sources":["../../src/client/Smartcomply.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,iEAAoE;AACpE,2DAA8D;AAC9D,4CAA4C;AAM5C;;;;;;;;GAQG;AACH,MAAa,WAAW;IAqBtB,YAAY,MAAiB;QAPrB,kBAAa,GAAkB,IAAI,CAAC;QACpC,sBAAiB,GAAkB,IAAI,CAAC;QACxC,eAAU,GAAyB,IAAI,CAAC;QAM9C,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QACnF,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,Q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AK,CAAC,aAAa;QACjB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CACtC,MAAM,EACN,qBAAqB,EACrB,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC7B,CAAC;QAEF,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,UAAU,CAAC;QAE7C,mEAAmE;QACnE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE1C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,aAAa,CAAC,WAAmB;QAC/B,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,gBAAgB;QACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAC3C,KAAK,EACL,iBAAiB,CAClB,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAC7B,KAAK,EACL,+BAA+B,CAChC,CAAC;IACJ,CAAC;;AA5IH,kCA6IC;AA5IC;;;;;;;;GAQG;AACa,mBAAO,GAAG,QAAQ,AAAX,CAAY"}
@@ -2,6 +2,7 @@ import { SDKConfig } from "./Config";
2
2
  import { OnboardingModule } from "../modules/onboarding/onboarding";
3
3
  import { LivenessModule } from "../modules/liveness/liveness";
4
4
  import { SessionResponse, SDKInitConfig } from "../types/onboarding";
5
+ import { LivenessResumeInfoResponse } from "../types/liveness";
5
6
  /**
6
7
  * SmartComply SDK — main entry point.
7
8
  *
@@ -21,7 +22,7 @@ export declare class SmartComply {
21
22
  * CDN tag they installed with (e.g. @1, which floats to the latest
22
23
  * matching release) actually resolved to the version they expect.
23
24
  */
24
- static readonly VERSION = "1.0.88";
25
+ static readonly VERSION = "1.0.90";
25
26
  private http;
26
27
  private clientId;
27
28
  private _sessionToken;
@@ -46,9 +47,32 @@ export declare class SmartComply {
46
47
  * Returns: { token: "...", expires_at: "..." }
47
48
  */
48
49
  createSession(): Promise<SessionResponse>;
50
+ /**
51
+ * Resume an existing session from a resume_token (client-initiated
52
+ * resubmit — see the "Resubmit" action in the Adhere dashboard). Unlike
53
+ * createSession(), this makes no network call: a resume_token IS already
54
+ * a valid SessionToken row on the backend (SDKSessionTokenAuthentication
55
+ * checks it against SessionToken.active the same way as any session
56
+ * token), so there is nothing to create — only to start using directly.
57
+ *
58
+ * Must be used INSTEAD OF createSession(), not alongside it. Calling
59
+ * createSession() after this would mint a second, unrelated session and
60
+ * silently abandon the resume — the backend's resume-match in
61
+ * LivenessCreateAPIView only fires for the session actually presented on
62
+ * the request, so the resume_token has to be the one in use throughout.
63
+ *
64
+ * No expires_at is set here — the resume_token's own issuance response
65
+ * only carries resume_expires_at (a 72h invite-link window), not the
66
+ * session's own runtime expiry the way createSession() returns one. The
67
+ * backend still enforces the real expiry server-side regardless; this
68
+ * only means the client-side "session about to expire" warning timer
69
+ * (see SmartComplyFlow.initialize()) has nothing to schedule against and
70
+ * is skipped for a resumed session.
71
+ */
72
+ resumeSession(resumeToken: string): void;
49
73
  /**
50
74
  * Fetch SDK configuration from the backend.
51
- * Must be called after createSession().
75
+ * Must be called after createSession() or resumeSession().
52
76
  *
53
77
  * GET /v1/initialize/
54
78
  * Auth: x-access-token: <sessionToken>
@@ -56,5 +80,16 @@ export declare class SmartComply {
56
80
  * Returns: { brand_name, theme, verification_type, channels, redirect_url, ... }
57
81
  */
58
82
  initializeConfig(): Promise<SDKInitConfig>;
83
+ /**
84
+ * Resolve a resume_token to the entry/step it's resuming, without
85
+ * consuming the single-use resume binding (unlike create/, which does).
86
+ * Only meaningful after resumeSession() — a normal createSession()
87
+ * session was never issued for a resume, so this returns a 404
88
+ * (NOT_A_RESUME_TOKEN) for it, same as the backend.
89
+ *
90
+ * GET /v1/sdk/liveness/resume-info/
91
+ * Auth: x-access-token: <sessionToken>
92
+ */
93
+ getResumeInfo(): Promise<LivenessResumeInfoResponse>;
59
94
  }
60
95
  //# sourceMappingURL=Smartcomply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Smartcomply.d.ts","sourceRoot":"","sources":["../../../src/client/Smartcomply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EACL,eAAe,EACf,aAAa,EACd,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AACH,qBAAa,WAAW;IACtB;;;;;;;;OAQG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,YAAY;IAEnC,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,UAAU,CAA8B;IAEzC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,EAAE,cAAc,CAAC;gBAEpB,MAAM,EAAE,SAAS;IAiB7B,sDAAsD;IACtD,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IAED,uCAAuC;IACvC,IAAI,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEpC;IAED,gFAAgF;IAChF,IAAI,SAAS,IAAI,aAAa,GAAG,IAAI,CAEpC;IAED;;;;;;;;OAQG;IACG,aAAa,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G;IACG,aAAa,IAAI,OAAO,CAAC,0BAA0B,CAAC;CAM3D"}
@@ -57,9 +57,36 @@ export class SmartComply {
57
57
  this.http.setSessionToken(response.token);
58
58
  return response;
59
59
  }
60
+ /**
61
+ * Resume an existing session from a resume_token (client-initiated
62
+ * resubmit — see the "Resubmit" action in the Adhere dashboard). Unlike
63
+ * createSession(), this makes no network call: a resume_token IS already
64
+ * a valid SessionToken row on the backend (SDKSessionTokenAuthentication
65
+ * checks it against SessionToken.active the same way as any session
66
+ * token), so there is nothing to create — only to start using directly.
67
+ *
68
+ * Must be used INSTEAD OF createSession(), not alongside it. Calling
69
+ * createSession() after this would mint a second, unrelated session and
70
+ * silently abandon the resume — the backend's resume-match in
71
+ * LivenessCreateAPIView only fires for the session actually presented on
72
+ * the request, so the resume_token has to be the one in use throughout.
73
+ *
74
+ * No expires_at is set here — the resume_token's own issuance response
75
+ * only carries resume_expires_at (a 72h invite-link window), not the
76
+ * session's own runtime expiry the way createSession() returns one. The
77
+ * backend still enforces the real expiry server-side regardless; this
78
+ * only means the client-side "session about to expire" warning timer
79
+ * (see SmartComplyFlow.initialize()) has nothing to schedule against and
80
+ * is skipped for a resumed session.
81
+ */
82
+ resumeSession(resumeToken) {
83
+ this._sessionToken = resumeToken;
84
+ this._sessionExpiresAt = null;
85
+ this.http.setSessionToken(resumeToken);
86
+ }
60
87
  /**
61
88
  * Fetch SDK configuration from the backend.
62
- * Must be called after createSession().
89
+ * Must be called after createSession() or resumeSession().
63
90
  *
64
91
  * GET /v1/initialize/
65
92
  * Auth: x-access-token: <sessionToken>
@@ -71,6 +98,19 @@ export class SmartComply {
71
98
  this._sdkConfig = config;
72
99
  return config;
73
100
  }
101
+ /**
102
+ * Resolve a resume_token to the entry/step it's resuming, without
103
+ * consuming the single-use resume binding (unlike create/, which does).
104
+ * Only meaningful after resumeSession() — a normal createSession()
105
+ * session was never issued for a resume, so this returns a 404
106
+ * (NOT_A_RESUME_TOKEN) for it, same as the backend.
107
+ *
108
+ * GET /v1/sdk/liveness/resume-info/
109
+ * Auth: x-access-token: <sessionToken>
110
+ */
111
+ async getResumeInfo() {
112
+ return this.http.sessionRequest("GET", "/v1/sdk/liveness/resume-info/");
113
+ }
74
114
  }
75
115
  /**
76
116
  * Package version, hardcoded to match package.json — bump this alongside
@@ -81,5 +121,5 @@ export class SmartComply {
81
121
  * CDN tag they installed with (e.g. @1, which floats to the latest
82
122
  * matching release) actually resolved to the version they expect.
83
123
  */
84
- SmartComply.VERSION = "1.0.88";
124
+ SmartComply.VERSION = "1.0.90";
85
125
  //# sourceMappingURL=Smartcomply.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Smartcomply.js","sourceRoot":"","sources":["../../../src/client/Smartcomply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAM5C;;;;;;;;GAQG;AACH,MAAM,OAAO,WAAW;IAqBtB,YAAY,MAAiB;QAPrB,kBAAa,GAAkB,IAAI,CAAC;QACpC,sBAAiB,GAAkB,IAAI,CAAC;QACxC,eAAU,GAAyB,IAAI,CAAC;QAM9C,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QACnF,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAEnC,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,CAAC,I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AAC,aAAa;QACjB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CACtC,MAAM,EACN,qBAAqB,EACrB,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC7B,CAAC;QAEF,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,UAAU,CAAC;QAE7C,mEAAmE;QACnE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE1C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,aAAa,CAAC,WAAmB;QAC/B,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,gBAAgB;QACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAC3C,KAAK,EACL,iBAAiB,CAClB,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAC7B,KAAK,EACL,+BAA+B,CAChC,CAAC;IACJ,CAAC;;AA3ID;;;;;;;;GAQG;AACa,mBAAO,GAAG,QAAQ,AAAX,CAAY"}
@@ -6,6 +6,29 @@ export interface FlowOptions {
6
6
  clientId: string;
7
7
  environment?: Environment;
8
8
  timeout?: number;
9
+ /**
10
+ * Resume a previously-failed verification instead of starting a new
11
+ * session — the token from a client-initiated resubmit invite (the
12
+ * "Resubmit" action on a failed session in the Adhere dashboard). Read
13
+ * this from wherever your own resume link puts it (a query param, a
14
+ * deep-link payload, etc.) and pass it straight through here; the SDK
15
+ * does not parse the host page's URL itself.
16
+ *
17
+ * Authenticates the widget as the resumed session (instead of creating a
18
+ * new one) and looks up which step failed, so the customer lands
19
+ * directly on document_capture or liveness instead of the welcome
20
+ * screen — skipping country/ID-type selection, which is pre-filled from
21
+ * the original attempt. Falls back to the normal welcome screen if that
22
+ * lookup doesn't resolve cleanly (an already-used/expired token, or the
23
+ * original channel no longer exists in this config); the resume itself
24
+ * still works correctly via the backend's own resume-match once
25
+ * create/submit is called either way — this only affects which screen
26
+ * is shown first.
27
+ *
28
+ * A data-verification/liveness-only failure has no document channel to
29
+ * re-select, so it goes straight to the liveness step.
30
+ */
31
+ resumeToken?: string;
9
32
  onComplete?: (result: FlowResult) => void;
10
33
  onError?: (error: Error) => void;
11
34
  onClose?: () => void;
@@ -98,6 +121,7 @@ export declare class SmartComplyFlow {
98
121
  close(): void;
99
122
  private mount;
100
123
  private initialize;
124
+ private _resolveResumeStep;
101
125
  private _showExpiryWarningWhenSafe;
102
126
  private static readonly MAX_EXPIRY_DEFERRALS;
103
127
  private _expiryDeferrals;
@@ -1 +1 @@
1
- {"version":3,"file":"SmartComplyFlow.d.ts","sourceRoot":"","sources":["../../../src/flow/SmartComplyFlow.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIxF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAoB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA2CxE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,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BAAwB;IAqBhC,OAAO,CAAC,cAAc;IAUtB;;OAEG;YACW,4BAA4B;IAiB1C;;OAEG;YACW,mBAAmB;IA+GjC,OAAO,CAAC,6BAA6B;IA8DrC,OAAO,CAAC,cAAc;IA4HtB,OAAO,CAAC,aAAa;IAsGrB,OAAO,CAAC,YAAY;IAqHpB,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,gBAAgB;IAmDxB,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,qBAAqB;IAmB7B,sGAAsG;IACtG,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,cAAc;IAgBtB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,cAAc;IAmFtB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,YAAY;CAiCrB"}
@@ -607,23 +607,32 @@ export class SmartComplyFlow {
607
607
  async initialize() {
608
608
  this.showStep("loading");
609
609
  try {
610
- // Create session
611
- await this.sdk.createSession();
612
- // C4: Start session expiry timer (warn 2 min before 30-min expiry)
613
- const expiresAt = this.sdk.sessionExpiresAt;
614
- if (expiresAt) {
615
- const expiresMs = new Date(expiresAt).getTime() - Date.now();
616
- const warnMs = Math.max(expiresMs - 120000, 0); // warn 2 min before
617
- this.sessionExpiryTimer = setTimeout(() => this._showExpiryWarningWhenSafe(), warnMs);
618
- // The warning above is advisory only and can defer indefinitely
619
- // while the user sits on a camera-active step — without a hard
620
- // stop, an ignored/deferred warning left the widget open against
621
- // an already-expired backend session (SessionToken.expires_at,
622
- // 30 min — see sdk/views.py's SessionToken.objects.create call)
623
- // for as long as the host page stayed open. Force-close once the
624
- // real deadline passes so the widget's lifetime never exceeds
625
- // what the backend actually honors.
626
- this.sessionExpiredTimer = setTimeout(() => this._enforceSessionExpiry(), Math.max(expiresMs, 0));
610
+ if (this.options.resumeToken) {
611
+ // A resume_token IS already a valid session on the backend — no
612
+ // creation call, and no client-side expiry warning to schedule
613
+ // (see resumeSession()'s own doc comment for why). The backend
614
+ // still enforces the real expiry regardless; a request made after
615
+ // it has genuinely lapsed is rejected there, same as any session.
616
+ this.sdk.resumeSession(this.options.resumeToken);
617
+ }
618
+ else {
619
+ await this.sdk.createSession();
620
+ // C4: Start session expiry timer (warn 2 min before 30-min expiry)
621
+ const expiresAt = this.sdk.sessionExpiresAt;
622
+ if (expiresAt) {
623
+ const expiresMs = new Date(expiresAt).getTime() - Date.now();
624
+ const warnMs = Math.max(expiresMs - 120000, 0); // warn 2 min before
625
+ this.sessionExpiryTimer = setTimeout(() => this._showExpiryWarningWhenSafe(), warnMs);
626
+ // The warning above is advisory only and can defer indefinitely
627
+ // while the user sits on a camera-active step — without a hard
628
+ // stop, an ignored/deferred warning left the widget open against
629
+ // an already-expired backend session (SessionToken.expires_at,
630
+ // 30 min — see sdk/views.py's SessionToken.objects.create call)
631
+ // for as long as the host page stayed open. Force-close once the
632
+ // real deadline passes so the widget's lifetime never exceeds
633
+ // what the backend actually honors.
634
+ this.sessionExpiredTimer = setTimeout(() => this._enforceSessionExpiry(), Math.max(expiresMs, 0));
635
+ }
627
636
  }
628
637
  // Load config
629
638
  this.sdkConfig = await this.sdk.initializeConfig();
@@ -645,12 +654,78 @@ export class SmartComplyFlow {
645
654
  }
646
655
  if (this.isDestroyed)
647
656
  return;
648
- this.showStep("welcome");
657
+ this.showStep(this.options.resumeToken ? await this._resolveResumeStep() : "welcome");
649
658
  }
650
659
  catch (err) {
651
660
  this.showErrorStep(err.message || "Failed to initialize. Please try again.");
652
661
  }
653
662
  }
663
+ // Resolves a resume_token to the step the customer should land on,
664
+ // pre-selecting the same country/ID type the original attempt used (the
665
+ // same state renderCountrySelect/renderIdTypeSelect's own click handlers
666
+ // set) so document_capture/liveness render correctly instead of assuming
667
+ // state that was never set. Falls back to "welcome" on anything that
668
+ // doesn't resolve cleanly — this is a UX improvement, not a requirement:
669
+ // the backend's own resume-match at create/ time still works correctly
670
+ // even if the widget can't figure out which screen to pre-select.
671
+ async _resolveResumeStep() {
672
+ try {
673
+ const info = await this.sdk.getResumeInfo();
674
+ if (info.verification_type === "liveness_only" ||
675
+ info.failure_stage === "liveness" ||
676
+ // data_match is always a selfie-vs-identity-photo mismatch (see the
677
+ // backend's own comment in _process_identity_face_match) — fixed by
678
+ // redoing the selfie/video, same as a "liveness" failure. There is
679
+ // no document step in data verification at all, so this can never
680
+ // legitimately need document_capture.
681
+ info.failure_stage === "data_match") {
682
+ // Nothing to re-select — there's no document channel to pick, just
683
+ // liveness itself to redo. selectedCountry still needs a non-blank
684
+ // value (renderLiveness sends it as a required field) the same way
685
+ // the liveness-only welcome-screen path already handles this.
686
+ this.selectedCountry = info.country || this.selectedCountry || "global";
687
+ return "liveness";
688
+ }
689
+ if (info.failure_stage === "document" && info.country && info.identifier_type) {
690
+ const channels = this.sdkConfig?.channels || {};
691
+ const idTypes = channels[info.country] || [];
692
+ const match = idTypes.find((idType) => {
693
+ const code = typeof idType === "string" ? idType : (idType.code || idType.name);
694
+ return code === info.identifier_type;
695
+ });
696
+ if (match) {
697
+ const typeName = typeof match === "string" ? match : match.name;
698
+ const typeCode = typeof match === "string" ? match : (match.code || match.name);
699
+ const channelFields = typeof match !== "string" ? (match.fields || []) : [];
700
+ const isDocFlow = channelFields.some((f) => isUploadFieldType(f.type)) || this.isDocumentFlow();
701
+ const info2 = resolveIdTypeInfo(typeName, isDocFlow);
702
+ const requiresBackFromBackend = typeof match !== "string" ? match.requires_back_side : undefined;
703
+ this.selectedCountry = info.country;
704
+ this.selectedIdType = typeCode;
705
+ this.selectedIdTypeName = typeName;
706
+ this.selectedRequiresBack = requiresBackFromBackend ?? info2.requiresBack;
707
+ if (typeof match !== "string") {
708
+ this.selectedChannelId = match.id;
709
+ this.selectedChannelFields = match.fields || [];
710
+ }
711
+ return "document_capture";
712
+ }
713
+ // Channel from the original submission no longer exists in this
714
+ // config (e.g. it was disabled since) — fall through to welcome
715
+ // rather than render document_capture with no title/back-side info.
716
+ }
717
+ // Nothing above matched cleanly (e.g. a document channel that no
718
+ // longer exists in this config) — the entry is still correctly bound
719
+ // server-side regardless of which screen the widget shows first.
720
+ return "welcome";
721
+ }
722
+ catch {
723
+ // NOT_A_RESUME_TOKEN / RESUME_TARGET_UNAVAILABLE / network error —
724
+ // never block the flow on this lookup. create/'s own resume-match
725
+ // still runs correctly once the customer gets there.
726
+ return "welcome";
727
+ }
728
+ }
654
729
  // Defers the expiry warning while the user is on a camera-active step
655
730
  // (document_capture/liveness) — showing it there would blow away a live
656
731
  // video element and in-progress MediaRecorder mid-scan.