@thestatic-tv/dcl-sdk 2.6.1 → 2.7.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 +6 -1
- package/dist/index.d.mts +19 -5
- package/dist/index.d.ts +19 -5
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ staticTV.guideUI.toggle()
|
|
|
99
99
|
staticTV.chatUI.toggle()
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
## In-world admin, chat
|
|
102
|
+
## In-world admin, chat, watch time (2.6.0) and session tracking (2.7.0)
|
|
103
103
|
|
|
104
104
|
The Admin Panel, Chat, the watch heartbeat and like/follow send DCL signed requests: Decentraland
|
|
105
105
|
signs each one as the player, and thestatic.tv checks that it came from the scene deployed where
|
|
@@ -110,6 +110,11 @@ update and redeploy your scene to keep them working. Chill to Earn credits the p
|
|
|
110
110
|
the heartbeat; a guest's minutes count for the channel but earn nothing, and a guest cannot like
|
|
111
111
|
or follow.
|
|
112
112
|
|
|
113
|
+
Since 2.7.0 the session calls (enter, heartbeat, leave) are signed too, on every tier: the visitor
|
|
114
|
+
in your analytics is the player who signed them, and the SDK names no wallet. A scene on an older
|
|
115
|
+
SDK keeps every feature after the server change; its visitors read as anonymous in analytics until
|
|
116
|
+
it updates.
|
|
117
|
+
|
|
113
118
|
## Pricing & Tiers
|
|
114
119
|
|
|
115
120
|
See [thestatic.tv/info](https://thestatic.tv/info) for current pricing and tier features.
|
package/dist/index.d.mts
CHANGED
|
@@ -15,9 +15,14 @@ declare global {
|
|
|
15
15
|
* Player identity data from DCL
|
|
16
16
|
*/
|
|
17
17
|
interface PlayerData {
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Player's wallet address (userId from DCL).
|
|
20
|
+
* @deprecated Since 2.7.0 the session calls are DCL signed requests and thestatic.tv records the
|
|
21
|
+
* signer as the visitor, so the server never reads this for sessions and the SDK sends no wallet
|
|
22
|
+
* in them. Kept for compatibility; only the read-only `getStats()` query still uses it.
|
|
23
|
+
*/
|
|
19
24
|
wallet?: string;
|
|
20
|
-
/** Player's display name */
|
|
25
|
+
/** Player's display name - sent with the session's enter call */
|
|
21
26
|
name?: string;
|
|
22
27
|
}
|
|
23
28
|
|
|
@@ -89,13 +94,15 @@ interface StaticTVConfig {
|
|
|
89
94
|
baseUrl?: string;
|
|
90
95
|
apiUrl?: string;
|
|
91
96
|
/**
|
|
92
|
-
* Player data from DCL - pass from your scene's getPlayer() call
|
|
97
|
+
* Player data from DCL - pass from your scene's getPlayer() call.
|
|
98
|
+
* `name` goes with the session's enter call; `wallet` is deprecated (see PlayerData) - the
|
|
99
|
+
* signed session identifies the visitor itself.
|
|
93
100
|
* @example
|
|
94
101
|
* import { getPlayer } from '@dcl/sdk/players'
|
|
95
102
|
* const player = getPlayer()
|
|
96
103
|
* new StaticTVClient({
|
|
97
104
|
* apiKey: 'dcls_...',
|
|
98
|
-
* player: {
|
|
105
|
+
* player: { name: player?.name }
|
|
99
106
|
* })
|
|
100
107
|
*/
|
|
101
108
|
player?: PlayerData;
|
|
@@ -463,6 +470,11 @@ declare class GuideModule {
|
|
|
463
470
|
* Works with both channel keys (dclk_) and scene keys (dcls_).
|
|
464
471
|
* Scene keys use /scene-session endpoint, channel keys use /session.
|
|
465
472
|
*
|
|
473
|
+
* Enter, heartbeat and leave are DCL signed requests (2.7.0): the explorer signs each one as the
|
|
474
|
+
* player and thestatic.tv records that proven wallet as the visitor. They name no wallet - earlier
|
|
475
|
+
* versions put one in the enter body, and the server took it as the visitor. An unsigned call
|
|
476
|
+
* still gets its tier and every answer, its visitor recorded as anonymous.
|
|
477
|
+
*
|
|
466
478
|
* Includes automatic boundary detection to ensure metrics only track
|
|
467
479
|
* players who are actually within the scene's parcel boundaries.
|
|
468
480
|
*/
|
|
@@ -509,7 +521,9 @@ declare class SessionModule {
|
|
|
509
521
|
*/
|
|
510
522
|
private getEndpoint;
|
|
511
523
|
/**
|
|
512
|
-
* Get player wallet - prioritize config, fallback to runtime detection
|
|
524
|
+
* Get player wallet - prioritize config, fallback to runtime detection.
|
|
525
|
+
* Only the read-only getStats() query uses it (2.7.0): the session calls are signed and name
|
|
526
|
+
* no wallet, so the signer is the visitor.
|
|
513
527
|
*/
|
|
514
528
|
private getWallet;
|
|
515
529
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -15,9 +15,14 @@ declare global {
|
|
|
15
15
|
* Player identity data from DCL
|
|
16
16
|
*/
|
|
17
17
|
interface PlayerData {
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Player's wallet address (userId from DCL).
|
|
20
|
+
* @deprecated Since 2.7.0 the session calls are DCL signed requests and thestatic.tv records the
|
|
21
|
+
* signer as the visitor, so the server never reads this for sessions and the SDK sends no wallet
|
|
22
|
+
* in them. Kept for compatibility; only the read-only `getStats()` query still uses it.
|
|
23
|
+
*/
|
|
19
24
|
wallet?: string;
|
|
20
|
-
/** Player's display name */
|
|
25
|
+
/** Player's display name - sent with the session's enter call */
|
|
21
26
|
name?: string;
|
|
22
27
|
}
|
|
23
28
|
|
|
@@ -89,13 +94,15 @@ interface StaticTVConfig {
|
|
|
89
94
|
baseUrl?: string;
|
|
90
95
|
apiUrl?: string;
|
|
91
96
|
/**
|
|
92
|
-
* Player data from DCL - pass from your scene's getPlayer() call
|
|
97
|
+
* Player data from DCL - pass from your scene's getPlayer() call.
|
|
98
|
+
* `name` goes with the session's enter call; `wallet` is deprecated (see PlayerData) - the
|
|
99
|
+
* signed session identifies the visitor itself.
|
|
93
100
|
* @example
|
|
94
101
|
* import { getPlayer } from '@dcl/sdk/players'
|
|
95
102
|
* const player = getPlayer()
|
|
96
103
|
* new StaticTVClient({
|
|
97
104
|
* apiKey: 'dcls_...',
|
|
98
|
-
* player: {
|
|
105
|
+
* player: { name: player?.name }
|
|
99
106
|
* })
|
|
100
107
|
*/
|
|
101
108
|
player?: PlayerData;
|
|
@@ -463,6 +470,11 @@ declare class GuideModule {
|
|
|
463
470
|
* Works with both channel keys (dclk_) and scene keys (dcls_).
|
|
464
471
|
* Scene keys use /scene-session endpoint, channel keys use /session.
|
|
465
472
|
*
|
|
473
|
+
* Enter, heartbeat and leave are DCL signed requests (2.7.0): the explorer signs each one as the
|
|
474
|
+
* player and thestatic.tv records that proven wallet as the visitor. They name no wallet - earlier
|
|
475
|
+
* versions put one in the enter body, and the server took it as the visitor. An unsigned call
|
|
476
|
+
* still gets its tier and every answer, its visitor recorded as anonymous.
|
|
477
|
+
*
|
|
466
478
|
* Includes automatic boundary detection to ensure metrics only track
|
|
467
479
|
* players who are actually within the scene's parcel boundaries.
|
|
468
480
|
*/
|
|
@@ -509,7 +521,9 @@ declare class SessionModule {
|
|
|
509
521
|
*/
|
|
510
522
|
private getEndpoint;
|
|
511
523
|
/**
|
|
512
|
-
* Get player wallet - prioritize config, fallback to runtime detection
|
|
524
|
+
* Get player wallet - prioritize config, fallback to runtime detection.
|
|
525
|
+
* Only the read-only getStats() query uses it (2.7.0): the session calls are signed and name
|
|
526
|
+
* no wallet, so the signer is the visitor.
|
|
513
527
|
*/
|
|
514
528
|
private getWallet;
|
|
515
529
|
/**
|
package/dist/index.js
CHANGED
|
@@ -420,7 +420,9 @@ var SessionModule = class {
|
|
|
420
420
|
return this.client.keyType === "scene" ? "/scene-session" : "/session";
|
|
421
421
|
}
|
|
422
422
|
/**
|
|
423
|
-
* Get player wallet - prioritize config, fallback to runtime detection
|
|
423
|
+
* Get player wallet - prioritize config, fallback to runtime detection.
|
|
424
|
+
* Only the read-only getStats() query uses it (2.7.0): the session calls are signed and name
|
|
425
|
+
* no wallet, so the signer is the visitor.
|
|
424
426
|
*/
|
|
425
427
|
getWallet() {
|
|
426
428
|
const config = this.client.getConfig();
|
|
@@ -463,14 +465,12 @@ var SessionModule = class {
|
|
|
463
465
|
}
|
|
464
466
|
await this.initializeBounds();
|
|
465
467
|
try {
|
|
466
|
-
const walletAddress = this.getWallet();
|
|
467
468
|
const dclDisplayName = this.getDisplayName();
|
|
468
|
-
this.client.log(`Starting session
|
|
469
|
-
const response = await this.client.
|
|
469
|
+
this.client.log(`Starting session (signed) - name: ${dclDisplayName}`);
|
|
470
|
+
const response = await this.client.signedRequest(this.getEndpoint(), {
|
|
470
471
|
method: "POST",
|
|
471
472
|
body: JSON.stringify({
|
|
472
473
|
action: "enter",
|
|
473
|
-
walletAddress,
|
|
474
474
|
dclDisplayName,
|
|
475
475
|
metadata
|
|
476
476
|
})
|
|
@@ -522,7 +522,7 @@ var SessionModule = class {
|
|
|
522
522
|
this._outOfBoundsCount = 0;
|
|
523
523
|
}
|
|
524
524
|
try {
|
|
525
|
-
await this.client.
|
|
525
|
+
await this.client.signedRequest(this.getEndpoint(), {
|
|
526
526
|
method: "POST",
|
|
527
527
|
body: JSON.stringify({
|
|
528
528
|
action: "heartbeat",
|
|
@@ -547,7 +547,7 @@ var SessionModule = class {
|
|
|
547
547
|
}
|
|
548
548
|
if (this.sessionId) {
|
|
549
549
|
try {
|
|
550
|
-
await this.client.
|
|
550
|
+
await this.client.signedRequest(this.getEndpoint(), {
|
|
551
551
|
method: "POST",
|
|
552
552
|
body: JSON.stringify({
|
|
553
553
|
action: "leave",
|
package/dist/index.mjs
CHANGED
|
@@ -372,7 +372,9 @@ var SessionModule = class {
|
|
|
372
372
|
return this.client.keyType === "scene" ? "/scene-session" : "/session";
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
|
-
* Get player wallet - prioritize config, fallback to runtime detection
|
|
375
|
+
* Get player wallet - prioritize config, fallback to runtime detection.
|
|
376
|
+
* Only the read-only getStats() query uses it (2.7.0): the session calls are signed and name
|
|
377
|
+
* no wallet, so the signer is the visitor.
|
|
376
378
|
*/
|
|
377
379
|
getWallet() {
|
|
378
380
|
const config = this.client.getConfig();
|
|
@@ -415,14 +417,12 @@ var SessionModule = class {
|
|
|
415
417
|
}
|
|
416
418
|
await this.initializeBounds();
|
|
417
419
|
try {
|
|
418
|
-
const walletAddress = this.getWallet();
|
|
419
420
|
const dclDisplayName = this.getDisplayName();
|
|
420
|
-
this.client.log(`Starting session
|
|
421
|
-
const response = await this.client.
|
|
421
|
+
this.client.log(`Starting session (signed) - name: ${dclDisplayName}`);
|
|
422
|
+
const response = await this.client.signedRequest(this.getEndpoint(), {
|
|
422
423
|
method: "POST",
|
|
423
424
|
body: JSON.stringify({
|
|
424
425
|
action: "enter",
|
|
425
|
-
walletAddress,
|
|
426
426
|
dclDisplayName,
|
|
427
427
|
metadata
|
|
428
428
|
})
|
|
@@ -474,7 +474,7 @@ var SessionModule = class {
|
|
|
474
474
|
this._outOfBoundsCount = 0;
|
|
475
475
|
}
|
|
476
476
|
try {
|
|
477
|
-
await this.client.
|
|
477
|
+
await this.client.signedRequest(this.getEndpoint(), {
|
|
478
478
|
method: "POST",
|
|
479
479
|
body: JSON.stringify({
|
|
480
480
|
action: "heartbeat",
|
|
@@ -499,7 +499,7 @@ var SessionModule = class {
|
|
|
499
499
|
}
|
|
500
500
|
if (this.sessionId) {
|
|
501
501
|
try {
|
|
502
|
-
await this.client.
|
|
502
|
+
await this.client.signedRequest(this.getEndpoint(), {
|
|
503
503
|
method: "POST",
|
|
504
504
|
body: JSON.stringify({
|
|
505
505
|
action: "leave",
|
package/package.json
CHANGED