playsout-web-sdk 1.0.62 → 1.0.63

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 (102) hide show
  1. package/README.md +206 -366
  2. package/dist/arrow-DVB3ZH4I.png +0 -0
  3. package/dist/bofang-7CYHXAOR.png +0 -0
  4. package/dist/chunk-DXJDUM6W.js +2 -0
  5. package/dist/chunk-FQSZP2MS.cjs +2 -0
  6. package/dist/chunk-GZLJ3BX5.js +1929 -0
  7. package/dist/chunk-RBKA52ZP.cjs +1929 -0
  8. package/dist/chunk-VZ5ZVHY4.js +2 -0
  9. package/dist/chunk-ZWHQXIXN.cjs +2 -0
  10. package/dist/clock-UCOJBATJ.png +0 -0
  11. package/dist/comment-CYSCAN7M.png +0 -0
  12. package/dist/config.d.ts +2 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/{core → dist/core}/api.d.ts +1 -5
  15. package/dist/core/api.d.ts.map +1 -0
  16. package/{core → dist/core}/errors.d.ts +1 -4
  17. package/dist/core/errors.d.ts.map +1 -0
  18. package/{core → dist/core}/events.d.ts +1 -9
  19. package/{core → dist/core}/events.d.ts.map +1 -1
  20. package/{core → dist/core}/index.d.ts.map +1 -1
  21. package/{core → dist/core}/storage.d.ts +0 -1
  22. package/{core → dist/core}/storage.d.ts.map +1 -1
  23. package/{core → dist/core}/types.d.ts +2 -37
  24. package/dist/core/types.d.ts.map +1 -0
  25. package/dist/data/games.d.ts +3 -0
  26. package/dist/data/games.d.ts.map +1 -0
  27. package/dist/fenxiang-SHOVHZII.png +0 -0
  28. package/dist/index.cjs +1 -0
  29. package/{index.d.ts → dist/index.d.ts} +1 -1
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.global.js +1929 -0
  32. package/dist/index.iife.js +1929 -0
  33. package/{index.js → dist/index.js} +1 -1
  34. package/dist/like-UTHO5POC.png +0 -0
  35. package/dist/live-like-4WE6H52V.png +0 -0
  36. package/dist/next-T6TSGXOI.png +0 -0
  37. package/dist/react/PlaysoutVideoWidget.d.ts +16 -0
  38. package/dist/react/PlaysoutVideoWidget.d.ts.map +1 -0
  39. package/dist/react/index.cjs +1 -0
  40. package/{react → dist/react}/index.d.ts +2 -0
  41. package/dist/react/index.d.ts.map +1 -0
  42. package/dist/react/index.js +1 -0
  43. package/dist/share-2WNZMMZ6.png +0 -0
  44. package/dist/shoucang-CSI3UBYK.png +0 -0
  45. package/dist/shuqian-KOBOMTMJ.png +0 -0
  46. package/dist/shuqian1-VMWYGXP3.png +0 -0
  47. package/dist/vue/PlaysoutVideoWidget.d.ts +31 -0
  48. package/dist/vue/PlaysoutVideoWidget.d.ts.map +1 -0
  49. package/{vue → dist/vue}/composable.d.ts +4 -2
  50. package/{vue → dist/vue}/composable.d.ts.map +1 -1
  51. package/dist/vue/index.cjs +1 -0
  52. package/{vue → dist/vue}/index.d.ts +1 -0
  53. package/dist/vue/index.d.ts.map +1 -0
  54. package/dist/vue/index.js +1 -0
  55. package/dist/web-components/PlaysoutVideoWidget.d.ts +59 -0
  56. package/dist/web-components/PlaysoutVideoWidget.d.ts.map +1 -0
  57. package/{web-components → dist/web-components}/PlaysoutWidget.d.ts +6 -3
  58. package/dist/web-components/PlaysoutWidget.d.ts.map +1 -0
  59. package/dist/web-components/index.cjs +1 -0
  60. package/dist/web-components/index.d.ts +5 -0
  61. package/dist/web-components/index.d.ts.map +1 -0
  62. package/dist/web-components/index.js +1 -0
  63. package/package.json +77 -63
  64. package/chunk-EZLO3WY6.js +0 -2
  65. package/chunk-MDSUYVLI.cjs +0 -2
  66. package/chunk-Z2CIDSTP.cjs +0 -2
  67. package/chunk-Z5PDR5PA.js +0 -2
  68. package/core/api.d.ts.map +0 -1
  69. package/core/errors.d.ts.map +0 -1
  70. package/core/types.d.ts.map +0 -1
  71. package/data/games.d.ts +0 -30
  72. package/data/games.d.ts.map +0 -1
  73. package/index.cjs +0 -1
  74. package/index.d.ts.map +0 -1
  75. package/index.global.js +0 -1546
  76. package/index.iife.js +0 -1546
  77. package/react/index.cjs +0 -1
  78. package/react/index.d.ts.map +0 -1
  79. package/react/index.js +0 -1
  80. package/vue/index.cjs +0 -1
  81. package/vue/index.d.ts.map +0 -1
  82. package/vue/index.js +0 -1
  83. package/web-components/PlaysoutWidget.d.ts.map +0 -1
  84. package/web-components/imageCache.d.ts +0 -13
  85. package/web-components/imageCache.d.ts.map +0 -1
  86. package/web-components/index.cjs +0 -1546
  87. package/web-components/index.d.ts +0 -3
  88. package/web-components/index.d.ts.map +0 -1
  89. package/web-components/index.js +0 -1546
  90. /package/{core → dist/core}/index.d.ts +0 -0
  91. /package/{iife-entry.d.ts → dist/iife-entry.d.ts} +0 -0
  92. /package/{iife-entry.d.ts.map → dist/iife-entry.d.ts.map} +0 -0
  93. /package/{public-api.d.ts → dist/public-api.d.ts} +0 -0
  94. /package/{public-api.d.ts.map → dist/public-api.d.ts.map} +0 -0
  95. /package/{react → dist/react}/context.d.ts +0 -0
  96. /package/{react → dist/react}/context.d.ts.map +0 -0
  97. /package/{vue → dist/vue}/plugin.d.ts +0 -0
  98. /package/{vue → dist/vue}/plugin.d.ts.map +0 -0
  99. /package/{web-components → dist/web-components}/PrivyBridge.d.ts +0 -0
  100. /package/{web-components → dist/web-components}/PrivyBridge.d.ts.map +0 -0
  101. /package/{web-components → dist/web-components}/assetUrl.d.ts +0 -0
  102. /package/{web-components → dist/web-components}/assetUrl.d.ts.map +0 -0
