1import{l as b,A as l,r as x,S as E}from"./index.a592fd0f.1791468856214.js";import{j as A,k as P}from"./staticContentModules.67d7c02e.1791468856214.js";import{S as $}from"./index.f9422d19.1791468856214.js";import{r as k,u as y}from"./agentation.68356e44.1791468856214.js";import{f as F}from"./floatingNotification.action.e8693b1d.1791468856214.js";import"./index.2815c6b3.1791468856214.js";import"./index.c060afc9.1791468856214.js";import"./index.665864a1.1791468856214.js";import"./floatingNotification.constant.27687fe7.1791468856214.js";const G="_floatingNotificationContainer_sdb0w_1",M="_innerContainer_sdb0w_1",R="_floatingContent_sdb0w_1",T="_left_sdb0w_5",W="_right_sdb0w_8",D="_closeIcon_sdb0w_11",U="_floatingImage_sdb0w_19",V="_desc_sdb0w_27",z="_ctaButton_sdb0w_50",B="_noImage_sdb0w_70",O="_svgCloseIcon_sdb0w_74",H="_carouselWrapper_sdb0w_78",a={floatingNotificationContainer:G,innerContainer:M,floatingContent:R,left:T,right:W,closeIcon:D,floatingImage:U,desc:V,ctaButton:z,noImage:B,svgCloseIcon:O,carouselWrapper:H},rt=({pathname:o})=>{const s=k.useHistory(),{floatingNotification:r,setFloatingNotification:n}=X({pathname:o}),e=b.useSelector(t=>t.language),c=b.useDispatch();if(!(r.length>0))return;const d=({parentId:t,childId:g,displayFrequency:i,displayFrequencyType:f})=>{n(p=>p.map(m=>m.id===t?{...m,floatingNotifications:m.floatingNotifications.map(_=>({..._,floatingNotificationContents:_.floatingNotificationContents.filter(h=>h.id!==g)}))}:m)),P(g,f,i)},u=t=>{let g=e.countryLanguageKey&&e.countryLanguageKey.toLowerCase().replace("_","-");if(t&&t.redirectUrl&&t.urlOpenIn)if(t.urlOpenIn==="CURRENT_PAGE"){let i=t.redirectUrl,f=window.location.protocol+"//"+window.location.hostname+"/"+g;i.includes(f)&&(i=i.replace(f,"")),t.isAllowConversion&&t.isAllowConversion===!0?(s.push(i),c(F.storeFloatingNotificationId(t.floatingNotificationId))):s.push(i)}else t.isAllowConversion&&t.isAllowConversion===!0?window.open(t.redirectUrl+"?floatingNotificationId="+t.floatingNotificationId,"_blank"):window.open(t.redirectUrl,"_blank")};return l.jsx("div",{className:a.floatingNotificationContainer,children:r.map(({floatingNotifications:t,displayFrequencyType:g,displayFrequency:i,notificationType:f,displayNotification:p,id:m})=>{const _=p==="SLIDING",h=t?.[0]?.floatingNotificationContents?.[0]?.horizontalPosition==="LEFT",w=t?.[0]?.floatingNotificationContents?.[0]?.verticalPosition,C=t?.length<=1;return l.jsx(Y,{isSlider:_,isLeft:h,topPosition:w,onlyOneNotification:C,displayFrequencyType:g,displayFrequency:i,notificationType:f,floatingNotifications:t,handleFloatingOnClose:d,floatingOnClick:u},m)})})},N=(o="")=>o.replace(/\/$/,"")||"/home",K=(o,s)=>{const r=N(s);return o.map(n=>({...n,match:r===N(n.displayPage)||r.startsWith(`${N(n.displayPage)}/`)})).filter(n=>n.match).sort((n,e)=>e.displayPage.length-n.displayPage.length)},X=({pathname:o})=>{const[s,r]=x.useState([]),n=b.useSelector(e=>e.user.isLogin);return x.useEffect(()=>{let e=!1;return(async()=>{try{const c=await A();if(e)return;const d=K(c,o);r(d)}catch(c){e||(r([]),console.error(c))}})(),()=>{e=!0}},[o,n]),{floatingNotification:s,setFloatingNotification:r}},J=(o,s)=>{s==="NEW_PAGE"?window.open(o):window.location.href=o},Q={IMAGE_AND_TEXT:["text","image"],TEXT:["text"],IMAGE:["image"]},I=(o,s)=>Q[o]?.includes(s)||!1,Y=({isSlider:o,isLeft:s,topPosition:r,onlyOneNotification:n,displayFrequencyType:e,displayFrequency:c,notificationType:d,floatingNotifications:u,handleFloatingOnClose:t,floatingOnClick:g})=>{const{t:i}=y("liteFloatingNotification");return o?l.jsx("div",{className:`${a.carouselWrapper} ${s?a.left:a.right}`,style:{top:`${r}%`||"unset"},children:l.jsx($,{lazyLoad:"ondemand",autoplay:window.portalSettings?.rewardPopup?.sliderSettings?.autoplay??!1,infinite:!n,autoplaySpeed:3e3,speed:1200,arrows:!1,slidesToShow:1,children:j({floatingNotifications:u,handleFloatingOnClose:t,t:i,notificationType:d,displayFrequency:c,displayFrequencyType:e,floatingOnClick:g})})}):j({floatingNotifications:u,handleFloatingOnClose:t,t:i,notificationType:d,displayFrequency:c,displayFrequencyType:e,floatingOnClick:g})},j=({floatingNotifications:o,handleFloatingOnClose:s,t:r,notificationType:n,displayFrequency:e,displayFrequencyType:c,floatingOnClick:d})=>Array.isArray(o)&&o.map(({floatingNotificationContents:u,floatingNotificationSettingId:t},g)=>l.jsx("div",{className:a.innerContainer,children:u.map(({id:i,content:f,ctaButtonType:p,horizontalPosition:m,imagePath:_,verticalPosition:h,redirectUrl:w,urlOpenIn:C,isAllowConversion:v,floatingNotificationId:S})=>{const L=m==="LEFT";return l.jsxs("div",{className:`${a.floatingContent} ${L?a.left:a.right}
1`,style:{top:`${h}%`||"unset"},children:[window.portalSettings?.rewardPopup?.isSVGCloseIcon?l.jsx(E,{category:"SVGTransfer",name:"D-closebtn",className:a.svgCloseIcon,onClick:()=>s({parentId:t,childId:i,displayFrequencyType:c,displayFrequency:e})}):l.jsxs("picture",{children:[l.jsx("source",{src:"/public/html/images/sp2lite/shared/cross.webp",type:"image/webp"}),l.jsx("img",{className:a.closeIcon,src:"/public/html/images/sp2lite/shared/cross.png",alt:"modal-close",role:"button",onClick:()=>s({parentId:t,childId:i,displayFrequencyType:c,displayFrequency:e})})]}),I(n,"image")&&l.jsx("img",{className:a.floatingImage,src:_,onClick:()=>d({redirectUrl:w,urlOpenIn:C,isAllowConversion:v,floatingNotificationId:S})}),l.jsxs("div",{className:`${a.desc} ${I(n,"image")?"":a.noImage}`,children:[I(n,"text")&&f&&l.jsx("div",{className:a.content,dangerouslySetInnerHTML:{__html:f}}),p&&l.jsx("button",{className:a.ctaButton,onClick:()=>J(w,C),children:r(`liteFloatingNotification:liteFloatingNotification.${p}`,p)})]})]},i)})},g));export{rt as default};
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.