@@ -7,7 +7,6 @@ import { FragmentOf } from '~/client/graphql';
77import { ScriptsFragment } from './fragment' ;
88
99type ScriptsData = FragmentOf < typeof ScriptsFragment > ;
10- type ScriptNode = NonNullable < ScriptsData [ 'scripts' ] [ 'edges' ] > [ number ] [ 'node' ] ;
1110
1211interface ScriptRendererProps {
1312 scripts : ScriptsData [ 'scripts' ] | null ;
@@ -27,7 +26,7 @@ interface ScriptsProps {
2726 * @param {ComponentProps<typeof Script>['strategy'] } props.strategy - The loading strategy
2827 * @returns {JSX.Element | null } JSX element containing the rendered scripts
2928 */
30- const ScriptRenderer = ( { scripts, location, strategy } : ScriptRendererProps ) => {
29+ export const ScriptManagerScripts = ( { scripts, location, strategy } : ScriptRendererProps ) => {
3130 if ( ! scripts ?. edges ) return null ;
3231
3332 const scriptNodes = removeEdgesAndNodes ( scripts ) ;
@@ -75,25 +74,3 @@ const ScriptRenderer = ({ scripts, location, strategy }: ScriptRendererProps) =>
7574 </ >
7675 ) ;
7776} ;
78-
79- /**
80- * Renders scripts that should be placed in the <head> tag
81- * Uses afterInteractive strategy for critical functionality
82- * @param {ScriptsProps } props - The props containing scripts data
83- * @param {ScriptsData['scripts'] | null } props.scripts - The scripts data from GraphQL
84- * @returns {JSX.Element | null } JSX element containing header scripts
85- */
86- export const HeaderScripts = ( { scripts } : ScriptsProps ) => {
87- return < ScriptRenderer location = "head" scripts = { scripts } strategy = "afterInteractive" /> ;
88- } ;
89-
90- /**
91- * Renders scripts that should be placed before the closing </body> tag
92- * Uses lazyOnload strategy for better performance
93- * @param {ScriptsProps } props - The props containing scripts data
94- * @param {ScriptsData['scripts'] | null } props.scripts - The scripts data from GraphQL
95- * @returns {JSX.Element | null } JSX element containing footer scripts
96- */
97- export const FooterScripts = ( { scripts } : ScriptsProps ) => {
98- return < ScriptRenderer location = "footer" scripts = { scripts } strategy = "lazyOnload" /> ;
99- } ;
0 commit comments