@@ -68,8 +68,10 @@ public function render(BlockInterface $block, $templateFile, array $dictionary =
6868 return $ result ;
6969 }
7070
71- // Do not wrap if content looks like JSON
72- if (str_starts_with ($ trimmedResult , '{ ' ) || str_starts_with ($ trimmedResult , '[ ' )) {
71+ // Do not wrap if content looks like JSON (also check for common JSON patterns)
72+ if (str_starts_with ($ trimmedResult , '{ ' ) ||
73+ str_starts_with ($ trimmedResult , '[ ' ) ||
74+ (str_starts_with ($ trimmedResult , '" ' ) && str_contains ($ trimmedResult , '":{" ' ))) {
7375 return $ result ;
7476 }
7577
@@ -78,8 +80,15 @@ public function render(BlockInterface $block, $templateFile, array $dictionary =
7880 return $ result ;
7981 }
8082
81- // Do not wrap if template path suggests partial/JS/JSON
82- if (strpos ($ templateFile , '/js/ ' ) !== false || strpos ($ templateFile , '/json/ ' ) !== false ) {
83+ // Do not wrap if template path suggests partial/JS/JSON or Magewire/Hyva Checkout components
84+ // Only block Hyva Checkout specifically, not all checkout templates
85+ $ lowerTemplatePath = strtolower ($ templateFile );
86+ if (strpos ($ lowerTemplatePath , '/js/ ' ) !== false ||
87+ strpos ($ lowerTemplatePath , '/json/ ' ) !== false ||
88+ strpos ($ lowerTemplatePath , '/magewire/ ' ) !== false ||
89+ strpos ($ lowerTemplatePath , '/livewire/ ' ) !== false ||
90+ (strpos ($ lowerTemplatePath , 'hyva ' ) !== false && strpos ($ lowerTemplatePath , 'checkout ' ) !== false ) ||
91+ strpos ($ lowerTemplatePath , 'component.phtml ' ) !== false ) {
8392 return $ result ;
8493 }
8594
0 commit comments