1"use strict";(self.webpackChunkpuratos_react=self.webpackChunkpuratos_react||[]).push([[118,182,485,747],{14196(e,t,a){a.r(t),a.d(t,{default:()=>Ce});var s=a(96540),r=a(19115),n=a(62371),o=a(70006),c=a(45711),i=a(5556),l=a.n(i),d=a(90249),p=a(746),h=a(15588),m=a(24518),u=a(58089),g=a(54950),x=a(30275),j=a(74848);class C extends s.Component{constructor(e){super(e)}render(){const{i18n:e,title:t,clearCart:a,quickAddItems:r,onInputChange:n,addToCart:o}=this.props;return(0,j.jsx)(s.Fragment,{children:(0,j.jsxs)("div",{className:"cart__content--header-mobile hide-desktop",children:[(0,j.jsxs)("div",{className:"row",children:[(0,j.jsx)("div",{className:"cart__content--header-mobile-title col-xs-"+(a?"6":"12"),children:(0,j.jsx)("h2",{className:"p-margin-none",children:t})}),a&&(0,j.jsx)("div",{className:"cart__content--header-empty-cart col-xs-6",children:(0,j.jsx)("div",{className:"cart__content--header-mobile-empty-card",children:(0,j.jsxs)("a",{href:"#",className:"p-align-self-end text-right",onClick:a,children:[(0,j.jsx)("span",{className:"svg-trash-can"}),(0,g.T)(e,"Clear cart")]})})})]}),r&&(0,j.jsx)("div",{className:"cart__content--header-mobile-quick-add",children:(0,j.jsx)(x.A,{handleInputChange:n,handleSubmit:o,i18n:e,autocompleteItems:r,placeholder:(0,g.T)(e,"Add to cart")})})]})})}}const _=C;var k=a(35013),N=a(51044),v=a(32809),I=a(67597);class y extends s.Component{render(){const{i18n:e,aemResource:t,children:a,loading:r,cartData:n,onInputChange:o,quickAddItems:c,clearCart:i,inOverview:l,addToCart:p,allowedRoles:h,notAllowedRoles:g,eCommerceRequired:x,excelImportEnabled:C,count:y}=this.props;return(0,j.jsx)(s.Fragment,{children:(0,j.jsxs)(m.E,{loading:r,messages:t,data:["don't remove"],allowedRoles:h,notAllowedRoles:g,eCommerceRequired:x,children:[n&&(0,j.jsx)(_,{i18n:e,title:t.cartTitle,clearCart:i,quickAddItems:c,onInputChange:o,addToCart:p}),(0,j.jsx)(k.I,{cartData:n,view:"mobile"}),(0,j.jsx)(s.Fragment,{children:(0,j.jsx)("div",{className:"row",children:(0,j.jsx)("div",{className:"col-xs-12 checkout-card__wrapper",children:(0,j.jsx)(u.A,{className:"cart__content--overview-products",children:(0,j.jsx)(N.N8,{type:I.v.quickAddProduct,children:(0,j.jsx)(d.x,{i18n:e,loading:r,skeletonType:v.N.CART,cart:n,isCart:!0,listModel:t,onInputChange:o,addToCart:p,quickAddItems:c,clearCart:i,count:y,excelEnabled:C,inOverview:l,children:a})})})})})})]})})}}y.propTypes={handleSearchInput:l().func,loading:l().bool},y.defaultProps={loading:!0,allowedRoles:[p.ai.puratosCustomerValidated,p.ai.puratosCustomerNoAuth],notAllowedRoles:[p.ai.puratosNoCustomer,p.ai.puratosCustomerUnvalidated]};const f=(0,h.A)(e=>({i18n:e.myPuratos_i18n.i18n,excelImportEnabled:0!==Object.keys(e.myPuratos_excelImport.aemResource).length,cartInputDisabled:e.myPuratos_cart.disabled}),{setActive:c.K2,updateItem:c.fk,deleteItem:c.LD})(y);var b=a(74331),A=a(8525),M=a(95796),R=a(2219),w=a(37961),D=a(56347),P=a(22178),T=a(29413),L=a(44599),S=a(81449),E=a(54585),O=a(70223),q=a(20410),G=a(9402),Q=a(67849),W=a(43099);const B={margin:"auto"},F=({children:e})=>{const t=(0,Q.GO)(),a=(0,r.useSelector)(P.zv),n=(0,r.useSelector)(E.Uj),o=JSON.parse(localStorage.getItem("basketChanges"))||[];(0,s.useEffect)(()=>{(0,W.y)()},[]);return(0,j.jsx)("div",{children:(0,j.jsx)(T.x,{loading:!(0,b.qi)(a),style:B,children:(0,j.jsxs)("div",{className:"cart p-padding-top-md p-bg-grey1",children:[(0,j.jsxs)("div",{className:"container cart__messages",children:[(0,j.jsx)(L.A,{}),n&&(0,j.jsx)("div",{className:"row p-margin-none",children:(0,j.jsx)(S.j,{},"order-before")}),o?.length>0&&(0,j.jsxs)(q.A,{type:G.g.info,onClose:()=>{localStorage.removeItem("basketChanges")}
1,children:[(0,j.jsx)("div",{dangerouslySetInnerHTML:{__html:t("The cart was updated, please review your cart content:")}}),(0,j.jsx)("ul",{children:o.map(e=>(0,j.jsxs)("li",{children:[e.materialNumber+" - "+e.productName,e.productLink?(0,j.jsxs)(j.Fragment,{children:[" ","-"," ",(0,j.jsx)("a",{href:e.productLink,target:"_blank",rel:"noreferrer",children:e.productLink})]}):""]},`material-${e.materialNumber}`))})]},O.oA.cart.cartChanges)]}),e]})})})};var $=a(13935);const U=({cartAlerts:e})=>{const[t,a]=(0,s.useState)(!0),[r,n]=(0,s.useState)("read more"),[o,c]=(0,s.useState)(!1),i=(0,s.useRef)(null),l=(0,Q.GO)();return(0,s.useEffect)(()=>{n(t?"read more":"read less")},[t]),(0,s.useEffect)(()=>{c(i.current.offsetHeight<i.current.scrollHeight||i.current.offsetWidth<i.current.scrollWidth)},[o]),(0,j.jsxs)("div",{className:"checkout-card__group--item p-margin-none",children:[(0,j.jsx)("p",{className:"cart__content--info-title",children:e.alertTitle}),(0,j.jsxs)(s.Fragment,{children:[(0,j.jsx)("p",{className:`cart__content--info-text ${t&&"text-ellipsis"}`,ref:i,children:e.alertMessage}),o&&(0,j.jsx)("a",{className:"cart__content--info-collapse",onClick:()=>a(!t),children:l(r)||r})]})]})};function V({i18n:e,cartData:t,listModel:a}){return(0,j.jsx)("div",{className:"cart__content--info",children:(0,j.jsxs)("div",{className:"checkout-card__group",children:[(0,j.jsx)("div",{className:"checkout-card__group--item p-margin-none",children:a.subtotalMessage&&(0,j.jsx)("p",{dangerouslySetInnerHTML:{__html:a.subtotalMessage}})}),a.cartAlerts&&a.cartAlerts.map((e,t)=>(0,j.jsx)(U,{cartAlerts:e},t)),(t.palletisation||t.grossWeight||t.netWeight)&&(0,j.jsx)("div",{className:"checkout-card__group--item",children:(0,j.jsxs)("div",{className:"shipping-info",children:[(0,j.jsx)("p",{className:"cart__content--info-title",children:(0,g.T)(e,"Shipping information")}),(0,j.jsx)("table",{className:"table cart__content--info-table",children:(0,j.jsxs)("tbody",{children:[t.palletisation?(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:(0,g.T)(e,"Palletisation")}),(0,j.jsx)("td",{children:t.palletisation})]}):null,t.grossWeight?(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:(0,g.T)(e,"Gross weight")}),(0,j.jsxs)("td",{children:[t.grossWeight," ",(0,g.T)(e,t.weightUnit)]})]}):null,t.netWeight?(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:(0,g.T)(e,"Net weight")}),(0,j.jsxs)("td",{children:[t.netWeight," ",(0,g.T)(e,t.weightUnit)]})]}):null]})})]})})]})})}V.propTypes={},V.defaultProps={};const H=V;var J=a(3440),z=a(93390),K=a(83310),X=a(48313),Y=a(6664),Z=a(79393),ee=a(98069),te=a(10639),ae=a(58830),se=a(99753),re=a(45037),ne=a(62274),oe=a(89029),ce=a(13956);const ie="clear-cart-modal";ne.P.modals[ie]=function({payload:e}){const t=(0,r.useDispatch)(),a=(0,Q.GO)(),n=s.useCallback(()=>t((0,re.Oo)()),[t,re.Oo]);return(0,j.jsx)(oe.a,{size:oe.a.sizes.MD,title:a("Empty shopping cart"),closeModal:n,children:(0,j.jsxs)(oe.a.Body,{className:"well p-modal__well",children:[(0,j.jsx)("p",{className:"p-sans-nr",children:a("Are you sure you want to empty your shopping cart?")}),(0,j.jsx)("hr",{}),(0,j.jsxs)("div",{className:"p-clear-cart-buttons",children:[(0,j.jsx)(ce.$,{color:ce.$.colors.SECONDARY_INVERTED,onClick:()=>{e.clearCart&&e.mapping&&(e.clearCart({...e.mapping,closeModal:!0}),t((0,A.Wf)("")))},className:"p-padding-left-lg p-padding-right-lg text-uppercase",children:a("yes")}),(0,j.jsx)(ce.$,{color:ce.$.colors.SECONDARY,onClick:n,className:"p-padding-left-lg p-padding-right-lg text-uppercase",children:a("no")})]})]})})};var le=a(95786),de=a(60040),pe=a(5864),he=a(7790),me=a(51701),ue=a(31977),ge=a(99792);class xe extends s.Component{state={loaded:!1,cartLoading:!1};productQuantities={};constructor(e){super(e),this.computeQuantities(e)}componentDidMount(){const{mapping:e}=this.props;this.props.fetchCartModel(e),this.props.fetchCart(e),this.props.fetchExcelImportModel(e),this.props.getCartRecommendationModel({mapping:e,pageRoute:b.Og.cart})}componentDidUpdate(e){const{mapping:t}=this.props;e.mapping!==t?(this.props.fetchCartModel(t),this.props.fetchCart(t),this.props.getCartRecommendationModel({mapping:t,pageRoute:b.Og.cart})):e.cartData!==this.props.cartData&&JSON.stringify(e.cartData)!==JSON.stringify(this.props.cartData)&&(this.state.loaded||this.setState({loaded:!0}),this.computeQuantities(this.props)),e.cartData?.basketItems?.length===this.props.cartData?.basketItems?.length&&e.cartData?.basketBundles?.length===this.props.cartData?.basketBundles?.length||this.props.getCartRecommendationModel({mapping:t,pageRoute:b.Og.cart})}computeQuantities=e=>{this.productQuantities={}
1,e.cartData?.basketItems?.forEach(e=>{const{materialNumber:t,quantity:a,isFreeGood:s}=e;s||(this.productQuantities[t]||(this.productQuantities[t]=0),this.productQuantities[t]+=a)})};setCartLoading=e=>{this.setState({cartLoading:e})};clearCart=e=>{this.props.openModal(ie,{clearCart:this.props.clearCart,mapping:e})};onClickProduct=(e,t)=>{(0,le.V)(e,I.v.cart,!1,this.props.userId,this.props.currency,t),me.v.selectItem({user_id:this.props.userId,page_language:(0,E.wq)(),email_address:(0,ge.M3)()?this.props.userEmail:"",login_status:this.props.userId?pe.y.LOGGED_IN:pe.y.GUEST,website_section:he.k.cart,items:(0,ue.L_)(e,this.props.currency,I.v.cart)})};render(){const{cartModel:e,checkoutModel:t,i18n:a,loading:s,addItemsToCart:r,cartData:n,onInputChange:c,quickAddItems:i,mapping:l,cartRecommendationsModel:d,cartRecommendationsLoading:h}=this.props;return(0,j.jsx)(F,{children:(0,j.jsx)("div",{className:"container cart__content",children:(0,j.jsx)("div",{className:"row",children:(0,j.jsxs)(M.h,{alerts:{addToCart:"cart.add",addToCartError:"cart.error",addToCartQuantity:"cart.quantity"},children:[(0,j.jsx)(w.d,{roles:[p.ai.puratosCustomerNoAuth,p.ai.puratosNoCustomer,p.ai.puratosCustomerUnvalidated],children:(0,j.jsx)(D.rd,{to:`/${(0,b.aM)(l,b.Og.myPuratos)}`})}),(0,j.jsxs)("div",{className:"col-md-9 col-sm-12 cart__content--cart",children:[(0,j.jsx)("div",{className:"row",children:(0,j.jsx)("div",{className:"col-xs-12",children:(0,j.jsx)(J.A,{marginTopSm:!0})})}),(0,j.jsx)(f,{aemResource:e,loading:s,cartData:n,onInputChange:c,quickAddItems:i,addToCart:r,count:n?.basketItems?.length+n?.basketBundles?.length||0,eCommerceRequired:!0,clearCart:()=>this.clearCart(this.props.mapping),children:(0,j.jsxs)(z.XI,{children:[(0,j.jsx)(X.K,{i18n:a}),(0,j.jsx)(z.XI.Body,{children:(0,j.jsxs)(N.N8,{type:I.v.cart,children:[n?.basketItems.map((e,t)=>(0,j.jsx)(o.A,{product:e,i18n:a,position:t+1,titlesClickable:!0,inOverview:!1,setCartLoading:this.setCartLoading,onClickProduct:this.onClickProduct},e.basketLineId)),n?.basketBundles.map((e,t)=>(0,j.jsx)(K.V,{data:e,i18n:a,position:t+1,titlesClickable:!0,inOverview:!1,setCartLoading:this.setCartLoading,onClickProduct:this.onClickProduct},e.bundleId))]})})]})}),(0,j.jsx)(z.hM,{children:(0,j.jsx)(u.A,{children:n&&(0,j.jsx)(H,{i18n:a,cartData:n,listModel:e})})}),(0,j.jsx)(se.C,{show:h||d?.products.length>0,children:(0,j.jsx)(ae.CartRecommendations,{resource:d,loading:h})})]}),(0,j.jsxs)("div",{className:"col-md-3 col-sm-12 sticky-top-md",children:[(0,j.jsx)(k.I,{cartData:n,view:"desktop"}),n?.basketItems?.length+n?.basketBundles?.length>0?(0,j.jsx)(u.A,{className:"sticky-bottom-sm",children:n&&(0,j.jsx)($.A,{i18n:a,cartData:n,listModel:e,showVAT:!0,cartLoading:this.state.cartLoading,shippingModel:t.shippingModel})}):null,(0,j.jsx)(z.jD,{children:(0,j.jsx)(u.A,{children:n&&(0,j.jsx)(H,{i18n:a,cartData:n,listModel:e})})})]})]})})})})}}const je={fetchCartModel:c.aT,fetchCart:c.Fy,fetchInterestingProducts:n.JL,getCartRecommendationModel:te.SI,updateItem:c.fk,deleteItem:c.LD,onInputChange:c.Vf,clearCart:c.sX,addItemsToCart:c.NR,fetchExcelImportModel:R.sf,setCheckoutStep:A.F8,openModal:re.qf},Ce=(0,r.connect)(e=>({cartModel:e.myPuratos_cart.aemResource,checkoutModel:e.myPuratos_checkout.aemResource,cartData:e.myPuratos_cart.data,interestingProductsModel:e.myPuratos_interestingProducts.aemResource,interestingProducts:e.myPuratos_interestingProducts.interProducts,i18n:e.myPuratos_i18n.i18n,loading:(0,Y.RK)(e)||(0,Z.DG)(e,ee.m7)||!(0,Y.qZ)(e),interestingLoading:e.myPuratos_interestingProducts.loading,mapping:e.myPuratos_dashboard.mapping,quickAddItems:e.myPuratos_cart.quickAddItems,homepage:e.myPuratos_aem.homepage,cartInputDisabled:e.myPuratos_cart.disabled,cartRecommendationsModel:e.myPuratos_cartRecommendations.aemResource,cartRecommendationsLoading:e.myPuratos_cartRecommendations.loading,userId:(0,de.B$)(e),currency:(0,Y.D9)(e),userEmail:(0,de.u6)(e)}),je)(xe)}}]); 2//# sourceMappingURL=myPuratos-cart.886c132d.chunk.js.map
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.