"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1333],{79512:function(e,t,o){o.d(t,{O:function(){return s},W:function(){return p}});var r=o(35944);o(67294);var a=o(99914),i=o(90762),n=o(76318);let l=o(87379).ZP.div.withConfig({componentId:"sc-ee959cfc-0"})([""]),s=e=>{let{customDataProps:t,wrapperProps:o,pages:n=[],...s}=e,d=p(n);return(0,r.tZ)(i.xu,{...o,children:(0,r.tZ)(l,{...t,children:(0,r.tZ)(a.L,{...s,pages:d})})})},p=e=>{let t=(0,n.U)();return e.map(e=>({dataEventCategory:"Ecommerce",dataEventAction:"Breadcrumb Click",dataEventLabel:t,...e}))}},17321:function(e,t,o){o.d(t,{ql:function(){return d},o2:function(){return p},_2:function(){return r._},Xg:function(){return a.X},oc:function(){return c}});var r=o(9268),a=o(10877),i=o(35944);o(67294);var n=o(11163),l=o(3527),s=o(54479);let p=e=>{let{children:t,pageTitle:o,SEOData:a,customHead:p}=e,{locale:d="vi-VN"}=(0,n.useRouter)(),{isDesktop:c}=s.v3.useDevice(),u=(0,l.x)();return(0,i.tZ)(r._,{locale:d,showStickyBottomMenu:!1,headerProps:{topBarProps:{backProps:{visible:!0,onClick:u},titleProps:{visible:!0,content:o},cartProps:{visible:!0},searchProps:{visible:!0},rightKebabProps:{visible:!0},hasBorder:!0},showSearchBar:c},SEOData:a,customHead:p,children:t})},d=e=>{let{children:t,pageTitle:o,SEOData:a,customHead:p}=e,{locale:d="vi-VN"}=(0,n.useRouter)(),{isDesktop:c}=s.v3.useDevice(),u=(0,l.x)();return(0,i.tZ)(r._,{locale:d,showStickyBottomMenu:!1,headerProps:{topBarProps:{backProps:{visible:!0,onClick:u},titleProps:{visible:!0,content:o},cartProps:{visible:!0},searchProps:{visible:!0},rightKebabProps:{visible:!0},hasBorder:!0},showSearchBar:c},SEOData:a,customHead:p,children:t})},c=e=>{let{children:t,pageTitle:o,SEOData:a,customHead:l,onBack:p}=e,{locale:d="vi-VN"}=(0,n.useRouter)(),{isDesktop:c}=s.v3.useDevice();return(0,i.tZ)(r._,{locale:d,headerProps:{topBarProps:{backProps:{visible:!0,onClick:p},titleProps:{visible:!0,content:o},cartProps:{visible:!1},searchProps:{visible:!1},rightKebabProps:{visible:!0},hasBorder:!0},showSearchBar:c},SEOData:a,customHead:l,showStickyBottomMenu:!0,bottomBarProps:{defaultMenuItemType:"profile"},children:t})}},10877:function(e,t,o){o.d(t,{X:function(){return s}});var r=o(35944);o(67294);var a=o(11163),i=o(90762),n=o(54479),l=o(9268);let s=e=>{let{children:t,pageTitle:o,SEOData:s,customHead:p,bottomMenuDefault:d}=e,{locale:c="vi-VN"}=(0,a.useRouter)(),{isMobile:u}=n.v3.useDevice();return(0,r.tZ)(l._,{locale:c,showStickyBottomMenu:!0,headerProps:{logoComponent:u&&o?(0,r.tZ)(i.X6,{tag:"h5",as:"h1",weight:"bold",wordWrap:"none",children:o}):void 0},bottomBarProps:{defaultMenuItemType:d},SEOData:s,customHead:p,children:t})}},69986:function(e,t,o){o.d(t,{S:function(){return a}});var r=o(54479);let a={getPromotionsList:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{page:"1",perPage:"5"};return r.GH.callApi({to:"ecom",path:"GET_PROMOTIONS",method:"GET",params:{page:String(e.page),perPage:String(e.perPage)}})},getPromotions:function(e){let{params:t}=e||{};return r.GH.callApi({to:"ecom",path:"GET_PROMOTIONS_PAGE",method:"GET",params:t})},getPromotionDetail:e=>r.GH.callApi({to:"ecom",path:"GET_PROMOTION_DETAIL",method:"GET",params:{slug:e}}),getVoucherByStatus:function(e){let{params:t}=e||{};return r.GH.callApiWithAuth({to:"ecom",path:"GET_VOUCHER_LIST_BY_STATUS",method:"GET",params:t})}}},3527:function(e,t,o){o.d(t,{x:function(){return n}});var r=o(67294),a=o(11163),i=o(54479);let n=()=>{let e=(0,a.useRouter)(),{back:t}=e,o=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{let e=()=>{o.current=!0};return window.addEventListener("beforeunload",e),()=>{o.current=!0,window.removeEventListener("beforeunload",e)}},[]),(0,r.useEffect)(()=>{o.current=!0,setTimeout(()=>{o.current=!1},700)},[e.asPath]),()=>{t(),setTimeout(()=>{o.current||e.push(i.zM.getNewRelativeURL("","shop").toString())},500)}}},91333:function(e,t,o){o.r(t),o.d(t,{__N_SSP:function(){return w},default:function(){return E}});var r=o(35944),a=o(30118),i=o(67294),n=o(37065),l=o(90762),s=o(79512),p=o(69986),d=o(54479),c=o(330),u=o(28220),g=o(41664),m=o.n(g),h=o(87379);let v=h.ZP.div.withConfig({componentId:"sc-7ee43285-0"})(["","{padding-bottom:24px;}","{padding:0px;}","{background:",";padding-top:24px;padding-bottom:40px;}.brand-list-pagination{margin:16px auto 0;justify-content:center;}"],u.M.tdOnly,u.M.mbDown,u.M.tdUp,e=>{let{theme:t}=e;return t.colors.neutral50}),b=h.ZP.div.withConfig({componentId:"sc-7ee43285-1"})(["display:grid;grid-gap:16px 16px;grid-template-columns:repeat( ",",1fr );padding:20px;background:",";border-radius:8px;margin-top:16px;","{margin-top:0;}","{grid-gap:12px 12px;padding:24px;}","{grid-gap:12px 8px;grid-template-columns:repeat(1,1fr);}"],e=>e.col||5,e=>{let{theme:t}=e;return t.colors.white},u.M.tdDown,u.M.tdOnly,u.M.mbDown),f=(0,h.ZP)(m()).withConfig({componentId:"sc-7ee43285-2"})(["cursor:pointer;min-width:0;.image-box-wrapper{width:100%;padding-top:100%;height:0;position:relative;}.image-box{width:100%;height:100%;object-fit:cover;border-radius:4px;position:absolute;top:0;left:0;}.box-text{display:flex;flex-direction:column;> span{line-height:24px;margin-top:0px;&:first-child{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}}}","{display:grid;grid-template-columns:64px auto;grid-template-rows:unset;grid-gap:12px 12px;position:relative;padding:12px 0px;&:first-child{padding-top:0;}.image-box-wrapper{width:64px;}.box-text{max-height:auto !important;> span{line-height:24px;margin-top:0px !important;}}&:before{content:'';border-bottom:1px solid ",";width:calc(100% - 10px);position:absolute;top:-8px;left:50%;transform:translateX(-50%);}&:first-child:before{display:none;}}"],u.M.mbDown,e=>e.theme.colors.neutral100),x=e=>{let{customDataProps:t,promotions:o,pagination:a}=e,u=d.D1.useTranslation(),{query:g,replace:m,pathname:h}=d.zM.useRouter(),{isTablet:x,isDesktop:P}=d.v3.useDevice(),[w,E]=(0,i.useState)(!1),[S,M]=(0,i.useState)(null!=o?o:[]),[T,O]=(0,i.useState)(a||{}),Z=(null==T?void 0:T.current)||1,y=[{label:u({id:"breadcrumb.home",defaultMessage:"Trang chủ"}),value:d.zM.getNewRelativeURL("","shop").toString()},{label:u({id:"breadcrumb.promotions",defaultMessage:"promotions"}),value:d.zM.getLocalisedUrl("","PROMOTION").toString()}],D=(0,i.useRef)(!0);return(0,i.useEffect)(()=>{D.current?D.current=!1:(D.current=!1,(async()=>{E(!0);let e=Number(g.page)||1,t=await p.S.getPromotions({params:{page:e,perPage:15}});if(null==t?void 0:t.data){var o,r,a,i;(null===(o=t.data.items)||void 0===o?void 0:o.length)||1===e?(M((null===(a=t.data)||void 0===a?void 0:null===(r=a.items)||void 0===r?void 0:r.map(d.lZ.formatPromotion).filter(c.$K))||[]),O(d.lZ.formatPagination(null===(i=t.data)||void 0===i?void 0:i.pagination)||{current:Number(g.page)||1})):m({pathname:h,query:{...g,page:1}})}E(!1)})())},[g.page]),(0,r.BX)(v,{"data-loading":w,...t,children:[(0,r.tZ)("div",{className:"page-breadcrumbs-wrapper",children:(0,r.tZ)(l.EW,{noGutter:!P,children:(0,r.tZ)(s.O,{pages:y,size:"md"})})}),(0,r.BX)(l.EW,{noGutter:!P,children:[P&&(0,r.tZ)(l.X6,{tag:"h5",wrapperProps:{style:{textTransform:"uppercase",marginTop:16}},children:u({id:"breadcrumb.promotions",defaultMessage:"Promotions"})}),(0,r.BX)(b,{"data-loading":w,col:x?4:5,children:[S.map((e,t)=>(0,r.BX)(f,{href:d.zM.getLocalisedUrl(e.slug||"","PROMOTION").toString(),"data-event-category":"Ecommerce","data-event-action":"Promotion Detail Click","data-event-label":d.zM.getLocalisedUrl(e.slug||"","PROMOTION").toString(),children:[(0,r.tZ)("div",{className:"image-box-wrapper",children:(0,r.tZ)(l.E9,{className:"image-box",src:e.thumbnail,alt:e.name})}),(0,r.BX)("div",{className:"box-text",children:[(0,r.tZ)(l.xv,{size:"p3",weight:"bold",colour:"gray800",customDataProps:{style:{marginTop:P?16:8}},children:e.name}),e.expiredDate&&(0,r.BX)(l.xv,{size:"p3",colour:"gray600",customDataProps:{style:{marginTop:P?4:8}},children:[u({id:"promotions.expiredDate",defaultMessage:"ExpiredDate"})," ",e.expiredDate]})]})]},t)),w&&(0,r.tZ)(l.zx,{className:"category-product-loading",size:"lg",isLoading:!0,color:"ghost"})]}),1!==T.last&&(0,r.tZ)(n.t,{className:"brand-list-pagination",total:(null==T?void 0:T.last)||1,value:Z,onChange:e=>!w&&m({pathname:h,query:{...g,page:e}},void 0,{shallow:!0})})]})]})};var P=o(17321),w=!0,E=e=>{let{navigation:t,promotions:o,defaultProductsListingPagination:i,canonicalUrl:n}=e,l=d.D1.useTranslation();return(0,r.tZ)(P.o2,{navigation:t,pageTitle:l({id:"breadcrumb.promotions",defaultMessage:"Promotions"}),SEOData:{canonicalUrl:n},children:(0,r.tZ)(a.Z,{children:(0,r.tZ)(x,{promotions:o||[],pagination:i})})})}}}]);