(this.webpackJsonpdimo=this.webpackJsonpdimo||[]).push([[82],{1403:function(e,t,n){"use strict";n.r(t);var a=n(37),r=n(0),o=n.n(r),c=n(13),i=n(247),u=n(254),s=n(87),l=n(194),d=n(789),p=n(18),f=n(106),h=n(1308),m=n.n(h),b=n(998),O=Object(i.a)((function(){return{root:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",position:"absolute",zIndex:"1308",width:"100%",height:"100%",background:"rgba(0,0,0,0.6)",top:"0"}}}));var g=function(e){var t=e.legacyMode,n=e.onClick,a=e.isLoading,i=O(),u=Object(p.g)(),s=Object(f.useSnackbar)().enqueueSnackbar,h=Object(r.useRef)(null),g=function(e){e&&function(e){try{a(!0),b.a.readQR(e,"").then((function(e){a(!1);var t=Object(b.b)(e),n={};n.titularName=t.titularDestino,n.accountNumber=t.cuentaAbono,n.amount=t.importe,n.accountType="QR"+t.glosa,n.idQr=t.idQr,n.cardData={EMISOR:t.codEf,NUMERO_TARJETA:t.cuentaAbono,DOCUMENTO:t.ciNitDestino,NOMBRE_USUARIO:t.titularDestino,TAR_MASK:"",MONTO:t.importe,datosAdicionales:[]},u.push({pathname:"/app/leer/qr/origen",state:{destinationData:n}})})).catch((function(e){a(!1),s("No se pudo leer el Codigo QR. Favor vuelva a intentarlo mas tarde",{variant:"error"})}))}catch(t){Object(c.a)(t),a(!1),s("Something went wrong",{variant:"error"})}}(e)},v=function(e){console.error(e)};return o.a.createElement(l.a,{className:i.root},!t&&o.a.createElement(m.a,{delay:300,onError:v,onScan:g,style:{width:"100%"}}),t&&o.a.createElement(m.a,{ref:h,delay:300,onError:v,onScan:g,style:{width:"100%"},legacyMode:!0}),o.a.createElement(l.a,{pt:1,width:"100%"},o.a.createElement(d.a,{className:i.button,color:"secondary",fullWidth:!0,size:"large",variant:"contained",onClick:function(){n(),setTimeout((function(){h.current.openImageDialog()}),1e3)}},"Buscar en archivos")),o.a.createElement(l.a,{pt:1,width:"100%"},o.a.createElement(d.a,{className:i.button,color:"secondary",fullWidth:!0,size:"large",variant:"contained",onClick:function(){u.push({pathname:"/app"})}},"Cerrar")))},v=n(154),y=n(916),j=Object(i.a)((function(e){return{root:{backgroundColor:e.palette.background.dark,minHeight:"100%",paddingTop:e.spacing(3)}}}));t.default=function(){var e=j(),t=Object(y.a)(),n=Object(f.useSnackbar)().enqueueSnackbar,i=Object(r.useState)(!1),l=Object(a.a)(i,2),d=l[0],p=l[1],h=Object(r.useState)(!1),m=Object(a.a)(h,2),b=m[0],O=m[1],w=Object(r.useCallback)((function(){try{O(!0),v.a.loadParticipantes().then((function(e){O(!1)})).catch((function(e){O(!1),n("No se pudieron obtener las configuraciones de los participantes transaccionales. Favor vuelva a intentarlo mas tarde",{variant:"error"})}))}catch(e){Object(c.a)(e),O(!1),n("OcuRRio un error inesperado al obtener los participantes transaccionales",{variant:"error"})}}),[t]);return Object(r.useEffect)((function(){w()}),[w]),b?o.a.createElement(s.a,null):o.a.createElement(u.a,{className:e.root,title:"Leer QR"},o.a.createElement(g,{legacyMode:d,onClick:function(){return p(!d)},isLoading:function(e){return O(e)}}))}},916:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var a=n(0);n(13);function r(){var e=Object(a.useRef)(!0);return Object(a.useEffect)((function(){return function(){e.current=!1}}),[]),e}},998:function(e,t,n){"use strict";n.d(t,"b",(function(){return u}));var a=n(54),r=n(6),o=n.n(r),c=(n(13),n(8)),i={appVersion:"1.0",imei:"",token:"",user:"",phoneNumber:""},u=function(e){var t=e&&null!==e?e:{};return{idQr:t.hasOwnProperty("idQr")?t.idQr:"",codMoneda:t.hasOwnProperty("codMoneda")?t.codMoneda:"",importe:t.hasOwnProperty("importe")&&!isNaN(t.importe)?Number(t.importe):"",glosa:t.hasOwnProperty("glosa")?t.glosa:"",fechaVencimiento:t.hasOwnProperty("fechaVencimiento")?t.fechaVencimiento:"",numPagos:t.hasOwnProperty("")?t.numPagos:"numPagos",codServicio:t.hasOwnProperty("codServicio")?t.codServicio:"",codEf:t.hasOwnProperty("codEf")?t.codEf:"",cuentaAbono:t.hasOwnProperty("cuentaAbono")?t.cuentaAbono:"",ciNitDestino:t.hasOwnProperty("ciNitDestino")?t.ciNitDestino:"",titularDestino:t.hasOwnProperty("titularDestino")?t.titularDestino:""}},s=new function e(){Object(a.a)(this,e),this.generateQR=function(e){return new Promise((function(t,n){o.a.post(c.i+"/v1/qr/simple/generarQr",{header:i,qrCobro:e},{headers:{"Content-Type":"application/json"}}).then((function(e){"0"===e.data.header.codReturn?t(e.data):n({error:{message:e.data.header.txtReturn}})})).catch((function(e){n(e)}))}))},this.readQR=function(e,t){return new Promise((function(n,a){o.a.post(c.i+"/v1/qr/simple/leerQr",{header:i,qrCobro:e,ef:t},{headers:{"Content-Type":"application/json"}}).then((function(e){"0"===e.data.header.codReturn?n(e.data.mensajeQr):a({error:{message:e.data.header.txtReturn}})})).catch((function(e){a(e)}))}))}};t.a=s}}]);
//# sourceMappingURL=82.4e5125e0.chunk.js.map