@vkontakte/videoplayer-interactive 1.0.32-beta.0 → 1.0.32-dev.162375f7.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 (31) hide show
  1. package/es2015.cjs.js +6 -43
  2. package/es2015.esm.js +6 -43
  3. package/es2018.cjs.js +6 -43
  4. package/es2018.esm.js +6 -43
  5. package/esnext.cjs.js +6 -43
  6. package/esnext.esm.js +6 -43
  7. package/evergreen.esm.js +5 -42
  8. package/package.json +4 -4
  9. package/types/modules/Interactives/Interactives.d.ts +0 -11
  10. package/types/modules/Interactives/containers/ChoiceContainer.d.ts +6 -8
  11. package/types/modules/Interactives/containers/Container.d.ts +5 -7
  12. package/types/modules/Interactives/containers/index.d.ts +0 -2
  13. package/types/modules/Interactives/controls/AreaControl.d.ts +2 -11
  14. package/types/modules/Interactives/controls/ButtonControl.d.ts +2 -11
  15. package/types/modules/Interactives/controls/Control.d.ts +9 -12
  16. package/types/modules/Interactives/controls/TextControl.d.ts +2 -11
  17. package/types/modules/Interactives/controls/index.d.ts +2 -4
  18. package/types/modules/Interactives/controls/types.d.ts +8 -17
  19. package/types/modules/Interactives/index.d.ts +4 -39
  20. package/types/modules/Interactives/types.d.ts +2 -14
  21. package/types/modules/Interactives/utils/GameController.d.ts +4 -8
  22. package/types/modules/Interactives/utils/InteractiveEvents.d.ts +1 -1
  23. package/types/modules/Interactives/utils/events.d.ts +1 -3
  24. package/types/modules/Interactives/utils/events.types.d.ts +0 -3
  25. package/types/modules/Interactives/utils/gameUtils.d.ts +1 -2
  26. package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +1 -5
  27. package/types/modules/Interactives/utils/renderingUtils.d.ts +3 -0
  28. package/types/modules/Interactives/containers/types.d.ts +0 -9
  29. package/types/modules/Interactives/containers/utils.d.ts +0 -6
  30. package/types/modules/Interactives/controls/utils.d.ts +0 -9
  31. package/types/modules/Interactives/styles.d.ts +0 -1
@@ -1,33 +1,24 @@
1
1
  import type { Control as TControl, ControlEvent, ControlLayoutParams } from '../../../manifest';
2
- import type { Control } from '../../../modules/Interactives/controls/Control';
3
- import { AnimationsFeatureToggles } from '../../../modules/Interactives/types';
2
+ import Control from '../../../modules/Interactives/controls/Control';
4
3
  export { TControl };
5
- export declare const CONTROLLER_PREFIX = "int";
6
4
  export declare enum CONTROLLER_IDS {
7
5
  AREA = "int_area",
8
6
  TEXT = "int_text",
9
7
  BUTTON = "int_bttn"
10
8
  }
