(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5631],{58398:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var a=r(85893),s=r(67294),o=r(80546),i=r.n(o);function c(e){let{isSelected:t,onSelectionChange:r}=e,[o,c]=(0,s.useState)(t);return(0,s.useEffect)(()=>{c(t)},[t]),(0,a.jsx)("span",{className:o?i().selectedButton:i().unselectedButton,onClick:()=>r&&r(!t),"data-component":"SelectButton"})}},52268:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var a=r(85893),s=r(67294),o=r(83609),i=r.n(o);function c(e){let{label:t,slug:r,val:o,requiredField:c,characterLimit:n,requiredErrorMessage:l,invalidErrorMessage:d,helperText:u,onChange:m,updated:_,disabled:h}=e,[p,v]=(0,s.useState)(""),[f,x]=(0,s.useState)(""),[g,P]=(0,s.useState)(!1);(0,s.useEffect)(()=>{o!==p&&C(o||"")},[o]);let C=(0,s.useCallback)((e,t)=>{n&&t&&(t.target.value=e.substr(0,n));let a=c?e?"":l:"";!a&&n&&e.length>n&&(e=e.substr(0,n),a=d),v(e),x(a),m&&m(r,e,a)},[n,c,l,d,m]),j=(0,s.useCallback)(()=>{!p&&c&&f!==l&&x(l),!0!==g&&P(!0)},[g,c,l,f]);return(0,s.useEffect)(()=>{_&&!g&&j(p)},[_,g,j]),(0,a.jsxs)("div",{className:"formFieldContainer ".concat(i().formFieldContainer),"data-component":"FormTextArea",children:[(0,a.jsxs)("label",{className:"".concat(p?i().formLabelActive:""," ").concat(f?i().formLabelInvalid:""),children:[(0,a.jsx)("span",{className:i().formLabel,children:t}),(0,a.jsx)("textarea",{disabled:h,className:h?i().formTextFieldSaved:i().formTextField,onChange:e=>C(e.target.value,e),onBlur:j,name:r,value:p||""})]}),n&&(0,a.jsxs)("span",{className:i().textFieldCharacterLength,children:[p.length,"/",n]}),f&&g&&(0,a.jsx)("div",{className:i().formFieldError,children:f}),u&&(0,a.jsx)("div",{className:i().formHelperText,children:u})]})}},89081:function(e,t,r){"use strict";r.d(t,{Z:function(){return x}});var a=r(85893),s=r(67294),o=r(25675),i=r.n(o),c=r(41664),n=r.n(c),l=r(86996),d=r(18374),u=r(85680),m=r(33412),_=r(58398),h=r(16503),p=r(84923),v=r.n(p),f=r(60992);function x(e){var t,r,o,c;let{product:p,showItemDetail:x,onItemSelect:g,isSelectable:P,isResults:C,isInPageGrid:j}=e,[I,N]=(0,s.useState)(null==p?void 0:p.selected),F=(0,h.Z)();return j&&(p=e,x=!1,P=!1,C=!0),(0,s.useEffect)(()=>{N(null==p?void 0:p.selected)},[p]),(0,a.jsxs)("section",{className:C?"".concat(v().singleProductItem," ").concat(v().singleProductItemResult):v().singleProductItem,"data-component":"ProductGridItem",children:[p.flag&&"None"!==p.flag&&(0,a.jsx)("div",{className:v().newProduct,children:p.flag.toUpperCase()}),(0,a.jsxs)("div",{className:"".concat(v().productImage," ").concat("phenix"===F&&(null===(t=p.pimcoreData)||void 0===t?void 0:t.category)==="Carpet"&&v().productImagePhenix),children:[(0,a.jsxs)(n(),{href:(0,u.sF)(p),children:[(0,a.jsx)("div",{className:v().productImageSwatch,children:(0,a.jsx)("div",{className:"next-img-wrapper",children:(0,a.jsx)(i(),{src:(0,d.UN)(null===(r=p.pimcoreData)||void 0===r?void 0:r.image).image,width:"262",height:"262",placeholder:"blur",blurDataURL:(0,m.Z)(262,262),alt:p.name,style:{maxWidth:"100%",height:"auto"}})})}),(0,a.jsx)("div",{className:v().productImageRoomscene,children:(0,a.jsx)("div",{className:"next-img-wrapper",children:(0,a.jsx)(i(),{src:(0,d.ID)(null===(o=p.pimcoreData)||void 0===o?void 0:o.image).image,width:"262",height:"262",placeholder:"blur",blurDataURL:(0,m.Z)(262,262),alt:p.name,style:{width:"100%",maxWidth:"100%",height:"100%"}})})})]}),(0,a.jsxs)("div",{className:v().gridFavoriteButton,onClick:e=>e.stopPropagation(),children:[!P&&(0,a.jsx)(l.Z,{product:p}),P&&(0,a.jsx)(_.Z,{isSelected:I,onSelectionChange:()=>{if(!P)return null;N(!I),g&&g(!I)}})]})]}),!C&&(0,a.jsxs)("div",{className:v().links,children:[(0,a.jsx)(f.Z,{product:p,halfLinks:!0}),(0,a.jsx)(n(),{href:(0,u.sF)(p),children:"View Details"})]}),(0,a.jsxs)("div",{children:[C&&(0,a.jsx)("p",{className:v().floorBrand,children:p.pimcoreData.collection}),(0,a.jsx)("h1",{className:v().pattern,children:(0,a.jsx)(n(),{href:(0,u.sF)(p),children:p.pattern})}),x&&(0,a.jsxs)("div",{className:v().color,children:["Type: ",null===(c=p.productCategory)||void 0===c?void 0:c.title]}),(0,a.jsxs)("div",{className:v().color,children:["Color: ",p.color]}),C&&(0,a.jsx)(f.Z,{product:p,isButton:!0}),x&&!C&&(0,a.jsxs)("div",{className:v().color,children:["Product Number: ",p.sku]})]})]})}},34469:function(e,t,r){"use strict";r.d(t,{Z:function(){return p}});var a=r(85893),s=r(67294),o=r(84670),i=r(8359),c=r(52268),n=r(2668),l=r(73665),d=r(47499),u=r(31526),m=r.n(u),_=r(49638);let h={};function p(e){let{onSubmit:t}=e,r=(0,s.useContext)(o.Z),[u,p]=(0,s.useState)(!1),[v,f]=(0,s.useState)({}),[x,g]=(0,s.useState)({name:!0}),[P,C]=(0,s.useState)(!1),[j,I]=(0,s.useState)(!1),[N,F]=(0,s.useState)(),[L,b]=(0,s.useState)();(0,s.useEffect)(()=>{let e=r.userLists&&r.userLists.favorites?r.userLists.favorites.map(e=>e.product).filter(e=>e):null;e.forEach(e=>{e.selected=!1,e.favoriteId=r.userLists.favorites.filter(t=>t.Sku==e.sku).pop().Id}),F(e)},[r.userLists]);let B=(0,s.useCallback)((e,t,r)=>{let a={...v};a[e]=t,f(a);let s=P?{...x}:h;s[e]=r,g(s),P||C(!0)},[v,x]),S=(0,s.useCallback)(async()=>{let e=P?{...x}:h;if(e.noProductsSelected=L?"":"Please select one or more products to create a list.",g(e),!(0,d.tV)(e)){I(!0);return}p(!0);let a=[...L].map(e=>e.favoriteId),s="/api/user/favorite?a=add-list&userId=".concat(r.user.Id,"&listName=").concat(v.name,"&notes=").concat(v.notes,"&favoriteIds=").concat(a.join(",")),o=await fetch(s).catch(e=>console.error("Error adding list",e));o.status;let i=await o.json();i&&r.updateUserLists(i),p(!1),t&&t()},[v,L]);return N?(0,a.jsxs)("section",{className:m().CreateProductSection,"data-component":"CreateProductList",children:[u&&(0,a.jsx)(_.Z,{spinner:"Spinner-Blush"}),(0,a.jsxs)("form",{className:m().CreateProductForm,onSubmit:e=>e.preventDefault(),children:[(0,a.jsxs)("div",{className:m().InstructionWrapper,children:[(0,a.jsx)("h1",{className:m().featureHeading,children:"Create New List"}),(0,a.jsx)("p",{children:"Select your favorite floors and add them to your new list."}),(0,a.jsx)("button",{className:"".concat(m().CreateListBtn," show-for-tablet-l ").concat((0,d.tV)(x)?"":" disabled"),onClick:S,children:"Create"})]}),(0,a.jsxs)("div",{className:m().FormInputs,children:[(0,a.jsx)(i.Z,{slug:"name",type:"text",label:"Name Your List",onChange:B,requiredField:!0,requiredErrorMessage:"Please give your list a name"}),(0,a.jsx)(c.Z,{label:"Notes",slug:"notes",onChange:B}),(0,a.jsx)(l.Z,{errors:x?Object.values(x):null,hide:!j}),(0,a.jsx)("button",{className:"".concat(m().CreateListBtn," hide-for-tablet-l ").concat((0,d.tV)(x)?"":" disabled"),onClick:S,children:"Create"}),"                "]})]}),(0,a.jsxs)("div",{className:m().FavoriteProductList,children:[(0,a.jsxs)("div",{className:m().FavoriteProductListTop,children:[(0,a.jsx)("h5",{children:"My favorites"}),(0,a.jsx)("div",{className:m().line}),(0,a.jsxs)("p",{className:m().count,children:["Showing ",N.length," favorites"]})]}),(0,a.jsx)(n.Z,{products:N,options:{hideFilters:!0,isFavoriteList:!0,showItemDetail:!0,isResults:!1,isEditableView:!0,onSelectedProductChange:e=>b(e)}})]})]}):(0,a.jsx)("section",{className:m().CreateProductSection,"data-component":"CreateProductList",children:(0,a.jsx)("p",{children:"Add some products to your favorites, and then you can make lists."})})}},80546:function(e){e.exports={selectedButton:"SelectButton_selectedButton__CTRop",unselectedButton:"SelectButton_unselectedButton___Z_OW"}},84923:function(e){e.exports={singleProductItem:"ProductGridItem_singleProductItem__52BGD",pattern:"ProductGridItem_pattern__l0s1X",color:"ProductGridItem_color__EU8xx",links:"ProductGridItem_links__C6Krp",floorBrand:"ProductGridItem_floorBrand__UTzB_",gridFavoriteButton:"ProductGridItem_gridFavoriteButton__e0Jsh",newProduct:"ProductGridItem_newProduct__Xx8sc",bestsellerProduct:"ProductGridItem_bestsellerProduct__NJFie",ImageTag:"ProductGridItem_ImageTag__qQEwi",productImage:"ProductGridItem_productImage__AQTBr",productImageSwatch:"ProductGridItem_productImageSwatch__X0SOC",productImageRoomscene:"ProductGridItem_productImageRoomscene__8phHo",productImagePhenix:"ProductGridItem_productImagePhenix__UjZ90",singleProductItemResult:"ProductGridItem_singleProductItemResult__eK5Oo"}},31526:function(e){e.exports={CreateProductSection:"CreateProductList_CreateProductSection__nvtRe",CreateProductForm:"CreateProductList_CreateProductForm__lbf0r",InstructionWrapper:"CreateProductList_InstructionWrapper__XZHA6",featureHeading:"CreateProductList_featureHeading__cxefC",FormInputs:"CreateProductList_FormInputs__3DYiU",CreateListBtn:"CreateProductList_CreateListBtn__6lhD3",FavoriteProductList:"CreateProductList_FavoriteProductList__l8lx6",FavoriteProductListTop:"CreateProductList_FavoriteProductListTop__XpB6A",line:"CreateProductList_line__OcJEF",count:"CreateProductList_count__2ftBk"}},51485:function(e){e.exports={FavoriteContainer:"Favorite_FavoriteContainer__L_9y_",CreateFavoriteList:"Favorite_CreateFavoriteList__o_htl",HeartIndication:"Favorite_HeartIndication__ydfhg",FavoriteInfo:"Favorite_FavoriteInfo__Iyaoc",favoriteContent:"Favorite_favoriteContent__QbCkj",favoriteNotes:"Favorite_favoriteNotes__gaH4Q",OrangeBar:"Favorite_OrangeBar__Z2ytE",FavoriteProductList:"Favorite_FavoriteProductList__5gT0a",editNoteBtnContainer:"Favorite_editNoteBtnContainer__4j0ou",editNoteBtn:"Favorite_editNoteBtn__pnOOu"}}}]);