playsout-web-sdk 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -50
- package/chunk-5IONEDIP.cjs +2 -0
- package/chunk-OLKMPDGC.js +2 -0
- package/core/api.d.ts.map +1 -1
- package/core/index.d.ts +2 -0
- package/core/index.d.ts.map +1 -1
- package/core/types.d.ts +1 -1
- package/core/types.d.ts.map +1 -1
- package/index.cjs +1 -1
- package/index.global.js +24 -120
- package/index.iife.js +24 -120
- package/index.js +1 -1
- package/package.json +1 -1
- package/react/context.d.ts.map +1 -1
- package/react/index.cjs +1 -1
- package/react/index.js +1 -1
- package/vue/composable.d.ts.map +1 -1
- package/vue/index.cjs +1 -1
- package/vue/index.js +1 -1
- package/web-components/PlaysoutWidget.d.ts.map +1 -1
- package/web-components/index.cjs +27 -123
- package/web-components/index.js +27 -123
- package/chunk-LU6AS3JQ.cjs +0 -2
- package/chunk-NZCZLXPA.js +0 -2
package/README.md
CHANGED
|
@@ -35,11 +35,10 @@ Use the following sequence when the application starts:
|
|
|
35
35
|
1. Initialize the SDK.
|
|
36
36
|
2. Read the current login state.
|
|
37
37
|
3. If the user is not logged in, call `Login()`.
|
|
38
|
-
4.
|
|
39
|
-
5.
|
|
40
|
-
6. Use `locale` to control the language and `user-points` to display the gem amount.
|
|
38
|
+
4. Render `<playsout-widget>`.
|
|
39
|
+
5. Use `locale` to control the language and `user-points` to display the gem amount.
|
|
41
40
|
|
|
42
|
-
`
|
|
41
|
+
During initialization, the SDK checks `expiresAt` and `refreshExpiresAt`. It uses a valid access token directly, refreshes an expired access token when the refresh token is still valid, and clears the session when the refresh token has expired. Do not use `getUserInfo()` as a startup gate. Call it only when a page explicitly needs fresh backend user data, and handle that request error separately so the widget can still render.
|
|
43
42
|
|
|
44
43
|
## Login Parameters
|
|
45
44
|
|
|
@@ -55,7 +54,7 @@ Required parameters:
|
|
|
55
54
|
| --- | --- |
|
|
56
55
|
| `platform` | Platform identifier. Use `'grab'` or `'eros'`. |
|
|
57
56
|
| `platformUserId` | Unique user ID from the host platform. |
|
|
58
|
-
| `platformToken` |
|
|
57
|
+
| `platformToken` | Random string. |
|
|
59
58
|
| `username` | User display name. |
|
|
60
59
|
|
|
61
60
|
Example:
|
|
@@ -64,12 +63,12 @@ Example:
|
|
|
64
63
|
await Playsout.Login({
|
|
65
64
|
platform: 'eros',
|
|
66
65
|
platformUserId: '10',
|
|
67
|
-
platformToken: '
|
|
66
|
+
platformToken: 'random-string',
|
|
68
67
|
username: 'TestUser',
|
|
69
68
|
});
|
|
70
69
|
```
|
|
71
70
|
|
|
72
|
-
`platformToken` is a required, non-empty string.
|
|
71
|
+
`platformToken` is a required, non-empty random string.
|
|
73
72
|
|
|
74
73
|
## HTML Integration
|
|
75
74
|
|
|
@@ -90,24 +89,38 @@ Place the following code in `index.html`:
|
|
|
90
89
|
|
|
91
90
|
<script src="https://unpkg.com/playsout-web-sdk/index.iife.js"></script>
|
|
92
91
|
<script>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
let loginPromise = null;
|
|
93
|
+
|
|
94
|
+
function login() {
|
|
95
|
+
if (!loginPromise) {
|
|
96
|
+
loginPromise = window.Playsout.Login({
|
|
96
97
|
platform: 'eros',
|
|
97
98
|
platformUserId: '10',
|
|
98
|
-
platformToken: '
|
|
99
|
+
platformToken: 'random-string',
|
|
99
100
|
username: 'TestUser'
|
|
101
|
+
}).finally(function () {
|
|
102
|
+
loginPromise = null;
|
|
100
103
|
});
|
|
101
|
-
return;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
return loginPromise;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function ensureLogin() {
|
|
110
|
+
if (!window.Playsout.isLoggedIn) {
|
|
111
|
+
return login();
|
|
112
|
+
}
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
async function bootstrap() {
|
|
109
116
|
await window.Playsout.init({ locale: 'zh' });
|
|
110
117
|
|
|
118
|
+
window.Playsout.on('authExpired', function () {
|
|
119
|
+
login().catch(function (error) {
|
|
120
|
+
console.error('Playsout re-login failed:', error);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
111
124
|
await ensureLogin();
|
|
112
125
|
|
|
113
126
|
window.Playsout.mount('#game-container');
|
|
@@ -198,7 +211,7 @@ Place this code in the page component that displays the game list. In a new Vue
|
|
|
198
211
|
```vue
|
|
199
212
|
<script setup>
|
|
200
213
|
import { watch } from 'vue';
|
|
201
|
-
import { usePlaysout
|
|
214
|
+
import { usePlaysout } from 'playsout-web-sdk/vue';
|
|
202
215
|
|
|
203
216
|
const {
|
|
204
217
|
isInitialized,
|
|
@@ -207,25 +220,27 @@ const {
|
|
|
207
220
|
Login,
|
|
208
221
|
} = usePlaysout();
|
|
209
222
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
223
|
+
let loginPromise = null;
|
|
224
|
+
|
|
225
|
+
function login() {
|
|
226
|
+
if (!loginPromise) {
|
|
227
|
+
loginPromise = Login({
|
|
213
228
|
platform: 'eros',
|
|
214
229
|
platformUserId: '10',
|
|
215
|
-
platformToken: '
|
|
230
|
+
platformToken: 'random-string',
|
|
216
231
|
username: 'TestUser',
|
|
232
|
+
}).finally(() => {
|
|
233
|
+
loginPromise = null;
|
|
217
234
|
});
|
|
218
|
-
return;
|
|
219
235
|
}
|
|
220
236
|
|
|
221
|
-
|
|
222
|
-
await Playsout.getUserInfo();
|
|
237
|
+
return loginPromise;
|
|
223
238
|
}
|
|
224
239
|
|
|
225
|
-
watch(isInitialized, (initialized) => {
|
|
226
|
-
if (!initialized) return;
|
|
240
|
+
watch([isInitialized, isLoggedIn], ([initialized, loggedIn]) => {
|
|
241
|
+
if (!initialized || loggedIn) return;
|
|
227
242
|
|
|
228
|
-
|
|
243
|
+
login().catch((error) => {
|
|
229
244
|
console.error('Playsout login flow failed:', error);
|
|
230
245
|
});
|
|
231
246
|
}, { immediate: true });
|
|
@@ -279,39 +294,31 @@ import { useEffect, useRef } from 'react';
|
|
|
279
294
|
import { usePlaysout } from 'playsout-web-sdk/react';
|
|
280
295
|
|
|
281
296
|
export default function App() {
|
|
282
|
-
const
|
|
297
|
+
const loginInFlight = useRef(false);
|
|
283
298
|
const {
|
|
284
299
|
isInitialized,
|
|
285
300
|
isLoggedIn,
|
|
286
301
|
locale,
|
|
287
302
|
Login,
|
|
288
|
-
getUserInfo,
|
|
289
303
|
} = usePlaysout();
|
|
290
304
|
|
|
291
305
|
useEffect(() => {
|
|
292
|
-
if (!isInitialized ||
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
async function ensureLoginAndUserInfo() {
|
|
296
|
-
if (!isLoggedIn) {
|
|
297
|
-
await Login({
|
|
298
|
-
platform: 'eros',
|
|
299
|
-
platformUserId: '10',
|
|
300
|
-
platformToken: 'platform_token',
|
|
301
|
-
username: 'TestUser',
|
|
302
|
-
});
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// Refresh once only when the page needs the latest backend user data.
|
|
307
|
-
await getUserInfo();
|
|
308
|
-
}
|
|
306
|
+
if (!isInitialized || isLoggedIn || loginInFlight.current) return;
|
|
307
|
+
loginInFlight.current = true;
|
|
309
308
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
309
|
+
Login({
|
|
310
|
+
platform: 'eros',
|
|
311
|
+
platformUserId: '10',
|
|
312
|
+
platformToken: 'random-string',
|
|
313
|
+
username: 'TestUser',
|
|
314
|
+
})
|
|
315
|
+
.catch((error) => {
|
|
316
|
+
console.error('Playsout login flow failed:', error);
|
|
317
|
+
})
|
|
318
|
+
.finally(() => {
|
|
319
|
+
loginInFlight.current = false;
|
|
320
|
+
});
|
|
321
|
+
}, [isInitialized, isLoggedIn, Login]);
|
|
315
322
|
|
|
316
323
|
return (
|
|
317
324
|
<playsout-widget
|
|
@@ -391,7 +398,7 @@ window.Playsout.on('authExpired', function () {
|
|
|
391
398
|
});
|
|
392
399
|
```
|
|
393
400
|
|
|
394
|
-
React and Vue
|
|
401
|
+
React and Vue adapters synchronize their reactive login state when `authExpired` is emitted. A watcher or effect that logs in whenever initialization is complete and `isLoggedIn` becomes false will therefore handle both startup and runtime expiration.
|
|
395
402
|
|
|
396
403
|
## Image Loading
|
|
397
404
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkZ2CIDSTP_cjs=require('./chunk-Z2CIDSTP.cjs');var k=(p=>(p.NOT_INITIALIZED="NOT_INITIALIZED",p.ALREADY_INITIALIZED="ALREADY_INITIALIZED",p.NOT_LOGGED_IN="NOT_LOGGED_IN",p.TOKEN_EXPIRED="TOKEN_EXPIRED",p.INVALID_TOKEN="INVALID_TOKEN",p.NETWORK_ERROR="NETWORK_ERROR",p.TIMEOUT="TIMEOUT",p.SERVER_ERROR="SERVER_ERROR",p.API_ERROR="API_ERROR",p.INVALID_PARAMS="INVALID_PARAMS",p.MISSING_PARAMS="MISSING_PARAMS",p.FEATURE_NOT_SUPPORTED="FEATURE_NOT_SUPPORTED",p.UNKNOWN="UNKNOWN",p.PAYMENT_FAILED="PAYMENT_FAILED",p.SHARE_FAILED="SHARE_FAILED",p))(k||{}),y=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}}},W={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 y(o,W[o],e)}var w="playsout_",R=class{constructor(e){this.storage=e;}get(e){try{return this.storage.getItem(w+e)}catch{return null}}set(e,t){try{this.storage.setItem(w+e,t);}catch(r){console.warn("[PlaysoutSDK] Storage set failed:",r);}}remove(e){try{this.storage.removeItem(w+e);}catch{}}clear(){try{let e=[];for(let t=0;t<this.storage.length;t++){let r=this.storage.key(t);r&&r.startsWith(w)&&e.push(r);}e.forEach(t=>this.storage.removeItem(t));}catch{}}},N=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 N:o==="sessionStorage"?new R(sessionStorage):new R(localStorage)}var I=v(),g={get:o=>I.get(o),set:(o,e)=>{I.set(o,e);},remove:o=>{I.remove(o);},clear:()=>{I.clear();},getJSON:o=>{let e=I.get(o);if(!e)return null;try{return JSON.parse(e)}catch{return null}},setJSON:(o,e)=>{I.set(o,JSON.stringify(e));},configure(o){I=v(o);}},c={TOKEN_DATA:"token_data",USER:"user",LOCALE:"locale",CONFIG:"config"};var $=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=$(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),E=()=>x.filter(o=>o.enable);({Adventure:E().filter(o=>o.category==="Adventure"),Moba:E().filter(o=>o.category==="Moba")});var G=o=>x.find(e=>e.id===o);var K=()=>Array.from(new Set(E().map(o=>o.category)));var U="https://api.playsout.com",C=3e4;function V(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");if(typeof t.username!="string"||!t.username.trim())throw l("MISSING_PARAMS","username is required for Grab/Eros login");return {platform:e,platformUserId:t.platformUserId,platformToken:t.platformToken,username:t.username,inviteCode:typeof t.inviteCode=="string"?t.inviteCode:void 0}}throw l("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var A=null,O=null,L=null;function j(o){O=o;}function F(o){L=o;}function M(){if(L)try{L();}catch{}}async function z(o,e={},t,r=false){let i=t?.apiBaseUrl||U,d=o.startsWith("http")?o:`${i}${o}`,u=new AbortController,s=setTimeout(()=>u.abort(),C);try{let m=g.getJSON(c.TOKEN_DATA),f={"Content-Type":"application/json",...e.headers};m?.accessToken&&!f.token&&(f.token=m.accessToken);let h=await fetch(d,{...e,signal:u.signal,headers:f});if(clearTimeout(s),!h.ok){if(h.status===401&&r)return await H(o,e,t);throw l(h.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${h.status}: ${h.statusText}`)}let D=await h.json();if(D.code!==1e4){if(r)return await H(o,e,t);throw l("API_ERROR",D.msg||"API request failed")}return D.data}catch(m){throw clearTimeout(s),m instanceof y?m:m instanceof Error?m.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",m.message):l("UNKNOWN")}}async function H(o,e,t){await B(t);let r=t?.apiBaseUrl||U,i=o.startsWith("http")?o:`${r}${o}`,d=new AbortController,u=setTimeout(()=>d.abort(),C);try{let s=g.getJSON(c.TOKEN_DATA),m={"Content-Type":"application/json",...e.headers};s?.accessToken&&(m.token=s.accessToken);let f=await fetch(i,{...e,signal:d.signal,headers:m});if(clearTimeout(u),!f.ok)throw l(f.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${f.status}: ${f.statusText}`);let h=await f.json();if(h.code!==1e4)throw l("API_ERROR",h.msg||"API request failed");return h.data}catch(s){throw clearTimeout(u),s instanceof y?s:s instanceof Error&&s.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",s?.message||"Request failed")}}async function B(o){if(A)return A;let e=(async()=>{let t=g.getJSON(c.TOKEN_DATA),r=Math.floor(Date.now()/1e3);if(!t?.refreshToken||t.refreshExpiresAt<=r)throw M(),l("TOKEN_EXPIRED","Refresh token has expired");let i=o?.apiBaseUrl||U,d=new AbortController,u=setTimeout(()=>d.abort(),C);try{let s=await fetch(`${i}/platform/refreshToken`,{method:"POST",signal:d.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t.refreshToken})});if(clearTimeout(u),!s.ok)throw s.status>=500?l("SERVER_ERROR",`HTTP ${s.status}: ${s.statusText}`):l("TOKEN_EXPIRED",`HTTP ${s.status}: ${s.statusText}`);let m=await s.json();if(m.code!==1e4||!m.data)throw l("TOKEN_EXPIRED",m.msg||"Failed to refresh token");let f=m.data;if(g.setJSON(c.TOKEN_DATA,f),O)try{O(f);}catch{}return f}catch(s){throw clearTimeout(u),s instanceof y?((s.code==="TOKEN_EXPIRED"||s.code==="NOT_LOGGED_IN")&&M(),s):s instanceof Error&&s.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",s?.message||"Refresh token failed")}})();A=e;try{return await e}finally{A===e&&(A=null);}}var b=class{constructor(){this.config=null;}configure(e){this.config=e;}async refreshToken(){return await B(this.config||void 0)}async getGames(e){let t=E();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=E(),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],d)=>({id:`category_${d}`,name:r,count:i}))}async getGameById(e){return G(e)}async getCategoryNames(){return K()}async loginOnly(e){let t=V(e);return await z("/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 z("/platform/user",{method:"GET"},this.config??void 0,true)}async getUser(){return g.getJSON(c.USER)}async validateToken(e){return !!e}},_=null;function P(){return _||(_=new b),_}var X="https://api.playsout.com",q="zh",S=class o{constructor(){this.config=null;this._isInitialized=false;this._user=null;this._token=null;this._locale=q;this._widget=null;}clearAuthState(){let e=!!(this._token||g.get(c.TOKEN_DATA)||g.get(c.USER));return this._user=null,this._token=null,g.remove(c.TOKEN_DATA),g.remove(c.USER),e}handleAuthExpired(){this.clearAuthState()&&chunkZ2CIDSTP_cjs.b.emit("authExpired"),this.config?.debug&&console.warn("[PlaysoutSDK] Auth expired, logged out");}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||X,debug:e.debug||false,storage:e.storage||"localStorage",locale:e.locale||q,appId:e.appId||""},g.configure(this.config.storage),j(i=>{this._token=i.accessToken;}),F(()=>{this.handleAuthExpired();});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)if(!t.refreshToken||t.refreshExpiresAt<=r)this.handleAuthExpired();else if(t.accessToken&&t.expiresAt>r)this._token=t.accessToken;else try{let i=P();i.configure(this.config),await i.refreshToken();}catch(i){if(!(i instanceof y&&(i.code==="TOKEN_EXPIRED"||i.code==="NOT_LOGGED_IN")))throw i}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");}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=P();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(u){if(u instanceof y&&(u.code==="TOKEN_EXPIRED"||u.code==="NOT_LOGGED_IN"||u.code==="INVALID_TOKEN"))throw u;this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo failed, login still success:",u);}let d=g.getJSON(c.TOKEN_DATA);return this._token=d?.accessToken||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=P();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.clearAuthState(),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=E();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=E(),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],d)=>({id:`category_${d}`,name:r,count:i}))}async getGameById(e){return this.ensureInitialized(),E().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),t?.detailMode&&i.setAttribute("detail-mode",t.detailMode),this._widget=i,t?.onGameClick&&i.addEventListener("game-click",d=>{let u=d;t.onGameClick(u.detail);}),t?.onLoginRequired&&i.addEventListener("login-required",t.onLoginRequired),t?.onLocaleChange&&i.addEventListener("locale-change",d=>{let u=d;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=S.getInstance(),fe=a;typeof window<"u"&&(window.__playsout_sdk_instance=a);var Ee=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:S});
|
|
2
|
+
exports.a=k;exports.b=y;exports.c=g;exports.d=c;exports.e=S;exports.f=a;exports.g=fe;exports.h=Ee;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c as c$1,b as b$1}from'./chunk-EZLO3WY6.js';var k=(p=>(p.NOT_INITIALIZED="NOT_INITIALIZED",p.ALREADY_INITIALIZED="ALREADY_INITIALIZED",p.NOT_LOGGED_IN="NOT_LOGGED_IN",p.TOKEN_EXPIRED="TOKEN_EXPIRED",p.INVALID_TOKEN="INVALID_TOKEN",p.NETWORK_ERROR="NETWORK_ERROR",p.TIMEOUT="TIMEOUT",p.SERVER_ERROR="SERVER_ERROR",p.API_ERROR="API_ERROR",p.INVALID_PARAMS="INVALID_PARAMS",p.MISSING_PARAMS="MISSING_PARAMS",p.FEATURE_NOT_SUPPORTED="FEATURE_NOT_SUPPORTED",p.UNKNOWN="UNKNOWN",p.PAYMENT_FAILED="PAYMENT_FAILED",p.SHARE_FAILED="SHARE_FAILED",p))(k||{}),y=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}}},W={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 y(o,W[o],e)}var w="playsout_",R=class{constructor(e){this.storage=e;}get(e){try{return this.storage.getItem(w+e)}catch{return null}}set(e,t){try{this.storage.setItem(w+e,t);}catch(r){console.warn("[PlaysoutSDK] Storage set failed:",r);}}remove(e){try{this.storage.removeItem(w+e);}catch{}}clear(){try{let e=[];for(let t=0;t<this.storage.length;t++){let r=this.storage.key(t);r&&r.startsWith(w)&&e.push(r);}e.forEach(t=>this.storage.removeItem(t));}catch{}}},N=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 N:o==="sessionStorage"?new R(sessionStorage):new R(localStorage)}var I=v(),g={get:o=>I.get(o),set:(o,e)=>{I.set(o,e);},remove:o=>{I.remove(o);},clear:()=>{I.clear();},getJSON:o=>{let e=I.get(o);if(!e)return null;try{return JSON.parse(e)}catch{return null}},setJSON:(o,e)=>{I.set(o,JSON.stringify(e));},configure(o){I=v(o);}},c={TOKEN_DATA:"token_data",USER:"user",LOCALE:"locale",CONFIG:"config"};var $=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=$(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),E=()=>x.filter(o=>o.enable);({Adventure:E().filter(o=>o.category==="Adventure"),Moba:E().filter(o=>o.category==="Moba")});var G=o=>x.find(e=>e.id===o);var K=()=>Array.from(new Set(E().map(o=>o.category)));var U="https://api.playsout.com",C=3e4;function V(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");if(typeof t.username!="string"||!t.username.trim())throw l("MISSING_PARAMS","username is required for Grab/Eros login");return {platform:e,platformUserId:t.platformUserId,platformToken:t.platformToken,username:t.username,inviteCode:typeof t.inviteCode=="string"?t.inviteCode:void 0}}throw l("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var A=null,O=null,L=null;function j(o){O=o;}function F(o){L=o;}function M(){if(L)try{L();}catch{}}async function z(o,e={},t,r=false){let i=t?.apiBaseUrl||U,d=o.startsWith("http")?o:`${i}${o}`,u=new AbortController,s=setTimeout(()=>u.abort(),C);try{let m=g.getJSON(c.TOKEN_DATA),f={"Content-Type":"application/json",...e.headers};m?.accessToken&&!f.token&&(f.token=m.accessToken);let h=await fetch(d,{...e,signal:u.signal,headers:f});if(clearTimeout(s),!h.ok){if(h.status===401&&r)return await H(o,e,t);throw l(h.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${h.status}: ${h.statusText}`)}let D=await h.json();if(D.code!==1e4){if(r)return await H(o,e,t);throw l("API_ERROR",D.msg||"API request failed")}return D.data}catch(m){throw clearTimeout(s),m instanceof y?m:m instanceof Error?m.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",m.message):l("UNKNOWN")}}async function H(o,e,t){await B(t);let r=t?.apiBaseUrl||U,i=o.startsWith("http")?o:`${r}${o}`,d=new AbortController,u=setTimeout(()=>d.abort(),C);try{let s=g.getJSON(c.TOKEN_DATA),m={"Content-Type":"application/json",...e.headers};s?.accessToken&&(m.token=s.accessToken);let f=await fetch(i,{...e,signal:d.signal,headers:m});if(clearTimeout(u),!f.ok)throw l(f.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${f.status}: ${f.statusText}`);let h=await f.json();if(h.code!==1e4)throw l("API_ERROR",h.msg||"API request failed");return h.data}catch(s){throw clearTimeout(u),s instanceof y?s:s instanceof Error&&s.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",s?.message||"Request failed")}}async function B(o){if(A)return A;let e=(async()=>{let t=g.getJSON(c.TOKEN_DATA),r=Math.floor(Date.now()/1e3);if(!t?.refreshToken||t.refreshExpiresAt<=r)throw M(),l("TOKEN_EXPIRED","Refresh token has expired");let i=o?.apiBaseUrl||U,d=new AbortController,u=setTimeout(()=>d.abort(),C);try{let s=await fetch(`${i}/platform/refreshToken`,{method:"POST",signal:d.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t.refreshToken})});if(clearTimeout(u),!s.ok)throw s.status>=500?l("SERVER_ERROR",`HTTP ${s.status}: ${s.statusText}`):l("TOKEN_EXPIRED",`HTTP ${s.status}: ${s.statusText}`);let m=await s.json();if(m.code!==1e4||!m.data)throw l("TOKEN_EXPIRED",m.msg||"Failed to refresh token");let f=m.data;if(g.setJSON(c.TOKEN_DATA,f),O)try{O(f);}catch{}return f}catch(s){throw clearTimeout(u),s instanceof y?((s.code==="TOKEN_EXPIRED"||s.code==="NOT_LOGGED_IN")&&M(),s):s instanceof Error&&s.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",s?.message||"Refresh token failed")}})();A=e;try{return await e}finally{A===e&&(A=null);}}var b=class{constructor(){this.config=null;}configure(e){this.config=e;}async refreshToken(){return await B(this.config||void 0)}async getGames(e){let t=E();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=E(),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],d)=>({id:`category_${d}`,name:r,count:i}))}async getGameById(e){return G(e)}async getCategoryNames(){return K()}async loginOnly(e){let t=V(e);return await z("/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 z("/platform/user",{method:"GET"},this.config??void 0,true)}async getUser(){return g.getJSON(c.USER)}async validateToken(e){return !!e}},_=null;function P(){return _||(_=new b),_}var X="https://api.playsout.com",q="zh",S=class o{constructor(){this.config=null;this._isInitialized=false;this._user=null;this._token=null;this._locale=q;this._widget=null;}clearAuthState(){let e=!!(this._token||g.get(c.TOKEN_DATA)||g.get(c.USER));return this._user=null,this._token=null,g.remove(c.TOKEN_DATA),g.remove(c.USER),e}handleAuthExpired(){this.clearAuthState()&&b$1.emit("authExpired"),this.config?.debug&&console.warn("[PlaysoutSDK] Auth expired, logged out");}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||X,debug:e.debug||false,storage:e.storage||"localStorage",locale:e.locale||q,appId:e.appId||""},g.configure(this.config.storage),j(i=>{this._token=i.accessToken;}),F(()=>{this.handleAuthExpired();});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)if(!t.refreshToken||t.refreshExpiresAt<=r)this.handleAuthExpired();else if(t.accessToken&&t.expiresAt>r)this._token=t.accessToken;else try{let i=P();i.configure(this.config),await i.refreshToken();}catch(i){if(!(i instanceof y&&(i.code==="TOKEN_EXPIRED"||i.code==="NOT_LOGGED_IN")))throw i}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");}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=P();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(u){if(u instanceof y&&(u.code==="TOKEN_EXPIRED"||u.code==="NOT_LOGGED_IN"||u.code==="INVALID_TOKEN"))throw u;this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo failed, login still success:",u);}let d=g.getJSON(c.TOKEN_DATA);return this._token=d?.accessToken||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=P();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.clearAuthState(),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=E();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=E(),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],d)=>({id:`category_${d}`,name:r,count:i}))}async getGameById(e){return this.ensureInitialized(),E().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),t?.detailMode&&i.setAttribute("detail-mode",t.detailMode),this._widget=i,t?.onGameClick&&i.addEventListener("game-click",d=>{let u=d;t.onGameClick(u.detail);}),t?.onLoginRequired&&i.addEventListener("login-required",t.onLoginRequired),t?.onLocaleChange&&i.addEventListener("locale-change",d=>{let u=d;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=S.getInstance(),fe=a;typeof window<"u"&&(window.__playsout_sdk_instance=a);var Ee=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:S});
|
|
2
|
+
export{k as a,y as b,g as c,c as d,S as e,a as f,fe as g,Ee as h};
|
package/core/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/core/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/B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAIrD;AAKD,wBAAgB,SAAS,IAAI,MAAM,CAKlC"}
|
package/core/index.d.ts
CHANGED
package/core/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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;IAEP,OAAO,CAAC,cAAc;IActB,OAAO,CAAC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,IAAI,GAAG,IAAI;IAO3D,OAAO,CAAC,iBAAiB;CAK1B;AAMD,eAAO,MAAM,GAAG,aAA4B,CAAC;AAG7C,eAAe,GAAG,CAAC"}
|
package/core/types.d.ts
CHANGED
package/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAG3C,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAGpF,MAAM,WAAW,SAAS;IAExB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAGvE,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAElC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1B,cAAc,EAAE,MAAM,CAAC;IAEvB,aAAa,EAAE,MAAM,CAAC;IAEtB,QAAQ,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAG3C,MAAM,MAAM,eAAe,G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C;IACpB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;CAC1B"}
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunk5IONEDIP_cjs=require('./chunk-5IONEDIP.cjs'),chunkZ2CIDSTP_cjs=require('./chunk-Z2CIDSTP.cjs');Object.defineProperty(exports,"ErrorCode",{enumerable:true,get:function(){return chunk5IONEDIP_cjs.a}});Object.defineProperty(exports,"Playsout",{enumerable:true,get:function(){return chunk5IONEDIP_cjs.h}});Object.defineProperty(exports,"PlaysoutSDK",{enumerable:true,get:function(){return chunk5IONEDIP_cjs.e}});Object.defineProperty(exports,"SDKError",{enumerable:true,get:function(){return chunk5IONEDIP_cjs.b}});Object.defineProperty(exports,"STORAGE_KEYS",{enumerable:true,get:function(){return chunk5IONEDIP_cjs.d}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunk5IONEDIP_cjs.g}});Object.defineProperty(exports,"sdk",{enumerable:true,get:function(){return chunk5IONEDIP_cjs.f}});Object.defineProperty(exports,"storage",{enumerable:true,get:function(){return chunk5IONEDIP_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}});
|