-
-
Save cyberfly/2facc508dff83b185f76e45c468f9553 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NEXT_PUBLIC_HELPSCOUT_BEACON_ID=9dc0a553-237e-5678-1234-09977d96ddf8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const HELPSCOUT_BEACON_ID = process.env.NEXT_PUBLIC_HELPSCOUT_BEACON_ID; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Script from "next/script"; | |
import { HELPSCOUT_BEACON_ID } from "helpers/constants"; | |
const Layout = ({ children }) => { | |
return ( | |
<> | |
{HELPSCOUT_BEACON_ID && ( | |
<> | |
<Script | |
id="helpscout-beacon-script" | |
strategy="lazyOnload" | |
dangerouslySetInnerHTML={{ | |
__html: `!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});`, | |
}} | |
/> | |
<Script | |
id="helpscout-beacon-init" | |
strategy="lazyOnload" | |
dangerouslySetInnerHTML={{ | |
__html: `window.Beacon('init', '${HELPSCOUT_BEACON_ID}')`, | |
}} | |
/> | |
</> | |
)} | |
</> | |
); | |
}; | |
export default Layout; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment