@lumiastream/lumia-types 3.2.8 → 3.2.9

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.
@@ -18,6 +18,7 @@ Runtime reminders:
18
18
  - Read Config/Data values from `Overlay.data`, not from a bare top-level `data` variable.
19
19
  - JS is already wrapped by Lumia in an async function, so top-level `await` is allowed.
20
20
  - Use literal listener names like `Overlay.on('chat', ...)` so Lumia can auto-subscribe to events.
21
+ - For full event payload shapes, use the Overlay Type Definitions page or `custom-overlays.d.ts`.
21
22
  - Use `Overlay.deleteStorage`, not `Overlay.removeStorage`.
22
23
 
23
24
  ### `window.Overlay` interface
@@ -106,6 +106,57 @@ Overlay.on("chat", (data) => {
106
106
  toast(`New chat message received from ${username}. They said ${message}`);
107
107
  });
108
108
 
109
+ // Full chat payload shape.
110
+ Overlay.on("chat", (data) => {
111
+ const {
112
+ origin, // Platform origin, such as "twitch", "youtube", "kick", "tiktok", or "facebook"
113
+ id, // Platform message id when available
114
+ username, // Account username/login
115
+ displayname, // Display name when available
116
+ channel, // Channel or room where the message was sent
117
+ avatar, // User avatar URL when available
118
+ message, // Chat message text
119
+ color, // User chat color, usually a hex value
120
+ badges, // Badge ids or badge image URLs
121
+ badgesLookup, // Badge id to image URL lookup map for some platforms
122
+ badgesRaw, // Raw platform badge string
123
+ emotesRaw, // Raw platform emote string
124
+ emotesPack, // Platform-specific emote metadata
125
+ isCheer, // Whether the message includes a cheer/bits event
126
+ reply, // Reply metadata: { username, body }
127
+ isPowerup, // Twitch Power-up flag
128
+ powerupType, // Twitch Power-up type
129
+ powerupName, // Twitch Power-up animation name
130
+ sharedMessage, // Twitch shared chat source metadata
131
+ lumiauserlevels, // Numeric Lumia user level ids
132
+ userLevels, // Boolean role map: isSelf, broadcaster, mod, vip, tier3, tier2, subscriber, regular, follower, anyone
133
+ time, // Local HH:mm:ss time generated by Lumia
134
+ timestamp, // Millisecond timestamp generated by Lumia
135
+ } = data;
136
+
137
+ console.log(origin, displayname || username, message, {
138
+ id,
139
+ channel,
140
+ avatar,
141
+ color,
142
+ badges,
143
+ badgesLookup,
144
+ badgesRaw,
145
+ emotesRaw,
146
+ emotesPack,
147
+ isCheer,
148
+ reply,
149
+ isPowerup,
150
+ powerupType,
151
+ powerupName,
152
+ sharedMessage,
153
+ lumiauserlevels,
154
+ userLevels,
155
+ time,
156
+ timestamp,
157
+ });
158
+ });
159
+
109
160
  Overlay.on("alert", (data) => {
110
161
  console.log("alert", data);
111
162
  const settings = data.extraSettings || {};
@@ -199,6 +250,8 @@ Overlay.on('overlaycontent', (data) => {
199
250
 
200
251
  Lumia auto-detects event subscriptions from literal `Overlay.on("event", ...)` calls in the JS tab. Use direct string literals so the overlay subscribes to the needed events. The Data tab only needs an `events` array for legacy/manual cases.
201
252
 
253
+ For full event payload shapes, see the [Overlay Type Definitions](/docs/custom-overlays/types). The raw declarations live in `custom-overlays.d.ts` as `ChatEvent`, `AlertEvent`, `HfxEvent`, `VirtualLightEvent`, and `CustomOverlayContentEvent`.
254
+
202
255
  ### OverlayListener types
203
256
 
204
257
  | Value | Label |
@@ -210,7 +263,7 @@ Lumia auto-detects event subscriptions from literal `Overlay.on("event", ...)` c
210
263
  | overlaycontent | Custom Overlay Content |
211
264
 
212
265
  > 💡 Performance Tip: Only selected events are delivered to the overlay.
213
- > 💡 The TypeScript types for each alert are within the Types tab.
266
+ > 💡 The TypeScript types for chat, alerts, HFX, virtual lights, and overlay content are within the Types tab.
214
267
  > 💡 `overlaycontent` sends custom content only to custom overlay layers with the matching `codeId`.
215
268
 
216
269
  ### Showing Toasts
@@ -1,6 +1,6 @@
1
1
  # Custom Overlays Examples
2
2
 
3
- > Need to inspect what an alert returns? Open the [alert explorer](/docs/variables#alert-explorer) on the Platform Variables page to browse `data.alert`, `data.extraSettings.*`, and the fields available for each alert.
3
+ > Need to inspect what an alert returns? Open the [alert explorer](/docs/variables#alert-explorer) on the Platform Variables page to browse `data.alert`, `data.extraSettings.*`, and the fields available for each alert. For full `Overlay.on(...)` payload types, see [Overlay Type Definitions](/docs/custom-overlays/types).
4
4
 
5
5
  ## Index
6
6
 
@@ -48,6 +48,26 @@ export enum ConfigsFieldType {
48
48
  */
49
49
  export type OverlayListener = 'chat' | 'alert' | 'hfx' | 'virtuallight' | 'overlaycontent';
50
50
 
51
+ export type ChatUserLevelKey = 'isSelf' | 'broadcaster' | 'mod' | 'vip' | 'tier3' | 'tier2' | 'subscriber' | 'regular' | 'follower' | 'anyone';
52
+
53
+ export type ChatUserLevels = Record<ChatUserLevelKey, boolean>;
54
+
55
+ export interface ChatReply {
56
+ /** Username of the message being replied to */
57
+ username: string;
58
+ /** Body of the message being replied to */
59
+ body: string;
60
+ }
61
+
62
+ export interface ChatSharedMessage {
63
+ /** Avatar for the source user/channel of the shared message */
64
+ avatar: string;
65
+ /** Display name for the source user/channel of the shared message */
66
+ displayname: string;
67
+ /** User ID for the source user/channel of the shared message */
68
+ userId: string;
69
+ }
70
+
51
71
  /**
52
72
  * Chat message event data structure.
53
73
  * Fired when a chat message is received from any connected platform.
@@ -55,53 +75,50 @@ export type OverlayListener = 'chat' | 'alert' | 'hfx' | 'virtuallight' | 'overl
55
75
  export interface ChatEvent {
56
76
  /** Platform origin (e.g., "twitch", "kick", "youtube", "tiktok") */
57
77
  origin: string;
58
- /** Unique message identifier */
59
- id: string;
60
- /** User's account username */
61
- username: string;
78
+ /** Unique message identifier when the platform provides one */
79
+ id?: string;
80
+ /** User's account username/login */
81
+ username?: string;
62
82
  /** User's display name (may differ from username) */
63
- displayname: string;
83
+ displayname?: string;
64
84
  /** Channel name where the message was sent */
65
- channel: string;
85
+ channel?: string;
66
86
  /** URL to the user's avatar image */
67
- avatar: string;
87
+ avatar?: string | null;
68
88
  /** The chat message content */
69
- message: string;
89
+ message?: string;
70
90
  /** User's chat color as hex code (e.g., "#00FF7F") */
71
- color: string;
72
- /** Array of badge image URLs */
73
- badges: string[];
74
- /** Raw badge data string (e.g., "broadcaster/1,sub/12,vip/1") */
75
- badgesRaw: string;
76
- /** Raw emotes data string */
77
- emotesRaw: string;
78
- /** Emote pack data structure */
79
- emotesPack: Record<string, unknown>;
91
+ color?: string;
92
+ /** Badge identifiers or badge image URLs */
93
+ badges?: string[];
94
+ /** Lookup map used by some platforms to resolve badge identifiers to image URLs */
95
+ badgesLookup?: Record<string, string>;
96
+ /** Raw badge data string (e.g., "broadcaster/1,subscriber/12,vip/1") */
97
+ badgesRaw?: string;
98
+ /** Raw emotes data string from the platform */
99
+ emotesRaw?: string;
100
+ /** Emote pack data structure; shape varies by platform */
101
+ emotesPack?: Record<string, unknown>;
102
+ /** Whether the message contains a cheer/bits event */
103
+ isCheer?: boolean;
80
104
  /** Reply data if this message is a reply to another */
81
- reply: unknown | null;
105
+ reply?: ChatReply | null;
106
+ /** Whether this is a Twitch Power-up message */
107
+ isPowerup?: boolean;
108
+ /** Twitch Power-up message type */
109
+ powerupType?: 'animated-message' | 'gigantified-emote-message' | string | false;
110
+ /** Twitch Power-up animation name */
111
+ powerupName?: 'simmer' | 'rainbow-eclipse' | 'cosmic-abyss' | string | false;
112
+ /** Shared chat source metadata when Twitch shared chat provides it */
113
+ sharedMessage?: ChatSharedMessage;
82
114
  /** Lumia-specific user level identifiers */
83
- lumiauserlevels: number[];
115
+ lumiauserlevels?: number[];
84
116
  /** User permission levels and roles */
85
- userLevels: {
86
- /** Whether this is the streamer's own message */
87
- isSelf: boolean;
88
- /** Whether the user is a moderator */
89
- mod: boolean;
90
- /** Whether the user is a VIP */
91
- vip: boolean;
92
- /** Whether the user is a tier 3 subscriber */
93
- tier3: boolean;
94
- /** Whether the user is a tier 2 subscriber */
95
- tier2: boolean;
96
- /** Whether the user is a subscriber (any tier) */
97
- subscriber: boolean;
98
- /** Whether the user is a regular viewer */
99
- regular: boolean;
100
- /** Whether the user is a follower */
101
- follower: boolean;
102
- /** Always true - indicates any user level */
103
- anyone: boolean;
104
- };
117
+ userLevels?: ChatUserLevels;
118
+ /** Local HH:mm:ss time string generated by Lumia */
119
+ time?: string;
120
+ /** Millisecond timestamp generated by Lumia */
121
+ timestamp?: number;
105
122
  }
106
123
 
107
124
  /**
@@ -52,6 +52,8 @@ In JS, wrap tokens in quotes: `const n = Number("{{twitch_session_bits_count}}")
52
52
 
53
53
  Valid listener names: `chat`, `alert`, `hfx`, `virtuallight`, `overlaycontent`.
54
54
 
55
+ Full event payload shapes are in `custom-overlays.d.ts` and the Overlay Type Definitions page. Use `ChatEvent`, `AlertEvent`, `HfxEvent`, `VirtualLightEvent`, and `CustomOverlayContentEvent` there before guessing fields.
56
+
55
57
  Alert rules:
56
58
 
57
59
  - Branch on exact `data.alert` string equality. No `includes`, no `type`, no `platform` heuristics.
@@ -48,6 +48,26 @@ export enum ConfigsFieldType {
48
48
  */
49
49
  export type OverlayListener = 'chat' | 'alert' | 'hfx' | 'virtuallight' | 'overlaycontent';
50
50
 
51
+ export type ChatUserLevelKey = 'isSelf' | 'broadcaster' | 'mod' | 'vip' | 'tier3' | 'tier2' | 'subscriber' | 'regular' | 'follower' | 'anyone';
52
+
53
+ export type ChatUserLevels = Record<ChatUserLevelKey, boolean>;
54
+
55
+ export interface ChatReply {
56
+ /** Username of the message being replied to */
57
+ username: string;
58
+ /** Body of the message being replied to */
59
+ body: string;
60
+ }
61
+
62
+ export interface ChatSharedMessage {
63
+ /** Avatar for the source user/channel of the shared message */
64
+ avatar: string;
65
+ /** Display name for the source user/channel of the shared message */
66
+ displayname: string;
67
+ /** User ID for the source user/channel of the shared message */
68
+ userId: string;
69
+ }
70
+
51
71
  /**
52
72
  * Chat message event data structure.
53
73
  * Fired when a chat message is received from any connected platform.
@@ -55,53 +75,50 @@ export type OverlayListener = 'chat' | 'alert' | 'hfx' | 'virtuallight' | 'overl
55
75
  export interface ChatEvent {
56
76
  /** Platform origin (e.g., "twitch", "kick", "youtube", "tiktok") */
57
77
  origin: string;
58
- /** Unique message identifier */
59
- id: string;
60
- /** User's account username */
61
- username: string;
78
+ /** Unique message identifier when the platform provides one */
79
+ id?: string;
80
+ /** User's account username/login */
81
+ username?: string;
62
82
  /** User's display name (may differ from username) */
63
- displayname: string;
83
+ displayname?: string;
64
84
  /** Channel name where the message was sent */
65
- channel: string;
85
+ channel?: string;
66
86
  /** URL to the user's avatar image */
67
- avatar: string;
87
+ avatar?: string | null;
68
88
  /** The chat message content */
69
- message: string;
89
+ message?: string;
70
90
  /** User's chat color as hex code (e.g., "#00FF7F") */
71
- color: string;
72
- /** Array of badge image URLs */
73
- badges: string[];
74
- /** Raw badge data string (e.g., "broadcaster/1,sub/12,vip/1") */
75
- badgesRaw: string;
76
- /** Raw emotes data string */
77
- emotesRaw: string;
78
- /** Emote pack data structure */
79
- emotesPack: Record<string, unknown>;
91
+ color?: string;
92
+ /** Badge identifiers or badge image URLs */
93
+ badges?: string[];
94
+ /** Lookup map used by some platforms to resolve badge identifiers to image URLs */
95
+ badgesLookup?: Record<string, string>;
96
+ /** Raw badge data string (e.g., "broadcaster/1,subscriber/12,vip/1") */
97
+ badgesRaw?: string;
98
+ /** Raw emotes data string from the platform */
99
+ emotesRaw?: string;
100
+ /** Emote pack data structure; shape varies by platform */
101
+ emotesPack?: Record<string, unknown>;
102
+ /** Whether the message contains a cheer/bits event */
103
+ isCheer?: boolean;
80
104
  /** Reply data if this message is a reply to another */
81
- reply: unknown | null;
105
+ reply?: ChatReply | null;
106
+ /** Whether this is a Twitch Power-up message */
107
+ isPowerup?: boolean;
108
+ /** Twitch Power-up message type */
109
+ powerupType?: 'animated-message' | 'gigantified-emote-message' | string | false;
110
+ /** Twitch Power-up animation name */
111
+ powerupName?: 'simmer' | 'rainbow-eclipse' | 'cosmic-abyss' | string | false;
112
+ /** Shared chat source metadata when Twitch shared chat provides it */
113
+ sharedMessage?: ChatSharedMessage;
82
114
  /** Lumia-specific user level identifiers */
83
- lumiauserlevels: number[];
115
+ lumiauserlevels?: number[];
84
116
  /** User permission levels and roles */
85
- userLevels: {
86
- /** Whether this is the streamer's own message */
87
- isSelf: boolean;
88
- /** Whether the user is a moderator */
89
- mod: boolean;
90
- /** Whether the user is a VIP */
91
- vip: boolean;
92
- /** Whether the user is a tier 3 subscriber */
93
- tier3: boolean;
94
- /** Whether the user is a tier 2 subscriber */
95
- tier2: boolean;
96
- /** Whether the user is a subscriber (any tier) */
97
- subscriber: boolean;
98
- /** Whether the user is a regular viewer */
99
- regular: boolean;
100
- /** Whether the user is a follower */
101
- follower: boolean;
102
- /** Always true - indicates any user level */
103
- anyone: boolean;
104
- };
117
+ userLevels?: ChatUserLevels;
118
+ /** Local HH:mm:ss time string generated by Lumia */
119
+ time?: string;
120
+ /** Millisecond timestamp generated by Lumia */
121
+ timestamp?: number;
105
122
  }
106
123
 
107
124
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/lumia-types",
3
- "version": "3.2.8",
3
+ "version": "3.2.9",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "files": [