diff --git a/src/components/error-component/error-boundary.js b/src/components/error-component/error-boundary.js index 53719559..78642ce3 100644 --- a/src/components/error-component/error-boundary.js +++ b/src/components/error-component/error-boundary.js @@ -9,6 +9,11 @@ class ErrorBoundary extends React.Component { } componentDidCatch = (error, info) => { + if (error?.message?.includes('survicate.com')) { + console.warn('Survicate script error:', error.message); + return; + } + if (window.TrackJS) window.TrackJS.console.log(this.props.root_store); this.setState({ diff --git a/src/public-path.ts b/src/public-path.ts index 7f77e322..67121daf 100644 --- a/src/public-path.ts +++ b/src/public-path.ts @@ -20,6 +20,7 @@ declare global { Survicate?: { track: (attribute: string, value: string) => void; }; + TrackJS: { configure: (config: { onError: (payload: any) => boolean }) => void }; } } @@ -37,11 +38,16 @@ const setSurvicateCalledValue = (value: boolean) => { }; const loadSurvicateScript = (callback: () => void) => { + if (document.getElementById('dbot-survicate')) return; + const script = document.createElement('script'); script.id = 'dbot-survicate'; script.async = true; script.src = 'https://survey.survicate.com/workspaces/83b651f6b3eca1ab4551d95760fe5deb/web_surveys.js'; script.onload = callback; + script.onerror = () => { + console.warn('Survicate script failed to load, ignoring error.'); + }; const firstScript = document.getElementsByTagName('script')[0]; if (firstScript?.parentNode) {