Hello Plasmic team! I’m loving Plasmic thus far and where I imagine this project is headed.
I have a funny issue that I’m experiencing can’t for the life of me figure out a way around this. Maybe you all might have an idea.
Crisp Chat which is deployed to our production finds its way into ever part of plasmic lol.
Context might help, sorry.
• Deployed on NextJS
• Plasmic is configured with /pages/[[…catchall]].tsx
• the following goes in the <head>
of the /pages/_document.tsx
<script
dangerouslySetInnerHTML={{
__html: `
window.$crisp = [];
CRISP_WEBSITE_ID = "${id}";
(function(){d=document;s=d.createElement("script");s.src="<https://client.crisp.chat/l.js>";s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();
`,
}}
/>
ah… you’ll need to not execute that code for your plasmic-host.tsx
page. I don’t think you can do so from _document.tsx
but should be able to from _app.tsx
by checking the current route before including the snippet
Ah that makes sense, conceptually at least. I haven’t messed with routes too much. If you happen to know a good resource to point me in the right direction to exclude something if the route is plasmic-host, that would be awesome.
No worries if not, I’m sure I’ll figure it out
@appetizing_ox FWIW, I have a very similar setup adding a chat widget in _app.tsx
and I have had no problems with it showing up in Plasmic
In case it helps, here’s the relevant code in my _app.tsx
file (note the <Script>
tag
import Script from 'next/script';
// ...
function MyApp({ Component, pageProps }: AppProps) {
return (
// ...
<Script
src="<https://chat-assets.frontapp.com/v1/chat.bundle.js>"
strategy="lazyOnload"
onLoad={() => {
(window as any).FrontChat('init', {chatId: process.env.FRONT_CHAT_ID, useDefaultLauncher: true});
}} />
<Component {...pageProps} />
// ...
);
}
export default MyApp;
of course you’ll replace the front chat script with your chat widget of choice