@tivio/sdk-react 10.3.0 → 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[];
@@ -705,6 +743,16 @@ export declare interface BaseInteractiveWidget<TAnswer extends BaseQuestionAnswe
705
743
  * Sourced live from the video document (`activeUsers.value`).
706
744
  */
707
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;
708
756
  answerQuestion(answerId: string): void;
709
757
  submitAnswer(request: Pick<SubmitAnswerRequest, 'answerOptionId' | 'answerText'>): Promise<void>;
710
758
  verifyJoinCode(joinCode: string, shouldJoinPlayer?: boolean): Promise<boolean>;
@@ -1485,7 +1533,11 @@ export declare enum CustomerId {
1485
1533
  MORAVEC = "MORAVEC",
1486
1534
  JAN_TUNA = "JAN_TUNA",
1487
1535
  PODNIKATELSKY_MINDSET = "PODNIKATELSKY_MINDSET",
1488
- PETR_HOFMAN = "PETR_HOFMAN"
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"
1489
1541
  }
1490
1542
 
1491
1543
  export declare interface CustomScript {