Module 900686

644 characters · in 4c3c9a548e67a0a1.js, 33645dc6ae61c139.js
Dependencies
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){n.d(t,{A:()=>a});var i=n(64700),s=n(522579),l=n(77729),r=n(723702);class a extends i.Component{getFileContents(){let{fileContents:e}=this.props;return"function"==typeof e&&(e=e()),e}handleFileDownload=e=>{e.preventDefault();let t=this.getFileContents(),{fileName:n,onDownload:i}=this.props;r.isPlatformEmbedded?this.downloadNative(t,n):this.downloadHtml5(t,n),i?.()};downloadNative(e,t){l.A.fileManager.saveWithDialog(e,t)}downloadHtml5(e,t){let n=new Blob([e],{type:this.props.contentType});(0,s.saveAs)(n,t)}render(){let{children:e}=this.props,t=i.Children.only(e);return i.cloneElement(t,{onClick:this.handleFileDownload})}}}