@streamlayer/react 1.8.4 → 1.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,7 @@ export type StreamLayerSDKAdvertisementProps = {
12
12
  notification?: boolean;
13
13
  skipAutoClose?: boolean;
14
14
  skipTypeCheck?: boolean;
15
+ externalAd?: boolean;
15
16
  };
16
17
  export { StreamLayerSDKAdvertisementUI };
17
18
  export declare const StreamLayerSDKAdvertisement: React.FC<StreamLayerSDKAdvertisementProps>;
package/lib/app/app.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const useStreamLayer: () => StreamLayerSDK | null;
3
3
  export declare const useStreamLayerEvent: () => import('react').MutableRefObject<string> | undefined;
4
4
  export declare const useStreamLayerTheme: () => string | undefined;
5
5
  export declare const useStreamLayerUI: () => {
6
+ promotionExternalAd?: boolean;
6
7
  promotionSidebar?: boolean;
7
8
  promotionOverlay?: boolean;
8
9
  promotionNotification?: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),K=require("react"),s=require("./index2.js"),i=require("./useStreamLayerApp2.js"),X=s.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),J="a1rlj479",Q="s35f1di",Y="sj4471g",Z="b12050d8",oo="b1d5ybek",eo=o=>o==="left"||o==="right"?Q:Z,so=o=>o==="left"||o==="right"?Y:oo,to=o=>o==="left"?"avdxyl3":o==="right"?"a1bisd08":o==="top"?"a1u9y2aj":"a1qqaks",j=({children:o,style:t,className:n,enabled:r=!0,hiding:d,direction:l="left",onAnimationEnd:c})=>e.jsx(X,{style:t,className:s.cx_default(n,J,to(l),r&&!d&&eo(l),r&&d&&so(l)),onAnimationEnd:c,children:o}),no=s.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),io=s.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),ao=()=>no,lo=s.styled_default(ao())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),ro=({promotion:o,promotionId:t,hiding:n,direction:r="bottom"})=>{var d,l;if(!((d=o.additionalBanner)!=null&&d.imageUrl))return null;let c=(l=o.banner)==null?void 0:l.url;return c&&c.indexOf("http")!==0&&(c=`https://${c}`),e.jsx(j,{direction:r,hiding:n,children:e.jsx(io,{className:"BannerContainer",children:e.jsx(lo,{className:"BannerLink",href:c,style:{backgroundImage:`url(${o.additionalBanner.imageUrl})`},"data-promo-id":t,"data-promo-type":o.type,"data-analytics":"banner",target:"_blank"})})})},co=s.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),mo=s.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),po=s.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),uo=s.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),_=s.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),yo=()=>_,fo=s.styled_default(yo())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),vo=s.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),Io=s.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),Ao=s.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),go=s.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),ho=s.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),xo=s.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),bo={[i.NotificationPromotionImagePosition.BOTTOM]:_,[i.NotificationPromotionImagePosition.MIDDLE]:fo},jo=({src:o,imagePosition:t})=>{const n=bo[t]||_;return e.jsx(n,{children:e.jsx("img",{src:o,alt:""})})},_o=({notification:o,open:t})=>{if(!o||!o.promotion||o.enabled!==i.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:n,body:r,image:d,promotion:l}=o,{sponsorLogo:c,sponsorLogoMode:m,imagePosition:u,ctaButton:a}=l;return e.jsxs(xo,{className:"SL_Lower_Third_Notification",onClick:t,children:[e.jsxs(co,{children:[e.jsx(jo,{src:d,imagePosition:u}),e.jsxs(mo,{children:[n&&e.jsx(po,{children:n}),r&&e.jsx(uo,{children:r})]})]}),e.jsxs(go,{children:[m!==i.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&e.jsxs(e.Fragment,{children:[e.jsx(Ao,{children:e.jsx("img",{src:c,alt:n})}),e.jsx(ho,{})]}),e.jsxs(Io,{name:"promo-button",style:{color:a==null?void 0:a.textColor,backgroundColor:a==null?void 0:a.color},children:[(a==null?void 0:a.ctaIcon)&&(a==null?void 0:a.ctaIconMode)===i.CtaIconMode.CTA_ICON_TRANSPARENT&&e.jsx(vo,{src:a==null?void 0:a.ctaIcon,alt:"cta-icon"}),(a==null?void 0:a.label)||"Open"]})]})]})},No=s.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),So=s.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),To=s.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),$o=s.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),Co=s.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),h=s.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),Lo=()=>h,U=s.styled_default(Lo())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),Mo=()=>h,W=s.styled_default(Mo())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),Po=()=>W,ko=s.styled_default(Po())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),Eo=()=>h,Oo=s.styled_default(Eo())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),Bo=()=>h,Do=s.styled_default(Bo())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Ro=s.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),qo=s.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),wo=()=>s.a1,Fo=s.styled_default(wo())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),Uo=s.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),zo={[i.NotificationPromotionImagePosition.UNSET]:U,[i.NotificationPromotionImagePosition.FIT]:U,[i.NotificationPromotionImagePosition.CENTERED]:W,[i.NotificationPromotionImagePosition.BOTTOM]:ko,[i.NotificationPromotionImagePosition.SOLID]:Oo,[i.NotificationPromotionImagePosition.MIDDLE]:Do},Vo=({src:o,imagePosition:t})=>{const n=zo[t];return e.jsx(n,{children:e.jsx("img",{src:o,alt:""})})},Go=({notification:o,open:t,promotionId:n,hiding:r,direction:d="left"})=>{if(!o||!o.promotion||o.enabled!==i.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(o.promotion.mode===i.NotificationPromotionMode.LOWER_THIRD)return e.jsx(_o,{notification:o,open:t});const{title:l,body:c,image:m,promotion:u}=o,{sponsorLogo:a,sponsorLogoMode:y,imagePosition:v,ctaButton:p}=u;return e.jsx(j,{className:"SL_Rich_Notification",direction:d,hiding:r,children:e.jsxs(So,{onClick:t,children:[y!==i.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&e.jsx(Uo,{children:e.jsx("img",{src:a,alt:l})}),e.jsxs(No,{children:[e.jsx(Vo,{src:m,imagePosition:v}),e.jsxs(To,{children:[l&&e.jsx($o,{children:l}),c&&e.jsx(Co,{children:c})]}),e.jsxs(qo,{name:"promo-button",style:{color:p==null?void 0:p.textColor,backgroundColor:p==null?void 0:p.color},children:[(p==null?void 0:p.ctaIcon)&&(p==null?void 0:p.ctaIconMode)===i.CtaIconMode.CTA_ICON_TRANSPARENT&&e.jsx(Ro,{src:p==null?void 0:p.ctaIcon,alt:"cta-icon"}),(p==null?void 0:p.label)||"Open"]}),e.jsx(Fo,{name:"chevronRight"})]})]})})},Ko=s.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Wo=s.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),Ho=s.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),Xo=s.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Jo="h10toh7",z=s.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),Qo=s.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),Yo=s.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),Zo=s.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),oe="s1nmch9k",V=s.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),ee=s.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),se=s.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),te=s.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),ne=s.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),ie=s.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),ae=s.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),le=s.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),re=s.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),de="h17rwbtk",G=({promotion:o,skipAutoClose:t,promotionId:n,onClose:r,markAsViewed:d})=>{var l,c,m,u,a,y,v,p,f,A,g,N,S,T,$,C,L,M,P,k,E,O,B,D,R,q,w,F;const x=o.type===i.PromotionType.INGAME_IAB11_LBAR||o.type===i.PromotionType.INGAME_IAB11,b=((l=o.sponsor)==null?void 0:l.logo)&&o.logoMode===i.PromotionLogoMode.CENTER;K.useEffect(()=>{n&&o.type&&d&&d()},[n,o.type,d]);let I=(c=o.banner)==null?void 0:c.url;return I&&I.indexOf("http")!==0&&(I=`https://${I}`),e.jsxs(Wo,{className:"PromoOverlay",children:[e.jsxs(Ho,{children:[e.jsxs(Xo,{className:s.cx_default(!b&&Jo),children:[((m=o.sponsor)==null?void 0:m.logo)&&o.logoMode===i.PromotionLogoMode.LEFT&&e.jsx(z,{src:(u=o.sponsor)==null?void 0:u.logo,alt:"promo"}),e.jsxs(se,{style:{paddingLeft:(a=o.sponsor)!=null&&a.logo&&o.logoMode===i.PromotionLogoMode.LEFT?"0px":"8px"},children:[((y=o.sponsor)==null?void 0:y.logo)&&o.logoMode===i.PromotionLogoMode.LEFT&&e.jsx(Qo,{children:(v=o.sponsor)==null?void 0:v.name}),e.jsxs(te,{className:"SponsorText",children:[e.jsx(ne,{children:"AD"}),e.jsx(ie,{children:"SPONSORED"})]})]})]}),e.jsx(s.S,{className:"ClosePromoIcon",close:r,autoClose:(p=o.closeTimer)==null?void 0:p.auto,duration:t?0:(f=o.closeTimer)==null?void 0:f.seconds})]}),e.jsxs(Yo,{children:[b&&e.jsx(z,{className:oe,src:(A=o.sponsor)==null?void 0:A.logo,alt:"promo"}),e.jsx(V,{children:(N=(g=o.banner)==null?void 0:g.video)!=null&&N.url?e.jsx(s.X,{source:(T=(S=o.banner)==null?void 0:S.video)==null?void 0:T.url,poster:(C=($=o.banner)==null?void 0:$.video)==null?void 0:C.thumbnailUrl,aspectRatio:x?"1/1":"16/9",onPlay:()=>{s.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:n,type:o.type}})},autoPlay:o.autoPlayVideo===i.AutoPlayVideo.ENABLED}):(L=o.banner)!=null&&L.imageUrl?e.jsx(Zo,{style:x?{aspectRatio:"1/1"}:{},src:(M=o.banner)==null?void 0:M.imageUrl,alt:"promo"}):null}),!x&&e.jsxs(V,{children:[((P=o.banner)==null?void 0:P.title)&&e.jsx(re,{className:s.cx_default("AdvTitle",b&&de),children:(k=o.banner)==null?void 0:k.title}),((E=o.banner)==null?void 0:E.body)&&e.jsx(ee,{className:"AdvDescription",children:(O=o.banner)==null?void 0:O.body})]})]}),o.buttonType!==i.PromotionButtonType.NO_BUTTON&&e.jsx(ae,{children:e.jsx(le,{href:I,style:{backgroundColor:((D=(B=o.banner)==null?void 0:B.ctaButton)==null?void 0:D.color)||"#009dc4",color:((q=(R=o.banner)==null?void 0:R.ctaButton)==null?void 0:q.textColor)||"#fff"},"data-analytics":"button","data-promo-id":n,"data-promo-type":o.type,target:"_blank",children:(F=(w=o.banner)==null?void 0:w.ctaButton)==null?void 0:F.label})})]})},ce=s.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),me=({children:o,direction:t,style:n,className:r,hiding:d})=>e.jsx(j,{direction:t,style:n,hiding:d,className:r,children:e.jsx(ce,{children:o})}),pe=o=>(o==null?void 0:o.type)===i.PromotionType.INGAME_IAB11_LBAR||(o==null?void 0:o.type)===i.PromotionType.INGAME_IAB21_LBAR,ue=o=>(o==null?void 0:o.type)===i.PromotionType.INGAME_IAB11||(o==null?void 0:o.type)===i.PromotionType.INGAME_IAB21,ye=({advertisement:o,close:t,skipTypeCheck:n,skipAutoClose:r,layoutMode:d="side-by-side",sidebar:l,isNotification:c,banner:m,markAsViewed:u,open:a})=>o.promotion?c&&o.notification?e.jsx(Go,{open:a,notification:o.notification,promotionId:o.question.id}):!l&&!m&&(n||ue(o.promotion))?e.jsx(Ko,{className:"PromoOverlayContainer",children:e.jsx(G,{markAsViewed:u,promotionId:o.question.id,promotion:o.promotion,onClose:t,skipAutoClose:r})}):l&&(n||pe(o.promotion))?e.jsx(me,{className:"PromoSidebarContainer",direction:l,hiding:!1,children:e.jsx(G,{markAsViewed:u,promotionId:o.question.id,promotion:o.promotion,onClose:t,skipAutoClose:r})}):m?e.jsx(ro,{promotionId:o.question.id,hiding:!1,promotion:o.promotion,direction:m}):null:null,fe=s.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),ve=o=>{const t=o.target;if(t instanceof HTMLAnchorElement&&t.target==="_blank"){const n=t.getAttribute("data-promo-id")||"",r=t.getAttribute("data-promo-type")||i.PromotionType.UNSET;t.getAttribute("data-analytics")==="button"&&s.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:n,type:r}}),t.getAttribute("data-analytics")==="banner"&&s.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:n,type:r}})}},Ie=({gamification:o,layoutMode:t,skipAutoClose:n,skipTypeCheck:r,sidebar:d,banner:l,notification:c,isMobileScreen:m,persistent:u})=>{var a,y,v;const p=K.useRef(null),f=s.useStore(o.advertisement.$store);s.L(p,{enabled:!!f.data,event:"click",listener:ve});const A=!l&&!d;if(f.data===void 0||!u&&f.isViewed)return null;const g=((v=(y=(a=f==null?void 0:f.data)==null?void 0:a.notification)==null?void 0:y.promotion)==null?void 0:v.mode)===i.NotificationPromotionMode.LOWER_THIRD;return e.jsx(fe,{ref:p,style:{height:A?"auto":"100%"},className:s.cx_default("SL-AdvertisementUIWrap",m&&"mobile-view",g&&"SL-AdvertisementUIWrap--lower-third"),children:e.jsx(ye,{skipTypeCheck:r,sidebar:d,banner:l,advertisement:f.data,close:f.close,markAsViewed:o.advertisement.markAsViewed,open:o.advertisement.open,layoutMode:t,isNotification:c,skipAutoClose:n})})},H=({sdk:o,sidebar:t,banner:n,skipAutoClose:r,skipTypeCheck:d,layoutMode:l,isMobileScreen:c,persistent:m,notification:u})=>{const a=s.useStore(o.featuresList.getStore());if(t&&n)return e.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(!a)return null;const y=o.getFeature(i.SdkOverlayType.GAMES);return y?e.jsx(Ie,{gamification:y,sidebar:t,banner:n,layoutMode:l,isMobileScreen:c,persistent:m,notification:u,skipTypeCheck:d,skipAutoClose:r}):null},Ae=({event:o,sidebar:t,banner:n,isMobileScreen:r,skipAutoClose:d,persistent:l,theme:c,notification:m,skipTypeCheck:u})=>{const a=s.useStreamLayer(),y=s.useStreamLayerUI(),v=s.useStreamLayerTheme();return a?t&&!y.promotionSidebar?o!==void 0&&e.jsx(s.StreamLayerSDKEvent,{event:o}):n&&!y.promotionBanner?o!==void 0&&e.jsx(s.StreamLayerSDKEvent,{event:o}):m&&!y.promotionNotification?o!==void 0&&e.jsx(s.StreamLayerSDKEvent,{event:o}):!n&&!t&&!m&&!y.promotionOverlay?o!==void 0&&e.jsx(s.StreamLayerSDKEvent,{event:o}):e.jsxs("div",{className:"StreamLayerSDK",children:[e.jsx(s.d,{customTheme:c??v,children:e.jsx(H,{sdk:a,sidebar:t,banner:n,isMobileScreen:r,persistent:l,notification:m,skipTypeCheck:u,skipAutoClose:d,layoutMode:"side-by-side"})}),o!==void 0&&e.jsx(s.StreamLayerSDKEvent,{event:o})]}):null};exports.StreamLayerSDKAdvertisement=Ae;exports.StreamLayerSDKAdvertisementUI=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),g=require("react"),t=require("./index2.js"),m=require("./useStreamLayerApp2.js"),me=t.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),ue="a1rlj479",pe="s35f1di",ye="sj4471g",ve="b12050d8",fe="b1d5ybek",Ae=e=>e==="left"||e==="right"?pe:ve,ge=e=>e==="left"||e==="right"?ye:fe,Ie=e=>e==="left"?"avdxyl3":e==="right"?"a1bisd08":e==="top"?"a1u9y2aj":"a1qqaks",k=({children:e,style:s,className:i,enabled:n=!0,hiding:r,direction:a="left",onAnimationEnd:c})=>o.jsx(me,{style:s,className:t.cx_default(i,ue,Ie(a),n&&!r&&Ae(a),n&&r&&ge(a)),onAnimationEnd:c,children:e}),xe=t.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),he=t.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),je=()=>xe,be=t.styled_default(je())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),_e=({promotion:e,promotionId:s,hiding:i,direction:n="bottom"})=>{var r,a;if(!((r=e.additionalBanner)!=null&&r.imageUrl))return null;let c=(a=e.banner)==null?void 0:a.url;return c&&c.indexOf("http")!==0&&(c=`https://${c}`),o.jsx(k,{direction:n,hiding:i,children:o.jsx(he,{className:"BannerContainer",children:o.jsx(be,{className:"BannerLink",href:c,style:{backgroundImage:`url(${e.additionalBanner.imageUrl})`},"data-promo-id":s,"data-promo-type":e.type,"data-analytics":"banner",target:"_blank"})})})},Ne=t.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Se=t.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),Te=t.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),Ee=t.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),O=t.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),Ce=()=>O,Pe=t.styled_default(Ce())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),Le=t.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),$e=t.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),Me=t.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),ke=t.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Oe=t.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),Be=t.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),De={[m.NotificationPromotionImagePosition.BOTTOM]:O,[m.NotificationPromotionImagePosition.MIDDLE]:Pe},Re=({src:e,imagePosition:s})=>{const i=De[s]||O;return o.jsx(i,{children:o.jsx("img",{src:e,alt:""})})},qe=({notification:e,open:s})=>{if(!e||!e.promotion||e.enabled!==m.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:i,body:n,image:r,promotion:a}=e,{sponsorLogo:c,sponsorLogoMode:u,imagePosition:v,ctaButton:l}=a;return o.jsxs(Be,{className:"SL_Lower_Third_Notification",onClick:s,children:[o.jsxs(Ne,{children:[o.jsx(Re,{src:r,imagePosition:v}),o.jsxs(Se,{children:[i&&o.jsx(Te,{children:i}),n&&o.jsx(Ee,{children:n})]})]}),o.jsxs(ke,{children:[u!==m.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&o.jsxs(o.Fragment,{children:[o.jsx(Me,{children:o.jsx("img",{src:c,alt:i})}),o.jsx(Oe,{})]}),o.jsxs($e,{name:"promo-button",style:{color:l==null?void 0:l.textColor,backgroundColor:l==null?void 0:l.color},children:[(l==null?void 0:l.ctaIcon)&&(l==null?void 0:l.ctaIconMode)===m.CtaIconMode.CTA_ICON_TRANSPARENT&&o.jsx(Le,{src:l==null?void 0:l.ctaIcon,alt:"cta-icon"}),(l==null?void 0:l.label)||"Open"]})]})]})},we=t.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Ve=t.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),Fe=t.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Ue=t.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),Ke=t.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),C=t.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),ze=()=>C,H=t.styled_default(ze())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),Ge=()=>C,Z=t.styled_default(Ge())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),We=()=>Z,He=t.styled_default(We())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),Ye=()=>C,Je=t.styled_default(Ye())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),Qe=()=>C,Xe=t.styled_default(Qe())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Ze=t.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),eo=t.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),oo=()=>t.h1,to=t.styled_default(oo())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),so=t.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),no={[m.NotificationPromotionImagePosition.UNSET]:H,[m.NotificationPromotionImagePosition.FIT]:H,[m.NotificationPromotionImagePosition.CENTERED]:Z,[m.NotificationPromotionImagePosition.BOTTOM]:He,[m.NotificationPromotionImagePosition.SOLID]:Je,[m.NotificationPromotionImagePosition.MIDDLE]:Xe},io=({src:e,imagePosition:s})=>{const i=no[s];return o.jsx(i,{children:o.jsx("img",{src:e,alt:""})})},lo=({notification:e,open:s,promotionId:i,hiding:n,direction:r="left"})=>{if(!e||!e.promotion||e.enabled!==m.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(e.promotion.mode===m.NotificationPromotionMode.LOWER_THIRD)return o.jsx(qe,{notification:e,open:s});const{title:a,body:c,image:u,promotion:v}=e,{sponsorLogo:l,sponsorLogoMode:f,imagePosition:y,ctaButton:p}=v;return o.jsx(k,{className:"SL_Rich_Notification",direction:r,hiding:n,children:o.jsxs(Ve,{onClick:s,children:[f!==m.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&o.jsx(so,{children:o.jsx("img",{src:l,alt:a})}),o.jsxs(we,{children:[o.jsx(io,{src:u,imagePosition:y}),o.jsxs(Fe,{children:[a&&o.jsx(Ue,{children:a}),c&&o.jsx(Ke,{children:c})]}),o.jsxs(eo,{name:"promo-button",style:{color:p==null?void 0:p.textColor,backgroundColor:p==null?void 0:p.color},children:[(p==null?void 0:p.ctaIcon)&&(p==null?void 0:p.ctaIconMode)===m.CtaIconMode.CTA_ICON_TRANSPARENT&&o.jsx(Ze,{src:p==null?void 0:p.ctaIcon,alt:"cta-icon"}),(p==null?void 0:p.label)||"Open"]}),o.jsx(to,{name:"chevronRight"})]})]})})},ao=t.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),ee=t.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),oe=t.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),te=t.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),se="h10toh7",Y=t.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),ro=t.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),ne=t.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),co=t.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),mo="s1nmch9k",J=t.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),uo=t.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),po=t.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),yo=t.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),ie=t.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),vo=t.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),fo=t.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),Ao=t.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),go=t.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),Io="h17rwbtk",xo=t.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),Q=t.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),ho=t.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),jo=({time:e,adCount:s,adPosition:i})=>{const n=Math.floor(e/60),r=e-n*60;return n===0&&r===0&&s===i?null:o.jsxs(xo,{children:[s>1&&o.jsxs(o.Fragment,{children:[o.jsxs(Q,{children:[i," of ",s]}),o.jsx(ho,{})]}),o.jsxs(Q,{children:[n,":",r<10?`0${r}`:r]})]})},bo=(e,s,{onPlay:i,onStop:n,onProgress:r})=>{const a=google.ima;let c=new a.AdDisplayContainer(e),u=new a.AdsLoader(c),v=new a.AdsRequest,l;u.addEventListener(a.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,y=>{l=y.getAdsManager(e),i&&l.addEventListener(a.AdEvent.Type.STARTED,i),n&&l.addEventListener(a.AdEvent.Type.COMPLETE,n),r&&l.addEventListener(a.AdEvent.Type.AD_PROGRESS,p=>r(p.getAdData())),l.init(e.clientWidth,e.clientHeight,a.ViewMode.NORMAL),l.start()},!1),u.addEventListener(a.AdErrorEvent.Type.AD_ERROR,()=>{console.log("ad error"),n==null||n()},!1),v.linearAdSlotWidth=e.clientWidth,v.linearAdSlotHeight=e.clientHeight,v.adTagUrl=s,u.requestAds(v);const f=()=>{l==null||l.destroy(),u==null||u.destroy(),c==null||c.destroy(),c=void 0,u=void 0,v=void 0,l=void 0};return()=>{try{c.initialize()}catch(y){n==null||n(),console.log("AdsManager could not be started",y)}return f}},_o=t.styled_default("div")({name:"Container",class:"c4q6dw1",propsAsIs:!1}),No=t.styled_default("div")({name:"ControlsContainer",class:"c1la67r",propsAsIs:!1}),So="m3guev",To="m7099mt",Eo="mmm6o5s",Co=({promotion:e,controlVideo:s,promotionId:i,onClose:n,externalAd:r,skipAutoClose:a})=>{var c;const u=g.useRef(null),[v,l]=g.useState(!1),[f,y]=g.useState(0),[p,h]=g.useState(0),[b,A]=g.useState(0),I=g.useRef(),x=g.useCallback(()=>{y(0),h(0),A(0),l(!1),s==null||s({muted:!1})},[s]);g.useEffect(()=>{if(r!=null&&r.url&&u.current){x();const j=bo(u.current,r.url,{onPlay:()=>{t.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:i,type:e.type}}),s==null||s({muted:!0}),l(!0)},onStop:()=>{n==null||n(),x()},onProgress:_=>{y(Math.round(_.duration-_.currentTime)),h(_.totalAds),A(_.adPosition)}})();return I.current=j,()=>{I.current=void 0,j()}}},[r==null?void 0:r.url,s,x,i,e.type,n]);const S=((c=e.sponsor)==null?void 0:c.logo)&&e.logoMode===m.PromotionLogoMode.CENTER;return o.jsxs(ee,{className:"PromoOverlay",children:[o.jsxs(oe,{children:[o.jsx(te,{className:t.cx_default(!S&&se),children:o.jsx(ie,{style:{transform:"scale(1.5)"},children:"Ad"})}),o.jsxs(No,{children:[o.jsx(jo,{time:f,adCount:p,adPosition:b}),a&&o.jsx(t.b,{className:"ClosePromoIcon",close:()=>{var j;(j=I.current)==null||j.call(I),n==null||n(),x()}})]})]}),o.jsx(ne,{className:t.cx_default(So,v&&To,!v&&Eo),children:o.jsx(_o,{ref:u})})]})},X=e=>{var s,i,n,r,a,c,u,v,l,f,y,p,h,b,A,I,x,S,j,_,B,D,R,q,w,V,F,U,K,z;const{promotion:d,controlVideo:T,skipAutoClose:ae,promotionId:E,onClose:re,markAsViewed:P,externalAd:G}=e,L=d.type===m.PromotionType.INGAME_IAB11_LBAR||d.type===m.PromotionType.INGAME_IAB11,$=((s=d.sponsor)==null?void 0:s.logo)&&d.logoMode===m.PromotionLogoMode.CENTER,de=!!((n=(i=d.banner)==null?void 0:i.video)!=null&&n.url),M=d.autoPlayVideo===m.AutoPlayVideo.ENABLED,[ce,W]=g.useState(!de||!M);if(g.useEffect(()=>{E&&d.type&&P&&P()},[E,d.type,P]),g.useEffect(()=>()=>{T==null||T({muted:!1})},[T]),G)return o.jsx(Co,{...e,externalAd:G});let N=(r=d.banner)==null?void 0:r.url;return N&&N.indexOf("http")!==0&&(N=`https://${N}`),o.jsxs(ee,{className:"PromoOverlay",children:[o.jsxs(oe,{children:[o.jsxs(te,{className:t.cx_default(!$&&se),children:[((a=d.sponsor)==null?void 0:a.logo)&&d.logoMode===m.PromotionLogoMode.LEFT&&o.jsx(Y,{src:(c=d.sponsor)==null?void 0:c.logo,alt:"promo"}),o.jsxs(po,{style:{paddingLeft:(u=d.sponsor)!=null&&u.logo&&d.logoMode===m.PromotionLogoMode.LEFT?"0px":"8px"},children:[((v=d.sponsor)==null?void 0:v.logo)&&d.logoMode===m.PromotionLogoMode.LEFT&&o.jsx(ro,{children:(l=d.sponsor)==null?void 0:l.name}),o.jsxs(yo,{className:"SponsorText",children:[o.jsx(ie,{children:"AD"}),o.jsx(vo,{children:"SPONSORED"})]})]})]}),o.jsx(t.b,{className:"ClosePromoIcon",close:re,autoClose:(f=d.closeTimer)==null?void 0:f.auto,duration:ae?0:(y=d.closeTimer)==null?void 0:y.seconds,isPlaying:ce})]}),o.jsxs(ne,{children:[$&&o.jsx(Y,{className:mo,src:(p=d.sponsor)==null?void 0:p.logo,alt:"promo"}),o.jsx(J,{children:(b=(h=d.banner)==null?void 0:h.video)!=null&&b.url?o.jsx(t.Y,{source:(I=(A=d.banner)==null?void 0:A.video)==null?void 0:I.url,poster:(S=(x=d.banner)==null?void 0:x.video)==null?void 0:S.thumbnailUrl,aspectRatio:L?"1/1":"16/9",onPause:()=>{M&&W(!1)},onPlay:()=>{t.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:E,type:d.type}}),W(!0)},controlVideo:T,autoPlay:M}):(j=d.banner)!=null&&j.imageUrl?o.jsx(co,{style:L?{aspectRatio:"1/1"}:{},src:(_=d.banner)==null?void 0:_.imageUrl,alt:"promo"}):null}),!L&&o.jsxs(J,{children:[((B=d.banner)==null?void 0:B.title)&&o.jsx(go,{className:t.cx_default("AdvTitle",$&&Io),children:(D=d.banner)==null?void 0:D.title}),((R=d.banner)==null?void 0:R.body)&&o.jsx(uo,{className:"AdvDescription",children:(q=d.banner)==null?void 0:q.body})]})]}),d.buttonType!==m.PromotionButtonType.NO_BUTTON&&o.jsx(fo,{children:o.jsx(Ao,{href:N,style:{backgroundColor:((V=(w=d.banner)==null?void 0:w.ctaButton)==null?void 0:V.color)||"#009dc4",color:((U=(F=d.banner)==null?void 0:F.ctaButton)==null?void 0:U.textColor)||"#fff"},"data-analytics":"button","data-promo-id":E,"data-promo-type":d.type,target:"_blank",children:(z=(K=d.banner)==null?void 0:K.ctaButton)==null?void 0:z.label})})]})},Po=t.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),Lo=({children:e,direction:s,style:i,className:n,hiding:r})=>o.jsx(k,{direction:s,style:i,hiding:r,className:n,children:o.jsx(Po,{children:e})}),$o=e=>(e==null?void 0:e.type)===m.PromotionType.INGAME_IAB11_LBAR||(e==null?void 0:e.type)===m.PromotionType.INGAME_IAB21_LBAR,Mo=e=>(e==null?void 0:e.type)===m.PromotionType.INGAME_IAB11||(e==null?void 0:e.type)===m.PromotionType.INGAME_IAB21,ko=({advertisement:e,close:s,skipTypeCheck:i,skipAutoClose:n,layoutMode:r="side-by-side",sidebar:a,isNotification:c,banner:u,markAsViewed:v,open:l,externalAd:f,controlVideo:y})=>e.promotion?c&&e.notification?o.jsx(lo,{open:l,notification:e.notification,promotionId:e.question.id}):!a&&!u&&(i||Mo(e.promotion))?o.jsx(ao,{className:"PromoOverlayContainer",children:o.jsx(X,{markAsViewed:v,promotionId:e.question.id,promotion:e.promotion,onClose:s,skipAutoClose:n,externalAd:f,controlVideo:y})}):a&&(i||$o(e.promotion))?o.jsx(Lo,{className:"PromoSidebarContainer",direction:a,hiding:!1,children:o.jsx(X,{markAsViewed:v,promotionId:e.question.id,promotion:e.promotion,externalAd:f,onClose:s,controlVideo:y,skipAutoClose:n})}):u?o.jsx(_e,{promotionId:e.question.id,hiding:!1,promotion:e.promotion,direction:u}):null:null,Oo=t.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),Bo=e=>{const s=e.target;if(s instanceof HTMLAnchorElement&&s.target==="_blank"){const i=s.getAttribute("data-promo-id")||"",n=s.getAttribute("data-promo-type")||m.PromotionType.UNSET;s.getAttribute("data-analytics")==="button"&&t.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:i,type:n}}),s.getAttribute("data-analytics")==="banner"&&t.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:i,type:n}})}},Do=({gamification:e,layoutMode:s,skipAutoClose:i,skipTypeCheck:n,sidebar:r,banner:a,notification:c,isMobileScreen:u,persistent:v,externalAd:l,controlVideo:f})=>{var y,p,h;const b=g.useRef(null),A=t.useStore(e.advertisement.$store);t.L(b,{enabled:!!A.data,event:"click",listener:Bo});const I=!a&&!r;if(A.data===void 0||!v&&A.isViewed)return null;const x=((h=(p=(y=A==null?void 0:A.data)==null?void 0:y.notification)==null?void 0:p.promotion)==null?void 0:h.mode)===m.NotificationPromotionMode.LOWER_THIRD;return o.jsx(Oo,{ref:b,style:{height:I?"auto":"100%"},className:t.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view",x&&"SL-AdvertisementUIWrap--lower-third"),children:o.jsx(ko,{skipTypeCheck:n,sidebar:r,banner:a,advertisement:A.data,close:A.close,externalAd:l?A.externalAd:void 0,markAsViewed:e.advertisement.markAsViewed,open:e.advertisement.open,layoutMode:s,isNotification:c,skipAutoClose:i,controlVideo:f})})},le=({sdk:e,sidebar:s,externalAd:i,banner:n,skipAutoClose:r,skipTypeCheck:a,layoutMode:c,isMobileScreen:u,persistent:v,notification:l})=>{const f=t.useStore(e.featuresList.getStore());if(g.useEffect(()=>{if(i){const p=document.createElement("script");p.async=!0,p.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",document.body.appendChild(p)}},[i]),s&&n)return o.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(n&&i)return o.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!f)return null;const y=e.getFeature(m.SdkOverlayType.GAMES);return y?o.jsx(Do,{gamification:y,sidebar:s,banner:n,layoutMode:c,isMobileScreen:u,persistent:v,notification:l,skipTypeCheck:a,skipAutoClose:r,externalAd:i,controlVideo:e.controlVideoPlayer}):null},Ro=({event:e,sidebar:s,banner:i,isMobileScreen:n,skipAutoClose:r,persistent:a,theme:c,notification:u,skipTypeCheck:v,externalAd:l})=>{const f=t.useStreamLayer(),y=t.useStreamLayerUI(),p=t.useStreamLayerTheme();return f?l&&!y.promotionExternalAd?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):!l&&y.promotionExternalAd?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):s&&!y.promotionSidebar?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):i&&!y.promotionBanner?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):u&&!y.promotionNotification?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):!i&&!s&&!u&&!y.promotionOverlay?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):o.jsxs("div",{className:"StreamLayerSDK",children:[o.jsx(t.d,{customTheme:c??p,children:o.jsx(le,{sdk:f,sidebar:s,banner:i,isMobileScreen:n,persistent:a,notification:u,skipTypeCheck:v,skipAutoClose:r,layoutMode:"side-by-side",externalAd:l})}),e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e})]}):null};exports.StreamLayerSDKAdvertisement=Ro;exports.StreamLayerSDKAdvertisementUI=le;