@thestatic-tv/dcl-sdk 2.3.0-dev.0 → 2.3.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/README.md +39 -25
- package/dist/index.d.mts +324 -69
- package/dist/index.d.ts +324 -69
- package/dist/index.js +937 -410
- package/dist/index.mjs +934 -409
- package/package.json +8 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { Entity as Entity$1 } from '@dcl/sdk/ecs';
|
|
1
2
|
import ReactEcs from '@dcl/sdk/react-ecs';
|
|
2
3
|
|
|
4
|
+
/**
|
|
5
|
+
* JSX namespace declaration for DTS generation compatibility.
|
|
6
|
+
* React-ECS uses custom JSX factory, this ensures types compile.
|
|
7
|
+
*/
|
|
8
|
+
declare global {
|
|
9
|
+
namespace JSX {
|
|
10
|
+
interface Element {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
3
14
|
/**
|
|
4
15
|
* Player identity data from DCL
|
|
5
16
|
*/
|
|
@@ -9,12 +20,57 @@ interface PlayerData {
|
|
|
9
20
|
/** Player's display name */
|
|
10
21
|
name?: string;
|
|
11
22
|
}
|
|
23
|
+
|
|
24
|
+
type Entity = Entity$1;
|
|
12
25
|
/**
|
|
13
26
|
* Configuration options for StaticTVClient
|
|
14
27
|
*/
|
|
15
28
|
interface StaticTVConfig {
|
|
16
29
|
/** Your channel's API key from thestatic.tv studio */
|
|
17
30
|
apiKey: string;
|
|
31
|
+
/**
|
|
32
|
+
* Video screen entity - SDK automatically manages VideoPlayer on this entity.
|
|
33
|
+
* When user selects a video from Guide or Admin plays a URL, it plays here.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const screen = engine.addEntity()
|
|
38
|
+
* Transform.create(screen, { position: Vector3.create(8, 3, 14), scale: Vector3.create(8, 4.5, 0.1) })
|
|
39
|
+
* MeshRenderer.setPlane(screen)
|
|
40
|
+
*
|
|
41
|
+
* const staticTV = new StaticTVClient({
|
|
42
|
+
* apiKey: 'dcls_...',
|
|
43
|
+
* videoScreen: screen // SDK handles all video playback!
|
|
44
|
+
* })
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
videoScreen?: Entity;
|
|
48
|
+
/**
|
|
49
|
+
* Scene ID for Admin Panel API calls.
|
|
50
|
+
* Optional - defaults to API key ID if not provided.
|
|
51
|
+
*/
|
|
52
|
+
sceneId?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Callback when video URL should be played (Pro tier).
|
|
55
|
+
* If videoScreen is set, this is called AFTER SDK plays the video.
|
|
56
|
+
* Use for custom logic like logging, UI updates, etc.
|
|
57
|
+
*/
|
|
58
|
+
onVideoPlay?: (url: string) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Callback when video playback should stop (Pro tier).
|
|
61
|
+
* If videoScreen is set, this is called AFTER SDK stops the video.
|
|
62
|
+
*/
|
|
63
|
+
onVideoStop?: () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Callback for broadcast messages (Pro tier).
|
|
66
|
+
* Default: shows notification via staticTV.showNotification()
|
|
67
|
+
*/
|
|
68
|
+
onBroadcast?: (text: string) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Command handler for scene-specific commands (Pro tier).
|
|
71
|
+
* Called when admin triggers a command from the panel.
|
|
72
|
+
*/
|
|
73
|
+
onCommand?: (type: string, payload?: Record<string, unknown>) => void;
|
|
18
74
|
/** Automatically start session tracking on init (default: true) */
|
|
19
75
|
autoStartSession?: boolean;
|
|
20
76
|
/** Interval for session heartbeats in ms (default: 30000) */
|
|
@@ -37,11 +93,11 @@ interface StaticTVConfig {
|
|
|
37
93
|
*/
|
|
38
94
|
player?: PlayerData;
|
|
39
95
|
/**
|
|
40
|
-
* Guide UI configuration
|
|
96
|
+
* Guide UI configuration
|
|
41
97
|
*/
|
|
42
98
|
guideUI?: GuideUIConfig;
|
|
43
99
|
/**
|
|
44
|
-
* Chat UI configuration
|
|
100
|
+
* Chat UI configuration
|
|
45
101
|
*/
|
|
46
102
|
chatUI?: ChatUIConfig;
|
|
47
103
|
}
|
|
@@ -87,14 +143,22 @@ interface GuideResponse {
|
|
|
87
143
|
vodCount: number;
|
|
88
144
|
};
|
|
89
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* SDK tier levels - determines available features
|
|
148
|
+
* - free: Session tracking only (visitor metrics)
|
|
149
|
+
* - standard: Guide, Chat, Heartbeat, Interactions + session tracking
|
|
150
|
+
* - pro: Everything in Standard + Admin Panel
|
|
151
|
+
*/
|
|
152
|
+
type SDKTier = 'free' | 'standard' | 'pro';
|
|
90
153
|
/**
|
|
91
154
|
* Session response from the API
|
|
92
155
|
*/
|
|
93
156
|
interface SessionResponse {
|
|
94
157
|
success: boolean;
|
|
95
158
|
sessionId?: string;
|
|
159
|
+
keyId?: string;
|
|
96
160
|
keyType?: 'scene' | 'channel';
|
|
97
|
-
sdkType?: 'lite' | 'full';
|
|
161
|
+
sdkType?: SDKTier | 'lite' | 'full';
|
|
98
162
|
version: string;
|
|
99
163
|
}
|
|
100
164
|
/**
|
|
@@ -189,7 +253,10 @@ interface ChatMessage {
|
|
|
189
253
|
username: string;
|
|
190
254
|
text: string;
|
|
191
255
|
uid: string;
|
|
192
|
-
createdAt:
|
|
256
|
+
createdAt: Date | {
|
|
257
|
+
seconds: number;
|
|
258
|
+
nanoseconds: number;
|
|
259
|
+
} | string | number;
|
|
193
260
|
isSystem?: boolean;
|
|
194
261
|
}
|
|
195
262
|
/**
|
|
@@ -237,7 +304,7 @@ interface VideoSlot {
|
|
|
237
304
|
*/
|
|
238
305
|
type CommandHandler = (type: string, payload?: Record<string, unknown>) => void;
|
|
239
306
|
/**
|
|
240
|
-
* Custom scene tab definition for
|
|
307
|
+
* Custom scene tab definition for Pro tier
|
|
241
308
|
*/
|
|
242
309
|
interface SceneTabDefinition {
|
|
243
310
|
/** Tab label shown in the tab bar */
|
|
@@ -245,16 +312,17 @@ interface SceneTabDefinition {
|
|
|
245
312
|
/** Unique tab ID */
|
|
246
313
|
id: string;
|
|
247
314
|
/** React-ECS component that renders the tab content */
|
|
248
|
-
render: () =>
|
|
315
|
+
render: () => JSX.Element | null;
|
|
249
316
|
}
|
|
250
317
|
/**
|
|
251
318
|
* Configuration options for AdminPanelModule
|
|
252
319
|
*/
|
|
253
320
|
interface AdminPanelConfig {
|
|
254
321
|
/**
|
|
255
|
-
* Scene ID for API calls
|
|
322
|
+
* Scene ID for API calls.
|
|
323
|
+
* Optional - defaults to API key ID if not provided.
|
|
256
324
|
*/
|
|
257
|
-
sceneId
|
|
325
|
+
sceneId?: string;
|
|
258
326
|
/**
|
|
259
327
|
* Panel title (shown in header)
|
|
260
328
|
*/
|
|
@@ -277,8 +345,8 @@ interface AdminPanelConfig {
|
|
|
277
345
|
*/
|
|
278
346
|
showModTab?: boolean;
|
|
279
347
|
/**
|
|
280
|
-
|
|
281
|
-
|
|
348
|
+
* Custom scene tabs (Pro tier)
|
|
349
|
+
*/
|
|
282
350
|
sceneTabs?: SceneTabDefinition[];
|
|
283
351
|
/**
|
|
284
352
|
* Command handler for scene-specific commands (e.g., elevator, lights)
|
|
@@ -309,6 +377,11 @@ interface AdminPanelConfig {
|
|
|
309
377
|
* Enable debug logging
|
|
310
378
|
*/
|
|
311
379
|
debug?: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Force admin access (for testing without server endpoint)
|
|
382
|
+
* WARNING: Only use during development!
|
|
383
|
+
*/
|
|
384
|
+
forceAdmin?: boolean;
|
|
312
385
|
}
|
|
313
386
|
|
|
314
387
|
/**
|
|
@@ -354,13 +427,24 @@ declare class GuideModule {
|
|
|
354
427
|
declare class SessionModule {
|
|
355
428
|
private client;
|
|
356
429
|
private sessionId;
|
|
430
|
+
private _keyId;
|
|
357
431
|
private heartbeatTimerId;
|
|
358
432
|
private isActive;
|
|
359
|
-
private
|
|
433
|
+
private _tier;
|
|
360
434
|
constructor(client: StaticTVClient);
|
|
361
435
|
/**
|
|
362
|
-
* Get the
|
|
363
|
-
|
|
436
|
+
* Get the API key ID (used as default sceneId for Pro users)
|
|
437
|
+
*/
|
|
438
|
+
get keyId(): string | null;
|
|
439
|
+
/**
|
|
440
|
+
* Get the SDK tier returned by the server
|
|
441
|
+
* - free: Session tracking only
|
|
442
|
+
* - standard: Guide, Chat, Heartbeat, Interactions
|
|
443
|
+
* - pro: Everything + Admin Panel
|
|
444
|
+
*/
|
|
445
|
+
get tier(): SDKTier;
|
|
446
|
+
/**
|
|
447
|
+
* @deprecated Use `tier` instead. Returns mapped value for compatibility.
|
|
364
448
|
*/
|
|
365
449
|
get sdkType(): 'lite' | 'full';
|
|
366
450
|
/**
|
|
@@ -486,7 +570,6 @@ declare class GuideUIModule {
|
|
|
486
570
|
private currentPage;
|
|
487
571
|
private itemsPerPage;
|
|
488
572
|
private searchQuery;
|
|
489
|
-
private uiScale;
|
|
490
573
|
private _currentVideoId;
|
|
491
574
|
constructor(client: StaticTVClient, config?: GuideUIConfig);
|
|
492
575
|
/**
|
|
@@ -536,7 +619,7 @@ declare class GuideUIModule {
|
|
|
536
619
|
private handleChannelClick;
|
|
537
620
|
/**
|
|
538
621
|
* Get the guide UI component for rendering
|
|
539
|
-
*
|
|
622
|
+
* Always renders toggle button, plus panel when visible
|
|
540
623
|
*/
|
|
541
624
|
getComponent: () => any;
|
|
542
625
|
private renderLeftPanel;
|
|
@@ -570,7 +653,6 @@ declare class ChatUIModule {
|
|
|
570
653
|
private inputText;
|
|
571
654
|
private chatScrollOffset;
|
|
572
655
|
private position;
|
|
573
|
-
private fontScale;
|
|
574
656
|
private chatTimerId;
|
|
575
657
|
private playerInfoTimerId;
|
|
576
658
|
private isInitialized;
|
|
@@ -624,9 +706,11 @@ declare class ChatUIModule {
|
|
|
624
706
|
private resetChatTimer;
|
|
625
707
|
private parseServerTime;
|
|
626
708
|
private formatTime;
|
|
709
|
+
/** Scale a dimension by shared uiScale */
|
|
710
|
+
private s;
|
|
627
711
|
/**
|
|
628
712
|
* Get the chat UI component for rendering
|
|
629
|
-
*
|
|
713
|
+
* Always renders toggle button, plus panel when visible
|
|
630
714
|
*/
|
|
631
715
|
getComponent: () => any;
|
|
632
716
|
private getPositionStyle;
|
|
@@ -647,7 +731,7 @@ declare class ChatUIModule {
|
|
|
647
731
|
* Provides in-scene admin controls:
|
|
648
732
|
* - Video Tab: Stream control, video playback, slots
|
|
649
733
|
* - Mod Tab: Scene admins, banned wallets, broadcast
|
|
650
|
-
* - Custom Scene Tabs:
|
|
734
|
+
* - Custom Scene Tabs: Pro tier
|
|
651
735
|
*/
|
|
652
736
|
|
|
653
737
|
declare class AdminPanelUIModule {
|
|
@@ -662,6 +746,8 @@ declare class AdminPanelUIModule {
|
|
|
662
746
|
private customVideoUrl;
|
|
663
747
|
private streamData;
|
|
664
748
|
private streamFetched;
|
|
749
|
+
private videoState;
|
|
750
|
+
private videoStateFetched;
|
|
665
751
|
private channelCreating;
|
|
666
752
|
private channelCreateError;
|
|
667
753
|
private channelDeleting;
|
|
@@ -682,8 +768,12 @@ declare class AdminPanelUIModule {
|
|
|
682
768
|
private modsFetched;
|
|
683
769
|
constructor(client: StaticTVClient, config: AdminPanelConfig);
|
|
684
770
|
private log;
|
|
771
|
+
/** Scale a dimension by shared uiScale */
|
|
772
|
+
private s;
|
|
773
|
+
/** Get scaled theme */
|
|
774
|
+
private get theme();
|
|
685
775
|
/**
|
|
686
|
-
* Initialize the admin panel - checks admin status
|
|
776
|
+
* Initialize the admin panel - checks admin status and fetches video state
|
|
687
777
|
*/
|
|
688
778
|
init(): Promise<void>;
|
|
689
779
|
/**
|
|
@@ -694,6 +784,14 @@ declare class AdminPanelUIModule {
|
|
|
694
784
|
* Toggle the admin panel open/closed
|
|
695
785
|
*/
|
|
696
786
|
toggle(): void;
|
|
787
|
+
/**
|
|
788
|
+
* Show the admin panel
|
|
789
|
+
*/
|
|
790
|
+
show(): void;
|
|
791
|
+
/**
|
|
792
|
+
* Hide the admin panel
|
|
793
|
+
*/
|
|
794
|
+
hide(): void;
|
|
697
795
|
/**
|
|
698
796
|
* Check if the panel is currently open
|
|
699
797
|
*/
|
|
@@ -703,13 +801,22 @@ declare class AdminPanelUIModule {
|
|
|
703
801
|
*/
|
|
704
802
|
get hasAccess(): boolean;
|
|
705
803
|
/**
|
|
706
|
-
|
|
707
|
-
|
|
804
|
+
* Register a custom scene tab (Pro tier)
|
|
805
|
+
*/
|
|
708
806
|
registerSceneTab(tab: SceneTabDefinition): void;
|
|
709
807
|
private startStreamPolling;
|
|
710
808
|
private stopStreamPolling;
|
|
711
809
|
private fetchStreamData;
|
|
712
810
|
private refreshStreamStatus;
|
|
811
|
+
private fetchVideoState;
|
|
812
|
+
/**
|
|
813
|
+
* Play a video slot by ID - looks up URL and calls onVideoPlay
|
|
814
|
+
*/
|
|
815
|
+
playSlot(slotId: string): void;
|
|
816
|
+
/**
|
|
817
|
+
* Auto-play the default slot if configured
|
|
818
|
+
*/
|
|
819
|
+
private autoPlayDefault;
|
|
713
820
|
private createChannel;
|
|
714
821
|
private claimTrial;
|
|
715
822
|
private deleteChannel;
|
|
@@ -737,10 +844,10 @@ declare class AdminPanelUIModule {
|
|
|
737
844
|
/**
|
|
738
845
|
* StaticTVClient - Main client for connecting DCL scenes to thestatic.tv
|
|
739
846
|
*
|
|
740
|
-
* All keys use dcls_ prefix. Features enabled based on
|
|
741
|
-
* -
|
|
742
|
-
* -
|
|
743
|
-
* - pro:
|
|
847
|
+
* All keys use dcls_ prefix. Features enabled based on tier from server:
|
|
848
|
+
* - free: Session tracking only (visitor metrics)
|
|
849
|
+
* - standard: Guide, Chat, Heartbeat, Interactions + session tracking
|
|
850
|
+
* - pro: Everything in Standard + Admin Panel (Video + Mod tabs)
|
|
744
851
|
*/
|
|
745
852
|
|
|
746
853
|
/** Key type constants (legacy - kept for compatibility) */
|
|
@@ -750,38 +857,57 @@ declare class StaticTVClient {
|
|
|
750
857
|
private config;
|
|
751
858
|
private baseUrl;
|
|
752
859
|
private _keyType;
|
|
860
|
+
private _keyId;
|
|
753
861
|
private _disabled;
|
|
754
|
-
private
|
|
862
|
+
private _tier;
|
|
863
|
+
private _standardFeaturesEnabled;
|
|
755
864
|
private _proFeaturesEnabled;
|
|
756
|
-
|
|
865
|
+
private _pendingProConfig;
|
|
866
|
+
/** Guide module - fetch channel lineup (standard/pro tier) */
|
|
757
867
|
guide: GuideModule | null;
|
|
758
|
-
/** Session module - track visitor sessions (all
|
|
868
|
+
/** Session module - track visitor sessions (all tiers, null when disabled) */
|
|
759
869
|
session: SessionModule | null;
|
|
760
|
-
/** Heartbeat module - track video watching (
|
|
870
|
+
/** Heartbeat module - track video watching (standard/pro tier) */
|
|
761
871
|
heartbeat: HeartbeatModule | null;
|
|
762
|
-
/** Interactions module - like/follow channels (
|
|
872
|
+
/** Interactions module - like/follow channels (standard/pro tier) */
|
|
763
873
|
interactions: InteractionsModule | null;
|
|
764
|
-
/** Guide UI module - channel browser UI (
|
|
874
|
+
/** Guide UI module - channel browser UI (standard/pro tier) */
|
|
765
875
|
guideUI: GuideUIModule | null;
|
|
766
|
-
/** Chat UI module - real-time chat UI (
|
|
876
|
+
/** Chat UI module - real-time chat UI (standard/pro tier) */
|
|
767
877
|
chatUI: ChatUIModule | null;
|
|
768
|
-
/** Admin Panel module - Video/Mod tabs (pro
|
|
878
|
+
/** Admin Panel module - Video/Mod tabs (pro tier only) */
|
|
769
879
|
adminPanel: AdminPanelUIModule | null;
|
|
880
|
+
/** UI scale - fixed at 1.0. DCL's UI system auto-scales based on viewport. */
|
|
881
|
+
readonly uiScale: number;
|
|
882
|
+
/** Get the API base URL (for internal module use) */
|
|
883
|
+
getBaseUrl(): string;
|
|
770
884
|
/**
|
|
771
885
|
* Create a new StaticTVClient
|
|
772
886
|
*
|
|
773
887
|
* @param config Configuration options
|
|
774
888
|
*
|
|
775
|
-
* @example
|
|
889
|
+
* @example Free tier (session tracking only):
|
|
890
|
+
* ```typescript
|
|
891
|
+
* const staticTV = new StaticTVClient({
|
|
892
|
+
* apiKey: 'dcls_your_key_here'
|
|
893
|
+
* })
|
|
894
|
+
* ```
|
|
895
|
+
*
|
|
896
|
+
* @example Standard/Pro with video screen (SDK handles playback):
|
|
776
897
|
* ```typescript
|
|
777
|
-
*
|
|
898
|
+
* // Create your video screen
|
|
899
|
+
* const screen = engine.addEntity()
|
|
900
|
+
* Transform.create(screen, { position: Vector3.create(8, 3, 14), scale: Vector3.create(8, 4.5, 0.1) })
|
|
901
|
+
* MeshRenderer.setPlane(screen)
|
|
902
|
+
*
|
|
903
|
+
* // SDK handles everything - Guide selection + Pro admin controls just work
|
|
904
|
+
* const staticTV = new StaticTVClient({
|
|
905
|
+
* apiKey: 'dcls_your_key_here',
|
|
906
|
+
* videoScreen: screen // That's it! SDK manages video playback
|
|
907
|
+
* })
|
|
778
908
|
*
|
|
779
909
|
* export function main() {
|
|
780
|
-
*
|
|
781
|
-
* staticTV = new StaticTVClient({
|
|
782
|
-
* apiKey: 'dcls_your_key_here'
|
|
783
|
-
* })
|
|
784
|
-
* // Session tracking starts automatically!
|
|
910
|
+
* staticTV.setupUI()
|
|
785
911
|
* }
|
|
786
912
|
* ```
|
|
787
913
|
*/
|
|
@@ -795,8 +921,16 @@ declare class StaticTVClient {
|
|
|
795
921
|
*/
|
|
796
922
|
get isDisabled(): boolean;
|
|
797
923
|
/**
|
|
798
|
-
*
|
|
799
|
-
|
|
924
|
+
* Get the current SDK tier (free, standard, or pro)
|
|
925
|
+
*/
|
|
926
|
+
get tier(): SDKTier;
|
|
927
|
+
/**
|
|
928
|
+
* Check if this is a free tier client (session tracking only)
|
|
929
|
+
* Returns true until session confirms a higher tier
|
|
930
|
+
*/
|
|
931
|
+
get isFree(): boolean;
|
|
932
|
+
/**
|
|
933
|
+
* @deprecated Use `isFree` instead. Kept for backward compatibility.
|
|
800
934
|
*/
|
|
801
935
|
get isLite(): boolean;
|
|
802
936
|
/**
|
|
@@ -805,28 +939,79 @@ declare class StaticTVClient {
|
|
|
805
939
|
*/
|
|
806
940
|
request<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
807
941
|
/**
|
|
808
|
-
* Log a message
|
|
942
|
+
* Log a debug message (only when debug: true)
|
|
809
943
|
* @internal
|
|
810
944
|
*/
|
|
811
945
|
log(message: string, ...args: unknown[]): void;
|
|
946
|
+
/**
|
|
947
|
+
* Log a warning (always shown)
|
|
948
|
+
* @internal
|
|
949
|
+
*/
|
|
950
|
+
warn(message: string): void;
|
|
951
|
+
/**
|
|
952
|
+
* Log an error (always shown, user-friendly format)
|
|
953
|
+
* @internal
|
|
954
|
+
*/
|
|
955
|
+
error(message: string, err?: unknown): void;
|
|
812
956
|
/**
|
|
813
957
|
* Get the current configuration
|
|
814
958
|
* @internal
|
|
815
959
|
*/
|
|
816
960
|
getConfig(): StaticTVConfig;
|
|
961
|
+
private _currentVideoUrl;
|
|
962
|
+
/**
|
|
963
|
+
* Play a video on the configured videoScreen entity.
|
|
964
|
+
* Called by Guide UI and Admin Panel.
|
|
965
|
+
*
|
|
966
|
+
* @param url Video URL to play
|
|
967
|
+
*/
|
|
968
|
+
playVideo(url: string): void;
|
|
969
|
+
/**
|
|
970
|
+
* Stop video playback on the configured videoScreen entity.
|
|
971
|
+
* Called by Admin Panel.
|
|
972
|
+
*/
|
|
973
|
+
stopVideo(): void;
|
|
974
|
+
/**
|
|
975
|
+
* Get the currently playing video URL
|
|
976
|
+
*/
|
|
977
|
+
get currentVideoUrl(): string;
|
|
978
|
+
/**
|
|
979
|
+
* Internal handler for Guide video selection
|
|
980
|
+
* @internal
|
|
981
|
+
*/
|
|
982
|
+
_handleGuideVideoSelect(video: GuideVideo): void;
|
|
817
983
|
/**
|
|
818
|
-
*
|
|
984
|
+
* Internal handler for broadcast messages
|
|
819
985
|
* @internal
|
|
820
986
|
*/
|
|
821
|
-
|
|
987
|
+
_handleBroadcast(text: string): void;
|
|
822
988
|
/**
|
|
823
|
-
*
|
|
824
|
-
*
|
|
989
|
+
* Initialize standard feature modules (guide, heartbeat, interactions, UI)
|
|
990
|
+
* @internal
|
|
991
|
+
*/
|
|
992
|
+
private _initStandardModules;
|
|
993
|
+
/**
|
|
994
|
+
* Initialize pro feature modules (admin panel)
|
|
995
|
+
* @internal
|
|
996
|
+
*/
|
|
997
|
+
private _initProModules;
|
|
998
|
+
/**
|
|
999
|
+
* Called by SessionModule when server returns the tier
|
|
1000
|
+
* Enables modules based on tier level
|
|
1001
|
+
* @internal
|
|
1002
|
+
*/
|
|
1003
|
+
_enableFeaturesForTier(tier: SDKTier, keyId?: string | null): void;
|
|
1004
|
+
/**
|
|
1005
|
+
* @deprecated Use `_enableFeaturesForTier` instead
|
|
825
1006
|
* @internal
|
|
826
1007
|
*/
|
|
827
1008
|
_enableFullFeatures(): void;
|
|
828
1009
|
/**
|
|
829
|
-
* Check if
|
|
1010
|
+
* Check if standard features are enabled (guide, chat, etc.)
|
|
1011
|
+
*/
|
|
1012
|
+
get hasStandardFeatures(): boolean;
|
|
1013
|
+
/**
|
|
1014
|
+
* @deprecated Use `hasStandardFeatures` instead
|
|
830
1015
|
*/
|
|
831
1016
|
get hasFullFeatures(): boolean;
|
|
832
1017
|
/**
|
|
@@ -834,52 +1019,122 @@ declare class StaticTVClient {
|
|
|
834
1019
|
*/
|
|
835
1020
|
get hasProFeatures(): boolean;
|
|
836
1021
|
/**
|
|
837
|
-
*
|
|
1022
|
+
* @deprecated Use `tier` instead
|
|
838
1023
|
*/
|
|
839
1024
|
get sdkType(): 'lite' | 'full';
|
|
840
1025
|
/**
|
|
841
|
-
*
|
|
842
|
-
*
|
|
1026
|
+
* Configure Pro features (Admin Panel with Video + Mod tabs)
|
|
1027
|
+
*
|
|
1028
|
+
* **OPTIONAL**: If you set `videoScreen` in the constructor, you don't need
|
|
1029
|
+
* to call this method - the Admin Panel will auto-enable with sensible defaults.
|
|
1030
|
+
*
|
|
1031
|
+
* Use this method only if you need:
|
|
1032
|
+
* - Custom scene tab UI
|
|
1033
|
+
* - Custom panel title/styling
|
|
1034
|
+
* - Advanced command handlers
|
|
843
1035
|
*
|
|
844
1036
|
* @param config Admin panel configuration
|
|
845
1037
|
*
|
|
846
|
-
* @example
|
|
1038
|
+
* @example Using videoScreen (recommended - no enableProFeatures needed):
|
|
847
1039
|
* ```typescript
|
|
848
|
-
* const staticTV = new StaticTVClient({
|
|
1040
|
+
* const staticTV = new StaticTVClient({
|
|
1041
|
+
* apiKey: 'dcls_...',
|
|
1042
|
+
* videoScreen: myScreen // Admin Panel auto-enabled for Pro tier!
|
|
1043
|
+
* })
|
|
1044
|
+
* ```
|
|
849
1045
|
*
|
|
850
|
-
*
|
|
1046
|
+
* @example Advanced: Custom scene tabs
|
|
1047
|
+
* ```typescript
|
|
851
1048
|
* staticTV.enableProFeatures({
|
|
852
|
-
* sceneId: 'my-scene',
|
|
853
1049
|
* title: 'MY SCENE ADMIN',
|
|
854
|
-
*
|
|
855
|
-
* onVideoStop: () => videoPlayer.stop(),
|
|
856
|
-
* onBroadcast: (text) => showNotification(text)
|
|
1050
|
+
* sceneTabs: [{ label: 'LIGHTS', id: 'lights', render: () => <LightsTab /> }]
|
|
857
1051
|
* })
|
|
858
1052
|
* ```
|
|
859
1053
|
*/
|
|
860
|
-
enableProFeatures(config
|
|
1054
|
+
enableProFeatures(config?: AdminPanelConfig): void;
|
|
1055
|
+
/**
|
|
1056
|
+
* Register a custom scene tab for the admin panel (Pro tier)
|
|
1057
|
+
* Must call enableProFeatures() first.
|
|
1058
|
+
*
|
|
1059
|
+
* @param tab The tab definition with label, id, and render function
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```typescript
|
|
1063
|
+
* staticTV.registerSceneTab({
|
|
1064
|
+
* label: 'LIGHTS',
|
|
1065
|
+
* id: 'lights',
|
|
1066
|
+
* render: () => <MyLightsControls />
|
|
1067
|
+
* })
|
|
1068
|
+
* ```
|
|
1069
|
+
*/
|
|
1070
|
+
registerSceneTab(tab: SceneTabDefinition): void;
|
|
1071
|
+
/**
|
|
1072
|
+
* Close Admin/Guide panels (they share the same screen space)
|
|
1073
|
+
* Chat is independent and stays open.
|
|
1074
|
+
* @param except The panel that should stay open: 'admin' | 'guide'
|
|
1075
|
+
*/
|
|
1076
|
+
closeOtherPanels(except: 'admin' | 'guide'): void;
|
|
861
1077
|
/**
|
|
862
|
-
*
|
|
863
|
-
*
|
|
1078
|
+
* Set up the UI renderer for all SDK panels
|
|
1079
|
+
* Call this in your scene's main() function to render Guide, Chat, Admin panels.
|
|
1080
|
+
* No need to create your own ui.tsx - the SDK handles everything.
|
|
864
1081
|
*
|
|
865
|
-
* @
|
|
1082
|
+
* @example
|
|
1083
|
+
* ```typescript
|
|
1084
|
+
* const staticTV = new StaticTVClient({ apiKey: 'dcls_...' })
|
|
1085
|
+
*
|
|
1086
|
+
* export function main() {
|
|
1087
|
+
* staticTV.setupUI()
|
|
1088
|
+
* // That's it! All panels will render automatically
|
|
1089
|
+
* }
|
|
1090
|
+
* ```
|
|
1091
|
+
*/
|
|
1092
|
+
setupUI(): void;
|
|
1093
|
+
/**
|
|
1094
|
+
* Show a notification message on screen
|
|
1095
|
+
* Works with both SDK-rendered UI and custom UI setups.
|
|
1096
|
+
*
|
|
1097
|
+
* @param message The message to display
|
|
1098
|
+
* @param durationMs How long to show (default 5000ms)
|
|
866
1099
|
*
|
|
867
1100
|
* @example
|
|
868
1101
|
* ```typescript
|
|
869
|
-
* staticTV.
|
|
870
|
-
*
|
|
871
|
-
* id: 'lights',
|
|
872
|
-
* render: () => <MyLightsControls />
|
|
873
|
-
* })
|
|
1102
|
+
* staticTV.showNotification('Stream started!')
|
|
1103
|
+
* staticTV.showNotification('Custom message', 10000) // 10 seconds
|
|
874
1104
|
* ```
|
|
875
1105
|
*/
|
|
876
|
-
|
|
1106
|
+
showNotification(message: string, durationMs?: number): void;
|
|
877
1107
|
/**
|
|
878
1108
|
* Cleanup when done (call before scene unload)
|
|
879
1109
|
*/
|
|
880
1110
|
destroy(): Promise<void>;
|
|
881
1111
|
}
|
|
882
1112
|
|
|
1113
|
+
/**
|
|
1114
|
+
* UI Renderer - SDK-level UI component that renders all panels
|
|
1115
|
+
*
|
|
1116
|
+
* This allows scenes to use the SDK's UI without needing their own ui.tsx file.
|
|
1117
|
+
* Just call staticTV.setupUI() and all panels will render automatically.
|
|
1118
|
+
*/
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* Show a notification message on screen
|
|
1122
|
+
* @param message The message to display
|
|
1123
|
+
* @param durationMs How long to show (default 5000ms)
|
|
1124
|
+
*/
|
|
1125
|
+
declare function showNotification(message: string, durationMs?: number): void;
|
|
1126
|
+
/**
|
|
1127
|
+
* Set up the UI renderer for a StaticTVClient
|
|
1128
|
+
* Call this in your scene's main() function after creating the client.
|
|
1129
|
+
*
|
|
1130
|
+
* @example
|
|
1131
|
+
* ```typescript
|
|
1132
|
+
* const staticTV = new StaticTVClient({ apiKey: 'dcls_...' })
|
|
1133
|
+
* setupStaticUI(staticTV)
|
|
1134
|
+
* ```
|
|
1135
|
+
*/
|
|
1136
|
+
declare function setupStaticUI(client: StaticTVClient): void;
|
|
1137
|
+
|
|
883
1138
|
/**
|
|
884
1139
|
* Identity utilities for getting player information
|
|
885
1140
|
* Uses getUserData from ~system/UserIdentity for reliable data in both
|
|
@@ -904,4 +1159,4 @@ declare function getPlayerWallet(): string | null;
|
|
|
904
1159
|
*/
|
|
905
1160
|
declare function getPlayerDisplayName(): string | null;
|
|
906
1161
|
|
|
907
|
-
export { type AdminPanelConfig, AdminPanelUIModule, type Channel, type ChatChannel, type ChatMessage, type ChatUIConfig, ChatUIModule, type CommandHandler, type GuideFeaturedPlaylist, GuideModule, type GuideResponse, type GuideUIConfig, GuideUIModule, type GuideVideo, HeartbeatModule, type HeartbeatResponse, type InteractionResponse, InteractionsModule, KEY_TYPE_CHANNEL, KEY_TYPE_SCENE, type PlayerData, type SceneStats, type SceneStatsResponse, type SceneTabDefinition, SessionModule, type SessionResponse, StaticTVClient, type StaticTVConfig, type StreamData, type VideoSlot, type Vod, fetchUserData, getPlayerDisplayName, getPlayerWallet };
|
|
1162
|
+
export { type AdminPanelConfig, AdminPanelUIModule, type Channel, type ChatChannel, type ChatMessage, type ChatUIConfig, ChatUIModule, type CommandHandler, type GuideFeaturedPlaylist, GuideModule, type GuideResponse, type GuideUIConfig, GuideUIModule, type GuideVideo, HeartbeatModule, type HeartbeatResponse, type InteractionResponse, InteractionsModule, KEY_TYPE_CHANNEL, KEY_TYPE_SCENE, type PlayerData, type SDKTier, type SceneStats, type SceneStatsResponse, type SceneTabDefinition, SessionModule, type SessionResponse, StaticTVClient, type StaticTVConfig, type StreamData, type VideoSlot, type Vod, fetchUserData, getPlayerDisplayName, getPlayerWallet, setupStaticUI, showNotification };
|