@streamlayer/react 1.11.2 → 1.11.3-rc.4
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.
- package/lib/cjs/advertisement.js +1 -1
- package/lib/cjs/gamification-feature.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/insight.js +1 -1
- package/lib/cjs/notification.js +1 -1
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/provider.js +78 -90
- package/lib/cjs/useStreamLayerApp2.js +12 -12
- package/lib/classic/cjs/advertisement.js +1 -1
- package/lib/classic/cjs/gamification-feature.js +1 -1
- package/lib/classic/cjs/index.js +1 -1
- package/lib/classic/cjs/insight.js +1 -1
- package/lib/classic/cjs/notification.js +1 -1
- package/lib/classic/cjs/points.js +1 -1
- package/lib/classic/cjs/provider.js +78 -90
- package/lib/classic/cjs/useStreamLayerApp2.js +12 -12
- package/lib/classic/es/advertisement.js +704 -605
- package/lib/classic/es/gamification-feature.js +1 -1
- package/lib/classic/es/index.js +11 -14
- package/lib/classic/es/insight.js +34 -35
- package/lib/classic/es/notification.js +452 -378
- package/lib/classic/es/points.js +67 -44
- package/lib/classic/es/provider.js +13981 -15913
- package/lib/classic/es/useStreamLayerApp2.js +3253 -2969
- package/lib/classic/index.d.ts +1 -10
- package/lib/classic/style.css +455 -1
- package/lib/es/advertisement.js +704 -605
- package/lib/es/gamification-feature.js +1 -1
- package/lib/es/index.js +11 -14
- package/lib/es/insight.js +34 -35
- package/lib/es/notification.js +452 -378
- package/lib/es/points.js +67 -44
- package/lib/es/provider.js +13979 -15910
- package/lib/es/useStreamLayerApp2.js +3253 -2969
- package/lib/index.d.ts +1 -10
- package/lib/style.css +1 -1
- package/package.json +1 -76
- package/lib/app/masters.d.ts +0 -28
- package/lib/cjs/gamification-feature2.js +0 -1
- package/lib/cjs/masters.js +0 -1
- package/lib/cjs/masters2.js +0 -9
- package/lib/classic/app/masters.d.ts +0 -28
- package/lib/classic/cjs/gamification-feature2.js +0 -1
- package/lib/classic/cjs/masters.js +0 -1
- package/lib/classic/cjs/masters2.js +0 -9
- package/lib/classic/es/gamification-feature2.js +0 -4
- package/lib/classic/es/masters.js +0 -8
- package/lib/classic/es/masters2.js +0 -1066
- package/lib/classic/masters.d.ts +0 -5
- package/lib/dist/cjs/gamification-feature.js +0 -1
- package/lib/dist/cjs/gamification-feature2.js +0 -1
- package/lib/dist/cjs/index.js +0 -1
- package/lib/dist/cjs/masters.js +0 -219
- package/lib/dist/cjs/package.json +0 -1
- package/lib/dist/es/gamification-feature.js +0 -4
- package/lib/dist/es/gamification-feature2.js +0 -123
- package/lib/dist/es/index.js +0 -9
- package/lib/dist/es/masters.js +0 -42696
- package/lib/dist/es/package.json +0 -1
- package/lib/dist/style.css +0 -1
- package/lib/es/gamification-feature2.js +0 -4
- package/lib/es/masters.js +0 -8
- package/lib/es/masters2.js +0 -1066
- package/lib/masters.d.ts +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),g=require("react"),t=require("./provider.js"),u=require("./useStreamLayerApp2.js"),pe=t.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),ye="a1rlj479",ve="s35f1di",fe="sj4471g",Ae="b12050d8",ge="b1d5ybek",Ie=e=>e==="left"||e==="right"?ve:Ae,he=e=>e==="left"||e==="right"?fe:ge,xe=e=>e==="left"?"avdxyl3":e==="right"?"a1bisd08":e==="top"?"a1u9y2aj":"a1qqaks",B=({children:e,style:s,className:l,enabled:n=!0,hiding:r,direction:a="left",onAnimationEnd:c})=>o.jsx(pe,{style:s,className:t.cx_default(l,ye,xe(a),n&&!r&&Ie(a),n&&r&&he(a)),onAnimationEnd:c,children:e}),je=t.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),_e=t.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),be=()=>je,Ne=t.styled_default(be())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),Pe=({promotion:e,promotionId:s,hiding:l,direction:n="bottom"})=>{var r,a;if(!((r=e.additionalBanner)!=null&&r.imageUrl))return null;let c=(a=e.additionalBanner)==null?void 0:a.url;return c&&c.indexOf("http")!==0&&(c=`https://${c}`),o.jsx(B,{direction:n,hiding:l,children:o.jsx(_e,{className:"BannerContainer",children:o.jsx(Ne,{as:c?"a":"span",className:"BannerLink",href:c,style:{backgroundImage:`url(${e.additionalBanner.imageUrl})`,cursor:c?"pointer":"default"},"data-promo-id":s,"data-promo-type":e.type,"data-analytics":"banner",target:"_blank"})})})},Se=t.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Te=t.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),Ee=t.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),$e=t.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),R=t.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),Ce=()=>R,Le=t.styled_default(Ce())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),Me=t.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),ke=t.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),Oe=t.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),Be=t.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Re=t.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),De=t.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),qe={[u.NotificationPromotionImagePosition.BOTTOM]:R,[u.NotificationPromotionImagePosition.MIDDLE]:Le},we=({src:e,imagePosition:s})=>{const l=qe[s]||R;return o.jsx(l,{children:o.jsx("img",{src:e,alt:""})})},Ve=({notification:e,open:s})=>{if(!e||!e.promotion||e.enabled!==u.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:l,body:n,image:r,promotion:a}=e,{sponsorLogo:c,sponsorLogoMode:p,imagePosition:v,ctaButton:i}=a;return o.jsxs(De,{className:"SL_Lower_Third_Notification",onClick:s,children:[o.jsxs(Se,{children:[o.jsx(we,{src:r,imagePosition:v}),o.jsxs(Te,{children:[l&&o.jsx(Ee,{children:l}),n&&o.jsx($e,{children:n})]})]}),o.jsxs(Be,{children:[p!==u.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&o.jsxs(o.Fragment,{children:[o.jsx(Oe,{children:o.jsx("img",{src:c,alt:l})}),o.jsx(Re,{})]}),o.jsxs(ke,{name:"promo-button",style:{color:i==null?void 0:i.textColor,backgroundColor:i==null?void 0:i.color},children:[(i==null?void 0:i.ctaIcon)&&(i==null?void 0:i.ctaIconMode)===u.CtaIconMode.CTA_ICON_TRANSPARENT&&o.jsx(Me,{src:i==null?void 0:i.ctaIcon,alt:"cta-icon"}),(i==null?void 0:i.label)||"Open"]})]})]})},Fe=t.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Ue=t.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),ze=t.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Ge=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}),We=()=>C,Z=t.styled_default(We())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),He=()=>C,te=t.styled_default(He())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),Ye=()=>te,Je=t.styled_default(Ye())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),Ze=()=>C,Qe=t.styled_default(Ze())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),Xe=()=>C,eo=t.styled_default(Xe())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),oo=t.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),to=t.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),so=()=>t.f1,no=t.styled_default(so())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),lo=t.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),io={[u.NotificationPromotionImagePosition.UNSET]:Z,[u.NotificationPromotionImagePosition.FIT]:Z,[u.NotificationPromotionImagePosition.CENTERED]:te,[u.NotificationPromotionImagePosition.BOTTOM]:Je,[u.NotificationPromotionImagePosition.SOLID]:Qe,[u.NotificationPromotionImagePosition.MIDDLE]:eo},ao=({src:e,imagePosition:s})=>{const l=io[s];return o.jsx(l,{children:o.jsx("img",{src:e,alt:""})})},ro=({notification:e,open:s,promotionId:l,hiding:n,direction:r="left"})=>{if(!e||!e.promotion||e.enabled!==u.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(e.promotion.mode===u.NotificationPromotionMode.LOWER_THIRD)return o.jsx(Ve,{notification:e,open:s});const{title:a,body:c,image:p,promotion:v}=e,{sponsorLogo:i,sponsorLogoMode:f,imagePosition:y,ctaButton:m}=v;return o.jsx(B,{className:"SL_Rich_Notification",direction:r,hiding:n,children:o.jsxs(Ue,{onClick:s,children:[f!==u.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&o.jsx(lo,{children:o.jsx("img",{src:i,alt:a})}),o.jsxs(Fe,{children:[o.jsx(ao,{src:p,imagePosition:y}),o.jsxs(ze,{children:[a&&o.jsx(Ge,{children:a}),c&&o.jsx(Ke,{children:c})]}),o.jsxs(to,{name:"promo-button",style:{color:m==null?void 0:m.textColor,backgroundColor:m==null?void 0:m.color},children:[(m==null?void 0:m.ctaIcon)&&(m==null?void 0:m.ctaIconMode)===u.CtaIconMode.CTA_ICON_TRANSPARENT&&o.jsx(oo,{src:m==null?void 0:m.ctaIcon,alt:"cta-icon"}),(m==null?void 0:m.label)||"Open"]}),o.jsx(no,{name:"chevronRight"})]})]})})},co=t.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),se=t.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),ne=t.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),le=t.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),ie="h10toh7",Q=t.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),mo=t.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),ae=t.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),uo=t.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),po="s1nmch9k",X=t.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),yo=t.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),vo=t.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),fo=t.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),re=t.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),Ao=t.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),go=t.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),Io=t.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),ho=t.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),xo="h17rwbtk",jo=t.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),ee=t.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),_o=t.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),bo=({time:e,adCount:s,adPosition:l})=>{const n=Math.floor(e/60),r=e-n*60;return n===0&&r===0&&s===l?null:o.jsxs(jo,{children:[s>1&&o.jsxs(o.Fragment,{children:[o.jsxs(ee,{children:[l," of ",s]}),o.jsx(_o,{})]}),o.jsxs(ee,{children:[n,":",r<10?`0${r}`:r]})]})},No=(e,s,{onPlay:l,onStop:n,onProgress:r})=>{const a=google.ima;let c=new a.AdDisplayContainer(e),p=new a.AdsLoader(c),v=new a.AdsRequest,i;p.addEventListener(a.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,y=>{i=y.getAdsManager(e),l&&i.addEventListener(a.AdEvent.Type.STARTED,l),n&&i.addEventListener(a.AdEvent.Type.COMPLETE,n),r&&i.addEventListener(a.AdEvent.Type.AD_PROGRESS,m=>r(m.getAdData())),i.init(e.clientWidth,e.clientHeight,a.ViewMode.NORMAL),i.start()},!1),p.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,p.requestAds(v);const f=()=>{i==null||i.destroy(),p==null||p.destroy(),c==null||c.destroy(),c=void 0,p=void 0,v=void 0,i=void 0};return()=>{try{c.initialize()}catch(y){n==null||n(),console.log("AdsManager could not be started",y)}return f}},Po=t.styled_default("div")({name:"Container",class:"c4q6dw1",propsAsIs:!1}),So=t.styled_default("div")({name:"ControlsContainer",class:"c1la67r",propsAsIs:!1}),To="m3guev",Eo="m7099mt",$o="mmm6o5s",Co=({promotion:e,controlVideo:s,promotionId:l,onClose:n,externalAd:r,skipAutoClose:a})=>{var c;const p=g.useRef(null),[v,i]=g.useState(!1),[f,y]=g.useState(0),[m,I]=g.useState(0),[_,A]=g.useState(0),h=g.useRef(),x=g.useCallback(()=>{y(0),I(0),A(0),i(!1),s==null||s({muted:!1})},[s]);g.useEffect(()=>{if(r!=null&&r.url&&p.current){x();const j=No(p.current,r.url,{onPlay:()=>{t.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:l,type:e.type}}),s==null||s({muted:!0}),i(!0)},onStop:()=>{n==null||n(),x()},onProgress:b=>{y(Math.round(b.duration-b.currentTime)),I(b.totalAds),A(b.adPosition)}})();return h.current=j,()=>{h.current=void 0,j()}}},[r==null?void 0:r.url,s,x,l,e.type,n]);const S=((c=e.sponsor)==null?void 0:c.logo)&&e.logoMode===u.PromotionLogoMode.CENTER;return o.jsxs(se,{className:"PromoOverlay",children:[o.jsxs(ne,{children:[o.jsx(le,{className:t.cx_default(!S&&ie),children:o.jsx(re,{style:{transform:"scale(1.5)"},children:"Ad"})}),o.jsxs(So,{children:[o.jsx(bo,{time:f,adCount:m,adPosition:_}),a&&o.jsx(t.b,{className:"ClosePromoIcon",close:()=>{var j;(j=h.current)==null||j.call(h),n==null||n(),x()}})]})]}),o.jsx(ae,{className:t.cx_default(To,v&&Eo,!v&&$o),children:o.jsx(Po,{ref:p})})]})},oe=e=>{var s,l,n,r,a,c,p,v,i,f,y,m,I,_,A,h,x,S,j,b,D,q,w,V,F,U,z,G,K,W;const{promotion:d,open:H,advertisementPaused:ce,togglePause:N,controlVideo:T,skipAutoClose:me,promotionId:E,onClose:ue,markAsViewed:L,externalAd:Y}=e,M=d.type===u.PromotionType.INGAME_IAB11_LBAR||d.type===u.PromotionType.INGAME_IAB11,k=((s=d.sponsor)==null?void 0:s.logo)&&d.logoMode===u.PromotionLogoMode.CENTER,J=!!((n=(l=d.banner)==null?void 0:l.video)!=null&&n.url),$=d.autoPlayVideo===u.AutoPlayVideo.ENABLED;if(g.useEffect(()=>{N==null||N(J||$),H==null||H()},[]),g.useEffect(()=>{E&&d.type&&L&&L()},[E,d.type,L]),g.useEffect(()=>()=>{T==null||T({muted:!1})},[T]),Y)return o.jsx(Co,{...e,externalAd:Y});let P=(r=d.banner)==null?void 0:r.url;P&&P.indexOf("http")!==0&&(P=`https://${P}`);let O=!0;return J&&(!ce||!$?O=!0:O=!1),o.jsxs(se,{className:"PromoOverlay",children:[o.jsxs(ne,{children:[o.jsxs(le,{className:t.cx_default(!k&&ie),children:[((a=d.sponsor)==null?void 0:a.logo)&&d.logoMode===u.PromotionLogoMode.LEFT&&o.jsx(Q,{className:"PromoSponsorLogo",src:(c=d.sponsor)==null?void 0:c.logo,alt:"promo"}),o.jsxs(vo,{style:{paddingLeft:(p=d.sponsor)!=null&&p.logo&&d.logoMode===u.PromotionLogoMode.LEFT?"0px":"8px"},children:[((v=d.sponsor)==null?void 0:v.logo)&&d.logoMode===u.PromotionLogoMode.LEFT&&o.jsx(mo,{children:(i=d.sponsor)==null?void 0:i.name}),o.jsxs(fo,{className:"SponsorText",children:[o.jsx(re,{children:"AD"}),o.jsx(Ao,{children:"SPONSORED"})]})]})]}),o.jsx(t.b,{className:"ClosePromoIcon",close:ue,autoClose:(f=d.closeTimer)==null?void 0:f.auto,duration:me?0:(y=d.closeTimer)==null?void 0:y.seconds,isPlaying:O})]}),o.jsxs(ae,{children:[k&&o.jsx(Q,{className:po,src:(m=d.sponsor)==null?void 0:m.logo,alt:"promo"}),o.jsx(X,{children:(_=(I=d.banner)==null?void 0:I.video)!=null&&_.url?o.jsx(t.Y,{source:(h=(A=d.banner)==null?void 0:A.video)==null?void 0:h.url,poster:(S=(x=d.banner)==null?void 0:x.video)==null?void 0:S.thumbnailUrl,aspectRatio:M?"1/1":"16/9",onPause:()=>{$&&(N==null||N(!0))},onPlay:()=>{t.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:E,type:d.type}}),N==null||N(!1)},controlVideo:T,autoPlay:$}):(j=d.banner)!=null&&j.imageUrl?o.jsx(uo,{style:M?{aspectRatio:"1/1"}:{},src:(b=d.banner)==null?void 0:b.imageUrl,alt:"promo"}):null}),!M&&o.jsxs(X,{children:[((D=d.banner)==null?void 0:D.title)&&o.jsx(ho,{className:t.cx_default("AdvTitle",k&&xo),children:(q=d.banner)==null?void 0:q.title}),((w=d.banner)==null?void 0:w.body)&&o.jsx(yo,{className:"AdvDescription",children:(V=d.banner)==null?void 0:V.body})]})]}),d.buttonType!==u.PromotionButtonType.NO_BUTTON&&o.jsx(go,{children:o.jsx(Io,{href:P,style:{backgroundColor:((U=(F=d.banner)==null?void 0:F.ctaButton)==null?void 0:U.color)||"#009dc4",color:((G=(z=d.banner)==null?void 0:z.ctaButton)==null?void 0:G.textColor)||"#fff"},"data-analytics":"button","data-promo-id":E,"data-promo-type":d.type,target:"_blank",children:(W=(K=d.banner)==null?void 0:K.ctaButton)==null?void 0:W.label})})]})},Lo=t.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),Mo=({children:e,direction:s,style:l,className:n,hiding:r})=>o.jsx(B,{direction:s,style:l,hiding:r,className:n,children:o.jsx(Lo,{children:e})}),ko=e=>(e==null?void 0:e.type)===u.PromotionType.INGAME_IAB11_LBAR||(e==null?void 0:e.type)===u.PromotionType.INGAME_IAB21_LBAR,Oo=e=>(e==null?void 0:e.type)===u.PromotionType.INGAME_IAB11||(e==null?void 0:e.type)===u.PromotionType.INGAME_IAB21,Bo=({advertisement:e,close:s,skipTypeCheck:l,skipAutoClose:n,layoutMode:r="side-by-side",sidebar:a,isNotification:c,banner:p,markAsViewed:v,open:i,externalAd:f,controlVideo:y,advertisementPaused:m,togglePause:I})=>e.promotion?c&&e.notification?o.jsx(ro,{open:()=>i==null?void 0:i({fromNotification:!0}),notification:e.notification,promotionId:e.question.id}):!a&&!p&&(l||Oo(e.promotion))?o.jsx(co,{className:"PromoOverlayContainer",children:o.jsx(oe,{markAsViewed:v,promotionId:e.question.id,promotion:e.promotion,onClose:s,open:i,skipAutoClose:n,externalAd:f,controlVideo:y,advertisementPaused:m,togglePause:I})}):a&&(l||ko(e.promotion))?o.jsx(Mo,{className:"PromoSidebarContainer",direction:a,hiding:!1,children:o.jsx(oe,{markAsViewed:v,promotionId:e.question.id,promotion:e.promotion,externalAd:f,onClose:s,open:i,controlVideo:y,skipAutoClose:n,advertisementPaused:m,togglePause:I})}):p?o.jsx(Pe,{promotionId:e.question.id,hiding:!1,promotion:e.promotion,direction:p}):null:null,Ro=t.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),Do=e=>{const s=e.target;if(s instanceof HTMLAnchorElement&&s.target==="_blank"){const l=s.getAttribute("data-promo-id")||"",n=s.getAttribute("data-promo-type")||u.PromotionType.UNSET;s.getAttribute("data-analytics")==="button"&&t.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:l,type:n}}),s.getAttribute("data-analytics")==="banner"&&t.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:l,type:n}})}},qo=({gamification:e,layoutMode:s,skipAutoClose:l,skipTypeCheck:n,sidebar:r,banner:a,notification:c,isMobileScreen:p,persistent:v,externalAd:i,controlVideo:f})=>{var y,m,I;const _=g.useRef(null),A=t.useStore(e.advertisement.$store);t.L(_,{enabled:!!A.data,event:"click",listener:Do});const h=!a&&!r;if(A.data===void 0||!v&&A.isViewed)return null;const x=((I=(m=(y=A==null?void 0:A.data)==null?void 0:y.notification)==null?void 0:m.promotion)==null?void 0:I.mode)===u.NotificationPromotionMode.LOWER_THIRD;return o.jsx(Ro,{ref:_,style:{height:h?"auto":"100%"},className:t.cx_default("SL-AdvertisementUIWrap",p&&"mobile-view",x&&"SL-AdvertisementUIWrap--lower-third"),children:o.jsx(Bo,{skipTypeCheck:n,sidebar:r,banner:a,advertisement:A.data,advertisementPaused:A.isPaused,togglePause:A.togglePause,close:A.close,externalAd:i?A.externalAd:void 0,markAsViewed:e.advertisement.markAsViewed,open:e.advertisement.open,layoutMode:s,isNotification:c,skipAutoClose:l,controlVideo:f})})},de=({sdk:e,sidebar:s,externalAd:l,banner:n,skipAutoClose:r,skipTypeCheck:a,layoutMode:c,isMobileScreen:p,persistent:v,notification:i})=>{const f=t.useStore(e.featuresList.getStore());if(g.useEffect(()=>{if(l){const m=document.createElement("script");m.async=!0,m.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",document.body.appendChild(m)}},[l]),s&&n)return o.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(n&&l)return o.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!f)return null;const y=e.getFeature(u.SdkOverlayType.GAMES);return y?o.jsx(qo,{gamification:y,sidebar:s,banner:n,layoutMode:c,isMobileScreen:p,persistent:v,notification:i,skipTypeCheck:a,skipAutoClose:r,externalAd:l,controlVideo:e.controlVideoPlayer}):null},wo=({event:e,sidebar:s,banner:l,isMobileScreen:n,skipAutoClose:r,persistent:a,theme:c,notification:p,skipTypeCheck:v,externalAd:i})=>{const f=t.useStreamLayer(),y=t.useStreamLayerUI(),m=t.useStreamLayerTheme();return f?i&&!y.promotionExternalAd?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):!i&&y.promotionExternalAd?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):s&&!y.promotionSidebar?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):l&&!y.promotionBanner?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):p&&!y.promotionNotification?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):!l&&!s&&!p&&!y.promotionOverlay?e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e}):o.jsxs("div",{className:"StreamLayerSDK",children:[o.jsx(t.h,{customTheme:c??m.theme,themeMode:m.themeMode,children:o.jsx(de,{sdk:f,sidebar:s,banner:l,isMobileScreen:n,persistent:a,notification:p,skipTypeCheck:v,skipAutoClose:r,layoutMode:"side-by-side",externalAd:i})}),e!==void 0&&o.jsx(t.StreamLayerSDKEvent,{event:e})]}):null};exports.StreamLayerSDKAdvertisement=wo;exports.StreamLayerSDKAdvertisementUI=de;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("./provider.js"),x=require("react"),p=require("./useStreamLayerApp2.js"),me=()=>be,fe=()=>D,ye=o.styled_default("div")({name:"Ue",class:"uyu7xk0",propsAsIs:!1}),ve="fqz8iof",Ae="gxr1krc",xe="h13v49g2",ge="wa4hjtn",he="q1ymob7l",Ie=e=>e==="left"||e==="right"?Ae:ge,_e=e=>e==="left"||e==="right"?xe:he,je=e=>e==="left"?"q1fdesan":e==="right"?"qbseob7":e==="top"?"q75ycmf":"q4whugf",R=({children:e,style:t,className:n,enabled:l=!0,hiding:r,direction:i="left",onAnimationEnd:c})=>s.jsx(ye,{style:t,className:o.cx_default(n,ve,je(i),l&&!r&&Ie(i),l&&r&&_e(i)),onAnimationEnd:c,children:e}),be=o.styled_default("a")({name:"Ve",class:"vgopyvs",propsAsIs:!1}),Ne=o.styled_default("div")({name:"Xe",class:"x1l2v9sz",propsAsIs:!1}),Pe=o.styled_default(me())({name:"Ye",class:"y1rsbbux",propsAsIs:!0}),Se=({promotion:e,promotionId:t,hiding:n,direction:l="bottom"})=>{var r,i;if(!((r=e.additionalBanner)!=null&&r.imageUrl))return null;let c=(i=e.additionalBanner)==null?void 0:i.url;return c&&c.indexOf("http")!==0&&(c=`https://${c}`),s.jsx(R,{direction:l,hiding:n,children:s.jsx(Ne,{className:"BannerContainer",children:s.jsx(Pe,{as:c?"a":"span",className:"BannerLink",href:c,style:{backgroundImage:`url(${e.additionalBanner.imageUrl})`,cursor:c?"pointer":"default"},"data-promo-id":t,"data-promo-type":e.type,"data-analytics":"banner",target:"_blank"})})})},Ee=o.styled_default("div")({name:"ye",class:"yi8uu2r",propsAsIs:!1}),Te=o.styled_default("div")({name:"we",class:"wen854k",propsAsIs:!1}),ke=o.styled_default("div")({name:"Ne",class:"nlclczp",propsAsIs:!1}),Le=o.styled_default("div")({name:"Ie",class:"i1pzq9dr",propsAsIs:!1}),D=o.styled_default("div")({name:"S",class:"s5vuv05",propsAsIs:!1}),Me=o.styled_default(fe())({name:"Ae",class:"a1g1k4vx",propsAsIs:!0}),Ce=o.styled_default("img")({name:"et",class:"e1o3sc8x",propsAsIs:!1}),Oe=o.styled_default("button")({name:"Te",class:"tlks1dc",propsAsIs:!1}),Be=o.styled_default("div")({name:"tt",class:"t1pckims",propsAsIs:!1}),Re=o.styled_default("div")({name:"it",class:"i11ap48y",propsAsIs:!1}),De=o.styled_default("div")({name:"ot",class:"o1n7skcl",propsAsIs:!1}),we=o.styled_default("div")({name:"nt",class:"n1c1yghr",propsAsIs:!1}),qe={[p.NotificationPromotionImagePosition.BOTTOM]:D,[p.NotificationPromotionImagePosition.MIDDLE]:Me},Ve=({src:e,imagePosition:t})=>{const n=qe[t]||D;return s.jsx(n,{children:s.jsx("img",{src:e,alt:""})})},ze=({notification:e,open:t})=>{if(!e||!e.promotion||e.enabled!==p.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:n,body:l,image:r,promotion:i}=e,{sponsorLogo:c,sponsorLogoMode:m,imagePosition:y,ctaButton:a}=i;return s.jsxs(we,{className:"SL_Lower_Third_Notification",onClick:t,children:[s.jsxs(Ee,{children:[s.jsx(Ve,{src:r,imagePosition:y}),s.jsxs(Te,{children:[n&&s.jsx(ke,{children:n}),l&&s.jsx(Le,{children:l})]})]}),s.jsxs(Re,{children:[m!==p.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&s.jsxs(s.Fragment,{children:[s.jsx(Be,{children:s.jsx("img",{src:c,alt:n})}),s.jsx(De,{})]}),s.jsxs(Oe,{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)===p.CtaIconMode.CTA_ICON_TRANSPARENT&&s.jsx(Ce,{src:a==null?void 0:a.ctaIcon,alt:"cta-icon"}),(a==null?void 0:a.label)||"Open"]})]})]})},Ue=()=>L,Fe=()=>L,Ge=()=>oe,Ke=()=>L,We=()=>L,He=()=>o.p1,$e=o.styled_default("div")({name:"st",class:"skov865",propsAsIs:!1}),Xe=o.styled_default("div")({name:"lt",class:"lw55zje",propsAsIs:!1}),Ye=o.styled_default("div")({name:"ct",class:"cp3zokn",propsAsIs:!1}),Je=o.styled_default("div")({name:"ht",class:"hleka6v",propsAsIs:!1}),Qe=o.styled_default("div")({name:"mt",class:"m1dpdc6q",propsAsIs:!1}),L=o.styled_default("div")({name:"_",class:"_xhq0ob",propsAsIs:!1}),J=o.styled_default(Ue())({name:"se",class:"s17r872u",propsAsIs:!0}),oe=o.styled_default(Fe())({name:"Le",class:"lqkz0nn",propsAsIs:!0}),Ze=o.styled_default(Ge())({name:"pt",class:"pxp52sw",propsAsIs:!0}),es=o.styled_default(Ke())({name:"gt",class:"g1nj4e4m",propsAsIs:!0}),ss=o.styled_default(We())({name:"ft",class:"f2xx3so",propsAsIs:!0}),os=o.styled_default("img")({name:"xt",class:"xsepra4",propsAsIs:!1}),ts=o.styled_default("button")({name:"vt",class:"vjnv577",propsAsIs:!1}),ls=o.styled_default(He())({name:"ut",class:"u1720p2l",propsAsIs:!0}),ns=o.styled_default("div")({name:"bt",class:"b58k3cq",propsAsIs:!1}),as={[p.NotificationPromotionImagePosition.UNSET]:J,[p.NotificationPromotionImagePosition.FIT]:J,[p.NotificationPromotionImagePosition.CENTERED]:oe,[p.NotificationPromotionImagePosition.BOTTOM]:Ze,[p.NotificationPromotionImagePosition.SOLID]:es,[p.NotificationPromotionImagePosition.MIDDLE]:ss},is=({src:e,imagePosition:t})=>{const n=as[t];return s.jsx(n,{children:s.jsx("img",{src:e,alt:""})})},rs=({notification:e,open:t,promotionId:n,hiding:l,direction:r="left"})=>{if(!e||!e.promotion||e.enabled!==p.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(e.promotion.mode===p.NotificationPromotionMode.LOWER_THIRD)return s.jsx(ze,{notification:e,open:t});const{title:i,body:c,image:m,promotion:y}=e,{sponsorLogo:a,sponsorLogoMode:v,imagePosition:f,ctaButton:u}=y;return s.jsx(R,{className:"SL_Rich_Notification",direction:r,hiding:l,children:s.jsxs(Xe,{onClick:t,children:[v!==p.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&s.jsx(ns,{children:s.jsx("img",{src:a,alt:i})}),s.jsxs($e,{children:[s.jsx(is,{src:m,imagePosition:f}),s.jsxs(Ye,{children:[i&&s.jsx(Je,{children:i}),c&&s.jsx(Qe,{children:c})]}),s.jsxs(ts,{name:"promo-button",style:{color:u==null?void 0:u.textColor,backgroundColor:u==null?void 0:u.color},children:[(u==null?void 0:u.ctaIcon)&&(u==null?void 0:u.ctaIconMode)===p.CtaIconMode.CTA_ICON_TRANSPARENT&&s.jsx(os,{src:u==null?void 0:u.ctaIcon,alt:"cta-icon"}),(u==null?void 0:u.label)||"Open"]}),s.jsx(ls,{name:"chevronRight"})]})]})})},ds=(e,t,{onPlay:n,onStop:l,onProgress:r})=>{const i=google.ima;let c=new i.AdDisplayContainer(e),m=new i.AdsLoader(c),y=new i.AdsRequest,a;m.addEventListener(i.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,f=>{a=f.getAdsManager(e),n&&a.addEventListener(i.AdEvent.Type.STARTED,n),l&&a.addEventListener(i.AdEvent.Type.COMPLETE,l),r&&a.addEventListener(i.AdEvent.Type.AD_PROGRESS,u=>r(u.getAdData())),a.init(e.clientWidth,e.clientHeight,i.ViewMode.NORMAL),a.start()},!1),m.addEventListener(i.AdErrorEvent.Type.AD_ERROR,()=>{console.log("ad error"),l==null||l()},!1),y.linearAdSlotWidth=e.clientWidth,y.linearAdSlotHeight=e.clientHeight,y.adTagUrl=t,m.requestAds(y);const v=()=>{a==null||a.destroy(),m==null||m.destroy(),c==null||c.destroy(),c=void 0,m=void 0,y=void 0,a=void 0};return()=>{try{c.initialize()}catch(f){l==null||l(),console.log("AdsManager could not be started",f)}return v}},cs=o.styled_default("div")({name:"At",class:"adac9vz",propsAsIs:!1}),te=o.styled_default("div")({name:"Me",class:"mkswgvt",propsAsIs:!1}),le=o.styled_default("div")({name:"Oe",class:"o192mgxa",propsAsIs:!1}),ne=o.styled_default("div")({name:"ke",class:"k1gnq24q",propsAsIs:!1}),ae="coq8lkc",Q=o.styled_default("img")({name:"le",class:"l4v1wna",propsAsIs:!1}),us=o.styled_default("div")({name:"Tt",class:"tmkv3p8",propsAsIs:!1}),ie=o.styled_default("div")({name:"Pe",class:"p2t6hr7",propsAsIs:!1}),ps=o.styled_default("img")({name:"Et",class:"e1pcxfds",propsAsIs:!1}),ms="liwzk4s",Z=o.styled_default("div")({name:"ce",class:"c1a201jb",propsAsIs:!1}),fs=o.styled_default("div")({name:"Mt",class:"m15ldj84",propsAsIs:!1}),ys=o.styled_default("div")({name:"Ot",class:"o476kyw",propsAsIs:!1}),vs=o.styled_default("div")({name:"kt",class:"k1hywf8s",propsAsIs:!1}),re=o.styled_default("div")({name:"Se",class:"sdkny8g",propsAsIs:!1}),As=o.styled_default("span")({name:"Ct",class:"cbdjlwu",propsAsIs:!1}),xs=o.styled_default("div")({name:"Pt",class:"p1f1xars",propsAsIs:!1}),gs=o.styled_default("a")({name:"St",class:"sutwicq",propsAsIs:!1}),hs=o.styled_default("div")({name:"_t",class:"_1okt91f",propsAsIs:!1}),Is="jhfc43o",_s=o.styled_default("div")({name:"Rt",class:"rxbm36u",propsAsIs:!1}),ee=o.styled_default("div")({name:"he",class:"har3kpv",propsAsIs:!1}),js=o.styled_default("div")({name:"$t",class:"_113zdc5",propsAsIs:!1}),bs=({time:e,adCount:t,adPosition:n})=>{const l=Math.floor(e/60),r=e-l*60;return l===0&&r===0&&t===n?null:s.jsxs(_s,{children:[t>1&&s.jsxs(s.Fragment,{children:[s.jsxs(ee,{children:[n," of ",t]}),s.jsx(js,{})]}),s.jsxs(ee,{children:[l,":",r<10?`0${r}`:r]})]})},Ns=o.styled_default("div")({name:"zt",class:"z1brcd18",propsAsIs:!1}),Ps=o.styled_default("div")({name:"Bt",class:"b1xio38j",propsAsIs:!1}),Ss="u849s5c",Es="f1yp4da5",Ts="gjcla8p",ks=({promotion:e,controlVideo:t,promotionId:n,onClose:l,externalAd:r,skipAutoClose:i})=>{var c;const m=x.useRef(null),[y,a]=x.useState(!1),[v,f]=x.useState(0),[u,g]=x.useState(0),[j,A]=x.useState(0),h=x.useRef(),I=x.useCallback(()=>{f(0),g(0),A(0),a(!1),t==null||t({muted:!1})},[t]);x.useEffect(()=>{if(r!=null&&r.url&&m.current){I();const _=ds(m.current,r.url,{onPlay:()=>{o.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:n,type:e.type,hasBanner:!1}}),t==null||t({muted:!0}),a(!0)},onStop:()=>{l==null||l(),I()},onProgress:b=>{f(Math.round(b.duration-b.currentTime)),g(b.totalAds),A(b.adPosition)}})();return h.current=_,()=>{h.current=void 0,_()}}},[r==null?void 0:r.url,t,I,n,e.type,l]);const S=((c=e.sponsor)==null?void 0:c.logo)&&e.logoMode===p.PromotionLogoMode.CENTER;return s.jsxs(te,{className:"PromoOverlay",children:[s.jsxs(le,{children:[s.jsx(ne,{className:o.cx_default(!S&&ae),children:s.jsx(re,{style:{transform:"scale(1.5)"},children:"Ad"})}),s.jsxs(Ps,{children:[s.jsx(bs,{time:v,adCount:u,adPosition:j}),i&&s.jsx(o.ge,{className:"ClosePromoIcon",close:()=>{var _;(_=h.current)==null||_.call(h),l==null||l(),I()}})]})]}),s.jsx(ie,{className:o.cx_default(Ss,y&&Es,!y&&Ts),children:s.jsx(Ns,{ref:m})})]})},se=e=>{var t,n,l,r,i,c,m,y,a,v,f,u,g,j,A,h,I,S,_,b,w,q,V,z,U,F,G,K,W,H;const{promotion:d,open:$,advertisementPaused:ce,togglePause:N,controlVideo:E,skipAutoClose:ue,promotionId:T,onClose:pe,markAsViewed:M,externalAd:X}=e,C=d.type===p.PromotionType.INGAME_IAB11_LBAR||d.type===p.PromotionType.INGAME_IAB11,O=((t=d.sponsor)==null?void 0:t.logo)&&d.logoMode===p.PromotionLogoMode.CENTER,Y=!!((l=(n=d.banner)==null?void 0:n.video)!=null&&l.url),k=d.autoPlayVideo===p.AutoPlayVideo.ENABLED;if(x.useEffect(()=>{N==null||N(Y||k),$==null||$()},[]),x.useEffect(()=>{T&&d.type&&M&&M()},[T,d.type,M]),x.useEffect(()=>()=>{E==null||E({muted:!1})},[E]),X)return s.jsx(ks,{...e,externalAd:X});let P=(r=d.banner)==null?void 0:r.url;P&&P.indexOf("http")!==0&&(P=`https://${P}`);let B=!0;return Y&&(!ce||!k?B=!0:B=!1),s.jsxs(te,{className:"PromoOverlay",children:[s.jsxs(le,{children:[s.jsxs(ne,{className:o.cx_default(!O&&ae),children:[((i=d.sponsor)==null?void 0:i.logo)&&d.logoMode===p.PromotionLogoMode.LEFT&&s.jsx(Q,{className:"PromoSponsorLogo",src:(c=d.sponsor)==null?void 0:c.logo,alt:"promo"}),s.jsxs(ys,{style:{paddingLeft:(m=d.sponsor)!=null&&m.logo&&d.logoMode===p.PromotionLogoMode.LEFT?"0px":"8px"},children:[((y=d.sponsor)==null?void 0:y.logo)&&d.logoMode===p.PromotionLogoMode.LEFT&&s.jsx(us,{children:(a=d.sponsor)==null?void 0:a.name}),s.jsxs(vs,{className:"SponsorText",children:[s.jsx(re,{children:"AD"}),s.jsx(As,{children:"SPONSORED"})]})]})]}),s.jsx(o.ge,{className:"ClosePromoIcon",close:pe,autoClose:(v=d.closeTimer)==null?void 0:v.auto,duration:ue?0:(f=d.closeTimer)==null?void 0:f.seconds,isPlaying:B})]}),s.jsxs(ie,{children:[O&&s.jsx(Q,{className:ms,src:(u=d.sponsor)==null?void 0:u.logo,alt:"promo"}),s.jsx(Z,{children:(j=(g=d.banner)==null?void 0:g.video)!=null&&j.url?s.jsx(o.he,{source:(h=(A=d.banner)==null?void 0:A.video)==null?void 0:h.url,poster:(S=(I=d.banner)==null?void 0:I.video)==null?void 0:S.thumbnailUrl,aspectRatio:C?"1/1":"16/9",onPause:()=>{k&&(N==null||N(!0))},onPlay:()=>{o.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:T,type:d.type,hasBanner:!1}}),N==null||N(!1)},controlVideo:E,autoPlay:k}):(_=d.banner)!=null&&_.imageUrl?s.jsx(ps,{style:C?{aspectRatio:"1/1"}:{},src:(b=d.banner)==null?void 0:b.imageUrl,alt:"promo"}):null}),!C&&s.jsxs(Z,{children:[((w=d.banner)==null?void 0:w.title)&&s.jsx(hs,{className:o.cx_default("AdvTitle",O&&Is),children:(q=d.banner)==null?void 0:q.title}),((V=d.banner)==null?void 0:V.body)&&s.jsx(fs,{className:"AdvDescription",children:(z=d.banner)==null?void 0:z.body})]})]}),d.buttonType!==p.PromotionButtonType.NO_BUTTON&&s.jsx(xs,{children:s.jsx(gs,{href:P,style:{backgroundColor:((F=(U=d.banner)==null?void 0:U.ctaButton)==null?void 0:F.color)||"#009dc4",color:((K=(G=d.banner)==null?void 0:G.ctaButton)==null?void 0:K.textColor)||"#fff"},"data-analytics":"button","data-promo-id":T,"data-promo-type":d.type,target:"_blank",children:(H=(W=d.banner)==null?void 0:W.ctaButton)==null?void 0:H.label})})]})},Ls=o.styled_default("div")({name:"Wt",class:"wbguw5z",propsAsIs:!1}),Ms=({children:e,direction:t,style:n,className:l,hiding:r})=>s.jsx(R,{direction:t,style:n,hiding:r,className:l,children:s.jsx(Ls,{children:e})}),Cs=e=>(e==null?void 0:e.type)===p.PromotionType.INGAME_IAB11_LBAR||(e==null?void 0:e.type)===p.PromotionType.INGAME_IAB21_LBAR,Os=e=>(e==null?void 0:e.type)===p.PromotionType.INGAME_IAB11||(e==null?void 0:e.type)===p.PromotionType.INGAME_IAB21,Bs=({advertisement:e,close:t,skipTypeCheck:n,skipAutoClose:l,layoutMode:r="side-by-side",sidebar:i,isNotification:c,banner:m,markAsViewed:y,open:a,externalAd:v,controlVideo:f,advertisementPaused:u,togglePause:g})=>e.promotion?c&&e.notification?s.jsx(rs,{open:()=>a==null?void 0:a({fromNotification:!0}),notification:e.notification,promotionId:e.question.id}):!i&&!m&&(n||Os(e.promotion))?s.jsx(cs,{className:"PromoOverlayContainer",children:s.jsx(se,{markAsViewed:y,promotionId:e.question.id,promotion:e.promotion,onClose:t,open:a,skipAutoClose:l,externalAd:v,controlVideo:f,advertisementPaused:u,togglePause:g})}):i&&(n||Cs(e.promotion))?s.jsx(Ms,{className:"PromoSidebarContainer",direction:i,hiding:!1,children:s.jsx(se,{markAsViewed:y,promotionId:e.question.id,promotion:e.promotion,externalAd:v,onClose:t,open:a,controlVideo:f,skipAutoClose:l,advertisementPaused:u,togglePause:g})}):m?s.jsx(Se,{promotionId:e.question.id,hiding:!1,promotion:e.promotion,direction:m}):null:null,Rs=o.styled_default("div")({name:"Vt",class:"v13knq7z",propsAsIs:!1}),Ds=e=>{const t=e.target;if(t instanceof HTMLAnchorElement&&t.target==="_blank"){const n=t.getAttribute("data-promo-id")||"",l=t.getAttribute("data-promo-type")||p.PromotionType.UNSET;t.getAttribute("data-analytics")==="button"&&o.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:n,type:l,hasBanner:!1}}),t.getAttribute("data-analytics")==="banner"&&o.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:n,type:l,hasBanner:!1}})}},ws=({gamification:e,layoutMode:t,skipAutoClose:n,skipTypeCheck:l,sidebar:r,banner:i,notification:c,isMobileScreen:m,persistent:y,externalAd:a,controlVideo:v})=>{var f,u,g;const j=x.useRef(null),A=o.useStore(e.advertisement.$store);o.L(j,{enabled:!!A.data,event:"click",listener:Ds});const h=!i&&!r;if(A.data===void 0||!y&&A.isViewed)return null;const I=((g=(u=(f=A==null?void 0:A.data)==null?void 0:f.notification)==null?void 0:u.promotion)==null?void 0:g.mode)===p.NotificationPromotionMode.LOWER_THIRD;return s.jsx(Rs,{ref:j,style:{height:h?"auto":"100%"},className:o.cx_default("SL-AdvertisementUIWrap",m&&"mobile-view",I&&"SL-AdvertisementUIWrap--lower-third"),children:s.jsx(Bs,{skipTypeCheck:l,sidebar:r,banner:i,advertisement:A.data,advertisementPaused:A.isPaused,togglePause:A.togglePause,close:A.close,externalAd:a?A.externalAd:void 0,markAsViewed:e.advertisement.markAsViewed,open:e.advertisement.open,layoutMode:t,isNotification:c,skipAutoClose:n,controlVideo:v})})},de=({sdk:e,sidebar:t,externalAd:n,banner:l,skipAutoClose:r,skipTypeCheck:i,layoutMode:c,isMobileScreen:m,persistent:y,notification:a})=>{const v=o.useStore(e.featuresList.getStore());if(x.useEffect(()=>{if(n){const u=document.createElement("script");u.async=!0,u.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",document.body.appendChild(u)}},[n]),t&&l)return s.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(l&&n)return s.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!v)return null;const f=e.getFeature(p.SdkOverlayType.GAMES);return f?s.jsx(ws,{gamification:f,sidebar:t,banner:l,layoutMode:c,isMobileScreen:m,persistent:y,notification:a,skipTypeCheck:i,skipAutoClose:r,externalAd:n,controlVideo:e.controlVideoPlayer}):null},qs=({event:e,sidebar:t,banner:n,isMobileScreen:l,skipAutoClose:r,persistent:i,theme:c,notification:m,skipTypeCheck:y,externalAd:a})=>{const v=o.useStreamLayer(),f=o.useStreamLayerUI(),u=o.useStreamLayerTheme();return v?a&&!f.promotionExternalAd?e!==void 0&&s.jsx(o.StreamLayerSDKEvent,{event:e}):!a&&f.promotionExternalAd?e!==void 0&&s.jsx(o.StreamLayerSDKEvent,{event:e}):t&&!f.promotionSidebar?e!==void 0&&s.jsx(o.StreamLayerSDKEvent,{event:e}):n&&!f.promotionBanner?e!==void 0&&s.jsx(o.StreamLayerSDKEvent,{event:e}):m&&!f.promotionNotification?e!==void 0&&s.jsx(o.StreamLayerSDKEvent,{event:e}):!n&&!t&&!m&&!f.promotionOverlay?e!==void 0&&s.jsx(o.StreamLayerSDKEvent,{event:e}):s.jsxs("div",{className:"StreamLayerSDK",children:[s.jsx(o.h,{customTheme:c??u.theme,themeMode:u.themeMode,children:s.jsx(de,{sdk:v,sidebar:t,banner:n,isMobileScreen:l,persistent:i,notification:m,skipTypeCheck:y,skipAutoClose:r,layoutMode:"side-by-side",externalAd:a})}),e!==void 0&&s.jsx(o.StreamLayerSDKEvent,{event:e})]}):null};exports.StreamLayerSDKAdvertisement=qs;exports.StreamLayerSDKAdvertisementUI=de;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js");exports.default=e.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js");exports.default=e.GR;
|
package/lib/classic/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js"),r=require("./notification.js");exports.StreamLayerProvider=e.StreamLayerProvider;exports.StreamLayerSDKEvent=e.StreamLayerSDKEvent;exports.StreamLayerSDKReact=e.StreamLayerSDKReact;exports.StreamLayerThemeProvider=e.h;exports.useStreamLayer=e.useStreamLayer;exports.useStreamLayerTheme=e.useStreamLayerTheme;exports.useStreamLayerUI=e.useStreamLayerUI;exports.StreamLayerSDKNotification=r.StreamLayerSDKNotification;exports.StreamLayerSDKNotificationUI=r.StreamLayerSDKNotificationUI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),i=require("./provider.js"),l=require("react"),h=require("./useStreamLayerApp2.js"),p=()=>i.jr,S=i.styled_default(p())({name:"y",class:"y1tj7gx6",propsAsIs:!0}),g=({gamification:e,persistent:n,skipAutoClose:o,hideHeader:a,insightId:s})=>{const t=l.useRef(""),c=i.useStore(e.openedQuestion.$store);return l.useEffect(()=>s?(!n||e.isOpenedQuestion(s)||(t.current=s,e.getFeedItem(s).then(r=>{var d;t.current===s&&((d=r==null?void 0:r.attributes)==null?void 0:d.attributes.case)==="insight"&&e.openQuestion(s,r)})),()=>{t.current=""}):(e.activeQuestionId.subscribe(({data:r})=>{var d;r&&((d=r.feedItem)==null?void 0:d.type)==="insight"&&(!n||e.isOpenedQuestion(r.feedItem.id)||(t.current=r.feedItem.id,e.openQuestion(r.feedItem.id,r.feedItem))),!r&&t.current&&(e.closeQuestion(t.current),t.current="")}),()=>{}),[e,n,s]),c?u.jsx(S,{skipAutoClose:o,hideHeader:a,gamification:e,hideSponsor:!0}):null},m=({sdk:e,persistent:n,skipAutoClose:o,insightId:a,hideHeader:s})=>{if(!i.useStore(e.featuresList.getStore()))return null;const t=e.getFeature(h.SdkOverlayType.GAMES);return t?u.jsx(g,{insightId:a,persistent:n,hideHeader:s,gamification:t,skipAutoClose:o}):null},y=({event:e,theme:n,hideHeader:o,skipAutoClose:a,persistent:s})=>{const t=i.useStreamLayer(),c=i.useStreamLayerTheme();return t?u.jsxs("div",{className:"StreamLayerSDK",children:[u.jsx(i.h,{customTheme:n??c.theme,themeMode:c.themeMode,children:u.jsx(m,{skipAutoClose:a,sdk:t,hideHeader:o,persistent:s})}),e!==void 0&&u.jsx(i.StreamLayerSDKEvent,{event:e})]}):null};exports.StreamLayerSDKInsight=y;exports.StreamLayerSDKInsightUI=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js"),d=require("./useStreamLayerApp2.js"),s=require("react/jsx-runtime"),p=require("react"),m=e.styled_default("div")({name:"Media",class:"m1bcvojl",propsAsIs:!1}),q=()=>m,w=e.styled_default(q())({name:"MediaImgBottom",class:"m58gin0",propsAsIs:!0}),E=()=>m,v=e.styled_default(E())({name:"MediaImgSolid",class:"m1atm8do",propsAsIs:!0}),M=()=>m,Q=e.styled_default(M())({name:"MediaImgRounded",class:"myx3xoi",propsAsIs:!0}),L=()=>m,D=e.styled_default(L())({name:"MediaImgCentered",class:"m1bwv0gx",propsAsIs:!0}),O=()=>m,R=e.styled_default(O())({name:"MediaImgInsight",class:"mntjanp",propsAsIs:!0}),z=e.styled_default("div")({name:"VideoIcon",class:"v1kofb47",propsAsIs:!1}),B={[d.QuestionImages.UNSET]:v,[d.QuestionImages.NONE]:v,[d.QuestionImages.ROUNDED]:Q,[d.QuestionImages.CENTERED]:D,[d.QuestionImages.TRANSPARENT]:w},A=({src:n,imageMode:a=d.QuestionImages.UNSET,withVideo:i,fromInsight:l})=>{if(a===d.QuestionImages.NONE)return null;const t=l?R:B[a];return s.jsxs(t,{children:[s.jsx("img",{src:n,alt:""}),i&&s.jsx(z,{children:s.jsx(e.f1,{name:"icon-play"})})]})},P=e.styled_default("div")({name:"NotificationContent",class:"nuraq9m",propsAsIs:!1}),U=e.styled_default("div")({name:"NotificationContainer",class:"ns1nzpg",propsAsIs:!1}),N=e.styled_default("div")({name:"Body",class:"b1j59nzs",propsAsIs:!1}),V=e.styled_default("div")({name:"Title",class:"t9vmnpp",propsAsIs:!1}),F=e.styled_default("button")({name:"Button",class:"b14ivj5k",propsAsIs:!1}),K=()=>e.f1,W=e.styled_default(K())({name:"StyledChevronRight",class:"s1atci8n",propsAsIs:!0}),G=e.styled_default("div")({name:"QuoteWrap",class:"q4w8jgs",propsAsIs:!1}),Y=e.styled_default("blockquote")({name:"Quote",class:"qaa0kez",propsAsIs:!1}),H=e.styled_default("div")({name:"Body",class:"b1wvd52w",propsAsIs:!1}),J=e.styled_default("div")({name:"Container",class:"ccvukea",propsAsIs:!1}),X=({image:n,tweet:a,account:i,accountVerified:l,body:t,title:c})=>{var r;return s.jsxs(J,{children:[c&&s.jsx(G,{children:s.jsx(Y,{children:c})}),s.jsx(e.D$1,{image:n,name:(r=a==null?void 0:a.meta)==null?void 0:r.accountName,userName:i,verified:l,createdTweet:a==null?void 0:a.date}),s.jsx(H,{children:e.S$2(t)})]})},Z=({title:n,questionType:a,questionTypeData:i})=>s.jsxs(N,{children:[s.jsx(e.x$2,{questionTypeData:i,questionType:a,questionStatus:d.QuestionStatus.UNSET}),n&&s.jsx(V,{children:n})]}),ss=({tweet:n})=>n?s.jsx(N,{children:s.jsx(X,{...n,controlVideo:()=>{}})}):null,es=({action:n,questionType:a,inApp:i,insight:l,tweet:t})=>{var c;const r=e.e[a],o=e.o[a];if(!r||!i||!i.notification)return null;const{title:y,image:f,imageMode:I}=i.notification;let u=f;a===d.QuestionType.TWEET&&t!=null&&t.tweetMedia&&(u=t.tweetMedia.image),I===d.QuestionImages.NONE&&(u="");const j=i.useMediaFromContent&&(l==null?void 0:l.image),h=a===d.QuestionType.TWEET&&((c=t==null?void 0:t.tweetMedia)==null?void 0:c.video)||a===d.QuestionType.FACTOID&&(l==null?void 0:l.video);return s.jsx(U,{className:"SL_InApp",onClick:n,children:s.jsxs(P,{style:u?{}:{paddingLeft:"1.5rem"},children:[u&&!j&&s.jsx(A,{src:u,imageMode:I,withVideo:!!h}),j&&s.jsx(A,{src:j,fromInsight:!0,withVideo:!!h}),a===d.QuestionType.TWEET?s.jsx(ss,{tweet:t}):s.jsx(Z,{questionTypeData:r,questionType:a,title:y}),s.jsx(F,{name:"inapp-button",children:o||"Open"}),s.jsx(W,{name:"chevronRight"})]})})},ts=e.styled_default("div")({name:"NotificationContainer",class:"n11jcrxe",propsAsIs:!1}),$=e.styled_default("img")({name:"Icon",class:"i1vmpt6u",propsAsIs:!1}),ns=e.styled_default("div")({name:"IconContainer",class:"i180665s",propsAsIs:!1}),as=()=>e.f1,is=e.styled_default(as())({name:"TitleIcon",class:"t16zzzei",propsAsIs:!0}),ls=()=>e.b,os=e.styled_default(ls())({name:"Close",class:"c1sur0q2",propsAsIs:!0}),ds=e.styled_default("div")({name:"Body",class:"bai9j52",propsAsIs:!1}),cs=e.styled_default("div")({name:"Title",class:"t1bnt25p",propsAsIs:!1}),rs=e.styled_default("div")({name:"Description",class:"dmixjec",propsAsIs:!1}),us=e.styled_default("button")({name:"Button",class:"b1ubkw1q",propsAsIs:!1}),ps=({open:n,close:a,...i})=>{var l,t;return s.jsxs(ts,{onClick:()=>{n==null||n(),i&&(i.instantOpen=!0)},children:[s.jsxs(ns,{children:[s.jsx($,{className:"on-light",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification.png"}),s.jsx($,{className:"on-dark",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification-dark.png"})]}),s.jsxs(ds,{children:[s.jsxs(cs,{children:[s.jsx(is,{name:"icon-trophy-solid"}),(l=i==null?void 0:i.titleCard)==null?void 0:l.title]}),s.jsxs(rs,{children:[s.jsx("span",{children:(t=i==null?void 0:i.titleCard)==null?void 0:t.subtitle}),s.jsx(us,{name:"inapp-button",children:"Play Now"})]})]}),s.jsx(os,{close:c=>{c==null||c.stopPropagation(),a==null||a()}})]})},ms=e.styled_default("div")({name:"Container",class:"cef8huz",propsAsIs:!1}),ys=()=>e.f1,fs=e.styled_default(ys())({name:"CheckIcon",class:"c1mo15kk",propsAsIs:!0}),js=()=>e.f1,xs=e.styled_default(js())({name:"PredictionIcon",class:"p16zkqnm",propsAsIs:!0}),Is=e.styled_default("div")({name:"PredictionIconContainer",class:"pjszi7a",propsAsIs:!1}),hs=e.styled_default("div")({name:"BodyContainer",class:"bftbmo3",propsAsIs:!1}),vs=e.styled_default("div")({name:"Body",class:"barrbyu",propsAsIs:!1}),As=e.styled_default("div")({name:"Subtitle",class:"sz7237i",propsAsIs:!1}),$s=({step:n,children:a,answer:i,state:l="pending"})=>s.jsxs(ms,{children:[s.jsx(Is,{children:s.jsx(xs,{name:"icon-prediction"})}),s.jsx(hs,{children:s.jsx(vs,{children:a},n)}),s.jsx(As,{className:l,children:s.jsxs("div",{children:[s.jsx(fs,{name:"icon-check"}),"Your Pick: ",i]})})]}),_s=e.styled_default("div")({name:"Container",class:"ckyzolp",propsAsIs:!1}),x=e.styled_default("div")({name:"Line",class:"l16t1zr7",propsAsIs:!1}),gs=()=>x,Ts=e.styled_default(gs())({name:"Line1",class:"le78kvg",propsAsIs:!0}),Ns=()=>x,Cs=e.styled_default(Ns())({name:"Line2",class:"l1o7966d",propsAsIs:!0}),Ss=()=>x,bs=e.styled_default(Ss())({name:"Line3",class:"lu9lyxq",propsAsIs:!0}),ks=()=>s.jsxs(_s,{children:[s.jsx(Ts,{children:s.jsx("div",{})}),s.jsx(Cs,{children:s.jsx("div",{})}),s.jsx(bs,{children:s.jsx("div",{})})]}),qs=e.styled_default("div")({name:"Container",class:"c10jy6zf",propsAsIs:!1}),ws=()=>e.f1,Es=e.styled_default(ws())({name:"CheckIcon",class:"c1c7scay",propsAsIs:!0}),Ms=()=>s.jsxs(qs,{children:[s.jsx(Es,{name:"icon-check"})," Prediction results are in!"]}),Qs=e.styled_default("div")({name:"Container",class:"cf6k2yy",propsAsIs:!1}),Ls=e.styled_default("div")({name:"Caption",class:"c1c8xjus",propsAsIs:!1}),Ds=e.styled_default("div")({name:"Title",class:"t1d1uekn",propsAsIs:!1}),Os=({title:n})=>s.jsxs(Qs,{children:[s.jsx(Ls,{children:"Results for"}),s.jsx(Ds,{children:n})]}),C=e.styled_default("div")({name:"Container",class:"c181a1as",propsAsIs:!1}),S=e.styled_default("div")({name:"Title",class:"t1cduox6",propsAsIs:!1}),Rs=()=>e.f1,b=e.styled_default(Rs())({name:"CorrectIcon",class:"c1onrv6j",propsAsIs:!0}),zs=()=>b,Bs=e.styled_default(zs())({name:"InCorrectIcon",class:"i17n9o7e",propsAsIs:!0}),Ps=()=>s.jsxs(C,{children:[s.jsxs(S,{children:["Congratulations!",s.jsx("br",{}),"You answered correctly."]}),s.jsx(b,{name:"icon-check"})]}),Us=({title:n})=>s.jsxs(C,{children:[s.jsxs(S,{children:["Better luck next time!",s.jsx("br",{}),"Correct: ",n]}),s.jsx(Bs,{name:"icon-cross"})]}),Vs=e.styled_default("div")({name:"Container",class:"cnxgcs2",propsAsIs:!1}),Fs=e.styled_default("div")({name:"Title",class:"t903f8n",propsAsIs:!1}),Ks=()=>e.f1,Ws=e.styled_default(Ks())({name:"CheckIcon",class:"ceyu3qj",propsAsIs:!0}),Gs=({points:n})=>s.jsxs(Vs,{children:[s.jsxs(Fs,{children:["You won ",s.jsx(e.d,{delay:.5,prefix:"+",suffix:" points",value:n})]}),s.jsx(Ws,{name:"icon-trophy-solid"})]}),_=e.styled_default("div")({name:"Container",class:"cq3agu2",propsAsIs:!1}),g=e.styled_default("div")({name:"Body",class:"b16qj0do",propsAsIs:!1}),T={1:3e3,2:4e3,3:4e3,4:4e3},Ys=({close:n,action:a,setStep:i,votedAnswer:l,correct:t,correctAnswerTitle:c,questionTitle:r,step:o})=>{if(p.useEffect(()=>{if(i){const f=setTimeout(()=>{T[o+1]&&(t||o<3)?i(o+1):n==null||n()},T[o]);return()=>{f&&clearTimeout(f)}}return()=>{}},[i,o,n,t]),o===1)return s.jsx(_,{children:s.jsx(g,{children:s.jsx(Ms,{})})});let y="pending";return(o===3||o===4)&&(y=t?"correct":"incorrect"),s.jsx(_,{onClick:()=>a==null?void 0:a(),children:s.jsxs(g,{children:[o!==1&&s.jsx(ks,{},o),s.jsxs($s,{state:y,step:o,answer:(l==null?void 0:l.title)||"unknown",children:[o===2&&s.jsx(Os,{title:r||"unknown"}),o===3&&t&&s.jsx(Ps,{}),o===3&&!t&&s.jsx(Us,{title:c||"unknown"}),o===4&&s.jsx(Gs,{points:(l==null?void 0:l.points)||0})]})]})})},Hs=({close:n,action:a,votedAnswer:i,correct:l,correctAnswerTitle:t,questionTitle:c})=>{const[r,o]=p.useState(1);return s.jsx(Ys,{close:n,action:a,votedAnswer:i,correct:l,correctAnswerTitle:t,questionTitle:c,setStep:o,step:r,title:""})},Js=e.styled_default("div")({name:"NotificationContainer",class:"n1i4h28u",propsAsIs:!1}),Xs=n=>s.jsx(Js,{children:s.jsx(Hs,{...n})}),k=({sdk:n})=>{const[a]=p.useState(n.getNotificationsStore()),i=e.useStore(a),l=n.getFeature(d.SdkOverlayType.GAMES),t=p.useMemo(()=>n.getActiveNotification(),[n,i]);return p.useEffect(()=>{t&&e.eventBus.emit("notification",{action:"rendered",payload:{questionId:t.data.questionId,questionType:t.data.questionType}})},[t]),t&&t.type===e.NotificationType.QUESTION_RESOLVED?t.data.question&&t.data.questionType===d.QuestionType.PREDICTION?s.jsx(Xs,{action:t.action,close:t.close,...t.data.question}):null:t&&t.type===e.NotificationType.ONBOARDING?t.data.onboarding?s.jsx(ps,{open:l==null?void 0:l.openFeature,close:t.close,...t.data.onboarding}):null:t&&s.jsx(es,{...t.data,action:t.action})},Zs=({theme:n})=>{const a=e.useStreamLayer(),i=e.useStreamLayerTheme(),l=e.useStreamLayerUI();return a&&l.appNotification?l.app?null:s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(e.h,{customTheme:n??i.theme,themeMode:i.themeMode,children:s.jsx(k,{sdk:a})})}):null};exports.StreamLayerSDKNotification=Zs;exports.StreamLayerSDKNotificationUI=k;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),e=require("./provider.js"),u=require("react"),d=require("./useStreamLayerApp2.js"),E=()=>f,Q=()=>f,O=()=>f,z=()=>f,D=()=>f,f=e.styled_default("div")({name:"g",class:"g1mxl69i",propsAsIs:!1}),L=e.styled_default(E())({name:"V",class:"v1jt3w2c",propsAsIs:!0}),I=e.styled_default(Q())({name:"I",class:"i178msgc",propsAsIs:!0}),M=e.styled_default(O())({name:"W",class:"witns0f",propsAsIs:!0}),C=e.styled_default(z())({name:"G",class:"gw2eqv8",propsAsIs:!0}),R=e.styled_default(D())({name:"H",class:"h8e6tlf",propsAsIs:!0}),P=e.styled_default("div")({name:"K",class:"k1d4kk25",propsAsIs:!1}),U={[d.QuestionImages.UNSET]:I,[d.QuestionImages.NONE]:I,[d.QuestionImages.ROUNDED]:M,[d.QuestionImages.CENTERED]:C,[d.QuestionImages.TRANSPARENT]:L},_=({src:l,imageMode:a=d.QuestionImages.UNSET,withVideo:n,fromInsight:i})=>{if(a===d.QuestionImages.NONE)return null;const t=i?R:U[a];return s.jsxs(t,{children:[s.jsx("img",{src:l,alt:""}),n&&s.jsx(P,{children:s.jsx(e.p1,{name:"icon-play"})})]})},V=()=>e.p1,K=()=>e.p1,F=()=>e.ge,W=()=>e.p1,B=()=>e.p1,G=()=>j,H=()=>j,Y=()=>j,Z=()=>e.p1,X=()=>e.p1,$=()=>k,J=()=>e.p1,ss=e.styled_default("div")({name:"Z",class:"z1qm1hyz",propsAsIs:!1}),es=e.styled_default("div")({name:"tt",class:"t27jvdr",propsAsIs:!1}),w=e.styled_default("div")({name:"L",class:"l1jox3sj",propsAsIs:!1}),ts=e.styled_default("div")({name:"et",class:"e19jnjng",propsAsIs:!1}),ls=e.styled_default("button")({name:"it",class:"ir43pdl",propsAsIs:!1}),as=e.styled_default(V())({name:"nt",class:"nbnqqq5",propsAsIs:!0}),ns=e.styled_default("div")({name:"ot",class:"o1bhnjnl",propsAsIs:!1}),is=e.styled_default("blockquote")({name:"rt",class:"r13lqzum",propsAsIs:!1}),os=e.styled_default("div")({name:"at",class:"a167n9j1",propsAsIs:!1}),ds=e.styled_default("div")({name:"ct",class:"c55pgud",propsAsIs:!1}),rs=({image:l,tweet:a,account:n,accountVerified:i,body:t,title:r})=>{var c;return s.jsxs(ds,{children:[r&&s.jsx(ns,{children:s.jsx(is,{children:r})}),s.jsx(e.j,{image:l,name:(c=a==null?void 0:a.meta)==null?void 0:c.accountName,userName:n,verified:i,createdTweet:a==null?void 0:a.date}),s.jsx(os,{children:e.B(t)})]})},cs=({title:l,questionType:a,questionTypeData:n})=>s.jsxs(w,{children:[s.jsx(e.P,{questionTypeData:n,questionType:a,questionStatus:d.QuestionStatus.UNSET}),l&&s.jsx(ts,{children:l})]}),ps=({tweet:l})=>l?s.jsx(w,{children:s.jsx(rs,{...l,controlVideo:()=>{}})}):null,us=({action:l,questionType:a,inApp:n,insight:i,tweet:t})=>{var r;const c=e.X[a],o=e.Z[a];if(!c||!n||!n.notification)return null;const{title:m,image:x,imageMode:h}=n.notification;let p=x;a===d.QuestionType.TWEET&&t!=null&&t.tweetMedia&&(p=t.tweetMedia.image),h===d.QuestionImages.NONE&&(p="");const y=n.useMediaFromContent&&(i==null?void 0:i.image),v=a===d.QuestionType.TWEET&&((r=t==null?void 0:t.tweetMedia)==null?void 0:r.video)||a===d.QuestionType.FACTOID&&(i==null?void 0:i.video);return s.jsx(es,{className:"SL_InApp",onClick:l,children:s.jsxs(ss,{style:p?{}:{paddingLeft:"1.5rem"},children:[p&&!y&&s.jsx(_,{src:p,imageMode:h,withVideo:!!v}),y&&s.jsx(_,{src:y,fromInsight:!0,withVideo:!!v}),a===d.QuestionType.TWEET?s.jsx(ps,{tweet:t}):s.jsx(cs,{questionTypeData:c,questionType:a,title:m}),s.jsx(ls,{name:"inapp-button",children:o||"Open"}),s.jsx(as,{name:"chevronRight"})]})})},fs=e.styled_default("div")({name:"ht",class:"hjq7nef",propsAsIs:!1}),A=e.styled_default("img")({name:"S",class:"s1wpz4bk",propsAsIs:!1}),ms=e.styled_default("div")({name:"mt",class:"m9a4mjd",propsAsIs:!1}),xs=e.styled_default(K())({name:"ft",class:"f1hieehz",propsAsIs:!0}),ys=e.styled_default(F())({name:"ut",class:"u1ourn5d",propsAsIs:!0}),js=e.styled_default("div")({name:"gt",class:"g1evqivf",propsAsIs:!1}),hs=e.styled_default("div")({name:"xt",class:"x1fon3ii",propsAsIs:!1}),vs=e.styled_default("div")({name:"wt",class:"w14r8hqz",propsAsIs:!1}),Is=e.styled_default("button")({name:"yt",class:"yxk4apw",propsAsIs:!1}),_s=({open:l,close:a,...n})=>{var i,t;return s.jsxs(fs,{onClick:()=>{l==null||l(),n&&(n.instantOpen=!0)},children:[s.jsxs(ms,{children:[s.jsx(A,{className:"on-light",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification.png"}),s.jsx(A,{className:"on-dark",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification-dark.png"})]}),s.jsxs(js,{children:[s.jsxs(hs,{children:[s.jsx(xs,{name:"icon-trophy-solid"}),(i=n==null?void 0:n.titleCard)==null?void 0:i.title]}),s.jsxs(vs,{children:[s.jsx("span",{children:(t=n==null?void 0:n.titleCard)==null?void 0:t.subtitle}),s.jsx(Is,{name:"inapp-button",children:"Play Now"})]})]}),s.jsx(ys,{close:r=>{r==null||r.stopPropagation(),a==null||a()}})]})},As=e.styled_default("div")({name:"bt",class:"bfwt6f4",propsAsIs:!1}),gs=e.styled_default(W())({name:"kt",class:"kyg779c",propsAsIs:!0}),Ts=e.styled_default(B())({name:"It",class:"i1evrlv8",propsAsIs:!0}),qs=e.styled_default("div")({name:"Ct",class:"c1ikdq9p",propsAsIs:!1}),ws=e.styled_default("div")({name:"St",class:"sa973kf",propsAsIs:!1}),Ns=e.styled_default("div")({name:"Nt",class:"n1f8vz8k",propsAsIs:!1}),Ss=e.styled_default("div")({name:"Tt",class:"t2aop6q",propsAsIs:!1}),ks=({step:l,children:a,answer:n,state:i="pending"})=>s.jsxs(As,{children:[s.jsx(qs,{children:s.jsx(Ts,{name:"icon-prediction"})}),s.jsx(ws,{children:s.jsx(Ns,{children:a},l)}),s.jsx(Ss,{className:i,children:s.jsxs("div",{children:[s.jsx(gs,{name:"icon-check"}),"Your Pick: ",n]})})]}),bs=e.styled_default("div")({name:"Et",class:"e1rehgb5",propsAsIs:!1}),j=e.styled_default("div")({name:"y",class:"ylp5m3t",propsAsIs:!1}),Es=e.styled_default(G())({name:"$t",class:"_o9k3m4",propsAsIs:!0}),Qs=e.styled_default(H())({name:"Lt",class:"l1f41dxb",propsAsIs:!0}),Os=e.styled_default(Y())({name:"zt",class:"z1vokrte",propsAsIs:!0}),zs=()=>s.jsxs(bs,{children:[s.jsx(Es,{children:s.jsx("div",{})}),s.jsx(Qs,{children:s.jsx("div",{})}),s.jsx(Os,{children:s.jsx("div",{})})]}),Ds=e.styled_default("div")({name:"qt",class:"q1ftib8q",propsAsIs:!1}),Ls=e.styled_default(Z())({name:"Rt",class:"r1m9yg5p",propsAsIs:!0}),Ms=()=>s.jsxs(Ds,{children:[s.jsx(Ls,{name:"icon-check"})," Prediction results are in!"]}),Cs=e.styled_default("div")({name:"Ot",class:"oa7jasz",propsAsIs:!1}),Rs=e.styled_default("div")({name:"Qt",class:"q13bebf9",propsAsIs:!1}),Ps=e.styled_default("div")({name:"Pt",class:"p1o3s78d",propsAsIs:!1}),Us=({title:l})=>s.jsxs(Cs,{children:[s.jsx(Rs,{children:"Results for"}),s.jsx(Ps,{children:l})]}),N=e.styled_default("div")({name:"z",class:"z19uba88",propsAsIs:!1}),S=e.styled_default("div")({name:"M",class:"me3836e",propsAsIs:!1}),k=e.styled_default(X())({name:"q",class:"q12u443i",propsAsIs:!0}),Vs=e.styled_default($())({name:"At",class:"andaq1w",propsAsIs:!0}),Ks=()=>s.jsxs(N,{children:[s.jsxs(S,{children:["Congratulations!",s.jsx("br",{}),"You answered correctly."]}),s.jsx(k,{name:"icon-check"})]}),Fs=({title:l})=>s.jsxs(N,{children:[s.jsxs(S,{children:["Better luck next time!",s.jsx("br",{}),"Correct: ",l]}),s.jsx(Vs,{name:"icon-cross"})]}),Ws=e.styled_default("div")({name:"_t",class:"_1tv8lyn",propsAsIs:!1}),Bs=e.styled_default("div")({name:"Ft",class:"f15gn2pe",propsAsIs:!1}),Gs=e.styled_default(J())({name:"Ut",class:"uz0guqg",propsAsIs:!0}),Hs=({points:l})=>s.jsxs(Ws,{children:[s.jsxs(Bs,{children:["You won ",s.jsx(e.a,{delay:.5,prefix:"+",suffix:" points",value:l})]}),s.jsx(Gs,{name:"icon-trophy-solid"})]}),g=e.styled_default("div")({name:"N",class:"nfeou2w",propsAsIs:!1}),T=e.styled_default("div")({name:"T",class:"tyhpuaw",propsAsIs:!1}),q={1:3e3,2:4e3,3:4e3,4:4e3},Ys=({close:l,action:a,setStep:n,votedAnswer:i,correct:t,correctAnswerTitle:r,questionTitle:c,step:o})=>{if(u.useEffect(()=>{if(n){const x=setTimeout(()=>{q[o+1]&&(t||o<3)?n(o+1):l==null||l()},q[o]);return()=>{x&&clearTimeout(x)}}return()=>{}},[n,o,l,t]),o===1)return s.jsx(g,{children:s.jsx(T,{children:s.jsx(Ms,{})})});let m="pending";return(o===3||o===4)&&(m=t?"correct":"incorrect"),s.jsx(g,{onClick:()=>a==null?void 0:a(),children:s.jsxs(T,{children:[o!==1&&s.jsx(zs,{},o),s.jsxs(ks,{state:m,step:o,answer:(i==null?void 0:i.title)||"unknown",children:[o===2&&s.jsx(Us,{title:c||"unknown"}),o===3&&t&&s.jsx(Ks,{}),o===3&&!t&&s.jsx(Fs,{title:r||"unknown"}),o===4&&s.jsx(Hs,{points:(i==null?void 0:i.points)||0})]})]})})},Zs=({close:l,action:a,votedAnswer:n,correct:i,correctAnswerTitle:t,questionTitle:r})=>{const[c,o]=u.useState(1);return s.jsx(Ys,{close:l,action:a,votedAnswer:n,correct:i,correctAnswerTitle:t,questionTitle:r,setStep:o,step:c,title:""})},Xs=e.styled_default("div")({name:"Ht",class:"hvynqnf",propsAsIs:!1}),$s=l=>s.jsx(Xs,{children:s.jsx(Zs,{...l})}),b=({sdk:l})=>{const[a]=u.useState(l.getNotificationsStore()),n=e.useStore(a),i=l.getFeature(d.SdkOverlayType.GAMES),t=u.useMemo(()=>l.getActiveNotification(),[l,n]);return u.useEffect(()=>{t&&e.eventBus.emit("notification",{action:"rendered",payload:{questionId:t.data.questionId,questionType:t.data.questionType}})},[t]),t&&t.type===e.NotificationType.QUESTION_RESOLVED?t.data.question&&t.data.questionType===d.QuestionType.PREDICTION?s.jsx($s,{action:t.action,close:t.close,...t.data.question}):null:t&&t.type===e.NotificationType.ONBOARDING?t.data.onboarding?s.jsx(_s,{open:i==null?void 0:i.openFeature,close:t.close,...t.data.onboarding}):null:t&&s.jsx(us,{...t.data,action:t.action})},Js=({theme:l})=>{const a=e.useStreamLayer(),n=e.useStreamLayerTheme(),i=e.useStreamLayerUI();return a&&i.appNotification?i.app?null:s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(e.h,{customTheme:l??n.theme,themeMode:n.themeMode,children:s.jsx(b,{sdk:a})})}):null};exports.StreamLayerSDKNotification=Js;exports.StreamLayerSDKNotificationUI=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("./provider.js"),u=require("react"),c=require("./useStreamLayerApp2.js"),d=()=>e.p1,m=e.styled_default("div")({name:"v",class:"vo74vtj",propsAsIs:!1}),p=e.styled_default("div")({name:"S",class:"saa7tf1",propsAsIs:!1}),y=e.styled_default(d())({name:"w",class:"we3ylu3",propsAsIs:!0}),S=e.styled_default("div")({name:"b",class:"bw198ph",propsAsIs:!1}),f=e.styled_default("div")({name:"P",class:"p1warvjl",propsAsIs:!1}),v=e.styled_default("div")({name:"C",class:"conlc3z",propsAsIs:!1}),h=({points:s,onClick:a,className:r})=>t.jsxs(m,{className:r,onClick:a,children:[t.jsx(p,{children:t.jsx(y,{name:"icon-trophy-solid"})}),t.jsxs(S,{children:[t.jsx(f,{children:"Total points"}),t.jsx(v,{children:t.jsx(e.a,{value:s})})]})]}),j=({gamification:s})=>{const a=s.userSummary.$store,[r,o]=u.useState(0);return u.useEffect(()=>{const i=a.subscribe(l=>{var n;(n=l==null?void 0:l.summary)!=null&&n.points&&o(l.summary.points)});return()=>{i()}},[a]),t.jsx(h,{className:e.l,points:r,onClick:()=>{s.status.get()===e.FeatureStatus.Suspended?s.openFeature():s.status.get()===e.FeatureStatus.Ready&&s.closeFeature(!1)}})},x=({sdk:s})=>{if(!e.useStore(s.featuresList.getStore()))return null;const a=s.getFeature(c.SdkOverlayType.GAMES);return a?t.jsx(j,{gamification:a}):null},b=({theme:s})=>{const a=e.useStreamLayer(),r=e.useStreamLayerTheme();return a?t.jsx("div",{className:"StreamLayerSDK",children:t.jsx(e.h,{customTheme:s??r.theme,themeMode:r.themeMode,children:t.jsx(x,{sdk:a})})}):null};exports.StreamLayerSDKPoints=b;
|