{"version":3,"file":"./webpack-chunks/chunk.326.b6b582cf318406352057.js","mappings":"uGAAA,MAAMA,EAAeC,SAASC,cAAc,wBACtCC,EAAUF,SAASC,cACxB,0CAIKE,EAAgBC,IACrB,MAAMC,EACLD,EAAGH,cAAc,6BAA6BK,WAAa,EACtDC,EACLH,EAAGH,cAAc,6BAA6BO,aAAa,YAAc,EAC1E,GAAIH,EAAa,CAChB,IAAII,EAAOC,KAAKC,MAAMZ,EAAaO,WACnCG,EAAKG,gBAAkB,CACtB,QAAS,kBACTP,cACAE,eAEDR,EAAac,UAAYH,KAAKI,UAAUL,EACzC,GAGKM,EAAS,CACdC,YAAY,EACZC,WAAW,EACXC,SAAS,GAGV,GAAIhB,EAAQM,aAAa,iBAExBL,EAAaD,OACP,CACN,MAAMiB,EAAWA,CAACC,EAAWC,KAC5BD,EAAUE,SAASC,IACa,kBAA3BA,EAASC,gBACZrB,EAAaD,GACbmB,EAASI,aACV,GAEqB,EAEN,IAAIC,iBAAiBP,GAC7BQ,QAAQzB,EAASa,EAC3B,C","sources":["webpack://krusteaz-website/./wp-content/themes/tombras/assets/product-schema.js"],"sourcesContent":["const schemaScript = document.querySelector(\"#product-schema-data\");\nconst reviews = document.querySelector(\n\t\"#customer-reviews-block [data-bv-show]\"\n);\nconsole.log(\"Product schema\", reviews, schemaScript);\n\nconst updateSchema = (el) => {\n\tconst ratingValue =\n\t\tel.querySelector('[itemprop=\"ratingValue\"]')?.innerText || 0;\n\tconst reviewCount =\n\t\tel.querySelector('[itemprop=\"reviewCount\"]')?.getAttribute(\"content\") || 0;\n\tif (ratingValue) {\n\t\tlet json = JSON.parse(schemaScript.innerText);\n\t\tjson.aggregateRating = {\n\t\t\t\"@type\": \"AggregateRating\",\n\t\t\tratingValue,\n\t\t\treviewCount,\n\t\t};\n\t\tschemaScript.innerHTML = JSON.stringify(json);\n\t}\n};\n\nconst config = {\n\tattributes: true,\n\tchildList: true,\n\tsubtree: true,\n};\n\nif (reviews.getAttribute(\"data-bv-ready\")) {\n\tconsole.log(\"attribute is there...\");\n\tupdateSchema(reviews);\n} else {\n\tconst callback = (mutations, observer) => {\n\t\tmutations.forEach((mutation) => {\n\t\t\tif (mutation.attributeName === \"data-bv-ready\") {\n\t\t\t\tupdateSchema(reviews);\n\t\t\t\tobserver.disconnect();\n\t\t\t}\n\t\t});\n\t\tconsole.log(mutations);\n\t};\n\tconst observer = new MutationObserver(callback);\n\tobserver.observe(reviews, config);\n}\n"],"names":["schemaScript","document","querySelector","reviews","updateSchema","el","ratingValue","innerText","reviewCount","getAttribute","json","JSON","parse","aggregateRating","innerHTML","stringify","config","attributes","childList","subtree","callback","mutations","observer","forEach","mutation","attributeName","disconnect","MutationObserver","observe"],"sourceRoot":""}