playsout-web-sdk 1.0.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 (53) hide show
  1. package/chunk-AJVRILLC.js +2 -0
  2. package/chunk-EZLO3WY6.js +2 -0
  3. package/chunk-MUMDBAO7.cjs +2 -0
  4. package/chunk-Z2CIDSTP.cjs +2 -0
  5. package/core/api.d.ts +19 -0
  6. package/core/api.d.ts.map +1 -0
  7. package/core/errors.d.ts +31 -0
  8. package/core/errors.d.ts.map +1 -0
  9. package/core/events.d.ts +30 -0
  10. package/core/events.d.ts.map +1 -0
  11. package/core/index.d.ts +38 -0
  12. package/core/index.d.ts.map +1 -0
  13. package/core/storage.d.ts +24 -0
  14. package/core/storage.d.ts.map +1 -0
  15. package/core/types.d.ts +127 -0
  16. package/core/types.d.ts.map +1 -0
  17. package/data/games.d.ts +30 -0
  18. package/data/games.d.ts.map +1 -0
  19. package/iife-entry.d.ts +3 -0
  20. package/iife-entry.d.ts.map +1 -0
  21. package/index.cjs +1 -0
  22. package/index.d.ts +9 -0
  23. package/index.d.ts.map +1 -0
  24. package/index.global.js +1471 -0
  25. package/index.iife.js +1471 -0
  26. package/index.js +1 -0
  27. package/package.json +63 -0
  28. package/public-api.d.ts +24 -0
  29. package/public-api.d.ts.map +1 -0
  30. package/react/context.d.ts +40 -0
  31. package/react/context.d.ts.map +1 -0
  32. package/react/index.cjs +1 -0
  33. package/react/index.d.ts +6 -0
  34. package/react/index.d.ts.map +1 -0
  35. package/react/index.js +1 -0
  36. package/vue/composable.d.ts +88 -0
  37. package/vue/composable.d.ts.map +1 -0
  38. package/vue/index.cjs +1 -0
  39. package/vue/index.d.ts +8 -0
  40. package/vue/index.d.ts.map +1 -0
  41. package/vue/index.js +1 -0
  42. package/vue/plugin.d.ts +14 -0
  43. package/vue/plugin.d.ts.map +1 -0
  44. package/web-components/PlaysoutWidget.d.ts +46 -0
  45. package/web-components/PlaysoutWidget.d.ts.map +1 -0
  46. package/web-components/assetUrl.d.ts +2 -0
  47. package/web-components/assetUrl.d.ts.map +1 -0
  48. package/web-components/imageCache.d.ts +13 -0
  49. package/web-components/imageCache.d.ts.map +1 -0
  50. package/web-components/index.cjs +1471 -0
  51. package/web-components/index.d.ts +3 -0
  52. package/web-components/index.d.ts.map +1 -0
  53. package/web-components/index.js +1471 -0
