@thestatic-tv/dcl-sdk 2.7.0 → 2.8.1

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,6 +99,23 @@ staticTV.guideUI.toggle()
99
99
  staticTV.chatUI.toggle()
100
100
  ```
101
101
 
102
+ ## 18+ channels (2.8.0)
103
+
104
+ 18+ channels are in the lineup with the rest: each 18+ channel and each of its VODs carries
105
+ `isNsfw: true` (on `GuideVideo`, `Channel` and `Vod`). Before one plays, the viewer chooses yes or
106
+ no - nothing is proven, and nothing is sent or stored.
107
+
108
+ - **The built-in Guide UI asks for you.** Picking an 18+ entry (a card, or RANDOM SIGNAL landing on
109
+ one) shows MATURE CONTENT with YES and NO. YES hands it to `onVideoSelect` (and to your
110
+ `videoScreen` or `onVideoPlay`) and covers that channel until the scene unloads; NO, or closing
111
+ the guide, plays nothing.
112
+ - **A scene that starts entries itself must ask too.** If you play from `staticTV.guide`
113
+ (`getChannels()`, `getLiveChannels()`, `getVods()`) or from your own copy of the lineup - a
114
+ picker of your own, an auto-play of a live channel, a default channel - check `isNsfw` and play
115
+ an 18+ entry only after the viewer answers yes.
116
+
117
+ SDK versions before 2.8.0 drop the flag and play every pick at once.
118
+
102
119
  ## In-world admin, chat, watch time (2.6.0) and session tracking (2.7.0)
103
120
 
104
121
  The Admin Panel, Chat, the watch heartbeat and like/follow send DCL signed requests: Decentraland
package/dist/index.d.mts CHANGED
@@ -141,6 +141,11 @@ interface Channel {
141
141
  logo: string | null;
142
142
  description: string;
143
143
  socials: string | null;
144
+ /**
145
+ * True for an 18+ channel (thestatic.tv's flag since 2026-10-15). Listed like any other: a scene
146
+ * that plays it without the guide UI asks the viewer yes or no first.
147
+ */
148
+ isNsfw?: boolean;
144
149
  }
145
150
  /**
146
151
  * VOD (Video on Demand) information
@@ -152,6 +157,8 @@ interface Vod {
152
157
  thumbnail: string | null;
153
158
  channelId: string;
154
159
  createdAt: string;
160
+ /** True for each VOD of an 18+ channel (since 2026-10-15) - ask the viewer yes or no before it plays */
161
+ isNsfw?: boolean;
155
162
  }
156
163
  /**
157
164
  * Guide response from the API
@@ -240,6 +247,11 @@ interface GuideVideo {
240
247
  channelId?: string;
241
248
  duration?: number;
242
249
  requiresAuth?: boolean;
250
+ /**
251
+ * True for an 18+ channel and each of its VODs (thestatic.tv's flag since 2026-10-15). The entry
252
+ * stays in the lineup; the guide UI asks the viewer yes or no before it calls onVideoSelect.
253
+ */
254
+ isNsfw?: boolean;
243
255
  }
244
256
  /**
245
257
  * Featured playlist for the guide UI
@@ -254,7 +266,8 @@ interface GuideFeaturedPlaylist {
254
266
  interface GuideUIConfig {
255
267
  /**
256
268
  * Callback when user selects a video
257
- * Developer should handle playback
269
+ * Developer should handle playback. An 18+ entry (isNsfw) arrives only after the viewer answers
270
+ * the guide's MATURE CONTENT question yes (2.8.0); a no never calls it.
258
271
  */
259
272
  onVideoSelect?: (video: GuideVideo) => void;
260
273
  /**
@@ -433,6 +446,11 @@ interface AdminPanelConfig {
433
446
 
434
447
  /**
435
448
  * Guide module - fetch channel lineup from thestatic.tv
449
+ *
450
+ * Each channel and VOD carries isNsfw since 2026-10-15 (true for an 18+ channel and each of its
451
+ * VODs), passed through as the API sends it - nothing is left out. This module plays nothing; a
452
+ * scene that plays an entry from it without the guide UI asks the viewer yes or no first when
453
+ * isNsfw is true, as the guide UI does (README, "18+ channels").
436
454
  */
437
455
 
438
456
  declare class GuideModule {
@@ -654,6 +672,8 @@ declare class GuideUIModule {
654
672
  private itemsPerPage;
655
673
  private searchQuery;
656
674
  private _currentVideoId;
675
+ private _ageAsk;
676
+ private _ageYes;
657
677
  constructor(client: StaticTVClient, config?: GuideUIConfig);
658
678
  /**
659
679
  * Initialize the guide - fetch channel data
@@ -698,7 +718,10 @@ declare class GuideUIModule {
698
718
  private getBaseUrl;
699
719
  private fetchGuideData;
700
720
  private s;
721
+ /** The channel a yes covers: the entry's channel, else the entry itself */
722
+ private ageKey;
701
723
  private handleVideoSelect;
724
+ private answerAge;
702
725
  private handleChannelClick;
703
726
  /**
704
727
  * Get the guide UI component for rendering
@@ -710,6 +733,8 @@ declare class GuideUIModule {
710
733
  private renderRightPanel;
711
734
  private renderCardGrid;
712
735
  private renderGuideCard;
736
+ /** The 18+ question over the guide panel: MATURE CONTENT, the pick's name, YES or NO */
737
+ private renderAgeChoice;
713
738
  private renderCloseButton;
714
739
  private renderToggleButton;
715
740
  }
@@ -791,6 +816,13 @@ declare class ChatUIModule {
791
816
  private formatTime;
792
817
  /** Scale a dimension by shared uiScale */
793
818
  private s;
819
+ /**
820
+ * The height a message's text needs (2026-10-20): a wrapped uiText with no height is laid out one line
821
+ * tall, so a long message drew its other lines over the messages below it. Its lines are estimated at a
822
+ * generous 0.6em a letter against the column it wraps in, each 1.5x the font size, plus its 4px padding
823
+ * top and bottom.
824
+ */
825
+ private messageTextRoom;
794
826
  /**
795
827
  * Get the chat UI component for rendering
796
828
  * Always renders toggle button, plus panel when visible
package/dist/index.d.ts CHANGED
@@ -141,6 +141,11 @@ interface Channel {
141
141
  logo: string | null;
142
142
  description: string;
143
143
  socials: string | null;
144
+ /**
145
+ * True for an 18+ channel (thestatic.tv's flag since 2026-10-15). Listed like any other: a scene
146
+ * that plays it without the guide UI asks the viewer yes or no first.
147
+ */
148
+ isNsfw?: boolean;
144
149
  }
145
150
  /**
146
151
  * VOD (Video on Demand) information
@@ -152,6 +157,8 @@ interface Vod {
152
157
  thumbnail: string | null;
153
158
  channelId: string;
154
159
  createdAt: string;
160
+ /** True for each VOD of an 18+ channel (since 2026-10-15) - ask the viewer yes or no before it plays */
161
+ isNsfw?: boolean;
155
162
  }
156
163
  /**
157
164
  * Guide response from the API
@@ -240,6 +247,11 @@ interface GuideVideo {
240
247
  channelId?: string;
241
248
  duration?: number;
242
249
  requiresAuth?: boolean;
250
+ /**
251
+ * True for an 18+ channel and each of its VODs (thestatic.tv's flag since 2026-10-15). The entry
252
+ * stays in the lineup; the guide UI asks the viewer yes or no before it calls onVideoSelect.
253
+ */
254
+ isNsfw?: boolean;
243
255
  }
244
256
  /**
245
257
  * Featured playlist for the guide UI
@@ -254,7 +266,8 @@ interface GuideFeaturedPlaylist {
254
266
  interface GuideUIConfig {
255
267
  /**
256
268
  * Callback when user selects a video
257
- * Developer should handle playback
269
+ * Developer should handle playback. An 18+ entry (isNsfw) arrives only after the viewer answers
270
+ * the guide's MATURE CONTENT question yes (2.8.0); a no never calls it.
258
271
  */
259
272
  onVideoSelect?: (video: GuideVideo) => void;
260
273
  /**
@@ -433,6 +446,11 @@ interface AdminPanelConfig {
433
446
 
434
447
  /**
435
448
  * Guide module - fetch channel lineup from thestatic.tv
449
+ *
450
+ * Each channel and VOD carries isNsfw since 2026-10-15 (true for an 18+ channel and each of its
451
+ * VODs), passed through as the API sends it - nothing is left out. This module plays nothing; a
452
+ * scene that plays an entry from it without the guide UI asks the viewer yes or no first when
453
+ * isNsfw is true, as the guide UI does (README, "18+ channels").
436
454
  */
437
455
 
438
456
  declare class GuideModule {
@@ -654,6 +672,8 @@ declare class GuideUIModule {
654
672
  private itemsPerPage;
655
673
  private searchQuery;
656
674
  private _currentVideoId;
675
+ private _ageAsk;
676
+ private _ageYes;
657
677
  constructor(client: StaticTVClient, config?: GuideUIConfig);
658
678
  /**
659
679
  * Initialize the guide - fetch channel data
@@ -698,7 +718,10 @@ declare class GuideUIModule {
698
718
  private getBaseUrl;
699
719
  private fetchGuideData;
700
720
  private s;
721
+ /** The channel a yes covers: the entry's channel, else the entry itself */
722
+ private ageKey;
701
723
  private handleVideoSelect;
724
+ private answerAge;
702
725
  private handleChannelClick;
703
726
  /**
704
727
  * Get the guide UI component for rendering
@@ -710,6 +733,8 @@ declare class GuideUIModule {
710
733
  private renderRightPanel;
711
734
  private renderCardGrid;
712
735
  private renderGuideCard;
736
+ /** The 18+ question over the guide panel: MATURE CONTENT, the pick's name, YES or NO */
737
+ private renderAgeChoice;
713
738
  private renderCloseButton;
714
739
  private renderToggleButton;
715
740
  }
@@ -791,6 +816,13 @@ declare class ChatUIModule {
791
816
  private formatTime;
792
817
  /** Scale a dimension by shared uiScale */
793
818
  private s;
819
+ /**
820
+ * The height a message's text needs (2026-10-20): a wrapped uiText with no height is laid out one line
821
+ * tall, so a long message drew its other lines over the messages below it. Its lines are estimated at a
822
+ * generous 0.6em a letter against the column it wraps in, each 1.5x the font size, plus its 4px padding
823
+ * top and bottom.
824
+ */
825
+ private messageTextRoom;
794
826
  /**
795
827
  * Get the chat UI component for rendering
796
828
  * Always renders toggle button, plus panel when visible
package/dist/index.js CHANGED
@@ -1001,6 +1001,10 @@ var GuideUIModule = class {
1001
1001
  this.searchQuery = "";
1002
1002
  // Current video tracking (for "PLAYING" indicator)
1003
1003
  this._currentVideoId = null;
1004
+ // The 18+ question (2026-10-15): the pick it is asking about, and the channels answered yes
1005
+ // while the scene runs - in memory only, nothing is sent or stored
1006
+ this._ageAsk = null;
1007
+ this._ageYes = /* @__PURE__ */ new Set();
1004
1008
  // =============================================================================
1005
1009
  // --- UI RENDERING ---
1006
1010
  // =============================================================================
@@ -1038,7 +1042,8 @@ var GuideUIModule = class {
1038
1042
  children: [
1039
1043
  this.renderLeftPanel(),
1040
1044
  this.renderRightPanel(),
1041
- this.renderCloseButton()
1045
+ this.renderCloseButton(),
1046
+ this._ageAsk ? this.renderAgeChoice(this._ageAsk) : null
1042
1047
  ]
1043
1048
  }) : null
1044
1049
  ]
@@ -1070,6 +1075,7 @@ var GuideUIModule = class {
1070
1075
  */
1071
1076
  hide() {
1072
1077
  this._isVisible = false;
1078
+ this._ageAsk = null;
1073
1079
  this.activeTab = "SIGNALS";
1074
1080
  this.searchQuery = "";
1075
1081
  this.currentPage = 0;
@@ -1153,7 +1159,9 @@ var GuideUIModule = class {
1153
1159
  isCreator: v.isCreator === true || v.type === "live",
1154
1160
  channelId: v.channelId || slug,
1155
1161
  duration: v.duration,
1156
- requiresAuth: v.requiresAuth
1162
+ requiresAuth: v.requiresAuth,
1163
+ // An 18+ channel or one of its VODs (thestatic.tv's flag since 2026-10-15): it stays listed and asks first
1164
+ isNsfw: v.isNsfw === true
1157
1165
  };
1158
1166
  videos.push(mapped);
1159
1167
  if (mapped.isLive) {
@@ -1175,7 +1183,8 @@ var GuideUIModule = class {
1175
1183
  isCreator: v.isCreator,
1176
1184
  channelId: v.channelId || v.id,
1177
1185
  duration: v.duration,
1178
- requiresAuth: v.requiresAuth
1186
+ requiresAuth: v.requiresAuth,
1187
+ isNsfw: v.isNsfw === true
1179
1188
  }))
1180
1189
  });
1181
1190
  }
@@ -1198,11 +1207,30 @@ var GuideUIModule = class {
1198
1207
  s(value) {
1199
1208
  return Math.round(value * this.client.uiScale);
1200
1209
  }
1210
+ /** The channel a yes covers: the entry's channel, else the entry itself */
1211
+ ageKey(video) {
1212
+ return video.channelId || video.id;
1213
+ }
1214
+ // An 18+ pick asks first (2026-10-15, Joseph's rule): until 2.8.0 every pick went to the scene at
1215
+ // once. An 18+ channel and its VODs stay in the lineup; before one reaches onVideoSelect (and the
1216
+ // client's own player behind it) the viewer chooses yes or no - no proof, nothing sent anywhere.
1217
+ // A yes covers that channel while the scene runs; a no plays nothing.
1201
1218
  handleVideoSelect(video) {
1219
+ if (video.isNsfw && !this._ageYes.has(this.ageKey(video))) {
1220
+ this._ageAsk = video;
1221
+ return;
1222
+ }
1202
1223
  if (this.config.onVideoSelect) {
1203
1224
  this.config.onVideoSelect(video);
1204
1225
  }
1205
1226
  }
1227
+ answerAge(yes) {
1228
+ const video = this._ageAsk;
1229
+ this._ageAsk = null;
1230
+ if (!video || !yes) return;
1231
+ this._ageYes.add(this.ageKey(video));
1232
+ this.handleVideoSelect(video);
1233
+ }
1206
1234
  handleChannelClick(video) {
1207
1235
  const baseUrl = this.getBaseUrl();
1208
1236
  const channelUrl = `${baseUrl}/${video.channelId || video.id}`;
@@ -1609,6 +1637,93 @@ var GuideUIModule = class {
1609
1637
  ]
1610
1638
  });
1611
1639
  }
1640
+ /** The 18+ question over the guide panel: MATURE CONTENT, the pick's name, YES or NO */
1641
+ renderAgeChoice(video) {
1642
+ const buttonW = this.s(170);
1643
+ const buttonH = this.s(44);
1644
+ const bodyH = this.s(UI_DIMENSIONS.guide.content.bodySize * 1.5 * 2);
1645
+ return import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1646
+ key: "age-choice",
1647
+ uiTransform: {
1648
+ positionType: "absolute",
1649
+ position: { top: 0, left: 0 },
1650
+ width: "100%",
1651
+ height: "100%",
1652
+ justifyContent: "center",
1653
+ alignItems: "center",
1654
+ // The cards under it take no clicks while it asks
1655
+ pointerFilter: "block"
1656
+ },
1657
+ uiBackground: { color: import_math3.Color4.create(0, 0, 0, 0.85) },
1658
+ children: [
1659
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1660
+ uiTransform: {
1661
+ width: this.s(480),
1662
+ flexDirection: "column",
1663
+ alignItems: "center",
1664
+ padding: this.s(24),
1665
+ border: { top: 2, bottom: 2, left: 2, right: 2 },
1666
+ borderColor: THEME.colors.red
1667
+ },
1668
+ uiBackground: { color: THEME.colors.panel },
1669
+ children: [
1670
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1671
+ uiTransform: { marginBottom: this.s(8) },
1672
+ uiText: { value: "MATURE CONTENT", fontSize: this.s(24), color: THEME.colors.red }
1673
+ }),
1674
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1675
+ uiTransform: { marginBottom: this.s(12) },
1676
+ uiText: { value: truncateText(video.name || "Unknown", 40), fontSize: this.s(16), color: THEME.colors.cyan }
1677
+ }),
1678
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1679
+ uiTransform: { width: "100%", minHeight: bodyH, marginBottom: this.s(20) },
1680
+ uiText: {
1681
+ value: "This channel is for viewers aged 18 and older. Are you 18 or older?",
1682
+ fontSize: this.s(UI_DIMENSIONS.guide.content.bodySize),
1683
+ color: THEME.colors.white,
1684
+ textAlign: "middle-center",
1685
+ textWrap: "wrap"
1686
+ }
1687
+ }),
1688
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1689
+ uiTransform: { flexDirection: "row", justifyContent: "center", gap: this.s(16) },
1690
+ children: [
1691
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1692
+ key: "age-yes",
1693
+ uiTransform: { width: buttonW, height: buttonH, justifyContent: "center", alignItems: "center" },
1694
+ uiBackground: { color: THEME.colors.red },
1695
+ onMouseDown: () => this.answerAge(true),
1696
+ children: [
1697
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1698
+ uiText: { value: "YES, I AM 18+", fontSize: this.s(14), color: THEME.colors.white }
1699
+ })
1700
+ ]
1701
+ }),
1702
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1703
+ key: "age-no",
1704
+ uiTransform: {
1705
+ width: buttonW,
1706
+ height: buttonH,
1707
+ justifyContent: "center",
1708
+ alignItems: "center",
1709
+ border: { top: 1, bottom: 1, left: 1, right: 1 },
1710
+ borderColor: THEME.colors.gray
1711
+ },
1712
+ uiBackground: { color: THEME.colors.buttonBackground },
1713
+ onMouseDown: () => this.answerAge(false),
1714
+ children: [
1715
+ import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
1716
+ uiText: { value: "NO", fontSize: this.s(14), color: THEME.colors.white }
1717
+ })
1718
+ ]
1719
+ })
1720
+ ]
1721
+ })
1722
+ ]
1723
+ })
1724
+ ]
1725
+ });
1726
+ }
1612
1727
  renderCloseButton() {
1613
1728
  const closeSize = this.s(UI_DIMENSIONS.closeButton.size);
1614
1729
  return import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
@@ -1666,6 +1781,7 @@ var import_players = require("@dcl/sdk/players");
1666
1781
  var import_RestrictedActions2 = require("~system/RestrictedActions");
1667
1782
  var POLL_INTERVAL_ACTIVE = 5e3;
1668
1783
  var POLL_INTERVAL_PASSIVE = 3e4;
1784
+ var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
1669
1785
  var ChatUIModule = class {
1670
1786
  constructor(client, config = {}) {
1671
1787
  // Visibility state
@@ -2039,6 +2155,17 @@ var ChatUIModule = class {
2039
2155
  s(value) {
2040
2156
  return Math.round(value * this.client.uiScale);
2041
2157
  }
2158
+ /**
2159
+ * The height a message's text needs (2026-10-20): a wrapped uiText with no height is laid out one line
2160
+ * tall, so a long message drew its other lines over the messages below it. Its lines are estimated at a
2161
+ * generous 0.6em a letter against the column it wraps in, each 1.5x the font size, plus its 4px padding
2162
+ * top and bottom.
2163
+ */
2164
+ messageTextRoom(text, fontSize) {
2165
+ const column = this.s(UI_DIMENSIONS.chat.width) - MESSAGE_TEXT_INSET;
2166
+ const lines = Math.max(1, Math.ceil(text.length * 0.6 * fontSize / column));
2167
+ return Math.ceil(lines * fontSize * 1.5) + 8;
2168
+ }
2042
2169
  getPositionStyle() {
2043
2170
  return { bottom: 55, right: 20 };
2044
2171
  }
@@ -2097,11 +2224,17 @@ var ChatUIModule = class {
2097
2224
  return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
2098
2225
  uiTransform: { flexGrow: 1, width: "100%", flexDirection: "row", overflow: "hidden" },
2099
2226
  children: [
2100
- // Messages
2227
+ // Messages - anchored at the bottom, so the newest stays in view now that a row grows with its text
2228
+ // (2026-10-20): a page taller than the column clipped its newest row, and offset 0 cannot scroll
2229
+ // past it; now its oldest clips at the top, one scroll up away. The rows keep their height
2230
+ // (flexShrink 0 - the protocol's default of 1 squeezes them onto each other) in one column
2231
+ // (nowrap - the protocol documents wrap as its default).
2101
2232
  import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
2102
2233
  uiTransform: {
2103
2234
  flexGrow: 1,
2104
2235
  flexDirection: "column",
2236
+ justifyContent: "flex-end",
2237
+ flexWrap: "nowrap",
2105
2238
  padding: { left: 12, right: 8, top: 8, bottom: 8 },
2106
2239
  overflow: "hidden"
2107
2240
  },
@@ -2164,7 +2297,7 @@ var ChatUIModule = class {
2164
2297
  renderSystemMessage(msg, theme) {
2165
2298
  return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
2166
2299
  key: msg.id,
2167
- uiTransform: { width: "100%", height: 24, marginBottom: 4 },
2300
+ uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
2168
2301
  uiText: { value: msg.text, fontSize: theme.systemMessage, color: THEME.colors.green, textAlign: "middle-left" }
2169
2302
  });
2170
2303
  }
@@ -2176,9 +2309,10 @@ var ChatUIModule = class {
2176
2309
  let accentColor = THEME.colors.cyan;
2177
2310
  if (displayName.toLowerCase().includes("admin")) accentColor = THEME.colors.magenta;
2178
2311
  else if (isCurrentUser) accentColor = THEME.colors.green;
2312
+ const textRoom = this.messageTextRoom(msg.text, theme.chatMessage);
2179
2313
  return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
2180
2314
  key: msg.id,
2181
- uiTransform: { width: "100%", flexDirection: "column", marginBottom: 16 },
2315
+ uiTransform: { width: "100%", flexDirection: "column", marginBottom: 16, flexShrink: 0 },
2182
2316
  children: [
2183
2317
  // Header row
2184
2318
  import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
@@ -2204,11 +2338,11 @@ var ChatUIModule = class {
2204
2338
  uiTransform: { width: "100%", flexDirection: "row", alignItems: "stretch", paddingLeft: 8 },
2205
2339
  children: [
2206
2340
  import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
2207
- uiTransform: { width: 3, minHeight: 28 },
2341
+ uiTransform: { width: 3, minHeight: textRoom },
2208
2342
  uiBackground: { color: accentColor }
2209
2343
  }),
2210
2344
  import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
2211
- uiTransform: { flexGrow: 1, paddingLeft: 12, paddingTop: 4, paddingBottom: 4 },
2345
+ uiTransform: { flexGrow: 1, minHeight: textRoom, paddingLeft: 12, paddingTop: 4, paddingBottom: 4 },
2212
2346
  uiText: {
2213
2347
  value: msg.text,
2214
2348
  fontSize: theme.chatMessage,
package/dist/index.mjs CHANGED
@@ -953,6 +953,10 @@ var GuideUIModule = class {
953
953
  this.searchQuery = "";
954
954
  // Current video tracking (for "PLAYING" indicator)
955
955
  this._currentVideoId = null;
956
+ // The 18+ question (2026-10-15): the pick it is asking about, and the channels answered yes
957
+ // while the scene runs - in memory only, nothing is sent or stored
958
+ this._ageAsk = null;
959
+ this._ageYes = /* @__PURE__ */ new Set();
956
960
  // =============================================================================
957
961
  // --- UI RENDERING ---
958
962
  // =============================================================================
@@ -990,7 +994,8 @@ var GuideUIModule = class {
990
994
  children: [
991
995
  this.renderLeftPanel(),
992
996
  this.renderRightPanel(),
993
- this.renderCloseButton()
997
+ this.renderCloseButton(),
998
+ this._ageAsk ? this.renderAgeChoice(this._ageAsk) : null
994
999
  ]
995
1000
  }) : null
996
1001
  ]
@@ -1022,6 +1027,7 @@ var GuideUIModule = class {
1022
1027
  */
1023
1028
  hide() {
1024
1029
  this._isVisible = false;
1030
+ this._ageAsk = null;
1025
1031
  this.activeTab = "SIGNALS";
1026
1032
  this.searchQuery = "";
1027
1033
  this.currentPage = 0;
@@ -1105,7 +1111,9 @@ var GuideUIModule = class {
1105
1111
  isCreator: v.isCreator === true || v.type === "live",
1106
1112
  channelId: v.channelId || slug,
1107
1113
  duration: v.duration,
1108
- requiresAuth: v.requiresAuth
1114
+ requiresAuth: v.requiresAuth,
1115
+ // An 18+ channel or one of its VODs (thestatic.tv's flag since 2026-10-15): it stays listed and asks first
1116
+ isNsfw: v.isNsfw === true
1109
1117
  };
1110
1118
  videos.push(mapped);
1111
1119
  if (mapped.isLive) {
@@ -1127,7 +1135,8 @@ var GuideUIModule = class {
1127
1135
  isCreator: v.isCreator,
1128
1136
  channelId: v.channelId || v.id,
1129
1137
  duration: v.duration,
1130
- requiresAuth: v.requiresAuth
1138
+ requiresAuth: v.requiresAuth,
1139
+ isNsfw: v.isNsfw === true
1131
1140
  }))
1132
1141
  });
1133
1142
  }
@@ -1150,11 +1159,30 @@ var GuideUIModule = class {
1150
1159
  s(value) {
1151
1160
  return Math.round(value * this.client.uiScale);
1152
1161
  }
1162
+ /** The channel a yes covers: the entry's channel, else the entry itself */
1163
+ ageKey(video) {
1164
+ return video.channelId || video.id;
1165
+ }
1166
+ // An 18+ pick asks first (2026-10-15, Joseph's rule): until 2.8.0 every pick went to the scene at
1167
+ // once. An 18+ channel and its VODs stay in the lineup; before one reaches onVideoSelect (and the
1168
+ // client's own player behind it) the viewer chooses yes or no - no proof, nothing sent anywhere.
1169
+ // A yes covers that channel while the scene runs; a no plays nothing.
1153
1170
  handleVideoSelect(video) {
1171
+ if (video.isNsfw && !this._ageYes.has(this.ageKey(video))) {
1172
+ this._ageAsk = video;
1173
+ return;
1174
+ }
1154
1175
  if (this.config.onVideoSelect) {
1155
1176
  this.config.onVideoSelect(video);
1156
1177
  }
1157
1178
  }
1179
+ answerAge(yes) {
1180
+ const video = this._ageAsk;
1181
+ this._ageAsk = null;
1182
+ if (!video || !yes) return;
1183
+ this._ageYes.add(this.ageKey(video));
1184
+ this.handleVideoSelect(video);
1185
+ }
1158
1186
  handleChannelClick(video) {
1159
1187
  const baseUrl = this.getBaseUrl();
1160
1188
  const channelUrl = `${baseUrl}/${video.channelId || video.id}`;
@@ -1561,6 +1589,93 @@ var GuideUIModule = class {
1561
1589
  ]
1562
1590
  });
1563
1591
  }
1592
+ /** The 18+ question over the guide panel: MATURE CONTENT, the pick's name, YES or NO */
1593
+ renderAgeChoice(video) {
1594
+ const buttonW = this.s(170);
1595
+ const buttonH = this.s(44);
1596
+ const bodyH = this.s(UI_DIMENSIONS.guide.content.bodySize * 1.5 * 2);
1597
+ return ReactEcs2.createElement(UiEntity2, {
1598
+ key: "age-choice",
1599
+ uiTransform: {
1600
+ positionType: "absolute",
1601
+ position: { top: 0, left: 0 },
1602
+ width: "100%",
1603
+ height: "100%",
1604
+ justifyContent: "center",
1605
+ alignItems: "center",
1606
+ // The cards under it take no clicks while it asks
1607
+ pointerFilter: "block"
1608
+ },
1609
+ uiBackground: { color: Color43.create(0, 0, 0, 0.85) },
1610
+ children: [
1611
+ ReactEcs2.createElement(UiEntity2, {
1612
+ uiTransform: {
1613
+ width: this.s(480),
1614
+ flexDirection: "column",
1615
+ alignItems: "center",
1616
+ padding: this.s(24),
1617
+ border: { top: 2, bottom: 2, left: 2, right: 2 },
1618
+ borderColor: THEME.colors.red
1619
+ },
1620
+ uiBackground: { color: THEME.colors.panel },
1621
+ children: [
1622
+ ReactEcs2.createElement(UiEntity2, {
1623
+ uiTransform: { marginBottom: this.s(8) },
1624
+ uiText: { value: "MATURE CONTENT", fontSize: this.s(24), color: THEME.colors.red }
1625
+ }),
1626
+ ReactEcs2.createElement(UiEntity2, {
1627
+ uiTransform: { marginBottom: this.s(12) },
1628
+ uiText: { value: truncateText(video.name || "Unknown", 40), fontSize: this.s(16), color: THEME.colors.cyan }
1629
+ }),
1630
+ ReactEcs2.createElement(UiEntity2, {
1631
+ uiTransform: { width: "100%", minHeight: bodyH, marginBottom: this.s(20) },
1632
+ uiText: {
1633
+ value: "This channel is for viewers aged 18 and older. Are you 18 or older?",
1634
+ fontSize: this.s(UI_DIMENSIONS.guide.content.bodySize),
1635
+ color: THEME.colors.white,
1636
+ textAlign: "middle-center",
1637
+ textWrap: "wrap"
1638
+ }
1639
+ }),
1640
+ ReactEcs2.createElement(UiEntity2, {
1641
+ uiTransform: { flexDirection: "row", justifyContent: "center", gap: this.s(16) },
1642
+ children: [
1643
+ ReactEcs2.createElement(UiEntity2, {
1644
+ key: "age-yes",
1645
+ uiTransform: { width: buttonW, height: buttonH, justifyContent: "center", alignItems: "center" },
1646
+ uiBackground: { color: THEME.colors.red },
1647
+ onMouseDown: () => this.answerAge(true),
1648
+ children: [
1649
+ ReactEcs2.createElement(UiEntity2, {
1650
+ uiText: { value: "YES, I AM 18+", fontSize: this.s(14), color: THEME.colors.white }
1651
+ })
1652
+ ]
1653
+ }),
1654
+ ReactEcs2.createElement(UiEntity2, {
1655
+ key: "age-no",
1656
+ uiTransform: {
1657
+ width: buttonW,
1658
+ height: buttonH,
1659
+ justifyContent: "center",
1660
+ alignItems: "center",
1661
+ border: { top: 1, bottom: 1, left: 1, right: 1 },
1662
+ borderColor: THEME.colors.gray
1663
+ },
1664
+ uiBackground: { color: THEME.colors.buttonBackground },
1665
+ onMouseDown: () => this.answerAge(false),
1666
+ children: [
1667
+ ReactEcs2.createElement(UiEntity2, {
1668
+ uiText: { value: "NO", fontSize: this.s(14), color: THEME.colors.white }
1669
+ })
1670
+ ]
1671
+ })
1672
+ ]
1673
+ })
1674
+ ]
1675
+ })
1676
+ ]
1677
+ });
1678
+ }
1564
1679
  renderCloseButton() {
1565
1680
  const closeSize = this.s(UI_DIMENSIONS.closeButton.size);
1566
1681
  return ReactEcs2.createElement(UiEntity2, {
@@ -1618,6 +1733,7 @@ import { getPlayer } from "@dcl/sdk/players";
1618
1733
  import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
1619
1734
  var POLL_INTERVAL_ACTIVE = 5e3;
1620
1735
  var POLL_INTERVAL_PASSIVE = 3e4;
1736
+ var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
1621
1737
  var ChatUIModule = class {
1622
1738
  constructor(client, config = {}) {
1623
1739
  // Visibility state
@@ -1991,6 +2107,17 @@ var ChatUIModule = class {
1991
2107
  s(value) {
1992
2108
  return Math.round(value * this.client.uiScale);
1993
2109
  }
2110
+ /**
2111
+ * The height a message's text needs (2026-10-20): a wrapped uiText with no height is laid out one line
2112
+ * tall, so a long message drew its other lines over the messages below it. Its lines are estimated at a
2113
+ * generous 0.6em a letter against the column it wraps in, each 1.5x the font size, plus its 4px padding
2114
+ * top and bottom.
2115
+ */
2116
+ messageTextRoom(text, fontSize) {
2117
+ const column = this.s(UI_DIMENSIONS.chat.width) - MESSAGE_TEXT_INSET;
2118
+ const lines = Math.max(1, Math.ceil(text.length * 0.6 * fontSize / column));
2119
+ return Math.ceil(lines * fontSize * 1.5) + 8;
2120
+ }
1994
2121
  getPositionStyle() {
1995
2122
  return { bottom: 55, right: 20 };
1996
2123
  }
@@ -2049,11 +2176,17 @@ var ChatUIModule = class {
2049
2176
  return ReactEcs3.createElement(UiEntity3, {
2050
2177
  uiTransform: { flexGrow: 1, width: "100%", flexDirection: "row", overflow: "hidden" },
2051
2178
  children: [
2052
- // Messages
2179
+ // Messages - anchored at the bottom, so the newest stays in view now that a row grows with its text
2180
+ // (2026-10-20): a page taller than the column clipped its newest row, and offset 0 cannot scroll
2181
+ // past it; now its oldest clips at the top, one scroll up away. The rows keep their height
2182
+ // (flexShrink 0 - the protocol's default of 1 squeezes them onto each other) in one column
2183
+ // (nowrap - the protocol documents wrap as its default).
2053
2184
  ReactEcs3.createElement(UiEntity3, {
2054
2185
  uiTransform: {
2055
2186
  flexGrow: 1,
2056
2187
  flexDirection: "column",
2188
+ justifyContent: "flex-end",
2189
+ flexWrap: "nowrap",
2057
2190
  padding: { left: 12, right: 8, top: 8, bottom: 8 },
2058
2191
  overflow: "hidden"
2059
2192
  },
@@ -2116,7 +2249,7 @@ var ChatUIModule = class {
2116
2249
  renderSystemMessage(msg, theme) {
2117
2250
  return ReactEcs3.createElement(UiEntity3, {
2118
2251
  key: msg.id,
2119
- uiTransform: { width: "100%", height: 24, marginBottom: 4 },
2252
+ uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
2120
2253
  uiText: { value: msg.text, fontSize: theme.systemMessage, color: THEME.colors.green, textAlign: "middle-left" }
2121
2254
  });
2122
2255
  }
@@ -2128,9 +2261,10 @@ var ChatUIModule = class {
2128
2261
  let accentColor = THEME.colors.cyan;
2129
2262
  if (displayName.toLowerCase().includes("admin")) accentColor = THEME.colors.magenta;
2130
2263
  else if (isCurrentUser) accentColor = THEME.colors.green;
2264
+ const textRoom = this.messageTextRoom(msg.text, theme.chatMessage);
2131
2265
  return ReactEcs3.createElement(UiEntity3, {
2132
2266
  key: msg.id,
2133
- uiTransform: { width: "100%", flexDirection: "column", marginBottom: 16 },
2267
+ uiTransform: { width: "100%", flexDirection: "column", marginBottom: 16, flexShrink: 0 },
2134
2268
  children: [
2135
2269
  // Header row
2136
2270
  ReactEcs3.createElement(UiEntity3, {
@@ -2156,11 +2290,11 @@ var ChatUIModule = class {
2156
2290
  uiTransform: { width: "100%", flexDirection: "row", alignItems: "stretch", paddingLeft: 8 },
2157
2291
  children: [
2158
2292
  ReactEcs3.createElement(UiEntity3, {
2159
- uiTransform: { width: 3, minHeight: 28 },
2293
+ uiTransform: { width: 3, minHeight: textRoom },
2160
2294
  uiBackground: { color: accentColor }
2161
2295
  }),
2162
2296
  ReactEcs3.createElement(UiEntity3, {
2163
- uiTransform: { flexGrow: 1, paddingLeft: 12, paddingTop: 4, paddingBottom: 4 },
2297
+ uiTransform: { flexGrow: 1, minHeight: textRoom, paddingLeft: 12, paddingTop: 4, paddingBottom: 4 },
2164
2298
  uiText: {
2165
2299
  value: msg.text,
2166
2300
  fontSize: theme.chatMessage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thestatic-tv/dcl-sdk",
3
- "version": "2.7.0",
3
+ "version": "2.8.1",
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",