I have to include a third party widget into my React+TS app.
The widget is shipped in a minified js file and according to their documentation it can be included in a script tag or through e.g. requireJS.
What I cannot wrap my head around is that - as far as I understand - both methods above include the widget at runtime as window.Widget. However, I would like to interact with the widget from my TypeScript code as it exposed different methods. Is that at all possible? Obviously, I could include my own logic outside TS/React, but I'd prefer to keep it inside. If that's not possible, is there another way I could communicate with the widget other than maybe through my server?
Apologies if this is a stupid question, I'm a bit stuck right now!
Ok, so I feel pretty stupid. It turns out, I can download the minified js file and just import it into my project. It doesn't have any types, but it works.
import * as Widget from "../lib/widget.min";