@vkontakte/videoplayer-interactive 1.0.27-dev.60ca8010.0 → 1.0.27-dev.7d383bee.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 (57) hide show
  1. package/es2015.cjs.js +6 -6
  2. package/es2015.esm.js +5 -5
  3. package/es2018.cjs.js +6 -6
  4. package/es2018.esm.js +6 -6
  5. package/esnext.cjs.js +5 -5
  6. package/esnext.esm.js +5 -5
  7. package/evergreen.esm.js +6 -6
  8. package/package.json +6 -6
  9. package/types/index.d.ts +3 -2
  10. package/types/modules/Graph/Graph.d.ts +2 -3
  11. package/types/modules/Interactives/Interactives.d.ts +13 -13
  12. package/types/modules/Interactives/Layout.d.ts +7 -7
  13. package/types/modules/Interactives/containers/ChoiceContainer.d.ts +3 -3
  14. package/types/modules/Interactives/containers/Container.d.ts +4 -4
  15. package/types/modules/Interactives/controls/Control.d.ts +4 -3
  16. package/types/modules/Interactives/controls/types.d.ts +5 -4
  17. package/types/modules/Interactives/index.d.ts +2 -2
  18. package/types/modules/Interactives/types.d.ts +3 -3
  19. package/types/modules/Interactives/utils/GameController.d.ts +2 -2
  20. package/types/modules/Interactives/utils/GroupsStack.d.ts +5 -5
  21. package/types/modules/Interactives/utils/HistoryController.d.ts +2 -3
  22. package/types/modules/Interactives/utils/InteractiveEvents.d.ts +2 -2
  23. package/types/modules/Interactives/utils/SelectBranches.d.ts +2 -2
  24. package/types/modules/Interactives/utils/SelectBranches.types.d.ts +12 -12
  25. package/types/modules/Interactives/utils/events.d.ts +2 -2
  26. package/types/modules/Interactives/utils/fallbackStrategies.d.ts +6 -6
  27. package/types/modules/Interactives/utils/gameUtils.d.ts +14 -14
  28. package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +1 -1
  29. package/types/modules/Interactives/utils/renderingUtils.d.ts +7 -9
  30. package/types/modules/Loaders/vkVideoLoader/types.d.ts +2 -2
  31. package/types/modules/Loaders/vkVideoLoader/utils.d.ts +2 -0
  32. package/types/modules/ManifestController/ManifestController.d.ts +12 -11
  33. package/types/modules/ManifestController/utils.d.ts +6 -6
  34. package/types/modules/SeamlessController/SeamlessController.d.ts +2 -2
  35. package/types/modules/SeamlessController/utils.d.ts +2 -2
  36. package/types/modules/SeekToInteractiveController/SeekToInteractiveController.d.ts +2 -2
  37. package/types/movika.core/manifest/index.d.ts +28 -0
  38. package/types/movika.core/manifest/manifest_3_2/chapter.d.ts +63 -0
  39. package/types/movika.core/manifest/manifest_3_2/control.d.ts +67 -0
  40. package/types/movika.core/manifest/manifest_3_2/manifest.d.ts +50 -0
  41. package/types/movika.core/manifest/manifest_3_2/template.d.ts +34 -0
  42. package/types/movika.core/manifest/manifest_3_3/chapter.d.ts +72 -0
  43. package/types/movika.core/manifest/manifest_3_3/control.d.ts +66 -0
  44. package/types/movika.core/manifest/manifest_3_3/graph.d.ts +73 -0
  45. package/types/movika.core/manifest/manifest_3_3/manifest.d.ts +52 -0
  46. package/types/movika.core/manifest/manifest_3_3/template.d.ts +34 -0
  47. package/types/movika.core/manifest/migrations/index.d.ts +1 -0
  48. package/types/movika.core/manifest/migrations/migrateManifestToLatestVersion.d.ts +1 -0
  49. package/types/movika.core/manifest/migrations/migrate_from_3_0_to_3_1.d.ts +21 -0
  50. package/types/movika.core/manifest/migrations/migrate_from_3_1_to_3_2.d.ts +2 -0
  51. package/types/movika.core/manifest/migrations/migrate_from_3_2_to_3_3.d.ts +8 -0
  52. package/types/{manifest/utils.d.ts → movika.core/manifest/types.d.ts} +6 -23
  53. package/types/movika.core/manifest/utils.d.ts +5 -0
  54. package/types/utils/LastFrame.d.ts +1 -1
  55. package/types/utils/chapterHelpers.d.ts +1 -1
  56. package/types/utils/extractVkMovieId.d.ts +1 -1
  57. package/types/manifest/index.d.ts +0 -3
