To handle downloads, you can use the onDownload prop. This prop is a function that is called when the user clicks the download button.
import { Editor, downloadProject } from '@polygona/react-sdk';const MyComponent = () => {const handleDownload = async ( projectName: string, settings: Record<string, string>, outputFormat: 'glb' | 'stl') => { // You can add your own logic here. For example, you can redirect the user to your // checkout page and download the project after the payment is completed. const { data } = await downloadProject({ apiKey, projectId: id, settings, outputFormat, }); if (data) { const url = URL.createObjectURL(data); const a = document.createElement('a'); a.href = url; a.download = `${projectName}.${outputFormat}`; a.click(); URL.revokeObjectURL(url); }};return ( <Editor projectId="YOUR_PROJECT_ID" apiKey="YOUR_API_KEY" onDownload={handleDownload} />);};