PageSourceSearch

https://www.xtrawine.com/cdn/shop/t/101/assets/algolia-collection-utils.js?v=33210231021615774081773245332

js xtrawine.com collected 2026-09-24 23:21:08 UTC 6,990 bytes, 2 lines download raw bytes

1const DOMUtils={getElement(selector){return document.querySelector(selector)},getElements(selector){return document.querySelectorAll(selector)},getElementById(id){return document.getElementById(id.replace("#",""))},hideElement(element){element&&(element.style.display="none",element.style.visibility="hidden")},showElement(element){element&&(element.style.display="",element.style.visibility="visible")},removeElement(element){element&&element.parentNode&&element.parentNode.removeChild(element)},clearProductGrid(){const container=this.getElement(ALGOLIA_CONFIG.SELECTORS.PRODUCT_GRID);container&&(container.innerHTML="")},hideProductItems(){this.getElements(ALGOLIA_CONFIG.SELECTORS.PRODUCT_ITEMS).forEach(product=>{this.hideElement(product),this.removeElement(product)})},hideErrorContainers(){this.getElements(ALGOLIA_CONFIG.SELECTORS.ERROR_CONTAINERS).forEach(container=>this.hideElement(container))}},SearchUtils={buildBasicSearchParams(query="",filters={}){return{query,filters:this.buildFilterString(filters),hitsPerPage:ALGOLIA_CONFIG.SEARCH.DEFAULT_HITS_PER_PAGE,page:0}},buildFilterString(filters){const filterParts=[];Object.entries(filters).forEach(([field,values])=>{if(Array.isArray(values)&&values.length>0)if(field==="meta.xtrawine.grapesMain"){const grapeFilters=values.map(grape=>`${field}:"${grape}"`);filterParts.push(`(${grapeFilters.join(" OR ")})`),console.log("\u{1F347} Grapes substring filter:",{original:values,filterString:`(${grapeFilters.join(" OR ")})`})}else if(field==="meta.xtrawine.subCategoryList"){const subCategoryFilters=[];values.forEach(selectedValue=>{[`["${selectedValue}"]`,`"${selectedValue}",`,`,"${selectedValue}",`,`,"${selectedValue}"]`].forEach(pattern=>{subCategoryFilters.push(`${field}:"${pattern}"`)})}),filterParts.push(`(${subCategoryFilters.join(" OR ")})`),console.log("\u{1F3F7}\uFE0F SubCategory filter patterns:",{original:values,filterString:`(${subCategoryFilters.join(" OR ")})`,patterns:subCategoryFilters})}else{const filterValues=values.map(value=>`"${value}"`).join(" OR ");filterParts.push(`${field}:(${filterValues})`)}});const finalFilter=filterParts.join(" AND ");return console.log("\u{1F50D} Final filter string:",finalFilter),finalFilter},buildCollectionFilter(collectionHandle){return collectionHandle?`${ALGOLIA_CONFIG.FIELDS.COLLECTION_FILTER_FIELD}:"${collectionHandle}"`:""},groupProductsByCountry(products){console.log("\u{1F30D} Raggruppamento prodotti per paese",products);const countryGroups={};products.forEach(product=>{const country=product?.meta?.xtrawine?.country;country&&(countryGroups[country]||(countryGroups[country]=[]),countryGroups[country].push(product))});const result=Object.keys(countryGroups).sort().map(country=>({name:country,count:countryGroups[country].length,products:countryGroups[country]}));return console.log("\u{1F30D} Paesi trovati:",result.map(g=>`${g.name} (${g.count})`)),result},groupProductsByRegion(products,selectedCountry){console.log("\u{1F3D4}\uFE0F Raggruppamento prodotti per regione",{selectedCountry,productC
1ount:products.length});const regionGroups={};products.forEach(product=>{const country=product?.meta?.xtrawine?.country,region=product?.meta?.xtrawine?.zone;country===selectedCountry&&region&&(regionGroups[region]||(regionGroups[region]=[]),regionGroups[region].push(product))});const result=Object.keys(regionGroups).sort().map(region=>({name:region,count:regionGroups[region].length,products:regionGroups[region]}));return console.log("\u{1F3D4}\uFE0F Regioni trovate per",selectedCountry,":",result.map(g=>`${g.name} (${g.count})`)),result},getRegionsForCountry(products,country){console.log("\u{1F5FA}\uFE0F Ricerca regioni per paese:",country);const regions=[...new Set(products.filter(product=>product?.meta?.xtrawine?.country===country).map(product=>product?.meta?.xtrawine?.zone).filter(zone=>zone))].sort();return console.log("\u{1F5FA}\uFE0F Regioni disponibili:",regions),regions},formatSearchResults(results,context="search"){return{hits:results.hits||[],totalHits:results.nbHits||0,totalPages:results.nbPages||0,currentPage:results.page||0,processingTime:results.processingTimeMS||0,context}}},LogUtils={logSearchOperation(operation,params,results=null){const emoji=this.getOperationEmoji(operation);console.log(`${emoji} ${operation}:`,params),results&&console.log(`\u{1F4CA} Results: ${results.hits?.length||0} products found in ${results.processingTime||0}ms`)},logCollectionInfo(collectionHandle,hitsPerPage){console.log("\u{1F3EA} Collection:",collectionHandle,"Items per page:",hitsPerPage)},logConfigDetails(config){console.log("\u{1F527} Algolia config found:",config),console.log("\u{1F527} Config details:",{appId:config.appId,apiKey:config.apiKey?`${config.apiKey.substring(0,10)}...`:"MISSING",indexName:config.indexName})},logFilterOperation(operation,count,details=null){console.log(`\u{1F6AB} ${operation}: ${count} items`,details||"")},logTranslationInit(language){console.log("\u{1F30D} Translation system initialized for language:",language)},getOperationEmoji(operation){return{search:"\u{1F50D}",filter:"\u{1F53D}",sort:"\u{1F4CA}",pagination:"\u{1F4C4}",config:"\u{1F527}",error:"\u274C",success:"\u2705",test:"\u{1F9EA}",collection:"\u{1F3EA}"}[operation]||"\u{1F4CB}"}},ValidationUtils={isAlgoliaConfigured(){return window.algoliaConfig&&window.algoliaConfig.appId&&window.algoliaConfig.apiKey&&window.algoliaConfig.indexName},isValidCollection(collectionHandle){return collectionHandle&&typeof collectionHandle=="string"&&collectionHandle.trim().length>0},isValidPrice(price){return!isNaN(parseFloat(price))&&isFinite(price)&&price>=0},isValidLanguage(lang){return ALGOLIA_CONFIG.LANGUAGES.SUPPORTED.includes(lang)},sanitizeString(str){return typeof str=="string"?str.trim():""},validateFilterValue(value){return value!=null&&value!==""}},URLUtils={getCurrentURL(){return new URL(window.location)},getURLParams(){return new URLSearchParams(window.location.search)},buildURLWithParams(newParams={},excludeParams=[]){const baseUrl=window.location.origin+window.location.pathname,urlParams=new URLSearchParams(window.location.search);excludeParams.forEach(param=>urlParams.delete(param)),Object.entries(newParams).forEach(([key,value])=>{value==null||value===""?urlParams.delete(key):urlParams.set(key,value)});const queryString=urlParams.toString();return queryString?`${baseUrl}?${queryString}`:baseUrl},updateURL(params,replaceState=!1){const url=this.getCurrentURL();Object.entries(params).forEach(([key,value])=>{value!=null&&value!==""?url.searchParams.set(key,value):url.searchParams.delete(key)});const method=replaceState?"replaceState":"pushState";window.history[method]({},"",url)},extractLanguageFromURL(){const pathSegments=window.location.pathname.split("/").filter(segment=>segment);return pathSegments.length>0&&ALGOLIA_CONFIG.LANGUAGES.SUPPORTED.includes(pathSegments[0])?pathSegments[0]:null}};
2//# sourceMappingURL=/cdn/shop/t/101/assets/algolia-collection-utils.js.map?v=33210231021615774081773245332

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.