@tivio/sdk-react 10.0.0 → 10.2.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 CHANGED
@@ -1,8 +1,7 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import { DocumentReference } from '@firebase/firestore-types';
3
3
  import type duration from 'dayjs/plugin/duration';
4
- import type { default as firebase_2 } from '@firebase/app-types';
5
- import type { default as firebase_3 } from 'firebase';
4
+ import type firebase from '@firebase/app-types';
6
5
  import { FunctionComponentElement } from 'react';
7
6
  import type { GeoPoint } from '@firebase/firestore-types';
8
7
  import { OperatingSystem } from 'detect-browser';
@@ -26,7 +25,22 @@ export declare interface ActivatedPromotionsWithIdsResponse {
26
25
  activatedPromotionsIds: string[];
27
26
  }
28
27
 
29
- export declare type ActivateVoucherResponse = string | ActivatedPromotionsResponse | ActivatedPromotionsWithIdsResponse;
28
+ /**
29
+ * Response returned when `activateVoucher` is called with `responseFormat: 'extended'`.
30
+ *
31
+ * It always carries `voucherInfo` (safe server-side metadata) and, depending on the
32
+ * voucher type, either a `purchaseId` (transaction / subscription) or the list of
33
+ * `activatedPromotions` (promotion voucher).
34
+ */
35
+ export declare interface ActivateVoucherExtendedResponse {
36
+ voucherInfo: VoucherInfoPublic;
37
+ purchaseId?: string;
38
+ activatedPromotions?: ActivatedPromotion[];
39
+ }
40
+
41
+ export declare type ActivateVoucherResponse = string | ActivatedPromotionsResponse | ActivatedPromotionsWithIdsResponse | ActivateVoucherExtendedResponse;
42
+
43
+ export declare type ActivateVoucherResponseFormat = 'legacy' | 'extended';
30
44
 