@@ -0,0 +1,50 @@
1
+ import type { Chapter } from './chapter';
2
+ export type ManifestVideoVariantType = 'custom' | 'mp4' | 'hls' | 'dash' | 'mpeg';
3
+ export type Extensions = Exclude<ManifestVideoVariantType, 'custom'>;
4
+ export type Standard = '144p' | '240p' | '360p' | '480p' | '720p' | '1080p' | '1440p' | '2160p' | '4320p';
5
+ export interface CustomManifestVideoVariant {
6
+ type: Extract<ManifestVideoVariantType, 'custom'>;
7
+ payload: {
8
+ type: string;
9
+ id: string;
10
+ };
11
+ }
12
+ export interface DefaultManifestVideoVariant {
13
+ type: Extensions;
14
+ url: string;
15
+ size?: number | null;
16
+ standard?: Standard | null;
17
+ resolution?: string | null;
18
+ bitrate?: number | null;
19
+ cover?: string | null;
20
+ preview?: string | null;
21
+ }
22
+ export type ManifestVideoVariant = CustomManifestVideoVariant | DefaultManifestVideoVariant;
23
+ export interface ManifestVideo {
24
+ id: string;
25
+ duration?: number | null;
26
+ shortlink?: string | null;
27
+ variants: ManifestVideoVariant[];
28
+ title?: string;
29
+ }
30
+ export type Media = {
31
+ videos: ManifestVideo[];
32
+ };
33
+ export interface Metadata {
34
+ id: string;
35
+ version: '3.2';
36
+ build: number;
37
+ initChapterId?: string;
38
+ created: string;
39
+ updated: string;
40
+ types?: string[];
41
+ /**
42
+ * @deprecated
43
+ */
44
+ media?: Media | string;
45
+ }
46
+ export interface Manifest_3_2 {
47
+ metadata: Metadata;
48
+ media: Media;
49
+ chapters: Chapter[];
50
+ }
@@ -0,0 +1,34 @@
1
+ export interface ManifestDataTemplate {
2
+ /**
3
+ * uuid
4
+ */
5
+ id: string;
6
+ /**
7
+ * Template name
8
+ */
9
+ name: string;
10
+ /**
11
+ * Chapter type this template can be applied to
12
+ */
13
+ chapterType: 'start' | 'simple' | 'end';
14
+ /**
15
+ * Template includes stringified JSON object that applied to chapter
16
+ */
17
+ template: string;
18
+ /**
19
+ * Template data type to apply to
20
+ */
21
+ type: 'container';
22
+ /**
23
+ * Manifest version of template
24
+ */
25
+ manifestVersion: string;
26
+ /**
27
+ * Date when template was created
28
+ */
29
+ created?: number;
30
+ /**
31
+ * Date when template was updated
32
+ */
33
+ updated?: number;
34
+ }
@@ -0,0 +1,72 @@
1
+ import type { Control } from './control';
2
+ export type ChapterEventType = 'onSuspense';
3
+ export type ContainerEventType = 'onSuspense';
4
+ export type ChapterSuspenseActionType = 'setNextBranch' | 'setWeightlessRandomBranch' | 'setRandomBranch' | 'setMaxWeightBranch' | 'setMinWeightBranch' | 'setDefaultBranch' | 'continuePlayback' | 'openURI' | 'expect';
5
+ export type ContainerSuspenseActionType = 'setNextBranch' | 'continuePlayback' | 'expect' | 'openURI';
6
+ export interface ChapterEvent {
7
+ type: ChapterEventType;
8
+ action: {
9
+ type: ChapterSuspenseActionType;
10
+ args: {
11
+ branchId?: string;
12
+ shouldOpenNow: boolean;
13
+ isDetachContainer?: boolean;
14
+ uri?: string;
15
+ };
16
+ };
17
+ }
18
+ export interface ChapterBranch {
19
+ id: string;
20
+ chapterId: string;
21
+ weight?: number;
22
+ manifestUrl?: string;
23
+ isDefault?: boolean;
24
+ }
25
+ export interface ContainerEvent {
26
+ type: ContainerEventType;
27
+ action: {
28
+ type: ContainerSuspenseActionType;
29
+ args: {
30
+ branchId?: string;
31
+ shouldOpenNow: boolean;
32
+ isDetachContainer?: boolean;
33
+ uri?: string;
34
+ };
35
+ };
36
+ }
37
+ export interface ChapterContainer {
38
+ id: string;
39
+ /**
40
+ * Interactivity start time in milliseconds
41
+ */
42
+ startTime: number;
43
+ /**
44
+ * Interactivity end time in milliseconds
45
+ */
46
+ endTime?: number | null;
47
+ controls: Control[];
48
+ layout: {
49
+ type: 'Relative';
50
+ };
51
+ type: 'Choice' | 'TextInput';
52
+ events?: ContainerEvent[];
53
+ }
54
+ export interface Chapter {
55
+ id: string;
56
+ videoId?: string;
57
+ containers: ChapterContainer[];
58
+ branches: ChapterBranch[];
59
+ events?: ChapterEvent[];
60
+ label: string;
61
+ order: 'start' | 'end' | 'simple';
62
+ }
63
+ /**
64
+ * ------------ WARNING! ------------
65
+ * This is editor specific type only.
66
+ * Not used in stored manifest
67
+ */
68
+ export declare enum ChapterError {
69
+ NoVideo = 0,
70
+ NoEOV = 1,
71
+ NoBranches = 2
72
+ }
@@ -0,0 +1,66 @@
1
+ export type ControlType = 'Text' | 'Button' | 'Area';
2
+ export type ControlEventType = 'onClick';
3
+ export type ControlActionType = 'setNextBranch' | 'continuePlayback' | 'openURI';
4
+ export interface ControlEvent {
5
+ type: ControlEventType;
6
+ action: {
7
+ type: ControlActionType;
8
+ args: {
9
+ branchId?: string;
10
+ shouldOpenNow: boolean;
11
+ isDetachContainer?: boolean;
12
+ uri?: string;
13
+ };
14
+ };
15
+ }
16
+ export interface ControlLayoutParams {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ angle: number;
22
+ innerSizesDependOn?: 'video' | 'self';
23
+ }
24
+ export interface ControlProps {
25
+ text?: {
26
+ value: string;
27
+ gravityHorizontal: 'start' | 'end' | 'center';
28
+ gravityVertical: 'top' | 'bottom' | 'center';
29
+ color: string;
30
+ alpha: number;
31
+ size: number;
32
+ paddings?: {
33
+ top: number;
34
+ right: number;
35
+ bottom: number;
36
+ left: number;
37
+ };
38
+ /**
39
+ * @deprecated accepted but no one uses
40
+ */
41
+ alignment?: 'left' | 'right' | 'center';
42
+ };
43
+ background: {
44
+ type: 'color';
45
+ color: string;
46
+ alpha: number;
47
+ src?: string;
48
+ };
49
+ shape: {
50
+ type: 'rectangle';
51
+ roundCorners: number;
52
+ border: {
53
+ width: number;
54
+ color: string;
55
+ alpha: number;
56
+ };
57
+ };
58
+ }
59
+ export interface Control {
60
+ id: string;
61
+ type: ControlType;
62
+ label: string;
63
+ layoutParams: ControlLayoutParams;
64
+ props: ControlProps;
65
+ events?: ControlEvent[];
66
+ }
@@ -0,0 +1,73 @@
1
+ export interface GraphBackground {
2
+ color?: string;
3
+ grid?: {
4
+ enabled?: boolean;
5
+ color?: string;
6
+ };
7
+ }
8
+ export interface GraphCustomChapter {
9
+ id: string;
10
+ x: number;
11
+ y: number;
12
+ }
13
+ export interface GraphEditDefaultChapter {
14
+ flipTo?: {
15
+ enabled?: boolean;
16
+ backgroundColor?: string;
17
+ textColor?: string;
18
+ };
19
+ controls?: {
20
+ enabled?: boolean;
21
+ backgroundColor?: string;
22
+ textColor?: string;
23
+ };
24
+ hover?: {
25
+ enabled?: boolean;
26
+ borderColor?: string;
27
+ shadowColor?: string;
28
+ };
29
+ }
30
+ export type GraphEditChapter = GraphCustomChapter & GraphEditDefaultChapter;
31
+ export interface GraphViewDefaultChapter extends GraphEditDefaultChapter {
32
+ watchAgain?: {
33
+ enabled?: boolean;
34
+ backgroundColor?: string;
35
+ textColor?: string;
36
+ };
37
+ preview?: {
38
+ enabled?: boolean;
39
+ backgroundColor?: string;
40
+ textColor?: string;
41
+ };
42
+ goBlind?: boolean;
43
+ }
44
+ export type GraphViewChapter = Pick<GraphCustomChapter, 'id'> & Partial<Pick<GraphCustomChapter, 'x' | 'y'>> & GraphViewDefaultChapter;
45
+ export interface GraphDefaultBranch {
46
+ display?: boolean;
47
+ color?: string;
48
+ connectionColor?: string;
49
+ actionConnectionColor?: string;
50
+ actionIconColor?: string;
51
+ inactionConnectionColor?: string;
52
+ inactionIconColor?: string;
53
+ displayActionConnections?: boolean;
54
+ }
55
+ export interface GraphBranch extends GraphDefaultBranch {
56
+ id: string;
57
+ }
58
+ export interface GraphDesign {
59
+ edit: {
60
+ background?: GraphBackground;
61
+ defaultChapter?: GraphEditDefaultChapter;
62
+ chapters: GraphEditChapter[];
63
+ defaultBranch?: GraphDefaultBranch;
64
+ branches?: GraphBranch[];
65
+ };
66
+ view: {
67
+ background?: GraphBackground;
68
+ defaultChapter?: GraphViewDefaultChapter;
69
+ chapters?: GraphViewChapter[];
70
+ defaultBranch?: GraphDefaultBranch;
71
+ branches?: GraphBranch[];
72
+ };
73
+ }
@@ -0,0 +1,52 @@
1
+ import type { Chapter } from './chapter';
2
+ import type { GraphDesign } from './graph';
3
+ export type ManifestVideoVariantType = 'custom' | 'mp4' | 'hls' | 'dash' | 'mpeg';
4
+ export type Extensions = Exclude<ManifestVideoVariantType, 'custom'>;
5
+ export type Standard = '144p' | '240p' | '360p' | '480p' | '720p' | '1080p' | '1440p' | '2160p' | '4320p';
6
+ export interface CustomManifestVideoVariant {
7
+ type: Extract<ManifestVideoVariantType, 'custom'>;
8
+ payload: {
9
+ type: string;
10
+ id: string;
11
+ };
12
+ }
13
+ export interface DefaultManifestVideoVariant {
14
+ type: Extensions;
15
+ url: string;
16
+ size?: number | null;
17
+ standard?: Standard | null;
18
+ resolution?: string | null;
19
+ bitrate?: number | null;
20
+ cover?: string | null;
21
+ preview?: string | null;
22
+ }
23
+ export type ManifestVideoVariant = CustomManifestVideoVariant | DefaultManifestVideoVariant;
24
+ export interface ManifestVideo {
25
+ id: string;
26
+ duration?: number | null;
27
+ shortlink?: string | null;
28
+ variants: ManifestVideoVariant[];
29
+ title?: string;
30
+ }
31
+ export type Media = {
32
+ videos: ManifestVideo[];
33
+ };
34
+ export interface Metadata {
35
+ id: string;
36
+ version: '3.3';
37
+ build: number;
38
+ initChapterId?: string;
39
+ created: string;
40
+ updated: string;
41
+ types?: string[];
42
+ /**
43
+ * @deprecated
44
+ */
45
+ media?: Media | string;
46
+ }
47
+ export interface Manifest_3_3 {
48
+ metadata: Metadata;
49
+ media: Media;
50
+ chapters: Chapter[];
51
+ graph: GraphDesign;
52
+ }
@@ -0,0 +1,34 @@
1
+ export interface ManifestDataTemplate {
2
+ /**
3
+ * uuid
4
+ */
5
+ id: string;
6
+ /**
7
+ * Template name
8
+ */
9
+ name: string;
10
+ /**
11
+ * Chapter type this template can be applied to
12
+ */
13
+ chapterType: 'start' | 'simple' | 'end';
14
+ /**
15
+ * Template includes stringified JSON object that applied to chapter
16
+ */
17
+ template: string;
18
+ /**
19
+ * Template data type to apply to
20
+ */
21
+ type: 'container';
22
+ /**
23
+ * Manifest version of template
24
+ */
25
+ manifestVersion: string;
26
+ /**
27
+ * Date when template was created
28
+ */
29
+ created?: number;
30
+ /**
31
+ * Date when template was updated
32
+ */
33
+ updated?: number;
34
+ }
@@ -0,0 +1 @@
1
+ export { migrateManifestToLatestVersion } from "./migrateManifestToLatestVersion";
@@ -0,0 +1 @@
1
+ export function migrateManifestToLatestVersion(manifest: any): any;
@@ -0,0 +1,21 @@
1
+ export const DEFAULT_MANIFEST_VERSION: "3.1";
2
+ export namespace FALLBACK_STRATEGY_TO_ACTION_TYPE {
3
+ let _default: string;
4
+ export { _default as default };
5
+ export let random: string;
6
+ export let weightlessRandom: string;
7
+ export let max: string;
8
+ export let min: string;
9
+ }
10
+ export namespace defaultEvent {
11
+ let type: string;
12
+ namespace action {
13
+ let type_1: string;
14
+ export { type_1 as type };
15
+ export namespace args {
16
+ let shouldOpenNow: boolean;
17
+ let isDetachContainer: boolean;
18
+ }
19
+ }
20
+ }
21
+ export function migrate_from_3_0_to_3_1(manifest: any): any;
@@ -0,0 +1,2 @@
1
+ export const DEFAULT_MANIFEST_VERSION: "3.2";
2
+ export function migrate_from_3_1_to_3_2(manifest: any): any;
@@ -0,0 +1,8 @@
1
+ import type { Manifest_3_2 } from '../manifest_3_2/manifest';
2
+ import type { ChapterEvent, ContainerEvent } from '../manifest_3_3/chapter';
3
+ import type { GraphCustomChapter, GraphDesign } from '../manifest_3_3/graph';
4
+ import type { Manifest_3_3 } from '../manifest_3_3/manifest';
5
+ export declare const DEFAULT_MANIFEST_VERSION = "3.3";
6
+ export declare const createDefaultGraphDesign: (chapters?: GraphCustomChapter[] | undefined) => GraphDesign;
7
+ export declare const expectEvent: ContainerEvent & ChapterEvent;
8
+ export declare const migrate_from_3_2_to_3_3: (manifest: Manifest_3_2) => Manifest_3_3;
@@ -1,39 +1,18 @@
1
- import { EventActionTypes, type AnyManifest, type AnyControl } from '../manifest';
2
- /**
3
- * checks manifest object validity
4
- * @param manifest - manifest to check
5
- * @returns true is valid, false is invalid
6
- */
7
- export declare const isValidManifest: (manifest: AnyManifest) => boolean;
8
- export declare const isTextControl: (controlItem: AnyControl) => boolean;
9
- export declare const isButtonControl: (controlItem: AnyControl) => boolean;
10
- export declare const isAreaControl: (controlItem: AnyControl) => boolean;
11
- export type EventActionKeys = keyof typeof EventActionTypes;
12
- /**
13
- * @deprecated use ContainerTypes enum instead
14
- */
1
+ import type { Chapter } from './manifest_3_3/chapter';
2
+ export type { Control } from './manifest_3_3/control';
15
3
  export declare const containerTypes: {
16
4
  readonly Choice: "Choice";
17
5
  readonly TextInput: "TextInput";
18
6
  };
