@vkontakte/videoplayer-interactive 1.0.19-dev.c3a364e7.0 → 1.0.19-dev.d432d6cd.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.
Files changed (65) hide show
  1. package/es2015.cjs.js +6 -6
  2. package/es2015.esm.js +6 -6
  3. package/es2018.cjs.js +6 -6
  4. package/es2018.esm.js +6 -6
  5. package/esnext.cjs.js +6 -6
  6. package/esnext.esm.js +6 -6
  7. package/evergreen.esm.js +6 -6
  8. package/package.json +5 -5
  9. package/types/index.d.ts +3 -4
  10. package/types/manifest/index.d.ts +3 -0
  11. package/types/manifest/utils.d.ts +11 -0
  12. package/types/modules/Graph/Graph.d.ts +16 -12
  13. package/types/modules/Interactives/Interactives.d.ts +99 -83
  14. package/types/modules/Interactives/Layout.d.ts +11 -7
  15. package/types/modules/Interactives/controls/AreaControl.d.ts +2 -11
  16. package/types/modules/Interactives/controls/ButtonControl.d.ts +2 -11
  17. package/types/modules/Interactives/controls/Control.d.ts +20 -12
  18. package/types/modules/Interactives/controls/TextControl.d.ts +2 -11
  19. package/types/modules/Interactives/controls/index.d.ts +4 -3
  20. package/types/modules/Interactives/controls/types.d.ts +24 -0
  21. package/types/modules/Interactives/index.d.ts +4 -4
  22. package/types/modules/Interactives/types.d.ts +38 -7
  23. package/types/modules/Interactives/utils/GameController.d.ts +35 -16
  24. package/types/modules/Interactives/utils/GroupsStack.d.ts +31 -21
  25. package/types/modules/Interactives/utils/HistoryController.d.ts +8 -8
  26. package/types/modules/Interactives/utils/InteractiveEvents.d.ts +16 -10
  27. package/types/modules/Interactives/utils/ResizeManager.d.ts +8 -1
  28. package/types/modules/Interactives/utils/SelectBranches.d.ts +15 -51
  29. package/types/modules/Interactives/utils/SelectBranches.types.d.ts +73 -0
  30. package/types/modules/Interactives/utils/events.d.ts +8 -0
  31. package/types/modules/Interactives/utils/fallbackStrategies.d.ts +23 -6
  32. package/types/modules/Interactives/utils/gameUtils.d.ts +28 -26
  33. package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +4 -4
  34. package/types/modules/Interactives/utils/renderingUtils.d.ts +64 -59
  35. package/types/modules/Loaders/vkVideoLoader/types.d.ts +2 -2
  36. package/types/modules/Loaders/vkVideoLoader/utils.d.ts +1 -1
  37. package/types/modules/ManifestController/Loadable.d.ts +4 -7
  38. package/types/modules/ManifestController/ManifestController.d.ts +11 -12
  39. package/types/modules/ManifestController/utils.d.ts +6 -6
  40. package/types/modules/SeamlessController/SeamlessController.d.ts +10 -12
  41. package/types/modules/SeamlessController/utils.d.ts +2 -2
  42. package/types/modules/SeekToInteractiveController/SeekToInteractiveController.d.ts +2 -2
  43. package/types/utils/EventManager.d.ts +3 -3
  44. package/types/utils/LastFrame.d.ts +1 -1
  45. package/types/utils/Raf.d.ts +1 -1
  46. package/types/utils/chapterHelpers.d.ts +1 -1
  47. package/types/utils/extractVkMovieId.d.ts +2 -2
  48. package/types/modules/Interactives/controls/constants.d.ts +0 -5
  49. package/types/movika.core/manifest/index.d.ts +0 -19
  50. package/types/movika.core/manifest/manifest_3_2/chapter.d.ts +0 -62
  51. package/types/movika.core/manifest/manifest_3_2/control.d.ts +0 -67
  52. package/types/movika.core/manifest/manifest_3_2/manifest.d.ts +0 -50
  53. package/types/movika.core/manifest/manifest_3_2/template.d.ts +0 -34
  54. package/types/movika.core/manifest/manifest_3_3/chapter.d.ts +0 -70
  55. package/types/movika.core/manifest/manifest_3_3/control.d.ts +0 -66
  56. package/types/movika.core/manifest/manifest_3_3/graph.d.ts +0 -73
  57. package/types/movika.core/manifest/manifest_3_3/manifest.d.ts +0 -52
  58. package/types/movika.core/manifest/manifest_3_3/template.d.ts +0 -34
  59. package/types/movika.core/manifest/migrations/index.d.ts +0 -1
  60. package/types/movika.core/manifest/migrations/migrateManifestToLatestVersion.d.ts +0 -1
  61. package/types/movika.core/manifest/migrations/migrate_from_3_0_to_3_1.d.ts +0 -21
  62. package/types/movika.core/manifest/migrations/migrate_from_3_1_to_3_2.d.ts +0 -2
  63. package/types/movika.core/manifest/migrations/migrate_from_3_2_to_3_3.d.ts +0 -8
  64. package/types/movika.core/manifest/types.d.ts +0 -29
  65. package/types/movika.core/manifest/utils.d.ts +0 -5
