@streamlayer/react 1.21.0 → 1.21.2
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/index.js +1 -1
- package/lib/cjs/insight.js +1 -1
- package/lib/cjs/notification.js +1 -1
- package/lib/cjs/pause-ad.js +1 -1
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/provider.js +14 -14
- package/lib/cjs/useStreamLayerApp2.js +1 -1
- package/lib/classic/cjs/advertisement.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/pause-ad.js +1 -1
- package/lib/classic/cjs/points.js +1 -1
- package/lib/classic/cjs/provider.js +9 -9
- package/lib/classic/cjs/useStreamLayerApp2.js +1 -1
- package/lib/classic/es/advertisement.js +2 -3
- package/lib/classic/es/index.js +9 -10
- package/lib/classic/es/insight.js +6 -7
- package/lib/classic/es/notification.js +2 -3
- package/lib/classic/es/pause-ad.js +117 -124
- package/lib/classic/es/points.js +2 -3
- package/lib/classic/es/provider.js +2066 -2062
- package/lib/classic/es/useStreamLayerApp2.js +1 -1
- package/lib/dist/cjs/gamification-feature2.js +1 -1
- package/lib/dist/cjs/index.js +1 -1
- package/lib/dist/cjs/masters.js +22 -22
- package/lib/dist/es/gamification-feature2.js +71 -72
- package/lib/dist/es/index.js +6 -7
- package/lib/dist/es/masters.js +3089 -3074
- package/lib/dist/style.css +1 -1
- package/lib/es/advertisement.js +2 -3
- package/lib/es/index.js +9 -10
- package/lib/es/insight.js +6 -7
- package/lib/es/notification.js +2 -3
- package/lib/es/pause-ad.js +113 -120
- package/lib/es/points.js +2 -3
- package/lib/es/provider.js +2035 -2020
- package/lib/es/useStreamLayerApp2.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +14 -15
package/lib/cjs/advertisement.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),_e=require("react");require("@nanostores/react");require("nanostores");const W=require("./provider.js");require("lodash.throttle");require("react-dom");require("react-countup");const ue=require("./useStreamLayerApp2.js"),Dd=require("./vast-client.min-B0NUra1B.js"),Qf=require("./index-l-eyvmpL.js"),Gn=require("uuid"),Jf=W.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Zf="a1rlj479",em="s35f1di",tm="sj4471g",im="b12050d8",nm="b1d5ybek",sm=i=>i==="left"||i==="right"?em:im,rm=i=>i==="left"||i==="right"?tm:nm,am=i=>i==="left"?"avdxyl3":i==="right"?"a1bisd08":i==="top"?"a1u9y2aj":"a1qqaks",bo=({children:i,style:e,className:t,enabled:n=!0,hiding:s,direction:r="left",onAnimationEnd:a})=>z.jsx(Jf,{style:e,className:W.cx_default(t,Zf,am(r),n&&!s&&sm(r),n&&s&&rm(r)),onAnimationEnd:a,children:i}),om=W.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),lm=W.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),um=()=>om,dm=W.styled_default(um())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),Od=({promotion:i,promotionId:e,hiding:t,isEventFired:n,fireEvent:s,direction:r="bottom"})=>{const a=(i==null?void 0:i.adUnit)===ue.AdUnit.STANDART,l=a?i.banner:i.additionalBanner;if(_e.useEffect(()=>{l!=null&&l.imageUrl&&i.type&&e&&(n!=null&&n("banner-showed")||(W.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:e,type:i.type}}),s==null||s("banner-showed")))},[l==null?void 0:l.imageUrl,s,n,i.type,e]),!(l!=null&&l.imageUrl))return null;let c=l==null?void 0:l.url;return c&&c.indexOf("http")!==0&&(c=`https://${c}`),z.jsx(bo,{direction:r,hiding:t,children:z.jsx(lm,{className:"BannerContainer","data-is-ad":a,children:z.jsx(dm,{as:c?"a":"span",className:"BannerLink",href:c,style:{backgroundImage:`url(${l.imageUrl})`,cursor:c?"pointer":"default"},"data-promo-id":e,"data-promo-type":i.type,"data-a":"banner",target:"_blank","data-is-ad":a})})})},hm=({cardId:i,promotion:e,direction:t="bottom"})=>z.jsx(Od,{promotion:e,promotionId:i,direction:t,hiding:!1}),cm=W.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),pm=W.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),gm=W.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),fm=W.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),To=W.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),mm=()=>To,ym=W.styled_default(mm())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),iu=W.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),_m=W.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),bm=W.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Tm=W.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),vm=W.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),Md=W.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),Sm=()=>Md,Em=W.styled_default(Sm())({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),wm=()=>Md,Rd=W.styled_default(wm())({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),km={[ue.NotificationPromotionImagePosition.BOTTOM]:To,[ue.NotificationPromotionImagePosition.MIDDLE]:ym},Cm=({src:i,imagePosition:e})=>{const t=km[e]||To;return z.jsx(t,{children:z.jsx("img",{src:i,alt:""})})},Im=W.O(Em),xm=W.O(Rd),Am=({notification:i,open:e,close:t,webos:n})=>{if(!i||!i.promotion||i.enabled!==ue.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:s,body:r,image:a,promotion:l}=i,{sponsorLogo:c,sponsorLogoMode:f,imagePosition:m,ctaButton:b}=l;return z.jsxs(vm,{"data-webos":n,className:"SL_Lower_Third_Notification",onClick:n?void 0:e,children:[z.jsxs(cm,{children:[z.jsx(Cm,{src:a,imagePosition:m}),z.jsxs(pm,{children:[s&&z.jsx(gm,{children:s}),r&&z.jsx(fm,{children:r})]})]}),z.jsxs(bm,{children:[f!==ue.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&z.jsxs(z.Fragment,{children:[z.jsx(_m,{children:z.jsx("img",{src:c,alt:s})}),z.jsx(Tm,{})]}),n?z.jsxs(z.Fragment,{children:[z.jsx(Im,{webos:!0,onClick:t,children:"Dismiss"}),z.jsxs(xm,{webos:!0,autoFocus:!0,style:{color:b==null?void 0:b.textColor,backgroundColor:b==null?void 0:b.color},onClick:e,children:[(b==null?void 0:b.ctaIcon)&&(b==null?void 0:b.ctaIconMode)===ue.CtaIconMode.CTA_ICON_TRANSPARENT&&z.jsx(iu,{src:b==null?void 0:b.ctaIcon,alt:"cta-icon"}),(b==null?void 0:b.label)||"Open"]})]}):z.jsxs(Rd,{name:"promo-button",style:{color:b==null?void 0:b.textColor,backgroundColor:b==null?void 0:b.color},children:[(b==null?void 0:b.ctaIcon)&&(b==null?void 0:b.ctaIconMode)===ue.CtaIconMode.CTA_ICON_TRANSPARENT&&z.jsx(iu,{src:b==null?void 0:b.ctaIcon,alt:"cta-icon"}),(b==null?void 0:b.label)||"Open"]})]})]})},Pm=W.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Lm=W.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),Dm=W.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Om=W.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),Mm=W.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Lr=W.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),Rm=()=>Lr,nu=W.styled_default(Rm())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),Um=()=>Lr,Ud=W.styled_default(Um())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),Nm=()=>Ud,Bm=W.styled_default(Nm())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),Fm=()=>Lr,jm=W.styled_default(Fm())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),$m=()=>Lr,qm=W.styled_default($m())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Vm=W.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),Hm=()=>W.B1,zm=W.styled_default(Hm())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),Wm=W.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),Nd=W.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),Gm=()=>Nd,Xm=W.styled_default(Gm())({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),Km=()=>Nd,Ym=W.styled_default(Km())({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),Qm={[ue.NotificationPromotionImagePosition.UNSET]:nu,[ue.NotificationPromotionImagePosition.FIT]:nu,[ue.NotificationPromotionImagePosition.CENTERED]:Ud,[ue.NotificationPromotionImagePosition.BOTTOM]:Bm,[ue.NotificationPromotionImagePosition.SOLID]:jm,[ue.NotificationPromotionImagePosition.MIDDLE]:qm},Jm=({src:i,imagePosition:e})=>{const t=Qm[e];return z.jsx(t,{children:z.jsx("img",{src:i,alt:""})})},Zm=W.O(Xm),ey=W.O(Ym),ty=({notification:i,open:e,promotionId:t,hiding:n,direction:s="left",close:r,webos:a})=>{if(!i||!i.promotion||i.enabled!==ue.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===ue.NotificationPromotionMode.LOWER_THIRD)return z.jsx(Am,{notification:i,open:e,close:r,webos:a});const{title:l,body:c,image:f,promotion:m}=i,{sponsorLogo:b,sponsorLogoMode:C,imagePosition:w,ctaButton:A}=m,v=M=>{M.stopPropagation(),r==null||r()};return z.jsx(bo,{className:"SL_Rich_Notification",direction:s,hiding:n,children:z.jsxs(Lm,{onClick:a?()=>{}:e,children:[C!==ue.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&b&&z.jsx(Wm,{children:z.jsx("img",{src:b,alt:l})}),z.jsxs(Pm,{children:[z.jsx(Jm,{src:f,imagePosition:w}),z.jsxs(Dm,{children:[l&&z.jsx(Om,{children:l}),c&&z.jsx(Mm,{children:c})]}),a&&z.jsx(Zm,{webos:!0,onClick:v,children:"Dismiss"}),z.jsxs(ey,{webos:a,autoFocus:a,onClick:a?e:()=>{},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)===ue.CtaIconMode.CTA_ICON_TRANSPARENT&&z.jsx(Vm,{src:A==null?void 0:A.ctaIcon,alt:"cta-icon"}),(A==null?void 0:A.label)||"Open"]}),z.jsx(zm,{name:"chevronRight"})]})]})})},iy=W.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Bd=W.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),Fd=W.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),jd=W.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),$d="h10toh7",su=W.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),ny=W.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),qd=W.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),sy=W.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),ry="s1nmch9k",ru=W.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),ay=W.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),oy=W.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),ly=W.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Vd=W.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),uy=W.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Hd=W.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),zd=W.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),dy=W.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),hy="h17rwbtk",cy=W.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),au=W.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),py=W.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),gy=({time:i,adCount:e,adPosition:t})=>{const n=Math.floor(i/60),s=i-n*60;return n===0&&s===0&&e===t?null:z.jsxs(cy,{children:[e>1&&z.jsxs(z.Fragment,{children:[z.jsxs(au,{children:[t," of ",e]}),z.jsx(py,{})]}),z.jsxs(au,{children:[n,":",s<10?`0${s}`:s]})]})},fy=W.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),my=({whyThisAd:i})=>{const[e,t]=_e.useState(!1);return!i.iconClickThroughURLTemplate||!i.staticResource?null:z.jsxs(fy,{style:{width:i.width,height:i.height,[i.xPosition]:3,[i.yPosition]:11},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&z.jsx("img",{alt:"ad choice",src:i.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&z.jsx("span",{children:"ad choice"})]})},yy=W.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Wd=W.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),_y=()=>Wd,by=W.styled_default(_y())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),Ty=()=>Wd,vy=W.styled_default(Ty())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),Sy=W.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),Ey=W.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),ou="m12n261r",lu="m16vcml8",uu="m1078nk6",du=globalThis||void 0||self;class wy{constructor(e){this.id=e.getAttribute("id"),this.allowMultipleAds=e.getAttribute("allowMultipleAds"),this.followRedirects=e.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null;for(const t in e.childNodes){const n=e.childNodes[t];switch(n.localName){case"AdTagURI":this.adTagURI={templateType:n.getAttribute("templateType"),uri:(n.textContent||n.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=n.firstChild;this.vastAdData&&this.vastAdData.nodeType!==1;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=n;break}}}}function Gd(i,e){const t=[];for(const n in i.childNodes){const s=i.childNodes[n];(s.nodeName===e||e===`vmap:${s.nodeName}`||s.nodeName===`vmap:${e}`)&&t.push(s)}return t}function ky(i){if(!i||!i.childNodes)return{};const e=i.childNodes,t=[];for(const s in e){const r=e[s];r.nodeName==="#cdata-section"&&t.push(r)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let n="";for(const s in e){const r=e[s];switch(r.nodeName){case"#text":n+=r.textContent.trim();break;case"#cdata-section":n+=r.data;break}}return n}function vo(i){const e={attributes:{},children:{},value:{}};e.value=ky(i);const t=i.attributes;if(t)for(const s in t){const r=t[s];r.nodeName&&r.nodeValue!==void 0&&r.nodeValue!==null&&(e.attributes[r.nodeName]=r.nodeValue)}const n=i.childNodes;if(n)for(const s in n){const r=n[s];r.nodeName&&r.nodeName.substring(0,1)!=="#"&&(e.children[r.nodeName]=vo(r))}return e}class Cy{constructor(e){this.timeOffset=e.getAttribute("timeOffset"),this.breakType=e.getAttribute("breakType"),this.breakId=e.getAttribute("breakId"),this.repeatAfter=e.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[];for(const t in e.childNodes){const n=e.childNodes[t];switch(n.localName){case"AdSource":this.adSource=new wy(n);break;case"TrackingEvents":for(const s in n.childNodes){const r=n.childNodes[s];r.localName==="Tracking"&&this.trackingEvents.push({event:r.getAttribute("event"),uri:(r.textContent||r.text||"").trim()})}break;case"Extensions":this.extensions=Gd(n,"Extension").map(s=>vo(s));break}}}track(e,t){for(const n in this.trackingEvents){const s=this.trackingEvents[n];if(s.event===e){let{uri:r}=s;s.event==="error"&&(r=r.replace("[ERRORCODE]",t)),this.tracker(r)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}}class Iy{constructor(e){if(!e||!e.documentElement||e.documentElement.localName!=="VMAP")throw new Error("Not a VMAP document");this.version=e.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[];for(const t in e.documentElement.childNodes){const n=e.documentElement.childNodes[t];switch(n.localName){case"AdBreak":this.adBreaks.push(new Cy(n));break;case"Extensions":this.extensions=Gd(n,"Extension").map(s=>vo(s));break}}}}const xy=(i,e)=>{const t=goog.pal,n=new t.ConsentSettings;n.allowStorage=!1;const s=new t.NonceLoader(n);return async()=>{try{const r=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||Gn.v4(),c=sessionStorage.getItem("sl-ad-session-id");c||(c=Gn.v4(),sessionStorage.setItem("sl-ad-session-id",c)),Gn.validate(l)||(l=Gn.v5(`https://${l}`,Gn.v5.URL)),r.searchParams.get("url")||r.searchParams.set("url","https://streamlayer.io"),r.searchParams.get("description_url")||r.searchParams.set("description_url","https://streamlayer.io"),a.adWillAutoPlay=r.searchParams.get("vpa")==="auto",a.adWillPlayMuted=r.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=r.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=i.clientHeight,a.videoWidth=i.clientWidth;const f=await s.loadNonceManager(a);return r.searchParams.get("is_lat")==="[placeholder]"&&r.searchParams.set("is_lat","1"),r.searchParams.get("rdid")==="[placeholder]"&&r.searchParams.set("rdid",l),r.searchParams.get("correlator")==="[placeholder]"&&r.searchParams.set("correlator",c),r.searchParams.set("wta","1"),r.searchParams.set("givn",f.getNonce()),{url:r,manager:f}}catch(r){console.log("AdsManager could not be started",r);return}}},Ay=new Dd.ce,Py=i=>i.creatives.find(e=>e.mediaFiles),Ly=i=>{var e;const t=i==null?void 0:i.mediaFiles;return t!=null&&t.length&&((e=t.find(n=>n.fileURL))==null?void 0:e.fileURL)||""},Xn=W.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),Dy=(i,e)=>{const[t,n]=_e.useState(),s=_e.useRef(Date.now()),r=_e.useRef(Date.now());return _e.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=xy(i.current,e),l=Date.now();s.current=l,Xn.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),a().then(c=>{s.current===l&&c&&(n(c.url),Xn.set({ads:[],autoplay:!0,muted:!1,nonceManager:c.manager}))}).catch(c=>{console.error(c)})},[i,e]),_e.useEffect(()=>{const a=async(l,c)=>{let f=[];if(l.searchParams.get("output")==="vmap"){const w=await fetch(l.toString()),A=new DOMParser,v=await w.text(),M=A.parseFromString(v,"text/xml");f=new Iy(M).adBreaks.map(D=>D.adSource.adTagURI.uri)}else f=[l.toString()];const m=await Promise.all(f.map((w,A)=>Ay.get(w).then(v=>{if(r.current===c){const M=v.ads.find(N=>N.creatives.length>0);if(!M)return;const D=Py(M),R=Ly(D);return{creative:D,order:A,mediaFileUrl:R,ad:M,raw:v}}}))),b=l.searchParams.get("vpa")!=="click",C=l.searchParams.get("vpmute")==="1";Xn.set({...Xn.get(),ads:m.filter(w=>!!w),autoplay:b,muted:C})};if(t){const l=Date.now();r.current=l,a(t,l)}return()=>{r.current=0}},[t]),Xn},ar=globalThis||void 0||self;var or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof du<"u"?du:typeof self<"u"?self:{};function ms(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Oy(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(n){var s=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:function(){return i[n]}})}),t}var Zn;typeof window<"u"?Zn=window:typeof or<"u"?Zn=or:typeof self<"u"?Zn=self:Zn={};var Dr=Zn;const x=ms(Dr),My={},Ry=Object.freeze(Object.defineProperty({__proto__:null,default:My},Symbol.toStringTag,{value:"Module"})),Uy=Oy(Ry);var hu=typeof or<"u"?or:typeof window<"u"?window:{},Ny=Uy,es;typeof document<"u"?es=document:(es=hu["__GLOBAL_DOCUMENT_CACHE@4"],es||(es=hu["__GLOBAL_DOCUMENT_CACHE@4"]=Ny));var Xd=es;const G=ms(Xd);var So={exports:{}},Kd={exports:{}};(function(i){function e(){return i.exports=e=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var s=arguments[n];for(var r in s)({}).hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t},i.exports.__esModule=!0,i.exports.default=i.exports,e.apply(null,arguments)}i.exports=e,i.exports.__esModule=!0,i.exports.default=i.exports})(Kd);var By=Kd.exports,Fy=$y,jy=Object.prototype.toString;function $y(i){if(!i)return!1;var e=jy.call(i);return e==="[object Function]"||typeof i=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)}function qy(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=Vy(i))||e){t&&(i=t);var n=0;return function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),_e=require("react");require("nanostores");const W=require("./provider.js");require("lodash.throttle");require("react-dom");require("react-countup");const ue=require("./useStreamLayerApp2.js"),Dd=require("./vast-client.min-B0NUra1B.js"),Qf=require("./index-l-eyvmpL.js"),Gn=require("uuid"),Jf=W.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Zf="a1rlj479",em="s35f1di",tm="sj4471g",im="b12050d8",nm="b1d5ybek",sm=i=>i==="left"||i==="right"?em:im,rm=i=>i==="left"||i==="right"?tm:nm,am=i=>i==="left"?"avdxyl3":i==="right"?"a1bisd08":i==="top"?"a1u9y2aj":"a1qqaks",bo=({children:i,style:e,className:t,enabled:n=!0,hiding:s,direction:r="left",onAnimationEnd:a})=>z.jsx(Jf,{style:e,className:W.cx_default(t,Zf,am(r),n&&!s&&sm(r),n&&s&&rm(r)),onAnimationEnd:a,children:i}),om=W.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),lm=W.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),um=()=>om,dm=W.styled_default(um())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),Od=({promotion:i,promotionId:e,hiding:t,isEventFired:n,fireEvent:s,direction:r="bottom"})=>{const a=(i==null?void 0:i.adUnit)===ue.AdUnit.STANDART,l=a?i.banner:i.additionalBanner;if(_e.useEffect(()=>{l!=null&&l.imageUrl&&i.type&&e&&(n!=null&&n("banner-showed")||(W.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:e,type:i.type}}),s==null||s("banner-showed")))},[l==null?void 0:l.imageUrl,s,n,i.type,e]),!(l!=null&&l.imageUrl))return null;let c=l==null?void 0:l.url;return c&&c.indexOf("http")!==0&&(c=`https://${c}`),z.jsx(bo,{direction:r,hiding:t,children:z.jsx(lm,{className:"BannerContainer","data-is-ad":a,children:z.jsx(dm,{as:c?"a":"span",className:"BannerLink",href:c,style:{backgroundImage:`url(${l.imageUrl})`,cursor:c?"pointer":"default"},"data-promo-id":e,"data-promo-type":i.type,"data-a":"banner",target:"_blank","data-is-ad":a})})})},hm=({cardId:i,promotion:e,direction:t="bottom"})=>z.jsx(Od,{promotion:e,promotionId:i,direction:t,hiding:!1}),cm=W.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),pm=W.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),gm=W.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),fm=W.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),To=W.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),mm=()=>To,ym=W.styled_default(mm())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),iu=W.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),_m=W.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),bm=W.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Tm=W.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),vm=W.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),Md=W.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),Sm=()=>Md,Em=W.styled_default(Sm())({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),wm=()=>Md,Rd=W.styled_default(wm())({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),km={[ue.NotificationPromotionImagePosition.BOTTOM]:To,[ue.NotificationPromotionImagePosition.MIDDLE]:ym},Cm=({src:i,imagePosition:e})=>{const t=km[e]||To;return z.jsx(t,{children:z.jsx("img",{src:i,alt:""})})},Im=W.O(Em),xm=W.O(Rd),Am=({notification:i,open:e,close:t,webos:n})=>{if(!i||!i.promotion||i.enabled!==ue.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:s,body:r,image:a,promotion:l}=i,{sponsorLogo:c,sponsorLogoMode:f,imagePosition:m,ctaButton:b}=l;return z.jsxs(vm,{"data-webos":n,className:"SL_Lower_Third_Notification",onClick:n?void 0:e,children:[z.jsxs(cm,{children:[z.jsx(Cm,{src:a,imagePosition:m}),z.jsxs(pm,{children:[s&&z.jsx(gm,{children:s}),r&&z.jsx(fm,{children:r})]})]}),z.jsxs(bm,{children:[f!==ue.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&z.jsxs(z.Fragment,{children:[z.jsx(_m,{children:z.jsx("img",{src:c,alt:s})}),z.jsx(Tm,{})]}),n?z.jsxs(z.Fragment,{children:[z.jsx(Im,{webos:!0,onClick:t,children:"Dismiss"}),z.jsxs(xm,{webos:!0,autoFocus:!0,style:{color:b==null?void 0:b.textColor,backgroundColor:b==null?void 0:b.color},onClick:e,children:[(b==null?void 0:b.ctaIcon)&&(b==null?void 0:b.ctaIconMode)===ue.CtaIconMode.CTA_ICON_TRANSPARENT&&z.jsx(iu,{src:b==null?void 0:b.ctaIcon,alt:"cta-icon"}),(b==null?void 0:b.label)||"Open"]})]}):z.jsxs(Rd,{name:"promo-button",style:{color:b==null?void 0:b.textColor,backgroundColor:b==null?void 0:b.color},children:[(b==null?void 0:b.ctaIcon)&&(b==null?void 0:b.ctaIconMode)===ue.CtaIconMode.CTA_ICON_TRANSPARENT&&z.jsx(iu,{src:b==null?void 0:b.ctaIcon,alt:"cta-icon"}),(b==null?void 0:b.label)||"Open"]})]})]})},Pm=W.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Lm=W.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),Dm=W.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Om=W.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),Mm=W.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Lr=W.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),Rm=()=>Lr,nu=W.styled_default(Rm())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),Um=()=>Lr,Ud=W.styled_default(Um())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),Nm=()=>Ud,Bm=W.styled_default(Nm())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),Fm=()=>Lr,jm=W.styled_default(Fm())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),$m=()=>Lr,qm=W.styled_default($m())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Vm=W.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),Hm=()=>W.B1,zm=W.styled_default(Hm())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),Wm=W.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),Nd=W.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),Gm=()=>Nd,Xm=W.styled_default(Gm())({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),Km=()=>Nd,Ym=W.styled_default(Km())({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),Qm={[ue.NotificationPromotionImagePosition.UNSET]:nu,[ue.NotificationPromotionImagePosition.FIT]:nu,[ue.NotificationPromotionImagePosition.CENTERED]:Ud,[ue.NotificationPromotionImagePosition.BOTTOM]:Bm,[ue.NotificationPromotionImagePosition.SOLID]:jm,[ue.NotificationPromotionImagePosition.MIDDLE]:qm},Jm=({src:i,imagePosition:e})=>{const t=Qm[e];return z.jsx(t,{children:z.jsx("img",{src:i,alt:""})})},Zm=W.O(Xm),ey=W.O(Ym),ty=({notification:i,open:e,promotionId:t,hiding:n,direction:s="left",close:r,webos:a})=>{if(!i||!i.promotion||i.enabled!==ue.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===ue.NotificationPromotionMode.LOWER_THIRD)return z.jsx(Am,{notification:i,open:e,close:r,webos:a});const{title:l,body:c,image:f,promotion:m}=i,{sponsorLogo:b,sponsorLogoMode:C,imagePosition:w,ctaButton:A}=m,v=M=>{M.stopPropagation(),r==null||r()};return z.jsx(bo,{className:"SL_Rich_Notification",direction:s,hiding:n,children:z.jsxs(Lm,{onClick:a?()=>{}:e,children:[C!==ue.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&b&&z.jsx(Wm,{children:z.jsx("img",{src:b,alt:l})}),z.jsxs(Pm,{children:[z.jsx(Jm,{src:f,imagePosition:w}),z.jsxs(Dm,{children:[l&&z.jsx(Om,{children:l}),c&&z.jsx(Mm,{children:c})]}),a&&z.jsx(Zm,{webos:!0,onClick:v,children:"Dismiss"}),z.jsxs(ey,{webos:a,autoFocus:a,onClick:a?e:()=>{},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)===ue.CtaIconMode.CTA_ICON_TRANSPARENT&&z.jsx(Vm,{src:A==null?void 0:A.ctaIcon,alt:"cta-icon"}),(A==null?void 0:A.label)||"Open"]}),z.jsx(zm,{name:"chevronRight"})]})]})})},iy=W.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Bd=W.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),Fd=W.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),jd=W.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),$d="h10toh7",su=W.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),ny=W.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),qd=W.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),sy=W.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),ry="s1nmch9k",ru=W.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),ay=W.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),oy=W.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),ly=W.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Vd=W.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),uy=W.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Hd=W.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),zd=W.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),dy=W.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),hy="h17rwbtk",cy=W.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),au=W.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),py=W.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),gy=({time:i,adCount:e,adPosition:t})=>{const n=Math.floor(i/60),s=i-n*60;return n===0&&s===0&&e===t?null:z.jsxs(cy,{children:[e>1&&z.jsxs(z.Fragment,{children:[z.jsxs(au,{children:[t," of ",e]}),z.jsx(py,{})]}),z.jsxs(au,{children:[n,":",s<10?`0${s}`:s]})]})},fy=W.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),my=({whyThisAd:i})=>{const[e,t]=_e.useState(!1);return!i.iconClickThroughURLTemplate||!i.staticResource?null:z.jsxs(fy,{style:{width:i.width,height:i.height,[i.xPosition]:3,[i.yPosition]:11},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&z.jsx("img",{alt:"ad choice",src:i.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&z.jsx("span",{children:"ad choice"})]})},yy=W.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Wd=W.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),_y=()=>Wd,by=W.styled_default(_y())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),Ty=()=>Wd,vy=W.styled_default(Ty())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),Sy=W.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),Ey=W.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),ou="m12n261r",lu="m16vcml8",uu="m1078nk6",du=globalThis||void 0||self;class wy{constructor(e){this.id=e.getAttribute("id"),this.allowMultipleAds=e.getAttribute("allowMultipleAds"),this.followRedirects=e.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null;for(const t in e.childNodes){const n=e.childNodes[t];switch(n.localName){case"AdTagURI":this.adTagURI={templateType:n.getAttribute("templateType"),uri:(n.textContent||n.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=n.firstChild;this.vastAdData&&this.vastAdData.nodeType!==1;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=n;break}}}}function Gd(i,e){const t=[];for(const n in i.childNodes){const s=i.childNodes[n];(s.nodeName===e||e===`vmap:${s.nodeName}`||s.nodeName===`vmap:${e}`)&&t.push(s)}return t}function ky(i){if(!i||!i.childNodes)return{};const e=i.childNodes,t=[];for(const s in e){const r=e[s];r.nodeName==="#cdata-section"&&t.push(r)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let n="";for(const s in e){const r=e[s];switch(r.nodeName){case"#text":n+=r.textContent.trim();break;case"#cdata-section":n+=r.data;break}}return n}function vo(i){const e={attributes:{},children:{},value:{}};e.value=ky(i);const t=i.attributes;if(t)for(const s in t){const r=t[s];r.nodeName&&r.nodeValue!==void 0&&r.nodeValue!==null&&(e.attributes[r.nodeName]=r.nodeValue)}const n=i.childNodes;if(n)for(const s in n){const r=n[s];r.nodeName&&r.nodeName.substring(0,1)!=="#"&&(e.children[r.nodeName]=vo(r))}return e}class Cy{constructor(e){this.timeOffset=e.getAttribute("timeOffset"),this.breakType=e.getAttribute("breakType"),this.breakId=e.getAttribute("breakId"),this.repeatAfter=e.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[];for(const t in e.childNodes){const n=e.childNodes[t];switch(n.localName){case"AdSource":this.adSource=new wy(n);break;case"TrackingEvents":for(const s in n.childNodes){const r=n.childNodes[s];r.localName==="Tracking"&&this.trackingEvents.push({event:r.getAttribute("event"),uri:(r.textContent||r.text||"").trim()})}break;case"Extensions":this.extensions=Gd(n,"Extension").map(s=>vo(s));break}}}track(e,t){for(const n in this.trackingEvents){const s=this.trackingEvents[n];if(s.event===e){let{uri:r}=s;s.event==="error"&&(r=r.replace("[ERRORCODE]",t)),this.tracker(r)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}}class Iy{constructor(e){if(!e||!e.documentElement||e.documentElement.localName!=="VMAP")throw new Error("Not a VMAP document");this.version=e.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[];for(const t in e.documentElement.childNodes){const n=e.documentElement.childNodes[t];switch(n.localName){case"AdBreak":this.adBreaks.push(new Cy(n));break;case"Extensions":this.extensions=Gd(n,"Extension").map(s=>vo(s));break}}}}const xy=(i,e)=>{const t=goog.pal,n=new t.ConsentSettings;n.allowStorage=!1;const s=new t.NonceLoader(n);return async()=>{try{const r=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||Gn.v4(),c=sessionStorage.getItem("sl-ad-session-id");c||(c=Gn.v4(),sessionStorage.setItem("sl-ad-session-id",c)),Gn.validate(l)||(l=Gn.v5(`https://${l}`,Gn.v5.URL)),r.searchParams.get("url")||r.searchParams.set("url","https://streamlayer.io"),r.searchParams.get("description_url")||r.searchParams.set("description_url","https://streamlayer.io"),a.adWillAutoPlay=r.searchParams.get("vpa")==="auto",a.adWillPlayMuted=r.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=r.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=i.clientHeight,a.videoWidth=i.clientWidth;const f=await s.loadNonceManager(a);return r.searchParams.get("is_lat")==="[placeholder]"&&r.searchParams.set("is_lat","1"),r.searchParams.get("rdid")==="[placeholder]"&&r.searchParams.set("rdid",l),r.searchParams.get("correlator")==="[placeholder]"&&r.searchParams.set("correlator",c),r.searchParams.set("wta","1"),r.searchParams.set("givn",f.getNonce()),{url:r,manager:f}}catch(r){console.log("AdsManager could not be started",r);return}}},Ay=new Dd.ce,Py=i=>i.creatives.find(e=>e.mediaFiles),Ly=i=>{var e;const t=i==null?void 0:i.mediaFiles;return t!=null&&t.length&&((e=t.find(n=>n.fileURL))==null?void 0:e.fileURL)||""},Xn=W.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),Dy=(i,e)=>{const[t,n]=_e.useState(),s=_e.useRef(Date.now()),r=_e.useRef(Date.now());return _e.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=xy(i.current,e),l=Date.now();s.current=l,Xn.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),a().then(c=>{s.current===l&&c&&(n(c.url),Xn.set({ads:[],autoplay:!0,muted:!1,nonceManager:c.manager}))}).catch(c=>{console.error(c)})},[i,e]),_e.useEffect(()=>{const a=async(l,c)=>{let f=[];if(l.searchParams.get("output")==="vmap"){const w=await fetch(l.toString()),A=new DOMParser,v=await w.text(),M=A.parseFromString(v,"text/xml");f=new Iy(M).adBreaks.map(D=>D.adSource.adTagURI.uri)}else f=[l.toString()];const m=await Promise.all(f.map((w,A)=>Ay.get(w).then(v=>{if(r.current===c){const M=v.ads.find(N=>N.creatives.length>0);if(!M)return;const D=Py(M),R=Ly(D);return{creative:D,order:A,mediaFileUrl:R,ad:M,raw:v}}}))),b=l.searchParams.get("vpa")!=="click",C=l.searchParams.get("vpmute")==="1";Xn.set({...Xn.get(),ads:m.filter(w=>!!w),autoplay:b,muted:C})};if(t){const l=Date.now();r.current=l,a(t,l)}return()=>{r.current=0}},[t]),Xn},ar=globalThis||void 0||self;var or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof du<"u"?du:typeof self<"u"?self:{};function ms(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Oy(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(n){var s=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:function(){return i[n]}})}),t}var Zn;typeof window<"u"?Zn=window:typeof or<"u"?Zn=or:typeof self<"u"?Zn=self:Zn={};var Dr=Zn;const x=ms(Dr),My={},Ry=Object.freeze(Object.defineProperty({__proto__:null,default:My},Symbol.toStringTag,{value:"Module"})),Uy=Oy(Ry);var hu=typeof or<"u"?or:typeof window<"u"?window:{},Ny=Uy,es;typeof document<"u"?es=document:(es=hu["__GLOBAL_DOCUMENT_CACHE@4"],es||(es=hu["__GLOBAL_DOCUMENT_CACHE@4"]=Ny));var Xd=es;const G=ms(Xd);var So={exports:{}},Kd={exports:{}};(function(i){function e(){return i.exports=e=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var s=arguments[n];for(var r in s)({}).hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t},i.exports.__esModule=!0,i.exports.default=i.exports,e.apply(null,arguments)}i.exports=e,i.exports.__esModule=!0,i.exports.default=i.exports})(Kd);var By=Kd.exports,Fy=$y,jy=Object.prototype.toString;function $y(i){if(!i)return!1;var e=jy.call(i);return e==="[object Function]"||typeof i=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)}function qy(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=Vy(i))||e){t&&(i=t);var n=0;return function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vy(i,e){if(i){if(typeof i=="string")return cu(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return cu(i,e)}}function cu(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}var Hy=function(){function i(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=i.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},e.addInterceptor=function(t,n){this.typeToInterceptorsMap_.has(t)||this.typeToInterceptorsMap_.set(t,new Set);var s=this.typeToInterceptorsMap_.get(t);return s.has(n)?!1:(s.add(n),!0)},e.removeInterceptor=function(t,n){var s=this.typeToInterceptorsMap_.get(t);return s&&s.has(n)?(s.delete(n),!0):!1},e.clearInterceptorsByType=function(t){var n=this.typeToInterceptorsMap_.get(t);return n?(this.typeToInterceptorsMap_.delete(t),this.typeToInterceptorsMap_.set(t,new Set),!0):!1},e.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},e.getForType=function(t){return this.typeToInterceptorsMap_.get(t)||new Set},e.execute=function(t,n){for(var s=this.getForType(t),r=qy(s),a;!(a=r()).done;){var l=a.value;try{n=l(n)}catch{}}return n},i}(),zy=Hy,Wy=function(){function i(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var e=i.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},e.getMaxAttempts=function(){return this.maxAttempts_},e.setMaxAttempts=function(t){this.maxAttempts_=t},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(t){this.delayFactor_=t},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(t){this.fuzzFactor_=t},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(t){this.initialDelay_=t},e.createRetry=function(t){var n=t===void 0?{}:t,s=n.maxAttempts,r=n.delayFactor,a=n.fuzzFactor,l=n.initialDelay;return new Gy({maxAttempts:s||this.maxAttempts_,delayFactor:r||this.delayFactor_,fuzzFactor:a||this.fuzzFactor_,initialDelay:l||this.initialDelay_})},i}(),Gy=function(){function i(t){this.maxAttempts_=t.maxAttempts,this.delayFactor_=t.delayFactor,this.fuzzFactor_=t.fuzzFactor,this.currentDelay_=t.initialDelay,this.currentAttempt_=1}var e=i.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var t=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+t},e.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},e.getCurrentDelay=function(){return this.currentDelay_},e.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},e.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},e.getCurrentFuzzedDelay=function(){var t=this.getCurrentMinPossibleDelay(),n=this.getCurrentMaxPossibleDelay();return t+Math.random()*(n-t)},i}(),Xy=Wy,Ky=Dr,Yy=function(i,e){return e===void 0&&(e=!1),function(t,n,s){if(t){i(t);return}if(n.statusCode>=400&&n.statusCode<=599){var r=s;if(e)if(Ky.TextDecoder){var a=Qy(n.headers&&n.headers["content-type"]);try{r=new TextDecoder(a).decode(s)}catch{}}else r=String.fromCharCode.apply(null,new Uint8Array(s));i({cause:r});return}i(null,s)}};function Qy(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(e,t){var n=t.split("="),s=n[0],r=n[1];return s.trim()==="charset"?r.trim():e},"utf-8")}var Jy=Yy,Yd=Dr,Zy=By,e_=Fy,Qd=zy,t_=Xy;Fe.httpHandler=Jy;Fe.requestInterceptorsStorage=new Qd;Fe.responseInterceptorsStorage=new Qd;Fe.retryManager=new t_;/**
|
|
3
3
|
* @license
|
|
4
4
|
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js");require("nanostores");require("react/jsx-runtime");require("react");require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js");require("nanostores");require("react/jsx-runtime");require("react");require("lodash.throttle");require("react-dom");require("react-countup");const 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;
|
package/lib/cjs/insight.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),l=require("react");require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),l=require("react");require("nanostores");const i=require("./provider.js");require("lodash.throttle");require("react-dom");require("react-countup");const p=require("./useStreamLayerApp2.js"),S=()=>i.Tt,f=i.styled_default(S())({name:"QuestionWrap",class:"q10hhsxv",propsAsIs:!0}),g=({gamification:e,sdk:o,persistent:n,skipAutoClose:a,hideHeader:d,insightId:t})=>{const s=l.useRef(""),h=i.useStore(e.openedQuestion.$store);return l.useEffect(()=>t?(!n||e.isOpenedQuestion(t)||(s.current=t,e.getFeedItem(t).then(r=>{var c;s.current===t&&((c=r==null?void 0:r.attributes)==null?void 0:c.attributes.case)==="insight"&&e.openQuestion(t,r)})),()=>{s.current=""}):(e.activeQuestionId.subscribe(({data:r})=>{var c;r&&((c=r.feedItem)==null?void 0:c.type)==="insight"&&(!n||e.isOpenedQuestion(r.feedItem.id)||(s.current=r.feedItem.id,e.openQuestion(r.feedItem.id,r.feedItem))),!r&&s.current&&(e.closeQuestion(s.current),s.current="")}),()=>{}),[e,n,t]),h?u.jsx(f,{sdk:o,skipAutoClose:a,hideHeader:d,gamification:e,hideSponsor:!0}):null},m=({sdk:e,persistent:o,skipAutoClose:n,insightId:a,hideHeader:d})=>{if(!i.useStore(e.featuresList.getStore()))return null;const t=e.getFeature(p.SdkOverlayType.GAMES);return t?u.jsx(g,{insightId:a,sdk:e,persistent:o,hideHeader:d,gamification:t,skipAutoClose:n}):null},I=({event:e,theme:o,hideHeader:n,skipAutoClose:a,persistent:d})=>{const t=i.useStreamLayer(),s=i.useStreamLayerTheme();return t?u.jsxs("div",{className:"StreamLayerSDK",children:[u.jsx(i.h,{customTheme:o??s.theme,themeMode:s.themeMode,children:u.jsx(m,{skipAutoClose:a,sdk:t,hideHeader:n,persistent:d})}),e!==void 0&&u.jsx(i.StreamLayerSDKEvent,{event:e})]}):null};exports.StreamLayerSDKInsight=I;exports.StreamLayerSDKInsightUI=m;
|
package/lib/cjs/notification.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),y=require("react");require("@nanostores/react");require("nanostores");const e=require("./provider.js");require("lodash.throttle");require("react-dom");require("react-countup");const r=require("./useStreamLayerApp2.js"),I=e.styled_default("div")({name:"Media",class:"m1bcvojl",propsAsIs:!1}),os=()=>I,is=e.styled_default(os())({name:"MediaImgBottom",class:"m58gin0",propsAsIs:!0}),ls=()=>I,w=e.styled_default(ls())({name:"MediaImgSolid",class:"m1atm8do",propsAsIs:!0}),as=()=>I,ds=e.styled_default(as())({name:"MediaImgRounded",class:"myx3xoi",propsAsIs:!0}),rs=()=>I,cs=e.styled_default(rs())({name:"MediaImgCentered",class:"m1bwv0gx",propsAsIs:!0}),us=()=>I,ps=e.styled_default(us())({name:"MediaImgInsight",class:"mntjanp",propsAsIs:!0}),ms=e.styled_default("div")({name:"VideoIcon",class:"v1kofb47",propsAsIs:!1}),ys={[r.QuestionImages.UNSET]:w,[r.QuestionImages.NONE]:w,[r.QuestionImages.ROUNDED]:ds,[r.QuestionImages.CENTERED]:cs,[r.QuestionImages.TRANSPARENT]:is,[r.QuestionImages.SOLID]:w},N=({src:t,imageMode:o=r.QuestionImages.UNSET,withVideo:i,fromInsight:n})=>{if(o===r.QuestionImages.NONE)return null;const l=n?ps:ys[o];return s.jsxs(l,{children:[s.jsx("img",{src:t,alt:""}),i&&s.jsx(ms,{children:s.jsx(e.B1,{name:"icon-play"})})]})},xs=e.styled_default("div")({name:"NotificationContent",class:"nuraq9m",propsAsIs:!1}),vs=e.styled_default("div")({name:"NotificationContainer",class:"ns1nzpg",propsAsIs:!1}),R=e.styled_default("div")({name:"Body",class:"b1j59nzs",propsAsIs:!1}),fs=e.styled_default("div")({name:"Title",class:"t9vmnpp",propsAsIs:!1}),js=e.styled_default("button")({name:"Button",class:"b14ivj5k",propsAsIs:!1}),Is=()=>e.B1,As=e.styled_default(Is())({name:"StyledChevronRight",class:"s1atci8n",propsAsIs:!0}),hs=e.styled_default("div")({name:"QuoteWrap",class:"q4w8jgs",propsAsIs:!1}),$s=e.styled_default("blockquote")({name:"Quote",class:"qaa0kez",propsAsIs:!1}),gs=e.styled_default("div")({name:"Body",class:"b1wvd52w",propsAsIs:!1}),_s=e.styled_default("div")({name:"Container",class:"ccvukea",propsAsIs:!1}),ws=({image:t,tweet:o,account:i,accountVerified:n,body:l,title:u})=>{var c;return s.jsxs(_s,{children:[u&&s.jsx(hs,{children:s.jsx($s,{children:u})}),s.jsx(e.D$2,{image:t,name:(c=o==null?void 0:o.meta)==null?void 0:c.accountName,userName:i,verified:n,createdTweet:o==null?void 0:o.date}),s.jsx(gs,{children:e.D$3(l)})]})},Ts=({title:t,questionType:o,questionTypeData:i})=>s.jsxs(R,{children:[s.jsx(e.x$1,{questionTypeData:i,questionType:o,questionStatus:r.QuestionStatus.UNSET}),t&&s.jsx(fs,{children:t})]}),bs=({tweet:t})=>t?s.jsx(R,{children:s.jsx(ws,{...t,controlVideo:()=>{}})}):null,Cs=({action:t,questionType:o,inApp:i,insight:n,tweet:l})=>{var u;const c=e.e[o],a=e.o[o];if(!c||!i||!i.notification)return null;const{title:p,image:m,imageMode:v}=i.notification;let x=m;o===r.QuestionType.TWEET&&l!=null&&l.tweetMedia&&(x=l.tweetMedia.image),v===r.QuestionImages.NONE&&(x="");const f=i.useMediaFromContent&&(n==null?void 0:n.image),d=o===r.QuestionType.TWEET&&((u=l==null?void 0:l.tweetMedia)==null?void 0:u.video)||o===r.QuestionType.FACTOID&&(n==null?void 0:n.video);return s.jsx(vs,{"data-a":"intr",className:"SL_InApp",onClick:t,children:s.jsxs(xs,{style:x?{}:{paddingLeft:"1.5rem"},children:[x&&!f&&s.jsx(N,{src:x,imageMode:v,withVideo:!!d}),f&&s.jsx(N,{src:f,fromInsight:!0,withVideo:!!d}),o===r.QuestionType.TWEET?s.jsx(bs,{tweet:l}):s.jsx(Ts,{questionTypeData:c,questionType:o,title:p}),s.jsx(js,{name:"inapp-button",children:a||"Open"}),s.jsx(As,{name:"chevronRight"})]})})},Ns=()=>({color:t})=>t,k=e.styled_default("div")({name:"MediaComponentWrap",class:"mek728j",propsAsIs:!1,vars:{"mek728j-0":[Ns()]}}),j=e.styled_default("div")({name:"Media",class:"m461t56",propsAsIs:!1}),ks=()=>j,qs=e.styled_default(ks())({name:"MediaImgBottom",class:"m22bh04",propsAsIs:!0}),Ss=()=>j,Es=e.styled_default(Ss())({name:"MediaVideo",class:"m17u1e34",propsAsIs:!0}),Ls=()=>j,Ms=e.styled_default(Ls())({name:"MediaImgContentMedia",class:"m4j3eds",propsAsIs:!0}),Ds=()=>j,Bs=e.styled_default(Ds())({name:"MediaImgSolid",class:"m1lp3swr",propsAsIs:!0}),Qs=()=>j,Rs=e.styled_default(Qs())({name:"MediaImgRounded",class:"mc7lij",propsAsIs:!0}),Os=()=>j,Us=e.styled_default(Os())({name:"MediaImgCentered",class:"mwwaw7o",propsAsIs:!0}),Ps=()=>j,T=e.styled_default(Ps())({name:"MediaNone",class:"mqfzyyr",propsAsIs:!0}),zs="v170mtgf",Vs={[r.QuestionImages.UNSET]:T,[r.QuestionImages.NONE]:T,[r.QuestionImages.ROUNDED]:Rs,[r.QuestionImages.CENTERED]:Us,[r.QuestionImages.TRANSPARENT]:qs,[r.QuestionImages.SOLID]:Bs},q=({src:t,imageMode:o=r.QuestionImages.UNSET,withVideo:i,color:n,useContentMedia:l,thumbnailUrl:u})=>{if(!t)return s.jsx(k,{color:n,children:s.jsx(T,{})});const c=l===r.NotificationUseContentMedia.ENABLED?Ms:Vs[o];return s.jsx(k,{color:n,children:i?s.jsx(Es,{children:s.jsx(e.Et,{className:zs,source:t,poster:u||""})}):s.jsx(c,{children:s.jsx("img",{src:t,alt:""})})})},Fs=()=>({withoutPadding:t})=>t?"0px":"1rem",O=e.styled_default("div")({name:"NotificationContent",class:"n1p3bk1c",propsAsIs:!1,vars:{"n1p3bk1c-0":[Fs()]}}),Ws=e.styled_default("div")({name:"MainContent",class:"m1g211mu",propsAsIs:!1}),Ys=()=>e.B1,Ks=e.styled_default(Ys())({name:"StyledChevronRight",class:"sx1hq4c",propsAsIs:!0}),U=e.styled_default("div")({name:"NotificationContainer",class:"n1fcriet",propsAsIs:!1}),Gs=()=>({questionType:t})=>t===r.QuestionType.FACTOID?"7.3rem":"4.5rem",Hs=()=>({webos:t})=>t?"11px 0px 8px 0px":"11px 0px",Js=()=>({imageMode:t,webos:o})=>o?"330px":t===r.QuestionImages.SOLID?"310px":t===r.QuestionImages.CENTERED||t===r.QuestionImages.ROUNDED||t===r.QuestionImages.TRANSPARENT?"370px":"430px",Xs=e.styled_default("div")({name:"Body",class:"b1byyovs",propsAsIs:!1,vars:{"b1byyovs-0":[Gs()],"b1byyovs-1":[Hs()],"b1byyovs-2":[Js()]}}),Zs=()=>({webos:t})=>t?"0.85rem":"1.033rem",se=()=>({webos:t})=>t?"0.95rem":"1.25rem",ee=()=>({webos:t})=>t?"4.7rem":"2.25rem",te=()=>({webos:t})=>t?"pre-wrap":"nowrap",ne=e.styled_default("div")({name:"Title",class:"t1y5k5id",propsAsIs:!1,vars:{"t1y5k5id-0":[Zs()],"t1y5k5id-1":[se()],"t1y5k5id-2":[ee()],"t1y5k5id-3":[te()]}}),oe=e.styled_default("div")({name:"Description",class:"dw9eb7l",propsAsIs:!1}),ie=e.styled_default("div")({name:"LogoImgContainer",class:"ldu8wgy",propsAsIs:!1}),P=e.styled_default("img")({name:"LogoImg",class:"ln4a3eh",propsAsIs:!1}),le=()=>U,ae=e.styled_default(le())({name:"NotificationInterstitialContainer",class:"no2k63v",propsAsIs:!0}),de=e.styled_default("div")({name:"TVButtons",class:"th9nn6a",propsAsIs:!1}),z=e.styled_default("button")({name:"TVButton",class:"t1eee77p",propsAsIs:!1}),re=()=>z,ce=e.styled_default(re())({name:"DismissButton",class:"ds000hw",propsAsIs:!0}),ue=()=>z,pe=e.styled_default(ue())({name:"AnswerButton",class:"a1nz9hoe",propsAsIs:!0}),me=({title:t,questionType:o,questionTypeData:i,description:n,imageMode:l,webos:u})=>s.jsxs(Xs,{imageMode:l,questionType:o,webos:u,children:[s.jsx(e.x$1,{questionTypeData:i,questionType:o,questionStatus:r.QuestionStatus.UNSET}),t&&s.jsx(ne,{webos:u,children:t}),n&&s.jsx(oe,{children:n})]}),ye=e.O(ae),xe=e.O(ce),ve=e.O(pe),fe=({sponsorLogo:t,onClick:o,webos:i})=>s.jsx(ye,{autoFocus:!0,webos:i,onClick:o,"data-webos":i,children:s.jsx(O,{withoutPadding:!0,children:s.jsx(P,{src:t})})}),je=({action:t,close:o,questionType:i,inApp:n,insight:l,color:u,webos:c})=>{var a,p,m;const[v,x]=y.useState(!1),f=y.useRef();y.useEffect(()=>(n!=null&&n.sponsorLogo&&(x(!0),f.current=setTimeout(()=>{x(!1)},5e3)),()=>clearTimeout(f.current)),[n==null?void 0:n.sponsorLogo]);const d=e.e[i];if(!d||!n||!n.notification)return null;const{title:Z,image:ss,imageMode:h,useContentMedia:$}=n.notification,es=i===r.QuestionType.FACTOID?l==null?void 0:l.heading:Z,ts=i===r.QuestionType.FACTOID?l==null?void 0:l.body:"",ns=ss,g=i===r.QuestionType.FACTOID&&((a=l==null?void 0:l.video)==null?void 0:a.url)&&(n==null?void 0:n.isVideo)&&$===r.NotificationUseContentMedia.ENABLED,_=$===r.NotificationUseContentMedia.ENABLED?g?(p=l==null?void 0:l.video)==null?void 0:p.url:l==null?void 0:l.image:"";return n!=null&&n.sponsorLogo&&v?s.jsx(fe,{sponsorLogo:n==null?void 0:n.sponsorLogo,webos:c,onClick:()=>x(!1)}):s.jsxs(U,{"data-a":"intr",className:"SL_InApp",onClick:A=>{c||t==null||t(A)},"data-is-insight":i===r.QuestionType.FACTOID,"data-webos":c,children:[(n==null?void 0:n.sponsorLogo)&&s.jsx(ie,{children:s.jsx(P,{src:n==null?void 0:n.sponsorLogo})}),s.jsxs(O,{children:[s.jsxs(Ws,{children:[!_&&s.jsx(q,{src:ns,imageMode:h,withVideo:!!g,color:u}),_&&s.jsx(q,{src:_,imageMode:h,withVideo:!!g,color:u,useContentMedia:$,thumbnailUrl:(m=l==null?void 0:l.video)==null?void 0:m.thumbnailUrl}),s.jsx(me,{questionTypeData:d,questionType:i,title:es,description:ts,imageMode:h,webos:c})]}),!c&&s.jsx(Ks,{name:"chevronRight"}),c&&s.jsxs(de,{children:[s.jsx(xe,{webos:!0,"data-close-btn":"true",onClick:A=>{A.stopPropagation(),o==null||o(A)},children:"Dismiss"}),s.jsx(ve,{webos:!0,autoFocus:!0,onClick:t,children:"Answer"})]})]})]})},Ie=e.styled_default("div")({name:"NotificationContainer",class:"n11jcrxe",propsAsIs:!1}),S=e.styled_default("img")({name:"Icon",class:"i1vmpt6u",propsAsIs:!1}),Ae=e.styled_default("div")({name:"IconContainer",class:"i180665s",propsAsIs:!1}),he=()=>e.B1,$e=e.styled_default(he())({name:"TitleIcon",class:"t16zzzei",propsAsIs:!0}),ge=()=>e.y,_e=e.styled_default(ge())({name:"Close",class:"c1sur0q2",propsAsIs:!0}),we=e.styled_default("div")({name:"Body",class:"bai9j52",propsAsIs:!1}),Te=e.styled_default("div")({name:"Title",class:"t1bnt25p",propsAsIs:!1}),be=e.styled_default("div")({name:"Description",class:"dmixjec",propsAsIs:!1}),Ce=e.styled_default("button")({name:"Button",class:"b1ubkw1q",propsAsIs:!1}),Ne=({open:t,close:o,...i})=>{var n,l;return s.jsxs(Ie,{"data-a":"intr",onClick:()=>{t==null||t(),i&&i.markIstantOpen()},children:[s.jsxs(Ae,{children:[s.jsx(S,{className:"on-light",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification.png"}),s.jsx(S,{className:"on-dark",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification-dark.png"})]}),s.jsxs(we,{children:[s.jsxs(Te,{children:[s.jsx($e,{name:"icon-trophy-solid"}),(n=i==null?void 0:i.titleCard)==null?void 0:n.title]}),s.jsxs(be,{children:[s.jsx("span",{children:(l=i==null?void 0:i.titleCard)==null?void 0:l.subtitle}),s.jsx(Ce,{name:"inapp-button",children:"Play Now"})]})]}),s.jsx(_e,{close:u=>{u==null||u.stopPropagation(),o==null||o()}})]})},ke=e.styled_default("div")({name:"Container",class:"cef8huz",propsAsIs:!1}),qe=()=>e.B1,Se=e.styled_default(qe())({name:"CheckIcon",class:"c1mo15kk",propsAsIs:!0}),Ee=()=>e.B1,Le=e.styled_default(Ee())({name:"PredictionIcon",class:"p16zkqnm",propsAsIs:!0}),Me=e.styled_default("div")({name:"PredictionIconContainer",class:"pjszi7a",propsAsIs:!1}),De=e.styled_default("div")({name:"BodyContainer",class:"bftbmo3",propsAsIs:!1}),Be=e.styled_default("div")({name:"Body",class:"barrbyu",propsAsIs:!1}),Qe=e.styled_default("div")({name:"Subtitle",class:"sz7237i",propsAsIs:!1}),Re=({step:t,children:o,answer:i,state:n="pending"})=>{const[l,u]=y.useState(0),[c]=y.useState(()=>new ResizeObserver(p=>{window.requestAnimationFrame(()=>{var m,v;u(((v=(m=p==null?void 0:p[0])==null?void 0:m.contentRect)==null?void 0:v.width)??0)})})),a=y.useCallback(p=>{p?c.observe(p):c.disconnect()},[c]);return y.useEffect(()=>()=>{c.disconnect()},[c]),s.jsxs(ke,{children:[s.jsx(Me,{children:s.jsx(Le,{name:"icon-prediction"})}),s.jsx(De,{style:{minWidth:`${l}px`},children:s.jsx(Be,{children:o},t)}),s.jsx(Qe,{ref:a,className:n,children:s.jsxs("div",{children:[s.jsx(Se,{name:"icon-check"}),"Your Pick: ",i]})})]})},Oe=e.styled_default("div")({name:"Container",class:"ckyzolp",propsAsIs:!1}),b=e.styled_default("div")({name:"Line",class:"l16t1zr7",propsAsIs:!1}),Ue=()=>b,Pe=e.styled_default(Ue())({name:"Line1",class:"le78kvg",propsAsIs:!0}),ze=()=>b,Ve=e.styled_default(ze())({name:"Line2",class:"l1o7966d",propsAsIs:!0}),Fe=()=>b,We=e.styled_default(Fe())({name:"Line3",class:"lu9lyxq",propsAsIs:!0}),Ye=()=>s.jsxs(Oe,{children:[s.jsx(Pe,{children:s.jsx("div",{})}),s.jsx(Ve,{children:s.jsx("div",{})}),s.jsx(We,{children:s.jsx("div",{})})]}),Ke=e.styled_default("div")({name:"Container",class:"c10jy6zf",propsAsIs:!1}),Ge=()=>e.B1,He=e.styled_default(Ge())({name:"CheckIcon",class:"c1c7scay",propsAsIs:!0}),Je=()=>s.jsxs(Ke,{children:[s.jsx(He,{name:"icon-check"})," Prediction results are in!"]}),Xe=e.styled_default("div")({name:"Container",class:"cf6k2yy",propsAsIs:!1}),Ze=e.styled_default("div")({name:"Caption",class:"c1c8xjus",propsAsIs:!1}),st=e.styled_default("div")({name:"Title",class:"t1d1uekn",propsAsIs:!1}),et=({title:t})=>s.jsxs(Xe,{children:[s.jsx(Ze,{children:"Results for"}),s.jsx(st,{children:t})]}),V=e.styled_default("div")({name:"Container",class:"c181a1as",propsAsIs:!1}),F=e.styled_default("div")({name:"Title",class:"t1cduox6",propsAsIs:!1}),tt=()=>e.B1,W=e.styled_default(tt())({name:"CorrectIcon",class:"c1onrv6j",propsAsIs:!0}),nt=()=>W,ot=e.styled_default(nt())({name:"InCorrectIcon",class:"i17n9o7e",propsAsIs:!0}),it=()=>s.jsxs(V,{children:[s.jsxs(F,{children:["Congratulations!",s.jsx("br",{}),"You answered correctly."]}),s.jsx(W,{name:"icon-check"})]}),lt=({title:t})=>s.jsxs(V,{children:[s.jsxs(F,{children:["Better luck next time!",s.jsx("br",{}),"Correct: ",t]}),s.jsx(ot,{name:"icon-cross"})]}),at=e.styled_default("div")({name:"Container",class:"cnxgcs2",propsAsIs:!1}),dt=e.styled_default("div")({name:"Title",class:"t903f8n",propsAsIs:!1}),rt=()=>e.B1,ct=e.styled_default(rt())({name:"CheckIcon",class:"ceyu3qj",propsAsIs:!0}),ut=({points:t})=>s.jsxs(at,{children:[s.jsxs(dt,{children:["You won ",s.jsx(e.d,{delay:.5,prefix:"+",suffix:" points",value:t})]}),s.jsx(ct,{name:"icon-trophy-solid"})]}),E=e.styled_default("div")({name:"Container",class:"cq3agu2",propsAsIs:!1}),L=e.styled_default("div")({name:"Body",class:"b16qj0do",propsAsIs:!1}),M={1:3e3,2:4e3,3:4e3,4:4e3},pt=({close:t,action:o,setStep:i,votedAnswer:n,correct:l,correctAnswerTitle:u,questionTitle:c,step:a})=>{if(y.useEffect(()=>{if(i){const m=setTimeout(()=>{M[a+1]&&(l||a<3)?i(a+1):t==null||t()},M[a]);return()=>{m&&clearTimeout(m)}}return()=>{}},[i,a,t,l]),a===1)return s.jsx(E,{children:s.jsx(L,{children:s.jsx(Je,{})})});let p="pending";return(a===3||a===4)&&(p=l?"correct":"incorrect"),s.jsx(E,{"data-a":"intr",onClick:()=>o==null?void 0:o(),children:s.jsxs(L,{children:[a!==1&&s.jsx(Ye,{},a),s.jsxs(Re,{state:p,step:a,answer:(n==null?void 0:n.title)||"unknown",children:[a===2&&s.jsx(et,{title:c||"unknown"}),a===3&&l&&s.jsx(it,{}),a===3&&!l&&s.jsx(lt,{title:u||"unknown"}),a===4&&s.jsx(ut,{points:(n==null?void 0:n.points)||0})]})]})})},mt=({close:t,action:o,votedAnswer:i,correct:n,correctAnswerTitle:l,questionTitle:u})=>{const[c,a]=y.useState(1);return s.jsx(pt,{close:t,action:o,votedAnswer:i,correct:n,correctAnswerTitle:l,questionTitle:u,setStep:a,step:c,title:""})},yt=e.styled_default("div")({name:"NotificationContainer",class:"n1i4h28u",propsAsIs:!1}),xt=t=>s.jsx(yt,{children:s.jsx(mt,{...t})}),vt=e.styled_default("div")({name:"Container",class:"cwa9tgs",propsAsIs:!1}),ft=e.styled_default("div")({name:"BodyContainer",class:"b1xx7swj",propsAsIs:!1}),jt=e.styled_default("div")({name:"Body",class:"b1a21en",propsAsIs:!1}),It=({step:t,children:o,state:i="pending"})=>{const[n,l]=y.useState(0);return y.useEffect(()=>{const u=new ResizeObserver(c=>{window.requestAnimationFrame(()=>{var a,p;const m=((p=(a=c==null?void 0:c[0])==null?void 0:a.contentRect)==null?void 0:p.width)??0;l(m)})});return()=>{u.disconnect()}},[]),s.jsx(vt,{style:{padding:`${t===3&&i==="incorrect"||t===1?"5px 100px":"5px 40px"}`},children:s.jsx(ft,{style:{minWidth:`${n}px`},children:s.jsx(jt,{children:o},t)})})},At=e.styled_default("div")({name:"Container",class:"c1nd5cu8",propsAsIs:!1}),C=e.styled_default("div")({name:"Line",class:"lgbipw0",propsAsIs:!1}),ht=()=>C,$t=e.styled_default(ht())({name:"Line1",class:"l1anth16",propsAsIs:!0}),gt=()=>C,_t=e.styled_default(gt())({name:"Line2",class:"l193yd7v",propsAsIs:!0}),wt=()=>C,Tt=e.styled_default(wt())({name:"Line3",class:"lhbflsp",propsAsIs:!0}),bt=()=>s.jsxs(At,{children:[s.jsx($t,{children:s.jsx("div",{})}),s.jsx(_t,{children:s.jsx("div",{})}),s.jsx(Tt,{children:s.jsx("div",{})})]}),Ct=e.styled_default("div")({name:"Container",class:"c1lvd429",propsAsIs:!1}),Nt=()=>e.B1,kt=e.styled_default(Nt())({name:"PredictionIcon",class:"p1n4m87t",propsAsIs:!0}),qt=()=>s.jsxs(Ct,{children:[s.jsx(kt,{name:"icon-prediction"})," Prediction results are in!"]}),St=()=>e.B1,Et=e.styled_default(St())({name:"CheckIcon",class:"c126r8f9",propsAsIs:!0}),Lt=e.styled_default("div")({name:"Answer",class:"a1o2rpgl",propsAsIs:!1}),Mt=e.styled_default("div")({name:"Container",class:"cej6ci1",propsAsIs:!1}),Dt=e.styled_default("div")({name:"Title",class:"tob24mr",propsAsIs:!1}),Bt=({title:t,answer:o})=>s.jsxs(Mt,{children:[s.jsx(Dt,{children:t}),s.jsxs(Lt,{children:[s.jsx(Et,{name:"icon-prediction"}),"Your Pick: ",o]})]}),Y=e.styled_default("div")({name:"Container",class:"c1lesal4",propsAsIs:!1}),K=e.styled_default("div")({name:"Title",class:"tv66n4w",propsAsIs:!1}),Qt=()=>e.B1,Rt=e.styled_default(Qt())({name:"CorrectIcon",class:"cx0vlv2",propsAsIs:!0}),G=e.styled_default("div")({name:"Answer",class:"akfh4v5",propsAsIs:!1}),Ot=({answer:t})=>s.jsxs(Y,{children:[s.jsx(K,{children:"Congratulations! You answered correctly."}),s.jsxs(G,{children:[s.jsx(Rt,{name:"icon-correct"}),"Your Pick: ",t]})]}),Ut=({title:t,answer:o})=>s.jsxs(Y,{children:[s.jsxs(K,{children:["Better luck next time!",s.jsx("br",{}),"Correct: ",t]}),s.jsxs(G,{children:["Your Pick: ",o]})]}),D=e.styled_default("div")({name:"Container",class:"cmox3ot",propsAsIs:!1}),B=e.styled_default("div")({name:"Body",class:"bqq1ix4",propsAsIs:!1}),Q={1:3e3,2:4e3,3:4e3},Pt=({close:t,action:o,setStep:i,votedAnswer:n,correct:l,correctAnswerTitle:u,questionTitle:c,step:a})=>{if(y.useEffect(()=>{if(i){const m=setTimeout(()=>{Q[a+1]&&(l||a<3)?i(a+1):t==null||t()},Q[a]);return()=>{m&&clearTimeout(m)}}return()=>{}},[i,a,t,l]),a===1)return s.jsx(D,{children:s.jsx(B,{children:s.jsx(qt,{})})});let p="pending";return a===3&&(p=l?"correct":"incorrect"),s.jsx(D,{"data-a":"intr",onClick:()=>o==null?void 0:o(),children:s.jsxs(B,{children:[a!==1&&s.jsx(bt,{},a),s.jsxs(It,{state:p,step:a,children:[a===2&&s.jsx(Bt,{title:c||"unknown",answer:(n==null?void 0:n.title)||"unknown"}),a===3&&l&&s.jsx(Ot,{answer:(n==null?void 0:n.title)||"unknown"}),a===3&&!l&&s.jsx(Ut,{title:u||"unknown",answer:(n==null?void 0:n.title)||"unknown"})]})]})})},zt=({close:t,action:o,votedAnswer:i,correct:n,correctAnswerTitle:l,questionTitle:u})=>{const[c,a]=y.useState(1);return s.jsx(Pt,{close:t,action:o,votedAnswer:i,correct:n,correctAnswerTitle:l,questionTitle:u,setStep:a,step:c,title:""})},H=e.styled_default("div")({name:"NotificationContainer",class:"nn0nqh6",propsAsIs:!1}),Vt=()=>({withoutPadding:t})=>t?"0px":"1rem",Ft=e.styled_default("div")({name:"NotificationContent",class:"n1bcdf3j",propsAsIs:!1,vars:{"n1bcdf3j-0":[Vt()]}}),J=e.styled_default("img")({name:"LogoImg",class:"l8jorbq",propsAsIs:!1}),Wt=()=>H,Yt=e.styled_default(Wt())({name:"NotificationInterstitialContainer",class:"nf920y3",propsAsIs:!0}),Kt=e.styled_default("div")({name:"LogoImgContainer",class:"lzsmehn",propsAsIs:!1}),Gt=({sponsorLogo:t,onClick:o})=>s.jsx(Yt,{onClick:o,children:s.jsx(Ft,{withoutPadding:!0,children:s.jsx(J,{src:t})})}),Ht=t=>{var o,i,n,l,u;const[c,a]=y.useState(!1),p=y.useRef();return y.useEffect(()=>{var m;return(m=t==null?void 0:t.inApp)!=null&&m.sponsorLogo&&(a(!0),p.current=setTimeout(()=>{a(!1)},5e3)),()=>clearTimeout(p.current)},[(o=t==null?void 0:t.inApp)==null?void 0:o.sponsorLogo]),(i=t==null?void 0:t.inApp)!=null&&i.sponsorLogo&&c?s.jsx(Gt,{sponsorLogo:(n=t.inApp)==null?void 0:n.sponsorLogo,onClick:()=>a(!1)}):s.jsx(H,{children:s.jsxs("div",{children:[((l=t==null?void 0:t.inApp)==null?void 0:l.sponsorLogo)&&s.jsx(Kt,{children:s.jsx(J,{src:(u=t==null?void 0:t.inApp)==null?void 0:u.sponsorLogo})}),s.jsx(zt,{...t})]})})},X=({sdk:t,webos:o})=>{var i,n,l,u,c,a,p,m;const[v]=y.useState(t.getNotificationsStore()),x=e.useStore(v),f=t.getFeature(r.SdkOverlayType.GAMES),d=y.useMemo(()=>t.getActiveNotification(),[t,x]);return y.useEffect(()=>{d&&e.eventBus.emit("notification",{action:"rendered",payload:{questionId:d.data.questionId,questionType:d.data.questionType}})},[d]),d&&d.type===e.NotificationType.QUESTION_RESOLVED?d.data.question&&d.data.questionType===r.QuestionType.PREDICTION?d&&((i=d.data.inApp)==null?void 0:i.adUnit)===r.AdUnit.STANDART?s.jsx(Ht,{action:d.action,close:d.close,...d.data.question,inApp:d.data.inApp}):s.jsx(xt,{action:d.action,close:d.close,...d.data.question}):null:d&&d.type===e.NotificationType.ONBOARDING?d.data.onboarding?s.jsx(Ne,{open:f==null?void 0:f.openOnboarding,close:d.close,...d.data.onboarding}):null:d&&((n=d.data.inApp)==null?void 0:n.adUnit)===r.AdUnit.STANDART?s.jsx(je,{...d.data,action:d.action,close:d.close,color:((c=(u=(l=d==null?void 0:d.data)==null?void 0:l.inApp)==null?void 0:u.notification)==null?void 0:c.indicatorColor)||((m=(p=(a=d==null?void 0:d.data)==null?void 0:a.inApp)==null?void 0:p.appearance)==null?void 0:m.primaryColor),webos:o}):d&&s.jsx(Cs,{...d.data,action:d.action})},Jt=({theme:t})=>{const o=e.useStreamLayer(),i=e.useStreamLayerTheme(),n=e.useStreamLayerUI();return o&&(n.appNotification||n.onboardingNotification)?n.app&&!n.onboardingNotification?null:s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(e.h,{customTheme:t??i.theme,themeMode:i.themeMode,children:s.jsx(X,{sdk:o})})}):null};exports.StreamLayerSDKNotification=Jt;exports.StreamLayerSDKNotificationUI=X;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),y=require("react");require("nanostores");const e=require("./provider.js");require("lodash.throttle");require("react-dom");require("react-countup");const r=require("./useStreamLayerApp2.js"),I=e.styled_default("div")({name:"Media",class:"m1bcvojl",propsAsIs:!1}),os=()=>I,is=e.styled_default(os())({name:"MediaImgBottom",class:"m58gin0",propsAsIs:!0}),ls=()=>I,w=e.styled_default(ls())({name:"MediaImgSolid",class:"m1atm8do",propsAsIs:!0}),as=()=>I,ds=e.styled_default(as())({name:"MediaImgRounded",class:"myx3xoi",propsAsIs:!0}),rs=()=>I,cs=e.styled_default(rs())({name:"MediaImgCentered",class:"m1bwv0gx",propsAsIs:!0}),us=()=>I,ps=e.styled_default(us())({name:"MediaImgInsight",class:"mntjanp",propsAsIs:!0}),ms=e.styled_default("div")({name:"VideoIcon",class:"v1kofb47",propsAsIs:!1}),ys={[r.QuestionImages.UNSET]:w,[r.QuestionImages.NONE]:w,[r.QuestionImages.ROUNDED]:ds,[r.QuestionImages.CENTERED]:cs,[r.QuestionImages.TRANSPARENT]:is,[r.QuestionImages.SOLID]:w},N=({src:t,imageMode:o=r.QuestionImages.UNSET,withVideo:i,fromInsight:n})=>{if(o===r.QuestionImages.NONE)return null;const l=n?ps:ys[o];return s.jsxs(l,{children:[s.jsx("img",{src:t,alt:""}),i&&s.jsx(ms,{children:s.jsx(e.B1,{name:"icon-play"})})]})},xs=e.styled_default("div")({name:"NotificationContent",class:"nuraq9m",propsAsIs:!1}),vs=e.styled_default("div")({name:"NotificationContainer",class:"ns1nzpg",propsAsIs:!1}),R=e.styled_default("div")({name:"Body",class:"b1j59nzs",propsAsIs:!1}),fs=e.styled_default("div")({name:"Title",class:"t9vmnpp",propsAsIs:!1}),js=e.styled_default("button")({name:"Button",class:"b14ivj5k",propsAsIs:!1}),Is=()=>e.B1,As=e.styled_default(Is())({name:"StyledChevronRight",class:"s1atci8n",propsAsIs:!0}),hs=e.styled_default("div")({name:"QuoteWrap",class:"q4w8jgs",propsAsIs:!1}),$s=e.styled_default("blockquote")({name:"Quote",class:"qaa0kez",propsAsIs:!1}),gs=e.styled_default("div")({name:"Body",class:"b1wvd52w",propsAsIs:!1}),_s=e.styled_default("div")({name:"Container",class:"ccvukea",propsAsIs:!1}),ws=({image:t,tweet:o,account:i,accountVerified:n,body:l,title:u})=>{var c;return s.jsxs(_s,{children:[u&&s.jsx(hs,{children:s.jsx($s,{children:u})}),s.jsx(e.D$2,{image:t,name:(c=o==null?void 0:o.meta)==null?void 0:c.accountName,userName:i,verified:n,createdTweet:o==null?void 0:o.date}),s.jsx(gs,{children:e.D$3(l)})]})},Ts=({title:t,questionType:o,questionTypeData:i})=>s.jsxs(R,{children:[s.jsx(e.x$1,{questionTypeData:i,questionType:o,questionStatus:r.QuestionStatus.UNSET}),t&&s.jsx(fs,{children:t})]}),bs=({tweet:t})=>t?s.jsx(R,{children:s.jsx(ws,{...t,controlVideo:()=>{}})}):null,Cs=({action:t,questionType:o,inApp:i,insight:n,tweet:l})=>{var u;const c=e.e[o],a=e.o[o];if(!c||!i||!i.notification)return null;const{title:p,image:m,imageMode:v}=i.notification;let x=m;o===r.QuestionType.TWEET&&l!=null&&l.tweetMedia&&(x=l.tweetMedia.image),v===r.QuestionImages.NONE&&(x="");const f=i.useMediaFromContent&&(n==null?void 0:n.image),d=o===r.QuestionType.TWEET&&((u=l==null?void 0:l.tweetMedia)==null?void 0:u.video)||o===r.QuestionType.FACTOID&&(n==null?void 0:n.video);return s.jsx(vs,{"data-a":"intr",className:"SL_InApp",onClick:t,children:s.jsxs(xs,{style:x?{}:{paddingLeft:"1.5rem"},children:[x&&!f&&s.jsx(N,{src:x,imageMode:v,withVideo:!!d}),f&&s.jsx(N,{src:f,fromInsight:!0,withVideo:!!d}),o===r.QuestionType.TWEET?s.jsx(bs,{tweet:l}):s.jsx(Ts,{questionTypeData:c,questionType:o,title:p}),s.jsx(js,{name:"inapp-button",children:a||"Open"}),s.jsx(As,{name:"chevronRight"})]})})},Ns=()=>({color:t})=>t,k=e.styled_default("div")({name:"MediaComponentWrap",class:"mek728j",propsAsIs:!1,vars:{"mek728j-0":[Ns()]}}),j=e.styled_default("div")({name:"Media",class:"m461t56",propsAsIs:!1}),ks=()=>j,qs=e.styled_default(ks())({name:"MediaImgBottom",class:"m22bh04",propsAsIs:!0}),Ss=()=>j,Es=e.styled_default(Ss())({name:"MediaVideo",class:"m17u1e34",propsAsIs:!0}),Ls=()=>j,Ms=e.styled_default(Ls())({name:"MediaImgContentMedia",class:"m4j3eds",propsAsIs:!0}),Ds=()=>j,Bs=e.styled_default(Ds())({name:"MediaImgSolid",class:"m1lp3swr",propsAsIs:!0}),Qs=()=>j,Rs=e.styled_default(Qs())({name:"MediaImgRounded",class:"mc7lij",propsAsIs:!0}),Os=()=>j,Us=e.styled_default(Os())({name:"MediaImgCentered",class:"mwwaw7o",propsAsIs:!0}),Ps=()=>j,T=e.styled_default(Ps())({name:"MediaNone",class:"mqfzyyr",propsAsIs:!0}),zs="v170mtgf",Vs={[r.QuestionImages.UNSET]:T,[r.QuestionImages.NONE]:T,[r.QuestionImages.ROUNDED]:Rs,[r.QuestionImages.CENTERED]:Us,[r.QuestionImages.TRANSPARENT]:qs,[r.QuestionImages.SOLID]:Bs},q=({src:t,imageMode:o=r.QuestionImages.UNSET,withVideo:i,color:n,useContentMedia:l,thumbnailUrl:u})=>{if(!t)return s.jsx(k,{color:n,children:s.jsx(T,{})});const c=l===r.NotificationUseContentMedia.ENABLED?Ms:Vs[o];return s.jsx(k,{color:n,children:i?s.jsx(Es,{children:s.jsx(e.Et,{className:zs,source:t,poster:u||""})}):s.jsx(c,{children:s.jsx("img",{src:t,alt:""})})})},Fs=()=>({withoutPadding:t})=>t?"0px":"1rem",O=e.styled_default("div")({name:"NotificationContent",class:"n1p3bk1c",propsAsIs:!1,vars:{"n1p3bk1c-0":[Fs()]}}),Ws=e.styled_default("div")({name:"MainContent",class:"m1g211mu",propsAsIs:!1}),Ys=()=>e.B1,Ks=e.styled_default(Ys())({name:"StyledChevronRight",class:"sx1hq4c",propsAsIs:!0}),U=e.styled_default("div")({name:"NotificationContainer",class:"n1fcriet",propsAsIs:!1}),Gs=()=>({questionType:t})=>t===r.QuestionType.FACTOID?"7.3rem":"4.5rem",Hs=()=>({webos:t})=>t?"11px 0px 8px 0px":"11px 0px",Js=()=>({imageMode:t,webos:o})=>o?"330px":t===r.QuestionImages.SOLID?"310px":t===r.QuestionImages.CENTERED||t===r.QuestionImages.ROUNDED||t===r.QuestionImages.TRANSPARENT?"370px":"430px",Xs=e.styled_default("div")({name:"Body",class:"b1byyovs",propsAsIs:!1,vars:{"b1byyovs-0":[Gs()],"b1byyovs-1":[Hs()],"b1byyovs-2":[Js()]}}),Zs=()=>({webos:t})=>t?"0.85rem":"1.033rem",se=()=>({webos:t})=>t?"0.95rem":"1.25rem",ee=()=>({webos:t})=>t?"4.7rem":"2.25rem",te=()=>({webos:t})=>t?"pre-wrap":"nowrap",ne=e.styled_default("div")({name:"Title",class:"t1y5k5id",propsAsIs:!1,vars:{"t1y5k5id-0":[Zs()],"t1y5k5id-1":[se()],"t1y5k5id-2":[ee()],"t1y5k5id-3":[te()]}}),oe=e.styled_default("div")({name:"Description",class:"dw9eb7l",propsAsIs:!1}),ie=e.styled_default("div")({name:"LogoImgContainer",class:"ldu8wgy",propsAsIs:!1}),P=e.styled_default("img")({name:"LogoImg",class:"ln4a3eh",propsAsIs:!1}),le=()=>U,ae=e.styled_default(le())({name:"NotificationInterstitialContainer",class:"no2k63v",propsAsIs:!0}),de=e.styled_default("div")({name:"TVButtons",class:"th9nn6a",propsAsIs:!1}),z=e.styled_default("button")({name:"TVButton",class:"t1eee77p",propsAsIs:!1}),re=()=>z,ce=e.styled_default(re())({name:"DismissButton",class:"ds000hw",propsAsIs:!0}),ue=()=>z,pe=e.styled_default(ue())({name:"AnswerButton",class:"a1nz9hoe",propsAsIs:!0}),me=({title:t,questionType:o,questionTypeData:i,description:n,imageMode:l,webos:u})=>s.jsxs(Xs,{imageMode:l,questionType:o,webos:u,children:[s.jsx(e.x$1,{questionTypeData:i,questionType:o,questionStatus:r.QuestionStatus.UNSET}),t&&s.jsx(ne,{webos:u,children:t}),n&&s.jsx(oe,{children:n})]}),ye=e.O(ae),xe=e.O(ce),ve=e.O(pe),fe=({sponsorLogo:t,onClick:o,webos:i})=>s.jsx(ye,{autoFocus:!0,webos:i,onClick:o,"data-webos":i,children:s.jsx(O,{withoutPadding:!0,children:s.jsx(P,{src:t})})}),je=({action:t,close:o,questionType:i,inApp:n,insight:l,color:u,webos:c})=>{var a,p,m;const[v,x]=y.useState(!1),f=y.useRef();y.useEffect(()=>(n!=null&&n.sponsorLogo&&(x(!0),f.current=setTimeout(()=>{x(!1)},5e3)),()=>clearTimeout(f.current)),[n==null?void 0:n.sponsorLogo]);const d=e.e[i];if(!d||!n||!n.notification)return null;const{title:Z,image:ss,imageMode:h,useContentMedia:$}=n.notification,es=i===r.QuestionType.FACTOID?l==null?void 0:l.heading:Z,ts=i===r.QuestionType.FACTOID?l==null?void 0:l.body:"",ns=ss,g=i===r.QuestionType.FACTOID&&((a=l==null?void 0:l.video)==null?void 0:a.url)&&(n==null?void 0:n.isVideo)&&$===r.NotificationUseContentMedia.ENABLED,_=$===r.NotificationUseContentMedia.ENABLED?g?(p=l==null?void 0:l.video)==null?void 0:p.url:l==null?void 0:l.image:"";return n!=null&&n.sponsorLogo&&v?s.jsx(fe,{sponsorLogo:n==null?void 0:n.sponsorLogo,webos:c,onClick:()=>x(!1)}):s.jsxs(U,{"data-a":"intr",className:"SL_InApp",onClick:A=>{c||t==null||t(A)},"data-is-insight":i===r.QuestionType.FACTOID,"data-webos":c,children:[(n==null?void 0:n.sponsorLogo)&&s.jsx(ie,{children:s.jsx(P,{src:n==null?void 0:n.sponsorLogo})}),s.jsxs(O,{children:[s.jsxs(Ws,{children:[!_&&s.jsx(q,{src:ns,imageMode:h,withVideo:!!g,color:u}),_&&s.jsx(q,{src:_,imageMode:h,withVideo:!!g,color:u,useContentMedia:$,thumbnailUrl:(m=l==null?void 0:l.video)==null?void 0:m.thumbnailUrl}),s.jsx(me,{questionTypeData:d,questionType:i,title:es,description:ts,imageMode:h,webos:c})]}),!c&&s.jsx(Ks,{name:"chevronRight"}),c&&s.jsxs(de,{children:[s.jsx(xe,{webos:!0,"data-close-btn":"true",onClick:A=>{A.stopPropagation(),o==null||o(A)},children:"Dismiss"}),s.jsx(ve,{webos:!0,autoFocus:!0,onClick:t,children:"Answer"})]})]})]})},Ie=e.styled_default("div")({name:"NotificationContainer",class:"n11jcrxe",propsAsIs:!1}),S=e.styled_default("img")({name:"Icon",class:"i1vmpt6u",propsAsIs:!1}),Ae=e.styled_default("div")({name:"IconContainer",class:"i180665s",propsAsIs:!1}),he=()=>e.B1,$e=e.styled_default(he())({name:"TitleIcon",class:"t16zzzei",propsAsIs:!0}),ge=()=>e.y,_e=e.styled_default(ge())({name:"Close",class:"c1sur0q2",propsAsIs:!0}),we=e.styled_default("div")({name:"Body",class:"bai9j52",propsAsIs:!1}),Te=e.styled_default("div")({name:"Title",class:"t1bnt25p",propsAsIs:!1}),be=e.styled_default("div")({name:"Description",class:"dmixjec",propsAsIs:!1}),Ce=e.styled_default("button")({name:"Button",class:"b1ubkw1q",propsAsIs:!1}),Ne=({open:t,close:o,...i})=>{var n,l;return s.jsxs(Ie,{"data-a":"intr",onClick:()=>{t==null||t(),i&&i.markIstantOpen()},children:[s.jsxs(Ae,{children:[s.jsx(S,{className:"on-light",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification.png"}),s.jsx(S,{className:"on-dark",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification-dark.png"})]}),s.jsxs(we,{children:[s.jsxs(Te,{children:[s.jsx($e,{name:"icon-trophy-solid"}),(n=i==null?void 0:i.titleCard)==null?void 0:n.title]}),s.jsxs(be,{children:[s.jsx("span",{children:(l=i==null?void 0:i.titleCard)==null?void 0:l.subtitle}),s.jsx(Ce,{name:"inapp-button",children:"Play Now"})]})]}),s.jsx(_e,{close:u=>{u==null||u.stopPropagation(),o==null||o()}})]})},ke=e.styled_default("div")({name:"Container",class:"cef8huz",propsAsIs:!1}),qe=()=>e.B1,Se=e.styled_default(qe())({name:"CheckIcon",class:"c1mo15kk",propsAsIs:!0}),Ee=()=>e.B1,Le=e.styled_default(Ee())({name:"PredictionIcon",class:"p16zkqnm",propsAsIs:!0}),Me=e.styled_default("div")({name:"PredictionIconContainer",class:"pjszi7a",propsAsIs:!1}),De=e.styled_default("div")({name:"BodyContainer",class:"bftbmo3",propsAsIs:!1}),Be=e.styled_default("div")({name:"Body",class:"barrbyu",propsAsIs:!1}),Qe=e.styled_default("div")({name:"Subtitle",class:"sz7237i",propsAsIs:!1}),Re=({step:t,children:o,answer:i,state:n="pending"})=>{const[l,u]=y.useState(0),[c]=y.useState(()=>new ResizeObserver(p=>{window.requestAnimationFrame(()=>{var m,v;u(((v=(m=p==null?void 0:p[0])==null?void 0:m.contentRect)==null?void 0:v.width)??0)})})),a=y.useCallback(p=>{p?c.observe(p):c.disconnect()},[c]);return y.useEffect(()=>()=>{c.disconnect()},[c]),s.jsxs(ke,{children:[s.jsx(Me,{children:s.jsx(Le,{name:"icon-prediction"})}),s.jsx(De,{style:{minWidth:`${l}px`},children:s.jsx(Be,{children:o},t)}),s.jsx(Qe,{ref:a,className:n,children:s.jsxs("div",{children:[s.jsx(Se,{name:"icon-check"}),"Your Pick: ",i]})})]})},Oe=e.styled_default("div")({name:"Container",class:"ckyzolp",propsAsIs:!1}),b=e.styled_default("div")({name:"Line",class:"l16t1zr7",propsAsIs:!1}),Ue=()=>b,Pe=e.styled_default(Ue())({name:"Line1",class:"le78kvg",propsAsIs:!0}),ze=()=>b,Ve=e.styled_default(ze())({name:"Line2",class:"l1o7966d",propsAsIs:!0}),Fe=()=>b,We=e.styled_default(Fe())({name:"Line3",class:"lu9lyxq",propsAsIs:!0}),Ye=()=>s.jsxs(Oe,{children:[s.jsx(Pe,{children:s.jsx("div",{})}),s.jsx(Ve,{children:s.jsx("div",{})}),s.jsx(We,{children:s.jsx("div",{})})]}),Ke=e.styled_default("div")({name:"Container",class:"c10jy6zf",propsAsIs:!1}),Ge=()=>e.B1,He=e.styled_default(Ge())({name:"CheckIcon",class:"c1c7scay",propsAsIs:!0}),Je=()=>s.jsxs(Ke,{children:[s.jsx(He,{name:"icon-check"})," Prediction results are in!"]}),Xe=e.styled_default("div")({name:"Container",class:"cf6k2yy",propsAsIs:!1}),Ze=e.styled_default("div")({name:"Caption",class:"c1c8xjus",propsAsIs:!1}),st=e.styled_default("div")({name:"Title",class:"t1d1uekn",propsAsIs:!1}),et=({title:t})=>s.jsxs(Xe,{children:[s.jsx(Ze,{children:"Results for"}),s.jsx(st,{children:t})]}),V=e.styled_default("div")({name:"Container",class:"c181a1as",propsAsIs:!1}),F=e.styled_default("div")({name:"Title",class:"t1cduox6",propsAsIs:!1}),tt=()=>e.B1,W=e.styled_default(tt())({name:"CorrectIcon",class:"c1onrv6j",propsAsIs:!0}),nt=()=>W,ot=e.styled_default(nt())({name:"InCorrectIcon",class:"i17n9o7e",propsAsIs:!0}),it=()=>s.jsxs(V,{children:[s.jsxs(F,{children:["Congratulations!",s.jsx("br",{}),"You answered correctly."]}),s.jsx(W,{name:"icon-check"})]}),lt=({title:t})=>s.jsxs(V,{children:[s.jsxs(F,{children:["Better luck next time!",s.jsx("br",{}),"Correct: ",t]}),s.jsx(ot,{name:"icon-cross"})]}),at=e.styled_default("div")({name:"Container",class:"cnxgcs2",propsAsIs:!1}),dt=e.styled_default("div")({name:"Title",class:"t903f8n",propsAsIs:!1}),rt=()=>e.B1,ct=e.styled_default(rt())({name:"CheckIcon",class:"ceyu3qj",propsAsIs:!0}),ut=({points:t})=>s.jsxs(at,{children:[s.jsxs(dt,{children:["You won ",s.jsx(e.d,{delay:.5,prefix:"+",suffix:" points",value:t})]}),s.jsx(ct,{name:"icon-trophy-solid"})]}),E=e.styled_default("div")({name:"Container",class:"cq3agu2",propsAsIs:!1}),L=e.styled_default("div")({name:"Body",class:"b16qj0do",propsAsIs:!1}),M={1:3e3,2:4e3,3:4e3,4:4e3},pt=({close:t,action:o,setStep:i,votedAnswer:n,correct:l,correctAnswerTitle:u,questionTitle:c,step:a})=>{if(y.useEffect(()=>{if(i){const m=setTimeout(()=>{M[a+1]&&(l||a<3)?i(a+1):t==null||t()},M[a]);return()=>{m&&clearTimeout(m)}}return()=>{}},[i,a,t,l]),a===1)return s.jsx(E,{children:s.jsx(L,{children:s.jsx(Je,{})})});let p="pending";return(a===3||a===4)&&(p=l?"correct":"incorrect"),s.jsx(E,{"data-a":"intr",onClick:()=>o==null?void 0:o(),children:s.jsxs(L,{children:[a!==1&&s.jsx(Ye,{},a),s.jsxs(Re,{state:p,step:a,answer:(n==null?void 0:n.title)||"unknown",children:[a===2&&s.jsx(et,{title:c||"unknown"}),a===3&&l&&s.jsx(it,{}),a===3&&!l&&s.jsx(lt,{title:u||"unknown"}),a===4&&s.jsx(ut,{points:(n==null?void 0:n.points)||0})]})]})})},mt=({close:t,action:o,votedAnswer:i,correct:n,correctAnswerTitle:l,questionTitle:u})=>{const[c,a]=y.useState(1);return s.jsx(pt,{close:t,action:o,votedAnswer:i,correct:n,correctAnswerTitle:l,questionTitle:u,setStep:a,step:c,title:""})},yt=e.styled_default("div")({name:"NotificationContainer",class:"n1i4h28u",propsAsIs:!1}),xt=t=>s.jsx(yt,{children:s.jsx(mt,{...t})}),vt=e.styled_default("div")({name:"Container",class:"cwa9tgs",propsAsIs:!1}),ft=e.styled_default("div")({name:"BodyContainer",class:"b1xx7swj",propsAsIs:!1}),jt=e.styled_default("div")({name:"Body",class:"b1a21en",propsAsIs:!1}),It=({step:t,children:o,state:i="pending"})=>{const[n,l]=y.useState(0);return y.useEffect(()=>{const u=new ResizeObserver(c=>{window.requestAnimationFrame(()=>{var a,p;const m=((p=(a=c==null?void 0:c[0])==null?void 0:a.contentRect)==null?void 0:p.width)??0;l(m)})});return()=>{u.disconnect()}},[]),s.jsx(vt,{style:{padding:`${t===3&&i==="incorrect"||t===1?"5px 100px":"5px 40px"}`},children:s.jsx(ft,{style:{minWidth:`${n}px`},children:s.jsx(jt,{children:o},t)})})},At=e.styled_default("div")({name:"Container",class:"c1nd5cu8",propsAsIs:!1}),C=e.styled_default("div")({name:"Line",class:"lgbipw0",propsAsIs:!1}),ht=()=>C,$t=e.styled_default(ht())({name:"Line1",class:"l1anth16",propsAsIs:!0}),gt=()=>C,_t=e.styled_default(gt())({name:"Line2",class:"l193yd7v",propsAsIs:!0}),wt=()=>C,Tt=e.styled_default(wt())({name:"Line3",class:"lhbflsp",propsAsIs:!0}),bt=()=>s.jsxs(At,{children:[s.jsx($t,{children:s.jsx("div",{})}),s.jsx(_t,{children:s.jsx("div",{})}),s.jsx(Tt,{children:s.jsx("div",{})})]}),Ct=e.styled_default("div")({name:"Container",class:"c1lvd429",propsAsIs:!1}),Nt=()=>e.B1,kt=e.styled_default(Nt())({name:"PredictionIcon",class:"p1n4m87t",propsAsIs:!0}),qt=()=>s.jsxs(Ct,{children:[s.jsx(kt,{name:"icon-prediction"})," Prediction results are in!"]}),St=()=>e.B1,Et=e.styled_default(St())({name:"CheckIcon",class:"c126r8f9",propsAsIs:!0}),Lt=e.styled_default("div")({name:"Answer",class:"a1o2rpgl",propsAsIs:!1}),Mt=e.styled_default("div")({name:"Container",class:"cej6ci1",propsAsIs:!1}),Dt=e.styled_default("div")({name:"Title",class:"tob24mr",propsAsIs:!1}),Bt=({title:t,answer:o})=>s.jsxs(Mt,{children:[s.jsx(Dt,{children:t}),s.jsxs(Lt,{children:[s.jsx(Et,{name:"icon-prediction"}),"Your Pick: ",o]})]}),Y=e.styled_default("div")({name:"Container",class:"c1lesal4",propsAsIs:!1}),K=e.styled_default("div")({name:"Title",class:"tv66n4w",propsAsIs:!1}),Qt=()=>e.B1,Rt=e.styled_default(Qt())({name:"CorrectIcon",class:"cx0vlv2",propsAsIs:!0}),G=e.styled_default("div")({name:"Answer",class:"akfh4v5",propsAsIs:!1}),Ot=({answer:t})=>s.jsxs(Y,{children:[s.jsx(K,{children:"Congratulations! You answered correctly."}),s.jsxs(G,{children:[s.jsx(Rt,{name:"icon-correct"}),"Your Pick: ",t]})]}),Ut=({title:t,answer:o})=>s.jsxs(Y,{children:[s.jsxs(K,{children:["Better luck next time!",s.jsx("br",{}),"Correct: ",t]}),s.jsxs(G,{children:["Your Pick: ",o]})]}),D=e.styled_default("div")({name:"Container",class:"cmox3ot",propsAsIs:!1}),B=e.styled_default("div")({name:"Body",class:"bqq1ix4",propsAsIs:!1}),Q={1:3e3,2:4e3,3:4e3},Pt=({close:t,action:o,setStep:i,votedAnswer:n,correct:l,correctAnswerTitle:u,questionTitle:c,step:a})=>{if(y.useEffect(()=>{if(i){const m=setTimeout(()=>{Q[a+1]&&(l||a<3)?i(a+1):t==null||t()},Q[a]);return()=>{m&&clearTimeout(m)}}return()=>{}},[i,a,t,l]),a===1)return s.jsx(D,{children:s.jsx(B,{children:s.jsx(qt,{})})});let p="pending";return a===3&&(p=l?"correct":"incorrect"),s.jsx(D,{"data-a":"intr",onClick:()=>o==null?void 0:o(),children:s.jsxs(B,{children:[a!==1&&s.jsx(bt,{},a),s.jsxs(It,{state:p,step:a,children:[a===2&&s.jsx(Bt,{title:c||"unknown",answer:(n==null?void 0:n.title)||"unknown"}),a===3&&l&&s.jsx(Ot,{answer:(n==null?void 0:n.title)||"unknown"}),a===3&&!l&&s.jsx(Ut,{title:u||"unknown",answer:(n==null?void 0:n.title)||"unknown"})]})]})})},zt=({close:t,action:o,votedAnswer:i,correct:n,correctAnswerTitle:l,questionTitle:u})=>{const[c,a]=y.useState(1);return s.jsx(Pt,{close:t,action:o,votedAnswer:i,correct:n,correctAnswerTitle:l,questionTitle:u,setStep:a,step:c,title:""})},H=e.styled_default("div")({name:"NotificationContainer",class:"nn0nqh6",propsAsIs:!1}),Vt=()=>({withoutPadding:t})=>t?"0px":"1rem",Ft=e.styled_default("div")({name:"NotificationContent",class:"n1bcdf3j",propsAsIs:!1,vars:{"n1bcdf3j-0":[Vt()]}}),J=e.styled_default("img")({name:"LogoImg",class:"l8jorbq",propsAsIs:!1}),Wt=()=>H,Yt=e.styled_default(Wt())({name:"NotificationInterstitialContainer",class:"nf920y3",propsAsIs:!0}),Kt=e.styled_default("div")({name:"LogoImgContainer",class:"lzsmehn",propsAsIs:!1}),Gt=({sponsorLogo:t,onClick:o})=>s.jsx(Yt,{onClick:o,children:s.jsx(Ft,{withoutPadding:!0,children:s.jsx(J,{src:t})})}),Ht=t=>{var o,i,n,l,u;const[c,a]=y.useState(!1),p=y.useRef();return y.useEffect(()=>{var m;return(m=t==null?void 0:t.inApp)!=null&&m.sponsorLogo&&(a(!0),p.current=setTimeout(()=>{a(!1)},5e3)),()=>clearTimeout(p.current)},[(o=t==null?void 0:t.inApp)==null?void 0:o.sponsorLogo]),(i=t==null?void 0:t.inApp)!=null&&i.sponsorLogo&&c?s.jsx(Gt,{sponsorLogo:(n=t.inApp)==null?void 0:n.sponsorLogo,onClick:()=>a(!1)}):s.jsx(H,{children:s.jsxs("div",{children:[((l=t==null?void 0:t.inApp)==null?void 0:l.sponsorLogo)&&s.jsx(Kt,{children:s.jsx(J,{src:(u=t==null?void 0:t.inApp)==null?void 0:u.sponsorLogo})}),s.jsx(zt,{...t})]})})},X=({sdk:t,webos:o})=>{var i,n,l,u,c,a,p,m;const[v]=y.useState(t.getNotificationsStore()),x=e.useStore(v),f=t.getFeature(r.SdkOverlayType.GAMES),d=y.useMemo(()=>t.getActiveNotification(),[t,x]);return y.useEffect(()=>{d&&e.eventBus.emit("notification",{action:"rendered",payload:{questionId:d.data.questionId,questionType:d.data.questionType}})},[d]),d&&d.type===e.NotificationType.QUESTION_RESOLVED?d.data.question&&d.data.questionType===r.QuestionType.PREDICTION?d&&((i=d.data.inApp)==null?void 0:i.adUnit)===r.AdUnit.STANDART?s.jsx(Ht,{action:d.action,close:d.close,...d.data.question,inApp:d.data.inApp}):s.jsx(xt,{action:d.action,close:d.close,...d.data.question}):null:d&&d.type===e.NotificationType.ONBOARDING?d.data.onboarding?s.jsx(Ne,{open:f==null?void 0:f.openOnboarding,close:d.close,...d.data.onboarding}):null:d&&((n=d.data.inApp)==null?void 0:n.adUnit)===r.AdUnit.STANDART?s.jsx(je,{...d.data,action:d.action,close:d.close,color:((c=(u=(l=d==null?void 0:d.data)==null?void 0:l.inApp)==null?void 0:u.notification)==null?void 0:c.indicatorColor)||((m=(p=(a=d==null?void 0:d.data)==null?void 0:a.inApp)==null?void 0:p.appearance)==null?void 0:m.primaryColor),webos:o}):d&&s.jsx(Cs,{...d.data,action:d.action})},Jt=({theme:t})=>{const o=e.useStreamLayer(),i=e.useStreamLayerTheme(),n=e.useStreamLayerUI();return o&&(n.appNotification||n.onboardingNotification)?n.app&&!n.onboardingNotification?null:s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(e.h,{customTheme:t??i.theme,themeMode:i.themeMode,children:s.jsx(X,{sdk:o})})}):null};exports.StreamLayerSDKNotification=Jt;exports.StreamLayerSDKNotificationUI=X;
|
package/lib/cjs/pause-ad.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),e=require("./provider.js");require("nanostores");const i=require("react");require("lodash.throttle");require("react-dom");require("react-countup");const R=require("./vast-client.min-B0NUra1B.js"),_={},B=new R.ce,k=e.i(_),j=e.createLogger("ui:gam-static"),C=s=>new Promise((t,n)=>{const l=new Image;l.onload=()=>t(s),l.onerror=()=>n(),l.src=s}),L=()=>{const s=i.useRef(0);return[i.useCallback(async t=>{var n,l,r,p,c,u,y,d,h,x,A;if((n=k.get()[t])!=null&&n.imageSrc)return{success:!0};const f=Date.now();s.current=f,k.setKey(t,{id:"",url:t});try{e.eventBus.emit("exposedPauseAd",{action:"load",payload:{}});const m=await B.get(t);if(j.debug(m,"parsedVAST"),s.current===f&&k.get()[t].url){const o=m.ads.find(v=>v.creatives.length>0);if(o){j.debug(o,"validAd");const v=o.creatives.find(g=>g.type==="nonlinear");if(v){j.debug(v,"nonlinear");const g=(r=(l=v.variations)==null?void 0:l[0])==null?void 0:r.staticResource,E=(c=(p=v.variations)==null?void 0:p[0])==null?void 0:c.nonlinearClickThroughURLTemplate;if(g)return await C(g),k.setKey(t,{id:o.id||"",url:t,imageSrc:g,adUrl:E}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}const P=o.creatives.find(g=>g.type==="companion");j.debug(P,"companion");const b=(h=(d=(y=(u=P==null?void 0:P.variations)==null?void 0:u[0])==null?void 0:y.staticResources)==null?void 0:d[0])==null?void 0:h.url,S=(A=(x=P==null?void 0:P.variations)==null?void 0:x[0])==null?void 0:A.companionClickThroughURLTemplate;if(b)return await C(b),k.setKey(t,{id:o.id||"",url:t,imageSrc:b,adUrl:S}),e.eventBus.emit("exposedPauseAd",{action:"loaded",payload:{id:o.id||""}}),{success:!0}}}}catch(m){console.error("Error parsing VAST",m)}return{success:!1}},[]),k]},D=e.styled_default("div")({name:"PauseAdOverlay",class:"pw9gih8",propsAsIs:!1}),I=e.styled_default("div")({name:"PauseAdContent",class:"p8lpomy",propsAsIs:!1}),U=e.styled_default("div")({name:"PauseAdTopLeft",class:"pv7u167",propsAsIs:!1}),q=e.styled_default("h2")({name:"PauseAdTitle",class:"p1kh2yb0",propsAsIs:!1}),M=e.styled_default("p")({name:"PauseAdCaption",class:"pl8f94x",propsAsIs:!1}),V=e.styled_default("div")({name:"PauseAdBottomLeft",class:"p1m6zmrt",propsAsIs:!1}),K=e.styled_default("button")({name:"PauseAdPlayButton",class:"pm3vwfa",propsAsIs:!1}),N=e.styled_default("div")({name:"PauseAdSidebarGradient",class:"p1tibuhw",propsAsIs:!1}),F=e.styled_default("div")({name:"PauseAdSidebar",class:"ptqqrqd",propsAsIs:!1}),$=e.styled_default("span")({name:"PauseAdTitleDescription",class:"p14estxv",propsAsIs:!1}),w=e.styled_default("img")({name:"ExternalAdContainer",class:"e1dpvfl1",propsAsIs:!1}),O=({vastUrl:s,isDesktop:t})=>{var n;const[,l]=L(),r=e.useStore(l,{keys:[s]});return i.useEffect(()=>{r&&r[s]&&r[s].imageSrc&&r[s].id&&e.eventBus.emit("exposedPauseAd",{action:"rendered",payload:{id:r[s].id}})},[r,s]),(n=r==null?void 0:r[s])!=null&&n.imageSrc?!r[s].adUrl||!t?a.jsx(w,{src:r[s].imageSrc}):a.jsx("a",{onClick:()=>{e.eventBus.emit("exposedPauseAd",{action:"navigated",payload:{id:r[s].id}})},href:r[s].adUrl,target:"_blank",rel:"noopener noreferrer",children:a.jsx(w,{src:r[s].imageSrc})}):null},z=({isClosing:s,title:t,caption:n,onPlay:l,onClose:r,vastUrl:p,options:c,isDesktop:u})=>{const y=(c==null?void 0:c.showPauseButton)??!0,{ref:d,focusSelf:h}=e.distExports.useFocusable({focusKey:"sl-pause-ad-play",onEnterRelease:l,isFocusBoundary:!0,forceFocus:!0});return i.useEffect(()=>{d.current&&h()},[d,h]),i.useEffect(()=>{if(!r)return()=>{};const x=A=>{const f=A.keyCode;if(f===461||f===10009||f===27||f===8){A.preventDefault(),A.stopPropagation(),A.stopImmediatePropagation(),r();return}};return window.addEventListener("keydown",x,{capture:!0}),()=>window.removeEventListener("keydown",x,{capture:!0})},[r]),a.jsx(D,{className:e.cx_default("SL_PauseAdOverlay",s&&"pause-ad-closing"),children:a.jsxs(I,{children:[a.jsxs(U,{children:[a.jsx(q,{children:t}),a.jsx(M,{children:n})]}),y&&a.jsx(V,{children:a.jsx(K,{ref:d,onClick:l,onMouseEnter:()=>d.current.focus(),"aria-label":"Resume playback"})}),a.jsx(N,{className:"SL_PauseAdSidebar",children:a.jsxs(F,{children:[p&&a.jsx(O,{isDesktop:u,vastUrl:p}),a.jsx($,{children:"ADVERTISEMENT"})]})})]})})},G=({showPauseAd:s,vastUrls:t,title:n,caption:l,sdk:r,onClose:p,onRender:c,options:u,isDesktop:y})=>{const d=(u==null?void 0:u.pauseAdDelay)??5e3,[h,x]=i.useState(!1),[A,f]=i.useState(!1),m=i.useRef(),o=t==null?void 0:t[0].url,v=i.useRef(o);v.current=o;const[P,b]=L(),S=i.useCallback(()=>{p&&(e.eventBus.emit("exposedPauseAd",{action:"closed",payload:{}}),p())},[p]),g=i.useCallback(()=>{r.controlVideoPlayer({play:!0})},[r]);return i.useEffect(()=>{if(s&&o){e.eventBus.emit("exposedPauseAd",{action:"enabled",payload:{}}),P(o).then(T=>{v.current===o&&(T==null?void 0:T.success)!==!0&&(clearTimeout(m.current),S==null||S())}).catch(()=>{v.current===o&&(clearTimeout(m.current),S==null||S())});const E=()=>{const T=b.get()[v.current];T!=null&&T.imageSrc?(clearTimeout(m.current),f(!1),x(!0)):m.current=setTimeout(()=>{E()},200)};m.current=setTimeout(()=>{E()},d)}else e.eventBus.emit("exposedPauseAd",{action:"disabled",payload:{}}),f(!0),m.current=setTimeout(()=>{x(!1)},400);return()=>{m.current&&clearTimeout(m.current)}},[b,P,S,d,s,o]),i.useEffect(()=>{c==null||c({rendered:h})},[h,c]),i.useEffect(()=>()=>{c==null||c({rendered:!1})},[c]),h?a.jsx(z,{onClose:S,isClosing:A,title:n,caption:l,onPlay:g,vastUrl:o,options:u,isDesktop:y}):null},J=({showPauseAd:s,pauseAdVastUrl:t,videoPlayerController:n,onRenderPauseAd:l,onClosePauseAd:r,children:p,options:c})=>{const u=e.useStreamLayer(),y=e.useStreamLayerTheme(),d=i.useRef();return i.useEffect(()=>u?(n&&(d.current=n,u.addVideoPlayerController(d.current)),()=>{d.current&&u.removeVideoPlayerController(d.current)}):()=>{},[u,n]),u?a.jsx("div",{className:"StreamLayerSDK",children:a.jsxs(e.h,{style:p?{position:"relative"}:{},customTheme:y.theme,themeMode:y.themeMode,children:[p,t&&a.jsx(G,{sdk:u,showPauseAd:s,vastUrls:t,onClose:r,onRender:l,options:c,isDesktop:!0})]})}):p};class Q extends i.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){console.error(t,n.componentStack)}render(){return this.state.hasError?this.props.children:a.jsx(J,{...this.props})}}exports.StreamLayerPauseAd=Q;
|
package/lib/cjs/points.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("react");require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("react");require("nanostores");const e=require("./provider.js");require("lodash.throttle");require("react-dom");require("react-countup");const c=require("./useStreamLayerApp2.js"),d=e.styled_default("div")({name:"PointsContainer",class:"psiob9b",propsAsIs:!1}),p=e.styled_default("div")({name:"PointsIcon",class:"p1gqe4lh",propsAsIs:!1}),m=()=>e.B1,y=e.styled_default(m())({name:"PointsSvg",class:"p15syg2y",propsAsIs:!0}),S=e.styled_default("div")({name:"PointsBody",class:"p12n4f2h",propsAsIs:!1}),v=e.styled_default("div")({name:"PointsTitle",class:"poqmx89",propsAsIs:!1}),h=e.styled_default("div")({name:"PointsValue",class:"prj9b3v",propsAsIs:!1}),f=({points:t,onClick:r})=>s.jsxs(d,{className:e.m,onClick:r,children:[s.jsx(p,{children:s.jsx(y,{name:"icon-trophy-solid"})}),s.jsxs(S,{children:[s.jsx(v,{children:"Total points"}),s.jsx(h,{children:s.jsx(e.d,{value:t})})]})]}),j=({gamification:t})=>{const r=t.userSummary.$store,[a,l]=u.useState(0);return u.useEffect(()=>{const n=r.subscribe(i=>{var o;(o=i==null?void 0:i.summary)!=null&&o.points&&l(i.summary.points)});return()=>{n()}},[r]),s.jsx(f,{points:a,onClick:()=>{const n=t.status.get();n===e.FeatureStatus.Suspended?(t.openFeature(),e.eventBus.emit("app",{action:"open",payload:{}}),e.eventBus.emit("interactions",{action:"tap",payload:{}})):n===e.FeatureStatus.Ready&&(t.closeFeature(!1),e.eventBus.emit("app",{action:"close",payload:{}}),e.eventBus.emit("interactions",{action:"tap",payload:{}}))}})},x=({sdk:t})=>{if(!e.useStore(t.featuresList.getStore()))return null;const r=t.getFeature(c.SdkOverlayType.GAMES);return r?s.jsx(j,{gamification:r}):null},g=({theme:t})=>{const r=e.useStreamLayer(),a=e.useStreamLayerTheme();return r?s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(e.h,{customTheme:t??a.theme,themeMode:a.themeMode,children:s.jsx(x,{sdk:r})})}):null};exports.StreamLayerSDKPoints=g;
|