@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
package/dist/index.d.ts CHANGED
@@ -1,20 +1,1279 @@
1
- import 'whatwg-fetch';
2
- import 'es7-object-polyfill';
3
- export { PlayerProvider, withPlayerContext } from './components/PlayerProvider';
4
- export type { PlayerProviderProps } from './components/PlayerProvider';
5
- export { bundlePromise } from './services/bundlePromise';
6
- export * from './components/hooks';
7
- export * from './components/TivioProvider';
8
- export * from './components/TivioWidget';
9
- export * from './components/TivioWidgetError';
10
- export * from './components/TvTivioProvider';
11
- export * from './components/TivioWidgetLoader';
12
- export * from './types/customPlayer.types';
13
- export * from './services/bundleLoader';
14
- export * from './services/pubSub';
15
- export * from './types/types';
16
- export { Disposer } from './types/common';
17
- export { Empty } from './types/common';
18
- export { Nullable } from './types/common';
19
- export * from './types/bundle.types';
20
- export { setUser } from './services/login';
1
+ import { AuthOverlayState } from '@tivio/common';
2
+ import { Channel as Channel_2 } from '@tivio/common/dist/types/externalTypes/channel';
3
+ import { Channel as Channel_3 } from '@tivio/common';
4
+ import { ComponentType } from 'react';
5
+ import { CreateUserWithEmailAndPassword } from '@tivio/common';
6
+ import { Currency } from '@tivio/common';
7
+ import { CUSTOMER_BUILD } from '@tivio/common';
8
+ import { FunctionComponentElement } from 'react';
9
+ import { ItemsInRow } from '@tivio/common';
10
+ import { Monetization } from '@tivio/common';
11
+ import { PaginationInterface } from '@tivio/common';
12
+ import { PaginationOptions } from '@tivio/common';
13
+ import { PLATFORM } from '@tivio/common';
14
+ import type { Purchase as Purchase_2 } from '@tivio/common';
15
+ import { Purchase as Purchase_3 } from '@tivio/common/dist/types/externalTypes/user';
16
+ import { QerkoCancellationInfo } from '@tivio/common';
17
+ import type { QerkoPaymentInfo } from '@tivio/common';
18
+ import { QerkoTransaction } from '@tivio/common';
19
+ import { default as React_2 } from 'react';
20
+ import { Row } from '@tivio/common';
21
+ import { Screen as Screen_2 } from '@tivio/common';
22
+ import { ScreenOptions } from '@tivio/common';
23
+ import { Section as Section_2 } from '@tivio/common/dist/types/externalTypes/section';
24
+ import { Section as Section_3 } from '@tivio/common';
25
+ import type { SubscribeToItemsInRow } from '@tivio/common';
26
+ import { SubscribeToItemsInRowOptions } from '@tivio/common';
27
+ import type { SubscribeToRowsInScreen } from '@tivio/common';
28
+ import type { SubscribeToScreen } from '@tivio/common';
29
+ import { SubscribeToTaggedVideos } from '@tivio/common';
30
+ import { Tag } from '@tivio/common';
31
+ import { TilePropsPartial } from '@tivio/common';
32
+ import type { TvAppProps } from '@tivio/common';
33
+ import { UseCancelSubscription } from '@tivio/common';
34
+ import { UseChannelSource } from '@tivio/common';
35
+ import type { User } from '@tivio/common';
36
+ import { User as User_2 } from '@tivio/common/dist/types/externalTypes/user';
37
+ import { UseSearch } from '@tivio/common';
38
+ import type { UseTvChannel } from '@tivio/common';
39
+ import { Video } from '@tivio/common';
40
+ import { WebRowProps } from '@tivio/common';
41
+ import { WebSeriesDetailScreenProps } from '@tivio/common';
42
+
43
+ declare type AdSegment = {
44
+ id: string;
45
+ /**
46
+ * @deprecated alias to secondsToEnd * 1000
47
+ */
48
+ remainingMs: number;
49
+ secondsToEnd: number;
50
+ secondsToSkippable: number | null;
51
+ canSeek: boolean;
52
+ /**
53
+ * true if is skippable and skip countdown has passed
54
+ */
55
+ canSkip: boolean;
56
+ /**
57
+ * true ad if is skippable after some skipDelayMs (if it is skippable, skipDelayMs is defined)
58
+ */
59
+ isSkippable: boolean;
60
+ skip: () => any;
61
+ };
62
+
63
+ export declare type AdSource = {
64
+ new (uri: string, name: string, description: string, skipDelayMs: number | null, adDurationMs: number, trackingContext?: any, // internal Tivio types
65
+ adMarker?: any, // internal Tivio types
66
+ packInfo?: any, // internal Tivio types
67
+ provider?: any): AdSource;
68
+ description: string;
69
+ name: string;
70
+ uri: string;
71
+ durationMs: number;
72
+ skipDelayMs: number | null;
73
+ type: 'ad';
74
+ /**
75
+ * true if is skippable and skip countdown has passed
76
+ */
77
+ canSkip: boolean;
78
+ /**
79
+ * true ad if is skippable after some skipDelayMs (if it is skippable, skipDelayMs is defined)
80
+ */
81
+ isSkippable: boolean;
82
+ /**
83
+ * Skip ad. Only works when canSkip is true
84
+ */
85
+ skip: () => void;
86
+ /**
87
+ * Order in ad break (ad break is a group of ads played right after each other)
88
+ */
89
+ order: number;
90
+ /**
91
+ * Total number of ads in ad break (ad break is a group of ads played right after each other)
92
+ */
93
+ totalCount: number;
94
+ secondsToEnd: number;
95
+ secondsToSkippable: number | null;
96
+ };
97
+
98
+ /**
99
+ * Index names in Algolia search engine.
100
+ *
101
+ * @public
102
+ */
103
+ export declare enum ALGOLIA_INDEX_NAME {
104
+ VIDEOS = 'videos',
105
+ VIDEOSDESC = 'videos_created_desc',
106
+ TAGS = 'tags',
107
+ TV_CHANNELS = 'tvChannels',
108
+ USERS = 'users'
109
+ }
110
+
111
+ export declare type BadRequestError = Error & {
112
+ details?: {
113
+ reason?: 'DOES_NOT_EXIST' | 'EXPIRED' | 'ALREADY_USED';
114
+ };
115
+ };
116
+
117
+ export declare type BetOffer = {
118
+ betService: string;
119
+ league: string;
120
+ odds: {
121
+ winner: string;
122
+ rate: number;
123
+ }[];
124
+ sport: string;
125
+ opponent1: string;
126
+ opponent2: string;
127
+ time: Date;
128
+ };
129
+
130
+ /**
131
+ * rejects when bundle is not available
132
+ */
133
+ export declare const bundlePromise: Promise<RemoteBundleState>;
134
+
135
+ export declare type Channel = {
136
+ id: string;
137
+ name: string;
138
+ header: string;
139
+ headerLogo: string;
140
+ recentVideos: Video[];
141
+ };
142
+
143
+ export declare const ChannelsContext: React_2.Context<DataState<Channel_3>>;
144
+
145
+ export declare type ChannelSource = {
146
+ new (uri: string, originalOptions: Record<string, any>, channelName: string, programName: string, programDescription: string, from: Date, to: Date): ChannelSource;
147
+ description: string;
148
+ name: string;
149
+ uri: string;
150
+ from: Date;
151
+ channelName: string;
152
+ to: Date;
153
+ type: 'channel';
154
+ watchWithoutAdsRecommendation: {
155
+ showPurchaseDialog: () => void;
156
+ } | null;
157
+ };
158
+
159
+ export declare interface ChannelSourcePojo {
160
+ type: 'ChannelSource';
161
+ uri: string;
162
+ originalOptions: any;
163
+ channelName: string;
164
+ programName: string;
165
+ programDescription: string;
166
+ from: Date;
167
+ to: Date;
168
+ poster?: string;
169
+ }
170
+
171
+ export declare type Chapter = any;
172
+
173
+ export declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose' | 'forceCloudFnResolver'> & {
174
+ deviceCapabilities: PlayerCapability[] | 'auto';
175
+ /**
176
+ * @private
177
+ * Run HTML, CSS and JS feature support check
178
+ */
179
+ runFeatureSupportCheck?: boolean;
180
+ };
181
+
182
+ export declare const createPubSub: () => PubSub;
183
+
184
+ /**
185
+ * Fetch & load CommonJS remote module.
186
+ */
187
+ export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig) => Promise<TivioBundle>;
188
+
189
+ export declare const createUseRemoteBundle: () => (conf: InternalConfig) => RemoteBundleState;
190
+
191
+ export { Currency }
192
+
193
+ declare interface DataState<T> {
194
+ data: {
195
+ [key: string]: HookData<T>;
196
+ };
197
+ setData: (key: string, data: HookData<T>) => void;
198
+ }
199
+
200
+ export declare type Disposer = () => void;
201
+
202
+ export declare type Empty = void | Promise<void> | undefined | Promise<undefined>;
203
+
204
+ export declare type Events = {
205
+ 'on-ready': RemoteBundleState;
206
+ 'on-error': Error;
207
+ };
208
+
209
+ /**
210
+ * @throws if fetch fails
211
+ */
212
+ export declare const fetchBundle: (secret: string, conf: InternalConfig) => Promise<string>;
213
+
214
+ /**
215
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
216
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
217
+ */
218
+ declare type FetchPackage = (url: string) => Promise<string>;
219
+
220
+ export declare interface GenericOnCallError {
221
+ code: string;
222
+ message?: string;
223
+ details?: string[];
224
+ }
225
+
226
+ /**
227
+ * Share singleton instance
228
+ */
229
+ export declare const getPubSub: () => PubSub;
230
+
231
+ declare interface HookData<T> {
232
+ data: PaginationData<T> | null;
233
+ error: Error | null;
234
+ isLoading: boolean;
235
+ }
236
+
237
+ export declare type InputSource = AdSource | ChannelSource | VodTivioSource | VodExternalSource;
238
+
239
+ export declare type InternalConfig = {
240
+ /**
241
+ * @private URL of remote code bundle to be fetched directly (without using resolver)
242
+ */
243
+ bundleUrlOverride?: string;
244
+ currency: Currency;
245
+ /**
246
+ * Tells Tivio which technologies/protocols etc. is the device capable to play.
247
+ * If not provided, Tivio will try to guess it (based on the browser).
248
+ */
249
+ deviceCapabilities: PlayerCapability[];
250
+ /**
251
+ * Additional options for deviceCapabilities
252
+ */
253
+ capabilitiesOptions?: {
254
+ /**
255
+ * Should the player prefer HTTP sources instead HTTPs if they are available.
256
+ * This can be used on platforms that support mixed content but do not support
257
+ * specific HTTPS certificates. (e.g. certificates from Letsencrypt not supported on LG TVs)
258
+ */
259
+ preferHttp?: boolean;
260
+ };
261
+ disableUnmounting?: boolean;
262
+ enable?: boolean;
263
+ enableSentry?: boolean;
264
+ ErrorComponent?: ComponentType<{
265
+ error: string | null;
266
+ }>;
267
+ fetchPackage: FetchPackage;
268
+ language?: LangCode;
269
+ LoaderComponent?: ComponentType;
270
+ logger?: Logger | null;
271
+ pubSub: PubSub;
272
+ /**
273
+ * @private URL of resolver. Resolver is a script used to fetch remove code bundle
274
+ */
275
+ resolverUrl: string;
276
+ sdkVersion: string;
277
+ secret: string | null;
278
+ verbose?: boolean;
279
+ /**
280
+ * @private
281
+ */
282
+ forceCloudFnResolver?: boolean;
283
+ };
284
+
285
+ declare interface IntroMarker {
286
+ marker: Marker;
287
+ skip: () => void;
288
+ }
289
+
290
+ export declare enum LangCode {
291
+ CS = "cs",
292
+ DE = "de",
293
+ EN = "en",
294
+ FR = "fr",
295
+ PL = "pl",
296
+ SK = "sk",
297
+ SP = "sp"
298
+ }
299
+
300
+ declare interface Logger {
301
+ /** important messages */
302
+ warn(...data: LoggerArgs): void;
303
+ /** errors */
304
+ error(...data: LoggerArgs): void;
305
+ /** critical errors */
306
+ exception(...data: LoggerArgs): void;
307
+ /** metrics */
308
+ info(...data: LoggerArgs): void;
309
+ /** non-production messages */
310
+ debug(...data: LoggerArgs): void;
311
+ }
312
+
313
+ /**
314
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
315
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
316
+ */
317
+ declare type LoggerArgs = any[];
318
+
319
+ export declare type Marker = {
320
+ id: string;
321
+ type: string;
322
+ from: Date;
323
+ to: Date;
324
+ count?: number;
325
+ fromMs?: number;
326
+ toMs?: number;
327
+ };
328
+
329
+ export { Monetization }
330
+
331
+ /**
332
+ * TODO: Duplicate, because we can't import types from core-js.
333
+ */
334
+ export declare type NewVoucher = {
335
+ expirationDate: Date | number;
336
+ };
337
+
338
+ export declare type Nullable<T> = {
339
+ [P in keyof T]: T[P] | null;
340
+ };
341
+
342
+ declare type PaginationData<T> = {
343
+ items: T[];
344
+ hasNextPage: boolean;
345
+ fetchMore: Function;
346
+ };
347
+
348
+ export declare interface PlayerCapability {
349
+ codec: 'h264' | 'h265';
350
+ encryption: 'fairplay' | 'none' | 'playready' | 'widevine';
351
+ protocol: 'dash' | 'hls';
352
+ }
353
+
354
+ export declare interface PlayerInterface {
355
+ pause: () => void;
356
+ /**
357
+ * unpause
358
+ */
359
+ play: () => void;
360
+ /**
361
+ * @param {number} ms - milliseconds relative to start of video (relative to 0 ms)
362
+ * or in case of TV programs relative to start of the program (relative to source.from ms)
363
+ */
364
+ seekTo: (ms: number) => void;
365
+ /**
366
+ * Source to be passed to player.
367
+ *
368
+ * Depending on autoplay settings it should either start playing
369
+ * immediately or just be loaded by player and stay paused.
370
+ */
371
+ setSource: (source: InputSource | null) => void;
372
+ /**
373
+ * volume in [0,1]
374
+ */
375
+ setVolume?: (volume: number) => void;
376
+ mute?: () => void;
377
+ /**
378
+ * restore volume to previous value
379
+ */
380
+ unmute?: () => void;
381
+ }
382
+
383
+ export declare const PlayerProvider: ({ children, playerWrapperId, }: PlayerProviderProps) => FunctionComponentElement<PlayerProviderProps>;
384
+
385
+ export declare type PlayerProviderProps = {
386
+ children: React_2.ReactNode;
387
+ playerWrapperId?: string;
388
+ };
389
+
390
+ declare type PlayerState = 'playing' | 'paused' | 'idle';
391
+
392
+ export declare type PlayerWrapper = {
393
+ /**
394
+ * Report that playback of video has finished
395
+ */
396
+ onPlaybackEnded: () => void;
397
+ /**
398
+ * Report video progress in milliseconds
399
+ */
400
+ onTimeChanged: (ms: number) => void;
401
+ /**
402
+ * Report that video state changed
403
+ */
404
+ onStateChanged: (state: PlayerState) => void;
405
+ /**
406
+ * Send source to Tivio
407
+ */
408
+ onSourceChanged: (source: InputSource | null) => void;
409
+ /**
410
+ * Report that video failed to load (never started playing)
411
+ */
412
+ onLoadError: (error: Error) => void;
413
+ /**
414
+ * Report that video failed during playback (successfully loaded and then failed, e.g. part of stream is invalid)
415
+ */
416
+ onError: (error: Error) => void;
417
+ /**
418
+ * Unpause video
419
+ */
420
+ play: () => void;
421
+ /**
422
+ * Pause video
423
+ */
424
+ pause: () => void;
425
+ /**
426
+ * Currently playing source
427
+ */
428
+ source: InputSource | null;
429
+ events: {
430
+ isSupported: (even: string) => boolean;
431
+ addListener: <T = any>(event: string, cb: (value: T) => Empty) => void;
432
+ removeListener: <T = any>(event: string, cb: (value: T) => Empty) => void;
433
+ removeAllListeners: () => void;
434
+ };
435
+ /**
436
+ * Register a low level player that implements player methods, like play video, change volume, etc.
437
+ */
438
+ register: (playerInterface: PlayerInterface) => void;
439
+ /**
440
+ * duration of current source in ms (both setter and getter)
441
+ */
442
+ durationMs: number | null;
443
+ isPlaybackStarted: boolean;
444
+ isPaused: boolean;
445
+ isPlaying: boolean;
446
+ isIdle: boolean;
447
+ error: Error | null;
448
+ /**
449
+ * Replay the video that finished playback
450
+ */
451
+ replay: () => void;
452
+ /**
453
+ * Retry to play a video that failed to start playing (e.g. due to a network error)
454
+ */
455
+ retry: () => void;
456
+ togglePlayPause: () => void;
457
+ seekTo: (ms: number) => void;
458
+ /**
459
+ * set volume to value between 0,1
460
+ */
461
+ setVolume: (volume: number) => void;
462
+ /**
463
+ * change volume by value between -1,1
464
+ */
465
+ changeVolumeBy: (volume: number) => void;
466
+ setMuted: (muted: boolean) => void;
467
+ toggleMuted: () => void;
468
+ };
469
+
470
+ export declare interface PubSub {
471
+ publish: <K extends keyof Events>(triggerName: K, payload: Events[K]) => Empty;
472
+ subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
473
+ }
474
+
475
+ export declare type Purchase = {
476
+ isPurchased: boolean;
477
+ monetizationId: string;
478
+ videoId: string;
479
+ status: string;
480
+ video: Video | null;
481
+ };
482
+
483
+ export declare interface QerkoData {
484
+ monetization: Monetization;
485
+ video?: Video;
486
+ onPurchase?: () => void;
487
+ onClose?: () => void;
488
+ }
489
+
490
+ export declare interface QerkoOverlayState {
491
+ data: QerkoData | null;
492
+ openQerkoOverlay: ((data: QerkoData) => void);
493
+ closeQerkoOverlay: () => void;
494
+ }
495
+
496
+ export declare type RemoteBundleState = {
497
+ config: InternalConfig;
498
+ error: string | null;
499
+ settings: Settings;
500
+ state: 'loading' | 'error' | 'ready';
501
+ } & Nullable<TivioBundle>;
502
+
503
+ export declare type RemoteProviderProps = {
504
+ disableUnmounting?: boolean;
505
+ language?: string;
506
+ };
507
+
508
+ export declare interface RouterOverrides {
509
+ goToVideoDetailPage: (videoId: string) => void;
510
+ goToSeriesDetailPage: (tagId: string) => void;
511
+ goToTagPage: (tagId: string) => void;
512
+ goToLoginScreen: () => void;
513
+ goBack: () => void;
514
+ goLivePlayer: (videoId: string) => void;
515
+ goVodPlayer: (tvChannelId: string) => void;
516
+ }
517
+
518
+ export declare interface RouterOverridesContextState {
519
+ routerOverrides: RouterOverrides;
520
+ }
521
+
522
+ export declare type Section = {
523
+ id: string;
524
+ name: string;
525
+ channel: Channel;
526
+ videos: Video[];
527
+ };
528
+
529
+ export declare const SectionsContext: React_2.Context<DataState<Section_3>>;
530
+
531
+ export declare type Settings = {
532
+ /**
533
+ * @deprecated TIV-994 in favour of setUser from libs/sdk-react/src/services/login.ts
534
+ */
535
+ setUser: (userId: string, userPayload: unknown) => Promise<void>;
536
+ };
537
+
538
+ /**
539
+ * Set user to sign in/out.
540
+ *
541
+ * Sign in - setUser('userID', { token: 'xxx' })
542
+ * Sign out - setUser(null)
543
+ */
544
+ export declare const setUser: (userId: string | null, payload?: UserPayload | undefined) => Promise<void>;
545
+
546
+ export declare const showGdprConsentPreferences: () => Promise<void>;
547
+
548
+ declare type SubscriptionInfo = {
549
+ type: 'subscription';
550
+ name: string;
551
+ benefits: string[];
552
+ frequency: string;
553
+ };
554
+
555
+ export declare interface SubscriptionOverlayData {
556
+ subscriptions?: Monetization[];
557
+ onPurchase?: () => void;
558
+ onClose?: () => void;
559
+ }
560
+
561
+ export declare type SubscriptionOverlayState = {
562
+ data: SubscriptionOverlayData | null;
563
+ closeSubscriptionOverlay: () => void;
564
+ openSubscriptionOverlay: (data: SubscriptionOverlayData) => void;
565
+ };
566
+
567
+ export declare interface TivioAuth {
568
+ changePassword: (newPassword: string) => Promise<void>;
569
+ changeUserPhoto(file: File): Promise<void>;
570
+ removeUserPhoto(): Promise<void>;
571
+ getPurchasedVodsWithInitializedVideos: () => Promise<Purchase_2[]>;
572
+ /**
573
+ * @param email
574
+ * @param password
575
+ */
576
+ createUserWithEmailAndPassword: CreateUserWithEmailAndPassword;
577
+ /**
578
+ * Sign in the user and starts listening on his purchases
579
+ * @param email
580
+ * @param password
581
+ */
582
+ signInWithEmailAndPassword: (email: string, password: string) => Promise<void>;
583
+ initializeUser: () => Promise<void>;
584
+ signOut: () => Promise<void>;
585
+ /**
586
+ * Used for reset forgotten password by user
587
+ */
588
+ resetPassword: (email: string) => Promise<void>;
589
+ createFreePurchase: (monetizationId: string) => Promise<void>;
590
+ }
591
+
592
+ export declare type TivioBundle = {
593
+ components: TivioComponents;
594
+ getters: TivioGetters;
595
+ auth: TivioAuth;
596
+ hooks: TivioHooks;
597
+ init: (config: Config) => void | Promise<void>;
598
+ purchaseVideoWithQerko: (videoId: string, monetizationId: string, voucher?: {
599
+ expirationDate: Date;
600
+ }) => Promise<QerkoPaymentInfo>;
601
+ purchaseSubscriptionWithQerko: (monetizationId: string, voucher?: {
602
+ expirationDate: Date;
603
+ }) => Promise<QerkoPaymentInfo>;
604
+ cancelSubscriptionWithQerko: (subscriptionId: string) => Promise<QerkoCancellationInfo>;
605
+ setLanguage: (language: LangCode) => void;
606
+ setUser: (userId: string | null, userPayload?: UserPayload) => Promise<void>;
607
+ showConsentPreferences: () => void;
608
+ sources: TivioSources;
609
+ subscriptions: TivioSubscriptions;
610
+ internal: {
611
+ components: TivioInternalComponents;
612
+ hooks: TivioInternalHooks;
613
+ providers: TivioInternalProviders;
614
+ };
615
+ };
616
+
617
+ export declare type TivioBundleFile = {
618
+ Tivio: TivioBundle;
619
+ };
620
+
621
+ export declare type TivioComponents = {
622
+ AdIndicationButtonWeb: React_2.ReactNode;
623
+ Markers: React_2.ReactNode;
624
+ PlayerDataContext: React_2.ReactNode;
625
+ Provider: React_2.ComponentType<RemoteProviderProps>;
626
+ Recommendation: React_2.ReactNode;
627
+ SkipButtonWeb: React_2.ReactNode;
628
+ /**
629
+ * @deprecated will be removed in in @tivio/sdk-react@4
630
+ */
631
+ VideoAdBanner: React_2.ReactNode;
632
+ WebPlayer: React_2.ComponentType<WebPlayerProps>;
633
+ Widget: React_2.ComponentType<TivioWidgetProps>;
634
+ TvPlayer: React_2.ComponentType<WebPlayerProps>;
635
+ PlayerDataContextProvider: React_2.ComponentType<{
636
+ id: string;
637
+ }>;
638
+ SkipButtonTv: React_2.ComponentType<{
639
+ Button: React_2.ComponentType;
640
+ Label: React_2.ComponentType;
641
+ Container: React_2.ComponentType;
642
+ onStarted?: () => any;
643
+ onEnded?: () => any;
644
+ }>;
645
+ TvApp: React_2.ComponentType<TvAppProps>;
646
+ CustomerScreen: React_2.ComponentType<{
647
+ screenId: string;
648
+ }>;
649
+ WebTagScreen: React_2.ComponentType<{
650
+ tagId: string;
651
+ onError?: (error: Error) => void;
652
+ }>;
653
+ WebSearchScreen: React_2.ComponentType<{
654
+ searchQuery?: string;
655
+ }>;
656
+ WebRow: React_2.ComponentType<WebRowProps>;
657
+ WebTile: React_2.ComponentType<{
658
+ item?: Video | Tag;
659
+ } & TilePropsPartial>;
660
+ FeatureSupportCheck: React_2.ComponentType<{}>;
661
+ };
662
+
663
+ export declare const TivioContext: React_2.Context<RemoteBundleState | null>;
664
+
665
+ export declare type TivioGetters = {
666
+ isTivioLoaded: (cb: (isLoaded: boolean) => void) => boolean;
667
+ isSignedIn: () => boolean;
668
+ /**
669
+ * Get channel by its id.
670
+ * @param channelId - channel id
671
+ * @returns {Promise<Channel | null>} channel or null if channel does not exists
672
+ */
673
+ getChannelById: (channelId: string) => Promise<Channel | null>;
674
+ /**
675
+ * Get (or create) player wrapper instance
676
+ * @param opt - player getter options
677
+ * @returns {PlayerWrapper} player wrapper instance
678
+ */
679
+ getPlayerWrapper: (opt: {
680
+ playerWrapperId?: string;
681
+ }) => PlayerWrapper;
682
+ getOrganizationScreens: () => Promise<Screen_2[]>;
683
+ getOrganizationSubscriptions: () => Promise<Monetization[] | undefined>;
684
+ /**
685
+ * Get section by its id.
686
+ * @param sectionId - section id
687
+ * @returns {Promise<{section: Section, channel: Channel} | null>} section and channel or null if channel or section does not exists
688
+ */
689
+ getSectionById: (sectionId: string) => Promise<Section | null>;
690
+ /**
691
+ * Get video by its id.
692
+ * @param videoId - video id
693
+ * @returns {Promise<Video | null>} video or null if video does not exists
694
+ */
695
+ getVideoById: (videoId: string) => Promise<Video | null>;
696
+ /**
697
+ * Get widget by its id.
698
+ * @param widgetId - widget id
699
+ * @returns {Promise<Widget | null>} widget or null if widget does not exists
700
+ */
701
+ getWidgetById: (widgetId: string) => Promise<Widget | null>;
702
+ /**
703
+ * Get player capabilities based on user's browser and OS as resolved by Tivio.
704
+ * @returns PlayerCapability[]
705
+ */
706
+ getPlayerCapabilities: () => PlayerCapability[];
707
+ };
708
+
709
+ export declare type TivioHooks = {
710
+ useAd: () => [(AdSource | null)];
711
+ useAdSegment: () => AdSegment | null;
712
+ useCancelSubscription: UseCancelSubscription;
713
+ useItemsInRow: (rowId: string, options: PaginationOptions) => {
714
+ pagination: PaginationInterface<ItemsInRow> | null;
715
+ error: Error | null;
716
+ };
717
+ usePurchaseRecovery: () => {
718
+ purchaseRecoveryResult?: string;
719
+ loading: boolean;
720
+ error?: GenericOnCallError;
721
+ purchaseRecovery: (monetizationId: string) => void;
722
+ };
723
+ useRowsInScreen: (screenId: string, options: PaginationOptions) => {
724
+ pagination: PaginationInterface<Row> | null;
725
+ error: Error | null;
726
+ };
727
+ useTaggedVideos: (tagIds: string[], options: SubscribeToItemsInRowOptions) => {
728
+ pagination: PaginationInterface<Video> | null;
729
+ error: Error | null;
730
+ };
731
+ useSearch: UseSearch;
732
+ useVideo: (videoId: string) => {
733
+ data: Video | null;
734
+ error: string | null;
735
+ };
736
+ useVoucher: (voucherId: string) => any;
737
+ /**
738
+ * @deprecated will be removed in version
739
+ */
740
+ useLastVideoByWidgetId: (widgetId: string) => Video | null;
741
+ useWatchWithoutAdsOffer: () => {
742
+ canPurchaseWatchWithoutAds: boolean;
743
+ showPurchaseDialog: () => void;
744
+ };
745
+ useApplyInviteCode: () => {
746
+ applyInviteCodeResult?: boolean;
747
+ loading: boolean;
748
+ error?: GenericOnCallError;
749
+ applyInviteCode: (code: string) => void;
750
+ inviteCodeReset: () => void;
751
+ };
752
+ };
753
+
754
+ export declare type TivioInternalComponents = {
755
+ PrimaryButton: React_2.ComponentType;
756
+ WebLandingScreen: React_2.ComponentType<{
757
+ logo?: string;
758
+ }>;
759
+ WebVideoScreen: React_2.ComponentType<{
760
+ videoId: string;
761
+ }>;
762
+ WebSeriesDetailScreen: React_2.ComponentType<WebSeriesDetailScreenProps>;
763
+ };
764
+
765
+ export declare type TivioInternalHooks = {
766
+ useAuthOverlay: () => AuthOverlayState;
767
+ useSubscriptionsOverlay: () => SubscriptionOverlayState;
768
+ useQerkoOverlay: () => QerkoOverlayState;
769
+ usePurchasesWithVideos: () => {
770
+ purchases: Purchase_2[];
771
+ };
772
+ useOrganizationSubscriptions: () => {
773
+ subscriptions: Monetization[];
774
+ };
775
+ useIsMonetizationPurchased: () => {
776
+ isOneOfSubscriptionPurchased: (subscriptionIds: string[]) => boolean;
777
+ };
778
+ useReferralInfo: any;
779
+ useTvChannel: UseTvChannel;
780
+ useChannelSource: UseChannelSource;
781
+ useUser: () => {
782
+ user: User | null;
783
+ error: string | null;
784
+ isInitialized: boolean;
785
+ };
786
+ };
787
+
788
+ export declare type TivioInternalProviders = {
789
+ AppThemeProvider: React_2.ComponentType;
790
+ AuthOverlayContextProvider: React_2.ComponentType;
791
+ CustomerProvider: React_2.ComponentType<{
792
+ customer: CUSTOMER_BUILD;
793
+ platform: PLATFORM;
794
+ children: any;
795
+ }>;
796
+ ConfigProvider: React_2.ComponentType;
797
+ UserContextProvider: React_2.ComponentType;
798
+ SubscriptionOverlayContextProvider: React_2.ComponentType;
799
+ QerkoOverlayContextProvider: React_2.ComponentType;
800
+ PurchasesWithVideosContextProvider: React_2.ComponentType;
801
+ OrganizationSubscriptionsContextProvider: React_2.ComponentType;
802
+ RouterOverridesContextProvider: React_2.ComponentType<RouterOverridesContextState>;
803
+ };
804
+
805
+ export declare const TivioProvider: React_2.FC<TivioProviderProps>;
806
+
807
+ export declare type TivioProviderProps = {
808
+ /**
809
+ * This prop must be set only once and not change value afterwards
810
+ */
811
+ conf: Config | undefined | null;
812
+ children: React_2.ReactNode;
813
+ };
814
+
815
+ export declare type TivioSources = {
816
+ AdSource: any;
817
+ ChannelSource: any;
818
+ VodExternalSource: any;
819
+ VodTivioSource: any;
820
+ };
821
+
822
+ export declare type TivioSubscriptions = {
823
+ subscribeToUser: (cb: (error: string | null, user: User | null) => void) => void;
824
+ /**
825
+ * Listen to widget changes.
826
+ * @param widgetId - widget id
827
+ * @param cb - callback on widget updates or on error
828
+ */
829
+ subscribeToWidget: (widgetId: string, cb: (error: Error | null, data: Widget | null, disposer?: Disposer) => void) => void;
830
+ /**
831
+ * Listen to channel changes.
832
+ * @param channelId - channel id
833
+ * @param cb - callback on channel updates or on error
834
+ */
835
+ subscribeToChannel: (channelId: string, cb: (error: Error | null, data: Channel | null) => void) => void;
836
+ /**
837
+ * Listen to section changes.
838
+ * @param sectionId - section id
839
+ * @param cb - callback on section updates or on error
840
+ */
841
+ subscribeToSection: (sectionId: string, cb: (error: Error | null, data: Section | null) => void) => void;
842
+ /**
843
+ * Listen to video changes.
844
+ * @param videoId - video id
845
+ * @param cb - callback on video updates or on error
846
+ */
847
+ subscribeToVideo: (videoId: string, cb: (error: Error | null, data: Video | null, disposer?: Disposer) => void) => void;
848
+ /**
849
+ * Listen to videos in section changes.
850
+ * @param sectionId - section id
851
+ * @param cb - callback on videos change or error
852
+ * @param limit - videos count
853
+ */
854
+ subscribeToVideosInSection: (sectionId: string, cb: (error: null | Error, data: null | {
855
+ videos: Video[];
856
+ hasNextPage: boolean;
857
+ }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
858
+ /**
859
+ * Listen to section in channel changes
860
+ * @param channelId - channel id
861
+ * @param cb - callback on sections change or error
862
+ * @param limit - sections count
863
+ */
864
+ subscribeToSectionsInChannel: (channelId: string, cb: (error: null | Error, data: null | {
865
+ sections: Section[];
866
+ hasNextPage: boolean;
867
+ }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
868
+ /**
869
+ * Listen to channels in widget changes
870
+ * @param widgetId - widget id
871
+ * @param cb - callback on channels change or error
872
+ * @param limit - channels count
873
+ */
874
+ subscribeToChannelsInWidget: (widgetId: string, cb: (error: null | Error, data: null | {
875
+ channels: Channel[];
876
+ hasNextPage: boolean;
877
+ }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
878
+ subscribeToScreen: SubscribeToScreen;
879
+ subscribeToItemsInRow: SubscribeToItemsInRow;
880
+ subscribeToRowsInScreen: SubscribeToRowsInScreen;
881
+ subscribeToTaggedVideos: SubscribeToTaggedVideos;
882
+ registerOverlayCallbacks: (callbacks: {
883
+ onShow: () => void;
884
+ onHide: () => void;
885
+ }) => void;
886
+ };
887
+
888
+ export declare const TivioWidget: React_2.ForwardRefExoticComponent<Pick<TivioWidgetProps, "id" | "onEnabled" | "onBlur"> & React_2.RefAttributes<TivioWidgetRef>>;
889
+
890
+ export declare const TivioWidgetError: React_2.FC<TivioWidgetErrorProps>;
891
+
892
+ declare type TivioWidgetErrorProps = {
893
+ error: string | null;
894
+ };
895
+
896
+ export declare const TivioWidgetLoader: React_2.FC;
897
+
898
+ export declare interface TivioWidgetProps {
899
+ id: string;
900
+ ref: React_2.MutableRefObject<TivioWidgetRef>;
901
+ onEnabled?: (enabled: boolean) => any;
902
+ onBlur?: (event: {
903
+ key: string;
904
+ width: number;
905
+ x: number;
906
+ }) => any;
907
+ }
908
+
909
+ export declare interface TivioWidgetRef {
910
+ focus: (args: {
911
+ x?: number;
912
+ }) => void;
913
+ handleKey: (key: string) => ({
914
+ handled: boolean;
915
+ x: number;
916
+ });
917
+ unfocus: () => ({
918
+ x: number;
919
+ });
920
+ }
921
+
922
+ declare type TransactionInfo = {
923
+ type: 'transaction';
924
+ name: string;
925
+ videoId: string;
926
+ cover: string;
927
+ description: string;
928
+ };
929
+
930
+ export declare const TvTivioProvider: React_2.FC<TivioProviderProps>;
931
+
932
+ export declare const useAd: () => AdSource | null;
933
+
934
+ export declare const useAdSegment: () => {
935
+ id: string;
936
+ remainingMs: number;
937
+ secondsToEnd: number;
938
+ secondsToSkippable: number | null;
939
+ canSeek: boolean;
940
+ canSkip: boolean;
941
+ isSkippable: boolean;
942
+ skip: () => any;
943
+ } | null;
944
+
945
+ /**
946
+ * Is used to login user through different device in which user is already logged in.
947
+ * (e.g. login in tv app through web app)
948
+ *
949
+ * @return applyInviteCodeResult - true if code was applied successfully, false otherwise.
950
+ * loading - loading state
951
+ * error - error in case request failure
952
+ * applyInviteCode - function to apply invite code
953
+ * inviteCodeReset - function to reset to initial state
954
+ */
955
+ export declare function useApplyInviteCode(): {
956
+ applyInviteCodeResult?: boolean | undefined;
957
+ loading: boolean;
958
+ error?: GenericOnCallError | undefined;
959
+ applyInviteCode: (code: string) => void;
960
+ inviteCodeReset: () => void;
961
+ };
962
+
963
+ export declare const useBetOffer: () => BetOffer | null;
964
+
965
+ export declare const useCancelSubscription: UseCancelSubscription;
966
+
967
+ /**
968
+ * Use channel
969
+ * @param channelId - channel id
970
+ */
971
+ export declare const useChannel: (channelId: string) => {
972
+ error: string | null;
973
+ data: Channel | null;
974
+ };
975
+
976
+ /**
977
+ * Use channels in widget
978
+ * @param widgetId - widget id
979
+ * @param [limit] - channels count, defaults to 10
980
+ */
981
+ export declare const useChannelsInWidget: (widgetId: string, limit?: number) => {
982
+ error: Error | null;
983
+ data: PaginationData<Channel_2> | null;
984
+ isLoading: boolean;
985
+ };
986
+
987
+ export declare const useCurrentMarker: () => Marker | null;
988
+
989
+ export declare const useFreePurchase: () => {
990
+ purchase: (monetizationId: string) => Promise<void>;
991
+ };
992
+
993
+ export declare const useIntro: () => IntroMarker | null;
994
+
995
+ export declare const useIsLoaded: () => {
996
+ isTivioLoaded: boolean;
997
+ };
998
+
999
+ export declare const useIsMonetizationPurchased: () => {
1000
+ isOneOfSubscriptionPurchased: (subscriptionIds: string[]) => boolean;
1001
+ };
1002
+
1003
+ /**
1004
+ * Use row items
1005
+ * @param rowId - row ID
1006
+ * @param options - subscription options
1007
+ */
1008
+ export declare const useItemsInRow: (rowId: string, options?: SubscribeToItemsInRowOptions) => {
1009
+ pagination: PaginationInterface<ItemsInRow> | null;
1010
+ error: Error | null;
1011
+ };
1012
+
1013
+ /**
1014
+ * @deprecated will be removed in v4
1015
+ */
1016
+ export declare function useLastVideoByWidgetId(widgetId: string): Video | null;
1017
+
1018
+ export declare const useMarkers: () => Marker[] | null;
1019
+
1020
+ export declare const useOrganizationSubscriptions: () => {
1021
+ subscriptions: Monetization[];
1022
+ };
1023
+
1024
+ export declare type UsePlayerEvent = <T = any>(eventName: string) => T | null;
1025
+
1026
+ export declare const usePlayerEvent: UsePlayerEvent;
1027
+
1028
+ /**
1029
+ * Is used to mark purchase in recovery state as PAID.
1030
+ *
1031
+ * @return purchaseRecoveryResult - message describing result of the recovery
1032
+ * loading - loading state
1033
+ * error - error in case request failure
1034
+ * purchaseRecovery - functions to execute purchase recovery
1035
+ */
1036
+ export declare function usePurchaseRecovery(): {
1037
+ purchaseRecoveryResult?: string | undefined;
1038
+ loading: boolean;
1039
+ error?: GenericOnCallError | undefined;
1040
+ purchaseRecovery: (monetizationId: string) => void;
1041
+ };
1042
+
1043
+ export declare const usePurchaseSubscription: (monetizationId: string, voucher?: NewVoucher | undefined) => QerkoTransaction;
1044
+
1045
+ /**
1046
+ * Return purchases with initialized video (purchases[i].video not null)
1047
+ */
1048
+ export declare const usePurchasesWithVideos: () => {
1049
+ purchases: Purchase_3[];
1050
+ };
1051
+
1052
+ export { User }
1053
+
1054
+ export declare const useRowsInScreen: (screenId: string, options?: PaginationOptions) => {
1055
+ pagination: PaginationInterface<Row> | null;
1056
+ error: Error | null;
1057
+ };
1058
+
1059
+ export declare type UserPayload = Record<string, any>;
1060
+
1061
+ /**
1062
+ * @deprecated
1063
+ *
1064
+ * Use app screen
1065
+ * @param screenId - screen ID
1066
+ * @param options - subscribe to screen options
1067
+ */
1068
+ export declare const useScreen: (screenId: string, options?: ScreenOptions | undefined) => never;
1069
+
1070
+ export declare const useScreens: () => {
1071
+ screens: Screen_2[];
1072
+ };
1073
+
1074
+ /**
1075
+ * Full text search that returns entities based on search query.
1076
+ * @param indexName - index that search would be performed on ('videos', 'tags', etc.)
1077
+ * @param options - pagination options
1078
+ */
1079
+ export declare const useSearch: UseSearch;
1080
+
1081
+ /**
1082
+ * Use section
1083
+ * @param sectionId - section id
1084
+ */
1085
+ export declare const useSection: (sectionId: string) => {
1086
+ error: string | null;
1087
+ data: Section | null;
1088
+ };
1089
+
1090
+ /**
1091
+ * Use section in channel
1092
+ * @param channelId - channel id
1093
+ * @param [limit] - sections count, defaults to 10
1094
+ */
1095
+ export declare const useSectionsInChannel: (channelId: string, limit?: number) => {
1096
+ error: Error | null;
1097
+ data: PaginationData<Section_2> | null;
1098
+ isLoading: boolean;
1099
+ };
1100
+
1101
+ export declare const useSeekState: () => boolean | null;
1102
+
1103
+ /**
1104
+ * Returns videos with given tag ids
1105
+ * @param tagIds - tag ids
1106
+ * @param options - subscription options
1107
+ */
1108
+ export declare const useTaggedVideos: (tagIds: string[], options?: SubscribeToItemsInRowOptions) => {
1109
+ pagination: PaginationInterface<Video> | null;
1110
+ error: Error | null;
1111
+ };
1112
+
1113
+ export declare const useTivioData: () => RemoteBundleState;
1114
+
1115
+ export declare const useTivioReadyData: () => RemoteBundleState | null;
1116
+
1117
+ export declare const useTransactionPayment: (videoId: string, monetizationId: string, voucher?: NewVoucher | undefined) => QerkoTransaction;
1118
+
1119
+ export declare const useUser: () => {
1120
+ user: User_2 | null;
1121
+ error: string | null;
1122
+ isInitialized: boolean;
1123
+ };
1124
+
1125
+ /**
1126
+ * Use video
1127
+ * @param videoId - video id
1128
+ */
1129
+ export declare const useVideo: (videoId?: string | undefined) => {
1130
+ data: Video | null;
1131
+ error: string | null;
1132
+ };
1133
+
1134
+ /**
1135
+ * Use videos in section
1136
+ * @param sectionId - section id
1137
+ * @param [limit] - videos count, defaults to 10
1138
+ */
1139
+ export declare const useVideosInSection: (sectionId?: string | undefined, limit?: number) => {
1140
+ error: Error | null;
1141
+ data: PaginationData<Video> | null;
1142
+ isLoading: boolean;
1143
+ };
1144
+
1145
+ export declare const useVoucher: (voucherId: string) => {
1146
+ activate: (() => Promise<void>) | null;
1147
+ voucher: Voucher | null;
1148
+ /**
1149
+ * You can check error.details if you need to know error type when you want your own error messages
1150
+ * (can be one of "DOES_NOT_EXIST", "EXPIRED" and "ALREADY_USED").
1151
+ */
1152
+ error: Error | BadRequestError | null;
1153
+ /**
1154
+ * True if voucher has been successfully activated in current session.
1155
+ */
1156
+ activationSuccess: boolean;
1157
+ };
1158
+
1159
+ export declare const useWatchWithoutAdsOffer: () => {
1160
+ canPurchaseWatchWithoutAds: boolean;
1161
+ showPurchaseDialog: () => void;
1162
+ };
1163
+
1164
+ /**
1165
+ * Use widget
1166
+ * @param widgetId - widget id
1167
+ */
1168
+ export declare const useWidget: (widgetId: string) => {
1169
+ error: string;
1170
+ widget: Widget | null;
1171
+ };
1172
+
1173
+ export { Video }
1174
+
1175
+ declare type VideoPath = string;
1176
+
1177
+ export declare const VideosContext: React_2.Context<DataState<Video>>;
1178
+
1179
+ export declare type VodExternalSource = {
1180
+ new (uri: string, monetizationId: string, name: string, description: string, originalOptions: Record<string, any>): VodTivioSource;
1181
+ type: 'vod_external';
1182
+ description: string;
1183
+ name: string;
1184
+ uri: string;
1185
+ };
1186
+
1187
+ export declare type VodTivioSource = {
1188
+ new (uri: string, videoId: string, name: string, description: string, adMonetizationId?: string): VodTivioSource;
1189
+ type: 'vod_tivio';
1190
+ description: string;
1191
+ name: string;
1192
+ uri: string;
1193
+ };
1194
+
1195
+ export declare interface VodTivioSourcePojo {
1196
+ type: 'VodTivioSource';
1197
+ description: string;
1198
+ path: string;
1199
+ name: string;
1200
+ uri: string;
1201
+ poster?: string;
1202
+ adMonetizationId?: string;
1203
+ }
1204
+
1205
+ /**
1206
+ * TODO: Should be in core-js, we can't import types from it, though.
1207
+ */
1208
+ declare type Voucher = {
1209
+ activate: () => void;
1210
+ isUsed: boolean;
1211
+ isExpired: boolean;
1212
+ status: 'NEW' | 'USED';
1213
+ voucherInfo: SubscriptionInfo | TransactionInfo;
1214
+ };
1215
+
1216
+ export declare interface WebPlayerProps {
1217
+ id: string;
1218
+ source?: VodTivioSourcePojo | ChannelSourcePojo | VideoPath | null;
1219
+ onEnded?: () => any;
1220
+ /**
1221
+ * If this function is specified, then "Back" button is shown in top right corner.
1222
+ */
1223
+ onBack?: () => void;
1224
+ className?: string;
1225
+ /**
1226
+ * default false
1227
+ *
1228
+ * If you choose `autoplay` make sure that autoplay is allowed in the specific situation.
1229
+ * In some cases it may not be allowed, e.g. before the user interacted with the site, and the video
1230
+ * will stay paused.
1231
+ *
1232
+ * Source: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
1233
+ */
1234
+ autoplay?: boolean;
1235
+ /**
1236
+ * default false
1237
+ */
1238
+ canReplay?: boolean;
1239
+ /**
1240
+ * default false
1241
+ */
1242
+ showMarkers?: boolean;
1243
+ /**
1244
+ * number[] is array of keyboard event.which numeric codes
1245
+ * (see https://keycode.info/)
1246
+ */
1247
+ customShortcuts?: Partial<{
1248
+ toggleFullscreen: number[];
1249
+ togglePause: number[];
1250
+ toggleMute: number[];
1251
+ jumpForward: number[];
1252
+ jumpBack: number[];
1253
+ volumeUp: number[];
1254
+ volumeDown: number[];
1255
+ }>;
1256
+ /**
1257
+ * default true
1258
+ */
1259
+ enableKeyboardShortcuts?: boolean;
1260
+ onProgress?: (event: React_2.ChangeEvent<HTMLVideoElement>) => void;
1261
+ /**
1262
+ * @deprecated this callback is never called. Will be removed in @tivio/sdk-react version 4
1263
+ */
1264
+ onPlayerControllerCreated?: (playerController: any) => void;
1265
+ }
1266
+
1267
+ export declare type Widget = {
1268
+ id: string;
1269
+ channels: Channel[];
1270
+ isEnabled: boolean | null;
1271
+ name: string | null;
1272
+ recentVideos: Video[] | null;
1273
+ widgetId: string | null;
1274
+ lastVideo: Video | null;
1275
+ };
1276
+
1277
+ export declare function withPlayerContext(id: string): <P>(WrappedComponent: React_2.ComponentType<P>) => (props: P) => JSX.Element;
1278
+
1279
+ export { }