(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9188],{34292:function(e,t,i){"use strict";var s=i(16683),n=i(67294),r=i(83393),a=i(93914),d=i(53414);t.Z=function(e){let{appState:t}=(0,n.useContext)(s.H),{clientSideApi:i}=(0,r.Z)(),[o,c]=(0,n.useState)(e),{handleLogin:l}=(0,d.Z)(),u=async s=>{var n;if(s.preventDefault(),!t.loggedInUser){l();return}c(e=>({...e,isUserFav:!e.isUserFav,favoriteCount:e.isUserFav?e.favoriteCount-1:e.favoriteCount+1})),i.userFavoriteItemControllerToggle({userId:null===(n=t.loggedInUser)||void 0===n?void 0:n.id,discountId:e.id})},C=async s=>{if(s.preventDefault(),!t.loggedInUser){l();return}c(e=>({...e,isUserLike:!e.isUserLike,likeCount:e.isUserLike?e.likeCount-1:e.likeCount+1})),i.userLikeControllerToggle({discountId:e.id,userId:t.loggedInUser.id},{headers:(0,a.p)()})},x=async()=>{},h=async()=>{await i.discountControllerUpdateReadCount(o.id)};return(0,n.useEffect)(()=>{c(e)},[e]),{discount:o,clickDiscountFavButton:u,clickDiscountLikeButton:C,clickDiscountWechatShareButton:x,updateDiscountReadCount:h}}},59229:function(e,t,i){"use strict";i.d(t,{k:function(){return j}});var s=i(85893),n=i(91592),r=i(10864),a=i.n(r),d=i(3313),o=i(92718),c=i(41664),l=i.n(c),u=i(64533),C=i(62246),x=i(67294),h=i(16683),v=i(11434),m=i(34292),_=i(54462);let j=e=>{var t,i;let{discount:r,showFavBtn:c=!0}=e,{appState:j}=(0,x.useContext)(h.H),{discount:f,clickDiscountFavButton:p}=(0,m.Z)(r);return(0,s.jsxs)("div",{"data-testid":"DiscountCard",className:"".concat(a().discountCard," relative"),children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(l(),{onClick:()=>{(0,_.r)("Link click Discount Card",{discount:r})},href:"/discounts/detail/".concat(r.slug),children:(0,s.jsx)(n.Z,{src:null===(t=r.featureImage)||void 0===t?void 0:t.src,width:0,height:0,className:a().discountCardImage})}),f.category===u.o0.Advertisement?(0,s.jsx)("div",{className:a().imgCategory,children:"广告"}):null]}),(0,s.jsxs)("div",{className:a().discountCardContent,children:[(0,s.jsxs)("div",{className:a().discountCardTopSection,children:[(0,s.jsx)(l(),{onClick:()=>{(0,_.r)("Link click discount Card Top Section",{discount:r})},href:"/discounts/detail/".concat(r.slug),children:(0,s.jsx)(d.x,{variant:"Title4",textColor:"Dark",truncate:!0,children:r.title})}),(0,s.jsxs)("div",{className:a().discountCardSubTitle,children:[r.salesPrice&&(0,s.jsx)(d.x,{variant:"Title4",textColor:"Red",bold:"600",children:"$".concat(r.salesPrice.toFixed(2))}),r.regularPrice&&(0,s.jsx)(d.x,{variant:"Title4",textColor:"Light",bold:"600",className:"line-through",children:"$".concat(r.regularPrice.toFixed(2))}),!r.salesPrice&&r.discountDescription&&(0,s.jsx)(d.x,{variant:"Title4",textColor:"Red",bold:"600",children:"".concat(r.discountDescription)})]})]}),(0,s.jsxs)("div",{className:a().discountCardMidSection,children:[(0,s.jsx)("div",{className:a().discountCardFeatures,children:null===(i=r.discountTags)||void 0===i?void 0:i.map(e=>(0,s.jsx)(l(),{onClick:()=>{},href:"/discounts/".concat(e.name),className:a().discountCardFeature,"data-testid":"discountcard-test-id",children:(0,s.jsxs)(d.x,{variant:"Small",children:[" ",e.name," "]})},e.id))}),r.description&&(0,s.jsxs)("div",{children:[(0,s.jsx)(d.x,{variant:"Small",className:a().discountCardDescription,children:r.description}),(0,s.jsx)(l(),{onClick:()=>{},href:"/discounts/detail/".concat(r.slug),children:(0,s.jsx)(d.x,{variant:"Small",className:a().discountDescriptionText,textColor:"Red",children:"阅读全文"})})]})]}),(0,s.jsxs)("div",{className:a().discountCardBottomSection,children:[(0,s.jsxs)(d.x,{variant:"Small",textColor:"Light",children:["有效期：",(0,C.A8)(r.validStartDate),"-",(0,C.A8)(r.validEndDate)]}),(0,s.jsxs)("div",{className:a().discountCardFavComments,children:[c?(0,s.jsxs)("div",{className:a().discountCardFavComment,children:[(0,s.jsx)(v.Z,{isFav:f.isUserFav,onClickFavButton:p}),(0,s.jsxs)(d.x,{variant:"Small",children:[r.favoriteCount," "]})]}):(0,s.jsx)(s.Fragment,{}),j.appConfig.discountComment&&(0,s.jsxs)("div",{className:a().discountCardFavComment,children:[(0,s.jsx)(n.Z,{src:o.ep,height:14,width:14}),(0,s.jsxs)(d.x,{variant:"Small",children:[r.commentCount," "]})]})]}),r.discountProductUrl&&(0,s.jsx)(l(),{onClick:()=>{},href:r.discountProductUrl,target:"_blank",className:a().discountNewLink,children:(0,s.jsx)(d.x,{textColor:"White",children:"去购买 "})})]})]}),(null==r?void 0:r.rank)&&(0,s.jsx)("div",{className:"absolute right-1 top-1 bg-red-600 px-3 py-[2px] font-PingFangSC text-sm text-white",children:"置顶"})]})}},2381:function(e,t,i){"use strict";i.d(t,{c:function(){return l}});var s=i(85893),n=i(41664),r=i.n(n),a=i(3313),d=i(9602),o=i.n(d),c=i(54462);let l=e=>{let{children:t,title:i,titleProps:n,seeMore:d,href:l,Icon:u,seeMoreTextProps:C,classNameContent:x}=e;return n={variant:"Title",textColor:"Dark",bold:"600",...n},C={textColor:"Blue",bold:"500",...C},(0,s.jsxs)("div",{"data-testid":"TitleCard",className:o().TitleCard,children:[(0,s.jsxs)("div",{className:o().cardTop,children:[(0,s.jsxs)("div",{className:o().titleWrapper,children:[u&&u,(0,s.jsx)(a.x,{...n,children:i})]}),d&&l&&(0,s.jsx)(r(),{onClick:()=>{(0,c.r)("Link click see More Text",{seeMore:d})},href:l,children:(0,s.jsx)(a.x,{...C,children:"查看更多"})})]}),(0,s.jsx)("div",{className:" ".concat(x||o().cardContent),children:t})]})}},35272:function(e,t,i){"use strict";var s=i(85893),n=i(67294),r=i(58533);t.Z=e=>{let{children:t,hasMore:i,loader:a,dataLength:d,next:o,refreshFunction:c,className:l}=e,[u,C]=(0,n.useState)(1),x=(0,n.useCallback)(()=>{C(e=>e+1)},[]),h=(0,s.jsx)("p",{style:{textAlign:"center"},children:(0,s.jsx)("b",{children:"Yay! You have seen it all"})});return(0,s.jsx)(r.Z,{next:()=>{o(u),x()},hasMore:i,loader:a,dataLength:d,endMessage:h,pullDownToRefresh:!0,pullDownToRefreshThreshold:50,pullDownToRefreshContent:(0,s.jsx)("h3",{style:{textAlign:"center"},children:"↓ Pull down to refresh"}),releaseToRefreshContent:(0,s.jsx)("h3",{style:{textAlign:"center"},children:"↑ Release to refresh"}),refreshFunction:()=>{c(),C(1)},style:{width:"100%"},className:l,"data-testid":"custominfinitescrollwithpulltorefresh-test-id",children:t})}},11434:function(e,t,i){"use strict";i.d(t,{Z:function(){return a}});var s=i(85893),n=i(3313),r=i(41392);function a(e){let{isFav:t,onClickFavButton:i,width:a=22,height:d=22,variant:o="mobile",bottomText:c,rightText:l}=e,u="";return"desktop"===o&&(u="flex justify-center h-10 item-center"),l&&(u="flex items-center"),(0,s.jsxs)("div",{"data-testid":"FavButton",onClick:i,className:u,children:[(0,s.jsx)(r.Y,{width:a,height:d,isActive:t}),l&&(0,s.jsx)("div",{className:"ml-1 mt-1",children:(0,s.jsx)(n.x,{className:"text-center",variant:"Small",textColor:"Default",noWrap:!0,children:l})}),c&&(0,s.jsx)("div",{children:(0,s.jsx)(n.x,{className:"text-center",variant:"Small",textColor:"Dark",noWrap:!0,children:c})})]})}},52707:function(e,t,i){"use strict";function s(e){return void 0===e?void 0:"string"==typeof e?[e]:Array.isArray(e)&&e.length>0?e:void 0}i.d(t,{Q:function(){return s}})},10864:function(e){e.exports={discountCard:"DiscountCard_discountCard__M4Hge",discountCardImage:"DiscountCard_discountCardImage__nAZn7",imgCategory:"DiscountCard_imgCategory__hy99a",discountCardContent:"DiscountCard_discountCardContent__TvqBX",discountCardTopSection:"DiscountCard_discountCardTopSection__u2SmR",discountCardSubTitle:"DiscountCard_discountCardSubTitle__X8QyN",discountCardMidSection:"DiscountCard_discountCardMidSection__COyWa",discountCardFeatures:"DiscountCard_discountCardFeatures__SJ0lu",discountCardFeature:"DiscountCard_discountCardFeature__738l3",discountCardDescription:"DiscountCard_discountCardDescription__ZOYqM",discountDescriptionText:"DiscountCard_discountDescriptionText__q6hER",discountCardBottomSection:"DiscountCard_discountCardBottomSection__4auPV",discountCardFavComments:"DiscountCard_discountCardFavComments__FQSvs",discountCardFavComment:"DiscountCard_discountCardFavComment__Y89x_",discountNewLink:"DiscountCard_discountNewLink__dmkVj"}},9602:function(e){e.exports={TitleCard:"TitleCard_TitleCard__bUuzH",cardTop:"TitleCard_cardTop__e1spF",titleWrapper:"TitleCard_titleWrapper__f2Ahp",seeMore:"TitleCard_seeMore__cXC_V",cardContent:"TitleCard_cardContent__yeZKC"}}}]);