ENGLISH·COURSE API
    Preparing search index...
    • Celebrates the lesson on screen earning its ticket, and hands the learner on to the counter when that ticket was the module's last.

      Parameters

      • input: {
            lesson:
                | {
                    kind: "reading";
                    id: string & $brand<"LessonId">;
                    courseId: string & $brand<"CourseId">;
                    moduleId: string & $brand<"ModuleId">;
                    sequence: number;
                    title: string;
                    body: string;
                }
                | {
                    kind: "video";
                    id: string & $brand<"LessonId">;
                    courseId: string & $brand<"CourseId">;
                    moduleId: string & $brand<"ModuleId">;
                    sequence: number;
                    title: string;
                    description: string;
                    source: string;
                    durationSeconds: number;
                    poster?: string;
                    uploadDate?: string;
                };
            module: {
                id: string & $brand<"ModuleId">;
                courseId: string & $brand<"CourseId">;
                slug: string & $brand<"Slug">;
                title: string;
                sequence: number;
            };
            moduleLessons: readonly (
                | {
                    kind: "reading";
                    id: string & $brand<"LessonId">;
                    courseId: string & $brand<"CourseId">;
                    moduleId: string & $brand<"ModuleId">;
                    sequence: number;
                    title: string;
                    body: string;
                }
                | {
                    kind: "video";
                    id: string & $brand<"LessonId">;
                    courseId: string & $brand<"CourseId">;
                    moduleId: string & $brand<"ModuleId">;
                    sequence: number;
                    title: string;
                    description: string;
                    source: string;
                    durationSeconds: number;
                    poster?: string;
                    uploadDate?: string;
                }
            )[];
        }

        The lesson on screen, its module, and every lesson of that module

      Returns LessonRewardMoment

      The current ticket moment and a way to dismiss it

      It observes the tickets instead of being told by whoever completed the lesson, so marking it and watching it to the end both celebrate, exactly once, with the same rule every progress surface counts with.

      Only earning a ticket counts — not completion itself. The first value is taken once the mount-time storage read has settled, so opening a lesson completed on an earlier visit stays quiet; and because a ticket is kept once earned, un-marking and completing again announces nothing a second time.

      A learner watching fullscreen still sees the ticket — TicketToast renders into the presented element — but the prize dialog waits until they leave fullscreen rather than covering the lesson they are watching, and then waits a moment more so its entrance is seen and not spent behind the restore.

      A waiting prize is recorded the instant its last ticket is earned, so a learner who moves on before the dialog is due is still told about it on the next page they open. While this page is on screen it holds that announcement, so the news can never arrive over the ticket it belongs to; the hold leaves with the page.

      Browser-side only — do NOT call from a Server Component.

      const { ticket, dismissTicket } = useLessonRewardMoment({ lesson, module, moduleLessons });
      return <TicketToast moment={ticket} onDone={dismissTicket} />;