PageSourceSearch

https://main.cdn.wish.com/web/ac80df1e8d74/dist/cozy/cozy_mobile_c…t_browsy_Browsy_tsx.becc62a01dc35d319928.js

js wish.com collected 2026-09-24 07:56:48 UTC 34,364 bytes, 2 lines download raw bytes

1(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([["cozy_mobile_components_product_browsy_Browsy_tsx"],{
1"./cozy/mobile/components/product/browsy/Browsy.tsx":function(e,t,o){"use strict";o.d(t,{Z:function(){return ae}}),o("./node_modules/core-js/modules/web.dom-collections.iterator.js");var i=o("./node_modules/react/index.js"),s=o("./node_modules/react-redux/es/index.js"),n=o("./node_modules/react-router/esm/react-router.js"),r=o("./cozy/coco/components/DotLoader/DotLoader.tsx"),l=o("./cozy/coco/components/Icons/CloseIcon.tsx"),c=o("./cozy/coco/components/InfiniteList/InfiniteList.tsx"),d=o("./cozy/coco/components/DesignSpec/TextSpec.tsx"),a=o("./cozy/coco/components/WishLoadingBox/WishLoadingBox.tsx"),u=o("./cozy/coco/components/Button/Button.tsx"),h=o("./cozy/mobile/components/product/productImage/ProductImageContainer.tsx"),p=o("./node_modules/lodash/get.js"),m=o.n(p),x=o("./node_modules/react-router-dom/esm/react-router-dom.js"),g=o("./cozy/coco/components/RatingStars/RatingStars.tsx"),v=o("./node_modules/@ContextLogic/atlas-ui/dist/index.js"),y=o("./cozy/mobile/styles/product/ContestInfo.tsx"),w=o("./node_modules/styled-components/dist/styled-components.browser.esm.js"),I=o("./cozy/shared/styles/Mixins.tsx");const S=w.ZP.div.withConfig({displayName:"BrowsyContainer__BrowsyProductWrapper",componentId:"sc-1qj0y4g-0"})(["background-color:",";margin-top:14px;border-radius:12px;overflow:hidden;"],(e=>{let{theme:t}=e;return t.white})),C=w.ZP.div.withConfig({displayName:"BrowsyContainer__ProductDetailsWrapper",componentId:"sc-1qj0y4g-1"})(["margin:0 12px;"]),f=w.ZP.div.withConfig({displayName:"BrowsyContainer__PriceWrapper",componentId:"sc-1qj0y4g-2"})(["margin:6px 0;"]),_=w.ZP.div.withConfig({displayName:"BrowsyContainer__Price",componentId:"sc-1qj0y4g-3"})([""," color:",""],I.Gg,(e=>{let{theme:t}=e;return t.palettesGrey700})),j=w.ZP.div.withConfig({displayName:"BrowsyContainer__ProductButtonsWrapper",componentId:"sc-1qj0y4g-4"})([""," gap:12px;margin:0 12px 10px 12px;"],I.At),P=w.ZP.div.withConfig({displayName:"BrowsyContainer__SectionDivider",componentId:"sc-1qj0y4g-5"})(["height:4px;margin:0 0 10px -12px;width:calc(100% + 24px);background:",";"],(e=>{let{theme:t}=e;return t.palettesGrey200})),b=w.ZP.div.withConfig({displayName:"BrowsyContainer__ProductRatingWrapper",componentId:"sc-1qj0y4g-6"})([""," "," margin:10px 0 6px;"],I.bW,I.gq),z=w.ZP.div.withConfig({displayName:"BrowsyContainer__ProductRatingCount",componentId:"sc-1qj0y4g-7"})(["color:",";margin-left:8px;text-decoration:underline;"],(e=>{let{theme:t}=e;return t.palettesGrey900})),L=w.ZP.div.withConfig({displayName:"BrowsyContainer__AdBadgeContainer",componentId:"sc-1qj0y4g-8"})(["position:relative;"]),R=w.ZP.div.withConfig({displayName:"BrowsyContainer__AdBadge",componentId:"sc-1qj0y4g-9"})([""," background:rgba(0,0,0,0.5);border-radius:4px;bottom:16px;color:",";padding:2px 5px;position:absolute;right:8px;"],I.Vh,(e=>{let{theme:t}=e;return t.white}));var D=o("./cozy/mobile/styles/product/RatingsSectionV2.tsx"),B=o("./cozy/routes/RouteGenerators.tsx"),T=o("./cozy/utils/i18n.tsx"),E=o("./cozy/utils/URL.tsx"),Z=o("./cozy/data/constants/URLParameterConstants.tsx"),M=o("./cozy/data/constants/RatingConstants.tsx"),A=o("./cozy/data/selectors/ProductSelectors.tsx"),W=o("./cozy/mobile/components/product/ratingsSection/ProductReviewV2.tsx"),U=o("./node_modules/react/jsx-runtime.js"),k=(0,s.$j)(((e,t)=>{let{pid:o}=t;const i=(0,A.So8)(e,o);return{hasProductRating:!(null==i||!i.rating),ratingCountSpec:m()(i,"ratingCountSpec",null),ratingScore:m()(i,"rating",0),topRatings:(0,A.or)(e,o)}}))((e=>{let{hasProductRating:t,ratingCountSpec:o,ratingScore:s,topRatings:r,pid:l,sendBrowsyAnalytics:c}=e;const{palettesGrey700:a,Yellow1:u}=(0,w.Fg)(),h=(0,n.k6)(),p=(0,n.TH)(),[m,I]=(0,i.useState)({index:null,status:!1}),S=()=>{c("CLICK_REVIEWER_PROFILE")},C=(e,t)=>{I({index:e,status:t})};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(b,{children:t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g.Z,{ratingScore:s,overrideStyle:{width:"12px",height:"12px"},colorFull:u}),(0,U.jsx)(x.rU,{to:(0,B.sx)(l),onClick:()=>{c("CLICK_PRODUCT_RATING_SEE_MORE")},children:(0,U.jsx)(z,{children:(0,U.jsx)(d.Z,{textSpec:o})})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(y.PS,{children:(0,T.et)("A badge on a product indicating that it is too new to have reviews","New")}),(0,U.jsx)(y.xx,{children:(0,T.ag)("No item or merchant ratings yet")})]})}),r&&(0,U.jsxs)(D.vp,{overrideStyle:{marginBottom:"10px"},children:[r.map(((e,t)=>(0,U.jsx)(W.Z,{productId:l,rating:e,overrideReviewStyle:{padding:"8px",minWidth:"180px",height:(null==m?void 0:m.index)===t&&null!=m&&m.status?"150px":"60px",transition:"width 600ms ease-out, height 600ms ease-out"},overrideRatingStarsStyle:{width:"12px",height:"12px"},overrideProfileImageLinkStyle:{height:"30px"},overrideReviewHeaderTopStyle:{flexDirection:"column"},overrideReviewHeaderNameStyle:{fontSize:"10px",fontWeight:"600",marginBottom:"4px"},overrideReviewTextStyle:{fontSize:"10px",fontWeight:"400"},overrideRatingStarsColour:u,profilePictureDimenstion:30,overrideReviewTextLineClamp:2,shouldHideReviewDate:!0,shouldHideReviewHeaderBottom:!0,shouldHideBottomSection:!0,onClickProfileImage:S,reviewExpand:m,handleReviewExpand:C,reviewPosition:t,module:M.HT},t))),(0,U.jsxs)(D.Qi,{onClick:()=>{c("CLICK_PDP_TOP_RATINGS_VIEW_ALL"),h.push("".concat((0,B.sx)(l)).concat(p.search)),(0,E.pP)(Z.PP,h)},overrideStyle:{minWidth:"120px",padding:"8px",height:"60px"},children:[(0,U.jsx)(v.Icon,{name:"arrowRight",size:"small",color:a}),(0,U.jsx)(D.fE,{children:(0,T.et)("Meaning view all reviews for a product","View all")})]})]})]})})),H=o("./cozy/shared/components/buttons/BuyButton.tsx"),O=o("./cozy/shared/components/product/pdpModules/PdpBadgeTrayModule.tsx"),V=o("./cozy/mobile/components/common/modal/WishDotLoaderModal.tsx"),N=o("./cozy/mobile/components/hoc/BuyButtonPanelHOC.tsx"),q=o("./cozy/data/selectors/BrowserSelectors.tsx"),F=o("./cozy/shared/styles/buttons/BuyButton.tsx"),X=o("./cozy/utils/String.tsx"),G=o("./cozy/utils/ProductLinkUrl.tsx"),Y=o("./cozy/utils/ClientExperimentUtils.tsx"),K=o("./cozy/data/services/AnalyticsService.tsx"),$=o("./cozy/data/actions/ProductDetailPageActions.tsx"),Q=o("./cozy/data/actions/ProductActions.tsx"),J=(0,N.Z)((0,s.$j)(((e,t)=>{let{pid:o}=t;const i=(0,A.QsX)(e,o);return{isFullProduct:(0,A.q8f)(e,o),displayActualPrice:(0,A.zHz)(e,o,{precisionSelector:X.NK,useDefault:!0}
1),isBrowsyDataFetched:(0,A.DJo)(e,o),titleTextSpec:(0,A.f9r)(e,o),browsyBadges:(0,A.RgO)(e,o),isBrowsyProductSoldOut:(0,A.ptZ)(e,o),requestID:i?(0,A.BDE)(e,o):null,windowHeight:(0,q.Cr)(e),adBadgeSpec:(0,A.bd)(e,o)}}),((e,t)=>{let{pid:o}=t;return{getFullProductInfo:t=>e((0,Q.getFullProductAndPrefetch)(o,t)),setInitialProductValuesAction:()=>e((0,Q.setInitialProductValues)(o)),fetchPdp:()=>e((0,$.b)(o))}}))((e=>{let{displayActualPrice:t,isBrowsyDataFetched:o,isBrowsyProductSoldOut:s,titleTextSpec:r,browsyBadges:l,requestID:c,windowHeight:p,isFullProduct:m,adBadgeSpec:x,getFullProductInfo:g,setInitialProductValuesAction:v,fetchPdp:y,pid:w,index:I,heroProductID:b,onClickView:z,loadProductData:D,buttonStyle:B,setBuyButtonClickedPIDs:M,scrollDivID:A,onTileClick:W,onClickBuyButton:N}=e;const q=(0,n.TH)(),X=(0,i.useRef)(null),$=(0,i.useRef)(!1),Q=(0,E.re)(Z.hh,q),J=(0,G.a)(w,q,Q),[ee,te]=(0,i.useState)(!1),oe=()=>{var e,t;const o=null===(e=X.current)||void 0===e?void 0:e.getBoundingClientRect().top,i=null===(t=X.current)||void 0===t?void 0:t.getBoundingClientRect().bottom;!$.current&&o&&i&&(0===I||o>=0&&i<=p)&&((0,K.y)("IMPRESSION_BROWSY_PDP",{product_id:w,is_browsy:!0,hero_product:b}),$.current=!0)};(0,i.useEffect)((()=>{D(w),0===I&&oe();const e=A&&document.getElementById(A);return e&&X.current&&e.addEventListener("scroll",oe),()=>{e&&e.removeEventListener("scroll",oe)}}),[]);const ie=e=>{(0,K.y)(e,{product_id:w,request_id:c,is_browsy:!0,hero_product:b})},se=()=>{ie("CLICK_VIEW_FULL_PDP"),z()},ne=r?(0,U.jsx)(d.Z,{onClick:se,textSpec:r,to:J,overrideStyle:{display:"-webkit-box","-webkit-line-clamp":"2","-webkit-box-orient":"vertical",overflow:"hidden"}}):(0,U.jsx)(a.Z,{width:"100%",height:"40px"}),re=o?l&&(0,U.jsx)(O.Z,{module:l,overrideStyles:{overflowY:"scroll",marginBottom:"8px"},overrideIconStyle:{marginRight:"5px"},shouldHideScrollbar:!0}):(0,U.jsx)(a.Z,{width:"100%",height:"40px"});return(0,U.jsxs)(S,{ref:X,onClick:()=>W?W(w):void 0,children:[(0,U.jsx)(h.Z,{pid:w,shouldHideActionIcons:!0,shouldSetUnloadedSrc:!0,isFullWidthSquare:!0,overrideImageIndexWrapperStyles:{top:"8px",right:"8px",fontSize:"9px",fontWeight:"600",borderRadius:"4px",padding:"5px 8px",lineHeight:"0"},isImageObjectFitCover:!0,onImageClick:()=>ie("CLICK_MOBILE_EXTRA_PHOTOS")}),x&&0!==I&&(0,Y.nO)()&&(0,U.jsx)(L,{children:(0,U.jsx)(R,{children:null==x?void 0:x.text})}),(0,U.jsxs)(C,{children:[ne,(0,U.jsx)(f,{children:(0,U.jsx)(_,{children:t})}),re,(0,U.jsx)(P,{}),o?(0,U.jsx)(k,{pid:w,sendBrowsyAnalytics:ie}):(0,U.jsx)(a.Z,{width:"100%",height:"120px"})]}),(0,U.jsxs)(j,{children:[(0,U.jsx)(u.ZP,{color:u.fV.BLACK_WHITE,onClick:se,to:J,bold:!0,stretch:!0,rounded:!0,overrideStyle:{...B,padding:"0",boxSizing:"border-box"},children:(0,T.et)("View details button to take user to the product page.","View details")}),s?(0,U.jsx)(F.aB,{shouldChangeBuyButtonColor:!0,style:B,children:(0,T.et)("Sold Out Button","Sold Out")}):(0,U.jsx)(H.Z,{pid:w,overrideBuyButtonClick:async()=>{ie("CLICK_PDP_ADD_TO_CART"),M((e=>[...e,w])),W&&W(w),m||(te(!0),v(),await g({shouldForceFetch:!1}),await y(),te(!1)),N()},shouldChangeBuyButtonColor:!0,text:(0,T.ag)("Add to cart"),showLoader:!o,overrideStyle:B,shouldNotClearBuyButtonReducer:!0,isLazyLoaded:!0})]}),ee&&(0,U.jsx)(V.Z,{})]})}))),ee=o("./cozy/shared/styles/Utils.tsx");const te=w.ZP.div.withConfig({displayName:"Browsy__BrowsyWrapper",componentId:"sc-1twsjpz-0"})(["position:fixed;top:0;left:0;z-index:",";transition:all 0.4s ease;opacity:",";"],(e=>{let{theme:t}=e;return t.zIndexModal3}),(e=>{let{isVisible:t}=e;return t?1:0})),oe=w.ZP.div.withConfig({displayName:"Browsy__BrowsyBackdrop",componentId:"sc-1twsjpz-1"})(["position:fixed;box-sizing:border-box;width:100%;height:100%;background:",";"],(e=>{let{theme:t}=e;return(0,ee.cM)(t.Grey1,.7)})),ie=w.ZP.div.withConfig({displayName:"Browsy__BrowsyContent",componentId:"sc-1twsjpz-2"})(["height:calc(100% - ","px);margin:0 24px;overflow-y:scroll;"],48),se=w.ZP.div.withConfig({displayName:"Browsy__BrowsyTopWrapper",componentId:"sc-1twsjpz-3"})(["padding:12px 16px;background:",";width:100vw;height:","px;box-sizing:border-box;display:flex;align-items:center;"],(e=>{let{theme:t}=e;return t.white}),48),ne=w.ZP.h4.withConfig({displayName:"Browsy__BrowsyTitle",componentId:"sc-1twsjpz-4"})([""," margin-left:10px;"],I.Vt),re=w.ZP.div.withConfig({displayName:"Browsy__TilePlaceholder",componentId:"sc-1twsjpz-5"}
1)(["height:","px;border-radius:12px;"],570),le=w.ZP.div.withConfig({displayName:"Browsy__NoItems",componentId:"sc-1twsjpz-6"})(["display:block;margin:0 10px 10px 10px;",";text-align:center;line-height:40px;color:",";"],I.fb,(e=>{let{theme:t}=e;return t.white}));var ce=o("./cozy/data/actions/BuyButtonActions.tsx"),de=o("./cozy/data/constants/AppConstants.tsx"),ae=(0,s.$j)(null,(e=>({getBrowsyProductsData:t=>e((0,Q.getBrowsyProductsInfo)(t)),clearBuyButton:t=>e((0,ce.o)(t))})))((e=>{let{productIDs:t,onLoadMore:o,noMoreItems:s,isLoading:d,originalPid:a,scrollDivID:u,apiOffset:h,onClose:p,pushBrowsyState:m,title:x,getBrowsyProductsData:g,clearBuyButton:v}=e;const y=(0,n.TH)(),[w,I]=(0,i.useState)(!1),[S,C]=(0,i.useState)(!1),[f,_]=(0,i.useState)([]),j=(0,i.useRef)(null),P=(0,i.useRef)(h),b=(0,i.useRef)(0),z=(0,i.useRef)(!0),L=void 0===t||0===t.length,R=()=>{const e=t.slice(P.current,P.current+5);P.current=P.current+e.length,g(e)},D=()=>{m(b.current,P.current,j)};(0,i.useEffect)((()=>(I(!0),setTimeout((()=>window.document.body.classList.add("no-overflow")),100),()=>{window.document.body.classList.remove("no-overflow"),z.current&&(D(),p())})),[]),(0,i.useEffect)((()=>{P.current=h}),[h]),(0,i.useEffect)((()=>()=>{f.forEach((e=>v(e)))}),[f]),(0,i.useEffect)((()=>{R()}),[t]),(0,i.useEffect)((()=>{L?o&&setTimeout(o,0):s||d||!o||setTimeout(o,0)}),[L,s]);const B=e=>{e===t[P.current]&&S&&R()},Z=()=>{z.current=!1,p()},M=()=>{z.current=!1,window.document.body.classList.remove("no-overflow"),D(),p()},A=e=>{j.current=e},W=L?[...Array(20).keys()].map((e=>(0,U.jsx)(re,{},e))):t.map(((e,t)=>(0,U.jsx)(J,{pid:e,index:t,heroProductID:a,onClickView:M,onTileClick:A,loadProductData:B,setBuyButtonClickedPIDs:_,buttonStyle:{width:"calc(50% - 6px)",borderRadius:"24px",height:"32px",lineHeight:"16px",fontSize:"12px"},shouldClearSelectedDimensions:!0,productSource:(0,E.re)("source",y)||de.Yw.UNKNOWN,source:"browsy",scrollDivID:u},"".concat(e,"-").concat(t)))).filter((e=>null!==e)),k=s?(0,U.jsx)(le,{children:(0,T.ag)("No More Items")},"footer-no-items"):(0,U.jsx)(r.Z,{overrideStyle:{marginBottom:"16px"}},"footer-loader");return W.push(k),(0,U.jsxs)(te,{isVisible:w,children:[(0,U.jsxs)(se,{children:[(0,U.jsx)(l.Z,{eventHandlers:{onClick:Z},overrideStyle:{width:"10px",height:"10px",padding:"4px",border:"2px solid black",borderRadius:"50%"}}),(0,U.jsx)(ne,{children:x||(0,T.et)("Related Items Heading on Top of Browsy Modal","Related Items")})]}),(0,U.jsx)(oe,{onClick:Z,children:(0,U.jsxs)(ie,{id:u,onClick:e=>e.stopPropagation(),children:[d&&L?(0,U.jsx)(r.Z,{overrideStyle:{margin:"16px 0"}}):null,!d&&s&&L?(0,U.jsx)(le,{children:(0,T.ag)("No Products Found.")}):(0,U.jsx)(c.Z,{lazyLoadCallback:()=>{C(!1),o&&o()}
1,entries:W,scrollContainerID:u,isInsideModal:!0,buffer:2,onScrollDown:()=>{var e;S||C(!0),b.current=u&&(null===(e=document.getElementById(u))||void 0===e?void 0:e.scrollTop)||0}})]})})]})}))},
1"./cozy/mobile/components/product/productImage/ProductImageContainer.tsx":function(e,t,o){"use strict";o.d(t,{Z:function(){return j}}),o("./node_modules/core-js/modules/web.dom-collections.iterator.js");var i=o("./node_modules/react/index.js"),s=o("./node_modules/react-redux/es/index.js"),n=o("./node_modules/styled-components/dist/styled-components.browser.esm.js"),r=o("./node_modules/react/jsx-runtime.js"),l=e=>{let{overrideStyle:t={}}=e;const o=(0,n.Fg)();return(0,r.jsxs)("svg",{viewBox:"0 0 22 18",fill:o.white,xmlns:"http://www.w3.org/2000/svg",style:{...t},children:[(0,r.jsx)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.68228 7.25068C8.92741 7.24021 9.16216 7.3503 9.31086 7.54547L12.1429 11.2625L13.832 9.04547C13.9822 8.84837 14.22 8.73817 14.4674 8.75101C14.7149 8.76385 14.94 8.89808 15.069 9.10965L19.4551 16.3056C19.8409 16.9386 19.3853 17.75 18.6439 17.75H3.36389C2.6147 17.75 2.16031 16.9233 2.56189 16.2908L8.08113 7.59799C8.21264 7.39086 8.43715 7.26115 8.68228 7.25068ZM8.77028 9.31103L4.36459 16.25H17.6645L14.3597 10.828L12.7394 12.9545C12.5976 13.1407 12.3769 13.25 12.1429 13.25C11.9088 13.25 11.6881 13.1407 11.5463 12.9545L8.77028 9.31103Z",fill:o.white}),(0,r.jsx)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.5 4.75C16.0858 4.75 15.75 5.08579 15.75 5.5C15.75 5.91421 16.0858 6.25 16.5 6.25C16.9142 6.25 17.25 5.91421 17.25 5.5C17.25 5.08579 16.9142 4.75 16.5 4.75ZM14.25 5.5C14.25 4.25736 15.2574 3.25 16.5 3.25C17.7426 3.25 18.75 4.25736 18.75 5.5C18.75 6.74264 17.7426 7.75 16.5 7.75C15.2574 7.75 14.25 6.74264 14.25 5.5Z",fill:o.white}),(0,r.jsx)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.66667 1.75C2.49549 1.75 1.75 2.54186 1.75 3.28571V14.7143C1.75 15.4581 2.49549 16.25 3.66667 16.25H18.3333C19.5045 16.25 20.25 15.4581 20.25 14.7143V3.28571C20.25 2.54186 19.5045 1.75 18.3333 1.75H3.66667ZM0.25 3.28571C0.25 1.50484 1.89232 0.25 3.66667 0.25H18.3333C20.1077 0.25 21.75 1.50484 21.75 3.28571V14.7143C21.75 16.4952 20.1077 17.75 18.3333 17.75H3.66667C1.89232 17.75 0.25 16.4952 0.25 14.7143V3.28571Z",fill:o.white})]})},c=o("./cozy/shared/components/product/ShareButton.tsx"),d=o("./cozy/shared/components/hoc/LazyImageHOC.tsx"),a=o("./cozy/data/selectors/ProductSelectors.tsx"),u=o("./cozy/data/selectors/UserSelectors.tsx"),h=o("./cozy/data/actions/ProductDetailPageActions.tsx"),p=o("./cozy/data/selectors/DataSelectors.tsx"),m=o("./cozy/data/selectors/ProductDetailPageSelectors.tsx"),x=o("./cozy/data/services/AnalyticsService.tsx"),g=o("./cozy/mobile/styles/product/ProductPage.tsx"),v=o("./cozy/desktop/components/productV2/imageSection/AdultContentWarningImage.tsx"),y=o("./cozy/coco/components/Icons/HomeStyler3DIcon.tsx"),w=o("./cozy/data/constants/DataTestIDConstants.tsx"),I=o("./cozy/utils/Promise.tsx"),S=o("./cozy/utils/ClientExperimentUtils.tsx");function C(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const f=(0,d.Z)(g.fb);class _ extends i.Component{constructor(e){var t,o;super(e),C(this,"images",void 0),C(this,"image",void 0),C(this,"initialScroll",void 0),C(this,"isScrolling",void 0),C(this,"initialX",void 0),C(this,"initialY",void 0),C(this,"scrollDirection",void 0),C(this,"setWrapperRef",(e=>{this.images=e})),C(this,"initializeCarousel",(()=>{const{images:e}=this,{totalUniqueImages:t}=this.state;if(e&&e.children&&e.addEventListener){const[o]=e.children;this.image=o,e.scrollLeft=t>1?this.image.clientWidth:0,e.addEventListener("touchstart",this.onTouchStart),e.addEventListener("touchmove",this.onTouchMove),e.addEventListener("touchend",this.onTouchEnd),e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("mouseup",this.onMouseUp),this.setState({isInitialized:!0},(()=>{t>1&&(e.scrollLeft=o.clientWidth)}))}})),C(this,"scrollToSelectedPic",((e,t)=>
1{const{images:o}=this;if(o&&o.children&&o.scrollLeft){const[i]=o.children,{currentImageIndex:s}=this.state;e&&s!==e&&this.setState({currentImageIndex:e},(()=>{this.smoothScroll(o.scrollLeft,e*i.clientWidth),o.scrollLeft=e*i.clientWidth,t&&this.setState({isDefaultVariationImageLoaded:!0})}))}})),C(this,"onMouseOut",(()=>{const{images:e}=this;e&&(this.isScrolling=!1,this.scrollDirection=0,this.scrollToWholeImage(),this.initialX=null,this.initialY=null,this.initialScroll=null,e.removeEventListener("mouseout",this.onMouseOut))})),C(this,"onMouseUp",(()=>{const{images:e}=this;e&&(this.isScrolling=!1,this.scrollDirection=0,this.scrollToWholeImage(),this.initialX=null,this.initialY=null,this.initialScroll=null,e.removeEventListener("mouseout",this.onMouseUp))})),C(this,"onMouseDown",(e=>{const{images:t}=this;t&&(t.addEventListener("mouseout",this.onMouseOut),this.initialX=e.clientX,this.initialY=e.clientY,this.initialScroll=t.scrollLeft,this.isScrolling=!0,this.scrollDirection=0)})),C(this,"onMouseMove",(e=>{const{images:t,image:o}=this;if(this.isScrolling&&null!==this.initialScroll&&void 0!==this.initialScroll&&null!==this.initialX&&void 0!==this.initialX&&null!==this.initialY&&void 0!==this.initialY&&1!==this.scrollDirection&&t&&o){if(0===this.scrollDirection){const t=this.initialY-e.clientY,o=this.initialX-e.clientX;Math.abs(t)>10?this.scrollDirection=1:Math.abs(o)>10&&(this.scrollDirection=2)}else 2===this.scrollDirection&&e.preventDefault();let i=this.initialScroll+(this.initialX-e.clientX);i>=t.scrollWidth-o.clientWidth?i=t.scrollWidth-o.clientWidth:i<=0&&(i=0),t.scrollLeft=i}})),C(this,"onTouchStart",(e=>{const{images:t}=this;!this.isScrolling&&t&&(this.initialY=e.touches[0].clientY,this.initialX=e.touches[0].clientX,this.initialScroll=t.scrollLeft,this.isScrolling=!0,this.scrollDirection=0)})),C(this,"onTouchEnd",(()=>{this.isScrolling=!1,this.scrollDirection=0,this.scrollToWholeImage(),this.initialX=null,this.initialY=null,this.initialScroll=null})),C(this,"onTouchMove",(e=>{const{images:t,image:o}=this;if(this.isScrolling&&null!==this.initialScroll&&void 0!==this.initialScroll&&null!==this.initialX&&void 0!==this.initialX&&null!==this.initialY&&void 0!==this.initialY&&1!==this.scrollDirection&&t&&o){if(0===this.scrollDirection){const t=this.initialY-e.touches[0].clientY,o=this.initialX-e.touches[0].clientX;Math.abs(t)>10?this.scrollDirection=1:Math.abs(o)>10&&(this.scrollDirection=2)}else 2===this.scrollDirection&&e.cancelable&&e.preventDefault();let i=this.initialScroll+(this.initialX-e.touches[0].clientX);i>=t.scrollWidth-o.clientWidth?i=t.scrollWidth-o.clientWidth:i<=0&&(i=0),t.scrollLeft=i}})),C(this,"scrollToWholeImage",(async()=>{const{images:e,image:t}=this,{currentImageIndex:o,totalUniqueImages:i}=this.state;if(e&&t&&i&&e.scrollLeft!==this.initialScroll&&"number"==typeof this.initialScroll){let s=(e.scrollLeft+t.clientWidth/2)/t.clientWidth>>0;const n=e.scrollLeft-this.initialScroll;0===Math.abs(s-o)&&(n>0&&Math.abs(n)>50?s++:Math.abs(n)>50&&s--);let r=s;0===r&&(r=i),r===i+1&&(r=1),this.setState({currentImageIndex:r},(()=>{o!==r&&(0,x.y)("CLICK_MSITE_SCROLL_PRODUCT_IMAGE",{previous_index:o,current_index:r})})),await this.smoothScroll(e.scrollLeft,s*t.clientWidth),e.scrollLeft=r*t.clientWidth}})),C(this,"smoothScroll",(async(e,t)=>{const{images:o}=this;if(o&&!this.isScrolling){const i=Math.abs(e-t);i<2?o.scrollLeft=t:(o.scrollLeft=e,await(0,I.g)(10),await this.smoothScroll(e+Math.max(i/10,2)*(e<t?1:-1),t))}})),this.initialScroll=null,this.isScrolling=!1,this.initialX=null,this.initialY=null,this.scrollDirection=0,this.state={currentImageIndex:1,isInitialized:!1,totalUniqueImages:null!==(t=null===(o=e.photoStripImages)||void 0===o?void 0:o.length)&&void 0!==t?t:0,isDefaultVariationImageLoaded:!1}}componentDidMount(){const{images:e}=this,{totalUniqueImages:t}=this.state;if(e&&e.children&&e.addEventListener){const[o]=e.children;this.image=o,e.scrollLeft=t>1?this.image.clientWidth:0,e.addEventListener("touchstart",this.onTouchStart),e.addEventListener("touchmove",this.onTouchMove),e.addEventListener("touchend",this.onTouchEnd),e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("mouseup",this.onMouseUp),this.setState({isInitialized:!0},(()=>{t>1&&(e.scrollLeft=o.clientWidth)}))}}componentDidUpdate(e){const t=!this.props.shouldRequireAgeConsent||this.props.hasAgeConsent,o=!e.shouldRequireAgeConsent||e.hasAgeConsent;var i;t&&!o&&(null===(i=this.initializeCarousel)||void 0===i||i.call(this));const{photoStripImages:s,isProductVariationInfoLoaded:n,selectedDimension:r,isAllDimensionSelected:l,hasProductUniqueSequenceID:c}=this.props,{totalUniqueImages:d,isDefaultVariationImageLoaded:a}=this.state,{images:u}=this,h=s?s.length:0;h!==d&&this.setState({totalUniqueImages:h},(()=>{if(u&&u.children&&u.addEventListener){const[e]=u.children;this.image=e,u.scrollLeft=h>1?this.image.clientWidth:0}}
1)),n&&c&&(!(0,S.yO)()||l||a||this.scrollToSelectedPic((this.props.defaultVariationImgIndex||0)+1,!0),(0,S.hS)()&&e.selectedDimension!==r&&l&&this.scrollToSelectedPic((this.props.currentVariationImgIndex||0)+1))}componentWillUnmount(){const{images:e}=this;e&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("touchmove",this.onTouchMove),e.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("mouseup",this.onMouseUp))}render(){const{photoStripImages:e,productImageAltText:t,pid:o,shouldHideActionIcons:i,shouldSetUnloadedSrc:s,overrideImageIndexWrapperStyles:n,isFullWidthSquare:d,isImageObjectFitCover:a,productImageModule:u,pdpState:h,show3DPopup:p,onImageClick:m}=this.props,{isInitialized:x,totalUniqueImages:I}=this.state;if(e){const S=e[e.length-1],C=e[0],{currentImageIndex:_}=this.state;let j=[];j=1===e.length?[(0,r.jsx)(f,{src:C.mainImgUrl,alt:"".concat(t),isFullWidthSquare:d,unloadedSrc:s?C.src:null,objectFit:a?"cover":null},C.sequenceId)]:x?[(0,r.jsx)(f,{src:S.mainImgUrl,alt:"",isFullWidthSquare:d,unloadedSrc:s?S.src:null,objectFit:a?"cover":null},-1),...e.map(((e,o)=>(0,r.jsx)(f,{src:e.mainImgUrl,alt:"".concat(t," - ").concat(o),isFullWidthSquare:d,unloadedSrc:s?e.src:null,objectFit:a?"cover":null},e.sequenceId))),(0,r.jsx)(f,{src:C.mainImgUrl,alt:"",isFullWidthSquare:d,unloadedSrc:s?C.src:null,objectFit:a?"cover":null},-2)]:[(0,r.jsx)(f,{src:C.mainImgUrl,alt:"".concat(t," - 0"),isFullWidthSquare:d,unloadedSrc:s?C.src:null,objectFit:a?"cover":null},C.sequenceId)];const P=()=>{const e={...h[o]};e.show3DPopup=!0,p(e)};return(0,r.jsxs)(g.yy,{children:[(0,r.jsx)(g.es,{children:!this.props.hasAgeConsent&&this.props.shouldRequireAgeConsent?(0,r.jsx)(g.ZP,{children:(0,r.jsx)(v.Z,{})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g.RD,{ref:this.setWrapperRef,onClick:m,children:j}),(null==u?void 0:u.ar_3d_renderer_url)&&(0,r.jsxs)("button",{style:{position:"absolute",bottom:"16px",left:"16px",borderRadius:"40px",border:"1px solid black",display:"flex",padding:"6px 8px"},onClick:P,children:[(0,r.jsx)(y.Z,{}),null==u?void 0:u.ar_3d_renderer_button_text]}),_&&I&&(0,r.jsxs)(g.ub,{style:n,children:[(0,r.jsx)(l,{overrideStyle:{padding:"0 5px 2px 0",height:"12px",width:"12px",verticalAlign:"middle"}}),"".concat(_,"/").concat(I,"\n              ")]}),(0,r.jsx)(g.IU,{})]})}),i?null:(0,r.jsx)(g.t0,{children:(0,r.jsx)(g.VE,{children:(0,r.jsx)(c.Z,{"data-testid":w.Q7.SHARE_BUTTON,pid:o})})})]})}return null}}var j=(0,s.$j)(((e,t)=>{let{pid:o}=t;return{photoStripImages:(0,a.dNJ)(e,o),productImageAltText:(0,a.zOx)(e,o),isProductVariationInfoLoaded:(0,a.HPZ)(e,o),selectedDimension:(0,a.OlN)(e,o),isAllDimensionSelected:(0,a.yMV)(e,o),defaultVariationImgIndex:(0,a.qEz)(e,o),currentVariationImgIndex:(0,a.UrZ)(e,o),hasProductUniqueSequenceID:(0,a.elp)(e,o),hasAgeConsent:(0,u.TD)(e),shouldRequireAgeConsent:(0,a.NGJ)(e,o),productImageModule:(0,m.Lm)(e,o),pdpState:(0,p.lr)(e)}}),(e=>({show3DPopup:t=>e((0,h.p)(t))})))(_)},
1"./cozy/mobile/components/product/ratingsSection/ProductReviewV2.tsx":function(e,t,o){"use strict";var i=o("./node_modules/lodash/throttle.js"),s=o.n(i),n=(o("./node_modules/core-js/modules/web.dom-collections.iterator.js"),o("./node_modules/react/index.js")),r=o("./node_modules/react-redux/es/index.js"),l=o("./cozy/coco/components/ProfilePicture/ProfilePicture.tsx"),c=o("./cozy/coco/components/RatingStars/RatingStars.tsx"),d=o("./cozy/coco/components/CountryFlag/CountryFlag.tsx"),a=o("./cozy/coco/components/Icons/PlayIcon.tsx"),u=o("./cozy/coco/components/Icons/VerifiedPurchaseCheckIcon.tsx"),h=o("./cozy/coco/components/VoteButton/VoteButton.tsx"),p=o("./node_modules/react-router/esm/react-router.js"),m=o("./node_modules/@ContextLogic/atlas-ui/dist/index.js"),x=o("./cozy/data/selectors/UserSelectors.tsx"),g=o("./cozy/utils/i18n.tsx"),v=o("./cozy/utils/logger/ReviewConsumptionLogger.tsx"),y=o("./cozy/utils/hooks/UseEventListener.tsx"),w=o("./cozy/utils/Date.tsx"),I=o("./cozy/utils/providers/UIConfigPropProvider/uiConfigProps.ts"),S=o("./cozy/utils/ClientExperimentUtils.tsx"),C=o("./cozy/mobile/styles/product/RatingsSectionV2.tsx"),f=o("./cozy/routes/RouteTesters.tsx"),_=o("./cozy/mobile/components/mobileMediaViewer/MobileMediaViewer.tsx"),j=o("./cozy/mobile/components/product/ratingsSection/MobileMediaViewerFooter.tsx"),P=o("./cozy/mobile/components/mobileMediaViewer/PhotoViewerHeader.tsx"),b=o("./cozy/data/services/AnalyticsService.tsx"),z=o("./cozy/data/actions/ProductActions.tsx"),L=o("./cozy/routes/RouteGenerators.tsx"),R=o("./cozy/data/constants/RatingConstants.tsx"),D=o("./node_modules/react/jsx-runtime.js");t.Z=(0,r.$j)((e=>({viewerID:(0,x.VN)(e),viewerLocale:(0,x.Kd)(e),viewerCountry:(0,x.so)(e)})),(e=>({removeReviewDownvote:t=>{let{ratingId:o,productId:i}=t;return e((0,z.removeReviewDownvote)({ratingId:o,productId:i}))},removeReviewUpvote:t=>{let{ratingId:o,productId:i}=t;return e((0,z.removeReviewUpvote)({ratingId:o,productId:i}))},upvoteReview:t=>{let{ratingId:o,productId:i}=t;return e((0,z.upvoteReview)({ratingId:o,productId:i}))},downvoteReview:t=>{let{ratingId:o,productId:i}=t;return e((0,z.downvoteReview)({ratingId:o,productId:i}))}})))((e=>{let{productId:t,rating:o,removeReviewDownvote:i,removeReviewUpvote:r,upvoteReview:x,downvoteReview:z,overrideReviewStyle:B,overrideRatingStarsStyle:T,overrideRatingStarsColour:E,overrideProfileImageLinkStyle:Z,profilePictureDimenstion:M,overrideReviewHeaderTopStyle:A,overrideReviewHeaderNameStyle:W,shouldHideReviewDate:U,shouldHideReviewHeaderBottom:k,overrideReviewTextStyle:H,shouldHideBottomSection:O,overrideReviewTextLineClamp:V,onClickProfileImage:N,position:q,viewerID:F,viewerCountry:X,viewerLocale:G,reviewExpand:Y,handleReviewExpand:K,reviewPosition:$,module:Q}=e;const J=(0,p.TH)(),ee=(0,f.hjc)(J),te=(0,n.useRef)(null),[oe,ie]=(0,n.useState)(!1),[se,ne]=(0,n.useState)(),[re,le]=(0,n.use
1State)(),[ce,de]=(0,n.useState)(!1),[ae,ue]=(0,n.useState)(!1),{id:he,user:{profile_pic_small:pe,short_name:me,country_code:xe,id:ge,signup_date:ve},author_reviews:ye,author_uploads:we,rating:Ie,size:Se,color:Ce,image_large_url:fe,image_thumbnail_url:_e,upvote_count:je,user_upvoted:Pe,downvote_count:be,user_downvoted:ze,comment:Le,time:Re}=o,De=(0,n.useMemo)((()=>new Date(ve).getFullYear()),[ve]),Be=s()((()=>{if(te.current&&!oe&&window.scrollY+window.innerHeight>te.current.offsetTop){const e=_e?v.oZ.PHOTO:v.oZ.TEXT;(0,v.db)(e,{user_id:F,product_id:t,review_id:he,reviewer_id:ge,star_rating:Ie,rank:q,comment:Le,user_country:X,user_locale:G,reviewer_country:xe,action:v.KW.IMPRESSION,position:ee?v.Rz.RATING_PAGE:v.Rz.PRODUCT_PAGE},!1),ie(!0)}}),v.aW);(0,y.Z)("scroll",Be);const Te=[];return(0,D.jsxs)(C.Cq,{ref:te,style:B,children:[(0,D.jsxs)(C.bs,{children:[(0,D.jsxs)(C.Sr,{children:[(0,D.jsx)(C.ay,{to:(0,L.S4)(ge),style:Z,onClick:N,children:(0,D.jsx)(l.Z,{image:pe,dimensions:M||40,name:null==me?void 0:me.slice(0,1)})}),(0,D.jsxs)(C.oe,{children:[(0,D.jsxs)(C.td,{style:A,children:[(0,D.jsxs)(C.zq,{children:[(0,D.jsx)(C.u8,{style:W,children:me}),!U&&(0,D.jsx)(C.rp,{children:(0,w.cc)(Re,!0)})]}),(0,D.jsx)(c.Z,{ratingScore:Ie,overrideStyle:T,colorFull:E})]}),!k&&(0,D.jsxs)(C.tZ,{children:[(0,D.jsx)(d.ZP,{countryCode:xe,overrideStyle:{height:12,width:"unset",margin:"1px 4px 0px 0px"}}),[(0,g.ag)("Joined {%1=year joined}",De),null==ye?void 0:(0,g.bk)(ye,"{%1=number of reviews} review","{%1=number of reviews} reviews"),null==we?void 0:(0,g.bk)(we,"{%1=number of uploads} upload","{%1=number of uploads} uploads")].filter((e=>void 0!==e)).reduce(((e,t,o)=>0===o?[t]:[...e,"·",t]),[]).map((e=>(0,D.jsx)(C.BF,{children:e})))]})]}),ae&&Q===R.HT&&(0,S.bX)()&&(0,D.jsx)(m.Icon,{onClick:()=>K&&K(null!=$?$:null,$!==(null==Y?void 0:Y.index)||!(null!=Y&&Y.status)),name:$===(null==Y?void 0:Y.index)&&null!=Y&&Y.status?"chevronDownLarge":"chevronUpLarge",size:"small"})]}),(0,D.jsx)(C.lb,{style:H,overrideLineClamp:V,isExpanded:!($!==(null==Y?void 0:Y.index)||null==Y||!Y.status),ref:e=>{if(!e)return;const t=(e=>{const t=getComputedStyle(e),o=parseFloat(t.width),i=document.createElement("canvas").getContext("2d");i&&(i.font="".concat(t.fontSize," ").concat(t.fontFamily));const s=null==i?void 0:i.measureText(e.innerText);return s&&s.width/(V||4)>o})(e);t&&ue(t)},children:Le})]}),!O&&(0,D.jsxs)(C.$B,{children:[(null!=fe&&null!=_e||Te.length>0)&&(0,D.jsxs)(C.QB,{children:[Te.map((e=>{let{src:o,thumbnailSmall:i,thumbnailLarge:s}=e;return(0,D.jsxs)(C.EQ,{size:C.Zd,children:[(0,D.jsx)(C.oH,{children:(0,D.jsx)(a.Z,{})}),(0,D.jsx)(C.qN,{src:i,size:C.Zd,onClick:()=>(e=>{let{src:o,thumbnail:i}=e;le({src:o,thumbnail:i}),(0,b.y)("CLICK_RATING_PHOTO"),(0,v.db)(v.oZ.VIDEO,{user_id:F,product_id:t,review_id:he,reviewer_id:ge,star_rating:Ie,rank:q,comment:Le,user_country:X,user_locale:G,reviewer_country:xe,action:v.KW.CLICK,position:ee?v.Rz.RATING_PAGE:v.Rz.PRODUCT_PAGE},!1)})({src:o,thumbnail:s})})]})})),null!=fe&&null!=_e&&(0,D.jsx)(C.qN,{src:_e,size:C.Zd,onClick:()=>(ne(fe),(0,b.y)("CLICK_RATING_PHOTO"),void(0,v.db)(v.oZ.PHOTO,{user_id:F,product_id:t,review_id:he,reviewer_id:ge,star_rating:Ie,rank:q,comment:Le,user_country:X,user_locale:G,reviewer_country:xe,action:v.KW.CLICK,position:ee?v.Rz.RATING_PAGE:v.Rz.PRODUCT_PAGE},!1))})]}),(0,D.jsxs)(C.av,{children:[[null==Se?void 0:(0,g.ag)("Size: {%1=name of size}",Se),null==Ce?void 0:(0,g.ag)("Color: {%1=name of color}",Ce)].filter((e=>void 0!==e)).reduce(((e,t)=>[...e,t,"|"]),[]).map((e=>(0,D.jsx)(C.uq,{children:e}))),(0,D.jsxs)(C.s,{children:[(0,D.jsx)(u.Z,{}),(0,D.jsx)(C.uq,{children:(0,g.et)("Wish has verified this review author purchased the product","Verified Purchase")})]})]}),(0,D.jsxs)(C.lu,{children:[(0,D.jsx)(h.Z,{selected:Pe,onClick:async()=>{ce||(de(!0),Pe?await r({ratingId:he,productId:t}):await x({ratingId:he,productId:t}),de(!1))},type:h.o.UPVOTE,buttonText:(0,g.et)("The review was helpful","Helpful"),voteCount:je}),(0,D.jsx)(h.Z,{selected:ze,onClick:async()=>{ce||(de(!0),ze?await i({ratingId:he,productId:t}):await z({ratingId:he,productId:t}),de(!1))}
1,type:h.o.DOWNVOTE,buttonText:(0,g.et)("The review was not helpful","Not helpful"),voteCount:be})]}),void 0!==se&&(0,D.jsx)(_.Z,{maxMediaHeight:"calc(100vh - ".concat(I.d.mobileMediaViewerFooterCollapsedHeight,"px)"),imageUrl:se,onClose:()=>ne(void 0),headerComponent:(0,D.jsx)(P.Z,{uid:ge,name:me,profilePicture:pe,hasProfilePicture:null!=pe}),footerComponent:(0,D.jsx)(j.Z,{ratingScore:o.rating,size:o.size,color:o.color,upvoteCount:o.upvote_count,userUpvoted:o.user_upvoted,downvoteCount:o.downvote_count,userDownvoted:o.user_downvoted,comment:o.comment,pid:t,removeReviewDownvote:()=>i({ratingId:he,productId:t}),removeReviewUpvote:()=>r({ratingId:he,productId:t}),upvoteReview:()=>x({ratingId:he,productId:t}),downvoteReview:()=>z({ratingId:he,productId:t})})}),void 0===se&&void 0!==re&&(0,D.jsx)(_.Z,{maxMediaHeight:"calc(100vh - ".concat(I.d.mobileMediaViewerFooterCollapsedHeight,"px)"),videoUrl:re.src,videoThumbnailUrl:re.thumbnail,onClose:()=>le(void 0),headerComponent:(0,D.jsx)(P.Z,{uid:ge,name:me,profilePicture:pe,hasProfilePicture:null!=pe}),footerComponent:(0,D.jsx)(j.Z,{ratingScore:o.rating,size:o.size,color:o.color,upvoteCount:o.upvote_count,userUpvoted:o.user_upvoted,downvoteCount:o.downvote_count,userDownvoted:o.user_downvoted,comment:o.comment,pid:t,removeReviewDownvote:()=>i({ratingId:he,productId:t}),removeReviewUpvote:()=>r({ratingId:he,productId:t}),upvoteReview:()=>x({ratingId:he,productId:t}),downvoteReview:()=>z({ratingId:he,productId:t})})})]})]},he)}))}
1}]);
2//# sourceMappingURL=cozy_mobile_components_product_browsy_Browsy_tsx.becc62a01dc35d319928.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.