@tivio/sdk-react 3.3.1 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/.madgerc +7 -0
  2. package/README.md +14 -6
  3. package/README.md.bak +14 -10
  4. package/dist/index.d.ts +1279 -20
  5. package/dist/index.js +1 -2
  6. package/package.json +13 -12
  7. package/dist/components/ContextProvider.d.ts +0 -7
  8. package/dist/components/PlayerProvider.d.ts +0 -19
  9. package/dist/components/TivioProvider.d.ts +0 -16
  10. package/dist/components/TivioWidget.d.ts +0 -7
  11. package/dist/components/TivioWidgetError.d.ts +0 -10
  12. package/dist/components/TivioWidgetLoader.d.ts +0 -6
  13. package/dist/components/TvTivioProvider.d.ts +0 -7
  14. package/dist/components/context/ChannelsContext.d.ts +0 -6
  15. package/dist/components/context/RowItemsContext.d.ts +0 -7
  16. package/dist/components/context/ScreensContext.d.ts +0 -6
  17. package/dist/components/context/SectionsContext.d.ts +0 -6
  18. package/dist/components/context/VideosContext.d.ts +0 -6
  19. package/dist/components/context/index.d.ts +0 -5
  20. package/dist/components/context/types.d.ts +0 -27
  21. package/dist/components/hooks/contentHooks.d.ts +0 -68
  22. package/dist/components/hooks/index.d.ts +0 -21
  23. package/dist/components/hooks/playerHooks.d.ts +0 -28
  24. package/dist/components/hooks/useApplyInviteCode.d.ts +0 -6
  25. package/dist/components/hooks/useCancelSubscription.d.ts +0 -2
  26. package/dist/components/hooks/useError.d.ts +0 -9
  27. package/dist/components/hooks/useFreePurchase.d.ts +0 -4
  28. package/dist/components/hooks/useItemsInRow.d.ts +0 -11
  29. package/dist/components/hooks/useLastVideoByWidgetId.d.ts +0 -5
  30. package/dist/components/hooks/useOrganizationSubscriptions.d.ts +0 -3
  31. package/dist/components/hooks/usePurchaseRecovery.d.ts +0 -6
  32. package/dist/components/hooks/usePurchaseSubscription.d.ts +0 -4
  33. package/dist/components/hooks/usePurchasesWithVideos.d.ts +0 -7
  34. package/dist/components/hooks/useRowsInScreen.d.ts +0 -6
  35. package/dist/components/hooks/useScreen.d.ts +0 -10
  36. package/dist/components/hooks/useScreens.d.ts +0 -5
  37. package/dist/components/hooks/useSearch.d.ts +0 -8
  38. package/dist/components/hooks/useTaggedVideos.d.ts +0 -11
  39. package/dist/components/hooks/useTivio.d.ts +0 -3
  40. package/dist/components/hooks/useTransactionPayment.d.ts +0 -5
  41. package/dist/components/hooks/useUser.d.ts +0 -4
  42. package/dist/components/hooks/useVoucher.d.ts +0 -25
  43. package/dist/components/hooks/useWatchWithoutAdsOffer.d.ts +0 -4
  44. package/dist/config.d.ts +0 -20
  45. package/dist/index.js.LICENSE.txt +0 -3
  46. package/dist/info.d.ts +0 -2
  47. package/dist/services/bundleLoader.d.ts +0 -15
  48. package/dist/services/bundlePromise.d.ts +0 -7
  49. package/dist/services/dependencyResolver.d.ts +0 -24
  50. package/dist/services/localFetch/coreReactDomDist.d.ts +0 -1
  51. package/dist/services/localFetch/none.d.ts +0 -1
  52. package/dist/services/logger.d.ts +0 -26
  53. package/dist/services/login.d.ts +0 -9
  54. package/dist/services/packageLoader.d.ts +0 -6
  55. package/dist/services/pubSub.d.ts +0 -13
  56. package/dist/services/sentry.d.ts +0 -4
  57. package/dist/services/settings.d.ts +0 -13
  58. package/dist/types/bundle.types.d.ts +0 -423
  59. package/dist/types/common.d.ts +0 -6
  60. package/dist/types/config.types.d.ts +0 -0
  61. package/dist/types/customPlayer.types.d.ts +0 -171
  62. package/dist/types/types.d.ts +0 -175
