@vkontakte/videoplayer-interactive 1.0.29-dev.e881d3ff.0 → 1.0.30-dev.bd42a8ac.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.
@@ -0,0 +1,47 @@
1
+ import type { SubjectName, ActionMap, SubjectType, AfterExpectActionType, Behaviour } from './SelectBranches.types';
2
+ import { InteractivesEventTypes } from './events';
3
+ import { EventActionTypes } from '../../../manifest';
4
+ import type { ControlEvent, ContainerEvent, ChapterEvent, ChapterContainer, Control } from '../../../manifest';
5
+ import type { InteractiveRange } from './getInteractiveRanges';
6
+ export type { SubjectName };
7
+ type InteractivesEventTypesValues = `${InteractivesEventTypes}`;
8
+ type InteractivesEventTypesValuesChapter = InteractivesEventTypes.ACTION_CHOICE | InteractivesEventTypes.ACTION_CHOICE_CANCELED | InteractivesEventTypes.ACTION_EXECUTION;
9
+ type InteractivesEventTypesValuesContainer = InteractivesEventTypesValues;
10
+ type InteractivesEventTypesValuesControl = InteractivesEventTypesValuesChapter | InteractivesEventTypes.VISIBILITY;
11
+ type InteractiveEventType<T extends SubjectName> = T extends 'container' ? InteractivesEventTypesValuesContainer : InteractivesEventTypesValuesControl;
12
+ type TInteractiveCommon<T extends SubjectName, U extends InteractiveEventType<T>> = {
13
+ subjectId: string;
14
+ subjectName: T;
15
+ type: U;
16
+ };
17
+ export type TInteractivesVisibility<T extends Exclude<SubjectName, 'chapter'>> = TInteractiveCommon<T, InteractivesEventTypes.VISIBILITY> & {
18
+ visibility: boolean;
19
+ isFirst?: boolean;
20
+ };
21
+ type EventActionTypesValues = `${EventActionTypes}`;
22
+ export type TInteractiveRangeEndedEvent = {
23
+ type: InteractivesEventTypes.RANGE_ENDED;
24
+ payload: InteractiveRange;
25
+ };
26
+ type NonChapterChangeEvents = EventActionTypes.openURI | EventActionTypes.continuePlayback | EventActionTypes.expect;
27
+ type TInteractivesActionExecEventPayload<T extends EventActionTypesValues> = T extends Exclude<EventActionTypesValues, NonChapterChangeEvents> ? Partial<{
28
+ chapterId: string;
29
+ autoSelect: boolean;
30
+ behaviour: Behaviour;
31
+ manifestURL: string;
32
+ }> : undefined;
33
+ export type TInteractivesActionExecutionEvent<T extends SubjectName> = TInteractiveCommon<T, InteractivesEventTypes.ACTION_EXECUTION> & {
34
+ actionType: ActionMap[T]['type'] | AfterExpectActionType;
35
+ subjectType?: SubjectType<T>;
36
+ payload?: TInteractivesActionExecEventPayload<ActionMap[T]['type']>;
37
+ };
38
+ type TInteractivesActionChoiceEventPayload<T extends SubjectName> = T extends 'chapter' ? ChapterEvent['action']['args'] : T extends 'container' ? ContainerEvent['action']['args'] : ControlEvent['action']['args'] & {
39
+ containerId: string;
40
+ };
41
+ type TSubjectTypeValues<T extends SubjectName> = T extends 'chapter' ? undefined : T extends 'container' ? ChapterContainer['type'] : Control['type'];
42
+ export type TInteractivesActionChoiceEvent<T extends SubjectName> = TInteractiveCommon<T, InteractivesEventTypes.ACTION_CHOICE | InteractivesEventTypes.ACTION_CHOICE_CANCELED> & {
43
+ subjectType?: TSubjectTypeValues<T>;
44
+ actionType: EventActionTypesValues;
45
+ payload: TInteractivesActionChoiceEventPayload<T>;
46
+ };
47
+ export type TInteractivesContainerRemoved = TInteractiveCommon<'container', InteractivesEventTypes.CONTAINER_REMOVED>;