@vkontakte/videoplayer-interactive 1.0.30-dev.a221ed50.0 → 1.0.30-dev.b736679d.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 (37) hide show
  1. package/es2015.cjs.js +233 -5
  2. package/es2015.esm.js +234 -6
  3. package/es2018.cjs.js +234 -6
  4. package/es2018.esm.js +233 -5
  5. package/esnext.cjs.js +234 -6
  6. package/esnext.esm.js +234 -6
  7. package/evergreen.esm.js +234 -6
  8. package/package.json +4 -4
  9. package/types/modules/Interactives/Interactives.d.ts +19 -9
  10. package/types/modules/Interactives/Layout.d.ts +4 -0
  11. package/types/modules/Interactives/containers/ChoiceContainer.d.ts +16 -7
  12. package/types/modules/Interactives/containers/Container.d.ts +9 -6
  13. package/types/modules/Interactives/controls/AreaControl.d.ts +22 -2
  14. package/types/modules/Interactives/controls/ButtonControl.d.ts +27 -2
  15. package/types/modules/Interactives/controls/Control.d.ts +22 -9
  16. package/types/modules/Interactives/controls/types.d.ts +21 -7
  17. package/types/modules/Interactives/index.d.ts +69 -4
  18. package/types/modules/Interactives/styles.d.ts +1 -0
  19. package/types/modules/Interactives/types.d.ts +12 -12
  20. package/types/modules/Interactives/utils/BlinkAnimationReference.d.ts +2 -0
  21. package/types/modules/Interactives/utils/FillAnimation.d.ts +30 -0
  22. package/types/modules/Interactives/utils/GameController.d.ts +16 -12
  23. package/types/modules/Interactives/utils/InteractiveEvents.d.ts +3 -3
  24. package/types/modules/Interactives/utils/SelectBranches.d.ts +2 -1
  25. package/types/modules/Interactives/utils/SelectBranches.types.d.ts +1 -0
  26. package/types/modules/Interactives/utils/TapElement.d.ts +10 -0
  27. package/types/modules/Interactives/utils/events.d.ts +0 -1
  28. package/types/modules/Interactives/utils/events.types.d.ts +3 -1
  29. package/types/modules/Interactives/utils/gameUtils.d.ts +1 -2
  30. package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +1 -5
  31. package/types/modules/Interactives/utils/renderingUtils.d.ts +15 -3
  32. package/types/utils/AverageColor/FrameAverageColor.d.ts +19 -0
  33. package/types/utils/AverageColor/helpers.d.ts +17 -0
  34. package/types/utils/AverageColor/index.d.ts +2 -0
  35. package/types/utils/getVideoContentSize.d.ts +1 -1
  36. package/types/utils/Binding.d.ts +0 -34
  37. package/types/utils/EventManager.d.ts +0 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-interactive",
3
- "version": "1.0.30-dev.a221ed50.0",
3
+ "version": "1.0.30-dev.b736679d.0",
4
4
  "author": "vk.com",
5
5
  "description": "Movika interactive SDK",
6
6
  "homepage": "https://vk.com",
@@ -51,8 +51,8 @@
51
51
  "dependencies": {
52
52
  "@interactiveplatform/movika-graph-editor": "1.11.0",
53
53
  "@interactiveplatform/movika-manifest": "^1.0.0",
54
- "@vkontakte/videoplayer-core": "2.0.124-dev.fd13add7.0",
55
- "@vkontakte/videoplayer-shared": "1.0.53-dev.a9b4cfb1.0",
56
- "@vkontakte/videoplayer-statistics": "1.0.70-dev.8aef5225.0"
54
+ "@vkontakte/videoplayer-core": "2.0.124-dev.c81f9f40.0",
55
+ "@vkontakte/videoplayer-shared": "1.0.53-dev.9233f32f.0",
56
+ "@vkontakte/videoplayer-statistics": "1.0.70-dev.f572f826.0"
57
57
  }
58
58
  }
@@ -12,11 +12,11 @@ declare enum INTERACTIVE_APP_STATES {
12
12
  destroyed = 3
13
13
  }
