playsout-web-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunk-AJVRILLC.js +2 -0
- package/chunk-EZLO3WY6.js +2 -0
- package/chunk-MUMDBAO7.cjs +2 -0
- package/chunk-Z2CIDSTP.cjs +2 -0
- package/core/api.d.ts +19 -0
- package/core/api.d.ts.map +1 -0
- package/core/errors.d.ts +31 -0
- package/core/errors.d.ts.map +1 -0
- package/core/events.d.ts +30 -0
- package/core/events.d.ts.map +1 -0
- package/core/index.d.ts +38 -0
- package/core/index.d.ts.map +1 -0
- package/core/storage.d.ts +24 -0
- package/core/storage.d.ts.map +1 -0
- package/core/types.d.ts +127 -0
- package/core/types.d.ts.map +1 -0
- package/data/games.d.ts +30 -0
- package/data/games.d.ts.map +1 -0
- package/iife-entry.d.ts +3 -0
- package/iife-entry.d.ts.map +1 -0
- package/index.cjs +1 -0
- package/index.d.ts +9 -0
- package/index.d.ts.map +1 -0
- package/index.global.js +1471 -0
- package/index.iife.js +1471 -0
- package/index.js +1 -0
- package/package.json +63 -0
- package/public-api.d.ts +24 -0
- package/public-api.d.ts.map +1 -0
- package/react/context.d.ts +40 -0
- package/react/context.d.ts.map +1 -0
- package/react/index.cjs +1 -0
- package/react/index.d.ts +6 -0
- package/react/index.d.ts.map +1 -0
- package/react/index.js +1 -0
- package/vue/composable.d.ts +88 -0
- package/vue/composable.d.ts.map +1 -0
- package/vue/index.cjs +1 -0
- package/vue/index.d.ts +8 -0
- package/vue/index.d.ts.map +1 -0
- package/vue/index.js +1 -0
- package/vue/plugin.d.ts +14 -0
- package/vue/plugin.d.ts.map +1 -0
- package/web-components/PlaysoutWidget.d.ts +46 -0
- package/web-components/PlaysoutWidget.d.ts.map +1 -0
- package/web-components/assetUrl.d.ts +2 -0
- package/web-components/assetUrl.d.ts.map +1 -0
- package/web-components/imageCache.d.ts +13 -0
- package/web-components/imageCache.d.ts.map +1 -0
- package/web-components/index.cjs +1471 -0
- package/web-components/index.d.ts +3 -0
- package/web-components/index.d.ts.map +1 -0
- package/web-components/index.js +1471 -0
package/index.js
ADDED
|
@@ -0,0 +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-AJVRILLC.js';export{a as SDKEvent,b as eventEmitter}from'./chunk-EZLO3WY6.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "playsout-web-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PlaysoutSDK } from './core';
|
|
2
|
+
export declare const Playsout: Readonly<{
|
|
3
|
+
init: (config?: import(".").SDKConfig) => Promise<void>;
|
|
4
|
+
mount: (selector: string, options?: import(".").MountOptions) => void;
|
|
5
|
+
unmount: () => void;
|
|
6
|
+
destroy: () => void;
|
|
7
|
+
Login: (params: import(".").PlatformLoginParams) => Promise<import(".").PlatformLoginResult>;
|
|
8
|
+
logout: () => void;
|
|
9
|
+
getToken: () => string | null;
|
|
10
|
+
getUserInfo: () => Promise<import(".").PlatformUserInfo>;
|
|
11
|
+
getUser: () => import(".").User | null;
|
|
12
|
+
setLocale: (locale: import(".").SupportedLocale) => void;
|
|
13
|
+
getLocale: () => import(".").SupportedLocale;
|
|
14
|
+
getGames: (params?: import(".").GetGamesParams) => Promise<import(".").Game[]>;
|
|
15
|
+
getCategories: () => Promise<import(".").Category[]>;
|
|
16
|
+
on: <T = unknown>(event: string, callback: (data: T) => void) => () => void;
|
|
17
|
+
off: (event: string, callback: (data: unknown) => void) => void;
|
|
18
|
+
readonly isInitialized: boolean;
|
|
19
|
+
readonly isLoggedIn: boolean;
|
|
20
|
+
instance: PlaysoutSDK;
|
|
21
|
+
PlaysoutSDKClass: typeof PlaysoutSDK;
|
|
22
|
+
}>;
|
|
23
|
+
export type PlaysoutPublicAPI = typeof Playsout;
|
|
24
|
+
//# sourceMappingURL=public-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAO,MAAM,QAAQ,CAAC;AAO1C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;EA+BnB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,OAAO,QAAQ,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SDKConfig, User, Game, Category, GetGamesParams, SupportedLocale, PlatformLoginParams, PlatformLoginResult } from '../core/types';
|
|
3
|
+
export interface PlaysoutContextValue {
|
|
4
|
+
isInitialized: boolean;
|
|
5
|
+
isLoggedIn: boolean;
|
|
6
|
+
user: User | null;
|
|
7
|
+
token: string | null;
|
|
8
|
+
locale: SupportedLocale;
|
|
9
|
+
games: Game[];
|
|
10
|
+
categories: Category[];
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
init: (config: SDKConfig) => Promise<void>;
|
|
14
|
+
Login: (params: PlatformLoginParams) => Promise<PlatformLoginResult>;
|
|
15
|
+
logout: () => void;
|
|
16
|
+
setLocale: (locale: SupportedLocale) => void;
|
|
17
|
+
getGames: (params?: GetGamesParams) => Promise<Game[]>;
|
|
18
|
+
getCategories: () => Promise<Category[]>;
|
|
19
|
+
refreshGames: () => Promise<void>;
|
|
20
|
+
getUserInfo: () => Promise<unknown>;
|
|
21
|
+
}
|
|
22
|
+
export interface PlaysoutProviderProps {
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
config?: SDKConfig;
|
|
25
|
+
locale?: SupportedLocale;
|
|
26
|
+
}
|
|
27
|
+
export declare function PlaysoutProvider({ children, config, locale, }: PlaysoutProviderProps): React.JSX.Element;
|
|
28
|
+
export declare function usePlaysout(): PlaysoutContextValue;
|
|
29
|
+
export declare function useGames(params?: GetGamesParams): {
|
|
30
|
+
games: Game[];
|
|
31
|
+
isLoading: boolean;
|
|
32
|
+
error: Error | null;
|
|
33
|
+
refresh: (newParams?: GetGamesParams) => Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
export declare function useCategories(): {
|
|
36
|
+
categories: Category[];
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
refresh: () => Promise<Category[]>;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/react/context.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAG3F,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,oBAAoB;IAEnC,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAGpB,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;IAClC,WAAW,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACrC;AAMD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAMD,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,MAAM,GACP,EAAE,qBAAqB,qBA0JvB;AAMD,wBAAgB,WAAW,IAAI,oBAAoB,CAQlD;AAKD,wBAAgB,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc;;;;0BAaC,cAAc;EAgB9D;AAKD,wBAAgB,aAAa;;;mBAtON,OAAO,CAAC,QAAQ,EAAE,CAAC;EAyOzC"}
|
package/react/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkMUMDBAO7_cjs=require('../chunk-MUMDBAO7.cjs');require('../chunk-Z2CIDSTP.cjs');var react=require('react'),jsxRuntime=require('react/jsx-runtime');var S=react.createContext(null);function H({children:a,config:n,locale:c}){let[u,d]=react.useState(false),[p,g]=react.useState(false),[L,i]=react.useState(null),[G,m]=react.useState(null),[C,w]=react.useState(c||"zh"),[k,h]=react.useState([]),[U,E]=react.useState([]),[b,r]=react.useState(false),[R,f]=react.useState(null),x=react.useCallback(async t=>{try{r(!0),f(null),await chunkMUMDBAO7_cjs.f.init(t),d(!0),g(chunkMUMDBAO7_cjs.f.isLoggedIn),i(chunkMUMDBAO7_cjs.f.user),m(chunkMUMDBAO7_cjs.f.token),w(chunkMUMDBAO7_cjs.f.locale);let[o,P]=await Promise.all([chunkMUMDBAO7_cjs.f.getGames(),chunkMUMDBAO7_cjs.f.getCategories()]);h(o),E(P);}catch(o){f(o instanceof Error?o:new Error("Initialization failed")),console.error("[PlaysoutProvider] Init error:",o);}finally{r(false);}},[]),z=react.useCallback(async t=>{try{r(!0),f(null);let o=await chunkMUMDBAO7_cjs.h.Login(t);return g(!0),i(chunkMUMDBAO7_cjs.f.user),m(chunkMUMDBAO7_cjs.f.token),o}catch(o){let P=o instanceof Error?o:new Error("Login failed");throw f(P),P}finally{r(false);}},[]),V=react.useCallback(()=>{chunkMUMDBAO7_cjs.f.logout(),g(false),i(null),m(null);},[]),D=react.useCallback(t=>{chunkMUMDBAO7_cjs.h.setLocale(t),w(t);},[]),K=react.useCallback(async t=>{try{return r(!0),await chunkMUMDBAO7_cjs.f.getGames(t)}finally{r(false);}},[]),T=react.useCallback(async()=>{try{return r(!0),await chunkMUMDBAO7_cjs.f.getCategories()}finally{r(false);}},[]),A=react.useCallback(async()=>{try{r(!0);let[t,o]=await Promise.all([chunkMUMDBAO7_cjs.f.getGames(),chunkMUMDBAO7_cjs.f.getCategories()]);h(t),E(o);}catch(t){f(t instanceof Error?t:new Error("Refresh failed"));}finally{r(false);}},[]),F=react.useCallback(async()=>{try{r(!0);let t=await chunkMUMDBAO7_cjs.f.getUserInfo();return i(chunkMUMDBAO7_cjs.f.user),t}finally{r(false);}},[]);react.useEffect(()=>{n&&!u&&x(n);},[n,u,x]);let N={isInitialized:u,isLoggedIn:p,user:L,token:G,locale:C,games:k,categories:U,isLoading:b,error:R,init:x,Login:z,logout:V,setLocale:D,getGames:K,getCategories:T,refreshGames:A,getUserInfo:F};return jsxRuntime.jsx(S.Provider,{value:N,children:a})}function v(){let a=react.useContext(S);if(!a)throw new Error("usePlaysout must be used within PlaysoutProvider");return a}function J(a){let{games:n,getGames:c,isLoading:u,error:d}=v(),[p,g]=react.useState(n),[L,i]=react.useState(u);react.useEffect(()=>{g(n);},[n]),react.useEffect(()=>{i(u);},[u]);let G=react.useCallback(async m=>{i(true);try{let C=await c(m||a);g(C);}finally{i(false);}},[c,a]);return {games:p,isLoading:L,error:d,refresh:G}}function M(){let{categories:a,getCategories:n,isLoading:c}=v();return {categories:a,isLoading:c,refresh:n}}Object.defineProperty(exports,"Playsout",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.h}});exports.PlaysoutProvider=H;exports.useCategories=M;exports.useGames=J;exports.usePlaysout=v;
|
package/react/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { PlaysoutProvider, usePlaysout, useGames, useCategories } from './context';
|
|
2
|
+
export { Playsout } from '../public-api';
|
|
3
|
+
export type { PlaysoutPublicAPI } from '../public-api';
|
|
4
|
+
export type { PlaysoutContextValue, PlaysoutProviderProps, } from './context';
|
|
5
|
+
export type { PlatformType, GrabErosLoginParams, TikTokLoginParams, PlatformLoginParams, PlatformLoginResult, } from '../core/types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;AAGnF,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"}
|
package/react/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f,h}from'../chunk-AJVRILLC.js';export{h as Playsout}from'../chunk-AJVRILLC.js';import'../chunk-EZLO3WY6.js';import {createContext,useState,useCallback,useEffect,useContext}from'react';import {jsx}from'react/jsx-runtime';var S=createContext(null);function H({children:a,config:n,locale:c}){let[u,d]=useState(false),[p,g]=useState(false),[L,i]=useState(null),[G,m]=useState(null),[C,w]=useState(c||"zh"),[k,h$1]=useState([]),[U,E]=useState([]),[b,r]=useState(false),[R,f$1]=useState(null),x=useCallback(async t=>{try{r(!0),f$1(null),await f.init(t),d(!0),g(f.isLoggedIn),i(f.user),m(f.token),w(f.locale);let[o,P]=await Promise.all([f.getGames(),f.getCategories()]);h$1(o),E(P);}catch(o){f$1(o instanceof Error?o:new Error("Initialization failed")),console.error("[PlaysoutProvider] Init error:",o);}finally{r(false);}},[]),z=useCallback(async t=>{try{r(!0),f$1(null);let o=await h.Login(t);return g(!0),i(f.user),m(f.token),o}catch(o){let P=o instanceof Error?o:new Error("Login failed");throw f$1(P),P}finally{r(false);}},[]),V=useCallback(()=>{f.logout(),g(false),i(null),m(null);},[]),D=useCallback(t=>{h.setLocale(t),w(t);},[]),K=useCallback(async t=>{try{return r(!0),await f.getGames(t)}finally{r(false);}},[]),T=useCallback(async()=>{try{return r(!0),await f.getCategories()}finally{r(false);}},[]),A=useCallback(async()=>{try{r(!0);let[t,o]=await Promise.all([f.getGames(),f.getCategories()]);h$1(t),E(o);}catch(t){f$1(t instanceof Error?t:new Error("Refresh failed"));}finally{r(false);}},[]),F=useCallback(async()=>{try{r(!0);let t=await f.getUserInfo();return i(f.user),t}finally{r(false);}},[]);useEffect(()=>{n&&!u&&x(n);},[n,u,x]);let N={isInitialized:u,isLoggedIn:p,user:L,token:G,locale:C,games:k,categories:U,isLoading:b,error:R,init:x,Login:z,logout:V,setLocale:D,getGames:K,getCategories:T,refreshGames:A,getUserInfo:F};return jsx(S.Provider,{value:N,children:a})}function v(){let a=useContext(S);if(!a)throw new Error("usePlaysout must be used within PlaysoutProvider");return a}function J(a){let{games:n,getGames:c,isLoading:u,error:d}=v(),[p,g]=useState(n),[L,i]=useState(u);useEffect(()=>{g(n);},[n]),useEffect(()=>{i(u);},[u]);let G=useCallback(async m=>{i(true);try{let C=await c(m||a);g(C);}finally{i(false);}},[c,a]);return {games:p,isLoading:L,error:d,refresh:G}}function M(){let{categories:a,getCategories:n,isLoading:c}=v();return {categories:a,isLoading:c,refresh:n}}export{H as PlaysoutProvider,M as useCategories,J as useGames,v as usePlaysout};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
import type { SDKConfig, User, Game, Category, GetGamesParams, SupportedLocale, PlatformLoginParams, PlatformLoginResult } from '../core/types';
|
|
3
|
+
export declare const PLAYSOUT_KEY: InjectionKey<PlaysoutComposable>;
|
|
4
|
+
export interface PlaysoutComposable {
|
|
5
|
+
isInitialized: Ref<boolean>;
|
|
6
|
+
isLoggedIn: Ref<boolean>;
|
|
7
|
+
user: Ref<User | null>;
|
|
8
|
+
token: Ref<string | null>;
|
|
9
|
+
locale: Ref<SupportedLocale>;
|
|
10
|
+
games: Ref<Game[]>;
|
|
11
|
+
categories: Ref<Category[]>;
|
|
12
|
+
isLoading: Ref<boolean>;
|
|
13
|
+
error: Ref<Error | null>;
|
|
14
|
+
init: (config: SDKConfig) => Promise<void>;
|
|
15
|
+
Login: (params: PlatformLoginParams) => Promise<PlatformLoginResult>;
|
|
16
|
+
logout: () => void;
|
|
17
|
+
setLocale: (locale: SupportedLocale) => void;
|
|
18
|
+
getGames: (params?: GetGamesParams) => Promise<Game[]>;
|
|
19
|
+
getCategories: () => Promise<Category[]>;
|
|
20
|
+
refreshGames: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare function createPlaysout(): {
|
|
23
|
+
isInitialized: Ref<boolean, boolean>;
|
|
24
|
+
isLoggedIn: Ref<boolean, boolean>;
|
|
25
|
+
user: Ref<{
|
|
26
|
+
userId: string;
|
|
27
|
+
username: string;
|
|
28
|
+
avatar?: string | undefined;
|
|
29
|
+
email?: string | undefined;
|
|
30
|
+
} | null, User | {
|
|
31
|
+
userId: string;
|
|
32
|
+
username: string;
|
|
33
|
+
avatar?: string | undefined;
|
|
34
|
+
email?: string | undefined;
|
|
35
|
+
} | null>;
|
|
36
|
+
token: Ref<string | null, string | null>;
|
|
37
|
+
locale: Ref<SupportedLocale, SupportedLocale>;
|
|
38
|
+
games: Ref<{
|
|
39
|
+
id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
category: string;
|
|
42
|
+
image: string;
|
|
43
|
+
description?: string | undefined;
|
|
44
|
+
isNew?: boolean | undefined;
|
|
45
|
+
isHot?: boolean | undefined;
|
|
46
|
+
isBanner?: boolean | undefined;
|
|
47
|
+
enable: boolean;
|
|
48
|
+
externalUrl?: string | undefined;
|
|
49
|
+
orientation?: "portrait" | "landscape" | undefined;
|
|
50
|
+
apiGameId?: number | undefined;
|
|
51
|
+
}[], Game[] | {
|
|
52
|
+
id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
category: string;
|
|
55
|
+
image: string;
|
|
56
|
+
description?: string | undefined;
|
|
57
|
+
isNew?: boolean | undefined;
|
|
58
|
+
isHot?: boolean | undefined;
|
|
59
|
+
isBanner?: boolean | undefined;
|
|
60
|
+
enable: boolean;
|
|
61
|
+
externalUrl?: string | undefined;
|
|
62
|
+
orientation?: "portrait" | "landscape" | undefined;
|
|
63
|
+
apiGameId?: number | undefined;
|
|
64
|
+
}[]>;
|
|
65
|
+
categories: Ref<{
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
icon?: string | undefined;
|
|
69
|
+
count: number;
|
|
70
|
+
}[], Category[] | {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
icon?: string | undefined;
|
|
74
|
+
count: number;
|
|
75
|
+
}[]>;
|
|
76
|
+
isLoading: Ref<boolean, boolean>;
|
|
77
|
+
error: Ref<Error | null, Error | null>;
|
|
78
|
+
hasError: import("vue").ComputedRef<boolean>;
|
|
79
|
+
init: (config: SDKConfig) => Promise<void>;
|
|
80
|
+
Login: (params: PlatformLoginParams) => Promise<PlatformLoginResult>;
|
|
81
|
+
logout: () => void;
|
|
82
|
+
setLocale: (newLocale: SupportedLocale) => void;
|
|
83
|
+
getGames: (params?: GetGamesParams) => Promise<Game[]>;
|
|
84
|
+
getCategories: () => Promise<Category[]>;
|
|
85
|
+
refreshGames: () => Promise<void>;
|
|
86
|
+
};
|
|
87
|
+
export declare function usePlaysout(): PlaysoutComposable;
|
|
88
|
+
//# sourceMappingURL=composable.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAgBA,SAAS;oBA2BR,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"}
|
package/vue/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkMUMDBAO7_cjs=require('../chunk-MUMDBAO7.cjs');require('../chunk-Z2CIDSTP.cjs');var vue=require('vue');var c=Symbol("PlaysoutSDK");function p(){let l=vue.ref(false),i=vue.ref(false),n=vue.ref(null),g=vue.ref(null),f=vue.ref("zh"),y=vue.ref([]),P=vue.ref([]),o=vue.ref(false),s=vue.ref(null),C=vue.computed(()=>s.value!==null);async function G(e){try{o.value=!0,s.value=null,await chunkMUMDBAO7_cjs.f.init(e),l.value=!0,m(),await L();}catch(a){s.value=a instanceof Error?a:new Error("Initialization failed"),console.error("[usePlaysout] Init error:",a);}finally{o.value=false;}}function m(){i.value=chunkMUMDBAO7_cjs.f.isLoggedIn,n.value=chunkMUMDBAO7_cjs.f.user,g.value=chunkMUMDBAO7_cjs.f.token,f.value=chunkMUMDBAO7_cjs.f.locale;}async function S(e){try{o.value=!0,s.value=null;let a=await chunkMUMDBAO7_cjs.h.Login(e);return m(),a}catch(a){let v=a instanceof Error?a:new Error("Login failed");throw s.value=v,v}finally{o.value=false;}}function b(){chunkMUMDBAO7_cjs.f.logout(),m();}function x(e){chunkMUMDBAO7_cjs.h.setLocale(e),f.value=e;}async function R(e){try{return o.value=!0,await chunkMUMDBAO7_cjs.f.getGames(e)}finally{o.value=false;}}async function E(){try{return o.value=!0,await chunkMUMDBAO7_cjs.f.getCategories()}finally{o.value=false;}}async function L(){try{o.value=!0;let[e,a]=await Promise.all([chunkMUMDBAO7_cjs.f.getGames(),chunkMUMDBAO7_cjs.f.getCategories()]);y.value=e,P.value=a;}catch(e){s.value=e instanceof Error?e:new Error("Refresh failed");}finally{o.value=false;}}return {isInitialized:l,isLoggedIn:i,user:n,token:g,locale:f,games:y,categories:P,isLoading:o,error:s,hasError:C,init:G,Login:S,logout:b,setLocale:x,getGames:R,getCategories:E,refreshGames:L}}function d(){let l=vue.inject(c);if(!l)throw new Error("usePlaysout must be used after calling createPlaysout()");return l}function h(l={}){return {install(i){let n=p();i.provide(c,n),l.config&&n.init(l.config);}}}Object.defineProperty(exports,"Playsout",{enumerable:true,get:function(){return chunkMUMDBAO7_cjs.h}});exports.createPlaysout=p;exports.createPlaysoutPlugin=h;exports.usePlaysout=d;
|
package/vue/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createPlaysout, usePlaysout } from './composable';
|
|
2
|
+
export { createPlaysoutPlugin } from './plugin';
|
|
3
|
+
export { Playsout } from '../public-api';
|
|
4
|
+
export type { PlaysoutPublicAPI } from '../public-api';
|
|
5
|
+
export type { PlaysoutComposable } from './composable';
|
|
6
|
+
export type { PlaysoutPluginOptions } from './plugin';
|
|
7
|
+
export type { PlatformType, GrabErosLoginParams, TikTokLoginParams, PlatformLoginParams, PlatformLoginResult, } from '../core/types';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;AAGhD,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"}
|
package/vue/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f,h as h$1}from'../chunk-AJVRILLC.js';export{h as Playsout}from'../chunk-AJVRILLC.js';import'../chunk-EZLO3WY6.js';import {ref,computed,inject}from'vue';var c=Symbol("PlaysoutSDK");function p(){let l=ref(false),i=ref(false),n=ref(null),g=ref(null),f$1=ref("zh"),y=ref([]),P=ref([]),o=ref(false),s=ref(null),C=computed(()=>s.value!==null);async function G(e){try{o.value=!0,s.value=null,await f.init(e),l.value=!0,m(),await L();}catch(a){s.value=a instanceof Error?a:new Error("Initialization failed"),console.error("[usePlaysout] Init error:",a);}finally{o.value=false;}}function m(){i.value=f.isLoggedIn,n.value=f.user,g.value=f.token,f$1.value=f.locale;}async function S(e){try{o.value=!0,s.value=null;let a=await h$1.Login(e);return m(),a}catch(a){let v=a instanceof Error?a:new Error("Login failed");throw s.value=v,v}finally{o.value=false;}}function b(){f.logout(),m();}function x(e){h$1.setLocale(e),f$1.value=e;}async function R(e){try{return o.value=!0,await f.getGames(e)}finally{o.value=false;}}async function E(){try{return o.value=!0,await f.getCategories()}finally{o.value=false;}}async function L(){try{o.value=!0;let[e,a]=await Promise.all([f.getGames(),f.getCategories()]);y.value=e,P.value=a;}catch(e){s.value=e instanceof Error?e:new Error("Refresh failed");}finally{o.value=false;}}return {isInitialized:l,isLoggedIn:i,user:n,token:g,locale:f$1,games:y,categories:P,isLoading:o,error:s,hasError:C,init:G,Login:S,logout:b,setLocale:x,getGames:R,getCategories:E,refreshGames:L}}function d(){let l=inject(c);if(!l)throw new Error("usePlaysout must be used after calling createPlaysout()");return l}function h(l={}){return {install(i){let n=p();i.provide(c,n),l.config&&n.init(l.config);}}}export{p as createPlaysout,h as createPlaysoutPlugin,d as usePlaysout};
|
package/vue/plugin.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import type { SDKConfig } from '../core/types';
|
|
3
|
+
export { usePlaysout } from './composable';
|
|
4
|
+
export type { PlaysoutComposable } from './composable';
|
|
5
|
+
export interface PlaysoutPluginOptions {
|
|
6
|
+
config?: SDKConfig;
|
|
7
|
+
locale?: SDKConfig['locale'];
|
|
8
|
+
}
|
|
9
|
+
export declare function createPlaysoutPlugin(options?: PlaysoutPluginOptions): {
|
|
10
|
+
install(app: App): void;
|
|
11
|
+
};
|
|
12
|
+
export type { SDKConfig } from '../core/types';
|
|
13
|
+
export type { SupportedLocale, Game, Category, GetGamesParams, PlatformType, GrabErosLoginParams, TikTokLoginParams, PlatformLoginParams, PlatformLoginResult, } from '../core/types';
|
|
14
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/vue/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKvD,MAAM,WAAW,qBAAqB;IAEpC,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,MAAM,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC9B;AAKD,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B;iBAEvD,GAAG;EAYnB;AAGD,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EACV,eAAe,EACf,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
declare class PlaysoutWidget extends HTMLElement {
|
|
2
|
+
private shadow;
|
|
3
|
+
private _appId;
|
|
4
|
+
private _locale;
|
|
5
|
+
private games;
|
|
6
|
+
private filteredGames;
|
|
7
|
+
private selectedCategory;
|
|
8
|
+
private searchQuery;
|
|
9
|
+
private bannerUrl;
|
|
10
|
+
private userPoints;
|
|
11
|
+
private avatarUrl;
|
|
12
|
+
private recentGames;
|
|
13
|
+
private _detailMode;
|
|
14
|
+
private currentView;
|
|
15
|
+
private currentGame;
|
|
16
|
+
static get observedAttributes(): string[];
|
|
17
|
+
constructor();
|
|
18
|
+
private t;
|
|
19
|
+
private hasTranslation;
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
22
|
+
private loadGames;
|
|
23
|
+
private pollForSDK;
|
|
24
|
+
private doLoadGames;
|
|
25
|
+
private filterGames;
|
|
26
|
+
private showLoading;
|
|
27
|
+
private showError;
|
|
28
|
+
private render;
|
|
29
|
+
private updateUI;
|
|
30
|
+
private gemPacks;
|
|
31
|
+
private showStoreModal;
|
|
32
|
+
private hideStoreModal;
|
|
33
|
+
private showProfileModal;
|
|
34
|
+
private hideProfileModal;
|
|
35
|
+
private showLanguageSelectModal;
|
|
36
|
+
private handleGemPurchase;
|
|
37
|
+
private toastTimeout;
|
|
38
|
+
private showToast;
|
|
39
|
+
private renderGames;
|
|
40
|
+
private showLoginPrompt;
|
|
41
|
+
private renderGameCard;
|
|
42
|
+
private renderGameDetail;
|
|
43
|
+
private attachEventListeners;
|
|
44
|
+
}
|
|
45
|
+
export { PlaysoutWidget };
|
|
46
|
+
//# sourceMappingURL=PlaysoutWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaysoutWidget.d.ts","sourceRoot":"","sources":["../../src/web-components/PlaysoutWidget.ts"],"names":[],"mappings":"AAkzCA,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,CAAuB;IAC/C,OAAO,CAAC,WAAW,CAAc;IAGjC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,WAAW,CAAc;IAGjC,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,WAAW,CAAqB;IAExC,MAAM,KAAK,kBAAkB,aAE5B;;IAQD,OAAO,CAAC,CAAC;IAUT,OAAO,CAAC,cAAc;IAKtB,iBAAiB;IAKjB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;YA0CzE,SAAS;IA4BvB,OAAO,CAAC,UAAU;YAmBJ,WAAW;IA6BzB,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,SAAS;IAgBjB,OAAO,CAAC,MAAM;IAqHd,OAAO,CAAC,QAAQ;IAehB,OAAO,CAAC,QAAQ,CAKd;IAEF,OAAO,CAAC,cAAc;IA6DtB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,gBAAgB;IA4HxB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,uBAAuB;IAuE/B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,YAAY,CAAuB;IAE3C,OAAO,CAAC,SAAS;IAkCjB,OAAO,CAAC,WAAW;IAgEnB,OAAO,CAAC,eAAe;IAqCvB,OAAO,CAAC,cAAc;IA+BtB,OAAO,CAAC,gBAAgB;IAgDxB,OAAO,CAAC,oBAAoB;CAkD7B;AAOD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetUrl.d.ts","sourceRoot":"","sources":["../../src/web-components/assetUrl.ts"],"names":[],"mappings":"AAQA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function setCriticalAssets(urls: string[]): void;
|
|
2
|
+
export declare function setPriorityCache(urls: string[], append?: boolean): void;
|
|
3
|
+
export declare function preloadImages(urls: string[], onProgress?: (loaded: number, total: number) => void): Promise<void>;
|
|
4
|
+
export declare function getCachedImageUrl(url: string): Promise<string | null>;
|
|
5
|
+
export declare function clearCache(): void;
|
|
6
|
+
export declare function getCacheStatus(): {
|
|
7
|
+
memoryCount: number;
|
|
8
|
+
storageCount: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveWithCache(originalUrl: string): string;
|
|
11
|
+
export declare function resolveWithCacheAsync(originalUrl: string): Promise<string>;
|
|
12
|
+
export declare function onImageReady(originalUrl: string, callback: (blobUrl: string) => void): () => void;
|
|
13
|
+
//# sourceMappingURL=imageCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageCache.d.ts","sourceRoot":"","sources":["../../src/web-components/imageCache.ts"],"names":[],"mappings":"AAiVA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAQtD;AAOD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,OAAe,GAAG,IAAI,CAmB9E;AAOD,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GACnD,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAMD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4BrE;AAKD,wBAAgB,UAAU,IAAI,IAAI,CAiBjC;AAKD,wBAAgB,cAAc,IAAI;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAK9E;AAWD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAoD5D;AAWD,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgEhF;AAaD,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAajG"}
|