11
- export type Dimensions<T = string> = {
12
- width: T;
13
- height: T;
9
+ export type Dimensions = {
10
+ width: string;
11
+ height: string;
14
12
  };
15
- export type Callbacks = {
16
- setControlLayout: (element: HTMLElement, controlLayoutParams: ControlLayoutParams) => void;
17
- };
18
- export type ControlCreateViewParams = {
13
+ export type LayoutCallback = (element: HTMLElement, controlLayoutParams: ControlLayoutParams) => void;
14
+ export type CreateViewParams = {
19
15
  parentElement: HTMLElement;
20
- callbacks: Callbacks;
21
- };
22
- export type Options = Record<string, unknown>;
23
- export type ControlOptions = {
24
- features: Pick<AnimationsFeatureToggles, never>;
16
+ layoutCallback: LayoutCallback;
25
17
  };
26
- export declare function isControlOptions(options: Options): options is ControlOptions;
27
18
  type ControlEventCallbackParams = {
28
19
  action: ControlEvent['action'];
29
20
  controlId: string;
30
21
  controlType: TControl['type'];
31
22
  };
32
23
  export type ControlEventCallback = (params: ControlEventCallbackParams) => void;
33
- export type ControlCreator<O extends Options = Options, C extends Control = Control> = (control: TControl, options?: O) => C | undefined;
24
+ export type ControlCreator = (control: TControl) => Control | undefined;
@@ -6,44 +6,9 @@ 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, options?: import("./containers/types").ChoiceContainerOptions) => import("./containers/ChoiceContainer").ChoiceContainer | undefined;
10
- createAreaControl: import("./controls").ControlCreator<import("./controls").ControlOptions, {
11
- createView({ parentElement, callbacks }: import("./controls").ControlCreateViewParams): void;
12
- disable(): void;
13
- enable(): void;
14
- getElement(): Nullable<HTMLElement>;
15
- container: Nullable<{
16
- element: HTMLElement;
17
- dimensions: import("./controls").Dimensions;
18
- }>;
19
- controlElement: Nullable<HTMLElement>;
20
- clickListener: Nullable<(event: MouseEvent) => void>;
21
- control: import("@interactiveplatform/movika-manifest/dist/chapter-COPBtRYg").e;
22
- options?: import("./controls").Options;
23
- createContainerElement(callbacks: import("./controls").Callbacks): void;
24
- createClickListener(callback: AnyFn): (event: MouseEvent) => void;
25
- featureIsEnabled(name: keyof import("./controls").ControlOptions["features"]): false | undefined;
26
- setEvents(callback: import("./controls").ControlEventCallback): void;
27
- removeListeners(): void;
28
- }>;
29
- createButtonControl: import("./controls").ControlCreator<import("./controls").ControlOptions, {
30
- createView({ parentElement, callbacks }: import("./controls").ControlCreateViewParams): void;
31
- disable(): void;
32
- enable(): void;
33
- getElement(): Nullable<HTMLElement>;
34
- container: Nullable<{
35
- element: HTMLElement;
36
- dimensions: import("./controls").Dimensions;
37
- }>;
38
- controlElement: Nullable<HTMLElement>;
39
- clickListener: Nullable<(event: MouseEvent) => void>;
40
- control: import("@interactiveplatform/movika-manifest/dist/chapter-COPBtRYg").e;
41
- options?: import("./controls").Options;
42
- createContainerElement(callbacks: import("./controls").Callbacks): void;
43
- createClickListener(callback: AnyFn): (event: MouseEvent) => void;
44
- featureIsEnabled(name: keyof import("./controls").ControlOptions["features"]): false | undefined;
45
- setEvents(callback: import("./controls").ControlEventCallback): void;
46
- removeListeners(): void;
47
- }>;
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;
48
13
  classnamesPrefix: string;
49
14
  };
