@lumiastream/lumia-types 3.5.3 → 3.5.4

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.
@@ -777,8 +777,6 @@ export declare enum LumiaAlertValues {
777
777
  TWITCH_WATCH_STREAK = "twitch-watchStreak",
778
778
  /** Power-ups used */
779
779
  TWITCH_POWERUPS = "twitch-powerups",
780
- /** Power-up points earned */
781
- TWITCH_POWERUPS_POINTS = "twitch-powerupsPoints",
782
780
  /** YouTube stream went live */
783
781
  YOUTUBE_STREAM_LIVE = "youtube-streamLive",
784
782
  /** YouTube stream went offline */
@@ -1797,6 +1795,10 @@ export declare enum SystemVariables {
1797
1795
  SPOTIFY_NOW_PLAYING_URL = "spotify_now_playing_url",
1798
1796
  /** Now playing Spotify URI. Use as {{spotify_now_playing_uri}}. */
1799
1797
  SPOTIFY_NOW_PLAYING_URI = "spotify_now_playing_uri",
1798
+ /** Now playing track duration in seconds. Use as {{spotify_now_playing_duration}}. */
1799
+ SPOTIFY_NOW_PLAYING_DURATION = "spotify_now_playing_duration",
1800
+ /** Now playing track progress (current position) in seconds. Use as {{spotify_now_playing_progress}}. */
1801
+ SPOTIFY_NOW_PLAYING_PROGRESS = "spotify_now_playing_progress",
1800
1802
  /** Next song title. Use as {{spotify_next_song}}. */
1801
1803
  SPOTIFY_NEXT_SONG = "spotify_next_song",
1802
1804
  /** Next song artwork URL. Use as {{spotify_next_image}}. */
@@ -1821,6 +1823,10 @@ export declare enum SystemVariables {
1821
1823
  YOUTUBEMUSIC_NOW_PLAYING_ID = "youtubemusic_now_playing_id",
1822
1824
  /** Now playing URL. Use as {{youtubemusic_now_playing_url}}. */
1823
1825
  YOUTUBEMUSIC_NOW_PLAYING_URL = "youtubemusic_now_playing_url",
1826
+ /** Now playing track duration in seconds. Use as {{youtubemusic_now_playing_duration}}. */
1827
+ YOUTUBEMUSIC_NOW_PLAYING_DURATION = "youtubemusic_now_playing_duration",
1828
+ /** Now playing track progress (current position) in seconds. Use as {{youtubemusic_now_playing_progress}}. */
1829
+ YOUTUBEMUSIC_NOW_PLAYING_PROGRESS = "youtubemusic_now_playing_progress",
1824
1830
  /** Next song title. Use as {{youtubemusic_next_song}}. */
1825
1831
  YOUTUBEMUSIC_NEXT_SONG = "youtubemusic_next_song",
1826
1832
  /** Next song artwork URL. Use as {{youtubemusic_next_image}}. */
@@ -1875,6 +1881,10 @@ export declare enum SystemVariables {
1875
1881
  VLC_NOW_PLAYING_ID = "vlc_now_playing_id",
1876
1882
  /** Media URL. Use as {{vlc_now_playing_url}}. */
1877
1883
  VLC_NOW_PLAYING_URL = "vlc_now_playing_url",
1884
+ /** Now playing media duration in seconds. Use as {{vlc_now_playing_duration}}. */
1885
+ VLC_NOW_PLAYING_DURATION = "vlc_now_playing_duration",
1886
+ /** Now playing media progress (current position) in seconds. Use as {{vlc_now_playing_progress}}. */
1887
+ VLC_NOW_PLAYING_PROGRESS = "vlc_now_playing_progress",
1878
1888
  /** Media URI. Use as {{vlc_now_playing_uri}}. */
1879
1889
  VLC_NOW_PLAYING_URI = "vlc_now_playing_uri",
1880
1890
  /** Voice changer on (true/false). Use as {{voicemod_voice_changer_on}}. */
@@ -777,8 +777,6 @@ export declare enum LumiaAlertValues {
777
777
  TWITCH_WATCH_STREAK = "twitch-watchStreak",
778
778
  /** Power-ups used */
779
779
  TWITCH_POWERUPS = "twitch-powerups",
780
- /** Power-up points earned */
781
- TWITCH_POWERUPS_POINTS = "twitch-powerupsPoints",
782
780
  /** YouTube stream went live */
783
781
  YOUTUBE_STREAM_LIVE = "youtube-streamLive",
784
782
  /** YouTube stream went offline */
@@ -1797,6 +1795,10 @@ export declare enum SystemVariables {
1797
1795
  SPOTIFY_NOW_PLAYING_URL = "spotify_now_playing_url",
1798
1796
  /** Now playing Spotify URI. Use as {{spotify_now_playing_uri}}. */
1799
1797
  SPOTIFY_NOW_PLAYING_URI = "spotify_now_playing_uri",
1798
+ /** Now playing track duration in seconds. Use as {{spotify_now_playing_duration}}. */
1799
+ SPOTIFY_NOW_PLAYING_DURATION = "spotify_now_playing_duration",
1800
+ /** Now playing track progress (current position) in seconds. Use as {{spotify_now_playing_progress}}. */
1801
+ SPOTIFY_NOW_PLAYING_PROGRESS = "spotify_now_playing_progress",
1800
1802
  /** Next song title. Use as {{spotify_next_song}}. */
1801
1803
  SPOTIFY_NEXT_SONG = "spotify_next_song",
1802
1804
  /** Next song artwork URL. Use as {{spotify_next_image}}. */
@@ -1821,6 +1823,10 @@ export declare enum SystemVariables {
1821
1823
  YOUTUBEMUSIC_NOW_PLAYING_ID = "youtubemusic_now_playing_id",
1822
1824
  /** Now playing URL. Use as {{youtubemusic_now_playing_url}}. */
1823
1825
  YOUTUBEMUSIC_NOW_PLAYING_URL = "youtubemusic_now_playing_url",
1826
+ /** Now playing track duration in seconds. Use as {{youtubemusic_now_playing_duration}}. */
1827
+ YOUTUBEMUSIC_NOW_PLAYING_DURATION = "youtubemusic_now_playing_duration",
1828
+ /** Now playing track progress (current position) in seconds. Use as {{youtubemusic_now_playing_progress}}. */
1829
+ YOUTUBEMUSIC_NOW_PLAYING_PROGRESS = "youtubemusic_now_playing_progress",
1824
1830
  /** Next song title. Use as {{youtubemusic_next_song}}. */
1825
1831
  YOUTUBEMUSIC_NEXT_SONG = "youtubemusic_next_song",
1826
1832
  /** Next song artwork URL. Use as {{youtubemusic_next_image}}. */
@@ -1875,6 +1881,10 @@ export declare enum SystemVariables {
1875
1881
  VLC_NOW_PLAYING_ID = "vlc_now_playing_id",
1876
1882
  /** Media URL. Use as {{vlc_now_playing_url}}. */
1877
1883
  VLC_NOW_PLAYING_URL = "vlc_now_playing_url",
1884
+ /** Now playing media duration in seconds. Use as {{vlc_now_playing_duration}}. */
1885
+ VLC_NOW_PLAYING_DURATION = "vlc_now_playing_duration",
1886
+ /** Now playing media progress (current position) in seconds. Use as {{vlc_now_playing_progress}}. */
1887
+ VLC_NOW_PLAYING_PROGRESS = "vlc_now_playing_progress",
1878
1888
  /** Media URI. Use as {{vlc_now_playing_uri}}. */
1879
1889
  VLC_NOW_PLAYING_URI = "vlc_now_playing_uri",
1880
1890
  /** Voice changer on (true/false). Use as {{voicemod_voice_changer_on}}. */
@@ -0,0 +1,8 @@
1
+ export declare const EMULATE_EXAMPLE_AVATAR_URL = "https://static-cdn.jtvnw.net/jtv_user_pictures/2b1fa336-f9b2-42cf-bd2c-98675da74982-profile_image-300x300.png";
2
+ export declare function getExampleAlertVariableValue(variableName: string): string | number | boolean;
3
+ export declare function buildExampleAlertVariables(acceptedVariables: string[] | undefined, existingExtraSettings?: Record<string, any>): Record<string, any>;
4
+ export interface InputFieldLike {
5
+ variableField: string;
6
+ }
7
+ export declare function isRedundantInputField(inputField: InputFieldLike, allInputFields: ReadonlyArray<InputFieldLike> | undefined): boolean;
8
+ export declare function syncLinkedVariableFields(values: Record<string, any>): void;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EMULATE_EXAMPLE_AVATAR_URL = void 0;
4
+ exports.getExampleAlertVariableValue = getExampleAlertVariableValue;
5
+ exports.buildExampleAlertVariables = buildExampleAlertVariables;
6
+ exports.isRedundantInputField = isRedundantInputField;
7
+ exports.syncLinkedVariableFields = syncLinkedVariableFields;
8
+ exports.EMULATE_EXAMPLE_AVATAR_URL = 'https://static-cdn.jtvnw.net/jtv_user_pictures/2b1fa336-f9b2-42cf-bd2c-98675da74982-profile_image-300x300.png';
9
+ function getExampleAlertVariableValue(variableName) {
10
+ const lowered = variableName.toLowerCase();
11
+ if (lowered.includes('avatar') || lowered.includes('image') || lowered.includes('thumbnail') || lowered.includes('cover') || lowered.includes('icon')) {
12
+ return exports.EMULATE_EXAMPLE_AVATAR_URL;
13
+ }
14
+ if (lowered.includes('url') || lowered.includes('link')) {
15
+ return 'https://lumia.stream';
16
+ }
17
+ if (lowered.endsWith('symbol') || lowered === 'currencysymbol') {
18
+ return '$';
19
+ }
20
+ if (lowered.includes('currency')) {
21
+ return 'USD';
22
+ }
23
+ if (lowered.includes('color')) {
24
+ return '#FF4076';
25
+ }
26
+ if (lowered.includes('amount') ||
27
+ lowered.includes('bits') ||
28
+ lowered.includes('count') ||
29
+ lowered.includes('total') ||
30
+ lowered.includes('viewers') ||
31
+ lowered.includes('points') ||
32
+ lowered.includes('level') ||
33
+ lowered.includes('progress') ||
34
+ lowered.includes('duration') ||
35
+ lowered.includes('price')) {
36
+ return 42;
37
+ }
38
+ if (lowered.startsWith('is') || lowered.startsWith('has') || lowered.startsWith('can') || lowered.startsWith('should')) {
39
+ return true;
40
+ }
41
+ if (lowered.includes('date')) {
42
+ return new Date().toISOString().slice(0, 10);
43
+ }
44
+ if (lowered.includes('time')) {
45
+ return new Date().toISOString();
46
+ }
47
+ if (lowered.includes('song') || lowered.includes('track') || lowered.includes('title')) {
48
+ return 'Example Title';
49
+ }
50
+ if (lowered.includes('artist')) {
51
+ return 'Example Artist';
52
+ }
53
+ if (lowered.includes('album')) {
54
+ return 'Example Album';
55
+ }
56
+ if (lowered.includes('username') || lowered.includes('user') || lowered.includes('viewer') || lowered.includes('sender') || lowered.includes('author')) {
57
+ return 'lumiastream';
58
+ }
59
+ if (lowered.includes('message') || lowered.includes('text') || lowered.includes('content') || lowered.includes('body')) {
60
+ return 'Example message';
61
+ }
62
+ if (lowered.endsWith('id') || lowered.includes('_id')) {
63
+ return '12345';
64
+ }
65
+ return `Example ${variableName}`;
66
+ }
67
+ function buildExampleAlertVariables(acceptedVariables, existingExtraSettings) {
68
+ if (!Array.isArray(acceptedVariables) || acceptedVariables.length === 0) {
69
+ return {};
70
+ }
71
+ const currentValues = existingExtraSettings !== null && existingExtraSettings !== void 0 ? existingExtraSettings : {};
72
+ return acceptedVariables.reduce((all, variableName) => {
73
+ if (typeof variableName !== 'string') {
74
+ return all;
75
+ }
76
+ const cleanedVariableName = variableName.replace(/^\{\{|\}\}$/g, '').trim();
77
+ if (!cleanedVariableName) {
78
+ return all;
79
+ }
80
+ if (Object.prototype.hasOwnProperty.call(currentValues, cleanedVariableName)) {
81
+ return all;
82
+ }
83
+ return { ...all, [cleanedVariableName]: getExampleAlertVariableValue(cleanedVariableName) };
84
+ }, {});
85
+ }
86
+ const LINKED_VARIABLE_FIELD_GROUPS = [['giftAmount', 'amount']];
87
+ function isRedundantInputField(inputField, allInputFields) {
88
+ if (!inputField || !allInputFields)
89
+ return false;
90
+ for (const group of LINKED_VARIABLE_FIELD_GROUPS) {
91
+ const idx = group.indexOf(inputField.variableField);
92
+ if (idx <= 0)
93
+ continue;
94
+ const primary = group[0];
95
+ if (allInputFields.some((f) => f.variableField === primary)) {
96
+ return true;
97
+ }
98
+ }
99
+ return false;
100
+ }
101
+ function syncLinkedVariableFields(values) {
102
+ if (!values)
103
+ return;
104
+ for (const group of LINKED_VARIABLE_FIELD_GROUPS) {
105
+ let source;
106
+ let sourceKey;
107
+ for (const key of group) {
108
+ if (values[key] !== undefined && values[key] !== null && values[key] !== '') {
109
+ source = values[key];
110
+ sourceKey = key;
111
+ break;
112
+ }
113
+ }
114
+ if (sourceKey === undefined)
115
+ continue;
116
+ for (const key of group) {
117
+ if (key === sourceKey)
118
+ continue;
119
+ if (values[key] === undefined || values[key] === null || values[key] === '') {
120
+ values[key] = source;
121
+ }
122
+ }
123
+ }
124
+ }
@@ -275,8 +275,6 @@ export var LumiaAlertValues;
275
275
  LumiaAlertValues["TWITCH_WATCH_STREAK"] = "twitch-watchStreak";
276
276
  /** Power-ups used */
277
277
  LumiaAlertValues["TWITCH_POWERUPS"] = "twitch-powerups";
278
- /** Power-up points earned */
279
- LumiaAlertValues["TWITCH_POWERUPS_POINTS"] = "twitch-powerupsPoints";
280
278
  // YouTube alerts
281
279
  /** YouTube stream went live */
282
280
  LumiaAlertValues["YOUTUBE_STREAM_LIVE"] = "youtube-streamLive";
@@ -659,7 +657,6 @@ export const LumiaAlertFriendlyValues = {
659
657
  [LumiaAlertValues.TWITCH_AD_STOPPED]: 'Twitch Ad Stopped',
660
658
  [LumiaAlertValues.TWITCH_WATCH_STREAK]: 'Twitch Watch Streak',
661
659
  [LumiaAlertValues.TWITCH_POWERUPS]: 'Twitch Powerups',
662
- [LumiaAlertValues.TWITCH_POWERUPS_POINTS]: 'Twitch Powerups points',
663
660
  [LumiaAlertValues.YOUTUBE_STREAM_LIVE]: 'Youtube Stream Live',
664
661
  [LumiaAlertValues.YOUTUBE_STREAM_OFFLINE]: 'Youtube Stream Offline',
665
662
  [LumiaAlertValues.YOUTUBE_FIRST_CHATTER]: 'Youtube First Chatter',