@tivio/sdk-react 10.2.1 → 11.0.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
@@ -675,15 +675,53 @@ export declare interface BaseInteractiveWidget<TAnswer extends BaseQuestionAnswe
675
675
  readonly type: InteractiveWidgetType;
676
676
  readonly status: InteractiveWidgetStatus;
677
677
  readonly questionsCount: number;
678
+ /**
679
+ * Id of the answer option the current user picked for {@link currentQuestion}.
680
+ *
681
+ * @remarks
682
+ * This is **optimistic local state**, not a server-confirmed value. It is set
683
+ * immediately when `submitAnswer` is called (before the backend responds) so the
684
+ * UI can reflect the choice without delay. For quizzes it is reverted to its
685
+ * previous value if the submission fails; for **polls** it is intentionally kept
686
+ * on failure (polls favor a smooth voting experience over per-vote precision), so
687
+ * the user keeps seeing their pick for this session. It is scoped to this
688
+ * device/session and resets when the question changes — it does not reflect a vote
689
+ * made by the same user elsewhere.
690
+ */
678
691
  readonly currentAnswerId?: string;
692
+ /**
693
+ * The state to render **right now** for the audience. Render your scene off this.
694
+ *
695
+ * @remarks
696
+ * It is kept in sync with the viewer's delayed video stream: it switches to the
697
+ * next state exactly when that state becomes active, not before. To show a preview
698
+ * of what's coming (e.g. a "voting opens in N s" screen), read
699
+ * {@link currentStateWithDelay}'s `state` together with {@link secondsUntilStateChange}.
700
+ */
679
701
  readonly currentState: TState;
680
702
  /**
681
- * State delayed for end users, used to toggle scenes just like in OBS / host view.
703
+ * The **upcoming** state and the absolute time it becomes active (`enteredAt`).
704
+ *
705
+ * @remarks
706
+ * While a transition is pending, `state` is already the next state whereas
707
+ * {@link currentState} still reports what's on screen. Use this together with
708
+ * {@link secondsUntilStateChange} to render a countdown / preview of the next state.
682
709
  */
683
710
  readonly currentStateWithDelay: InteractiveWidgetCurrentStateWithDelay<TState>;
684
711
  readonly currentQuestion: CurrentQuestion<TAnswer> | null;
685
712
  readonly answers?: TAnswer[];
686
713
  readonly questionIndex?: number;
714
+ /**
715
+ * Whether the current user has submitted an answer for {@link currentQuestion}.
716
+ *
717
+ * @remarks
718
+ * This is **optimistic local state**, not a server-confirmed value. It flips to
719
+ * `true` the moment `submitAnswer` is called (before the backend responds). For
720
+ * quizzes it is reverted to `false` if the submission fails; for **polls** it is
721
+ * intentionally kept `true` on failure, so the user keeps seeing their vote as
722
+ * submitted for this session. It is scoped to this device/session and resets when
723
+ * the question changes.
724
+ */
687
725
  readonly isSubmitted?: boolean;
688
726
  readonly userRole: InteractiveWidgetRole;
689
727
  readonly scenes: TScene[];
@@ -694,6 +732,27 @@ export declare interface BaseInteractiveWidget<TAnswer extends BaseQuestionAnswe
694
732
  * disruption to existing consumers.
695
733
  */
696
734
  readonly isWaitingForStart: boolean;
735
+ /**
736
+ * Delay (in seconds) applied to the audience-facing
737
+ * state relative to the live state, so end users see widget transitions in sync
738
+ * with their delayed video stream.
739
+ */
740
+ readonly audienceDelayInSeconds: number;
741
+ /**
742
+ * Number of users currently active on the video this widget belongs to.
743
+ * Sourced live from the video document (`activeUsers.value`).
744
+ */
745
+ readonly activeUsers?: number;
746
+ /**
747
+ * Whole seconds until the {@link currentStateWithDelay} state becomes active for
748
+ * the audience; `0` when no transition is pending.
749
+ *
750
+ * @remarks
751
+ * Use this for countdown UIs instead of computing time yourself — it is already
752
+ * synced to server time. Reading it in render is safe (it updates at most once per
753
+ * second). Derive "is a transition pending?" as `secondsUntilStateChange > 0`.
754
+ */
755
+ readonly secondsUntilStateChange: number;
697
756
  answerQuestion(answerId: string): void;
698
757
  submitAnswer(request: Pick<SubmitAnswerRequest, 'answerOptionId' | 'answerText'>): Promise<void>;
699
758
  verifyJoinCode(joinCode: string, shouldJoinPlayer?: boolean): Promise<boolean>;
@@ -1473,7 +1532,12 @@ export declare enum CustomerId {
1473
1532
  MYSTICO = "MYSTICO",
1474
1533
  MORAVEC = "MORAVEC",
1475
1534
  JAN_TUNA = "JAN_TUNA",
1476
- PODNIKATELSKY_MINDSET = "PODNIKATELSKY_MINDSET"
1535
+ PODNIKATELSKY_MINDSET = "PODNIKATELSKY_MINDSET",
1536
+ PETR_HOFMAN = "PETR_HOFMAN",
1537
+ NCSLM = "NCSLM",
1538
+ DOUCKO_S_ROBINEM = "DOUCKO_S_ROBINEM",
1539
+ KVIZ_PLEASE = "KVIZ_PLEASE",
1540
+ TALKSHOW_KOTAK_LIVE = "TALKSHOW_KOTAK_LIVE"
1477
1541
  }
1478
1542
 
1479
1543
  export declare interface CustomScript {
@@ -4475,7 +4539,7 @@ export declare interface PollWidget<TScene extends InteractiveWidgetScene = Inte
4475
4539
  readonly type: InteractiveWidgetType.POLL;
4476
4540
  }
4477
4541
 
4478
- export declare type PollWidgetState = InteractiveWidgetState.IDLE | InteractiveWidgetState.CURRENT_QUESTION | InteractiveWidgetState.LEADERBOARD | InteractiveWidgetState.RESET_GAME | InteractiveWidgetState.NEXT_STATE;
4542
+ export declare type PollWidgetState = InteractiveWidgetState.IDLE | InteractiveWidgetState.CURRENT_QUESTION | InteractiveWidgetState.RESOLVED_QUESTION | InteractiveWidgetState.RESET_GAME | InteractiveWidgetState.NEXT_STATE;
4479
4543
 
4480
4544
  /**
4481
4545
  * @public
@@ -5165,7 +5229,9 @@ export declare interface QuestionRepository {
5165
5229
  readonly selectedAnswerId: string | undefined;
5166
5230
  isSubmitted: boolean;
5167
5231
  isSubmitting: boolean;
5168
- setCurrentQuestion: (question: CurrentQuestion | null, role: InteractiveWidgetRole, secondsToAnswer: number, shouldEnterAtTimestampMs?: number, shouldAdjustEndTimestampMs?: boolean) => void;
5232
+ setCurrentQuestion: (question: CurrentQuestion | null, role: InteractiveWidgetRole,
5233
+ /** Time limit for the question. Omit/undefined means no timer (e.g. polls). */
5234
+ secondsToAnswer: number | undefined, shouldEnterAtTimestampMs?: number, shouldAdjustEndTimestampMs?: boolean) => void;
5169
5235
  selectAnswer: (answerId: string | undefined) => void;
5170
5236
  setShowCountdown: (showCountdown: boolean) => void;
5171
5237
  reset: () => void;