@vkontakte/videoplayer-interactive 1.0.61 → 1.0.62-dev.04ce2cd1.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 +8 -7
- package/es2015.esm.js +8 -7
- package/es2018.cjs +8 -7
- package/es2018.esm.js +8 -7
- package/es2024.cjs +8 -7
- package/es2024.esm.js +8 -7
- package/esnext.cjs +8 -7
- package/esnext.esm.js +8 -7
- package/evergreen.esm.js +8 -7
- package/package.json +4 -4
- package/types/index.d.ts +9 -8
- package/types/manifest/index.d.ts +3 -3
- package/types/manifest/utils.d.ts +33 -32
- package/types/modules/Graph/Graph.d.ts +47 -46
- package/types/modules/Graph/index.d.ts +1 -1
- package/types/modules/Interactives/Interactives.d.ts +138 -135
- package/types/modules/Interactives/Layout.d.ts +11 -11
- package/types/modules/Interactives/containers/ChoiceContainer.d.ts +31 -31
- package/types/modules/Interactives/containers/Container.d.ts +19 -19
- package/types/modules/Interactives/containers/index.d.ts +4 -4
- package/types/modules/Interactives/containers/types.d.ts +6 -6
- package/types/modules/Interactives/containers/utils.d.ts +3 -3
- package/types/modules/Interactives/controls/AreaControl.d.ts +17 -16
- package/types/modules/Interactives/controls/ButtonControl.d.ts +21 -20
- package/types/modules/Interactives/controls/Control.d.ts +42 -41
- package/types/modules/Interactives/controls/TextControl.d.ts +14 -13
- package/types/modules/Interactives/controls/index.d.ts +6 -6
- package/types/modules/Interactives/controls/types.d.ts +22 -19
- package/types/modules/Interactives/controls/utils.d.ts +10 -10
- package/types/modules/Interactives/index.d.ts +14 -95
- package/types/modules/Interactives/styles/index.d.ts +1 -1
- package/types/modules/Interactives/types.d.ts +64 -64
- package/types/modules/Interactives/utils/BlinkAnimationRef.d.ts +10 -10
- package/types/modules/Interactives/utils/ControlFillAnimation/ControlFillAnimation.d.ts +30 -30
- package/types/modules/Interactives/utils/ControlFillAnimation/index.d.ts +1 -1
- package/types/modules/Interactives/utils/ControlFillAnimation/utils.d.ts +9 -9
- package/types/modules/Interactives/utils/ControlTap/ControlTap.d.ts +12 -12
- package/types/modules/Interactives/utils/ControlTap/index.d.ts +1 -1
- package/types/modules/Interactives/utils/ControlTap/utils.d.ts +3 -3
- package/types/modules/Interactives/utils/GameController.d.ts +66 -66
- package/types/modules/Interactives/utils/GroupsStack.d.ts +18 -20
- package/types/modules/Interactives/utils/HistoryController.d.ts +39 -40
- package/types/modules/Interactives/utils/InteractiveEvents.d.ts +30 -29
- package/types/modules/Interactives/utils/ResizeManager.d.ts +10 -10
- package/types/modules/Interactives/utils/SelectBranches.d.ts +15 -15
- package/types/modules/Interactives/utils/SelectBranches.types.d.ts +53 -53
- package/types/modules/Interactives/utils/angleUtils.d.ts +13 -13
- package/types/modules/Interactives/utils/createControlText.d.ts +2 -2
- package/types/modules/Interactives/utils/emitOnError.d.ts +10 -10
- package/types/modules/Interactives/utils/events.d.ts +67 -67
- package/types/modules/Interactives/utils/events.types.d.ts +35 -32
- package/types/modules/Interactives/utils/fallbackStrategies.d.ts +15 -14
- package/types/modules/Interactives/utils/functionUtils.d.ts +9 -2
- package/types/modules/Interactives/utils/gameUtils.d.ts +22 -21
- package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +5 -5
- package/types/modules/Interactives/utils/renderingUtils.d.ts +48 -53
- package/types/modules/Loaders/index.d.ts +1 -1
- package/types/modules/Loaders/movikaProjectIdLoader/index.d.ts +1 -1
- package/types/modules/Loaders/vkVideoLoader/CustomVkVideoLoader.d.ts +8 -8
- package/types/modules/Loaders/vkVideoLoader/index.d.ts +1 -1
- package/types/modules/Loaders/vkVideoLoader/types.d.ts +231 -231
- package/types/modules/Loaders/vkVideoLoader/utils.d.ts +1 -1
- package/types/modules/ManifestController/Loadable.d.ts +5 -5
- package/types/modules/ManifestController/ManifestController.d.ts +29 -29
- package/types/modules/ManifestController/index.d.ts +1 -1
- package/types/modules/ManifestController/utils.d.ts +6 -6
- package/types/modules/SeamlessController/InstanceManager.d.ts +10 -10
- package/types/modules/SeamlessController/SeamlessController.d.ts +30 -27
- package/types/modules/SeamlessController/utils.d.ts +6 -6
- package/types/modules/SeekToInteractiveController/SeekToInteractiveController.d.ts +8 -8
- package/types/modules/SeekToInteractiveController/index.d.ts +1 -1
- package/types/types/CustomError.d.ts +9 -9
- package/types/types/index.d.ts +2 -2
- package/types/utils/CssVarsManager.d.ts +21 -21
- package/types/utils/Error.d.ts +6 -6
- package/types/utils/EventEmitter.d.ts +10 -10
- package/types/utils/LastFrame.d.ts +29 -29
- package/types/utils/LastFrameCanvasAPI.d.ts +17 -17
- package/types/utils/MultiMap.d.ts +8 -8
- package/types/utils/Raf.d.ts +11 -11
- package/types/utils/chapterHelpers.d.ts +1 -1
- package/types/utils/compareVersions.d.ts +12 -12
- package/types/utils/extractVkMovieId.d.ts +1 -1
- package/types/utils/getVideoContentSize.d.ts +3 -3
- package/types/utils/hexToRgb.d.ts +2 -2
- package/types/utils/throttle.d.ts +1 -1
- package/types/utils/typeCheck.d.ts +7 -7
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import type { ChapterContainer, Control, ChapterBranch, ControlEvent, ContainerEvent, ChapterEvent } from
|
|
2
|
-
import type { EventEmitter } from
|
|
3
|
-
import type { IPlayer } from
|
|
4
|
-
import type { InteractiveEventsType } from
|
|
5
|
-
import type { GlobalEvents } from
|
|
6
|
-
import { Nullable } from
|
|
7
|
-
export type SubjectName =
|
|
8
|
-
export type AfterExpectActionType =
|
|
9
|
-
export type Behaviour =
|
|
10
|
-
export type ControlAfterExpectCallbackType = () => ExpectEventHandlerArg<
|
|
1
|
+
import type { ChapterContainer, Control, ChapterBranch, ControlEvent, ContainerEvent, ChapterEvent } from "../../../manifest";
|
|
2
|
+
import type { EventEmitter } from "../../../utils/EventEmitter";
|
|
3
|
+
import type { IPlayer } from "@vkontakte/videoplayer-core";
|
|
4
|
+
import type { InteractiveEventsType } from "./InteractiveEvents";
|
|
5
|
+
import type { GlobalEvents } from "./events";
|
|
6
|
+
import type { Nullable } from "@vkontakte/videoplayer-shared";
|
|
7
|
+
export type SubjectName = "chapter" | "container" | "control";
|
|
8
|
+
export type AfterExpectActionType = "after-expect";
|
|
9
|
+
export type Behaviour = "change-chapter" | "change-manifest";
|
|
10
|
+
export type ControlAfterExpectCallbackType = () => ExpectEventHandlerArg<"control">;
|
|
11
11
|
export type SelectBranchesArg = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
globalEventEmitter: EventEmitter;
|
|
13
|
+
globalEvents: GlobalEvents;
|
|
14
|
+
player: IPlayer;
|
|
15
|
+
interactiveEvents: InteractiveEventsType;
|
|
16
16
|
};
|
|
17
17
|
export type OnControlEventArg = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
action: ControlEvent["action"];
|
|
19
|
+
controlType: Control["type"];
|
|
20
|
+
controlId: Control["id"];
|
|
21
|
+
containerId: ChapterContainer["id"];
|
|
22
|
+
onEvent: AnyFn;
|
|
23
|
+
branches?: ChapterBranch[];
|
|
24
|
+
isEOV?: () => boolean;
|
|
25
|
+
isDisabled?: () => boolean;
|
|
26
26
|
};
|
|
27
27
|
export type OnContainerEventArg = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
action: ContainerEvent["action"];
|
|
29
|
+
container: ChapterContainer;
|
|
30
|
+
autoSelected?: boolean;
|
|
31
|
+
branches?: ChapterBranch[];
|
|
32
|
+
isEOV?: boolean;
|
|
33
33
|
};
|
|
34
34
|
export type OnChapterEventArg = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
action: ChapterEvent["action"];
|
|
36
|
+
chapterId: string;
|
|
37
|
+
branches?: ChapterBranch[];
|
|
38
38
|
};
|
|
39
39
|
export type SetManifestContainerEventsArg = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
container: ChapterContainer;
|
|
41
|
+
branches: ChapterBranch[];
|
|
42
|
+
isEOV?: boolean;
|
|
43
43
|
};
|
|
44
|
-
export type AnyAction = ControlEvent[
|
|
44
|
+
export type AnyAction = ControlEvent["action"] | ContainerEvent["action"] | ChapterEvent["action"];
|
|
45
45
|
export type ActionMap = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
control: ControlEvent["action"];
|
|
47
|
+
container: ContainerEvent["action"];
|
|
48
|
+
chapter: ChapterEvent["action"];
|
|
49
49
|
};
|
|
50
|
-
export type SubjectType<T extends keyof ActionMap> = T extends
|
|
50
|
+
export type SubjectType<T extends keyof ActionMap> = T extends "control" ? Control["type"] : undefined;
|
|
51
51
|
export type EventActionCommon<T extends keyof ActionMap> = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
subjectId: string;
|
|
53
|
+
subjectName: T;
|
|
54
|
+
subjectType?: SubjectType<T>;
|
|
55
55
|
};
|
|
56
56
|
export type EventActionCommonWithAction<T extends keyof ActionMap> = EventActionCommon<T> & {
|
|
57
|
-
|
|
57
|
+
action: ActionMap[T];
|
|
58
58
|
};
|
|
59
59
|
export type OpenURIArg<T extends keyof ActionMap> = EventActionCommonWithAction<T> & {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
payload: {
|
|
61
|
+
URI?: Nullable<string>;
|
|
62
|
+
};
|
|
63
63
|
};
|
|
64
64
|
export type ChangeManifestArg<T extends keyof ActionMap> = EventActionCommonWithAction<T> & {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
payload: {
|
|
66
|
+
behaviour?: Behaviour;
|
|
67
|
+
};
|
|
68
68
|
};
|
|
69
69
|
export type ChangeChapterArg<T extends keyof ActionMap> = EventActionCommonWithAction<T> & {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
payload: {
|
|
71
|
+
chapterId: string;
|
|
72
|
+
autoSelect: boolean;
|
|
73
|
+
behaviour?: Behaviour;
|
|
74
|
+
};
|
|
75
75
|
};
|
|
76
76
|
export type ContinuePlaybackArg<T extends keyof ActionMap> = EventActionCommonWithAction<T>;
|
|
77
77
|
export type OnExpectEventArg<T extends keyof ActionMap> = EventActionCommon<T>;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare function isPositiveXAxis(angle: number):
|
|
2
|
+
* use normalizeRadians before use
|
|
3
|
+
*/
|
|
4
|
+
export declare function isPositiveXAxis(angle: number): boolean;
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* use normalizeRadians before use
|
|
7
|
+
*/
|
|
8
8
|
export declare function isPositiveYAxis(angle: number): boolean;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* use normalizeRadians before use
|
|
11
|
+
*/
|
|
12
12
|
export declare function isNegativeXAxis(angle: number): boolean;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* use normalizeRadians before use
|
|
15
|
+
*/
|
|
16
16
|
export declare function isNegativeYAxis(angle: number): boolean;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* normalizes to [0, 2π)
|
|
19
|
+
*/
|
|
20
20
|
export declare function normalizeRadians(rad: number): number;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* use normalizeRadians before use
|
|
23
|
+
*/
|
|
24
24
|
export declare function getQuadrant(rad: number): number | null;
|
|
25
25
|
export declare function radiansToDegrees(rad: number): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyControl } from
|
|
2
|
-
type Type = Lowercase<AnyControl[
|
|
1
|
+
import type { AnyControl } from "../../../manifest";
|
|
2
|
+
type Type = Lowercase<AnyControl["type"]> | AnyControl["type"];
|
|
3
3
|
export declare const createControlText: (type: Type) => HTMLElement;
|
|
4
4
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ErrorCategoryEnum, ErrorSeverityEnum } from
|
|
2
|
-
import { CustomError } from
|
|
3
|
-
import { Subject } from
|
|
1
|
+
import { ErrorCategoryEnum, ErrorSeverityEnum } from "../../../types";
|
|
2
|
+
import { CustomError } from "../../../utils/Error";
|
|
3
|
+
import type { Subject } from "@vkontakte/videoplayer-shared";
|
|
4
4
|
type EmitOnErrorArg = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
emitter$: Subject<CustomError>;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
subjectId?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
severity?: ErrorSeverityEnum;
|
|
10
|
+
category?: ErrorCategoryEnum;
|
|
11
11
|
};
|
|
12
|
-
export declare function emitOnError({ emitter$, error, subjectId, message, severity, category
|
|
12
|
+
export declare function emitOnError({ emitter$, error, subjectId, message, severity, category }: EmitOnErrorArg): void;
|
|
13
13
|
export {};
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import type { Subject } from
|
|
2
|
-
import type { ChapterChangedData, EachTickData, PlayerChangedData } from
|
|
3
|
-
import type { CustomError } from
|
|
4
|
-
import type { Manifest } from
|
|
5
|
-
import { TInteractiveRangeEndedEvent, TInteractivesActionChoiceEvent, TInteractivesActionExecutionEvent, TInteractivesContainerRemoved, TInteractivesContainerFakeRemoved, SubjectName, TInteractivesVisibility } from
|
|
1
|
+
import type { Subject } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { ChapterChangedData, EachTickData, PlayerChangedData } from "../types";
|
|
3
|
+
import type { CustomError } from "../../../utils/Error";
|
|
4
|
+
import type { Manifest } from "../../../manifest";
|
|
5
|
+
import type { TInteractiveRangeEndedEvent, TInteractivesActionChoiceEvent, TInteractivesActionExecutionEvent, TInteractivesContainerRemoved, TInteractivesContainerFakeRemoved, SubjectName, TInteractivesVisibility } from "./events.types";
|
|
6
6
|
export interface GlobalEvents {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
noInteraction$: Subject<void>;
|
|
8
|
+
graphVisibilityChanged$: Subject<boolean>;
|
|
9
|
+
watchAgainIsClicked$: Subject<string>;
|
|
10
|
+
chapterChanged$: Subject<ChapterChangedData>;
|
|
11
|
+
playerChanged$: Subject<PlayerChangedData>;
|
|
12
|
+
error$: Subject<CustomError>;
|
|
13
|
+
eachTick$: Subject<EachTickData>;
|
|
14
|
+
manifestChanged$: Subject<Manifest>;
|
|
15
|
+
interactiveRangeEnded$: Subject<TInteractiveRangeEndedEvent>;
|
|
16
|
+
interactiveContainerRemoved$: Subject<TInteractivesContainerRemoved>;
|
|
17
|
+
interactiveContainerFakeRemoved$: Subject<TInteractivesContainerFakeRemoved>;
|
|
18
|
+
interactiveActionExecution$: Subject<TInteractivesActionExecutionEvent<SubjectName>>;
|
|
19
|
+
interactiveActionChoice$: Subject<TInteractivesActionChoiceEvent<SubjectName>>;
|
|
20
|
+
interactiveVisibilityChanged$: Subject<TInteractivesVisibility<"container">>;
|
|
21
21
|
}
|
|
22
22
|
export declare const EVENT_NAMES: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Используйте interactivesInstance.events.graphVisibilityChanged$
|
|
25
|
+
* & interactivesInstance.events.watchAgainIsClicked$
|
|
26
|
+
*/
|
|
27
|
+
readonly graph: "graph";
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Используйте interactivesInstance.events
|
|
30
|
+
*/
|
|
31
|
+
readonly interactives: "interactives";
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Используйте interactivesInstance.events.chapterChanged$
|
|
34
|
+
*/
|
|
35
|
+
readonly chapterChanged: "chapter-changed";
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Используйте interactivesInstance.events.playerChanged$
|
|
38
|
+
*/
|
|
39
|
+
readonly playerChanged: "player-changed";
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Используйте interactivesInstance.events.manifestChanged$
|
|
42
|
+
*/
|
|
43
|
+
readonly manifestChanged: "manifest-changed";
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Используйте interactivesInstance.events.error$
|
|
46
|
+
*/
|
|
47
|
+
readonly errors: "errors";
|
|
48
|
+
readonly eachTick: "eachTick";
|
|
49
|
+
readonly historyInited: "history-inited";
|
|
50
|
+
readonly historyDestroyed: "history-destroyed";
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
* @deprecated Используйте interactivesInstance.events.graphVisibilityChanged$ &
|
|
54
|
+
* interactivesInstance.events.watchAgainIsClicked$
|
|
55
|
+
*/
|
|
56
56
|
export declare const graphEventTypes: {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
readonly visibility: "visibility";
|
|
58
|
+
readonly watchAgainClicked: "watchAgainClicked";
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
* @deprecated use InteractivesEventTypes enum instead
|
|
62
|
+
*/
|
|
63
63
|
export declare const interactivesEventTypes: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
readonly actionChoiceCanceled: "action-choice-canceled";
|
|
65
|
+
readonly actionChoice: "action-choice";
|
|
66
|
+
readonly actionExecution: "action-execution";
|
|
67
|
+
readonly visibility: "visibility";
|
|
68
|
+
readonly containerRemoved: "container-removed";
|
|
69
|
+
readonly rangeEnded: "range-ended";
|
|
70
70
|
};
|
|
71
71
|
export declare enum InteractivesEventTypes {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
ACTION_CHOICE_CANCELED = "action-choice-canceled",
|
|
73
|
+
ACTION_CHOICE = "action-choice",
|
|
74
|
+
ACTION_EXECUTION = "action-execution",
|
|
75
|
+
VISIBILITY = "visibility",
|
|
76
|
+
CONTAINER_REMOVED = "container-removed",
|
|
77
|
+
CONTAINER_FAKE_REMOVED = "container-fake-removed",
|
|
78
|
+
RANGE_ENDED = "range-ended"
|
|
79
79
|
}
|
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
import type { SubjectName, ActionMap, SubjectType, AfterExpectActionType, Behaviour } from
|
|
2
|
-
import { InteractivesEventTypes } from
|
|
3
|
-
import { EventActionTypes } from
|
|
4
|
-
import type { ControlEvent, ContainerEvent, ChapterEvent, ChapterContainer, Control } from
|
|
5
|
-
import type { InteractiveRange } from
|
|
1
|
+
import type { SubjectName, ActionMap, SubjectType, AfterExpectActionType, Behaviour } from "./SelectBranches.types";
|
|
2
|
+
import type { InteractivesEventTypes } from "./events";
|
|
3
|
+
import type { EventActionTypes } from "../../../manifest";
|
|
4
|
+
import type { ControlEvent, ContainerEvent, ChapterEvent, ChapterContainer, Control } from "../../../manifest";
|
|
5
|
+
import type { InteractiveRange } from "./getInteractiveRanges";
|
|
6
6
|
export type { SubjectName };
|
|
7
7
|
type InteractivesEventTypesValues = `${InteractivesEventTypes}`;
|
|
8
8
|
type InteractivesEventTypesValuesChapter = InteractivesEventTypes.ACTION_CHOICE | InteractivesEventTypes.ACTION_CHOICE_CANCELED | InteractivesEventTypes.ACTION_EXECUTION;
|
|
9
9
|
type InteractivesEventTypesValuesContainer = InteractivesEventTypesValues;
|
|
10
10
|
type InteractivesEventTypesValuesControl = InteractivesEventTypesValuesChapter | InteractivesEventTypes.VISIBILITY;
|
|
11
|
-
type InteractiveEventType<T extends SubjectName> = T extends
|
|
12
|
-
type TInteractiveCommon<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
type InteractiveEventType<T extends SubjectName> = T extends "container" ? InteractivesEventTypesValuesContainer : InteractivesEventTypesValuesControl;
|
|
12
|
+
type TInteractiveCommon<
|
|
13
|
+
T extends SubjectName,
|
|
14
|
+
U extends InteractiveEventType<T>
|
|
15
|
+
> = {
|
|
16
|
+
subjectId: string;
|
|
17
|
+
subjectName: T;
|
|
18
|
+
type: U;
|
|
16
19
|
};
|
|
17
|
-
export type TInteractivesVisibility<T extends Exclude<SubjectName,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
export type TInteractivesVisibility<T extends Exclude<SubjectName, "chapter">> = TInteractiveCommon<T, InteractivesEventTypes.VISIBILITY> & {
|
|
21
|
+
visibility: boolean;
|
|
22
|
+
isFirst?: boolean;
|
|
20
23
|
};
|
|
21
24
|
type EventActionTypesValues = `${EventActionTypes}`;
|
|
22
25
|
export type TInteractiveRangeEndedEvent = {
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
type: InteractivesEventTypes.RANGE_ENDED;
|
|
27
|
+
payload: InteractiveRange;
|
|
25
28
|
};
|
|
26
29
|
type NonChapterChangeEvents = EventActionTypes.openURI | EventActionTypes.continuePlayback | EventActionTypes.expect;
|
|
27
30
|
type TInteractivesActionExecEventPayload<T extends EventActionTypesValues> = T extends Exclude<EventActionTypesValues, NonChapterChangeEvents> ? Partial<{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
chapterId: string;
|
|
32
|
+
autoSelect: boolean;
|
|
33
|
+
behaviour: Behaviour;
|
|
34
|
+
manifestURL: string;
|
|
32
35
|
}> : undefined;
|
|
33
36
|
export type TInteractivesActionExecutionEvent<T extends SubjectName> = TInteractiveCommon<T, InteractivesEventTypes.ACTION_EXECUTION> & {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
actionType: ActionMap[T]["type"] | AfterExpectActionType;
|
|
38
|
+
subjectType?: SubjectType<T>;
|
|
39
|
+
payload?: TInteractivesActionExecEventPayload<ActionMap[T]["type"]>;
|
|
37
40
|
};
|
|
38
41
|
type TControlPayloadExtra = {
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
containerId: string;
|
|
43
|
+
invokeImmediately: boolean;
|
|
41
44
|
};
|
|
42
|
-
type TInteractivesActionChoiceEventPayload<T extends SubjectName> = T extends
|
|
43
|
-
type TSubjectTypeValues<T extends SubjectName> = T extends
|
|
45
|
+
type TInteractivesActionChoiceEventPayload<T extends SubjectName> = T extends "chapter" ? ChapterEvent["action"]["args"] : T extends "container" ? ContainerEvent["action"]["args"] & Pick<TControlPayloadExtra, "invokeImmediately"> : ControlEvent["action"]["args"] & TControlPayloadExtra;
|
|
46
|
+
type TSubjectTypeValues<T extends SubjectName> = T extends "chapter" ? undefined : T extends "container" ? ChapterContainer["type"] : Control["type"];
|
|
44
47
|
export type TInteractivesActionChoiceEvent<T extends SubjectName> = TInteractiveCommon<T, InteractivesEventTypes.ACTION_CHOICE | InteractivesEventTypes.ACTION_CHOICE_CANCELED> & {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
subjectType?: TSubjectTypeValues<T>;
|
|
49
|
+
actionType: EventActionTypesValues;
|
|
50
|
+
payload: TInteractivesActionChoiceEventPayload<T>;
|
|
48
51
|
};
|
|
49
|
-
export type TInteractivesContainerRemoved = TInteractiveCommon<
|
|
50
|
-
export type TInteractivesContainerFakeRemoved = TInteractiveCommon<
|
|
51
|
-
|
|
52
|
+
export type TInteractivesContainerRemoved = TInteractiveCommon<"container", InteractivesEventTypes.CONTAINER_REMOVED>;
|
|
53
|
+
export type TInteractivesContainerFakeRemoved = TInteractiveCommon<"container", InteractivesEventTypes.CONTAINER_FAKE_REMOVED> & {
|
|
54
|
+
removeAllOpenURI: boolean;
|
|
52
55
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { type ChapterBranch } from
|
|
1
|
+
import { type ChapterBranch } from "../../../manifest";
|
|
2
|
+
import type { Nullable } from "@vkontakte/videoplayer-shared";
|
|
2
3
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
* Returns a random number in the range [0, limit) or [limit, 0) if the 'limit'
|
|
5
|
+
* value is negative
|
|
6
|
+
*/
|
|
6
7
|
export declare const getRandomNumber: (limit: number) => number;
|
|
7
8
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const minFallbackStrategy: (branches: ChapterBranch[]) => ChapterBranch
|
|
9
|
+
* Finds the value with minimal weight number
|
|
10
|
+
*/
|
|
11
|
+
export declare const minFallbackStrategy: (branches: ChapterBranch[]) => Nullable<ChapterBranch>;
|
|
11
12
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare const maxFallbackStrategy: (branches: ChapterBranch[]) => ChapterBranch
|
|
13
|
+
* Finds the value with maximal weight number
|
|
14
|
+
*/
|
|
15
|
+
export declare const maxFallbackStrategy: (branches: ChapterBranch[]) => Nullable<ChapterBranch>;
|
|
15
16
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
* Finds first branch with `isDefault === true` value
|
|
18
|
+
*/
|
|
18
19
|
export declare const defaultFallbackStrategy: (branches: ChapterBranch[]) => ChapterBranch | undefined;
|
|
19
20
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
* Returns the random branch
|
|
22
|
+
*/
|
|
22
23
|
export declare const weightlessRandomFallbackStrategy: (branches: ChapterBranch[]) => ChapterBranch;
|
|
23
24
|
export declare const weightyRandomFallbackStrategy: (branches: ChapterBranch[]) => ChapterBranch;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
type Reverse<T extends unknown[]> = T extends [infer First, ...infer Rest] ? [...Reverse<Rest>, First] : T;
|
|
2
2
|
export declare function reverseArgs<Fn extends AnyFn>(fn: Fn): (...args: Reverse<Parameters<Fn>>) => ReturnType<Fn>;
|
|
3
|
-
export declare function partial<
|
|
4
|
-
|
|
3
|
+
export declare function partial<
|
|
4
|
+
T extends unknown[],
|
|
5
|
+
U extends unknown[],
|
|
6
|
+
R
|
|
7
|
+
>(fn: (...args: [...T, ...U]) => R, ...presetArgs: T): (...laterArgs: U) => R;
|
|
8
|
+
export declare function partial<
|
|
9
|
+
T extends Record<string, unknown>,
|
|
10
|
+
P extends Partial<T>
|
|
11
|
+
>(fn: (args: T) => unknown, presetArgs: P): (laterArgs: Omit<T, keyof P>) => ReturnType<typeof fn>;
|
|
5
12
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type Control, type Chapter, type ChapterContainer } from
|
|
2
|
-
import type { GameController } from
|
|
3
|
-
import type { IgnoreExpectState } from
|
|
1
|
+
import { type Control, type Chapter, type ChapterContainer } from "../../../manifest";
|
|
2
|
+
import type { GameController } from "./GameController";
|
|
3
|
+
import type { IgnoreExpectState } from "../types";
|
|
4
4
|
export declare enum GameStates {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
nothing = 0,
|
|
6
|
+
beforeInteractive = 1,
|
|
7
|
+
interactive = 2,
|
|
8
|
+
afterInteractive = 3,
|
|
9
|
+
end = 4,
|
|
10
|
+
removed = 5,
|
|
11
|
+
destroyed = 6
|
|
12
12
|
}
|
|
13
13
|
export declare const isControlsExist: (controls: Control[]) => boolean;
|
|
14
14
|
export declare const isLastChapter: (chapter: Chapter) => boolean;
|
|
@@ -16,26 +16,27 @@ export declare const hasEndTemplate: (chapter: Chapter) => boolean;
|
|
|
16
16
|
export declare const isBeforeStartTime: (currentTime: number, container: ChapterContainer) => boolean;
|
|
17
17
|
export declare const isInteractiveTime: (currentTime: number, container: ChapterContainer) => boolean;
|
|
18
18
|
export declare const isAfterInteractiveTime: (currentTime: number, container: ChapterContainer) => boolean;
|
|
19
|
-
type AnyEvent = (ChapterContainer | Chapter | Control)[
|
|
19
|
+
type AnyEvent = (ChapterContainer | Chapter | Control)["events"];
|
|
20
|
+
type ExtractItemFromArray<T> = T extends (infer U)[] ? U : never;
|
|
20
21
|
export declare const isExpectEvent: (events?: AnyEvent) => boolean;
|
|
21
|
-
export declare const getExpectEvent: (events?: AnyEvent) =>
|
|
22
|
+
export declare const getExpectEvent: (events?: AnyEvent) => ExtractItemFromArray<AnyEvent> | undefined;
|
|
22
23
|
export declare const isOneCtrlOneContainer: (controls: Control[]) => boolean;
|
|
23
24
|
export declare const isOneTextCtrlContainer: (controls: Control[]) => boolean;
|
|
24
25
|
export declare function excludeTextControl(containers?: ChapterContainer[]): ChapterContainer[];
|
|
25
26
|
export declare const isEOVEndTime: (target: HTMLVideoElement, endTime: ChapterContainer["endTime"]) => boolean;
|
|
26
27
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
* @param {GameController[]} [gameControllers=[]] список контрллеров
|
|
29
|
+
* @param {(number | null | undefined)} [expectTime=Infinity] expectTime = endTime - какой expectTime мы ищем
|
|
30
|
+
* @param {string[]} [ignoreIds=[]] какие контейнеры игнорировать
|
|
31
|
+
*/
|
|
31
32
|
export declare function getGameControllerContainersWithExpect(gameControllers?: GameController[], expectTime?: number | null | undefined, ignoreIds?: string[]): GameController[];
|
|
32
33
|
type ExecForAllExpectContainersParamsType = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
gameControllers: GameController[];
|
|
35
|
+
subjectName: string;
|
|
36
|
+
subjectId: string;
|
|
37
|
+
execFn: (gameController: GameController) => void;
|
|
37
38
|
};
|
|
38
|
-
export declare function execForAllExpectContainers({ gameControllers, subjectName, subjectId, execFn
|
|
39
|
+
export declare function execForAllExpectContainers({ gameControllers, subjectName, subjectId, execFn }: ExecForAllExpectContainersParamsType): void;
|
|
39
40
|
export declare function isControlHasOpenURIEvent(control: Control): boolean;
|
|
40
41
|
export declare const evaluateContainerEventStatus: (container: ChapterContainer, gameControllers: GameController[]) => IgnoreExpectState;
|
|
41
42
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type Container } from
|
|
1
|
+
import { type Container } from "../../../manifest";
|
|
2
2
|
export type Subject = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
id: string;
|
|
4
|
+
isRemoved: boolean;
|
|
5
5
|
};
|
|
6
6
|
export type InteractiveRange = {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
subjects: Subject[];
|
|
8
|
+
range: [number, number];
|
|
9
9
|
};
|
|
10
10
|
export type InteractiveRanges = Array<InteractiveRange>;
|
|
11
11
|
export declare const getInteractiveRanges: (containers?: Container[]) => InteractiveRanges;
|