@@ -1,7 +1,41 @@
1
- export class Interactives {
2
- constructor(options: any);
1
+ import { Observable, Subject, ValueSubject } from '@vkontakte/videoplayer-shared';
2
+ import type { Chapter, Manifest, VideoInfo, AnyManifest } from '../../manifest';
3
+ import { type InteractiveRange } from './utils/getInteractiveRanges';
4
+ import type { IInteractiveOptions, IOptionalInteractiveOptions } from "./types";
5
+ import type { IPlayer } from "@vkontakte/videoplayer-core";
6
+ import { InstanceStatistics } from '../../modules/SeamlessController/InstanceManager';
7
+ declare enum INTERACTIVE_APP_STATES {
8
+ created = 0,
9
+ initiated = 1,
10
+ ready = 2,
11
+ destroyed = 3
12
+ }
13
+ export declare class Interactives {
14
+ private subscription;
15
+ private globalEventEmitter;
16
+ private animation;
17
+ private eventManager;
18
+ private seekToInteractiveController;
19
+ private endedRanges;
20
+ private gameControllers;
21
+ private rootElement;
22
+ private factories;
23
+ private isFirstChapterFetched;
24
+ private _options;
25
+ private manifestController;
26
+ private resizeManager;
27
+ private historyController;
28
+ private player;
29
+ private interactiveEvents;
30
+ private selectBranches;
31
+ private seamlessController;
32
+ private seamlessControllerSubs;
33
+ private graph;
34
+ private lastFrame;
35
+ private noInteractionTimeout;
36
+ appState: INTERACTIVE_APP_STATES;
3
37
  state: {
4
- prevChapter$: ValueSubject<null>;
38
+ prevChapter$: ValueSubject<Nullable<Chapter>>;
5
39
  isInitialChapter$: ValueSubject<boolean>;
6
40
  isFirstChapter$: ValueSubject<boolean>;
7
41
  isEndChapter$: ValueSubject<boolean>;
@@ -9,98 +43,80 @@ export class Interactives {
9
43
  calledByInteractive$: ValueSubject<boolean>;
10
44
  lastChapterChangeWasInitiatedByInteractive$: ValueSubject<boolean>;
11
45
  disabledControls$: ValueSubject<boolean>;
12
- interactiveRanges$: ValueSubject<never[]>;
46
+ interactiveRanges$: ValueSubject<InteractiveRange[]>;
13
47
  isInteractiveTime$: ValueSubject<boolean>;
14
- statistics$: ValueSubject<null>;
48
+ statistics$: ValueSubject<Nullable<InstanceStatistics>>;
49
+ isSeekable$: ValueSubject<boolean>;
15
50
  };
16
51
  events: {
17
- noInteraction$: Subject<any>;
52
+ noInteraction$: Subject<void>;
53
+ graphVisibilityChanged$: Subject<unknown>;
54
+ watchAgainIsClicked$: Subject<unknown>;
18
55
  };
19
- options: any;
20
- factories: Map<string, (container: any, rootElement: any) => import("./containers").ChoiceContainer | undefined>;
21
- rootElement: HTMLDivElement;
22
- isFirstChapterFetched: boolean;
23
- appState: 0;
24
- clearHistoryIfEnded: () => void;
25
- /**
26
- * Returns an object with observables used for sending statistics
27
- * @returns {any}
28
- */
29
- getStatEvents(): any;
30
- setPlayer(player: any): void;
31
- /**
32
- * Set new manifest
33
- *
34
- * @async
35
- * @param {Record<string, any> | string} manifest whose version is higher than 3
36
- * @returns {Promise<any>}
37
- */
38
- setManifest(manifest: Record<string, any> | string): Promise<any>;
39
- /**
40
- * @param {string[]} chapterIds
41
- */
42
- setVisitedChapters(chapterIds: string[]): void;
43
- /**
44
- * @typedef {Object} VideosInfo
45
- * @property {string} id
46
- * @property {string} cover
47
- * @property {string=} title
48
- */
49
- /**
50
- * @param {Array<VideosInfo>} videosInfo
51
- */
52
- updateGraphVideosInfo(videosInfo: Array<{
53
- id: string;
54
- cover: string;
55
- title?: string | undefined;
56
- }>): void;
57
- /**
58
- * Set new chapter
59
- *
60
- * @async
61
- * @param {{ chapterId?: string; pushToHistory?: boolean }}
62
- * @returns {Promise<any>}
63
- */
64
- setChapter({ chapterId, pushToHistory }?: {
56
+ constructor(options: IOptionalInteractiveOptions);
57
+ private clearHistoryIfEnded;
58
+ private initSubscriptions;
59
+ private initSeamless;
60
+ private handleSeamlessPlayerChanged;
61
+ private onPlaybackStarted;
62
+ private handlePositionChange;
63
+ private registerVideoEvents;
64
+ private removeControllers;
65
+ private setGameControllers;
66
+ private filterGameControllers;
67
+ private checkIfSeekable;
68
+ private updateLastEventInfo;
69
+ private pushChapterToHistory;
70
+ private completeInteractiveRange;
71
+ private clearNoInteractionTimeout;
72
+ private reset;
73
+ get options(): IInteractiveOptions;
74
+ init(): void;
75
+ setManifest(manifest: AnyManifest | string): Promise<Manifest | undefined>;
76
+ setPlayer(player: IPlayer): void;
77
+ setChapter({ chapterId, pushToHistory, playPrev }?: {
65
78
  chapterId?: string;
66
79
  pushToHistory?: boolean;
67
- }): Promise<any>;
80
+ playPrev?: boolean;
81
+ }): Promise<void>;
82
+ getStatEvents(): {
83
+ click$: Observable<unknown>;
84
+ nextMovie$: Observable<unknown>;
85
+ };
68
86
  toggleGraphView(show?: boolean): void;
69
- init(): void;
87
+ setVisitedChapters(chapterIds: string[]): void;
88
+ updateGraphVideosInfo(videosInfo: VideoInfo[]): void;
70
89
  deadEndCheck(): boolean;
71
90
  allControlsAreRemoved(): boolean;
72
- isEndedExpectation(): any;
91
+ isEndedExpectation(): boolean;
73
92
  playPrevChapter(): void;
74
- setDisabledControls(value: any): void;
75
- isSupport(manifest?: any): boolean;
93
+ setDisabledControls(value: boolean): void;
94
+ isSupport(manifest?: Nullable<Manifest>): boolean;
76
95
  getInitialVideoInfo(): {
77
- videoId: any;
78
- chapterId: any;
96
+ videoId: string | null;
97
+ chapterId: string;
79
98
  };
80
- getHistoryState(): any;
81
- getIsSeekable(): ValueSubject<boolean>;
82
- getInteractiveRanges(): import("./utils/getInteractiveRanges").ReduceAcc;
83
- /**
84
- * Description
85
- * @param {number|undefined} [offsetMs="3000"]
86
- * @returns {number | null}
87
- */
88
- getNextInteractiveStartTime(offsetMs?: number | undefined): number | null;
99
+ getHistoryState(): import("./utils/HistoryController").HistoryControllerState;
89
100
  /**
90
- * Description
91
- * @param {string} [chapterId]
92
- * @returns {any}
93
- */
94
- getChapterBranches(chapterId?: string | undefined): any;
95
- getCurrentChapter(): any;
96
- getCurrentManifest(): any;
97
- addFactory(type: any, factory: any): void;
98
- removeFactory(type: any): void;
99
- on(...args: any[]): this;
100
- off(...args: any[]): this;
101
- once(...args: any[]): this;
101
+ * @deprecated Используйте this.state.isSeekable$
102
+ */
103
+ getIsSeekable(): ValueSubject<boolean>;
104
+ getInteractiveRanges(): import("./utils/getInteractiveRanges").InteractiveRanges;
105
+ getNextInteractiveStartTime(offsetMs?: number): number | null;
106
+ getChapterBranches(chapterId?: string): {
107
+ chapter: Chapter;
108
+ graph: import("@interactiveplatform/movika-graph-editor").GraphEditChapter | import("@interactiveplatform/movika-graph-editor").GraphViewChapter | undefined;
109
+ media: import("@interactiveplatform/movika-graph-editor").ManifestVideo;
110
+ }[];
111
+ getCurrentChapter(): {
112
+ chapter: Nullable<Chapter>;
113
+ media: Nullable<import("@interactiveplatform/movika-graph-editor").ManifestVideo>;
114
+ graph: Nullable<import("@interactiveplatform/movika-graph-editor").GraphDesign>;
115
+ };
116
+ getCurrentManifest(): Nullable<Manifest>;
117
+ on(eventName: string, fn: Function): this;
118
+ off(eventName: string, fn: Function): this;
119
+ once(eventName: string, fn: Function): this;
102
120
  destroy(): void;
103
- #private;
104
121
  }
105
- import { ValueSubject } from '@vkontakte/videoplayer-shared';
106
- import { Subject } from '@vkontakte/videoplayer-shared';
122
+ export {};
@@ -1,9 +1,13 @@
1
- export class Layout {
2
- constructor(layout: any);
3
- layout: any;
1
+ import { ChapterContainer, ControlLayoutParams } from '../../manifest';
2
+ declare abstract class Layout {
3
+ layout: ChapterContainer['layout'];
4
+ protected constructor(layout: ChapterContainer['layout']);
5
+ abstract setContainerLayout(target: HTMLElement): void;
6
+ abstract setControlLayout(target: HTMLElement, layoutParams: ControlLayoutParams): void;
4
7
  }
5
- export function createRelativeLayout(layout: any): RelativeLayout | undefined;
6
- export class RelativeLayout extends Layout {
7
- setContainerLayout(target: any): void;
8
- setControlLayout(target: any, layoutParams: any): void;
8
+ export declare class RelativeLayout extends Layout {
9
+ constructor(layout: ChapterContainer['layout']);
10
+ setContainerLayout(target: HTMLElement): void;
11
+ setControlLayout(target: HTMLElement, layoutParams: ControlLayoutParams): void;
9
12
  }
13
+ export {};
@@ -1,11 +1,2 @@
1
- export function createAreaControl(control: any): AreaControl | undefined;
2
- export class AreaControl extends Control {
3
- createView({ parent, layoutFn }: {
4
- parent: any;
5
- layoutFn: any;
6
- }): HTMLDivElement;
7
- controlEl: HTMLButtonElement | undefined;
8
- disable(): void;
9
- enable(): void;
10
- }
11
- import { Control } from './Control';
1
+ import { type ControlCreator } from './types';
2
+ export declare const createAreaControl: ControlCreator;
@@ -1,11 +1,2 @@
1
- export function createButtonControl(control: any): ButtonControl | undefined;
2
- export class ButtonControl extends Control {
3
- createView({ parent, layoutFn }: {
4
- parent: any;
5
- layoutFn: any;
6
- }): HTMLDivElement;
7
- controlEl: HTMLButtonElement | undefined;
8
- disable(): void;
9
- enable(): void;
10
- }
11
- import { Control } from './Control';
1
+ import { type ControlCreator } from './types';
2
+ export declare const createButtonControl: ControlCreator;
@@ -1,13 +1,21 @@
1
- export class Control {
2
- constructor(control: any);
3
- control: any;
4
- createView(layoutFn: any): {
5
- controlContainerEl: HTMLDivElement;
6
- dependsOn: {
7
- height: string;
8
- width: string;
9
- };
10
- };
11
- setEvents(element: any, callback: any): void;
12
- getElement(): Element | null;
1
+ import type { ControlEventCallback, CreateViewParams, Dimensions, LayoutCallback, TControl } from './types';
2
+ type ControlContainer = {
3
+ element: HTMLElement;
4
+ dimensions: Dimensions;
5
+ };
6
+ export default abstract class Control {
7
+ control: TControl;
8
+ protected container: Nullable<ControlContainer>;
9
+ protected controlElement: Nullable<HTMLElement>;
10
+ private clickListener;
11
+ protected constructor(control: TControl);
12
+ abstract createView(params: CreateViewParams): void;
13
+ abstract getElement(): Nullable<HTMLElement>;
14
+ abstract disable(): void;
15
+ abstract enable(): void;
16
+ protected createContainerElement(layoutCallback: LayoutCallback): void;
17
+ private createClickListener;
18
+ setEvents(callback: ControlEventCallback): void;
19
+ removeListeners(): void;
13
20
  }
21
+ export {};
@@ -1,11 +1,2 @@
1
- export function createTextControl(control: any): TextControl | undefined;
2
- export class TextControl extends Control {
3
- createView({ parent, layoutFn }: {
4
- parent: any;
5
- layoutFn: any;
6
- }): HTMLDivElement;
7
- controlEl: HTMLDivElement | undefined;
8
- disable(): void;
9
- enable(): void;
10
- }
11
- import { Control } from './Control';
1
+ import { type ControlCreator } from './types';
2
+ export declare const createTextControl: ControlCreator;
@@ -1,3 +1,4 @@
1
- export * from "./AreaControl";
2
- export * from "./ButtonControl";
3
- export * from "./Control";
1
+ export * from './AreaControl.js';
2
+ export * from './ButtonControl.js';
3
+ export * from './Control';
4
+ export * from './types';
@@ -0,0 +1,24 @@
1
+ import type { Control as TControl, ControlEvent, ControlLayoutParams } from '../../../manifest';
2
+ import Control from '../../../modules/Interactives/controls/Control';
3
+ export { TControl };
4
+ export declare enum CONTROLLER_IDS {
5
+ AREA = "int_area",
6
+ TEXT = "int_text",
7
+ BUTTON = "int_bttn"
8
+ }
9
+ export type Dimensions = {
10
+ width: string;
11
+ height: string;
12
+ };
13
+ export type LayoutCallback = (element: HTMLElement, controlLayoutParams: ControlLayoutParams) => void;
14
+ export type CreateViewParams = {
15
+ parentElement: HTMLElement;
16
+ layoutCallback: LayoutCallback;
17
+ };
18
+ type ControlEventCallbackParams = {
19
+ action: ControlEvent['action'];
20
+ controlId: string;
21
+ controlType: TControl['type'];
22
+ };
23
+ export type ControlEventCallback = (params: ControlEventCallbackParams) => void;
24
+ export type ControlCreator = (control: TControl) => Control | undefined;
@@ -1,14 +1,14 @@
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 { InteractiveRange, VideoInfo } from './types';
4
+ export type { InteractiveProjectInfo } from './types';
5
5
  export { isLastChapter, hasEndTemplate } from './utils/gameUtils';
6
+ export type { InteractiveRange } from './utils/getInteractiveRanges';
6
7
  export declare const utils: {
7
8
  Container: typeof Container;
8
9
  createChoiceContainer: (container: any, rootElement: any) => import("./containers/ChoiceContainer").ChoiceContainer | undefined;
9
- createAreaControl: (control: any) => import("./controls/AreaControl").AreaControl | undefined;
10
- createButtonControl: (control: any) => import("./controls/ButtonControl").ButtonControl | undefined;
11
- createRelativeLayout: (layout: any) => import("./Layout").RelativeLayout | undefined;
10
+ createAreaControl: import("./controls").ControlCreator;
11
+ createButtonControl: import("./controls").ControlCreator;
12
12
  getRootEl: () => Element | null;
13
13
  classnamesPrefix: string;
14
14
  };
@@ -1,9 +1,40 @@
1
- export type InteractiveRange = {
2
- range: [number, number];
3
- subjects: string[];
4
- };
5
- export type VideoInfo = {
6
- id: string;
7
- cover: string;
1
+ import type { InterfaceLanguage } from '@vkontakte/videoplayer-shared';
2
+ import type { IOptionalTuningConfig } from '@vkontakte/videoplayer-core';
3
+ import type { IOneStat } from '@vkontakte/videoplayer-statistics';
4
+ import type { Loaders } from '../../modules/ManifestController/Loadable';
5
+ import type { HistoryApi, HistorySettings } from '../../modules/Interactives/utils/HistoryController';
6
+ export type InteractiveProjectInfo = {
7
+ videoId: string;
8
+ pid?: string;
8
9
  title?: string;
10
+ variantPayloadType?: string;
11
+ };
12
+ export type RequiredOptions = 'parentElement' | 'fullscreenTargetElement';
13
+ export type IOptionalInteractiveOptions = Partial<Omit<IInteractiveOptions, RequiredOptions | 'config'>> & Required<Pick<IInteractiveOptions, RequiredOptions>> & {
14
+ config?: Partial<IInteractiveOptions['config']>;
9
15
  };
16
+ export interface IInteractiveOptions {
17
+ parentElement: HTMLElement;
18
+ fullscreenTargetElement: HTMLElement;
19
+ lang: InterfaceLanguage | string;
20
+ config: {
21
+ historyMaxLength: number;
22
+ noInteractionEventTimeout: number;
23
+ };
24
+ graph: boolean;
25
+ lastFrame: boolean;
26
+ initSeamless: boolean;
27
+ permanentTextControls: boolean;
28
+ loaders: Partial<Loaders>;
29
+ initChapterId?: string;
30
+ projectInfo?: InteractiveProjectInfo;
31
+ historyApi?: HistoryApi;
32
+ historySettings?: HistorySettings;
33
+ coreConfig?: IOptionalTuningConfig;
34
+ vkVideoLoader?: (owner_id: string, video_id: string) => unknown;
35
+ createOneStat?: (video: any, configOverwrite?: any) => IOneStat | undefined;
36
+ /**
37
+ * @deprecated
38
+ * */
39
+ disableControlsOnPause?: boolean;
40
+ }
@@ -1,4 +1,37 @@
1
- export class GameController {
1
+ import { type ISubscription, type IValueSubject } from '@vkontakte/videoplayer-shared';
2
+ import { type IPlayer } from '@vkontakte/videoplayer-core';
3
+ import type { InteractiveEventsType } from './InteractiveEvents';
4
+ import type { ChapterBranch, ChapterContainer } from '../../../manifest';
5
+ import type { EventEmitter } from '../../../utils/EventEmitter';
6
+ import { SelectBranches } from './SelectBranches';
7
+ import { GameStates } from './gameUtils';
8
+ type Container = {
9
+ container: ChapterContainer;
10
+ getElement: () => HTMLElement;
11
+ disable: () => void;
12
+ enable: () => void;
13
+ hide: () => void;
14
+ show: () => void;
15
+ createView: AnyFn;
16
+ removeView: () => void;
17
+ isDisabled: boolean;
18
+ isRemoved: boolean;
19
+ };
20
+ export declare class GameController {
21
+ container: Container;
22
+ branches: ChapterBranch[];
23
+ selectBranches: ReturnType<typeof SelectBranches>;
24
+ subscription: ISubscription;
25
+ player: IPlayer;
26
+ interactiveEvents: InteractiveEventsType;
27
+ ignoreContainerEvent: () => boolean;
28
+ isPermanentText: boolean;
29
+ disabledControls$: IValueSubject<boolean>;
30
+ onRemove: () => void;
31
+ globalEventEmitter: EventEmitter;
32
+ gameState: GameStates;
33
+ isSelectedControlEvent: boolean;
34
+ isSelectedContainerEvent: boolean;
2
35
  constructor({ player, container, branches, selectBranches, interactiveEvents, globalEventEmitter, ignoreContainerEvent, permanentTextControls, disabledControls$, onRemove, }: {
3
36
  player: any;
4
37
  container: any;
@@ -11,20 +44,6 @@ export class GameController {
11
44
  disabledControls$: any;
12
45
  onRemove: any;
13
46
  });
14
- container: any;
15
- branches: any;
16
- selectBranches: any;
17
- subscription: Subscription;
18
- player: any;
19
- interactiveEvents: any;
20
- ignoreContainerEvent: any;
21
- isPermanentText: any;
22
- disabledControls$: any;
23
- onRemove: any;
24
- globalEventEmitter: any;
25
- gameState: 0;
26
- isSelectedControlEvent: boolean;
27
- isSelectedContainerEvent: boolean;
28
47
  registerEvents(): void;
29
48
  hide: () => void;
30
49
  show: () => void;
@@ -38,4 +57,4 @@ export class GameController {
38
57
  removeView(): void;
39
58
  destroy(): void;
40
59
  }
41
- import { Subscription } from '@vkontakte/videoplayer-shared';
60
+ export {};
@@ -1,22 +1,32 @@
1
- export function GroupsStack(): {
2
- map: {};
3
- remove: ({ timestamp, priority, initiator }: {
4
- timestamp: any;
5
- priority: any;
6
- initiator: any;
7
- }) => boolean | undefined;
8
- add: ({ timestamp, priority, initiator, ...rest }: {
9
- [x: string]: any;
10
- timestamp: any;
11
- priority: any;
12
- initiator: any;
13
- }) => void;
14
- removeAll: () => boolean;
15
- get: ({ timestamp, priority, initiator }: {
16
- timestamp: any;
17
- priority: any;
18
- initiator: any;
19
- }) => any;
20
- getLte: (timestamp: any) => {};
21
- getGte: (timestamp: any) => {};
1
+ import type { EventActionKeys } from '../../../manifest';
2
+ export type TPriority = 'chapter' | 'container' | 'control';
3
+ export type TPayload = {
4
+ actionType: EventActionKeys;
5
+ action: AnyFn;
22
6
  };
7
+ export type TMapInitiator = {
8
+ [initiator: string]: TPayload[];
9
+ };
10
+ type TMapPriority = {
11
+ [priority in TPriority]?: TMapInitiator;
12
+ };
13
+ type TMap = {
14
+ [timestamp: number]: TMapPriority;
15
+ };
16
+ export type TMapFlattened = {
17
+ timestamp: number;
18
+ priority: TPriority;
19
+ initiator: string;
20
+ } & TPayload;
21
+ type GetAndRemoveArgType = Partial<Omit<TMapFlattened, keyof TPayload>> & Pick<TMapFlattened, 'timestamp'>;
22
+ export type TGroupsStack = ReturnType<typeof GroupsStack>;
23
+ export declare function GroupsStack(): {
24
+ map: TMap;
25
+ remove: ({ timestamp, priority, initiator }: GetAndRemoveArgType) => boolean;
26
+ add: ({ timestamp, priority, initiator, ...rest }: TMapFlattened) => void;
27
+ removeAll: () => void;
28
+ get: ({ timestamp, priority, initiator }: GetAndRemoveArgType) => TMapInitiator | TPayload[] | TMapPriority | null;
29
+ getLte: (timestamp: number) => TMap;
30
+ getGte: (timestamp: number) => TMap;
31
+ };
32
+ export {};
@@ -1,24 +1,24 @@
1
1
  import { Nullable } 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 '../../../movika.core/manifest';
4
+ import type { VideoId } from '../../../manifest';
5
5
  import type { Interactives } from '../../../modules/Interactives';
6
- interface HistoryApi {
7
- get: (videoId: string) => Promise<number[]>;
8
- save: (videoId: string, videoIds: Array<VideoId>) => Promise<void>;
6
+ export interface HistoryApi {
7
+ get: (rawId: string) => Promise<number[]>;
8
+ save: (rawId: string, videoIds: number[]) => Promise<void>;
9
9
  }
10
- interface HistorySettings {
10
+ export interface HistorySettings {
11
11
  maxLength: number;
12
12
  initChapterId?: string;
13
13
  }
14
14
  interface HistoryControllerParams {
15
- videoId: string;
16
15
  globalEventEmitter: EventEmitter;
17
16
  interactiveController: Interactives;
18
17
  settings: HistorySettings;
18
+ videoId?: string;
19
19
  historyApi?: Nullable<HistoryApi>;
20
20
  }
21
- interface HistoryControllerState {
21
+ export interface HistoryControllerState {
22
22
  history$: IValueSubject<string[]>;
23
23
  hasPrevChapter$: IValueSubject<boolean>;
24
24
  prevChapter$: IValueSubject<Nullable<string>>;
@@ -27,7 +27,7 @@ interface HistoryControllerState {
27
27
  }
28
28
  export default class HistoryController {
29
29
  #private;
30
- state: Nullable<HistoryControllerState>;
30
+ state: HistoryControllerState;
31
31
  constructor({ globalEventEmitter, videoId, interactiveController, historyApi, settings }: HistoryControllerParams);
32
32
  setManifest(manifest: any): Promise<void>;
33
33
  get inited(): boolean;
@@ -1,12 +1,17 @@
1
+ import { type Container } from '../../../manifest';
2
+ import { type TPayload, type TGroupsStack } from './GroupsStack';
3
+ import type { IPlayer } from '@vkontakte/videoplayer-core';
4
+ export type InteractiveEventsType = ReturnType<typeof InteractiveEvents>;
5
+ type AddMethodParamType = Parameters<TGroupsStack['add']>[0];
6
+ type RemoveMethodParamType = Parameters<TGroupsStack['remove']>[0];
1
7
  /**
2
8
  * Executes an events at different times of the current chapter
3
- * @param {object} player
4
9
  */
5
- export function InteractiveEvents(player: object): {
6
- setPlayer: (player: any) => void;
7
- add: (args: any) => void;
8
- remove: (args: any) => void;
9
- exec: (timestamp: any) => void;
10
+ export declare function InteractiveEvents(player: IPlayer): {
11
+ setPlayer: (player: IPlayer) => void;
12
+ add: (args: AddMethodParamType) => void;
13
+ remove: (args: RemoveMethodParamType) => void;
14
+ exec: (timestamp: number) => void;
10
15
  execEndOfVideo: () => void;
11
16
  listen: () => void;
12
17
  unlisten: () => void;
@@ -16,10 +21,11 @@ export function InteractiveEvents(player: object): {
16
21
  timestamp: any;
17
22
  id: any;
18
23
  }) => void;
19
- setData: (containers?: any[]) => void;
20
- resetCalled: (timestamp: any) => void;
21
- isReady: (timestamp: any) => boolean;
24
+ setData: (containers?: Container[]) => void;
25
+ resetCalled: (timestamp: number) => void;
26
+ isReady: (timestamp: number) => boolean;
22
27
  release: () => void;
23
28
  };
24
- getPreparedToExecActions: (timestamp?: number) => any[];
29
+ getPreparedToExecActions: (timestamp?: number) => TPayload[];
25
30
  };
31
+ export {};
@@ -1,5 +1,12 @@
1
- export function ResizeManager(getOptions: any): {
1
+ import type { IPlayer } from '@vkontakte/videoplayer-core';
2
+ type ResizeManagerArg = () => {
3
+ parentElement: HTMLElement;
4
+ player?: Nullable<IPlayer>;
5
+ fns?: AnyFn[];
6
+ };
7
+ export declare function ResizeManager(getOptions: ResizeManagerArg): {
2
8
  resizeObserver: ResizeObserver;
3
9
  calc: () => void;
4
10
  release: () => void;
5
11
  };
12
+ export {};