sparkle-react 0.0.58 → 0.0.59
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.mts +291 -41
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import * as _twurple_api from '@twurple/api';
|
|
3
4
|
|
|
4
5
|
declare const sparkleConfig: z.ZodObject<{
|
|
5
6
|
userId: z.ZodString;
|
|
@@ -368,16 +369,259 @@ declare function useTask(): {
|
|
|
368
369
|
invokeUntil: (taskId: string, delaySeconds: number, payload?: unknown) => Promise<boolean>;
|
|
369
370
|
};
|
|
370
371
|
|
|
371
|
-
|
|
372
|
+
interface Pagination extends ForwardPagination {
|
|
373
|
+
before?: string;
|
|
374
|
+
}
|
|
372
375
|
type UserId = string | number;
|
|
376
|
+
interface CustomRewardRedemptionFilter {
|
|
377
|
+
newestFirst?: boolean;
|
|
378
|
+
}
|
|
379
|
+
interface PaginatedCustomRewardRedemptionFilter extends CustomRewardRedemptionFilter, ForwardPagination {
|
|
380
|
+
}
|
|
381
|
+
interface Subscription {
|
|
382
|
+
gifterId: string | null;
|
|
383
|
+
gifterName: string | null;
|
|
384
|
+
gifterDisplayName: string | null;
|
|
385
|
+
userId: string;
|
|
386
|
+
userName: string;
|
|
387
|
+
userDisplayName: string;
|
|
388
|
+
isGift: boolean;
|
|
389
|
+
tier: string;
|
|
390
|
+
}
|
|
391
|
+
interface SubscriptionData {
|
|
392
|
+
data: Subscription[];
|
|
393
|
+
cursor: string | null;
|
|
394
|
+
points: number;
|
|
395
|
+
total: number;
|
|
396
|
+
}
|
|
397
|
+
interface ChatChatterData {
|
|
398
|
+
userId: string;
|
|
399
|
+
userName: string;
|
|
400
|
+
userDisplayName: string;
|
|
401
|
+
}
|
|
402
|
+
interface ChatSettings {
|
|
403
|
+
slowModeEnabled: boolean;
|
|
404
|
+
slowModeDelay: number | null;
|
|
405
|
+
followerOnlyModeEnabled: boolean;
|
|
406
|
+
followerOnlyModeDelay: number | null;
|
|
407
|
+
subscriberOnlyModeEnabled: boolean;
|
|
408
|
+
emoteOnlyModeEnabled: boolean;
|
|
409
|
+
uniqueChatModeEnabled: boolean;
|
|
410
|
+
}
|
|
411
|
+
interface PrivilegedChatSettings extends ChatSettings {
|
|
412
|
+
nonModeratorChatDelay: boolean;
|
|
413
|
+
nonModeratorChatDelayDuration: number | null;
|
|
414
|
+
}
|
|
415
|
+
interface CustomReward {
|
|
416
|
+
id: string;
|
|
417
|
+
backgroundColor: string;
|
|
418
|
+
isEnabled: boolean;
|
|
419
|
+
cost: number;
|
|
420
|
+
title: string;
|
|
421
|
+
prompt: string;
|
|
422
|
+
userInputRequired: boolean;
|
|
423
|
+
maxRedemptionsPerStream: number | null;
|
|
424
|
+
maxRedemptionsPerUserPerStream: number | null;
|
|
425
|
+
globalCooldown: number | null;
|
|
426
|
+
isPaused: boolean;
|
|
427
|
+
isInStock: boolean;
|
|
428
|
+
redemptionsThisStream: number | null;
|
|
429
|
+
autoFulfill: boolean;
|
|
430
|
+
cooldownExpiryDate: Date | null;
|
|
431
|
+
}
|
|
432
|
+
interface CustomRewardRedemption {
|
|
433
|
+
id: string;
|
|
434
|
+
userId: string;
|
|
435
|
+
userName: string;
|
|
436
|
+
userDisplayName: string;
|
|
437
|
+
userInput: string;
|
|
438
|
+
isFulfilled: boolean;
|
|
439
|
+
isCanceled: boolean;
|
|
440
|
+
redemptionDate: Date;
|
|
441
|
+
rewardId: string;
|
|
442
|
+
rewardTitle: string;
|
|
443
|
+
rewardPrompt: string;
|
|
444
|
+
rewardCost: number;
|
|
445
|
+
}
|
|
446
|
+
interface BitsLeaderboardEntry {
|
|
447
|
+
amount: number;
|
|
448
|
+
rank: number;
|
|
449
|
+
userDisplayName: string;
|
|
450
|
+
userId: string;
|
|
451
|
+
userName: string;
|
|
452
|
+
}
|
|
453
|
+
interface BitsLeaderboard {
|
|
454
|
+
entries: BitsLeaderboardEntry[];
|
|
455
|
+
totalCount: number;
|
|
456
|
+
}
|
|
457
|
+
type BitsLeaderboardPeriod = "day" | "week" | "month" | "year" | "all";
|
|
458
|
+
interface BitsLeaderboardQuery {
|
|
459
|
+
count?: number;
|
|
460
|
+
period?: BitsLeaderboardPeriod;
|
|
461
|
+
startDate?: Date;
|
|
462
|
+
contextUserId?: string;
|
|
463
|
+
}
|
|
464
|
+
interface Channel {
|
|
465
|
+
id: string;
|
|
466
|
+
name: string;
|
|
467
|
+
displayName: string;
|
|
468
|
+
language: string;
|
|
469
|
+
gameId: string;
|
|
470
|
+
gameName: string;
|
|
471
|
+
title: string;
|
|
472
|
+
delay: number;
|
|
473
|
+
tags: string[];
|
|
474
|
+
contentClassificationLabels: string[];
|
|
475
|
+
isBrandedContent: boolean;
|
|
476
|
+
}
|
|
477
|
+
interface ChannelEditor {
|
|
478
|
+
userId: string;
|
|
479
|
+
userDisplayName: string;
|
|
480
|
+
creationDate: Date;
|
|
481
|
+
}
|
|
482
|
+
interface Clip {
|
|
483
|
+
id: string;
|
|
484
|
+
url: string;
|
|
485
|
+
embedUrl: string;
|
|
486
|
+
creatorId: string;
|
|
487
|
+
creatorName: string;
|
|
488
|
+
videoId: string;
|
|
489
|
+
gameId: string;
|
|
490
|
+
language: string;
|
|
491
|
+
title: string;
|
|
492
|
+
viewCount: number;
|
|
493
|
+
createdAt: Date;
|
|
494
|
+
thumbnailUrl: string;
|
|
495
|
+
}
|
|
496
|
+
interface PaginatedClipFilter extends Pagination {
|
|
497
|
+
startDate?: string;
|
|
498
|
+
endDate?: string;
|
|
499
|
+
isFeatured?: boolean;
|
|
500
|
+
}
|
|
501
|
+
type GoalType = "follower" | "subscription" | "subscription_count" | "new_subscription" | "new_subscription_count";
|
|
502
|
+
interface Goal {
|
|
503
|
+
id: string;
|
|
504
|
+
type: GoalType;
|
|
505
|
+
description: string;
|
|
506
|
+
currentAmount: number;
|
|
507
|
+
targetAmount: number;
|
|
508
|
+
creationDate: Date;
|
|
509
|
+
}
|
|
510
|
+
type StreamType = "live" | "vodcast" | "";
|
|
511
|
+
interface Stream {
|
|
512
|
+
id: string;
|
|
513
|
+
userId: string;
|
|
514
|
+
userName: string;
|
|
515
|
+
userDisplayName: string;
|
|
516
|
+
gameId: string;
|
|
517
|
+
gameName: string;
|
|
518
|
+
type: StreamType;
|
|
519
|
+
title: string;
|
|
520
|
+
viewers: number;
|
|
521
|
+
startDate: Date;
|
|
522
|
+
language: string;
|
|
523
|
+
thumbnailUrl: string;
|
|
524
|
+
tags: string[];
|
|
525
|
+
isMature: boolean;
|
|
526
|
+
}
|
|
527
|
+
interface StreamMarker {
|
|
528
|
+
id: string;
|
|
529
|
+
creationDate: Date;
|
|
530
|
+
description: string;
|
|
531
|
+
positionInSeconds: number;
|
|
532
|
+
url: string;
|
|
533
|
+
}
|
|
534
|
+
interface BlockedTerm {
|
|
535
|
+
id: string;
|
|
536
|
+
creationDate: Date;
|
|
537
|
+
expirationDate: Date;
|
|
538
|
+
updatedDate: Date;
|
|
539
|
+
moderatorId: string;
|
|
540
|
+
text: string;
|
|
541
|
+
}
|
|
542
|
+
interface Poll {
|
|
543
|
+
id: string;
|
|
544
|
+
broadcasterId: string;
|
|
545
|
+
broadcasterName: string;
|
|
546
|
+
broadcasterDisplayName: string;
|
|
547
|
+
title: string;
|
|
548
|
+
isChannelPointsVotingEnabled: boolean;
|
|
549
|
+
channelPointsPerVote: number;
|
|
550
|
+
status: _twurple_api.HelixPollStatus;
|
|
551
|
+
durationInSeconds: number;
|
|
552
|
+
startDate: Date;
|
|
553
|
+
endDate: Date;
|
|
554
|
+
choices: {
|
|
555
|
+
id: string;
|
|
556
|
+
title: string;
|
|
557
|
+
totalVotes: number;
|
|
558
|
+
channelPointsVotes: number;
|
|
559
|
+
}[];
|
|
560
|
+
}
|
|
561
|
+
type PredictionOutcomeColor = "BLUE" | "PINK";
|
|
562
|
+
type PredictionStatus = "ACTIVE" | "RESOLVED" | "CANCELED" | "LOCKED";
|
|
563
|
+
interface Prediction {
|
|
564
|
+
id: string;
|
|
565
|
+
title: string;
|
|
566
|
+
status: PredictionStatus;
|
|
567
|
+
autoLockAfter: number;
|
|
568
|
+
createdAt: Date;
|
|
569
|
+
endedAt: Date | null;
|
|
570
|
+
lockedAt: Date | null;
|
|
571
|
+
outcomes: PredictionOutcome[];
|
|
572
|
+
winningOutcomeId: string | null;
|
|
573
|
+
winningOutcome: PredictionOutcome | null;
|
|
574
|
+
}
|
|
575
|
+
interface Predictor {
|
|
576
|
+
userId: string;
|
|
577
|
+
userName: string;
|
|
578
|
+
userDisplayName: string;
|
|
579
|
+
channelPointsUsed: number;
|
|
580
|
+
channelPointsWon: number | null;
|
|
581
|
+
}
|
|
582
|
+
interface PredictionOutcome {
|
|
583
|
+
id: string;
|
|
584
|
+
title: string;
|
|
585
|
+
users: number;
|
|
586
|
+
totalChannelPoints: number;
|
|
587
|
+
color: PredictionOutcomeColor;
|
|
588
|
+
topPredictors: Predictor[];
|
|
589
|
+
}
|
|
590
|
+
type UserType = "staff" | "admin" | "global_mod" | "";
|
|
591
|
+
type BroadcasterType = "partner" | "affiliate" | "";
|
|
592
|
+
interface User {
|
|
593
|
+
id: string;
|
|
594
|
+
name: string;
|
|
595
|
+
displayName: string;
|
|
596
|
+
description: string;
|
|
597
|
+
type: UserType;
|
|
598
|
+
broadcasterType: BroadcasterType;
|
|
599
|
+
profilePictureUrl: string;
|
|
600
|
+
offlinePlaceholderUrl: string;
|
|
601
|
+
creationDate: Date;
|
|
602
|
+
}
|
|
373
603
|
interface ForwardPagination {
|
|
374
604
|
limit?: number;
|
|
375
605
|
after?: string;
|
|
376
606
|
}
|
|
607
|
+
interface ForwardPagination {
|
|
608
|
+
limit?: number;
|
|
609
|
+
after?: string;
|
|
610
|
+
}
|
|
611
|
+
/** Sous-ensemble lecture seule de `ctx.twitch` (runtime / Monaco). */
|
|
377
612
|
interface PaginatedResult<T> {
|
|
378
613
|
readonly data: T[];
|
|
379
614
|
cursor?: string;
|
|
380
615
|
}
|
|
616
|
+
interface PaginatedResult<T> {
|
|
617
|
+
readonly data: T[];
|
|
618
|
+
cursor?: string;
|
|
619
|
+
}
|
|
620
|
+
interface PaginatedResultWithTotal<T> {
|
|
621
|
+
readonly data: T[];
|
|
622
|
+
cursor: string;
|
|
623
|
+
total: number;
|
|
624
|
+
}
|
|
381
625
|
interface PaginatedResultWithTotal<T> {
|
|
382
626
|
readonly data: T[];
|
|
383
627
|
cursor: string;
|
|
@@ -385,82 +629,88 @@ interface PaginatedResultWithTotal<T> {
|
|
|
385
629
|
}
|
|
386
630
|
interface TwitchGetClient {
|
|
387
631
|
bits: {
|
|
388
|
-
getLeaderboard: (params?:
|
|
389
|
-
count?: number;
|
|
390
|
-
period?: "day" | "week" | "month" | "all";
|
|
391
|
-
startedAt?: Date;
|
|
392
|
-
}) => Promise<unknown>;
|
|
632
|
+
getLeaderboard: (params?: BitsLeaderboardQuery) => Promise<BitsLeaderboard>;
|
|
393
633
|
};
|
|
394
634
|
channelPoints: {
|
|
395
|
-
getCustomRewards: (onlyManageable?: boolean) => Promise<
|
|
396
|
-
getCustomRewardsByIds: (rewardIds: string[]) => Promise<
|
|
397
|
-
getCustomRewardById: (rewardId: string) => Promise<
|
|
398
|
-
getRedemptionsByIds: (rewardId: string, redemptionIds: string[]) => Promise<
|
|
399
|
-
getRedemptionById: (rewardId: string, redemptionId: string) => Promise<
|
|
400
|
-
getRedemptions: (rewardId: string, status: string, filter:
|
|
635
|
+
getCustomRewards: (onlyManageable?: boolean) => Promise<CustomReward[]>;
|
|
636
|
+
getCustomRewardsByIds: (rewardIds: string[]) => Promise<CustomReward[]>;
|
|
637
|
+
getCustomRewardById: (rewardId: string) => Promise<CustomReward>;
|
|
638
|
+
getRedemptionsByIds: (rewardId: string, redemptionIds: string[]) => Promise<CustomRewardRedemption[]>;
|
|
639
|
+
getRedemptionById: (rewardId: string, redemptionId: string) => Promise<CustomRewardRedemption>;
|
|
640
|
+
getRedemptions: (rewardId: string, status: string, filter: PaginatedCustomRewardRedemptionFilter) => Promise<PaginatedResult<CustomRewardRedemption>>;
|
|
401
641
|
};
|
|
402
642
|
channel: {
|
|
403
|
-
getChannelInfoById: (user: UserId) => Promise<
|
|
643
|
+
getChannelInfoById: (user: UserId) => Promise<Channel>;
|
|
404
644
|
getFollowDate: (user: UserId) => Promise<number | null>;
|
|
405
|
-
getChannelEditors: () => Promise<
|
|
406
|
-
getVips: () => Promise<
|
|
407
|
-
checkVipForUsers: (users: UserId[]) => Promise<
|
|
645
|
+
getChannelEditors: () => Promise<ChannelEditor[]>;
|
|
646
|
+
getVips: () => Promise<ChatChatterData[]>;
|
|
647
|
+
checkVipForUsers: (users: UserId[]) => Promise<ChatChatterData[]>;
|
|
408
648
|
checkVipForUser: (user: UserId) => Promise<boolean>;
|
|
409
649
|
getChannelFollowerCount: () => Promise<number>;
|
|
410
650
|
};
|
|
411
651
|
chat: {
|
|
412
|
-
getChatters: (pagination?: ForwardPagination) => Promise<PaginatedResultWithTotal<
|
|
413
|
-
getSettings: () => Promise<
|
|
414
|
-
getSettingsPrivileged: () => Promise<
|
|
652
|
+
getChatters: (pagination?: ForwardPagination) => Promise<PaginatedResultWithTotal<ChatChatterData>>;
|
|
653
|
+
getSettings: () => Promise<ChatSettings>;
|
|
654
|
+
getSettingsPrivileged: () => Promise<PrivilegedChatSettings>;
|
|
415
655
|
getColorsForUsers: (users: UserId[]) => Promise<Record<string, string>>;
|
|
416
656
|
getColorForUser: (user: UserId) => Promise<string>;
|
|
417
657
|
};
|
|
418
658
|
clips: {
|
|
419
|
-
getClips: (filter?:
|
|
420
|
-
getClipById: (id: string) => Promise<
|
|
421
|
-
getClipsByIds: (ids: string[]) => Promise<
|
|
659
|
+
getClips: (filter?: PaginatedClipFilter) => Promise<PaginatedResult<Clip>>;
|
|
660
|
+
getClipById: (id: string) => Promise<Clip>;
|
|
661
|
+
getClipsByIds: (ids: string[]) => Promise<Clip[]>;
|
|
422
662
|
};
|
|
423
663
|
goals: {
|
|
424
|
-
getGoals: () => Promise<
|
|
664
|
+
getGoals: () => Promise<Goal[]>;
|
|
425
665
|
};
|
|
426
666
|
polls: {
|
|
427
667
|
getPolls: (pagination?: ForwardPagination) => Promise<{
|
|
428
|
-
data:
|
|
668
|
+
data: Poll[];
|
|
429
669
|
cursor: string;
|
|
430
670
|
}>;
|
|
431
|
-
getPollsByIds: (ids: string[]) => Promise<
|
|
432
|
-
getPollById: (id: string) => Promise<
|
|
671
|
+
getPollsByIds: (ids: string[]) => Promise<Poll[]>;
|
|
672
|
+
getPollById: (id: string) => Promise<Poll>;
|
|
433
673
|
};
|
|
434
674
|
predictions: {
|
|
435
675
|
getPredictions: (pagination?: ForwardPagination) => Promise<{
|
|
436
|
-
data:
|
|
676
|
+
data: Prediction[];
|
|
437
677
|
cursor: string;
|
|
438
678
|
}>;
|
|
439
|
-
getPredictionsByIds: (ids: string[]) => Promise<
|
|
440
|
-
getPredictionById: (id: string) => Promise<
|
|
679
|
+
getPredictionsByIds: (ids: string[]) => Promise<Prediction[]>;
|
|
680
|
+
getPredictionById: (id: string) => Promise<Prediction>;
|
|
441
681
|
};
|
|
442
682
|
streams: {
|
|
443
|
-
getStream: () => Promise<
|
|
444
|
-
getStreamMarkers: (pagination?: ForwardPagination) => Promise<PaginatedResult<
|
|
683
|
+
getStream: () => Promise<Stream | null>;
|
|
684
|
+
getStreamMarkers: (pagination?: ForwardPagination) => Promise<PaginatedResult<StreamMarker>>;
|
|
445
685
|
};
|
|
446
686
|
subscriptions: {
|
|
447
|
-
getSubscriptions: (pagination?: ForwardPagination) => Promise<
|
|
448
|
-
getSubscriptionsForUsers: (users: UserId[]) => Promise<
|
|
449
|
-
getSubscriptionForUser: (user: UserId) => Promise<
|
|
450
|
-
checkUserSubscription: (user: UserId) => Promise<
|
|
687
|
+
getSubscriptions: (pagination?: ForwardPagination) => Promise<SubscriptionData>;
|
|
688
|
+
getSubscriptionsForUsers: (users: UserId[]) => Promise<Subscription[]>;
|
|
689
|
+
getSubscriptionForUser: (user: UserId) => Promise<Subscription>;
|
|
690
|
+
checkUserSubscription: (user: UserId) => Promise<Subscription>;
|
|
451
691
|
};
|
|
452
692
|
moderation: {
|
|
453
|
-
getBanned: () => Promise<
|
|
693
|
+
getBanned: () => Promise<{
|
|
694
|
+
creationDate: Date;
|
|
695
|
+
expiryDate: Date;
|
|
696
|
+
moderatorDisplayName: string;
|
|
697
|
+
moderatorId: string;
|
|
698
|
+
moderatorName: string;
|
|
699
|
+
reason: string;
|
|
700
|
+
userId: string;
|
|
701
|
+
userName: string;
|
|
702
|
+
userDisplayName: string;
|
|
703
|
+
}[]>;
|
|
454
704
|
checkBan: (userId: string) => Promise<boolean>;
|
|
455
705
|
getModerators: () => Promise<unknown[]>;
|
|
456
706
|
checkModerator: (userId: string) => Promise<boolean>;
|
|
457
|
-
getBlockedTerms: () => Promise<
|
|
707
|
+
getBlockedTerms: () => Promise<BlockedTerm[]>;
|
|
458
708
|
};
|
|
459
709
|
utils: {
|
|
460
|
-
getUserById: (id: string) => Promise<
|
|
461
|
-
getUserByName: (name: string) => Promise<
|
|
462
|
-
getUserByIds: (ids: string[]) => Promise<
|
|
463
|
-
getUserByNames: (names: string[]) => Promise<
|
|
710
|
+
getUserById: (id: string) => Promise<User>;
|
|
711
|
+
getUserByName: (name: string) => Promise<User>;
|
|
712
|
+
getUserByIds: (ids: string[]) => Promise<User[]>;
|
|
713
|
+
getUserByNames: (names: string[]) => Promise<User[]>;
|
|
464
714
|
};
|
|
465
715
|
}
|
|
466
716
|
|