@@ -19,6 +19,7 @@ const styles = {
1919 Bianca : { crust : '#e6c27b' , sauce : '#fff3e0' , cheese : '#fff9c4' } ,
2020 BBQ : { crust : '#d4a342' , sauce : '#5d4037' , cheese : '#ffab00' } ,
2121 Pesto : { crust : '#c5e1a5' , sauce : '#388e3c' , cheese : '#f1f8e9' } ,
22+ Wales : { crust : '#53d442' , sauce : '#d32f2f' , cheese : '#ffffff' } ,
2223} ;
2324
2425function setPizzaStyle ( styleName ) {
@@ -28,6 +29,9 @@ function setPizzaStyle(styleName) {
2829 document . documentElement . style . setProperty ( '--crust' , style . crust ) ;
2930 document . documentElement . style . setProperty ( '--sauce' , style . sauce ) ;
3031 document . documentElement . style . setProperty ( '--cheese' , style . cheese ) ;
32+ if ( styleName === 'Wales' ) {
33+ addTopping ( 'π' , 'Medium' , 10 ) ;
34+ }
3135 }
3236}
3337
@@ -104,9 +108,7 @@ function resetPizza() {
104108function getPizzaState ( ) {
105109 const sauceVisible = document . getElementById ( 'sauce-layer' ) . style . display === 'block' ;
106110 const cheeseVisible = document . getElementById ( 'cheese-layer' ) . style . display === 'block' ;
107- const toppings = Array . from ( document . querySelectorAll ( '.topping span' ) ) . map (
108- ( s ) => s . innerText ,
109- ) ;
111+ const toppings = Array . from ( document . querySelectorAll ( '.topping span' ) ) . map ( ( s ) => s . innerText ) ;
110112
111113 return {
112114 size : sizeText . innerText ,
@@ -116,7 +118,7 @@ function getPizzaState() {
116118 } ;
117119}
118120
119- function sharePizza ( ) {
121+ function sharePizza ( agentInvoked = false ) {
120122 const state = getPizzaState ( ) ;
121123 const jsonString = JSON . stringify ( state ) ;
122124 // Correctly handle Unicode (emojis) with btoa
@@ -126,7 +128,15 @@ function sharePizza() {
126128 const params = new URLSearchParams ( url . search ) ;
127129 params . set ( 'share' , base64 ) ;
128130 url . search = params . toString ( ) ;
129- return url . toString ( ) ;
131+ const shareUrl = url . toString ( ) ;
132+
133+ navigator . clipboard . writeText ( shareUrl ) . then ( ( ) => {
134+ if ( ! agentInvoked ) {
135+ alert ( 'Link copied to clipboard!' ) ;
136+ }
137+ } ) ;
138+
139+ return shareUrl ;
130140}
131141
132142function loadPizzaStateFromURL ( ) {
@@ -186,7 +196,7 @@ if (window.navigator.modelContext) {
186196 inputSchema : {
187197 type : 'object' ,
188198 properties : {
189- style : { type : 'string' , enum : [ 'Classic' , 'Bianca' , 'BBQ' , 'Pesto' ] } ,
199+ style : { type : 'string' , enum : [ 'Classic' , 'Bianca' , 'BBQ' , 'Pesto' , 'Wales' ] } ,
190200 } ,
191201 required : [ 'style' ] ,
192202 } ,
@@ -224,7 +234,7 @@ if (window.navigator.modelContext) {
224234 properties : {
225235 topping : {
226236 type : 'string' ,
227- enum : [ 'π' , 'π' , 'πΏ' , 'π' , 'π«' , 'π₯' , 'π§
' , 'π«' , 'π½' , 'πΆοΈ' ] ,
237+ enum : [ 'π' , 'π' , 'πΏ' , 'π' , 'π«' , 'π₯' , 'π§
' , 'π«' , 'π½' , 'πΆοΈ' , 'π' ] ,
228238 } ,
229239 size : { type : 'string' , enum : [ 'Small' , 'Medium' , 'Large' , 'Extra Large' ] } ,
230240 count : {
@@ -249,7 +259,7 @@ if (window.navigator.modelContext) {
249259 properties : {
250260 topping : {
251261 type : 'string' ,
252- enum : [ 'π' , 'π' , 'πΏ' , 'π' , 'π«' , 'π₯' , 'π§
' , 'π«' , 'π½' , 'πΆοΈ' ] ,
262+ enum : [ 'π' , 'π' , 'πΏ' , 'π' , 'π«' , 'π₯' , 'π§
' , 'π«' , 'π½' , 'πΆοΈ' , 'π' ] ,
253263 } ,
254264 all : {
255265 type : 'boolean' ,
0 commit comments