UNPKG

@softcol/biometrics

Version:

Collection of utility methods for eLogic Biometrics

39 lines (29 loc) 1.07 kB
import { EBiometricsEnvironment, EBiometricsState } from '../models'; import { EBM_URL_DEVELOPMENT, EBM_URL_PRODUCTION } from '../constants'; export class RenderService { private _url: string; constructor() { this._url = EBM_URL_DEVELOPMENT; } private _configure(state: EBiometricsState): void { if (state.environment === EBiometricsEnvironment.production) { this._url = EBM_URL_PRODUCTION } } createEmbed(state: EBiometricsState): void { this._configure(state) const { targetEl } = state; targetEl.style.overflow = 'hidden'; while (targetEl.firstChild) { if (targetEl.lastChild) targetEl.removeChild(targetEl.lastChild); } const newEmbed = document.createElement('iframe'); newEmbed.src = `${this._url}/${state.account}/${state.provider}?id=${state.id}`; newEmbed.style.width = '100%'; newEmbed.style.height = '100%'; newEmbed.style.minHeight = 'inherit'; newEmbed.style.border = 'none'; newEmbed.allow = 'camera *;microphone *'; targetEl.appendChild(newEmbed); } }