PageSourceSearch

https://www.oliocarli.us/etc.clientlibs/fratellicarli/clientlibs/c…/754.8a2e6502b9c6f90a781c.chunk.js

js oliocarli.us collected 2026-10-08 06:19:17 UTC 15,906 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfratelli_carli=self.webpackChunkfratelli_carli||[]).push([[754],{7754:function(e,t,a){a.r(t),a.d(t,{default:function(){return p}});var n=a(6540);const i="conf_format",r="conf_packaging";var l=a(4346);function o(e,t,a){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class c{constructor(){o(this,"utils",new l.O),o(this,"selector","[data-cmp-is='productcollection'], [data-cmp-is='product-list'], .cmp-tabs__tabpanel--active, .pdpdetail, [data-fc-datalayer-listname='hero'], [data-fc-datalayer-listname='bundle']:not(.hidden)"),this.observer=null,this.observerElement=null}init(){this.observer=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&this.pushEventData(e.target)})});document.querySelectorAll(this.selector).forEach(e=>{this.observer.observe(e)})}pushEventData(e){let t=[];t.push(this.utils.getFcData(e)),t.forEach(e=>{e.length>0&&this.utils.pushECommerceEvent("view_item_list",{items:e})})}initNewBundleComponent(){this.observerElement=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&this.pushEventData(e.target)})});const e=document.querySelectorAll("[data-fc-datalayer-listname='bundle']:not(.hidden)");let t=[];if(window.dataLayer){const e=window.dataLayer.filter(e=>"view_item_list"==e.event);t=e.map(e=>{var t;return null===(t=e.ecommerce)||void 0===t?void 0:t.items[0]}).filter(e=>"bundle"==e.item_list_name).map(e=>e.sku)}e.forEach(e=>{const a=e.dataset.bundleVariantSku;t.includes(a)||this.observerElement.observe(e)})}}var s=a(579),u=a(8808);function d(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function m(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?d(Object(a),!0).forEach(function(t){f(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):d(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function f(e,t,a){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var p=e=>{const{isConfigurable:t,productThumbnail:a,productName:l,initialSku:o,variantsJson:d,variantsAttributeJson:f,defaultFormatLabelValue:p,defaultPackageLabelValue:v,finalPrice:b,finalPriceFormatted:_,originalPrice:y,originalPriceFormatted:g,productPricePerLitOil:h,addToCartLabel:E,productDisabledLabel:P,notifyMeCtaText:S,isNotifyMeEnabled:k,simpleItemsPerPack:A,simplePackagingType:w,simpleItemWeight:N,simpleMeasurementUnits:O,isProductAvailable:C,inStock:q,bundleAddToCartBtn:$,bundleCardShortDescription:L,bundleMultiplePurchaseDiscount:F,bundleTotalForItems:T,showOmnibus:D,carliDiscountPercent:j,omnibusPriceFormatted:x}=e.valueMap,{userPDPPrice:M,pdpSku:H,pdpVariants:I}=e.realTimeData,z=I||JSON.parse(d||"{}"),J=JSON.parse(f||"[]"),[U,V]=(0,n.useState)(!1),[B,G]=(0,n.useState)(!1),[R,K]=(0,n.useState)(null),[Q,W]=(0,n.useState)(null),[Y,X]=(0,n.useState)(null),[Z,ee]=(0,n.use
1State)(null),[te,ae]=(0,n.useState)("false"==C),[ne,ie]=(0,n.useState)("false"==q),re=document.querySelectorAll("input"),le=!!Array.from(re).find(e=>"isConfezioneMista"===e.name&&"true"===e.value),oe=0===Object.keys(z).length,{handleNotifyMe:ce}=(0,u.A)();(0,n.useEffect)(()=>{const e=e=>{ue(window.location.hash.replaceAll("#","")),e.preventDefault()},t=document.querySelectorAll(".productFullDetail__options button");return t.forEach(function(t){t.addEventListener("click",e)},void 0),()=>{t.forEach(function(t){t.removeEventListener("click",e)},void 0)}},[]),(0,n.useEffect)(()=>{ue()},[o]),(0,n.useEffect)(()=>{oe&&se()},[R,Q]),(0,n.useEffect)(()=>{var e,t,a,n,l;if(!R&&!Q||0===Object.keys(z).length){let e=!1;var o,c,s;if(M&&H)e=M.originalPrice&&M.originalPrice.value>(null===(o=M.finalPrice)||void 0===o?void 0:o.value),X(e?M.originalPrice.formatted:null),((null==M||null===(c=M.finalPrice)||void 0===c?void 0:c.formatted)||(null==M||null===(s=M.finalPrice)||void 0===s?void 0:s.formattedFinalPrice))&&ee(M.finalPrice.formatted||M.finalPrice.formattedFinalPrice);else e=b<y,X(e?g:null),ee(_);return}const u=null===(e=J.find(e=>e.id===i).values.find(e=>e.label===R))||void 0===e?void 0:e.id,d=null===(t=J.find(e=>e.id===r).values.find(e=>e.label===Q))||void 0===t?void 0:t.id,m=z.find(({variantAttributes:e})=>e[i]===u&&e[r]===d);if(!m)return void ae(!0);const f=z.find(({variantAttributes:e})=>e.conf_format===u&&e.conf_packaging===d),p=M&&H&&H==(null==f?void 0:f.sku)&&M||f,v=p.originalPrice&&p.originalPrice.value>(null===(a=p.finalPrice)||void 0===a?void 0:a.value);X(v?p.originalPrice.formatted:null),((null==p||null===(n=p.finalPrice)||void 0===n?void 0:n.formatted)||(null==p||null===(l=p.finalPrice)||void 0===l?void 0:l.formattedFinalPrice))&&ee(p.finalPrice.formatted||p.finalPrice.formattedFinalPrice),ae(!1),document.getElementById("ci-360-pdp-id").setAttribute("value",m.sku),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#"+m.sku),setTimeout(()=>{window.dispatchEvent(new PopStateEvent("popstate"))},0),ue()},[d,f,R,Q,M,I]);const se=e=>{var t;const a=document.querySelectorAll(".bundleComponent.bundleComponent-container"),n=null===(t=document.querySelector('meta[name="currency-code"]'))||void 0===t?void 0:t.content,i="EUR"==n?"€":"USD"==n?"$":"CHF ",r=0===Object.keys(z).length;a&&a.length>0&&a.forEach(t=>{const a=t.getAttribute("data-bundle-variant-sku");(r||a!==e.sku)&&t.classList.add("hidden"),r||a===e.sku||t.classList.remove("observed")});const l=r?document.querySelector(".bundleComponent.bundleComponent-container"):document.querySelector(`[data-bundle-variant-sku="${e.sku}"]`);if(l){var o;l.classList.contains("hidden")&&(l.classList.remove("hidden"),r||l.classList.contains("observed")||(setTimeout(()=>{(new c).initNewBundleComponent()},300),l.classList.add("observed")));const P=JSON.parse(l.querySelector(".item__root").dataset.cmpDataLayer);!r&&P&&R&&Q&&(P.item_sku=null==e?void 0:e.sku,P.item_variant_formato=R||"",P.item_variant_confezione=Q||"",l.querySelector(".item__root").setAttribute("data-cmp-data-layer",JSON.stringify(P))),a.forEach(e=>{e.querySelectorAll(".item__root").forEach(t=>{var a;"Not in stock"===(null===(a=JSON.parse(t.dataset.cmpDataLayer))||void 0===a?void 0:a.item_stock_status)&&e.classList.add("hidden")})});var u=l.getAttribute("data-bundle-discount-type"),d=parseFloat(l.getAttribute("data-bundle-discount"))||0;const S="true"==l.getAttribute("data-always-show-percentage"),k=(l.getAttribute("data-bundle-total"),l.getAttribute("data-discount-start-date")),A=l.getAttribute("data-discount-end-date"),w=new Date,N=(!k||new Date(k)<=w)&&(!A||new Date(A)>=w),O=l.querySelectorAll(".bundleComponent__selected-card:checked"),M=l.querySelectorAll(".bundleComponent__card .bundleComponent__selected-card"),H=M.length>0&&Array.from(M).every(e=>e.checked),I=l.querySelector(".default-bundleComponent");var f=0;if(I){if(r||Q&&R){const G=JSON.parse(document.querySelector(".productFullDetail__root").dataset.fcDatalayer);var p=r?G.item_format_description:L.replace("<PACKAGING>",Q).replace("<QUANTITY>",R);I.querySelector("[default-bundle-description]").innerHTML=p}const B=I.querySelector(".SkinPrice");if(B){const K=null==B?void 0:B.dataset,W=(null==K?void 0:K.caconfigOmnibus_info_tip_text)||"",Y=(null==K?void 0:K.caconfigOmnibus_original_price_text)||"",X=(null==K?void 0:K.caconfigOmnibus_tooltip_text)||"";let Z="";if(r){const ee={showOmnibusValue:D,priceRange:{formattedFinalPrice
1:_},originalPrice:{formatted:g},omnibusPrice:{formattedOmnibusPrice:x},discountPercent:j,omnibusInfoTipText:W,omnibusInfoOriginalPriceText:Y,omnibusDialogText:X};Z=(0,s.fN)(ee)}else{const te=m(m({},e),{},{showOmnibusValue:e.showOmnibus,discountPercent:e.carliDiscountPercent,omnibusInfoTipText:W,omnibusInfoOriginalPriceText:Y,omnibusDialogText:X});Z=(0,s.fN)(te)}B.innerHTML=Z}I.querySelector(".item__root").setAttribute("data-product-prices",`{"finalPrice":{"value": ${r?parseFloat(b):e.finalPrice.value}}, "originalPrice":{"value": ${r?parseFloat(y):e.originalPrice.value}}}`)}O&&O.length>0&&O.forEach(e=>{const t=e.closest(".bundleComponent__card").querySelector(".item__root");if(t){const e=JSON.parse(t.getAttribute("data-product-prices"));f+=e.finalPrice.value}});const J=l.querySelector(".bundleComponent__footer .SkinPrice"),U=null===(o=document.querySelector('meta[name="country-code"]'))||void 0===o?void 0:o.content.toLowerCase();var v=f,h="";if(H&&d>0){if("percentage"===u){E=f-d/100*f,v=Math.floor(10*E)/10,h=`${d}%`}else"fixed"===u&&(v=f-d,h=`${"fr"!==U?i:""} ${"€"==i||"CHF"==i?d.toFixed(2).replace(".",","):d.toFixed(2)} ${"fr"==U?i:""}`,S&&(h=`${Math.floor(d/f*100)}%`));J.innerHTML=`\n\t\t\t\t\t<span class="regularPrice">${"fr"!==U?i:""} ${"€"==i||"CHF"==i?f.toFixed(2).replace(".",","):f.toFixed(2)} ${"fr"==U?i:""}</span>\n\t\t\t\t\t<span class="discountedPrice">${"fr"!==U?i:""} ${"€"==i||"CHF"==i?v.toFixed(2).replace(".",","):v.toFixed(2)} ${"fr"==U?i:""}</span>\n\t\t\t\t\t<span class="discountValue">- ${S||"€"!=i&&"CHF"!=i?h:h.replace(".",",")}</span>\n\t\t\t\t`}else J.innerHTML=`${"fr"!==U?i:""} ${v.toFixed(2).replace(".",",")} ${"fr"==U?i:""}`;function V(t){const a=t.querySelector(".bundleComponent__footer"),n=Array.from(M).filter(e=>e.checked).length,i=t.querySelector(".bundleComponent__discount-label");if(a){const a=t.querySelector("button");a.querySelector(".cmp-button__text").innerHTML=$.replace("<VALUE>",n),t.querySelector(".bundleComponent__total-label").innerHTML=T.replace("<VALUE>",n),i.innerHTML=d>0?F:"",(r?C&&q:e.inStock&&e.isAvailable)?a.removeAttribute("disabled"):a.setAttribute("disabled","true")}}H&&!N&&(J.innerHTML=`${"fr"!==U?i:""} ${f.toFixed(2).replace(".",",")} ${"fr"==U?i:""}`),a.forEach(e=>{let t=0;const a=e.querySelector(".default-bundleComponent .item__root");a.hasAttribute("data-initial-final-price")||a.setAttribute("data-initial-final-price",JSON.parse(a.getAttribute("data-product-prices")).finalPrice.value);e.querySelectorAll(".bundleComponent__card").forEach(e=>{const n=e.querySelector(".item__root");if(n){const e=JSON.parse(n.getAttribute("data-product-prices")),i=parseFloat(a.getAttribute("data-initial-final-price"));t+=n.parentElement.classList.contains("default-bundleComponent")?i:e.finalPrice.value}}),a.querySelector(".price-container").innerHTML.length>0&&(e.hasAttribute("data-bundle-total")||e.setAttribute("data-bundle-total",t.toFixed(2)))}),V(l),M.forEach(e=>{e.addEventListener("change",e=>{V(l)})})}var E},ue=(0,n.useCallback)(e=>{let t=e||window.location.hash.replaceAll("#","");if(0===Object.keys(z).length)K(`${N} ${O}`),W(`${A} ${w}`),document.querySelector(".bundleComponent")&&se();else{const e=z.find(e=>e.sku===t);if(e){const{isAvailable:t,inStock:a}=e;ae(!t),ie(!a)}const a=null==e?void 0:e.variantAttributes;if(void 0!==a){const{conf_format:e,conf_packaging:t}=a,n=J.find(e=>e.id===i).values.find(t=>t.id===e).label;K(n);const l=J.find(e=>e.id===r).values.find(e=>e.id===t).label;W(l)}else{const e=e=>{const t=document.querySelector(`.tileList__root[data-id="${e}"] .tile__root_selected`);return null==t?void 0:t.dataset.title};K(e("conf_format")),W(e("conf_packaging"))}document.querySelector(".bundleComponent")&&e&&se(e)}},[z,J]),de=(0,n.useMemo)(()=>{var e,t;const a=J.find(e=>e.id===i),l=null==a||null===(e=a.values)||void 0===e||null===(t=e.find(e=>e.label===R))||void 0===t?void 0:t.uid,o=Array.isArray(z)?z.filter(e=>{const{variantAttributesUid:t}=e;return t[i]===l}).map(e=>e.variantAttributesUid[r]):[];if(Array.isArray(J)&&J.length>1){const e=J.find(e=>e.id===r);if(e&&Array.isArray(e.values))return e.values.filter(e=>o.includes(e.uid)).map(({label:e,id:t},a)=>n.createElement("li",{key:`${a}_${e}`,id:t,"data-value":a,className:`clickable__root tile__root tile__root--${e} select-dropdown__list-item_formato`,onClick:()=>(e=>{W(e),G(!1)})(e)},e))}return null},[R,J,z]),me=(0,n.useMemo)(()=>n.createElement("div",{className:"section3 "+(te||ne?"unavailable":"")},n.createElement("div",{className:"price range"},n.createElement("div",{className:"container-prezzi-pdp"},!te&&n.createElement("div",{className:"center-pdp-price price-container"},Y&&n.createElement("span",{className:"regularPrice"},Y||g),n.createElement("span",{className:"discountedPrice"},Z||_)),n.createElement("div",{className:"price-perlitro-wrapper"},n.createElement("p",{className:"prezzo-per-litro"}," ",h)))),n.createElement("div",{className:"addtocartbutton"},"false"==k&&n.createElement("button",{disabled:te||ne,className:"btn-acquista-pdp-sticky","data-cmp-is":"add-to-cart-sticky-menu",onClick:()=>{document.querySelector("[data-cmp-is=add-to-cart]").click()}},te||ne?P:E),"true"==k&&n.createElement("button",{"data-cmp-is":"notify-me",className:"btn-acquista-pdp-sticky",onClick:()=>document.querySelector("[data-cmp-is=notify-me]").click()},S))),[Z,_,te,k]);return n.createElement("div",{className:"containeraddtocartpdp"},n.createElement("div",{className:"variant-container"},n.createElement("div",{className:"section1"},n.createElement("div",{className:"blockimageselec"},le?n.createElement("div",{className:"product-item-name item-is-confezione-mista"},n.createElement("span",null,l)):n.createElement(n.Fragment,null,n.createElement("div",{className:"imageprodctrounded"},n.createElement("img",{src:a,alt:l,className:"lozad"})),n.createElement("div",{className:"option__root selectformato"},n.createElement("div",{className:"tileList__root select-dropdown","data-id":"conf-format"},n.createElement("button",{role:"button","data-value":"",className:"select-dropdown__button_confezione",onClick:()=>{V(!U),G(!1)}},n.createElement("span",null,`${R||p} `),J.length>1&&J.find(e=>e.id===i).values.length>1&&n.createElement("span",{className:"chevron bottom"}," ")),n.createElement("ul",{className:`select-dropdown__list_confezione ${U&&"active"}`},J.length>1&&J.find(e=>e.id===i).values.map(({label:e,id:t},a)=>n.createElement("li",{key:`${a}_${e}`,id:t,"data-value":a,className:`clickable__root tile__root tile__root--${e}  select-dropdown__list-item_confezione`,onClick:()=>(e=>{var t,a,n,l;K(e),V(!1);const o=J.find(e=>e.id===i),c=(null==o||null===(t=o.values)||void 0===t||null===(a=t.find(t=>t.label===e))||void 0===a?void 0:a.uid)||"",s=Array.isArray(z)?z.filter(({variantAttributesUid:e})=>e[i]===c):[],u=s.length>0?s[0]:null,d=null==u?void 0:u.variantAttributesUid[r],m=J.find(e=>e.id===r),f=null==m||null===(n=m.values)||void 0===n||null===(l=n.find(e=>e.uid===d))||void 0===l?void 0:l.label;W(f||"")})(e)},e)))))))),n.createElement("div",{className:"section2 "+(te||ne?"unavailable":"")},n.createElement("div",{className:"option__root select selectconfezione"},n.createElement("div",{className:"tileList__root select-dropdown_formato"},n.createElement("button",{role:"button","data-value":"",className:"select-dropdown__button_formato",onClick:()=>{G(!B),V(!1)}},n.createElement("span",null,`${Q||v} `),J.length>1&&J.find(e=>e.id===r).values.length>1&&n.createElement("span",{className:"chevron bottom"}," ")),n.createElement("ul",{className:`select-dropdown__list_formato ${B&&"active"}`},de))))),me)}}}]);

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.