@velion-la/onboarding-sdk-web 1.0.0-beta.8 → 1.0.0
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 +26 -24
- package/dist/velion-sdk.es.js +1 -1
- package/dist/velion-sdk.es.js.map +1 -1
- package/dist/velion-sdk.umd.js +1 -1
- package/dist/velion-sdk.umd.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# @velion-la/onboarding-sdk (Loader)
|
|
1
|
+
# @velion-la/onboarding-sdk-web (Loader)
|
|
2
2
|
|
|
3
|
-
Thin client for the Velion Onboarding flow. This package creates an iframe that loads the **full onboarding
|
|
3
|
+
Thin client for the Velion Onboarding flow. This package creates an iframe that loads the **full onboarding runtime** from the Velion CDN (`https://static.velion.la/sdk/onboarding/v1` by default) and bridges configuration and events via postMessage. The published bundle is ~3.5 kB gzip; the heavy UI (document capture, liveness, fingerprint) runs inside the iframe and updates without changing your integration.
|
|
4
4
|
|
|
5
|
-
[npm](https://www.npmjs.com/package/@velion-la/onboarding-sdk) · [License](./LICENSE)
|
|
5
|
+
[npm](https://www.npmjs.com/package/@velion-la/onboarding-sdk-web) · [License](./LICENSE)
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ Your backend defines which steps are required per session; the SDK (loader + app
|
|
|
13
13
|
**Key points:**
|
|
14
14
|
|
|
15
15
|
- **Zero framework dependency for consumers.** Works with Angular, Vue, React, or plain HTML.
|
|
16
|
-
- **Optional `cdnUrl`.** Default is `https://static.velion.la/sdk`. Override for
|
|
16
|
+
- **Optional `cdnUrl`.** Default is `https://static.velion.la/sdk/onboarding/v1`. Override only for the development CDN or a self-hosted runtime.
|
|
17
17
|
- **Same API.** `VelionOnboarding`, `onSuccess`, `onError`, `onStepChange`, theme, etc. unchanged.
|
|
18
18
|
|
|
19
19
|
---
|
|
@@ -21,9 +21,9 @@ Your backend defines which steps are required per session; the SDK (loader + app
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm install @velion-la/onboarding-sdk
|
|
25
|
-
# or: yarn add @velion-la/onboarding-sdk
|
|
26
|
-
# or: pnpm add @velion-la/onboarding-sdk
|
|
24
|
+
npm install @velion-la/onboarding-sdk-web
|
|
25
|
+
# or: yarn add @velion-la/onboarding-sdk-web
|
|
26
|
+
# or: pnpm add @velion-la/onboarding-sdk-web
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
---
|
|
@@ -31,7 +31,7 @@ npm install @velion-la/onboarding-sdk
|
|
|
31
31
|
## Quick Start
|
|
32
32
|
|
|
33
33
|
```typescript
|
|
34
|
-
import { VelionOnboarding, SdkErrorCode } from '@velion-la/onboarding-sdk';
|
|
34
|
+
import { VelionOnboarding, SdkErrorCode } from '@velion-la/onboarding-sdk-web';
|
|
35
35
|
|
|
36
36
|
const { session_id, session_token, expires_at } = await fetch('/api/kyc/sessions', {
|
|
37
37
|
method: 'POST',
|
|
@@ -42,7 +42,7 @@ const sdk = new VelionOnboarding({
|
|
|
42
42
|
sessionId: session_id,
|
|
43
43
|
sessionToken: session_token,
|
|
44
44
|
expiresAt: expires_at,
|
|
45
|
-
apiUrl: 'https://<your-domain>.velion.la/gateway/api/v1/onboarding',
|
|
45
|
+
apiUrl: 'https://<your-domain>.velion.la/gateway/api/v1/onboarding/public/sdk',
|
|
46
46
|
locale: 'es',
|
|
47
47
|
theme: { primaryColor: '#0052CC', borderRadius: '10px' },
|
|
48
48
|
onSuccess: (result) => console.log('Done:', result.status),
|
|
@@ -81,7 +81,7 @@ or full viewport height:
|
|
|
81
81
|
}
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
More detail: [
|
|
84
|
+
More detail: [web/README.md](../web/README.md) (integration notes for the hosted runtime).
|
|
85
85
|
|
|
86
86
|
---
|
|
87
87
|
|
|
@@ -92,16 +92,20 @@ More detail: [app/README.md](../app/README.md) (integration notes for the hosted
|
|
|
92
92
|
| `containerId` | `string` | ✓ | — | `id` of the DOM element where the iframe is inserted. |
|
|
93
93
|
| `sessionId` | `string` | ✓ | — | Session identifier from your backend. |
|
|
94
94
|
| `sessionToken` | `string` | ✓ | — | Short-lived Bearer token (e.g. JWT). |
|
|
95
|
-
| `apiUrl` | `string` | ✓ | — | Gateway base URL (no trailing slash). |
|
|
96
|
-
| `cdnUrl` | `string` | | `'https://static.velion.la/sdk'
|
|
97
|
-
| `expiresAt` | `string` | | — | ISO-8601 token expiry. |
|
|
95
|
+
| `apiUrl` | `string` | ✓ | — | Gateway base URL for the SDK chain, ending in `/public/sdk` (no trailing slash, `https://`). |
|
|
96
|
+
| `cdnUrl` | `string` | | `'https://static.velion.la/sdk/onboarding/v1'` | Base URL of the onboarding runtime (iframe source). |
|
|
97
|
+
| `expiresAt` | `string` | | — | ISO-8601 token expiry (`expires_at` from session creation; 30 minutes by default). |
|
|
98
98
|
| `theme` | `VelionTheme` | | — | Primary color, border radius, etc. |
|
|
99
99
|
| `locale` | `string` | | `'es'` | BCP 47 locale for UI. |
|
|
100
100
|
| `onSuccess` | `(result: OnboardingResult) => void` | | — | Called when the flow completes. |
|
|
101
101
|
| `onError` | `(error: SdkError) => void` | | — | Called on unrecoverable errors. |
|
|
102
102
|
| `onStepChange` | `(step, index, total) => void` | | — | Called when the active step changes. |
|
|
103
103
|
| `onStepComplete` | `(step: OnboardingStep) => void` | | — | Called after each step succeeds. |
|
|
104
|
+
| `onExit` | `(exit: OnboardingExit) => void` | | — | Called when the user leaves without a verdict (`reason: 'BACK_EXIT' \| 'RETRY_CANCELLED'`). Neither `onSuccess` nor `onError` fires; dismiss the SDK surface. |
|
|
105
|
+
| `onLivenessVideoUploaded` | `(ref: LivenessVideoRef) => void` | | — | Called once the `LIVENESS_MATCH` step stored its session video (GCS PUT returned 200). `ref` is `{ upload_url, content_type, duration_ms, size_bytes }`. Best-effort: not called when recording was disabled or the upload failed. |
|
|
106
|
+
| `retryStepTexts` | `VelionRetryStepTexts` | | — | Per-step copy override for the retry dialog shown on a backend `RETRY_STEP`. Keyed by step code. |
|
|
104
107
|
| `onTokenExpired` | `() => Promise<{ sessionToken: string; expiresAt?: string }>` | | — | Optional. When the iframe reports token expiry, return a new token so the flow can continue. |
|
|
108
|
+
| `runtimeReadyTimeoutMs` | `number` | | `30000` | How long to wait, after the iframe document loaded, for the runtime to report ready. Past it `onError` fires with `RUNTIME_LOAD_FAILED` instead of leaving a blank iframe (e.g. a CDN whose `index.html` points at missing assets). |
|
|
105
109
|
|
|
106
110
|
All other options from the full SDK (e.g. `livenessDisplayText`) are passed through to the app in the iframe.
|
|
107
111
|
|
|
@@ -110,7 +114,7 @@ All other options from the full SDK (e.g. `livenessDisplayText`) are passed thro
|
|
|
110
114
|
## Instance methods
|
|
111
115
|
|
|
112
116
|
- **`sdk.start(): Promise<void>`** — Starts the flow (loads iframe, sends config).
|
|
113
|
-
- **`sdk.getStatus(): SdkStatus`** — Returns current state (`'IDLE'` \| `'RUNNING'` \| `'COMPLETED'` \| `'ERROR'` \| `'DESTROYED'`).
|
|
117
|
+
- **`sdk.getStatus(): SdkStatus`** — Returns current state (`'IDLE'` \| `'INITIALIZING'` \| `'RUNNING'` \| `'COMPLETED'` \| `'EXITED'` \| `'ERROR'` \| `'DESTROYED'`).
|
|
114
118
|
- **`sdk.destroy(): void`** — Removes the iframe and cleans up. Idempotent.
|
|
115
119
|
- **`VelionOnboarding.getVersion(): string`** — Static; returns SDK version.
|
|
116
120
|
|
|
@@ -120,13 +124,15 @@ All other options from the full SDK (e.g. `livenessDisplayText`) are passed thro
|
|
|
120
124
|
|
|
121
125
|
```html
|
|
122
126
|
<div id="kyc-container"></div>
|
|
123
|
-
|
|
127
|
+
<!-- Serve the UMD build from your own origin, e.g. copied from
|
|
128
|
+
node_modules/@velion-la/onboarding-sdk-web/dist/velion-sdk.umd.js -->
|
|
129
|
+
<script src="/vendor/velion-sdk.umd.js"></script>
|
|
124
130
|
<script>
|
|
125
131
|
const sdk = new VelionSDK.VelionOnboarding({
|
|
126
132
|
containerId: 'kyc-container',
|
|
127
133
|
sessionId: '...',
|
|
128
134
|
sessionToken: '...',
|
|
129
|
-
apiUrl: 'https://<your-domain>.velion.la/gateway/api/v1/onboarding',
|
|
135
|
+
apiUrl: 'https://<your-domain>.velion.la/gateway/api/v1/onboarding/public/sdk',
|
|
130
136
|
onSuccess: (r) => console.log(r.status),
|
|
131
137
|
onError: (e) => console.error(e.code, e.message),
|
|
132
138
|
});
|
|
@@ -140,23 +146,19 @@ The UMD bundle exposes `window.VelionSDK`.
|
|
|
140
146
|
|
|
141
147
|
## Error handling
|
|
142
148
|
|
|
143
|
-
Errors are delivered via `onError` with a `SdkError` object (`code`, `message`, optional `cameraCode`, `httpStatus`, `cause`). Common codes: `SESSION_EXPIRED`, `SESSION_FETCH_FAILED`, `CAMERA_ERROR`, `CONTAINER_NOT_FOUND`, `FINGERPRINT_FAILED`, `LIVENESS_FAILED`, etc.
|
|
149
|
+
Errors are delivered via `onError` with a `SdkError` object (`code`, `message`, optional `cameraCode`, `httpStatus`, `cause`). Common codes: `SESSION_EXPIRED`, `SESSION_FETCH_FAILED`, `CAMERA_ERROR`, `CONTAINER_NOT_FOUND`, `FINGERPRINT_FAILED`, `LIVENESS_FAILED`, etc. Session tokens last 30 minutes by default: provide `onTokenExpired` so the host can mint a new one (`POST /public/api-key/onboarding/sessions/{id}/tokens` from your backend) and the flow resumes where it was.
|
|
144
150
|
|
|
145
151
|
---
|
|
146
152
|
|
|
147
153
|
## Backend and CDN
|
|
148
154
|
|
|
149
|
-
- Your **backend**
|
|
150
|
-
- The **
|
|
155
|
+
- Your **backend** creates the session against the Velion gateway with your public API key (`POST /public/api-key/onboarding/sessions`, scope `write:onboarding`) and hands `session_id`, `session_token` and `expires_at` to the page. The loader passes `apiUrl` and `sessionToken` to the runtime; every SDK request (`GET /sessions/:id`, the SSE stream, each step's `POST`) is made from the iframe with the session JWT. Your backend never proxies those calls.
|
|
156
|
+
- The **runtime** is served from the Velion CDN at `cdnUrl` (default `https://static.velion.la/sdk/onboarding/v1`; development builds live at `https://static.development.us-central1.velion.cloud/sdk/onboarding/v1`). It is deployed by this repository's CI from the `web/` workspace, together with an Ed25519-signed `manifest.json` the loader verifies before mounting the iframe. Hosts never deploy it themselves.
|
|
151
157
|
|
|
152
158
|
---
|
|
153
159
|
|
|
154
160
|
## Publishing (maintainers)
|
|
155
161
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
1. `npm run build`
|
|
159
|
-
2. `npm version patch|minor|major`
|
|
160
|
-
3. `npm publish`
|
|
162
|
+
The loader is published by CI, not by hand: every push to `develop` publishes a pre-release under the `beta` dist-tag, and `main` publishes stable versions under `latest`. The full procedure (release branch, version bump, CDN deploy, manifest signing) is in [docs/RELEASING.md](../docs/RELEASING.md).
|
|
161
163
|
|
|
162
164
|
`files` in `package.json` includes `dist`, `README.md`, and `LICENSE`.
|
package/dist/velion-sdk.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=/* @__PURE__ */(e=>(e.PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",e.DEVICE_NOT_FOUND="CAMERA_DEVICE_NOT_FOUND",e.DEVICE_NOT_READABLE="CAMERA_DEVICE_NOT_READABLE",e.INSECURE_CONTEXT="CAMERA_INSECURE_CONTEXT",e.POLICY_BLOCKED="CAMERA_POLICY_BLOCKED",e.NOT_SUPPORTED="CAMERA_NOT_SUPPORTED",e.WEBVIEW_BLOCKED="CAMERA_WEBVIEW_BLOCKED",e.CONSTRAINT_ERROR="CAMERA_CONSTRAINT_ERROR",e.UNKNOWN="CAMERA_UNKNOWN_ERROR",e))(e||{}),t=/* @__PURE__ */(e=>(e.SESSION_INVALID="SESSION_INVALID",e.SESSION_EXPIRED="SESSION_EXPIRED",e.SESSION_FETCH_FAILED="SESSION_FETCH_FAILED",e.SESSION_DECLINED="SESSION_DECLINED",e.FINGERPRINT_FAILED="FINGERPRINT_FAILED",e.DOCUMENT_UPLOAD_FAILED="DOCUMENT_UPLOAD_FAILED",e.LIVENESS_FAILED="LIVENESS_FAILED",e.LIVENESS_INIT_FAILED="LIVENESS_INIT_FAILED",e.LIVENESS_VIDEO_UPLOAD_FAILED="LIVENESS_VIDEO_UPLOAD_FAILED",e.CAMERA_ERROR="CAMERA_ERROR",e.NETWORK_ERROR="NETWORK_ERROR",e.API_ERROR="API_ERROR",e.CONTAINER_NOT_FOUND="CONTAINER_NOT_FOUND",e.ALREADY_STARTED="ALREADY_STARTED",e.INSTANCE_DESTROYED="INSTANCE_DESTROYED",e.INSECURE_EMBED="INSECURE_EMBED",e.INTEGRITY_FAILED="INTEGRITY_FAILED",e.UNKNOWN="UNKNOWN",e))(t||{});const n="VELION_INIT",i="VELION_READY",s="VELION_SUCCESS",r="VELION_ERROR",o="VELION_STEP_CHANGE",a="VELION_STEP_COMPLETE",E="VELION_TOKEN_EXPIRED",c="VELION_TOKEN",l="lpqLG4Ta0YyBn/+lQh95tFl4CuTIHWapeeq7+xnPH+U=";function d(e){const t=atob(e),n=new ArrayBuffer(t.length),i=new Uint8Array(n);for(let s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return n}async function h(e,t=l){let n,i,s,r,o,a;try{const t=await fetch(`${e}/manifest.json`,{credentials:"omit",cache:"no-cache",redirect:"error"});if(404===t.status)return{ok:!1,reason:"unavailable"};if(!t.ok)return{ok:!1,reason:"unavailable",detail:`HTTP ${t.status}`};n=await t.arrayBuffer(),i=(new TextDecoder).decode(n)}catch(E){return{ok:!1,reason:"unavailable",detail:E.message}}try{if(s=JSON.parse(i),"string"!=typeof s.version||"string"!=typeof s.entry||"string"!=typeof s.buildTime)return{ok:!1,reason:"malformed"}}catch(E){return{ok:!1,reason:"malformed",detail:E.message}}if(!t)return{ok:!0,manifest:s,signed:!1};try{const t=await fetch(`${e}/manifest.sig`,{credentials:"omit",cache:"no-cache",redirect:"error"});if(!t.ok)return{ok:!1,reason:"invalid_signature",detail:`sig HTTP ${t.status}`};r=d((await t.text()).trim())}catch(E){return{ok:!1,reason:"invalid_signature",detail:E.message}}try{o=await async function(e){const t=d(e);return crypto.subtle.importKey("raw",t,{name:"Ed25519"},!1,["verify"])}(t)}catch(E){return{ok:!1,reason:"invalid_signature",detail:`pubkey import failed: ${E.message}`}}try{a=await async function(e,t,n){return crypto.subtle.verify({name:"Ed25519"},e,t,n)}(o,r,n)}catch(E){return{ok:!1,reason:"invalid_signature",detail:E.message}}return a?{ok:!0,manifest:s,signed:!0}:{ok:!1,reason:"invalid_signature"}}const f="https://static.velion.la/sdk/onboarding/v1";function I(e){try{const n=new URL(e);return"https:"===n.protocol||"http:"===n.protocol&&("localhost"===(t=n.hostname)||"127.0.0.1"===t||"::1"===t||t.endsWith(".local"))}catch{return!1}var t}const u=["containerId","sessionId","sessionToken","apiUrl","expiresAt","theme","colorMode","locale","allowEmbedded","livenessShowIntro","livenessShowBackButton","fingerprintEndpoint","debug","googleMapsApiKey","showFinalResultScreen","showProgressBar","finalResultScreenTexts"];class N{constructor(e){this.status="IDLE",this.iframe=null,this.container=null,this.messageHandler=null,this.containerResizeObserver=null,this.iframeHeightWindowResizeHandler=null,this.cdnOrigin="",this.config=Object.freeze({...e})}async start(){if("DESTROYED"===this.status)return void this.config.onError?.({code:t.INSTANCE_DESTROYED,message:"This VelionOnboarding instance has been destroyed. Create a new instance to retry."});if("IDLE"!==this.status)return void this.config.onError?.({code:t.ALREADY_STARTED,message:"start() was called on an already-running SDK instance. Call destroy() before re-starting."});const e=document.getElementById(this.config.containerId);if(!e)return void this.config.onError?.({code:t.CONTAINER_NOT_FOUND,message:`No DOM element found with id="${this.config.containerId}". Ensure the element exists before calling start().`});const l=(this.config.cdnUrl??f).replace(/\/$/,"");if(!I(l))return void this.config.onError?.({code:t.UNKNOWN,message:`Insecure cdnUrl: "${l}". Must be https:// (http:// is allowed only for localhost).`});if(this.config.apiUrl&&!I(this.config.apiUrl))return void this.config.onError?.({code:t.UNKNOWN,message:`Insecure apiUrl: "${this.config.apiUrl}". Must be https:// (http:// is allowed only for localhost).`});if(this.cdnOrigin=function(e){try{return new URL(e).origin}catch{return""}}(l),!this.cdnOrigin)return void this.config.onError?.({code:t.UNKNOWN,message:`Invalid cdnUrl: ${l}. Must be a valid absolute URL.`});this.container=e,this.status="INITIALIZING";const d=document.createElement("iframe");d.setAttribute("title","Velion Onboarding"),d.setAttribute("allow","camera"),d.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-popups allow-modals"),d.setAttribute("referrerpolicy","no-referrer"),d.style.width="100%",d.style.border="none",d.style.display="block";const h=e=>{if(e.origin!==this.cdnOrigin)return;if(e.source!==this.iframe?.contentWindow)return;const n=e.data;if(n&&"string"==typeof n.type)switch(n.type){case i:this.status="RUNNING";break;case s:this.status="COMPLETED",this.config.onSuccess?.(n.payload);break;case r:this.status="ERROR",this.config.onError?.(n.payload);break;case o:{const e=n.payload;this.config.onStepChange?.(e.step,e.stepIndex);break}case a:{const e=n.payload;this.config.onStepComplete?.(e.step);break}case"VELION_EXIT":this.status="EXITED",this.config.onExit?.(n.payload);break;case E:{const e=this.config.onTokenExpired;e?e().then(e=>this.sendToIframe({type:c,payload:e}),()=>{this.config.onError?.({code:t.SESSION_EXPIRED,message:"Token refresh failed."})}):this.config.onError?.({code:t.SESSION_EXPIRED,message:"Session token expired. Provide onTokenExpired in config to refresh."});break}}};window.addEventListener("message",h),this.messageHandler=h,this.iframe=d,e.replaceChildren(d),this.attachIframeHeightSync(e,d);const N=await this.resolveManifest(l);if(!N)return;const R=N.entry.startsWith("/")?N.entry:`/${N.entry}`;return new Promise(e=>{d.onload=()=>{if(!this.iframe?.contentWindow)return this.status="ERROR",this.config.onError?.({code:t.UNKNOWN,message:"Iframe failed to load."}),void e();const i=function(e){const t={containerId:"velion-sdk-root",allowEmbedded:!0};for(const n of u){if("containerId"===n||"allowEmbedded"===n)continue;const i=e[n];void 0!==i&&"function"!=typeof i&&(t[n]=i)}return t}(this.config);let s;try{s=JSON.parse(JSON.stringify(i))}catch{s=i}this.sendToIframe({type:n,payload:s}),this.status="RUNNING",e()},d.onerror=()=>{this.status="ERROR",this.config.onError?.({code:t.UNKNOWN,message:`Failed to load onboarding app from ${l}. Check cdnUrl and network.`}),e()},d.src=`${l}${R}`})}async resolveManifest(e){let n;try{n=await h(e)}catch(i){return this.status="ERROR",this.config.onError?.({code:t.INTEGRITY_FAILED,message:`Manifest verification crashed unexpectedly: ${i.message}`}),null}if(n.ok)return!n.signed&&l?(this.status="ERROR",this.config.onError?.({code:t.INTEGRITY_FAILED,message:"Internal: manifest reported as unsigned despite pubkey being set."}),null):n.manifest;if("unavailable"===n.reason){return!0!==this.config.allowUnverifiedCdn?(this.status="ERROR",this.config.onError?.({code:t.INTEGRITY_FAILED,message:`CDN at "${e}" did not expose /manifest.json. The loader is configured to require a signed manifest. If the CDN is migrating, set \`allowUnverifiedCdn: true\` on the loader config — but only as a temporary measure.`}),null):{version:"legacy",buildTime:/* @__PURE__ */(new Date).toISOString(),entry:"/index.html"}}return this.status="ERROR",this.config.onError?.({code:t.INTEGRITY_FAILED,message:`CDN manifest at "${e}/manifest.json" failed integrity check (${n.reason}). Refusing to load the iframe to protect the user. `+("detail"in n&&n.detail?`Detail: ${n.detail}`:"")}),null}attachIframeHeightSync(e,t){const n=()=>{if(this.iframe!==t||this.container!==e)return;const n=e.clientHeight;n>0?(t.style.height=`${n}px`,t.style.minHeight=""):(t.style.height="min(85vh, 880px)",t.style.minHeight="")};n(),requestAnimationFrame(n),requestAnimationFrame(()=>{requestAnimationFrame(n)}),"undefined"!=typeof ResizeObserver?(this.containerResizeObserver=new ResizeObserver(n),this.containerResizeObserver.observe(e)):(this.iframeHeightWindowResizeHandler=n,window.addEventListener("resize",n))}detachIframeHeightSync(){this.containerResizeObserver&&(this.containerResizeObserver.disconnect(),this.containerResizeObserver=null),this.iframeHeightWindowResizeHandler&&(window.removeEventListener("resize",this.iframeHeightWindowResizeHandler),this.iframeHeightWindowResizeHandler=null)}sendToIframe(e){this.iframe?.contentWindow&&this.iframe.contentWindow.postMessage(e,this.cdnOrigin)}getStatus(){return this.status}static getVersion(){return"1.0.0-beta.8"}destroy(){"DESTROYED"!==this.status&&(this.detachIframeHeightSync(),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.iframe&&this.container&&(this.iframe.remove(),this.container.replaceChildren()),this.iframe=null,this.container=null,this.status="DESTROYED")}}function R(e){}export{e as CameraErrorCode,f as DEFAULT_CDN_URL,t as SdkErrorCode,r as VELION_MSG_ERROR,n as VELION_MSG_INIT,i as VELION_MSG_READY,o as VELION_MSG_STEP_CHANGE,a as VELION_MSG_STEP_COMPLETE,s as VELION_MSG_SUCCESS,c as VELION_MSG_TOKEN,E as VELION_MSG_TOKEN_EXPIRED,N as VelionOnboarding,R as setOpenCVBaseUrl};
|
|
1
|
+
var e=Object.defineProperty,t=(t,r,n)=>((t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n)(t,"symbol"!=typeof r?r+"":r,n),r=/* @__PURE__ */(e=>(e.PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",e.DEVICE_NOT_FOUND="CAMERA_DEVICE_NOT_FOUND",e.DEVICE_NOT_READABLE="CAMERA_DEVICE_NOT_READABLE",e.INSECURE_CONTEXT="CAMERA_INSECURE_CONTEXT",e.POLICY_BLOCKED="CAMERA_POLICY_BLOCKED",e.NOT_SUPPORTED="CAMERA_NOT_SUPPORTED",e.WEBVIEW_BLOCKED="CAMERA_WEBVIEW_BLOCKED",e.CONSTRAINT_ERROR="CAMERA_CONSTRAINT_ERROR",e.UNKNOWN="CAMERA_UNKNOWN_ERROR",e))(r||{}),n=/* @__PURE__ */(e=>(e.SESSION_INVALID="SESSION_INVALID",e.SESSION_EXPIRED="SESSION_EXPIRED",e.SESSION_FETCH_FAILED="SESSION_FETCH_FAILED",e.SESSION_DECLINED="SESSION_DECLINED",e.ROUTING_TIMEOUT="ROUTING_TIMEOUT",e.FINGERPRINT_FAILED="FINGERPRINT_FAILED",e.DOCUMENT_UPLOAD_FAILED="DOCUMENT_UPLOAD_FAILED",e.LIVENESS_FAILED="LIVENESS_FAILED",e.LIVENESS_INIT_FAILED="LIVENESS_INIT_FAILED",e.LIVENESS_VIDEO_UPLOAD_FAILED="LIVENESS_VIDEO_UPLOAD_FAILED",e.CAMERA_ERROR="CAMERA_ERROR",e.NETWORK_ERROR="NETWORK_ERROR",e.API_ERROR="API_ERROR",e.CONTAINER_NOT_FOUND="CONTAINER_NOT_FOUND",e.ALREADY_STARTED="ALREADY_STARTED",e.INSTANCE_DESTROYED="INSTANCE_DESTROYED",e.INSECURE_EMBED="INSECURE_EMBED",e.INTEGRITY_FAILED="INTEGRITY_FAILED",e.UNSUPPORTED_BROWSER="UNSUPPORTED_BROWSER",e.RUNTIME_LOAD_FAILED="RUNTIME_LOAD_FAILED",e.UNKNOWN="UNKNOWN",e))(n||{});const i="VELION_INIT",s="VELION_READY",o="VELION_SUCCESS",a="VELION_ERROR",c="VELION_STEP_CHANGE",f="VELION_STEP_COMPLETE",l="VELION_TOKEN_EXPIRED",d="VELION_EXIT",h="VELION_LIVENESS_VIDEO_UPLOADED",E="VELION_TOKEN",u=Object.freeze,g=0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,m=0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,R=0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,y=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,I=0x6666666666666666666666666666666666666666666666666666666666666658n,N=g-1n,O=u({p:g,n:m,h:8n,a:N,d:R,Gx:y,Gy:I}),p=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&1===e.BYTES_PER_ELEMENT,T=(e,t,r="")=>{if(p(e)&&(void 0===t||e.length===t))return e;const n=p(e),i=(r?`"${r}" `:"")+"expected Uint8Array"+(void 0!==t?` of length ${t}`:"")+", got "+(n?`length=${e.length}`:"type="+typeof e);if(!n)throw new TypeError(i);throw new RangeError(i)},w=(e,t)=>e.toString(16).padStart(t,"0"),_=e=>{let t="";for(const r of T(e))t+=w(r,2);return t},A=e=>{const t="hex invalid";if("string"!=typeof e)throw new TypeError(t);if(e.length%2||!/^[\da-f]*$/i.test(e))throw new RangeError(t);const r=new Uint8Array(e.length/2);for(let n=0,i=0;n<r.length;n++,i+=2){const t=e.charCodeAt(i),s=e.charCodeAt(i+1);r[n]=16*((15&t)+9*(t>>6))+(15&s)+9*(s>>6)}return r},S=(...e)=>{let t=0;for(const i of e)t+=T(i).length;const r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r},b=(e,t,r,n="bad number: out of range")=>{if("bigint"!=typeof e)throw new TypeError(n);if(t<=e&&e<r)return e;throw new RangeError(n)},D=(e,t=g)=>(e%=t)>=0n?e:t+e,v=(1n<<255n)-1n,L=e=>{if(e<0n)throw new RangeError("negative coordinate");let t=19n*(e>>255n)+(e&v);return t=19n*(t>>255n)+(t&v),t%g},U=async(e,...t)=>T(await(e=>{const t=X[e];if("function"!=typeof t)throw new Error("hashes."+e+" not set");return t})(e)(S(...t)),64,"digest"),C=e=>{if(e instanceof M)return e;throw new TypeError("Point expected")},k=2n**256n,x=class e{constructor(e,r,n,i){t(this,"X"),t(this,"Y"),t(this,"Z"),t(this,"T");const s=k;this.X=b(e,0n,s),this.Y=b(r,0n,s),this.Z=b(n,1n,s),this.T=b(i,0n,s),u(this)}static CURVE(){return O}static fromAffine(t){return new e(t.x,t.y,1n,L(t.x*t.y))}static fromBytes(t,r=!1){const n=((e,t="",r)=>Uint8Array.from(T(e,r,t)))(t,"point",32),i=n[31];n[31]=-129&i;const s=B(n);r||b(s,0n,g);const o=L(s*s),a=D(o-1n),c=L(R*o+1n);let{isValid:f,value:l}=Y(a,c);if(!f)throw new Error("bad point: y not sqrt");const d=!!(128&i);if(!r&&0n===l&&d)throw new Error("bad point: x==0, isLastByteOdd");return d!==!!(1n&l)&&(l=D(-l)),new e(l,s,1n,L(l*s))}static fromHex(t,r){return e.fromBytes(A(t),r)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const e=N,t=R;if(this.is0())throw new Error("bad point: ZERO");const{X:r,Y:n,Z:i,T:s}=this,o=L(r*r),a=L(n*n),c=L(i*i),f=L(c*c),l=L(o*e);if(L(c*(l+a))!==D(f+L(t*L(o*a))))throw new Error("bad point: equation left != right (1)");if(L(r*n)!==L(i*s))throw new Error("bad point: equation left != right (2)");return this}equals(e){const{X:t,Y:r,Z:n}=this,{X:i,Y:s,Z:o}=C(e);return L(t*o)===L(i*n)&&L(r*o)===L(s*n)}is0(){return this.equals(F)}negate(){return new e(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:r,Z:n}=this,i=N,s=L(t*t),o=L(r*r),a=L(2n*n*n),c=L(i*s),f=D(t+r),l=D(L(f*f)-s-o),d=D(c+o),h=D(d-a),E=D(c-o),u=L(l*h),g=L(d*E),m=L(l*E),R=L(h*d);return new e(u,g,R,m)}add(t){const{X:r,Y:n,Z:i,T:s}=this,{X:o,Y:a,Z:c,T:f}=C(t),l=N,d=R,h=L(r*o),E=L(n*a),u=L(L(s*d)*f),g=L(i*c),m=D(L(D(r+n)*D(o+a))-h-E),y=D(g-u),I=D(g+u),O=D(E-L(l*h)),p=L(m*y),T=L(I*O),w=L(m*O),_=L(y*I);return new e(p,T,_,w)}subtract(e){return this.add(C(e).negate())}multiply(e,t=!0){if(!t&&0n===e)return F;if(b(e,1n,m),!t&&this.is0())return F;if(1n===e)return this;if(this.equals(P))return q(e).p;let r=F,n=P,i=this;for(let s=0;t?s<256:e>0n;s++)1n&e?r=r.add(i):t&&(n=n.add(i)),i=i.double(),e>>=1n;return r}multiplyUnsafe(e){return this.multiply(e,!1)}toAffine(){const{X:e,Y:t,Z:r}=this;if(this.equals(F))return{x:0n,y:1n};const n=((e,t)=>{if(0n===e)throw new Error("invert: expected non-zero number");if(t<=1n)throw new Error("invert: expected modulus > 1, got "+t);let r=D(e,t),n=t,i=0n,s=1n;for(;0n!==r;){const e=n/r,t=n-r*e,o=i-s*e;n=r,r=t,i=s,s=o}if(1n!==n)throw new Error("invert: does not exist");return D(i,t)})(r,g);if(1n!==L(r*n))throw new Error("invalid inverse");return{x:L(e*n),y:L(t*n)}}toBytes(){const{x:e,y:t}=this.toAffine(),r=V(t);return r[31]|=1n&e?128:0,r}toHex(){return _(this.toBytes())}clearCofactor(){return this.multiply(8n,!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return this.multiply(m/2n,!1).double().add(this).is0()}};t(x,"BASE"),t(x,"ZERO");let M=x;const P=new M(y,I,1n,D(y*I)),F=new M(0n,1n,1n,0n);M.BASE=P,M.ZERO=F;const V=e=>A(w(b(e,0n,k),64)).reverse(),B=e=>BigInt("0x"+_(Uint8Array.from(T(e)).reverse())),H=(e,t)=>{let r=e;for(;t-- >0;)r=L(r*r);return r},W=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Y=(e,t)=>{const r=L(t*L(t*t)),n=L(L(r*r)*t),i=(e=>{const t=L(e*e),r=L(t*e),n=L(H(r,2)*r),i=L(H(n,1)*e),s=L(H(i,5)*i),o=L(H(s,10)*s),a=L(H(o,20)*o),c=L(H(a,40)*a),f=L(H(c,80)*c),l=L(H(f,80)*c),d=L(H(l,10)*s);return L(H(d,2)*e)})(L(e*n));let s=L(e*L(r*i));const o=L(t*L(s*s)),a=s,c=L(s*W),f=o===e,l=o===D(-e),d=o===D(-e*W);return f&&(s=a),(l||d)&&(s=c),1n==(1n&D(s))&&(s=D(-s)),{isValid:f||l,value:s}},$=e=>{return t=B(e),D(t,m);var t},z=(e,t,r,n)=>{e=T(e,64,"signature"),t=T(t,void 0,"message"),r=T(r,32,"publicKey");const i=(e=>{if(null===e||"object"!=typeof e)throw new TypeError("expected valid options object");return e.zip215??!0})(n),s=e.subarray(0,32),o=B(e.subarray(32,64));let a,c,f,l=Uint8Array.of(),d=!1;try{a=M.fromBytes(r,i),c=M.fromBytes(s,i),f=P.multiply(o,!1),l=S(s,r,t),d=!0}catch(h){}return[l,e=>{if(!d)return!1;if(!i&&a.isSmallOrder())return!1;const t=$(e);return c.add(a.multiply(t,!1)).subtract(f).clearCofactor().is0()}]},K=async(e,t,r,n={})=>(async e=>e[1](await U("sha512Async",e[0])))(z(e,t,r,n)),X={sha512Async:async e=>{const t=globalThis?.crypto?.subtle;if(!t)throw new Error("crypto.subtle must be defined, consider polyfill");return new Uint8Array(await t.digest("SHA-512",S(e)))},sha512:void 0};let G;const Z=(e,t)=>{const r=t.negate();return e?r:t},q=e=>{const t=G||(G=(()=>{const e=[];let t,r=P;for(let n=0;n<33;n++){t=r,e.push(t);for(let n=1;n<128;n++)t=t.add(r),e.push(t);r=t.double()}return e})());let r=F,n=P;for(let i=0;i<33;i++){let s=Number(255n&e);e>>=8n,s>128&&(s-=256,e+=1n);const o=128*i,a=o+Math.abs(s)-1,c=i%2!=0,f=s<0;0===s?n=n.add(Z(c,t[o])):r=r.add(Z(f,t[a]))}if(0n!==e)throw new Error("invalid wnaf");return{p:r,f:n}},j="YD9MZrrs2k4N0v3lOIxO/mvLfM+4Fpqe7SvnViFtMiA=";function J(e){const t=atob(e),r=new ArrayBuffer(t.length),n=new Uint8Array(r);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return r}function Q(e){if(e instanceof Error&&"NotSupportedError"===e.name)return!0;const t=e instanceof Error?e.message:String(e);return/unrecognized|not supported|unsupported/i.test(t)}async function ee(e,t,r){if("function"!=typeof globalThis.crypto?.subtle?.digest)return{ok:!1,reason:"unsupported_browser",detail:"crypto.subtle is unavailable (insecure context or very old browser); the manifest signature cannot be verified."};const n=J(e),i=await async function(e,t,r){let n;try{n=await crypto.subtle.importKey("raw",e,{name:"Ed25519"},!1,["verify"])}catch(i){return Q(i)?{kind:"unsupported"}:{kind:"error",detail:`pubkey import failed: ${i.message}`}}try{return{kind:"verdict",valid:await crypto.subtle.verify({name:"Ed25519"},n,t,r)}}catch(i){return Q(i)?{kind:"unsupported"}:{kind:"error",detail:i.message}}}(n,t,r);if("error"===i.kind)return{ok:!1,reason:"invalid_signature",detail:i.detail};let s;if("verdict"===i.kind)s=i.valid;else try{s=await async function(e,t,r){return K(new Uint8Array(t),new Uint8Array(r),new Uint8Array(e),{zip215:!1})}(n,t,r)}catch(o){return{ok:!1,reason:"invalid_signature",detail:o.message}}return s?null:{ok:!1,reason:"invalid_signature"}}const te="https://static.velion.la/sdk/onboarding/v1";function re(e){try{const r=new URL(e);return"https:"===r.protocol||"http:"===r.protocol&&("localhost"===(t=r.hostname)||"127.0.0.1"===t||"::1"===t||t.endsWith(".local"))}catch{return!1}var t}const ne=["containerId","sessionId","sessionToken","apiUrl","expiresAt","theme","colorMode","locale","allowEmbedded","livenessShowIntro","livenessShowBackButton","fingerprintEndpoint","debug","googleMapsApiKey","showFinalResultScreen","showProgressBar","finalResultScreenTexts","routingTimeoutMs"];class ie{constructor(e){this.status="IDLE",this.iframe=null,this.container=null,this.messageHandler=null,this.containerResizeObserver=null,this.iframeHeightWindowResizeHandler=null,this.cdnOrigin="",this.readyTimer=null,this.config=Object.freeze({...e})}clearReadyTimer(){null!==this.readyTimer&&(clearTimeout(this.readyTimer),this.readyTimer=null)}armReadyTimer(e){this.clearReadyTimer();const t=this.config.runtimeReadyTimeoutMs??3e4;t>0&&(this.readyTimer=setTimeout(()=>{this.readyTimer=null,"RUNNING"===this.status&&(this.status="ERROR",this.config.onError?.({code:n.RUNTIME_LOAD_FAILED,message:`The onboarding runtime at ${e} did not become ready within ${t} ms. Check that the CDN serves the assets referenced by its index.html and that the host page's Content-Security-Policy allows the runtime scripts.`}))},t))}async start(){if("DESTROYED"===this.status)return void this.config.onError?.({code:n.INSTANCE_DESTROYED,message:"This VelionOnboarding instance has been destroyed. Create a new instance to retry."});if("IDLE"!==this.status)return void this.config.onError?.({code:n.ALREADY_STARTED,message:"start() was called on an already-running SDK instance. Call destroy() before re-starting."});const e=document.getElementById(this.config.containerId);if(!e)return void this.config.onError?.({code:n.CONTAINER_NOT_FOUND,message:`No DOM element found with id="${this.config.containerId}". Ensure the element exists before calling start().`});const t=(this.config.cdnUrl??te).replace(/\/$/,"");if(!re(t))return void this.config.onError?.({code:n.UNKNOWN,message:`Insecure cdnUrl: "${t}". Must be https:// (http:// is allowed only for localhost).`});if(this.config.apiUrl&&!re(this.config.apiUrl))return void this.config.onError?.({code:n.UNKNOWN,message:`Insecure apiUrl: "${this.config.apiUrl}". Must be https:// (http:// is allowed only for localhost).`});if(this.cdnOrigin=function(e){try{return new URL(e).origin}catch{return""}}(t),!this.cdnOrigin)return void this.config.onError?.({code:n.UNKNOWN,message:`Invalid cdnUrl: ${t}. Must be a valid absolute URL.`});this.container=e,this.status="INITIALIZING";const r=document.createElement("iframe");r.setAttribute("title","Velion Onboarding"),r.setAttribute("allow","camera"),r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-popups allow-modals"),r.setAttribute("referrerpolicy","no-referrer"),r.style.width="100%",r.style.border="none",r.style.display="block";const u=e=>{if(e.origin!==this.cdnOrigin)return;if(e.source!==this.iframe?.contentWindow)return;const t=e.data;if(t&&"string"==typeof t.type)switch(this.clearReadyTimer(),t.type){case s:this.status="RUNNING";break;case o:this.status="COMPLETED",this.config.onSuccess?.(t.payload);break;case a:this.status="ERROR",this.config.onError?.(t.payload);break;case c:{const e=t.payload;this.config.onStepChange?.(e.step,e.stepIndex);break}case f:{const e=t.payload;this.config.onStepComplete?.(e.step);break}case d:this.status="EXITED",this.config.onExit?.(t.payload);break;case h:this.config.onLivenessVideoUploaded?.(t.payload);break;case l:{const e=this.config.onTokenExpired;e?e().then(e=>this.sendToIframe({type:E,payload:e}),()=>{this.config.onError?.({code:n.SESSION_EXPIRED,message:"Token refresh failed."})}):this.config.onError?.({code:n.SESSION_EXPIRED,message:"Session token expired. Provide onTokenExpired in config to refresh."});break}}};window.addEventListener("message",u),this.messageHandler=u,this.iframe=r,e.replaceChildren(r),this.attachIframeHeightSync(e,r);const g=await this.resolveManifest(t);if(!g)return;const m=g.entry.startsWith("/")?g.entry:`/${g.entry}`;return new Promise(e=>{r.onload=()=>{if(!this.iframe?.contentWindow)return this.status="ERROR",this.config.onError?.({code:n.UNKNOWN,message:"Iframe failed to load."}),void e();const r=function(e){const t={containerId:"velion-sdk-root",allowEmbedded:!0};for(const r of ne){if("containerId"===r||"allowEmbedded"===r)continue;const n=e[r];void 0!==n&&"function"!=typeof n&&(t[r]=n)}return t}(this.config);let s;try{s=JSON.parse(JSON.stringify(r))}catch{s=r}this.sendToIframe({type:i,payload:s}),this.status="RUNNING",this.armReadyTimer(t),e()},r.onerror=()=>{this.status="ERROR",this.config.onError?.({code:n.UNKNOWN,message:`Failed to load onboarding app from ${t}. Check cdnUrl and network.`}),e()},r.src=`${t}${m}`})}async resolveManifest(e){let t;try{t=await async function(e,t=j){let r,n,i,s;try{const t=await fetch(`${e}/manifest.json`,{credentials:"omit",cache:"no-cache",redirect:"error"});if(404===t.status)return{ok:!1,reason:"unavailable"};if(!t.ok)return{ok:!1,reason:"unavailable",detail:`HTTP ${t.status}`};r=await t.arrayBuffer(),n=(new TextDecoder).decode(r)}catch(o){return{ok:!1,reason:"unavailable",detail:o.message}}try{if(i=JSON.parse(n),"string"!=typeof i.version||"string"!=typeof i.entry||"string"!=typeof i.buildTime)return{ok:!1,reason:"malformed"}}catch(o){return{ok:!1,reason:"malformed",detail:o.message}}if(!t)return{ok:!0,manifest:i,signed:!1};try{const t=await fetch(`${e}/manifest.sig`,{credentials:"omit",cache:"no-cache",redirect:"error"});if(!t.ok)return{ok:!1,reason:"invalid_signature",detail:`sig HTTP ${t.status}`};s=J((await t.text()).trim())}catch(o){return{ok:!1,reason:"invalid_signature",detail:o.message}}return await ee(t,s,r)||{ok:!0,manifest:i,signed:!0}}(e)}catch(r){return this.status="ERROR",this.config.onError?.({code:n.INTEGRITY_FAILED,message:`Manifest verification crashed unexpectedly: ${r.message}`}),null}if(t.ok)return!t.signed&&j?(this.status="ERROR",this.config.onError?.({code:n.INTEGRITY_FAILED,message:"Internal: manifest reported as unsigned despite pubkey being set."}),null):t.manifest;if("unavailable"===t.reason){return!0!==this.config.allowUnverifiedCdn?(this.status="ERROR",this.config.onError?.({code:n.INTEGRITY_FAILED,message:`CDN at "${e}" did not expose /manifest.json. The loader is configured to require a signed manifest. If the CDN is migrating, set \`allowUnverifiedCdn: true\` on the loader config — but only as a temporary measure.`}),null):{version:"legacy",buildTime:/* @__PURE__ */(new Date).toISOString(),entry:"/index.html"}}return"unsupported_browser"===t.reason?(this.status="ERROR",this.config.onError?.({code:n.UNSUPPORTED_BROWSER,message:"This browser cannot verify the signature of the Velion CDN manifest, so the onboarding cannot start. It needs a secure context (https) and WebCrypto (Chrome/Edge 67+, Firefox 68+, Safari 14+). "+(t.detail?`Detail: ${t.detail}`:"")}),null):(this.status="ERROR",this.config.onError?.({code:n.INTEGRITY_FAILED,message:`CDN manifest at "${e}/manifest.json" failed integrity check (${t.reason}). Refusing to load the iframe to protect the user. `+("detail"in t&&t.detail?`Detail: ${t.detail}`:"")}),null)}attachIframeHeightSync(e,t){const r=()=>{if(this.iframe!==t||this.container!==e)return;const r=e.clientHeight;r>0?(t.style.height=`${r}px`,t.style.minHeight=""):(t.style.height="min(85vh, 880px)",t.style.minHeight="")};r(),requestAnimationFrame(r),requestAnimationFrame(()=>{requestAnimationFrame(r)}),"undefined"!=typeof ResizeObserver?(this.containerResizeObserver=new ResizeObserver(r),this.containerResizeObserver.observe(e)):(this.iframeHeightWindowResizeHandler=r,window.addEventListener("resize",r))}detachIframeHeightSync(){this.containerResizeObserver&&(this.containerResizeObserver.disconnect(),this.containerResizeObserver=null),this.iframeHeightWindowResizeHandler&&(window.removeEventListener("resize",this.iframeHeightWindowResizeHandler),this.iframeHeightWindowResizeHandler=null)}sendToIframe(e){this.iframe?.contentWindow&&this.iframe.contentWindow.postMessage(e,this.cdnOrigin)}getStatus(){return this.status}static getVersion(){return"1.0.0"}destroy(){"DESTROYED"!==this.status&&(this.clearReadyTimer(),this.detachIframeHeightSync(),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.iframe&&this.container&&(this.iframe.remove(),this.container.replaceChildren()),this.iframe=null,this.container=null,this.status="DESTROYED")}}function se(e){}export{r as CameraErrorCode,te as DEFAULT_CDN_URL,n as SdkErrorCode,a as VELION_MSG_ERROR,d as VELION_MSG_EXIT,i as VELION_MSG_INIT,h as VELION_MSG_LIVENESS_VIDEO_UPLOADED,s as VELION_MSG_READY,c as VELION_MSG_STEP_CHANGE,f as VELION_MSG_STEP_COMPLETE,o as VELION_MSG_SUCCESS,E as VELION_MSG_TOKEN,l as VELION_MSG_TOKEN_EXPIRED,ie as VelionOnboarding,se as setOpenCVBaseUrl};
|
|
2
2
|
//# sourceMappingURL=velion-sdk.es.js.map
|