VirusTotal / vt-augment

The VT Augment widget is an official, compliant and recommended way of integrating VirusTotal data in third-party applications.
Other
35 stars 10 forks source link

how to use the VT Augment widget in ES6 ?! #34

Open CreativeASAP opened 1 year ago

CreativeASAP commented 1 year ago

I have faced an error when using the VT Augment widget in ES6. This is the code: // Start of code import React, { useEffect, useRef } from "react"; import VTAugment from "@virustotal/vt-augment";

const VTButton = () => { const containerRef = useRef(null); const vtaugmentRef = useRef(null);

const handleButtonClick = () => { if (vtaugmentRef.current) { vtaugmentRef.current .load( "https://www.virustotal.com/ui/widget/html/MTMuMTA3LjEyLjUwfHxpcF9hZGRyZXNzfHx7ImJkMSI6ICIjNGQ2Mzg1IiwgImJnMSI6ICIjMzEzZDVhIiwgImJnMiI6ICIjMjIyYzQyIiwgImZnMSI6ICIjZmZmZmZmIiwgInR5cGUiOiAiZGVmYXVsdCJ9fHxzZXNzaW9ufHxmb3VuZHx8djN8fDE2OTYyNjY1MzV8fGYwZjMxMDQ2MDllZmI3NzU1MzBjMmM4NGEzZTYxZDQxNDcwZWRjMDYxOWEyYzA0ZWU2NzFjZjIxNzgwOWRmZjY" ) .openDrawer(); } };

useEffect(() => { if (containerRef.current) { vtaugmentRef.current = new VTAugment(containerRef.current, { mode: "drawer", }); } }, []);

return (

); };

export default VTButton;

// End of code

and this is the error: Uncaught TypeError: import_vt_augment.default is not a constructor at VTButton.jsx:20:30 at commitHookEffectListMount (react-dom.development.js:23150:26) at commitPassiveMountOnFiber (react-dom.development.js:24926:13) at commitPassiveMountEffects_complete (react-dom.development.js:24891:9) at commitPassiveMountEffects_begin (react-dom.development.js:24878:7) at commitPassiveMountEffects (react-dom.development.js:24866:3) at flushPassiveEffectsImpl (react-dom.development.js:27039:3) at flushPassiveEffects (react-dom.development.js:26984:14) at performSyncWorkOnRoot (react-dom.development.js:26076:3) at flushSyncCallbacks (react-dom.development.js:12042:22)

Derekt2 commented 6 months ago

same problem here, unable to import in Vue.js framework via import VTAugment from "@virustotal/vt-augment";

My guess is this is unsupported as UMD is only option provided