@@ -51,9 +51,28 @@ if (!bundle) {
5151 throw new Error ( "Failed to get 'data-bundle' attribute from frame element" ) ;
5252}
5353
54+ /** @type {import('@opendatacapture/runtime-core').InteractiveInstrument }*/
5455const instrument = await evaluateInstrument ( bundle ) ;
5556
56- /** @type {string[] | undefined } */
57+ if ( instrument . content . meta ) {
58+ Object . entries ( instrument . content . meta ) . forEach ( ( [ name , content ] ) => {
59+ const meta = document . createElement ( 'meta' ) ;
60+ meta . name = name ;
61+ meta . content = content ;
62+ document . head . appendChild ( meta ) ;
63+ } ) ;
64+ }
65+
66+ const encodedStyle = instrument . content . __injectHead ?. style ;
67+ if ( encodedStyle ) {
68+ const style = atob ( encodedStyle ) ;
69+ document . head . insertAdjacentHTML ( 'beforeend' , `<style>${ style } </style>` ) ;
70+ }
71+
72+ if ( instrument . content . html ) {
73+ document . body . insertAdjacentHTML ( 'beforeend' , instrument . content . html ) ;
74+ }
75+
5776const scripts = instrument . content . __injectHead ?. scripts ;
5877scripts ?. forEach ( ( encodedScript ) => {
5978 const script = document . createElement ( 'script' ) ;
@@ -62,10 +81,4 @@ scripts?.forEach((encodedScript) => {
6281 document . head . appendChild ( script ) ;
6382} ) ;
6483
65- const encodedStyle = instrument . content . __injectHead ?. style ;
66- if ( encodedStyle ) {
67- const style = atob ( encodedStyle ) ;
68- document . head . insertAdjacentHTML ( 'beforeend' , `<style>${ style } </style>` ) ;
69- }
70-
7184await instrument . content . render ( done ) ;
0 commit comments