Newer
Older
import { ResponseStatusType } from '@iqb/responses';
export type NavigationTarget = 'first' | 'last' | 'previous' | 'next' | 'end';
export type Progress = 'none' | 'some' | 'complete';
export type PagingMode = 'separate' | 'buttons' | 'concat-scroll' | 'concat-scroll-snap';
export enum ElementCodeStatusValue {
UNSET = 0, NOT_REACHED = 1, DISPLAYED = 2, VALUE_CHANGED = 3, VALUE_DERIVED = 4, SOURCE_MISSING = 5,
DERIVE_ERROR = 6, CODING_COMPLETE = 7, NO_CODING = 8, CODING_INCOMPLETE = 9, CODING_ERROR = 10
}
export interface StatusChangeElement {
id: string;
status: ResponseStatusType;
export interface PlayerConfig {
unitNumber?: number;
unitTitle?: number;
unitId?: number;
logPolicy?: 'lean' | 'rich' | 'debug' | 'disabled';
startPage?: string;
enabledNavigationTargets?: NavigationTarget[];
directDownloadUrl?: string;
}
export interface UnitState {
dataParts?: Record<string, string>;
presentationProgress?: Progress;
responseProgress?: Progress;
unitStateDataType?: string;
}
export interface PlayerState {
export interface LogData {
timeStamp: number,
key: string,
content?: string
}
export interface VopStartCommand {
type: 'vopStartCommand';
sessionId: string;
unitDefinition?: string;
unitDefinitionType?: string;
unitState?: UnitState;
playerConfig?: PlayerConfig;
}
export interface VopNavigationDeniedNotification {
type: 'vopNavigationDeniedNotification';
sessionId: string;
reason?: Array<'presentationIncomplete' | 'responsesIncomplete'>
}
export interface VopPageNavigationCommand {
type: 'vopPageNavigationCommand';
sessionId: string;
target: string;
}
export interface VopReadyNotification {
metadata: VopMetaData;
}
export interface VopMetaData {
$schema: string,
id: string;
type: string;
version: string;
specVersion: string;
metadataVersion: string
name: {
lang: string;
value: string;
}[];
description: {
lang: string;
value: string;
}[];
maintainer: {
name: Record<string, string>[];
email: string;
url: string;
}
code: {
repositoryType: string;
licenseType: string;
licenseUrl: string;
repositoryUrl: string;
}
notSupportedFeatures: string[];
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
}
export interface VopStateChangedNotification {
type: 'vopStateChangedNotification';
sessionId: string;
timeStamp: number;
unitState?: UnitState;
playerState?: PlayerState;
log?: LogData[];
}
export interface VopUnitNavigationRequestedNotification {
type: 'vopUnitNavigationRequestedNotification';
sessionId: string;
target: 'first' | 'last' | 'previous' | 'next' | 'end';
}
export interface VopWindowFocusChangedNotification {
type: 'vopWindowFocusChangedNotification';
timeStamp: number;
hasFocus: boolean;
}
export type VopMessage =
VopStartCommand |
VopNavigationDeniedNotification |
VopPageNavigationCommand |
VopReadyNotification |
VopStateChangedNotification |
VopWindowFocusChangedNotification |
VopUnitNavigationRequestedNotification;