(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8167],{81785:function(e,t,s){"use strict";var i=s(57437);s(2265);var r=s(30938);t.Z=e=>{let{fill:t,large:s}=e;return t=t||"var(--primary-contrast-text)",(0,i.jsx)(r.Z,{viewBox:"0 0 8 8",style:{width:s?"16px":"12px",height:s?"16px":"12px"},children:(0,i.jsxs)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M7.5 0.5L0.5 7.5",stroke:t,strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M0.5 0.5L7.5 7.5",stroke:t,strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})]})})}},3569:function(e,t,s){"use strict";var i=s(57437);s(2265);var r=s(30938);t.Z=e=>{let{viewBox:t="0 0 46 46",size:s="46px",fill:a="black"}=e;return(0,i.jsx)(r.Z,{viewBox:t,style:{width:s,height:s},children:(0,i.jsxs)("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M23.4999 0C17.9376 0 13.4285 4.5091 13.4285 10.0714C13.4285 15.6336 17.9376 20.1427 23.4999 20.1427C29.0621 20.1427 33.5712 15.6336 33.5712 10.0714C33.5712 4.5091 29.0621 0 23.4999 0ZM16.7856 10.0714C16.7856 6.36319 19.7918 3.35712 23.4999 3.35712C27.208 3.35712 30.2141 6.36319 30.2141 10.0714C30.2141 13.7795 27.208 16.7856 23.4999 16.7856C19.7918 16.7856 16.7856 13.7795 16.7856 10.0714Z",fill:a}),(0,i.jsx)("path",{d:"M3.34772 45.4999C4.47543 34.9708 13.1081 26.857 23.5 26.857C33.8918 26.857 42.5245 34.9708 43.6523 45.4999C43.751 46.4216 44.5782 47.0889 45.5001 46.9902C46.4218 46.8915 47.089 46.0641 46.9903 45.1424C45.6909 33.0113 35.71 23.4999 23.5 23.4999C11.2899 23.4999 1.30898 33.0113 0.00968681 45.1424C-0.0890462 46.0641 0.578165 46.8915 1.49995 46.9902C2.42171 47.0889 3.24899 46.4216 3.34772 45.4999Z",fill:a})]})})}},28167:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return _}});var i=s(57437),r=s(46387),a=s(3254),n=s(2265),l=s(32603),c=s(90381),o=s(74416),d=s(55095);s(40853);var u=s(61386),v=s(39919),m=s(83464),w=s(27648),x=s(77382),p=s(3569);s(12766);var h=s(49245),j=s(82480),g=s(5520);s(78802);var f=e=>{let{name:t,rating:s,time:a,title:n,description:l,index:c,orgStore:u}=e,v=(0,o.wH)(u);return(0,i.jsxs)(i.Fragment,{children:[(!v||0!==c)&&(0,i.jsx)(g.Z,{}),(0,i.jsxs)("div",{className:"review-card-root",children:[(0,i.jsxs)("div",{className:"review-card-flex-center",style:{marginTop:v&&0===c?0:20,marginBottom:16},children:[(0,i.jsxs)("div",{className:"review-card-flex-center",children:[(0,i.jsx)("div",{className:"review-card-profile-img",children:(0,i.jsx)(p.Z,{size:"10px"})}),(0,i.jsx)("div",{className:"review-card-name",children:(0,o.av)(t)?t:"User"})]}),(0,i.jsx)(r.Z,{className:"review-card-subtext",children:a})]}),(0,i.jsx)(d.Z,{stars:s,size:15,noText:!0}),(0,i.jsx)(r.Z,{className:"review-card-title",children:n}),(0,i.jsx)(r.Z,{className:"review-card-description",children:l})]})]})},y=e=>{let{slug:t,superSku:s,inline:r,productId:a,myReview:l,setMyReview:c,orgStore:d}=e,u=(0,n.useRef)(),[v,p]=(0,n.useState)(!0),[j,g]=(0,n.useState)({content:[],last:!1,empty:!1,currentPage:0}),y=!r&&!j.last,[N,_]=(0,n.useState)(" "),Z=(0,n.useRef)(!1);(0,n.useEffect)(()=>{let e=(0,h.Jt)("access_token");c(null);let i={};e&&(i={Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}),m.Z.get("".concat((0,x.bl)(),"/api/v1/store/").concat(t,"/product/").concat(s,"/reviews?size=").concat(r?4:20,"&page=0"),{headers:i}).then(e=>{var t,s,i,r,a;let n=e.data,l=null!==(r=null===(t=n.all_reviews)||void 0===t?void 0:t.content)&&void 0!==r?r:[];n.my_review&&(c(n.my_review),l=l.filter(e=>e.customer_id!==n.my_review.customer_id||(Z.current=!0,!1))),g({content:l,currentPage:1,last:null===(a=null===(s=n.all_reviews)||void 0===s?void 0:s.last)||void 0===a||a}),p(!1),_(null===(i=n.all_reviews)||void 0===i?void 0:i.totalElements)})},[s]);let k=()=>{p(!0),m.Z.get("".concat((0,x.bl)(),"/api/v1/store/").concat(t,"/product/").concat(s,"/reviews?size=").concat(20,"&page=").concat(j.currentPage)).then(e=>{var t,s,i,r;let a=e.data,n=null!==(i=null===(t=a.all_reviews)||void 0===t?void 0:t.content)&&void 0!==i?i:[];a.my_review&&!Z.current&&(n=n.filter(e=>e.customer_id!==a.my_review.customer_id||(Z.current=!0,!1))),g({content:[...j.content,...n],currentPage:j.currentPage+1,last:null===(r=null===(s=a.all_reviews)||void 0===s?void 0:s.last)||void 0===r||r}),p(!1)})},C=(0,n.useCallback)(e=>{!v&&(u.current&&u.current.disconnect(),u.current=new IntersectionObserver(e=>{let t=e[0];t.isIntersecting&&y&&k((t.target.parentElement?t.target.parentElement.childElementCount:0)/20)}),e&&u.current.observe(e))},[v,y]);return(0,i.jsxs)("div",{children:[l&&(0,i.jsx)(f,{name:(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[l.customer_name," (You)","NEW"===l.status&&(0,i.jsx)("div",{className:"reviews-list-tab",children:"Awaiting"})]}),title:l.title,description:l.description,rating:l.rating,time:(0,o.VG)(new Date(l.updated_at)),index:0,orgStore:d}),j.content.map((e,t)=>j.content.length-15===t?(0,i.jsx)("div",{ref:C,children:(0,i.jsx)(f,{name:e.customer_name,title:e.title,description:e.description,rating:e.rating,time:(0,o.VG)(new Date(e.updated_at)),index:l?t+1:t,orgStore:d})},e.id):(0,i.jsx)("div",{children:(0,i.jsx)(f,{name:e.customer_name,title:e.title,description:e.description,rating:e.rating,time:(0,o.VG)(new Date(e.updated_at)),index:l?t+1:t,orgStore:d})},e.id)),r&&!j.last&&N>0?(0,i.jsxs)(w.default,{color:"secondary",prefetch:!1,href:"/products/".concat(a,"/all-reviews"),className:"reviews-list-viewAll",children:["View all ",(0,o.pF)(N)," reviews"]}):(0,i.jsx)("div",{style:{marginTop:-14}}),y&&(0,i.jsx)("div",{style:{display:"flex",width:"100%",justifyContent:"center"},children:(0,i.jsx)(b,{orgStore:d})})]})};let b=e=>{let{orgStore:t}=e,s=(0,o.wH)(t);return(0,i.jsx)("div",{style:{width:"100%"},children:[0,1,2].map(e=>(0,i.jsx)("div",{children:(0,i.jsxs)("div",{className:"reviews-list-root",children:[(0,i.jsx)("div",{className:"reviews-list-flex-center",style:{marginTop:s&&0===e?0:20,marginBottom:16},children:(0,i.jsxs)("div",{className:"reviews-list-flex-center",children:[(0,i.jsx)("div",{className:"reviews-list-profile-img",children:(0,i.jsx)(p.Z,{size:"10px"})}),(0,i.jsx)(j.Z,{className:"reviews-list-name"})]})}),(0,i.jsx)(d.Z,{stars:0,size:15,noText:!0}),(0,i.jsx)(j.Z,{className:"reviews-list-title"}),(0,i.jsx)(j.Z,{className:"reviews-list-description"}),(0,i.jsx)(j.Z,{className:"reviews-list-description"})]})},e))})};var N=s(4596),_=e=>{var t,s,u;let{orgStore:m,superSku:w,inline:x,productId:p,name:h,image:j,ratingsData:g={}}=e,[f,b]=(0,n.useState)(!1),_=(0,o.wH)(m),[k,C]=(0,n.useState)(null),[S,z]=(0,n.useState)(92),E=(0,l.v9)(e=>e.customer.customer),P=(0,l.I0)(),T=()=>{b(!1),document.body.style.overflowY="auto"};return(0,n.useEffect)(()=>(new URLSearchParams(window.location.search).get("writereview")?(document.body.style.overflowY="hidden",b(!0),z(document.getElementById("app-header").offsetHeight)):document.body.style.overflowY="auto",window.addEventListener("popstate",T),()=>window.removeEventListener("popstate",T)),[window.location.search]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"product-review-root",style:{"--product-review-summary-container-margin-top":x?"5px":"0px","--product-review-summary-container-width":x?"36%":"100%","--product-review-summary-info-display":x?"block":"flex","--product-review-ratings-box-padding-left":x?"0px":"28px","--product-review-ratings-box-border-left":x?"none":"1px solid #ebebeb","--product-review-ratings-box-flex-grow":x?0:1,"--product-review-ratings-box-margin-left":x?"0px":"28px","--product-review-reviews-container-display":x?"flex":"block","--product-review-list-padding-left":x?"38px":"0px","--product-review-app-header-offset":"".concat(S,"px"),...x?{}:{paddingBottom:60}},children:[(_||x)&&(0,i.jsx)(r.Z,{className:"product-review-heading",style:{marginLeft:0,marginBottom:18},children:null===(t=m.label_settings)||void 0===t?void 0:t.review_and_ratings_heading}),(0,i.jsxs)("div",{className:"product-review-reviews-container",children:[(0,i.jsxs)("div",{className:"product-review-summary-container",children:[(0,i.jsxs)("div",{className:"product-review-summary-info",children:[(0,i.jsxs)("div",{style:{marginTop:4},children:[(0,i.jsx)(d.Z,{stars:g.rating,size:"20px"}),g.rated_by?(0,i.jsxs)("div",{className:"product-review-subtext",children:["Based on ",g.rated_by," reviews"]}):(0,i.jsxs)("div",{children:[(0,i.jsx)(r.Z,{className:"product-review-no-review",children:"No Customer Reviews"}),(0,i.jsx)(r.Z,{className:"product-review-no-review-subtext",children:"Share your thoughts with other customers"})]})]}),!!g.rated_by&&(0,i.jsxs)("div",{className:"product-review-ratings-box",children:[(0,i.jsx)(Z,{progress:g.five_raters/g.rated_by,rating:5,num:g.five_raters}),(0,i.jsx)(Z,{progress:g.four_raters/g.rated_by,rating:4,num:g.four_raters}),(0,i.jsx)(Z,{progress:g.three_raters/g.rated_by,rating:3,num:g.three_raters}),(0,i.jsx)(Z,{progress:g.two_raters/g.rated_by,rating:2,num:g.two_raters}),(0,i.jsx)(Z,{progress:g.one_raters/g.rated_by,rating:1,num:g.one_raters})]})]}),(0,i.jsx)(c.Z,{bold:!0,fullWidth:!0,onClick:()=>{if((!m.attributes["plugin-review-rating"].anonymous_review||"false"===m.attributes["plugin-review-rating"].anonymous_review)&&!E.id){P((0,v.eh)());return}let e=window.location.search,t="?writereview=1";""!==e&&(t=e+"&writereview=1");let s=window.location.protocol+"//"+window.location.host+window.location.pathname+t;window.history.pushState(null,null,s),document.body.style.overflowY="hidden",z(document.getElementById("app-header").offsetHeight),b(!0)},style:{marginTop:4,marginBottom:32,position:"static",width:"100%"},className:"product-review-review-btn",children:k&&E.id?null===(s=m.label_settings)||void 0===s?void 0:s.edit_review_cta:null===(u=m.label_settings)||void 0===u?void 0:u.write_review_cta})]}),(0,i.jsx)("div",{className:"product-review-list",children:(0,i.jsx)("div",{children:(0,i.jsx)(y,{superSku:w,slug:m.slug,inline:x,productId:p,myReview:k,setMyReview:C,orgStore:m})})})]})]}),(0,i.jsx)(a.ZP,{anchor:"bottom",open:f,variant:_?"persistent":"temporary",onClose:()=>{window.history.back()},PaperProps:{style:{"--product-review-app-header-offset":"".concat(S,"px")},className:"product-review-write-popup"},children:(0,i.jsx)(N.Z,{name:h,image:j,inline:!0,superSku:w,slug:m.slug,data:E.id?k:null,onEditSuccess:e=>C(e),open:f,orgStore:m})})]})};let Z=e=>{let{rating:t,progress:s,num:r}=e;return(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,i.jsx)("div",{className:"product-review-rating-num",children:t}),(0,i.jsx)(u.Z,{stroke:"#FEBC48",size:"9px"}),(0,i.jsx)("div",{className:"product-review-bar",style:{marginLeft:6},children:(0,i.jsx)("div",{className:"product-review-bar",style:{background:{5:"#4AA54A",4:"#A5D631",3:"#F7E632",2:"#F7A521",1:"#EF3A10"}[t],width:"".concat(100*s,"%")}})}),(0,i.jsx)("div",{className:"product-review-num-of-rating",children:(0,o.pF)(r)})]})}},55095:function(e,t,s){"use strict";var i=s(57437),r=s(61386),a=s(2265);s(13049),t.Z=function(e){var t;let{stars:s,size:n="1.8rem",noText:l,themeColor:c="#febc48"}=e,o=0;return s&&(o=(5*Math.round(10*s/5)/10*20).toString()+"%"),(0,i.jsx)(a.Fragment,{children:(0,i.jsxs)("div",{className:"rating-stars",children:[!l&&!!s&&(0,i.jsx)("span",{className:"star-text",children:null!==(t=null==s?void 0:s.toFixed(1))&&void 0!==t?t:"0.0"}),(0,i.jsxs)("div",{id:"backStar",className:"back-star",children:[(0,i.jsx)(r.Z,{stroke:"#e8e8e8",size:n}),(0,i.jsx)(r.Z,{stroke:"#e8e8e8",size:n}),(0,i.jsx)(r.Z,{stroke:"#e8e8e8",size:n}),(0,i.jsx)(r.Z,{stroke:"#e8e8e8",size:n}),(0,i.jsx)(r.Z,{stroke:"#e8e8e8",size:n}),(0,i.jsxs)("div",{id:"frontStar",className:"front-star",style:{width:o},children:[(0,i.jsx)(r.Z,{stroke:c,size:n}),(0,i.jsx)(r.Z,{stroke:c,size:n}),(0,i.jsx)(r.Z,{stroke:c,size:n}),(0,i.jsx)(r.Z,{stroke:c,size:n}),(0,i.jsx)(r.Z,{stroke:c,size:n})]})]})]})})}},4596:function(e,t,s){"use strict";var i=s(57437),r=s(29),a=s.n(r),n=s(62069),l=s(46387),c=s(77584),o=s(2265),d=s(74416),u=s(42188),v=s(32603),m=s(83464),w=s(69111);s(90915);var x=s(81785),p=s(61386),h=s(77382),j=s(49245);t.Z=e=>{var t,s,r;let{name:g,image:f,inline:y,superSku:b,slug:N,data:_,onEditSuccess:Z,open:k,orgStore:C}=e,[S,z]=(0,o.useState)(0),[E,P]=(0,o.useState)(""),[T,B]=(0,o.useState)(""),[F,A]=(0,o.useState)(""),I=!S||!E.trim(),L=(0,v.v9)(e=>e.customer.customer),[M,R]=(0,o.useState)(!1),[W,Y]=(0,o.useState)(null),H=(0,d.wH)(C);(0,o.useEffect)(()=>{if(_){var e;z(_.rating),P(null!==(e=_.customer_name)&&void 0!==e?e:L.name),B(_.title),A(_.description)}},[k]);let D=()=>{window.history.back(),Y(null),_||(z(0),P(""),B(""),A(""))},G=async()=>{if(M)return;R(!0);let e=(0,j.Jt)("access_token"),t=e?"Bearer ".concat(e):"Basic ".concat(h.YG),s={title:T,description:F,rating:S,customer_name:E},i=_&&L.id?await m.Z.put("".concat((0,h.bl)(),"/api/v1/store/").concat(N,"/product/").concat(b,"/reviews/").concat(_.id),s,{headers:{Authorization:t,"Content-Type":"application/json"}}):await m.Z.post("".concat((0,h.bl)(),"/api/v1/store/").concat(N,"/product/").concat(b,"/reviews"),s,{headers:{Authorization:t,"Content-Type":"application/json"}});Z&&Z(i.data),Y(i.data.status),R(!1)};return(0,o.useEffect)(()=>{L.name&&P(L.name)},[L]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.ZP,{container:!0,style:{postion:"relative",maxWidth:1280,marginLeft:"auto",marginRight:"auto"},children:[!H&&(0,i.jsx)("div",{onClick:D,className:"jsx-ecf8030530de781c write-review-close",children:(0,i.jsx)(x.Z,{large:H})}),W?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.ZP,{item:!0,xs:12,md:6,className:"write-review-left-block",children:y&&H&&(0,i.jsxs)("div",{className:"jsx-ecf8030530de781c write-review-product-info",children:[(0,i.jsx)("img",{src:f,alt:g,className:"jsx-ecf8030530de781c write-review-media"}),(0,i.jsx)("div",{className:"jsx-ecf8030530de781c",children:(0,i.jsx)(l.Z,{className:"write-review-name",children:g})})]})}),(0,i.jsx)(n.ZP,{item:!0,xs:12,md:6,className:"write-review-left-block",style:{display:"flex",alignItems:"center"},children:(0,i.jsxs)("div",{style:{width:"100%",textAlign:"center"},className:"jsx-ecf8030530de781c",children:[(0,i.jsxs)("div",{className:"jsx-ecf8030530de781c write-review-success",children:[(0,i.jsx)(u.Z,{style:{fontSize:44,color:"var(--secondary-main)"}}),(0,i.jsx)(l.Z,{className:"write-review-success-txt",children:"Review Submitted"}),(0,i.jsx)(l.Z,{className:"write-review-success-subtxt",children:"NEW"===W?"The review has been submitted successfully and awaiting verification.":"The review has been submitted successfully."})]}),(0,i.jsx)(w.Z,{fullWidth:!0,style:{maxWidth:500},onClick:D,bold:!0,className:"write-review-submit",children:"Continue"})]})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.ZP,{item:!0,xs:12,md:6,className:"write-review-left-block",children:[!H&&(0,i.jsx)(l.Z,{className:"write-review-heading",children:null===(t=C.label_settings)||void 0===t?void 0:t.write_review_cta}),(y||!H)&&(0,i.jsxs)("div",{className:"jsx-ecf8030530de781c write-review-product-info",children:[(0,i.jsx)("img",{src:f||"https://storage.googleapis.com/shy-pub/static/placeholder.jpg",alt:g,className:"jsx-ecf8030530de781c write-review-media"}),(0,i.jsx)("div",{className:"jsx-ecf8030530de781c",children:(0,i.jsx)(l.Z,{className:"write-review-name",children:g})})]})]}),(0,i.jsxs)(n.ZP,{item:!0,xs:12,md:6,className:"write-review-left-block",children:[H&&(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:16},className:"jsx-ecf8030530de781c",children:[(0,i.jsx)(l.Z,{className:"write-review-heading",children:null===(s=C.label_settings)||void 0===s?void 0:s.write_review_cta}),(0,i.jsx)("div",{style:{cursor:"pointer",marginTop:12},onClick:D,className:"jsx-ecf8030530de781c",children:(0,i.jsx)(x.Z,{large:H})})]}),(0,i.jsxs)(l.Z,{className:"write-review-sub-heading",style:{marginTop:6},children:["Overall Rating ",(0,i.jsx)("span",{style:{color:"#f30020"},className:"jsx-ecf8030530de781c",children:"*"})]}),(0,i.jsx)("div",{className:"jsx-ecf8030530de781c write-review-stars",children:[1,2,3,4,5].map((e,t)=>(0,i.jsx)("div",{onClick:()=>z(t+1),style:{cursor:"pointer",margin:"0px 2px"},className:"jsx-ecf8030530de781c",children:(0,i.jsx)(p.Z,{stroke:t<S?"#febc48":"#e8e8e8",size:H?32:28})},t))}),(0,i.jsxs)(l.Z,{className:"write-review-sub-heading",children:["Your Name ",(0,i.jsx)("span",{style:{color:"#f30020"},className:"jsx-ecf8030530de781c",children:"*"})]}),(0,i.jsx)(c.Z,{variant:"outlined",fullWidth:!0,value:E,onChange:e=>{(0,d.av)(e.target.value)&&P(e.target.value)},inputProps:{className:"write-review-input"},placeholder:"Enter your name",disabled:!!L.name||!!(null==_?void 0:_.customer_name),classes:{root:"write-review-black"}}),(0,i.jsx)(l.Z,{className:"write-review-sub-heading",children:"Title"}),(0,i.jsx)(c.Z,{variant:"outlined",fullWidth:!0,value:T,onChange:e=>{e.target.value.length>100||B(e.target.value)},inputProps:{className:"write-review-input"},placeholder:"Type your review title"}),(0,i.jsxs)("div",{className:"jsx-ecf8030530de781c write-review-helper-txt",children:[T.length,"/100"]}),(0,i.jsx)(l.Z,{className:"write-review-desc-heading",children:"Description"}),(0,i.jsx)(c.Z,{variant:"outlined",fullWidth:!0,multiline:!0,value:F,onChange:e=>{e.target.value.length>1e3||A(e.target.value)},InputProps:{className:"write-review-input"},inputProps:{className:"write-review-input",style:{padding:0,height:40}},placeholder:"Please write your review"}),(0,i.jsxs)("div",{className:"jsx-ecf8030530de781c write-review-helper-txt",children:[F.length,"/1000"]}),(0,i.jsx)(w.Z,{disabled:I,loading:M,onClick:G,fullWidth:!0,bold:!0,className:"write-review-submit",children:null===(r=C.label_settings)||void 0===r?void 0:r.submit_review_cta})]})]})]}),(0,i.jsx)(a(),{id:"ecf8030530de781c",children:".MuiInputBase-root.Mui-disabled{color:rgba(0,0,0,.87)}"})]})}},78802:function(){},12766:function(){},40853:function(){},13049:function(){},90915:function(){}}]);