@@ -19,7 +19,6 @@ 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 type AnimationsFeatureToggles = {};
23
22
  export interface IInteractiveOptions {
24
23
  parentElement: HTMLElement;
25
24
  fullscreenTargetElement: HTMLElement;
@@ -32,7 +31,6 @@ export interface IInteractiveOptions {
32
31
  lastFrame: boolean;
33
32
  initSeamless: boolean;
34
33
  permanentTextControls: boolean;
35
- interactiveTimeOpenUri: boolean;
36
34
  loaders: Partial<Loaders>;
37
35
  initChapterId?: string;
38
36
  projectInfo?: InteractiveProjectInfo;
@@ -42,10 +40,9 @@ export interface IInteractiveOptions {
42
40
  vkVideoLoader?: (owner_id: string, video_id: string) => unknown;
43
41
  createOneStat?: (video: any, configOverwrite?: any) => IOneStat | undefined;
44
42
  /**
45
- * @deprecated
46
- * */
43
+ * @deprecated
44
+ * */
47
45
  disableControlsOnPause?: boolean;
48
- animationFeatureToggles?: AnimationsFeatureToggles;
49
46
  }
50
47
  export type ChapterChangedData = {
51
48
  chapter: Chapter;
@@ -62,12 +59,3 @@ export interface EachTickData {
62
59
  currentTime: number;
63
60
  isInteractiveTime: boolean;
64
61
  }
65
- export type IgnoreExpectState = {
66
- isExpectTime: boolean;
67
- hasOtherExpect: boolean;
68
- hasOpenURIEvent: boolean;
69
- hasOpenURIEventInCurrentContainer: boolean;
70
- isAllOpenURIEventsValid: boolean;
71
- isExpectEventForCurrentContainer: boolean;
72
- hasShouldOpenNowEvent: boolean;
73
- };
@@ -3,9 +3,8 @@ 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 { SelectBranchesType } from './SelectBranches';
7
- import type { IgnoreExpectState } from '../../../modules/Interactives/types';
8
6
  import type { ChoiceContainer } from '../../../modules/Interactives/containers';
7
+ import type { SelectBranchesType } from './SelectBranches';
9
8
  import { type GlobalEvents } from './events';
10
9
  import { GameStates } from './gameUtils';
11
10
  type ConstructorArg = {
@@ -16,9 +15,8 @@ type ConstructorArg = {
16
15
  interactiveEvents: InteractiveEventsType;
17
16
  globalEventEmitter: EventEmitter;
18
17
  globalEvents: GlobalEvents;
19
- getContainerEventState: () => IgnoreExpectState;
18
+ ignoreContainerEvent: () => boolean;
20
19
  permanentTextControls: boolean;
21
- interactiveTimeOpenUri: boolean;
22
20
  disabledControls$: IValueSubject<boolean>;
23
21
  onRemove: () => void;
24
22
  };
@@ -29,9 +27,8 @@ export declare class GameController {
29
27
  subscription: ISubscription;
30
28
  player: IPlayer;
31
29
  interactiveEvents: InteractiveEventsType;
32
- getContainerEventState: () => IgnoreExpectState;
30
+ ignoreContainerEvent: () => boolean;
33
31
  isPermanentText: boolean;
34
- interactiveTimeOpenUri: boolean;
35
32
  disabledControls$: IValueSubject<boolean>;
36
33
  onRemove: () => void;
37
34
  globalEventEmitter: EventEmitter;
@@ -39,7 +36,7 @@ export declare class GameController {
39
36
  isSelectedControlEvent: boolean;
40
37
  isSelectedContainerEvent: boolean;
41
38
  globalEvents: GlobalEvents;
42
- constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter, getContainerEventState, permanentTextControls, interactiveTimeOpenUri, disabledControls$, onRemove, }: ConstructorArg);
39
+ constructor({ player, container, branches, selectBranches, interactiveEvents, globalEvents, globalEventEmitter, ignoreContainerEvent, permanentTextControls, disabledControls$, onRemove, }: ConstructorArg);
43
40
  private emitContainerVisibilityEvent;
44
41
  registerEvents(): void;
45
42
  hide: () => void;
@@ -52,7 +49,6 @@ export declare class GameController {
52
49
  whilePlaying: () => void;
53
50
  reset(): void;
54
51
  removeView(): void;
55
- fakeRemoveView(remove?: boolean): void;
56
52
  destroy(): void;
57
53
  }
58
54
  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: boolean): {
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;
@@ -2,7 +2,7 @@ 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
4
  import type { Manifest } from '../../../manifest';
5
- import { TInteractiveRangeEndedEvent, TInteractivesActionChoiceEvent, TInteractivesActionExecutionEvent, TInteractivesContainerRemoved, TInteractivesContainerFakeRemoved, SubjectName, TInteractivesVisibility } from './events.types';
5
+ import { TInteractiveRangeEndedEvent, TInteractivesActionChoiceEvent, TInteractivesActionExecutionEvent, TInteractivesContainerRemoved, SubjectName, TInteractivesVisibility } from './events.types';
6
6
  export interface GlobalEvents {
7
7
  noInteraction$: Subject<void>;
8
8
  graphVisibilityChanged$: Subject<boolean>;
@@ -14,7 +14,6 @@ export interface GlobalEvents {
14
14
  manifestChanged$: Subject<Manifest>;
15
15
  interactiveRangeEnded$: Subject<TInteractiveRangeEndedEvent>;
16
16
  interactiveContainerRemoved$: Subject<TInteractivesContainerRemoved>;
17
- interactiveContainerFakeRemoved$: Subject<TInteractivesContainerFakeRemoved>;
18
17
  interactiveActionExecution$: Subject<TInteractivesActionExecutionEvent<SubjectName>>;
19
18
  interactiveActionChoice$: Subject<TInteractivesActionChoiceEvent<SubjectName>>;
20
19
  interactiveVisibilityChanged$: Subject<TInteractivesVisibility<'container'>>;
@@ -74,6 +73,5 @@ export declare enum InteractivesEventTypes {
74
73
  ACTION_EXECUTION = "action-execution",
75
74
  VISIBILITY = "visibility",
76
75
  CONTAINER_REMOVED = "container-removed",
77
- CONTAINER_FAKE_REMOVED = "container-fake-removed",
78
76
  RANGE_ENDED = "range-ended"
79
77
  }
@@ -47,6 +47,3 @@ export type TInteractivesActionChoiceEvent<T extends SubjectName> = TInteractive
47
47
  payload: TInteractivesActionChoiceEventPayload<T>;
48
48
  };
49
49
  export type TInteractivesContainerRemoved = TInteractiveCommon<'container', InteractivesEventTypes.CONTAINER_REMOVED>;
50
- export type TInteractivesContainerFakeRemoved = TInteractiveCommon<'container', InteractivesEventTypes.CONTAINER_FAKE_REMOVED> & {
51
- removeAllOpenURI: boolean;
52
- };
@@ -1,6 +1,5 @@
1
1
  import { type Control, type Chapter, type ChapterContainer } from '../../../manifest';
2
2
  import type { GameController } from './GameController';
3
- import type { IgnoreExpectState } from '../../../modules/Interactives/types';
4
3
  export declare enum GameStates {
5
4
  nothing = 0,
6
5
  beforeInteractive = 1,
@@ -25,5 +24,5 @@ export declare function excludeTextControl(containers?: ChapterContainer[]): Cha
25
24
  export declare const isEOVEndTime: (target: HTMLVideoElement, endTime: ChapterContainer["endTime"]) => boolean;
26
25
  export declare function partial<T extends unknown[], U extends unknown[], R>(fn: (...args: [...T, ...U]) => R, ...presetArgs: T): (...laterArgs: U) => R;
27
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>;
28
- export declare const evaluateContainerEventStatus: (container: ChapterContainer, gameControllers: GameController[]) => IgnoreExpectState;
27
+ export declare const shouldIgnoreContainerEvent: (container: ChapterContainer, gameControllers: GameController[]) => boolean;
29
28
  export {};
@@ -1,10 +1,6 @@
1
1
  import { type Container } from '../../../manifest';
2
- export type Subject = {
3
- id: string;
4
- isRemoved: boolean;
5
- };
6
2
  export type InteractiveRange = {
7
- subjects: Subject[];
3
+ subjects: string[];
8
4
  range: [number, number];
9
5
  };
10
6
  export type InteractiveRanges = Array<InteractiveRange>;
@@ -1,6 +1,9 @@
1
1
  import { type Control } from '../../../manifest';
2
2
  import { type Dimensions } from '../../../modules/Interactives/controls';
3
3
  export declare const classnamesPrefix = "interactive";
4
+ export declare const rootElClassName = "interactive-controls-container";
5
+ export declare const getRootEl: () => Element | null;
6
+ export declare const DISABLE_OPACITY = 0.4;
4
7
  export declare const controlStylesFallbacks: {
5
8
  textColor: string;
6
9
  textSize: number;
@@ -1,9 +0,0 @@
1
- import { Options, ControlEventCallback } from '../controls';
2
- import { AnimationsFeatureToggles } from '../types';
3
- export type ChoiceContainerOptions = {
4
- features: Pick<AnimationsFeatureToggles, never>;
5
- };
6
- export declare function isChoiceContainerOptions(options: Options): options is ChoiceContainerOptions;
7
- export type ContainerCreateViewParams = {
8
- eventCallback: ControlEventCallback;
9
- };
@@ -1,6 +0,0 @@
1
- export declare const CONTAINERS_CLASSNAME_PREFIX = "interactive-container";
2
- export declare const containersClassNames: {
3
- common: string;
4
- hidden: string;
5
- disabled: string;
6
- };
@@ -1,9 +0,0 @@
1
- export declare const CONTROLS_CLASSNAME_PREFIX = "interactive-control";
2
- export declare const controlsClassNames: {
3
- common: string;
4
- wrapper: string;
5
- disabled: string;
6
- button: string;
7
- area: string;
8
- text: string;
9
- };
@@ -1 +0,0 @@
1
- export declare const applyStyles: (attachToElement: HTMLElement) => void;