Module 900686

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