@@ -0,0 +1,2 @@
1
+ import {c as c$1,b as b$1}from'./chunk-EZLO3WY6.js';var N=(m=>(m.NOT_INITIALIZED="NOT_INITIALIZED",m.ALREADY_INITIALIZED="ALREADY_INITIALIZED",m.NOT_LOGGED_IN="NOT_LOGGED_IN",m.TOKEN_EXPIRED="TOKEN_EXPIRED",m.INVALID_TOKEN="INVALID_TOKEN",m.NETWORK_ERROR="NETWORK_ERROR",m.TIMEOUT="TIMEOUT",m.SERVER_ERROR="SERVER_ERROR",m.API_ERROR="API_ERROR",m.INVALID_PARAMS="INVALID_PARAMS",m.MISSING_PARAMS="MISSING_PARAMS",m.FEATURE_NOT_SUPPORTED="FEATURE_NOT_SUPPORTED",m.UNKNOWN="UNKNOWN",m.PAYMENT_FAILED="PAYMENT_FAILED",m.SHARE_FAILED="SHARE_FAILED",m))(N||{}),T=class extends Error{constructor(t,r,i){super(r);this.code=t;this.details=i;this.name="SDKError";}toJSON(){return {name:this.name,code:this.code,message:this.message,details:this.details}}},q={NOT_INITIALIZED:"SDK not initialized. Please call PlaysoutSDK.init() first.",ALREADY_INITIALIZED:"SDK already initialized. Please do not call init() more than once.",NOT_LOGGED_IN:"User not logged in. Please log in first.",TOKEN_EXPIRED:"Login token has expired. Please log in again.",INVALID_TOKEN:"Invalid login token. Please log in again.",NETWORK_ERROR:"Network connection failed. Please check your network.",TIMEOUT:"Request timed out. Please try again later.",SERVER_ERROR:"Server is busy. Please try again later.",API_ERROR:"API request failed.",INVALID_PARAMS:"Invalid parameter(s).",MISSING_PARAMS:"Missing required parameter(s).",FEATURE_NOT_SUPPORTED:"This feature is not supported in the current environment.",UNKNOWN:"An unknown error occurred.",PAYMENT_FAILED:"Payment failed.",SHARE_FAILED:"Share failed."};function l(o,e){return new T(o,q[o],e)}var P="playsout_",D=class{constructor(e){this.storage=e;}get(e){try{return this.storage.getItem(P+e)}catch{return null}}set(e,t){try{this.storage.setItem(P+e,t);}catch(r){console.warn("[PlaysoutSDK] Storage set failed:",r);}}remove(e){try{this.storage.removeItem(P+e);}catch{}}clear(){try{let e=[];for(let t=0;t<this.storage.length;t++){let r=this.storage.key(t);r&&r.startsWith(P)&&e.push(r);}e.forEach(t=>this.storage.removeItem(t));}catch{}}},_=class{constructor(){this.store=new Map;}get(e){return this.store.get(e)??null}set(e,t){this.store.set(e,t);}remove(e){this.store.delete(e);}clear(){this.store.clear();}};function v(o="localStorage"){return typeof window>"u"||o==="memory"?new _:o==="sessionStorage"?new D(sessionStorage):new D(localStorage)}var S=v(),g={get:o=>S.get(o),set:(o,e)=>{S.set(o,e);},remove:o=>{S.remove(o);},clear:()=>{S.clear();},getJSON:o=>{let e=S.get(o);if(!e)return null;try{return JSON.parse(e)}catch{return null}},setJSON:(o,e)=>{S.set(o,JSON.stringify(e));},configure(o){S=v(o);}},c={TOKEN_DATA:"token_data",USER:"user",LOCALE:"locale",CONFIG:"config"};var W=o=>{if(!o)return o;try{let e=new URL(o);if(e.hostname==="games.playsout.com"){let t=e.pathname,r=t.endsWith("/"),i=/\.[a-z0-9]+$/i.test(t);!r&&!i&&(e.pathname=`${t}/`);}return e.toString()}catch{return o}},J=o=>o.map(e=>{if(!e.externalUrl)return e;let t=W(e.externalUrl);return t===e.externalUrl?e:{...e,externalUrl:t}}),Z=[{id:"BlockCrushFun",title:"Block Crush Fun",category:"Puzzle",image:c$1("./games/BlockCrushFun.png"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/BlockCrushFun"},{id:"DogeSurvivors",title:"Doge Survivors",category:"Doge OS",image:c$1("./games/DogeSurvivors.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeSurvivors/"},{id:"DogeMaze",title:"Doge Maze",category:"Doge OS",image:c$1("./games/DogeMaze.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeMaze/"},{id:"DogeMart",title:"Doge Mart",category:"Doge OS",image:c$1("./games/DogeMart.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeMart/"},{id:"KittyEscape",title:"Kitty Escape",category:"Puzzle",image:c$1("./games/KittyEscape.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/KittyEscape/"},{id:"ProjectGarden",title:"Project: Garden",category:"Adventure",image:c$1("./games/SimulatedAdventures.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/simulated/"},{id:"ProjectIDLE",title:"Project: IDLE",category:"Simulation",image:c$1("./games/ProjectIDLE.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/idle/"},{id:"CulinaryStarWeb",title:"Culinary Star",category:"Casual",image:c$1("./games/CulinaryStar.webp"),description:"Cooking game",isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CulinaryStar/"},{id:"PickaxeQuest",title:"Pickaxe Quest",category:"Adventure",image:c$1("./games/PickaxeQuest.jpg"),description:"Mining and adventure game",isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/PickaxeQuest/",apiGameId:73},{id:"MonsterSurvivors",title:"Monster Survivors",category:"Adventure",image:c$1("./games/MonsterSurvivors.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/MonsterSurvivors/"},{id:"IdleTowerDefense",title:"Idle Tower Defense",category:"RPG",image:c$1("./games/IdleTowerDefense.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/IdleTowerDefense/"},{id:"MushroomWarriors",title:"Mushroom Warriors",category:"RPG",image:c$1("./games/MushroomWarriors.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/MushroomWarriors/"},{id:"FollowThePath",title:"Follow The Path",category:"Arcade",image:c$1("./games/FollowThePath.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/FollowThePath/"},{id:"ColorRun",title:"Color Run",category:"Arcade",image:c$1("./games/ColorRun.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ColorRun/"},{id:"StupidArrow",title:"Stupid Arrow",category:"Arcade",image:c$1("./games/StupidArrow.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/StupidArrow/"},{id:"ZigZag",title:"Zig Zag",category:"Arcade",image:c$1("./games/ZigZag.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ZigZag/"},{id:"SpikesEverywhere",title:"Spikes Everywhere",category:"Arcade",image:c$1("./games/SpikesEverywhere.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/SpikesEverywhere/"},{id:"ArrowRacer",title:"Arrow Racer",category:"Arcade",image:c$1("./games/ArrowRacer.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ArrowRacer/"},{id:"CircleLeap",title:"Circle Leap",category:"Arcade",image:c$1("./games/CircleLeap.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CircleLeap/"},{id:"ColorMatcher",title:"Color Matcher",category:"Arcade",image:c$1("./games/ColorMatcher.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ColorMatcher/"},{id:"EndlessMaze",title:"Endless Maze",category:"Arcade",image:c$1("./games/EndlessMaze.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/EndlessMaze/"},{id:"SpinningAround",title:"Spinning Around",category:"Arcade",image:c$1("./games/SpinningAround.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/SpinningAround/"},{id:"BoomBallz",title:"Boom Ballz",category:"Arcade",image:c$1("./games/BoomBallz.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/BoomBallz/"},{id:"CubeHead",title:"Cube Head",category:"Arcade",image:c$1("./games/CubeHead.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CubeHead/"},{id:"CapybaraLink",title:"Capybara Link",category:"Puzzle",image:c$1("./games/CapybaraLink.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CapybaraLink/"},{id:"Snake2048",title:"Snake 2048",category:"Puzzle",image:c$1("./games/Snake2048.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Snake2048/"},{id:"FishTankFury",title:"Fish Tank Fury",category:"Puzzle",image:c$1("./games/FishTankFury.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/FishTankFury/"},{id:"ConnectBalls",title:"Connect Balls",category:"Arcade",image:c$1("./games/ConnectBalls.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ConnectBalls/"},{id:"CircularBreaker",title:"Circular Breaker",category:"Arcade",image:c$1("./games/CircularBreaker.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CircularBreaker/"},{id:"OneDoor",title:"One Door",category:"Arcade",image:c$1("./games/OneDoor.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/OneDoor/"},{id:"CatchtheFruits",title:"Catch the Fruits",category:"Casual",image:c$1("./games/CatchtheFruits.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CatchtheFruits/"},{id:"Falling2048",title:"Falling 2048",category:"Casual",image:c$1("./games/Falling2048.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Falling2048/"}],x=J(Z),h=()=>x.filter(o=>o.enable);({Adventure:h().filter(o=>o.category==="Adventure"),Moba:h().filter(o=>o.category==="Moba")});var G=o=>x.find(e=>e.id===o);var K=()=>Array.from(new Set(h().map(o=>o.category)));var C="https://api.playsout.com",U=3e4,V=new Set([10010,10011,10012,10013]);function $(o){let e=String(o?.platform||"").toLowerCase();if(e==="tiktok"){let t=o.authorizationCode;if(typeof t!="string"||!t.trim())throw l("MISSING_PARAMS","authorizationCode is required for TikTok login");return {platform:e,authorizationCode:t}}if(e==="grab"||e==="eros"){let t=o;if(typeof t.platformUserId!="string"||!t.platformUserId.trim())throw l("MISSING_PARAMS","platformUserId is required for Grab/Eros login");if(typeof t.platformToken!="string"||!t.platformToken.trim())throw l("MISSING_PARAMS","platformToken is required for Grab/Eros login");return {platform:e,platformUserId:t.platformUserId,platformToken:t.platformToken,username:typeof t.username=="string"?t.username:void 0,inviteCode:typeof t.inviteCode=="string"?t.inviteCode:void 0}}throw l("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var A=null,L=null,w=null;function H(o){L=o;}function F(o){w=o;}async function M(o,e={},t,r=false){let i=t?.apiBaseUrl||C,s=o.startsWith("http")?o:`${i}${o}`,u=new AbortController,d=setTimeout(()=>u.abort(),U);try{let f=g.getJSON(c.TOKEN_DATA),y={"Content-Type":"application/json",...e.headers};f?.accessToken&&!y.token&&(y.token=f.accessToken);let p=await fetch(s,{...e,signal:u.signal,headers:y});if(clearTimeout(d),!p.ok){if(p.status===401&&!r)return await z(o,e,t);throw l(p.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${p.status}: ${p.statusText}`)}let I=await p.json();if(I.code!==void 0&&V.has(I.code)&&!r){if(o.includes("/platform/refreshToken"))throw l("TOKEN_EXPIRED",I.msg||"Token expired");return await z(o,e,t)}if(I.code!==0&&I.code!==1e4)throw l("API_ERROR",I.msg||"API request failed");return I.data}catch(f){throw clearTimeout(d),f instanceof T?f:f instanceof Error?f.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",f.message):l("UNKNOWN")}}async function z(o,e,t){await j(t);let r=t?.apiBaseUrl||C,i=o.startsWith("http")?o:`${r}${o}`,s=new AbortController,u=setTimeout(()=>s.abort(),U);try{let d=g.getJSON(c.TOKEN_DATA),f={"Content-Type":"application/json",...e.headers};d?.accessToken&&(f.token=d.accessToken);let y=await fetch(i,{...e,signal:s.signal,headers:f});if(clearTimeout(u),!y.ok)throw l(y.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${y.status}: ${y.statusText}`);let p=await y.json();if(p.code!==0&&p.code!==1e4)throw l("API_ERROR",p.msg||"API request failed");return p.data}catch(d){throw clearTimeout(u),d instanceof T?d:d instanceof Error&&d.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",d?.message||"Request failed")}}async function j(o){return A||(A=(async()=>{let e=g.getJSON(c.TOKEN_DATA);if(!e?.refreshToken)throw l("NOT_LOGGED_IN","No refresh token available");let t=o?.apiBaseUrl||C,r=new AbortController,i=setTimeout(()=>r.abort(),U);try{let s=await fetch(`${t}/platform/refreshToken`,{method:"POST",signal:r.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})});if(clearTimeout(i),!s.ok)throw l("TOKEN_EXPIRED","Failed to refresh token");let u=await s.json();if(u.code!==0&&u.code!==1e4||!u.data)throw l("TOKEN_EXPIRED",u.msg||"Failed to refresh token");let d=u.data;if(g.setJSON(c.TOKEN_DATA,d),L)try{L(d);}catch{}return d}catch(s){if(clearTimeout(i),s instanceof T){if(w)try{w();}catch{}throw s}if(s instanceof Error&&s.name==="AbortError")throw l("TIMEOUT");if(w)try{w();}catch{}throw l("TOKEN_EXPIRED","Refresh token failed")}finally{A=null;}})(),A)}var O=class{constructor(){this.config=null;}configure(e){this.config=e;}async refreshToken(){return await j(this.config||void 0)}async getGames(e){let t=h();if(e?.category&&(t=t.filter(r=>r.category===e.category)),e?.search){let r=e.search.toLowerCase();t=t.filter(i=>i.title.toLowerCase().includes(r)||i.category.toLowerCase().includes(r)||i.description&&i.description.toLowerCase().includes(r));}if(e?.sortBy)switch(e.sortBy){case "newest":t=t.filter(r=>r.isNew).concat(t.filter(r=>!r.isNew));break;case "rating":t=t.filter(r=>r.isHot).concat(t.filter(r=>!r.isHot));break}if(e?.page&&e?.pageSize){let r=(e.page-1)*e.pageSize;t=t.slice(r,r+e.pageSize);}return t}async getCategories(){let e=h(),t=new Map;return e.forEach(r=>{let i=t.get(r.category)||0;t.set(r.category,i+1);}),Array.from(t.entries()).map(([r,i],s)=>({id:`category_${s}`,name:r,count:i}))}async getGameById(e){return G(e)}async getCategoryNames(){return K()}async loginOnly(e){let t=$(e);return await M("/platform/login",{method:"POST",body:JSON.stringify(t)},this.config??void 0)}async Login(e){let t=await this.loginOnly(e),r;try{r=await this.getUserInfo();}catch{}return {tokenData:t,user:r}}async getUserInfo(){return await M("/platform/user",{method:"GET"},this.config??void 0)}async getUser(){return g.getJSON(c.USER)}async validateToken(e){return !!e}},b=null;function R(){return b||(b=new O),b}var Y="https://api.playsout.com",B="zh",k=class o{constructor(){this.config=null;this._isInitialized=false;this._user=null;this._token=null;this._locale=B;this._widget=null;}static getInstance(){return o.instance||(o.instance=new o),o.instance}async init(e={}){if(this._isInitialized)throw l("ALREADY_INITIALIZED");this.config={apiBaseUrl:e.apiBaseUrl||Y,debug:e.debug||false,storage:e.storage||"localStorage",locale:e.locale||B,appId:e.appId||""},g.configure(this.config.storage),H(i=>{this._token=i.accessToken;}),F(()=>{this._user=null,this._token=null,g.remove(c.TOKEN_DATA),g.remove(c.USER),b$1.emit("authExpired"),this.config?.debug&&console.warn("[PlaysoutSDK] Auth expired, logged out");});let t=g.getJSON(c.TOKEN_DATA);this._user=g.getJSON(c.USER),this._locale=g.get(c.LOCALE)||this.config.locale;let r=Math.floor(Date.now()/1e3);if(t&&t.refreshExpiresAt>r&&(this._token=t.accessToken),this._isInitialized=true,this.config.debug&&(console.log("[PlaysoutSDK] Initialized with config:",this.config),console.log("[PlaysoutSDK] Restored token:",this._token?this._token.substring(0,20)+"...":"(none)")),b$1.emit("initialized"),t){let i=Math.floor(Date.now()/1e3);if(t.expiresAt-i<=300)try{let s=R();s.configure(this.config),await s.refreshToken();let u=g.getJSON(c.TOKEN_DATA);u&&(this._token=u.accessToken),this.config.debug&&console.log("[PlaysoutSDK] Token proactively refreshed at init");}catch(s){this.config.debug&&console.warn("[PlaysoutSDK] Proactive refresh failed, will retry on next request:",s);}}}destroy(){this.config=null,this._isInitialized=false,this._user=null,this._token=null,g.clear(),b$1.clear();}get isInitialized(){return this._isInitialized}get isLoggedIn(){return !!this._token}get user(){return this._user}get token(){return this._token}get locale(){return this._locale}get sdkConfig(){return this.config}async Login(e){this.ensureInitialized(),this.config?.debug&&console.log("[PlaysoutSDK] Login with params:",e);let t=R();t.configure(this.config);let r=await t.loginOnly(e);g.setJSON(c.TOKEN_DATA,r),this.config?.debug&&console.log("[PlaysoutSDK] Token saved, expires at:",new Date(r.expiresAt*1e3).toISOString());let i;try{i=await t.getUserInfo();}catch(s){this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo failed, login still success:",s);}return this._token=r.accessToken,i&&(this._user={userId:String(i.id),username:i.username},g.setJSON(c.USER,this._user)),this.config?.debug&&console.log("[PlaysoutSDK] Login success, user:",i),b$1.emit("login",{user:this._user,token:this._token}),{tokenData:r,user:i}}async getUserInfo(){if(this.ensureInitialized(),!this._token)throw l("NOT_LOGGED_IN","Please login first");let e=R();e.configure(this.config);let t=await e.getUserInfo();return this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo result:",t),t&&(this._user={userId:String(t.id),username:t.username},g.setJSON(c.USER,this._user)),t}logout(){this._user=null,this._token=null,g.remove(c.TOKEN_DATA),g.remove(c.USER),b$1.emit("logout");}getToken(){return this.ensureInitialized(),this._token}getUser(){return this.ensureInitialized(),this._user}setLocale(e){if(this.ensureInitialized(),!["zh","en","ja","ko","vi","th","id","ms"].includes(e))throw l("INVALID_PARAMS",`Unsupported locale: ${e}`);this._locale=e,g.set(c.LOCALE,e),this.config?.debug&&console.log("[PlaysoutSDK] Locale changed to:",e);let t=this._widget||document.querySelector("playsout-widget");t&&t.getAttribute("locale")!==e&&t.setAttribute("locale",e),b$1.emit("localeChange",e);}getLocale(){return this.ensureInitialized(),this._locale}async getGames(e){this.ensureInitialized();let t=h();if(e?.category&&(t=t.filter(r=>r.category===e.category)),e?.search){let r=e.search.toLowerCase();t=t.filter(i=>i.title.toLowerCase().includes(r)||i.category.toLowerCase().includes(r)||i.description&&i.description.toLowerCase().includes(r));}if(e?.sortBy)switch(e.sortBy){case "newest":t=t.filter(r=>r.isNew).concat(t.filter(r=>!r.isNew));break;case "rating":t=t.filter(r=>r.isHot).concat(t.filter(r=>!r.isHot));break}if(e?.page&&e?.pageSize){let r=(e.page-1)*e.pageSize;t=t.slice(r,r+e.pageSize);}return t}async getCategories(){this.ensureInitialized();let e=h(),t=new Map;return e.forEach(r=>{let i=t.get(r.category)||0;t.set(r.category,i+1);}),Array.from(t.entries()).map(([r,i],s)=>({id:`category_${s}`,name:r,count:i}))}async getGameById(e){return this.ensureInitialized(),h().find(t=>t.id===e)}mount(e,t){if(this.ensureInitialized(),typeof document>"u")throw l("FEATURE_NOT_SUPPORTED","mount requires DOM environment");let r=document.querySelector(e);if(!r)throw l("INVALID_PARAMS",`Container not found: ${e}`);let i=document.createElement("playsout-widget");this.config?.appId&&i.setAttribute("app-id",this.config.appId),i.setAttribute("locale",t?.locale||this._locale),i.setAttribute("theme",t?.theme||"dark"),t?.detailMode&&i.setAttribute("detail-mode",t.detailMode),this._widget=i,t?.onGameClick&&i.addEventListener("game-click",s=>{let u=s;t.onGameClick(u.detail);}),t?.onLoginRequired&&i.addEventListener("login-required",t.onLoginRequired),t?.onLocaleChange&&i.addEventListener("locale-change",s=>{let u=s;t.onLocaleChange(u.detail);}),r.appendChild(i),this.config?.debug&&console.log("[PlaysoutSDK] Widget mounted to:",e);}unmount(){let e=document.querySelector("playsout-widget");e&&e.remove(),this._widget=null;}on(e,t){return this.ensureInitialized(),b$1.on(e,t)}off(e,t){this.ensureInitialized(),b$1.off(e,t);}ensureInitialized(){if(!this._isInitialized)throw l("NOT_INITIALIZED")}},a=k.getInstance(),he=a;typeof window<"u"&&(window.__playsout_sdk_instance=a);var Ie=Object.freeze({init:a.init.bind(a),mount:a.mount.bind(a),unmount:a.unmount.bind(a),destroy:a.destroy.bind(a),Login:a.Login.bind(a),logout:a.logout.bind(a),getToken:a.getToken.bind(a),getUserInfo:a.getUserInfo.bind(a),getUser:a.getUser.bind(a),setLocale:a.setLocale.bind(a),getLocale:a.getLocale.bind(a),getGames:a.getGames.bind(a),getCategories:a.getCategories.bind(a),on:a.on.bind(a),off:a.off.bind(a),get isInitialized(){return a.isInitialized},get isLoggedIn(){return a.isLoggedIn},instance:a,PlaysoutSDKClass:k});
2
+ export{N as a,T as b,g as c,c as d,k as e,a as f,he as g,Ie as h};
@@ -0,0 +1,2 @@
1
+ var l=(r=>(r.INITIALIZED="initialized",r.LOGIN="login",r.LOGOUT="logout",r.LOCALE_CHANGE="localeChange",r.ERROR="error",r.GAME_CLICK="gameClick",r.LOGIN_REQUIRED="loginRequired",r.AUTH_EXPIRED="authExpired",r))(l||{}),a=class{constructor(){this.events=new Map;}on(e,n){return this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(n),()=>{this.off(e,n);}}once(e,n){let s=i=>{n(i),this.off(e,s);};return this.on(e,s)}off(e,n){this.events.get(e)?.delete(n),this.events.get(e)?.size===0&&this.events.delete(e);}emit(e,n){this.events.get(e)?.forEach(s=>{try{s(n);}catch(i){console.error(`[PlaysoutSDK] Event handler error for "${e}":`,i);}});}listenerCount(e){return this.events.get(e)?.size??0}clear(){this.events.clear();}},o=new a,u={on:(t,e)=>o.on(t,e),once:(t,e)=>o.once(t,e),off:(t,e)=>{o.off(t,e);},clear:()=>{o.clear();},emit:(t,e)=>{o.emit(t,e);}};var c="https://games.playsout.com/resources/icon/image";function d(t){if(!t||/^(data:|https?:|blob:)/i.test(t))return t;let e=t.replace(/^\.\//,"");return `${c}/${e}`}
2
+ export{l as a,u as b,d as c};
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkZ2CIDSTP_cjs=require('./chunk-Z2CIDSTP.cjs');var N=(m=>(m.NOT_INITIALIZED="NOT_INITIALIZED",m.ALREADY_INITIALIZED="ALREADY_INITIALIZED",m.NOT_LOGGED_IN="NOT_LOGGED_IN",m.TOKEN_EXPIRED="TOKEN_EXPIRED",m.INVALID_TOKEN="INVALID_TOKEN",m.NETWORK_ERROR="NETWORK_ERROR",m.TIMEOUT="TIMEOUT",m.SERVER_ERROR="SERVER_ERROR",m.API_ERROR="API_ERROR",m.INVALID_PARAMS="INVALID_PARAMS",m.MISSING_PARAMS="MISSING_PARAMS",m.FEATURE_NOT_SUPPORTED="FEATURE_NOT_SUPPORTED",m.UNKNOWN="UNKNOWN",m.PAYMENT_FAILED="PAYMENT_FAILED",m.SHARE_FAILED="SHARE_FAILED",m))(N||{}),T=class extends Error{constructor(t,r,i){super(r);this.code=t;this.details=i;this.name="SDKError";}toJSON(){return {name:this.name,code:this.code,message:this.message,details:this.details}}},q={NOT_INITIALIZED:"SDK not initialized. Please call PlaysoutSDK.init() first.",ALREADY_INITIALIZED:"SDK already initialized. Please do not call init() more than once.",NOT_LOGGED_IN:"User not logged in. Please log in first.",TOKEN_EXPIRED:"Login token has expired. Please log in again.",INVALID_TOKEN:"Invalid login token. Please log in again.",NETWORK_ERROR:"Network connection failed. Please check your network.",TIMEOUT:"Request timed out. Please try again later.",SERVER_ERROR:"Server is busy. Please try again later.",API_ERROR:"API request failed.",INVALID_PARAMS:"Invalid parameter(s).",MISSING_PARAMS:"Missing required parameter(s).",FEATURE_NOT_SUPPORTED:"This feature is not supported in the current environment.",UNKNOWN:"An unknown error occurred.",PAYMENT_FAILED:"Payment failed.",SHARE_FAILED:"Share failed."};function l(o,e){return new T(o,q[o],e)}var P="playsout_",D=class{constructor(e){this.storage=e;}get(e){try{return this.storage.getItem(P+e)}catch{return null}}set(e,t){try{this.storage.setItem(P+e,t);}catch(r){console.warn("[PlaysoutSDK] Storage set failed:",r);}}remove(e){try{this.storage.removeItem(P+e);}catch{}}clear(){try{let e=[];for(let t=0;t<this.storage.length;t++){let r=this.storage.key(t);r&&r.startsWith(P)&&e.push(r);}e.forEach(t=>this.storage.removeItem(t));}catch{}}},_=class{constructor(){this.store=new Map;}get(e){return this.store.get(e)??null}set(e,t){this.store.set(e,t);}remove(e){this.store.delete(e);}clear(){this.store.clear();}};function v(o="localStorage"){return typeof window>"u"||o==="memory"?new _:o==="sessionStorage"?new D(sessionStorage):new D(localStorage)}var S=v(),g={get:o=>S.get(o),set:(o,e)=>{S.set(o,e);},remove:o=>{S.remove(o);},clear:()=>{S.clear();},getJSON:o=>{let e=S.get(o);if(!e)return null;try{return JSON.parse(e)}catch{return null}},setJSON:(o,e)=>{S.set(o,JSON.stringify(e));},configure(o){S=v(o);}},c={TOKEN_DATA:"token_data",USER:"user",LOCALE:"locale",CONFIG:"config"};var W=o=>{if(!o)return o;try{let e=new URL(o);if(e.hostname==="games.playsout.com"){let t=e.pathname,r=t.endsWith("/"),i=/\.[a-z0-9]+$/i.test(t);!r&&!i&&(e.pathname=`${t}/`);}return e.toString()}catch{return o}},J=o=>o.map(e=>{if(!e.externalUrl)return e;let t=W(e.externalUrl);return t===e.externalUrl?e:{...e,externalUrl:t}}),Z=[{id:"BlockCrushFun",title:"Block Crush Fun",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/BlockCrushFun.png"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/BlockCrushFun"},{id:"DogeSurvivors",title:"Doge Survivors",category:"Doge OS",image:chunkZ2CIDSTP_cjs.c("./games/DogeSurvivors.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeSurvivors/"},{id:"DogeMaze",title:"Doge Maze",category:"Doge OS",image:chunkZ2CIDSTP_cjs.c("./games/DogeMaze.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeMaze/"},{id:"DogeMart",title:"Doge Mart",category:"Doge OS",image:chunkZ2CIDSTP_cjs.c("./games/DogeMart.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeMart/"},{id:"KittyEscape",title:"Kitty Escape",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/KittyEscape.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/KittyEscape/"},{id:"ProjectGarden",title:"Project: Garden",category:"Adventure",image:chunkZ2CIDSTP_cjs.c("./games/SimulatedAdventures.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/simulated/"},{id:"ProjectIDLE",title:"Project: IDLE",category:"Simulation",image:chunkZ2CIDSTP_cjs.c("./games/ProjectIDLE.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/idle/"},{id:"CulinaryStarWeb",title:"Culinary Star",category:"Casual",image:chunkZ2CIDSTP_cjs.c("./games/CulinaryStar.webp"),description:"Cooking game",isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CulinaryStar/"},{id:"PickaxeQuest",title:"Pickaxe Quest",category:"Adventure",image:chunkZ2CIDSTP_cjs.c("./games/PickaxeQuest.jpg"),description:"Mining and adventure game",isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/PickaxeQuest/",apiGameId:73},{id:"MonsterSurvivors",title:"Monster Survivors",category:"Adventure",image:chunkZ2CIDSTP_cjs.c("./games/MonsterSurvivors.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/MonsterSurvivors/"},{id:"IdleTowerDefense",title:"Idle Tower Defense",category:"RPG",image:chunkZ2CIDSTP_cjs.c("./games/IdleTowerDefense.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/IdleTowerDefense/"},{id:"MushroomWarriors",title:"Mushroom Warriors",category:"RPG",image:chunkZ2CIDSTP_cjs.c("./games/MushroomWarriors.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/MushroomWarriors/"},{id:"FollowThePath",title:"Follow The Path",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/FollowThePath.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/FollowThePath/"},{id:"ColorRun",title:"Color Run",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ColorRun.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ColorRun/"},{id:"StupidArrow",title:"Stupid Arrow",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/StupidArrow.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/StupidArrow/"},{id:"ZigZag",title:"Zig Zag",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ZigZag.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ZigZag/"},{id:"SpikesEverywhere",title:"Spikes Everywhere",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/SpikesEverywhere.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/SpikesEverywhere/"},{id:"ArrowRacer",title:"Arrow Racer",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ArrowRacer.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ArrowRacer/"},{id:"CircleLeap",title:"Circle Leap",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/CircleLeap.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CircleLeap/"},{id:"ColorMatcher",title:"Color Matcher",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ColorMatcher.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ColorMatcher/"},{id:"EndlessMaze",title:"Endless Maze",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/EndlessMaze.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/EndlessMaze/"},{id:"SpinningAround",title:"Spinning Around",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/SpinningAround.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/SpinningAround/"},{id:"BoomBallz",title:"Boom Ballz",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/BoomBallz.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/BoomBallz/"},{id:"CubeHead",title:"Cube Head",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/CubeHead.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CubeHead/"},{id:"CapybaraLink",title:"Capybara Link",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/CapybaraLink.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CapybaraLink/"},{id:"Snake2048",title:"Snake 2048",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/Snake2048.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Snake2048/"},{id:"FishTankFury",title:"Fish Tank Fury",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/FishTankFury.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/FishTankFury/"},{id:"ConnectBalls",title:"Connect Balls",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ConnectBalls.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ConnectBalls/"},{id:"CircularBreaker",title:"Circular Breaker",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/CircularBreaker.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CircularBreaker/"},{id:"OneDoor",title:"One Door",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/OneDoor.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/OneDoor/"},{id:"CatchtheFruits",title:"Catch the Fruits",category:"Casual",image:chunkZ2CIDSTP_cjs.c("./games/CatchtheFruits.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CatchtheFruits/"},{id:"Falling2048",title:"Falling 2048",category:"Casual",image:chunkZ2CIDSTP_cjs.c("./games/Falling2048.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Falling2048/"}],x=J(Z),h=()=>x.filter(o=>o.enable);({Adventure:h().filter(o=>o.category==="Adventure"),Moba:h().filter(o=>o.category==="Moba")});var G=o=>x.find(e=>e.id===o);var K=()=>Array.from(new Set(h().map(o=>o.category)));var C="https://api.playsout.com",U=3e4,V=new Set([10010,10011,10012,10013]);function $(o){let e=String(o?.platform||"").toLowerCase();if(e==="tiktok"){let t=o.authorizationCode;if(typeof t!="string"||!t.trim())throw l("MISSING_PARAMS","authorizationCode is required for TikTok login");return {platform:e,authorizationCode:t}}if(e==="grab"||e==="eros"){let t=o;if(typeof t.platformUserId!="string"||!t.platformUserId.trim())throw l("MISSING_PARAMS","platformUserId is required for Grab/Eros login");if(typeof t.platformToken!="string"||!t.platformToken.trim())throw l("MISSING_PARAMS","platformToken is required for Grab/Eros login");return {platform:e,platformUserId:t.platformUserId,platformToken:t.platformToken,username:typeof t.username=="string"?t.username:void 0,inviteCode:typeof t.inviteCode=="string"?t.inviteCode:void 0}}throw l("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var A=null,L=null,w=null;function H(o){L=o;}function F(o){w=o;}async function M(o,e={},t,r=false){let i=t?.apiBaseUrl||C,s=o.startsWith("http")?o:`${i}${o}`,u=new AbortController,d=setTimeout(()=>u.abort(),U);try{let f=g.getJSON(c.TOKEN_DATA),y={"Content-Type":"application/json",...e.headers};f?.accessToken&&!y.token&&(y.token=f.accessToken);let p=await fetch(s,{...e,signal:u.signal,headers:y});if(clearTimeout(d),!p.ok){if(p.status===401&&!r)return await z(o,e,t);throw l(p.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${p.status}: ${p.statusText}`)}let I=await p.json();if(I.code!==void 0&&V.has(I.code)&&!r){if(o.includes("/platform/refreshToken"))throw l("TOKEN_EXPIRED",I.msg||"Token expired");return await z(o,e,t)}if(I.code!==0&&I.code!==1e4)throw l("API_ERROR",I.msg||"API request failed");return I.data}catch(f){throw clearTimeout(d),f instanceof T?f:f instanceof Error?f.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",f.message):l("UNKNOWN")}}async function z(o,e,t){await j(t);let r=t?.apiBaseUrl||C,i=o.startsWith("http")?o:`${r}${o}`,s=new AbortController,u=setTimeout(()=>s.abort(),U);try{let d=g.getJSON(c.TOKEN_DATA),f={"Content-Type":"application/json",...e.headers};d?.accessToken&&(f.token=d.accessToken);let y=await fetch(i,{...e,signal:s.signal,headers:f});if(clearTimeout(u),!y.ok)throw l(y.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${y.status}: ${y.statusText}`);let p=await y.json();if(p.code!==0&&p.code!==1e4)throw l("API_ERROR",p.msg||"API request failed");return p.data}catch(d){throw clearTimeout(u),d instanceof T?d:d instanceof Error&&d.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",d?.message||"Request failed")}}async function j(o){return A||(A=(async()=>{let e=g.getJSON(c.TOKEN_DATA);if(!e?.refreshToken)throw l("NOT_LOGGED_IN","No refresh token available");let t=o?.apiBaseUrl||C,r=new AbortController,i=setTimeout(()=>r.abort(),U);try{let s=await fetch(`${t}/platform/refreshToken`,{method:"POST",signal:r.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})});if(clearTimeout(i),!s.ok)throw l("TOKEN_EXPIRED","Failed to refresh token");let u=await s.json();if(u.code!==0&&u.code!==1e4||!u.data)throw l("TOKEN_EXPIRED",u.msg||"Failed to refresh token");let d=u.data;if(g.setJSON(c.TOKEN_DATA,d),L)try{L(d);}catch{}return d}catch(s){if(clearTimeout(i),s instanceof T){if(w)try{w();}catch{}throw s}if(s instanceof Error&&s.name==="AbortError")throw l("TIMEOUT");if(w)try{w();}catch{}throw l("TOKEN_EXPIRED","Refresh token failed")}finally{A=null;}})(),A)}var O=class{constructor(){this.config=null;}configure(e){this.config=e;}async refreshToken(){return await j(this.config||void 0)}async getGames(e){let t=h();if(e?.category&&(t=t.filter(r=>r.category===e.category)),e?.search){let r=e.search.toLowerCase();t=t.filter(i=>i.title.toLowerCase().includes(r)||i.category.toLowerCase().includes(r)||i.description&&i.description.toLowerCase().includes(r));}if(e?.sortBy)switch(e.sortBy){case "newest":t=t.filter(r=>r.isNew).concat(t.filter(r=>!r.isNew));break;case "rating":t=t.filter(r=>r.isHot).concat(t.filter(r=>!r.isHot));break}if(e?.page&&e?.pageSize){let r=(e.page-1)*e.pageSize;t=t.slice(r,r+e.pageSize);}return t}async getCategories(){let e=h(),t=new Map;return e.forEach(r=>{let i=t.get(r.category)||0;t.set(r.category,i+1);}),Array.from(t.entries()).map(([r,i],s)=>({id:`category_${s}`,name:r,count:i}))}async getGameById(e){return G(e)}async getCategoryNames(){return K()}async loginOnly(e){let t=$(e);return await M("/platform/login",{method:"POST",body:JSON.stringify(t)},this.config??void 0)}async Login(e){let t=await this.loginOnly(e),r;try{r=await this.getUserInfo();}catch{}return {tokenData:t,user:r}}async getUserInfo(){return await M("/platform/user",{method:"GET"},this.config??void 0)}async getUser(){return g.getJSON(c.USER)}async validateToken(e){return !!e}},b=null;function R(){return b||(b=new O),b}var Y="https://api.playsout.com",B="zh",k=class o{constructor(){this.config=null;this._isInitialized=false;this._user=null;this._token=null;this._locale=B;this._widget=null;}static getInstance(){return o.instance||(o.instance=new o),o.instance}async init(e={}){if(this._isInitialized)throw l("ALREADY_INITIALIZED");this.config={apiBaseUrl:e.apiBaseUrl||Y,debug:e.debug||false,storage:e.storage||"localStorage",locale:e.locale||B,appId:e.appId||""},g.configure(this.config.storage),H(i=>{this._token=i.accessToken;}),F(()=>{this._user=null,this._token=null,g.remove(c.TOKEN_DATA),g.remove(c.USER),chunkZ2CIDSTP_cjs.b.emit("authExpired"),this.config?.debug&&console.warn("[PlaysoutSDK] Auth expired, logged out");});let t=g.getJSON(c.TOKEN_DATA);this._user=g.getJSON(c.USER),this._locale=g.get(c.LOCALE)||this.config.locale;let r=Math.floor(Date.now()/1e3);if(t&&t.refreshExpiresAt>r&&(this._token=t.accessToken),this._isInitialized=true,this.config.debug&&(console.log("[PlaysoutSDK] Initialized with config:",this.config),console.log("[PlaysoutSDK] Restored token:",this._token?this._token.substring(0,20)+"...":"(none)")),chunkZ2CIDSTP_cjs.b.emit("initialized"),t){let i=Math.floor(Date.now()/1e3);if(t.expiresAt-i<=300)try{let s=R();s.configure(this.config),await s.refreshToken();let u=g.getJSON(c.TOKEN_DATA);u&&(this._token=u.accessToken),this.config.debug&&console.log("[PlaysoutSDK] Token proactively refreshed at init");}catch(s){this.config.debug&&console.warn("[PlaysoutSDK] Proactive refresh failed, will retry on next request:",s);}}}destroy(){this.config=null,this._isInitialized=false,this._user=null,this._token=null,g.clear(),chunkZ2CIDSTP_cjs.b.clear();}get isInitialized(){return this._isInitialized}get isLoggedIn(){return !!this._token}get user(){return this._user}get token(){return this._token}get locale(){return this._locale}get sdkConfig(){return this.config}async Login(e){this.ensureInitialized(),this.config?.debug&&console.log("[PlaysoutSDK] Login with params:",e);let t=R();t.configure(this.config);let r=await t.loginOnly(e);g.setJSON(c.TOKEN_DATA,r),this.config?.debug&&console.log("[PlaysoutSDK] Token saved, expires at:",new Date(r.expiresAt*1e3).toISOString());let i;try{i=await t.getUserInfo();}catch(s){this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo failed, login still success:",s);}return this._token=r.accessToken,i&&(this._user={userId:String(i.id),username:i.username},g.setJSON(c.USER,this._user)),this.config?.debug&&console.log("[PlaysoutSDK] Login success, user:",i),chunkZ2CIDSTP_cjs.b.emit("login",{user:this._user,token:this._token}),{tokenData:r,user:i}}async getUserInfo(){if(this.ensureInitialized(),!this._token)throw l("NOT_LOGGED_IN","Please login first");let e=R();e.configure(this.config);let t=await e.getUserInfo();return this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo result:",t),t&&(this._user={userId:String(t.id),username:t.username},g.setJSON(c.USER,this._user)),t}logout(){this._user=null,this._token=null,g.remove(c.TOKEN_DATA),g.remove(c.USER),chunkZ2CIDSTP_cjs.b.emit("logout");}getToken(){return this.ensureInitialized(),this._token}getUser(){return this.ensureInitialized(),this._user}setLocale(e){if(this.ensureInitialized(),!["zh","en","ja","ko","vi","th","id","ms"].includes(e))throw l("INVALID_PARAMS",`Unsupported locale: ${e}`);this._locale=e,g.set(c.LOCALE,e),this.config?.debug&&console.log("[PlaysoutSDK] Locale changed to:",e);let t=this._widget||document.querySelector("playsout-widget");t&&t.getAttribute("locale")!==e&&t.setAttribute("locale",e),chunkZ2CIDSTP_cjs.b.emit("localeChange",e);}getLocale(){return this.ensureInitialized(),this._locale}async getGames(e){this.ensureInitialized();let t=h();if(e?.category&&(t=t.filter(r=>r.category===e.category)),e?.search){let r=e.search.toLowerCase();t=t.filter(i=>i.title.toLowerCase().includes(r)||i.category.toLowerCase().includes(r)||i.description&&i.description.toLowerCase().includes(r));}if(e?.sortBy)switch(e.sortBy){case "newest":t=t.filter(r=>r.isNew).concat(t.filter(r=>!r.isNew));break;case "rating":t=t.filter(r=>r.isHot).concat(t.filter(r=>!r.isHot));break}if(e?.page&&e?.pageSize){let r=(e.page-1)*e.pageSize;t=t.slice(r,r+e.pageSize);}return t}async getCategories(){this.ensureInitialized();let e=h(),t=new Map;return e.forEach(r=>{let i=t.get(r.category)||0;t.set(r.category,i+1);}),Array.from(t.entries()).map(([r,i],s)=>({id:`category_${s}`,name:r,count:i}))}async getGameById(e){return this.ensureInitialized(),h().find(t=>t.id===e)}mount(e,t){if(this.ensureInitialized(),typeof document>"u")throw l("FEATURE_NOT_SUPPORTED","mount requires DOM environment");let r=document.querySelector(e);if(!r)throw l("INVALID_PARAMS",`Container not found: ${e}`);let i=document.createElement("playsout-widget");this.config?.appId&&i.setAttribute("app-id",this.config.appId),i.setAttribute("locale",t?.locale||this._locale),i.setAttribute("theme",t?.theme||"dark"),t?.detailMode&&i.setAttribute("detail-mode",t.detailMode),this._widget=i,t?.onGameClick&&i.addEventListener("game-click",s=>{let u=s;t.onGameClick(u.detail);}),t?.onLoginRequired&&i.addEventListener("login-required",t.onLoginRequired),t?.onLocaleChange&&i.addEventListener("locale-change",s=>{let u=s;t.onLocaleChange(u.detail);}),r.appendChild(i),this.config?.debug&&console.log("[PlaysoutSDK] Widget mounted to:",e);}unmount(){let e=document.querySelector("playsout-widget");e&&e.remove(),this._widget=null;}on(e,t){return this.ensureInitialized(),chunkZ2CIDSTP_cjs.b.on(e,t)}off(e,t){this.ensureInitialized(),chunkZ2CIDSTP_cjs.b.off(e,t);}ensureInitialized(){if(!this._isInitialized)throw l("NOT_INITIALIZED")}},a=k.getInstance(),he=a;typeof window<"u"&&(window.__playsout_sdk_instance=a);var Ie=Object.freeze({init:a.init.bind(a),mount:a.mount.bind(a),unmount:a.unmount.bind(a),destroy:a.destroy.bind(a),Login:a.Login.bind(a),logout:a.logout.bind(a),getToken:a.getToken.bind(a),getUserInfo:a.getUserInfo.bind(a),getUser:a.getUser.bind(a),setLocale:a.setLocale.bind(a),getLocale:a.getLocale.bind(a),getGames:a.getGames.bind(a),getCategories:a.getCategories.bind(a),on:a.on.bind(a),off:a.off.bind(a),get isInitialized(){return a.isInitialized},get isLoggedIn(){return a.isLoggedIn},instance:a,PlaysoutSDKClass:k});
2
+ exports.a=N;exports.b=T;exports.c=g;exports.d=c;exports.e=k;exports.f=a;exports.g=he;exports.h=Ie;
@@ -0,0 +1,2 @@
1
+ 'use strict';var l=(r=>(r.INITIALIZED="initialized",r.LOGIN="login",r.LOGOUT="logout",r.LOCALE_CHANGE="localeChange",r.ERROR="error",r.GAME_CLICK="gameClick",r.LOGIN_REQUIRED="loginRequired",r.AUTH_EXPIRED="authExpired",r))(l||{}),a=class{constructor(){this.events=new Map;}on(e,n){return this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(n),()=>{this.off(e,n);}}once(e,n){let s=i=>{n(i),this.off(e,s);};return this.on(e,s)}off(e,n){this.events.get(e)?.delete(n),this.events.get(e)?.size===0&&this.events.delete(e);}emit(e,n){this.events.get(e)?.forEach(s=>{try{s(n);}catch(i){console.error(`[PlaysoutSDK] Event handler error for "${e}":`,i);}});}listenerCount(e){return this.events.get(e)?.size??0}clear(){this.events.clear();}},o=new a,u={on:(t,e)=>o.on(t,e),once:(t,e)=>o.once(t,e),off:(t,e)=>{o.off(t,e);},clear:()=>{o.clear();},emit:(t,e)=>{o.emit(t,e);}};var c="https://games.playsout.com/resources/icon/image";function d(t){if(!t||/^(data:|https?:|blob:)/i.test(t))return t;let e=t.replace(/^\.\//,"");return `${c}/${e}`}
2
+ exports.a=l;exports.b=u;exports.c=d;
package/core/api.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { SDKConfig, Game, Category, GetGamesParams, User, PlatformLoginParams, PlatformLoginResult, PlatformUserInfo, TokenData } from './types';
2
+ export declare function setTokenRefreshListener(listener: (tokenData: TokenData) => void): void;
3
+ export declare function setAuthExpiredListener(listener: () => void): void;
4
+ export declare class SDKAPI {
5
+ private config;
6
+ configure(config: SDKConfig): void;
7
+ refreshToken(): Promise<TokenData>;
8
+ getGames(params?: GetGamesParams): Promise<Game[]>;
9
+ getCategories(): Promise<Category[]>;
10
+ getGameById(id: string): Promise<Game | undefined>;
11
+ getCategoryNames(): Promise<string[]>;
12
+ loginOnly(params: PlatformLoginParams): Promise<TokenData>;
13
+ Login(params: PlatformLoginParams): Promise<PlatformLoginResult>;
14
+ getUserInfo(): Promise<PlatformUserInfo>;
15
+ getUser(): Promise<User | null>;
16
+ validateToken(token: string): Promise<boolean>;
17
+ }
18
+ export declare function getSDKAPI(): SDKAPI;
19
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/core/api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,SAAS,EAET,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACV,MAAM,SAAS,CAAC;AAwFjB,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI,CAEtF;AAMD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAEjE;AA6ND,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAA0B;IAKxC,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAS5B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAQlC,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAuClD,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAmBpC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;IAOlD,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAOrC,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IAY1D,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAuBhE,WAAW,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAUxC,OAAO,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAO/B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAIrD;AAKD,wBAAgB,SAAS,IAAI,MAAM,CAKlC"}
@@ -0,0 +1,31 @@
1
+ export declare enum ErrorCode {
2
+ NOT_INITIALIZED = "NOT_INITIALIZED",
3
+ ALREADY_INITIALIZED = "ALREADY_INITIALIZED",
4
+ NOT_LOGGED_IN = "NOT_LOGGED_IN",
5
+ TOKEN_EXPIRED = "TOKEN_EXPIRED",
6
+ INVALID_TOKEN = "INVALID_TOKEN",
7
+ NETWORK_ERROR = "NETWORK_ERROR",
8
+ TIMEOUT = "TIMEOUT",
9
+ SERVER_ERROR = "SERVER_ERROR",
10
+ API_ERROR = "API_ERROR",
11
+ INVALID_PARAMS = "INVALID_PARAMS",
12
+ MISSING_PARAMS = "MISSING_PARAMS",
13
+ FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED",
14
+ UNKNOWN = "UNKNOWN",
15
+ PAYMENT_FAILED = "PAYMENT_FAILED",
16
+ SHARE_FAILED = "SHARE_FAILED"
17
+ }
18
+ export declare class SDKError extends Error {
19
+ code: ErrorCode;
20
+ details?: unknown | undefined;
21
+ constructor(code: ErrorCode, message: string, details?: unknown | undefined);
22
+ toJSON(): {
23
+ name: string;
24
+ code: ErrorCode;
25
+ message: string;
26
+ details: unknown;
27
+ };
28
+ }
29
+ export declare const ErrorMessages: Record<ErrorCode, string>;
30
+ export declare function createSDKError(code: ErrorCode, details?: unknown): SDKError;
31
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAQA,oBAAY,SAAS;IAGnB,eAAe,oBAAoB;IAEnC,mBAAmB,wBAAwB;IAI3C,aAAa,kBAAkB;IAE/B,aAAa,kBAAkB;IAE/B,aAAa,kBAAkB;IAI/B,aAAa,kBAAkB;IAE/B,OAAO,YAAY;IAEnB,YAAY,iBAAiB;IAE7B,SAAS,cAAc;IAIvB,cAAc,mBAAmB;IAEjC,cAAc,mBAAmB;IAIjC,qBAAqB,0BAA0B;IAE/C,OAAO,YAAY;IAInB,cAAc,mBAAmB;IAIjC,YAAY,iBAAiB;CAC9B;AAKD,qBAAa,QAAS,SAAQ,KAAK;IAExB,IAAI,EAAE,SAAS;IAEf,OAAO,CAAC,EAAE,OAAO;gBAFjB,IAAI,EAAE,SAAS,EACtB,OAAO,EAAE,MAAM,EACR,OAAO,CAAC,EAAE,OAAO,YAAA;IAM1B,MAAM;;;;;;CAQP;AAOD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAgBnD,CAAC;AAKF,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAE3E"}
@@ -0,0 +1,30 @@
1
+ export type EventCallback<T = unknown> = (data: T) => void;
2
+ export declare enum SDKEvent {
3
+ INITIALIZED = "initialized",
4
+ LOGIN = "login",
5
+ LOGOUT = "logout",
6
+ LOCALE_CHANGE = "localeChange",
7
+ ERROR = "error",
8
+ GAME_CLICK = "gameClick",
9
+ LOGIN_REQUIRED = "loginRequired",
10
+ AUTH_EXPIRED = "authExpired"
11
+ }
12
+ declare class EventEmitter {
13
+ private events;
14
+ on<T = unknown>(event: string, callback: EventCallback<T>): () => void;
15
+ once<T = unknown>(event: string, callback: EventCallback<T>): () => void;
16
+ off(event: string, callback: EventCallback): void;
17
+ emit<T = unknown>(event: string, data?: T): void;
18
+ listenerCount(event: string): number;
19
+ clear(): void;
20
+ }
21
+ export declare const events: EventEmitter;
22
+ export declare const eventEmitter: {
23
+ on: <T = unknown>(event: string, callback: EventCallback<T>) => (() => void);
24
+ once: <T = unknown>(event: string, callback: EventCallback<T>) => (() => void);
25
+ off: (event: string, callback: EventCallback) => void;
26
+ clear: () => void;
27
+ emit: <T = unknown>(event: string, data?: T) => void;
28
+ };
29
+ export {};
30
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/core/events.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAK3D,oBAAY,QAAQ;IAElB,WAAW,gBAAgB;IAE3B,KAAK,UAAU;IAEf,MAAM,WAAW;IAEjB,aAAa,iBAAiB;IAE9B,KAAK,UAAU;IAEf,UAAU,cAAc;IAExB,cAAc,kBAAkB;IAEhC,YAAY,gBAAgB;CAC7B;AAKD,cAAM,YAAY;IAChB,OAAO,CAAC,MAAM,CAAyC;IAKvD,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAetE,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAWxE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAUjD,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI;IAahD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAOpC,KAAK,IAAI,IAAI;CAGd;AAKD,eAAO,MAAM,MAAM,cAAqB,CAAC;AAKzC,eAAO,MAAM,YAAY;SAIlB,CAAC,mBAAmB,MAAM,YAAY,aAAa,CAAC,CAAC,CAAC,KAAG,CAAC,MAAM,IAAI,CAAC;WAOnE,CAAC,mBAAmB,MAAM,YAAY,aAAa,CAAC,CAAC,CAAC,KAAG,CAAC,MAAM,IAAI,CAAC;iBAO/D,MAAM,YAAY,aAAa,KAAG,IAAI;iBAOxC,IAAI;WAOR,CAAC,mBAAmB,MAAM,SAAS,CAAC,KAAG,IAAI;CAGnD,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { SDKConfig, SupportedLocale, User, Game, Category, GetGamesParams, MountOptions, PlatformLoginParams, PlatformLoginResult, PlatformUserInfo } from './types';
2
+ export declare class PlaysoutSDK {
3
+ private static instance;
4
+ private config;
5
+ private _isInitialized;
6
+ private _user;
7
+ private _token;
8
+ private _locale;
9
+ private _widget;
10
+ private constructor();
11
+ static getInstance(): PlaysoutSDK;
12
+ init(config?: SDKConfig): Promise<void>;
13
+ destroy(): void;
14
+ get isInitialized(): boolean;
15
+ get isLoggedIn(): boolean;
16
+ get user(): User | null;
17
+ get token(): string | null;
18
+ get locale(): SupportedLocale;
19
+ get sdkConfig(): SDKConfig | null;
20
+ Login(params: PlatformLoginParams): Promise<PlatformLoginResult>;
21
+ getUserInfo(): Promise<PlatformUserInfo>;
22
+ logout(): void;
23
+ getToken(): string | null;
24
+ getUser(): User | null;
25
+ setLocale(locale: SupportedLocale): void;
26
+ getLocale(): SupportedLocale;
27
+ getGames(params?: GetGamesParams): Promise<Game[]>;
28
+ getCategories(): Promise<Category[]>;
29
+ getGameById(id: string): Promise<Game | undefined>;
30
+ mount(selector: string, options?: MountOptions): void;
31
+ unmount(): void;
32
+ on<T = unknown>(event: string, callback: (data: T) => void): () => void;
33
+ off(event: string, callback: (data: unknown) => void): void;
34
+ private ensureInitialized;
35
+ }
36
+ export declare const sdk: PlaysoutSDK;
37
+ export default sdk;
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAejB,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IAErC,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,OAAO,CAAmC;IAGlD,OAAO,CAAC,OAAO,CAA4B;IAE3C,OAAO;IAKP,MAAM,CAAC,WAAW,IAAI,WAAW;IAW3B,IAAI,CAAC,MAAM,GAAE,SAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAoFjD,OAAO,IAAI,IAAI;IAYf,IAAI,aAAa,IAAI,OAAO,CAE3B;IAGD,IAAI,UAAU,IAAI,OAAO,CAExB;IAGD,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,CAEtB;IAGD,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAEzB;IAGD,IAAI,MAAM,IAAI,eAAe,CAE5B;IAGD,IAAI,SAAS,IAAI,SAAS,GAAG,IAAI,CAEhC;IAQK,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAuDhE,WAAW,IAAI,OAAO,CAAC,gBAAgB,CAAC;IA8B9C,MAAM,IAAI,IAAI;IAYd,QAAQ,IAAI,MAAM,GAAG,IAAI;IAQzB,OAAO,IAAI,IAAI,GAAG,IAAI;IAiBtB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IA0BxC,SAAS,IAAI,eAAe;IAYtB,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IA8ClD,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAqBpC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;IAYxD,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAuDrD,OAAO,IAAI,IAAI;IAaf,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAQvE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAO3D,OAAO,CAAC,iBAAiB;CAK1B;AAMD,eAAO,MAAM,GAAG,aAA4B,CAAC;AAG7C,eAAe,GAAG,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { StorageType } from './types';
2
+ export interface StorageAdapter {
3
+ get(key: string): string | null;
4
+ set(key: string, value: string): void;
5
+ remove(key: string): void;
6
+ clear(): void;
7
+ }
8
+ export declare function createStorage(type?: StorageType): StorageAdapter;
9
+ export declare const storage: {
10
+ get: (key: string) => string | null;
11
+ set: (key: string, value: string) => void;
12
+ remove: (key: string) => void;
13
+ clear: () => void;
14
+ getJSON: <T>(key: string) => T | null;
15
+ setJSON: <T>(key: string, value: T) => void;
16
+ configure(type: StorageType): void;
17
+ };
18
+ export declare const STORAGE_KEYS: {
19
+ readonly TOKEN_DATA: "token_data";
20
+ readonly USER: "user";
21
+ readonly LOCALE: "locale";
22
+ readonly CONFIG: "config";
23
+ };
24
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/core/storage.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf;AAkFD,wBAAgB,aAAa,CAAC,IAAI,GAAE,WAA4B,GAAG,cAAc,CAYhF;AASD,eAAO,MAAM,OAAO;eAIP,MAAM,KAAG,MAAM,GAAG,IAAI;eAOtB,MAAM,SAAS,MAAM,KAAG,IAAI;kBAOzB,MAAM,KAAG,IAAI;iBAOhB,IAAI;cAOL,CAAC,OAAO,MAAM,KAAG,CAAC,GAAG,IAAI;cAazB,CAAC,OAAO,MAAM,SAAS,CAAC,KAAG,IAAI;oBAOzB,WAAW,GAAG,IAAI;CAGnC,CAAC;AAKF,eAAO,MAAM,YAAY;;;;;CAKf,CAAC"}
@@ -0,0 +1,127 @@
1
+ export declare const SDK_PACKAGE_NAME = "playsout";
2
+ export type SupportedLocale = 'zh' | 'en' | 'ja' | 'ko' | 'vi' | 'th' | 'id' | 'ms';
3
+ export interface SDKConfig {
4
+ appId?: string;
5
+ apiBaseUrl?: string;
6
+ debug?: boolean;
7
+ storage?: StorageType;
8
+ locale?: SupportedLocale;
9
+ }
10
+ export type StorageType = 'localStorage' | 'sessionStorage' | 'memory';
11
+ export interface User {
12
+ userId: string;
13
+ username: string;
14
+ avatar?: string;
15
+ email?: string;
16
+ }
17
+ export type PlatformType = 'grab' | 'eros' | 'tiktok';
18
+ export interface GrabErosLoginParams {
19
+ platform: 'grab' | 'eros';
20
+ platformUserId: string;
21
+ platformToken: string;
22
+ username?: string | null;
23
+ inviteCode?: string;
24
+ }
25
+ export interface TikTokLoginParams {
26
+ platform: 'tiktok';
27
+ authorizationCode: string;
28
+ }
29
+ export type PlatformLoginParams = GrabErosLoginParams | TikTokLoginParams;
30
+ export interface PlatformLoginResult {
31
+ tokenData: TokenData;
32
+ user?: PlatformUserInfo;
33
+ }
34
+ export interface PlatformUserInfo {
35
+ id: number;
36
+ platform: string;
37
+ username: string;
38
+ inviteCode?: string;
39
+ inviterCode?: string;
40
+ createTime?: string;
41
+ updateTime?: string;
42
+ [key: string]: unknown;
43
+ }
44
+ export interface Game {
45
+ id: string;
46
+ title: string;
47
+ category: string;
48
+ image: string;
49
+ description?: string;
50
+ isNew?: boolean;
51
+ isHot?: boolean;
52
+ isBanner?: boolean;
53
+ enable: boolean;
54
+ externalUrl?: string;
55
+ orientation?: 'portrait' | 'landscape';
56
+ apiGameId?: number;
57
+ }
58
+ export interface Category {
59
+ id: string;
60
+ name: string;
61
+ icon?: string;
62
+ count: number;
63
+ }
64
+ export interface GetGamesParams {
65
+ category?: string;
66
+ search?: string;
67
+ page?: number;
68
+ pageSize?: number;
69
+ sortBy?: 'rating' | 'players' | 'newest';
70
+ }
71
+ export interface ShareParams {
72
+ title: string;
73
+ text: string;
74
+ url: string;
75
+ image?: string;
76
+ }
77
+ export interface ShareResult {
78
+ success: boolean;
79
+ platform?: string;
80
+ }
81
+ export interface PaymentParams {
82
+ gameId: string;
83
+ itemId: string;
84
+ amount: number;
85
+ currency?: string;
86
+ }
87
+ export interface PaymentResult {
88
+ orderId: string;
89
+ status: 'pending' | 'success' | 'failed';
90
+ transactionId?: string;
91
+ }
92
+ export interface APIResponse<T> {
93
+ code: number;
94
+ msg: string;
95
+ data?: T;
96
+ times: number;
97
+ }
98
+ export interface MountOptions {
99
+ theme?: 'light' | 'dark';
100
+ locale?: SupportedLocale;
101
+ detailMode?: 'link' | 'iframe';
102
+ onGameClick?: (game: Game) => void;
103
+ onLoginRequired?: () => void;
104
+ onLocaleChange?: (locale: SupportedLocale) => void;
105
+ }
106
+ export interface RefreshTokenResult {
107
+ accessToken: string;
108
+ refreshToken?: string;
109
+ expiresIn?: number;
110
+ }
111
+ export interface TokenData {
112
+ accessToken: string;
113
+ expiresIn: number;
114
+ expiresAt: number;
115
+ refreshToken: string;
116
+ refreshExpiresIn: number;
117
+ refreshExpiresAt: number;
118
+ }
119
+ export interface SDKState {
120
+ isInitialized: boolean;
121
+ isLoggedIn: boolean;
122
+ user: User | null;
123
+ token: string | null;
124
+ locale: SupportedLocale;
125
+ config: SDKConfig | null;
126
+ }
127
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,30 @@
1
+ export interface Game {
2
+ id: string;
3
+ title: string;
4
+ category: string;
5
+ image: string;
6
+ description?: string;
7
+ isNew?: boolean;
8
+ isHot?: boolean;
9
+ isBanner?: boolean;
10
+ enable: boolean;
11
+ externalUrl?: string;
12
+ orientation?: 'portrait' | 'landscape';
13
+ apiGameId?: number;
14
+ }
15
+ export declare const games: Game[];
16
+ export declare const getEnabledGames: () => Game[];
17
+ export declare const gamesByCategory: {
18
+ Adventure: Game[];
19
+ Moba: Game[];
20
+ };
21
+ export declare const getNewGames: () => Game[];
22
+ export declare const getHotGames: () => Game[];
23
+ export declare const getMarkedHotGames: () => Game[];
24
+ export declare const getBannerGames: () => Game[];
25
+ export declare const getGameById: (id: string) => Game | undefined;
26
+ export declare const getApiGameId: (id: string) => number | undefined;
27
+ export declare const getEnabledGameById: (id: string) => Game | undefined;
28
+ export declare const getAllCategories: () => string[];
29
+ export declare const searchGames: (query: string) => Game[];
30
+ //# sourceMappingURL=games.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"games.d.ts","sourceRoot":"","sources":["../../src/data/games.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgYD,eAAO,MAAM,KAAK,EAAE,IAAI,EAA6B,CAAC;AAGtD,eAAO,MAAM,eAAe,QAAO,IAAI,EAEtC,CAAC;AAGF,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAGF,eAAO,MAAM,WAAW,QAAO,IAAI,EAElC,CAAC;AAGF,eAAO,MAAM,WAAW,QAAO,IAAI,EAElC,CAAC;AAGF,eAAO,MAAM,iBAAiB,QAAO,IAAI,EAExC,CAAC;AAGF,eAAO,MAAM,cAAc,QAAO,IAAI,EAErC,CAAC;AAGF,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,KAAG,IAAI,GAAG,SAE/C,CAAC;AAGF,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,KAAG,MAAM,GAAG,SAGlD,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAAI,IAAI,MAAM,KAAG,IAAI,GAAG,SAEtD,CAAC;AAGF,eAAO,MAAM,gBAAgB,QAAO,MAAM,EAEzC,CAAC;AAGF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,IAAI,EAO/C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import './web-components';
2
+ export declare const init: (config?: import(".").SDKConfig) => Promise<void>, mount: (selector: string, options?: import(".").MountOptions) => void, unmount: () => void, destroy: () => void, Login: (params: import(".").PlatformLoginParams) => Promise<import(".").PlatformLoginResult>, logout: () => void, getToken: () => string | null, getUserInfo: () => Promise<import(".").PlatformUserInfo>, getUser: () => import(".").User | null, setLocale: (locale: import(".").SupportedLocale) => void, getLocale: () => import(".").SupportedLocale, getGames: (params?: import(".").GetGamesParams) => Promise<import(".").Game[]>, getCategories: () => Promise<import(".").Category[]>, on: <T = unknown>(event: string, callback: (data: T) => void) => () => void, off: (event: string, callback: (data: unknown) => void) => void, isInitialized: boolean, isLoggedIn: boolean, instance: import("./core").PlaysoutSDK, PlaysoutSDKClass: typeof import("./core").PlaysoutSDK;
3
+ //# sourceMappingURL=iife-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iife-entry.d.ts","sourceRoot":"","sources":["../src/iife-entry.ts"],"names":[],"mappings":"AAIA,OAAO,kBAAkB,CAAC;AAE1B,eAAO,MACL,IAAI,qDACJ,KAAK,kEACL,OAAO,cACP,OAAO,cACP,KAAK,yFACL,MAAM,cACN,QAAQ,uBACR,WAAW,+CACX,OAAO,iCACP,SAAS,iDACT,SAAS,qCACT,QAAQ,wEACR,aAAa,yCACb,EAAE,2EACF,GAAG,8DACH,aAAa,WACb,UAAU,WACV,QAAQ,gCACR,gBAAgB,qCACN,CAAC"}
package/index.cjs ADDED
@@ -0,0 +1 @@
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkMUMDBAO7_cjs=require('./chunk-MUMDBAO7.cjs'),chunkZ2CIDSTP_cjs=require('./chunk-Z2CIDSTP.cjs');Object.defineProperty(exports,"ErrorCode",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.a}});Object.defineProperty(exports,"Playsout",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.h}});Object.defineProperty(exports,"PlaysoutSDK",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.e}});Object.defineProperty(exports,"SDKError",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.b}});Object.defineProperty(exports,"STORAGE_KEYS",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.d}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.g}});Object.defineProperty(exports,"sdk",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.f}});Object.defineProperty(exports,"storage",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.c}});Object.defineProperty(exports,"SDKEvent",{enumerable:true,get:function(){return chunkZ2CIDSTP_cjs.a}});Object.defineProperty(exports,"eventEmitter",{enumerable:true,get:function(){return chunkZ2CIDSTP_cjs.b}});
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export { PlaysoutSDK, sdk, default } from './core';
2
+ export { Playsout } from './public-api';
3
+ export type { PlaysoutPublicAPI } from './public-api';
4
+ export type { SDKConfig, SupportedLocale, StorageType, User, PlatformType, GrabErosLoginParams, TikTokLoginParams, PlatformLoginParams, PlatformLoginResult, PlatformUserInfo, RefreshTokenResult, Game, Category, GetGamesParams, ShareParams, ShareResult, PaymentParams, PaymentResult, APIResponse, MountOptions, SDKState, } from './core/types';
5
+ export { SDKError, ErrorCode } from './core/errors';
6
+ export type { StorageAdapter } from './core/storage';
7
+ export { storage, STORAGE_KEYS } from './core/storage';
8
+ export { eventEmitter, SDKEvent } from './core/events';
9
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,YAAY,EACV,SAAS,EACT,eAAe,EACf,WAAW,EACX,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}