// @flow import ERRORS from "./errors"; import {getConfig, getConfigForProgression} from "./config"; import createProgression from "./create-progression"; import createState from "./create-state"; import checkAnswerCorrectness from "./check-answer-correctness"; import checkAnswer from "./check-answer"; import {computeNextStepAfterAnswer, computeNextStepOnAcceptExtraLife, computeNextStepOnRefuseExtraLife} from "./compute-next-step"; declare export var ERRORS: {STATE_VALIDATION_ERROR: string}; declare export function checkAnswer(config: {answerBoundaryLimit: number, lives: number, livesDisabled: boolean, maxTypos: number, remainingLifeRequests: number, slidesToComplete: number, starsPerAskingClue: number, starsPerCorrectAnswer: number, starsPerResourceViewed: number, version: string}, question: {content: {answers: Array>}, type: "qcm"} | {content: {answers: Array>}, type: "qcmGraphic"} | {content: {answers: Array>, matchOrder: boolean}, type: "qcmDrag"} | {content: {answers: Array>}, type: "slider"} | {content: {answers: Array>, maxTypos?: ?number}, type: "basic"} | {content: {answers: Array>, choices: Array<{type: "text" | "select"}>, matchOrder: boolean, maxTypos?: ?number}, type: "template"}, givenAnswer: Array): boolean; declare export function checkAnswerCorrectness(config: {answerBoundaryLimit: number, lives: number, livesDisabled: boolean, maxTypos: number, remainingLifeRequests: number, slidesToComplete: number, starsPerAskingClue: number, starsPerCorrectAnswer: number, starsPerResourceViewed: number, version: string}, question: {content: {answers: Array>}, type: "qcm"} | {content: {answers: Array>}, type: "qcmGraphic"} | {content: {answers: Array>, matchOrder: boolean}, type: "qcmDrag"} | {content: {answers: Array>}, type: "slider"} | {content: {answers: Array>, maxTypos?: ?number}, type: "basic"} | {content: {answers: Array>, choices: Array<{type: "text" | "select"}>, matchOrder: boolean, maxTypos?: ?number}, type: "template"}, givenAnswer: Array): {corrections: Array<{answer: string | void, isCorrect: ?boolean}>, isCorrect: boolean}; declare export function computeNextStepAfterAnswer(config: {answerBoundaryLimit: number, lives: number, livesDisabled: boolean, maxTypos: number, remainingLifeRequests: number, slidesToComplete: number, starsPerAskingClue: number, starsPerCorrectAnswer: number, starsPerResourceViewed: number, version: string}, state: {content?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}} & {allAnswers: Array<{answer: Array, isCorrect: ?boolean, slideRef: string}>, content?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, hasViewedAResourceAtThisStep: boolean, isCorrect: ?boolean, lives: number, livesDisabled?: boolean, nextContent?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, remainingLifeRequests: number, requestedClues: Array, slides: Array, stars: number, step: {current: number}, variables: {[_: string]: string | boolean | number}, viewedResources: Array<{ref: string, resources: Array, type: mixed /* UNEXPECTED TYPE: EvalT */}>}, availableContent: Array<{ref: string, rules: Array<{conditions: Array<{operator: $Keys<{BETWEEN: (expectedValues: Array, value: T) => boolean, EQUALS: (expectedValues: Array, value: T) => boolean, GT: (expectedValues: Array, value: T) => boolean, GTE: (expectedValues: Array, value: T) => boolean, IN: (expectedValues: Array, value: T) => boolean, LT: (expectedValues: Array, value: T) => boolean, LTE: (expectedValues: Array, value: T) => boolean, NOT_BETWEEN: (expectedValues: Array, value: T) => boolean, NOT_EQUALS: (expectedValues: Array, value: T) => boolean, NOT_IN: (expectedValues: Array, value: T) => boolean}>, target: {field: "lives" | "stars" | string, scope: "variable"} | {field: "isCorrect" | "answer", ref: string, scope: "slide"}, values: Array>}>, destination: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}>, priority: number, ref?: string, source: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}> | null, slides: Array<{_id: string, chapter_id: string, position?: ?number, question: {content: {answers: Array>}, type: "qcm"} | {content: {answers: Array>}, type: "qcmGraphic"} | {content: {answers: Array>, matchOrder: boolean}, type: "qcmDrag"} | {content: {answers: Array>}, type: "slider"} | {content: {answers: Array>, maxTypos?: ?number}, type: "basic"} | {content: {answers: Array>, choices: Array<{type: "text" | "select"}>, matchOrder: boolean, maxTypos?: ?number}, type: "template"}}>}>, currentSlide: {_id: string, chapter_id: string, position?: ?number, question: {content: {answers: Array>}, type: "qcm"} | {content: {answers: Array>}, type: "qcmGraphic"} | {content: {answers: Array>, matchOrder: boolean}, type: "qcmDrag"} | {content: {answers: Array>}, type: "slider"} | {content: {answers: Array>, maxTypos?: ?number}, type: "basic"} | {content: {answers: Array>, choices: Array<{type: "text" | "select"}>, matchOrder: boolean, maxTypos?: ?number}, type: "template"}}, action: mixed /* UNEXPECTED TYPE: EvalT */): {payload: {answer: Array, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, godMode: ?boolean, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, isCorrect: ?boolean, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "answer"} | null; declare export function computeNextStepOnAcceptExtraLife(config: {answerBoundaryLimit: number, lives: number, livesDisabled: boolean, maxTypos: number, remainingLifeRequests: number, slidesToComplete: number, starsPerAskingClue: number, starsPerCorrectAnswer: number, starsPerResourceViewed: number, version: string}, state: {content?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}} & {allAnswers: Array<{answer: Array, isCorrect: ?boolean, slideRef: string}>, content?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, hasViewedAResourceAtThisStep: boolean, isCorrect: ?boolean, lives: number, livesDisabled?: boolean, nextContent?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, remainingLifeRequests: number, requestedClues: Array, slides: Array, stars: number, step: {current: number}, variables: {[_: string]: string | boolean | number}, viewedResources: Array<{ref: string, resources: Array, type: mixed /* UNEXPECTED TYPE: EvalT */}>}, availableContent: Array<{ref: string, rules: Array<{conditions: Array<{operator: $Keys<{BETWEEN: (expectedValues: Array, value: T) => boolean, EQUALS: (expectedValues: Array, value: T) => boolean, GT: (expectedValues: Array, value: T) => boolean, GTE: (expectedValues: Array, value: T) => boolean, IN: (expectedValues: Array, value: T) => boolean, LT: (expectedValues: Array, value: T) => boolean, LTE: (expectedValues: Array, value: T) => boolean, NOT_BETWEEN: (expectedValues: Array, value: T) => boolean, NOT_EQUALS: (expectedValues: Array, value: T) => boolean, NOT_IN: (expectedValues: Array, value: T) => boolean}>, target: {field: "lives" | "stars" | string, scope: "variable"} | {field: "isCorrect" | "answer", ref: string, scope: "slide"}, values: Array>}>, destination: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}>, priority: number, ref?: string, source: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}> | null, slides: Array<{_id: string, chapter_id: string, position?: ?number, question: {content: {answers: Array>}, type: "qcm"} | {content: {answers: Array>}, type: "qcmGraphic"} | {content: {answers: Array>, matchOrder: boolean}, type: "qcmDrag"} | {content: {answers: Array>}, type: "slider"} | {content: {answers: Array>, maxTypos?: ?number}, type: "basic"} | {content: {answers: Array>, choices: Array<{type: "text" | "select"}>, matchOrder: boolean, maxTypos?: ?number}, type: "template"}}>}>): {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeAccepted"} | null; declare export function computeNextStepOnRefuseExtraLife(config: {answerBoundaryLimit: number, lives: number, livesDisabled: boolean, maxTypos: number, remainingLifeRequests: number, slidesToComplete: number, starsPerAskingClue: number, starsPerCorrectAnswer: number, starsPerResourceViewed: number, version: string}, state: {content?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}} & {allAnswers: Array<{answer: Array, isCorrect: ?boolean, slideRef: string}>, content?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, hasViewedAResourceAtThisStep: boolean, isCorrect: ?boolean, lives: number, livesDisabled?: boolean, nextContent?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, remainingLifeRequests: number, requestedClues: Array, slides: Array, stars: number, step: {current: number}, variables: {[_: string]: string | boolean | number}, viewedResources: Array<{ref: string, resources: Array, type: mixed /* UNEXPECTED TYPE: EvalT */}>}): {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeRefused"}; declare export function createProgression(engine: {ref: string, version: string}, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, engineOptions: {lives?: number, livesDisabled?: boolean}, availableContent: Array<{ref: string, rules: Array<{conditions: Array<{operator: $Keys<{BETWEEN: (expectedValues: Array, value: T) => boolean, EQUALS: (expectedValues: Array, value: T) => boolean, GT: (expectedValues: Array, value: T) => boolean, GTE: (expectedValues: Array, value: T) => boolean, IN: (expectedValues: Array, value: T) => boolean, LT: (expectedValues: Array, value: T) => boolean, LTE: (expectedValues: Array, value: T) => boolean, NOT_BETWEEN: (expectedValues: Array, value: T) => boolean, NOT_EQUALS: (expectedValues: Array, value: T) => boolean, NOT_IN: (expectedValues: Array, value: T) => boolean}>, target: {field: "lives" | "stars" | string, scope: "variable"} | {field: "isCorrect" | "answer", ref: string, scope: "slide"}, values: Array>}>, destination: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}>, priority: number, ref?: string, source: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}> | null, slides: Array<{_id: string, chapter_id: string, position?: ?number, question: {content: {answers: Array>}, type: "qcm"} | {content: {answers: Array>}, type: "qcmGraphic"} | {content: {answers: Array>, matchOrder: boolean}, type: "qcmDrag"} | {content: {answers: Array>}, type: "slider"} | {content: {answers: Array>, maxTypos?: ?number}, type: "basic"} | {content: {answers: Array>, choices: Array<{type: "text" | "select"}>, matchOrder: boolean, maxTypos?: ?number}, type: "template"}}>}>): {actions: Array<{type: "init"} | {payload: {instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "move"} | {payload: {answer: Array, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, godMode: ?boolean, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, isCorrect: ?boolean, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "answer"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "clue"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeAccepted"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeRefused"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, resource: {ref: string, type: "video" | "pdf", version?: string}}, type: "resource"} | {payload: {instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "move"}>, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, engine: {ref: string, version: string}, engineOptions: {lives?: number, livesDisabled?: boolean}} | null; declare export function createState(progression: {actions: Array<{type: "init"} | {payload: {instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "move"} | {payload: {answer: Array, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, godMode: ?boolean, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, isCorrect: ?boolean, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "answer"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "clue"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeAccepted"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeRefused"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, resource: {ref: string, type: "video" | "pdf", version?: string}}, type: "resource"} | {payload: {instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "move"}>, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, engine: {ref: string, version: string}, engineOptions: {lives?: number, livesDisabled?: boolean}}): {content?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}} & {allAnswers: Array<{answer: Array, isCorrect: ?boolean, slideRef: string}>, content?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, hasViewedAResourceAtThisStep: boolean, isCorrect: ?boolean, lives: number, livesDisabled?: boolean, nextContent?: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, remainingLifeRequests: number, requestedClues: Array, slides: Array, stars: number, step: {current: number}, variables: {[_: string]: string | boolean | number}, viewedResources: Array<{ref: string, resources: Array, type: mixed /* UNEXPECTED TYPE: EvalT */}>}; declare export function getConfig(engine: {ref: string, version: string}): {answerBoundaryLimit: number, lives: number, livesDisabled: boolean, maxTypos: number, remainingLifeRequests: number, slidesToComplete: number, starsPerAskingClue: number, starsPerCorrectAnswer: number, starsPerResourceViewed: number, version: string}; declare export function getConfigForProgression(progression: {actions: Array<{type: "init"} | {payload: {instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "move"} | {payload: {answer: Array, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, godMode: ?boolean, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, isCorrect: ?boolean, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "answer"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "clue"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeAccepted"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeRefused"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, resource: {ref: string, type: "video" | "pdf", version?: string}}, type: "resource"} | {payload: {instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "move"}>, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, engine: {ref: string, version: string}, engineOptions: {lives?: number, livesDisabled?: boolean}}): {answerBoundaryLimit: number, lives: number, livesDisabled: boolean, maxTypos: number, remainingLifeRequests: number, slidesToComplete: number, starsPerAskingClue: number, starsPerCorrectAnswer: number, starsPerResourceViewed: number, version: string};