1- <!DOCTYPE html>
1+ <!doctype html>
22< html >
33 < head >
44 < base target ="_top " />
1010 --surface-color : # ffffff ;
1111 }
1212 body {
13- font-family : -apple-system, BlinkMacSystemFont, "Segoe UI" , Roboto,
14- Helvetica, Arial, sans-serif;
13+ font-family :
14+ -apple-system, BlinkMacSystemFont, "Segoe UI" , Roboto, Helvetica,
15+ Arial, sans-serif;
1516 margin : 0 ;
1617 padding : 0 ;
1718 background : var (--bg-color );
@@ -359,7 +360,7 @@ <h3>A2UI App Hub</h3>
359360 if ( msg . beginRendering . styles ?. primaryColor ) {
360361 document . documentElement . style . setProperty (
361362 "--primary-color" ,
362- msg . beginRendering . styles . primaryColor
363+ msg . beginRendering . styles . primaryColor ,
363364 ) ;
364365 }
365366 }
@@ -370,7 +371,7 @@ <h3>A2UI App Hub</h3>
370371 }
371372 if ( msg . surfaceUpdate ) {
372373 msg . surfaceUpdate . components . forEach (
373- ( c ) => ( state . components [ c . id ] = c )
374+ ( c ) => ( state . components [ c . id ] = c ) ,
374375 ) ;
375376 if ( ! state . rootId && msg . surfaceUpdate . components . length > 0 ) {
376377 state . rootId = msg . surfaceUpdate . components [ 0 ] . id ;
@@ -405,14 +406,14 @@ <h3>A2UI App Hub</h3>
405406 . replace ( / > / g, ">" ) ;
406407 html = html . replace (
407408 / \[ ( [ ^ \] ] + ) \] \( ( h t t p s ? : \/ \/ [ ^ \s ) ] + ) \) / g,
408- '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
409+ '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>' ,
409410 ) ;
410411 const urlPattern = / ( h t t p s ? : \/ \/ [ ^ \s ] + ) / ;
411412 if ( ! html . includes ( "<a " ) && urlPattern . test ( html ) ) {
412413 html = html . replace (
413414 urlPattern ,
414415 ( match ) =>
415- `<a href="${ match } " target="_blank" rel="noopener noreferrer">More Info</a>`
416+ `<a href="${ match } " target="_blank" rel="noopener noreferrer">More Info</a>` ,
416417 ) ;
417418 }
418419 return html ;
@@ -426,12 +427,12 @@ <h3>A2UI App Hub</h3>
426427
427428 if ( entry . valueMap && Array . isArray ( entry . valueMap ) ) {
428429 const isStandardMap = entry . valueMap . some (
429- ( v ) => v && typeof v === "object" && "key" in v
430+ ( v ) => v && typeof v === "object" && "key" in v ,
430431 ) ;
431432 if ( isStandardMap ) {
432433 const isListLike = entry . valueMap . every (
433434 ( v , i ) =>
434- String ( v . key ) === String ( i ) || String ( v . key ) . startsWith ( "item" )
435+ String ( v . key ) === String ( i ) || String ( v . key ) . startsWith ( "item" ) ,
435436 ) ;
436437 if ( isListLike ) return entry . valueMap . map ( ( v ) => parseValue ( v ) ) ;
437438 const obj = { } ;
@@ -523,7 +524,7 @@ <h3>A2UI App Hub</h3>
523524 props . url . literalString ||
524525 resolvePath ( sid , joinPath ( ctx , props . url . path ) ) ;
525526 img . src =
526- url || "https:/ /via.placeholder.com/400x200?text=No+Image" ;
527+ url || "https:\/\ /via.placeholder.com\ /400x200?text=No+Image" ;
527528 if ( props . width ) {
528529 img . style . width = props . width ;
529530 img . style . minHeight = "0" ;
@@ -580,26 +581,26 @@ <h3>A2UI App Hub</h3>
580581 } ;
581582 sendMessage (
582583 `DETAILS_JSON:${ JSON . stringify ( d ) } ` ,
583- "Loading Form..."
584+ "Loading Form..." ,
584585 ) ;
585586 } else if ( actionName === "submit_booking" ) {
586587 const inputs = document . querySelectorAll ( ".a2ui-textfield" ) ;
587588 let details = [ ] ;
588589 inputs . forEach ( ( i ) =>
589- details . push ( `${ i . dataset . label } : ${ i . value } ` )
590+ details . push ( `${ i . dataset . label } : ${ i . value } ` ) ,
590591 ) ;
591592 const rName =
592593 resolvePath ( sid , "restaurantName" ) || "the restaurant" ;
593594 const rImage = resolvePath ( sid , "imageUrl" ) || "" ;
594595 sendMessage (
595596 `User submitted a booking for ${ rName } . Details: ${ details . join (
596- ", "
597+ ", " ,
597598 ) } . ImageUrl: ${ rImage } `,
598- "Submitting..."
599+ "Submitting..." ,
599600 ) ;
600601 } else if ( actionName === "add_events" ) {
601602 const checkboxes = document . querySelectorAll (
602- ".a2ui-checkbox:checked"
603+ ".a2ui-checkbox:checked" ,
603604 ) ;
604605 if ( checkboxes . length === 0 ) {
605606 alert ( "Please select at least one event." ) ;
@@ -614,7 +615,7 @@ <h3>A2UI App Hub</h3>
614615 }
615616 } ) ;
616617 const msg = `Please add these events to calendar: ${ JSON . stringify (
617- selectedEvents
618+ selectedEvents ,
618619 ) } `;
619620 sendMessage ( msg , "Adding to Calendar..." ) ;
620621 } else if ( actionName === "back_to_list" ) {
@@ -717,9 +718,8 @@ <h3>A2UI App Hub</h3>
717718
718719 if ( r . uiJson ) renderA2UiMessages ( r . uiJson ) ;
719720 else if ( r . text )
720- document . getElementById (
721- "ui-container"
722- ) . innerHTML = `<div class="a2ui-card"><p>${ r . text } </p></div>` ;
721+ document . getElementById ( "ui-container" ) . innerHTML =
722+ `<div class="a2ui-card"><p>${ r . text } </p></div>` ;
723723 } )
724724 . withFailureHandler ( ( e ) => {
725725 alert ( "Error: " + e . message ) ;
0 commit comments