14
14
  export declare class Interactives {
15
- private subscription;
15
+ private playerSubscriptions;
16
+ private subscriptions;
16
17
  private globalEventEmitter;
17
18
  private eventsSubs;
18
19
  private animation;
19
- private eventManager;
20
20
  private seekToInteractiveController;
21
21
  private endedRanges;
22
22
  private gameControllers;
@@ -35,6 +35,7 @@ export declare class Interactives {
35
35
  private graph;
36
36
  private lastFrame;
37
37
  private noInteractionTimeout;
38
+ private frameAverageColor;
38
39
  appState: INTERACTIVE_APP_STATES;
39
40
  state: {
40
41
  prevChapter$: ValueSubject<Nullable<Chapter>>;
@@ -53,22 +54,31 @@ export declare class Interactives {
53
54
  };
54
55
  events: GlobalEvents;
55
56
  constructor(options: IOptionalInteractiveOptions);
57
+ private getVideoFrameAverageColorInfo;
56
58
  private emitErrorEvent;
57
59
  private clearHistoryIfEnded;
58
60
  private initSubscriptions;
61
+ private getGameControllerContainersWithExpect;
62
+ private execForAllExpectContainers;
63
+ private updateControlsShadowStyles;
64
+ private toggleControlsCTAAnimation;
59
65
  private initSeamless;
60
66
  private handleSeamlessPlayerChanged;
61
67
  private onPlaybackStarted;
62
68
  private handlePositionChange;
63
69
  private registerVideoEvents;
64
- private removeControllers;
70
+ removeGameControllersViews: ({ includeTextControls }?: {
71
+ includeTextControls?: boolean | undefined;
72
+ }) => void;
73
+ destroyGameControllers: ({ includeTextControls }?: {
74
+ includeTextControls?: boolean | undefined;
75
+ }) => void;
65
76
  private setGameControllers;
66
- private filterGameControllers;
77
+ private addGameControllers;
67
78
  private checkIfSeekable;
68
79
  private updateLastEventInfo;
69
80
  private pushChapterToHistory;
70
81
  private completeInteractiveRange;
71
- private handleFakeRemoval;
72
82
  private clearNoInteractionTimeout;
73
83
  private reset;
74
84
  get options(): IInteractiveOptions;
@@ -88,7 +98,7 @@ export declare class Interactives {
88
98
  setVisitedChapters(chapterIds: string[]): void;
89
99
  updateGraphVideosInfo(videosInfo: VideoInfo[]): void;
90
100
  deadEndCheck(): boolean;
91
- allControlsAreRemoved(): boolean;
101
+ allControlsAreRemoved(includeWillRemovedState?: boolean): boolean;
92
102
  isEndedExpectation(): boolean;
93
103
  playPrevChapter(): void;
94
104
  setDisabledControls(value: boolean): void;
@@ -115,9 +125,9 @@ export declare class Interactives {
115
125
  graph: Nullable<import("@interactiveplatform/movika-manifest").GraphDesign>;
116
126
  };
117
127
  getCurrentManifest(): Nullable<Manifest>;
118
- on(eventName: string, fn: Function): this;
119
- off(eventName: string, fn: Function): this;
120
- once(eventName: string, fn: Function): this;
128
+ on(eventName: string, fn: AnyFn): this;
129
+ off(eventName: string, fn: AnyFn): this;
130
+ once(eventName: string, fn: AnyFn): this;
121
131
  destroy(): void;
122
132
  }
123
133
  export {};
@@ -9,5 +9,9 @@ export declare class RelativeLayout extends Layout {
9
9
  constructor(layout: ChapterContainer['layout']);
10
10
  setContainerLayout(target: HTMLElement): void;
11
11
  setControlLayout(target: HTMLElement, layoutParams: ControlLayoutParams): void;
12
+ getComputedDimensions(mountedElement: HTMLElement, layoutParams: ControlLayoutParams): {
13
+ width: number;
14
+ height: number;
15
+ };
12
16
  }
13
17
  export {};
@@ -1,19 +1,28 @@
1
1
  import { Container } from './Container';
2
- import { ChapterContainer } from "../../../manifest";
3
- import { ControlEventCallback } from "../../../modules/Interactives/controls";
4
- export declare const createChoiceContainer: (container: ChapterContainer, rootElement: HTMLElement) => ChoiceContainer | undefined;
2
+ import { ChapterContainer, ControlTypes } from '../../../manifest';
3
+ import type { ChoiceContainerOptions, ContainerCreateView } from '../../../modules/Interactives/controls';
4
+ export declare const createChoiceContainer: (container: ChapterContainer, rootElement: HTMLElement, options: ChoiceContainerOptions) => 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: ChapterContainer, rootElement: HTMLElement);
11
- createView(eventCallback: ControlEventCallback): HTMLElement;
10
+ willRemoved: boolean;
11
+ constructor(container: ChapterContainer, rootElement: HTMLElement, options: ChoiceContainerOptions);
12
+ createView({ eventCallback, videoDurationMs }: ContainerCreateView): HTMLElement;
13
+ onProgress(currentTime: number, isInteractive: boolean): void;
14
+ onResize(): void;
12
15
  hide(): void;
13
16
  show(): void;
14
17
  enable(): void;
15
18
  disable(): void;
16
- removeView(destroy?: boolean): void;
17
- fakeRemove(): void;
19
+ removeView(withTransition?: boolean, useDelay?: boolean): void;
20
+ private onTransitionEnd;
21
+ removeAllControls(withTransition?: boolean): void;
22
+ removeNonInteractedControls(withTransition?: boolean): void;
23
+ isInteracted(): boolean;
18
24
  getElement(): HTMLElement | null;
25
+ toggleCTAAnimation(enable?: boolean): void;
26
+ updateControlsShadowStyles(isFrameBased?: boolean): void;
27
+ setupControlsBlinkAnimSync(ctrlElement: HTMLElement, controlType: Extract<`${ControlTypes}`, 'Button' | 'Area'>): void;
19
28
  }
@@ -1,12 +1,15 @@
1
- import Control from '../../../modules/Interactives/controls/Control';
2
- import { ChapterContainer } from "../../../manifest";
3
- import { ControlCreator } from "../../../modules/Interactives/controls";
1
+ import { Control } from '../../../modules/Interactives/controls/Control';
2
+ import type { ChapterContainer } from '../../../manifest';
3
+ import type { ControlCreator, Options } from '../../../modules/Interactives/controls';
4
+ import { type ChoiceContainerOptions } from '../../../modules/Interactives/controls';
4
5
  export declare class Container {
5
6
  container: ChapterContainer;
6
- private factories;
7
7
  controls: Control[];
8
- constructor(container: ChapterContainer);
9
- addControlFactory(type: string, factory: ControlCreator): void;
8
+ options?: Options;
9
+ private factories;
10
+ constructor(container: ChapterContainer, options?: Options);
11
+ addControlFactory(type: string, factory: ControlCreator<any>): void;
12
+ featureIsEnabled(name: keyof ChoiceContainerOptions['features']): boolean | undefined;
10
13
  removeControlFactory(type: string): void;
11
14
  private setControls;
12
15
  private chooseControls;
@@ -1,2 +1,22 @@
1
- import { type ControlCreator } from './types';
2
- export declare const createAreaControl: ControlCreator;
1
+ import { Control } from './Control';
2
+ import { type ControlCreator, type CreateViewParams, type TControl, type ChoiceContainerOptions } from './types';
3
+ import { TapElement } from '../utils/TapElement';
4
+ export declare const createAreaControl: ControlCreator<ChoiceContainerOptions, AreaControl>;
5
+ declare class AreaControl extends Control {
6
+ tapElement?: TapElement;
7
+ constructor(control: TControl, options?: ChoiceContainerOptions);
8
+ createView({ parentElement, callbacks }: CreateViewParams): void;
9
+ onControlSelect: () => void;
10
+ updateShadowStyles(dependOnFrameTone?: boolean): void;
11
+ disable(): void;
12
+ enable(): void;
13
+ setShowTimeRange(): void;
14
+ onProgress(): void;
15
+ onResize(): void;
16
+ removeView(withTransition?: boolean): void;
17
+ onTransitionEnd: (event: TransitionEvent) => void;
18
+ removeListeners(): void;
19
+ getElement(): Nullable<HTMLElement>;
20
+ toggleCTAAnimation(enable?: boolean): void;
21
+ }
22
+ export {};
@@ -1,2 +1,27 @@
1
- import { type ControlCreator } from './types';
2
- export declare const createButtonControl: ControlCreator;
1
+ import { Control } from './Control';
2
+ import { type ControlCreator, type CreateViewParams, type TControl, type ChoiceContainerOptions } from './types';
3
+ import { FillAnimation } from '../utils/FillAnimation';
4
+ import { TapElement } from '../utils/TapElement';
5
+ export declare const createButtonControl: ControlCreator<ChoiceContainerOptions, ButtonControl>;
6
+ declare class ButtonControl extends Control {
7
+ startTime?: number;
8
+ endTime?: number;
9
+ fillAnimation?: FillAnimation;
10
+ tapElement?: TapElement;
11
+ constructor(control: TControl, options?: ChoiceContainerOptions);
12
+ createView({ parentElement, callbacks }: CreateViewParams): void;
13
+ onControlSelect: () => void;
14
+ disable(): void;
15
+ enable(): void;
16
+ setShowTimeRange(startTime: number, endTime: number): void;
17
+ onProgress(currentTime: number): void;
18
+ updateFillAnimationDimension(): void;
19
+ onResize(): void;
20
+ getElement(): Nullable<HTMLElement>;
21
+ removeView(withTransition?: boolean): void;
22
+ onTransitionEnd: (event: TransitionEvent) => void;
23
+ removeListeners(): void;
24
+ toggleCTAAnimation(enable?: boolean): void;
25
+ updateShadowStyles(): void;
26
+ }
27
+ export {};
@@ -1,20 +1,33 @@
1
- import type { ControlEventCallback, CreateViewParams, Dimensions, LayoutCallback, TControl } from './types';
1
+ import type { ControlEventCallback, CreateViewParams, Dimensions, Callbacks, TControl, Options, ChoiceContainerOptions } from './types';
2
2
  type ControlContainer = {
3
3
  element: HTMLElement;
4
- dimensions: Dimensions;
4
+ dimensions: Dimensions<string>;
5
+ getComputedDimensions: () => Dimensions<number>;
6
+ isManifestContainerDisabled: () => boolean;
5
7
  };
6
- export default abstract class Control {
8
+ type ClickListener = (event: MouseEvent) => void;
9
+ export declare abstract class Control {
7
10
  control: TControl;
8
- protected container: Nullable<ControlContainer>;
9
- protected controlElement: Nullable<HTMLElement>;
10
- private clickListener;
11
- protected constructor(control: TControl);
11
+ options?: Options | undefined;
12
+ container: Nullable<ControlContainer>;
13
+ controlElement: Nullable<HTMLElement>;
14
+ clickListener: Nullable<ClickListener>;
15
+ isInteracted: boolean;
16
+ isRemoved: boolean;
17
+ constructor(control: TControl, options?: Options | undefined);
12
18
  abstract createView(params: CreateViewParams): void;
13
19
  abstract getElement(): Nullable<HTMLElement>;
14
20
  abstract disable(): void;
15
21
  abstract enable(): void;
16
- protected createContainerElement(layoutCallback: LayoutCallback): void;
17
- private createClickListener;
22
+ abstract onProgress(currentTime: number): void;
23
+ abstract onResize(): void;
24
+ abstract setShowTimeRange(startTime: number, endTime: number): void;
25
+ abstract removeView(withTransition?: boolean): void;
26
+ abstract toggleCTAAnimation(enable?: boolean): void;
27
+ abstract updateShadowStyles(isFrameBased?: boolean): void;
28
+ createContainerElement(callbacks: Callbacks): void;
29
+ createClickListener(callback: any): ClickListener;
30
+ featureIsEnabled(name: keyof ChoiceContainerOptions['features']): boolean | undefined;
18
31
  setEvents(callback: ControlEventCallback): void;
19
32
  removeListeners(): void;
20
33
  }
@@ -1,24 +1,38 @@
1
1
  import type { Control as TControl, ControlEvent, ControlLayoutParams } from '../../../manifest';
2
- import Control from '../../../modules/Interactives/controls/Control';
2
+ import type { ControlsAnimationFeatureToggles } from '../../../modules/Interactives/types';
3
+ import { Control } from '../../../modules/Interactives/controls/Control';
3
4
  export { TControl };
4
5
  export declare enum CONTROLLER_IDS {
5
6
  AREA = "int_area",
6
7
  TEXT = "int_text",
7
8
  BUTTON = "int_bttn"
8
9
  }
9
- export type Dimensions = {
10
- width: string;
11
- height: string;
10
+ export type Dimensions<T = string> = {
11
+ width: T;
12
+ height: T;
13
+ };
14
+ export type Callbacks = {
15
+ setControlLayout: (element: HTMLElement, controlLayoutParams: ControlLayoutParams) => void;
16
+ getComputedDimensions: () => Dimensions<number>;
17
+ isContainerDisabled?: () => boolean;
12
18
  };
13
- export type LayoutCallback = (element: HTMLElement, controlLayoutParams: ControlLayoutParams) => void;
14
19
  export type CreateViewParams = {
15
20
  parentElement: HTMLElement;
16
- layoutCallback: LayoutCallback;
21
+ callbacks: Callbacks;
17
22
  };
18
23
  type ControlEventCallbackParams = {
19
24
  action: ControlEvent['action'];
20
25
  controlId: string;
21
26
  controlType: TControl['type'];
22
27
  };
28
+ export type Options = Record<string, unknown>;
29
+ export type ChoiceContainerOptions = {
30
+ features: Pick<ControlsAnimationFeatureToggles, 'buttonControlInteractiveTimeTimer' | 'areaControlFrameBasedShadow' | 'tapPlaceShow' | 'controlsShowAnimation' | 'controlsCTAAnimation'>;
31
+ };
32
+ export declare function isChoiceContainerOptions(options: Options): options is ChoiceContainerOptions;
23
33
  export type ControlEventCallback = (params: ControlEventCallbackParams) => void;
24
- export type ControlCreator = (control: TControl) => Control | undefined;
34
+ export type ContainerCreateView = {
35
+ videoDurationMs: number;
36
+ eventCallback: ControlEventCallback;
37
+ };
38
+ export type ControlCreator<O extends Options = Options, C extends Control = Control> = (control: TControl, options?: O) => C | undefined;
@@ -6,9 +6,74 @@ export { isLastChapter, hasEndTemplate, isOneTextCtrlContainer } from './utils/g
6
6
  export type { InteractiveRange } from './utils/getInteractiveRanges';
7
7
  export declare const utils: {
8
8
  Container: typeof Container;
9
- createChoiceContainer: (container: import("@interactiveplatform/movika-manifest").ChapterContainer, rootElement: HTMLElement) => import("./containers/ChoiceContainer").ChoiceContainer | undefined;
10
- createAreaControl: import("./controls").ControlCreator;
11
- createButtonControl: import("./controls").ControlCreator;
12
- getRootEl: () => Element | null;
9
+ createChoiceContainer: (container: import("@interactiveplatform/movika-manifest").ChapterContainer, rootElement: HTMLElement, options: import("./controls").ChoiceContainerOptions) => import("./containers/ChoiceContainer").ChoiceContainer | undefined;
10
+ createAreaControl: import("./controls").ControlCreator<import("./controls").ChoiceContainerOptions, {
11
+ tapElement?: import("./utils/TapElement").TapElement;
12
+ createView({ parentElement, callbacks }: import("./controls").CreateViewParams): void;
13
+ onControlSelect: () => void;
14
+ updateShadowStyles(dependOnFrameTone?: boolean): void;
15
+ disable(): void;
16
+ enable(): void;
17
+ setShowTimeRange(): void;
18
+ onProgress(): void;
19
+ onResize(): void;
20
+ removeView(withTransition?: boolean): void;
21
+ onTransitionEnd: (event: TransitionEvent) => void;
22
+ removeListeners(): void;
23
+ getElement(): Nullable<HTMLElement>;
24
+ toggleCTAAnimation(enable?: boolean): void;
25
+ container: Nullable<{
26
+ element: HTMLElement;
27
+ dimensions: import("./controls").Dimensions<string>;
28
+ getComputedDimensions: () => import("./controls").Dimensions<number>;
29
+ isManifestContainerDisabled: () => boolean;
30
+ }>;
31
+ controlElement: Nullable<HTMLElement>;
32
+ clickListener: Nullable<(event: MouseEvent) => void>;
33
+ isInteracted: boolean;
34
+ isRemoved: boolean;
35
+ control: import("@interactiveplatform/movika-manifest/dist/chapter-COPBtRYg").e;
36
+ options?: import("./controls").Options;
37
+ createContainerElement(callbacks: import("./controls").Callbacks): void;
38
+ createClickListener(callback: any): (event: MouseEvent) => void;
39
+ featureIsEnabled(name: keyof import("./controls").ChoiceContainerOptions["features"]): boolean | undefined;
40
+ setEvents(callback: import("./controls").ControlEventCallback): void;
41
+ }>;
42
+ createButtonControl: import("./controls").ControlCreator<import("./controls").ChoiceContainerOptions, {
43
+ startTime?: number;
44
+ endTime?: number;
45
+ fillAnimation?: import("./utils/FillAnimation").FillAnimation;
46
+ tapElement?: import("./utils/TapElement").TapElement;
47
+ createView({ parentElement, callbacks }: import("./controls").CreateViewParams): void;
48
+ onControlSelect: () => void;
49
+ disable(): void;
50
+ enable(): void;
51
+ setShowTimeRange(startTime: number, endTime: number): void;
52
+ onProgress(currentTime: number): void;
53
+ updateFillAnimationDimension(): void;
54
+ onResize(): void;
55
+ getElement(): Nullable<HTMLElement>;
56
+ removeView(withTransition?: boolean): void;
57
+ onTransitionEnd: (event: TransitionEvent) => void;
58
+ removeListeners(): void;
59
+ toggleCTAAnimation(enable?: boolean): void;
60
+ updateShadowStyles(): void;
61
+ container: Nullable<{
62
+ element: HTMLElement;
63
+ dimensions: import("./controls").Dimensions<string>;
64
+ getComputedDimensions: () => import("./controls").Dimensions<number>;
65
+ isManifestContainerDisabled: () => boolean;
66
+ }>;
67
+ controlElement: Nullable<HTMLElement>;
68
+ clickListener: Nullable<(event: MouseEvent) => void>;
69
+ isInteracted: boolean;
70
+ isRemoved: boolean;
71
+ control: import("@interactiveplatform/movika-manifest/dist/chapter-COPBtRYg").e;
72
+ options?: import("./controls").Options;
73
+ createContainerElement(callbacks: import("./controls").Callbacks): void;
74
+ createClickListener(callback: any): (event: MouseEvent) => void;
75
+ featureIsEnabled(name: keyof import("./controls").ChoiceContainerOptions["features"]): boolean | undefined;
76
+ setEvents(callback: import("./controls").ControlEventCallback): void;
77
+ }>;
13
78
  classnamesPrefix: string;
14
79
  };
@@ -0,0 +1 @@
1
+ export declare const apply: (attachToElement: HTMLElement) => void;
@@ -19,7 +19,15 @@ export type RequiredOptions = 'parentElement' | 'fullscreenTargetElement';
19
19
  export type IOptionalInteractiveOptions = Partial<Omit<IInteractiveOptions, RequiredOptions | 'config'>> & Required<Pick<IInteractiveOptions, RequiredOptions>> & {
20
20
  config?: Partial<IInteractiveOptions['config']>;
21
21
  };
22
- export interface IInteractiveOptions {
22
+ export type ControlsAnimationFeatureToggles = {
23
+ buttonControlInteractiveTimeTimer: boolean;
24
+ areaControlFrameBasedShadow: boolean;
25
+ tapPlaceShow: boolean;
26
+ controlsCTAAnimation: boolean;
27
+ controlsShowAnimation: boolean;
28
+ controlsHideAnimation: boolean;
29
+ };
30
+ export type IInteractiveOptions = {
23
31
  parentElement: HTMLElement;
24
32
  fullscreenTargetElement: HTMLElement;
25
33
  lang: InterfaceLanguage | string;
@@ -31,7 +39,6 @@ export interface IInteractiveOptions {
31
39
  lastFrame: boolean;
32
40
  initSeamless: boolean;
33
41
  permanentTextControls: boolean;
34
- interactiveTimeOpenUri: boolean;
35
42
  loaders: Partial<Loaders>;
36
43
  initChapterId?: string;
37
44
  projectInfo?: InteractiveProjectInfo;
@@ -41,10 +48,10 @@ export interface IInteractiveOptions {
41
48
  vkVideoLoader?: (owner_id: string, video_id: string) => unknown;
42
49
  createOneStat?: (video: any, configOverwrite?: any) => IOneStat | undefined;
43
50
  /**
44
- * @deprecated
45
- * */
51
+ * @deprecated
52
+ * */
46
53
  disableControlsOnPause?: boolean;
47
- }
54
+ } & ControlsAnimationFeatureToggles;
48
55
  export type ChapterChangedData = {
49
56
  chapter: Chapter;
50
57
  manifestVideo: ManifestVideo;
@@ -60,10 +67,3 @@ export interface EachTickData {
60
67
  currentTime: number;
61
68
  isInteractiveTime: boolean;
62
69
  }
63
- export type IgnoreExpectState = {
64
- isExpectTime: boolean;
65
- hasOtherExpect: boolean;
66
- hasOpenURIEvent: boolean;
67
- hasOpenURIEventInCurrentContainer: boolean;
68
- isAllOpenURIEventsValid: boolean;
69
- };
@@ -0,0 +1,2 @@
1
+ export declare const createBlinkAnimationRef: () => HTMLDivElement;
2
+ export declare const restartBlinkAnimationRef: (blinkAnimationRefElement: HTMLElement) => void;
@@ -0,0 +1,30 @@
1
+ export declare function normalizeRadians(rad: number): number;
2
+ export declare function radiansToDegrees(rad: number): number;
3
+ export type Options = {
4
+ startTime: number;
5
+ endTime: number;
6
+ rotateAngle: number;
7
+ borderRadius: string;
8
+ debug?: boolean;
9
+ };
10
+ export declare class FillAnimation {
11
+ fillAnimationElement: HTMLDivElement;
12
+ private fillAnimationFillerElement;
13
+ private fillAnimationFillerWrapperElement;
14
+ private startTime;
15
+ private endTime;
16
+ private shouldFillHeight;
17
+ private widthExpansionCoef;
18
+ private isDebug;
19
+ private fromLeft;
20
+ private useSkew;
21
+ private rotateAngle;
22
+ constructor(opts: Options);
23
+ updateDimension(opts: {
24
+ width: number;
25
+ height: number;
26
+ borderWidth: number;
27
+ }): void;
28
+ updateAnimation(currentTime: number): void;
29
+ private calcWidthExpansionCoef;
30
+ }
@@ -3,35 +3,35 @@ import { type IPlayer } from '@vkontakte/videoplayer-core';
3
3
  import type { InteractiveEventsType } from './InteractiveEvents';
4
4
  import type { ChapterBranch } from '../../../manifest';
5
5
  import type { EventEmitter } from '../../../utils/EventEmitter';
6
- import type { IgnoreExpectState } from '../../../modules/Interactives/types';
7
- import type { ChoiceContainer } from "../../../modules/Interactives/containers";
8
- import { SelectBranches } from './SelectBranches';
6
+ import type { ControlsAnimationFeatureToggles } from '../../../modules/Interactives/types';
7
+ import type { ChoiceContainer } from '../../../modules/Interactives/containers';
8
+ import type { SelectBranchesType } from './SelectBranches';
9
9
  import { type GlobalEvents } from './events';
10
10
  import { GameStates } from './gameUtils';
11
+ type Features = Pick<ControlsAnimationFeatureToggles, 'controlsHideAnimation'>;
11
12
  type ConstructorArg = {
12
13
  player: IPlayer;
13
14
  container: ChoiceContainer;
14
15
  branches: ChapterBranch[];
15
- selectBranches: ReturnType<typeof SelectBranches>;
16
+ selectBranches: ReturnType<SelectBranchesType>;
16
17
  interactiveEvents: InteractiveEventsType;
17
18
  globalEventEmitter: EventEmitter;
18
19
  globalEvents: GlobalEvents;
20
+ ignoreContainerEvent: () => boolean;
19
21
  permanentTextControls: boolean;
20
22
  disabledControls$: IValueSubject<boolean>;
21
23
  onRemove: () => void;
22
- getContainerEventState: () => IgnoreExpectState;
23
- interactiveTimeOpenUri: boolean;
24
+ features: Features;
24
25
  };
25
26
  export declare class GameController {
26
27
  container: ChoiceContainer;
27
28
  branches: ChapterBranch[];
28
- selectBranches: ReturnType<typeof SelectBranches>;
29
+ selectBranches: ReturnType<SelectBranchesType>;
29
30
  subscription: ISubscription;
30
31
  player: IPlayer;
31
32
  interactiveEvents: InteractiveEventsType;
32
- getContainerEventState: () => IgnoreExpectState;
33
+ ignoreContainerEvent: () => boolean;
33
34
  isPermanentText: boolean;
34
- interactiveTimeOpenUri: boolean;
35
35
  disabledControls$: IValueSubject<boolean>;
36
36
  onRemove: () => void;
37
37
  globalEventEmitter: EventEmitter;
@@ -39,7 +39,8 @@ export declare class GameController {
39
39
  isSelectedControlEvent: boolean;
40
40
  isSelectedContainerEvent: boolean;
41
41
  globalEvents: GlobalEvents;
42
- constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter, getContainerEventState, permanentTextControls, interactiveTimeOpenUri, disabledControls$, onRemove, }: ConstructorArg);
42
+ features: Features;
43
+ constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter, ignoreContainerEvent, permanentTextControls, disabledControls$, onRemove, features, }: ConstructorArg);
43
44
  private emitContainerVisibilityEvent;
44
45
  registerEvents(): void;
45
46
  hide: () => void;
@@ -51,8 +52,11 @@ export declare class GameController {
51
52
  onEndOfVideo: () => void;
52
53
  whilePlaying: () => void;
53
54
  reset(): void;
54
- removeView(destroy?: boolean): void;
55
- fakeRemoveView(remove?: boolean): void;
55
+ isInteracted(): boolean;
56
+ isRemovedOrDestroyed(includeWillRemovedState?: boolean): boolean;
57
+ removeView(withTransition?: boolean): void;
58
+ toggleControlsCTAAnimation(value: boolean): void;
59
+ updateControlsShadowStyles(isFrameBased?: boolean): void;
56
60
  destroy(): void;
57
61
  }
58
62
  export {};
@@ -7,7 +7,7 @@ type RemoveMethodParamType = Parameters<TGroupsStack['remove']>[0];
7
7
  /**
8
8
  * Executes an events at different times of the current chapter
9
9
  */
10
- export declare function InteractiveEvents(player: IPlayer, interactiveTimeOpenUri: any): {
10
+ export declare function InteractiveEvents(player: IPlayer): {
11
11
  setPlayer: (player: IPlayer) => void;
12
12
  add: (args: AddMethodParamType) => void;
13
13
  remove: (args: RemoveMethodParamType) => void;
@@ -18,8 +18,8 @@ export declare function InteractiveEvents(player: IPlayer, interactiveTimeOpenUr
18
18
  release: () => void;
19
19
  containersEventsCallState: {
20
20
  setCalled: ({ timestamp, id }: {
21
- timestamp: any;
22
- id: any;
21
+ timestamp: number;
22
+ id: string;
23
23
  }) => void;
24
24
  setData: (containers?: Container[]) => void;
25
25
  resetCalled: (timestamp: number) => void;
@@ -7,7 +7,7 @@ export declare const defaultArgs: {
7
7
  export declare const AFTER_EXPECT_ACTION: AfterExpectActionType;
8
8
  export declare const extendArgs: <T extends AnyAction>(action: T, rewrite?: boolean) => T;
9
9
  export type ExtendArgsReturnType = ReturnType<typeof extendArgs>;
10
- export declare const SelectBranches: ({ globalEventEmitter, globalEvents, player, interactiveEvents, removeControllers, }: SelectBranchesArg) => {
10
+ export declare const SelectBranches: ({ globalEventEmitter, globalEvents, player, interactiveEvents }: SelectBranchesArg) => {
11
11
  onControlEvent: ({ action, controlType, controlId, containerId, branches, onEvent, isEOV, isDisabled, }: OnControlEventArg) => void;
12
12
  onContainerEvent: ({ action, container: { id: containerId, endTime }, branches, isEOV, autoSelected, }: OnContainerEventArg) => void;
13
13
  onChapterEvent: ({ chapterId, action, branches }: OnChapterEventArg) => (() => ContinuePlaybackArg<"chapter">) | undefined;
@@ -20,3 +20,4 @@ export declare const SelectBranches: ({ globalEventEmitter, globalEvents, player
20
20
  isExpect: boolean;
21
21
  };
22
22
  };
23
+ export type SelectBranchesType = typeof SelectBranches;
@@ -6,6 +6,7 @@ import type { GlobalEvents } from './events';
6
6
  export type SubjectName = 'chapter' | 'container' | 'control';
7
7
  export type AfterExpectActionType = 'after-expect';
8
8
  export type Behaviour = 'change-chapter' | 'change-manifest';
9
+ export type ControlAfterExpectCallbackType = () => ExpectEventHandlerArg<'control'>;
9
10
  export type SelectBranchesArg = {
10
11
  globalEventEmitter: EventEmitter;
11
12
  globalEvents: GlobalEvents;
@@ -0,0 +1,10 @@
1
+ export declare class TapElement {
2
+ element: HTMLDivElement;
3
+ controlRotateAngleRad: number;
4
+ clickCancelCondition: () => boolean;
5
+ constructor(controlRotateAngleRad: number, clickCancelCondition: () => boolean);
6
+ onElementClick: (e: Event & {
7
+ clientX: number;
8
+ clientY: number;
9
+ }) => void;
10
+ }
@@ -65,7 +65,6 @@ export declare const interactivesEventTypes: {
65
65
  readonly actionExecution: "action-execution";
66
66
  readonly visibility: "visibility";
67
67
  readonly containerRemoved: "container-removed";
68
- readonly containerFakeRemoved: "container-fake-removed";
69
68
  readonly rangeEnded: "range-ended";
70
69
  };
71
70
  export declare enum InteractivesEventTypes {
@@ -35,9 +35,11 @@ export type TInteractivesActionExecutionEvent<T extends SubjectName> = TInteract
35
35
  subjectType?: SubjectType<T>;
36
36
  payload?: TInteractivesActionExecEventPayload<ActionMap[T]['type']>;
37
37
  };
38
- type TInteractivesActionChoiceEventPayload<T extends SubjectName> = T extends 'chapter' ? ChapterEvent['action']['args'] : T extends 'container' ? ContainerEvent['action']['args'] : ControlEvent['action']['args'] & {
38
+ type TControlPayloadExtra = {
39
39
  containerId: string;
40
+ invokeImmediately: boolean;
40
41
  };
42
+ type TInteractivesActionChoiceEventPayload<T extends SubjectName> = T extends 'chapter' ? ChapterEvent['action']['args'] : T extends 'container' ? ContainerEvent['action']['args'] & Pick<TControlPayloadExtra, 'invokeImmediately'> : ControlEvent['action']['args'] & TControlPayloadExtra;
41
43
  type TSubjectTypeValues<T extends SubjectName> = T extends 'chapter' ? undefined : T extends 'container' ? ChapterContainer['type'] : Control['type'];
42
44
  export type TInteractivesActionChoiceEvent<T extends SubjectName> = TInteractiveCommon<T, InteractivesEventTypes.ACTION_CHOICE | InteractivesEventTypes.ACTION_CHOICE_CANCELED> & {
43
45
  subjectType?: TSubjectTypeValues<T>;