dont install the scripts on booking pages (#20373)
This commit is contained in:
1 parent
be883aac02
commit
b0ed1fd5e6
3 files changed
+30
-21
No files matched your search
@@ -1,14 +1,39 @@
|
||||
import { headers } from "next/headers";
|
||||
import Script from "next/script";
|
||||
|
||||
import PageWrapper from "@components/PageWrapperAppDir";
|
||||
|
||||
export default async function PageWrapperLayout({ children }: { children: React.ReactNode }) {
|
||||
const h = await headers();
|
||||
const nonce = h.get("x-nonce") ?? undefined;
|
||||
const headScript = process.env.NEXT_PUBLIC_HEAD_SCRIPTS;
|
||||
const bodyScript = process.env.NEXT_PUBLIC_BODY_SCRIPTS;
|
||||
|
||||
const scripts = [
|
||||
{
|
||||
id: "injected-head-script",
|
||||
script: headScript ?? "",
|
||||
},
|
||||
{
|
||||
id: "injected-body-script",
|
||||
script: bodyScript ?? "",
|
||||
},
|
||||
].filter((script): script is { id: string; script: string } => !!script.script);
|
||||
|
||||
return (
|
||||
<PageWrapper requiresLicense={false} nonce={nonce}>
|
||||
{children}
|
||||
{scripts.map((script) => (
|
||||
<Script
|
||||
key={script.id}
|
||||
nonce={nonce}
|
||||
id={script.id}
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: script.script,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</PageWrapper>
|
||||
);
|
||||
}
|
||||
@@ -116,16 +116,6 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
suppressHydrationWarning
|
||||
data-nextjs-router="app">
|
||||
<head nonce={nonce}>
|
||||
{!!process.env.NEXT_PUBLIC_HEAD_SCRIPTS && (
|
||||
<script
|
||||
nonce={nonce}
|
||||
id="injected-head-scripts"
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: process.env.NEXT_PUBLIC_HEAD_SCRIPTS,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<style>{`
|
||||
:root {
|
||||
--font-inter: ${interFont.style.fontFamily.replace(/\'/g, "")};
|
||||
@@ -150,16 +140,6 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
}
|
||||
}>
|
||||
<IconSprites />
|
||||
{!!process.env.NEXT_PUBLIC_BODY_SCRIPTS && (
|
||||
<script
|
||||
nonce={nonce}
|
||||
id="injected-head-scripts"
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: process.env.NEXT_PUBLIC_BODY_SCRIPTS,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<SpeculationRules
|
||||
// URLs In Navigation
|
||||
prerenderPathsOnHover={[
|
||||
|
||||
Reference in new issue
Block a user