// Trustindex widget loader — injects the Trustindex script once and lets it // self-initialize. Pass `loaderUrl` (the script src from your Trustindex embed // code) and optionally `widgetId` if you want to target a specific widget. function TrustindexEmbed({ loaderUrl, widgetId, minHeight }) { const ref = React.useRef(null); React.useEffect(() => { if (!loaderUrl || !ref.current) return; const existing = document.querySelector(`script[data-trustindex-src="${loaderUrl}"]`); if (!existing) { const s = document.createElement('script'); s.src = loaderUrl; s.async = true; s.defer = true; s.setAttribute('data-trustindex-src', loaderUrl); ref.current.appendChild(s); } }, [loaderUrl]); return (
); } Object.assign(window, { TrustindexEmbed });