19
- /**
20
- * @deprecated use ControlTypes enum instead
21
- */
22
7
  export declare const controlTypes: {
23
8
  readonly Button: "Button";
24
9
  readonly Area: "Area";
25
10
  readonly Text: "Text";
26
11
  };
27
- /**
28
- * @deprecated use EventTypes enum instead
29
- */
30
12
  export declare const eventTypes: {
31
13
  readonly onClick: "onClick";
32
14
  readonly onSuspense: "onSuspense";
33
15
  };
34
- /**
35
- * @deprecated use EventActionTypes enum instead
36
- */
37
16
  export declare const eventActionTypes: {
38
17
  readonly openURI: "openURI";
39
18
  readonly setNextBranch: "setNextBranch";
@@ -45,3 +24,7 @@ export declare const eventActionTypes: {
45
24
  readonly continuePlayback: "continuePlayback";
46
25
  readonly expect: "expect";
47
26
  };
27
+ export type EventActionTypes = typeof eventActionTypes[keyof typeof eventActionTypes];
28
+ export type VideoId = number | string;
29
+ export type ChapterContainers = Chapter['containers'];
30
+ export type { Chapter } from './manifest_3_3/chapter';
@@ -0,0 +1,5 @@
1
+ export function isSupportedManifest(manifestVersion: string): boolean;
2
+ export function isValidManifest(manifest: object): boolean;
3
+ export function isTextControl(controlItem: any): boolean;
4
+ export function isButtonControl(controlItem: any): boolean;
5
+ export function isAreaControl(controlItem: any): boolean;
@@ -1,4 +1,4 @@
1
- import type { Chapter } from '../manifest';
1
+ import type { Chapter } from '../movika.core/manifest';
2
2
  import { LastFrameCanvasAPI } from './LastFrameCanvasAPI';
3
3
  type ConstructorParams = {
4
4
  parentElement: HTMLElement;
@@ -1,4 +1,4 @@
1
- import type { Manifest, ManifestVideoVariant, ManifestVideo, VideoId } from '../manifest';
1
+ import type { Manifest, ManifestVideoVariant, ManifestVideo, VideoId } from '../movika.core/manifest';
2
2
  export declare const chapterIdsToVKVideoIds: (chapterIds: string[], interactiveManifest: Manifest) => number[];
3
3
  export declare const getVideoRawIdByMedia: (mediaVideo: ManifestVideo) => string | undefined;
4
4
  export declare const isVKVariantItem: (variantItem: ManifestVideoVariant) => boolean;
@@ -1,2 +1,2 @@
1
- import type { ManifestVideo } from '../manifest';
1
+ import type { ManifestVideo } from '../movika.core/manifest';
2
2
  export declare const extractVkMovieId: (media: ManifestVideo) => [] | [string, string];
@@ -1,3 +0,0 @@
1
- export type { ChapterContainer, ChapterContainer as Container, Chapter, Control, Manifest, ManifestVideo, ManifestVideoVariant, Media, Metadata, VideoId, CustomManifestVideoVariant, Extension, AnyManifest, AnyControl, GraphEditChapter, GraphViewChapter, ChapterBranch, Standard, ControlLayoutParams, ControlEvent, ContainerEvent, ChapterEvent, } from '@interactiveplatform/movika-manifest';
2
- export { isSupportedManifest, ContainerTypes, ControlTypes, EventActionTypes, EventTypes, migrateManifestToLatestVersion, compareVersions, } from '@interactiveplatform/movika-manifest';
3
- export * from './utils';