@thestatic-tv/dcl-sdk 2.6.0 → 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 CHANGED
@@ -99,7 +99,7 @@ staticTV.guideUI.toggle()
99
99
  staticTV.chatUI.toggle()
100
100
  ```
101
101
 
102
- ## In-world admin, chat and watch time (2.6.0)
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
- /** Player's wallet address (userId from DCL) */
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: { wallet: player?.userId, name: player?.name }
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
  /**
@@ -1196,6 +1210,14 @@ declare class StaticTVClient {
1196
1210
  * @internal
1197
1211
  */
1198
1212
  private _resolveFeaturesReady;
1213
+ /**
1214
+ * Called by SessionModule when the session could not start - the server
1215
+ * refused it (an unpaid legacy key, since 2026-10-07) or the request failed.
1216
+ * With no tier ever confirmed that is the free tier: onFeaturesReady() must
1217
+ * settle, never hang a scene awaiting it. A tier already confirmed stays.
1218
+ * @internal
1219
+ */
1220
+ _settleFeaturesAsFree(): void;
1199
1221
  /**
1200
1222
  * Called by SessionModule when server returns the tier
1201
1223
  * Enables modules based on tier level
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
- /** Player's wallet address (userId from DCL) */
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: { wallet: player?.userId, name: player?.name }
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
  /**
@@ -1196,6 +1210,14 @@ declare class StaticTVClient {
1196
1210
  * @internal
1197
1211
  */
1198
1212
  private _resolveFeaturesReady;
1213
+ /**
1214
+ * Called by SessionModule when the session could not start - the server
1215
+ * refused it (an unpaid legacy key, since 2026-10-07) or the request failed.
1216
+ * With no tier ever confirmed that is the free tier: onFeaturesReady() must
1217
+ * settle, never hang a scene awaiting it. A tier already confirmed stays.
1218
+ * @internal
1219
+ */
1220
+ _settleFeaturesAsFree(): void;
1199
1221
  /**
1200
1222
  * Called by SessionModule when server returns the tier
1201
1223
  * Enables modules based on tier level
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 with wallet: ${walletAddress}, name: ${dclDisplayName}`);
469
- const response = await this.client.request(this.getEndpoint(), {
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
  })
@@ -485,9 +485,11 @@ var SessionModule = class {
485
485
  this.client._enableFeaturesForTier(this._tier, this._keyId);
486
486
  return this.sessionId;
487
487
  }
488
+ this.client._settleFeaturesAsFree();
488
489
  return null;
489
490
  } catch (error) {
490
491
  this.client.log(`Failed to start session: ${error}`);
492
+ this.client._settleFeaturesAsFree();
491
493
  return null;
492
494
  }
493
495
  }
@@ -520,7 +522,7 @@ var SessionModule = class {
520
522
  this._outOfBoundsCount = 0;
521
523
  }
