@tixyel/streamelements 7.3.1 → 7.5.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.d.ts +179 -145
- package/dist/index.es.js +907 -840
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1001,6 +1001,20 @@ declare namespace StreamElements {
|
|
|
1001
1001
|
isEditorMode: boolean;
|
|
1002
1002
|
muted: boolean;
|
|
1003
1003
|
};
|
|
1004
|
+
events: {
|
|
1005
|
+
emit<L extends Event.Listener>(event: L, data: Event.EventData<L>['event']): {
|
|
1006
|
+
ok: boolean;
|
|
1007
|
+
};
|
|
1008
|
+
emit<T extends Record<string, any>, E extends string>(event: E extends Event.Listener ? never : E, data: T): {
|
|
1009
|
+
ok: boolean;
|
|
1010
|
+
};
|
|
1011
|
+
broadcast<L extends Event.Listener>(event: L, data: Event.EventData<L>['event']): {
|
|
1012
|
+
ok: boolean;
|
|
1013
|
+
};
|
|
1014
|
+
broadcast<T extends Record<string, any>, E extends string>(event: E extends Event.Listener ? never : E, data: T): {
|
|
1015
|
+
ok: boolean;
|
|
1016
|
+
};
|
|
1017
|
+
};
|
|
1004
1018
|
};
|
|
1005
1019
|
namespace Event {
|
|
1006
1020
|
type onWidgetLoad = {
|
|
@@ -1104,6 +1118,17 @@ declare namespace StreamElements {
|
|
|
1104
1118
|
type onEventReceived = (Provider.Twitch.Events | Provider.YouTube.Events | Provider.StreamElements.Events) & {
|
|
1105
1119
|
emulated?: boolean;
|
|
1106
1120
|
};
|
|
1121
|
+
type Listener = onEventReceived['listener'];
|
|
1122
|
+
type EventByListener = {
|
|
1123
|
+
[L in Listener]: Extract<onEventReceived, {
|
|
1124
|
+
listener: L;
|
|
1125
|
+
}>['event'];
|
|
1126
|
+
};
|
|
1127
|
+
type EventData<L extends Listener = Listener> = {
|
|
1128
|
+
listener: L;
|
|
1129
|
+
event: EventByListener[L];
|
|
1130
|
+
emulated?: boolean;
|
|
1131
|
+
};
|
|
1107
1132
|
}
|
|
1108
1133
|
namespace Session {
|
|
1109
1134
|
type Data = Tip & Host & Raid & Cheer & Merch & Purchase & Follower & Hypetrain & Superchat & Sponsor & Subscriber & CheerPurchase & ChannelPoints & CharityCampaignDonation;
|
|
@@ -3353,156 +3378,165 @@ declare namespace Helper {
|
|
|
3353
3378
|
const utils: UtilsHelper;
|
|
3354
3379
|
}
|
|
3355
3380
|
|
|
3356
|
-
declare
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
session: {
|
|
3371
|
-
types: Record<string, StreamElements.Session.Config.Any>;
|
|
3372
|
-
available(): StreamElements.Session.Config.Available.Data;
|
|
3373
|
-
get(startSession?: StreamElements.Session.Data): Promise<StreamElements.Session.Data>;
|
|
3374
|
-
};
|
|
3375
|
-
event: {
|
|
3376
|
-
/**
|
|
3377
|
-
* Simulates the onWidgetLoad event for a widget.
|
|
3378
|
-
* @param fields - The field values to be included in the event.
|
|
3379
|
-
* @param session - The session data to be included in the event.
|
|
3380
|
-
* @param currency - The currency to be used (default is 'USD').
|
|
3381
|
-
* @returns A Promise that resolves to the simulated onWidgetLoad event data.
|
|
3382
|
-
*/
|
|
3383
|
-
onWidgetLoad(fields: Record<string, StreamElements.CustomField.Value>, session: StreamElements.Session.Data, currency?: "BRL" | "USD" | "EUR"): Promise<StreamElements.Event.onWidgetLoad>;
|
|
3384
|
-
/**
|
|
3385
|
-
* Simulates the onSessionUpdate event for a widget.
|
|
3386
|
-
* @param session - The session data to be included in the event.
|
|
3387
|
-
* @returns A Promise that resolves to the simulated onSessionUpdate event data.
|
|
3388
|
-
*/
|
|
3389
|
-
onSessionUpdate(session?: StreamElements.Session.Data, update?: ClientEvents$1): Promise<StreamElements.Event.onSessionUpdate>;
|
|
3390
|
-
/**
|
|
3391
|
-
* Simulates the onEventReceived event for a widget.
|
|
3392
|
-
* @param provider - The provider of the event (default is 'random').
|
|
3393
|
-
* @param type - The type of event to simulate (default is 'random').
|
|
3394
|
-
* @param options - Additional options to customize the event data.
|
|
3395
|
-
* @returns A Promise that resolves to the simulated onEventReceived event data, or null if the event type is not supported.
|
|
3396
|
-
* @example
|
|
3397
|
-
* ```javascript
|
|
3398
|
-
* // Simulate a random event
|
|
3399
|
-
* const randomEvent = await Local .generate.event.onEventReceived();
|
|
3400
|
-
*
|
|
3401
|
-
* // Simulate a Twitch message event with custom options
|
|
3402
|
-
* const twitchMessageEvent = await Local .generate.event.onEventReceived('twitch', 'message', { name: 'Streamer', message: 'Hello World!' });
|
|
3403
|
-
* ```
|
|
3404
|
-
*/
|
|
3405
|
-
onEventReceived(provider?: Provider$1 | "random", type?: StreamElements.Event.onEventReceived["listener"] | "random" | "tip" | "cheer" | "follower" | "raid" | "subscriber", options?: Record<string, string | number | boolean>): Promise<StreamElements.Event.onEventReceived | null>;
|
|
3406
|
-
};
|
|
3407
|
-
};
|
|
3408
|
-
const emulate: {
|
|
3409
|
-
twitch: {
|
|
3410
|
-
message(data?: Partial<{
|
|
3411
|
-
name: string;
|
|
3412
|
-
message: string;
|
|
3413
|
-
badges: BadgeOptions;
|
|
3414
|
-
color: string;
|
|
3415
|
-
userId: string;
|
|
3381
|
+
declare class Emulator {
|
|
3382
|
+
twitch: {
|
|
3383
|
+
message(data?: Partial<{
|
|
3384
|
+
name: string;
|
|
3385
|
+
message: string;
|
|
3386
|
+
badges: BadgeOptions;
|
|
3387
|
+
color: string;
|
|
3388
|
+
userId: string;
|
|
3389
|
+
msgId: string;
|
|
3390
|
+
channel: string;
|
|
3391
|
+
time: number;
|
|
3392
|
+
firstMsg: boolean;
|
|
3393
|
+
returningChatter: boolean;
|
|
3394
|
+
reply: {
|
|
3416
3395
|
msgId: string;
|
|
3417
|
-
channel: string;
|
|
3418
|
-
time: number;
|
|
3419
|
-
firstMsg: boolean;
|
|
3420
|
-
returningChatter: boolean;
|
|
3421
|
-
reply: {
|
|
3422
|
-
msgId: string;
|
|
3423
|
-
userId: string;
|
|
3424
|
-
login: string;
|
|
3425
|
-
name: string;
|
|
3426
|
-
text: string;
|
|
3427
|
-
};
|
|
3428
|
-
thread: {
|
|
3429
|
-
msgId: string;
|
|
3430
|
-
name: string;
|
|
3431
|
-
};
|
|
3432
|
-
}>): void;
|
|
3433
|
-
deleteMessage(msgId: string): void;
|
|
3434
|
-
deleteMessages(userId: string): void;
|
|
3435
|
-
follower(data?: Partial<{
|
|
3436
|
-
avatar: string;
|
|
3437
|
-
name: string;
|
|
3438
|
-
}>): void;
|
|
3439
|
-
raid(data?: Partial<{
|
|
3440
|
-
amount: number;
|
|
3441
|
-
avatar: string;
|
|
3442
|
-
name: string;
|
|
3443
|
-
}>): void;
|
|
3444
|
-
cheer(data?: Partial<{
|
|
3445
|
-
amount: number;
|
|
3446
|
-
avatar: string;
|
|
3447
|
-
name: string;
|
|
3448
|
-
message: string;
|
|
3449
|
-
}>): void;
|
|
3450
|
-
subscriber(data?: Partial<{
|
|
3451
|
-
tier: "1000" | "2000" | "3000" | "prime";
|
|
3452
|
-
amount: number;
|
|
3453
|
-
avatar: string;
|
|
3454
|
-
name: string;
|
|
3455
|
-
sender: string;
|
|
3456
|
-
message: string;
|
|
3457
|
-
subType: "default" | "gift" | "community" | "spam";
|
|
3458
|
-
}> & {
|
|
3459
|
-
subType?: "default" | "gift" | "community" | "spam";
|
|
3460
|
-
}): void;
|
|
3461
|
-
};
|
|
3462
|
-
streamelements: {
|
|
3463
|
-
tip(data?: Partial<{
|
|
3464
|
-
amount: number;
|
|
3465
|
-
avatar: string;
|
|
3466
|
-
name: string;
|
|
3467
|
-
}>): void;
|
|
3468
|
-
};
|
|
3469
|
-
youtube: {
|
|
3470
|
-
message(data?: Partial<{
|
|
3471
|
-
name: string;
|
|
3472
|
-
message: string;
|
|
3473
|
-
badges: BadgeOptions;
|
|
3474
|
-
color: string;
|
|
3475
3396
|
userId: string;
|
|
3476
|
-
|
|
3477
|
-
channel: string;
|
|
3478
|
-
time: number;
|
|
3479
|
-
avatar: string;
|
|
3480
|
-
}>): void;
|
|
3481
|
-
subscriber(data?: Partial<{
|
|
3482
|
-
avatar: string;
|
|
3397
|
+
login: string;
|
|
3483
3398
|
name: string;
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
name: string;
|
|
3489
|
-
}>): void;
|
|
3490
|
-
sponsor(data?: Partial<{
|
|
3491
|
-
tier: "1000" | "2000" | "3000";
|
|
3492
|
-
amount: number;
|
|
3493
|
-
avatar: string;
|
|
3399
|
+
text: string;
|
|
3400
|
+
};
|
|
3401
|
+
thread: {
|
|
3402
|
+
msgId: string;
|
|
3494
3403
|
name: string;
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3404
|
+
};
|
|
3405
|
+
}>): void;
|
|
3406
|
+
deleteMessage(msgId: string): void;
|
|
3407
|
+
deleteMessages(userId: string): void;
|
|
3408
|
+
follower(data?: Partial<{
|
|
3409
|
+
avatar: string;
|
|
3410
|
+
name: string;
|
|
3411
|
+
}>): void;
|
|
3412
|
+
raid(data?: Partial<{
|
|
3413
|
+
amount: number;
|
|
3414
|
+
avatar: string;
|
|
3415
|
+
name: string;
|
|
3416
|
+
}>): void;
|
|
3417
|
+
cheer(data?: Partial<{
|
|
3418
|
+
amount: number;
|
|
3419
|
+
avatar: string;
|
|
3420
|
+
name: string;
|
|
3421
|
+
message: string;
|
|
3422
|
+
}>): void;
|
|
3423
|
+
subscriber(data?: Partial<{
|
|
3424
|
+
tier: "1000" | "2000" | "3000" | "prime";
|
|
3425
|
+
amount: number;
|
|
3426
|
+
avatar: string;
|
|
3427
|
+
name: string;
|
|
3428
|
+
sender: string;
|
|
3429
|
+
message: string;
|
|
3430
|
+
subType: "default" | "gift" | "community" | "spam";
|
|
3431
|
+
}> & {
|
|
3432
|
+
subType?: "default" | "gift" | "community" | "spam";
|
|
3433
|
+
}): void;
|
|
3434
|
+
};
|
|
3435
|
+
streamelements: {
|
|
3436
|
+
tip(data?: Partial<{
|
|
3437
|
+
amount: number;
|
|
3438
|
+
avatar: string;
|
|
3439
|
+
name: string;
|
|
3440
|
+
}>): void;
|
|
3505
3441
|
};
|
|
3442
|
+
youtube: {
|
|
3443
|
+
message(data?: Partial<{
|
|
3444
|
+
name: string;
|
|
3445
|
+
message: string;
|
|
3446
|
+
badges: BadgeOptions;
|
|
3447
|
+
color: string;
|
|
3448
|
+
userId: string;
|
|
3449
|
+
msgId: string;
|
|
3450
|
+
channel: string;
|
|
3451
|
+
time: number;
|
|
3452
|
+
avatar: string;
|
|
3453
|
+
}>): void;
|
|
3454
|
+
subscriber(data?: Partial<{
|
|
3455
|
+
avatar: string;
|
|
3456
|
+
name: string;
|
|
3457
|
+
}>): void;
|
|
3458
|
+
superchat(data?: Partial<{
|
|
3459
|
+
amount: number;
|
|
3460
|
+
avatar: string;
|
|
3461
|
+
name: string;
|
|
3462
|
+
}>): void;
|
|
3463
|
+
sponsor(data?: Partial<{
|
|
3464
|
+
tier: "1000" | "2000" | "3000";
|
|
3465
|
+
amount: number;
|
|
3466
|
+
avatar: string;
|
|
3467
|
+
name: string;
|
|
3468
|
+
sender: string;
|
|
3469
|
+
message: string;
|
|
3470
|
+
subType: "default" | "gift" | "community" | "spam";
|
|
3471
|
+
}> & {
|
|
3472
|
+
subType?: "default" | "gift" | "community" | "spam";
|
|
3473
|
+
}): void;
|
|
3474
|
+
};
|
|
3475
|
+
kick: {};
|
|
3476
|
+
facebook: {};
|
|
3477
|
+
send<T extends 'onEventReceived' | 'onSessionUpdate' | 'onWidgetLoad'>(listener: T, event: T extends 'onEventReceived' ? StreamElements.Event.onEventReceived : T extends 'onSessionUpdate' ? StreamElements.Event.onSessionUpdate : StreamElements.Event.onWidgetLoad): void;
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3480
|
+
/**
|
|
3481
|
+
* Simulates the onWidgetLoad event for a widget.
|
|
3482
|
+
* @param fields - The field values to be included in the event.
|
|
3483
|
+
* @param session - The session data to be included in the event.
|
|
3484
|
+
* @param currency - The currency to be used (default is 'USD').
|
|
3485
|
+
* @returns A Promise that resolves to the simulated onWidgetLoad event data.
|
|
3486
|
+
*/
|
|
3487
|
+
declare function onWidgetLoad(fields: Record<string, StreamElements.CustomField.Value>, session: StreamElements.Session.Data, currency?: 'BRL' | 'USD' | 'EUR'): Promise<StreamElements.Event.onWidgetLoad>;
|
|
3488
|
+
/**
|
|
3489
|
+
* Simulates the onSessionUpdate event for a widget.
|
|
3490
|
+
* @param session - The session data to be included in the event.
|
|
3491
|
+
* @returns A Promise that resolves to the simulated onSessionUpdate event data.
|
|
3492
|
+
*/
|
|
3493
|
+
declare function onSessionUpdate(session?: StreamElements.Session.Data, update?: ClientEvents$1): Promise<StreamElements.Event.onSessionUpdate>;
|
|
3494
|
+
/**
|
|
3495
|
+
* Simulates the onEventReceived event for a widget.
|
|
3496
|
+
* @param provider - The provider of the event (default is 'random').
|
|
3497
|
+
* @param type - The type of event to simulate (default is 'random').
|
|
3498
|
+
* @param options - Additional options to customize the event data.
|
|
3499
|
+
* @returns A Promise that resolves to the simulated onEventReceived event data, or null if the event type is not supported.
|
|
3500
|
+
* @example
|
|
3501
|
+
* ```javascript
|
|
3502
|
+
* // Simulate a random event
|
|
3503
|
+
* const randomEvent = await onEventReceived();
|
|
3504
|
+
*
|
|
3505
|
+
* // Simulate a Twitch message event with custom options
|
|
3506
|
+
* const twitchMessageEvent = await onEventReceived('twitch', 'message', { name: 'Streamer', message: 'Hello World!' });
|
|
3507
|
+
* ```
|
|
3508
|
+
*/
|
|
3509
|
+
declare function onEventReceived(provider?: Provider$1 | 'random', type?: StreamElements.Event.onEventReceived['listener'] | 'random' | 'tip' | 'cheer' | 'follower' | 'raid' | 'subscriber', options?: Record<string, string | number | boolean>): Promise<StreamElements.Event.onEventReceived | null>;
|
|
3510
|
+
declare class Generator {
|
|
3511
|
+
event: {
|
|
3512
|
+
onWidgetLoad: typeof onWidgetLoad;
|
|
3513
|
+
onSessionUpdate: typeof onSessionUpdate;
|
|
3514
|
+
onEventReceived: typeof onEventReceived;
|
|
3515
|
+
};
|
|
3516
|
+
session: {
|
|
3517
|
+
types: Record<string, StreamElements.Session.Config.Any>;
|
|
3518
|
+
available(): StreamElements.Session.Config.Available.Data;
|
|
3519
|
+
get(startSession?: StreamElements.Session.Data): Promise<StreamElements.Session.Data>;
|
|
3520
|
+
};
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
type localQueueItem = {
|
|
3524
|
+
listener: 'onEventReceived';
|
|
3525
|
+
data: StreamElements.Event.onEventReceived;
|
|
3526
|
+
session?: boolean;
|
|
3527
|
+
} | {
|
|
3528
|
+
listener: 'onWidgetLoad';
|
|
3529
|
+
data: StreamElements.Event.onWidgetLoad;
|
|
3530
|
+
} | {
|
|
3531
|
+
listener: 'onSessionUpdate';
|
|
3532
|
+
data: StreamElements.Event.onSessionUpdate;
|
|
3533
|
+
};
|
|
3534
|
+
|
|
3535
|
+
declare namespace Local {
|
|
3536
|
+
type QueueItem = localQueueItem;
|
|
3537
|
+
const queue: useQueue<localQueueItem>;
|
|
3538
|
+
const generate: Generator;
|
|
3539
|
+
const emulate: Emulator;
|
|
3506
3540
|
function start(fieldsFile?: string[], dataFiles?: string[], session?: StreamElements.Session.Data): Promise<void>;
|
|
3507
3541
|
}
|
|
3508
3542
|
|