"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}),h=e.styled_default("div")({name:"PointsTitle",class:"poqmx89",propsAsIs:!1}),v=e.styled_default("div")({name:"PointsValue",class:"prj9b3v",propsAsIs:!1}),f=({points:t,onClick:a})=>s.jsxs(d,{className:e.h$1,onClick:a,children:[s.jsx(p,{children:s.jsx(y,{name:"icon-trophy-solid"})}),s.jsxs(S,{children:[s.jsx(h,{children:"Total points"}),s.jsx(v,{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;