522
524
  try {
523
- await this.client.request(this.getEndpoint(), {
525
+ await this.client.signedRequest(this.getEndpoint(), {
524
526
  method: "POST",
525
527
  body: JSON.stringify({
526
528
  action: "heartbeat",
@@ -545,7 +547,7 @@ var SessionModule = class {
545
547
  }
546
548
  if (this.sessionId) {
547
549
  try {
548
- await this.client.request(this.getEndpoint(), {
550
+ await this.client.signedRequest(this.getEndpoint(), {
549
551
  method: "POST",
550
552
  body: JSON.stringify({
551
553
  action: "leave",
@@ -3986,11 +3988,6 @@ var StaticTVClient = class {
3986
3988
  return;
3987
3989
  }
3988
3990
  this.session = new SessionModule(this);
3989
- if (this._keyType === KEY_TYPE_CHANNEL) {
3990
- this._tier = "standard";
3991
- this._initStandardModules();
3992
- this._resolveFeaturesReady("standard");
3993
- }
3994
3991
  if (this.config.autoStartSession) {
3995
3992
  fetchUserData().then(() => {
3996
3993
  this.session.startSession().catch((err) => {
@@ -4490,6 +4487,19 @@ var StaticTVClient = class {
4490
4487
  this._featuresReadyResolve(tier);
4491
4488
  }
4492
4489
  }
4490
+ /**
4491
+ * Called by SessionModule when the session could not start - the server
4492
+ * refused it (an unpaid legacy key, since 2026-10-07) or the request failed.
4493
+ * With no tier ever confirmed that is the free tier: onFeaturesReady() must
4494
+ * settle, never hang a scene awaiting it. A tier already confirmed stays.
4495
+ * @internal
4496
+ */
4497
+ _settleFeaturesAsFree() {
4498
+ if (!this._featuresResolved) {
4499
+ this._tier = "free";
4500
+ this._resolveFeaturesReady("free");
4501
+ }
4502
+ }
4493
4503
  /**
4494
4504
  * Called by SessionModule when server returns the tier
4495
4505
  * Enables modules based on tier level
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 with wallet: ${walletAddress}, name: ${dclDisplayName}`);
421
- const response = await this.client.request(this.getEndpoint(), {
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
  })
@@ -437,9 +437,11 @@ var SessionModule = class {
437
437
  this.client._enableFeaturesForTier(this._tier, this._keyId);
438
438
  return this.sessionId;
439
439
  }
440
+ this.client._settleFeaturesAsFree();
440
441
  return null;
441
442
  } catch (error) {
442
443
  this.client.log(`Failed to start session: ${error}`);
444
+ this.client._settleFeaturesAsFree();
443
445
  return null;
444
446
  }
445
447
  }
@@ -472,7 +474,7 @@ var SessionModule = class {
472
474
  this._outOfBoundsCount = 0;
473
475
  }
474
476
  try {
475
- await this.client.request(this.getEndpoint(), {
477
+ await this.client.signedRequest(this.getEndpoint(), {
476
478
  method: "POST",
477
479
  body: JSON.stringify({
478
480
  action: "heartbeat",
@@ -497,7 +499,7 @@ var SessionModule = class {
497
499
  }
498
500
  if (this.sessionId) {
499
501
  try {
500
- await this.client.request(this.getEndpoint(), {
502
+ await this.client.signedRequest(this.getEndpoint(), {
501
503
  method: "POST",
502
504
  body: JSON.stringify({
503
505
  action: "leave",
@@ -3938,11 +3940,6 @@ var StaticTVClient = class {
3938
3940
  return;
3939
3941
  }
3940
3942
  this.session = new SessionModule(this);
3941
- if (this._keyType === KEY_TYPE_CHANNEL) {
3942
- this._tier = "standard";
3943
- this._initStandardModules();
3944
- this._resolveFeaturesReady("standard");
3945
- }
3946
3943
  if (this.config.autoStartSession) {
3947
3944
  fetchUserData().then(() => {
3948
3945
  this.session.startSession().catch((err) => {
@@ -4442,6 +4439,19 @@ var StaticTVClient = class {
4442
4439
  this._featuresReadyResolve(tier);
4443
4440
  }
4444
4441
  }
4442
+ /**
4443
+ * Called by SessionModule when the session could not start - the server
4444
+ * refused it (an unpaid legacy key, since 2026-10-07) or the request failed.
4445
+ * With no tier ever confirmed that is the free tier: onFeaturesReady() must
4446
+ * settle, never hang a scene awaiting it. A tier already confirmed stays.
4447
+ * @internal
4448
+ */
4449
+ _settleFeaturesAsFree() {
4450
+ if (!this._featuresResolved) {
4451
+ this._tier = "free";
4452
+ this._resolveFeaturesReady("free");
4453
+ }
4454
+ }
4445
4455
  /**
4446
4456
  * Called by SessionModule when server returns the tier
4447
4457
  * Enables modules based on tier level
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thestatic-tv/dcl-sdk",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Connect your Decentraland scene to thestatic.tv - full channel lineup, metrics tracking, and interactions",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",