@thestatic-tv/dcl-sdk 2.5.27 → 2.6.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/dist/index.mjs CHANGED
@@ -16,6 +16,9 @@ async function request(url, options = {}) {
16
16
  return response.json();
17
17
  }
18
18
 
19
+ // src/StaticTVClient.ts
20
+ import { signedFetch as signedFetch3 } from "~system/SignedFetch";
21
+
19
22
  // src/modules/guide.ts
20
23
  var GuideModule = class {
21
24
  // 30 seconds
@@ -208,6 +211,7 @@ import { engine as engine2, Transform } from "@dcl/sdk/ecs";
208
211
  import { getSceneInformation } from "~system/Runtime";
209
212
  var PARCEL_SIZE = 16;
210
213
  var cachedBounds = null;
214
+ var cachedParcelRects = [];
211
215
  var boundsInitialized = false;
212
216
  var boundsError = false;
213
217
  function parseParcel(parcel) {
@@ -243,6 +247,16 @@ async function getSceneBounds() {
243
247
  boundsError = true;
244
248
  return null;
245
249
  }
250
+ const base = baseParcel ? parseParcel(baseParcel) : coords[0];
251
+ if (!base) {
252
+ boundsError = true;
253
+ return null;
254
+ }
255
+ cachedParcelRects = coords.map((c) => {
256
+ const minX = (c.x - base.x) * PARCEL_SIZE;
257
+ const minZ = (c.z - base.z) * PARCEL_SIZE;
258
+ return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
259
+ });
246
260
  const worldMinX = Math.min(...coords.map((c) => c.x));
247
261
  const worldMaxX = Math.max(...coords.map((c) => c.x));
248
262
  const worldMinZ = Math.min(...coords.map((c) => c.z));
@@ -265,13 +279,15 @@ async function getSceneBounds() {
265
279
  return null;
266
280
  }
267
281
  }
268
- function isPlayerInBounds(bounds) {
282
+ function isPlayerInBounds(_bounds) {
269
283
  try {
270
284
  const transform = Transform.getOrNull(engine2.PlayerEntity);
271
285
  if (!transform) return false;
272
- const pos = transform.position;
286
+ const { x, z } = transform.position;
273
287
  const buffer = 0.5;
274
- return pos.x >= bounds.minX - buffer && pos.x <= bounds.maxX + buffer && pos.z >= bounds.minZ - buffer && pos.z <= bounds.maxZ + buffer;
288
+ return cachedParcelRects.some(
289
+ (r) => x >= r.minX - buffer && x <= r.maxX + buffer && z >= r.minZ - buffer && z <= r.maxZ + buffer
290
+ );
275
291
  } catch {
276
292
  return false;
277
293
  }
@@ -318,9 +334,12 @@ var SessionModule = class {
318
334
  return this._bounds;
319
335
  }
320
336
  /**
321
- * Check if player is currently within scene bounds
337
+ * Check if player is currently within scene bounds.
338
+ * Uses customBoundsCheck from config if provided, otherwise falls back to auto-detected parcel bounds.
322
339
  */
323
340
  isPlayerInScene() {
341
+ const customCheck = this.client.getConfig().customBoundsCheck;
342
+ if (customCheck) return customCheck();
324
343
  if (!this._bounds) return true;
325
344
  return isPlayerInBounds(this._bounds);
326
345
  }
@@ -573,13 +592,6 @@ var HeartbeatModule = class {
573
592
  this.currentChannel = null;
574
593
  this.isWatching = false;
575
594
  }
576
- /**
577
- * Get player wallet - prioritize config, fallback to runtime detection
578
- */
579
- getWallet() {
580
- const config = this.client.getConfig();
581
- return config.player?.wallet || getPlayerWallet();
582
- }
583
595
  /**
584
596
  * Send a watching heartbeat (1 heartbeat = 1 minute watched)
585
597
  * Only sends if player is within scene bounds
@@ -591,14 +603,9 @@ var HeartbeatModule = class {
591
603
  return;
592
604
  }
593
605
  try {
594
- const sessionId = this.client.session?.getSessionId();
595
- await this.client.request("/heartbeat", {
606
+ await this.client.signedRequest("/heartbeat", {
596
607
  method: "POST",
597
- body: JSON.stringify({
598
- channelSlug: this.currentChannel,
599
- walletAddress: this.getWallet(),
600
- sessionId
601
- })
608
+ body: JSON.stringify({ channelSlug: this.currentChannel })
602
609
  });
603
610
  this.client.log(`Heartbeat sent for ${this.currentChannel}`);
604
611
  } catch (error) {
@@ -638,13 +645,9 @@ var InteractionsModule = class {
638
645
  return null;
639
646
  }
640
647
  try {
641
- const response = await this.client.request("/interact", {
648
+ const response = await this.client.signedRequest("/interact", {
642
649
  method: "POST",
643
- body: JSON.stringify({
644
- action: "like",
645
- channelSlug,
646
- walletAddress
647
- })
650
+ body: JSON.stringify({ action: "like", channelSlug })
648
651
  });
649
652
  if (response.alreadyExists) {
650
653
  this.client.log(`Already liked ${channelSlug}`);
@@ -671,13 +674,9 @@ var InteractionsModule = class {
671
674
  return null;
672
675
  }
673
676
  try {
674
- const response = await this.client.request("/interact", {
677
+ const response = await this.client.signedRequest("/interact", {
675
678
  method: "POST",
676
- body: JSON.stringify({
677
- action: "follow",
678
- channelSlug,
679
- walletAddress
680
- })
679
+ body: JSON.stringify({ action: "follow", channelSlug })
681
680
  });
682
681
  if (response.alreadyExists) {
683
682
  this.client.log(`Already following ${channelSlug}`);
@@ -1615,7 +1614,6 @@ import { Color4 as Color44 } from "@dcl/sdk/math";
1615
1614
  import { signedFetch } from "~system/SignedFetch";
1616
1615
  import { getPlayer } from "@dcl/sdk/players";
1617
1616
  import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
1618
- var FIREBASE_API_KEY = "AIzaSyCX5jViDWUSagUmAX7S4OXgXyJZ9shaC5Y";
1619
1617
  var POLL_INTERVAL_ACTIVE = 5e3;
1620
1618
  var POLL_INTERVAL_PASSIVE = 3e4;
1621
1619
  var ChatUIModule = class {
@@ -1623,8 +1621,10 @@ var ChatUIModule = class {
1623
1621
  // Visibility state
1624
1622
  this._isVisible = false;
1625
1623
  this._unreadCount = 0;
1626
- // Authentication state
1627
- this.idToken = null;
1624
+ // Authentication state. There is no login token (thestatic.tv STATIC-01, 2026-10-07): the old
1625
+ // flow got a Firebase custom token from /api/auth/dcl, which any scene could ask for on a
1626
+ // visitor's behalf. Status and sends are now DCL signed requests bound to this scene.
1627
+ this.authChecked = false;
1628
1628
  this.isSigningIn = false;
1629
1629
  this.isRegisteredUser = false;
1630
1630
  this.currentUsername = "Guest";
@@ -1784,7 +1784,12 @@ var ChatUIModule = class {
1784
1784
  return baseUrl.replace("/api/v1/dcl", "");
1785
1785
  }
1786
1786
  async performAuth() {
1787
- if (this.isSigningIn || this.idToken) return;
1787
+ if (this.isSigningIn || this.authChecked) return;
1788
+ const sceneId = this.client.getSceneId();
1789
+ if (!sceneId) {
1790
+ this.client.log("Chat: no sceneId - signed chat needs the scene this SDK is registered as");
1791
+ return;
1792
+ }
1788
1793
  this.isSigningIn = true;
1789
1794
  try {
1790
1795
  const baseUrl = this.getBaseUrl();
@@ -1793,29 +1798,18 @@ var ChatUIModule = class {
1793
1798
  init: {
1794
1799
  method: "POST",
1795
1800
  headers: { "Content-Type": "application/json" },
1796
- body: JSON.stringify({})
1801
+ body: JSON.stringify({ sceneId })
1797
1802
  }
1798
1803
  });
1799
- if (!response.ok) throw new Error("Backend refused login");
1804
+ if (!response.ok) throw new Error("Backend refused the signed status check");
1800
1805
  const authData = JSON.parse(response.body);
1801
1806
  if (authData.username) this.currentUsername = authData.username;
1802
1807
  this.isRegisteredUser = !!authData.isRegistered;
1803
- const exchangeRes = await fetch(
1804
- `https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=${FIREBASE_API_KEY}`,
1805
- {
1806
- method: "POST",
1807
- headers: { "Content-Type": "application/json" },
1808
- body: JSON.stringify({ token: authData.token, returnSecureToken: true })
1809
- }
1810
- );
1811
- const exchangeData = await exchangeRes.json();
1812
- if (exchangeData.idToken) {
1813
- this.idToken = exchangeData.idToken;
1814
- if (this.inputText && this.isRegisteredUser) {
1815
- this.handleSend();
1816
- }
1808
+ this.authChecked = true;
1809
+ if (this.inputText && this.isRegisteredUser) {
1810
+ this.handleSend();
1817
1811
  }
1818
- this.client.log("Chat auth successful");
1812
+ this.client.log("Chat status checked");
1819
1813
  } catch (e) {
1820
1814
  this.client.log(`Chat auth failed: ${e}`);
1821
1815
  } finally {
@@ -1884,11 +1878,13 @@ var ChatUIModule = class {
1884
1878
  }
1885
1879
  async handleSend() {
1886
1880
  if (!this.inputText.trim()) return;
1887
- if (!this.idToken) {
1881
+ if (!this.authChecked) {
1888
1882
  await this.performAuth();
1889
1883
  return;
1890
1884
  }
1891
1885
  if (!this.isRegisteredUser) return;
1886
+ const sceneId = this.client.getSceneId();
1887
+ if (!sceneId) return;
1892
1888
  const message = this.inputText.trim();
1893
1889
  this.inputText = "";
1894
1890
  try {
@@ -1897,18 +1893,15 @@ var ChatUIModule = class {
1897
1893
  url: `${baseUrl}/api/chat/send`,
1898
1894
  init: {
1899
1895
  method: "POST",
1900
- headers: {
1901
- "Content-Type": "application/json",
1902
- Authorization: `Bearer ${this.idToken}`
1903
- },
1904
- body: JSON.stringify({ channelId: this.currentChannelId, text: message })
1896
+ headers: { "Content-Type": "application/json" },
1897
+ body: JSON.stringify({ channelId: this.currentChannelId, text: message, sceneId })
1905
1898
  }
1906
1899
  });
1907
1900
  if (response.ok) {
1908
1901
  await this.fetchMessages();
1909
1902
  this.resetChatTimer();
1910
- } else if (response.status === 401) {
1911
- this.idToken = null;
1903
+ } else if (response.status === 401 || response.status === 403) {
1904
+ this.authChecked = false;
1912
1905
  this.performAuth();
1913
1906
  }
1914
1907
  } catch (e) {
@@ -2412,6 +2405,7 @@ import ReactEcs5, { UiEntity as UiEntity5, Button as Button3, Label as Label5, I
2412
2405
  import { Color4 as Color45, Vector3 } from "@dcl/sdk/math";
2413
2406
  import { getPlayer as getPlayer2 } from "@dcl/sdk/players";
2414
2407
  import { movePlayerTo, openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
2408
+ import { signedFetch as signedFetch2 } from "~system/SignedFetch";
2415
2409
 
2416
2410
  // src/ui/ui-renderer.tsx
2417
2411
  import ReactEcs4, { ReactEcsRenderer, UiEntity as UiEntity4, Label as Label4 } from "@dcl/sdk/react-ecs";
@@ -3177,8 +3171,8 @@ var AdminPanelUIModule = class {
3177
3171
  return;
3178
3172
  }
3179
3173
  try {
3180
- const res = await fetch(
3181
- `${this.baseUrl}/scene/${this.config.sceneId}/admin-check?wallet=${player.userId}`
3174
+ const res = await this.signedRequest(
3175
+ `${this.baseUrl}/scene/${this.config.sceneId}/admin-check`
3182
3176
  );
3183
3177
  if (res.ok) {
3184
3178
  const data = await res.json();
@@ -3279,6 +3273,20 @@ var AdminPanelUIModule = class {
3279
3273
  this.log("Command polling stopped");
3280
3274
  }
3281
3275
  }
3276
+ /**
3277
+ * Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
3278
+ * explorer signs it with the player's identity, and the server checks the signature and that it
3279
+ * came from the scene deployed at this scene's registered location. A wallet named in a query or
3280
+ * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
3281
+ */
3282
+ async signedRequest(url, init = {}) {
3283
+ const res = await signedFetch2({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
3284
+ return {
3285
+ ok: res.ok,
3286
+ status: res.status,
3287
+ json: async () => res.body ? JSON.parse(res.body) : {}
3288
+ };
3289
+ }
3282
3290
  async pollCommands() {
3283
3291
  try {
3284
3292
  const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
@@ -3322,8 +3330,8 @@ var AdminPanelUIModule = class {
3322
3330
  async fetchStreamData() {
3323
3331
  if (this.streamFetched || !this.playerWallet) return;
3324
3332
  try {
3325
- const res = await fetch(
3326
- `${this.baseUrl}/scene/${this.config.sceneId}/stream?wallet=${this.playerWallet}`
3333
+ const res = await this.signedRequest(
3334
+ `${this.baseUrl}/scene/${this.config.sceneId}/stream`
3327
3335
  );
3328
3336
  if (res.ok) {
3329
3337
  this.streamData = await res.json();
@@ -3337,8 +3345,8 @@ var AdminPanelUIModule = class {
3337
3345
  async refreshStreamStatus() {
3338
3346
  if (!this.playerWallet) return;
3339
3347
  try {
3340
- const res = await fetch(
3341
- `${this.baseUrl}/scene/${this.config.sceneId}/stream?wallet=${this.playerWallet}`
3348
+ const res = await this.signedRequest(
3349
+ `${this.baseUrl}/scene/${this.config.sceneId}/stream`
3342
3350
  );
3343
3351
  if (res.ok) {
3344
3352
  this.streamData = await res.json();
@@ -3397,12 +3405,12 @@ var AdminPanelUIModule = class {
3397
3405
  this.channelCreateError = "";
3398
3406
  try {
3399
3407
  this.log("Creating channel for scene...");
3400
- const res = await fetch(
3408
+ const res = await this.signedRequest(
3401
3409
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/create`,
3402
3410
  {
3403
3411
  method: "POST",
3404
3412
  headers: { "Content-Type": "application/json" },
3405
- body: JSON.stringify({ wallet: this.playerWallet })
3413
+ body: JSON.stringify({})
3406
3414
  }
3407
3415
  );
3408
3416
  const data = await res.json();
@@ -3427,12 +3435,12 @@ var AdminPanelUIModule = class {
3427
3435
  this.trialClaimError = "";
3428
3436
  try {
3429
3437
  this.log("Claiming streaming trial...");
3430
- const res = await fetch(
3438
+ const res = await this.signedRequest(
3431
3439
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/claim-trial`,
3432
3440
  {
3433
3441
  method: "POST",
3434
3442
  headers: { "Content-Type": "application/json" },
3435
- body: JSON.stringify({ wallet: this.playerWallet })
3443
+ body: JSON.stringify({})
3436
3444
  }
3437
3445
  );
3438
3446
  const data = await res.json();
@@ -3457,12 +3465,12 @@ var AdminPanelUIModule = class {
3457
3465
  this.channelDeleteError = "";
3458
3466
  try {
3459
3467
  this.log("Deleting channel for scene...");
3460
- const res = await fetch(
3468
+ const res = await this.signedRequest(
3461
3469
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/delete`,
3462
3470
  {
3463
3471
  method: "POST",
3464
3472
  headers: { "Content-Type": "application/json" },
3465
- body: JSON.stringify({ wallet: this.playerWallet })
3473
+ body: JSON.stringify({})
3466
3474
  }
3467
3475
  );
3468
3476
  const data = await res.json();
@@ -3492,12 +3500,12 @@ var AdminPanelUIModule = class {
3492
3500
  this.streamControlStatus = "";
3493
3501
  try {
3494
3502
  this.log("Starting stream...");
3495
- const res = await fetch(
3503
+ const res = await this.signedRequest(
3496
3504
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3497
3505
  {
3498
3506
  method: "POST",
3499
3507
  headers: { "Content-Type": "application/json" },
3500
- body: JSON.stringify({ action: "start", wallet: this.playerWallet })
3508
+ body: JSON.stringify({ action: "start" })
3501
3509
  }
3502
3510
  );
3503
3511
  const data = await res.json();
@@ -3524,12 +3532,12 @@ var AdminPanelUIModule = class {
3524
3532
  this.streamControlStatus = "";
3525
3533
  try {
3526
3534
  this.log("Stopping stream...");
3527
- const res = await fetch(
3535
+ const res = await this.signedRequest(
3528
3536
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3529
3537
  {
3530
3538
  method: "POST",
3531
3539
  headers: { "Content-Type": "application/json" },
3532
- body: JSON.stringify({ action: "stop", wallet: this.playerWallet })
3540
+ body: JSON.stringify({ action: "stop" })
3533
3541
  }
3534
3542
  );
3535
3543
  const data = await res.json();
@@ -3555,12 +3563,12 @@ var AdminPanelUIModule = class {
3555
3563
  this.keyRotateStatus = "";
3556
3564
  try {
3557
3565
  this.log("Rotating stream key...");
3558
- const res = await fetch(
3566
+ const res = await this.signedRequest(
3559
3567
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3560
3568
  {
3561
3569
  method: "POST",
3562
3570
  headers: { "Content-Type": "application/json" },
3563
- body: JSON.stringify({ action: "rotateKey", wallet: this.playerWallet })
3571
+ body: JSON.stringify({ action: "rotateKey" })
3564
3572
  }
3565
3573
  );
3566
3574
  const data = await res.json();
@@ -3583,8 +3591,8 @@ var AdminPanelUIModule = class {
3583
3591
  if (!this.playerWallet) return;
3584
3592
  this.modStatus = "loading";
3585
3593
  try {
3586
- const res = await fetch(
3587
- `${this.baseUrl}/scene/${this.config.sceneId}/config?wallet=${this.playerWallet}`,
3594
+ const res = await this.signedRequest(
3595
+ `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3588
3596
  { headers: { "Content-Type": "application/json" } }
3589
3597
  );
3590
3598
  if (res.ok) {
@@ -3612,14 +3620,13 @@ var AdminPanelUIModule = class {
3612
3620
  if (this.sceneAdmins.includes(normalized)) return;
3613
3621
  this.modStatus = "loading";
3614
3622
  try {
3615
- const res = await fetch(
3623
+ const res = await this.signedRequest(
3616
3624
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3617
3625
  {
3618
3626
  method: "POST",
3619
3627
  headers: { "Content-Type": "application/json" },
3620
3628
  body: JSON.stringify({
3621
- sceneAdmins: [...this.sceneAdmins, normalized],
3622
- wallet: this.playerWallet
3629
+ sceneAdmins: [...this.sceneAdmins, normalized]
3623
3630
  })
3624
3631
  }
3625
3632
  );
@@ -3640,14 +3647,13 @@ var AdminPanelUIModule = class {
3640
3647
  if (!wallet || !this.playerWallet) return;
3641
3648
  this.modStatus = "loading";
3642
3649
  try {
3643
- const res = await fetch(
3650
+ const res = await this.signedRequest(
3644
3651
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3645
3652
  {
3646
3653
  method: "POST",
3647
3654
  headers: { "Content-Type": "application/json" },
3648
3655
  body: JSON.stringify({
3649
- sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet),
3650
- wallet: this.playerWallet
3656
+ sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet)
3651
3657
  })
3652
3658
  }
3653
3659
  );
@@ -3673,14 +3679,13 @@ var AdminPanelUIModule = class {
3673
3679
  if (this.bannedWallets.includes(normalized)) return;
3674
3680
  this.modStatus = "loading";
3675
3681
  try {
3676
- const res = await fetch(
3682
+ const res = await this.signedRequest(
3677
3683
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3678
3684
  {
3679
3685
  method: "POST",
3680
3686
  headers: { "Content-Type": "application/json" },
3681
3687
  body: JSON.stringify({
3682
- bannedWallets: [...this.bannedWallets, normalized],
3683
- wallet: this.playerWallet
3688
+ bannedWallets: [...this.bannedWallets, normalized]
3684
3689
  })
3685
3690
  }
3686
3691
  );
@@ -3702,14 +3707,13 @@ var AdminPanelUIModule = class {
3702
3707
  if (!wallet || !this.playerWallet) return;
3703
3708
  this.modStatus = "loading";
3704
3709
  try {
3705
- const res = await fetch(
3710
+ const res = await this.signedRequest(
3706
3711
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3707
3712
  {
3708
3713
  method: "POST",
3709
3714
  headers: { "Content-Type": "application/json" },
3710
3715
  body: JSON.stringify({
3711
- bannedWallets: this.bannedWallets.filter((w) => w !== wallet),
3712
- wallet: this.playerWallet
3716
+ bannedWallets: this.bannedWallets.filter((w) => w !== wallet)
3713
3717
  })
3714
3718
  }
3715
3719
  );
@@ -3909,6 +3913,7 @@ var StaticTVClient = class {
3909
3913
  ...config
3910
3914
  };
3911
3915
  this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
3916
+ this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
3912
3917
  if (!config.apiKey) {
3913
3918
  this._disabled = true;
3914
3919
  this._keyType = null;
@@ -3961,7 +3966,7 @@ var StaticTVClient = class {
3961
3966
  }
3962
3967
  /** Get the API base URL (for internal module use) */
3963
3968
  getBaseUrl() {
3964
- return this.baseUrl;
3969
+ return this.apiUrl;
3965
3970
  }
3966
3971
  /**
3967
3972
  * Get the key type (channel, scene, or null if disabled)
@@ -4028,7 +4033,7 @@ var StaticTVClient = class {
4028
4033
  * @internal
4029
4034
  */
4030
4035
  async request(endpoint, options = {}) {
4031
- const url = `${this.baseUrl}${endpoint}`;
4036
+ const url = `${this.apiUrl}${endpoint}`;
4032
4037
  return request(url, {
4033
4038
  ...options,
4034
4039
  headers: {
@@ -4038,6 +4043,33 @@ var StaticTVClient = class {
4038
4043
  }
4039
4044
  });
4040
4045
  }
4046
+ /**
4047
+ * Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
4048
+ * it to that proven wallet and checks it came from this scene - never a wallet the request names.
4049
+ * @internal
4050
+ */
4051
+ async signedRequest(endpoint, init = {}) {
4052
+ const response = await signedFetch3({
4053
+ url: `${this.apiUrl}${endpoint}`,
4054
+ init: {
4055
+ method: init.method || "POST",
4056
+ headers: {
4057
+ "Content-Type": "application/json",
4058
+ "x-dcl-api-key": this.config.apiKey
4059
+ },
4060
+ body: init.body
4061
+ }
4062
+ });
4063
+ let data = {};
4064
+ try {
4065
+ data = response.body ? JSON.parse(response.body) : {};
4066
+ } catch {
4067
+ }
4068
+ if (!response.ok) {
4069
+ throw new Error(data.error || `HTTP ${response.status}`);
4070
+ }
4071
+ return data;
4072
+ }
4041
4073
  /**
4042
4074
  * Log a debug message (only when debug: true)
4043
4075
  * @internal
@@ -4415,6 +4447,14 @@ var StaticTVClient = class {
4415
4447
  * Enables modules based on tier level
4416
4448
  * @internal
4417
4449
  */
4450
+ /**
4451
+ * The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
4452
+ * dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
4453
+ * request came from the scene deployed at that scene's registered location.
4454
+ */
4455
+ getSceneId() {
4456
+ return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
4457
+ }
4418
4458
  _enableFeaturesForTier(tier, keyId) {
4419
4459
  this._tier = tier;
4420
4460
  if (keyId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thestatic-tv/dcl-sdk",
3
- "version": "2.5.27",
3
+ "version": "2.6.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",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "homepage": "https://thestatic.tv",
45
45
  "bugs": {
46
- "url": "https://github.com/thestatic-tv/dcl-sdk/issues"
46
+ "url": "https://thestatic.tv/support"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@dcl-sdk/utils": ">=1.0.0",
@@ -52,9 +52,15 @@
52
52
  "devDependencies": {
53
53
  "@dcl-sdk/utils": "^1.4.0",
54
54
  "@dcl/sdk": "^7.0.0",
55
- "@vitest/coverage-v8": "^4.0.16",
55
+ "@vitest/coverage-v8": "^4.1.11",
56
56
  "tsup": "^8.0.0",
57
57
  "typescript": "^5.0.0",
58
- "vitest": "^4.0.16"
58
+ "vitest": "^4.1.11"
59
+ },
60
+ "overrides": {
61
+ "protobufjs": "^7.6.3",
62
+ "esbuild": "^0.28.1",
63
+ "ts-deepmerge": "^8.0.0",
64
+ "cookie": "^0.7.0"
59
65
  }
60
66
  }