31
45
  declare interface actualPriceDetails {
32
46
  amountCents: number;
@@ -599,7 +613,7 @@ export declare interface AvatarProps {
599
613
  */
600
614
  export declare type BadRequestError = Error & {
601
615
  details?: {
602
- reason?: 'DOES_NOT_EXIST' | 'EXPIRED' | 'ALREADY_USED' | 'ALREADY_USED_BY_CURRENT_USER';
616
+ reason?: 'DOES_NOT_EXIST' | 'EXPIRED' | 'ALREADY_USED' | 'ALREADY_USED_BY_CURRENT_USER' | 'LIMIT_REACHED' | 'FULFILLED' | 'INVALID_VOUCHER_TYPE';
603
617
  };
604
618
  };
605
619
 
@@ -649,6 +663,52 @@ export declare interface BannerProps {
649
663
  */
650
664
  export declare type BannerPropsPartial = Partial<BannerProps>;
651
665
 
666
+ /**
667
+ * Fields and methods common to every interactive widget (quiz, poll, …).
668
+ * Parameterized over the concrete answer type, state type, and scene type so
669
+ * more specialized widget interfaces can narrow each axis independently.
670
+ */
671
+ export declare interface BaseInteractiveWidget<TAnswer extends BaseQuestionAnswer = QuestionAnswer, TState extends InteractiveWidgetState = InteractiveWidgetState, TScene extends InteractiveWidgetScene = InteractiveWidgetScene> {
672
+ readonly id: string;
673
+ readonly name: string;
674
+ readonly path: string;
675
+ readonly type: InteractiveWidgetType;
676
+ readonly status: InteractiveWidgetStatus;
677
+ readonly questionsCount: number;
678
+ readonly currentAnswerId?: string;
679
+ readonly currentState: TState;
680
+ /**
681
+ * State delayed for end users, used to toggle scenes just like in OBS / host view.
682
+ */
683
+ readonly currentStateWithDelay: InteractiveWidgetCurrentStateWithDelay<TState>;
684
+ readonly currentQuestion: CurrentQuestion<TAnswer> | null;
685
+ readonly answers?: TAnswer[];
686
+ readonly questionIndex?: number;
687
+ readonly isSubmitted?: boolean;
688
+ readonly userRole: InteractiveWidgetRole;
689
+ readonly scenes: TScene[];
690
+ readonly activeScene: TScene | null;
691
+ readonly theme?: InteractiveWidgetTheme;
692
+ /**
693
+ * @remarks Always `false` for `PollWidget` — kept on the base to minimize
694
+ * disruption to existing consumers.
695
+ */
696
+ readonly isWaitingForStart: boolean;
697
+ answerQuestion(answerId: string): void;
698
+ submitAnswer(request: Pick<SubmitAnswerRequest, 'answerOptionId' | 'answerText'>): Promise<void>;
699
+ verifyJoinCode(joinCode: string, shouldJoinPlayer?: boolean): Promise<boolean>;
700
+ destroy(): void;
701
+ }
702
+
703
+ /**
704
+ * Fields shared by both quiz and poll answers.
705
+ */
706
+ export declare interface BaseQuestionAnswer {
707
+ id: string;
708
+ answer: Translation;
709
+ status?: AnswerStatus;
710
+ }
711
+
652
712
  /**
653
713
  * Base row interface with common fields
654
714
  * @public
@@ -1313,13 +1373,17 @@ export declare type CurrencyLowerCase = 'czk' | 'eur' | 'usd' | 'pln';
1313
1373
  */
1314
1374
  export declare const CurrencyToTitle: Record<Currency, string>;
1315
1375
 
1316
- export declare interface CurrentQuestion {
1376
+ /**
1377
+ * Generic "current question" shape, parameterized by answer type.
1378
+ * Use `QuizQuestion` / `PollQuestion` for concrete forms.
1379
+ */
1380
+ export declare interface CurrentQuestion<TAnswer extends BaseQuestionAnswer = QuestionAnswer> {
1317
1381
  id: string;
1318
1382
  question: Translation;
1319
- answers?: QuestionAnswer[];
1383
+ answers?: TAnswer[];
1320
1384
  index?: number;
1321
1385
  endTimestampMs?: number;
1322
- status?: QuizGameStatus;
1386
+ status?: InteractiveWidgetStatus;
1323
1387
  }
1324
1388
 
1325
1389
  export declare type CurrentQuestionScene = InteractiveWidgetSceneBase<InteractiveWidgetSceneTemplateType.CURRENT_QUESTION>;
@@ -1406,7 +1470,9 @@ export declare enum CustomerId {
1406
1470
  THE_JOHNY = "THE_JOHNY",
1407
1471
  GOOD_MOVE = "GOOD_MOVE",
1408
1472
  JANA_HANZ = "JANA_HANZ",
1409
- MYSTICO = "MYSTICO"
1473
+ MYSTICO = "MYSTICO",
1474
+ MORAVEC = "MORAVEC",
1475
+ JAN_TUNA = "JAN_TUNA"
1410
1476
  }
1411
1477
 
1412
1478
  export declare interface CustomScript {
@@ -2449,41 +2515,10 @@ export declare interface IndexedVideo extends IndexedObject {
2449
2515
 
2450
2516
  export declare type IntegrationType = 'discord' | 'patreon';
2451
2517
 
2452
- export declare interface InteractiveWidget<T extends InteractiveWidgetScene = InteractiveWidgetScene> {
2453
- readonly id: string;
2454
- readonly name: string;
2455
- readonly path: string;
2456
- readonly currentQuestion: CurrentQuestion | null;
2457
- readonly status: QuizGameStatus;
2458
- readonly questionsCount: number;
2459
- readonly currentAnswerId?: string;
2460
- readonly currentState: InteractiveWidgetState;
2461
- /**
2462
- * State delayed for end users, which is used to toggle scenes just like in OBS and host view
2463
- */
2464
- readonly currentStateWithDelay: InteractiveWidgetCurrentStateWithDelay;
2465
- readonly answers?: QuestionAnswer[];
2466
- readonly questionIndex?: number;
2467
- readonly isSubmitted?: boolean;
2468
- readonly leaderboard: LeaderboardGroupItem | null;
2469
- readonly highlightedUsersIds: string[];
2470
- readonly userRole: QuizGameRole;
2471
- readonly secondsToAnswer: number;
2472
- readonly scenes: T[];
2473
- readonly activeScene: T | null;
2474
- readonly theme?: InteractiveWidgetTheme;
2475
- readonly showCountdown: boolean;
2476
- readonly lastQuestionTopScorers: LeaderboardPlayer[];
2477
- readonly questionRepository: QuestionRepository;
2478
- readonly isWaitingForStart: boolean;
2479
- answerQuestion(answerId: string): void;
2480
- submitAnswer(request: Pick<SubmitAnswerRequest, 'answerOptionId' | 'answerText'>): Promise<void>;
2481
- verifyJoinCode(joinCode: string, shouldJoinPlayer?: boolean): Promise<boolean>;
2482
- destroy(): void;
2483
- }
2518
+ export declare type InteractiveWidget<TScene extends InteractiveWidgetScene = InteractiveWidgetScene> = QuizWidget<TScene> | PollWidget<TScene>;
2484
2519
 
2485
- export declare interface InteractiveWidgetCurrentStateWithDelay {
2486
- state: InteractiveWidgetState;
2520
+ export declare interface InteractiveWidgetCurrentStateWithDelay<TState extends InteractiveWidgetState = InteractiveWidgetState> {
2521
+ state: TState;
2487
2522
  enteredAt: Date;
2488
2523
  }
2489
2524
 
@@ -2497,6 +2532,27 @@ export declare enum InteractiveWidgetDisplayComponent {
2497
2532
  AD_VAST = "adVast"
2498
2533
  }
2499
2534
 
2535
+ export declare interface InteractiveWidgetGroupStats {
2536
+ answerPercentages: Record<string, number>;
2537
+ averageScore: number;
2538
+ correctAnswersRatio: number;
2539
+ }
2540
+
2541
+ export declare enum InteractiveWidgetGroupType {
2542
+ HIGHLIGHTED_PLAYERS = "HIGHLIGHTED_PLAYERS",
2543
+ /** Participants playing in Offline mode */
2544
+ LOCAL_PLAYERS = "LOCAL_PLAYERS",
2545
+ ALL = "ALL",
2546
+ PARTY = "PARTY"
2547
+ }
2548
+
2549
+ export declare enum InteractiveWidgetRole {
2550
+ OBS = "OBS",
2551
+ HOST = "HOST",
2552
+ PLAYER = "PLAYER",
2553
+ LOCAL_PLAYER = "LOCAL_PLAYER"
2554
+ }
2555
+
2500
2556
  export declare type InteractiveWidgetScene = CurrentQuestionScene | LeaderboardScene | QRCodeScene | AdBannerScene | PlayersScene | NoGraphicsScene | CountdownScene;
2501
2557
 
2502
2558
  export declare interface InteractiveWidgetSceneBase<TType extends InteractiveWidgetSceneTemplateType> {
@@ -2554,6 +2610,16 @@ export declare enum InteractiveWidgetState {
2554
2610
  RESET_GAME = "ResetGame"
2555
2611
  }
2556
2612
 
2613
+ export declare enum InteractiveWidgetStatus {
2614
+ /**
2615
+ * Waiting to start the quiz / question
2616
+ */
2617
+ WAITING = "WAITING",
2618
+ IN_PROGRESS = "IN_PROGRESS",
2619
+ IN_BETWEEN_QUESTIONS = "IN_BETWEEN_QUESTIONS",
2620
+ DONE = "DONE"
2621
+ }
2622
+
2557
2623
  export declare interface InteractiveWidgetTheme {
2558
2624
  palette: Record<string, string>;
2559
2625
  components: {
@@ -2563,6 +2629,11 @@ export declare interface InteractiveWidgetTheme {
2563
2629
 
2564
2630
  declare type InteractiveWidgetThemeKey = InteractiveWidgetDisplayComponent | `${InteractiveWidgetDisplayComponent.CURRENT_QUESTION}${AnswerStatus}` | 'timeLeftBar';
2565
2631
 
2632
+ export declare enum InteractiveWidgetType {
2633
+ POLL = "POLL",
2634
+ QUIZ = "QUIZ"
2635
+ }
2636
+
2566
2637
  /**
2567
2638
  * @public
2568
2639
  */
@@ -2589,6 +2660,15 @@ export declare type InternalConfig = SdkReactConfig & {
2589
2660
  forceCloudFnResolver?: boolean;
2590
2661
  };
2591
2662
 
2663
+ /**
2664
+ * Subset of `BaseInteractiveWidget` methods that are intentionally **not**
2665
+ * advertised on the SDK hook return types (`useInteractiveWidget`,
2666
+ * `useQuizWidget`, `usePollWidget`). These methods still exist at runtime and
2667
+ * are used by internal `core-react-dom` UI / server flows — they're just hidden
2668
+ * from external SDK consumers, which should only call `submitAnswer`.
2669
+ */
2670
+ export declare type InternalInteractiveWidgetMethods = 'answerQuestion' | 'verifyJoinCode' | 'changeState';
2671
+
2592
2672
  /**
2593
2673
  * @public
2594
2674
  */
@@ -2743,7 +2823,7 @@ export declare interface LastMessage {
2743
2823
  export declare interface LeaderboardGroupItem {
2744
2824
  groupPath?: string;
2745
2825
  groupName?: string;
2746
- type: QuizGameGroupType;
2826
+ type: InteractiveWidgetGroupType;
2747
2827
  /**
2748
2828
  * Consists of top 3 players of the group (global or private team)
2749
2829
  * the player's rank in the group
@@ -3163,6 +3243,16 @@ export declare interface MonetizationCardProps {
3163
3243
  focused?: boolean;
3164
3244
  }
3165
3245
 
3246
+ /**
3247
+ * @public
3248
+ */
3249
+ export declare type MonetizationCta = {
3250
+ type: 'email';
3251
+ payload: {
3252
+ email: string;
3253
+ };
3254
+ };
3255
+
3166
3256
  export declare interface MonetizationsCountsSummaryItem {
3167
3257
  /**
3168
3258
  * Unix timestamp at which the data is aggregated
@@ -4370,6 +4460,22 @@ export declare enum PlayerWrapperEventType {
4370
4460
  */
4371
4461
  export declare type PlayerWrapperEventTypeType = `${PlayerWrapperEventType}`;
4372
4462
 
4463
+ export declare type PollQuestion = CurrentQuestion<PollQuestionAnswer>;
4464
+
4465
+ export declare interface PollQuestionAnswer extends BaseQuestionAnswer {
4466
+ votes?: number;
4467
+ }
4468
+
4469
+ /**
4470
+ * A poll-flavored interactive widget. No scoring / leaderboard / countdown — just
4471
+ * "here's a question, here are the vote counts". Uses a narrower state machine.
4472
+ */
4473
+ export declare interface PollWidget<TScene extends InteractiveWidgetScene = InteractiveWidgetScene> extends BaseInteractiveWidget<PollQuestionAnswer, PollWidgetState, TScene> {
4474
+ readonly type: InteractiveWidgetType.POLL;
4475
+ }
4476
+
4477
+ export declare type PollWidgetState = InteractiveWidgetState.IDLE | InteractiveWidgetState.CURRENT_QUESTION | InteractiveWidgetState.LEADERBOARD | InteractiveWidgetState.RESET_GAME | InteractiveWidgetState.NEXT_STATE;
4478
+
4373
4479
  /**
4374
4480
  * @public
4375
4481
  */
@@ -4537,6 +4643,11 @@ export declare interface PubSub {
4537
4643
  * @public
4538
4644
  */
4539
4645
  export declare interface PurchasableMonetization extends Monetization {
4646
+ /**
4647
+ * If CTA is configured, the monetization should not be directly purchasable in clients.
4648
+ * Client apps should render CTA action instead of purchase button.
4649
+ */
4650
+ cta?: MonetizationCta;
4540
4651
  /**
4541
4652
  * Price before any discounts (e.g. promotions).
4542
4653
  */
@@ -5035,13 +5146,7 @@ export declare interface QerkoTransaction {
5035
5146
 
5036
5147
  export declare type QRCodeScene = InteractiveWidgetSceneBase<InteractiveWidgetSceneTemplateType.QR_CODE>;
5037
5148
 
5038
- export declare interface QuestionAnswer {
5039
- id: string;
5040
- answer: Translation;
5041
- isCorrect?: boolean;
5042
- votes?: number;
5043
- status?: AnswerStatus;
5044
- }
5149
+ export declare type QuestionAnswer = QuizQuestionAnswer | PollQuestionAnswer;
5045
5150
 
5046
5151
  export declare enum QuestionEvents {
5047
5152
  NEW_QUESTION = "new_question",
@@ -5059,7 +5164,7 @@ export declare interface QuestionRepository {
5059
5164
  readonly selectedAnswerId: string | undefined;
5060
5165
  isSubmitted: boolean;
5061
5166
  isSubmitting: boolean;
5062
- setCurrentQuestion: (question: CurrentQuestion | null, role: QuizGameRole, secondsToAnswer: number, shouldEnterAtTimestampMs?: number, shouldAdjustEndTimestampMs?: boolean) => void;
5167
+ setCurrentQuestion: (question: CurrentQuestion | null, role: InteractiveWidgetRole, secondsToAnswer: number, shouldEnterAtTimestampMs?: number, shouldAdjustEndTimestampMs?: boolean) => void;
5063
5168
  selectAnswer: (answerId: string | undefined) => void;
5064
5169
  setShowCountdown: (showCountdown: boolean) => void;
5065
5170
  reset: () => void;
@@ -5073,41 +5178,28 @@ export declare type QuestionRepositoryEventMap = {
5073
5178
  [QuestionEvents.QUESTION_TIMEOUT]: (question: CurrentQuestion | null) => void;
5074
5179
  };
5075
5180
 
5076
- export declare interface QuizGameGroupStats {
5077
- answerPercentages: Record<string, number>;
5078
- averageScore: number;
5079
- correctAnswersRatio: number;
5080
- }
5081
-
5082
- export declare enum QuizGameGroupType {
5083
- HIGHLIGHTED_PLAYERS = "HIGHLIGHTED_PLAYERS",
5084
- /** Participants playing in Offline mode */
5085
- LOCAL_PLAYERS = "LOCAL_PLAYERS",
5086
- ALL = "ALL",
5087
- PARTY = "PARTY"
5088
- }
5181
+ export declare type QuizQuestion = CurrentQuestion<QuizQuestionAnswer>;
5089
5182
 
5090
- export declare enum QuizGameRole {
5091
- OBS = "OBS",
5092
- HOST = "HOST",
5093
- PLAYER = "PLAYER",
5094
- LOCAL_PLAYER = "LOCAL_PLAYER"
5183
+ export declare interface QuizQuestionAnswer extends BaseQuestionAnswer {
5184
+ isCorrect?: boolean;
5185
+ votes?: number;
5095
5186
  }
5096
5187
 
5097
- export declare enum QuizGameStatus {
5098
- /**
5099
- * Waiting to start the quiz / question
5100
- */
5101
- WAITING = "WAITING",
5102
- IN_PROGRESS = "IN_PROGRESS",
5103
- IN_BETWEEN_QUESTIONS = "IN_BETWEEN_QUESTIONS",
5104
- DONE = "DONE"
5188
+ /**
5189
+ * A quiz-flavored interactive widget. Adds scoring, leaderboard, and countdown
5190
+ * concepts on top of the base, and narrows answers to `QuizQuestionAnswer`.
5191
+ */
5192
+ export declare interface QuizWidget<TScene extends InteractiveWidgetScene = InteractiveWidgetScene> extends BaseInteractiveWidget<QuizQuestionAnswer, QuizWidgetState, TScene> {
5193
+ readonly type: InteractiveWidgetType.QUIZ;
5194
+ readonly leaderboard: LeaderboardGroupItem | null;
5195
+ readonly lastQuestionTopScorers: LeaderboardPlayer[];
5196
+ readonly highlightedUsersIds: string[];
5197
+ readonly secondsToAnswer: number;
5198
+ readonly showCountdown: boolean;
5199
+ readonly questionRepository: QuestionRepository;
5105
5200
  }
5106
5201
 
5107
- export declare enum QuizGameType {
5108
- POLL = "POLL",
5109
- QUIZ = "QUIZ"
5110
- }
5202
+ export declare type QuizWidgetState = InteractiveWidgetState;
5111
5203
 
5112
5204
  /**
5113
5205
  * @public
@@ -5224,6 +5316,11 @@ export declare interface RemoteControlPairPayload {
5224
5316
  profileId: string;
5225
5317
  }
5226
5318
 
5319
+ export declare interface RemoteControlPairResponse {
5320
+ sessionId: string;
5321
+ videoId: string;
5322
+ }
5323
+
5227
5324
  export declare interface RemoteControlPlaybackControlPayload {
5228
5325
  sessionId: string;
5229
5326
  videoId: string;
@@ -5605,7 +5702,7 @@ declare type SceneMetadata<TType extends InteractiveWidgetSceneTemplateType> = T
5605
5702
  } : TType extends InteractiveWidgetSceneTemplateType.LEADERBOARD ? {
5606
5703
  highlightedPlayers: LeaderboardPlayer[];
5607
5704
  topPlayers: LeaderboardPlayer[];
5608
- stats?: QuizGameGroupStats;
5705
+ stats?: InteractiveWidgetGroupStats;
5609
5706
  } : TType extends InteractiveWidgetSceneTemplateType.QR_CODE ? Record<Extract<SceneMetadataKeys[TType], string>, string> : TType extends InteractiveWidgetSceneTemplateType.AD_BANNER ? Record<Extract<SceneMetadataKeys[TType], string>, string> : TType extends InteractiveWidgetSceneTemplateType.PLAYERS ? Record<Extract<SceneMetadataKeys[TType], string>, string> : object;
5610
5707
 
5611
5708
  export declare interface SceneMetadataKeys {
@@ -5758,6 +5855,13 @@ export declare type SdkReactConfig = Omit<TivioConfig, 'language'> & {
5758
5855
  language?: LangCode;
5759
5856
  };
5760
5857
 
5858
+ /**
5859
+ * Narrows away `InternalInteractiveWidgetMethods` from any concrete widget
5860
+ * type. Distributes over discriminated unions so `SDKWidget<InteractiveWidget>`
5861
+ * stays a union of `SDKWidget<QuizWidget> | SDKWidget<PollWidget>`.
5862
+ */
5863
+ export declare type SDKWidget<T> = T extends unknown ? Omit<T, InternalInteractiveWidgetMethods> : never;
5864
+
5761
5865
  /**
5762
5866
  * @public
5763
5867
  * @deprecated sections are no longer used.
@@ -6521,14 +6625,6 @@ export declare type SubscribeToTaggedVideosOptions = Omit<SubscribeToItemsInRowO
6521
6625
  orderBy?: OrderBy<TaggedVideosOrderByField>[];
6522
6626
  };
6523
6627
 
6524
- declare interface SubscriptionInfo {
6525
- id: string;
6526
- type: 'subscription';
6527
- name: string;
6528
- benefits: string[];
6529
- frequency: string;
6530
- }
6531
-
6532
6628
  /**
6533
6629
  * Extended language codes for subtitle tracks.
6534
6630
  * Includes all LangCode values plus additional languages only needed for subtitles.
@@ -6911,7 +7007,7 @@ export declare interface TivioConfig {
6911
7007
  debug?: boolean;
6912
7008
  verbose?: boolean;
6913
7009
  firebaseApp?: any | null;
6914
- firebaseFactory?: (config: object, appName?: string) => firebase_2.FirebaseApp;
7010
+ firebaseFactory?: (config: object, appName?: string) => firebase.FirebaseApp;
6915
7011
  authDomainOverride?: string;
6916
7012
  /**
6917
7013
  * @deprecated this field is no longer in use and has no impact when set.
@@ -7040,7 +7136,7 @@ export declare type TivioHooks = {
7040
7136
  data: Video | null;
7041
7137
  error: string | null;
7042
7138
  };
7043
- useVoucher: (voucherId: string) => any;
7139
+ useVoucher: (voucherId: string) => UseVoucherReturn;
7044
7140
  useApplyInviteCode: () => {
7045
7141
  applyInviteCodeResult?: boolean;
7046
7142
  loading: boolean;
@@ -7050,6 +7146,22 @@ export declare type TivioHooks = {
7050
7146
  };
7051
7147
  useChannelSource: UseChannelSource;
7052
7148
  useTvChannel: UseTvChannel;
7149
+ useInteractiveWidget: (widgetPath: string | undefined, isObs?: boolean) => {
7150
+ widget: SDKWidget<InteractiveWidget> | null;
7151
+ isLoading: boolean;
7152
+ error: Error | null;
7153
+ };
7154
+ useQuizWidget: (widgetPath: string | undefined, isObs?: boolean) => {
7155
+ widget: SDKWidget<QuizWidget> | null;
7156
+ isLoading: boolean;
7157
+ error: Error | null;
7158
+ };
7159
+ usePollWidget: (widgetPath: string | undefined, isObs?: boolean) => {
7160
+ widget: SDKWidget<PollWidget> | null;
7161
+ isLoading: boolean;
7162
+ error: Error | null;
7163
+ };
7164
+ useRemoteController: UseRemoteController;
7053
7165
  };
7054
7166
 
7055
7167
  /**
@@ -7267,7 +7379,7 @@ export declare type TivioReactBundle = {
7267
7379
  }, email?: string) => Promise<QerkoPaymentInfo>;
7268
7380
  purchaseSubscriptionWithQerko: (monetizationId: string, voucher?: {
7269
7381
  expirationDate: Date;
7270
- }) => Promise<QerkoPaymentInfo>;
7382
+ }, email?: string, quantity?: number) => Promise<QerkoPaymentInfo>;
7271
7383
  cancelSubscriptionWithQerko: (subscriptionId: string) => Promise<QerkoCancellationInfo>;
7272
7384
  showConsentPreferences: () => void;
7273
7385
  /**
@@ -7376,17 +7488,6 @@ export declare interface Track {
7376
7488
  language: LangCode;
7377
7489
  }
7378
7490
 
7379
- declare interface TransactionInfo {
7380
- id: string;
7381
- type: 'transaction';
7382
- name: string;
7383
- videoId: string;
7384
- cover: string;
7385
- description: string;
7386
- promotions?: firebase_3.firestore.DocumentReference<Promotion>[];
7387
- fullDiscount?: boolean;
7388
- }
7389
-
7390
7491
  /**
7391
7492
  * Represents one string in every supported language mutation.
7392
7493
  * @public
@@ -7690,6 +7791,18 @@ export declare type UseEpisodesResult = {
7690
7791
  hasMoreEpisodes: boolean;
7691
7792
  };
7692
7793
 
7794
+ /**
7795
+ * Load the interactive widget at `widgetPath` via the remote Tivio bundle.
7796
+ * Returns the union widget (`QuizWidget | PollWidget`); narrow
7797
+ * on `widget.type` to access type-specific fields. Prefer `useQuizWidget` /
7798
+ * `usePollWidget` when you know the type up-front.
7799
+ */
7800
+ export declare const useInteractiveWidget: (widgetPath: string | undefined, isObs?: boolean) => {
7801
+ widget: SDKWidget<InteractiveWidget> | null;
7802
+ isLoading: boolean;
7803
+ error: Error | null;
7804
+ };
7805
+
7693
7806
  /**
7694
7807
  * @public
7695
7808
  */
@@ -7782,6 +7895,12 @@ export declare const useOrganizationSubscriptions: (onlyPurchasableSubscriptions
7782
7895
  subscriptions: PurchasableMonetization[];
7783
7896
  };
7784
7897
 
7898
+ export declare const usePollWidget: (widgetPath: string | undefined, isObs?: boolean) => {
7899
+ widget: Omit<PollWidget<InteractiveWidgetScene>, InternalInteractiveWidgetMethods> | null;
7900
+ isLoading: boolean;
7901
+ error: Error | null;
7902
+ };
7903
+
7785
7904
  /**
7786
7905
  * Is used to mark purchase in recovery state as PAID.
7787
7906
  *
@@ -7803,6 +7922,12 @@ export declare function usePurchaseRecovery(): {
7803
7922
  */
7804
7923
  export declare const usePurchaseSubscription: (monetizationId: string, voucher?: NewVoucher) => QerkoTransaction;
7805
7924
 
7925
+ export declare const useQuizWidget: (widgetPath: string | undefined, isObs?: boolean) => {
7926
+ widget: Omit<QuizWidget<InteractiveWidgetScene>, InternalInteractiveWidgetMethods> | null;
7927
+ isLoading: boolean;
7928
+ error: Error | null;
7929
+ };
7930
+
7806
7931
  /**
7807
7932
  * @public
7808
7933
  */
@@ -7944,6 +8069,58 @@ export declare interface UseReactionsOptions {
7944
8069
  onError?: (error: Error) => void;
7945
8070
  }
7946
8071
 
8072
+ /**
8073
+ * @public
8074
+ */
8075
+ export declare type UseRemoteController = (options?: UseRemoteControllerOptions) => UseRemoteControllerResult;
8076
+
8077
+ export declare const useRemoteController: UseRemoteController;
8078
+
8079
+ /**
8080
+ * @public
8081
+ */
8082
+ export declare interface UseRemoteControllerOptions {
8083
+ sessionId?: string;
8084
+ videoId?: string;
8085
+ }
8086
+
8087
+ /**
8088
+ * @public
8089
+ */
8090
+ export declare type UseRemoteControllerPlaybackControlPayload = Pick<RemoteControlPlaybackControlPayload, 'playback' | 'activeVideoId'> & Partial<Pick<RemoteControlPlaybackControlPayload, 'sessionId' | 'videoId'>>;
8091
+
8092
+ /**
8093
+ * @public
8094
+ */
8095
+ export declare type UseRemoteControllerPlayHighlightPayload = Pick<RemoteControlPlayHighlightPayload, 'activeVideoId' | 'replay'> & Partial<Pick<RemoteControlPlayHighlightPayload, 'sessionId' | 'videoId'>>;
8096
+
8097
+ /**
8098
+ * @public
8099
+ */
8100
+ export declare interface UseRemoteControllerResult {
8101
+ session: UserStreamingSessionFieldInterface | null;
8102
+ sessionId: string | null;
8103
+ videoId: string | null;
8104
+ activeContentId: string | null;
8105
+ isInitialized: boolean;
8106
+ isSignedIn: boolean;
8107
+ isLoading: boolean;
8108
+ error: Error | null;
8109
+ resetError: () => void;
8110
+ pairDevice: (payload: RemoteControlPairPayload) => Promise<RemoteControlPairResponse>;
8111
+ unpairDevice: (payload?: Partial<RemoteControlUnpairPayload>) => Promise<boolean | string>;
8112
+ selectCamera: (payload: UseRemoteControllerSelectCameraPayload) => Promise<boolean | string>;
8113
+ playHighlight: (payload: UseRemoteControllerPlayHighlightPayload) => Promise<boolean | string>;
8114
+ playbackControl: (payload: UseRemoteControllerPlaybackControlPayload) => Promise<boolean | string>;
8115
+ getSourceUrl: (payload: RemoteControlGetSourceUrlPayload) => Promise<RemoteControlGenerateSourceResponse>;
8116
+ remoteControl: <TResponse = RemoteControlGenerateSourceResponse | boolean | string>(payload: RemoteControlRequest) => Promise<TResponse>;
8117
+ }
8118
+
8119
+ /**
8120
+ * @public
8121
+ */
8122
+ export declare type UseRemoteControllerSelectCameraPayload = Pick<RemoteControlSelectCameraPayload, 'activeVideoId'> & Partial<Pick<RemoteControlSelectCameraPayload, 'sessionId' | 'videoId'>>;
8123
+
7947
8124
  export declare enum UserGroup {
7948
8125
  ALL = "all",
7949
8126
  FREE = "free",
@@ -8159,19 +8336,28 @@ export declare const useVideo: (videoIdOrUrlName?: string) => {
8159
8336
  /**
8160
8337
  * @public
8161
8338
  */
8162
- export declare const useVoucher: (voucherId: string) => {
8163
- activate: (() => Promise<void>) | null;
8164
- voucher: Voucher | null;
8165
- /**
8166
- * You can check error.details if you need to know error type when you want your own error messages
8167
- * (can be one of "DOES_NOT_EXIST", "EXPIRED", "ALREADY_USED_BY_CURRENT_USER" and "ALREADY_USED").
8168
- */
8169
- error: Error | BadRequestError | null;
8170
- /**
8171
- * True if voucher has been successfully activated in current session.
8172
- */
8339
+ export declare const useVoucher: (voucherId: string) => UseVoucherReturn;
8340
+
8341
+ /**
8342
+ * Return type of `useVoucher` hook (core-react / sdk-react).
8343
+ *
8344
+ * Activation is triggered via the top-level `activate`. After a successful activation
8345
+ * `voucher` carries the server-provided metadata (`voucherInfo`, `videoId`,
8346
+ * `subscriptionsToShow`) as flat attributes. While the voucher is still initializing,
8347
+ * `voucher` is `null`.
8348
+ */
8349
+ export declare interface UseVoucherReturn {
8350
+ activate: () => Promise<void>;
8351
+ voucher: {
8352
+ organizationId: string | null;
8353
+ isInitialized: boolean;
8354
+ voucherInfo: VoucherInfoPublic | null;
8355
+ videoId?: string;
8356
+ subscriptionsToShow: PurchasableMonetization[];
8357
+ } | null;
8358
+ error: Error | null;
8173
8359
  activationSuccess: boolean;
8174
- };
8360
+ }
8175
8361
 
8176
8362
  /**
8177
8363
  * @public
@@ -8805,15 +8991,30 @@ export declare interface VodTivioSourceParams extends PlayerSourceParams<SourceT
8805
8991
  sessionId?: string;
8806
8992
  }
8807
8993
 
8808
- /**
8809
- * TODO: Should be in core-js, we can't import types from it, though.
8810
- */
8811
- declare interface Voucher {
8812
- activate: () => void;
8813
- isUsed: boolean;
8994
+ export declare interface VoucherInfoBasePublic {
8995
+ id: string;
8814
8996
  isExpired: boolean;
8815
- status: 'NEW' | 'USED';
8816
- voucherInfo: SubscriptionInfo | TransactionInfo;
8997
+ status: VoucherInfoPublicStatus;
8998
+ fullDiscount?: boolean;
8999
+ }
9000
+
9001
+ export declare type VoucherInfoPublic = VoucherInfoSubscriptionPublic | VoucherInfoTransactionPublic;
9002
+
9003
+ export declare type VoucherInfoPublicStatus = 'NEW' | 'USED' | 'FULFILLED';
9004
+
9005
+ export declare interface VoucherInfoSubscriptionPublic extends VoucherInfoBasePublic {
9006
+ type: 'subscription';
9007
+ name: string;
9008
+ benefits: string[];
9009
+ frequency?: MONETIZATION_FREQUENCY;
9010
+ }
9011
+
9012
+ export declare interface VoucherInfoTransactionPublic extends VoucherInfoBasePublic {
9013
+ type: 'transaction';
9014
+ name: string;
9015
+ videoId: string;
9016
+ cover: string;
9017
+ description: string;
8817
9018
  }
8818
9019
 
8819
9020
  declare interface VoucherPageConfiguration {