@vkontakte/videoplayer-statistics 1.0.100-dev.04f0bb5f.0 → 1.0.100-dev.319d6ebf.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2018.cjs +3 -3
- package/es2018.esm.js +3 -3
- package/es2024.cjs +3 -3
- package/es2024.esm.js +3 -3
- package/esnext.cjs +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +3 -3
- package/types/ShareVSID.d.ts +3 -3
- package/types/index.d.ts +6 -5
- package/types/mediascopePixel/MediascopePixel.d.ts +36 -36
- package/types/mediascopePixel/Stopwatch.d.ts +10 -10
- package/types/mediascopePixel/types.d.ts +5 -5
- package/types/oneStat/Api.d.ts +35 -34
- package/types/oneStat/ApiTransport.d.ts +19 -19
- package/types/oneStat/Logger.d.ts +35 -35
- package/types/oneStat/OneStat.d.ts +309 -307
- package/types/oneStat/config.d.ts +32 -32
- package/types/oneStat/env.d.ts +3 -3
- package/types/oneStat/index.d.ts +9 -6
- package/types/oneStat/types.d.ts +43 -43
- package/types/oneStat/uiEvents.d.ts +19 -19
- package/types/oneStat/utils/mappers.d.ts +2 -2
- package/types/oneStat/utils/shorten.d.ts +1 -1
- package/types/oneStat/utils/timeSynchronisation.d.ts +8 -8
- package/types/oneStat/utils/watchCoverage.d.ts +4 -4
- package/types/oneStat/values.d.ts +63 -64
- package/types/shared/useModeController.d.ts +6 -5
- package/types/thinOneStat/Api.d.ts +32 -32
- package/types/thinOneStat/ApiTransport.d.ts +19 -19
- package/types/thinOneStat/Logger.d.ts +35 -35
- package/types/thinOneStat/ThinOneStat.d.ts +271 -271
- package/types/thinOneStat/config.d.ts +21 -20
- package/types/thinOneStat/env.d.ts +3 -3
- package/types/thinOneStat/events.d.ts +21 -21
- package/types/thinOneStat/index.d.ts +6 -4
- package/types/thinOneStat/types.d.ts +24 -24
- package/types/thinOneStat/utils/calculateTotalViewTime.d.ts +2 -2
- package/types/thinOneStat/utils/downloadBytes.d.ts +4 -4
- package/types/thinOneStat/utils/mappers.d.ts +3 -2
- package/types/thinOneStat/utils/timeSynchronisation.d.ts +8 -8
- package/types/thinOneStat/utils/watchCoverage.d.ts +4 -4
- package/types/thinOneStat/utils/watchedN.d.ts +5 -5
- package/types/thinOneStat/values.d.ts +67 -67
- package/es2015.cjs +0 -6
- package/es2015.esm.js +0 -6
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { ILogCustomData } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import type { RecursivePartial } from
|
|
1
|
+
import type { ILogCustomData } from "./types";
|
|
2
|
+
import type { Operation } from "./values";
|
|
3
|
+
import { ApiEnv } from "./values";
|
|
4
|
+
import type { RecursivePartial, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
5
5
|
export interface IConfig {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
6
|
+
apiEnv: ApiEnv;
|
|
7
|
+
apiKey: string;
|
|
8
|
+
apiBaseUrl: string | null;
|
|
9
|
+
requestRetryCount: number;
|
|
10
|
+
useVsid64: boolean;
|
|
11
|
+
firstFlushTime: Milliseconds;
|
|
12
|
+
flushDebounceTime: Milliseconds;
|
|
13
|
+
flushMaxWait: Milliseconds;
|
|
14
|
+
storageExpiration: Milliseconds;
|
|
15
|
+
watchCoverageInterval: Milliseconds;
|
|
16
|
+
disabledOperations: Operation[];
|
|
17
|
+
disabledCustomFields: (keyof ILogCustomData)[];
|
|
18
|
+
shorten: boolean;
|
|
19
|
+
maxLoops: number;
|
|
20
|
+
embedUrlParams: string[];
|
|
21
|
+
useBeacon: boolean;
|
|
22
|
+
clearStorageAtUnload: boolean;
|
|
23
|
+
synchronizeTime: boolean;
|
|
24
|
+
debugLog: boolean;
|
|
25
|
+
useVKComIsMobileLogic: boolean;
|
|
26
|
+
backoff: {
|
|
27
|
+
start: Milliseconds;
|
|
28
|
+
factor: number;
|
|
29
|
+
max: Milliseconds;
|
|
30
|
+
random: number;
|
|
31
|
+
};
|
|
32
|
+
useKeepalive: boolean;
|
|
33
|
+
watchCoverageTimeoutFix: boolean;
|
|
34
34
|
}
|
|
35
35
|
export type IOptionalConfig = RecursivePartial<IConfig>;
|
|
36
36
|
export declare const fillDefault: (partial: IOptionalConfig) => IConfig;
|
package/types/oneStat/env.d.ts
CHANGED
package/types/oneStat/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export {
|
|
1
|
+
import { OneStat } from "./OneStat";
|
|
2
|
+
import type { IOneStat, IStatContext, IConstructorParams } from "./OneStat";
|
|
3
|
+
import { ApiEnv, ContentType, Quality, ConnectionType, SeekAction, InteractiveInterfaceClick } from "./values";
|
|
4
|
+
import type { InterfaceClick } from "./values";
|
|
5
|
+
import type { IUIEvents, IAdsEvents, IInteractiveEvents } from "./uiEvents";
|
|
6
|
+
export { OneStat, ApiEnv, ContentType, Quality, ConnectionType, SeekAction, InteractiveInterfaceClick };
|
|
7
|
+
export type { IOneStat, IStatContext, IConstructorParams, IUIEvents, IAdsEvents, IInteractiveEvents, InterfaceClick };
|
|
8
|
+
export { VERSION } from "../env";
|
|
9
|
+
export type { IOptionalConfig } from "./config";
|
package/types/oneStat/types.d.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { Kbps, Milliseconds, Seconds } from
|
|
2
|
-
import { ConnectionType, ContentType, Flag, Mode, Network, Operation, Quality, StatType } from
|
|
1
|
+
import type { Kbps, Milliseconds, Seconds } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { ConnectionType, ContentType, Flag, Mode, Network, Operation, Quality, StatType } from "./values";
|
|
3
3
|
export interface ILogItem {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
operation: Operation;
|
|
5
|
+
type: 1;
|
|
6
|
+
time?: Seconds | Milliseconds;
|
|
7
|
+
timestamp: Milliseconds;
|
|
8
|
+
network?: Network;
|
|
9
|
+
custom: ILogCustomData;
|
|
10
10
|
}
|
|
11
11
|
export interface ILogCustomData {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Сессия смотрения, уникальна для пользователя, контента, экземпляра плеера и одного просмотра
|
|
14
|
+
* См https://confluence.vk.team/display/VID/Video%20Session%20ID
|
|
15
|
+
*/
|
|
16
|
+
vsid: string;
|
|
17
|
+
uid?: string;
|
|
18
|
+
isid?: string;
|
|
19
|
+
vid: number;
|
|
20
|
+
ct?: ContentType;
|
|
21
|
+
place?: string;
|
|
22
|
+
quality?: Quality;
|
|
23
|
+
cdn_host?: string;
|
|
24
|
+
stat_type?: StatType;
|
|
25
|
+
param?: any;
|
|
26
|
+
vk_app_id?: string;
|
|
27
|
+
track_code?: string;
|
|
28
|
+
connection_type?: ConnectionType;
|
|
29
|
+
connection_reused?: Flag;
|
|
30
|
+
cached_data?: Flag;
|
|
31
|
+
live?: Flag;
|
|
32
|
+
muted?: Flag;
|
|
33
|
+
mode?: Mode;
|
|
34
|
+
subtitles?: string;
|
|
35
|
+
failover?: Flag;
|
|
36
|
+
download_speed?: Kbps;
|
|
37
|
+
manual_quality?: Flag;
|
|
38
|
+
ref_domain?: string;
|
|
39
|
+
direct_url?: string;
|
|
40
|
+
rate?: string;
|
|
41
|
+
view_360?: 1;
|
|
42
|
+
vk_playlist_id?: string;
|
|
43
|
+
aid?: string;
|
|
44
|
+
in_history?: 1;
|
|
45
|
+
latency?: number;
|
|
46
|
+
buffer_latency?: number;
|
|
47
47
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { IObservable } from
|
|
2
|
-
import { InteractiveInterfaceClick } from
|
|
3
|
-
import type { SeekAction } from
|
|
1
|
+
import type { IObservable } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { InteractiveInterfaceClick } from "./values";
|
|
3
|
+
import type { SeekAction } from "./values";
|
|
4
4
|
export interface IUIEvents {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
actionRewind$?: IObservable<void>;
|
|
6
|
+
actionSeek$?: IObservable<SeekAction>;
|
|
7
|
+
inPiP$?: IObservable<boolean>;
|
|
8
|
+
inFullscreen$?: IObservable<boolean>;
|
|
9
|
+
actionSetSubtitle$?: IObservable<string>;
|
|
10
|
+
nextMovie$?: IObservable<number>;
|
|
11
11
|
}
|
|
12
12
|
export interface IAdsEvents {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
slotRequested$?: IObservable<void>;
|
|
14
|
+
started$?: IObservable<string>;
|
|
15
|
+
paused$?: IObservable<void>;
|
|
16
|
+
resumed$?: IObservable<void>;
|
|
17
|
+
ended$?: IObservable<string>;
|
|
18
|
+
skipped$?: IObservable<void>;
|
|
19
|
+
clicked$?: IObservable<string>;
|
|
20
|
+
error$?: IObservable<string>;
|
|
21
21
|
}
|
|
22
22
|
export interface IInteractiveEvents {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
click$?: IObservable<InteractiveInterfaceClick>;
|
|
24
|
+
nextMovie$?: IObservable<number>;
|
|
25
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpConnectionType as CoreConnectionType, Surface, VideoFormat, VideoQuality } from
|
|
2
|
-
import { ConnectionType as StatisticsConnectionType, ContentType, Mode, Network, Quality } from
|
|
1
|
+
import { HttpConnectionType as CoreConnectionType, Surface, VideoFormat, VideoQuality } from "@vkontakte/videoplayer-core";
|
|
2
|
+
import { ConnectionType as StatisticsConnectionType, ContentType, Mode, Network, Quality } from "../values";
|
|
3
3
|
export declare const quality: (coreQuality: VideoQuality | undefined) => Quality | undefined;
|
|
4
4
|
export declare const connectionType: (coreType: CoreConnectionType | undefined) => StatisticsConnectionType | undefined;
|
|
5
5
|
export declare const contentType: (format: VideoFormat | undefined) => ContentType | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ILogItem } from
|
|
1
|
+
import type { ILogItem } from "../types";
|
|
2
2
|
export declare const shorten: (item: ILogItem) => object;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Milliseconds } from
|
|
1
|
+
import type { Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
2
2
|
export declare class TimeSynchronisation {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
private offset;
|
|
4
|
+
constructor(initialOffset?: Milliseconds);
|
|
5
|
+
getOffset(): Milliseconds;
|
|
6
|
+
setOffset(offset: Milliseconds): void;
|
|
7
|
+
now(): number;
|
|
8
|
+
date(date?: Date): Date;
|
|
9
|
+
addServerTime(serverTime: Milliseconds, rtt: Milliseconds): void;
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IPlayer } from
|
|
2
|
-
import { IObservable, IRange, Milliseconds, Seconds } from
|
|
1
|
+
import type { IPlayer } from "@vkontakte/videoplayer-core";
|
|
2
|
+
import type { IObservable, IRange, Milliseconds, Seconds } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
export type IParams = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
forceInterval: Milliseconds;
|
|
5
|
+
watchCoverageTimeoutFix: boolean;
|
|
6
6
|
};
|
|
7
7
|
export declare const watchCoverage: (player: IPlayer, params: IParams) => IObservable<IRange<Seconds>>;
|
|
@@ -1,86 +1,85 @@
|
|
|
1
|
-
import { ILogCustomData } from
|
|
2
|
-
export type Operation =
|
|
3
|
-
'failover' | 'quality' | 'play_toggle' | 'pause' | 'adv' | 'playing';
|
|
1
|
+
import type { ILogCustomData } from "./types";
|
|
2
|
+
export type Operation = "action_play" | "action_play_interactive" | "first_bytes" | "player_ready" | "first_frame" | "seek" | "watch_coverage_record" | "watch_coverage_live" | "empty_buffer" | "action_stop" | "close_at_empty_buffer" | "content_error" | "player_interface_click" | "next_movie" | "track_switch" | "failover" | "quality" | "play_toggle" | "pause" | "adv" | "playing";
|
|
4
3
|
export declare enum ApiEnv {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
PROD = "prod",
|
|
5
|
+
VK_ALIAS = "vk_alias",
|
|
6
|
+
VIDEOTEST = "videotest",
|
|
7
|
+
TEST = "test",
|
|
8
|
+
OKCDN = "okcdn",
|
|
9
|
+
AUTO = "auto"
|
|
11
10
|
}
|
|
12
11
|
export declare enum Quality {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
Q144P = "mobile",
|
|
13
|
+
Q240P = "lowest",
|
|
14
|
+
Q360P = "low",
|
|
15
|
+
Q480P = "medium",
|
|
16
|
+
Q720P = "high",
|
|
17
|
+
Q1080P = "fullhd",
|
|
18
|
+
Q1440P = "quadhd",
|
|
19
|
+
Q2160P = "ultrahd",
|
|
20
|
+
UNKNOWN = "unknown"
|
|
22
21
|
}
|
|
23
22
|
export declare enum ContentType {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
MP4 = "mp4",
|
|
24
|
+
DASH = "dash",
|
|
25
|
+
DASH_SEP = "dash_sep",
|
|
26
|
+
ONDEMAND_DASH = "ondemand_dash",
|
|
27
|
+
HLS = "hls",
|
|
28
|
+
HLS_FMP4 = "hls_fmp4",
|
|
29
|
+
ONDEMAND_HLS = "ondemand_hls",
|
|
30
|
+
WEBM = "webm",
|
|
31
|
+
AV1 = "av1",
|
|
32
|
+
ONDEMAND_DASH_LIVE = "ondemand_dash_live",
|
|
33
|
+
ONDEMAND_HLS_LIVE = "ondemand_hls_live",
|
|
34
|
+
WEBRTC = "webrtc",
|
|
35
|
+
UNKNOWN = "unknown",
|
|
36
|
+
/** @deprecated сдк не поддерживает RTMP, не нужно его использовать */
|
|
37
|
+
RTMP = "rtmp"
|
|
39
38
|
}
|
|
40
39
|
export declare enum StatType {
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
AUTO = "auto",
|
|
41
|
+
MANUAL = ""
|
|
43
42
|
}
|
|
44
43
|
export declare enum ConnectionType {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
HTTP1 = "http1",
|
|
45
|
+
HTTP2 = "http2",
|
|
46
|
+
HTTP3 = "http3"
|
|
48
47
|
}
|
|
49
48
|
export declare enum Flag {
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
YES = 1,
|
|
50
|
+
NO = 0
|
|
52
51
|
}
|
|
53
52
|
export declare enum Network {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
EXCELLENT = "excellent",
|
|
54
|
+
GOOD = "good",
|
|
55
|
+
POOR = "poor"
|
|
57
56
|
}
|
|
58
57
|
export declare enum Mode {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
PIP = "pip",
|
|
59
|
+
FULLSCREEN = "fullscreen",
|
|
60
|
+
EXTERNAL = "external",
|
|
61
|
+
PREFETCH = "prefetch",
|
|
62
|
+
AIRPLAY = "airplay",
|
|
63
|
+
CHROMECAST = "chromecast",
|
|
64
|
+
INVISIBLE = "invisible",
|
|
65
|
+
MINIMAL = "minimal"
|
|
67
66
|
}
|
|
68
67
|
export declare enum SeekAction {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
SLIDER = "slider",
|
|
69
|
+
RICH = "rich",
|
|
70
|
+
DOUBLE_TAP = "double_tap",
|
|
71
|
+
TIME_CODE = "time_code",
|
|
72
|
+
EPISODE = "episode",
|
|
73
|
+
REWIND = "rewind",
|
|
74
|
+
LIVE = "live",
|
|
75
|
+
UNKNOWN = "unknown"
|
|
77
76
|
}
|
|
78
77
|
export declare enum InteractiveInterfaceClick {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
GRAPH_SHOW = "iGraphShow",
|
|
79
|
+
GRAPH_HIDE = "iGraphHide",
|
|
80
|
+
NEXT_AREA = "iNextChapterArea",
|
|
81
|
+
NEXT_BUTTON = "iNextChapterBtn",
|
|
82
|
+
WATCH_AGAIN = "iWatchAgainBtn"
|
|
84
83
|
}
|
|
85
84
|
export type InterfaceClick = InteractiveInterfaceClick;
|
|
86
85
|
export declare const OperationAliases: Partial<Record<Operation, string>>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IUIEvents as IUIEventsOneStat } from
|
|
2
|
-
import { IUIEvents as IUIEventsThinOneStat } from
|
|
3
|
-
import { IPlayer
|
|
4
|
-
import {
|
|
1
|
+
import type { IUIEvents as IUIEventsOneStat } from "../oneStat";
|
|
2
|
+
import type { IUIEvents as IUIEventsThinOneStat } from "../thinOneStat";
|
|
3
|
+
import type { IPlayer } from "@vkontakte/videoplayer-core";
|
|
4
|
+
import { Surface } from "@vkontakte/videoplayer-core";
|
|
5
|
+
import type { IListener, IObservable } from "@vkontakte/videoplayer-shared";
|
|
5
6
|
/** конроллер для состояния mode плеера */
|
|
6
7
|
export declare const useModeController: (uiEvents: IUIEventsOneStat | IUIEventsThinOneStat, subscribe: <T>(observable: IObservable<T> | undefined, logger: IListener<T>) => void, player?: IPlayer) => {
|
|
7
|
-
|
|
8
|
+
surface$: IObservable<Surface | undefined>;
|
|
8
9
|
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import type { ISubject, IError, IValueObservable } from
|
|
2
|
-
import { ValueSubject } from
|
|
3
|
-
import type { IApiTransport } from
|
|
4
|
-
import type { ILogItem } from
|
|
5
|
-
import type { IConfig } from
|
|
1
|
+
import type { ISubject, IError, IValueObservable } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import { ValueSubject } from "@vkontakte/videoplayer-shared";
|
|
3
|
+
import type { IApiTransport } from "./ApiTransport";
|
|
4
|
+
import type { ILogItem } from "./types";
|
|
5
|
+
import type { IConfig } from "./config";
|
|
6
6
|
export interface IApi {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
authorized$: IValueObservable<boolean>;
|
|
8
|
+
authorize(authToken?: string): Promise<string | undefined>;
|
|
9
|
+
logBeacon(items: ILogItem[]): void;
|
|
10
|
+
logRequest(items: ILogItem[]): Promise<void>;
|
|
11
|
+
destroy(): void;
|
|
12
12
|
}
|
|
13
13
|
export interface IApiParams {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
config: IConfig;
|
|
15
|
+
deviceId: string;
|
|
16
|
+
apiTransport: IApiTransport;
|
|
17
|
+
error$: ISubject<IError>;
|
|
18
|
+
refreshAuthToken?: () => Promise<string | undefined>;
|
|
19
19
|
}
|
|
20
20
|
export declare class Api implements IApi {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
authorized$: ValueSubject<boolean>;
|
|
22
|
+
private params;
|
|
23
|
+
private authToken?;
|
|
24
|
+
private sessionKey?;
|
|
25
|
+
private authorizePromise?;
|
|
26
|
+
private refreshAuthTokenPromise?;
|
|
27
|
+
private consequentAuthErrors;
|
|
28
|
+
private backoffTimeoutId;
|
|
29
|
+
constructor(params: IApiParams);
|
|
30
|
+
authorize(authToken?: string): Promise<string | undefined>;
|
|
31
|
+
logBeacon(items: ILogItem[]): void;
|
|
32
|
+
logRequest(items: ILogItem[]): Promise<void>;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
private refreshAuthToken;
|
|
35
|
+
private createLogParams;
|
|
36
|
+
private authorizeWithBackoff;
|
|
37
|
+
private doAuthorize;
|
|
38
38
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { ISubject, IError } from
|
|
2
|
-
import type { IConfig } from
|
|
3
|
-
import type { TimeSynchronisation } from
|
|
1
|
+
import type { ISubject, IError } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IConfig } from "./config";
|
|
3
|
+
import type { TimeSynchronisation } from "./utils/timeSynchronisation";
|
|
4
4
|
export interface IApiTransport {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
sendBeacon(method: string, params: Record<string, unknown>, sessionKey?: string): boolean;
|
|
6
|
+
sendRequest<T = unknown>(method: string, params: Record<string, unknown>, sessionKey?: string, headers?: Record<string, unknown>): Promise<T>;
|
|
7
7
|
}
|
|
8
8
|
export interface IApiTransportParams {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
config: IConfig;
|
|
10
|
+
timeSynchronisation?: TimeSynchronisation;
|
|
11
|
+
error$: ISubject<IError>;
|
|
12
12
|
}
|
|
13
13
|
export declare class ApiTransport implements IApiTransport {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
private params;
|
|
15
|
+
private apiKey;
|
|
16
|
+
private apiBaseUrl;
|
|
17
|
+
private apiEnv;
|
|
18
|
+
private isApiBaseUrlFetched;
|
|
19
|
+
private timeSynchronisation?;
|
|
20
|
+
constructor(params: IApiTransportParams);
|
|
21
|
+
sendBeacon(method: string, params: Record<string, unknown>, sessionKey?: string): boolean;
|
|
22
|
+
sendRequest<T = unknown>(method: string, params: Record<string, unknown>, sessionKey?: string, headers?: Record<string, unknown>): Promise<T>;
|
|
23
|
+
private resolveApiBaseUrl;
|
|
24
|
+
private prepareQueryParams;
|
|
25
25
|
}
|