"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[71],{271:(e,t,a)=>{a.r(t),a.d(t,{default:()=>i});const i={container:"ARXqDxZt",writeReviewTitle:"BYrMqN9b",field:"mX1RH16p",label:"kOxbIdDY",input:"MWf_zaBJ",textarea:"c4EbHpL4",rating:"qKa8P3SJ",star:"Cr3A6eGy",starSelected:"vRJsPzxd",submit:"dk6iJfOU",imagePreview:"XZ7E9B5A",statusContainer:"OlsGRGkU",thankYouTitle:"COGuffWk",thankYouMessage:"YHPG5NZb"}},8:(e,t,a)=>{a.r(t),a.d(t,{default:()=>i});const i={gallery:"utYziQAE",imageContainer:"u7hALhRV",image:"HRX192Oq",imageMessage:"C0mfa5lU",review:"jT_XY_1t",title:"pfrMrpCr",truncated:"YcyRuLBB",expanded:"IomlcWA2",modal:"EQpOtFeT",fadeIn:"sVWQQ9or",fadeOut:"sZfxzYzK",modalInner:"Lg4GX5Y4",modalContent:"OpbIhP35",modalOverlay:"iZzCdFwp",modalHeader:"wek3E8S1",fullBleedImage:"i2zolDuA",slideUp:"u96mNKND",slideDown:"jAr2PKY3",closeButton:"MvI_gVPT",modalTextContent:"bihC0FqM",modalBodyText:"ksR2mAtx",loadMoreButton:"QklUYRZO",reviewsHeader:"KjJxq4iV"}},270:(e,t,a)=>{const i=a(65);(0,a(2).createEntrypoint)("pdp_reviews",i.Reviews)},21:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.REVIEWS_ENDPOINT=t.REVIEWS_PER_PAGE=void 0,t.formatPrice=function(e){return parseInt(e)},t.REVIEWS_PER_PAGE=28,t.REVIEWS_ENDPOINT="https://shalom-development-worker-may-2024.digitaloptgroup.workers.dev"},66:function(e,t,a){var i=this&&this.__awaiter||function(e,t,a,i){return new(a||(a=Promise))((function(s,l){function n(e){try{d(i.next(e))}catch(e){l(e)}}function r(e){try{d(i.throw(e))}catch(e){l(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(n,r)}d((i=i.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ReviewForm=function({productId:e,productName:t,productHandle:a,productType:s,productDescription:c,productImageUrl:o,productUrl:u,config:f}){const[h,m]=(0,n.useState)("ready"),[p,v]=(0,n.useState)({name:"",email:"",rating:0,title:"",review:"",images:[]});function g(e){const t=e.target;v(Object.assign(Object.assign({},p),{[t.name]:t.value}))}return"submitting"===h?(0,l.jsx)("div",{class:r.default.statusContainer,children:(0,l.jsx)("div",{class:r.default.thankYouTitle,children:"Submitting your review..."})}):"success"===h?(0,l.jsxs)("div",{class:r.default.statusContainer,children:[(0,l.jsx)("div",{class:r.default.thankYouTitle,children:"Thank you for submitting a review!"}),(0,l.jsx)("div",{class:r.default.thankYouMessage,children:"Your input is very much appreciated. Share it with your friends so they can enjoy it too!"})]}):(0,l.jsxs)("form",{class:r.default.container,onSubmit:function(l){return i(this,void 0,void 0,(function*(){var i;l.preventDefault(),m("submitting");const n=(null==o?void 0:o.startsWith("/fast-image"))?`${f.shopify_file_path}${o.split(null!==(i=f.fast_image_prefix)&&void 0!==i?i:"")[1]}`:o,r=new FormData;r.append("productId",e),r.append("author",p.name),r.append("email",p.email),r.append("location",""),r.append("reviewRating",p.rating.toString()),r.append("reviewTitle",p.title),r.append("reviewMessage",p.review),r.append("productName",t),r.append("productSKU",a),r.append("productType",s),r.append("productDescription",c),r.append("productImageUrl",null!=n?n:""),r.append("productUrl",u),r.append("reviewSource","widget");for(let e=0;e
(0,l.jsx)("span",{class:[r.default.star,p.rating>=e?r.default.starSelected:""].join(" "),onClick:()=>{return t=e,void v(Object.assign(Object.assign({},p),{rating:t}));var t},children:p.rating>=e?"★":"☆"},e)))})]}),(0,l.jsxs)("div",{class:r.default.field,children:[(0,l.jsx)("label",{class:r.default.label,for:"title",children:"Title of Review"}),(0,l.jsx)("input",{class:r.default.input,type:"text",id:"title",name:"title",value:p.title,onChange:g,placeholder:"Give your review a title"})]}),(0,l.jsxs)("div",{class:r.default.field,children:[(0,l.jsx)("label",{class:r.default.label,for:"review",children:"How was your overall experience?"}),(0,l.jsx)("textarea",{class:r.default.textarea,id:"review",name:"review",value:p.review,onChange:g})]}),(0,l.jsxs)("div",{class:r.default.field,children:[(0,l.jsx)("label",{class:r.default.label,for:"images",children:"Add Photos"}),(0,l.jsx)("input",{class:r.default.input,type:"file",id:"images",name:"images",multiple:!0,onChange:function(e){const t=e.target;t.files&&v(Object.assign(Object.assign({},p),{images:[...p.images,...Array.from(t.files)]}))}}),(0,l.jsx)("div",{class:r.default.imagePreview,children:p.images.map(((e,t)=>(0,l.jsx)("img",{src:URL.createObjectURL(e),alt:`Preview ${t+1}`},t)))})]}),(0,l.jsx)("div",{class:r.default.submit,children:(0,l.jsx)("button",{class:d.default.loadMoreButton,type:"submit",children:"Submit"})})]})};const l=a(0),n=(a(1),a(3)),r=s(a(271)),d=s(a(8))},122:function(e,t,a){var i=this&&this.__awaiter||function(e,t,a,i){return new(a||(a=Promise))((function(s,l){function n(e){try{d(i.next(e))}catch(e){l(e)}}function r(e){try{d(i.throw(e))}catch(e){l(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(n,r)}d((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ListTracking=function({children:e,id:t,cacheKey:a}){const n=(0,l.useRef)(null),[d,c]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{const e=new IntersectionObserver((s=>i(this,[s],void 0,(function*([i]){if(null==i?void 0:i.isIntersecting){n.current&&e.unobserve(n.current);try{yield r(a,t,"trial")}catch(e){}}}))),{root:null,rootMargin:"0px",threshold:1});return n.current&&e.observe(n.current),()=>{n.current&&e.unobserve(n.current)}}),[]),(0,s.jsx)("div",{ref:n,onClick:()=>i(this,void 0,void 0,(function*(){try{d||(yield r(a,t,"success"),c(!0))}catch(e){}})),children:e})};const s=a(0),l=(a(1),a(3)),n=a(21);function r(e,t,a){return i(this,void 0,void 0,(function*(){const i=new URL(n.REVIEWS_ENDPOINT);i.pathname="/__list_engagement__",i.searchParams.set(a,"1"),i.searchParams.set("cacheKey",e),i.searchParams.set("__orly_aid","NA"),i.searchParams.set("itemId",null==t?void 0:t.toString()),yield fetch(i.toString(),{mode:"no-cors"})}))}},65:function(e,t,a){var i=this&&this.__awaiter||function(e,t,a,i){return new(a||(a=Promise))((function(s,l){function n(e){try{d(i.next(e))}catch(e){l(e)}}function r(e){try{d(i.throw(e))}catch(e){l(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(n,r)}d((i=i.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Reviews=function(e){var t,a;const s=e.useSharedState(),{product:m,config:p}=s((e=>({product:e.product,config:e.config})));if(!m)return(0,l.jsx)(n.Fragment,{});const v=m.handle,{reviewCount:g,reviewRating:x}=m,j=Object.values(m.imageMap).flat().map((({src:e})=>e)),[w,y]=(0,r.useState)(!1),[b,_]=(0,r.useState)(!(e.reviews.length{M(!0),window.matchMedia("(max-width: 600px)").matches||(R(null),P(!1)),setTimeout((()=>{R(null),P(!1),M(!1)}),300),document.body.style.overflow="auto"},B=e=>{e.target===e.currentTarget&&D()},W="Studio photo";return(0,l.jsxs)("div",{id:"reviews",class:d.default.reviewContainer,children:[I&&(0,l.jsxs)(n.Fragment,{children:[(0,l.jsx)("div",{class:[d.default.modal,T?d.default.fadeOut:""].join(" "),onClick:B,onDblClick:D}),(0,l.jsx)("div",{class:d.default.modalInner,onClick:B,onDblClick:D,children:(0,l.jsxs)("div",{class:[d.default.modalContent,T?d.default.slideDown:""].join(" "),onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("div",{class:d.default.modalHeader,children:(0,l.jsx)("button",{class:d.default.closeButton,onClick:D,children:"X"})}),(0,l.jsx)("div",{class:d.default.modalTextContent,children:(0,l.jsx)(h.ReviewForm,{productId:m.id,productName:m.title,productHandle:m.handle,productType:m.productType,productDescription:m.description,productImageUrl:null===(a=null===(t=m.variants[0])||void 0===t?void 0:t.image)||void 0===a?void 0:a.src,productUrl:`https://${p.hostname}/products/${m.handle}`,config:p})})]})})]}),g&&x?(0,l.jsxs)("div",{class:d.default.reviewsHeader,children:["★★★★★ ",g," Reviews | Avg Rating: ",x.toFixed(1)]}):(0,l.jsx)("div",{class:d.default.reviewsHeader,children:"Be the first to review this item"}),(0,l.jsx)("button",{class:d.default.loadMoreButton,onClick:()=>{P(!0),document.body.style.overflow="hidden"},children:"Write a Review"}),(0,l.jsx)("div",{className:d.default.gallery,children:C.map(((e,t)=>{const a=(null==e?void 0:e.images[0])?`https://cdn.stamped.io/uploads/photos/${e.images[0]}`:j[t%j.length];return(0,l.jsx)(u.ListTracking,{id:e.id,cacheKey:e.cacheKey,children:(0,l.jsxs)("div",{onClick:()=>((e,t)=>{R(Object.assign(Object.assign({},e),{imgSrc:t})),document.body.style.overflow="hidden"})(e,a),class:d.default.reviewContainer,children:[(0,l.jsxs)("div",{class:d.default.imageContainer,children:[(0,l.jsx)(f.LazyImage,{src:a,initialWidth:400,cssClass:d.default.image,alt:e.author,fullSizeWidth:600,width:200,height:200}),!(null==e?void 0:e.images[0])&&(0,l.jsx)("div",{class:d.default.imageMessage,children:W})]}),(0,l.jsxs)("div",{class:d.default.review,children:[(0,l.jsx)("h3",{class:d.default.title,children:e.author}),(0,l.jsxs)("h3",{children:["✅ Verified Buyer | ",e.dateCreated]}),(0,l.jsx)("h3",{class:d.default.stars,children:"★★★★★"}),(0,l.jsx)("h3",{class:d.default.title,children:e.title}),(0,l.jsx)("p",{class:d.default.truncated,children:e.body})]})]},e.title)})}))}),(T||O)&&(0,l.jsxs)(n.Fragment,{children:[(0,l.jsx)("div",{class:[d.default.modal,T?d.default.fadeOut:""].join(" "),onClick:B,onDblClick:D}),O&&(0,l.jsx)("div",{class:d.default.modalInner,onClick:B,onDblClick:D,children:(0,l.jsxs)("div",{class:[d.default.modalContent,T?d.default.slideDown:""].join(" "),onClick:e=>e.stopPropagation(),children:[(0,l.jsxs)("div",{class:d.default.modalHeader,children:[(0,l.jsx)(f.LazyImage,{src:O.imgSrc,initialWidth:400,cssClass:d.default.fullBleedImage,alt:O.author,fullSizeWidth:600,width:200,height:200}),!(null==O?void 0:O.images[0])&&(0,l.jsx)("div",{class:d.default.imageMessage,children:W}),(0,l.jsx)("button",{class:d.default.closeButton,onClick:D,children:"X"})]}),(0,l.jsxs)("div",{class:d.default.modalTextContent,children:[(0,l.jsx)("h3",{class:d.default.title,children:O.author}),(0,l.jsxs)("h3",{children:["✅ Verified Buyer | ",O.dateCreated]}),(0,l.jsx)("h3",{class:d.default.stars,children:"★★★★★"}),(0,l.jsx)("h3",{class:d.default.title,children:O.title}),(0,l.jsx)("p",{class:d.default.modalBodyText,children:O.body})]})]})})]}),b&&(0,l.jsx)("button",{class:d.default.loadMoreButton,onClick:()=>i(this,void 0,void 0,(function*(){y(!0);const e=yield(0,c.getLazyState)("reviewsLazy",{productHandle:v,page:S+1});y(!1),(null!=e?e:[]).length{Object.defineProperty(t,"__esModule",{value:!0}),t.LazyImage=function({src:e,initialWidth:t,fullSizeWidth:a,cssClass:s,alt:l="",width:r,height:d,style:c}){const o=n(e,t,a);return r&&d?(0,i.jsx)("img",{src:o,class:s,alt:l,width:r,height:d,style:c}):(0,i.jsx)("img",{src:o,class:s,alt:l,style:c})},t.useBestImage=n;const i=a(0),s=(a(1),a(7)),l=a(3);function n(e,t,a){const i=(0,s.getFastImage)(e,t),n=(0,s.getFastImage)(e,a),[r,d]=(0,l.useState)({});(0,l.useEffect)((()=>{if(document){const e=document.createElement("img");e.src=n,e.onload=()=>d(Object.assign(Object.assign({},r),{[n]:!0}))}}),[n]);const c=(0,l.useMemo)((()=>r[n]?n:i),[e,t,a,r]);return(0,l.useEffect)((()=>{if(document){const e=document.createElement("img");e.src=n,e.onload=()=>d(Object.assign(Object.assign({},r),{[n]:!0}))}}),[n]),c}}},e=>{e.O(0,[1,2,3],(()=>e(e.s=270))),e.O()}]);