@@ -1 +1 @@
1
- export{a as ErrorCode,h as Playsout,e as PlaysoutSDK,b as SDKError,d as STORAGE_KEYS,g as default,f as sdk,c as storage}from'./chunk-Z5PDR5PA.js';export{a as SDKEvent,b as eventEmitter}from'./chunk-EZLO3WY6.js';
1
+ export{a as ErrorCode,h as Playsout,e as PlaysoutSDK,b as SDKError,d as STORAGE_KEYS,g as default,f as sdk,c as storage}from'./chunk-VZ5ZVHY4.js';export{a as SDKEvent,b as eventEmitter}from'./chunk-DXJDUM6W.js';
Binary file
Binary file
Binary file
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import '../web-components';
3
+ import type { SupportedLocale } from '../core/types';
4
+ import type { VideoWidgetErrorDetail, VideoWidgetEventDetail } from '../web-components/PlaysoutVideoWidget';
5
+ export interface PlaysoutVideoWidgetProps {
6
+ locale?: SupportedLocale;
7
+ adApiKey?: string;
8
+ className?: string;
9
+ style?: React.CSSProperties;
10
+ onVideoPlay?: (event: CustomEvent<VideoWidgetEventDetail>) => void;
11
+ onVideoClose?: (event: CustomEvent<VideoWidgetEventDetail>) => void;
12
+ onVideoError?: (event: CustomEvent<VideoWidgetErrorDetail>) => void;
13
+ onAdComplete?: (event: CustomEvent<VideoWidgetEventDetail>) => void;
14
+ }
15
+ export declare const PlaysoutVideoWidget: React.ForwardRefExoticComponent<PlaysoutVideoWidgetProps & React.RefAttributes<HTMLElement>>;
16
+ //# sourceMappingURL=PlaysoutVideoWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaysoutVideoWidget.d.ts","sourceRoot":"","sources":["../../src/react/PlaysoutVideoWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAClF,OAAO,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE5G,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;IACnE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;IACpE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;IACpE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;CACrE;AAED,eAAO,MAAM,mBAAmB,8FAuC9B,CAAC"}
@@ -0,0 +1 @@
1
+ 'use strict';var chunkFQSZP2MS_cjs=require('../chunk-FQSZP2MS.cjs');require('../chunk-RBKA52ZP.cjs'),require('../chunk-ZWHQXIXN.cjs');var Q=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Q__default=/*#__PURE__*/_interopDefault(Q);var S=Q.createContext(null);function F({children:c,config:r,locale:g}){let[i,E]=Q.useState(false),[y,m]=Q.useState(false),[p,s]=Q.useState(null),[C,l]=Q.useState(null),[a,G]=Q.useState(g||"zh"),[d,L]=Q.useState([]),[W,w]=Q.useState([]),[k,n]=Q.useState(false),[R,x]=Q.useState(null),V=Q.useCallback(async t=>{try{n(!0),x(null),await chunkFQSZP2MS_cjs.f.init(t),E(!0),m(chunkFQSZP2MS_cjs.f.isLoggedIn),s(chunkFQSZP2MS_cjs.f.user),l(chunkFQSZP2MS_cjs.f.token),G(chunkFQSZP2MS_cjs.f.locale);let[o,v]=await Promise.all([chunkFQSZP2MS_cjs.f.getGames(),chunkFQSZP2MS_cjs.f.getCategories()]);L(o),w(v);}catch(o){x(o instanceof Error?o:new Error("Initialization failed")),console.error("[PlaysoutProvider] Init error:",o);}finally{n(false);}},[]),D=Q.useCallback(async t=>{try{n(!0),x(null);let o=await chunkFQSZP2MS_cjs.h.Login(t);return m(chunkFQSZP2MS_cjs.f.isLoggedIn),s(chunkFQSZP2MS_cjs.f.user),l(chunkFQSZP2MS_cjs.f.token),o}catch(o){let v=o instanceof Error?o:new Error("Login failed");throw x(v),v}finally{n(false);}},[]),U=Q.useCallback(()=>{chunkFQSZP2MS_cjs.f.logout(),m(false),s(null),l(null);},[]),T=Q.useCallback(t=>{chunkFQSZP2MS_cjs.h.setLocale(t),G(t);},[]),z=Q.useCallback(async t=>{try{return n(!0),await chunkFQSZP2MS_cjs.f.getGames(t)}finally{n(false);}},[]),A=Q.useCallback(async()=>{try{return n(!0),await chunkFQSZP2MS_cjs.f.getCategories()}finally{n(false);}},[]),H=Q.useCallback(async()=>{try{n(!0);let[t,o]=await Promise.all([chunkFQSZP2MS_cjs.f.getGames(),chunkFQSZP2MS_cjs.f.getCategories()]);L(t),w(o);}catch(t){x(t instanceof Error?t:new Error("Refresh failed"));}finally{n(false);}},[]),K=Q.useCallback(async()=>{try{n(!0);let t=await chunkFQSZP2MS_cjs.f.getUserInfo();return s(chunkFQSZP2MS_cjs.f.user),t}finally{n(false);}},[]);Q.useEffect(()=>{r&&!i&&V(r);},[r,i,V]),Q.useEffect(()=>{if(!i)return;let t=()=>{m(chunkFQSZP2MS_cjs.f.isLoggedIn),s(chunkFQSZP2MS_cjs.f.user),l(chunkFQSZP2MS_cjs.f.token);},o=[chunkFQSZP2MS_cjs.h.on("login",t),chunkFQSZP2MS_cjs.h.on("logout",t),chunkFQSZP2MS_cjs.h.on("authExpired",t)];return ()=>{o.forEach(v=>v());}},[i]);let M={isInitialized:i,isLoggedIn:y,user:p,token:C,locale:a,games:d,categories:W,isLoading:k,error:R,init:V,Login:D,logout:U,setLocale:T,getGames:z,getCategories:A,refreshGames:H,getUserInfo:K};return jsxRuntime.jsx(S.Provider,{value:M,children:c})}function h(){let c=Q.useContext(S);if(!c)throw new Error("usePlaysout must be used within PlaysoutProvider");return c}function q(c){let{games:r,getGames:g,isLoading:i,error:E}=h(),[y,m]=Q.useState(r),[p,s]=Q.useState(i);Q.useEffect(()=>{m(r);},[r]),Q.useEffect(()=>{s(i);},[i]);let C=Q.useCallback(async l=>{s(true);try{let a=await g(l||c);m(a);}finally{s(false);}},[g,c]);return {games:y,isLoading:p,error:E,refresh:C}}function J(){let{categories:c,getCategories:r,isLoading:g}=h();return {categories:c,isLoading:g,refresh:r}}var _=Q.forwardRef(function({locale:r="en",adApiKey:g,className:i,style:E,onVideoPlay:y,onVideoClose:m,onVideoError:p,onAdComplete:s},C){let l=Q.useRef(null);return Q.useImperativeHandle(C,()=>l.current),Q.useEffect(()=>{let a=l.current;a&&(a.setAttribute("locale",r),g?a.setAttribute("ad-api-key",g):a.removeAttribute("ad-api-key"));},[r,g]),Q.useEffect(()=>{let a=l.current;if(!a)return;let G=[["video-play",y],["video-close",m],["video-error",p],["ad-complete",s]].filter(d=>!!d[1]);return G.forEach(([d,L])=>a.addEventListener(d,L)),()=>G.forEach(([d,L])=>a.removeEventListener(d,L))},[y,m,p,s]),Q__default.default.createElement("playsout-video-widget",{ref:l,className:i,style:E})});Object.defineProperty(exports,"Playsout",{enumerable:true,get:function(){return chunkFQSZP2MS_cjs.h}});exports.PlaysoutProvider=F;exports.PlaysoutVideoWidget=_;exports.useCategories=J;exports.useGames=q;exports.usePlaysout=h;
@@ -1,4 +1,6 @@
1
1
  export { PlaysoutProvider, usePlaysout, useGames, useCategories } from './context';
2
+ export { PlaysoutVideoWidget } from './PlaysoutVideoWidget';
3
+ export type { PlaysoutVideoWidgetProps } from './PlaysoutVideoWidget';
2
4
  export { Playsout } from '../public-api';
3
5
  export type { PlaysoutPublicAPI } from '../public-api';