@@ -1,26 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- export declare type LoggerArgs = any[];
6
- export interface Logger {
7
- /** important messages */
8
- warn(...data: LoggerArgs): void;
9
- /** errors */
10
- error(...data: LoggerArgs): void;
11
- /** critical errors */
12
- exception(...data: LoggerArgs): void;
13
- /** metrics */
14
- info(...data: LoggerArgs): void;
15
- /** non-production messages */
16
- debug(...data: LoggerArgs): void;
17
- }
18
- export declare type LoggerConf = {
19
- isConsoleEnabled: boolean;
20
- isSentryEnabled?: boolean;
21
- };
22
- export declare type Severity = 'warn' | 'error' | 'info' | 'debug';
23
- /**
24
- * Factory
25
- **/
26
- export declare const createLogger: (conf: LoggerConf) => Logger;
@@ -1,9 +0,0 @@
1
- import type { UserPayload } from '../types/bundle.types';
2
- /**
3
- * Set user to sign in/out.
4
- *
5
- * Sign in - setUser('userID', { token: 'xxx' })
6
- * Sign out - setUser(null)
7
- */
8
- declare const setUser: (userId: string | null, payload?: UserPayload | undefined) => Promise<void>;
9
- export { setUser };
@@ -1,6 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- export declare type FetchPackage = (url: string) => Promise<string>;
6
- export declare const fetchPackage: FetchPackage;
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- /**
6
- * Export Tivio Events API
7
- */
8
- import { PubSub } from '../types/bundle.types';
9
- export declare const createPubSub: () => PubSub;
10
- /**
11
- * Share singleton instance
12
- */
13
- export declare const getPubSub: () => PubSub;
@@ -1,4 +0,0 @@
1
- import * as _Sentry from '@sentry/browser';
2
- export declare let Sentry: null | typeof _Sentry;
3
- export declare const disableSentry: () => void;
4
- export declare const initSentry: () => void;
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- /**
6
- * @deprecated TIV-994 in favour of setUser from libs/sdk-react/src/services/login.ts
7
- */
8
- export declare const createSettings: () => {
9
- /**
10
- * @deprecated TIV-994 in favour of setUser from libs/sdk-react/src/services/login.ts
11
- */
12
- setUser: (userId: string, userPayload: unknown) => Promise<void>;
13
- };
@@ -1,423 +0,0 @@
1
- import { Currency, ItemsInRow, PaginationInterface, PaginationOptions, QerkoCancellationInfo, Row, ROW_ITEM_TYPES, SubscribeToItemsInRowOptions, SubscribeToTaggedVideos, Tag, TilePropsPartial, UseCancelSubscription, CUSTOMER_BUILD, PLATFORM, WebRowProps } from '@tivio/common';
2
- import { ComponentType } from 'react';
3
- import { Logger } from '../services/logger';
4
- import { FetchPackage } from '../services/packageLoader';
5
- import { Disposer, Empty, Nullable } from './common';
6
- import { Channel, Language, RemoteProviderProps, Section, TivioSources, TivioWidgetProps, UserData, WebPlayerProps, Widget } from './types';
7
- import type { AdSource, PlayerWrapper } from './customPlayer.types';
8
- import type { Monetization, Purchase, QerkoPaymentInfo, Screen, SubscribeToItemsInRow, SubscribeToRowsInScreen, SubscribeToScreen, TvAppProps, User, UseSearch, Video } from '@tivio/common';
9
- import type React from 'react';
10
- declare type Settings = {
11
- /**
12
- * @deprecated TIV-994 in favour of setUser from libs/sdk-react/src/services/login.ts
13
- */
14
- setUser: (userId: string, userPayload: unknown) => Promise<void>;
15
- };
16
- interface PlayerCapability {
17
- codec: 'h264' | 'h265';
18
- encryption: 'fairplay' | 'none' | 'playready' | 'widevine';
19
- protocol: 'dash' | 'hls';
20
- }
21
- declare type InternalConfig = {
22
- /**
23
- * @private URL of remote code bundle to be fetched directly (without using resolver)
24
- */
25
- bundleUrlOverride?: string;
26
- currency: Currency;
27
- /**
28
- * Tells Tivio which technologies/protocols etc. is the device capable to play.
29
- * If not provided, Tivio will try to guess it (based on the browser).
30
- */
31
- deviceCapabilities: PlayerCapability[];
32
- /**
33
- * Additional options for deviceCapabilities
34
- */
35
- capabilitiesOptions?: {
36
- /**
37
- * Should the player prefer HTTP sources instead HTTPs if they are available.
38
- * This can be used on platforms that support mixed content but do not support
39
- * specific HTTPS certificates. (e.g. certificates from Letsencrypt not supported on LG TVs)
40
- */
41
- preferHttp?: boolean;
42
- };
43
- disableUnmounting?: boolean;
44
- enable?: boolean;
45
- enableSentry?: boolean;
46
- ErrorComponent?: ComponentType<{
47
- error: string | null;
48
- }>;
49
- fetchPackage: FetchPackage;
50
- language?: Language;
51
- LoaderComponent?: ComponentType;
52
- logger?: Logger | null;
53
- pubSub: PubSub;
54
- /**
55
- * @private URL of resolver. Resolver is a script used to fetch remove code bundle
56
- */
57
- resolverUrl: string;
58
- sdkVersion: string;
59
- secret: string | null;
60
- verbose?: boolean;
61
- /**
62
- * @private
63
- */
64
- forceCloudFnResolver?: boolean;
65
- };
66
- declare type Events = {
67
- 'on-ready': RemoteBundleState;
68
- 'on-error': Error;
69
- };
70
- interface PubSub {
71
- publish: <K extends keyof Events>(triggerName: K, payload: Events[K]) => Empty;
72
- subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
73
- }
74
- declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose' | 'forceCloudFnResolver'> & {
75
- deviceCapabilities: PlayerCapability[] | 'auto';
76
- /**
77
- * @private
78
- * Run HTML, CSS and JS feature support check
79
- */
80
- runFeatureSupportCheck?: boolean;
81
- };
82
- declare type TivioSubscriptions = {
83
- subscribeToUser: (cb: (error: string | null, user: User | null) => void) => void;
84
- /**
85
- * Listen to widget changes.
86
- * @param widgetId - widget id
87
- * @param cb - callback on widget updates or on error
88
- */
89
- subscribeToWidget: (widgetId: string, cb: (error: Error | null, data: Widget | null, disposer?: Disposer) => void) => void;
90
- /**
91
- * Listen to channel changes.
92
- * @param channelId - channel id
93
- * @param cb - callback on channel updates or on error
94
- */
95
- subscribeToChannel: (channelId: string, cb: (error: Error | null, data: Channel | null) => void) => void;
96
- /**
97
- * Listen to section changes.
98
- * @param sectionId - section id
99
- * @param cb - callback on section updates or on error
100
- */
101
- subscribeToSection: (sectionId: string, cb: (error: Error | null, data: Section | null) => void) => void;
102
- /**
103
- * Listen to video changes.
104
- * @param videoId - video id
105
- * @param cb - callback on video updates or on error
106
- */
107
- subscribeToVideo: (videoId: string, cb: (error: Error | null, data: Video | null, disposer?: Disposer) => void) => void;
108
- /**
109
- * Listen to videos in section changes.
110
- * @param sectionId - section id
111
- * @param cb - callback on videos change or error
112
- * @param limit - videos count
113
- */
114
- subscribeToVideosInSection: (sectionId: string, cb: (error: null | Error, data: null | {
115
- videos: Video[];
116
- hasNextPage: boolean;
117
- }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
118
- /**
119
- * Listen to section in channel changes
120
- * @param channelId - channel id
121
- * @param cb - callback on sections change or error
122
- * @param limit - sections count
123
- */
124
- subscribeToSectionsInChannel: (channelId: string, cb: (error: null | Error, data: null | {
125
- sections: Section[];
126
- hasNextPage: boolean;
127
- }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
128
- /**
129
- * Listen to channels in widget changes
130
- * @param widgetId - widget id
131
- * @param cb - callback on channels change or error
132
- * @param limit - channels count
133
- */
134
- subscribeToChannelsInWidget: (widgetId: string, cb: (error: null | Error, data: null | {
135
- channels: Channel[];
136
- hasNextPage: boolean;
137
- }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
138
- subscribeToScreen: SubscribeToScreen;
139
- subscribeToItemsInRow: SubscribeToItemsInRow;
140
- subscribeToRowsInScreen: SubscribeToRowsInScreen;
141
- subscribeToTaggedVideos: SubscribeToTaggedVideos;
142
- registerOverlayCallbacks: (callbacks: {
143
- onShow: () => void;
144
- onHide: () => void;
145
- }) => void;
146
- };
147
- declare type TivioGetters = {
148
- isTivioLoaded: (cb: (isLoaded: boolean) => void) => boolean;
149
- isSignedIn: () => boolean;
150
- /**
151
- * Get channel by its id.
152
- * @param channelId - channel id
153
- * @returns {Promise<Channel | null>} channel or null if channel does not exists
154
- */
155
- getChannelById: (channelId: string) => Promise<Channel | null>;
156
- /**
157
- * Get (or create) player wrapper instance
158
- * @param opt - player getter options
159
- * @returns {PlayerWrapper} player wrapper instance
160
- */
161
- getPlayerWrapper: (opt: {
162
- playerWrapperId?: string;
163
- }) => PlayerWrapper;
164
- getOrganizationScreens: () => Promise<Screen[]>;
165
- getOrganizationSubscriptions: () => Promise<Monetization[] | undefined>;
166
- /**
167
- * Get section by its id.
168
- * @param sectionId - section id
169
- * @returns {Promise<{section: Section, channel: Channel} | null>} section and channel or null if channel or section does not exists
170
- */
171
- getSectionById: (sectionId: string) => Promise<Section | null>;
172
- /**
173
- * Get video by its id.
174
- * @param videoId - video id
175
- * @returns {Promise<Video | null>} video or null if video does not exists
176
- */
177
- getVideoById: (videoId: string) => Promise<Video | null>;
178
- /**
179
- * Get widget by its id.
180
- * @param widgetId - widget id
181
- * @returns {Promise<Widget | null>} widget or null if widget does not exists
182
- */
183
- getWidgetById: (widgetId: string) => Promise<Widget | null>;
184
- /**
185
- * Get player capabilities based on user's browser and OS as resolved by Tivio.
186
- * @returns PlayerCapability[]
187
- */
188
- getPlayerCapabilities: () => PlayerCapability[];
189
- };
190
- interface TivioAuth {
191
- changePassword: (newPassword: string) => Promise<void>;
192
- changeUserPhoto(file: File): Promise<void>;
193
- removeUserPhoto(): Promise<void>;
194
- getPurchasedVodsWithInitializedVideos: () => Promise<Purchase[]>;
195
- /**
196
- * @param email
197
- * @param password
198
- */
199
- createUserWithEmailAndPassword: (email: string, password: string, userData?: UserData) => Promise<void>;
200
- /**
201
- * Sign in the user and starts listening on his purchases
202
- * @param email
203
- * @param password
204
- */
205
- signInWithEmailAndPassword: (email: string, password: string) => Promise<void>;
206
- initializeUser: () => Promise<void>;
207
- signOut: () => Promise<void>;
208
- createFreePurchase: (monetizationId: string) => Promise<void>;
209
- }
210
- export interface RouterOverrides {
211
- goToPlayer: (videoId: string, type: ROW_ITEM_TYPES, rowId?: string) => void;
212
- goToTagPage: (tagId: string) => void;
213
- goToLoginScreen: () => void;
214
- goBack: () => void;
215
- }
216
- export interface RouterOverridesContextState {
217
- routerOverrides: RouterOverrides;
218
- }
219
- declare type TivioComponents = {
220
- AdIndicationButtonWeb: React.ReactNode;
221
- Markers: React.ReactNode;
222
- PlayerDataContext: React.ReactNode;
223
- Provider: React.ComponentType<RemoteProviderProps>;
224
- Recommendation: React.ReactNode;
225
- SkipButtonWeb: React.ReactNode;
226
- /**
227
- * @deprecated will be removed in in @tivio/sdk-react@4
228
- */
229
- VideoAdBanner: React.ReactNode;
230
- WebPlayer: React.ComponentType<WebPlayerProps>;
231
- Widget: React.ComponentType<TivioWidgetProps>;
232
- TvPlayer: React.ComponentType<WebPlayerProps>;
233
- PlayerDataContextProvider: React.ComponentType<{
234
- id: string;
235
- }>;
236
- SkipButtonTv: React.ComponentType<{
237
- Button: React.ComponentType;
238
- Label: React.ComponentType;
239
- Container: React.ComponentType;
240
- onStarted?: () => any;
241
- onEnded?: () => any;
242
- }>;
243
- TvApp: React.ComponentType<TvAppProps>;
244
- CustomerScreen: React.ComponentType<{
245
- screenId: string;
246
- }>;
247
- WebTagScreen: React.ComponentType<{
248
- tagId: string;
249
- onError?: (error: Error) => void;
250
- }>;
251
- WebRow: React.ComponentType<WebRowProps>;
252
- WebTile: React.ComponentType<{
253
- item?: Video | Tag;
254
- } & TilePropsPartial>;
255
- FeatureSupportCheck: React.ComponentType<{}>;
256
- };
257
- declare type AdSegment = {
258
- id: string;
259
- /**
260
- * @deprecated alias to secondsToEnd * 1000
261
- */
262
- remainingMs: number;
263
- secondsToEnd: number;
264
- secondsToSkippable: number | null;
265
- canSeek: boolean;
266
- /**
267
- * true if is skippable and skip countdown has passed
268
- */
269
- canSkip: boolean;
270
- /**
271
- * true ad if is skippable after some skipDelayMs (if it is skippable, skipDelayMs is defined)
272
- */
273
- isSkippable: boolean;
274
- skip: () => any;
275
- };
276
- declare type TivioHooks = {
277
- useAd: () => [(AdSource | null)];
278
- useAdSegment: () => AdSegment | null;
279
- useCancelSubscription: UseCancelSubscription;
280
- useItemsInRow: (rowId: string, options: PaginationOptions) => {
281
- pagination: PaginationInterface<ItemsInRow> | null;
282
- error: Error | null;
283
- };
284
- usePurchaseRecovery: () => {
285
- purchaseRecoveryResult?: string;
286
- loading: boolean;
287
- error?: any;
288
- purchaseRecovery: (monetizationId: string) => void;
289
- };
290
- useRowsInScreen: (screenId: string, options: PaginationOptions) => {
291
- pagination: PaginationInterface<Row> | null;
292
- error: Error | null;
293
- };
294
- useTaggedVideos: (tagIds: string[], options: SubscribeToItemsInRowOptions) => {
295
- pagination: PaginationInterface<Video> | null;
296
- error: Error | null;
297
- };
298
- useSearch: UseSearch;
299
- useVideo: (videoId: string) => {
300
- data: Video | null;
301
- error: string | null;
302
- };
303
- useVoucher: (voucherId: string) => any;
304
- /**
305
- * @deprecated will be removed in version
306
- */
307
- useLastVideoByWidgetId: (widgetId: string) => Video | null;
308
- useWatchWithoutAdsOffer: () => {
309
- canPurchaseWatchWithoutAds: boolean;
310
- showPurchaseDialog: () => void;
311
- };
312
- useApplyInviteCode: () => {
313
- applyInviteCodeResult?: boolean;
314
- loading: boolean;
315
- error?: any;
316
- applyInviteCode: (code: string) => void;
317
- };
318
- };
319
- export declare type UserPayload = Record<string, any>;
320
- declare type TivioBundle = {
321
- components: TivioComponents;
322
- getters: TivioGetters;
323
- auth: TivioAuth;
324
- hooks: TivioHooks;
325
- init: (config: Config) => void | Promise<void>;
326
- purchaseVideoWithQerko: (videoId: string, monetizationId: string, voucher?: {
327
- expirationDate: Date;
328
- }) => Promise<QerkoPaymentInfo>;
329
- purchaseSubscriptionWithQerko: (monetizationId: string, voucher?: {
330
- expirationDate: Date;
331
- }) => Promise<QerkoPaymentInfo>;
332
- cancelSubscriptionWithQerko: (subscriptionId: string) => Promise<QerkoCancellationInfo>;
333
- setLanguage: (language: Language) => void;
334
- setUser: (userId: string | null, userPayload?: UserPayload) => Promise<void>;
335
- sources: TivioSources;
336
- subscriptions: TivioSubscriptions;
337
- internal: {
338
- components: TivioInternalComponents;
339
- hooks: TivioInternalHooks;
340
- providers: TivioInternalProviders;
341
- };
342
- };
343
- declare type TivioInternalComponents = {
344
- CustomButton: React.ComponentType;
345
- WebLandingScreen: React.ComponentType;
346
- WebVideoScreen: React.ComponentType<{
347
- videoId: string;
348
- }>;
349
- };
350
- declare type TivioInternalHooks = {
351
- useAuthOverlay: () => AuthOverlayState;
352
- useSubscriptionsOverlay: () => SubscriptionOverlayState;
353
- useQerkoOverlay: () => QerkoOverlayState;
354
- usePurchasesWithVideos: () => {
355
- purchases: Purchase[];
356
- };
357
- useOrganizationSubscriptions: () => {
358
- subscriptions: Monetization[];
359
- };
360
- useUser: () => {
361
- user: User | null;
362
- error: string | null;
363
- };
364
- };
365
- declare type TivioInternalProviders = {
366
- AppThemeProvider: React.ComponentType;
367
- AuthOverlayContextProvider: React.ComponentType;
368
- CustomerProvider: React.ComponentType<{
369
- customer: CUSTOMER_BUILD;
370
- platform: PLATFORM;
371
- children: any;
372
- }>;
373
- ConfigProvider: React.ComponentType;
374
- UserContextProvider: React.ComponentType;
375
- SubscriptionOverlayContextProvider: React.ComponentType;
376
- QerkoOverlayContextProvider: React.ComponentType;
377
- PurchasesWithVideosContextProvider: React.ComponentType;
378
- OrganizationSubscriptionsContextProvider: React.ComponentType;
379
- RouterOverridesContextProvider: React.ComponentType<RouterOverridesContextState>;
380
- };
381
- declare type TivioBundleFile = {
382
- Tivio: TivioBundle;
383
- };
384
- declare type AuthOverlayType = 'login' | 'registration' | 'closed';
385
- interface AuthOverlayState {
386
- type: AuthOverlayType;
387
- closeAuthOverlay: () => void;
388
- openAuthOverlay: (type: AuthOverlayType) => void;
389
- }
390
- interface SubscriptionOverlayData {
391
- subscriptions?: Monetization[];
392
- onPurchase?: () => void;
393
- onClose?: () => void;
394
- }
395
- declare type SubscriptionOverlayState = {
396
- data: SubscriptionOverlayData | null;
397
- closeSubscriptionOverlay: () => void;
398
- openSubscriptionOverlay: (data: SubscriptionOverlayData) => void;
399
- };
400
- interface QerkoData {
401
- monetization: Monetization;
402
- video?: Video;
403
- onPurchase?: () => void;
404
- onClose?: () => void;
405
- }
406
- interface QerkoOverlayState {
407
- data: QerkoData | null;
408
- openQerkoOverlay: ((data: QerkoData) => void);
409
- closeQerkoOverlay: () => void;
410
- }
411
- declare type RemoteBundleState = {
412
- config: InternalConfig;
413
- error: string | null;
414
- settings: Settings;
415
- state: 'loading' | 'error' | 'ready';
416
- } & Nullable<TivioBundle>;
417
- /**
418
- * TODO: Duplicate, because we can't import types from core-js.
419
- */
420
- declare type NewVoucher = {
421
- expirationDate: Date | number;
422
- };
423
- export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, TivioInternalComponents, TivioInternalHooks, TivioInternalProviders, Events, PubSub, PlayerCapability, Currency, AuthOverlayState, AuthOverlayType, SubscriptionOverlayData, SubscriptionOverlayState, QerkoData, QerkoOverlayState, NewVoucher, };
@@ -1,6 +0,0 @@
1
- declare type Nullable<T> = {
2
- [P in keyof T]: T[P] | null;
3
- };
4
- declare type Empty = void | Promise<void> | undefined | Promise<undefined>;
5
- declare type Disposer = () => void;
6
- export { Disposer, Empty, Nullable, };
File without changes
@@ -1,171 +0,0 @@
1
- import { Empty } from './common';
2
- export declare type ChannelSource = {
3
- new (uri: string, originalOptions: Record<string, any>, channelName: string, programName: string, programDescription: string, from: Date, to: Date): ChannelSource;
4
- description: string;
5
- name: string;
6
- uri: string;
7
- from: Date;
8
- channelName: string;
9
- to: Date;
10
- type: 'channel';
11
- watchWithoutAdsRecommendation: {
12
- showPurchaseDialog: () => void;
13
- } | null;
14
- };
15
- export declare type AdSource = {
16
- new (uri: string, name: string, description: string, skipDelayMs: number | null, adDurationMs: number, trackingContext?: any, // internal Tivio types
17
- adMarker?: any, // internal Tivio types
18
- packInfo?: any, // internal Tivio types
19
- provider?: any): AdSource;
20
- description: string;
21
- name: string;
22
- uri: string;
23
- durationMs: number;
24
- skipDelayMs: number | null;
25
- type: 'ad';
26
- /**
27
- * true if is skippable and skip countdown has passed
28
- */
29
- canSkip: boolean;
30
- /**
31
- * true ad if is skippable after some skipDelayMs (if it is skippable, skipDelayMs is defined)
32
- */
33
- isSkippable: boolean;
34
- /**
35
- * Skip ad. Only works when canSkip is true
36
- */
37
- skip: () => void;
38
- /**
39
- * Order in ad break (ad break is a group of ads played right after each other)
40
- */
41
- order: number;
42
- /**
43
- * Total number of ads in ad break (ad break is a group of ads played right after each other)
44
- */
45
- totalCount: number;
46
- secondsToEnd: number;
47
- secondsToSkippable: number | null;
48
- };
49
- export declare type VodTivioSource = {
50
- new (uri: string, videoId: string, name: string, description: string, adMonetizationId?: string): VodTivioSource;
51
- type: 'vod_tivio';
52
- description: string;
53
- name: string;
54
- uri: string;
55
- };
56
- export declare type VodExternalSource = {
57
- new (uri: string, monetizationId: string, name: string, description: string, originalOptions: Record<string, any>): VodTivioSource;
58
- type: 'vod_external';
59
- description: string;
60
- name: string;
61
- uri: string;
62
- };
63
- export declare type InputSource = AdSource | ChannelSource | VodTivioSource | VodExternalSource;
64
- declare type PlayerState = 'playing' | 'paused' | 'idle';
65
- export interface PlayerInterface {
66
- pause: () => void;
67
- /**
68
- * unpause
69
- */
70
- play: () => void;
71
- /**
72
- * @param {number} ms - milliseconds relative to start of video (relative to 0 ms)
73
- * or in case of TV programs relative to start of the program (relative to source.from ms)
74
- */
75
- seekTo: (ms: number) => void;
76
- /**
77
- * Source to be passed to player.
78
- *
79
- * Depending on autoplay settings it should either start playing
80
- * immediately or just be loaded by player and stay paused.
81
- */
82
- setSource: (source: InputSource | null) => void;
83
- /**
84
- * volume in [0,1]
85
- */
86
- setVolume?: (volume: number) => void;
87
- mute?: () => void;
88
- /**
89
- * restore volume to previous value
90
- */
91
- unmute?: () => void;
92
- }
93
- export declare type PlayerWrapper = {
94
- /**
95
- * Report that playback of video has finished
96
- */
97
- onPlaybackEnded: () => void;
98
- /**
99
- * Report video progress in milliseconds
100
- */
101
- onTimeChanged: (ms: number) => void;
102
- /**
103
- * Report that video state changed
104
- */
105
- onStateChanged: (state: PlayerState) => void;
106
- /**
107
- * Send source to Tivio
108
- */
109
- onSourceChanged: (source: InputSource | null) => void;
110
- /**
111
- * Report that video failed to load (never started playing)
112
- */
113
- onLoadError: (error: Error) => void;
114
- /**
115
- * Report that video failed during playback (successfully loaded and then failed, e.g. part of stream is invalid)
116
- */
117
- onError: (error: Error) => void;
118
- /**
119
- * Unpause video
120
- */
121
- play: () => void;
122
- /**
123
- * Pause video
124
- */
125
- pause: () => void;
126
- /**
127
- * Currently playing source
128
- */
129
- source: InputSource | null;
130
- events: {
131
- isSupported: (even: string) => boolean;
132
- addListener: <T = any>(event: string, cb: (value: T) => Empty) => void;
133
- removeListener: <T = any>(event: string, cb: (value: T) => Empty) => void;
134
- removeAllListeners: () => void;
135
- };
136
- /**
137
- * Register a low level player that implements player methods, like play video, change volume, etc.
138
- */
139
- register: (playerInterface: PlayerInterface) => void;
140
- /**
141
- * duration of current source in ms (both setter and getter)
142
- */
143
- durationMs: number | null;
144
- isPlaybackStarted: boolean;
145
- isPaused: boolean;
146
- isPlaying: boolean;
147
- isIdle: boolean;
148
- error: Error | null;
149
- /**
150
- * Replay the video that finished playback
151
- */
152
- replay: () => void;
153
- /**
154
- * Retry to play a video that failed to start playing (e.g. due to a network error)
155
- */
156
- retry: () => void;
157
- togglePlayPause: () => void;
158
- seekTo: (ms: number) => void;
159
- /**
160
- * set volume to value between 0,1
161
- */
162
- setVolume: (volume: number) => void;
163
- /**
164
- * change volume by value between -1,1
165
- */
166
- changeVolumeBy: (volume: number) => void;
167
- setMuted: (muted: boolean) => void;
168
- toggleMuted: () => void;
169
- };
170
- export declare type UsePlayerEvent = <T = any>(eventName: string) => T | null;
171
- export {};