@vkontakte/videoplayer-interactive 1.0.28 → 1.0.29-dev.6887ae27.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/es2015.cjs.js +7 -7
- package/es2015.esm.js +7 -7
- package/es2018.cjs.js +7 -7
- package/es2018.esm.js +7 -7
- package/esnext.cjs.js +7 -7
- package/esnext.esm.js +7 -7
- package/evergreen.esm.js +7 -7
- package/package.json +4 -4
- package/types/index.d.ts +2 -3
- package/types/manifest/index.d.ts +3 -0
- package/types/{movika.core/manifest/types.d.ts → manifest/utils.d.ts} +23 -6
- package/types/modules/Graph/Graph.d.ts +3 -2
- package/types/modules/Interactives/Interactives.d.ts +20 -18
- package/types/modules/Interactives/Layout.d.ts +7 -7
- package/types/modules/Interactives/containers/ChoiceContainer.d.ts +3 -3
- package/types/modules/Interactives/containers/Container.d.ts +4 -4
- package/types/modules/Interactives/controls/Control.d.ts +3 -4
- package/types/modules/Interactives/controls/types.d.ts +4 -5
- package/types/modules/Interactives/index.d.ts +2 -2
- package/types/modules/Interactives/types.d.ts +3 -3
- package/types/modules/Interactives/utils/GameController.d.ts +18 -15
- package/types/modules/Interactives/utils/GroupsStack.d.ts +5 -5
- package/types/modules/Interactives/utils/HistoryController.d.ts +3 -2
- package/types/modules/Interactives/utils/InteractiveEvents.d.ts +2 -2
- package/types/modules/Interactives/utils/SelectBranches.d.ts +6 -4
- package/types/modules/Interactives/utils/SelectBranches.types.d.ts +18 -14
- package/types/modules/Interactives/utils/events.d.ts +31 -8
- package/types/modules/Interactives/utils/events.types.d.ts +47 -0
- package/types/modules/Interactives/utils/fallbackStrategies.d.ts +6 -6
- package/types/modules/Interactives/utils/gameUtils.d.ts +14 -14
- package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +1 -1
- package/types/modules/Interactives/utils/renderingUtils.d.ts +9 -7
- package/types/modules/Loaders/vkVideoLoader/types.d.ts +2 -2
- package/types/modules/Loaders/vkVideoLoader/utils.d.ts +0 -2
- package/types/modules/ManifestController/ManifestController.d.ts +11 -12
- package/types/modules/ManifestController/utils.d.ts +6 -6
- package/types/modules/SeamlessController/SeamlessController.d.ts +2 -2
- package/types/modules/SeamlessController/utils.d.ts +2 -2
- package/types/modules/SeekToInteractiveController/SeekToInteractiveController.d.ts +2 -2
- package/types/utils/LastFrame.d.ts +1 -1
- package/types/utils/chapterHelpers.d.ts +1 -1
- package/types/utils/extractVkMovieId.d.ts +1 -1
- package/types/movika.core/manifest/index.d.ts +0 -28
- package/types/movika.core/manifest/manifest_3_2/chapter.d.ts +0 -63
- package/types/movika.core/manifest/manifest_3_2/control.d.ts +0 -67
- package/types/movika.core/manifest/manifest_3_2/manifest.d.ts +0 -50
- package/types/movika.core/manifest/manifest_3_2/template.d.ts +0 -34
- package/types/movika.core/manifest/manifest_3_3/chapter.d.ts +0 -72
- package/types/movika.core/manifest/manifest_3_3/control.d.ts +0 -66
- package/types/movika.core/manifest/manifest_3_3/graph.d.ts +0 -73
- package/types/movika.core/manifest/manifest_3_3/manifest.d.ts +0 -52
- package/types/movika.core/manifest/manifest_3_3/template.d.ts +0 -34
- package/types/movika.core/manifest/migrations/index.d.ts +0 -1
- package/types/movika.core/manifest/migrations/migrateManifestToLatestVersion.d.ts +0 -1
- package/types/movika.core/manifest/migrations/migrate_from_3_0_to_3_1.d.ts +0 -21
- package/types/movika.core/manifest/migrations/migrate_from_3_1_to_3_2.d.ts +0 -2
- package/types/movika.core/manifest/migrations/migrate_from_3_2_to_3_3.d.ts +0 -8
- package/types/movika.core/manifest/utils.d.ts +0 -5
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Container } from './Container';
|
|
2
|
-
import {
|
|
2
|
+
import { ChapterContainer } from "../../../manifest";
|
|
3
3
|
import { ControlEventCallback } from "../../../modules/Interactives/controls";
|
|
4
|
-
export declare const createChoiceContainer: (container:
|
|
4
|
+
export declare const createChoiceContainer: (container: ChapterContainer, rootElement: HTMLElement) => ChoiceContainer | undefined;
|
|
5
5
|
export declare class ChoiceContainer extends Container {
|
|
6
6
|
private rootElement;
|
|
7
7
|
private layout;
|
|
8
8
|
isRemoved: boolean;
|
|
9
9
|
isDisabled: boolean;
|
|
10
|
-
constructor(container:
|
|
10
|
+
constructor(container: ChapterContainer, rootElement: HTMLElement);
|
|
11
11
|
createView(eventCallback: ControlEventCallback): HTMLElement;
|
|
12
12
|
hide(): void;
|
|
13
13
|
show(): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import Control from '../../../modules/Interactives/controls/Control
|
|
2
|
-
import {
|
|
1
|
+
import Control from '../../../modules/Interactives/controls/Control';
|
|
2
|
+
import { ChapterContainer } from "../../../manifest";
|
|
3
3
|
import { ControlCreator } from "../../../modules/Interactives/controls";
|
|
4
4
|
export declare class Container {
|
|
5
|
-
container:
|
|
5
|
+
container: ChapterContainer;
|
|
6
6
|
private factories;
|
|
7
7
|
controls: Control[];
|
|
8
|
-
constructor(container:
|
|
8
|
+
constructor(container: ChapterContainer);
|
|
9
9
|
addControlFactory(type: string, factory: ControlCreator): void;
|
|
10
10
|
removeControlFactory(type: string): void;
|
|
11
11
|
private setControls;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ControlEventCallback, CreateViewParams, Dimensions, LayoutCallback } from './types';
|
|
1
|
+
import type { ControlEventCallback, CreateViewParams, Dimensions, LayoutCallback, TControl } from './types';
|
|
3
2
|
type ControlContainer = {
|
|
4
3
|
element: HTMLElement;
|
|
5
4
|
dimensions: Dimensions;
|
|
6
5
|
};
|
|
7
6
|
export default abstract class Control {
|
|
8
|
-
control:
|
|
7
|
+
control: TControl;
|
|
9
8
|
protected container: Nullable<ControlContainer>;
|
|
10
9
|
protected controlElement: Nullable<HTMLElement>;
|
|
11
10
|
private clickListener;
|
|
12
|
-
protected constructor(control:
|
|
11
|
+
protected constructor(control: TControl);
|
|
13
12
|
abstract createView(params: CreateViewParams): void;
|
|
14
13
|
abstract getElement(): Nullable<HTMLElement>;
|
|
15
14
|
abstract disable(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ControlEvent, ControlLayoutParams } from '../../../
|
|
2
|
-
import { LatestControl } from '../../../movika.core/manifest';
|
|
1
|
+
import type { Control as TControl, ControlEvent, ControlLayoutParams } from '../../../manifest';
|
|
3
2
|
import Control from '../../../modules/Interactives/controls/Control';
|
|
3
|
+
export { TControl };
|
|
4
4
|
export declare enum CONTROLLER_IDS {
|
|
5
5
|
AREA = "int_area",
|
|
6
6
|
TEXT = "int_text",
|
|
@@ -18,8 +18,7 @@ export type CreateViewParams = {
|
|
|
18
18
|
type ControlEventCallbackParams = {
|
|
19
19
|
action: ControlEvent['action'];
|
|
20
20
|
controlId: string;
|
|
21
|
-
controlType:
|
|
21
|
+
controlType: TControl['type'];
|
|
22
22
|
};
|
|
23
23
|
export type ControlEventCallback = (params: ControlEventCallbackParams) => void;
|
|
24
|
-
export type ControlCreator = (control:
|
|
25
|
-
export {};
|
|
24
|
+
export type ControlCreator = (control: TControl) => Control | undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Container } from './containers/index';
|
|
2
2
|
export { Interactives } from './Interactives';
|
|
3
3
|
export { EVENT_NAMES, graphEventTypes, interactivesEventTypes } from './utils/events';
|
|
4
|
-
export type {
|
|
4
|
+
export type { InteractiveProjectInfo, PlayerChangedData, VideoInfo } from './types';
|
|
5
5
|
export { isLastChapter, hasEndTemplate, isOneTextCtrlContainer } from './utils/gameUtils';
|
|
6
6
|
export type { InteractiveRange } from './utils/getInteractiveRanges';
|
|
7
7
|
export declare const utils: {
|
|
8
8
|
Container: typeof Container;
|
|
9
|
-
createChoiceContainer: (container: import("
|
|
9
|
+
createChoiceContainer: (container: import("@interactiveplatform/movika-manifest").ChapterContainer, rootElement: HTMLElement) => import("./containers/ChoiceContainer").ChoiceContainer | undefined;
|
|
10
10
|
createAreaControl: import("./controls").ControlCreator;
|
|
11
11
|
createButtonControl: import("./controls").ControlCreator;
|
|
12
12
|
getRootEl: () => Element | null;
|
|
@@ -3,7 +3,7 @@ import type { IOptionalTuningConfig, IPlayer } from '@vkontakte/videoplayer-core
|
|
|
3
3
|
import type { IOneStat } from '@vkontakte/videoplayer-statistics';
|
|
4
4
|
import type { Loaders } from '../../modules/ManifestController/Loadable';
|
|
5
5
|
import type { HistoryApi, HistorySettings } from '../../modules/Interactives/utils/HistoryController';
|
|
6
|
-
import type {
|
|
6
|
+
import type { Chapter, ManifestVideo } from '../../manifest';
|
|
7
7
|
export type VideoInfo = {
|
|
8
8
|
id: string;
|
|
9
9
|
cover: string;
|
|
@@ -45,8 +45,8 @@ export interface IInteractiveOptions {
|
|
|
45
45
|
disableControlsOnPause?: boolean;
|
|
46
46
|
}
|
|
47
47
|
export type ChapterChangedData = {
|
|
48
|
-
chapter:
|
|
49
|
-
manifestVideo:
|
|
48
|
+
chapter: Chapter;
|
|
49
|
+
manifestVideo: ManifestVideo;
|
|
50
50
|
};
|
|
51
51
|
export type PlayerChangedData<T = any> = {
|
|
52
52
|
player: IPlayer;
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import { type ISubscription, type IValueSubject } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import { type IPlayer } from '@vkontakte/videoplayer-core';
|
|
3
3
|
import type { InteractiveEventsType } from './InteractiveEvents';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ChapterBranch } from '../../../manifest';
|
|
5
5
|
import type { EventEmitter } from '../../../utils/EventEmitter';
|
|
6
6
|
import type { ChoiceContainer } from "../../../modules/Interactives/containers";
|
|
7
7
|
import { SelectBranches } from './SelectBranches';
|
|
8
8
|
import { type GlobalEvents } from './events';
|
|
9
9
|
import { GameStates } from './gameUtils';
|
|
10
|
+
type ConstructorArg = {
|
|
11
|
+
player: IPlayer;
|
|
12
|
+
container: ChoiceContainer;
|
|
13
|
+
branches: ChapterBranch[];
|
|
14
|
+
selectBranches: ReturnType<typeof SelectBranches>;
|
|
15
|
+
interactiveEvents: InteractiveEventsType;
|
|
16
|
+
globalEventEmitter: EventEmitter;
|
|
17
|
+
globalEvents: GlobalEvents;
|
|
18
|
+
ignoreContainerEvent: () => boolean;
|
|
19
|
+
permanentTextControls: boolean;
|
|
20
|
+
disabledControls$: IValueSubject<boolean>;
|
|
21
|
+
onRemove: () => void;
|
|
22
|
+
};
|
|
10
23
|
export declare class GameController {
|
|
11
24
|
container: ChoiceContainer;
|
|
12
|
-
branches:
|
|
25
|
+
branches: ChapterBranch[];
|
|
13
26
|
selectBranches: ReturnType<typeof SelectBranches>;
|
|
14
27
|
subscription: ISubscription;
|
|
15
28
|
player: IPlayer;
|
|
@@ -23,19 +36,8 @@ export declare class GameController {
|
|
|
23
36
|
isSelectedControlEvent: boolean;
|
|
24
37
|
isSelectedContainerEvent: boolean;
|
|
25
38
|
globalEvents: GlobalEvents;
|
|
26
|
-
constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter, ignoreContainerEvent, permanentTextControls, disabledControls$, onRemove, }:
|
|
27
|
-
|
|
28
|
-
container: any;
|
|
29
|
-
branches: any;
|
|
30
|
-
selectBranches: any;
|
|
31
|
-
interactiveEvents: any;
|
|
32
|
-
globalEvents: any;
|
|
33
|
-
globalEventEmitter: any;
|
|
34
|
-
ignoreContainerEvent: any;
|
|
35
|
-
permanentTextControls: any;
|
|
36
|
-
disabledControls$: any;
|
|
37
|
-
onRemove: any;
|
|
38
|
-
});
|
|
39
|
+
constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter, ignoreContainerEvent, permanentTextControls, disabledControls$, onRemove, }: ConstructorArg);
|
|
40
|
+
private emitContainerVisibilityEvent;
|
|
39
41
|
registerEvents(): void;
|
|
40
42
|
hide: () => void;
|
|
41
43
|
show: () => void;
|
|
@@ -49,3 +51,4 @@ export declare class GameController {
|
|
|
49
51
|
removeView(): void;
|
|
50
52
|
destroy(): void;
|
|
51
53
|
}
|
|
54
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { EventActionKeys } from '../../../manifest';
|
|
2
2
|
export type TPriority = 'chapter' | 'container' | 'control';
|
|
3
3
|
export type TPayload = {
|
|
4
|
-
actionType:
|
|
4
|
+
actionType: EventActionKeys;
|
|
5
5
|
action: AnyFn;
|
|
6
6
|
};
|
|
7
7
|
export type TMapInitiator = {
|
|
@@ -13,17 +13,17 @@ type TMapPriority = {
|
|
|
13
13
|
type TMap = {
|
|
14
14
|
[timestamp: number]: TMapPriority;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
16
|
+
export type TMapFlattened = {
|
|
17
17
|
timestamp: number;
|
|
18
18
|
priority: TPriority;
|
|
19
19
|
initiator: string;
|
|
20
20
|
} & TPayload;
|
|
21
|
-
type GetAndRemoveArgType = Partial<Omit<
|
|
21
|
+
type GetAndRemoveArgType = Partial<Omit<TMapFlattened, keyof TPayload>> & Pick<TMapFlattened, 'timestamp'>;
|
|
22
22
|
export type TGroupsStack = ReturnType<typeof GroupsStack>;
|
|
23
23
|
export declare function GroupsStack(): {
|
|
24
24
|
map: TMap;
|
|
25
25
|
remove: ({ timestamp, priority, initiator }: GetAndRemoveArgType) => boolean;
|
|
26
|
-
add: ({ timestamp, priority, initiator, ...rest }:
|
|
26
|
+
add: ({ timestamp, priority, initiator, ...rest }: TMapFlattened) => void;
|
|
27
27
|
removeAll: () => void;
|
|
28
28
|
get: ({ timestamp, priority, initiator }: GetAndRemoveArgType) => TMapInitiator | TPayload[] | TMapPriority | null;
|
|
29
29
|
getLte: (timestamp: number) => TMap;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Nullable, Subject } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import type { IValueSubject } from '@vkontakte/videoplayer-shared';
|
|
3
3
|
import { EventEmitter } from '../../../utils/EventEmitter';
|
|
4
|
-
import type { VideoId } from '../../../
|
|
5
|
-
import type {
|
|
4
|
+
import type { VideoId } from '../../../manifest';
|
|
5
|
+
import type { VideoInfo } from "../../../modules/Interactives";
|
|
6
|
+
import type { Interactives } from '../../../modules/Interactives';
|
|
6
7
|
import { CustomError } from '../../../utils/Error';
|
|
7
8
|
export interface HistoryApi {
|
|
8
9
|
get: (rawId: string) => Promise<number[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Container } from '../../../manifest';
|
|
2
2
|
import { type TPayload, type TGroupsStack } from './GroupsStack';
|
|
3
3
|
import type { IPlayer } from '@vkontakte/videoplayer-core';
|
|
4
4
|
export type InteractiveEventsType = ReturnType<typeof InteractiveEvents>;
|
|
@@ -21,7 +21,7 @@ export declare function InteractiveEvents(player: IPlayer): {
|
|
|
21
21
|
timestamp: any;
|
|
22
22
|
id: any;
|
|
23
23
|
}) => void;
|
|
24
|
-
setData: (containers?:
|
|
24
|
+
setData: (containers?: Container[]) => void;
|
|
25
25
|
resetCalled: (timestamp: number) => void;
|
|
26
26
|
isReady: (timestamp: number) => boolean;
|
|
27
27
|
release: () => void;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { SelectBranchesArg, OnControlEventArg, ContinuePlaybackArg, ExpectEventHandlerArg, OnChapterEventArg, OnContainerEventArg, OnExpectEventArg, SetManifestContainerEventsArg, ActionMap, AnyAction } from './SelectBranches.types';
|
|
1
|
+
import type { Chapter } from '../../../manifest';
|
|
2
|
+
import type { SelectBranchesArg, OnControlEventArg, ContinuePlaybackArg, ExpectEventHandlerArg, OnChapterEventArg, OnContainerEventArg, OnExpectEventArg, SetManifestContainerEventsArg, ActionMap, AnyAction, AfterExpectActionType } from './SelectBranches.types';
|
|
3
3
|
export declare const defaultArgs: {
|
|
4
4
|
readonly shouldOpenNow: true;
|
|
5
5
|
readonly isDetachContainer: true;
|
|
6
6
|
};
|
|
7
|
+
export declare const AFTER_EXPECT_ACTION: AfterExpectActionType;
|
|
7
8
|
export declare const extendArgs: <T extends AnyAction>(action: T, rewrite?: boolean) => T;
|
|
8
|
-
export
|
|
9
|
+
export type ExtendArgsReturnType = ReturnType<typeof extendArgs>;
|
|
10
|
+
export declare const SelectBranches: ({ globalEventEmitter, globalEvents, player, interactiveEvents, removeControllers, }: SelectBranchesArg) => {
|
|
9
11
|
onControlEvent: ({ action, controlType, controlId, containerId, branches, onEvent, isEOV, isDisabled, }: OnControlEventArg) => void;
|
|
10
12
|
onContainerEvent: ({ action, container: { id: containerId, endTime }, branches, isEOV, autoSelected, }: OnContainerEventArg) => void;
|
|
11
13
|
onChapterEvent: ({ chapterId, action, branches }: OnChapterEventArg) => (() => ContinuePlaybackArg<"chapter">) | undefined;
|
|
12
14
|
onExpectEvent: <T extends keyof ActionMap>({ subjectId, subjectName }: OnExpectEventArg<T>) => void;
|
|
13
15
|
expectEventHandler: <T extends keyof ActionMap>({ subjectId, subjectName }: ExpectEventHandlerArg<T>) => void;
|
|
14
|
-
setManifestChapterEvents: (chapter:
|
|
16
|
+
setManifestChapterEvents: (chapter: Chapter) => void;
|
|
15
17
|
setManifestContainerEvents: ({ container, branches, isEOV }: SetManifestContainerEventsArg) => void;
|
|
16
18
|
stopExpect: () => void;
|
|
17
19
|
state: {
|
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChapterContainer, Control, ChapterBranch, ControlEvent, ContainerEvent, ChapterEvent } from '../../../manifest';
|
|
2
2
|
import type { EventEmitter } from '../../../utils/EventEmitter';
|
|
3
3
|
import type { IPlayer } from '@vkontakte/videoplayer-core';
|
|
4
4
|
import type { InteractiveEventsType } from './InteractiveEvents';
|
|
5
|
+
import type { GlobalEvents } from './events';
|
|
5
6
|
export type SubjectName = 'chapter' | 'container' | 'control';
|
|
7
|
+
export type AfterExpectActionType = 'after-expect';
|
|
8
|
+
export type Behaviour = 'change-chapter' | 'change-manifest';
|
|
6
9
|
export type SelectBranchesArg = {
|
|
7
10
|
globalEventEmitter: EventEmitter;
|
|
11
|
+
globalEvents: GlobalEvents;
|
|
8
12
|
player: IPlayer;
|
|
9
13
|
interactiveEvents: InteractiveEventsType;
|
|
10
14
|
removeControllers?: AnyFn;
|
|
11
15
|
};
|
|
12
16
|
export type OnControlEventArg = {
|
|
13
17
|
action: ControlEvent['action'];
|
|
14
|
-
controlType:
|
|
15
|
-
controlId:
|
|
16
|
-
containerId:
|
|
18
|
+
controlType: Control['type'];
|
|
19
|
+
controlId: Control['id'];
|
|
20
|
+
containerId: ChapterContainer['id'];
|
|
17
21
|
onEvent: AnyFn;
|
|
18
|
-
branches?:
|
|
22
|
+
branches?: ChapterBranch[];
|
|
19
23
|
isEOV?: () => boolean;
|
|
20
24
|
isDisabled?: () => boolean;
|
|
21
25
|
};
|
|
22
26
|
export type OnContainerEventArg = {
|
|
23
27
|
action: ContainerEvent['action'];
|
|
24
|
-
container:
|
|
28
|
+
container: ChapterContainer;
|
|
25
29
|
autoSelected?: boolean;
|
|
26
|
-
branches?:
|
|
30
|
+
branches?: ChapterBranch[];
|
|
27
31
|
isEOV?: boolean;
|
|
28
32
|
};
|
|
29
33
|
export type OnChapterEventArg = {
|
|
30
34
|
action: ChapterEvent['action'];
|
|
31
35
|
chapterId: string;
|
|
32
|
-
branches?:
|
|
36
|
+
branches?: ChapterBranch[];
|
|
33
37
|
};
|
|
34
38
|
export type SetManifestContainerEventsArg = {
|
|
35
|
-
container:
|
|
36
|
-
branches:
|
|
39
|
+
container: ChapterContainer;
|
|
40
|
+
branches: ChapterBranch[];
|
|
37
41
|
isEOV?: boolean;
|
|
38
42
|
};
|
|
39
43
|
export type AnyAction = ControlEvent['action'] | ContainerEvent['action'] | ChapterEvent['action'];
|
|
@@ -42,7 +46,7 @@ export type ActionMap = {
|
|
|
42
46
|
container: ContainerEvent['action'];
|
|
43
47
|
chapter: ChapterEvent['action'];
|
|
44
48
|
};
|
|
45
|
-
export type SubjectType<T extends keyof ActionMap> = T extends 'control' ?
|
|
49
|
+
export type SubjectType<T extends keyof ActionMap> = T extends 'control' ? Control['type'] : undefined;
|
|
46
50
|
export type EventActionCommon<T extends keyof ActionMap> = {
|
|
47
51
|
subjectId: string;
|
|
48
52
|
subjectName: T;
|
|
@@ -53,19 +57,19 @@ export type EventActionCommonWithAction<T extends keyof ActionMap> = EventAction
|
|
|
53
57
|
};
|
|
54
58
|
export type OpenURIArg<T extends keyof ActionMap> = EventActionCommonWithAction<T> & {
|
|
55
59
|
payload: {
|
|
56
|
-
URI?: string
|
|
60
|
+
URI?: Nullable<string>;
|
|
57
61
|
};
|
|
58
62
|
};
|
|
59
63
|
export type ChangeManifestArg<T extends keyof ActionMap> = EventActionCommonWithAction<T> & {
|
|
60
64
|
payload: {
|
|
61
|
-
behaviour?:
|
|
65
|
+
behaviour?: Behaviour;
|
|
62
66
|
};
|
|
63
67
|
};
|
|
64
68
|
export type ChangeChapterArg<T extends keyof ActionMap> = EventActionCommonWithAction<T> & {
|
|
65
69
|
payload: {
|
|
66
70
|
chapterId: string;
|
|
67
71
|
autoSelect: boolean;
|
|
68
|
-
behaviour?:
|
|
72
|
+
behaviour?: Behaviour;
|
|
69
73
|
};
|
|
70
74
|
};
|
|
71
75
|
export type ContinuePlaybackArg<T extends keyof ActionMap> = EventActionCommonWithAction<T>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Subject } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import type { ChapterChangedData, EachTickData, PlayerChangedData } from '../../../modules/Interactives/types';
|
|
3
3
|
import type { CustomError } from '../../../utils/Error';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Manifest } from '../../../manifest';
|
|
5
|
+
import { TInteractiveRangeEndedEvent, TInteractivesActionChoiceEvent, TInteractivesActionExecutionEvent, TInteractivesContainerRemoved, SubjectName, TInteractivesVisibility } from './events.types';
|
|
5
6
|
export interface GlobalEvents {
|
|
6
7
|
noInteraction$: Subject<void>;
|
|
7
8
|
graphVisibilityChanged$: Subject<boolean>;
|
|
@@ -10,14 +11,22 @@ export interface GlobalEvents {
|
|
|
10
11
|
playerChanged$: Subject<PlayerChangedData>;
|
|
11
12
|
error$: Subject<CustomError>;
|
|
12
13
|
eachTick$: Subject<EachTickData>;
|
|
13
|
-
manifestChanged$: Subject<
|
|
14
|
+
manifestChanged$: Subject<Manifest>;
|
|
15
|
+
interactiveRangeEnded$: Subject<TInteractiveRangeEndedEvent>;
|
|
16
|
+
interactiveContainerRemoved$: Subject<TInteractivesContainerRemoved>;
|
|
17
|
+
interactiveActionExecution$: Subject<TInteractivesActionExecutionEvent<SubjectName>>;
|
|
18
|
+
interactiveActionChoice$: Subject<TInteractivesActionChoiceEvent<SubjectName>>;
|
|
19
|
+
interactiveVisibilityChanged$: Subject<TInteractivesVisibility<'container'>>;
|
|
14
20
|
}
|
|
15
21
|
export declare const EVENT_NAMES: {
|
|
16
22
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
* @deprecated Используйте interactivesInstance.events.graphVisibilityChanged$
|
|
24
|
+
* & interactivesInstance.events.watchAgainIsClicked$
|
|
25
|
+
*/
|
|
20
26
|
readonly graph: "graph";
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Используйте interactivesInstance.events
|
|
29
|
+
*/
|
|
21
30
|
readonly interactives: "interactives";
|
|
22
31
|
/**
|
|
23
32
|
* @deprecated Используйте interactivesInstance.events.chapterChanged$
|
|
@@ -31,19 +40,25 @@ export declare const EVENT_NAMES: {
|
|
|
31
40
|
* @deprecated Используйте interactivesInstance.events.manifestChanged$
|
|
32
41
|
*/
|
|
33
42
|
readonly manifestChanged: "manifest-changed";
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Используйте interactivesInstance.events.error$
|
|
45
|
+
*/
|
|
34
46
|
readonly errors: "errors";
|
|
35
47
|
readonly eachTick: "eachTick";
|
|
36
48
|
readonly historyInited: "history-inited";
|
|
37
49
|
readonly historyDestroyed: "history-destroyed";
|
|
38
50
|
};
|
|
39
51
|
/**
|
|
40
|
-
* @deprecated Используйте interactivesInstance.events.graphVisibilityChanged$ &
|
|
41
|
-
* interactivesInstance.events.watchAgainIsClicked$
|
|
42
|
-
*/
|
|
52
|
+
* @deprecated Используйте interactivesInstance.events.graphVisibilityChanged$ &
|
|
53
|
+
* interactivesInstance.events.watchAgainIsClicked$
|
|
54
|
+
*/
|
|
43
55
|
export declare const graphEventTypes: {
|
|
44
56
|
readonly visibility: "visibility";
|
|
45
57
|
readonly watchAgainClicked: "watchAgainClicked";
|
|
46
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated use InteractivesEventTypes enum instead
|
|
61
|
+
*/
|
|
47
62
|
export declare const interactivesEventTypes: {
|
|
48
63
|
readonly actionChoiceCanceled: "action-choice-canceled";
|
|
49
64
|
readonly actionChoice: "action-choice";
|
|
@@ -52,3 +67,11 @@ export declare const interactivesEventTypes: {
|
|
|
52
67
|
readonly containerRemoved: "container-removed";
|
|
53
68
|
readonly rangeEnded: "range-ended";
|
|
54
69
|
};
|
|
70
|
+
export declare enum InteractivesEventTypes {
|
|
71
|
+
ACTION_CHOICE_CANCELED = "action-choice-canceled",
|
|
72
|
+
ACTION_CHOICE = "action-choice",
|
|
73
|
+
ACTION_EXECUTION = "action-execution",
|
|
74
|
+
VISIBILITY = "visibility",
|
|
75
|
+
CONTAINER_REMOVED = "container-removed",
|
|
76
|
+
RANGE_ENDED = "range-ended"
|
|
77
|
+
}
|
|
@@ -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>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ChapterBranch } from '../../../manifest';
|
|
2
2
|
/**
|
|
3
3
|
* Returns a random number in the range [0, limit) or [limit, 0) if the 'limit'
|
|
4
4
|
* value is negative
|
|
@@ -7,17 +7,17 @@ export declare const getRandomNumber: (limit: number) => number;
|
|
|
7
7
|
/**
|
|
8
8
|
* Finds the value with minimal weight number
|
|
9
9
|
*/
|
|
10
|
-
export declare const minFallbackStrategy: (branches:
|
|
10
|
+
export declare const minFallbackStrategy: (branches: ChapterBranch[]) => Nullable<ChapterBranch>;
|
|
11
11
|
/**
|
|
12
12
|
* Finds the value with maximal weight number
|
|
13
13
|
*/
|
|
14
|
-
export declare const maxFallbackStrategy: (branches:
|
|
14
|
+
export declare const maxFallbackStrategy: (branches: ChapterBranch[]) => Nullable<ChapterBranch>;
|
|
15
15
|
/**
|
|
16
16
|
* Finds first branch with `isDefault === true` value
|
|
17
17
|
*/
|
|
18
|
-
export declare const defaultFallbackStrategy: (branches:
|
|
18
|
+
export declare const defaultFallbackStrategy: (branches: ChapterBranch[]) => ChapterBranch | undefined;
|
|
19
19
|
/**
|
|
20
20
|
* Returns the random branch
|
|
21
21
|
*/
|
|
22
|
-
export declare const weightlessRandomFallbackStrategy: (branches:
|
|
23
|
-
export declare const weightyRandomFallbackStrategy: (branches:
|
|
22
|
+
export declare const weightlessRandomFallbackStrategy: (branches: ChapterBranch[]) => ChapterBranch;
|
|
23
|
+
export declare const weightyRandomFallbackStrategy: (branches: ChapterBranch[]) => ChapterBranch;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Control, type Chapter, type ChapterContainer } from '../../../manifest';
|
|
2
2
|
import type { GameController } from './GameController';
|
|
3
3
|
export declare enum GameStates {
|
|
4
4
|
nothing = 0,
|
|
@@ -9,20 +9,20 @@ export declare enum GameStates {
|
|
|
9
9
|
removed = 5,
|
|
10
10
|
destroyed = 6
|
|
11
11
|
}
|
|
12
|
-
export declare const isControlsExist: (controls:
|
|
13
|
-
export declare const isLastChapter: (chapter:
|
|
14
|
-
export declare const hasEndTemplate: (chapter:
|
|
15
|
-
export declare const isBeforeStartTime: (currentTime: number, container:
|
|
16
|
-
export declare const isInteractiveTime: (currentTime: number, container:
|
|
17
|
-
export declare const isAfterInteractiveTime: (currentTime: number, container:
|
|
18
|
-
type AnyEvent =
|
|
12
|
+
export declare const isControlsExist: (controls: Control[]) => boolean;
|
|
13
|
+
export declare const isLastChapter: (chapter: Chapter) => boolean;
|
|
14
|
+
export declare const hasEndTemplate: (chapter: Chapter) => boolean;
|
|
15
|
+
export declare const isBeforeStartTime: (currentTime: number, container: ChapterContainer) => boolean;
|
|
16
|
+
export declare const isInteractiveTime: (currentTime: number, container: ChapterContainer) => boolean;
|
|
17
|
+
export declare const isAfterInteractiveTime: (currentTime: number, container: ChapterContainer) => boolean;
|
|
18
|
+
type AnyEvent = (ChapterContainer | Chapter | Control)['events'];
|
|
19
19
|
export declare const isExpectEvent: (events?: AnyEvent) => boolean;
|
|
20
|
-
export declare const getExpectEvent: (events?: AnyEvent) => import("../../../
|
|
21
|
-
export declare const isOneCtrlOneContainer: (controls:
|
|
22
|
-
export declare const isOneTextCtrlContainer: (controls:
|
|
23
|
-
export declare function excludeTextControl(containers?:
|
|
24
|
-
export declare const isEOVEndTime: (target: HTMLVideoElement, endTime:
|
|
20
|
+
export declare const getExpectEvent: (events?: AnyEvent) => import("../../../manifest").ControlEvent | import("../../../manifest").ChapterEvent | import("../../../manifest").ContainerEvent | undefined;
|
|
21
|
+
export declare const isOneCtrlOneContainer: (controls: Control[]) => boolean;
|
|
22
|
+
export declare const isOneTextCtrlContainer: (controls: Control[]) => boolean;
|
|
23
|
+
export declare function excludeTextControl(containers?: ChapterContainer[]): ChapterContainer[];
|
|
24
|
+
export declare const isEOVEndTime: (target: HTMLVideoElement, endTime: ChapterContainer["endTime"]) => boolean;
|
|
25
25
|
export declare function partial<T extends unknown[], U extends unknown[], R>(fn: (...args: [...T, ...U]) => R, ...presetArgs: T): (...laterArgs: U) => R;
|
|
26
26
|
export declare function partial<T extends Record<string, unknown>, P extends Partial<T>>(fn: (args: T) => unknown, presetArgs: P): (laterArgs: Omit<T, keyof P>) => ReturnType<typeof fn>;
|
|
27
|
-
export declare const shouldIgnoreContainerEvent: (container:
|
|
27
|
+
export declare const shouldIgnoreContainerEvent: (container: ChapterContainer, gameControllers: GameController[]) => boolean;
|
|
28
28
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Control } from '../../../manifest';
|
|
2
2
|
import { type Dimensions } from '../../../modules/Interactives/controls';
|
|
3
3
|
export declare const classnamesPrefix = "interactive";
|
|
4
4
|
export declare const rootElClassName = "interactive-controls-container";
|
|
@@ -33,27 +33,29 @@ export declare enum TEXT_ALIGN {
|
|
|
33
33
|
end = "right",
|
|
34
34
|
center = "center"
|
|
35
35
|
}
|
|
36
|
-
type SetTextPositionStylesProps = {
|
|
36
|
+
export type SetTextPositionStylesProps = {
|
|
37
37
|
target: HTMLElement;
|
|
38
|
-
props:
|
|
38
|
+
props: Control['props']['text'] & {
|
|
39
|
+
alignment: Control['layoutParams']['alignment'];
|
|
40
|
+
};
|
|
39
41
|
};
|
|
40
42
|
export declare const setTextPositionStyles: ({ target, props }: SetTextPositionStylesProps) => void;
|
|
41
43
|
type SetTextStylesProps = {
|
|
42
44
|
target: HTMLElement;
|
|
43
|
-
props:
|
|
45
|
+
props: Control['props'];
|
|
44
46
|
fallback: ControlStylesFallbacks;
|
|
45
47
|
dependsOn: Dimensions;
|
|
46
48
|
};
|
|
47
49
|
export declare const setTextStyles: ({ target, props, fallback, dependsOn }: SetTextStylesProps) => void;
|
|
48
50
|
type SetBackgroundStylesProps = {
|
|
49
51
|
target: HTMLElement;
|
|
50
|
-
props:
|
|
52
|
+
props: Control['props'];
|
|
51
53
|
fallback: ControlStylesFallbacks;
|
|
52
54
|
};
|
|
53
55
|
export declare const setBackgroundStyles: ({ target, props, fallback }: SetBackgroundStylesProps) => void;
|
|
54
56
|
type SetBorderStylesProps = {
|
|
55
57
|
target: HTMLElement;
|
|
56
|
-
props:
|
|
58
|
+
props: Control['props'];
|
|
57
59
|
fallback: ControlStylesFallbacks;
|
|
58
60
|
dependsOn: Dimensions;
|
|
59
61
|
};
|
|
@@ -61,7 +63,7 @@ export declare const setBorderStyles: ({ target, props, fallback, dependsOn }: S
|
|
|
61
63
|
type SetAngleProps = {
|
|
62
64
|
target: HTMLElement;
|
|
63
65
|
fallback: ControlStylesFallbacks;
|
|
64
|
-
layoutParams:
|
|
66
|
+
layoutParams: Control['layoutParams'];
|
|
65
67
|
};
|
|
66
68
|
export declare const setAngle: ({ target, layoutParams, fallback }: SetAngleProps) => void;
|
|
67
69
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ManifestVideo, ManifestVideoVariant } from '../../../
|
|
2
|
-
export type {
|
|
1
|
+
import type { ManifestVideo, ManifestVideoVariant } from '../../../manifest';
|
|
2
|
+
export type { Extension, Standard } from '../../../manifest';
|
|
3
3
|
export interface GetVKVideoParams {
|
|
4
4
|
access_token: string;
|
|
5
5
|
owner_id?: number;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ManifestVideoVariant } from '../../../movika.core/manifest';
|
|
2
1
|
import type { FullRequestParams, VideoVideoImage } from './types';
|
|
3
2
|
export declare function createRequestURL({ baseURL, requestParams }: FullRequestParams): string;
|
|
4
3
|
export declare function findMaxResolutionFrame(frames?: VideoVideoImage[]): VideoVideoImage | undefined;
|
|
5
|
-
export declare function isVKVariantItem(variantItem: ManifestVideoVariant): boolean;
|