@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/README.md
CHANGED
|
@@ -16,10 +16,9 @@ This SDK allows DCL scene builders to:
|
|
|
16
16
|
|
|
17
17
|
| Tier | Price | Features |
|
|
18
18
|
|------|-------|----------|
|
|
19
|
-
| **
|
|
20
|
-
| **
|
|
21
|
-
| **Pro** | $15/mo |
|
|
22
|
-
| **Custom** | $20/mo | Pro + Custom scene tabs for scene-specific controls |
|
|
19
|
+
| **Free** | $5/mo | Session/visitor tracking only |
|
|
20
|
+
| **Standard** | $10/mo | Free + Guide UI, Chat UI, Heartbeat, Interactions |
|
|
21
|
+
| **Pro** | $15/mo | Standard + Admin Panel (Video tab, Mod tab, Custom scene tabs) |
|
|
23
22
|
|
|
24
23
|
> **All keys use `dcls_` prefix** - the server determines your subscription level.
|
|
25
24
|
>
|
|
@@ -116,7 +115,7 @@ await staticTV.interactions.follow('channel-slug')
|
|
|
116
115
|
await staticTV.destroy()
|
|
117
116
|
```
|
|
118
117
|
|
|
119
|
-
##
|
|
118
|
+
## Free Tier (Visitor Tracking Only)
|
|
120
119
|
|
|
121
120
|
If you don't have a channel but want to track visitors to your scene:
|
|
122
121
|
|
|
@@ -139,14 +138,17 @@ export function main() {
|
|
|
139
138
|
}
|
|
140
139
|
```
|
|
141
140
|
|
|
142
|
-
3. Check
|
|
141
|
+
3. Check the current tier:
|
|
143
142
|
|
|
144
143
|
```typescript
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
// Check tier (free, standard, or pro)
|
|
145
|
+
console.log('Current tier:', staticTV.tier)
|
|
146
|
+
|
|
147
|
+
if (staticTV.isFree) {
|
|
148
|
+
console.log('Running in free tier - session tracking only')
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
// guide, heartbeat, and interactions are null in
|
|
151
|
+
// guide, heartbeat, and interactions are null in free tier
|
|
150
152
|
if (staticTV.guide) {
|
|
151
153
|
const channels = await staticTV.guide.getChannels()
|
|
152
154
|
}
|
|
@@ -173,25 +175,28 @@ Main client class for interacting with thestatic.tv.
|
|
|
173
175
|
| Property | Type | Description |
|
|
174
176
|
|----------|------|-------------|
|
|
175
177
|
| `keyType` | `'channel' \| 'scene'` | The detected key type |
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
178
|
+
| `tier` | `'free' \| 'standard' \| 'pro'` | Current subscription tier |
|
|
179
|
+
| `isFree` | `boolean` | `true` if free tier (session tracking only) |
|
|
180
|
+
| `hasStandardFeatures` | `boolean` | `true` if standard features enabled |
|
|
181
|
+
| `hasProFeatures` | `boolean` | `true` if pro features enabled |
|
|
182
|
+
| `guide` | `GuideModule \| null` | Guide module (null in free tier) |
|
|
179
183
|
| `session` | `SessionModule` | Session module (always available) |
|
|
180
|
-
| `heartbeat` | `HeartbeatModule \| null` | Heartbeat module (null in
|
|
181
|
-
| `interactions` | `InteractionsModule \| null` | Interactions module (null in
|
|
182
|
-
| `guideUI` | `GuideUIModule \| null` | Guide UI module (null in
|
|
183
|
-
| `chatUI` | `ChatUIModule \| null` | Chat UI module (null in
|
|
184
|
+
| `heartbeat` | `HeartbeatModule \| null` | Heartbeat module (null in free tier) |
|
|
185
|
+
| `interactions` | `InteractionsModule \| null` | Interactions module (null in free tier) |
|
|
186
|
+
| `guideUI` | `GuideUIModule \| null` | Guide UI module (null in free tier) |
|
|
187
|
+
| `chatUI` | `ChatUIModule \| null` | Chat UI module (null in free tier) |
|
|
184
188
|
| `adminPanel` | `AdminPanelUIModule \| null` | Admin panel (null until enableProFeatures() called) |
|
|
189
|
+
| `isLite` | `boolean` | **Deprecated**: Use `isFree` instead |
|
|
185
190
|
|
|
186
191
|
#### Methods
|
|
187
192
|
|
|
188
193
|
| Method | Description |
|
|
189
194
|
|--------|-------------|
|
|
190
195
|
| `enableProFeatures(config)` | Enable Pro tier admin panel |
|
|
191
|
-
| `registerSceneTab(tab)` | Add custom scene tab (
|
|
196
|
+
| `registerSceneTab(tab)` | Add custom scene tab (Pro tier) |
|
|
192
197
|
| `destroy()` | Cleanup before scene unload |
|
|
193
198
|
|
|
194
|
-
### Guide Module (
|
|
199
|
+
### Guide Module (Standard/Pro Tier)
|
|
195
200
|
|
|
196
201
|
```typescript
|
|
197
202
|
staticTV.guide.getChannels() // Get all channels (cached 30s)
|
|
@@ -210,9 +215,18 @@ staticTV.session.startSession() // Manually start session
|
|
|
210
215
|
staticTV.session.endSession() // End session
|
|
211
216
|
staticTV.session.getSessionId() // Get current session ID
|
|
212
217
|
staticTV.session.isSessionActive() // Check if session is active
|
|
218
|
+
|
|
219
|
+
// Get scene stats (visitors, sessions, etc.)
|
|
220
|
+
const stats = await staticTV.session.getStats()
|
|
221
|
+
if (stats) {
|
|
222
|
+
console.log('Total sessions today:', stats.totalSessions)
|
|
223
|
+
console.log('Unique visitors:', stats.uniqueVisitors)
|
|
224
|
+
console.log('Total minutes watched:', stats.totalMinutes)
|
|
225
|
+
console.log('You are visitor #', stats.visitorNumber)
|
|
226
|
+
}
|
|
213
227
|
```
|
|
214
228
|
|
|
215
|
-
### Heartbeat Module (
|
|
229
|
+
### Heartbeat Module (Standard/Pro Tier)
|
|
216
230
|
|
|
217
231
|
Track video watching. Each heartbeat represents 1 minute watched.
|
|
218
232
|
|
|
@@ -223,7 +237,7 @@ staticTV.heartbeat.getCurrentChannel() // Get currently watched channel
|
|
|
223
237
|
staticTV.heartbeat.isCurrentlyWatching() // Check if watching
|
|
224
238
|
```
|
|
225
239
|
|
|
226
|
-
### Interactions Module (
|
|
240
|
+
### Interactions Module (Standard/Pro Tier)
|
|
227
241
|
|
|
228
242
|
Like and follow channels. Requires wallet connection.
|
|
229
243
|
|
|
@@ -232,7 +246,7 @@ staticTV.interactions.like(channelSlug) // Like a channel
|
|
|
232
246
|
staticTV.interactions.follow(channelSlug) // Follow a channel
|
|
233
247
|
```
|
|
234
248
|
|
|
235
|
-
### Guide UI Module (
|
|
249
|
+
### Guide UI Module (Standard/Pro Tier)
|
|
236
250
|
|
|
237
251
|
Built-in channel browser UI. You provide a callback to handle video selection.
|
|
238
252
|
|
|
@@ -269,7 +283,7 @@ staticTV.guideUI.currentVideoId = 'video-id'
|
|
|
269
283
|
await staticTV.guideUI.refresh()
|
|
270
284
|
```
|
|
271
285
|
|
|
272
|
-
### Chat UI Module (
|
|
286
|
+
### Chat UI Module (Standard/Pro Tier)
|
|
273
287
|
|
|
274
288
|
Real-time chat with Firebase authentication.
|
|
275
289
|
|
|
@@ -325,7 +339,7 @@ export function main() {
|
|
|
325
339
|
|
|
326
340
|
// Enable admin panel (Pro tier)
|
|
327
341
|
staticTV.enableProFeatures({
|
|
328
|
-
sceneId
|
|
342
|
+
// sceneId is optional - defaults to your API key ID
|
|
329
343
|
title: 'MY SCENE ADMIN', // Panel header title
|
|
330
344
|
onVideoPlay: (url) => {
|
|
331
345
|
// Handle video playback in your scene
|
|
@@ -365,7 +379,7 @@ if (staticTV.adminPanel.hasAccess) { ... }
|
|
|
365
379
|
|
|
366
380
|
| Option | Type | Default | Description |
|
|
367
381
|
|--------|------|---------|-------------|
|
|
368
|
-
| `sceneId` | `string` |
|
|
382
|
+
| `sceneId` | `string` | API key ID | Scene ID for API calls (optional - defaults to your API key ID) |
|
|
369
383
|
| `title` | `string` | `'ADMIN PANEL'` | Header title |
|
|
370
384
|
| `headerColor` | `{r,g,b,a}` | red | Header background color |
|
|
371
385
|
| `showVideoTab` | `boolean` | `true` | Show Video tab |
|
|
@@ -378,7 +392,7 @@ if (staticTV.adminPanel.hasAccess) { ... }
|
|
|
378
392
|
| `footerLink` | `string` | scene page | Link shown in footer |
|
|
379
393
|
| `debug` | `boolean` | `false` | Enable debug logging |
|
|
380
394
|
|
|
381
|
-
### Custom Scene Tabs (
|
|
395
|
+
### Custom Scene Tabs (Pro Tier)
|
|
382
396
|
|
|
383
397
|
Add your own scene-specific control tabs to the admin panel:
|
|
384
398
|
|