4
6
  export type { PlaysoutContextValue, PlaysoutProviderProps, } from './context';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,YAAY,EACV,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ import {f,h as h$1}from'../chunk-VZ5ZVHY4.js';export{h as Playsout}from'../chunk-VZ5ZVHY4.js';import'../chunk-GZLJ3BX5.js';import'../chunk-DXJDUM6W.js';import Q,{createContext,forwardRef,useRef,useImperativeHandle,useEffect,useState,useCallback,useContext}from'react';import {jsx}from'react/jsx-runtime';var S=createContext(null);function F({children:c,config:r,locale:g}){let[i,E]=useState(false),[y,m]=useState(false),[p,s]=useState(null),[C,l]=useState(null),[a,G]=useState(g||"zh"),[d,L]=useState([]),[W,w]=useState([]),[k,n]=useState(false),[R,x]=useState(null),V=useCallback(async t=>{try{n(!0),x(null),await f.init(t),E(!0),m(f.isLoggedIn),s(f.user),l(f.token),G(f.locale);let[o,v]=await Promise.all([f.getGames(),f.getCategories()]);L(o),w(v);}catch(o){x(o instanceof Error?o:new Error("Initialization failed")),console.error("[PlaysoutProvider] Init error:",o);}finally{n(false);}},[]),D=useCallback(async t=>{try{n(!0),x(null);let o=await h$1.Login(t);return m(f.isLoggedIn),s(f.user),l(f.token),o}catch(o){let v=o instanceof Error?o:new Error("Login failed");throw x(v),v}finally{n(false);}},[]),U=useCallback(()=>{f.logout(),m(false),s(null),l(null);},[]),T=useCallback(t=>{h$1.setLocale(t),G(t);},[]),z=useCallback(async t=>{try{return n(!0),await f.getGames(t)}finally{n(false);}},[]),A=useCallback(async()=>{try{return n(!0),await f.getCategories()}finally{n(false);}},[]),H=useCallback(async()=>{try{n(!0);let[t,o]=await Promise.all([f.getGames(),f.getCategories()]);L(t),w(o);}catch(t){x(t instanceof Error?t:new Error("Refresh failed"));}finally{n(false);}},[]),K=useCallback(async()=>{try{n(!0);let t=await f.getUserInfo();return s(f.user),t}finally{n(false);}},[]);useEffect(()=>{r&&!i&&V(r);},[r,i,V]),useEffect(()=>{if(!i)return;let t=()=>{m(f.isLoggedIn),s(f.user),l(f.token);},o=[h$1.on("login",t),h$1.on("logout",t),h$1.on("authExpired",t)];return ()=>{o.forEach(v=>v());}},[i]);let M={isInitialized:i,isLoggedIn:y,user:p,token:C,locale:a,games:d,categories:W,isLoading:k,error:R,init:V,Login:D,logout:U,setLocale:T,getGames:z,getCategories:A,refreshGames:H,getUserInfo:K};return jsx(S.Provider,{value:M,children:c})}function h(){let c=useContext(S);if(!c)throw new Error("usePlaysout must be used within PlaysoutProvider");return c}function q(c){let{games:r,getGames:g,isLoading:i,error:E}=h(),[y,m]=useState(r),[p,s]=useState(i);useEffect(()=>{m(r);},[r]),useEffect(()=>{s(i);},[i]);let C=useCallback(async l=>{s(true);try{let a=await g(l||c);m(a);}finally{s(false);}},[g,c]);return {games:y,isLoading:p,error:E,refresh:C}}function J(){let{categories:c,getCategories:r,isLoading:g}=h();return {categories:c,isLoading:g,refresh:r}}var _=forwardRef(function({locale:r="en",adApiKey:g,className:i,style:E,onVideoPlay:y,onVideoClose:m,onVideoError:p,onAdComplete:s},C){let l=useRef(null);return useImperativeHandle(C,()=>l.current),useEffect(()=>{let a=l.current;a&&(a.setAttribute("locale",r),g?a.setAttribute("ad-api-key",g):a.removeAttribute("ad-api-key"));},[r,g]),useEffect(()=>{let a=l.current;if(!a)return;let G=[["video-play",y],["video-close",m],["video-error",p],["ad-complete",s]].filter(d=>!!d[1]);return G.forEach(([d,L])=>a.addEventListener(d,L)),()=>G.forEach(([d,L])=>a.removeEventListener(d,L))},[y,m,p,s]),Q.createElement("playsout-video-widget",{ref:l,className:i,style:E})});export{F as PlaysoutProvider,_ as PlaysoutVideoWidget,J as useCategories,q as useGames,h as usePlaysout};
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,31 @@
1
+ import '../web-components';
2
+ export declare const PlaysoutVideoWidget: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ locale: {
4
+ type: StringConstructor;
5
+ default: string;
6
+ };
7
+ adApiKey: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ };
11
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
12
+ [key: string]: any;
13
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("video-error" | "ad-complete" | "video-close" | "video-play")[], "video-error" | "ad-complete" | "video-close" | "video-play", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
+ locale: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ adApiKey: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ }>> & Readonly<{
23
+ "onVideo-error"?: ((...args: any[]) => any) | undefined;
24
+ "onAd-complete"?: ((...args: any[]) => any) | undefined;
25
+ "onVideo-close"?: ((...args: any[]) => any) | undefined;
26
+ "onVideo-play"?: ((...args: any[]) => any) | undefined;
27
+ }>, {
28
+ locale: string;
29
+ adApiKey: string;
30
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
31
+ //# sourceMappingURL=PlaysoutVideoWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaysoutVideoWidget.d.ts","sourceRoot":"","sources":["../../src/vue/PlaysoutVideoWidget.ts"],"names":[],"mappings":"AACA,OAAO,mBAAmB,CAAC;AAG3B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAmC9B,CAAC"}
@@ -44,7 +44,8 @@ export declare function createPlaysout(): {
44
44
  isNew?: boolean | undefined;
45
45
  isHot?: boolean | undefined;
46
46
  isBanner?: boolean | undefined;
47
- enable: boolean;
47
+ enable?: boolean | undefined;
48
+ isEnabled?: boolean | undefined;
48
49
  externalUrl?: string | undefined;
49
50
  orientation?: "portrait" | "landscape" | undefined;
50
51
  apiGameId?: number | undefined;
@@ -57,7 +58,8 @@ export declare function createPlaysout(): {
57
58
  isNew?: boolean | undefined;
58
59
  isHot?: boolean | undefined;
59
60
  isBanner?: boolean | undefined;
60
- enable: boolean;
61
+ enable?: boolean | undefined;
62
+ isEnabled?: boolean | undefined;
61
63
  externalUrl?: string | undefined;
62
64
  orientation?: "portrait" | "landscape" | undefined;
63
65
  apiGameId?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"composable.d.ts","sourceRoot":"","sources":["../../src/vue/composable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAyB,KAAK,YAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAGzE,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,YAAY,EAA4B,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAGtF,MAAM,WAAW,kBAAkB;IAEjC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5B,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACzB,IAAI,EAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1B,MAAM,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACnB,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5B,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACxB,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAGzB,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,KAAK,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACvD,aAAa,EAAE,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACzC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAKD,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAiBA,SAAS;oBAqCR,mBAAmB,KAAG,OAAO,CAAC,mBAAmB,CAAC;;2BAuBjD,eAAe;wBAMZ,cAAc,KAAG,OAAO,CAAC,IAAI,EAAE,CAAC;yBAUjC,OAAO,CAAC,QAAQ,EAAE,CAAC;;EA+CpD;AAMD,wBAAgB,WAAW,IAAI,kBAAkB,CAQhD"}
1
+ {"version":3,"file":"composable.d.ts","sourceRoot":"","sources":["../../src/vue/composable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAyB,KAAK,YAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAGzE,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,YAAY,EAA4B,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAGtF,MAAM,WAAW,kBAAkB;IAEjC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5B,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACzB,IAAI,EAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1B,MAAM,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACnB,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5B,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACxB,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAGzB,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,KAAK,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACvD,aAAa,EAAE,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACzC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAKD,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAiBA,SAAS;oBAqCR,mBAAmB,KAAG,OAAO,CAAC,mBAAmB,CAAC;;2BAuBjD,eAAe;wBAMZ,cAAc,KAAG,OAAO,CAAC,IAAI,EAAE,CAAC;yBAUjC,OAAO,CAAC,QAAQ,EAAE,CAAC;;EA+CpD;AAMD,wBAAgB,WAAW,IAAI,kBAAkB,CAQhD"}
@@ -0,0 +1 @@
1
+ 'use strict';var chunkFQSZP2MS_cjs=require('../chunk-FQSZP2MS.cjs');require('../chunk-RBKA52ZP.cjs'),require('../chunk-ZWHQXIXN.cjs');var vue=require('vue');var y=Symbol("PlaysoutSDK");function d(){let o=vue.ref(false),n=vue.ref(false),u=vue.ref(null),r=vue.ref(null),f=vue.ref("zh"),g=vue.ref([]),t=vue.ref([]),e=vue.ref(false),m=vue.ref(null),P=false,C=vue.computed(()=>m.value!==null);async function b(a){try{e.value=!0,m.value=null,await chunkFQSZP2MS_cjs.f.init(a),o.value=!0,p(),G(),await v();}catch(i){m.value=i instanceof Error?i:new Error("Initialization failed"),console.error("[usePlaysout] Init error:",i);}finally{e.value=false;}}function p(){n.value=chunkFQSZP2MS_cjs.f.isLoggedIn,u.value=chunkFQSZP2MS_cjs.f.user,r.value=chunkFQSZP2MS_cjs.f.token,f.value=chunkFQSZP2MS_cjs.f.locale;}function G(){P||(P=true,chunkFQSZP2MS_cjs.h.on("login",p),chunkFQSZP2MS_cjs.h.on("logout",p),chunkFQSZP2MS_cjs.h.on("authExpired",p));}async function x(a){try{e.value=!0,m.value=null;let i=await chunkFQSZP2MS_cjs.h.Login(a);return p(),i}catch(i){let L=i instanceof Error?i:new Error("Login failed");throw m.value=L,L}finally{e.value=false;}}function S(){chunkFQSZP2MS_cjs.f.logout(),p();}function h(a){chunkFQSZP2MS_cjs.h.setLocale(a),f.value=a;}async function K(a){try{return e.value=!0,await chunkFQSZP2MS_cjs.f.getGames(a)}finally{e.value=false;}}async function R(){try{return e.value=!0,await chunkFQSZP2MS_cjs.f.getCategories()}finally{e.value=false;}}async function v(){try{e.value=!0;let[a,i]=await Promise.all([chunkFQSZP2MS_cjs.f.getGames(),chunkFQSZP2MS_cjs.f.getCategories()]);g.value=a,t.value=i;}catch(a){m.value=a instanceof Error?a:new Error("Refresh failed");}finally{e.value=false;}}return {isInitialized:o,isLoggedIn:n,user:u,token:r,locale:f,games:g,categories:t,isLoading:e,error:m,hasError:C,init:b,Login:x,logout:S,setLocale:h,getGames:K,getCategories:R,refreshGames:v}}function E(){let o=vue.inject(y);if(!o)throw new Error("usePlaysout must be used after calling createPlaysout()");return o}function D(o={}){return {install(n){let u=d();n.provide(y,u),o.config&&u.init(o.config);}}}var U=vue.defineComponent({name:"PlaysoutVideoWidget",props:{locale:{type:String,default:"en"},adApiKey:{type:String,default:""}},emits:["video-play","video-close","video-error","ad-complete"],setup(o,{emit:n,expose:u}){let r=vue.ref(null),f=[["video-play",(t=>n("video-play",t))],["video-close",(t=>n("video-close",t))],["video-error",(t=>n("video-error",t))],["ad-complete",(t=>n("ad-complete",t))]],g=()=>{r.value&&(r.value.setAttribute("locale",o.locale),o.adApiKey?r.value.setAttribute("ad-api-key",o.adApiKey):r.value.removeAttribute("ad-api-key"));};return vue.onMounted(()=>{g(),f.forEach(([t,e])=>r.value?.addEventListener(t,e));}),vue.onBeforeUnmount(()=>{f.forEach(([t,e])=>r.value?.removeEventListener(t,e));}),vue.watch(()=>[o.locale,o.adApiKey],g),u({element:r}),()=>vue.h("playsout-video-widget",{ref:r})}});Object.defineProperty(exports,"Playsout",{enumerable:true,get:function(){return chunkFQSZP2MS_cjs.h}});exports.PlaysoutVideoWidget=U;exports.createPlaysout=d;exports.createPlaysoutPlugin=D;exports.usePlaysout=E;
@@ -1,5 +1,6 @@
1
1
  export { createPlaysout, usePlaysout } from './composable';
2
2
  export { createPlaysoutPlugin } from './plugin';
3
+ export { PlaysoutVideoWidget } from './PlaysoutVideoWidget';
3
4
  export { Playsout } from '../public-api';
4
5
  export type { PlaysoutPublicAPI } from '../public-api';
5
6
  export type { PlaysoutComposable } from './composable';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,YAAY,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ import {f,h as h$1}from'../chunk-VZ5ZVHY4.js';export{h as Playsout}from'../chunk-VZ5ZVHY4.js';import'../chunk-GZLJ3BX5.js';import'../chunk-DXJDUM6W.js';import {defineComponent,ref,onMounted,onBeforeUnmount,watch,h,computed,inject}from'vue';var y=Symbol("PlaysoutSDK");function d(){let o=ref(false),n=ref(false),u=ref(null),r=ref(null),f$1=ref("zh"),g=ref([]),t=ref([]),e=ref(false),m=ref(null),P=false,C=computed(()=>m.value!==null);async function b(a){try{e.value=!0,m.value=null,await f.init(a),o.value=!0,p(),G(),await v();}catch(i){m.value=i instanceof Error?i:new Error("Initialization failed"),console.error("[usePlaysout] Init error:",i);}finally{e.value=false;}}function p(){n.value=f.isLoggedIn,u.value=f.user,r.value=f.token,f$1.value=f.locale;}function G(){P||(P=true,h$1.on("login",p),h$1.on("logout",p),h$1.on("authExpired",p));}async function x(a){try{e.value=!0,m.value=null;let i=await h$1.Login(a);return p(),i}catch(i){let L=i instanceof Error?i:new Error("Login failed");throw m.value=L,L}finally{e.value=false;}}function S(){f.logout(),p();}function h(a){h$1.setLocale(a),f$1.value=a;}async function K(a){try{return e.value=!0,await f.getGames(a)}finally{e.value=false;}}async function R(){try{return e.value=!0,await f.getCategories()}finally{e.value=false;}}async function v(){try{e.value=!0;let[a,i]=await Promise.all([f.getGames(),f.getCategories()]);g.value=a,t.value=i;}catch(a){m.value=a instanceof Error?a:new Error("Refresh failed");}finally{e.value=false;}}return {isInitialized:o,isLoggedIn:n,user:u,token:r,locale:f$1,games:g,categories:t,isLoading:e,error:m,hasError:C,init:b,Login:x,logout:S,setLocale:h,getGames:K,getCategories:R,refreshGames:v}}function E(){let o=inject(y);if(!o)throw new Error("usePlaysout must be used after calling createPlaysout()");return o}function D(o={}){return {install(n){let u=d();n.provide(y,u),o.config&&u.init(o.config);}}}var U=defineComponent({name:"PlaysoutVideoWidget",props:{locale:{type:String,default:"en"},adApiKey:{type:String,default:""}},emits:["video-play","video-close","video-error","ad-complete"],setup(o,{emit:n,expose:u}){let r=ref(null),f=[["video-play",(t=>n("video-play",t))],["video-close",(t=>n("video-close",t))],["video-error",(t=>n("video-error",t))],["ad-complete",(t=>n("ad-complete",t))]],g=()=>{r.value&&(r.value.setAttribute("locale",o.locale),o.adApiKey?r.value.setAttribute("ad-api-key",o.adApiKey):r.value.removeAttribute("ad-api-key"));};return onMounted(()=>{g(),f.forEach(([t,e])=>r.value?.addEventListener(t,e));}),onBeforeUnmount(()=>{f.forEach(([t,e])=>r.value?.removeEventListener(t,e));}),watch(()=>[o.locale,o.adApiKey],g),u({element:r}),()=>h("playsout-video-widget",{ref:r})}});export{U as PlaysoutVideoWidget,d as createPlaysout,D as createPlaysoutPlugin,E as usePlaysout};
@@ -0,0 +1,59 @@
1
+ interface ApplixirStatus {
2
+ type?: string;
3
+ }
4
+ interface ApplixirOptions {
5
+ apiKey: string;
6
+ injectionElementId: string;
7
+ adStatusCallbackFn: (status: ApplixirStatus) => void;
8
+ adErrorCallbackFn: () => void;
9
+ }
10
+ declare global {
11
+ interface Window {
12
+ initializeAndOpenPlayer?: (options: ApplixirOptions) => void;
13
+ }
14
+ }
15
+ export interface VideoWidgetEventDetail {
16
+ id: number;
17
+ title: string;
18
+ }
19
+ export interface VideoWidgetErrorDetail extends VideoWidgetEventDetail {
20
+ source: string;
21
+ }
22
+ export declare const DEFAULT_VIDEO_MEDIA_BASE_URL = "https://games.playsout.com/resources/icon/short-drama/videos";
23
+ export declare class PlaysoutVideoWidget extends HTMLElement {
24
+ static get observedAttributes(): string[];
25
+ private readonly shadow;
26
+ private currentTab;
27
+ private currentVideo;
28
+ private readonly likedVideoIds;
29
+ private readonly favoriteVideoIds;
30
+ private isCurrentVideoUnlocked;
31
+ private pendingNextVideo;
32
+ private adContainer;
33
+ constructor();
34
+ connectedCallback(): void;
35
+ disconnectedCallback(): void;
36
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
37
+ private get locale();
38
+ private get adApiKey();
39
+ private t;
40
+ private renderPage;
41
+ private renderCards;
42
+ private handleClick;
43
+ private openVideo;
44
+ private formatTime;
45
+ private toggleInteraction;
46
+ private videoUrl;
47
+ private getNextVideo;
48
+ private showUnlockModal;
49
+ private watchAd;
50
+ private ensureAdContainer;
51
+ private showAdError;
52
+ private completeAdUnlock;
53
+ private hideUnlockModal;
54
+ private closeVideo;
55
+ private cleanupPlayer;
56
+ private emit;
57
+ }
58
+ export {};
59
+ //# sourceMappingURL=PlaysoutVideoWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaysoutVideoWidget.d.ts","sourceRoot":"","sources":["../../src/web-components/PlaysoutVideoWidget.ts"],"names":[],"mappings":"AA0BA,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACrD,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,uBAAuB,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;KAC9D;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD,eAAO,MAAM,4BAA4B,iEAAmC,CAAC;AAsY7E,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,MAAM,KAAK,kBAAkB,aAE5B;IAED,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IACtD,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,gBAAgB,CAA0B;IAClD,OAAO,CAAC,WAAW,CAA+B;;IAQlD,iBAAiB;IAKjB,oBAAoB;IAOpB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQvF,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,KAAK,QAAQ,GAEnB;IAED,OAAO,CAAC,CAAC;IAUT,OAAO,CAAC,UAAU;IAiClB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,WAAW;IA4BnB,OAAO,CAAC,SAAS;IA+EjB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,eAAe;YAsBT,OAAO;IA+CrB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,IAAI;CAGb"}
@@ -1,7 +1,6 @@
1
1
  declare class PlaysoutWidget extends HTMLElement {
2
2
  private shadow;
3
3
  private bridge;
4
- private _appId;
5
4
  private _locale;
6
5
  private games;
7
6
  private filteredGames;
@@ -9,8 +8,6 @@ declare class PlaysoutWidget extends HTMLElement {
9
8
  private searchQuery;
10
9
  private bannerUrl;
11
10
  private userPoints;
12
- private avatarUrl;
13
- private recentGames;
14
11
  private _detailMode;
15
12
  private currentView;
16
13
  private currentGame;
@@ -21,6 +18,11 @@ declare class PlaysoutWidget extends HTMLElement {
21
18
  private t;
22
19
  private hasTranslation;
23
20
  private getBridgeUser;
21
+ private isGameEnabled;
22
+ private getEnabledGames;
23
+ private getVisibleCategories;
24
+ private getCategoryUi;
25
+ private renderCategoryButton;
24
26
  private setUserPoints;
25
27
  connectedCallback(): void;
26
28
  disconnectedCallback(): void;
@@ -29,6 +31,7 @@ declare class PlaysoutWidget extends HTMLElement {
29
31
  private pollForSDK;
30
32
  private doLoadGames;
31
33
  private filterGames;
34
+ private updateFilteredGames;
32
35
  private showLoading;
33
36
  private showError;
34
37
  private render;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaysoutWidget.d.ts","sourceRoot":"","sources":["../../src/web-components/PlaysoutWidget.ts"],"names":[],"mappings":"AAo3CA,cAAM,cAAe,SAAQ,WAAW;IACtC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,WAAW,CAAc;IAGjC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,UAAU,CAAgB;IAGlC,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,gBAAgB,CAAc;IACtC,OAAO,CAAC,sBAAsB,CAAwD;IAEtF,MAAM,KAAK,kBAAkB,aAE5B;;IAgBD,OAAO,CAAC,CAAC;IAUT,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,aAAa;IAmBrB,iBAAiB;IAMjB,oBAAoB;IASpB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;YAkCzE,SAAS;IA4BvB,OAAO,CAAC,UAAU;YAmBJ,WAAW;IAazB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,SAAS;IAgBjB,OAAO,CAAC,MAAM;IAqFd,OAAO,CAAC,QAAQ;IAehB,OAAO,CAAC,QAAQ,CAKd;IAEF,OAAO,CAAC,cAAc;IA6DtB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,gBAAgB;IAgExB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,gBAAgB;IAuFxB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,uBAAuB;IAuE/B,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,YAAY,CAAuB;IAE3C,OAAO,CAAC,SAAS;IAoCjB,OAAO,CAAC,WAAW;IAgEnB,OAAO,CAAC,eAAe;IAqCvB,OAAO,CAAC,cAAc;IA+BtB,OAAO,CAAC,gBAAgB;IAoDxB,OAAO,CAAC,oBAAoB;CA0C7B;AAOD,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ 'use strict';var chunkRBKA52ZP_cjs=require('../chunk-RBKA52ZP.cjs');require('../chunk-ZWHQXIXN.cjs');Object.defineProperty(exports,"PlaysoutVideoWidget",{enumerable:true,get:function(){return chunkRBKA52ZP_cjs.b}});Object.defineProperty(exports,"PlaysoutWidget",{enumerable:true,get:function(){return chunkRBKA52ZP_cjs.a}});
@@ -0,0 +1,5 @@
1
+ import { PlaysoutWidget } from './PlaysoutWidget';
2
+ import { PlaysoutVideoWidget } from './PlaysoutVideoWidget';
3
+ export { PlaysoutWidget, PlaysoutVideoWidget };
4
+ export type { VideoWidgetErrorDetail, VideoWidgetEventDetail, } from './PlaysoutVideoWidget';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC;AAC/C,YAAY,EACV,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1 @@
1
+ export{b as PlaysoutVideoWidget,a as PlaysoutWidget}from'../chunk-GZLJ3BX5.js';import'../chunk-DXJDUM6W.js';
package/package.json CHANGED
@@ -1,63 +1,77 @@
1
- {
2
- "name": "playsout-web-sdk",
3
- "version": "1.0.62",
4
- "description": "Playsout WebGame SDK for game list, authentication, and internationalization",
5
- "type": "module",
6
- "main": "index.cjs",
7
- "module": "index.js",
8
- "types": "index.d.ts",
9
- "unpkg": "index.iife.js",
10
- "exports": {
11
- ".": {
12
- "types": "./index.d.ts",
13
- "import": "./index.js",
14
- "require": "./index.cjs"
15
- },
16
- "./iife": "./index.iife.js",
17
- "./react": {
18
- "types": "./react/index.d.ts",
19
- "import": "./react/index.js",
20
- "require": "./react/index.cjs"
21
- },
22
- "./vue": {
23
- "types": "./vue/index.d.ts",
24
- "import": "./vue/index.js",
25
- "require": "./vue/index.cjs"
26
- },
27
- "./web-components": {
28
- "types": "./web-components/index.d.ts",
29
- "import": "./web-components/index.js",
30
- "require": "./web-components/index.cjs"
31
- }
32
- },
33
- "keywords": [
34
- "sdk",
35
- "webgame",
36
- "game",
37
- "playsout",
38
- "react",
39
- "vue"
40
- ],
41
- "author": "",
42
- "license": "MIT",
43
- "dependencies": {
44
- "html-to-image": "^1.11.13",
45
- "i18next": "^26.3.4",
46
- "react-i18next": "^17.0.8"
47
- },
48
- "peerDependencies": {
49
- "react": ">=18.3.0",
50
- "react-dom": ">=18.3.0"
51
- },
52
- "peerDependenciesMeta": {
53
- "react": {
54
- "optional": true
55
- },
56
- "react-dom": {
57
- "optional": true
58
- }
59
- },
60
- "publishConfig": {
61
- "access": "public"
62
- }
63
- }
1
+ {
2
+ "name": "playsout-web-sdk",
3
+ "private": false,
4
+ "version": "1.0.63",
5
+ "description": "Playsout WebGame SDK for game list, authentication, and internationalization",
6
+ "type": "module",
7
+ "main": "dist/index.cjs",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "unpkg": "dist/index.iife.js",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs"
16
+ },
17
+ "./iife": "./dist/index.iife.js",
18
+ "./react": {
19
+ "types": "./dist/react/index.d.ts",
20
+ "import": "./dist/react/index.js",
21
+ "require": "./dist/react/index.cjs"
22
+ },
23
+ "./vue": {
24
+ "types": "./dist/vue/index.d.ts",
25
+ "import": "./dist/vue/index.js",
26
+ "require": "./dist/vue/index.cjs"
27
+ },
28
+ "./web-components": {
29
+ "types": "./dist/web-components/index.d.ts",
30
+ "import": "./dist/web-components/index.js",
31
+ "require": "./dist/web-components/index.cjs"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "README.md"
37
+ ],
38
+ "scripts": {
39
+ "build:types": "tsc --emitDeclarationOnly --removeComments",
40
+ "build:sdk": "tsup && npm run build:types && node build/post-build.mjs",
41
+ "build:sdk:watch": "tsup --watch",
42
+ "build:sdk:prod": "tsup --minify && npm run build:types && node build/post-build.mjs",
43
+ "prepack": "npm run build:sdk:prod",
44
+ "lint": "echo 'lint not configured yet'"
45
+ },
46
+ "peerDependencies": {
47
+ "react": ">=18.3.0",
48
+ "react-dom": ">=18.3.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "react": {
52
+ "optional": true
53
+ },
54
+ "react-dom": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "keywords": [
59
+ "sdk",
60
+ "webgame",
61
+ "game",
62
+ "playsout",
63
+ "react",
64
+ "vue"
65
+ ],
66
+ "author": "",
67
+ "license": "MIT",
68
+ "devDependencies": {
69
+ "@types/react": "^19.2.17",
70
+ "@types/react-dom": "^19.2.3",
71
+ "react": ">=18.3.0",
72
+ "react-dom": ">=18.3.0",
73
+ "tsup": "^8.5.1",
74
+ "typescript": "~6.0.2",
75
+ "vue": "^3.5.39"
76
+ }
77
+ }
package/chunk-EZLO3WY6.js DELETED
@@ -1,2 +0,0 @@
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};
@@ -1,2 +0,0 @@
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||{}),E=class extends Error{constructor(t,r,a){super(r);this.code=t;this.details=a;this.name="SDKError";}toJSON(){return {name:this.name,code:this.code,message:this.message,details:this.details}}},$={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 n(o,e){return new E(o,$[o],e)}var P="playsout_",R=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 G(o="localStorage"){return typeof window>"u"||o==="memory"?new _:o==="sessionStorage"?new R(sessionStorage):new R(localStorage)}var S=G(),l={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=G(o);}},g={TOKEN_DATA:"token_data",USER:"user",LOGIN_PARAMS:"login_params",LOCALE:"locale",CONFIG:"config"};var V=o=>{if(!o)return o;try{let e=new URL(o);if(e.hostname==="games.playsout.com"){let t=e.pathname,r=t.endsWith("/"),a=/\.[a-z0-9]+$/i.test(t);!r&&!a&&(e.pathname=`${t}/`);}return e.toString()}catch{return o}},X=o=>o.map(e=>{if(!e.externalUrl)return e;let t=V(e.externalUrl);return t===e.externalUrl?e:{...e,externalUrl:t}}),Y=[{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/grab/BlockCrushFun/"},{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/grab/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:"SoccerDASH",title:"Soccer Dash",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/Soccer Dash.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerDASH/"},{id:"SoccerSurvivor",title:"Soccer Survivor",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/SoccerSurvivor.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerSurvivors/"},{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/grab/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/grab/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/grab/FollowThePath/"},{id:"SoccerCascade",title:"Soccer Cascade",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/Soccer Cascade.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerCascade/"},{id:"CatDelta",title:"Cat Delta",category:"Adventure",image:chunkZ2CIDSTP_cjs.c("./games/CatDelta.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CatDelta/"},{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/grab/ColorRun/"},{id:"SoccerZombies",title:"Soccer vs. Zombies",category:"Tower Defense",image:chunkZ2CIDSTP_cjs.c("./games/Soccer vs. Zombies.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerZombies/"},{id:"MiniSoccer",title:"Mini Soccer",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/minisoccer.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/minisoccer/"},{id:"SoccerMaze",title:"Soccer Maze",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/Soccer Maze.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerMaze/"},{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/grab/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/grab/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/grab/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/grab/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/grab/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/grab/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/grab/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/grab/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/grab/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/grab/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/grab/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/grab/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/grab/Falling2048/"}],K=X(Y),h=()=>K.filter(o=>o.enable);({Adventure:h().filter(o=>o.category==="Adventure"),Moba:h().filter(o=>o.category==="Moba")});var M=o=>K.find(e=>e.id===o);var z=()=>Array.from(new Set(h().map(o=>o.category)));var C="https://api.playsout.com",x=3e4;function Q(o){let e=String(o?.platform||"").toLowerCase();if(e==="tiktok"){let t=o.authorizationCode;if(typeof t!="string"||!t.trim())throw n("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 n("MISSING_PARAMS","platformUserId is required for Grab/Eros login");if(typeof t.platformToken!="string"||!t.platformToken.trim())throw n("MISSING_PARAMS","platformToken is required for Grab/Eros login");if(typeof t.username!="string"||!t.username.trim())throw n("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 n("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var I=null,L=null,v=null,O=null;function B(o){L=o;}function q(o){v=o;}function W(o){O=o;}function H(){if(O)try{O();}catch{}}async function ee(o){if(!v)throw H(),o instanceof E?o:n("TOKEN_EXPIRED",o);try{return await v()}catch(e){throw H(),e instanceof E?e:n("TOKEN_EXPIRED",e)}}async function j(o,e={},t,r=false,a=r){let u=t?.apiBaseUrl||C,p=o.startsWith("http")?o:`${u}${o}`,c=new AbortController,f=setTimeout(()=>c.abort(),x);try{let d=l.getJSON(g.TOKEN_DATA),A={"Content-Type":"application/json",...e.headers};r&&d?.accessToken&&!A.token&&(A.token=d.accessToken);let T=await fetch(p,{...e,signal:c.signal,headers:A});if(clearTimeout(f),!T.ok){if(T.status===401&&r&&a)return await F(o,e,t);throw n(T.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${T.status}: ${T.statusText}`)}let k=await T.json();if(k.code!==1e4){if(r&&a)return await F(o,e,t);throw n("API_ERROR",k.msg||"API request failed")}return k.data}catch(d){throw clearTimeout(f),d instanceof E?d:d instanceof Error?d.name==="AbortError"?n("TIMEOUT"):n("NETWORK_ERROR",d.message):n("UNKNOWN")}}async function F(o,e,t){await Z(t);let r=t?.apiBaseUrl||C,a=o.startsWith("http")?o:`${r}${o}`,u=new AbortController,p=setTimeout(()=>u.abort(),x);try{let c=l.getJSON(g.TOKEN_DATA),f={"Content-Type":"application/json",...e.headers};c?.accessToken&&(f.token=c.accessToken);let d=await fetch(a,{...e,signal:u.signal,headers:f});if(clearTimeout(p),!d.ok)throw n(d.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${d.status}: ${d.statusText}`);let A=await d.json();if(A.code!==1e4)throw n("API_ERROR",A.msg||"API request failed");return A.data}catch(c){throw clearTimeout(p),c instanceof E?c:c instanceof Error&&c.name==="AbortError"?n("TIMEOUT"):n("NETWORK_ERROR",c?.message||"Request failed")}}async function Z(o){if(I)return I;let e=(async()=>{try{let t=l.getJSON(g.TOKEN_DATA),r=Math.floor(Date.now()/1e3);if(!t?.refreshToken||t.refreshExpiresAt<=r)throw n("TOKEN_EXPIRED","Refresh token has expired");let a=o?.apiBaseUrl||C,u=new AbortController,p=setTimeout(()=>u.abort(),x);try{let c=await fetch(`${a}/platform/refreshToken`,{method:"POST",signal:u.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t.refreshToken})});if(clearTimeout(p),!c.ok)throw c.status>=500?n("SERVER_ERROR",`HTTP ${c.status}: ${c.statusText}`):n("TOKEN_EXPIRED",`HTTP ${c.status}: ${c.statusText}`);let f=await c.json();if(f.code!==1e4||!f.data)throw n("TOKEN_EXPIRED",f.msg||"Failed to refresh token");let d=f.data;if(l.setJSON(g.TOKEN_DATA,d),L)try{L(d);}catch{}return d}catch(c){throw clearTimeout(p),c instanceof E?c:c instanceof Error&&c.name==="AbortError"?n("TIMEOUT"):n("NETWORK_ERROR",c?.message||"Refresh token failed")}}catch(t){return await ee(t)}})();I=e;try{return await e}finally{I===e&&(I=null);}}var U=class{constructor(){this.config=null;}configure(e){this.config=e;}async refreshToken(){return await Z(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(a=>a.title.toLowerCase().includes(r)||a.category.toLowerCase().includes(r)||a.description&&a.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 a=t.get(r.category)||0;t.set(r.category,a+1);}),Array.from(t.entries()).map(([r,a],u)=>({id:`category_${u}`,name:r,count:a}))}async getGameById(e){return M(e)}async getCategoryNames(){return z()}async loginOnly(e){let t=Q(e);return await j("/platform/login",{method:"POST",body:JSON.stringify(t)},this.config??void 0)}async Login(e){let t=await this.loginOnly(e);l.setJSON(g.TOKEN_DATA,t);try{let r=await this.getUserInfo(!1);return {tokenData:t,user:r}}catch(r){throw l.remove(g.TOKEN_DATA),l.remove(g.USER),r}}async getUserInfo(e=true){return await j("/platform/user",{method:"GET"},this.config??void 0,true,e)}async getUser(){return l.getJSON(g.USER)}async validateToken(e){return !!e}},D=null;function b(){return D||(D=new U),D}var te="https://api.playsout.com",J="zh",w=class o{constructor(){this.config=null;this._isInitialized=false;this._user=null;this._token=null;this._locale=J;this._widget=null;}clearAuthState(){let e=!!(this._token||l.get(g.TOKEN_DATA)||l.get(g.USER));return this._user=null,this._token=null,l.remove(g.TOKEN_DATA),l.remove(g.USER),l.remove(g.LOGIN_PARAMS),e}updateUser(e){this._user={userId:String(e.id),username:e.username},l.setJSON(g.USER,this._user);}saveLoginParams(e){if(e.platform==="grab"||e.platform==="eros"){l.setJSON(g.LOGIN_PARAMS,{...e});return}l.remove(g.LOGIN_PARAMS);}async performLogin(e,t){let r=b();r.configure(this.config);let a=await r.loginOnly(e);l.setJSON(g.TOKEN_DATA,a);let u=await r.getUserInfo(false);return this._token=a.accessToken,this.updateUser(u),t&&this.saveLoginParams(e),chunkZ2CIDSTP_cjs.b.emit("login",{user:this._user,token:this._token}),{tokenData:a,user:u}}async recoverAuthentication(){let e=l.getJSON(g.LOGIN_PARAMS);if(!e||e.platform!=="grab"&&e.platform!=="eros")throw n("TOKEN_EXPIRED","No reusable login parameters available");return (await this.performLogin(e,false)).tokenData}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 n("ALREADY_INITIALIZED");this.config={apiBaseUrl:e.apiBaseUrl||te,debug:e.debug||false,storage:e.storage||"localStorage",locale:e.locale||J,appId:e.appId||""},l.configure(this.config.storage),B(a=>{this._token=a.accessToken;}),q(()=>this.recoverAuthentication()),W(()=>{this.handleAuthExpired();});let t=l.getJSON(g.TOKEN_DATA);this._user=l.getJSON(g.USER),this._locale=l.get(g.LOCALE)||this.config.locale;let r=Math.floor(Date.now()/1e3);if(t){let a=b();if(a.configure(this.config),t.accessToken&&t.expiresAt>r?this._token=t.accessToken:await a.refreshToken(),this._token&&!this._user){let u=await a.getUserInfo();this.updateUser(u);}}else this._user&&(this._user=null,l.remove(g.USER));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,l.clear(),chunkZ2CIDSTP_cjs.b.clear();}get isInitialized(){return this._isInitialized}get isLoggedIn(){return !!(this._token&&this._user)}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);try{let t=await this.performLogin(e,!0);return this.config?.debug&&console.log("[PlaysoutSDK] Login success, user:",t.user),t}catch(t){throw this.clearAuthState(),t}}async getUserInfo(){if(this.ensureInitialized(),!this.isLoggedIn)throw n("NOT_LOGGED_IN","Please login first");let e=b();e.configure(this.config);let t=await e.getUserInfo();return this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo result:",t),t&&this.updateUser(t),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 n("INVALID_PARAMS",`Unsupported locale: ${e}`);this._locale=e,l.set(g.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(a=>a.title.toLowerCase().includes(r)||a.category.toLowerCase().includes(r)||a.description&&a.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 a=t.get(r.category)||0;t.set(r.category,a+1);}),Array.from(t.entries()).map(([r,a],u)=>({id:`category_${u}`,name:r,count:a}))}async getGameById(e){return this.ensureInitialized(),h().find(t=>t.id===e)}mount(e,t){if(this.ensureInitialized(),typeof document>"u")throw n("FEATURE_NOT_SUPPORTED","mount requires DOM environment");let r=document.querySelector(e);if(!r)throw n("INVALID_PARAMS",`Container not found: ${e}`);let a=document.createElement("playsout-widget");this.config?.appId&&a.setAttribute("app-id",this.config.appId),a.setAttribute("locale",t?.locale||this._locale),t?.detailMode&&a.setAttribute("detail-mode",t.detailMode),this._widget=a,t?.onGameClick&&a.addEventListener("game-click",u=>{let p=u;t.onGameClick(p.detail);}),t?.onLoginRequired&&a.addEventListener("login-required",t.onLoginRequired),t?.onLocaleChange&&a.addEventListener("locale-change",u=>{let p=u;t.onLocaleChange(p.detail);}),r.appendChild(a),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 n("NOT_INITIALIZED")}},s=w.getInstance(),Se=s;typeof window<"u"&&(window.__playsout_sdk_instance=s);var we=Object.freeze({init:s.init.bind(s),mount:s.mount.bind(s),unmount:s.unmount.bind(s),destroy:s.destroy.bind(s),Login:s.Login.bind(s),logout:s.logout.bind(s),getToken:s.getToken.bind(s),getUserInfo:s.getUserInfo.bind(s),getUser:s.getUser.bind(s),setLocale:s.setLocale.bind(s),getLocale:s.getLocale.bind(s),getGames:s.getGames.bind(s),getCategories:s.getCategories.bind(s),on:s.on.bind(s),off:s.off.bind(s),get isInitialized(){return s.isInitialized},get isLoggedIn(){return s.isLoggedIn},instance:s,PlaysoutSDKClass:w});
2
- exports.a=N;exports.b=E;exports.c=l;exports.d=g;exports.e=w;exports.f=s;exports.g=Se;exports.h=we;
@@ -1,2 +0,0 @@
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/chunk-Z5PDR5PA.js DELETED
@@ -1,2 +0,0 @@
1
- import {c,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||{}),E=class extends Error{constructor(t,r,a){super(r);this.code=t;this.details=a;this.name="SDKError";}toJSON(){return {name:this.name,code:this.code,message:this.message,details:this.details}}},$={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 n(o,e){return new E(o,$[o],e)}var P="playsout_",R=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 G(o="localStorage"){return typeof window>"u"||o==="memory"?new _:o==="sessionStorage"?new R(sessionStorage):new R(localStorage)}var S=G(),l={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=G(o);}},g={TOKEN_DATA:"token_data",USER:"user",LOGIN_PARAMS:"login_params",LOCALE:"locale",CONFIG:"config"};var V=o=>{if(!o)return o;try{let e=new URL(o);if(e.hostname==="games.playsout.com"){let t=e.pathname,r=t.endsWith("/"),a=/\.[a-z0-9]+$/i.test(t);!r&&!a&&(e.pathname=`${t}/`);}return e.toString()}catch{return o}},X=o=>o.map(e=>{if(!e.externalUrl)return e;let t=V(e.externalUrl);return t===e.externalUrl?e:{...e,externalUrl:t}}),Y=[{id:"BlockCrushFun",title:"Block Crush Fun",category:"Puzzle",image:c("./games/BlockCrushFun.png"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/BlockCrushFun/"},{id:"KittyEscape",title:"Kitty Escape",category:"Puzzle",image:c("./games/KittyEscape.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/KittyEscape/"},{id:"ProjectGarden",title:"Project: Garden",category:"Adventure",image: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:c("./games/ProjectIDLE.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/idle/"},{id:"SoccerDASH",title:"Soccer Dash",category:"Arcade",image:c("./games/Soccer Dash.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerDASH/"},{id:"SoccerSurvivor",title:"Soccer Survivor",category:"Arcade",image:c("./games/SoccerSurvivor.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerSurvivors/"},{id:"CulinaryStarWeb",title:"Culinary Star",category:"Casual",image: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:c("./games/PickaxeQuest.jpg"),description:"Mining and adventure game",isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/PickaxeQuest/",apiGameId:73},{id:"MonsterSurvivors",title:"Monster Survivors",category:"Adventure",image: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: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:c("./games/MushroomWarriors.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/MushroomWarriors/"},{id:"FollowThePath",title:"Follow The Path",category:"Arcade",image:c("./games/FollowThePath.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/FollowThePath/"},{id:"SoccerCascade",title:"Soccer Cascade",category:"Arcade",image:c("./games/Soccer Cascade.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerCascade/"},{id:"CatDelta",title:"Cat Delta",category:"Adventure",image:c("./games/CatDelta.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CatDelta/"},{id:"ColorRun",title:"Color Run",category:"Arcade",image:c("./games/ColorRun.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ColorRun/"},{id:"SoccerZombies",title:"Soccer vs. Zombies",category:"Tower Defense",image:c("./games/Soccer vs. Zombies.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerZombies/"},{id:"MiniSoccer",title:"Mini Soccer",category:"Arcade",image:c("./games/minisoccer.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/minisoccer/"},{id:"SoccerMaze",title:"Soccer Maze",category:"Arcade",image:c("./games/Soccer Maze.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerMaze/"},{id:"StupidArrow",title:"Stupid Arrow",category:"Arcade",image:c("./games/StupidArrow.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/StupidArrow/"},{id:"ZigZag",title:"Zig Zag",category:"Arcade",image:c("./games/ZigZag.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ZigZag/"},{id:"SpikesEverywhere",title:"Spikes Everywhere",category:"Arcade",image:c("./games/SpikesEverywhere.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SpikesEverywhere/"},{id:"ArrowRacer",title:"Arrow Racer",category:"Arcade",image:c("./games/ArrowRacer.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ArrowRacer/"},{id:"CircleLeap",title:"Circle Leap",category:"Arcade",image:c("./games/CircleLeap.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CircleLeap/"},{id:"ColorMatcher",title:"Color Matcher",category:"Arcade",image:c("./games/ColorMatcher.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ColorMatcher/"},{id:"EndlessMaze",title:"Endless Maze",category:"Arcade",image: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:c("./games/SpinningAround.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SpinningAround/"},{id:"BoomBallz",title:"Boom Ballz",category:"Arcade",image: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:c("./games/CubeHead.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CubeHead/"},{id:"CapybaraLink",title:"Capybara Link",category:"Puzzle",image: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: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:c("./games/FishTankFury.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/FishTankFury/"},{id:"ConnectBalls",title:"Connect Balls",category:"Arcade",image:c("./games/ConnectBalls.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ConnectBalls/"},{id:"CircularBreaker",title:"Circular Breaker",category:"Arcade",image:c("./games/CircularBreaker.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CircularBreaker/"},{id:"OneDoor",title:"One Door",category:"Arcade",image:c("./games/OneDoor.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/OneDoor/"},{id:"CatchtheFruits",title:"Catch the Fruits",category:"Casual",image: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:c("./games/Falling2048.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/Falling2048/"}],K=X(Y),h=()=>K.filter(o=>o.enable);({Adventure:h().filter(o=>o.category==="Adventure"),Moba:h().filter(o=>o.category==="Moba")});var M=o=>K.find(e=>e.id===o);var z=()=>Array.from(new Set(h().map(o=>o.category)));var C="https://api.playsout.com",x=3e4;function Q(o){let e=String(o?.platform||"").toLowerCase();if(e==="tiktok"){let t=o.authorizationCode;if(typeof t!="string"||!t.trim())throw n("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 n("MISSING_PARAMS","platformUserId is required for Grab/Eros login");if(typeof t.platformToken!="string"||!t.platformToken.trim())throw n("MISSING_PARAMS","platformToken is required for Grab/Eros login");if(typeof t.username!="string"||!t.username.trim())throw n("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 n("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var I=null,L=null,v=null,O=null;function B(o){L=o;}function q(o){v=o;}function W(o){O=o;}function H(){if(O)try{O();}catch{}}async function ee(o){if(!v)throw H(),o instanceof E?o:n("TOKEN_EXPIRED",o);try{return await v()}catch(e){throw H(),e instanceof E?e:n("TOKEN_EXPIRED",e)}}async function j(o,e={},t,r=false,a=r){let u=t?.apiBaseUrl||C,p=o.startsWith("http")?o:`${u}${o}`,c=new AbortController,f=setTimeout(()=>c.abort(),x);try{let d=l.getJSON(g.TOKEN_DATA),A={"Content-Type":"application/json",...e.headers};r&&d?.accessToken&&!A.token&&(A.token=d.accessToken);let T=await fetch(p,{...e,signal:c.signal,headers:A});if(clearTimeout(f),!T.ok){if(T.status===401&&r&&a)return await F(o,e,t);throw n(T.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${T.status}: ${T.statusText}`)}let k=await T.json();if(k.code!==1e4){if(r&&a)return await F(o,e,t);throw n("API_ERROR",k.msg||"API request failed")}return k.data}catch(d){throw clearTimeout(f),d instanceof E?d:d instanceof Error?d.name==="AbortError"?n("TIMEOUT"):n("NETWORK_ERROR",d.message):n("UNKNOWN")}}async function F(o,e,t){await Z(t);let r=t?.apiBaseUrl||C,a=o.startsWith("http")?o:`${r}${o}`,u=new AbortController,p=setTimeout(()=>u.abort(),x);try{let c=l.getJSON(g.TOKEN_DATA),f={"Content-Type":"application/json",...e.headers};c?.accessToken&&(f.token=c.accessToken);let d=await fetch(a,{...e,signal:u.signal,headers:f});if(clearTimeout(p),!d.ok)throw n(d.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${d.status}: ${d.statusText}`);let A=await d.json();if(A.code!==1e4)throw n("API_ERROR",A.msg||"API request failed");return A.data}catch(c){throw clearTimeout(p),c instanceof E?c:c instanceof Error&&c.name==="AbortError"?n("TIMEOUT"):n("NETWORK_ERROR",c?.message||"Request failed")}}async function Z(o){if(I)return I;let e=(async()=>{try{let t=l.getJSON(g.TOKEN_DATA),r=Math.floor(Date.now()/1e3);if(!t?.refreshToken||t.refreshExpiresAt<=r)throw n("TOKEN_EXPIRED","Refresh token has expired");let a=o?.apiBaseUrl||C,u=new AbortController,p=setTimeout(()=>u.abort(),x);try{let c=await fetch(`${a}/platform/refreshToken`,{method:"POST",signal:u.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t.refreshToken})});if(clearTimeout(p),!c.ok)throw c.status>=500?n("SERVER_ERROR",`HTTP ${c.status}: ${c.statusText}`):n("TOKEN_EXPIRED",`HTTP ${c.status}: ${c.statusText}`);let f=await c.json();if(f.code!==1e4||!f.data)throw n("TOKEN_EXPIRED",f.msg||"Failed to refresh token");let d=f.data;if(l.setJSON(g.TOKEN_DATA,d),L)try{L(d);}catch{}return d}catch(c){throw clearTimeout(p),c instanceof E?c:c instanceof Error&&c.name==="AbortError"?n("TIMEOUT"):n("NETWORK_ERROR",c?.message||"Refresh token failed")}}catch(t){return await ee(t)}})();I=e;try{return await e}finally{I===e&&(I=null);}}var U=class{constructor(){this.config=null;}configure(e){this.config=e;}async refreshToken(){return await Z(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(a=>a.title.toLowerCase().includes(r)||a.category.toLowerCase().includes(r)||a.description&&a.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 a=t.get(r.category)||0;t.set(r.category,a+1);}),Array.from(t.entries()).map(([r,a],u)=>({id:`category_${u}`,name:r,count:a}))}async getGameById(e){return M(e)}async getCategoryNames(){return z()}async loginOnly(e){let t=Q(e);return await j("/platform/login",{method:"POST",body:JSON.stringify(t)},this.config??void 0)}async Login(e){let t=await this.loginOnly(e);l.setJSON(g.TOKEN_DATA,t);try{let r=await this.getUserInfo(!1);return {tokenData:t,user:r}}catch(r){throw l.remove(g.TOKEN_DATA),l.remove(g.USER),r}}async getUserInfo(e=true){return await j("/platform/user",{method:"GET"},this.config??void 0,true,e)}async getUser(){return l.getJSON(g.USER)}async validateToken(e){return !!e}},D=null;function b(){return D||(D=new U),D}var te="https://api.playsout.com",J="zh",w=class o{constructor(){this.config=null;this._isInitialized=false;this._user=null;this._token=null;this._locale=J;this._widget=null;}clearAuthState(){let e=!!(this._token||l.get(g.TOKEN_DATA)||l.get(g.USER));return this._user=null,this._token=null,l.remove(g.TOKEN_DATA),l.remove(g.USER),l.remove(g.LOGIN_PARAMS),e}updateUser(e){this._user={userId:String(e.id),username:e.username},l.setJSON(g.USER,this._user);}saveLoginParams(e){if(e.platform==="grab"||e.platform==="eros"){l.setJSON(g.LOGIN_PARAMS,{...e});return}l.remove(g.LOGIN_PARAMS);}async performLogin(e,t){let r=b();r.configure(this.config);let a=await r.loginOnly(e);l.setJSON(g.TOKEN_DATA,a);let u=await r.getUserInfo(false);return this._token=a.accessToken,this.updateUser(u),t&&this.saveLoginParams(e),b$1.emit("login",{user:this._user,token:this._token}),{tokenData:a,user:u}}async recoverAuthentication(){let e=l.getJSON(g.LOGIN_PARAMS);if(!e||e.platform!=="grab"&&e.platform!=="eros")throw n("TOKEN_EXPIRED","No reusable login parameters available");return (await this.performLogin(e,false)).tokenData}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 n("ALREADY_INITIALIZED");this.config={apiBaseUrl:e.apiBaseUrl||te,debug:e.debug||false,storage:e.storage||"localStorage",locale:e.locale||J,appId:e.appId||""},l.configure(this.config.storage),B(a=>{this._token=a.accessToken;}),q(()=>this.recoverAuthentication()),W(()=>{this.handleAuthExpired();});let t=l.getJSON(g.TOKEN_DATA);this._user=l.getJSON(g.USER),this._locale=l.get(g.LOCALE)||this.config.locale;let r=Math.floor(Date.now()/1e3);if(t){let a=b();if(a.configure(this.config),t.accessToken&&t.expiresAt>r?this._token=t.accessToken:await a.refreshToken(),this._token&&!this._user){let u=await a.getUserInfo();this.updateUser(u);}}else this._user&&(this._user=null,l.remove(g.USER));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,l.clear(),b$1.clear();}get isInitialized(){return this._isInitialized}get isLoggedIn(){return !!(this._token&&this._user)}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);try{let t=await this.performLogin(e,!0);return this.config?.debug&&console.log("[PlaysoutSDK] Login success, user:",t.user),t}catch(t){throw this.clearAuthState(),t}}async getUserInfo(){if(this.ensureInitialized(),!this.isLoggedIn)throw n("NOT_LOGGED_IN","Please login first");let e=b();e.configure(this.config);let t=await e.getUserInfo();return this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo result:",t),t&&this.updateUser(t),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 n("INVALID_PARAMS",`Unsupported locale: ${e}`);this._locale=e,l.set(g.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(a=>a.title.toLowerCase().includes(r)||a.category.toLowerCase().includes(r)||a.description&&a.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 a=t.get(r.category)||0;t.set(r.category,a+1);}),Array.from(t.entries()).map(([r,a],u)=>({id:`category_${u}`,name:r,count:a}))}async getGameById(e){return this.ensureInitialized(),h().find(t=>t.id===e)}mount(e,t){if(this.ensureInitialized(),typeof document>"u")throw n("FEATURE_NOT_SUPPORTED","mount requires DOM environment");let r=document.querySelector(e);if(!r)throw n("INVALID_PARAMS",`Container not found: ${e}`);let a=document.createElement("playsout-widget");this.config?.appId&&a.setAttribute("app-id",this.config.appId),a.setAttribute("locale",t?.locale||this._locale),t?.detailMode&&a.setAttribute("detail-mode",t.detailMode),this._widget=a,t?.onGameClick&&a.addEventListener("game-click",u=>{let p=u;t.onGameClick(p.detail);}),t?.onLoginRequired&&a.addEventListener("login-required",t.onLoginRequired),t?.onLocaleChange&&a.addEventListener("locale-change",u=>{let p=u;t.onLocaleChange(p.detail);}),r.appendChild(a),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 n("NOT_INITIALIZED")}},s=w.getInstance(),Se=s;typeof window<"u"&&(window.__playsout_sdk_instance=s);var we=Object.freeze({init:s.init.bind(s),mount:s.mount.bind(s),unmount:s.unmount.bind(s),destroy:s.destroy.bind(s),Login:s.Login.bind(s),logout:s.logout.bind(s),getToken:s.getToken.bind(s),getUserInfo:s.getUserInfo.bind(s),getUser:s.getUser.bind(s),setLocale:s.setLocale.bind(s),getLocale:s.getLocale.bind(s),getGames:s.getGames.bind(s),getCategories:s.getCategories.bind(s),on:s.on.bind(s),off:s.off.bind(s),get isInitialized(){return s.isInitialized},get isLoggedIn(){return s.isLoggedIn},instance:s,PlaysoutSDKClass:w});
2
- export{N as a,E as b,l as c,g as d,w as e,s as f,Se as g,we as h};
package/core/api.d.ts.map DELETED
@@ -1 +0,0 @@
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;AA4FjB,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI,CAEtF;AAKD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAEhF;AAMD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAEjE;AAqPD,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;IAmBhE,WAAW,CAAC,iBAAiB,UAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAUhE,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"}
@@ -1 +0,0 @@
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"}