@streamlayer/react 1.17.1 → 1.18.0

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.
Files changed (54) hide show
  1. package/lib/app/advertisement.d.ts +1 -0
  2. package/lib/app/app.d.ts +3 -0
  3. package/lib/app/provider.d.ts +4 -1
  4. package/lib/app/useStreamLayerApp.d.ts +2 -1
  5. package/lib/cjs/advertisement.js +36 -36
  6. package/lib/cjs/gamification-feature.js +1 -1
  7. package/lib/cjs/index2.js +2 -2
  8. package/lib/cjs/insight.js +1 -1
  9. package/lib/cjs/masters2.js +3 -3
  10. package/lib/cjs/notification.js +1 -1
  11. package/lib/cjs/points.js +1 -1
  12. package/lib/cjs/provider.js +62 -19
  13. package/lib/cjs/useStreamLayerApp2.js +15 -15
  14. package/lib/classic/app/advertisement.d.ts +1 -0
  15. package/lib/classic/app/app.d.ts +3 -0
  16. package/lib/classic/app/provider.d.ts +4 -1
  17. package/lib/classic/app/useStreamLayerApp.d.ts +2 -1
  18. package/lib/classic/cjs/advertisement.js +36 -36
  19. package/lib/classic/cjs/bet-pack.js +2 -2
  20. package/lib/classic/cjs/gamification-feature.js +1 -1
  21. package/lib/classic/cjs/insight.js +1 -1
  22. package/lib/classic/cjs/notification.js +1 -1
  23. package/lib/classic/cjs/points.js +1 -1
  24. package/lib/classic/cjs/provider.js +57 -14
  25. package/lib/classic/cjs/useStreamLayerApp2.js +15 -15
  26. package/lib/classic/es/advertisement.js +6778 -6620
  27. package/lib/classic/es/bet-pack.js +245 -245
  28. package/lib/classic/es/gamification-feature.js +1 -1
  29. package/lib/classic/es/index.js +3 -3
  30. package/lib/classic/es/insight.js +41 -38
  31. package/lib/classic/es/notification.js +739 -230
  32. package/lib/classic/es/points.js +10 -10
  33. package/lib/classic/es/provider.js +7285 -4829
  34. package/lib/classic/es/useStreamLayerApp.js +1 -1
  35. package/lib/classic/es/useStreamLayerApp2.js +4007 -3787
  36. package/lib/dist/cjs/gamification-feature2.js +1 -1
  37. package/lib/dist/cjs/masters.js +47 -43
  38. package/lib/dist/es/gamification-feature2.js +15 -15
  39. package/lib/dist/es/index.js +3 -3
  40. package/lib/dist/es/masters.js +14631 -12156
  41. package/lib/dist/style.css +1 -1
  42. package/lib/es/advertisement.js +6778 -6620
  43. package/lib/es/gamification-feature.js +1 -1
  44. package/lib/es/index.js +1 -1
  45. package/lib/es/index2.js +362 -362
  46. package/lib/es/insight.js +41 -38
  47. package/lib/es/masters2.js +28 -26
  48. package/lib/es/notification.js +739 -230
  49. package/lib/es/points.js +10 -10
  50. package/lib/es/provider.js +7162 -4706
  51. package/lib/es/useStreamLayerApp.js +1 -1
  52. package/lib/es/useStreamLayerApp2.js +4007 -3787
  53. package/lib/style.css +1 -1
  54. package/package.json +14 -14
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js"),s=require("react/jsx-runtime"),p=require("react"),c=require("./useStreamLayerApp2.js"),x=e.styled_default("div")({name:"Media",class:"m1bcvojl",propsAsIs:!1}),S=()=>x,q=e.styled_default(S())({name:"MediaImgBottom",class:"m58gin0",propsAsIs:!0}),E=()=>x,h=e.styled_default(E())({name:"MediaImgSolid",class:"m1atm8do",propsAsIs:!0}),M=()=>x,Q=e.styled_default(M())({name:"MediaImgRounded",class:"myx3xoi",propsAsIs:!0}),L=()=>x,D=e.styled_default(L())({name:"MediaImgCentered",class:"m1bwv0gx",propsAsIs:!0}),R=()=>x,z=e.styled_default(R())({name:"MediaImgInsight",class:"mntjanp",propsAsIs:!0}),O=e.styled_default("div")({name:"VideoIcon",class:"v1kofb47",propsAsIs:!1}),B={[c.QuestionImages.UNSET]:h,[c.QuestionImages.NONE]:h,[c.QuestionImages.ROUNDED]:Q,[c.QuestionImages.CENTERED]:D,[c.QuestionImages.TRANSPARENT]:q},A=({src:n,imageMode:a=c.QuestionImages.UNSET,withVideo:i,fromInsight:o})=>{if(a===c.QuestionImages.NONE)return null;const t=o?z:B[a];return s.jsxs(t,{children:[s.jsx("img",{src:n,alt:""}),i&&s.jsx(O,{children:s.jsx(e.k1,{name:"icon-play"})})]})},P=e.styled_default("div")({name:"NotificationContent",class:"nuraq9m",propsAsIs:!1}),U=e.styled_default("div")({name:"NotificationContainer",class:"ns1nzpg",propsAsIs:!1}),k=e.styled_default("div")({name:"Body",class:"b1j59nzs",propsAsIs:!1}),V=e.styled_default("div")({name:"Title",class:"t9vmnpp",propsAsIs:!1}),F=e.styled_default("button")({name:"Button",class:"b14ivj5k",propsAsIs:!1}),W=()=>e.k1,K=e.styled_default(W())({name:"StyledChevronRight",class:"s1atci8n",propsAsIs:!0}),G=e.styled_default("div")({name:"QuoteWrap",class:"q4w8jgs",propsAsIs:!1}),Y=e.styled_default("blockquote")({name:"Quote",class:"qaa0kez",propsAsIs:!1}),H=e.styled_default("div")({name:"Body",class:"b1wvd52w",propsAsIs:!1}),J=e.styled_default("div")({name:"Container",class:"ccvukea",propsAsIs:!1}),X=({image:n,tweet:a,account:i,accountVerified:o,body:t,title:r})=>{var d;return s.jsxs(J,{children:[r&&s.jsx(G,{children:s.jsx(Y,{children:r})}),s.jsx(e.D,{image:n,name:(d=a==null?void 0:a.meta)==null?void 0:d.accountName,userName:i,verified:o,createdTweet:a==null?void 0:a.date}),s.jsx(H,{children:e.A(t)})]})},Z=({title:n,questionType:a,questionTypeData:i})=>s.jsxs(k,{children:[s.jsx(e.x,{questionTypeData:i,questionType:a,questionStatus:c.QuestionStatus.UNSET}),n&&s.jsx(V,{children:n})]}),ss=({tweet:n})=>n?s.jsx(k,{children:s.jsx(X,{...n,controlVideo:()=>{}})}):null,es=({action:n,questionType:a,inApp:i,insight:o,tweet:t})=>{var r;const d=e.e[a],l=e.o[a];if(!d||!i||!i.notification)return null;const{title:u,image:m,imageMode:y}=i.notification;let f=m;a===c.QuestionType.TWEET&&t!=null&&t.tweetMedia&&(f=t.tweetMedia.image),y===c.QuestionImages.NONE&&(f="");const j=i.useMediaFromContent&&(o==null?void 0:o.image),v=a===c.QuestionType.TWEET&&((r=t==null?void 0:t.tweetMedia)==null?void 0:r.video)||a===c.QuestionType.FACTOID&&(o==null?void 0:o.video);return s.jsx(U,{"data-a":"intr",className:"SL_InApp",onClick:n,children:s.jsxs(P,{style:f?{}:{paddingLeft:"1.5rem"},children:[f&&!j&&s.jsx(A,{src:f,imageMode:y,withVideo:!!v}),j&&s.jsx(A,{src:j,fromInsight:!0,withVideo:!!v}),a===c.QuestionType.TWEET?s.jsx(ss,{tweet:t}):s.jsx(Z,{questionTypeData:d,questionType:a,title:u}),s.jsx(F,{name:"inapp-button",children:l||"Open"}),s.jsx(K,{name:"chevronRight"})]})})},ts=e.styled_default("div")({name:"NotificationContainer",class:"n11jcrxe",propsAsIs:!1}),g=e.styled_default("img")({name:"Icon",class:"i1vmpt6u",propsAsIs:!1}),ns=e.styled_default("div")({name:"IconContainer",class:"i180665s",propsAsIs:!1}),as=()=>e.k1,is=e.styled_default(as())({name:"TitleIcon",class:"t16zzzei",propsAsIs:!0}),os=()=>e.y,ls=e.styled_default(os())({name:"Close",class:"c1sur0q2",propsAsIs:!0}),ds=e.styled_default("div")({name:"Body",class:"bai9j52",propsAsIs:!1}),cs=e.styled_default("div")({name:"Title",class:"t1bnt25p",propsAsIs:!1}),rs=e.styled_default("div")({name:"Description",class:"dmixjec",propsAsIs:!1}),us=e.styled_default("button")({name:"Button",class:"b1ubkw1q",propsAsIs:!1}),ps=({open:n,close:a,...i})=>{var o,t;return s.jsxs(ts,{"data-a":"intr",onClick:()=>{n==null||n(),i&&(i.instantOpen=!0)},children:[s.jsxs(ns,{children:[s.jsx(g,{className:"on-light",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification.png"}),s.jsx(g,{className:"on-dark",src:"https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification-dark.png"})]}),s.jsxs(ds,{children:[s.jsxs(cs,{children:[s.jsx(is,{name:"icon-trophy-solid"}),(o=i==null?void 0:i.titleCard)==null?void 0:o.title]}),s.jsxs(rs,{children:[s.jsx("span",{children:(t=i==null?void 0:i.titleCard)==null?void 0:t.subtitle}),s.jsx(us,{name:"inapp-button",children:"Play Now"})]})]}),s.jsx(ls,{close:r=>{r==null||r.stopPropagation(),a==null||a()}})]})},ms=e.styled_default("div")({name:"Container",class:"cef8huz",propsAsIs:!1}),ys=()=>e.k1,fs=e.styled_default(ys())({name:"CheckIcon",class:"c1mo15kk",propsAsIs:!0}),xs=()=>e.k1,js=e.styled_default(xs())({name:"PredictionIcon",class:"p16zkqnm",propsAsIs:!0}),Is=e.styled_default("div")({name:"PredictionIconContainer",class:"pjszi7a",propsAsIs:!1}),vs=e.styled_default("div")({name:"BodyContainer",class:"bftbmo3",propsAsIs:!1}),hs=e.styled_default("div")({name:"Body",class:"barrbyu",propsAsIs:!1}),As=e.styled_default("div")({name:"Subtitle",class:"sz7237i",propsAsIs:!1}),gs=({step:n,children:a,answer:i,state:o="pending"})=>{const[t,r]=p.useState(0),[d]=p.useState(()=>new ResizeObserver(u=>{window.requestAnimationFrame(()=>{var m,y;r((y=(m=u==null?void 0:u[0])==null?void 0:m.contentRect)==null?void 0:y.width)})})),l=p.useCallback(u=>{u||d.disconnect(),d.observe(u)},[d]);return p.useMemo(()=>()=>{d.disconnect()},[d]),s.jsxs(ms,{children:[s.jsx(Is,{children:s.jsx(js,{name:"icon-prediction"})}),s.jsx(vs,{style:{minWidth:`${t}px`},children:s.jsx(hs,{children:a},n)}),s.jsx(As,{ref:l,className:o,children:s.jsxs("div",{children:[s.jsx(fs,{name:"icon-check"}),"Your Pick: ",i]})})]})},_s=e.styled_default("div")({name:"Container",class:"ckyzolp",propsAsIs:!1}),I=e.styled_default("div")({name:"Line",class:"l16t1zr7",propsAsIs:!1}),Ts=()=>I,$s=e.styled_default(Ts())({name:"Line1",class:"le78kvg",propsAsIs:!0}),ks=()=>I,Ns=e.styled_default(ks())({name:"Line2",class:"l1o7966d",propsAsIs:!0}),bs=()=>I,Cs=e.styled_default(bs())({name:"Line3",class:"lu9lyxq",propsAsIs:!0}),ws=()=>s.jsxs(_s,{children:[s.jsx($s,{children:s.jsx("div",{})}),s.jsx(Ns,{children:s.jsx("div",{})}),s.jsx(Cs,{children:s.jsx("div",{})})]}),Ss=e.styled_default("div")({name:"Container",class:"c10jy6zf",propsAsIs:!1}),qs=()=>e.k1,Es=e.styled_default(qs())({name:"CheckIcon",class:"c1c7scay",propsAsIs:!0}),Ms=()=>s.jsxs(Ss,{children:[s.jsx(Es,{name:"icon-check"})," Prediction results are in!"]}),Qs=e.styled_default("div")({name:"Container",class:"cf6k2yy",propsAsIs:!1}),Ls=e.styled_default("div")({name:"Caption",class:"c1c8xjus",propsAsIs:!1}),Ds=e.styled_default("div")({name:"Title",class:"t1d1uekn",propsAsIs:!1}),Rs=({title:n})=>s.jsxs(Qs,{children:[s.jsx(Ls,{children:"Results for"}),s.jsx(Ds,{children:n})]}),N=e.styled_default("div")({name:"Container",class:"c181a1as",propsAsIs:!1}),b=e.styled_default("div")({name:"Title",class:"t1cduox6",propsAsIs:!1}),zs=()=>e.k1,C=e.styled_default(zs())({name:"CorrectIcon",class:"c1onrv6j",propsAsIs:!0}),Os=()=>C,Bs=e.styled_default(Os())({name:"InCorrectIcon",class:"i17n9o7e",propsAsIs:!0}),Ps=()=>s.jsxs(N,{children:[s.jsxs(b,{children:["Congratulations!",s.jsx("br",{}),"You answered correctly."]}),s.jsx(C,{name:"icon-check"})]}),Us=({title:n})=>s.jsxs(N,{children:[s.jsxs(b,{children:["Better luck next time!",s.jsx("br",{}),"Correct: ",n]}),s.jsx(Bs,{name:"icon-cross"})]}),Vs=e.styled_default("div")({name:"Container",class:"cnxgcs2",propsAsIs:!1}),Fs=e.styled_default("div")({name:"Title",class:"t903f8n",propsAsIs:!1}),Ws=()=>e.k1,Ks=e.styled_default(Ws())({name:"CheckIcon",class:"ceyu3qj",propsAsIs:!0}),Gs=({points:n})=>s.jsxs(Vs,{children:[s.jsxs(Fs,{children:["You won ",s.jsx(e.d,{delay:.5,prefix:"+",suffix:" points",value:n})]}),s.jsx(Ks,{name:"icon-trophy-solid"})]}),_=e.styled_default("div")({name:"Container",class:"cq3agu2",propsAsIs:!1}),T=e.styled_default("div")({name:"Body",class:"b16qj0do",propsAsIs:!1}),$={1:3e3,2:4e3,3:4e3,4:4e3},Ys=({close:n,action:a,setStep:i,votedAnswer:o,correct:t,correctAnswerTitle:r,questionTitle:d,step:l})=>{if(p.useEffect(()=>{if(i){const m=setTimeout(()=>{$[l+1]&&(t||l<3)?i(l+1):n==null||n()},$[l]);return()=>{m&&clearTimeout(m)}}return()=>{}},[i,l,n,t]),l===1)return s.jsx(_,{children:s.jsx(T,{children:s.jsx(Ms,{})})});let u="pending";return(l===3||l===4)&&(u=t?"correct":"incorrect"),s.jsx(_,{"data-a":"intr",onClick:()=>a==null?void 0:a(),children:s.jsxs(T,{children:[l!==1&&s.jsx(ws,{},l),s.jsxs(gs,{state:u,step:l,answer:(o==null?void 0:o.title)||"unknown",children:[l===2&&s.jsx(Rs,{title:d||"unknown"}),l===3&&t&&s.jsx(Ps,{}),l===3&&!t&&s.jsx(Us,{title:r||"unknown"}),l===4&&s.jsx(Gs,{points:(o==null?void 0:o.points)||0})]})]})})},Hs=({close:n,action:a,votedAnswer:i,correct:o,correctAnswerTitle:t,questionTitle:r})=>{const[d,l]=p.useState(1);return s.jsx(Ys,{close:n,action:a,votedAnswer:i,correct:o,correctAnswerTitle:t,questionTitle:r,setStep:l,step:d,title:""})},Js=e.styled_default("div")({name:"NotificationContainer",class:"n1i4h28u",propsAsIs:!1}),Xs=n=>s.jsx(Js,{children:s.jsx(Hs,{...n})}),w=({sdk:n})=>{const[a]=p.useState(n.getNotificationsStore()),i=e.useStore(a),o=n.getFeature(c.SdkOverlayType.GAMES),t=p.useMemo(()=>n.getActiveNotification(),[n,i]);return p.useEffect(()=>{t&&e.eventBus.emit("notification",{action:"rendered",payload:{questionId:t.data.questionId,questionType:t.data.questionType}})},[t]),t&&t.type===e.NotificationType.QUESTION_RESOLVED?t.data.question&&t.data.questionType===c.QuestionType.PREDICTION?s.jsx(Xs,{action:t.action,close:t.close,...t.data.question}):null:t&&t.type===e.NotificationType.ONBOARDING?t.data.onboarding?s.jsx(ps,{open:o==null?void 0:o.openFeature,close:t.close,...t.data.onboarding}):null:t&&s.jsx(es,{...t.data,action:t.action})},Zs=({theme:n})=>{const a=e.useStreamLayer(),i=e.useStreamLayerTheme(),o=e.useStreamLayerUI();return a&&(o.appNotification||o.onboardingNotification)?o.app&&!o.onboardingNotification?null:s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(e.h,{customTheme:n??i.theme,themeMode:i.themeMode,children:s.jsx(w,{sdk:a})})}):null};exports.StreamLayerSDKNotification=Zs;exports.StreamLayerSDKNotificationUI=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./provider.js"),s=require("react/jsx-runtime"),y=require("react"),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,_=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]:_,[r.QuestionImages.NONE]:_,[r.QuestionImages.ROUNDED]:ds,[r.QuestionImages.CENTERED]:cs,[r.QuestionImages.TRANSPARENT]:is,[r.QuestionImages.SOLID]:_},C=({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}),Q=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,{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$1(l)})]})},Ts=({title:t,questionType:o,questionTypeData:i})=>s.jsxs(Q,{children:[s.jsx(e.x,{questionTypeData:i,questionType:o,questionStatus:r.QuestionStatus.UNSET}),t&&s.jsx(fs,{children:t})]}),bs=({tweet:t})=>t?s.jsx(Q,{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(C,{src:x,imageMode:v,withVideo:!!d}),f&&s.jsx(C,{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,N=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,Ss=e.styled_default(ks())({name:"MediaImgBottom",class:"m22bh04",propsAsIs:!0}),qs=()=>j,Es=e.styled_default(qs())({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,w=e.styled_default(Ps())({name:"MediaNone",class:"mqfzyyr",propsAsIs:!0}),zs="v170mtgf",Vs={[r.QuestionImages.UNSET]:w,[r.QuestionImages.NONE]:w,[r.QuestionImages.ROUNDED]:Rs,[r.QuestionImages.CENTERED]:Us,[r.QuestionImages.TRANSPARENT]:Ss,[r.QuestionImages.SOLID]:Bs},k=({src:t,imageMode:o=r.QuestionImages.UNSET,withVideo:i,color:n,useContentMedia:l,thumbnailUrl:u})=>{if(!t)return s.jsx(N,{color:n,children:s.jsx(w,{})});const c=l===r.NotificationUseContentMedia.ENABLED?Ms:Vs[o];return s.jsx(N,{color:n,children:i?s.jsx(Es,{children:s.jsx(e.Pe,{className:zs,source:t,poster:u||""})}):s.jsx(c,{children:s.jsx("img",{src:t,alt:""})})})},Fs=()=>({withoutPadding:t})=>t?"0px":"1rem",R=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}),O=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}),U=e.styled_default("img")({name:"LogoImg",class:"ln4a3eh",propsAsIs:!1}),le=()=>O,ae=e.styled_default(le())({name:"NotificationInterstitialContainer",class:"no2k63v",propsAsIs:!0}),de=e.styled_default("div")({name:"TVButtons",class:"th9nn6a",propsAsIs:!1}),P=e.styled_default("button")({name:"TVButton",class:"t1eee77p",propsAsIs:!1}),re=()=>P,ce=e.styled_default(re())({name:"DismissButton",class:"ds000hw",propsAsIs:!0}),ue=()=>P,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,{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(R,{withoutPadding:!0,children:s.jsx(U,{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:X,image:Z,imageMode:A,useContentMedia:h}=n.notification,ss=i===r.QuestionType.FACTOID?l==null?void 0:l.heading:X,es=i===r.QuestionType.FACTOID?l==null?void 0:l.body:"",ts=Z,$=i===r.QuestionType.FACTOID&&((a=l==null?void 0:l.video)==null?void 0:a.url)&&(n==null?void 0:n.isVideo)&&h===r.NotificationUseContentMedia.ENABLED,g=h===r.NotificationUseContentMedia.ENABLED?$?(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(O,{"data-a":"intr",className:"SL_InApp",onClick:ns=>{c&&(t==null||t(ns))},"data-is-insight":i===r.QuestionType.FACTOID,"data-webos":c,children:[(n==null?void 0:n.sponsorLogo)&&s.jsx(ie,{children:s.jsx(U,{src:n==null?void 0:n.sponsorLogo})}),s.jsxs(R,{children:[s.jsxs(Ws,{children:[!g&&s.jsx(k,{src:ts,imageMode:A,withVideo:!!$,color:u}),g&&s.jsx(k,{src:g,imageMode:A,withVideo:!!$,color:u,useContentMedia:h,thumbnailUrl:(m=l==null?void 0:l.video)==null?void 0:m.thumbnailUrl}),s.jsx(me,{questionTypeData:d,questionType:i,title:ss,description:es,imageMode:A,webos:c})]}),!c&&s.jsx(Ks,{name:"chevronRight"}),c&&s.jsxs(de,{children:[s.jsx(xe,{webos:!0,"data-close-btn":"true",onClick:o,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}),Se=()=>e.B1,qe=e.styled_default(Se())({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(qe,{name:"icon-check"}),"Your Pick: ",i]})})]})},Oe=e.styled_default("div")({name:"Container",class:"ckyzolp",propsAsIs:!1}),T=e.styled_default("div")({name:"Line",class:"l16t1zr7",propsAsIs:!1}),Ue=()=>T,Pe=e.styled_default(Ue())({name:"Line1",class:"le78kvg",propsAsIs:!0}),ze=()=>T,Ve=e.styled_default(ze())({name:"Line2",class:"l1o7966d",propsAsIs:!0}),Fe=()=>T,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})]}),z=e.styled_default("div")({name:"Container",class:"c181a1as",propsAsIs:!1}),V=e.styled_default("div")({name:"Title",class:"t1cduox6",propsAsIs:!1}),tt=()=>e.B1,F=e.styled_default(tt())({name:"CorrectIcon",class:"c1onrv6j",propsAsIs:!0}),nt=()=>F,ot=e.styled_default(nt())({name:"InCorrectIcon",class:"i17n9o7e",propsAsIs:!0}),it=()=>s.jsxs(z,{children:[s.jsxs(V,{children:["Congratulations!",s.jsx("br",{}),"You answered correctly."]}),s.jsx(F,{name:"icon-check"})]}),lt=({title:t})=>s.jsxs(z,{children:[s.jsxs(V,{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"})]}),q=e.styled_default("div")({name:"Container",class:"cq3agu2",propsAsIs:!1}),E=e.styled_default("div")({name:"Body",class:"b16qj0do",propsAsIs:!1}),L={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(()=>{L[a+1]&&(l||a<3)?i(a+1):t==null||t()},L[a]);return()=>{m&&clearTimeout(m)}}return()=>{}},[i,a,t,l]),a===1)return s.jsx(q,{children:s.jsx(E,{children:s.jsx(Je,{})})});let p="pending";return(a===3||a===4)&&(p=l?"correct":"incorrect"),s.jsx(q,{"data-a":"intr",onClick:()=>o==null?void 0:o(),children:s.jsxs(E,{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}),b=e.styled_default("div")({name:"Line",class:"lgbipw0",propsAsIs:!1}),ht=()=>b,$t=e.styled_default(ht())({name:"Line1",class:"l1anth16",propsAsIs:!0}),gt=()=>b,_t=e.styled_default(gt())({name:"Line2",class:"l193yd7v",propsAsIs:!0}),wt=()=>b,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}),St=()=>s.jsxs(Ct,{children:[s.jsx(kt,{name:"icon-prediction"})," Prediction results are in!"]}),qt=()=>e.B1,Et=e.styled_default(qt())({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]})]}),W=e.styled_default("div")({name:"Container",class:"c1lesal4",propsAsIs:!1}),Y=e.styled_default("div")({name:"Title",class:"tv66n4w",propsAsIs:!1}),Qt=()=>e.B1,Rt=e.styled_default(Qt())({name:"CorrectIcon",class:"cx0vlv2",propsAsIs:!0}),K=e.styled_default("div")({name:"Answer",class:"akfh4v5",propsAsIs:!1}),Ot=({answer:t})=>s.jsxs(W,{children:[s.jsx(Y,{children:"Congratulations! You answered correctly."}),s.jsxs(K,{children:[s.jsx(Rt,{name:"icon-correct"}),"Your Pick: ",t]})]}),Ut=({title:t,answer:o})=>s.jsxs(W,{children:[s.jsxs(Y,{children:["Better luck next time!",s.jsx("br",{}),"Correct: ",t]}),s.jsxs(K,{children:["Your Pick: ",o]})]}),M=e.styled_default("div")({name:"Container",class:"cmox3ot",propsAsIs:!1}),D=e.styled_default("div")({name:"Body",class:"bqq1ix4",propsAsIs:!1}),B={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(()=>{B[a+1]&&(l||a<3)?i(a+1):t==null||t()},B[a]);return()=>{m&&clearTimeout(m)}}return()=>{}},[i,a,t,l]),a===1)return s.jsx(M,{children:s.jsx(D,{children:s.jsx(St,{})})});let p="pending";return a===3&&(p=l?"correct":"incorrect"),s.jsx(M,{"data-a":"intr",onClick:()=>o==null?void 0:o(),children:s.jsxs(D,{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:""})},G=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()]}}),H=e.styled_default("img")({name:"LogoImg",class:"l8jorbq",propsAsIs:!1}),Wt=()=>G,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(H,{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(G,{children:s.jsxs("div",{children:[((l=t==null?void 0:t.inApp)==null?void 0:l.sponsorLogo)&&s.jsx(Kt,{children:s.jsx(H,{src:(u=t==null?void 0:t.inApp)==null?void 0:u.sponsorLogo})}),s.jsx(zt,{...t})]})})},J=({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(J,{sdk:o})})}):null};exports.StreamLayerSDKNotification=Jt;exports.StreamLayerSDKNotificationUI=J;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("react"),e=require("./provider.js"),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.k1,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:a})=>s.jsxs(d,{className:e.m,onClick:a,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 a=t.userSummary.$store,[n,u]=l.useState(0);return l.useEffect(()=>{const r=a.subscribe(o=>{var i;(i=o==null?void 0:o.summary)!=null&&i.points&&u(o.summary.points)});return()=>{r()}},[a]),s.jsx(f,{points:n,onClick:()=>{const r=t.status.get();r===e.FeatureStatus.Suspended?(t.openFeature(),e.eventBus.emit("app",{action:"open",payload:{}}),e.eventBus.emit("interactions",{action:"tap",payload:{}})):r===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 a=t.getFeature(c.SdkOverlayType.GAMES);return a?s.jsx(j,{gamification:a}):null},g=({theme:t})=>{const a=e.useStreamLayer(),n=e.useStreamLayerTheme();return a?s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(e.h,{customTheme:t??n.theme,themeMode:n.themeMode,children:s.jsx(x,{sdk:a})})}):null};exports.StreamLayerSDKPoints=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("react"),e=require("./provider.js"),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:a})=>s.jsxs(d,{className:e.m,onClick:a,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 a=t.userSummary.$store,[n,u]=l.useState(0);return l.useEffect(()=>{const r=a.subscribe(o=>{var i;(i=o==null?void 0:o.summary)!=null&&i.points&&u(o.summary.points)});return()=>{r()}},[a]),s.jsx(f,{points:n,onClick:()=>{const r=t.status.get();r===e.FeatureStatus.Suspended?(t.openFeature(),e.eventBus.emit("app",{action:"open",payload:{}}),e.eventBus.emit("interactions",{action:"tap",payload:{}})):r===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 a=t.getFeature(c.SdkOverlayType.GAMES);return a?s.jsx(j,{gamification:a}):null},g=({theme:t})=>{const a=e.useStreamLayer(),n=e.useStreamLayerTheme();return a?s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(e.h,{customTheme:t??n.theme,themeMode:n.themeMode,children:s.jsx(x,{sdk:a})})}):null};exports.StreamLayerSDKPoints=g;