eagle-id
Version:
A React based component to perform identity verification
1 lines • 57.3 kB
JavaScript
module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@material-ui/core/Button")},function(e,t){e.exports=require("react-device-detect")},function(e,t){e.exports=require("axios")},function(e,t){e.exports=require("react-lottie")},function(e,t){e.exports=require("notistack")},function(e,t){e.exports=require("@material-ui/core/Dialog")},function(e,t){e.exports=require("@material-ui/core/Fab")},function(e,t){e.exports=require("@material-ui/core/CircularProgress")},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("https")},function(e,t){e.exports=require("@material-ui/core/FormControlLabel")},function(e,t){e.exports=require("@material-ui/core/Checkbox")},function(e,t){e.exports=require("@material-ui/icons/RadioButtonUnchecked")},function(e,t){e.exports=require("@material-ui/icons/Loop")},function(e,t){e.exports=require("react-webcam")},function(e,t){e.exports=require("react-exif-orientation-img")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("@material-ui/core/DialogContent")},function(e,t){e.exports=require("detect-browser")},function(e,t){e.exports=require("jimp")},function(e,t,n){"use strict";n.r(t);var o=n(0),r=n.n(o),i=n(5),a=n(2),c=Object.freeze({PRIVACY_SCREEN:"privacy_screen",DOCUMENT_SCREEN:"document_screen",WEBCAM_SCREEN:"webcam_screen",CONFIRMATION_SCREEN:"confirmation_screen",SELFIE_SCREEN:"selfie_screen",UPLOAD_SCREEN:"upload_screen",RESPONSE_SCREEN:"response_screen"}),s=Object.freeze({FRONT:"front",BACK:"back"}),u=a.isMobile?window.innerWidth-25:window.innerWidth/3,l=window.innerHeight-50,p={baseUrl:"https://api.eyn.ninja/api/v1/prod/identitycheck",apiSecret:"public-e692d869-c110-4a33-b003-2098a5e04f72",privacy:{show:!0,notice:"https://www.eyn.vision/privacynotice"},title:"Eagle ID powered by EYN",ui:{documentTitle:"Select Your Document Type",documentSubTitle:""},camera:{imageFormat:"image/jpeg",ui:{idFront:{scanLabel:"Scan the FRONT SIDE of your document",infoLabel:"Place it within the frame and press the camera button",scanNumber:"Scan 1/2"},idBack:{scanLabel:"Scan the BACK SIDE of your document",infoLabel:"Place it within the frame and press the camera button",scanNumber:"Scan 2/2"},visa:{scanLabel:"Scan your VISA document",infoLabel:"Place it within the frame and press the camera button",scanNumber:""},passport:{scanLabel:"Scan the FRONT PAGE of your PASSPORT document",infoLabel:"Please make sure to only include the main page containing the passport photo",scanNumber:""},other:{scanLabel:"Scan your document",infoLabel:"Place it within the frame and press the camera button",scanNumber:""},selfie:{scanLabel:"Send us a smile",infoLabel:"Place it within the frame and\n press the camera button",scanNumber:""}}},resources:{images:{logo:"./resources/images/logo.png",logoTitle:"./resources/images/logo-title.png",privacy:"./resources/images/privacy-notice.png",icon_passport:"./resources/images/type_passport.svg",icon_id:"./resources/images/type_identity_card.svg",icon_other:"./resources/images/identity_type_other.svg",icon_camera:"./resources/images/camera.svg",image_selfie:"./resources/images/selfie_instruc.svg",overlay_document_web:"./resources/images/overlay_document.svg",overlay_document_mobile:"./resources/images/overlay_document_mobile.svg",overlay_selfie_web:"./resources/images/overlay_selfie.svg",overlay_selfie_mobile:"./resources/images/overlay_selfie_mobile.svg"},animations:{passport:"./resources/animations/scan_passport.json",idfront:"./resources/animations/scan_document_front.json",idback:"./resources/animations/scan_document_back.json",status_good:"./resources/animations/verify_status_good.json",loading:"./resources/animations/loading_coffee.json"}}},f=function(){var e=window.outerWidth;return e<=320?{large:22,regular:17}:e>320&&e<=375?{large:24,regular:19}:e>=375?{large:26,regular:21}:void 0},m={title:{color:"#05294B",marginTop:25,fontSize:f().large,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif",marginLeft:10,marginRight:10},subTitle:{color:"#05294B",fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif",marginLeft:10,marginRight:10},documentTypes:{fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif",color:"rgba(5, 41, 75, 1)",backgroundColor:"rgba(5, 41, 75, 0.15)",width:u-50,margin:"0 auto",borderRadius:50,borderColor:"rgba(5, 41, 75, 0.15)"},buttonFilled:{margin:2,fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif",color:"white",backgroundColor:"#05294B",borderRadius:25},buttonOutlined:{margin:2,fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif",color:"#05294B",borderRadius:25,borderColor:"#05294B"},buttonContent:{left:0,right:0,marginLeft:10,marginRight:"auto"},container:{borderStyle:"solid",borderWidth:1,borderRadius:5,borderColor:"gray",width:u,height:l,position:"absolute",left:0,right:0,marginLeft:"auto",marginRight:"auto",marginTop:25,marginBottom:25,boxShadow:"10px 10px 5px grey"},header:{borderStyle:"solid",borderWidth:1,borderRadius:5,borderColor:"gray",width:u,position:"absolute",top:-1,left:-1,right:0,marginLeft:"auto",marginRight:"auto",color:"white",backgroundColor:"#05294B",marginBottom:25,height:50,fontSize:f().large,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif"},videoStream:{position:"absolute",top:0,left:0,right:0,marginLeft:"auto",marginRight:"auto",display:"block",backgroundColor:"transparent"},camera:{position:"absolute",left:0,right:0,bottom:25,marginLeft:"auto",marginRight:"auto",backgroundColor:"transparent"},cameraIcon:{backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},fontSize:50},progress:{size:50,color:"white"},overlay:{position:"relative",margin:"auto",backgroundColor:"transparent",top:0,display:"block",marginLeft:0,paddingLeft:0,marginRight:0,paddingRight:0},refresh:{position:"absolute",left:0,right:25,bottom:25,marginLeft:"auto",marginRight:0,backgroundColor:"#05294B"},lottie:{position:"absolute",left:0,right:0,top:25,marginLeft:"auto",marginRight:"auto"},cameraLabels:{position:"absolute",left:0,right:0,bottom:75,marginLeft:"auto",marginRight:"auto"},loading:{color:"secondary"},label:{color:"white",top:0,bottom:0,left:0,right:0,margin:"auto",marginLeft:"auto",marginRight:"auto",width:"100",fontSize:f().large,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif"},info:{color:"white",top:0,bottom:0,left:0,right:0,margin:"auto",marginLeft:"auto",marginRight:"auto",width:"100",fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif"},scan:{color:"white",top:0,bottom:0,left:0,right:0,margin:"auto",marginLeft:"auto",marginRight:"auto",width:"100",fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif"},images:{position:"relative",marginLeft:25,marginRight:25,marginTop:75,marginBottom:5,width:u-50,borderRadius:10,boxShadow:"5px 5px 5px grey"},text:{color:"#05294B",fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif"},textGray:{color:"gray",fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif",marginBottom:-10,marginLeft:25,marginRight:25,textAlign:"left"},list:{color:"gray",fontSize:f().regular,fontFamily:"'Raleway', 'Roboto', 'Helvetica', 'Arial', sans-serif",textAlign:"left",position:"relative",left:0,right:0,marginLeft:"auto",marginRight:"auto",display:"inline-block"},checkBox:{color:"#05294B"}},g=(n(17),n(3)),d=n.n(g),b=n(9),y=n.n(b),h=n(10),v=n.n(h),_=n(1),E=n.n(_),S=n(11),w=n.n(S),R=n(12),O=n.n(R);function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function L(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=N(e);if(t){var r=N(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return T(this,n)}}function T(e,t){return!t||"object"!==k(t)&&"function"!=typeof t?j(e):t}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(a,e);var t,n,o,i=P(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),B(j(t=i.call(this,e)),"acceptPrivacyNotice",(function(){t.state.acceptPrivacyNotice?(t.setState({privacyNotice:!1}),localStorage.setItem("TermsAndConditions",!0),t.props.switchScreen()):t.props.enqueueSnackbar("Please accept the terms and conditions before continuing.",{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"center"}})})),B(j(t),"handleChange",(function(e){t.setState({acceptPrivacyNotice:e.target.checked})})),t.state={config:t.props.config,acceptPrivacyNotice:!0},t}return t=a,(n=[{key:"componentDidUpdate",value:function(e,t){e.config!=this.props.config&&this.setState({config:this.props.config})}},{key:"render",value:function(){var e=this;return r.a.createElement("div",null,r.a.createElement("center",null,r.a.createElement("img",{src:this.state.config.resources.images.logo,width:200,alt:"logo",style:{marginTop:75}}),r.a.createElement("br",null),r.a.createElement("img",{src:this.state.config.resources.images.privacy,width:150,alt:"privacy-notice",style:{marginTop:25}}),r.a.createElement(w.a,{control:r.a.createElement(O.a,{checked:this.state.acceptPrivacyNotice,onChange:function(t){e.handleChange(t)},color:"primary",style:m.checkBox}),labelPlacement:"end",label:r.a.createElement("p",{style:m.text},"By clicking Start you accept our ",r.a.createElement("a",{href:this.state.config.privacy.notice},"terms and conditions"),"."),style:{marginLeft:25,marginRight:25}}),r.a.createElement("br",null),r.a.createElement(E.a,{variant:"contained",color:"primary",style:m.buttonFilled,onClick:function(){e.acceptPrivacyNotice()}},"Start"),r.a.createElement("br",null),r.a.createElement("br",null)))}}])&&L(t.prototype,n),o&&L(t,o),a}(o.Component),D=Object(i.withSnackbar)(x);function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function A(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=z(e);if(t){var r=z(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return U(this,n)}}function U(e,t){return!t||"object"!==F(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(a,e);var t,n,o,i=M(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=i.call(this,e)).state={config:t.props.config,disableButtons:!1},t}return t=a,(n=[{key:"componentDidUpdate",value:function(e,t){e.config!=this.props.config&&this.setState({config:this.props.config})}},{key:"render",value:function(){var e=this;return r.a.createElement("div",null,r.a.createElement("center",null,r.a.createElement("div",{style:{marginTop:75}},r.a.createElement("h1",{style:m.title}," ",this.state.config.ui.documentTitle," "),r.a.createElement("h2",{style:m.subTitle}," ",this.state.config.ui.documentSubTitle," ")),r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(E.a,{variant:"outlined",color:"primary",style:m.documentTypes,onClick:function(){e.setState({disableButtons:!0}),e.props.selectDocument("id_front")},disabled:this.state.disableButtons},r.a.createElement("img",{src:this.state.config.resources.images.icon_id,width:"50",alt:"logo id",stlye:m.buttonContent}),r.a.createElement("p",{style:m.buttonContent}," ID / Residence Permit ")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(E.a,{variant:"outlined",color:"primary",style:m.documentTypes,onClick:function(){e.setState({disableButtons:!0}),e.props.selectDocument("visa")},disabled:this.state.disableButtons},r.a.createElement("img",{src:this.state.config.resources.images.icon_id,width:"50",alt:"logo id",style:m.buttonContent}),r.a.createElement("p",{style:m.buttonContent}," Visa ")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(E.a,{variant:"outlined",color:"primary",style:m.documentTypes,onClick:function(){e.setState({disableButtons:!0}),e.props.selectDocument("passport")},disabled:this.state.disableButtons},r.a.createElement("img",{src:this.state.config.resources.images.icon_passport,width:"50",alt:"logo id",style:m.buttonContent}),r.a.createElement("p",{style:m.buttonContent}," Passport ")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(E.a,{variant:"outlined",color:"primary",style:m.documentTypes,onClick:function(){e.setState({disableButtons:!0}),e.props.selectDocument("other")},disabled:this.state.disableButtons},r.a.createElement("img",{src:this.state.config.resources.images.icon_other,width:"50",alt:"logo id",style:m.buttonContent}),r.a.createElement("p",{style:m.buttonContent}," Other "))))))),r.a.createElement("br",null),r.a.createElement("br",null))}}])&&A(t.prototype,n),o&&A(t,o),a}(o.Component),W=n(13),H=n.n(W),Y=n(14),V=n.n(Y),K=n(7),G=n.n(K),Q=n(8),J=n.n(Q),$=n(6),X=n.n($),Z=(n(18),n(15)),ee=n.n(Z),te=n(4),ne=n.n(te);function oe(e){return(oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function re(e,t,n,o,r,i,a){try{var c=e[i](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(o,r)}function ie(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var i=e.apply(t,n);function a(e){re(i,o,r,a,c,"next",e)}function c(e){re(i,o,r,a,c,"throw",e)}a(void 0)}))}}function ae(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function se(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=pe(e);if(t){var r=pe(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ue(this,n)}}function ue(e,t){return!t||"object"!==oe(t)&&"function"!=typeof t?le(e):t}function le(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var me=(0,n(19).detect)(),ge=r.a.createRef(),de=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ce(e,t)}(c,e);var t,n,o,i=se(c);function c(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),fe(le(t=i.call(this,e)),"capture",(function(){if(!t.state.disableButtons){t.setState({disableButtons:!0});var e=ge.current.getScreenshot();t.props.processImage(e)}})),fe(le(t),"getDeviceId",ie(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"chrome"===me.name&&"Android OS"===me.os&&navigator.mediaDevices.enumerateDevices().then((function(e){e.forEach((function(e){"videoinput"===e.kind&&e.label.includes("facing front")&&t.setState({deviceIdFront:e.deviceId}),"videoinput"===e.kind&&e.label.includes("facing back")&&t.setState({deviceIdBack:e.deviceId})}))}));case 1:case"end":return e.stop()}}),e)})))),fe(le(t),"getFacingMode",(function(e){return e===s.FRONT?"user":"environment"})),fe(le(t),"changeCameraPosition",(function(){"chrome"===me.name&&"Android OS"===me.os&&(ge.current&&ge.current.stream&&ge.current.stream.getVideoTracks&&ge.current.stream.getVideoTracks().map((function(e){return e.stop()})),ge=r.a.createRef()),cameraPosition===s.FRONT?t.setState({cameraPosition:s.BACK}):cameraPosition===s.BACK&&t.setState({cameraPosition:s.FRONT})}));var n=s.FRONT;return"selfie"===t.props.documentType&&(n=s.FRONT),"chrome"===me.name&&"Android OS"===me.os&&(n=s.FRONT),t.state={config:t.props.config,cameraPosition:n,deviceIdFront:"",deviceIdBack:"",loading:t.props.loading,disableButtons:!1,showAnimation:!1},t.getDeviceId(),t}return t=c,(n=[{key:"componentWillMount",value:function(){var e=this;d.a.get(this.state.config.resources.animations.passport).then((function(t){e.setState({animationPassport:t.data},e.forceUpdate())})).catch((function(e){console.log(e)})),d.a.get(this.state.config.resources.animations.idfront).then((function(t){e.setState({animationIdFront:t.data},e.forceUpdate())})).catch((function(e){console.log(e)})),d.a.get(this.state.config.resources.animations.idback).then((function(t){e.setState({animationIdBack:t.data},e.forceUpdate())})).catch((function(e){console.log(e)}));var t=!1;switch(this.props.documentType){case"id_front":case"id_back":case"visa":case"passport":t=!0;break;case"other":case"selfie":t=!1}this.setState({showAnimation:t},this.forceUpdate())}},{key:"componentDidUpdate",value:function(e,t){t.disableButtons&&this.setState({disableButtons:!1}),e.config!=this.props.config&&this.setState({config:this.props.config})}},{key:"render",value:function(){var e=this;switch(this.props.documentType){case"id_front":this.label=this.props.config.camera.ui.idFront.scanLabel,this.info=this.props.config.camera.ui.idFront.infoLabel,this.number=this.props.config.camera.ui.idFront.scanNumber,this.overlay="document",this.animationData=this.state.animationIdFront,this.mirrored=!1;break;case"id_back":this.label=this.props.config.camera.ui.idBack.scanLabel,this.info=this.props.config.camera.ui.idBack.infoLabel,this.number=this.props.config.camera.ui.idBack.scanNumber,this.overlay="document",this.animationData=this.state.animationIdBack,this.mirrored=!1;break;case"visa":this.label=this.props.config.camera.ui.visa.scanLabel,this.info=this.props.config.camera.ui.visa.infoLabel,this.number=this.props.config.camera.ui.visa.scanNumber,this.overlay="document",this.animationData=this.state.animationPassport,this.mirrored=!1;break;case"passport":this.label=this.props.config.camera.ui.passport.scanLabel,this.info=this.props.config.camera.ui.passport.infoLabel,this.number=this.props.config.camera.ui.passport.scanNumber,this.overlay="document",this.animationData=this.state.animationPassport,this.mirrored=!1;break;case"other":this.label=this.props.config.camera.ui.other.scanLabel,this.info=this.props.config.camera.ui.other.infoLabel,this.number=this.props.config.camera.ui.other.scanNumber,this.overlay="none",this.mirrored=!1;break;case"selfie":this.label=this.props.config.camera.ui.selfie.scanLabel,this.info=this.props.config.camera.ui.selfie.infoLabel,this.number=this.props.config.camera.ui.selfie.scanNumber,this.overlay="selfie",this.mirrored=!0}var t=800,n=600,o={facingMode:this.getFacingMode(this.state.cameraPosition),width:t,height:n},i=t;a.isMobile?(t=window.innerWidth,n=window.innerHeight,i=t-100,"passport"!==this.props.documentType&&"visa"!==this.props.documentType||(i=t-150)):(i=350,"passport"!==this.props.documentType&&"visa"!==this.props.documentType||(i=300)),"chrome"===me.name&&"Android OS"===me.os&&this.state.cameraPosition===s.BACK&&(o={deviceId:this.state.deviceIdBack,width:t,height:n});var c={loop:!1,autoplay:!0,animationData:this.animationData,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}},u=[{eventName:"complete",callback:function(){e.setState({showAnimation:!1},e.forceUpdate())}}];return r.a.createElement(X.a,{open:this.props.open,onClose:function(){e.props.close()},fullScreen:!0,fullWidth:!1,maxWidth:!1},r.a.createElement(ee.a,{ref:ge,width:t,height:n,audio:!1,mirrored:this.mirrored,screenshotFormat:this.props.config.camera.imageFormat,videoConstraints:o,forceScreenshotSourceSize:!0,screenshotQuality:1,onUserMediaError:function(t){e.props.showSnackMessage("error","Loading the camera failed with: "+t),e.setState({disableButtons:!0})},style:m.videoStream}),this.state.showAnimation?r.a.createElement("center",null,r.a.createElement(ne.a,{options:c,width:i,eventListeners:u,style:m.lottie})):r.a.createElement("div",null),this.state.loading?r.a.createElement("center",null,r.a.createElement(J.a,{color:"secondary",style:{position:"absolute",marginTop:window.innerHeight/2}})):r.a.createElement("div",null),r.a.createElement("div",{style:m.cameraLabels},r.a.createElement("center",null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("center",null,r.a.createElement("h1",{style:m.label}," ",this.label," ")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("center",null,r.a.createElement("p",{style:m.info}," ",this.info," ")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("center",null,r.a.createElement("p",{style:m.scan}," ",this.number," ")))))))),r.a.createElement("div",null,r.a.createElement("center",null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(G.a,{color:"primary",style:m.camera,onClick:function(){e.capture()}},this.state.disableButtons?r.a.createElement(J.a,{style:m.progress,disableShrink:!0,variant:"indeterminate"}):r.a.createElement(H.a,{style:m.cameraIcon}))),r.a.createElement("td",null,r.a.createElement(G.a,{color:"primary",style:m.refresh,onClick:function(){e.changeCameraPosition()}},r.a.createElement(V.a,null)))))))))}}])&&ae(t.prototype,n),o&&ae(t,o),c}(o.Component),be=n(16),ye=n.n(be);function he(e){return(he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ve(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _e(e,t){return(_e=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ee(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=we(e);if(t){var r=we(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Se(this,n)}}function Se(e,t){return!t||"object"!==he(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Re=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_e(e,t)}(a,e);var t,n,o,i=Ee(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=i.call(this,e)).state={},t}return t=a,(n=[{key:"componentDidUpdate",value:function(e,t){t.disableButtons&&this.setState({disableButtons:!1}),e.config!=this.props.config&&this.setState({config:this.props.config})}},{key:"render",value:function(){var e=this;return r.a.createElement("div",null,"identity_document_image_mrz"in this.props.images?r.a.createElement(ye.a,{id:"identityDocument",src:URL.createObjectURL(this.props.images.identity_document_image_mrz),alt:"image of document",style:m.images}):r.a.createElement(r.a.Fragment,null),r.a.createElement("center",null,r.a.createElement("h1",{style:m.title},"Quality Control 🧐"),r.a.createElement("p",{style:m.textGray},"Please make sure that the ID picture is:"),r.a.createElement("ul",{style:m.list},r.a.createElement("li",null,"clearly visible"),r.a.createElement("li",null,"no glare or hidden parts")),r.a.createElement("br",null),r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",{style:{marginRight:25}},r.a.createElement(E.a,{variant:"outlined",color:"primary",style:m.buttonOutlined,onClick:function(){return e.setState({disableButtons:!0}),e.props.retake()},disabled:this.state.disableButtons}," Retake")),r.a.createElement("td",{style:{marginLeft:25}},r.a.createElement(E.a,{variant:"contained",color:"primary",style:m.buttonFilled,onClick:function(){return e.setState({disableButtons:!0}),e.props.confirm()},disabled:this.state.disableButtons,autoFocus:!0}," Confirm")))))),r.a.createElement("br",null),r.a.createElement("br",null))}}])&&ve(t.prototype,n),o&&ve(t,o),a}(o.Component);function Oe(e){return(Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ke(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Le(e,t){return(Le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=Te(e);if(t){var r=Te(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Pe(this,n)}}function Pe(e,t){return!t||"object"!==Oe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Te(e){return(Te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var je=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Le(e,t)}(a,e);var t,n,o,i=Ce(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=i.call(this,e)).state={config:t.props.config,disableButtons:!1},t}return t=a,(n=[{key:"componentDidUpdate",value:function(e,t){t.disableButtons&&this.setState({disableButtons:!1}),e.config!=this.props.config&&this.setState({config:this.props.config})}},{key:"render",value:function(){var e=this;return r.a.createElement("div",null,r.a.createElement("center",null,r.a.createElement("img",{src:this.state.config.resources.images.image_selfie,height:window.innerHeight/2,alt:"selfie instructions",style:{marginTop:75}}),r.a.createElement("h1",{style:m.title},"We just need to see your pearly whites"),r.a.createElement(E.a,{variant:"contained",color:"primary",style:m.buttonFilled,disabled:this.state.disableButtons,onClick:function(){e.setState({disableButtons:!0}),e.props.takeSelfie()}}," Take Selfie")),r.a.createElement("br",null),r.a.createElement("br",null))}}])&&ke(t.prototype,n),o&&ke(t,o),a}(o.Component);function Ne(e){return(Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Be(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function xe(e,t){return(xe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function De(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=Ae(e);if(t){var r=Ae(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Fe(this,n)}}function Fe(e,t){return!t||"object"!==Ne(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ae(e){return(Ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ie=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xe(e,t)}(c,e);var t,n,o,i=De(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=i.call(this,e)).state={config:t.props.config,animationData:{}},t}return t=c,(n=[{key:"componentWillMount",value:function(){var e=this;d.a.get(this.state.config.resources.animations.loading).then((function(t){e.setState({animationData:t.data})})).catch((function(e){console.log(e)}))}},{key:"componentDidUpdate",value:function(e,t){e.config!=this.props.config&&this.setState({config:this.props.config})}},{key:"render",value:function(){var e={loop:!0,autoplay:!0,animationData:this.state.animationData,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}};return r.a.createElement("div",null,r.a.createElement("center",null,r.a.createElement("div",{style:{marginTop:75}},r.a.createElement("h1",{style:m.title},"Processing ...")),r.a.createElement(ne.a,{options:e,width:a.isMobile?window.innerWidth/1.5:window.innerWidth/3,eventListeners:[{eventName:"complete",callback:function(){}}]})),r.a.createElement("br",null),r.a.createElement("br",null))}}])&&Be(t.prototype,n),o&&Be(t,o),c}(o.Component);function Me(e){return(Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ue(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ze(e,t){return(ze=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=He(e);if(t){var r=He(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return We(this,n)}}function We(e,t){return!t||"object"!==Me(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function He(e){return(He=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ye=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ze(e,t)}(c,e);var t,n,o,i=qe(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=i.call(this,e)).state={config:t.props.config},t}return t=c,(n=[{key:"componentWillMount",value:function(){var e=this;d.a.get(this.state.config.resources.animations.status_good).then((function(t){e.setState({animationData:t.data})})).catch((function(e){console.log(e)}))}},{key:"componentDidUpdate",value:function(e,t){e.config!=this.props.config&&this.setState({config:this.props.config})}},{key:"render",value:function(){var e={loop:!1,autoplay:!0,animationData:this.state.animationData,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}};return r.a.createElement("div",null,r.a.createElement("center",null,r.a.createElement("div",{style:{marginTop:75}},r.a.createElement("h1",{style:m.title},"Document Uploaded")),r.a.createElement(ne.a,{options:e,width:a.isMobile?150:250,eventListeners:[{eventName:"complete",callback:function(){}}]}),r.a.createElement("br",null),r.a.createElement("p",{style:{fontSize:14,color:"#05294B"}}," Response received in ",this.props.responseTime," seconds "),r.a.createElement("br",null),r.a.createElement("br",null)))}}])&&Ue(t.prototype,n),o&&Ue(t,o),c}(o.Component);function Ve(e){return(Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ke(e,t,n,o,r,i,a){try{var c=e[i](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(o,r)}function Ge(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var i=e.apply(t,n);function a(e){Ke(i,o,r,a,c,"next",e)}function c(e){Ke(i,o,r,a,c,"throw",e)}a(void 0)}))}}function Qe(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Je(e,t){return(Je=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $e(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=et(e);if(t){var r=et(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Xe(this,n)}}function Xe(e,t){return!t||"object"!==Ve(t)&&"function"!=typeof t?Ze(e):t}function Ze(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function et(e){return(et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var nt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Je(e,t)}(u,e);var t,o,i,s=$e(u);function u(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),tt(Ze(t=s.call(this,e)),"switchScreen",(function(e){t.setState({screen:e},t.forceUpdate())})),tt(Ze(t),"setDocumentType",(function(e){t.setState({documentType:e})})),tt(Ze(t),"processImage",(function(e){t.setState({loading:!0});var o=n(20);o.read(e).then((function(e){var n=50,r=25,i=e.bitmap.width-100,s=e.bitmap.height-window.innerHeight/4.5;a.isMobile&&(n=25,i=e.bitmap.width-50,s=e.bitmap.height-window.innerHeight/1.5),"selfie"===t.state.documentType&&(n=100,r=25,i=e.bitmap.width-200,s=e.bitmap.height-window.innerHeight/4,a.isMobile&&(n=50,i=e.bitmap.width-100,s=e.bitmap.height-window.innerHeight/2)),e.crop(n,r,i,s).getBase64Async(o.MIME_JPEG).then((function(e){fetch(e).then((function(e){return e.blob()})).then((function(n){t.setState({loading:!1});var o=t.state.images;if("selfie"===t.state.documentType&&(o.user_selfie_base64=e.replace("data:image/jpeg;base64,",""),o.user_selfie=n,t.setState({images:o}),t.switchScreen(c.UPLOAD_SCREEN),t.callEynAPI()),"id_front"===t.state.documentType)return o.identity_document_image_front_base64=e.replace("data:image/jpeg;base64,",""),o.identity_document_image_front=n,void t.setState({images:o,documentType:"id_back"});"id_back"!==t.state.documentType&&"visa"!==t.state.documentType&&"passport"!==t.state.documentType&&"other"!==t.state.documentType||(o.identity_document_image_mrz_base64=e.replace("data:image/jpeg;base64,",""),o.identity_document_image_mrz=n,t.setState({images:o},t.switchScreen(c.CONFIRMATION_SCREEN)))}))}))}))})),tt(Ze(t),"callEynAPI",Ge(regeneratorRuntime.mark((function e(){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.setState({loading:!0}),n=Math.floor(Date.now()),o={},"identity_document_image_front_base64"in t.state.images?(o.document_front_base64_encoded=t.state.images.identity_document_image_front_base64,o.document_back_base64_encoded=t.state.images.identity_document_image_mrz_base64):o.document_front_base64_encoded=t.state.images.identity_document_image_mrz_base64,o.selfie_base64_encoded=t.state.images.user_selfie_base64,o.eyn_ocr_token=t.state.config.apiSecret,d.a.create({timeout:12e4,httpAgent:new y.a.Agent({keepAlive:!0}),httpsAgent:new v.a.Agent({keepAlive:!0}),maxRedirects:10,maxContentLength:5e7})({url:t.state.config.baseUrl,method:"POST",data:o}).then((function(e){var o=(Math.floor(Date.now())-n)/1e3;t.setState({response:e.data,responseTime:o,loading:!1}),console.log(e),t.switchScreen(c.RESPONSE_SCREEN)})).catch((function(e){t.setState({loading:!1}),console.log(e),t.props.enqueueSnackbar("An error occured during the upload of your document. Please try again.",{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"center"}})}));case 8:case"end":return e.stop()}}),e)})))),t.state={config:t.props.config,screen:c.PRIVACY_SCREEN,documentType:"other",images:{},loading:!1},t}return t=u,(o=[{key:"componentDidUpdate",value:function(e,t){e.config!=this.props.config&&this.setState({config:this.props.config})}},{key:"componentDidMount",value:function(){!0===this.state.config.privacy.show&&"true"!==localStorage.getItem("TermsAndConditions")?this.setState({screen:c.PRIVACY_SCREEN},this.forceUpdate()):this.setState({screen:c.DOCUMENT_SCREEN},this.forceUpdate())}},{key:"render",value:function(){var e=this;return r.a.createElement("div",null,r.a.createElement("div",{style:m.container},r.a.createElement("div",{style:m.header},r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("img",{src:this.state.config.resources.images.logoTitle,height:"40",alt:"logo"})),r.a.createElement("td",null,r.a.createElement("p",{style:{position:"absolute",top:0,bottom:0,margin:"auto",marginTop:10,whiteSpace:"nowrap",fontWeight:400}},this.state.config.title)))))),this.state.screen===c.PRIVACY_SCREEN?r.a.createElement(D,{config:this.props.config,switchScreen:function(){e.switchScreen(c.DOCUMENT_SCREEN)}}):r.a.createElement("div",null),this.state.screen===c.DOCUMENT_SCREEN?r.a.createElement(q,{config:this.props.config,selectDocument:function(t){e.setDocumentType(t),e.switchScreen(c.WEBCAM_SCREEN)}}):r.a.createElement("div",null),this.state.screen===c.WEBCAM_SCREEN?r.a.createElement(de,{config:this.props.config,loading:this.state.loading,open:this.state.screen===c.WEBCAM_SCREEN,close:function(){},documentType:this.state.documentType,processImage:function(t){e.processImage(t)}}):r.a.createElement("div",null),this.state.screen===c.CONFIRMATION_SCREEN?r.a.createElement(Re,{config:this.props.config,images:this.state.images,confirm:function(){e.setDocumentType("selfie"),e.switchScreen(c.SELFIE_SCREEN)},retake:function(){e.switchScreen(c.WEBCAM_SCREEN)}}):r.a.createElement("div",null),this.state.screen===c.SELFIE_SCREEN?r.a.createElement(je,{config:this.props.config,takeSelfie:function(){e.switchScreen(c.WEBCAM_SCREEN)}}):r.a.createElement("div",null),this.state.screen===c.UPLOAD_SCREEN?r.a.createElement(Ie,{config:this.props.config}):r.a.createElement("div",null),this.state.screen===c.RESPONSE_SCREEN?r.a.createElement(Ye,{config:this.props.config,responseTime:this.state.responseTime}):r.a.createElement("div",null)))}}])&&Qe(t.prototype,o),i&&Qe(t,i),u}(o.Component);function ot(e){return(ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function rt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],o=!0,r=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(o=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{o||null==c.return||c.return()}finally{if(r)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return it(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function at(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ct(e,t){return(ct=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function st(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=pt(e);if(t){var r=pt(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ut(this,n)}}function ut(e,t){return!t||"object"!==ot(t)&&"function"!=typeof t?lt(e):t}function lt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pt(e){return(pt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ft(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ct(e,t)}(c,e);var t,n,o,a=st(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),ft(lt(t=a.call(this,e)),"configureLayout",(function(){var e="";e="baseUrl"in t.props.config&&void 0!==t.props.config.baseUrl?t.props.config.baseUrl:p.baseUrl;var n="";n="apiSecret"in t.props.config&&void 0!==t.props.config.apiSecret?t.props.config.apiSecret:p.apiSecret;var o="";o="title"in t.props.config&&void 0!==t.props.config.title?t.props.config.title:p.title;var r="";r="privacy"in t.props.config&&"show"in t.props.config.ui&&void 0!==t.props.config.privacy.show?t.props.config.privacy.show:p.privacy.show;var i="";i="privacy"in t.props.config&&"notice"in t.props.config.ui&&void 0!==t.props.config.privacy.notice?t.props.config.privacy.notice:p.privacy.notice;var a="";a="ui"in t.props.config&&"documentTitle"in t.props.config.ui&&void 0!==t.props.config.ui.documentTitle?t.props.config.ui.documentTitle:p.ui.documentTitle;var c="";c="ui"in t.props.config&&"documentSubTitle"in t.props.config.ui&&void 0!==t.props.config.ui.documentSubTitle?t.props.config.ui.documentSubTitle:p.ui.documentSubTitle;var s="";s="camera"in t.props.config&&"imageFormat"in t.props.config.camera&&void 0!==t.props.config.camera.imageFormat?t.props.config.camera.imageFormat:p.camera.imageFormat;var u="";u="camera"in t.props.config&&"ui"in t.props.config.camera&&"idFront"in t.props.config.camera.ui&&"scanLabel"in t.props.config.camera.ui.idFront&&void 0!==t.props.config.camera.ui.idFront.scanLabel?t.props.config.camera.ui.idFront.scanLabel:p.camera.ui.idFront.scanLabel;var l="";l="camera"in t.props.config&&"ui"in t.props.config.camera&&"idFront"in t.props.config.camera.ui&&"infoLabel"in t.props.config.camera.ui.idFront&&void 0!==t.props.config.camera.ui.idFront.infoLabel?t.props.config.camera.ui.idFront.infoLabel:p.camera.ui.idFront.infoLabel;var f="";f="camera"in t.props.config&&"ui"in t.props.config.camera&&"idFront"in t.props.config.camera.ui&&"scanNumber"in t.props.config.camera.ui.idFront&&void 0!==t.props.config.camera.ui.idFront.scanNumber?t.props.config.camera.ui.idFront.scanNumber:p.camera.ui.idFront.scanNumber;var m="";m="camera"in t.props.config&&"ui"in t.props.config.camera&&"idBack"in t.props.config.camera.ui&&"scanLabel"in t.props.config.camera.ui.idBack&&void 0!==t.props.config.camera.ui.idBack.scanLabel?t.props.config.camera.ui.idBack.scanLabel:p.camera.ui.idBack.scanLabel;var g="";g="camera"in t.props.config&&"ui"in t.props.config.camera&&"idBack"in t.props.config.camera.ui&&"infoLabel"in t.props.config.camera.ui.idBack&&void 0!==t.props.config.camera.ui.idBack.infoLabel?t.props.config.camera.ui.idBack.infoLabel:p.camera.ui.idBack.infoLabel;var d="";d="camera"in t.props.config&&"ui"in t.props.config.camera&&"idBack"in t.props.config.camera.ui&&"scanNumber"in t.props.config.camera.ui.idBack&&void 0!==t.props.config.camera.ui.idBack.scanNumber?t.props.config.camera.ui.idBack.scanNumber:p.camera.ui.idBack.scanNumber;var b="";b="camera"in t.props.config&&"ui"in t.props.config.camera&&"visa"in t.props.config.camera.ui&&"scanLabel"in t.props.config.camera.ui.visa&&void 0!==t.props.config.camera.ui.visa.scanLabel?t.props.config.camera.ui.visa.scanLabel:p.camera.ui.visa.scanLabel;var y="";y="camera"in t.props.config&&"ui"in t.props.config.camera&&"visa"in t.props.config.camera.ui&&"infoLabel"in t.props.config.camera.ui.visa&&void 0!==t.props.config.camera.ui.visa.infoLabel?t.props.config.camera.ui.visa.infoLabel:p.camera.ui.visa.infoLabel;var h="";h="camera"in t.props.config&&"ui"in t.props.config.camera&&"visa"in t.props.config.camera.ui&&"scanNumber"in t.props.config.camera.ui.visa&&void 0!==t.props.config.camera.ui.visa.scanNumber?t.props.config.camera.ui.visa.scanNumber:p.camera.ui.visa.scanNumber;var v="";v="camera"in t.props.config&&"ui"in t.props.config.camera&&"passport"in t.pr